@equinor/mad-insights 0.1.1 → 0.1.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 +12 -0
- package/dist/AppInsightsInitializer.js +3 -3
- package/dist/appInsights.d.ts +1 -1
- package/dist/appInsights.js +1 -1
- package/dist/{chunk-UEUCDD3L.js → chunk-GCHDCY5M.js} +1 -1
- package/dist/{chunk-A36VBZRX.js → chunk-VNYFCEDH.js} +1 -1
- package/dist/{chunk-UBOLTVAF.js → chunk-ZP5UXSLZ.js} +13 -4
- package/dist/index.js +3 -3
- package/dist/types.d.ts +5 -1
- package/dist/useAppInsights.js +2 -2
- package/package.json +50 -50
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @equinor/mad-insights
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6349528: `addTelemetryInitializer`: should no longer crash if long term log is not initialized
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b2b8572: feat: should now be possible to run `track` before app insights is initialized
|
|
14
|
+
|
|
3
15
|
## 0.1.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppInsightsInitializer
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-GCHDCY5M.js";
|
|
4
|
+
import "./chunk-VNYFCEDH.js";
|
|
5
|
+
import "./chunk-ZP5UXSLZ.js";
|
|
6
6
|
import "./chunk-Q2JGSIYU.js";
|
|
7
7
|
export {
|
|
8
8
|
AppInsightsInitializer
|
package/dist/appInsights.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ReactPlugin } from "@microsoft/applicationinsights-react-js";
|
|
|
2
2
|
import { ApplicationInsights, ICustomProperties } from "@microsoft/applicationinsights-web";
|
|
3
3
|
import { AppInsightsInitConfig, Envelope } from "./types";
|
|
4
4
|
declare let appInsightsMain: ApplicationInsights;
|
|
5
|
-
declare let appInsightsLongTermLog: ApplicationInsights;
|
|
5
|
+
declare let appInsightsLongTermLog: ApplicationInsights | undefined;
|
|
6
6
|
declare let reactPluginWeb: ReactPlugin;
|
|
7
7
|
/**
|
|
8
8
|
* Initialize appInsights. This should be called at app startup (useEffect inside App.tsx might be a good place to put it).
|
package/dist/appInsights.js
CHANGED
|
@@ -16,6 +16,8 @@ var hasBeenInitialized = false;
|
|
|
16
16
|
var reactPluginWeb;
|
|
17
17
|
var useSHA1;
|
|
18
18
|
var envelopeBacklog = [];
|
|
19
|
+
var trackShortTermBacklog = [];
|
|
20
|
+
var trackLongTermBacklog = [];
|
|
19
21
|
var appInsightsInit = (config) => {
|
|
20
22
|
var _a, _b;
|
|
21
23
|
const { connectionString, instrumentationKey } = config;
|
|
@@ -76,6 +78,8 @@ var appInsightsInit = (config) => {
|
|
|
76
78
|
appInsightsMain.loadAppInsights();
|
|
77
79
|
}
|
|
78
80
|
envelopeBacklog.forEach(addTelemetryInitializer);
|
|
81
|
+
trackShortTermBacklog.forEach((item) => trackEvent(item.event, item.customProperties));
|
|
82
|
+
trackLongTermBacklog.forEach((item) => trackEventLongTerm(item.event, item.customProperties));
|
|
79
83
|
void track("Application STARTED" /* APP_STARTED */);
|
|
80
84
|
};
|
|
81
85
|
var appInsightsHasBeenInitialized = () => hasBeenInitialized;
|
|
@@ -100,12 +104,17 @@ var setUsername = (username, userIdentifier) => {
|
|
|
100
104
|
}
|
|
101
105
|
};
|
|
102
106
|
var trackEvent = (event, customProperties) => {
|
|
103
|
-
|
|
107
|
+
if (!appInsightsMain) {
|
|
108
|
+
trackShortTermBacklog.push({ event, customProperties });
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
104
111
|
appInsightsMain.trackEvent(event, customProperties);
|
|
105
112
|
};
|
|
106
113
|
var trackEventLongTerm = (event, customProperties) => {
|
|
107
|
-
if (!appInsightsLongTermLog)
|
|
108
|
-
|
|
114
|
+
if (!appInsightsLongTermLog) {
|
|
115
|
+
trackLongTermBacklog.push({ event, customProperties });
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
109
118
|
appInsightsLongTermLog.trackEvent(event, customProperties);
|
|
110
119
|
};
|
|
111
120
|
var track = (eventName, eventStatus, extraText, extraData) => {
|
|
@@ -123,7 +132,7 @@ var addTelemetryInitializer = (envelope) => {
|
|
|
123
132
|
return;
|
|
124
133
|
}
|
|
125
134
|
appInsightsMain.addTelemetryInitializer(envelope);
|
|
126
|
-
appInsightsLongTermLog.addTelemetryInitializer(envelope);
|
|
135
|
+
appInsightsLongTermLog == null ? void 0 : appInsightsLongTermLog.addTelemetryInitializer(envelope);
|
|
127
136
|
};
|
|
128
137
|
var excludeLogFilter = (eventString, excludeStrings) => excludeStrings.some((excludeString) => eventString.includes(excludeString));
|
|
129
138
|
var trackShortTerm = (eventName, eventStatus, extraText, extraData) => {
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppInsightsInitializer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GCHDCY5M.js";
|
|
4
4
|
import "./chunk-6F4PWJZI.js";
|
|
5
5
|
import {
|
|
6
6
|
useAppInsights
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VNYFCEDH.js";
|
|
8
8
|
import {
|
|
9
9
|
addTelemetryInitializer,
|
|
10
10
|
appInsightsHasBeenInitialized,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
trackNavigation,
|
|
24
24
|
trackShortTerm,
|
|
25
25
|
validateAppInsightsInit
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZP5UXSLZ.js";
|
|
27
27
|
import "./chunk-Q2JGSIYU.js";
|
|
28
28
|
export {
|
|
29
29
|
AppInsightsInitializer,
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITelemetryItem } from "@microsoft/applicationinsights-web";
|
|
1
|
+
import { ICustomProperties, IEventTelemetry, ITelemetryItem } from "@microsoft/applicationinsights-web";
|
|
2
2
|
export type AppInsightsInitConfig = ({
|
|
3
3
|
connectionString: string;
|
|
4
4
|
instrumentationKey?: undefined;
|
|
@@ -21,3 +21,7 @@ export type AppInsightsInitConfig = ({
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export type Envelope = (item: ITelemetryItem) => boolean | void;
|
|
24
|
+
export type TrackEventPayload = {
|
|
25
|
+
event: IEventTelemetry;
|
|
26
|
+
customProperties?: ICustomProperties | undefined;
|
|
27
|
+
};
|
package/dist/useAppInsights.js
CHANGED
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
2
|
+
"name": "@equinor/mad-insights",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Application Insights implementation for the mad team",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
|
|
8
|
+
"test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
|
|
9
|
+
"dev": "tsup-node --watch --clean=false",
|
|
10
|
+
"lint": "eslint src/",
|
|
11
|
+
"clean": "rm -rf node_modules/ && rm -rf dist/"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"react native",
|
|
15
|
+
"tracking",
|
|
16
|
+
"logging",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "Equinor Mobile App Delivery team (MAD)"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/equinor/mad/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/equinor/mad/",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"react": ">=18.0",
|
|
31
|
+
"react-dom": ">=18.0",
|
|
32
|
+
"react-native": ">=0.70",
|
|
33
|
+
"react-native-device-info": "^10.8.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@microsoft/applicationinsights-react-js": "^17.0.0",
|
|
37
|
+
"@microsoft/applicationinsights-react-native": "^4.0.2",
|
|
38
|
+
"@microsoft/applicationinsights-web": "^3.0.2",
|
|
39
|
+
"crypto-js": "^4.1.1",
|
|
40
|
+
"history": "^5.3.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@equinor/eslint-config-mad": "*",
|
|
44
|
+
"@types/crypto-js": "^4.1.2"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"CODE_OF_CONDUCT.md",
|
|
48
|
+
"LICENSE",
|
|
49
|
+
"CHANGELOG.md",
|
|
50
|
+
"dist"
|
|
51
|
+
]
|
|
52
52
|
}
|