From fd3f9ec31bfd891a19422d9a6691bb2f9065360f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 20:14:00 +0000 Subject: [PATCH 1/7] Initial plan From b70aaa6bc57f0f782a507f8b1d12843ca1cc42b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 20:26:02 +0000 Subject: [PATCH 2/7] Initial analysis - identify missing export path for manualIndex Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> --- .../src/DeviceInfo/DeviceModule.d.ts | 10 + .../src/DeviceInfo/DeviceModule.js | 34 +++ .../src/DeviceInfo/DeviceModule.js.map | 1 + .../src/DeviceInfo/ReactNativeDeviceInfo.d.ts | 6 + .../src/DeviceInfo/ReactNativeDeviceInfo.js | 11 + .../DeviceInfo/ReactNativeDeviceInfo.js.map | 1 + .../src/Interfaces/IDeviceInfoModule.d.ts | 25 ++ .../src/Interfaces/IDeviceInfoModule.js | 4 + .../src/Interfaces/IDeviceInfoModule.js.map | 1 + .../src/Interfaces/INativeDevice.d.ts | 14 + .../src/Interfaces/INativeDevice.js | 4 + .../src/Interfaces/INativeDevice.js.map | 1 + .../Interfaces/IReactNativePluginConfig.d.ts | 15 + .../Interfaces/IReactNativePluginConfig.js | 2 + .../IReactNativePluginConfig.js.map | 1 + .../src/Interfaces/index.d.ts | 3 + .../src/Interfaces/index.js | 4 + .../src/Interfaces/index.js.map | 1 + .../src/ReactNativeManualDevicePlugin.d.ts | 43 +++ .../src/ReactNativeManualDevicePlugin.js | 269 ++++++++++++++++++ .../src/ReactNativeManualDevicePlugin.js.map | 1 + .../src/ReactNativePlugin.d.ts | 5 + .../src/ReactNativePlugin.js | 17 ++ .../src/ReactNativePlugin.js.map | 1 + .../src/index.d.ts | 7 + applicationinsights-react-native/src/index.js | 8 + .../src/index.js.map | 1 + .../src/manualIndex.d.ts | 4 + .../src/manualIndex.js | 5 + .../src/manualIndex.js.map | 1 + .../tsconfig.json | 5 +- 31 files changed, 502 insertions(+), 3 deletions(-) create mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts create mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js create mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map create mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts create mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js create mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js create mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js create mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js create mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/index.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/index.js create mode 100644 applicationinsights-react-native/src/Interfaces/index.js.map create mode 100644 applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts create mode 100644 applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js create mode 100644 applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map create mode 100644 applicationinsights-react-native/src/ReactNativePlugin.d.ts create mode 100644 applicationinsights-react-native/src/ReactNativePlugin.js create mode 100644 applicationinsights-react-native/src/ReactNativePlugin.js.map create mode 100644 applicationinsights-react-native/src/index.d.ts create mode 100644 applicationinsights-react-native/src/index.js create mode 100644 applicationinsights-react-native/src/index.js.map create mode 100644 applicationinsights-react-native/src/manualIndex.d.ts create mode 100644 applicationinsights-react-native/src/manualIndex.js create mode 100644 applicationinsights-react-native/src/manualIndex.js.map diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts new file mode 100644 index 00000000..9076b37f --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts @@ -0,0 +1,10 @@ +import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; +export declare const DEVICE_MODEL = "model"; +export declare const DEVICE_TYPE = "type"; +export declare const UNIQUE_ID = "id"; +export declare class DeviceModule implements IDeviceInfoModule { + getModel: () => string; + getDeviceType: () => string; + getUniqueId: () => string | Promise; + constructor(); +} diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js new file mode 100644 index 00000000..ee6be332 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { objDefineAccessors } from "@microsoft/applicationinsights-core-js"; +export var DEVICE_MODEL = "model"; +export var DEVICE_TYPE = "type"; +export var UNIQUE_ID = "id"; +var DeviceModule = /** @class */ (function () { + function DeviceModule() { + var _self = this; + var _model = null; + var _deviceType = null; + var _uniqueId = null; + function _getModel() { + return _model; + } + function _getDeviceType() { + return _deviceType; + } + function _getUniqueId() { + return _uniqueId; + } + // Provide the public interface methods for accessing the values + _self.getModel = _getModel; + _self.getDeviceType = _getDeviceType; + _self.getUniqueId = _getUniqueId; + // Provide setters (for testing) and re-use the functions for minification + objDefineAccessors(_self, DEVICE_MODEL, _getModel, function (value) { return _model = value; }); + objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, function (value) { return _deviceType = value; }); + objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, function (value) { return _uniqueId = value; }); + } + return DeviceModule; +}()); +export { DeviceModule }; +//# sourceMappingURL=DeviceModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map new file mode 100644 index 00000000..57ee9813 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DeviceModule.js","sourceRoot":"","sources":["DeviceModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,MAAM,CAAC,IAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,IAAM,WAAW,GAAG,MAAM,CAAC;AAClC,MAAM,CAAC,IAAM,SAAS,GAAG,IAAI,CAAC;AAE9B;IAKI;QACI,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,IAAI,MAAM,GAAW,IAAI,CAAC;QAC1B,IAAI,WAAW,GAAW,IAAI,CAAC;QAC/B,IAAI,SAAS,GAA6B,IAAI,CAAC;QAE/C,SAAS,SAAS;YACd,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,SAAS,cAAc;YACnB,OAAO,WAAW,CAAC;QACvB,CAAC;QAED,SAAS,YAAY;YACjB,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,gEAAgE;QAChE,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC3B,KAAK,CAAC,aAAa,GAAG,cAAc,CAAC;QACrC,KAAK,CAAC,WAAW,GAAG,YAAY,CAAA;QAEhC,0EAA0E;QAC1E,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAC,KAAK,IAAK,OAAA,MAAM,GAAG,KAAK,EAAd,CAAc,CAAC,CAAC;QAC9E,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,UAAC,KAAK,IAAK,OAAA,WAAW,GAAG,KAAK,EAAnB,CAAmB,CAAC,CAAC;QACvF,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAC,KAAK,IAAK,OAAA,SAAS,GAAG,KAAK,EAAjB,CAAiB,CAAC,CAAC;IACrF,CAAC;IACL,mBAAC;AAAD,CAAC,AAjCD,IAiCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\nexport const DEVICE_MODEL = \"model\";\nexport const DEVICE_TYPE = \"type\";\nexport const UNIQUE_ID = \"id\";\n\nexport class DeviceModule implements IDeviceInfoModule {\n public getModel: () => string;\n public getDeviceType: () => string;\n public getUniqueId: () => string | Promise;\n\n constructor() {\n let _self = this;\n let _model: string = null;\n let _deviceType: string = null;\n let _uniqueId: string | Promise = null;\n\n function _getModel() {\n return _model;\n }\n\n function _getDeviceType() {\n return _deviceType;\n }\n\n function _getUniqueId() {\n return _uniqueId;\n }\n\n // Provide the public interface methods for accessing the values\n _self.getModel = _getModel;\n _self.getDeviceType = _getDeviceType;\n _self.getUniqueId = _getUniqueId\n\n // Provide setters (for testing) and re-use the functions for minification\n objDefineAccessors(_self, DEVICE_MODEL, _getModel, (value) => _model = value);\n objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, (value) => _deviceType = value);\n objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, (value) => _uniqueId = value);\n }\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts new file mode 100644 index 00000000..84731ff9 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts @@ -0,0 +1,6 @@ +import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; +/** + * Returns the "react-native-device-info" as the Device Info Module + * @returns + */ +export declare function getReactNativeDeviceInfo(): IDeviceInfoModule; diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js new file mode 100644 index 00000000..56f9cc87 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import DeviceInfo from "react-native-device-info"; +/** + * Returns the "react-native-device-info" as the Device Info Module + * @returns + */ +export function getReactNativeDeviceInfo() { + return DeviceInfo; +} +//# sourceMappingURL=ReactNativeDeviceInfo.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map new file mode 100644 index 00000000..87f6ff9e --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ReactNativeDeviceInfo.js","sourceRoot":"","sources":["ReactNativeDeviceInfo.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAGlD;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACpC,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport DeviceInfo from \"react-native-device-info\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\n/**\n * Returns the \"react-native-device-info\" as the Device Info Module\n * @returns\n */\nexport function getReactNativeDeviceInfo(): IDeviceInfoModule {\n return DeviceInfo;\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts new file mode 100644 index 00000000..3aaa3876 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts @@ -0,0 +1,25 @@ +/** + * Interface to abstract how the plugin can access the Device Info, this is a stripped + * down version of the "react-native-device-info" interface and is mostly supplied for + * testing. + */ +export interface IDeviceInfoModule { + /** + * Returns the Device Model + */ + getModel: () => string; + /** + * Returns the device type + */ + getDeviceType: () => string; + /** + * Returns the unique Id for the device, to support both the current version and previous + * versions react-native-device-info, this may return either a `string` or `Promise`, + * when a promise is returned the plugin will "wait" for the promise to `resolve` or `reject` + * before processing any events. This WILL cause telemetry to be BLOCKED until either of these + * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve. + * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock + * event processing when this issue occurs. + */ + getUniqueId: () => Promise | string; +} diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js new file mode 100644 index 00000000..c8a6d87f --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +export {}; +//# sourceMappingURL=IDeviceInfoModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map new file mode 100644 index 00000000..0521d434 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IDeviceInfoModule.js","sourceRoot":"","sources":["IDeviceInfoModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * Interface to abstract how the plugin can access the Device Info, this is a stripped\n * down version of the \"react-native-device-info\" interface and is mostly supplied for\n * testing.\n */\nexport interface IDeviceInfoModule {\n /**\n * Returns the Device Model\n */\n getModel: () => string;\n\n /**\n * Returns the device type\n */\n getDeviceType: () => string;\n\n /**\n * Returns the unique Id for the device, to support both the current version and previous\n * versions react-native-device-info, this may return either a `string` or `Promise`,\n * when a promise is returned the plugin will \"wait\" for the promise to `resolve` or `reject`\n * before processing any events. This WILL cause telemetry to be BLOCKED until either of these\n * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve.\n * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock\n * event processing when this issue occurs.\n */\n getUniqueId: () => Promise | string;\n}\n\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts b/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts new file mode 100644 index 00000000..a7486c91 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts @@ -0,0 +1,14 @@ +export interface INativeDevice { + /** + * Device type, e.g. Handset, Tablet, Tv + */ + deviceClass?: string; + /** + * Unique installation ID + */ + id?: string; + /** + * The device model: iPhone XS Max, Galaxy S10, etc + */ + model?: string; +} diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js b/applicationinsights-react-native/src/Interfaces/INativeDevice.js new file mode 100644 index 00000000..980d412e --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/INativeDevice.js @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +export {}; +//# sourceMappingURL=INativeDevice.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map b/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map new file mode 100644 index 00000000..7ff7ab10 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map @@ -0,0 +1 @@ +{"version":3,"file":"INativeDevice.js","sourceRoot":"","sources":["INativeDevice.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nexport interface INativeDevice {\n /**\n * Device type, e.g. Handset, Tablet, Tv\n */\n deviceClass?: string;\n\n /**\n * Unique installation ID\n */\n id?: string;\n\n /**\n * The device model: iPhone XS Max, Galaxy S10, etc\n */\n model?: string;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts new file mode 100644 index 00000000..c4d2e610 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts @@ -0,0 +1,15 @@ +export interface IReactNativePluginConfig { + /** + * Disable automatic device collection + */ + disableDeviceCollection?: boolean; + /** + * Disable automatic exception collection + */ + disableExceptionCollection?: boolean; + /** + * Timeout value to unblock the processing of events if the DeviceInfoModule + * returns a Promise. + */ + uniqueIdPromiseTimeout?: number; +} diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js new file mode 100644 index 00000000..226f9ad3 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=IReactNativePluginConfig.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map new file mode 100644 index 00000000..31ec78bc --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IReactNativePluginConfig.js","sourceRoot":"","sources":["IReactNativePluginConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nexport interface IReactNativePluginConfig {\n /**\n * Disable automatic device collection\n */\n disableDeviceCollection?: boolean;\n\n /**\n * Disable automatic exception collection\n */\n disableExceptionCollection?: boolean;\n\n /**\n * Timeout value to unblock the processing of events if the DeviceInfoModule\n * returns a Promise.\n */\n uniqueIdPromiseTimeout?: number;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.d.ts b/applicationinsights-react-native/src/Interfaces/index.d.ts new file mode 100644 index 00000000..60cb8453 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/index.d.ts @@ -0,0 +1,3 @@ +import { INativeDevice } from "./INativeDevice"; +import { IReactNativePluginConfig } from "./IReactNativePluginConfig"; +export { INativeDevice, IReactNativePluginConfig }; diff --git a/applicationinsights-react-native/src/Interfaces/index.js b/applicationinsights-react-native/src/Interfaces/index.js new file mode 100644 index 00000000..3c19633e --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/index.js @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +export {}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.js.map b/applicationinsights-react-native/src/Interfaces/index.js.map new file mode 100644 index 00000000..2ec4799a --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { INativeDevice } from \"./INativeDevice\";\nimport { IReactNativePluginConfig } from \"./IReactNativePluginConfig\";\n\nexport { INativeDevice, IReactNativePluginConfig };\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts new file mode 100644 index 00000000..087af07d --- /dev/null +++ b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts @@ -0,0 +1,43 @@ +import { BaseTelemetryPlugin, IAppInsightsCore, IPlugin, IProcessTelemetryContext, ITelemetryItem, ITelemetryPlugin } from "@microsoft/applicationinsights-core-js"; +import { IReactNativePluginConfig } from "./Interfaces"; +import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; +export declare class ReactNativeManualDevicePlugin extends BaseTelemetryPlugin { + identifier: string; + priority: number; + _nextPlugin?: ITelemetryPlugin; + private _setExceptionHandler; + private _collectDeviceInfo; + constructor(config?: IReactNativePluginConfig); + protected getDeviceInfoModule(_deviceInfoModule: any): IDeviceInfoModule; + initialize(config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface + core?: IAppInsightsCore, extensions?: IPlugin[]): void; + processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void; + /** + * Set the module that will be used during initialization when collecting device is enabled + * (the default), automatic collection can be disabled via the `disableDeviceCollection` + * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown. + * @param deviceInfoModule + */ + setDeviceInfoModule(deviceInfoModule: IDeviceInfoModule): void; + /** + * Manually set the deviceId, if set before initialization and automatic device info collection + * is enabled this value may get overwritten. If you want to keep this value disable auto + * collection by setting the `disableDeviceCollection` config to true. + * @param newId - The value to use as the device Id. + */ + setDeviceId(newId: string): void; + /** + * Manually set the device model, if set before initialization and automatic device info + * collection is enabled this value may get overwritten. If you want to keep this value + * disable auto collection by setting the `disableDeviceCollection` config to true. + * @param newModel - The value to use as the device model. + */ + setDeviceModel(newModel: string): void; + /** + * Manually set the device type (class), if set before initialization and automatic device + * info collection is enabled this value may get overwritten. If you want to keep this value + * disable auto collection by setting the `disableDeviceCollection` config to true. + * @param newType - The value to use as the device type + */ + setDeviceType(newType: string): void; +} diff --git a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js new file mode 100644 index 00000000..4f8c4381 --- /dev/null +++ b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { __extends } from "tslib"; +import dynamicProto from "@microsoft/dynamicproto-js"; +import { AnalyticsPluginIdentifier, eSeverityLevel } from "@microsoft/applicationinsights-common"; +import { BaseTelemetryPlugin, _eInternalMessageId, _throwInternal, _warnToConsole, arrForEach, dumpObj, eLoggingSeverity, getExceptionName, onConfigChange } from "@microsoft/applicationinsights-core-js"; +import { getGlobal, strShimUndefined } from "@microsoft/applicationinsights-shims"; +import { isPromiseLike, isString, objDeepFreeze, scheduleTimeout } from "@nevware21/ts-utils"; +var defaultReactNativePluginConfig = objDeepFreeze({ + disableDeviceCollection: false, + disableExceptionCollection: false, + uniqueIdPromiseTimeout: 5000 +}); +var ReactNativeManualDevicePlugin = /** @class */ (function (_super) { + __extends(ReactNativeManualDevicePlugin, _super); + function ReactNativeManualDevicePlugin(config) { + var _this = _super.call(this) || this; + _this.identifier = "AppInsightsReactNativePlugin"; + _this.priority = 140; + // Automatic defaults, don't set values here only set in _initDefaults() + var _device; + var _config; + var _analyticsPlugin; + var _defaultHandler; + var _waitingForId; + var _waitingTimer; + var _waitingItems = null; + var _deviceInfoModule; + var _deviceInfoNeedsUpdate; + var exceptionHandlerSet; + dynamicProto(ReactNativeManualDevicePlugin, _this, function (_self, _base) { + _initDefaults(); + _self.initialize = function (config, // need `| object` to coerce to interface + core, extensions) { + var identifier = _this.identifier; + if (!_self.isInitialized()) { + _base.initialize(config, core, extensions); + _self._addHook(onConfigChange(config, function (details) { + var _a; + var ctx = _self._getTelCtx(); + _config = ctx.getExtCfg(identifier, defaultReactNativePluginConfig); + if (!_config.disableDeviceCollection && _deviceInfoNeedsUpdate) { + _deviceInfoNeedsUpdate = !_self._collectDeviceInfo(); + } + if (core && core.getPlugin) { + _analyticsPlugin = (_a = core.getPlugin(AnalyticsPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin; + } + else { + _analyticsPlugin = null; + } + if (exceptionHandlerSet) { + _resetGlobalErrorHandler(); + } + if (!_config.disableExceptionCollection) { + _self._setExceptionHandler(); + exceptionHandlerSet = true; + } + })); + } + }; + _self.processTelemetry = function (item, itemCtx) { + if (!_waitingForId) { + _applyDeviceContext(item); + _self.processNext(item, itemCtx); + } + else { + // Make sure we have an array for the waiting items + _waitingItems = _waitingItems || []; + _waitingItems.push({ + item: item, + itemCtx: itemCtx + }); + } + }; + _self.setDeviceInfoModule = function (deviceInfoModule) { + // Set the configured deviceInfoModule + _deviceInfoModule = deviceInfoModule; + _deviceInfoNeedsUpdate = true; + }; + _self.setDeviceId = _setDeviceId; + _self.setDeviceModel = function (newModel) { + _device.model = newModel; + }; + _self.setDeviceType = function (newType) { + _device.deviceClass = newType; + }; + /** + * Automatically collects native device info for this device + */ + _self._collectDeviceInfo = function () { + try { + _deviceInfoModule = _this.getDeviceInfoModule(_deviceInfoModule); + if (!_deviceInfoModule) { + return false; + } + _device.deviceClass = _deviceInfoModule.getDeviceType(); + _device.model = _deviceInfoModule.getModel(); + var uniqueId = _deviceInfoModule.getUniqueId(); // Installation ID support different versions which return a promise vs string + if (isPromiseLike(uniqueId)) { + _waitingForId = true; + if (_waitingTimer) { + _waitingTimer.cancel(); + } + _waitingTimer = scheduleTimeout(function () { + _waitingTimer = null; + _setDeviceId(_device.id); + }, 0); + _waitingTimer.unref(); + uniqueId.then(function (value) { + _setDeviceId(value); + }, function (reason) { + _warnToConsole(_self.diagLog(), "Failed to get device id: " + dumpObj(reason)); + // Just reuse the existing id (if any) + _setDeviceId(_device.id); + }); + } + else if (isString(uniqueId)) { + _device.id = uniqueId; + } + return true; + } + catch (e) { + _warnToConsole(_self.diagLog(), "Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj(e)); + } + }; + _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) { + _resetGlobalErrorHandler(); + _initDefaults(); + }; + function _initDefaults() { + _device = {}; + _config = {}; + _analyticsPlugin = null; + _defaultHandler = null; + _waitingForId = false; + _deviceInfoModule = null; + _deviceInfoNeedsUpdate = true; + exceptionHandlerSet = false; + } + function _setDeviceId(newId) { + _device.id = newId; + _waitingForId = false; + if (_waitingTimer) { + _waitingTimer.cancel(); + } + if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) { + var items = _waitingItems; + _waitingItems = null; + arrForEach(items, function (value) { + try { + _self.processTelemetry(value.item, value.itemCtx); + } + catch (e) { + // Just ignore + } + }); + } + } + function _applyDeviceContext(item) { + if (_device) { + item.ext = item.ext || {}; + item.ext.device = item.ext.device || {}; + if (isString(_device.id)) { + item.ext.device.localId = _device.id; + } + if (isString(_device.model)) { + item.ext.device.model = _device.model; + } + if (isString(_device.deviceClass)) { + item.ext.device.deviceClass = _device.deviceClass; + } + } + } + function _getGlobal() { + if (typeof global !== strShimUndefined && global) { + return global; + } + return getGlobal(); + } + _self._setExceptionHandler = function () { + var _global = _getGlobal(); + if (_global && _global.ErrorUtils) { + // intercept react-native error handling + _defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === "function" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler; + _global.ErrorUtils.setGlobalHandler(_trackException); + } + }; + function _resetGlobalErrorHandler() { + var _global = _getGlobal(); + if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) { + _global.ErrorUtils.setGlobalHandler(_defaultHandler || null); + } + } + // default global error handler syntax: handleError(e, isFatal) + function _trackException(e, isFatal) { + var exception = { exception: e, severityLevel: eSeverityLevel.Error }; + if (_analyticsPlugin) { + _analyticsPlugin.trackException(exception); + } + else { + _throwInternal(_self.diagLog(), eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, ReactNative plugin telemetry will not be sent: "); + } + // call the _defaultHandler - react native also gets the error + if (_defaultHandler) { + _defaultHandler.call(global, e, isFatal); + } + } + // Test Hooks + _self._config = _config; + _self._getDbgPlgTargets = function () { + return [_device, _deviceInfoModule, _config]; + }; + }); + return _this; + } + ReactNativeManualDevicePlugin.prototype.getDeviceInfoModule = function (_deviceInfoModule) { + if (!_deviceInfoModule) { + _warnToConsole(this.diagLog(), "Failed to get DeviceInfo. Provide DeviceInfo while init or turn it off by setting disableDeviceCollection flag to true"); + return null; + } + return _deviceInfoModule; + }; + ReactNativeManualDevicePlugin.prototype.initialize = function (config, // need `| object` to coerce to interface + core, extensions) { + // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging + }; + ReactNativeManualDevicePlugin.prototype.processTelemetry = function (env, itemCtx) { + // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging + }; + /** + * Set the module that will be used during initialization when collecting device is enabled + * (the default), automatic collection can be disabled via the `disableDeviceCollection` + * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown. + * @param deviceInfoModule + */ + ReactNativeManualDevicePlugin.prototype.setDeviceInfoModule = function (deviceInfoModule) { + // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging + }; + /** + * Manually set the deviceId, if set before initialization and automatic device info collection + * is enabled this value may get overwritten. If you want to keep this value disable auto + * collection by setting the `disableDeviceCollection` config to true. + * @param newId - The value to use as the device Id. + */ + ReactNativeManualDevicePlugin.prototype.setDeviceId = function (newId) { + // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging + }; + /** + * Manually set the device model, if set before initialization and automatic device info + * collection is enabled this value may get overwritten. If you want to keep this value + * disable auto collection by setting the `disableDeviceCollection` config to true. + * @param newModel - The value to use as the device model. + */ + ReactNativeManualDevicePlugin.prototype.setDeviceModel = function (newModel) { + // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging + }; + /** + * Manually set the device type (class), if set before initialization and automatic device + * info collection is enabled this value may get overwritten. If you want to keep this value + * disable auto collection by setting the `disableDeviceCollection` config to true. + * @param newType - The value to use as the device type + */ + ReactNativeManualDevicePlugin.prototype.setDeviceType = function (newType) { + // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging + }; + return ReactNativeManualDevicePlugin; +}(BaseTelemetryPlugin)); +export { ReactNativeManualDevicePlugin }; +//# sourceMappingURL=ReactNativeManualDevicePlugin.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map new file mode 100644 index 00000000..eb75ae58 --- /dev/null +++ b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ReactNativeManualDevicePlugin.js","sourceRoot":"","sources":["ReactNativeManualDevicePlugin.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;;AAElC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACH,yBAAyB,EAA8C,cAAc,EACxF,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,mBAAmB,EACsB,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EACnI,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;QACzC,YAAA,MAAK,WAAE,SAAC;QARZ,gBAAU,GAAW,8BAA8B,CAAC;QACpD,cAAQ,GAAW,GAAG,CAAC;QASnB,yEAAyE;QACzE,IAAI,OAAsB,CAAC;QAC3B,IAAI,OAAiC,CAAC;QACtC,IAAI,gBAA8B,CAAC;QACnC,IAAI,eAAe,CAAC;QACpB,IAAI,aAAsB,CAAC;QAC3B,IAAI,aAA4B,CAAC;QACjC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;QAC1D,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,mDAAW,GAAlB,UAAmB,KAAa;QAC5B,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,sDAAc,GAArB,UAAsB,QAAgB;QAClC,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,qDAAa,GAApB,UAAqB,OAAe;QAChC,oFAAoF;IACxF,CAAC;IACL,oCAAC;AAAD,CAAC,AAtSD,CAAmD,mBAAmB,GAsSrE","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\nimport {\n AnalyticsPluginIdentifier, IAppInsights, IDevice, IExceptionTelemetry, eSeverityLevel\n} from \"@microsoft/applicationinsights-common\";\nimport {\n BaseTelemetryPlugin, IAppInsightsCore, IConfigDefaults, IPlugin, IProcessTelemetryContext, IProcessTelemetryUnloadContext, ITelemetryItem,\n ITelemetryPlugin, ITelemetryUnloadState, _eInternalMessageId, _throwInternal, _warnToConsole, arrForEach, dumpObj, eLoggingSeverity,\n getExceptionName, onConfigChange\n} from \"@microsoft/applicationinsights-core-js\";\nimport { getGlobal, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\nimport { isPromiseLike, isString, ITimerHandler, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\n\ndeclare var global: Window;\nconst defaultReactNativePluginConfig: IConfigDefaults = objDeepFreeze({\n disableDeviceCollection: false,\n disableExceptionCollection: false,\n uniqueIdPromiseTimeout: 5000\n});\n\nexport class ReactNativeManualDevicePlugin extends BaseTelemetryPlugin {\n\n identifier: string = \"AppInsightsReactNativePlugin\";\n priority: number = 140;\n _nextPlugin?: ITelemetryPlugin;\n\n private _setExceptionHandler: () => void;\n private _collectDeviceInfo: () => boolean;\n\n constructor(config?: IReactNativePluginConfig) {\n super();\n\n // Automatic defaults, don't set values here only set in _initDefaults()\n let _device: INativeDevice;\n let _config: IReactNativePluginConfig;\n let _analyticsPlugin: IAppInsights;\n let _defaultHandler;\n let _waitingForId: boolean;\n let _waitingTimer: ITimerHandler;\n let _waitingItems: { item: ITelemetryItem, itemCtx?: IProcessTelemetryContext }[] = null;\n let _deviceInfoModule: IDeviceInfoModule;\n \n let _deviceInfoNeedsUpdate:boolean;\n let exceptionHandlerSet:boolean;\n \n dynamicProto(ReactNativeManualDevicePlugin, this, (_self, _base) => {\n _initDefaults();\n\n _self.initialize = (\n config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface\n core?: IAppInsightsCore,\n extensions?: IPlugin[]\n ) => {\n let identifier = this.identifier;\n if (!_self.isInitialized()) {\n _base.initialize(config, core, extensions);\n\n _self._addHook(onConfigChange(config, (details) => {\n let ctx = _self._getTelCtx();\n _config = ctx.getExtCfg(identifier, defaultReactNativePluginConfig);\n\n if (!_config.disableDeviceCollection && _deviceInfoNeedsUpdate) {\n _deviceInfoNeedsUpdate = !_self._collectDeviceInfo();\n }\n \n if (core && core.getPlugin) {\n _analyticsPlugin = core.getPlugin(AnalyticsPluginIdentifier)?.plugin as IAppInsights;\n } else {\n _analyticsPlugin = null;\n }\n\n if (exceptionHandlerSet){\n _resetGlobalErrorHandler();\n }\n \n if (!_config.disableExceptionCollection) {\n _self._setExceptionHandler();\n exceptionHandlerSet = true;\n }\n }));\n }\n };\n\n\n _self.processTelemetry = (item: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {\n if (!_waitingForId) {\n _applyDeviceContext(item);\n _self.processNext(item, itemCtx);\n } else {\n // Make sure we have an array for the waiting items\n _waitingItems = _waitingItems || [];\n _waitingItems.push({\n item,\n itemCtx\n });\n }\n };\n \n _self.setDeviceInfoModule = (deviceInfoModule: IDeviceInfoModule) => {\n // Set the configured deviceInfoModule\n _deviceInfoModule = deviceInfoModule;\n _deviceInfoNeedsUpdate = true;\n };\n\n _self.setDeviceId =_setDeviceId;\n \n _self.setDeviceModel = (newModel: string) => {\n _device.model = newModel;\n };\n \n _self.setDeviceType = (newType: string) => {\n _device.deviceClass = newType;\n };\n \n /**\n * Automatically collects native device info for this device\n */\n _self._collectDeviceInfo = () : boolean => {\n try {\n _deviceInfoModule = this.getDeviceInfoModule(_deviceInfoModule);\n if (!_deviceInfoModule) {\n return false;\n }\n _device.deviceClass = _deviceInfoModule.getDeviceType();\n _device.model = _deviceInfoModule.getModel();\n let uniqueId = _deviceInfoModule.getUniqueId(); // Installation ID support different versions which return a promise vs string\n if (isPromiseLike(uniqueId)) {\n _waitingForId = true;\n if (_waitingTimer) {\n _waitingTimer.cancel();\n }\n _waitingTimer = scheduleTimeout(() => {\n _waitingTimer = null;\n _setDeviceId(_device.id);\n }, 0);\n _waitingTimer.unref();\n uniqueId.then((value) => {\n _setDeviceId(value);\n }, (reason) => {\n _warnToConsole(_self.diagLog(), \"Failed to get device id: \" + dumpObj(reason));\n // Just reuse the existing id (if any)\n _setDeviceId(_device.id);\n });\n } else if (isString(uniqueId)) {\n _device.id = uniqueId;\n }\n return true;\n } catch (e) {\n _warnToConsole(_self.diagLog(), \"Failed to get DeviceInfo: \" + getExceptionName(e) + \" - \" + dumpObj(e));\n }\n }\n\n _self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {\n _resetGlobalErrorHandler();\n _initDefaults();\n };\n\n function _initDefaults() {\n _device = {};\n _config = {};\n _analyticsPlugin = null;\n _defaultHandler = null;\n _waitingForId = false;\n _deviceInfoModule = null;\n _deviceInfoNeedsUpdate = true;\n exceptionHandlerSet = false;\n }\n\n \n\n function _setDeviceId(newId: string) {\n _device.id = newId;\n _waitingForId = false;\n if (_waitingTimer) {\n _waitingTimer.cancel();\n }\n\n if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) {\n let items = _waitingItems;\n _waitingItems = null;\n arrForEach(items, (value) => {\n try {\n _self.processTelemetry(value.item, value.itemCtx);\n } catch (e) {\n // Just ignore\n }\n });\n }\n }\n\n function _applyDeviceContext(item: ITelemetryItem) {\n if (_device) {\n item.ext = item.ext || {};\n item.ext.device = item.ext.device || ({} as IDevice);\n if (isString(_device.id)) {\n item.ext.device.localId = _device.id;\n }\n if (isString(_device.model)) {\n item.ext.device.model = _device.model;\n }\n if (isString(_device.deviceClass)) {\n item.ext.device.deviceClass = _device.deviceClass;\n }\n }\n }\n\n function _getGlobal(): any {\n if (typeof global !== strShimUndefined && global) {\n return global as any;\n }\n\n return getGlobal() as any;\n }\n\n _self._setExceptionHandler = () => {\n const _global = _getGlobal();\n if (_global && _global.ErrorUtils) {\n // intercept react-native error handling\n _defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === \"function\" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler;\n _global.ErrorUtils.setGlobalHandler(_trackException);\n }\n }\n\n function _resetGlobalErrorHandler() {\n const _global = _getGlobal();\n if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) {\n _global.ErrorUtils.setGlobalHandler(_defaultHandler || null);\n }\n }\n\n // default global error handler syntax: handleError(e, isFatal)\n function _trackException(e, isFatal) {\n const exception: IExceptionTelemetry = { exception: e, severityLevel: eSeverityLevel.Error };\n\n if (_analyticsPlugin) {\n _analyticsPlugin.trackException(exception);\n } else {\n _throwInternal(_self.diagLog(),\n eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, ReactNative plugin telemetry will not be sent: \");\n }\n\n // call the _defaultHandler - react native also gets the error\n if (_defaultHandler) {\n _defaultHandler.call(global, e, isFatal);\n }\n }\n\n // Test Hooks\n (_self as any)._config = _config;\n (_self as any)._getDbgPlgTargets = () => {\n return [_device, _deviceInfoModule, _config];\n }\n });\n }\n\n protected getDeviceInfoModule(_deviceInfoModule): IDeviceInfoModule {\n if (!_deviceInfoModule) {\n _warnToConsole(this.diagLog(), \"Failed to get DeviceInfo. Provide DeviceInfo while init or turn it off by setting disableDeviceCollection flag to true\");\n return null;\n }\n return _deviceInfoModule;\n }\n\n public initialize(\n config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface\n core?: IAppInsightsCore,\n extensions?: IPlugin[]) {\n\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n public processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Set the module that will be used during initialization when collecting device is enabled\n * (the default), automatic collection can be disabled via the `disableDeviceCollection`\n * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown.\n * @param deviceInfoModule\n */\n public setDeviceInfoModule(deviceInfoModule: IDeviceInfoModule) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Manually set the deviceId, if set before initialization and automatic device info collection\n * is enabled this value may get overwritten. If you want to keep this value disable auto\n * collection by setting the `disableDeviceCollection` config to true.\n * @param newId - The value to use as the device Id.\n */\n public setDeviceId(newId: string) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Manually set the device model, if set before initialization and automatic device info\n * collection is enabled this value may get overwritten. If you want to keep this value\n * disable auto collection by setting the `disableDeviceCollection` config to true.\n * @param newModel - The value to use as the device model.\n */\n public setDeviceModel(newModel: string) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Manually set the device type (class), if set before initialization and automatic device\n * info collection is enabled this value may get overwritten. If you want to keep this value\n * disable auto collection by setting the `disableDeviceCollection` config to true.\n * @param newType - The value to use as the device type\n */\n public setDeviceType(newType: string) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativePlugin.d.ts b/applicationinsights-react-native/src/ReactNativePlugin.d.ts new file mode 100644 index 00000000..1e754845 --- /dev/null +++ b/applicationinsights-react-native/src/ReactNativePlugin.d.ts @@ -0,0 +1,5 @@ +import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; +import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; +export declare class ReactNativePlugin extends ReactNativeManualDevicePlugin { + protected getDeviceInfoModule(_deviceInfoModule: any): IDeviceInfoModule; +} diff --git a/applicationinsights-react-native/src/ReactNativePlugin.js b/applicationinsights-react-native/src/ReactNativePlugin.js new file mode 100644 index 00000000..1a158902 --- /dev/null +++ b/applicationinsights-react-native/src/ReactNativePlugin.js @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { __extends } from "tslib"; +import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo"; +import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; +var ReactNativePlugin = /** @class */ (function (_super) { + __extends(ReactNativePlugin, _super); + function ReactNativePlugin() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReactNativePlugin.prototype.getDeviceInfoModule = function (_deviceInfoModule) { + return _deviceInfoModule || getReactNativeDeviceInfo(); + }; + return ReactNativePlugin; +}(ReactNativeManualDevicePlugin)); +export { ReactNativePlugin }; +//# sourceMappingURL=ReactNativePlugin.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativePlugin.js.map b/applicationinsights-react-native/src/ReactNativePlugin.js.map new file mode 100644 index 00000000..381dacc3 --- /dev/null +++ b/applicationinsights-react-native/src/ReactNativePlugin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ReactNativePlugin.js","sourceRoot":"","sources":["ReactNativePlugin.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF;IAAuC,qCAA6B;IAApE;;IAIA,CAAC;IAHa,+CAAmB,GAA7B,UAA8B,iBAAiB;QAC3C,OAAO,iBAAiB,IAAI,wBAAwB,EAAE,CAAC;IAC3D,CAAC;IACL,wBAAC;AAAD,CAAC,AAJD,CAAuC,6BAA6B,GAInE","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n\nimport { getReactNativeDeviceInfo } from \"./DeviceInfo/ReactNativeDeviceInfo\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\n\n\nexport class ReactNativePlugin extends ReactNativeManualDevicePlugin {\n protected getDeviceInfoModule(_deviceInfoModule): IDeviceInfoModule {\n return _deviceInfoModule || getReactNativeDeviceInfo();\n }\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/index.d.ts b/applicationinsights-react-native/src/index.d.ts new file mode 100644 index 00000000..377b491d --- /dev/null +++ b/applicationinsights-react-native/src/index.d.ts @@ -0,0 +1,7 @@ +import { ReactNativePlugin } from "./ReactNativePlugin"; +import { INativeDevice, IReactNativePluginConfig } from "./Interfaces"; +import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; +import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo"; +import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; +export { ReactNativePlugin, ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule }; +export { getReactNativeDeviceInfo }; diff --git a/applicationinsights-react-native/src/index.js b/applicationinsights-react-native/src/index.js new file mode 100644 index 00000000..f7ea1169 --- /dev/null +++ b/applicationinsights-react-native/src/index.js @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { ReactNativePlugin } from "./ReactNativePlugin"; +import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo"; +import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; +export { ReactNativePlugin, ReactNativeManualDevicePlugin }; +export { getReactNativeDeviceInfo }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/index.js.map b/applicationinsights-react-native/src/index.js.map new file mode 100644 index 00000000..2e7b28ff --- /dev/null +++ b/applicationinsights-react-native/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAA8D,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { ReactNativePlugin } from \"./ReactNativePlugin\";\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\nimport { getReactNativeDeviceInfo } from \"./DeviceInfo/ReactNativeDeviceInfo\";\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\n\nexport { ReactNativePlugin, ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule };\nexport { getReactNativeDeviceInfo };\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/manualIndex.d.ts b/applicationinsights-react-native/src/manualIndex.d.ts new file mode 100644 index 00000000..e8267008 --- /dev/null +++ b/applicationinsights-react-native/src/manualIndex.d.ts @@ -0,0 +1,4 @@ +import { INativeDevice, IReactNativePluginConfig } from "./Interfaces"; +import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; +import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; +export { ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule }; diff --git a/applicationinsights-react-native/src/manualIndex.js b/applicationinsights-react-native/src/manualIndex.js new file mode 100644 index 00000000..50276e89 --- /dev/null +++ b/applicationinsights-react-native/src/manualIndex.js @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; +export { ReactNativeManualDevicePlugin }; +//# sourceMappingURL=manualIndex.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/manualIndex.js.map b/applicationinsights-react-native/src/manualIndex.js.map new file mode 100644 index 00000000..a7417baa --- /dev/null +++ b/applicationinsights-react-native/src/manualIndex.js.map @@ -0,0 +1 @@ +{"version":3,"file":"manualIndex.js","sourceRoot":"","sources":["manualIndex.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAKlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,6BAA6B,EAA8D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\n\nexport { ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule };\n\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/tsconfig.json b/applicationinsights-react-native/tsconfig.json index 4e17aeeb..9744eb56 100644 --- a/applicationinsights-react-native/tsconfig.json +++ b/applicationinsights-react-native/tsconfig.json @@ -7,15 +7,14 @@ "moduleResolution": "Node", "target": "es5", "alwaysStrict": true, - "suppressImplicitAnyIndexErrors": true, "allowSyntheticDefaultImports": true, "importHelpers": true, "noEmitHelpers": true, "forceConsistentCasingInFileNames": true, "declaration": true, - "declarationDir": "applicationinsights-react-native/types", + "declarationDir": "types", "outDir": "dist-esm", - "rootDir": "applicationinsights-react-native/src" + "rootDir": "src" }, "include": [ "./src/**/*.ts" From 43b66586dd5e78d2a930f9aa77ed408a96a2e4cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 20:28:40 +0000 Subject: [PATCH 3/7] Add missing export for /dist-esm/manualIndex path to fix Expo imports Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> --- applicationinsights-react-native/package.json | 4 +++ .../src/DeviceInfo/DeviceModule.d.ts | 10 ------ .../src/DeviceInfo/DeviceModule.js | 34 ------------------- .../src/DeviceInfo/DeviceModule.js.map | 1 - .../src/DeviceInfo/ReactNativeDeviceInfo.d.ts | 6 ---- .../src/DeviceInfo/ReactNativeDeviceInfo.js | 11 ------ .../DeviceInfo/ReactNativeDeviceInfo.js.map | 1 - .../src/Interfaces/IDeviceInfoModule.d.ts | 25 -------------- .../src/Interfaces/IDeviceInfoModule.js | 4 --- .../src/Interfaces/IDeviceInfoModule.js.map | 1 - .../src/Interfaces/INativeDevice.d.ts | 14 -------- .../src/Interfaces/INativeDevice.js | 4 --- .../src/Interfaces/INativeDevice.js.map | 1 - .../Interfaces/IReactNativePluginConfig.d.ts | 15 -------- .../Interfaces/IReactNativePluginConfig.js | 2 -- .../IReactNativePluginConfig.js.map | 1 - .../src/Interfaces/index.d.ts | 3 -- .../src/Interfaces/index.js | 4 --- .../src/Interfaces/index.js.map | 1 - 19 files changed, 4 insertions(+), 138 deletions(-) delete mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts delete mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js delete mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map delete mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts delete mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js delete mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js delete mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js delete mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js delete mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/index.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/index.js delete mode 100644 applicationinsights-react-native/src/Interfaces/index.js.map diff --git a/applicationinsights-react-native/package.json b/applicationinsights-react-native/package.json index d5f390bc..25f95c38 100644 --- a/applicationinsights-react-native/package.json +++ b/applicationinsights-react-native/package.json @@ -11,6 +11,10 @@ "./manual": { "types": "./types/manualIndex.d.ts", "import": "./dist-esm/manualIndex.js" + }, + "./dist-esm/manualIndex": { + "types": "./types/manualIndex.d.ts", + "import": "./dist-esm/manualIndex.js" } }, "types": "types/index.d.ts", diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts deleted file mode 100644 index 9076b37f..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; -export declare const DEVICE_MODEL = "model"; -export declare const DEVICE_TYPE = "type"; -export declare const UNIQUE_ID = "id"; -export declare class DeviceModule implements IDeviceInfoModule { - getModel: () => string; - getDeviceType: () => string; - getUniqueId: () => string | Promise; - constructor(); -} diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js deleted file mode 100644 index ee6be332..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import { objDefineAccessors } from "@microsoft/applicationinsights-core-js"; -export var DEVICE_MODEL = "model"; -export var DEVICE_TYPE = "type"; -export var UNIQUE_ID = "id"; -var DeviceModule = /** @class */ (function () { - function DeviceModule() { - var _self = this; - var _model = null; - var _deviceType = null; - var _uniqueId = null; - function _getModel() { - return _model; - } - function _getDeviceType() { - return _deviceType; - } - function _getUniqueId() { - return _uniqueId; - } - // Provide the public interface methods for accessing the values - _self.getModel = _getModel; - _self.getDeviceType = _getDeviceType; - _self.getUniqueId = _getUniqueId; - // Provide setters (for testing) and re-use the functions for minification - objDefineAccessors(_self, DEVICE_MODEL, _getModel, function (value) { return _model = value; }); - objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, function (value) { return _deviceType = value; }); - objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, function (value) { return _uniqueId = value; }); - } - return DeviceModule; -}()); -export { DeviceModule }; -//# sourceMappingURL=DeviceModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map deleted file mode 100644 index 57ee9813..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DeviceModule.js","sourceRoot":"","sources":["DeviceModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,MAAM,CAAC,IAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,IAAM,WAAW,GAAG,MAAM,CAAC;AAClC,MAAM,CAAC,IAAM,SAAS,GAAG,IAAI,CAAC;AAE9B;IAKI;QACI,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,IAAI,MAAM,GAAW,IAAI,CAAC;QAC1B,IAAI,WAAW,GAAW,IAAI,CAAC;QAC/B,IAAI,SAAS,GAA6B,IAAI,CAAC;QAE/C,SAAS,SAAS;YACd,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,SAAS,cAAc;YACnB,OAAO,WAAW,CAAC;QACvB,CAAC;QAED,SAAS,YAAY;YACjB,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,gEAAgE;QAChE,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC3B,KAAK,CAAC,aAAa,GAAG,cAAc,CAAC;QACrC,KAAK,CAAC,WAAW,GAAG,YAAY,CAAA;QAEhC,0EAA0E;QAC1E,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAC,KAAK,IAAK,OAAA,MAAM,GAAG,KAAK,EAAd,CAAc,CAAC,CAAC;QAC9E,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,UAAC,KAAK,IAAK,OAAA,WAAW,GAAG,KAAK,EAAnB,CAAmB,CAAC,CAAC;QACvF,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAC,KAAK,IAAK,OAAA,SAAS,GAAG,KAAK,EAAjB,CAAiB,CAAC,CAAC;IACrF,CAAC;IACL,mBAAC;AAAD,CAAC,AAjCD,IAiCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\nexport const DEVICE_MODEL = \"model\";\nexport const DEVICE_TYPE = \"type\";\nexport const UNIQUE_ID = \"id\";\n\nexport class DeviceModule implements IDeviceInfoModule {\n public getModel: () => string;\n public getDeviceType: () => string;\n public getUniqueId: () => string | Promise;\n\n constructor() {\n let _self = this;\n let _model: string = null;\n let _deviceType: string = null;\n let _uniqueId: string | Promise = null;\n\n function _getModel() {\n return _model;\n }\n\n function _getDeviceType() {\n return _deviceType;\n }\n\n function _getUniqueId() {\n return _uniqueId;\n }\n\n // Provide the public interface methods for accessing the values\n _self.getModel = _getModel;\n _self.getDeviceType = _getDeviceType;\n _self.getUniqueId = _getUniqueId\n\n // Provide setters (for testing) and re-use the functions for minification\n objDefineAccessors(_self, DEVICE_MODEL, _getModel, (value) => _model = value);\n objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, (value) => _deviceType = value);\n objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, (value) => _uniqueId = value);\n }\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts deleted file mode 100644 index 84731ff9..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; -/** - * Returns the "react-native-device-info" as the Device Info Module - * @returns - */ -export declare function getReactNativeDeviceInfo(): IDeviceInfoModule; diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js deleted file mode 100644 index 56f9cc87..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import DeviceInfo from "react-native-device-info"; -/** - * Returns the "react-native-device-info" as the Device Info Module - * @returns - */ -export function getReactNativeDeviceInfo() { - return DeviceInfo; -} -//# sourceMappingURL=ReactNativeDeviceInfo.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map deleted file mode 100644 index 87f6ff9e..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ReactNativeDeviceInfo.js","sourceRoot":"","sources":["ReactNativeDeviceInfo.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAGlD;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACpC,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport DeviceInfo from \"react-native-device-info\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\n/**\n * Returns the \"react-native-device-info\" as the Device Info Module\n * @returns\n */\nexport function getReactNativeDeviceInfo(): IDeviceInfoModule {\n return DeviceInfo;\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts deleted file mode 100644 index 3aaa3876..00000000 --- a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Interface to abstract how the plugin can access the Device Info, this is a stripped - * down version of the "react-native-device-info" interface and is mostly supplied for - * testing. - */ -export interface IDeviceInfoModule { - /** - * Returns the Device Model - */ - getModel: () => string; - /** - * Returns the device type - */ - getDeviceType: () => string; - /** - * Returns the unique Id for the device, to support both the current version and previous - * versions react-native-device-info, this may return either a `string` or `Promise`, - * when a promise is returned the plugin will "wait" for the promise to `resolve` or `reject` - * before processing any events. This WILL cause telemetry to be BLOCKED until either of these - * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve. - * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock - * event processing when this issue occurs. - */ - getUniqueId: () => Promise | string; -} diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js deleted file mode 100644 index c8a6d87f..00000000 --- a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -export {}; -//# sourceMappingURL=IDeviceInfoModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map deleted file mode 100644 index 0521d434..00000000 --- a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IDeviceInfoModule.js","sourceRoot":"","sources":["IDeviceInfoModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * Interface to abstract how the plugin can access the Device Info, this is a stripped\n * down version of the \"react-native-device-info\" interface and is mostly supplied for\n * testing.\n */\nexport interface IDeviceInfoModule {\n /**\n * Returns the Device Model\n */\n getModel: () => string;\n\n /**\n * Returns the device type\n */\n getDeviceType: () => string;\n\n /**\n * Returns the unique Id for the device, to support both the current version and previous\n * versions react-native-device-info, this may return either a `string` or `Promise`,\n * when a promise is returned the plugin will \"wait\" for the promise to `resolve` or `reject`\n * before processing any events. This WILL cause telemetry to be BLOCKED until either of these\n * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve.\n * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock\n * event processing when this issue occurs.\n */\n getUniqueId: () => Promise | string;\n}\n\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts b/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts deleted file mode 100644 index a7486c91..00000000 --- a/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface INativeDevice { - /** - * Device type, e.g. Handset, Tablet, Tv - */ - deviceClass?: string; - /** - * Unique installation ID - */ - id?: string; - /** - * The device model: iPhone XS Max, Galaxy S10, etc - */ - model?: string; -} diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js b/applicationinsights-react-native/src/Interfaces/INativeDevice.js deleted file mode 100644 index 980d412e..00000000 --- a/applicationinsights-react-native/src/Interfaces/INativeDevice.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -export {}; -//# sourceMappingURL=INativeDevice.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map b/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map deleted file mode 100644 index 7ff7ab10..00000000 --- a/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"INativeDevice.js","sourceRoot":"","sources":["INativeDevice.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nexport interface INativeDevice {\n /**\n * Device type, e.g. Handset, Tablet, Tv\n */\n deviceClass?: string;\n\n /**\n * Unique installation ID\n */\n id?: string;\n\n /**\n * The device model: iPhone XS Max, Galaxy S10, etc\n */\n model?: string;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts deleted file mode 100644 index c4d2e610..00000000 --- a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export interface IReactNativePluginConfig { - /** - * Disable automatic device collection - */ - disableDeviceCollection?: boolean; - /** - * Disable automatic exception collection - */ - disableExceptionCollection?: boolean; - /** - * Timeout value to unblock the processing of events if the DeviceInfoModule - * returns a Promise. - */ - uniqueIdPromiseTimeout?: number; -} diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js deleted file mode 100644 index 226f9ad3..00000000 --- a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=IReactNativePluginConfig.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map deleted file mode 100644 index 31ec78bc..00000000 --- a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IReactNativePluginConfig.js","sourceRoot":"","sources":["IReactNativePluginConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nexport interface IReactNativePluginConfig {\n /**\n * Disable automatic device collection\n */\n disableDeviceCollection?: boolean;\n\n /**\n * Disable automatic exception collection\n */\n disableExceptionCollection?: boolean;\n\n /**\n * Timeout value to unblock the processing of events if the DeviceInfoModule\n * returns a Promise.\n */\n uniqueIdPromiseTimeout?: number;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.d.ts b/applicationinsights-react-native/src/Interfaces/index.d.ts deleted file mode 100644 index 60cb8453..00000000 --- a/applicationinsights-react-native/src/Interfaces/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { INativeDevice } from "./INativeDevice"; -import { IReactNativePluginConfig } from "./IReactNativePluginConfig"; -export { INativeDevice, IReactNativePluginConfig }; diff --git a/applicationinsights-react-native/src/Interfaces/index.js b/applicationinsights-react-native/src/Interfaces/index.js deleted file mode 100644 index 3c19633e..00000000 --- a/applicationinsights-react-native/src/Interfaces/index.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -export {}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.js.map b/applicationinsights-react-native/src/Interfaces/index.js.map deleted file mode 100644 index 2ec4799a..00000000 --- a/applicationinsights-react-native/src/Interfaces/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { INativeDevice } from \"./INativeDevice\";\nimport { IReactNativePluginConfig } from \"./IReactNativePluginConfig\";\n\nexport { INativeDevice, IReactNativePluginConfig };\n"]} \ No newline at end of file From a121cc08b63ab97db533727815b445ed00c6dea0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 12 Jul 2025 00:19:43 +0000 Subject: [PATCH 4/7] Restore deleted DeviceInfo and Interfaces files, keep only package.json export changes Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> --- .../src/DeviceInfo/DeviceModule.d.ts | 10 ++++++ .../src/DeviceInfo/DeviceModule.js | 34 +++++++++++++++++++ .../src/DeviceInfo/DeviceModule.js.map | 1 + .../src/DeviceInfo/ReactNativeDeviceInfo.d.ts | 6 ++++ .../src/DeviceInfo/ReactNativeDeviceInfo.js | 11 ++++++ .../DeviceInfo/ReactNativeDeviceInfo.js.map | 1 + .../src/Interfaces/IDeviceInfoModule.d.ts | 25 ++++++++++++++ .../src/Interfaces/IDeviceInfoModule.js | 4 +++ .../src/Interfaces/IDeviceInfoModule.js.map | 1 + .../src/Interfaces/INativeDevice.d.ts | 14 ++++++++ .../src/Interfaces/INativeDevice.js | 4 +++ .../src/Interfaces/INativeDevice.js.map | 1 + .../Interfaces/IReactNativePluginConfig.d.ts | 15 ++++++++ .../Interfaces/IReactNativePluginConfig.js | 2 ++ .../IReactNativePluginConfig.js.map | 1 + .../src/Interfaces/index.d.ts | 3 ++ .../src/Interfaces/index.js | 4 +++ .../src/Interfaces/index.js.map | 1 + 18 files changed, 138 insertions(+) create mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts create mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js create mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map create mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts create mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js create mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js create mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js create mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js create mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map create mode 100644 applicationinsights-react-native/src/Interfaces/index.d.ts create mode 100644 applicationinsights-react-native/src/Interfaces/index.js create mode 100644 applicationinsights-react-native/src/Interfaces/index.js.map diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts new file mode 100644 index 00000000..9076b37f --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts @@ -0,0 +1,10 @@ +import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; +export declare const DEVICE_MODEL = "model"; +export declare const DEVICE_TYPE = "type"; +export declare const UNIQUE_ID = "id"; +export declare class DeviceModule implements IDeviceInfoModule { + getModel: () => string; + getDeviceType: () => string; + getUniqueId: () => string | Promise; + constructor(); +} diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js new file mode 100644 index 00000000..ee6be332 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { objDefineAccessors } from "@microsoft/applicationinsights-core-js"; +export var DEVICE_MODEL = "model"; +export var DEVICE_TYPE = "type"; +export var UNIQUE_ID = "id"; +var DeviceModule = /** @class */ (function () { + function DeviceModule() { + var _self = this; + var _model = null; + var _deviceType = null; + var _uniqueId = null; + function _getModel() { + return _model; + } + function _getDeviceType() { + return _deviceType; + } + function _getUniqueId() { + return _uniqueId; + } + // Provide the public interface methods for accessing the values + _self.getModel = _getModel; + _self.getDeviceType = _getDeviceType; + _self.getUniqueId = _getUniqueId; + // Provide setters (for testing) and re-use the functions for minification + objDefineAccessors(_self, DEVICE_MODEL, _getModel, function (value) { return _model = value; }); + objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, function (value) { return _deviceType = value; }); + objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, function (value) { return _uniqueId = value; }); + } + return DeviceModule; +}()); +export { DeviceModule }; +//# sourceMappingURL=DeviceModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map new file mode 100644 index 00000000..57ee9813 --- /dev/null +++ b/applicationinsights-react-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D,IAiCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\nexport const DEVICE_MODEL = \"model\";\nexport const DEVICE_TYPE = \"type\";\nexport const UNIQUE_ID = \"id\";\n\nexport class DeviceModule implements IDeviceInfoModule {\n public getModel: () => string;\n public getDeviceType: () => string;\n public getUniqueId: () => string | Promise;\n\n constructor() {\n let _self = this;\n let _model: string = null;\n let _deviceType: string = null;\n let _uniqueId: string | Promise = null;\n\n function _getModel() {\n return _model;\n }\n\n function _getDeviceType() {\n return _deviceType;\n }\n\n function _getUniqueId() {\n return _uniqueId;\n }\n\n // Provide the public interface methods for accessing the values\n _self.getModel = _getModel;\n _self.getDeviceType = _getDeviceType;\n _self.getUniqueId = _getUniqueId\n\n // Provide setters (for testing) and re-use the functions for minification\n objDefineAccessors(_self, DEVICE_MODEL, _getModel, (value) => _model = value);\n objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, (value) => _deviceType = value);\n objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, (value) => _uniqueId = value);\n }\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts new file mode 100644 index 00000000..84731ff9 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts @@ -0,0 +1,6 @@ +import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; +/** + * Returns the "react-native-device-info" as the Device Info Module + * @returns + */ +export declare function getReactNativeDeviceInfo(): IDeviceInfoModule; diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js new file mode 100644 index 00000000..56f9cc87 --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import DeviceInfo from "react-native-device-info"; +/** + * Returns the "react-native-device-info" as the Device Info Module + * @returns + */ +export function getReactNativeDeviceInfo() { + return DeviceInfo; +} +//# sourceMappingURL=ReactNativeDeviceInfo.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map new file mode 100644 index 00000000..87f6ff9e --- /dev/null +++ b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ReactNativeDeviceInfo.js","sourceRoot":"","sources":["ReactNativeDeviceInfo.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAGlD;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACpC,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport DeviceInfo from \"react-native-device-info\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\n/**\n * Returns the \"react-native-device-info\" as the Device Info Module\n * @returns\n */\nexport function getReactNativeDeviceInfo(): IDeviceInfoModule {\n return DeviceInfo;\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts new file mode 100644 index 00000000..3aaa3876 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts @@ -0,0 +1,25 @@ +/** + * Interface to abstract how the plugin can access the Device Info, this is a stripped + * down version of the "react-native-device-info" interface and is mostly supplied for + * testing. + */ +export interface IDeviceInfoModule { + /** + * Returns the Device Model + */ + getModel: () => string; + /** + * Returns the device type + */ + getDeviceType: () => string; + /** + * Returns the unique Id for the device, to support both the current version and previous + * versions react-native-device-info, this may return either a `string` or `Promise`, + * when a promise is returned the plugin will "wait" for the promise to `resolve` or `reject` + * before processing any events. This WILL cause telemetry to be BLOCKED until either of these + * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve. + * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock + * event processing when this issue occurs. + */ + getUniqueId: () => Promise | string; +} diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js new file mode 100644 index 00000000..c8a6d87f --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +export {}; +//# sourceMappingURL=IDeviceInfoModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map new file mode 100644 index 00000000..0521d434 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IDeviceInfoModule.js","sourceRoot":"","sources":["IDeviceInfoModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * Interface to abstract how the plugin can access the Device Info, this is a stripped\n * down version of the \"react-native-device-info\" interface and is mostly supplied for\n * testing.\n */\nexport interface IDeviceInfoModule {\n /**\n * Returns the Device Model\n */\n getModel: () => string;\n\n /**\n * Returns the device type\n */\n getDeviceType: () => string;\n\n /**\n * Returns the unique Id for the device, to support both the current version and previous\n * versions react-native-device-info, this may return either a `string` or `Promise`,\n * when a promise is returned the plugin will \"wait\" for the promise to `resolve` or `reject`\n * before processing any events. This WILL cause telemetry to be BLOCKED until either of these\n * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve.\n * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock\n * event processing when this issue occurs.\n */\n getUniqueId: () => Promise | string;\n}\n\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts b/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts new file mode 100644 index 00000000..a7486c91 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts @@ -0,0 +1,14 @@ +export interface INativeDevice { + /** + * Device type, e.g. Handset, Tablet, Tv + */ + deviceClass?: string; + /** + * Unique installation ID + */ + id?: string; + /** + * The device model: iPhone XS Max, Galaxy S10, etc + */ + model?: string; +} diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js b/applicationinsights-react-native/src/Interfaces/INativeDevice.js new file mode 100644 index 00000000..980d412e --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/INativeDevice.js @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +export {}; +//# sourceMappingURL=INativeDevice.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map b/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map new file mode 100644 index 00000000..7ff7ab10 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map @@ -0,0 +1 @@ +{"version":3,"file":"INativeDevice.js","sourceRoot":"","sources":["INativeDevice.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nexport interface INativeDevice {\n /**\n * Device type, e.g. Handset, Tablet, Tv\n */\n deviceClass?: string;\n\n /**\n * Unique installation ID\n */\n id?: string;\n\n /**\n * The device model: iPhone XS Max, Galaxy S10, etc\n */\n model?: string;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts new file mode 100644 index 00000000..c4d2e610 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts @@ -0,0 +1,15 @@ +export interface IReactNativePluginConfig { + /** + * Disable automatic device collection + */ + disableDeviceCollection?: boolean; + /** + * Disable automatic exception collection + */ + disableExceptionCollection?: boolean; + /** + * Timeout value to unblock the processing of events if the DeviceInfoModule + * returns a Promise. + */ + uniqueIdPromiseTimeout?: number; +} diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js new file mode 100644 index 00000000..226f9ad3 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=IReactNativePluginConfig.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map new file mode 100644 index 00000000..31ec78bc --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"IReactNativePluginConfig.js","sourceRoot":"","sources":["IReactNativePluginConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nexport interface IReactNativePluginConfig {\n /**\n * Disable automatic device collection\n */\n disableDeviceCollection?: boolean;\n\n /**\n * Disable automatic exception collection\n */\n disableExceptionCollection?: boolean;\n\n /**\n * Timeout value to unblock the processing of events if the DeviceInfoModule\n * returns a Promise.\n */\n uniqueIdPromiseTimeout?: number;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.d.ts b/applicationinsights-react-native/src/Interfaces/index.d.ts new file mode 100644 index 00000000..60cb8453 --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/index.d.ts @@ -0,0 +1,3 @@ +import { INativeDevice } from "./INativeDevice"; +import { IReactNativePluginConfig } from "./IReactNativePluginConfig"; +export { INativeDevice, IReactNativePluginConfig }; diff --git a/applicationinsights-react-native/src/Interfaces/index.js b/applicationinsights-react-native/src/Interfaces/index.js new file mode 100644 index 00000000..3c19633e --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/index.js @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +export {}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.js.map b/applicationinsights-react-native/src/Interfaces/index.js.map new file mode 100644 index 00000000..2ec4799a --- /dev/null +++ b/applicationinsights-react-native/src/Interfaces/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { INativeDevice } from \"./INativeDevice\";\nimport { IReactNativePluginConfig } from \"./IReactNativePluginConfig\";\n\nexport { INativeDevice, IReactNativePluginConfig };\n"]} \ No newline at end of file From 28c30dc1390893623aa8b5eb4dafc83aaa8c6746 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 12 Jul 2025 00:24:07 +0000 Subject: [PATCH 5/7] Add require field to package.json exports for Jest compatibility Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> --- applicationinsights-react-native/package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/applicationinsights-react-native/package.json b/applicationinsights-react-native/package.json index 25f95c38..60d41c4d 100644 --- a/applicationinsights-react-native/package.json +++ b/applicationinsights-react-native/package.json @@ -6,15 +6,18 @@ "exports": { ".": { "types": "./types/index.d.ts", - "import": "./dist-esm/index.js" + "import": "./dist-esm/index.js", + "require": "./dist/applicationinsights-react-native.js" }, "./manual": { "types": "./types/manualIndex.d.ts", - "import": "./dist-esm/manualIndex.js" + "import": "./dist-esm/manualIndex.js", + "require": "./dist/applicationinsights-react-native.js" }, "./dist-esm/manualIndex": { "types": "./types/manualIndex.d.ts", - "import": "./dist-esm/manualIndex.js" + "import": "./dist-esm/manualIndex.js", + "require": "./dist/applicationinsights-react-native.js" } }, "types": "types/index.d.ts", From 31c36b96f112cb3d004baf152d16372da13b4273 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 12 Jul 2025 00:29:15 +0000 Subject: [PATCH 6/7] Remove all generated files and restore only package.json exports changes Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> --- .../src/DeviceInfo/DeviceModule.d.ts | 10 - .../src/DeviceInfo/DeviceModule.js | 34 --- .../src/DeviceInfo/DeviceModule.js.map | 1 - .../src/DeviceInfo/ReactNativeDeviceInfo.d.ts | 6 - .../src/DeviceInfo/ReactNativeDeviceInfo.js | 11 - .../DeviceInfo/ReactNativeDeviceInfo.js.map | 1 - .../src/Interfaces/IDeviceInfoModule.d.ts | 25 -- .../src/Interfaces/IDeviceInfoModule.js | 4 - .../src/Interfaces/IDeviceInfoModule.js.map | 1 - .../src/Interfaces/INativeDevice.d.ts | 14 - .../src/Interfaces/INativeDevice.js | 4 - .../src/Interfaces/INativeDevice.js.map | 1 - .../Interfaces/IReactNativePluginConfig.d.ts | 15 - .../Interfaces/IReactNativePluginConfig.js | 2 - .../IReactNativePluginConfig.js.map | 1 - .../src/Interfaces/index.d.ts | 3 - .../src/Interfaces/index.js | 4 - .../src/Interfaces/index.js.map | 1 - .../src/ReactNativeManualDevicePlugin.d.ts | 43 --- .../src/ReactNativeManualDevicePlugin.js | 269 ------------------ .../src/ReactNativeManualDevicePlugin.js.map | 1 - .../src/ReactNativePlugin.d.ts | 5 - .../src/ReactNativePlugin.js | 17 -- .../src/ReactNativePlugin.js.map | 1 - .../src/index.d.ts | 7 - applicationinsights-react-native/src/index.js | 8 - .../src/index.js.map | 1 - .../src/manualIndex.d.ts | 4 - .../src/manualIndex.js | 5 - .../src/manualIndex.js.map | 1 - .../tsconfig.json | 5 +- 31 files changed, 3 insertions(+), 502 deletions(-) delete mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts delete mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js delete mode 100644 applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map delete mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts delete mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js delete mode 100644 applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js delete mode 100644 applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js delete mode 100644 applicationinsights-react-native/src/Interfaces/INativeDevice.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js delete mode 100644 applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map delete mode 100644 applicationinsights-react-native/src/Interfaces/index.d.ts delete mode 100644 applicationinsights-react-native/src/Interfaces/index.js delete mode 100644 applicationinsights-react-native/src/Interfaces/index.js.map delete mode 100644 applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts delete mode 100644 applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js delete mode 100644 applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map delete mode 100644 applicationinsights-react-native/src/ReactNativePlugin.d.ts delete mode 100644 applicationinsights-react-native/src/ReactNativePlugin.js delete mode 100644 applicationinsights-react-native/src/ReactNativePlugin.js.map delete mode 100644 applicationinsights-react-native/src/index.d.ts delete mode 100644 applicationinsights-react-native/src/index.js delete mode 100644 applicationinsights-react-native/src/index.js.map delete mode 100644 applicationinsights-react-native/src/manualIndex.d.ts delete mode 100644 applicationinsights-react-native/src/manualIndex.js delete mode 100644 applicationinsights-react-native/src/manualIndex.js.map diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts deleted file mode 100644 index 9076b37f..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; -export declare const DEVICE_MODEL = "model"; -export declare const DEVICE_TYPE = "type"; -export declare const UNIQUE_ID = "id"; -export declare class DeviceModule implements IDeviceInfoModule { - getModel: () => string; - getDeviceType: () => string; - getUniqueId: () => string | Promise; - constructor(); -} diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js deleted file mode 100644 index ee6be332..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import { objDefineAccessors } from "@microsoft/applicationinsights-core-js"; -export var DEVICE_MODEL = "model"; -export var DEVICE_TYPE = "type"; -export var UNIQUE_ID = "id"; -var DeviceModule = /** @class */ (function () { - function DeviceModule() { - var _self = this; - var _model = null; - var _deviceType = null; - var _uniqueId = null; - function _getModel() { - return _model; - } - function _getDeviceType() { - return _deviceType; - } - function _getUniqueId() { - return _uniqueId; - } - // Provide the public interface methods for accessing the values - _self.getModel = _getModel; - _self.getDeviceType = _getDeviceType; - _self.getUniqueId = _getUniqueId; - // Provide setters (for testing) and re-use the functions for minification - objDefineAccessors(_self, DEVICE_MODEL, _getModel, function (value) { return _model = value; }); - objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, function (value) { return _deviceType = value; }); - objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, function (value) { return _uniqueId = value; }); - } - return DeviceModule; -}()); -export { DeviceModule }; -//# sourceMappingURL=DeviceModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map b/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map deleted file mode 100644 index 57ee9813..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/DeviceModule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"DeviceModule.js","sourceRoot":"","sources":["DeviceModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,MAAM,CAAC,IAAM,YAAY,GAAG,OAAO,CAAC;AACpC,MAAM,CAAC,IAAM,WAAW,GAAG,MAAM,CAAC;AAClC,MAAM,CAAC,IAAM,SAAS,GAAG,IAAI,CAAC;AAE9B;IAKI;QACI,IAAI,KAAK,GAAG,IAAI,CAAC;QACjB,IAAI,MAAM,GAAW,IAAI,CAAC;QAC1B,IAAI,WAAW,GAAW,IAAI,CAAC;QAC/B,IAAI,SAAS,GAA6B,IAAI,CAAC;QAE/C,SAAS,SAAS;YACd,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,SAAS,cAAc;YACnB,OAAO,WAAW,CAAC;QACvB,CAAC;QAED,SAAS,YAAY;YACjB,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,gEAAgE;QAChE,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC3B,KAAK,CAAC,aAAa,GAAG,cAAc,CAAC;QACrC,KAAK,CAAC,WAAW,GAAG,YAAY,CAAA;QAEhC,0EAA0E;QAC1E,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAC,KAAK,IAAK,OAAA,MAAM,GAAG,KAAK,EAAd,CAAc,CAAC,CAAC;QAC9E,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,UAAC,KAAK,IAAK,OAAA,WAAW,GAAG,KAAK,EAAnB,CAAmB,CAAC,CAAC;QACvF,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAC,KAAK,IAAK,OAAA,SAAS,GAAG,KAAK,EAAjB,CAAiB,CAAC,CAAC;IACrF,CAAC;IACL,mBAAC;AAAD,CAAC,AAjCD,IAiCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { objDefineAccessors } from \"@microsoft/applicationinsights-core-js\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\nexport const DEVICE_MODEL = \"model\";\nexport const DEVICE_TYPE = \"type\";\nexport const UNIQUE_ID = \"id\";\n\nexport class DeviceModule implements IDeviceInfoModule {\n public getModel: () => string;\n public getDeviceType: () => string;\n public getUniqueId: () => string | Promise;\n\n constructor() {\n let _self = this;\n let _model: string = null;\n let _deviceType: string = null;\n let _uniqueId: string | Promise = null;\n\n function _getModel() {\n return _model;\n }\n\n function _getDeviceType() {\n return _deviceType;\n }\n\n function _getUniqueId() {\n return _uniqueId;\n }\n\n // Provide the public interface methods for accessing the values\n _self.getModel = _getModel;\n _self.getDeviceType = _getDeviceType;\n _self.getUniqueId = _getUniqueId\n\n // Provide setters (for testing) and re-use the functions for minification\n objDefineAccessors(_self, DEVICE_MODEL, _getModel, (value) => _model = value);\n objDefineAccessors(_self, DEVICE_TYPE, _getDeviceType, (value) => _deviceType = value);\n objDefineAccessors(_self, UNIQUE_ID, _getUniqueId, (value) => _uniqueId = value);\n }\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts deleted file mode 100644 index 84731ff9..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IDeviceInfoModule } from "../Interfaces/IDeviceInfoModule"; -/** - * Returns the "react-native-device-info" as the Device Info Module - * @returns - */ -export declare function getReactNativeDeviceInfo(): IDeviceInfoModule; diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js deleted file mode 100644 index 56f9cc87..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import DeviceInfo from "react-native-device-info"; -/** - * Returns the "react-native-device-info" as the Device Info Module - * @returns - */ -export function getReactNativeDeviceInfo() { - return DeviceInfo; -} -//# sourceMappingURL=ReactNativeDeviceInfo.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map b/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map deleted file mode 100644 index 87f6ff9e..00000000 --- a/applicationinsights-react-native/src/DeviceInfo/ReactNativeDeviceInfo.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ReactNativeDeviceInfo.js","sourceRoot":"","sources":["ReactNativeDeviceInfo.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAGlD;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACpC,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport DeviceInfo from \"react-native-device-info\";\nimport { IDeviceInfoModule } from \"../Interfaces/IDeviceInfoModule\";\n\n/**\n * Returns the \"react-native-device-info\" as the Device Info Module\n * @returns\n */\nexport function getReactNativeDeviceInfo(): IDeviceInfoModule {\n return DeviceInfo;\n}"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts deleted file mode 100644 index 3aaa3876..00000000 --- a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Interface to abstract how the plugin can access the Device Info, this is a stripped - * down version of the "react-native-device-info" interface and is mostly supplied for - * testing. - */ -export interface IDeviceInfoModule { - /** - * Returns the Device Model - */ - getModel: () => string; - /** - * Returns the device type - */ - getDeviceType: () => string; - /** - * Returns the unique Id for the device, to support both the current version and previous - * versions react-native-device-info, this may return either a `string` or `Promise`, - * when a promise is returned the plugin will "wait" for the promise to `resolve` or `reject` - * before processing any events. This WILL cause telemetry to be BLOCKED until either of these - * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve. - * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock - * event processing when this issue occurs. - */ - getUniqueId: () => Promise | string; -} diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js deleted file mode 100644 index c8a6d87f..00000000 --- a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -export {}; -//# sourceMappingURL=IDeviceInfoModule.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map b/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map deleted file mode 100644 index 0521d434..00000000 --- a/applicationinsights-react-native/src/Interfaces/IDeviceInfoModule.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IDeviceInfoModule.js","sourceRoot":"","sources":["IDeviceInfoModule.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * Interface to abstract how the plugin can access the Device Info, this is a stripped\n * down version of the \"react-native-device-info\" interface and is mostly supplied for\n * testing.\n */\nexport interface IDeviceInfoModule {\n /**\n * Returns the Device Model\n */\n getModel: () => string;\n\n /**\n * Returns the device type\n */\n getDeviceType: () => string;\n\n /**\n * Returns the unique Id for the device, to support both the current version and previous\n * versions react-native-device-info, this may return either a `string` or `Promise`,\n * when a promise is returned the plugin will \"wait\" for the promise to `resolve` or `reject`\n * before processing any events. This WILL cause telemetry to be BLOCKED until either of these\n * states, so when returning a Promise it MUST `resolve` or `reject` it can't just never resolve.\n * There is a default timeout configured via `uniqueIdPromiseTimeout` to automatically unblock\n * event processing when this issue occurs.\n */\n getUniqueId: () => Promise | string;\n}\n\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts b/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts deleted file mode 100644 index a7486c91..00000000 --- a/applicationinsights-react-native/src/Interfaces/INativeDevice.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface INativeDevice { - /** - * Device type, e.g. Handset, Tablet, Tv - */ - deviceClass?: string; - /** - * Unique installation ID - */ - id?: string; - /** - * The device model: iPhone XS Max, Galaxy S10, etc - */ - model?: string; -} diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js b/applicationinsights-react-native/src/Interfaces/INativeDevice.js deleted file mode 100644 index 980d412e..00000000 --- a/applicationinsights-react-native/src/Interfaces/INativeDevice.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -export {}; -//# sourceMappingURL=INativeDevice.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map b/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map deleted file mode 100644 index 7ff7ab10..00000000 --- a/applicationinsights-react-native/src/Interfaces/INativeDevice.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"INativeDevice.js","sourceRoot":"","sources":["INativeDevice.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nexport interface INativeDevice {\n /**\n * Device type, e.g. Handset, Tablet, Tv\n */\n deviceClass?: string;\n\n /**\n * Unique installation ID\n */\n id?: string;\n\n /**\n * The device model: iPhone XS Max, Galaxy S10, etc\n */\n model?: string;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts deleted file mode 100644 index c4d2e610..00000000 --- a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export interface IReactNativePluginConfig { - /** - * Disable automatic device collection - */ - disableDeviceCollection?: boolean; - /** - * Disable automatic exception collection - */ - disableExceptionCollection?: boolean; - /** - * Timeout value to unblock the processing of events if the DeviceInfoModule - * returns a Promise. - */ - uniqueIdPromiseTimeout?: number; -} diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js deleted file mode 100644 index 226f9ad3..00000000 --- a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=IReactNativePluginConfig.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map b/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map deleted file mode 100644 index 31ec78bc..00000000 --- a/applicationinsights-react-native/src/Interfaces/IReactNativePluginConfig.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IReactNativePluginConfig.js","sourceRoot":"","sources":["IReactNativePluginConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\nexport interface IReactNativePluginConfig {\n /**\n * Disable automatic device collection\n */\n disableDeviceCollection?: boolean;\n\n /**\n * Disable automatic exception collection\n */\n disableExceptionCollection?: boolean;\n\n /**\n * Timeout value to unblock the processing of events if the DeviceInfoModule\n * returns a Promise.\n */\n uniqueIdPromiseTimeout?: number;\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.d.ts b/applicationinsights-react-native/src/Interfaces/index.d.ts deleted file mode 100644 index 60cb8453..00000000 --- a/applicationinsights-react-native/src/Interfaces/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { INativeDevice } from "./INativeDevice"; -import { IReactNativePluginConfig } from "./IReactNativePluginConfig"; -export { INativeDevice, IReactNativePluginConfig }; diff --git a/applicationinsights-react-native/src/Interfaces/index.js b/applicationinsights-react-native/src/Interfaces/index.js deleted file mode 100644 index 3c19633e..00000000 --- a/applicationinsights-react-native/src/Interfaces/index.js +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -export {}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/Interfaces/index.js.map b/applicationinsights-react-native/src/Interfaces/index.js.map deleted file mode 100644 index 2ec4799a..00000000 --- a/applicationinsights-react-native/src/Interfaces/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { INativeDevice } from \"./INativeDevice\";\nimport { IReactNativePluginConfig } from \"./IReactNativePluginConfig\";\n\nexport { INativeDevice, IReactNativePluginConfig };\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts deleted file mode 100644 index 087af07d..00000000 --- a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { BaseTelemetryPlugin, IAppInsightsCore, IPlugin, IProcessTelemetryContext, ITelemetryItem, ITelemetryPlugin } from "@microsoft/applicationinsights-core-js"; -import { IReactNativePluginConfig } from "./Interfaces"; -import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; -export declare class ReactNativeManualDevicePlugin extends BaseTelemetryPlugin { - identifier: string; - priority: number; - _nextPlugin?: ITelemetryPlugin; - private _setExceptionHandler; - private _collectDeviceInfo; - constructor(config?: IReactNativePluginConfig); - protected getDeviceInfoModule(_deviceInfoModule: any): IDeviceInfoModule; - initialize(config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface - core?: IAppInsightsCore, extensions?: IPlugin[]): void; - processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void; - /** - * Set the module that will be used during initialization when collecting device is enabled - * (the default), automatic collection can be disabled via the `disableDeviceCollection` - * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown. - * @param deviceInfoModule - */ - setDeviceInfoModule(deviceInfoModule: IDeviceInfoModule): void; - /** - * Manually set the deviceId, if set before initialization and automatic device info collection - * is enabled this value may get overwritten. If you want to keep this value disable auto - * collection by setting the `disableDeviceCollection` config to true. - * @param newId - The value to use as the device Id. - */ - setDeviceId(newId: string): void; - /** - * Manually set the device model, if set before initialization and automatic device info - * collection is enabled this value may get overwritten. If you want to keep this value - * disable auto collection by setting the `disableDeviceCollection` config to true. - * @param newModel - The value to use as the device model. - */ - setDeviceModel(newModel: string): void; - /** - * Manually set the device type (class), if set before initialization and automatic device - * info collection is enabled this value may get overwritten. If you want to keep this value - * disable auto collection by setting the `disableDeviceCollection` config to true. - * @param newType - The value to use as the device type - */ - setDeviceType(newType: string): void; -} diff --git a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js deleted file mode 100644 index 4f8c4381..00000000 --- a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import { __extends } from "tslib"; -import dynamicProto from "@microsoft/dynamicproto-js"; -import { AnalyticsPluginIdentifier, eSeverityLevel } from "@microsoft/applicationinsights-common"; -import { BaseTelemetryPlugin, _eInternalMessageId, _throwInternal, _warnToConsole, arrForEach, dumpObj, eLoggingSeverity, getExceptionName, onConfigChange } from "@microsoft/applicationinsights-core-js"; -import { getGlobal, strShimUndefined } from "@microsoft/applicationinsights-shims"; -import { isPromiseLike, isString, objDeepFreeze, scheduleTimeout } from "@nevware21/ts-utils"; -var defaultReactNativePluginConfig = objDeepFreeze({ - disableDeviceCollection: false, - disableExceptionCollection: false, - uniqueIdPromiseTimeout: 5000 -}); -var ReactNativeManualDevicePlugin = /** @class */ (function (_super) { - __extends(ReactNativeManualDevicePlugin, _super); - function ReactNativeManualDevicePlugin(config) { - var _this = _super.call(this) || this; - _this.identifier = "AppInsightsReactNativePlugin"; - _this.priority = 140; - // Automatic defaults, don't set values here only set in _initDefaults() - var _device; - var _config; - var _analyticsPlugin; - var _defaultHandler; - var _waitingForId; - var _waitingTimer; - var _waitingItems = null; - var _deviceInfoModule; - var _deviceInfoNeedsUpdate; - var exceptionHandlerSet; - dynamicProto(ReactNativeManualDevicePlugin, _this, function (_self, _base) { - _initDefaults(); - _self.initialize = function (config, // need `| object` to coerce to interface - core, extensions) { - var identifier = _this.identifier; - if (!_self.isInitialized()) { - _base.initialize(config, core, extensions); - _self._addHook(onConfigChange(config, function (details) { - var _a; - var ctx = _self._getTelCtx(); - _config = ctx.getExtCfg(identifier, defaultReactNativePluginConfig); - if (!_config.disableDeviceCollection && _deviceInfoNeedsUpdate) { - _deviceInfoNeedsUpdate = !_self._collectDeviceInfo(); - } - if (core && core.getPlugin) { - _analyticsPlugin = (_a = core.getPlugin(AnalyticsPluginIdentifier)) === null || _a === void 0 ? void 0 : _a.plugin; - } - else { - _analyticsPlugin = null; - } - if (exceptionHandlerSet) { - _resetGlobalErrorHandler(); - } - if (!_config.disableExceptionCollection) { - _self._setExceptionHandler(); - exceptionHandlerSet = true; - } - })); - } - }; - _self.processTelemetry = function (item, itemCtx) { - if (!_waitingForId) { - _applyDeviceContext(item); - _self.processNext(item, itemCtx); - } - else { - // Make sure we have an array for the waiting items - _waitingItems = _waitingItems || []; - _waitingItems.push({ - item: item, - itemCtx: itemCtx - }); - } - }; - _self.setDeviceInfoModule = function (deviceInfoModule) { - // Set the configured deviceInfoModule - _deviceInfoModule = deviceInfoModule; - _deviceInfoNeedsUpdate = true; - }; - _self.setDeviceId = _setDeviceId; - _self.setDeviceModel = function (newModel) { - _device.model = newModel; - }; - _self.setDeviceType = function (newType) { - _device.deviceClass = newType; - }; - /** - * Automatically collects native device info for this device - */ - _self._collectDeviceInfo = function () { - try { - _deviceInfoModule = _this.getDeviceInfoModule(_deviceInfoModule); - if (!_deviceInfoModule) { - return false; - } - _device.deviceClass = _deviceInfoModule.getDeviceType(); - _device.model = _deviceInfoModule.getModel(); - var uniqueId = _deviceInfoModule.getUniqueId(); // Installation ID support different versions which return a promise vs string - if (isPromiseLike(uniqueId)) { - _waitingForId = true; - if (_waitingTimer) { - _waitingTimer.cancel(); - } - _waitingTimer = scheduleTimeout(function () { - _waitingTimer = null; - _setDeviceId(_device.id); - }, 0); - _waitingTimer.unref(); - uniqueId.then(function (value) { - _setDeviceId(value); - }, function (reason) { - _warnToConsole(_self.diagLog(), "Failed to get device id: " + dumpObj(reason)); - // Just reuse the existing id (if any) - _setDeviceId(_device.id); - }); - } - else if (isString(uniqueId)) { - _device.id = uniqueId; - } - return true; - } - catch (e) { - _warnToConsole(_self.diagLog(), "Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj(e)); - } - }; - _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) { - _resetGlobalErrorHandler(); - _initDefaults(); - }; - function _initDefaults() { - _device = {}; - _config = {}; - _analyticsPlugin = null; - _defaultHandler = null; - _waitingForId = false; - _deviceInfoModule = null; - _deviceInfoNeedsUpdate = true; - exceptionHandlerSet = false; - } - function _setDeviceId(newId) { - _device.id = newId; - _waitingForId = false; - if (_waitingTimer) { - _waitingTimer.cancel(); - } - if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) { - var items = _waitingItems; - _waitingItems = null; - arrForEach(items, function (value) { - try { - _self.processTelemetry(value.item, value.itemCtx); - } - catch (e) { - // Just ignore - } - }); - } - } - function _applyDeviceContext(item) { - if (_device) { - item.ext = item.ext || {}; - item.ext.device = item.ext.device || {}; - if (isString(_device.id)) { - item.ext.device.localId = _device.id; - } - if (isString(_device.model)) { - item.ext.device.model = _device.model; - } - if (isString(_device.deviceClass)) { - item.ext.device.deviceClass = _device.deviceClass; - } - } - } - function _getGlobal() { - if (typeof global !== strShimUndefined && global) { - return global; - } - return getGlobal(); - } - _self._setExceptionHandler = function () { - var _global = _getGlobal(); - if (_global && _global.ErrorUtils) { - // intercept react-native error handling - _defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === "function" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler; - _global.ErrorUtils.setGlobalHandler(_trackException); - } - }; - function _resetGlobalErrorHandler() { - var _global = _getGlobal(); - if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) { - _global.ErrorUtils.setGlobalHandler(_defaultHandler || null); - } - } - // default global error handler syntax: handleError(e, isFatal) - function _trackException(e, isFatal) { - var exception = { exception: e, severityLevel: eSeverityLevel.Error }; - if (_analyticsPlugin) { - _analyticsPlugin.trackException(exception); - } - else { - _throwInternal(_self.diagLog(), eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, ReactNative plugin telemetry will not be sent: "); - } - // call the _defaultHandler - react native also gets the error - if (_defaultHandler) { - _defaultHandler.call(global, e, isFatal); - } - } - // Test Hooks - _self._config = _config; - _self._getDbgPlgTargets = function () { - return [_device, _deviceInfoModule, _config]; - }; - }); - return _this; - } - ReactNativeManualDevicePlugin.prototype.getDeviceInfoModule = function (_deviceInfoModule) { - if (!_deviceInfoModule) { - _warnToConsole(this.diagLog(), "Failed to get DeviceInfo. Provide DeviceInfo while init or turn it off by setting disableDeviceCollection flag to true"); - return null; - } - return _deviceInfoModule; - }; - ReactNativeManualDevicePlugin.prototype.initialize = function (config, // need `| object` to coerce to interface - core, extensions) { - // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging - }; - ReactNativeManualDevicePlugin.prototype.processTelemetry = function (env, itemCtx) { - // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging - }; - /** - * Set the module that will be used during initialization when collecting device is enabled - * (the default), automatic collection can be disabled via the `disableDeviceCollection` - * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown. - * @param deviceInfoModule - */ - ReactNativeManualDevicePlugin.prototype.setDeviceInfoModule = function (deviceInfoModule) { - // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging - }; - /** - * Manually set the deviceId, if set before initialization and automatic device info collection - * is enabled this value may get overwritten. If you want to keep this value disable auto - * collection by setting the `disableDeviceCollection` config to true. - * @param newId - The value to use as the device Id. - */ - ReactNativeManualDevicePlugin.prototype.setDeviceId = function (newId) { - // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging - }; - /** - * Manually set the device model, if set before initialization and automatic device info - * collection is enabled this value may get overwritten. If you want to keep this value - * disable auto collection by setting the `disableDeviceCollection` config to true. - * @param newModel - The value to use as the device model. - */ - ReactNativeManualDevicePlugin.prototype.setDeviceModel = function (newModel) { - // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging - }; - /** - * Manually set the device type (class), if set before initialization and automatic device - * info collection is enabled this value may get overwritten. If you want to keep this value - * disable auto collection by setting the `disableDeviceCollection` config to true. - * @param newType - The value to use as the device type - */ - ReactNativeManualDevicePlugin.prototype.setDeviceType = function (newType) { - // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging - }; - return ReactNativeManualDevicePlugin; -}(BaseTelemetryPlugin)); -export { ReactNativeManualDevicePlugin }; -//# sourceMappingURL=ReactNativeManualDevicePlugin.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map b/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map deleted file mode 100644 index eb75ae58..00000000 --- a/applicationinsights-react-native/src/ReactNativeManualDevicePlugin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ReactNativeManualDevicePlugin.js","sourceRoot":"","sources":["ReactNativeManualDevicePlugin.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;;AAElC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,EACH,yBAAyB,EAA8C,cAAc,EACxF,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,mBAAmB,EACsB,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EACnI,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;QACzC,YAAA,MAAK,WAAE,SAAC;QAR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,CAAC;IAEM,kDAAU,GAAjB,UACI,MAA0C,EAAE,yCAAyC;IACrF,IAAuB,EACvB,UAAsB;QAEtB,oFAAoF;IACxF,CAAC;IAEM,wDAAgB,GAAvB,UAAwB,GAAmB,EAAE,OAAkC;QAC3E,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,2DAAmB,GAA1B,UAA2B,gBAAmC;QAC1D,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,mDAAW,GAAlB,UAAmB,KAAa;QAC5B,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,sDAAc,GAArB,UAAsB,QAAgB;QAClC,oFAAoF;IACxF,CAAC;IAED;;;;;OAKG;IACI,qDAAa,GAApB,UAAqB,OAAe;QAChC,oFAAoF;IACxF,CAAC;IACL,oCAAC;AAAD,CAAC,AAtSD,CAAmD,mBAAmB,GAsSrE","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\nimport {\n AnalyticsPluginIdentifier, IAppInsights, IDevice, IExceptionTelemetry, eSeverityLevel\n} from \"@microsoft/applicationinsights-common\";\nimport {\n BaseTelemetryPlugin, IAppInsightsCore, IConfigDefaults, IPlugin, IProcessTelemetryContext, IProcessTelemetryUnloadContext, ITelemetryItem,\n ITelemetryPlugin, ITelemetryUnloadState, _eInternalMessageId, _throwInternal, _warnToConsole, arrForEach, dumpObj, eLoggingSeverity,\n getExceptionName, onConfigChange\n} from \"@microsoft/applicationinsights-core-js\";\nimport { getGlobal, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\nimport { isPromiseLike, isString, ITimerHandler, objDeepFreeze, scheduleTimeout } from \"@nevware21/ts-utils\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\n\ndeclare var global: Window;\nconst defaultReactNativePluginConfig: IConfigDefaults = objDeepFreeze({\n disableDeviceCollection: false,\n disableExceptionCollection: false,\n uniqueIdPromiseTimeout: 5000\n});\n\nexport class ReactNativeManualDevicePlugin extends BaseTelemetryPlugin {\n\n identifier: string = \"AppInsightsReactNativePlugin\";\n priority: number = 140;\n _nextPlugin?: ITelemetryPlugin;\n\n private _setExceptionHandler: () => void;\n private _collectDeviceInfo: () => boolean;\n\n constructor(config?: IReactNativePluginConfig) {\n super();\n\n // Automatic defaults, don't set values here only set in _initDefaults()\n let _device: INativeDevice;\n let _config: IReactNativePluginConfig;\n let _analyticsPlugin: IAppInsights;\n let _defaultHandler;\n let _waitingForId: boolean;\n let _waitingTimer: ITimerHandler;\n let _waitingItems: { item: ITelemetryItem, itemCtx?: IProcessTelemetryContext }[] = null;\n let _deviceInfoModule: IDeviceInfoModule;\n \n let _deviceInfoNeedsUpdate:boolean;\n let exceptionHandlerSet:boolean;\n \n dynamicProto(ReactNativeManualDevicePlugin, this, (_self, _base) => {\n _initDefaults();\n\n _self.initialize = (\n config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface\n core?: IAppInsightsCore,\n extensions?: IPlugin[]\n ) => {\n let identifier = this.identifier;\n if (!_self.isInitialized()) {\n _base.initialize(config, core, extensions);\n\n _self._addHook(onConfigChange(config, (details) => {\n let ctx = _self._getTelCtx();\n _config = ctx.getExtCfg(identifier, defaultReactNativePluginConfig);\n\n if (!_config.disableDeviceCollection && _deviceInfoNeedsUpdate) {\n _deviceInfoNeedsUpdate = !_self._collectDeviceInfo();\n }\n \n if (core && core.getPlugin) {\n _analyticsPlugin = core.getPlugin(AnalyticsPluginIdentifier)?.plugin as IAppInsights;\n } else {\n _analyticsPlugin = null;\n }\n\n if (exceptionHandlerSet){\n _resetGlobalErrorHandler();\n }\n \n if (!_config.disableExceptionCollection) {\n _self._setExceptionHandler();\n exceptionHandlerSet = true;\n }\n }));\n }\n };\n\n\n _self.processTelemetry = (item: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => {\n if (!_waitingForId) {\n _applyDeviceContext(item);\n _self.processNext(item, itemCtx);\n } else {\n // Make sure we have an array for the waiting items\n _waitingItems = _waitingItems || [];\n _waitingItems.push({\n item,\n itemCtx\n });\n }\n };\n \n _self.setDeviceInfoModule = (deviceInfoModule: IDeviceInfoModule) => {\n // Set the configured deviceInfoModule\n _deviceInfoModule = deviceInfoModule;\n _deviceInfoNeedsUpdate = true;\n };\n\n _self.setDeviceId =_setDeviceId;\n \n _self.setDeviceModel = (newModel: string) => {\n _device.model = newModel;\n };\n \n _self.setDeviceType = (newType: string) => {\n _device.deviceClass = newType;\n };\n \n /**\n * Automatically collects native device info for this device\n */\n _self._collectDeviceInfo = () : boolean => {\n try {\n _deviceInfoModule = this.getDeviceInfoModule(_deviceInfoModule);\n if (!_deviceInfoModule) {\n return false;\n }\n _device.deviceClass = _deviceInfoModule.getDeviceType();\n _device.model = _deviceInfoModule.getModel();\n let uniqueId = _deviceInfoModule.getUniqueId(); // Installation ID support different versions which return a promise vs string\n if (isPromiseLike(uniqueId)) {\n _waitingForId = true;\n if (_waitingTimer) {\n _waitingTimer.cancel();\n }\n _waitingTimer = scheduleTimeout(() => {\n _waitingTimer = null;\n _setDeviceId(_device.id);\n }, 0);\n _waitingTimer.unref();\n uniqueId.then((value) => {\n _setDeviceId(value);\n }, (reason) => {\n _warnToConsole(_self.diagLog(), \"Failed to get device id: \" + dumpObj(reason));\n // Just reuse the existing id (if any)\n _setDeviceId(_device.id);\n });\n } else if (isString(uniqueId)) {\n _device.id = uniqueId;\n }\n return true;\n } catch (e) {\n _warnToConsole(_self.diagLog(), \"Failed to get DeviceInfo: \" + getExceptionName(e) + \" - \" + dumpObj(e));\n }\n }\n\n _self._doTeardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void): void | boolean => {\n _resetGlobalErrorHandler();\n _initDefaults();\n };\n\n function _initDefaults() {\n _device = {};\n _config = {};\n _analyticsPlugin = null;\n _defaultHandler = null;\n _waitingForId = false;\n _deviceInfoModule = null;\n _deviceInfoNeedsUpdate = true;\n exceptionHandlerSet = false;\n }\n\n \n\n function _setDeviceId(newId: string) {\n _device.id = newId;\n _waitingForId = false;\n if (_waitingTimer) {\n _waitingTimer.cancel();\n }\n\n if (!_waitingForId && _waitingItems && _waitingItems.length > 0 && _self.isInitialized()) {\n let items = _waitingItems;\n _waitingItems = null;\n arrForEach(items, (value) => {\n try {\n _self.processTelemetry(value.item, value.itemCtx);\n } catch (e) {\n // Just ignore\n }\n });\n }\n }\n\n function _applyDeviceContext(item: ITelemetryItem) {\n if (_device) {\n item.ext = item.ext || {};\n item.ext.device = item.ext.device || ({} as IDevice);\n if (isString(_device.id)) {\n item.ext.device.localId = _device.id;\n }\n if (isString(_device.model)) {\n item.ext.device.model = _device.model;\n }\n if (isString(_device.deviceClass)) {\n item.ext.device.deviceClass = _device.deviceClass;\n }\n }\n }\n\n function _getGlobal(): any {\n if (typeof global !== strShimUndefined && global) {\n return global as any;\n }\n\n return getGlobal() as any;\n }\n\n _self._setExceptionHandler = () => {\n const _global = _getGlobal();\n if (_global && _global.ErrorUtils) {\n // intercept react-native error handling\n _defaultHandler = (typeof _global.ErrorUtils.getGlobalHandler === \"function\" && _global.ErrorUtils.getGlobalHandler()) || _global.ErrorUtils._globalHandler;\n _global.ErrorUtils.setGlobalHandler(_trackException);\n }\n }\n\n function _resetGlobalErrorHandler() {\n const _global = _getGlobal();\n if (_global && _global.ErrorUtils && _global.ErrorUtils.getGlobalHandler() === _trackException) {\n _global.ErrorUtils.setGlobalHandler(_defaultHandler || null);\n }\n }\n\n // default global error handler syntax: handleError(e, isFatal)\n function _trackException(e, isFatal) {\n const exception: IExceptionTelemetry = { exception: e, severityLevel: eSeverityLevel.Error };\n\n if (_analyticsPlugin) {\n _analyticsPlugin.trackException(exception);\n } else {\n _throwInternal(_self.diagLog(),\n eLoggingSeverity.CRITICAL, _eInternalMessageId.TelemetryInitializerFailed, \"Analytics plugin is not available, ReactNative plugin telemetry will not be sent: \");\n }\n\n // call the _defaultHandler - react native also gets the error\n if (_defaultHandler) {\n _defaultHandler.call(global, e, isFatal);\n }\n }\n\n // Test Hooks\n (_self as any)._config = _config;\n (_self as any)._getDbgPlgTargets = () => {\n return [_device, _deviceInfoModule, _config];\n }\n });\n }\n\n protected getDeviceInfoModule(_deviceInfoModule): IDeviceInfoModule {\n if (!_deviceInfoModule) {\n _warnToConsole(this.diagLog(), \"Failed to get DeviceInfo. Provide DeviceInfo while init or turn it off by setting disableDeviceCollection flag to true\");\n return null;\n }\n return _deviceInfoModule;\n }\n\n public initialize(\n config?: IReactNativePluginConfig | object, // need `| object` to coerce to interface\n core?: IAppInsightsCore,\n extensions?: IPlugin[]) {\n\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n public processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Set the module that will be used during initialization when collecting device is enabled\n * (the default), automatic collection can be disabled via the `disableDeviceCollection`\n * config. If no `deviceInfoModule` is set and collection is enabled, an error will be thrown.\n * @param deviceInfoModule\n */\n public setDeviceInfoModule(deviceInfoModule: IDeviceInfoModule) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Manually set the deviceId, if set before initialization and automatic device info collection\n * is enabled this value may get overwritten. If you want to keep this value disable auto\n * collection by setting the `disableDeviceCollection` config to true.\n * @param newId - The value to use as the device Id.\n */\n public setDeviceId(newId: string) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Manually set the device model, if set before initialization and automatic device info\n * collection is enabled this value may get overwritten. If you want to keep this value\n * disable auto collection by setting the `disableDeviceCollection` config to true.\n * @param newModel - The value to use as the device model.\n */\n public setDeviceModel(newModel: string) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n\n /**\n * Manually set the device type (class), if set before initialization and automatic device\n * info collection is enabled this value may get overwritten. If you want to keep this value\n * disable auto collection by setting the `disableDeviceCollection` config to true.\n * @param newType - The value to use as the device type\n */\n public setDeviceType(newType: string) {\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\n }\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativePlugin.d.ts b/applicationinsights-react-native/src/ReactNativePlugin.d.ts deleted file mode 100644 index 1e754845..00000000 --- a/applicationinsights-react-native/src/ReactNativePlugin.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; -import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; -export declare class ReactNativePlugin extends ReactNativeManualDevicePlugin { - protected getDeviceInfoModule(_deviceInfoModule: any): IDeviceInfoModule; -} diff --git a/applicationinsights-react-native/src/ReactNativePlugin.js b/applicationinsights-react-native/src/ReactNativePlugin.js deleted file mode 100644 index 1a158902..00000000 --- a/applicationinsights-react-native/src/ReactNativePlugin.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import { __extends } from "tslib"; -import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo"; -import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; -var ReactNativePlugin = /** @class */ (function (_super) { - __extends(ReactNativePlugin, _super); - function ReactNativePlugin() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReactNativePlugin.prototype.getDeviceInfoModule = function (_deviceInfoModule) { - return _deviceInfoModule || getReactNativeDeviceInfo(); - }; - return ReactNativePlugin; -}(ReactNativeManualDevicePlugin)); -export { ReactNativePlugin }; -//# sourceMappingURL=ReactNativePlugin.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/ReactNativePlugin.js.map b/applicationinsights-react-native/src/ReactNativePlugin.js.map deleted file mode 100644 index 381dacc3..00000000 --- a/applicationinsights-react-native/src/ReactNativePlugin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ReactNativePlugin.js","sourceRoot":"","sources":["ReactNativePlugin.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF;IAAuC,qCAA6B;IAApE;;IAIA,CAAC;IAHa,+CAAmB,GAA7B,UAA8B,iBAAiB;QAC3C,OAAO,iBAAiB,IAAI,wBAAwB,EAAE,CAAC;IAC3D,CAAC;IACL,wBAAC;AAAD,CAAC,AAJD,CAAuC,6BAA6B,GAInE","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n\nimport { getReactNativeDeviceInfo } from \"./DeviceInfo/ReactNativeDeviceInfo\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\n\n\nexport class ReactNativePlugin extends ReactNativeManualDevicePlugin {\n protected getDeviceInfoModule(_deviceInfoModule): IDeviceInfoModule {\n return _deviceInfoModule || getReactNativeDeviceInfo();\n }\n}\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/index.d.ts b/applicationinsights-react-native/src/index.d.ts deleted file mode 100644 index 377b491d..00000000 --- a/applicationinsights-react-native/src/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ReactNativePlugin } from "./ReactNativePlugin"; -import { INativeDevice, IReactNativePluginConfig } from "./Interfaces"; -import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; -import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo"; -import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; -export { ReactNativePlugin, ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule }; -export { getReactNativeDeviceInfo }; diff --git a/applicationinsights-react-native/src/index.js b/applicationinsights-react-native/src/index.js deleted file mode 100644 index f7ea1169..00000000 --- a/applicationinsights-react-native/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import { ReactNativePlugin } from "./ReactNativePlugin"; -import { getReactNativeDeviceInfo } from "./DeviceInfo/ReactNativeDeviceInfo"; -import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; -export { ReactNativePlugin, ReactNativeManualDevicePlugin }; -export { getReactNativeDeviceInfo }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/index.js.map b/applicationinsights-react-native/src/index.js.map deleted file mode 100644 index 2e7b28ff..00000000 --- a/applicationinsights-react-native/src/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAA8D,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport { ReactNativePlugin } from \"./ReactNativePlugin\";\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\nimport { getReactNativeDeviceInfo } from \"./DeviceInfo/ReactNativeDeviceInfo\";\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\n\nexport { ReactNativePlugin, ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule };\nexport { getReactNativeDeviceInfo };\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/src/manualIndex.d.ts b/applicationinsights-react-native/src/manualIndex.d.ts deleted file mode 100644 index e8267008..00000000 --- a/applicationinsights-react-native/src/manualIndex.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { INativeDevice, IReactNativePluginConfig } from "./Interfaces"; -import { IDeviceInfoModule } from "./Interfaces/IDeviceInfoModule"; -import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; -export { ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule }; diff --git a/applicationinsights-react-native/src/manualIndex.js b/applicationinsights-react-native/src/manualIndex.js deleted file mode 100644 index 50276e89..00000000 --- a/applicationinsights-react-native/src/manualIndex.js +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -import { ReactNativeManualDevicePlugin } from "./ReactNativeManualDevicePlugin"; -export { ReactNativeManualDevicePlugin }; -//# sourceMappingURL=manualIndex.js.map \ No newline at end of file diff --git a/applicationinsights-react-native/src/manualIndex.js.map b/applicationinsights-react-native/src/manualIndex.js.map deleted file mode 100644 index a7417baa..00000000 --- a/applicationinsights-react-native/src/manualIndex.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"manualIndex.js","sourceRoot":"","sources":["manualIndex.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAKlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,6BAA6B,EAA8D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n\nimport { INativeDevice, IReactNativePluginConfig } from \"./Interfaces\";\nimport { IDeviceInfoModule } from \"./Interfaces/IDeviceInfoModule\";\nimport { ReactNativeManualDevicePlugin } from \"./ReactNativeManualDevicePlugin\";\n\nexport { ReactNativeManualDevicePlugin, INativeDevice, IReactNativePluginConfig, IDeviceInfoModule };\n\n"]} \ No newline at end of file diff --git a/applicationinsights-react-native/tsconfig.json b/applicationinsights-react-native/tsconfig.json index 9744eb56..4e17aeeb 100644 --- a/applicationinsights-react-native/tsconfig.json +++ b/applicationinsights-react-native/tsconfig.json @@ -7,14 +7,15 @@ "moduleResolution": "Node", "target": "es5", "alwaysStrict": true, + "suppressImplicitAnyIndexErrors": true, "allowSyntheticDefaultImports": true, "importHelpers": true, "noEmitHelpers": true, "forceConsistentCasingInFileNames": true, "declaration": true, - "declarationDir": "types", + "declarationDir": "applicationinsights-react-native/types", "outDir": "dist-esm", - "rootDir": "src" + "rootDir": "applicationinsights-react-native/src" }, "include": [ "./src/**/*.ts" From 346d2a27cd197fe9f8bf7a2aa5fcb5d60122db75 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Jul 2025 23:34:35 +0000 Subject: [PATCH 7/7] Remove ./dist-esm/manualIndex export entry as requested Co-authored-by: Karlie-777 <79606506+Karlie-777@users.noreply.github.com> --- applicationinsights-react-native/package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/applicationinsights-react-native/package.json b/applicationinsights-react-native/package.json index 60d41c4d..7060619d 100644 --- a/applicationinsights-react-native/package.json +++ b/applicationinsights-react-native/package.json @@ -13,11 +13,6 @@ "types": "./types/manualIndex.d.ts", "import": "./dist-esm/manualIndex.js", "require": "./dist/applicationinsights-react-native.js" - }, - "./dist-esm/manualIndex": { - "types": "./types/manualIndex.d.ts", - "import": "./dist-esm/manualIndex.js", - "require": "./dist/applicationinsights-react-native.js" } }, "types": "types/index.d.ts",