aesirx-analytics 2.2.11 → 2.2.13

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,1178 @@
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
+ check_circle_default,
12
+ getWeb3ID,
13
+ no_default,
14
+ useConsentStatus_default
15
+ } from "./chunk-MPD57P7C.js";
16
+ import {
17
+ AnalyticsContext,
18
+ agreeConsents,
19
+ bg_default,
20
+ getConsents,
21
+ getMember,
22
+ getNonce,
23
+ getSignature,
24
+ getWalletNonce,
25
+ loadGtagScript,
26
+ loadGtmScript,
27
+ privacy_default,
28
+ revokeConsents,
29
+ useTranslation,
30
+ verifySignature
31
+ } from "./chunk-N4WREXIA.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,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAlCAYAAADWSWD3AAAACXBIWXMAAAsTAAALEwEAmpwYA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hWC3DiGPvyJWVlhgcnJCp1KzCXKf0ZUTBlowYYO4mPHEpn09SrHT7+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
+ window.funcAfterReject && window.funcAfterReject();
525
+ };
526
+ const handleRevokeBtn = async () => {
527
+ const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
528
+ const consentType = sessionStorage.getItem("aesirx-analytics-consent-type");
529
+ const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
530
+ try {
531
+ let flag = true;
532
+ if (levelRevoke !== "1") {
533
+ if (parseInt(levelRevoke) > 2) {
534
+ if (!jwt && (parseInt(levelRevoke) === 2 || parseInt(levelRevoke) === 4)) {
535
+ SSOClick(".revokeLogin");
536
+ return;
537
+ }
538
+ if (account && consentType !== "metamask") {
539
+ setLoading("sign");
540
+ const signature = await getSignature(
541
+ endpoint,
542
+ account,
543
+ connection,
544
+ "Revoke consent:{nonce} {domain} {time}"
545
+ );
546
+ setLoading("saving");
547
+ const consentList = await getConsents(endpoint, uuid);
548
+ consentList.forEach(async (consent) => {
549
+ !consent?.expiration && await revokeConsents(
550
+ endpoint,
551
+ levelRevoke,
552
+ consent?.consent_uuid,
553
+ account,
554
+ signature,
555
+ web3ID,
556
+ jwt
557
+ );
558
+ });
559
+ setLoading("done");
560
+ handleRevoke(false);
561
+ } else if (connector) {
562
+ setLoading("sign");
563
+ setLoading("saving");
564
+ const nonce = await getNonce(
565
+ endpoint,
566
+ address,
567
+ "Revoke consent:{nonce} {domain} {time}",
568
+ "metamask"
569
+ );
570
+ signMessage({ message: `${nonce}` });
571
+ } else {
572
+ setLoading("connect");
573
+ flag = false;
574
+ }
575
+ } else {
576
+ if (!jwt && parseInt(levelRevoke) === 2) {
577
+ SSOClick(".revokeLogin");
578
+ return;
579
+ } else {
580
+ setLoading("saving");
581
+ const consentList = await getConsents(endpoint, uuid);
582
+ consentList.forEach(async (consent) => {
583
+ !consent?.expiration && await revokeConsents(
584
+ endpoint,
585
+ levelRevoke,
586
+ consent?.consent_uuid,
587
+ null,
588
+ null,
589
+ null,
590
+ jwt
591
+ );
592
+ });
593
+ setLoading("done");
594
+ handleRevoke(false);
595
+ }
596
+ }
597
+ if (flag && (account && consentType !== "metamask" || level < 3)) {
598
+ setShowExpandConsent(false);
599
+ setShow(true);
600
+ setShowBackdrop(false);
601
+ sessionStorage.removeItem("aesirx-analytics-allow");
602
+ }
603
+ } else {
604
+ handleRevoke(false);
605
+ setShowExpandConsent(false);
606
+ setShow(true);
607
+ setShowBackdrop(false);
608
+ sessionStorage.removeItem("aesirx-analytics-allow");
609
+ }
610
+ const hostUrl = endpoint ? endpoint : "";
611
+ const root = hostUrl ? hostUrl.replace(/\/$/, "") : "";
612
+ trackEvent(root, "", {
613
+ event_name: "Revoke consent",
614
+ event_type: "revoke-consent"
615
+ });
616
+ } catch (error) {
617
+ console.log(error);
618
+ setLoading("done");
619
+ toast.error(error?.response?.data?.error ?? error.message);
620
+ }
621
+ };
622
+ const SSOClick = (selector) => {
623
+ const element = document.querySelector(selector);
624
+ element.click();
625
+ };
626
+ useEffect(() => {
627
+ if (activeConnectorError) {
628
+ toast.error(activeConnectorError);
629
+ }
630
+ }, [activeConnectorError]);
631
+ useEffect(() => {
632
+ if (sessionStorage.getItem("aesirx-analytics-rejected") === "true") {
633
+ setShowBackdrop(false);
634
+ setShowExpandConsent(false);
635
+ }
636
+ if (sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0") {
637
+ window.funcAfterConsent && window.funcAfterConsent();
638
+ }
639
+ (gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
640
+ }, []);
641
+ useEffect(() => {
642
+ if (showExpandRevoke && isDesktop && (sessionStorage.getItem("aesirx-analytics-revoke") === "3" || sessionStorage.getItem("aesirx-analytics-revoke") === "4")) {
643
+ setActiveConnectorType(BROWSER_WALLET);
644
+ }
645
+ }, [showExpandRevoke]);
646
+ console.log("level", uuid, level, web3ID, account, loading);
647
+ const ConsentLevelUprade = ({ level: level2, levelname, image, content, isUpgrade = false }) => {
648
+ return /* @__PURE__ */ React.createElement(
649
+ "div",
650
+ {
651
+ className: `consent_level mt-2 h-100 ${isUpgrade ? `cursor-pointer ${upgradeLevel === level2 ? "active" : ""}` : ""} `,
652
+ onClick: () => {
653
+ setUpgradeLevel(level2);
654
+ handleLevel(level2);
655
+ }
656
+ },
657
+ /* @__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)),
658
+ /* @__PURE__ */ React.createElement("div", { className: "checkbox_img" }, /* @__PURE__ */ React.createElement(
659
+ "img",
660
+ {
661
+ width: "23px",
662
+ height: "23px",
663
+ src: upgradeLevel === level2 ? checkbox_active_default : checkbox_default
664
+ }
665
+ ))
666
+ );
667
+ };
668
+ const loadConsentDefault = (gtagId2, gtmId2) => {
669
+ window.dataLayer = window.dataLayer || [];
670
+ function gtag(p0, p1, p2) {
671
+ dataLayer.push(arguments);
672
+ }
673
+ gtag("consent", "default", {
674
+ ad_user_data: "denied",
675
+ ad_personalization: "denied",
676
+ ad_storage: "denied",
677
+ analytics_storage: "denied",
678
+ wait_for_update: 500
679
+ });
680
+ if (gtagId2) {
681
+ gtag("js", /* @__PURE__ */ new Date());
682
+ gtag("config", `${gtagId2}`);
683
+ }
684
+ if (gtmId2) {
685
+ dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
686
+ }
687
+ if (layout === "advance-consent-mode") {
688
+ gtagId2 && loadGtagScript(gtagId2);
689
+ gtmId2 && loadGtmScript(gtmId2);
690
+ gtag("set", "url_passthrough", true);
691
+ gtag("set", "ads_data_redaction", true);
692
+ }
693
+ };
694
+ const paymentRevoke = sessionStorage.getItem("aesirx-analytics-payment");
695
+ const advisorRevoke = sessionStorage.getItem("aesirx-analytics-advisor");
696
+ console.log("loading", loading);
697
+ 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(
698
+ "div",
699
+ {
700
+ tabIndex: -1,
701
+ className: `toast-container position-fixed m-md-3 ${showExpandRevoke ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
702
+ },
703
+ /* @__PURE__ */ React.createElement(
704
+ "div",
705
+ {
706
+ className: `toast revoke-toast custom ${showRevoke || sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0" ? "show" : ""} ${showExpandRevoke ? "" : "minimize"}`
707
+ },
708
+ /* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
709
+ /* @__PURE__ */ React.createElement("div", { className: "toast-body p-0 shadow mx-1 mx-md-0 mb-2 mb-md-0" }, /* @__PURE__ */ React.createElement(
710
+ "div",
711
+ {
712
+ className: `revoke-wrapper minimize-shield-wrapper position-relative ${showExpandRevoke ? "bg-white" : ""}`
713
+ },
714
+ !showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
715
+ "img",
716
+ {
717
+ className: "cover-img position-absolute h-100 w-100 object-fit-cover",
718
+ src: bg_default
719
+ }
720
+ ), /* @__PURE__ */ React.createElement(
721
+ "div",
722
+ {
723
+ className: "minimize-shield",
724
+ onClick: () => {
725
+ if (osName !== OsTypes?.IOS && isMobile && !connection && sessionStorage.getItem("aesirx-analytics-revoke") && parseInt(sessionStorage.getItem("aesirx-analytics-revoke")) > 2) {
726
+ setActiveConnectorType(WALLET_CONNECT);
727
+ }
728
+ setShowExpandRevoke(true);
729
+ }
730
+ },
731
+ /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
732
+ t("txt_shield_of_privacy")
733
+ )),
734
+ showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
735
+ "div",
736
+ {
737
+ 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`,
738
+ style: {
739
+ borderBottom: "1px solid #DEDEDE"
740
+ }
741
+ },
742
+ /* @__PURE__ */ React.createElement("div", { className: "text-primary text-nowrap" }, t("txt_tracking_data_privacy")),
743
+ /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center fs-14 text-primary" }, /* @__PURE__ */ React.createElement(
744
+ "a",
745
+ {
746
+ href: "https://shield.aesirx.io/",
747
+ rel: "noreferrer",
748
+ target: "_blank",
749
+ className: "minimize-shield-wrapper position-relative text-decoration-none"
750
+ },
751
+ /* @__PURE__ */ React.createElement(
752
+ "img",
753
+ {
754
+ className: "cover-img position-absolute h-100 w-100 object-fit-cover z-1",
755
+ src: bg_default
756
+ }
757
+ ),
758
+ /* @__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"))
759
+ ))
760
+ ), /* @__PURE__ */ React.createElement(
761
+ "div",
762
+ {
763
+ className: "minimize-revoke",
764
+ onClick: () => {
765
+ setShowExpandRevoke(false);
766
+ }
767
+ },
768
+ /* @__PURE__ */ React.createElement("img", { src: no_default })
769
+ ), /* @__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(
770
+ Form.Check,
771
+ {
772
+ id: `option-revoke-payment`,
773
+ checked: revokeConsentOption === "payment",
774
+ type: "checkbox",
775
+ label: t("txt_revoke_opt_in"),
776
+ value: "payment",
777
+ onChange: ({ target: { value } }) => {
778
+ setRevokeConsentOption(value);
779
+ }
780
+ }
781
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null), advisorRevoke ? /* @__PURE__ */ React.createElement(
782
+ Form.Check,
783
+ {
784
+ id: `option-revoke-advisor`,
785
+ checked: revokeConsentOption === "advisor",
786
+ type: "checkbox",
787
+ label: t("txt_revoke_opt_in_advisor"),
788
+ value: "advisor",
789
+ onChange: ({ target: { value } }) => {
790
+ setRevokeConsentOption(value);
791
+ }
792
+ }
793
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement(
794
+ Form.Check,
795
+ {
796
+ id: `option-revoke-consent`,
797
+ checked: revokeConsentOption === "consent",
798
+ type: "checkbox",
799
+ label: t("txt_revoke_consent_for_the_site"),
800
+ value: "consent",
801
+ onChange: ({ target: { value } }) => {
802
+ setRevokeConsentOption(value);
803
+ }
804
+ }
805
+ )), /* @__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(
806
+ "a",
807
+ {
808
+ 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",
809
+ href: "https://dapp.shield.aesirx.io/revoke-consent",
810
+ target: "_blank",
811
+ rel: "noreferrer"
812
+ },
813
+ t("txt_manage_consent")
814
+ ), loading === "done" ? /* @__PURE__ */ React.createElement(
815
+ Button,
816
+ {
817
+ variant: "outline-success",
818
+ onClick: async () => {
819
+ if (revokeConsentOption === "payment") {
820
+ sessionStorage.removeItem("aesirx-analytics-payment");
821
+ setShowExpandRevoke(false);
822
+ setRevokeConsentOption("consent");
823
+ setTimeout(() => {
824
+ window.location.reload();
825
+ }, 1e3);
826
+ } else if (revokeConsentOption === "advisor") {
827
+ sessionStorage.removeItem("aesirx-analytics-advisor");
828
+ setShowExpandRevoke(false);
829
+ setRevokeConsentOption("consent");
830
+ setTimeout(() => {
831
+ window.location.reload();
832
+ }, 1e3);
833
+ } else {
834
+ await handleRevokeBtn();
835
+ if (level > 1) {
836
+ setTimeout(() => {
837
+ window.location.reload();
838
+ }, 1e3);
839
+ }
840
+ }
841
+ },
842
+ 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"
843
+ },
844
+ t("txt_revoke_consent")
845
+ ) : /* @__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(
846
+ SSOButton,
847
+ {
848
+ className: "d-none revokeLogin",
849
+ text: /* @__PURE__ */ React.createElement(React.Fragment, null, "Login Revoke"),
850
+ ssoState: "noscopes",
851
+ onGetData
852
+ }
853
+ ))))))))
854
+ ))
855
+ )
856
+ ), /* @__PURE__ */ React.createElement(
857
+ "div",
858
+ {
859
+ tabIndex: -1,
860
+ className: `toast-container position-fixed m-md-3 ${showExpandConsent ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
861
+ },
862
+ /* @__PURE__ */ React.createElement(
863
+ "div",
864
+ {
865
+ className: `toast custom ${show ? "show" : ""} ${showExpandConsent ? "" : "minimize"}`
866
+ },
867
+ /* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
868
+ /* @__PURE__ */ React.createElement("div", { className: "toast-body p-0 shadow mx-1 mx-md-0 mb-2 mb-md-0" }, !showExpandConsent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "minimize-shield-wrapper position-relative" }, /* @__PURE__ */ React.createElement(
869
+ "img",
870
+ {
871
+ className: "cover-img position-absolute h-100 w-100 object-fit-cover",
872
+ src: bg_default
873
+ }
874
+ ), /* @__PURE__ */ React.createElement(
875
+ "div",
876
+ {
877
+ className: "minimize-shield",
878
+ ref: analyticsContext?.ref,
879
+ onClick: () => {
880
+ setShowExpandConsent(true);
881
+ const rejectConsent = sessionStorage.getItem("aesirx-analytics-rejected");
882
+ rejectConsent && setShowRejectedConsent(true);
883
+ sessionStorage.removeItem("aesirx-analytics-rejected");
884
+ }
885
+ },
886
+ /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
887
+ t("txt_shield_of_privacy")
888
+ ))) : /* @__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-1 mb-lg-3" }, t("txt_select_your_preferred")), /* @__PURE__ */ React.createElement(Form, null, /* @__PURE__ */ React.createElement(Row, null, /* @__PURE__ */ React.createElement(Col, { lg: 6, className: "mb-2 mb-lg-0" }, /* @__PURE__ */ React.createElement(
889
+ ConsentLevelUprade,
890
+ {
891
+ level: 3,
892
+ levelname: t(`txt_decentralized_wallet`),
893
+ image: wallet_consent_default,
894
+ content: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__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_decentralized_wallet_will_be_loaded"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
902
+ "img",
903
+ {
904
+ src: check_circle_default,
905
+ width: "14px",
906
+ height: "15px"
907
+ }
908
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_both_first_party_third_party"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
909
+ "img",
910
+ {
911
+ src: check_circle_default,
912
+ width: "14px",
913
+ height: "15px"
914
+ }
915
+ )), /* @__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 check-line" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
916
+ "img",
917
+ {
918
+ src: check_circle_default,
919
+ width: "14px",
920
+ height: "15px"
921
+ }
922
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_users_can_revoke")))),
923
+ isUpgrade: true
924
+ }
925
+ )), /* @__PURE__ */ React.createElement(Col, { lg: 6 }, /* @__PURE__ */ React.createElement(
926
+ ConsentLevelUprade,
927
+ {
928
+ level: 4,
929
+ levelname: t(`txt_decentralized_wallet_shield`),
930
+ image: wallet_shield_consent_default,
931
+ content: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__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_decentralized_wallet_will_be_loaded"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__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_both_first_party_third_party"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
946
+ "img",
947
+ {
948
+ src: check_circle_default,
949
+ width: "14px",
950
+ height: "15px"
951
+ }
952
+ )), /* @__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 check-line" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
953
+ "img",
954
+ {
955
+ src: check_circle_default,
956
+ width: "14px",
957
+ height: "15px"
958
+ }
959
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_users_can_revoke_dapp"))), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-start check-line" }, /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(
960
+ "img",
961
+ {
962
+ src: check_circle_default,
963
+ width: "14px",
964
+ height: "15px"
965
+ }
966
+ )), /* @__PURE__ */ React.createElement("div", { className: "ms-10px" }, t("txt_users_can_earn")))),
967
+ isUpgrade: true
968
+ }
969
+ )))), /* @__PURE__ */ React.createElement("div", { className: "d-flex w-100 flex-wrap flex-lg-nowrap justify-content-between mt-4" }, /* @__PURE__ */ React.createElement(
970
+ Button,
971
+ {
972
+ variant: "outline-success",
973
+ onClick: () => {
974
+ setUpgradeLayout(false);
975
+ handleLevel(1);
976
+ },
977
+ 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"
978
+ },
979
+ t("txt_back")
980
+ ), /* @__PURE__ */ React.createElement(
981
+ "div",
982
+ {
983
+ 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"}`
984
+ },
985
+ layout !== "simple-consent-mode" && layout !== "simple-web-2" && /* @__PURE__ */ React.createElement(
986
+ Suspense,
987
+ {
988
+ fallback: /* @__PURE__ */ React.createElement("div", { className: "d-flex h-100 justify-content-center align-items-center" }, "Loading...")
989
+ },
990
+ /* @__PURE__ */ React.createElement(
991
+ SSOButton,
992
+ {
993
+ 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",
994
+ text: /* @__PURE__ */ React.createElement(React.Fragment, null, t("txt_continue")),
995
+ ssoState: "noscopes",
996
+ onGetData,
997
+ ...level === 2 ? { noCreateAccount: true } : {}
998
+ }
999
+ )
1000
+ )
1001
+ ), level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
1002
+ Button,
1003
+ {
1004
+ variant: "success",
1005
+ onClick: handleAgree,
1006
+ 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"
1007
+ },
1008
+ loadingCheckAccount ? /* @__PURE__ */ React.createElement(
1009
+ "span",
1010
+ {
1011
+ className: "spinner-border spinner-border-sm me-1",
1012
+ role: "status",
1013
+ "aria-hidden": "true"
1014
+ }
1015
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null),
1016
+ t("txt_continue")
1017
+ ))))) : showRejectedConsent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1018
+ TermsComponent,
1019
+ {
1020
+ level,
1021
+ handleLevel,
1022
+ isCustom: true,
1023
+ layout,
1024
+ isRejectedLayout: true
1025
+ },
1026
+ /* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100" }, /* @__PURE__ */ React.createElement(
1027
+ Form.Check,
1028
+ {
1029
+ checked: consents.includes(1),
1030
+ type: "switch",
1031
+ label: "Personal data share consent.",
1032
+ value: 1,
1033
+ onChange: handleChange,
1034
+ className: "d-none"
1035
+ }
1036
+ ), /* @__PURE__ */ React.createElement(
1037
+ Form.Check,
1038
+ {
1039
+ checked: consents.includes(2),
1040
+ type: "switch",
1041
+ label: "Personal data cross site share consent.",
1042
+ value: 2,
1043
+ onChange: handleChange,
1044
+ className: "d-none"
1045
+ }
1046
+ ), /* @__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(
1047
+ Button,
1048
+ {
1049
+ variant: "outline-success",
1050
+ onClick: handleNotAllow,
1051
+ 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"
1052
+ },
1053
+ t("txt_reject_consent")
1054
+ ), level === 2 || level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
1055
+ Button,
1056
+ {
1057
+ variant: "outline-success",
1058
+ onClick: handleAgree,
1059
+ className: "w-100 me-3 mb-2 mb-lg-0 d-flex align-items-center justify-content-center fs-14 rounded-pill py-2 py-lg-3"
1060
+ },
1061
+ loadingCheckAccount ? /* @__PURE__ */ React.createElement(
1062
+ "span",
1063
+ {
1064
+ className: "spinner-border spinner-border-sm me-1",
1065
+ role: "status",
1066
+ "aria-hidden": "true"
1067
+ }
1068
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null),
1069
+ t("txt_yes_i_consent")
1070
+ ), layout === "simple-consent-mode" || layout === "simple-web-2" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1071
+ Button,
1072
+ {
1073
+ variant: "outline-success",
1074
+ onClick: () => {
1075
+ setUpgradeLayout(true);
1076
+ },
1077
+ 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"
1078
+ },
1079
+ t("txt_change_consent")
1080
+ ), " ")) : /* @__PURE__ */ React.createElement(React.Fragment, null)))
1081
+ )) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1082
+ TermsComponent,
1083
+ {
1084
+ level,
1085
+ handleLevel,
1086
+ isCustom: true,
1087
+ layout
1088
+ },
1089
+ /* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100" }, /* @__PURE__ */ React.createElement(
1090
+ Form.Check,
1091
+ {
1092
+ checked: consents.includes(1),
1093
+ type: "switch",
1094
+ label: "Personal data share consent.",
1095
+ value: 1,
1096
+ onChange: handleChange,
1097
+ className: "d-none"
1098
+ }
1099
+ ), /* @__PURE__ */ React.createElement(
1100
+ Form.Check,
1101
+ {
1102
+ checked: consents.includes(2),
1103
+ type: "switch",
1104
+ label: "Personal data cross site share consent.",
1105
+ value: 2,
1106
+ onChange: handleChange,
1107
+ className: "d-none"
1108
+ }
1109
+ ), /* @__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(
1110
+ Button,
1111
+ {
1112
+ variant: "outline-success",
1113
+ onClick: handleNotAllow,
1114
+ 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"
1115
+ },
1116
+ t("txt_reject_consent")
1117
+ ), level === 2 || level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
1118
+ Button,
1119
+ {
1120
+ variant: "outline-success",
1121
+ onClick: handleAgree,
1122
+ className: "w-100 me-3 mb-2 mb-lg-0 d-flex align-items-center justify-content-center fs-14 rounded-pill py-2 py-lg-3"
1123
+ },
1124
+ loadingCheckAccount ? /* @__PURE__ */ React.createElement(
1125
+ "span",
1126
+ {
1127
+ className: "spinner-border spinner-border-sm me-1",
1128
+ role: "status",
1129
+ "aria-hidden": "true"
1130
+ }
1131
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null),
1132
+ t("txt_yes_i_consent")
1133
+ ), layout === "simple-consent-mode" || layout === "simple-web-2" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1134
+ Button,
1135
+ {
1136
+ variant: "outline-success",
1137
+ onClick: () => {
1138
+ setUpgradeLayout(true);
1139
+ },
1140
+ 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"
1141
+ },
1142
+ t("txt_change_consent")
1143
+ ), " ")) : /* @__PURE__ */ React.createElement(React.Fragment, null)))
1144
+ ))) : /* @__PURE__ */ React.createElement("div", { className: "p-4" }, /* @__PURE__ */ React.createElement(
1145
+ ContentLoader,
1146
+ {
1147
+ speed: 2,
1148
+ width: 340,
1149
+ height: 84,
1150
+ viewBox: "0 0 340 84",
1151
+ backgroundColor: "#f3f3f3",
1152
+ foregroundColor: "#ecebeb"
1153
+ },
1154
+ /* @__PURE__ */ React.createElement("rect", { x: "0", y: "0", rx: "3", ry: "3", width: "67", height: "11" }),
1155
+ /* @__PURE__ */ React.createElement("rect", { x: "76", y: "0", rx: "3", ry: "3", width: "140", height: "11" }),
1156
+ /* @__PURE__ */ React.createElement("rect", { x: "127", y: "48", rx: "3", ry: "3", width: "53", height: "11" }),
1157
+ /* @__PURE__ */ React.createElement("rect", { x: "187", y: "48", rx: "3", ry: "3", width: "72", height: "11" }),
1158
+ /* @__PURE__ */ React.createElement("rect", { x: "18", y: "48", rx: "3", ry: "3", width: "100", height: "11" }),
1159
+ /* @__PURE__ */ React.createElement("rect", { x: "0", y: "71", rx: "3", ry: "3", width: "37", height: "11" }),
1160
+ /* @__PURE__ */ React.createElement("rect", { x: "18", y: "23", rx: "3", ry: "3", width: "140", height: "11" }),
1161
+ /* @__PURE__ */ React.createElement("rect", { x: "166", y: "23", rx: "3", ry: "3", width: "173", height: "11" })
1162
+ ))))
1163
+ )
1164
+ ), !account && loading === "connect" && /* @__PURE__ */ React.createElement(
1165
+ Connect_default,
1166
+ {
1167
+ isConnecting,
1168
+ handleOnConnect,
1169
+ activeConnectorError,
1170
+ activeConnectorType,
1171
+ activeConnector
1172
+ }
1173
+ ));
1174
+ };
1175
+ var ConsentCustom_default = ConsentComponentCustom;
1176
+ export {
1177
+ ConsentCustom_default as default
1178
+ };