aesirx-analytics 2.2.3 → 2.2.5
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-ZWVGMKB7.js +676 -0
- package/dist/ConsentCustom-P3FMYMS3.js +828 -0
- package/dist/analytics.js +463 -151
- package/dist/{chunk-ZYCOHH2R.js → chunk-JH54YDTD.js} +246 -11
- package/dist/{Consent-HRGYMPE6.js → chunk-PHG7RB3K.js} +500 -673
- package/dist/index.d.ts +8 -2
- package/dist/index.js +48 -16
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
@@ -3,9 +3,13 @@ import { NextRouter } from 'next/router';
|
|
3
3
|
|
4
4
|
interface AnalyticsNext {
|
5
5
|
router: NextRouter;
|
6
|
+
attributes: any;
|
7
|
+
oldLayout?: boolean;
|
8
|
+
loginApp?: any;
|
9
|
+
isLoggedApp?: boolean;
|
6
10
|
children?: ReactNode;
|
7
11
|
}
|
8
|
-
declare const AnalyticsNext: ({ router, children }: AnalyticsNext) => React.JSX.Element;
|
12
|
+
declare const AnalyticsNext: ({ router, attributes, oldLayout, loginApp, isLoggedApp, children, }: AnalyticsNext) => React.JSX.Element;
|
9
13
|
|
10
14
|
interface AnalyticsReact {
|
11
15
|
location: {
|
@@ -16,8 +20,9 @@ interface AnalyticsReact {
|
|
16
20
|
replace: (_: object) => void;
|
17
21
|
};
|
18
22
|
children?: ReactNode;
|
23
|
+
oldLayout?: boolean;
|
19
24
|
}
|
20
|
-
declare const AnalyticsReact: ({ location, history, children }: AnalyticsReact) => React.JSX.Element;
|
25
|
+
declare const AnalyticsReact: ({ location, history, oldLayout, children }: AnalyticsReact) => React.JSX.Element;
|
21
26
|
|
22
27
|
declare const trackEvent: (endpoint: string, referer?: string, data?: object) => Promise<boolean>;
|
23
28
|
|
@@ -26,6 +31,7 @@ interface AnalyticsContextType {
|
|
26
31
|
visitor_uuid: string;
|
27
32
|
setEventID: Dispatch<SetStateAction<string>>;
|
28
33
|
setUUID: Dispatch<SetStateAction<string>>;
|
34
|
+
ref: any;
|
29
35
|
}
|
30
36
|
declare const AnalyticsContext: React.Context<AnalyticsContextType>;
|
31
37
|
|
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-JH54YDTD.js";
|
5
5
|
|
6
6
|
// src/AnalyticsNext/index.tsx
|
7
7
|
import React2 from "react";
|
@@ -330,7 +330,7 @@ var createRequestV2 = (endpoint, task) => {
|
|
330
330
|
var rememberFlow = (endpoint, flow) => {
|
331
331
|
return `${endpoint}/remember_flow/${flow}`;
|
332
332
|
};
|
333
|
-
var startTracker = async (endpoint, url, referer, user_agent) => {
|
333
|
+
var startTracker = async (endpoint, url, referer, user_agent, attributesVisit) => {
|
334
334
|
const allow = sessionStorage.getItem("aesirx-analytics-allow");
|
335
335
|
if (allow === "0") {
|
336
336
|
return null;
|
@@ -356,9 +356,14 @@ var startTracker = async (endpoint, url, referer, user_agent) => {
|
|
356
356
|
urlParams.get(key) && attributes.push({ name: key, value: urlParams.get(key) });
|
357
357
|
}
|
358
358
|
}
|
359
|
+
if (attributesVisit?.length) {
|
360
|
+
attributesVisit?.forEach((element) => {
|
361
|
+
element?.name && attributes.push({ name: element?.name, value: element?.value });
|
362
|
+
});
|
363
|
+
}
|
359
364
|
const responseStart = await trackerService(createRequestV2(endpoint, "start"), {
|
360
365
|
fingerprint,
|
361
|
-
url,
|
366
|
+
url: url?.replace(/^(https?:\/\/)?(www\.)?/, "$1"),
|
362
367
|
...referer && (referer !== url || document2.referrer) && {
|
363
368
|
referer: referer !== url ? referer : document2.referrer
|
364
369
|
},
|
@@ -458,15 +463,15 @@ var endTrackerVisibilityState = (endPoint) => {
|
|
458
463
|
};
|
459
464
|
|
460
465
|
// src/AnalyticsNext/handle.tsx
|
461
|
-
var AnalyticsHandle = ({ router, children }) => {
|
466
|
+
var AnalyticsHandle = ({ router, attributes, children }) => {
|
462
467
|
const AnalyticsStore = React.useContext(AnalyticsContext);
|
463
468
|
const endPoint = process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL;
|
464
469
|
const [prevRoute, setPrevRoute] = useState("");
|
465
470
|
const handleStartTracker = useCallback(
|
466
|
-
async (prevRoute2) => {
|
471
|
+
async (prevRoute2, attributes2) => {
|
467
472
|
const referer = prevRoute2 ? prevRoute2 : "";
|
468
473
|
window["referer"] = referer;
|
469
|
-
const responseStart = await startTracker(endPoint, "", referer);
|
474
|
+
const responseStart = await startTracker(endPoint, "", referer, "", attributes2);
|
470
475
|
responseStart?.event_uuid && AnalyticsStore.setEventID(responseStart.event_uuid);
|
471
476
|
responseStart?.visitor_uuid && AnalyticsStore.setUUID(responseStart.visitor_uuid);
|
472
477
|
},
|
@@ -476,7 +481,7 @@ var AnalyticsHandle = ({ router, children }) => {
|
|
476
481
|
const init = async () => {
|
477
482
|
if (!AnalyticsStore.visitor_uuid) {
|
478
483
|
setPrevRoute(router.asPath);
|
479
|
-
await handleStartTracker(router.asPath);
|
484
|
+
await handleStartTracker(router.asPath, attributes);
|
480
485
|
}
|
481
486
|
};
|
482
487
|
init();
|
@@ -486,7 +491,7 @@ var AnalyticsHandle = ({ router, children }) => {
|
|
486
491
|
setPrevRoute(router.asPath);
|
487
492
|
if (AnalyticsStore.visitor_uuid) {
|
488
493
|
endTracker(endPoint, window["event_uuid"], AnalyticsStore.visitor_uuid);
|
489
|
-
await handleStartTracker(prevRoute);
|
494
|
+
await handleStartTracker(prevRoute, attributes);
|
490
495
|
}
|
491
496
|
};
|
492
497
|
router.events.on("routeChangeComplete", handleRouteChange);
|
@@ -513,16 +518,35 @@ var handle_default = AnalyticsHandle;
|
|
513
518
|
|
514
519
|
// src/AnalyticsNext/index.tsx
|
515
520
|
import dynamic from "next/dynamic";
|
516
|
-
var ConsentComponent = dynamic(() => import("./Consent-
|
517
|
-
var
|
518
|
-
|
521
|
+
var ConsentComponent = dynamic(() => import("./Consent-ZWVGMKB7.js"), { ssr: false });
|
522
|
+
var ConsentComponentCustom = dynamic(() => import("./ConsentCustom-P3FMYMS3.js"), { ssr: false });
|
523
|
+
var AnalyticsNext = ({
|
524
|
+
router,
|
525
|
+
attributes,
|
526
|
+
oldLayout = false,
|
527
|
+
loginApp,
|
528
|
+
isLoggedApp,
|
529
|
+
children
|
530
|
+
}) => {
|
531
|
+
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 ? /* @__PURE__ */ React2.createElement(
|
519
532
|
ConsentComponent,
|
520
533
|
{
|
521
534
|
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
522
535
|
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
523
|
-
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io"
|
536
|
+
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io",
|
537
|
+
loginApp,
|
538
|
+
isLoggedApp
|
524
539
|
}
|
525
|
-
)
|
540
|
+
) : /* @__PURE__ */ React2.createElement(
|
541
|
+
ConsentComponentCustom,
|
542
|
+
{
|
543
|
+
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
544
|
+
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
545
|
+
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io",
|
546
|
+
loginApp,
|
547
|
+
isLoggedApp
|
548
|
+
}
|
549
|
+
)))));
|
526
550
|
};
|
527
551
|
var AnalyticsNext_default = AnalyticsNext;
|
528
552
|
|
@@ -566,15 +590,23 @@ var AnalyticsHandle2 = ({ location, history, children }) => {
|
|
566
590
|
var handle_default2 = AnalyticsHandle2;
|
567
591
|
|
568
592
|
// src/AnalyticsReact/index.tsx
|
569
|
-
var ConsentComponent2 = React4.lazy(() => import("./Consent-
|
570
|
-
var
|
571
|
-
|
593
|
+
var ConsentComponent2 = React4.lazy(() => import("./Consent-ZWVGMKB7.js"));
|
594
|
+
var ConsentComponentCustom2 = React4.lazy(() => import("./ConsentCustom-P3FMYMS3.js"));
|
595
|
+
var AnalyticsReact = ({ location, history, oldLayout = false, children }) => {
|
596
|
+
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 ? /* @__PURE__ */ React4.createElement(
|
572
597
|
ConsentComponent2,
|
573
598
|
{
|
574
599
|
endpoint: process.env.REACT_APP_ENDPOINT_ANALYTICS_URL,
|
575
600
|
networkEnv: process.env.REACT_APP_CONCORDIUM_NETWORK,
|
576
601
|
aesirXEndpoint: process.env.REACT_APP_ENDPOINT_URL ?? "https://api.aesirx.io"
|
577
602
|
}
|
603
|
+
) : /* @__PURE__ */ React4.createElement(
|
604
|
+
ConsentComponentCustom2,
|
605
|
+
{
|
606
|
+
endpoint: process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL,
|
607
|
+
networkEnv: process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK,
|
608
|
+
aesirXEndpoint: process.env.NEXT_PUBLIC_ENDPOINT_URL ?? "https://api.aesirx.io"
|
609
|
+
}
|
578
610
|
))));
|
579
611
|
};
|
580
612
|
var AnalyticsReact_default = AnalyticsReact;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "aesirx-analytics",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.5",
|
4
4
|
"license": "GPL-3.0-only",
|
5
5
|
"author": "AesirX",
|
6
6
|
"repository": "https://gitlab.redweb.dk/aesirx/analytics",
|
@@ -14,20 +14,20 @@
|
|
14
14
|
"@concordium/web-sdk": "^7.0.4-rc.3",
|
15
15
|
"@web3modal/ethereum": "^2.7.0",
|
16
16
|
"@web3modal/react": "^2.7.0",
|
17
|
-
"aesirx-sso": "^1.4.
|
17
|
+
"aesirx-sso": "^1.4.6",
|
18
18
|
"axios": "^1.6.0",
|
19
19
|
"bootstrap": "^5.3.2",
|
20
20
|
"bowser": "^2.11.0",
|
21
21
|
"buffer": "^6.0.3",
|
22
22
|
"ethers": "^6.6.5",
|
23
23
|
"i18next": "^23.6.0",
|
24
|
-
"i18next-browser-languagedetector": "^7.1
|
24
|
+
"i18next-browser-languagedetector": "^7.2.1",
|
25
25
|
"murmurhash-js": "^1.0.0",
|
26
|
-
"next": "^
|
26
|
+
"next": "^14.1.0",
|
27
27
|
"query-string": "^7.1.1",
|
28
|
-
"react": "^18.
|
28
|
+
"react": "^18.3.1",
|
29
29
|
"react-bootstrap": "^2.8.0",
|
30
|
-
"react-content-loader": "^
|
30
|
+
"react-content-loader": "^7.0.0",
|
31
31
|
"react-device-detect": "^2.2.3",
|
32
32
|
"react-dom": "18",
|
33
33
|
"react-toastify": "^9.1.3",
|
@@ -63,20 +63,20 @@
|
|
63
63
|
]
|
64
64
|
},
|
65
65
|
"devDependencies": {
|
66
|
-
"@babel/preset-env": "^7.
|
66
|
+
"@babel/preset-env": "^7.24.5",
|
67
67
|
"@babel/preset-typescript": "^7.23.0",
|
68
68
|
"@jest/globals": "^29.7.0",
|
69
69
|
"@types/jest": "^29.5.0",
|
70
70
|
"@types/murmurhash-js": "^1.0.3",
|
71
71
|
"@types/node": "^20.8.0",
|
72
|
-
"@types/react": "^18.
|
72
|
+
"@types/react": "^18.3.1",
|
73
73
|
"@types/react-dom": "^18.2.14",
|
74
74
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
75
75
|
"@typescript-eslint/parser": "^5.57.0",
|
76
76
|
"@walletconnect/types": "^2.10.0",
|
77
77
|
"dotenv": "^16.0.3",
|
78
78
|
"esbuild-plugin-inline-image": "^0.0.9",
|
79
|
-
"esbuild-sass-plugin": "^
|
79
|
+
"esbuild-sass-plugin": "^3.0.0",
|
80
80
|
"esbuild-scss-modules-plugin": "^1.1.1",
|
81
81
|
"eslint": "^8.48.0",
|
82
82
|
"eslint-plugin-react": "^7.33.2",
|