chore: Use different files for widget and dashboard audio alert (#4637)
This commit is contained in:
parent
ef850eda0f
commit
2e0d43c093
8 changed files with 7 additions and 7 deletions
|
@ -121,7 +121,7 @@ export const IFrameHelper = {
|
|||
|
||||
setupAudioListeners: () => {
|
||||
const { baseUrl = '' } = window.$chatwoot;
|
||||
getAlertAudio(baseUrl).then(() =>
|
||||
getAlertAudio(baseUrl, 'widget').then(() =>
|
||||
initOnEvents.forEach(event => {
|
||||
document.removeEventListener(
|
||||
event,
|
||||
|
|
|
@ -4,7 +4,7 @@ import { IFrameHelper } from 'widget/helpers/utils';
|
|||
import { showBadgeOnFavicon } from './faviconHelper';
|
||||
|
||||
export const initOnEvents = ['click', 'touchstart', 'keypress', 'keydown'];
|
||||
export const getAlertAudio = async (baseUrl = '') => {
|
||||
export const getAlertAudio = async (baseUrl = '', type = 'dashboard') => {
|
||||
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||
const playsound = audioBuffer => {
|
||||
window.playAudioAlert = () => {
|
||||
|
@ -17,7 +17,7 @@ export const getAlertAudio = async (baseUrl = '') => {
|
|||
};
|
||||
|
||||
try {
|
||||
const resourceUrl = `${baseUrl}/dashboard/audios/ding.mp3`;
|
||||
const resourceUrl = `${baseUrl}/audio/${type}/ding.mp3`;
|
||||
const audioRequest = new Request(resourceUrl);
|
||||
|
||||
fetch(audioRequest)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue