@webex/contact-center 3.12.0-next.149 → 3.12.0-next.150
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 +1 -1
- package/ai-docs/CONTRACTS.md +1 -0
- package/dist/cc.js +4 -4
- package/dist/cc.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/services/config/Util.js +38 -45
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +15 -71
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +49 -226
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +33 -11
- package/dist/services/config/types.js.map +1 -1
- package/dist/types/cc.d.ts +3 -3
- package/dist/types/index.d.ts +16 -8
- package/dist/types/services/config/Util.d.ts +4 -8
- package/dist/types/services/config/constants.d.ts +15 -71
- package/dist/types/services/config/index.d.ts +16 -64
- package/dist/types/services/config/types.d.ts +97 -160
- package/dist/webex.js +1 -1
- package/package.json +1 -1
- package/src/cc.ts +4 -4
- package/src/index.ts +16 -8
- package/src/services/agent/ai-docs/AGENTS.md +1 -1
- package/src/services/config/Util.ts +43 -82
- package/src/services/config/ai-docs/AGENTS.md +34 -39
- package/src/services/config/ai-docs/ARCHITECTURE.md +88 -101
- package/src/services/config/ai-docs/config-spec.md +115 -132
- package/src/services/config/constants.ts +18 -80
- package/src/services/config/index.ts +52 -278
- package/src/services/config/types.ts +101 -185
- package/test/unit/spec/index.ts +6 -2
- package/test/unit/spec/services/config/Util.ts +442 -70
- package/test/unit/spec/services/config/index.ts +246 -544
- package/typedoc.md +1 -1
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import {parseAgentConfigs} from '../../../../../src/services/config/Util';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AgentProfile,
|
|
4
|
+
AuxCode,
|
|
5
|
+
DialPlanEntity,
|
|
6
|
+
OrgDesktopLoginResponse,
|
|
7
|
+
TeamList,
|
|
8
|
+
} from '../../../../../src/services/config/types';
|
|
3
9
|
|
|
4
|
-
const baseAgentProfile:
|
|
10
|
+
const baseAgentProfile: AgentProfile = {
|
|
5
11
|
timeoutDesktopInactivityCustomEnabled: false,
|
|
6
12
|
timeoutDesktopInactivityMins: 10,
|
|
7
13
|
accessWrapUpCode: 'ALL',
|
|
8
|
-
wrapUpCodes: [],
|
|
9
14
|
accessIdleCode: 'ALL',
|
|
10
|
-
idleCodes: [],
|
|
11
15
|
autoWrapUp: false,
|
|
12
16
|
autoWrapAfterSeconds: 30,
|
|
13
17
|
lastAgentRouting: false,
|
|
@@ -21,29 +25,23 @@ const baseAgentProfile: DesktopProfileResponse = {
|
|
|
21
25
|
addressBookId: 'ab-1',
|
|
22
26
|
outdialANIId: 'ani-1',
|
|
23
27
|
loginVoiceOptions: [],
|
|
24
|
-
dialPlans: [],
|
|
25
28
|
agentDNValidation: 'PROVISIONED_VALUE',
|
|
26
29
|
accessQueue: 'SPECIFIC',
|
|
27
30
|
accessEntryPoint: 'NONE',
|
|
28
31
|
accessBuddyTeam: 'ALL',
|
|
29
|
-
} as
|
|
32
|
+
} as AgentProfile;
|
|
30
33
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
dbId: 'db-1',
|
|
41
|
-
deafultDialledNumber: '+15551234567',
|
|
42
|
-
id: 'user-1',
|
|
43
|
-
teamIds: ['team-1'],
|
|
34
|
+
const baseOrgConfig: OrgDesktopLoginResponse = {
|
|
35
|
+
organization: {
|
|
36
|
+
tenantId: 'tenant-1',
|
|
37
|
+
timezone: 'UTC',
|
|
38
|
+
},
|
|
39
|
+
organizationSetting: {
|
|
40
|
+
campaignManagerEnabled: false,
|
|
41
|
+
webRtcEnabled: true,
|
|
42
|
+
maskSensitiveData: false,
|
|
44
43
|
},
|
|
45
|
-
|
|
46
|
-
tenantData: {
|
|
44
|
+
tenantConfiguration: {
|
|
47
45
|
timeoutDesktopInactivityEnabled: false,
|
|
48
46
|
timeoutDesktopInactivityMins: 15,
|
|
49
47
|
forceDefaultDn: false,
|
|
@@ -54,76 +52,450 @@ const baseProfileData = {
|
|
|
54
52
|
endConsultEnabled: true,
|
|
55
53
|
callVariablesSuppressed: false,
|
|
56
54
|
privacyShieldVisible: false,
|
|
55
|
+
lostConnectionRecoveryTimeout: 120000,
|
|
57
56
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
urlMappings: {},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const baseProfileData = {
|
|
61
|
+
orgConfig: baseOrgConfig,
|
|
62
|
+
userData: {
|
|
63
|
+
ciUserId: 'agent-1',
|
|
64
|
+
firstName: 'Jane',
|
|
65
|
+
lastName: 'Agent',
|
|
66
|
+
email: 'jane@example.com',
|
|
67
|
+
agentProfileId: 'profile-1',
|
|
68
|
+
skillProfileId: 'skill-1',
|
|
69
|
+
siteId: 'site-1',
|
|
70
|
+
dbId: 'db-1',
|
|
71
|
+
deafultDialledNumber: '+15551234567',
|
|
72
|
+
id: 'user-1',
|
|
68
73
|
},
|
|
69
74
|
agentProfileData: baseAgentProfile,
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
teamData: [{id: 'team-1', name: 'Support'}] as TeamList[],
|
|
76
|
+
auxCodes: [] as AuxCode[],
|
|
77
|
+
dialPlanData: [] as DialPlanEntity[],
|
|
72
78
|
multimediaProfileId: 'mm-1',
|
|
73
|
-
aiFeatureFlags: {data: []},
|
|
74
79
|
};
|
|
75
80
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
const auxCodePool: AuxCode[] = [
|
|
82
|
+
{
|
|
83
|
+
id: 'idle-1',
|
|
84
|
+
name: 'Meeting',
|
|
85
|
+
workTypeCode: 'IDLE_CODE',
|
|
86
|
+
active: true,
|
|
87
|
+
defaultCode: false,
|
|
88
|
+
isSystemCode: false,
|
|
89
|
+
description: '',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'idle-2',
|
|
93
|
+
name: 'Lunch',
|
|
94
|
+
workTypeCode: 'IDLE_CODE',
|
|
95
|
+
active: true,
|
|
96
|
+
defaultCode: false,
|
|
97
|
+
isSystemCode: false,
|
|
98
|
+
description: '',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'idle-3',
|
|
102
|
+
name: 'Retired',
|
|
103
|
+
workTypeCode: 'IDLE_CODE',
|
|
104
|
+
active: false,
|
|
105
|
+
defaultCode: false,
|
|
106
|
+
isSystemCode: false,
|
|
107
|
+
description: '',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'wrap-1',
|
|
111
|
+
name: 'Sale',
|
|
112
|
+
workTypeCode: 'WRAP_UP_CODE',
|
|
113
|
+
active: true,
|
|
114
|
+
defaultCode: true,
|
|
115
|
+
isSystemCode: false,
|
|
116
|
+
description: '',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'wrap-2',
|
|
120
|
+
name: 'No Sale',
|
|
121
|
+
workTypeCode: 'WRAP_UP_CODE',
|
|
122
|
+
active: true,
|
|
123
|
+
defaultCode: false,
|
|
124
|
+
isSystemCode: false,
|
|
125
|
+
description: '',
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
const dialPlans: DialPlanEntity[] = [
|
|
130
|
+
{
|
|
131
|
+
id: 'plan-1',
|
|
132
|
+
name: 'US',
|
|
133
|
+
regularExpression: '1[0-9]{10}',
|
|
134
|
+
prefix: '1',
|
|
135
|
+
strippedChars: '( )-',
|
|
136
|
+
active: true,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 'plan-2',
|
|
140
|
+
name: 'Any Format',
|
|
141
|
+
regularExpression: '[0-9a-zA-Z]+',
|
|
142
|
+
prefix: '',
|
|
143
|
+
strippedChars: '( )-',
|
|
144
|
+
active: true,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: 'plan-3',
|
|
148
|
+
name: 'Retired',
|
|
149
|
+
regularExpression: '[0-9]+',
|
|
150
|
+
prefix: '',
|
|
151
|
+
strippedChars: '',
|
|
152
|
+
active: false,
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
describe('parseAgentConfigs', () => {
|
|
157
|
+
describe('organization aggregate mapping', () => {
|
|
158
|
+
it('maps every org-sourced field from the aggregate sections', () => {
|
|
159
|
+
const profile = parseAgentConfigs({
|
|
160
|
+
...baseProfileData,
|
|
161
|
+
orgConfig: {
|
|
162
|
+
...baseOrgConfig,
|
|
163
|
+
organizationSetting: {
|
|
164
|
+
campaignManagerEnabled: true,
|
|
165
|
+
webRtcEnabled: true,
|
|
166
|
+
maskSensitiveData: true,
|
|
167
|
+
},
|
|
168
|
+
tenantConfiguration: {
|
|
169
|
+
...baseOrgConfig.tenantConfiguration,
|
|
170
|
+
forceDefaultDn: true,
|
|
171
|
+
dnDefaultRegex: 'regexUS',
|
|
172
|
+
dnOtherRegex: 'regexOther',
|
|
173
|
+
privacyShieldVisible: true,
|
|
174
|
+
timeoutDesktopInactivityEnabled: true,
|
|
175
|
+
timeoutDesktopInactivityMins: 15,
|
|
176
|
+
},
|
|
177
|
+
urlMappings: {
|
|
178
|
+
ACQUEON_API_URL: 'https://api.example.com',
|
|
179
|
+
ACQUEON_CONSOLE_URL: 'https://console.example.com',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(profile.enterpriseId).toBe('tenant-1');
|
|
185
|
+
expect(profile.tenantTimezone).toBe('UTC');
|
|
186
|
+
expect(profile.isCampaignManagementEnabled).toBe(true);
|
|
187
|
+
expect(profile.webRtcEnabled).toBe(true);
|
|
188
|
+
expect(profile.maskSensitiveData).toBe(true);
|
|
189
|
+
expect(profile.forceDefaultDn).toBe(true);
|
|
190
|
+
expect(profile.regexUS).toBe('regexUS');
|
|
191
|
+
expect(profile.regexOther).toBe('regexOther');
|
|
192
|
+
expect(profile.privacyShieldVisible).toBe(true);
|
|
193
|
+
expect(profile.isOutboundEnabledForTenant).toBe(true);
|
|
194
|
+
expect(profile.isEndTaskEnabled).toBe(true);
|
|
195
|
+
expect(profile.isEndConsultEnabled).toBe(true);
|
|
196
|
+
expect(profile.lostConnectionRecoveryTimeout).toBe(120000);
|
|
197
|
+
expect(profile.isTimeoutDesktopInactivityEnabled).toBe(true);
|
|
198
|
+
expect(profile.timeoutDesktopInactivityMins).toBe(15);
|
|
199
|
+
expect(profile.callVariablesSuppressed).toBe(false);
|
|
200
|
+
expect(profile.urlMappings).toEqual({
|
|
201
|
+
acqueonApiUrl: 'https://api.example.com',
|
|
202
|
+
acqueonConsoleUrl: 'https://console.example.com',
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('no longer emits environment', () => {
|
|
207
|
+
expect(parseAgentConfigs(baseProfileData)).not.toHaveProperty('environment');
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('defaults the Acqueon URLs when urlMappings is empty or absent', () => {
|
|
211
|
+
const emptyUrlMappings = {acqueonApiUrl: '', acqueonConsoleUrl: ''};
|
|
212
|
+
|
|
213
|
+
expect(parseAgentConfigs(baseProfileData).urlMappings).toEqual(emptyUrlMappings);
|
|
214
|
+
expect(
|
|
215
|
+
parseAgentConfigs({
|
|
216
|
+
...baseProfileData,
|
|
217
|
+
orgConfig: {...baseOrgConfig, urlMappings: undefined},
|
|
218
|
+
}).urlMappings
|
|
219
|
+
).toEqual(emptyUrlMappings);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('maps the MSFT and Webex configuration from org level', () => {
|
|
223
|
+
const profile = parseAgentConfigs({
|
|
224
|
+
...baseProfileData,
|
|
225
|
+
orgConfig: {
|
|
226
|
+
...baseOrgConfig,
|
|
227
|
+
microsoftConfig: {showUserDetails: true, stateSynchronization: false},
|
|
228
|
+
webexConfig: {showUserDetails: false, stateSynchronization: true},
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
expect(profile.microsoftConfig).toEqual({
|
|
233
|
+
showUserDetailsMS: true,
|
|
234
|
+
stateSynchronizationMS: false,
|
|
235
|
+
});
|
|
236
|
+
expect(profile.webexConfig).toEqual({
|
|
237
|
+
showUserDetailsWebex: false,
|
|
238
|
+
stateSynchronizationWebex: true,
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('defaults the MSFT and Webex configuration to false when the sections are absent', () => {
|
|
243
|
+
const profile = parseAgentConfigs(baseProfileData);
|
|
244
|
+
|
|
245
|
+
expect(profile.microsoftConfig).toEqual({
|
|
246
|
+
showUserDetailsMS: false,
|
|
247
|
+
stateSynchronizationMS: false,
|
|
248
|
+
});
|
|
249
|
+
expect(profile.webexConfig).toEqual({
|
|
250
|
+
showUserDetailsWebex: false,
|
|
251
|
+
stateSynchronizationWebex: false,
|
|
252
|
+
});
|
|
253
|
+
});
|
|
79
254
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
255
|
+
it('maps the aiFeature section through as-is', () => {
|
|
256
|
+
const aiFeature = {
|
|
257
|
+
realtimeTranscripts: {enable: true},
|
|
258
|
+
suggestedResponses: {enable: false},
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
expect(parseAgentConfigs({...baseProfileData, orgConfig: {...baseOrgConfig, aiFeature}})
|
|
262
|
+
.aiFeature).toBe(aiFeature);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('leaves aiFeature undefined when the section is absent', () => {
|
|
266
|
+
expect(parseAgentConfigs(baseProfileData).aiFeature).toBeUndefined();
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
describe('user aggregate mapping', () => {
|
|
271
|
+
it('maps every user-sourced and agentProfile-sourced field', () => {
|
|
272
|
+
const profile = parseAgentConfigs(baseProfileData);
|
|
273
|
+
|
|
274
|
+
expect(profile.agentId).toBe('agent-1');
|
|
275
|
+
expect(profile.agentName).toBe('Jane Agent');
|
|
276
|
+
expect(profile.agentMailId).toBe('jane@example.com');
|
|
277
|
+
expect(profile.agentProfileID).toBe('profile-1');
|
|
278
|
+
expect(profile.defaultDn).toBe('+15551234567');
|
|
279
|
+
expect(profile.siteId).toBe('site-1');
|
|
280
|
+
expect(profile.analyserUserId).toBe('user-1');
|
|
281
|
+
expect(profile.agentDbId).toBe('db-1');
|
|
282
|
+
expect(profile.skillProfileId).toBe('skill-1');
|
|
283
|
+
expect(profile.multimediaProfileId).toBe('mm-1');
|
|
284
|
+
expect(profile.teams).toEqual(baseProfileData.teamData);
|
|
285
|
+
expect(profile.forceDefaultDnForAgent).toBe(true);
|
|
286
|
+
expect(profile.isAdhocDialingEnabled).toBe(false);
|
|
287
|
+
expect(profile.idleCodesAccess).toBe('ALL');
|
|
288
|
+
expect(profile.isOutboundEnabledForAgent).toBe(true);
|
|
289
|
+
expect(profile.isAgentAvailableAfterOutdial).toBe(true);
|
|
290
|
+
expect(profile.outDialEp).toBe('ep-1');
|
|
291
|
+
expect(profile.outdialANIId).toBe('ani-1');
|
|
292
|
+
expect(profile.addressBookId).toBe('ab-1');
|
|
293
|
+
expect(profile.agentPersonalStatsEnabled).toBe(false);
|
|
294
|
+
expect(profile.loginVoiceOptions).toEqual([]);
|
|
295
|
+
expect(profile.wrapUpData.wrapUpProps).toMatchObject({
|
|
296
|
+
autoWrapup: false,
|
|
297
|
+
autoWrapupInterval: 30,
|
|
298
|
+
lastAgentRoute: false,
|
|
299
|
+
wrapUpCodeAccess: 'ALL',
|
|
300
|
+
allowCancelAutoWrapup: false,
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('maps collaboration access flags onto Profile', () => {
|
|
305
|
+
const profile = parseAgentConfigs(baseProfileData);
|
|
306
|
+
|
|
307
|
+
expect(profile.allowConsultToQueue).toBe(false);
|
|
308
|
+
expect(profile.accessQueue).toBe('SPECIFIC');
|
|
309
|
+
expect(profile.accessEntryPoint).toBe('NONE');
|
|
310
|
+
expect(profile.accessBuddyTeam).toBe('ALL');
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('no longer emits autoAnswer', () => {
|
|
314
|
+
expect(parseAgentConfigs(baseProfileData)).not.toHaveProperty('autoAnswer');
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it('falls back to null when the agent has no skill profile', () => {
|
|
318
|
+
const profile = parseAgentConfigs({
|
|
319
|
+
...baseProfileData,
|
|
320
|
+
userData: {...baseProfileData.userData, skillProfileId: ''},
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
expect(profile.skillProfileId).toBeNull();
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it.each([
|
|
327
|
+
{
|
|
328
|
+
name: 'the agent override when custom inactivity timeout is enabled',
|
|
329
|
+
customEnabled: true,
|
|
330
|
+
tenantEnabled: false,
|
|
331
|
+
expected: 10,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: 'the tenant value when only the tenant timeout is enabled',
|
|
335
|
+
customEnabled: false,
|
|
336
|
+
tenantEnabled: true,
|
|
337
|
+
expected: 15,
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: 'null when neither is enabled',
|
|
341
|
+
customEnabled: false,
|
|
342
|
+
tenantEnabled: false,
|
|
343
|
+
expected: null,
|
|
344
|
+
},
|
|
345
|
+
])('resolves timeoutDesktopInactivityMins to $name', ({customEnabled, tenantEnabled, expected}) => {
|
|
346
|
+
const profile = parseAgentConfigs({
|
|
347
|
+
...baseProfileData,
|
|
348
|
+
orgConfig: {
|
|
349
|
+
...baseOrgConfig,
|
|
350
|
+
tenantConfiguration: {
|
|
351
|
+
...baseOrgConfig.tenantConfiguration,
|
|
352
|
+
timeoutDesktopInactivityEnabled: tenantEnabled,
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
agentProfileData: {
|
|
356
|
+
...baseAgentProfile,
|
|
357
|
+
timeoutDesktopInactivityCustomEnabled: customEnabled,
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
expect(profile.timeoutDesktopInactivityMins).toBe(expected);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('does not throw when the aggregate omits the inactivity minutes', () => {
|
|
365
|
+
const profile = parseAgentConfigs({
|
|
366
|
+
...baseProfileData,
|
|
367
|
+
orgConfig: {
|
|
368
|
+
...baseOrgConfig,
|
|
369
|
+
tenantConfiguration: {
|
|
370
|
+
...baseOrgConfig.tenantConfiguration,
|
|
371
|
+
timeoutDesktopInactivityEnabled: true,
|
|
372
|
+
timeoutDesktopInactivityMins: undefined,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
agentProfileData: {...baseAgentProfile, timeoutDesktopInactivityMins: undefined},
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
expect(profile.timeoutDesktopInactivityMins).toBeUndefined();
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
describe('auxiliary codes', () => {
|
|
383
|
+
it('splits the pool by workTypeCode and appends the synthetic Available code', () => {
|
|
384
|
+
const profile = parseAgentConfigs({...baseProfileData, auxCodes: auxCodePool});
|
|
385
|
+
|
|
386
|
+
expect(profile.idleCodes).toEqual([
|
|
387
|
+
{id: 'idle-1', name: 'Meeting', isSystem: false, isDefault: false},
|
|
388
|
+
{id: 'idle-2', name: 'Lunch', isSystem: false, isDefault: false},
|
|
389
|
+
{id: '0', name: 'Available', isSystem: false, isDefault: false},
|
|
390
|
+
]);
|
|
391
|
+
expect(profile.wrapupCodes).toEqual([
|
|
392
|
+
{id: 'wrap-1', name: 'Sale', isSystem: false, isDefault: true},
|
|
393
|
+
{id: 'wrap-2', name: 'No Sale', isSystem: false, isDefault: false},
|
|
394
|
+
]);
|
|
395
|
+
expect(profile.defaultWrapupCode).toBe('wrap-1');
|
|
396
|
+
expect(profile.wrapUpData.wrapUpProps.wrapUpReasonList).toEqual(profile.wrapupCodes);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it('defaults defaultWrapupCode to an empty string when no code is default', () => {
|
|
400
|
+
const profile = parseAgentConfigs({
|
|
401
|
+
...baseProfileData,
|
|
402
|
+
auxCodes: auxCodePool.map((code) => ({...code, defaultCode: false})),
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
expect(profile.defaultWrapupCode).toBe('');
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it.each(['accessIdleCode', 'accessWrapUpCode'] as const)(
|
|
409
|
+
'returns the supplied pool unfiltered but still reports %s when access is SPECIFIC',
|
|
410
|
+
(accessField) => {
|
|
411
|
+
const profile = parseAgentConfigs({
|
|
412
|
+
...baseProfileData,
|
|
413
|
+
auxCodes: auxCodePool,
|
|
414
|
+
agentProfileData: {...baseAgentProfile, [accessField]: 'SPECIFIC'},
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
expect(profile.idleCodes).toHaveLength(3);
|
|
418
|
+
expect(profile.wrapupCodes).toHaveLength(2);
|
|
419
|
+
expect(profile.idleCodesAccess).toBe(
|
|
420
|
+
accessField === 'accessIdleCode' ? 'SPECIFIC' : 'ALL'
|
|
421
|
+
);
|
|
422
|
+
expect(profile.wrapUpData.wrapUpProps.wrapUpCodeAccess).toBe(
|
|
423
|
+
accessField === 'accessWrapUpCode' ? 'SPECIFIC' : 'ALL'
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
describe('dial plan', () => {
|
|
430
|
+
it('builds dialPlanEntity from every active plan when dial planning is enabled', () => {
|
|
431
|
+
const profile = parseAgentConfigs({
|
|
432
|
+
...baseProfileData,
|
|
433
|
+
dialPlanData: dialPlans,
|
|
434
|
+
agentProfileData: {...baseAgentProfile, dialPlanEnabled: true},
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
expect(profile.dialPlan).toEqual({
|
|
438
|
+
type: 'adhocDial',
|
|
439
|
+
dialPlanEntity: [
|
|
440
|
+
{regex: '1[0-9]{10}', prefix: '1', strippedChars: '( )-', name: 'US'},
|
|
441
|
+
{regex: '[0-9a-zA-Z]+', prefix: '', strippedChars: '( )-', name: 'Any Format'},
|
|
442
|
+
],
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
it('leaves dialPlan undefined when dial planning is disabled', () => {
|
|
447
|
+
expect(parseAgentConfigs({...baseProfileData, dialPlanData: dialPlans}).dialPlan).toBeUndefined();
|
|
448
|
+
});
|
|
84
449
|
});
|
|
85
450
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
|
|
451
|
+
describe('wellness break', () => {
|
|
452
|
+
it('enables wellness only when organization config, reminders, and license are present', () => {
|
|
453
|
+
const profile = parseAgentConfigs({
|
|
454
|
+
...baseProfileData,
|
|
455
|
+
orgConfig: {
|
|
456
|
+
...baseOrgConfig,
|
|
457
|
+
organizationSetting: {...baseOrgConfig.organizationSetting, aiAssistantQuantity: 1},
|
|
458
|
+
aiFeature: {
|
|
94
459
|
agentWellbeing: {
|
|
95
460
|
enable: true,
|
|
96
461
|
wellnessBreakReminders: 'ENABLED',
|
|
97
462
|
},
|
|
98
463
|
},
|
|
99
|
-
|
|
100
|
-
}
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
expect(profile.isWellnessBreakEnabled).toBe(true);
|
|
101
468
|
});
|
|
102
469
|
|
|
103
|
-
|
|
104
|
-
|
|
470
|
+
it.each([
|
|
471
|
+
{quantity: 0, enable: true, reminders: 'ENABLED'},
|
|
472
|
+
{quantity: 1, enable: false, reminders: 'ENABLED'},
|
|
473
|
+
{quantity: 1, enable: true, reminders: 'DISABLED'},
|
|
474
|
+
] as const)('disables wellness when an effective gate is missing', ({quantity, enable, reminders}) => {
|
|
475
|
+
const profile = parseAgentConfigs({
|
|
476
|
+
...baseProfileData,
|
|
477
|
+
orgConfig: {
|
|
478
|
+
...baseOrgConfig,
|
|
479
|
+
organizationSetting: {...baseOrgConfig.organizationSetting, aiAssistantQuantity: quantity},
|
|
480
|
+
aiFeature: {
|
|
481
|
+
agentWellbeing: {enable, wellnessBreakReminders: reminders},
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
expect(profile.isWellnessBreakEnabled).toBe(false);
|
|
487
|
+
});
|
|
105
488
|
|
|
106
|
-
|
|
107
|
-
{quantity: 0, enable: true, reminders: 'ENABLED'},
|
|
108
|
-
{quantity: 1, enable: false, reminders: 'ENABLED'},
|
|
109
|
-
{quantity: 1, enable: true, reminders: 'DISABLED'},
|
|
110
|
-
] as const)(
|
|
111
|
-
'disables wellness when an effective gate is missing',
|
|
112
|
-
({quantity, enable, reminders}) => {
|
|
489
|
+
it('disables wellness when the aiFeature section is absent', () => {
|
|
113
490
|
const profile = parseAgentConfigs({
|
|
114
491
|
...baseProfileData,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
{
|
|
119
|
-
id: 'ai-feature-1',
|
|
120
|
-
agentWellbeing: {enable, wellnessBreakReminders: reminders},
|
|
121
|
-
},
|
|
122
|
-
],
|
|
492
|
+
orgConfig: {
|
|
493
|
+
...baseOrgConfig,
|
|
494
|
+
organizationSetting: {...baseOrgConfig.organizationSetting, aiAssistantQuantity: 1},
|
|
123
495
|
},
|
|
124
496
|
});
|
|
125
497
|
|
|
126
498
|
expect(profile.isWellnessBreakEnabled).toBe(false);
|
|
127
|
-
}
|
|
128
|
-
);
|
|
499
|
+
});
|
|
500
|
+
});
|
|
129
501
|
});
|