@webex/contact-center 3.12.0-task-refactor.10 → 3.12.0-task-refactor.11

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 CHANGED
@@ -300,6 +300,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
300
300
  this.$webex.once(_constants.READY, () => {
301
301
  // @ts-ignore
302
302
  this.$config = this.config;
303
+ this.validatePluginConfig();
303
304
 
304
305
  /**
305
306
  * This is used for handling the async requests by sending webex.request and wait for corresponding websocket event.
@@ -349,6 +350,16 @@ class ContactCenter extends _webexCore.WebexPlugin {
349
350
  this.trigger(_types4.TASK_EVENTS.TASK_HYDRATE, task);
350
351
  };
351
352
 
353
+ /**
354
+ * Handles multi-login hydrate events for SDK instances without Mobius registration
355
+ * @private
356
+ * @param {ITask} task The task object associated with the multi-login hydrate
357
+ */
358
+ handleTaskMultiLoginHydrate = task => {
359
+ // @ts-ignore
360
+ this.trigger(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, task);
361
+ };
362
+
352
363
  /**
353
364
  * Handles task merged events when tasks are combined eg: EPDN merge/transfer
354
365
  * @private
@@ -367,6 +378,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
367
378
  incomingTaskListener() {
368
379
  this.taskManager.on(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
369
380
  this.taskManager.on(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
381
+ this.taskManager.on(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, this.handleTaskMultiLoginHydrate);
370
382
  this.taskManager.on(_types4.TASK_EVENTS.TASK_MERGED, this.handleTaskMerged);
371
383
  }
372
384
 
@@ -476,6 +488,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
476
488
  this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.WEBSOCKET_DEREGISTER_SUCCESS, _constants4.METRIC_EVENT_NAMES.WEBSOCKET_DEREGISTER_FAIL]);
477
489
  this.taskManager.off(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
478
490
  this.taskManager.off(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
491
+ this.taskManager.off(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, this.handleTaskMultiLoginHydrate);
479
492
  this.taskManager.unregisterIncomingCallEvent();
480
493
  this.services.webSocketManager.off('message', this.handleWebsocketMessage);
481
494
  this.services.rtdWebSocketManager.off('message', this.handleRTDWebsocketMessage);
@@ -654,7 +667,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
654
667
  });
655
668
  });
656
669
  }
657
- if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER)) {
670
+ if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER) && !this.isWebRTCRegistrationDisabled()) {
658
671
  this.$webex.internal.mercury.connect().then(() => {
659
672
  _loggerProxy.default.log('Authentication: webex.internal.mercury.connect successful', {
660
673
  module: _constants.CC_FILE,
@@ -666,6 +679,11 @@ class ContactCenter extends _webexCore.WebexPlugin {
666
679
  method: _constants.METHODS.CONNECT_WEBSOCKET
667
680
  });
668
681
  });
682
+ } else if (this.isWebRTCRegistrationDisabled()) {
683
+ _loggerProxy.default.info('Skipping Mobius registration because disableWebRTCRegistration is enabled', {
684
+ module: _constants.CC_FILE,
685
+ method: _constants.METHODS.CONNECT_WEBSOCKET
686
+ });
669
687
  }
670
688
  if (this.$config && this.$config.allowAutomatedRelogin) {
671
689
  await this.silentRelogin();
@@ -742,8 +760,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
742
760
  auxCodeId: _constants.EMPTY_STRING
743
761
  }
744
762
  });
745
- if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER) {
763
+ if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER && !this.isWebRTCRegistrationDisabled()) {
746
764
  await this.webCallingService.registerWebCallingLine();
765
+ } else if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER && this.isWebRTCRegistrationDisabled()) {
766
+ _loggerProxy.default.info('Skipping web calling line registration because disableWebRTCRegistration is enabled', {
767
+ module: _constants.CC_FILE,
768
+ method: _constants.METHODS.STATION_LOGIN
769
+ });
747
770
  }
748
771
  const resp = await loginResponse;
749
772
  const {
@@ -1070,6 +1093,25 @@ class ContactCenter extends _webexCore.WebexPlugin {
1070
1093
  this.taskManager.handleRealtimeWebsocketEvent(event);
1071
1094
  };
1072
1095
 
1096
+ /**
1097
+ * Checks whether Mobius/WebRTC registration should be skipped by config
1098
+ * @returns {boolean} True when browser WebRTC registration is disabled
1099
+ * @private
1100
+ */
1101
+ isWebRTCRegistrationDisabled() {
1102
+ return this.$config?.disableWebRTCRegistration === true;
1103
+ }
1104
+
1105
+ /**
1106
+ * Validates contact-center plugin configuration before service initialization
1107
+ * @private
1108
+ */
1109
+ validatePluginConfig() {
1110
+ if (this.$config?.disableWebRTCRegistration === true && this.$config?.allowMultiLogin === false) {
1111
+ 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.');
1112
+ }
1113
+ }
1114
+
1073
1115
  /**
1074
1116
  * Initializes event listeners for the Contact Center service
1075
1117
  * Sets up handlers for connection state changes and other core events
@@ -1204,6 +1246,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
1204
1246
  this.agentConfig.deviceType = deviceType;
1205
1247
  switch (deviceType) {
1206
1248
  case _types.LoginOption.BROWSER:
1249
+ if (this.isWebRTCRegistrationDisabled()) {
1250
+ _loggerProxy.default.info('Skipping web calling line registration because disableWebRTCRegistration is enabled', {
1251
+ module: _constants.CC_FILE,
1252
+ method: _constants.METHODS.HANDLE_DEVICE_TYPE
1253
+ });
1254
+ break;
1255
+ }
1207
1256
  try {
1208
1257
  await this.webCallingService.registerWebCallingLine();
1209
1258
  } catch (error) {