aesirx-analytics 2.2.11 → 2.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,934 +0,0 @@
1
- import {
2
- BROWSER_WALLET,
3
- Connect_default,
4
- Ethereum_default,
5
- LoadingStatus,
6
- TermsComponent,
7
- WALLET_CONNECT,
8
- arrow_default,
9
- bg_default,
10
- getWeb3ID,
11
- no_default,
12
- privacy_default,
13
- useConsentStatus_default,
14
- yes_default
15
- } from "./chunk-5VSCCPP6.js";
16
- import {
17
- AnalyticsContext,
18
- agreeConsents,
19
- getConsents,
20
- getMember,
21
- getNonce,
22
- getSignature,
23
- getWalletNonce,
24
- loadGtagScript,
25
- loadGtmScript,
26
- revokeConsents,
27
- useTranslation,
28
- verifySignature
29
- } from "./chunk-N36VEWSG.js";
30
-
31
- // src/Components/ConsentCustom.tsx
32
- import React, { useContext, useEffect, useState } from "react";
33
- import { Button, Form } from "react-bootstrap";
34
- import { ToastContainer, toast } from "react-toastify";
35
-
36
- // src/Assets/checkbox.svg
37
- 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';
38
-
39
- // src/Assets/checkbox_active.svg
40
- 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';
41
-
42
- // src/Components/ConsentCustom.tsx
43
- import ContentLoader from "react-content-loader";
44
- import { SSOButton } from "aesirx-sso";
45
- import {
46
- MAINNET,
47
- WithWalletConnector,
48
- useConnection,
49
- useConnect,
50
- stringMessage,
51
- useGrpcClient,
52
- TESTNET
53
- } from "@concordium/react-components";
54
- import { OsTypes, isDesktop, isMobile, osName } from "react-device-detect";
55
- import { useAccount, useSignMessage } from "wagmi";
56
- var ConsentComponentCustom = ({
57
- endpoint,
58
- aesirXEndpoint,
59
- networkEnv,
60
- loginApp,
61
- isLoggedApp,
62
- gtagId,
63
- gtmId,
64
- layout
65
- }) => {
66
- return /* @__PURE__ */ React.createElement(WithWalletConnector, { network: networkEnv === "testnet" ? TESTNET : MAINNET }, (props) => /* @__PURE__ */ React.createElement("div", { className: "aesirxconsent" }, /* @__PURE__ */ React.createElement(Ethereum_default, null, /* @__PURE__ */ React.createElement(
67
- ConsentComponentCustomApp,
68
- {
69
- ...props,
70
- endpoint,
71
- aesirXEndpoint,
72
- loginApp,
73
- isLoggedApp,
74
- gtagId,
75
- gtmId,
76
- layout
77
- }
78
- ))));
79
- };
80
- var ConsentComponentCustomApp = (props) => {
81
- const {
82
- endpoint,
83
- aesirXEndpoint,
84
- loginApp,
85
- isLoggedApp,
86
- gtagId,
87
- gtmId,
88
- layout,
89
- activeConnectorType,
90
- activeConnector,
91
- activeConnectorError,
92
- connectedAccounts,
93
- genesisHashes,
94
- setActiveConnectorType,
95
- network
96
- } = props;
97
- const { setConnection } = useConnection(connectedAccounts, genesisHashes);
98
- const { isConnecting } = useConnect(activeConnector, setConnection);
99
- const handleOnConnect = async (connectorType, network2 = "concordium") => {
100
- if (network2 === "concordium") {
101
- setActiveConnectorType(connectorType);
102
- }
103
- setLoading("done");
104
- };
105
- const [
106
- uuid,
107
- level,
108
- connection,
109
- account,
110
- show,
111
- setShow,
112
- web3ID,
113
- setWeb3ID,
114
- handleLevel,
115
- showRevoke,
116
- handleRevoke
117
- ] = useConsentStatus_default(endpoint, layout, props);
118
- const [consents, setConsents] = useState([1, 2]);
119
- const [loading, setLoading] = useState("done");
120
- const [loadingCheckAccount, setLoadingCheckAccount] = useState(false);
121
- const [showExpandConsent, setShowExpandConsent] = useState(true);
122
- const [showExpandRevoke, setShowExpandRevoke] = useState(false);
123
- const [showBackdrop, setShowBackdrop] = useState(true);
124
- const [consentTier4, setConsentTier4] = useState({});
125
- const [upgradeLayout, setUpgradeLayout] = useState(false);
126
- const [upgradeShowDetail, setUpgradeShowDetail] = useState(false);
127
- const [upgradeLevel, setUpgradeLevel] = useState(0);
128
- const analyticsContext = useContext(AnalyticsContext);
129
- const { t } = useTranslation();
130
- const gRPCClient = useGrpcClient(network);
131
- const { address, connector } = useAccount();
132
- const { signMessage } = useSignMessage({
133
- async onSuccess(data, variables) {
134
- const signature = Buffer.from(
135
- typeof data === "object" && data !== null ? JSON.stringify(data) : data,
136
- "utf-8"
137
- ).toString("base64");
138
- const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
139
- if (variables?.message.indexOf("Revoke consent") > -1) {
140
- const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
141
- const consentList = await getConsents(endpoint, uuid);
142
- consentList.forEach(async (consent) => {
143
- !consent?.expiration && await revokeConsents(
144
- endpoint,
145
- levelRevoke,
146
- consent?.consent_uuid,
147
- address,
148
- signature,
149
- web3ID,
150
- jwt,
151
- "metamask"
152
- );
153
- });
154
- setLoading("done");
155
- handleRevoke(false);
156
- setShowExpandConsent(false);
157
- setShow(true);
158
- setShowBackdrop(false);
159
- sessionStorage.removeItem("aesirx-analytics-allow");
160
- } else if (variables?.message.indexOf("Login with nonce") > -1) {
161
- const res = await verifySignature(aesirXEndpoint, "metamask", address, data);
162
- sessionStorage.setItem("aesirx-analytics-jwt", res?.jwt);
163
- setLoadingCheckAccount(false);
164
- const nonce = await getNonce(
165
- endpoint,
166
- address,
167
- "Give consent Tier 4:{nonce} {domain} {time}",
168
- "metamask"
169
- );
170
- signMessage({ message: `${nonce}` });
171
- } else {
172
- setLoading("saving");
173
- await agreeConsents(
174
- endpoint,
175
- level,
176
- uuid,
177
- consents,
178
- address,
179
- signature,
180
- web3ID,
181
- jwt,
182
- "metamask",
183
- gtagId,
184
- gtmId,
185
- layout
186
- );
187
- sessionStorage.setItem("aesirx-analytics-uuid", uuid);
188
- sessionStorage.setItem("aesirx-analytics-allow", "1");
189
- sessionStorage.setItem("aesirx-analytics-consent-type", "metamask");
190
- setShow(false);
191
- setLoading("done");
192
- handleRevoke(true, level);
193
- setShowBackdrop(false);
194
- }
195
- },
196
- async onError(error) {
197
- setLoading("done");
198
- toast.error(error.message);
199
- }
200
- });
201
- const handleChange = async ({ target: { value } }) => {
202
- if (consents.indexOf(parseInt(value)) === -1) {
203
- setConsents([...consents, ...[parseInt(value)]]);
204
- } else {
205
- setConsents(consents.filter((consent) => consent !== parseInt(value)));
206
- }
207
- };
208
- const handleAgree = async () => {
209
- try {
210
- let flag = true;
211
- let jwt = "";
212
- if (level > 2) {
213
- if (level === 4) {
214
- try {
215
- setLoadingCheckAccount(true);
216
- const nonceLogin = await getWalletNonce(
217
- aesirXEndpoint,
218
- account ? "concordium" : "metamask",
219
- account ?? address
220
- );
221
- if (nonceLogin) {
222
- try {
223
- if (account) {
224
- const signature = await connection.signMessage(
225
- account,
226
- stringMessage(`${nonceLogin}`)
227
- );
228
- const convertedSignature = typeof signature === "object" && signature !== null ? signature : JSON.parse(signature);
229
- if (signature) {
230
- const data = await verifySignature(
231
- aesirXEndpoint,
232
- "concordium",
233
- account,
234
- convertedSignature
235
- );
236
- sessionStorage.setItem("aesirx-analytics-jwt", data?.jwt);
237
- jwt = data?.jwt;
238
- loginApp && !isLoggedApp && loginApp(data);
239
- setLoadingCheckAccount(false);
240
- }
241
- } else {
242
- signMessage({ message: `${nonceLogin}` });
243
- }
244
- } catch (error) {
245
- setLoadingCheckAccount(false);
246
- toast(error.message);
247
- }
248
- }
249
- } catch (error) {
250
- SSOClick(".loginSSO");
251
- setLoadingCheckAccount(false);
252
- return;
253
- }
254
- }
255
- if (account) {
256
- const signature = await getSignature(
257
- endpoint,
258
- account,
259
- connection,
260
- level === 3 ? "Give consent:{nonce} {domain} {time}" : "Give consent Tier 4:{nonce} {domain} {time}"
261
- );
262
- setLoading("saving");
263
- await agreeConsents(
264
- endpoint,
265
- level,
266
- uuid,
267
- consents,
268
- account,
269
- signature,
270
- web3ID,
271
- jwt,
272
- "concordium",
273
- gtagId,
274
- gtmId,
275
- layout
276
- );
277
- sessionStorage.setItem("aesirx-analytics-consent-type", "concordium");
278
- } else if (connector) {
279
- if (level === 3) {
280
- const nonce = await getNonce(
281
- endpoint,
282
- address,
283
- level === 3 ? "Give consent:{nonce} {domain} {time}" : "Give consent Tier 4:{nonce} {domain} {time}",
284
- "metamask"
285
- );
286
- signMessage({ message: `${nonce}` });
287
- }
288
- } else {
289
- setLoading("connect");
290
- flag = false;
291
- }
292
- } else {
293
- setLoading("saving");
294
- const consentList = await getConsents(endpoint, analyticsContext.visitor_uuid);
295
- consents.forEach(async (consent) => {
296
- const existConsent = consentList.find((item) => item?.consent === consent);
297
- if (!existConsent) {
298
- await agreeConsents(
299
- endpoint,
300
- 1,
301
- uuid,
302
- consent,
303
- null,
304
- null,
305
- null,
306
- null,
307
- null,
308
- gtagId,
309
- gtmId,
310
- layout
311
- );
312
- } else if (!!existConsent?.consent_uuid && existConsent?.expiration && new Date(existConsent.expiration) < /* @__PURE__ */ new Date()) {
313
- await agreeConsents(
314
- endpoint,
315
- 1,
316
- uuid,
317
- consent,
318
- null,
319
- null,
320
- null,
321
- null,
322
- null,
323
- gtagId,
324
- gtmId,
325
- layout
326
- );
327
- }
328
- });
329
- }
330
- if (flag && (account || level < 3)) {
331
- sessionStorage.setItem("aesirx-analytics-uuid", uuid);
332
- sessionStorage.setItem("aesirx-analytics-allow", "1");
333
- setShow(false);
334
- setLoading("done");
335
- handleRevoke(true, level);
336
- setShowBackdrop(false);
337
- }
338
- } catch (error) {
339
- console.log(error);
340
- handleNotAllow();
341
- setLoading("done");
342
- toast.error(error?.response?.data?.error ?? error.message);
343
- }
344
- };
345
- useEffect(() => {
346
- const init = async () => {
347
- if (Object.keys(consentTier4)?.length && (account || address)) {
348
- await consentTier4Init(consentTier4);
349
- setConsentTier4({});
350
- }
351
- };
352
- init();
353
- }, [consentTier4, account, address]);
354
- const consentTier4Init = async (response) => {
355
- let hasWeb3ID = true;
356
- if (response?.loginType === "concordium") {
357
- const web3ID2 = await getWeb3ID(account, gRPCClient, network?.name);
358
- if (web3ID2) {
359
- setWeb3ID(web3ID2);
360
- } else {
361
- hasWeb3ID = false;
362
- }
363
- } else {
364
- const memberData = await getMember(aesirXEndpoint, response?.access_token);
365
- hasWeb3ID = memberData?.web3id ? true : false;
366
- }
367
- if (hasWeb3ID) {
368
- if (response?.loginType === "concordium") {
369
- sessionStorage.setItem("aesirx-analytics-consent-type", "concordium");
370
- const signature = await getSignature(
371
- endpoint,
372
- account,
373
- connection,
374
- "Give consent Tier 4:{nonce} {domain} {time}"
375
- );
376
- await agreeConsents(
377
- endpoint,
378
- level,
379
- uuid,
380
- consents,
381
- account,
382
- signature,
383
- null,
384
- response?.jwt,
385
- "concordium",
386
- gtagId,
387
- gtmId,
388
- layout
389
- );
390
- setShow(false);
391
- handleRevoke(true, level);
392
- setLoading("done");
393
- } else if (response?.loginType === "metamask") {
394
- sessionStorage.setItem("aesirx-analytics-consent-type", "metamask");
395
- const nonce = await getNonce(
396
- endpoint,
397
- address,
398
- "Give consent Tier 4:{nonce} {domain} {time}",
399
- "metamask"
400
- );
401
- signMessage({ message: `${nonce}` });
402
- }
403
- } else {
404
- handleLevel(3);
405
- toast("You haven't minted any WEB3 ID yet. Try to mint at https://dapp.shield.aesirx.io");
406
- setLoading("done");
407
- }
408
- };
409
- const onGetData = async (response) => {
410
- try {
411
- setLoading("saving");
412
- const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
413
- sessionStorage.setItem("aesirx-analytics-jwt", response?.jwt);
414
- if (levelRevoke && levelRevoke !== "0") {
415
- sessionStorage.setItem(
416
- "aesirx-analytics-consent-type",
417
- response?.loginType === "concordium" ? "concordium" : "metamask"
418
- );
419
- handleRevokeBtn();
420
- } else {
421
- if (level === 4) {
422
- if (response?.loginType === "concordium" && isDesktop) {
423
- setActiveConnectorType(BROWSER_WALLET);
424
- }
425
- setConsentTier4(response);
426
- } else {
427
- await agreeConsents(
428
- endpoint,
429
- level,
430
- uuid,
431
- consents,
432
- null,
433
- null,
434
- null,
435
- response?.jwt,
436
- "concordium",
437
- gtagId,
438
- gtmId,
439
- layout
440
- );
441
- setShow(false);
442
- handleRevoke(true, level);
443
- setLoading("done");
444
- }
445
- }
446
- loginApp && !isLoggedApp && loginApp(response);
447
- } catch (error) {
448
- console.log(error);
449
- setShow(false);
450
- setLoading("done");
451
- toast.error(error?.response?.data?.error ?? error.message);
452
- }
453
- };
454
- const handleNotAllow = () => {
455
- sessionStorage.setItem("aesirx-analytics-uuid", uuid);
456
- sessionStorage.setItem("aesirx-analytics-rejected", "true");
457
- setShowExpandConsent(false);
458
- setShowBackdrop(false);
459
- };
460
- const handleRevokeBtn = async () => {
461
- const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
462
- const consentType = sessionStorage.getItem("aesirx-analytics-consent-type");
463
- const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
464
- try {
465
- let flag = true;
466
- if (levelRevoke !== "1") {
467
- if (parseInt(levelRevoke) > 2) {
468
- if (!jwt && (parseInt(levelRevoke) === 2 || parseInt(levelRevoke) === 4)) {
469
- SSOClick(".revokeLogin");
470
- return;
471
- }
472
- if (account && consentType !== "metamask") {
473
- setLoading("sign");
474
- const signature = await getSignature(
475
- endpoint,
476
- account,
477
- connection,
478
- "Revoke consent:{nonce} {domain} {time}"
479
- );
480
- setLoading("saving");
481
- const consentList = await getConsents(endpoint, uuid);
482
- consentList.forEach(async (consent) => {
483
- !consent?.expiration && await revokeConsents(
484
- endpoint,
485
- levelRevoke,
486
- consent?.consent_uuid,
487
- account,
488
- signature,
489
- web3ID,
490
- jwt
491
- );
492
- });
493
- setLoading("done");
494
- handleRevoke(false);
495
- } else if (connector) {
496
- setLoading("sign");
497
- setLoading("saving");
498
- const nonce = await getNonce(
499
- endpoint,
500
- address,
501
- "Revoke consent:{nonce} {domain} {time}",
502
- "metamask"
503
- );
504
- signMessage({ message: `${nonce}` });
505
- } else {
506
- setLoading("connect");
507
- flag = false;
508
- }
509
- } else {
510
- setLoading("saving");
511
- const consentList = await getConsents(endpoint, uuid);
512
- consentList.forEach(async (consent) => {
513
- !consent?.expiration && await revokeConsents(
514
- endpoint,
515
- levelRevoke,
516
- consent?.consent_uuid,
517
- null,
518
- null,
519
- null,
520
- jwt
521
- );
522
- });
523
- setLoading("done");
524
- handleRevoke(false);
525
- }
526
- if (flag && (account && consentType !== "metamask" || level < 3)) {
527
- setShowExpandConsent(false);
528
- setShow(true);
529
- setShowBackdrop(false);
530
- sessionStorage.removeItem("aesirx-analytics-allow");
531
- }
532
- } else {
533
- handleRevoke(false);
534
- setShowExpandConsent(false);
535
- setShow(true);
536
- setShowBackdrop(false);
537
- sessionStorage.removeItem("aesirx-analytics-allow");
538
- }
539
- } catch (error) {
540
- console.log(error);
541
- setLoading("done");
542
- toast.error(error?.response?.data?.error ?? error.message);
543
- }
544
- };
545
- const SSOClick = (selector) => {
546
- const element = document.querySelector(selector);
547
- element.click();
548
- };
549
- useEffect(() => {
550
- if (activeConnectorError) {
551
- toast.error(activeConnectorError);
552
- }
553
- }, [activeConnectorError]);
554
- useEffect(() => {
555
- if (sessionStorage.getItem("aesirx-analytics-rejected") === "true") {
556
- setShowBackdrop(false);
557
- setShowExpandConsent(false);
558
- }
559
- if (sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0") {
560
- window.funcAfterConsent && window.funcAfterConsent();
561
- }
562
- (gtagId || gtmId) && loadConsentDefault(gtagId, gtmId);
563
- }, []);
564
- console.log("level", uuid, level, web3ID, account, loading);
565
- const ConsentLevelUprade = ({
566
- level: level2,
567
- tier,
568
- levelname,
569
- term_custom,
570
- content_custom,
571
- isUpgrade = false
572
- }) => {
573
- return /* @__PURE__ */ React.createElement(
574
- "div",
575
- {
576
- className: `consent_level mt-2 ${isUpgrade ? `cursor-pointer ${upgradeLevel === level2 ? "active" : ""}` : ""} `,
577
- onClick: () => {
578
- setUpgradeLevel(level2);
579
- }
580
- },
581
- /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center justify-content-between flex-wrap" }, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center" }, /* @__PURE__ */ React.createElement("div", { className: `status-tier tier-${level2} rounded-circle` }), /* @__PURE__ */ React.createElement("div", { className: "status-tier-text fw-semibold fs-14 text-primary" }, tier, " - ", levelname)), !isUpgrade ? /* @__PURE__ */ React.createElement("div", { className: "fw-semibold fs-14 text-primary" }, term_custom) : /* @__PURE__ */ React.createElement(React.Fragment, null, upgradeShowDetail ? /* @__PURE__ */ React.createElement("div", { className: "fw-semibold fs-14 text-primary" }, term_custom) : /* @__PURE__ */ React.createElement(React.Fragment, null))),
582
- !isUpgrade ? /* @__PURE__ */ React.createElement("div", { className: `${isUpgrade ? "consent_upgrade_content" : ""} mt-2` }, content_custom) : /* @__PURE__ */ React.createElement(React.Fragment, null, upgradeShowDetail ? /* @__PURE__ */ React.createElement("div", { className: "mt-2" }, content_custom) : /* @__PURE__ */ React.createElement(React.Fragment, null)),
583
- isUpgrade ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "checkbox_img" }, /* @__PURE__ */ React.createElement(
584
- "img",
585
- {
586
- width: "23px",
587
- height: "23px",
588
- src: upgradeLevel === level2 ? checkbox_active_default : checkbox_default
589
- }
590
- ))) : /* @__PURE__ */ React.createElement(React.Fragment, null)
591
- );
592
- };
593
- const loadConsentDefault = (gtagId2, gtmId2) => {
594
- window.dataLayer = window.dataLayer || [];
595
- function gtag(p0, p1, p2) {
596
- dataLayer.push(arguments);
597
- }
598
- gtag("consent", "default", {
599
- ad_user_data: "denied",
600
- ad_personalization: "denied",
601
- ad_storage: "denied",
602
- analytics_storage: "denied",
603
- wait_for_update: 500
604
- });
605
- if (gtagId2) {
606
- gtag("js", /* @__PURE__ */ new Date());
607
- gtag("config", `${gtagId2}`);
608
- }
609
- if (gtmId2) {
610
- dataLayer.push({ "gtm.start": (/* @__PURE__ */ new Date()).getTime(), event: "gtm.js" });
611
- }
612
- if (layout === "advance-consent-mode") {
613
- gtagId2 && loadGtagScript(gtagId2);
614
- gtmId2 && loadGtmScript(gtmId2);
615
- gtag("set", "url_passthrough", true);
616
- gtag("set", "ads_data_redaction", true);
617
- }
618
- };
619
- 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(
620
- "div",
621
- {
622
- tabIndex: -1,
623
- className: `toast-container position-fixed m-md-3 ${showExpandRevoke ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
624
- },
625
- /* @__PURE__ */ React.createElement(
626
- "div",
627
- {
628
- className: `toast revoke-toast ${showRevoke || sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0" ? "show" : ""} ${showExpandRevoke ? "" : "minimize"}`
629
- },
630
- /* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
631
- /* @__PURE__ */ React.createElement("div", { className: "toast-body p-0 shadow mx-3 mx-md-0" }, /* @__PURE__ */ React.createElement("div", { className: "revoke-wrapper minimize-shield-wrapper position-relative" }, !showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
632
- "img",
633
- {
634
- className: "cover-img position-absolute h-100 w-100 object-fit-cover",
635
- src: bg_default
636
- }
637
- ), /* @__PURE__ */ React.createElement(
638
- "div",
639
- {
640
- className: "minimize-shield",
641
- onClick: () => {
642
- if (osName !== OsTypes?.IOS && isMobile && !connection && sessionStorage.getItem("aesirx-analytics-revoke") && parseInt(sessionStorage.getItem("aesirx-analytics-revoke")) > 2) {
643
- setActiveConnectorType(WALLET_CONNECT);
644
- }
645
- setShowExpandRevoke(true);
646
- }
647
- },
648
- /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
649
- t("txt_shield_of_privacy")
650
- )), showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
651
- "div",
652
- {
653
- className: "minimize-revoke",
654
- onClick: () => {
655
- setShowExpandRevoke(false);
656
- }
657
- },
658
- /* @__PURE__ */ React.createElement("img", { src: no_default })
659
- ), /* @__PURE__ */ React.createElement("div", { className: "p-3 bg-white text" }, t("txt_you_can_revoke"), " ", /* @__PURE__ */ React.createElement("br", null), t("txt_visit"), " ", /* @__PURE__ */ React.createElement(
660
- "a",
661
- {
662
- href: "https://nft.shield.aesirx.io",
663
- className: "text-success text-decoration-underline",
664
- target: "_blank",
665
- rel: "noreferrer"
666
- },
667
- t("txt_link")
668
- ), " ", t("txt_for_more_information")), /* @__PURE__ */ React.createElement("div", { className: "rounded-bottom position-relative overflow-hidden text-white" }, /* @__PURE__ */ React.createElement(
669
- "img",
670
- {
671
- className: "cover-img position-absolute h-100 w-100 object-fit-cover",
672
- src: bg_default
673
- }
674
- ), /* @__PURE__ */ React.createElement("div", { className: "position-relative p-3" }, /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center justify-content-between flex-wrap" }, /* @__PURE__ */ React.createElement("div", { className: "me-2" }, /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }), " ", t("txt_shield_of_privacy")), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center" }, /* @__PURE__ */ React.createElement(
675
- "a",
676
- {
677
- className: "text-success text-decoration-underline manage-consent fs-14",
678
- href: "https://dapp.shield.aesirx.io/revoke-consent",
679
- target: "_blank",
680
- rel: "noreferrer"
681
- },
682
- t("txt_manage_consent")
683
- ), loading === "done" ? /* @__PURE__ */ React.createElement(
684
- Button,
685
- {
686
- variant: "success",
687
- onClick: handleRevokeBtn,
688
- className: "text-white d-flex align-items-center revoke-btn fs-14"
689
- },
690
- t("txt_revoke_consent")
691
- ) : /* @__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(
692
- SSOButton,
693
- {
694
- className: "d-none revokeLogin",
695
- text: /* @__PURE__ */ React.createElement(React.Fragment, null, "Login Revoke"),
696
- ssoState: "noscopes",
697
- onGetData
698
- }
699
- )))))))))
700
- )
701
- ), /* @__PURE__ */ React.createElement(
702
- "div",
703
- {
704
- tabIndex: -1,
705
- className: `toast-container position-fixed m-md-3 ${showExpandConsent ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
706
- },
707
- /* @__PURE__ */ React.createElement(
708
- "div",
709
- {
710
- className: `toast custom ${show ? "show" : ""} ${showExpandConsent ? "" : "minimize"}`
711
- },
712
- /* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
713
- /* @__PURE__ */ React.createElement("div", { className: "toast-body p-0 shadow mx-3 mx-md-0" }, !showExpandConsent ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "minimize-shield-wrapper position-relative" }, /* @__PURE__ */ React.createElement(
714
- "img",
715
- {
716
- className: "cover-img position-absolute h-100 w-100 object-fit-cover",
717
- src: bg_default
718
- }
719
- ), /* @__PURE__ */ React.createElement(
720
- "div",
721
- {
722
- className: "minimize-shield",
723
- ref: analyticsContext?.ref,
724
- onClick: () => {
725
- setShowExpandConsent(true);
726
- sessionStorage.removeItem("aesirx-analytics-rejected");
727
- }
728
- },
729
- /* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
730
- t("txt_shield_of_privacy")
731
- ))) : /* @__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" }, loading === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: "mb-2 mb-lg-3" }, t("txt_upgrade_consent_text")), /* @__PURE__ */ React.createElement("p", { className: "fw-semibold text-dark" }, t("txt_your_current_level")), /* @__PURE__ */ React.createElement(
732
- ConsentLevelUprade,
733
- {
734
- level,
735
- tier: t(`txt_tier_${level}_tier`),
736
- levelname: t(`txt_tier_${level}_levelname`),
737
- term_custom: t(`txt_tier_${level}_term_custom`),
738
- content_custom: t(`txt_tier_${level}_content_custom`)
739
- }
740
- ), /* @__PURE__ */ React.createElement("div", { className: "d-flex align-items-center justify-content-between w-100 mt-3 flex-wrap" }, /* @__PURE__ */ React.createElement("p", { className: "fw-semibold text-dark w-100 w-lg-auto mb-0" }, t("txt_upgrade_consent_to")), /* @__PURE__ */ React.createElement(
741
- "div",
742
- {
743
- className: "ms-auto read-more-btn fs-7 text-primary cursor-pointer",
744
- onClick: () => {
745
- setUpgradeShowDetail(!upgradeShowDetail ? true : false);
746
- }
747
- },
748
- !upgradeShowDetail ? t("txt_show_details") : t("txt_hide_details"),
749
- " ",
750
- /* @__PURE__ */ React.createElement(
751
- "img",
752
- {
753
- src: arrow_default,
754
- className: `ms-1 ${upgradeShowDetail ? "revert" : ""}`
755
- }
756
- )
757
- )), /* @__PURE__ */ React.createElement(Form, null, level !== 1 && layout !== "advance-consent-mode" && /* @__PURE__ */ React.createElement(
758
- ConsentLevelUprade,
759
- {
760
- level: 1,
761
- tier: t(`txt_tier_1_tier`),
762
- levelname: t(`txt_tier_1_levelname`),
763
- term_custom: t(`txt_tier_1_term_custom`),
764
- content_custom: t(`txt_tier_1_content_custom`),
765
- isUpgrade: true
766
- }
767
- ), level !== 2 && /* @__PURE__ */ React.createElement(
768
- ConsentLevelUprade,
769
- {
770
- level: 2,
771
- tier: t(`txt_tier_2_tier`),
772
- levelname: t(`txt_tier_2_levelname`),
773
- term_custom: t(`txt_tier_2_term_custom`),
774
- content_custom: t(`txt_tier_2_content_custom`),
775
- isUpgrade: true
776
- }
777
- ), level !== 3 && /* @__PURE__ */ React.createElement(
778
- ConsentLevelUprade,
779
- {
780
- level: 3,
781
- tier: t(`txt_tier_3_tier`),
782
- levelname: t(`txt_tier_3_levelname`),
783
- term_custom: t(`txt_tier_3_term_custom`),
784
- content_custom: t(`txt_tier_3_content_custom`),
785
- isUpgrade: true
786
- }
787
- ), level !== 4 && /* @__PURE__ */ React.createElement(
788
- ConsentLevelUprade,
789
- {
790
- level: 4,
791
- tier: t(`txt_tier_4_tier`),
792
- levelname: t(`txt_tier_4_levelname`),
793
- term_custom: t(`txt_tier_4_term_custom`),
794
- content_custom: t(`txt_tier_4_content_custom`),
795
- isUpgrade: true
796
- }
797
- )), /* @__PURE__ */ React.createElement("div", { className: "d-flex w-100 flex-wrap flex-lg-nowrap justify-content-end mt-4" }, /* @__PURE__ */ React.createElement(
798
- Button,
799
- {
800
- variant: "outline-success",
801
- onClick: () => {
802
- setUpgradeLayout(false);
803
- },
804
- 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 text-dark"
805
- },
806
- t("txt_cancel")
807
- ), /* @__PURE__ */ React.createElement(
808
- Button,
809
- {
810
- variant: "success",
811
- onClick: () => {
812
- if (upgradeLevel) {
813
- handleLevel(upgradeLevel);
814
- setUpgradeLayout(false);
815
- } else {
816
- toast("Please choose upgrade level");
817
- }
818
- },
819
- className: "d-flex align-items-center justify-content-center fs-14 w-100 w-lg-30 me-3 rounded-pill py-3 text-white"
820
- },
821
- t("txt_change_consent")
822
- ))) : /* @__PURE__ */ React.createElement(React.Fragment, null))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
823
- TermsComponent,
824
- {
825
- level,
826
- handleLevel,
827
- isCustom: true,
828
- layout
829
- },
830
- /* @__PURE__ */ React.createElement(Form, { className: "mb-0 w-100" }, /* @__PURE__ */ React.createElement(
831
- Form.Check,
832
- {
833
- checked: consents.includes(1),
834
- type: "switch",
835
- label: "Personal data share consent.",
836
- value: 1,
837
- onChange: handleChange,
838
- className: "d-none"
839
- }
840
- ), /* @__PURE__ */ React.createElement(
841
- Form.Check,
842
- {
843
- checked: consents.includes(2),
844
- type: "switch",
845
- label: "Personal data cross site share consent.",
846
- value: 2,
847
- onChange: handleChange,
848
- className: "d-none"
849
- }
850
- ), /* @__PURE__ */ React.createElement("div", { className: "d-flex w-100 flex-wrap flex-lg-nowrap" }, loading === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, layout === "simple-consent-mode" || layout === "simple-web-2" ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
851
- Button,
852
- {
853
- variant: "outline-success",
854
- onClick: () => {
855
- setUpgradeLayout(true);
856
- },
857
- 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 text-dark"
858
- },
859
- t("txt_change_consent")
860
- ), " "), /* @__PURE__ */ React.createElement(
861
- Button,
862
- {
863
- variant: "outline-success",
864
- onClick: handleNotAllow,
865
- 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 text-dark"
866
- },
867
- t("txt_reject_consent")
868
- ), /* @__PURE__ */ React.createElement(
869
- "div",
870
- {
871
- className: `ssoBtnWrapper w-100 me-3 bg-success rounded-pill ${level === 2 || level === 4 && !account && !address ? "" : "d-none"}`
872
- },
873
- /* @__PURE__ */ React.createElement(
874
- SSOButton,
875
- {
876
- className: "btn btn-success text-white d-flex align-items-center justify-content-center loginSSO rounded-pill py-2 py-lg-3 w-100",
877
- text: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("img", { src: yes_default, className: "me-1" }), t("txt_yes_i_consent")),
878
- ssoState: "noscopes",
879
- onGetData,
880
- ...level === 2 ? { noCreateAccount: true } : {}
881
- }
882
- )
883
- ), level === 2 || level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
884
- Button,
885
- {
886
- variant: "success",
887
- onClick: handleAgree,
888
- className: "w-100 me-3 text-white d-flex align-items-center justify-content-center fs-14 rounded-pill py-2 py-lg-3"
889
- },
890
- loadingCheckAccount ? /* @__PURE__ */ React.createElement(
891
- "span",
892
- {
893
- className: "spinner-border spinner-border-sm me-1",
894
- role: "status",
895
- "aria-hidden": "true"
896
- }
897
- ) : /* @__PURE__ */ React.createElement("img", { src: yes_default, className: "me-1" }),
898
- t("txt_yes_i_consent")
899
- )) : /* @__PURE__ */ React.createElement(React.Fragment, null)))
900
- ))) : /* @__PURE__ */ React.createElement("div", { className: "p-4" }, /* @__PURE__ */ React.createElement(
901
- ContentLoader,
902
- {
903
- speed: 2,
904
- width: 340,
905
- height: 84,
906
- viewBox: "0 0 340 84",
907
- backgroundColor: "#f3f3f3",
908
- foregroundColor: "#ecebeb"
909
- },
910
- /* @__PURE__ */ React.createElement("rect", { x: "0", y: "0", rx: "3", ry: "3", width: "67", height: "11" }),
911
- /* @__PURE__ */ React.createElement("rect", { x: "76", y: "0", rx: "3", ry: "3", width: "140", height: "11" }),
912
- /* @__PURE__ */ React.createElement("rect", { x: "127", y: "48", rx: "3", ry: "3", width: "53", height: "11" }),
913
- /* @__PURE__ */ React.createElement("rect", { x: "187", y: "48", rx: "3", ry: "3", width: "72", height: "11" }),
914
- /* @__PURE__ */ React.createElement("rect", { x: "18", y: "48", rx: "3", ry: "3", width: "100", height: "11" }),
915
- /* @__PURE__ */ React.createElement("rect", { x: "0", y: "71", rx: "3", ry: "3", width: "37", height: "11" }),
916
- /* @__PURE__ */ React.createElement("rect", { x: "18", y: "23", rx: "3", ry: "3", width: "140", height: "11" }),
917
- /* @__PURE__ */ React.createElement("rect", { x: "166", y: "23", rx: "3", ry: "3", width: "173", height: "11" })
918
- ))))
919
- )
920
- ), !account && loading === "connect" && /* @__PURE__ */ React.createElement(
921
- Connect_default,
922
- {
923
- isConnecting,
924
- handleOnConnect,
925
- activeConnectorError,
926
- activeConnectorType,
927
- activeConnector
928
- }
929
- ));
930
- };
931
- var ConsentCustom_default = ConsentComponentCustom;
932
- export {
933
- ConsentCustom_default as default
934
- };