fix: Add base_url to the audio notification file (#4116)
This commit is contained in:
parent
647efa12e7
commit
3c3b6f90c7
7 changed files with 9 additions and 4 deletions
|
@ -255,7 +255,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onDateRangeChange() {
|
onDateRangeChange() {
|
||||||
console.log(this.from, this.to);
|
|
||||||
this.$emit('date-range-change', {
|
this.$emit('date-range-change', {
|
||||||
from: this.from,
|
from: this.from,
|
||||||
to: this.to,
|
to: this.to,
|
||||||
|
|
|
@ -119,7 +119,8 @@ export const IFrameHelper = {
|
||||||
},
|
},
|
||||||
|
|
||||||
setupAudioListeners: () => {
|
setupAudioListeners: () => {
|
||||||
getAlertAudio().then(() =>
|
const { baseUrl = '' } = window.$chatwoot;
|
||||||
|
getAlertAudio(baseUrl).then(() =>
|
||||||
initOnEvents.forEach(event => {
|
initOnEvents.forEach(event => {
|
||||||
document.removeEventListener(
|
document.removeEventListener(
|
||||||
event,
|
event,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { IFrameHelper } from 'widget/helpers/utils';
|
||||||
import { showBadgeOnFavicon } from './faviconHelper';
|
import { showBadgeOnFavicon } from './faviconHelper';
|
||||||
|
|
||||||
export const initOnEvents = ['click', 'touchstart', 'keypress'];
|
export const initOnEvents = ['click', 'touchstart', 'keypress'];
|
||||||
export const getAlertAudio = async () => {
|
export const getAlertAudio = async (baseUrl = '') => {
|
||||||
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
const playsound = audioBuffer => {
|
const playsound = audioBuffer => {
|
||||||
window.playAudioAlert = () => {
|
window.playAudioAlert = () => {
|
||||||
|
@ -17,7 +17,8 @@ export const getAlertAudio = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const audioRequest = new Request('/dashboard/audios/ding.mp3');
|
const resourceUrl = `${baseUrl}/dashboard/audios/ding.mp3`;
|
||||||
|
const audioRequest = new Request(resourceUrl);
|
||||||
|
|
||||||
fetch(audioRequest)
|
fetch(audioRequest)
|
||||||
.then(response => response.arrayBuffer())
|
.then(response => response.arrayBuffer())
|
||||||
|
|
|
@ -82,6 +82,7 @@ Rails.application.configure do
|
||||||
allow do
|
allow do
|
||||||
origins '*'
|
origins '*'
|
||||||
resource '/packs/*', headers: :any, methods: [:get, :options]
|
resource '/packs/*', headers: :any, methods: [:get, :options]
|
||||||
|
resource '/dashboard/audios/ding.mp3', headers: :any, methods: [:get, :options]
|
||||||
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'uid', 'expiry']
|
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'uid', 'expiry']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,6 +121,7 @@ Rails.application.configure do
|
||||||
allow do
|
allow do
|
||||||
origins '*'
|
origins '*'
|
||||||
resource '/packs/*', headers: :any, methods: [:get, :options]
|
resource '/packs/*', headers: :any, methods: [:get, :options]
|
||||||
|
resource '/dashboard/audios/ding.mp3', headers: :any, methods: [:get, :options]
|
||||||
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('CW_API_ONLY_SERVER', false))
|
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('CW_API_ONLY_SERVER', false))
|
||||||
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'uid', 'expiry']
|
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'uid', 'expiry']
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,6 +87,7 @@ Rails.application.configure do
|
||||||
allow do
|
allow do
|
||||||
origins '*'
|
origins '*'
|
||||||
resource '/packs/*', headers: :any, methods: [:get, :options]
|
resource '/packs/*', headers: :any, methods: [:get, :options]
|
||||||
|
resource '/dashboard/audios/ding.mp3', headers: :any, methods: [:get, :options]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,6 +58,7 @@ Rails.application.configure do
|
||||||
allow do
|
allow do
|
||||||
origins '*'
|
origins '*'
|
||||||
resource '/packs/*', headers: :any, methods: [:get, :options]
|
resource '/packs/*', headers: :any, methods: [:get, :options]
|
||||||
|
resource '/dashboard/audios/ding.mp3', headers: :any, methods: [:get, :options]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue