@webex/contact-center 3.11.0 → 3.12.0-mobius-socket.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/dist/cc.js +121 -28
- package/dist/cc.js.map +1 -1
- package/dist/constants.js +5 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js +7 -0
- 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 +9 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +173 -0
- package/dist/services/ApiAiAssistant.js.map +1 -0
- package/dist/services/agent/types.js.map +1 -1
- package/dist/services/config/Util.js +6 -2
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +12 -0
- 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 +19 -1
- 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 +28 -6
- 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 +20 -5
- 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/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/TaskManager.js +117 -24
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +16 -3
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +15 -1
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +51 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/types.js +15 -0
- package/dist/services/task/types.js.map +1 -1
- package/dist/types/cc.d.ts +801 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/constants.d.ts +50 -0
- package/dist/types/index.d.ts +184 -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 +161 -0
- package/dist/types/services/AddressBook.d.ts +74 -0
- package/dist/types/services/ApiAiAssistant.d.ts +31 -0
- package/dist/types/services/EntryPoint.d.ts +67 -0
- package/dist/types/services/Queue.d.ts +76 -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 +249 -0
- package/dist/types/services/config/index.d.ts +177 -0
- package/dist/types/services/config/types.d.ts +1207 -0
- package/dist/types/services/constants.d.ts +110 -0
- package/dist/types/services/core/Err.d.ts +121 -0
- package/dist/types/services/core/GlobalTypes.d.ts +58 -0
- package/dist/types/services/core/Utils.d.ts +101 -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 +35 -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/TaskManager.d.ts +1 -0
- package/dist/types/services/task/TaskUtils.d.ts +92 -0
- package/dist/types/services/task/constants.d.ts +84 -0
- package/dist/types/services/task/contact.d.ts +69 -0
- package/dist/types/services/task/dialer.d.ts +43 -0
- package/dist/types/services/task/index.d.ts +650 -0
- package/dist/types/services/task/types.d.ts +1319 -0
- package/dist/types/types.d.ts +643 -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 +7 -0
- package/dist/types.js +14 -1
- package/dist/types.js.map +1 -1
- package/dist/webex.js +1 -1
- package/package.json +9 -9
- package/src/cc.ts +157 -30
- package/src/constants.ts +4 -0
- package/src/index.ts +1 -0
- package/src/metrics/behavioral-events.ts +14 -0
- package/src/metrics/constants.ts +11 -0
- package/src/services/ApiAiAssistant.ts +217 -0
- package/src/services/agent/types.ts +1 -1
- package/src/services/config/Util.ts +8 -0
- package/src/services/config/constants.ts +12 -0
- package/src/services/config/index.ts +45 -1
- package/src/services/config/types.ts +67 -0
- package/src/services/constants.ts +29 -0
- package/src/services/core/Err.ts +1 -0
- package/src/services/core/Utils.ts +32 -5
- package/src/services/core/aqm-reqs.ts +100 -22
- package/src/services/core/websocket/WebSocketManager.ts +21 -6
- package/src/services/core/websocket/connection-service.ts +5 -1
- package/src/services/index.ts +4 -0
- package/src/services/task/TaskManager.ts +174 -27
- package/src/services/task/TaskUtils.ts +12 -0
- package/src/services/task/constants.ts +16 -0
- package/src/services/task/dialer.ts +56 -1
- package/src/services/task/types.ts +24 -0
- package/src/types.ts +40 -1
- package/test/unit/spec/cc.ts +163 -23
- package/test/unit/spec/services/ApiAiAssistant.ts +115 -0
- package/test/unit/spec/services/config/index.ts +56 -0
- package/test/unit/spec/services/core/Utils.ts +63 -1
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +82 -12
- package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
- package/test/unit/spec/services/task/TaskManager.ts +1119 -251
- package/test/unit/spec/services/task/dialer.ts +198 -112
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -1,157 +1,243 @@
|
|
|
1
|
-
import AqmReqs from
|
|
2
|
-
import aqmDialer from
|
|
1
|
+
import AqmReqs from '../../../../../src/services/core/aqm-reqs';
|
|
2
|
+
import aqmDialer from '../../../../../src/services/task/dialer';
|
|
3
3
|
|
|
4
4
|
jest.mock('../../../../../src/services/core/Utils', () => ({
|
|
5
|
-
|
|
6
5
|
createErrDetailsObject: jest.fn(),
|
|
7
6
|
getRoutingHost: jest.fn(),
|
|
8
|
-
|
|
9
7
|
}));
|
|
10
8
|
|
|
11
9
|
jest.mock('../../../../../src/services/core/aqm-reqs');
|
|
12
10
|
|
|
13
11
|
describe('AQM routing dialer', () => {
|
|
14
|
-
|
|
15
12
|
let fakeAqm: jest.Mocked<AqmReqs>;
|
|
16
13
|
|
|
17
14
|
beforeEach(() => {
|
|
18
|
-
|
|
19
15
|
jest.clearAllMocks();
|
|
20
16
|
|
|
21
17
|
fakeAqm = new AqmReqs() as jest.Mocked<AqmReqs>;
|
|
22
18
|
fakeAqm.reqEmpty = jest.fn().mockImplementation((fn) => fn);
|
|
23
19
|
fakeAqm.req = jest.fn().mockImplementation((fn) => fn);
|
|
20
|
+
});
|
|
24
21
|
|
|
22
|
+
describe('Routing outbound dial', () => {
|
|
23
|
+
it('should call the startdial api', () => {
|
|
24
|
+
const fakeAqm = {
|
|
25
|
+
req: () =>
|
|
26
|
+
jest.fn().mockResolvedValue(() => {
|
|
27
|
+
Promise.resolve({data: 'outdial success'});
|
|
28
|
+
}),
|
|
29
|
+
evt: jest.fn(),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
33
|
+
|
|
34
|
+
dialer
|
|
35
|
+
.startOutdial({
|
|
36
|
+
data: {
|
|
37
|
+
entryPointId: '1212312',
|
|
38
|
+
destination: '+142356',
|
|
39
|
+
direction: 'OUTBOUND',
|
|
40
|
+
attributes: {},
|
|
41
|
+
mediaType: 'telephony',
|
|
42
|
+
outboundType: 'OUTDIAL',
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
.then((response) => {
|
|
46
|
+
expect(response.data).toBe('outdial success');
|
|
47
|
+
})
|
|
48
|
+
.catch(() => {
|
|
49
|
+
expect(true).toBe(true);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(dialer.startOutdial).toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should handle network errors', () => {
|
|
56
|
+
const fakeAqm = {
|
|
57
|
+
req: () => jest.fn().mockRejectedValue(new Error('Network Error')),
|
|
58
|
+
evt: jest.fn(),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
62
|
+
|
|
63
|
+
return expect(
|
|
64
|
+
dialer.startOutdial({
|
|
65
|
+
data: {
|
|
66
|
+
entryPointId: '1212312',
|
|
67
|
+
destination: '+142356',
|
|
68
|
+
direction: 'OUTBOUND',
|
|
69
|
+
attributes: {},
|
|
70
|
+
mediaType: 'telephony',
|
|
71
|
+
outboundType: 'OUTDIAL',
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
).rejects.toThrow('Network Error');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should handle invalid payload', () => {
|
|
78
|
+
const fakeAqm = {
|
|
79
|
+
req: () => jest.fn().mockRejectedValue(new Error('Invalid Payload in request')),
|
|
80
|
+
evt: jest.fn(),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
84
|
+
|
|
85
|
+
return expect(
|
|
86
|
+
dialer.startOutdial({
|
|
87
|
+
data: {
|
|
88
|
+
entryPointId: '',
|
|
89
|
+
destination: '',
|
|
90
|
+
direction: 'OUTBOUND',
|
|
91
|
+
attributes: {},
|
|
92
|
+
mediaType: 'telephony',
|
|
93
|
+
outboundType: 'OUTDIAL',
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
).rejects.toThrow('Invalid Payload in request');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should handle servers errors', () => {
|
|
100
|
+
const fakeAqm = {
|
|
101
|
+
req: () => jest.fn().mockRejectedValue(new Error('Server Error')),
|
|
102
|
+
evt: jest.fn(),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
106
|
+
return expect(
|
|
107
|
+
dialer.startOutdial({
|
|
108
|
+
data: {
|
|
109
|
+
entryPointId: '123456',
|
|
110
|
+
destination: '+142356',
|
|
111
|
+
direction: 'OUTBOUND',
|
|
112
|
+
attributes: {},
|
|
113
|
+
mediaType: 'telephony',
|
|
114
|
+
outboundType: 'OUTDIAL',
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
).rejects.toThrow('Server Error');
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should handle Timeout scenarios', () => {
|
|
121
|
+
const fakeAqm = {
|
|
122
|
+
req: () => jest.fn().mockRejectedValue(new Error('Request Timeout')),
|
|
123
|
+
evt: jest.fn(),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
127
|
+
return expect(
|
|
128
|
+
dialer.startOutdial({
|
|
129
|
+
data: {
|
|
130
|
+
entryPointId: '12345',
|
|
131
|
+
destination: '+123456',
|
|
132
|
+
direction: 'OUTBOUND',
|
|
133
|
+
attributes: {},
|
|
134
|
+
mediaType: 'telephony',
|
|
135
|
+
outboundType: 'OUTDIAL',
|
|
136
|
+
},
|
|
137
|
+
})
|
|
138
|
+
).rejects.toThrow('Request Timeout');
|
|
139
|
+
});
|
|
25
140
|
});
|
|
26
141
|
|
|
27
|
-
describe(
|
|
142
|
+
describe('Campaign preview contact operations', () => {
|
|
143
|
+
const previewPayload = {
|
|
144
|
+
interactionId: 'interaction-123',
|
|
145
|
+
campaignId: 'TestCampaignPreview',
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
describe('acceptPreviewContact', () => {
|
|
149
|
+
it('should construct the correct URL with campaignId and interactionId', () => {
|
|
150
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
151
|
+
const config = dialer.acceptPreviewContact({data: previewPayload}) as any;
|
|
152
|
+
|
|
153
|
+
expect(config.url).toBe(
|
|
154
|
+
`/v1/dialer/campaign/${previewPayload.campaignId}/preview-task/${previewPayload.interactionId}/accept`
|
|
155
|
+
);
|
|
156
|
+
});
|
|
28
157
|
|
|
29
|
-
|
|
158
|
+
it('should URL-encode campaignId when it contains reserved characters', () => {
|
|
159
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
160
|
+
const payloadWithSpecialChars = {
|
|
161
|
+
interactionId: 'interaction-456',
|
|
162
|
+
campaignId: 'My Campaign/Test #1',
|
|
163
|
+
};
|
|
164
|
+
const config = dialer.acceptPreviewContact({data: payloadWithSpecialChars}) as any;
|
|
165
|
+
|
|
166
|
+
expect(config.url).toBe(
|
|
167
|
+
`/v1/dialer/campaign/${encodeURIComponent(
|
|
168
|
+
payloadWithSpecialChars.campaignId
|
|
169
|
+
)}/preview-task/${payloadWithSpecialChars.interactionId}/accept`
|
|
170
|
+
);
|
|
171
|
+
expect(config.url).toContain('My%20Campaign%2FTest%20%231');
|
|
172
|
+
});
|
|
30
173
|
|
|
174
|
+
it('should call the acceptPreviewContact api', () => {
|
|
31
175
|
const fakeAqm = {
|
|
32
176
|
req: () =>
|
|
33
177
|
jest.fn().mockResolvedValue(() => {
|
|
34
|
-
Promise.resolve({
|
|
178
|
+
Promise.resolve({data: 'accept preview success'});
|
|
35
179
|
}),
|
|
36
|
-
evt: jest.fn()
|
|
180
|
+
evt: jest.fn(),
|
|
37
181
|
};
|
|
38
|
-
|
|
182
|
+
|
|
39
183
|
const dialer = aqmDialer(fakeAqm as any);
|
|
40
184
|
|
|
41
185
|
dialer
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
destination: "+142356",
|
|
46
|
-
direction: "OUTBOUND",
|
|
47
|
-
attributes: {},
|
|
48
|
-
mediaType: "telephony",
|
|
49
|
-
outboundType: "OUTDIAL"
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
.then(response => {
|
|
53
|
-
expect(response.data).toBe("outdial success");
|
|
186
|
+
.acceptPreviewContact({data: previewPayload})
|
|
187
|
+
.then((response) => {
|
|
188
|
+
expect(response.data).toBe('accept preview success');
|
|
54
189
|
})
|
|
55
190
|
.catch(() => {
|
|
56
191
|
expect(true).toBe(true);
|
|
57
192
|
});
|
|
58
|
-
|
|
59
|
-
expect(dialer.startOutdial).toHaveBeenCalled();
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("should handle network errors", () => {
|
|
64
|
-
|
|
65
|
-
const fakeAqm = {
|
|
66
|
-
req: () => jest.fn().mockRejectedValue(new Error("Network Error")),
|
|
67
|
-
evt: jest.fn()
|
|
68
|
-
};
|
|
69
193
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return expect(dialer.startOutdial({
|
|
73
|
-
|
|
74
|
-
data: {
|
|
75
|
-
entryPointId: "1212312",
|
|
76
|
-
destination: "+142356",
|
|
77
|
-
direction: "OUTBOUND",
|
|
78
|
-
attributes: {},
|
|
79
|
-
mediaType: "telephony",
|
|
80
|
-
outboundType: "OUTDIAL"
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
})).rejects.toThrow("Network Error");
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("should handle invalid payload", () => {
|
|
87
|
-
|
|
88
|
-
const fakeAqm = {
|
|
89
|
-
|
|
90
|
-
req: () => jest.fn().mockRejectedValue(new Error("Invalid Payload in request")),
|
|
91
|
-
evt: jest.fn()
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const dialer = aqmDialer(fakeAqm as any);
|
|
96
|
-
|
|
97
|
-
return expect(dialer.startOutdial({
|
|
98
|
-
|
|
99
|
-
data: {
|
|
100
|
-
entryPointId: "",
|
|
101
|
-
destination: "",
|
|
102
|
-
direction: "OUTBOUND",
|
|
103
|
-
attributes: {},
|
|
104
|
-
mediaType: "telephony",
|
|
105
|
-
outboundType: "OUTDIAL"
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
})).rejects.toThrow("Invalid Payload in request");
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
it("should handle servers errors", () => {
|
|
113
|
-
|
|
114
|
-
const fakeAqm = {
|
|
115
|
-
req: () => jest.fn().mockRejectedValue(new Error("Server Error")),
|
|
116
|
-
evt: jest.fn()
|
|
117
|
-
};
|
|
194
|
+
expect(dialer.acceptPreviewContact).toHaveBeenCalled();
|
|
195
|
+
});
|
|
118
196
|
|
|
119
|
-
|
|
120
|
-
|
|
197
|
+
it('should handle network errors', () => {
|
|
198
|
+
const fakeAqm = {
|
|
199
|
+
req: () => jest.fn().mockRejectedValue(new Error('Network Error')),
|
|
200
|
+
evt: jest.fn(),
|
|
201
|
+
};
|
|
121
202
|
|
|
122
|
-
|
|
123
|
-
entryPointId: "123456",
|
|
124
|
-
destination: "+142356",
|
|
125
|
-
direction: "OUTBOUND",
|
|
126
|
-
attributes: {},
|
|
127
|
-
mediaType: "telephony",
|
|
128
|
-
outboundType: "OUTDIAL"
|
|
129
|
-
}
|
|
203
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
130
204
|
|
|
131
|
-
|
|
205
|
+
return expect(
|
|
206
|
+
dialer.acceptPreviewContact({
|
|
207
|
+
data: previewPayload,
|
|
208
|
+
})
|
|
209
|
+
).rejects.toThrow('Network Error');
|
|
210
|
+
});
|
|
132
211
|
|
|
133
|
-
|
|
212
|
+
it('should handle server errors', () => {
|
|
213
|
+
const fakeAqm = {
|
|
214
|
+
req: () => jest.fn().mockRejectedValue(new Error('Server Error')),
|
|
215
|
+
evt: jest.fn(),
|
|
216
|
+
};
|
|
134
217
|
|
|
135
|
-
|
|
218
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
136
219
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
220
|
+
return expect(
|
|
221
|
+
dialer.acceptPreviewContact({
|
|
222
|
+
data: previewPayload,
|
|
223
|
+
})
|
|
224
|
+
).rejects.toThrow('Server Error');
|
|
225
|
+
});
|
|
141
226
|
|
|
142
|
-
|
|
143
|
-
|
|
227
|
+
it('should handle timeout scenarios', () => {
|
|
228
|
+
const fakeAqm = {
|
|
229
|
+
req: () => jest.fn().mockRejectedValue(new Error('Request Timeout')),
|
|
230
|
+
evt: jest.fn(),
|
|
231
|
+
};
|
|
144
232
|
|
|
145
|
-
|
|
146
|
-
entryPointId: "12345",
|
|
147
|
-
destination: "+123456",
|
|
148
|
-
direction: "OUTBOUND",
|
|
149
|
-
attributes: {},
|
|
150
|
-
mediaType: "telephony",
|
|
151
|
-
outboundType: "OUTDIAL"
|
|
152
|
-
}
|
|
233
|
+
const dialer = aqmDialer(fakeAqm as any);
|
|
153
234
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
235
|
+
return expect(
|
|
236
|
+
dialer.acceptPreviewContact({
|
|
237
|
+
data: previewPayload,
|
|
238
|
+
})
|
|
239
|
+
).rejects.toThrow('Request Timeout');
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
});
|
|
157
243
|
});
|