@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
@@ -47,6 +47,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
47
47
  * @ignore
48
48
  */
49
49
  function ContactsClient(webex, logger) {
50
+ var _this$webex$internal$;
50
51
  (0, _classCallCheck2.default)(this, ContactsClient);
51
52
  (0, _defineProperty2.default)(this, "sdkConnector", void 0);
52
53
  (0, _defineProperty2.default)(this, "encryptionKeyUrl", void 0);
@@ -54,6 +55,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
54
55
  (0, _defineProperty2.default)(this, "groups", void 0);
55
56
  (0, _defineProperty2.default)(this, "contacts", void 0);
56
57
  (0, _defineProperty2.default)(this, "defaultGroupId", void 0);
58
+ (0, _defineProperty2.default)(this, "contactsServiceUrl", void 0);
57
59
  this.sdkConnector = _SDKConnector.default;
58
60
  if (!this.sdkConnector.getWebex()) {
59
61
  _SDKConnector.default.setWebex(webex);
@@ -63,33 +65,34 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
63
65
  this.groups = undefined;
64
66
  this.contacts = undefined;
65
67
  this.defaultGroupId = '';
68
+ this.contactsServiceUrl = ((_this$webex$internal$ = this.webex.internal.services._serviceUrls) === null || _this$webex$internal$ === void 0 ? void 0 : _this$webex$internal$.contactsService) || this.webex.internal.services.get(this.webex.internal.services._activeServices.contactsService);
66
69
  _Logger.default.setLogger(logger.level, _constants2.CONTACTS_CLIENT);
67
70
  }
68
71
 
69
72
  /**
70
73
  * Decrypt emails, phoneNumbers, sipAddresses.
71
74
  */
72
- (0, _createClass2.default)(ContactsClient, [{
75
+ return (0, _createClass2.default)(ContactsClient, [{
73
76
  key: "decryptContactDetail",
74
77
  value: (function () {
75
78
  var _decryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(encryptionKeyUrl, contactDetails) {
76
79
  var _this = this;
77
80
  var decryptedContactDetail, decryptedValues;
78
- return _regenerator.default.wrap(function _callee$(_context) {
81
+ return _regenerator.default.wrap(function (_context) {
79
82
  while (1) switch (_context.prev = _context.next) {
80
83
  case 0:
81
84
  decryptedContactDetail = (0, _toConsumableArray2.default)(contactDetails);
82
- _context.next = 3;
85
+ _context.next = 1;
83
86
  return _promise.default.all(decryptedContactDetail.map(function (detail) {
84
87
  return _this.webex.internal.encryption.decryptText(encryptionKeyUrl, detail.value);
85
88
  }));
86
- case 3:
89
+ case 1:
87
90
  decryptedValues = _context.sent;
88
91
  decryptedValues.forEach(function (decryptedValue, index) {
89
92
  decryptedContactDetail[index].value = decryptedValue;
90
93
  });
91
94
  return _context.abrupt("return", decryptedContactDetail);
92
- case 6:
95
+ case 2:
93
96
  case "end":
94
97
  return _context.stop();
95
98
  }
@@ -111,21 +114,21 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
111
114
  var _encryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(encryptionKeyUrl, contactDetails) {
112
115
  var _this2 = this;
113
116
  var encryptedContactDetail, encryptedValues;
114
- return _regenerator.default.wrap(function _callee2$(_context2) {
117
+ return _regenerator.default.wrap(function (_context2) {
115
118
  while (1) switch (_context2.prev = _context2.next) {
116
119
  case 0:
117
120
  encryptedContactDetail = (0, _toConsumableArray2.default)(contactDetails);
118
- _context2.next = 3;
121
+ _context2.next = 1;
119
122
  return _promise.default.all(encryptedContactDetail.map(function (detail) {
120
123
  return _this2.webex.internal.encryption.encryptText(encryptionKeyUrl, detail.value);
121
124
  }));
122
- case 3:
125
+ case 1:
123
126
  encryptedValues = _context2.sent;
124
127
  encryptedValues.forEach(function (encryptedValue, index) {
125
128
  encryptedContactDetail[index].value = encryptedValue;
126
129
  });
127
130
  return _context2.abrupt("return", encryptedContactDetail);
128
- case 6:
131
+ case 2:
129
132
  case "end":
130
133
  return _context2.stop();
131
134
  }
@@ -146,40 +149,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
146
149
  var _encryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(contact) {
147
150
  var _this3 = this;
148
151
  var encryptionKeyUrl, encryptedContact, encryptionPromises, encryptedFieldsList;
149
- return _regenerator.default.wrap(function _callee5$(_context5) {
152
+ return _regenerator.default.wrap(function (_context5) {
150
153
  while (1) switch (_context5.prev = _context5.next) {
151
154
  case 0:
152
155
  encryptionKeyUrl = contact.encryptionKeyUrl;
153
156
  encryptedContact = _objectSpread({}, contact);
154
157
  encryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
155
158
  var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(field) {
156
- var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue;
157
- return _regenerator.default.wrap(function _callee4$(_context4) {
159
+ var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue, _t3, _t4;
160
+ return _regenerator.default.wrap(function (_context4) {
158
161
  while (1) switch (_context4.prev = _context4.next) {
159
162
  case 0:
160
- _context4.t0 = field;
161
- _context4.next = _context4.t0 === _constants2.encryptedFields.ADDRESS_INFO ? 3 : _context4.t0 === _constants2.encryptedFields.EMAILS ? 12 : _context4.t0 === _constants2.encryptedFields.PHONE_NUMBERS ? 12 : _context4.t0 === _constants2.encryptedFields.SIP_ADDRESSES ? 12 : 18;
163
+ _t3 = field;
164
+ _context4.next = _t3 === _constants2.encryptedFields.ADDRESS_INFO ? 1 : _t3 === _constants2.encryptedFields.EMAILS ? 4 : _t3 === _constants2.encryptedFields.PHONE_NUMBERS ? 4 : _t3 === _constants2.encryptedFields.SIP_ADDRESSES ? 4 : 7;
162
165
  break;
163
- case 3:
166
+ case 1:
164
167
  plaintextAddressInfo = encryptedContact.addressInfo;
165
168
  if (!plaintextAddressInfo) {
166
- _context4.next = 11;
169
+ _context4.next = 3;
167
170
  break;
168
171
  }
169
172
  encryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
170
173
  var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref2) {
171
- var _ref4, key, value;
172
- return _regenerator.default.wrap(function _callee3$(_context3) {
174
+ var _ref4, key, value, _t, _t2;
175
+ return _regenerator.default.wrap(function (_context3) {
173
176
  while (1) switch (_context3.prev = _context3.next) {
174
177
  case 0:
175
178
  _ref4 = (0, _slicedToArray2.default)(_ref2, 2), key = _ref4[0], value = _ref4[1];
176
- _context3.t0 = key;
177
- _context3.next = 4;
179
+ _t = key;
180
+ _context3.next = 1;
178
181
  return _this3.webex.internal.encryption.encryptText(encryptionKeyUrl, value);
179
- case 4:
180
- _context3.t1 = _context3.sent;
181
- return _context3.abrupt("return", [_context3.t0, _context3.t1]);
182
- case 6:
182
+ case 1:
183
+ _t2 = _context3.sent;
184
+ return _context3.abrupt("return", [_t, _t2]);
185
+ case 2:
183
186
  case "end":
184
187
  return _context3.stop();
185
188
  }
@@ -189,38 +192,37 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
189
192
  return _ref3.apply(this, arguments);
190
193
  };
191
194
  }());
192
- _context4.t1 = Object;
193
- _context4.next = 9;
195
+ _t4 = Object;
196
+ _context4.next = 2;
194
197
  return _promise.default.all(encryptedAddressInfoPromises);
195
- case 9:
196
- _context4.t2 = _context4.sent;
197
- encryptedAddressInfo = _context4.t1.fromEntries.call(_context4.t1, _context4.t2);
198
- case 11:
198
+ case 2:
199
+ encryptedAddressInfo = _t4.fromEntries.call(_t4, _context4.sent);
200
+ case 3:
199
201
  return _context4.abrupt("return", [field, encryptedAddressInfo]);
200
- case 12:
202
+ case 4:
201
203
  plainTextDetails = encryptedContact[field];
202
204
  if (!plainTextDetails) {
203
- _context4.next = 17;
205
+ _context4.next = 6;
204
206
  break;
205
207
  }
206
- _context4.next = 16;
208
+ _context4.next = 5;
207
209
  return _this3.encryptContactDetail(encryptionKeyUrl, plainTextDetails);
208
- case 16:
210
+ case 5:
209
211
  encryptedDetails = _context4.sent;
210
- case 17:
212
+ case 6:
211
213
  return _context4.abrupt("return", [field, encryptedDetails]);
212
- case 18:
214
+ case 7:
213
215
  if (!((0, _values.default)(_constants2.encryptedFields).includes(field) && encryptedContact[field])) {
214
- _context4.next = 22;
216
+ _context4.next = 9;
215
217
  break;
216
218
  }
217
- _context4.next = 21;
219
+ _context4.next = 8;
218
220
  return _this3.webex.internal.encryption.encryptText(encryptionKeyUrl, encryptedContact[field]);
219
- case 21:
221
+ case 8:
220
222
  encryptedValue = _context4.sent;
221
- case 22:
223
+ case 9:
222
224
  return _context4.abrupt("return", [field, encryptedValue]);
223
- case 23:
225
+ case 10:
224
226
  case "end":
225
227
  return _context4.stop();
226
228
  }
@@ -230,9 +232,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
230
232
  return _ref.apply(this, arguments);
231
233
  };
232
234
  }());
233
- _context5.next = 5;
235
+ _context5.next = 1;
234
236
  return _promise.default.all(encryptionPromises);
235
- case 5:
237
+ case 1:
236
238
  encryptedFieldsList = _context5.sent;
237
239
  encryptedFieldsList.forEach(function (_ref5) {
238
240
  var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
@@ -243,7 +245,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
243
245
  }
244
246
  });
245
247
  return _context5.abrupt("return", encryptedContact);
246
- case 8:
248
+ case 2:
247
249
  case "end":
248
250
  return _context5.stop();
249
251
  }
@@ -264,40 +266,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
264
266
  var _decryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(contact) {
265
267
  var _this4 = this;
266
268
  var encryptionKeyUrl, decryptedContact, decryptionPromises, decryptedFieldsList;
267
- return _regenerator.default.wrap(function _callee8$(_context8) {
269
+ return _regenerator.default.wrap(function (_context8) {
268
270
  while (1) switch (_context8.prev = _context8.next) {
269
271
  case 0:
270
272
  encryptionKeyUrl = contact.encryptionKeyUrl;
271
273
  decryptedContact = _objectSpread({}, contact);
272
274
  decryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
273
275
  var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(field) {
274
- var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue;
275
- return _regenerator.default.wrap(function _callee7$(_context7) {
276
+ var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue, _t7, _t8;
277
+ return _regenerator.default.wrap(function (_context7) {
276
278
  while (1) switch (_context7.prev = _context7.next) {
277
279
  case 0:
278
- _context7.t0 = field;
279
- _context7.next = _context7.t0 === _constants2.encryptedFields.ADDRESS_INFO ? 3 : _context7.t0 === _constants2.encryptedFields.EMAILS ? 12 : _context7.t0 === _constants2.encryptedFields.PHONE_NUMBERS ? 12 : _context7.t0 === _constants2.encryptedFields.SIP_ADDRESSES ? 12 : 18;
280
+ _t7 = field;
281
+ _context7.next = _t7 === _constants2.encryptedFields.ADDRESS_INFO ? 1 : _t7 === _constants2.encryptedFields.EMAILS ? 4 : _t7 === _constants2.encryptedFields.PHONE_NUMBERS ? 4 : _t7 === _constants2.encryptedFields.SIP_ADDRESSES ? 4 : 7;
280
282
  break;
281
- case 3:
283
+ case 1:
282
284
  plaintextAddressInfo = decryptedContact.addressInfo;
283
285
  if (!plaintextAddressInfo) {
284
- _context7.next = 11;
286
+ _context7.next = 3;
285
287
  break;
286
288
  }
287
289
  decryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
288
290
  var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref8) {
289
- var _ref0, key, value;
290
- return _regenerator.default.wrap(function _callee6$(_context6) {
291
+ var _ref0, key, value, _t5, _t6;
292
+ return _regenerator.default.wrap(function (_context6) {
291
293
  while (1) switch (_context6.prev = _context6.next) {
292
294
  case 0:
293
295
  _ref0 = (0, _slicedToArray2.default)(_ref8, 2), key = _ref0[0], value = _ref0[1];
294
- _context6.t0 = key;
295
- _context6.next = 4;
296
+ _t5 = key;
297
+ _context6.next = 1;
296
298
  return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, value);
297
- case 4:
298
- _context6.t1 = _context6.sent;
299
- return _context6.abrupt("return", [_context6.t0, _context6.t1]);
300
- case 6:
299
+ case 1:
300
+ _t6 = _context6.sent;
301
+ return _context6.abrupt("return", [_t5, _t6]);
302
+ case 2:
301
303
  case "end":
302
304
  return _context6.stop();
303
305
  }
@@ -307,38 +309,37 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
307
309
  return _ref9.apply(this, arguments);
308
310
  };
309
311
  }());
310
- _context7.t1 = Object;
311
- _context7.next = 9;
312
+ _t8 = Object;
313
+ _context7.next = 2;
312
314
  return _promise.default.all(decryptedAddressInfoPromises);
313
- case 9:
314
- _context7.t2 = _context7.sent;
315
- decryptedAddressInfo = _context7.t1.fromEntries.call(_context7.t1, _context7.t2);
316
- case 11:
315
+ case 2:
316
+ decryptedAddressInfo = _t8.fromEntries.call(_t8, _context7.sent);
317
+ case 3:
317
318
  return _context7.abrupt("return", [field, decryptedAddressInfo]);
318
- case 12:
319
+ case 4:
319
320
  plainTextDetails = decryptedContact[field];
320
321
  if (!plainTextDetails) {
321
- _context7.next = 17;
322
+ _context7.next = 6;
322
323
  break;
323
324
  }
324
- _context7.next = 16;
325
+ _context7.next = 5;
325
326
  return _this4.decryptContactDetail(encryptionKeyUrl, plainTextDetails);
326
- case 16:
327
+ case 5:
327
328
  decryptedDetails = _context7.sent;
328
- case 17:
329
+ case 6:
329
330
  return _context7.abrupt("return", [field, decryptedDetails]);
330
- case 18:
331
+ case 7:
331
332
  if (!((0, _values.default)(_constants2.encryptedFields).includes(field) && decryptedContact[field])) {
332
- _context7.next = 22;
333
+ _context7.next = 9;
333
334
  break;
334
335
  }
335
- _context7.next = 21;
336
+ _context7.next = 8;
336
337
  return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, decryptedContact[field]);
337
- case 21:
338
+ case 8:
338
339
  decryptedValue = _context7.sent;
339
- case 22:
340
+ case 9:
340
341
  return _context7.abrupt("return", [field, decryptedValue]);
341
- case 23:
342
+ case 10:
342
343
  case "end":
343
344
  return _context7.stop();
344
345
  }
@@ -348,9 +349,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
348
349
  return _ref7.apply(this, arguments);
349
350
  };
350
351
  }());
351
- _context8.next = 5;
352
+ _context8.next = 1;
352
353
  return _promise.default.all(decryptionPromises);
353
- case 5:
354
+ case 1:
354
355
  decryptedFieldsList = _context8.sent;
355
356
  decryptedFieldsList.forEach(function (_ref1) {
356
357
  var _ref10 = (0, _slicedToArray2.default)(_ref1, 2),
@@ -361,7 +362,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
361
362
  }
362
363
  });
363
364
  return _context8.abrupt("return", decryptedContact);
364
- case 8:
365
+ case 2:
365
366
  case "end":
366
367
  return _context8.stop();
367
368
  }
@@ -452,8 +453,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
452
453
  value: (function () {
453
454
  var _getContacts = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
454
455
  var _this5 = this;
455
- var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorStatus;
456
- return _regenerator.default.wrap(function _callee1$(_context1) {
456
+ var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorStatus, _t9, _t0;
457
+ return _regenerator.default.wrap(function (_context1) {
457
458
  while (1) switch (_context1.prev = _context1.next) {
458
459
  case 0:
459
460
  loggerContext = {
@@ -463,47 +464,47 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
463
464
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
464
465
  contactList = [];
465
466
  cloudContactsMap = {};
466
- _context1.prev = 4;
467
- _context1.next = 7;
467
+ _context1.prev = 1;
468
+ _context1.next = 2;
468
469
  return this.webex.request({
469
470
  // eslint-disable-next-line no-underscore-dangle
470
- uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
471
+ uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
471
472
  method: _types.HTTP_METHODS.GET
472
473
  });
473
- case 7:
474
+ case 2:
474
475
  response = _context1.sent;
475
476
  _Logger.default.log("Response code: ".concat(response.statusCode, " and Response trackingId: ").concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), loggerContext);
476
477
  responseBody = response.body;
477
478
  if (responseBody) {
478
- _context1.next = 12;
479
+ _context1.next = 3;
479
480
  break;
480
481
  }
481
482
  throw new Error("".concat(response));
482
- case 12:
483
+ case 3:
483
484
  contacts = responseBody.contacts, groups = responseBody.groups;
484
- _context1.next = 15;
485
+ _context1.next = 4;
485
486
  return _promise.default.all(contacts.map(/*#__PURE__*/function () {
486
487
  var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(contact) {
487
488
  var decryptedContact;
488
- return _regenerator.default.wrap(function _callee9$(_context9) {
489
+ return _regenerator.default.wrap(function (_context9) {
489
490
  while (1) switch (_context9.prev = _context9.next) {
490
491
  case 0:
491
492
  if (!(contact.contactType === _types2.ContactType.CUSTOM)) {
492
- _context9.next = 7;
493
+ _context9.next = 2;
493
494
  break;
494
495
  }
495
- _context9.next = 3;
496
+ _context9.next = 1;
496
497
  return _this5.decryptContact(contact);
497
- case 3:
498
+ case 1:
498
499
  decryptedContact = _context9.sent;
499
500
  contactList.push(decryptedContact);
500
- _context9.next = 8;
501
+ _context9.next = 3;
501
502
  break;
502
- case 7:
503
+ case 2:
503
504
  if (contact.contactType === _types2.ContactType.CLOUD && contact.contactId) {
504
505
  cloudContactsMap[contact.contactId] = contact;
505
506
  }
506
- case 8:
507
+ case 3:
507
508
  case "end":
508
509
  return _context9.stop();
509
510
  }
@@ -513,28 +514,28 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
513
514
  return _ref11.apply(this, arguments);
514
515
  };
515
516
  }()));
516
- case 15:
517
+ case 4:
517
518
  if (!(0, _keys.default)(cloudContactsMap).length) {
518
- _context1.next = 38;
519
+ _context1.next = 10;
519
520
  break;
520
521
  }
521
522
  contactIdList = (0, _keys.default)(cloudContactsMap);
522
523
  totalContacts = contactIdList.length;
523
524
  MAX_CONTACTS_PER_QUERY = 50;
524
525
  i = 0;
525
- case 20:
526
+ case 5:
526
527
  if (!(i < totalContacts)) {
527
- _context1.next = 38;
528
+ _context1.next = 10;
528
529
  break;
529
530
  }
530
- _context1.prev = 21;
531
+ _context1.prev = 6;
531
532
  contactIdListChunk = contactIdList.slice(i, i + MAX_CONTACTS_PER_QUERY);
532
533
  query = contactIdListChunk.map(function (item) {
533
534
  return "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(item, "\"");
534
535
  }).join(_constants2.OR);
535
- _context1.next = 26;
536
+ _context1.next = 7;
536
537
  return (0, _Utils.scimQuery)(query);
537
- case 26:
538
+ case 7:
538
539
  result = _context1.sent;
539
540
  slicedCloudContactsMap = Object.fromEntries((0, _entries.default)(cloudContactsMap).slice(i, i + MAX_CONTACTS_PER_QUERY));
540
541
  resolvedContacts = this.resolveCloudContacts(slicedCloudContactsMap, result.body);
@@ -543,28 +544,28 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
543
544
  return contactList.push(item);
544
545
  });
545
546
  }
546
- _context1.next = 35;
547
+ _context1.next = 9;
547
548
  break;
548
- case 32:
549
- _context1.prev = 32;
550
- _context1.t0 = _context1["catch"](21);
549
+ case 8:
550
+ _context1.prev = 8;
551
+ _t9 = _context1["catch"](6);
551
552
  _Logger.default.warn("Error processing contact chunk ".concat(i, "-").concat(i + MAX_CONTACTS_PER_QUERY), loggerContext);
552
- case 35:
553
+ case 9:
553
554
  i += MAX_CONTACTS_PER_QUERY;
554
- _context1.next = 20;
555
+ _context1.next = 5;
555
556
  break;
556
- case 38:
557
- _context1.next = 40;
557
+ case 10:
558
+ _context1.next = 11;
558
559
  return _promise.default.all(groups.map(/*#__PURE__*/function () {
559
560
  var _ref12 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0(group, idx) {
560
- return _regenerator.default.wrap(function _callee0$(_context0) {
561
+ return _regenerator.default.wrap(function (_context0) {
561
562
  while (1) switch (_context0.prev = _context0.next) {
562
563
  case 0:
563
- _context0.next = 2;
564
+ _context0.next = 1;
564
565
  return _this5.webex.internal.encryption.decryptText(group.encryptionKeyUrl, group.displayName);
565
- case 2:
566
+ case 1:
566
567
  groups[idx].displayName = _context0.sent;
567
- case 3:
568
+ case 2:
568
569
  case "end":
569
570
  return _context0.stop();
570
571
  }
@@ -574,7 +575,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
574
575
  return _ref12.apply(this, arguments);
575
576
  };
576
577
  }()));
577
- case 40:
578
+ case 11:
578
579
  this.groups = groups;
579
580
  this.contacts = contactList;
580
581
  contactResponse = {
@@ -587,20 +588,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
587
588
  };
588
589
  _Logger.default.log('Successfully fetched contacts and groups', loggerContext);
589
590
  return _context1.abrupt("return", contactResponse);
590
- case 47:
591
- _context1.prev = 47;
592
- _context1.t1 = _context1["catch"](4);
593
- _Logger.default.error("Error fetching contacts: ".concat((0, _stringify.default)(_context1.t1)), loggerContext);
594
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context1.t1, loggerContext);
595
- _context1.next = 53;
591
+ case 12:
592
+ _context1.prev = 12;
593
+ _t0 = _context1["catch"](1);
594
+ _Logger.default.error("Error fetching contacts: ".concat((0, _stringify.default)(_t0)), loggerContext);
595
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t0, loggerContext);
596
+ _context1.next = 13;
596
597
  return (0, _Utils.uploadLogs)();
597
- case 53:
598
+ case 13:
598
599
  return _context1.abrupt("return", errorStatus);
599
- case 54:
600
+ case 14:
600
601
  case "end":
601
602
  return _context1.stop();
602
603
  }
603
- }, _callee1, this, [[4, 47], [21, 32]]);
604
+ }, _callee1, this, [[1, 12], [6, 8]]);
604
605
  }));
605
606
  function getContacts() {
606
607
  return _getContacts.apply(this, arguments);
@@ -618,7 +619,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
618
619
  value: (function () {
619
620
  var _createNewEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
620
621
  var loggerContext, unboundedKeyUri, unboundedKeys;
621
- return _regenerator.default.wrap(function _callee10$(_context10) {
622
+ return _regenerator.default.wrap(function (_context10) {
622
623
  while (1) switch (_context10.prev = _context10.next) {
623
624
  case 0:
624
625
  loggerContext = {
@@ -628,18 +629,18 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
628
629
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
629
630
  unboundedKeyUri = '';
630
631
  _Logger.default.info('Requesting kms for a new KRO and key', loggerContext);
631
- _context10.next = 6;
632
+ _context10.next = 1;
632
633
  return this.webex.internal.encryption.kms.createUnboundKeys({
633
634
  count: 1
634
635
  });
635
- case 6:
636
+ case 1:
636
637
  unboundedKeys = _context10.sent;
637
638
  unboundedKeyUri = unboundedKeys[0].uri;
638
639
  this.webex.internal.encryption.kms.createResource({
639
640
  keyUris: [unboundedKeyUri]
640
641
  });
641
642
  return _context10.abrupt("return", unboundedKeyUri);
642
- case 10:
643
+ case 2:
643
644
  case "end":
644
645
  return _context10.stop();
645
646
  }
@@ -662,7 +663,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
662
663
  var _fetchEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
663
664
  var _response$data$group;
664
665
  var loggerContext, response, _response$data$group2;
665
- return _regenerator.default.wrap(function _callee11$(_context11) {
666
+ return _regenerator.default.wrap(function (_context11) {
666
667
  while (1) switch (_context11.prev = _context11.next) {
667
668
  case 0:
668
669
  loggerContext = {
@@ -671,33 +672,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
671
672
  };
672
673
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
673
674
  if (!this.encryptionKeyUrl) {
674
- _context11.next = 4;
675
+ _context11.next = 1;
675
676
  break;
676
677
  }
677
678
  return _context11.abrupt("return", this.encryptionKeyUrl);
678
- case 4:
679
+ case 1:
679
680
  // istanbul ignore else
680
681
  if (this.groups === undefined) {
681
682
  this.getContacts();
682
683
  }
683
684
  // istanbul ignore else
684
685
  if (!(this.groups && this.groups.length)) {
685
- _context11.next = 7;
686
+ _context11.next = 2;
686
687
  break;
687
688
  }
688
689
  return _context11.abrupt("return", this.groups[0].encryptionKeyUrl);
689
- case 7:
690
- _context11.next = 9;
690
+ case 2:
691
+ _context11.next = 3;
691
692
  return this.createNewEncryptionKeyUrl();
692
- case 9:
693
+ case 3:
693
694
  this.encryptionKeyUrl = _context11.sent;
694
695
  _Logger.default.log("Creating a default group: ".concat(_constants2.DEFAULT_GROUP_NAME), {
695
696
  file: _constants2.CONTACTS_CLIENT,
696
697
  method: this.fetchEncryptionKeyUrl.name
697
698
  });
698
- _context11.next = 13;
699
+ _context11.next = 4;
699
700
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME, this.encryptionKeyUrl);
700
- case 13:
701
+ case 4:
701
702
  response = _context11.sent;
702
703
  if ((_response$data$group = response.data.group) !== null && _response$data$group !== void 0 && _response$data$group.groupId) {
703
704
  this.defaultGroupId = (_response$data$group2 = response.data.group) === null || _response$data$group2 === void 0 ? void 0 : _response$data$group2.groupId;
@@ -707,7 +708,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
707
708
  });
708
709
  }
709
710
  return _context11.abrupt("return", this.encryptionKeyUrl);
710
- case 16:
711
+ case 5:
711
712
  case "end":
712
713
  return _context11.stop();
713
714
  }
@@ -729,7 +730,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
729
730
  value: (function () {
730
731
  var _fetchDefaultGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
731
732
  var loggerContext, i, response, group, groupId;
732
- return _regenerator.default.wrap(function _callee12$(_context12) {
733
+ return _regenerator.default.wrap(function (_context12) {
733
734
  while (1) switch (_context12.prev = _context12.next) {
734
735
  case 0:
735
736
  loggerContext = {
@@ -738,7 +739,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
738
739
  };
739
740
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
740
741
  if (!this.defaultGroupId) {
741
- _context12.next = 5;
742
+ _context12.next = 1;
742
743
  break;
743
744
  }
744
745
  _Logger.default.log("Using existing default group with ID: ".concat(this.defaultGroupId), {
@@ -746,19 +747,19 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
746
747
  method: this.fetchDefaultGroup.name
747
748
  });
748
749
  return _context12.abrupt("return", this.defaultGroupId);
749
- case 5:
750
+ case 1:
750
751
  if (!(this.groups && this.groups.length)) {
751
- _context12.next = 15;
752
+ _context12.next = 4;
752
753
  break;
753
754
  }
754
755
  i = 0;
755
- case 7:
756
+ case 2:
756
757
  if (!(i < this.groups.length)) {
757
- _context12.next = 15;
758
+ _context12.next = 4;
758
759
  break;
759
760
  }
760
761
  if (!(this.groups[i].displayName === _constants2.DEFAULT_GROUP_NAME)) {
761
- _context12.next = 12;
762
+ _context12.next = 3;
762
763
  break;
763
764
  }
764
765
  this.defaultGroupId = this.groups[i].groupId;
@@ -767,22 +768,22 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
767
768
  method: this.fetchDefaultGroup.name
768
769
  });
769
770
  return _context12.abrupt("return", this.defaultGroupId);
770
- case 12:
771
+ case 3:
771
772
  i += 1;
772
- _context12.next = 7;
773
+ _context12.next = 2;
773
774
  break;
774
- case 15:
775
+ case 4:
775
776
  _Logger.default.log('No default group found.', {
776
777
  file: _constants2.CONTACTS_CLIENT,
777
778
  method: this.fetchDefaultGroup.name
778
779
  });
779
- _context12.next = 18;
780
+ _context12.next = 5;
780
781
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME);
781
- case 18:
782
+ case 5:
782
783
  response = _context12.sent;
783
784
  group = response.data.group;
784
785
  if (!group) {
785
- _context12.next = 24;
786
+ _context12.next = 6;
786
787
  break;
787
788
  }
788
789
  groupId = group.groupId;
@@ -791,9 +792,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
791
792
  method: this.fetchDefaultGroup.name
792
793
  });
793
794
  return _context12.abrupt("return", groupId);
794
- case 24:
795
+ case 6:
795
796
  return _context12.abrupt("return", '');
796
- case 25:
797
+ case 7:
797
798
  case "end":
798
799
  return _context12.stop();
799
800
  }
@@ -816,8 +817,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
816
817
  key: "createContactGroup",
817
818
  value: (function () {
818
819
  var _createContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(displayName, encryptionKeyUrl, groupType) {
819
- var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse, errorStatus;
820
- return _regenerator.default.wrap(function _callee13$(_context13) {
820
+ var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse, errorStatus, _t1, _t10;
821
+ return _regenerator.default.wrap(function (_context13) {
821
822
  while (1) switch (_context13.prev = _context13.next) {
822
823
  case 0:
823
824
  loggerContext = {
@@ -825,33 +826,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
825
826
  method: _constants2.METHODS.CREATE_CONTACT_GROUP
826
827
  };
827
828
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with displayName: ").concat(displayName), loggerContext);
828
- _context13.t0 = encryptionKeyUrl;
829
- if (_context13.t0) {
830
- _context13.next = 7;
829
+ _t1 = encryptionKeyUrl;
830
+ if (_t1) {
831
+ _context13.next = 2;
831
832
  break;
832
833
  }
833
- _context13.next = 6;
834
+ _context13.next = 1;
834
835
  return this.fetchEncryptionKeyUrl();
835
- case 6:
836
- _context13.t0 = _context13.sent;
837
- case 7:
838
- encryptionKeyUrlFinal = _context13.t0;
836
+ case 1:
837
+ _t1 = _context13.sent;
838
+ case 2:
839
+ encryptionKeyUrlFinal = _t1;
839
840
  if (!(this.groups === undefined)) {
840
- _context13.next = 11;
841
+ _context13.next = 3;
841
842
  break;
842
843
  }
843
- _context13.next = 11;
844
+ _context13.next = 3;
844
845
  return this.getContacts();
845
- case 11:
846
+ case 3:
846
847
  if (!(this.groups && this.groups.length)) {
847
- _context13.next = 16;
848
+ _context13.next = 4;
848
849
  break;
849
850
  }
850
851
  isExistingGroup = this.groups.find(function (group) {
851
852
  return group.displayName === displayName;
852
853
  });
853
854
  if (!isExistingGroup) {
854
- _context13.next = 16;
855
+ _context13.next = 4;
855
856
  break;
856
857
  }
857
858
  _Logger.default.warn("Group name ".concat(displayName, " already exists."), loggerContext);
@@ -862,10 +863,10 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
862
863
  },
863
864
  message: _constants.FAILURE_MESSAGE
864
865
  });
865
- case 16:
866
- _context13.next = 18;
866
+ case 4:
867
+ _context13.next = 5;
867
868
  return this.webex.internal.encryption.encryptText(encryptionKeyUrlFinal, displayName);
868
- case 18:
869
+ case 5:
869
870
  encryptedDisplayName = _context13.sent;
870
871
  groupInfo = {
871
872
  schemas: _constants2.CONTACTS_SCHEMA,
@@ -873,15 +874,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
873
874
  groupType: groupType || _types2.GroupType.NORMAL,
874
875
  encryptionKeyUrl: encryptionKeyUrlFinal
875
876
  };
876
- _context13.prev = 20;
877
- _context13.next = 23;
877
+ _context13.prev = 6;
878
+ _context13.next = 7;
878
879
  return this.webex.request({
879
880
  // eslint-disable-next-line no-underscore-dangle
880
- uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER),
881
+ uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER),
881
882
  method: _types.HTTP_METHODS.POST,
882
883
  body: groupInfo
883
884
  });
884
- case 23:
885
+ case 7:
885
886
  response = _context13.sent;
886
887
  _Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
887
888
  _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid), loggerContext);
@@ -897,20 +898,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
897
898
  (_this$groups = this.groups) === null || _this$groups === void 0 ? void 0 : _this$groups.push(group);
898
899
  _Logger.default.log("Contact group ".concat(displayName, " successfully created"), loggerContext);
899
900
  return _context13.abrupt("return", contactResponse);
900
- case 34:
901
- _context13.prev = 34;
902
- _context13.t1 = _context13["catch"](20);
903
- _Logger.default.error("Unable to create contact group: ".concat((0, _stringify.default)(_context13.t1)), loggerContext);
904
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context13.t1, loggerContext);
905
- _context13.next = 40;
901
+ case 8:
902
+ _context13.prev = 8;
903
+ _t10 = _context13["catch"](6);
904
+ _Logger.default.error("Unable to create contact group: ".concat((0, _stringify.default)(_t10)), loggerContext);
905
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t10, loggerContext);
906
+ _context13.next = 9;
906
907
  return (0, _Utils.uploadLogs)();
907
- case 40:
908
+ case 9:
908
909
  return _context13.abrupt("return", errorStatus);
909
- case 41:
910
+ case 10:
910
911
  case "end":
911
912
  return _context13.stop();
912
913
  }
913
- }, _callee13, this, [[20, 34]]);
914
+ }, _callee13, this, [[6, 8]]);
914
915
  }));
915
916
  function createContactGroup(_x12, _x13, _x14) {
916
917
  return _createContactGroup.apply(this, arguments);
@@ -926,8 +927,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
926
927
  key: "deleteContactGroup",
927
928
  value: (function () {
928
929
  var _deleteContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14(groupId) {
929
- var loggerContext, _response$headers3, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorStatus;
930
- return _regenerator.default.wrap(function _callee14$(_context14) {
930
+ var loggerContext, _response$headers3, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorStatus, _t11;
931
+ return _regenerator.default.wrap(function (_context14) {
931
932
  while (1) switch (_context14.prev = _context14.next) {
932
933
  case 0:
933
934
  loggerContext = {
@@ -935,15 +936,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
935
936
  method: _constants2.METHODS.DELETE_CONTACT_GROUP
936
937
  };
937
938
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with groupId: ").concat(groupId), loggerContext);
938
- _context14.prev = 2;
939
+ _context14.prev = 1;
939
940
  _Logger.default.info("Deleting contact group: ".concat(groupId), loggerContext);
940
- _context14.next = 6;
941
+ _context14.next = 2;
941
942
  return this.webex.request({
942
943
  // eslint-disable-next-line no-underscore-dangle
943
- uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER, "/").concat(groupId),
944
+ uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER, "/").concat(groupId),
944
945
  method: _types.HTTP_METHODS.DELETE
945
946
  });
946
- case 6:
947
+ case 2:
947
948
  response = _context14.sent;
948
949
  _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid), loggerContext);
949
950
  contactResponse = {
@@ -962,20 +963,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
962
963
  }
963
964
  _Logger.default.log("Contact group ".concat(groupId, " successfully deleted"), loggerContext);
964
965
  return _context14.abrupt("return", contactResponse);
965
- case 16:
966
- _context14.prev = 16;
967
- _context14.t0 = _context14["catch"](2);
968
- _Logger.default.error("Unable to delete contact group ".concat(groupId, ": ").concat((0, _stringify.default)(_context14.t0)), loggerContext);
969
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context14.t0, loggerContext);
970
- _context14.next = 22;
966
+ case 3:
967
+ _context14.prev = 3;
968
+ _t11 = _context14["catch"](1);
969
+ _Logger.default.error("Unable to delete contact group ".concat(groupId, ": ").concat((0, _stringify.default)(_t11)), loggerContext);
970
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t11, loggerContext);
971
+ _context14.next = 4;
971
972
  return (0, _Utils.uploadLogs)();
972
- case 22:
973
+ case 4:
973
974
  return _context14.abrupt("return", errorStatus);
974
- case 23:
975
+ case 5:
975
976
  case "end":
976
977
  return _context14.stop();
977
978
  }
978
- }, _callee14, this, [[2, 16]]);
979
+ }, _callee14, this, [[1, 3]]);
979
980
  }));
980
981
  function deleteContactGroup(_x15) {
981
982
  return _deleteContactGroup.apply(this, arguments);
@@ -991,8 +992,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
991
992
  key: "createContact",
992
993
  value: (function () {
993
994
  var _createContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(contactInfo) {
994
- var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorStatus;
995
- return _regenerator.default.wrap(function _callee15$(_context15) {
995
+ var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorStatus, _t12, _t13;
996
+ return _regenerator.default.wrap(function (_context15) {
996
997
  while (1) switch (_context15.prev = _context15.next) {
997
998
  case 0:
998
999
  loggerContext = {
@@ -1000,42 +1001,42 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1000
1001
  method: _constants2.METHODS.CREATE_CONTACT
1001
1002
  };
1002
1003
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactType: ").concat(contactInfo.contactType), loggerContext);
1003
- _context15.prev = 2;
1004
+ _context15.prev = 1;
1004
1005
  contact = _objectSpread({}, contactInfo);
1005
1006
  if (contact.encryptionKeyUrl) {
1006
- _context15.next = 8;
1007
+ _context15.next = 3;
1007
1008
  break;
1008
1009
  }
1009
- _context15.next = 7;
1010
+ _context15.next = 2;
1010
1011
  return this.fetchEncryptionKeyUrl();
1011
- case 7:
1012
+ case 2:
1012
1013
  contact.encryptionKeyUrl = _context15.sent;
1013
- case 8:
1014
+ case 3:
1014
1015
  if (!(!contact.groups || contact.groups.length === 0)) {
1015
- _context15.next = 13;
1016
+ _context15.next = 5;
1016
1017
  break;
1017
1018
  }
1018
- _context15.next = 11;
1019
+ _context15.next = 4;
1019
1020
  return this.fetchDefaultGroup();
1020
- case 11:
1021
+ case 4:
1021
1022
  defaultGroupId = _context15.sent;
1022
1023
  contact.groups = [defaultGroupId];
1023
- case 13:
1024
+ case 5:
1024
1025
  contact.schemas = _constants2.CONTACTS_SCHEMA;
1025
1026
  requestBody = {};
1026
- _context15.t0 = contact.contactType;
1027
- _context15.next = _context15.t0 === _types2.ContactType.CUSTOM ? 18 : _context15.t0 === _types2.ContactType.CLOUD ? 23 : 30;
1027
+ _t12 = contact.contactType;
1028
+ _context15.next = _t12 === _types2.ContactType.CUSTOM ? 6 : _t12 === _types2.ContactType.CLOUD ? 8 : 11;
1028
1029
  break;
1029
- case 18:
1030
- _context15.next = 20;
1030
+ case 6:
1031
+ _context15.next = 7;
1031
1032
  return this.encryptContact(contact);
1032
- case 20:
1033
+ case 7:
1033
1034
  encryptedContact = _context15.sent;
1034
1035
  requestBody = encryptedContact;
1035
- return _context15.abrupt("break", 31);
1036
- case 23:
1036
+ return _context15.abrupt("continue", 12);
1037
+ case 8:
1037
1038
  if (contact.contactId) {
1038
- _context15.next = 25;
1039
+ _context15.next = 9;
1039
1040
  break;
1040
1041
  }
1041
1042
  return _context15.abrupt("return", {
@@ -1045,14 +1046,14 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1045
1046
  },
1046
1047
  message: _constants.FAILURE_MESSAGE
1047
1048
  });
1048
- case 25:
1049
- _context15.next = 27;
1049
+ case 9:
1050
+ _context15.next = 10;
1050
1051
  return this.encryptContact(contact);
1051
- case 27:
1052
+ case 10:
1052
1053
  _encryptedContact = _context15.sent;
1053
1054
  requestBody = _encryptedContact;
1054
- return _context15.abrupt("break", 31);
1055
- case 30:
1055
+ return _context15.abrupt("continue", 12);
1056
+ case 11:
1056
1057
  return _context15.abrupt("return", {
1057
1058
  statusCode: 400,
1058
1059
  data: {
@@ -1060,15 +1061,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1060
1061
  },
1061
1062
  message: _constants.FAILURE_MESSAGE
1062
1063
  });
1063
- case 31:
1064
- _context15.next = 33;
1064
+ case 12:
1065
+ _context15.next = 13;
1065
1066
  return this.webex.request({
1066
1067
  // eslint-disable-next-line no-underscore-dangle
1067
- uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
1068
+ uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
1068
1069
  method: _types.HTTP_METHODS.POST,
1069
1070
  body: requestBody
1070
1071
  });
1071
- case 33:
1072
+ case 13:
1072
1073
  response = _context15.sent;
1073
1074
  _Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
1074
1075
  _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid), loggerContext);
@@ -1082,39 +1083,39 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1082
1083
  message: _constants.SUCCESS_MESSAGE
1083
1084
  };
1084
1085
  if (!(contact.contactType === _types2.ContactType.CLOUD && newContact.contactId)) {
1085
- _context15.next = 48;
1086
+ _context15.next = 15;
1086
1087
  break;
1087
1088
  }
1088
1089
  query = "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(newContact.contactId, "\"");
1089
- _context15.next = 43;
1090
+ _context15.next = 14;
1090
1091
  return (0, _Utils.scimQuery)(query);
1091
- case 43:
1092
+ case 14:
1092
1093
  res = _context15.sent;
1093
1094
  resolvedContact = this.resolveCloudContacts(Object.fromEntries([[newContact.contactId, newContact]]), res.body);
1094
1095
  if (resolvedContact) {
1095
1096
  (_this$contacts = this.contacts) === null || _this$contacts === void 0 ? void 0 : _this$contacts.push(resolvedContact[0]);
1096
1097
  }
1097
- _context15.next = 49;
1098
+ _context15.next = 16;
1098
1099
  break;
1099
- case 48:
1100
+ case 15:
1100
1101
  (_this$contacts2 = this.contacts) === null || _this$contacts2 === void 0 ? void 0 : _this$contacts2.push(contact);
1101
- case 49:
1102
+ case 16:
1102
1103
  _Logger.default.log("Contact successfully created", loggerContext);
1103
1104
  return _context15.abrupt("return", contactResponse);
1104
- case 53:
1105
- _context15.prev = 53;
1106
- _context15.t1 = _context15["catch"](2);
1107
- _Logger.default.error("Failed to create contact: ".concat((0, _stringify.default)(_context15.t1)), loggerContext);
1108
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context15.t1, loggerContext);
1109
- _context15.next = 59;
1105
+ case 17:
1106
+ _context15.prev = 17;
1107
+ _t13 = _context15["catch"](1);
1108
+ _Logger.default.error("Failed to create contact: ".concat((0, _stringify.default)(_t13)), loggerContext);
1109
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t13, loggerContext);
1110
+ _context15.next = 18;
1110
1111
  return (0, _Utils.uploadLogs)();
1111
- case 59:
1112
+ case 18:
1112
1113
  return _context15.abrupt("return", errorStatus);
1113
- case 60:
1114
+ case 19:
1114
1115
  case "end":
1115
1116
  return _context15.stop();
1116
1117
  }
1117
- }, _callee15, this, [[2, 53]]);
1118
+ }, _callee15, this, [[1, 17]]);
1118
1119
  }));
1119
1120
  function createContact(_x16) {
1120
1121
  return _createContact.apply(this, arguments);
@@ -1130,8 +1131,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1130
1131
  key: "deleteContact",
1131
1132
  value: (function () {
1132
1133
  var _deleteContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(contactId) {
1133
- var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorStatus;
1134
- return _regenerator.default.wrap(function _callee16$(_context16) {
1134
+ var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorStatus, _t14;
1135
+ return _regenerator.default.wrap(function (_context16) {
1135
1136
  while (1) switch (_context16.prev = _context16.next) {
1136
1137
  case 0:
1137
1138
  loggerContext = {
@@ -1139,15 +1140,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1139
1140
  method: _constants2.METHODS.DELETE_CONTACT
1140
1141
  };
1141
1142
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactId: ").concat(contactId), loggerContext);
1142
- _context16.prev = 2;
1143
+ _context16.prev = 1;
1143
1144
  _Logger.default.info("Deleting contact : ".concat(contactId), loggerContext);
1144
- _context16.next = 6;
1145
+ _context16.next = 2;
1145
1146
  return this.webex.request({
1146
1147
  // eslint-disable-next-line no-underscore-dangle
1147
- uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER, "/").concat(contactId),
1148
+ uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER, "/").concat(contactId),
1148
1149
  method: _types.HTTP_METHODS.DELETE
1149
1150
  });
1150
- case 6:
1151
+ case 2:
1151
1152
  response = _context16.sent;
1152
1153
  contactResponse = {
1153
1154
  statusCode: Number(response[_constants.STATUS_CODE]),
@@ -1162,20 +1163,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1162
1163
  }
1163
1164
  _Logger.default.log("Contact ".concat(contactId, " successfully deleted"), loggerContext);
1164
1165
  return _context16.abrupt("return", contactResponse);
1165
- case 14:
1166
- _context16.prev = 14;
1167
- _context16.t0 = _context16["catch"](2);
1168
- _Logger.default.error("Unable to delete contact ".concat(contactId, ": ").concat((0, _stringify.default)(_context16.t0)), loggerContext);
1169
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context16.t0, loggerContext);
1170
- _context16.next = 20;
1166
+ case 3:
1167
+ _context16.prev = 3;
1168
+ _t14 = _context16["catch"](1);
1169
+ _Logger.default.error("Unable to delete contact ".concat(contactId, ": ").concat((0, _stringify.default)(_t14)), loggerContext);
1170
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t14, loggerContext);
1171
+ _context16.next = 4;
1171
1172
  return (0, _Utils.uploadLogs)();
1172
- case 20:
1173
+ case 4:
1173
1174
  return _context16.abrupt("return", errorStatus);
1174
- case 21:
1175
+ case 5:
1175
1176
  case "end":
1176
1177
  return _context16.stop();
1177
1178
  }
1178
- }, _callee16, this, [[2, 14]]);
1179
+ }, _callee16, this, [[1, 3]]);
1179
1180
  }));
1180
1181
  function deleteContact(_x17) {
1181
1182
  return _deleteContact.apply(this, arguments);
@@ -1192,7 +1193,6 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1192
1193
  return this.sdkConnector;
1193
1194
  }
1194
1195
  }]);
1195
- return ContactsClient;
1196
1196
  }();
1197
1197
  /**
1198
1198
  * Creates a ContactsClient instance