@webex/calling 3.10.0-next.1 → 3.10.0-next.10

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.
Files changed (47) hide show
  1. package/dist/CallHistory/CallHistory.js +26 -20
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +109 -0
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/WxCallBackendConnector.js +2 -1
  6. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  7. package/dist/CallingClient/CallingClient.js +160 -205
  8. package/dist/CallingClient/CallingClient.js.map +1 -1
  9. package/dist/CallingClient/CallingClient.test.js +152 -290
  10. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  11. package/dist/CallingClient/calling/call.js +14 -14
  12. package/dist/CallingClient/calling/call.js.map +1 -1
  13. package/dist/CallingClient/calling/call.test.js +348 -258
  14. package/dist/CallingClient/calling/call.test.js.map +1 -1
  15. package/dist/Contacts/ContactsClient.js +8 -5
  16. package/dist/Contacts/ContactsClient.js.map +1 -1
  17. package/dist/Events/impl/index.js +1 -2
  18. package/dist/Events/impl/index.js.map +1 -1
  19. package/dist/SDKConnector/types.js.map +1 -1
  20. package/dist/Voicemail/BroadworksBackendConnector.js +14 -12
  21. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  22. package/dist/Voicemail/UcmBackendConnector.js +2 -1
  23. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  24. package/dist/common/testUtil.js +2 -1
  25. package/dist/common/testUtil.js.map +1 -1
  26. package/dist/module/CallHistory/CallHistory.js +7 -3
  27. package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
  28. package/dist/module/CallingClient/CallingClient.js +83 -121
  29. package/dist/module/CallingClient/calling/call.js +5 -5
  30. package/dist/module/Contacts/ContactsClient.js +9 -5
  31. package/dist/module/Events/impl/index.js +1 -2
  32. package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
  33. package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
  34. package/dist/module/common/testUtil.js +1 -0
  35. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  36. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  37. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  38. package/dist/types/Contacts/ContactsClient.d.ts +1 -0
  39. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  40. package/dist/types/Events/impl/index.d.ts.map +1 -1
  41. package/dist/types/SDKConnector/types.d.ts +10 -0
  42. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  43. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  44. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  45. package/dist/types/common/testUtil.d.ts +1 -0
  46. package/dist/types/common/testUtil.d.ts.map +1 -1
  47. package/package.json +4 -4
@@ -307,28 +307,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
307
307
  _this.mediaEngine.setLogger(adaptedLogger);
308
308
  _this.primaryMobiusUris = [];
309
309
  _this.backupMobiusUris = [];
310
- var mobiusServiceHost = '';
311
- try {
312
- mobiusServiceHost = new URL(_this.webex.internal.services._serviceUrls.mobius).host;
313
- } catch (error) {
314
- _Logger.default.warn("Failed to parse mobius service URL", {
315
- file: _constants2.CALLING_CLIENT_FILE,
316
- method: _this.constructor.name
317
- });
318
- }
319
-
320
- // TODO: This is a temp fix - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6809
321
- if (_this.webex.internal.services._hostCatalog) {
322
- _this.mobiusClusters = mobiusServiceHost && _this.webex.internal.services._hostCatalog[mobiusServiceHost] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_US_PROD] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_EU_PROD] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_US_INT] || _this.webex.internal.services._hostCatalog[_constants2.MOBIUS_EU_INT];
323
- } else {
324
- // @ts-ignore
325
- var mobiusObject = _this.webex.internal.services._services.find(
326
- // @ts-ignore
327
- function (item) {
328
- return item.serviceName === 'mobius';
329
- });
330
- _this.mobiusClusters = [mobiusObject.serviceUrls[0].baseUrl];
331
- }
310
+ _this.mobiusClusters = _this.webex.internal.services.getMobiusClusters();
332
311
  _this.mobiusHost = '';
333
312
  _this.registerSessionsListener();
334
313
  _this.registerCallsClearedListener();
@@ -550,146 +529,72 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
550
529
  value: (function () {
551
530
  var _getClientRegionInfo = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
552
531
  var _this3 = this;
553
- var abort, regionInfo, _iterator2, _step2, _loop2, _ret;
554
- return _regenerator.default.wrap(function _callee9$(_context1) {
555
- while (1) switch (_context1.prev = _context1.next) {
532
+ var abort, regionInfo, _response$headers, _response$headers$tra, _response$headers2, response, clientRegionInfo;
533
+ return _regenerator.default.wrap(function _callee9$(_context0) {
534
+ while (1) switch (_context0.prev = _context0.next) {
556
535
  case 0:
557
536
  _Logger.default.info(_constants.METHOD_START_MESSAGE, {
558
537
  file: _constants2.CALLING_CLIENT_FILE,
559
538
  method: _constants2.METHODS.GET_CLIENT_REGION_INFO
560
539
  });
561
540
  regionInfo = {};
562
- _iterator2 = _createForOfIteratorHelper(this.mobiusClusters);
563
- _context1.prev = 3;
564
- _loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
565
- var mobius, _temp$headers, _response$headers, _response$headers2, _response$headers$tra, _response$headers3, temp, myIP, response, clientRegionInfo;
566
- return _regenerator.default.wrap(function _loop2$(_context0) {
567
- while (1) switch (_context0.prev = _context0.next) {
568
- case 0:
569
- mobius = _step2.value;
570
- if (mobius.host) {
571
- _this3.mobiusHost = "https://".concat(mobius.host).concat(_constants2.API_V1);
572
- } else {
573
- _this3.mobiusHost = mobius;
574
- }
575
- _context0.prev = 2;
576
- _context0.next = 5;
577
- return _this3.webex.request({
578
- uri: "".concat(_this3.mobiusHost).concat(_constants2.URL_ENDPOINT).concat(_constants2.IP_ENDPOINT),
579
- method: _types3.HTTP_METHODS.GET,
580
- headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, _this3.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
581
- service: _types3.ALLOWED_SERVICES.MOBIUS
582
- });
583
- case 5:
584
- temp = _context0.sent;
585
- _Logger.default.log("Response trackingId: ".concat(temp === null || temp === void 0 ? void 0 : (_temp$headers = temp.headers) === null || _temp$headers === void 0 ? void 0 : _temp$headers.trackingid), {
586
- file: _constants2.CALLING_CLIENT_FILE,
587
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
588
- });
589
- myIP = temp.body.ipv4; // eslint-disable-next-line no-await-in-loop
590
- _context0.next = 10;
591
- return _this3.webex.request({
592
- uri: "".concat(_constants2.DISCOVERY_URL, "/").concat(myIP),
593
- method: _types3.HTTP_METHODS.GET,
594
- addAuthHeader: false,
595
- headers: (0, _defineProperty2.default)({}, _constants2.SPARK_USER_AGENT, null)
596
- });
597
- case 10:
598
- response = _context0.sent;
599
- _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), {
600
- file: _constants2.CALLING_CLIENT_FILE,
601
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
602
- });
603
- clientRegionInfo = response.body;
604
- regionInfo.clientRegion = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.clientRegion ? clientRegionInfo.clientRegion : '';
605
- regionInfo.countryCode = clientRegionInfo !== null && clientRegionInfo !== void 0 && clientRegionInfo.countryCode ? clientRegionInfo.countryCode : '';
606
- _Logger.default.log("Successfully fetched Client region info: ".concat(regionInfo.clientRegion, ", countryCode: ").concat(regionInfo.countryCode, ", and response trackingid: ").concat(response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid), {
607
- file: _constants2.CALLING_CLIENT_FILE,
608
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO
609
- });
610
-
611
- // Metrics for region info - trying clusters in loop
612
- _this3.metricManager.submitRegionInfoMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.REGION_INFO, _types4.METRIC_TYPE.BEHAVIORAL, _this3.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, (_response$headers$tra = response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid) !== null && _response$headers$tra !== void 0 ? _response$headers$tra : '');
613
- return _context0.abrupt("return", 0);
614
- case 20:
615
- _context0.prev = 20;
616
- _context0.t0 = _context0["catch"](2);
617
- _Logger.default.error("Failed to get client region info: ".concat((0, _stringify.default)(_context0.t0)), {
618
- method: _constants2.METHODS.GET_CLIENT_REGION_INFO,
619
- file: _constants2.CALLING_CLIENT_FILE
620
- });
541
+ _context0.prev = 2;
542
+ _context0.next = 5;
543
+ return this.webex.request({
544
+ uri: "".concat(_constants2.DISCOVERY_URL),
545
+ method: _types3.HTTP_METHODS.GET,
546
+ addAuthHeader: false,
547
+ headers: (0, _defineProperty2.default)({}, _constants2.SPARK_USER_AGENT, null)
548
+ });
549
+ case 5:
550
+ response = _context0.sent;
551
+ clientRegionInfo = response.body;
552
+ regionInfo.clientRegion = (clientRegionInfo === null || clientRegionInfo === void 0 ? void 0 : clientRegionInfo.clientRegion) || '';
553
+ regionInfo.countryCode = (clientRegionInfo === null || clientRegionInfo === void 0 ? void 0 : clientRegionInfo.countryCode) || '';
554
+ _Logger.default.log("Successfully fetched Client region info: ".concat(regionInfo.clientRegion, ", countryCode: ").concat(regionInfo.countryCode, ", and response trackingid: ").concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), {
555
+ file: _constants2.CALLING_CLIENT_FILE,
556
+ method: _constants2.METHODS.GET_CLIENT_REGION_INFO
557
+ });
558
+ this.metricManager.submitRegionInfoMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.REGION_INFO, _types4.METRIC_TYPE.BEHAVIORAL, this.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, (_response$headers$tra = response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid) !== null && _response$headers$tra !== void 0 ? _response$headers$tra : '');
559
+ _context0.next = 25;
560
+ break;
561
+ case 13:
562
+ _context0.prev = 13;
563
+ _context0.t0 = _context0["catch"](2);
564
+ _Logger.default.error("Failed to get client region info: ".concat((0, _stringify.default)(_context0.t0)), {
565
+ method: _constants2.METHODS.GET_CLIENT_REGION_INFO,
566
+ file: _constants2.CALLING_CLIENT_FILE
567
+ });
621
568
 
622
- // eslint-disable-next-line no-await-in-loop
623
- _context0.next = 25;
624
- return (0, _Utils.handleCallingClientErrors)(_context0.t0, function (clientError) {
625
- var _headers$trackingId, _headers3;
626
- _this3.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId = (_headers3 = _context0.t0.headers) === null || _headers3 === void 0 ? void 0 : _headers3.trackingId) !== null && _headers$trackingId !== void 0 ? _headers$trackingId : '', undefined, clientError);
627
- _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
628
- }, {
629
- method: _constants2.GET_MOBIUS_SERVERS_UTIL,
630
- file: _constants2.CALLING_CLIENT_FILE
631
- });
632
- case 25:
633
- abort = _context0.sent;
634
- regionInfo.clientRegion = '';
635
- regionInfo.countryCode = '';
636
- if (!abort) {
637
- _context0.next = 32;
638
- break;
639
- }
640
- _context0.next = 31;
641
- return (0, _Utils.uploadLogs)();
642
- case 31:
643
- return _context0.abrupt("return", {
644
- v: regionInfo
645
- });
646
- case 32:
647
- case "end":
648
- return _context0.stop();
649
- }
650
- }, _loop2, null, [[2, 20]]);
569
+ // eslint-disable-next-line no-await-in-loop
570
+ _context0.next = 18;
571
+ return (0, _Utils.handleCallingClientErrors)(_context0.t0, function (clientError) {
572
+ var _headers$trackingId, _headers2;
573
+ _this3.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId = (_headers2 = _context0.t0.headers) === null || _headers2 === void 0 ? void 0 : _headers2.trackingId) !== null && _headers$trackingId !== void 0 ? _headers$trackingId : '', undefined, clientError);
574
+ _this3.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
575
+ }, {
576
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL,
577
+ file: _constants2.CALLING_CLIENT_FILE
651
578
  });
652
- _iterator2.s();
653
- case 6:
654
- if ((_step2 = _iterator2.n()).done) {
655
- _context1.next = 15;
656
- break;
657
- }
658
- return _context1.delegateYield(_loop2(), "t0", 8);
659
- case 8:
660
- _ret = _context1.t0;
661
- if (!(_ret === 0)) {
662
- _context1.next = 11;
663
- break;
664
- }
665
- return _context1.abrupt("break", 15);
666
- case 11:
667
- if (!_ret) {
668
- _context1.next = 13;
579
+ case 18:
580
+ abort = _context0.sent;
581
+ regionInfo.clientRegion = '';
582
+ regionInfo.countryCode = '';
583
+ if (!abort) {
584
+ _context0.next = 25;
669
585
  break;
670
586
  }
671
- return _context1.abrupt("return", _ret.v);
672
- case 13:
673
- _context1.next = 6;
674
- break;
675
- case 15:
676
- _context1.next = 20;
677
- break;
678
- case 17:
679
- _context1.prev = 17;
680
- _context1.t1 = _context1["catch"](3);
681
- _iterator2.e(_context1.t1);
682
- case 20:
683
- _context1.prev = 20;
684
- _iterator2.f();
685
- return _context1.finish(20);
686
- case 23:
687
- return _context1.abrupt("return", regionInfo);
587
+ _context0.next = 24;
588
+ return (0, _Utils.uploadLogs)();
688
589
  case 24:
590
+ return _context0.abrupt("return", regionInfo);
591
+ case 25:
592
+ return _context0.abrupt("return", regionInfo);
593
+ case 26:
689
594
  case "end":
690
- return _context1.stop();
595
+ return _context0.stop();
691
596
  }
692
- }, _callee9, this, [[3, 17, 20, 23]]);
597
+ }, _callee9, this, [[2, 13]]);
693
598
  }));
694
599
  function getClientRegionInfo() {
695
600
  return _getClientRegionInfo.apply(this, arguments);
@@ -709,7 +614,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
709
614
  _this$sdkConfig4,
710
615
  _this$sdkConfig4$disc,
711
616
  _this4 = this;
712
- var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, regionInfo, _response$headers4, _response$headers$tra2, _response$headers5, response, mobiusServers, mobiusUris, abort;
617
+ var useDefault, clientRegion, countryCode, _this$sdkConfig5, _this$sdkConfig5$disc, _this$sdkConfig6, _this$sdkConfig6$disc, _this$webex$internal$, regionInfo, _iterator2, _step2, _loop2, _ret;
713
618
  return _regenerator.default.wrap(function _callee0$(_context10) {
714
619
  while (1) switch (_context10.prev = _context10.next) {
715
620
  case 0:
@@ -735,7 +640,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
735
640
  });
736
641
  clientRegion = (_this$sdkConfig5 = this.sdkConfig) === null || _this$sdkConfig5 === void 0 ? void 0 : (_this$sdkConfig5$disc = _this$sdkConfig5.discovery) === null || _this$sdkConfig5$disc === void 0 ? void 0 : _this$sdkConfig5$disc.region;
737
642
  countryCode = (_this$sdkConfig6 = this.sdkConfig) === null || _this$sdkConfig6 === void 0 ? void 0 : (_this$sdkConfig6$disc = _this$sdkConfig6.discovery) === null || _this$sdkConfig6$disc === void 0 ? void 0 : _this$sdkConfig6$disc.country;
738
- this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
643
+ this.mobiusHost = ((_this$webex$internal$ = this.webex.internal.services._serviceUrls) === null || _this$webex$internal$ === void 0 ? void 0 : _this$webex$internal$.mobius) || this.webex.internal.services.get(this.webex.internal.services._activeServices.mobius);
739
644
  _context10.next = 15;
740
645
  break;
741
646
  case 9:
@@ -751,73 +656,123 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
751
656
  countryCode = regionInfo.countryCode;
752
657
  case 15:
753
658
  if (!(clientRegion && countryCode)) {
754
- _context10.next = 42;
659
+ _context10.next = 38;
755
660
  break;
756
661
  }
757
662
  _Logger.default.log("Found Region: ".concat(clientRegion, " and country: ").concat(countryCode, ", going to fetch Mobius server"), {
758
663
  file: _constants2.CALLING_CLIENT_FILE,
759
664
  method: _constants2.GET_MOBIUS_SERVERS_UTIL
760
665
  });
761
- _context10.prev = 17;
762
- _context10.next = 20;
763
- return this.webex.request({
764
- uri: "".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
765
- method: _types3.HTTP_METHODS.GET,
766
- headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, this.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
767
- service: _types3.ALLOWED_SERVICES.MOBIUS
768
- });
769
- case 20:
770
- response = _context10.sent;
771
- _Logger.default.log("Mobius Server found for the region. Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid), {
772
- file: _constants2.CALLING_CLIENT_FILE,
773
- method: _constants2.GET_MOBIUS_SERVERS_UTIL
774
- });
775
- mobiusServers = response.body; // Metrics for mobius servers
776
- this.metricManager.submitMobiusServersMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, _types4.METRIC_TYPE.BEHAVIORAL, mobiusServers, (_response$headers$tra2 = response === null || response === void 0 ? void 0 : (_response$headers5 = response.headers) === null || _response$headers5 === void 0 ? void 0 : _response$headers5.trackingid) !== null && _response$headers$tra2 !== void 0 ? _response$headers$tra2 : '');
666
+ _iterator2 = _createForOfIteratorHelper(this.mobiusClusters);
667
+ _context10.prev = 18;
668
+ _loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
669
+ var mobius, _response$headers3, _response$headers$tra2, _response$headers4, response, mobiusServers, mobiusUris, abort;
670
+ return _regenerator.default.wrap(function _loop2$(_context1) {
671
+ while (1) switch (_context1.prev = _context1.next) {
672
+ case 0:
673
+ mobius = _step2.value;
674
+ if (mobius.host) {
675
+ _this4.mobiusHost = "https://".concat(mobius.host).concat(_constants2.API_V1);
676
+ } else {
677
+ _this4.mobiusHost = mobius;
678
+ }
679
+ _context1.prev = 2;
680
+ _context1.next = 5;
681
+ return _this4.webex.request({
682
+ uri: "".concat(_this4.mobiusHost).concat(_constants2.URL_ENDPOINT, "?regionCode=").concat(clientRegion, "&countryCode=").concat(countryCode),
683
+ method: _types3.HTTP_METHODS.GET,
684
+ headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants2.CISCO_DEVICE_URL, _this4.webex.internal.device.url), _constants2.SPARK_USER_AGENT, _constants2.CALLING_USER_AGENT),
685
+ service: _types3.ALLOWED_SERVICES.MOBIUS
686
+ });
687
+ case 5:
688
+ response = _context1.sent;
689
+ _Logger.default.log("Mobius Server found for the region. Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid), {
690
+ file: _constants2.CALLING_CLIENT_FILE,
691
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL
692
+ });
693
+ mobiusServers = response.body; // Metrics for mobius servers
694
+ _this4.metricManager.submitMobiusServersMetric(_types4.METRIC_EVENT.MOBIUS_DISCOVERY, _types4.MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, _types4.METRIC_TYPE.BEHAVIORAL, mobiusServers, (_response$headers$tra2 = response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid) !== null && _response$headers$tra2 !== void 0 ? _response$headers$tra2 : '');
777
695
 
778
- /* update arrays of Mobius Uris. */
779
- mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, this.mobiusHost);
780
- this.primaryMobiusUris = mobiusUris.primary;
781
- this.backupMobiusUris = mobiusUris.backup;
782
- _Logger.default.log("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), {
783
- file: _constants2.CALLING_CLIENT_FILE,
784
- method: _constants2.GET_MOBIUS_SERVERS_UTIL
696
+ /* update arrays of Mobius Uris. */
697
+ mobiusUris = (0, _Utils.filterMobiusUris)(mobiusServers, _this4.mobiusHost);
698
+ _this4.primaryMobiusUris = mobiusUris.primary;
699
+ _this4.backupMobiusUris = mobiusUris.backup;
700
+ _Logger.default.log("Final list of Mobius Servers, primary: ".concat(mobiusUris.primary, " and backup: ").concat(mobiusUris.backup), {
701
+ file: _constants2.CALLING_CLIENT_FILE,
702
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL
703
+ });
704
+ return _context1.abrupt("return", 0);
705
+ case 16:
706
+ _context1.prev = 16;
707
+ _context1.t0 = _context1["catch"](2);
708
+ _Logger.default.error("Failed to get Mobius servers: ".concat((0, _stringify.default)(_context1.t0)), {
709
+ method: _constants2.METHODS.GET_MOBIUS_SERVERS,
710
+ file: _constants2.CALLING_CLIENT_FILE
711
+ });
712
+
713
+ // eslint-disable-next-line no-await-in-loop
714
+ _context1.next = 21;
715
+ return (0, _Utils.handleCallingClientErrors)(_context1.t0, function (clientError) {
716
+ var _headers$trackingId2, _headers4;
717
+ _this4.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId2 = (_headers4 = _context1.t0.headers) === null || _headers4 === void 0 ? void 0 : _headers4.trackingId) !== null && _headers$trackingId2 !== void 0 ? _headers$trackingId2 : '', undefined, clientError);
718
+ _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
719
+ }, {
720
+ method: _constants2.GET_MOBIUS_SERVERS_UTIL,
721
+ file: _constants2.CALLING_CLIENT_FILE
722
+ });
723
+ case 21:
724
+ abort = _context1.sent;
725
+ if (!abort) {
726
+ _context1.next = 27;
727
+ break;
728
+ }
729
+ useDefault = true;
730
+ // eslint-disable-next-line no-await-in-loop
731
+ _context1.next = 26;
732
+ return (0, _Utils.uploadLogs)();
733
+ case 26:
734
+ return _context1.abrupt("return", 0);
735
+ case 27:
736
+ case "end":
737
+ return _context1.stop();
738
+ }
739
+ }, _loop2, null, [[2, 16]]);
785
740
  });
786
- _context10.next = 40;
741
+ _iterator2.s();
742
+ case 21:
743
+ if ((_step2 = _iterator2.n()).done) {
744
+ _context10.next = 28;
745
+ break;
746
+ }
747
+ return _context10.delegateYield(_loop2(), "t0", 23);
748
+ case 23:
749
+ _ret = _context10.t0;
750
+ if (!(_ret === 0)) {
751
+ _context10.next = 26;
752
+ break;
753
+ }
754
+ return _context10.abrupt("break", 28);
755
+ case 26:
756
+ _context10.next = 21;
757
+ break;
758
+ case 28:
759
+ _context10.next = 33;
787
760
  break;
788
761
  case 30:
789
762
  _context10.prev = 30;
790
- _context10.t0 = _context10["catch"](17);
791
- _Logger.default.error("Failed to get Mobius servers: ".concat((0, _stringify.default)(_context10.t0)), {
792
- method: _constants2.METHODS.GET_MOBIUS_SERVERS,
793
- file: _constants2.CALLING_CLIENT_FILE
794
- });
795
- _context10.next = 35;
796
- return (0, _Utils.handleCallingClientErrors)(_context10.t0, function (clientError) {
797
- var _headers$trackingId2, _headers5;
798
- _this4.metricManager.submitRegistrationMetric(_types4.METRIC_EVENT.REGISTRATION_ERROR, _types4.REG_ACTION.REGISTER, _types4.METRIC_TYPE.BEHAVIORAL, _constants2.GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', (_headers$trackingId2 = (_headers5 = _context10.t0.headers) === null || _headers5 === void 0 ? void 0 : _headers5.trackingId) !== null && _headers$trackingId2 !== void 0 ? _headers$trackingId2 : '', undefined, clientError);
799
- _this4.emit(_types2.CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
800
- }, {
801
- method: _constants2.GET_MOBIUS_SERVERS_UTIL,
802
- file: _constants2.CALLING_CLIENT_FILE
803
- });
804
- case 35:
805
- abort = _context10.sent;
806
- if (!abort) {
807
- _context10.next = 39;
808
- break;
809
- }
763
+ _context10.t1 = _context10["catch"](18);
764
+ _iterator2.e(_context10.t1);
765
+ case 33:
766
+ _context10.prev = 33;
767
+ _iterator2.f();
768
+ return _context10.finish(33);
769
+ case 36:
810
770
  _context10.next = 39;
811
- return (0, _Utils.uploadLogs)();
812
- case 39:
813
- useDefault = true;
814
- case 40:
815
- _context10.next = 43;
816
771
  break;
817
- case 42:
772
+ case 38:
818
773
  /* Setting this to true because region info is possibly undefined */
819
774
  useDefault = true;
820
- case 43:
775
+ case 39:
821
776
  /* Use a default URL if Mobius discovery fails either because of region info failure
822
777
  * or because the discovered Mobius couldn't be reached
823
778
  */
@@ -830,11 +785,11 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
830
785
  this.mobiusHost = "https://".concat(this.mobiusClusters[0].host).concat(_constants2.API_V1);
831
786
  this.primaryMobiusUris = ["".concat(this.mobiusHost).concat(_constants2.URL_ENDPOINT)];
832
787
  }
833
- case 44:
788
+ case 40:
834
789
  case "end":
835
790
  return _context10.stop();
836
791
  }
837
- }, _callee0, this, [[17, 30]]);
792
+ }, _callee0, this, [[18, 30, 33, 36]]);
838
793
  }));
839
794
  function getMobiusServers() {
840
795
  return _getMobiusServers.apply(this, arguments);