@webex/internal-plugin-device 3.0.0-beta.4 → 3.0.0-beta.400

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 (44) hide show
  1. package/README.md +10 -6
  2. package/dist/config.js +9 -9
  3. package/dist/config.js.map +1 -1
  4. package/dist/constants.js +2 -3
  5. package/dist/constants.js.map +1 -1
  6. package/dist/device.js +114 -172
  7. package/dist/device.js.map +1 -1
  8. package/dist/features/feature-collection.js +1 -8
  9. package/dist/features/feature-collection.js.map +1 -1
  10. package/dist/features/feature-model.js +15 -42
  11. package/dist/features/feature-model.js.map +1 -1
  12. package/dist/features/features-model.js +9 -21
  13. package/dist/features/features-model.js.map +1 -1
  14. package/dist/features/index.js +0 -8
  15. package/dist/features/index.js.map +1 -1
  16. package/dist/index.js +2 -24
  17. package/dist/index.js.map +1 -1
  18. package/dist/interceptors/device-url.js +12 -33
  19. package/dist/interceptors/device-url.js.map +1 -1
  20. package/dist/ipNetworkDetector.js +200 -0
  21. package/dist/ipNetworkDetector.js.map +1 -0
  22. package/dist/metrics.js +0 -2
  23. package/dist/metrics.js.map +1 -1
  24. package/package.json +10 -10
  25. package/src/config.js +17 -9
  26. package/src/constants.js +3 -5
  27. package/src/device.js +164 -146
  28. package/src/features/feature-collection.js +1 -1
  29. package/src/features/feature-model.js +5 -11
  30. package/src/features/features-model.js +3 -9
  31. package/src/features/index.js +1 -5
  32. package/src/index.js +3 -11
  33. package/src/interceptors/device-url.js +5 -7
  34. package/src/ipNetworkDetector.ts +176 -0
  35. package/src/metrics.js +1 -2
  36. package/test/integration/spec/device.js +210 -239
  37. package/test/integration/spec/webex.js +9 -9
  38. package/test/unit/spec/device.js +110 -53
  39. package/test/unit/spec/features/feature-collection.js +2 -2
  40. package/test/unit/spec/features/feature-model.js +23 -39
  41. package/test/unit/spec/features/features-model.js +4 -12
  42. package/test/unit/spec/interceptors/device-url.js +69 -109
  43. package/test/unit/spec/ipNetworkDetector.js +410 -0
  44. package/test/unit/spec/wdm-dto.json +5 -13
package/src/config.js CHANGED
@@ -2,7 +2,6 @@ import {inBrowser, deviceType} from '@webex/common';
2
2
 
3
3
  export default {
4
4
  device: {
5
-
6
5
  /**
7
6
  * The duration to wait for the catalog to populate in seconds.
8
7
  *
@@ -16,22 +15,22 @@ export default {
16
15
  * @type {Object}
17
16
  */
18
17
  defaults: {
19
-
20
18
  /**
21
19
  * The default body configuration of registration requests.
22
20
  *
23
21
  * @type {Object}
24
22
  */
25
23
  body: {
26
- name: (typeof process.title === 'string' ?
27
- process.title.trim() : undefined) ||
28
- inBrowser && 'browser' || 'javascript',
24
+ name:
25
+ (typeof process.title === 'string' ? process.title.trim() : undefined) ||
26
+ (inBrowser && 'browser') ||
27
+ 'javascript',
29
28
  deviceType: deviceType.WEB,
30
29
  model: 'web-js-sdk',
31
30
  localizedModel: 'webex-js-sdk',
32
31
  systemName: 'WEBEX_JS_SDK',
33
- systemVersion: '1.0.0'
34
- }
32
+ systemVersion: '1.0.0',
33
+ },
35
34
  },
36
35
 
37
36
  /**
@@ -56,6 +55,15 @@ export default {
56
55
  *
57
56
  * @type {boolean}
58
57
  */
59
- ephemeralDeviceTTL: 30 * 60
60
- }
58
+ ephemeralDeviceTTL: 30 * 60,
59
+ },
60
+
61
+ /**
62
+ * installationId is used exclusively as web client for fraud prevention,
63
+ * and is aliased to as machineId by CA.
64
+ *
65
+ * @alias device.machineId
66
+ * @type {string}
67
+ */
68
+ installationId: undefined,
61
69
  };
package/src/constants.js CHANGED
@@ -8,18 +8,16 @@ export const CISCO_DEVICE_URL = 'cisco-device-url';
8
8
  export const FEATURE_COLLECTION_NAMES = [
9
9
  FEATURE_COLLECTION_DEVELOPER,
10
10
  FEATURE_COLLECTION_ENTITLEMENT,
11
- FEATURE_COLLECTION_USER
11
+ FEATURE_COLLECTION_USER,
12
12
  ];
13
13
 
14
14
  export const FEATURE_TYPES = {
15
15
  BOOLEAN: 'boolean',
16
16
  NUMBER: 'number',
17
- STRING: 'string'
17
+ STRING: 'string',
18
18
  };
19
19
 
20
20
  // Device constants.
21
21
  export const DEVICE_EVENT_REGISTRATION_SUCCESS = 'registration:success';
22
22
 
23
- export const DEVICE_EVENTS = [
24
- DEVICE_EVENT_REGISTRATION_SUCCESS
25
- ];
23
+ export const DEVICE_EVENTS = [DEVICE_EVENT_REGISTRATION_SUCCESS];
package/src/device.js CHANGED
@@ -4,11 +4,9 @@ import {persist, waitForValue, WebexPlugin} from '@webex/webex-core';
4
4
  import {safeSetTimeout} from '@webex/common-timers';
5
5
 
6
6
  import METRICS from './metrics';
7
- import {
8
- FEATURE_COLLECTION_NAMES,
9
- DEVICE_EVENT_REGISTRATION_SUCCESS
10
- } from './constants';
7
+ import {FEATURE_COLLECTION_NAMES, DEVICE_EVENT_REGISTRATION_SUCCESS} from './constants';
11
8
  import FeaturesModel from './features/features-model';
9
+ import IpNetworkDetector from './ipNetworkDetector';
12
10
 
13
11
  /**
14
12
  * Determine if the plugin should be initialized based on cached storage.
@@ -20,7 +18,6 @@ function decider() {
20
18
  }
21
19
 
22
20
  const Device = WebexPlugin.extend({
23
-
24
21
  // Ampersand property members.
25
22
 
26
23
  namespace: 'Device',
@@ -37,7 +34,13 @@ const Device = WebexPlugin.extend({
37
34
  *
38
35
  * @type {FeaturesModel}
39
36
  */
40
- features: FeaturesModel
37
+ features: FeaturesModel,
38
+ /**
39
+ * Helper class for detecting what IP network version (ipv4, ipv6) we're on.
40
+ *
41
+ * @type {IpNetworkDetector}
42
+ */
43
+ ipNetworkDetector: IpNetworkDetector,
41
44
  },
42
45
 
43
46
  /**
@@ -121,7 +124,7 @@ const Device = WebexPlugin.extend({
121
124
  *
122
125
  * @returns {Array<string>}
123
126
  */
124
- ecmSupportedStorageProviders: ['array', false, (() => [])],
127
+ ecmSupportedStorageProviders: ['array', false, () => []],
125
128
 
126
129
  /**
127
130
  * This property stores the modification time value retrieved from the
@@ -242,7 +245,7 @@ const Device = WebexPlugin.extend({
242
245
  *
243
246
  * @type {'ALLOW' | 'BLOCK'}
244
247
  */
245
- whiteboardFileShareControl: 'string'
248
+ whiteboardFileShareControl: 'string',
246
249
  },
247
250
 
248
251
  /**
@@ -268,9 +271,9 @@ const Device = WebexPlugin.extend({
268
271
  * @returns {boolean}
269
272
  */
270
273
  fn() {
271
- return !!(this.url);
272
- }
273
- }
274
+ return !!this.url;
275
+ },
276
+ },
274
277
  },
275
278
 
276
279
  /**
@@ -318,7 +321,7 @@ const Device = WebexPlugin.extend({
318
321
  *
319
322
  * @type {boolean}
320
323
  */
321
- isInNetwork: 'boolean'
324
+ isInNetwork: 'boolean',
322
325
  },
323
326
 
324
327
  // Event method members.
@@ -355,61 +358,60 @@ const Device = WebexPlugin.extend({
355
358
  this.logger.info('device: refreshing');
356
359
 
357
360
  // Validate that the device can be registered.
358
- return this.canRegister()
359
- .then(() => {
360
- // Validate if the device is not registered and register instead.
361
- if (!this.registered) {
362
- this.logger.info('device: device not registered, registering');
363
-
364
- return this.register();
365
- }
366
-
367
- // Merge body configurations, overriding defaults.
368
- const body = {
369
- ...(this.serialize()),
370
- ...(this.config.body ? this.config.body : {})
371
- };
372
-
373
- // Remove unneeded properties from the body object.
374
- delete body.features;
375
- delete body.mediaCluster;
376
- delete body.etag;
377
-
378
- // Append a ttl value if the device is marked as ephemeral.
379
- if (this.config.ephemeral) {
380
- body.ttl = this.config.ephemeralDeviceTTL;
381
- }
382
-
383
- // Merge header configurations, overriding defaults.
384
- const headers = {
385
- ...(this.config.defaults.headers ? this.config.defaults.headers : {}),
386
- ...(this.config.headers ? this.config.headers : {}),
387
- // If etag is sent, WDM will not send developer feature toggles unless they have changed
388
- ...(this.etag ? {'If-None-Match': this.etag} : {})
389
- };
390
-
391
- return this.request({
392
- method: 'PUT',
393
- uri: this.url,
394
- body,
395
- headers
396
- })
397
- .then((response) => this.processRegistrationSuccess(response))
398
- .catch((reason) => {
399
- // Handle a 404 error, which indicates that the device is no longer
400
- // valid and needs to be registered as a new device.
401
- if (reason.statusCode === 404) {
402
- this.logger.info('device: refresh failed, device is not valid');
403
- this.logger.info('device: attempting to register a new device');
361
+ return this.canRegister().then(() => {
362
+ // Validate if the device is not registered and register instead.
363
+ if (!this.registered) {
364
+ this.logger.info('device: device not registered, registering');
404
365
 
405
- this.clear();
366
+ return this.register();
367
+ }
406
368
 
407
- return this.register();
408
- }
369
+ // Merge body configurations, overriding defaults.
370
+ const body = {
371
+ ...this.serialize(),
372
+ ...(this.config.body ? this.config.body : {}),
373
+ };
409
374
 
410
- return Promise.reject(reason);
411
- });
412
- });
375
+ // Remove unneeded properties from the body object.
376
+ delete body.features;
377
+ delete body.mediaCluster;
378
+ delete body.etag;
379
+
380
+ // Append a ttl value if the device is marked as ephemeral.
381
+ if (this.config.ephemeral) {
382
+ body.ttl = this.config.ephemeralDeviceTTL;
383
+ }
384
+
385
+ // Merge header configurations, overriding defaults.
386
+ const headers = {
387
+ ...(this.config.defaults.headers ? this.config.defaults.headers : {}),
388
+ ...(this.config.headers ? this.config.headers : {}),
389
+ // If etag is sent, WDM will not send developer feature toggles unless they have changed
390
+ ...(this.etag ? {'If-None-Match': this.etag} : {}),
391
+ };
392
+
393
+ return this.request({
394
+ method: 'PUT',
395
+ uri: this.url,
396
+ body,
397
+ headers,
398
+ })
399
+ .then((response) => this.processRegistrationSuccess(response))
400
+ .catch((reason) => {
401
+ // Handle a 404 error, which indicates that the device is no longer
402
+ // valid and needs to be registered as a new device.
403
+ if (reason.statusCode === 404) {
404
+ this.logger.info('device: refresh failed, device is not valid');
405
+ this.logger.info('device: attempting to register a new device');
406
+
407
+ this.clear();
408
+
409
+ return this.register();
410
+ }
411
+
412
+ return Promise.reject(reason);
413
+ });
414
+ });
413
415
  },
414
416
 
415
417
  /**
@@ -425,52 +427,68 @@ const Device = WebexPlugin.extend({
425
427
  this.logger.info('device: registering');
426
428
 
427
429
  // Validate that the device can be registered.
428
- return this.canRegister()
429
- .then(() => {
430
- // Validate if the device is already registered and refresh instead.
431
- if (this.registered) {
432
- this.logger.info('device: device already registered, refreshing');
433
-
434
- return this.refresh();
435
- }
436
-
437
- // Merge body configurations, overriding defaults.
438
- const body = {
439
- ...(this.config.defaults.body ? this.config.defaults.body : {}),
440
- ...(this.config.body ? this.config.body : {})
441
- };
442
-
443
- // Merge header configurations, overriding defaults.
444
- const headers = {
445
- ...(this.config.defaults.headers ? this.config.defaults.headers : {}),
446
- ...(this.config.headers ? this.config.headers : {})
447
- };
448
-
449
- // Append a ttl value if the device is marked as ephemeral
450
- if (this.config.ephemeral) {
451
- body.ttl = this.config.ephemeralDeviceTTL;
452
- }
453
-
454
- // This will be replaced by a `create()` method.
455
- return this.request({
456
- method: 'POST',
457
- service: 'wdm',
458
- resource: 'devices',
459
- body,
460
- headers
430
+ return this.canRegister().then(() => {
431
+ // Validate if the device is already registered and refresh instead.
432
+ if (this.registered) {
433
+ this.logger.info('device: device already registered, refreshing');
434
+
435
+ return this.refresh();
436
+ }
437
+
438
+ // Merge body configurations, overriding defaults.
439
+ const body = {
440
+ ...(this.config.defaults.body ? this.config.defaults.body : {}),
441
+ ...(this.config.body ? this.config.body : {}),
442
+ };
443
+
444
+ // Merge header configurations, overriding defaults.
445
+ const headers = {
446
+ ...(this.config.defaults.headers ? this.config.defaults.headers : {}),
447
+ ...(this.config.headers ? this.config.headers : {}),
448
+ };
449
+
450
+ // Append a ttl value if the device is marked as ephemeral
451
+ if (this.config.ephemeral) {
452
+ body.ttl = this.config.ephemeralDeviceTTL;
453
+ }
454
+ this.webex.internal.newMetrics.submitInternalEvent({
455
+ name: 'internal.register.device.request',
456
+ });
457
+
458
+ // This will be replaced by a `create()` method.
459
+ return this.request({
460
+ method: 'POST',
461
+ service: 'wdm',
462
+ resource: 'devices',
463
+ body,
464
+ headers,
465
+ })
466
+ .catch((error) => {
467
+ this.webex.internal.newMetrics.submitInternalEvent({
468
+ name: 'internal.register.device.response',
469
+ });
470
+
471
+ throw error;
461
472
  })
462
- .then((response) => {
463
- this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);
464
-
465
- return this.processRegistrationSuccess(response);
466
- })
467
- .catch((error) => {
468
- this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_WDM_REGISTRATION_FAILED, {
469
- fields: {error}
470
- });
471
- throw error;
473
+ .then((response) => {
474
+ // Do not add any processing of response above this as that will affect timestamp
475
+ this.webex.internal.newMetrics.submitInternalEvent({
476
+ name: 'internal.register.device.response',
472
477
  });
473
- });
478
+
479
+ this.webex.internal.metrics.submitClientMetrics(
480
+ METRICS.JS_SDK_WDM_REGISTRATION_SUCCESSFUL
481
+ );
482
+
483
+ return this.processRegistrationSuccess(response);
484
+ })
485
+ .catch((error) => {
486
+ this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_WDM_REGISTRATION_FAILED, {
487
+ fields: {error},
488
+ });
489
+ throw error;
490
+ });
491
+ });
474
492
  },
475
493
 
476
494
  /**
@@ -493,9 +511,8 @@ const Device = WebexPlugin.extend({
493
511
 
494
512
  return this.request({
495
513
  uri: this.url,
496
- method: 'DELETE'
497
- })
498
- .then(() => this.clear());
514
+ method: 'DELETE',
515
+ }).then(() => this.clear());
499
516
  },
500
517
  /* eslint-enable require-jsdoc */
501
518
 
@@ -515,19 +532,19 @@ const Device = WebexPlugin.extend({
515
532
  const {services} = this.webex.internal;
516
533
 
517
534
  // Wait for the postauth catalog to populate.
518
- return services.waitForCatalog(
519
- 'postauth',
520
- this.config.canRegisterWaitDuration
521
- )
522
- .then(() => (
523
- // Validate that the service exists after waiting for the catalog.
524
- services.get('wdm') ?
525
- Promise.resolve() :
526
- Promise.reject(new Error([
527
- 'device: cannot register,',
528
- '\'wdm\' service is not available from the postauth catalog'
529
- ].join(' ')))
530
- ));
535
+ return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(() =>
536
+ // Validate that the service exists after waiting for the catalog.
537
+ services.get('wdm')
538
+ ? Promise.resolve()
539
+ : Promise.reject(
540
+ new Error(
541
+ [
542
+ 'device: cannot register,',
543
+ "'wdm' service is not available from the postauth catalog",
544
+ ].join(' ')
545
+ )
546
+ )
547
+ );
531
548
  },
532
549
 
533
550
  /**
@@ -556,14 +573,14 @@ const Device = WebexPlugin.extend({
556
573
  const headers = {
557
574
  'cisco-no-http-redirect': null,
558
575
  'spark-user-agent': null,
559
- trackingid: null
576
+ trackingid: null,
560
577
  };
561
578
 
562
579
  // Send the network reachability request.
563
580
  return this.request({
564
581
  headers,
565
582
  method: 'GET',
566
- uri: this.intranetInactivityCheckUrl
583
+ uri: this.intranetInactivityCheckUrl,
567
584
  })
568
585
  .then(() => {
569
586
  this.isInNetwork = true;
@@ -612,17 +629,15 @@ const Device = WebexPlugin.extend({
612
629
  .catch((error) => {
613
630
  this.logger.warn(error.message);
614
631
 
615
- return Promise.reject(new Error(
616
- 'device: failed to get the current websocket url'
617
- ));
632
+ return Promise.reject(new Error('device: failed to get the current websocket url'));
618
633
  });
619
634
  }
620
635
 
621
636
  // Validate if the device is registered.
622
637
  if (!this.registered) {
623
- return Promise.reject(new Error(
624
- 'device: cannot get websocket url, device is not registered'
625
- ));
638
+ return Promise.reject(
639
+ new Error('device: cannot get websocket url, device is not registered')
640
+ );
626
641
  }
627
642
 
628
643
  // Attempt to collect the priority-host-mapped web socket URL.
@@ -633,9 +648,7 @@ const Device = WebexPlugin.extend({
633
648
  return Promise.resolve(wsUrl);
634
649
  }
635
650
 
636
- return Promise.reject(new Error(
637
- 'device: failed to get the current websocket url'
638
- ));
651
+ return Promise.reject(new Error('device: failed to get the current websocket url'));
639
652
  },
640
653
 
641
654
  /**
@@ -654,9 +667,9 @@ const Device = WebexPlugin.extend({
654
667
  delete body.services;
655
668
  delete body.serviceHostMap;
656
669
 
657
- const {etag} = response.headers;
670
+ const {etag} = response.headers || {};
658
671
 
659
- if (this.etag && this.etag === etag) {
672
+ if (this.etag && etag && this.etag === etag) {
660
673
  // If current etag matches the previous one and we have sent
661
674
  // If-None-Match header the developer and entitlement feature
662
675
  // toggles will not be returned
@@ -707,12 +720,14 @@ const Device = WebexPlugin.extend({
707
720
 
708
721
  // Validate if the device is currently in a meeting and is configured to
709
722
  // required inactivity enforcement.
710
- if (!this.isInMeeting && this.config.enableInactivityEnforcement &&
711
- this.isReachabilityChecked) {
723
+ if (
724
+ !this.isInMeeting &&
725
+ this.config.enableInactivityEnforcement &&
726
+ this.isReachabilityChecked
727
+ ) {
712
728
  if (this.isInNetwork) {
713
729
  this.setLogoutTimer(this.inNetworkInactivityDuration);
714
- }
715
- else {
730
+ } else {
716
731
  this.setLogoutTimer(this.intranetInactivityDuration);
717
732
  }
718
733
  }
@@ -732,7 +747,9 @@ const Device = WebexPlugin.extend({
732
747
  }
733
748
 
734
749
  // Setup user activity date event listener.
735
- this.on('change:lastUserActivityDate', () => { this.resetLogoutTimer(); });
750
+ this.on('change:lastUserActivityDate', () => {
751
+ this.resetLogoutTimer();
752
+ });
736
753
 
737
754
  // Initialize a new timer.
738
755
  this.logoutTimer = safeSetTimeout(() => {
@@ -754,9 +771,10 @@ const Device = WebexPlugin.extend({
754
771
  resolve();
755
772
  }
756
773
 
757
- const timeoutTimer = safeSetTimeout(() => reject(
758
- new Error('device: timeout occured while waiting for registration')
759
- ), timeout * 1000);
774
+ const timeoutTimer = safeSetTimeout(
775
+ () => reject(new Error('device: timeout occured while waiting for registration')),
776
+ timeout * 1000
777
+ );
760
778
 
761
779
  this.once(DEVICE_EVENT_REGISTRATION_SUCCESS, () => {
762
780
  clearTimeout(timeoutTimer);
@@ -832,7 +850,7 @@ const Device = WebexPlugin.extend({
832
850
  this.isInMeeting = false;
833
851
  this.resetLogoutTimer();
834
852
  });
835
- }
853
+ },
836
854
  /* eslint-enable require-jsdoc */
837
855
  });
838
856
 
@@ -24,7 +24,7 @@ const FeatureCollection = AmpCollection.extend({
24
24
  *
25
25
  * @type {Class}
26
26
  */
27
- model: FeatureModel
27
+ model: FeatureModel,
28
28
  });
29
29
 
30
30
  export default FeatureCollection;
@@ -20,7 +20,6 @@ import {FEATURE_TYPES} from '../constants';
20
20
  * **WDM** service upon registration.
21
21
  */
22
22
  const FeatureModel = AmpState.extend({
23
-
24
23
  idAttribute: 'key', // needed by Ampersand to determine unique item
25
24
 
26
25
  // Ampersand property members.
@@ -67,7 +66,7 @@ const FeatureModel = AmpState.extend({
67
66
  *
68
67
  * @type {any}
69
68
  */
70
- value: 'any'
69
+ value: 'any',
71
70
  },
72
71
 
73
72
  /**
@@ -82,11 +81,7 @@ const FeatureModel = AmpState.extend({
82
81
  constructor(attrs, options = {}) {
83
82
  defaults(options, {parse: true});
84
83
 
85
- return Reflect.apply(
86
- AmpState.prototype.constructor,
87
- this,
88
- [attrs, options]
89
- );
84
+ return Reflect.apply(AmpState.prototype.constructor, this, [attrs, options]);
90
85
  },
91
86
 
92
87
  // Ampsersand method members.
@@ -150,7 +145,7 @@ const FeatureModel = AmpState.extend({
150
145
  // Validate that the overloaded class member returned an object with the
151
146
  // `lastModified` key-value pair and instance it as an ISO string.
152
147
  if (attrs.lastModified) {
153
- attrs.lastModified = (new Date(attrs.lastModified).toISOString());
148
+ attrs.lastModified = new Date(attrs.lastModified).toISOString();
154
149
  }
155
150
 
156
151
  return attrs;
@@ -179,8 +174,7 @@ const FeatureModel = AmpState.extend({
179
174
  if (isObject(key) || key === null) {
180
175
  attrs = key;
181
176
  optns = value;
182
- }
183
- else {
177
+ } else {
184
178
  attrs = {};
185
179
  attrs[key] = value;
186
180
  optns = options;
@@ -189,7 +183,7 @@ const FeatureModel = AmpState.extend({
189
183
  attrs = this.parse(attrs, optns);
190
184
 
191
185
  return Reflect.apply(AmpState.prototype.set, this, [attrs, optns]);
192
- }
186
+ },
193
187
  });
194
188
 
195
189
  export default FeatureModel;
@@ -14,7 +14,6 @@ import FeatureCollection from './feature-collection';
14
14
  * organize the data retrieved from the **wdm** service on device registration.
15
15
  */
16
16
  const FeaturesModel = AmpState.extend({
17
-
18
17
  // Ampersand property members.
19
18
 
20
19
  collections: {
@@ -37,7 +36,7 @@ const FeaturesModel = AmpState.extend({
37
36
  *
38
37
  * @type {FeatureCollection}
39
38
  */
40
- user: FeatureCollection
39
+ user: FeatureCollection,
41
40
  },
42
41
 
43
42
  // Helper method members.
@@ -87,16 +86,11 @@ const FeaturesModel = AmpState.extend({
87
86
  eventNames.forEach((eventName) => {
88
87
  FEATURE_COLLECTION_NAMES.forEach((collectionName) => {
89
88
  this[collectionName].on(eventName, (model, options) => {
90
- this.trigger(
91
- `change:${collectionName}`,
92
- this,
93
- this[collectionName],
94
- options
95
- );
89
+ this.trigger(`change:${collectionName}`, this, this[collectionName], options);
96
90
  });
97
91
  });
98
92
  });
99
- }
93
+ },
100
94
  });
101
95
 
102
96
  export default FeaturesModel;
@@ -2,8 +2,4 @@ import FeatureCollection from './feature-collection';
2
2
  import FeatureModel from './feature-model';
3
3
  import FeaturesModel from './features-model';
4
4
 
5
- export {
6
- FeatureCollection,
7
- FeatureModel,
8
- FeaturesModel
9
- };
5
+ export {FeatureCollection, FeatureModel, FeaturesModel};
package/src/index.js CHANGED
@@ -13,7 +13,7 @@ import config from './config';
13
13
  registerInternalPlugin('device', Device, {
14
14
  config,
15
15
  interceptors: {
16
- DeviceUrlInterceptor: DeviceUrlInterceptor.create
16
+ DeviceUrlInterceptor: DeviceUrlInterceptor.create,
17
17
  },
18
18
  /**
19
19
  * Unregister the device in the case that the webex instance has logged out.
@@ -22,16 +22,8 @@ registerInternalPlugin('device', Device, {
22
22
  */
23
23
  onBeforeLogout() {
24
24
  return this.unregister();
25
- }
25
+ },
26
26
  });
27
27
 
28
28
  export {default} from './device';
29
- export {
30
- config,
31
- constants,
32
- DeviceUrlInterceptor,
33
- FeatureCollection,
34
- FeatureModel,
35
- FeaturesModel
36
- };
37
-
29
+ export {config, constants, DeviceUrlInterceptor, FeatureCollection, FeatureModel, FeaturesModel};