@webex/contact-center 3.12.0-next.9 → 3.12.0-task-refactor.2
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/AGENTS.md +438 -0
- package/ai-docs/README.md +131 -0
- package/ai-docs/RULES.md +455 -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 +65 -123
- package/dist/cc.js.map +1 -1
- package/dist/constants.js +13 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +26 -13
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +7 -6
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +0 -3
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/config/Util.js +2 -3
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/types.js +16 -14
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +0 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +79 -55
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +17 -92
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +5 -25
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +1 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +644 -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 +570 -535
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +132 -28
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +7 -6
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +0 -51
- 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 +634 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +372 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +139 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +263 -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 +377 -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 +157 -18
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1031 -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 +4 -33
- package/dist/types/constants.d.ts +13 -2
- package/dist/types/index.d.ts +11 -5
- package/dist/types/metrics/constants.d.ts +5 -3
- package/dist/types/services/ApiAiAssistant.d.ts +1 -1
- package/dist/types/services/config/types.d.ts +97 -25
- package/dist/types/services/core/Err.d.ts +0 -2
- package/dist/types/services/core/Utils.d.ts +25 -23
- package/dist/types/services/core/aqm-reqs.d.ts +0 -49
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -1
- package/dist/types/services/core/websocket/connection-service.d.ts +0 -1
- package/dist/types/services/core/websocket/types.d.ts +1 -1
- package/dist/types/services/index.d.ts +1 -1
- package/dist/types/services/task/Task.d.ts +146 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskUtils.d.ts +39 -8
- package/dist/types/services/task/constants.d.ts +5 -4
- package/dist/types/services/task/dialer.d.ts +0 -15
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +906 -0
- package/dist/types/services/task/state-machine/actions.d.ts +8 -0
- package/dist/types/services/task/state-machine/constants.d.ts +91 -0
- package/dist/types/services/task/state-machine/guards.d.ts +78 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +256 -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 +539 -88
- package/dist/types/services/task/voice/Voice.d.ts +183 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/types.d.ts +68 -0
- package/dist/types/webex.d.ts +1 -0
- package/dist/types.js +70 -0
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +14 -11
- package/src/cc.ts +91 -177
- package/src/constants.ts +13 -2
- package/src/index.ts +14 -5
- package/src/metrics/ai-docs/AGENTS.md +348 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
- package/src/metrics/behavioral-events.ts +28 -14
- package/src/metrics/constants.ts +7 -8
- package/src/services/ApiAiAssistant.ts +2 -4
- package/src/services/agent/ai-docs/AGENTS.md +238 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
- package/src/services/ai-docs/AGENTS.md +384 -0
- package/src/services/config/Util.ts +2 -3
- package/src/services/config/ai-docs/AGENTS.md +253 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
- package/src/services/config/types.ts +108 -20
- package/src/services/constants.ts +0 -1
- package/src/services/core/Err.ts +0 -1
- package/src/services/core/Utils.ts +90 -67
- package/src/services/core/ai-docs/AGENTS.md +379 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
- package/src/services/core/aqm-reqs.ts +22 -100
- package/src/services/core/websocket/WebSocketManager.ts +4 -23
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +1 -2
- package/src/services/task/Task.ts +785 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +579 -633
- package/src/services/task/TaskUtils.ts +175 -31
- package/src/services/task/ai-docs/AGENTS.md +448 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +573 -0
- package/src/services/task/constants.ts +5 -4
- package/src/services/task/dialer.ts +1 -56
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +793 -0
- package/src/services/task/state-machine/actions.ts +422 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
- package/src/services/task/state-machine/constants.ts +150 -0
- package/src/services/task/state-machine/guards.ts +303 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +228 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +542 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +641 -95
- package/src/services/task/voice/Voice.ts +1255 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +88 -5
- package/src/utils/AGENTS.md +276 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +59 -142
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +17 -0
- package/test/unit/spec/services/config/index.ts +26 -55
- package/test/unit/spec/services/core/Utils.ts +103 -52
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +48 -112
- package/test/unit/spec/services/core/websocket/connection-service.ts +5 -4
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +416 -0
- package/test/unit/spec/services/task/TaskFactory.ts +62 -0
- package/test/unit/spec/services/task/TaskManager.ts +781 -1735
- package/test/unit/spec/services/task/TaskUtils.ts +125 -0
- package/test/unit/spec/services/task/dialer.ts +112 -198
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +473 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +288 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +147 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +587 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +242 -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/dist/types/services/task/index.d.ts +0 -650
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/* eslint-disable import/no-cycle */
|
|
2
|
+
import type {AnyActorRef} from 'xstate';
|
|
3
|
+
import {TaskEventPayload} from './state-machine';
|
|
3
4
|
import {Msg} from '../core/GlobalTypes';
|
|
4
5
|
import AutoWrapup from './AutoWrapup';
|
|
5
6
|
|
|
@@ -9,6 +10,11 @@ import AutoWrapup from './AutoWrapup';
|
|
|
9
10
|
*/
|
|
10
11
|
export type TaskId = string;
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier for a call in the Webex calling system
|
|
15
|
+
*/
|
|
16
|
+
export type CallId = string;
|
|
17
|
+
|
|
12
18
|
/**
|
|
13
19
|
* Helper type for creating enum-like objects with type safety
|
|
14
20
|
* @internal
|
|
@@ -90,6 +96,26 @@ export const MEDIA_CHANNEL = {
|
|
|
90
96
|
*/
|
|
91
97
|
export type MEDIA_CHANNEL = Enum<typeof MEDIA_CHANNEL>;
|
|
92
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Supported task channel types for UI control configuration
|
|
101
|
+
*/
|
|
102
|
+
export const TASK_CHANNEL_TYPE = {
|
|
103
|
+
VOICE: 'voice',
|
|
104
|
+
DIGITAL: 'digital',
|
|
105
|
+
} as const;
|
|
106
|
+
|
|
107
|
+
export type TaskChannelType = Enum<typeof TASK_CHANNEL_TYPE>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Voice channel variants that toggle PSTN/WebRTC specific behaviors
|
|
111
|
+
*/
|
|
112
|
+
export const VOICE_VARIANT = {
|
|
113
|
+
PSTN: 'pstn',
|
|
114
|
+
WEBRTC: 'webrtc',
|
|
115
|
+
} as const;
|
|
116
|
+
|
|
117
|
+
export type VoiceVariant = Enum<typeof VOICE_VARIANT>;
|
|
118
|
+
|
|
93
119
|
/**
|
|
94
120
|
* Enumeration of all task-related events that can occur in the contact center system
|
|
95
121
|
* These events represent different states and actions in the task lifecycle
|
|
@@ -203,6 +229,11 @@ export enum TASK_EVENTS {
|
|
|
203
229
|
*/
|
|
204
230
|
TASK_CONSULT_QUEUE_FAILED = 'task:consultQueueFailed',
|
|
205
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Triggered whenever task UI controls are recalculated
|
|
234
|
+
*/
|
|
235
|
+
TASK_UI_CONTROLS_UPDATED = 'task:ui-controls-updated',
|
|
236
|
+
|
|
206
237
|
/**
|
|
207
238
|
* Triggered when a consultation request is accepted
|
|
208
239
|
* @example
|
|
@@ -287,6 +318,24 @@ export enum TASK_EVENTS {
|
|
|
287
318
|
*/
|
|
288
319
|
TASK_WRAPPEDUP = 'task:wrappedup',
|
|
289
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Triggered when the task state machine reaches a final state and resources should be cleaned up.
|
|
323
|
+
* Used internally by TaskManager to perform collection/call cleanup.
|
|
324
|
+
* @internal
|
|
325
|
+
*/
|
|
326
|
+
TASK_CLEANUP = 'task:cleanup',
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Triggered when recording is started
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* task.on(TASK_EVENTS.TASK_RECORDING_STARTED, (task: ITask) => {
|
|
333
|
+
* console.log('Recording started:', task.data.interactionId);
|
|
334
|
+
* });
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
TASK_RECORDING_STARTED = 'task:recordingStarted',
|
|
338
|
+
|
|
290
339
|
/**
|
|
291
340
|
* Triggered when recording is paused
|
|
292
341
|
* @example
|
|
@@ -519,6 +568,43 @@ export enum TASK_EVENTS {
|
|
|
519
568
|
*/
|
|
520
569
|
TASK_PARTICIPANT_LEFT_FAILED = 'task:participantLeftFailed',
|
|
521
570
|
|
|
571
|
+
/**
|
|
572
|
+
* Triggered when agent initiates exit from conference
|
|
573
|
+
* @example
|
|
574
|
+
* ```typescript
|
|
575
|
+
* task.on(TASK_EVENTS.TASK_EXIT_CONFERENCE, (task: ITask) => {
|
|
576
|
+
* console.log('Exiting conference:', task.data.interactionId);
|
|
577
|
+
* // Handle conference exit initiation
|
|
578
|
+
* });
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
TASK_EXIT_CONFERENCE = 'task:exitConference',
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Triggered when agent initiates conference transfer
|
|
585
|
+
* @example
|
|
586
|
+
* ```typescript
|
|
587
|
+
* task.on(TASK_EVENTS.TASK_TRANSFER_CONFERENCE, (task: ITask) => {
|
|
588
|
+
* console.log('Transferring conference:', task.data.interactionId);
|
|
589
|
+
* // Handle conference transfer initiation
|
|
590
|
+
* });
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
TASK_TRANSFER_CONFERENCE = 'task:transferConference',
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Triggered when agent switches between consult call and main call.
|
|
597
|
+
* Use task.uiControls to determine current state and button visibility.
|
|
598
|
+
* @example
|
|
599
|
+
* ```typescript
|
|
600
|
+
* task.on(TASK_EVENTS.TASK_SWITCH_CALL, (task: ITask) => {
|
|
601
|
+
* console.log('Call switched:', task.data.interactionId);
|
|
602
|
+
* // Update UI based on task.uiControls.main.switch / task.uiControls.consult.switch
|
|
603
|
+
* });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
TASK_SWITCH_CALL = 'task:switchCall',
|
|
607
|
+
|
|
522
608
|
/**
|
|
523
609
|
* Triggered when a contact is merged
|
|
524
610
|
* @example
|
|
@@ -542,18 +628,6 @@ export enum TASK_EVENTS {
|
|
|
542
628
|
* ```
|
|
543
629
|
*/
|
|
544
630
|
TASK_POST_CALL_ACTIVITY = 'task:postCallActivity',
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Triggered when a campaign preview contact is offered to the agent
|
|
548
|
-
* @example
|
|
549
|
-
* ```typescript
|
|
550
|
-
* task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, (data: AgentContact) => {
|
|
551
|
-
* console.log('Campaign preview contact received:', data.interactionId);
|
|
552
|
-
* // Handle campaign preview reservation
|
|
553
|
-
* });
|
|
554
|
-
* ```
|
|
555
|
-
*/
|
|
556
|
-
TASK_CAMPAIGN_PREVIEW_RESERVATION = 'task:campaignPreviewReservation',
|
|
557
631
|
}
|
|
558
632
|
|
|
559
633
|
/**
|
|
@@ -561,6 +635,146 @@ export enum TASK_EVENTS {
|
|
|
561
635
|
* Contains comprehensive details about an ongoing customer interaction
|
|
562
636
|
* @public
|
|
563
637
|
*/
|
|
638
|
+
export interface CallAssociatedDatum {
|
|
639
|
+
/** Whether the field can be edited by the agent */
|
|
640
|
+
agentEditable: boolean;
|
|
641
|
+
/** Whether the field is visible to the agent */
|
|
642
|
+
agentViewable: boolean;
|
|
643
|
+
/** Display name for the field */
|
|
644
|
+
displayName: string;
|
|
645
|
+
/** Whether the field is global */
|
|
646
|
+
global: boolean;
|
|
647
|
+
/** Whether the field is secure */
|
|
648
|
+
isSecure: boolean;
|
|
649
|
+
/** Internal field name */
|
|
650
|
+
name: string;
|
|
651
|
+
/** Whether the field is reportable */
|
|
652
|
+
reportable: boolean;
|
|
653
|
+
/** Secure key identifier */
|
|
654
|
+
secureKeyId: string;
|
|
655
|
+
/** Secure key version */
|
|
656
|
+
secureKeyVersion: number;
|
|
657
|
+
/** Data type of the field */
|
|
658
|
+
type: string;
|
|
659
|
+
/** Field value */
|
|
660
|
+
value: string;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
export type CallAssociatedData = Record<string, CallAssociatedDatum>;
|
|
664
|
+
|
|
665
|
+
export type CallAssociatedDetails = Record<string, string>;
|
|
666
|
+
|
|
667
|
+
export interface FlowParameter {
|
|
668
|
+
/** Parameter name */
|
|
669
|
+
name?: string;
|
|
670
|
+
/** Additional qualifier */
|
|
671
|
+
qualifier?: string;
|
|
672
|
+
/** Description of the parameter */
|
|
673
|
+
description?: string;
|
|
674
|
+
/** Data type of the value */
|
|
675
|
+
valueDataType?: string;
|
|
676
|
+
/** Value associated with the parameter */
|
|
677
|
+
value?: string;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export interface InteractionParticipant {
|
|
681
|
+
/** Unique participant identifier */
|
|
682
|
+
id: string;
|
|
683
|
+
/** Participant type label used by backend */
|
|
684
|
+
pType: string;
|
|
685
|
+
/** Friendly participant type */
|
|
686
|
+
type: string;
|
|
687
|
+
/** Whether the participant has joined */
|
|
688
|
+
hasJoined: boolean;
|
|
689
|
+
/** Whether the participant has left */
|
|
690
|
+
hasLeft: boolean;
|
|
691
|
+
/** Whether the participant is still in pre-dial */
|
|
692
|
+
isInPredial: boolean;
|
|
693
|
+
/** Optional caller identifier */
|
|
694
|
+
callerId?: string | null;
|
|
695
|
+
/** Whether auto-answer is enabled */
|
|
696
|
+
autoAnswerEnabled?: boolean;
|
|
697
|
+
/** Backchannel/bnr details */
|
|
698
|
+
bnrDetails?: unknown;
|
|
699
|
+
/** Channel identifier for the participant */
|
|
700
|
+
channelId?: string;
|
|
701
|
+
/** Current consult state */
|
|
702
|
+
consultState?: string | null;
|
|
703
|
+
/** Timestamp when consult started */
|
|
704
|
+
consultTimestamp?: number | null;
|
|
705
|
+
/** Current participant state */
|
|
706
|
+
currentState?: string | null;
|
|
707
|
+
/** Timestamp of the current state */
|
|
708
|
+
currentStateTimestamp?: number | null;
|
|
709
|
+
/** Device call identifier */
|
|
710
|
+
deviceCallId?: string | null;
|
|
711
|
+
/** Device identifier */
|
|
712
|
+
deviceId?: string | null;
|
|
713
|
+
/** Device type (AGENT_DN, BROWSER, etc.) */
|
|
714
|
+
deviceType?: string | null;
|
|
715
|
+
/** Dial number associated with participant */
|
|
716
|
+
dn?: string | null;
|
|
717
|
+
/** Whether participant is currently consulted */
|
|
718
|
+
isConsulted?: boolean;
|
|
719
|
+
/** Whether participant offer is active */
|
|
720
|
+
isOffered?: boolean;
|
|
721
|
+
/** Whether participant is in wrap-up */
|
|
722
|
+
isWrapUp?: boolean;
|
|
723
|
+
/** Whether participant completed wrap-up */
|
|
724
|
+
isWrappedUp?: boolean;
|
|
725
|
+
/** Timestamp of when participant joined */
|
|
726
|
+
joinTimestamp?: number | null;
|
|
727
|
+
/** Last updated timestamp */
|
|
728
|
+
lastUpdated?: number | null;
|
|
729
|
+
/** Friendly name of participant */
|
|
730
|
+
name?: string | null;
|
|
731
|
+
/** Queue identifier associated with participant */
|
|
732
|
+
queueId?: string;
|
|
733
|
+
/** Queue manager identifier */
|
|
734
|
+
queueMgrId?: string;
|
|
735
|
+
/** Session identifier */
|
|
736
|
+
sessionId?: string;
|
|
737
|
+
/** Site identifier */
|
|
738
|
+
siteId?: string;
|
|
739
|
+
/** Skill identifier */
|
|
740
|
+
skillId?: string | null;
|
|
741
|
+
/** Skill name */
|
|
742
|
+
skillName?: string | null;
|
|
743
|
+
/** Skill list for participant */
|
|
744
|
+
skills?: string[];
|
|
745
|
+
/** Team identifier */
|
|
746
|
+
teamId?: string;
|
|
747
|
+
/** Team name */
|
|
748
|
+
teamName?: string;
|
|
749
|
+
/** Timestamp for wrap-up */
|
|
750
|
+
wrapUpTimestamp?: number | null;
|
|
751
|
+
/** Additional metadata */
|
|
752
|
+
[key: string]: unknown;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
export type InteractionParticipants = Record<string, InteractionParticipant>;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Media entry type from interaction.media
|
|
759
|
+
* Used for media state tracking in consult and conference scenarios
|
|
760
|
+
*/
|
|
761
|
+
export type MediaEntry = {
|
|
762
|
+
/** Unique identifier for the media resource */
|
|
763
|
+
mediaResourceId: string;
|
|
764
|
+
/** Type of media channel */
|
|
765
|
+
mediaType: MEDIA_CHANNEL;
|
|
766
|
+
/** Media manager handling this media */
|
|
767
|
+
mediaMgr: string;
|
|
768
|
+
/** List of participant identifiers */
|
|
769
|
+
participants: string[];
|
|
770
|
+
/** Type of media (e.g., 'mainCall', 'consult') */
|
|
771
|
+
mType: string;
|
|
772
|
+
/** Indicates if media is on hold */
|
|
773
|
+
isHold: boolean;
|
|
774
|
+
/** Timestamp when media was put on hold */
|
|
775
|
+
holdTimestamp: number | null;
|
|
776
|
+
};
|
|
777
|
+
|
|
564
778
|
export type Interaction = {
|
|
565
779
|
/** Indicates if the interaction is managed by Flow Control */
|
|
566
780
|
isFcManaged: boolean;
|
|
@@ -575,7 +789,11 @@ export type Interaction = {
|
|
|
575
789
|
/** Current virtual team handling the interaction */
|
|
576
790
|
currentVTeam: string;
|
|
577
791
|
/** List of participants in the interaction */
|
|
578
|
-
participants:
|
|
792
|
+
participants: InteractionParticipants;
|
|
793
|
+
/** Detailed call associated data */
|
|
794
|
+
callAssociatedData?: CallAssociatedData;
|
|
795
|
+
/** Simplified call associated key/value pairs */
|
|
796
|
+
callAssociatedDetails?: CallAssociatedDetails;
|
|
579
797
|
/** Unique identifier for the interaction */
|
|
580
798
|
interactionId: string;
|
|
581
799
|
/** Organization identifier */
|
|
@@ -584,7 +802,18 @@ export type Interaction = {
|
|
|
584
802
|
createdTimestamp?: number;
|
|
585
803
|
/** Indicates if wrap-up assistance is enabled */
|
|
586
804
|
isWrapUpAssist?: boolean;
|
|
587
|
-
/**
|
|
805
|
+
/** Identifier of parent interaction if applicable */
|
|
806
|
+
parentInteractionId?: string;
|
|
807
|
+
/** Indicates if media is forked for this interaction */
|
|
808
|
+
isMediaForked?: boolean;
|
|
809
|
+
/** Retroactive flow properties returned by backend */
|
|
810
|
+
flowProperties?: Record<string, unknown> | null;
|
|
811
|
+
/** Media specific properties returned by backend */
|
|
812
|
+
mediaProperties?: Record<string, unknown> | null;
|
|
813
|
+
/**
|
|
814
|
+
* Detailed call processing information and metadata.
|
|
815
|
+
* Mirrors the callProcessingDetails section described in Webex Contact Center Agent Contact payloads.
|
|
816
|
+
*/
|
|
588
817
|
callProcessingDetails: {
|
|
589
818
|
/** Name of the Queue Manager handling this interaction */
|
|
590
819
|
QMgrName: string;
|
|
@@ -602,20 +831,24 @@ export type Interaction = {
|
|
|
602
831
|
QueueId: string;
|
|
603
832
|
/** Virtual team identifier */
|
|
604
833
|
vteamId: string;
|
|
605
|
-
/**
|
|
606
|
-
pauseResumeEnabled?:
|
|
834
|
+
/** Agent capability for pause/resume on this interaction */
|
|
835
|
+
pauseResumeEnabled?: boolean;
|
|
607
836
|
/** Duration of pause in seconds */
|
|
608
837
|
pauseDuration?: string;
|
|
609
|
-
/**
|
|
610
|
-
isPaused?:
|
|
611
|
-
/**
|
|
612
|
-
recordInProgress?:
|
|
613
|
-
/**
|
|
614
|
-
recordingStarted?:
|
|
838
|
+
/** Legacy pause indicator (recordInProgress=false is the active pause signal) */
|
|
839
|
+
isPaused?: boolean;
|
|
840
|
+
/** Recording is actively capturing audio right now */
|
|
841
|
+
recordInProgress?: boolean;
|
|
842
|
+
/** Recording was started for this interaction (may be paused) */
|
|
843
|
+
recordingStarted?: boolean;
|
|
844
|
+
/** Customer geographic region */
|
|
845
|
+
customerRegion?: string;
|
|
846
|
+
/** Flow tag identifier */
|
|
847
|
+
flowTagId?: string;
|
|
615
848
|
/** Indicates if Consult to Queue is in progress */
|
|
616
|
-
ctqInProgress?:
|
|
849
|
+
ctqInProgress?: boolean;
|
|
617
850
|
/** Indicates if outdial transfer to queue is enabled */
|
|
618
|
-
outdialTransferToQueueEnabled?:
|
|
851
|
+
outdialTransferToQueueEnabled?: boolean;
|
|
619
852
|
/** IVR conversation transcript */
|
|
620
853
|
convIvrTranscript?: string;
|
|
621
854
|
/** Customer's name */
|
|
@@ -705,61 +938,54 @@ export type Interaction = {
|
|
|
705
938
|
};
|
|
706
939
|
/** Main interaction identifier for related interactions */
|
|
707
940
|
mainInteractionId?: string;
|
|
941
|
+
/** Timestamp when interaction entered queue */
|
|
942
|
+
queuedTimestamp?: number | null;
|
|
708
943
|
/** Media-specific information for the interaction */
|
|
709
|
-
media: Record<
|
|
710
|
-
string,
|
|
711
|
-
{
|
|
712
|
-
/** Unique identifier for the media resource */
|
|
713
|
-
mediaResourceId: string;
|
|
714
|
-
/** Type of media channel */
|
|
715
|
-
mediaType: MEDIA_CHANNEL;
|
|
716
|
-
/** Media manager handling this media */
|
|
717
|
-
mediaMgr: string;
|
|
718
|
-
/** List of participant identifiers */
|
|
719
|
-
participants: string[];
|
|
720
|
-
/** Type of media */
|
|
721
|
-
mType: string;
|
|
722
|
-
/** Indicates if media is on hold */
|
|
723
|
-
isHold: boolean;
|
|
724
|
-
/** Timestamp when media was put on hold */
|
|
725
|
-
holdTimestamp: number | null;
|
|
726
|
-
}
|
|
727
|
-
>;
|
|
944
|
+
media: Record<string, MediaEntry>;
|
|
728
945
|
/** Owner of the interaction */
|
|
729
946
|
owner: string;
|
|
730
947
|
/** Primary media channel for the interaction */
|
|
731
|
-
mediaChannel:
|
|
948
|
+
mediaChannel: string;
|
|
732
949
|
/** Direction information for the contact */
|
|
733
950
|
contactDirection: {type: string};
|
|
734
951
|
/** Type of outbound interaction */
|
|
735
952
|
outboundType?: string;
|
|
953
|
+
/** Optional workflow manager identifier */
|
|
954
|
+
workflowManager?: string | null;
|
|
736
955
|
/** Parameters passed through the call flow */
|
|
737
|
-
callFlowParams
|
|
738
|
-
string,
|
|
739
|
-
{
|
|
740
|
-
/** Name of the parameter */
|
|
741
|
-
name: string;
|
|
742
|
-
/** Qualifier for the parameter */
|
|
743
|
-
qualifier: string;
|
|
744
|
-
/** Description of the parameter */
|
|
745
|
-
description: string;
|
|
746
|
-
/** Data type of the parameter value */
|
|
747
|
-
valueDataType: string;
|
|
748
|
-
/** Value of the parameter */
|
|
749
|
-
value: string;
|
|
750
|
-
}
|
|
751
|
-
>;
|
|
956
|
+
callFlowParams?: Record<string, FlowParameter>;
|
|
752
957
|
};
|
|
753
958
|
|
|
754
959
|
/**
|
|
755
|
-
* Task payload
|
|
756
|
-
*
|
|
960
|
+
* Task payload mirroring the Agent Contact event payload from Webex Contact Center
|
|
961
|
+
* (developer.webex.com). Arrives on AGENT_* websocket events and is the source of truth
|
|
962
|
+
* for UI/state machine updates.
|
|
757
963
|
* @public
|
|
758
964
|
*/
|
|
965
|
+
export type RealtimeTranscription = {
|
|
966
|
+
agentId: string;
|
|
967
|
+
orgId: string;
|
|
968
|
+
notifType: string;
|
|
969
|
+
notifDetails: {
|
|
970
|
+
actionEvent: string;
|
|
971
|
+
};
|
|
972
|
+
data: {
|
|
973
|
+
role: 'AGENT' | 'CALLER';
|
|
974
|
+
utteranceId: string;
|
|
975
|
+
conversationId: string;
|
|
976
|
+
publishTimestamp: number;
|
|
977
|
+
messageId: string;
|
|
978
|
+
isFinal: boolean;
|
|
979
|
+
languageCode: string;
|
|
980
|
+
orgId: string;
|
|
981
|
+
content: string;
|
|
982
|
+
};
|
|
983
|
+
};
|
|
984
|
+
|
|
759
985
|
export type TaskData = {
|
|
760
|
-
/**
|
|
986
|
+
/** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
|
|
761
987
|
mediaResourceId: string;
|
|
762
|
-
/**
|
|
988
|
+
/** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
|
|
763
989
|
eventType: string;
|
|
764
990
|
/** Timestamp when the event occurred */
|
|
765
991
|
eventTime?: number;
|
|
@@ -769,7 +995,7 @@ export type TaskData = {
|
|
|
769
995
|
destAgentId: string;
|
|
770
996
|
/** Unique tracking identifier for the task */
|
|
771
997
|
trackingId: string;
|
|
772
|
-
/** Media resource identifier for consultation
|
|
998
|
+
/** Media resource identifier for consultation leg when present */
|
|
773
999
|
consultMediaResourceId: string;
|
|
774
1000
|
/** Detailed interaction information */
|
|
775
1001
|
interaction: Interaction;
|
|
@@ -781,7 +1007,7 @@ export type TaskData = {
|
|
|
781
1007
|
toOwner?: boolean;
|
|
782
1008
|
/** Identifier for child interaction in consult/transfer scenarios */
|
|
783
1009
|
childInteractionId?: string;
|
|
784
|
-
/**
|
|
1010
|
+
/** Interaction/contact identifier from backend (same as interaction.interactionId) */
|
|
785
1011
|
interactionId: string;
|
|
786
1012
|
/** Organization identifier */
|
|
787
1013
|
orgId: string;
|
|
@@ -791,7 +1017,7 @@ export type TaskData = {
|
|
|
791
1017
|
queueMgr: string;
|
|
792
1018
|
/** Name of the queue where task is queued */
|
|
793
1019
|
queueName?: string;
|
|
794
|
-
/**
|
|
1020
|
+
/** Task/interaction type returned by the platform (routing/monitoring/etc.) */
|
|
795
1021
|
type: string;
|
|
796
1022
|
/** Timeout value for RONA (Redirection on No Answer) in seconds */
|
|
797
1023
|
ronaTimeout?: number;
|
|
@@ -827,12 +1053,107 @@ export type TaskData = {
|
|
|
827
1053
|
reservedAgentChannelId?: string;
|
|
828
1054
|
/** Indicates if wrap-up is required for this task */
|
|
829
1055
|
wrapUpRequired?: boolean;
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Current consultation status derived from state machine
|
|
1059
|
+
* Values: CONSULT_INITIATED, CONSULT_ACCEPTED, BEING_CONSULTED,
|
|
1060
|
+
* BEING_CONSULTED_ACCEPTED, CONNECTED, CONFERENCE, CONSULT_COMPLETED
|
|
1061
|
+
*/
|
|
1062
|
+
consultStatus?: string;
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Indicates if consultation is in progress (state machine: CONSULTING)
|
|
1066
|
+
*/
|
|
1067
|
+
isConsultInProgress?: boolean;
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Indicates if the task is incoming for the active agent
|
|
1071
|
+
*/
|
|
1072
|
+
isIncomingTask?: boolean;
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Indicates if the task is on hold (state machine: HELD)
|
|
1076
|
+
*/
|
|
1077
|
+
isOnHold?: boolean;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Indicates if customer is currently in the call
|
|
1081
|
+
* Derived from participants in main media
|
|
1082
|
+
*/
|
|
1083
|
+
isCustomerInCall?: boolean;
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Count of conference participants (agents only)
|
|
1087
|
+
* Used for determining if max participants reached
|
|
1088
|
+
*/
|
|
1089
|
+
conferenceParticipantsCount?: number;
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Indicates if this is a secondary agent (consulted party)
|
|
1093
|
+
*/
|
|
1094
|
+
isSecondaryAgent?: boolean;
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Indicates if this is a secondary EP-DN agent (telephony consult to external)
|
|
1098
|
+
*/
|
|
1099
|
+
isSecondaryEpDnAgent?: boolean;
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* Task state for MPC (Multi-Party Conference) scenarios
|
|
1103
|
+
* Maps participant consultState to task state
|
|
1104
|
+
*/
|
|
1105
|
+
mpcState?: string;
|
|
830
1106
|
/** Indicates if auto-answer is in progress for this task */
|
|
831
1107
|
isAutoAnswering?: boolean;
|
|
832
1108
|
/** Indicates if wrap-up is required for this task */
|
|
833
1109
|
agentsPendingWrapUp?: string[];
|
|
834
1110
|
};
|
|
835
1111
|
|
|
1112
|
+
export type TaskUIControlState = {
|
|
1113
|
+
isVisible: boolean;
|
|
1114
|
+
isEnabled: boolean;
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* UI control representation for a single interaction leg.
|
|
1119
|
+
*/
|
|
1120
|
+
export type InteractionUIControls = {
|
|
1121
|
+
accept: TaskUIControlState;
|
|
1122
|
+
decline: TaskUIControlState;
|
|
1123
|
+
hold: TaskUIControlState;
|
|
1124
|
+
transfer: TaskUIControlState;
|
|
1125
|
+
consult: TaskUIControlState;
|
|
1126
|
+
end: TaskUIControlState;
|
|
1127
|
+
recording: TaskUIControlState;
|
|
1128
|
+
mute: TaskUIControlState;
|
|
1129
|
+
consultTransfer: TaskUIControlState;
|
|
1130
|
+
endConsult: TaskUIControlState;
|
|
1131
|
+
conference: TaskUIControlState;
|
|
1132
|
+
exitConference: TaskUIControlState;
|
|
1133
|
+
transferConference: TaskUIControlState;
|
|
1134
|
+
mergeToConference: TaskUIControlState;
|
|
1135
|
+
wrapup: TaskUIControlState;
|
|
1136
|
+
switch: TaskUIControlState;
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
export type TaskUILeg = 'main' | 'consult';
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* UI controls surfaced to task consumers.
|
|
1143
|
+
* Consumers should read controls from the per-leg surfaces and use `activeLeg`
|
|
1144
|
+
* to determine which one is currently interactive.
|
|
1145
|
+
*/
|
|
1146
|
+
export type TaskUIControls = {
|
|
1147
|
+
main: InteractionUIControls;
|
|
1148
|
+
consult: InteractionUIControls;
|
|
1149
|
+
activeLeg: TaskUILeg;
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Helper class for managing task action control state
|
|
1154
|
+
* Tracks visibility and enabled state for task actions that can be executed
|
|
1155
|
+
* @public
|
|
1156
|
+
*/
|
|
836
1157
|
/**
|
|
837
1158
|
* Type representing an agent contact message within the contact center system
|
|
838
1159
|
* Contains comprehensive interaction and task related details for agent operations
|
|
@@ -1054,6 +1375,15 @@ export type TransferPayload = {
|
|
|
1054
1375
|
destinationType: DestinationType;
|
|
1055
1376
|
};
|
|
1056
1377
|
|
|
1378
|
+
/**
|
|
1379
|
+
* Options for configuring transfer behavior
|
|
1380
|
+
* @public
|
|
1381
|
+
*/
|
|
1382
|
+
export type TransferOptions = {
|
|
1383
|
+
/** Additional transfer configuration options */
|
|
1384
|
+
[key: string]: unknown;
|
|
1385
|
+
};
|
|
1386
|
+
|
|
1057
1387
|
/**
|
|
1058
1388
|
* API payload for ending a consultation
|
|
1059
1389
|
* This is the actual payload that is sent to the developer API
|
|
@@ -1129,18 +1459,6 @@ export type DialerPayload = {
|
|
|
1129
1459
|
origin: string;
|
|
1130
1460
|
};
|
|
1131
1461
|
|
|
1132
|
-
/**
|
|
1133
|
-
* Payload for campaign preview contact operations (accept, skip, remove)
|
|
1134
|
-
* @public
|
|
1135
|
-
*/
|
|
1136
|
-
export type PreviewContactPayload = {
|
|
1137
|
-
/** The interaction ID from the campaign reservation */
|
|
1138
|
-
interactionId: string;
|
|
1139
|
-
/** The campaign name (not a UUID). Available from the reservation event at
|
|
1140
|
-
* `task.data.interaction.callProcessingDetails.campaignId` or `task.data.campaignId`. */
|
|
1141
|
-
campaignId: string;
|
|
1142
|
-
};
|
|
1143
|
-
|
|
1144
1462
|
/**
|
|
1145
1463
|
* Data structure for cleaning up contact resources
|
|
1146
1464
|
* @public
|
|
@@ -1175,6 +1493,41 @@ export type ContactCleanupData = {
|
|
|
1175
1493
|
};
|
|
1176
1494
|
};
|
|
1177
1495
|
|
|
1496
|
+
/**
|
|
1497
|
+
* Boolean-like fields in callProcessingDetails that may arrive as strings.
|
|
1498
|
+
* Used by taskDataNormalizer to coerce payloads to actual booleans.
|
|
1499
|
+
*/
|
|
1500
|
+
export type CallProcessingBooleanKey =
|
|
1501
|
+
| 'recordingStarted'
|
|
1502
|
+
| 'recordInProgress'
|
|
1503
|
+
| 'isPaused'
|
|
1504
|
+
| 'pauseResumeEnabled'
|
|
1505
|
+
| 'ctqInProgress'
|
|
1506
|
+
| 'outdialTransferToQueueEnabled'
|
|
1507
|
+
| 'taskToBeSelfServiced'
|
|
1508
|
+
| 'CONTINUE_RECORDING_ON_TRANSFER'
|
|
1509
|
+
| 'isParked'
|
|
1510
|
+
| 'participantInviteTimeout'
|
|
1511
|
+
| 'checkAgentAvailability';
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Interaction-level boolean fields that may arrive as strings from backend payloads.
|
|
1515
|
+
*/
|
|
1516
|
+
export type InteractionBooleanKey = 'isFcManaged' | 'isMediaForked' | 'isTerminated';
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* Participant boolean fields that may arrive as strings and need normalization.
|
|
1520
|
+
*/
|
|
1521
|
+
export type ParticipantBooleanKey =
|
|
1522
|
+
| 'autoAnswerEnabled'
|
|
1523
|
+
| 'hasJoined'
|
|
1524
|
+
| 'hasLeft'
|
|
1525
|
+
| 'isConsulted'
|
|
1526
|
+
| 'isInPredial'
|
|
1527
|
+
| 'isOffered'
|
|
1528
|
+
| 'isWrapUp'
|
|
1529
|
+
| 'isWrappedUp';
|
|
1530
|
+
|
|
1178
1531
|
/**
|
|
1179
1532
|
* Response type for task public methods
|
|
1180
1533
|
* Can be an {@link AgentContact} object containing updated task state,
|
|
@@ -1183,11 +1536,38 @@ export type ContactCleanupData = {
|
|
|
1183
1536
|
*/
|
|
1184
1537
|
export type TaskResponse = AgentContact | Error | void;
|
|
1185
1538
|
|
|
1539
|
+
/**
|
|
1540
|
+
* Payload shape used by consult conference helper utilities.
|
|
1541
|
+
*/
|
|
1542
|
+
export type consultConferencePayloadData = {
|
|
1543
|
+
agentId?: string;
|
|
1544
|
+
destinationType?: string;
|
|
1545
|
+
destAgentId?: string;
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* Minimal event-emitter contract exposed to SDK consumers.
|
|
1550
|
+
* Defined here so that consumers do NOT need `@types/node` in their tsconfig.
|
|
1551
|
+
* The runtime Task class still extends Node's EventEmitter (via ampersand-events),
|
|
1552
|
+
* which satisfies this interface at runtime.
|
|
1553
|
+
* @public
|
|
1554
|
+
*/
|
|
1555
|
+
export interface IEventEmitter {
|
|
1556
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1557
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
1558
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1559
|
+
off(event: string, listener: (...args: any[]) => void): this;
|
|
1560
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1561
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
1562
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1563
|
+
emit(event: string, ...args: any[]): boolean;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1186
1566
|
/**
|
|
1187
1567
|
* Interface for managing task-related operations in the contact center
|
|
1188
|
-
* Extends
|
|
1568
|
+
* Extends IEventEmitter to support event-driven task updates
|
|
1189
1569
|
*/
|
|
1190
|
-
export interface ITask extends
|
|
1570
|
+
export interface ITask extends IEventEmitter {
|
|
1191
1571
|
/**
|
|
1192
1572
|
* Event data received in the Contact Center events.
|
|
1193
1573
|
* Contains detailed task information including interaction details, media resources,
|
|
@@ -1207,6 +1587,36 @@ export interface ITask extends EventEmitter {
|
|
|
1207
1587
|
*/
|
|
1208
1588
|
autoWrapup?: AutoWrapup;
|
|
1209
1589
|
|
|
1590
|
+
/**
|
|
1591
|
+
* Latest UI controls derived from the state machine.
|
|
1592
|
+
* Each control has `isVisible` and `isEnabled` flags computed from current task state.
|
|
1593
|
+
* Subscribe to {@link TASK_EVENTS.TASK_UI_CONTROLS_UPDATED} for change notifications.
|
|
1594
|
+
*/
|
|
1595
|
+
readonly uiControls: TaskUIControls;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* State machine instance for managing task state transitions and derived properties.
|
|
1599
|
+
* The state machine handles:
|
|
1600
|
+
* - State transitions (IDLE → OFFERED → CONNECTED → HELD, etc.)
|
|
1601
|
+
* - Derived properties (canHold, canResume, isConsulted, etc.)
|
|
1602
|
+
* - Action availability based on current state
|
|
1603
|
+
*
|
|
1604
|
+
* This is part of the migration from manual state management to centralized state machine.
|
|
1605
|
+
* During the transition period, both the old setUIControls() and state machine coexist.
|
|
1606
|
+
*
|
|
1607
|
+
* @see createTaskStateMachine
|
|
1608
|
+
* @internal
|
|
1609
|
+
*/
|
|
1610
|
+
stateMachineService?: AnyActorRef;
|
|
1611
|
+
state?: any;
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* Helper method to send events to the state machine.
|
|
1615
|
+
* This is part of the migration to XState.
|
|
1616
|
+
* @internal
|
|
1617
|
+
*/
|
|
1618
|
+
sendStateMachineEvent: (event: TaskEventPayload) => void;
|
|
1619
|
+
|
|
1210
1620
|
/**
|
|
1211
1621
|
* Cancels the auto-wrapup timer for the task.
|
|
1212
1622
|
* This method stops the auto-wrapup process if it is currently active.
|
|
@@ -1228,7 +1638,7 @@ export interface ITask extends EventEmitter {
|
|
|
1228
1638
|
* @returns Updated task instance
|
|
1229
1639
|
* @ignore
|
|
1230
1640
|
*/
|
|
1231
|
-
updateTaskData(newData: TaskData):
|
|
1641
|
+
updateTaskData(newData: TaskData): void;
|
|
1232
1642
|
|
|
1233
1643
|
/**
|
|
1234
1644
|
* Answers or accepts an incoming task.
|
|
@@ -1360,18 +1770,7 @@ export interface ITask extends EventEmitter {
|
|
|
1360
1770
|
* await task.transfer({ to: "queueId", destinationType: "queue" });
|
|
1361
1771
|
* ```
|
|
1362
1772
|
*/
|
|
1363
|
-
transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
|
|
1364
|
-
|
|
1365
|
-
/**
|
|
1366
|
-
* Transfers the task after consultation.
|
|
1367
|
-
* @param consultTransferPayload - Details for consult transfer (optional)
|
|
1368
|
-
* @returns Promise<TaskResponse>
|
|
1369
|
-
* @example
|
|
1370
|
-
* ```typescript
|
|
1371
|
-
* await task.consultTransfer({ to: "agentId", destinationType: "agent" });
|
|
1372
|
-
* ```
|
|
1373
|
-
*/
|
|
1374
|
-
consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
|
|
1773
|
+
transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
|
|
1375
1774
|
|
|
1376
1775
|
/**
|
|
1377
1776
|
* Initiates a consult conference (merge consult call with main call).
|
|
@@ -1403,6 +1802,19 @@ export interface ITask extends EventEmitter {
|
|
|
1403
1802
|
*/
|
|
1404
1803
|
transferConference(): Promise<TaskResponse>;
|
|
1405
1804
|
|
|
1805
|
+
/**
|
|
1806
|
+
* Toggles between consult call and main call during consulting.
|
|
1807
|
+
* If on consult leg, switches to main call (holds consult).
|
|
1808
|
+
* If on main call, switches to consult (resumes consult).
|
|
1809
|
+
* Only available when in CONSULTING state.
|
|
1810
|
+
* @returns Promise<TaskResponse>
|
|
1811
|
+
* @example
|
|
1812
|
+
* ```typescript
|
|
1813
|
+
* await task.switchCall();
|
|
1814
|
+
* ```
|
|
1815
|
+
*/
|
|
1816
|
+
switchCall(): Promise<TaskResponse>;
|
|
1817
|
+
|
|
1406
1818
|
/**
|
|
1407
1819
|
* Toggles mute/unmute for the local audio stream during a WebRTC task.
|
|
1408
1820
|
* @returns Promise<void>
|
|
@@ -1413,3 +1825,137 @@ export interface ITask extends EventEmitter {
|
|
|
1413
1825
|
*/
|
|
1414
1826
|
toggleMute(): Promise<void>;
|
|
1415
1827
|
}
|
|
1828
|
+
|
|
1829
|
+
/**
|
|
1830
|
+
* Interface for managing digital channel task operations in the contact center
|
|
1831
|
+
* Digital channels (chat, email, social, SMS) have a simpler interface than voice
|
|
1832
|
+
* Extends ITask but overrides updateTaskData to return IDigital
|
|
1833
|
+
* @public
|
|
1834
|
+
*/
|
|
1835
|
+
export interface IDigital extends Omit<ITask, 'updateTaskData'> {
|
|
1836
|
+
/**
|
|
1837
|
+
* Updates the task data
|
|
1838
|
+
* @param newData - Updated task data
|
|
1839
|
+
* @param shouldOverwrite - Whether to completely replace existing data
|
|
1840
|
+
* @returns Updated Digital task instance
|
|
1841
|
+
*/
|
|
1842
|
+
updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
* Interface for managing voice/telephony task operations in the contact center
|
|
1847
|
+
* Extends ITask with voice-specific functionality for hold/resume operations
|
|
1848
|
+
* @public
|
|
1849
|
+
*/
|
|
1850
|
+
export interface IVoice extends ITask {
|
|
1851
|
+
/**
|
|
1852
|
+
* Toggles hold/resume state for a voice task.
|
|
1853
|
+
* If the task is currently on hold, it will be resumed.
|
|
1854
|
+
* If the task is active, it will be placed on hold.
|
|
1855
|
+
* @returns Promise<TaskResponse>
|
|
1856
|
+
* @example
|
|
1857
|
+
* ```typescript
|
|
1858
|
+
* await voiceTask.holdResume();
|
|
1859
|
+
* ```
|
|
1860
|
+
*/
|
|
1861
|
+
holdResume(): Promise<TaskResponse>;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* Configuration options for voice task UI controls
|
|
1866
|
+
*/
|
|
1867
|
+
export type VoiceUIControlOptions = {
|
|
1868
|
+
isEndTaskEnabled?: boolean;
|
|
1869
|
+
isEndConsultEnabled?: boolean;
|
|
1870
|
+
voiceVariant?: VoiceVariant;
|
|
1871
|
+
isRecordingEnabled?: boolean;
|
|
1872
|
+
};
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* Participant information for UI display
|
|
1876
|
+
*/
|
|
1877
|
+
export type Participant = {
|
|
1878
|
+
id: string;
|
|
1879
|
+
name?: string;
|
|
1880
|
+
pType?: string;
|
|
1881
|
+
};
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* @deprecated Use Participant instead
|
|
1885
|
+
*/
|
|
1886
|
+
export type TaskAccessorParticipant = Participant;
|
|
1887
|
+
|
|
1888
|
+
export interface IWebRTC extends IVoice {
|
|
1889
|
+
/**
|
|
1890
|
+
* This method is used to mute/unmute the call.
|
|
1891
|
+
* @returns Promise<void>
|
|
1892
|
+
* @example
|
|
1893
|
+
* ```typescript
|
|
1894
|
+
* task.toggleMute();
|
|
1895
|
+
* ```
|
|
1896
|
+
*/
|
|
1897
|
+
toggleMute(): Promise<void>;
|
|
1898
|
+
/**
|
|
1899
|
+
* Decline the incoming task for Browser Login
|
|
1900
|
+
*
|
|
1901
|
+
* @example
|
|
1902
|
+
* ```
|
|
1903
|
+
* task.decline();
|
|
1904
|
+
* ```
|
|
1905
|
+
*/
|
|
1906
|
+
decline(): Promise<TaskResponse>;
|
|
1907
|
+
/**
|
|
1908
|
+
* This method is used to unregister the web call listeners.
|
|
1909
|
+
* @returns void
|
|
1910
|
+
* @example
|
|
1911
|
+
* ```typescript
|
|
1912
|
+
* task.unregisterWebCallListeners();
|
|
1913
|
+
* ```
|
|
1914
|
+
*/
|
|
1915
|
+
unregisterWebCallListeners(): void;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
export type WebSocketPayload = TaskData & {
|
|
1919
|
+
type: string;
|
|
1920
|
+
mediaResourceId?: string;
|
|
1921
|
+
reason?: string;
|
|
1922
|
+
/**
|
|
1923
|
+
* Optional real-time transcript chunk payload.
|
|
1924
|
+
* Present on REAL_TIME_TRANSCRIPTION notifications.
|
|
1925
|
+
*/
|
|
1926
|
+
data?: RealtimeTranscription['data'];
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
export type WebSocketMessage = {
|
|
1930
|
+
keepalive?: 'true' | 'false' | boolean;
|
|
1931
|
+
type?: string;
|
|
1932
|
+
data: WebSocketPayload;
|
|
1933
|
+
};
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Actions to be performed after handling an event
|
|
1937
|
+
*
|
|
1938
|
+
* These actions represent TaskManager-level concerns (task collection lifecycle,
|
|
1939
|
+
* resource cleanup) rather than task-level state machine concerns. The separation
|
|
1940
|
+
* ensures proper responsibility:
|
|
1941
|
+
* - TaskManager: Collection management, metrics, cleanup
|
|
1942
|
+
* - State Machine: Task state transitions, event emissions, UI controls
|
|
1943
|
+
*/
|
|
1944
|
+
export interface TaskEventActions {
|
|
1945
|
+
task?: ITask;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Context for processing an event
|
|
1950
|
+
*
|
|
1951
|
+
* Contains all information needed to process a WebSocket event:
|
|
1952
|
+
* - Event type and payload from the backend
|
|
1953
|
+
* - Task instance (if exists)
|
|
1954
|
+
* - Pre-mapped state machine event (if applicable)
|
|
1955
|
+
*/
|
|
1956
|
+
export interface EventContext {
|
|
1957
|
+
eventType: string;
|
|
1958
|
+
payload: WebSocketPayload;
|
|
1959
|
+
task?: ITask;
|
|
1960
|
+
stateMachineEvent?: TaskEventPayload | null;
|
|
1961
|
+
}
|