From e8cf59c661aaba0531c6b912a97b04e6c8bcfbff Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Sat, 29 Feb 2020 11:27:02 +0530 Subject: [PATCH] Feature: Alert widget user when message is received from agent (#571) --- app/javascript/dashboard/assets/audio/ding.mp3 | Bin 20040 -> 0 bytes app/javascript/shared/assets/audio/ding.mp3 | Bin 0 -> 2667 bytes .../shared/helpers/AudioNotificationHelper.js | 9 +++++++++ .../widget/store/modules/conversation.js | 5 +++++ .../modules/specs/conversation/actions.spec.js | 13 +++++++++++++ 5 files changed, 27 insertions(+) delete mode 100644 app/javascript/dashboard/assets/audio/ding.mp3 create mode 100644 app/javascript/shared/assets/audio/ding.mp3 create mode 100644 app/javascript/shared/helpers/AudioNotificationHelper.js diff --git a/app/javascript/dashboard/assets/audio/ding.mp3 b/app/javascript/dashboard/assets/audio/ding.mp3 deleted file mode 100644 index 1c4921711b56b46d87e0978fc0221e21854a9353..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20040 zcmdqIN|gG$JY{E+HvBBRj94 zxU{0GwxOxzednj%fuWJH$*I}-rIocG+q(yc$A8W)ude^y-rfH#F*Rv*c>x|VQ4etG z0}_t{01zuMVOoR$!2P!xN(q|rR1d%S|IrI|qj#@AlXVuat-?B&4=doX$Ao3K}LH1NdiscH$mKch2}i- z-{Bu4c;BCh%Yl%u3wxpxfktqgv_f;#gp=3@)=XEt$6H@(b z5Avnv)GGzn@f5G=KW_qCCe3cgu*qj#K$-py9lOuxMqfvM+*{Wa2z(=hdL{Zf4ITTL zFj^{7M)kqu|(qN_Ey>xrSV9edMGk z^;iAm1IenNYV;D=z>6ib@0M?x3H+&r*zQahPe*3`{Q1;87+L;2j=36+XbUws>$YC~ zz|#094?8&0`QgNgF(Tnw0KfnQ6U1UniH+k;y-?$WclSuUAd%#}aDbY(xc4(JqBli& zT6uz3BG^>hK(ePFpzaX`D*9-^dOciVKbtWm?<>5&)PK(~AwbG@OOJyBDHA3f10$Tk z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wkf~R1S;;JGt$I{?o^!5w z`mrdtpt|T!RZC#sCqAAl2T~5*zhYZMn;EEC`{pe}&Y;u{zQX;ZDW^s*F#RN7t~mRw z;=?h|Fd1ek){upQr(bE&pmyxuc9)M<_PH~2Ml9-ETDE)_H4rYL8+6=nygg)I5GJqN zHtsQMGdmG{peHWlWkQu@*-%$P1- { + try { + new Audio(notificationAudio).play(); + } catch (error) { + console.log(error); + } +}; diff --git a/app/javascript/widget/store/modules/conversation.js b/app/javascript/widget/store/modules/conversation.js index 34d8688bf..47ed94656 100755 --- a/app/javascript/widget/store/modules/conversation.js +++ b/app/javascript/widget/store/modules/conversation.js @@ -2,6 +2,7 @@ import Vue from 'vue'; import { sendMessageAPI, getConversationAPI } from 'widget/api/conversation'; import { MESSAGE_TYPE } from 'widget/helpers/constants'; +import { playNotificationAudio } from 'shared/helpers/AudioNotificationHelper'; import getUuid from '../../helpers/uuid'; import DateHelper from '../../../shared/helpers/DateHelper'; @@ -93,6 +94,10 @@ export const actions = { }, addMessage({ commit }, data) { + if (data.message_type === MESSAGE_TYPE.OUTGOING) { + playNotificationAudio(); + } + commit('pushMessageToConversation', data); }, }; diff --git a/app/javascript/widget/store/modules/specs/conversation/actions.spec.js b/app/javascript/widget/store/modules/specs/conversation/actions.spec.js index 56b50f7f1..1482d276c 100644 --- a/app/javascript/widget/store/modules/specs/conversation/actions.spec.js +++ b/app/javascript/widget/store/modules/specs/conversation/actions.spec.js @@ -1,7 +1,11 @@ +import { playNotificationAudio } from 'shared/helpers/AudioNotificationHelper'; import { actions } from '../../conversation'; import getUuid from '../../../../helpers/uuid'; jest.mock('../../../../helpers/uuid'); +jest.mock('shared/helpers/AudioNotificationHelper', () => ({ + playNotificationAudio: jest.fn(), +})); const commit = jest.fn(); @@ -11,6 +15,15 @@ describe('#actions', () => { actions.addMessage({ commit }, { id: 1 }); expect(commit).toBeCalledWith('pushMessageToConversation', { id: 1 }); }); + + it('plays audio when agent sends a message', () => { + actions.addMessage({ commit }, { id: 1, message_type: 1 }); + expect(playNotificationAudio).toBeCalled(); + expect(commit).toBeCalledWith('pushMessageToConversation', { + id: 1, + message_type: 1, + }); + }); }); describe('#sendMessage', () => {