aesirx-analytics 2.2.10 → 2.2.12

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.
@@ -0,0 +1,1157 @@
1
+ import {
2
+ trackEvent
3
+ } from "./chunk-UJTYOAT7.js";
4
+ import {
5
+ BROWSER_WALLET,
6
+ Connect_default,
7
+ Ethereum_default,
8
+ LoadingStatus,
9
+ TermsComponent,
10
+ WALLET_CONNECT,
11
+ bg_default,
12
+ check_circle_default,
13
+ getWeb3ID,
14
+ no_default,
15
+ privacy_default,
16
+ useConsentStatus_default
17
+ } from "./chunk-PD33NAQI.js";
18
+ import {
19
+ AnalyticsContext,
20
+ agreeConsents,
21
+ getConsents,
22
+ getMember,
23
+ getNonce,
24
+ getSignature,
25
+ getWalletNonce,
26
+ loadGtagScript,
27
+ loadGtmScript,
28
+ revokeConsents,
29
+ useTranslation,
30
+ verifySignature
31
+ } from "./chunk-R4T7FUMB.js";
32
+
33
+ // src/Components/ConsentCustom.tsx
34
+ import React, { Suspense, useContext, useEffect, useState } from "react";
35
+ import { Button, Col, Form, Row } from "react-bootstrap";
36
+ import { ToastContainer, toast } from "react-toastify";
37
+
38
+ // src/Assets/checkbox.svg
39
+ var checkbox_default = 'data:image/svg+xml,<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<circle cx="11.5" cy="11.5" r="10.5" stroke="%23DEDEDE" stroke-width="2"/>%0A</svg>%0A';
40
+
41
+ // src/Assets/checkbox_active.svg
42
+ var checkbox_active_default = 'data:image/svg+xml,<svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<circle cx="11.5" cy="11.5" r="11.5" fill="%231C9678"/>%0A<path fill-rule="evenodd" clip-rule="evenodd" d="M15.6685 9.15506C15.8752 9.36181 15.8752 9.69701 15.6685 9.90376L10.7273 14.8449C10.5205 15.0517 10.1853 15.0517 9.97859 14.8449L7.15506 12.0214C6.94831 11.8147 6.94831 11.4795 7.15506 11.2727C7.36181 11.066 7.69701 11.066 7.90376 11.2727L10.3529 13.7219L14.9198 9.15506C15.1265 8.94831 15.4617 8.94831 15.6685 9.15506Z" fill="white" stroke="white" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/>%0A</svg>%0A';
43
+
44
+ // src/Assets/wallet_consent.png
45
+ var wallet_consent_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAG2SURBVHgB7Ze7TgJBFIb/OQvrDSOFD7AkmlhoQqOtsTJ2+gY0Gi+F+gTqQ2CMjfAE0JnYSGWMNNhZaIKdlaEgERDmOMNNix1iAbNb8BVzyUxy/vwzmTlHoMvS/q3XknQMKVIQHMewYFGBQN5xWhcvV1vlQVuFbhZ375Jg3A9VhA9SYOftejNvWqeOIs6NWkg7GOPGS+WMcUi5kmLAgx3irjt9YlpUzsgkbMJsjEcziZV1WIRBc6Y1is7NezOJZZA7iaARq+k69ybNagUjx3Eq0enZgrLomUhmHg+myr5igkAQnT8dRC/0mBAwLOX52mV9G2EQo2HGme4DP6YeDrmJUDjToeaFSExI7kwPLcbC4/I/lBgOkxg7cKsJ2agN3BOBBbSI6mup3UdiccQW/D9uK840Pj/6ruj/z+SQFTHajX5AlR2YMoSI+qnK6j32MGIx+mhaX1WolMW8D5bQgv465Mf4BTZBqkx5R0gYH5MfpHJjkpJLCBhVY5cf9twSNb8nMnqCQJFZoFv4r6arSYFozmKZ+4sQheKhu6GH7TtTPIqVVA2zoVL1rKpn7KQUSgQzn/aEaH4AkOGIml1TIcQAAAAASUVORK5CYII=";
46
+
47
+ // src/Assets/wallet_shield_consent.png
48
+ var wallet_shield_consent_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAlCAYAAADWSWD3AAAACXBIWXMAAAsTAAALEwEAmpwY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5hWC3DiGPvyJWVlhgcnJCp1KzCXKf0ZUTBlowYYO4mPHEpn09SrHT7+1uyXu+Rtl02cANRLjtOb2+/IWUDNW8Z4bBjeoRQAuthx7As9DQgEd6t1cYbBL7zIhHORccG0WxK0dPDELjpmmbEKZfLWC+G5fg4IOCTMpPJKEp02hFZd4Dc2rruaJQ+UQ559TVqno+PD7B6PWw4jsuFECimIYRrEkGlbBpKRXijITlqz08IeAYWUg2sDlFHCi0kGw0u+/qk0FHCQMBxsbrqirGxRTk/PyEnJ0to3SSWpSeV74DeUhcF3Q2+c+XJ0QHo1Gj2Ahsf388xCbF0epgXCmVjYCCKoAUvl8MsHm+ySsVisZhep1oNVrTJW2Qy2eMlrmLRkOn0qLSsNUkhlpIaWZckm50JkuRFr1tbWlCu+r3/NocmTmNq3SlHRoqkfaxVGm4+3+DoONDXF0fwvQi6gjcfqgWWgUoC5KsqFGxMWglvofn5RcwJEzISeQa1mlYYsTzQ5EdHj1LRT0C3v5VfVNPbaT5wCvpqLpdtfz+bzWOonPbGs7MppNMx0FoeRo1fjUnqTUaJgt5RRKBiMpudVpTtyIL6MqvLz/f6CeGym9JFDusW0CGzq6f3XiTiwTh4r5+D8f9B+xeousAecrjVhAAAAABJRU5ErkJggg==";
49
+
50
+ // src/Components/ConsentCustom.tsx
51
+ import ContentLoader from "react-content-loader";
52
+ import {
53
+ MAINNET,
54
+ WithWalletConnector,
55
+ useConnection,
56
+ useConnect,
57
+ stringMessage,
58
+ useGrpcClient,
59
+ TESTNET
60
+ } from "@concordium/react-components";
61
+ import { OsTypes, isDesktop, isMobile, osName } from "react-device-detect";
62
+ import { useAccount, useSignMessage } from "wagmi";
63
+ var SSOButton = React.lazy(
64
+ () => import("aesirx-sso").then((module) => ({ default: module.SSOButton }))
65
+ );
66
+ var ConsentComponentCustom = ({
67
+ endpoint,
68
+ aesirXEndpoint,
69
+ networkEnv,
70
+ loginApp,
71
+ isLoggedApp,
72
+ gtagId,
73
+ gtmId,
74
+ layout
75
+ }) => {
76
+ return /* @__PURE__ */ React.createElement(WithWalletConnector, { network: networkEnv === "testnet" ? TESTNET : MAINNET }, (props) => /* @__PURE__ */ React.createElement(
77
+ ConsentComponentCustomWrapper,
78
+ {
79
+ ...props,
80
+ endpoint,
81
+ aesirXEndpoint,
82
+ loginApp,
83
+ isLoggedApp,
84
+ gtagId,
85
+ gtmId,
86
+ layout
87
+ }
88
+ ));
89
+ };
90
+ var ConsentComponentCustomWrapper = (props) => {
91
+ const [
92
+ uuid,
93
+ level,
94
+ connection,
95
+ account,
96
+ show,
97
+ setShow,
98
+ web3ID,
99
+ setWeb3ID,
100
+ handleLevel,
101
+ showRevoke,
102
+ handleRevoke
103
+ ] = useConsentStatus_default(props?.endpoint, props?.layout, props);
104
+ return /* @__PURE__ */ React.createElement("div", { className: "aesirxconsent" }, /* @__PURE__ */ React.createElement(Ethereum_default, { layout: props?.layout, level }, /* @__PURE__ */ React.createElement(
105
+ ConsentComponentCustomApp,
106
+ {
107
+ ...props,
108
+ endpoint: props?.endpoint,
109
+ aesirXEndpoint: props?.aesirXEndpoint,
110
+ loginApp: props?.loginApp,
111
+ isLoggedApp: props?.isLoggedApp,
112
+ gtagId: props?.gtagId,
113
+ gtmId: props?.gtmId,
114
+ layout: props?.layout,
115
+ uuid,
116
+ level,
117
+ connection,
118
+ account,
119
+ show,
120
+ setShow,
121
+ web3ID,
122
+ setWeb3ID,
123
+ handleLevel,
124
+ showRevoke,
125
+ handleRevoke
126
+ }
127
+ )));
128
+ };
129
+ var ConsentComponentCustomApp = (props) => {
130
+ const {
131
+ endpoint,
132
+ aesirXEndpoint,
133
+ loginApp,
134
+ isLoggedApp,
135
+ gtagId,
136
+ gtmId,
137
+ layout,
138
+ activeConnectorType,
139
+ activeConnector,
140
+ activeConnectorError,
141
+ connectedAccounts,
142
+ genesisHashes,
143
+ setActiveConnectorType,
144
+ network,
145
+ uuid,
146
+ level,
147
+ connection,
148
+ account,
149
+ show,
150
+ setShow,
151
+ web3ID,
152
+ setWeb3ID,
153
+ handleLevel,
154
+ showRevoke,
155
+ handleRevoke
156
+ } = props;
157
+ const { setConnection } = useConnection(connectedAccounts, genesisHashes);
158
+ const { isConnecting } = useConnect(activeConnector, setConnection);
159
+ const handleOnConnect = async (connectorType, network2 = "concordium") => {
160
+ if (network2 === "concordium") {
161
+ setActiveConnectorType(connectorType);
162
+ }
163
+ setLoading("done");
164
+ };
165
+ const [consents, setConsents] = useState([1, 2]);
166
+ const [revokeConsentOption, setRevokeConsentOption] = useState("consent");
167
+ const [loading, setLoading] = useState("done");
168
+ const [loadingCheckAccount, setLoadingCheckAccount] = useState(false);
169
+ const [showExpandConsent, setShowExpandConsent] = useState(true);
170
+ const [showRejectedConsent, setShowRejectedConsent] = useState(false);
171
+ const [showExpandRevoke, setShowExpandRevoke] = useState(false);
172
+ const [showBackdrop, setShowBackdrop] = useState(true);
173
+ const [consentTier4, setConsentTier4] = useState({});
174
+ const [upgradeLayout, setUpgradeLayout] = useState(
175
+ level === 3 || level === 4 ? true : false
176
+ );
177
+ const [upgradeLevel, setUpgradeLevel] = useState(level === 4 || level === 3 ? level : 0);
178
+ const analyticsContext = useContext(AnalyticsContext);
179
+ const { t } = useTranslation();
180
+ const gRPCClient = useGrpcClient(network);
181
+ const revoke = sessionStorage.getItem("aesirx-analytics-revoke");
182
+ const { address, connector } = (layout === "simple-consent-mode" || layout === "simple-web-2" || level === 1) && (!revoke || revoke === "0" || revoke === "1") ? { address: "", connector: "" } : useAccount();
183
+ const { signMessage } = (layout === "simple-consent-mode" || layout === "simple-web-2" || level === 1) && (!revoke || revoke === "0" || revoke === "1") ? { signMessage: {} } : useSignMessage({
184
+ async onSuccess(data, variables) {
185
+ const signature = Buffer.from(
186
+ typeof data === "object" && data !== null ? JSON.stringify(data) : data,
187
+ "utf-8"
188
+ ).toString("base64");
189
+ const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
190
+ if (variables?.message.indexOf("Revoke consent") > -1) {
191
+ const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
192
+ const consentList = await getConsents(endpoint, uuid);
193
+ consentList.forEach(async (consent) => {
194
+ !consent?.expiration && await revokeConsents(
195
+ endpoint,
196
+ levelRevoke,
197
+ consent?.consent_uuid,
198
+ address,
199
+ signature,
200
+ web3ID,
201
+ jwt,
202
+ "metamask"
203
+ );
204
+ });
205
+ setLoading("done");
206
+ handleRevoke(false);
207
+ setShowExpandConsent(false);
208
+ setShow(true);
209
+ setShowBackdrop(false);
210
+ sessionStorage.removeItem("aesirx-analytics-allow");
211
+ } else if (variables?.message.indexOf("Login with nonce") > -1) {
212
+ const res = await verifySignature(aesirXEndpoint, "metamask", address, data);
213
+ sessionStorage.setItem("aesirx-analytics-jwt", res?.jwt);
214
+ setLoadingCheckAccount(false);
215
+ const nonce = await getNonce(
216
+ endpoint,
217
+ address,
218
+ "Give consent Tier 4:{nonce} {domain} {time}",
219
+ "metamask"
220
+ );
221
+ signMessage({ message: `${nonce}` });
222
+ } else {
223
+ setLoading("saving");
224
+ await agreeConsents(
225
+ endpoint,
226
+ level,
227
+ uuid,
228
+ consents,
229
+ address,
230
+ signature,
231
+ web3ID,
232
+ jwt,
233
+ "metamask",
234
+ gtagId,
235
+ gtmId,
236
+ layout
237
+ );
238
+ sessionStorage.setItem("aesirx-analytics-uuid", uuid);
239
+ sessionStorage.setItem("aesirx-analytics-allow", "1");
240
+ sessionStorage.setItem("aesirx-analytics-consent-type", "metamask");
241
+ setShow(false);
242
+ setLoading("done");
243
+ handleRevoke(true, level);
244
+ setShowBackdrop(false);
245
+ }
246
+ },
247
+ async onError(error) {
248
+ setLoading("done");
249
+ toast.error(error.message);
250
+ }
251
+ });
252
+ const handleChange = async ({ target: { value } }) => {
253
+ if (consents.indexOf(parseInt(value)) === -1) {
254
+ setConsents([...consents, ...[parseInt(value)]]);
255
+ } else {
256
+ setConsents(consents.filter((consent) => consent !== parseInt(value)));
257
+ }
258
+ };
259
+ const handleAgree = async () => {
260
+ try {
261
+ let flag = true;
262
+ let jwt = "";
263
+ if (level > 2) {
264
+ if (level === 4) {
265
+ try {
266
+ setLoadingCheckAccount(true);
267
+ const nonceLogin = await getWalletNonce(
268
+ aesirXEndpoint,
269
+ account ? "concordium" : "metamask",
270
+ account ?? address
271
+ );
272
+ if (nonceLogin) {
273
+ try {
274
+ if (account) {
275
+ const signature = await connection.signMessage(
276
+ account,
277
+ stringMessage(`${nonceLogin}`)
278
+ );
279
+ const convertedSignature = typeof signature === "object" && signature !== null ? signature : JSON.parse(signature);
280
+ if (signature) {
281
+ const data = await verifySignature(
282
+ aesirXEndpoint,
283
+ "concordium",
284
+ account,
285
+ convertedSignature
286
+ );
287
+ sessionStorage.setItem("aesirx-analytics-jwt", data?.jwt);
288
+ jwt = data?.jwt;
289
+ loginApp && !isLoggedApp && loginApp(data);
290
+ setLoadingCheckAccount(false);
291
+ }
292
+ } else {
293
+ signMessage({ message: `${nonceLogin}` });
294
+ }
295
+ } catch (error) {
296
+ setLoadingCheckAccount(false);
297
+ toast(error.message);
298
+ }
299
+ }
300
+ } catch (error) {
301
+ SSOClick(".loginSSO");
302
+ setLoadingCheckAccount(false);
303
+ return;
304
+ }
305
+ }
306
+ if (account) {
307
+ const signature = await getSignature(
308
+ endpoint,
309
+ account,
310
+ connection,
311
+ level === 3 ? "Give consent:{nonce} {domain} {time}" : "Give consent Tier 4:{nonce} {domain} {time}"
312
+ );
313
+ setLoading("saving");
314
+ await agreeConsents(
315
+ endpoint,
316
+ level,
317
+ uuid,
318
+ consents,
319
+ account,
320
+ signature,
321
+ web3ID,
322
+ jwt,
323
+ "concordium",
324
+ gtagId,
325
+ gtmId,
326
+ layout
327
+ );
328
+ sessionStorage.setItem("aesirx-analytics-consent-type", "concordium");
329
+ setUpgradeLayout(false);
330
+ } else if (connector) {
331
+ if (level === 3) {
332
+ const nonce = await getNonce(
333
+ endpoint,
334
+ address,
335
+ level === 3 ? "Give consent:{nonce} {domain} {time}" : "Give consent Tier 4:{nonce} {domain} {time}",
336
+ "metamask"
337
+ );
338
+ signMessage({ message: `${nonce}` });
339
+ }
340
+ } else {
341
+ setLoading("connect");
342
+ flag = false;
343
+ }
344
+ } else {
345
+ setLoading("saving");
346
+ const consentList = await getConsents(endpoint, analyticsContext.visitor_uuid);
347
+ consents.forEach(async (consent) => {
348
+ const existConsent = consentList.find((item) => item?.consent === consent);
349
+ if (!existConsent) {
350
+ await agreeConsents(
351
+ endpoint,
352
+ 1,
353
+ uuid,
354
+ consent,
355
+ null,
356
+ null,
357
+ null,
358
+ null,
359
+ null,
360
+ gtagId,
361
+ gtmId,
362
+ layout
363
+ );
364
+ } else if (!!existConsent?.consent_uuid && existConsent?.expiration && new Date(existConsent.expiration) < /* @__PURE__ */ new Date()) {
365
+ await agreeConsents(
366
+ endpoint,
367
+ 1,
368
+ uuid,
369
+ consent,
370
+ null,
371
+ null,
372
+ null,
373
+ null,
374
+ null,
375
+ gtagId,
376
+ gtmId,
377
+ layout
378
+ );
379
+ }
380
+ });
381
+ }
382
+ if (flag && (account || level < 3)) {
383
+ sessionStorage.setItem("aesirx-analytics-uuid", uuid);
384
+ sessionStorage.setItem("aesirx-analytics-allow", "1");
385
+ setShow(false);
386
+ setLoading("done");
387
+ handleRevoke(true, level);
388
+ setUpgradeLayout(false);
389
+ setShowBackdrop(false);
390
+ setShowExpandRevoke(false);
391
+ }
392
+ } catch (error) {
393
+ console.log(error);
394
+ handleNotAllow();
395
+ setLoading("done");
396
+ toast.error(error?.response?.data?.error ?? error.message);
397
+ }
398
+ };
399
+ useEffect(() => {
400
+ const init = async () => {
401
+ if (Object.keys(consentTier4)?.length && (account || address)) {
402
+ await consentTier4Init(consentTier4);
403
+ setConsentTier4({});
404
+ }
405
+ };
406
+ init();
407
+ }, [consentTier4, account, address]);
408
+ const consentTier4Init = async (response) => {
409
+ let hasWeb3ID = true;
410
+ if (response?.loginType === "concordium") {
411
+ const web3ID2 = await getWeb3ID(account, gRPCClient, network?.name);
412
+ if (web3ID2) {
413
+ setWeb3ID(web3ID2);
414
+ } else {
415
+ hasWeb3ID = false;
416
+ }
417
+ } else {
418
+ const memberData = await getMember(aesirXEndpoint, response?.access_token);
419
+ hasWeb3ID = memberData?.web3id ? true : false;
420
+ }
421
+ if (hasWeb3ID) {
422
+ if (response?.loginType === "concordium") {
423
+ sessionStorage.setItem("aesirx-analytics-consent-type", "concordium");
424
+ const signature = await getSignature(
425
+ endpoint,
426
+ account,
427
+ connection,
428
+ "Give consent Tier 4:{nonce} {domain} {time}"
429
+ );
430
+ await agreeConsents(
431
+ endpoint,
432
+ level,
433
+ uuid,
434
+ consents,
435
+ account,
436
+ signature,
437
+ null,
438
+ response?.jwt,
439
+ "concordium",
440
+ gtagId,
441
+ gtmId,
442
+ layout
443
+ );
444
+ setShow(false);
445
+ handleRevoke(true, level);
446
+ setUpgradeLayout(false);
447
+ setLoading("done");
448
+ } else if (response?.loginType === "metamask") {
449
+ sessionStorage.setItem("aesirx-analytics-consent-type", "metamask");
450
+ const nonce = await getNonce(
451
+ endpoint,
452
+ address,
453
+ "Give consent Tier 4:{nonce} {domain} {time}",
454
+ "metamask"
455
+ );
456
+ signMessage({ message: `${nonce}` });
457
+ }
458
+ } else {
459
+ handleLevel(3);
460
+ toast("You haven't minted any WEB3 ID yet. Try to mint at https://dapp.shield.aesirx.io");
461
+ setLoading("done");
462
+ }
463
+ };
464
+ const onGetData = async (response) => {
465
+ try {
466
+ setLoading("saving");
467
+ const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
468
+ sessionStorage.setItem("aesirx-analytics-jwt", response?.jwt);
469
+ if (levelRevoke && levelRevoke !== "0") {
470
+ sessionStorage.setItem(
471
+ "aesirx-analytics-consent-type",
472
+ response?.loginType === "concordium" ? "concordium" : "metamask"
473
+ );
474
+ await handleRevokeBtn();
475
+ setTimeout(() => {
476
+ window.location.reload();
477
+ }, 1e3);
478
+ } else {
479
+ if (level === 4) {
480
+ if (response?.loginType === "concordium" && isDesktop) {
481
+ setActiveConnectorType(BROWSER_WALLET);
482
+ }
483
+ setConsentTier4(response);
484
+ } else {
485
+ await agreeConsents(
486
+ endpoint,
487
+ level,
488
+ uuid,
489
+ consents,
490
+ null,
491
+ null,
492
+ null,
493
+ response?.jwt,
494
+ "concordium",
495
+ gtagId,
496
+ gtmId,
497
+ layout
498
+ );
499
+ setShow(false);
500
+ handleRevoke(true, level);
501
+ setUpgradeLayout(false);
502
+ setLoading("done");
503
+ }
504
+ }
505
+ loginApp && !isLoggedApp && loginApp(response);
506
+ } catch (error) {
507
+ console.log(error);
508
+ setShow(false);
509
+ setLoading("done");
510
+ toast.error(error?.response?.data?.error ?? error.message);
511
+ }
512
+ };
513
+ const handleNotAllow = () => {
514
+ sessionStorage.setItem("aesirx-analytics-uuid", uuid);
515
+ sessionStorage.setItem("aesirx-analytics-rejected", "true");
516
+ setShowExpandConsent(false);
517
+ setShowBackdrop(false);
518
+ const hostUrl = endpoint ? endpoint : "";
519
+ const root = hostUrl ? hostUrl.replace(/\/$/, "") : "";
520
+ trackEvent(root, "", {
521
+ event_name: "Reject consent",
522
+ event_type: "reject-consent"
523
+ });
524
+ };
525
+ const handleRevokeBtn = async () => {
526
+ const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
527
+ const consentType = sessionStorage.getItem("aesirx-analytics-consent-type");
528
+ const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
529
+ try {
530
+ let flag = true;
531
+ if (levelRevoke !== "1") {
532
+ if (parseInt(levelRevoke) > 2) {
533
+ if (!jwt && (parseInt(levelRevoke) === 2 || parseInt(levelRevoke) === 4)) {
534
+ SSOClick(".revokeLogin");
535
+ return;
536
+ }
537
+ if (account && consentType !== "metamask") {
538
+ setLoading("sign");
539
+ const signature = await getSignature(
540
+ endpoint,
541
+ account,
542
+ connection,
543
+ "Revoke consent:{nonce} {domain} {time}"
544
+ );
545
+ setLoading("saving");
546
+ const consentList = await getConsents(endpoint, uuid);
547
+ consentList.forEach(async (consent) => {
548
+ !consent?.expiration && await revokeConsents(
549
+ endpoint,
550
+ levelRevoke,
551
+ consent?.consent_uuid,
552
+ account,
553
+ signature,
554
+ web3ID,
555
+ jwt
556
+ );
557
+ });
558
+ setLoading("done");
559
+ handleRevoke(false);
560
+ } else if (connector) {
561
+ setLoading("sign");
562
+ setLoading("saving");
563
+ const nonce = await getNonce(
564
+ endpoint,
565
+ address,
566
+ "Revoke consent:{nonce} {domain} {time}",
567
+ "metamask"
568
+ );
569
+ signMessage({ message: `${nonce}` });
570
+ } else {
571
+ setLoading("connect");
572
+ flag = false;
573
+ }
574
+ } else {
575
+ if (!jwt && parseInt(levelRevoke) === 2) {
576
+ SSOClick(".revokeLogin");
577
+ return;
578
+ } else {
579
+ setLoading("saving");
580
+ const consentList = await getConsents(endpoint, uuid);
581
+ consentList.forEach(async (consent) => {
582
+ !consent?.expiration && await revokeConsents(
583
+ endpoint,
584
+ levelRevoke,
585
+ consent?.consent_uuid,
586
+ null,
587
+ null,
588
+ null,
589
+ jwt
590
+ );
591
+ });
592
+ setLoading("done");
593
+ handleRevoke(false);
594
+ }
595
+ }
596
+ if (flag && (account && consentType !== "metamask" || level < 3)) {
597
+ setShowExpandConsent(false);
598
+ setShow(true);
599
+ setShowBackdrop(false);
600
+ sessionStorage.removeItem("aesirx-analytics-allow");
601
+ }
602
+ } else {
603
+ handleRevoke(false);
604
+ setShowExpandConsent(false);
605
+ setShow(true);
606
+ setShowBackdrop(false);
607
+ sessionStorage.removeItem("aesirx-analytics-allow");
608
+ }
609
+ const hostUrl = endpoint ? endpoint : "";
610
+ const root = hostUrl ? hostUrl.replace(/\/$/, "") : "";
611
+ trackEvent(root, "", {
612
+ event_name: "Revoke consent",
613
+ event_type: "revoke-consent"
614
+ });
615
+ } catch (error) {
616
+ console.log(error);
617
+ setLoading("done");
618
+ toast.error(error?.response?.data?.error ?? error.message);
619
+ }
620
+ };
621
+ const SSOClick = (selector) => {
622
+ const element = document.querySelector(selector);
623
+ element.click();
624
+ };
625
+ useEffect(() => {
626
+ if (activeConnectorError) {
627
+ toast.error(activeConnectorError);
628
+ }
629
+ }, [activeConnectorError]);
630
+ useEffect(() => {
631
+ if (sessionStorage.getItem("aesirx-analytics-rejected") === "true") {
632
+ setShowBackdrop(false);
633
+ setShowExpandConsent(false);
634
+ }
635
+ if (sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0") {
636
+ window.funcAfterConsent && window.funcAfterConsent();
637
+ }
638
+ (gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
639
+ }, []);
640
+ useEffect(() => {
641
+ if (showExpandRevoke && isDesktop && (sessionStorage.getItem("aesirx-analytics-revoke") === "3" || sessionStorage.getItem("aesirx-analytics-revoke") === "4")) {
642
+ setActiveConnectorType(BROWSER_WALLET);
643
+ }
644
+ }, [showExpandRevoke]);
645
+ console.log("level", uuid, level, web3ID, account, loading);
646
+ const ConsentLevelUprade = ({ level: level2, levelname, image, content, isUpgrade = false }) => {
647
+ return /* @__PURE__ */ React.createElement(
648
+ "div",
649
+ {
650
+ className: `consent_level mt-2 h-100 ${isUpgrade ? `cursor-pointer ${upgradeLevel === level2 ? "active" : ""}` : ""} `,
651
+ onClick: () => {
652
+ setUpgradeLevel(level2);
653
+ handleLevel(level2);
654
+ }
655
+ },
656
+ /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center justify-content-between flex-wrap" }, /* @__PURE__ */ React.createElement("img", { className: "level-img mb-2", src: image, alt: "level" }), /* @__PURE__ */ React.createElement("div", { className: "status-tier-text fw-semibold text-primary w-100 mb-1" }, levelname), /* @__PURE__ */ React.createElement("div", { className: "fs-14" }, content)),
657
+ /* @__PURE__ */ React.createElement("div", { className: "checkbox_img" }, /* @__PURE__ */ React.createElement(
658
+ "img",
659
+ {
660
+ width: "23px",
661
+ height: "23px",
662
+ src: upgradeLevel === level2 ? checkbox_active_default : checkbox_default
663
+ }
664
+ ))
665
+ );
666
+ };
667
+ const loadConsentDefault = (gtagId2, gtmId2) => {
668
+ window.dataLayer = window.dataLayer || [];
669
+ function gtag(p0, p1, p2) {
670
+ dataLayer.push(arguments);
671
+ }
672
+ gtag("consent", "default", {
673
+ ad_user_data: "denied",
674
+ ad_personalization: "denied",
675
+ ad_storage: "denied",
676
+ analytics_storage: "denied",
677
+ wait_for_update: 500
678
+ });
679
+ if (gtagId2) {
680
+ gtag("js", /* @__PURE__ */ new Date());
681
+ gtag("config", `${gtagId2}`);
682
+ }
683
+ if (gtmId2) {
684
+ dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
685
+ }
686
+ if (layout === "advance-consent-mode") {
687
+ gtagId2 && loadGtagScript(gtagId2);
688
+ gtmId2 && loadGtmScript(gtmId2);
689
+ gtag("set", "url_passthrough", true);
690
+ gtag("set", "ads_data_redaction", true);
691
+ }
692
+ };
693
+ const paymentRevoke = sessionStorage.getItem("aesirx-analytics-payment");
694
+ console.log("loading", loading);
695
+ 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(
696
+ "div",
697
+ {
698
+ tabIndex: -1,
699
+ className: `toast-container position-fixed m-md-3 ${showExpandRevoke ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
700
+ },
701
+ /* @__PURE__ */ React.createElement(
702
+ "div",
703
+ {
704
+ className: `toast revoke-toast custom ${showRevoke || sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0" ? "show" : ""} ${showExpandRevoke ? "" : "minimize"}`
705
+ },
706
+ /* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
707
+ /* @__PURE__ */ React.createElement("div", { className: "toast-body p-0 shadow mx-3 mx-md-0" }, /* @__PURE__ */ React.createElement(
708
+ "div",
709
+ {
710
+ className: `revoke-wrapper minimize-shield-wrapper position-relative ${showExpandRevoke ? "bg-white" : ""}`
711
+ },
712
+ !showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
713
+ "img",
714
+ {
715
+ className: "cover-img position-absolute h-100 w-100 object-fit-cover",
716
+ src: bg_default
717
+ }
718
+ ), /* @__PURE__ */ React.createElement(
719
+ "div",
720
+ {
721
+ className: "minimize-shield",
722
+ onClick: () => {
723
+ if (osName !== OsTypes?.IOS && isMobile && !connection && sessionStorage.getItem("aesirx-analytics-revoke") && parseInt(sessionStorage.getItem("aesirx-analytics-revoke")) > 2) {
724
+ setActiveConnectorType(WALLET_CONNECT);
725
+ }
726
+ setShowExpandRevoke(true);
727
+ }
728
+ },
729
+ /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
730
+ t("txt_shield_of_privacy")
731
+ )),
732
+ showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
733
+ "div",
734
+ {
735
+ 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`,
736
+ style: {
737
+ borderBottom: "1px solid #DEDEDE"
738
+ }
739
+ },
740
+ /* @__PURE__ */ React.createElement("div", { className: "text-primary text-nowrap" }, t("txt_tracking_data_privacy")),
741
+ /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center fs-14 text-primary" }, /* @__PURE__ */ React.createElement(
742
+ "a",
743
+ {
744
+ href: "https://shield.aesirx.io/",
745
+ rel: "noreferrer",
746
+ target: "_blank",
747
+ className: "minimize-shield-wrapper position-relative text-decoration-none"
748
+ },
749
+ /* @__PURE__ */ React.createElement(
750
+ "img",
751
+ {
752
+ className: "cover-img position-absolute h-100 w-100 object-fit-cover z-1",
753
+ src: bg_default
754
+ }
755
+ ),
756
+ /* @__PURE__ */ React.createElement("div", { className: "minimize-shield position-relative z-2 py-2" }, /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }), t("txt_shield_of_privacy"))
757
+ ))
758
+ ), /* @__PURE__ */ React.createElement(
759
+ "div",
760
+ {
761
+ className: "minimize-revoke",
762
+ onClick: () => {
763
+ setShowExpandRevoke(false);
764
+ }
765
+ },
766
+ /* @__PURE__ */ React.createElement("img", { src: no_default })
767
+ ), /* @__PURE__ */ React.createElement("div", { className: "p-3 bg-white" }, paymentRevoke ? t("txt_you_can_revoke_on_the_site") : t("txt_you_can_revoke")), /* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100 bg-white px-3" }, paymentRevoke ? /* @__PURE__ */ React.createElement(
768
+ Form.Check,
769
+ {
770
+ id: `option-revoke-payment`,
771
+ checked: revokeConsentOption === "payment",
772
+ type: "checkbox",
773
+ label: t("txt_revoke_opt_in"),
774
+ value: "payment",
775
+ onChange: ({ target: { value } }) => {
776
+ setRevokeConsentOption(value);
777
+ }
778
+ }
779
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement(
780
+ Form.Check,
781
+ {
782
+ id: `option-revoke-consent`,
783
+ checked: revokeConsentOption === "consent",
784
+ type: "checkbox",
785
+ label: t("txt_revoke_consent_for_the_site"),
786
+ value: "consent",
787
+ onChange: ({ target: { value } }) => {
788
+ setRevokeConsentOption(value);
789
+ }
790
+ }
791
+ )), /* @__PURE__ */ React.createElement("div", { className: "rounded-bottom position-relative overflow-hidden bg-white" }, /* @__PURE__ */ React.createElement("div", { className: "position-relative p-3" }, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center flex-wrap" }, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center w-100 justify-content-end" }, /* @__PURE__ */ React.createElement(
792
+ "a",
793
+ {
794
+ 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",
795
+ href: "https://dapp.shield.aesirx.io/revoke-consent",
796
+ target: "_blank",
797
+ rel: "noreferrer"
798
+ },
799
+ t("txt_manage_consent")
800
+ ), loading === "done" ? /* @__PURE__ */ React.createElement(
801
+ Button,
802
+ {
803
+ variant: "outline-success",
804
+ onClick: async () => {
805
+ if (paymentRevoke) {
806
+ sessionStorage.removeItem("aesirx-analytics-payment");
807
+ setShowExpandRevoke(false);
808
+ setRevokeConsentOption("consent");
809
+ setTimeout(() => {
810
+ window.location.reload();
811
+ }, 1e3);
812
+ } else {
813
+ await handleRevokeBtn();
814
+ if (level > 1) {
815
+ setTimeout(() => {
816
+ window.location.reload();
817
+ }, 1e3);
818
+ }
819
+ }
820
+ },
821
+ 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"
822
+ },
823
+ t("txt_revoke_consent")
824
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null), (sessionStorage.getItem("aesirx-analytics-revoke") === "4" || sessionStorage.getItem("aesirx-analytics-revoke") === "2") && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement("div", null, "Loading...") }, /* @__PURE__ */ React.createElement(
825
+ SSOButton,
826
+ {
827
+ className: "d-none revokeLogin",
828
+ text: /* @__PURE__ */ React.createElement(React.Fragment, null, "Login Revoke"),
829
+ ssoState: "noscopes",
830
+ onGetData
831
+ }
832
+ ))))))))
833
+ ))
834
+ )
835
+ ), /* @__PURE__ */ React.createElement(
836
+ "div",
837
+ {
838
+ tabIndex: -1,
839
+ className: `toast-container position-fixed m-md-3 ${showExpandConsent ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
840
+ },
841
+ /* @__PURE__ */ React.createElement(
842
+ "div",
843
+ {
844
+ className: `toast custom ${show ? "show" : ""} ${showExpandConsent ? "" : "minimize"}`
845
+ },
846
+ /* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
847
+ /* @__PURE__ */ React.createElement("div", { className: "toast-body p-0 shadow mx-3 mx-md-0" }, !showExpandConsent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "minimize-shield-wrapper position-relative" }, /* @__PURE__ */ React.createElement(
848
+ "img",
849
+ {
850
+ className: "cover-img position-absolute h-100 w-100 object-fit-cover",
851
+ src: bg_default
852
+ }
853
+ ), /* @__PURE__ */ React.createElement(
854
+ "div",
855
+ {
856
+ className: "minimize-shield",
857
+ ref: analyticsContext?.ref,
858
+ onClick: () => {
859
+ setShowExpandConsent(true);
860
+ const rejectConsent = sessionStorage.getItem("aesirx-analytics-rejected");
861
+ rejectConsent && setShowRejectedConsent(true);
862
+ sessionStorage.removeItem("aesirx-analytics-rejected");
863
+ }
864
+ },
865
+ /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
866
+ t("txt_shield_of_privacy")
867
+ ))) : /* @__PURE__ */ React.createElement("div", { className: "bg-white" }, level ? /* @__PURE__ */ React.createElement(React.Fragment, null, upgradeLayout ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "bg-white rounded p-3 w-auto" }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: "mb-2 mb-lg-3" }, t("txt_select_your_preferred")), /* @__PURE__ */ React.createElement(Form, null, /* @__PURE__ */ React.createElement(Row, null, /* @__PURE__ */ React.createElement(Col, { lg: 6 }, /* @__PURE__ */ React.createElement(
868
+ ConsentLevelUprade,
869
+ {
870
+ level: 3,
871
+ levelname: t(`txt_decentralized_wallet`),
872
+ image: wallet_consent_default,
873
+ content: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
874
+ "img",
875
+ {
876
+ src: check_circle_default,
877
+ width: "14px",
878
+ height: "15px"
879
+ }
880
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_decentralized_wallet_will_be_loaded"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
881
+ "img",
882
+ {
883
+ src: check_circle_default,
884
+ width: "14px",
885
+ height: "15px"
886
+ }
887
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_both_first_party_third_party"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
888
+ "img",
889
+ {
890
+ src: check_circle_default,
891
+ width: "14px",
892
+ height: "15px"
893
+ }
894
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_all_consented_data_will_be_collected"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
895
+ "img",
896
+ {
897
+ src: check_circle_default,
898
+ width: "14px",
899
+ height: "15px"
900
+ }
901
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_users_can_revoke")))),
902
+ isUpgrade: true
903
+ }
904
+ )), /* @__PURE__ */ React.createElement(Col, { lg: 6 }, /* @__PURE__ */ React.createElement(
905
+ ConsentLevelUprade,
906
+ {
907
+ level: 4,
908
+ levelname: t(`txt_decentralized_wallet_shield`),
909
+ image: wallet_shield_consent_default,
910
+ content: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
911
+ "img",
912
+ {
913
+ src: check_circle_default,
914
+ width: "14px",
915
+ height: "15px"
916
+ }
917
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_decentralized_wallet_will_be_loaded"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
918
+ "img",
919
+ {
920
+ src: check_circle_default,
921
+ width: "14px",
922
+ height: "15px"
923
+ }
924
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_both_first_party_third_party"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
925
+ "img",
926
+ {
927
+ src: check_circle_default,
928
+ width: "14px",
929
+ height: "15px"
930
+ }
931
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_all_consented_data_will_be_collected"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
932
+ "img",
933
+ {
934
+ src: check_circle_default,
935
+ width: "14px",
936
+ height: "15px"
937
+ }
938
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_users_can_revoke_dapp"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
939
+ "img",
940
+ {
941
+ src: check_circle_default,
942
+ width: "14px",
943
+ height: "15px"
944
+ }
945
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_users_can_earn")))),
946
+ isUpgrade: true
947
+ }
948
+ )))), /* @__PURE__ */ React.createElement("div", { className: "d-flex w-100 flex-wrap flex-lg-nowrap justify-content-between mt-4" }, /* @__PURE__ */ React.createElement(
949
+ Button,
950
+ {
951
+ variant: "outline-success",
952
+ onClick: () => {
953
+ setUpgradeLayout(false);
954
+ handleLevel(1);
955
+ },
956
+ className: "d-flex align-items-center justify-content-center fs-14 w-100 w-lg-30 me-3 mb-2 mb-lg-0 rounded-pill py-3"
957
+ },
958
+ t("txt_back")
959
+ ), /* @__PURE__ */ React.createElement(
960
+ "div",
961
+ {
962
+ 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"}`
963
+ },
964
+ layout !== "simple-consent-mode" && layout !== "simple-web-2" && /* @__PURE__ */ React.createElement(
965
+ Suspense,
966
+ {
967
+ fallback: /* @__PURE__ */ React.createElement("div", { className: "d-flex h-100 justify-content-center align-items-center" }, "Loading...")
968
+ },
969
+ /* @__PURE__ */ React.createElement(
970
+ SSOButton,
971
+ {
972
+ className: "btn btn-success d-flex align-items-center justify-content-center loginSSO rounded-pill py-2 py-lg-3 w-100 w-lg-30 fs-14 text-white",
973
+ text: /* @__PURE__ */ React.createElement(React.Fragment, null, t("txt_continue")),
974
+ ssoState: "noscopes",
975
+ onGetData,
976
+ ...level === 2 ? { noCreateAccount: true } : {}
977
+ }
978
+ )
979
+ )
980
+ ), level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
981
+ Button,
982
+ {
983
+ variant: "success",
984
+ onClick: handleAgree,
985
+ className: "w-100 me-3 d-flex align-items-center justify-content-center fs-14 rounded-pill py-2 py-lg-3 w-100 w-lg-30 fs-14 text-white"
986
+ },
987
+ loadingCheckAccount ? /* @__PURE__ */ React.createElement(
988
+ "span",
989
+ {
990
+ className: "spinner-border spinner-border-sm me-1",
991
+ role: "status",
992
+ "aria-hidden": "true"
993
+ }
994
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null),
995
+ t("txt_continue")
996
+ ))))) : showRejectedConsent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
997
+ TermsComponent,
998
+ {
999
+ level,
1000
+ handleLevel,
1001
+ isCustom: true,
1002
+ layout,
1003
+ isRejectedLayout: true
1004
+ },
1005
+ /* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100" }, /* @__PURE__ */ React.createElement(
1006
+ Form.Check,
1007
+ {
1008
+ checked: consents.includes(1),
1009
+ type: "switch",
1010
+ label: "Personal data share consent.",
1011
+ value: 1,
1012
+ onChange: handleChange,
1013
+ className: "d-none"
1014
+ }
1015
+ ), /* @__PURE__ */ React.createElement(
1016
+ Form.Check,
1017
+ {
1018
+ checked: consents.includes(2),
1019
+ type: "switch",
1020
+ label: "Personal data cross site share consent.",
1021
+ value: 2,
1022
+ onChange: handleChange,
1023
+ className: "d-none"
1024
+ }
1025
+ ), /* @__PURE__ */ React.createElement("div", { className: "d-flex w-100 flex-wrap flex-lg-nowrap" }, loading === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1026
+ Button,
1027
+ {
1028
+ variant: "outline-success",
1029
+ onClick: handleNotAllow,
1030
+ className: "d-flex align-items-center justify-content-center fs-14 w-100 me-3 mb-2 mb-lg-0 rounded-pill py-2 py-lg-3"
1031
+ },
1032
+ t("txt_reject_consent")
1033
+ ), level === 2 || level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
1034
+ Button,
1035
+ {
1036
+ variant: "outline-success",
1037
+ onClick: handleAgree,
1038
+ className: "w-100 me-3 d-flex align-items-center justify-content-center fs-14 rounded-pill py-2 py-lg-3"
1039
+ },
1040
+ loadingCheckAccount ? /* @__PURE__ */ React.createElement(
1041
+ "span",
1042
+ {
1043
+ className: "spinner-border spinner-border-sm me-1",
1044
+ role: "status",
1045
+ "aria-hidden": "true"
1046
+ }
1047
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null),
1048
+ t("txt_yes_i_consent")
1049
+ ), layout === "simple-consent-mode" || layout === "simple-web-2" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1050
+ Button,
1051
+ {
1052
+ variant: "outline-success",
1053
+ onClick: () => {
1054
+ setUpgradeLayout(true);
1055
+ },
1056
+ className: "d-flex align-items-center justify-content-center fs-14 w-100 me-3 mb-2 mb-lg-0 rounded-pill py-2 py-lg-3"
1057
+ },
1058
+ t("txt_change_consent")
1059
+ ), " ")) : /* @__PURE__ */ React.createElement(React.Fragment, null)))
1060
+ )) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1061
+ TermsComponent,
1062
+ {
1063
+ level,
1064
+ handleLevel,
1065
+ isCustom: true,
1066
+ layout
1067
+ },
1068
+ /* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100" }, /* @__PURE__ */ React.createElement(
1069
+ Form.Check,
1070
+ {
1071
+ checked: consents.includes(1),
1072
+ type: "switch",
1073
+ label: "Personal data share consent.",
1074
+ value: 1,
1075
+ onChange: handleChange,
1076
+ className: "d-none"
1077
+ }
1078
+ ), /* @__PURE__ */ React.createElement(
1079
+ Form.Check,
1080
+ {
1081
+ checked: consents.includes(2),
1082
+ type: "switch",
1083
+ label: "Personal data cross site share consent.",
1084
+ value: 2,
1085
+ onChange: handleChange,
1086
+ className: "d-none"
1087
+ }
1088
+ ), /* @__PURE__ */ React.createElement("div", { className: "d-flex w-100 flex-wrap flex-lg-nowrap" }, loading === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1089
+ Button,
1090
+ {
1091
+ variant: "outline-success",
1092
+ onClick: handleNotAllow,
1093
+ className: "d-flex align-items-center justify-content-center fs-14 w-100 me-3 mb-2 mb-lg-0 rounded-pill py-2 py-lg-3"
1094
+ },
1095
+ t("txt_reject_consent")
1096
+ ), level === 2 || level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
1097
+ Button,
1098
+ {
1099
+ variant: "outline-success",
1100
+ onClick: handleAgree,
1101
+ className: "w-100 me-3 d-flex align-items-center justify-content-center fs-14 rounded-pill py-2 py-lg-3"
1102
+ },
1103
+ loadingCheckAccount ? /* @__PURE__ */ React.createElement(
1104
+ "span",
1105
+ {
1106
+ className: "spinner-border spinner-border-sm me-1",
1107
+ role: "status",
1108
+ "aria-hidden": "true"
1109
+ }
1110
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null),
1111
+ t("txt_yes_i_consent")
1112
+ ), layout === "simple-consent-mode" || layout === "simple-web-2" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1113
+ Button,
1114
+ {
1115
+ variant: "outline-success",
1116
+ onClick: () => {
1117
+ setUpgradeLayout(true);
1118
+ },
1119
+ className: "d-flex align-items-center justify-content-center fs-14 w-100 me-3 mb-2 mb-lg-0 rounded-pill py-2 py-lg-3"
1120
+ },
1121
+ t("txt_change_consent")
1122
+ ), " ")) : /* @__PURE__ */ React.createElement(React.Fragment, null)))
1123
+ ))) : /* @__PURE__ */ React.createElement("div", { className: "p-4" }, /* @__PURE__ */ React.createElement(
1124
+ ContentLoader,
1125
+ {
1126
+ speed: 2,
1127
+ width: 340,
1128
+ height: 84,
1129
+ viewBox: "0 0 340 84",
1130
+ backgroundColor: "#f3f3f3",
1131
+ foregroundColor: "#ecebeb"
1132
+ },
1133
+ /* @__PURE__ */ React.createElement("rect", { x: "0", y: "0", rx: "3", ry: "3", width: "67", height: "11" }),
1134
+ /* @__PURE__ */ React.createElement("rect", { x: "76", y: "0", rx: "3", ry: "3", width: "140", height: "11" }),
1135
+ /* @__PURE__ */ React.createElement("rect", { x: "127", y: "48", rx: "3", ry: "3", width: "53", height: "11" }),
1136
+ /* @__PURE__ */ React.createElement("rect", { x: "187", y: "48", rx: "3", ry: "3", width: "72", height: "11" }),
1137
+ /* @__PURE__ */ React.createElement("rect", { x: "18", y: "48", rx: "3", ry: "3", width: "100", height: "11" }),
1138
+ /* @__PURE__ */ React.createElement("rect", { x: "0", y: "71", rx: "3", ry: "3", width: "37", height: "11" }),
1139
+ /* @__PURE__ */ React.createElement("rect", { x: "18", y: "23", rx: "3", ry: "3", width: "140", height: "11" }),
1140
+ /* @__PURE__ */ React.createElement("rect", { x: "166", y: "23", rx: "3", ry: "3", width: "173", height: "11" })
1141
+ ))))
1142
+ )
1143
+ ), !account && loading === "connect" && /* @__PURE__ */ React.createElement(
1144
+ Connect_default,
1145
+ {
1146
+ isConnecting,
1147
+ handleOnConnect,
1148
+ activeConnectorError,
1149
+ activeConnectorType,
1150
+ activeConnector
1151
+ }
1152
+ ));
1153
+ };
1154
+ var ConsentCustom_default = ConsentComponentCustom;
1155
+ export {
1156
+ ConsentCustom_default as default
1157
+ };