@microsoft/applicationinsights-react-native 4.3.4 → 4.3.5-nightly.2411-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/browser/applicationinsights-react-native.js +3133 -0
- package/browser/applicationinsights-react-native.js.map +1 -0
- package/browser/applicationinsights-react-native.min.js +6 -0
- package/browser/applicationinsights-react-native.min.js.map +1 -0
- package/dist/applicationinsights-react-native.api.json +1149 -0
- package/dist/applicationinsights-react-native.api.md +68 -0
- package/dist/applicationinsights-react-native.d.ts +126 -0
- package/dist/applicationinsights-react-native.js +3133 -0
- package/dist/applicationinsights-react-native.js.map +1 -0
- package/dist/applicationinsights-react-native.min.js +6 -0
- package/dist/applicationinsights-react-native.min.js.map +1 -0
- package/dist/applicationinsights-react-native.rollup.d.ts +131 -0
- package/dist-esm/DeviceInfo/DeviceModule.js +6 -2
- package/dist-esm/DeviceInfo/DeviceModule.js.map +1 -1
- package/dist-esm/DeviceInfo/ReactNativeDeviceInfo.js +6 -2
- package/dist-esm/DeviceInfo/ReactNativeDeviceInfo.js.map +1 -1
- package/dist-esm/Interfaces/IDeviceInfoModule.js +6 -2
- package/dist-esm/Interfaces/IDeviceInfoModule.js.map +1 -1
- package/dist-esm/Interfaces/INativeDevice.js +6 -2
- package/dist-esm/Interfaces/INativeDevice.js.map +1 -1
- package/dist-esm/Interfaces/IReactNativePluginConfig.js +4 -0
- package/dist-esm/Interfaces/IReactNativePluginConfig.js.map +1 -1
- package/dist-esm/Interfaces/index.js +6 -2
- package/dist-esm/Interfaces/index.js.map +1 -1
- package/dist-esm/ReactNativeManualDevicePlugin.js +13 -46
- package/dist-esm/ReactNativeManualDevicePlugin.js.map +1 -1
- package/dist-esm/ReactNativePlugin.js +7 -3
- package/dist-esm/ReactNativePlugin.js.map +1 -1
- package/dist-esm/index.js +6 -2
- package/dist-esm/index.js.map +1 -1
- package/dist-esm/manualIndex.js +6 -2
- package/dist-esm/manualIndex.js.map +1 -1
- package/package.json +100 -97
- package/types/tsdoc-metadata.json +11 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Microsoft Application Insights react native plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Microsoft Application Insights Team
|
|
6
|
+
* https://github.com/microsoft/applicationinsights-react-native#readme
|
|
7
|
+
*
|
|
8
|
+
* ---------------------------------------------------------------------------
|
|
9
|
+
* This is a single combined (rollup) declaration file for the package,
|
|
10
|
+
* use this version if your build environment doesn't support the using the
|
|
11
|
+
* individual *.d.ts files or default namespace wrapped version.
|
|
12
|
+
* - Namespaced version: applicationinsights-react-native.d.ts
|
|
13
|
+
* ---------------------------------------------------------------------------
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
|
|
17
|
+
import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
|
|
18
|
+
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
19
|
+
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
20
|
+
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
21
|
+
import { ITelemetryPlugin } from '@microsoft/applicationinsights-core-js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the "react-native-device-info" as the Device Info Module
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function getReactNativeDeviceInfo(): IDeviceInfoModule;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Interface to abstract how the plugin can access the Device Info, this is a stripped
|
|
31
|
+
* down version of the "react-native-device-info" interface and is mostly supplied for
|
|
32
|
+
* testing.
|
|
33
|
+
*/
|
|
34
|
+
export declare interface IDeviceInfoModule {
|
|
35
|
+
/**
|
|
36
|
+
* Returns the Device Model
|
|
37
|
+
*/
|
|
38
|
+
getModel: () => string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the device type
|
|
41
|
+
*/
|
|
42
|
+
getDeviceType: () => string;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the unique Id for the device, to support both the current version and previous
|
|
45
|
+
* versions react-native-device-info, this may return either a `string` or `Promise<string>`,
|
|
46
|
+
* when a promise is returned the plugin will "wait" for the promise to `resolve` or `reject`
|
|
47
|
+
* before processing any events. This WILL cause telemetry to be BLOCKED until either of these
|
|
48
|
+
* states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve.
|
|
49
|
+
* There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock
|
|
50
|
+
* event processing when this issue occurs.
|
|
51
|
+
*/
|
|
52
|
+
getUniqueId: () => Promise<string> | string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export declare interface INativeDevice {
|
|
56
|
+
/**
|
|
57
|
+
* Device type, e.g. Handset, Tablet, Tv
|
|
58
|
+
*/
|
|
59
|
+
deviceClass?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Unique installation ID
|
|
62
|
+
*/
|
|
63
|
+
id?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The device model: iPhone XS Max, Galaxy S10, etc
|
|
66
|
+
*/
|
|
67
|
+
model?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export declare interface IReactNativePluginConfig {
|
|
71
|
+
/**
|
|
72
|
+
* Disable automatic device collection
|
|
73
|
+
*/
|
|
74
|
+
disableDeviceCollection?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Disable automatic exception collection
|
|
77
|
+
*/
|
|
78
|
+
disableExceptionCollection?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Timeout value to unblock the processing of events if the DeviceInfoModule
|
|
81
|
+
* returns a Promise.
|
|
82
|
+
*/
|
|
83
|
+
uniqueIdPromiseTimeout?: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare class ReactNativeManualDevicePlugin extends BaseTelemetryPlugin {
|
|
87
|
+
identifier: string;
|
|
88
|
+
priority: number;
|
|
89
|
+
_nextPlugin?: ITelemetryPlugin;
|
|
90
|
+
private _setExceptionHandler;
|
|
91
|
+
private _collectDeviceInfo;
|
|
92
|
+
constructor(config?: IReactNativePluginConfig);
|
|
93
|
+
protected getDeviceInfoModule(_deviceInfoModule: any): IDeviceInfoModule;
|
|
94
|
+
initialize(config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface
|
|
95
|
+
core?: IAppInsightsCore, extensions?: IPlugin[]): void;
|
|
96
|
+
processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
97
|
+
/**
|
|
98
|
+
* Set the module that will be used during initialization when collecting device is enabled
|
|
99
|
+
* (the default), automatic collection can be disabled via the `disableDeviceCollection`
|
|
100
|
+
* config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown.
|
|
101
|
+
* @param deviceInfoModule
|
|
102
|
+
*/
|
|
103
|
+
setDeviceInfoModule(deviceInfoModule: IDeviceInfoModule): void;
|
|
104
|
+
/**
|
|
105
|
+
* Manually set the deviceId, if set before initialization and automatic device info collection
|
|
106
|
+
* is enabled this value may get overwritten. If you want to keep this value disable auto
|
|
107
|
+
* collection by setting the `disableDeviceCollection` config to true.
|
|
108
|
+
* @param newId - The value to use as the device Id.
|
|
109
|
+
*/
|
|
110
|
+
setDeviceId(newId: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Manually set the device model, if set before initialization and automatic device info
|
|
113
|
+
* collection is enabled this value may get overwritten. If you want to keep this value
|
|
114
|
+
* disable auto collection by setting the `disableDeviceCollection` config to true.
|
|
115
|
+
* @param newModel - The value to use as the device model.
|
|
116
|
+
*/
|
|
117
|
+
setDeviceModel(newModel: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Manually set the device type (class), if set before initialization and automatic device
|
|
120
|
+
* info collection is enabled this value may get overwritten. If you want to keep this value
|
|
121
|
+
* disable auto collection by setting the `disableDeviceCollection` config to true.
|
|
122
|
+
* @param newType - The value to use as the device type
|
|
123
|
+
*/
|
|
124
|
+
setDeviceType(newType: string): void;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export declare class ReactNativePlugin extends ReactNativeManualDevicePlugin {
|
|
128
|
+
protected getDeviceInfoModule(_deviceInfoModule: any): IDeviceInfoModule;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { }
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
import { objDefineAccessors } from "@microsoft/applicationinsights-core-js";
|
|
4
8
|
export var DEVICE_MODEL = "model";
|
|
5
9
|
export var DEVICE_TYPE = "type";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceModule.js","
|
|
1
|
+
{"version":3,"file":"DeviceModule.js.map","sources":["DeviceModule.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\r\nexport var DEVICE_MODEL = \"model\";\r\nexport var DEVICE_TYPE = \"type\";\r\nexport var UNIQUE_ID = \"id\";\r\nvar DeviceModule = /** @class */ (function () {\r\n function DeviceModule() {\r\n var _self = this;\r\n var _model = null;\r\n var _deviceType = null;\r\n var _uniqueId = null;\r\n function _getModel() {\r\n return _model;\r\n }\r\n function _getDeviceType() {\r\n return _deviceType;\r\n }\r\n function _getUniqueId() {\r\n return _uniqueId;\r\n }\r\n // Provide the public interface methods for accessing the values\r\n _self.getModel = _getModel;\r\n _self.getDeviceType = _getDeviceType;\r\n _self.getUniqueId = _getUniqueId;\r\n // Provide setters (for testing) and re-use the functions for minification\r\n objDefineAccessors(_self, DEVICE_MODEL, _getModel, function (value) { return _model = value; });\r\n objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, function (value) { return _deviceType = value; });\r\n objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, function (value) { return _uniqueId = value; });\r\n }\r\n return DeviceModule;\r\n}());\r\nexport { DeviceModule };\r\n//# sourceMappingURL=DeviceModule.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
import DeviceInfo from "react-native-device-info";
|
|
4
8
|
/**
|
|
5
9
|
* Returns the "react-native-device-info" as the Device Info Module
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeDeviceInfo.js","
|
|
1
|
+
{"version":3,"file":"ReactNativeDeviceInfo.js.map","sources":["ReactNativeDeviceInfo.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport DeviceInfo from \"react-native-device-info\";\r\n/**\r\n * Returns the \"react-native-device-info\" as the Device Info Module\r\n * @returns\r\n */\r\nexport function getReactNativeDeviceInfo() {\r\n return DeviceInfo;\r\n}\r\n//# sourceMappingURL=ReactNativeDeviceInfo.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
export {};
|
|
4
8
|
//# sourceMappingURL=IDeviceInfoModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDeviceInfoModule.js","
|
|
1
|
+
{"version":3,"file":"IDeviceInfoModule.js.map","sources":["IDeviceInfoModule.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=IDeviceInfoModule.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
export {};
|
|
4
8
|
//# sourceMappingURL=INativeDevice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INativeDevice.js","
|
|
1
|
+
{"version":3,"file":"INativeDevice.js.map","sources":["INativeDevice.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=INativeDevice.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IReactNativePluginConfig.js","
|
|
1
|
+
{"version":3,"file":"IReactNativePluginConfig.js.map","sources":["IReactNativePluginConfig.js"],"sourcesContent":["export {};\r\n//# sourceMappingURL=IReactNativePluginConfig.js.map"],"names":[],"mappings":";;;;AAAA;AACA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
export {};
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js.map","sources":["index.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
4
8
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
5
9
|
import { AnalyticsPluginIdentifier } from "@microsoft/applicationinsights-common";
|
|
6
10
|
import { BaseTelemetryPlugin, _throwInternal, _warnToConsole, arrForEach, dumpObj, getExceptionName, onConfigChange } from "@microsoft/applicationinsights-core-js";
|
|
@@ -220,49 +224,12 @@ var ReactNativeManualDevicePlugin = /** @class */ (function (_super) {
|
|
|
220
224
|
}
|
|
221
225
|
return _deviceInfoModule;
|
|
222
226
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
};
|
|
230
|
-
/**
|
|
231
|
-
* Set the module that will be used during initialization when collecting device is enabled
|
|
232
|
-
* (the default), automatic collection can be disabled via the `disableDeviceCollection`
|
|
233
|
-
* config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown.
|
|
234
|
-
* @param deviceInfoModule
|
|
235
|
-
*/
|
|
236
|
-
ReactNativeManualDevicePlugin.prototype.setDeviceInfoModule = function (deviceInfoModule) {
|
|
237
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* Manually set the deviceId, if set before initialization and automatic device info collection
|
|
241
|
-
* is enabled this value may get overwritten. If you want to keep this value disable auto
|
|
242
|
-
* collection by setting the `disableDeviceCollection` config to true.
|
|
243
|
-
* @param newId - The value to use as the device Id.
|
|
244
|
-
*/
|
|
245
|
-
ReactNativeManualDevicePlugin.prototype.setDeviceId = function (newId) {
|
|
246
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Manually set the device model, if set before initialization and automatic device info
|
|
250
|
-
* collection is enabled this value may get overwritten. If you want to keep this value
|
|
251
|
-
* disable auto collection by setting the `disableDeviceCollection` config to true.
|
|
252
|
-
* @param newModel - The value to use as the device model.
|
|
253
|
-
*/
|
|
254
|
-
ReactNativeManualDevicePlugin.prototype.setDeviceModel = function (newModel) {
|
|
255
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Manually set the device type (class), if set before initialization and automatic device
|
|
259
|
-
* info collection is enabled this value may get overwritten. If you want to keep this value
|
|
260
|
-
* disable auto collection by setting the `disableDeviceCollection` config to true.
|
|
261
|
-
* @param newType - The value to use as the device type
|
|
262
|
-
*/
|
|
263
|
-
ReactNativeManualDevicePlugin.prototype.setDeviceType = function (newType) {
|
|
264
|
-
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
265
|
-
};
|
|
227
|
+
// Removed Stub for ReactNativeManualDevicePlugin.prototype.initialize.
|
|
228
|
+
// Removed Stub for ReactNativeManualDevicePlugin.prototype.processTelemetry.
|
|
229
|
+
// Removed Stub for ReactNativeManualDevicePlugin.prototype.setDeviceInfoModule.
|
|
230
|
+
// Removed Stub for ReactNativeManualDevicePlugin.prototype.setDeviceId.
|
|
231
|
+
// Removed Stub for ReactNativeManualDevicePlugin.prototype.setDeviceModel.
|
|
232
|
+
// Removed Stub for ReactNativeManualDevicePlugin.prototype.setDeviceType.
|
|
266
233
|
return ReactNativeManualDevicePlugin;
|
|
267
234
|
}(BaseTelemetryPlugin));
|
|
268
235
|
export { ReactNativeManualDevicePlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeManualDevicePlugin.js","sourceRoot":"","sources":["../src/ReactNativeManualDevicePlugin.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;;AAElC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACH,yBAAyB,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,mBAAmB,EAC2C,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EACjH,gBAAgB,EAAE,cAAc,EACnC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAiB,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAI7G,IAAM,8BAA8B,GAA8C,aAAa,CAAC;IAC5F,uBAAuB,EAAE,KAAK;IAC9B,0BAA0B,EAAE,KAAK;IACjC,sBAAsB,EAAE,IAAI;CAC/B,CAAC,CAAC;AAEH;IAAmD,iDAAmB;IASlE,uCAAY,MAAiC;QAA7C,YACI,iBAAO,SA+NV;QAvOD,gBAAU,GAAW,8BAA8B,CAAC;QACpD,cAAQ,GAAW,GAAG,CAAC;QASnB,yEAAyE;QACzE,IAAI,OAAsB,CAAC;QAC3B,IAAI,OAAiC,CAA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yright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport {\r\n AnalyticsPluginIdentifier, IAppInsights, IDevice, IExceptionTelemetry, eSeverityLevel\r\n} from \"@microsoft/applicationinsights-common\";\r\nimport {\r\n BaseTelemetryPlugin, IAppInsightsCore, IConfigDefaults, IPlugin, IProcessTelemetryContext, IProcessTelemetryUnloadContext, ITelemetryItem,\r\n ITelemetryPlugin, ITelemetryUnloadState, _eInternalMessageId, _throwInternal, _warnToConsole, arrForEach, dumpObj, eLoggingSeverity,\r\n getExceptionName, onConfigChange\r\n} from \"@microsoft/applicationinsights-core-js\";\r\nimport { getGlobal, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\r\nimport { isPromiseLike, isString, ITimerHandler, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\r\n\r\ndeclare var global: Window;\r\nconst defaultReactNativePluginConfig: IConfigDefaults<IReactNativePluginConfig> = objDeepFreeze({\r\n disableDeviceCollection: false,\r\n disableExceptionCollection: false,\r\n uniqueIdPromiseTimeout: 5000\r\n});\r\n\r\nexport class ReactNativeManualDevicePlugin extends BaseTelemetryPlugin {\r\n\r\n identifier: string = \"AppInsightsReactNativePlugin\";\r\n priority: number = 140;\r\n _nextPlugin?: ITelemetryPlugin;\r\n\r\n private _setExceptionHandler: () => void;\r\n private _collectDeviceInfo: () => boolean;\r\n\r\n constructor(config?: IReactNativePluginConfig) {\r\n super();\r\n\r\n // Automatic defaults, don't set values here only set in _initDefaults()\r\n let _device: INativeDevice;\r\n let _config: IReactNativePluginConfig;\r\n let _analyticsPlugin: IAppInsights;\r\n let _defaultHandler;\r\n let _waitingForId: boolean;\r\n let _waitingTimer: ITimerHandler;\r\n let _waitingItems: { item: ITelemetryItem, itemCtx?: IProcessTelemetryContext }[] = null;\r\n let _deviceInfoModule: IDeviceInfoModule;\r\n \r\n let _deviceInfoNeedsUpdate:boolean;\r\n let exceptionHandlerSet:boolean;\r\n \r\n dynamicProto(ReactNativeManualDevicePlugin, this, (_self, _base) => {\r\n _initDefaults();\r\n\r\n _self.initialize = (\r\n config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface\r\n core?: IAppInsightsCore,\r\n extensions?: IPlugin[]\r\n ) => {\r\n let identifier = this.identifier;\r\n if (!_self.isInitialized()) {\r\n _base.initialize(config, core, extensions);\r\n\r\n _self._addHook(onConfigChange(config, (details) => {\r\n let ctx = _self._getTelCtx();\r\n _config = ctx.getExtCfg<IReactNativePluginConfig>(identifier, defaultReactNativePluginConfig);\r\n\r\n if (!_config.disableDeviceCollection && _deviceInfoNeedsUpdate) {\r\n _deviceInfoNeedsUpdate = !_self._collectDeviceInfo();\r\n }\r\n \r\n if (core && core.getPlugin) {\r\n _analyticsPlugin = core.getPlugin<any>(AnalyticsPluginIdentifier)?.plugin as IAppInsights;\r\n } else {\r\n _analyticsPlugin = null;\r\n }\r\n\r\n if (exceptionHandlerSet){\r\n _resetGlobalErrorHandler();\r\n }\r\n \r\n if (!_config.disableExceptionCollection) {\r\n _self._setExceptionHandler();\r\n exceptionHandlerSet = true;\r\n }\r\n }));\r\n }\r\n };\r\n\r\n\r\n _self.processTelemetry = (item: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {\r\n if (!_waitingForId) {\r\n _applyDeviceContext(item);\r\n _self.processNext(item, itemCtx);\r\n } else {\r\n // Make sure we have an array for the waiting items\r\n _waitingItems = _waitingItems || [];\r\n _waitingItems.push({\r\n item,\r\n itemCtx\r\n });\r\n }\r\n };\r\n \r\n _self.setDeviceInfoModule = (deviceInfoModule: IDeviceInfoModule) => {\r\n // Set the configured deviceInfoModule\r\n _deviceInfoModule = deviceInfoModule;\r\n _deviceInfoNeedsUpdate = true;\r\n };\r\n\r\n _self.setDeviceId =_setDeviceId;\r\n \r\n _self.setDeviceModel = (newModel: string) => {\r\n _device.model = newModel;\r\n };\r\n \r\n _self.setDeviceType = (newType: string) => {\r\n _device.deviceClass = newType;\r\n };\r\n \r\n /**\r\n * Automatically collects native device info for this device\r\n */\r\n _self._collectDeviceInfo = () : boolean => {\r\n try {\r\n _deviceInfoModule = this.getDeviceInfoModule(_deviceInfoModule);\r\n if (!_deviceInfoModule) {\r\n return false;\r\n }\r\n _device.deviceClass = _deviceInfoModule.getDeviceType();\r\n _device.model = _deviceInfoModule.getModel();\r\n let uniqueId = _deviceInfoModule.getUniqueId(); // Installation ID support different versions which return a promise vs string\r\n if (isPromiseLike(uniqueId)) {\r\n _waitingForId = true;\r\n if (_waitingTimer) {\r\n _waitingTimer.cancel();\r\n }\r\n _waitingTimer = scheduleTimeout(() => {\r\n _waitingTimer = null;\r\n _setDeviceId(_device.id);\r\n }, 0);\r\n _waitingTimer.unref();\r\n uniqueId.then((value) => {\r\n _setDeviceId(value);\r\n }, (reason) => {\r\n _warnToConsole(_self.diagLog(), \"Failed to get device id: \" + dumpObj(reason));\r\n // Just reuse the existing id (if any)\r\n _setDeviceId(_device.id);\r\n });\r\n } else if (isString(uniqueId)) {\r\n _device.id = uniqueId;\r\n }\r\n return true;\r\n } catch (e) {\r\n _warnToConsole(_self.diagLog(), \"Failed to get DeviceInfo: \" + getExceptionName(e) + \" - \" + dumpObj(e));\r\n }\r\n }\r\n\r\n _self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {\r\n _resetGlobalErrorHandler();\r\n _initDefaults();\r\n };\r\n\r\n function _initDefaults() {\r\n _device = {};\r\n _config = {};\r\n _analyticsPlugin = null;\r\n _defaultHandler = null;\r\n _waitingForId = false;\r\n _deviceInfoModule = null;\r\n _deviceInfoNeedsUpdate = true;\r\n exceptionHandlerSet = false;\r\n }\r\n\r\n \r\n\r\n function _setDeviceId(newId: string) {\r\n _device.id = newId;\r\n _waitingForId = false;\r\n if (_waitingTimer) {\r\n _waitingTimer.cancel();\r\n }\r\n\r\n if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) {\r\n let items = _waitingItems;\r\n _waitingItems = null;\r\n arrForEach(items, (value) => {\r\n try {\r\n _self.processTelemetry(value.item, value.itemCtx);\r\n } catch (e) {\r\n // Just ignore\r\n }\r\n });\r\n }\r\n }\r\n\r\n function _applyDeviceContext(item: ITelemetryItem) {\r\n if (_device) {\r\n item.ext = item.ext || {};\r\n item.ext.device = item.ext.device || ({} as IDevice);\r\n if (isString(_device.id)) {\r\n item.ext.device.localId = _device.id;\r\n }\r\n if (isString(_device.model)) {\r\n item.ext.device.model = _device.model;\r\n }\r\n if (isString(_device.deviceClass)) {\r\n item.ext.device.deviceClass = _device.deviceClass;\r\n }\r\n }\r\n }\r\n\r\n function _getGlobal(): any {\r\n if (typeof global !== strShimUndefined && global) {\r\n return global as any;\r\n }\r\n\r\n return getGlobal() as any;\r\n }\r\n\r\n _self._setExceptionHandler = () => {\r\n const _global = _getGlobal();\r\n if (_global && _global.ErrorUtils) {\r\n // intercept react-native error handling\r\n _defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === \"function\" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler;\r\n _global.ErrorUtils.setGlobalHandler(_trackException);\r\n }\r\n }\r\n\r\n function _resetGlobalErrorHandler() {\r\n const _global = _getGlobal();\r\n if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) {\r\n _global.ErrorUtils.setGlobalHandler(_defaultHandler || null);\r\n }\r\n }\r\n\r\n // default global error handler syntax: handleError(e, isFatal)\r\n function _trackException(e, isFatal) {\r\n const exception: IExceptionTelemetry = { exception: e, severityLevel: eSeverityLevel.Error };\r\n\r\n if (_analyticsPlugin) {\r\n _analyticsPlugin.trackException(exception);\r\n } else {\r\n _throwInternal(_self.diagLog(),\r\n eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, ReactNative plugin telemetry will not be sent: \");\r\n }\r\n\r\n // call the _defaultHandler - react native also gets the error\r\n if (_defaultHandler) {\r\n _defaultHandler.call(global, e, isFatal);\r\n }\r\n }\r\n\r\n // Test Hooks\r\n (_self as any)._config = _config;\r\n (_self as any)._getDbgPlgTargets = () => {\r\n return [_device, _deviceInfoModule, _config];\r\n }\r\n });\r\n }\r\n\r\n protected getDeviceInfoModule(_deviceInfoModule): IDeviceInfoModule {\r\n if (!_deviceInfoModule) {\r\n _warnToConsole(this.diagLog(), \"Failed to get DeviceInfo. Provide DeviceInfo while init or turn it off by setting disableDeviceCollection flag to true\");\r\n return null;\r\n }\r\n return _deviceInfoModule;\r\n }\r\n\r\n public initialize(\r\n config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface\r\n core?: IAppInsightsCore,\r\n extensions?: IPlugin[]) {\r\n\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n public processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n /**\r\n * Set the module that will be used during initialization when collecting device is enabled\r\n * (the default), automatic collection can be disabled via the `disableDeviceCollection`\r\n * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown.\r\n * @param deviceInfoModule\r\n */\r\n public setDeviceInfoModule(deviceInfoModule: IDeviceInfoModule) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n /**\r\n * Manually set the deviceId, if set before initialization and automatic device info collection\r\n * is enabled this value may get overwritten. If you want to keep this value disable auto\r\n * collection by setting the `disableDeviceCollection` config to true.\r\n * @param newId - The value to use as the device Id.\r\n */\r\n public setDeviceId(newId: string) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n /**\r\n * Manually set the device model, if set before initialization and automatic device info\r\n * collection is enabled this value may get overwritten. If you want to keep this value\r\n * disable auto collection by setting the `disableDeviceCollection` config to true.\r\n * @param newModel - The value to use as the device model.\r\n */\r\n public setDeviceModel(newModel: string) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n\r\n /**\r\n * Manually set the device type (class), if set before initialization and automatic device\r\n * info collection is enabled this value may get overwritten. If you want to keep this value\r\n * disable auto collection by setting the `disableDeviceCollection` config to true.\r\n * @param newType - The value to use as the device type\r\n */\r\n public setDeviceType(newType: string) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ReactNativeManualDevicePlugin.js.map","sources":["ReactNativeManualDevicePlugin.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AnalyticsPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, _warnToConsole, arrForEach, dumpObj, getExceptionName, onConfigChange } from \"@microsoft/applicationinsights-core-js\";\r\nimport { getGlobal, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { isPromiseLike, isString, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nvar defaultReactNativePluginConfig = objDeepFreeze({\r\n disableDeviceCollection: false,\r\n disableExceptionCollection: false,\r\n uniqueIdPromiseTimeout: 5000\r\n});\r\nvar ReactNativeManualDevicePlugin = /** @class */ (function (_super) {\r\n __extends(ReactNativeManualDevicePlugin, _super);\r\n function ReactNativeManualDevicePlugin(config) {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"AppInsightsReactNativePlugin\";\r\n _this.priority = 140;\r\n // Automatic defaults, don't set values here only set in _initDefaults()\r\n var _device;\r\n var _config;\r\n var _analyticsPlugin;\r\n var _defaultHandler;\r\n var _waitingForId;\r\n var _waitingTimer;\r\n var _waitingItems = null;\r\n var _deviceInfoModule;\r\n var _deviceInfoNeedsUpdate;\r\n var exceptionHandlerSet;\r\n dynamicProto(ReactNativeManualDevicePlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (config, // need `| object` to coerce to interface\r\n core, extensions) {\r\n var identifier = _this.identifier;\r\n if (!_self.isInitialized()) {\r\n _base.initialize(config, core, extensions);\r\n _self._addHook(onConfigChange(config, function (details) {\r\n var _a;\r\n var ctx = _self._getTelCtx();\r\n _config = ctx.getExtCfg(identifier, defaultReactNativePluginConfig);\r\n if (!_config.disableDeviceCollection && _deviceInfoNeedsUpdate) {\r\n _deviceInfoNeedsUpdate = !_self._collectDeviceInfo();\r\n }\r\n if (core && core.getPlugin) {\r\n _analyticsPlugin = (_a = core.getPlugin(AnalyticsPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin;\r\n }\r\n else {\r\n _analyticsPlugin = null;\r\n }\r\n if (exceptionHandlerSet) {\r\n _resetGlobalErrorHandler();\r\n }\r\n if (!_config.disableExceptionCollection) {\r\n _self._setExceptionHandler();\r\n exceptionHandlerSet = true;\r\n }\r\n }));\r\n }\r\n };\r\n _self.processTelemetry = function (item, itemCtx) {\r\n if (!_waitingForId) {\r\n _applyDeviceContext(item);\r\n _self.processNext(item, itemCtx);\r\n }\r\n else {\r\n // Make sure we have an array for the waiting items\r\n _waitingItems = _waitingItems || [];\r\n _waitingItems.push({\r\n item: item,\r\n itemCtx: itemCtx\r\n });\r\n }\r\n };\r\n _self.setDeviceInfoModule = function (deviceInfoModule) {\r\n // Set the configured deviceInfoModule\r\n _deviceInfoModule = deviceInfoModule;\r\n _deviceInfoNeedsUpdate = true;\r\n };\r\n _self.setDeviceId = _setDeviceId;\r\n _self.setDeviceModel = function (newModel) {\r\n _device.model = newModel;\r\n };\r\n _self.setDeviceType = function (newType) {\r\n _device.deviceClass = newType;\r\n };\r\n /**\r\n * Automatically collects native device info for this device\r\n */\r\n _self._collectDeviceInfo = function () {\r\n try {\r\n _deviceInfoModule = _this.getDeviceInfoModule(_deviceInfoModule);\r\n if (!_deviceInfoModule) {\r\n return false;\r\n }\r\n _device.deviceClass = _deviceInfoModule.getDeviceType();\r\n _device.model = _deviceInfoModule.getModel();\r\n var uniqueId = _deviceInfoModule.getUniqueId(); // Installation ID support different versions which return a promise vs string\r\n if (isPromiseLike(uniqueId)) {\r\n _waitingForId = true;\r\n if (_waitingTimer) {\r\n _waitingTimer.cancel();\r\n }\r\n _waitingTimer = scheduleTimeout(function () {\r\n _waitingTimer = null;\r\n _setDeviceId(_device.id);\r\n }, 0);\r\n _waitingTimer.unref();\r\n uniqueId.then(function (value) {\r\n _setDeviceId(value);\r\n }, function (reason) {\r\n _warnToConsole(_self.diagLog(), \"Failed to get device id: \" + dumpObj(reason));\r\n // Just reuse the existing id (if any)\r\n _setDeviceId(_device.id);\r\n });\r\n }\r\n else if (isString(uniqueId)) {\r\n _device.id = uniqueId;\r\n }\r\n return true;\r\n }\r\n catch (e) {\r\n _warnToConsole(_self.diagLog(), \"Failed to get DeviceInfo: \" + getExceptionName(e) + \" - \" + dumpObj(e));\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {\r\n _resetGlobalErrorHandler();\r\n _initDefaults();\r\n };\r\n function _initDefaults() {\r\n _device = {};\r\n _config = {};\r\n _analyticsPlugin = null;\r\n _defaultHandler = null;\r\n _waitingForId = false;\r\n _deviceInfoModule = null;\r\n _deviceInfoNeedsUpdate = true;\r\n exceptionHandlerSet = false;\r\n }\r\n function _setDeviceId(newId) {\r\n _device.id = newId;\r\n _waitingForId = false;\r\n if (_waitingTimer) {\r\n _waitingTimer.cancel();\r\n }\r\n if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) {\r\n var items = _waitingItems;\r\n _waitingItems = null;\r\n arrForEach(items, function (value) {\r\n try {\r\n _self.processTelemetry(value.item, value.itemCtx);\r\n }\r\n catch (e) {\r\n // Just ignore\r\n }\r\n });\r\n }\r\n }\r\n function _applyDeviceContext(item) {\r\n if (_device) {\r\n item.ext = item.ext || {};\r\n item.ext.device = item.ext.device || {};\r\n if (isString(_device.id)) {\r\n item.ext.device.localId = _device.id;\r\n }\r\n if (isString(_device.model)) {\r\n item.ext.device.model = _device.model;\r\n }\r\n if (isString(_device.deviceClass)) {\r\n item.ext.device.deviceClass = _device.deviceClass;\r\n }\r\n }\r\n }\r\n function _getGlobal() {\r\n if (typeof global !== strShimUndefined && global) {\r\n return global;\r\n }\r\n return getGlobal();\r\n }\r\n _self._setExceptionHandler = function () {\r\n var _global = _getGlobal();\r\n if (_global && _global.ErrorUtils) {\r\n // intercept react-native error handling\r\n _defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === \"function\" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler;\r\n _global.ErrorUtils.setGlobalHandler(_trackException);\r\n }\r\n };\r\n function _resetGlobalErrorHandler() {\r\n var _global = _getGlobal();\r\n if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) {\r\n _global.ErrorUtils.setGlobalHandler(_defaultHandler || null);\r\n }\r\n }\r\n // default global error handler syntax: handleError(e, isFatal)\r\n function _trackException(e, isFatal) {\r\n var exception = { exception: e, severityLevel: 3 /* eSeverityLevel.Error */ };\r\n if (_analyticsPlugin) {\r\n _analyticsPlugin.trackException(exception);\r\n }\r\n else {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, \"Analytics plugin is not available, ReactNative plugin telemetry will not be sent: \");\r\n }\r\n // call the _defaultHandler - react native also gets the error\r\n if (_defaultHandler) {\r\n _defaultHandler.call(global, e, isFatal);\r\n }\r\n }\r\n // Test Hooks\r\n _self._config = _config;\r\n _self._getDbgPlgTargets = function () {\r\n return [_device, _deviceInfoModule, _config];\r\n };\r\n });\r\n return _this;\r\n }\r\n ReactNativeManualDevicePlugin.prototype.getDeviceInfoModule = function (_deviceInfoModule) {\r\n if (!_deviceInfoModule) {\r\n _warnToConsole(this.diagLog(), \"Failed to get DeviceInfo. Provide DeviceInfo while init or turn it off by setting disableDeviceCollection flag to true\");\r\n return null;\r\n }\r\n return _deviceInfoModule;\r\n };\r\n ReactNativeManualDevicePlugin.prototype.initialize = function (config, // need `| object` to coerce to interface\r\n core, extensions) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ReactNativeManualDevicePlugin.prototype.processTelemetry = function (env, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Set the module that will be used during initialization when collecting device is enabled\r\n * (the default), automatic collection can be disabled via the `disableDeviceCollection`\r\n * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown.\r\n * @param deviceInfoModule\r\n */\r\n ReactNativeManualDevicePlugin.prototype.setDeviceInfoModule = function (deviceInfoModule) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Manually set the deviceId, if set before initialization and automatic device info collection\r\n * is enabled this value may get overwritten. If you want to keep this value disable auto\r\n * collection by setting the `disableDeviceCollection` config to true.\r\n * @param newId - The value to use as the device Id.\r\n */\r\n ReactNativeManualDevicePlugin.prototype.setDeviceId = function (newId) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Manually set the device model, if set before initialization and automatic device info\r\n * collection is enabled this value may get overwritten. If you want to keep this value\r\n * disable auto collection by setting the `disableDeviceCollection` config to true.\r\n * @param newModel - The value to use as the device model.\r\n */\r\n ReactNativeManualDevicePlugin.prototype.setDeviceModel = function (newModel) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Manually set the device type (class), if set before initialization and automatic device\r\n * info collection is enabled this value may get overwritten. If you want to keep this value\r\n * disable auto collection by setting the `disableDeviceCollection` config to true.\r\n * @param newType - The value to use as the device type\r\n */\r\n ReactNativeManualDevicePlugin.prototype.setDeviceType = function (newType) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return ReactNativeManualDevicePlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { ReactNativeManualDevicePlugin };\r\n//# sourceMappingURL=ReactNativeManualDevicePlugin.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;0EA0CM;AACN;AACA;AACA;AACA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
4
8
|
import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo";
|
|
5
9
|
import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin";
|
|
6
10
|
var ReactNativePlugin = /** @class */ (function (_super) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativePlugin.js","
|
|
1
|
+
{"version":3,"file":"ReactNativePlugin.js.map","sources":["ReactNativePlugin.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { __extends } from \"tslib\";\r\nimport { getReactNativeDeviceInfo } from \"./DeviceInfo/ReactNativeDeviceInfo\";\r\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\r\nvar ReactNativePlugin = /** @class */ (function (_super) {\r\n __extends(ReactNativePlugin, _super);\r\n function ReactNativePlugin() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ReactNativePlugin.prototype.getDeviceInfoModule = function (_deviceInfoModule) {\r\n return _deviceInfoModule || getReactNativeDeviceInfo();\r\n };\r\n return ReactNativePlugin;\r\n}(ReactNativeManualDevicePlugin));\r\nexport { ReactNativePlugin };\r\n//# sourceMappingURL=ReactNativePlugin.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/dist-esm/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
import { ReactNativePlugin } from "./ReactNativePlugin";
|
|
4
8
|
import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo";
|
|
5
9
|
import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin";
|
package/dist-esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js.map","sources":["index.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ReactNativePlugin } from \"./ReactNativePlugin\";\r\nimport { getReactNativeDeviceInfo } from \"./DeviceInfo/ReactNativeDeviceInfo\";\r\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\r\nexport { ReactNativePlugin, ReactNativeManualDevicePlugin };\r\nexport { getReactNativeDeviceInfo };\r\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA"}
|
package/dist-esm/manualIndex.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Application Insights JavaScript SDK - React Native Plugin, 4.3.5-nightly.2411-03
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin";
|
|
4
8
|
export { ReactNativeManualDevicePlugin };
|
|
5
9
|
//# sourceMappingURL=manualIndex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manualIndex.js","
|
|
1
|
+
{"version":3,"file":"manualIndex.js.map","sources":["manualIndex.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\r\nexport { ReactNativeManualDevicePlugin };\r\n//# sourceMappingURL=manualIndex.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA"}
|