@webex/contact-center 3.12.0-llmrefactor.2 → 3.12.0-llmrefactor.4
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 +5 -4
- package/ai-docs/ARCHITECTURE.md +1 -1
- package/ai-docs/CONTRACTS.md +6 -2
- package/ai-docs/SECURITY.md +1 -1
- package/ai-docs/contact-center-spec.md +22 -4
- package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
- package/dist/cc.js +440 -10
- package/dist/cc.js.map +1 -1
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +10 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +13 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +2 -0
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +18 -15
- package/dist/services/AddressBook.js.map +1 -1
- package/dist/services/AnswerCallOnWebexService.js +174 -0
- package/dist/services/AnswerCallOnWebexService.js.map +1 -0
- package/dist/services/EntryPoint.js +46 -68
- package/dist/services/EntryPoint.js.map +1 -1
- package/dist/services/Queue.js +27 -22
- package/dist/services/Queue.js.map +1 -1
- package/dist/services/WebexCrossClientService.js +171 -0
- package/dist/services/WebexCrossClientService.js.map +1 -0
- package/dist/services/WxAppTelephonyMercurySync.js +93 -0
- package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
- package/dist/services/config/Util.js +3 -0
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +10 -6
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/types.js +4 -0
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/WebexRequest.js +6 -2
- package/dist/services/core/WebexRequest.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +28 -14
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/types.js.map +1 -1
- package/dist/services/task/Task.js +73 -7
- package/dist/services/task/Task.js.map +1 -1
- package/dist/services/task/TaskFactory.js +8 -4
- package/dist/services/task/TaskFactory.js.map +1 -1
- package/dist/services/task/TaskManager.js +353 -21
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/WebexCallingUtils.js +70 -0
- package/dist/services/task/WebexCallingUtils.js.map +1 -0
- package/dist/services/task/constants.js +4 -1
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +29 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/digital/Digital.js +3 -2
- package/dist/services/task/digital/Digital.js.map +1 -1
- package/dist/services/task/state-machine/TaskStateMachine.js +135 -37
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -1
- package/dist/services/task/state-machine/actions.js +6 -1
- package/dist/services/task/state-machine/actions.js.map +1 -1
- package/dist/services/task/state-machine/guards.js +38 -11
- package/dist/services/task/state-machine/guards.js.map +1 -1
- package/dist/services/task/state-machine/types.js.map +1 -1
- package/dist/services/task/state-machine/uiControlsComputer.js +118 -18
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -1
- package/dist/services/task/types.js +16 -1
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +350 -14
- package/dist/services/task/voice/Voice.js.map +1 -1
- package/dist/services/task/voice/WebRTC.js +4 -1
- package/dist/services/task/voice/WebRTC.js.map +1 -1
- package/dist/services/task/voice/wxAppVoiceMethods.js +201 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
- package/dist/services/wxAppTelephonyUtils.js +19 -0
- package/dist/services/wxAppTelephonyUtils.js.map +1 -0
- package/dist/types/cc.d.ts +77 -4
- package/dist/types/config.d.ts +7 -0
- package/dist/types/constants.d.ts +8 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/metrics/constants.d.ts +2 -0
- package/dist/types/services/AddressBook.d.ts +2 -1
- package/dist/types/services/AnswerCallOnWebexService.d.ts +37 -0
- package/dist/types/services/EntryPoint.d.ts +7 -5
- package/dist/types/services/Queue.d.ts +5 -3
- package/dist/types/services/WebexCrossClientService.d.ts +28 -0
- package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
- package/dist/types/services/config/constants.d.ts +8 -5
- package/dist/types/services/config/types.d.ts +17 -4
- package/dist/types/services/core/Err.d.ts +2 -0
- package/dist/types/services/core/WebexRequest.d.ts +1 -0
- package/dist/types/services/core/types.d.ts +2 -0
- package/dist/types/services/task/Task.d.ts +20 -2
- package/dist/types/services/task/TaskFactory.d.ts +2 -1
- package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
- package/dist/types/services/task/constants.d.ts +3 -0
- package/dist/types/services/task/contact.d.ts +4 -0
- package/dist/types/services/task/digital/Digital.d.ts +2 -2
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +260 -56
- package/dist/types/services/task/state-machine/guards.d.ts +6 -5
- package/dist/types/services/task/state-machine/types.d.ts +9 -1
- package/dist/types/services/task/types.d.ts +81 -4
- package/dist/types/services/task/voice/Voice.d.ts +48 -9
- package/dist/types/services/task/voice/WebRTC.d.ts +2 -2
- package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +52 -0
- package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
- package/dist/types/types.d.ts +14 -8
- package/dist/types/utils/PageCache.d.ts +20 -3
- package/dist/types.js +7 -2
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +19 -5
- package/dist/utils/PageCache.js.map +1 -1
- package/dist/webex.js +1 -1
- package/package.json +9 -9
- package/src/cc.ts +506 -9
- package/src/config.ts +7 -0
- package/src/constants.ts +8 -0
- package/src/index.ts +2 -0
- package/src/metrics/ai-docs/metrics-spec.md +9 -3
- package/src/metrics/behavioral-events.ts +14 -0
- package/src/metrics/constants.ts +2 -0
- package/src/services/AddressBook.ts +17 -6
- package/src/services/AnswerCallOnWebexService.ts +206 -0
- package/src/services/EntryPoint.ts +59 -60
- package/src/services/Queue.ts +29 -12
- package/src/services/WebexCrossClientService.ts +212 -0
- package/src/services/WxAppTelephonyMercurySync.ts +115 -0
- package/src/services/ai-docs/AGENTS.md +10 -10
- package/src/services/ai-docs/services-spec.md +6 -1
- package/src/services/config/Util.ts +3 -0
- package/src/services/config/ai-docs/AGENTS.md +1 -1
- package/src/services/config/ai-docs/ARCHITECTURE.md +2 -2
- package/src/services/config/ai-docs/config-spec.md +6 -0
- package/src/services/config/constants.ts +10 -6
- package/src/services/config/types.ts +16 -4
- package/src/services/core/Err.ts +1 -0
- package/src/services/core/WebexRequest.ts +3 -1
- package/src/services/core/ai-docs/core-spec.md +5 -1
- package/src/services/core/aqm-reqs.ts +30 -15
- package/src/services/core/types.ts +2 -0
- package/src/services/task/Task.ts +79 -8
- package/src/services/task/TaskFactory.ts +8 -3
- package/src/services/task/TaskManager.ts +522 -16
- package/src/services/task/WebexCallingUtils.ts +136 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +1 -0
- package/src/services/task/ai-docs/task-spec.md +152 -2
- package/src/services/task/constants.ts +3 -0
- package/src/services/task/contact.ts +30 -0
- package/src/services/task/digital/Digital.ts +4 -2
- package/src/services/task/state-machine/TaskStateMachine.ts +210 -63
- package/src/services/task/state-machine/actions.ts +5 -2
- package/src/services/task/state-machine/ai-docs/AGENTS.md +8 -4
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +17 -8
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +56 -24
- package/src/services/task/state-machine/guards.ts +64 -11
- package/src/services/task/state-machine/types.ts +16 -1
- package/src/services/task/state-machine/uiControlsComputer.ts +206 -32
- package/src/services/task/types.ts +114 -4
- package/src/services/task/voice/Voice.ts +462 -12
- package/src/services/task/voice/WebRTC.ts +5 -1
- package/src/services/task/voice/wxAppVoiceMethods.ts +307 -0
- package/src/services/wxAppTelephonyUtils.ts +14 -0
- package/src/types.ts +33 -9
- package/src/utils/AGENTS.md +21 -10
- package/src/utils/PageCache.ts +38 -5
- package/src/utils/ai-docs/utils-spec.md +21 -11
- package/test/unit/spec/cc.ts +1274 -0
- package/test/unit/spec/metrics/behavioral-events.ts +18 -0
- package/test/unit/spec/services/AddressBook.ts +37 -6
- package/test/unit/spec/services/AnswerCallOnWebexService.ts +223 -0
- package/test/unit/spec/services/EntryPoint.ts +87 -40
- package/test/unit/spec/services/Queue.ts +123 -12
- package/test/unit/spec/services/WebexCrossClientService.ts +261 -0
- package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +113 -0
- package/test/unit/spec/services/config/Util.ts +85 -0
- package/test/unit/spec/services/core/WebexRequest.ts +3 -1
- package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
- package/test/unit/spec/services/task/Task.ts +200 -0
- package/test/unit/spec/services/task/TaskFactory.ts +39 -2
- package/test/unit/spec/services/task/TaskManager.ts +1294 -1
- package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
- package/test/unit/spec/services/task/contact.ts +33 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +854 -72
- package/test/unit/spec/services/task/state-machine/guards.ts +210 -8
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +445 -7
- package/test/unit/spec/services/task/voice/Voice.ts +874 -0
- package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +459 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {expect} from '@jest/globals';
|
|
2
|
+
import {
|
|
3
|
+
getWebexCallingDeviceDetailsForAgent,
|
|
4
|
+
isWebexCallingCallForAgent,
|
|
5
|
+
isWxAppEngagedForControls,
|
|
6
|
+
decodedLineOwnerId,
|
|
7
|
+
} from '../../../../../src/services/task/WebexCallingUtils';
|
|
8
|
+
import {TaskState} from '../../../../../src/services/task/state-machine/constants';
|
|
9
|
+
|
|
10
|
+
const WX_APP_PARTICIPANT = {
|
|
11
|
+
id: 'agent-1',
|
|
12
|
+
deviceType: 'wxApp',
|
|
13
|
+
deviceId: 'device-id-1',
|
|
14
|
+
deviceCallId: 'call-id-1',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const participantsById = {
|
|
18
|
+
'agent-1': WX_APP_PARTICIPANT,
|
|
19
|
+
'customer-1': {id: 'customer-1', pType: 'Customer'},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
describe('getWebexCallingDeviceDetailsForAgent', () => {
|
|
23
|
+
it('returns device details when agent participant has wxApp deviceType', () => {
|
|
24
|
+
const result = getWebexCallingDeviceDetailsForAgent('agent-1', participantsById);
|
|
25
|
+
|
|
26
|
+
expect(result).toEqual({
|
|
27
|
+
deviceType: 'wxApp',
|
|
28
|
+
deviceId: 'device-id-1',
|
|
29
|
+
deviceCallId: 'call-id-1',
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('returns undefined when agentId is undefined', () => {
|
|
34
|
+
expect(getWebexCallingDeviceDetailsForAgent(undefined, participantsById)).toBeUndefined();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('returns undefined when agentId is empty string', () => {
|
|
38
|
+
expect(getWebexCallingDeviceDetailsForAgent('', participantsById)).toBeUndefined();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('returns undefined when participants is null', () => {
|
|
42
|
+
expect(getWebexCallingDeviceDetailsForAgent('agent-1', null)).toBeUndefined();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('returns undefined when participants is an array (not object-by-id)', () => {
|
|
46
|
+
expect(getWebexCallingDeviceDetailsForAgent('agent-1', [WX_APP_PARTICIPANT])).toBeUndefined();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('returns undefined when agent participant lacks deviceCallId', () => {
|
|
50
|
+
const participants = {
|
|
51
|
+
'agent-1': {id: 'agent-1', deviceType: 'wxApp', deviceId: 'device-id-1'},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
expect(getWebexCallingDeviceDetailsForAgent('agent-1', participants)).toBeUndefined();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('returns undefined when agent participant lacks deviceId', () => {
|
|
58
|
+
const participants = {
|
|
59
|
+
'agent-1': {id: 'agent-1', deviceType: 'wxApp', deviceCallId: 'call-id-1'},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
expect(getWebexCallingDeviceDetailsForAgent('agent-1', participants)).toBeUndefined();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('finds participant by id field when keyed differently', () => {
|
|
66
|
+
const participants = {
|
|
67
|
+
'some-other-key': WX_APP_PARTICIPANT,
|
|
68
|
+
};
|
|
69
|
+
const result = getWebexCallingDeviceDetailsForAgent('agent-1', participants);
|
|
70
|
+
|
|
71
|
+
expect(result?.deviceCallId).toBe('call-id-1');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('defaults deviceType to empty string when missing', () => {
|
|
75
|
+
const participants = {
|
|
76
|
+
'agent-1': {id: 'agent-1', deviceId: 'device-id-1', deviceCallId: 'call-id-1'},
|
|
77
|
+
};
|
|
78
|
+
const result = getWebexCallingDeviceDetailsForAgent('agent-1', participants);
|
|
79
|
+
|
|
80
|
+
expect(result?.deviceType).toBe('');
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('isWebexCallingCallForAgent', () => {
|
|
85
|
+
it('returns true when device details are found', () => {
|
|
86
|
+
expect(isWebexCallingCallForAgent('agent-1', participantsById)).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('returns false when no device details are found', () => {
|
|
90
|
+
expect(isWebexCallingCallForAgent('unknown-agent', participantsById)).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('returns false when agentId is undefined', () => {
|
|
94
|
+
expect(isWebexCallingCallForAgent(undefined, participantsById)).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('isWxAppEngagedForControls', () => {
|
|
99
|
+
it('returns true when flag is on, wxApp participant exists, and state is CONNECTED', () => {
|
|
100
|
+
expect(
|
|
101
|
+
isWxAppEngagedForControls(true, 'agent-1', participantsById, TaskState.CONNECTED)
|
|
102
|
+
).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('returns false in OFFERED state', () => {
|
|
106
|
+
expect(isWxAppEngagedForControls(true, 'agent-1', participantsById, TaskState.OFFERED)).toBe(
|
|
107
|
+
false
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('returns false when enableWxBetterTogether is false', () => {
|
|
112
|
+
expect(
|
|
113
|
+
isWxAppEngagedForControls(false, 'agent-1', participantsById, TaskState.CONNECTED)
|
|
114
|
+
).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('returns false in TERMINATED state', () => {
|
|
118
|
+
expect(
|
|
119
|
+
isWxAppEngagedForControls(true, 'agent-1', participantsById, TaskState.TERMINATED)
|
|
120
|
+
).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('returns false in COMPLETED state', () => {
|
|
124
|
+
expect(
|
|
125
|
+
isWxAppEngagedForControls(true, 'agent-1', participantsById, TaskState.COMPLETED)
|
|
126
|
+
).toBe(false);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('returns false in WRAPPING_UP state', () => {
|
|
130
|
+
expect(
|
|
131
|
+
isWxAppEngagedForControls(true, 'agent-1', participantsById, TaskState.WRAPPING_UP)
|
|
132
|
+
).toBe(false);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe('decodedLineOwnerId', () => {
|
|
137
|
+
it('returns undefined when lineOwnerId is not provided', () => {
|
|
138
|
+
expect(decodedLineOwnerId(undefined)).toBeUndefined();
|
|
139
|
+
expect(decodedLineOwnerId('')).toBeUndefined();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('decodes base64 encoded ID and returns last path segment', () => {
|
|
143
|
+
const orgId = 'ciscospark://us/ORGANIZATION/org-abc';
|
|
144
|
+
const encoded = btoa(orgId);
|
|
145
|
+
const result = decodedLineOwnerId(encoded);
|
|
146
|
+
|
|
147
|
+
expect(result).toBe('org-abc');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('returns undefined when base64 decoding fails', () => {
|
|
151
|
+
expect(decodedLineOwnerId('not-valid-base64!!')).toBeUndefined();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
@@ -215,6 +215,39 @@ describe("Routing contacts", () => {
|
|
|
215
215
|
expect(req).toBeDefined();
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
+
it('dropConferenceParticipant', () => {
|
|
219
|
+
fakeAqm.pendingRequests = {};
|
|
220
|
+
const req = contact.dropConferenceParticipant({
|
|
221
|
+
interactionId: 'test-interaction-drop-123',
|
|
222
|
+
participantId: '+1/participant 42',
|
|
223
|
+
}) as any;
|
|
224
|
+
|
|
225
|
+
expect(req).toEqual({
|
|
226
|
+
url: '/v1/tasks/test-interaction-drop-123/conference/participants/%2B1%2Fparticipant%2042/drop',
|
|
227
|
+
data: {},
|
|
228
|
+
host: 'wcc-api-gateway',
|
|
229
|
+
err: expect.any(Function),
|
|
230
|
+
redactSensitiveLogs: true,
|
|
231
|
+
notifSuccess: {
|
|
232
|
+
bind: {
|
|
233
|
+
type: 'RoutingMessage',
|
|
234
|
+
data: {
|
|
235
|
+
type: 'ParticipantLeftConference',
|
|
236
|
+
interactionId: 'test-interaction-drop-123',
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
msg: {},
|
|
240
|
+
},
|
|
241
|
+
notifFail: {
|
|
242
|
+
bind: {
|
|
243
|
+
type: 'RoutingMessage',
|
|
244
|
+
data: {type: 'ParticipantDropConferenceFailed'},
|
|
245
|
+
},
|
|
246
|
+
errId: 'Service.aqm.task.dropConferenceParticipant',
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
218
251
|
it("exitConference", () => {
|
|
219
252
|
fakeAqm.pendingRequests = {};
|
|
220
253
|
const req = contact.exitConference({
|