@webex/contact-center 3.12.0-next.8 → 3.12.0-task-refactor.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/AGENTS.md +438 -0
  2. package/ai-docs/README.md +131 -0
  3. package/ai-docs/RULES.md +455 -0
  4. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  5. package/ai-docs/patterns/testing-patterns.md +480 -0
  6. package/ai-docs/patterns/typescript-patterns.md +365 -0
  7. package/ai-docs/templates/README.md +102 -0
  8. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  9. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  10. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  11. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  12. package/ai-docs/templates/new-method/00-master.md +80 -0
  13. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  14. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  15. package/ai-docs/templates/new-method/03-tests.md +201 -0
  16. package/ai-docs/templates/new-method/04-validation.md +141 -0
  17. package/ai-docs/templates/new-service/00-master.md +109 -0
  18. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  19. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  20. package/ai-docs/templates/new-service/03-integration.md +178 -0
  21. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  22. package/ai-docs/templates/new-service/05-validation.md +145 -0
  23. package/dist/cc.js +65 -123
  24. package/dist/cc.js.map +1 -1
  25. package/dist/constants.js +13 -2
  26. package/dist/constants.js.map +1 -1
  27. package/dist/index.js +13 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/metrics/behavioral-events.js +26 -13
  30. package/dist/metrics/behavioral-events.js.map +1 -1
  31. package/dist/metrics/constants.js +7 -6
  32. package/dist/metrics/constants.js.map +1 -1
  33. package/dist/services/ApiAiAssistant.js +0 -3
  34. package/dist/services/ApiAiAssistant.js.map +1 -1
  35. package/dist/services/config/Util.js +2 -3
  36. package/dist/services/config/Util.js.map +1 -1
  37. package/dist/services/config/types.js +16 -14
  38. package/dist/services/config/types.js.map +1 -1
  39. package/dist/services/constants.js +0 -1
  40. package/dist/services/constants.js.map +1 -1
  41. package/dist/services/core/Err.js.map +1 -1
  42. package/dist/services/core/Utils.js +79 -55
  43. package/dist/services/core/Utils.js.map +1 -1
  44. package/dist/services/core/aqm-reqs.js +17 -92
  45. package/dist/services/core/aqm-reqs.js.map +1 -1
  46. package/dist/services/core/websocket/WebSocketManager.js +5 -25
  47. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  48. package/dist/services/core/websocket/types.js.map +1 -1
  49. package/dist/services/index.js +1 -2
  50. package/dist/services/index.js.map +1 -1
  51. package/dist/services/task/Task.js +644 -0
  52. package/dist/services/task/Task.js.map +1 -0
  53. package/dist/services/task/TaskFactory.js +45 -0
  54. package/dist/services/task/TaskFactory.js.map +1 -0
  55. package/dist/services/task/TaskManager.js +556 -532
  56. package/dist/services/task/TaskManager.js.map +1 -1
  57. package/dist/services/task/TaskUtils.js +132 -28
  58. package/dist/services/task/TaskUtils.js.map +1 -1
  59. package/dist/services/task/constants.js +7 -6
  60. package/dist/services/task/constants.js.map +1 -1
  61. package/dist/services/task/dialer.js +0 -51
  62. package/dist/services/task/dialer.js.map +1 -1
  63. package/dist/services/task/digital/Digital.js +77 -0
  64. package/dist/services/task/digital/Digital.js.map +1 -0
  65. package/dist/services/task/state-machine/TaskStateMachine.js +634 -0
  66. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  67. package/dist/services/task/state-machine/actions.js +366 -0
  68. package/dist/services/task/state-machine/actions.js.map +1 -0
  69. package/dist/services/task/state-machine/constants.js +139 -0
  70. package/dist/services/task/state-machine/constants.js.map +1 -0
  71. package/dist/services/task/state-machine/guards.js +256 -0
  72. package/dist/services/task/state-machine/guards.js.map +1 -0
  73. package/dist/services/task/state-machine/index.js +53 -0
  74. package/dist/services/task/state-machine/index.js.map +1 -0
  75. package/dist/services/task/state-machine/types.js +54 -0
  76. package/dist/services/task/state-machine/types.js.map +1 -0
  77. package/dist/services/task/state-machine/uiControlsComputer.js +369 -0
  78. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  79. package/dist/services/task/taskDataNormalizer.js +99 -0
  80. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  81. package/dist/services/task/types.js +157 -18
  82. package/dist/services/task/types.js.map +1 -1
  83. package/dist/services/task/voice/Voice.js +1031 -0
  84. package/dist/services/task/voice/Voice.js.map +1 -0
  85. package/dist/services/task/voice/WebRTC.js +149 -0
  86. package/dist/services/task/voice/WebRTC.js.map +1 -0
  87. package/dist/types/cc.d.ts +4 -33
  88. package/dist/types/constants.d.ts +13 -2
  89. package/dist/types/index.d.ts +11 -5
  90. package/dist/types/metrics/constants.d.ts +5 -3
  91. package/dist/types/services/ApiAiAssistant.d.ts +1 -1
  92. package/dist/types/services/config/types.d.ts +97 -25
  93. package/dist/types/services/core/Err.d.ts +0 -2
  94. package/dist/types/services/core/Utils.d.ts +25 -23
  95. package/dist/types/services/core/aqm-reqs.d.ts +0 -49
  96. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -1
  97. package/dist/types/services/core/websocket/connection-service.d.ts +0 -1
  98. package/dist/types/services/core/websocket/types.d.ts +1 -1
  99. package/dist/types/services/index.d.ts +1 -1
  100. package/dist/types/services/task/Task.d.ts +146 -0
  101. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  102. package/dist/types/services/task/TaskUtils.d.ts +39 -8
  103. package/dist/types/services/task/constants.d.ts +5 -4
  104. package/dist/types/services/task/dialer.d.ts +0 -15
  105. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  106. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +906 -0
  107. package/dist/types/services/task/state-machine/actions.d.ts +8 -0
  108. package/dist/types/services/task/state-machine/constants.d.ts +91 -0
  109. package/dist/types/services/task/state-machine/guards.d.ts +78 -0
  110. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  111. package/dist/types/services/task/state-machine/types.d.ts +256 -0
  112. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  113. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  114. package/dist/types/services/task/types.d.ts +539 -88
  115. package/dist/types/services/task/voice/Voice.d.ts +183 -0
  116. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  117. package/dist/types/types.d.ts +68 -0
  118. package/dist/types/webex.d.ts +1 -0
  119. package/dist/types.js +70 -0
  120. package/dist/types.js.map +1 -1
  121. package/dist/webex.js +14 -2
  122. package/dist/webex.js.map +1 -1
  123. package/package.json +14 -11
  124. package/src/cc.ts +91 -177
  125. package/src/constants.ts +13 -2
  126. package/src/index.ts +14 -5
  127. package/src/metrics/ai-docs/AGENTS.md +348 -0
  128. package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
  129. package/src/metrics/behavioral-events.ts +28 -14
  130. package/src/metrics/constants.ts +7 -8
  131. package/src/services/ApiAiAssistant.ts +2 -4
  132. package/src/services/agent/ai-docs/AGENTS.md +238 -0
  133. package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
  134. package/src/services/ai-docs/AGENTS.md +384 -0
  135. package/src/services/config/Util.ts +2 -3
  136. package/src/services/config/ai-docs/AGENTS.md +253 -0
  137. package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
  138. package/src/services/config/types.ts +108 -20
  139. package/src/services/constants.ts +0 -1
  140. package/src/services/core/Err.ts +0 -1
  141. package/src/services/core/Utils.ts +90 -67
  142. package/src/services/core/ai-docs/AGENTS.md +379 -0
  143. package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
  144. package/src/services/core/aqm-reqs.ts +22 -100
  145. package/src/services/core/websocket/WebSocketManager.ts +4 -23
  146. package/src/services/core/websocket/types.ts +1 -1
  147. package/src/services/index.ts +1 -2
  148. package/src/services/task/Task.ts +785 -0
  149. package/src/services/task/TaskFactory.ts +55 -0
  150. package/src/services/task/TaskManager.ts +567 -633
  151. package/src/services/task/TaskUtils.ts +175 -31
  152. package/src/services/task/ai-docs/AGENTS.md +448 -0
  153. package/src/services/task/ai-docs/ARCHITECTURE.md +573 -0
  154. package/src/services/task/constants.ts +5 -4
  155. package/src/services/task/dialer.ts +1 -56
  156. package/src/services/task/digital/Digital.ts +95 -0
  157. package/src/services/task/state-machine/TaskStateMachine.ts +793 -0
  158. package/src/services/task/state-machine/actions.ts +409 -0
  159. package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
  160. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
  161. package/src/services/task/state-machine/constants.ts +150 -0
  162. package/src/services/task/state-machine/guards.ts +295 -0
  163. package/src/services/task/state-machine/index.ts +28 -0
  164. package/src/services/task/state-machine/types.ts +228 -0
  165. package/src/services/task/state-machine/uiControlsComputer.ts +529 -0
  166. package/src/services/task/taskDataNormalizer.ts +137 -0
  167. package/src/services/task/types.ts +641 -95
  168. package/src/services/task/voice/Voice.ts +1255 -0
  169. package/src/services/task/voice/WebRTC.ts +187 -0
  170. package/src/types.ts +88 -5
  171. package/src/utils/AGENTS.md +276 -0
  172. package/src/webex.js +2 -0
  173. package/test/unit/spec/cc.ts +59 -142
  174. package/test/unit/spec/logger-proxy.ts +70 -0
  175. package/test/unit/spec/services/ApiAiAssistant.ts +17 -0
  176. package/test/unit/spec/services/config/index.ts +26 -55
  177. package/test/unit/spec/services/core/Utils.ts +103 -52
  178. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +48 -112
  179. package/test/unit/spec/services/core/websocket/connection-service.ts +5 -4
  180. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  181. package/test/unit/spec/services/task/Task.ts +416 -0
  182. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  183. package/test/unit/spec/services/task/TaskManager.ts +781 -1735
  184. package/test/unit/spec/services/task/TaskUtils.ts +125 -0
  185. package/test/unit/spec/services/task/dialer.ts +112 -198
  186. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  187. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +473 -0
  188. package/test/unit/spec/services/task/state-machine/guards.ts +288 -0
  189. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  190. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +147 -0
  191. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  192. package/test/unit/spec/services/task/voice/Voice.ts +587 -0
  193. package/test/unit/spec/services/task/voice/WebRTC.ts +242 -0
  194. package/umd/contact-center.min.js +2 -2
  195. package/umd/contact-center.min.js.map +1 -1
  196. package/dist/services/task/index.js +0 -1525
  197. package/dist/services/task/index.js.map +0 -1
  198. package/dist/types/services/task/index.d.ts +0 -650
  199. package/src/services/task/index.ts +0 -1801
  200. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -58,6 +58,8 @@ export declare const CC_TASK_EVENTS: {
58
58
  readonly AGENT_CONFERENCE_TRANSFER_FAILED: "AgentConferenceTransferFailed";
59
59
  /** Event emitted for post-call activity by participant */
60
60
  readonly PARTICIPANT_POST_CALL_ACTIVITY: "ParticipantPostCallActivity";
61
+ /** Event emitted when consulted participant is being moved/transferred */
62
+ readonly CONSULTED_PARTICIPANT_MOVING: "ConsultedParticipantMoving";
61
63
  /** Event emitted when contact is blind transferred */
62
64
  readonly AGENT_BLIND_TRANSFERRED: "AgentBlindTransferred";
63
65
  /** Event emitted when blind transfer fails */
@@ -74,6 +76,8 @@ export declare const CC_TASK_EVENTS: {
74
76
  readonly AGENT_CONSULT_TRANSFER_FAILED: "AgentConsultTransferFailed";
75
77
  /** Event emitted when contact recording is paused */
76
78
  readonly CONTACT_RECORDING_PAUSED: "ContactRecordingPaused";
79
+ /** Event emitted when contact recording is started */
80
+ readonly CONTACT_RECORDING_STARTED: "ContactRecordingStarted";
77
81
  /** Event emitted when pausing contact recording fails */
78
82
  readonly CONTACT_RECORDING_PAUSE_FAILED: "ContactRecordingPauseFailed";
79
83
  /** Event emitted when contact recording is resumed */
@@ -84,6 +88,10 @@ export declare const CC_TASK_EVENTS: {
84
88
  readonly CONTACT_ENDED: "ContactEnded";
85
89
  /** Event emitted when contact is merged */
86
90
  readonly CONTACT_MERGED: "ContactMerged";
91
+ /** Event emitted when contact payload is updated (routing updates) */
92
+ readonly CONTACT_UPDATED: "ContactUpdated";
93
+ /** Event emitted when contact owner changes */
94
+ readonly CONTACT_OWNER_CHANGED: "ContactOwnerChanged";
87
95
  /** Event emitted when ending contact fails */
88
96
  readonly AGENT_CONTACT_END_FAILED: "AgentContactEndFailed";
89
97
  /** Event emitted when agent enters wrap-up state */
@@ -104,12 +112,6 @@ export declare const CC_TASK_EVENTS: {
104
112
  readonly AGENT_CONTACT_UNASSIGNED: "AgentContactUnassigned";
105
113
  /** Event emitted when inviting agent fails */
106
114
  readonly AGENT_INVITE_FAILED: "AgentInviteFailed";
107
- /** Event emitted when a campaign preview contact is offered to the agent */
108
- readonly AGENT_OFFER_CAMPAIGN_RESERVATION: "AgentOfferCampaignReservation";
109
- /** Event emitted when campaign contact is updated */
110
- readonly CAMPAIGN_CONTACT_UPDATED: "CampaignContactUpdated";
111
- /** Event emitted when accepting a campaign preview contact fails */
112
- readonly CAMPAIGN_PREVIEW_ACCEPT_FAILED: "CampaignPreviewAcceptFailed";
113
115
  /** Event emitted when a real-time transcript chunk is received */
114
116
  readonly REAL_TIME_TRANSCRIPTION: "REAL_TIME_TRANSCRIPTION";
115
117
  };
@@ -215,6 +217,8 @@ export declare const CC_EVENTS: {
215
217
  readonly AGENT_CONFERENCE_TRANSFER_FAILED: "AgentConferenceTransferFailed";
216
218
  /** Event emitted for post-call activity by participant */
217
219
  readonly PARTICIPANT_POST_CALL_ACTIVITY: "ParticipantPostCallActivity";
220
+ /** Event emitted when consulted participant is being moved/transferred */
221
+ readonly CONSULTED_PARTICIPANT_MOVING: "ConsultedParticipantMoving";
218
222
  /** Event emitted when contact is blind transferred */
219
223
  readonly AGENT_BLIND_TRANSFERRED: "AgentBlindTransferred";
220
224
  /** Event emitted when blind transfer fails */
@@ -231,6 +235,8 @@ export declare const CC_EVENTS: {
231
235
  readonly AGENT_CONSULT_TRANSFER_FAILED: "AgentConsultTransferFailed";
232
236
  /** Event emitted when contact recording is paused */
233
237
  readonly CONTACT_RECORDING_PAUSED: "ContactRecordingPaused";
238
+ /** Event emitted when contact recording is started */
239
+ readonly CONTACT_RECORDING_STARTED: "ContactRecordingStarted";
234
240
  /** Event emitted when pausing contact recording fails */
235
241
  readonly CONTACT_RECORDING_PAUSE_FAILED: "ContactRecordingPauseFailed";
236
242
  /** Event emitted when contact recording is resumed */
@@ -241,6 +247,10 @@ export declare const CC_EVENTS: {
241
247
  readonly CONTACT_ENDED: "ContactEnded";
242
248
  /** Event emitted when contact is merged */
243
249
  readonly CONTACT_MERGED: "ContactMerged";
250
+ /** Event emitted when contact payload is updated (routing updates) */
251
+ readonly CONTACT_UPDATED: "ContactUpdated";
252
+ /** Event emitted when contact owner changes */
253
+ readonly CONTACT_OWNER_CHANGED: "ContactOwnerChanged";
244
254
  /** Event emitted when ending contact fails */
245
255
  readonly AGENT_CONTACT_END_FAILED: "AgentContactEndFailed";
246
256
  /** Event emitted when agent enters wrap-up state */
@@ -261,12 +271,6 @@ export declare const CC_EVENTS: {
261
271
  readonly AGENT_CONTACT_UNASSIGNED: "AgentContactUnassigned";
262
272
  /** Event emitted when inviting agent fails */
263
273
  readonly AGENT_INVITE_FAILED: "AgentInviteFailed";
264
- /** Event emitted when a campaign preview contact is offered to the agent */
265
- readonly AGENT_OFFER_CAMPAIGN_RESERVATION: "AgentOfferCampaignReservation";
266
- /** Event emitted when campaign contact is updated */
267
- readonly CAMPAIGN_CONTACT_UPDATED: "CampaignContactUpdated";
268
- /** Event emitted when accepting a campaign preview contact fails */
269
- readonly CAMPAIGN_PREVIEW_ACCEPT_FAILED: "CampaignPreviewAcceptFailed";
270
274
  /** Event emitted when a real-time transcript chunk is received */
271
275
  readonly REAL_TIME_TRANSCRIPTION: "REAL_TIME_TRANSCRIPTION";
272
276
  /** Welcome event when agent connects to websocket/backend */
@@ -314,6 +318,14 @@ export type WelcomeEvent = {
314
318
  /** ID of the agent that connected */
315
319
  agentId: string;
316
320
  };
321
+ /**
322
+ * Available login options for voice channel access
323
+ * 'AGENT_DN' - Login using agent's DN
324
+ * 'EXTENSION' - Login using extension number
325
+ * 'BROWSER' - Login using browser-based WebRTC
326
+ * @public
327
+ */
328
+ export type LoginOption = 'AGENT_DN' | 'EXTENSION' | 'BROWSER';
317
329
  /**
318
330
  * Response type for welcome events which can be either success or error
319
331
  * @public
@@ -391,6 +403,26 @@ export type AgentResponse = {
391
403
  * Represents the response from getDesktopProfileById method.
392
404
  */
393
405
  export type DesktopProfileResponse = {
406
+ /**
407
+ * Unique identifier of the agent profile configuration.
408
+ */
409
+ id: string;
410
+ /**
411
+ * Display name for the agent profile.
412
+ */
413
+ name: string;
414
+ /**
415
+ * Description of the agent profile.
416
+ */
417
+ description: string;
418
+ /**
419
+ * Parent entity type for the profile (for example ORGANIZATION).
420
+ */
421
+ parentType: string;
422
+ /**
423
+ * Indicates whether screen pop is enabled.
424
+ */
425
+ screenPopup: boolean;
394
426
  /**
395
427
  * Represents the voice options of an agent.
396
428
  */
@@ -423,6 +455,10 @@ export type DesktopProfileResponse = {
423
455
  * Auto wrap-up allowed.
424
456
  */
425
457
  autoWrapUp: boolean;
458
+ /**
459
+ * Whether the agent personal greeting is enabled.
460
+ */
461
+ agentPersonalGreeting: boolean;
426
462
  /**
427
463
  * Auto answer allowed.
428
464
  */
@@ -439,6 +475,30 @@ export type DesktopProfileResponse = {
439
475
  * Allow auto wrap-up extension.
440
476
  */
441
477
  allowAutoWrapUpExtension: boolean;
478
+ /**
479
+ * Access control for queues assigned to the agent (ALL or SPECIFIC).
480
+ */
481
+ accessQueue: string;
482
+ /**
483
+ * Queue identifiers available to the agent when access is SPECIFIC.
484
+ */
485
+ queues: string[];
486
+ /**
487
+ * Access control for entry points assigned to the agent.
488
+ */
489
+ accessEntryPoint: string;
490
+ /**
491
+ * Entry point identifiers available to the agent when access is SPECIFIC.
492
+ */
493
+ entryPoints: string[];
494
+ /**
495
+ * Access control for buddy teams assigned to the agent.
496
+ */
497
+ accessBuddyTeam: string;
498
+ /**
499
+ * Buddy team identifiers available to the agent when access is SPECIFIC.
500
+ */
501
+ buddyTeams: string[];
442
502
  /**
443
503
  * Outdial enabled for the agent.
444
504
  */
@@ -475,6 +535,10 @@ export type DesktopProfileResponse = {
475
535
  * Agent DN validation of the agent.
476
536
  */
477
537
  agentDNValidation: string;
538
+ /**
539
+ * Additional DN validation criteria configured for the agent.
540
+ */
541
+ agentDNValidationCriterions: string[];
478
542
  /**
479
543
  * Dial plans of the agent.
480
544
  */
@@ -503,6 +567,26 @@ export type DesktopProfileResponse = {
503
567
  * State synchronization in Webex enabled or not.
504
568
  */
505
569
  stateSynchronizationWebex: boolean;
570
+ /**
571
+ * Threshold rules configured for the agent profile.
572
+ */
573
+ thresholdRules: Array<Record<string, string | number>>;
574
+ /**
575
+ * Whether the agent profile is currently active.
576
+ */
577
+ active: boolean;
578
+ /**
579
+ * Whether this profile is the system default.
580
+ */
581
+ systemDefault: boolean;
582
+ /**
583
+ * Timestamp when the profile was created.
584
+ */
585
+ createdTime: number;
586
+ /**
587
+ * Timestamp when the profile was last updated.
588
+ */
589
+ lastUpdatedTime: number;
506
590
  };
507
591
  /**
508
592
  * Response containing multimedia profile configuration for an agent
@@ -658,8 +742,6 @@ export type OrgInfo = {
658
742
  tenantId: string;
659
743
  /** Organization timezone */
660
744
  timezone: string;
661
- /** Current environment (e.g., 'produs1', 'intgus1') */
662
- environment: string;
663
745
  };
664
746
  /**
665
747
  * Organization-wide feature settings and configurations
@@ -898,14 +980,6 @@ export type WrapupData = {
898
980
  allowCancelAutoWrapup?: boolean;
899
981
  };
900
982
  };
901
- /**
902
- * Available login options for voice channel access
903
- * 'AGENT_DN' - Login using agent's DN
904
- * 'EXTENSION' - Login using extension number
905
- * 'BROWSER' - Login using browser-based WebRTC
906
- * @public
907
- */
908
- export type LoginOption = 'AGENT_DN' | 'EXTENSION' | 'BROWSER';
909
983
  /**
910
984
  * Team configuration information
911
985
  * @public
@@ -1073,7 +1147,7 @@ export type Profile = {
1073
1147
  /** Outbound entry point */
1074
1148
  outDialEp: string;
1075
1149
  /** Whether ending calls is enabled */
1076
- isEndCallEnabled: boolean;
1150
+ isEndTaskEnabled: boolean;
1077
1151
  /** Whether ending consultations is enabled */
1078
1152
  isEndConsultEnabled: boolean;
1079
1153
  /** Optional lifecycle manager URL */
@@ -1120,8 +1194,6 @@ export type Profile = {
1120
1194
  isAnalyzerEnabled?: boolean;
1121
1195
  /** Tenant timezone */
1122
1196
  tenantTimezone?: string;
1123
- /** Current environment (e.g., 'produs1', 'intgus1') */
1124
- environment?: string;
1125
1197
  /** Available voice login options */
1126
1198
  loginVoiceOptions?: LoginOption[];
1127
1199
  /** Current login device type */
@@ -65,8 +65,6 @@ export type TaskErrorIds = {
65
65
  'Service.aqm.task.resumeRecording': Failure;
66
66
  } | {
67
67
  'Service.aqm.dialer.startOutdial': Failure;
68
- } | {
69
- 'Service.aqm.dialer.acceptPreviewContact': Failure;
70
68
  } | {
71
69
  'Service.reqs.generic.failure': {
72
70
  trackingId: string;
@@ -1,19 +1,8 @@
1
1
  import * as Err from './Err';
2
2
  import { LoginOption, WebexRequestPayload } from '../../types';
3
3
  import { Failure, AugmentedError } from './GlobalTypes';
4
- import { TaskData, ConsultTransferPayLoad, Interaction } from '../task/types';
5
- import { DialPlan } from '../config/types';
6
- export declare const FALLBACK_DIAL_NUMBER_REGEX: RegExp;
7
- /**
8
- * Validates a dial number against the provided dial plan regex patterns.
9
- * A number is valid if it matches at least one regex pattern in the dial plans.
10
- * Falls back to US/Canada regex validation if no dial plan entries are configured.
11
- *
12
- * @param input - The dial number to validate
13
- * @param dialPlanEntries - Array of dial plan entries containing regex patterns
14
- * @returns true if the input matches at least one dial plan regex pattern, false otherwise
15
- */
16
- export declare const isValidDialNumber: (input: string, dialPlanEntries: DialPlan['dialPlanEntity']) => boolean;
4
+ import { ConsultConferenceData, consultConferencePayloadData, ConsultTransferDestinationType, TaskData, Interaction } from '../task/types';
5
+ export declare const isValidDialNumber: (input: string) => boolean;
17
6
  export declare const getStationLoginErrorData: (failure: Failure, loginOption: LoginOption) => {
18
7
  message: any;
19
8
  fieldName: any;
@@ -61,15 +50,7 @@ export declare const generateTaskErrorObject: (error: any, methodName: string, m
61
50
  * @ignore
62
51
  */
63
52
  export declare const createErrDetailsObject: (errObj: WebexRequestPayload) => Err.Details<"Service.reqs.generic.failure">;
64
- /**
65
- * Gets the consulted agent ID from the media object by finding the agent
66
- * in the consult media participants (excluding the current agent).
67
- *
68
- * @param media - The media object from the interaction
69
- * @param agentId - The current agent's ID to exclude from the search
70
- * @returns The consulted agent ID, or empty string if none found
71
- */
72
- export declare const getConsultedAgentId: (media: Interaction['media'], agentId: string) => string;
53
+ export declare const getConsultedAgentId: (media: Interaction["media"], agentId: string) => string;
73
54
  /**
74
55
  * Gets the destination agent ID for CBT (Capacity Based Team) scenarios.
75
56
  * CBT refers to teams created in Control Hub with capacity-based routing
@@ -98,4 +79,25 @@ export declare const calculateDestAgentId: (interaction: Interaction, agentId: s
98
79
  * @returns The destination agent ID for determining destination type
99
80
  */
100
81
  export declare const calculateDestType: (interaction: Interaction, agentId: string) => string;
101
- export declare const deriveConsultTransferDestinationType: (taskData?: TaskData) => ConsultTransferPayLoad['destinationType'];
82
+ /**
83
+ * Gets the destination agent ID from participants.
84
+ * Finds a participant who is not the current agent and is an agent type.
85
+ *
86
+ * @param participants - The participants object from interaction
87
+ * @param agentId - The current agent's ID
88
+ * @returns The destination agent ID, or undefined if none found
89
+ */
90
+ export declare const buildConsultConferenceParamData: (dataPassed: consultConferencePayloadData, interactionIdPassed: string) => {
91
+ interactionId: string;
92
+ data: ConsultConferenceData;
93
+ };
94
+ /**
95
+ * Derives the consult transfer destination type based on task data.
96
+ * This function determines the appropriate destination type for a consult transfer
97
+ * by examining the destination type stored in the task data.
98
+ *
99
+ * @param taskData - The task data containing destination information
100
+ * @returns The derived consult transfer destination type
101
+ * @public
102
+ */
103
+ export declare const deriveConsultTransferDestinationType: (taskData: TaskData) => ConsultTransferDestinationType;
@@ -6,60 +6,11 @@ export default class AqmReqs {
6
6
  private webexRequest;
7
7
  private webSocketManager;
8
8
  constructor(webSocketManager: WebSocketManager);
9
- /**
10
- * Creates a request function for an API call with parameters
11
- * @param c - The configuration for the request
12
- * @returns A function that makes the API request
13
- */
14
9
  req<TRes, TErr, TReq>(c: Conf<TRes, TErr, TReq>): Res<TRes, TReq>;
15
- /**
16
- * Creates a request function for an API call with no parameters
17
- * @param c - The configuration for the request
18
- * @returns A function that makes the API request
19
- */
20
10
  reqEmpty<TRes, TErr>(c: ConfEmpty<TRes, TErr>): ResEmpty<TRes>;
21
- /**
22
- * Makes an API request
23
- * @param c - The request configuration
24
- * @param cbRes - The callback for the response
25
- * @returns A promise that resolves with the response or rejects with an error
26
- */
27
11
  private makeAPIRequest;
28
- /**
29
- * Creates a promise for an API request
30
- * @param c - The request configuration
31
- * @param cbRes - The callback for the response
32
- * @returns A promise that resolves with the response or rejects with an error
33
- */
34
12
  private createPromise;
35
- /**
36
- * Converts a bind object to a string representation
37
- * @param bind - The bind object to convert
38
- * @returns A string representation of the bind object
39
- */
40
13
  private bindPrint;
41
- /**
42
- * Checks if a message matches a bind object
43
- * @param bind - The bind object to check against
44
- * @param msg - The message to check
45
- * @returns True if the message matches the bind object, false otherwise
46
- */
47
14
  private bindCheck;
48
- /**
49
- * Checks type-dependent field conditions defined in __typeMap.
50
- * @param typeMap - The type map to check against
51
- * @param msg - The message to check
52
- * @returns True if the message matches the type map, false otherwise
53
- * The typeMap has the shape:
54
- * { typeField: "type", conditions: { EventA: { field: value }, EventB: { field: value } } }
55
- * It reads msg[typeField] to determine which condition set to apply,
56
- * then verifies all fields in that condition match the message.
57
- */
58
- private static typeMapCheck;
59
- /**
60
- * Handles incoming messages from the WebSocket (must be a lambda fn)
61
- * @param msg - The message to handle
62
- * @returns
63
- */
64
15
  private readonly onMessage;
65
16
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import EventEmitter from 'events';
3
2
  import { WebexSDK, SubscribeRequest } from '../../../types';
4
3
  import { ConnectionLostDetails } from './types';
@@ -33,3 +32,4 @@ export declare class WebSocketManager extends EventEmitter {
33
32
  private connect;
34
33
  private webSocketOnCloseHandler;
35
34
  }
35
+ export default WebSocketManager;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'events';
3
2
  import { ConnectionServiceOptions, ConnectionProp } from './types';
4
3
  export declare class ConnectionService extends EventEmitter {
@@ -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,146 @@
1
+ import { EventEmitter } from 'events';
2
+ import type { ActorRefFrom, SnapshotFrom } from 'xstate';
3
+ import { ITask, TaskData, TaskResponse, WrapupPayLoad, TaskId, TransferPayLoad, TASK_EVENTS, TaskUIControls, ConsultEndPayload, ConsultPayload, ConsultTransferPayLoad, ResumeRecordingPayload, CallId } from './types';
4
+ import routingContact from './contact';
5
+ import MetricsManager from '../../metrics/MetricsManager';
6
+ import { TaskState } from './state-machine';
7
+ import type { TaskEventPayload, TaskStateMachine, UIControlConfig, TaskActionsMap, TaskActionArgs } from './state-machine';
8
+ import AutoWrapup from './AutoWrapup';
9
+ import { WrapupData } from '../config/types';
10
+ type UIControlConfigInput = Omit<UIControlConfig, 'channelType'> & {
11
+ channelType?: UIControlConfig['channelType'];
12
+ };
13
+ export default abstract class Task extends EventEmitter implements ITask {
14
+ protected contact: ReturnType<typeof routingContact>;
15
+ protected metricsManager: MetricsManager;
16
+ stateMachineService?: ActorRefFrom<TaskStateMachine>;
17
+ data: TaskData;
18
+ webCallMap: Record<TaskId, CallId>;
19
+ state?: SnapshotFrom<TaskStateMachine>;
20
+ private lastState?;
21
+ protected currentUiControls: TaskUIControls;
22
+ protected uiControlConfig: UIControlConfig;
23
+ protected wrapupData?: WrapupData;
24
+ autoWrapup?: AutoWrapup;
25
+ protected agentId?: string;
26
+ constructor(contact: ReturnType<typeof routingContact>, data: TaskData, uiControlConfig: UIControlConfigInput, wrapupData?: WrapupData, agentId?: string);
27
+ private static resolveChannelType;
28
+ abstract accept(): Promise<TaskResponse>;
29
+ decline(): Promise<TaskResponse>;
30
+ pauseRecording(): Promise<TaskResponse>;
31
+ resumeRecording(resumeRecordingPayload: ResumeRecordingPayload): Promise<TaskResponse>;
32
+ consult(consultPayload: ConsultPayload): Promise<TaskResponse>;
33
+ endConsult(consultEndPayload: ConsultEndPayload): Promise<TaskResponse>;
34
+ consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
35
+ consultConference(): Promise<TaskResponse>;
36
+ exitConference(): Promise<TaskResponse>;
37
+ transferConference(): Promise<TaskResponse>;
38
+ switchCall(): Promise<TaskResponse>;
39
+ toggleMute(): Promise<void>;
40
+ unregisterWebCallListeners(): void;
41
+ /**
42
+ * Cancel any in-progress auto wrap-up timer.
43
+ * Base implementation just clears the timer reference so subclasses inherit the behavior.
44
+ */
45
+ cancelAutoWrapupTimer(): void;
46
+ hold(): Promise<TaskResponse>;
47
+ resume(): Promise<TaskResponse>;
48
+ holdResume(): Promise<TaskResponse>;
49
+ /**
50
+ * Latest UI controls derived from state machine state and context.
51
+ */
52
+ get uiControls(): TaskUIControls;
53
+ protected updateUiControls(forceEmit?: boolean): void;
54
+ /**
55
+ * Initialize the state machine
56
+ */
57
+ private initializeStateMachine;
58
+ /**
59
+ * Send an event to the state machine
60
+ */
61
+ sendStateMachineEvent(event: TaskEventPayload): void;
62
+ /**
63
+ * Get the current state machine state
64
+ */
65
+ protected getCurrentState(): TaskState | undefined;
66
+ /**
67
+ * Compute UI controls based on current state machine state.
68
+ *
69
+ * @returns UI control states for all task actions
70
+ */
71
+ protected computeUIControls(): TaskUIControls;
72
+ /**
73
+ * Stop the state machine service
74
+ */
75
+ protected stopStateMachine(): void;
76
+ private static extractTaskDataFromEvent;
77
+ private autoAnswerIfNeeded;
78
+ private updateTaskFromEvent;
79
+ protected getStateMachineActionOverrides(): Partial<TaskActionsMap>;
80
+ protected getChannelSpecificActionOverrides(): Partial<TaskActionsMap>;
81
+ protected createEmitSelfAction(taskEvent: TASK_EVENTS, { updateTaskData }?: {
82
+ updateTaskData?: boolean;
83
+ }): ({ event }: TaskActionArgs) => void;
84
+ private getCommonActionOverrides;
85
+ /**
86
+ * Sets up the automatic wrap-up timer if wrap-up is required
87
+ */
88
+ protected setupAutoWrapupTimer(): void;
89
+ /**
90
+ * Cancels the automatic wrap-up timer if it's running
91
+ */
92
+ private reconcileData;
93
+ /**
94
+ *
95
+ * @param methodName - The name of the method that is unsupported
96
+ * @throws Error
97
+ */
98
+ protected unsupportedMethodError(methodName: string): void;
99
+ /**
100
+ * This method is used to update the task data.
101
+ * @param updatedData - TaskData
102
+ * @param shouldOverwrite - boolean
103
+ * @example
104
+ * ```typescript
105
+ * task.updateTaskData(updatedData, true);
106
+ * ```
107
+ */
108
+ updateTaskData(updatedData: TaskData, shouldOverwrite?: boolean): ITask;
109
+ /**
110
+ * This is used to blind transfer or vTeam transfer the task
111
+ * @param transferPayload
112
+ * @returns Promise<TaskResponse>
113
+ * @throws Error
114
+ * @example
115
+ * ```typescript
116
+ * const transferPayload = {
117
+ * to: 'myQueueId',
118
+ * destinationType: 'queue',
119
+ * }
120
+ * task.transfer(transferPayload).then(()=>{}).catch(()=>{});
121
+ * ```
122
+ */
123
+ transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
124
+ /**
125
+ * This is used to end the task.
126
+ * @returns Promise<TaskResponse>
127
+ * @throws Error
128
+ * @example
129
+ * ```typescript
130
+ * task.end().then(()=>{}).catch(()=>{})
131
+ * ```
132
+ */
133
+ end(): Promise<TaskResponse>;
134
+ /**
135
+ * This is used to wrap up the task.
136
+ * @param wrapupPayload - WrapupPayLoad
137
+ * @returns Promise<TaskResponse>
138
+ * @throws Error
139
+ * @example
140
+ * ```typescript
141
+ * task.wrapup(wrapupPayload).then(()=>{}).catch(()=>{})
142
+ * ```
143
+ */
144
+ wrapup(wrapupPayload: WrapupPayLoad): Promise<TaskResponse>;
145
+ }
146
+ export {};
@@ -0,0 +1,12 @@
1
+ import routingContact from './contact';
2
+ import WebCallingService from '../WebCallingService';
3
+ import Task from './Task';
4
+ import { TaskData } from './types';
5
+ import { ConfigFlags } from '../../types';
6
+ import { WrapupData } from '../config/types';
7
+ export default class TaskFactory {
8
+ /**
9
+ * Creates the correct Task subclass based on mediaType & loginOption
10
+ */
11
+ static createTask(contact: ReturnType<typeof routingContact>, webCallingService: WebCallingService, data: TaskData, configFlags: ConfigFlags, wrapupData?: WrapupData, agentId?: string): Task;
12
+ }
@@ -1,4 +1,30 @@
1
1
  import { Interaction, ITask, TaskData } from './types';
2
+ import { TaskContext } from './state-machine/types';
3
+ /**
4
+ * Checks if the customer is still in the call (not left)
5
+ *
6
+ * @param interaction - The interaction object
7
+ * @param interactionId - The main interaction ID
8
+ * @returns true if customer is in the call
9
+ */
10
+ export declare const getIsCustomerInCall: (interaction: Interaction, interactionId: string) => boolean;
11
+ /**
12
+ * Gets the count of active agent participants in the conference
13
+ * Excludes Customer, Supervisor, and VVA participant types
14
+ *
15
+ * @param interaction - The interaction object
16
+ * @param interactionId - The main interaction ID
17
+ * @returns Number of active agent participants
18
+ */
19
+ export declare const getConferenceParticipantsCount: (interaction: Interaction, interactionId: string) => number;
20
+ /**
21
+ * Determines if a consult is actively in-progress for conference control gating.
22
+ * This is used to disable conference controls (End/Consult) only when a consult leg
23
+ * still exists outside the main call participants.
24
+ */
25
+ export declare const getIsConsultInProgressForConferenceControls: (interaction: Interaction | undefined, mainCallId: string | undefined, selfAgentId: string | undefined) => boolean;
26
+ export declare const getIsConsultedAgentForControls: (taskData: TaskData | null, context: TaskContext, isConsultingState: boolean) => boolean;
27
+ export declare const getServerHoldStateForControls: (context: TaskContext, mainCallId?: string, fallbackTaskData?: TaskData | null) => boolean | undefined;
2
28
  /**
3
29
  * Determines if the given agent is the primary agent (owner) of the task
4
30
  * @param task - The task to check
@@ -22,8 +48,11 @@ export declare const isParticipantInMainInteraction: (task: ITask, agentId: stri
22
48
  export declare const checkParticipantNotInInteraction: (task: ITask, agentId: string) => boolean;
23
49
  /**
24
50
  * Determines if a conference is currently in progress based on the number of active agent participants
25
- * @param TaskData - The payLoad data to check for conference status
51
+ * @param data - The task data to check for conference status
26
52
  * @returns true if there are 2 or more active agent participants in the main call, false otherwise
53
+ *
54
+ * For Agent B (consulted agent), their task's interactionId may be different from the main call.
55
+ * We use mainInteractionId from the interaction if available, otherwise fallback to interactionId.
27
56
  */
28
57
  export declare const getIsConferenceInProgress: (data: TaskData) => boolean;
29
58
  /**
@@ -36,7 +65,7 @@ export declare const isSecondaryAgent: (interaction: Interaction) => boolean;
36
65
  /**
37
66
  * Checks if the current agent is a secondary EP-DN (Entry Point Dial Number) agent.
38
67
  * This is specifically for telephony consultations to external numbers/entry points.
39
- * @param task - The task object containing interaction details
68
+ * @param interaction - The interaction object
40
69
  * @returns true if this is a secondary EP-DN agent in telephony consultation, false otherwise
41
70
  */
42
71
  export declare const isSecondaryEpDnAgent: (interaction: Interaction) => boolean;
@@ -83,10 +112,12 @@ export declare const hasAgentInitiatedOutdial: (interaction: Interaction, agentI
83
112
  */
84
113
  export declare const shouldAutoAnswerTask: (taskData: TaskData, agentId: string, loginOption: string, webRtcEnabled: boolean) => boolean;
85
114
  /**
86
- * Checks if a task is a campaign preview reservation that has not yet been accepted.
87
- * Campaign preview tasks should not trigger incoming call handling until the agent
88
- * explicitly accepts the preview contact.
89
- * @param task - The task to check
90
- * @returns true if the task is a pending campaign preview reservation, false otherwise
115
+ * Gets the consult media resource ID for switch-call operations.
116
+ * Searches for the consult media leg in the interaction.
117
+ *
118
+ * @param interaction - The interaction object
119
+ * @param consultMediaResourceId - The consult media resource ID from task data
120
+ * @param agentId - Current agent ID
121
+ * @returns The consult media resource ID or undefined
91
122
  */
92
- export declare const isCampaignPreviewReservation: (task: ITask) => boolean;
123
+ export declare const getConsultMediaResourceId: (interaction: Interaction | undefined, consultMediaResourceId: string | undefined, agentId: string | undefined) => string | undefined;