@microsoft/applicationinsights-react-native 2.5.6 → 3.0.1-nightly.2208-03
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 +49 -2
- package/browser/applicationinsights-react-native.js +109 -49
- package/browser/applicationinsights-react-native.js.map +1 -1
- package/browser/applicationinsights-react-native.min.js +2 -2
- package/browser/applicationinsights-react-native.min.js.map +1 -1
- package/dist/applicationinsights-react-native.api.json +216 -6
- package/dist/applicationinsights-react-native.api.md +12 -5
- package/dist/applicationinsights-react-native.d.ts +70 -1
- package/dist/applicationinsights-react-native.js +109 -49
- package/dist/applicationinsights-react-native.js.map +1 -1
- package/dist/applicationinsights-react-native.min.js +2 -2
- package/dist/applicationinsights-react-native.min.js.map +1 -1
- package/dist/applicationinsights-react-native.rollup.d.ts +70 -1
- package/dist-esm/DeviceInfo/DeviceModule.js +38 -0
- package/dist-esm/DeviceInfo/DeviceModule.js.map +1 -0
- package/dist-esm/DeviceInfo/ReactNativeDeviceInfo.js +15 -0
- package/dist-esm/DeviceInfo/ReactNativeDeviceInfo.js.map +1 -0
- package/dist-esm/Interfaces/IDeviceInfoModule.js +8 -0
- package/dist-esm/Interfaces/IDeviceInfoModule.js.map +1 -0
- package/dist-esm/Interfaces/INativeDevice.js +3 -1
- package/dist-esm/Interfaces/INativeDevice.js.map +1 -1
- package/dist-esm/Interfaces/IReactNativePluginConfig.js +1 -1
- package/dist-esm/Interfaces/index.js +3 -1
- package/dist-esm/Interfaces/index.js.map +1 -1
- package/dist-esm/ReactNativePlugin.js +81 -41
- package/dist-esm/ReactNativePlugin.js.map +1 -1
- package/dist-esm/index.js +5 -1
- package/dist-esm/index.js.map +1 -1
- package/package.json +86 -82
- package/src/DeviceInfo/DeviceModule.ts +44 -0
- package/src/DeviceInfo/ReactNativeDeviceInfo.ts +13 -0
- package/src/Interfaces/IDeviceInfoModule.ts +31 -0
- package/src/Interfaces/INativeDevice.ts +3 -0
- package/src/Interfaces/IReactNativePluginConfig.ts +15 -0
- package/src/Interfaces/index.ts +3 -0
- package/src/ReactNativePlugin.ts +109 -41
- package/src/index.ts +8 -2
- package/types/DeviceInfo/DeviceModule.d.ts +10 -0
- package/types/DeviceInfo/ReactNativeDeviceInfo.d.ts +6 -0
- package/types/Interfaces/IDeviceInfoModule.d.ts +25 -0
- package/types/Interfaces/IReactNativePluginConfig.d.ts +11 -0
- package/types/ReactNativePlugin.d.ts +27 -11
- package/types/index.d.ts +4 -1
- package/types/tsdoc-metadata.json +1 -1
package/README.md
CHANGED
|
@@ -32,11 +32,58 @@ appInsights.loadAppInsights();
|
|
|
32
32
|
You must be using a version `>=2.0.0` of `@microsoft/applicationinsights-web`. This plugin will only work in react-native apps, e.g. it will not work with `expo`.
|
|
33
33
|
|
|
34
34
|
## Device Information Collected
|
|
35
|
+
|
|
35
36
|
By default, this plugin automatically collects
|
|
36
37
|
- **Unique Device ID** (also known as Installation ID)
|
|
37
38
|
- **Device Model Name** (iPhone XS, etc.)
|
|
38
39
|
- **Device Type** (Handset, Tablet, etc.)
|
|
39
40
|
|
|
41
|
+
## IDeviceInfoModule
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
/**
|
|
45
|
+
* Interface to abstract how the plugin can access the Device Info, this is a stripped
|
|
46
|
+
* down version of the "react-native-device-info" interface and is mostly supplied for
|
|
47
|
+
* testing.
|
|
48
|
+
*/
|
|
49
|
+
export interface IDeviceInfoModule {
|
|
50
|
+
/**
|
|
51
|
+
* Returns the Device Model
|
|
52
|
+
*/
|
|
53
|
+
getModel: () => string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns the device type
|
|
57
|
+
*/
|
|
58
|
+
getDeviceType: () => string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the unique Id for the device, to support both the current version and previous
|
|
62
|
+
* versions react-native-device-info, this may return either a `string` or `Promise<string>`,
|
|
63
|
+
* when a promise is returned the plugin will "wait" for the promise to `resolve` or `reject`
|
|
64
|
+
* before processing any events. This WILL cause telemetry to be BLOCKED until either of these
|
|
65
|
+
* states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve.
|
|
66
|
+
* There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock
|
|
67
|
+
* event processing when this issue occurs.
|
|
68
|
+
*/
|
|
69
|
+
getUniqueId: () => Promise<string> | string;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If events are getting "blocked" because the `Promise` returned via `getUniqueId` is never resolved / rejected
|
|
74
|
+
you can call `setDeviceId()` on the plugin to "unblock" this waiting state. There is also an automatic timeout
|
|
75
|
+
configured via `uniqueIdPromiseTimeout` (defaults to 5 seconds), which will internally call `setDeviceId()` with
|
|
76
|
+
any previously configured value.
|
|
77
|
+
|
|
78
|
+
## Compatibility Matrix
|
|
79
|
+
|
|
80
|
+
The [Compatibility Matrix](https://github.com/microsoft/applicationinsights-react-native#compatibility-matrix)
|
|
81
|
+
is tracked and updated on the main project README.md page.
|
|
82
|
+
|
|
83
|
+
## Nightly Builds
|
|
84
|
+
|
|
85
|
+
See the [Main Readme](https://github.com/microsoft/applicationinsights-react-native#nightly-builds)
|
|
86
|
+
|
|
40
87
|
## Contributing
|
|
41
88
|
|
|
42
89
|
This project welcomes contributions and suggestions. Most contributions require you to
|
|
@@ -56,11 +103,11 @@ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any addi
|
|
|
56
103
|
|
|
57
104
|
As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.
|
|
58
105
|
|
|
59
|
-
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft�s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
|
106
|
+
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft�s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
|
|
60
107
|
|
|
61
108
|
## Trademarks
|
|
62
109
|
|
|
63
|
-
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft�s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party�s policies.
|
|
110
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft�s Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party�s policies.
|
|
64
111
|
|
|
65
112
|
## License
|
|
66
113
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Native Plugin,
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 3.0.1-nightly.2208-03
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -357,9 +357,9 @@
|
|
|
357
357
|
var _DYN_CREATE_NEW = "createNew";
|
|
358
358
|
var _DYN_INDEX_OF = "indexOf";
|
|
359
359
|
var _DYN_USER_AGENT = "userAgent";
|
|
360
|
-
var _DYN_REPLACE = "replace";
|
|
361
360
|
var _DYN_NODE_TYPE = "nodeType";
|
|
362
361
|
var _DYN_APPLY = "apply";
|
|
362
|
+
var _DYN_REPLACE = "replace";
|
|
363
363
|
var _DYN_ENABLE_DEBUG_EXCEPTI4 = "enableDebugExceptions";
|
|
364
364
|
var _DYN_LOG_INTERNAL_MESSAGE = "logInternalMessage";
|
|
365
365
|
var _DYN_TO_LOWER_CASE = "toLowerCase";
|
|
@@ -410,18 +410,15 @@
|
|
|
410
410
|
function isNullOrUndefined(value) {
|
|
411
411
|
return (value === null || isUndefined(value));
|
|
412
412
|
}
|
|
413
|
-
function hasOwnProperty(obj, prop) {
|
|
414
|
-
return !!(obj && ObjHasOwnProperty[_DYN_CALL ](obj, prop));
|
|
415
|
-
}
|
|
416
413
|
function isObject(value) {
|
|
417
414
|
return !!(value && typeof value === strShimObject);
|
|
418
415
|
}
|
|
419
|
-
function isFunction(value) {
|
|
416
|
+
function isFunction$1(value) {
|
|
420
417
|
return !!(value && typeof value === strShimFunction);
|
|
421
418
|
}
|
|
422
419
|
function normalizeJsName(name) {
|
|
423
420
|
var value = name;
|
|
424
|
-
if (value && isString(value)) {
|
|
421
|
+
if (value && isString$1(value)) {
|
|
425
422
|
value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
|
|
426
423
|
return letter.toUpperCase();
|
|
427
424
|
});
|
|
@@ -432,7 +429,7 @@
|
|
|
432
429
|
}
|
|
433
430
|
return value;
|
|
434
431
|
}
|
|
435
|
-
function objForEachKey
|
|
432
|
+
function objForEachKey(target, callbackfn) {
|
|
436
433
|
if (target) {
|
|
437
434
|
for (var prop in target) {
|
|
438
435
|
if (ObjHasOwnProperty[_DYN_CALL ](target, prop)) {
|
|
@@ -454,7 +451,7 @@
|
|
|
454
451
|
function isError(obj) {
|
|
455
452
|
return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Error]");
|
|
456
453
|
}
|
|
457
|
-
function isString(value) {
|
|
454
|
+
function isString$1(value) {
|
|
458
455
|
return typeof value === "string";
|
|
459
456
|
}
|
|
460
457
|
function isBoolean(value) {
|
|
@@ -542,7 +539,7 @@
|
|
|
542
539
|
function _createProxyFunction(source, funcName) {
|
|
543
540
|
var srcFunc = null;
|
|
544
541
|
var src = null;
|
|
545
|
-
if (isFunction(source)) {
|
|
542
|
+
if (isFunction$1(source)) {
|
|
546
543
|
srcFunc = source;
|
|
547
544
|
}
|
|
548
545
|
else {
|
|
@@ -716,7 +713,7 @@
|
|
|
716
713
|
if (theConsole[func]) {
|
|
717
714
|
logFunc = func;
|
|
718
715
|
}
|
|
719
|
-
if (isFunction(theConsole[logFunc])) {
|
|
716
|
+
if (isFunction$1(theConsole[logFunc])) {
|
|
720
717
|
theConsole[logFunc](message);
|
|
721
718
|
}
|
|
722
719
|
}
|
|
@@ -873,10 +870,10 @@
|
|
|
873
870
|
_self[_DYN_NAME ] = name;
|
|
874
871
|
_self[_DYN_IS_ASYNC ] = isAsync;
|
|
875
872
|
_self[_DYN_IS_CHILD_EVT ] = function () { return false; };
|
|
876
|
-
if (isFunction(payloadDetails)) {
|
|
873
|
+
if (isFunction$1(payloadDetails)) {
|
|
877
874
|
var theDetails_1;
|
|
878
875
|
accessorDefined = objDefineAccessors(_self, "payload", function () {
|
|
879
|
-
if (!theDetails_1 && isFunction(payloadDetails)) {
|
|
876
|
+
if (!theDetails_1 && isFunction$1(payloadDetails)) {
|
|
880
877
|
theDetails_1 = payloadDetails();
|
|
881
878
|
payloadDetails = null;
|
|
882
879
|
}
|
|
@@ -923,7 +920,7 @@
|
|
|
923
920
|
_self[_DYN_TIME ] = dateNow() - _self.start;
|
|
924
921
|
_self.exTime = _self[_DYN_TIME ] - childTime;
|
|
925
922
|
_self[_DYN_COMPLETE ] = function () { };
|
|
926
|
-
if (!accessorDefined && isFunction(payloadDetails)) {
|
|
923
|
+
if (!accessorDefined && isFunction$1(payloadDetails)) {
|
|
927
924
|
_self.payload = payloadDetails();
|
|
928
925
|
}
|
|
929
926
|
};
|
|
@@ -1045,7 +1042,7 @@
|
|
|
1045
1042
|
}
|
|
1046
1043
|
|
|
1047
1044
|
var _objDefineProperty = ObjDefineProperty;
|
|
1048
|
-
var version = '2.8.
|
|
1045
|
+
var version = '2.8.6';
|
|
1049
1046
|
var instanceName = "." + newId(6);
|
|
1050
1047
|
var _dataUid = 0;
|
|
1051
1048
|
function _createAccessor(target, prop, value) {
|
|
@@ -1216,7 +1213,7 @@
|
|
|
1216
1213
|
if (mergeDefault !== 0 ) {
|
|
1217
1214
|
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1218
1215
|
if (config && mergeDefault === 2 ) {
|
|
1219
|
-
objForEachKey
|
|
1216
|
+
objForEachKey(defaultValue, function (field) {
|
|
1220
1217
|
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1221
1218
|
var cfgValue = config[field];
|
|
1222
1219
|
if (!isNullOrUndefined(cfgValue)) {
|
|
@@ -1298,7 +1295,7 @@
|
|
|
1298
1295
|
var context = internalContext.ctx;
|
|
1299
1296
|
function _processNext(updateState) {
|
|
1300
1297
|
return context.iterate(function (plugin) {
|
|
1301
|
-
if (isFunction(plugin[_DYN_UPDATE ])) {
|
|
1298
|
+
if (isFunction$1(plugin[_DYN_UPDATE ])) {
|
|
1302
1299
|
plugin[_DYN_UPDATE ](context, updateState);
|
|
1303
1300
|
}
|
|
1304
1301
|
});
|
|
@@ -1323,7 +1320,7 @@
|
|
|
1323
1320
|
if (!add && startAt === thePlugin) {
|
|
1324
1321
|
add = true;
|
|
1325
1322
|
}
|
|
1326
|
-
if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
1323
|
+
if (add && thePlugin && isFunction$1(thePlugin[STR_PROCESS_TELEMETRY ])) {
|
|
1327
1324
|
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1328
1325
|
if (!firstProxy) {
|
|
1329
1326
|
firstProxy = newProxy;
|
|
@@ -1342,8 +1339,8 @@
|
|
|
1342
1339
|
}
|
|
1343
1340
|
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1344
1341
|
var nextProxy = null;
|
|
1345
|
-
var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY ]);
|
|
1346
|
-
var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
1342
|
+
var hasProcessTelemetry = isFunction$1(plugin[STR_PROCESS_TELEMETRY ]);
|
|
1343
|
+
var hasSetNext = isFunction$1(plugin[_DYN_SET_NEXT_PLUGIN ]);
|
|
1347
1344
|
var chainId;
|
|
1348
1345
|
if (plugin) {
|
|
1349
1346
|
chainId = plugin[_DYN_IDENTIFIER ] + "-" + plugin[STR_PRIORITY ] + "-" + _chainId++;
|
|
@@ -1368,7 +1365,7 @@
|
|
|
1368
1365
|
};
|
|
1369
1366
|
function _getTelCtx() {
|
|
1370
1367
|
var itemCtx;
|
|
1371
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1368
|
+
if (plugin && isFunction$1(plugin[strGetTelCtx])) {
|
|
1372
1369
|
itemCtx = plugin[strGetTelCtx]();
|
|
1373
1370
|
}
|
|
1374
1371
|
if (!itemCtx) {
|
|
@@ -1598,7 +1595,7 @@
|
|
|
1598
1595
|
if (itemCtx) {
|
|
1599
1596
|
itemCtx[_DYN_PROCESS_NEXT ](env);
|
|
1600
1597
|
}
|
|
1601
|
-
else if (_nextPlugin && isFunction(_nextPlugin[STR_PROCESS_TELEMETRY ])) {
|
|
1598
|
+
else if (_nextPlugin && isFunction$1(_nextPlugin[STR_PROCESS_TELEMETRY ])) {
|
|
1602
1599
|
_nextPlugin[STR_PROCESS_TELEMETRY ](env, null);
|
|
1603
1600
|
}
|
|
1604
1601
|
};
|
|
@@ -1665,15 +1662,26 @@
|
|
|
1665
1662
|
|
|
1666
1663
|
var AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics";
|
|
1667
1664
|
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
}
|
|
1665
|
+
var FUNCTION = "function";
|
|
1666
|
+
var STRING = "string";
|
|
1667
|
+
var ArrCls = Array;
|
|
1668
|
+
|
|
1669
|
+
function _createIs(theType) {
|
|
1670
|
+
return function (value) {
|
|
1671
|
+
return typeof value === theType;
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
var isString = _createIs(STRING);
|
|
1675
|
+
var isFunction = _createIs(FUNCTION);
|
|
1676
|
+
ArrCls.isArray;
|
|
1677
|
+
function isPromiseLike(value) {
|
|
1678
|
+
return !!value && isFunction(value.then);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
function getReactNativeDeviceInfo() {
|
|
1682
|
+
return DeviceInfo__default["default"];
|
|
1676
1683
|
}
|
|
1684
|
+
|
|
1677
1685
|
var ReactNativePlugin = /** @class */ (function (_super) {
|
|
1678
1686
|
__extendsFn(ReactNativePlugin, _super);
|
|
1679
1687
|
function ReactNativePlugin(config) {
|
|
@@ -1684,10 +1692,15 @@
|
|
|
1684
1692
|
var _config;
|
|
1685
1693
|
var _analyticsPlugin;
|
|
1686
1694
|
var _defaultHandler;
|
|
1695
|
+
var _waitingForId;
|
|
1696
|
+
var _waitingTimer;
|
|
1697
|
+
var _waitingItems = null;
|
|
1698
|
+
var _deviceInfoModule;
|
|
1687
1699
|
dynamicProto(ReactNativePlugin, _this, function (_self, _base) {
|
|
1688
1700
|
_initDefaults();
|
|
1689
1701
|
_self.initialize = function (config,
|
|
1690
1702
|
core, extensions) {
|
|
1703
|
+
var _a;
|
|
1691
1704
|
if (!_self.isInitialized()) {
|
|
1692
1705
|
_base.initialize(config, core, extensions);
|
|
1693
1706
|
var inConfig_1 = config || {};
|
|
@@ -1698,13 +1711,8 @@
|
|
|
1698
1711
|
if (!_config.disableDeviceCollection) {
|
|
1699
1712
|
_self._collectDeviceInfo();
|
|
1700
1713
|
}
|
|
1701
|
-
if (
|
|
1702
|
-
|
|
1703
|
-
var identifier = ext.identifier;
|
|
1704
|
-
if (identifier === AnalyticsPluginIdentifier) {
|
|
1705
|
-
_analyticsPlugin = ext;
|
|
1706
|
-
}
|
|
1707
|
-
});
|
|
1714
|
+
if (core && core.getPlugin) {
|
|
1715
|
+
_analyticsPlugin = (_a = core.getPlugin(AnalyticsPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin;
|
|
1708
1716
|
}
|
|
1709
1717
|
if (!_config.disableExceptionCollection) {
|
|
1710
1718
|
_self._setExceptionHandler();
|
|
@@ -1712,12 +1720,22 @@
|
|
|
1712
1720
|
}
|
|
1713
1721
|
};
|
|
1714
1722
|
_self.processTelemetry = function (item, itemCtx) {
|
|
1715
|
-
|
|
1716
|
-
|
|
1723
|
+
if (!_waitingForId) {
|
|
1724
|
+
_applyDeviceContext(item);
|
|
1725
|
+
_self.processNext(item, itemCtx);
|
|
1726
|
+
}
|
|
1727
|
+
else {
|
|
1728
|
+
_waitingItems = _waitingItems || [];
|
|
1729
|
+
_waitingItems.push({
|
|
1730
|
+
item: item,
|
|
1731
|
+
itemCtx: itemCtx
|
|
1732
|
+
});
|
|
1733
|
+
}
|
|
1717
1734
|
};
|
|
1718
|
-
_self.
|
|
1719
|
-
|
|
1735
|
+
_self.setDeviceInfoModule = function (deviceInfoModule) {
|
|
1736
|
+
_deviceInfoModule = deviceInfoModule;
|
|
1720
1737
|
};
|
|
1738
|
+
_self.setDeviceId = _setDeviceId;
|
|
1721
1739
|
_self.setDeviceModel = function (newModel) {
|
|
1722
1740
|
_device.model = newModel;
|
|
1723
1741
|
};
|
|
@@ -1726,9 +1744,29 @@
|
|
|
1726
1744
|
};
|
|
1727
1745
|
_self._collectDeviceInfo = function () {
|
|
1728
1746
|
try {
|
|
1729
|
-
|
|
1730
|
-
_device.
|
|
1731
|
-
_device.model =
|
|
1747
|
+
var deviceInfoModule = _deviceInfoModule || getReactNativeDeviceInfo();
|
|
1748
|
+
_device.deviceClass = deviceInfoModule.getDeviceType();
|
|
1749
|
+
_device.model = deviceInfoModule.getModel();
|
|
1750
|
+
var uniqueId = deviceInfoModule.getUniqueId();
|
|
1751
|
+
if (isPromiseLike(uniqueId)) {
|
|
1752
|
+
_waitingForId = true;
|
|
1753
|
+
if (_waitingTimer) {
|
|
1754
|
+
clearTimeout(_waitingTimer);
|
|
1755
|
+
}
|
|
1756
|
+
_waitingTimer = setTimeout(function () {
|
|
1757
|
+
_waitingTimer = null;
|
|
1758
|
+
_setDeviceId(_device.id);
|
|
1759
|
+
});
|
|
1760
|
+
uniqueId.then(function (value) {
|
|
1761
|
+
_setDeviceId(value);
|
|
1762
|
+
}, function (reason) {
|
|
1763
|
+
_warnToConsole(_self.diagLog(), "Failed to get device id: " + dumpObj(reason));
|
|
1764
|
+
_setDeviceId(_device.id);
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
else if (isString(uniqueId)) {
|
|
1768
|
+
_device.id = uniqueId;
|
|
1769
|
+
}
|
|
1732
1770
|
}
|
|
1733
1771
|
catch (e) {
|
|
1734
1772
|
_warnToConsole(_self.diagLog(), "Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj(e));
|
|
@@ -1743,18 +1781,38 @@
|
|
|
1743
1781
|
_config = config || _getDefaultConfig();
|
|
1744
1782
|
_analyticsPlugin = null;
|
|
1745
1783
|
_defaultHandler = null;
|
|
1784
|
+
_waitingForId = false;
|
|
1785
|
+
_deviceInfoModule = null;
|
|
1786
|
+
}
|
|
1787
|
+
function _setDeviceId(newId) {
|
|
1788
|
+
_device.id = newId;
|
|
1789
|
+
_waitingForId = false;
|
|
1790
|
+
if (_waitingTimer) {
|
|
1791
|
+
clearTimeout(_waitingTimer);
|
|
1792
|
+
}
|
|
1793
|
+
if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) {
|
|
1794
|
+
var items = _waitingItems;
|
|
1795
|
+
_waitingItems = null;
|
|
1796
|
+
arrForEach(items, function (value) {
|
|
1797
|
+
try {
|
|
1798
|
+
_self.processTelemetry(value.item, value.itemCtx);
|
|
1799
|
+
}
|
|
1800
|
+
catch (e) {
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1746
1804
|
}
|
|
1747
1805
|
function _applyDeviceContext(item) {
|
|
1748
1806
|
if (_device) {
|
|
1749
1807
|
item.ext = item.ext || {};
|
|
1750
1808
|
item.ext.device = item.ext.device || {};
|
|
1751
|
-
if (
|
|
1809
|
+
if (isString(_device.id)) {
|
|
1752
1810
|
item.ext.device.localId = _device.id;
|
|
1753
1811
|
}
|
|
1754
|
-
if (
|
|
1812
|
+
if (isString(_device.model)) {
|
|
1755
1813
|
item.ext.device.model = _device.model;
|
|
1756
1814
|
}
|
|
1757
|
-
if (
|
|
1815
|
+
if (isString(_device.deviceClass)) {
|
|
1758
1816
|
item.ext.device.deviceClass = _device.deviceClass;
|
|
1759
1817
|
}
|
|
1760
1818
|
}
|
|
@@ -1792,13 +1850,14 @@
|
|
|
1792
1850
|
}
|
|
1793
1851
|
_self._config = _config;
|
|
1794
1852
|
_self._getDbgPlgTargets = function () {
|
|
1795
|
-
return [_device];
|
|
1853
|
+
return [_device, _deviceInfoModule];
|
|
1796
1854
|
};
|
|
1797
1855
|
});
|
|
1798
1856
|
function _getDefaultConfig() {
|
|
1799
1857
|
return {
|
|
1800
1858
|
disableDeviceCollection: false,
|
|
1801
|
-
disableExceptionCollection: false
|
|
1859
|
+
disableExceptionCollection: false,
|
|
1860
|
+
uniqueIdPromiseTimeout: 5000
|
|
1802
1861
|
};
|
|
1803
1862
|
}
|
|
1804
1863
|
return _this;
|
|
@@ -1808,6 +1867,7 @@
|
|
|
1808
1867
|
}(BaseTelemetryPlugin));
|
|
1809
1868
|
|
|
1810
1869
|
exports.ReactNativePlugin = ReactNativePlugin;
|
|
1870
|
+
exports.getReactNativeDeviceInfo = getReactNativeDeviceInfo;
|
|
1811
1871
|
|
|
1812
1872
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1813
1873
|
|