@webex/contact-center 3.11.0 → 3.12.0
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 +91 -27
- 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 +19 -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 +13 -1
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/task/TaskManager.js +96 -25
- 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 +14 -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 +800 -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 +103 -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 +34 -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 +52 -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 +83 -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 +120 -29
- 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 +21 -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 +12 -0
- package/src/services/task/TaskManager.ts +149 -28
- package/src/services/task/TaskUtils.ts +12 -0
- package/src/services/task/constants.ts +15 -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 +92 -22
- 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 +71 -1
- package/test/unit/spec/services/task/TaskManager.ts +1015 -165
- 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
package/dist/cc.js
CHANGED
|
@@ -22,9 +22,10 @@ var _WebCallingService = _interopRequireDefault(require("./services/WebCallingSe
|
|
|
22
22
|
var _types4 = require("./services/task/types");
|
|
23
23
|
var _MetricsManager = _interopRequireDefault(require("./metrics/MetricsManager"));
|
|
24
24
|
var _constants4 = require("./metrics/constants");
|
|
25
|
-
var _EntryPoint =
|
|
26
|
-
var _AddressBook =
|
|
27
|
-
var _Queue =
|
|
25
|
+
var _EntryPoint = require("./services/EntryPoint");
|
|
26
|
+
var _AddressBook = require("./services/AddressBook");
|
|
27
|
+
var _Queue = require("./services/Queue");
|
|
28
|
+
var _ApiAiAssistant = require("./services/ApiAiAssistant");
|
|
28
29
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
30
|
/**
|
|
30
31
|
* @module CCPlugin
|
|
@@ -84,6 +85,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
84
85
|
* - `task:established` - Task/call has been connected
|
|
85
86
|
* - `task:ended` - Task/call has ended
|
|
86
87
|
* - `task:error` - An error occurred during task handling
|
|
88
|
+
* - `task:campaignPreviewReservation` - Campaign preview contact offered to agent
|
|
87
89
|
*
|
|
88
90
|
* @public
|
|
89
91
|
*
|
|
@@ -272,6 +274,12 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
272
274
|
* ```
|
|
273
275
|
*/
|
|
274
276
|
|
|
277
|
+
/**
|
|
278
|
+
* API instance for AI Assistant operations such as transcript controls.
|
|
279
|
+
* @type {ApiAIAssistant}
|
|
280
|
+
* @public
|
|
281
|
+
*/
|
|
282
|
+
|
|
275
283
|
/**
|
|
276
284
|
* Logger utility for Contact Center plugin
|
|
277
285
|
* Provides consistent logging across the plugin
|
|
@@ -306,19 +314,18 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
306
314
|
});
|
|
307
315
|
this.services.webSocketManager.on('message', this.handleWebsocketMessage);
|
|
308
316
|
this.webCallingService = new _WebCallingService.default(this.$webex);
|
|
317
|
+
this.apiAIAssistant = new _ApiAiAssistant.ApiAIAssistant(this.$webex);
|
|
309
318
|
this.metricsManager = _MetricsManager.default.getInstance({
|
|
310
319
|
webex: this.$webex
|
|
311
320
|
});
|
|
312
|
-
this.taskManager = _TaskManager.default.getTaskManager(this.services.contact, this.webCallingService, this.services.webSocketManager);
|
|
321
|
+
this.taskManager = _TaskManager.default.getTaskManager(this.apiAIAssistant, this.services.contact, this.webCallingService, this.services.webSocketManager);
|
|
313
322
|
this.incomingTaskListener();
|
|
314
323
|
|
|
315
324
|
// Initialize API instances
|
|
316
325
|
// will have future function for indivdual fetch etc so better be in an object
|
|
317
|
-
this.entryPoint = new _EntryPoint.
|
|
318
|
-
this.addressBook = new _AddressBook.
|
|
319
|
-
this.queue = new _Queue.
|
|
320
|
-
|
|
321
|
-
// Initialize logger
|
|
326
|
+
this.entryPoint = new _EntryPoint.EntryPoint(this.$webex);
|
|
327
|
+
this.addressBook = new _AddressBook.AddressBook(this.$webex, () => this.agentConfig?.addressBookId);
|
|
328
|
+
this.queue = new _Queue.Queue(this.$webex);
|
|
322
329
|
_loggerProxy.default.initialize(this.$webex.logger);
|
|
323
330
|
});
|
|
324
331
|
}
|
|
@@ -353,6 +360,16 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
353
360
|
this.trigger(_types4.TASK_EVENTS.TASK_MERGED, task);
|
|
354
361
|
};
|
|
355
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Handles campaign preview reservation events when a contact is offered to the agent
|
|
365
|
+
* @private
|
|
366
|
+
* @param {ITask} task The campaign reservation task
|
|
367
|
+
*/
|
|
368
|
+
handleCampaignPreviewReservation = task => {
|
|
369
|
+
// @ts-ignore
|
|
370
|
+
this.trigger(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, task);
|
|
371
|
+
};
|
|
372
|
+
|
|
356
373
|
/**
|
|
357
374
|
* Sets up event listeners for incoming tasks and task hydration
|
|
358
375
|
* Subscribes to task events from the task manager
|
|
@@ -362,6 +379,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
362
379
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
|
|
363
380
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
|
|
364
381
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_MERGED, this.handleTaskMerged);
|
|
382
|
+
this.taskManager.on(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, this.handleCampaignPreviewReservation);
|
|
365
383
|
}
|
|
366
384
|
|
|
367
385
|
/**
|
|
@@ -470,6 +488,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
470
488
|
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.WEBSOCKET_DEREGISTER_SUCCESS, _constants4.METRIC_EVENT_NAMES.WEBSOCKET_DEREGISTER_FAIL]);
|
|
471
489
|
this.taskManager.off(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
|
|
472
490
|
this.taskManager.off(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
|
|
491
|
+
this.taskManager.off(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, this.handleCampaignPreviewReservation);
|
|
473
492
|
this.taskManager.unregisterIncomingCallEvent();
|
|
474
493
|
this.services.webSocketManager.off('message', this.handleWebsocketMessage);
|
|
475
494
|
this.services.connectionService.off('connectionLost', this.handleConnectionLost);
|
|
@@ -610,6 +629,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
610
629
|
this.taskManager.setWrapupData(this.agentConfig.wrapUpData);
|
|
611
630
|
this.taskManager.setAgentId(this.agentConfig.agentId);
|
|
612
631
|
this.taskManager.setWebRtcEnabled(this.agentConfig.webRtcEnabled);
|
|
632
|
+
this.apiAIAssistant.setAIFeatureFlags(this.agentConfig.aiFeature);
|
|
613
633
|
if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER)) {
|
|
614
634
|
try {
|
|
615
635
|
await this.$webex.internal.mercury.connect();
|
|
@@ -672,7 +692,8 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
672
692
|
});
|
|
673
693
|
try {
|
|
674
694
|
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.STATION_LOGIN_SUCCESS, _constants4.METRIC_EVENT_NAMES.STATION_LOGIN_FAILED]);
|
|
675
|
-
|
|
695
|
+
const dialPlanEntries = this.agentConfig?.dialPlan?.dialPlanEntity ?? [];
|
|
696
|
+
if (data.loginOption === _types.LoginOption.AGENT_DN && !(0, _Utils.isValidDialNumber)(data.dialNumber, dialPlanEntries)) {
|
|
676
697
|
const error = new Error('INVALID_DIAL_NUMBER');
|
|
677
698
|
// @ts-ignore - adding custom key to the error object
|
|
678
699
|
error.details = {
|
|
@@ -1336,6 +1357,64 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1336
1357
|
}
|
|
1337
1358
|
}
|
|
1338
1359
|
|
|
1360
|
+
/**
|
|
1361
|
+
* Accepts a campaign preview contact, initiating the outbound call.
|
|
1362
|
+
*
|
|
1363
|
+
* When a campaign manager reserves a contact for an agent, the agent receives an
|
|
1364
|
+
* `AgentOfferCampaignReservation` event. The agent can then accept the preview contact
|
|
1365
|
+
* to initiate the outbound call.
|
|
1366
|
+
*
|
|
1367
|
+
* @param {PreviewContactPayload} payload - The preview contact payload containing interactionId and campaignId (campaign name, not UUID).
|
|
1368
|
+
* @returns {Promise<TaskResponse>} Promise resolving with agent contact on success.
|
|
1369
|
+
* @throws {Error} If the operation fails (network error, customer unavailable, etc.)
|
|
1370
|
+
*
|
|
1371
|
+
* @example
|
|
1372
|
+
* ```typescript
|
|
1373
|
+
* webex.cc.on('task:campaignPreviewReservation', async (task) => {
|
|
1374
|
+
* const { interactionId } = task.data;
|
|
1375
|
+
* // campaignId is the campaign name (e.g. "MyCampaign"), not a UUID
|
|
1376
|
+
* const campaignId = task.data.interaction.callProcessingDetails.campaignId;
|
|
1377
|
+
*
|
|
1378
|
+
* const result = await webex.cc.acceptPreviewContact({ interactionId, campaignId });
|
|
1379
|
+
* });
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
async acceptPreviewContact(payload) {
|
|
1383
|
+
_loggerProxy.default.info('Accepting campaign preview contact', {
|
|
1384
|
+
module: _constants.CC_FILE,
|
|
1385
|
+
method: _constants.METHODS.ACCEPT_PREVIEW_CONTACT
|
|
1386
|
+
});
|
|
1387
|
+
try {
|
|
1388
|
+
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_ACCEPT_SUCCESS, _constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_ACCEPT_FAILED]);
|
|
1389
|
+
const result = await this.services.dialer.acceptPreviewContact({
|
|
1390
|
+
data: payload
|
|
1391
|
+
});
|
|
1392
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_ACCEPT_SUCCESS, {
|
|
1393
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(result),
|
|
1394
|
+
interactionId: payload.interactionId,
|
|
1395
|
+
campaignId: payload.campaignId
|
|
1396
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1397
|
+
_loggerProxy.default.log('Campaign preview contact accepted successfully', {
|
|
1398
|
+
module: _constants.CC_FILE,
|
|
1399
|
+
method: _constants.METHODS.ACCEPT_PREVIEW_CONTACT,
|
|
1400
|
+
trackingId: result.trackingId,
|
|
1401
|
+
interactionId: payload.interactionId
|
|
1402
|
+
});
|
|
1403
|
+
return result;
|
|
1404
|
+
} catch (error) {
|
|
1405
|
+
const failure = error.details;
|
|
1406
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_ACCEPT_FAILED, {
|
|
1407
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1408
|
+
interactionId: payload.interactionId,
|
|
1409
|
+
campaignId: payload.campaignId
|
|
1410
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1411
|
+
const {
|
|
1412
|
+
error: detailedError
|
|
1413
|
+
} = (0, _Utils.getErrorDetails)(error, _constants.METHODS.ACCEPT_PREVIEW_CONTACT, _constants.CC_FILE);
|
|
1414
|
+
throw detailedError;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1339
1418
|
/**
|
|
1340
1419
|
* Fetches outdial ANI (Automatic Number Identification) entries for an outdial ANI ID.
|
|
1341
1420
|
*
|
|
@@ -1467,6 +1546,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1467
1546
|
/**
|
|
1468
1547
|
* Updates the agent device type and login configuration.
|
|
1469
1548
|
* Use this method to change how an agent connects to the contact center system (e.g., switching from browser-based calling to a desk phone extension).
|
|
1549
|
+
* Change to any field of the profile is allowed;
|
|
1470
1550
|
*
|
|
1471
1551
|
* @param {AgentDeviceUpdate} data Configuration containing:
|
|
1472
1552
|
* - loginOption: New device type ('BROWSER', 'EXTENSION', 'AGENT_DN')
|
|
@@ -1500,24 +1580,8 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1500
1580
|
trackingId
|
|
1501
1581
|
});
|
|
1502
1582
|
try {
|
|
1503
|
-
// Only block if both loginOption AND teamId remain unchanged
|
|
1504
|
-
if (this.webCallingService?.loginOption === data.loginOption && data.teamId === this.agentConfig.currentTeamId) {
|
|
1505
|
-
const message = 'Will not proceed with device update as new Device type is same as current device type and teamId is same as current teamId';
|
|
1506
|
-
const err = new Error(message);
|
|
1507
|
-
err.details = {
|
|
1508
|
-
type: 'Identical Device Change Failure',
|
|
1509
|
-
orgId: this.$webex.credentials.getOrgId(),
|
|
1510
|
-
trackingId,
|
|
1511
|
-
data: {
|
|
1512
|
-
agentId: this.agentConfig.agentId,
|
|
1513
|
-
reasonCode: 'R002',
|
|
1514
|
-
reason: message
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1517
|
-
throw err;
|
|
1518
|
-
}
|
|
1519
1583
|
await this.stationLogout({
|
|
1520
|
-
logoutReason: 'User requested agent
|
|
1584
|
+
logoutReason: 'User requested agent profile update'
|
|
1521
1585
|
});
|
|
1522
1586
|
const loginPayload = {
|
|
1523
1587
|
teamId: data.teamId,
|