@learncard/react 2.10.6 → 2.10.8
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/cjs/{MeritBadgeDisplayCard-1de23221.js → MeritBadgeDisplayCard-15b85a79.js} +2 -2
- package/dist/cjs/{MeritBadgeDisplayCard-1de23221.js.map → MeritBadgeDisplayCard-15b85a79.js.map} +1 -1
- package/dist/cjs/{SchoolIDCard-2d3cbb2c.js → SchoolIDCard-10796199.js} +1184 -3
- package/dist/cjs/SchoolIDCard-10796199.js.map +1 -0
- package/dist/cjs/{VCCard-31833e79.js → VCCard-4f02e2f4.js} +2 -2
- package/dist/cjs/{VCCard-31833e79.js.map → VCCard-4f02e2f4.js.map} +1 -1
- package/dist/cjs/{VCDisplayCard2-8b8aaea7.js → VCDisplayCard2-8517f419.js} +28 -14
- package/dist/cjs/VCDisplayCard2-8517f419.js.map +1 -0
- package/dist/cjs/VerifierStateBadgeAndText-c15064b2.js.map +1 -1
- package/dist/cjs/i18n-cc7e34ec.js +55 -0
- package/dist/cjs/i18n-cc7e34ec.js.map +1 -0
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index14.js +5 -5
- package/dist/cjs/index22.js +2 -1
- package/dist/cjs/index22.js.map +1 -1
- package/dist/cjs/index31.js +1 -2
- package/dist/cjs/index31.js.map +1 -1
- package/dist/cjs/index39.js +4 -4
- package/dist/cjs/index42.js +3 -3
- package/dist/esm/{MeritBadgeDisplayCard-a7a504e0.js → MeritBadgeDisplayCard-2029a552.js} +2 -2
- package/dist/esm/{MeritBadgeDisplayCard-a7a504e0.js.map → MeritBadgeDisplayCard-2029a552.js.map} +1 -1
- package/dist/esm/{SchoolIDCard-fbd1cf6c.js → SchoolIDCard-f82e40bc.js} +1183 -2
- package/dist/esm/SchoolIDCard-f82e40bc.js.map +1 -0
- package/dist/esm/{VCCard-d07dfdc7.js → VCCard-c0f6dff3.js} +2 -2
- package/dist/esm/{VCCard-d07dfdc7.js.map → VCCard-c0f6dff3.js.map} +1 -1
- package/dist/esm/{VCDisplayCard2-a3f671bc.js → VCDisplayCard2-fc5c4225.js} +28 -14
- package/dist/esm/VCDisplayCard2-fc5c4225.js.map +1 -0
- package/dist/esm/VerifierStateBadgeAndText-60b98d25.js.map +1 -1
- package/dist/esm/i18n-8454d6ea.js +47 -0
- package/dist/esm/i18n-8454d6ea.js.map +1 -0
- package/dist/esm/index.js +5 -5
- package/dist/esm/index14.js +5 -5
- package/dist/esm/index22.js +2 -1
- package/dist/esm/index22.js.map +1 -1
- package/dist/esm/index31.js +1 -2
- package/dist/esm/index31.js.map +1 -1
- package/dist/esm/index39.js +4 -4
- package/dist/esm/index42.js +3 -3
- package/dist/index.d.ts +37 -1
- package/package.json +2 -2
- package/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx +1 -1
- package/src/components/MeritBadgeDisplayCard/VerifierStateBadgeAndText.tsx +7 -5
- package/src/components/VCDisplayCard2/VerificationRow.tsx +27 -4
- package/src/components/VCDisplayCard2/VerificationsBox.tsx +4 -5
- package/src/i18n/index.tsx +87 -0
- package/src/index.ts +3 -0
- package/dist/cjs/SchoolIDCard-2d3cbb2c.js.map +0 -1
- package/dist/cjs/VCDisplayCard2-8b8aaea7.js.map +0 -1
- package/dist/cjs/index-47efbf5b.js +0 -1186
- package/dist/cjs/index-47efbf5b.js.map +0 -1
- package/dist/esm/SchoolIDCard-fbd1cf6c.js.map +0 -1
- package/dist/esm/VCDisplayCard2-a3f671bc.js.map +0 -1
- package/dist/esm/index-cbd2e9db.js +0 -1184
- package/dist/esm/index-cbd2e9db.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { createContext, useMemo, useContext, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const I18nContext = createContext(null);
|
|
4
|
+
const EN_DEFAULTS = {
|
|
5
|
+
"verification.selfIssued": "Self Issued",
|
|
6
|
+
"verification.trustedIssuer": "Trusted Issuer",
|
|
7
|
+
"verification.unknownIssuer": "Unknown Issuer",
|
|
8
|
+
"verification.appIssuer": "Trusted App",
|
|
9
|
+
"verification.untrustedIssuer": "Untrusted Issuer",
|
|
10
|
+
"credential.by": "By",
|
|
11
|
+
"verification.title": "Credential Verifications",
|
|
12
|
+
"verification.infoText": "Credential verifications check the cryptographic proof of digital credentials to ensure their authenticity and accuracy.",
|
|
13
|
+
"verification.status.success": "Success",
|
|
14
|
+
"verification.status.error": "Error",
|
|
15
|
+
"verification.status.failed": "Failed",
|
|
16
|
+
"verification.check.proof": "Proof",
|
|
17
|
+
"verification.check.status": "Status",
|
|
18
|
+
"verification.check.expiration": "Expiration",
|
|
19
|
+
"verification.message.valid": "Valid",
|
|
20
|
+
"verification.message.invalid": "Invalid",
|
|
21
|
+
"verification.message.notRevoked": "Not Revoked",
|
|
22
|
+
"verification.message.revoked": "Revoked",
|
|
23
|
+
"verification.message.doesNotExpire": "Does Not Expire",
|
|
24
|
+
"verification.message.expired": "Expired",
|
|
25
|
+
"verification.message.active": "Active",
|
|
26
|
+
"verification.message.couldNotVerify": "Boost Credential could not be verified."
|
|
27
|
+
};
|
|
28
|
+
const interpolate = (str, params) => params ? str.replace(/\{(\w+)\}/g, (_, k) => params[k] != null ? String(params[k]) : `{${k}}`) : str;
|
|
29
|
+
const I18nProvider = ({ resolve, locale, children }) => {
|
|
30
|
+
const value = useMemo(() => ({ resolve, locale }), [resolve, locale]);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(I18nContext.Provider, { value }, children);
|
|
32
|
+
};
|
|
33
|
+
const useT = () => {
|
|
34
|
+
const ctx = useContext(I18nContext);
|
|
35
|
+
return useCallback(
|
|
36
|
+
(key, params) => {
|
|
37
|
+
const fromHost = ctx == null ? void 0 : ctx.resolve(key, params);
|
|
38
|
+
if (fromHost != null) return fromHost;
|
|
39
|
+
const def = EN_DEFAULTS[key];
|
|
40
|
+
return def != null ? interpolate(def, params) : key;
|
|
41
|
+
},
|
|
42
|
+
[ctx]
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { EN_DEFAULTS as E, I18nProvider as I, useT as u };
|
|
47
|
+
//# sourceMappingURL=i18n-8454d6ea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n-8454d6ea.js","sources":["../../src/i18n/index.tsx"],"sourcesContent":["/**\n * Lightweight i18n adapter for `@learncard/react`.\n *\n * This is a PUBLISHED SDK consumed by external third parties who have no\n * Paraglide, no app providers, and no catalog. So the rule is: render English\n * with zero configuration, and only *optionally* accept translations.\n *\n * Components call `useT()`. With no provider mounted, `useT()` returns the\n * co-located English default (zero-config English for every consumer). A\n * consumer that wants localization mounts `<I18nProvider resolve={fn} locale={l}>`\n * where `fn` maps a key to a translated string using whatever i18n they use\n * (Paraglide, i18next, a static map — the SDK doesn't care).\n *\n * Kept intentionally dependency-free and self-contained (a ~40-line copy also\n * lives in learn-card-base) so the SDK pulls in no i18n runtime.\n */\nimport React, { createContext, useCallback, useContext, useMemo } from 'react';\n\nexport type I18nResolver = (key: string, params?: Record<string, unknown>) => string | undefined;\n\ntype I18nContextValue = { resolve: I18nResolver; locale: string };\n\nconst I18nContext = createContext<I18nContextValue | null>(null);\n\n/**\n * English defaults co-located with the SDK. One entry per extracted string.\n * Keys are unprefixed; a host app namespaces them (e.g. `sdk.`) in its catalog.\n */\nexport const EN_DEFAULTS: Record<string, string> = {\n 'verification.selfIssued': 'Self Issued',\n 'verification.trustedIssuer': 'Trusted Issuer',\n 'verification.unknownIssuer': 'Unknown Issuer',\n 'verification.appIssuer': 'Trusted App',\n 'verification.untrustedIssuer': 'Untrusted Issuer',\n 'credential.by': 'By',\n 'verification.title': 'Credential Verifications',\n 'verification.infoText':\n 'Credential verifications check the cryptographic proof of digital credentials to ensure their authenticity and accuracy.',\n 'verification.status.success': 'Success',\n 'verification.status.error': 'Error',\n 'verification.status.failed': 'Failed',\n 'verification.check.proof': 'Proof',\n 'verification.check.status': 'Status',\n 'verification.check.expiration': 'Expiration',\n 'verification.message.valid': 'Valid',\n 'verification.message.invalid': 'Invalid',\n 'verification.message.notRevoked': 'Not Revoked',\n 'verification.message.revoked': 'Revoked',\n 'verification.message.doesNotExpire': 'Does Not Expire',\n 'verification.message.expired': 'Expired',\n 'verification.message.active': 'Active',\n 'verification.message.couldNotVerify': 'Boost Credential could not be verified.',\n};\n\n/** Minimal `{var}` interpolation — no dependency. */\nconst interpolate = (str: string, params?: Record<string, unknown>): string =>\n params\n ? str.replace(/\\{(\\w+)\\}/g, (_, k) => (params[k] != null ? String(params[k]) : `{${k}}`))\n : str;\n\nexport const I18nProvider: React.FC<{\n resolve: I18nResolver;\n locale: string;\n children: React.ReactNode;\n}> = ({ resolve, locale, children }) => {\n const value = useMemo<I18nContextValue>(() => ({ resolve, locale }), [resolve, locale]);\n return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;\n};\n\n/**\n * Returns a translate function. Resolution order:\n * 1. host resolver (consumer catalog) if a provider is mounted and has the key\n * 2. co-located English default (interpolated)\n * 3. the key itself (last-resort)\n */\nexport const useT = (): ((key: string, params?: Record<string, unknown>) => string) => {\n const ctx = useContext(I18nContext);\n return useCallback(\n (key: string, params?: Record<string, unknown>) => {\n const fromHost = ctx?.resolve(key, params);\n if (fromHost != null) return fromHost;\n const def = EN_DEFAULTS[key];\n return def != null ? interpolate(def, params) : key;\n },\n [ctx]\n );\n};\n"],"names":[],"mappings":";;AAsBA,MAAM,WAAA,GAAc,cAAuC,IAAI,CAAA,CAAA;AAMxD,MAAM,WAAsC,GAAA;AAAA,EAC/C,yBAA2B,EAAA,aAAA;AAAA,EAC3B,4BAA8B,EAAA,gBAAA;AAAA,EAC9B,4BAA8B,EAAA,gBAAA;AAAA,EAC9B,wBAA0B,EAAA,aAAA;AAAA,EAC1B,8BAAgC,EAAA,kBAAA;AAAA,EAChC,eAAiB,EAAA,IAAA;AAAA,EACjB,oBAAsB,EAAA,0BAAA;AAAA,EACtB,uBACI,EAAA,0HAAA;AAAA,EACJ,6BAA+B,EAAA,SAAA;AAAA,EAC/B,2BAA6B,EAAA,OAAA;AAAA,EAC7B,4BAA8B,EAAA,QAAA;AAAA,EAC9B,0BAA4B,EAAA,OAAA;AAAA,EAC5B,2BAA6B,EAAA,QAAA;AAAA,EAC7B,+BAAiC,EAAA,YAAA;AAAA,EACjC,4BAA8B,EAAA,OAAA;AAAA,EAC9B,8BAAgC,EAAA,SAAA;AAAA,EAChC,iCAAmC,EAAA,aAAA;AAAA,EACnC,8BAAgC,EAAA,SAAA;AAAA,EAChC,oCAAsC,EAAA,iBAAA;AAAA,EACtC,8BAAgC,EAAA,SAAA;AAAA,EAChC,6BAA+B,EAAA,QAAA;AAAA,EAC/B,qCAAuC,EAAA,yCAAA;AAC3C,EAAA;AAGA,MAAM,WAAA,GAAc,CAAC,GAAa,EAAA,MAAA,KAC9B,SACM,GAAI,CAAA,OAAA,CAAQ,YAAc,EAAA,CAAC,CAAG,EAAA,CAAA,KAAO,OAAO,CAAC,CAAA,IAAK,IAAO,GAAA,MAAA,CAAO,MAAO,CAAA,CAAC,CAAC,CAAI,GAAA,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,CAAI,CACtF,GAAA,GAAA,CAAA;AAEH,MAAM,eAIR,CAAC,EAAE,OAAS,EAAA,MAAA,EAAQ,UAAe,KAAA;AACpC,EAAM,MAAA,KAAA,GAAQ,OAA0B,CAAA,OAAO,EAAE,OAAA,EAAS,QAAW,CAAA,EAAA,CAAC,OAAS,EAAA,MAAM,CAAC,CAAA,CAAA;AACtF,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,WAAA,CAAY,QAAZ,EAAA,EAAqB,SAAe,QAAS,CAAA,CAAA;AACzD,EAAA;AAQO,MAAM,OAAO,MAAmE;AACnF,EAAM,MAAA,GAAA,GAAM,WAAW,WAAW,CAAA,CAAA;AAClC,EAAO,OAAA,WAAA;AAAA,IACH,CAAC,KAAa,MAAqC,KAAA;AAC/C,MAAM,MAAA,QAAA,GAAW,GAAK,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,GAAA,CAAA,OAAA,CAAQ,GAAK,EAAA,MAAA,CAAA,CAAA;AACnC,MAAI,IAAA,QAAA,IAAY,MAAa,OAAA,QAAA,CAAA;AAC7B,MAAM,MAAA,GAAA,GAAM,YAAY,GAAG,CAAA,CAAA;AAC3B,MAAA,OAAO,GAAO,IAAA,IAAA,GAAO,WAAY,CAAA,GAAA,EAAK,MAAM,CAAI,GAAA,GAAA,CAAA;AAAA,KACpD;AAAA,IACA,CAAC,GAAG,CAAA;AAAA,GACR,CAAA;AACJ;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
export { S as SelectedSkills, V as VERIFIER_STATES, f as formatDidDisplayName, b as getAvatarColorFromString, g as getAvatarLetterFromDid, i as isDid, a as isLearnCardNetworkDid, r as resolveProfileDisplay } from './VerifierStateBadgeAndText-60b98d25.js';
|
|
3
|
+
export { E as EN_DEFAULTS, I as I18nProvider, u as useT } from './i18n-8454d6ea.js';
|
|
3
4
|
export { A as AchievementCard } from './AchievementCard-c600788a.js';
|
|
4
5
|
export { B as BoostGenericCard } from './BoostGenericCard-7dfcc887.js';
|
|
5
6
|
export { B as BoostSmallCard } from './BoostSmallCard-a73b6800.js';
|
|
@@ -18,7 +19,7 @@ export { L as LearnCardCreditCardFrontFace } from './LearnCardCreditCardFrontFac
|
|
|
18
19
|
export { L as LearnPill } from './LearnPill-e0720485.js';
|
|
19
20
|
export { L as Lightbox } from './Lightbox-f0338a0c.js';
|
|
20
21
|
export { C as CircleLoadingState } from './CircleSpinner-03a329fc.js';
|
|
21
|
-
export { M as MeritBadgeBackFace, a as MeritBadgeDisplayCard, b as MeritBadgeFrontFace } from './MeritBadgeDisplayCard-
|
|
22
|
+
export { M as MeritBadgeBackFace, a as MeritBadgeDisplayCard, b as MeritBadgeFrontFace } from './MeritBadgeDisplayCard-2029a552.js';
|
|
22
23
|
export { M as MeritBadgeSkillsCount } from './MeritBadgeSkillsCount-c5271d7f.js';
|
|
23
24
|
export { M as MiniVCThumbnail } from './MiniVCThumbnail-cc05e1f8.js';
|
|
24
25
|
export { N as Notification } from './Notification-279ba207.js';
|
|
@@ -30,17 +31,17 @@ export { U as UserNotificationTypeStyles } from './types-b32d28d5.js';
|
|
|
30
31
|
export { Q as QRCodeCard } from './QRCodeCard-3abf9f33.js';
|
|
31
32
|
export { C as CheckmarkSvg, R as RoundedPill } from './RoundedPill-50279e5d.js';
|
|
32
33
|
export { R as RoundedSquare, a as TYPE_TO_IMG_SRC, T as TYPE_TO_MINI_ICON, b as TYPE_TO_WALLET_COLOR, W as WALLET_SUBTYPES } from './constants-f1ed610c.js';
|
|
33
|
-
export { S as SchoolIDCard } from './SchoolIDCard-
|
|
34
|
+
export { S as SchoolIDCard } from './SchoolIDCard-f82e40bc.js';
|
|
34
35
|
export { S as SkillTabCard } from './SkillTabCard-f2edb3fc.js';
|
|
35
36
|
export { S as SkillVerticalCard } from './SkillVerticalCard-045169f9.js';
|
|
36
37
|
export { a as SkillsCard, S as SkillsMeterSegment } from './SkillsCard-5279aac9.js';
|
|
37
38
|
export { S as SkillsStatsCard } from './SkillsStatsCard-e0cd6137.js';
|
|
38
39
|
export { S as SmallAchievementCard } from './SmallAchievementCard-24dfa453.js';
|
|
39
40
|
export { U as UserProfilePicture } from './UserProfilePicture-50c34186.js';
|
|
40
|
-
export { V as VCCard } from './VCCard-
|
|
41
|
+
export { V as VCCard } from './VCCard-c0f6dff3.js';
|
|
41
42
|
export { V as VCDisplayBackFace } from './VCDisplayBackFace-bb60a881.js';
|
|
42
43
|
export { V as VCDisplayCard } from './VCDisplayCard-9905d9d3.js';
|
|
43
|
-
export { V as VCDisplayCard2, a as VCDisplayCardSkillsCount, b as VCIDDisplayCard } from './VCDisplayCard2-
|
|
44
|
+
export { V as VCDisplayCard2, a as VCDisplayCardSkillsCount, b as VCIDDisplayCard } from './VCDisplayCard2-fc5c4225.js';
|
|
44
45
|
export { V as VCThumbnail } from './VCThumbnail-835921dd.js';
|
|
45
46
|
export { V as VCVerificationCheck, a as VCVerificationCheckWithSpinner, b as VCVerificationCheckWithText } from './VCVerificationCheck-8b8b7a76.js';
|
|
46
47
|
export { V as ValidationStateIndicator } from './VCVerificationPill-83eb61f4.js';
|
|
@@ -125,7 +126,6 @@ import './X.svg';
|
|
|
125
126
|
import './ArrowArcLeft.svg';
|
|
126
127
|
import './walletids.webp';
|
|
127
128
|
import './membership-graphic.png';
|
|
128
|
-
import './index-cbd2e9db.js';
|
|
129
129
|
import './skillplaceholder.png';
|
|
130
130
|
import './skillgraph.svg';
|
|
131
131
|
import '@learncard/init';
|
package/dist/esm/index14.js
CHANGED
|
@@ -17,7 +17,7 @@ export { L as LearnCardCreditCardFrontFace } from './LearnCardCreditCardFrontFac
|
|
|
17
17
|
export { L as LearnPill } from './LearnPill-e0720485.js';
|
|
18
18
|
export { L as Lightbox } from './Lightbox-f0338a0c.js';
|
|
19
19
|
export { C as CircleLoadingState } from './CircleSpinner-03a329fc.js';
|
|
20
|
-
export { M as MeritBadgeBackFace, a as MeritBadgeDisplayCard, b as MeritBadgeFrontFace } from './MeritBadgeDisplayCard-
|
|
20
|
+
export { M as MeritBadgeBackFace, a as MeritBadgeDisplayCard, b as MeritBadgeFrontFace } from './MeritBadgeDisplayCard-2029a552.js';
|
|
21
21
|
export { M as MeritBadgeSkillsCount } from './MeritBadgeSkillsCount-c5271d7f.js';
|
|
22
22
|
export { M as MiniVCThumbnail } from './MiniVCThumbnail-cc05e1f8.js';
|
|
23
23
|
export { N as Notification } from './Notification-279ba207.js';
|
|
@@ -29,17 +29,17 @@ export { U as UserNotificationTypeStyles } from './types-b32d28d5.js';
|
|
|
29
29
|
export { Q as QRCodeCard } from './QRCodeCard-3abf9f33.js';
|
|
30
30
|
export { C as CheckmarkSvg, R as RoundedPill } from './RoundedPill-50279e5d.js';
|
|
31
31
|
export { R as RoundedSquare, a as TYPE_TO_IMG_SRC, T as TYPE_TO_MINI_ICON, b as TYPE_TO_WALLET_COLOR, W as WALLET_SUBTYPES } from './constants-f1ed610c.js';
|
|
32
|
-
export { S as SchoolIDCard } from './SchoolIDCard-
|
|
32
|
+
export { S as SchoolIDCard } from './SchoolIDCard-f82e40bc.js';
|
|
33
33
|
export { S as SkillTabCard } from './SkillTabCard-f2edb3fc.js';
|
|
34
34
|
export { S as SkillVerticalCard } from './SkillVerticalCard-045169f9.js';
|
|
35
35
|
export { a as SkillsCard, S as SkillsMeterSegment } from './SkillsCard-5279aac9.js';
|
|
36
36
|
export { S as SkillsStatsCard } from './SkillsStatsCard-e0cd6137.js';
|
|
37
37
|
export { S as SmallAchievementCard } from './SmallAchievementCard-24dfa453.js';
|
|
38
38
|
export { U as UserProfilePicture } from './UserProfilePicture-50c34186.js';
|
|
39
|
-
export { V as VCCard } from './VCCard-
|
|
39
|
+
export { V as VCCard } from './VCCard-c0f6dff3.js';
|
|
40
40
|
export { V as VCDisplayBackFace } from './VCDisplayBackFace-bb60a881.js';
|
|
41
41
|
export { V as VCDisplayCard } from './VCDisplayCard-9905d9d3.js';
|
|
42
|
-
export { V as VCDisplayCard2, a as VCDisplayCardSkillsCount, b as VCIDDisplayCard } from './VCDisplayCard2-
|
|
42
|
+
export { V as VCDisplayCard2, a as VCDisplayCardSkillsCount, b as VCIDDisplayCard } from './VCDisplayCard2-fc5c4225.js';
|
|
43
43
|
export { V as VCThumbnail } from './VCThumbnail-835921dd.js';
|
|
44
44
|
export { V as VCVerificationCheck, a as VCVerificationCheckWithSpinner, b as VCVerificationCheckWithText } from './VCVerificationCheck-8b8b7a76.js';
|
|
45
45
|
export { V as ValidationStateIndicator } from './VCVerificationPill-83eb61f4.js';
|
|
@@ -125,12 +125,12 @@ import './X.svg';
|
|
|
125
125
|
import './ArrowArcLeft.svg';
|
|
126
126
|
import './walletids.webp';
|
|
127
127
|
import './membership-graphic.png';
|
|
128
|
-
import './index-cbd2e9db.js';
|
|
129
128
|
import './skillplaceholder.png';
|
|
130
129
|
import './skillgraph.svg';
|
|
131
130
|
import '@learncard/init';
|
|
132
131
|
import './ArrowArcRight.svg';
|
|
133
132
|
import './icon.green.fat-arrow.png';
|
|
133
|
+
import './i18n-8454d6ea.js';
|
|
134
134
|
import './id-sleeve.png';
|
|
135
135
|
import './vc.check.svg';
|
|
136
136
|
import './RedXCircle.svg';
|
package/dist/esm/index22.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export { M as MeritBadgeBackFace, a as MeritBadgeDisplayCard, b as MeritBadgeFrontFace } from './MeritBadgeDisplayCard-
|
|
2
|
+
export { M as MeritBadgeBackFace, a as MeritBadgeDisplayCard, b as MeritBadgeFrontFace } from './MeritBadgeDisplayCard-2029a552.js';
|
|
3
3
|
import './index-cb3a593b.js';
|
|
4
4
|
import './types.esm-d6b48609.js';
|
|
5
5
|
export { M as MeritBadgeSkillsCount } from './MeritBadgeSkillsCount-c5271d7f.js';
|
|
6
|
+
import './i18n-8454d6ea.js';
|
|
6
7
|
import './VerifierStateBadgeAndText-60b98d25.js';
|
|
7
8
|
import './athletics.png';
|
|
8
9
|
import './business.png';
|
package/dist/esm/index22.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index22.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index22.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/index31.js
CHANGED
package/dist/esm/index31.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index31.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index31.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/esm/index39.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { V as VCCard } from './VCCard-
|
|
1
|
+
export { V as VCCard } from './VCCard-c0f6dff3.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@learncard/init';
|
|
4
4
|
import './VCDisplayCard-9905d9d3.js';
|
|
@@ -21,8 +21,7 @@ import './RedXCircle.svg';
|
|
|
21
21
|
import './GreenCheckCircle.svg';
|
|
22
22
|
import './YellowWarningCircle.svg';
|
|
23
23
|
import './ArrowArcRight.svg';
|
|
24
|
-
import './VCDisplayCard2-
|
|
25
|
-
import './index-cbd2e9db.js';
|
|
24
|
+
import './VCDisplayCard2-fc5c4225.js';
|
|
26
25
|
import './VerifierStateBadgeAndText-60b98d25.js';
|
|
27
26
|
import './athletics.png';
|
|
28
27
|
import './business.png';
|
|
@@ -35,9 +34,10 @@ import './stem.png';
|
|
|
35
34
|
import './trade.png';
|
|
36
35
|
import './Lightbox-f0338a0c.js';
|
|
37
36
|
import 'react-dom';
|
|
37
|
+
import './i18n-8454d6ea.js';
|
|
38
38
|
import './CertificateDisplayCard-4e9254e0.js';
|
|
39
39
|
import './DotsThreeOutline.svg';
|
|
40
40
|
import './QRCodeIcon-8eef4f7c.js';
|
|
41
41
|
import './id-sleeve.png';
|
|
42
|
-
import './MeritBadgeDisplayCard-
|
|
42
|
+
import './MeritBadgeDisplayCard-2029a552.js';
|
|
43
43
|
//# sourceMappingURL=index39.js.map
|
package/dist/esm/index42.js
CHANGED
|
@@ -10,11 +10,11 @@ import './social.png';
|
|
|
10
10
|
import './stem.png';
|
|
11
11
|
import './trade.png';
|
|
12
12
|
import './index-cb3a593b.js';
|
|
13
|
-
export { V as VCDisplayCard2, a as VCDisplayCardSkillsCount, b as VCIDDisplayCard } from './VCDisplayCard2-
|
|
13
|
+
export { V as VCDisplayCard2, a as VCDisplayCardSkillsCount, b as VCIDDisplayCard } from './VCDisplayCard2-fc5c4225.js';
|
|
14
14
|
import './types.esm-d6b48609.js';
|
|
15
|
+
import './i18n-8454d6ea.js';
|
|
15
16
|
import './id-sleeve.png';
|
|
16
17
|
import './PuzzlePiece-a3d9cc62.js';
|
|
17
|
-
import './index-cbd2e9db.js';
|
|
18
18
|
import './VCVerificationCheck-8b8b7a76.js';
|
|
19
19
|
import './vc.check.svg';
|
|
20
20
|
import './CircleSpinner-03a329fc.js';
|
|
@@ -28,5 +28,5 @@ import 'react-dom';
|
|
|
28
28
|
import './CertificateDisplayCard-4e9254e0.js';
|
|
29
29
|
import './DotsThreeOutline.svg';
|
|
30
30
|
import './QRCodeIcon-8eef4f7c.js';
|
|
31
|
-
import './MeritBadgeDisplayCard-
|
|
31
|
+
import './MeritBadgeDisplayCard-2029a552.js';
|
|
32
32
|
//# sourceMappingURL=index42.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1614,4 +1614,40 @@ declare const useParsedSdJwtVc: (learnCard: LearnCard | undefined, compact: stri
|
|
|
1614
1614
|
declare const humanizeClaimLabel: (key: string) => string;
|
|
1615
1615
|
declare const formatClaimValue: (value: unknown) => string;
|
|
1616
1616
|
|
|
1617
|
-
|
|
1617
|
+
/**
|
|
1618
|
+
* Lightweight i18n adapter for `@learncard/react`.
|
|
1619
|
+
*
|
|
1620
|
+
* This is a PUBLISHED SDK consumed by external third parties who have no
|
|
1621
|
+
* Paraglide, no app providers, and no catalog. So the rule is: render English
|
|
1622
|
+
* with zero configuration, and only *optionally* accept translations.
|
|
1623
|
+
*
|
|
1624
|
+
* Components call `useT()`. With no provider mounted, `useT()` returns the
|
|
1625
|
+
* co-located English default (zero-config English for every consumer). A
|
|
1626
|
+
* consumer that wants localization mounts `<I18nProvider resolve={fn} locale={l}>`
|
|
1627
|
+
* where `fn` maps a key to a translated string using whatever i18n they use
|
|
1628
|
+
* (Paraglide, i18next, a static map — the SDK doesn't care).
|
|
1629
|
+
*
|
|
1630
|
+
* Kept intentionally dependency-free and self-contained (a ~40-line copy also
|
|
1631
|
+
* lives in learn-card-base) so the SDK pulls in no i18n runtime.
|
|
1632
|
+
*/
|
|
1633
|
+
|
|
1634
|
+
type I18nResolver = (key: string, params?: Record<string, unknown>) => string | undefined;
|
|
1635
|
+
/**
|
|
1636
|
+
* English defaults co-located with the SDK. One entry per extracted string.
|
|
1637
|
+
* Keys are unprefixed; a host app namespaces them (e.g. `sdk.`) in its catalog.
|
|
1638
|
+
*/
|
|
1639
|
+
declare const EN_DEFAULTS: Record<string, string>;
|
|
1640
|
+
declare const I18nProvider: React$1.FC<{
|
|
1641
|
+
resolve: I18nResolver;
|
|
1642
|
+
locale: string;
|
|
1643
|
+
children: React$1.ReactNode;
|
|
1644
|
+
}>;
|
|
1645
|
+
/**
|
|
1646
|
+
* Returns a translate function. Resolution order:
|
|
1647
|
+
* 1. host resolver (consumer catalog) if a provider is mounted and has the key
|
|
1648
|
+
* 2. co-located English default (interpolated)
|
|
1649
|
+
* 3. the key itself (last-resort)
|
|
1650
|
+
*/
|
|
1651
|
+
declare const useT: () => ((key: string, params?: Record<string, unknown>) => string);
|
|
1652
|
+
|
|
1653
|
+
export { AchievementCard, AwardDisplayIcon, AwardRibbon, BadgeDisplayIcon, BoostGenericCard, BoostSmallCard, Briefcase, Button, ButtonProps, CertDisplayCardSkillsCount, CertificateBackFace, CertificateDisplayCard, CertificateDisplayIcon, CertificateFrontFace, Checkmark, CheckmarkSvg, CircleCheckButton, CircleIcon, CircleIconProps, CircleLoadingState, CircleSpinnerProps, Coins, CountCircle, CountCircleProps, CourseCard, CourseDisplayIcon, CourseVerticalCard, CredentialFormat, CredentialIconType, EN_DEFAULTS, FlippyCard, FlippyCardProps, GenericArrow, GenericCard, Graduation, I18nProvider, I18nResolver, IDDisplayIcon, IDIcon, IDSleeve, JobHistoryCard, JobListCard, JobListingBubble, LearnCardCreditCardBackFace, LearnCardCreditCardBackFaceProps, LearnCardCreditCardFrontFace, LearnCardCreditCardFrontFaceProps, LearnCardCreditCardProps, LearnCardCreditCardUserProps, LearnPill, Lightbox, LightboxImage, LightboxItem, LightboxItemType, LightboxProps, LightboxVideo, Lightbulb, MeritBadgeBackFace, MeritBadgeDisplayCard, MeritBadgeFrontFace, MeritBadgeSkillsCount, MiniVCThumbnail, MiniVCThumbnailProps, Notification, NotificationBoostCard, NotificationBoostCardProps, NotificationIssuerMeta, NotificationProps, NotificationTypeStyles, NotificationUserAcceptedBoostCard, NotificationUserAcceptedBoostCardProps, NotificationUserCard, NotificationUserCardProps, ParsedSdJwtVc, QRCodeCard, QRCodeCardProps, QRCodeIcon, RoundedPill, RoundedSquare, RoundedSquareProps, SchoolIDCard, SchoolIDCardProps, SelectedSkills, SkillTabCard, SkillVerticalCard, SkillsCard, SkillsMeterSegment, SkillsStatsCard, SmallAchievementCard, TYPE_TO_IMG_SRC, TYPE_TO_MINI_ICON, TYPE_TO_WALLET_COLOR, ThreeDotVertical, Trophy, User, UserNotificationTypeStyles, UserProfilePicture, VCCard, VCCardProps, VCDisplayBackFace, VCDisplayCard, VCDisplayCard2, VCDisplayCard2Props, VCDisplayCardPropsReal, VCDisplayCardSkillsCount, VCIDDisplayCard, VCIDDisplayCardProps, VCThumbnail, VCThumbnailProps, VCVerificationCheck, VCVerificationCheckProps, VCVerificationCheckWithSpinner, VCVerificationCheckWithText, VERIFIER_STATES, ValidationStateIndicator, VerifierState, VerifierStateBadgeAndTextProps, WALLET_SUBTYPES, formatClaimValue, formatDidDisplayName, getAvatarColorFromString, getAvatarLetterFromDid, humanizeClaimLabel, isDid, isLearnCardNetworkDid, resolveProfileDisplay, useCredentialFormat, useOnMomentumScrollEnd, useParsedSdJwtVc, useScrollBorders, useT };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/react",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"vite": "^6.4.2"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@learncard/init": "2.4.
|
|
69
|
+
"@learncard/init": "2.4.8",
|
|
70
70
|
"date-fns": "^2.28.0",
|
|
71
71
|
"numeral": "^2.0.6",
|
|
72
72
|
"pretty-bytes": "^6.0.0",
|
|
@@ -159,7 +159,7 @@ export const MeritBadgeFrontFace: React.FC<MeritBadgeFrontFaceProps> = ({
|
|
|
159
159
|
>
|
|
160
160
|
<div className="flex flex-col gap-[5px] w-full">
|
|
161
161
|
<div className="flex flex-col items-center text-grayscale-900">
|
|
162
|
-
{issueeName && (
|
|
162
|
+
{issueeName && !customBodyCardComponent && (
|
|
163
163
|
<>
|
|
164
164
|
<span className="flex flex-wrap items-baseline justify-center gap-1 text-[16px] leading-[150%] font-jacques max-w-full overflow-hidden text-ellipsis whitespace-nowrap">
|
|
165
165
|
{!issueeDisplay.isMissing && issueeDisplay.isDidValue ? (
|
|
@@ -3,6 +3,7 @@ import UnknownVerifierBadge from '../svgs/UnknownVerifierBadge';
|
|
|
3
3
|
import VerifiedBadge from '../svgs/VerifiedBadge';
|
|
4
4
|
import PersonBadge from '../svgs/PersonBadge';
|
|
5
5
|
import RedFlag from '../svgs/RedFlag';
|
|
6
|
+
import { useT } from '../../i18n';
|
|
6
7
|
|
|
7
8
|
const VERIFIER_STATES = {
|
|
8
9
|
selfVerified: 'Self Issued',
|
|
@@ -18,36 +19,37 @@ type VerifierStateBadgeAndTextProps = {
|
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const VerifierStateBadgeAndText: React.FC<VerifierStateBadgeAndTextProps> = ({ verifierState }) => {
|
|
22
|
+
const t = useT();
|
|
21
23
|
return (
|
|
22
24
|
<div className="flex justify-center">
|
|
23
25
|
{verifierState === VERIFIER_STATES.selfVerified && (
|
|
24
26
|
<span className="uppercase font-poppins text-[12px] font-[500] text-green-dark flex gap-[3px] items-center">
|
|
25
27
|
<PersonBadge />
|
|
26
|
-
|
|
28
|
+
{t('verification.selfIssued')}
|
|
27
29
|
</span>
|
|
28
30
|
)}
|
|
29
31
|
{verifierState === VERIFIER_STATES.trustedVerifier && (
|
|
30
32
|
<span className="uppercase font-poppins text-[12px] font-[500] text-blue-light flex gap-[3px] items-center">
|
|
31
33
|
<VerifiedBadge />
|
|
32
|
-
|
|
34
|
+
{t('verification.trustedIssuer')}
|
|
33
35
|
</span>
|
|
34
36
|
)}
|
|
35
37
|
{verifierState === VERIFIER_STATES.unknownVerifier && (
|
|
36
38
|
<span className="uppercase font-poppins text-[12px] font-[500] text-orange-500 flex gap-[3px] items-center">
|
|
37
39
|
<UnknownVerifierBadge />
|
|
38
|
-
|
|
40
|
+
{t('verification.unknownIssuer')}
|
|
39
41
|
</span>
|
|
40
42
|
)}
|
|
41
43
|
{verifierState === VERIFIER_STATES.appIssuer && (
|
|
42
44
|
<span className="uppercase font-poppins text-[12px] font-[500] text-cyan-600 flex gap-[3px] items-center">
|
|
43
45
|
<UnknownVerifierBadge />
|
|
44
|
-
|
|
46
|
+
{t('verification.appIssuer')}
|
|
45
47
|
</span>
|
|
46
48
|
)}
|
|
47
49
|
{verifierState === VERIFIER_STATES.untrustedVerifier && (
|
|
48
50
|
<span className="uppercase font-poppins text-[12px] font-[500] text-red-mastercard flex gap-[3px] items-center">
|
|
49
51
|
<RedFlag />
|
|
50
|
-
|
|
52
|
+
{t('verification.untrustedIssuer')}
|
|
51
53
|
</span>
|
|
52
54
|
)}
|
|
53
55
|
</div>
|
|
@@ -8,13 +8,28 @@ import AcuteCheckmark from '../svgs/AcuteCheckmark';
|
|
|
8
8
|
import ExclamationPoint from '../svgs/ExclamationPoint';
|
|
9
9
|
import X from '../svgs/X';
|
|
10
10
|
import { capitalize } from '../../helpers/string.helpers';
|
|
11
|
+
import { useT } from '../../i18n';
|
|
11
12
|
|
|
12
13
|
type VerificationRowProps = {
|
|
13
14
|
verification: VerificationItem;
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
/** Map the SDK's English verification messages to i18n keys; unknown messages pass through. */
|
|
18
|
+
const MESSAGE_KEYS: Record<string, string> = {
|
|
19
|
+
Valid: 'valid',
|
|
20
|
+
Invalid: 'invalid',
|
|
21
|
+
'Not Revoked': 'notRevoked',
|
|
22
|
+
Revoked: 'revoked',
|
|
23
|
+
'Does Not Expire': 'doesNotExpire',
|
|
24
|
+
Expired: 'expired',
|
|
25
|
+
Active: 'active',
|
|
26
|
+
'Boost Credential could not be verified.': 'couldNotVerify',
|
|
27
|
+
'Boost Credential could not be verified': 'couldNotVerify',
|
|
28
|
+
};
|
|
29
|
+
|
|
16
30
|
const VerificationRow: React.FC<VerificationRowProps> = ({ verification }) => {
|
|
17
31
|
const [showInfo, setShowInfo] = useState(false);
|
|
32
|
+
const t = useT();
|
|
18
33
|
const statusColor = getColorForVerificationStatus(verification.status);
|
|
19
34
|
|
|
20
35
|
const getIcon = () => {
|
|
@@ -28,11 +43,19 @@ const VerificationRow: React.FC<VerificationRowProps> = ({ verification }) => {
|
|
|
28
43
|
}
|
|
29
44
|
};
|
|
30
45
|
|
|
46
|
+
const statusText = t(`verification.status.${String(verification.status).toLowerCase()}`);
|
|
47
|
+
const translateMessage = (msg?: string): string => {
|
|
48
|
+
if (!msg) return '';
|
|
49
|
+
const key = MESSAGE_KEYS[msg];
|
|
50
|
+
return key ? t(`verification.message.${key}`) : msg;
|
|
51
|
+
};
|
|
52
|
+
const checkLabel = verification.check ? t(`verification.check.${verification.check}`) : '';
|
|
53
|
+
|
|
31
54
|
let primaryText = verification.check
|
|
32
|
-
? `${
|
|
33
|
-
: verification.message;
|
|
55
|
+
? `${checkLabel}: ${translateMessage(verification.message)}`
|
|
56
|
+
: translateMessage(verification.message);
|
|
34
57
|
if (verification.status === VerificationStatusEnum.Failed) {
|
|
35
|
-
primaryText = verification.message ?? verification.details ?? '';
|
|
58
|
+
primaryText = translateMessage(verification.message ?? verification.details ?? '');
|
|
36
59
|
}
|
|
37
60
|
primaryText = capitalize(primaryText);
|
|
38
61
|
|
|
@@ -45,7 +68,7 @@ const VerificationRow: React.FC<VerificationRowProps> = ({ verification }) => {
|
|
|
45
68
|
style={{ color: statusColor }}
|
|
46
69
|
>
|
|
47
70
|
{getIcon()}
|
|
48
|
-
{
|
|
71
|
+
{statusText}
|
|
49
72
|
{infoText && (
|
|
50
73
|
<button className="ml-auto" onClick={() => setShowInfo(!showInfo)}>
|
|
51
74
|
<InfoIcon color={statusColor} />
|
|
@@ -5,6 +5,7 @@ import InfoIcon from '../svgs/InfoIcon';
|
|
|
5
5
|
import InfoBox from './InfoBox';
|
|
6
6
|
|
|
7
7
|
import { VerificationItem } from '@learncard/types';
|
|
8
|
+
import { useT } from '../../i18n';
|
|
8
9
|
|
|
9
10
|
type VerificationsBoxProps = {
|
|
10
11
|
verificationItems: VerificationItem[];
|
|
@@ -12,11 +13,12 @@ type VerificationsBoxProps = {
|
|
|
12
13
|
|
|
13
14
|
const VerificationsBox: React.FC<VerificationsBoxProps> = ({ verificationItems }) => {
|
|
14
15
|
const [showInfo, setShowInfo] = useState(false);
|
|
16
|
+
const t = useT();
|
|
15
17
|
|
|
16
18
|
return (
|
|
17
19
|
<div className="verifications-box bg-white flex flex-col items-start gap-[10px] rounded-[20px] shadow-bottom px-[15px] py-[20px] w-full relative">
|
|
18
20
|
<h3 className="text-[20px] leading-[20px] text-grayscale-900">
|
|
19
|
-
|
|
21
|
+
{t('verification.title')}
|
|
20
22
|
</h3>
|
|
21
23
|
<button
|
|
22
24
|
className="absolute top-[17px] right-[17px]"
|
|
@@ -28,10 +30,7 @@ const VerificationsBox: React.FC<VerificationsBoxProps> = ({ verificationItems }
|
|
|
28
30
|
<InfoIcon color={showInfo ? '#6366F1' : undefined} />
|
|
29
31
|
</button>
|
|
30
32
|
{showInfo && (
|
|
31
|
-
<InfoBox
|
|
32
|
-
text="Credential verifications check the cryptographic proof of digital credentials to ensure their authenticity and accuracy."
|
|
33
|
-
handleClose={() => setShowInfo(false)}
|
|
34
|
-
/>
|
|
33
|
+
<InfoBox text={t('verification.infoText')} handleClose={() => setShowInfo(false)} />
|
|
35
34
|
)}
|
|
36
35
|
|
|
37
36
|
{verificationItems.map((verification, index) => (
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight i18n adapter for `@learncard/react`.
|
|
3
|
+
*
|
|
4
|
+
* This is a PUBLISHED SDK consumed by external third parties who have no
|
|
5
|
+
* Paraglide, no app providers, and no catalog. So the rule is: render English
|
|
6
|
+
* with zero configuration, and only *optionally* accept translations.
|
|
7
|
+
*
|
|
8
|
+
* Components call `useT()`. With no provider mounted, `useT()` returns the
|
|
9
|
+
* co-located English default (zero-config English for every consumer). A
|
|
10
|
+
* consumer that wants localization mounts `<I18nProvider resolve={fn} locale={l}>`
|
|
11
|
+
* where `fn` maps a key to a translated string using whatever i18n they use
|
|
12
|
+
* (Paraglide, i18next, a static map — the SDK doesn't care).
|
|
13
|
+
*
|
|
14
|
+
* Kept intentionally dependency-free and self-contained (a ~40-line copy also
|
|
15
|
+
* lives in learn-card-base) so the SDK pulls in no i18n runtime.
|
|
16
|
+
*/
|
|
17
|
+
import React, { createContext, useCallback, useContext, useMemo } from 'react';
|
|
18
|
+
|
|
19
|
+
export type I18nResolver = (key: string, params?: Record<string, unknown>) => string | undefined;
|
|
20
|
+
|
|
21
|
+
type I18nContextValue = { resolve: I18nResolver; locale: string };
|
|
22
|
+
|
|
23
|
+
const I18nContext = createContext<I18nContextValue | null>(null);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* English defaults co-located with the SDK. One entry per extracted string.
|
|
27
|
+
* Keys are unprefixed; a host app namespaces them (e.g. `sdk.`) in its catalog.
|
|
28
|
+
*/
|
|
29
|
+
export const EN_DEFAULTS: Record<string, string> = {
|
|
30
|
+
'verification.selfIssued': 'Self Issued',
|
|
31
|
+
'verification.trustedIssuer': 'Trusted Issuer',
|
|
32
|
+
'verification.unknownIssuer': 'Unknown Issuer',
|
|
33
|
+
'verification.appIssuer': 'Trusted App',
|
|
34
|
+
'verification.untrustedIssuer': 'Untrusted Issuer',
|
|
35
|
+
'credential.by': 'By',
|
|
36
|
+
'verification.title': 'Credential Verifications',
|
|
37
|
+
'verification.infoText':
|
|
38
|
+
'Credential verifications check the cryptographic proof of digital credentials to ensure their authenticity and accuracy.',
|
|
39
|
+
'verification.status.success': 'Success',
|
|
40
|
+
'verification.status.error': 'Error',
|
|
41
|
+
'verification.status.failed': 'Failed',
|
|
42
|
+
'verification.check.proof': 'Proof',
|
|
43
|
+
'verification.check.status': 'Status',
|
|
44
|
+
'verification.check.expiration': 'Expiration',
|
|
45
|
+
'verification.message.valid': 'Valid',
|
|
46
|
+
'verification.message.invalid': 'Invalid',
|
|
47
|
+
'verification.message.notRevoked': 'Not Revoked',
|
|
48
|
+
'verification.message.revoked': 'Revoked',
|
|
49
|
+
'verification.message.doesNotExpire': 'Does Not Expire',
|
|
50
|
+
'verification.message.expired': 'Expired',
|
|
51
|
+
'verification.message.active': 'Active',
|
|
52
|
+
'verification.message.couldNotVerify': 'Boost Credential could not be verified.',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** Minimal `{var}` interpolation — no dependency. */
|
|
56
|
+
const interpolate = (str: string, params?: Record<string, unknown>): string =>
|
|
57
|
+
params
|
|
58
|
+
? str.replace(/\{(\w+)\}/g, (_, k) => (params[k] != null ? String(params[k]) : `{${k}}`))
|
|
59
|
+
: str;
|
|
60
|
+
|
|
61
|
+
export const I18nProvider: React.FC<{
|
|
62
|
+
resolve: I18nResolver;
|
|
63
|
+
locale: string;
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
}> = ({ resolve, locale, children }) => {
|
|
66
|
+
const value = useMemo<I18nContextValue>(() => ({ resolve, locale }), [resolve, locale]);
|
|
67
|
+
return <I18nContext.Provider value={value}>{children}</I18nContext.Provider>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Returns a translate function. Resolution order:
|
|
72
|
+
* 1. host resolver (consumer catalog) if a provider is mounted and has the key
|
|
73
|
+
* 2. co-located English default (interpolated)
|
|
74
|
+
* 3. the key itself (last-resort)
|
|
75
|
+
*/
|
|
76
|
+
export const useT = (): ((key: string, params?: Record<string, unknown>) => string) => {
|
|
77
|
+
const ctx = useContext(I18nContext);
|
|
78
|
+
return useCallback(
|
|
79
|
+
(key: string, params?: Record<string, unknown>) => {
|
|
80
|
+
const fromHost = ctx?.resolve(key, params);
|
|
81
|
+
if (fromHost != null) return fromHost;
|
|
82
|
+
const def = EN_DEFAULTS[key];
|
|
83
|
+
return def != null ? interpolate(def, params) : key;
|
|
84
|
+
},
|
|
85
|
+
[ctx]
|
|
86
|
+
);
|
|
87
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -14,3 +14,6 @@ export * from './helpers/did-display.helpers';
|
|
|
14
14
|
export * from './hooks/useCredentialFormat';
|
|
15
15
|
export * from './hooks/useParsedSdJwtVc';
|
|
16
16
|
export * from './helpers/credentialFormat.helpers';
|
|
17
|
+
|
|
18
|
+
// Optional i18n adapter (English by default; consumers may inject a resolver)
|
|
19
|
+
export * from './i18n';
|