@webex/contact-center 3.12.0-next.7 → 3.12.0-next.70
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 +212 -23
- package/dist/cc.js.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/metrics/behavioral-events.js +26 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +4 -0
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/config/Util.js +1 -1
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +1 -1
- 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/Utils.js +37 -9
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/task/TaskManager.js +94 -8
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/constants.js +3 -1
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +78 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/index.js +7 -2
- package/dist/services/task/index.js.map +1 -1
- package/dist/services/task/types.js +56 -0
- package/dist/services/task/types.js.map +1 -1
- package/dist/types/cc.d.ts +61 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/metrics/constants.d.ts +4 -0
- package/dist/types/services/config/types.d.ts +10 -1
- package/dist/types/services/core/Err.d.ts +4 -0
- package/dist/types/services/core/Utils.d.ts +10 -3
- package/dist/types/services/task/constants.d.ts +2 -0
- package/dist/types/services/task/dialer.d.ts +30 -0
- package/dist/types/services/task/types.d.ts +65 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/webex.js +1 -1
- package/package.json +9 -9
- package/src/cc.ts +270 -24
- package/src/constants.ts +2 -0
- package/src/metrics/behavioral-events.ts +28 -0
- package/src/metrics/constants.ts +4 -0
- package/src/services/config/Util.ts +1 -1
- package/src/services/config/constants.ts +1 -1
- package/src/services/config/types.ts +6 -1
- package/src/services/core/Err.ts +2 -0
- package/src/services/core/Utils.ts +43 -8
- package/src/services/task/TaskManager.ts +106 -22
- package/src/services/task/constants.ts +2 -0
- package/src/services/task/dialer.ts +80 -0
- package/src/services/task/index.ts +7 -2
- package/src/services/task/types.ts +70 -0
- package/src/types.ts +2 -0
- package/test/unit/spec/cc.ts +210 -20
- package/test/unit/spec/services/config/index.ts +3 -3
- package/test/unit/spec/services/core/Utils.ts +90 -7
- package/test/unit/spec/services/task/TaskManager.ts +252 -7
- package/test/unit/spec/services/task/dialer.ts +190 -0
- package/test/unit/spec/services/task/index.ts +21 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
package/dist/cc.js
CHANGED
|
@@ -301,6 +301,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
301
301
|
this.$webex.once(_constants.READY, () => {
|
|
302
302
|
// @ts-ignore
|
|
303
303
|
this.$config = this.config;
|
|
304
|
+
this.validatePluginConfig();
|
|
304
305
|
|
|
305
306
|
/**
|
|
306
307
|
* This is used for handling the async requests by sending webex.request and wait for corresponding websocket event.
|
|
@@ -312,7 +313,6 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
312
313
|
webex: this.$webex,
|
|
313
314
|
connectionConfig: this.getConnectionConfig()
|
|
314
315
|
});
|
|
315
|
-
this.services.webSocketManager.on('message', this.handleWebsocketMessage);
|
|
316
316
|
this.webCallingService = new _WebCallingService.default(this.$webex);
|
|
317
317
|
this.apiAIAssistant = new _ApiAiAssistant.ApiAIAssistant(this.$webex);
|
|
318
318
|
this.metricsManager = _MetricsManager.default.getInstance({
|
|
@@ -369,6 +369,16 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
369
369
|
// @ts-ignore
|
|
370
370
|
this.trigger(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, task);
|
|
371
371
|
};
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Handles multi-login hydrate events emitted when browser login accepts an incoming call.
|
|
375
|
+
* @private
|
|
376
|
+
* @param {ITask} task The task object associated with multi-login hydrate
|
|
377
|
+
*/
|
|
378
|
+
handleTaskMultiLoginHydrate = task => {
|
|
379
|
+
// @ts-ignore
|
|
380
|
+
this.trigger(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, task);
|
|
381
|
+
};
|
|
372
382
|
handleRTDWebsocketMessage = payload => {
|
|
373
383
|
this.taskManager.handleRealtimeWebsocketEvent(payload);
|
|
374
384
|
};
|
|
@@ -382,6 +392,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
382
392
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
|
|
383
393
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
|
|
384
394
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_MERGED, this.handleTaskMerged);
|
|
395
|
+
this.taskManager.on(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, this.handleTaskMultiLoginHydrate);
|
|
385
396
|
this.taskManager.on(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, this.handleCampaignPreviewReservation);
|
|
386
397
|
}
|
|
387
398
|
|
|
@@ -422,13 +433,14 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
422
433
|
* ```
|
|
423
434
|
*/
|
|
424
435
|
async register() {
|
|
425
|
-
_loggerProxy.default.
|
|
436
|
+
_loggerProxy.default.log('Starting CC SDK registration', {
|
|
426
437
|
module: _constants.CC_FILE,
|
|
427
438
|
method: _constants.METHODS.REGISTER
|
|
428
439
|
});
|
|
429
440
|
try {
|
|
430
441
|
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_SUCCESS, _constants4.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_FAILED]);
|
|
431
442
|
this.setupEventListeners();
|
|
443
|
+
this.services.webSocketManager.on('message', this.handleWebsocketMessage);
|
|
432
444
|
const resp = await this.connectWebsocket();
|
|
433
445
|
// Ensure 'dn' is always populated from 'defaultDn'
|
|
434
446
|
resp.dn = resp.defaultDn;
|
|
@@ -491,6 +503,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
491
503
|
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.WEBSOCKET_DEREGISTER_SUCCESS, _constants4.METRIC_EVENT_NAMES.WEBSOCKET_DEREGISTER_FAIL]);
|
|
492
504
|
this.taskManager.off(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
|
|
493
505
|
this.taskManager.off(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
|
|
506
|
+
this.taskManager.off(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, this.handleTaskMultiLoginHydrate);
|
|
494
507
|
this.taskManager.off(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, this.handleCampaignPreviewReservation);
|
|
495
508
|
this.taskManager.unregisterIncomingCallEvent();
|
|
496
509
|
this.services.webSocketManager.off('message', this.handleWebsocketMessage);
|
|
@@ -609,6 +622,25 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
609
622
|
}
|
|
610
623
|
}
|
|
611
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Checks whether WebRTC registration should be skipped by config.
|
|
627
|
+
* @returns {boolean}
|
|
628
|
+
* @private
|
|
629
|
+
*/
|
|
630
|
+
isWebRTCRegistrationDisabled() {
|
|
631
|
+
return this.$config?.disableWebRTCRegistration === true;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Validates contact-center plugin configuration before service initialization
|
|
636
|
+
* @private
|
|
637
|
+
*/
|
|
638
|
+
validatePluginConfig() {
|
|
639
|
+
if (this.$config?.disableWebRTCRegistration === true && this.$config?.allowMultiLogin === false) {
|
|
640
|
+
throw new Error('Invalid Contact Center configuration: disableWebRTCRegistration cannot be true when allowMultiLogin is false. Enable allowMultiLogin or allow WebRTC registration so an SDK instance can receive Mobius/WebRTC task events.');
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
612
644
|
/**
|
|
613
645
|
* Connects to the websocket and fetches the agent profile
|
|
614
646
|
* @returns {Promise<Profile>} Agent profile information
|
|
@@ -616,7 +648,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
616
648
|
* @private
|
|
617
649
|
*/
|
|
618
650
|
async connectWebsocket() {
|
|
619
|
-
_loggerProxy.default.
|
|
651
|
+
_loggerProxy.default.log('Connecting to websocket', {
|
|
620
652
|
module: _constants.CC_FILE,
|
|
621
653
|
method: _constants.METHODS.CONNECT_WEBSOCKET
|
|
622
654
|
});
|
|
@@ -639,7 +671,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
639
671
|
this.taskManager.setWebRtcEnabled(this.agentConfig.webRtcEnabled);
|
|
640
672
|
this.apiAIAssistant.setAIFeatureFlags(this.agentConfig.aiFeature);
|
|
641
673
|
if (this.agentConfig.aiFeature?.realtimeTranscripts?.enable) {
|
|
642
|
-
_loggerProxy.default.
|
|
674
|
+
_loggerProxy.default.log('Connecting to RTD websocket', {
|
|
643
675
|
module: _constants.CC_FILE,
|
|
644
676
|
method: _constants.METHODS.CONNECT_WEBSOCKET
|
|
645
677
|
});
|
|
@@ -659,7 +691,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
659
691
|
});
|
|
660
692
|
});
|
|
661
693
|
}
|
|
662
|
-
if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER)) {
|
|
694
|
+
if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER) && !this.isWebRTCRegistrationDisabled()) {
|
|
663
695
|
try {
|
|
664
696
|
await this.$webex.internal.mercury.connect();
|
|
665
697
|
_loggerProxy.default.log('Authentication: webex.internal.mercury.connect successful', {
|
|
@@ -672,9 +704,19 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
672
704
|
method: _constants.METHODS.CONNECT_WEBSOCKET
|
|
673
705
|
});
|
|
674
706
|
}
|
|
707
|
+
} else if (this.isWebRTCRegistrationDisabled()) {
|
|
708
|
+
_loggerProxy.default.info('Skipping Mobius registration because disableWebRTCRegistration is enabled', {
|
|
709
|
+
module: _constants.CC_FILE,
|
|
710
|
+
method: _constants.METHODS.CONNECT_WEBSOCKET
|
|
711
|
+
});
|
|
675
712
|
}
|
|
676
713
|
if (this.$config && this.$config.allowAutomatedRelogin) {
|
|
677
714
|
await this.silentRelogin();
|
|
715
|
+
} else {
|
|
716
|
+
_loggerProxy.default.log('Skipping silent relogin: allowAutomatedRelogin is disabled', {
|
|
717
|
+
module: _constants.CC_FILE,
|
|
718
|
+
method: _constants.METHODS.CONNECT_WEBSOCKET
|
|
719
|
+
});
|
|
678
720
|
}
|
|
679
721
|
return this.agentConfig;
|
|
680
722
|
} catch (error) {
|
|
@@ -715,22 +757,27 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
715
757
|
* ```
|
|
716
758
|
*/
|
|
717
759
|
async stationLogin(data) {
|
|
718
|
-
|
|
760
|
+
const loggerContext = {
|
|
719
761
|
module: _constants.CC_FILE,
|
|
720
762
|
method: _constants.METHODS.STATION_LOGIN
|
|
721
|
-
}
|
|
763
|
+
};
|
|
722
764
|
try {
|
|
765
|
+
_loggerProxy.default.log(`Starting agent station login | loginOption: ${data?.loginOption} teamId: ${data?.teamId}`, loggerContext);
|
|
723
766
|
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.STATION_LOGIN_SUCCESS, _constants4.METRIC_EVENT_NAMES.STATION_LOGIN_FAILED]);
|
|
724
767
|
const dialPlanEntries = this.agentConfig?.dialPlan?.dialPlanEntity ?? [];
|
|
725
|
-
if (data.loginOption === _types.LoginOption.AGENT_DN
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
768
|
+
if (data.loginOption === _types.LoginOption.AGENT_DN) {
|
|
769
|
+
_loggerProxy.default.log(`Validating dial number | dialPlanEnabled: ${!!this.agentConfig?.dialPlan} | dialPlanEntryCount: ${dialPlanEntries.length}`, loggerContext);
|
|
770
|
+
if (!(0, _Utils.isValidDialNumber)(data.dialNumber, dialPlanEntries)) {
|
|
771
|
+
_loggerProxy.default.log(`Dial number validation failed | dialNumber: ${data.dialNumber} | dialPlanEntryCount: ${dialPlanEntries.length}`, loggerContext);
|
|
772
|
+
const error = new Error('INVALID_DIAL_NUMBER');
|
|
773
|
+
// @ts-ignore - adding custom key to the error object
|
|
774
|
+
error.details = {
|
|
775
|
+
data: {
|
|
776
|
+
reason: 'INVALID_DIAL_NUMBER'
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
throw error;
|
|
780
|
+
}
|
|
734
781
|
}
|
|
735
782
|
const loginResponse = await this.services.agent.stationLogin({
|
|
736
783
|
data: {
|
|
@@ -746,8 +793,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
746
793
|
auxCodeId: _constants.EMPTY_STRING
|
|
747
794
|
}
|
|
748
795
|
});
|
|
749
|
-
if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER) {
|
|
796
|
+
if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER && !this.isWebRTCRegistrationDisabled()) {
|
|
750
797
|
await this.webCallingService.registerWebCallingLine();
|
|
798
|
+
} else if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER && this.isWebRTCRegistrationDisabled()) {
|
|
799
|
+
_loggerProxy.default.info('Skipping web calling line registration because disableWebRTCRegistration is enabled', {
|
|
800
|
+
module: _constants.CC_FILE,
|
|
801
|
+
method: _constants.METHODS.STATION_LOGIN
|
|
802
|
+
});
|
|
751
803
|
}
|
|
752
804
|
const resp = await loginResponse;
|
|
753
805
|
const {
|
|
@@ -1102,13 +1154,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1102
1154
|
async handleConnectionLost(msg) {
|
|
1103
1155
|
if (msg.isConnectionLost) {
|
|
1104
1156
|
// TODO: Emit an event saying connection is lost
|
|
1105
|
-
_loggerProxy.default.
|
|
1157
|
+
_loggerProxy.default.log('event=handleConnectionLost | Connection lost', {
|
|
1106
1158
|
module: _constants.CC_FILE,
|
|
1107
1159
|
method: _constants.METHODS.HANDLE_CONNECTION_LOST
|
|
1108
1160
|
});
|
|
1109
1161
|
} else if (msg.isSocketReconnected) {
|
|
1110
1162
|
// TODO: Emit an event saying connection is re-estabilished
|
|
1111
|
-
_loggerProxy.default.
|
|
1163
|
+
_loggerProxy.default.log('event=handleConnectionReconnect | Connection reconnected attempting to request silent relogin', {
|
|
1112
1164
|
module: _constants.CC_FILE,
|
|
1113
1165
|
method: _constants.METHODS.HANDLE_CONNECTION_LOST
|
|
1114
1166
|
});
|
|
@@ -1123,7 +1175,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1123
1175
|
* @private
|
|
1124
1176
|
*/
|
|
1125
1177
|
async silentRelogin() {
|
|
1126
|
-
_loggerProxy.default.
|
|
1178
|
+
_loggerProxy.default.log('Starting silent relogin process', {
|
|
1127
1179
|
module: _constants.CC_FILE,
|
|
1128
1180
|
method: _constants.METHODS.SILENT_RELOGIN
|
|
1129
1181
|
});
|
|
@@ -1145,7 +1197,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1145
1197
|
this.agentConfig.currentTeamId = reLoginResponse.data.teamId;
|
|
1146
1198
|
await this.handleDeviceType(deviceType, dn);
|
|
1147
1199
|
if (lastStateChangeReason === 'agent-wss-disconnect') {
|
|
1148
|
-
_loggerProxy.default.
|
|
1200
|
+
_loggerProxy.default.log('event=requestAutoStateChange | Requesting state change to available on socket reconnect', {
|
|
1149
1201
|
module: _constants.CC_FILE,
|
|
1150
1202
|
method: _constants.METHODS.SILENT_RELOGIN
|
|
1151
1203
|
});
|
|
@@ -1169,8 +1221,6 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1169
1221
|
}
|
|
1170
1222
|
this.agentConfig.lastStateAuxCodeId = auxCodeId;
|
|
1171
1223
|
this.agentConfig.isAgentLoggedIn = true;
|
|
1172
|
-
// TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there
|
|
1173
|
-
this.services.webSocketManager.on('message', this.handleWebsocketMessage);
|
|
1174
1224
|
_loggerProxy.default.log(`Silent relogin process completed successfully with login Option: ${reLoginResponse.data.deviceType} teamId: ${reLoginResponse.data.teamId}`, {
|
|
1175
1225
|
module: _constants.CC_FILE,
|
|
1176
1226
|
method: _constants.METHODS.SILENT_RELOGIN,
|
|
@@ -1205,6 +1255,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1205
1255
|
this.agentConfig.deviceType = deviceType;
|
|
1206
1256
|
switch (deviceType) {
|
|
1207
1257
|
case _types.LoginOption.BROWSER:
|
|
1258
|
+
if (this.isWebRTCRegistrationDisabled()) {
|
|
1259
|
+
_loggerProxy.default.info('Skipping web calling line registration because disableWebRTCRegistration is enabled', {
|
|
1260
|
+
module: _constants.CC_FILE,
|
|
1261
|
+
method: _constants.METHODS.HANDLE_DEVICE_TYPE
|
|
1262
|
+
});
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1208
1265
|
try {
|
|
1209
1266
|
await this.webCallingService.registerWebCallingLine();
|
|
1210
1267
|
} catch (error) {
|
|
@@ -1444,6 +1501,138 @@ class ContactCenter extends _webexCore.WebexPlugin {
|
|
|
1444
1501
|
}
|
|
1445
1502
|
}
|
|
1446
1503
|
|
|
1504
|
+
/**
|
|
1505
|
+
* Skips a campaign preview contact, requesting the next contact from the campaign.
|
|
1506
|
+
*
|
|
1507
|
+
* When a campaign manager reserves a contact for an agent, the agent receives an
|
|
1508
|
+
* `AgentOfferCampaignReservation` event. Instead of accepting, the agent can skip the
|
|
1509
|
+
* preview contact to move to the next contact in the campaign.
|
|
1510
|
+
*
|
|
1511
|
+
* @param {PreviewContactPayload} payload - The preview contact payload containing interactionId and campaignId (campaign name, not UUID).
|
|
1512
|
+
* @returns {Promise<TaskResponse>} Promise resolving with agent contact on success.
|
|
1513
|
+
* @throws {Error} If the operation fails (network error, etc.)
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
* ```typescript
|
|
1517
|
+
* webex.cc.on('task:campaignPreviewReservation', async (task) => {
|
|
1518
|
+
* const { interactionId } = task.data;
|
|
1519
|
+
* const campaignId = task.data.interaction.callProcessingDetails.campaignId;
|
|
1520
|
+
*
|
|
1521
|
+
* const result = await webex.cc.skipPreviewContact({ interactionId, campaignId });
|
|
1522
|
+
* });
|
|
1523
|
+
* ```
|
|
1524
|
+
*/
|
|
1525
|
+
async skipPreviewContact(payload) {
|
|
1526
|
+
const task = this.taskManager.getTask(payload.interactionId);
|
|
1527
|
+
if (task?.data?.interaction?.callProcessingDetails?.campaignPreviewSkipDisabled === 'true') {
|
|
1528
|
+
_loggerProxy.default.warn('Skip action is disabled for this campaign preview contact', {
|
|
1529
|
+
module: _constants.CC_FILE,
|
|
1530
|
+
method: _constants.METHODS.SKIP_PREVIEW_CONTACT,
|
|
1531
|
+
interactionId: payload.interactionId
|
|
1532
|
+
});
|
|
1533
|
+
throw new Error('Skip action is disabled for this campaign preview contact');
|
|
1534
|
+
}
|
|
1535
|
+
_loggerProxy.default.info('Skipping campaign preview contact', {
|
|
1536
|
+
module: _constants.CC_FILE,
|
|
1537
|
+
method: _constants.METHODS.SKIP_PREVIEW_CONTACT
|
|
1538
|
+
});
|
|
1539
|
+
try {
|
|
1540
|
+
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_SKIP_SUCCESS, _constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_SKIP_FAILED]);
|
|
1541
|
+
const result = await this.services.dialer.skipPreviewContact({
|
|
1542
|
+
data: payload
|
|
1543
|
+
});
|
|
1544
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_SKIP_SUCCESS, {
|
|
1545
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(result),
|
|
1546
|
+
interactionId: payload.interactionId,
|
|
1547
|
+
campaignId: payload.campaignId
|
|
1548
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1549
|
+
_loggerProxy.default.log('Campaign preview contact skipped successfully', {
|
|
1550
|
+
module: _constants.CC_FILE,
|
|
1551
|
+
method: _constants.METHODS.SKIP_PREVIEW_CONTACT,
|
|
1552
|
+
trackingId: result.trackingId,
|
|
1553
|
+
interactionId: payload.interactionId
|
|
1554
|
+
});
|
|
1555
|
+
return result;
|
|
1556
|
+
} catch (error) {
|
|
1557
|
+
const failure = error.details;
|
|
1558
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_SKIP_FAILED, {
|
|
1559
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1560
|
+
interactionId: payload.interactionId,
|
|
1561
|
+
campaignId: payload.campaignId
|
|
1562
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1563
|
+
const {
|
|
1564
|
+
error: detailedError
|
|
1565
|
+
} = (0, _Utils.getErrorDetails)(error, _constants.METHODS.SKIP_PREVIEW_CONTACT, _constants.CC_FILE);
|
|
1566
|
+
throw detailedError;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* Removes a campaign preview contact from the campaign list entirely.
|
|
1572
|
+
*
|
|
1573
|
+
* When a campaign manager reserves a contact for an agent, the agent receives an
|
|
1574
|
+
* `AgentOfferCampaignReservation` event. Instead of accepting or skipping, the agent can
|
|
1575
|
+
* remove the preview contact to permanently take it out of the campaign contact list.
|
|
1576
|
+
*
|
|
1577
|
+
* @param {PreviewContactPayload} payload - The preview contact payload containing interactionId and campaignId (campaign name, not UUID).
|
|
1578
|
+
* @returns {Promise<TaskResponse>} Promise resolving with agent contact on success.
|
|
1579
|
+
* @throws {Error} If the operation fails (network error, etc.)
|
|
1580
|
+
*
|
|
1581
|
+
* @example
|
|
1582
|
+
* ```typescript
|
|
1583
|
+
* webex.cc.on('task:campaignPreviewReservation', async (task) => {
|
|
1584
|
+
* const { interactionId } = task.data;
|
|
1585
|
+
* const campaignId = task.data.interaction.callProcessingDetails.campaignId;
|
|
1586
|
+
*
|
|
1587
|
+
* const result = await webex.cc.removePreviewContact({ interactionId, campaignId });
|
|
1588
|
+
* });
|
|
1589
|
+
* ```
|
|
1590
|
+
*/
|
|
1591
|
+
async removePreviewContact(payload) {
|
|
1592
|
+
const task = this.taskManager.getTask(payload.interactionId);
|
|
1593
|
+
if (task?.data?.interaction?.callProcessingDetails?.campaignPreviewRemoveDisabled === 'true') {
|
|
1594
|
+
_loggerProxy.default.warn('Remove action is disabled for this campaign preview contact', {
|
|
1595
|
+
module: _constants.CC_FILE,
|
|
1596
|
+
method: _constants.METHODS.REMOVE_PREVIEW_CONTACT,
|
|
1597
|
+
interactionId: payload.interactionId
|
|
1598
|
+
});
|
|
1599
|
+
throw new Error('Remove action is disabled for this campaign preview contact');
|
|
1600
|
+
}
|
|
1601
|
+
_loggerProxy.default.info('Removing campaign preview contact', {
|
|
1602
|
+
module: _constants.CC_FILE,
|
|
1603
|
+
method: _constants.METHODS.REMOVE_PREVIEW_CONTACT
|
|
1604
|
+
});
|
|
1605
|
+
try {
|
|
1606
|
+
this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_REMOVE_SUCCESS, _constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_REMOVE_FAILED]);
|
|
1607
|
+
const result = await this.services.dialer.removePreviewContact({
|
|
1608
|
+
data: payload
|
|
1609
|
+
});
|
|
1610
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_REMOVE_SUCCESS, {
|
|
1611
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(result),
|
|
1612
|
+
interactionId: payload.interactionId,
|
|
1613
|
+
campaignId: payload.campaignId
|
|
1614
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1615
|
+
_loggerProxy.default.log('Campaign preview contact removed successfully', {
|
|
1616
|
+
module: _constants.CC_FILE,
|
|
1617
|
+
method: _constants.METHODS.REMOVE_PREVIEW_CONTACT,
|
|
1618
|
+
trackingId: result.trackingId,
|
|
1619
|
+
interactionId: payload.interactionId
|
|
1620
|
+
});
|
|
1621
|
+
return result;
|
|
1622
|
+
} catch (error) {
|
|
1623
|
+
const failure = error.details;
|
|
1624
|
+
this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.CAMPAIGN_PREVIEW_REMOVE_FAILED, {
|
|
1625
|
+
..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),
|
|
1626
|
+
interactionId: payload.interactionId,
|
|
1627
|
+
campaignId: payload.campaignId
|
|
1628
|
+
}, ['behavioral', 'business', 'operational']);
|
|
1629
|
+
const {
|
|
1630
|
+
error: detailedError
|
|
1631
|
+
} = (0, _Utils.getErrorDetails)(error, _constants.METHODS.REMOVE_PREVIEW_CONTACT, _constants.CC_FILE);
|
|
1632
|
+
throw detailedError;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1447
1636
|
/**
|
|
1448
1637
|
* Fetches outdial ANI (Automatic Number Identification) entries for an outdial ANI ID.
|
|
1449
1638
|
*
|