@webex/contact-center 3.12.0-next.67 → 3.12.0-next.68

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
@@ -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.
@@ -368,6 +369,16 @@ class ContactCenter extends _webexCore.WebexPlugin {
368
369
  // @ts-ignore
369
370
  this.trigger(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, task);
370
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
+ };
371
382
  handleRTDWebsocketMessage = payload => {
372
383
  this.taskManager.handleRealtimeWebsocketEvent(payload);
373
384
  };
@@ -381,6 +392,7 @@ class ContactCenter extends _webexCore.WebexPlugin {
381
392
  this.taskManager.on(_types4.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
382
393
  this.taskManager.on(_types4.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
383
394
  this.taskManager.on(_types4.TASK_EVENTS.TASK_MERGED, this.handleTaskMerged);
395
+ this.taskManager.on(_types4.TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, this.handleTaskMultiLoginHydrate);
384
396
  this.taskManager.on(_types4.TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_RESERVATION, this.handleCampaignPreviewReservation);
385
397
  }
386
398
 
@@ -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
@@ -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,6 +704,11 @@ 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();
@@ -756,8 +793,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
756
793
  auxCodeId: _constants.EMPTY_STRING
757
794
  }
758
795
  });
759
- if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER) {
796
+ if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER && !this.isWebRTCRegistrationDisabled()) {
760
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
+ });
761
803
  }
762
804
  const resp = await loginResponse;
763
805
  const {
@@ -1213,6 +1255,13 @@ class ContactCenter extends _webexCore.WebexPlugin {
1213
1255
  this.agentConfig.deviceType = deviceType;
1214
1256
  switch (deviceType) {
1215
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
+ }
1216
1265
  try {
1217
1266
  await this.webCallingService.registerWebCallingLine();
1218
1267
  } catch (error) {