@webex/calling 3.12.0-next.3 → 3.12.0-next.31

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 (194) hide show
  1. package/dist/CallingClient/CallingClient.js +463 -205
  2. package/dist/CallingClient/CallingClient.js.map +1 -1
  3. package/dist/CallingClient/CallingClient.test.js +170 -77
  4. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  5. package/dist/CallingClient/calling/call.js +32 -8
  6. package/dist/CallingClient/calling/call.js.map +1 -1
  7. package/dist/CallingClient/calling/call.test.js +581 -445
  8. package/dist/CallingClient/calling/call.test.js.map +1 -1
  9. package/dist/CallingClient/calling/callManager.js +53 -30
  10. package/dist/CallingClient/calling/callManager.js.map +1 -1
  11. package/dist/CallingClient/calling/callManager.test.js +35 -0
  12. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  13. package/dist/CallingClient/calling/types.js +2 -0
  14. package/dist/CallingClient/calling/types.js.map +1 -1
  15. package/dist/CallingClient/constants.js +24 -3
  16. package/dist/CallingClient/constants.js.map +1 -1
  17. package/dist/CallingClient/line/line.test.js +16 -1
  18. package/dist/CallingClient/line/line.test.js.map +1 -1
  19. package/dist/CallingClient/registration/register.js +694 -406
  20. package/dist/CallingClient/registration/register.js.map +1 -1
  21. package/dist/CallingClient/registration/register.test.js +202 -21
  22. package/dist/CallingClient/registration/register.test.js.map +1 -1
  23. package/dist/CallingClient/registration/types.js.map +1 -1
  24. package/dist/CallingClient/registration/webWorker.js +41 -104
  25. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  26. package/dist/CallingClient/registration/webWorker.test.js +39 -153
  27. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  28. package/dist/CallingClient/registration/webWorkerStr.js +1 -1
  29. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  30. package/dist/CallingClient/utils/constants.js +46 -0
  31. package/dist/CallingClient/utils/constants.js.map +1 -0
  32. package/dist/CallingClient/utils/index.js +63 -0
  33. package/dist/CallingClient/utils/index.js.map +1 -0
  34. package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
  35. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
  36. package/dist/CallingClient/utils/mobiusSocketMapper.test.js +211 -0
  37. package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
  38. package/dist/CallingClient/utils/request.js +349 -0
  39. package/dist/CallingClient/utils/request.js.map +1 -0
  40. package/dist/CallingClient/utils/request.test.js +881 -0
  41. package/dist/CallingClient/utils/request.test.js.map +1 -0
  42. package/dist/CallingClient/utils/types.js +7 -0
  43. package/dist/CallingClient/utils/types.js.map +1 -0
  44. package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
  45. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
  46. package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
  47. package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
  48. package/dist/Contacts/ContactsClient.test.js +3 -8
  49. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  50. package/dist/Events/types.js +1 -11
  51. package/dist/Events/types.js.map +1 -1
  52. package/dist/Metrics/index.js +60 -0
  53. package/dist/Metrics/index.js.map +1 -1
  54. package/dist/Metrics/index.test.js +356 -0
  55. package/dist/Metrics/index.test.js.map +1 -1
  56. package/dist/Metrics/types.js +11 -1
  57. package/dist/Metrics/types.js.map +1 -1
  58. package/dist/SDKConnector/types.js.map +1 -1
  59. package/dist/common/Utils.js +138 -44
  60. package/dist/common/Utils.js.map +1 -1
  61. package/dist/common/testUtil.js +8 -4
  62. package/dist/common/testUtil.js.map +1 -1
  63. package/dist/common/types.js +2 -0
  64. package/dist/common/types.js.map +1 -1
  65. package/dist/mobius-socket/config.js +24 -0
  66. package/dist/mobius-socket/config.js.map +1 -0
  67. package/dist/mobius-socket/errors.js +150 -0
  68. package/dist/mobius-socket/errors.js.map +1 -0
  69. package/dist/mobius-socket/index.js +57 -0
  70. package/dist/mobius-socket/index.js.map +1 -0
  71. package/dist/mobius-socket/mobius-socket-events.test.js +485 -0
  72. package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
  73. package/dist/mobius-socket/mobius-socket.js +804 -0
  74. package/dist/mobius-socket/mobius-socket.js.map +1 -0
  75. package/dist/mobius-socket/mobius-socket.test.js +1833 -0
  76. package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
  77. package/dist/mobius-socket/socket/constants.js +34 -0
  78. package/dist/mobius-socket/socket/constants.js.map +1 -0
  79. package/dist/mobius-socket/socket/index.js +15 -0
  80. package/dist/mobius-socket/socket/index.js.map +1 -0
  81. package/dist/mobius-socket/socket/socket-base.js +604 -0
  82. package/dist/mobius-socket/socket/socket-base.js.map +1 -0
  83. package/dist/mobius-socket/socket/socket.js +19 -0
  84. package/dist/mobius-socket/socket/socket.js.map +1 -0
  85. package/dist/mobius-socket/socket/socket.shim.js +26 -0
  86. package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
  87. package/dist/mobius-socket/socket/types.js +7 -0
  88. package/dist/mobius-socket/socket/types.js.map +1 -0
  89. package/dist/mobius-socket/socket.test.js +727 -0
  90. package/dist/mobius-socket/socket.test.js.map +1 -0
  91. package/dist/mobius-socket/test/mocha-helpers.js +23 -0
  92. package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
  93. package/dist/mobius-socket/test/promise-tick.js +28 -0
  94. package/dist/mobius-socket/test/promise-tick.js.map +1 -0
  95. package/dist/mobius-socket/types.js +7 -0
  96. package/dist/mobius-socket/types.js.map +1 -0
  97. package/dist/module/CallingClient/CallingClient.js +141 -10
  98. package/dist/module/CallingClient/calling/call.js +24 -6
  99. package/dist/module/CallingClient/calling/callManager.js +27 -7
  100. package/dist/module/CallingClient/calling/types.js +2 -0
  101. package/dist/module/CallingClient/constants.js +20 -0
  102. package/dist/module/CallingClient/registration/register.js +226 -62
  103. package/dist/module/CallingClient/registration/webWorker.js +42 -61
  104. package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
  105. package/dist/module/CallingClient/utils/constants.js +30 -0
  106. package/dist/module/CallingClient/utils/index.js +5 -0
  107. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
  108. package/dist/module/CallingClient/utils/request.js +162 -0
  109. package/dist/module/CallingClient/utils/types.js +1 -0
  110. package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
  111. package/dist/module/Events/types.js +0 -10
  112. package/dist/module/Metrics/index.js +46 -0
  113. package/dist/module/Metrics/types.js +10 -0
  114. package/dist/module/common/Utils.js +52 -12
  115. package/dist/module/common/testUtil.js +5 -1
  116. package/dist/module/common/types.js +2 -0
  117. package/dist/module/mobius-socket/config.js +15 -0
  118. package/dist/module/mobius-socket/errors.js +64 -0
  119. package/dist/module/mobius-socket/index.js +24 -0
  120. package/dist/module/mobius-socket/mobius-socket.js +571 -0
  121. package/dist/module/mobius-socket/socket/constants.js +10 -0
  122. package/dist/module/mobius-socket/socket/index.js +4 -0
  123. package/dist/module/mobius-socket/socket/socket-base.js +368 -0
  124. package/dist/module/mobius-socket/socket/socket.js +9 -0
  125. package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
  126. package/dist/module/mobius-socket/socket/types.js +1 -0
  127. package/dist/module/mobius-socket/types.js +1 -0
  128. package/dist/types/CallingClient/CallingClient.d.ts +7 -0
  129. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  130. package/dist/types/CallingClient/calling/call.d.ts +2 -0
  131. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  132. package/dist/types/CallingClient/calling/callManager.d.ts +3 -2
  133. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  134. package/dist/types/CallingClient/calling/types.d.ts +21 -9
  135. package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
  136. package/dist/types/CallingClient/constants.d.ts +20 -0
  137. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  138. package/dist/types/CallingClient/registration/register.d.ts +6 -0
  139. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  140. package/dist/types/CallingClient/registration/types.d.ts +3 -1
  141. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  142. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  143. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  144. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  145. package/dist/types/CallingClient/utils/constants.d.ts +30 -0
  146. package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
  147. package/dist/types/CallingClient/utils/index.d.ts +6 -0
  148. package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
  149. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
  150. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
  151. package/dist/types/CallingClient/utils/request.d.ts +23 -0
  152. package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
  153. package/dist/types/CallingClient/utils/types.d.ts +29 -0
  154. package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
  155. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
  156. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
  157. package/dist/types/Events/types.d.ts +0 -10
  158. package/dist/types/Events/types.d.ts.map +1 -1
  159. package/dist/types/Metrics/index.d.ts.map +1 -1
  160. package/dist/types/Metrics/types.d.ts +11 -1
  161. package/dist/types/Metrics/types.d.ts.map +1 -1
  162. package/dist/types/SDKConnector/types.d.ts +24 -0
  163. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  164. package/dist/types/common/Utils.d.ts +9 -2
  165. package/dist/types/common/Utils.d.ts.map +1 -1
  166. package/dist/types/common/testUtil.d.ts +4 -1
  167. package/dist/types/common/testUtil.d.ts.map +1 -1
  168. package/dist/types/common/types.d.ts +3 -0
  169. package/dist/types/common/types.d.ts.map +1 -1
  170. package/dist/types/mobius-socket/config.d.ts +17 -0
  171. package/dist/types/mobius-socket/config.d.ts.map +1 -0
  172. package/dist/types/mobius-socket/errors.d.ts +32 -0
  173. package/dist/types/mobius-socket/errors.d.ts.map +1 -0
  174. package/dist/types/mobius-socket/index.d.ts +14 -0
  175. package/dist/types/mobius-socket/index.d.ts.map +1 -0
  176. package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
  177. package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
  178. package/dist/types/mobius-socket/socket/constants.d.ts +11 -0
  179. package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
  180. package/dist/types/mobius-socket/socket/index.d.ts +5 -0
  181. package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
  182. package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
  183. package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
  184. package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
  185. package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
  186. package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
  187. package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
  188. package/dist/types/mobius-socket/socket/types.d.ts +61 -0
  189. package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
  190. package/dist/types/mobius-socket/types.d.ts +21 -0
  191. package/dist/types/mobius-socket/types.d.ts.map +1 -0
  192. package/package.json +20 -5
  193. package/src/mobius-socket/socket/socket.shim.ts +22 -0
  194. package/src/mobius-socket/socket/socket.ts +14 -0
@@ -36,9 +36,20 @@ var _registerFixtures = require("./registration/registerFixtures");
36
36
  var _constants2 = require("../common/constants");
37
37
  var _types4 = require("../Metrics/types");
38
38
  var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
39
- 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 _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
39
+ var _request = require("./utils/request");
40
+ 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 _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
40
41
  function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
41
42
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable dot-notation */
43
+ jest.mock('../mobius-socket', function () {
44
+ return {
45
+ getMobiusSocketInstance: jest.fn().mockReturnValue({
46
+ sendWssRequest: jest.fn(),
47
+ connect: jest.fn(),
48
+ on: jest.fn(),
49
+ off: jest.fn()
50
+ })
51
+ };
52
+ });
42
53
  global.crypto = {
43
54
  randomUUID: function randomUUID() {
44
55
  return '12345678-1234-5678-1234-567812345678';
@@ -64,6 +75,12 @@ describe('CallingClient Tests', function () {
64
75
  originalProcessNextTick(resolve);
65
76
  });
66
77
  }
78
+ beforeEach(function () {
79
+ _request.APIRequest.resetInstance();
80
+ _request.APIRequest.getInstance({
81
+ webex: webex
82
+ });
83
+ });
67
84
  describe('CallingClient pick Mobius cluster using Service Host Tests', function () {
68
85
  afterAll(function () {
69
86
  callManager.removeAllListeners();
@@ -316,81 +333,80 @@ describe('CallingClient Tests', function () {
316
333
  }
317
334
  }, _callee0);
318
335
  })));
319
-
320
- /**
321
- * Input sdk config to callingClient with serviceData carrying valid value for indicator
322
- * 'contactcenter', but an empty string for domain field in it.
323
- *
324
- * It should throw error and abort execution as domain value is invalid.
325
- *
326
- * DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
327
- */
328
- it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
329
- var serviceDataObj, _t3;
336
+ it('ContactCenter: uses config domain and does not fetch RTMS domain from catalog', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
337
+ var serviceDataObj;
330
338
  return _regenerator.default.wrap(function (_context1) {
331
339
  while (1) switch (_context1.prev = _context1.next) {
332
340
  case 0:
333
341
  serviceDataObj = {
334
342
  indicator: _types2.ServiceIndicator.CONTACT_CENTER,
335
- domain: ''
343
+ domain: 'test.example.com'
336
344
  };
337
- _context1.prev = 1;
338
- _context1.next = 2;
345
+ webex.internal.services.get = jest.fn();
346
+ _context1.next = 1;
339
347
  return (0, _CallingClient.createClient)(webex, {
340
348
  serviceData: serviceDataObj
341
349
  });
342
- case 2:
350
+ case 1:
343
351
  callingClient = _context1.sent;
344
- _context1.next = 4;
345
- break;
346
- case 3:
347
- _context1.prev = 3;
348
- _t3 = _context1["catch"](1);
349
- expect(_t3.message).toEqual('Invalid service domain.');
350
- case 4:
351
- expect.assertions(1);
352
- case 5:
352
+ expect(callingClient).toBeTruthy();
353
+ expect(webex.internal.services.get).not.toHaveBeenCalled();
354
+ case 2:
353
355
  case "end":
354
356
  return _context1.stop();
355
357
  }
356
- }, _callee1, null, [[1, 3]]);
358
+ }, _callee1);
357
359
  })));
358
360
 
359
361
  /**
360
362
  * Input sdk config to callingClient with serviceData carrying valid value for indicator
361
363
  * 'contactcenter' , and a valid domain type string for domain field in it.
362
- *
363
- * Execution should proceed properly and createRegistration should be called with same serviceData.
364
- *
365
- * DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
366
364
  */
367
- it('ContactCenter: verify valid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
365
+ it('ContactCenter: fetches RTMS domain from catalog when config domain is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
368
366
  var serviceDataObj;
367
+ return _regenerator.default.wrap(function (_context10) {
368
+ while (1) switch (_context10.prev = _context10.next) {
369
+ case 0:
370
+ serviceDataObj = {
371
+ indicator: _types2.ServiceIndicator.CONTACT_CENTER,
372
+ domain: ''
373
+ };
374
+ webex.internal.services.get = jest.fn().mockReturnValue('https://cc-rtms.example.com/calling/web/rtms');
375
+ _context10.next = 1;
376
+ return (0, _CallingClient.createClient)(webex, {
377
+ serviceData: serviceDataObj
378
+ });
379
+ case 1:
380
+ callingClient = _context10.sent;
381
+ expect(callingClient).toBeTruthy();
382
+ expect(webex.internal.services.get).toHaveBeenCalledWith('wcc-calling-rtms-domain');
383
+ case 2:
384
+ case "end":
385
+ return _context10.stop();
386
+ }
387
+ }, _callee10);
388
+ })));
389
+ it('ContactCenter: init fails when config domain is empty and catalog fetch fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
390
+ var serviceDataObj, createLineSpy;
369
391
  return _regenerator.default.wrap(function (_context11) {
370
392
  while (1) switch (_context11.prev = _context11.next) {
371
393
  case 0:
372
394
  serviceDataObj = {
373
395
  indicator: _types2.ServiceIndicator.CONTACT_CENTER,
374
- domain: 'test.example.com'
396
+ domain: ''
375
397
  };
376
- expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
377
- return _regenerator.default.wrap(function (_context10) {
378
- while (1) switch (_context10.prev = _context10.next) {
379
- case 0:
380
- _context10.next = 1;
381
- return (0, _CallingClient.createClient)(webex, {
382
- serviceData: serviceDataObj
383
- });
384
- case 1:
385
- callingClient = _context10.sent;
386
- expect(callingClient).toBeTruthy();
387
- case 2:
388
- case "end":
389
- return _context10.stop();
390
- }
391
- }, _callee10);
392
- }))).not.toThrow(Error);
398
+ createLineSpy = jest.spyOn(_CallingClient.CallingClient.prototype, 'createLine');
399
+ webex.internal.services.get = jest.fn(function () {
400
+ throw new Error('catalog unavailable');
401
+ });
402
+ _context11.next = 1;
403
+ return expect((0, _CallingClient.createClient)(webex, {
404
+ serviceData: serviceDataObj
405
+ })).rejects.toThrow('Invalid service domain.');
393
406
  case 1:
407
+ expect(createLineSpy).not.toHaveBeenCalled();
408
+ createLineSpy.mockRestore();
409
+ case 2:
394
410
  case "end":
395
411
  return _context11.stop();
396
412
  }
@@ -566,12 +582,12 @@ describe('CallingClient Tests', function () {
566
582
  }();
567
583
  it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
568
584
  var _ref17 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(clusterName) {
569
- var _t4;
585
+ var _t3;
570
586
  return _regenerator.default.wrap(function (_context17) {
571
587
  while (1) switch (_context17.prev = _context17.next) {
572
588
  case 0:
573
- _t4 = clusterName;
574
- _context17.next = _t4 === 'mobius-eu-central-1.prod.infra.webex.com' ? 1 : _t4 === 'mobius-us-east-1.int.infra.webex.com' ? 2 : _t4 === 'mobius-eu-central-1.int.infra.webex.com' ? 3 : 4;
589
+ _t3 = clusterName;
590
+ _context17.next = _t3 === 'mobius-eu-central-1.prod.infra.webex.com' ? 1 : _t3 === 'mobius-us-east-1.int.infra.webex.com' ? 2 : _t3 === 'mobius-eu-central-1.int.infra.webex.com' ? 3 : 4;
575
591
  break;
576
592
  case 1:
577
593
  checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
@@ -1061,14 +1077,25 @@ describe('CallingClient Tests', function () {
1061
1077
  callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
1062
1078
  });
1063
1079
  });
1064
- describe('getDevices', function () {
1080
+ describe('Mobius async_event routing', function () {
1065
1081
  var callingClient;
1066
- var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
1067
- var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
1082
+ var asyncEventCallback;
1083
+ var mobiusSocketMock;
1068
1084
  beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
1085
+ var asyncEventOnCall;
1069
1086
  return _regenerator.default.wrap(function (_context30) {
1070
1087
  while (1) switch (_context30.prev = _context30.next) {
1071
1088
  case 0:
1089
+ webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
1090
+ value: true
1091
+ });
1092
+ _request.APIRequest.resetInstance();
1093
+ _request.APIRequest.getInstance({
1094
+ webex: webex
1095
+ });
1096
+ mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
1097
+ mobiusSocketMock.on.mockClear();
1098
+ mobiusSocketMock.off.mockClear();
1072
1099
  _context30.next = 1;
1073
1100
  return (0, _CallingClient.createClient)(webex, {
1074
1101
  logger: {
@@ -1077,9 +1104,10 @@ describe('CallingClient Tests', function () {
1077
1104
  });
1078
1105
  case 1:
1079
1106
  callingClient = _context30.sent;
1080
- callingClient.primaryMobiusUris = [primaryMobius];
1081
- callingClient.backupMobiusUris = [backupMobius];
1082
- webex.request.mockClear();
1107
+ asyncEventOnCall = mobiusSocketMock.on.mock.calls.find(function (call) {
1108
+ return call[0] === 'event:async_event';
1109
+ });
1110
+ asyncEventCallback = asyncEventOnCall[1];
1083
1111
  case 2:
1084
1112
  case "end":
1085
1113
  return _context30.stop();
@@ -1088,11 +1116,76 @@ describe('CallingClient Tests', function () {
1088
1116
  })));
1089
1117
  afterEach(function () {
1090
1118
  callingClient.removeAllListeners();
1119
+ callManager.removeAllListeners();
1120
+ webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
1121
+ value: false
1122
+ });
1091
1123
  });
1092
- it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1093
- var devices, responsePayload, response;
1124
+ it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
1125
+ var callEventSpy;
1094
1126
  return _regenerator.default.wrap(function (_context31) {
1095
1127
  while (1) switch (_context31.prev = _context31.next) {
1128
+ case 0:
1129
+ callEventSpy = jest.spyOn(callingClient['callManager'], 'dequeueWsEvents').mockImplementation(function () {
1130
+ return undefined;
1131
+ });
1132
+ _context31.next = 1;
1133
+ return asyncEventCallback({
1134
+ type: 'async_event',
1135
+ data: {
1136
+ eventType: 'mobius.call',
1137
+ callId: 'fcf86aa5-5539-4c9f-8b72-667786ae9b6c',
1138
+ callUrl: 'https://mobius-a.wbx2.com/api/v1/calling/web/devices/d1/calls/c1',
1139
+ deviceId: 'd1',
1140
+ correlationId: 'corr-1'
1141
+ }
1142
+ });
1143
+ case 1:
1144
+ expect(callEventSpy).toHaveBeenCalledWith(expect.objectContaining({
1145
+ type: 'async_event',
1146
+ data: expect.objectContaining({
1147
+ eventType: 'mobius.call'
1148
+ })
1149
+ }));
1150
+ case 2:
1151
+ case "end":
1152
+ return _context31.stop();
1153
+ }
1154
+ }, _callee31);
1155
+ })));
1156
+ });
1157
+ describe('getDevices', function () {
1158
+ var callingClient;
1159
+ var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
1160
+ var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
1161
+ beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1162
+ return _regenerator.default.wrap(function (_context32) {
1163
+ while (1) switch (_context32.prev = _context32.next) {
1164
+ case 0:
1165
+ _context32.next = 1;
1166
+ return (0, _CallingClient.createClient)(webex, {
1167
+ logger: {
1168
+ level: _types.LOGGER.INFO
1169
+ }
1170
+ });
1171
+ case 1:
1172
+ callingClient = _context32.sent;
1173
+ callingClient.primaryMobiusUris = [primaryMobius];
1174
+ callingClient.backupMobiusUris = [backupMobius];
1175
+ webex.request.mockClear();
1176
+ case 2:
1177
+ case "end":
1178
+ return _context32.stop();
1179
+ }
1180
+ }, _callee32);
1181
+ })));
1182
+ afterEach(function () {
1183
+ callingClient.removeAllListeners();
1184
+ });
1185
+ it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1186
+ var devices, responsePayload, response;
1187
+ return _regenerator.default.wrap(function (_context33) {
1188
+ while (1) switch (_context33.prev = _context33.next) {
1096
1189
  case 0:
1097
1190
  devices = [{
1098
1191
  deviceId: 'device-1',
@@ -1110,10 +1203,10 @@ describe('CallingClient Tests', function () {
1110
1203
  }
1111
1204
  };
1112
1205
  webex.request.mockResolvedValue(responsePayload);
1113
- _context31.next = 1;
1206
+ _context33.next = 1;
1114
1207
  return callingClient.getDevices('user-123');
1115
1208
  case 1:
1116
- response = _context31.sent;
1209
+ response = _context33.sent;
1117
1210
  expect(webex.request).toHaveBeenCalledWith({
1118
1211
  uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
1119
1212
  method: _types2.HTTP_METHODS.GET,
@@ -1123,14 +1216,14 @@ describe('CallingClient Tests', function () {
1123
1216
  expect(response).toEqual(devices);
1124
1217
  case 2:
1125
1218
  case "end":
1126
- return _context31.stop();
1219
+ return _context33.stop();
1127
1220
  }
1128
- }, _callee31);
1221
+ }, _callee33);
1129
1222
  })));
1130
- it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
1223
+ it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
1131
1224
  var devices, failurePayload, responsePayload, response, requestCalls;
1132
- return _regenerator.default.wrap(function (_context32) {
1133
- while (1) switch (_context32.prev = _context32.next) {
1225
+ return _regenerator.default.wrap(function (_context34) {
1226
+ while (1) switch (_context34.prev = _context34.next) {
1134
1227
  case 0:
1135
1228
  devices = [{
1136
1229
  deviceId: 'device-2',
@@ -1151,10 +1244,10 @@ describe('CallingClient Tests', function () {
1151
1244
  }
1152
1245
  };
1153
1246
  webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
1154
- _context32.next = 1;
1247
+ _context34.next = 1;
1155
1248
  return callingClient.getDevices('user-123');
1156
1249
  case 1:
1157
- response = _context32.sent;
1250
+ response = _context34.sent;
1158
1251
  requestCalls = webex.request.mock.calls;
1159
1252
  expect(requestCalls[0][0]).toEqual({
1160
1253
  uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
@@ -1171,9 +1264,9 @@ describe('CallingClient Tests', function () {
1171
1264
  expect(response).toEqual(devices);
1172
1265
  case 2:
1173
1266
  case "end":
1174
- return _context32.stop();
1267
+ return _context34.stop();
1175
1268
  }
1176
- }, _callee32);
1269
+ }, _callee34);
1177
1270
  })));
1178
1271
  });
1179
1272
  describe('windowsChromiumIceWarmup', function () {
@@ -1249,17 +1342,17 @@ describe('CallingClient Tests', function () {
1249
1342
  afterAll(function () {
1250
1343
  global.RTCPeerConnection = origRTCPeerConnection;
1251
1344
  });
1252
- it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
1253
- return _regenerator.default.wrap(function (_context33) {
1254
- while (1) switch (_context33.prev = _context33.next) {
1345
+ it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
1346
+ return _regenerator.default.wrap(function (_context35) {
1347
+ while (1) switch (_context35.prev = _context35.next) {
1255
1348
  case 0:
1256
- _context33.next = 1;
1349
+ _context35.next = 1;
1257
1350
  return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
1258
1351
  case 1:
1259
1352
  case "end":
1260
- return _context33.stop();
1353
+ return _context35.stop();
1261
1354
  }
1262
- }, _callee33);
1355
+ }, _callee35);
1263
1356
  })));
1264
1357
  });
1265
1358
  });