@webex/contact-center 3.12.0-next.16 → 3.12.0-next.161

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 (328) hide show
  1. package/.sdd/manifest.json +887 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +62 -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 +52 -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 +385 -0
  17. package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
  18. package/ai-docs/features/contact-owner-change-refactor.md +78 -0
  19. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  20. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  21. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  22. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  23. package/ai-docs/patterns/testing-patterns.md +480 -0
  24. package/ai-docs/patterns/typescript-patterns.md +365 -0
  25. package/ai-docs/templates/README.md +102 -0
  26. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  27. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  28. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  29. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  30. package/ai-docs/templates/new-method/00-master.md +80 -0
  31. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  32. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  33. package/ai-docs/templates/new-method/03-tests.md +201 -0
  34. package/ai-docs/templates/new-method/04-validation.md +141 -0
  35. package/ai-docs/templates/new-service/00-master.md +109 -0
  36. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  37. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  38. package/ai-docs/templates/new-service/03-integration.md +178 -0
  39. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  40. package/ai-docs/templates/new-service/05-validation.md +145 -0
  41. package/dist/cc.js +888 -49
  42. package/dist/cc.js.map +1 -1
  43. package/dist/config.js +13 -0
  44. package/dist/config.js.map +1 -1
  45. package/dist/constants.js +38 -3
  46. package/dist/constants.js.map +1 -1
  47. package/dist/index.js +54 -17
  48. package/dist/index.js.map +1 -1
  49. package/dist/metrics/MetricsManager.js +16 -0
  50. package/dist/metrics/MetricsManager.js.map +1 -1
  51. package/dist/metrics/behavioral-events.js +185 -0
  52. package/dist/metrics/behavioral-events.js.map +1 -1
  53. package/dist/metrics/constants.js +54 -4
  54. package/dist/metrics/constants.js.map +1 -1
  55. package/dist/services/AddressBook.js +18 -15
  56. package/dist/services/AddressBook.js.map +1 -1
  57. package/dist/services/AnswerCallOnWebexService.js +202 -0
  58. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  59. package/dist/services/ApiAiAssistant.js +369 -14
  60. package/dist/services/ApiAiAssistant.js.map +1 -1
  61. package/dist/services/EntryPoint.js +46 -68
  62. package/dist/services/EntryPoint.js.map +1 -1
  63. package/dist/services/Queue.js +27 -22
  64. package/dist/services/Queue.js.map +1 -1
  65. package/dist/services/UserPreference.js +427 -0
  66. package/dist/services/UserPreference.js.map +1 -0
  67. package/dist/services/WebCallingService.js +10 -2
  68. package/dist/services/WebCallingService.js.map +1 -1
  69. package/dist/services/WebexCrossClientService.js +225 -0
  70. package/dist/services/WebexCrossClientService.js.map +1 -0
  71. package/dist/services/WxAppTelephonyMercurySync.js +111 -0
  72. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  73. package/dist/services/config/Util.js +48 -48
  74. package/dist/services/config/Util.js.map +1 -1
  75. package/dist/services/config/constants.js +56 -78
  76. package/dist/services/config/constants.js.map +1 -1
  77. package/dist/services/config/index.js +100 -226
  78. package/dist/services/config/index.js.map +1 -1
  79. package/dist/services/config/types.js +93 -24
  80. package/dist/services/config/types.js.map +1 -1
  81. package/dist/services/constants.js +11 -1
  82. package/dist/services/constants.js.map +1 -1
  83. package/dist/services/core/Err.js.map +1 -1
  84. package/dist/services/core/Utils.js +131 -32
  85. package/dist/services/core/Utils.js.map +1 -1
  86. package/dist/services/core/WebexRequest.js +6 -2
  87. package/dist/services/core/WebexRequest.js.map +1 -1
  88. package/dist/services/core/aqm-reqs.js +17 -11
  89. package/dist/services/core/aqm-reqs.js.map +1 -1
  90. package/dist/services/core/constants.js +9 -1
  91. package/dist/services/core/constants.js.map +1 -1
  92. package/dist/services/core/types.js.map +1 -1
  93. package/dist/services/core/websocket/WebSocketManager.js +19 -2
  94. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  95. package/dist/services/core/websocket/types.js.map +1 -1
  96. package/dist/services/index.js +1 -1
  97. package/dist/services/index.js.map +1 -1
  98. package/dist/services/task/Task.js +955 -0
  99. package/dist/services/task/Task.js.map +1 -0
  100. package/dist/services/task/TaskFactory.js +50 -0
  101. package/dist/services/task/TaskFactory.js.map +1 -0
  102. package/dist/services/task/TaskManager.js +1272 -605
  103. package/dist/services/task/TaskManager.js.map +1 -1
  104. package/dist/services/task/TaskUtils.js +221 -27
  105. package/dist/services/task/TaskUtils.js.map +1 -1
  106. package/dist/services/task/WebexCallingUtils.js +70 -0
  107. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  108. package/dist/services/task/constants.js +19 -2
  109. package/dist/services/task/constants.js.map +1 -1
  110. package/dist/services/task/contact.js +29 -0
  111. package/dist/services/task/contact.js.map +1 -1
  112. package/dist/services/task/digital/Digital.js +78 -0
  113. package/dist/services/task/digital/Digital.js.map +1 -0
  114. package/dist/services/task/state-machine/TaskStateMachine.js +982 -0
  115. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  116. package/dist/services/task/state-machine/actions.js +572 -0
  117. package/dist/services/task/state-machine/actions.js.map +1 -0
  118. package/dist/services/task/state-machine/constants.js +161 -0
  119. package/dist/services/task/state-machine/constants.js.map +1 -0
  120. package/dist/services/task/state-machine/guards.js +379 -0
  121. package/dist/services/task/state-machine/guards.js.map +1 -0
  122. package/dist/services/task/state-machine/index.js +53 -0
  123. package/dist/services/task/state-machine/index.js.map +1 -0
  124. package/dist/services/task/state-machine/types.js +54 -0
  125. package/dist/services/task/state-machine/types.js.map +1 -0
  126. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  127. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  128. package/dist/services/task/taskDataNormalizer.js +99 -0
  129. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  130. package/dist/services/task/types.js +215 -5
  131. package/dist/services/task/types.js.map +1 -1
  132. package/dist/services/task/voice/Voice.js +1504 -0
  133. package/dist/services/task/voice/Voice.js.map +1 -0
  134. package/dist/services/task/voice/WebRTC.js +152 -0
  135. package/dist/services/task/voice/WebRTC.js.map +1 -0
  136. package/dist/services/task/voice/wxAppOfferObservability.js +145 -0
  137. package/dist/services/task/voice/wxAppOfferObservability.js.map +1 -0
  138. package/dist/services/task/voice/wxAppVoiceMethods.js +395 -0
  139. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  140. package/dist/services/wxAppDiagnosticLogging.js +159 -0
  141. package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
  142. package/dist/services/wxAppTelephonyUtils.js +19 -0
  143. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  144. package/dist/types/cc.d.ts +152 -9
  145. package/dist/types/config.d.ts +13 -0
  146. package/dist/types/constants.d.ts +36 -1
  147. package/dist/types/index.d.ts +54 -20
  148. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  149. package/dist/types/metrics/constants.d.ts +48 -1
  150. package/dist/types/services/AddressBook.d.ts +2 -1
  151. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  152. package/dist/types/services/ApiAiAssistant.d.ts +67 -5
  153. package/dist/types/services/EntryPoint.d.ts +7 -5
  154. package/dist/types/services/Queue.d.ts +5 -3
  155. package/dist/types/services/UserPreference.d.ts +118 -0
  156. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  157. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  158. package/dist/types/services/config/Util.d.ts +4 -8
  159. package/dist/types/services/config/constants.d.ts +49 -76
  160. package/dist/types/services/config/index.d.ts +16 -64
  161. package/dist/types/services/config/types.d.ts +240 -114
  162. package/dist/types/services/constants.d.ts +9 -0
  163. package/dist/types/services/core/Err.d.ts +2 -0
  164. package/dist/types/services/core/Utils.d.ts +43 -13
  165. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  166. package/dist/types/services/core/constants.d.ts +7 -0
  167. package/dist/types/services/core/types.d.ts +2 -0
  168. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  169. package/dist/types/services/core/websocket/types.d.ts +1 -1
  170. package/dist/types/services/index.d.ts +1 -1
  171. package/dist/types/services/task/Task.d.ts +186 -0
  172. package/dist/types/services/task/TaskFactory.d.ts +14 -0
  173. package/dist/types/services/task/TaskUtils.d.ts +54 -2
  174. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  175. package/dist/types/services/task/constants.d.ts +17 -0
  176. package/dist/types/services/task/contact.d.ts +4 -0
  177. package/dist/types/services/task/digital/Digital.d.ts +23 -0
  178. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1442 -0
  179. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  180. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  181. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  182. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  183. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  184. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  185. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  186. package/dist/types/services/task/types.d.ts +738 -66
  187. package/dist/types/services/task/voice/Voice.d.ts +241 -0
  188. package/dist/types/services/task/voice/WebRTC.d.ts +54 -0
  189. package/dist/types/services/task/voice/wxAppOfferObservability.d.ts +39 -0
  190. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +68 -0
  191. package/dist/types/services/wxAppDiagnosticLogging.d.ts +63 -0
  192. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  193. package/dist/types/types.d.ts +213 -11
  194. package/dist/types/utils/PageCache.d.ts +20 -3
  195. package/dist/types/webex.d.ts +1 -0
  196. package/dist/types.js +168 -6
  197. package/dist/types.js.map +1 -1
  198. package/dist/utils/PageCache.js +19 -5
  199. package/dist/utils/PageCache.js.map +1 -1
  200. package/dist/webex.js +22 -2
  201. package/dist/webex.js.map +1 -1
  202. package/package.json +16 -12
  203. package/src/cc.ts +1137 -67
  204. package/src/config.ts +13 -0
  205. package/src/constants.ts +39 -1
  206. package/src/index.ts +62 -15
  207. package/src/metrics/MetricsManager.ts +16 -0
  208. package/src/metrics/ai-docs/AGENTS.md +350 -0
  209. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  210. package/src/metrics/ai-docs/metrics-spec.md +971 -0
  211. package/src/metrics/behavioral-events.ts +190 -0
  212. package/src/metrics/constants.ts +59 -4
  213. package/src/services/AddressBook.ts +17 -6
  214. package/src/services/AnswerCallOnWebexService.ts +239 -0
  215. package/src/services/ApiAiAssistant.ts +494 -15
  216. package/src/services/EntryPoint.ts +59 -60
  217. package/src/services/Queue.ts +29 -12
  218. package/src/services/UserPreference.ts +509 -0
  219. package/src/services/WebCallingService.ts +16 -2
  220. package/src/services/WebexCrossClientService.ts +298 -0
  221. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  222. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  223. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  224. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  225. package/src/services/ai-docs/AGENTS.md +386 -0
  226. package/src/services/ai-docs/services-spec.md +512 -0
  227. package/src/services/config/Util.ts +54 -84
  228. package/src/services/config/ai-docs/AGENTS.md +250 -0
  229. package/src/services/config/ai-docs/ARCHITECTURE.md +413 -0
  230. package/src/services/config/ai-docs/config-spec.md +669 -0
  231. package/src/services/config/constants.ts +63 -85
  232. package/src/services/config/index.ts +116 -277
  233. package/src/services/config/types.ts +229 -125
  234. package/src/services/constants.ts +10 -0
  235. package/src/services/core/Err.ts +1 -0
  236. package/src/services/core/Utils.ts +151 -37
  237. package/src/services/core/WebexRequest.ts +3 -1
  238. package/src/services/core/ai-docs/AGENTS.md +381 -0
  239. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  240. package/src/services/core/ai-docs/core-spec.md +797 -0
  241. package/src/services/core/aqm-reqs.ts +18 -12
  242. package/src/services/core/constants.ts +8 -0
  243. package/src/services/core/types.ts +33 -1
  244. package/src/services/core/websocket/WebSocketManager.ts +28 -2
  245. package/src/services/core/websocket/types.ts +1 -1
  246. package/src/services/index.ts +1 -1
  247. package/src/services/task/Task.ts +1211 -0
  248. package/src/services/task/TaskFactory.ts +82 -0
  249. package/src/services/task/TaskManager.ts +1585 -724
  250. package/src/services/task/TaskUtils.ts +316 -25
  251. package/src/services/task/WebexCallingUtils.ts +136 -0
  252. package/src/services/task/ai-docs/AGENTS.md +457 -0
  253. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  254. package/src/services/task/ai-docs/task-spec.md +1501 -0
  255. package/src/services/task/constants.ts +18 -0
  256. package/src/services/task/contact.ts +30 -0
  257. package/src/services/task/digital/Digital.ts +102 -0
  258. package/src/services/task/state-machine/TaskStateMachine.ts +1320 -0
  259. package/src/services/task/state-machine/actions.ts +741 -0
  260. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  261. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1156 -0
  262. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2247 -0
  263. package/src/services/task/state-machine/constants.ts +172 -0
  264. package/src/services/task/state-machine/guards.ts +442 -0
  265. package/src/services/task/state-machine/index.ts +28 -0
  266. package/src/services/task/state-machine/types.ts +258 -0
  267. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  268. package/src/services/task/taskDataNormalizer.ts +137 -0
  269. package/src/services/task/types.ts +918 -70
  270. package/src/services/task/voice/Voice.ts +1878 -0
  271. package/src/services/task/voice/WebRTC.ts +194 -0
  272. package/src/services/task/voice/wxAppOfferObservability.ts +204 -0
  273. package/src/services/task/voice/wxAppVoiceMethods.ts +575 -0
  274. package/src/services/wxAppDiagnosticLogging.ts +286 -0
  275. package/src/services/wxAppTelephonyUtils.ts +14 -0
  276. package/src/types.ts +272 -13
  277. package/src/utils/AGENTS.md +289 -0
  278. package/src/utils/PageCache.ts +38 -5
  279. package/src/utils/ai-docs/utils-spec.md +391 -0
  280. package/src/webex.js +10 -0
  281. package/test/unit/fixtures/aiSummaryTestUtils.ts +40 -0
  282. package/test/unit/spec/cc.ts +3553 -107
  283. package/test/unit/spec/index.ts +885 -0
  284. package/test/unit/spec/logger-proxy.ts +70 -0
  285. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  286. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  287. package/test/unit/spec/services/AddressBook.ts +37 -6
  288. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  289. package/test/unit/spec/services/ApiAiAssistant.ts +442 -23
  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 +45 -1
  294. package/test/unit/spec/services/WebexCrossClientService.ts +509 -0
  295. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  296. package/test/unit/spec/services/config/Util.ts +501 -0
  297. package/test/unit/spec/services/config/index.ts +317 -547
  298. package/test/unit/spec/services/core/Utils.ts +447 -8
  299. package/test/unit/spec/services/core/WebexRequest.ts +8 -7
  300. package/test/unit/spec/services/core/aqm-reqs.ts +142 -1
  301. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +129 -53
  302. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  303. package/test/unit/spec/services/task/Task.ts +2723 -0
  304. package/test/unit/spec/services/task/TaskFactory.ts +116 -0
  305. package/test/unit/spec/services/task/TaskManager.ts +4734 -1769
  306. package/test/unit/spec/services/task/TaskUtils.ts +307 -0
  307. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  308. package/test/unit/spec/services/task/contact.ts +33 -0
  309. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  310. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +4060 -0
  311. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  312. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  313. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  314. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  315. package/test/unit/spec/services/task/voice/Voice.ts +2355 -0
  316. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  317. package/test/unit/spec/services/task/voice/wxAppOfferObservability.ts +361 -0
  318. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +719 -0
  319. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +179 -0
  320. package/test/unit/spec/wellnessSampleUtils.ts +288 -0
  321. package/typedoc.md +1 -1
  322. package/umd/contact-center.min.js +2 -2
  323. package/umd/contact-center.min.js.map +1 -1
  324. package/dist/services/task/index.js +0 -1530
  325. package/dist/services/task/index.js.map +0 -1
  326. package/dist/types/services/task/index.d.ts +0 -650
  327. package/src/services/task/index.ts +0 -1806
  328. package/test/unit/spec/services/task/index.ts +0 -2205
@@ -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
@@ -543,6 +646,17 @@ export enum TASK_EVENTS {
543
646
  */
544
647
  TASK_POST_CALL_ACTIVITY = 'task:postCallActivity',
545
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
+
546
660
  /**
547
661
  * Triggered when a campaign preview contact is offered to the agent
548
662
  * @example
@@ -602,6 +716,27 @@ export enum TASK_EVENTS {
602
716
  * ```
603
717
  */
604
718
  TASK_CAMPAIGN_CONTACT_UPDATED = 'task:campaignContactUpdated',
719
+
720
+ /**
721
+ * Triggered when a mid-call summary is received for the task.
722
+ */
723
+ TASK_MID_CALL_SUMMARY_RECEIVED = 'task:midCallSummaryReceived',
724
+
725
+ /**
726
+ * Triggered on the task object when AI feature enablement flags arrive for that task's interaction.
727
+ * Fires immediately if the frame arrived after the task was registered, or at registration time
728
+ * if the frame arrived before the task (orphan retention). Consumers should use this event
729
+ * instead of the cc-level `FEATURE_ENABLEMENT` event so they do not need to maintain an
730
+ * interactionId → flags map manually.
731
+ * @example
732
+ * ```typescript
733
+ * task.on(TASK_EVENTS.TASK_FEATURE_ENABLEMENT, (enablement: AISummaryFeatureEnablement) => {
734
+ * const { midCallEnabled, postCallEnabled } = enablement;
735
+ * // gate summary UI on these flags
736
+ * });
737
+ * ```
738
+ */
739
+ TASK_FEATURE_ENABLEMENT = 'task:featureEnablement',
605
740
  }
606
741
 
607
742
  /**
@@ -609,6 +744,146 @@ export enum TASK_EVENTS {
609
744
  * Contains comprehensive details about an ongoing customer interaction
610
745
  * @public
611
746
  */
747
+ export interface CallAssociatedDatum {
748
+ /** Whether the field can be edited by the agent */
749
+ agentEditable: boolean;
750
+ /** Whether the field is visible to the agent */
751
+ agentViewable: boolean;
752
+ /** Display name for the field */
753
+ displayName: string;
754
+ /** Whether the field is global */
755
+ global: boolean;
756
+ /** Whether the field is secure */
757
+ isSecure: boolean;
758
+ /** Internal field name */
759
+ name: string;
760
+ /** Whether the field is reportable */
761
+ reportable: boolean;
762
+ /** Secure key identifier */
763
+ secureKeyId: string;
764
+ /** Secure key version */
765
+ secureKeyVersion: number;
766
+ /** Data type of the field */
767
+ type: string;
768
+ /** Field value */
769
+ value: string;
770
+ }
771
+
772
+ export type CallAssociatedData = Record<string, CallAssociatedDatum>;
773
+
774
+ export type CallAssociatedDetails = Record<string, string>;
775
+
776
+ export interface FlowParameter {
777
+ /** Parameter name */
778
+ name?: string;
779
+ /** Additional qualifier */
780
+ qualifier?: string;
781
+ /** Description of the parameter */
782
+ description?: string;
783
+ /** Data type of the value */
784
+ valueDataType?: string;
785
+ /** Value associated with the parameter */
786
+ value?: string;
787
+ }
788
+
789
+ export interface InteractionParticipant {
790
+ /** Unique participant identifier */
791
+ id: string;
792
+ /** Participant type label used by backend */
793
+ pType: string;
794
+ /** Friendly participant type */
795
+ type: string;
796
+ /** Whether the participant has joined */
797
+ hasJoined: boolean;
798
+ /** Whether the participant has left */
799
+ hasLeft: boolean;
800
+ /** Whether the participant is still in pre-dial */
801
+ isInPredial: boolean;
802
+ /** Optional caller identifier */
803
+ callerId?: string | null;
804
+ /** Whether auto-answer is enabled */
805
+ autoAnswerEnabled?: boolean;
806
+ /** Backchannel/bnr details */
807
+ bnrDetails?: unknown;
808
+ /** Channel identifier for the participant */
809
+ channelId?: string;
810
+ /** Current consult state */
811
+ consultState?: string | null;
812
+ /** Timestamp when consult started */
813
+ consultTimestamp?: number | null;
814
+ /** Current participant state */
815
+ currentState?: string | null;
816
+ /** Timestamp of the current state */
817
+ currentStateTimestamp?: number | null;
818
+ /** Device call identifier */
819
+ deviceCallId?: string | null;
820
+ /** Device identifier */
821
+ deviceId?: string | null;
822
+ /** Device type (AGENT_DN, BROWSER, etc.) */
823
+ deviceType?: string | null;
824
+ /** Dial number associated with participant */
825
+ dn?: string | null;
826
+ /** Whether participant is currently consulted */
827
+ isConsulted?: boolean;
828
+ /** Whether participant offer is active */
829
+ isOffered?: boolean;
830
+ /** Whether participant is in wrap-up */
831
+ isWrapUp?: boolean;
832
+ /** Whether participant completed wrap-up */
833
+ isWrappedUp?: boolean;
834
+ /** Timestamp of when participant joined */
835
+ joinTimestamp?: number | null;
836
+ /** Last updated timestamp */
837
+ lastUpdated?: number | null;
838
+ /** Friendly name of participant */
839
+ name?: string | null;
840
+ /** Queue identifier associated with participant */
841
+ queueId?: string;
842
+ /** Queue manager identifier */
843
+ queueMgrId?: string;
844
+ /** Session identifier */
845
+ sessionId?: string;
846
+ /** Site identifier */
847
+ siteId?: string;
848
+ /** Skill identifier */
849
+ skillId?: string | null;
850
+ /** Skill name */
851
+ skillName?: string | null;
852
+ /** Skill list for participant */
853
+ skills?: string[];
854
+ /** Team identifier */
855
+ teamId?: string;
856
+ /** Team name */
857
+ teamName?: string;
858
+ /** Timestamp for wrap-up */
859
+ wrapUpTimestamp?: number | null;
860
+ /** Additional metadata */
861
+ [key: string]: unknown;
862
+ }
863
+
864
+ export type InteractionParticipants = Record<string, InteractionParticipant>;
865
+
866
+ /**
867
+ * Media entry type from interaction.media
868
+ * Used for media state tracking in consult and conference scenarios
869
+ */
870
+ export type MediaEntry = {
871
+ /** Unique identifier for the media resource */
872
+ mediaResourceId: string;
873
+ /** Type of media channel */
874
+ mediaType: MEDIA_CHANNEL;
875
+ /** Media manager handling this media */
876
+ mediaMgr: string;
877
+ /** List of participant identifiers */
878
+ participants: string[];
879
+ /** Type of media (e.g., 'mainCall', 'consult') */
880
+ mType: string;
881
+ /** Indicates if media is on hold */
882
+ isHold: boolean;
883
+ /** Timestamp when media was put on hold */
884
+ holdTimestamp: number | null;
885
+ };
886
+
612
887
  export type Interaction = {
613
888
  /** Indicates if the interaction is managed by Flow Control */
614
889
  isFcManaged: boolean;
@@ -623,7 +898,11 @@ export type Interaction = {
623
898
  /** Current virtual team handling the interaction */
624
899
  currentVTeam: string;
625
900
  /** List of participants in the interaction */
626
- participants: any; // TODO: Define specific participant type
901
+ participants: InteractionParticipants;
902
+ /** Detailed call associated data */
903
+ callAssociatedData?: CallAssociatedData;
904
+ /** Simplified call associated key/value pairs */
905
+ callAssociatedDetails?: CallAssociatedDetails;
627
906
  /** Unique identifier for the interaction */
628
907
  interactionId: string;
629
908
  /** Organization identifier */
@@ -632,7 +911,18 @@ export type Interaction = {
632
911
  createdTimestamp?: number;
633
912
  /** Indicates if wrap-up assistance is enabled */
634
913
  isWrapUpAssist?: boolean;
635
- /** Detailed call processing information and metadata */
914
+ /** Identifier of parent interaction if applicable */
915
+ parentInteractionId?: string;
916
+ /** Indicates if media is forked for this interaction */
917
+ isMediaForked?: boolean;
918
+ /** Retroactive flow properties returned by backend */
919
+ flowProperties?: Record<string, unknown> | null;
920
+ /** Media specific properties returned by backend */
921
+ mediaProperties?: Record<string, unknown> | null;
922
+ /**
923
+ * Detailed call processing information and metadata.
924
+ * Mirrors the callProcessingDetails section described in Webex Contact Center Agent Contact payloads.
925
+ */
636
926
  callProcessingDetails: {
637
927
  /** Name of the Queue Manager handling this interaction */
638
928
  QMgrName: string;
@@ -650,20 +940,24 @@ export type Interaction = {
650
940
  QueueId: string;
651
941
  /** Virtual team identifier */
652
942
  vteamId: string;
653
- /** Indicates if pause/resume functionality is enabled */
654
- pauseResumeEnabled?: string;
943
+ /** Agent capability for pause/resume on this interaction */
944
+ pauseResumeEnabled?: boolean;
655
945
  /** Duration of pause in seconds */
656
946
  pauseDuration?: string;
657
- /** Indicates if the interaction is currently paused */
658
- isPaused?: string;
659
- /** Indicates if recording is in progress */
660
- recordInProgress?: string;
661
- /** Indicates if recording has started */
662
- recordingStarted?: string;
947
+ /** Legacy pause indicator (recordInProgress=false is the active pause signal) */
948
+ isPaused?: boolean;
949
+ /** Recording is actively capturing audio right now */
950
+ recordInProgress?: boolean;
951
+ /** Recording was started for this interaction (may be paused) */
952
+ recordingStarted?: boolean;
953
+ /** Customer geographic region */
954
+ customerRegion?: string;
955
+ /** Flow tag identifier */
956
+ flowTagId?: string;
663
957
  /** Indicates if Consult to Queue is in progress */
664
- ctqInProgress?: string;
958
+ ctqInProgress?: boolean;
665
959
  /** Indicates if outdial transfer to queue is enabled */
666
- outdialTransferToQueueEnabled?: string;
960
+ outdialTransferToQueueEnabled?: boolean;
667
961
  /** IVR conversation transcript */
668
962
  convIvrTranscript?: string;
669
963
  /** Customer's name */
@@ -750,6 +1044,8 @@ export type Interaction = {
750
1044
  fcDesktopView?: string;
751
1045
  /** Agent ID who initiated the outdial call */
752
1046
  outdialAgentId?: string;
1047
+ /** Indicates if the customer has left the call during an active consult */
1048
+ hasCustomerLeft?: string;
753
1049
  /** Indicates if the skip action is disabled for campaign preview contacts */
754
1050
  campaignPreviewSkipDisabled?: string;
755
1051
  /** Indicates if the remove action is disabled for campaign preview contacts */
@@ -761,61 +1057,54 @@ export type Interaction = {
761
1057
  };
762
1058
  /** Main interaction identifier for related interactions */
763
1059
  mainInteractionId?: string;
1060
+ /** Timestamp when interaction entered queue */
1061
+ queuedTimestamp?: number | null;
764
1062
  /** Media-specific information for the interaction */
765
- media: Record<
766
- string,
767
- {
768
- /** Unique identifier for the media resource */
769
- mediaResourceId: string;
770
- /** Type of media channel */
771
- mediaType: MEDIA_CHANNEL;
772
- /** Media manager handling this media */
773
- mediaMgr: string;
774
- /** List of participant identifiers */
775
- participants: string[];
776
- /** Type of media */
777
- mType: string;
778
- /** Indicates if media is on hold */
779
- isHold: boolean;
780
- /** Timestamp when media was put on hold */
781
- holdTimestamp: number | null;
782
- }
783
- >;
1063
+ media: Record<string, MediaEntry>;
784
1064
  /** Owner of the interaction */
785
1065
  owner: string;
786
1066
  /** Primary media channel for the interaction */
787
- mediaChannel: MEDIA_CHANNEL;
1067
+ mediaChannel: string;
788
1068
  /** Direction information for the contact */
789
1069
  contactDirection: {type: string};
790
1070
  /** Type of outbound interaction */
791
1071
  outboundType?: string;
1072
+ /** Optional workflow manager identifier */
1073
+ workflowManager?: string | null;
792
1074
  /** Parameters passed through the call flow */
793
- callFlowParams: Record<
794
- string,
795
- {
796
- /** Name of the parameter */
797
- name: string;
798
- /** Qualifier for the parameter */
799
- qualifier: string;
800
- /** Description of the parameter */
801
- description: string;
802
- /** Data type of the parameter value */
803
- valueDataType: string;
804
- /** Value of the parameter */
805
- value: string;
806
- }
807
- >;
1075
+ callFlowParams?: Record<string, FlowParameter>;
808
1076
  };
809
1077
 
810
1078
  /**
811
- * Task payload containing detailed information about a contact center task
812
- * This structure encapsulates all relevant data for task management
1079
+ * Task payload mirroring the Agent Contact event payload from Webex Contact Center
1080
+ * (developer.webex.com). Arrives on AGENT_* websocket events and is the source of truth
1081
+ * for UI/state machine updates.
813
1082
  * @public
814
1083
  */
1084
+ export type RealtimeTranscription = {
1085
+ agentId: string;
1086
+ orgId: string;
1087
+ notifType: string;
1088
+ notifDetails: {
1089
+ actionEvent: string;
1090
+ };
1091
+ data: {
1092
+ role: 'AGENT' | 'CALLER';
1093
+ utteranceId: string;
1094
+ conversationId: string;
1095
+ publishTimestamp: number;
1096
+ messageId: string;
1097
+ isFinal: boolean;
1098
+ languageCode: string;
1099
+ orgId: string;
1100
+ content: string;
1101
+ };
1102
+ };
1103
+
815
1104
  export type TaskData = {
816
- /** Unique identifier for the media resource handling this task */
1105
+ /** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
817
1106
  mediaResourceId: string;
818
- /** Type of event that triggered this task data */
1107
+ /** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
819
1108
  eventType: string;
820
1109
  /** Timestamp when the event occurred */
821
1110
  eventTime?: number;
@@ -825,7 +1114,7 @@ export type TaskData = {
825
1114
  destAgentId: string;
826
1115
  /** Unique tracking identifier for the task */
827
1116
  trackingId: string;
828
- /** Media resource identifier for consultation operations */
1117
+ /** Media resource identifier for consultation leg when present */
829
1118
  consultMediaResourceId: string;
830
1119
  /** Detailed interaction information */
831
1120
  interaction: Interaction;
@@ -837,7 +1126,7 @@ export type TaskData = {
837
1126
  toOwner?: boolean;
838
1127
  /** Identifier for child interaction in consult/transfer scenarios */
839
1128
  childInteractionId?: string;
840
- /** Unique identifier for the interaction */
1129
+ /** Interaction/contact identifier from backend (same as interaction.interactionId) */
841
1130
  interactionId: string;
842
1131
  /** Organization identifier */
843
1132
  orgId: string;
@@ -847,7 +1136,7 @@ export type TaskData = {
847
1136
  queueMgr: string;
848
1137
  /** Name of the queue where task is queued */
849
1138
  queueName?: string;
850
- /** Type of the task */
1139
+ /** Task/interaction type returned by the platform (routing/monitoring/etc.) */
851
1140
  type: string;
852
1141
  /** Timeout value for RONA (Redirection on No Answer) in seconds */
853
1142
  ronaTimeout?: number;
@@ -883,12 +1172,130 @@ export type TaskData = {
883
1172
  reservedAgentChannelId?: string;
884
1173
  /** Indicates if wrap-up is required for this task */
885
1174
  wrapUpRequired?: boolean;
1175
+ /** SDK-internal: skip task:outdialFailed when non-wxApp agent-terminated outdial still needs wrapup */
1176
+ suppressOutdialFailedPopup?: boolean;
1177
+
1178
+ /**
1179
+ * Current consultation status derived from state machine
1180
+ * Values: CONSULT_INITIATED, CONSULT_ACCEPTED, BEING_CONSULTED,
1181
+ * BEING_CONSULTED_ACCEPTED, CONNECTED, CONFERENCE, CONSULT_COMPLETED
1182
+ */
1183
+ consultStatus?: string;
1184
+
1185
+ /**
1186
+ * Indicates if consultation is in progress (state machine: CONSULTING)
1187
+ */
1188
+ isConsultInProgress?: boolean;
1189
+
1190
+ /**
1191
+ * Indicates if the task is incoming for the active agent
1192
+ */
1193
+ isIncomingTask?: boolean;
1194
+
1195
+ /**
1196
+ * Indicates if the task is on hold (state machine: HELD)
1197
+ */
1198
+ isOnHold?: boolean;
1199
+
1200
+ /**
1201
+ * Indicates if customer is currently in the call
1202
+ * Derived from participants in main media
1203
+ */
1204
+ isCustomerInCall?: boolean;
1205
+
1206
+ /**
1207
+ * Count of conference participants (agents only)
1208
+ * Used for determining if max participants reached
1209
+ */
1210
+ conferenceParticipantsCount?: number;
1211
+
1212
+ /**
1213
+ * Indicates if this is a secondary agent (consulted party)
1214
+ */
1215
+ isSecondaryAgent?: boolean;
1216
+
1217
+ /**
1218
+ * Indicates if this is a secondary EP-DN agent (telephony consult to external)
1219
+ */
1220
+ isSecondaryEpDnAgent?: boolean;
1221
+
1222
+ /**
1223
+ * Task state for MPC (Multi-Party Conference) scenarios
1224
+ * Maps participant consultState to task state
1225
+ */
1226
+ mpcState?: string;
886
1227
  /** Indicates if auto-answer is in progress for this task */
887
1228
  isAutoAnswering?: boolean;
888
1229
  /** Indicates if wrap-up is required for this task */
889
1230
  agentsPendingWrapUp?: string[];
890
1231
  };
891
1232
 
1233
+ export type TaskUIControlState = {
1234
+ isVisible: boolean;
1235
+ isEnabled: boolean;
1236
+ };
1237
+
1238
+ /**
1239
+ * UI control representation for a single interaction leg.
1240
+ */
1241
+ export type InteractionUIControls = {
1242
+ accept: TaskUIControlState;
1243
+ decline: TaskUIControlState;
1244
+ hold: TaskUIControlState;
1245
+ transfer: TaskUIControlState;
1246
+ consult: TaskUIControlState;
1247
+ end: TaskUIControlState;
1248
+ recording: TaskUIControlState;
1249
+ mute: TaskUIControlState;
1250
+ consultTransfer: TaskUIControlState;
1251
+ endConsult: TaskUIControlState;
1252
+ conference: TaskUIControlState;
1253
+ exitConference: TaskUIControlState;
1254
+ transferConference: TaskUIControlState;
1255
+ mergeToConference: TaskUIControlState;
1256
+ wrapup: TaskUIControlState;
1257
+ switch: TaskUIControlState;
1258
+ keypad?: TaskUIControlState;
1259
+ };
1260
+
1261
+ /** Options for {@link ITask.toggleMute} — wxApp engaged calls use `muted` for target state. */
1262
+ export type TaskToggleMuteOptions = {
1263
+ muted?: boolean;
1264
+ lineOwnerId?: string;
1265
+ };
1266
+
1267
+ /** Options for {@link ITask.transmitDtmf} — wxApp engaged in-call DTMF. */
1268
+ export type TaskTransmitDtmfOptions = {
1269
+ dtmf: string;
1270
+ lineOwnerId?: string;
1271
+ };
1272
+
1273
+ export type TaskUILeg = 'main' | 'consult';
1274
+
1275
+ /**
1276
+ * UI controls surfaced to task consumers.
1277
+ * Consumers should read controls from the per-leg surfaces and use `activeLeg`
1278
+ * to determine which one is currently interactive.
1279
+ */
1280
+ export type TaskUIControls = {
1281
+ main: InteractionUIControls;
1282
+ consult: InteractionUIControls;
1283
+ activeLeg: TaskUILeg;
1284
+ /**
1285
+ * Ordered destination categories available for each action.
1286
+ * The first category is the default for consumers that render a destination picker.
1287
+ */
1288
+ consultTransferDestinations: {
1289
+ consult: ConsultTransferDestinationType[];
1290
+ transfer: ConsultTransferDestinationType[];
1291
+ };
1292
+ };
1293
+
1294
+ /**
1295
+ * Helper class for managing task action control state
1296
+ * Tracks visibility and enabled state for task actions that can be executed
1297
+ * @public
1298
+ */
892
1299
  /**
893
1300
  * Type representing an agent contact message within the contact center system
894
1301
  * Contains comprehensive interaction and task related details for agent operations
@@ -1110,6 +1517,15 @@ export type TransferPayload = {
1110
1517
  destinationType: DestinationType;
1111
1518
  };
1112
1519
 
1520
+ /**
1521
+ * Options for configuring transfer behavior
1522
+ * @public
1523
+ */
1524
+ export type TransferOptions = {
1525
+ /** Additional transfer configuration options */
1526
+ [key: string]: unknown;
1527
+ };
1528
+
1113
1529
  /**
1114
1530
  * API payload for ending a consultation
1115
1531
  * This is the actual payload that is sent to the developer API
@@ -1231,6 +1647,41 @@ export type ContactCleanupData = {
1231
1647
  };
1232
1648
  };
1233
1649
 
1650
+ /**
1651
+ * Boolean-like fields in callProcessingDetails that may arrive as strings.
1652
+ * Used by taskDataNormalizer to coerce payloads to actual booleans.
1653
+ */
1654
+ export type CallProcessingBooleanKey =
1655
+ | 'recordingStarted'
1656
+ | 'recordInProgress'
1657
+ | 'isPaused'
1658
+ | 'pauseResumeEnabled'
1659
+ | 'ctqInProgress'
1660
+ | 'outdialTransferToQueueEnabled'
1661
+ | 'taskToBeSelfServiced'
1662
+ | 'CONTINUE_RECORDING_ON_TRANSFER'
1663
+ | 'isParked'
1664
+ | 'participantInviteTimeout'
1665
+ | 'checkAgentAvailability';
1666
+
1667
+ /**
1668
+ * Interaction-level boolean fields that may arrive as strings from backend payloads.
1669
+ */
1670
+ export type InteractionBooleanKey = 'isFcManaged' | 'isMediaForked' | 'isTerminated';
1671
+
1672
+ /**
1673
+ * Participant boolean fields that may arrive as strings and need normalization.
1674
+ */
1675
+ export type ParticipantBooleanKey =
1676
+ | 'autoAnswerEnabled'
1677
+ | 'hasJoined'
1678
+ | 'hasLeft'
1679
+ | 'isConsulted'
1680
+ | 'isInPredial'
1681
+ | 'isOffered'
1682
+ | 'isWrapUp'
1683
+ | 'isWrappedUp';
1684
+
1234
1685
  /**
1235
1686
  * Response type for task public methods
1236
1687
  * Can be an {@link AgentContact} object containing updated task state,
@@ -1239,11 +1690,119 @@ export type ContactCleanupData = {
1239
1690
  */
1240
1691
  export type TaskResponse = AgentContact | Error | void;
1241
1692
 
1693
+ /** AI-assisted mid-call summary action. @public */
1694
+ export type AISummaryAction = 'CONSULT' | 'TRANSFER';
1695
+
1696
+ /** Feedback value sent with an AI summary response. @public */
1697
+ export type AISummaryFeedback = 'none' | 'thumbs_up' | 'thumbs_down';
1698
+
1699
+ /** AI summary response state for post-call and mid-call flows. @public */
1700
+ export type AISummaryState =
1701
+ | 'DEFAULT'
1702
+ | 'EXCLUDED'
1703
+ | 'IGNORED'
1704
+ | 'MID_CALL_CANCELLED'
1705
+ | 'NOT_RECEIVED';
1706
+
1707
+ /** Structured fields shared by post-call and mid-call summaries. @public */
1708
+ export type AISummarySections = {
1709
+ initialContactReason?: string;
1710
+ additionalContactReasons?: string;
1711
+ additionalContext?: string;
1712
+ keyActionsTaken?: string;
1713
+ nextSteps?: string;
1714
+ reasonForTransferOrConsult?: string;
1715
+ };
1716
+
1717
+ /** RTD payload returned or delivered for an AI summary. @public */
1718
+ export type AISummary = {
1719
+ conversationId: string;
1720
+ adaptiveCard?: Record<string, unknown>;
1721
+ adaptiveCardId?: string;
1722
+ editAdaptiveCard?: Record<string, unknown>;
1723
+ editAdaptiveCardId?: string;
1724
+ areTranscriptsAvailable?: boolean;
1725
+ languageCode?: string;
1726
+ resolution?: string;
1727
+ sections?: AISummarySections;
1728
+ suggestedWrapUpCodes?: Array<{name: string; [key: string]: unknown}>;
1729
+ suggestedWrapUpCodesMessage?: string;
1730
+ summaryText?: string;
1731
+ timestamp?: number;
1732
+ [key: string]: unknown;
1733
+ };
1734
+
1735
+ /** RTD payload describing AI-summary feature enablement for an interaction. @public */
1736
+ export type AISummaryFeatureEnablement = {
1737
+ interactionId: string;
1738
+ midCallEnabled?: boolean;
1739
+ postCallEnabled?: boolean;
1740
+ actionTimestamp?: number;
1741
+ [key: string]: unknown;
1742
+ };
1743
+
1744
+ /** Current AI-summary capabilities for a task. @public */
1745
+ export type AISummaryCapabilities = Required<
1746
+ Pick<AISummaryFeatureEnablement, 'midCallEnabled' | 'postCallEnabled'>
1747
+ >;
1748
+
1749
+ /**
1750
+ * Payload sent when reporting a post-call or mid-call summary result.
1751
+ * Transport timestamps are generated by the SDK when the response is sent.
1752
+ * @public
1753
+ */
1754
+ export type AISummaryResponse = {
1755
+ summary: AISummarySections | string;
1756
+ feedback: AISummaryFeedback;
1757
+ state: AISummaryState;
1758
+ numberOfTimesViewed: number;
1759
+ numberOfTimesEdited: number;
1760
+ numberOfTimesCopied: number;
1761
+ summaryReceived?: boolean;
1762
+ wrapUpCode?: string;
1763
+ };
1764
+
1765
+ /**
1766
+ * Request payload for removing a supported participant from an active conference.
1767
+ * @public
1768
+ */
1769
+ export type DropConferenceParticipantPayload = {
1770
+ /** Participant identifier supplied by the current task roster. */
1771
+ participantId: string;
1772
+ };
1773
+
1774
+ /**
1775
+ * Payload shape used by consult conference helper utilities.
1776
+ */
1777
+ export type consultConferencePayloadData = {
1778
+ agentId?: string;
1779
+ destinationType?: string;
1780
+ destAgentId?: string;
1781
+ };
1782
+
1783
+ /**
1784
+ * Minimal event-emitter contract exposed to SDK consumers.
1785
+ * Defined here so that consumers do NOT need `@types/node` in their tsconfig.
1786
+ * The runtime Task class still extends Node's EventEmitter (via ampersand-events),
1787
+ * which satisfies this interface at runtime.
1788
+ * @public
1789
+ */
1790
+ export interface IEventEmitter {
1791
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1792
+ on(event: string, listener: (...args: any[]) => void): this;
1793
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1794
+ off(event: string, listener: (...args: any[]) => void): this;
1795
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1796
+ once(event: string, listener: (...args: any[]) => void): this;
1797
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1798
+ emit(event: string, ...args: any[]): boolean;
1799
+ }
1800
+
1242
1801
  /**
1243
1802
  * Interface for managing task-related operations in the contact center
1244
- * Extends EventEmitter to support event-driven task updates
1803
+ * Extends IEventEmitter to support event-driven task updates
1245
1804
  */
1246
- export interface ITask extends EventEmitter {
1805
+ export interface ITask extends IEventEmitter {
1247
1806
  /**
1248
1807
  * Event data received in the Contact Center events.
1249
1808
  * Contains detailed task information including interaction details, media resources,
@@ -1251,6 +1810,12 @@ export interface ITask extends EventEmitter {
1251
1810
  */
1252
1811
  data: TaskData;
1253
1812
 
1813
+ /**
1814
+ * Current AI-summary capabilities for this task. Both flags are false until
1815
+ * the matching feature-enablement event is received.
1816
+ */
1817
+ readonly aiSummaryCapabilities: Readonly<AISummaryCapabilities>;
1818
+
1254
1819
  /**
1255
1820
  * Map associating tasks with their corresponding call identifiers.
1256
1821
  */
@@ -1263,6 +1828,73 @@ export interface ITask extends EventEmitter {
1263
1828
  */
1264
1829
  autoWrapup?: AutoWrapup;
1265
1830
 
1831
+ /**
1832
+ * Latest UI controls derived from the state machine.
1833
+ * Each control has `isVisible` and `isEnabled` flags computed from current task state.
1834
+ * Subscribe to {@link TASK_EVENTS.TASK_UI_CONTROLS_UPDATED} for change notifications.
1835
+ */
1836
+ readonly uiControls: TaskUIControls;
1837
+
1838
+ /**
1839
+ * Update wxApp thick-client answer flag at runtime.
1840
+ * Voice tasks override to refresh uiControls; other channel types no-op.
1841
+ * @internal
1842
+ */
1843
+ setEnableWxBetterTogether(enabled: boolean): void;
1844
+
1845
+ /**
1846
+ * Apply wxApp mute state from Mercury sync or call-details fetch.
1847
+ * @internal
1848
+ */
1849
+ applyWxAppMuteStateFromSync(incomingCallId: string, muted: boolean): void;
1850
+
1851
+ /**
1852
+ * Current wxApp mute state for engaged telephony (Voice tasks only).
1853
+ */
1854
+ getWxAppMuted?(): boolean;
1855
+
1856
+ /**
1857
+ * Re-seed wxApp mute from GET telephony/calls/{callId}. Resolves to muted state when known.
1858
+ */
1859
+ syncWxAppMuteFromCallDetails?(): Promise<boolean | undefined>;
1860
+
1861
+ /**
1862
+ * Re-run OFFERED wxApp offer diagnostics without emitting UI controls.
1863
+ * Voice tasks implement this; other channel types omit it.
1864
+ * @internal
1865
+ */
1866
+ refreshWxAppOfferObservability?(): void;
1867
+
1868
+ /**
1869
+ * Cancel pending wxApp offer observability timers (participant-mismatch grace).
1870
+ * Voice tasks implement this; other channel types omit it.
1871
+ * @internal
1872
+ */
1873
+ disposeWxAppOfferObservability?(): void;
1874
+
1875
+ /**
1876
+ * State machine instance for managing task state transitions and derived properties.
1877
+ * The state machine handles:
1878
+ * - State transitions (IDLE → OFFERED → CONNECTED → HELD, etc.)
1879
+ * - Derived properties (canHold, canResume, isConsulted, etc.)
1880
+ * - Action availability based on current state
1881
+ *
1882
+ * This is part of the migration from manual state management to centralized state machine.
1883
+ * During the transition period, both the old setUIControls() and state machine coexist.
1884
+ *
1885
+ * @see createTaskStateMachine
1886
+ * @internal
1887
+ */
1888
+ stateMachineService?: AnyActorRef;
1889
+ state?: any;
1890
+
1891
+ /**
1892
+ * Helper method to send events to the state machine.
1893
+ * This is part of the migration to XState.
1894
+ * @internal
1895
+ */
1896
+ sendStateMachineEvent: (event: TaskEventPayload) => void;
1897
+
1266
1898
  /**
1267
1899
  * Cancels the auto-wrapup timer for the task.
1268
1900
  * This method stops the auto-wrapup process if it is currently active.
@@ -1271,6 +1903,46 @@ export interface ITask extends EventEmitter {
1271
1903
  */
1272
1904
  cancelAutoWrapupTimer(): void;
1273
1905
 
1906
+ /**
1907
+ * Applies the AI-summary feature flags received for this task's interaction.
1908
+ * @internal
1909
+ */
1910
+ setFeatureEnablement?(enablement: AISummaryFeatureEnablement): void;
1911
+
1912
+ /**
1913
+ * Clears the task-local AI-summary feature flags on task removal or session cleanup.
1914
+ * @internal
1915
+ */
1916
+ clearFeatureEnablement?(): void;
1917
+
1918
+ /**
1919
+ * Requests an AI-generated post-call summary for this task.
1920
+ * @returns Promise resolving with the matching post-call summary payload.
1921
+ */
1922
+ requestPostCallSummary(): Promise<AISummary>;
1923
+
1924
+ /**
1925
+ * Sends the consumer's post-call summary response.
1926
+ * @param response - Validated post-call response observations and summary state.
1927
+ * @returns Promise resolving when AI Assistant acknowledges the response.
1928
+ */
1929
+ sendPostCallSummaryResponse(response: AISummaryResponse): Promise<void>;
1930
+
1931
+ /**
1932
+ * Requests an AI-generated mid-call summary for a consult or transfer flow.
1933
+ * @param action - The consult or transfer flow requesting the summary.
1934
+ * @returns Promise resolving with the matching mid-call summary payload.
1935
+ */
1936
+ requestMidCallSummary(action: AISummaryAction): Promise<AISummary>;
1937
+
1938
+ /**
1939
+ * Sends the consumer's mid-call summary response for a consult or transfer flow.
1940
+ * @param response - Validated mid-call response observations and summary state.
1941
+ * @param action - The consult or transfer flow responding to the summary.
1942
+ * @returns Promise resolving when AI Assistant acknowledges the response.
1943
+ */
1944
+ sendMidCallSummaryResponse(response: AISummaryResponse, action: AISummaryAction): Promise<void>;
1945
+
1274
1946
  /**
1275
1947
  * Deregisters all web call event listeners.
1276
1948
  * Used when cleaning up task resources.
@@ -1284,7 +1956,7 @@ export interface ITask extends EventEmitter {
1284
1956
  * @returns Updated task instance
1285
1957
  * @ignore
1286
1958
  */
1287
- updateTaskData(newData: TaskData): ITask;
1959
+ updateTaskData(newData: TaskData): void;
1288
1960
 
1289
1961
  /**
1290
1962
  * Answers or accepts an incoming task.
@@ -1416,28 +2088,29 @@ export interface ITask extends EventEmitter {
1416
2088
  * await task.transfer({ to: "queueId", destinationType: "queue" });
1417
2089
  * ```
1418
2090
  */
1419
- transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
2091
+ transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
1420
2092
 
1421
2093
  /**
1422
- * Transfers the task after consultation.
1423
- * @param consultTransferPayload - Details for consult transfer (optional)
2094
+ * Initiates a consult conference (merge consult call with main call).
1424
2095
  * @returns Promise<TaskResponse>
1425
2096
  * @example
1426
2097
  * ```typescript
1427
- * await task.consultTransfer({ to: "agentId", destinationType: "agent" });
2098
+ * await task.consultConference();
1428
2099
  * ```
1429
2100
  */
1430
- consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
2101
+ consultConference(): Promise<TaskResponse>;
1431
2102
 
1432
2103
  /**
1433
- * Initiates a consult conference (merge consult call with main call).
2104
+ * Removes a supported participant from the active conference.
2105
+ * Resolves after the correlated ParticipantLeftConference routing event.
2106
+ * @param payload - Participant identifier to remove
1434
2107
  * @returns Promise<TaskResponse>
1435
2108
  * @example
1436
2109
  * ```typescript
1437
- * await task.consultConference();
2110
+ * await task.dropConferenceParticipant({participantId: 'participant-id'});
1438
2111
  * ```
1439
2112
  */
1440
- consultConference(): Promise<TaskResponse>;
2113
+ dropConferenceParticipant(payload: DropConferenceParticipantPayload): Promise<TaskResponse>;
1441
2114
 
1442
2115
  /**
1443
2116
  * Exits from an ongoing conference.
@@ -1460,12 +2133,187 @@ export interface ITask extends EventEmitter {
1460
2133
  transferConference(): Promise<TaskResponse>;
1461
2134
 
1462
2135
  /**
1463
- * Toggles mute/unmute for the local audio stream during a WebRTC task.
2136
+ * Toggles between consult call and main call during consulting.
2137
+ * If on consult leg, switches to main call (holds consult).
2138
+ * If on main call, switches to consult (resumes consult).
2139
+ * Only available when in CONSULTING state.
2140
+ * @returns Promise<TaskResponse>
2141
+ * @example
2142
+ * ```typescript
2143
+ * await task.switchCall();
2144
+ * ```
2145
+ */
2146
+ switchCall(): Promise<TaskResponse>;
2147
+
2148
+ /**
2149
+ * Toggles mute/unmute for the active call.
2150
+ * WebRTC tasks toggle the local stream; wxApp engaged tasks route to telephony mute REST when
2151
+ * `enableWxBetterTogether` is active.
2152
+ * @param options - Optional target mute state (`muted`) for wxApp; ignored for WebRTC toggle.
1464
2153
  * @returns Promise<void>
1465
2154
  * @example
1466
2155
  * ```typescript
1467
2156
  * await task.toggleMute();
2157
+ * await task.toggleMute({ muted: true });
2158
+ * ```
2159
+ */
2160
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
2161
+
2162
+ /**
2163
+ * Sends in-call DTMF tones for wxApp engaged telephony tasks when `enableWxBetterTogether` is active.
2164
+ * @param options - DTMF digit(s) and optional shared-line owner id.
2165
+ * @returns Promise<void>
2166
+ * @example
2167
+ * ```typescript
2168
+ * await task.transmitDtmf({ dtmf: '5' });
2169
+ * ```
2170
+ */
2171
+ transmitDtmf(options: TaskTransmitDtmfOptions): Promise<void>;
2172
+ }
2173
+
2174
+ /**
2175
+ * Interface for managing digital channel task operations in the contact center
2176
+ * Digital channels (chat, email, social, SMS) have a simpler interface than voice
2177
+ * Extends ITask but overrides updateTaskData to return IDigital
2178
+ * @public
2179
+ */
2180
+ export interface IDigital extends Omit<ITask, 'updateTaskData'> {
2181
+ /**
2182
+ * Updates the task data
2183
+ * @param newData - Updated task data
2184
+ * @param shouldOverwrite - Whether to completely replace existing data
2185
+ * @returns Updated Digital task instance
2186
+ */
2187
+ updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
2188
+ }
2189
+
2190
+ /**
2191
+ * Interface for managing voice/telephony task operations in the contact center
2192
+ * Extends ITask with voice-specific functionality for hold/resume operations
2193
+ * @public
2194
+ */
2195
+ export interface IVoice extends ITask {
2196
+ /**
2197
+ * Toggles hold/resume state for a voice task.
2198
+ * If the task is currently on hold, it will be resumed.
2199
+ * If the task is active, it will be placed on hold.
2200
+ * @returns Promise<TaskResponse>
2201
+ * @example
2202
+ * ```typescript
2203
+ * await voiceTask.holdResume();
1468
2204
  * ```
1469
2205
  */
1470
- toggleMute(): Promise<void>;
2206
+ holdResume(): Promise<TaskResponse>;
2207
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2208
+ isWebexAppCallingOffer(): boolean;
2209
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2210
+ getCallingDeviceDetails(): import('./WebexCallingUtils').WebexCallingDeviceDetails | undefined;
2211
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2212
+ getWebexCallingCallId(): string | null;
2213
+ }
2214
+
2215
+ /**
2216
+ * Configuration options for voice task UI controls
2217
+ */
2218
+ export type VoiceUIControlOptions = {
2219
+ isEndTaskEnabled?: boolean;
2220
+ isEndConsultEnabled?: boolean;
2221
+ voiceVariant?: VoiceVariant;
2222
+ isRecordingEnabled?: boolean;
2223
+ enableWxBetterTogether?: boolean;
2224
+ consultTransferConfig?: ConsultTransferDestinationConfig;
2225
+ answerCallOnWebexService?: import('../AnswerCallOnWebexService').default;
2226
+ /** Read-only observability: whether usersub answer-calls-on-wxcc is active this session. */
2227
+ getUsersubPublished?: () => boolean;
2228
+ };
2229
+
2230
+ /**
2231
+ * Participant information for UI display
2232
+ */
2233
+ export type Participant = {
2234
+ id: string;
2235
+ name?: string;
2236
+ pType?: string;
2237
+ };
2238
+
2239
+ /**
2240
+ * @deprecated Use Participant instead
2241
+ */
2242
+ export type TaskAccessorParticipant = Participant;
2243
+
2244
+ export interface IWebRTC extends IVoice {
2245
+ /**
2246
+ * This method is used to mute/unmute the call.
2247
+ * @returns Promise<void>
2248
+ * @example
2249
+ * ```typescript
2250
+ * task.toggleMute();
2251
+ * ```
2252
+ */
2253
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
2254
+ /**
2255
+ * Decline the incoming task for Browser Login
2256
+ *
2257
+ * @example
2258
+ * ```
2259
+ * task.decline();
2260
+ * ```
2261
+ */
2262
+ decline(): Promise<TaskResponse>;
2263
+ /**
2264
+ * This method is used to unregister the web call listeners.
2265
+ * @returns void
2266
+ * @example
2267
+ * ```typescript
2268
+ * task.unregisterWebCallListeners();
2269
+ * ```
2270
+ */
2271
+ unregisterWebCallListeners(): void;
2272
+ }
2273
+
2274
+ export type WebSocketPayload = TaskData & {
2275
+ type: string;
2276
+ mediaResourceId?: string;
2277
+ reason?: string;
2278
+ /** ContactEnded: party that ended the contact (e.g. 'Agent', 'Customer') */
2279
+ terminatingParty?: string;
2280
+ /**
2281
+ * Optional real-time transcript chunk payload.
2282
+ * Present on REAL_TIME_TRANSCRIPTION notifications.
2283
+ */
2284
+ data?: RealtimeTranscription['data'];
2285
+ };
2286
+
2287
+ export type WebSocketMessage = {
2288
+ keepalive?: 'true' | 'false' | boolean;
2289
+ type?: string;
2290
+ data: WebSocketPayload;
2291
+ };
2292
+
2293
+ /**
2294
+ * Actions to be performed after handling an event
2295
+ *
2296
+ * These actions represent TaskManager-level concerns (task collection lifecycle,
2297
+ * resource cleanup) rather than task-level state machine concerns. The separation
2298
+ * ensures proper responsibility:
2299
+ * - TaskManager: Collection management, metrics, cleanup
2300
+ * - State Machine: Task state transitions, event emissions, UI controls
2301
+ */
2302
+ export interface TaskEventActions {
2303
+ task?: ITask;
2304
+ }
2305
+
2306
+ /**
2307
+ * Context for processing an event
2308
+ *
2309
+ * Contains all information needed to process a WebSocket event:
2310
+ * - Event type and payload from the backend
2311
+ * - Task instance (if exists)
2312
+ * - Pre-mapped state machine event (if applicable)
2313
+ */
2314
+ export interface EventContext {
2315
+ eventType: string;
2316
+ payload: WebSocketPayload;
2317
+ task?: ITask;
2318
+ stateMachineEvent?: TaskEventPayload | null;
1471
2319
  }