aesirx-analytics 2.2.17 → 2.2.19
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 +7 -7
- package/dist/{Consent-LAJMH5O6.js → Consent-TGYEV2XV.js} +37 -21
- package/dist/{ConsentCustom-FMWN7JO6.js → ConsentCustom-IBIHKHPV.js} +49 -28
- package/dist/analytics.js +129 -114
- package/dist/{chunk-P35CM6LS.js → chunk-EL2DBQXP.js} +38 -15
- package/dist/{chunk-PGOKXH35.js → chunk-ZC2ONV6W.js} +37 -14
- package/dist/index.js +29 -9
- package/package.json +2 -2
package/README.md
CHANGED
@@ -286,13 +286,10 @@ Please follow below CSS example:
|
|
286
286
|
## Choose template for Consent modal
|
287
287
|
|
288
288
|
There is 5 template for Consent modal
|
289
|
-
1.
|
290
|
-
2. default (recommend)
|
291
|
-
3. simple-consent-mode
|
292
|
-
1. Support Basic Consent Mode v2
|
293
|
-
4. advance-consent-mode
|
289
|
+
1. default (recommend)
|
294
290
|
1. Support Advance Consent Mode v2
|
295
|
-
|
291
|
+
2. simple-consent-mode
|
292
|
+
1. Support Basic Consent Mode v2
|
296
293
|
|
297
294
|
#### Usage in SSR site:
|
298
295
|
```
|
@@ -325,7 +322,10 @@ NEXT_PUBLIC_CONSENT_LAYOUT=default
|
|
325
322
|
"title":"payment",
|
326
323
|
"content":"<div>YOUR_CONTENT_INPUT_HERE</div>"
|
327
324
|
}
|
328
|
-
]
|
325
|
+
]`;
|
326
|
+
|
327
|
+
//trigger open optIn consent with Javascript
|
328
|
+
document.querySelector('.opt-in-consent.payment').classList.add('show');
|
329
329
|
</script>
|
330
330
|
```
|
331
331
|
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
WALLET_CONNECT,
|
8
8
|
getWeb3ID,
|
9
9
|
useConsentStatus_default
|
10
|
-
} from "./chunk-
|
10
|
+
} from "./chunk-ZC2ONV6W.js";
|
11
11
|
import {
|
12
12
|
AnalyticsContext,
|
13
13
|
agreeConsents,
|
@@ -24,7 +24,7 @@ import {
|
|
24
24
|
revokeConsents,
|
25
25
|
useTranslation,
|
26
26
|
verifySignature
|
27
|
-
} from "./chunk-
|
27
|
+
} from "./chunk-EL2DBQXP.js";
|
28
28
|
|
29
29
|
// src/Components/Consent.tsx
|
30
30
|
import React, { Suspense, useContext, useEffect, useState } from "react";
|
@@ -544,31 +544,45 @@ var ConsentComponentApp = (props) => {
|
|
544
544
|
const element = document.querySelector(selector);
|
545
545
|
element.click();
|
546
546
|
};
|
547
|
-
const loadConsentDefault = (gtagId2, gtmId2) => {
|
547
|
+
const loadConsentDefault = async (gtagId2, gtmId2) => {
|
548
548
|
window.dataLayer = window.dataLayer || [];
|
549
549
|
function gtag(p0, p1, p2) {
|
550
550
|
dataLayer.push(arguments);
|
551
551
|
}
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
gtag("js", /* @__PURE__ */ new Date());
|
561
|
-
gtag("config", `${gtagId2}`);
|
562
|
-
}
|
563
|
-
if (gtmId2) {
|
564
|
-
dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
565
|
-
}
|
566
|
-
if (layout === "advance-consent-mode") {
|
567
|
-
gtagId2 && loadGtagScript(gtagId2);
|
568
|
-
gtmId2 && loadGtmScript(gtmId2);
|
552
|
+
if (layout !== "simple-consent-mode" && sessionStorage.getItem("consentGranted") !== "true") {
|
553
|
+
gtag("consent", "default", {
|
554
|
+
ad_user_data: "denied",
|
555
|
+
ad_personalization: "denied",
|
556
|
+
ad_storage: "denied",
|
557
|
+
analytics_storage: "denied",
|
558
|
+
wait_for_update: 500
|
559
|
+
});
|
569
560
|
gtag("set", "url_passthrough", true);
|
570
561
|
gtag("set", "ads_data_redaction", true);
|
571
562
|
}
|
563
|
+
if ((layout !== "simple-consent-mode" || sessionStorage.getItem("consentGranted") === "true") && (gtmId2 && !document.querySelector(
|
564
|
+
`script[src="https://www.googletagmanager.com/gtm.js?id=${gtmId2}"]`
|
565
|
+
) || gtagId2 && !document.querySelector(
|
566
|
+
`script[src="https://www.googletagmanager.com/gtag/js?id=${gtagId2}"]`
|
567
|
+
))) {
|
568
|
+
gtagId2 && await loadGtagScript(gtagId2);
|
569
|
+
gtmId2 && await loadGtmScript(gtmId2);
|
570
|
+
if (gtagId2) {
|
571
|
+
gtag("js", /* @__PURE__ */ new Date());
|
572
|
+
gtag("config", `${gtagId2}`);
|
573
|
+
}
|
574
|
+
if (gtmId2) {
|
575
|
+
dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
576
|
+
}
|
577
|
+
}
|
578
|
+
if (sessionStorage.getItem("consentGranted") === "true") {
|
579
|
+
gtag("consent", "update", {
|
580
|
+
ad_user_data: "granted",
|
581
|
+
ad_personalization: "granted",
|
582
|
+
ad_storage: "granted",
|
583
|
+
analytics_storage: "granted"
|
584
|
+
});
|
585
|
+
}
|
572
586
|
};
|
573
587
|
useEffect(() => {
|
574
588
|
if (activeConnectorError) {
|
@@ -580,8 +594,10 @@ var ConsentComponentApp = (props) => {
|
|
580
594
|
setShowBackdrop(false);
|
581
595
|
setShowExpandConsent(false);
|
582
596
|
}
|
583
|
-
(gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
|
584
597
|
}, []);
|
598
|
+
useEffect(() => {
|
599
|
+
(gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
|
600
|
+
}, [layout]);
|
585
601
|
console.log("level", uuid, level, web3ID, account, loading);
|
586
602
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(ToastContainer, null), /* @__PURE__ */ React.createElement("div", { className: `offcanvas-backdrop fade ${showBackdrop && show ? "show" : "d-none"}` }), /* @__PURE__ */ React.createElement(
|
587
603
|
"div",
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
check_circle_default,
|
12
12
|
getWeb3ID,
|
13
13
|
useConsentStatus_default
|
14
|
-
} from "./chunk-
|
14
|
+
} from "./chunk-ZC2ONV6W.js";
|
15
15
|
import {
|
16
16
|
AnalyticsContext,
|
17
17
|
agreeConsents,
|
@@ -28,7 +28,7 @@ import {
|
|
28
28
|
revokeConsents,
|
29
29
|
useTranslation,
|
30
30
|
verifySignature
|
31
|
-
} from "./chunk-
|
31
|
+
} from "./chunk-EL2DBQXP.js";
|
32
32
|
|
33
33
|
// src/Components/ConsentCustom.tsx
|
34
34
|
import React, { Suspense, useContext, useEffect, useState } from "react";
|
@@ -72,7 +72,8 @@ var ConsentComponentCustom = ({
|
|
72
72
|
gtagId,
|
73
73
|
gtmId,
|
74
74
|
layout,
|
75
|
-
isOptInReplaceAnalytics
|
75
|
+
isOptInReplaceAnalytics,
|
76
|
+
customConsentText
|
76
77
|
}) => {
|
77
78
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, !isOptInReplaceAnalytics ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(WithWalletConnector, { network: networkEnv === "testnet" ? TESTNET : MAINNET }, (props) => /* @__PURE__ */ React.createElement(
|
78
79
|
ConsentComponentCustomWrapper,
|
@@ -84,7 +85,8 @@ var ConsentComponentCustom = ({
|
|
84
85
|
isLoggedApp,
|
85
86
|
gtagId,
|
86
87
|
gtmId,
|
87
|
-
layout
|
88
|
+
layout,
|
89
|
+
customConsentText
|
88
90
|
}
|
89
91
|
))) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
90
92
|
};
|
@@ -113,6 +115,7 @@ var ConsentComponentCustomWrapper = (props) => {
|
|
113
115
|
gtagId: props?.gtagId,
|
114
116
|
gtmId: props?.gtmId,
|
115
117
|
layout: props?.layout,
|
118
|
+
customConsentText: props?.customConsentText,
|
116
119
|
uuid,
|
117
120
|
level,
|
118
121
|
connection,
|
@@ -136,6 +139,7 @@ var ConsentComponentCustomApp = (props) => {
|
|
136
139
|
gtagId,
|
137
140
|
gtmId,
|
138
141
|
layout,
|
142
|
+
customConsentText,
|
139
143
|
activeConnectorType,
|
140
144
|
activeConnector,
|
141
145
|
activeConnectorError,
|
@@ -180,8 +184,8 @@ var ConsentComponentCustomApp = (props) => {
|
|
180
184
|
const { t } = useTranslation();
|
181
185
|
const gRPCClient = useGrpcClient(network);
|
182
186
|
const revoke = sessionStorage.getItem("aesirx-analytics-revoke");
|
183
|
-
const { address, connector } = (layout === "simple-consent-mode" ||
|
184
|
-
const { signMessage } = (layout === "simple-consent-mode" ||
|
187
|
+
const { address, connector } = (layout === "simple-consent-mode" || level === 1) && (!revoke || revoke === "0" || revoke === "1") ? { address: "", connector: "" } : useAccount();
|
188
|
+
const { signMessage } = (layout === "simple-consent-mode" || level === 1) && (!revoke || revoke === "0" || revoke === "1") ? { signMessage: {} } : useSignMessage({
|
185
189
|
async onSuccess(data, variables) {
|
186
190
|
const signature = Buffer.from(
|
187
191
|
typeof data === "object" && data !== null ? JSON.stringify(data) : data,
|
@@ -638,8 +642,10 @@ var ConsentComponentCustomApp = (props) => {
|
|
638
642
|
if (sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0") {
|
639
643
|
window.funcAfterConsent && window.funcAfterConsent();
|
640
644
|
}
|
641
|
-
(gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
|
642
645
|
}, []);
|
646
|
+
useEffect(() => {
|
647
|
+
(gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
|
648
|
+
}, [layout]);
|
643
649
|
useEffect(() => {
|
644
650
|
if (showExpandRevoke && isDesktop && (sessionStorage.getItem("aesirx-analytics-revoke") === "3" || sessionStorage.getItem("aesirx-analytics-revoke") === "4")) {
|
645
651
|
setActiveConnectorType(BROWSER_WALLET);
|
@@ -667,30 +673,44 @@ var ConsentComponentCustomApp = (props) => {
|
|
667
673
|
))
|
668
674
|
);
|
669
675
|
};
|
670
|
-
const loadConsentDefault = (gtagId2, gtmId2) => {
|
676
|
+
const loadConsentDefault = async (gtagId2, gtmId2) => {
|
671
677
|
window.dataLayer = window.dataLayer || [];
|
672
678
|
function gtag(p0, p1, p2) {
|
673
679
|
dataLayer.push(arguments);
|
674
680
|
}
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
681
|
+
if ((layout !== "simple-consent-mode" || sessionStorage.getItem("consentGranted") === "true") && (gtmId2 && !document.querySelector(
|
682
|
+
`script[src="https://www.googletagmanager.com/gtm.js?id=${gtmId2}"]`
|
683
|
+
) || gtagId2 && !document.querySelector(
|
684
|
+
`script[src="https://www.googletagmanager.com/gtag/js?id=${gtagId2}"]`
|
685
|
+
))) {
|
686
|
+
gtagId2 && await loadGtagScript(gtagId2);
|
687
|
+
gtmId2 && await loadGtmScript(gtmId2);
|
688
|
+
if (gtagId2) {
|
689
|
+
gtag("js", /* @__PURE__ */ new Date());
|
690
|
+
gtag("config", `${gtagId2}`);
|
691
|
+
}
|
692
|
+
if (gtmId2) {
|
693
|
+
dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
|
694
|
+
}
|
688
695
|
}
|
689
|
-
if (layout
|
690
|
-
gtagId2 && loadGtagScript(gtagId2);
|
691
|
-
gtmId2 && loadGtmScript(gtmId2);
|
696
|
+
if (layout !== "simple-consent-mode" && sessionStorage.getItem("consentGranted") !== "true") {
|
692
697
|
gtag("set", "url_passthrough", true);
|
693
698
|
gtag("set", "ads_data_redaction", true);
|
699
|
+
gtag("consent", "default", {
|
700
|
+
ad_user_data: "denied",
|
701
|
+
ad_personalization: "denied",
|
702
|
+
ad_storage: "denied",
|
703
|
+
analytics_storage: "denied",
|
704
|
+
wait_for_update: 500
|
705
|
+
});
|
706
|
+
}
|
707
|
+
if (sessionStorage.getItem("consentGranted") === "true") {
|
708
|
+
gtag("consent", "update", {
|
709
|
+
ad_user_data: "granted",
|
710
|
+
ad_personalization: "granted",
|
711
|
+
ad_storage: "granted",
|
712
|
+
analytics_storage: "granted"
|
713
|
+
});
|
694
714
|
}
|
695
715
|
};
|
696
716
|
const paymentRevoke = sessionStorage.getItem("aesirx-analytics-opt-payment");
|
@@ -967,7 +987,7 @@ var ConsentComponentCustomApp = (props) => {
|
|
967
987
|
{
|
968
988
|
className: `ssoBtnWrapper d-flex align-items-center justify-content-center w-100 w-lg-30 me-3 bg-success rounded-pill ${level === 4 && !account && !address ? "" : "d-none"}`
|
969
989
|
},
|
970
|
-
layout !== "simple-consent-mode" &&
|
990
|
+
layout !== "simple-consent-mode" && /* @__PURE__ */ React.createElement(
|
971
991
|
Suspense,
|
972
992
|
{
|
973
993
|
fallback: /* @__PURE__ */ React.createElement("div", { className: "d-flex h-100 justify-content-center align-items-center" }, "Loading...")
|
@@ -1052,7 +1072,7 @@ var ConsentComponentCustomApp = (props) => {
|
|
1052
1072
|
}
|
1053
1073
|
) : /* @__PURE__ */ React.createElement(React.Fragment, null),
|
1054
1074
|
t("txt_yes_i_consent")
|
1055
|
-
), layout === "simple-consent-mode"
|
1075
|
+
), layout === "simple-consent-mode" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
1056
1076
|
Button,
|
1057
1077
|
{
|
1058
1078
|
variant: "outline-success",
|
@@ -1069,7 +1089,8 @@ var ConsentComponentCustomApp = (props) => {
|
|
1069
1089
|
level,
|
1070
1090
|
handleLevel,
|
1071
1091
|
isCustom: true,
|
1072
|
-
layout
|
1092
|
+
layout,
|
1093
|
+
customConsentText
|
1073
1094
|
},
|
1074
1095
|
/* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100" }, /* @__PURE__ */ React.createElement(
|
1075
1096
|
Form.Check,
|
@@ -1115,7 +1136,7 @@ var ConsentComponentCustomApp = (props) => {
|
|
1115
1136
|
}
|
1116
1137
|
) : /* @__PURE__ */ React.createElement(React.Fragment, null),
|
1117
1138
|
t("txt_yes_i_consent")
|
1118
|
-
), layout === "simple-consent-mode"
|
1139
|
+
), layout === "simple-consent-mode" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
1119
1140
|
Button,
|
1120
1141
|
{
|
1121
1142
|
variant: "outline-success",
|