feat: Adds sound alert notification for new messages on the widget (#3181)
* feat: Adds sound alert notification for new messages on the widget * Review fixes * uses absolute path * Minor fixes Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import VueI18n from 'vue-i18n';
|
|||||||
import store from '../widget/store';
|
import store from '../widget/store';
|
||||||
import App from '../widget/App.vue';
|
import App from '../widget/App.vue';
|
||||||
import ActionCableConnector from '../widget/helpers/actionCable';
|
import ActionCableConnector from '../widget/helpers/actionCable';
|
||||||
|
import { getAlertAudio } from 'shared/helpers/AudioNotificationHelper';
|
||||||
import i18n from '../widget/i18n';
|
import i18n from '../widget/i18n';
|
||||||
|
|
||||||
Vue.use(VueI18n);
|
Vue.use(VueI18n);
|
||||||
@@ -30,4 +31,5 @@ window.onload = () => {
|
|||||||
window.WOOT_WIDGET,
|
window.WOOT_WIDGET,
|
||||||
window.chatwootPubsubToken
|
window.chatwootPubsubToken
|
||||||
);
|
);
|
||||||
|
getAlertAudio();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,3 +94,7 @@ export const newMessageNotification = data => {
|
|||||||
showBadgeOnFavicon();
|
showBadgeOnFavicon();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const playNewMessageNotificationInWidget = () => {
|
||||||
|
window.playAudioAlert();
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import BaseActionCableConnector from '../../shared/helpers/BaseActionCableConnector';
|
import BaseActionCableConnector from '../../shared/helpers/BaseActionCableConnector';
|
||||||
|
import { playNewMessageNotificationInWidget } from 'shared/helpers/AudioNotificationHelper';
|
||||||
|
|
||||||
class ActionCableConnector extends BaseActionCableConnector {
|
class ActionCableConnector extends BaseActionCableConnector {
|
||||||
constructor(app, pubsubToken) {
|
constructor(app, pubsubToken) {
|
||||||
@@ -36,6 +37,9 @@ class ActionCableConnector extends BaseActionCableConnector {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
window.bus.$emit('on-agent-message-received');
|
window.bus.$emit('on-agent-message-received');
|
||||||
});
|
});
|
||||||
|
if (data.sender_type === 'User') {
|
||||||
|
playNewMessageNotificationInWidget();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMessageUpdated = data => {
|
onMessageUpdated = data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user