@webex/contact-center 3.12.0-next.8 → 3.12.0-next.81
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 +265 -29
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +16 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +101 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +23 -4
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +74 -3
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/config/Util.js +3 -3
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +23 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/types.js +49 -9
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +107 -32
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +2 -1
- 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 -1
- 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 +725 -526
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +162 -26
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +9 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +78 -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 +837 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +543 -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 +340 -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 +553 -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 +212 -4
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1042 -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 +94 -1
- package/dist/types/config.d.ts +6 -0
- package/dist/types/constants.d.ts +16 -1
- package/dist/types/index.d.ts +21 -6
- package/dist/types/metrics/constants.d.ts +19 -1
- package/dist/types/services/ApiAiAssistant.d.ts +11 -3
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/config/constants.d.ts +21 -0
- package/dist/types/services/config/types.d.ts +171 -10
- package/dist/types/services/core/Err.d.ts +4 -0
- package/dist/types/services/core/Utils.d.ts +33 -13
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
- 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 +157 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskUtils.d.ts +46 -2
- package/dist/types/services/task/constants.d.ts +7 -0
- package/dist/types/services/task/dialer.d.ts +30 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -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 +90 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +267 -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 +603 -66
- 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 +94 -0
- package/dist/types/webex.d.ts +1 -0
- package/dist/types.js +85 -0
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +15 -12
- package/src/cc.ts +329 -30
- package/src/config.ts +6 -0
- package/src/constants.ts +16 -1
- package/src/index.ts +23 -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 +106 -0
- package/src/metrics/constants.ts +23 -4
- package/src/services/ApiAiAssistant.ts +104 -3
- package/src/services/UserPreference.ts +509 -0
- 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 +3 -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/constants.ts +25 -1
- package/src/services/config/types.ts +174 -11
- package/src/services/core/Err.ts +2 -0
- package/src/services/core/Utils.ts +123 -37
- package/src/services/core/ai-docs/AGENTS.md +379 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
- package/src/services/core/websocket/WebSocketManager.ts +2 -0
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +1 -1
- package/src/services/task/Task.ts +837 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +738 -613
- package/src/services/task/TaskUtils.ts +205 -25
- package/src/services/task/ai-docs/AGENTS.md +455 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +585 -0
- package/src/services/task/constants.ts +7 -0
- package/src/services/task/dialer.ts +80 -0
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
- package/src/services/task/state-machine/actions.ts +685 -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 +172 -0
- package/src/services/task/state-machine/guards.ts +406 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +241 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +710 -71
- package/src/services/task/voice/Voice.ts +1267 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +122 -2
- package/src/utils/AGENTS.md +276 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +343 -23
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +122 -17
- 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 +30 -30
- package/test/unit/spec/services/core/Utils.ts +425 -8
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
- 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 +832 -1702
- package/test/unit/spec/services/task/TaskUtils.ts +206 -0
- package/test/unit/spec/services/task/dialer.ts +190 -0
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +631 -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/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,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { CallId } from '@webex/calling/dist/types/common/types';
|
|
3
|
-
import EventEmitter from 'events';
|
|
1
|
+
import { TaskEventPayload } from './state-machine';
|
|
4
2
|
import { Msg } from '../core/GlobalTypes';
|
|
5
3
|
import AutoWrapup from './AutoWrapup';
|
|
6
4
|
/**
|
|
@@ -8,6 +6,10 @@ import AutoWrapup from './AutoWrapup';
|
|
|
8
6
|
* @public
|
|
9
7
|
*/
|
|
10
8
|
export type TaskId = string;
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier for a call in the Webex calling system
|
|
11
|
+
*/
|
|
12
|
+
export type CallId = string;
|
|
11
13
|
/**
|
|
12
14
|
* Defines the valid destination types for routing tasks within the contact center
|
|
13
15
|
* Used to specify where a task should be directed
|
|
@@ -77,6 +79,22 @@ export declare const MEDIA_CHANNEL: {
|
|
|
77
79
|
* @public
|
|
78
80
|
*/
|
|
79
81
|
export type MEDIA_CHANNEL = Enum<typeof MEDIA_CHANNEL>;
|
|
82
|
+
/**
|
|
83
|
+
* Supported task channel types for UI control configuration
|
|
84
|
+
*/
|
|
85
|
+
export declare const TASK_CHANNEL_TYPE: {
|
|
86
|
+
readonly VOICE: "voice";
|
|
87
|
+
readonly DIGITAL: "digital";
|
|
88
|
+
};
|
|
89
|
+
export type TaskChannelType = Enum<typeof TASK_CHANNEL_TYPE>;
|
|
90
|
+
/**
|
|
91
|
+
* Voice channel variants that toggle PSTN/WebRTC specific behaviors
|
|
92
|
+
*/
|
|
93
|
+
export declare const VOICE_VARIANT: {
|
|
94
|
+
readonly PSTN: "pstn";
|
|
95
|
+
readonly WEBRTC: "webrtc";
|
|
96
|
+
};
|
|
97
|
+
export type VoiceVariant = Enum<typeof VOICE_VARIANT>;
|
|
80
98
|
/**
|
|
81
99
|
* Enumeration of all task-related events that can occur in the contact center system
|
|
82
100
|
* These events represent different states and actions in the task lifecycle
|
|
@@ -181,6 +199,10 @@ export declare enum TASK_EVENTS {
|
|
|
181
199
|
* ```
|
|
182
200
|
*/
|
|
183
201
|
TASK_CONSULT_QUEUE_FAILED = "task:consultQueueFailed",
|
|
202
|
+
/**
|
|
203
|
+
* Triggered whenever task UI controls are recalculated
|
|
204
|
+
*/
|
|
205
|
+
TASK_UI_CONTROLS_UPDATED = "task:ui-controls-updated",
|
|
184
206
|
/**
|
|
185
207
|
* Triggered when a consultation request is accepted
|
|
186
208
|
* @example
|
|
@@ -258,6 +280,16 @@ export declare enum TASK_EVENTS {
|
|
|
258
280
|
* ```
|
|
259
281
|
*/
|
|
260
282
|
TASK_WRAPPEDUP = "task:wrappedup",
|
|
283
|
+
/**
|
|
284
|
+
* Triggered when recording is started
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* task.on(TASK_EVENTS.TASK_RECORDING_STARTED, (task: ITask) => {
|
|
288
|
+
* console.log('Recording started:', task.data.interactionId);
|
|
289
|
+
* });
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
TASK_RECORDING_STARTED = "task:recordingStarted",
|
|
261
293
|
/**
|
|
262
294
|
* Triggered when recording is paused
|
|
263
295
|
* @example
|
|
@@ -471,6 +503,40 @@ export declare enum TASK_EVENTS {
|
|
|
471
503
|
* ```
|
|
472
504
|
*/
|
|
473
505
|
TASK_PARTICIPANT_LEFT_FAILED = "task:participantLeftFailed",
|
|
506
|
+
/**
|
|
507
|
+
* Triggered when agent initiates exit from conference
|
|
508
|
+
* @example
|
|
509
|
+
* ```typescript
|
|
510
|
+
* task.on(TASK_EVENTS.TASK_EXIT_CONFERENCE, (task: ITask) => {
|
|
511
|
+
* console.log('Exiting conference:', task.data.interactionId);
|
|
512
|
+
* // Handle conference exit initiation
|
|
513
|
+
* });
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
TASK_EXIT_CONFERENCE = "task:exitConference",
|
|
517
|
+
/**
|
|
518
|
+
* Triggered when agent initiates conference transfer
|
|
519
|
+
* @example
|
|
520
|
+
* ```typescript
|
|
521
|
+
* task.on(TASK_EVENTS.TASK_TRANSFER_CONFERENCE, (task: ITask) => {
|
|
522
|
+
* console.log('Transferring conference:', task.data.interactionId);
|
|
523
|
+
* // Handle conference transfer initiation
|
|
524
|
+
* });
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
TASK_TRANSFER_CONFERENCE = "task:transferConference",
|
|
528
|
+
/**
|
|
529
|
+
* Triggered when agent switches between consult call and main call.
|
|
530
|
+
* Use task.uiControls to determine current state and button visibility.
|
|
531
|
+
* @example
|
|
532
|
+
* ```typescript
|
|
533
|
+
* task.on(TASK_EVENTS.TASK_SWITCH_CALL, (task: ITask) => {
|
|
534
|
+
* console.log('Call switched:', task.data.interactionId);
|
|
535
|
+
* // Update UI based on task.uiControls.main.switch / task.uiControls.consult.switch
|
|
536
|
+
* });
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
TASK_SWITCH_CALL = "task:switchCall",
|
|
474
540
|
/**
|
|
475
541
|
* Triggered when a contact is merged
|
|
476
542
|
* @example
|
|
@@ -493,6 +559,16 @@ export declare enum TASK_EVENTS {
|
|
|
493
559
|
* ```
|
|
494
560
|
*/
|
|
495
561
|
TASK_POST_CALL_ACTIVITY = "task:postCallActivity",
|
|
562
|
+
/**
|
|
563
|
+
* Triggered when a multi-login task update should hydrate SDK instances without Mobius registration.
|
|
564
|
+
* @example
|
|
565
|
+
* ```typescript
|
|
566
|
+
* task.on(TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, (task: ITask) => {
|
|
567
|
+
* console.log('Multi-login hydrate:', task.data.interactionId);
|
|
568
|
+
* });
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
TASK_MULTI_LOGIN_HYDRATE = "task:multiLoginHydrate",
|
|
496
572
|
/**
|
|
497
573
|
* Triggered when a campaign preview contact is offered to the agent
|
|
498
574
|
* @example
|
|
@@ -503,13 +579,190 @@ export declare enum TASK_EVENTS {
|
|
|
503
579
|
* });
|
|
504
580
|
* ```
|
|
505
581
|
*/
|
|
506
|
-
TASK_CAMPAIGN_PREVIEW_RESERVATION = "task:campaignPreviewReservation"
|
|
582
|
+
TASK_CAMPAIGN_PREVIEW_RESERVATION = "task:campaignPreviewReservation",
|
|
583
|
+
/**
|
|
584
|
+
* Triggered when accepting a campaign preview contact fails
|
|
585
|
+
* @example
|
|
586
|
+
* ```typescript
|
|
587
|
+
* task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_ACCEPT_FAILED, (task: ITask) => {
|
|
588
|
+
* console.log('Campaign preview accept failed:', task.data.interactionId);
|
|
589
|
+
* // Handle accept failure
|
|
590
|
+
* });
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
TASK_CAMPAIGN_PREVIEW_ACCEPT_FAILED = "task:campaignPreviewAcceptFailed",
|
|
594
|
+
/**
|
|
595
|
+
* Triggered when skipping a campaign preview contact fails
|
|
596
|
+
* @example
|
|
597
|
+
* ```typescript
|
|
598
|
+
* task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_SKIP_FAILED, (task: ITask) => {
|
|
599
|
+
* console.log('Campaign preview skip failed:', task.data.interactionId);
|
|
600
|
+
* // Handle skip failure
|
|
601
|
+
* });
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
TASK_CAMPAIGN_PREVIEW_SKIP_FAILED = "task:campaignPreviewSkipFailed",
|
|
605
|
+
/**
|
|
606
|
+
* Triggered when removing a campaign preview contact fails
|
|
607
|
+
* @example
|
|
608
|
+
* ```typescript
|
|
609
|
+
* task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_REMOVE_FAILED, (task: ITask) => {
|
|
610
|
+
* console.log('Campaign preview remove failed:', task.data.interactionId);
|
|
611
|
+
* // Handle remove failure
|
|
612
|
+
* });
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
TASK_CAMPAIGN_PREVIEW_REMOVE_FAILED = "task:campaignPreviewRemoveFailed",
|
|
616
|
+
/**
|
|
617
|
+
* Triggered when a campaign contact is updated (e.g., after skip or remove, when the next contact is offered)
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* task.on(TASK_EVENTS.TASK_CAMPAIGN_CONTACT_UPDATED, (task: ITask) => {
|
|
621
|
+
* console.log('Campaign contact updated:', task.data.interactionId);
|
|
622
|
+
* // Handle updated campaign contact (e.g., display next contact)
|
|
623
|
+
* });
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
TASK_CAMPAIGN_CONTACT_UPDATED = "task:campaignContactUpdated"
|
|
507
627
|
}
|
|
508
628
|
/**
|
|
509
629
|
* Represents a customer interaction within the contact center system
|
|
510
630
|
* Contains comprehensive details about an ongoing customer interaction
|
|
511
631
|
* @public
|
|
512
632
|
*/
|
|
633
|
+
export interface CallAssociatedDatum {
|
|
634
|
+
/** Whether the field can be edited by the agent */
|
|
635
|
+
agentEditable: boolean;
|
|
636
|
+
/** Whether the field is visible to the agent */
|
|
637
|
+
agentViewable: boolean;
|
|
638
|
+
/** Display name for the field */
|
|
639
|
+
displayName: string;
|
|
640
|
+
/** Whether the field is global */
|
|
641
|
+
global: boolean;
|
|
642
|
+
/** Whether the field is secure */
|
|
643
|
+
isSecure: boolean;
|
|
644
|
+
/** Internal field name */
|
|
645
|
+
name: string;
|
|
646
|
+
/** Whether the field is reportable */
|
|
647
|
+
reportable: boolean;
|
|
648
|
+
/** Secure key identifier */
|
|
649
|
+
secureKeyId: string;
|
|
650
|
+
/** Secure key version */
|
|
651
|
+
secureKeyVersion: number;
|
|
652
|
+
/** Data type of the field */
|
|
653
|
+
type: string;
|
|
654
|
+
/** Field value */
|
|
655
|
+
value: string;
|
|
656
|
+
}
|
|
657
|
+
export type CallAssociatedData = Record<string, CallAssociatedDatum>;
|
|
658
|
+
export type CallAssociatedDetails = Record<string, string>;
|
|
659
|
+
export interface FlowParameter {
|
|
660
|
+
/** Parameter name */
|
|
661
|
+
name?: string;
|
|
662
|
+
/** Additional qualifier */
|
|
663
|
+
qualifier?: string;
|
|
664
|
+
/** Description of the parameter */
|
|
665
|
+
description?: string;
|
|
666
|
+
/** Data type of the value */
|
|
667
|
+
valueDataType?: string;
|
|
668
|
+
/** Value associated with the parameter */
|
|
669
|
+
value?: string;
|
|
670
|
+
}
|
|
671
|
+
export interface InteractionParticipant {
|
|
672
|
+
/** Unique participant identifier */
|
|
673
|
+
id: string;
|
|
674
|
+
/** Participant type label used by backend */
|
|
675
|
+
pType: string;
|
|
676
|
+
/** Friendly participant type */
|
|
677
|
+
type: string;
|
|
678
|
+
/** Whether the participant has joined */
|
|
679
|
+
hasJoined: boolean;
|
|
680
|
+
/** Whether the participant has left */
|
|
681
|
+
hasLeft: boolean;
|
|
682
|
+
/** Whether the participant is still in pre-dial */
|
|
683
|
+
isInPredial: boolean;
|
|
684
|
+
/** Optional caller identifier */
|
|
685
|
+
callerId?: string | null;
|
|
686
|
+
/** Whether auto-answer is enabled */
|
|
687
|
+
autoAnswerEnabled?: boolean;
|
|
688
|
+
/** Backchannel/bnr details */
|
|
689
|
+
bnrDetails?: unknown;
|
|
690
|
+
/** Channel identifier for the participant */
|
|
691
|
+
channelId?: string;
|
|
692
|
+
/** Current consult state */
|
|
693
|
+
consultState?: string | null;
|
|
694
|
+
/** Timestamp when consult started */
|
|
695
|
+
consultTimestamp?: number | null;
|
|
696
|
+
/** Current participant state */
|
|
697
|
+
currentState?: string | null;
|
|
698
|
+
/** Timestamp of the current state */
|
|
699
|
+
currentStateTimestamp?: number | null;
|
|
700
|
+
/** Device call identifier */
|
|
701
|
+
deviceCallId?: string | null;
|
|
702
|
+
/** Device identifier */
|
|
703
|
+
deviceId?: string | null;
|
|
704
|
+
/** Device type (AGENT_DN, BROWSER, etc.) */
|
|
705
|
+
deviceType?: string | null;
|
|
706
|
+
/** Dial number associated with participant */
|
|
707
|
+
dn?: string | null;
|
|
708
|
+
/** Whether participant is currently consulted */
|
|
709
|
+
isConsulted?: boolean;
|
|
710
|
+
/** Whether participant offer is active */
|
|
711
|
+
isOffered?: boolean;
|
|
712
|
+
/** Whether participant is in wrap-up */
|
|
713
|
+
isWrapUp?: boolean;
|
|
714
|
+
/** Whether participant completed wrap-up */
|
|
715
|
+
isWrappedUp?: boolean;
|
|
716
|
+
/** Timestamp of when participant joined */
|
|
717
|
+
joinTimestamp?: number | null;
|
|
718
|
+
/** Last updated timestamp */
|
|
719
|
+
lastUpdated?: number | null;
|
|
720
|
+
/** Friendly name of participant */
|
|
721
|
+
name?: string | null;
|
|
722
|
+
/** Queue identifier associated with participant */
|
|
723
|
+
queueId?: string;
|
|
724
|
+
/** Queue manager identifier */
|
|
725
|
+
queueMgrId?: string;
|
|
726
|
+
/** Session identifier */
|
|
727
|
+
sessionId?: string;
|
|
728
|
+
/** Site identifier */
|
|
729
|
+
siteId?: string;
|
|
730
|
+
/** Skill identifier */
|
|
731
|
+
skillId?: string | null;
|
|
732
|
+
/** Skill name */
|
|
733
|
+
skillName?: string | null;
|
|
734
|
+
/** Skill list for participant */
|
|
735
|
+
skills?: string[];
|
|
736
|
+
/** Team identifier */
|
|
737
|
+
teamId?: string;
|
|
738
|
+
/** Team name */
|
|
739
|
+
teamName?: string;
|
|
740
|
+
/** Timestamp for wrap-up */
|
|
741
|
+
wrapUpTimestamp?: number | null;
|
|
742
|
+
/** Additional metadata */
|
|
743
|
+
[key: string]: unknown;
|
|
744
|
+
}
|
|
745
|
+
export type InteractionParticipants = Record<string, InteractionParticipant>;
|
|
746
|
+
/**
|
|
747
|
+
* Media entry type from interaction.media
|
|
748
|
+
* Used for media state tracking in consult and conference scenarios
|
|
749
|
+
*/
|
|
750
|
+
export type MediaEntry = {
|
|
751
|
+
/** Unique identifier for the media resource */
|
|
752
|
+
mediaResourceId: string;
|
|
753
|
+
/** Type of media channel */
|
|
754
|
+
mediaType: MEDIA_CHANNEL;
|
|
755
|
+
/** Media manager handling this media */
|
|
756
|
+
mediaMgr: string;
|
|
757
|
+
/** List of participant identifiers */
|
|
758
|
+
participants: string[];
|
|
759
|
+
/** Type of media (e.g., 'mainCall', 'consult') */
|
|
760
|
+
mType: string;
|
|
761
|
+
/** Indicates if media is on hold */
|
|
762
|
+
isHold: boolean;
|
|
763
|
+
/** Timestamp when media was put on hold */
|
|
764
|
+
holdTimestamp: number | null;
|
|
765
|
+
};
|
|
513
766
|
export type Interaction = {
|
|
514
767
|
/** Indicates if the interaction is managed by Flow Control */
|
|
515
768
|
isFcManaged: boolean;
|
|
@@ -524,7 +777,11 @@ export type Interaction = {
|
|
|
524
777
|
/** Current virtual team handling the interaction */
|
|
525
778
|
currentVTeam: string;
|
|
526
779
|
/** List of participants in the interaction */
|
|
527
|
-
participants:
|
|
780
|
+
participants: InteractionParticipants;
|
|
781
|
+
/** Detailed call associated data */
|
|
782
|
+
callAssociatedData?: CallAssociatedData;
|
|
783
|
+
/** Simplified call associated key/value pairs */
|
|
784
|
+
callAssociatedDetails?: CallAssociatedDetails;
|
|
528
785
|
/** Unique identifier for the interaction */
|
|
529
786
|
interactionId: string;
|
|
530
787
|
/** Organization identifier */
|
|
@@ -533,7 +790,18 @@ export type Interaction = {
|
|
|
533
790
|
createdTimestamp?: number;
|
|
534
791
|
/** Indicates if wrap-up assistance is enabled */
|
|
535
792
|
isWrapUpAssist?: boolean;
|
|
536
|
-
/**
|
|
793
|
+
/** Identifier of parent interaction if applicable */
|
|
794
|
+
parentInteractionId?: string;
|
|
795
|
+
/** Indicates if media is forked for this interaction */
|
|
796
|
+
isMediaForked?: boolean;
|
|
797
|
+
/** Retroactive flow properties returned by backend */
|
|
798
|
+
flowProperties?: Record<string, unknown> | null;
|
|
799
|
+
/** Media specific properties returned by backend */
|
|
800
|
+
mediaProperties?: Record<string, unknown> | null;
|
|
801
|
+
/**
|
|
802
|
+
* Detailed call processing information and metadata.
|
|
803
|
+
* Mirrors the callProcessingDetails section described in Webex Contact Center Agent Contact payloads.
|
|
804
|
+
*/
|
|
537
805
|
callProcessingDetails: {
|
|
538
806
|
/** Name of the Queue Manager handling this interaction */
|
|
539
807
|
QMgrName: string;
|
|
@@ -551,20 +819,24 @@ export type Interaction = {
|
|
|
551
819
|
QueueId: string;
|
|
552
820
|
/** Virtual team identifier */
|
|
553
821
|
vteamId: string;
|
|
554
|
-
/**
|
|
555
|
-
pauseResumeEnabled?:
|
|
822
|
+
/** Agent capability for pause/resume on this interaction */
|
|
823
|
+
pauseResumeEnabled?: boolean;
|
|
556
824
|
/** Duration of pause in seconds */
|
|
557
825
|
pauseDuration?: string;
|
|
558
|
-
/**
|
|
559
|
-
isPaused?:
|
|
560
|
-
/**
|
|
561
|
-
recordInProgress?:
|
|
562
|
-
/**
|
|
563
|
-
recordingStarted?:
|
|
826
|
+
/** Legacy pause indicator (recordInProgress=false is the active pause signal) */
|
|
827
|
+
isPaused?: boolean;
|
|
828
|
+
/** Recording is actively capturing audio right now */
|
|
829
|
+
recordInProgress?: boolean;
|
|
830
|
+
/** Recording was started for this interaction (may be paused) */
|
|
831
|
+
recordingStarted?: boolean;
|
|
832
|
+
/** Customer geographic region */
|
|
833
|
+
customerRegion?: string;
|
|
834
|
+
/** Flow tag identifier */
|
|
835
|
+
flowTagId?: string;
|
|
564
836
|
/** Indicates if Consult to Queue is in progress */
|
|
565
|
-
ctqInProgress?:
|
|
837
|
+
ctqInProgress?: boolean;
|
|
566
838
|
/** Indicates if outdial transfer to queue is enabled */
|
|
567
|
-
outdialTransferToQueueEnabled?:
|
|
839
|
+
outdialTransferToQueueEnabled?: boolean;
|
|
568
840
|
/** IVR conversation transcript */
|
|
569
841
|
convIvrTranscript?: string;
|
|
570
842
|
/** Customer's name */
|
|
@@ -651,59 +923,67 @@ export type Interaction = {
|
|
|
651
923
|
fcDesktopView?: string;
|
|
652
924
|
/** Agent ID who initiated the outdial call */
|
|
653
925
|
outdialAgentId?: string;
|
|
926
|
+
/** Indicates if the customer has left the call during an active consult */
|
|
927
|
+
hasCustomerLeft?: string;
|
|
928
|
+
/** Indicates if the skip action is disabled for campaign preview contacts */
|
|
929
|
+
campaignPreviewSkipDisabled?: string;
|
|
930
|
+
/** Indicates if the remove action is disabled for campaign preview contacts */
|
|
931
|
+
campaignPreviewRemoveDisabled?: string;
|
|
932
|
+
/** Auto-action to perform when campaign preview offer times out (ACCEPT, SKIP, REMOVE) */
|
|
933
|
+
campaignPreviewAutoAction?: string;
|
|
934
|
+
/** Timestamp (ms) when the campaign preview offer expires */
|
|
935
|
+
campaignPreviewOfferTimeout?: string;
|
|
654
936
|
};
|
|
655
937
|
/** Main interaction identifier for related interactions */
|
|
656
938
|
mainInteractionId?: string;
|
|
939
|
+
/** Timestamp when interaction entered queue */
|
|
940
|
+
queuedTimestamp?: number | null;
|
|
657
941
|
/** Media-specific information for the interaction */
|
|
658
|
-
media: Record<string,
|
|
659
|
-
/** Unique identifier for the media resource */
|
|
660
|
-
mediaResourceId: string;
|
|
661
|
-
/** Type of media channel */
|
|
662
|
-
mediaType: MEDIA_CHANNEL;
|
|
663
|
-
/** Media manager handling this media */
|
|
664
|
-
mediaMgr: string;
|
|
665
|
-
/** List of participant identifiers */
|
|
666
|
-
participants: string[];
|
|
667
|
-
/** Type of media */
|
|
668
|
-
mType: string;
|
|
669
|
-
/** Indicates if media is on hold */
|
|
670
|
-
isHold: boolean;
|
|
671
|
-
/** Timestamp when media was put on hold */
|
|
672
|
-
holdTimestamp: number | null;
|
|
673
|
-
}>;
|
|
942
|
+
media: Record<string, MediaEntry>;
|
|
674
943
|
/** Owner of the interaction */
|
|
675
944
|
owner: string;
|
|
676
945
|
/** Primary media channel for the interaction */
|
|
677
|
-
mediaChannel:
|
|
946
|
+
mediaChannel: string;
|
|
678
947
|
/** Direction information for the contact */
|
|
679
948
|
contactDirection: {
|
|
680
949
|
type: string;
|
|
681
950
|
};
|
|
682
951
|
/** Type of outbound interaction */
|
|
683
952
|
outboundType?: string;
|
|
953
|
+
/** Optional workflow manager identifier */
|
|
954
|
+
workflowManager?: string | null;
|
|
684
955
|
/** Parameters passed through the call flow */
|
|
685
|
-
callFlowParams
|
|
686
|
-
/** Name of the parameter */
|
|
687
|
-
name: string;
|
|
688
|
-
/** Qualifier for the parameter */
|
|
689
|
-
qualifier: string;
|
|
690
|
-
/** Description of the parameter */
|
|
691
|
-
description: string;
|
|
692
|
-
/** Data type of the parameter value */
|
|
693
|
-
valueDataType: string;
|
|
694
|
-
/** Value of the parameter */
|
|
695
|
-
value: string;
|
|
696
|
-
}>;
|
|
956
|
+
callFlowParams?: Record<string, FlowParameter>;
|
|
697
957
|
};
|
|
698
958
|
/**
|
|
699
|
-
* Task payload
|
|
700
|
-
*
|
|
959
|
+
* Task payload mirroring the Agent Contact event payload from Webex Contact Center
|
|
960
|
+
* (developer.webex.com). Arrives on AGENT_* websocket events and is the source of truth
|
|
961
|
+
* for UI/state machine updates.
|
|
701
962
|
* @public
|
|
702
963
|
*/
|
|
964
|
+
export type RealtimeTranscription = {
|
|
965
|
+
agentId: string;
|
|
966
|
+
orgId: string;
|
|
967
|
+
notifType: string;
|
|
968
|
+
notifDetails: {
|
|
969
|
+
actionEvent: string;
|
|
970
|
+
};
|
|
971
|
+
data: {
|
|
972
|
+
role: 'AGENT' | 'CALLER';
|
|
973
|
+
utteranceId: string;
|
|
974
|
+
conversationId: string;
|
|
975
|
+
publishTimestamp: number;
|
|
976
|
+
messageId: string;
|
|
977
|
+
isFinal: boolean;
|
|
978
|
+
languageCode: string;
|
|
979
|
+
orgId: string;
|
|
980
|
+
content: string;
|
|
981
|
+
};
|
|
982
|
+
};
|
|
703
983
|
export type TaskData = {
|
|
704
|
-
/**
|
|
984
|
+
/** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
|
|
705
985
|
mediaResourceId: string;
|
|
706
|
-
/**
|
|
986
|
+
/** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
|
|
707
987
|
eventType: string;
|
|
708
988
|
/** Timestamp when the event occurred */
|
|
709
989
|
eventTime?: number;
|
|
@@ -713,7 +993,7 @@ export type TaskData = {
|
|
|
713
993
|
destAgentId: string;
|
|
714
994
|
/** Unique tracking identifier for the task */
|
|
715
995
|
trackingId: string;
|
|
716
|
-
/** Media resource identifier for consultation
|
|
996
|
+
/** Media resource identifier for consultation leg when present */
|
|
717
997
|
consultMediaResourceId: string;
|
|
718
998
|
/** Detailed interaction information */
|
|
719
999
|
interaction: Interaction;
|
|
@@ -725,7 +1005,7 @@ export type TaskData = {
|
|
|
725
1005
|
toOwner?: boolean;
|
|
726
1006
|
/** Identifier for child interaction in consult/transfer scenarios */
|
|
727
1007
|
childInteractionId?: string;
|
|
728
|
-
/**
|
|
1008
|
+
/** Interaction/contact identifier from backend (same as interaction.interactionId) */
|
|
729
1009
|
interactionId: string;
|
|
730
1010
|
/** Organization identifier */
|
|
731
1011
|
orgId: string;
|
|
@@ -735,7 +1015,7 @@ export type TaskData = {
|
|
|
735
1015
|
queueMgr: string;
|
|
736
1016
|
/** Name of the queue where task is queued */
|
|
737
1017
|
queueName?: string;
|
|
738
|
-
/**
|
|
1018
|
+
/** Task/interaction type returned by the platform (routing/monitoring/etc.) */
|
|
739
1019
|
type: string;
|
|
740
1020
|
/** Timeout value for RONA (Redirection on No Answer) in seconds */
|
|
741
1021
|
ronaTimeout?: number;
|
|
@@ -771,11 +1051,93 @@ export type TaskData = {
|
|
|
771
1051
|
reservedAgentChannelId?: string;
|
|
772
1052
|
/** Indicates if wrap-up is required for this task */
|
|
773
1053
|
wrapUpRequired?: boolean;
|
|
1054
|
+
/**
|
|
1055
|
+
* Current consultation status derived from state machine
|
|
1056
|
+
* Values: CONSULT_INITIATED, CONSULT_ACCEPTED, BEING_CONSULTED,
|
|
1057
|
+
* BEING_CONSULTED_ACCEPTED, CONNECTED, CONFERENCE, CONSULT_COMPLETED
|
|
1058
|
+
*/
|
|
1059
|
+
consultStatus?: string;
|
|
1060
|
+
/**
|
|
1061
|
+
* Indicates if consultation is in progress (state machine: CONSULTING)
|
|
1062
|
+
*/
|
|
1063
|
+
isConsultInProgress?: boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* Indicates if the task is incoming for the active agent
|
|
1066
|
+
*/
|
|
1067
|
+
isIncomingTask?: boolean;
|
|
1068
|
+
/**
|
|
1069
|
+
* Indicates if the task is on hold (state machine: HELD)
|
|
1070
|
+
*/
|
|
1071
|
+
isOnHold?: boolean;
|
|
1072
|
+
/**
|
|
1073
|
+
* Indicates if customer is currently in the call
|
|
1074
|
+
* Derived from participants in main media
|
|
1075
|
+
*/
|
|
1076
|
+
isCustomerInCall?: boolean;
|
|
1077
|
+
/**
|
|
1078
|
+
* Count of conference participants (agents only)
|
|
1079
|
+
* Used for determining if max participants reached
|
|
1080
|
+
*/
|
|
1081
|
+
conferenceParticipantsCount?: number;
|
|
1082
|
+
/**
|
|
1083
|
+
* Indicates if this is a secondary agent (consulted party)
|
|
1084
|
+
*/
|
|
1085
|
+
isSecondaryAgent?: boolean;
|
|
1086
|
+
/**
|
|
1087
|
+
* Indicates if this is a secondary EP-DN agent (telephony consult to external)
|
|
1088
|
+
*/
|
|
1089
|
+
isSecondaryEpDnAgent?: boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* Task state for MPC (Multi-Party Conference) scenarios
|
|
1092
|
+
* Maps participant consultState to task state
|
|
1093
|
+
*/
|
|
1094
|
+
mpcState?: string;
|
|
774
1095
|
/** Indicates if auto-answer is in progress for this task */
|
|
775
1096
|
isAutoAnswering?: boolean;
|
|
776
1097
|
/** Indicates if wrap-up is required for this task */
|
|
777
1098
|
agentsPendingWrapUp?: string[];
|
|
778
1099
|
};
|
|
1100
|
+
export type TaskUIControlState = {
|
|
1101
|
+
isVisible: boolean;
|
|
1102
|
+
isEnabled: boolean;
|
|
1103
|
+
};
|
|
1104
|
+
/**
|
|
1105
|
+
* UI control representation for a single interaction leg.
|
|
1106
|
+
*/
|
|
1107
|
+
export type InteractionUIControls = {
|
|
1108
|
+
accept: TaskUIControlState;
|
|
1109
|
+
decline: TaskUIControlState;
|
|
1110
|
+
hold: TaskUIControlState;
|
|
1111
|
+
transfer: TaskUIControlState;
|
|
1112
|
+
consult: TaskUIControlState;
|
|
1113
|
+
end: TaskUIControlState;
|
|
1114
|
+
recording: TaskUIControlState;
|
|
1115
|
+
mute: TaskUIControlState;
|
|
1116
|
+
consultTransfer: TaskUIControlState;
|
|
1117
|
+
endConsult: TaskUIControlState;
|
|
1118
|
+
conference: TaskUIControlState;
|
|
1119
|
+
exitConference: TaskUIControlState;
|
|
1120
|
+
transferConference: TaskUIControlState;
|
|
1121
|
+
mergeToConference: TaskUIControlState;
|
|
1122
|
+
wrapup: TaskUIControlState;
|
|
1123
|
+
switch: TaskUIControlState;
|
|
1124
|
+
};
|
|
1125
|
+
export type TaskUILeg = 'main' | 'consult';
|
|
1126
|
+
/**
|
|
1127
|
+
* UI controls surfaced to task consumers.
|
|
1128
|
+
* Consumers should read controls from the per-leg surfaces and use `activeLeg`
|
|
1129
|
+
* to determine which one is currently interactive.
|
|
1130
|
+
*/
|
|
1131
|
+
export type TaskUIControls = {
|
|
1132
|
+
main: InteractionUIControls;
|
|
1133
|
+
consult: InteractionUIControls;
|
|
1134
|
+
activeLeg: TaskUILeg;
|
|
1135
|
+
};
|
|
1136
|
+
/**
|
|
1137
|
+
* Helper class for managing task action control state
|
|
1138
|
+
* Tracks visibility and enabled state for task actions that can be executed
|
|
1139
|
+
* @public
|
|
1140
|
+
*/
|
|
779
1141
|
/**
|
|
780
1142
|
* Type representing an agent contact message within the contact center system
|
|
781
1143
|
* Contains comprehensive interaction and task related details for agent operations
|
|
@@ -986,6 +1348,14 @@ export type TransferPayload = {
|
|
|
986
1348
|
/** Type of the transfer destination */
|
|
987
1349
|
destinationType: DestinationType;
|
|
988
1350
|
};
|
|
1351
|
+
/**
|
|
1352
|
+
* Options for configuring transfer behavior
|
|
1353
|
+
* @public
|
|
1354
|
+
*/
|
|
1355
|
+
export type TransferOptions = {
|
|
1356
|
+
/** Additional transfer configuration options */
|
|
1357
|
+
[key: string]: unknown;
|
|
1358
|
+
};
|
|
989
1359
|
/**
|
|
990
1360
|
* API payload for ending a consultation
|
|
991
1361
|
* This is the actual payload that is sent to the developer API
|
|
@@ -1101,6 +1471,19 @@ export type ContactCleanupData = {
|
|
|
1101
1471
|
type: string;
|
|
1102
1472
|
};
|
|
1103
1473
|
};
|
|
1474
|
+
/**
|
|
1475
|
+
* Boolean-like fields in callProcessingDetails that may arrive as strings.
|
|
1476
|
+
* Used by taskDataNormalizer to coerce payloads to actual booleans.
|
|
1477
|
+
*/
|
|
1478
|
+
export type CallProcessingBooleanKey = 'recordingStarted' | 'recordInProgress' | 'isPaused' | 'pauseResumeEnabled' | 'ctqInProgress' | 'outdialTransferToQueueEnabled' | 'taskToBeSelfServiced' | 'CONTINUE_RECORDING_ON_TRANSFER' | 'isParked' | 'participantInviteTimeout' | 'checkAgentAvailability';
|
|
1479
|
+
/**
|
|
1480
|
+
* Interaction-level boolean fields that may arrive as strings from backend payloads.
|
|
1481
|
+
*/
|
|
1482
|
+
export type InteractionBooleanKey = 'isFcManaged' | 'isMediaForked' | 'isTerminated';
|
|
1483
|
+
/**
|
|
1484
|
+
* Participant boolean fields that may arrive as strings and need normalization.
|
|
1485
|
+
*/
|
|
1486
|
+
export type ParticipantBooleanKey = 'autoAnswerEnabled' | 'hasJoined' | 'hasLeft' | 'isConsulted' | 'isInPredial' | 'isOffered' | 'isWrapUp' | 'isWrappedUp';
|
|
1104
1487
|
/**
|
|
1105
1488
|
* Response type for task public methods
|
|
1106
1489
|
* Can be an {@link AgentContact} object containing updated task state,
|
|
@@ -1108,11 +1491,32 @@ export type ContactCleanupData = {
|
|
|
1108
1491
|
* @public
|
|
1109
1492
|
*/
|
|
1110
1493
|
export type TaskResponse = AgentContact | Error | void;
|
|
1494
|
+
/**
|
|
1495
|
+
* Payload shape used by consult conference helper utilities.
|
|
1496
|
+
*/
|
|
1497
|
+
export type consultConferencePayloadData = {
|
|
1498
|
+
agentId?: string;
|
|
1499
|
+
destinationType?: string;
|
|
1500
|
+
destAgentId?: string;
|
|
1501
|
+
};
|
|
1502
|
+
/**
|
|
1503
|
+
* Minimal event-emitter contract exposed to SDK consumers.
|
|
1504
|
+
* Defined here so that consumers do NOT need `@types/node` in their tsconfig.
|
|
1505
|
+
* The runtime Task class still extends Node's EventEmitter (via ampersand-events),
|
|
1506
|
+
* which satisfies this interface at runtime.
|
|
1507
|
+
* @public
|
|
1508
|
+
*/
|
|
1509
|
+
export interface IEventEmitter {
|
|
1510
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
1511
|
+
off(event: string, listener: (...args: any[]) => void): this;
|
|
1512
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
1513
|
+
emit(event: string, ...args: any[]): boolean;
|
|
1514
|
+
}
|
|
1111
1515
|
/**
|
|
1112
1516
|
* Interface for managing task-related operations in the contact center
|
|
1113
|
-
* Extends
|
|
1517
|
+
* Extends IEventEmitter to support event-driven task updates
|
|
1114
1518
|
*/
|
|
1115
|
-
export interface ITask extends
|
|
1519
|
+
export interface ITask extends IEventEmitter {
|
|
1116
1520
|
/**
|
|
1117
1521
|
* Event data received in the Contact Center events.
|
|
1118
1522
|
* Contains detailed task information including interaction details, media resources,
|
|
@@ -1129,6 +1533,13 @@ export interface ITask extends EventEmitter {
|
|
|
1129
1533
|
* as defined in {@link AutoWrapup}
|
|
1130
1534
|
*/
|
|
1131
1535
|
autoWrapup?: AutoWrapup;
|
|
1536
|
+
/**
|
|
1537
|
+
* Latest UI controls derived from the state machine.
|
|
1538
|
+
* Each control has `isVisible` and `isEnabled` flags computed from current task state.
|
|
1539
|
+
* Subscribe to {@link TASK_EVENTS.TASK_UI_CONTROLS_UPDATED} for change notifications.
|
|
1540
|
+
*/
|
|
1541
|
+
readonly uiControls: TaskUIControls;
|
|
1542
|
+
state?: any;
|
|
1132
1543
|
/**
|
|
1133
1544
|
* Cancels the auto-wrapup timer for the task.
|
|
1134
1545
|
* This method stops the auto-wrapup process if it is currently active.
|
|
@@ -1148,7 +1559,7 @@ export interface ITask extends EventEmitter {
|
|
|
1148
1559
|
* @returns Updated task instance
|
|
1149
1560
|
* @ignore
|
|
1150
1561
|
*/
|
|
1151
|
-
updateTaskData(newData: TaskData):
|
|
1562
|
+
updateTaskData(newData: TaskData): void;
|
|
1152
1563
|
/**
|
|
1153
1564
|
* Answers or accepts an incoming task.
|
|
1154
1565
|
* Once accepted, the task will be assigned to the agent and trigger a {@link TASK_EVENTS.TASK_ASSIGNED} event.
|
|
@@ -1269,17 +1680,7 @@ export interface ITask extends EventEmitter {
|
|
|
1269
1680
|
* await task.transfer({ to: "queueId", destinationType: "queue" });
|
|
1270
1681
|
* ```
|
|
1271
1682
|
*/
|
|
1272
|
-
transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
|
|
1273
|
-
/**
|
|
1274
|
-
* Transfers the task after consultation.
|
|
1275
|
-
* @param consultTransferPayload - Details for consult transfer (optional)
|
|
1276
|
-
* @returns Promise<TaskResponse>
|
|
1277
|
-
* @example
|
|
1278
|
-
* ```typescript
|
|
1279
|
-
* await task.consultTransfer({ to: "agentId", destinationType: "agent" });
|
|
1280
|
-
* ```
|
|
1281
|
-
*/
|
|
1282
|
-
consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
|
|
1683
|
+
transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
|
|
1283
1684
|
/**
|
|
1284
1685
|
* Initiates a consult conference (merge consult call with main call).
|
|
1285
1686
|
* @returns Promise<TaskResponse>
|
|
@@ -1307,6 +1708,18 @@ export interface ITask extends EventEmitter {
|
|
|
1307
1708
|
* ```
|
|
1308
1709
|
*/
|
|
1309
1710
|
transferConference(): Promise<TaskResponse>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Toggles between consult call and main call during consulting.
|
|
1713
|
+
* If on consult leg, switches to main call (holds consult).
|
|
1714
|
+
* If on main call, switches to consult (resumes consult).
|
|
1715
|
+
* Only available when in CONSULTING state.
|
|
1716
|
+
* @returns Promise<TaskResponse>
|
|
1717
|
+
* @example
|
|
1718
|
+
* ```typescript
|
|
1719
|
+
* await task.switchCall();
|
|
1720
|
+
* ```
|
|
1721
|
+
*/
|
|
1722
|
+
switchCall(): Promise<TaskResponse>;
|
|
1310
1723
|
/**
|
|
1311
1724
|
* Toggles mute/unmute for the local audio stream during a WebRTC task.
|
|
1312
1725
|
* @returns Promise<void>
|
|
@@ -1317,3 +1730,127 @@ export interface ITask extends EventEmitter {
|
|
|
1317
1730
|
*/
|
|
1318
1731
|
toggleMute(): Promise<void>;
|
|
1319
1732
|
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Interface for managing digital channel task operations in the contact center
|
|
1735
|
+
* Digital channels (chat, email, social, SMS) have a simpler interface than voice
|
|
1736
|
+
* Extends ITask but overrides updateTaskData to return IDigital
|
|
1737
|
+
* @public
|
|
1738
|
+
*/
|
|
1739
|
+
export interface IDigital extends Omit<ITask, 'updateTaskData'> {
|
|
1740
|
+
/**
|
|
1741
|
+
* Updates the task data
|
|
1742
|
+
* @param newData - Updated task data
|
|
1743
|
+
* @param shouldOverwrite - Whether to completely replace existing data
|
|
1744
|
+
* @returns Updated Digital task instance
|
|
1745
|
+
*/
|
|
1746
|
+
updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Interface for managing voice/telephony task operations in the contact center
|
|
1750
|
+
* Extends ITask with voice-specific functionality for hold/resume operations
|
|
1751
|
+
* @public
|
|
1752
|
+
*/
|
|
1753
|
+
export interface IVoice extends ITask {
|
|
1754
|
+
/**
|
|
1755
|
+
* Toggles hold/resume state for a voice task.
|
|
1756
|
+
* If the task is currently on hold, it will be resumed.
|
|
1757
|
+
* If the task is active, it will be placed on hold.
|
|
1758
|
+
* @returns Promise<TaskResponse>
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```typescript
|
|
1761
|
+
* await voiceTask.holdResume();
|
|
1762
|
+
* ```
|
|
1763
|
+
*/
|
|
1764
|
+
holdResume(): Promise<TaskResponse>;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Configuration options for voice task UI controls
|
|
1768
|
+
*/
|
|
1769
|
+
export type VoiceUIControlOptions = {
|
|
1770
|
+
isEndTaskEnabled?: boolean;
|
|
1771
|
+
isEndConsultEnabled?: boolean;
|
|
1772
|
+
voiceVariant?: VoiceVariant;
|
|
1773
|
+
isRecordingEnabled?: boolean;
|
|
1774
|
+
};
|
|
1775
|
+
/**
|
|
1776
|
+
* Participant information for UI display
|
|
1777
|
+
*/
|
|
1778
|
+
export type Participant = {
|
|
1779
|
+
id: string;
|
|
1780
|
+
name?: string;
|
|
1781
|
+
pType?: string;
|
|
1782
|
+
};
|
|
1783
|
+
/**
|
|
1784
|
+
* @deprecated Use Participant instead
|
|
1785
|
+
*/
|
|
1786
|
+
export type TaskAccessorParticipant = Participant;
|
|
1787
|
+
export interface IWebRTC extends IVoice {
|
|
1788
|
+
/**
|
|
1789
|
+
* This method is used to mute/unmute the call.
|
|
1790
|
+
* @returns Promise<void>
|
|
1791
|
+
* @example
|
|
1792
|
+
* ```typescript
|
|
1793
|
+
* task.toggleMute();
|
|
1794
|
+
* ```
|
|
1795
|
+
*/
|
|
1796
|
+
toggleMute(): Promise<void>;
|
|
1797
|
+
/**
|
|
1798
|
+
* Decline the incoming task for Browser Login
|
|
1799
|
+
*
|
|
1800
|
+
* @example
|
|
1801
|
+
* ```
|
|
1802
|
+
* task.decline();
|
|
1803
|
+
* ```
|
|
1804
|
+
*/
|
|
1805
|
+
decline(): Promise<TaskResponse>;
|
|
1806
|
+
/**
|
|
1807
|
+
* This method is used to unregister the web call listeners.
|
|
1808
|
+
* @returns void
|
|
1809
|
+
* @example
|
|
1810
|
+
* ```typescript
|
|
1811
|
+
* task.unregisterWebCallListeners();
|
|
1812
|
+
* ```
|
|
1813
|
+
*/
|
|
1814
|
+
unregisterWebCallListeners(): void;
|
|
1815
|
+
}
|
|
1816
|
+
export type WebSocketPayload = TaskData & {
|
|
1817
|
+
type: string;
|
|
1818
|
+
mediaResourceId?: string;
|
|
1819
|
+
reason?: string;
|
|
1820
|
+
/**
|
|
1821
|
+
* Optional real-time transcript chunk payload.
|
|
1822
|
+
* Present on REAL_TIME_TRANSCRIPTION notifications.
|
|
1823
|
+
*/
|
|
1824
|
+
data?: RealtimeTranscription['data'];
|
|
1825
|
+
};
|
|
1826
|
+
export type WebSocketMessage = {
|
|
1827
|
+
keepalive?: 'true' | 'false' | boolean;
|
|
1828
|
+
type?: string;
|
|
1829
|
+
data: WebSocketPayload;
|
|
1830
|
+
};
|
|
1831
|
+
/**
|
|
1832
|
+
* Actions to be performed after handling an event
|
|
1833
|
+
*
|
|
1834
|
+
* These actions represent TaskManager-level concerns (task collection lifecycle,
|
|
1835
|
+
* resource cleanup) rather than task-level state machine concerns. The separation
|
|
1836
|
+
* ensures proper responsibility:
|
|
1837
|
+
* - TaskManager: Collection management, metrics, cleanup
|
|
1838
|
+
* - State Machine: Task state transitions, event emissions, UI controls
|
|
1839
|
+
*/
|
|
1840
|
+
export interface TaskEventActions {
|
|
1841
|
+
task?: ITask;
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Context for processing an event
|
|
1845
|
+
*
|
|
1846
|
+
* Contains all information needed to process a WebSocket event:
|
|
1847
|
+
* - Event type and payload from the backend
|
|
1848
|
+
* - Task instance (if exists)
|
|
1849
|
+
* - Pre-mapped state machine event (if applicable)
|
|
1850
|
+
*/
|
|
1851
|
+
export interface EventContext {
|
|
1852
|
+
eventType: string;
|
|
1853
|
+
payload: WebSocketPayload;
|
|
1854
|
+
task?: ITask;
|
|
1855
|
+
stateMachineEvent?: TaskEventPayload | null;
|
|
1856
|
+
}
|