aesirx-analytics 2.3.6 → 2.4.0

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