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/hooks/onCloseLivechat.js

24 lines
786 B

import { callbacks } from '../../../../../app/callbacks';
import { settings } from '../../../../../app/settings';
import { dispatchWaitingQueueStatus } from '../lib/Helper';
import { RoutingManager } from '../../../../../app/livechat/server/lib/RoutingManager';
[NEW][Enterprise] Omnichannel On-Hold Queue (#20945) * Add settings for on-hold feature * Add On-Hold Section within Sidebar * On hold room UI * OnHold - Automatic * Add Manual on-hold button UI * OnHold - manual - Start manual On-Hold timer after agent reply - Stop manual On-Hold timer on visitor message - Show manual On-Hold Option when timer expires * Handle manual On-Hold event * Add permissions to manual on-hold feature * [New] Auto-Close On hold chats * Routing chat when an on-hold get is resumed * Apply suggestions from code review * Apply suggestions from code review * Add migration * Add new endpoint - livechat/placeChatOnHold * Move Resume Button login within livechatReadOnly file * Remove timeout on Manual On-Hold feature - From now on, the On-Hold option will appear within visitor Info panel, provided the agent has sent the last message * Apply suggestions from code review * Move resume On-Hold chat logic inside Queue Manager * Apply suggestions from code review Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com> * Apply suggestions from code review * Use takeInquiry() to resume On-Hold chats * Fix failing test case * Minor improvements. * [Regression] Omnichannel On Hold feature - handle following impacted events - Returning chat to the queue - Forwarding chats - Closing chats * Fix failing test cases * Revert "[Regression] Omnichannel On hold Queue" * Prevent on hold chat from being returned or forwarded (cherry picked from commit 2edcb8234224ebad2b479282da3f9be6a5626db6) * Move checks to Livechat methods * Add releaseOnHoldChat() method * Fix callback returning promise. Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com>
4 years ago
import { LivechatEnterprise } from '../lib/LivechatEnterprise';
const onCloseLivechat = (room) => {
[NEW][Enterprise] Omnichannel On-Hold Queue (#20945) * Add settings for on-hold feature * Add On-Hold Section within Sidebar * On hold room UI * OnHold - Automatic * Add Manual on-hold button UI * OnHold - manual - Start manual On-Hold timer after agent reply - Stop manual On-Hold timer on visitor message - Show manual On-Hold Option when timer expires * Handle manual On-Hold event * Add permissions to manual on-hold feature * [New] Auto-Close On hold chats * Routing chat when an on-hold get is resumed * Apply suggestions from code review * Apply suggestions from code review * Add migration * Add new endpoint - livechat/placeChatOnHold * Move Resume Button login within livechatReadOnly file * Remove timeout on Manual On-Hold feature - From now on, the On-Hold option will appear within visitor Info panel, provided the agent has sent the last message * Apply suggestions from code review * Move resume On-Hold chat logic inside Queue Manager * Apply suggestions from code review Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com> * Apply suggestions from code review * Use takeInquiry() to resume On-Hold chats * Fix failing test case * Minor improvements. * [Regression] Omnichannel On Hold feature - handle following impacted events - Returning chat to the queue - Forwarding chats - Closing chats * Fix failing test cases * Revert "[Regression] Omnichannel On hold Queue" * Prevent on hold chat from being returned or forwarded (cherry picked from commit 2edcb8234224ebad2b479282da3f9be6a5626db6) * Move checks to Livechat methods * Add releaseOnHoldChat() method * Fix callback returning promise. Co-authored-by: Renato Becker <renato.augusto.becker@gmail.com>
4 years ago
Promise.await(LivechatEnterprise.releaseOnHoldChat(room));
if (!settings.get('Livechat_waiting_queue')) {
return room;
}
const { departmentId } = room || {};
if (!RoutingManager.getConfig().autoAssignAgent) {
dispatchWaitingQueueStatus(departmentId);
return room;
}
return room;
};
callbacks.add('livechat.closeRoom', onCloseLivechat, callbacks.priority.HIGH, 'livechat-waiting-queue-monitor-close-room');