@webex/contact-center 3.9.0-next.9 → 3.10.0-multi-llms.1
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 +193 -47
- package/dist/cc.js.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/logger-proxy.js +24 -1
- package/dist/logger-proxy.js.map +1 -1
- package/dist/metrics/behavioral-events.js +89 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +30 -2
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +271 -0
- package/dist/services/AddressBook.js.map +1 -0
- package/dist/services/EntryPoint.js +227 -0
- package/dist/services/EntryPoint.js.map +1 -0
- package/dist/services/Queue.js +261 -0
- package/dist/services/Queue.js.map +1 -0
- package/dist/services/config/constants.js +36 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +29 -21
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +33 -1
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Utils.js +91 -31
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/constants.js +17 -1
- package/dist/services/core/constants.js.map +1 -1
- package/dist/services/task/TaskManager.js +150 -7
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +104 -0
- package/dist/services/task/TaskUtils.js.map +1 -0
- package/dist/services/task/constants.js +26 -1
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +86 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/index.js +302 -39
- package/dist/services/task/index.js.map +1 -1
- package/dist/services/task/types.js +12 -0
- package/dist/services/task/types.js.map +1 -1
- package/dist/types/cc.d.ts +121 -35
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/metrics/constants.d.ts +24 -1
- package/dist/types/services/AddressBook.d.ts +74 -0
- package/dist/types/services/EntryPoint.d.ts +67 -0
- package/dist/types/services/Queue.d.ts +76 -0
- package/dist/types/services/config/constants.d.ts +35 -1
- package/dist/types/services/config/index.d.ts +6 -9
- package/dist/types/services/config/types.d.ts +79 -58
- package/dist/types/services/core/Utils.d.ts +33 -5
- package/dist/types/services/core/constants.d.ts +14 -0
- package/dist/types/services/task/TaskUtils.d.ts +42 -0
- package/dist/types/services/task/constants.d.ts +23 -0
- package/dist/types/services/task/contact.d.ts +10 -0
- package/dist/types/services/task/index.d.ts +84 -3
- package/dist/types/services/task/types.d.ts +245 -21
- package/dist/types/types.d.ts +162 -0
- package/dist/types/utils/PageCache.d.ts +173 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +192 -0
- package/dist/utils/PageCache.js.map +1 -0
- package/dist/webex.js +1 -1
- package/package.json +10 -9
- package/src/cc.ts +217 -52
- package/src/constants.ts +1 -0
- package/src/index.ts +17 -2
- package/src/logger-proxy.ts +24 -1
- package/src/metrics/behavioral-events.ts +94 -0
- package/src/metrics/constants.ts +34 -1
- package/src/services/AddressBook.ts +291 -0
- package/src/services/EntryPoint.ts +241 -0
- package/src/services/Queue.ts +277 -0
- package/src/services/config/constants.ts +42 -2
- package/src/services/config/index.ts +30 -30
- package/src/services/config/types.ts +59 -58
- package/src/services/core/Utils.ts +101 -41
- package/src/services/core/constants.ts +16 -0
- package/src/services/task/TaskManager.ts +181 -9
- package/src/services/task/TaskUtils.ts +113 -0
- package/src/services/task/constants.ts +25 -0
- package/src/services/task/contact.ts +80 -0
- package/src/services/task/index.ts +364 -54
- package/src/services/task/types.ts +264 -20
- package/src/types.ts +180 -0
- package/src/utils/PageCache.ts +252 -0
- package/test/unit/spec/cc.ts +282 -85
- package/test/unit/spec/metrics/behavioral-events.ts +42 -0
- package/test/unit/spec/services/AddressBook.ts +332 -0
- package/test/unit/spec/services/EntryPoint.ts +259 -0
- package/test/unit/spec/services/Queue.ts +323 -0
- package/test/unit/spec/services/config/index.ts +279 -65
- package/test/unit/spec/services/core/Utils.ts +262 -31
- package/test/unit/spec/services/task/TaskManager.ts +752 -1
- package/test/unit/spec/services/task/TaskUtils.ts +131 -0
- package/test/unit/spec/services/task/contact.ts +31 -1
- package/test/unit/spec/services/task/index.ts +675 -69
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -229,7 +229,7 @@ describe('Utils', () => {
|
|
|
229
229
|
});
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
-
it('should return DUPLICATE_LOCATION message and fieldName for
|
|
232
|
+
it('should return DUPLICATE_LOCATION message and fieldName for dial number', () => {
|
|
233
233
|
const failure = {data: {reason: 'DUPLICATE_LOCATION'}} as Failure;
|
|
234
234
|
const result = Utils.getStationLoginErrorData(failure, LoginOption.AGENT_DN);
|
|
235
235
|
expect(result).toEqual({
|
|
@@ -277,53 +277,284 @@ describe('Utils', () => {
|
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
|
|
280
|
-
describe('
|
|
281
|
-
const currentAgentId = 'agent-
|
|
280
|
+
describe('getConsultedAgentId', () => {
|
|
281
|
+
const currentAgentId = 'agent-123';
|
|
282
282
|
|
|
283
|
-
it('
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
283
|
+
it('should return consulted agent ID from consult media', () => {
|
|
284
|
+
const media: any = {
|
|
285
|
+
mainCall: {
|
|
286
|
+
mType: 'mainCall',
|
|
287
|
+
participants: [currentAgentId, 'customer-1'],
|
|
288
|
+
},
|
|
289
|
+
consultCall: {
|
|
290
|
+
mType: 'consult',
|
|
291
|
+
participants: [currentAgentId, 'agent-456'],
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const result = Utils.getConsultedAgentId(media, currentAgentId);
|
|
296
|
+
expect(result).toBe('agent-456');
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it('should return empty string when no consult media exists', () => {
|
|
300
|
+
const media: any = {
|
|
301
|
+
mainCall: {
|
|
302
|
+
mType: 'mainCall',
|
|
303
|
+
participants: [currentAgentId, 'customer-1'],
|
|
304
|
+
},
|
|
288
305
|
};
|
|
289
306
|
|
|
290
|
-
const result = Utils.
|
|
291
|
-
expect(result).toBe('
|
|
307
|
+
const result = Utils.getConsultedAgentId(media, currentAgentId);
|
|
308
|
+
expect(result).toBe('');
|
|
292
309
|
});
|
|
293
310
|
|
|
294
|
-
it('
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
311
|
+
it('should return empty string when current agent is not in consult participants', () => {
|
|
312
|
+
const media: any = {
|
|
313
|
+
consultCall: {
|
|
314
|
+
mType: 'consult',
|
|
315
|
+
participants: ['other-agent-1', 'other-agent-2'],
|
|
316
|
+
},
|
|
298
317
|
};
|
|
299
318
|
|
|
300
|
-
const result = Utils.
|
|
319
|
+
const result = Utils.getConsultedAgentId(media, currentAgentId);
|
|
320
|
+
expect(result).toBe('');
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it('should handle empty media object', () => {
|
|
324
|
+
const result = Utils.getConsultedAgentId({}, currentAgentId);
|
|
301
325
|
expect(result).toBe('');
|
|
302
326
|
});
|
|
303
327
|
|
|
304
|
-
it('
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
328
|
+
it('should handle multiple media entries and find consult', () => {
|
|
329
|
+
const media: any = {
|
|
330
|
+
media1: {mType: 'mainCall', participants: [currentAgentId]},
|
|
331
|
+
media2: {mType: 'hold', participants: []},
|
|
332
|
+
media3: {mType: 'consult', participants: [currentAgentId, 'consulted-agent']},
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const result = Utils.getConsultedAgentId(media, currentAgentId);
|
|
336
|
+
expect(result).toBe('consulted-agent');
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
describe('getDestAgentIdForCBT', () => {
|
|
341
|
+
it('should return destination agent ID for CBT scenario', () => {
|
|
342
|
+
const interaction: any = {
|
|
343
|
+
participants: {
|
|
344
|
+
'agent-uuid-123': {
|
|
345
|
+
type: 'Agent',
|
|
346
|
+
pType: 'dn',
|
|
347
|
+
dn: '5551234567',
|
|
348
|
+
id: 'agent-uuid-123',
|
|
349
|
+
},
|
|
350
|
+
'customer-1': {
|
|
351
|
+
type: 'Customer',
|
|
352
|
+
pType: 'Customer',
|
|
353
|
+
id: 'customer-1',
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
const consultingAgent = '5551234567'; // Phone number, not in participants as key
|
|
358
|
+
|
|
359
|
+
const result = Utils.getDestAgentIdForCBT(interaction, consultingAgent);
|
|
360
|
+
expect(result).toBe('agent-uuid-123');
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it('should return empty string when consultingAgent is in participants (non-CBT)', () => {
|
|
364
|
+
const interaction: any = {
|
|
365
|
+
participants: {
|
|
366
|
+
'agent-123': {
|
|
367
|
+
type: 'Agent',
|
|
368
|
+
pType: 'Agent',
|
|
369
|
+
id: 'agent-123',
|
|
370
|
+
},
|
|
371
|
+
},
|
|
308
372
|
};
|
|
309
|
-
|
|
373
|
+
const consultingAgent = 'agent-123'; // Exists as key in participants
|
|
374
|
+
|
|
375
|
+
const result = Utils.getDestAgentIdForCBT(interaction, consultingAgent);
|
|
376
|
+
expect(result).toBe('');
|
|
377
|
+
});
|
|
310
378
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
379
|
+
it('should return empty string when no matching dial number found', () => {
|
|
380
|
+
const interaction: any = {
|
|
381
|
+
participants: {
|
|
382
|
+
'agent-uuid-123': {
|
|
383
|
+
type: 'Agent',
|
|
384
|
+
pType: 'dn',
|
|
385
|
+
dn: '5559999999',
|
|
386
|
+
id: 'agent-uuid-123',
|
|
387
|
+
},
|
|
388
|
+
},
|
|
314
389
|
};
|
|
315
|
-
|
|
390
|
+
const consultingAgent = '5551234567'; // Different number
|
|
391
|
+
|
|
392
|
+
const result = Utils.getDestAgentIdForCBT(interaction, consultingAgent);
|
|
393
|
+
expect(result).toBe('');
|
|
394
|
+
});
|
|
316
395
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
396
|
+
it('should return empty string when consultingAgent is empty', () => {
|
|
397
|
+
const interaction: any = {
|
|
398
|
+
participants: {
|
|
399
|
+
'agent-uuid-123': {
|
|
400
|
+
type: 'Agent',
|
|
401
|
+
pType: 'dn',
|
|
402
|
+
dn: '5551234567',
|
|
403
|
+
},
|
|
404
|
+
},
|
|
320
405
|
};
|
|
321
|
-
|
|
406
|
+
|
|
407
|
+
const result = Utils.getDestAgentIdForCBT(interaction, '');
|
|
408
|
+
expect(result).toBe('');
|
|
322
409
|
});
|
|
323
410
|
|
|
324
|
-
it('
|
|
325
|
-
|
|
326
|
-
|
|
411
|
+
it('should match only when participant type is dial number and type is Agent', () => {
|
|
412
|
+
const interaction: any = {
|
|
413
|
+
participants: {
|
|
414
|
+
'participant-1': {
|
|
415
|
+
type: 'Customer',
|
|
416
|
+
pType: 'dn',
|
|
417
|
+
dn: '5551234567',
|
|
418
|
+
},
|
|
419
|
+
'participant-2': {
|
|
420
|
+
type: 'Agent',
|
|
421
|
+
pType: 'Agent',
|
|
422
|
+
dn: '5551234567',
|
|
423
|
+
},
|
|
424
|
+
'participant-3': {
|
|
425
|
+
type: 'Agent',
|
|
426
|
+
pType: 'dn',
|
|
427
|
+
dn: '5551234567',
|
|
428
|
+
id: 'correct-agent',
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const result = Utils.getDestAgentIdForCBT(interaction, '5551234567');
|
|
434
|
+
expect(result).toBe('participant-3');
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
it('should handle case-insensitive participant type comparison', () => {
|
|
438
|
+
const interaction: any = {
|
|
439
|
+
participants: {
|
|
440
|
+
'agent-uuid': {
|
|
441
|
+
type: 'Agent',
|
|
442
|
+
pType: 'DN', // Uppercase (dial number)
|
|
443
|
+
dn: '5551234567',
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const result = Utils.getDestAgentIdForCBT(interaction, '5551234567');
|
|
449
|
+
expect(result).toBe('agent-uuid');
|
|
327
450
|
});
|
|
328
451
|
});
|
|
452
|
+
|
|
453
|
+
describe('calculateDestAgentId', () => {
|
|
454
|
+
const currentAgentId = 'agent-123';
|
|
455
|
+
|
|
456
|
+
it('should return destAgentIdCBT when found', () => {
|
|
457
|
+
const interaction: any = {
|
|
458
|
+
media: {
|
|
459
|
+
consult: {
|
|
460
|
+
mType: 'consult',
|
|
461
|
+
participants: [currentAgentId, '5551234567'],
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
participants: {
|
|
465
|
+
'agent-uuid-456': {
|
|
466
|
+
type: 'Agent',
|
|
467
|
+
pType: 'dn',
|
|
468
|
+
dn: '5551234567',
|
|
469
|
+
id: 'agent-uuid-456',
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
const result = Utils.calculateDestAgentId(interaction, currentAgentId);
|
|
475
|
+
expect(result).toBe('agent-uuid-456');
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('should return participant id for regular agent when not CBT', () => {
|
|
479
|
+
const consultedAgentId = 'agent-456';
|
|
480
|
+
const interaction: any = {
|
|
481
|
+
media: {
|
|
482
|
+
consult: {
|
|
483
|
+
mType: 'consult',
|
|
484
|
+
participants: [currentAgentId, consultedAgentId],
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
participants: {
|
|
488
|
+
[consultedAgentId]: {
|
|
489
|
+
type: 'Agent',
|
|
490
|
+
id: consultedAgentId,
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
const result = Utils.calculateDestAgentId(interaction, currentAgentId);
|
|
496
|
+
expect(result).toBe(consultedAgentId);
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
it('should return epId for EpDn type participants', () => {
|
|
500
|
+
const consultedAgentId = 'epdn-456';
|
|
501
|
+
const interaction: any = {
|
|
502
|
+
media: {
|
|
503
|
+
consult: {
|
|
504
|
+
mType: 'consult',
|
|
505
|
+
participants: [currentAgentId, consultedAgentId],
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
participants: {
|
|
509
|
+
[consultedAgentId]: {
|
|
510
|
+
type: 'EpDn',
|
|
511
|
+
id: consultedAgentId,
|
|
512
|
+
epId: 'entry-point-id-789',
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
const result = Utils.calculateDestAgentId(interaction, currentAgentId);
|
|
518
|
+
expect(result).toBe('entry-point-id-789');
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
it('should return undefined when no consulting agent found', () => {
|
|
522
|
+
const interaction: any = {
|
|
523
|
+
media: {
|
|
524
|
+
mainCall: {
|
|
525
|
+
mType: 'mainCall',
|
|
526
|
+
participants: [currentAgentId],
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
participants: {},
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
const result = Utils.calculateDestAgentId(interaction, currentAgentId);
|
|
533
|
+
expect(result).toBeUndefined();
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it('should handle CBT scenario when phone number is not a direct participant key', () => {
|
|
537
|
+
const interaction: any = {
|
|
538
|
+
media: {
|
|
539
|
+
consult: {
|
|
540
|
+
mType: 'consult',
|
|
541
|
+
participants: [currentAgentId, '5551234567'], // Phone number in media
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
participants: {
|
|
545
|
+
// Note: '5551234567' is NOT a key - this is CBT
|
|
546
|
+
'agent-uuid-cbt': {
|
|
547
|
+
type: 'Agent',
|
|
548
|
+
pType: 'dn',
|
|
549
|
+
dn: '5551234567', // Found by matching DN
|
|
550
|
+
id: 'agent-uuid-cbt',
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
const result = Utils.calculateDestAgentId(interaction, currentAgentId);
|
|
556
|
+
expect(result).toBe('agent-uuid-cbt'); // Returns the CBT agent
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
|
|
329
560
|
});
|