@webex/internal-plugin-device 3.0.0-beta.3 → 3.0.0-beta.31
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.
- package/README.md +10 -6
- package/dist/config.js +0 -8
- package/dist/config.js.map +1 -1
- package/dist/constants.js +2 -3
- package/dist/constants.js.map +1 -1
- package/dist/device.js +91 -169
- package/dist/device.js.map +1 -1
- package/dist/features/feature-collection.js +1 -8
- package/dist/features/feature-collection.js.map +1 -1
- package/dist/features/feature-model.js +15 -42
- package/dist/features/feature-model.js.map +1 -1
- package/dist/features/features-model.js +9 -21
- package/dist/features/features-model.js.map +1 -1
- package/dist/features/index.js +0 -8
- package/dist/features/index.js.map +1 -1
- package/dist/index.js +2 -24
- package/dist/index.js.map +1 -1
- package/dist/interceptors/device-url.js +12 -33
- package/dist/interceptors/device-url.js.map +1 -1
- package/dist/metrics.js +0 -2
- package/dist/metrics.js.map +1 -1
- package/package.json +10 -10
- package/src/config.js +8 -9
- package/src/constants.js +3 -5
- package/src/device.js +140 -144
- package/src/features/feature-collection.js +1 -1
- package/src/features/feature-model.js +5 -11
- package/src/features/features-model.js +3 -9
- package/src/features/index.js +1 -5
- package/src/index.js +3 -11
- package/src/interceptors/device-url.js +5 -7
- package/src/metrics.js +1 -2
- package/test/integration/spec/device.js +210 -239
- package/test/integration/spec/webex.js +9 -9
- package/test/unit/spec/device.js +44 -53
- package/test/unit/spec/features/feature-collection.js +2 -2
- package/test/unit/spec/features/feature-model.js +23 -39
- package/test/unit/spec/features/features-model.js +4 -12
- package/test/unit/spec/interceptors/device-url.js +69 -109
- package/test/unit/spec/wdm-dto.json +5 -13
package/dist/device.js
CHANGED
|
@@ -1,55 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$keys = 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$getOwnPropertyDescriptor2 = 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 _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
24
|
-
|
|
25
15
|
var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
|
|
26
|
-
|
|
27
16
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
28
|
-
|
|
29
17
|
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor"));
|
|
30
|
-
|
|
31
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
32
|
-
|
|
33
19
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/applyDecoratedDescriptor"));
|
|
34
|
-
|
|
35
20
|
var _common = require("@webex/common");
|
|
36
|
-
|
|
37
21
|
var _webexCore = require("@webex/webex-core");
|
|
38
|
-
|
|
39
22
|
var _commonTimers = require("@webex/common-timers");
|
|
40
|
-
|
|
41
23
|
var _metrics = _interopRequireDefault(require("./metrics"));
|
|
42
|
-
|
|
43
24
|
var _constants = require("./constants");
|
|
44
|
-
|
|
45
25
|
var _featuresModel = _interopRequireDefault(require("./features/features-model"));
|
|
46
|
-
|
|
47
26
|
var _dec, _dec2, _dec3, _dec4, _dec5, _obj;
|
|
48
|
-
|
|
49
27
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor2(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
50
|
-
|
|
51
28
|
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$getOwnPropertyDescriptor2(source, key)); }); } return target; }
|
|
52
|
-
|
|
53
29
|
/**
|
|
54
30
|
* Determine if the plugin should be initialized based on cached storage.
|
|
55
31
|
*
|
|
@@ -58,9 +34,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
58
34
|
function decider() {
|
|
59
35
|
return !this.config.ephemeral;
|
|
60
36
|
}
|
|
61
|
-
|
|
62
37
|
var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)('@'), _dec2 = (0, _webexCore.waitForValue)('@'), _dec3 = (0, _webexCore.waitForValue)('@'), _dec4 = (0, _common.deprecated)('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()'), _dec5 = (0, _webexCore.persist)('@', decider), (_obj = {
|
|
63
38
|
// Ampersand property members.
|
|
39
|
+
|
|
64
40
|
namespace: 'Device',
|
|
65
41
|
// Allow for extra properties to prevent the plugin from failing due to
|
|
66
42
|
// **WDM** service DTO changes.
|
|
@@ -74,7 +50,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
74
50
|
*/
|
|
75
51
|
features: _featuresModel.default
|
|
76
52
|
},
|
|
77
|
-
|
|
78
53
|
/**
|
|
79
54
|
* A collection of device properties mostly assigned by the retrieved DTO from
|
|
80
55
|
* the **WDM** service that are mapped against the ampersand properties.
|
|
@@ -88,21 +63,18 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
88
63
|
* @type {'ALLOW' | 'BLOCK'}
|
|
89
64
|
*/
|
|
90
65
|
clientMessagingGiphy: 'string',
|
|
91
|
-
|
|
92
66
|
/**
|
|
93
67
|
* This property should store the company name.
|
|
94
68
|
*
|
|
95
69
|
* @type {string}
|
|
96
70
|
*/
|
|
97
71
|
customerCompanyName: 'string',
|
|
98
|
-
|
|
99
72
|
/**
|
|
100
73
|
* This property should store the logo url.
|
|
101
74
|
*
|
|
102
75
|
* @type {string}
|
|
103
76
|
*/
|
|
104
77
|
customerLogoUrl: 'string',
|
|
105
|
-
|
|
106
78
|
/**
|
|
107
79
|
* This property doesn't have any real values, but is sent during device
|
|
108
80
|
* refresh to prevent the **wdm** service from falling back to an iOS device
|
|
@@ -111,21 +83,18 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
111
83
|
* @type {string}
|
|
112
84
|
*/
|
|
113
85
|
deviceType: 'string',
|
|
114
|
-
|
|
115
86
|
/**
|
|
116
87
|
* This property should store the help url.
|
|
117
88
|
*
|
|
118
89
|
* @type {string}
|
|
119
90
|
*/
|
|
120
91
|
helpUrl: 'string',
|
|
121
|
-
|
|
122
92
|
/**
|
|
123
93
|
* This property should store the intranet inactivity timer duration.
|
|
124
94
|
*
|
|
125
95
|
* @type {number}
|
|
126
96
|
*/
|
|
127
97
|
intranetInactivityDuration: 'number',
|
|
128
|
-
|
|
129
98
|
/**
|
|
130
99
|
* This property stores the url required to validate if the device is able
|
|
131
100
|
* to actively reach the intranet network.
|
|
@@ -133,7 +102,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
133
102
|
* @type {string}
|
|
134
103
|
*/
|
|
135
104
|
intranetInactivityCheckUrl: 'string',
|
|
136
|
-
|
|
137
105
|
/**
|
|
138
106
|
* This property stores the inactivity timer duration, and could possibly
|
|
139
107
|
* deprecate the `intranetInactivityDuration` property.
|
|
@@ -141,7 +109,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
141
109
|
* @type {number}
|
|
142
110
|
*/
|
|
143
111
|
inNetworkInactivityDuration: 'number',
|
|
144
|
-
|
|
145
112
|
/**
|
|
146
113
|
* This property stores the ECM (external content management) enabled value
|
|
147
114
|
* for the whole organization.
|
|
@@ -149,7 +116,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
149
116
|
* @type {boolean}
|
|
150
117
|
*/
|
|
151
118
|
ecmEnabledForAllUsers: ['boolean', false, false],
|
|
152
|
-
|
|
153
119
|
/**
|
|
154
120
|
* This property stores an array of ECM (external content management)
|
|
155
121
|
* providers that are currently available.
|
|
@@ -159,7 +125,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
159
125
|
ecmSupportedStorageProviders: ['array', false, function () {
|
|
160
126
|
return [];
|
|
161
127
|
}],
|
|
162
|
-
|
|
163
128
|
/**
|
|
164
129
|
* This property stores the modification time value retrieved from the
|
|
165
130
|
* **WDM** endpoint formatted as ISO 8601.
|
|
@@ -167,28 +132,24 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
167
132
|
* @type {string}
|
|
168
133
|
*/
|
|
169
134
|
modificationTime: 'string',
|
|
170
|
-
|
|
171
135
|
/**
|
|
172
136
|
* This property stores the navigation bar color.
|
|
173
137
|
*
|
|
174
138
|
* @type {string}
|
|
175
139
|
*/
|
|
176
140
|
navigationBarColor: 'string',
|
|
177
|
-
|
|
178
141
|
/**
|
|
179
142
|
* This property stores the partner company's name when available.
|
|
180
143
|
*
|
|
181
144
|
* @type {string}
|
|
182
145
|
*/
|
|
183
146
|
partnerCompanyName: 'string',
|
|
184
|
-
|
|
185
147
|
/**
|
|
186
148
|
* This property stores the partner company's logo when available.
|
|
187
149
|
*
|
|
188
150
|
* @type {string}
|
|
189
151
|
*/
|
|
190
152
|
partnerLogoUrl: 'string',
|
|
191
|
-
|
|
192
153
|
/**
|
|
193
154
|
* This property stores the availability of people data from the **WDM**
|
|
194
155
|
* service.
|
|
@@ -196,28 +157,24 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
196
157
|
* @type {boolean}
|
|
197
158
|
*/
|
|
198
159
|
peopleInsightsEnabled: 'boolean',
|
|
199
|
-
|
|
200
160
|
/**
|
|
201
161
|
* This property stores the reporting site's description when available.
|
|
202
162
|
*
|
|
203
163
|
* @type {string}
|
|
204
164
|
*/
|
|
205
165
|
reportingSiteDesc: 'string',
|
|
206
|
-
|
|
207
166
|
/**
|
|
208
167
|
* This property stores the reporting site's access url when available.
|
|
209
168
|
*
|
|
210
169
|
* @type {string}
|
|
211
170
|
*/
|
|
212
171
|
reportingSiteUrl: 'string',
|
|
213
|
-
|
|
214
172
|
/**
|
|
215
173
|
* This property stores the encryption key url when available.
|
|
216
174
|
*
|
|
217
175
|
* @type {string}
|
|
218
176
|
*/
|
|
219
177
|
searchEncryptionKeyUrl: 'string',
|
|
220
|
-
|
|
221
178
|
/**
|
|
222
179
|
* This property stores the availability of support-provided text from the
|
|
223
180
|
* **WDM** service.
|
|
@@ -225,21 +182,18 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
225
182
|
* @type {boolean}
|
|
226
183
|
*/
|
|
227
184
|
showSupportText: 'boolean',
|
|
228
|
-
|
|
229
185
|
/**
|
|
230
186
|
* This property stores the support provider's company name when available.
|
|
231
187
|
*
|
|
232
188
|
* @type {string}
|
|
233
189
|
*/
|
|
234
190
|
supportProviderCompanyName: 'string',
|
|
235
|
-
|
|
236
191
|
/**
|
|
237
192
|
* This property stores the support provider's logo url when available.
|
|
238
193
|
*
|
|
239
194
|
* @type {string}
|
|
240
195
|
*/
|
|
241
196
|
supportProviderLogoUrl: 'string',
|
|
242
|
-
|
|
243
197
|
/**
|
|
244
198
|
* This property stores the device's url retrieved from a registration
|
|
245
199
|
* request. This property gets set via the initial registration process by a
|
|
@@ -248,7 +202,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
248
202
|
* @type {string}
|
|
249
203
|
*/
|
|
250
204
|
url: 'string',
|
|
251
|
-
|
|
252
205
|
/**
|
|
253
206
|
* This property stores the device's userId uuid value, which can also be
|
|
254
207
|
* derived from the device's registerd user's userId retrieved from
|
|
@@ -257,14 +210,12 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
257
210
|
* @type {string}
|
|
258
211
|
*/
|
|
259
212
|
userId: 'string',
|
|
260
|
-
|
|
261
213
|
/**
|
|
262
214
|
* This property stores whether or not file sharing is enabled
|
|
263
215
|
*
|
|
264
216
|
* @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}
|
|
265
217
|
*/
|
|
266
218
|
webFileShareControl: 'string',
|
|
267
|
-
|
|
268
219
|
/**
|
|
269
220
|
* This property stores the current web socket url used by the registered
|
|
270
221
|
* device.
|
|
@@ -272,7 +223,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
272
223
|
* @type {string}
|
|
273
224
|
*/
|
|
274
225
|
webSocketUrl: 'string',
|
|
275
|
-
|
|
276
226
|
/**
|
|
277
227
|
* This property stores the value indicating whether or not white board file
|
|
278
228
|
* sharing is enabled for the current device.
|
|
@@ -281,7 +231,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
281
231
|
*/
|
|
282
232
|
whiteboardFileShareControl: 'string'
|
|
283
233
|
},
|
|
284
|
-
|
|
285
234
|
/**
|
|
286
235
|
* A list of derived properties that populate based when their parent data
|
|
287
236
|
* available via the device's properties.
|
|
@@ -296,7 +245,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
296
245
|
*/
|
|
297
246
|
registered: {
|
|
298
247
|
deps: ['url'],
|
|
299
|
-
|
|
300
248
|
/**
|
|
301
249
|
* Checks if the device is registered by validating that the url exists.
|
|
302
250
|
* Amperstand does not allow this to method to be written as an arrow
|
|
@@ -309,7 +257,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
309
257
|
}
|
|
310
258
|
}
|
|
311
259
|
},
|
|
312
|
-
|
|
313
260
|
/**
|
|
314
261
|
* Stores timer data as well as other state details.
|
|
315
262
|
*
|
|
@@ -322,7 +269,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
322
269
|
* @type {any}
|
|
323
270
|
*/
|
|
324
271
|
logoutTimer: 'any',
|
|
325
|
-
|
|
326
272
|
/**
|
|
327
273
|
* This property stores the date for the last activity the user made
|
|
328
274
|
* with the current device.
|
|
@@ -330,7 +276,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
330
276
|
* @type {number}
|
|
331
277
|
*/
|
|
332
278
|
lastUserActivityDate: 'number',
|
|
333
|
-
|
|
334
279
|
/**
|
|
335
280
|
* This property stores whether or not the reachability check has been
|
|
336
281
|
* performed to prevent the reachability check from performing its
|
|
@@ -339,7 +284,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
339
284
|
* @returns {boolean}
|
|
340
285
|
*/
|
|
341
286
|
isReachabilityChecked: ['boolean', false, false],
|
|
342
|
-
|
|
343
287
|
/**
|
|
344
288
|
* This property stores whether or not the current device is in a meeting
|
|
345
289
|
* to prevent an unneeded timeout of a meeting due to inactivity.
|
|
@@ -347,7 +291,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
347
291
|
* @type {boolean}
|
|
348
292
|
*/
|
|
349
293
|
isInMeeting: 'boolean',
|
|
350
|
-
|
|
351
294
|
/**
|
|
352
295
|
* This property identifies if the device is currently in network to prevent
|
|
353
296
|
* the `resetLogoutTimer()` method from being called repeatedly once its
|
|
@@ -358,7 +301,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
358
301
|
isInNetwork: 'boolean'
|
|
359
302
|
},
|
|
360
303
|
// Event method members.
|
|
361
|
-
|
|
362
304
|
/**
|
|
363
305
|
* Trigger meeting started event for webex instance. Used by web-client team.
|
|
364
306
|
*
|
|
@@ -367,7 +309,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
367
309
|
meetingStarted: function meetingStarted() {
|
|
368
310
|
this.webex.trigger('meeting started');
|
|
369
311
|
},
|
|
370
|
-
|
|
371
312
|
/**
|
|
372
313
|
* Trigger meeting ended event for webex instance. Used by web-client team.
|
|
373
314
|
*
|
|
@@ -378,34 +319,33 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
378
319
|
},
|
|
379
320
|
refresh: function refresh() {
|
|
380
321
|
var _this = this;
|
|
322
|
+
this.logger.info('device: refreshing');
|
|
381
323
|
|
|
382
|
-
|
|
383
|
-
|
|
324
|
+
// Validate that the device can be registered.
|
|
384
325
|
return this.canRegister().then(function () {
|
|
385
326
|
// Validate if the device is not registered and register instead.
|
|
386
327
|
if (!_this.registered) {
|
|
387
328
|
_this.logger.info('device: device not registered, registering');
|
|
388
|
-
|
|
389
329
|
return _this.register();
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
var body = _objectSpread(_objectSpread({}, _this.serialize()), _this.config.body ? _this.config.body : {}); // Remove unneeded properties from the body object.
|
|
330
|
+
}
|
|
394
331
|
|
|
332
|
+
// Merge body configurations, overriding defaults.
|
|
333
|
+
var body = _objectSpread(_objectSpread({}, _this.serialize()), _this.config.body ? _this.config.body : {});
|
|
395
334
|
|
|
335
|
+
// Remove unneeded properties from the body object.
|
|
396
336
|
delete body.features;
|
|
397
337
|
delete body.mediaCluster;
|
|
398
|
-
delete body.etag;
|
|
338
|
+
delete body.etag;
|
|
399
339
|
|
|
340
|
+
// Append a ttl value if the device is marked as ephemeral.
|
|
400
341
|
if (_this.config.ephemeral) {
|
|
401
342
|
body.ttl = _this.config.ephemeralDeviceTTL;
|
|
402
|
-
}
|
|
403
|
-
|
|
343
|
+
}
|
|
404
344
|
|
|
345
|
+
// Merge header configurations, overriding defaults.
|
|
405
346
|
var headers = _objectSpread(_objectSpread(_objectSpread({}, _this.config.defaults.headers ? _this.config.defaults.headers : {}), _this.config.headers ? _this.config.headers : {}), _this.etag ? {
|
|
406
347
|
'If-None-Match': _this.etag
|
|
407
348
|
} : {});
|
|
408
|
-
|
|
409
349
|
return _this.request({
|
|
410
350
|
method: 'PUT',
|
|
411
351
|
uri: _this.url,
|
|
@@ -418,43 +358,38 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
418
358
|
// valid and needs to be registered as a new device.
|
|
419
359
|
if (reason.statusCode === 404) {
|
|
420
360
|
_this.logger.info('device: refresh failed, device is not valid');
|
|
421
|
-
|
|
422
361
|
_this.logger.info('device: attempting to register a new device');
|
|
423
|
-
|
|
424
362
|
_this.clear();
|
|
425
|
-
|
|
426
363
|
return _this.register();
|
|
427
364
|
}
|
|
428
|
-
|
|
429
365
|
return _promise.default.reject(reason);
|
|
430
366
|
});
|
|
431
367
|
});
|
|
432
368
|
},
|
|
433
369
|
register: function register() {
|
|
434
370
|
var _this2 = this;
|
|
371
|
+
this.logger.info('device: registering');
|
|
435
372
|
|
|
436
|
-
|
|
437
|
-
|
|
373
|
+
// Validate that the device can be registered.
|
|
438
374
|
return this.canRegister().then(function () {
|
|
439
375
|
// Validate if the device is already registered and refresh instead.
|
|
440
376
|
if (_this2.registered) {
|
|
441
377
|
_this2.logger.info('device: device already registered, refreshing');
|
|
442
|
-
|
|
443
378
|
return _this2.refresh();
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
var body = _objectSpread(_objectSpread({}, _this2.config.defaults.body ? _this2.config.defaults.body : {}), _this2.config.body ? _this2.config.body : {}); // Merge header configurations, overriding defaults.
|
|
448
|
-
|
|
379
|
+
}
|
|
449
380
|
|
|
450
|
-
|
|
381
|
+
// Merge body configurations, overriding defaults.
|
|
382
|
+
var body = _objectSpread(_objectSpread({}, _this2.config.defaults.body ? _this2.config.defaults.body : {}), _this2.config.body ? _this2.config.body : {});
|
|
451
383
|
|
|
384
|
+
// Merge header configurations, overriding defaults.
|
|
385
|
+
var headers = _objectSpread(_objectSpread({}, _this2.config.defaults.headers ? _this2.config.defaults.headers : {}), _this2.config.headers ? _this2.config.headers : {});
|
|
452
386
|
|
|
387
|
+
// Append a ttl value if the device is marked as ephemeral
|
|
453
388
|
if (_this2.config.ephemeral) {
|
|
454
389
|
body.ttl = _this2.config.ephemeralDeviceTTL;
|
|
455
|
-
}
|
|
456
|
-
|
|
390
|
+
}
|
|
457
391
|
|
|
392
|
+
// This will be replaced by a `create()` method.
|
|
458
393
|
return _this2.request({
|
|
459
394
|
method: 'POST',
|
|
460
395
|
service: 'wdm',
|
|
@@ -463,7 +398,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
463
398
|
headers: headers
|
|
464
399
|
}).then(function (response) {
|
|
465
400
|
_this2.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);
|
|
466
|
-
|
|
467
401
|
return _this2.processRegistrationSuccess(response);
|
|
468
402
|
}).catch(function (error) {
|
|
469
403
|
_this2.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_FAILED, {
|
|
@@ -471,21 +405,17 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
471
405
|
error: error
|
|
472
406
|
}
|
|
473
407
|
});
|
|
474
|
-
|
|
475
408
|
throw error;
|
|
476
409
|
});
|
|
477
410
|
});
|
|
478
411
|
},
|
|
479
412
|
unregister: function unregister() {
|
|
480
413
|
var _this3 = this;
|
|
481
|
-
|
|
482
414
|
this.logger.info('device: unregistering');
|
|
483
|
-
|
|
484
415
|
if (!this.registered) {
|
|
485
416
|
this.logger.warn('device: not registered');
|
|
486
417
|
return _promise.default.resolve();
|
|
487
418
|
}
|
|
488
|
-
|
|
489
419
|
return this.request({
|
|
490
420
|
uri: this.url,
|
|
491
421
|
method: 'DELETE'
|
|
@@ -493,10 +423,8 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
493
423
|
return _this3.clear();
|
|
494
424
|
});
|
|
495
425
|
},
|
|
496
|
-
|
|
497
426
|
/* eslint-enable require-jsdoc */
|
|
498
427
|
// Helper method members
|
|
499
|
-
|
|
500
428
|
/**
|
|
501
429
|
* Determine if registration methods can be performed. This method utilizes
|
|
502
430
|
* the `services` plugin to confirm if the appropriate service urls are
|
|
@@ -505,17 +433,19 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
505
433
|
* @returns {Promise<void, Error>}
|
|
506
434
|
*/
|
|
507
435
|
canRegister: function canRegister() {
|
|
508
|
-
this.logger.info('device: validating if registration can occur');
|
|
436
|
+
this.logger.info('device: validating if registration can occur');
|
|
509
437
|
|
|
510
|
-
|
|
438
|
+
// Destructure the services plugin for ease of reference.
|
|
439
|
+
var services = this.webex.internal.services;
|
|
511
440
|
|
|
441
|
+
// Wait for the postauth catalog to populate.
|
|
512
442
|
return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(function () {
|
|
513
|
-
return (
|
|
514
|
-
|
|
443
|
+
return (
|
|
444
|
+
// Validate that the service exists after waiting for the catalog.
|
|
445
|
+
services.get('wdm') ? _promise.default.resolve() : _promise.default.reject(new Error(['device: cannot register,', "'wdm' service is not available from the postauth catalog"].join(' ')))
|
|
515
446
|
);
|
|
516
447
|
});
|
|
517
448
|
},
|
|
518
|
-
|
|
519
449
|
/**
|
|
520
450
|
* Check if the device can currently reach the inactivity check url.
|
|
521
451
|
*
|
|
@@ -523,27 +453,28 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
523
453
|
*/
|
|
524
454
|
checkNetworkReachability: function checkNetworkReachability() {
|
|
525
455
|
var _this4 = this;
|
|
456
|
+
this.logger.info('device: checking network reachability');
|
|
526
457
|
|
|
527
|
-
|
|
528
|
-
|
|
458
|
+
// Validate if the device has been checked and reset the logout timer.
|
|
529
459
|
if (this.isReachabilityChecked) {
|
|
530
460
|
return _promise.default.resolve(this.resetLogoutTimer());
|
|
531
461
|
}
|
|
462
|
+
this.isReachabilityChecked = true;
|
|
532
463
|
|
|
533
|
-
|
|
534
|
-
|
|
464
|
+
// Validate if the device has a intranet checking url.
|
|
535
465
|
if (!this.intranetInactivityCheckUrl) {
|
|
536
466
|
this.isInNetwork = false;
|
|
537
467
|
return _promise.default.resolve(this.resetLogoutTimer());
|
|
538
|
-
}
|
|
539
|
-
|
|
468
|
+
}
|
|
540
469
|
|
|
470
|
+
// Clear unnecessary headers for reachability request.
|
|
541
471
|
var headers = {
|
|
542
472
|
'cisco-no-http-redirect': null,
|
|
543
473
|
'spark-user-agent': null,
|
|
544
474
|
trackingid: null
|
|
545
|
-
};
|
|
475
|
+
};
|
|
546
476
|
|
|
477
|
+
// Send the network reachability request.
|
|
547
478
|
return this.request({
|
|
548
479
|
headers: headers,
|
|
549
480
|
method: 'GET',
|
|
@@ -553,14 +484,11 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
553
484
|
return _promise.default.resolve(_this4.resetLogoutTimer());
|
|
554
485
|
}).catch(function () {
|
|
555
486
|
_this4.logger.info('device: did not reach ping endpoint');
|
|
556
|
-
|
|
557
487
|
_this4.logger.info('device: triggering off-network timer');
|
|
558
|
-
|
|
559
488
|
_this4.isInNetwork = false;
|
|
560
489
|
return _promise.default.resolve(_this4.resetLogoutTimer());
|
|
561
490
|
});
|
|
562
491
|
},
|
|
563
|
-
|
|
564
492
|
/**
|
|
565
493
|
* Clears the registration ttl value if available.
|
|
566
494
|
*
|
|
@@ -568,15 +496,14 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
568
496
|
* @returns {void}
|
|
569
497
|
*/
|
|
570
498
|
clear: function clear() {
|
|
571
|
-
this.logger.info('device: clearing registered device');
|
|
499
|
+
this.logger.info('device: clearing registered device');
|
|
572
500
|
|
|
501
|
+
// Prototype the extended class in order to preserve the parent member.
|
|
573
502
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
574
503
|
args[_key] = arguments[_key];
|
|
575
504
|
}
|
|
576
|
-
|
|
577
505
|
(0, _apply.default)(_webexCore.WebexPlugin.prototype.clear, this, args);
|
|
578
506
|
},
|
|
579
|
-
|
|
580
507
|
/**
|
|
581
508
|
* Get the current websocket url with the appropriate priority host.
|
|
582
509
|
*
|
|
@@ -585,37 +512,36 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
585
512
|
*/
|
|
586
513
|
getWebSocketUrl: function getWebSocketUrl() {
|
|
587
514
|
var _this5 = this;
|
|
588
|
-
|
|
589
515
|
var wait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
590
|
-
this.logger.info('device: getting the current websocket url');
|
|
516
|
+
this.logger.info('device: getting the current websocket url');
|
|
591
517
|
|
|
592
|
-
|
|
518
|
+
// Destructure the services plugin for ease of reference.
|
|
519
|
+
var services = this.webex.internal.services;
|
|
593
520
|
|
|
521
|
+
// Validate if the method should wait for registration.
|
|
594
522
|
if (wait) {
|
|
595
523
|
return this.waitForRegistration().then(function () {
|
|
596
524
|
return services.convertUrlToPriorityHostUrl(_this5.webSocketUrl);
|
|
597
525
|
}).catch(function (error) {
|
|
598
526
|
_this5.logger.warn(error.message);
|
|
599
|
-
|
|
600
527
|
return _promise.default.reject(new Error('device: failed to get the current websocket url'));
|
|
601
528
|
});
|
|
602
|
-
}
|
|
603
|
-
|
|
529
|
+
}
|
|
604
530
|
|
|
531
|
+
// Validate if the device is registered.
|
|
605
532
|
if (!this.registered) {
|
|
606
533
|
return _promise.default.reject(new Error('device: cannot get websocket url, device is not registered'));
|
|
607
|
-
}
|
|
608
|
-
|
|
534
|
+
}
|
|
609
535
|
|
|
610
|
-
|
|
536
|
+
// Attempt to collect the priority-host-mapped web socket URL.
|
|
537
|
+
var wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);
|
|
611
538
|
|
|
539
|
+
// Validate that the url was collected.
|
|
612
540
|
if (wsUrl) {
|
|
613
541
|
return _promise.default.resolve(wsUrl);
|
|
614
542
|
}
|
|
615
|
-
|
|
616
543
|
return _promise.default.reject(new Error('device: failed to get the current websocket url'));
|
|
617
544
|
},
|
|
618
|
-
|
|
619
545
|
/**
|
|
620
546
|
* Process a successful device registration.
|
|
621
547
|
*
|
|
@@ -624,46 +550,46 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
624
550
|
*/
|
|
625
551
|
processRegistrationSuccess: function processRegistrationSuccess(response) {
|
|
626
552
|
var _this6 = this;
|
|
553
|
+
this.logger.info('device: received registration payload');
|
|
627
554
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
var body = _objectSpread({}, response.body); // Clean service data.
|
|
631
|
-
|
|
555
|
+
// Clone the response body for service cleaning.
|
|
556
|
+
var body = _objectSpread({}, response.body);
|
|
632
557
|
|
|
558
|
+
// Clean service data.
|
|
633
559
|
delete body.services;
|
|
634
560
|
delete body.serviceHostMap;
|
|
635
561
|
var etag = response.headers.etag;
|
|
636
|
-
|
|
637
562
|
if (this.etag && this.etag === etag) {
|
|
638
563
|
// If current etag matches the previous one and we have sent
|
|
639
564
|
// If-None-Match header the developer and entitlement feature
|
|
640
565
|
// toggles will not be returned
|
|
641
566
|
var features = body.features;
|
|
642
|
-
delete body.features;
|
|
643
|
-
|
|
567
|
+
delete body.features;
|
|
568
|
+
// When using the etag feature cache, user and entitlement features are still returned
|
|
644
569
|
this.features.user.reset(features.user);
|
|
645
570
|
this.features.entitlement.reset(features.entitlement);
|
|
646
|
-
}
|
|
647
|
-
|
|
571
|
+
}
|
|
648
572
|
|
|
649
|
-
|
|
573
|
+
// Assign the recieved DTO from **WDM** to this device.
|
|
574
|
+
this.set(body);
|
|
650
575
|
|
|
576
|
+
// Assign the new etag to this device.
|
|
651
577
|
this.set({
|
|
652
578
|
etag: etag
|
|
653
|
-
});
|
|
579
|
+
});
|
|
654
580
|
|
|
581
|
+
// Validate if device is ephemeral and setup refresh timer.
|
|
655
582
|
if (this.config.ephemeral) {
|
|
656
583
|
this.logger.info('device: enqueuing device refresh');
|
|
657
584
|
var delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;
|
|
658
585
|
this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {
|
|
659
586
|
return _this6.refresh();
|
|
660
587
|
}, delay);
|
|
661
|
-
}
|
|
662
|
-
|
|
588
|
+
}
|
|
663
589
|
|
|
590
|
+
// Emit the registration:success event.
|
|
664
591
|
this.trigger(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, this);
|
|
665
592
|
},
|
|
666
|
-
|
|
667
593
|
/**
|
|
668
594
|
* Reset the current local logout timer for the registered device if
|
|
669
595
|
* registered.
|
|
@@ -671,15 +597,19 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
671
597
|
* @returns {void}
|
|
672
598
|
*/
|
|
673
599
|
resetLogoutTimer: function resetLogoutTimer() {
|
|
674
|
-
this.logger.info('device: resetting logout timer');
|
|
600
|
+
this.logger.info('device: resetting logout timer');
|
|
675
601
|
|
|
676
|
-
|
|
602
|
+
// Clear current logout timer.
|
|
603
|
+
clearTimeout(this.logoutTimer);
|
|
677
604
|
|
|
678
|
-
|
|
605
|
+
// Remove last activity date event listener.
|
|
606
|
+
this.off('change:lastUserActivityDate');
|
|
679
607
|
|
|
680
|
-
|
|
681
|
-
|
|
608
|
+
// Remove the logout timer.
|
|
609
|
+
this.unset('logoutTimer');
|
|
682
610
|
|
|
611
|
+
// Validate if the device is currently in a meeting and is configured to
|
|
612
|
+
// required inactivity enforcement.
|
|
683
613
|
if (!this.isInMeeting && this.config.enableInactivityEnforcement && this.isReachabilityChecked) {
|
|
684
614
|
if (this.isInNetwork) {
|
|
685
615
|
this.setLogoutTimer(this.inNetworkInactivityDuration);
|
|
@@ -688,7 +618,6 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
688
618
|
}
|
|
689
619
|
}
|
|
690
620
|
},
|
|
691
|
-
|
|
692
621
|
/**
|
|
693
622
|
* Set the value of the logout timer for the current registered device.
|
|
694
623
|
*
|
|
@@ -697,23 +626,21 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
697
626
|
*/
|
|
698
627
|
setLogoutTimer: function setLogoutTimer(duration) {
|
|
699
628
|
var _this7 = this;
|
|
700
|
-
|
|
701
629
|
this.logger.info('device: setting logout timer');
|
|
702
|
-
|
|
703
630
|
if (!duration || duration <= 0) {
|
|
704
631
|
return;
|
|
705
|
-
}
|
|
706
|
-
|
|
632
|
+
}
|
|
707
633
|
|
|
634
|
+
// Setup user activity date event listener.
|
|
708
635
|
this.on('change:lastUserActivityDate', function () {
|
|
709
636
|
_this7.resetLogoutTimer();
|
|
710
|
-
});
|
|
637
|
+
});
|
|
711
638
|
|
|
639
|
+
// Initialize a new timer.
|
|
712
640
|
this.logoutTimer = (0, _commonTimers.safeSetTimeout)(function () {
|
|
713
641
|
_this7.webex.logout();
|
|
714
642
|
}, duration * 1000);
|
|
715
643
|
},
|
|
716
|
-
|
|
717
644
|
/**
|
|
718
645
|
* Wait for the device to be registered.
|
|
719
646
|
*
|
|
@@ -722,18 +649,15 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
722
649
|
*/
|
|
723
650
|
waitForRegistration: function waitForRegistration() {
|
|
724
651
|
var _this8 = this;
|
|
725
|
-
|
|
726
652
|
var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
|
|
727
653
|
this.logger.info('device: waiting for registration');
|
|
728
654
|
return new _promise.default(function (resolve, reject) {
|
|
729
655
|
if (_this8.registered) {
|
|
730
656
|
resolve();
|
|
731
657
|
}
|
|
732
|
-
|
|
733
658
|
var timeoutTimer = (0, _commonTimers.safeSetTimeout)(function () {
|
|
734
659
|
return reject(new Error('device: timeout occured while waiting for registration'));
|
|
735
660
|
}, timeout * 1000);
|
|
736
|
-
|
|
737
661
|
_this8.once(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, function () {
|
|
738
662
|
clearTimeout(timeoutTimer);
|
|
739
663
|
resolve();
|
|
@@ -745,56 +669,54 @@ var Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)(
|
|
|
745
669
|
},
|
|
746
670
|
initialize: function initialize() {
|
|
747
671
|
var _this9 = this;
|
|
748
|
-
|
|
749
672
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
750
673
|
args[_key2] = arguments[_key2];
|
|
751
674
|
}
|
|
752
|
-
|
|
753
675
|
// Prototype the extended class in order to preserve the parent member.
|
|
754
|
-
(0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);
|
|
676
|
+
(0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);
|
|
755
677
|
|
|
678
|
+
// Initialize feature events and listeners.
|
|
756
679
|
_constants.FEATURE_COLLECTION_NAMES.forEach(function (collectionName) {
|
|
757
680
|
_this9.features.on("change:".concat(collectionName), function (model, value, options) {
|
|
758
681
|
_this9.trigger('change', _this9, options);
|
|
759
|
-
|
|
760
682
|
_this9.trigger('change:features', _this9, _this9.features, options);
|
|
761
683
|
});
|
|
762
|
-
});
|
|
763
|
-
|
|
684
|
+
});
|
|
764
685
|
|
|
686
|
+
// Initialize network reachability checking event for url change.
|
|
765
687
|
this.on('change:intranetInactivityCheckUrl', function () {
|
|
766
688
|
_this9.checkNetworkReachability();
|
|
767
|
-
});
|
|
689
|
+
});
|
|
768
690
|
|
|
691
|
+
// Initialize network reachability checking event for duration change.
|
|
769
692
|
this.on('change:intranetInactivityDuration', function () {
|
|
770
693
|
_this9.checkNetworkReachability();
|
|
771
|
-
});
|
|
694
|
+
});
|
|
772
695
|
|
|
696
|
+
// Initialize network reachability checking event for duration change.
|
|
773
697
|
this.on('change:inNetworkInactivityDuration', function () {
|
|
774
698
|
_this9.checkNetworkReachability();
|
|
775
|
-
});
|
|
699
|
+
});
|
|
776
700
|
|
|
701
|
+
// Initialize listener for activity checking.
|
|
777
702
|
this.listenTo(this.webex, 'user-activity', function () {
|
|
778
703
|
_this9.lastUserActivityDate = (0, _now.default)();
|
|
779
|
-
});
|
|
704
|
+
});
|
|
780
705
|
|
|
706
|
+
// Initialize listener for meeting started event.
|
|
781
707
|
this.listenTo(this.webex, 'meeting started', function () {
|
|
782
708
|
_this9.isInMeeting = true;
|
|
783
|
-
|
|
784
709
|
_this9.resetLogoutTimer();
|
|
785
|
-
});
|
|
710
|
+
});
|
|
786
711
|
|
|
712
|
+
// Initialize listener for meeting ended event.
|
|
787
713
|
this.listenTo(this.webex, 'meeting ended', function () {
|
|
788
714
|
_this9.isInMeeting = false;
|
|
789
|
-
|
|
790
715
|
_this9.resetLogoutTimer();
|
|
791
716
|
});
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
,
|
|
795
|
-
version: "3.0.0-beta.3"
|
|
717
|
+
} /* eslint-enable require-jsdoc */,
|
|
718
|
+
version: "3.0.0-beta.31"
|
|
796
719
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight, _dec], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "register", [_common.oneFlight, _dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "register"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "unregister", [_common.oneFlight, _dec3], (0, _getOwnPropertyDescriptor.default)(_obj, "unregister"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "markUrlFailedAndGetNew", [_dec4], (0, _getOwnPropertyDescriptor.default)(_obj, "markUrlFailedAndGetNew"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "initialize", [_dec5], (0, _getOwnPropertyDescriptor.default)(_obj, "initialize"), _obj)), _obj)));
|
|
797
|
-
|
|
798
720
|
var _default = Device;
|
|
799
721
|
exports.default = _default;
|
|
800
722
|
//# sourceMappingURL=device.js.map
|