@webex/contact-center 3.11.0 → 3.12.0-llmrefactor.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.
Files changed (267) hide show
  1. package/.sdd/manifest.json +882 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +46 -0
  5. package/ai-docs/GETTING_STARTED.md +168 -0
  6. package/ai-docs/GLOSSARY.md +43 -0
  7. package/ai-docs/README.md +138 -0
  8. package/ai-docs/REVIEW_CHECKLIST.md +41 -0
  9. package/ai-docs/RULES.md +444 -0
  10. package/ai-docs/SECURITY.md +52 -0
  11. package/ai-docs/SERVICE_STATE.md +48 -0
  12. package/ai-docs/SPEC_INDEX.md +65 -0
  13. package/ai-docs/adr/0001-spec-source-policy.md +55 -0
  14. package/ai-docs/adr/README.md +8 -0
  15. package/ai-docs/adr/_adr-template.md +31 -0
  16. package/ai-docs/contact-center-spec.md +341 -0
  17. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  18. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  19. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  20. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  21. package/ai-docs/patterns/testing-patterns.md +480 -0
  22. package/ai-docs/patterns/typescript-patterns.md +365 -0
  23. package/ai-docs/templates/README.md +102 -0
  24. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  25. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  26. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  27. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  28. package/ai-docs/templates/new-method/00-master.md +80 -0
  29. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  30. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  31. package/ai-docs/templates/new-method/03-tests.md +201 -0
  32. package/ai-docs/templates/new-method/04-validation.md +141 -0
  33. package/ai-docs/templates/new-service/00-master.md +109 -0
  34. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  35. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  36. package/ai-docs/templates/new-service/03-integration.md +178 -0
  37. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  38. package/ai-docs/templates/new-service/05-validation.md +145 -0
  39. package/dist/cc.js +379 -50
  40. package/dist/cc.js.map +1 -1
  41. package/dist/config.js +6 -0
  42. package/dist/config.js.map +1 -1
  43. package/dist/constants.js +22 -2
  44. package/dist/constants.js.map +1 -1
  45. package/dist/index.js +27 -5
  46. package/dist/index.js.map +1 -1
  47. package/dist/metrics/behavioral-events.js +114 -0
  48. package/dist/metrics/behavioral-events.js.map +1 -1
  49. package/dist/metrics/constants.js +32 -3
  50. package/dist/metrics/constants.js.map +1 -1
  51. package/dist/services/ApiAiAssistant.js +318 -0
  52. package/dist/services/ApiAiAssistant.js.map +1 -0
  53. package/dist/services/UserPreference.js +427 -0
  54. package/dist/services/UserPreference.js.map +1 -0
  55. package/dist/services/agent/types.js.map +1 -1
  56. package/dist/services/config/Util.js +8 -4
  57. package/dist/services/config/Util.js.map +1 -1
  58. package/dist/services/config/constants.js +35 -2
  59. package/dist/services/config/constants.js.map +1 -1
  60. package/dist/services/config/index.js +41 -2
  61. package/dist/services/config/index.js.map +1 -1
  62. package/dist/services/config/types.js +66 -8
  63. package/dist/services/config/types.js.map +1 -1
  64. package/dist/services/constants.js +27 -1
  65. package/dist/services/constants.js.map +1 -1
  66. package/dist/services/core/Err.js.map +1 -1
  67. package/dist/services/core/Utils.js +122 -25
  68. package/dist/services/core/Utils.js.map +1 -1
  69. package/dist/services/core/aqm-reqs.js +92 -17
  70. package/dist/services/core/aqm-reqs.js.map +1 -1
  71. package/dist/services/core/websocket/WebSocketManager.js +22 -6
  72. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  73. package/dist/services/core/websocket/connection-service.js +3 -1
  74. package/dist/services/core/websocket/connection-service.js.map +1 -1
  75. package/dist/services/core/websocket/types.js.map +1 -1
  76. package/dist/services/index.js +6 -0
  77. package/dist/services/index.js.map +1 -1
  78. package/dist/services/task/Task.js +688 -0
  79. package/dist/services/task/Task.js.map +1 -0
  80. package/dist/services/task/TaskFactory.js +45 -0
  81. package/dist/services/task/TaskFactory.js.map +1 -0
  82. package/dist/services/task/TaskManager.js +751 -457
  83. package/dist/services/task/TaskManager.js.map +1 -1
  84. package/dist/services/task/TaskUtils.js +220 -23
  85. package/dist/services/task/TaskUtils.js.map +1 -1
  86. package/dist/services/task/constants.js +23 -2
  87. package/dist/services/task/constants.js.map +1 -1
  88. package/dist/services/task/dialer.js +129 -0
  89. package/dist/services/task/dialer.js.map +1 -1
  90. package/dist/services/task/digital/Digital.js +77 -0
  91. package/dist/services/task/digital/Digital.js.map +1 -0
  92. package/dist/services/task/state-machine/TaskStateMachine.js +873 -0
  93. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  94. package/dist/services/task/state-machine/actions.js +567 -0
  95. package/dist/services/task/state-machine/actions.js.map +1 -0
  96. package/dist/services/task/state-machine/constants.js +161 -0
  97. package/dist/services/task/state-machine/constants.js.map +1 -0
  98. package/dist/services/task/state-machine/guards.js +382 -0
  99. package/dist/services/task/state-machine/guards.js.map +1 -0
  100. package/dist/services/task/state-machine/index.js +53 -0
  101. package/dist/services/task/state-machine/index.js.map +1 -0
  102. package/dist/services/task/state-machine/types.js +54 -0
  103. package/dist/services/task/state-machine/types.js.map +1 -0
  104. package/dist/services/task/state-machine/uiControlsComputer.js +603 -0
  105. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  106. package/dist/services/task/taskDataNormalizer.js +99 -0
  107. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  108. package/dist/services/task/types.js +227 -4
  109. package/dist/services/task/types.js.map +1 -1
  110. package/dist/services/task/voice/Voice.js +1044 -0
  111. package/dist/services/task/voice/Voice.js.map +1 -0
  112. package/dist/services/task/voice/WebRTC.js +149 -0
  113. package/dist/services/task/voice/WebRTC.js.map +1 -0
  114. package/dist/types/cc.d.ts +894 -0
  115. package/dist/types/config.d.ts +72 -0
  116. package/dist/types/constants.d.ts +66 -0
  117. package/dist/types/index.d.ts +199 -0
  118. package/dist/types/logger-proxy.d.ts +71 -0
  119. package/dist/types/metrics/MetricsManager.d.ts +223 -0
  120. package/dist/types/metrics/behavioral-events.d.ts +29 -0
  121. package/dist/types/metrics/constants.d.ts +181 -0
  122. package/dist/types/services/AddressBook.d.ts +74 -0
  123. package/dist/types/services/ApiAiAssistant.d.ts +49 -0
  124. package/dist/types/services/EntryPoint.d.ts +67 -0
  125. package/dist/types/services/Queue.d.ts +76 -0
  126. package/dist/types/services/UserPreference.d.ts +118 -0
  127. package/dist/types/services/WebCallingService.d.ts +1 -0
  128. package/dist/types/services/agent/index.d.ts +46 -0
  129. package/dist/types/services/agent/types.d.ts +413 -0
  130. package/dist/types/services/config/Util.d.ts +20 -0
  131. package/dist/types/services/config/constants.d.ts +270 -0
  132. package/dist/types/services/config/index.d.ts +177 -0
  133. package/dist/types/services/config/types.d.ts +1368 -0
  134. package/dist/types/services/constants.d.ts +110 -0
  135. package/dist/types/services/core/Err.d.ts +125 -0
  136. package/dist/types/services/core/GlobalTypes.d.ts +58 -0
  137. package/dist/types/services/core/Utils.d.ts +121 -0
  138. package/dist/types/services/core/WebexRequest.d.ts +22 -0
  139. package/dist/types/services/core/aqm-reqs.d.ts +65 -0
  140. package/dist/types/services/core/constants.d.ts +99 -0
  141. package/dist/types/services/core/types.d.ts +47 -0
  142. package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
  143. package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
  144. package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
  145. package/dist/types/services/core/websocket/types.d.ts +37 -0
  146. package/dist/types/services/index.d.ts +54 -0
  147. package/dist/types/services/task/AutoWrapup.d.ts +40 -0
  148. package/dist/types/services/task/Task.d.ts +157 -0
  149. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  150. package/dist/types/services/task/TaskManager.d.ts +1 -0
  151. package/dist/types/services/task/TaskUtils.d.ts +138 -0
  152. package/dist/types/services/task/constants.d.ts +91 -0
  153. package/dist/types/services/task/contact.d.ts +69 -0
  154. package/dist/types/services/task/dialer.d.ts +73 -0
  155. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  156. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1194 -0
  157. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  158. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  159. package/dist/types/services/task/state-machine/guards.d.ts +102 -0
  160. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  161. package/dist/types/services/task/state-machine/types.d.ts +269 -0
  162. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  163. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  164. package/dist/types/services/task/types.d.ts +1856 -0
  165. package/dist/types/services/task/voice/Voice.d.ts +184 -0
  166. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  167. package/dist/types/types.d.ts +778 -0
  168. package/dist/types/utils/PageCache.d.ts +173 -0
  169. package/dist/types/webex-config.d.ts +53 -0
  170. package/dist/types/webex.d.ts +8 -0
  171. package/dist/types.js +130 -1
  172. package/dist/types.js.map +1 -1
  173. package/dist/webex.js +14 -2
  174. package/dist/webex.js.map +1 -1
  175. package/package.json +16 -12
  176. package/src/cc.ts +477 -51
  177. package/src/config.ts +6 -0
  178. package/src/constants.ts +21 -1
  179. package/src/index.ts +24 -5
  180. package/src/metrics/ai-docs/AGENTS.md +350 -0
  181. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  182. package/src/metrics/ai-docs/metrics-spec.md +854 -0
  183. package/src/metrics/behavioral-events.ts +120 -0
  184. package/src/metrics/constants.ts +37 -3
  185. package/src/services/ApiAiAssistant.ts +412 -0
  186. package/src/services/UserPreference.ts +509 -0
  187. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  188. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  189. package/src/services/agent/ai-docs/agent-spec.md +504 -0
  190. package/src/services/agent/types.ts +1 -1
  191. package/src/services/ai-docs/AGENTS.md +386 -0
  192. package/src/services/ai-docs/services-spec.md +492 -0
  193. package/src/services/config/Util.ts +10 -2
  194. package/src/services/config/ai-docs/AGENTS.md +255 -0
  195. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  196. package/src/services/config/ai-docs/config-spec.md +669 -0
  197. package/src/services/config/constants.ts +37 -1
  198. package/src/services/config/index.ts +45 -1
  199. package/src/services/config/types.ts +241 -11
  200. package/src/services/constants.ts +29 -0
  201. package/src/services/core/Err.ts +3 -0
  202. package/src/services/core/Utils.ts +143 -30
  203. package/src/services/core/ai-docs/AGENTS.md +381 -0
  204. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  205. package/src/services/core/ai-docs/core-spec.md +783 -0
  206. package/src/services/core/aqm-reqs.ts +100 -22
  207. package/src/services/core/websocket/WebSocketManager.ts +23 -6
  208. package/src/services/core/websocket/connection-service.ts +5 -1
  209. package/src/services/core/websocket/types.ts +1 -1
  210. package/src/services/index.ts +4 -0
  211. package/src/services/task/Task.ts +837 -0
  212. package/src/services/task/TaskFactory.ts +55 -0
  213. package/src/services/task/TaskManager.ts +793 -521
  214. package/src/services/task/TaskUtils.ts +314 -24
  215. package/src/services/task/ai-docs/AGENTS.md +457 -0
  216. package/src/services/task/ai-docs/ARCHITECTURE.md +594 -0
  217. package/src/services/task/ai-docs/task-spec.md +1319 -0
  218. package/src/services/task/constants.ts +23 -0
  219. package/src/services/task/dialer.ts +136 -1
  220. package/src/services/task/digital/Digital.ts +95 -0
  221. package/src/services/task/state-machine/TaskStateMachine.ts +1166 -0
  222. package/src/services/task/state-machine/actions.ts +738 -0
  223. package/src/services/task/state-machine/ai-docs/AGENTS.md +458 -0
  224. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1137 -0
  225. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2177 -0
  226. package/src/services/task/state-machine/constants.ts +172 -0
  227. package/src/services/task/state-machine/guards.ts +445 -0
  228. package/src/services/task/state-machine/index.ts +28 -0
  229. package/src/services/task/state-machine/types.ts +243 -0
  230. package/src/services/task/state-machine/uiControlsComputer.ts +961 -0
  231. package/src/services/task/taskDataNormalizer.ts +137 -0
  232. package/src/services/task/types.ts +734 -71
  233. package/src/services/task/voice/Voice.ts +1270 -0
  234. package/src/services/task/voice/WebRTC.ts +187 -0
  235. package/src/types.ts +205 -2
  236. package/src/utils/AGENTS.md +278 -0
  237. package/src/utils/ai-docs/utils-spec.md +381 -0
  238. package/src/webex.js +2 -0
  239. package/test/unit/spec/cc.ts +503 -43
  240. package/test/unit/spec/logger-proxy.ts +70 -0
  241. package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
  242. package/test/unit/spec/services/UserPreference.ts +401 -0
  243. package/test/unit/spec/services/WebCallingService.ts +7 -1
  244. package/test/unit/spec/services/config/index.ts +85 -29
  245. package/test/unit/spec/services/core/Utils.ts +481 -2
  246. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
  247. package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
  248. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  249. package/test/unit/spec/services/task/Task.ts +477 -0
  250. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  251. package/test/unit/spec/services/task/TaskManager.ts +1001 -1003
  252. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  253. package/test/unit/spec/services/task/dialer.ts +372 -96
  254. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  255. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +2651 -0
  256. package/test/unit/spec/services/task/state-machine/guards.ts +637 -0
  257. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  258. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2663 -0
  259. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  260. package/test/unit/spec/services/task/voice/Voice.ts +649 -0
  261. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  262. package/umd/contact-center.min.js +2 -2
  263. package/umd/contact-center.min.js.map +1 -1
  264. package/dist/services/task/index.js +0 -1525
  265. package/dist/services/task/index.js.map +0 -1
  266. package/src/services/task/index.ts +0 -1801
  267. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -0,0 +1,1856 @@
1
+ import { TaskEventPayload } from './state-machine';
2
+ import { Msg } from '../core/GlobalTypes';
3
+ import AutoWrapup from './AutoWrapup';
4
+ /**
5
+ * Unique identifier for a task in the contact center system
6
+ * @public
7
+ */
8
+ export type TaskId = string;
9
+ /**
10
+ * Unique identifier for a call in the Webex calling system
11
+ */
12
+ export type CallId = string;
13
+ /**
14
+ * Defines the valid destination types for routing tasks within the contact center
15
+ * Used to specify where a task should be directed
16
+ * @public
17
+ */
18
+ export declare const DESTINATION_TYPE: {
19
+ /** Route task to a specific queue */
20
+ QUEUE: string;
21
+ /** Route task to a specific dial number */
22
+ DIALNUMBER: string;
23
+ /** Route task to a specific agent */
24
+ AGENT: string;
25
+ /** Route task to an entry point (supported only for consult operations) */
26
+ ENTRYPOINT: string;
27
+ };
28
+ /**
29
+ * Type representing valid destination types for task routing
30
+ * Derived from the DESTINATION_TYPE constant
31
+ * @public
32
+ */
33
+ export type DestinationType = Enum<typeof DESTINATION_TYPE>;
34
+ /**
35
+ * Defines the valid destination types for consult transfer operations
36
+ * Used when transferring a task after consultation
37
+ * @public
38
+ */
39
+ export declare const CONSULT_TRANSFER_DESTINATION_TYPE: {
40
+ /** Transfer to a specific agent */
41
+ AGENT: string;
42
+ /** Transfer to an entry point */
43
+ ENTRYPOINT: string;
44
+ /** Transfer to a dial number */
45
+ DIALNUMBER: string;
46
+ /** Transfer to a queue */
47
+ QUEUE: string;
48
+ };
49
+ /**
50
+ * Type representing valid destination types for consult transfers
51
+ * Derived from the CONSULT_TRANSFER_DESTINATION_TYPE constant
52
+ * @public
53
+ */
54
+ export type ConsultTransferDestinationType = Enum<typeof CONSULT_TRANSFER_DESTINATION_TYPE>;
55
+ /**
56
+ * Defines all supported media channel types for customer interactions
57
+ * These represent the different ways customers can communicate with agents
58
+ * @public
59
+ */
60
+ export declare const MEDIA_CHANNEL: {
61
+ /** Email-based communication channel */
62
+ readonly EMAIL: "email";
63
+ /** Web-based chat communication channel */
64
+ readonly CHAT: "chat";
65
+ /** Voice/phone communication channel */
66
+ readonly TELEPHONY: "telephony";
67
+ /** Social media platform communication channel */
68
+ readonly SOCIAL: "social";
69
+ /** SMS text messaging communication channel */
70
+ readonly SMS: "sms";
71
+ /** Facebook Messenger communication channel */
72
+ readonly FACEBOOK: "facebook";
73
+ /** WhatsApp messaging communication channel */
74
+ readonly WHATSAPP: "whatsapp";
75
+ };
76
+ /**
77
+ * Type representing valid media channels
78
+ * Derived from the MEDIA_CHANNEL constant
79
+ * @public
80
+ */
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>;
98
+ /**
99
+ * Enumeration of all task-related events that can occur in the contact center system
100
+ * These events represent different states and actions in the task lifecycle
101
+ * @public
102
+ */
103
+ export declare enum TASK_EVENTS {
104
+ /**
105
+ * Triggered when a new task is received by the system
106
+ * @example
107
+ * ```typescript
108
+ * task.on(TASK_EVENTS.TASK_INCOMING, (task: ITask) => {
109
+ * console.log('New task received:', task.data.interactionId);
110
+ * // Handle incoming task
111
+ * });
112
+ * ```
113
+ */
114
+ TASK_INCOMING = "task:incoming",
115
+ /**
116
+ * Triggered when a task is successfully assigned to an agent
117
+ * @example
118
+ * ```typescript
119
+ * task.on(TASK_EVENTS.TASK_ASSIGNED, (task: ITask) => {
120
+ * console.log('Task assigned:', task.data.interactionId);
121
+ * // Begin handling the assigned task
122
+ * });
123
+ * ```
124
+ */
125
+ TASK_ASSIGNED = "task:assigned",
126
+ /**
127
+ * Triggered when the media state of a task changes
128
+ * @example
129
+ * ```typescript
130
+ * task.on(TASK_EVENTS.TASK_MEDIA, (track: MediaStreamTrack) => {
131
+ * // Handle media track updates
132
+ * });
133
+ * ```
134
+ */
135
+ TASK_MEDIA = "task:media",
136
+ /**
137
+ * Triggered when a task is removed from an agent
138
+ * @example
139
+ * ```typescript
140
+ * task.on(TASK_EVENTS.TASK_UNASSIGNED, (task: ITask) => {
141
+ * console.log('Task unassigned:', task.data.interactionId);
142
+ * // Clean up task resources
143
+ * });
144
+ * ```
145
+ */
146
+ TASK_UNASSIGNED = "task:unassigned",
147
+ /**
148
+ * Triggered when a task is placed on hold
149
+ * @example
150
+ * ```typescript
151
+ * task.on(TASK_EVENTS.TASK_HOLD, (task: ITask) => {
152
+ * console.log('Task placed on hold:', task.data.interactionId);
153
+ * // Update UI to show hold state
154
+ * });
155
+ * ```
156
+ */
157
+ TASK_HOLD = "task:hold",
158
+ /**
159
+ * Triggered when a task is resumed from hold
160
+ * @example
161
+ * ```typescript
162
+ * task.on(TASK_EVENTS.TASK_RESUME, (task: ITask) => {
163
+ * console.log('Task resumed from hold:', task.data.interactionId);
164
+ * // Update UI to show active state
165
+ * });
166
+ * ```
167
+ */
168
+ TASK_RESUME = "task:resume",
169
+ /**
170
+ * Triggered when a consultation session ends
171
+ * @example
172
+ * ```typescript
173
+ * task.on(TASK_EVENTS.TASK_CONSULT_END, (task: ITask) => {
174
+ * console.log('Consultation ended:', task.data.interactionId);
175
+ * // Clean up consultation resources
176
+ * });
177
+ * ```
178
+ */
179
+ TASK_CONSULT_END = "task:consultEnd",
180
+ /**
181
+ * Triggered when a queue consultation is cancelled
182
+ * @example
183
+ * ```typescript
184
+ * task.on(TASK_EVENTS.TASK_CONSULT_QUEUE_CANCELLED, (task: ITask) => {
185
+ * console.log('Queue consultation cancelled:', task.data.interactionId);
186
+ * // Handle consultation cancellation
187
+ * });
188
+ * ```
189
+ */
190
+ TASK_CONSULT_QUEUE_CANCELLED = "task:consultQueueCancelled",
191
+ /**
192
+ * Triggered when a queue consultation fails
193
+ * @example
194
+ * ```typescript
195
+ * task.on(TASK_EVENTS.TASK_CONSULT_QUEUE_FAILED, (task: ITask) => {
196
+ * console.log('Queue consultation failed:', task.data.interactionId);
197
+ * // Handle consultation failure
198
+ * });
199
+ * ```
200
+ */
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",
206
+ /**
207
+ * Triggered when a consultation request is accepted
208
+ * @example
209
+ * ```typescript
210
+ * task.on(TASK_EVENTS.TASK_CONSULT_ACCEPTED, (task: ITask) => {
211
+ * console.log('Consultation accepted:', task.data.interactionId);
212
+ * // Begin consultation
213
+ * });
214
+ * ```
215
+ */
216
+ TASK_CONSULT_ACCEPTED = "task:consultAccepted",
217
+ /**
218
+ * Triggered when consultation is in progress
219
+ * @example
220
+ * ```typescript
221
+ * task.on(TASK_EVENTS.TASK_CONSULTING, (task: ITask) => {
222
+ * console.log('Consulting in progress:', task.data.interactionId);
223
+ * // Handle ongoing consultation
224
+ * });
225
+ * ```
226
+ */
227
+ TASK_CONSULTING = "task:consulting",
228
+ /**
229
+ * Triggered when a new consultation is created
230
+ * @example
231
+ * ```typescript
232
+ * task.on(TASK_EVENTS.TASK_CONSULT_CREATED, (task: ITask) => {
233
+ * console.log('Consultation created:', task.data.interactionId);
234
+ * // Initialize consultation
235
+ * });
236
+ * ```
237
+ */
238
+ TASK_CONSULT_CREATED = "task:consultCreated",
239
+ /**
240
+ * Triggered when a consultation is offered
241
+ * @example
242
+ * ```typescript
243
+ * task.on(TASK_EVENTS.TASK_OFFER_CONSULT, (task: ITask) => {
244
+ * console.log('Consultation offered:', task.data.interactionId);
245
+ * // Handle consultation offer
246
+ * });
247
+ * ```
248
+ */
249
+ TASK_OFFER_CONSULT = "task:offerConsult",
250
+ /**
251
+ * Triggered when a task is completed/terminated
252
+ * @example
253
+ * ```typescript
254
+ * task.on(TASK_EVENTS.TASK_END, (task: ITask) => {
255
+ * console.log('Task ended:', task.data.interactionId);
256
+ * // Clean up and finalize task
257
+ * });
258
+ * ```
259
+ */
260
+ TASK_END = "task:end",
261
+ /**
262
+ * Triggered when a task enters wrap-up state
263
+ * @example
264
+ * ```typescript
265
+ * task.on(TASK_EVENTS.TASK_WRAPUP, (task: ITask) => {
266
+ * console.log('Task in wrap-up:', task.data.interactionId);
267
+ * // Begin wrap-up process
268
+ * });
269
+ * ```
270
+ */
271
+ TASK_WRAPUP = "task:wrapup",
272
+ /**
273
+ * Triggered when task wrap-up is completed
274
+ * @example
275
+ * ```typescript
276
+ * task.on(TASK_EVENTS.TASK_WRAPPEDUP, (task: ITask) => {
277
+ * console.log('Task wrapped up:', task.data.interactionId);
278
+ * // Finalize task completion
279
+ * });
280
+ * ```
281
+ */
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",
293
+ /**
294
+ * Triggered when recording is paused
295
+ * @example
296
+ * ```typescript
297
+ * task.on(TASK_EVENTS.TASK_RECORDING_PAUSED, (task: ITask) => {
298
+ * console.log('Recording paused:', task.data.interactionId);
299
+ * // Update recording state
300
+ * });
301
+ * ```
302
+ */
303
+ TASK_RECORDING_PAUSED = "task:recordingPaused",
304
+ /**
305
+ * Triggered when recording pause attempt fails
306
+ * @example
307
+ * ```typescript
308
+ * task.on(TASK_EVENTS.TASK_RECORDING_PAUSE_FAILED, (task: ITask) => {
309
+ * console.log('Recording pause failed:', task.data.interactionId);
310
+ * // Handle pause failure
311
+ * });
312
+ * ```
313
+ */
314
+ TASK_RECORDING_PAUSE_FAILED = "task:recordingPauseFailed",
315
+ /**
316
+ * Triggered when recording is resumed
317
+ * @example
318
+ * ```typescript
319
+ * task.on(TASK_EVENTS.TASK_RECORDING_RESUMED, (task: ITask) => {
320
+ * console.log('Recording resumed:', task.data.interactionId);
321
+ * // Update recording state
322
+ * });
323
+ * ```
324
+ */
325
+ TASK_RECORDING_RESUMED = "task:recordingResumed",
326
+ /**
327
+ * Triggered when recording resume attempt fails
328
+ * @example
329
+ * ```typescript
330
+ * task.on(TASK_EVENTS.TASK_RECORDING_RESUME_FAILED, (task: ITask) => {
331
+ * console.log('Recording resume failed:', task.data.interactionId);
332
+ * // Handle resume failure
333
+ * });
334
+ * ```
335
+ */
336
+ TASK_RECORDING_RESUME_FAILED = "task:recordingResumeFailed",
337
+ /**
338
+ * Triggered when a task is rejected/unanswered
339
+ * @example
340
+ * ```typescript
341
+ * task.on(TASK_EVENTS.TASK_REJECT, (task: ITask) => {
342
+ * console.log('Task rejected:', task.data.interactionId);
343
+ * // Handle task rejection
344
+ * });
345
+ * ```
346
+ */
347
+ TASK_REJECT = "task:rejected",
348
+ /**
349
+ * Triggered when an outdial call fails
350
+ * @example
351
+ * ```typescript
352
+ * task.on(TASK_EVENTS.TASK_OUTDIAL_FAILED, (reason: string) => {
353
+ * console.log('Outdial failed:', reason);
354
+ * // Handle outdial failure
355
+ * });
356
+ * ```
357
+ */
358
+ TASK_OUTDIAL_FAILED = "task:outdialFailed",
359
+ /**
360
+ * Triggered when a task is populated with data
361
+ * @example
362
+ * ```typescript
363
+ * task.on(TASK_EVENTS.TASK_HYDRATE, (task: ITask) => {
364
+ * console.log('Task hydrated:', task.data.interactionId);
365
+ * // Process task data
366
+ * });
367
+ * ```
368
+ */
369
+ TASK_HYDRATE = "task:hydrate",
370
+ /**
371
+ * Triggered when a new contact is offered
372
+ * @example
373
+ * ```typescript
374
+ * task.on(TASK_EVENTS.TASK_OFFER_CONTACT, (task: ITask) => {
375
+ * console.log('Contact offered:', task.data.interactionId);
376
+ * // Handle contact offer
377
+ * });
378
+ * ```
379
+ */
380
+ TASK_OFFER_CONTACT = "task:offerContact",
381
+ /**
382
+ * Triggered when a task has been successfully auto-answered
383
+ * This event is emitted after the SDK automatically accepts a task due to:
384
+ * - WebRTC calls with auto-answer enabled
385
+ * - Agent-initiated outdial calls
386
+ * - Other auto-answer scenarios
387
+ * @example
388
+ * ```typescript
389
+ * task.on(TASK_EVENTS.TASK_AUTO_ANSWERED, (task: ITask) => {
390
+ * console.log('Task auto-answered:', task.data.interactionId);
391
+ * // Update UI - enable cancel button, etc.
392
+ * });
393
+ * ```
394
+ */
395
+ TASK_AUTO_ANSWERED = "task:autoAnswered",
396
+ /**
397
+ * Triggered when a conference is being established
398
+ * @example
399
+ * ```typescript
400
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_ESTABLISHING, (task: ITask) => {
401
+ * console.log('Conference establishing:', task.data.interactionId);
402
+ * // Handle conference setup in progress
403
+ * });
404
+ * ```
405
+ */
406
+ TASK_CONFERENCE_ESTABLISHING = "task:conferenceEstablishing",
407
+ /**
408
+ * Triggered when a conference is started successfully
409
+ * @example
410
+ * ```typescript
411
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_STARTED, (task: ITask) => {
412
+ * console.log('Conference started:', task.data.interactionId);
413
+ * // Handle conference start
414
+ * });
415
+ * ```
416
+ */
417
+ TASK_CONFERENCE_STARTED = "task:conferenceStarted",
418
+ /**
419
+ * Triggered when a conference fails to start
420
+ * @example
421
+ * ```typescript
422
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_FAILED, (task: ITask) => {
423
+ * console.log('Conference failed:', task.data.interactionId);
424
+ * // Handle conference failure
425
+ * });
426
+ * ```
427
+ */
428
+ TASK_CONFERENCE_FAILED = "task:conferenceFailed",
429
+ /**
430
+ * Triggered when a conference is ended successfully
431
+ * @example
432
+ * ```typescript
433
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_ENDED, (task: ITask) => {
434
+ * console.log('Conference ended:', task.data.interactionId);
435
+ * // Handle conference end
436
+ * });
437
+ * ```
438
+ */
439
+ TASK_CONFERENCE_ENDED = "task:conferenceEnded",
440
+ /**
441
+ * Triggered when a participant joins the conference
442
+ * @example
443
+ * ```typescript
444
+ * task.on(TASK_EVENTS.TASK_PARTICIPANT_JOINED, (task: ITask) => {
445
+ * console.log('Participant joined conference:', task.data.interactionId);
446
+ * // Handle participant joining
447
+ * });
448
+ * ```
449
+ */
450
+ TASK_PARTICIPANT_JOINED = "task:participantJoined",
451
+ /**
452
+ * Triggered when a participant leaves the conference
453
+ * @example
454
+ * ```typescript
455
+ * task.on(TASK_EVENTS.TASK_PARTICIPANT_LEFT, (task: ITask) => {
456
+ * console.log('Participant left conference:', task.data.interactionId);
457
+ * // Handle participant leaving
458
+ * });
459
+ * ```
460
+ */
461
+ TASK_PARTICIPANT_LEFT = "task:participantLeft",
462
+ /**
463
+ * Triggered when conference transfer is successful
464
+ * @example
465
+ * ```typescript
466
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_TRANSFERRED, (task: ITask) => {
467
+ * console.log('Conference transferred:', task.data.interactionId);
468
+ * // Handle successful conference transfer
469
+ * });
470
+ * ```
471
+ */
472
+ TASK_CONFERENCE_TRANSFERRED = "task:conferenceTransferred",
473
+ /**
474
+ * Triggered when conference transfer fails
475
+ * @example
476
+ * ```typescript
477
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_TRANSFER_FAILED, (task: ITask) => {
478
+ * console.log('Conference transfer failed:', task.data.interactionId);
479
+ * // Handle failed conference transfer
480
+ * });
481
+ * ```
482
+ */
483
+ TASK_CONFERENCE_TRANSFER_FAILED = "task:conferenceTransferFailed",
484
+ /**
485
+ * Triggered when ending a conference fails
486
+ * @example
487
+ * ```typescript
488
+ * task.on(TASK_EVENTS.TASK_CONFERENCE_END_FAILED, (task: ITask) => {
489
+ * console.log('Conference end failed:', task.data.interactionId);
490
+ * // Handle failed conference end
491
+ * });
492
+ * ```
493
+ */
494
+ TASK_CONFERENCE_END_FAILED = "task:conferenceEndFailed",
495
+ /**
496
+ * Triggered when participant exit from conference fails
497
+ * @example
498
+ * ```typescript
499
+ * task.on(TASK_EVENTS.TASK_PARTICIPANT_LEFT_FAILED, (task: ITask) => {
500
+ * console.log('Participant failed to leave conference:', task.data.interactionId);
501
+ * // Handle failed participant exit
502
+ * });
503
+ * ```
504
+ */
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",
540
+ /**
541
+ * Triggered when a contact is merged
542
+ * @example
543
+ * ```typescript
544
+ * task.on(TASK_EVENTS.TASK_MERGED, (task: ITask) => {
545
+ * console.log('Contact merged:', task.data.interactionId);
546
+ * // Handle contact merge
547
+ * });
548
+ * ```
549
+ */
550
+ TASK_MERGED = "task:merged",
551
+ /**
552
+ * Triggered when a participant enters post-call activity state
553
+ * @example
554
+ * ```typescript
555
+ * task.on(TASK_EVENTS.TASK_POST_CALL_ACTIVITY, (task: ITask) => {
556
+ * console.log('Participant in post-call activity:', task.data.interactionId);
557
+ * // Handle post-call activity
558
+ * });
559
+ * ```
560
+ */
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",
572
+ /**
573
+ * Triggered when a campaign preview contact is offered to the agent
574
+ * @example
575
+ * ```typescript
576
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, (data: AgentContact) => {
577
+ * console.log('Campaign preview contact received:', data.interactionId);
578
+ * // Handle campaign preview reservation
579
+ * });
580
+ * ```
581
+ */
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"
627
+ }
628
+ /**
629
+ * Represents a customer interaction within the contact center system
630
+ * Contains comprehensive details about an ongoing customer interaction
631
+ * @public
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
+ };
766
+ export type Interaction = {
767
+ /** Indicates if the interaction is managed by Flow Control */
768
+ isFcManaged: boolean;
769
+ /** Indicates if the interaction has been terminated */
770
+ isTerminated: boolean;
771
+ /** The type of media channel for this interaction */
772
+ mediaType: MEDIA_CHANNEL;
773
+ /** List of previous virtual teams that handled this interaction */
774
+ previousVTeams: string[];
775
+ /** Current state of the interaction */
776
+ state: string;
777
+ /** Current virtual team handling the interaction */
778
+ currentVTeam: string;
779
+ /** List of participants in the interaction */
780
+ participants: InteractionParticipants;
781
+ /** Detailed call associated data */
782
+ callAssociatedData?: CallAssociatedData;
783
+ /** Simplified call associated key/value pairs */
784
+ callAssociatedDetails?: CallAssociatedDetails;
785
+ /** Unique identifier for the interaction */
786
+ interactionId: string;
787
+ /** Organization identifier */
788
+ orgId: string;
789
+ /** Timestamp when the interaction was created */
790
+ createdTimestamp?: number;
791
+ /** Indicates if wrap-up assistance is enabled */
792
+ isWrapUpAssist?: boolean;
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
+ */
805
+ callProcessingDetails: {
806
+ /** Name of the Queue Manager handling this interaction */
807
+ QMgrName: string;
808
+ /** Indicates if the task should be self-serviced */
809
+ taskToBeSelfServiced: string;
810
+ /** Automatic Number Identification (caller's number) */
811
+ ani: string;
812
+ /** Display version of the ANI */
813
+ displayAni: string;
814
+ /** Dialed Number Identification Service number */
815
+ dnis: string;
816
+ /** Tenant identifier */
817
+ tenantId: string;
818
+ /** Queue identifier */
819
+ QueueId: string;
820
+ /** Virtual team identifier */
821
+ vteamId: string;
822
+ /** Agent capability for pause/resume on this interaction */
823
+ pauseResumeEnabled?: boolean;
824
+ /** Duration of pause in seconds */
825
+ pauseDuration?: string;
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;
836
+ /** Indicates if Consult to Queue is in progress */
837
+ ctqInProgress?: boolean;
838
+ /** Indicates if outdial transfer to queue is enabled */
839
+ outdialTransferToQueueEnabled?: boolean;
840
+ /** IVR conversation transcript */
841
+ convIvrTranscript?: string;
842
+ /** Customer's name */
843
+ customerName: string;
844
+ /** Name of the virtual team */
845
+ virtualTeamName: string;
846
+ /** RONA (Redirection on No Answer) timeout in seconds */
847
+ ronaTimeout: string;
848
+ /** Category of the interaction */
849
+ category: string;
850
+ /** Reason for the interaction */
851
+ reason: string;
852
+ /** Source number for the interaction */
853
+ sourceNumber: string;
854
+ /** Source page that initiated the interaction */
855
+ sourcePage: string;
856
+ /** Application user identifier */
857
+ appUser: string;
858
+ /** Customer's contact number */
859
+ customerNumber: string;
860
+ /** Code indicating the reason for interaction */
861
+ reasonCode: string;
862
+ /** Path taken through the IVR system */
863
+ IvrPath: string;
864
+ /** Identifier for the IVR path */
865
+ pathId: string;
866
+ /** Email address or contact point that initiated the interaction */
867
+ fromAddress: string;
868
+ /** Identifier of the parent interaction for related interactions */
869
+ parentInteractionId?: string;
870
+ /** Identifier of the child interaction for related interactions */
871
+ childInteractionId?: string;
872
+ /** Type of relationship between parent and child interactions */
873
+ relationshipType?: string;
874
+ /** ANI of the parent interaction */
875
+ parent_ANI?: string;
876
+ /** DNIS of the parent interaction */
877
+ parent_DNIS?: string;
878
+ /** Indicates if the consulted destination agent has joined */
879
+ consultDestinationAgentJoined?: boolean | string;
880
+ /** Name of the destination agent for consultation */
881
+ consultDestinationAgentName?: string;
882
+ /** DN of the parent interaction's agent */
883
+ parent_Agent_DN?: string;
884
+ /** Name of the parent interaction's agent */
885
+ parent_Agent_Name?: string;
886
+ /** Team name of the parent interaction's agent */
887
+ parent_Agent_TeamName?: string;
888
+ /** Indicates if the interaction is in conference mode */
889
+ isConferencing?: string;
890
+ /** Type of monitoring being performed */
891
+ monitorType?: string;
892
+ /** Name of the workflow being executed */
893
+ workflowName?: string;
894
+ /** Identifier of the workflow */
895
+ workflowId?: string;
896
+ /** Indicates if monitoring is in invisible mode */
897
+ monitoringInvisibleMode?: string;
898
+ /** Identifier for the monitoring request */
899
+ monitoringRequestId?: string;
900
+ /** Timeout for participant invitation */
901
+ participantInviteTimeout?: string;
902
+ /** Filename for music on hold */
903
+ mohFileName?: string;
904
+ /** Flag for continuing recording during transfer */
905
+ CONTINUE_RECORDING_ON_TRANSFER?: string;
906
+ /** Entry point identifier */
907
+ EP_ID?: string;
908
+ /** Type of routing being used */
909
+ ROUTING_TYPE?: string;
910
+ /** Events registered with Flow Control Engine */
911
+ fceRegisteredEvents?: string;
912
+ /** Indicates if the interaction is parked */
913
+ isParked?: string;
914
+ /** Priority level of the interaction */
915
+ priority?: string;
916
+ /** Identifier for the routing strategy */
917
+ routingStrategyId?: string;
918
+ /** Current state of monitoring */
919
+ monitoringState?: string;
920
+ /** Indicates if blind transfer is in progress */
921
+ BLIND_TRANSFER_IN_PROGRESS?: boolean;
922
+ /** Desktop view configuration for Flow Control */
923
+ fcDesktopView?: string;
924
+ /** Agent ID who initiated the outdial call */
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;
936
+ };
937
+ /** Main interaction identifier for related interactions */
938
+ mainInteractionId?: string;
939
+ /** Timestamp when interaction entered queue */
940
+ queuedTimestamp?: number | null;
941
+ /** Media-specific information for the interaction */
942
+ media: Record<string, MediaEntry>;
943
+ /** Owner of the interaction */
944
+ owner: string;
945
+ /** Primary media channel for the interaction */
946
+ mediaChannel: string;
947
+ /** Direction information for the contact */
948
+ contactDirection: {
949
+ type: string;
950
+ };
951
+ /** Type of outbound interaction */
952
+ outboundType?: string;
953
+ /** Optional workflow manager identifier */
954
+ workflowManager?: string | null;
955
+ /** Parameters passed through the call flow */
956
+ callFlowParams?: Record<string, FlowParameter>;
957
+ };
958
+ /**
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.
962
+ * @public
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
+ };
983
+ export type TaskData = {
984
+ /** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
985
+ mediaResourceId: string;
986
+ /** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
987
+ eventType: string;
988
+ /** Timestamp when the event occurred */
989
+ eventTime?: number;
990
+ /** Identifier of the agent handling the task */
991
+ agentId: string;
992
+ /** Identifier of the destination agent for transfers/consults */
993
+ destAgentId: string;
994
+ /** Unique tracking identifier for the task */
995
+ trackingId: string;
996
+ /** Media resource identifier for consultation leg when present */
997
+ consultMediaResourceId: string;
998
+ /** Detailed interaction information */
999
+ interaction: Interaction;
1000
+ /** Unique identifier for the participant */
1001
+ participantId?: string;
1002
+ /** Indicates if the task is from the owner */
1003
+ fromOwner?: boolean;
1004
+ /** Indicates if the task is to the owner */
1005
+ toOwner?: boolean;
1006
+ /** Identifier for child interaction in consult/transfer scenarios */
1007
+ childInteractionId?: string;
1008
+ /** Interaction/contact identifier from backend (same as interaction.interactionId) */
1009
+ interactionId: string;
1010
+ /** Organization identifier */
1011
+ orgId: string;
1012
+ /** Current owner of the task */
1013
+ owner: string;
1014
+ /** Queue manager handling the task */
1015
+ queueMgr: string;
1016
+ /** Name of the queue where task is queued */
1017
+ queueName?: string;
1018
+ /** Task/interaction type returned by the platform (routing/monitoring/etc.) */
1019
+ type: string;
1020
+ /** Timeout value for RONA (Redirection on No Answer) in seconds */
1021
+ ronaTimeout?: number;
1022
+ /** Indicates if the task is in consultation state */
1023
+ isConsulted?: boolean;
1024
+ /** Indicates if the task is in conference state */
1025
+ isConferencing: boolean;
1026
+ /** Indicates if a conference is currently in progress (2+ active agents) */
1027
+ isConferenceInProgress?: boolean;
1028
+ /** Identifier of agent who last updated the task */
1029
+ updatedBy?: string;
1030
+ /** Type of destination for transfer/consult */
1031
+ destinationType?: string;
1032
+ /** Indicates if the task was automatically resumed */
1033
+ autoResumed?: boolean;
1034
+ /** Code indicating the reason for an action */
1035
+ reasonCode?: string | number;
1036
+ /** Description of the reason for an action */
1037
+ reason?: string;
1038
+ /** Identifier of the consulting agent */
1039
+ consultingAgentId?: string;
1040
+ /** Unique identifier for the task */
1041
+ taskId?: string;
1042
+ /** Task details including state and media information */
1043
+ task?: Interaction;
1044
+ /** Unique identifier for monitoring offered events */
1045
+ id?: string;
1046
+ /** Indicates if the web call is muted */
1047
+ isWebCallMute?: boolean;
1048
+ /** Identifier for reservation interaction */
1049
+ reservationInteractionId?: string;
1050
+ /** Identifier for the reserved agent channel (used for campaign tasks) */
1051
+ reservedAgentChannelId?: string;
1052
+ /** Indicates if wrap-up is required for this task */
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;
1095
+ /** Indicates if auto-answer is in progress for this task */
1096
+ isAutoAnswering?: boolean;
1097
+ /** Indicates if wrap-up is required for this task */
1098
+ agentsPendingWrapUp?: string[];
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
+ */
1141
+ /**
1142
+ * Type representing an agent contact message within the contact center system
1143
+ * Contains comprehensive interaction and task related details for agent operations
1144
+ * @public
1145
+ */
1146
+ export type AgentContact = Msg<{
1147
+ /** Unique identifier for the media resource */
1148
+ mediaResourceId: string;
1149
+ /** Type of the event (e.g., 'AgentDesktopMessage') */
1150
+ eventType: string;
1151
+ /** Timestamp when the event occurred */
1152
+ eventTime?: number;
1153
+ /** Unique identifier of the agent handling the contact */
1154
+ agentId: string;
1155
+ /** Identifier of the destination agent for transfers/consults */
1156
+ destAgentId: string;
1157
+ /** Unique tracking identifier for the contact */
1158
+ trackingId: string;
1159
+ /** Media resource identifier for consult operations */
1160
+ consultMediaResourceId: string;
1161
+ /** Detailed interaction information including media and participant data */
1162
+ interaction: Interaction;
1163
+ /** Unique identifier for the participant */
1164
+ participantId?: string;
1165
+ /** Indicates if the message is from the owner of the interaction */
1166
+ fromOwner?: boolean;
1167
+ /** Indicates if the message is to the owner of the interaction */
1168
+ toOwner?: boolean;
1169
+ /** Identifier for child interaction in case of consult/transfer */
1170
+ childInteractionId?: string;
1171
+ /** Unique identifier for the interaction */
1172
+ interactionId: string;
1173
+ /** Organization identifier */
1174
+ orgId: string;
1175
+ /** Current owner of the interaction */
1176
+ owner: string;
1177
+ /** Queue manager handling the interaction */
1178
+ queueMgr: string;
1179
+ /** Name of the queue where interaction is queued */
1180
+ queueName?: string;
1181
+ /** Type of the contact/interaction */
1182
+ type: string;
1183
+ /** Timeout value for RONA (Redirection on No Answer) in seconds */
1184
+ ronaTimeout?: number;
1185
+ /** Indicates if the interaction is in consult state */
1186
+ isConsulted?: boolean;
1187
+ /** Indicates if the interaction is in conference state */
1188
+ isConferencing: boolean;
1189
+ /** Identifier of the agent who last updated the interaction */
1190
+ updatedBy?: string;
1191
+ /** Type of destination for transfer/consult */
1192
+ destinationType?: string;
1193
+ /** Indicates if the interaction was automatically resumed */
1194
+ autoResumed?: boolean;
1195
+ /** Code indicating the reason for an action */
1196
+ reasonCode?: string | number;
1197
+ /** Description of the reason for an action */
1198
+ reason?: string;
1199
+ /** Identifier of the consulting agent */
1200
+ consultingAgentId?: string;
1201
+ /** Unique identifier for the task */
1202
+ taskId?: string;
1203
+ /** Task details including media and state information */
1204
+ task?: Interaction;
1205
+ /** Identifier of the supervisor monitoring the interaction */
1206
+ supervisorId?: string;
1207
+ /** Type of monitoring (e.g., 'SILENT', 'BARGE_IN') */
1208
+ monitorType?: string;
1209
+ /** Dial number of the supervisor */
1210
+ supervisorDN?: string;
1211
+ /** Unique identifier for monitoring offered events */
1212
+ id?: string;
1213
+ /** Indicates if the web call is muted */
1214
+ isWebCallMute?: boolean;
1215
+ /** Identifier for reservation interaction */
1216
+ reservationInteractionId?: string;
1217
+ /** Identifier for the reserved agent channel */
1218
+ reservedAgentChannelId?: string;
1219
+ /** Current monitoring state information */
1220
+ monitoringState?: {
1221
+ /** Type of monitoring state */
1222
+ type: string;
1223
+ };
1224
+ /** Name of the supervisor monitoring the interaction */
1225
+ supervisorName?: string;
1226
+ }>;
1227
+ /**
1228
+ * Information about a virtual team in the contact center
1229
+ * @ignore
1230
+ */
1231
+ export type VTeam = {
1232
+ /** Profile ID of the agent in the virtual team */
1233
+ agentProfileId: string;
1234
+ /** Session ID of the agent in the virtual team */
1235
+ agentSessionId: string;
1236
+ /** Type of channel handled by the virtual team */
1237
+ channelType: string;
1238
+ /** Type of the virtual team */
1239
+ type: string;
1240
+ /** Optional tracking identifier */
1241
+ trackingId?: string;
1242
+ };
1243
+ /**
1244
+ * Detailed information about a virtual team configuration
1245
+ * @ignore
1246
+ */
1247
+ export type VteamDetails = {
1248
+ /** Name of the virtual team */
1249
+ name: string;
1250
+ /** Type of channel handled by the virtual team */
1251
+ channelType: string;
1252
+ /** Unique identifier for the virtual team */
1253
+ id: string;
1254
+ /** Type of the virtual team */
1255
+ type: string;
1256
+ /** ID of the analyzer associated with the team */
1257
+ analyzerId: string;
1258
+ };
1259
+ /**
1260
+ * Response type for successful virtual team operations
1261
+ * Contains details about virtual teams and their capabilities
1262
+ * @ignore
1263
+ */
1264
+ export type VTeamSuccess = Msg<{
1265
+ /** Response data containing team information */
1266
+ data: {
1267
+ /** List of virtual team details */
1268
+ vteamList: Array<VteamDetails>;
1269
+ /** Whether queue consultation is allowed */
1270
+ allowConsultToQueue: boolean;
1271
+ };
1272
+ /** Method name from JavaScript */
1273
+ jsMethod: string;
1274
+ /** Data related to the call */
1275
+ callData: string;
1276
+ /** Session ID of the agent */
1277
+ agentSessionId: string;
1278
+ }>;
1279
+ /**
1280
+ * Parameters for putting a task on hold or resuming from hold
1281
+ * @public
1282
+ */
1283
+ export type HoldResumePayload = {
1284
+ /** Unique identifier for the media resource to hold/resume */
1285
+ mediaResourceId: string;
1286
+ };
1287
+ /**
1288
+ * Parameters for resuming a task's recording
1289
+ * @public
1290
+ */
1291
+ export type ResumeRecordingPayload = {
1292
+ /** Indicates if the recording was automatically resumed */
1293
+ autoResumed: boolean;
1294
+ };
1295
+ /**
1296
+ * Parameters for transferring a task to another destination
1297
+ * @public
1298
+ */
1299
+ export type TransferPayLoad = {
1300
+ /** Destination identifier where the task will be transferred to */
1301
+ to: string;
1302
+ /** Type of the destination (queue, agent, etc.) */
1303
+ destinationType: DestinationType;
1304
+ };
1305
+ /**
1306
+ * Parameters for initiating a consultative transfer
1307
+ * @public
1308
+ */
1309
+ export type ConsultTransferPayLoad = {
1310
+ /** Destination identifier for the consultation transfer */
1311
+ to: string;
1312
+ /** Type of the consultation transfer destination */
1313
+ destinationType: ConsultTransferDestinationType;
1314
+ };
1315
+ /**
1316
+ * Parameters for initiating a consultation with another agent or queue
1317
+ * @public
1318
+ */
1319
+ export type ConsultPayload = {
1320
+ /** Destination identifier for the consultation */
1321
+ to: string | undefined;
1322
+ /** Type of the consultation destination (agent, queue, etc.) */
1323
+ destinationType: DestinationType;
1324
+ /** Whether to hold other participants during consultation (always true) */
1325
+ holdParticipants?: boolean;
1326
+ };
1327
+ /**
1328
+ * Parameters for ending a consultation task
1329
+ * @public
1330
+ */
1331
+ export type ConsultEndPayload = {
1332
+ /** Indicates if this is a consultation operation */
1333
+ isConsult: boolean;
1334
+ /** Indicates if this involves a secondary entry point or DN agent */
1335
+ isSecondaryEpDnAgent?: boolean;
1336
+ /** Optional queue identifier for the consultation */
1337
+ queueId?: string;
1338
+ /** Identifier of the task being consulted */
1339
+ taskId: string;
1340
+ };
1341
+ /**
1342
+ * Parameters for transferring a task to another destination
1343
+ * @public
1344
+ */
1345
+ export type TransferPayload = {
1346
+ /** Destination identifier where the task will be transferred */
1347
+ to: string | undefined;
1348
+ /** Type of the transfer destination */
1349
+ destinationType: DestinationType;
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
+ };
1359
+ /**
1360
+ * API payload for ending a consultation
1361
+ * This is the actual payload that is sent to the developer API
1362
+ * @public
1363
+ */
1364
+ export type ConsultEndAPIPayload = {
1365
+ /** Optional identifier of the queue involved in the consultation */
1366
+ queueId?: string;
1367
+ };
1368
+ /**
1369
+ * Data required for consulting and conferencing operations
1370
+ * @public
1371
+ */
1372
+ export type ConsultConferenceData = {
1373
+ /** Identifier of the agent initiating consult/conference */
1374
+ agentId?: string;
1375
+ /** Target destination for the consult/conference */
1376
+ to: string | undefined;
1377
+ /** Type of destination (e.g., 'agent', 'queue') */
1378
+ destinationType: string;
1379
+ };
1380
+ /**
1381
+ * Parameters required for cancelling a consult to queue operation
1382
+ * @public
1383
+ */
1384
+ export type cancelCtq = {
1385
+ /** Identifier of the agent cancelling the CTQ */
1386
+ agentId: string;
1387
+ /** Identifier of the queue where consult was initiated */
1388
+ queueId: string;
1389
+ };
1390
+ /**
1391
+ * Parameters required for declining a task
1392
+ * @public
1393
+ */
1394
+ export type declinePayload = {
1395
+ /** Identifier of the media resource to decline */
1396
+ mediaResourceId: string;
1397
+ };
1398
+ /**
1399
+ * Parameters for wrapping up a task with relevant completion details
1400
+ * @public
1401
+ */
1402
+ export type WrapupPayLoad = {
1403
+ /** The reason provided for wrapping up the task */
1404
+ wrapUpReason: string;
1405
+ /** Auxiliary code identifier associated with the wrap-up state */
1406
+ auxCodeId: string;
1407
+ };
1408
+ /**
1409
+ * Configuration parameters for initiating outbound dialer tasks
1410
+ * @public
1411
+ */
1412
+ export type DialerPayload = {
1413
+ /** An entryPointId for respective task */
1414
+ entryPointId: string;
1415
+ /** A valid customer DN, on which the response is expected, maximum length 36 characters */
1416
+ destination: string;
1417
+ /** The direction of the call */
1418
+ direction: 'OUTBOUND';
1419
+ /** Schema-free data tuples to pass specific data based on outboundType (max 30 tuples) */
1420
+ attributes: {
1421
+ [key: string]: string;
1422
+ };
1423
+ /** The media type for the request */
1424
+ mediaType: 'telephony' | 'chat' | 'social' | 'email';
1425
+ /** The outbound type for the task */
1426
+ outboundType: 'OUTDIAL' | 'CALLBACK' | 'EXECUTE_FLOW';
1427
+ /** The Outdial ANI number that will be used while making a call to the customer. */
1428
+ origin: string;
1429
+ };
1430
+ /**
1431
+ * Payload for campaign preview contact operations (accept, skip, remove)
1432
+ * @public
1433
+ */
1434
+ export type PreviewContactPayload = {
1435
+ /** The interaction ID from the campaign reservation */
1436
+ interactionId: string;
1437
+ /** The campaign name (not a UUID). Available from the reservation event at
1438
+ * `task.data.interaction.callProcessingDetails.campaignId` or `task.data.campaignId`. */
1439
+ campaignId: string;
1440
+ };
1441
+ /**
1442
+ * Data structure for cleaning up contact resources
1443
+ * @public
1444
+ */
1445
+ export type ContactCleanupData = {
1446
+ /** Type of cleanup operation being performed */
1447
+ type: string;
1448
+ /** Organization identifier where cleanup is occurring */
1449
+ orgId: string;
1450
+ /** Identifier of the agent associated with the contacts */
1451
+ agentId: string;
1452
+ /** Detailed data about the cleanup operation */
1453
+ data: {
1454
+ /** Type of event that triggered the cleanup */
1455
+ eventType: string;
1456
+ /** Identifier of the interaction being cleaned up */
1457
+ interactionId: string;
1458
+ /** Organization identifier */
1459
+ orgId: string;
1460
+ /** Media manager handling the cleanup */
1461
+ mediaMgr: string;
1462
+ /** Tracking identifier for the cleanup operation */
1463
+ trackingId: string;
1464
+ /** Type of media being cleaned up */
1465
+ mediaType: string;
1466
+ /** Optional destination information */
1467
+ destination?: string;
1468
+ /** Whether this is a broadcast cleanup */
1469
+ broadcast: boolean;
1470
+ /** Type of cleanup being performed */
1471
+ type: string;
1472
+ };
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';
1487
+ /**
1488
+ * Response type for task public methods
1489
+ * Can be an {@link AgentContact} object containing updated task state,
1490
+ * an Error in case of failure, or void for operations that don't return data
1491
+ * @public
1492
+ */
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
+ }
1515
+ /**
1516
+ * Interface for managing task-related operations in the contact center
1517
+ * Extends IEventEmitter to support event-driven task updates
1518
+ */
1519
+ export interface ITask extends IEventEmitter {
1520
+ /**
1521
+ * Event data received in the Contact Center events.
1522
+ * Contains detailed task information including interaction details, media resources,
1523
+ * and participant data as defined in {@link TaskData}
1524
+ */
1525
+ data: TaskData;
1526
+ /**
1527
+ * Map associating tasks with their corresponding call identifiers.
1528
+ */
1529
+ webCallMap: Record<TaskId, CallId>;
1530
+ /**
1531
+ * Auto-wrapup timer for the task
1532
+ * This is used to automatically wrap up tasks after a specified duration
1533
+ * as defined in {@link AutoWrapup}
1534
+ */
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;
1543
+ /**
1544
+ * Cancels the auto-wrapup timer for the task.
1545
+ * This method stops the auto-wrapup process if it is currently active.
1546
+ * Note: This is supported only in single session mode. Not supported in multi-session mode.
1547
+ * @returns void
1548
+ */
1549
+ cancelAutoWrapupTimer(): void;
1550
+ /**
1551
+ * Deregisters all web call event listeners.
1552
+ * Used when cleaning up task resources.
1553
+ * @ignore
1554
+ */
1555
+ unregisterWebCallListeners(): void;
1556
+ /**
1557
+ * Updates the task data with new information
1558
+ * @param newData - Updated task data to apply, must conform to {@link TaskData} structure
1559
+ * @returns Updated task instance
1560
+ * @ignore
1561
+ */
1562
+ updateTaskData(newData: TaskData): void;
1563
+ /**
1564
+ * Answers or accepts an incoming task.
1565
+ * Once accepted, the task will be assigned to the agent and trigger a {@link TASK_EVENTS.TASK_ASSIGNED} event.
1566
+ * The response will contain updated agent contact information as defined in {@link AgentContact}.
1567
+ * @returns Promise<TaskResponse>
1568
+ * @example
1569
+ * ```typescript
1570
+ * await task.accept();
1571
+ * ```
1572
+ */
1573
+ accept(): Promise<TaskResponse>;
1574
+ /**
1575
+ * Declines an incoming task for Browser Login
1576
+ * @returns Promise<TaskResponse>
1577
+ * @example
1578
+ * ```typescript
1579
+ * await task.decline();
1580
+ * ```
1581
+ */
1582
+ decline(): Promise<TaskResponse>;
1583
+ /**
1584
+ * Places the current task on hold.
1585
+ * @param mediaResourceId - Optional media resource ID to use for the hold operation. If not provided, uses the task's current mediaResourceId
1586
+ * @returns Promise<TaskResponse>
1587
+ * @example
1588
+ * ```typescript
1589
+ * // Hold with default mediaResourceId
1590
+ * await task.hold();
1591
+ *
1592
+ * // Hold with custom mediaResourceId
1593
+ * await task.hold('custom-media-resource-id');
1594
+ * ```
1595
+ */
1596
+ hold(mediaResourceId?: string): Promise<TaskResponse>;
1597
+ /**
1598
+ * Resumes a task that was previously on hold.
1599
+ * @param mediaResourceId - Optional media resource ID to use for the resume operation. If not provided, uses the task's current mediaResourceId from interaction media
1600
+ * @returns Promise<TaskResponse>
1601
+ * @example
1602
+ * ```typescript
1603
+ * // Resume with default mediaResourceId
1604
+ * await task.resume();
1605
+ *
1606
+ * // Resume with custom mediaResourceId
1607
+ * await task.resume('custom-media-resource-id');
1608
+ * ```
1609
+ */
1610
+ resume(mediaResourceId?: string): Promise<TaskResponse>;
1611
+ /**
1612
+ * Ends/terminates the current task.
1613
+ * @returns Promise<TaskResponse>
1614
+ * @example
1615
+ * ```typescript
1616
+ * await task.end();
1617
+ * ```
1618
+ */
1619
+ end(): Promise<TaskResponse>;
1620
+ /**
1621
+ * Initiates wrap-up process for the task with specified details.
1622
+ * @param wrapupPayload - Wrap-up details including reason and auxiliary code
1623
+ * @returns Promise<TaskResponse>
1624
+ * @example
1625
+ * ```typescript
1626
+ * await task.wrapup({
1627
+ * wrapUpReason: "Customer issue resolved",
1628
+ * auxCodeId: "RESOLVED"
1629
+ * });
1630
+ * ```
1631
+ */
1632
+ wrapup(wrapupPayload: WrapupPayLoad): Promise<TaskResponse>;
1633
+ /**
1634
+ * Pauses the recording for current task.
1635
+ * @returns Promise<TaskResponse>
1636
+ * @example
1637
+ * ```typescript
1638
+ * await task.pauseRecording();
1639
+ * ```
1640
+ */
1641
+ pauseRecording(): Promise<TaskResponse>;
1642
+ /**
1643
+ * Resumes a previously paused recording.
1644
+ * @param resumeRecordingPayload - Parameters for resuming the recording
1645
+ * @returns Promise<TaskResponse>
1646
+ * @example
1647
+ * ```typescript
1648
+ * await task.resumeRecording({
1649
+ * autoResumed: false
1650
+ * });
1651
+ * ```
1652
+ */
1653
+ resumeRecording(resumeRecordingPayload: ResumeRecordingPayload): Promise<TaskResponse>;
1654
+ /**
1655
+ * Initiates a consultation with another agent or queue.
1656
+ * @param consultPayload - Consultation details including destination and type
1657
+ * @returns Promise<TaskResponse>
1658
+ * @example
1659
+ * ```typescript
1660
+ * await task.consult({ to: "agentId", destinationType: "agent" });
1661
+ * ```
1662
+ */
1663
+ consult(consultPayload: ConsultPayload): Promise<TaskResponse>;
1664
+ /**
1665
+ * Ends an ongoing consultation.
1666
+ * @param consultEndPayload - Details for ending the consultation
1667
+ * @returns Promise<TaskResponse>
1668
+ * @example
1669
+ * ```typescript
1670
+ * await task.endConsult({ isConsult: true, taskId: "taskId" });
1671
+ * ```
1672
+ */
1673
+ endConsult(consultEndPayload: ConsultEndPayload): Promise<TaskResponse>;
1674
+ /**
1675
+ * Transfers the task to another agent or queue.
1676
+ * @param transferPayload - Transfer details including destination and type
1677
+ * @returns Promise<TaskResponse>
1678
+ * @example
1679
+ * ```typescript
1680
+ * await task.transfer({ to: "queueId", destinationType: "queue" });
1681
+ * ```
1682
+ */
1683
+ transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
1684
+ /**
1685
+ * Initiates a consult conference (merge consult call with main call).
1686
+ * @returns Promise<TaskResponse>
1687
+ * @example
1688
+ * ```typescript
1689
+ * await task.consultConference();
1690
+ * ```
1691
+ */
1692
+ consultConference(): Promise<TaskResponse>;
1693
+ /**
1694
+ * Exits from an ongoing conference.
1695
+ * @returns Promise<TaskResponse>
1696
+ * @example
1697
+ * ```typescript
1698
+ * await task.exitConference();
1699
+ * ```
1700
+ */
1701
+ exitConference(): Promise<TaskResponse>;
1702
+ /**
1703
+ * Transfers the conference to another participant.
1704
+ * @returns Promise<TaskResponse>
1705
+ * @example
1706
+ * ```typescript
1707
+ * await task.transferConference();
1708
+ * ```
1709
+ */
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>;
1723
+ /**
1724
+ * Toggles mute/unmute for the local audio stream during a WebRTC task.
1725
+ * @returns Promise<void>
1726
+ * @example
1727
+ * ```typescript
1728
+ * await task.toggleMute();
1729
+ * ```
1730
+ */
1731
+ toggleMute(): Promise<void>;
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
+ }