@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/features/index.js
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
_Object$defineProperty(exports, "FeatureCollection", {
|
|
12
9
|
enumerable: true,
|
|
13
10
|
get: function get() {
|
|
14
11
|
return _featureCollection.default;
|
|
15
12
|
}
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
_Object$defineProperty(exports, "FeatureModel", {
|
|
19
15
|
enumerable: true,
|
|
20
16
|
get: function get() {
|
|
21
17
|
return _featureModel.default;
|
|
22
18
|
}
|
|
23
19
|
});
|
|
24
|
-
|
|
25
20
|
_Object$defineProperty(exports, "FeaturesModel", {
|
|
26
21
|
enumerable: true,
|
|
27
22
|
get: function get() {
|
|
28
23
|
return _featuresModel.default;
|
|
29
24
|
}
|
|
30
25
|
});
|
|
31
|
-
|
|
32
26
|
var _featureCollection = _interopRequireDefault(require("./feature-collection"));
|
|
33
|
-
|
|
34
27
|
var _featureModel = _interopRequireDefault(require("./feature-model"));
|
|
35
|
-
|
|
36
28
|
var _featuresModel = _interopRequireDefault(require("./features-model"));
|
|
37
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.js"],"sourcesContent":["import FeatureCollection from './feature-collection';\nimport FeatureModel from './feature-model';\nimport FeaturesModel from './features-model';\n\nexport {
|
|
1
|
+
{"version":3,"names":[],"sources":["index.js"],"sourcesContent":["import FeatureCollection from './feature-collection';\nimport FeatureModel from './feature-model';\nimport FeaturesModel from './features-model';\n\nexport {FeatureCollection, FeatureModel, FeaturesModel};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA"}
|
package/dist/index.js
CHANGED
|
@@ -1,92 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
4
|
-
|
|
5
4
|
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
6
|
-
|
|
7
5
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
8
|
-
|
|
9
6
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
10
|
-
|
|
11
7
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
12
|
-
|
|
13
8
|
_Object$defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
|
-
|
|
17
11
|
_Object$defineProperty(exports, "DeviceUrlInterceptor", {
|
|
18
12
|
enumerable: true,
|
|
19
13
|
get: function get() {
|
|
20
14
|
return _deviceUrl.default;
|
|
21
15
|
}
|
|
22
16
|
});
|
|
23
|
-
|
|
24
17
|
_Object$defineProperty(exports, "FeatureCollection", {
|
|
25
18
|
enumerable: true,
|
|
26
19
|
get: function get() {
|
|
27
20
|
return _index.FeatureCollection;
|
|
28
21
|
}
|
|
29
22
|
});
|
|
30
|
-
|
|
31
23
|
_Object$defineProperty(exports, "FeatureModel", {
|
|
32
24
|
enumerable: true,
|
|
33
25
|
get: function get() {
|
|
34
26
|
return _index.FeatureModel;
|
|
35
27
|
}
|
|
36
28
|
});
|
|
37
|
-
|
|
38
29
|
_Object$defineProperty(exports, "FeaturesModel", {
|
|
39
30
|
enumerable: true,
|
|
40
31
|
get: function get() {
|
|
41
32
|
return _index.FeaturesModel;
|
|
42
33
|
}
|
|
43
34
|
});
|
|
44
|
-
|
|
45
35
|
_Object$defineProperty(exports, "config", {
|
|
46
36
|
enumerable: true,
|
|
47
37
|
get: function get() {
|
|
48
38
|
return _config.default;
|
|
49
39
|
}
|
|
50
40
|
});
|
|
51
|
-
|
|
52
41
|
exports.constants = void 0;
|
|
53
|
-
|
|
54
42
|
_Object$defineProperty(exports, "default", {
|
|
55
43
|
enumerable: true,
|
|
56
44
|
get: function get() {
|
|
57
45
|
return _device.default;
|
|
58
46
|
}
|
|
59
47
|
});
|
|
60
|
-
|
|
61
48
|
require("@webex/internal-plugin-metrics");
|
|
62
|
-
|
|
63
49
|
var _webexCore = require("@webex/webex-core");
|
|
64
|
-
|
|
65
50
|
var _device = _interopRequireDefault(require("./device"));
|
|
66
|
-
|
|
67
51
|
var _index = require("./features/index");
|
|
68
|
-
|
|
69
52
|
var _deviceUrl = _interopRequireDefault(require("./interceptors/device-url"));
|
|
70
|
-
|
|
71
53
|
var constants = _interopRequireWildcard(require("./constants"));
|
|
72
|
-
|
|
73
54
|
exports.constants = constants;
|
|
74
|
-
|
|
75
55
|
var _config = _interopRequireDefault(require("./config"));
|
|
76
|
-
|
|
77
56
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
78
|
-
|
|
79
57
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
80
|
-
|
|
81
58
|
// Internal dependencies.
|
|
82
59
|
// Need to import metrics plugin for the devices to send metrics on succes/failure registration
|
|
60
|
+
|
|
83
61
|
// Plugin dependencies.
|
|
62
|
+
|
|
84
63
|
(0, _webexCore.registerInternalPlugin)('device', _device.default, {
|
|
85
64
|
config: _config.default,
|
|
86
65
|
interceptors: {
|
|
87
66
|
DeviceUrlInterceptor: _deviceUrl.default.create
|
|
88
67
|
},
|
|
89
|
-
|
|
90
68
|
/**
|
|
91
69
|
* Unregister the device in the case that the webex instance has logged out.
|
|
92
70
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerInternalPlugin","Device","config","interceptors","DeviceUrlInterceptor","create","onBeforeLogout","unregister"],"sources":["index.js"],"sourcesContent":["// Internal dependencies.\n// Need to import metrics plugin for the devices to send metrics on succes/failure registration\nimport '@webex/internal-plugin-metrics';\nimport {registerInternalPlugin} from '@webex/webex-core';\n\n// Plugin dependencies.\nimport Device from './device';\nimport {FeatureCollection, FeatureModel, FeaturesModel} from './features/index';\nimport DeviceUrlInterceptor from './interceptors/device-url';\nimport * as constants from './constants';\nimport config from './config';\n\nregisterInternalPlugin('device', Device, {\n config,\n interceptors: {\n DeviceUrlInterceptor: DeviceUrlInterceptor.create
|
|
1
|
+
{"version":3,"names":["registerInternalPlugin","Device","config","interceptors","DeviceUrlInterceptor","create","onBeforeLogout","unregister"],"sources":["index.js"],"sourcesContent":["// Internal dependencies.\n// Need to import metrics plugin for the devices to send metrics on succes/failure registration\nimport '@webex/internal-plugin-metrics';\nimport {registerInternalPlugin} from '@webex/webex-core';\n\n// Plugin dependencies.\nimport Device from './device';\nimport {FeatureCollection, FeatureModel, FeaturesModel} from './features/index';\nimport DeviceUrlInterceptor from './interceptors/device-url';\nimport * as constants from './constants';\nimport config from './config';\n\nregisterInternalPlugin('device', Device, {\n config,\n interceptors: {\n DeviceUrlInterceptor: DeviceUrlInterceptor.create,\n },\n /**\n * Unregister the device in the case that the webex instance has logged out.\n *\n * @returns {Promise<undefined>}\n */\n onBeforeLogout() {\n return this.unregister();\n },\n});\n\nexport {default} from './device';\nexport {config, constants, DeviceUrlInterceptor, FeatureCollection, FeatureModel, FeaturesModel};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AAGA;AACA;AACA;AACA;AAAyC;AACzC;AAA8B;AAAA;AAV9B;AACA;;AAIA;;AAOA,IAAAA,iCAAsB,EAAC,QAAQ,EAAEC,eAAM,EAAE;EACvCC,MAAM,EAANA,eAAM;EACNC,YAAY,EAAE;IACZC,oBAAoB,EAAEA,kBAAoB,CAACC;EAC7C,CAAC;EACD;AACF;AACA;AACA;AACA;EACEC,cAAc,4BAAG;IACf,OAAO,IAAI,CAACC,UAAU,EAAE;EAC1B;AACF,CAAC,CAAC"}
|
|
@@ -1,52 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
4
|
-
|
|
5
4
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
6
|
-
|
|
7
5
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
8
|
-
|
|
9
6
|
_Object$defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
|
-
|
|
13
9
|
exports.default = void 0;
|
|
14
|
-
|
|
15
10
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
16
|
-
|
|
17
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
18
|
-
|
|
19
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
20
|
-
|
|
21
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
22
|
-
|
|
23
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
24
|
-
|
|
25
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
26
|
-
|
|
27
16
|
var _set2 = _interopRequireDefault(require("lodash/set"));
|
|
28
|
-
|
|
29
17
|
var _httpCore = require("@webex/http-core");
|
|
30
|
-
|
|
31
18
|
var _constants = require("../constants");
|
|
32
|
-
|
|
33
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
34
|
-
|
|
35
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
36
|
-
|
|
37
21
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
* Adds 'cisco-device-url' header, as appropriate, to requests
|
|
23
|
+
*/
|
|
40
24
|
var DeviceUrlInterceptor = /*#__PURE__*/function (_Interceptor) {
|
|
41
25
|
(0, _inherits2.default)(DeviceUrlInterceptor, _Interceptor);
|
|
42
|
-
|
|
43
26
|
var _super = _createSuper(DeviceUrlInterceptor);
|
|
44
|
-
|
|
45
27
|
function DeviceUrlInterceptor() {
|
|
46
28
|
(0, _classCallCheck2.default)(this, DeviceUrlInterceptor);
|
|
47
29
|
return _super.apply(this, arguments);
|
|
48
30
|
}
|
|
49
|
-
|
|
50
31
|
(0, _createClass2.default)(DeviceUrlInterceptor, [{
|
|
51
32
|
key: "onRequest",
|
|
52
33
|
value:
|
|
@@ -57,39 +38,38 @@ var DeviceUrlInterceptor = /*#__PURE__*/function (_Interceptor) {
|
|
|
57
38
|
*/
|
|
58
39
|
function onRequest(options) {
|
|
59
40
|
var headers = options.headers,
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
service = options.service,
|
|
42
|
+
uri = options.uri;
|
|
62
43
|
var _this$webex$internal = this.webex.internal,
|
|
63
|
-
|
|
64
|
-
|
|
44
|
+
device = _this$webex$internal.device,
|
|
45
|
+
services = _this$webex$internal.services;
|
|
65
46
|
|
|
47
|
+
// Check if header is already set before moving forward
|
|
66
48
|
if (!device.url || headers && _constants.CISCO_DEVICE_URL in headers && !!headers[_constants.CISCO_DEVICE_URL]) {
|
|
67
49
|
return _promise.default.resolve(options);
|
|
68
|
-
}
|
|
69
|
-
|
|
50
|
+
}
|
|
70
51
|
|
|
52
|
+
// Wait for catalog and service to be defined.
|
|
71
53
|
return services.waitForService({
|
|
72
54
|
service: service,
|
|
73
55
|
url: uri
|
|
74
56
|
}).then(function (url) {
|
|
75
57
|
// Grab the service name with the url returned from waitForService
|
|
76
58
|
var _ref = services.getServiceFromUrl(url) || {},
|
|
77
|
-
|
|
59
|
+
serviceName = _ref.name;
|
|
60
|
+
var invalidServices = ['idbroker', 'oauth', 'saml'];
|
|
78
61
|
|
|
79
|
-
|
|
62
|
+
// Check if service is not one of the invalid services
|
|
80
63
|
// Assign the url to the device header
|
|
81
|
-
|
|
82
64
|
if (serviceName && !invalidServices.includes(serviceName)) {
|
|
83
65
|
(0, _set2.default)(options, "headers['".concat(_constants.CISCO_DEVICE_URL, "']"), device.url);
|
|
84
66
|
}
|
|
85
|
-
|
|
86
67
|
return options;
|
|
87
68
|
}).catch(function (error) {
|
|
88
69
|
// Validate that the error came from getServiceFromUrl
|
|
89
70
|
if (error.message.match(/was not found after waiting/)) {
|
|
90
71
|
return options;
|
|
91
72
|
}
|
|
92
|
-
|
|
93
73
|
return _promise.default.reject(error);
|
|
94
74
|
});
|
|
95
75
|
}
|
|
@@ -108,6 +88,5 @@ var DeviceUrlInterceptor = /*#__PURE__*/function (_Interceptor) {
|
|
|
108
88
|
}]);
|
|
109
89
|
return DeviceUrlInterceptor;
|
|
110
90
|
}(_httpCore.Interceptor);
|
|
111
|
-
|
|
112
91
|
exports.default = DeviceUrlInterceptor;
|
|
113
92
|
//# sourceMappingURL=device-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceUrlInterceptor","options","headers","service","uri","webex","internal","device","services","url","CISCO_DEVICE_URL","resolve","waitForService","then","getServiceFromUrl","serviceName","name","invalidServices","includes","catch","error","message","match","reject","Interceptor"],"sources":["device-url.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport {set} from 'lodash';\n\nimport {CISCO_DEVICE_URL} from '../constants';\n\n/**\n
|
|
1
|
+
{"version":3,"names":["DeviceUrlInterceptor","options","headers","service","uri","webex","internal","device","services","url","CISCO_DEVICE_URL","resolve","waitForService","then","getServiceFromUrl","serviceName","name","invalidServices","includes","catch","error","message","match","reject","Interceptor"],"sources":["device-url.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport {set} from 'lodash';\n\nimport {CISCO_DEVICE_URL} from '../constants';\n\n/**\n * Adds 'cisco-device-url' header, as appropriate, to requests\n */\nexport default class DeviceUrlInterceptor extends Interceptor {\n /**\n * @returns {DeviceUrlInterceptor}\n */\n static create() {\n /* eslint no-invalid-this: [0] */\n return new DeviceUrlInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onRequest\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n const {headers, service, uri} = options;\n const {device, services} = this.webex.internal;\n\n // Check if header is already set before moving forward\n if (!device.url || (headers && CISCO_DEVICE_URL in headers && !!headers[CISCO_DEVICE_URL])) {\n return Promise.resolve(options);\n }\n\n // Wait for catalog and service to be defined.\n return services\n .waitForService({service, url: uri})\n .then((url) => {\n // Grab the service name with the url returned from waitForService\n const {name: serviceName} = services.getServiceFromUrl(url) || {};\n const invalidServices = ['idbroker', 'oauth', 'saml'];\n\n // Check if service is not one of the invalid services\n // Assign the url to the device header\n if (serviceName && !invalidServices.includes(serviceName)) {\n set(options, `headers['${CISCO_DEVICE_URL}']`, device.url);\n }\n\n return options;\n })\n .catch((error) => {\n // Validate that the error came from getServiceFromUrl\n if (error.message.match(/was not found after waiting/)) {\n return options;\n }\n\n return Promise.reject(error);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA;AAGA;AAA8C;AAAA;AAE9C;AACA;AACA;AAFA,IAGqBA,oBAAoB;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IASvC;AACF;AACA;AACA;AACA;IACE,mBAAUC,OAAO,EAAE;MACjB,IAAOC,OAAO,GAAkBD,OAAO,CAAhCC,OAAO;QAAEC,OAAO,GAASF,OAAO,CAAvBE,OAAO;QAAEC,GAAG,GAAIH,OAAO,CAAdG,GAAG;MAC5B,2BAA2B,IAAI,CAACC,KAAK,CAACC,QAAQ;QAAvCC,MAAM,wBAANA,MAAM;QAAEC,QAAQ,wBAARA,QAAQ;;MAEvB;MACA,IAAI,CAACD,MAAM,CAACE,GAAG,IAAKP,OAAO,IAAIQ,2BAAgB,IAAIR,OAAO,IAAI,CAAC,CAACA,OAAO,CAACQ,2BAAgB,CAAE,EAAE;QAC1F,OAAO,iBAAQC,OAAO,CAACV,OAAO,CAAC;MACjC;;MAEA;MACA,OAAOO,QAAQ,CACZI,cAAc,CAAC;QAACT,OAAO,EAAPA,OAAO;QAAEM,GAAG,EAAEL;MAAG,CAAC,CAAC,CACnCS,IAAI,CAAC,UAACJ,GAAG,EAAK;QACb;QACA,WAA4BD,QAAQ,CAACM,iBAAiB,CAACL,GAAG,CAAC,IAAI,CAAC,CAAC;UAApDM,WAAW,QAAjBC,IAAI;QACX,IAAMC,eAAe,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC;;QAErD;QACA;QACA,IAAIF,WAAW,IAAI,CAACE,eAAe,CAACC,QAAQ,CAACH,WAAW,CAAC,EAAE;UACzD,mBAAId,OAAO,qBAAcS,2BAAgB,SAAMH,MAAM,CAACE,GAAG,CAAC;QAC5D;QAEA,OAAOR,OAAO;MAChB,CAAC,CAAC,CACDkB,KAAK,CAAC,UAACC,KAAK,EAAK;QAChB;QACA,IAAIA,KAAK,CAACC,OAAO,CAACC,KAAK,CAAC,6BAA6B,CAAC,EAAE;UACtD,OAAOrB,OAAO;QAChB;QAEA,OAAO,iBAAQsB,MAAM,CAACH,KAAK,CAAC;MAC9B,CAAC,CAAC;IACN;EAAC;IAAA;IAAA;IA9CD;AACF;AACA;IACE,kBAAgB;MACd;MACA,OAAO,IAAIpB,oBAAoB,CAAC;QAACK,KAAK,EAAE;MAAI,CAAC,CAAC;IAChD;EAAC;EAAA;AAAA,EAP+CmB,qBAAW;AAAA"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
10
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
12
|
+
var _webexCore = require("@webex/webex-core");
|
|
13
|
+
/*!
|
|
14
|
+
* Copyright (c) 2015-2023 Cisco Systems, Inc. See LICENSE file.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @class
|
|
19
|
+
*/
|
|
20
|
+
var IpNetworkDetector = _webexCore.WebexPlugin.extend({
|
|
21
|
+
idAttribute: 'IpNetworkDetectorId',
|
|
22
|
+
namespace: 'Device',
|
|
23
|
+
props: {
|
|
24
|
+
firstIpV4: ['number', true, -1],
|
|
25
|
+
// time [ms] it took to receive first IPv4 candidate
|
|
26
|
+
firstIpV6: ['number', true, -1],
|
|
27
|
+
// time [ms] it took to receive first IPv6 candidate
|
|
28
|
+
firstMdns: ['number', true, -1],
|
|
29
|
+
// time [ms] it took to receive first mDNS candidate
|
|
30
|
+
totalTime: ['number', true, -1] // total time [ms] it took to do the last IP network detection
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
derived: {
|
|
34
|
+
/**
|
|
35
|
+
* True if we know we're on an IPv4 network,
|
|
36
|
+
* False if we know that we are not on an IPv4 network,
|
|
37
|
+
* undefined if we are not sure
|
|
38
|
+
*/
|
|
39
|
+
supportsIpV4: {
|
|
40
|
+
deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],
|
|
41
|
+
/**
|
|
42
|
+
* Function for calculating the value of supportsIpV4 prop
|
|
43
|
+
* @returns {boolean | undefined}
|
|
44
|
+
*/
|
|
45
|
+
fn: function fn() {
|
|
46
|
+
if (this.firstIpV4 >= 0) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (this.totalTime < 0) {
|
|
50
|
+
// we haven't completed the detection, yet
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (this.receivedOnlyMDnsCandidates()) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* True if we know we're on an IPv6 network,
|
|
61
|
+
* False if we know that we are not on an IPv6 network,
|
|
62
|
+
* undefined if we are not sure
|
|
63
|
+
*/
|
|
64
|
+
supportsIpV6: {
|
|
65
|
+
deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],
|
|
66
|
+
/**
|
|
67
|
+
* Function for calculating the value of supportsIpV6 prop
|
|
68
|
+
* @returns {boolean | undefined}
|
|
69
|
+
*/
|
|
70
|
+
fn: function fn() {
|
|
71
|
+
if (this.firstIpV6 >= 0) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
if (this.totalTime < 0) {
|
|
75
|
+
// we haven't completed the detection, yet
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (this.receivedOnlyMDnsCandidates()) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Returns true if we have received only mDNS candidates - browsers usually do that if we don't have any user media permissions
|
|
87
|
+
*
|
|
88
|
+
* @private
|
|
89
|
+
* @returns {boolean}
|
|
90
|
+
*/
|
|
91
|
+
receivedOnlyMDnsCandidates: function receivedOnlyMDnsCandidates() {
|
|
92
|
+
return this.totalTime >= 0 && this.firstMdns >= 0 && this.firstIpV4 < 0 && this.firstIpV6 < 0;
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @param {RTCPeerConnection} pc Peer connection to use
|
|
97
|
+
* @private
|
|
98
|
+
* @returns {Promise<void>}
|
|
99
|
+
*/
|
|
100
|
+
gatherLocalCandidates: function gatherLocalCandidates(pc) {
|
|
101
|
+
var _this = this;
|
|
102
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
103
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
104
|
+
while (1) switch (_context.prev = _context.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
return _context.abrupt("return", new _promise.default(function (resolve, reject) {
|
|
107
|
+
var done = false;
|
|
108
|
+
_this.firstIpV4 = -1;
|
|
109
|
+
_this.firstIpV6 = -1;
|
|
110
|
+
_this.firstMdns = -1;
|
|
111
|
+
_this.totalTime = -1;
|
|
112
|
+
var startTime = performance.now();
|
|
113
|
+
var doneGatheringIceCandidates = function doneGatheringIceCandidates() {
|
|
114
|
+
if (done) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
done = true;
|
|
118
|
+
_this.totalTime = performance.now() - startTime;
|
|
119
|
+
resolve();
|
|
120
|
+
};
|
|
121
|
+
pc.onicecandidate = function (event) {
|
|
122
|
+
var _event$candidate;
|
|
123
|
+
if ((_event$candidate = event.candidate) !== null && _event$candidate !== void 0 && _event$candidate.address) {
|
|
124
|
+
if (event.candidate.address.endsWith('.local')) {
|
|
125
|
+
// if we don't have camera/mic permissions, browser just gives us mDNS candidates
|
|
126
|
+
if (_this.firstMdns === -1) {
|
|
127
|
+
_this.firstMdns = performance.now() - startTime;
|
|
128
|
+
}
|
|
129
|
+
} else if (event.candidate.address.includes(':')) {
|
|
130
|
+
if (_this.firstIpV6 === -1) {
|
|
131
|
+
_this.firstIpV6 = performance.now() - startTime;
|
|
132
|
+
}
|
|
133
|
+
} else if (_this.firstIpV4 === -1) {
|
|
134
|
+
_this.firstIpV4 = performance.now() - startTime;
|
|
135
|
+
}
|
|
136
|
+
if (_this.firstIpV4 >= 0 && _this.firstIpV6 >= 0) {
|
|
137
|
+
// if we've got both ipv4 and ipv6 candidates, there is no need to wait for any more candidates, we can resolve now
|
|
138
|
+
resolve();
|
|
139
|
+
}
|
|
140
|
+
} else if (event.candidate === null) {
|
|
141
|
+
doneGatheringIceCandidates();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
pc.onicegatheringstatechange = function () {
|
|
145
|
+
if (pc.iceGatheringState === 'complete') {
|
|
146
|
+
doneGatheringIceCandidates();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
pc.createDataChannel('data');
|
|
150
|
+
pc.createOffer().then(function (offer) {
|
|
151
|
+
return pc.setLocalDescription(offer);
|
|
152
|
+
}).catch(function (e) {
|
|
153
|
+
_this.webex.logger.error('Failed to detect ip network version:', e);
|
|
154
|
+
reject(e);
|
|
155
|
+
});
|
|
156
|
+
}));
|
|
157
|
+
case 1:
|
|
158
|
+
case "end":
|
|
159
|
+
return _context.stop();
|
|
160
|
+
}
|
|
161
|
+
}, _callee);
|
|
162
|
+
}))();
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* Detects if we are on IPv4 and/or IPv6 network. Once it resolves, read the
|
|
166
|
+
* supportsIpV4 and supportsIpV6 props to find out the result.
|
|
167
|
+
*
|
|
168
|
+
* @returns {Promise<Object>}
|
|
169
|
+
*/
|
|
170
|
+
detect: function detect() {
|
|
171
|
+
var _this2 = this;
|
|
172
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
173
|
+
var results, pc;
|
|
174
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
175
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
_context2.prev = 0;
|
|
178
|
+
pc = new RTCPeerConnection();
|
|
179
|
+
_context2.next = 4;
|
|
180
|
+
return _this2.gatherLocalCandidates(pc);
|
|
181
|
+
case 4:
|
|
182
|
+
results = _context2.sent;
|
|
183
|
+
case 5:
|
|
184
|
+
_context2.prev = 5;
|
|
185
|
+
pc.close();
|
|
186
|
+
return _context2.finish(5);
|
|
187
|
+
case 8:
|
|
188
|
+
return _context2.abrupt("return", results);
|
|
189
|
+
case 9:
|
|
190
|
+
case "end":
|
|
191
|
+
return _context2.stop();
|
|
192
|
+
}
|
|
193
|
+
}, _callee2, null, [[0,, 5, 8]]);
|
|
194
|
+
}))();
|
|
195
|
+
},
|
|
196
|
+
version: "3.0.0-beta.300"
|
|
197
|
+
});
|
|
198
|
+
var _default = IpNetworkDetector;
|
|
199
|
+
exports.default = _default;
|
|
200
|
+
//# sourceMappingURL=ipNetworkDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["IpNetworkDetector","WebexPlugin","extend","idAttribute","namespace","props","firstIpV4","firstIpV6","firstMdns","totalTime","derived","supportsIpV4","deps","fn","undefined","receivedOnlyMDnsCandidates","supportsIpV6","gatherLocalCandidates","pc","resolve","reject","done","startTime","performance","now","doneGatheringIceCandidates","onicecandidate","event","candidate","address","endsWith","includes","onicegatheringstatechange","iceGatheringState","createDataChannel","createOffer","then","offer","setLocalDescription","catch","e","webex","logger","error","detect","RTCPeerConnection","results","close"],"sources":["ipNetworkDetector.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2023 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\n\n/**\n * @class\n */\nconst IpNetworkDetector = WebexPlugin.extend({\n idAttribute: 'IpNetworkDetectorId',\n\n namespace: 'Device',\n\n props: {\n firstIpV4: ['number', true, -1], // time [ms] it took to receive first IPv4 candidate\n firstIpV6: ['number', true, -1], // time [ms] it took to receive first IPv6 candidate\n firstMdns: ['number', true, -1], // time [ms] it took to receive first mDNS candidate\n totalTime: ['number', true, -1], // total time [ms] it took to do the last IP network detection\n },\n\n derived: {\n /**\n * True if we know we're on an IPv4 network,\n * False if we know that we are not on an IPv4 network,\n * undefined if we are not sure\n */\n supportsIpV4: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV4 prop\n * @returns {boolean | undefined}\n */\n fn() {\n if (this.firstIpV4 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n\n return false;\n },\n },\n /**\n * True if we know we're on an IPv6 network,\n * False if we know that we are not on an IPv6 network,\n * undefined if we are not sure\n */\n supportsIpV6: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV6 prop\n * @returns {boolean | undefined}\n */ fn() {\n if (this.firstIpV6 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n\n return false;\n },\n },\n },\n\n /**\n * Returns true if we have received only mDNS candidates - browsers usually do that if we don't have any user media permissions\n *\n * @private\n * @returns {boolean}\n */\n receivedOnlyMDnsCandidates() {\n return this.totalTime >= 0 && this.firstMdns >= 0 && this.firstIpV4 < 0 && this.firstIpV6 < 0;\n },\n\n /**\n *\n * @param {RTCPeerConnection} pc Peer connection to use\n * @private\n * @returns {Promise<void>}\n */\n async gatherLocalCandidates(pc: RTCPeerConnection): Promise<void> {\n return new Promise((resolve, reject) => {\n let done = false;\n\n this.firstIpV4 = -1;\n this.firstIpV6 = -1;\n this.firstMdns = -1;\n this.totalTime = -1;\n const startTime = performance.now();\n\n const doneGatheringIceCandidates = () => {\n if (done) {\n return;\n }\n done = true;\n\n this.totalTime = performance.now() - startTime;\n\n resolve();\n };\n\n pc.onicecandidate = (event) => {\n if (event.candidate?.address) {\n if (event.candidate.address.endsWith('.local')) {\n // if we don't have camera/mic permissions, browser just gives us mDNS candidates\n if (this.firstMdns === -1) {\n this.firstMdns = performance.now() - startTime;\n }\n } else if (event.candidate.address.includes(':')) {\n if (this.firstIpV6 === -1) {\n this.firstIpV6 = performance.now() - startTime;\n }\n } else if (this.firstIpV4 === -1) {\n this.firstIpV4 = performance.now() - startTime;\n }\n\n if (this.firstIpV4 >= 0 && this.firstIpV6 >= 0) {\n // if we've got both ipv4 and ipv6 candidates, there is no need to wait for any more candidates, we can resolve now\n resolve();\n }\n } else if (event.candidate === null) {\n doneGatheringIceCandidates();\n }\n };\n\n pc.onicegatheringstatechange = () => {\n if (pc.iceGatheringState === 'complete') {\n doneGatheringIceCandidates();\n }\n };\n\n pc.createDataChannel('data');\n\n pc.createOffer()\n .then((offer) => pc.setLocalDescription(offer))\n .catch((e) => {\n this.webex.logger.error('Failed to detect ip network version:', e);\n reject(e);\n });\n });\n },\n\n /**\n * Detects if we are on IPv4 and/or IPv6 network. Once it resolves, read the\n * supportsIpV4 and supportsIpV6 props to find out the result.\n *\n * @returns {Promise<Object>}\n */\n async detect() {\n let results;\n let pc;\n\n try {\n pc = new RTCPeerConnection();\n\n results = await this.gatherLocalCandidates(pc);\n } finally {\n pc.close();\n }\n\n return results;\n },\n});\n\nexport default IpNetworkDetector;\n"],"mappings":"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"}
|
package/dist/metrics.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.default = void 0;
|
|
10
8
|
// Metric to do with WDM registration
|
|
11
9
|
var _default = {
|
package/dist/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JS_SDK_WDM_REGISTRATION_SUCCESSFUL","JS_SDK_WDM_REGISTRATION_FAILED"],"sources":["metrics.js"],"sourcesContent":["// Metric to do with WDM registration\nexport default {\n JS_SDK_WDM_REGISTRATION_SUCCESSFUL: 'JS_SDK_WDM_REGISTRATION_SUCCESSFUL',\n JS_SDK_WDM_REGISTRATION_FAILED: 'JS_SDK_WDM_REGISTRATION_FAILED'
|
|
1
|
+
{"version":3,"names":["JS_SDK_WDM_REGISTRATION_SUCCESSFUL","JS_SDK_WDM_REGISTRATION_FAILED"],"sources":["metrics.js"],"sourcesContent":["// Metric to do with WDM registration\nexport default {\n JS_SDK_WDM_REGISTRATION_SUCCESSFUL: 'JS_SDK_WDM_REGISTRATION_SUCCESSFUL',\n JS_SDK_WDM_REGISTRATION_FAILED: 'JS_SDK_WDM_REGISTRATION_FAILED',\n};\n"],"mappings":";;;;;;;AAAA;AAAA,eACe;EACbA,kCAAkC,EAAE,oCAAoC;EACxEC,8BAA8B,EAAE;AAClC,CAAC;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-device",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.300",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Timothy Scheuering <timsch@cisco.com>",
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
25
|
-
"@webex/test-helper-mock-webex": "3.0.0-beta.
|
|
26
|
-
"@webex/test-helper-test-users": "3.0.0-beta.
|
|
24
|
+
"@webex/test-helper-chai": "3.0.0-beta.300",
|
|
25
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.300",
|
|
26
|
+
"@webex/test-helper-test-users": "3.0.0-beta.300",
|
|
27
27
|
"chai": "^4.3.4",
|
|
28
28
|
"chai-as-promised": "^7.1.1",
|
|
29
29
|
"sinon": "^9.2.4"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@webex/common": "3.0.0-beta.
|
|
33
|
-
"@webex/common-timers": "3.0.0-beta.
|
|
34
|
-
"@webex/http-core": "3.0.0-beta.
|
|
35
|
-
"@webex/internal-plugin-device": "3.0.0-beta.
|
|
36
|
-
"@webex/internal-plugin-metrics": "3.0.0-beta.
|
|
37
|
-
"@webex/webex-core": "3.0.0-beta.
|
|
32
|
+
"@webex/common": "3.0.0-beta.300",
|
|
33
|
+
"@webex/common-timers": "3.0.0-beta.300",
|
|
34
|
+
"@webex/http-core": "3.0.0-beta.300",
|
|
35
|
+
"@webex/internal-plugin-device": "3.0.0-beta.300",
|
|
36
|
+
"@webex/internal-plugin-metrics": "3.0.0-beta.300",
|
|
37
|
+
"@webex/webex-core": "3.0.0-beta.300",
|
|
38
38
|
"ampersand-collection": "^2.0.2",
|
|
39
39
|
"ampersand-state": "^5.0.3",
|
|
40
40
|
"lodash": "^4.17.21"
|
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:
|
|
27
|
-
process.title.trim() : undefined) ||
|
|
28
|
-
inBrowser && 'browser' ||
|
|
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,6 @@ export default {
|
|
|
56
55
|
*
|
|
57
56
|
* @type {boolean}
|
|
58
57
|
*/
|
|
59
|
-
ephemeralDeviceTTL: 30 * 60
|
|
60
|
-
}
|
|
58
|
+
ephemeralDeviceTTL: 30 * 60,
|
|
59
|
+
},
|
|
61
60
|
};
|
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];
|