@webex/calling 3.8.1-web-workers-keepalive.2 → 3.9.0

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 (35) hide show
  1. package/dist/CallSettings/WxCallBackendConnector.js +2 -2
  2. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  3. package/dist/CallSettings/WxCallBackendConnector.test.js +94 -27
  4. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  5. package/dist/CallSettings/types.js.map +1 -1
  6. package/dist/CallingClient/CallingClient.js +56 -21
  7. package/dist/CallingClient/CallingClient.js.map +1 -1
  8. package/dist/CallingClient/CallingClient.test.js +162 -98
  9. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  10. package/dist/CallingClient/constants.js +3 -4
  11. package/dist/CallingClient/constants.js.map +1 -1
  12. package/dist/CallingClient/registration/register.js +278 -198
  13. package/dist/CallingClient/registration/register.js.map +1 -1
  14. package/dist/CallingClient/registration/register.test.js +168 -85
  15. package/dist/CallingClient/registration/register.test.js.map +1 -1
  16. package/dist/CallingClient/registration/types.js.map +1 -1
  17. package/dist/common/Utils.js +13 -7
  18. package/dist/common/Utils.js.map +1 -1
  19. package/dist/common/Utils.test.js +265 -119
  20. package/dist/common/Utils.test.js.map +1 -1
  21. package/dist/module/CallSettings/WxCallBackendConnector.js +1 -1
  22. package/dist/module/CallingClient/CallingClient.js +23 -8
  23. package/dist/module/CallingClient/constants.js +1 -2
  24. package/dist/module/CallingClient/registration/register.js +39 -6
  25. package/dist/module/common/Utils.js +8 -1
  26. package/dist/types/CallSettings/types.d.ts +1 -1
  27. package/dist/types/CallSettings/types.d.ts.map +1 -1
  28. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  29. package/dist/types/CallingClient/constants.d.ts +1 -2
  30. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  31. package/dist/types/CallingClient/registration/register.d.ts +1 -0
  32. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  33. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  34. package/dist/types/common/Utils.d.ts.map +1 -1
  35. package/package.json +4 -5
@@ -5,11 +5,12 @@ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/obje
5
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
6
6
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
7
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
8
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
8
+ var _Object$defineProperty2 = require("@babel/runtime-corejs2/core-js/object/define-property");
9
9
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
13
+ var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-property"));
13
14
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
14
15
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
15
16
  var _calling = require("../CallingClient/calling");
@@ -25,7 +26,16 @@ var _constants2 = require("./constants");
25
26
  var _types3 = require("../Events/types");
26
27
  var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
27
28
  function ownKeys(e, r) { var t = _Object$keys(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; }
28
- 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 no-underscore-dangle */
29
+ 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$defineProperty2(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable no-underscore-dangle */
30
+ // Mock crypto for Node.js test environment
31
+ (0, _defineProperty3.default)(global, 'crypto', {
32
+ value: {
33
+ randomUUID: jest.fn(function () {
34
+ return 'mocked-uuid-12345';
35
+ })
36
+ },
37
+ writable: true
38
+ });
29
39
  var mockSubmitRegistrationMetric = jest.fn();
30
40
  var mockEmitterCb = jest.fn();
31
41
  var mockRestoreCb = jest.fn();
@@ -270,6 +280,142 @@ describe('Registration Tests', function () {
270
280
  expect(logSpy).toHaveBeenCalledWith(codeObj.logMsg, logObj);
271
281
  });
272
282
  });
283
+ describe('CallingClient Error Tests', function () {
284
+ var logSpy = jest.spyOn(_Logger.default, 'warn');
285
+ var logObj = {
286
+ file: 'CallingClient',
287
+ method: 'handleCallingClientErrors'
288
+ };
289
+ beforeEach(function () {
290
+ jest.clearAllMocks();
291
+ });
292
+ it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
293
+ var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
294
+ return _regenerator.default.wrap(function _callee$(_context) {
295
+ while (1) switch (_context.prev = _context.next) {
296
+ case 0:
297
+ statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
298
+ message = 'User is unauthorized due to an expired token.';
299
+ errorType = _types2.ERROR_TYPE.TOKEN_ERROR;
300
+ finalError = true;
301
+ webexPayload = {
302
+ statusCode: statusCode,
303
+ headers: {
304
+ trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
305
+ },
306
+ body: {
307
+ device: {
308
+ deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
309
+ },
310
+ userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
311
+ errorCode: 0
312
+ }
313
+ };
314
+ mockErrorEvent = {
315
+ type: errorType,
316
+ message: message,
317
+ context: logObj
318
+ };
319
+ callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
320
+ _context.next = 9;
321
+ return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
322
+ case 9:
323
+ result = _context.sent;
324
+ expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
325
+ expect(result).toBe(finalError);
326
+ expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
327
+ expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
328
+ case 14:
329
+ case "end":
330
+ return _context.stop();
331
+ }
332
+ }, _callee);
333
+ })));
334
+ it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
335
+ var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
336
+ return _regenerator.default.wrap(function _callee2$(_context2) {
337
+ while (1) switch (_context2.prev = _context2.next) {
338
+ case 0:
339
+ statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
340
+ message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
341
+ errorType = _types2.ERROR_TYPE.SERVICE_UNAVAILABLE;
342
+ finalError = false;
343
+ webexPayload = {
344
+ statusCode: statusCode,
345
+ headers: {
346
+ trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
347
+ },
348
+ body: {
349
+ device: {
350
+ deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
351
+ },
352
+ userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
353
+ errorCode: 0
354
+ }
355
+ };
356
+ mockErrorEvent = {
357
+ type: errorType,
358
+ message: message,
359
+ context: logObj
360
+ };
361
+ callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
362
+ _context2.next = 9;
363
+ return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
364
+ case 9:
365
+ result = _context2.sent;
366
+ expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
367
+ expect(result).toBe(finalError);
368
+ expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
369
+ expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
370
+ case 14:
371
+ case "end":
372
+ return _context2.stop();
373
+ }
374
+ }, _callee2);
375
+ })));
376
+ it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
377
+ var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
378
+ return _regenerator.default.wrap(function _callee3$(_context3) {
379
+ while (1) switch (_context3.prev = _context3.next) {
380
+ case 0:
381
+ statusCode = 206;
382
+ message = 'Unknown error';
383
+ errorType = _types2.ERROR_TYPE.DEFAULT;
384
+ finalError = false;
385
+ webexPayload = {
386
+ statusCode: statusCode,
387
+ headers: {
388
+ trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
389
+ },
390
+ body: {
391
+ device: {
392
+ deviceId: '8a67806f-fc4d-446b-a131-31e71ea5b010'
393
+ },
394
+ userId: '8a67806f-fc4d-446b-a131-31e71ea5b0e9',
395
+ errorCode: 0
396
+ }
397
+ };
398
+ mockErrorEvent = {
399
+ type: errorType,
400
+ message: message,
401
+ context: logObj
402
+ };
403
+ callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
404
+ _context3.next = 9;
405
+ return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
406
+ case 9:
407
+ result = _context3.sent;
408
+ expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
409
+ expect(result).toBe(finalError);
410
+ expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
411
+ expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
412
+ case 14:
413
+ case "end":
414
+ return _context3.stop();
415
+ }
416
+ }, _callee3);
417
+ })));
418
+ });
273
419
  describe('Call Tests', function () {
274
420
  /* Error flows tests starts */
275
421
  var logSpy = jest.spyOn(_Logger.default, 'warn');
@@ -815,11 +961,11 @@ describe('resolveContact tests', function () {
815
961
  }));
816
962
  });
817
963
  });
818
- it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
964
+ it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
819
965
  var _callingPartyInfo$use2;
820
966
  var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
821
- return _regenerator.default.wrap(function _callee$(_context) {
822
- while (1) switch (_context.prev = _context.next) {
967
+ return _regenerator.default.wrap(function _callee4$(_context4) {
968
+ while (1) switch (_context4.prev = _context4.next) {
823
969
  case 0:
824
970
  callingPartyInfo = {};
825
971
  warnSpy = jest.spyOn(_Logger.default, 'warn');
@@ -829,10 +975,10 @@ describe('resolveContact tests', function () {
829
975
  callingPartyInfo.userExternalId = {
830
976
  $: 'userExternalId'
831
977
  };
832
- _context.next = 6;
978
+ _context4.next = 6;
833
979
  return (0, _Utils.resolveContact)(callingPartyInfo);
834
980
  case 6:
835
- displayInfo = _context.sent;
981
+ displayInfo = _context4.sent;
836
982
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
837
983
  expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
838
984
  file: 'utils',
@@ -844,15 +990,15 @@ describe('resolveContact tests', function () {
844
990
  }));
845
991
  case 11:
846
992
  case "end":
847
- return _context.stop();
993
+ return _context4.stop();
848
994
  }
849
- }, _callee);
995
+ }, _callee4);
850
996
  })));
851
- it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
997
+ it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
852
998
  var _callingPartyInfo$use3;
853
999
  var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
854
- return _regenerator.default.wrap(function _callee2$(_context2) {
855
- while (1) switch (_context2.prev = _context2.next) {
1000
+ return _regenerator.default.wrap(function _callee5$(_context5) {
1001
+ while (1) switch (_context5.prev = _context5.next) {
856
1002
  case 0:
857
1003
  callingPartyInfo = {};
858
1004
  scimResponse = (0, _testUtil.getSampleScimResponse)();
@@ -864,10 +1010,10 @@ describe('resolveContact tests', function () {
864
1010
  callingPartyInfo.userExternalId = {
865
1011
  $: 'userExternalId'
866
1012
  };
867
- _context2.next = 7;
1013
+ _context5.next = 7;
868
1014
  return (0, _Utils.resolveContact)(callingPartyInfo);
869
1015
  case 7:
870
- displayInfo = _context2.sent;
1016
+ displayInfo = _context5.sent;
871
1017
  query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
872
1018
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
873
1019
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
@@ -876,15 +1022,15 @@ describe('resolveContact tests', function () {
876
1022
  scimResponse.totalResults = '1';
877
1023
  case 12:
878
1024
  case "end":
879
- return _context2.stop();
1025
+ return _context5.stop();
880
1026
  }
881
- }, _callee2);
1027
+ }, _callee5);
882
1028
  })));
883
- it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
1029
+ it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
884
1030
  var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
885
1031
  var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
886
- return _regenerator.default.wrap(function _callee3$(_context3) {
887
- while (1) switch (_context3.prev = _context3.next) {
1032
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1033
+ while (1) switch (_context6.prev = _context6.next) {
888
1034
  case 0:
889
1035
  callingPartyInfo = {};
890
1036
  scimResponse = (0, _testUtil.getSampleScimResponse)();
@@ -896,10 +1042,10 @@ describe('resolveContact tests', function () {
896
1042
  callingPartyInfo.userExternalId = {
897
1043
  $: 'userExternalId'
898
1044
  };
899
- _context3.next = 7;
1045
+ _context6.next = 7;
900
1046
  return (0, _Utils.resolveContact)(callingPartyInfo);
901
1047
  case 7:
902
- displayInfo = _context3.sent;
1048
+ displayInfo = _context6.sent;
903
1049
  query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
904
1050
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
905
1051
  uri: query
@@ -915,10 +1061,10 @@ describe('resolveContact tests', function () {
915
1061
  statusCode: 200,
916
1062
  body: scimResponse
917
1063
  });
918
- _context3.next = 18;
1064
+ _context6.next = 18;
919
1065
  return (0, _Utils.resolveContact)(callingPartyInfo);
920
1066
  case 18:
921
- displayInfo = _context3.sent;
1067
+ displayInfo = _context6.sent;
922
1068
  expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
923
1069
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
924
1070
  uri: query
@@ -926,9 +1072,9 @@ describe('resolveContact tests', function () {
926
1072
  scimResponse.Resources[0].phoneNumbers = phoneNumbers;
927
1073
  case 22:
928
1074
  case "end":
929
- return _context3.stop();
1075
+ return _context6.stop();
930
1076
  }
931
- }, _callee3);
1077
+ }, _callee6);
932
1078
  })));
933
1079
  it('Resolve by userExternalId - no photo', function () {
934
1080
  var callingPartyInfo = {};
@@ -993,10 +1139,10 @@ describe('resolveContact tests', function () {
993
1139
  }));
994
1140
  });
995
1141
  });
996
- it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
1142
+ it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
997
1143
  var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
998
- return _regenerator.default.wrap(function _callee4$(_context4) {
999
- while (1) switch (_context4.prev = _context4.next) {
1144
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1145
+ while (1) switch (_context7.prev = _context7.next) {
1000
1146
  case 0:
1001
1147
  callingPartyInfo = {};
1002
1148
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1006,10 +1152,10 @@ describe('resolveContact tests', function () {
1006
1152
  callingPartyInfo.name = {
1007
1153
  $: 'Name'
1008
1154
  };
1009
- _context4.next = 8;
1155
+ _context7.next = 8;
1010
1156
  return (0, _Utils.resolveContact)(callingPartyInfo);
1011
1157
  case 8:
1012
- displayInfo = _context4.sent;
1158
+ displayInfo = _context7.sent;
1013
1159
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
1014
1160
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1015
1161
  displayName: 'Name'
@@ -1017,15 +1163,15 @@ describe('resolveContact tests', function () {
1017
1163
  peopleListResponse.items = items;
1018
1164
  case 12:
1019
1165
  case "end":
1020
- return _context4.stop();
1166
+ return _context7.stop();
1021
1167
  }
1022
- }, _callee4);
1168
+ }, _callee7);
1023
1169
  })));
1024
- it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
1170
+ it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1025
1171
  var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
1026
1172
  var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
1027
- return _regenerator.default.wrap(function _callee5$(_context5) {
1028
- while (1) switch (_context5.prev = _context5.next) {
1173
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1174
+ while (1) switch (_context8.prev = _context8.next) {
1029
1175
  case 0:
1030
1176
  callingPartyInfo = {};
1031
1177
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1036,10 +1182,10 @@ describe('resolveContact tests', function () {
1036
1182
  callingPartyInfo.name = {
1037
1183
  $: 'Name'
1038
1184
  };
1039
- _context5.next = 8;
1185
+ _context8.next = 8;
1040
1186
  return (0, _Utils.resolveContact)(callingPartyInfo);
1041
1187
  case 8:
1042
- displayInfo = _context5.sent;
1188
+ displayInfo = _context8.sent;
1043
1189
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1044
1190
  displayName: 'Name'
1045
1191
  }));
@@ -1052,10 +1198,10 @@ describe('resolveContact tests', function () {
1052
1198
  /* Also test empty id */
1053
1199
  peopleListResponse.items[0].id = '';
1054
1200
  webex.people.list.mockResolvedValueOnce(peopleListResponse);
1055
- _context5.next = 19;
1201
+ _context8.next = 19;
1056
1202
  return (0, _Utils.resolveContact)(callingPartyInfo);
1057
1203
  case 19:
1058
- displayInfo = _context5.sent;
1204
+ displayInfo = _context8.sent;
1059
1205
  expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
1060
1206
  expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
1061
1207
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
@@ -1064,14 +1210,14 @@ describe('resolveContact tests', function () {
1064
1210
  peopleListResponse.items[0].id = id;
1065
1211
  case 24:
1066
1212
  case "end":
1067
- return _context5.stop();
1213
+ return _context8.stop();
1068
1214
  }
1069
- }, _callee5);
1215
+ }, _callee8);
1070
1216
  })));
1071
- it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1217
+ it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1072
1218
  var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
1073
- return _regenerator.default.wrap(function _callee6$(_context6) {
1074
- while (1) switch (_context6.prev = _context6.next) {
1219
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1220
+ while (1) switch (_context9.prev = _context9.next) {
1075
1221
  case 0:
1076
1222
  callingPartyInfo = {};
1077
1223
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1082,10 +1228,10 @@ describe('resolveContact tests', function () {
1082
1228
  callingPartyInfo.name = {
1083
1229
  $: 'Name'
1084
1230
  };
1085
- _context6.next = 9;
1231
+ _context9.next = 9;
1086
1232
  return (0, _Utils.resolveContact)(callingPartyInfo);
1087
1233
  case 9:
1088
- displayInfo = _context6.sent;
1234
+ displayInfo = _context9.sent;
1089
1235
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
1090
1236
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
1091
1237
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
@@ -1095,14 +1241,14 @@ describe('resolveContact tests', function () {
1095
1241
  peopleListResponse.items[0].phoneNumbers = phoneNumbers;
1096
1242
  case 15:
1097
1243
  case "end":
1098
- return _context6.stop();
1244
+ return _context9.stop();
1099
1245
  }
1100
- }, _callee6);
1246
+ }, _callee9);
1101
1247
  })));
1102
- it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
1248
+ it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1103
1249
  var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
1104
- return _regenerator.default.wrap(function _callee7$(_context7) {
1105
- while (1) switch (_context7.prev = _context7.next) {
1250
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1251
+ while (1) switch (_context10.prev = _context10.next) {
1106
1252
  case 0:
1107
1253
  callingPartyInfo = {};
1108
1254
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1112,10 +1258,10 @@ describe('resolveContact tests', function () {
1112
1258
  callingPartyInfo.name = {
1113
1259
  $: 'Name'
1114
1260
  };
1115
- _context7.next = 8;
1261
+ _context10.next = 8;
1116
1262
  return (0, _Utils.resolveContact)(callingPartyInfo);
1117
1263
  case 8:
1118
- displayInfo = _context7.sent;
1264
+ displayInfo = _context10.sent;
1119
1265
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1120
1266
  displayName: 'Name'
1121
1267
  }));
@@ -1125,9 +1271,9 @@ describe('resolveContact tests', function () {
1125
1271
  peopleListResponse.items[0].phoneNumbers = phoneNumbers;
1126
1272
  case 14:
1127
1273
  case "end":
1128
- return _context7.stop();
1274
+ return _context10.stop();
1129
1275
  }
1130
- }, _callee7);
1276
+ }, _callee10);
1131
1277
  })));
1132
1278
  });
1133
1279
  describe('Store and Fetch voicemail tests', function () {
@@ -1245,40 +1391,40 @@ describe('Infer id from UUID Tests', function () {
1245
1391
  });
1246
1392
  });
1247
1393
  describe('Get endpoint by CALLING_BACKEND tests', function () {
1248
- it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1249
- return _regenerator.default.wrap(function _callee8$(_context8) {
1250
- while (1) switch (_context8.prev = _context8.next) {
1394
+ it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1395
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1396
+ while (1) switch (_context11.prev = _context11.next) {
1251
1397
  case 0:
1252
- _context8.t0 = expect;
1253
- _context8.next = 3;
1398
+ _context11.t0 = expect;
1399
+ _context11.next = 3;
1254
1400
  return (0, _Utils.getXsiActionEndpoint)(webex, {
1255
1401
  file: 'testFile',
1256
1402
  method: 'testMethod'
1257
1403
  }, _types.CALLING_BACKEND.UCM);
1258
1404
  case 3:
1259
- _context8.t1 = _context8.sent;
1260
- (0, _context8.t0)(_context8.t1).toBeInstanceOf(Error);
1405
+ _context11.t1 = _context11.sent;
1406
+ (0, _context11.t0)(_context11.t1).toBeInstanceOf(Error);
1261
1407
  case 5:
1262
1408
  case "end":
1263
- return _context8.stop();
1409
+ return _context11.stop();
1264
1410
  }
1265
- }, _callee8);
1411
+ }, _callee11);
1266
1412
  })));
1267
- it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1268
- return _regenerator.default.wrap(function _callee9$(_context9) {
1269
- while (1) switch (_context9.prev = _context9.next) {
1413
+ it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1414
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1415
+ while (1) switch (_context12.prev = _context12.next) {
1270
1416
  case 0:
1271
- _context9.t0 = expect;
1272
- _context9.next = 3;
1417
+ _context12.t0 = expect;
1418
+ _context12.next = 3;
1273
1419
  return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
1274
1420
  case 3:
1275
- _context9.t1 = _context9.sent;
1276
- (0, _context9.t0)(_context9.t1).toBeInstanceOf(Error);
1421
+ _context12.t1 = _context12.sent;
1422
+ (0, _context12.t0)(_context12.t1).toBeInstanceOf(Error);
1277
1423
  case 5:
1278
1424
  case "end":
1279
- return _context9.stop();
1425
+ return _context12.stop();
1280
1426
  }
1281
- }, _callee9);
1427
+ }, _callee12);
1282
1428
  })));
1283
1429
  });
1284
1430
  describe('Get XSI Action Endpoint tests', function () {
@@ -1296,10 +1442,10 @@ describe('Get XSI Action Endpoint tests', function () {
1296
1442
  file: 'testFile',
1297
1443
  method: 'testMethod'
1298
1444
  };
1299
- it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
1445
+ it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1300
1446
  var mockResponse, xsiEndpoint;
1301
- return _regenerator.default.wrap(function _callee10$(_context10) {
1302
- while (1) switch (_context10.prev = _context10.next) {
1447
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1448
+ while (1) switch (_context13.prev = _context13.next) {
1303
1449
  case 0:
1304
1450
  mockResponse = {
1305
1451
  body: {
@@ -1311,22 +1457,22 @@ describe('Get XSI Action Endpoint tests', function () {
1311
1457
  }
1312
1458
  };
1313
1459
  mockWebex.request.mockResolvedValue(mockResponse);
1314
- _context10.next = 4;
1460
+ _context13.next = 4;
1315
1461
  return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
1316
1462
  case 4:
1317
- xsiEndpoint = _context10.sent;
1463
+ xsiEndpoint = _context13.sent;
1318
1464
  expect(mockWebex.request).toHaveBeenCalledTimes(1);
1319
1465
  expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
1320
1466
  case 7:
1321
1467
  case "end":
1322
- return _context10.stop();
1468
+ return _context13.stop();
1323
1469
  }
1324
- }, _callee10);
1470
+ }, _callee13);
1325
1471
  })));
1326
- it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1472
+ it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
1327
1473
  var mockResponse, xsiEndpoint;
1328
- return _regenerator.default.wrap(function _callee11$(_context11) {
1329
- while (1) switch (_context11.prev = _context11.next) {
1474
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1475
+ while (1) switch (_context14.prev = _context14.next) {
1330
1476
  case 0:
1331
1477
  mockResponse = {
1332
1478
  body: {
@@ -1338,22 +1484,22 @@ describe('Get XSI Action Endpoint tests', function () {
1338
1484
  }
1339
1485
  };
1340
1486
  mockWebex.request.mockResolvedValue(mockResponse);
1341
- _context11.next = 4;
1487
+ _context14.next = 4;
1342
1488
  return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
1343
1489
  case 4:
1344
- xsiEndpoint = _context11.sent;
1490
+ xsiEndpoint = _context14.sent;
1345
1491
  expect(mockWebex.request).toHaveBeenCalledTimes(1);
1346
1492
  expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
1347
1493
  case 7:
1348
1494
  case "end":
1349
- return _context11.stop();
1495
+ return _context14.stop();
1350
1496
  }
1351
- }, _callee11);
1497
+ }, _callee14);
1352
1498
  })));
1353
- it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1499
+ it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1354
1500
  var mockResponse, xsiEndpoint;
1355
- return _regenerator.default.wrap(function _callee12$(_context12) {
1356
- while (1) switch (_context12.prev = _context12.next) {
1501
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1502
+ while (1) switch (_context15.prev = _context15.next) {
1357
1503
  case 0:
1358
1504
  mockResponse = {
1359
1505
  body: {
@@ -1365,17 +1511,17 @@ describe('Get XSI Action Endpoint tests', function () {
1365
1511
  }
1366
1512
  };
1367
1513
  mockWebex.request.mockResolvedValue(mockResponse);
1368
- _context12.next = 4;
1514
+ _context15.next = 4;
1369
1515
  return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
1370
1516
  case 4:
1371
- xsiEndpoint = _context12.sent;
1517
+ xsiEndpoint = _context15.sent;
1372
1518
  expect(mockWebex.request).toHaveBeenCalledTimes(1);
1373
1519
  expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
1374
1520
  case 7:
1375
1521
  case "end":
1376
- return _context12.stop();
1522
+ return _context15.stop();
1377
1523
  }
1378
- }, _callee12);
1524
+ }, _callee15);
1379
1525
  })));
1380
1526
  });
1381
1527
  describe('modifySdpForIPv4', function () {
@@ -1452,19 +1598,19 @@ describe('uploadLogs', function () {
1452
1598
  global.crypto = originalCrypto;
1453
1599
  jest.clearAllMocks();
1454
1600
  });
1455
- it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1601
+ it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1456
1602
  var mockMetaData, logSpy, result;
1457
- return _regenerator.default.wrap(function _callee13$(_context13) {
1458
- while (1) switch (_context13.prev = _context13.next) {
1603
+ return _regenerator.default.wrap(function _callee16$(_context16) {
1604
+ while (1) switch (_context16.prev = _context16.next) {
1459
1605
  case 0:
1460
1606
  mockMetaData = {
1461
1607
  correlationId: 'test-correlation'
1462
1608
  };
1463
1609
  logSpy = jest.spyOn(_Logger.default, 'info');
1464
- _context13.next = 4;
1610
+ _context16.next = 4;
1465
1611
  return (0, _Utils.uploadLogs)(mockMetaData, true);
1466
1612
  case 4:
1467
- result = _context13.sent;
1613
+ result = _context16.sent;
1468
1614
  expect(result).toEqual({
1469
1615
  trackingid: '1234',
1470
1616
  feedbackId: 'mocked-uuid-12345'
@@ -1497,14 +1643,14 @@ describe('uploadLogs', function () {
1497
1643
  });
1498
1644
  case 9:
1499
1645
  case "end":
1500
- return _context13.stop();
1646
+ return _context16.stop();
1501
1647
  }
1502
- }, _callee13);
1648
+ }, _callee16);
1503
1649
  })));
1504
- it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
1650
+ it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
1505
1651
  var mockMetaData, mockError, logSpy;
1506
- return _regenerator.default.wrap(function _callee14$(_context14) {
1507
- while (1) switch (_context14.prev = _context14.next) {
1652
+ return _regenerator.default.wrap(function _callee17$(_context17) {
1653
+ while (1) switch (_context17.prev = _context17.next) {
1508
1654
  case 0:
1509
1655
  mockMetaData = {
1510
1656
  correlationId: 'test-correlation'
@@ -1512,18 +1658,18 @@ describe('uploadLogs', function () {
1512
1658
  mockError = new Error('Upload failed'); // Mock the submitLogs to fail
1513
1659
  submitLogsMock.mockRejectedValueOnce(mockError);
1514
1660
  logSpy = jest.spyOn(_Logger.default, 'error');
1515
- _context14.prev = 4;
1516
- _context14.next = 7;
1661
+ _context17.prev = 4;
1662
+ _context17.next = 7;
1517
1663
  return (0, _Utils.uploadLogs)(mockMetaData, true);
1518
1664
  case 7:
1519
1665
  // If we get here, the test should fail since we expected an exception
1520
1666
  expect(true).toBe(false); // This will fail the test if no exception is thrown
1521
- _context14.next = 15;
1667
+ _context17.next = 15;
1522
1668
  break;
1523
1669
  case 10:
1524
- _context14.prev = 10;
1525
- _context14.t0 = _context14["catch"](4);
1526
- expect(_context14.t0).toBe(mockError);
1670
+ _context17.prev = 10;
1671
+ _context17.t0 = _context17["catch"](4);
1672
+ expect(_context17.t0).toBe(mockError);
1527
1673
  expect(logSpy).toHaveBeenCalledWith(expect.objectContaining({
1528
1674
  message: expect.stringContaining('Failed to upload Logs')
1529
1675
  }), {
@@ -1550,14 +1696,14 @@ describe('uploadLogs', function () {
1550
1696
  });
1551
1697
  case 15:
1552
1698
  case "end":
1553
- return _context14.stop();
1699
+ return _context17.stop();
1554
1700
  }
1555
- }, _callee14, null, [[4, 10]]);
1701
+ }, _callee17, null, [[4, 10]]);
1556
1702
  })));
1557
- it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1703
+ it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
1558
1704
  var mockMetaData, mockError, logSpy, result;
1559
- return _regenerator.default.wrap(function _callee15$(_context15) {
1560
- while (1) switch (_context15.prev = _context15.next) {
1705
+ return _regenerator.default.wrap(function _callee18$(_context18) {
1706
+ while (1) switch (_context18.prev = _context18.next) {
1561
1707
  case 0:
1562
1708
  mockMetaData = {
1563
1709
  correlationId: 'test-correlation'
@@ -1565,10 +1711,10 @@ describe('uploadLogs', function () {
1565
1711
  mockError = new Error('Upload failed'); // Mock the submitLogs to fail
1566
1712
  submitLogsMock.mockRejectedValueOnce(mockError);
1567
1713
  logSpy = jest.spyOn(_Logger.default, 'error');
1568
- _context15.next = 6;
1714
+ _context18.next = 6;
1569
1715
  return (0, _Utils.uploadLogs)(mockMetaData, false);
1570
1716
  case 6:
1571
- result = _context15.sent;
1717
+ result = _context18.sent;
1572
1718
  expect(result).toBeUndefined();
1573
1719
  expect(logSpy).toHaveBeenCalledWith(expect.objectContaining({
1574
1720
  message: expect.stringContaining('Failed to upload Logs')
@@ -1596,9 +1742,9 @@ describe('uploadLogs', function () {
1596
1742
  });
1597
1743
  case 10:
1598
1744
  case "end":
1599
- return _context15.stop();
1745
+ return _context18.stop();
1600
1746
  }
1601
- }, _callee15);
1747
+ }, _callee18);
1602
1748
  })));
1603
1749
  });
1604
1750
  //# sourceMappingURL=Utils.test.js.map