aesirx-analytics 2.2.2 → 2.2.4
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/dist/Consent-J6XDJB65.js +663 -0
- package/dist/ConsentCustom-6YFZO4ZJ.js +815 -0
- package/dist/analytics.js +640 -2362
- package/dist/{Consent-3FMR7JQE.js → chunk-AJMXPNA2.js} +532 -693
- package/dist/{chunk-ZYCOHH2R.js → chunk-FKCTTU52.js} +240 -8
- package/dist/index.d.ts +10 -2
- package/dist/index.js +359 -63
- package/package.json +13 -12
package/dist/index.d.ts
CHANGED
@@ -3,9 +3,11 @@ import { NextRouter } from 'next/router';
|
|
3
3
|
|
4
4
|
interface AnalyticsNext {
|
5
5
|
router: NextRouter;
|
6
|
+
attributes: any;
|
7
|
+
customLayout?: boolean;
|
6
8
|
children?: ReactNode;
|
7
9
|
}
|
8
|
-
declare const AnalyticsNext: ({ router, children }: AnalyticsNext) => React.JSX.Element;
|
10
|
+
declare const AnalyticsNext: ({ router, attributes, customLayout, children }: AnalyticsNext) => React.JSX.Element;
|
9
11
|
|
10
12
|
interface AnalyticsReact {
|
11
13
|
location: {
|
@@ -29,4 +31,10 @@ interface AnalyticsContextType {
|
|
29
31
|
}
|
30
32
|
declare const AnalyticsContext: React.Context<AnalyticsContextType>;
|
31
33
|
|
32
|
-
|
34
|
+
/**
|
35
|
+
* Function to get browser finger print
|
36
|
+
* @returns
|
37
|
+
*/
|
38
|
+
declare const getFingerprint: () => string;
|
39
|
+
|
40
|
+
export { AnalyticsContext, AnalyticsNext, AnalyticsReact, getFingerprint, trackEvent };
|
package/dist/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import {
|
2
2
|
AnalyticsContext,
|
3
3
|
AnalyticsContextProvider_default
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-FKCTTU52.js";
|
5
5
|
|
6
6
|
// src/AnalyticsNext/index.tsx
|
7
7
|
import React2 from "react";
|
@@ -34,7 +34,293 @@ var trackerService = async (endpoint, payload) => {
|
|
34
34
|
|
35
35
|
// src/utils/index.ts
|
36
36
|
import Bowser from "bowser";
|
37
|
-
|
37
|
+
|
38
|
+
// src/lib/envHelper.ts
|
39
|
+
var getHashKey = () => {
|
40
|
+
let value = null;
|
41
|
+
try {
|
42
|
+
if (typeof process.env != "undefined") {
|
43
|
+
value = process.env.SECURE_LOCAL_STORAGE_HASH_KEY || process.env.REACT_APP_SECURE_LOCAL_STORAGE_HASH_KEY || process.env.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY || process.env.VITE_SECURE_LOCAL_STORAGE_HASH_KEY;
|
44
|
+
} else {
|
45
|
+
console.warn(`react-secure-storage : process is not defined! Just a warning!`);
|
46
|
+
}
|
47
|
+
} catch (ex) {
|
48
|
+
return null;
|
49
|
+
}
|
50
|
+
return value;
|
51
|
+
};
|
52
|
+
var getStoragePrefix = () => {
|
53
|
+
let value = null;
|
54
|
+
try {
|
55
|
+
if (typeof process.env != "undefined") {
|
56
|
+
value = process.env.SECURE_LOCAL_STORAGE_PREFIX || process.env.REACT_APP_SECURE_LOCAL_STORAGE_PREFIX || process.env.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX || process.env.VITE_SECURE_LOCAL_STORAGE_PREFIX;
|
57
|
+
} else {
|
58
|
+
console.warn(`react-secure-storage : process is not defined! Just a warning!`);
|
59
|
+
}
|
60
|
+
} catch (ex) {
|
61
|
+
return null;
|
62
|
+
}
|
63
|
+
return value;
|
64
|
+
};
|
65
|
+
var getDisabledKeys = () => {
|
66
|
+
let value = null;
|
67
|
+
try {
|
68
|
+
if (typeof process.env != "undefined") {
|
69
|
+
value = process.env.SECURE_LOCAL_STORAGE_DISABLED_KEYS || process.env.REACT_APP_SECURE_LOCAL_STORAGE_DISABLED_KEYS || process.env.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_DISABLED_KEYS || process.env.VITE_SECURE_LOCAL_STORAGE_DISABLED_KEYS;
|
70
|
+
} else {
|
71
|
+
console.warn(`react-secure-storage : process is not defined! Just a warning!`);
|
72
|
+
}
|
73
|
+
} catch (ex) {
|
74
|
+
return null;
|
75
|
+
}
|
76
|
+
return value;
|
77
|
+
};
|
78
|
+
var envHelper = {
|
79
|
+
getHashKey,
|
80
|
+
getStoragePrefix,
|
81
|
+
getDisabledKeys
|
82
|
+
};
|
83
|
+
var envHelper_default = envHelper;
|
84
|
+
|
85
|
+
// src/lib/fingerpint.lib.ts
|
86
|
+
import murmurhash3_32_gc from "murmurhash-js/murmurhash3_gc";
|
87
|
+
|
88
|
+
// src/lib/utils.ts
|
89
|
+
var FINGERPRINT_KEYS = {
|
90
|
+
USERAGENT: "UserAgent",
|
91
|
+
SCREEN_PRINT: "ScreenPrint",
|
92
|
+
PLUGINS: "Plugins",
|
93
|
+
FONTS: "Fonts",
|
94
|
+
LOCAL_STORAGE: "LocalStorage",
|
95
|
+
SESSION_STORAGE: "SessionStorage",
|
96
|
+
TIMEZONE: "TimeZone",
|
97
|
+
LANGUAGE: "Language",
|
98
|
+
SYSTEM_LANGUAGE: "SystemLanguage",
|
99
|
+
COOKIE: "Cookie",
|
100
|
+
CANVAS: "Canvas",
|
101
|
+
HOSTNAME: "Hostname"
|
102
|
+
};
|
103
|
+
var getDisabledKeys2 = () => {
|
104
|
+
const DISABLED_KEYS = envHelper_default.getDisabledKeys() || "";
|
105
|
+
if (DISABLED_KEYS === "")
|
106
|
+
return [];
|
107
|
+
const allOptions = [
|
108
|
+
FINGERPRINT_KEYS.USERAGENT,
|
109
|
+
FINGERPRINT_KEYS.SCREEN_PRINT,
|
110
|
+
FINGERPRINT_KEYS.PLUGINS,
|
111
|
+
FINGERPRINT_KEYS.FONTS,
|
112
|
+
FINGERPRINT_KEYS.LOCAL_STORAGE,
|
113
|
+
FINGERPRINT_KEYS.SESSION_STORAGE,
|
114
|
+
FINGERPRINT_KEYS.TIMEZONE,
|
115
|
+
FINGERPRINT_KEYS.LANGUAGE,
|
116
|
+
FINGERPRINT_KEYS.SYSTEM_LANGUAGE,
|
117
|
+
FINGERPRINT_KEYS.COOKIE,
|
118
|
+
FINGERPRINT_KEYS.CANVAS,
|
119
|
+
FINGERPRINT_KEYS.HOSTNAME
|
120
|
+
];
|
121
|
+
const response = [];
|
122
|
+
DISABLED_KEYS.split("|").forEach((key) => {
|
123
|
+
if (key === "") {
|
124
|
+
console.log("test");
|
125
|
+
} else if (allOptions.includes(key))
|
126
|
+
response.push(key);
|
127
|
+
else
|
128
|
+
console.warn(
|
129
|
+
`react-secure-storage : ${key} is not present in the available disabled keys options! Please go through the documentation`
|
130
|
+
);
|
131
|
+
});
|
132
|
+
return response;
|
133
|
+
};
|
134
|
+
|
135
|
+
// src/lib/fingerpint.lib.ts
|
136
|
+
var ClientJS = class {
|
137
|
+
//
|
138
|
+
// MAIN METHODS
|
139
|
+
//
|
140
|
+
// Get Fingerprint. Return a 32-bit integer representing the browsers fingerprint.
|
141
|
+
getFingerprint() {
|
142
|
+
const bar = "|";
|
143
|
+
const disabledKeys = getDisabledKeys2();
|
144
|
+
let key = "";
|
145
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.USERAGENT)) {
|
146
|
+
key += navigator.userAgent + bar;
|
147
|
+
}
|
148
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.HOSTNAME)) {
|
149
|
+
key += window.location.hostname + bar;
|
150
|
+
}
|
151
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.SCREEN_PRINT)) {
|
152
|
+
key += this.getScreenPrint() + bar;
|
153
|
+
}
|
154
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.PLUGINS)) {
|
155
|
+
key += this.getPlugins() + bar;
|
156
|
+
}
|
157
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.FONTS)) {
|
158
|
+
key += this.getFonts() + bar;
|
159
|
+
}
|
160
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.LOCAL_STORAGE)) {
|
161
|
+
key += this.isLocalStorage() + bar;
|
162
|
+
}
|
163
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.SESSION_STORAGE)) {
|
164
|
+
key += this.isSessionStorage() + bar;
|
165
|
+
}
|
166
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.TIMEZONE)) {
|
167
|
+
key += this.getTimeZone() + bar;
|
168
|
+
}
|
169
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.LANGUAGE)) {
|
170
|
+
key += this.getLanguage() + bar;
|
171
|
+
}
|
172
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.SYSTEM_LANGUAGE)) {
|
173
|
+
key += this.getSystemLanguage() + bar;
|
174
|
+
}
|
175
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.COOKIE)) {
|
176
|
+
key += this.isCookie() + bar;
|
177
|
+
}
|
178
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.CANVAS)) {
|
179
|
+
key += this.getCanvasPrint();
|
180
|
+
}
|
181
|
+
if (key.endsWith(bar))
|
182
|
+
key = key.substring(0, key.length - 1);
|
183
|
+
const seed = 256;
|
184
|
+
return murmurhash3_32_gc(key, seed);
|
185
|
+
}
|
186
|
+
//
|
187
|
+
// SCREEN METHODS
|
188
|
+
//
|
189
|
+
// Get Screen Print. Return a string containing screen information.
|
190
|
+
getScreenPrint() {
|
191
|
+
return "Color Depth: " + this.getColorDepth() + ", Device XDPI: " + this.getDeviceXDPI() + ", Device YDPI: " + this.getDeviceYDPI();
|
192
|
+
}
|
193
|
+
// Get Color Depth. Return a string containing the color depth.
|
194
|
+
getColorDepth() {
|
195
|
+
return window.screen.colorDepth;
|
196
|
+
}
|
197
|
+
// Get Current Resolution. Return a string containing the current resolution.
|
198
|
+
getCurrentResolution() {
|
199
|
+
return window.screen.width + "x" + window.screen.height;
|
200
|
+
}
|
201
|
+
// Get Available Resolution. Return a string containing the available resolution.
|
202
|
+
getAvailableResolution() {
|
203
|
+
return window.screen.availWidth + "x" + window.screen.availHeight;
|
204
|
+
}
|
205
|
+
// Get Device XPDI. Return a string containing the device XPDI.
|
206
|
+
getDeviceXDPI() {
|
207
|
+
return "";
|
208
|
+
}
|
209
|
+
// Get Device YDPI. Return a string containing the device YDPI.
|
210
|
+
getDeviceYDPI() {
|
211
|
+
return "";
|
212
|
+
}
|
213
|
+
//
|
214
|
+
// PLUGIN METHODS
|
215
|
+
//
|
216
|
+
// Get Plugins. Return a string containing a list of installed plugins.
|
217
|
+
getPlugins() {
|
218
|
+
let pluginsList = "";
|
219
|
+
for (let i = 0; i < navigator.plugins.length; i++) {
|
220
|
+
if (i === navigator.plugins.length - 1) {
|
221
|
+
pluginsList += navigator.plugins[i].name;
|
222
|
+
} else {
|
223
|
+
pluginsList += navigator.plugins[i].name + ", ";
|
224
|
+
}
|
225
|
+
}
|
226
|
+
return pluginsList;
|
227
|
+
}
|
228
|
+
//
|
229
|
+
// FONT METHODS
|
230
|
+
//
|
231
|
+
// Get Fonts. Return a string containing a list of installed fonts.
|
232
|
+
getFonts() {
|
233
|
+
const fontString = "";
|
234
|
+
return fontString;
|
235
|
+
}
|
236
|
+
//
|
237
|
+
// STORAGE METHODS
|
238
|
+
//
|
239
|
+
// Is Local Storage. Check if local storage is enabled.
|
240
|
+
isLocalStorage() {
|
241
|
+
try {
|
242
|
+
return !!localStorage;
|
243
|
+
} catch (e) {
|
244
|
+
return true;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
// Is Session Storage. Check if session storage is enabled.
|
248
|
+
isSessionStorage() {
|
249
|
+
try {
|
250
|
+
return !!sessionStorage;
|
251
|
+
} catch (e) {
|
252
|
+
return true;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
// Is Cookie. Check if cookies are enabled.
|
256
|
+
isCookie() {
|
257
|
+
return navigator.cookieEnabled;
|
258
|
+
}
|
259
|
+
//
|
260
|
+
// TIME METHODS
|
261
|
+
//
|
262
|
+
// Get Time Zone. Return a string containing the time zone.
|
263
|
+
getTimeZone() {
|
264
|
+
const rightNow = /* @__PURE__ */ new Date();
|
265
|
+
let myNumber, formattedNumber, result;
|
266
|
+
myNumber = String(-(rightNow.getTimezoneOffset() / 60));
|
267
|
+
if (myNumber < 0) {
|
268
|
+
myNumber = myNumber * -1;
|
269
|
+
formattedNumber = ("0" + myNumber).slice(-2);
|
270
|
+
result = "-" + formattedNumber;
|
271
|
+
} else {
|
272
|
+
formattedNumber = ("0" + myNumber).slice(-2);
|
273
|
+
result = "+" + formattedNumber;
|
274
|
+
}
|
275
|
+
return result;
|
276
|
+
}
|
277
|
+
//
|
278
|
+
// LANGUAGE METHODS
|
279
|
+
//
|
280
|
+
// Get Language. Return a string containing the user language.
|
281
|
+
getLanguage() {
|
282
|
+
return navigator.language;
|
283
|
+
}
|
284
|
+
// Get System Language. Return a string containing the system language.
|
285
|
+
getSystemLanguage() {
|
286
|
+
return navigator.language || window.navigator.language;
|
287
|
+
}
|
288
|
+
// Get Canvas Print. Return a string containing the canvas URI data.
|
289
|
+
getCanvasPrint() {
|
290
|
+
const canvas = document.createElement("canvas");
|
291
|
+
let ctx;
|
292
|
+
try {
|
293
|
+
ctx = canvas.getContext("2d");
|
294
|
+
} catch (e) {
|
295
|
+
return "";
|
296
|
+
}
|
297
|
+
const txt = "ClientJS,org <canvas> 1.0";
|
298
|
+
ctx.textBaseline = "top";
|
299
|
+
ctx.font = "14px 'Arial'";
|
300
|
+
ctx.textBaseline = "alphabetic";
|
301
|
+
ctx.fillStyle = "#f60";
|
302
|
+
ctx.fillRect(125, 1, 62, 20);
|
303
|
+
ctx.fillStyle = "#069";
|
304
|
+
ctx.fillText(txt, 2, 15);
|
305
|
+
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
306
|
+
ctx.fillText(txt, 4, 17);
|
307
|
+
return canvas.toDataURL();
|
308
|
+
}
|
309
|
+
};
|
310
|
+
var clientJS = new ClientJS();
|
311
|
+
var fingerpint_lib_default = clientJS;
|
312
|
+
|
313
|
+
// src/lib/fingerprint.ts
|
314
|
+
var HASH_KEY = "E86E2612010258B35137";
|
315
|
+
var getFingerprint = () => {
|
316
|
+
const HASH_KEY_CUSTOM = envHelper_default.getHashKey() || HASH_KEY;
|
317
|
+
if (typeof window === "undefined")
|
318
|
+
return HASH_KEY_CUSTOM;
|
319
|
+
return fingerpint_lib_default.getFingerprint() + HASH_KEY_CUSTOM;
|
320
|
+
};
|
321
|
+
var fingerprint_default = getFingerprint;
|
322
|
+
|
323
|
+
// src/utils/index.ts
|
38
324
|
var createRequest = (endpoint, task) => {
|
39
325
|
return `${endpoint}/visitor/v1/${task}`;
|
40
326
|
};
|
@@ -44,7 +330,7 @@ var createRequestV2 = (endpoint, task) => {
|
|
44
330
|
var rememberFlow = (endpoint, flow) => {
|
45
331
|
return `${endpoint}/remember_flow/${flow}`;
|
46
332
|
};
|
47
|
-
var startTracker = async (endpoint, url, referer, user_agent) => {
|
333
|
+
var startTracker = async (endpoint, url, referer, user_agent, attributesVisit) => {
|
48
334
|
const allow = sessionStorage.getItem("aesirx-analytics-allow");
|
49
335
|
if (allow === "0") {
|
50
336
|
return null;
|
@@ -62,34 +348,36 @@ var startTracker = async (endpoint, url, referer, user_agent) => {
|
|
62
348
|
const queryString = window.location.search;
|
63
349
|
const urlParams = new URLSearchParams(queryString);
|
64
350
|
const ip = "";
|
65
|
-
const fpPromise = FingerprintJS.load({ monitoring: false });
|
66
351
|
try {
|
67
|
-
const
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
urlParams.get(key) && attributes.push({ name: key, value: urlParams.get(key) });
|
73
|
-
}
|
352
|
+
const fingerprint = fingerprint_default();
|
353
|
+
const attributes = [];
|
354
|
+
for (const key of urlParams.keys()) {
|
355
|
+
if (key.startsWith("utm_")) {
|
356
|
+
urlParams.get(key) && attributes.push({ name: key, value: urlParams.get(key) });
|
74
357
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
referer: referer !== url ? referer : document2.referrer
|
80
|
-
},
|
81
|
-
user_agent,
|
82
|
-
ip,
|
83
|
-
browser_name,
|
84
|
-
browser_version,
|
85
|
-
lang,
|
86
|
-
device,
|
87
|
-
...attributes?.length && {
|
88
|
-
event_name: "visit",
|
89
|
-
event_type: "action",
|
90
|
-
attributes
|
91
|
-
}
|
358
|
+
}
|
359
|
+
if (attributesVisit?.length) {
|
360
|
+
attributesVisit?.forEach((element) => {
|
361
|
+
element?.name && attributes.push({ name: element?.name, value: element?.value });
|
92
362
|
});
|
363
|
+
}
|
364
|
+
const responseStart = await trackerService(createRequestV2(endpoint, "start"), {
|
365
|
+
fingerprint,
|
366
|
+
url: url?.replace(/^(https?:\/\/)?(www\.)?/, "$1"),
|
367
|
+
...referer && (referer !== url || document2.referrer) && {
|
368
|
+
referer: referer !== url ? referer : document2.referrer
|
369
|
+
},
|
370
|
+
user_agent,
|
371
|
+
ip,
|
372
|
+
browser_name,
|
373
|
+
browser_version,
|
374
|
+
lang,
|
375
|
+
device,
|
376
|
+
...attributes?.length && {
|
377
|
+
event_name: "visit",
|
378
|
+
event_type: "action",
|
379
|
+
attributes
|
380
|
+
}
|
93
381
|
});
|
94
382
|
if (window["aesirxTrackEcommerce"] === "true" && sessionStorage.getItem("aesirx-analytics-flow") !== (await responseStart)?.flow_uuid) {
|
95
383
|
sessionStorage.setItem("aesirx-analytics-flow", (await responseStart)?.flow_uuid);
|
@@ -118,31 +406,28 @@ var trackEvent = async (endpoint, referer, data) => {
|
|
118
406
|
const lang = window.navigator["userLanguage"] || window.navigator.language;
|
119
407
|
const device = browser?.platform?.model ?? browser?.platform?.type;
|
120
408
|
const ip = "";
|
121
|
-
const
|
122
|
-
const
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
);
|
144
|
-
return navigator.sendBeacon(createRequestV2(endpoint, "start"), blobData);
|
145
|
-
});
|
409
|
+
const fingerprint = fingerprint_default();
|
410
|
+
const headers = { type: "application/json" };
|
411
|
+
const blobData = new Blob(
|
412
|
+
[
|
413
|
+
JSON.stringify({
|
414
|
+
fingerprint,
|
415
|
+
url,
|
416
|
+
...referer !== "/" && referer && {
|
417
|
+
referer
|
418
|
+
},
|
419
|
+
user_agent,
|
420
|
+
ip,
|
421
|
+
browser_name,
|
422
|
+
browser_version,
|
423
|
+
lang,
|
424
|
+
device,
|
425
|
+
...data
|
426
|
+
})
|
427
|
+
],
|
428
|
+
headers
|
429
|
+
);
|
430
|
+
const responseStart = navigator.sendBeacon(createRequestV2(endpoint, "start"), blobData);
|
146
431
|
return responseStart;
|
147
432
|
};
|
148
433
|
var endTracker = (endPoint, event_uuid, visitor_uuid) => {
|
@@ -178,15 +463,15 @@ var endTrackerVisibilityState = (endPoint) => {
|
|
178
463
|
};
|
179
464
|
|
180
465
|
// src/AnalyticsNext/handle.tsx
|
181
|
-
var AnalyticsHandle = ({ router, children }) => {
|
466
|
+
var AnalyticsHandle = ({ router, attributes, children }) => {
|
182
467
|
const AnalyticsStore = React.useContext(AnalyticsContext);
|
183
468
|
const endPoint = process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL;
|
184
469
|
const [prevRoute, setPrevRoute] = useState("");
|
185
470
|
const handleStartTracker = useCallback(
|
186
|
-
async (prevRoute2) => {
|
471
|
+
async (prevRoute2, attributes2) => {
|
187
472
|
const referer = prevRoute2 ? prevRoute2 : "";
|
188
473
|
window["referer"] = referer;
|
189
|
-
const responseStart = await startTracker(endPoint, "", referer);
|
474
|
+
const responseStart = await startTracker(endPoint, "", referer, "", attributes2);
|
190
475
|
responseStart?.event_uuid && AnalyticsStore.setEventID(responseStart.event_uuid);
|
191
476
|
responseStart?.visitor_uuid && AnalyticsStore.setUUID(responseStart.visitor_uuid);
|
192
477
|
},
|
@@ -196,7 +481,7 @@ var AnalyticsHandle = ({ router, children }) => {
|
|
196
481
|
const init = async () => {
|
197
482
|
if (!AnalyticsStore.visitor_uuid) {
|
198
483
|
setPrevRoute(router.asPath);
|
199
|
-
await handleStartTracker(router.asPath);
|
484
|
+
await handleStartTracker(router.asPath, attributes);
|
200
485
|
}
|
201
486
|
};
|
202
487
|
init();
|
@@ -206,7 +491,7 @@ var AnalyticsHandle = ({ router, children }) => {
|
|
206
491
|
setPrevRoute(router.asPath);
|
207
492
|
if (AnalyticsStore.visitor_uuid) {
|
208
493
|
endTracker(endPoint, window["event_uuid"], AnalyticsStore.visitor_uuid);
|
209
|
-
await handleStartTracker(prevRoute);
|
494
|
+
await handleStartTracker(prevRoute, attributes);
|
210
495
|
}
|
211
496
|
};
|
212
497
|
router.events.on("routeChangeComplete", handleRouteChange);
|
@@ -233,15 +518,24 @@ var handle_default = AnalyticsHandle;
|
|
233
518
|
|
234
519
|
// src/AnalyticsNext/index.tsx
|
235
520
|
import dynamic from "next/dynamic";
|
236
|
-
var ConsentComponent = dynamic(() => import("./Consent-
|
237
|
-
var
|
238
|
-
|
521
|
+
var ConsentComponent = dynamic(() => import("./Consent-J6XDJB65.js"), { ssr: false });
|
522
|
+
var ConsentComponentCustom = dynamic(() => import("./ConsentCustom-6YFZO4ZJ.js"), { ssr: false });
|
523
|
+
var AnalyticsNext = ({ router, attributes, customLayout = false, children }) => {
|
524
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React2.createElement(handle_default, { router, attributes }, children, process.env.NEXT_PUBLIC_DISABLE_ANALYTICS_CONSENT !== "true" && /* @__PURE__ */ React2.createElement(React2.Fragment, null, customLayout ? /* @__PURE__ */ React2.createElement(
|
525
|
+
ConsentComponentCustom,
|
526
|
+
{
|
527
|
+
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
528
|
+
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
529
|
+
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io"
|
530
|
+
}
|
531
|
+
) : /* @__PURE__ */ React2.createElement(
|
239
532
|
ConsentComponent,
|
240
533
|
{
|
241
534
|
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
535
|
+
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
242
536
|
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io"
|
243
537
|
}
|
244
|
-
))));
|
538
|
+
)))));
|
245
539
|
};
|
246
540
|
var AnalyticsNext_default = AnalyticsNext;
|
247
541
|
|
@@ -285,12 +579,13 @@ var AnalyticsHandle2 = ({ location, history, children }) => {
|
|
285
579
|
var handle_default2 = AnalyticsHandle2;
|
286
580
|
|
287
581
|
// src/AnalyticsReact/index.tsx
|
288
|
-
var ConsentComponent2 = React4.lazy(() => import("./Consent-
|
582
|
+
var ConsentComponent2 = React4.lazy(() => import("./Consent-J6XDJB65.js"));
|
289
583
|
var AnalyticsReact = ({ location, history, children }) => {
|
290
584
|
return /* @__PURE__ */ React4.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React4.createElement(handle_default2, { location, history }, children, process.env.REACT_APP_DISABLE_ANALYTICS_CONSENT !== "true" && /* @__PURE__ */ React4.createElement(Suspense, { fallback: /* @__PURE__ */ React4.createElement(React4.Fragment, null) }, /* @__PURE__ */ React4.createElement(
|
291
585
|
ConsentComponent2,
|
292
586
|
{
|
293
587
|
endpoint: process.env.REACT_APP_ENDPOINT_ANALYTICS_URL,
|
588
|
+
networkEnv: process.env.REACT_APP_CONCORDIUM_NETWORK,
|
294
589
|
aesirXEndpoint: process.env.REACT_APP_ENDPOINT_URL ?? "https://api.aesirx.io"
|
295
590
|
}
|
296
591
|
))));
|
@@ -300,5 +595,6 @@ export {
|
|
300
595
|
AnalyticsContext,
|
301
596
|
AnalyticsNext_default as AnalyticsNext,
|
302
597
|
AnalyticsReact_default as AnalyticsReact,
|
598
|
+
fingerprint_default as getFingerprint,
|
303
599
|
trackEvent
|
304
600
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aesirx-analytics",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.4",
|
4
4
|
"license": "GPL-3.0-only",
|
5
5
|
"author": "AesirX",
|
6
6
|
"repository": "https://gitlab.redweb.dk/aesirx/analytics",
|
@@ -9,21 +9,21 @@
|
|
9
9
|
"types": "dist/index.d.ts",
|
10
10
|
"type": "module",
|
11
11
|
"dependencies": {
|
12
|
-
"@concordium/browser-wallet-api-helpers": "^
|
13
|
-
"@concordium/react-components": "^0.
|
14
|
-
"@concordium/web-sdk": "^
|
15
|
-
"@fingerprintjs/fingerprintjs": "3.4.2",
|
12
|
+
"@concordium/browser-wallet-api-helpers": "^3.0.0",
|
13
|
+
"@concordium/react-components": "^0.4.0-rc.7",
|
14
|
+
"@concordium/web-sdk": "^7.0.4-rc.3",
|
16
15
|
"@web3modal/ethereum": "^2.7.0",
|
17
16
|
"@web3modal/react": "^2.7.0",
|
18
|
-
"aesirx-sso": "^1.4.
|
19
|
-
"axios": "^1.
|
17
|
+
"aesirx-sso": "^1.4.6",
|
18
|
+
"axios": "^1.6.0",
|
20
19
|
"bootstrap": "^5.3.2",
|
21
20
|
"bowser": "^2.11.0",
|
22
21
|
"buffer": "^6.0.3",
|
23
22
|
"ethers": "^6.6.5",
|
24
|
-
"i18next": "^23.
|
23
|
+
"i18next": "^23.6.0",
|
25
24
|
"i18next-browser-languagedetector": "^7.1.0",
|
26
|
-
"
|
25
|
+
"murmurhash-js": "^1.0.0",
|
26
|
+
"next": "^14.1.0",
|
27
27
|
"query-string": "^7.1.1",
|
28
28
|
"react": "^18.2.0",
|
29
29
|
"react-bootstrap": "^2.8.0",
|
@@ -67,18 +67,19 @@
|
|
67
67
|
"@babel/preset-typescript": "^7.23.0",
|
68
68
|
"@jest/globals": "^29.7.0",
|
69
69
|
"@types/jest": "^29.5.0",
|
70
|
+
"@types/murmurhash-js": "^1.0.3",
|
70
71
|
"@types/node": "^20.8.0",
|
71
72
|
"@types/react": "^18.2.21",
|
72
|
-
"@types/react-dom": "^18.2.
|
73
|
+
"@types/react-dom": "^18.2.14",
|
73
74
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
74
75
|
"@typescript-eslint/parser": "^5.57.0",
|
75
76
|
"@walletconnect/types": "^2.10.0",
|
76
77
|
"dotenv": "^16.0.3",
|
77
78
|
"esbuild-plugin-inline-image": "^0.0.9",
|
78
|
-
"esbuild-sass-plugin": "^
|
79
|
+
"esbuild-sass-plugin": "^3.0.0",
|
79
80
|
"esbuild-scss-modules-plugin": "^1.1.1",
|
80
81
|
"eslint": "^8.48.0",
|
81
|
-
"eslint-plugin-react": "^7.
|
82
|
+
"eslint-plugin-react": "^7.33.2",
|
82
83
|
"jest": "^29.4.3",
|
83
84
|
"jest-environment-jsdom": "^29.4.3",
|
84
85
|
"node-fetch": "^3.3.1",
|