@webex/webex-core 3.0.0-beta.15 → 3.0.0-beta.17

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 (103) hide show
  1. package/dist/config.js +1 -11
  2. package/dist/config.js.map +1 -1
  3. package/dist/credentials-config.js +0 -20
  4. package/dist/credentials-config.js.map +1 -1
  5. package/dist/index.js +0 -76
  6. package/dist/index.js.map +1 -1
  7. package/dist/interceptors/auth.js +22 -55
  8. package/dist/interceptors/auth.js.map +1 -1
  9. package/dist/interceptors/default-options.js +0 -20
  10. package/dist/interceptors/default-options.js.map +1 -1
  11. package/dist/interceptors/embargo.js +0 -21
  12. package/dist/interceptors/embargo.js.map +1 -1
  13. package/dist/interceptors/network-timing.js +2 -21
  14. package/dist/interceptors/network-timing.js.map +1 -1
  15. package/dist/interceptors/payload-transformer.js +2 -22
  16. package/dist/interceptors/payload-transformer.js.map +1 -1
  17. package/dist/interceptors/rate-limit.js +21 -53
  18. package/dist/interceptors/rate-limit.js.map +1 -1
  19. package/dist/interceptors/redirect.js +4 -33
  20. package/dist/interceptors/redirect.js.map +1 -1
  21. package/dist/interceptors/request-event.js +3 -30
  22. package/dist/interceptors/request-event.js.map +1 -1
  23. package/dist/interceptors/request-logger.js +1 -30
  24. package/dist/interceptors/request-logger.js.map +1 -1
  25. package/dist/interceptors/request-timing.js +3 -22
  26. package/dist/interceptors/request-timing.js.map +1 -1
  27. package/dist/interceptors/response-logger.js +2 -31
  28. package/dist/interceptors/response-logger.js.map +1 -1
  29. package/dist/interceptors/user-agent.js +2 -29
  30. package/dist/interceptors/user-agent.js.map +1 -1
  31. package/dist/interceptors/webex-tracking-id.js +5 -28
  32. package/dist/interceptors/webex-tracking-id.js.map +1 -1
  33. package/dist/interceptors/webex-user-agent.js +5 -38
  34. package/dist/interceptors/webex-user-agent.js.map +1 -1
  35. package/dist/lib/batcher.js +3 -51
  36. package/dist/lib/batcher.js.map +1 -1
  37. package/dist/lib/credentials/credentials.js +28 -123
  38. package/dist/lib/credentials/credentials.js.map +1 -1
  39. package/dist/lib/credentials/grant-errors.js +0 -49
  40. package/dist/lib/credentials/grant-errors.js.map +1 -1
  41. package/dist/lib/credentials/index.js +1 -13
  42. package/dist/lib/credentials/index.js.map +1 -1
  43. package/dist/lib/credentials/scope.js +1 -7
  44. package/dist/lib/credentials/scope.js.map +1 -1
  45. package/dist/lib/credentials/token-collection.js +1 -7
  46. package/dist/lib/credentials/token-collection.js.map +1 -1
  47. package/dist/lib/credentials/token.js +29 -122
  48. package/dist/lib/credentials/token.js.map +1 -1
  49. package/dist/lib/page.js +12 -27
  50. package/dist/lib/page.js.map +1 -1
  51. package/dist/lib/services/constants.js +0 -2
  52. package/dist/lib/services/constants.js.map +1 -1
  53. package/dist/lib/services/index.js +1 -28
  54. package/dist/lib/services/index.js.map +1 -1
  55. package/dist/lib/services/interceptors/server-error.js +0 -21
  56. package/dist/lib/services/interceptors/server-error.js.map +1 -1
  57. package/dist/lib/services/interceptors/service.js +11 -33
  58. package/dist/lib/services/interceptors/service.js.map +1 -1
  59. package/dist/lib/services/metrics.js +0 -2
  60. package/dist/lib/services/metrics.js.map +1 -1
  61. package/dist/lib/services/service-catalog.js +10 -90
  62. package/dist/lib/services/service-catalog.js.map +1 -1
  63. package/dist/lib/services/service-fed-ramp.js +0 -2
  64. package/dist/lib/services/service-fed-ramp.js.map +1 -1
  65. package/dist/lib/services/service-host.js +41 -56
  66. package/dist/lib/services/service-host.js.map +1 -1
  67. package/dist/lib/services/service-registry.js +78 -90
  68. package/dist/lib/services/service-registry.js.map +1 -1
  69. package/dist/lib/services/service-state.js +3 -15
  70. package/dist/lib/services/service-state.js.map +1 -1
  71. package/dist/lib/services/service-url.js +4 -25
  72. package/dist/lib/services/service-url.js.map +1 -1
  73. package/dist/lib/services/services.js +116 -234
  74. package/dist/lib/services/services.js.map +1 -1
  75. package/dist/lib/stateless-webex-plugin.js +5 -28
  76. package/dist/lib/stateless-webex-plugin.js.map +1 -1
  77. package/dist/lib/storage/decorators.js +19 -62
  78. package/dist/lib/storage/decorators.js.map +1 -1
  79. package/dist/lib/storage/errors.js +0 -23
  80. package/dist/lib/storage/errors.js.map +1 -1
  81. package/dist/lib/storage/index.js +0 -14
  82. package/dist/lib/storage/index.js.map +1 -1
  83. package/dist/lib/storage/make-webex-plugin-store.js +11 -41
  84. package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
  85. package/dist/lib/storage/make-webex-store.js +8 -30
  86. package/dist/lib/storage/make-webex-store.js.map +1 -1
  87. package/dist/lib/storage/memory-store-adapter.js +1 -19
  88. package/dist/lib/storage/memory-store-adapter.js.map +1 -1
  89. package/dist/lib/webex-core-plugin-mixin.js +9 -29
  90. package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
  91. package/dist/lib/webex-http-error.js +1 -31
  92. package/dist/lib/webex-http-error.js.map +1 -1
  93. package/dist/lib/webex-internal-core-plugin-mixin.js +9 -29
  94. package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
  95. package/dist/lib/webex-plugin.js +6 -40
  96. package/dist/lib/webex-plugin.js.map +1 -1
  97. package/dist/plugins/logger.js +3 -17
  98. package/dist/plugins/logger.js.map +1 -1
  99. package/dist/webex-core.js +79 -203
  100. package/dist/webex-core.js.map +1 -1
  101. package/dist/webex-internal-core.js +0 -10
  102. package/dist/webex-internal-core.js.map +1 -1
  103. package/package.json +14 -14
@@ -1,67 +1,40 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
4
-
5
4
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
-
7
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
-
9
6
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
10
-
11
7
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
12
-
13
8
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
14
-
15
9
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
16
-
17
10
  _Object$defineProperty(exports, "__esModule", {
18
11
  value: true
19
12
  });
20
-
21
13
  exports.default = void 0;
22
-
23
14
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
24
-
25
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
26
-
27
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
28
-
29
17
  var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
30
-
31
18
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
32
-
33
19
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
34
-
35
20
  var _url = _interopRequireDefault(require("url"));
36
-
37
21
  var _sha = _interopRequireDefault(require("crypto-js/sha256"));
38
-
39
22
  var _webexPlugin = _interopRequireDefault(require("../webex-plugin"));
40
-
41
23
  var _metrics = _interopRequireDefault(require("./metrics"));
42
-
43
24
  var _serviceCatalog = _interopRequireDefault(require("./service-catalog"));
44
-
45
25
  var _serviceRegistry = _interopRequireDefault(require("./service-registry"));
46
-
47
26
  var _serviceState = _interopRequireDefault(require("./service-state"));
48
-
49
27
  var _serviceFedRamp = _interopRequireDefault(require("./service-fed-ramp"));
50
-
51
28
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
52
-
53
29
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
54
-
55
30
  var trailingSlashes = /(?:^\/)|(?:\/$)/;
56
- /* eslint-disable no-underscore-dangle */
57
31
 
32
+ /* eslint-disable no-underscore-dangle */
58
33
  /**
59
34
  * @class
60
35
  */
61
-
62
36
  var Services = _webexPlugin.default.extend({
63
37
  namespace: 'Services',
64
-
65
38
  /**
66
39
  * The {@link WeakMap} of {@link ServiceRegistry} class instances that are
67
40
  * keyed with WebexCore instances.
@@ -72,7 +45,6 @@ var Services = _webexPlugin.default.extend({
72
45
  * @memberof Services
73
46
  */
74
47
  registries: new _weakMap.default(),
75
-
76
48
  /**
77
49
  * The {@link WeakMap} of {@link ServiceState} class instances that are
78
50
  * keyed with WebexCore instances.
@@ -88,7 +60,6 @@ var Services = _webexPlugin.default.extend({
88
60
  },
89
61
  _catalogs: new _weakMap.default(),
90
62
  _serviceUrls: null,
91
-
92
63
  /**
93
64
  * Get the registry associated with this webex instance.
94
65
  *
@@ -99,7 +70,6 @@ var Services = _webexPlugin.default.extend({
99
70
  getRegistry: function getRegistry() {
100
71
  return this.registries.get(this.webex);
101
72
  },
102
-
103
73
  /**
104
74
  * Get the state associated with this webex instance.
105
75
  *
@@ -110,7 +80,6 @@ var Services = _webexPlugin.default.extend({
110
80
  getState: function getState() {
111
81
  return this.states.get(this.webex);
112
82
  },
113
-
114
83
  /**
115
84
  * @private
116
85
  * Get the current catalog based on the assocaited
@@ -120,7 +89,6 @@ var Services = _webexPlugin.default.extend({
120
89
  _getCatalog: function _getCatalog() {
121
90
  return this._catalogs.get(this.webex);
122
91
  },
123
-
124
92
  /**
125
93
  * Get a service url from the current services list by name
126
94
  * from the associated instance catalog.
@@ -131,10 +99,8 @@ var Services = _webexPlugin.default.extend({
131
99
  */
132
100
  get: function get(name, priorityHost, serviceGroup) {
133
101
  var catalog = this._getCatalog();
134
-
135
102
  return catalog.get(name, priorityHost, serviceGroup);
136
103
  },
137
-
138
104
  /**
139
105
  * Determine if the catalog contains a specific service
140
106
  *
@@ -144,7 +110,6 @@ var Services = _webexPlugin.default.extend({
144
110
  hasService: function hasService(serviceName) {
145
111
  return !!this.get(serviceName);
146
112
  },
147
-
148
113
  /**
149
114
  * Determine if a whilelist exists in the service catalog.
150
115
  *
@@ -152,10 +117,8 @@ var Services = _webexPlugin.default.extend({
152
117
  */
153
118
  hasAllowedDomains: function hasAllowedDomains() {
154
119
  var catalog = this._getCatalog();
155
-
156
120
  return catalog.getAllowedDomains().length > 0;
157
121
  },
158
-
159
122
  /**
160
123
  * Generate a service catalog as an object from
161
124
  * the associated instance catalog.
@@ -165,10 +128,8 @@ var Services = _webexPlugin.default.extend({
165
128
  */
166
129
  list: function list(priorityHost, serviceGroup) {
167
130
  var catalog = this._getCatalog();
168
-
169
131
  return catalog.list(priorityHost, serviceGroup);
170
132
  },
171
-
172
133
  /**
173
134
  * Mark a priority host service url as failed.
174
135
  * This will mark the host associated with the
@@ -184,10 +145,8 @@ var Services = _webexPlugin.default.extend({
184
145
  */
185
146
  markFailedUrl: function markFailedUrl(url, noPriorityHosts) {
186
147
  var catalog = this._getCatalog();
187
-
188
148
  return catalog.markFailedUrl(url, noPriorityHosts);
189
149
  },
190
-
191
150
  /**
192
151
  * saves all the services from the pre and post catalog service
193
152
  * @param {Object} serviceUrls
@@ -196,7 +155,6 @@ var Services = _webexPlugin.default.extend({
196
155
  _updateServiceUrls: function _updateServiceUrls(serviceUrls) {
197
156
  this._serviceUrls = _objectSpread(_objectSpread({}, this._serviceUrls), serviceUrls);
198
157
  },
199
-
200
158
  /**
201
159
  * Update a list of `serviceUrls` to the most current
202
160
  * catalog via the defined `discoveryUrl` then returns the current
@@ -212,59 +170,49 @@ var Services = _webexPlugin.default.extend({
212
170
  */
213
171
  updateServices: function updateServices() {
214
172
  var _this = this;
215
-
216
173
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
217
- from = _ref.from,
218
- query = _ref.query,
219
- token = _ref.token,
220
- forceRefresh = _ref.forceRefresh;
221
-
174
+ from = _ref.from,
175
+ query = _ref.query,
176
+ token = _ref.token,
177
+ forceRefresh = _ref.forceRefresh;
222
178
  var catalog = this._getCatalog();
223
-
224
179
  var formattedQuery;
225
- var serviceGroup; // map catalog name to service group name.
180
+ var serviceGroup;
226
181
 
182
+ // map catalog name to service group name.
227
183
  switch (from) {
228
184
  case 'limited':
229
185
  serviceGroup = 'preauth';
230
186
  break;
231
-
232
187
  case 'signin':
233
188
  serviceGroup = 'signin';
234
189
  break;
235
-
236
190
  default:
237
191
  serviceGroup = 'postauth';
238
192
  break;
239
- } // confirm catalog update for group is not in progress.
240
-
193
+ }
241
194
 
195
+ // confirm catalog update for group is not in progress.
242
196
  if (catalog.status[serviceGroup].collecting) {
243
197
  return this.waitForCatalog(serviceGroup);
244
198
  }
245
-
246
199
  catalog.status[serviceGroup].collecting = true;
247
-
248
200
  if (serviceGroup === 'preauth') {
249
201
  var queryKey = query && (0, _keys.default)(query)[0];
250
-
251
202
  if (!['email', 'emailhash', 'userId', 'orgId', 'mode'].includes(queryKey)) {
252
203
  return _promise.default.reject(new Error('a query param of email, emailhash, userId, orgId, or mode is required'));
253
204
  }
254
- } // encode email when query key is email
255
-
256
-
205
+ }
206
+ // encode email when query key is email
257
207
  if (serviceGroup === 'preauth' || serviceGroup === 'signin') {
258
208
  var _queryKey = (0, _keys.default)(query)[0];
259
209
  formattedQuery = {};
260
-
261
210
  if (_queryKey === 'email' && query.email) {
262
211
  formattedQuery.emailhash = (0, _sha.default)(query.email.toLowerCase()).toString();
263
212
  } else {
264
213
  formattedQuery[_queryKey] = query[_queryKey];
265
214
  }
266
215
  }
267
-
268
216
  return this._fetchNewServiceHostmap({
269
217
  from: from,
270
218
  token: token,
@@ -272,16 +220,13 @@ var Services = _webexPlugin.default.extend({
272
220
  forceRefresh: forceRefresh
273
221
  }).then(function (serviceHostMap) {
274
222
  catalog.updateServiceUrls(serviceGroup, serviceHostMap);
275
-
276
223
  _this.updateCredentialsConfig();
277
-
278
224
  catalog.status[serviceGroup].collecting = false;
279
225
  }).catch(function (error) {
280
226
  catalog.status[serviceGroup].collecting = false;
281
227
  return _promise.default.reject(error);
282
228
  });
283
229
  },
284
-
285
230
  /**
286
231
  * User validation parameter transfer object for {@link validateUser}.
287
232
  * @param {object} ValidateUserPTO
@@ -290,7 +235,6 @@ var Services = _webexPlugin.default.extend({
290
235
  * @property {object} [ValidateUserPTO.activationOptions] - Extra options to pass when sending the activation
291
236
  * @property {object} [ValidateUserPTO.preloginUserId] - The prelogin user id to set when sending the activation.
292
237
  */
293
-
294
238
  /**
295
239
  * User validation return transfer object for {@link validateUser}.
296
240
  * @param {object} ValidateUserRTO
@@ -299,7 +243,6 @@ var Services = _webexPlugin.default.extend({
299
243
  * @property {string} ValidateUserRTO.details - A descriptive status message.
300
244
  * @property {object} ValidateUserRTO.user - **License** service user object.
301
245
  */
302
-
303
246
  /**
304
247
  * Validate if a user is activated and update the service catalogs as needed
305
248
  * based on the user's activation status.
@@ -309,24 +252,25 @@ var Services = _webexPlugin.default.extend({
309
252
  */
310
253
  validateUser: function validateUser(_ref2) {
311
254
  var _this2 = this;
312
-
313
255
  var email = _ref2.email,
314
- _ref2$reqId = _ref2.reqId,
315
- reqId = _ref2$reqId === void 0 ? 'WEBCLIENT' : _ref2$reqId,
316
- _ref2$forceRefresh = _ref2.forceRefresh,
317
- forceRefresh = _ref2$forceRefresh === void 0 ? false : _ref2$forceRefresh,
318
- _ref2$activationOptio = _ref2.activationOptions,
319
- activationOptions = _ref2$activationOptio === void 0 ? {} : _ref2$activationOptio,
320
- preloginUserId = _ref2.preloginUserId;
321
- this.logger.info('services: validating a user'); // Validate that an email parameter key was provided.
322
-
256
+ _ref2$reqId = _ref2.reqId,
257
+ reqId = _ref2$reqId === void 0 ? 'WEBCLIENT' : _ref2$reqId,
258
+ _ref2$forceRefresh = _ref2.forceRefresh,
259
+ forceRefresh = _ref2$forceRefresh === void 0 ? false : _ref2$forceRefresh,
260
+ _ref2$activationOptio = _ref2.activationOptions,
261
+ activationOptions = _ref2$activationOptio === void 0 ? {} : _ref2$activationOptio,
262
+ preloginUserId = _ref2.preloginUserId;
263
+ this.logger.info('services: validating a user');
264
+
265
+ // Validate that an email parameter key was provided.
323
266
  if (!email) {
324
267
  return _promise.default.reject(new Error('`email` is required'));
325
- } // Destructure the credentials object.
326
-
268
+ }
327
269
 
328
- var canAuthorize = this.webex.credentials.canAuthorize; // Validate that the user is already authorized.
270
+ // Destructure the credentials object.
271
+ var canAuthorize = this.webex.credentials.canAuthorize;
329
272
 
273
+ // Validate that the user is already authorized.
330
274
  if (canAuthorize) {
331
275
  return this.updateServices({
332
276
  forceRefresh: forceRefresh
@@ -348,47 +292,49 @@ var Services = _webexPlugin.default.extend({
348
292
  user: userObj
349
293
  };
350
294
  });
351
- } // Destructure the client authorization details.
295
+ }
352
296
 
297
+ // Destructure the client authorization details.
353
298
  /* eslint-disable camelcase */
354
-
355
-
356
299
  var _this$webex$credentia = this.webex.credentials.config,
357
- client_id = _this$webex$credentia.client_id,
358
- client_secret = _this$webex$credentia.client_secret; // Validate that client authentication details exist.
300
+ client_id = _this$webex$credentia.client_id,
301
+ client_secret = _this$webex$credentia.client_secret;
359
302
 
303
+ // Validate that client authentication details exist.
360
304
  if (!client_id || !client_secret) {
361
305
  return _promise.default.reject(new Error('client authentication details are not available'));
362
306
  }
363
307
  /* eslint-enable camelcase */
364
- // Declare a class-memeber-scoped token for usage within the promise chain.
365
308
 
309
+ // Declare a class-memeber-scoped token for usage within the promise chain.
310
+ var token;
366
311
 
367
- var token; // Begin client authentication user validation.
368
-
312
+ // Begin client authentication user validation.
369
313
  return this.collectPreauthCatalog({
370
314
  email: email
371
315
  }).then(function () {
372
316
  // Retrieve the service url from the updated catalog. This is required
373
317
  // since `WebexCore` is usually not fully initialized at the time this
374
318
  // request completes.
375
- var idbrokerService = _this2.get('idbroker', true); // Collect the client auth token.
376
-
319
+ var idbrokerService = _this2.get('idbroker', true);
377
320
 
321
+ // Collect the client auth token.
378
322
  return _this2.webex.credentials.getClientToken({
379
323
  uri: "".concat(idbrokerService, "idb/oauth2/v1/access_token"),
380
324
  scope: 'webexsquare:admin webexsquare:get_conversation Identity:SCIM'
381
325
  });
382
326
  }).then(function (tokenObj) {
383
327
  // Generate the token string.
384
- token = tokenObj.toString(); // Collect the signin catalog using the client auth information.
328
+ token = tokenObj.toString();
385
329
 
330
+ // Collect the signin catalog using the client auth information.
386
331
  return _this2.collectSigninCatalog({
387
332
  email: email,
388
333
  token: token,
389
334
  forceRefresh: forceRefresh
390
335
  });
391
- }) // Validate if collecting the signin catalog failed and populate the RTO
336
+ })
337
+ // Validate if collecting the signin catalog failed and populate the RTO
392
338
  // with the appropriate content.
393
339
  .catch(function (error) {
394
340
  return {
@@ -396,7 +342,8 @@ var Services = _webexPlugin.default.extend({
396
342
  activated: false,
397
343
  details: error.name !== 'NotFound' ? 'user exists but is not activated' : 'user does not exist and is not activated'
398
344
  };
399
- }) // Validate if the previous promise resolved with an RTO and populate the
345
+ })
346
+ // Validate if the previous promise resolved with an RTO and populate the
400
347
  // new RTO accordingly.
401
348
  .then(function (rto) {
402
349
  return _promise.default.all([rto || {
@@ -412,9 +359,8 @@ var Services = _webexPlugin.default.extend({
412
359
  })]);
413
360
  }).then(function (_ref3) {
414
361
  var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
415
- rto = _ref4[0],
416
- user = _ref4[1];
417
-
362
+ rto = _ref4[0],
363
+ user = _ref4[1];
418
364
  return _objectSpread(_objectSpread({}, rto), {}, {
419
365
  user: user
420
366
  });
@@ -427,7 +373,6 @@ var Services = _webexPlugin.default.extend({
427
373
  return _promise.default.reject(response);
428
374
  });
429
375
  },
430
-
431
376
  /**
432
377
  * Get user meeting preferences (preferred webex site).
433
378
  *
@@ -435,21 +380,18 @@ var Services = _webexPlugin.default.extend({
435
380
  */
436
381
  getMeetingPreferences: function getMeetingPreferences() {
437
382
  var _this3 = this;
438
-
439
383
  return this.request({
440
384
  method: 'GET',
441
385
  service: 'hydra',
442
386
  resource: 'meetingPreferences'
443
387
  }).then(function (res) {
444
388
  _this3.logger.info('services: received user region info');
445
-
446
389
  return res.body;
447
390
  }).catch(function (err) {
448
- _this3.logger.info('services: was not able to fetch user login information', err); // resolve successfully even if request failed
449
-
391
+ _this3.logger.info('services: was not able to fetch user login information', err);
392
+ // resolve successfully even if request failed
450
393
  });
451
394
  },
452
-
453
395
  /**
454
396
  * Fetches client region info such as countryCode and timezone.
455
397
  *
@@ -457,7 +399,6 @@ var Services = _webexPlugin.default.extend({
457
399
  */
458
400
  fetchClientRegionInfo: function fetchClientRegionInfo() {
459
401
  var _this4 = this;
460
-
461
402
  return this.request({
462
403
  uri: 'https://ds.ciscospark.com/v1/region',
463
404
  addAuthHeader: false,
@@ -467,14 +408,12 @@ var Services = _webexPlugin.default.extend({
467
408
  timeout: 5000
468
409
  }).then(function (res) {
469
410
  _this4.logger.info('services: received user region info');
470
-
471
411
  return res.body;
472
412
  }).catch(function (err) {
473
- _this4.logger.info('services: was not able to get user region info', err); // resolve successfully even if request failed
474
-
413
+ _this4.logger.info('services: was not able to get user region info', err);
414
+ // resolve successfully even if request failed
475
415
  });
476
416
  },
477
-
478
417
  /**
479
418
  * User activation parameter transfer object for {@link sendUserActivation}.
480
419
  * @typedef {object} SendUserActivationPTO
@@ -484,7 +423,6 @@ var Services = _webexPlugin.default.extend({
484
423
  * @property {object} SendUserActivationPTO.activationOptions - Extra options to pass when sending the activation.
485
424
  * @property {object} SendUserActivationPTO.preloginUserId - The prelogin user id to set when sending the activation.
486
425
  */
487
-
488
426
  /**
489
427
  * Send a request to activate a user using a client token.
490
428
  *
@@ -493,23 +431,23 @@ var Services = _webexPlugin.default.extend({
493
431
  */
494
432
  sendUserActivation: function sendUserActivation(_ref5) {
495
433
  var _this5 = this;
496
-
497
434
  var email = _ref5.email,
498
- reqId = _ref5.reqId,
499
- token = _ref5.token,
500
- activationOptions = _ref5.activationOptions,
501
- preloginUserId = _ref5.preloginUserId;
435
+ reqId = _ref5.reqId,
436
+ token = _ref5.token,
437
+ activationOptions = _ref5.activationOptions,
438
+ preloginUserId = _ref5.preloginUserId;
502
439
  this.logger.info('services: sending user activation request');
503
440
  var countryCode;
504
- var timezone; // try to fetch client region info first
441
+ var timezone;
505
442
 
443
+ // try to fetch client region info first
506
444
  return this.fetchClientRegionInfo().then(function (clientRegionInfo) {
507
445
  if (clientRegionInfo) {
508
446
  countryCode = clientRegionInfo.countryCode;
509
447
  timezone = clientRegionInfo.timezone;
510
- } // Send the user activation request to the **License** service.
511
-
448
+ }
512
449
 
450
+ // Send the user activation request to the **License** service.
513
451
  return _this5.request({
514
452
  service: 'license',
515
453
  resource: 'users/activations',
@@ -527,16 +465,17 @@ var Services = _webexPlugin.default.extend({
527
465
  }, activationOptions),
528
466
  shouldRefreshAccessToken: false
529
467
  });
530
- }) // On success, return the **License** user object.
468
+ })
469
+ // On success, return the **License** user object.
531
470
  .then(function (_ref6) {
532
471
  var body = _ref6.body;
533
472
  return body;
534
- }) // On failure, reject with error from **License**.
473
+ })
474
+ // On failure, reject with error from **License**.
535
475
  .catch(function (error) {
536
476
  return _promise.default.reject(error);
537
477
  });
538
478
  },
539
-
540
479
  /**
541
480
  * simplified method to update the preauth catalog via email
542
481
  *
@@ -548,7 +487,6 @@ var Services = _webexPlugin.default.extend({
548
487
  */
549
488
  collectPreauthCatalog: function collectPreauthCatalog(query) {
550
489
  var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
551
-
552
490
  if (!query) {
553
491
  return this.updateServices({
554
492
  from: 'limited',
@@ -558,14 +496,12 @@ var Services = _webexPlugin.default.extend({
558
496
  forceRefresh: forceRefresh
559
497
  });
560
498
  }
561
-
562
499
  return this.updateServices({
563
500
  from: 'limited',
564
501
  query: query,
565
502
  forceRefresh: forceRefresh
566
503
  });
567
504
  },
568
-
569
505
  /**
570
506
  * simplified method to update the signin catalog via email and token
571
507
  * @param {object} param
@@ -575,18 +511,15 @@ var Services = _webexPlugin.default.extend({
575
511
  */
576
512
  collectSigninCatalog: function collectSigninCatalog() {
577
513
  var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
578
- email = _ref7.email,
579
- token = _ref7.token,
580
- forceRefresh = _ref7.forceRefresh;
581
-
514
+ email = _ref7.email,
515
+ token = _ref7.token,
516
+ forceRefresh = _ref7.forceRefresh;
582
517
  if (!email) {
583
518
  return _promise.default.reject(new Error('`email` is required'));
584
519
  }
585
-
586
520
  if (!token) {
587
521
  return _promise.default.reject(new Error('`token` is required'));
588
522
  }
589
-
590
523
  return this.updateServices({
591
524
  from: 'signin',
592
525
  query: {
@@ -596,7 +529,6 @@ var Services = _webexPlugin.default.extend({
596
529
  forceRefresh: forceRefresh
597
530
  });
598
531
  },
599
-
600
532
  /**
601
533
  * Updates credentials config to utilize u2c catalog
602
534
  * urls.
@@ -604,31 +536,29 @@ var Services = _webexPlugin.default.extend({
604
536
  */
605
537
  updateCredentialsConfig: function updateCredentialsConfig() {
606
538
  var _this$list = this.list(true),
607
- idbroker = _this$list.idbroker,
608
- identity = _this$list.identity;
609
-
539
+ idbroker = _this$list.idbroker,
540
+ identity = _this$list.identity;
610
541
  if (idbroker && identity) {
611
542
  var _this$webex$config$cr = this.webex.config.credentials,
612
- authorizationString = _this$webex$config$cr.authorizationString,
613
- authorizeUrl = _this$webex$config$cr.authorizeUrl; // This must be set outside of the setConfig method used to assign the
614
- // idbroker and identity url values.
543
+ authorizationString = _this$webex$config$cr.authorizationString,
544
+ authorizeUrl = _this$webex$config$cr.authorizeUrl;
615
545
 
546
+ // This must be set outside of the setConfig method used to assign the
547
+ // idbroker and identity url values.
616
548
  this.webex.config.credentials.authorizeUrl = authorizationString ? authorizeUrl : "".concat(idbroker.replace(trailingSlashes, ''), "/idb/oauth2/v1/authorize");
617
549
  this.webex.setConfig({
618
550
  credentials: {
619
551
  idbroker: {
620
552
  url: idbroker.replace(trailingSlashes, '') // remove trailing slash
621
-
622
553
  },
554
+
623
555
  identity: {
624
556
  url: identity.replace(trailingSlashes, '') // remove trailing slash
625
-
626
557
  }
627
558
  }
628
559
  });
629
560
  }
630
561
  },
631
-
632
562
  /**
633
563
  * Wait until the service catalog is available,
634
564
  * or reject afte ra timeout of 60 seconds.
@@ -638,20 +568,15 @@ var Services = _webexPlugin.default.extend({
638
568
  */
639
569
  waitForCatalog: function waitForCatalog(serviceGroup, timeout) {
640
570
  var catalog = this._getCatalog();
641
-
642
571
  var supertoken = this.webex.credentials.supertoken;
643
-
644
572
  if (serviceGroup === 'postauth' && supertoken && supertoken.access_token && !catalog.status.postauth.collecting && !catalog.status.postauth.ready) {
645
573
  if (!catalog.status.preauth.ready) {
646
574
  return this.initServiceCatalogs();
647
575
  }
648
-
649
576
  return this.updateServices();
650
577
  }
651
-
652
578
  return catalog.waitForCatalog(serviceGroup, timeout);
653
579
  },
654
-
655
580
  /**
656
581
  * Service waiting parameter transfer object for {@link waitForService}.
657
582
  *
@@ -660,7 +585,6 @@ var Services = _webexPlugin.default.extend({
660
585
  * @property {string} [WaitForServicePTO.url] - The service url.
661
586
  * @property {string} [WaitForServicePTO.timeout] - wait duration in seconds.
662
587
  */
663
-
664
588
  /**
665
589
  * Wait until the service has been ammended to any service catalog. This
666
590
  * method prioritizes the service name over the service url when searching.
@@ -670,35 +594,29 @@ var Services = _webexPlugin.default.extend({
670
594
  */
671
595
  waitForService: function waitForService(_ref8) {
672
596
  var _this6 = this;
673
-
674
597
  var name = _ref8.name,
675
- _ref8$timeout = _ref8.timeout,
676
- timeout = _ref8$timeout === void 0 ? 5 : _ref8$timeout,
677
- url = _ref8.url;
678
- var services = this.webex.config.services; // Save memory by grabbing the catalog after there isn't a priortyURL
598
+ _ref8$timeout = _ref8.timeout,
599
+ timeout = _ref8$timeout === void 0 ? 5 : _ref8$timeout,
600
+ url = _ref8.url;
601
+ var services = this.webex.config.services;
679
602
 
603
+ // Save memory by grabbing the catalog after there isn't a priortyURL
680
604
  var catalog = this._getCatalog();
681
-
682
605
  var fetchFromServiceUrl = services.servicesNotNeedValidation.find(function (service) {
683
606
  return service === name;
684
607
  });
685
-
686
608
  if (fetchFromServiceUrl) {
687
609
  return _promise.default.resolve(this._serviceUrls[name]);
688
610
  }
689
-
690
611
  var priorityUrl = this.get(name, true);
691
612
  var priorityUrlObj = this.getServiceFromUrl(url);
692
-
693
613
  if (priorityUrl || priorityUrlObj) {
694
614
  return _promise.default.resolve(priorityUrl || priorityUrlObj.priorityUrl);
695
615
  }
696
-
697
616
  if (catalog.isReady) {
698
617
  if (url) {
699
618
  return _promise.default.resolve(url);
700
619
  }
701
-
702
620
  this.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_SERVICE_NOT_FOUND, {
703
621
  fields: {
704
622
  service_name: name
@@ -706,16 +624,12 @@ var Services = _webexPlugin.default.extend({
706
624
  });
707
625
  return _promise.default.reject(new Error("services: service '".concat(name, "' was not found in any of the catalogs")));
708
626
  }
709
-
710
627
  return new _promise.default(function (resolve, reject) {
711
628
  var groupsToCheck = ['preauth', 'signin', 'postauth'];
712
-
713
629
  var checkCatalog = function checkCatalog(catalogGroup) {
714
630
  return catalog.waitForCatalog(catalogGroup, timeout).then(function () {
715
631
  var scopedPriorityUrl = _this6.get(name, true);
716
-
717
632
  var scopedPrioriryUrlObj = _this6.getServiceFromUrl(url);
718
-
719
633
  if (scopedPriorityUrl || scopedPrioriryUrlObj) {
720
634
  resolve(scopedPriorityUrl || scopedPrioriryUrlObj.priorityUrl);
721
635
  }
@@ -723,7 +637,6 @@ var Services = _webexPlugin.default.extend({
723
637
  return undefined;
724
638
  });
725
639
  };
726
-
727
640
  _promise.default.all(groupsToCheck.map(function (group) {
728
641
  return checkCatalog(group);
729
642
  })).then(function () {
@@ -732,12 +645,10 @@ var Services = _webexPlugin.default.extend({
732
645
  service_name: name
733
646
  }
734
647
  });
735
-
736
648
  reject(new Error("services: service '".concat(name, "' was not found after waiting")));
737
649
  });
738
650
  });
739
651
  },
740
-
741
652
  /**
742
653
  * @private
743
654
  * Organize a received hostmap from a service
@@ -749,17 +660,14 @@ var Services = _webexPlugin.default.extend({
749
660
  // map the host catalog items to a formatted hostmap
750
661
  var formattedHostmap = (0, _keys.default)(serviceHostmap.hostCatalog).reduce(function (accumulator, key) {
751
662
  var _serviceItem$hosts;
752
-
753
663
  if (serviceHostmap.hostCatalog[key].length === 0) {
754
664
  return accumulator;
755
665
  }
756
-
757
666
  var serviceName = serviceHostmap.hostCatalog[key][0].id.split(':')[3];
758
667
  var defaultUrl = serviceHostmap.serviceLinks[serviceName];
759
668
  var serviceItem = accumulator.find(function (item) {
760
669
  return item.name === serviceName;
761
670
  });
762
-
763
671
  if (!serviceItem) {
764
672
  serviceItem = {
765
673
  name: serviceName,
@@ -769,8 +677,8 @@ var Services = _webexPlugin.default.extend({
769
677
  };
770
678
  accumulator.push(serviceItem);
771
679
  }
772
-
773
- (_serviceItem$hosts = serviceItem.hosts).push.apply(_serviceItem$hosts, [// map the default key as a low priority default for cluster matching
680
+ (_serviceItem$hosts = serviceItem.hosts).push.apply(_serviceItem$hosts, [
681
+ // map the default key as a low priority default for cluster matching
774
682
  {
775
683
  host: key,
776
684
  ttl: -1,
@@ -782,15 +690,14 @@ var Services = _webexPlugin.default.extend({
782
690
  homeCluster: serviceItem.defaultHost === key
783
691
  });
784
692
  }))));
785
-
786
693
  return accumulator;
787
- }, []); // append service links that do not exist in the host catalog
694
+ }, []);
788
695
 
696
+ // append service links that do not exist in the host catalog
789
697
  (0, _keys.default)(serviceHostmap.serviceLinks).forEach(function (key) {
790
698
  var service = formattedHostmap.find(function (item) {
791
699
  return item.name === key;
792
700
  });
793
-
794
701
  if (!service) {
795
702
  formattedHostmap.push({
796
703
  name: key,
@@ -799,13 +706,13 @@ var Services = _webexPlugin.default.extend({
799
706
  hosts: []
800
707
  });
801
708
  }
802
- }); // update all the service urls in the host catalog
709
+ });
803
710
 
804
- this._updateServiceUrls(serviceHostmap.serviceLinks);
711
+ // update all the service urls in the host catalog
805
712
 
713
+ this._updateServiceUrls(serviceHostmap.serviceLinks);
806
714
  return formattedHostmap;
807
715
  },
808
-
809
716
  /**
810
717
  * Get the clusterId associated with a URL string.
811
718
  * @param {string} url
@@ -813,10 +720,8 @@ var Services = _webexPlugin.default.extend({
813
720
  */
814
721
  getClusterId: function getClusterId(url) {
815
722
  var catalog = this._getCatalog();
816
-
817
723
  return catalog.findClusterId(url);
818
724
  },
819
-
820
725
  /**
821
726
  * Get a service value from a provided clusterId. This method will
822
727
  * return an object containing both the name and url of a found service.
@@ -830,10 +735,8 @@ var Services = _webexPlugin.default.extend({
830
735
  */
831
736
  getServiceFromClusterId: function getServiceFromClusterId(params) {
832
737
  var catalog = this._getCatalog();
833
-
834
738
  return catalog.findServiceFromClusterId(params);
835
739
  },
836
-
837
740
  /**
838
741
  * Get a service object from a service url if the service url exists in the
839
742
  * catalog.
@@ -846,20 +749,16 @@ var Services = _webexPlugin.default.extend({
846
749
  */
847
750
  getServiceFromUrl: function getServiceFromUrl() {
848
751
  var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
849
-
850
752
  var service = this._getCatalog().findServiceUrlFromUrl(url);
851
-
852
753
  if (!service) {
853
754
  return undefined;
854
755
  }
855
-
856
756
  return {
857
757
  name: service.name,
858
758
  priorityUrl: service.get(true),
859
759
  defaultUrl: service.get()
860
760
  };
861
761
  },
862
-
863
762
  /**
864
763
  * Verify that a provided url exists in the service
865
764
  * catalog.
@@ -868,10 +767,8 @@ var Services = _webexPlugin.default.extend({
868
767
  */
869
768
  isServiceUrl: function isServiceUrl(url) {
870
769
  var catalog = this._getCatalog();
871
-
872
770
  return !!catalog.findServiceUrlFromUrl(url);
873
771
  },
874
-
875
772
  /**
876
773
  * Determine if a provided url is in the catalog's allowed domains.
877
774
  *
@@ -880,10 +777,8 @@ var Services = _webexPlugin.default.extend({
880
777
  */
881
778
  isAllowedDomainUrl: function isAllowedDomainUrl(url) {
882
779
  var catalog = this._getCatalog();
883
-
884
780
  return !!catalog.findAllowedDomain(url);
885
781
  },
886
-
887
782
  /**
888
783
  * Converts the host portion of the url from default host
889
784
  * to a priority host
@@ -895,14 +790,11 @@ var Services = _webexPlugin.default.extend({
895
790
  convertUrlToPriorityHostUrl: function convertUrlToPriorityHostUrl() {
896
791
  var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
897
792
  var data = this.getServiceFromUrl(url);
898
-
899
793
  if (!data) {
900
794
  throw Error("No service associated with url: [".concat(url, "]"));
901
795
  }
902
-
903
796
  return url.replace(data.defaultUrl, data.priorityUrl);
904
797
  },
905
-
906
798
  /**
907
799
  * @private
908
800
  * Simplified method wrapper for sending a request to get
@@ -918,43 +810,35 @@ var Services = _webexPlugin.default.extend({
918
810
  */
919
811
  _fetchNewServiceHostmap: function _fetchNewServiceHostmap() {
920
812
  var _this7 = this;
921
-
922
813
  var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
923
- from = _ref9.from,
924
- query = _ref9.query,
925
- token = _ref9.token,
926
- forceRefresh = _ref9.forceRefresh;
927
-
814
+ from = _ref9.from,
815
+ query = _ref9.query,
816
+ token = _ref9.token,
817
+ forceRefresh = _ref9.forceRefresh;
928
818
  var service = 'u2c';
929
819
  var resource = from ? "/".concat(from, "/catalog") : '/catalog';
930
-
931
820
  var qs = _objectSpread(_objectSpread({}, query), {}, {
932
821
  format: 'hostmap'
933
822
  });
934
-
935
823
  if (forceRefresh) {
936
824
  qs.timestamp = new Date().getTime();
937
825
  }
938
-
939
826
  var requestObject = {
940
827
  method: 'GET',
941
828
  service: service,
942
829
  resource: resource,
943
830
  qs: qs
944
831
  };
945
-
946
832
  if (token) {
947
833
  requestObject.headers = {
948
834
  authorization: token
949
835
  };
950
836
  }
951
-
952
837
  return this.request(requestObject).then(function (_ref10) {
953
838
  var body = _ref10.body;
954
839
  return _this7._formatReceivedHostmap(body);
955
840
  });
956
841
  },
957
-
958
842
  /**
959
843
  * Initialize the discovery services and the whitelisted services.
960
844
  *
@@ -963,17 +847,16 @@ var Services = _webexPlugin.default.extend({
963
847
  initConfig: function initConfig() {
964
848
  // Get the catalog and destructure the services config.
965
849
  var catalog = this._getCatalog();
966
-
967
850
  var _this$webex$config = this.webex.config,
968
- services = _this$webex$config.services,
969
- fedramp = _this$webex$config.fedramp; // Validate that the services configuration exists.
851
+ services = _this$webex$config.services,
852
+ fedramp = _this$webex$config.fedramp;
970
853
 
854
+ // Validate that the services configuration exists.
971
855
  if (services) {
972
856
  if (fedramp) {
973
857
  services.discovery = _serviceFedRamp.default;
974
- } // Check for discovery services.
975
-
976
-
858
+ }
859
+ // Check for discovery services.
977
860
  if (services.discovery) {
978
861
  // Format the discovery configuration into an injectable array.
979
862
  var formattedDiscoveryServices = (0, _keys.default)(services.discovery).map(function (key) {
@@ -981,11 +864,11 @@ var Services = _webexPlugin.default.extend({
981
864
  name: key,
982
865
  defaultUrl: services.discovery[key]
983
866
  };
984
- }); // Inject formatted discovery services into services catalog.
867
+ });
985
868
 
869
+ // Inject formatted discovery services into services catalog.
986
870
  catalog.updateServiceUrls('discovery', formattedDiscoveryServices);
987
871
  }
988
-
989
872
  if (services.override) {
990
873
  // Format the override configuration into an injectable array.
991
874
  var formattedOverrideServices = (0, _keys.default)(services.override).map(function (key) {
@@ -993,22 +876,22 @@ var Services = _webexPlugin.default.extend({
993
876
  name: key,
994
877
  defaultUrl: services.override[key]
995
878
  };
996
- }); // Inject formatted override services into services catalog.
879
+ });
997
880
 
881
+ // Inject formatted override services into services catalog.
998
882
  catalog.updateServiceUrls('override', formattedOverrideServices);
999
- } // Check for allowed host domains.
1000
-
883
+ }
1001
884
 
885
+ // Check for allowed host domains.
1002
886
  if (services.allowedDomains) {
1003
887
  // Store the allowed domains as a property of the catalog.
1004
888
  catalog.setAllowedDomains(services.allowedDomains);
1005
- } // Set `validateDomains` property to match configuration
1006
-
889
+ }
1007
890
 
891
+ // Set `validateDomains` property to match configuration
1008
892
  this.validateDomains = services.validateDomains;
1009
893
  }
1010
894
  },
1011
-
1012
895
  /**
1013
896
  * Make the initial requests to collect the root catalogs.
1014
897
  *
@@ -1016,16 +899,19 @@ var Services = _webexPlugin.default.extend({
1016
899
  */
1017
900
  initServiceCatalogs: function initServiceCatalogs() {
1018
901
  var _this8 = this;
902
+ this.logger.info('services: initializing initial service catalogs');
1019
903
 
1020
- this.logger.info('services: initializing initial service catalogs'); // Destructure the credentials plugin.
904
+ // Destructure the credentials plugin.
905
+ var credentials = this.webex.credentials;
1021
906
 
1022
- var credentials = this.webex.credentials; // Init a promise chain. Must be done as a Promise.resolve() to allow
907
+ // Init a promise chain. Must be done as a Promise.resolve() to allow
1023
908
  // credentials#getOrgId() to properly throw.
1024
-
1025
- return _promise.default.resolve() // Get the user's OrgId.
909
+ return _promise.default.resolve()
910
+ // Get the user's OrgId.
1026
911
  .then(function () {
1027
912
  return credentials.getOrgId();
1028
- }) // Begin collecting the preauth/limited catalog.
913
+ })
914
+ // Begin collecting the preauth/limited catalog.
1029
915
  .then(function (orgId) {
1030
916
  return _this8.collectPreauthCatalog({
1031
917
  orgId: orgId
@@ -1037,13 +923,12 @@ var Services = _webexPlugin.default.extend({
1037
923
  return _this8.updateServices().catch(function () {
1038
924
  return _this8.logger.warn('services: cannot retrieve postauth catalog');
1039
925
  });
1040
- } // Return a resolved promise for consistent return value.
1041
-
926
+ }
1042
927
 
928
+ // Return a resolved promise for consistent return value.
1043
929
  return _promise.default.resolve();
1044
930
  });
1045
931
  },
1046
-
1047
932
  /**
1048
933
  * Initializer
1049
934
  *
@@ -1053,24 +938,24 @@ var Services = _webexPlugin.default.extend({
1053
938
  */
1054
939
  initialize: function initialize() {
1055
940
  var _this9 = this;
1056
-
1057
941
  var catalog = new _serviceCatalog.default();
1058
942
  var registry = new _serviceRegistry.default();
1059
943
  var state = new _serviceState.default();
1060
-
1061
944
  this._catalogs.set(this.webex, catalog);
1062
-
1063
945
  this.registries.set(this.webex, registry);
1064
- this.states.set(this.webex, state); // Listen for configuration changes once.
946
+ this.states.set(this.webex, state);
1065
947
 
948
+ // Listen for configuration changes once.
1066
949
  this.listenToOnce(this.webex, 'change:config', function () {
1067
950
  _this9.initConfig();
1068
- }); // wait for webex instance to be ready before attempting
1069
- // to update the service catalogs
951
+ });
1070
952
 
953
+ // wait for webex instance to be ready before attempting
954
+ // to update the service catalogs
1071
955
  this.listenToOnce(this.webex, 'ready', function () {
1072
- var supertoken = _this9.webex.credentials.supertoken; // Validate if the supertoken exists.
956
+ var supertoken = _this9.webex.credentials.supertoken;
1073
957
 
958
+ // Validate if the supertoken exists.
1074
959
  if (supertoken && supertoken.access_token) {
1075
960
  _this9.initServiceCatalogs().then(function () {
1076
961
  catalog.isReady = true;
@@ -1079,18 +964,15 @@ var Services = _webexPlugin.default.extend({
1079
964
  });
1080
965
  } else {
1081
966
  var email = _this9.webex.config.email;
1082
-
1083
967
  _this9.collectPreauthCatalog(email ? {
1084
968
  email: email
1085
969
  } : undefined);
1086
970
  }
1087
971
  });
1088
972
  },
1089
- version: "3.0.0-beta.15"
973
+ version: "3.0.0-beta.17"
1090
974
  });
1091
975
  /* eslint-enable no-underscore-dangle */
1092
-
1093
-
1094
976
  var _default = Services;
1095
977
  exports.default = _default;
1096
978
  //# sourceMappingURL=services.js.map