@equinor/mad-insights 0.0.2 → 0.1.1
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.d.ts +9 -0
- package/dist/AppInsightsInitializer.js +9 -0
- package/dist/appInsights.d.ts +7 -26
- package/dist/appInsights.js +4 -2
- package/dist/chunk-6F4PWJZI.js +0 -0
- package/dist/{chunk-2YSWHN2G.js → chunk-A36VBZRX.js} +4 -1
- package/dist/chunk-Q2JGSIYU.js +16 -0
- package/dist/{chunk-PACV3Q7O.js → chunk-UBOLTVAF.js} +33 -22
- package/dist/chunk-UEUCDD3L.js +13 -0
- package/dist/encrypt.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -3
- package/dist/types.d.ts +23 -0
- package/dist/types.js +1 -0
- package/dist/useAppInsights.d.ts +1 -17
- package/dist/useAppInsights.js +3 -3
- package/package.json +9 -8
- package/dist/chunk-GUSP74WR.js +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @equinor/mad-insights
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b025c9b: Implemented Create Incident Screen
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 936e5e0: Added the ability to use `addTelemetryInitializer` before initializing application
|
|
14
|
+
insights
|
|
15
|
+
|
|
3
16
|
## 0.0.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { AppInsightsInitConfig } from "./types";
|
|
3
|
+
export type AppInsightsInitializerProps = PropsWithChildren<{
|
|
4
|
+
config: AppInsightsInitConfig;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* This component will run the `useAppInsights` hook for you, and return the children
|
|
8
|
+
*/
|
|
9
|
+
export declare const AppInsightsInitializer: ({ children, config }: AppInsightsInitializerProps) => import("react").ReactNode;
|
package/dist/appInsights.d.ts
CHANGED
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
import { ReactPlugin } from "@microsoft/applicationinsights-react-js";
|
|
2
|
-
import { ApplicationInsights, ICustomProperties
|
|
2
|
+
import { ApplicationInsights, ICustomProperties } from "@microsoft/applicationinsights-web";
|
|
3
|
+
import { AppInsightsInitConfig, Envelope } from "./types";
|
|
3
4
|
declare let appInsightsMain: ApplicationInsights;
|
|
4
5
|
declare let appInsightsLongTermLog: ApplicationInsights;
|
|
5
6
|
declare let reactPluginWeb: ReactPlugin;
|
|
6
|
-
declare let useSHA1: boolean;
|
|
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).
|
|
9
9
|
* You need to provide a connectionString OR instrumentationKey.
|
|
10
10
|
* @example initializeTracking({connectionString: "STRING"})
|
|
11
11
|
* @example initializeTracking({instrumentationKey: "STRING"})
|
|
12
|
-
* @param
|
|
12
|
+
* @param config: { connectionString } OR { instrumentationKey }
|
|
13
13
|
*/
|
|
14
|
-
export declare const appInsightsInit: (
|
|
15
|
-
|
|
16
|
-
instrumentationKey?: undefined;
|
|
17
|
-
} | {
|
|
18
|
-
instrumentationKey: string;
|
|
19
|
-
connectionString?: undefined;
|
|
20
|
-
}) & {
|
|
21
|
-
/**
|
|
22
|
-
* Long term log hides user id
|
|
23
|
-
*/
|
|
24
|
-
longTermLog?: ({
|
|
25
|
-
connectionString: string;
|
|
26
|
-
instrumentationKey?: undefined;
|
|
27
|
-
} | {
|
|
28
|
-
instrumentationKey: string;
|
|
29
|
-
connectionString?: undefined;
|
|
30
|
-
}) & {
|
|
31
|
-
/**@deprecated ONLY use in special circumstances. SHA1 is _NOT_ secure*/
|
|
32
|
-
useSHA1?: boolean;
|
|
33
|
-
};
|
|
34
|
-
}) => void;
|
|
14
|
+
export declare const appInsightsInit: (config: AppInsightsInitConfig) => void;
|
|
15
|
+
export declare const appInsightsHasBeenInitialized: () => boolean;
|
|
35
16
|
export declare const validateAppInsightsInit: () => void;
|
|
36
17
|
export declare const setUsername: (username: string, userIdentifier: string | undefined) => void;
|
|
37
18
|
/**
|
|
@@ -41,8 +22,8 @@ export declare const setUsername: (username: string, userIdentifier: string | un
|
|
|
41
22
|
* @param {string} [modifier] - extra text in the name of the event
|
|
42
23
|
* @param {Object} [extraData] - object to send as a customDimension property. Detailed information should be sent here
|
|
43
24
|
*/
|
|
44
|
-
export declare const track: (eventName: metricKeys, eventStatus?: metricStatus, extraText?: string, extraData?: ICustomProperties) =>
|
|
45
|
-
export declare const addTelemetryInitializer: (envelope:
|
|
25
|
+
export declare const track: (eventName: metricKeys, eventStatus?: metricStatus, extraText?: string, extraData?: ICustomProperties) => void;
|
|
26
|
+
export declare const addTelemetryInitializer: (envelope: Envelope) => void;
|
|
46
27
|
/**
|
|
47
28
|
* Track something for short term logs. status, modifier & extraData is optional
|
|
48
29
|
* @param {metricKeys} eventName - Name of the event
|
package/dist/appInsights.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addTelemetryInitializer,
|
|
3
|
+
appInsightsHasBeenInitialized,
|
|
3
4
|
appInsightsInit,
|
|
4
5
|
appInsightsLongTermLog,
|
|
5
6
|
appInsightsMain,
|
|
@@ -15,10 +16,11 @@ import {
|
|
|
15
16
|
trackNavigation,
|
|
16
17
|
trackShortTerm,
|
|
17
18
|
validateAppInsightsInit
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-UBOLTVAF.js";
|
|
20
|
+
import "./chunk-Q2JGSIYU.js";
|
|
20
21
|
export {
|
|
21
22
|
addTelemetryInitializer,
|
|
23
|
+
appInsightsHasBeenInitialized,
|
|
22
24
|
appInsightsInit,
|
|
23
25
|
appInsightsLongTermLog,
|
|
24
26
|
appInsightsMain,
|
|
File without changes
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
appInsightsHasBeenInitialized,
|
|
2
3
|
appInsightsInit
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UBOLTVAF.js";
|
|
4
5
|
|
|
5
6
|
// src/useAppInsights.ts
|
|
6
7
|
import { useEffect } from "react";
|
|
7
8
|
var useAppInsights = (...args) => {
|
|
8
9
|
useEffect(() => {
|
|
10
|
+
if (appInsightsHasBeenInitialized())
|
|
11
|
+
return;
|
|
9
12
|
appInsightsInit(...args);
|
|
10
13
|
}, [args]);
|
|
11
14
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/encrypt.ts
|
|
2
|
+
import CryptoJS from "crypto-js";
|
|
3
|
+
function obfuscateUser(username, userIdentifier, useSHA1) {
|
|
4
|
+
let domain;
|
|
5
|
+
if (username.includes("@") === false)
|
|
6
|
+
domain = "no domain";
|
|
7
|
+
else
|
|
8
|
+
domain = username.split("@")[1].toLowerCase();
|
|
9
|
+
const stringToEncrypt = `${userIdentifier}`;
|
|
10
|
+
const hash = useSHA1 ? CryptoJS.SHA1(stringToEncrypt) : CryptoJS.SHA256(stringToEncrypt);
|
|
11
|
+
return { id: hash.toString(), domain };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
obfuscateUser
|
|
16
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__async,
|
|
3
2
|
obfuscateUser
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q2JGSIYU.js";
|
|
5
4
|
|
|
6
5
|
// src/appInsights.ts
|
|
7
6
|
import { ReactPlugin } from "@microsoft/applicationinsights-react-js";
|
|
@@ -13,12 +12,17 @@ import { createBrowserHistory } from "history";
|
|
|
13
12
|
import { Platform } from "react-native";
|
|
14
13
|
var appInsightsMain;
|
|
15
14
|
var appInsightsLongTermLog;
|
|
15
|
+
var hasBeenInitialized = false;
|
|
16
16
|
var reactPluginWeb;
|
|
17
17
|
var useSHA1;
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
var envelopeBacklog = [];
|
|
19
|
+
var appInsightsInit = (config) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const { connectionString, instrumentationKey } = config;
|
|
22
|
+
useSHA1 = (_b = (_a = config.longTermLog) == null ? void 0 : _a.useSHA1) != null ? _b : false;
|
|
23
|
+
if (hasBeenInitialized)
|
|
24
|
+
return;
|
|
25
|
+
hasBeenInitialized = true;
|
|
22
26
|
if (Platform.OS === "web") {
|
|
23
27
|
const browserHistory = createBrowserHistory();
|
|
24
28
|
reactPluginWeb = new ReactPlugin();
|
|
@@ -33,11 +37,11 @@ var appInsightsInit = (payload) => {
|
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
});
|
|
36
|
-
if (
|
|
40
|
+
if (config.longTermLog) {
|
|
37
41
|
appInsightsLongTermLog = new ApplicationInsights({
|
|
38
42
|
config: {
|
|
39
|
-
connectionString:
|
|
40
|
-
instrumentationKey:
|
|
43
|
+
connectionString: config.longTermLog.connectionString,
|
|
44
|
+
instrumentationKey: config.longTermLog.instrumentationKey,
|
|
41
45
|
disableFetchTracking: false,
|
|
42
46
|
extensions: [reactPluginWeb],
|
|
43
47
|
extensionConfig: {
|
|
@@ -58,12 +62,12 @@ var appInsightsInit = (payload) => {
|
|
|
58
62
|
extensions: [RNPlugin]
|
|
59
63
|
}
|
|
60
64
|
});
|
|
61
|
-
if (
|
|
65
|
+
if (config.longTermLog) {
|
|
62
66
|
appInsightsLongTermLog = new ApplicationInsights({
|
|
63
67
|
config: {
|
|
64
68
|
disableFetchTracking: false,
|
|
65
|
-
connectionString:
|
|
66
|
-
instrumentationKey:
|
|
69
|
+
connectionString: config.longTermLog.connectionString,
|
|
70
|
+
instrumentationKey: config.longTermLog.instrumentationKey,
|
|
67
71
|
extensions: [RNPlugin]
|
|
68
72
|
}
|
|
69
73
|
});
|
|
@@ -71,8 +75,10 @@ var appInsightsInit = (payload) => {
|
|
|
71
75
|
}
|
|
72
76
|
appInsightsMain.loadAppInsights();
|
|
73
77
|
}
|
|
74
|
-
|
|
78
|
+
envelopeBacklog.forEach(addTelemetryInitializer);
|
|
79
|
+
void track("Application STARTED" /* APP_STARTED */);
|
|
75
80
|
};
|
|
81
|
+
var appInsightsHasBeenInitialized = () => hasBeenInitialized;
|
|
76
82
|
var validateAppInsightsInit = () => {
|
|
77
83
|
if (!appInsightsMain) {
|
|
78
84
|
throw new Error(
|
|
@@ -84,8 +90,8 @@ var setUsername = (username, userIdentifier) => {
|
|
|
84
90
|
validateAppInsightsInit();
|
|
85
91
|
appInsightsMain.setAuthenticatedUserContext(username, userIdentifier, true);
|
|
86
92
|
if (appInsightsLongTermLog) {
|
|
87
|
-
const obfuscatedUserName = obfuscateUser(userIdentifier
|
|
88
|
-
const obfuscatedUserId = obfuscateUser(username, userIdentifier
|
|
93
|
+
const obfuscatedUserName = obfuscateUser(userIdentifier != null ? userIdentifier : "", username, useSHA1).id;
|
|
94
|
+
const obfuscatedUserId = obfuscateUser(username, userIdentifier != null ? userIdentifier : "", useSHA1).id;
|
|
89
95
|
appInsightsLongTermLog.setAuthenticatedUserContext(
|
|
90
96
|
obfuscatedUserName,
|
|
91
97
|
obfuscatedUserId,
|
|
@@ -102,26 +108,30 @@ var trackEventLongTerm = (event, customProperties) => {
|
|
|
102
108
|
throw "No long term log set up";
|
|
103
109
|
appInsightsLongTermLog.trackEvent(event, customProperties);
|
|
104
110
|
};
|
|
105
|
-
var track = (eventName, eventStatus, extraText, extraData) =>
|
|
106
|
-
const eventString = `${eventName} ${eventStatus
|
|
111
|
+
var track = (eventName, eventStatus, extraText, extraData) => {
|
|
112
|
+
const eventString = `${eventName} ${eventStatus != null ? eventStatus : ""}. ${extraText != null ? extraText : ""}`;
|
|
107
113
|
if (excludeLogFilter(eventString, ["Ping", "ServiceMessage"]))
|
|
108
114
|
return;
|
|
109
115
|
trackEvent({ name: eventString }, extraData);
|
|
110
116
|
if (appInsightsLongTermLog) {
|
|
111
117
|
trackEventLongTerm({ name: eventString }, extraData);
|
|
112
118
|
}
|
|
113
|
-
}
|
|
119
|
+
};
|
|
114
120
|
var addTelemetryInitializer = (envelope) => {
|
|
121
|
+
if (!hasBeenInitialized) {
|
|
122
|
+
envelopeBacklog.push(envelope);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
115
125
|
appInsightsMain.addTelemetryInitializer(envelope);
|
|
116
126
|
appInsightsLongTermLog.addTelemetryInitializer(envelope);
|
|
117
127
|
};
|
|
118
128
|
var excludeLogFilter = (eventString, excludeStrings) => excludeStrings.some((excludeString) => eventString.includes(excludeString));
|
|
119
129
|
var trackShortTerm = (eventName, eventStatus, extraText, extraData) => {
|
|
120
|
-
const eventString = `${eventName} ${eventStatus
|
|
130
|
+
const eventString = `${eventName} ${eventStatus != null ? eventStatus : ""}. ${extraText != null ? extraText : ""}`;
|
|
121
131
|
trackEvent({ name: eventString }, extraData);
|
|
122
132
|
};
|
|
123
133
|
var trackLongTerm = (eventName, eventStatus, extraText, extraData) => {
|
|
124
|
-
const eventString = `${eventName} ${eventStatus
|
|
134
|
+
const eventString = `${eventName} ${eventStatus != null ? eventStatus : ""}. ${extraText != null ? extraText : ""}`;
|
|
125
135
|
trackEventLongTerm({ name: eventString }, extraData);
|
|
126
136
|
};
|
|
127
137
|
var trackNavigation = (routeName, longTerm) => {
|
|
@@ -134,11 +144,11 @@ var trackCustom = (text, extraData) => {
|
|
|
134
144
|
};
|
|
135
145
|
var handleAppStatusChange = (nextState) => {
|
|
136
146
|
switch (nextState) {
|
|
137
|
-
case "active"
|
|
147
|
+
case "active" /* ACTIVE */: {
|
|
138
148
|
track("Application ACTIVE" /* APP_ACTIVE */);
|
|
139
149
|
break;
|
|
140
150
|
}
|
|
141
|
-
case "background"
|
|
151
|
+
case "background" /* BACKGROUND */: {
|
|
142
152
|
track("Application BACKGROUND" /* APP_BACKGROUND */);
|
|
143
153
|
break;
|
|
144
154
|
}
|
|
@@ -180,6 +190,7 @@ export {
|
|
|
180
190
|
appInsightsLongTermLog,
|
|
181
191
|
reactPluginWeb,
|
|
182
192
|
appInsightsInit,
|
|
193
|
+
appInsightsHasBeenInitialized,
|
|
183
194
|
validateAppInsightsInit,
|
|
184
195
|
setUsername,
|
|
185
196
|
track,
|
package/dist/encrypt.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppInsightsInitializer
|
|
3
|
+
} from "./chunk-UEUCDD3L.js";
|
|
4
|
+
import "./chunk-6F4PWJZI.js";
|
|
1
5
|
import {
|
|
2
6
|
useAppInsights
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-A36VBZRX.js";
|
|
4
8
|
import {
|
|
5
9
|
addTelemetryInitializer,
|
|
10
|
+
appInsightsHasBeenInitialized,
|
|
6
11
|
appInsightsInit,
|
|
7
12
|
appInsightsLongTermLog,
|
|
8
13
|
appInsightsMain,
|
|
@@ -18,10 +23,12 @@ import {
|
|
|
18
23
|
trackNavigation,
|
|
19
24
|
trackShortTerm,
|
|
20
25
|
validateAppInsightsInit
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-UBOLTVAF.js";
|
|
27
|
+
import "./chunk-Q2JGSIYU.js";
|
|
23
28
|
export {
|
|
29
|
+
AppInsightsInitializer,
|
|
24
30
|
addTelemetryInitializer,
|
|
31
|
+
appInsightsHasBeenInitialized,
|
|
25
32
|
appInsightsInit,
|
|
26
33
|
appInsightsLongTermLog,
|
|
27
34
|
appInsightsMain,
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ITelemetryItem } from "@microsoft/applicationinsights-web";
|
|
2
|
+
export type AppInsightsInitConfig = ({
|
|
3
|
+
connectionString: string;
|
|
4
|
+
instrumentationKey?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
instrumentationKey: string;
|
|
7
|
+
connectionString?: undefined;
|
|
8
|
+
}) & {
|
|
9
|
+
/**
|
|
10
|
+
* Long term log hides user id
|
|
11
|
+
*/
|
|
12
|
+
longTermLog?: ({
|
|
13
|
+
connectionString: string;
|
|
14
|
+
instrumentationKey?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
instrumentationKey: string;
|
|
17
|
+
connectionString?: undefined;
|
|
18
|
+
}) & {
|
|
19
|
+
/**@deprecated ONLY use in special circumstances. SHA1 is _NOT_ secure*/
|
|
20
|
+
useSHA1?: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type Envelope = (item: ITelemetryItem) => boolean | void;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./chunk-6F4PWJZI.js";
|
package/dist/useAppInsights.d.ts
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
export declare const useAppInsights: (
|
|
2
|
-
connectionString: string;
|
|
3
|
-
instrumentationKey?: undefined;
|
|
4
|
-
} | {
|
|
5
|
-
instrumentationKey: string;
|
|
6
|
-
connectionString?: undefined;
|
|
7
|
-
}) & {
|
|
8
|
-
longTermLog?: (({
|
|
9
|
-
connectionString: string;
|
|
10
|
-
instrumentationKey?: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
instrumentationKey: string;
|
|
13
|
-
connectionString?: undefined;
|
|
14
|
-
}) & {
|
|
15
|
-
useSHA1?: boolean | undefined;
|
|
16
|
-
}) | undefined;
|
|
17
|
-
}) => void;
|
|
1
|
+
export declare const useAppInsights: (config: import("./types").AppInsightsInitConfig) => void;
|
package/dist/useAppInsights.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/mad-insights",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Application Insights implementation for the mad team",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"react": ">=
|
|
24
|
-
"react-dom": ">=
|
|
25
|
-
"react-native": ">=0.
|
|
23
|
+
"react": ">=18.0",
|
|
24
|
+
"react-dom": ">=18.0",
|
|
25
|
+
"react-native": ">=0.70",
|
|
26
26
|
"react-native-device-info": "^10.8.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@microsoft/applicationinsights-react-js": "^17.0.0",
|
|
30
|
-
"@microsoft/applicationinsights-react-native": "^4.0.
|
|
30
|
+
"@microsoft/applicationinsights-react-native": "^4.0.2",
|
|
31
31
|
"@microsoft/applicationinsights-web": "^3.0.2",
|
|
32
32
|
"crypto-js": "^4.1.1",
|
|
33
33
|
"history": "^5.3.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/crypto-js": "^4.1.2",
|
|
37
|
-
"@equinor/eslint-config-mad": "0.
|
|
37
|
+
"@equinor/eslint-config-mad": "0.3.1"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"CODE_OF_CONDUCT.md",
|
|
@@ -43,9 +43,10 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "tsup-node",
|
|
46
|
+
"build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
|
|
47
47
|
"test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
|
|
48
48
|
"dev": "tsup-node --watch --clean=false",
|
|
49
|
-
"lint": "eslint src/"
|
|
49
|
+
"lint": "eslint src/",
|
|
50
|
+
"clean": "rm -rf node_modules/ && rm -rf dist/"
|
|
50
51
|
}
|
|
51
52
|
}
|
package/dist/chunk-GUSP74WR.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/encrypt.ts
|
|
23
|
-
import CryptoJS from "crypto-js";
|
|
24
|
-
function obfuscateUser(username, userIdentifier, useSHA1) {
|
|
25
|
-
let domain;
|
|
26
|
-
if (username.includes("@") === false)
|
|
27
|
-
domain = "no domain";
|
|
28
|
-
else
|
|
29
|
-
domain = username.split("@")[1].toLowerCase();
|
|
30
|
-
const stringToEncrypt = `${userIdentifier}`;
|
|
31
|
-
const hash = useSHA1 ? CryptoJS.SHA1(stringToEncrypt) : CryptoJS.SHA256(stringToEncrypt);
|
|
32
|
-
return { id: hash.toString(), domain };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
__async,
|
|
37
|
-
obfuscateUser
|
|
38
|
-
};
|