@learncard/react 2.7.0 → 2.7.1
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/{BoostGenericCard-924e41e7.js → BoostGenericCard-a5ca50df.js} +8 -5
- package/dist/cjs/BoostGenericCard-a5ca50df.js.map +1 -0
- package/dist/cjs/{CertificateDisplayCard-74de3c56.js → CertificateDisplayCard-811ef7cf.js} +20 -10
- package/dist/cjs/CertificateDisplayCard-811ef7cf.js.map +1 -0
- package/dist/cjs/{VCCard-98ab4879.js → VCCard-2d4bfd86.js} +2 -2
- package/dist/cjs/{VCCard-98ab4879.js.map → VCCard-2d4bfd86.js.map} +1 -1
- package/dist/cjs/{VCDisplayCard2-e09f4a0a.js → VCDisplayCard2-2fbad5c7.js} +28 -5
- package/dist/cjs/VCDisplayCard2-2fbad5c7.js.map +1 -0
- package/dist/cjs/index-7d94d5ac.js.map +1 -1
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index13.js +5 -4
- package/dist/cjs/index13.js.map +1 -1
- package/dist/cjs/index3.js +1 -1
- package/dist/cjs/index36.js +3 -3
- package/dist/cjs/index39.js +2 -2
- package/dist/cjs/index6.js +2 -1
- package/dist/cjs/index6.js.map +1 -1
- package/dist/esm/{BoostGenericCard-09f3bd8a.js → BoostGenericCard-a82dec36.js} +8 -5
- package/dist/esm/BoostGenericCard-a82dec36.js.map +1 -0
- package/dist/esm/{CertificateDisplayCard-b3c93952.js → CertificateDisplayCard-5fc4318c.js} +19 -11
- package/dist/esm/CertificateDisplayCard-5fc4318c.js.map +1 -0
- package/dist/esm/{VCCard-b0347a85.js → VCCard-9f020c00.js} +2 -2
- package/dist/esm/{VCCard-b0347a85.js.map → VCCard-9f020c00.js.map} +1 -1
- package/dist/esm/{VCDisplayCard2-b0f44405.js → VCDisplayCard2-0b6b741f.js} +29 -6
- package/dist/esm/VCDisplayCard2-0b6b741f.js.map +1 -0
- package/dist/esm/index-43f63ea7.js.map +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/index13.js +4 -4
- package/dist/esm/index3.js +1 -1
- package/dist/esm/index36.js +3 -3
- package/dist/esm/index39.js +2 -2
- package/dist/esm/index6.js +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/main.css +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/BoostGenericCard-924e41e7.js.map +0 -1
- package/dist/cjs/CertificateDisplayCard-74de3c56.js.map +0 -1
- package/dist/cjs/VCDisplayCard2-e09f4a0a.js.map +0 -1
- package/dist/esm/BoostGenericCard-09f3bd8a.js.map +0 -1
- package/dist/esm/CertificateDisplayCard-b3c93952.js.map +0 -1
- package/dist/esm/VCDisplayCard2-b0f44405.js.map +0 -1
|
@@ -14,7 +14,7 @@ import './stem.svg';
|
|
|
14
14
|
import './trade.svg';
|
|
15
15
|
import './types.esm-8f6a5623.js';
|
|
16
16
|
import './CaretRightFilled.svg';
|
|
17
|
-
import { V as VCDisplayCard2 } from './VCDisplayCard2-
|
|
17
|
+
import { V as VCDisplayCard2 } from './VCDisplayCard2-0b6b741f.js';
|
|
18
18
|
import './id-sleeve.png';
|
|
19
19
|
|
|
20
20
|
var __async = (__this, __arguments, generator) => {
|
|
@@ -84,4 +84,4 @@ const VCCard = ({
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
export { VCCard as V };
|
|
87
|
-
//# sourceMappingURL=VCCard-
|
|
87
|
+
//# sourceMappingURL=VCCard-9f020c00.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VCCard-
|
|
1
|
+
{"version":3,"file":"VCCard-9f020c00.js","sources":["../../src/components/VCCard/VCCard.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { initLearnCard } from '@learncard/init';\nimport { VC, Profile, VerificationItem } from '@learncard/types';\n\nimport { VCDisplayCard } from '../VCDisplayCard';\nimport {\n VCDisplayCard2,\n CredentialIconType,\n} from '../VCDisplayCard2';\n\nimport { MediaMetadata, VideoMetadata } from '../../types';\n\nexport type VCCardProps = {\n credential: VC;\n issueeOverride?: Profile;\n className?: string;\n version?: '1' | '2';\n\n /* Only used for version 2 */\n subjectImageComponent?: React.ReactNode;\n // convertTagsToSkills?: (tags: string[]) => { [skill: string]: string[] };\n handleXClick?: () => void;\n getFileMetadata?: (url: string) => MediaMetadata;\n getVideoMetadata?: (url: string) => VideoMetadata;\n onMediaAttachmentClick?: (url: string) => void;\n bottomRightIcon?: CredentialIconType;\n};\n\nexport const VCCard: React.FC<VCCardProps> = ({\n credential,\n issueeOverride,\n className = '',\n version = '1',\n subjectImageComponent,\n // convertTagsToSkills,\n handleXClick,\n getFileMetadata,\n getVideoMetadata,\n onMediaAttachmentClick,\n bottomRightIcon,\n}) => {\n const [loading, setLoading] = useState(true);\n const [vcVerification, setVCVerification] = useState<VerificationItem[]>([]);\n\n useEffect(() => {\n const verify = async () => {\n const wallet = await initLearnCard();\n const verification = await wallet.invoke.verifyCredential(credential, {}, true);\n setVCVerification(verification);\n setLoading(false);\n };\n\n verify();\n }, [credential]);\n\n if (version === '1') {\n return (\n <VCDisplayCard\n credential={credential}\n issueeOverride={issueeOverride}\n className={className}\n loading={loading}\n verification={vcVerification}\n />\n );\n }\n return (\n <VCDisplayCard2\n credential={credential}\n issueeOverride={issueeOverride}\n verificationInProgress={loading}\n verificationItems={vcVerification}\n subjectImageComponent={subjectImageComponent}\n // convertTagsToSkills={convertTagsToSkills}\n handleXClick={handleXClick}\n getFileMetadata={getFileMetadata}\n getVideoMetadata={getVideoMetadata}\n onMediaAttachmentClick={onMediaAttachmentClick}\n bottomRightIcon={bottomRightIcon}\n />\n );\n};\n\nexport default VCCard;\n"],"names":["this"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAI,OAAO,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,KAAK;AAClD,EAAE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAA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EAAE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3D,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,MAAM,MAAM,GAAG,MAAM,OAAO,CAACA,SAAI,EAAE,IAAI,EAAE,aAAa;AAC1D,MAAM,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;AACtF,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC;AACtC,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;AACxB,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,EAAE,CAAC;AACb,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACnB,EAAE,IAAI,OAAO,KAAK,GAAG,EAAE;AACvB,IAAI,uBAAuB,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE;AAC9D,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAM,YAAY,EAAE,cAAc;AAClC,KAAK,CAAC,CAAC;AACP,GAAG;AACH,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;AAC7D,IAAI,UAAU;AACd,IAAI,cAAc;AAClB,IAAI,sBAAsB,EAAE,OAAO;AACnC,IAAI,iBAAiB,EAAE,cAAc;AACrC,IAAI,qBAAqB;AACzB,IAAI,YAAY;AAChB,IAAI,eAAe;AACnB,IAAI,gBAAgB;AACpB,IAAI,sBAAsB;AAC1B,IAAI,eAAe;AACnB,GAAG,CAAC,CAAC;AACL;;;;"}
|
|
@@ -2,8 +2,8 @@ import React, { useRef, useEffect, useState, createContext, Component, Children,
|
|
|
2
2
|
import './index-4fa491c1.js';
|
|
3
3
|
import { a as VCVerificationCheckWithSpinner } from './VCVerificationCheck-80249524.js';
|
|
4
4
|
import DefaultFace from './default-face.jpeg';
|
|
5
|
-
import { a as getColorForVerificationStatus, j as format$1, h as getNameFromProfile, i as getImageFromProfile, k as getCategoryColor, g as getTotalCountOfSkills, c as categorizeSkills
|
|
6
|
-
import { g as getBaseUrl,
|
|
5
|
+
import { a as getColorForVerificationStatus, j as format$1, h as getNameFromProfile, b as getInfoFromCredential, i as getImageFromProfile, k as getCategoryColor, g as getTotalCountOfSkills, c as categorizeSkills } from './credential.helpers-c06a1aa8.js';
|
|
6
|
+
import { g as getBaseUrl, d as VideoIcon, e as Camera, G as GenericDocumentIcon, L as LinkIcon, p as prettyBytes, f as capitalize, X, E as ExclamationPoint, A as AcuteCheckmark, I as InfoIcon, h as LeftArrow, i as SkillsBox, j as AlignmentsBox, t as truncateWithEllipsis, V as VERIFIER_STATES$1, k as VerifierStateBadgeAndText, P as PersonBadge, l as VerifiedBadge, U as UnknownVerifierBadge, R as RedFlag, b as CertificateDisplayCard } from './CertificateDisplayCard-5fc4318c.js';
|
|
7
7
|
import { L as Lightbox } from './Lightbox-a1aab9ea.js';
|
|
8
8
|
import { V as VerificationStatusEnum } from './types.esm-8f6a5623.js';
|
|
9
9
|
import { I as IDIcon, Q as QRCodeIcon, A as AwardRibbon } from './QRCodeIcon-e9569804.js';
|
|
@@ -580,6 +580,7 @@ const VC2BackFace = ({
|
|
|
580
580
|
};
|
|
581
581
|
|
|
582
582
|
const VC2FrontFaceInfo = ({
|
|
583
|
+
credential,
|
|
583
584
|
issuee,
|
|
584
585
|
issuer,
|
|
585
586
|
subjectDID,
|
|
@@ -588,12 +589,16 @@ const VC2FrontFaceInfo = ({
|
|
|
588
589
|
customBodyCardComponent,
|
|
589
590
|
createdAt,
|
|
590
591
|
imageUrl,
|
|
591
|
-
customThumbComponent
|
|
592
|
+
customThumbComponent,
|
|
593
|
+
trustedAppRegistry
|
|
592
594
|
}) => {
|
|
593
595
|
const issuerName = truncateWithEllipsis(getNameFromProfile(issuer != null ? issuer : ""), 25);
|
|
594
596
|
const issueeName = truncateWithEllipsis(getNameFromProfile(issuee != null ? issuee : ""), 25);
|
|
595
597
|
const issuerImage = getImageFromProfile(issuer != null ? issuer : "");
|
|
596
598
|
const issueeImage = getImageFromProfile(issuee != null ? issuee : "");
|
|
599
|
+
const { credentialSubject } = getInfoFromCredential(credential, "MMM dd, yyyy", {
|
|
600
|
+
uppercaseDate: false
|
|
601
|
+
});
|
|
597
602
|
const getImageElement = (imageUrl2, alt, overrideComponent) => {
|
|
598
603
|
if (overrideComponent)
|
|
599
604
|
return overrideComponent;
|
|
@@ -605,6 +610,18 @@ const VC2FrontFaceInfo = ({
|
|
|
605
610
|
};
|
|
606
611
|
const issueeImageEl = getImageElement(issueeImage, "Issuee image", subjectImageComponent);
|
|
607
612
|
const issuerImageEl = getImageElement(issuerImage, "Issuer image", issuerImageComponent);
|
|
613
|
+
const issuerDid = typeof credential.issuer === "string" ? credential.issuer : credential.issuer.id;
|
|
614
|
+
let verifierState;
|
|
615
|
+
if ((credentialSubject == null ? void 0 : credentialSubject.id) === issuerDid && issuerDid && issuerDid !== "did:example:123") {
|
|
616
|
+
verifierState = VERIFIER_STATES$1.selfVerified;
|
|
617
|
+
} else {
|
|
618
|
+
const appRegistryEntry = trustedAppRegistry == null ? void 0 : trustedAppRegistry.find((registryEntry) => registryEntry.did === issuerDid);
|
|
619
|
+
if (appRegistryEntry) {
|
|
620
|
+
verifierState = appRegistryEntry.isTrusted ? VERIFIER_STATES$1.trustedVerifier : VERIFIER_STATES$1.untrustedVerifier;
|
|
621
|
+
} else {
|
|
622
|
+
verifierState = VERIFIER_STATES$1.unknownVerifier;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
608
625
|
return /* @__PURE__ */ React.createElement("section", {
|
|
609
626
|
className: "vc-front-face w-full px-[15px] flex flex-col items-center gap-[15px]"
|
|
610
627
|
}, imageUrl && !customThumbComponent && /* @__PURE__ */ React.createElement("img", {
|
|
@@ -623,6 +640,8 @@ const VC2FrontFaceInfo = ({
|
|
|
623
640
|
}, issueeImageEl), /* @__PURE__ */ React.createElement("div", {
|
|
624
641
|
className: "vc-issuer-image h-[30px] w-[30px] rounded-full overflow-hidden absolute bottom-[-12px] right-[-12px]"
|
|
625
642
|
}, issuerImageEl)), /* @__PURE__ */ React.createElement("div", {
|
|
643
|
+
className: "flex flex-col gap-[13px]"
|
|
644
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
626
645
|
className: "vc-issue-details mt-[10px] flex flex-col items-center font-montserrat text-[14px] leading-[20px]"
|
|
627
646
|
}, /* @__PURE__ */ React.createElement("span", {
|
|
628
647
|
className: "created-at text-grayscale-700"
|
|
@@ -630,7 +649,9 @@ const VC2FrontFaceInfo = ({
|
|
|
630
649
|
className: "issued-by text-grayscale-900 font-[500]"
|
|
631
650
|
}, "by ", /* @__PURE__ */ React.createElement("strong", {
|
|
632
651
|
className: "font-[700]"
|
|
633
|
-
}, issuerName)))
|
|
652
|
+
}, issuerName))), /* @__PURE__ */ React.createElement(VerifierStateBadgeAndText, {
|
|
653
|
+
verifierState
|
|
654
|
+
})))));
|
|
634
655
|
};
|
|
635
656
|
|
|
636
657
|
/*! @license Rematrix v0.2.2
|
|
@@ -1194,6 +1215,7 @@ const VCDisplayCard2 = ({
|
|
|
1194
1215
|
}, isFront && /* @__PURE__ */ React.createElement(v, {
|
|
1195
1216
|
flipId: "face"
|
|
1196
1217
|
}, /* @__PURE__ */ React.createElement(VC2FrontFaceInfo, {
|
|
1218
|
+
credential,
|
|
1197
1219
|
issuee,
|
|
1198
1220
|
subjectDID,
|
|
1199
1221
|
issuer,
|
|
@@ -1203,7 +1225,8 @@ const VCDisplayCard2 = ({
|
|
|
1203
1225
|
customBodyCardComponent,
|
|
1204
1226
|
customThumbComponent,
|
|
1205
1227
|
createdAt: createdAt != null ? createdAt : "",
|
|
1206
|
-
imageUrl
|
|
1228
|
+
imageUrl,
|
|
1229
|
+
trustedAppRegistry
|
|
1207
1230
|
})), !isFront && /* @__PURE__ */ React.createElement(v, {
|
|
1208
1231
|
flipId: "face"
|
|
1209
1232
|
}, /* @__PURE__ */ React.createElement(VC2BackFace, {
|
|
@@ -1260,4 +1283,4 @@ const VCDisplayCard2 = ({
|
|
|
1260
1283
|
};
|
|
1261
1284
|
|
|
1262
1285
|
export { VCDisplayCard2 as V, VCDisplayCardSkillsCount as a, VCIDDisplayCard as b };
|
|
1263
|
-
//# sourceMappingURL=VCDisplayCard2-
|
|
1286
|
+
//# sourceMappingURL=VCDisplayCard2-0b6b741f.js.map
|