fix: Trigger campaigns only during business hours (#3085)

Fixes #2433
This commit is contained in:
Muhsin Keloth 2021-10-12 17:58:33 +05:30 committed by GitHub
parent 7c21cf2255
commit 6bfa551c85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 142 additions and 38 deletions

View file

@ -19,12 +19,14 @@ import Router from './views/Router';
import { getLocale } from './helpers/urlParamsHelper';
import { BUS_EVENTS } from 'shared/constants/busEvents';
import { isEmptyObject } from 'widget/helpers/utils';
import availabilityMixin from 'widget/mixins/availability';
export default {
name: 'App',
components: {
Router,
},
mixins: [availabilityMixin],
data() {
return {
showUnreadView: false,
@ -219,7 +221,11 @@ export default {
this.scrollConversationToBottom();
} else if (message.event === 'change-url') {
const { referrerURL, referrerHost } = message;
this.initCampaigns({ currentURL: referrerURL, websiteToken });
this.initCampaigns({
currentURL: referrerURL,
websiteToken,
isInBusinessHours: this.isInBusinessHours,
});
window.referrerURL = referrerURL;
bus.$emit(BUS_EVENTS.SET_REFERRER_HOST, referrerHost);
} else if (message.event === 'toggle-close-button') {