The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/ee/app/livechat-enterprise/server/startup.js

36 lines
1.4 KiB

import { Meteor } from 'meteor/meteor';
import { settings } from '../../../../app/settings';
import { updatePredictedVisitorAbandonment } from './lib/Helper';
import { VisitorInactivityMonitor } from './lib/VisitorInactivityMonitor';
import './lib/query.helper';
import { MultipleBusinessHoursBehavior } from './business-hour/Multiple';
import { SingleBusinessHourBehavior } from '../../../../app/livechat/server/business-hour/Single';
import { businessHourManager } from '../../../../app/livechat/server/business-hour';
import { resetDefaultBusinessHourIfNeeded } from './business-hour/Helper';
const visitorActivityMonitor = new VisitorInactivityMonitor();
const businessHours = {
Multiple: new MultipleBusinessHoursBehavior(),
Single: new SingleBusinessHourBehavior(),
};
Meteor.startup(async function() {
settings.onload('Livechat_abandoned_rooms_action', function(_, value) {
updatePredictedVisitorAbandonment();
if (!value || value === 'none') {
return visitorActivityMonitor.stop();
}
visitorActivityMonitor.start();
});
settings.onload('Livechat_visitor_inactivity_timeout', function() {
updatePredictedVisitorAbandonment();
});
settings.onload('Livechat_business_hour_type', (_, value) => {
businessHourManager.registerBusinessHourBehavior(businessHours[value]);
if (settings.get('Livechat_enable_business_hours')) {
businessHourManager.startManager();
}
});
await resetDefaultBusinessHourIfNeeded();
});