@webex/contact-center 3.11.0 → 3.12.0-llmrefactor.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.sdd/manifest.json +882 -0
- package/AGENTS.md +94 -0
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +46 -0
- package/ai-docs/GETTING_STARTED.md +168 -0
- package/ai-docs/GLOSSARY.md +43 -0
- package/ai-docs/README.md +138 -0
- package/ai-docs/REVIEW_CHECKLIST.md +41 -0
- package/ai-docs/RULES.md +444 -0
- package/ai-docs/SECURITY.md +52 -0
- package/ai-docs/SERVICE_STATE.md +48 -0
- package/ai-docs/SPEC_INDEX.md +65 -0
- package/ai-docs/adr/0001-spec-source-policy.md +55 -0
- package/ai-docs/adr/README.md +8 -0
- package/ai-docs/adr/_adr-template.md +31 -0
- package/ai-docs/contact-center-spec.md +341 -0
- package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
- package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
- package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
- package/ai-docs/patterns/event-driven-patterns.md +485 -0
- package/ai-docs/patterns/testing-patterns.md +480 -0
- package/ai-docs/patterns/typescript-patterns.md +365 -0
- package/ai-docs/templates/README.md +102 -0
- package/ai-docs/templates/documentation/create-agents-md.md +240 -0
- package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
- package/ai-docs/templates/existing-service/bug-fix.md +254 -0
- package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
- package/ai-docs/templates/new-method/00-master.md +80 -0
- package/ai-docs/templates/new-method/01-requirements.md +232 -0
- package/ai-docs/templates/new-method/02-implementation.md +295 -0
- package/ai-docs/templates/new-method/03-tests.md +201 -0
- package/ai-docs/templates/new-method/04-validation.md +141 -0
- package/ai-docs/templates/new-service/00-master.md +109 -0
- package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
- package/ai-docs/templates/new-service/02-code-generation.md +346 -0
- package/ai-docs/templates/new-service/03-integration.md +178 -0
- package/ai-docs/templates/new-service/04-test-generation.md +205 -0
- package/ai-docs/templates/new-service/05-validation.md +145 -0
- package/dist/cc.js +379 -50
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +22 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +114 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +32 -3
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +318 -0
- package/dist/services/ApiAiAssistant.js.map +1 -0
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/agent/types.js.map +1 -1
- package/dist/services/config/Util.js +8 -4
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +35 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +41 -2
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +66 -8
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +27 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +122 -25
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +92 -17
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +22 -6
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/connection-service.js +3 -1
- package/dist/services/core/websocket/connection-service.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +688 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +45 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +751 -457
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +220 -23
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +23 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +129 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +77 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +873 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +567 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +161 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +382 -0
- package/dist/services/task/state-machine/guards.js.map +1 -0
- package/dist/services/task/state-machine/index.js +53 -0
- package/dist/services/task/state-machine/index.js.map +1 -0
- package/dist/services/task/state-machine/types.js +54 -0
- package/dist/services/task/state-machine/types.js.map +1 -0
- package/dist/services/task/state-machine/uiControlsComputer.js +603 -0
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
- package/dist/services/task/taskDataNormalizer.js +99 -0
- package/dist/services/task/taskDataNormalizer.js.map +1 -0
- package/dist/services/task/types.js +227 -4
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1044 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +149 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/types/cc.d.ts +894 -0
- package/dist/types/config.d.ts +72 -0
- package/dist/types/constants.d.ts +66 -0
- package/dist/types/index.d.ts +199 -0
- package/dist/types/logger-proxy.d.ts +71 -0
- package/dist/types/metrics/MetricsManager.d.ts +223 -0
- package/dist/types/metrics/behavioral-events.d.ts +29 -0
- package/dist/types/metrics/constants.d.ts +181 -0
- package/dist/types/services/AddressBook.d.ts +74 -0
- package/dist/types/services/ApiAiAssistant.d.ts +49 -0
- package/dist/types/services/EntryPoint.d.ts +67 -0
- package/dist/types/services/Queue.d.ts +76 -0
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/WebCallingService.d.ts +1 -0
- package/dist/types/services/agent/index.d.ts +46 -0
- package/dist/types/services/agent/types.d.ts +413 -0
- package/dist/types/services/config/Util.d.ts +20 -0
- package/dist/types/services/config/constants.d.ts +270 -0
- package/dist/types/services/config/index.d.ts +177 -0
- package/dist/types/services/config/types.d.ts +1368 -0
- package/dist/types/services/constants.d.ts +110 -0
- package/dist/types/services/core/Err.d.ts +125 -0
- package/dist/types/services/core/GlobalTypes.d.ts +58 -0
- package/dist/types/services/core/Utils.d.ts +121 -0
- package/dist/types/services/core/WebexRequest.d.ts +22 -0
- package/dist/types/services/core/aqm-reqs.d.ts +65 -0
- package/dist/types/services/core/constants.d.ts +99 -0
- package/dist/types/services/core/types.d.ts +47 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
- package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
- package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
- package/dist/types/services/core/websocket/types.d.ts +37 -0
- package/dist/types/services/index.d.ts +54 -0
- package/dist/types/services/task/AutoWrapup.d.ts +40 -0
- package/dist/types/services/task/Task.d.ts +157 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskManager.d.ts +1 -0
- package/dist/types/services/task/TaskUtils.d.ts +138 -0
- package/dist/types/services/task/constants.d.ts +91 -0
- package/dist/types/services/task/contact.d.ts +69 -0
- package/dist/types/services/task/dialer.d.ts +73 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1194 -0
- package/dist/types/services/task/state-machine/actions.d.ts +10 -0
- package/dist/types/services/task/state-machine/constants.d.ts +107 -0
- package/dist/types/services/task/state-machine/guards.d.ts +102 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +269 -0
- package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
- package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
- package/dist/types/services/task/types.d.ts +1856 -0
- package/dist/types/services/task/voice/Voice.d.ts +184 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/types.d.ts +778 -0
- package/dist/types/utils/PageCache.d.ts +173 -0
- package/dist/types/webex-config.d.ts +53 -0
- package/dist/types/webex.d.ts +8 -0
- package/dist/types.js +130 -1
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +16 -12
- package/src/cc.ts +477 -51
- package/src/config.ts +6 -0
- package/src/constants.ts +21 -1
- package/src/index.ts +24 -5
- package/src/metrics/ai-docs/AGENTS.md +350 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
- package/src/metrics/ai-docs/metrics-spec.md +854 -0
- package/src/metrics/behavioral-events.ts +120 -0
- package/src/metrics/constants.ts +37 -3
- package/src/services/ApiAiAssistant.ts +412 -0
- package/src/services/UserPreference.ts +509 -0
- package/src/services/agent/ai-docs/AGENTS.md +240 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
- package/src/services/agent/ai-docs/agent-spec.md +504 -0
- package/src/services/agent/types.ts +1 -1
- package/src/services/ai-docs/AGENTS.md +386 -0
- package/src/services/ai-docs/services-spec.md +492 -0
- package/src/services/config/Util.ts +10 -2
- package/src/services/config/ai-docs/AGENTS.md +255 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
- package/src/services/config/ai-docs/config-spec.md +669 -0
- package/src/services/config/constants.ts +37 -1
- package/src/services/config/index.ts +45 -1
- package/src/services/config/types.ts +241 -11
- package/src/services/constants.ts +29 -0
- package/src/services/core/Err.ts +3 -0
- package/src/services/core/Utils.ts +143 -30
- package/src/services/core/ai-docs/AGENTS.md +381 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
- package/src/services/core/ai-docs/core-spec.md +783 -0
- package/src/services/core/aqm-reqs.ts +100 -22
- package/src/services/core/websocket/WebSocketManager.ts +23 -6
- package/src/services/core/websocket/connection-service.ts +5 -1
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +4 -0
- package/src/services/task/Task.ts +837 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +793 -521
- package/src/services/task/TaskUtils.ts +314 -24
- package/src/services/task/ai-docs/AGENTS.md +457 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +594 -0
- package/src/services/task/ai-docs/task-spec.md +1319 -0
- package/src/services/task/constants.ts +23 -0
- package/src/services/task/dialer.ts +136 -1
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1166 -0
- package/src/services/task/state-machine/actions.ts +738 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +458 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1137 -0
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2177 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +445 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +243 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +961 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +734 -71
- package/src/services/task/voice/Voice.ts +1270 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +205 -2
- package/src/utils/AGENTS.md +278 -0
- package/src/utils/ai-docs/utils-spec.md +381 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +503 -43
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/config/index.ts +85 -29
- package/test/unit/spec/services/core/Utils.ts +481 -2
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
- package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +477 -0
- package/test/unit/spec/services/task/TaskFactory.ts +62 -0
- package/test/unit/spec/services/task/TaskManager.ts +1001 -1003
- package/test/unit/spec/services/task/TaskUtils.ts +235 -0
- package/test/unit/spec/services/task/dialer.ts +372 -96
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +2651 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +637 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2663 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +649 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1525
- package/dist/services/task/index.js.map +0 -1
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { ConnectionServiceOptions, ConnectionProp } from './types';
|
|
4
|
+
export declare class ConnectionService extends EventEmitter {
|
|
5
|
+
private connectionProp;
|
|
6
|
+
private wsDisconnectAllowed;
|
|
7
|
+
private reconnectingTimer;
|
|
8
|
+
private restoreTimer;
|
|
9
|
+
private isConnectionLost;
|
|
10
|
+
private isRestoreFailed;
|
|
11
|
+
private isSocketReconnected;
|
|
12
|
+
private isKeepAlive;
|
|
13
|
+
private reconnectInterval;
|
|
14
|
+
private webSocketManager;
|
|
15
|
+
private subscribeRequest;
|
|
16
|
+
constructor(options: ConnectionServiceOptions);
|
|
17
|
+
private setupEventListeners;
|
|
18
|
+
private dispatchConnectionEvent;
|
|
19
|
+
private handleConnectionLost;
|
|
20
|
+
private clearTimerOnRestoreFailed;
|
|
21
|
+
private handleRestoreFailed;
|
|
22
|
+
private updateConnectionData;
|
|
23
|
+
setConnectionProp(prop: ConnectionProp): void;
|
|
24
|
+
private onPing;
|
|
25
|
+
private handleSocketClose;
|
|
26
|
+
private onSocketClose;
|
|
27
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default workerScript;
|
|
2
|
+
declare const workerScript: "\nconsole.log(\"*** Keepalive Worker Thread ***\");\nlet intervalId, intervalDuration, timeOutId, isSocketClosed, closeSocketTimeout;\nlet initialised = false;\nlet initiateWebSocketClosure = false;\n\nconst resetOfflineHandler = function () {\n if (timeOutId) {\n initialised = false;\n clearTimeout(timeOutId);\n timeOutId = null;\n }\n};\n\nconst checkOnlineStatus = function () {\n const onlineStatus = navigator.onLine;\n console.log(\n `[WebSocketStatus] event=checkOnlineStatus | online status=`,\n onlineStatus\n );\n return onlineStatus;\n};\n\n// Checks network status and if it's offline then force closes WebSocket\nconst checkNetworkStatus = function () {\n const onlineStatus = checkOnlineStatus();\n postMessage({ type: \"keepalive\", onlineStatus });\n if (!onlineStatus && !initialised) {\n initialised = true;\n // Sets a timeout of 16s, checks if socket didn't close then it closes forcefully\n timeOutId = setTimeout(() => {\n if (!isSocketClosed) {\n initiateWebSocketClosure = true;\n postMessage({ type: \"closeSocket\" });\n }\n }, closeSocketTimeout);\n }\n\n if (onlineStatus && initialised) {\n initialised = false;\n }\n\n if (initiateWebSocketClosure) {\n initiateWebSocketClosure = false;\n clearTimeout(timeOutId);\n timeOutId = null;\n }\n};\n\naddEventListener(\"message\", (event) => {\n if (event.data?.type === \"start\") {\n intervalDuration = event.data?.intervalDuration || 4000;\n closeSocketTimeout = event.data?.closeSocketTimeout || 5000;\n console.log(\"event=Websocket startWorker | keepalive Worker started\");\n intervalId = setInterval(\n (checkIfSocketClosed) => {\n checkNetworkStatus();\n isSocketClosed = checkIfSocketClosed;\n },\n intervalDuration,\n event.data?.isSocketClosed\n );\n\n resetOfflineHandler();\n }\n\n if (event.data?.type === \"terminate\" && intervalId) {\n console.log(\"event=Websocket terminateWorker | keepalive Worker stopped\");\n clearInterval(intervalId);\n intervalId = null;\n resetOfflineHandler();\n }\n});\n\n// Listen for online and offline events\nself.addEventListener('online', () => {\n console.log('Network status: online');\n checkNetworkStatus();\n});\n\nself.addEventListener('offline', () => {\n console.log('Network status: offline');\n checkNetworkStatus();\n});\n";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SubscribeRequest } from '../../../types';
|
|
2
|
+
import type WebSocketManager from './WebSocketManager';
|
|
3
|
+
/**
|
|
4
|
+
* Options for initializing a connection service.
|
|
5
|
+
* @typedef ConnectionServiceOptions
|
|
6
|
+
* @property {WebSocketManager} webSocketManager - The WebSocket manager instance.
|
|
7
|
+
* @property {SubscribeRequest} subscribeRequest - The subscribe request payload.
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
export type ConnectionServiceOptions = {
|
|
11
|
+
webSocketManager: WebSocketManager;
|
|
12
|
+
subscribeRequest: SubscribeRequest;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Details about the state of a lost connection and recovery attempts.
|
|
16
|
+
* @typedef ConnectionLostDetails
|
|
17
|
+
* @property {boolean} isConnectionLost - Indicates if the connection is currently lost.
|
|
18
|
+
* @property {boolean} isRestoreFailed - Indicates if restoring the connection has failed.
|
|
19
|
+
* @property {boolean} isSocketReconnected - Indicates if the socket has been reconnected.
|
|
20
|
+
* @property {boolean} isKeepAlive - Indicates if the keep-alive mechanism is active.
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
export type ConnectionLostDetails = {
|
|
24
|
+
isConnectionLost: boolean;
|
|
25
|
+
isRestoreFailed: boolean;
|
|
26
|
+
isSocketReconnected: boolean;
|
|
27
|
+
isKeepAlive: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Properties for connection configuration.
|
|
31
|
+
* @typedef ConnectionProp
|
|
32
|
+
* @property {number} lostConnectionRecoveryTimeout - Timeout in milliseconds for lost connection recovery.
|
|
33
|
+
* @ignore
|
|
34
|
+
*/
|
|
35
|
+
export type ConnectionProp = {
|
|
36
|
+
lostConnectionRecoveryTimeout: number;
|
|
37
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import routingAgent from './agent';
|
|
2
|
+
import routingContact from './task/contact';
|
|
3
|
+
import AgentConfigService from './config';
|
|
4
|
+
import { WebSocketManager } from './core/websocket/WebSocketManager';
|
|
5
|
+
import { ConnectionService } from './core/websocket/connection-service';
|
|
6
|
+
import { WebexSDK, SubscribeRequest } from '../types';
|
|
7
|
+
import aqmDialer from './task/dialer';
|
|
8
|
+
/**
|
|
9
|
+
* Services class provides centralized access to all contact center plugin services
|
|
10
|
+
* using a singleton pattern to ensure a single instance throughout the application.
|
|
11
|
+
* @private
|
|
12
|
+
* @ignore
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
export default class Services {
|
|
16
|
+
/** Agent services for managing agent state and capabilities */
|
|
17
|
+
readonly agent: ReturnType<typeof routingAgent>;
|
|
18
|
+
/** Configuration services for agent settings */
|
|
19
|
+
readonly config: AgentConfigService;
|
|
20
|
+
/** Contact services for managing customer interactions */
|
|
21
|
+
readonly contact: ReturnType<typeof routingContact>;
|
|
22
|
+
/** Dialer services for outbound calling features */
|
|
23
|
+
readonly dialer: ReturnType<typeof aqmDialer>;
|
|
24
|
+
/** WebSocket manager for handling real-time communications */
|
|
25
|
+
readonly webSocketManager: WebSocketManager;
|
|
26
|
+
/** RTD WebSocket manager for handling real-time transcription */
|
|
27
|
+
readonly rtdWebSocketManager: WebSocketManager;
|
|
28
|
+
/** Connection service for managing websocket connections */
|
|
29
|
+
readonly connectionService: ConnectionService;
|
|
30
|
+
/** Singleton instance of the Services class */
|
|
31
|
+
private static instance;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new Services instance
|
|
34
|
+
* @param options - Configuration options
|
|
35
|
+
* @param options.webex - WebexSDK instance
|
|
36
|
+
* @param options.connectionConfig - Subscription configuration for websocket connection
|
|
37
|
+
*/
|
|
38
|
+
constructor(options: {
|
|
39
|
+
webex: WebexSDK;
|
|
40
|
+
connectionConfig: SubscribeRequest;
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Gets singleton instance of Services class
|
|
44
|
+
* Creates a new instance if one doesn't exist
|
|
45
|
+
* @param options - Configuration options
|
|
46
|
+
* @param options.webex - WebexSDK instance
|
|
47
|
+
* @param options.connectionConfig - Subscription configuration for websocket connection
|
|
48
|
+
* @returns The singleton Services instance
|
|
49
|
+
*/
|
|
50
|
+
static getInstance(options: {
|
|
51
|
+
webex: WebexSDK;
|
|
52
|
+
connectionConfig: SubscribeRequest;
|
|
53
|
+
}): Services;
|
|
54
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AutoWrapup class implements a timer for automatic wrap-up functionality.
|
|
3
|
+
* It handles timing the wrap-up period and executing a callback when the timer completes.
|
|
4
|
+
*/
|
|
5
|
+
export default class AutoWrapup {
|
|
6
|
+
private timer;
|
|
7
|
+
private startTime;
|
|
8
|
+
private readonly interval;
|
|
9
|
+
allowCancelAutoWrapup: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new AutoWrapup timer
|
|
12
|
+
* @param interval - Time in milliseconds before auto wrap-up executes
|
|
13
|
+
* @param allowCancelAutoWrapup - Whether to allow canceling the auto wrap-up
|
|
14
|
+
*/
|
|
15
|
+
constructor(interval: number, allowCancelAutoWrapup?: boolean);
|
|
16
|
+
/**
|
|
17
|
+
* Starts the auto wrap-up timer
|
|
18
|
+
* @param onComplete - Callback function to execute when timer completes
|
|
19
|
+
*/
|
|
20
|
+
start(onComplete: () => void): void;
|
|
21
|
+
/**
|
|
22
|
+
* Clears the auto wrap-up timer if it's running
|
|
23
|
+
*/
|
|
24
|
+
clear(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the remaining time in milliseconds
|
|
27
|
+
* @returns Time left in milliseconds
|
|
28
|
+
*/
|
|
29
|
+
getTimeLeft(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if the timer is currently running
|
|
32
|
+
* @returns True if the timer is running, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
isRunning(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the remaining time in seconds (rounded)
|
|
37
|
+
* @returns Time left in seconds
|
|
38
|
+
*/
|
|
39
|
+
getTimeLeftSeconds(): number;
|
|
40
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import type { ActorRefFrom, SnapshotFrom } from 'xstate';
|
|
4
|
+
import { ITask, TaskData, TaskResponse, WrapupPayLoad, TaskId, TransferPayLoad, TASK_EVENTS, TaskUIControls, ConsultEndPayload, ConsultPayload, ConsultTransferPayLoad, ResumeRecordingPayload, CallId } from './types';
|
|
5
|
+
import routingContact from './contact';
|
|
6
|
+
import MetricsManager from '../../metrics/MetricsManager';
|
|
7
|
+
import { TaskState } from './state-machine';
|
|
8
|
+
import type { TaskEventPayload, TaskStateMachine, UIControlConfig, TaskActionsMap, TaskActionArgs } from './state-machine';
|
|
9
|
+
import AutoWrapup from './AutoWrapup';
|
|
10
|
+
import { WrapupData } from '../config/types';
|
|
11
|
+
type UIControlConfigInput = Omit<UIControlConfig, 'channelType'> & {
|
|
12
|
+
channelType?: UIControlConfig['channelType'];
|
|
13
|
+
};
|
|
14
|
+
export default abstract class Task extends EventEmitter implements ITask {
|
|
15
|
+
protected contact: ReturnType<typeof routingContact>;
|
|
16
|
+
protected metricsManager: MetricsManager;
|
|
17
|
+
stateMachineService?: ActorRefFrom<TaskStateMachine>;
|
|
18
|
+
data: TaskData;
|
|
19
|
+
webCallMap: Record<TaskId, CallId>;
|
|
20
|
+
state?: SnapshotFrom<TaskStateMachine>;
|
|
21
|
+
private lastState?;
|
|
22
|
+
protected currentUiControls: TaskUIControls;
|
|
23
|
+
protected uiControlConfig: UIControlConfig;
|
|
24
|
+
protected wrapupData?: WrapupData;
|
|
25
|
+
autoWrapup?: AutoWrapup;
|
|
26
|
+
protected agentId?: string;
|
|
27
|
+
constructor(contact: ReturnType<typeof routingContact>, data: TaskData, uiControlConfig: UIControlConfigInput, wrapupData?: WrapupData, agentId?: string);
|
|
28
|
+
private static resolveChannelType;
|
|
29
|
+
abstract accept(): Promise<TaskResponse>;
|
|
30
|
+
decline(): Promise<TaskResponse>;
|
|
31
|
+
pauseRecording(): Promise<TaskResponse>;
|
|
32
|
+
resumeRecording(resumeRecordingPayload: ResumeRecordingPayload): Promise<TaskResponse>;
|
|
33
|
+
consult(consultPayload: ConsultPayload): Promise<TaskResponse>;
|
|
34
|
+
endConsult(consultEndPayload: ConsultEndPayload): Promise<TaskResponse>;
|
|
35
|
+
consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
|
|
36
|
+
consultConference(): Promise<TaskResponse>;
|
|
37
|
+
exitConference(): Promise<TaskResponse>;
|
|
38
|
+
transferConference(): Promise<TaskResponse>;
|
|
39
|
+
switchCall(): Promise<TaskResponse>;
|
|
40
|
+
toggleMute(): Promise<void>;
|
|
41
|
+
unregisterWebCallListeners(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Cancel any in-progress auto wrap-up timer.
|
|
44
|
+
* Base implementation just clears the timer reference so subclasses inherit the behavior.
|
|
45
|
+
*/
|
|
46
|
+
cancelAutoWrapupTimer(): void;
|
|
47
|
+
hold(): Promise<TaskResponse>;
|
|
48
|
+
resume(): Promise<TaskResponse>;
|
|
49
|
+
holdResume(): Promise<TaskResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Latest UI controls derived from state machine state and context.
|
|
52
|
+
*/
|
|
53
|
+
get uiControls(): TaskUIControls;
|
|
54
|
+
protected updateUiControls(forceEmit?: boolean): void;
|
|
55
|
+
/**
|
|
56
|
+
* Initialize the state machine
|
|
57
|
+
*/
|
|
58
|
+
private initializeStateMachine;
|
|
59
|
+
/**
|
|
60
|
+
* Send an event to the state machine
|
|
61
|
+
*/
|
|
62
|
+
sendStateMachineEvent(event: TaskEventPayload): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get the current state machine state
|
|
65
|
+
*/
|
|
66
|
+
protected getCurrentState(): TaskState | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Compute UI controls based on current state machine state.
|
|
69
|
+
*
|
|
70
|
+
* @returns UI control states for all task actions
|
|
71
|
+
*/
|
|
72
|
+
protected computeUIControls(): TaskUIControls;
|
|
73
|
+
/**
|
|
74
|
+
* Stop the state machine service
|
|
75
|
+
*/
|
|
76
|
+
protected stopStateMachine(): void;
|
|
77
|
+
private static extractTaskDataFromEvent;
|
|
78
|
+
private autoAnswerIfNeeded;
|
|
79
|
+
private updateTaskFromEvent;
|
|
80
|
+
protected getStateMachineActionOverrides(): Partial<TaskActionsMap>;
|
|
81
|
+
protected getChannelSpecificActionOverrides(): Partial<TaskActionsMap>;
|
|
82
|
+
protected createEmitSelfAction(taskEvent: TASK_EVENTS, { updateTaskData }?: {
|
|
83
|
+
updateTaskData?: boolean;
|
|
84
|
+
}): ({ event }: TaskActionArgs) => void;
|
|
85
|
+
private getCommonActionOverrides;
|
|
86
|
+
/**
|
|
87
|
+
* Sets up the automatic wrap-up timer if wrap-up is required
|
|
88
|
+
*/
|
|
89
|
+
protected setupAutoWrapupTimer(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Cancels the automatic wrap-up timer if it's running
|
|
92
|
+
*/
|
|
93
|
+
private reconcileData;
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @param methodName - The name of the method that is unsupported
|
|
97
|
+
* @throws Error
|
|
98
|
+
*/
|
|
99
|
+
protected unsupportedMethodError(methodName: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* This method is used to update the task data.
|
|
102
|
+
* @param updatedData - TaskData
|
|
103
|
+
* @param shouldOverwrite - boolean
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* task.updateTaskData(updatedData, true);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
updateTaskData(updatedData: TaskData, shouldOverwrite?: boolean): ITask;
|
|
110
|
+
/**
|
|
111
|
+
* The backend sends `interaction.media` and `interaction.participants` as complete snapshots
|
|
112
|
+
* of the current call state. `reconcileData` deep-merges and never removes keys, so entries the
|
|
113
|
+
* backend dropped (e.g. a consult leg's media and consultee participant after the consult ends)
|
|
114
|
+
* linger in `this.data`. That stale data drives incorrect UI controls (e.g. the consult button
|
|
115
|
+
* staying disabled after the consult leg is gone, until a page refresh re-hydrates cleanly).
|
|
116
|
+
* Make only these two snapshot maps authoritative to the incoming payload, leaving every other
|
|
117
|
+
* field on the generic deep-merge path (CAD and other partial updates still merge as before).
|
|
118
|
+
*/
|
|
119
|
+
private pruneStaleInteractionMaps;
|
|
120
|
+
/**
|
|
121
|
+
* This is used to blind transfer or vTeam transfer the task
|
|
122
|
+
* @param transferPayload
|
|
123
|
+
* @returns Promise<TaskResponse>
|
|
124
|
+
* @throws Error
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const transferPayload = {
|
|
128
|
+
* to: 'myQueueId',
|
|
129
|
+
* destinationType: 'queue',
|
|
130
|
+
* }
|
|
131
|
+
* task.transfer(transferPayload).then(()=>{}).catch(()=>{});
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
|
|
135
|
+
/**
|
|
136
|
+
* This is used to end the task.
|
|
137
|
+
* @returns Promise<TaskResponse>
|
|
138
|
+
* @throws Error
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* task.end().then(()=>{}).catch(()=>{})
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
end(): Promise<TaskResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* This is used to wrap up the task.
|
|
147
|
+
* @param wrapupPayload - WrapupPayLoad
|
|
148
|
+
* @returns Promise<TaskResponse>
|
|
149
|
+
* @throws Error
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* task.wrapup(wrapupPayload).then(()=>{}).catch(()=>{})
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
wrapup(wrapupPayload: WrapupPayLoad): Promise<TaskResponse>;
|
|
156
|
+
}
|
|
157
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import routingContact from './contact';
|
|
2
|
+
import WebCallingService from '../WebCallingService';
|
|
3
|
+
import Task from './Task';
|
|
4
|
+
import { TaskData } from './types';
|
|
5
|
+
import { ConfigFlags } from '../../types';
|
|
6
|
+
import { WrapupData } from '../config/types';
|
|
7
|
+
export default class TaskFactory {
|
|
8
|
+
/**
|
|
9
|
+
* Creates the correct Task subclass based on mediaType & loginOption
|
|
10
|
+
*/
|
|
11
|
+
static createTask(contact: ReturnType<typeof routingContact>, webCallingService: WebCallingService, data: TaskData, configFlags: ConfigFlags, wrapupData?: WrapupData, agentId?: string): Task;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Interaction, ITask, TaskData } from './types';
|
|
2
|
+
import { TaskContext } from './state-machine/types';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the customer is still in the call (not left)
|
|
5
|
+
*
|
|
6
|
+
* @param interaction - The interaction object
|
|
7
|
+
* @param interactionId - The main interaction ID
|
|
8
|
+
* @returns true if customer is in the call
|
|
9
|
+
*/
|
|
10
|
+
export declare const getIsCustomerInCall: (interaction: Interaction, interactionId: string) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the count of active agent participants in the conference
|
|
13
|
+
* Excludes Customer, Supervisor, and VVA participant types
|
|
14
|
+
*
|
|
15
|
+
* @param interaction - The interaction object
|
|
16
|
+
* @param interactionId - The main interaction ID
|
|
17
|
+
* @returns Number of active agent participants
|
|
18
|
+
*/
|
|
19
|
+
export declare const getConferenceParticipantsCount: (interaction: Interaction, interactionId: string) => number;
|
|
20
|
+
/**
|
|
21
|
+
* Determines if a consult is actively in-progress for conference control gating.
|
|
22
|
+
* This is used to disable conference controls (End/Consult) only when a consult leg
|
|
23
|
+
* still exists outside the main call participants.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getIsConsultInProgressForConferenceControls: (interaction: Interaction | undefined, mainCallId: string | undefined, selfAgentId: string | undefined) => boolean;
|
|
26
|
+
export declare const getIsConsultedAgentForControls: (taskData: TaskData | null, context: TaskContext, isConsultingState: boolean) => boolean;
|
|
27
|
+
export declare const getServerHoldStateForControls: (context: TaskContext, mainCallId?: string, fallbackTaskData?: TaskData | null) => boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Determines if the given agent is the primary agent (owner) of the task
|
|
30
|
+
* @param task - The task to check
|
|
31
|
+
* @param agentId - The agent ID to check for primary status
|
|
32
|
+
* @returns true if the agent is the primary agent, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
export declare const isPrimary: (task: ITask, agentId: string) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the given agent is a participant in the main interaction (mainCall)
|
|
37
|
+
* @param task - The task to check
|
|
38
|
+
* @param agentId - The agent ID to check for participation
|
|
39
|
+
* @returns true if the agent is a participant in the main interaction, false otherwise
|
|
40
|
+
*/
|
|
41
|
+
export declare const isParticipantInMainInteraction: (task: ITask, agentId: string) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if the given agent is not in the interaction or has left the interaction
|
|
44
|
+
* @param task - The task to check
|
|
45
|
+
* @param agentId - The agent ID to check
|
|
46
|
+
* @returns true if the agent is not in the interaction or has left, false otherwise
|
|
47
|
+
*/
|
|
48
|
+
export declare const checkParticipantNotInInteraction: (task: ITask, agentId: string) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Determines if a conference is currently in progress based on the number of active agent participants
|
|
51
|
+
* @param data - The task data to check for conference status
|
|
52
|
+
* @returns true if there are 2 or more active agent participants in the main call, false otherwise
|
|
53
|
+
*
|
|
54
|
+
* For Agent B (consulted agent), their task's interactionId may be different from the main call.
|
|
55
|
+
* We use mainInteractionId from the interaction if available, otherwise fallback to interactionId.
|
|
56
|
+
*/
|
|
57
|
+
export declare const getIsConferenceInProgress: (data: TaskData) => boolean;
|
|
58
|
+
/** EP-DN consult merged to conference before a second agent joins the main leg (CAI-8329). */
|
|
59
|
+
export declare const isEpDnConsultPendingConferenceMerge: (taskData: TaskData | undefined, selfAgentId: string | undefined) => boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if the current agent is a secondary agent in a consultation scenario.
|
|
62
|
+
* Secondary agents are those who were consulted (not the original call owner).
|
|
63
|
+
* @param task - The task object containing interaction details
|
|
64
|
+
* @returns true if this is a secondary agent (consulted party), false otherwise
|
|
65
|
+
*/
|
|
66
|
+
export declare const isSecondaryAgent: (interaction: Interaction) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Checks if the current agent is a secondary EP-DN (Entry Point Dial Number) agent.
|
|
69
|
+
* This is specifically for telephony consultations to external numbers/entry points.
|
|
70
|
+
* @param interaction - The interaction object
|
|
71
|
+
* @returns true if this is a secondary EP-DN agent in telephony consultation, false otherwise
|
|
72
|
+
*/
|
|
73
|
+
export declare const isSecondaryEpDnAgent: (interaction: Interaction) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if the task belongs to a campaign preview interaction.
|
|
76
|
+
* Campaign preview ContactEnded events are terminal cleanup events and should not trigger wrapup.
|
|
77
|
+
*/
|
|
78
|
+
export declare const isCampaignPreviewTask: (taskData?: TaskData | null) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if auto-answer is enabled for the agent participant
|
|
81
|
+
* @param interaction - The interaction object
|
|
82
|
+
* @param agentId - Current agent ID
|
|
83
|
+
* @returns true if auto-answer is enabled, false otherwise
|
|
84
|
+
*/
|
|
85
|
+
export declare const isAutoAnswerEnabled: (interaction: Interaction, agentId: string) => boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Checks if the interaction is a WebRTC call eligible for auto-answer
|
|
88
|
+
* @param interaction - The interaction object
|
|
89
|
+
* @param loginOption - The agent's login option (BROWSER, AGENT_DN, etc.)
|
|
90
|
+
* @param webRtcEnabled - Whether WebRTC is enabled for the agent
|
|
91
|
+
* @returns true if this is a WebRTC call, false otherwise
|
|
92
|
+
*/
|
|
93
|
+
export declare const isWebRTCCall: (interaction: Interaction, loginOption: string, webRtcEnabled: boolean) => boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks if the interaction is a digital outbound (Email/SMS)
|
|
96
|
+
* @param interaction - The interaction object
|
|
97
|
+
* @returns true if this is a digital outbound, false otherwise
|
|
98
|
+
*/
|
|
99
|
+
export declare const isDigitalOutbound: (interaction: Interaction) => boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Checks if the outdial was initiated by the current agent
|
|
102
|
+
* @param interaction - The interaction object
|
|
103
|
+
* @param agentId - Current agent ID
|
|
104
|
+
* @returns true if agent initiated the outdial, false otherwise
|
|
105
|
+
*/
|
|
106
|
+
export declare const hasAgentInitiatedOutdial: (interaction: Interaction, agentId: string) => boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Determines if a task should be auto-answered based on interaction data
|
|
109
|
+
* Auto-answer logic handles:
|
|
110
|
+
* 1. WebRTC calls with auto-answer enabled in agent profile
|
|
111
|
+
* 2. Agent-initiated WebRTC outdial calls
|
|
112
|
+
* 3. Agent-initiated digital outbound (Email/SMS) without previous transfers
|
|
113
|
+
*
|
|
114
|
+
* @param taskData - The task data
|
|
115
|
+
* @param agentId - Current agent ID
|
|
116
|
+
* @param loginOption - Agent's login option
|
|
117
|
+
* @param webRtcEnabled - Whether WebRTC is enabled for the agent
|
|
118
|
+
* @returns true if task should be auto-answered, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
export declare const shouldAutoAnswerTask: (taskData: TaskData, agentId: string, loginOption: string, webRtcEnabled: boolean) => boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Gets the consult media resource ID for switch-call operations.
|
|
123
|
+
* Searches for the consult media leg in the interaction.
|
|
124
|
+
*
|
|
125
|
+
* @param interaction - The interaction object
|
|
126
|
+
* @param consultMediaResourceId - The consult media resource ID from task data
|
|
127
|
+
* @param agentId - Current agent ID
|
|
128
|
+
* @returns The consult media resource ID or undefined
|
|
129
|
+
*/
|
|
130
|
+
export declare const getConsultMediaResourceId: (interaction: Interaction | undefined, consultMediaResourceId: string | undefined, agentId: string | undefined) => string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Checks if a task is a campaign preview reservation that has not yet been accepted.
|
|
133
|
+
* Campaign preview tasks should not trigger incoming call handling until the agent
|
|
134
|
+
* explicitly accepts the preview contact.
|
|
135
|
+
* @param task - The task to check
|
|
136
|
+
* @returns true if the task is a pending campaign preview reservation, false otherwise
|
|
137
|
+
*/
|
|
138
|
+
export declare const isCampaignPreviewReservation: (task: ITask) => boolean;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for Task Service
|
|
3
|
+
* @module @webex/contact-center/services/task/constants
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export declare const TASK_MESSAGE_TYPE = "RoutingMessage";
|
|
7
|
+
export declare const TASK_API = "/v1/tasks/";
|
|
8
|
+
export declare const HOLD = "/hold";
|
|
9
|
+
export declare const UNHOLD = "/unhold";
|
|
10
|
+
export declare const CONSULT = "/consult";
|
|
11
|
+
export declare const CONSULT_ACCEPT = "/consult/accept";
|
|
12
|
+
export declare const CONSULT_END = "/consult/end";
|
|
13
|
+
export declare const TRANSFER = "/transfer";
|
|
14
|
+
export declare const CONSULT_TRANSFER = "/consult/transfer";
|
|
15
|
+
export declare const PAUSE = "/record/pause";
|
|
16
|
+
export declare const RESUME = "/record/resume";
|
|
17
|
+
export declare const WRAPUP = "/wrapup";
|
|
18
|
+
export declare const END = "/end";
|
|
19
|
+
export declare const CONSULT_CONFERENCE = "/consult/conference";
|
|
20
|
+
export declare const CONFERENCE_EXIT = "/conference/exit";
|
|
21
|
+
export declare const CONFERENCE_TRANSFER = "/conference/transfer";
|
|
22
|
+
export declare const DIALER_API = "/v1/dialer";
|
|
23
|
+
export declare const CAMPAIGN_PREVIEW_ACCEPT = "/accept";
|
|
24
|
+
export declare const CAMPAIGN_PREVIEW_SKIP = "/skip";
|
|
25
|
+
export declare const CAMPAIGN_PREVIEW_REMOVE = "/remove";
|
|
26
|
+
/** 80-second timeout for accepting preview contact (outbound call setup takes longer than default 20s) */
|
|
27
|
+
export declare const TIMEOUT_PREVIEW_ACCEPT = 80000;
|
|
28
|
+
export declare const TASK_MANAGER_FILE = "taskManager";
|
|
29
|
+
export declare const TASK_FILE = "task";
|
|
30
|
+
/**
|
|
31
|
+
* Task data field names that should be preserved during reconciliation
|
|
32
|
+
* These fields are retained even if not present in new data during updates
|
|
33
|
+
*/
|
|
34
|
+
export declare const PRESERVED_TASK_DATA_FIELDS: {
|
|
35
|
+
/** Indicates if the task is in consultation state */
|
|
36
|
+
IS_CONSULTED: string;
|
|
37
|
+
/** Indicates if wrap-up is required for this task */
|
|
38
|
+
WRAP_UP_REQUIRED: string;
|
|
39
|
+
/** Indicates if a conference is currently in progress (2+ active agents) */
|
|
40
|
+
IS_CONFERENCE_IN_PROGRESS: string;
|
|
41
|
+
/** Indicates if auto-answer is in progress for this task */
|
|
42
|
+
IS_AUTO_ANSWERING: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Array of task data field names that should not be deleted during reconciliation
|
|
46
|
+
* Used by reconcileData method to preserve important task state fields
|
|
47
|
+
*/
|
|
48
|
+
export declare const KEYS_TO_NOT_DELETE: string[];
|
|
49
|
+
/**
|
|
50
|
+
* Consultation status constants derived from state machine
|
|
51
|
+
* These values are computed and available in task.data.consultStatus
|
|
52
|
+
*/
|
|
53
|
+
export declare const METHODS: {
|
|
54
|
+
ACCEPT: string;
|
|
55
|
+
TOGGLE_MUTE: string;
|
|
56
|
+
DECLINE: string;
|
|
57
|
+
HOLD: string;
|
|
58
|
+
RESUME: string;
|
|
59
|
+
END: string;
|
|
60
|
+
WRAPUP: string;
|
|
61
|
+
PAUSE_RECORDING: string;
|
|
62
|
+
RESUME_RECORDING: string;
|
|
63
|
+
CONSULT: string;
|
|
64
|
+
END_CONSULT: string;
|
|
65
|
+
TRANSFER: string;
|
|
66
|
+
CONSULT_TRANSFER: string;
|
|
67
|
+
CONSULT_CONFERENCE: string;
|
|
68
|
+
EXIT_CONFERENCE: string;
|
|
69
|
+
TRANSFER_CONFERENCE: string;
|
|
70
|
+
UPDATE_TASK_DATA: string;
|
|
71
|
+
RECONCILE_DATA: string;
|
|
72
|
+
HANDLE_INCOMING_WEB_CALL: string;
|
|
73
|
+
REGISTER_TASK_LISTENERS: string;
|
|
74
|
+
HANDLE_REAL_TIME_WEBSOCKET_EVENT: string;
|
|
75
|
+
REMOVE_TASK_FROM_COLLECTION: string;
|
|
76
|
+
HANDLE_TASK_CLEANUP: string;
|
|
77
|
+
GET_TASK: string;
|
|
78
|
+
GET_ALL_TASKS: string;
|
|
79
|
+
GET_TASK_MANAGER: string;
|
|
80
|
+
SETUP_AUTO_WRAPUP_TIMER: string;
|
|
81
|
+
CANCEL_AUTO_WRAPUP_TIMER: string;
|
|
82
|
+
REQUEST_REAL_TIME_TRANSCRIPTS: string;
|
|
83
|
+
};
|
|
84
|
+
export declare const TRANSCRIPT_EVENT_MAP: {
|
|
85
|
+
AgentContactAssigned: string;
|
|
86
|
+
AgentConsulting: string;
|
|
87
|
+
AgentConsultConferenced: string;
|
|
88
|
+
AgentWrapup: string;
|
|
89
|
+
AgentConsultEnded: string;
|
|
90
|
+
ParticipantLeftConference: string;
|
|
91
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import AqmReqs from '../core/aqm-reqs';
|
|
2
|
+
import * as Contact from './types';
|
|
3
|
+
export default function routingContact(aqm: AqmReqs): {
|
|
4
|
+
accept: import("../core/types").Res<Contact.AgentContact, {
|
|
5
|
+
interactionId: string;
|
|
6
|
+
}>;
|
|
7
|
+
hold: import("../core/types").Res<Contact.AgentContact, {
|
|
8
|
+
interactionId: string;
|
|
9
|
+
data: Contact.HoldResumePayload;
|
|
10
|
+
}>;
|
|
11
|
+
unHold: import("../core/types").Res<Contact.AgentContact, {
|
|
12
|
+
interactionId: string;
|
|
13
|
+
data: Contact.HoldResumePayload;
|
|
14
|
+
}>;
|
|
15
|
+
pauseRecording: import("../core/types").Res<Contact.AgentContact, {
|
|
16
|
+
interactionId: string;
|
|
17
|
+
}>;
|
|
18
|
+
resumeRecording: import("../core/types").Res<Contact.AgentContact, {
|
|
19
|
+
interactionId: string;
|
|
20
|
+
data: Contact.ResumeRecordingPayload;
|
|
21
|
+
}>;
|
|
22
|
+
consult: import("../core/types").Res<Contact.AgentContact, {
|
|
23
|
+
interactionId: string;
|
|
24
|
+
data: Contact.ConsultPayload;
|
|
25
|
+
}>;
|
|
26
|
+
consultEnd: import("../core/types").Res<Contact.AgentContact, {
|
|
27
|
+
interactionId: string;
|
|
28
|
+
data: Contact.ConsultEndPayload;
|
|
29
|
+
}>;
|
|
30
|
+
consultAccept: import("../core/types").Res<Contact.AgentContact, {
|
|
31
|
+
interactionId: string;
|
|
32
|
+
}>;
|
|
33
|
+
blindTransfer: import("../core/types").Res<Contact.AgentContact, {
|
|
34
|
+
interactionId: string;
|
|
35
|
+
data: Contact.TransferPayLoad;
|
|
36
|
+
}>;
|
|
37
|
+
vteamTransfer: import("../core/types").Res<Contact.AgentContact, {
|
|
38
|
+
interactionId: string;
|
|
39
|
+
data: Contact.TransferPayLoad;
|
|
40
|
+
}>;
|
|
41
|
+
consultTransfer: import("../core/types").Res<Contact.AgentContact, {
|
|
42
|
+
interactionId: string;
|
|
43
|
+
data: Contact.ConsultTransferPayLoad;
|
|
44
|
+
}>;
|
|
45
|
+
end: import("../core/types").Res<Contact.AgentContact, {
|
|
46
|
+
interactionId: string;
|
|
47
|
+
}>;
|
|
48
|
+
wrapup: import("../core/types").Res<Contact.AgentContact, {
|
|
49
|
+
interactionId: string;
|
|
50
|
+
data: Contact.WrapupPayLoad;
|
|
51
|
+
}>;
|
|
52
|
+
cancelTask: import("../core/types").Res<Contact.AgentContact, {
|
|
53
|
+
interactionId: string;
|
|
54
|
+
}>;
|
|
55
|
+
cancelCtq: import("../core/types").Res<Contact.AgentContact, {
|
|
56
|
+
interactionId: string;
|
|
57
|
+
data: Contact.cancelCtq;
|
|
58
|
+
}>;
|
|
59
|
+
consultConference: import("../core/types").Res<Contact.AgentContact, {
|
|
60
|
+
interactionId: string;
|
|
61
|
+
data: Contact.ConsultConferenceData;
|
|
62
|
+
}>;
|
|
63
|
+
exitConference: import("../core/types").Res<Contact.AgentContact, {
|
|
64
|
+
interactionId: string;
|
|
65
|
+
}>;
|
|
66
|
+
conferenceTransfer: import("../core/types").Res<Contact.AgentContact, {
|
|
67
|
+
interactionId: string;
|
|
68
|
+
}>;
|
|
69
|
+
};
|