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