@webex/calling 3.10.0 → 3.11.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/CallHistory/CallHistory.js +128 -133
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +289 -186
  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 +72 -25
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +138 -48
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +138 -145
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +149 -150
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +407 -359
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +378 -401
  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 +666 -624
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +908 -556
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +22 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +114 -114
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/constants.js +7 -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 +675 -527
  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/registration/webWorkerStr.js +1 -1
  49. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  50. package/dist/CallingClient/types.js.map +1 -1
  51. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  52. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  53. package/dist/Contacts/ContactsClient.js +259 -268
  54. package/dist/Contacts/ContactsClient.js.map +1 -1
  55. package/dist/Contacts/ContactsClient.test.js +64 -63
  56. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  57. package/dist/Errors/catalog/CallError.js +7 -10
  58. package/dist/Errors/catalog/CallError.js.map +1 -1
  59. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  60. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  61. package/dist/Errors/catalog/ExtendedError.js +6 -8
  62. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  63. package/dist/Errors/catalog/LineError.js +6 -9
  64. package/dist/Errors/catalog/LineError.js.map +1 -1
  65. package/dist/Events/impl/index.js +12 -14
  66. package/dist/Events/impl/index.js.map +1 -1
  67. package/dist/Logger/index.js +3 -3
  68. package/dist/Logger/index.js.map +1 -1
  69. package/dist/Logger/index.test.js +1 -1
  70. package/dist/Logger/index.test.js.map +1 -1
  71. package/dist/Metrics/index.js +1 -2
  72. package/dist/Metrics/index.js.map +1 -1
  73. package/dist/SDKConnector/index.js +1 -2
  74. package/dist/SDKConnector/index.js.map +1 -1
  75. package/dist/SDKConnector/types.js.map +1 -1
  76. package/dist/Voicemail/BroadworksBackendConnector.js +131 -139
  77. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  78. package/dist/Voicemail/BroadworksBackendConnector.test.js +106 -98
  79. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  80. package/dist/Voicemail/UcmBackendConnector.js +88 -92
  81. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  82. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  83. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  84. package/dist/Voicemail/Voicemail.js +103 -131
  85. package/dist/Voicemail/Voicemail.js.map +1 -1
  86. package/dist/Voicemail/Voicemail.test.js +20 -20
  87. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  88. package/dist/Voicemail/WxCallBackendConnector.js +117 -131
  89. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  90. package/dist/Voicemail/WxCallBackendConnector.test.js +180 -154
  91. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  92. package/dist/common/Utils.js +198 -166
  93. package/dist/common/Utils.js.map +1 -1
  94. package/dist/common/Utils.test.js +436 -191
  95. package/dist/common/Utils.test.js.map +1 -1
  96. package/dist/common/constants.js +3 -1
  97. package/dist/common/constants.js.map +1 -1
  98. package/dist/common/testUtil.js +5 -4
  99. package/dist/common/testUtil.js.map +1 -1
  100. package/dist/common/types.js.map +1 -1
  101. package/dist/module/CallHistory/CallHistory.js +20 -11
  102. package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
  103. package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
  104. package/dist/module/CallingClient/CallingClient.js +125 -123
  105. package/dist/module/CallingClient/calling/call.js +76 -60
  106. package/dist/module/CallingClient/calling/callManager.js +7 -0
  107. package/dist/module/CallingClient/constants.js +5 -0
  108. package/dist/module/CallingClient/registration/register.js +93 -5
  109. package/dist/module/CallingClient/registration/webWorker.js +2 -2
  110. package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
  111. package/dist/module/Contacts/ContactsClient.js +19 -25
  112. package/dist/module/Events/impl/index.js +1 -1
  113. package/dist/module/Logger/index.js +2 -2
  114. package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
  115. package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
  116. package/dist/module/Voicemail/Voicemail.js +42 -68
  117. package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
  118. package/dist/module/common/Utils.js +31 -5
  119. package/dist/module/common/constants.js +2 -0
  120. package/dist/module/common/testUtil.js +1 -0
  121. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  122. package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
  123. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  124. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  125. package/dist/types/CallingClient/CallingClient.d.ts +2 -1
  126. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  127. package/dist/types/CallingClient/calling/call.d.ts +4 -0
  128. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  129. package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
  130. package/dist/types/CallingClient/constants.d.ts +5 -0
  131. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  132. package/dist/types/CallingClient/registration/register.d.ts +6 -1
  133. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  134. package/dist/types/CallingClient/registration/types.d.ts +8 -1
  135. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  136. package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
  137. package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
  138. package/dist/types/CallingClient/types.d.ts +2 -1
  139. package/dist/types/CallingClient/types.d.ts.map +1 -1
  140. package/dist/types/Contacts/ContactsClient.d.ts +1 -0
  141. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  142. package/dist/types/Logger/index.d.ts +1 -2
  143. package/dist/types/Logger/index.d.ts.map +1 -1
  144. package/dist/types/SDKConnector/types.d.ts +16 -0
  145. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  146. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  147. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  148. package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
  149. package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
  150. package/dist/types/common/Utils.d.ts +1 -1
  151. package/dist/types/common/Utils.d.ts.map +1 -1
  152. package/dist/types/common/constants.d.ts +2 -0
  153. package/dist/types/common/constants.d.ts.map +1 -1
  154. package/dist/types/common/testUtil.d.ts +1 -0
  155. package/dist/types/common/testUtil.d.ts.map +1 -1
  156. package/dist/types/common/types.d.ts +4 -0
  157. package/dist/types/common/types.d.ts.map +1 -1
  158. package/package.json +4 -4
@@ -9,8 +9,8 @@ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/de
9
9
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
10
10
  var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
11
11
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
12
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
13
12
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
13
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
14
14
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
15
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
16
16
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
@@ -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');
@@ -99,9 +99,12 @@ describe('Call history tests', function () {
99
99
  file: _constants.CALL_HISTORY_FILE,
100
100
  method: _constants.METHODS.GET_CALL_HISTORY_DATA
101
101
  });
102
- expect(errorSpy).toHaveBeenCalled();
102
+ expect(errorSpy).toHaveBeenCalledWith("Failed to get call history: ".concat((0, _stringify.default)(failurePayload)), {
103
+ file: _constants.CALL_HISTORY_FILE,
104
+ method: _constants.METHODS.GET_CALL_HISTORY_DATA
105
+ });
103
106
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
104
- case 11:
107
+ case 2:
105
108
  case "end":
106
109
  return _context2.stop();
107
110
  }
@@ -109,7 +112,7 @@ describe('Call history tests', function () {
109
112
  })));
110
113
  it('verify device not found call history case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
111
114
  var failurePayload, callHistoryPayload, response;
112
- return _regenerator.default.wrap(function _callee3$(_context3) {
115
+ return _regenerator.default.wrap(function (_context3) {
113
116
  while (1) switch (_context3.prev = _context3.next) {
114
117
  case 0:
115
118
  failurePayload = {
@@ -117,9 +120,9 @@ describe('Call history tests', function () {
117
120
  };
118
121
  callHistoryPayload = failurePayload;
119
122
  webex.request.mockRejectedValue(callHistoryPayload);
120
- _context3.next = 5;
123
+ _context3.next = 1;
121
124
  return callHistory.getCallHistoryData(0, 0, _types2.SORT.ASC, _types2.SORT_BY.START_TIME);
122
- case 5:
125
+ case 1:
123
126
  response = _context3.sent;
124
127
  expect(response.statusCode).toBe(404);
125
128
  expect(response.message).toBe('FAILURE');
@@ -129,9 +132,12 @@ describe('Call history tests', function () {
129
132
  file: _constants.CALL_HISTORY_FILE,
130
133
  method: _constants.METHODS.GET_CALL_HISTORY_DATA
131
134
  });
132
- expect(errorSpy).toHaveBeenCalled();
135
+ expect(errorSpy).toHaveBeenCalledWith("Failed to get call history: ".concat((0, _stringify.default)(failurePayload)), {
136
+ file: _constants.CALL_HISTORY_FILE,
137
+ method: _constants.METHODS.GET_CALL_HISTORY_DATA
138
+ });
133
139
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
134
- case 11:
140
+ case 2:
135
141
  case "end":
136
142
  return _context3.stop();
137
143
  }
@@ -140,14 +146,14 @@ describe('Call history tests', function () {
140
146
  describe('sorting user session response data by sortby', function () {
141
147
  it('Array should be sort.ASC by START TIME ', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
142
148
  var callHistoryPayload, response, responseDetails;
143
- return _regenerator.default.wrap(function _callee4$(_context4) {
149
+ return _regenerator.default.wrap(function (_context4) {
144
150
  while (1) switch (_context4.prev = _context4.next) {
145
151
  case 0:
146
152
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
147
153
  webex.request.mockResolvedValue(callHistoryPayload);
148
- _context4.next = 4;
154
+ _context4.next = 1;
149
155
  return callHistory.getCallHistoryData(10, 20, _types2.SORT.ASC, _types2.SORT_BY.START_TIME);
150
- case 4:
156
+ case 1:
151
157
  response = _context4.sent;
152
158
  responseDetails = {
153
159
  statusCode: _callHistoryFixtures.sortedCallHistory.body.statusCode,
@@ -163,7 +169,7 @@ describe('Call history tests', function () {
163
169
  file: _constants.CALL_HISTORY_FILE,
164
170
  method: _constants.METHODS.GET_CALL_HISTORY_DATA
165
171
  });
166
- case 8:
172
+ case 2:
167
173
  case "end":
168
174
  return _context4.stop();
169
175
  }
@@ -197,10 +203,10 @@ describe('Call history tests', function () {
197
203
  callSessionCallback(_callHistoryFixtures.MOCK_SESSION_EVENT_LEGACY);
198
204
  });
199
205
  it('verify the user viewed session event for missed calls update', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
200
- return _regenerator.default.wrap(function _callee5$(_context5) {
206
+ return _regenerator.default.wrap(function (_context5) {
201
207
  while (1) switch (_context5.prev = _context5.next) {
202
208
  case 0:
203
- _context5.next = 2;
209
+ _context5.next = 1;
204
210
  return new _promise.default(function (resolve) {
205
211
  callHistory.on(_types3.COMMON_EVENT_KEYS.CALL_HISTORY_USER_VIEWED_SESSIONS, function (event) {
206
212
  expect(event.data).toEqual(_callHistoryFixtures.MOCK_SESSION_EVENT_VIEWED.data);
@@ -210,17 +216,17 @@ describe('Call history tests', function () {
210
216
  var callSessionCallback = mockOn.mock.calls[2][1];
211
217
  callSessionCallback(_callHistoryFixtures.MOCK_SESSION_EVENT_VIEWED);
212
218
  });
213
- case 2:
219
+ case 1:
214
220
  case "end":
215
221
  return _context5.stop();
216
222
  }
217
223
  }, _callee5);
218
224
  })));
219
225
  it('verify the user sessions deleted event for deleting the call history records', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
220
- return _regenerator.default.wrap(function _callee6$(_context6) {
226
+ return _regenerator.default.wrap(function (_context6) {
221
227
  while (1) switch (_context6.prev = _context6.next) {
222
228
  case 0:
223
- _context6.next = 2;
229
+ _context6.next = 1;
224
230
  return new _promise.default(function (resolve) {
225
231
  callHistory.on(_types3.COMMON_EVENT_KEYS.CALL_HISTORY_USER_SESSIONS_DELETED, function (event) {
226
232
  expect(event.data).toEqual(_callHistoryFixtures.MOCK_SESSION_EVENT_DELETED.data);
@@ -230,7 +236,7 @@ describe('Call history tests', function () {
230
236
  var callSessionCallback = mockOn.mock.calls[3][1];
231
237
  callSessionCallback(_callHistoryFixtures.MOCK_SESSION_EVENT_DELETED);
232
238
  });
233
- case 2:
239
+ case 1:
234
240
  case "end":
235
241
  return _context6.stop();
236
242
  }
@@ -246,7 +252,7 @@ describe('Call history tests', function () {
246
252
  jest.clearAllMocks();
247
253
  });
248
254
  beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
249
- return _regenerator.default.wrap(function _callee7$(_context7) {
255
+ return _regenerator.default.wrap(function (_context7) {
250
256
  while (1) switch (_context7.prev = _context7.next) {
251
257
  case 0:
252
258
  serviceErrorCodeHandlerSpy = jest.spyOn(utils, 'serviceErrorCodeHandler');
@@ -260,24 +266,24 @@ describe('Call history tests', function () {
260
266
  }
261
267
  });
262
268
  });
263
- case 3:
269
+ case 1:
264
270
  case "end":
265
271
  return _context7.stop();
266
272
  }
267
273
  }, _callee7);
268
274
  })));
269
275
  it('successfully updates missed calls', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
270
- var endTimeSessionIds, response, convertedEndTimeSessionIds;
271
- 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) {
272
278
  while (1) switch (_context8.prev = _context8.next) {
273
279
  case 0:
274
280
  endTimeSessionIds = [{
275
281
  endTime: '1234568',
276
282
  sessionId: '123'
277
283
  }];
278
- _context8.next = 3;
284
+ _context8.next = 1;
279
285
  return callHistory.updateMissedCalls(endTimeSessionIds);
280
- case 3:
286
+ case 1:
281
287
  response = _context8.sent;
282
288
  convertedEndTimeSessionIds = endTimeSessionIds.map(function (session) {
283
289
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -286,39 +292,37 @@ describe('Call history tests', function () {
286
292
  });
287
293
  expect(response.statusCode).toEqual(200);
288
294
  expect(response).toEqual(_callHistoryFixtures.MOCK_UPDATE_MISSED_CALL_RESPONSE);
289
- _context8.t0 = expect(global.fetch);
290
- _context8.t1 = _callHistoryFixtures.janusSetReadStateUrl;
291
- _context8.t2 = _types2.HTTP_METHODS.POST;
292
- _context8.t3 = _defineProperty2.default;
293
- _context8.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
294
- _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;
295
301
  return webex.credentials.getUserToken();
296
- case 14:
297
- _context8.t5 = _context8.sent;
298
- _context8.t6 = (0, _context8.t3)(_context8.t4, "Authorization", _context8.t5);
299
- _context8.t7 = (0, _stringify.default)({
302
+ case 2:
303
+ _t6 = _t4(_t5, "Authorization", _context8.sent);
304
+ _t7 = (0, _stringify.default)({
300
305
  endTimeSessionIds: convertedEndTimeSessionIds
301
306
  });
302
- _context8.t8 = {
303
- method: _context8.t2,
304
- headers: _context8.t6,
305
- body: _context8.t7
306
- };
307
- _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
+ });
308
312
  // Verify logs were called with correct information
309
313
  expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with sessions: ").concat((0, _stringify.default)(convertedEndTimeSessionIds)), methodDetails);
310
314
  expect(logSpy).toHaveBeenCalledWith('Missed calls are successfully read by the user', methodDetails);
311
315
  expect(errorSpy).not.toHaveBeenCalled();
312
316
  expect(uploadLogsSpy).not.toHaveBeenCalled();
313
- case 23:
317
+ case 3:
314
318
  case "end":
315
319
  return _context8.stop();
316
320
  }
317
321
  }, _callee8);
318
322
  })));
319
323
  it('Error: updateMissedCalls throw 400 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
320
- var endTimeSessionIds, response, convertedEndTimeSessionIds;
321
- 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) {
322
326
  while (1) switch (_context9.prev = _context9.next) {
323
327
  case 0:
324
328
  endTimeSessionIds = [];
@@ -328,9 +332,9 @@ describe('Call history tests', function () {
328
332
  ok: false
329
333
  });
330
334
  });
331
- _context9.next = 4;
335
+ _context9.next = 1;
332
336
  return callHistory.updateMissedCalls(endTimeSessionIds);
333
- case 4:
337
+ case 1:
334
338
  response = _context9.sent;
335
339
  convertedEndTimeSessionIds = endTimeSessionIds.map(function (session) {
336
340
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -339,39 +343,37 @@ describe('Call history tests', function () {
339
343
  });
340
344
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_400);
341
345
  expect(response.statusCode).toBe(400);
342
- _context9.t0 = expect(global.fetch);
343
- _context9.t1 = _callHistoryFixtures.janusSetReadStateUrl;
344
- _context9.t2 = _types2.HTTP_METHODS.POST;
345
- _context9.t3 = _defineProperty2.default;
346
- _context9.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
347
- _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;
348
352
  return webex.credentials.getUserToken();
349
- case 15:
350
- _context9.t5 = _context9.sent;
351
- _context9.t6 = (0, _context9.t3)(_context9.t4, "Authorization", _context9.t5);
352
- _context9.t7 = (0, _stringify.default)({
353
+ case 2:
354
+ _t11 = _t1(_t10, "Authorization", _context9.sent);
355
+ _t12 = (0, _stringify.default)({
353
356
  endTimeSessionIds: convertedEndTimeSessionIds
354
357
  });
355
- _context9.t8 = {
356
- method: _context9.t2,
357
- headers: _context9.t6,
358
- body: _context9.t7
359
- };
360
- _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
+ });
361
363
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
362
364
  statusCode: 400
363
365
  }, methodDetails);
364
- expect(errorSpy).toHaveBeenCalled();
366
+ expect(errorSpy).toBeCalledWith(expect.stringContaining('Failed to update missed calls'), methodDetails);
365
367
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
366
- case 23:
368
+ case 3:
367
369
  case "end":
368
370
  return _context9.stop();
369
371
  }
370
372
  }, _callee9);
371
373
  })));
372
374
  it('Error: updateMissedCalls throw 401 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
373
- var endTimeSessionIds, response, convertedEndTimeSessionIds;
374
- 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) {
375
377
  while (1) switch (_context0.prev = _context0.next) {
376
378
  case 0:
377
379
  endTimeSessionIds = [];
@@ -381,9 +383,9 @@ describe('Call history tests', function () {
381
383
  ok: false
382
384
  });
383
385
  });
384
- _context0.next = 4;
386
+ _context0.next = 1;
385
387
  return callHistory.updateMissedCalls(endTimeSessionIds);
386
- case 4:
388
+ case 1:
387
389
  response = _context0.sent;
388
390
  convertedEndTimeSessionIds = endTimeSessionIds.map(function (session) {
389
391
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -392,31 +394,29 @@ describe('Call history tests', function () {
392
394
  });
393
395
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_401);
394
396
  expect(response.statusCode).toBe(401);
395
- _context0.t0 = expect(global.fetch);
396
- _context0.t1 = _callHistoryFixtures.janusSetReadStateUrl;
397
- _context0.t2 = _types2.HTTP_METHODS.POST;
398
- _context0.t3 = _defineProperty2.default;
399
- _context0.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
400
- _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;
401
403
  return webex.credentials.getUserToken();
402
- case 15:
403
- _context0.t5 = _context0.sent;
404
- _context0.t6 = (0, _context0.t3)(_context0.t4, "Authorization", _context0.t5);
405
- _context0.t7 = (0, _stringify.default)({
404
+ case 2:
405
+ _t18 = _t16(_t17, "Authorization", _context0.sent);
406
+ _t19 = (0, _stringify.default)({
406
407
  endTimeSessionIds: convertedEndTimeSessionIds
407
408
  });
408
- _context0.t8 = {
409
- method: _context0.t2,
410
- headers: _context0.t6,
411
- body: _context0.t7
412
- };
413
- _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
+ });
414
414
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
415
415
  statusCode: 401
416
416
  }, methodDetails);
417
417
  expect(errorSpy).toHaveBeenCalled();
418
418
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
419
- case 23:
419
+ case 3:
420
420
  case "end":
421
421
  return _context0.stop();
422
422
  }
@@ -429,14 +429,14 @@ describe('Call history tests', function () {
429
429
  });
430
430
  it('verify successful UCM lines API case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
431
431
  var ucmLinesAPIPayload, response;
432
- return _regenerator.default.wrap(function _callee1$(_context1) {
432
+ return _regenerator.default.wrap(function (_context1) {
433
433
  while (1) switch (_context1.prev = _context1.next) {
434
434
  case 0:
435
435
  ucmLinesAPIPayload = _callHistoryFixtures.MOCK_LINES_API_CALL_RESPONSE;
436
436
  webex.request.mockResolvedValue(ucmLinesAPIPayload);
437
- _context1.next = 4;
437
+ _context1.next = 1;
438
438
  return callHistory['fetchUCMLinesData']();
439
- case 4:
439
+ case 1:
440
440
  response = _context1.sent;
441
441
  expect(response.statusCode).toBe(200);
442
442
  expect(response.message).toBe('SUCCESS');
@@ -452,7 +452,7 @@ describe('Call history tests', function () {
452
452
  });
453
453
  expect(errorSpy).not.toHaveBeenCalled();
454
454
  expect(uploadLogsSpy).not.toHaveBeenCalled();
455
- case 11:
455
+ case 2:
456
456
  case "end":
457
457
  return _context1.stop();
458
458
  }
@@ -460,7 +460,7 @@ describe('Call history tests', function () {
460
460
  })));
461
461
  it('verify bad request failed UCM lines API case', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
462
462
  var failurePayload, ucmLinesAPIPayload, response;
463
- return _regenerator.default.wrap(function _callee10$(_context10) {
463
+ return _regenerator.default.wrap(function (_context10) {
464
464
  while (1) switch (_context10.prev = _context10.next) {
465
465
  case 0:
466
466
  failurePayload = {
@@ -468,9 +468,9 @@ describe('Call history tests', function () {
468
468
  };
469
469
  ucmLinesAPIPayload = failurePayload;
470
470
  webex.request.mockRejectedValue(ucmLinesAPIPayload);
471
- _context10.next = 5;
471
+ _context10.next = 1;
472
472
  return callHistory['fetchUCMLinesData']();
473
- case 5:
473
+ case 1:
474
474
  response = _context10.sent;
475
475
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_400);
476
476
  expect(response.data.error).toEqual(_callHistoryFixtures.ERROR_DETAILS_400.data.error);
@@ -490,7 +490,7 @@ describe('Call history tests', function () {
490
490
  });
491
491
  expect(errorSpy).toHaveBeenCalled();
492
492
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
493
- case 14:
493
+ case 2:
494
494
  case "end":
495
495
  return _context10.stop();
496
496
  }
@@ -498,7 +498,7 @@ describe('Call history tests', function () {
498
498
  })));
499
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() {
500
500
  var fetchUCMLinesDataSpy, mockCallHistoryPayload, response;
501
- return _regenerator.default.wrap(function _callee11$(_context11) {
501
+ return _regenerator.default.wrap(function (_context11) {
502
502
  while (1) switch (_context11.prev = _context11.next) {
503
503
  case 0:
504
504
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
@@ -507,14 +507,14 @@ describe('Call history tests', function () {
507
507
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue(_callHistoryFixtures.MOCK_LINES_API_CALL_RESPONSE);
508
508
  mockCallHistoryPayload = _callHistoryFixtures.MOCK_CALL_HISTORY_WITH_UCM_LINE_NUMBER;
509
509
  webex.request.mockResolvedValue(mockCallHistoryPayload);
510
- _context11.next = 6;
510
+ _context11.next = 1;
511
511
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
512
- case 6:
512
+ case 1:
513
513
  response = _context11.sent;
514
514
  expect(fetchUCMLinesDataSpy).toHaveBeenCalledTimes(1);
515
515
  expect(response.statusCode).toBe(200);
516
516
  expect(response.data.userSessions && response.data.userSessions[0].self.ucmLineNumber).toEqual(1);
517
- case 10:
517
+ case 2:
518
518
  case "end":
519
519
  return _context11.stop();
520
520
  }
@@ -522,7 +522,7 @@ describe('Call history tests', function () {
522
522
  })));
523
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() {
524
524
  var fetchUCMLinesDataSpy, mockCallHistoryPayload, response;
525
- return _regenerator.default.wrap(function _callee12$(_context12) {
525
+ return _regenerator.default.wrap(function (_context12) {
526
526
  while (1) switch (_context12.prev = _context12.next) {
527
527
  case 0:
528
528
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
@@ -532,15 +532,15 @@ describe('Call history tests', function () {
532
532
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue(_callHistoryFixtures.MOCK_LINES_API_CALL_RESPONSE_WITH_NO_LINEDATA);
533
533
  mockCallHistoryPayload = _callHistoryFixtures.MOCK_CALL_HISTORY_WITHOUT_UCM_LINE_NUMBER;
534
534
  webex.request.mockResolvedValue(mockCallHistoryPayload);
535
- _context12.next = 6;
535
+ _context12.next = 1;
536
536
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
537
- case 6:
537
+ case 1:
538
538
  response = _context12.sent;
539
539
  expect(fetchUCMLinesDataSpy).toHaveBeenCalledTimes(1);
540
540
  expect(response.statusCode).toBe(200);
541
541
  expect(response.data.userSessions && response.data.userSessions[0].self.cucmDN).toBeDefined();
542
542
  expect(response.data.userSessions && response.data.userSessions[0].self.ucmLineNumber).toEqual(undefined);
543
- case 11:
543
+ case 2:
544
544
  case "end":
545
545
  return _context12.stop();
546
546
  }
@@ -548,7 +548,7 @@ describe('Call history tests', function () {
548
548
  })));
549
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() {
550
550
  var fetchUCMLinesDataSpy, callHistoryPayload;
551
- return _regenerator.default.wrap(function _callee13$(_context13) {
551
+ return _regenerator.default.wrap(function (_context13) {
552
552
  while (1) switch (_context13.prev = _context13.next) {
553
553
  case 0:
554
554
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.UCM);
@@ -557,11 +557,11 @@ describe('Call history tests', function () {
557
557
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue({});
558
558
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
559
559
  webex.request.mockResolvedValue(callHistoryPayload);
560
- _context13.next = 6;
560
+ _context13.next = 1;
561
561
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
562
- case 6:
562
+ case 1:
563
563
  expect(fetchUCMLinesDataSpy).not.toHaveBeenCalled();
564
- case 7:
564
+ case 2:
565
565
  case "end":
566
566
  return _context13.stop();
567
567
  }
@@ -569,7 +569,7 @@ describe('Call history tests', function () {
569
569
  })));
570
570
  it('should not call fetchUCMLinesData when calling backend is not UCM', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
571
571
  var fetchUCMLinesDataSpy, callHistoryPayload;
572
- return _regenerator.default.wrap(function _callee14$(_context14) {
572
+ return _regenerator.default.wrap(function (_context14) {
573
573
  while (1) switch (_context14.prev = _context14.next) {
574
574
  case 0:
575
575
  jest.spyOn(utils, 'getCallingBackEnd').mockReturnValue(_types2.CALLING_BACKEND.WXC);
@@ -578,11 +578,11 @@ describe('Call history tests', function () {
578
578
  fetchUCMLinesDataSpy = jest.spyOn(callHistory, 'fetchUCMLinesData').mockResolvedValue({});
579
579
  callHistoryPayload = _callHistoryFixtures.mockCallHistoryBody;
580
580
  webex.request.mockResolvedValue(callHistoryPayload);
581
- _context14.next = 6;
581
+ _context14.next = 1;
582
582
  return callHistory.getCallHistoryData(7, 10, _types2.SORT.DEFAULT, _types2.SORT_BY.DEFAULT);
583
- case 6:
583
+ case 1:
584
584
  expect(fetchUCMLinesDataSpy).not.toHaveBeenCalled(); // Check that fetchUCMLinesData was not called
585
- case 7:
585
+ case 2:
586
586
  case "end":
587
587
  return _context14.stop();
588
588
  }
@@ -598,7 +598,7 @@ describe('Call history tests', function () {
598
598
  jest.clearAllMocks();
599
599
  });
600
600
  beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
601
- return _regenerator.default.wrap(function _callee15$(_context15) {
601
+ return _regenerator.default.wrap(function (_context15) {
602
602
  while (1) switch (_context15.prev = _context15.next) {
603
603
  case 0:
604
604
  serviceErrorCodeHandlerSpy = jest.spyOn(utils, 'serviceErrorCodeHandler');
@@ -612,24 +612,24 @@ describe('Call history tests', function () {
612
612
  }
613
613
  });
614
614
  });
615
- case 3:
615
+ case 1:
616
616
  case "end":
617
617
  return _context15.stop();
618
618
  }
619
619
  }, _callee15);
620
620
  })));
621
621
  it('successfully deletes the call history records', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
622
- var deleteSessionIds, response, convertedEndTimeSessionIds;
623
- 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) {
624
624
  while (1) switch (_context16.prev = _context16.next) {
625
625
  case 0:
626
626
  deleteSessionIds = [{
627
627
  endTime: '2024-10-22T08:50:48.603Z',
628
628
  sessionId: '123'
629
629
  }];
630
- _context16.next = 3;
630
+ _context16.next = 1;
631
631
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
632
- case 3:
632
+ case 1:
633
633
  response = _context16.sent;
634
634
  convertedEndTimeSessionIds = deleteSessionIds.map(function (session) {
635
635
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -638,39 +638,37 @@ describe('Call history tests', function () {
638
638
  });
639
639
  expect(response.statusCode).toEqual(200);
640
640
  expect(response).toEqual(_callHistoryFixtures.MOCK_DELETE_CALL_HISTORY_RECORDS_RESPONSE);
641
- _context16.t0 = expect(global.fetch);
642
- _context16.t1 = _callHistoryFixtures.janusMarkAsDeletedUrl;
643
- _context16.t2 = _types2.HTTP_METHODS.POST;
644
- _context16.t3 = _defineProperty2.default;
645
- _context16.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
646
- _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;
647
647
  return webex.credentials.getUserToken();
648
- case 14:
649
- _context16.t5 = _context16.sent;
650
- _context16.t6 = (0, _context16.t3)(_context16.t4, "Authorization", _context16.t5);
651
- _context16.t7 = (0, _stringify.default)({
648
+ case 2:
649
+ _t25 = _t23(_t24, "Authorization", _context16.sent);
650
+ _t26 = (0, _stringify.default)({
652
651
  deleteSessionIds: convertedEndTimeSessionIds
653
652
  });
654
- _context16.t8 = {
655
- method: _context16.t2,
656
- headers: _context16.t6,
657
- body: _context16.t7
658
- };
659
- _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
+ });
660
658
  // Verify logs were called with correct information
661
659
  expect(infoSpy).toHaveBeenCalledWith("".concat(_constants2.METHOD_START_MESSAGE, " with sessions: ").concat((0, _stringify.default)(deleteSessionIds)), methodDetails);
662
660
  expect(logSpy).toHaveBeenCalledWith("Successfully deleted ".concat(deleteSessionIds.length, " call history records"), methodDetails);
663
661
  expect(errorSpy).not.toHaveBeenCalled();
664
662
  expect(uploadLogsSpy).not.toHaveBeenCalled();
665
- case 23:
663
+ case 3:
666
664
  case "end":
667
665
  return _context16.stop();
668
666
  }
669
667
  }, _callee16);
670
668
  })));
671
669
  it('Error: deleteCallHistoryRecords throw 400 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
672
- var deleteSessionIds, response, convertedEndTimeSessionIds;
673
- 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) {
674
672
  while (1) switch (_context17.prev = _context17.next) {
675
673
  case 0:
676
674
  deleteSessionIds = [];
@@ -680,9 +678,9 @@ describe('Call history tests', function () {
680
678
  ok: false
681
679
  });
682
680
  });
683
- _context17.next = 4;
681
+ _context17.next = 1;
684
682
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
685
- case 4:
683
+ case 1:
686
684
  response = _context17.sent;
687
685
  convertedEndTimeSessionIds = deleteSessionIds.map(function (session) {
688
686
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -691,39 +689,37 @@ describe('Call history tests', function () {
691
689
  });
692
690
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_400);
693
691
  expect(response.statusCode).toBe(400);
694
- _context17.t0 = expect(global.fetch);
695
- _context17.t1 = _callHistoryFixtures.janusMarkAsDeletedUrl;
696
- _context17.t2 = _types2.HTTP_METHODS.POST;
697
- _context17.t3 = _defineProperty2.default;
698
- _context17.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
699
- _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;
700
698
  return webex.credentials.getUserToken();
701
- case 15:
702
- _context17.t5 = _context17.sent;
703
- _context17.t6 = (0, _context17.t3)(_context17.t4, "Authorization", _context17.t5);
704
- _context17.t7 = (0, _stringify.default)({
699
+ case 2:
700
+ _t32 = _t30(_t31, "Authorization", _context17.sent);
701
+ _t33 = (0, _stringify.default)({
705
702
  deleteSessionIds: convertedEndTimeSessionIds
706
703
  });
707
- _context17.t8 = {
708
- method: _context17.t2,
709
- headers: _context17.t6,
710
- body: _context17.t7
711
- };
712
- _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
+ });
713
709
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
714
710
  statusCode: 400
715
711
  }, methodDetails);
716
712
  expect(errorSpy).toHaveBeenCalled();
717
713
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
718
- case 23:
714
+ case 3:
719
715
  case "end":
720
716
  return _context17.stop();
721
717
  }
722
718
  }, _callee17);
723
719
  })));
724
720
  it('Error: deleteCallHistoryRecords throw 401 error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
725
- var deleteSessionIds, response, convertedEndTimeSessionIds;
726
- 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) {
727
723
  while (1) switch (_context18.prev = _context18.next) {
728
724
  case 0:
729
725
  deleteSessionIds = [];
@@ -733,9 +729,9 @@ describe('Call history tests', function () {
733
729
  ok: false
734
730
  });
735
731
  });
736
- _context18.next = 4;
732
+ _context18.next = 1;
737
733
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
738
- case 4:
734
+ case 1:
739
735
  response = _context18.sent;
740
736
  convertedEndTimeSessionIds = deleteSessionIds.map(function (session) {
741
737
  return _objectSpread(_objectSpread({}, session), {}, {
@@ -744,34 +740,32 @@ describe('Call history tests', function () {
744
740
  });
745
741
  expect(response).toStrictEqual(_callHistoryFixtures.ERROR_DETAILS_401);
746
742
  expect(response.statusCode).toBe(401);
747
- _context18.t0 = expect(global.fetch);
748
- _context18.t1 = _callHistoryFixtures.janusMarkAsDeletedUrl;
749
- _context18.t2 = _types2.HTTP_METHODS.POST;
750
- _context18.t3 = _defineProperty2.default;
751
- _context18.t4 = (0, _defineProperty2.default)({}, _constants.CONTENT_TYPE, _constants.APPLICATION_JSON);
752
- _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;
753
749
  return webex.credentials.getUserToken();
754
- case 15:
755
- _context18.t5 = _context18.sent;
756
- _context18.t6 = (0, _context18.t3)(_context18.t4, "Authorization", _context18.t5);
757
- _context18.t7 = (0, _stringify.default)({
750
+ case 2:
751
+ _t39 = _t37(_t38, "Authorization", _context18.sent);
752
+ _t40 = (0, _stringify.default)({
758
753
  deleteSessionIds: convertedEndTimeSessionIds
759
754
  });
760
- _context18.t8 = {
761
- method: _context18.t2,
762
- headers: _context18.t6,
763
- body: _context18.t7
764
- };
765
- _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
+ });
766
760
  expect(serviceErrorCodeHandlerSpy).toBeCalledOnceWith({
767
761
  statusCode: 401
768
762
  }, methodDetails);
769
- expect(errorSpy).toHaveBeenCalledWith(expect.any(Error), {
763
+ expect(errorSpy).toBeCalledWith(expect.stringContaining('Failed to delete call history records'), {
770
764
  file: _constants.CALL_HISTORY_FILE,
771
765
  method: _constants.METHODS.DELETE_CALL_HISTORY_RECORDS
772
766
  });
773
767
  expect(uploadLogsSpy).toHaveBeenCalledTimes(1);
774
- case 23:
768
+ case 3:
775
769
  case "end":
776
770
  return _context18.stop();
777
771
  }
@@ -779,7 +773,7 @@ describe('Call history tests', function () {
779
773
  })));
780
774
  it('handles invalid date formats gracefully', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
781
775
  var deleteSessionIds, response;
782
- return _regenerator.default.wrap(function _callee19$(_context19) {
776
+ return _regenerator.default.wrap(function (_context19) {
783
777
  while (1) switch (_context19.prev = _context19.next) {
784
778
  case 0:
785
779
  deleteSessionIds = [{
@@ -792,9 +786,9 @@ describe('Call history tests', function () {
792
786
  ok: false
793
787
  });
794
788
  });
795
- _context19.next = 4;
789
+ _context19.next = 1;
796
790
  return callHistory.deleteCallHistoryRecords(deleteSessionIds);
797
- case 4:
791
+ case 1:
798
792
  response = _context19.sent;
799
793
  expect(response.statusCode).toBe(400);
800
794
  expect(response).toEqual(_callHistoryFixtures.MOCK_DELETE_CALL_HISTORY_INVALID_DATE_RESPONSE);
@@ -802,12 +796,121 @@ describe('Call history tests', function () {
802
796
  // Verify logs were called with correct information
803
797
  expect(infoSpy).toHaveBeenCalledWith(expect.stringContaining('The provided date is malformed or invalid'), methodDetails);
804
798
  expect(uploadLogsSpy).not.toHaveBeenCalled();
805
- case 9:
799
+ case 2:
806
800
  case "end":
807
801
  return _context19.stop();
808
802
  }
809
803
  }, _callee19);
810
804
  })));
811
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
+ });
812
915
  });
813
916
  //# sourceMappingURL=CallHistory.test.js.map