@webex/contact-center 3.12.0-next.12 → 3.12.0-next.121

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 (307) hide show
  1. package/.sdd/manifest.json +884 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +51 -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 +808 -40
  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 +27 -3
  45. package/dist/constants.js.map +1 -1
  46. package/dist/index.js +20 -5
  47. package/dist/index.js.map +1 -1
  48. package/dist/metrics/MetricsManager.js +16 -0
  49. package/dist/metrics/MetricsManager.js.map +1 -1
  50. package/dist/metrics/behavioral-events.js +205 -0
  51. package/dist/metrics/behavioral-events.js.map +1 -1
  52. package/dist/metrics/constants.js +43 -4
  53. package/dist/metrics/constants.js.map +1 -1
  54. package/dist/services/AddressBook.js +18 -15
  55. package/dist/services/AddressBook.js.map +1 -1
  56. package/dist/services/AnswerCallOnWebexService.js +202 -0
  57. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  58. package/dist/services/ApiAiAssistant.js +153 -8
  59. package/dist/services/ApiAiAssistant.js.map +1 -1
  60. package/dist/services/EntryPoint.js +46 -68
  61. package/dist/services/EntryPoint.js.map +1 -1
  62. package/dist/services/Queue.js +27 -22
  63. package/dist/services/Queue.js.map +1 -1
  64. package/dist/services/UserPreference.js +427 -0
  65. package/dist/services/UserPreference.js.map +1 -0
  66. package/dist/services/WebexCrossClientService.js +222 -0
  67. package/dist/services/WebexCrossClientService.js.map +1 -0
  68. package/dist/services/WxAppTelephonyMercurySync.js +108 -0
  69. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  70. package/dist/services/config/Util.js +6 -3
  71. package/dist/services/config/Util.js.map +1 -1
  72. package/dist/services/config/constants.js +33 -8
  73. package/dist/services/config/constants.js.map +1 -1
  74. package/dist/services/config/types.js +53 -9
  75. package/dist/services/config/types.js.map +1 -1
  76. package/dist/services/core/Err.js.map +1 -1
  77. package/dist/services/core/Utils.js +107 -32
  78. package/dist/services/core/Utils.js.map +1 -1
  79. package/dist/services/core/WebexRequest.js +6 -2
  80. package/dist/services/core/WebexRequest.js.map +1 -1
  81. package/dist/services/core/aqm-reqs.js +28 -14
  82. package/dist/services/core/aqm-reqs.js.map +1 -1
  83. package/dist/services/core/types.js.map +1 -1
  84. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  85. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  86. package/dist/services/core/websocket/types.js.map +1 -1
  87. package/dist/services/index.js +1 -1
  88. package/dist/services/index.js.map +1 -1
  89. package/dist/services/task/Task.js +754 -0
  90. package/dist/services/task/Task.js.map +1 -0
  91. package/dist/services/task/TaskFactory.js +49 -0
  92. package/dist/services/task/TaskFactory.js.map +1 -0
  93. package/dist/services/task/TaskManager.js +1053 -520
  94. package/dist/services/task/TaskManager.js.map +1 -1
  95. package/dist/services/task/TaskUtils.js +211 -27
  96. package/dist/services/task/TaskUtils.js.map +1 -1
  97. package/dist/services/task/WebexCallingUtils.js +70 -0
  98. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  99. package/dist/services/task/constants.js +12 -2
  100. package/dist/services/task/constants.js.map +1 -1
  101. package/dist/services/task/contact.js +29 -0
  102. package/dist/services/task/contact.js.map +1 -1
  103. package/dist/services/task/dialer.js +78 -0
  104. package/dist/services/task/dialer.js.map +1 -1
  105. package/dist/services/task/digital/Digital.js +78 -0
  106. package/dist/services/task/digital/Digital.js.map +1 -0
  107. package/dist/services/task/state-machine/TaskStateMachine.js +954 -0
  108. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  109. package/dist/services/task/state-machine/actions.js +572 -0
  110. package/dist/services/task/state-machine/actions.js.map +1 -0
  111. package/dist/services/task/state-machine/constants.js +161 -0
  112. package/dist/services/task/state-machine/constants.js.map +1 -0
  113. package/dist/services/task/state-machine/guards.js +379 -0
  114. package/dist/services/task/state-machine/guards.js.map +1 -0
  115. package/dist/services/task/state-machine/index.js +53 -0
  116. package/dist/services/task/state-machine/index.js.map +1 -0
  117. package/dist/services/task/state-machine/types.js +54 -0
  118. package/dist/services/task/state-machine/types.js.map +1 -0
  119. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  120. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  121. package/dist/services/task/taskDataNormalizer.js +99 -0
  122. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  123. package/dist/services/task/types.js +228 -5
  124. package/dist/services/task/types.js.map +1 -1
  125. package/dist/services/task/voice/Voice.js +1447 -0
  126. package/dist/services/task/voice/Voice.js.map +1 -0
  127. package/dist/services/task/voice/WebRTC.js +152 -0
  128. package/dist/services/task/voice/WebRTC.js.map +1 -0
  129. package/dist/services/task/voice/wxAppVoiceMethods.js +354 -0
  130. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  131. package/dist/services/wxAppDiagnosticLogging.js +122 -0
  132. package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
  133. package/dist/services/wxAppTelephonyUtils.js +19 -0
  134. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  135. package/dist/types/cc.d.ts +172 -5
  136. package/dist/types/config.d.ts +13 -0
  137. package/dist/types/constants.d.ts +25 -1
  138. package/dist/types/index.d.ts +24 -7
  139. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  140. package/dist/types/metrics/constants.d.ts +38 -1
  141. package/dist/types/services/AddressBook.d.ts +2 -1
  142. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  143. package/dist/types/services/ApiAiAssistant.d.ts +22 -4
  144. package/dist/types/services/EntryPoint.d.ts +7 -5
  145. package/dist/types/services/Queue.d.ts +5 -3
  146. package/dist/types/services/UserPreference.d.ts +118 -0
  147. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  148. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  149. package/dist/types/services/config/constants.d.ts +29 -5
  150. package/dist/types/services/config/types.d.ts +184 -10
  151. package/dist/types/services/core/Err.d.ts +6 -0
  152. package/dist/types/services/core/Utils.d.ts +33 -13
  153. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  154. package/dist/types/services/core/types.d.ts +2 -0
  155. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  156. package/dist/types/services/core/websocket/types.d.ts +1 -1
  157. package/dist/types/services/index.d.ts +1 -1
  158. package/dist/types/services/task/Task.d.ts +175 -0
  159. package/dist/types/services/task/TaskFactory.d.ts +13 -0
  160. package/dist/types/services/task/TaskUtils.d.ts +48 -2
  161. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  162. package/dist/types/services/task/constants.d.ts +10 -0
  163. package/dist/types/services/task/contact.d.ts +4 -0
  164. package/dist/types/services/task/dialer.d.ts +30 -0
  165. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  166. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1356 -0
  167. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  168. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  169. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  170. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  171. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  172. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  173. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  174. package/dist/types/services/task/types.d.ts +680 -66
  175. package/dist/types/services/task/voice/Voice.d.ts +227 -0
  176. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  177. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +55 -0
  178. package/dist/types/services/wxAppDiagnosticLogging.d.ts +51 -0
  179. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  180. package/dist/types/types.d.ts +149 -8
  181. package/dist/types/utils/PageCache.d.ts +20 -3
  182. package/dist/types/webex.d.ts +1 -0
  183. package/dist/types.js +125 -4
  184. package/dist/types.js.map +1 -1
  185. package/dist/utils/PageCache.js +19 -5
  186. package/dist/utils/PageCache.js.map +1 -1
  187. package/dist/webex.js +14 -2
  188. package/dist/webex.js.map +1 -1
  189. package/package.json +16 -12
  190. package/src/cc.ts +986 -42
  191. package/src/config.ts +13 -0
  192. package/src/constants.ts +25 -1
  193. package/src/index.ts +25 -5
  194. package/src/metrics/MetricsManager.ts +16 -0
  195. package/src/metrics/ai-docs/AGENTS.md +350 -0
  196. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  197. package/src/metrics/ai-docs/metrics-spec.md +922 -0
  198. package/src/metrics/behavioral-events.ts +212 -0
  199. package/src/metrics/constants.ts +47 -4
  200. package/src/services/AddressBook.ts +17 -6
  201. package/src/services/AnswerCallOnWebexService.ts +239 -0
  202. package/src/services/ApiAiAssistant.ts +203 -8
  203. package/src/services/EntryPoint.ts +59 -60
  204. package/src/services/Queue.ts +29 -12
  205. package/src/services/UserPreference.ts +509 -0
  206. package/src/services/WebexCrossClientService.ts +293 -0
  207. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  208. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  209. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  210. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  211. package/src/services/ai-docs/AGENTS.md +386 -0
  212. package/src/services/ai-docs/services-spec.md +497 -0
  213. package/src/services/config/Util.ts +6 -3
  214. package/src/services/config/ai-docs/AGENTS.md +255 -0
  215. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  216. package/src/services/config/ai-docs/config-spec.md +675 -0
  217. package/src/services/config/constants.ts +35 -7
  218. package/src/services/config/types.ts +186 -11
  219. package/src/services/core/Err.ts +3 -0
  220. package/src/services/core/Utils.ts +123 -37
  221. package/src/services/core/WebexRequest.ts +3 -1
  222. package/src/services/core/ai-docs/AGENTS.md +381 -0
  223. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  224. package/src/services/core/ai-docs/core-spec.md +787 -0
  225. package/src/services/core/aqm-reqs.ts +30 -15
  226. package/src/services/core/types.ts +2 -0
  227. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  228. package/src/services/core/websocket/types.ts +1 -1
  229. package/src/services/index.ts +1 -1
  230. package/src/services/task/Task.ts +908 -0
  231. package/src/services/task/TaskFactory.ts +60 -0
  232. package/src/services/task/TaskManager.ts +1239 -608
  233. package/src/services/task/TaskUtils.ts +303 -25
  234. package/src/services/task/WebexCallingUtils.ts +136 -0
  235. package/src/services/task/ai-docs/AGENTS.md +457 -0
  236. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  237. package/src/services/task/ai-docs/task-spec.md +1470 -0
  238. package/src/services/task/constants.ts +10 -0
  239. package/src/services/task/contact.ts +30 -0
  240. package/src/services/task/dialer.ts +80 -0
  241. package/src/services/task/digital/Digital.ts +97 -0
  242. package/src/services/task/state-machine/TaskStateMachine.ts +1293 -0
  243. package/src/services/task/state-machine/actions.ts +741 -0
  244. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  245. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1145 -0
  246. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2207 -0
  247. package/src/services/task/state-machine/constants.ts +172 -0
  248. package/src/services/task/state-machine/guards.ts +442 -0
  249. package/src/services/task/state-machine/index.ts +28 -0
  250. package/src/services/task/state-machine/types.ts +258 -0
  251. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  252. package/src/services/task/taskDataNormalizer.ts +137 -0
  253. package/src/services/task/types.ts +819 -70
  254. package/src/services/task/voice/Voice.ts +1809 -0
  255. package/src/services/task/voice/WebRTC.ts +191 -0
  256. package/src/services/task/voice/wxAppVoiceMethods.ts +516 -0
  257. package/src/services/wxAppDiagnosticLogging.ts +174 -0
  258. package/src/services/wxAppTelephonyUtils.ts +14 -0
  259. package/src/types.ts +199 -11
  260. package/src/utils/AGENTS.md +289 -0
  261. package/src/utils/PageCache.ts +38 -5
  262. package/src/utils/ai-docs/utils-spec.md +391 -0
  263. package/src/webex.js +2 -0
  264. package/test/unit/spec/cc.ts +1947 -124
  265. package/test/unit/spec/logger-proxy.ts +70 -0
  266. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  267. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  268. package/test/unit/spec/services/AddressBook.ts +37 -6
  269. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  270. package/test/unit/spec/services/ApiAiAssistant.ts +178 -20
  271. package/test/unit/spec/services/EntryPoint.ts +87 -40
  272. package/test/unit/spec/services/Queue.ts +123 -12
  273. package/test/unit/spec/services/UserPreference.ts +401 -0
  274. package/test/unit/spec/services/WebCallingService.ts +7 -1
  275. package/test/unit/spec/services/WebexCrossClientService.ts +467 -0
  276. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  277. package/test/unit/spec/services/config/Util.ts +85 -0
  278. package/test/unit/spec/services/config/index.ts +30 -30
  279. package/test/unit/spec/services/core/Utils.ts +425 -8
  280. package/test/unit/spec/services/core/WebexRequest.ts +3 -1
  281. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  282. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  283. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  284. package/test/unit/spec/services/task/Task.ts +677 -0
  285. package/test/unit/spec/services/task/TaskFactory.ts +99 -0
  286. package/test/unit/spec/services/task/TaskManager.ts +1972 -1549
  287. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  288. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  289. package/test/unit/spec/services/task/contact.ts +33 -0
  290. package/test/unit/spec/services/task/dialer.ts +190 -0
  291. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  292. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +3459 -0
  293. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  294. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  295. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  296. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  297. package/test/unit/spec/services/task/voice/Voice.ts +1903 -0
  298. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  299. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +603 -0
  300. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +143 -0
  301. package/umd/contact-center.min.js +2 -2
  302. package/umd/contact-center.min.js.map +1 -1
  303. package/dist/services/task/index.js +0 -1525
  304. package/dist/services/task/index.js.map +0 -1
  305. package/dist/types/services/task/index.d.ts +0 -650
  306. package/src/services/task/index.ts +0 -1801
  307. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -18,6 +18,8 @@ export type Req<TRes, TErr> = {
18
18
  url: string;
19
19
  host?: string;
20
20
  method?: HTTP_METHODS;
21
+ /** Suppress request URLs and routing payloads from AQM logs for sensitive operations. */
22
+ redactSensitiveLogs?: boolean;
21
23
  err?: ((errObj: WebexRequestPayload) => Err.Details<'Service.reqs.generic.failure'>) | Err.IdsMessage | ((e: WebexRequestPayload) => Err.Message | Err.Details<Err.IdsDetails>);
22
24
  notifSuccess: {
23
25
  bind: Bind;
@@ -33,3 +33,4 @@ export declare class WebSocketManager extends EventEmitter {
33
33
  private connect;
34
34
  private webSocketOnCloseHandler;
35
35
  }
36
+ export default WebSocketManager;
@@ -1,5 +1,5 @@
1
1
  import { SubscribeRequest } from '../../../types';
2
- import { WebSocketManager } from './WebSocketManager';
2
+ import type WebSocketManager from './WebSocketManager';
3
3
  /**
4
4
  * Options for initializing a connection service.
5
5
  * @typedef ConnectionServiceOptions
@@ -23,7 +23,7 @@ export default class Services {
23
23
  readonly dialer: ReturnType<typeof aqmDialer>;
24
24
  /** WebSocket manager for handling real-time communications */
25
25
  readonly webSocketManager: WebSocketManager;
26
- /** RTD WebSocket manager for handling realtime transcription */
26
+ /** RTD WebSocket manager for handling real-time transcription */
27
27
  readonly rtdWebSocketManager: WebSocketManager;
28
28
  /** Connection service for managing websocket connections */
29
29
  readonly connectionService: ConnectionService;
@@ -0,0 +1,175 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import type { ActorRefFrom, SnapshotFrom } from 'xstate';
4
+ import { ITask, TaskData, TaskResponse, WrapupPayLoad, TaskId, TransferPayLoad, TASK_EVENTS, TaskUIControls, DropConferenceParticipantPayload, ConsultEndPayload, ConsultPayload, ConsultTransferPayLoad, ResumeRecordingPayload, CallId, TaskToggleMuteOptions, TaskTransmitDtmfOptions } from './types';
5
+ import routingContact from './contact';
6
+ import MetricsManager from '../../metrics/MetricsManager';
7
+ import { TaskState } from './state-machine';
8
+ import type { TaskEventPayload, TaskStateMachine, UIControlConfig, TaskActionsMap, TaskActionArgs } from './state-machine';
9
+ import AutoWrapup from './AutoWrapup';
10
+ import { WrapupData } from '../config/types';
11
+ type UIControlConfigInput = Omit<UIControlConfig, 'channelType'> & {
12
+ channelType?: UIControlConfig['channelType'];
13
+ };
14
+ export default abstract class Task extends EventEmitter implements ITask {
15
+ protected contact: ReturnType<typeof routingContact>;
16
+ protected metricsManager: MetricsManager;
17
+ stateMachineService?: ActorRefFrom<TaskStateMachine>;
18
+ data: TaskData;
19
+ webCallMap: Record<TaskId, CallId>;
20
+ state?: SnapshotFrom<TaskStateMachine>;
21
+ private lastState?;
22
+ protected currentUiControls: TaskUIControls;
23
+ protected uiControlConfig: UIControlConfig;
24
+ protected wrapupData?: WrapupData;
25
+ autoWrapup?: AutoWrapup;
26
+ protected agentId?: string;
27
+ constructor(contact: ReturnType<typeof routingContact>, data: TaskData, uiControlConfig: UIControlConfigInput, wrapupData?: WrapupData, agentId?: string);
28
+ private static resolveChannelType;
29
+ abstract accept(): Promise<TaskResponse>;
30
+ decline(): Promise<TaskResponse>;
31
+ pauseRecording(): Promise<TaskResponse>;
32
+ resumeRecording(resumeRecordingPayload: ResumeRecordingPayload): Promise<TaskResponse>;
33
+ consult(consultPayload: ConsultPayload): Promise<TaskResponse>;
34
+ endConsult(consultEndPayload: ConsultEndPayload): Promise<TaskResponse>;
35
+ consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
36
+ consultConference(): Promise<TaskResponse>;
37
+ dropConferenceParticipant(payload: DropConferenceParticipantPayload): Promise<TaskResponse>;
38
+ exitConference(): Promise<TaskResponse>;
39
+ transferConference(): Promise<TaskResponse>;
40
+ switchCall(): Promise<TaskResponse>;
41
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
42
+ transmitDtmf(options: TaskTransmitDtmfOptions): Promise<void>;
43
+ unregisterWebCallListeners(): void;
44
+ /**
45
+ * Cancel any in-progress auto wrap-up timer.
46
+ * Base implementation just clears the timer reference so subclasses inherit the behavior.
47
+ */
48
+ cancelAutoWrapupTimer(): void;
49
+ hold(): Promise<TaskResponse>;
50
+ resume(): Promise<TaskResponse>;
51
+ holdResume(): Promise<TaskResponse>;
52
+ /**
53
+ * Latest UI controls derived from state machine state and context.
54
+ */
55
+ get uiControls(): TaskUIControls;
56
+ protected updateUiControls(forceEmit?: boolean): void;
57
+ /**
58
+ * Initialize the state machine
59
+ */
60
+ private initializeStateMachine;
61
+ /**
62
+ * Send an event to the state machine
63
+ */
64
+ sendStateMachineEvent(event: TaskEventPayload): void;
65
+ /**
66
+ * Get the current state machine state
67
+ */
68
+ protected getCurrentState(): TaskState | undefined;
69
+ /**
70
+ * Compute UI controls based on current state machine state.
71
+ *
72
+ * @returns UI control states for all task actions
73
+ */
74
+ /**
75
+ * Update wxApp thick-client answer flag at runtime (Voice overrides).
76
+ */
77
+ setEnableWxBetterTogether(_enabled: boolean): void;
78
+ /**
79
+ * Apply wxApp mute state from external sync (Voice overrides).
80
+ */
81
+ applyWxAppMuteStateFromSync(_incomingCallId: string, _muted: boolean): void;
82
+ /**
83
+ * Hook for post-assign wxApp sync (Voice overrides).
84
+ */
85
+ protected onTaskAssigned(): void;
86
+ /**
87
+ * Hook for post-hydrate wxApp sync (Voice overrides).
88
+ */
89
+ protected onTaskHydrated(): void;
90
+ protected computeUIControls(): TaskUIControls;
91
+ /**
92
+ * Stop the state machine service
93
+ */
94
+ protected stopStateMachine(): void;
95
+ private static extractTaskDataFromEvent;
96
+ private autoAnswerIfNeeded;
97
+ private updateTaskFromEvent;
98
+ protected getStateMachineActionOverrides(): Partial<TaskActionsMap>;
99
+ protected getChannelSpecificActionOverrides(): Partial<TaskActionsMap>;
100
+ protected createEmitSelfAction(taskEvent: TASK_EVENTS, { updateTaskData }?: {
101
+ updateTaskData?: boolean;
102
+ }): ({ event }: TaskActionArgs) => void;
103
+ private getCommonActionOverrides;
104
+ /**
105
+ * Sets up the automatic wrap-up timer if wrap-up is required
106
+ */
107
+ protected setupAutoWrapupTimer(): void;
108
+ /**
109
+ * Cancels the automatic wrap-up timer if it's running
110
+ */
111
+ private reconcileData;
112
+ /**
113
+ *
114
+ * @param methodName - The name of the method that is unsupported
115
+ * @throws Error
116
+ */
117
+ protected unsupportedMethodError(methodName: string): void;
118
+ /**
119
+ * This method is used to update the task data.
120
+ * @param updatedData - TaskData
121
+ * @param shouldOverwrite - boolean
122
+ * @example
123
+ * ```typescript
124
+ * task.updateTaskData(updatedData, true);
125
+ * ```
126
+ */
127
+ updateTaskData(updatedData: TaskData, shouldOverwrite?: boolean): ITask;
128
+ /**
129
+ * The backend sends `interaction.media` and `interaction.participants` as complete snapshots
130
+ * of the current call state. `reconcileData` deep-merges and never removes keys, so entries the
131
+ * backend dropped (e.g. a consult leg's media and consultee participant after the consult ends)
132
+ * linger in `this.data`. That stale data drives incorrect UI controls (e.g. the consult button
133
+ * staying disabled after the consult leg is gone, until a page refresh re-hydrates cleanly).
134
+ * Make only these two snapshot maps authoritative to the incoming payload, leaving every other
135
+ * field on the generic deep-merge path (CAD and other partial updates still merge as before).
136
+ */
137
+ private pruneStaleInteractionMaps;
138
+ /**
139
+ * This is used to blind transfer or vTeam transfer the task
140
+ * @param transferPayload
141
+ * @returns Promise<TaskResponse>
142
+ * @throws Error
143
+ * @example
144
+ * ```typescript
145
+ * const transferPayload = {
146
+ * to: 'myQueueId',
147
+ * destinationType: 'queue',
148
+ * }
149
+ * task.transfer(transferPayload).then(()=>{}).catch(()=>{});
150
+ * ```
151
+ */
152
+ transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
153
+ /**
154
+ * This is used to end the task.
155
+ * @returns Promise<TaskResponse>
156
+ * @throws Error
157
+ * @example
158
+ * ```typescript
159
+ * task.end().then(()=>{}).catch(()=>{})
160
+ * ```
161
+ */
162
+ end(): Promise<TaskResponse>;
163
+ /**
164
+ * This is used to wrap up the task.
165
+ * @param wrapupPayload - WrapupPayLoad
166
+ * @returns Promise<TaskResponse>
167
+ * @throws Error
168
+ * @example
169
+ * ```typescript
170
+ * task.wrapup(wrapupPayload).then(()=>{}).catch(()=>{})
171
+ * ```
172
+ */
173
+ wrapup(wrapupPayload: WrapupPayLoad): Promise<TaskResponse>;
174
+ }
175
+ export {};
@@ -0,0 +1,13 @@
1
+ import routingContact from './contact';
2
+ import WebCallingService from '../WebCallingService';
3
+ import AnswerCallOnWebexService from '../AnswerCallOnWebexService';
4
+ import Task from './Task';
5
+ import { TaskData } from './types';
6
+ import { ConfigFlags } from '../../types';
7
+ import { WrapupData } from '../config/types';
8
+ export default class TaskFactory {
9
+ /**
10
+ * Creates the correct Task subclass based on mediaType & loginOption
11
+ */
12
+ static createTask(contact: ReturnType<typeof routingContact>, webCallingService: WebCallingService, data: TaskData, configFlags: ConfigFlags, wrapupData?: WrapupData, agentId?: string, answerCallOnWebexService?: AnswerCallOnWebexService): Task;
13
+ }
@@ -1,4 +1,30 @@
1
1
  import { Interaction, ITask, TaskData } from './types';
2
+ import { TaskContext } from './state-machine/types';
3
+ /**
4
+ * Checks if the customer is still in the call (not left)
5
+ *
6
+ * @param interaction - The interaction object
7
+ * @param interactionId - The main interaction ID
8
+ * @returns true if customer is in the call
9
+ */
10
+ export declare const getIsCustomerInCall: (interaction: Interaction, interactionId: string) => boolean;
11
+ /**
12
+ * Gets the count of active agent participants in the conference
13
+ * Excludes Customer, Supervisor, and VVA participant types
14
+ *
15
+ * @param interaction - The interaction object
16
+ * @param interactionId - The main interaction ID
17
+ * @returns Number of active agent participants
18
+ */
19
+ export declare const getConferenceParticipantsCount: (interaction: Interaction, interactionId: string) => number;
20
+ /**
21
+ * Determines if a consult is actively in-progress for conference control gating.
22
+ * This is used to disable conference controls (End/Consult) only when a consult leg
23
+ * still exists outside the main call participants.
24
+ */
25
+ export declare const getIsConsultInProgressForConferenceControls: (interaction: Interaction | undefined, mainCallId: string | undefined, selfAgentId: string | undefined) => boolean;
26
+ export declare const getIsConsultedAgentForControls: (taskData: TaskData | null, context: TaskContext, isConsultingState: boolean) => boolean;
27
+ export declare const getServerHoldStateForControls: (context: TaskContext, mainCallId?: string, fallbackTaskData?: TaskData | null) => boolean | undefined;
2
28
  /**
3
29
  * Determines if the given agent is the primary agent (owner) of the task
4
30
  * @param task - The task to check
@@ -22,10 +48,15 @@ export declare const isParticipantInMainInteraction: (task: ITask, agentId: stri
22
48
  export declare const checkParticipantNotInInteraction: (task: ITask, agentId: string) => boolean;
23
49
  /**
24
50
  * Determines if a conference is currently in progress based on the number of active agent participants
25
- * @param TaskData - The payLoad data to check for conference status
51
+ * @param data - The task data to check for conference status
26
52
  * @returns true if there are 2 or more active agent participants in the main call, false otherwise
53
+ *
54
+ * For Agent B (consulted agent), their task's interactionId may be different from the main call.
55
+ * We use mainInteractionId from the interaction if available, otherwise fallback to interactionId.
27
56
  */
28
57
  export declare const getIsConferenceInProgress: (data: TaskData) => boolean;
58
+ /** EP-DN consult merged to conference before a second agent joins the main leg (CAI-8329). */
59
+ export declare const isEpDnConsultPendingConferenceMerge: (taskData: TaskData | undefined, selfAgentId: string | undefined) => boolean;
29
60
  /**
30
61
  * Checks if the current agent is a secondary agent in a consultation scenario.
31
62
  * Secondary agents are those who were consulted (not the original call owner).
@@ -36,10 +67,15 @@ export declare const isSecondaryAgent: (interaction: Interaction) => boolean;
36
67
  /**
37
68
  * Checks if the current agent is a secondary EP-DN (Entry Point Dial Number) agent.
38
69
  * This is specifically for telephony consultations to external numbers/entry points.
39
- * @param task - The task object containing interaction details
70
+ * @param interaction - The interaction object
40
71
  * @returns true if this is a secondary EP-DN agent in telephony consultation, false otherwise
41
72
  */
42
73
  export declare const isSecondaryEpDnAgent: (interaction: Interaction) => boolean;
74
+ /**
75
+ * Checks if the task belongs to a campaign preview interaction.
76
+ * Campaign preview ContactEnded events are terminal cleanup events and should not trigger wrapup.
77
+ */
78
+ export declare const isCampaignPreviewTask: (taskData?: TaskData | null) => boolean;
43
79
  /**
44
80
  * Checks if auto-answer is enabled for the agent participant
45
81
  * @param interaction - The interaction object
@@ -82,6 +118,16 @@ export declare const hasAgentInitiatedOutdial: (interaction: Interaction, agentI
82
118
  * @returns true if task should be auto-answered, false otherwise
83
119
  */
84
120
  export declare const shouldAutoAnswerTask: (taskData: TaskData, agentId: string, loginOption: string, webRtcEnabled: boolean) => boolean;
121
+ /**
122
+ * Gets the consult media resource ID for switch-call operations.
123
+ * Searches for the consult media leg in the interaction.
124
+ *
125
+ * @param interaction - The interaction object
126
+ * @param consultMediaResourceId - The consult media resource ID from task data
127
+ * @param agentId - Current agent ID
128
+ * @returns The consult media resource ID or undefined
129
+ */
130
+ export declare const getConsultMediaResourceId: (interaction: Interaction | undefined, consultMediaResourceId: string | undefined, agentId: string | undefined) => string | undefined;
85
131
  /**
86
132
  * Checks if a task is a campaign preview reservation that has not yet been accepted.
87
133
  * Campaign preview tasks should not trigger incoming call handling until the agent
@@ -0,0 +1,11 @@
1
+ import { TaskState } from './state-machine/constants';
2
+ export type WebexCallingDeviceDetails = {
3
+ deviceType: string;
4
+ deviceId: string;
5
+ deviceCallId: string;
6
+ };
7
+ export declare function getWebexCallingDeviceDetailsForAgent(agentId: string | undefined, participants: unknown): WebexCallingDeviceDetails | undefined;
8
+ export declare function isWebexCallingCallForAgent(agentId: string | undefined, participants: unknown): boolean;
9
+ /** Matches wxAppVoiceMethods.getWebexCallingCallId engaged semantics for uiControls. */
10
+ export declare function isWxAppEngagedForControls(enableWxBetterTogether: boolean, agentId: string | undefined, participants: unknown, state: TaskState): boolean;
11
+ export declare function decodedLineOwnerId(lineOwnerId?: string): string | undefined;
@@ -11,6 +11,8 @@ export declare const CONSULT = "/consult";
11
11
  export declare const CONSULT_ACCEPT = "/consult/accept";
12
12
  export declare const CONSULT_END = "/consult/end";
13
13
  export declare const TRANSFER = "/transfer";
14
+ /** Backend destination value for direct entry-point transfers through the vteam endpoint. */
15
+ export declare const ENTRY_POINT_TRANSFER_DESTINATION_TYPE = "entrypointDialNumber";
14
16
  export declare const CONSULT_TRANSFER = "/consult/transfer";
15
17
  export declare const PAUSE = "/record/pause";
16
18
  export declare const RESUME = "/record/resume";
@@ -21,6 +23,8 @@ export declare const CONFERENCE_EXIT = "/conference/exit";
21
23
  export declare const CONFERENCE_TRANSFER = "/conference/transfer";
22
24
  export declare const DIALER_API = "/v1/dialer";
23
25
  export declare const CAMPAIGN_PREVIEW_ACCEPT = "/accept";
26
+ export declare const CAMPAIGN_PREVIEW_SKIP = "/skip";
27
+ export declare const CAMPAIGN_PREVIEW_REMOVE = "/remove";
24
28
  /** 80-second timeout for accepting preview contact (outbound call setup takes longer than default 20s) */
25
29
  export declare const TIMEOUT_PREVIEW_ACCEPT = 80000;
26
30
  export declare const TASK_MANAGER_FILE = "taskManager";
@@ -44,6 +48,10 @@ export declare const PRESERVED_TASK_DATA_FIELDS: {
44
48
  * Used by reconcileData method to preserve important task state fields
45
49
  */
46
50
  export declare const KEYS_TO_NOT_DELETE: string[];
51
+ /**
52
+ * Consultation status constants derived from state machine
53
+ * These values are computed and available in task.data.consultStatus
54
+ */
47
55
  export declare const METHODS: {
48
56
  ACCEPT: string;
49
57
  TOGGLE_MUTE: string;
@@ -59,6 +67,7 @@ export declare const METHODS: {
59
67
  TRANSFER: string;
60
68
  CONSULT_TRANSFER: string;
61
69
  CONSULT_CONFERENCE: string;
70
+ DROP_CONFERENCE_PARTICIPANT: string;
62
71
  EXIT_CONFERENCE: string;
63
72
  TRANSFER_CONFERENCE: string;
64
73
  UPDATE_TASK_DATA: string;
@@ -73,6 +82,7 @@ export declare const METHODS: {
73
82
  GET_TASK_MANAGER: string;
74
83
  SETUP_AUTO_WRAPUP_TIMER: string;
75
84
  CANCEL_AUTO_WRAPUP_TIMER: string;
85
+ REQUEST_REAL_TIME_TRANSCRIPTS: string;
76
86
  };
77
87
  export declare const TRANSCRIPT_EVENT_MAP: {
78
88
  AgentContactAssigned: string;
@@ -60,6 +60,10 @@ export default function routingContact(aqm: AqmReqs): {
60
60
  interactionId: string;
61
61
  data: Contact.ConsultConferenceData;
62
62
  }>;
63
+ dropConferenceParticipant: import("../core/types").Res<Contact.AgentContact, {
64
+ interactionId: string;
65
+ participantId: string;
66
+ }>;
63
67
  exitConference: import("../core/types").Res<Contact.AgentContact, {
64
68
  interactionId: string;
65
69
  }>;
@@ -40,4 +40,34 @@ export default function aqmDialer(aqm: AqmReqs): {
40
40
  acceptPreviewContact: import("../core/types").Res<Contact.AgentContact, {
41
41
  data: Contact.PreviewContactPayload;
42
42
  }>;
43
+ /**
44
+ * Skips a campaign preview contact, requesting the next contact from the campaign.
45
+ *
46
+ * @param {Object} p - Parameters object.
47
+ * @param {Contact.PreviewContactPayload} p.data - Payload containing interactionId and campaignId.
48
+ * @returns {Promise<Contact.AgentContact>} A promise that resolves with agent contact on success.
49
+ *
50
+ * Emits:
51
+ * - `CC_EVENTS.CAMPAIGN_CONTACT_UPDATED` or `CC_EVENTS.CONTACT_ENDED` on success
52
+ * - `CC_EVENTS.CAMPAIGN_PREVIEW_SKIP_FAILED` on failure
53
+ * @ignore
54
+ */
55
+ skipPreviewContact: import("../core/types").Res<Contact.AgentContact, {
56
+ data: Contact.PreviewContactPayload;
57
+ }>;
58
+ /**
59
+ * Removes a campaign preview contact from the campaign list entirely.
60
+ *
61
+ * @param {Object} p - Parameters object.
62
+ * @param {Contact.PreviewContactPayload} p.data - Payload containing interactionId and campaignId.
63
+ * @returns {Promise<Contact.AgentContact>} A promise that resolves with agent contact on success.
64
+ *
65
+ * Emits:
66
+ * - `CC_EVENTS.CAMPAIGN_CONTACT_UPDATED` or `CC_EVENTS.CONTACT_ENDED` on success
67
+ * - `CC_EVENTS.CAMPAIGN_PREVIEW_REMOVE_FAILED` on failure
68
+ * @ignore
69
+ */
70
+ removePreviewContact: import("../core/types").Res<Contact.AgentContact, {
71
+ data: Contact.PreviewContactPayload;
72
+ }>;
43
73
  };
@@ -0,0 +1,22 @@
1
+ import { ConsultTransferDestinationConfig, IDigital, TaskResponse, TaskData } from '../types';
2
+ import { WrapupData } from '../../config/types';
3
+ import Task from '../Task';
4
+ import routingContact from '../contact';
5
+ export default class Digital extends Task implements IDigital {
6
+ constructor(contact: ReturnType<typeof routingContact>, data: TaskData, wrapupData?: WrapupData, agentId?: string, consultTransferConfig?: ConsultTransferDestinationConfig);
7
+ /**
8
+ * Refresh the digital task with the latest backend payload and recompute UI controls.
9
+ */
10
+ updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
11
+ /**
12
+ * This is used for incoming digital task accept by agent.
13
+ *
14
+ * @returns Promise<TaskResponse>
15
+ * @throws Error
16
+ * @example
17
+ * ```typescript
18
+ * task.accept().then(()=>{}).catch(()=>{})
19
+ * ```
20
+ */
21
+ accept(): Promise<TaskResponse>;
22
+ }