@vechain/vechain-kit 1.8.0 → 1.8.2
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/index.cjs +52 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -67
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -73,6 +73,7 @@ var en_default = {
|
|
|
73
73
|
AVAILABLE: "AVAILABLE",
|
|
74
74
|
Accept: "Accept",
|
|
75
75
|
"Accept all": "Accept all",
|
|
76
|
+
"Accept selected": "Accept selected",
|
|
76
77
|
"Access and security": "Access and security",
|
|
77
78
|
Account: "Account",
|
|
78
79
|
"Account Upgrade Required": "Account Upgrade Required",
|
|
@@ -641,6 +642,7 @@ var de_default = {
|
|
|
641
642
|
AVAILABLE: "VERF\xDCGBAR",
|
|
642
643
|
Accept: "Akzeptieren",
|
|
643
644
|
"Accept all": "Alle akzeptieren",
|
|
645
|
+
"Accept selected": "Auswahl akzeptieren",
|
|
644
646
|
"Access and security": "Zugang und Sicherheit",
|
|
645
647
|
Account: "Konto",
|
|
646
648
|
"Account Upgrade Required": "Kontoupdate erforderlich",
|
|
@@ -1209,6 +1211,7 @@ var it_default = {
|
|
|
1209
1211
|
AVAILABLE: "DISPONIBILE",
|
|
1210
1212
|
Accept: "Accetta",
|
|
1211
1213
|
"Accept all": "Accetta tutto",
|
|
1214
|
+
"Accept selected": "Accetta selezionati",
|
|
1212
1215
|
"Access and security": "Accesso e sicurezza",
|
|
1213
1216
|
Account: "Account",
|
|
1214
1217
|
"Account Upgrade Required": "Aggiornamento dell'account richiesto",
|
|
@@ -1777,6 +1780,7 @@ var fr_default = {
|
|
|
1777
1780
|
AVAILABLE: "DISPONIBLE",
|
|
1778
1781
|
Accept: "Accepter",
|
|
1779
1782
|
"Accept all": "Tout accepter",
|
|
1783
|
+
"Accept selected": "Accepter la s\xE9lection",
|
|
1780
1784
|
"Access and security": "Acc\xE8s et s\xE9curit\xE9",
|
|
1781
1785
|
Account: "Compte",
|
|
1782
1786
|
"Account Upgrade Required": "Mise \xE0 niveau du compte requise",
|
|
@@ -2345,6 +2349,7 @@ var es_default = {
|
|
|
2345
2349
|
AVAILABLE: "DISPONIBLE",
|
|
2346
2350
|
Accept: "Aceptar",
|
|
2347
2351
|
"Accept all": "Aceptar todo",
|
|
2352
|
+
"Accept selected": "Aceptar seleccionado",
|
|
2348
2353
|
"Access and security": "Acceso y seguridad",
|
|
2349
2354
|
Account: "Cuenta",
|
|
2350
2355
|
"Account Upgrade Required": "Actualizaci\xF3n de cuenta necesaria",
|
|
@@ -2913,6 +2918,7 @@ var zh_default = {
|
|
|
2913
2918
|
AVAILABLE: "\u53EF\u7528",
|
|
2914
2919
|
Accept: "\u63A5\u53D7",
|
|
2915
2920
|
"Accept all": "\u5168\u90E8\u63A5\u53D7",
|
|
2921
|
+
"Accept selected": "\u63A5\u53D7\u5DF2\u9009\u62E9",
|
|
2916
2922
|
"Access and security": "\u8BBF\u95EE\u548C\u5B89\u5168",
|
|
2917
2923
|
Account: "\u8D26\u6237",
|
|
2918
2924
|
"Account Upgrade Required": "\u9700\u8981\u8D26\u6237\u5347\u7EA7",
|
|
@@ -3481,6 +3487,7 @@ var ja_default = {
|
|
|
3481
3487
|
AVAILABLE: "\u5229\u7528\u53EF\u80FD",
|
|
3482
3488
|
Accept: "\u627F\u8AFE",
|
|
3483
3489
|
"Accept all": "\u3059\u3079\u3066\u627F\u8AFE",
|
|
3490
|
+
"Accept selected": "\u9078\u629E\u3092\u53D7\u3051\u5165\u308C\u308B",
|
|
3484
3491
|
"Access and security": "\u30A2\u30AF\u30BB\u30B9\u3068\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3",
|
|
3485
3492
|
Account: "\u30A2\u30AB\u30A6\u30F3\u30C8",
|
|
3486
3493
|
"Account Upgrade Required": "\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30A2\u30C3\u30D7\u30B0\u30EC\u30FC\u30C9\u304C\u5FC5\u8981\u3067\u3059",
|
|
@@ -4799,7 +4806,7 @@ var AddressDisplay = ({
|
|
|
4799
4806
|
// package.json
|
|
4800
4807
|
var package_default = {
|
|
4801
4808
|
name: "@vechain/vechain-kit",
|
|
4802
|
-
version: "1.8.
|
|
4809
|
+
version: "1.8.2",
|
|
4803
4810
|
private: false,
|
|
4804
4811
|
homepage: "https://github.com/vechain/vechain-kit",
|
|
4805
4812
|
repository: "github:vechain/vechain-kit",
|
|
@@ -21140,17 +21147,18 @@ var LegalDocumentsContent = ({
|
|
|
21140
21147
|
return documentsNotAgreed.filter((document2) => formValues[document2.id]);
|
|
21141
21148
|
}, [documentsNotAgreed, formValues]);
|
|
21142
21149
|
const allSelected = documentsNotAgreed?.length === selectedDocuments.length;
|
|
21143
|
-
const onSubmit = (
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21150
|
+
const onSubmit = useCallback(
|
|
21151
|
+
(data) => {
|
|
21152
|
+
const agreedDocumentIds = new Set(
|
|
21153
|
+
Object.entries(data).filter(([_, checked]) => checked).map(([docId]) => docId)
|
|
21154
|
+
);
|
|
21155
|
+
const agreedDocuments = documentsNotAgreed.filter(
|
|
21156
|
+
(document2) => agreedDocumentIds.has(document2.id)
|
|
21157
|
+
);
|
|
21151
21158
|
return onAgree(agreedDocuments);
|
|
21152
|
-
}
|
|
21153
|
-
|
|
21159
|
+
},
|
|
21160
|
+
[documentsNotAgreed, onAgree]
|
|
21161
|
+
);
|
|
21154
21162
|
const borderColor = isDark ? "#3a3a3a" : "#eaeaea";
|
|
21155
21163
|
const sectionBgColor = isDark ? "#2a2a2a" : "#f5f5f5";
|
|
21156
21164
|
const headingColor = isDark ? "gray.300" : "gray.600";
|
|
@@ -21162,13 +21170,22 @@ var LegalDocumentsContent = ({
|
|
|
21162
21170
|
(doc) => formValues[doc.id]
|
|
21163
21171
|
).length;
|
|
21164
21172
|
if (allSelected) {
|
|
21165
|
-
return "Accept all";
|
|
21173
|
+
return t("Accept all");
|
|
21166
21174
|
}
|
|
21167
21175
|
if (onlyOptionalDocuments && selectedOptionalCount === 0) {
|
|
21168
|
-
return "Ignore and continue";
|
|
21176
|
+
return t("Ignore and continue");
|
|
21177
|
+
}
|
|
21178
|
+
if (hasRequiredDocuments && !hasOptionalDocuments || hasRequiredDocuments && selectedOptionalCount === 0) {
|
|
21179
|
+
return t("Accept");
|
|
21169
21180
|
}
|
|
21170
|
-
return "Accept selected";
|
|
21181
|
+
return t("Accept selected");
|
|
21171
21182
|
}, [onlyOptionalDocuments, allSelected, optionalDocuments, formValues]);
|
|
21183
|
+
const requiredTextDivider = (index) => {
|
|
21184
|
+
if (index === requiredDocuments.length - 2 && requiredDocuments.length > 1) {
|
|
21185
|
+
return t(" and ");
|
|
21186
|
+
}
|
|
21187
|
+
return ", ";
|
|
21188
|
+
};
|
|
21172
21189
|
return /* @__PURE__ */ jsx(Stack, { width: "full", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [
|
|
21173
21190
|
/* @__PURE__ */ jsx(StickyHeaderContainer, { children: /* @__PURE__ */ jsx(ModalHeader, { children: t("Terms and Policies") }) }),
|
|
21174
21191
|
/* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(VStack, { align: "stretch", spacing: 5, width: "full", children: [
|
|
@@ -21185,7 +21202,7 @@ var LegalDocumentsContent = ({
|
|
|
21185
21202
|
},
|
|
21186
21203
|
document2.id
|
|
21187
21204
|
),
|
|
21188
|
-
index < requiredDocuments.length - 1 ? index
|
|
21205
|
+
index < requiredDocuments.length - 1 ? requiredTextDivider(index) : null
|
|
21189
21206
|
] }, document2.id)),
|
|
21190
21207
|
".",
|
|
21191
21208
|
" ",
|
|
@@ -21193,7 +21210,7 @@ var LegalDocumentsContent = ({
|
|
|
21193
21210
|
"Please take a moment to review all the policies, with acceptance being mandatory to continue."
|
|
21194
21211
|
)
|
|
21195
21212
|
] }),
|
|
21196
|
-
onlyOptionalDocuments && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color:
|
|
21213
|
+
onlyOptionalDocuments && /* @__PURE__ */ jsx(Text, { fontSize: "sm", color: headingColor, mb: 3, children: /* @__PURE__ */ jsx(
|
|
21197
21214
|
Trans,
|
|
21198
21215
|
{
|
|
21199
21216
|
i18nKey: "<bold>Your privacy matters.</bold> You\u2019re in control, accept to enable optional features like cookies and analytics that help us enhance your experience.",
|
|
@@ -21203,7 +21220,7 @@ var LegalDocumentsContent = ({
|
|
|
21203
21220
|
{
|
|
21204
21221
|
as: "span",
|
|
21205
21222
|
fontWeight: "semibold",
|
|
21206
|
-
color:
|
|
21223
|
+
color: headingColor
|
|
21207
21224
|
}
|
|
21208
21225
|
)
|
|
21209
21226
|
}
|
|
@@ -21361,54 +21378,6 @@ var formatDocuments = (documents) => {
|
|
|
21361
21378
|
var getOptionalDocuments = (documents) => {
|
|
21362
21379
|
return documents.filter((document2) => !document2.required);
|
|
21363
21380
|
};
|
|
21364
|
-
var getStoredAgreements = () => {
|
|
21365
|
-
try {
|
|
21366
|
-
const storedData = localStorage.getItem(LEGAL_DOCS_LOCAL_STORAGE_KEY);
|
|
21367
|
-
if (storedData) {
|
|
21368
|
-
return JSON.parse(storedData);
|
|
21369
|
-
}
|
|
21370
|
-
return [];
|
|
21371
|
-
} catch (e) {
|
|
21372
|
-
console.warn(
|
|
21373
|
-
"Error reading legal document agreements from localStorage",
|
|
21374
|
-
e
|
|
21375
|
-
);
|
|
21376
|
-
return [];
|
|
21377
|
-
}
|
|
21378
|
-
};
|
|
21379
|
-
var getStoredRejectedDocuments = () => {
|
|
21380
|
-
try {
|
|
21381
|
-
const storedData = localStorage.getItem(
|
|
21382
|
-
LEGAL_DOCS_OPTIONAL_REJECT_LOCAL_STORAGE_KEY
|
|
21383
|
-
);
|
|
21384
|
-
if (storedData) {
|
|
21385
|
-
return JSON.parse(storedData);
|
|
21386
|
-
}
|
|
21387
|
-
return [];
|
|
21388
|
-
} catch (e) {
|
|
21389
|
-
console.warn(
|
|
21390
|
-
"Error reading rejected legal document agreements from localStorage",
|
|
21391
|
-
e
|
|
21392
|
-
);
|
|
21393
|
-
return [];
|
|
21394
|
-
}
|
|
21395
|
-
};
|
|
21396
|
-
var getDocumentsNotAgreed = (walletAddress, documents) => {
|
|
21397
|
-
if (!walletAddress) return [];
|
|
21398
|
-
const agreements = getStoredAgreements();
|
|
21399
|
-
const rejections = getStoredRejectedDocuments();
|
|
21400
|
-
return documents.filter((document2) => {
|
|
21401
|
-
const isAgreed = agreements.some(
|
|
21402
|
-
(agreement) => compareAddresses(agreement.walletAddress, walletAddress) && agreement.id === document2.id
|
|
21403
|
-
);
|
|
21404
|
-
if (isAgreed) return false;
|
|
21405
|
-
const isRejected = rejections.some(
|
|
21406
|
-
(rejection) => compareAddresses(rejection.walletAddress, walletAddress) && rejection.id === document2.id
|
|
21407
|
-
);
|
|
21408
|
-
if (isRejected) return false;
|
|
21409
|
-
return true;
|
|
21410
|
-
});
|
|
21411
|
-
};
|
|
21412
21381
|
var createDocumentRecords = (docs, walletAddress) => {
|
|
21413
21382
|
const timestamp = Date.now();
|
|
21414
21383
|
return docs.map((doc) => ({
|
|
@@ -21481,8 +21450,24 @@ var LegalDocumentsProvider = ({ children }) => {
|
|
|
21481
21450
|
return [formattedDocs, required];
|
|
21482
21451
|
}, [legalDocuments, isAnalyticsAllowed]);
|
|
21483
21452
|
const documentsNotAgreed = useMemo(() => {
|
|
21484
|
-
|
|
21485
|
-
|
|
21453
|
+
if (!account?.address) return [];
|
|
21454
|
+
return documents.filter((document2) => {
|
|
21455
|
+
const isAgreed = storedAgreements.some(
|
|
21456
|
+
(agreement) => compareAddresses(
|
|
21457
|
+
agreement.walletAddress,
|
|
21458
|
+
account.address
|
|
21459
|
+
) && agreement.id === document2.id
|
|
21460
|
+
);
|
|
21461
|
+
if (isAgreed) return false;
|
|
21462
|
+
const isRejected = optionalRejected.some(
|
|
21463
|
+
(rejection) => compareAddresses(
|
|
21464
|
+
rejection.walletAddress,
|
|
21465
|
+
account.address
|
|
21466
|
+
) && rejection.id === document2.id
|
|
21467
|
+
);
|
|
21468
|
+
return !isRejected;
|
|
21469
|
+
});
|
|
21470
|
+
}, [documents, account?.address, storedAgreements, optionalRejected]);
|
|
21486
21471
|
const hasAgreedToRequiredDocuments = useMemo(() => {
|
|
21487
21472
|
if (!requiredDocuments.length || !account?.address) return true;
|
|
21488
21473
|
return requiredDocuments.every(
|