@webex/calling 3.12.0-next.52 → 3.12.0-next.54

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 (32) hide show
  1. package/dist/CallingClient/CallingClient.js +25 -78
  2. package/dist/CallingClient/CallingClient.js.map +1 -1
  3. package/dist/CallingClient/CallingClient.test.js +322 -122
  4. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  5. package/dist/CallingClient/calling/callManager.js +29 -2
  6. package/dist/CallingClient/calling/callManager.js.map +1 -1
  7. package/dist/CallingClient/calling/callManager.test.js +88 -0
  8. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  9. package/dist/CallingClient/constants.js +1 -0
  10. package/dist/CallingClient/constants.js.map +1 -1
  11. package/dist/CallingClient/registration/register.js +10 -0
  12. package/dist/CallingClient/registration/register.js.map +1 -1
  13. package/dist/CallingClient/registration/register.test.js +69 -0
  14. package/dist/CallingClient/registration/register.test.js.map +1 -1
  15. package/dist/CallingClient/utils/request.js +20 -0
  16. package/dist/CallingClient/utils/request.js.map +1 -1
  17. package/dist/CallingClient/utils/request.test.js +31 -0
  18. package/dist/CallingClient/utils/request.test.js.map +1 -1
  19. package/dist/module/CallingClient/CallingClient.js +17 -39
  20. package/dist/module/CallingClient/calling/callManager.js +13 -1
  21. package/dist/module/CallingClient/constants.js +1 -0
  22. package/dist/module/CallingClient/registration/register.js +3 -0
  23. package/dist/module/CallingClient/utils/request.js +7 -0
  24. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  25. package/dist/types/CallingClient/calling/callManager.d.ts +1 -0
  26. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  27. package/dist/types/CallingClient/constants.d.ts +1 -0
  28. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  29. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  30. package/dist/types/CallingClient/utils/request.d.ts +1 -0
  31. package/dist/types/CallingClient/utils/request.d.ts.map +1 -1
  32. package/package.json +1 -1
@@ -44,7 +44,7 @@ var _types5 = require("../Metrics/types");
44
44
  var _Metrics = require("../Metrics");
45
45
  var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
46
46
  var _request = require("./utils/request");
47
- function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t11 in e) "default" !== _t11 && {}.hasOwnProperty.call(e, _t11) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t11)) && (i.get || i.set) ? o(f, _t11, i) : f[_t11] = e[_t11]); return f; })(e, t); }
47
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t1 in e) "default" !== _t1 && {}.hasOwnProperty.call(e, _t1) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t1)) && (i.get || i.set) ? o(f, _t1, i) : f[_t1] = e[_t1]); return f; })(e, t); }
48
48
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
49
49
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
50
50
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -940,7 +940,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
940
940
  key: "connectToMobiusSocket",
941
941
  value: (function () {
942
942
  var _connectToMobiusSocket = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
943
- var loggerContext, _iterator3, _step3, wssUri, _iterator4, _step4, _wssUri, _t7, _t8, _t9, _t0;
943
+ var loggerContext, _iterator3, _step3, wssUri, _t7, _t8;
944
944
  return _regenerator.default.wrap(function (_context12) {
945
945
  while (1) switch (_context12.prev = _context12.next) {
946
946
  case 0:
@@ -949,18 +949,15 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
949
949
  method: _constants2.METHODS.CONNECT_TO_MOBIUS_SOCKET
950
950
  };
951
951
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
952
- if (!(!this.primaryWssMobiusUris.length && !this.backupWssMobiusUris.length)) {
952
+ if (this.primaryWssMobiusUris.length) {
953
953
  _context12.next = 1;
954
954
  break;
955
955
  }
956
- _Logger.default.warn('No WSS URIs available from Mobius discovery, skipping socket connection', loggerContext);
956
+ _Logger.default.warn('No WSS URIs available from Mobius discovery for primary, skipping socket connection', loggerContext);
957
957
  return _context12.abrupt("return");
958
958
  case 1:
959
- if (!this.primaryWssMobiusUris.length) {
960
- _context12.next = 12;
961
- break;
962
- }
963
- _Logger.default.log("Attempting Mobius socket connection using primary WSS URIs (".concat(this.primaryWssMobiusUris.length, " available)"), loggerContext);
959
+ // Attempt to establish the socket connection with mobius if primary wss urls are present
960
+ // If wss url is not present for primary/backup, registration will be attempted with http even when feature flag is enabled for mobius socket
964
961
  _iterator3 = _createForOfIteratorHelper(this.primaryWssMobiusUris);
965
962
  _context12.prev = 2;
966
963
  _iterator3.s();
@@ -998,67 +995,11 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
998
995
  return _context12.finish(10);
999
996
  case 11:
1000
997
  _Logger.default.warn('All primary WSS URI connection attempts failed', loggerContext);
1001
- _context12.next = 13;
1002
- break;
1003
998
  case 12:
1004
- _Logger.default.warn('No primary WSS URIs available, skipping to backup', loggerContext);
1005
- case 13:
1006
- if (!this.backupWssMobiusUris.length) {
1007
- _context12.next = 24;
1008
- break;
1009
- }
1010
- _Logger.default.log("Attempting Mobius socket connection using backup WSS URIs (".concat(this.backupWssMobiusUris.length, " available)"), loggerContext);
1011
- _iterator4 = _createForOfIteratorHelper(this.backupWssMobiusUris);
1012
- _context12.prev = 14;
1013
- _iterator4.s();
1014
- case 15:
1015
- if ((_step4 = _iterator4.n()).done) {
1016
- _context12.next = 20;
1017
- break;
1018
- }
1019
- _wssUri = _step4.value;
1020
- _context12.prev = 16;
1021
- _Logger.default.log("Trying backup WSS URI: ".concat(_wssUri), loggerContext);
1022
- // eslint-disable-next-line no-await-in-loop
1023
- _context12.next = 17;
1024
- return this.apiRequest.connectToMobiusSocket(_wssUri);
1025
- case 17:
1026
- _Logger.default.log("Successfully connected to Mobius socket on backup WSS URI: ".concat(_wssUri), loggerContext);
1027
- return _context12.abrupt("return");
1028
- case 18:
1029
- _context12.prev = 18;
1030
- _t9 = _context12["catch"](16);
1031
- _Logger.default.warn("Backup WSS URI connection failed for ".concat(_wssUri, ": ").concat(_t9), loggerContext);
1032
- case 19:
1033
- _context12.next = 15;
1034
- break;
1035
- case 20:
1036
- _context12.next = 22;
1037
- break;
1038
- case 21:
1039
- _context12.prev = 21;
1040
- _t0 = _context12["catch"](14);
1041
- _iterator4.e(_t0);
1042
- case 22:
1043
- _context12.prev = 22;
1044
- _iterator4.f();
1045
- return _context12.finish(22);
1046
- case 23:
1047
- _Logger.default.warn('All backup WSS URI connection attempts failed', loggerContext);
1048
- _context12.next = 25;
1049
- break;
1050
- case 24:
1051
- _Logger.default.warn('No backup WSS URIs available', loggerContext);
1052
- case 25:
1053
- // Throwing an error is not required here. Connection will be attempted again during registration if no connection is established.
1054
- // We might remove this connection attempt logic during optimization since we are anyway going to try to connect to Mobius during
1055
- // registration and without registration the connection will be closed automatically by the mobius server.
1056
- _Logger.default.warn('All Mobius socket connection attempts exhausted for both primary and backup, continuing without socket', loggerContext);
1057
- case 26:
1058
999
  case "end":
1059
1000
  return _context12.stop();
1060
1001
  }
1061
- }, _callee10, this, [[2, 9, 10, 11], [4, 6], [14, 21, 22, 23], [16, 18]]);
1002
+ }, _callee10, this, [[2, 9, 10, 11], [4, 6]]);
1062
1003
  }));
1063
1004
  function connectToMobiusSocket() {
1064
1005
  return _connectToMobiusSocket.apply(this, arguments);
@@ -1156,7 +1097,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1156
1097
  value: (function () {
1157
1098
  var _createLine = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
1158
1099
  var _this$sdkConfig8;
1159
- var line;
1100
+ var socketEnabled, primaryUris, backupUris, line;
1160
1101
  return _regenerator.default.wrap(function (_context14) {
1161
1102
  while (1) switch (_context14.prev = _context14.next) {
1162
1103
  case 0:
@@ -1164,7 +1105,13 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1164
1105
  file: _constants2.CALLING_CLIENT_FILE,
1165
1106
  method: _constants2.METHODS.CREATE_LINE
1166
1107
  });
1167
- line = new _line.default(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, this.apiRequest.isSocketEnabled() ? (0, _Utils.normalizeMobiusUris)(this.primaryWssMobiusUris) : this.primaryMobiusUris, this.apiRequest.isSocketEnabled() ? (0, _Utils.normalizeMobiusUris)(this.backupWssMobiusUris) : this.backupMobiusUris, this.getLoggingLevel(), this.serviceData, (_this$sdkConfig8 = this.sdkConfig) === null || _this$sdkConfig8 === void 0 ? void 0 : _this$sdkConfig8.jwe);
1108
+ // When the Mobius socket is enabled, fall back to the HTTP URIs per group when that
1109
+ // group has no WSS URL, so registration is still attempted (primary and backup are
1110
+ // resolved independently). When the socket is disabled, always use the HTTP URIs.
1111
+ socketEnabled = this.apiRequest.isSocketEnabled();
1112
+ primaryUris = socketEnabled && this.primaryWssMobiusUris.length ? (0, _Utils.normalizeMobiusUris)(this.primaryWssMobiusUris) : this.primaryMobiusUris;
1113
+ backupUris = socketEnabled && this.backupWssMobiusUris.length ? (0, _Utils.normalizeMobiusUris)(this.backupWssMobiusUris) : this.backupMobiusUris;
1114
+ line = new _line.default(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, primaryUris, backupUris, this.getLoggingLevel(), this.serviceData, (_this$sdkConfig8 = this.sdkConfig) === null || _this$sdkConfig8 === void 0 ? void 0 : _this$sdkConfig8.jwe);
1168
1115
  this.lineDict[line.lineId] = line;
1169
1116
  case 1:
1170
1117
  case "end":
@@ -1195,7 +1142,7 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1195
1142
  key: "getDevices",
1196
1143
  value: (function () {
1197
1144
  var _getDevices = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(userId) {
1198
- var userid, mobiusUrls, finalError, _iterator5, _step5, mobiusUrl, normalizedMobiusUrl, uri, _body$devices, response, body, _t1, _t10;
1145
+ var userid, mobiusUrls, finalError, _iterator4, _step4, mobiusUrl, normalizedMobiusUrl, uri, _body$devices, response, body, _t9, _t0;
1199
1146
  return _regenerator.default.wrap(function (_context15) {
1200
1147
  while (1) switch (_context15.prev = _context15.next) {
1201
1148
  case 0:
@@ -1217,15 +1164,15 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1217
1164
  }
1218
1165
  throw new Error('Mobius URLs are not available');
1219
1166
  case 2:
1220
- _iterator5 = _createForOfIteratorHelper(mobiusUrls);
1167
+ _iterator4 = _createForOfIteratorHelper(mobiusUrls);
1221
1168
  _context15.prev = 3;
1222
- _iterator5.s();
1169
+ _iterator4.s();
1223
1170
  case 4:
1224
- if ((_step5 = _iterator5.n()).done) {
1171
+ if ((_step4 = _iterator4.n()).done) {
1225
1172
  _context15.next = 10;
1226
1173
  break;
1227
1174
  }
1228
- mobiusUrl = _step5.value;
1175
+ mobiusUrl = _step4.value;
1229
1176
  normalizedMobiusUrl = mobiusUrl.replace(/\/+$/, '/');
1230
1177
  uri = "".concat(normalizedMobiusUrl).concat(_constants2.DEVICES_ENDPOINT_RESOURCE, "?userid=").concat(encodeURIComponent(userid));
1231
1178
  _context15.prev = 5;
@@ -1250,8 +1197,8 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1250
1197
  return _context15.abrupt("return", (_body$devices = body.devices) !== null && _body$devices !== void 0 ? _body$devices : []);
1251
1198
  case 8:
1252
1199
  _context15.prev = 8;
1253
- _t1 = _context15["catch"](5);
1254
- finalError = _t1;
1200
+ _t9 = _context15["catch"](5);
1201
+ finalError = _t9;
1255
1202
  case 9:
1256
1203
  _context15.next = 4;
1257
1204
  break;
@@ -1260,11 +1207,11 @@ var CallingClient = exports.CallingClient = /*#__PURE__*/function (_Eventing) {
1260
1207
  break;
1261
1208
  case 11:
1262
1209
  _context15.prev = 11;
1263
- _t10 = _context15["catch"](3);
1264
- _iterator5.e(_t10);
1210
+ _t0 = _context15["catch"](3);
1211
+ _iterator4.e(_t0);
1265
1212
  case 12:
1266
1213
  _context15.prev = 12;
1267
- _iterator5.f();
1214
+ _iterator4.f();
1268
1215
  return _context15.finish(12);
1269
1216
  case 13:
1270
1217
  _Logger.default.error("Failed to fetch devices for userId ".concat(userId, ": ").concat((0, _stringify.default)(finalError)), {