@webex/contact-center 3.10.0-next.31 → 3.10.0-next.32

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/src/cc.ts CHANGED
@@ -693,52 +693,49 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
693
693
  module: CC_FILE,
694
694
  method: METHODS.CONNECT_WEBSOCKET,
695
695
  });
696
+
696
697
  try {
697
- return this.services.webSocketManager
698
- .initWebSocket({
699
- body: this.getConnectionConfig(),
700
- })
701
- .then(async (data: WelcomeEvent) => {
702
- const agentId = data.agentId;
703
- const orgId = this.$webex.credentials.getOrgId();
704
- this.agentConfig = await this.services.config.getAgentConfig(orgId, agentId);
705
- LoggerProxy.log(`Agent config is fetched successfully`, {
698
+ const data = (await this.services.webSocketManager.initWebSocket({
699
+ body: this.getConnectionConfig(),
700
+ })) as WelcomeEvent;
701
+
702
+ const agentId = data.agentId;
703
+ const orgId = this.$webex.credentials.getOrgId();
704
+ this.agentConfig = await this.services.config.getAgentConfig(orgId, agentId);
705
+
706
+ LoggerProxy.log(`Agent config is fetched successfully`, {
707
+ module: CC_FILE,
708
+ method: METHODS.CONNECT_WEBSOCKET,
709
+ });
710
+
711
+ // TODO: Make profile a singleton to make it available throughout app/sdk so we dont need to inject info everywhere
712
+ this.taskManager.setWrapupData(this.agentConfig.wrapUpData);
713
+ this.taskManager.setAgentId(this.agentConfig.agentId);
714
+ this.taskManager.setWebRtcEnabled(this.agentConfig.webRtcEnabled);
715
+
716
+ if (
717
+ this.agentConfig.webRtcEnabled &&
718
+ this.agentConfig.loginVoiceOptions.includes(LoginOption.BROWSER)
719
+ ) {
720
+ try {
721
+ await this.$webex.internal.mercury.connect();
722
+ LoggerProxy.log('Authentication: webex.internal.mercury.connect successful', {
706
723
  module: CC_FILE,
707
724
  method: METHODS.CONNECT_WEBSOCKET,
708
725
  });
709
- // TODO: Make profile a singleton to make it available throughout app/sdk so we dont need to inject info everywhere
710
- this.taskManager.setWrapupData(this.agentConfig.wrapUpData);
711
- this.taskManager.setAgentId(this.agentConfig.agentId);
712
- this.taskManager.setWebRtcEnabled(this.agentConfig.webRtcEnabled);
713
-
714
- if (
715
- this.agentConfig.webRtcEnabled &&
716
- this.agentConfig.loginVoiceOptions.includes(LoginOption.BROWSER)
717
- ) {
718
- this.$webex.internal.mercury
719
- .connect()
720
- .then(() => {
721
- LoggerProxy.log('Authentication: webex.internal.mercury.connect successful', {
722
- module: CC_FILE,
723
- method: METHODS.CONNECT_WEBSOCKET,
724
- });
725
- })
726
- .catch((error) => {
727
- LoggerProxy.error(`Error occurred during mercury.connect() ${error}`, {
728
- module: CC_FILE,
729
- method: METHODS.CONNECT_WEBSOCKET,
730
- });
731
- });
732
- }
733
- if (this.$config && this.$config.allowAutomatedRelogin) {
734
- await this.silentRelogin();
735
- }
736
-
737
- return this.agentConfig;
738
- })
739
- .catch((error) => {
740
- throw error;
741
- });
726
+ } catch (error) {
727
+ LoggerProxy.error(`Error occurred during mercury.connect() ${error}`, {
728
+ module: CC_FILE,
729
+ method: METHODS.CONNECT_WEBSOCKET,
730
+ });
731
+ }
732
+ }
733
+
734
+ if (this.$config && this.$config.allowAutomatedRelogin) {
735
+ await this.silentRelogin();
736
+ }
737
+
738
+ return this.agentConfig;
742
739
  } catch (error) {
743
740
  LoggerProxy.error(`Error during register: ${error}`, {
744
741
  module: CC_FILE,