@webex/contact-center 3.12.0-next.8 → 3.12.0-next.80

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.
Files changed (205) hide show
  1. package/AGENTS.md +438 -0
  2. package/ai-docs/README.md +131 -0
  3. package/ai-docs/RULES.md +455 -0
  4. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  5. package/ai-docs/patterns/testing-patterns.md +480 -0
  6. package/ai-docs/patterns/typescript-patterns.md +365 -0
  7. package/ai-docs/templates/README.md +102 -0
  8. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  9. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  10. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  11. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  12. package/ai-docs/templates/new-method/00-master.md +80 -0
  13. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  14. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  15. package/ai-docs/templates/new-method/03-tests.md +201 -0
  16. package/ai-docs/templates/new-method/04-validation.md +141 -0
  17. package/ai-docs/templates/new-service/00-master.md +109 -0
  18. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  19. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  20. package/ai-docs/templates/new-service/03-integration.md +178 -0
  21. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  22. package/ai-docs/templates/new-service/05-validation.md +145 -0
  23. package/dist/cc.js +265 -29
  24. package/dist/cc.js.map +1 -1
  25. package/dist/config.js +6 -0
  26. package/dist/config.js.map +1 -1
  27. package/dist/constants.js +16 -1
  28. package/dist/constants.js.map +1 -1
  29. package/dist/index.js +20 -5
  30. package/dist/index.js.map +1 -1
  31. package/dist/metrics/behavioral-events.js +101 -0
  32. package/dist/metrics/behavioral-events.js.map +1 -1
  33. package/dist/metrics/constants.js +23 -4
  34. package/dist/metrics/constants.js.map +1 -1
  35. package/dist/services/ApiAiAssistant.js +74 -3
  36. package/dist/services/ApiAiAssistant.js.map +1 -1
  37. package/dist/services/UserPreference.js +427 -0
  38. package/dist/services/UserPreference.js.map +1 -0
  39. package/dist/services/config/Util.js +3 -3
  40. package/dist/services/config/Util.js.map +1 -1
  41. package/dist/services/config/constants.js +23 -2
  42. package/dist/services/config/constants.js.map +1 -1
  43. package/dist/services/config/types.js +49 -9
  44. package/dist/services/config/types.js.map +1 -1
  45. package/dist/services/core/Err.js.map +1 -1
  46. package/dist/services/core/Utils.js +107 -32
  47. package/dist/services/core/Utils.js.map +1 -1
  48. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  49. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  50. package/dist/services/core/websocket/types.js.map +1 -1
  51. package/dist/services/index.js +1 -1
  52. package/dist/services/index.js.map +1 -1
  53. package/dist/services/task/Task.js +688 -0
  54. package/dist/services/task/Task.js.map +1 -0
  55. package/dist/services/task/TaskFactory.js +45 -0
  56. package/dist/services/task/TaskFactory.js.map +1 -0
  57. package/dist/services/task/TaskManager.js +725 -526
  58. package/dist/services/task/TaskManager.js.map +1 -1
  59. package/dist/services/task/TaskUtils.js +162 -26
  60. package/dist/services/task/TaskUtils.js.map +1 -1
  61. package/dist/services/task/constants.js +9 -2
  62. package/dist/services/task/constants.js.map +1 -1
  63. package/dist/services/task/dialer.js +78 -0
  64. package/dist/services/task/dialer.js.map +1 -1
  65. package/dist/services/task/digital/Digital.js +77 -0
  66. package/dist/services/task/digital/Digital.js.map +1 -0
  67. package/dist/services/task/state-machine/TaskStateMachine.js +837 -0
  68. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  69. package/dist/services/task/state-machine/actions.js +543 -0
  70. package/dist/services/task/state-machine/actions.js.map +1 -0
  71. package/dist/services/task/state-machine/constants.js +161 -0
  72. package/dist/services/task/state-machine/constants.js.map +1 -0
  73. package/dist/services/task/state-machine/guards.js +340 -0
  74. package/dist/services/task/state-machine/guards.js.map +1 -0
  75. package/dist/services/task/state-machine/index.js +53 -0
  76. package/dist/services/task/state-machine/index.js.map +1 -0
  77. package/dist/services/task/state-machine/types.js +54 -0
  78. package/dist/services/task/state-machine/types.js.map +1 -0
  79. package/dist/services/task/state-machine/uiControlsComputer.js +553 -0
  80. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  81. package/dist/services/task/taskDataNormalizer.js +99 -0
  82. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  83. package/dist/services/task/types.js +212 -4
  84. package/dist/services/task/types.js.map +1 -1
  85. package/dist/services/task/voice/Voice.js +1042 -0
  86. package/dist/services/task/voice/Voice.js.map +1 -0
  87. package/dist/services/task/voice/WebRTC.js +149 -0
  88. package/dist/services/task/voice/WebRTC.js.map +1 -0
  89. package/dist/types/cc.d.ts +94 -1
  90. package/dist/types/config.d.ts +6 -0
  91. package/dist/types/constants.d.ts +16 -1
  92. package/dist/types/index.d.ts +21 -6
  93. package/dist/types/metrics/constants.d.ts +19 -1
  94. package/dist/types/services/ApiAiAssistant.d.ts +11 -3
  95. package/dist/types/services/UserPreference.d.ts +118 -0
  96. package/dist/types/services/config/constants.d.ts +21 -0
  97. package/dist/types/services/config/types.d.ts +171 -10
  98. package/dist/types/services/core/Err.d.ts +4 -0
  99. package/dist/types/services/core/Utils.d.ts +33 -13
  100. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  101. package/dist/types/services/core/websocket/types.d.ts +1 -1
  102. package/dist/types/services/index.d.ts +1 -1
  103. package/dist/types/services/task/Task.d.ts +157 -0
  104. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  105. package/dist/types/services/task/TaskUtils.d.ts +46 -2
  106. package/dist/types/services/task/constants.d.ts +7 -0
  107. package/dist/types/services/task/dialer.d.ts +30 -0
  108. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  109. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -0
  110. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  111. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  112. package/dist/types/services/task/state-machine/guards.d.ts +90 -0
  113. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  114. package/dist/types/services/task/state-machine/types.d.ts +267 -0
  115. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  116. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  117. package/dist/types/services/task/types.d.ts +603 -66
  118. package/dist/types/services/task/voice/Voice.d.ts +184 -0
  119. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  120. package/dist/types/types.d.ts +94 -0
  121. package/dist/types/webex.d.ts +1 -0
  122. package/dist/types.js +85 -0
  123. package/dist/types.js.map +1 -1
  124. package/dist/webex.js +14 -2
  125. package/dist/webex.js.map +1 -1
  126. package/package.json +15 -12
  127. package/src/cc.ts +329 -30
  128. package/src/config.ts +6 -0
  129. package/src/constants.ts +16 -1
  130. package/src/index.ts +23 -5
  131. package/src/metrics/ai-docs/AGENTS.md +348 -0
  132. package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
  133. package/src/metrics/behavioral-events.ts +106 -0
  134. package/src/metrics/constants.ts +23 -4
  135. package/src/services/ApiAiAssistant.ts +104 -3
  136. package/src/services/UserPreference.ts +509 -0
  137. package/src/services/agent/ai-docs/AGENTS.md +238 -0
  138. package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
  139. package/src/services/ai-docs/AGENTS.md +384 -0
  140. package/src/services/config/Util.ts +3 -3
  141. package/src/services/config/ai-docs/AGENTS.md +253 -0
  142. package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
  143. package/src/services/config/constants.ts +25 -1
  144. package/src/services/config/types.ts +174 -11
  145. package/src/services/core/Err.ts +2 -0
  146. package/src/services/core/Utils.ts +123 -37
  147. package/src/services/core/ai-docs/AGENTS.md +379 -0
  148. package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
  149. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  150. package/src/services/core/websocket/types.ts +1 -1
  151. package/src/services/index.ts +1 -1
  152. package/src/services/task/Task.ts +837 -0
  153. package/src/services/task/TaskFactory.ts +55 -0
  154. package/src/services/task/TaskManager.ts +738 -613
  155. package/src/services/task/TaskUtils.ts +205 -25
  156. package/src/services/task/ai-docs/AGENTS.md +455 -0
  157. package/src/services/task/ai-docs/ARCHITECTURE.md +585 -0
  158. package/src/services/task/constants.ts +7 -0
  159. package/src/services/task/dialer.ts +80 -0
  160. package/src/services/task/digital/Digital.ts +95 -0
  161. package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
  162. package/src/services/task/state-machine/actions.ts +685 -0
  163. package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
  164. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
  165. package/src/services/task/state-machine/constants.ts +172 -0
  166. package/src/services/task/state-machine/guards.ts +406 -0
  167. package/src/services/task/state-machine/index.ts +28 -0
  168. package/src/services/task/state-machine/types.ts +241 -0
  169. package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
  170. package/src/services/task/taskDataNormalizer.ts +137 -0
  171. package/src/services/task/types.ts +710 -71
  172. package/src/services/task/voice/Voice.ts +1267 -0
  173. package/src/services/task/voice/WebRTC.ts +187 -0
  174. package/src/types.ts +122 -2
  175. package/src/utils/AGENTS.md +276 -0
  176. package/src/webex.js +2 -0
  177. package/test/unit/spec/cc.ts +343 -23
  178. package/test/unit/spec/logger-proxy.ts +70 -0
  179. package/test/unit/spec/services/ApiAiAssistant.ts +122 -17
  180. package/test/unit/spec/services/UserPreference.ts +401 -0
  181. package/test/unit/spec/services/WebCallingService.ts +7 -1
  182. package/test/unit/spec/services/config/index.ts +30 -30
  183. package/test/unit/spec/services/core/Utils.ts +425 -8
  184. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  185. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  186. package/test/unit/spec/services/task/Task.ts +477 -0
  187. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  188. package/test/unit/spec/services/task/TaskManager.ts +832 -1702
  189. package/test/unit/spec/services/task/TaskUtils.ts +206 -0
  190. package/test/unit/spec/services/task/dialer.ts +190 -0
  191. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  192. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
  193. package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
  194. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  195. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
  196. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  197. package/test/unit/spec/services/task/voice/Voice.ts +631 -0
  198. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  199. package/umd/contact-center.min.js +2 -2
  200. package/umd/contact-center.min.js.map +1 -1
  201. package/dist/services/task/index.js +0 -1525
  202. package/dist/services/task/index.js.map +0 -1
  203. package/dist/types/services/task/index.d.ts +0 -650
  204. package/src/services/task/index.ts +0 -1801
  205. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -0,0 +1,157 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import type { ActorRefFrom, SnapshotFrom } from 'xstate';
4
+ import { ITask, TaskData, TaskResponse, WrapupPayLoad, TaskId, TransferPayLoad, TASK_EVENTS, TaskUIControls, ConsultEndPayload, ConsultPayload, ConsultTransferPayLoad, ResumeRecordingPayload, CallId } from './types';
5
+ import routingContact from './contact';
6
+ import MetricsManager from '../../metrics/MetricsManager';
7
+ import { TaskState } from './state-machine';
8
+ import type { TaskEventPayload, TaskStateMachine, UIControlConfig, TaskActionsMap, TaskActionArgs } from './state-machine';
9
+ import AutoWrapup from './AutoWrapup';
10
+ import { WrapupData } from '../config/types';
11
+ type UIControlConfigInput = Omit<UIControlConfig, 'channelType'> & {
12
+ channelType?: UIControlConfig['channelType'];
13
+ };
14
+ export default abstract class Task extends EventEmitter implements ITask {
15
+ protected contact: ReturnType<typeof routingContact>;
16
+ protected metricsManager: MetricsManager;
17
+ stateMachineService?: ActorRefFrom<TaskStateMachine>;
18
+ data: TaskData;
19
+ webCallMap: Record<TaskId, CallId>;
20
+ state?: SnapshotFrom<TaskStateMachine>;
21
+ private lastState?;
22
+ protected currentUiControls: TaskUIControls;
23
+ protected uiControlConfig: UIControlConfig;
24
+ protected wrapupData?: WrapupData;
25
+ autoWrapup?: AutoWrapup;
26
+ protected agentId?: string;
27
+ constructor(contact: ReturnType<typeof routingContact>, data: TaskData, uiControlConfig: UIControlConfigInput, wrapupData?: WrapupData, agentId?: string);
28
+ private static resolveChannelType;
29
+ abstract accept(): Promise<TaskResponse>;
30
+ decline(): Promise<TaskResponse>;
31
+ pauseRecording(): Promise<TaskResponse>;
32
+ resumeRecording(resumeRecordingPayload: ResumeRecordingPayload): Promise<TaskResponse>;
33
+ consult(consultPayload: ConsultPayload): Promise<TaskResponse>;
34
+ endConsult(consultEndPayload: ConsultEndPayload): Promise<TaskResponse>;
35
+ consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
36
+ consultConference(): Promise<TaskResponse>;
37
+ exitConference(): Promise<TaskResponse>;
38
+ transferConference(): Promise<TaskResponse>;
39
+ switchCall(): Promise<TaskResponse>;
40
+ toggleMute(): Promise<void>;
41
+ unregisterWebCallListeners(): void;
42
+ /**
43
+ * Cancel any in-progress auto wrap-up timer.
44
+ * Base implementation just clears the timer reference so subclasses inherit the behavior.
45
+ */
46
+ cancelAutoWrapupTimer(): void;
47
+ hold(): Promise<TaskResponse>;
48
+ resume(): Promise<TaskResponse>;
49
+ holdResume(): Promise<TaskResponse>;
50
+ /**
51
+ * Latest UI controls derived from state machine state and context.
52
+ */
53
+ get uiControls(): TaskUIControls;
54
+ protected updateUiControls(forceEmit?: boolean): void;
55
+ /**
56
+ * Initialize the state machine
57
+ */
58
+ private initializeStateMachine;
59
+ /**
60
+ * Send an event to the state machine
61
+ */
62
+ sendStateMachineEvent(event: TaskEventPayload): void;
63
+ /**
64
+ * Get the current state machine state
65
+ */
66
+ protected getCurrentState(): TaskState | undefined;
67
+ /**
68
+ * Compute UI controls based on current state machine state.
69
+ *
70
+ * @returns UI control states for all task actions
71
+ */
72
+ protected computeUIControls(): TaskUIControls;
73
+ /**
74
+ * Stop the state machine service
75
+ */
76
+ protected stopStateMachine(): void;
77
+ private static extractTaskDataFromEvent;
78
+ private autoAnswerIfNeeded;
79
+ private updateTaskFromEvent;
80
+ protected getStateMachineActionOverrides(): Partial<TaskActionsMap>;
81
+ protected getChannelSpecificActionOverrides(): Partial<TaskActionsMap>;
82
+ protected createEmitSelfAction(taskEvent: TASK_EVENTS, { updateTaskData }?: {
83
+ updateTaskData?: boolean;
84
+ }): ({ event }: TaskActionArgs) => void;
85
+ private getCommonActionOverrides;
86
+ /**
87
+ * Sets up the automatic wrap-up timer if wrap-up is required
88
+ */
89
+ protected setupAutoWrapupTimer(): void;
90
+ /**
91
+ * Cancels the automatic wrap-up timer if it's running
92
+ */
93
+ private reconcileData;
94
+ /**
95
+ *
96
+ * @param methodName - The name of the method that is unsupported
97
+ * @throws Error
98
+ */
99
+ protected unsupportedMethodError(methodName: string): void;
100
+ /**
101
+ * This method is used to update the task data.
102
+ * @param updatedData - TaskData
103
+ * @param shouldOverwrite - boolean
104
+ * @example
105
+ * ```typescript
106
+ * task.updateTaskData(updatedData, true);
107
+ * ```
108
+ */
109
+ updateTaskData(updatedData: TaskData, shouldOverwrite?: boolean): ITask;
110
+ /**
111
+ * The backend sends `interaction.media` and `interaction.participants` as complete snapshots
112
+ * of the current call state. `reconcileData` deep-merges and never removes keys, so entries the
113
+ * backend dropped (e.g. a consult leg's media and consultee participant after the consult ends)
114
+ * linger in `this.data`. That stale data drives incorrect UI controls (e.g. the consult button
115
+ * staying disabled after the consult leg is gone, until a page refresh re-hydrates cleanly).
116
+ * Make only these two snapshot maps authoritative to the incoming payload, leaving every other
117
+ * field on the generic deep-merge path (CAD and other partial updates still merge as before).
118
+ */
119
+ private pruneStaleInteractionMaps;
120
+ /**
121
+ * This is used to blind transfer or vTeam transfer the task
122
+ * @param transferPayload
123
+ * @returns Promise<TaskResponse>
124
+ * @throws Error
125
+ * @example
126
+ * ```typescript
127
+ * const transferPayload = {
128
+ * to: 'myQueueId',
129
+ * destinationType: 'queue',
130
+ * }
131
+ * task.transfer(transferPayload).then(()=>{}).catch(()=>{});
132
+ * ```
133
+ */
134
+ transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
135
+ /**
136
+ * This is used to end the task.
137
+ * @returns Promise<TaskResponse>
138
+ * @throws Error
139
+ * @example
140
+ * ```typescript
141
+ * task.end().then(()=>{}).catch(()=>{})
142
+ * ```
143
+ */
144
+ end(): Promise<TaskResponse>;
145
+ /**
146
+ * This is used to wrap up the task.
147
+ * @param wrapupPayload - WrapupPayLoad
148
+ * @returns Promise<TaskResponse>
149
+ * @throws Error
150
+ * @example
151
+ * ```typescript
152
+ * task.wrapup(wrapupPayload).then(()=>{}).catch(()=>{})
153
+ * ```
154
+ */
155
+ wrapup(wrapupPayload: WrapupPayLoad): Promise<TaskResponse>;
156
+ }
157
+ export {};
@@ -0,0 +1,12 @@
1
+ import routingContact from './contact';
2
+ import WebCallingService from '../WebCallingService';
3
+ import Task from './Task';
4
+ import { TaskData } from './types';
5
+ import { ConfigFlags } from '../../types';
6
+ import { WrapupData } from '../config/types';
7
+ export default class TaskFactory {
8
+ /**
9
+ * Creates the correct Task subclass based on mediaType & loginOption
10
+ */
11
+ static createTask(contact: ReturnType<typeof routingContact>, webCallingService: WebCallingService, data: TaskData, configFlags: ConfigFlags, wrapupData?: WrapupData, agentId?: string): Task;
12
+ }
@@ -1,4 +1,30 @@
1
1
  import { Interaction, ITask, TaskData } from './types';
2
+ import { TaskContext } from './state-machine/types';
3
+ /**
4
+ * Checks if the customer is still in the call (not left)
5
+ *
6
+ * @param interaction - The interaction object
7
+ * @param interactionId - The main interaction ID
8
+ * @returns true if customer is in the call
9
+ */
10
+ export declare const getIsCustomerInCall: (interaction: Interaction, interactionId: string) => boolean;
11
+ /**
12
+ * Gets the count of active agent participants in the conference
13
+ * Excludes Customer, Supervisor, and VVA participant types
14
+ *
15
+ * @param interaction - The interaction object
16
+ * @param interactionId - The main interaction ID
17
+ * @returns Number of active agent participants
18
+ */
19
+ export declare const getConferenceParticipantsCount: (interaction: Interaction, interactionId: string) => number;
20
+ /**
21
+ * Determines if a consult is actively in-progress for conference control gating.
22
+ * This is used to disable conference controls (End/Consult) only when a consult leg
23
+ * still exists outside the main call participants.
24
+ */
25
+ export declare const getIsConsultInProgressForConferenceControls: (interaction: Interaction | undefined, mainCallId: string | undefined, selfAgentId: string | undefined) => boolean;
26
+ export declare const getIsConsultedAgentForControls: (taskData: TaskData | null, context: TaskContext, isConsultingState: boolean) => boolean;
27
+ export declare const getServerHoldStateForControls: (context: TaskContext, mainCallId?: string, fallbackTaskData?: TaskData | null) => boolean | undefined;
2
28
  /**
3
29
  * Determines if the given agent is the primary agent (owner) of the task
4
30
  * @param task - The task to check
@@ -22,8 +48,11 @@ export declare const isParticipantInMainInteraction: (task: ITask, agentId: stri
22
48
  export declare const checkParticipantNotInInteraction: (task: ITask, agentId: string) => boolean;
23
49
  /**
24
50
  * Determines if a conference is currently in progress based on the number of active agent participants
25
- * @param TaskData - The payLoad data to check for conference status
51
+ * @param data - The task data to check for conference status
26
52
  * @returns true if there are 2 or more active agent participants in the main call, false otherwise
53
+ *
54
+ * For Agent B (consulted agent), their task's interactionId may be different from the main call.
55
+ * We use mainInteractionId from the interaction if available, otherwise fallback to interactionId.
27
56
  */
28
57
  export declare const getIsConferenceInProgress: (data: TaskData) => boolean;
29
58
  /**
@@ -36,10 +65,15 @@ export declare const isSecondaryAgent: (interaction: Interaction) => boolean;
36
65
  /**
37
66
  * Checks if the current agent is a secondary EP-DN (Entry Point Dial Number) agent.
38
67
  * This is specifically for telephony consultations to external numbers/entry points.
39
- * @param task - The task object containing interaction details
68
+ * @param interaction - The interaction object
40
69
  * @returns true if this is a secondary EP-DN agent in telephony consultation, false otherwise
41
70
  */
42
71
  export declare const isSecondaryEpDnAgent: (interaction: Interaction) => boolean;
72
+ /**
73
+ * Checks if the task belongs to a campaign preview interaction.
74
+ * Campaign preview ContactEnded events are terminal cleanup events and should not trigger wrapup.
75
+ */
76
+ export declare const isCampaignPreviewTask: (taskData?: TaskData | null) => boolean;
43
77
  /**
44
78
  * Checks if auto-answer is enabled for the agent participant
45
79
  * @param interaction - The interaction object
@@ -82,6 +116,16 @@ export declare const hasAgentInitiatedOutdial: (interaction: Interaction, agentI
82
116
  * @returns true if task should be auto-answered, false otherwise
83
117
  */
84
118
  export declare const shouldAutoAnswerTask: (taskData: TaskData, agentId: string, loginOption: string, webRtcEnabled: boolean) => boolean;
119
+ /**
120
+ * Gets the consult media resource ID for switch-call operations.
121
+ * Searches for the consult media leg in the interaction.
122
+ *
123
+ * @param interaction - The interaction object
124
+ * @param consultMediaResourceId - The consult media resource ID from task data
125
+ * @param agentId - Current agent ID
126
+ * @returns The consult media resource ID or undefined
127
+ */
128
+ export declare const getConsultMediaResourceId: (interaction: Interaction | undefined, consultMediaResourceId: string | undefined, agentId: string | undefined) => string | undefined;
85
129
  /**
86
130
  * Checks if a task is a campaign preview reservation that has not yet been accepted.
87
131
  * Campaign preview tasks should not trigger incoming call handling until the agent
@@ -21,6 +21,8 @@ export declare const CONFERENCE_EXIT = "/conference/exit";
21
21
  export declare const CONFERENCE_TRANSFER = "/conference/transfer";
22
22
  export declare const DIALER_API = "/v1/dialer";
23
23
  export declare const CAMPAIGN_PREVIEW_ACCEPT = "/accept";
24
+ export declare const CAMPAIGN_PREVIEW_SKIP = "/skip";
25
+ export declare const CAMPAIGN_PREVIEW_REMOVE = "/remove";
24
26
  /** 80-second timeout for accepting preview contact (outbound call setup takes longer than default 20s) */
25
27
  export declare const TIMEOUT_PREVIEW_ACCEPT = 80000;
26
28
  export declare const TASK_MANAGER_FILE = "taskManager";
@@ -44,6 +46,10 @@ export declare const PRESERVED_TASK_DATA_FIELDS: {
44
46
  * Used by reconcileData method to preserve important task state fields
45
47
  */
46
48
  export declare const KEYS_TO_NOT_DELETE: string[];
49
+ /**
50
+ * Consultation status constants derived from state machine
51
+ * These values are computed and available in task.data.consultStatus
52
+ */
47
53
  export declare const METHODS: {
48
54
  ACCEPT: string;
49
55
  TOGGLE_MUTE: string;
@@ -73,6 +79,7 @@ export declare const METHODS: {
73
79
  GET_TASK_MANAGER: string;
74
80
  SETUP_AUTO_WRAPUP_TIMER: string;
75
81
  CANCEL_AUTO_WRAPUP_TIMER: string;
82
+ REQUEST_REAL_TIME_TRANSCRIPTS: string;
76
83
  };
77
84
  export declare const TRANSCRIPT_EVENT_MAP: {
78
85
  AgentContactAssigned: string;
@@ -40,4 +40,34 @@ export default function aqmDialer(aqm: AqmReqs): {
40
40
  acceptPreviewContact: import("../core/types").Res<Contact.AgentContact, {
41
41
  data: Contact.PreviewContactPayload;
42
42
  }>;
43
+ /**
44
+ * Skips a campaign preview contact, requesting the next contact from the campaign.
45
+ *
46
+ * @param {Object} p - Parameters object.
47
+ * @param {Contact.PreviewContactPayload} p.data - Payload containing interactionId and campaignId.
48
+ * @returns {Promise<Contact.AgentContact>} A promise that resolves with agent contact on success.
49
+ *
50
+ * Emits:
51
+ * - `CC_EVENTS.CAMPAIGN_CONTACT_UPDATED` or `CC_EVENTS.CONTACT_ENDED` on success
52
+ * - `CC_EVENTS.CAMPAIGN_PREVIEW_SKIP_FAILED` on failure
53
+ * @ignore
54
+ */
55
+ skipPreviewContact: import("../core/types").Res<Contact.AgentContact, {
56
+ data: Contact.PreviewContactPayload;
57
+ }>;
58
+ /**
59
+ * Removes a campaign preview contact from the campaign list entirely.
60
+ *
61
+ * @param {Object} p - Parameters object.
62
+ * @param {Contact.PreviewContactPayload} p.data - Payload containing interactionId and campaignId.
63
+ * @returns {Promise<Contact.AgentContact>} A promise that resolves with agent contact on success.
64
+ *
65
+ * Emits:
66
+ * - `CC_EVENTS.CAMPAIGN_CONTACT_UPDATED` or `CC_EVENTS.CONTACT_ENDED` on success
67
+ * - `CC_EVENTS.CAMPAIGN_PREVIEW_REMOVE_FAILED` on failure
68
+ * @ignore
69
+ */
70
+ removePreviewContact: import("../core/types").Res<Contact.AgentContact, {
71
+ data: Contact.PreviewContactPayload;
72
+ }>;
43
73
  };
@@ -0,0 +1,22 @@
1
+ import { IDigital, TaskResponse, TaskData } from '../types';
2
+ import { WrapupData } from '../../config/types';
3
+ import Task from '../Task';
4
+ import routingContact from '../contact';
5
+ export default class Digital extends Task implements IDigital {
6
+ constructor(contact: ReturnType<typeof routingContact>, data: TaskData, wrapupData?: WrapupData, agentId?: string);
7
+ /**
8
+ * Refresh the digital task with the latest backend payload and recompute UI controls.
9
+ */
10
+ updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
11
+ /**
12
+ * This is used for incoming digital task accept by agent.
13
+ *
14
+ * @returns Promise<TaskResponse>
15
+ * @throws Error
16
+ * @example
17
+ * ```typescript
18
+ * task.accept().then(()=>{}).catch(()=>{})
19
+ * ```
20
+ */
21
+ accept(): Promise<TaskResponse>;
22
+ }