aesirx-analytics 2.3.6 → 2.4.0
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/README.md +2 -242
- package/dist/analytics.js +1 -23686
- package/dist/index.d.ts +5 -40
- package/dist/index.js +515 -432
- package/package.json +2 -16
- package/dist/Consent-A2R6PCLK.js +0 -803
- package/dist/ConsentCustom-LYMWYNRI.js +0 -1160
- package/dist/chunk-NKOHXSTE.js +0 -2510
- package/dist/chunk-UJC5773H.js +0 -11357
package/dist/index.js
CHANGED
@@ -1,27 +1,506 @@
|
|
1
|
-
import {
|
2
|
-
AnalyticsContext,
|
3
|
-
AnalyticsContextProvider_default,
|
4
|
-
bg_default,
|
5
|
-
endTracker,
|
6
|
-
endTrackerVisibilityState,
|
7
|
-
fingerprint_default,
|
8
|
-
getConsentTemplate,
|
9
|
-
no_default,
|
10
|
-
privacy_default,
|
11
|
-
startTracker,
|
12
|
-
trackEvent,
|
13
|
-
useTranslation
|
14
|
-
} from "./chunk-NKOHXSTE.js";
|
15
|
-
|
16
1
|
// src/AnalyticsNext/index.tsx
|
17
|
-
import
|
2
|
+
import React3 from "react";
|
3
|
+
|
4
|
+
// src/utils/AnalyticsContextProvider.tsx
|
5
|
+
import React, { useEffect, useRef, useState } from "react";
|
6
|
+
var AnalyticsContext = React.createContext({
|
7
|
+
event_uuid: void 0,
|
8
|
+
visitor_uuid: void 0,
|
9
|
+
setEventID: void 0,
|
10
|
+
setUUID: void 0,
|
11
|
+
ref: void 0
|
12
|
+
});
|
13
|
+
var AnalyticsContextProvider = ({ children }) => {
|
14
|
+
const [eventID, setEventID] = useState();
|
15
|
+
const [UUID, setUUID] = useState();
|
16
|
+
const ref = useRef();
|
17
|
+
useEffect(() => {
|
18
|
+
const uuid = sessionStorage.getItem("aesirx-analytics-uuid");
|
19
|
+
uuid && setUUID(uuid);
|
20
|
+
}, []);
|
21
|
+
return /* @__PURE__ */ React.createElement(
|
22
|
+
AnalyticsContext.Provider,
|
23
|
+
{
|
24
|
+
value: {
|
25
|
+
event_uuid: eventID,
|
26
|
+
visitor_uuid: UUID,
|
27
|
+
setEventID,
|
28
|
+
setUUID,
|
29
|
+
ref
|
30
|
+
}
|
31
|
+
},
|
32
|
+
children
|
33
|
+
);
|
34
|
+
};
|
35
|
+
var AnalyticsContextProvider_default = AnalyticsContextProvider;
|
36
|
+
|
37
|
+
// src/AnalyticsNext/handle.tsx
|
38
|
+
import React2, { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
39
|
+
|
40
|
+
// src/utils/services.ts
|
41
|
+
var cache;
|
42
|
+
var assign = (a, b) => {
|
43
|
+
Object.keys(b).forEach((key) => {
|
44
|
+
if (b[key] !== void 0)
|
45
|
+
a[key] = b[key];
|
46
|
+
});
|
47
|
+
return a;
|
48
|
+
};
|
49
|
+
var trackerService = async (endpoint, payload) => {
|
50
|
+
const fetchData = await fetch(endpoint, {
|
51
|
+
method: "POST",
|
52
|
+
body: JSON.stringify(payload),
|
53
|
+
headers: assign({ "Content-Type": "application/json" }, { ["x-tracker-cache"]: cache })
|
54
|
+
});
|
55
|
+
const response = await fetchData.json();
|
56
|
+
if (response.error) {
|
57
|
+
throw response.error;
|
58
|
+
} else {
|
59
|
+
return response;
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
// src/utils/index.ts
|
64
|
+
import Bowser from "bowser";
|
65
|
+
|
66
|
+
// src/lib/envHelper.ts
|
67
|
+
var getHashKey = () => {
|
68
|
+
let value = null;
|
69
|
+
try {
|
70
|
+
if (typeof process.env != "undefined") {
|
71
|
+
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;
|
72
|
+
} else {
|
73
|
+
console.warn(`react-secure-storage : process is not defined! Just a warning!`);
|
74
|
+
}
|
75
|
+
} catch (ex) {
|
76
|
+
return null;
|
77
|
+
}
|
78
|
+
return value;
|
79
|
+
};
|
80
|
+
var getStoragePrefix = () => {
|
81
|
+
let value = null;
|
82
|
+
try {
|
83
|
+
if (typeof process.env != "undefined") {
|
84
|
+
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;
|
85
|
+
} else {
|
86
|
+
console.warn(`react-secure-storage : process is not defined! Just a warning!`);
|
87
|
+
}
|
88
|
+
} catch (ex) {
|
89
|
+
return null;
|
90
|
+
}
|
91
|
+
return value;
|
92
|
+
};
|
93
|
+
var getDisabledKeys = () => {
|
94
|
+
let value = null;
|
95
|
+
try {
|
96
|
+
if (typeof process.env != "undefined") {
|
97
|
+
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;
|
98
|
+
} else {
|
99
|
+
console.warn(`react-secure-storage : process is not defined! Just a warning!`);
|
100
|
+
}
|
101
|
+
} catch (ex) {
|
102
|
+
return null;
|
103
|
+
}
|
104
|
+
return value;
|
105
|
+
};
|
106
|
+
var envHelper = {
|
107
|
+
getHashKey,
|
108
|
+
getStoragePrefix,
|
109
|
+
getDisabledKeys
|
110
|
+
};
|
111
|
+
var envHelper_default = envHelper;
|
112
|
+
|
113
|
+
// src/lib/fingerpint.lib.ts
|
114
|
+
import murmurhash3_32_gc from "murmurhash-js/murmurhash3_gc";
|
115
|
+
|
116
|
+
// src/lib/utils.ts
|
117
|
+
var FINGERPRINT_KEYS = {
|
118
|
+
USERAGENT: "UserAgent",
|
119
|
+
SCREEN_PRINT: "ScreenPrint",
|
120
|
+
PLUGINS: "Plugins",
|
121
|
+
FONTS: "Fonts",
|
122
|
+
LOCAL_STORAGE: "LocalStorage",
|
123
|
+
SESSION_STORAGE: "SessionStorage",
|
124
|
+
TIMEZONE: "TimeZone",
|
125
|
+
LANGUAGE: "Language",
|
126
|
+
SYSTEM_LANGUAGE: "SystemLanguage",
|
127
|
+
COOKIE: "Cookie",
|
128
|
+
CANVAS: "Canvas",
|
129
|
+
HOSTNAME: "Hostname"
|
130
|
+
};
|
131
|
+
var getDisabledKeys2 = () => {
|
132
|
+
const DISABLED_KEYS = envHelper_default.getDisabledKeys() || "";
|
133
|
+
if (DISABLED_KEYS === "")
|
134
|
+
return [];
|
135
|
+
const allOptions = [
|
136
|
+
FINGERPRINT_KEYS.USERAGENT,
|
137
|
+
FINGERPRINT_KEYS.SCREEN_PRINT,
|
138
|
+
FINGERPRINT_KEYS.PLUGINS,
|
139
|
+
FINGERPRINT_KEYS.FONTS,
|
140
|
+
FINGERPRINT_KEYS.LOCAL_STORAGE,
|
141
|
+
FINGERPRINT_KEYS.SESSION_STORAGE,
|
142
|
+
FINGERPRINT_KEYS.TIMEZONE,
|
143
|
+
FINGERPRINT_KEYS.LANGUAGE,
|
144
|
+
FINGERPRINT_KEYS.SYSTEM_LANGUAGE,
|
145
|
+
FINGERPRINT_KEYS.COOKIE,
|
146
|
+
FINGERPRINT_KEYS.CANVAS,
|
147
|
+
FINGERPRINT_KEYS.HOSTNAME
|
148
|
+
];
|
149
|
+
const response = [];
|
150
|
+
DISABLED_KEYS.split("|").forEach((key) => {
|
151
|
+
if (key === "") {
|
152
|
+
console.log("test");
|
153
|
+
} else if (allOptions.includes(key))
|
154
|
+
response.push(key);
|
155
|
+
else
|
156
|
+
console.warn(
|
157
|
+
`react-secure-storage : ${key} is not present in the available disabled keys options! Please go through the documentation`
|
158
|
+
);
|
159
|
+
});
|
160
|
+
return response;
|
161
|
+
};
|
162
|
+
|
163
|
+
// src/lib/fingerpint.lib.ts
|
164
|
+
var ClientJS = class {
|
165
|
+
//
|
166
|
+
// MAIN METHODS
|
167
|
+
//
|
168
|
+
// Get Fingerprint. Return a 32-bit integer representing the browsers fingerprint.
|
169
|
+
getFingerprint() {
|
170
|
+
const bar = "|";
|
171
|
+
const disabledKeys = getDisabledKeys2();
|
172
|
+
let key = "";
|
173
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.USERAGENT)) {
|
174
|
+
key += navigator.userAgent + bar;
|
175
|
+
}
|
176
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.HOSTNAME)) {
|
177
|
+
key += window.location.hostname + bar;
|
178
|
+
}
|
179
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.SCREEN_PRINT)) {
|
180
|
+
key += this.getScreenPrint() + bar;
|
181
|
+
}
|
182
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.PLUGINS)) {
|
183
|
+
key += this.getPlugins() + bar;
|
184
|
+
}
|
185
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.FONTS)) {
|
186
|
+
key += this.getFonts() + bar;
|
187
|
+
}
|
188
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.LOCAL_STORAGE)) {
|
189
|
+
key += this.isLocalStorage() + bar;
|
190
|
+
}
|
191
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.SESSION_STORAGE)) {
|
192
|
+
key += this.isSessionStorage() + bar;
|
193
|
+
}
|
194
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.TIMEZONE)) {
|
195
|
+
key += this.getTimeZone() + bar;
|
196
|
+
}
|
197
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.LANGUAGE)) {
|
198
|
+
key += this.getLanguage() + bar;
|
199
|
+
}
|
200
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.SYSTEM_LANGUAGE)) {
|
201
|
+
key += this.getSystemLanguage() + bar;
|
202
|
+
}
|
203
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.COOKIE)) {
|
204
|
+
key += this.isCookie() + bar;
|
205
|
+
}
|
206
|
+
if (!disabledKeys.includes(FINGERPRINT_KEYS.CANVAS)) {
|
207
|
+
key += this.getCanvasPrint();
|
208
|
+
}
|
209
|
+
if (key.endsWith(bar))
|
210
|
+
key = key.substring(0, key.length - 1);
|
211
|
+
const seed = 256;
|
212
|
+
return murmurhash3_32_gc(key, seed);
|
213
|
+
}
|
214
|
+
//
|
215
|
+
// SCREEN METHODS
|
216
|
+
//
|
217
|
+
// Get Screen Print. Return a string containing screen information.
|
218
|
+
getScreenPrint() {
|
219
|
+
return "Color Depth: " + this.getColorDepth() + ", Device XDPI: " + this.getDeviceXDPI() + ", Device YDPI: " + this.getDeviceYDPI();
|
220
|
+
}
|
221
|
+
// Get Color Depth. Return a string containing the color depth.
|
222
|
+
getColorDepth() {
|
223
|
+
return window.screen.colorDepth;
|
224
|
+
}
|
225
|
+
// Get Current Resolution. Return a string containing the current resolution.
|
226
|
+
getCurrentResolution() {
|
227
|
+
return window.screen.width + "x" + window.screen.height;
|
228
|
+
}
|
229
|
+
// Get Available Resolution. Return a string containing the available resolution.
|
230
|
+
getAvailableResolution() {
|
231
|
+
return window.screen.availWidth + "x" + window.screen.availHeight;
|
232
|
+
}
|
233
|
+
// Get Device XPDI. Return a string containing the device XPDI.
|
234
|
+
getDeviceXDPI() {
|
235
|
+
return "";
|
236
|
+
}
|
237
|
+
// Get Device YDPI. Return a string containing the device YDPI.
|
238
|
+
getDeviceYDPI() {
|
239
|
+
return "";
|
240
|
+
}
|
241
|
+
//
|
242
|
+
// PLUGIN METHODS
|
243
|
+
//
|
244
|
+
// Get Plugins. Return a string containing a list of installed plugins.
|
245
|
+
getPlugins() {
|
246
|
+
let pluginsList = "";
|
247
|
+
for (let i = 0; i < navigator.plugins.length; i++) {
|
248
|
+
if (i === navigator.plugins.length - 1) {
|
249
|
+
pluginsList += navigator.plugins[i].name;
|
250
|
+
} else {
|
251
|
+
pluginsList += navigator.plugins[i].name + ", ";
|
252
|
+
}
|
253
|
+
}
|
254
|
+
return pluginsList;
|
255
|
+
}
|
256
|
+
//
|
257
|
+
// FONT METHODS
|
258
|
+
//
|
259
|
+
// Get Fonts. Return a string containing a list of installed fonts.
|
260
|
+
getFonts() {
|
261
|
+
const fontString = "";
|
262
|
+
return fontString;
|
263
|
+
}
|
264
|
+
//
|
265
|
+
// STORAGE METHODS
|
266
|
+
//
|
267
|
+
// Is Local Storage. Check if local storage is enabled.
|
268
|
+
isLocalStorage() {
|
269
|
+
try {
|
270
|
+
return !!localStorage;
|
271
|
+
} catch (e) {
|
272
|
+
return true;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
// Is Session Storage. Check if session storage is enabled.
|
276
|
+
isSessionStorage() {
|
277
|
+
try {
|
278
|
+
return !!sessionStorage;
|
279
|
+
} catch (e) {
|
280
|
+
return true;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
// Is Cookie. Check if cookies are enabled.
|
284
|
+
isCookie() {
|
285
|
+
return navigator.cookieEnabled;
|
286
|
+
}
|
287
|
+
//
|
288
|
+
// TIME METHODS
|
289
|
+
//
|
290
|
+
// Get Time Zone. Return a string containing the time zone.
|
291
|
+
getTimeZone() {
|
292
|
+
const rightNow = /* @__PURE__ */ new Date();
|
293
|
+
let myNumber, formattedNumber, result;
|
294
|
+
myNumber = String(-(rightNow.getTimezoneOffset() / 60));
|
295
|
+
if (myNumber < 0) {
|
296
|
+
myNumber = myNumber * -1;
|
297
|
+
formattedNumber = ("0" + myNumber).slice(-2);
|
298
|
+
result = "-" + formattedNumber;
|
299
|
+
} else {
|
300
|
+
formattedNumber = ("0" + myNumber).slice(-2);
|
301
|
+
result = "+" + formattedNumber;
|
302
|
+
}
|
303
|
+
return result;
|
304
|
+
}
|
305
|
+
//
|
306
|
+
// LANGUAGE METHODS
|
307
|
+
//
|
308
|
+
// Get Language. Return a string containing the user language.
|
309
|
+
getLanguage() {
|
310
|
+
return navigator.language;
|
311
|
+
}
|
312
|
+
// Get System Language. Return a string containing the system language.
|
313
|
+
getSystemLanguage() {
|
314
|
+
return navigator.language || window.navigator.language;
|
315
|
+
}
|
316
|
+
// Get Canvas Print. Return a string containing the canvas URI data.
|
317
|
+
getCanvasPrint() {
|
318
|
+
const canvas = document.createElement("canvas");
|
319
|
+
let ctx;
|
320
|
+
try {
|
321
|
+
ctx = canvas.getContext("2d");
|
322
|
+
} catch (e) {
|
323
|
+
return "";
|
324
|
+
}
|
325
|
+
const txt = "ClientJS,org <canvas> 1.0";
|
326
|
+
ctx.textBaseline = "top";
|
327
|
+
ctx.font = "14px 'Arial'";
|
328
|
+
ctx.textBaseline = "alphabetic";
|
329
|
+
ctx.fillStyle = "#f60";
|
330
|
+
ctx.fillRect(125, 1, 62, 20);
|
331
|
+
ctx.fillStyle = "#069";
|
332
|
+
ctx.fillText(txt, 2, 15);
|
333
|
+
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
334
|
+
ctx.fillText(txt, 4, 17);
|
335
|
+
return canvas.toDataURL();
|
336
|
+
}
|
337
|
+
};
|
338
|
+
var clientJS = new ClientJS();
|
339
|
+
var fingerpint_lib_default = clientJS;
|
340
|
+
|
341
|
+
// src/lib/fingerprint.ts
|
342
|
+
var HASH_KEY = "E86E2612010258B35137";
|
343
|
+
var getFingerprint = () => {
|
344
|
+
const HASH_KEY_CUSTOM = envHelper_default.getHashKey() || HASH_KEY;
|
345
|
+
if (typeof window === "undefined")
|
346
|
+
return HASH_KEY_CUSTOM;
|
347
|
+
return fingerpint_lib_default.getFingerprint() + HASH_KEY_CUSTOM;
|
348
|
+
};
|
349
|
+
var fingerprint_default = getFingerprint;
|
350
|
+
|
351
|
+
// src/utils/index.ts
|
352
|
+
var createRequest = (endpoint, task) => {
|
353
|
+
return `${endpoint}/visitor/v1/${task}`;
|
354
|
+
};
|
355
|
+
var createRequestV2 = (endpoint, task) => {
|
356
|
+
return `${endpoint}/visitor/v2/${task}`;
|
357
|
+
};
|
358
|
+
var rememberFlow = (endpoint, flow) => {
|
359
|
+
return `${endpoint}/remember_flow/${flow}`;
|
360
|
+
};
|
361
|
+
var startTracker = async (endpoint, url, referer, user_agent, attributesVisit) => {
|
362
|
+
const allow = sessionStorage.getItem("aesirx-analytics-allow");
|
363
|
+
const reject = sessionStorage.getItem("aesirx-analytics-rejected");
|
364
|
+
if (allow === "0" || reject === "true") {
|
365
|
+
return null;
|
366
|
+
}
|
367
|
+
const { location, document: document2 } = window;
|
368
|
+
const { pathname, search, origin } = location;
|
369
|
+
url = `${origin}${pathname}${search}`;
|
370
|
+
referer = referer ? location.protocol + "//" + location.host + referer : document2.referrer ? document2.referrer : window["referer"] ? window["referer"] === "/" ? location.protocol + "//" + location.host : location.protocol + "//" + location.host + window["referer"] : "";
|
371
|
+
user_agent = window.navigator.userAgent;
|
372
|
+
const browser = Bowser.parse(window.navigator.userAgent);
|
373
|
+
const browser_name = browser?.browser?.name;
|
374
|
+
const browser_version = browser?.browser?.version ?? "0";
|
375
|
+
const lang = window.navigator["userLanguage"] || window.navigator.language;
|
376
|
+
const device = browser?.platform?.model ?? browser?.platform?.type;
|
377
|
+
const queryString = window.location.search;
|
378
|
+
const urlParams = new URLSearchParams(queryString);
|
379
|
+
const ip = "";
|
380
|
+
try {
|
381
|
+
const fingerprint = fingerprint_default();
|
382
|
+
const attributes = [];
|
383
|
+
for (const key of urlParams.keys()) {
|
384
|
+
if (key.startsWith("utm_")) {
|
385
|
+
urlParams.get(key) && attributes.push({ name: key, value: urlParams.get(key) });
|
386
|
+
}
|
387
|
+
}
|
388
|
+
if (attributesVisit?.length) {
|
389
|
+
attributesVisit?.forEach((element) => {
|
390
|
+
element?.name && attributes.push({ name: element?.name, value: element?.value });
|
391
|
+
});
|
392
|
+
}
|
393
|
+
const responseStart = await trackerService(createRequestV2(endpoint, "start"), {
|
394
|
+
fingerprint,
|
395
|
+
url: url?.replace(/^(https?:\/\/)?(www\.)?/, "$1"),
|
396
|
+
...referer && (referer !== url || document2.referrer) && {
|
397
|
+
referer: referer !== url ? referer?.replace(/^(https?:\/\/)?(www\.)?/, "$1") : document2.referrer?.replace(/^(https?:\/\/)?(www\.)?/, "$1")
|
398
|
+
},
|
399
|
+
user_agent,
|
400
|
+
ip,
|
401
|
+
browser_name,
|
402
|
+
browser_version,
|
403
|
+
lang,
|
404
|
+
device: device?.includes("iPhone") ? "mobile" : device?.includes("iPad") ? "tablet" : device,
|
405
|
+
...attributes?.length && {
|
406
|
+
event_name: "visit",
|
407
|
+
event_type: "action",
|
408
|
+
attributes
|
409
|
+
}
|
410
|
+
});
|
411
|
+
if (window["aesirxTrackEcommerce"] === "true" && sessionStorage.getItem("aesirx-analytics-flow") !== (await responseStart)?.flow_uuid) {
|
412
|
+
sessionStorage.setItem("aesirx-analytics-flow", (await responseStart)?.flow_uuid);
|
413
|
+
try {
|
414
|
+
await trackerService(
|
415
|
+
rememberFlow(window.location.origin, (await responseStart)?.flow_uuid),
|
416
|
+
{}
|
417
|
+
);
|
418
|
+
} catch (error) {
|
419
|
+
console.log("Remember Flow Error", error);
|
420
|
+
}
|
421
|
+
}
|
422
|
+
return responseStart;
|
423
|
+
} catch (error) {
|
424
|
+
console.error("Analytics Error: ", error);
|
425
|
+
}
|
426
|
+
};
|
427
|
+
var trackEvent = async (endpoint, referer, data) => {
|
428
|
+
const allow = sessionStorage.getItem("aesirx-analytics-allow");
|
429
|
+
const reject = sessionStorage.getItem("aesirx-analytics-rejected");
|
430
|
+
if (allow === "0" || reject === "true") {
|
431
|
+
return null;
|
432
|
+
}
|
433
|
+
const { location, document: document2 } = window;
|
434
|
+
referer = referer ? location.protocol + "//" + location.host + referer : document2.referrer ? document2.referrer : window["referer"] ? window["referer"] === "/" ? location.protocol + "//" + location.host : location.protocol + "//" + location.host + window["referer"] : "";
|
435
|
+
const url = location.protocol + "//" + location.host + location.pathname;
|
436
|
+
const user_agent = window.navigator.userAgent;
|
437
|
+
const browser = Bowser.parse(window.navigator.userAgent);
|
438
|
+
const browser_name = browser?.browser?.name;
|
439
|
+
const browser_version = browser?.browser?.version ?? "0";
|
440
|
+
const lang = window.navigator["userLanguage"] || window.navigator.language;
|
441
|
+
const device = browser?.platform?.model ?? browser?.platform?.type;
|
442
|
+
const ip = "";
|
443
|
+
const fingerprint = fingerprint_default();
|
444
|
+
const headers = { type: "application/json" };
|
445
|
+
const blobData = new Blob(
|
446
|
+
[
|
447
|
+
JSON.stringify({
|
448
|
+
fingerprint,
|
449
|
+
url: url?.replace(/^(https?:\/\/)?(www\.)?/, "$1"),
|
450
|
+
...referer !== "/" && referer && {
|
451
|
+
referer: referer?.replace(/^(https?:\/\/)?(www\.)?/, "$1")
|
452
|
+
},
|
453
|
+
user_agent,
|
454
|
+
ip,
|
455
|
+
browser_name,
|
456
|
+
browser_version,
|
457
|
+
lang,
|
458
|
+
device: device?.includes("iPhone") ? "mobile" : device?.includes("iPad") ? "tablet" : device,
|
459
|
+
...data
|
460
|
+
})
|
461
|
+
],
|
462
|
+
headers
|
463
|
+
);
|
464
|
+
const responseStart = navigator.sendBeacon(createRequestV2(endpoint, "start"), blobData);
|
465
|
+
return responseStart;
|
466
|
+
};
|
467
|
+
var endTracker = (endPoint, event_uuid, visitor_uuid) => {
|
468
|
+
if (event_uuid && visitor_uuid) {
|
469
|
+
const body = {
|
470
|
+
event_uuid,
|
471
|
+
visitor_uuid
|
472
|
+
};
|
473
|
+
const headers = { type: "application/json" };
|
474
|
+
const blob = new Blob([JSON.stringify(body)], headers);
|
475
|
+
navigator.sendBeacon(createRequest(endPoint, "end"), blob);
|
476
|
+
}
|
477
|
+
};
|
478
|
+
var endTrackerVisibilityState = (endPoint) => {
|
479
|
+
document.addEventListener("visibilitychange", async () => {
|
480
|
+
if (document.visibilityState === "hidden") {
|
481
|
+
endTracker(endPoint, window["event_uuid"], window["visitor_uuid"]);
|
482
|
+
}
|
483
|
+
if (document.visibilityState === "visible") {
|
484
|
+
const response = await startTracker(endPoint, "", "", "", window["attributes"]);
|
485
|
+
window["event_uuid"] = response?.event_uuid;
|
486
|
+
}
|
487
|
+
});
|
488
|
+
window.addEventListener(
|
489
|
+
"pagehide",
|
490
|
+
(event) => {
|
491
|
+
if (event.persisted) {
|
492
|
+
endTracker(endPoint, window["event_uuid"], window["visitor_uuid"]);
|
493
|
+
}
|
494
|
+
},
|
495
|
+
false
|
496
|
+
);
|
497
|
+
};
|
18
498
|
|
19
499
|
// src/AnalyticsNext/handle.tsx
|
20
|
-
import React, { useCallback, useEffect, useState } from "react";
|
21
500
|
var AnalyticsHandle = ({ router, attributes, children }) => {
|
22
|
-
const AnalyticsStore =
|
501
|
+
const AnalyticsStore = React2.useContext(AnalyticsContext);
|
23
502
|
const endPoint = process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL;
|
24
|
-
const [prevRoute, setPrevRoute] =
|
503
|
+
const [prevRoute, setPrevRoute] = useState2("");
|
25
504
|
const handleStartTracker = useCallback(
|
26
505
|
async (prevRoute2, attributes2) => {
|
27
506
|
const referer = prevRoute2 ? prevRoute2 : "";
|
@@ -33,7 +512,7 @@ var AnalyticsHandle = ({ router, attributes, children }) => {
|
|
33
512
|
},
|
34
513
|
[AnalyticsStore, endPoint]
|
35
514
|
);
|
36
|
-
|
515
|
+
useEffect2(() => {
|
37
516
|
const init = async () => {
|
38
517
|
if (!AnalyticsStore.visitor_uuid) {
|
39
518
|
setPrevRoute(router.asPath);
|
@@ -42,7 +521,7 @@ var AnalyticsHandle = ({ router, attributes, children }) => {
|
|
42
521
|
};
|
43
522
|
init();
|
44
523
|
}, [AnalyticsStore.visitor_uuid]);
|
45
|
-
|
524
|
+
useEffect2(() => {
|
46
525
|
const handleRouteChange = async () => {
|
47
526
|
setPrevRoute(router.asPath);
|
48
527
|
if (AnalyticsStore.visitor_uuid) {
|
@@ -55,96 +534,36 @@ var AnalyticsHandle = ({ router, attributes, children }) => {
|
|
55
534
|
router.events.off("routeChangeComplete", handleRouteChange);
|
56
535
|
};
|
57
536
|
}, [router.events, router.asPath, router.query]);
|
58
|
-
|
537
|
+
useEffect2(() => {
|
59
538
|
const init = async () => {
|
60
539
|
endTrackerVisibilityState(endPoint);
|
61
540
|
};
|
62
541
|
init();
|
63
542
|
}, []);
|
64
|
-
|
543
|
+
useEffect2(() => {
|
65
544
|
const init = async () => {
|
66
545
|
window["event_uuid"] = AnalyticsStore.event_uuid;
|
67
546
|
window["visitor_uuid"] = AnalyticsStore.visitor_uuid;
|
68
547
|
};
|
69
548
|
init();
|
70
549
|
}, [AnalyticsStore.event_uuid, AnalyticsStore.visitor_uuid]);
|
71
|
-
return /* @__PURE__ */
|
550
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
72
551
|
};
|
73
552
|
var handle_default = AnalyticsHandle;
|
74
553
|
|
75
554
|
// src/AnalyticsNext/index.tsx
|
76
|
-
|
77
|
-
|
78
|
-
var ConsentComponentCustom = dynamic(() => import("./ConsentCustom-LYMWYNRI.js"), { ssr: false });
|
79
|
-
var AnalyticsNext = ({
|
80
|
-
router,
|
81
|
-
attributes,
|
82
|
-
oldLayout = false,
|
83
|
-
loginApp,
|
84
|
-
isLoggedApp,
|
85
|
-
isOptInReplaceAnalytics = false,
|
86
|
-
children
|
87
|
-
}) => {
|
88
|
-
const [layout, setLayout] = useState2(
|
89
|
-
process.env.NEXT_PUBLIC_CONSENT_LAYOUT ?? "simple-consent-mode"
|
90
|
-
);
|
91
|
-
const [gtagId, setGtagId] = useState2(process.env.NEXT_PUBLIC_ANALYTICS_GTAG_ID);
|
92
|
-
const [gtmId, setGtmId] = useState2(process.env.NEXT_PUBLIC_ANALYTICS_GTM_ID);
|
93
|
-
const [customConsentText, setCustomConsentText] = useState2(
|
94
|
-
process.env.NEXT_PUBLIC_ANALYTICS_CONSENT_TEXT
|
95
|
-
);
|
96
|
-
useEffect2(() => {
|
97
|
-
const init = async () => {
|
98
|
-
const data = await getConsentTemplate(
|
99
|
-
process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
100
|
-
window.location.host
|
101
|
-
);
|
102
|
-
setLayout(data?.data?.template ?? process.env.NEXT_PUBLIC_CONSENT_LAYOUT);
|
103
|
-
setGtagId(data?.data?.gtag_id ?? process.env.NEXT_PUBLIC_ANALYTICS_GTAG_ID);
|
104
|
-
setGtmId(data?.data?.gtm_id ?? process.env.NEXT_PUBLIC_ANALYTICS_GTM_ID);
|
105
|
-
setCustomConsentText(
|
106
|
-
data?.data?.consent_text ?? process.env.NEXT_PUBLIC_ANALYTICS_CONSENT_TEXT
|
107
|
-
);
|
108
|
-
};
|
109
|
-
init();
|
110
|
-
}, []);
|
111
|
-
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, oldLayout || layout === "original" ? /* @__PURE__ */ React2.createElement(
|
112
|
-
ConsentComponent,
|
113
|
-
{
|
114
|
-
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
115
|
-
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
116
|
-
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io",
|
117
|
-
loginApp,
|
118
|
-
isLoggedApp,
|
119
|
-
gtagId,
|
120
|
-
gtmId,
|
121
|
-
customConsentText
|
122
|
-
}
|
123
|
-
) : /* @__PURE__ */ React2.createElement(
|
124
|
-
ConsentComponentCustom,
|
125
|
-
{
|
126
|
-
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
127
|
-
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
128
|
-
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io",
|
129
|
-
loginApp,
|
130
|
-
isLoggedApp,
|
131
|
-
gtagId,
|
132
|
-
gtmId,
|
133
|
-
customConsentText,
|
134
|
-
layout,
|
135
|
-
isOptInReplaceAnalytics
|
136
|
-
}
|
137
|
-
)))));
|
555
|
+
var AnalyticsNext = ({ router, attributes, children }) => {
|
556
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React3.createElement(handle_default, { router, attributes }, children)));
|
138
557
|
};
|
139
558
|
var AnalyticsNext_default = AnalyticsNext;
|
140
559
|
|
141
560
|
// src/AnalyticsReact/index.tsx
|
142
|
-
import
|
561
|
+
import React5 from "react";
|
143
562
|
|
144
563
|
// src/AnalyticsReact/handle.tsx
|
145
|
-
import
|
564
|
+
import React4, { useEffect as useEffect3 } from "react";
|
146
565
|
var AnalyticsHandle2 = ({ location, history, children }) => {
|
147
|
-
const AnalyticsStore =
|
566
|
+
const AnalyticsStore = React4.useContext(AnalyticsContext);
|
148
567
|
const endPoint = process.env.REACT_APP_ENDPOINT_ANALYTICS_URL;
|
149
568
|
useEffect3(() => {
|
150
569
|
const init = async () => {
|
@@ -173,362 +592,26 @@ var AnalyticsHandle2 = ({ location, history, children }) => {
|
|
173
592
|
};
|
174
593
|
init();
|
175
594
|
}, [AnalyticsStore.event_uuid, AnalyticsStore.visitor_uuid]);
|
176
|
-
return /* @__PURE__ */
|
595
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, children);
|
177
596
|
};
|
178
597
|
var handle_default2 = AnalyticsHandle2;
|
179
598
|
|
180
599
|
// src/AnalyticsReact/index.tsx
|
181
|
-
var
|
182
|
-
|
183
|
-
var AnalyticsReact = ({
|
184
|
-
location,
|
185
|
-
history,
|
186
|
-
oldLayout = false,
|
187
|
-
isOptInReplaceAnalytics = false,
|
188
|
-
children
|
189
|
-
}) => {
|
190
|
-
const [layout, setLayout] = useState3(
|
191
|
-
process.env.REACT_APP_CONSENT_LAYOUT ?? "simple-consent-mode"
|
192
|
-
);
|
193
|
-
const [gtagId, setGtagId] = useState3(process.env.REACT_APP_ANALYTICS_GTAG_ID);
|
194
|
-
const [gtmId, setGtmId] = useState3(process.env.REACT_APP_ANALYTICS_GTM_ID);
|
195
|
-
const [customConsentText, setCustomConsentText] = useState3(
|
196
|
-
process.env.REACT_APP_ANALYTICS_CONSENT_TEXT
|
197
|
-
);
|
198
|
-
useEffect4(() => {
|
199
|
-
const init = async () => {
|
200
|
-
const data = await getConsentTemplate(
|
201
|
-
process.env.REACT_APP_ENDPOINT_ANALYTICS_URL,
|
202
|
-
window.location.host
|
203
|
-
);
|
204
|
-
setLayout(data?.data?.template ?? process.env.REACT_APP_CONSENT_LAYOUT);
|
205
|
-
setGtagId(data?.data?.gtag_id ?? process.env.REACT_APP_ANALYTICS_GTAG_ID);
|
206
|
-
setGtmId(data?.data?.gtm_id ?? process.env.REACT_APP_ANALYTICS_GTM_ID);
|
207
|
-
setCustomConsentText(
|
208
|
-
data?.data?.consent_text ?? process.env.REACT_APP_ANALYTICS_CONSENT_TEXT
|
209
|
-
);
|
210
|
-
};
|
211
|
-
init();
|
212
|
-
}, []);
|
213
|
-
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) }, oldLayout || layout === "original" ? /* @__PURE__ */ React4.createElement(
|
214
|
-
ConsentComponent2,
|
215
|
-
{
|
216
|
-
endpoint: process.env.REACT_APP_ENDPOINT_ANALYTICS_URL,
|
217
|
-
networkEnv: process.env.REACT_APP_CONCORDIUM_NETWORK,
|
218
|
-
aesirXEndpoint: process.env.REACT_APP_ENDPOINT_URL ?? "https://api.aesirx.io",
|
219
|
-
gtagId,
|
220
|
-
gtmId,
|
221
|
-
customConsentText
|
222
|
-
}
|
223
|
-
) : /* @__PURE__ */ React4.createElement(
|
224
|
-
ConsentComponentCustom2,
|
225
|
-
{
|
226
|
-
endpoint: process.env.REACT_APP_ENDPOINT_ANALYTICS_URL,
|
227
|
-
networkEnv: process.env.REACT_APP_CONCORDIUM_NETWORK,
|
228
|
-
aesirXEndpoint: process.env.REACT_APP_ENDPOINT_URL ?? "https://api.aesirx.io",
|
229
|
-
gtagId,
|
230
|
-
gtmId,
|
231
|
-
customConsentText,
|
232
|
-
layout,
|
233
|
-
isOptInReplaceAnalytics
|
234
|
-
}
|
235
|
-
))));
|
600
|
+
var AnalyticsReact = ({ location, history, children }) => {
|
601
|
+
return /* @__PURE__ */ React5.createElement(AnalyticsContextProvider_default, null, /* @__PURE__ */ React5.createElement(handle_default2, { location, history }, children));
|
236
602
|
};
|
237
603
|
var AnalyticsReact_default = AnalyticsReact;
|
238
|
-
|
239
|
-
// src/Components/OptInConsent.tsx
|
240
|
-
import React5, { useEffect as useEffect5, useState as useState4 } from "react";
|
241
|
-
import { Button, Form } from "react-bootstrap";
|
242
|
-
var endpoint = typeof window !== "undefined" && window["aesirx1stparty"] ? window["aesirx1stparty"] : process?.env?.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL ? process?.env?.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL : process?.env?.REACT_APP_ENDPOINT_ANALYTICS_URL ? process?.env?.REACT_APP_ENDPOINT_ANALYTICS_URL : "";
|
243
|
-
var OptInConsent = ({
|
244
|
-
optInConsentData = window?.optInConsentData ? JSON.parse(window?.optInConsentData) : []
|
245
|
-
}) => {
|
246
|
-
const optInReplace = optInConsentData?.find((obj) => obj.replaceAnalyticsConsent);
|
247
|
-
const { t } = useTranslation();
|
248
|
-
const [showExpandRevoke, setShowExpandRevoke] = useState4(false);
|
249
|
-
const [showRevoke, setShowRevoke] = useState4(false);
|
250
|
-
const [revokeConsentOption, setRevokeConsentOption] = useState4(
|
251
|
-
optInReplace?.title ? `aesirx-analytics-optin-${optInReplace?.title}` : "aesirx-analytics-optin-default"
|
252
|
-
);
|
253
|
-
const optInRevokes = Object.keys(sessionStorage).filter((key) => key.startsWith("aesirx-analytics-optin")).map((key) => key);
|
254
|
-
useEffect5(() => {
|
255
|
-
if (optInRevokes?.includes("aesirx-analytics-optin-default") || optInRevokes?.includes(`aesirx-analytics-optin-${optInReplace?.title}`)) {
|
256
|
-
setShowRevoke(true);
|
257
|
-
}
|
258
|
-
});
|
259
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, optInConsentData?.map((optIn, key) => /* @__PURE__ */ React5.createElement(React5.Fragment, { key }, /* @__PURE__ */ React5.createElement(OptIntConsentDetail, { optIn, setShowRevoke }))), optInReplace && /* @__PURE__ */ React5.createElement("div", { className: "aesirxconsent" }, /* @__PURE__ */ React5.createElement(
|
260
|
-
"div",
|
261
|
-
{
|
262
|
-
tabIndex: -1,
|
263
|
-
className: `toast-container position-fixed m-md-3 ${showExpandRevoke ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
|
264
|
-
},
|
265
|
-
/* @__PURE__ */ React5.createElement(
|
266
|
-
"div",
|
267
|
-
{
|
268
|
-
className: `toast revoke-toast custom ${showRevoke ? "show" : ""} ${showExpandRevoke ? "" : "minimize"}`
|
269
|
-
},
|
270
|
-
/* @__PURE__ */ React5.createElement("div", { className: "toast-body p-0 shadow mx-1 mx-md-0 mb-2 mb-md-0" }, /* @__PURE__ */ React5.createElement(
|
271
|
-
"div",
|
272
|
-
{
|
273
|
-
className: `revoke-wrapper minimize-shield-wrapper position-relative ${showExpandRevoke ? "bg-white" : ""}`
|
274
|
-
},
|
275
|
-
!showExpandRevoke && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
|
276
|
-
"img",
|
277
|
-
{
|
278
|
-
className: "cover-img position-absolute h-100 w-100 object-fit-cover",
|
279
|
-
src: bg_default,
|
280
|
-
alt: "Background Image"
|
281
|
-
}
|
282
|
-
), /* @__PURE__ */ React5.createElement(
|
283
|
-
"div",
|
284
|
-
{
|
285
|
-
className: "minimize-shield",
|
286
|
-
onClick: () => {
|
287
|
-
setShowExpandRevoke(true);
|
288
|
-
}
|
289
|
-
},
|
290
|
-
/* @__PURE__ */ React5.createElement("img", { src: privacy_default, alt: "SoP Icon" }),
|
291
|
-
window?.aesirx_analytics_translate?.txt_shield_of_privacy ?? t("txt_shield_of_privacy")
|
292
|
-
)),
|
293
|
-
showExpandRevoke && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
|
294
|
-
"div",
|
295
|
-
{
|
296
|
-
className: `d-flex rounded-top align-items-center justify-content-between p-2 p-lg-3 fw-medium flex-wrap py-2 py-lg-3 px-4 header-consent-bg`,
|
297
|
-
style: {
|
298
|
-
borderBottom: "1px solid #DEDEDE"
|
299
|
-
}
|
300
|
-
},
|
301
|
-
/* @__PURE__ */ React5.createElement("div", { className: "text-primary text-nowrap" }, window?.aesirx_analytics_translate?.txt_tracking_data_privacy ?? t("txt_tracking_data_privacy")),
|
302
|
-
/* @__PURE__ */ React5.createElement("div", { className: "d-flex align-items-center fs-14 text-primary" }, /* @__PURE__ */ React5.createElement(
|
303
|
-
"a",
|
304
|
-
{
|
305
|
-
href: "https://shield.aesirx.io/",
|
306
|
-
rel: "noreferrer",
|
307
|
-
target: "_blank",
|
308
|
-
className: "minimize-shield-wrapper position-relative text-decoration-none"
|
309
|
-
},
|
310
|
-
/* @__PURE__ */ React5.createElement(
|
311
|
-
"img",
|
312
|
-
{
|
313
|
-
className: "cover-img position-absolute h-100 w-100 object-fit-cover z-1",
|
314
|
-
src: bg_default,
|
315
|
-
alt: "Background Image"
|
316
|
-
}
|
317
|
-
),
|
318
|
-
/* @__PURE__ */ React5.createElement("div", { className: "minimize-shield position-relative z-2 py-2" }, /* @__PURE__ */ React5.createElement("img", { src: privacy_default, alt: "SoP Icon" }), window?.aesirx_analytics_translate?.txt_shield_of_privacy ?? t("txt_shield_of_privacy"))
|
319
|
-
))
|
320
|
-
), /* @__PURE__ */ React5.createElement(
|
321
|
-
"div",
|
322
|
-
{
|
323
|
-
className: "minimize-revoke",
|
324
|
-
onClick: () => {
|
325
|
-
setShowExpandRevoke(false);
|
326
|
-
}
|
327
|
-
},
|
328
|
-
/* @__PURE__ */ React5.createElement("img", { src: no_default, alt: "No Icon" })
|
329
|
-
), /* @__PURE__ */ React5.createElement("div", { className: "p-3 bg-white" }, window?.aesirx_analytics_translate?.txt_you_can_revoke ?? t("txt_you_can_revoke")), /* @__PURE__ */ React5.createElement(Form, { className: "mb-0 w-100 bg-white px-3" }, optInRevokes?.map((item, key) => {
|
330
|
-
return /* @__PURE__ */ React5.createElement(
|
331
|
-
Form.Check,
|
332
|
-
{
|
333
|
-
key,
|
334
|
-
id: `option-revoke-${item}`,
|
335
|
-
checked: revokeConsentOption === item,
|
336
|
-
type: "checkbox",
|
337
|
-
label: item === "aesirx-analytics-optin-default" ? window?.aesirx_analytics_translate?.txt_revoke_opt_in ?? t("txt_revoke_opt_in") : window?.aesirx_analytics_translate?.txt_revoke_opt_in ?? t("txt_revoke_opt_in") + " " + item?.replace("aesirx-analytics-optin-", ""),
|
338
|
-
value: item,
|
339
|
-
onChange: ({ target: { value } }) => {
|
340
|
-
setRevokeConsentOption(value);
|
341
|
-
}
|
342
|
-
}
|
343
|
-
);
|
344
|
-
})), /* @__PURE__ */ React5.createElement("div", { className: "rounded-bottom position-relative overflow-hidden bg-white" }, /* @__PURE__ */ React5.createElement("div", { className: "position-relative p-3" }, /* @__PURE__ */ React5.createElement("div", { className: "d-flex align-items-center flex-wrap" }, /* @__PURE__ */ React5.createElement("div", { className: "d-flex align-items-center w-100 justify-content-end" }, /* @__PURE__ */ React5.createElement(
|
345
|
-
"a",
|
346
|
-
{
|
347
|
-
className: "manage-consent fs-14 btn btn-outline-success rounded-pill py-2 py-lg-3 d-flex align-items-center justify-content-center w-100 w-lg-35",
|
348
|
-
href: "https://dapp.shield.aesirx.io/revoke-consent",
|
349
|
-
target: "_blank",
|
350
|
-
rel: "noreferrer"
|
351
|
-
},
|
352
|
-
window?.aesirx_analytics_translate?.txt_manage_consent ?? t("txt_manage_consent")
|
353
|
-
), /* @__PURE__ */ React5.createElement(
|
354
|
-
Button,
|
355
|
-
{
|
356
|
-
variant: "outline-success",
|
357
|
-
onClick: async () => {
|
358
|
-
if (revokeConsentOption) {
|
359
|
-
sessionStorage.removeItem(revokeConsentOption);
|
360
|
-
setShowExpandRevoke(false);
|
361
|
-
if (revokeConsentOption === `aesirx-analytics-optin-${optInReplace?.title}` || revokeConsentOption === "aesirx-analytics-optin-default") {
|
362
|
-
setTimeout(() => {
|
363
|
-
window.location.reload();
|
364
|
-
}, 1e3);
|
365
|
-
}
|
366
|
-
}
|
367
|
-
},
|
368
|
-
className: "d-flex align-items-center justify-content-center w-100 w-lg-35 revoke-btn fs-14 rounded-pill py-2 py-lg-3"
|
369
|
-
},
|
370
|
-
window?.aesirx_analytics_translate?.txt_revoke_consent ?? t("txt_revoke_consent")
|
371
|
-
))))))
|
372
|
-
))
|
373
|
-
)
|
374
|
-
)));
|
375
|
-
};
|
376
|
-
var OptIntConsentDetail = ({ optIn, setShowRevoke }) => {
|
377
|
-
const { t } = useTranslation();
|
378
|
-
const [show, setShow] = useState4(false);
|
379
|
-
const [showBackdrop, setShowBackdrop] = useState4(true);
|
380
|
-
const [showExpandConsent, setShowExpandConsent] = useState4(true);
|
381
|
-
const handleConsent = () => {
|
382
|
-
setShow(false);
|
383
|
-
setShowBackdrop(false);
|
384
|
-
sessionStorage.setItem(
|
385
|
-
optIn?.title ? `aesirx-analytics-optin-${optIn?.title}` : "aesirx-analytics-optin-default",
|
386
|
-
"true"
|
387
|
-
);
|
388
|
-
if (optIn?.replaceAnalyticsConsent) {
|
389
|
-
setShowRevoke(true);
|
390
|
-
}
|
391
|
-
optIn?.handleConsent && optIn?.handleConsent();
|
392
|
-
window?.funcAfterOptInConsent && window.funcAfterOptInConsent();
|
393
|
-
window?.optInConsentData && document.querySelector(`.opt-in-consent.${optIn?.title}`).classList.remove("show");
|
394
|
-
const hostUrl = endpoint ? endpoint : "";
|
395
|
-
const root = hostUrl ? hostUrl.replace(/\/$/, "") : "";
|
396
|
-
root && trackEvent(root, "", {
|
397
|
-
event_name: "Opt-in consent",
|
398
|
-
event_type: "opt-in-consent"
|
399
|
-
});
|
400
|
-
};
|
401
|
-
const handleClose = () => {
|
402
|
-
setShow(false);
|
403
|
-
setShowBackdrop(false);
|
404
|
-
if (optIn?.replaceAnalyticsConsent) {
|
405
|
-
setShowExpandConsent(false);
|
406
|
-
sessionStorage.setItem("aesirx-analytics-rejected", "true");
|
407
|
-
}
|
408
|
-
optIn?.handleReject && optIn?.handleReject();
|
409
|
-
window.funcAfterRejectOptIn && window.funcAfterRejectOptIn();
|
410
|
-
window?.optInConsentData && document.querySelector(`.opt-in-consent.${optIn?.title}`).classList.remove("show");
|
411
|
-
};
|
412
|
-
useEffect5(() => {
|
413
|
-
if (sessionStorage.getItem(`aesirx-analytics-optin-${optIn?.title}`) === "true" || sessionStorage.getItem("aesirx-analytics-optin-default") === "true") {
|
414
|
-
window.funcAfterOptInConsent && window.funcAfterOptInConsent();
|
415
|
-
}
|
416
|
-
if (optIn?.replaceAnalyticsConsent === "true") {
|
417
|
-
if (sessionStorage.getItem("aesirx-analytics-rejected") === "true") {
|
418
|
-
setShow(false);
|
419
|
-
setShowExpandConsent(false);
|
420
|
-
} else if (sessionStorage.getItem(`aesirx-analytics-optin-${optIn?.title}`) !== "true") {
|
421
|
-
setShow(true);
|
422
|
-
}
|
423
|
-
}
|
424
|
-
}, []);
|
425
|
-
useEffect5(() => {
|
426
|
-
if (optIn?.show) {
|
427
|
-
setShow(true);
|
428
|
-
}
|
429
|
-
}, [optIn]);
|
430
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, (show || optIn?.replaceAnalyticsConsent || window?.optInConsentData) && /* @__PURE__ */ React5.createElement(
|
431
|
-
"div",
|
432
|
-
{
|
433
|
-
className: `aesirxconsent opt-in-consent ${optIn?.title ?? ""} ${show ? "show" : ""} ${showExpandConsent ? "" : "show-minimize"}`
|
434
|
-
},
|
435
|
-
/* @__PURE__ */ React5.createElement("div", { className: `offcanvas-backdrop fade ${showBackdrop && show ? "show" : "d-none"}` }),
|
436
|
-
/* @__PURE__ */ React5.createElement(
|
437
|
-
"div",
|
438
|
-
{
|
439
|
-
tabIndex: -1,
|
440
|
-
className: `toast-container position-fixed m-md-3 ${show ? "" : "opacity-0"}`
|
441
|
-
},
|
442
|
-
/* @__PURE__ */ React5.createElement(
|
443
|
-
"div",
|
444
|
-
{
|
445
|
-
className: `toast ${show ? "show" : ""} custom ${showExpandConsent ? "" : "minimize"}`
|
446
|
-
},
|
447
|
-
/* @__PURE__ */ React5.createElement("div", { className: "toast-body p-0 shadow mx-3 mx-md-0" }, !showExpandConsent && optIn?.replaceAnalyticsConsent ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { className: "minimize-shield-wrapper position-relative" }, /* @__PURE__ */ React5.createElement(
|
448
|
-
"img",
|
449
|
-
{
|
450
|
-
className: "cover-img position-absolute h-100 w-100 object-fit-cover",
|
451
|
-
src: bg_default,
|
452
|
-
alt: "Background Image"
|
453
|
-
}
|
454
|
-
), /* @__PURE__ */ React5.createElement(
|
455
|
-
"div",
|
456
|
-
{
|
457
|
-
className: "minimize-shield",
|
458
|
-
onClick: () => {
|
459
|
-
setShow(true);
|
460
|
-
setShowExpandConsent(true);
|
461
|
-
sessionStorage.removeItem("aesirx-analytics-rejected");
|
462
|
-
}
|
463
|
-
},
|
464
|
-
/* @__PURE__ */ React5.createElement("img", { src: privacy_default, alt: "SoP Icon" }),
|
465
|
-
window?.aesirx_analytics_translate?.txt_shield_of_privacy ?? t("txt_shield_of_privacy")
|
466
|
-
))) : /* @__PURE__ */ React5.createElement("div", { className: "bg-white" }, /* @__PURE__ */ React5.createElement(
|
467
|
-
"div",
|
468
|
-
{
|
469
|
-
className: `d-flex rounded-top align-items-center justify-content-between p-2 p-lg-3 fw-medium flex-wrap py-2 py-lg-3 px-4 header-consent-bg`,
|
470
|
-
style: {
|
471
|
-
borderBottom: "1px solid #DEDEDE"
|
472
|
-
}
|
473
|
-
},
|
474
|
-
/* @__PURE__ */ React5.createElement("div", { className: "text-primary text-nowrap" }, window?.aesirx_analytics_translate?.txt_tracking_data_privacy ?? t("txt_tracking_data_privacy")),
|
475
|
-
/* @__PURE__ */ React5.createElement("div", { className: "d-flex align-items-center fs-14 text-primary" }, /* @__PURE__ */ React5.createElement(
|
476
|
-
"a",
|
477
|
-
{
|
478
|
-
href: "https://shield.aesirx.io/",
|
479
|
-
rel: "noreferrer",
|
480
|
-
target: "_blank",
|
481
|
-
className: "minimize-shield-wrapper position-relative text-decoration-none"
|
482
|
-
},
|
483
|
-
/* @__PURE__ */ React5.createElement(
|
484
|
-
"img",
|
485
|
-
{
|
486
|
-
className: "cover-img position-absolute h-100 w-100 object-fit-cover z-1",
|
487
|
-
src: bg_default,
|
488
|
-
alt: "Background Image"
|
489
|
-
}
|
490
|
-
),
|
491
|
-
/* @__PURE__ */ React5.createElement("div", { className: "minimize-shield position-relative z-2 py-2" }, /* @__PURE__ */ React5.createElement("img", { src: privacy_default, alt: "SoP Icon" }), window?.aesirx_analytics_translate?.txt_shield_of_privacy ?? t("txt_shield_of_privacy"))
|
492
|
-
))
|
493
|
-
), /* @__PURE__ */ React5.createElement("div", { className: "p-4 pt-3 pb-0 bg-white" }, /* @__PURE__ */ React5.createElement(
|
494
|
-
"div",
|
495
|
-
{
|
496
|
-
dangerouslySetInnerHTML: {
|
497
|
-
__html: optIn?.content ?? ""
|
498
|
-
}
|
499
|
-
}
|
500
|
-
)), /* @__PURE__ */ React5.createElement("div", { className: "rounded-bottom position-relative overflow-hidden text-white bg-white" }, /* @__PURE__ */ React5.createElement("div", { className: "position-relative pt-2 pt-lg-3 p-3" }, /* @__PURE__ */ React5.createElement("div", { className: "d-flex align-items-center justify-content-between flex-wrap" }, /* @__PURE__ */ React5.createElement(
|
501
|
-
Button,
|
502
|
-
{
|
503
|
-
onClick: handleClose,
|
504
|
-
variant: "outline-success",
|
505
|
-
className: "border-2 fs-7 fw-bold text-primary rounded-pill"
|
506
|
-
},
|
507
|
-
window?.aesirx_analytics_translate?.txt_reject_consent ?? t("txt_reject_consent")
|
508
|
-
), /* @__PURE__ */ React5.createElement(
|
509
|
-
Button,
|
510
|
-
{
|
511
|
-
onClick: handleConsent,
|
512
|
-
variant: "outline-success",
|
513
|
-
className: "border-2 fs-7 fw-bold text-primary rounded-pill"
|
514
|
-
},
|
515
|
-
window?.aesirx_analytics_translate?.txt_yes_i_consent ?? t("txt_yes_i_consent")
|
516
|
-
))))))
|
517
|
-
)
|
518
|
-
)
|
519
|
-
));
|
520
|
-
};
|
521
|
-
var OptInConsent_default = OptInConsent;
|
522
604
|
export {
|
523
605
|
AnalyticsContext,
|
524
606
|
AnalyticsContextProvider_default as AnalyticsContextProvider,
|
525
607
|
AnalyticsNext_default as AnalyticsNext,
|
526
|
-
handle_default as AnalyticsNextHandle,
|
527
608
|
AnalyticsReact_default as AnalyticsReact,
|
528
|
-
handle_default2 as AnalyticsReactHandle,
|
529
|
-
OptInConsent_default as OptInConsent,
|
530
609
|
endTrackerVisibilityState,
|
531
610
|
fingerprint_default as getFingerprint,
|
532
611
|
startTracker,
|
533
612
|
trackEvent
|
534
613
|
};
|
614
|
+
/*
|
615
|
+
* @copyright Copyright (C) 2022 AesirX. All rights reserved.
|
616
|
+
* @license GNU General Public License version 3, see LICENSE.
|
617
|
+
*/
|