@webex/contact-center 3.12.0-next.73 → 3.12.0-next.74

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 (188) 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 +53 -38
  24. package/dist/cc.js.map +1 -1
  25. package/dist/config.js +6 -0
  26. package/dist/config.js.map +1 -1
  27. package/dist/constants.js +14 -1
  28. package/dist/constants.js.map +1 -1
  29. package/dist/index.js +13 -5
  30. package/dist/index.js.map +1 -1
  31. package/dist/metrics/behavioral-events.js +26 -0
  32. package/dist/metrics/behavioral-events.js.map +1 -1
  33. package/dist/metrics/constants.js +9 -3
  34. package/dist/metrics/constants.js.map +1 -1
  35. package/dist/services/ApiAiAssistant.js +74 -3
  36. package/dist/services/ApiAiAssistant.js.map +1 -1
  37. package/dist/services/config/Util.js +2 -2
  38. package/dist/services/config/Util.js.map +1 -1
  39. package/dist/services/config/types.js +25 -9
  40. package/dist/services/config/types.js.map +1 -1
  41. package/dist/services/core/Utils.js +74 -27
  42. package/dist/services/core/Utils.js.map +1 -1
  43. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  44. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  45. package/dist/services/core/websocket/types.js.map +1 -1
  46. package/dist/services/index.js +1 -1
  47. package/dist/services/index.js.map +1 -1
  48. package/dist/services/task/Task.js +688 -0
  49. package/dist/services/task/Task.js.map +1 -0
  50. package/dist/services/task/TaskFactory.js +45 -0
  51. package/dist/services/task/TaskFactory.js.map +1 -0
  52. package/dist/services/task/TaskManager.js +725 -612
  53. package/dist/services/task/TaskManager.js.map +1 -1
  54. package/dist/services/task/TaskUtils.js +162 -26
  55. package/dist/services/task/TaskUtils.js.map +1 -1
  56. package/dist/services/task/constants.js +6 -1
  57. package/dist/services/task/constants.js.map +1 -1
  58. package/dist/services/task/digital/Digital.js +77 -0
  59. package/dist/services/task/digital/Digital.js.map +1 -0
  60. package/dist/services/task/state-machine/TaskStateMachine.js +837 -0
  61. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  62. package/dist/services/task/state-machine/actions.js +543 -0
  63. package/dist/services/task/state-machine/actions.js.map +1 -0
  64. package/dist/services/task/state-machine/constants.js +161 -0
  65. package/dist/services/task/state-machine/constants.js.map +1 -0
  66. package/dist/services/task/state-machine/guards.js +340 -0
  67. package/dist/services/task/state-machine/guards.js.map +1 -0
  68. package/dist/services/task/state-machine/index.js +53 -0
  69. package/dist/services/task/state-machine/index.js.map +1 -0
  70. package/dist/services/task/state-machine/types.js +54 -0
  71. package/dist/services/task/state-machine/types.js.map +1 -0
  72. package/dist/services/task/state-machine/uiControlsComputer.js +553 -0
  73. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  74. package/dist/services/task/taskDataNormalizer.js +99 -0
  75. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  76. package/dist/services/task/types.js +168 -16
  77. package/dist/services/task/types.js.map +1 -1
  78. package/dist/services/task/voice/Voice.js +1042 -0
  79. package/dist/services/task/voice/Voice.js.map +1 -0
  80. package/dist/services/task/voice/WebRTC.js +149 -0
  81. package/dist/services/task/voice/WebRTC.js.map +1 -0
  82. package/dist/types/cc.d.ts +19 -18
  83. package/dist/types/config.d.ts +6 -0
  84. package/dist/types/constants.d.ts +14 -1
  85. package/dist/types/index.d.ts +11 -5
  86. package/dist/types/metrics/constants.d.ts +7 -1
  87. package/dist/types/services/ApiAiAssistant.d.ts +11 -3
  88. package/dist/types/services/config/types.d.ts +113 -9
  89. package/dist/types/services/core/Utils.d.ts +23 -10
  90. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  91. package/dist/types/services/core/websocket/types.d.ts +1 -1
  92. package/dist/types/services/index.d.ts +1 -1
  93. package/dist/types/services/task/Task.d.ts +157 -0
  94. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  95. package/dist/types/services/task/TaskUtils.d.ts +46 -2
  96. package/dist/types/services/task/constants.d.ts +5 -0
  97. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  98. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -0
  99. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  100. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  101. package/dist/types/services/task/state-machine/guards.d.ts +90 -0
  102. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  103. package/dist/types/services/task/state-machine/types.d.ts +267 -0
  104. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  105. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  106. package/dist/types/services/task/types.d.ts +551 -78
  107. package/dist/types/services/task/voice/Voice.d.ts +184 -0
  108. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  109. package/dist/types/types.d.ts +92 -0
  110. package/dist/types/webex.d.ts +1 -0
  111. package/dist/types.js +85 -0
  112. package/dist/types.js.map +1 -1
  113. package/dist/webex.js +14 -2
  114. package/dist/webex.js.map +1 -1
  115. package/package.json +15 -12
  116. package/src/cc.ts +63 -43
  117. package/src/config.ts +6 -0
  118. package/src/constants.ts +14 -1
  119. package/src/index.ts +14 -5
  120. package/src/metrics/ai-docs/AGENTS.md +348 -0
  121. package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
  122. package/src/metrics/behavioral-events.ts +28 -0
  123. package/src/metrics/constants.ts +9 -4
  124. package/src/services/ApiAiAssistant.ts +104 -3
  125. package/src/services/agent/ai-docs/AGENTS.md +238 -0
  126. package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
  127. package/src/services/ai-docs/AGENTS.md +384 -0
  128. package/src/services/config/Util.ts +2 -2
  129. package/src/services/config/ai-docs/AGENTS.md +253 -0
  130. package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
  131. package/src/services/config/types.ts +116 -10
  132. package/src/services/core/Utils.ts +85 -34
  133. package/src/services/core/ai-docs/AGENTS.md +379 -0
  134. package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
  135. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  136. package/src/services/core/websocket/types.ts +1 -1
  137. package/src/services/index.ts +1 -1
  138. package/src/services/task/Task.ts +837 -0
  139. package/src/services/task/TaskFactory.ts +55 -0
  140. package/src/services/task/TaskManager.ts +738 -697
  141. package/src/services/task/TaskUtils.ts +205 -25
  142. package/src/services/task/ai-docs/AGENTS.md +455 -0
  143. package/src/services/task/ai-docs/ARCHITECTURE.md +585 -0
  144. package/src/services/task/constants.ts +5 -0
  145. package/src/services/task/digital/Digital.ts +95 -0
  146. package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
  147. package/src/services/task/state-machine/actions.ts +685 -0
  148. package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
  149. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
  150. package/src/services/task/state-machine/constants.ts +172 -0
  151. package/src/services/task/state-machine/guards.ts +406 -0
  152. package/src/services/task/state-machine/index.ts +28 -0
  153. package/src/services/task/state-machine/types.ts +241 -0
  154. package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
  155. package/src/services/task/taskDataNormalizer.ts +137 -0
  156. package/src/services/task/types.ts +654 -85
  157. package/src/services/task/voice/Voice.ts +1267 -0
  158. package/src/services/task/voice/WebRTC.ts +187 -0
  159. package/src/types.ts +112 -1
  160. package/src/utils/AGENTS.md +276 -0
  161. package/src/webex.js +2 -0
  162. package/test/unit/spec/cc.ts +133 -3
  163. package/test/unit/spec/logger-proxy.ts +70 -0
  164. package/test/unit/spec/services/ApiAiAssistant.ts +122 -17
  165. package/test/unit/spec/services/WebCallingService.ts +7 -1
  166. package/test/unit/spec/services/config/index.ts +27 -27
  167. package/test/unit/spec/services/core/Utils.ts +335 -1
  168. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  169. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  170. package/test/unit/spec/services/task/Task.ts +477 -0
  171. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  172. package/test/unit/spec/services/task/TaskManager.ts +821 -1936
  173. package/test/unit/spec/services/task/TaskUtils.ts +206 -0
  174. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  175. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
  176. package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
  177. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  178. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
  179. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  180. package/test/unit/spec/services/task/voice/Voice.ts +631 -0
  181. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  182. package/umd/contact-center.min.js +2 -2
  183. package/umd/contact-center.min.js.map +1 -1
  184. package/dist/services/task/index.js +0 -1530
  185. package/dist/services/task/index.js.map +0 -1
  186. package/dist/types/services/task/index.d.ts +0 -650
  187. package/src/services/task/index.ts +0 -1806
  188. package/test/unit/spec/services/task/index.ts +0 -2205
@@ -8,6 +8,12 @@ import {
8
8
  isDigitalOutbound,
9
9
  hasAgentInitiatedOutdial,
10
10
  shouldAutoAnswerTask,
11
+ getIsCustomerInCall,
12
+ getConferenceParticipantsCount,
13
+ isSecondaryAgent,
14
+ isSecondaryEpDnAgent,
15
+ getConsultMediaResourceId,
16
+ getIsConsultInProgressForConferenceControls,
11
17
  } from '../../../../../src/services/task/TaskUtils';
12
18
  import {ITask, Interaction, TaskData} from '../../../../../src/services/task/types';
13
19
  import {LoginOption} from '../../../../../src/types';
@@ -430,4 +436,204 @@ describe('TaskUtils', () => {
430
436
  });
431
437
  });
432
438
  });
439
+
440
+ // Additional coverage for conference/consult utility functions
441
+ describe('Conference Utility Functions', () => {
442
+ const interactionId = 'interaction-123';
443
+ const createInteraction = (media: any = {}, participants: any = {}) =>
444
+ ({interactionId, mainInteractionId: interactionId, media, participants}) as any;
445
+
446
+ it('getIsCustomerInCall returns true when customer active', () => {
447
+ const interaction = createInteraction(
448
+ {[interactionId]: {mType: 'mainCall', participants: ['c1']}},
449
+ {'c1': {pType: 'Customer', hasLeft: false}}
450
+ );
451
+ expect(getIsCustomerInCall(interaction, interactionId)).toBe(true);
452
+ });
453
+
454
+ it('getIsCustomerInCall returns false when participants map is missing', () => {
455
+ const interaction = createInteraction(
456
+ {[interactionId]: {mType: 'mainCall', participants: ['c1']}},
457
+ undefined
458
+ );
459
+ expect(getIsCustomerInCall(interaction, interactionId)).toBe(false);
460
+ });
461
+
462
+ it('getConferenceParticipantsCount counts active agents only', () => {
463
+ const interaction = createInteraction(
464
+ {[interactionId]: {mType: 'mainCall', participants: ['a1', 'a2', 'c1']}},
465
+ {'a1': {pType: 'Agent', hasLeft: false}, 'a2': {pType: 'Agent', hasLeft: false}, 'c1': {pType: 'Customer', hasLeft: false}}
466
+ );
467
+ expect(getConferenceParticipantsCount(interaction, interactionId)).toBe(2);
468
+ });
469
+
470
+ it('getConferenceParticipantsCount returns 0 when participants map is missing', () => {
471
+ const interaction = createInteraction(
472
+ {[interactionId]: {mType: 'mainCall', participants: ['a1', 'a2', 'c1']}},
473
+ undefined
474
+ );
475
+ expect(getConferenceParticipantsCount(interaction, interactionId)).toBe(0);
476
+ });
477
+
478
+ it('isSecondaryAgent returns true for consult with parentInteractionId', () => {
479
+ const interaction = createInteraction();
480
+ interaction.callProcessingDetails = {relationshipType: 'consult', parentInteractionId: 'parent-456'};
481
+ expect(isSecondaryAgent(interaction)).toBe(true);
482
+ });
483
+
484
+ it('isSecondaryEpDnAgent returns true for telephony secondary agent', () => {
485
+ const interaction = createInteraction();
486
+ interaction.mediaType = 'telephony';
487
+ interaction.callProcessingDetails = {relationshipType: 'consult', parentInteractionId: 'parent-456'};
488
+ expect(isSecondaryEpDnAgent(interaction)).toBe(true);
489
+ });
490
+ });
491
+
492
+ describe('getConsultMediaResourceId', () => {
493
+ it('returns consultMediaResourceId directly when provided', () => {
494
+ const result = getConsultMediaResourceId(undefined, 'consult-media-1', 'agent1');
495
+ expect(result).toBe('consult-media-1');
496
+ });
497
+
498
+ it('returns undefined when no interaction and no consultMediaResourceId', () => {
499
+ const result = getConsultMediaResourceId(undefined, undefined, 'agent1');
500
+ expect(result).toBeUndefined();
501
+ });
502
+
503
+ it('returns undefined when no agentId and no consultMediaResourceId', () => {
504
+ const interaction = {media: {}} as any;
505
+ const result = getConsultMediaResourceId(interaction, undefined, undefined);
506
+ expect(result).toBeUndefined();
507
+ });
508
+
509
+ it('finds consult media leg by mType and agent participation', () => {
510
+ const interaction = {
511
+ media: {
512
+ 'main-media': {
513
+ mediaResourceId: 'main-media',
514
+ mType: 'mainCall',
515
+ participants: ['agent1', 'customer1'],
516
+ },
517
+ 'consult-media': {
518
+ mediaResourceId: 'consult-media',
519
+ mType: 'consult',
520
+ participants: ['agent1', 'agent2'],
521
+ },
522
+ },
523
+ } as any;
524
+ const result = getConsultMediaResourceId(interaction, undefined, 'agent1');
525
+ expect(result).toBe('consult-media');
526
+ });
527
+
528
+ it('returns undefined when no consult media leg matches the agent', () => {
529
+ const interaction = {
530
+ media: {
531
+ 'main-media': {
532
+ mediaResourceId: 'main-media',
533
+ mType: 'mainCall',
534
+ participants: ['agent1', 'customer1'],
535
+ },
536
+ 'consult-media': {
537
+ mediaResourceId: 'consult-media',
538
+ mType: 'consult',
539
+ participants: ['agent2', 'agent3'],
540
+ },
541
+ },
542
+ } as any;
543
+ const result = getConsultMediaResourceId(interaction, undefined, 'agent1');
544
+ expect(result).toBeUndefined();
545
+ });
546
+
547
+ it('returns undefined when media has no consult type entries', () => {
548
+ const interaction = {
549
+ media: {
550
+ 'main-media': {
551
+ mediaResourceId: 'main-media',
552
+ mType: 'mainCall',
553
+ participants: ['agent1', 'customer1'],
554
+ },
555
+ },
556
+ } as any;
557
+ const result = getConsultMediaResourceId(interaction, undefined, 'agent1');
558
+ expect(result).toBeUndefined();
559
+ });
560
+
561
+ it('prioritizes direct consultMediaResourceId over interaction search', () => {
562
+ const interaction = {
563
+ media: {
564
+ 'consult-media': {
565
+ mediaResourceId: 'consult-media',
566
+ mType: 'consult',
567
+ participants: ['agent1', 'agent2'],
568
+ },
569
+ },
570
+ } as any;
571
+ const result = getConsultMediaResourceId(interaction, 'direct-id', 'agent1');
572
+ expect(result).toBe('direct-id');
573
+ });
574
+ });
575
+
576
+ describe('getIsConsultInProgressForConferenceControls', () => {
577
+ it('returns false when consultee is reserved but has not joined (RONA)', () => {
578
+ const interaction = {
579
+ participants: {
580
+ 'agent-1': {id: 'agent-1', pType: 'Agent', hasLeft: false, isConsulted: false},
581
+ 'agent-2': {
582
+ id: 'agent-2',
583
+ pType: 'Agent',
584
+ hasLeft: false,
585
+ hasJoined: false,
586
+ isConsulted: true,
587
+ consultState: 'consultReserved',
588
+ },
589
+ 'customer-1': {id: 'customer-1', pType: 'Customer', hasLeft: false},
590
+ },
591
+ media: {
592
+ 'interaction-1': {
593
+ mType: 'mainCall',
594
+ participants: ['customer-1', 'agent-1'],
595
+ },
596
+ 'consult-media': {
597
+ mType: 'consult',
598
+ participants: ['agent-2', 'agent-1'],
599
+ },
600
+ },
601
+ } as any;
602
+
603
+ expect(
604
+ getIsConsultInProgressForConferenceControls(interaction, 'interaction-1', 'agent-1')
605
+ ).toBe(false);
606
+ });
607
+
608
+ it('returns true when consultee is actively consulting', () => {
609
+ const interaction = {
610
+ participants: {
611
+ 'agent-1': {id: 'agent-1', pType: 'Agent', hasLeft: false, isConsulted: false},
612
+ 'agent-2': {
613
+ id: 'agent-2',
614
+ pType: 'Agent',
615
+ hasLeft: false,
616
+ hasJoined: true,
617
+ isConsulted: true,
618
+ consultState: 'consulting',
619
+ },
620
+ 'customer-1': {id: 'customer-1', pType: 'Customer', hasLeft: false},
621
+ },
622
+ media: {
623
+ 'interaction-1': {
624
+ mType: 'mainCall',
625
+ participants: ['customer-1', 'agent-1'],
626
+ },
627
+ 'consult-media': {
628
+ mType: 'consult',
629
+ participants: ['agent-2', 'agent-1'],
630
+ },
631
+ },
632
+ } as any;
633
+
634
+ expect(
635
+ getIsConsultInProgressForConferenceControls(interaction, 'interaction-1', 'agent-1')
636
+ ).toBe(true);
637
+ });
638
+ });
433
639
  });
@@ -0,0 +1,105 @@
1
+ import Digital from '../../../../../../src/services/task/digital/Digital';
2
+ import {MEDIA_CHANNEL, TaskData, TaskResponse} from '../../../../../../src/services/task/types';
3
+ import {TaskEvent, TaskEventPayload} from '../../../../../../src/services/task/state-machine';
4
+
5
+ jest.mock('../../../../../../src/services/core/WebexRequest', () => ({
6
+ __esModule: true,
7
+ default: {
8
+ getInstance: () => ({ uploadLogs: jest.fn() }),
9
+ },
10
+ }));
11
+
12
+ const sendStateEvents = (task: Digital, events: TaskEventPayload[]) => {
13
+ events.forEach((event) => {
14
+ if (!event) {
15
+ throw new Error('Task event payload is required');
16
+ }
17
+ task.stateMachineService?.send(event);
18
+ });
19
+ };
20
+
21
+ describe('Digital Task', () => {
22
+ const dummyData = {
23
+ interactionId: 'dig1',
24
+ interaction: {isTerminated: false, mediaType: MEDIA_CHANNEL.CHAT},
25
+ } as TaskData;
26
+ let dummyContact: { accept: jest.Mock<Promise<TaskResponse>> };
27
+
28
+ beforeEach(() => {
29
+ dummyContact = {
30
+ accept: jest.fn().mockResolvedValue({ status: 'ok' }),
31
+ };
32
+ });
33
+
34
+ it('accept() calls contact.accept with interactionId', async () => {
35
+ const task = new Digital(dummyContact, dummyData);
36
+ const res = await task.accept();
37
+ expect(dummyContact.accept).toHaveBeenCalledWith({ interactionId: 'dig1' });
38
+ expect(res).toEqual({ status: 'ok' });
39
+ });
40
+
41
+ it('accept() throws an error when contact.accept rejects', async () => {
42
+ const error = new Error('Error while performing accept');
43
+ (dummyContact.accept as jest.Mock).mockRejectedValue(error);
44
+ const task = new Digital(dummyContact, dummyData);
45
+ await expect(task.accept()).rejects.toThrow('Error while performing accept');
46
+ });
47
+
48
+ it('constructor shows accept when offered', () => {
49
+ const task = new Digital(dummyContact, dummyData);
50
+ sendStateEvents(task, [{type: TaskEvent.TASK_INCOMING, taskData: dummyData}]);
51
+ expect(task.uiControls.main.accept.isVisible).toBe(true);
52
+ expect(task.uiControls.main.accept.isEnabled).toBe(true);
53
+ });
54
+
55
+ describe('UI controls derived from state machine events', () => {
56
+ it('connected state shows transfer and end', () => {
57
+ const task = new Digital(dummyContact, dummyData);
58
+ sendStateEvents(task, [
59
+ {type: TaskEvent.TASK_INCOMING, taskData: dummyData},
60
+ {type: TaskEvent.ASSIGN, taskData: dummyData},
61
+ ]);
62
+ expect(task.uiControls.main.accept.isVisible).toBe(false);
63
+ expect(task.uiControls.main.transfer.isVisible).toBe(true);
64
+ expect(task.uiControls.main.end.isVisible).toBe(true);
65
+ expect(task.uiControls.main.wrapup.isVisible).toBe(false);
66
+ });
67
+
68
+ it('wrapup state hides transfer/end and shows wrapup button', () => {
69
+ const task = new Digital(dummyContact, dummyData);
70
+ sendStateEvents(task, [
71
+ {type: TaskEvent.TASK_INCOMING, taskData: dummyData},
72
+ {type: TaskEvent.ASSIGN, taskData: dummyData},
73
+ {type: TaskEvent.TASK_WRAPUP},
74
+ ]);
75
+ expect(task.uiControls.main.transfer.isVisible).toBe(false);
76
+ expect(task.uiControls.main.end.isVisible).toBe(false);
77
+ expect(task.uiControls.main.wrapup.isVisible).toBe(true);
78
+ });
79
+
80
+ it('terminated interaction toggles wrapup visibility even before END event', () => {
81
+ const task = new Digital(dummyContact, dummyData);
82
+ const terminatedData = {
83
+ ...dummyData,
84
+ interaction: {...(dummyData.interaction as any), isTerminated: true},
85
+ } as TaskData;
86
+ task.updateTaskData(terminatedData);
87
+ sendStateEvents(task, [
88
+ {type: TaskEvent.TASK_INCOMING, taskData: dummyData},
89
+ {type: TaskEvent.ASSIGN, taskData: terminatedData},
90
+ ]);
91
+ expect(task.uiControls.main.wrapup.isVisible).toBe(true);
92
+ });
93
+
94
+ it('rona hides accept controls', () => {
95
+ const task = new Digital(dummyContact, dummyData);
96
+ sendStateEvents(task, [
97
+ {type: TaskEvent.TASK_INCOMING, taskData: dummyData},
98
+ {type: TaskEvent.RONA},
99
+ ]);
100
+ expect(task.uiControls.main.accept.isVisible).toBe(false);
101
+ expect(task.uiControls.main.transfer.isVisible).toBe(false);
102
+ expect(task.uiControls.main.end.isVisible).toBe(false);
103
+ });
104
+ });
105
+ });