@webex/contact-center 3.11.0 → 3.12.0-auth-prejoin-fetch.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/.sdd/manifest.json +883 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +50 -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 +359 -0
  17. package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
  18. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  19. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  20. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  21. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  22. package/ai-docs/patterns/testing-patterns.md +480 -0
  23. package/ai-docs/patterns/typescript-patterns.md +365 -0
  24. package/ai-docs/templates/README.md +102 -0
  25. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  26. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  27. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  28. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  29. package/ai-docs/templates/new-method/00-master.md +80 -0
  30. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  31. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  32. package/ai-docs/templates/new-method/03-tests.md +201 -0
  33. package/ai-docs/templates/new-method/04-validation.md +141 -0
  34. package/ai-docs/templates/new-service/00-master.md +109 -0
  35. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  36. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  37. package/ai-docs/templates/new-service/03-integration.md +178 -0
  38. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  39. package/ai-docs/templates/new-service/05-validation.md +145 -0
  40. package/dist/cc.js +818 -59
  41. package/dist/cc.js.map +1 -1
  42. package/dist/config.js +13 -0
  43. package/dist/config.js.map +1 -1
  44. package/dist/constants.js +31 -3
  45. package/dist/constants.js.map +1 -1
  46. package/dist/index.js +27 -5
  47. package/dist/index.js.map +1 -1
  48. package/dist/metrics/behavioral-events.js +127 -0
  49. package/dist/metrics/behavioral-events.js.map +1 -1
  50. package/dist/metrics/constants.js +34 -3
  51. package/dist/metrics/constants.js.map +1 -1
  52. package/dist/services/AddressBook.js +18 -15
  53. package/dist/services/AddressBook.js.map +1 -1
  54. package/dist/services/AnswerCallOnWebexService.js +174 -0
  55. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  56. package/dist/services/ApiAiAssistant.js +318 -0
  57. package/dist/services/ApiAiAssistant.js.map +1 -0
  58. package/dist/services/EntryPoint.js +46 -68
  59. package/dist/services/EntryPoint.js.map +1 -1
  60. package/dist/services/Queue.js +27 -22
  61. package/dist/services/Queue.js.map +1 -1
  62. package/dist/services/UserPreference.js +427 -0
  63. package/dist/services/UserPreference.js.map +1 -0
  64. package/dist/services/WebexCrossClientService.js +171 -0
  65. package/dist/services/WebexCrossClientService.js.map +1 -0
  66. package/dist/services/WxAppTelephonyMercurySync.js +93 -0
  67. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  68. package/dist/services/agent/types.js.map +1 -1
  69. package/dist/services/config/Util.js +11 -4
  70. package/dist/services/config/Util.js.map +1 -1
  71. package/dist/services/config/constants.js +45 -8
  72. package/dist/services/config/constants.js.map +1 -1
  73. package/dist/services/config/index.js +41 -2
  74. package/dist/services/config/index.js.map +1 -1
  75. package/dist/services/config/types.js +70 -8
  76. package/dist/services/config/types.js.map +1 -1
  77. package/dist/services/constants.js +27 -1
  78. package/dist/services/constants.js.map +1 -1
  79. package/dist/services/core/Err.js.map +1 -1
  80. package/dist/services/core/Utils.js +122 -25
  81. package/dist/services/core/Utils.js.map +1 -1
  82. package/dist/services/core/WebexRequest.js +6 -2
  83. package/dist/services/core/WebexRequest.js.map +1 -1
  84. package/dist/services/core/aqm-reqs.js +119 -30
  85. package/dist/services/core/aqm-reqs.js.map +1 -1
  86. package/dist/services/core/types.js.map +1 -1
  87. package/dist/services/core/websocket/WebSocketManager.js +22 -6
  88. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  89. package/dist/services/core/websocket/connection-service.js +3 -1
  90. package/dist/services/core/websocket/connection-service.js.map +1 -1
  91. package/dist/services/core/websocket/types.js.map +1 -1
  92. package/dist/services/index.js +6 -0
  93. package/dist/services/index.js.map +1 -1
  94. package/dist/services/task/Task.js +754 -0
  95. package/dist/services/task/Task.js.map +1 -0
  96. package/dist/services/task/TaskFactory.js +49 -0
  97. package/dist/services/task/TaskFactory.js.map +1 -0
  98. package/dist/services/task/TaskManager.js +1073 -447
  99. package/dist/services/task/TaskManager.js.map +1 -1
  100. package/dist/services/task/TaskUtils.js +220 -23
  101. package/dist/services/task/TaskUtils.js.map +1 -1
  102. package/dist/services/task/WebexCallingUtils.js +70 -0
  103. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  104. package/dist/services/task/constants.js +26 -2
  105. package/dist/services/task/constants.js.map +1 -1
  106. package/dist/services/task/contact.js +29 -0
  107. package/dist/services/task/contact.js.map +1 -1
  108. package/dist/services/task/dialer.js +129 -0
  109. package/dist/services/task/dialer.js.map +1 -1
  110. package/dist/services/task/digital/Digital.js +78 -0
  111. package/dist/services/task/digital/Digital.js.map +1 -0
  112. package/dist/services/task/state-machine/TaskStateMachine.js +971 -0
  113. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  114. package/dist/services/task/state-machine/actions.js +572 -0
  115. package/dist/services/task/state-machine/actions.js.map +1 -0
  116. package/dist/services/task/state-machine/constants.js +161 -0
  117. package/dist/services/task/state-machine/constants.js.map +1 -0
  118. package/dist/services/task/state-machine/guards.js +409 -0
  119. package/dist/services/task/state-machine/guards.js.map +1 -0
  120. package/dist/services/task/state-machine/index.js +53 -0
  121. package/dist/services/task/state-machine/index.js.map +1 -0
  122. package/dist/services/task/state-machine/types.js +54 -0
  123. package/dist/services/task/state-machine/types.js.map +1 -0
  124. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  125. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  126. package/dist/services/task/taskDataNormalizer.js +99 -0
  127. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  128. package/dist/services/task/types.js +243 -5
  129. package/dist/services/task/types.js.map +1 -1
  130. package/dist/services/task/voice/Voice.js +1380 -0
  131. package/dist/services/task/voice/Voice.js.map +1 -0
  132. package/dist/services/task/voice/WebRTC.js +152 -0
  133. package/dist/services/task/voice/WebRTC.js.map +1 -0
  134. package/dist/services/task/voice/wxAppVoiceMethods.js +201 -0
  135. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  136. package/dist/services/wxAppTelephonyUtils.js +19 -0
  137. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  138. package/dist/types/cc.d.ts +967 -0
  139. package/dist/types/config.d.ts +79 -0
  140. package/dist/types/constants.d.ts +74 -0
  141. package/dist/types/index.d.ts +201 -0
  142. package/dist/types/logger-proxy.d.ts +71 -0
  143. package/dist/types/metrics/MetricsManager.d.ts +223 -0
  144. package/dist/types/metrics/behavioral-events.d.ts +29 -0
  145. package/dist/types/metrics/constants.d.ts +183 -0
  146. package/dist/types/services/AddressBook.d.ts +75 -0
  147. package/dist/types/services/AnswerCallOnWebexService.d.ts +37 -0
  148. package/dist/types/services/ApiAiAssistant.d.ts +49 -0
  149. package/dist/types/services/EntryPoint.d.ts +69 -0
  150. package/dist/types/services/Queue.d.ts +78 -0
  151. package/dist/types/services/UserPreference.d.ts +118 -0
  152. package/dist/types/services/WebCallingService.d.ts +1 -0
  153. package/dist/types/services/WebexCrossClientService.d.ts +28 -0
  154. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  155. package/dist/types/services/agent/index.d.ts +46 -0
  156. package/dist/types/services/agent/types.d.ts +413 -0
  157. package/dist/types/services/config/Util.d.ts +20 -0
  158. package/dist/types/services/config/constants.d.ts +273 -0
  159. package/dist/types/services/config/index.d.ts +177 -0
  160. package/dist/types/services/config/types.d.ts +1381 -0
  161. package/dist/types/services/constants.d.ts +110 -0
  162. package/dist/types/services/core/Err.d.ts +127 -0
  163. package/dist/types/services/core/GlobalTypes.d.ts +58 -0
  164. package/dist/types/services/core/Utils.d.ts +121 -0
  165. package/dist/types/services/core/WebexRequest.d.ts +23 -0
  166. package/dist/types/services/core/aqm-reqs.d.ts +65 -0
  167. package/dist/types/services/core/constants.d.ts +99 -0
  168. package/dist/types/services/core/types.d.ts +49 -0
  169. package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
  170. package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
  171. package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
  172. package/dist/types/services/core/websocket/types.d.ts +37 -0
  173. package/dist/types/services/index.d.ts +54 -0
  174. package/dist/types/services/task/AutoWrapup.d.ts +40 -0
  175. package/dist/types/services/task/Task.d.ts +175 -0
  176. package/dist/types/services/task/TaskFactory.d.ts +13 -0
  177. package/dist/types/services/task/TaskManager.d.ts +1 -0
  178. package/dist/types/services/task/TaskUtils.d.ts +138 -0
  179. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  180. package/dist/types/services/task/constants.d.ts +94 -0
  181. package/dist/types/services/task/contact.d.ts +73 -0
  182. package/dist/types/services/task/dialer.d.ts +73 -0
  183. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  184. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1398 -0
  185. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  186. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  187. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  188. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  189. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  190. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  191. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  192. package/dist/types/services/task/types.d.ts +1933 -0
  193. package/dist/types/services/task/voice/Voice.d.ts +223 -0
  194. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  195. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +52 -0
  196. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  197. package/dist/types/types.d.ts +784 -0
  198. package/dist/types/utils/PageCache.d.ts +190 -0
  199. package/dist/types/webex-config.d.ts +53 -0
  200. package/dist/types/webex.d.ts +8 -0
  201. package/dist/types.js +137 -3
  202. package/dist/types.js.map +1 -1
  203. package/dist/utils/PageCache.js +19 -5
  204. package/dist/utils/PageCache.js.map +1 -1
  205. package/dist/webex.js +14 -2
  206. package/dist/webex.js.map +1 -1
  207. package/package.json +16 -12
  208. package/src/cc.ts +983 -60
  209. package/src/config.ts +13 -0
  210. package/src/constants.ts +29 -1
  211. package/src/index.ts +26 -5
  212. package/src/metrics/ai-docs/AGENTS.md +350 -0
  213. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  214. package/src/metrics/ai-docs/metrics-spec.md +860 -0
  215. package/src/metrics/behavioral-events.ts +134 -0
  216. package/src/metrics/constants.ts +39 -3
  217. package/src/services/AddressBook.ts +17 -6
  218. package/src/services/AnswerCallOnWebexService.ts +206 -0
  219. package/src/services/ApiAiAssistant.ts +412 -0
  220. package/src/services/EntryPoint.ts +59 -60
  221. package/src/services/Queue.ts +29 -12
  222. package/src/services/UserPreference.ts +509 -0
  223. package/src/services/WebexCrossClientService.ts +212 -0
  224. package/src/services/WxAppTelephonyMercurySync.ts +115 -0
  225. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  226. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  227. package/src/services/agent/ai-docs/agent-spec.md +504 -0
  228. package/src/services/agent/types.ts +1 -1
  229. package/src/services/ai-docs/AGENTS.md +386 -0
  230. package/src/services/ai-docs/services-spec.md +497 -0
  231. package/src/services/config/Util.ts +13 -2
  232. package/src/services/config/ai-docs/AGENTS.md +255 -0
  233. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  234. package/src/services/config/ai-docs/config-spec.md +675 -0
  235. package/src/services/config/constants.ts +47 -7
  236. package/src/services/config/index.ts +45 -1
  237. package/src/services/config/types.ts +253 -11
  238. package/src/services/constants.ts +29 -0
  239. package/src/services/core/Err.ts +4 -0
  240. package/src/services/core/Utils.ts +143 -30
  241. package/src/services/core/WebexRequest.ts +3 -1
  242. package/src/services/core/ai-docs/AGENTS.md +381 -0
  243. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  244. package/src/services/core/ai-docs/core-spec.md +787 -0
  245. package/src/services/core/aqm-reqs.ts +125 -32
  246. package/src/services/core/types.ts +2 -0
  247. package/src/services/core/websocket/WebSocketManager.ts +23 -6
  248. package/src/services/core/websocket/connection-service.ts +5 -1
  249. package/src/services/core/websocket/types.ts +1 -1
  250. package/src/services/index.ts +4 -0
  251. package/src/services/task/Task.ts +908 -0
  252. package/src/services/task/TaskFactory.ts +60 -0
  253. package/src/services/task/TaskManager.ts +1291 -513
  254. package/src/services/task/TaskUtils.ts +314 -24
  255. package/src/services/task/WebexCallingUtils.ts +136 -0
  256. package/src/services/task/ai-docs/AGENTS.md +457 -0
  257. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  258. package/src/services/task/ai-docs/task-spec.md +1469 -0
  259. package/src/services/task/constants.ts +26 -0
  260. package/src/services/task/contact.ts +30 -0
  261. package/src/services/task/dialer.ts +136 -1
  262. package/src/services/task/digital/Digital.ts +97 -0
  263. package/src/services/task/state-machine/TaskStateMachine.ts +1313 -0
  264. package/src/services/task/state-machine/actions.ts +741 -0
  265. package/src/services/task/state-machine/ai-docs/AGENTS.md +462 -0
  266. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1146 -0
  267. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2209 -0
  268. package/src/services/task/state-machine/constants.ts +172 -0
  269. package/src/services/task/state-machine/guards.ts +498 -0
  270. package/src/services/task/state-machine/index.ts +28 -0
  271. package/src/services/task/state-machine/types.ts +258 -0
  272. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  273. package/src/services/task/taskDataNormalizer.ts +137 -0
  274. package/src/services/task/types.ts +843 -70
  275. package/src/services/task/voice/Voice.ts +1720 -0
  276. package/src/services/task/voice/WebRTC.ts +191 -0
  277. package/src/services/task/voice/wxAppVoiceMethods.ts +307 -0
  278. package/src/services/wxAppTelephonyUtils.ts +14 -0
  279. package/src/types.ts +238 -11
  280. package/src/utils/AGENTS.md +289 -0
  281. package/src/utils/PageCache.ts +38 -5
  282. package/src/utils/ai-docs/utils-spec.md +391 -0
  283. package/src/webex.js +2 -0
  284. package/test/unit/spec/cc.ts +1856 -122
  285. package/test/unit/spec/logger-proxy.ts +70 -0
  286. package/test/unit/spec/metrics/behavioral-events.ts +18 -0
  287. package/test/unit/spec/services/AddressBook.ts +37 -6
  288. package/test/unit/spec/services/AnswerCallOnWebexService.ts +223 -0
  289. package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
  290. package/test/unit/spec/services/EntryPoint.ts +87 -40
  291. package/test/unit/spec/services/Queue.ts +123 -12
  292. package/test/unit/spec/services/UserPreference.ts +401 -0
  293. package/test/unit/spec/services/WebCallingService.ts +7 -1
  294. package/test/unit/spec/services/WebexCrossClientService.ts +261 -0
  295. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +113 -0
  296. package/test/unit/spec/services/config/Util.ts +85 -0
  297. package/test/unit/spec/services/config/index.ts +85 -29
  298. package/test/unit/spec/services/core/Utils.ts +481 -2
  299. package/test/unit/spec/services/core/WebexRequest.ts +3 -1
  300. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  301. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
  302. package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
  303. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  304. package/test/unit/spec/services/task/Task.ts +677 -0
  305. package/test/unit/spec/services/task/TaskFactory.ts +99 -0
  306. package/test/unit/spec/services/task/TaskManager.ts +2209 -918
  307. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  308. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  309. package/test/unit/spec/services/task/contact.ts +33 -0
  310. package/test/unit/spec/services/task/dialer.ts +372 -96
  311. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  312. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +3433 -0
  313. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  314. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  315. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  316. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  317. package/test/unit/spec/services/task/voice/Voice.ts +1523 -0
  318. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  319. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +459 -0
  320. package/umd/contact-center.min.js +2 -2
  321. package/umd/contact-center.min.js.map +1 -1
  322. package/dist/services/task/index.js +0 -1525
  323. package/dist/services/task/index.js.map +0 -1
  324. package/src/services/task/index.ts +0 -1801
  325. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -1,7 +1,9 @@
1
- import {CallId} from '@webex/calling/dist/types/common/types';
2
- import EventEmitter from 'events';
1
+ /* eslint-disable import/no-cycle */
2
+ import type {AnyActorRef} from 'xstate';
3
+ import {TaskEventPayload} from './state-machine';
3
4
  import {Msg} from '../core/GlobalTypes';
4
5
  import AutoWrapup from './AutoWrapup';
6
+ import type {CollaborationAccess} from '../config/types';
5
7
 
6
8
  /**
7
9
  * Unique identifier for a task in the contact center system
@@ -9,6 +11,11 @@ import AutoWrapup from './AutoWrapup';
9
11
  */
10
12
  export type TaskId = string;
11
13
 
14
+ /**
15
+ * Unique identifier for a call in the Webex calling system
16
+ */
17
+ export type CallId = string;
18
+
12
19
  /**
13
20
  * Helper type for creating enum-like objects with type safety
14
21
  * @internal
@@ -27,7 +34,7 @@ export const DESTINATION_TYPE = {
27
34
  DIALNUMBER: 'dialNumber',
28
35
  /** Route task to a specific agent */
29
36
  AGENT: 'agent',
30
- /** Route task to an entry point (supported only for consult operations) */
37
+ /** Route task to an entry point */
31
38
  ENTRYPOINT: 'entryPoint',
32
39
  };
33
40
 
@@ -61,6 +68,17 @@ export const CONSULT_TRANSFER_DESTINATION_TYPE = {
61
68
  */
62
69
  export type ConsultTransferDestinationType = Enum<typeof CONSULT_TRANSFER_DESTINATION_TYPE>;
63
70
 
71
+ /**
72
+ * Agent-profile policy used by the task state machine to derive consult/transfer destinations.
73
+ * @internal
74
+ */
75
+ export type ConsultTransferDestinationConfig = {
76
+ allowConsultToQueue: boolean;
77
+ accessQueue?: CollaborationAccess;
78
+ accessEntryPoint?: CollaborationAccess;
79
+ accessBuddyTeam?: CollaborationAccess;
80
+ };
81
+
64
82
  /**
65
83
  * Defines all supported media channel types for customer interactions
66
84
  * These represent the different ways customers can communicate with agents
@@ -90,6 +108,26 @@ export const MEDIA_CHANNEL = {
90
108
  */
91
109
  export type MEDIA_CHANNEL = Enum<typeof MEDIA_CHANNEL>;
92
110
 
111
+ /**
112
+ * Supported task channel types for UI control configuration
113
+ */
114
+ export const TASK_CHANNEL_TYPE = {
115
+ VOICE: 'voice',
116
+ DIGITAL: 'digital',
117
+ } as const;
118
+
119
+ export type TaskChannelType = Enum<typeof TASK_CHANNEL_TYPE>;
120
+
121
+ /**
122
+ * Voice channel variants that toggle PSTN/WebRTC specific behaviors
123
+ */
124
+ export const VOICE_VARIANT = {
125
+ PSTN: 'pstn',
126
+ WEBRTC: 'webrtc',
127
+ } as const;
128
+
129
+ export type VoiceVariant = Enum<typeof VOICE_VARIANT>;
130
+
93
131
  /**
94
132
  * Enumeration of all task-related events that can occur in the contact center system
95
133
  * These events represent different states and actions in the task lifecycle
@@ -203,6 +241,16 @@ export enum TASK_EVENTS {
203
241
  */
204
242
  TASK_CONSULT_QUEUE_FAILED = 'task:consultQueueFailed',
205
243
 
244
+ /**
245
+ * Triggered whenever task UI controls are recalculated
246
+ */
247
+ TASK_UI_CONTROLS_UPDATED = 'task:ui-controls-updated',
248
+
249
+ /**
250
+ * Triggered when wxApp mute state changes from Webex App (Mercury sync or call details).
251
+ */
252
+ TASK_WXAPP_MUTE_STATE_UPDATED = 'task:wxapp-mute-state-updated',
253
+
206
254
  /**
207
255
  * Triggered when a consultation request is accepted
208
256
  * @example
@@ -287,6 +335,24 @@ export enum TASK_EVENTS {
287
335
  */
288
336
  TASK_WRAPPEDUP = 'task:wrappedup',
289
337
 
338
+ /**
339
+ * Triggered when the task state machine reaches a final state and resources should be cleaned up.
340
+ * Used internally by TaskManager to perform collection/call cleanup.
341
+ * @internal
342
+ */
343
+ TASK_CLEANUP = 'task:cleanup',
344
+
345
+ /**
346
+ * Triggered when recording is started
347
+ * @example
348
+ * ```typescript
349
+ * task.on(TASK_EVENTS.TASK_RECORDING_STARTED, (task: ITask) => {
350
+ * console.log('Recording started:', task.data.interactionId);
351
+ * });
352
+ * ```
353
+ */
354
+ TASK_RECORDING_STARTED = 'task:recordingStarted',
355
+
290
356
  /**
291
357
  * Triggered when recording is paused
292
358
  * @example
@@ -519,6 +585,43 @@ export enum TASK_EVENTS {
519
585
  */
520
586
  TASK_PARTICIPANT_LEFT_FAILED = 'task:participantLeftFailed',
521
587
 
588
+ /**
589
+ * Triggered when agent initiates exit from conference
590
+ * @example
591
+ * ```typescript
592
+ * task.on(TASK_EVENTS.TASK_EXIT_CONFERENCE, (task: ITask) => {
593
+ * console.log('Exiting conference:', task.data.interactionId);
594
+ * // Handle conference exit initiation
595
+ * });
596
+ * ```
597
+ */
598
+ TASK_EXIT_CONFERENCE = 'task:exitConference',
599
+
600
+ /**
601
+ * Triggered when agent initiates conference transfer
602
+ * @example
603
+ * ```typescript
604
+ * task.on(TASK_EVENTS.TASK_TRANSFER_CONFERENCE, (task: ITask) => {
605
+ * console.log('Transferring conference:', task.data.interactionId);
606
+ * // Handle conference transfer initiation
607
+ * });
608
+ * ```
609
+ */
610
+ TASK_TRANSFER_CONFERENCE = 'task:transferConference',
611
+
612
+ /**
613
+ * Triggered when agent switches between consult call and main call.
614
+ * Use task.uiControls to determine current state and button visibility.
615
+ * @example
616
+ * ```typescript
617
+ * task.on(TASK_EVENTS.TASK_SWITCH_CALL, (task: ITask) => {
618
+ * console.log('Call switched:', task.data.interactionId);
619
+ * // Update UI based on task.uiControls.main.switch / task.uiControls.consult.switch
620
+ * });
621
+ * ```
622
+ */
623
+ TASK_SWITCH_CALL = 'task:switchCall',
624
+
522
625
  /**
523
626
  * Triggered when a contact is merged
524
627
  * @example
@@ -542,6 +645,77 @@ export enum TASK_EVENTS {
542
645
  * ```
543
646
  */
544
647
  TASK_POST_CALL_ACTIVITY = 'task:postCallActivity',
648
+
649
+ /**
650
+ * Triggered when a multi-login task update should hydrate SDK instances without Mobius registration.
651
+ * @example
652
+ * ```typescript
653
+ * task.on(TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, (task: ITask) => {
654
+ * console.log('Multi-login hydrate:', task.data.interactionId);
655
+ * });
656
+ * ```
657
+ */
658
+ TASK_MULTI_LOGIN_HYDRATE = 'task:multiLoginHydrate',
659
+
660
+ /**
661
+ * Triggered when a campaign preview contact is offered to the agent
662
+ * @example
663
+ * ```typescript
664
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, (data: AgentContact) => {
665
+ * console.log('Campaign preview contact received:', data.interactionId);
666
+ * // Handle campaign preview reservation
667
+ * });
668
+ * ```
669
+ */
670
+ TASK_CAMPAIGN_PREVIEW_RESERVATION = 'task:campaignPreviewReservation',
671
+
672
+ /**
673
+ * Triggered when accepting a campaign preview contact fails
674
+ * @example
675
+ * ```typescript
676
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_ACCEPT_FAILED, (task: ITask) => {
677
+ * console.log('Campaign preview accept failed:', task.data.interactionId);
678
+ * // Handle accept failure
679
+ * });
680
+ * ```
681
+ */
682
+ TASK_CAMPAIGN_PREVIEW_ACCEPT_FAILED = 'task:campaignPreviewAcceptFailed',
683
+
684
+ /**
685
+ * Triggered when skipping a campaign preview contact fails
686
+ * @example
687
+ * ```typescript
688
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_SKIP_FAILED, (task: ITask) => {
689
+ * console.log('Campaign preview skip failed:', task.data.interactionId);
690
+ * // Handle skip failure
691
+ * });
692
+ * ```
693
+ */
694
+ TASK_CAMPAIGN_PREVIEW_SKIP_FAILED = 'task:campaignPreviewSkipFailed',
695
+
696
+ /**
697
+ * Triggered when removing a campaign preview contact fails
698
+ * @example
699
+ * ```typescript
700
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_REMOVE_FAILED, (task: ITask) => {
701
+ * console.log('Campaign preview remove failed:', task.data.interactionId);
702
+ * // Handle remove failure
703
+ * });
704
+ * ```
705
+ */
706
+ TASK_CAMPAIGN_PREVIEW_REMOVE_FAILED = 'task:campaignPreviewRemoveFailed',
707
+
708
+ /**
709
+ * Triggered when a campaign contact is updated (e.g., after skip or remove, when the next contact is offered)
710
+ * @example
711
+ * ```typescript
712
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_CONTACT_UPDATED, (task: ITask) => {
713
+ * console.log('Campaign contact updated:', task.data.interactionId);
714
+ * // Handle updated campaign contact (e.g., display next contact)
715
+ * });
716
+ * ```
717
+ */
718
+ TASK_CAMPAIGN_CONTACT_UPDATED = 'task:campaignContactUpdated',
545
719
  }
546
720
 
547
721
  /**
@@ -549,6 +723,146 @@ export enum TASK_EVENTS {
549
723
  * Contains comprehensive details about an ongoing customer interaction
550
724
  * @public
551
725
  */
726
+ export interface CallAssociatedDatum {
727
+ /** Whether the field can be edited by the agent */
728
+ agentEditable: boolean;
729
+ /** Whether the field is visible to the agent */
730
+ agentViewable: boolean;
731
+ /** Display name for the field */
732
+ displayName: string;
733
+ /** Whether the field is global */
734
+ global: boolean;
735
+ /** Whether the field is secure */
736
+ isSecure: boolean;
737
+ /** Internal field name */
738
+ name: string;
739
+ /** Whether the field is reportable */
740
+ reportable: boolean;
741
+ /** Secure key identifier */
742
+ secureKeyId: string;
743
+ /** Secure key version */
744
+ secureKeyVersion: number;
745
+ /** Data type of the field */
746
+ type: string;
747
+ /** Field value */
748
+ value: string;
749
+ }
750
+
751
+ export type CallAssociatedData = Record<string, CallAssociatedDatum>;
752
+
753
+ export type CallAssociatedDetails = Record<string, string>;
754
+
755
+ export interface FlowParameter {
756
+ /** Parameter name */
757
+ name?: string;
758
+ /** Additional qualifier */
759
+ qualifier?: string;
760
+ /** Description of the parameter */
761
+ description?: string;
762
+ /** Data type of the value */
763
+ valueDataType?: string;
764
+ /** Value associated with the parameter */
765
+ value?: string;
766
+ }
767
+
768
+ export interface InteractionParticipant {
769
+ /** Unique participant identifier */
770
+ id: string;
771
+ /** Participant type label used by backend */
772
+ pType: string;
773
+ /** Friendly participant type */
774
+ type: string;
775
+ /** Whether the participant has joined */
776
+ hasJoined: boolean;
777
+ /** Whether the participant has left */
778
+ hasLeft: boolean;
779
+ /** Whether the participant is still in pre-dial */
780
+ isInPredial: boolean;
781
+ /** Optional caller identifier */
782
+ callerId?: string | null;
783
+ /** Whether auto-answer is enabled */
784
+ autoAnswerEnabled?: boolean;
785
+ /** Backchannel/bnr details */
786
+ bnrDetails?: unknown;
787
+ /** Channel identifier for the participant */
788
+ channelId?: string;
789
+ /** Current consult state */
790
+ consultState?: string | null;
791
+ /** Timestamp when consult started */
792
+ consultTimestamp?: number | null;
793
+ /** Current participant state */
794
+ currentState?: string | null;
795
+ /** Timestamp of the current state */
796
+ currentStateTimestamp?: number | null;
797
+ /** Device call identifier */
798
+ deviceCallId?: string | null;
799
+ /** Device identifier */
800
+ deviceId?: string | null;
801
+ /** Device type (AGENT_DN, BROWSER, etc.) */
802
+ deviceType?: string | null;
803
+ /** Dial number associated with participant */
804
+ dn?: string | null;
805
+ /** Whether participant is currently consulted */
806
+ isConsulted?: boolean;
807
+ /** Whether participant offer is active */
808
+ isOffered?: boolean;
809
+ /** Whether participant is in wrap-up */
810
+ isWrapUp?: boolean;
811
+ /** Whether participant completed wrap-up */
812
+ isWrappedUp?: boolean;
813
+ /** Timestamp of when participant joined */
814
+ joinTimestamp?: number | null;
815
+ /** Last updated timestamp */
816
+ lastUpdated?: number | null;
817
+ /** Friendly name of participant */
818
+ name?: string | null;
819
+ /** Queue identifier associated with participant */
820
+ queueId?: string;
821
+ /** Queue manager identifier */
822
+ queueMgrId?: string;
823
+ /** Session identifier */
824
+ sessionId?: string;
825
+ /** Site identifier */
826
+ siteId?: string;
827
+ /** Skill identifier */
828
+ skillId?: string | null;
829
+ /** Skill name */
830
+ skillName?: string | null;
831
+ /** Skill list for participant */
832
+ skills?: string[];
833
+ /** Team identifier */
834
+ teamId?: string;
835
+ /** Team name */
836
+ teamName?: string;
837
+ /** Timestamp for wrap-up */
838
+ wrapUpTimestamp?: number | null;
839
+ /** Additional metadata */
840
+ [key: string]: unknown;
841
+ }
842
+
843
+ export type InteractionParticipants = Record<string, InteractionParticipant>;
844
+
845
+ /**
846
+ * Media entry type from interaction.media
847
+ * Used for media state tracking in consult and conference scenarios
848
+ */
849
+ export type MediaEntry = {
850
+ /** Unique identifier for the media resource */
851
+ mediaResourceId: string;
852
+ /** Type of media channel */
853
+ mediaType: MEDIA_CHANNEL;
854
+ /** Media manager handling this media */
855
+ mediaMgr: string;
856
+ /** List of participant identifiers */
857
+ participants: string[];
858
+ /** Type of media (e.g., 'mainCall', 'consult') */
859
+ mType: string;
860
+ /** Indicates if media is on hold */
861
+ isHold: boolean;
862
+ /** Timestamp when media was put on hold */
863
+ holdTimestamp: number | null;
864
+ };
865
+
552
866
  export type Interaction = {
553
867
  /** Indicates if the interaction is managed by Flow Control */
554
868
  isFcManaged: boolean;
@@ -563,7 +877,11 @@ export type Interaction = {
563
877
  /** Current virtual team handling the interaction */
564
878
  currentVTeam: string;
565
879
  /** List of participants in the interaction */
566
- participants: any; // TODO: Define specific participant type
880
+ participants: InteractionParticipants;
881
+ /** Detailed call associated data */
882
+ callAssociatedData?: CallAssociatedData;
883
+ /** Simplified call associated key/value pairs */
884
+ callAssociatedDetails?: CallAssociatedDetails;
567
885
  /** Unique identifier for the interaction */
568
886
  interactionId: string;
569
887
  /** Organization identifier */
@@ -572,7 +890,18 @@ export type Interaction = {
572
890
  createdTimestamp?: number;
573
891
  /** Indicates if wrap-up assistance is enabled */
574
892
  isWrapUpAssist?: boolean;
575
- /** Detailed call processing information and metadata */
893
+ /** Identifier of parent interaction if applicable */
894
+ parentInteractionId?: string;
895
+ /** Indicates if media is forked for this interaction */
896
+ isMediaForked?: boolean;
897
+ /** Retroactive flow properties returned by backend */
898
+ flowProperties?: Record<string, unknown> | null;
899
+ /** Media specific properties returned by backend */
900
+ mediaProperties?: Record<string, unknown> | null;
901
+ /**
902
+ * Detailed call processing information and metadata.
903
+ * Mirrors the callProcessingDetails section described in Webex Contact Center Agent Contact payloads.
904
+ */
576
905
  callProcessingDetails: {
577
906
  /** Name of the Queue Manager handling this interaction */
578
907
  QMgrName: string;
@@ -590,20 +919,24 @@ export type Interaction = {
590
919
  QueueId: string;
591
920
  /** Virtual team identifier */
592
921
  vteamId: string;
593
- /** Indicates if pause/resume functionality is enabled */
594
- pauseResumeEnabled?: string;
922
+ /** Agent capability for pause/resume on this interaction */
923
+ pauseResumeEnabled?: boolean;
595
924
  /** Duration of pause in seconds */
596
925
  pauseDuration?: string;
597
- /** Indicates if the interaction is currently paused */
598
- isPaused?: string;
599
- /** Indicates if recording is in progress */
600
- recordInProgress?: string;
601
- /** Indicates if recording has started */
602
- recordingStarted?: string;
926
+ /** Legacy pause indicator (recordInProgress=false is the active pause signal) */
927
+ isPaused?: boolean;
928
+ /** Recording is actively capturing audio right now */
929
+ recordInProgress?: boolean;
930
+ /** Recording was started for this interaction (may be paused) */
931
+ recordingStarted?: boolean;
932
+ /** Customer geographic region */
933
+ customerRegion?: string;
934
+ /** Flow tag identifier */
935
+ flowTagId?: string;
603
936
  /** Indicates if Consult to Queue is in progress */
604
- ctqInProgress?: string;
937
+ ctqInProgress?: boolean;
605
938
  /** Indicates if outdial transfer to queue is enabled */
606
- outdialTransferToQueueEnabled?: string;
939
+ outdialTransferToQueueEnabled?: boolean;
607
940
  /** IVR conversation transcript */
608
941
  convIvrTranscript?: string;
609
942
  /** Customer's name */
@@ -690,64 +1023,67 @@ export type Interaction = {
690
1023
  fcDesktopView?: string;
691
1024
  /** Agent ID who initiated the outdial call */
692
1025
  outdialAgentId?: string;
1026
+ /** Indicates if the customer has left the call during an active consult */
1027
+ hasCustomerLeft?: string;
1028
+ /** Indicates if the skip action is disabled for campaign preview contacts */
1029
+ campaignPreviewSkipDisabled?: string;
1030
+ /** Indicates if the remove action is disabled for campaign preview contacts */
1031
+ campaignPreviewRemoveDisabled?: string;
1032
+ /** Auto-action to perform when campaign preview offer times out (ACCEPT, SKIP, REMOVE) */
1033
+ campaignPreviewAutoAction?: string;
1034
+ /** Timestamp (ms) when the campaign preview offer expires */
1035
+ campaignPreviewOfferTimeout?: string;
693
1036
  };
694
1037
  /** Main interaction identifier for related interactions */
695
1038
  mainInteractionId?: string;
1039
+ /** Timestamp when interaction entered queue */
1040
+ queuedTimestamp?: number | null;
696
1041
  /** Media-specific information for the interaction */
697
- media: Record<
698
- string,
699
- {
700
- /** Unique identifier for the media resource */
701
- mediaResourceId: string;
702
- /** Type of media channel */
703
- mediaType: MEDIA_CHANNEL;
704
- /** Media manager handling this media */
705
- mediaMgr: string;
706
- /** List of participant identifiers */
707
- participants: string[];
708
- /** Type of media */
709
- mType: string;
710
- /** Indicates if media is on hold */
711
- isHold: boolean;
712
- /** Timestamp when media was put on hold */
713
- holdTimestamp: number | null;
714
- }
715
- >;
1042
+ media: Record<string, MediaEntry>;
716
1043
  /** Owner of the interaction */
717
1044
  owner: string;
718
1045
  /** Primary media channel for the interaction */
719
- mediaChannel: MEDIA_CHANNEL;
1046
+ mediaChannel: string;
720
1047
  /** Direction information for the contact */
721
1048
  contactDirection: {type: string};
722
1049
  /** Type of outbound interaction */
723
1050
  outboundType?: string;
1051
+ /** Optional workflow manager identifier */
1052
+ workflowManager?: string | null;
724
1053
  /** Parameters passed through the call flow */
725
- callFlowParams: Record<
726
- string,
727
- {
728
- /** Name of the parameter */
729
- name: string;
730
- /** Qualifier for the parameter */
731
- qualifier: string;
732
- /** Description of the parameter */
733
- description: string;
734
- /** Data type of the parameter value */
735
- valueDataType: string;
736
- /** Value of the parameter */
737
- value: string;
738
- }
739
- >;
1054
+ callFlowParams?: Record<string, FlowParameter>;
740
1055
  };
741
1056
 
742
1057
  /**
743
- * Task payload containing detailed information about a contact center task
744
- * This structure encapsulates all relevant data for task management
1058
+ * Task payload mirroring the Agent Contact event payload from Webex Contact Center
1059
+ * (developer.webex.com). Arrives on AGENT_* websocket events and is the source of truth
1060
+ * for UI/state machine updates.
745
1061
  * @public
746
1062
  */
1063
+ export type RealtimeTranscription = {
1064
+ agentId: string;
1065
+ orgId: string;
1066
+ notifType: string;
1067
+ notifDetails: {
1068
+ actionEvent: string;
1069
+ };
1070
+ data: {
1071
+ role: 'AGENT' | 'CALLER';
1072
+ utteranceId: string;
1073
+ conversationId: string;
1074
+ publishTimestamp: number;
1075
+ messageId: string;
1076
+ isFinal: boolean;
1077
+ languageCode: string;
1078
+ orgId: string;
1079
+ content: string;
1080
+ };
1081
+ };
1082
+
747
1083
  export type TaskData = {
748
- /** Unique identifier for the media resource handling this task */
1084
+ /** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
749
1085
  mediaResourceId: string;
750
- /** Type of event that triggered this task data */
1086
+ /** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
751
1087
  eventType: string;
752
1088
  /** Timestamp when the event occurred */
753
1089
  eventTime?: number;
@@ -757,7 +1093,7 @@ export type TaskData = {
757
1093
  destAgentId: string;
758
1094
  /** Unique tracking identifier for the task */
759
1095
  trackingId: string;
760
- /** Media resource identifier for consultation operations */
1096
+ /** Media resource identifier for consultation leg when present */
761
1097
  consultMediaResourceId: string;
762
1098
  /** Detailed interaction information */
763
1099
  interaction: Interaction;
@@ -769,7 +1105,7 @@ export type TaskData = {
769
1105
  toOwner?: boolean;
770
1106
  /** Identifier for child interaction in consult/transfer scenarios */
771
1107
  childInteractionId?: string;
772
- /** Unique identifier for the interaction */
1108
+ /** Interaction/contact identifier from backend (same as interaction.interactionId) */
773
1109
  interactionId: string;
774
1110
  /** Organization identifier */
775
1111
  orgId: string;
@@ -779,7 +1115,7 @@ export type TaskData = {
779
1115
  queueMgr: string;
780
1116
  /** Name of the queue where task is queued */
781
1117
  queueName?: string;
782
- /** Type of the task */
1118
+ /** Task/interaction type returned by the platform (routing/monitoring/etc.) */
783
1119
  type: string;
784
1120
  /** Timeout value for RONA (Redirection on No Answer) in seconds */
785
1121
  ronaTimeout?: number;
@@ -815,12 +1151,130 @@ export type TaskData = {
815
1151
  reservedAgentChannelId?: string;
816
1152
  /** Indicates if wrap-up is required for this task */
817
1153
  wrapUpRequired?: boolean;
1154
+ /** SDK-internal: skip task:outdialFailed when non-wxApp agent-terminated outdial still needs wrapup */
1155
+ suppressOutdialFailedPopup?: boolean;
1156
+
1157
+ /**
1158
+ * Current consultation status derived from state machine
1159
+ * Values: CONSULT_INITIATED, CONSULT_ACCEPTED, BEING_CONSULTED,
1160
+ * BEING_CONSULTED_ACCEPTED, CONNECTED, CONFERENCE, CONSULT_COMPLETED
1161
+ */
1162
+ consultStatus?: string;
1163
+
1164
+ /**
1165
+ * Indicates if consultation is in progress (state machine: CONSULTING)
1166
+ */
1167
+ isConsultInProgress?: boolean;
1168
+
1169
+ /**
1170
+ * Indicates if the task is incoming for the active agent
1171
+ */
1172
+ isIncomingTask?: boolean;
1173
+
1174
+ /**
1175
+ * Indicates if the task is on hold (state machine: HELD)
1176
+ */
1177
+ isOnHold?: boolean;
1178
+
1179
+ /**
1180
+ * Indicates if customer is currently in the call
1181
+ * Derived from participants in main media
1182
+ */
1183
+ isCustomerInCall?: boolean;
1184
+
1185
+ /**
1186
+ * Count of conference participants (agents only)
1187
+ * Used for determining if max participants reached
1188
+ */
1189
+ conferenceParticipantsCount?: number;
1190
+
1191
+ /**
1192
+ * Indicates if this is a secondary agent (consulted party)
1193
+ */
1194
+ isSecondaryAgent?: boolean;
1195
+
1196
+ /**
1197
+ * Indicates if this is a secondary EP-DN agent (telephony consult to external)
1198
+ */
1199
+ isSecondaryEpDnAgent?: boolean;
1200
+
1201
+ /**
1202
+ * Task state for MPC (Multi-Party Conference) scenarios
1203
+ * Maps participant consultState to task state
1204
+ */
1205
+ mpcState?: string;
818
1206
  /** Indicates if auto-answer is in progress for this task */
819
1207
  isAutoAnswering?: boolean;
820
1208
  /** Indicates if wrap-up is required for this task */
821
1209
  agentsPendingWrapUp?: string[];
822
1210
  };
823
1211
 
1212
+ export type TaskUIControlState = {
1213
+ isVisible: boolean;
1214
+ isEnabled: boolean;
1215
+ };
1216
+
1217
+ /**
1218
+ * UI control representation for a single interaction leg.
1219
+ */
1220
+ export type InteractionUIControls = {
1221
+ accept: TaskUIControlState;
1222
+ decline: TaskUIControlState;
1223
+ hold: TaskUIControlState;
1224
+ transfer: TaskUIControlState;
1225
+ consult: TaskUIControlState;
1226
+ end: TaskUIControlState;
1227
+ recording: TaskUIControlState;
1228
+ mute: TaskUIControlState;
1229
+ consultTransfer: TaskUIControlState;
1230
+ endConsult: TaskUIControlState;
1231
+ conference: TaskUIControlState;
1232
+ exitConference: TaskUIControlState;
1233
+ transferConference: TaskUIControlState;
1234
+ mergeToConference: TaskUIControlState;
1235
+ wrapup: TaskUIControlState;
1236
+ switch: TaskUIControlState;
1237
+ keypad?: TaskUIControlState;
1238
+ };
1239
+
1240
+ /** Options for {@link ITask.toggleMute} — wxApp engaged calls use `muted` for target state. */
1241
+ export type TaskToggleMuteOptions = {
1242
+ muted?: boolean;
1243
+ lineOwnerId?: string;
1244
+ };
1245
+
1246
+ /** Options for {@link ITask.transmitDtmf} — wxApp engaged in-call DTMF. */
1247
+ export type TaskTransmitDtmfOptions = {
1248
+ dtmf: string;
1249
+ lineOwnerId?: string;
1250
+ };
1251
+
1252
+ export type TaskUILeg = 'main' | 'consult';
1253
+
1254
+ /**
1255
+ * UI controls surfaced to task consumers.
1256
+ * Consumers should read controls from the per-leg surfaces and use `activeLeg`
1257
+ * to determine which one is currently interactive.
1258
+ */
1259
+ export type TaskUIControls = {
1260
+ main: InteractionUIControls;
1261
+ consult: InteractionUIControls;
1262
+ activeLeg: TaskUILeg;
1263
+ /**
1264
+ * Ordered destination categories available for each action.
1265
+ * The first category is the default for consumers that render a destination picker.
1266
+ */
1267
+ consultTransferDestinations: {
1268
+ consult: ConsultTransferDestinationType[];
1269
+ transfer: ConsultTransferDestinationType[];
1270
+ };
1271
+ };
1272
+
1273
+ /**
1274
+ * Helper class for managing task action control state
1275
+ * Tracks visibility and enabled state for task actions that can be executed
1276
+ * @public
1277
+ */
824
1278
  /**
825
1279
  * Type representing an agent contact message within the contact center system
826
1280
  * Contains comprehensive interaction and task related details for agent operations
@@ -1042,6 +1496,15 @@ export type TransferPayload = {
1042
1496
  destinationType: DestinationType;
1043
1497
  };
1044
1498
 
1499
+ /**
1500
+ * Options for configuring transfer behavior
1501
+ * @public
1502
+ */
1503
+ export type TransferOptions = {
1504
+ /** Additional transfer configuration options */
1505
+ [key: string]: unknown;
1506
+ };
1507
+
1045
1508
  /**
1046
1509
  * API payload for ending a consultation
1047
1510
  * This is the actual payload that is sent to the developer API
@@ -1117,6 +1580,18 @@ export type DialerPayload = {
1117
1580
  origin: string;
1118
1581
  };
1119
1582
 
1583
+ /**
1584
+ * Payload for campaign preview contact operations (accept, skip, remove)
1585
+ * @public
1586
+ */
1587
+ export type PreviewContactPayload = {
1588
+ /** The interaction ID from the campaign reservation */
1589
+ interactionId: string;
1590
+ /** The campaign name (not a UUID). Available from the reservation event at
1591
+ * `task.data.interaction.callProcessingDetails.campaignId` or `task.data.campaignId`. */
1592
+ campaignId: string;
1593
+ };
1594
+
1120
1595
  /**
1121
1596
  * Data structure for cleaning up contact resources
1122
1597
  * @public
@@ -1151,6 +1626,41 @@ export type ContactCleanupData = {
1151
1626
  };
1152
1627
  };
1153
1628
 
1629
+ /**
1630
+ * Boolean-like fields in callProcessingDetails that may arrive as strings.
1631
+ * Used by taskDataNormalizer to coerce payloads to actual booleans.
1632
+ */
1633
+ export type CallProcessingBooleanKey =
1634
+ | 'recordingStarted'
1635
+ | 'recordInProgress'
1636
+ | 'isPaused'
1637
+ | 'pauseResumeEnabled'
1638
+ | 'ctqInProgress'
1639
+ | 'outdialTransferToQueueEnabled'
1640
+ | 'taskToBeSelfServiced'
1641
+ | 'CONTINUE_RECORDING_ON_TRANSFER'
1642
+ | 'isParked'
1643
+ | 'participantInviteTimeout'
1644
+ | 'checkAgentAvailability';
1645
+
1646
+ /**
1647
+ * Interaction-level boolean fields that may arrive as strings from backend payloads.
1648
+ */
1649
+ export type InteractionBooleanKey = 'isFcManaged' | 'isMediaForked' | 'isTerminated';
1650
+
1651
+ /**
1652
+ * Participant boolean fields that may arrive as strings and need normalization.
1653
+ */
1654
+ export type ParticipantBooleanKey =
1655
+ | 'autoAnswerEnabled'
1656
+ | 'hasJoined'
1657
+ | 'hasLeft'
1658
+ | 'isConsulted'
1659
+ | 'isInPredial'
1660
+ | 'isOffered'
1661
+ | 'isWrapUp'
1662
+ | 'isWrappedUp';
1663
+
1154
1664
  /**
1155
1665
  * Response type for task public methods
1156
1666
  * Can be an {@link AgentContact} object containing updated task state,
@@ -1159,11 +1669,47 @@ export type ContactCleanupData = {
1159
1669
  */
1160
1670
  export type TaskResponse = AgentContact | Error | void;
1161
1671
 
1672
+ /**
1673
+ * Request payload for removing a supported participant from an active conference.
1674
+ * @public
1675
+ */
1676
+ export type DropConferenceParticipantPayload = {
1677
+ /** Participant identifier supplied by the current task roster. */
1678
+ participantId: string;
1679
+ };
1680
+
1681
+ /**
1682
+ * Payload shape used by consult conference helper utilities.
1683
+ */
1684
+ export type consultConferencePayloadData = {
1685
+ agentId?: string;
1686
+ destinationType?: string;
1687
+ destAgentId?: string;
1688
+ };
1689
+
1690
+ /**
1691
+ * Minimal event-emitter contract exposed to SDK consumers.
1692
+ * Defined here so that consumers do NOT need `@types/node` in their tsconfig.
1693
+ * The runtime Task class still extends Node's EventEmitter (via ampersand-events),
1694
+ * which satisfies this interface at runtime.
1695
+ * @public
1696
+ */
1697
+ export interface IEventEmitter {
1698
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1699
+ on(event: string, listener: (...args: any[]) => void): this;
1700
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1701
+ off(event: string, listener: (...args: any[]) => void): this;
1702
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1703
+ once(event: string, listener: (...args: any[]) => void): this;
1704
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1705
+ emit(event: string, ...args: any[]): boolean;
1706
+ }
1707
+
1162
1708
  /**
1163
1709
  * Interface for managing task-related operations in the contact center
1164
- * Extends EventEmitter to support event-driven task updates
1710
+ * Extends IEventEmitter to support event-driven task updates
1165
1711
  */
1166
- export interface ITask extends EventEmitter {
1712
+ export interface ITask extends IEventEmitter {
1167
1713
  /**
1168
1714
  * Event data received in the Contact Center events.
1169
1715
  * Contains detailed task information including interaction details, media resources,
@@ -1183,6 +1729,59 @@ export interface ITask extends EventEmitter {
1183
1729
  */
1184
1730
  autoWrapup?: AutoWrapup;
1185
1731
 
1732
+ /**
1733
+ * Latest UI controls derived from the state machine.
1734
+ * Each control has `isVisible` and `isEnabled` flags computed from current task state.
1735
+ * Subscribe to {@link TASK_EVENTS.TASK_UI_CONTROLS_UPDATED} for change notifications.
1736
+ */
1737
+ readonly uiControls: TaskUIControls;
1738
+
1739
+ /**
1740
+ * Update wxApp thick-client answer flag at runtime.
1741
+ * Voice tasks override to refresh uiControls; other channel types no-op.
1742
+ * @internal
1743
+ */
1744
+ setEnableWxBetterTogether(enabled: boolean): void;
1745
+
1746
+ /**
1747
+ * Apply wxApp mute state from Mercury sync or call-details fetch.
1748
+ * @internal
1749
+ */
1750
+ applyWxAppMuteStateFromSync(incomingCallId: string, muted: boolean): void;
1751
+
1752
+ /**
1753
+ * Current wxApp mute state for engaged telephony (Voice tasks only).
1754
+ */
1755
+ getWxAppMuted?(): boolean;
1756
+
1757
+ /**
1758
+ * Re-seed wxApp mute from GET telephony/calls/{callId}. Resolves to muted state when known.
1759
+ */
1760
+ syncWxAppMuteFromCallDetails?(): Promise<boolean | undefined>;
1761
+
1762
+ /**
1763
+ * State machine instance for managing task state transitions and derived properties.
1764
+ * The state machine handles:
1765
+ * - State transitions (IDLE → OFFERED → CONNECTED → HELD, etc.)
1766
+ * - Derived properties (canHold, canResume, isConsulted, etc.)
1767
+ * - Action availability based on current state
1768
+ *
1769
+ * This is part of the migration from manual state management to centralized state machine.
1770
+ * During the transition period, both the old setUIControls() and state machine coexist.
1771
+ *
1772
+ * @see createTaskStateMachine
1773
+ * @internal
1774
+ */
1775
+ stateMachineService?: AnyActorRef;
1776
+ state?: any;
1777
+
1778
+ /**
1779
+ * Helper method to send events to the state machine.
1780
+ * This is part of the migration to XState.
1781
+ * @internal
1782
+ */
1783
+ sendStateMachineEvent: (event: TaskEventPayload) => void;
1784
+
1186
1785
  /**
1187
1786
  * Cancels the auto-wrapup timer for the task.
1188
1787
  * This method stops the auto-wrapup process if it is currently active.
@@ -1204,7 +1803,7 @@ export interface ITask extends EventEmitter {
1204
1803
  * @returns Updated task instance
1205
1804
  * @ignore
1206
1805
  */
1207
- updateTaskData(newData: TaskData): ITask;
1806
+ updateTaskData(newData: TaskData): void;
1208
1807
 
1209
1808
  /**
1210
1809
  * Answers or accepts an incoming task.
@@ -1336,28 +1935,29 @@ export interface ITask extends EventEmitter {
1336
1935
  * await task.transfer({ to: "queueId", destinationType: "queue" });
1337
1936
  * ```
1338
1937
  */
1339
- transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
1938
+ transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
1340
1939
 
1341
1940
  /**
1342
- * Transfers the task after consultation.
1343
- * @param consultTransferPayload - Details for consult transfer (optional)
1941
+ * Initiates a consult conference (merge consult call with main call).
1344
1942
  * @returns Promise<TaskResponse>
1345
1943
  * @example
1346
1944
  * ```typescript
1347
- * await task.consultTransfer({ to: "agentId", destinationType: "agent" });
1945
+ * await task.consultConference();
1348
1946
  * ```
1349
1947
  */
1350
- consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
1948
+ consultConference(): Promise<TaskResponse>;
1351
1949
 
1352
1950
  /**
1353
- * Initiates a consult conference (merge consult call with main call).
1951
+ * Removes a supported participant from the active conference.
1952
+ * Resolves after the correlated ParticipantLeftConference routing event.
1953
+ * @param payload - Participant identifier to remove
1354
1954
  * @returns Promise<TaskResponse>
1355
1955
  * @example
1356
1956
  * ```typescript
1357
- * await task.consultConference();
1957
+ * await task.dropConferenceParticipant({participantId: 'participant-id'});
1358
1958
  * ```
1359
1959
  */
1360
- consultConference(): Promise<TaskResponse>;
1960
+ dropConferenceParticipant(payload: DropConferenceParticipantPayload): Promise<TaskResponse>;
1361
1961
 
1362
1962
  /**
1363
1963
  * Exits from an ongoing conference.
@@ -1380,12 +1980,185 @@ export interface ITask extends EventEmitter {
1380
1980
  transferConference(): Promise<TaskResponse>;
1381
1981
 
1382
1982
  /**
1383
- * Toggles mute/unmute for the local audio stream during a WebRTC task.
1983
+ * Toggles between consult call and main call during consulting.
1984
+ * If on consult leg, switches to main call (holds consult).
1985
+ * If on main call, switches to consult (resumes consult).
1986
+ * Only available when in CONSULTING state.
1987
+ * @returns Promise<TaskResponse>
1988
+ * @example
1989
+ * ```typescript
1990
+ * await task.switchCall();
1991
+ * ```
1992
+ */
1993
+ switchCall(): Promise<TaskResponse>;
1994
+
1995
+ /**
1996
+ * Toggles mute/unmute for the active call.
1997
+ * WebRTC tasks toggle the local stream; wxApp engaged tasks route to telephony mute REST when
1998
+ * `enableWxBetterTogether` is active.
1999
+ * @param options - Optional target mute state (`muted`) for wxApp; ignored for WebRTC toggle.
1384
2000
  * @returns Promise<void>
1385
2001
  * @example
1386
2002
  * ```typescript
1387
2003
  * await task.toggleMute();
2004
+ * await task.toggleMute({ muted: true });
1388
2005
  * ```
1389
2006
  */
1390
- toggleMute(): Promise<void>;
2007
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
2008
+
2009
+ /**
2010
+ * Sends in-call DTMF tones for wxApp engaged telephony tasks when `enableWxBetterTogether` is active.
2011
+ * @param options - DTMF digit(s) and optional shared-line owner id.
2012
+ * @returns Promise<void>
2013
+ * @example
2014
+ * ```typescript
2015
+ * await task.transmitDtmf({ dtmf: '5' });
2016
+ * ```
2017
+ */
2018
+ transmitDtmf(options: TaskTransmitDtmfOptions): Promise<void>;
2019
+ }
2020
+
2021
+ /**
2022
+ * Interface for managing digital channel task operations in the contact center
2023
+ * Digital channels (chat, email, social, SMS) have a simpler interface than voice
2024
+ * Extends ITask but overrides updateTaskData to return IDigital
2025
+ * @public
2026
+ */
2027
+ export interface IDigital extends Omit<ITask, 'updateTaskData'> {
2028
+ /**
2029
+ * Updates the task data
2030
+ * @param newData - Updated task data
2031
+ * @param shouldOverwrite - Whether to completely replace existing data
2032
+ * @returns Updated Digital task instance
2033
+ */
2034
+ updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
2035
+ }
2036
+
2037
+ /**
2038
+ * Interface for managing voice/telephony task operations in the contact center
2039
+ * Extends ITask with voice-specific functionality for hold/resume operations
2040
+ * @public
2041
+ */
2042
+ export interface IVoice extends ITask {
2043
+ /**
2044
+ * Toggles hold/resume state for a voice task.
2045
+ * If the task is currently on hold, it will be resumed.
2046
+ * If the task is active, it will be placed on hold.
2047
+ * @returns Promise<TaskResponse>
2048
+ * @example
2049
+ * ```typescript
2050
+ * await voiceTask.holdResume();
2051
+ * ```
2052
+ */
2053
+ holdResume(): Promise<TaskResponse>;
2054
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2055
+ isWebexAppCallingOffer(): boolean;
2056
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2057
+ getCallingDeviceDetails(): import('./WebexCallingUtils').WebexCallingDeviceDetails | undefined;
2058
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2059
+ getWebexCallingCallId(): string | null;
2060
+ }
2061
+
2062
+ /**
2063
+ * Configuration options for voice task UI controls
2064
+ */
2065
+ export type VoiceUIControlOptions = {
2066
+ isEndTaskEnabled?: boolean;
2067
+ isEndConsultEnabled?: boolean;
2068
+ voiceVariant?: VoiceVariant;
2069
+ isRecordingEnabled?: boolean;
2070
+ enableWxBetterTogether?: boolean;
2071
+ consultTransferConfig?: ConsultTransferDestinationConfig;
2072
+ answerCallOnWebexService?: import('../AnswerCallOnWebexService').default;
2073
+ };
2074
+
2075
+ /**
2076
+ * Participant information for UI display
2077
+ */
2078
+ export type Participant = {
2079
+ id: string;
2080
+ name?: string;
2081
+ pType?: string;
2082
+ };
2083
+
2084
+ /**
2085
+ * @deprecated Use Participant instead
2086
+ */
2087
+ export type TaskAccessorParticipant = Participant;
2088
+
2089
+ export interface IWebRTC extends IVoice {
2090
+ /**
2091
+ * This method is used to mute/unmute the call.
2092
+ * @returns Promise<void>
2093
+ * @example
2094
+ * ```typescript
2095
+ * task.toggleMute();
2096
+ * ```
2097
+ */
2098
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
2099
+ /**
2100
+ * Decline the incoming task for Browser Login
2101
+ *
2102
+ * @example
2103
+ * ```
2104
+ * task.decline();
2105
+ * ```
2106
+ */
2107
+ decline(): Promise<TaskResponse>;
2108
+ /**
2109
+ * This method is used to unregister the web call listeners.
2110
+ * @returns void
2111
+ * @example
2112
+ * ```typescript
2113
+ * task.unregisterWebCallListeners();
2114
+ * ```
2115
+ */
2116
+ unregisterWebCallListeners(): void;
2117
+ }
2118
+
2119
+ export type WebSocketPayload = TaskData & {
2120
+ type: string;
2121
+ mediaResourceId?: string;
2122
+ reason?: string;
2123
+ /** ContactEnded: party that ended the contact (e.g. 'Agent', 'Customer') */
2124
+ terminatingParty?: string;
2125
+ /**
2126
+ * Optional real-time transcript chunk payload.
2127
+ * Present on REAL_TIME_TRANSCRIPTION notifications.
2128
+ */
2129
+ data?: RealtimeTranscription['data'];
2130
+ };
2131
+
2132
+ export type WebSocketMessage = {
2133
+ keepalive?: 'true' | 'false' | boolean;
2134
+ type?: string;
2135
+ data: WebSocketPayload;
2136
+ };
2137
+
2138
+ /**
2139
+ * Actions to be performed after handling an event
2140
+ *
2141
+ * These actions represent TaskManager-level concerns (task collection lifecycle,
2142
+ * resource cleanup) rather than task-level state machine concerns. The separation
2143
+ * ensures proper responsibility:
2144
+ * - TaskManager: Collection management, metrics, cleanup
2145
+ * - State Machine: Task state transitions, event emissions, UI controls
2146
+ */
2147
+ export interface TaskEventActions {
2148
+ task?: ITask;
2149
+ }
2150
+
2151
+ /**
2152
+ * Context for processing an event
2153
+ *
2154
+ * Contains all information needed to process a WebSocket event:
2155
+ * - Event type and payload from the backend
2156
+ * - Task instance (if exists)
2157
+ * - Pre-mapped state machine event (if applicable)
2158
+ */
2159
+ export interface EventContext {
2160
+ eventType: string;
2161
+ payload: WebSocketPayload;
2162
+ task?: ITask;
2163
+ stateMachineEvent?: TaskEventPayload | null;
1391
2164
  }