@equinor/mad-insights 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/AppInsightsInitializer.js +3 -3
- package/dist/appInsights.d.ts +2 -0
- package/dist/appInsights.js +5 -1
- package/dist/chunk-U4QWRA5T.js +22 -0
- package/dist/{chunk-PGH7K4VG.js → chunk-UYNEMCKF.js} +1 -1
- package/dist/{chunk-PHO4BZGR.js → chunk-Z7EMW7JA.js} +34 -3
- package/dist/index.js +7 -3
- package/dist/useAppInsights.d.ts +2 -2
- package/dist/useAppInsights.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-UDTSFJ3J.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @equinor/mad-insights
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2b06c85: Add opt-out option for App Insights logging through @equinor/mad-core
|
|
8
|
+
- 411860f: Toast message bug fix along with other minor fixes
|
|
9
|
+
|
|
10
|
+
## 0.3.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- a6263b0: Minor UI bug fixes - SafeAreaView adding additional padding with banners
|
|
15
|
+
|
|
3
16
|
## 0.3.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppInsightsInitializer
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-UYNEMCKF.js";
|
|
4
|
+
import "./chunk-U4QWRA5T.js";
|
|
5
|
+
import "./chunk-Z7EMW7JA.js";
|
|
6
6
|
import "./chunk-HBTKADNX.js";
|
|
7
7
|
export {
|
|
8
8
|
AppInsightsInitializer
|
package/dist/appInsights.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ declare let reactPluginWeb: ReactPlugin;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const appInsightsInit: (config: AppInsightsInitConfig) => void;
|
|
15
15
|
export declare const appInsightsHasBeenInitialized: () => boolean;
|
|
16
|
+
export declare const enableInsights: () => void;
|
|
17
|
+
export declare const disableInsights: () => void;
|
|
16
18
|
export declare const validateAppInsightsInit: () => void;
|
|
17
19
|
export declare const setUsername: (username: string, userIdentifier: string | undefined) => void;
|
|
18
20
|
/**
|
package/dist/appInsights.js
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
appInsightsLongTermLog,
|
|
6
6
|
appInsightsMain,
|
|
7
7
|
appStateStatus,
|
|
8
|
+
disableInsights,
|
|
9
|
+
enableInsights,
|
|
8
10
|
handleAppStatusChange,
|
|
9
11
|
metricKeys,
|
|
10
12
|
metricStatus,
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
trackNavigation,
|
|
17
19
|
trackShortTerm,
|
|
18
20
|
validateAppInsightsInit
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-Z7EMW7JA.js";
|
|
20
22
|
import "./chunk-HBTKADNX.js";
|
|
21
23
|
export {
|
|
22
24
|
addTelemetryInitializer,
|
|
@@ -25,6 +27,8 @@ export {
|
|
|
25
27
|
appInsightsLongTermLog,
|
|
26
28
|
appInsightsMain,
|
|
27
29
|
appStateStatus,
|
|
30
|
+
disableInsights,
|
|
31
|
+
enableInsights,
|
|
28
32
|
handleAppStatusChange,
|
|
29
33
|
metricKeys,
|
|
30
34
|
metricStatus,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appInsightsInit
|
|
3
|
+
} from "./chunk-Z7EMW7JA.js";
|
|
4
|
+
|
|
5
|
+
// src/useAppInsights.ts
|
|
6
|
+
import { useEffect } from "react";
|
|
7
|
+
var useAppInsights = (config) => {
|
|
8
|
+
var _a, _b, _c;
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
appInsightsInit(config);
|
|
11
|
+
}, [
|
|
12
|
+
config.connectionString,
|
|
13
|
+
config.instrumentationKey,
|
|
14
|
+
(_a = config.longTermLog) == null ? void 0 : _a.connectionString,
|
|
15
|
+
(_b = config.longTermLog) == null ? void 0 : _b.instrumentationKey,
|
|
16
|
+
(_c = config.longTermLog) == null ? void 0 : _c.useSHA1
|
|
17
|
+
]);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
useAppInsights
|
|
22
|
+
};
|
|
@@ -13,16 +13,19 @@ import { Platform } from "react-native";
|
|
|
13
13
|
var appInsightsMain;
|
|
14
14
|
var appInsightsLongTermLog;
|
|
15
15
|
var hasBeenInitialized = false;
|
|
16
|
+
var isDisabled = false;
|
|
16
17
|
var reactPluginWeb;
|
|
17
18
|
var useSHA1;
|
|
18
19
|
var envelopeBacklog = [];
|
|
19
20
|
var trackShortTermBacklog = [];
|
|
20
21
|
var trackLongTermBacklog = [];
|
|
22
|
+
var pendingSetUsername;
|
|
21
23
|
var appInsightsInit = (config) => {
|
|
22
24
|
var _a, _b;
|
|
23
25
|
const { connectionString, instrumentationKey } = config;
|
|
24
|
-
|
|
26
|
+
enableInsights();
|
|
25
27
|
if (hasBeenInitialized) return;
|
|
28
|
+
useSHA1 = (_b = (_a = config.longTermLog) == null ? void 0 : _a.useSHA1) != null ? _b : false;
|
|
26
29
|
hasBeenInitialized = true;
|
|
27
30
|
if (Platform.OS === "web") {
|
|
28
31
|
const browserHistory = createBrowserHistory();
|
|
@@ -76,12 +79,31 @@ var appInsightsInit = (config) => {
|
|
|
76
79
|
}
|
|
77
80
|
appInsightsMain.loadAppInsights();
|
|
78
81
|
}
|
|
82
|
+
if (pendingSetUsername) {
|
|
83
|
+
const { username, userIdentifier } = pendingSetUsername;
|
|
84
|
+
pendingSetUsername = void 0;
|
|
85
|
+
setUsername(username, userIdentifier);
|
|
86
|
+
}
|
|
79
87
|
envelopeBacklog.forEach(addTelemetryInitializer);
|
|
80
88
|
trackShortTermBacklog.forEach((item) => trackEvent(item.event, item.customProperties));
|
|
81
89
|
trackLongTermBacklog.forEach((item) => trackEventLongTerm(item.event, item.customProperties));
|
|
82
90
|
void track("Application STARTED" /* APP_STARTED */);
|
|
83
91
|
};
|
|
84
92
|
var appInsightsHasBeenInitialized = () => hasBeenInitialized;
|
|
93
|
+
var enableInsights = () => {
|
|
94
|
+
isDisabled = false;
|
|
95
|
+
if (appInsightsMain) appInsightsMain.config.disableTelemetry = false;
|
|
96
|
+
if (appInsightsLongTermLog) appInsightsLongTermLog.config.disableTelemetry = false;
|
|
97
|
+
};
|
|
98
|
+
var disableInsights = () => {
|
|
99
|
+
isDisabled = true;
|
|
100
|
+
if (appInsightsMain) appInsightsMain.config.disableTelemetry = true;
|
|
101
|
+
if (appInsightsLongTermLog) appInsightsLongTermLog.config.disableTelemetry = true;
|
|
102
|
+
envelopeBacklog.length = 0;
|
|
103
|
+
trackShortTermBacklog.length = 0;
|
|
104
|
+
trackLongTermBacklog.length = 0;
|
|
105
|
+
pendingSetUsername = void 0;
|
|
106
|
+
};
|
|
85
107
|
var validateAppInsightsInit = () => {
|
|
86
108
|
if (!appInsightsMain) {
|
|
87
109
|
throw new Error(
|
|
@@ -90,7 +112,11 @@ var validateAppInsightsInit = () => {
|
|
|
90
112
|
}
|
|
91
113
|
};
|
|
92
114
|
var setUsername = (username, userIdentifier) => {
|
|
93
|
-
|
|
115
|
+
if (isDisabled) return;
|
|
116
|
+
if (!appInsightsMain) {
|
|
117
|
+
pendingSetUsername = { username, userIdentifier };
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
94
120
|
appInsightsMain.setAuthenticatedUserContext(username, userIdentifier, true);
|
|
95
121
|
if (appInsightsLongTermLog) {
|
|
96
122
|
const obfuscatedUserName = obfuscateUser(userIdentifier != null ? userIdentifier : "", username, useSHA1).id;
|
|
@@ -103,6 +129,7 @@ var setUsername = (username, userIdentifier) => {
|
|
|
103
129
|
}
|
|
104
130
|
};
|
|
105
131
|
var trackEvent = (event, customProperties) => {
|
|
132
|
+
if (isDisabled) return;
|
|
106
133
|
if (!appInsightsMain) {
|
|
107
134
|
trackShortTermBacklog.push({ event, customProperties });
|
|
108
135
|
return;
|
|
@@ -110,6 +137,7 @@ var trackEvent = (event, customProperties) => {
|
|
|
110
137
|
appInsightsMain.trackEvent(event, customProperties);
|
|
111
138
|
};
|
|
112
139
|
var trackEventLongTerm = (event, customProperties) => {
|
|
140
|
+
if (isDisabled) return;
|
|
113
141
|
if (!appInsightsLongTermLog) {
|
|
114
142
|
trackLongTermBacklog.push({ event, customProperties });
|
|
115
143
|
return;
|
|
@@ -125,7 +153,8 @@ var track = (eventName, eventStatus, extraText, extraData) => {
|
|
|
125
153
|
}
|
|
126
154
|
};
|
|
127
155
|
var addTelemetryInitializer = (envelope) => {
|
|
128
|
-
if (
|
|
156
|
+
if (isDisabled) return;
|
|
157
|
+
if (!appInsightsMain) {
|
|
129
158
|
envelopeBacklog.push(envelope);
|
|
130
159
|
return;
|
|
131
160
|
}
|
|
@@ -197,6 +226,8 @@ export {
|
|
|
197
226
|
reactPluginWeb,
|
|
198
227
|
appInsightsInit,
|
|
199
228
|
appInsightsHasBeenInitialized,
|
|
229
|
+
enableInsights,
|
|
230
|
+
disableInsights,
|
|
200
231
|
validateAppInsightsInit,
|
|
201
232
|
setUsername,
|
|
202
233
|
track,
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppInsightsInitializer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UYNEMCKF.js";
|
|
4
4
|
import "./chunk-6F4PWJZI.js";
|
|
5
5
|
import {
|
|
6
6
|
useAppInsights
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-U4QWRA5T.js";
|
|
8
8
|
import {
|
|
9
9
|
addTelemetryInitializer,
|
|
10
10
|
appInsightsHasBeenInitialized,
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
appInsightsLongTermLog,
|
|
13
13
|
appInsightsMain,
|
|
14
14
|
appStateStatus,
|
|
15
|
+
disableInsights,
|
|
16
|
+
enableInsights,
|
|
15
17
|
handleAppStatusChange,
|
|
16
18
|
metricKeys,
|
|
17
19
|
metricStatus,
|
|
@@ -23,7 +25,7 @@ import {
|
|
|
23
25
|
trackNavigation,
|
|
24
26
|
trackShortTerm,
|
|
25
27
|
validateAppInsightsInit
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-Z7EMW7JA.js";
|
|
27
29
|
import "./chunk-HBTKADNX.js";
|
|
28
30
|
export {
|
|
29
31
|
AppInsightsInitializer,
|
|
@@ -33,6 +35,8 @@ export {
|
|
|
33
35
|
appInsightsLongTermLog,
|
|
34
36
|
appInsightsMain,
|
|
35
37
|
appStateStatus,
|
|
38
|
+
disableInsights,
|
|
39
|
+
enableInsights,
|
|
36
40
|
handleAppStatusChange,
|
|
37
41
|
metricKeys,
|
|
38
42
|
metricStatus,
|
package/dist/useAppInsights.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useAppInsights: (
|
|
1
|
+
import { AppInsightsInitConfig } from "./types";
|
|
2
|
+
export declare const useAppInsights: (config: AppInsightsInitConfig) => void;
|
package/dist/useAppInsights.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-UDTSFJ3J.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
appInsightsHasBeenInitialized,
|
|
3
|
-
appInsightsInit
|
|
4
|
-
} from "./chunk-PHO4BZGR.js";
|
|
5
|
-
|
|
6
|
-
// src/useAppInsights.ts
|
|
7
|
-
import { useEffect } from "react";
|
|
8
|
-
var useAppInsights = (...args) => {
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (appInsightsHasBeenInitialized()) return;
|
|
11
|
-
appInsightsInit(...args);
|
|
12
|
-
}, [args]);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
useAppInsights
|
|
17
|
-
};
|