@webex/contact-center 3.11.0 → 3.12.0-llmrefactor.2
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.
- package/.sdd/manifest.json +882 -0
- package/AGENTS.md +94 -0
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +46 -0
- package/ai-docs/GETTING_STARTED.md +168 -0
- package/ai-docs/GLOSSARY.md +43 -0
- package/ai-docs/README.md +138 -0
- package/ai-docs/REVIEW_CHECKLIST.md +41 -0
- package/ai-docs/RULES.md +444 -0
- package/ai-docs/SECURITY.md +52 -0
- package/ai-docs/SERVICE_STATE.md +48 -0
- package/ai-docs/SPEC_INDEX.md +65 -0
- package/ai-docs/adr/0001-spec-source-policy.md +55 -0
- package/ai-docs/adr/README.md +8 -0
- package/ai-docs/adr/_adr-template.md +31 -0
- package/ai-docs/contact-center-spec.md +341 -0
- package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
- package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
- package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
- package/ai-docs/patterns/event-driven-patterns.md +485 -0
- package/ai-docs/patterns/testing-patterns.md +480 -0
- package/ai-docs/patterns/typescript-patterns.md +365 -0
- package/ai-docs/templates/README.md +102 -0
- package/ai-docs/templates/documentation/create-agents-md.md +240 -0
- package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
- package/ai-docs/templates/existing-service/bug-fix.md +254 -0
- package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
- package/ai-docs/templates/new-method/00-master.md +80 -0
- package/ai-docs/templates/new-method/01-requirements.md +232 -0
- package/ai-docs/templates/new-method/02-implementation.md +295 -0
- package/ai-docs/templates/new-method/03-tests.md +201 -0
- package/ai-docs/templates/new-method/04-validation.md +141 -0
- package/ai-docs/templates/new-service/00-master.md +109 -0
- package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
- package/ai-docs/templates/new-service/02-code-generation.md +346 -0
- package/ai-docs/templates/new-service/03-integration.md +178 -0
- package/ai-docs/templates/new-service/04-test-generation.md +205 -0
- package/ai-docs/templates/new-service/05-validation.md +145 -0
- package/dist/cc.js +379 -50
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +22 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +114 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +32 -3
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +318 -0
- package/dist/services/ApiAiAssistant.js.map +1 -0
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/agent/types.js.map +1 -1
- package/dist/services/config/Util.js +8 -4
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +35 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +41 -2
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +66 -8
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +27 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +122 -25
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +92 -17
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +22 -6
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/connection-service.js +3 -1
- package/dist/services/core/websocket/connection-service.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +688 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +45 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +751 -457
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +220 -23
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +23 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +129 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +77 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +873 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +567 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +161 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +382 -0
- package/dist/services/task/state-machine/guards.js.map +1 -0
- package/dist/services/task/state-machine/index.js +53 -0
- package/dist/services/task/state-machine/index.js.map +1 -0
- package/dist/services/task/state-machine/types.js +54 -0
- package/dist/services/task/state-machine/types.js.map +1 -0
- package/dist/services/task/state-machine/uiControlsComputer.js +603 -0
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
- package/dist/services/task/taskDataNormalizer.js +99 -0
- package/dist/services/task/taskDataNormalizer.js.map +1 -0
- package/dist/services/task/types.js +227 -4
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1044 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +149 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/types/cc.d.ts +894 -0
- package/dist/types/config.d.ts +72 -0
- package/dist/types/constants.d.ts +66 -0
- package/dist/types/index.d.ts +199 -0
- package/dist/types/logger-proxy.d.ts +71 -0
- package/dist/types/metrics/MetricsManager.d.ts +223 -0
- package/dist/types/metrics/behavioral-events.d.ts +29 -0
- package/dist/types/metrics/constants.d.ts +181 -0
- package/dist/types/services/AddressBook.d.ts +74 -0
- package/dist/types/services/ApiAiAssistant.d.ts +49 -0
- package/dist/types/services/EntryPoint.d.ts +67 -0
- package/dist/types/services/Queue.d.ts +76 -0
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/WebCallingService.d.ts +1 -0
- package/dist/types/services/agent/index.d.ts +46 -0
- package/dist/types/services/agent/types.d.ts +413 -0
- package/dist/types/services/config/Util.d.ts +20 -0
- package/dist/types/services/config/constants.d.ts +270 -0
- package/dist/types/services/config/index.d.ts +177 -0
- package/dist/types/services/config/types.d.ts +1368 -0
- package/dist/types/services/constants.d.ts +110 -0
- package/dist/types/services/core/Err.d.ts +125 -0
- package/dist/types/services/core/GlobalTypes.d.ts +58 -0
- package/dist/types/services/core/Utils.d.ts +121 -0
- package/dist/types/services/core/WebexRequest.d.ts +22 -0
- package/dist/types/services/core/aqm-reqs.d.ts +65 -0
- package/dist/types/services/core/constants.d.ts +99 -0
- package/dist/types/services/core/types.d.ts +47 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
- package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
- package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
- package/dist/types/services/core/websocket/types.d.ts +37 -0
- package/dist/types/services/index.d.ts +54 -0
- package/dist/types/services/task/AutoWrapup.d.ts +40 -0
- package/dist/types/services/task/Task.d.ts +157 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskManager.d.ts +1 -0
- package/dist/types/services/task/TaskUtils.d.ts +138 -0
- package/dist/types/services/task/constants.d.ts +91 -0
- package/dist/types/services/task/contact.d.ts +69 -0
- package/dist/types/services/task/dialer.d.ts +73 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1194 -0
- package/dist/types/services/task/state-machine/actions.d.ts +10 -0
- package/dist/types/services/task/state-machine/constants.d.ts +107 -0
- package/dist/types/services/task/state-machine/guards.d.ts +102 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +269 -0
- package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
- package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
- package/dist/types/services/task/types.d.ts +1856 -0
- package/dist/types/services/task/voice/Voice.d.ts +184 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/types.d.ts +778 -0
- package/dist/types/utils/PageCache.d.ts +173 -0
- package/dist/types/webex-config.d.ts +53 -0
- package/dist/types/webex.d.ts +8 -0
- package/dist/types.js +130 -1
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +16 -12
- package/src/cc.ts +477 -51
- package/src/config.ts +6 -0
- package/src/constants.ts +21 -1
- package/src/index.ts +24 -5
- package/src/metrics/ai-docs/AGENTS.md +350 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
- package/src/metrics/ai-docs/metrics-spec.md +854 -0
- package/src/metrics/behavioral-events.ts +120 -0
- package/src/metrics/constants.ts +37 -3
- package/src/services/ApiAiAssistant.ts +412 -0
- package/src/services/UserPreference.ts +509 -0
- package/src/services/agent/ai-docs/AGENTS.md +240 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
- package/src/services/agent/ai-docs/agent-spec.md +504 -0
- package/src/services/agent/types.ts +1 -1
- package/src/services/ai-docs/AGENTS.md +386 -0
- package/src/services/ai-docs/services-spec.md +492 -0
- package/src/services/config/Util.ts +10 -2
- package/src/services/config/ai-docs/AGENTS.md +255 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
- package/src/services/config/ai-docs/config-spec.md +669 -0
- package/src/services/config/constants.ts +37 -1
- package/src/services/config/index.ts +45 -1
- package/src/services/config/types.ts +241 -11
- package/src/services/constants.ts +29 -0
- package/src/services/core/Err.ts +3 -0
- package/src/services/core/Utils.ts +143 -30
- package/src/services/core/ai-docs/AGENTS.md +381 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
- package/src/services/core/ai-docs/core-spec.md +783 -0
- package/src/services/core/aqm-reqs.ts +100 -22
- package/src/services/core/websocket/WebSocketManager.ts +23 -6
- package/src/services/core/websocket/connection-service.ts +5 -1
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +4 -0
- package/src/services/task/Task.ts +837 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +793 -521
- package/src/services/task/TaskUtils.ts +314 -24
- package/src/services/task/ai-docs/AGENTS.md +457 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +594 -0
- package/src/services/task/ai-docs/task-spec.md +1319 -0
- package/src/services/task/constants.ts +23 -0
- package/src/services/task/dialer.ts +136 -1
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1166 -0
- package/src/services/task/state-machine/actions.ts +738 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +458 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1137 -0
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2177 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +445 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +243 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +961 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +734 -71
- package/src/services/task/voice/Voice.ts +1270 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +205 -2
- package/src/utils/AGENTS.md +278 -0
- package/src/utils/ai-docs/utils-spec.md +381 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +503 -43
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/config/index.ts +85 -29
- package/test/unit/spec/services/core/Utils.ts +481 -2
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
- package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +477 -0
- package/test/unit/spec/services/task/TaskFactory.ts +62 -0
- package/test/unit/spec/services/task/TaskManager.ts +1001 -1003
- package/test/unit/spec/services/task/TaskUtils.ts +235 -0
- package/test/unit/spec/services/task/dialer.ts +372 -96
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +2651 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +637 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2663 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +649 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1525
- package/dist/services/task/index.js.map +0 -1
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -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,233 @@ 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
|
+
|
|
639
|
+
it('returns true when EP-DN participant is on consult leg but not main call (CAI-8329)', () => {
|
|
640
|
+
const interaction = {
|
|
641
|
+
participants: {
|
|
642
|
+
'agent-1': {id: 'agent-1', pType: 'Agent', hasLeft: false, consultState: 'conferencing'},
|
|
643
|
+
'+13159998087': {
|
|
644
|
+
id: '+13159998087',
|
|
645
|
+
pType: 'EP-DN',
|
|
646
|
+
type: 'EpDn',
|
|
647
|
+
hasLeft: false,
|
|
648
|
+
},
|
|
649
|
+
'customer-1': {id: 'customer-1', pType: 'Customer', hasLeft: false, hasJoined: true},
|
|
650
|
+
},
|
|
651
|
+
media: {
|
|
652
|
+
'interaction-1': {
|
|
653
|
+
mType: 'mainCall',
|
|
654
|
+
participants: ['customer-1', 'agent-1'],
|
|
655
|
+
},
|
|
656
|
+
'consult-media-1': {
|
|
657
|
+
mType: 'consult',
|
|
658
|
+
participants: ['+13159998087', 'agent-1'],
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
} as any;
|
|
662
|
+
|
|
663
|
+
expect(
|
|
664
|
+
getIsConsultInProgressForConferenceControls(interaction, 'interaction-1', 'agent-1')
|
|
665
|
+
).toBe(true);
|
|
666
|
+
});
|
|
667
|
+
});
|
|
433
668
|
});
|