@webex/calling 3.10.0-next.2 → 3.10.0-next.21

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 (131) hide show
  1. package/dist/CallHistory/CallHistory.js +128 -128
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +278 -181
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/CallSettings.js +17 -18
  6. package/dist/CallSettings/CallSettings.js.map +1 -1
  7. package/dist/CallSettings/CallSettings.test.js +14 -14
  8. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  9. package/dist/CallSettings/UcmBackendConnector.js +71 -24
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +137 -138
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +297 -345
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +267 -405
  20. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  21. package/dist/CallingClient/calling/CallerId/index.js +7 -8
  22. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  23. package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
  24. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  25. package/dist/CallingClient/calling/call.js +655 -611
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +762 -551
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +15 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +113 -113
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/constants.js +5 -1
  34. package/dist/CallingClient/constants.js.map +1 -1
  35. package/dist/CallingClient/line/index.js +57 -74
  36. package/dist/CallingClient/line/index.js.map +1 -1
  37. package/dist/CallingClient/line/line.test.js +22 -22
  38. package/dist/CallingClient/line/line.test.js.map +1 -1
  39. package/dist/CallingClient/registration/register.js +657 -526
  40. package/dist/CallingClient/registration/register.js.map +1 -1
  41. package/dist/CallingClient/registration/register.test.js +657 -309
  42. package/dist/CallingClient/registration/register.test.js.map +1 -1
  43. package/dist/CallingClient/registration/types.js.map +1 -1
  44. package/dist/CallingClient/registration/webWorker.js +24 -24
  45. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  46. package/dist/CallingClient/registration/webWorker.test.js +20 -20
  47. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  48. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  49. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  50. package/dist/Contacts/ContactsClient.js +258 -258
  51. package/dist/Contacts/ContactsClient.js.map +1 -1
  52. package/dist/Contacts/ContactsClient.test.js +60 -60
  53. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  54. package/dist/Errors/catalog/CallError.js +7 -10
  55. package/dist/Errors/catalog/CallError.js.map +1 -1
  56. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  57. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  58. package/dist/Errors/catalog/ExtendedError.js +6 -8
  59. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  60. package/dist/Errors/catalog/LineError.js +6 -9
  61. package/dist/Errors/catalog/LineError.js.map +1 -1
  62. package/dist/Events/impl/index.js +11 -13
  63. package/dist/Events/impl/index.js.map +1 -1
  64. package/dist/Metrics/index.js +1 -2
  65. package/dist/Metrics/index.js.map +1 -1
  66. package/dist/SDKConnector/index.js +1 -2
  67. package/dist/SDKConnector/index.js.map +1 -1
  68. package/dist/SDKConnector/types.js.map +1 -1
  69. package/dist/Voicemail/BroadworksBackendConnector.js +129 -128
  70. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  71. package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
  72. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  73. package/dist/Voicemail/UcmBackendConnector.js +86 -86
  74. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  75. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  76. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  77. package/dist/Voicemail/Voicemail.js +58 -61
  78. package/dist/Voicemail/Voicemail.js.map +1 -1
  79. package/dist/Voicemail/Voicemail.test.js +20 -20
  80. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  81. package/dist/Voicemail/WxCallBackendConnector.js +116 -117
  82. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  83. package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
  84. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  85. package/dist/common/Utils.js +195 -165
  86. package/dist/common/Utils.js.map +1 -1
  87. package/dist/common/Utils.test.js +432 -183
  88. package/dist/common/Utils.test.js.map +1 -1
  89. package/dist/common/constants.js +3 -1
  90. package/dist/common/constants.js.map +1 -1
  91. package/dist/common/testUtil.js +5 -4
  92. package/dist/common/testUtil.js.map +1 -1
  93. package/dist/module/CallHistory/CallHistory.js +7 -3
  94. package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
  95. package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
  96. package/dist/module/CallingClient/CallingClient.js +83 -121
  97. package/dist/module/CallingClient/calling/call.js +60 -39
  98. package/dist/module/CallingClient/constants.js +3 -0
  99. package/dist/module/CallingClient/registration/register.js +82 -2
  100. package/dist/module/Contacts/ContactsClient.js +9 -5
  101. package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
  102. package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
  103. package/dist/module/common/Utils.js +27 -3
  104. package/dist/module/common/constants.js +2 -0
  105. package/dist/module/common/testUtil.js +1 -0
  106. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  107. package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
  108. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  109. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  110. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  111. package/dist/types/CallingClient/calling/call.d.ts +4 -0
  112. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  113. package/dist/types/CallingClient/constants.d.ts +3 -0
  114. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  115. package/dist/types/CallingClient/registration/register.d.ts +4 -0
  116. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  117. package/dist/types/CallingClient/registration/types.d.ts +6 -0
  118. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  119. package/dist/types/Contacts/ContactsClient.d.ts +1 -0
  120. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  121. package/dist/types/SDKConnector/types.d.ts +16 -0
  122. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  123. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  124. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  125. package/dist/types/common/Utils.d.ts +1 -1
  126. package/dist/types/common/Utils.d.ts.map +1 -1
  127. package/dist/types/common/constants.d.ts +2 -0
  128. package/dist/types/common/constants.d.ts.map +1 -1
  129. package/dist/types/common/testUtil.d.ts +1 -0
  130. package/dist/types/common/testUtil.d.ts.map +1 -1
  131. package/package.json +4 -4
@@ -24,7 +24,7 @@ var _constants = require("./constants");
24
24
  var utils = _interopRequireWildcard(require("../common/Utils"));
25
25
  var _Logger = _interopRequireDefault(require("../Logger"));
26
26
  var _constants2 = require("../common/constants");
27
- 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 _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
27
+ 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 _t41 in e) "default" !== _t41 && {}.hasOwnProperty.call(e, _t41) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t41)) && (i.get || i.set) ? o(f, _t41, i) : f[_t41] = e[_t41]); return f; })(e, t); }
28
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; }
29
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$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable dot-notation */ /* eslint-disable @typescript-eslint/no-shadow */
30
30
  var webex = (0, _testUtil.getTestUtilsWebex)();
@@ -43,14 +43,14 @@ describe('Call history tests', function () {
43
43
  });
44
44
  it('verify successful call history case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
45
45
  var callHistoryPayload, response;
46
- return _regenerator.default.wrap(function _callee$(_context) {
46
+ return _regenerator.default.wrap(function (_context) {
47
47
  while (1) switch (_context.prev = _context.next) {
48
48
  case 0:
49
49
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
50
50
  webex.request.mockResolvedValue(callHistoryPayload);
51
- _context.next = 4;
51
+ _context.next = 1;
52
52
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
53
- case 4:
53
+ case 1:
54
54
  response = _context.sent;
55
55
  expect(response.statusCode).toBe(200);
56
56
  expect(response.message).toBe('SUCCESS');
@@ -71,7 +71,7 @@ describe('Call history tests', function () {
71
71
  });
72
72
  expect(errorSpy).not.toHaveBeenCalled();
73
73
  expect(uploadLogsSpy).not.toHaveBeenCalled();
74
- case 14:
74
+ case 2:
75
75
  case "end":
76
76
  return _context.stop();
77
77
  }
@@ -79,7 +79,7 @@ describe('Call history tests', function () {
79
79
  })));
80
80
  it('verify bad request failed call history case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
81
81
  var failurePayload, callHistoryPayload, response;
82
- return _regenerator.default.wrap(function _callee2$(_context2) {
82
+ return _regenerator.default.wrap(function (_context2) {
83
83
  while (1) switch (_context2.prev = _context2.next) {
84
84
  case 0:
85
85
  failurePayload = {
@@ -87,9 +87,9 @@ describe('Call history tests', function () {
87
87
  };
88
88
  callHistoryPayload = failurePayload;
89
89
  webex.request.mockRejectedValue(callHistoryPayload);
90
- _context2.next = 5;
90
+ _context2.next = 1;
91
91
  return callHistory.getCallHistoryData(7, 2000, _types2.SORT.ASC, _types2.SORT_BY.START_TIME);
92
- case 5:
92
+ case 1:
93
93
  response = _context2.sent;
94
94
  expect(response.statusCode).toBe(400);
95
95
  expect(response.message).toBe('FAILURE');
@@ -104,7 +104,7 @@ describe('Call history tests', function () {
104
104
  method: _constants.METHODS.GET_CALL_HISTORY_DATA
105
105
  });
106
106
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
107
- case 11:
107
+ case 2:
108
108
  case "end":
109
109
  return _context2.stop();
110
110
  }
@@ -112,7 +112,7 @@ describe('Call history tests', function () {
112
112
  })));
113
113
  it('verify device not found call history case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
114
114
  var failurePayload, callHistoryPayload, response;
115
- return _regenerator.default.wrap(function _callee3$(_context3) {
115
+ return _regenerator.default.wrap(function (_context3) {
116
116
  while (1) switch (_context3.prev = _context3.next) {
117
117
  case 0:
118
118
  failurePayload = {
@@ -120,9 +120,9 @@ describe('Call history tests', function () {
120
120
  };
121
121
  callHistoryPayload = failurePayload;
122
122
  webex.request.mockRejectedValue(callHistoryPayload);
123
- _context3.next = 5;
123
+ _context3.next = 1;
124
124
  return callHistory.getCallHistoryData(0, 0, _types2.SORT.ASC, _types2.SORT_BY.START_TIME);
125
- case 5:
125
+ case 1:
126
126
  response = _context3.sent;
127
127
  expect(response.statusCode).toBe(404);
128
128
  expect(response.message).toBe('FAILURE');
@@ -137,7 +137,7 @@ describe('Call history tests', function () {
137
137
  method: _constants.METHODS.GET_CALL_HISTORY_DATA
138
138
  });
139
139
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
140
- case 11:
140
+ case 2:
141
141
  case "end":
142
142
  return _context3.stop();
143
143
  }
@@ -146,14 +146,14 @@ describe('Call history tests', function () {
146
146
  describe('sorting user session response data by sortby', function () {
147
147
  it('Array should be sort.ASC by START TIME ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
148
148
  var callHistoryPayload, response, responseDetails;
149
- return _regenerator.default.wrap(function _callee4$(_context4) {
149
+ return _regenerator.default.wrap(function (_context4) {
150
150
  while (1) switch (_context4.prev = _context4.next) {
151
151
  case 0:
152
152
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
153
153
  webex.request.mockResolvedValue(callHistoryPayload);
154
- _context4.next = 4;
154
+ _context4.next = 1;
155
155
  return callHistory.getCallHistoryData(10, 20, _types2.SORT.ASC, _types2.SORT_BY.START_TIME);
156
- case 4:
156
+ case 1:
157
157
  response = _context4.sent;
158
158
  responseDetails = {
159
159
  statusCode: _callHistoryFixtures.sortedCallHistory.body.statusCode,
@@ -169,7 +169,7 @@ describe('Call history tests', function () {
169
169
  file: _constants.CALL_HISTORY_FILE,
170
170
  method: _constants.METHODS.GET_CALL_HISTORY_DATA
171
171
  });
172
- case 8:
172
+ case 2:
173
173
  case "end":
174
174
  return _context4.stop();
175
175
  }
@@ -203,10 +203,10 @@ describe('Call history tests', function () {
203
203
  callSessionCallback(_callHistoryFixtures.MOCK_SESSION_EVENT_LEGACY);
204
204
  });
205
205
  it('verify the user viewed session event for missed calls update', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
206
- return _regenerator.default.wrap(function _callee5$(_context5) {
206
+ return _regenerator.default.wrap(function (_context5) {
207
207
  while (1) switch (_context5.prev = _context5.next) {
208
208
  case 0:
209
- _context5.next = 2;
209
+ _context5.next = 1;
210
210
  return new _promise.default(function (resolve) {
211
211
  callHistory.on(_types3.COMMON_EVENT_KEYS.CALL_HISTORY_USER_VIEWED_SESSIONS, function (event) {
212
212
  expect(event.data).toEqual(_callHistoryFixtures.MOCK_SESSION_EVENT_VIEWED.data);
@@ -216,17 +216,17 @@ describe('Call history tests', function () {
216
216
  var callSessionCallback = mockOn.mock.calls[2][1];
217
217
  callSessionCallback(_callHistoryFixtures.MOCK_SESSION_EVENT_VIEWED);
218
218
  });
219
- case 2:
219
+ case 1:
220
220
  case "end":
221
221
  return _context5.stop();
222
222
  }
223
223
  }, _callee5);
224
224
  })));
225
225
  it('verify the user sessions deleted event for deleting the call history records', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
226
- return _regenerator.default.wrap(function _callee6$(_context6) {
226
+ return _regenerator.default.wrap(function (_context6) {
227
227
  while (1) switch (_context6.prev = _context6.next) {
228
228
  case 0:
229
- _context6.next = 2;
229
+ _context6.next = 1;
230
230
  return new _promise.default(function (resolve) {
231
231
  callHistory.on(_types3.COMMON_EVENT_KEYS.CALL_HISTORY_USER_SESSIONS_DELETED, function (event) {
232
232
  expect(event.data).toEqual(_callHistoryFixtures.MOCK_SESSION_EVENT_DELETED.data);
@@ -236,7 +236,7 @@ describe('Call history tests', function () {
236
236
  var callSessionCallback = mockOn.mock.calls[3][1];
237
237
  callSessionCallback(_callHistoryFixtures.MOCK_SESSION_EVENT_DELETED);
238
238
  });
239
- case 2:
239
+ case 1:
240
240
  case "end":
241
241
  return _context6.stop();
242
242
  }
@@ -252,7 +252,7 @@ describe('Call history tests', function () {
252
252
  jest.clearAllMocks();
253
253
  });
254
254
  beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
255
- return _regenerator.default.wrap(function _callee7$(_context7) {
255
+ return _regenerator.default.wrap(function (_context7) {
256
256
  while (1) switch (_context7.prev = _context7.next) {
257
257
  case 0:
258
258
  serviceErrorCodeHandlerSpy = jest.spyOn(utils, 'serviceErrorCodeHandler');
@@ -266,24 +266,24 @@ describe('Call history tests', function () {
266
266
  }
267
267
  });
268
268
  });
269
- case 3:
269
+ case 1:
270
270
  case "end":
271
271
  return _context7.stop();
272
272
  }
273
273
  }, _callee7);
274
274
  })));
275
275
  it('successfully updates missed calls', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
276
- var endTimeSessionIds, response, convertedEndTimeSessionIds;
277
- return _regenerator.default.wrap(function _callee8$(_context8) {
276
+ var endTimeSessionIds, response, convertedEndTimeSessionIds, _t, _t2, _t3, _t4, _t5, _t6, _t7;
277
+ return _regenerator.default.wrap(function (_context8) {
278
278
  while (1) switch (_context8.prev = _context8.next) {
279
279
  case 0:
280
280
  endTimeSessionIds = [{
281
281
  endTime: '1234568',
282
282
  sessionId: '123'
283
283
  }];
284
- _context8.next = 3;
284
+ _context8.next = 1;
285
285
  return callHistory.updateMissedCalls(endTimeSessionIds);
286
- case 3:
286
+ case 1:
287
287
  response = _context8.sent;
288
288
  convertedEndTimeSessionIds = endTimeSessionIds.map(function (session) {
289
289
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -292,39 +292,37 @@ describe('Call history tests', function () {
292
292
  });
293
293
  expect(response.statusCode).toEqual(200);
294
294
  expect(response).toEqual(_callHistoryFixtures.MOCK_UPDATE_MISSED_CALL_RESPONSE);
295
- _context8.t0 = expect(global.fetch);
296
- _context8.t1 = _callHistoryFixtures.janusSetReadStateUrl;
297
- _context8.t2 = _types2.HTTP_METHODS.POST;
298
- _context8.t3 = _defineProperty2.default;
299
- _context8.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
300
- _context8.next = 14;
295
+ _t = expect(global.fetch);
296
+ _t2 = _callHistoryFixtures.janusSetReadStateUrl;
297
+ _t3 = _types2.HTTP_METHODS.POST;
298
+ _t4 = _defineProperty2.default;
299
+ _t5 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
300
+ _context8.next = 2;
301
301
  return webex.credentials.getUserToken();
302
- case 14:
303
- _context8.t5 = _context8.sent;
304
- _context8.t6 = (0, _context8.t3)(_context8.t4, "Authorization", _context8.t5);
305
- _context8.t7 = (0, _stringify.default)({
302
+ case 2:
303
+ _t6 = _t4(_t5, "Authorization", _context8.sent);
304
+ _t7 = (0, _stringify.default)({
306
305
  endTimeSessionIds: convertedEndTimeSessionIds
307
306
  });
308
- _context8.t8 = {
309
- method: _context8.t2,
310
- headers: _context8.t6,
311
- body: _context8.t7
312
- };
313
- _context8.t0.toBeCalledOnceWith.call(_context8.t0, _context8.t1, _context8.t8);
307
+ _t.toBeCalledOnceWith.call(_t, _t2, {
308
+ method: _t3,
309
+ headers: _t6,
310
+ body: _t7
311
+ });
314
312
  // Verify logs were called with correct information
315
313
  expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with sessions: ").concat((0, _stringify.default)(convertedEndTimeSessionIds)), methodDetails);
316
314
  expect(logSpy).toHaveBeenCalledWith('Missed calls are successfully read by the user', methodDetails);
317
315
  expect(errorSpy).not.toHaveBeenCalled();
318
316
  expect(uploadLogsSpy).not.toHaveBeenCalled();
319
- case 23:
317
+ case 3:
320
318
  case "end":
321
319
  return _context8.stop();
322
320
  }
323
321
  }, _callee8);
324
322
  })));
325
323
  it('Error: updateMissedCalls throw 400 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
326
- var endTimeSessionIds, response, convertedEndTimeSessionIds;
327
- return _regenerator.default.wrap(function _callee9$(_context9) {
324
+ var endTimeSessionIds, response, convertedEndTimeSessionIds, _t8, _t9, _t0, _t1, _t10, _t11, _t12;
325
+ return _regenerator.default.wrap(function (_context9) {
328
326
  while (1) switch (_context9.prev = _context9.next) {
329
327
  case 0:
330
328
  endTimeSessionIds = [];
@@ -334,9 +332,9 @@ describe('Call history tests', function () {
334
332
  ok: false
335
333
  });
336
334
  });
337
- _context9.next = 4;
335
+ _context9.next = 1;
338
336
  return callHistory.updateMissedCalls(endTimeSessionIds);
339
- case 4:
337
+ case 1:
340
338
  response = _context9.sent;
341
339
  convertedEndTimeSessionIds = endTimeSessionIds.map(function (session) {
342
340
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -345,39 +343,37 @@ describe('Call history tests', function () {
345
343
  });
346
344
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_400);
347
345
  expect(response.statusCode).toBe(400);
348
- _context9.t0 = expect(global.fetch);
349
- _context9.t1 = _callHistoryFixtures.janusSetReadStateUrl;
350
- _context9.t2 = _types2.HTTP_METHODS.POST;
351
- _context9.t3 = _defineProperty2.default;
352
- _context9.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
353
- _context9.next = 15;
346
+ _t8 = expect(global.fetch);
347
+ _t9 = _callHistoryFixtures.janusSetReadStateUrl;
348
+ _t0 = _types2.HTTP_METHODS.POST;
349
+ _t1 = _defineProperty2.default;
350
+ _t10 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
351
+ _context9.next = 2;
354
352
  return webex.credentials.getUserToken();
355
- case 15:
356
- _context9.t5 = _context9.sent;
357
- _context9.t6 = (0, _context9.t3)(_context9.t4, "Authorization", _context9.t5);
358
- _context9.t7 = (0, _stringify.default)({
353
+ case 2:
354
+ _t11 = _t1(_t10, "Authorization", _context9.sent);
355
+ _t12 = (0, _stringify.default)({
359
356
  endTimeSessionIds: convertedEndTimeSessionIds
360
357
  });
361
- _context9.t8 = {
362
- method: _context9.t2,
363
- headers: _context9.t6,
364
- body: _context9.t7
365
- };
366
- _context9.t0.toBeCalledOnceWith.call(_context9.t0, _context9.t1, _context9.t8);
358
+ _t8.toBeCalledOnceWith.call(_t8, _t9, {
359
+ method: _t0,
360
+ headers: _t11,
361
+ body: _t12
362
+ });
367
363
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
368
364
  statusCode: 400
369
365
  }, methodDetails);
370
366
  expect(errorSpy).toBeCalledWith(expect.stringContaining('Failed to update missed calls'), methodDetails);
371
367
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
372
- case 23:
368
+ case 3:
373
369
  case "end":
374
370
  return _context9.stop();
375
371
  }
376
372
  }, _callee9);
377
373
  })));
378
374
  it('Error: updateMissedCalls throw 401 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
379
- var endTimeSessionIds, response, convertedEndTimeSessionIds;
380
- return _regenerator.default.wrap(function _callee0$(_context0) {
375
+ var endTimeSessionIds, response, convertedEndTimeSessionIds, _t13, _t14, _t15, _t16, _t17, _t18, _t19;
376
+ return _regenerator.default.wrap(function (_context0) {
381
377
  while (1) switch (_context0.prev = _context0.next) {
382
378
  case 0:
383
379
  endTimeSessionIds = [];
@@ -387,9 +383,9 @@ describe('Call history tests', function () {
387
383
  ok: false
388
384
  });
389
385
  });
390
- _context0.next = 4;
386
+ _context0.next = 1;
391
387
  return callHistory.updateMissedCalls(endTimeSessionIds);
392
- case 4:
388
+ case 1:
393
389
  response = _context0.sent;
394
390
  convertedEndTimeSessionIds = endTimeSessionIds.map(function (session) {
395
391
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -398,31 +394,29 @@ describe('Call history tests', function () {
398
394
  });
399
395
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_401);
400
396
  expect(response.statusCode).toBe(401);
401
- _context0.t0 = expect(global.fetch);
402
- _context0.t1 = _callHistoryFixtures.janusSetReadStateUrl;
403
- _context0.t2 = _types2.HTTP_METHODS.POST;
404
- _context0.t3 = _defineProperty2.default;
405
- _context0.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
406
- _context0.next = 15;
397
+ _t13 = expect(global.fetch);
398
+ _t14 = _callHistoryFixtures.janusSetReadStateUrl;
399
+ _t15 = _types2.HTTP_METHODS.POST;
400
+ _t16 = _defineProperty2.default;
401
+ _t17 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
402
+ _context0.next = 2;
407
403
  return webex.credentials.getUserToken();
408
- case 15:
409
- _context0.t5 = _context0.sent;
410
- _context0.t6 = (0, _context0.t3)(_context0.t4, "Authorization", _context0.t5);
411
- _context0.t7 = (0, _stringify.default)({
404
+ case 2:
405
+ _t18 = _t16(_t17, "Authorization", _context0.sent);
406
+ _t19 = (0, _stringify.default)({
412
407
  endTimeSessionIds: convertedEndTimeSessionIds
413
408
  });
414
- _context0.t8 = {
415
- method: _context0.t2,
416
- headers: _context0.t6,
417
- body: _context0.t7
418
- };
419
- _context0.t0.toBeCalledOnceWith.call(_context0.t0, _context0.t1, _context0.t8);
409
+ _t13.toBeCalledOnceWith.call(_t13, _t14, {
410
+ method: _t15,
411
+ headers: _t18,
412
+ body: _t19
413
+ });
420
414
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
421
415
  statusCode: 401
422
416
  }, methodDetails);
423
417
  expect(errorSpy).toHaveBeenCalled();
424
418
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
425
- case 23:
419
+ case 3:
426
420
  case "end":
427
421
  return _context0.stop();
428
422
  }
@@ -435,14 +429,14 @@ describe('Call history tests', function () {
435
429
  });
436
430
  it('verify successful UCM lines API case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
437
431
  var ucmLinesAPIPayload, response;
438
- return _regenerator.default.wrap(function _callee1$(_context1) {
432
+ return _regenerator.default.wrap(function (_context1) {
439
433
  while (1) switch (_context1.prev = _context1.next) {
440
434
  case 0:
441
435
  ucmLinesAPIPayload = _callHistoryFixtures.MOCK_LINES_API_CALL_RESPONSE;
442
436
  webex.request.mockResolvedValue(ucmLinesAPIPayload);
443
- _context1.next = 4;
437
+ _context1.next = 1;
444
438
  return callHistory['fetchUCMLinesData']();
445
- case 4:
439
+ case 1:
446
440
  response = _context1.sent;
447
441
  expect(response.statusCode).toBe(200);
448
442
  expect(response.message).toBe('SUCCESS');
@@ -458,7 +452,7 @@ describe('Call history tests', function () {
458
452
  });
459
453
  expect(errorSpy).not.toHaveBeenCalled();
460
454
  expect(uploadLogsSpy).not.toHaveBeenCalled();
461
- case 11:
455
+ case 2:
462
456
  case "end":
463
457
  return _context1.stop();
464
458
  }
@@ -466,7 +460,7 @@ describe('Call history tests', function () {
466
460
  })));
467
461
  it('verify bad request failed UCM lines API case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
468
462
  var failurePayload, ucmLinesAPIPayload, response;
469
- return _regenerator.default.wrap(function _callee10$(_context10) {
463
+ return _regenerator.default.wrap(function (_context10) {
470
464
  while (1) switch (_context10.prev = _context10.next) {
471
465
  case 0:
472
466
  failurePayload = {
@@ -474,9 +468,9 @@ describe('Call history tests', function () {
474
468
  };
475
469
  ucmLinesAPIPayload = failurePayload;
476
470
  webex.request.mockRejectedValue(ucmLinesAPIPayload);
477
- _context10.next = 5;
471
+ _context10.next = 1;
478
472
  return callHistory['fetchUCMLinesData']();
479
- case 5:
473
+ case 1:
480
474
  response = _context10.sent;
481
475
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_400);
482
476
  expect(response.data.error).toEqual(_callHistoryFixtures.ERROR_DETAILS_400.data.error);
@@ -496,7 +490,7 @@ describe('Call history tests', function () {
496
490
  });
497
491
  expect(errorSpy).toHaveBeenCalled();
498
492
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
499
- case 14:
493
+ case 2:
500
494
  case "end":
501
495
  return _context10.stop();
502
496
  }
@@ -504,7 +498,7 @@ describe('Call history tests', function () {
504
498
  })));
505
499
  it('should call fetchUCMLinesData when calling backend is UCM and userSessions contain valid cucmDN', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
506
500
  var fetchUCMLinesDataSpy, mockCallHistoryPayload, response;
507
- return _regenerator.default.wrap(function _callee11$(_context11) {
501
+ return _regenerator.default.wrap(function (_context11) {
508
502
  while (1) switch (_context11.prev = _context11.next) {
509
503
  case 0:
510
504
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
@@ -513,14 +507,14 @@ describe('Call history tests', function () {
513
507
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue(_callHistoryFixtures.MOCK_LINES_API_CALL_RESPONSE);
514
508
  mockCallHistoryPayload = _callHistoryFixtures.MOCK_CALL_HISTORY_WITH_UCM_LINE_NUMBER;
515
509
  webex.request.mockResolvedValue(mockCallHistoryPayload);
516
- _context11.next = 6;
510
+ _context11.next = 1;
517
511
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
518
- case 6:
512
+ case 1:
519
513
  response = _context11.sent;
520
514
  expect(fetchUCMLinesDataSpy).toHaveBeenCalledTimes(1);
521
515
  expect(response.statusCode).toBe(200);
522
516
  expect(response.data.userSessions && response.data.userSessions[0].self.ucmLineNumber).toEqual(1);
523
- case 10:
517
+ case 2:
524
518
  case "end":
525
519
  return _context11.stop();
526
520
  }
@@ -528,7 +522,7 @@ describe('Call history tests', function () {
528
522
  })));
529
523
  it('should fetchUCMLinesData but not assign ucmLineNumber when UCM backend has no line data', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
530
524
  var fetchUCMLinesDataSpy, mockCallHistoryPayload, response;
531
- return _regenerator.default.wrap(function _callee12$(_context12) {
525
+ return _regenerator.default.wrap(function (_context12) {
532
526
  while (1) switch (_context12.prev = _context12.next) {
533
527
  case 0:
534
528
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
@@ -538,15 +532,15 @@ describe('Call history tests', function () {
538
532
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue(_callHistoryFixtures.MOCK_LINES_API_CALL_RESPONSE_WITH_NO_LINEDATA);
539
533
  mockCallHistoryPayload = _callHistoryFixtures.MOCK_CALL_HISTORY_WITHOUT_UCM_LINE_NUMBER;
540
534
  webex.request.mockResolvedValue(mockCallHistoryPayload);
541
- _context12.next = 6;
535
+ _context12.next = 1;
542
536
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
543
- case 6:
537
+ case 1:
544
538
  response = _context12.sent;
545
539
  expect(fetchUCMLinesDataSpy).toHaveBeenCalledTimes(1);
546
540
  expect(response.statusCode).toBe(200);
547
541
  expect(response.data.userSessions && response.data.userSessions[0].self.cucmDN).toBeDefined();
548
542
  expect(response.data.userSessions && response.data.userSessions[0].self.ucmLineNumber).toEqual(undefined);
549
- case 11:
543
+ case 2:
550
544
  case "end":
551
545
  return _context12.stop();
552
546
  }
@@ -554,7 +548,7 @@ describe('Call history tests', function () {
554
548
  })));
555
549
  it('should not call fetchUCMLinesData when calling backend is UCM but no valid cucmDN is present', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
556
550
  var fetchUCMLinesDataSpy, callHistoryPayload;
557
- return _regenerator.default.wrap(function _callee13$(_context13) {
551
+ return _regenerator.default.wrap(function (_context13) {
558
552
  while (1) switch (_context13.prev = _context13.next) {
559
553
  case 0:
560
554
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
@@ -563,11 +557,11 @@ describe('Call history tests', function () {
563
557
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue({});
564
558
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
565
559
  webex.request.mockResolvedValue(callHistoryPayload);
566
- _context13.next = 6;
560
+ _context13.next = 1;
567
561
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
568
- case 6:
562
+ case 1:
569
563
  expect(fetchUCMLinesDataSpy).not.toHaveBeenCalled();
570
- case 7:
564
+ case 2:
571
565
  case "end":
572
566
  return _context13.stop();
573
567
  }
@@ -575,7 +569,7 @@ describe('Call history tests', function () {
575
569
  })));
576
570
  it('should not call fetchUCMLinesData when calling backend is not UCM', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
577
571
  var fetchUCMLinesDataSpy, callHistoryPayload;
578
- return _regenerator.default.wrap(function _callee14$(_context14) {
572
+ return _regenerator.default.wrap(function (_context14) {
579
573
  while (1) switch (_context14.prev = _context14.next) {
580
574
  case 0:
581
575
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.WXC);
@@ -584,11 +578,11 @@ describe('Call history tests', function () {
584
578
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue({});
585
579
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
586
580
  webex.request.mockResolvedValue(callHistoryPayload);
587
- _context14.next = 6;
581
+ _context14.next = 1;
588
582
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
589
- case 6:
583
+ case 1:
590
584
  expect(fetchUCMLinesDataSpy).not.toHaveBeenCalled(); // Check that fetchUCMLinesData was not called
591
- case 7:
585
+ case 2:
592
586
  case "end":
593
587
  return _context14.stop();
594
588
  }
@@ -604,7 +598,7 @@ describe('Call history tests', function () {
604
598
  jest.clearAllMocks();
605
599
  });
606
600
  beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
607
- return _regenerator.default.wrap(function _callee15$(_context15) {
601
+ return _regenerator.default.wrap(function (_context15) {
608
602
  while (1) switch (_context15.prev = _context15.next) {
609
603
  case 0:
610
604
  serviceErrorCodeHandlerSpy = jest.spyOn(utils, 'serviceErrorCodeHandler');
@@ -618,24 +612,24 @@ describe('Call history tests', function () {
618
612
  }
619
613
  });
620
614
  });
621
- case 3:
615
+ case 1:
622
616
  case "end":
623
617
  return _context15.stop();
624
618
  }
625
619
  }, _callee15);
626
620
  })));
627
621
  it('successfully deletes the call history records', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
628
- var deleteSessionIds, response, convertedEndTimeSessionIds;
629
- return _regenerator.default.wrap(function _callee16$(_context16) {
622
+ var deleteSessionIds, response, convertedEndTimeSessionIds, _t20, _t21, _t22, _t23, _t24, _t25, _t26;
623
+ return _regenerator.default.wrap(function (_context16) {
630
624
  while (1) switch (_context16.prev = _context16.next) {
631
625
  case 0:
632
626
  deleteSessionIds = [{
633
627
  endTime: '2024-10-22T08:50:48.603Z',
634
628
  sessionId: '123'
635
629
  }];
636
- _context16.next = 3;
630
+ _context16.next = 1;
637
631
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
638
- case 3:
632
+ case 1:
639
633
  response = _context16.sent;
640
634
  convertedEndTimeSessionIds = deleteSessionIds.map(function (session) {
641
635
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -644,39 +638,37 @@ describe('Call history tests', function () {
644
638
  });
645
639
  expect(response.statusCode).toEqual(200);
646
640
  expect(response).toEqual(_callHistoryFixtures.MOCK_DELETE_CALL_HISTORY_RECORDS_RESPONSE);
647
- _context16.t0 = expect(global.fetch);
648
- _context16.t1 = _callHistoryFixtures.janusMarkAsDeletedUrl;
649
- _context16.t2 = _types2.HTTP_METHODS.POST;
650
- _context16.t3 = _defineProperty2.default;
651
- _context16.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
652
- _context16.next = 14;
641
+ _t20 = expect(global.fetch);
642
+ _t21 = _callHistoryFixtures.janusMarkAsDeletedUrl;
643
+ _t22 = _types2.HTTP_METHODS.POST;
644
+ _t23 = _defineProperty2.default;
645
+ _t24 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
646
+ _context16.next = 2;
653
647
  return webex.credentials.getUserToken();
654
- case 14:
655
- _context16.t5 = _context16.sent;
656
- _context16.t6 = (0, _context16.t3)(_context16.t4, "Authorization", _context16.t5);
657
- _context16.t7 = (0, _stringify.default)({
648
+ case 2:
649
+ _t25 = _t23(_t24, "Authorization", _context16.sent);
650
+ _t26 = (0, _stringify.default)({
658
651
  deleteSessionIds: convertedEndTimeSessionIds
659
652
  });
660
- _context16.t8 = {
661
- method: _context16.t2,
662
- headers: _context16.t6,
663
- body: _context16.t7
664
- };
665
- _context16.t0.toBeCalledOnceWith.call(_context16.t0, _context16.t1, _context16.t8);
653
+ _t20.toBeCalledOnceWith.call(_t20, _t21, {
654
+ method: _t22,
655
+ headers: _t25,
656
+ body: _t26
657
+ });
666
658
  // Verify logs were called with correct information
667
659
  expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with sessions: ").concat((0, _stringify.default)(deleteSessionIds)), methodDetails);
668
660
  expect(logSpy).toHaveBeenCalledWith("Successfully deleted ".concat(deleteSessionIds.length, " call history records"), methodDetails);
669
661
  expect(errorSpy).not.toHaveBeenCalled();
670
662
  expect(uploadLogsSpy).not.toHaveBeenCalled();
671
- case 23:
663
+ case 3:
672
664
  case "end":
673
665
  return _context16.stop();
674
666
  }
675
667
  }, _callee16);
676
668
  })));
677
669
  it('Error: deleteCallHistoryRecords throw 400 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
678
- var deleteSessionIds, response, convertedEndTimeSessionIds;
679
- return _regenerator.default.wrap(function _callee17$(_context17) {
670
+ var deleteSessionIds, response, convertedEndTimeSessionIds, _t27, _t28, _t29, _t30, _t31, _t32, _t33;
671
+ return _regenerator.default.wrap(function (_context17) {
680
672
  while (1) switch (_context17.prev = _context17.next) {
681
673
  case 0:
682
674
  deleteSessionIds = [];
@@ -686,9 +678,9 @@ describe('Call history tests', function () {
686
678
  ok: false
687
679
  });
688
680
  });
689
- _context17.next = 4;
681
+ _context17.next = 1;
690
682
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
691
- case 4:
683
+ case 1:
692
684
  response = _context17.sent;
693
685
  convertedEndTimeSessionIds = deleteSessionIds.map(function (session) {
694
686
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -697,39 +689,37 @@ describe('Call history tests', function () {
697
689
  });
698
690
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_400);
699
691
  expect(response.statusCode).toBe(400);
700
- _context17.t0 = expect(global.fetch);
701
- _context17.t1 = _callHistoryFixtures.janusMarkAsDeletedUrl;
702
- _context17.t2 = _types2.HTTP_METHODS.POST;
703
- _context17.t3 = _defineProperty2.default;
704
- _context17.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
705
- _context17.next = 15;
692
+ _t27 = expect(global.fetch);
693
+ _t28 = _callHistoryFixtures.janusMarkAsDeletedUrl;
694
+ _t29 = _types2.HTTP_METHODS.POST;
695
+ _t30 = _defineProperty2.default;
696
+ _t31 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
697
+ _context17.next = 2;
706
698
  return webex.credentials.getUserToken();
707
- case 15:
708
- _context17.t5 = _context17.sent;
709
- _context17.t6 = (0, _context17.t3)(_context17.t4, "Authorization", _context17.t5);
710
- _context17.t7 = (0, _stringify.default)({
699
+ case 2:
700
+ _t32 = _t30(_t31, "Authorization", _context17.sent);
701
+ _t33 = (0, _stringify.default)({
711
702
  deleteSessionIds: convertedEndTimeSessionIds
712
703
  });
713
- _context17.t8 = {
714
- method: _context17.t2,
715
- headers: _context17.t6,
716
- body: _context17.t7
717
- };
718
- _context17.t0.toBeCalledOnceWith.call(_context17.t0, _context17.t1, _context17.t8);
704
+ _t27.toBeCalledOnceWith.call(_t27, _t28, {
705
+ method: _t29,
706
+ headers: _t32,
707
+ body: _t33
708
+ });
719
709
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
720
710
  statusCode: 400
721
711
  }, methodDetails);
722
712
  expect(errorSpy).toHaveBeenCalled();
723
713
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
724
- case 23:
714
+ case 3:
725
715
  case "end":
726
716
  return _context17.stop();
727
717
  }
728
718
  }, _callee17);
729
719
  })));
730
720
  it('Error: deleteCallHistoryRecords throw 401 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
731
- var deleteSessionIds, response, convertedEndTimeSessionIds;
732
- return _regenerator.default.wrap(function _callee18$(_context18) {
721
+ var deleteSessionIds, response, convertedEndTimeSessionIds, _t34, _t35, _t36, _t37, _t38, _t39, _t40;
722
+ return _regenerator.default.wrap(function (_context18) {
733
723
  while (1) switch (_context18.prev = _context18.next) {
734
724
  case 0:
735
725
  deleteSessionIds = [];
@@ -739,9 +729,9 @@ describe('Call history tests', function () {
739
729
  ok: false
740
730
  });
741
731
  });
742
- _context18.next = 4;
732
+ _context18.next = 1;
743
733
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
744
- case 4:
734
+ case 1:
745
735
  response = _context18.sent;
746
736
  convertedEndTimeSessionIds = deleteSessionIds.map(function (session) {
747
737
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -750,25 +740,23 @@ describe('Call history tests', function () {
750
740
  });
751
741
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_401);
752
742
  expect(response.statusCode).toBe(401);
753
- _context18.t0 = expect(global.fetch);
754
- _context18.t1 = _callHistoryFixtures.janusMarkAsDeletedUrl;
755
- _context18.t2 = _types2.HTTP_METHODS.POST;
756
- _context18.t3 = _defineProperty2.default;
757
- _context18.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
758
- _context18.next = 15;
743
+ _t34 = expect(global.fetch);
744
+ _t35 = _callHistoryFixtures.janusMarkAsDeletedUrl;
745
+ _t36 = _types2.HTTP_METHODS.POST;
746
+ _t37 = _defineProperty2.default;
747
+ _t38 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
748
+ _context18.next = 2;
759
749
  return webex.credentials.getUserToken();
760
- case 15:
761
- _context18.t5 = _context18.sent;
762
- _context18.t6 = (0, _context18.t3)(_context18.t4, "Authorization", _context18.t5);
763
- _context18.t7 = (0, _stringify.default)({
750
+ case 2:
751
+ _t39 = _t37(_t38, "Authorization", _context18.sent);
752
+ _t40 = (0, _stringify.default)({
764
753
  deleteSessionIds: convertedEndTimeSessionIds
765
754
  });
766
- _context18.t8 = {
767
- method: _context18.t2,
768
- headers: _context18.t6,
769
- body: _context18.t7
770
- };
771
- _context18.t0.toBeCalledOnceWith.call(_context18.t0, _context18.t1, _context18.t8);
755
+ _t34.toBeCalledOnceWith.call(_t34, _t35, {
756
+ method: _t36,
757
+ headers: _t39,
758
+ body: _t40
759
+ });
772
760
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
773
761
  statusCode: 401
774
762
  }, methodDetails);
@@ -777,7 +765,7 @@ describe('Call history tests', function () {
777
765
  method: _constants.METHODS.DELETE_CALL_HISTORY_RECORDS
778
766
  });
779
767
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
780
- case 23:
768
+ case 3:
781
769
  case "end":
782
770
  return _context18.stop();
783
771
  }
@@ -785,7 +773,7 @@ describe('Call history tests', function () {
785
773
  })));
786
774
  it('handles invalid date formats gracefully', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
787
775
  var deleteSessionIds, response;
788
- return _regenerator.default.wrap(function _callee19$(_context19) {
776
+ return _regenerator.default.wrap(function (_context19) {
789
777
  while (1) switch (_context19.prev = _context19.next) {
790
778
  case 0:
791
779
  deleteSessionIds = [{
@@ -798,9 +786,9 @@ describe('Call history tests', function () {
798
786
  ok: false
799
787
  });
800
788
  });
801
- _context19.next = 4;
789
+ _context19.next = 1;
802
790
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
803
- case 4:
791
+ case 1:
804
792
  response = _context19.sent;
805
793
  expect(response.statusCode).toBe(400);
806
794
  expect(response).toEqual(_callHistoryFixtures.MOCK_DELETE_CALL_HISTORY_INVALID_DATE_RESPONSE);
@@ -808,12 +796,121 @@ describe('Call history tests', function () {
808
796
  // Verify logs were called with correct information
809
797
  expect(infoSpy).toHaveBeenCalledWith(expect.stringContaining('The provided date is malformed or invalid'), methodDetails);
810
798
  expect(uploadLogsSpy).not.toHaveBeenCalled();
811
- case 9:
799
+ case 2:
812
800
  case "end":
813
801
  return _context19.stop();
814
802
  }
815
803
  }, _callee19);
816
804
  })));
817
805
  });
806
+ describe('URL construction for shared sessions based on calling backend', function () {
807
+ var webexRequestSpy;
808
+ beforeEach(function () {
809
+ webexRequestSpy = jest.spyOn(webex, 'request').mockResolvedValue({
810
+ statusCode: 200,
811
+ body: {
812
+ statusCode: 200,
813
+ userSessions: []
814
+ }
815
+ });
816
+ });
817
+ afterEach(function () {
818
+ jest.restoreAllMocks();
819
+ });
820
+ it('should include includeSharedSessions=true for WXC backend', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
821
+ var callArgs;
822
+ return _regenerator.default.wrap(function (_context20) {
823
+ while (1) switch (_context20.prev = _context20.next) {
824
+ case 0:
825
+ jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.WXC);
826
+ _context20.next = 1;
827
+ return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
828
+ case 1:
829
+ callArgs = webexRequestSpy.mock.calls[0][0];
830
+ expect(callArgs.uri).toContain('&includeSharedSessions=true');
831
+ expect(callArgs.method).toBe(_types2.HTTP_METHODS.GET);
832
+ expect(callArgs.service).toBe('janus');
833
+ case 2:
834
+ case "end":
835
+ return _context20.stop();
836
+ }
837
+ }, _callee20);
838
+ })));
839
+ it('should NOT include includeSharedSessions for UCM backend', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
840
+ var callArgs;
841
+ return _regenerator.default.wrap(function (_context21) {
842
+ while (1) switch (_context21.prev = _context21.next) {
843
+ case 0:
844
+ jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
845
+ _context21.next = 1;
846
+ return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
847
+ case 1:
848
+ callArgs = webexRequestSpy.mock.calls[0][0];
849
+ expect(callArgs.uri).not.toContain('includeSharedSessions');
850
+ expect(callArgs.method).toBe(_types2.HTTP_METHODS.GET);
851
+ expect(callArgs.service).toBe('janus');
852
+ case 2:
853
+ case "end":
854
+ return _context21.stop();
855
+ }
856
+ }, _callee21);
857
+ })));
858
+ it('should NOT include includeSharedSessions for BWRKS backend', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
859
+ var callArgs;
860
+ return _regenerator.default.wrap(function (_context22) {
861
+ while (1) switch (_context22.prev = _context22.next) {
862
+ case 0:
863
+ jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.BWRKS);
864
+ _context22.next = 1;
865
+ return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
866
+ case 1:
867
+ callArgs = webexRequestSpy.mock.calls[0][0];
868
+ expect(callArgs.uri).not.toContain('includeSharedSessions');
869
+ expect(callArgs.method).toBe(_types2.HTTP_METHODS.GET);
870
+ expect(callArgs.service).toBe('janus');
871
+ case 2:
872
+ case "end":
873
+ return _context22.stop();
874
+ }
875
+ }, _callee22);
876
+ })));
877
+ it('should NOT include includeSharedSessions for unknown/other backends', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
878
+ var callArgs;
879
+ return _regenerator.default.wrap(function (_context23) {
880
+ while (1) switch (_context23.prev = _context23.next) {
881
+ case 0:
882
+ jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue('OTHER_BACKEND');
883
+ _context23.next = 1;
884
+ return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
885
+ case 1:
886
+ callArgs = webexRequestSpy.mock.calls[0][0];
887
+ expect(callArgs.uri).not.toContain('includeSharedSessions');
888
+ expect(callArgs.method).toBe(_types2.HTTP_METHODS.GET);
889
+ expect(callArgs.service).toBe('janus');
890
+ case 2:
891
+ case "end":
892
+ return _context23.stop();
893
+ }
894
+ }, _callee23);
895
+ })));
896
+ it('should construct URL correctly with base parameters for all backends', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
897
+ var callArgs;
898
+ return _regenerator.default.wrap(function (_context24) {
899
+ while (1) switch (_context24.prev = _context24.next) {
900
+ case 0:
901
+ jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.WXC);
902
+ _context24.next = 1;
903
+ return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
904
+ case 1:
905
+ callArgs = webexRequestSpy.mock.calls[0][0];
906
+ expect(callArgs.uri).toMatch(/.*\/history\/userSessions.*limit=10.*includeNewSessionTypes=true.*sort=DESC.*/);
907
+ expect(callArgs.uri).toContain('&includeSharedSessions=true');
908
+ case 2:
909
+ case "end":
910
+ return _context24.stop();
911
+ }
912
+ }, _callee24);
913
+ })));
914
+ });
818
915
  });
819
916
  //# sourceMappingURL=CallHistory.test.js.map