aesirx-analytics 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Consent-J6XDJB65.js +663 -0
- package/dist/ConsentCustom-6YFZO4ZJ.js +815 -0
- package/dist/analytics.js +640 -2362
- package/dist/{Consent-3FMR7JQE.js → chunk-AJMXPNA2.js} +532 -693
- package/dist/{chunk-ZYCOHH2R.js → chunk-FKCTTU52.js} +240 -8
- package/dist/index.d.ts +10 -2
- package/dist/index.js +359 -63
- package/package.json +13 -12
@@ -0,0 +1,663 @@
|
|
1
|
+
import {
|
2
|
+
BROWSER_WALLET,
|
3
|
+
Connect_default,
|
4
|
+
Ethereum_default,
|
5
|
+
LoadingStatus,
|
6
|
+
TermsComponent,
|
7
|
+
WALLET_CONNECT,
|
8
|
+
agreeConsents,
|
9
|
+
bg_default,
|
10
|
+
getConsents,
|
11
|
+
getMember,
|
12
|
+
getNonce,
|
13
|
+
getSignature,
|
14
|
+
getWalletNonce,
|
15
|
+
getWeb3ID,
|
16
|
+
no_default,
|
17
|
+
privacy_default,
|
18
|
+
revokeConsents,
|
19
|
+
useConsentStatus_default,
|
20
|
+
verifySignature,
|
21
|
+
yes_default
|
22
|
+
} from "./chunk-AJMXPNA2.js";
|
23
|
+
import {
|
24
|
+
AnalyticsContext,
|
25
|
+
useTranslation
|
26
|
+
} from "./chunk-FKCTTU52.js";
|
27
|
+
|
28
|
+
// src/Components/Consent.tsx
|
29
|
+
import React, { useContext, useEffect, useState } from "react";
|
30
|
+
import { Button, Form } from "react-bootstrap";
|
31
|
+
import { ToastContainer, toast } from "react-toastify";
|
32
|
+
|
33
|
+
// src/Assets/no_white.svg
|
34
|
+
var no_white_default = 'data:image/svg+xml,<svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<path d="M9 2C13.1421 2 16.5 5.35786 16.5 9.5C16.5 13.6421 13.1421 17 9 17C4.85786 17 1.5 13.6421 1.5 9.5C1.5 5.35786 4.85786 2 9 2ZM9 3.125C5.47918 3.125 2.625 5.97918 2.625 9.5C2.625 13.0208 5.47918 15.875 9 15.875C12.5208 15.875 15.375 13.0208 15.375 9.5C15.375 5.97918 12.5208 3.125 9 3.125ZM11.5847 6.79779L11.6477 6.85225C11.8474 7.05195 11.8656 7.36445 11.7022 7.58466L11.6477 7.64775L9.79575 9.5L11.6477 11.3523C11.8474 11.552 11.8656 11.8645 11.7022 12.0847L11.6477 12.1477C11.448 12.3474 11.1355 12.3656 10.9153 12.2022L10.8523 12.1477L9 10.2957L7.14775 12.1477C6.94805 12.3474 6.63555 12.3656 6.41534 12.2022L6.35225 12.1477C6.15255 11.948 6.1344 11.6355 6.29779 11.4153L6.35225 11.3523L8.20425 9.5L6.35225 7.64775C6.15255 7.44805 6.1344 7.13555 6.29779 6.91534L6.35225 6.85225C6.55195 6.65255 6.86445 6.6344 7.08466 6.79779L7.14775 6.85225L9 8.70425L10.8523 6.85225C11.052 6.65255 11.3645 6.6344 11.5847 6.79779Z" fill="%23fff"/>%0A</svg>%0A';
|
35
|
+
|
36
|
+
// src/Components/Consent.tsx
|
37
|
+
import ContentLoader from "react-content-loader";
|
38
|
+
import { SSOButton } from "aesirx-sso";
|
39
|
+
import {
|
40
|
+
MAINNET,
|
41
|
+
WithWalletConnector,
|
42
|
+
useConnection,
|
43
|
+
useConnect,
|
44
|
+
stringMessage,
|
45
|
+
useGrpcClient,
|
46
|
+
TESTNET
|
47
|
+
} from "@concordium/react-components";
|
48
|
+
import { OsTypes, isDesktop, isMobile, osName } from "react-device-detect";
|
49
|
+
import { useAccount, useSignMessage } from "wagmi";
|
50
|
+
var ConsentComponent = ({ endpoint, aesirXEndpoint, networkEnv }) => {
|
51
|
+
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(ConsentComponentApp, { ...props, endpoint, aesirXEndpoint }))));
|
52
|
+
};
|
53
|
+
var ConsentComponentApp = (props) => {
|
54
|
+
const {
|
55
|
+
endpoint,
|
56
|
+
aesirXEndpoint,
|
57
|
+
activeConnectorType,
|
58
|
+
activeConnector,
|
59
|
+
activeConnectorError,
|
60
|
+
connectedAccounts,
|
61
|
+
genesisHashes,
|
62
|
+
setActiveConnectorType,
|
63
|
+
network
|
64
|
+
} = props;
|
65
|
+
const { setConnection } = useConnection(connectedAccounts, genesisHashes);
|
66
|
+
const { isConnecting } = useConnect(activeConnector, setConnection);
|
67
|
+
const handleOnConnect = async (connectorType, network2 = "concordium") => {
|
68
|
+
if (network2 === "concordium") {
|
69
|
+
setActiveConnectorType(connectorType);
|
70
|
+
}
|
71
|
+
setLoading("done");
|
72
|
+
};
|
73
|
+
const [
|
74
|
+
uuid,
|
75
|
+
level,
|
76
|
+
connection,
|
77
|
+
account,
|
78
|
+
show,
|
79
|
+
setShow,
|
80
|
+
web3ID,
|
81
|
+
setWeb3ID,
|
82
|
+
handleLevel,
|
83
|
+
showRevoke,
|
84
|
+
handleRevoke
|
85
|
+
] = useConsentStatus_default(endpoint, props);
|
86
|
+
const [consents, setConsents] = useState([1, 2]);
|
87
|
+
const [loading, setLoading] = useState("done");
|
88
|
+
const [loadingCheckAccount, setLoadingCheckAccount] = useState(false);
|
89
|
+
const [showExpandConsent, setShowExpandConsent] = useState(true);
|
90
|
+
const [showExpandRevoke, setShowExpandRevoke] = useState(false);
|
91
|
+
const [showBackdrop, setShowBackdrop] = useState(true);
|
92
|
+
const [consentTier4, setConsentTier4] = useState({});
|
93
|
+
const analyticsContext = useContext(AnalyticsContext);
|
94
|
+
const { t } = useTranslation();
|
95
|
+
const gRPCClient = useGrpcClient(network);
|
96
|
+
const { address, connector } = useAccount();
|
97
|
+
const { signMessage } = useSignMessage({
|
98
|
+
async onSuccess(data, variables) {
|
99
|
+
const signature = Buffer.from(
|
100
|
+
typeof data === "object" && data !== null ? JSON.stringify(data) : data,
|
101
|
+
"utf-8"
|
102
|
+
).toString("base64");
|
103
|
+
const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
|
104
|
+
if (variables?.message.indexOf("Revoke consent") > -1) {
|
105
|
+
const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
|
106
|
+
const consentList = await getConsents(endpoint, uuid);
|
107
|
+
consentList.forEach(async (consent) => {
|
108
|
+
!consent?.expiration && await revokeConsents(
|
109
|
+
endpoint,
|
110
|
+
levelRevoke,
|
111
|
+
consent?.consent_uuid,
|
112
|
+
address,
|
113
|
+
signature,
|
114
|
+
web3ID,
|
115
|
+
jwt,
|
116
|
+
"metamask"
|
117
|
+
);
|
118
|
+
});
|
119
|
+
setLoading("done");
|
120
|
+
handleRevoke(false);
|
121
|
+
setShowExpandConsent(false);
|
122
|
+
setShow(true);
|
123
|
+
setShowBackdrop(false);
|
124
|
+
sessionStorage.removeItem("aesirx-analytics-allow");
|
125
|
+
} else if (variables?.message.indexOf("Login with nonce") > -1) {
|
126
|
+
const res = await verifySignature(aesirXEndpoint, "metamask", address, data);
|
127
|
+
sessionStorage.setItem("aesirx-analytics-jwt", res?.jwt);
|
128
|
+
setLoadingCheckAccount(false);
|
129
|
+
const nonce = await getNonce(
|
130
|
+
endpoint,
|
131
|
+
address,
|
132
|
+
"Give consent Tier 4:{nonce} {domain} {time}",
|
133
|
+
"metamask"
|
134
|
+
);
|
135
|
+
signMessage({ message: `${nonce}` });
|
136
|
+
} else {
|
137
|
+
setLoading("saving");
|
138
|
+
await agreeConsents(
|
139
|
+
endpoint,
|
140
|
+
level,
|
141
|
+
uuid,
|
142
|
+
consents,
|
143
|
+
address,
|
144
|
+
signature,
|
145
|
+
web3ID,
|
146
|
+
jwt,
|
147
|
+
"metamask"
|
148
|
+
);
|
149
|
+
sessionStorage.setItem("aesirx-analytics-uuid", uuid);
|
150
|
+
sessionStorage.setItem("aesirx-analytics-allow", "1");
|
151
|
+
sessionStorage.setItem("aesirx-analytics-consent-type", "metamask");
|
152
|
+
setShow(false);
|
153
|
+
setLoading("done");
|
154
|
+
handleRevoke(true, level);
|
155
|
+
setShowBackdrop(false);
|
156
|
+
}
|
157
|
+
},
|
158
|
+
async onError(error) {
|
159
|
+
setLoading("done");
|
160
|
+
toast.error(error.message);
|
161
|
+
}
|
162
|
+
});
|
163
|
+
const handleChange = async ({ target: { value } }) => {
|
164
|
+
if (consents.indexOf(parseInt(value)) === -1) {
|
165
|
+
setConsents([...consents, ...[parseInt(value)]]);
|
166
|
+
} else {
|
167
|
+
setConsents(consents.filter((consent) => consent !== parseInt(value)));
|
168
|
+
}
|
169
|
+
};
|
170
|
+
const handleAgree = async () => {
|
171
|
+
try {
|
172
|
+
let flag = true;
|
173
|
+
let jwt = "";
|
174
|
+
if (level > 2) {
|
175
|
+
if (level === 4) {
|
176
|
+
try {
|
177
|
+
setLoadingCheckAccount(true);
|
178
|
+
const nonceLogin = await getWalletNonce(
|
179
|
+
aesirXEndpoint,
|
180
|
+
account ? "concordium" : "metamask",
|
181
|
+
account ?? address
|
182
|
+
);
|
183
|
+
if (nonceLogin) {
|
184
|
+
try {
|
185
|
+
if (account) {
|
186
|
+
const signature = await connection.signMessage(
|
187
|
+
account,
|
188
|
+
stringMessage(`${nonceLogin}`)
|
189
|
+
);
|
190
|
+
const convertedSignature = typeof signature === "object" && signature !== null ? signature : JSON.parse(signature);
|
191
|
+
if (signature) {
|
192
|
+
const data = await verifySignature(
|
193
|
+
aesirXEndpoint,
|
194
|
+
"concordium",
|
195
|
+
account,
|
196
|
+
convertedSignature
|
197
|
+
);
|
198
|
+
sessionStorage.setItem("aesirx-analytics-jwt", data?.jwt);
|
199
|
+
jwt = data?.jwt;
|
200
|
+
setLoadingCheckAccount(false);
|
201
|
+
}
|
202
|
+
} else {
|
203
|
+
signMessage({ message: `${nonceLogin}` });
|
204
|
+
}
|
205
|
+
} catch (error) {
|
206
|
+
setLoadingCheckAccount(false);
|
207
|
+
toast(error.message);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
} catch (error) {
|
211
|
+
SSOClick(".loginSSO");
|
212
|
+
setLoadingCheckAccount(false);
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
if (account) {
|
217
|
+
const signature = await getSignature(
|
218
|
+
endpoint,
|
219
|
+
account,
|
220
|
+
connection,
|
221
|
+
level === 3 ? "Give consent:{nonce} {domain} {time}" : "Give consent Tier 4:{nonce} {domain} {time}"
|
222
|
+
);
|
223
|
+
setLoading("saving");
|
224
|
+
await agreeConsents(endpoint, level, uuid, consents, account, signature, web3ID, jwt);
|
225
|
+
sessionStorage.setItem("aesirx-analytics-consent-type", "concordium");
|
226
|
+
} else if (connector) {
|
227
|
+
if (level === 3) {
|
228
|
+
const nonce = await getNonce(
|
229
|
+
endpoint,
|
230
|
+
address,
|
231
|
+
level === 3 ? "Give consent:{nonce} {domain} {time}" : "Give consent Tier 4:{nonce} {domain} {time}",
|
232
|
+
"metamask"
|
233
|
+
);
|
234
|
+
signMessage({ message: `${nonce}` });
|
235
|
+
}
|
236
|
+
} else {
|
237
|
+
setLoading("connect");
|
238
|
+
flag = false;
|
239
|
+
}
|
240
|
+
} else {
|
241
|
+
setLoading("saving");
|
242
|
+
const consentList = await getConsents(endpoint, analyticsContext.visitor_uuid);
|
243
|
+
consents.forEach(async (consent) => {
|
244
|
+
const existConsent = consentList.find((item) => item?.consent === consent);
|
245
|
+
if (!existConsent) {
|
246
|
+
await agreeConsents(endpoint, 1, uuid, consent);
|
247
|
+
} else if (!!existConsent?.consent_uuid && existConsent?.expiration && new Date(existConsent.expiration) < /* @__PURE__ */ new Date()) {
|
248
|
+
await agreeConsents(endpoint, 1, uuid, consent);
|
249
|
+
}
|
250
|
+
});
|
251
|
+
}
|
252
|
+
if (flag && (account || level < 3)) {
|
253
|
+
sessionStorage.setItem("aesirx-analytics-uuid", uuid);
|
254
|
+
sessionStorage.setItem("aesirx-analytics-allow", "1");
|
255
|
+
setShow(false);
|
256
|
+
setLoading("done");
|
257
|
+
handleRevoke(true, level);
|
258
|
+
setShowBackdrop(false);
|
259
|
+
}
|
260
|
+
} catch (error) {
|
261
|
+
console.log(error);
|
262
|
+
handleNotAllow();
|
263
|
+
setLoading("done");
|
264
|
+
toast.error(error?.response?.data?.error ?? error.message);
|
265
|
+
}
|
266
|
+
};
|
267
|
+
useEffect(() => {
|
268
|
+
const init = async () => {
|
269
|
+
if (Object.keys(consentTier4)?.length && (account || address)) {
|
270
|
+
await consentTier4Init(consentTier4);
|
271
|
+
setConsentTier4({});
|
272
|
+
}
|
273
|
+
};
|
274
|
+
init();
|
275
|
+
}, [consentTier4, account, address]);
|
276
|
+
const consentTier4Init = async (response) => {
|
277
|
+
let hasWeb3ID = true;
|
278
|
+
if (response?.loginType === "concordium") {
|
279
|
+
const web3ID2 = await getWeb3ID(account, gRPCClient, network?.name);
|
280
|
+
if (web3ID2) {
|
281
|
+
setWeb3ID(web3ID2);
|
282
|
+
} else {
|
283
|
+
hasWeb3ID = false;
|
284
|
+
}
|
285
|
+
} else {
|
286
|
+
const memberData = await getMember(aesirXEndpoint, response?.access_token);
|
287
|
+
hasWeb3ID = memberData?.web3id ? true : false;
|
288
|
+
}
|
289
|
+
if (hasWeb3ID) {
|
290
|
+
if (response?.loginType === "concordium") {
|
291
|
+
sessionStorage.setItem("aesirx-analytics-consent-type", "concordium");
|
292
|
+
const signature = await getSignature(
|
293
|
+
endpoint,
|
294
|
+
account,
|
295
|
+
connection,
|
296
|
+
"Give consent Tier 4:{nonce} {domain} {time}"
|
297
|
+
);
|
298
|
+
await agreeConsents(
|
299
|
+
endpoint,
|
300
|
+
level,
|
301
|
+
uuid,
|
302
|
+
consents,
|
303
|
+
account,
|
304
|
+
signature,
|
305
|
+
null,
|
306
|
+
response?.jwt
|
307
|
+
);
|
308
|
+
setShow(false);
|
309
|
+
handleRevoke(true, level);
|
310
|
+
setLoading("done");
|
311
|
+
} else if (response?.loginType === "metamask") {
|
312
|
+
sessionStorage.setItem("aesirx-analytics-consent-type", "metamask");
|
313
|
+
const nonce = await getNonce(
|
314
|
+
endpoint,
|
315
|
+
address,
|
316
|
+
"Give consent Tier 4:{nonce} {domain} {time}",
|
317
|
+
"metamask"
|
318
|
+
);
|
319
|
+
signMessage({ message: `${nonce}` });
|
320
|
+
}
|
321
|
+
} else {
|
322
|
+
handleLevel(3);
|
323
|
+
toast("You haven't minted any WEB3 ID yet. Try to mint at https://dapp.shield.aesirx.io");
|
324
|
+
setLoading("done");
|
325
|
+
}
|
326
|
+
};
|
327
|
+
const onGetData = async (response) => {
|
328
|
+
try {
|
329
|
+
setLoading("saving");
|
330
|
+
const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
|
331
|
+
sessionStorage.setItem("aesirx-analytics-jwt", response?.jwt);
|
332
|
+
if (levelRevoke && levelRevoke !== "0") {
|
333
|
+
sessionStorage.setItem(
|
334
|
+
"aesirx-analytics-consent-type",
|
335
|
+
response?.loginType === "concordium" ? "concordium" : "metamask"
|
336
|
+
);
|
337
|
+
handleRevokeBtn();
|
338
|
+
} else {
|
339
|
+
if (level === 4) {
|
340
|
+
if (response?.loginType === "concordium" && isDesktop) {
|
341
|
+
setActiveConnectorType(BROWSER_WALLET);
|
342
|
+
}
|
343
|
+
setConsentTier4(response);
|
344
|
+
} else {
|
345
|
+
await agreeConsents(endpoint, level, uuid, consents, null, null, null, response?.jwt);
|
346
|
+
setShow(false);
|
347
|
+
handleRevoke(true, level);
|
348
|
+
setLoading("done");
|
349
|
+
}
|
350
|
+
}
|
351
|
+
} catch (error) {
|
352
|
+
console.log(error);
|
353
|
+
setShow(false);
|
354
|
+
setLoading("done");
|
355
|
+
toast.error(error?.response?.data?.error ?? error.message);
|
356
|
+
}
|
357
|
+
};
|
358
|
+
const handleNotAllow = () => {
|
359
|
+
sessionStorage.setItem("aesirx-analytics-uuid", uuid);
|
360
|
+
sessionStorage.setItem("aesirx-analytics-rejected", "true");
|
361
|
+
setShowExpandConsent(false);
|
362
|
+
setShowBackdrop(false);
|
363
|
+
};
|
364
|
+
const handleRevokeBtn = async () => {
|
365
|
+
const levelRevoke = sessionStorage.getItem("aesirx-analytics-revoke");
|
366
|
+
const consentType = sessionStorage.getItem("aesirx-analytics-consent-type");
|
367
|
+
const jwt = sessionStorage.getItem("aesirx-analytics-jwt");
|
368
|
+
try {
|
369
|
+
let flag = true;
|
370
|
+
if (levelRevoke !== "1") {
|
371
|
+
if (parseInt(levelRevoke) > 2) {
|
372
|
+
if (!jwt && (parseInt(levelRevoke) === 2 || parseInt(levelRevoke) === 4)) {
|
373
|
+
SSOClick(".revokeLogin");
|
374
|
+
return;
|
375
|
+
}
|
376
|
+
if (account && consentType !== "metamask") {
|
377
|
+
setLoading("sign");
|
378
|
+
const signature = await getSignature(
|
379
|
+
endpoint,
|
380
|
+
account,
|
381
|
+
connection,
|
382
|
+
"Revoke consent:{nonce} {domain} {time}"
|
383
|
+
);
|
384
|
+
setLoading("saving");
|
385
|
+
const consentList = await getConsents(endpoint, uuid);
|
386
|
+
consentList.forEach(async (consent) => {
|
387
|
+
!consent?.expiration && await revokeConsents(
|
388
|
+
endpoint,
|
389
|
+
levelRevoke,
|
390
|
+
consent?.consent_uuid,
|
391
|
+
account,
|
392
|
+
signature,
|
393
|
+
web3ID,
|
394
|
+
jwt
|
395
|
+
);
|
396
|
+
});
|
397
|
+
setLoading("done");
|
398
|
+
handleRevoke(false);
|
399
|
+
} else if (connector) {
|
400
|
+
setLoading("sign");
|
401
|
+
setLoading("saving");
|
402
|
+
const nonce = await getNonce(
|
403
|
+
endpoint,
|
404
|
+
address,
|
405
|
+
"Revoke consent:{nonce} {domain} {time}",
|
406
|
+
"metamask"
|
407
|
+
);
|
408
|
+
signMessage({ message: `${nonce}` });
|
409
|
+
} else {
|
410
|
+
setLoading("connect");
|
411
|
+
flag = false;
|
412
|
+
}
|
413
|
+
} else {
|
414
|
+
setLoading("saving");
|
415
|
+
const consentList = await getConsents(endpoint, uuid);
|
416
|
+
consentList.forEach(async (consent) => {
|
417
|
+
!consent?.expiration && await revokeConsents(
|
418
|
+
endpoint,
|
419
|
+
levelRevoke,
|
420
|
+
consent?.consent_uuid,
|
421
|
+
null,
|
422
|
+
null,
|
423
|
+
null,
|
424
|
+
jwt
|
425
|
+
);
|
426
|
+
});
|
427
|
+
setLoading("done");
|
428
|
+
handleRevoke(false);
|
429
|
+
}
|
430
|
+
if (flag && (account && consentType !== "metamask" || level < 3)) {
|
431
|
+
setShowExpandConsent(false);
|
432
|
+
setShow(true);
|
433
|
+
setShowBackdrop(false);
|
434
|
+
sessionStorage.removeItem("aesirx-analytics-allow");
|
435
|
+
}
|
436
|
+
} else {
|
437
|
+
handleRevoke(false);
|
438
|
+
setShowExpandConsent(false);
|
439
|
+
setShow(true);
|
440
|
+
setShowBackdrop(false);
|
441
|
+
sessionStorage.removeItem("aesirx-analytics-allow");
|
442
|
+
}
|
443
|
+
} catch (error) {
|
444
|
+
console.log(error);
|
445
|
+
setLoading("done");
|
446
|
+
toast.error(error?.response?.data?.error ?? error.message);
|
447
|
+
}
|
448
|
+
};
|
449
|
+
const SSOClick = (selector) => {
|
450
|
+
const element = document.querySelector(selector);
|
451
|
+
element.click();
|
452
|
+
};
|
453
|
+
useEffect(() => {
|
454
|
+
if (activeConnectorError) {
|
455
|
+
toast.error(activeConnectorError);
|
456
|
+
}
|
457
|
+
}, [activeConnectorError]);
|
458
|
+
useEffect(() => {
|
459
|
+
if (sessionStorage.getItem("aesirx-analytics-rejected") === "true") {
|
460
|
+
setShowBackdrop(false);
|
461
|
+
setShowExpandConsent(false);
|
462
|
+
}
|
463
|
+
}, []);
|
464
|
+
console.log("level", uuid, level, web3ID, account, loading);
|
465
|
+
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(
|
466
|
+
"div",
|
467
|
+
{
|
468
|
+
tabIndex: -1,
|
469
|
+
className: `toast-container position-fixed m-md-3 ${showExpandRevoke ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
|
470
|
+
},
|
471
|
+
/* @__PURE__ */ React.createElement(
|
472
|
+
"div",
|
473
|
+
{
|
474
|
+
className: `toast revoke-toast ${showRevoke || sessionStorage.getItem("aesirx-analytics-revoke") && sessionStorage.getItem("aesirx-analytics-revoke") !== "0" ? "show" : ""} ${showExpandRevoke ? "" : "minimize"}`
|
475
|
+
},
|
476
|
+
/* @__PURE__ */ React.createElement(LoadingStatus, { loading }),
|
477
|
+
/* @__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(
|
478
|
+
"img",
|
479
|
+
{
|
480
|
+
className: "cover-img position-absolute h-100 w-100 object-fit-cover",
|
481
|
+
src: bg_default
|
482
|
+
}
|
483
|
+
), /* @__PURE__ */ React.createElement(
|
484
|
+
"div",
|
485
|
+
{
|
486
|
+
className: "minimize-shield",
|
487
|
+
onClick: () => {
|
488
|
+
if (osName !== OsTypes?.IOS && isMobile && !connection && sessionStorage.getItem("aesirx-analytics-revoke") && parseInt(sessionStorage.getItem("aesirx-analytics-revoke")) > 2) {
|
489
|
+
setActiveConnectorType(WALLET_CONNECT);
|
490
|
+
}
|
491
|
+
setShowExpandRevoke(true);
|
492
|
+
}
|
493
|
+
},
|
494
|
+
/* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
|
495
|
+
t("txt_shield_of_privacy")
|
496
|
+
)), showExpandRevoke && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
497
|
+
"div",
|
498
|
+
{
|
499
|
+
className: "minimize-revoke",
|
500
|
+
onClick: () => {
|
501
|
+
setShowExpandRevoke(false);
|
502
|
+
}
|
503
|
+
},
|
504
|
+
/* @__PURE__ */ React.createElement("img", { src: no_default })
|
505
|
+
), /* @__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(
|
506
|
+
"a",
|
507
|
+
{
|
508
|
+
href: "https://nft.shield.aesirx.io",
|
509
|
+
className: "text-success text-decoration-underline",
|
510
|
+
target: "_blank",
|
511
|
+
rel: "noreferrer"
|
512
|
+
},
|
513
|
+
t("txt_link")
|
514
|
+
), " ", t("txt_for_more_information")), /* @__PURE__ */ React.createElement("div", { className: "rounded-bottom position-relative overflow-hidden text-white" }, /* @__PURE__ */ React.createElement(
|
515
|
+
"img",
|
516
|
+
{
|
517
|
+
className: "cover-img position-absolute h-100 w-100 object-fit-cover",
|
518
|
+
src: bg_default
|
519
|
+
}
|
520
|
+
), /* @__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(
|
521
|
+
"a",
|
522
|
+
{
|
523
|
+
className: "text-success text-decoration-underline manage-consent fs-14",
|
524
|
+
href: "https://dapp.shield.aesirx.io/revoke-consent",
|
525
|
+
target: "_blank",
|
526
|
+
rel: "noreferrer"
|
527
|
+
},
|
528
|
+
t("txt_manage_consent")
|
529
|
+
), loading === "done" ? /* @__PURE__ */ React.createElement(
|
530
|
+
Button,
|
531
|
+
{
|
532
|
+
variant: "success",
|
533
|
+
onClick: handleRevokeBtn,
|
534
|
+
className: "text-white d-flex align-items-center revoke-btn fs-14"
|
535
|
+
},
|
536
|
+
t("txt_revoke_consent")
|
537
|
+
) : /* @__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(
|
538
|
+
SSOButton,
|
539
|
+
{
|
540
|
+
className: "d-none revokeLogin",
|
541
|
+
text: /* @__PURE__ */ React.createElement(React.Fragment, null, "Login Revoke"),
|
542
|
+
ssoState: "noscopes",
|
543
|
+
onGetData
|
544
|
+
}
|
545
|
+
)))))))))
|
546
|
+
)
|
547
|
+
), /* @__PURE__ */ React.createElement(
|
548
|
+
"div",
|
549
|
+
{
|
550
|
+
tabIndex: -1,
|
551
|
+
className: `toast-container position-fixed m-md-3 ${showExpandConsent ? "top-50 start-50 translate-middle" : "bottom-0 end-0"}`
|
552
|
+
},
|
553
|
+
/* @__PURE__ */ React.createElement("div", { className: `toast ${show ? "show" : ""} ${showExpandConsent ? "" : "minimize"}` }, /* @__PURE__ */ React.createElement(LoadingStatus, { loading }), /* @__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(
|
554
|
+
"img",
|
555
|
+
{
|
556
|
+
className: "cover-img position-absolute h-100 w-100 object-fit-cover",
|
557
|
+
src: bg_default
|
558
|
+
}
|
559
|
+
), /* @__PURE__ */ React.createElement(
|
560
|
+
"div",
|
561
|
+
{
|
562
|
+
className: "minimize-shield",
|
563
|
+
onClick: () => {
|
564
|
+
setShowExpandConsent(true);
|
565
|
+
sessionStorage.removeItem("aesirx-analytics-rejected");
|
566
|
+
}
|
567
|
+
},
|
568
|
+
/* @__PURE__ */ React.createElement("img", { src: privacy_default, alt: "Shield of Privacy" }),
|
569
|
+
t("txt_shield_of_privacy")
|
570
|
+
))) : /* @__PURE__ */ React.createElement(React.Fragment, null, level ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TermsComponent, { level, handleLevel }, /* @__PURE__ */ React.createElement(Form, { className: "mb-0" }, /* @__PURE__ */ React.createElement(
|
571
|
+
Form.Check,
|
572
|
+
{
|
573
|
+
checked: consents.includes(1),
|
574
|
+
type: "switch",
|
575
|
+
label: "Personal data share consent.",
|
576
|
+
value: 1,
|
577
|
+
onChange: handleChange,
|
578
|
+
className: "d-none"
|
579
|
+
}
|
580
|
+
), /* @__PURE__ */ React.createElement(
|
581
|
+
Form.Check,
|
582
|
+
{
|
583
|
+
checked: consents.includes(2),
|
584
|
+
type: "switch",
|
585
|
+
label: "Personal data cross site share consent.",
|
586
|
+
value: 2,
|
587
|
+
onChange: handleChange,
|
588
|
+
className: "d-none"
|
589
|
+
}
|
590
|
+
), /* @__PURE__ */ React.createElement("div", { className: "d-flex justify-content-end" }, loading === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
591
|
+
"div",
|
592
|
+
{
|
593
|
+
className: `ssoBtnWrapper me-1 bg-success ${level === 2 || level === 4 && !account && !address ? "" : "d-none"}`
|
594
|
+
},
|
595
|
+
/* @__PURE__ */ React.createElement(
|
596
|
+
SSOButton,
|
597
|
+
{
|
598
|
+
className: "btn btn-success text-white d-flex align-items-center loginSSO",
|
599
|
+
text: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("img", { src: yes_default, className: "me-1" }), t("txt_yes_i_consent")),
|
600
|
+
ssoState: "noscopes",
|
601
|
+
onGetData,
|
602
|
+
...level === 2 ? { noCreateAccount: true } : {}
|
603
|
+
}
|
604
|
+
)
|
605
|
+
), level === 2 || level === 4 && !account && !address ? /* @__PURE__ */ React.createElement(React.Fragment, null) : /* @__PURE__ */ React.createElement(
|
606
|
+
Button,
|
607
|
+
{
|
608
|
+
variant: "success",
|
609
|
+
onClick: handleAgree,
|
610
|
+
className: "me-1 text-white d-flex align-items-center fs-14"
|
611
|
+
},
|
612
|
+
loadingCheckAccount ? /* @__PURE__ */ React.createElement(
|
613
|
+
"span",
|
614
|
+
{
|
615
|
+
className: "spinner-border spinner-border-sm me-1",
|
616
|
+
role: "status",
|
617
|
+
"aria-hidden": "true"
|
618
|
+
}
|
619
|
+
) : /* @__PURE__ */ React.createElement("img", { src: yes_default, className: "me-1" }),
|
620
|
+
t("txt_yes_i_consent")
|
621
|
+
), /* @__PURE__ */ React.createElement(
|
622
|
+
Button,
|
623
|
+
{
|
624
|
+
variant: "gray",
|
625
|
+
onClick: handleNotAllow,
|
626
|
+
className: "d-flex align-items-center fs-14"
|
627
|
+
},
|
628
|
+
/* @__PURE__ */ React.createElement("img", { src: no_white_default, className: "me-1" }),
|
629
|
+
t("txt_reject_consent")
|
630
|
+
)) : /* @__PURE__ */ React.createElement(React.Fragment, null))))) : /* @__PURE__ */ React.createElement("div", { className: "p-4" }, /* @__PURE__ */ React.createElement(
|
631
|
+
ContentLoader,
|
632
|
+
{
|
633
|
+
speed: 2,
|
634
|
+
width: 340,
|
635
|
+
height: 84,
|
636
|
+
viewBox: "0 0 340 84",
|
637
|
+
backgroundColor: "#f3f3f3",
|
638
|
+
foregroundColor: "#ecebeb"
|
639
|
+
},
|
640
|
+
/* @__PURE__ */ React.createElement("rect", { x: "0", y: "0", rx: "3", ry: "3", width: "67", height: "11" }),
|
641
|
+
/* @__PURE__ */ React.createElement("rect", { x: "76", y: "0", rx: "3", ry: "3", width: "140", height: "11" }),
|
642
|
+
/* @__PURE__ */ React.createElement("rect", { x: "127", y: "48", rx: "3", ry: "3", width: "53", height: "11" }),
|
643
|
+
/* @__PURE__ */ React.createElement("rect", { x: "187", y: "48", rx: "3", ry: "3", width: "72", height: "11" }),
|
644
|
+
/* @__PURE__ */ React.createElement("rect", { x: "18", y: "48", rx: "3", ry: "3", width: "100", height: "11" }),
|
645
|
+
/* @__PURE__ */ React.createElement("rect", { x: "0", y: "71", rx: "3", ry: "3", width: "37", height: "11" }),
|
646
|
+
/* @__PURE__ */ React.createElement("rect", { x: "18", y: "23", rx: "3", ry: "3", width: "140", height: "11" }),
|
647
|
+
/* @__PURE__ */ React.createElement("rect", { x: "166", y: "23", rx: "3", ry: "3", width: "173", height: "11" })
|
648
|
+
)))))
|
649
|
+
), !account && loading === "connect" && /* @__PURE__ */ React.createElement(
|
650
|
+
Connect_default,
|
651
|
+
{
|
652
|
+
isConnecting,
|
653
|
+
handleOnConnect,
|
654
|
+
activeConnectorError,
|
655
|
+
activeConnectorType,
|
656
|
+
activeConnector
|
657
|
+
}
|
658
|
+
));
|
659
|
+
};
|
660
|
+
var Consent_default = ConsentComponent;
|
661
|
+
export {
|
662
|
+
Consent_default as default
|
663
|
+
};
|