@learncard/react 2.10.3 → 2.10.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/README.md +10 -10
- package/dist/base.css +1 -1
- package/dist/base.js +1 -1
- package/dist/cjs/{BoostGenericCard-0f68947f.js → BoostGenericCard-5a07339f.js} +2 -2
- package/dist/cjs/{BoostGenericCard-0f68947f.js.map → BoostGenericCard-5a07339f.js.map} +1 -1
- package/dist/cjs/{CertificateDisplayCard-6c30f6e6.js → CertificateDisplayCard-a7940558.js} +4 -4
- package/dist/cjs/{CertificateDisplayCard-6c30f6e6.js.map → CertificateDisplayCard-a7940558.js.map} +1 -1
- package/dist/cjs/CircleIcon-f0fa68c7.js.map +1 -1
- package/dist/cjs/{LearnCardCreditCardFrontFace-aca1b7bc.js → LearnCardCreditCardFrontFace-75fb4e44.js} +2 -2
- package/dist/cjs/{LearnCardCreditCardFrontFace-aca1b7bc.js.map → LearnCardCreditCardFrontFace-75fb4e44.js.map} +1 -1
- package/dist/cjs/{MeritBadgeDisplayCard-535853f5.js → MeritBadgeDisplayCard-1c614da9.js} +4 -4
- package/dist/cjs/{MeritBadgeDisplayCard-535853f5.js.map → MeritBadgeDisplayCard-1c614da9.js.map} +1 -1
- package/dist/cjs/{MeritBadgeSkillsCount-5cc7d16e.js → MeritBadgeSkillsCount-4dabf982.js} +2 -2
- package/dist/cjs/{MeritBadgeSkillsCount-5cc7d16e.js.map → MeritBadgeSkillsCount-4dabf982.js.map} +1 -1
- package/dist/cjs/{QRCodeCard-f0079bd9.js → QRCodeCard-2378411e.js} +2 -2
- package/dist/cjs/{QRCodeCard-f0079bd9.js.map → QRCodeCard-2378411e.js.map} +1 -1
- package/dist/cjs/{SchoolIDCard-e22d0d80.js → SchoolIDCard-2d3cbb2c.js} +13 -1189
- package/dist/cjs/SchoolIDCard-2d3cbb2c.js.map +1 -0
- package/dist/cjs/{VCCard-deabc204.js → VCCard-5bb95d29.js} +3 -3
- package/dist/cjs/{VCCard-deabc204.js.map → VCCard-5bb95d29.js.map} +1 -1
- package/dist/cjs/{VCDisplayBackFace-a15d5252.js → VCDisplayBackFace-864c35d5.js} +3 -3
- package/dist/cjs/{VCDisplayBackFace-a15d5252.js.map → VCDisplayBackFace-864c35d5.js.map} +1 -1
- package/dist/cjs/{VCDisplayCard-a64fa405.js → VCDisplayCard-15af27c6.js} +3 -3
- package/dist/cjs/{VCDisplayCard-a64fa405.js.map → VCDisplayCard-15af27c6.js.map} +1 -1
- package/dist/cjs/{VCDisplayCard2-6c87eade.js → VCDisplayCard2-f3f5c6c4.js} +28 -22
- package/dist/cjs/VCDisplayCard2-f3f5c6c4.js.map +1 -0
- package/dist/cjs/{VCVerificationPill-e1cc6be2.js → VCVerificationPill-20ed4d3c.js} +2 -2
- package/dist/cjs/{VCVerificationPill-e1cc6be2.js.map → VCVerificationPill-20ed4d3c.js.map} +1 -1
- package/dist/cjs/{VerifierStateBadgeAndText-5229da1a.js → VerifierStateBadgeAndText-de5bd85f.js} +9 -11
- package/dist/cjs/VerifierStateBadgeAndText-de5bd85f.js.map +1 -0
- package/dist/cjs/{credential.helpers-473e89c5.js → credential.helpers-b4d27c8a.js} +3 -3
- package/dist/cjs/credential.helpers-b4d27c8a.js.map +1 -0
- package/dist/cjs/{index-ec1d26f1.js → index-330dcb9c.js} +1 -1
- package/dist/cjs/index-330dcb9c.js.map +1 -0
- package/dist/cjs/index-47efbf5b.js +1186 -0
- package/dist/cjs/index-47efbf5b.js.map +1 -0
- package/dist/cjs/{index-0cac2c5b.js → index-da255c9a.js} +1 -1
- package/dist/cjs/index-da255c9a.js.map +1 -0
- package/dist/cjs/index.js +18 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index14.js +18 -17
- package/dist/cjs/index14.js.map +1 -1
- package/dist/cjs/index18.js +2 -2
- package/dist/cjs/index22.js +6 -6
- package/dist/cjs/index28.js +2 -2
- package/dist/cjs/index31.js +2 -1
- package/dist/cjs/index31.js.map +1 -1
- package/dist/cjs/index39.js +12 -11
- package/dist/cjs/index39.js.map +1 -1
- package/dist/cjs/index4.js +4 -4
- package/dist/cjs/index40.js +5 -5
- package/dist/cjs/index41.js +6 -6
- package/dist/cjs/index42.js +8 -7
- package/dist/cjs/index42.js.map +1 -1
- package/dist/cjs/index43.js +2 -2
- package/dist/cjs/index46.js +2 -2
- package/dist/cjs/index7.js +5 -5
- package/dist/cjs/{types.esm-12bb5eed.js → types.esm-40b77196.js} +3 -2
- package/dist/cjs/types.esm-40b77196.js.map +1 -0
- package/dist/esm/{BoostGenericCard-b332a829.js → BoostGenericCard-997af0f5.js} +2 -2
- package/dist/esm/{BoostGenericCard-b332a829.js.map → BoostGenericCard-997af0f5.js.map} +1 -1
- package/dist/esm/{CertificateDisplayCard-fc148ca0.js → CertificateDisplayCard-d764151e.js} +4 -4
- package/dist/esm/{CertificateDisplayCard-fc148ca0.js.map → CertificateDisplayCard-d764151e.js.map} +1 -1
- package/dist/esm/CircleIcon-abd5ff06.js.map +1 -1
- package/dist/esm/{LearnCardCreditCardFrontFace-b7c917f5.js → LearnCardCreditCardFrontFace-13d29504.js} +2 -2
- package/dist/esm/{LearnCardCreditCardFrontFace-b7c917f5.js.map → LearnCardCreditCardFrontFace-13d29504.js.map} +1 -1
- package/dist/esm/{MeritBadgeDisplayCard-da9de0b8.js → MeritBadgeDisplayCard-907627ed.js} +4 -4
- package/dist/esm/{MeritBadgeDisplayCard-da9de0b8.js.map → MeritBadgeDisplayCard-907627ed.js.map} +1 -1
- package/dist/esm/{MeritBadgeSkillsCount-01e2756e.js → MeritBadgeSkillsCount-9474bd51.js} +2 -2
- package/dist/esm/{MeritBadgeSkillsCount-01e2756e.js.map → MeritBadgeSkillsCount-9474bd51.js.map} +1 -1
- package/dist/esm/{QRCodeCard-8f29c3c7.js → QRCodeCard-3abf9f33.js} +2 -2
- package/dist/esm/{QRCodeCard-8f29c3c7.js.map → QRCodeCard-3abf9f33.js.map} +1 -1
- package/dist/esm/{SchoolIDCard-8b151cd3.js → SchoolIDCard-fbd1cf6c.js} +12 -1188
- package/dist/esm/SchoolIDCard-fbd1cf6c.js.map +1 -0
- package/dist/esm/{VCCard-94dbe6bf.js → VCCard-ce4b451d.js} +3 -3
- package/dist/esm/{VCCard-94dbe6bf.js.map → VCCard-ce4b451d.js.map} +1 -1
- package/dist/esm/{VCDisplayBackFace-9c5b383f.js → VCDisplayBackFace-e347145c.js} +3 -3
- package/dist/esm/{VCDisplayBackFace-9c5b383f.js.map → VCDisplayBackFace-e347145c.js.map} +1 -1
- package/dist/esm/{VCDisplayCard-bd4d15e1.js → VCDisplayCard-3002776b.js} +3 -3
- package/dist/esm/{VCDisplayCard-bd4d15e1.js.map → VCDisplayCard-3002776b.js.map} +1 -1
- package/dist/esm/{VCDisplayCard2-c6a81e42.js → VCDisplayCard2-db880bbb.js} +28 -22
- package/dist/esm/VCDisplayCard2-db880bbb.js.map +1 -0
- package/dist/esm/{VCVerificationPill-d073557c.js → VCVerificationPill-5a05423b.js} +2 -2
- package/dist/esm/{VCVerificationPill-d073557c.js.map → VCVerificationPill-5a05423b.js.map} +1 -1
- package/dist/esm/{VerifierStateBadgeAndText-6946e820.js → VerifierStateBadgeAndText-bd1b0131.js} +9 -11
- package/dist/esm/VerifierStateBadgeAndText-bd1b0131.js.map +1 -0
- package/dist/esm/{credential.helpers-ff461699.js → credential.helpers-26e1a359.js} +3 -3
- package/dist/esm/credential.helpers-26e1a359.js.map +1 -0
- package/dist/esm/{index-2ef835bd.js → index-bc6b8b0b.js} +1 -1
- package/dist/{cjs/index-ec1d26f1.js.map → esm/index-bc6b8b0b.js.map} +1 -1
- package/dist/esm/{index-eae3ca64.js → index-cb3a593b.js} +1 -1
- package/dist/esm/index-cb3a593b.js.map +1 -0
- package/dist/esm/index-cbd2e9db.js +1184 -0
- package/dist/esm/index-cbd2e9db.js.map +1 -0
- package/dist/esm/index.js +18 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index14.js +18 -17
- package/dist/esm/index14.js.map +1 -1
- package/dist/esm/index18.js +2 -2
- package/dist/esm/index22.js +6 -6
- package/dist/esm/index28.js +2 -2
- package/dist/esm/index31.js +2 -1
- package/dist/esm/index31.js.map +1 -1
- package/dist/esm/index39.js +12 -11
- package/dist/esm/index39.js.map +1 -1
- package/dist/esm/index4.js +4 -4
- package/dist/esm/index40.js +5 -5
- package/dist/esm/index41.js +6 -6
- package/dist/esm/index42.js +8 -7
- package/dist/esm/index42.js.map +1 -1
- package/dist/esm/index43.js +2 -2
- package/dist/esm/index46.js +2 -2
- package/dist/esm/index7.js +5 -5
- package/dist/esm/{types.esm-f32fc00a.js → types.esm-13bb929b.js} +3 -2
- package/dist/esm/types.esm-13bb929b.js.map +1 -0
- package/dist/main.css +1 -1
- package/dist/main.js +1 -1
- package/package.json +102 -87
- package/src/assets/icons/accommodationsIcon.svg +5 -0
- package/src/assets/icons/accomplishmentsIcon.svg +4 -0
- package/src/assets/icons/achievementsIcon.svg +7 -0
- package/src/assets/icons/coursesIcon.svg +5 -0
- package/src/assets/icons/eventsIcon.svg +6 -0
- package/src/assets/icons/experiencesIcon.svg +4 -0
- package/src/assets/icons/goalsIcon.svg +5 -0
- package/src/assets/icons/idIcon.svg +4 -0
- package/src/assets/icons/membershipsIcon.svg +4 -0
- package/src/assets/icons/relationshipsIcon.svg +6 -0
- package/src/assets/icons/skillsIcon.svg +3 -0
- package/src/assets/icons/socialBadgesIcon.svg +7 -0
- package/src/assets/images/Accommodation-Hands.png +0 -0
- package/src/assets/images/ArrowArcLeft.svg +4 -0
- package/src/assets/images/ArrowArcRight.svg +4 -0
- package/src/assets/images/CaretRight.svg +3 -0
- package/src/assets/images/CaretRightFilled.svg +3 -0
- package/src/assets/images/DotsThreeOutline.svg +5 -0
- package/src/assets/images/GreenCheckCircle.svg +4 -0
- package/src/assets/images/RedXCircle.svg +5 -0
- package/src/assets/images/X.svg +4 -0
- package/src/assets/images/YellowWarningCircle.svg +4 -0
- package/src/assets/images/addawardlight.svg +8 -0
- package/src/assets/images/agriculture.png +0 -0
- package/src/assets/images/apple.png +0 -0
- package/src/assets/images/athletics.png +0 -0
- package/src/assets/images/award.svg +3 -0
- package/src/assets/images/backpack.png +0 -0
- package/src/assets/images/badge.png +0 -0
- package/src/assets/images/briefcase.svg +6 -0
- package/src/assets/images/business.png +0 -0
- package/src/assets/images/card-chip.svg +26 -0
- package/src/assets/images/check.svg +17 -0
- package/src/assets/images/coins.svg +3 -0
- package/src/assets/images/contactless-symbol.svg +3 -0
- package/src/assets/images/creative.png +0 -0
- package/src/assets/images/digital.png +0 -0
- package/src/assets/images/durable.png +0 -0
- package/src/assets/images/emptystate-death.png +0 -0
- package/src/assets/images/emptystate-dinocandle.png +0 -0
- package/src/assets/images/emptystate-ghost1.png +0 -0
- package/src/assets/images/eventsGraphic.png +0 -0
- package/src/assets/images/experience-mountain.png +0 -0
- package/src/assets/images/goals-target.png +0 -0
- package/src/assets/images/gradcaplight.svg +3 -0
- package/src/assets/images/graduation.svg +3 -0
- package/src/assets/images/icon.green.fat-arrow.png +0 -0
- package/src/assets/images/id-purple.png +0 -0
- package/src/assets/images/id-sleeve.png +0 -0
- package/src/assets/images/key-icon.svg +4 -0
- package/src/assets/images/lhplaceholder.png +0 -0
- package/src/assets/images/lightbulb.svg +3 -0
- package/src/assets/images/loveyou-icon.svg +5 -0
- package/src/assets/images/master-card-logo.svg +20 -0
- package/src/assets/images/medical.png +0 -0
- package/src/assets/images/membership-graphic.png +0 -0
- package/src/assets/images/membership-key.svg +9 -0
- package/src/assets/images/minigradcapcolored.svg +3 -0
- package/src/assets/images/minijob.svg +5 -0
- package/src/assets/images/minipuzzle.svg +3 -0
- package/src/assets/images/minipuzzlecolored.svg +3 -0
- package/src/assets/images/minitrophy.svg +3 -0
- package/src/assets/images/minitrophycolored.svg +3 -0
- package/src/assets/images/motlow-buckcard-bg.svg +32 -0
- package/src/assets/images/mountains-icon.svg +4 -0
- package/src/assets/images/photoplaceholder.png +0 -0
- package/src/assets/images/puzzle-icon.svg +3 -0
- package/src/assets/images/relationships-cats.png +0 -0
- package/src/assets/images/sample-badge.png +0 -0
- package/src/assets/images/skillgraph.svg +29 -0
- package/src/assets/images/skillplaceholder.png +0 -0
- package/src/assets/images/social-badge-2.png +0 -0
- package/src/assets/images/social-badge.png +0 -0
- package/src/assets/images/social-icon.svg +7 -0
- package/src/assets/images/social.png +0 -0
- package/src/assets/images/stem.png +0 -0
- package/src/assets/images/target-icon.svg +5 -0
- package/src/assets/images/trade.png +0 -0
- package/src/assets/images/trophy.svg +3 -0
- package/src/assets/images/user.svg +4 -0
- package/src/assets/images/users-icon.svg +6 -0
- package/src/assets/images/vc.check.svg +10 -0
- package/src/assets/images/verified-check.png +0 -0
- package/src/assets/images/walletTrophy.png +0 -0
- package/src/assets/images/walletcurrency.webp +0 -0
- package/src/assets/images/walletids.webp +0 -0
- package/src/assets/images/walletjobhistory.webp +0 -0
- package/src/assets/images/walletskills.webp +0 -0
- package/src/assets/styles/base.css +2 -0
- package/src/assets/styles/main.css +475 -0
- package/src/components/AchievementCard/AchievementCard.stories.tsx +31 -0
- package/src/components/AchievementCard/AchievementCard.tsx +88 -0
- package/src/components/AchievementCard/index.ts +5 -0
- package/src/components/BadgeThumbnailImg/BadgeThumbnailImg.test.tsx +47 -0
- package/src/components/BadgeThumbnailImg/BadgeThumbnailImg.tsx +72 -0
- package/src/components/BadgeThumbnailImg/index.ts +5 -0
- package/src/components/BoostGenericCard/AlignmentSkillsCount.tsx +54 -0
- package/src/components/BoostGenericCard/BoostGenericCard.stories.tsx +39 -0
- package/src/components/BoostGenericCard/BoostGenericCard.tsx +177 -0
- package/src/components/BoostGenericCard/index.ts +6 -0
- package/src/components/BoostSmallCard/BoostSmallCard.stories.tsx +57 -0
- package/src/components/BoostSmallCard/BoostSmallCard.tsx +178 -0
- package/src/components/BoostSmallCard/index.ts +5 -0
- package/src/components/Button/Button.stories.tsx +20 -0
- package/src/components/Button/Button.test.tsx +15 -0
- package/src/components/Button/Button.tsx +21 -0
- package/src/components/Button/index.ts +5 -0
- package/src/components/CertificateDisplayCard/AlignmentRow.tsx +26 -0
- package/src/components/CertificateDisplayCard/AlignmentsBox.tsx +70 -0
- package/src/components/CertificateDisplayCard/CertDisplayCardSkillsCount.tsx +66 -0
- package/src/components/CertificateDisplayCard/CertificateBackFace.tsx +130 -0
- package/src/components/CertificateDisplayCard/CertificateCornerIcon.tsx +48 -0
- package/src/components/CertificateDisplayCard/CertificateDisplayCard.stories.tsx +21 -0
- package/src/components/CertificateDisplayCard/CertificateDisplayCard.tsx +180 -0
- package/src/components/CertificateDisplayCard/CertificateFrontFace.tsx +308 -0
- package/src/components/CertificateDisplayCard/CertificateImageDisplay.test.tsx +43 -0
- package/src/components/CertificateDisplayCard/CertificateImageDisplay.tsx +68 -0
- package/src/components/CertificateDisplayCard/CertificateProfileImageDisplay.test.tsx +66 -0
- package/src/components/CertificateDisplayCard/CertificateProfileImageDisplay.tsx +64 -0
- package/src/components/CertificateDisplayCard/CertificateRibbon.tsx +43 -0
- package/src/components/CertificateDisplayCard/InfoBox.tsx +30 -0
- package/src/components/CertificateDisplayCard/MediaAttachmentsBox.tsx +347 -0
- package/src/components/CertificateDisplayCard/TruncateTextBox.tsx +73 -0
- package/src/components/CertificateDisplayCard/VerificationRow.tsx +67 -0
- package/src/components/CertificateDisplayCard/VerificationsBox.tsx +44 -0
- package/src/components/CertificateDisplayCard/VerifierStateBadgeAndText.tsx +100 -0
- package/src/components/CertificateDisplayCard/index.ts +20 -0
- package/src/components/CircleCheckButton/CircleCheckButton.stories.tsx +21 -0
- package/src/components/CircleCheckButton/CircleCheckButton.tsx +28 -0
- package/src/components/CircleCheckButton/index.ts +5 -0
- package/src/components/CircleIcon/CircleIcon.tsx +90 -0
- package/src/components/CircleIcon/__tests__/CircleIcon.test.tsx +38 -0
- package/src/components/CircleIcon/ci new +0 -0
- package/src/components/CircleIcon/index.ts +5 -0
- package/src/components/CourseCard/CourseCard.stories.tsx +23 -0
- package/src/components/CourseCard/CourseCard.tsx +94 -0
- package/src/components/CourseCard/index.ts +5 -0
- package/src/components/CourseVerticalCard/CourseVerticalCard.stories.tsx +31 -0
- package/src/components/CourseVerticalCard/CourseVerticalCard.tsx +118 -0
- package/src/components/CourseVerticalCard/index.ts +5 -0
- package/src/components/FlippyCard/FlippyCard.tsx +34 -0
- package/src/components/FlippyCard/__tests__/FlippyCard.test.tsx +41 -0
- package/src/components/FlippyCard/index.ts +5 -0
- package/src/components/GenericCard/GenericCard.stories.tsx +22 -0
- package/src/components/GenericCard/GenericCard.tsx +72 -0
- package/src/components/GenericCard/index.ts +5 -0
- package/src/components/JobHistoryCard/JobHistoryCard.stories.tsx +26 -0
- package/src/components/JobHistoryCard/JobHistoryCard.tsx +44 -0
- package/src/components/JobHistoryCard/index.ts +5 -0
- package/src/components/JobListCard/JobListCard.stories.tsx +54 -0
- package/src/components/JobListCard/JobListCard.tsx +162 -0
- package/src/components/JobListCard/index.ts +5 -0
- package/src/components/LearnCardCreditCardBackFace/LearnCardCreditCardBackFace.stories.tsx +31 -0
- package/src/components/LearnCardCreditCardBackFace/LearnCardCreditCardBackFace.tsx +104 -0
- package/src/components/LearnCardCreditCardBackFace/__tests__/LearnCardCreditCardBackFace.test.tsx +64 -0
- package/src/components/LearnCardCreditCardBackFace/index.ts +6 -0
- package/src/components/LearnCardCreditCardBackFace/types.ts +45 -0
- package/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.stories.tsx +28 -0
- package/src/components/LearnCardCreditCardFrontFace/LearnCardCreditCardFrontFace.tsx +102 -0
- package/src/components/LearnCardCreditCardFrontFace/__tests__/LearnCardCreditCardFrontFace.test.tsx +48 -0
- package/src/components/LearnCardCreditCardFrontFace/index.ts +6 -0
- package/src/components/LearnCardCreditCardFrontFace/types.ts +42 -0
- package/src/components/LearnPill/LearnPill.stories.tsx +20 -0
- package/src/components/LearnPill/LearnPill.tsx +35 -0
- package/src/components/LearnPill/index.ts +5 -0
- package/src/components/Lightbox/Lightbox.tsx +133 -0
- package/src/components/Lightbox/index.ts +5 -0
- package/src/components/Loading/CircleSpinner.tsx +52 -0
- package/src/components/Loading/index.ts +5 -0
- package/src/components/MeritBadgeDisplayCard/AlignmentRow.tsx +26 -0
- package/src/components/MeritBadgeDisplayCard/AlignmentsBox.tsx +70 -0
- package/src/components/MeritBadgeDisplayCard/InfoBox.tsx +30 -0
- package/src/components/MeritBadgeDisplayCard/MediaAttachmentsBox.tsx +347 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeBackFace.tsx +130 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeCornerIcon.tsx +46 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeDisplayCard.tsx +177 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx +292 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeImageDisplay.tsx +22 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeProfileImageDisplay.test.tsx +70 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeProfileImageDisplay.tsx +66 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeRibbon.tsx +185 -0
- package/src/components/MeritBadgeDisplayCard/MeritBadgeSkillsCount.tsx +47 -0
- package/src/components/MeritBadgeDisplayCard/TruncateTextBox.tsx +73 -0
- package/src/components/MeritBadgeDisplayCard/VerificationRow.tsx +67 -0
- package/src/components/MeritBadgeDisplayCard/VerificationsBox.tsx +44 -0
- package/src/components/MeritBadgeDisplayCard/VerifierStateBadgeAndText.tsx +57 -0
- package/src/components/MeritBadgeDisplayCard/index.ts +20 -0
- package/src/components/MiniVCThumbnail/ MiniVCThumbnail.css +18 -0
- package/src/components/MiniVCThumbnail/ MiniVCThumbnail.stories.tsx +24 -0
- package/src/components/MiniVCThumbnail/MiniVCThumbnail.tsx +83 -0
- package/src/components/MiniVCThumbnail/__tests__/MiniVCThumbnail.test.tsx +59 -0
- package/src/components/MiniVCThumbnail/index.ts +6 -0
- package/src/components/MiniVCThumbnail/types.ts +32 -0
- package/src/components/Notification/Notification.stories.tsx +25 -0
- package/src/components/Notification/Notification.tsx +115 -0
- package/src/components/Notification/__tests__/Notification.test.tsx +111 -0
- package/src/components/Notification/index.ts +6 -0
- package/src/components/Notification/types.ts +97 -0
- package/src/components/NotificationBoostCard/NotificationBoostCard.stories.tsx +54 -0
- package/src/components/NotificationBoostCard/NotificationBoostCard.tsx +153 -0
- package/src/components/NotificationBoostCard/index.ts +6 -0
- package/src/components/NotificationBoostCard/types.ts +25 -0
- package/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.stories.tsx +28 -0
- package/src/components/NotificationUserAcceptedBoostCard/NotificationUserAcceptedBoostCard.tsx +96 -0
- package/src/components/NotificationUserAcceptedBoostCard/index.ts +6 -0
- package/src/components/NotificationUserAcceptedBoostCard/types.ts +13 -0
- package/src/components/NotificationUserCard/NotificationUserCard.stories.tsx +26 -0
- package/src/components/NotificationUserCard/NotificationUserCard.tsx +121 -0
- package/src/components/NotificationUserCard/index.ts +6 -0
- package/src/components/NotificationUserCard/types.ts +43 -0
- package/src/components/QRCodeCard/QRCodeCard.stories.tsx +26 -0
- package/src/components/QRCodeCard/QRCodeCard.tsx +54 -0
- package/src/components/QRCodeCard/__tests__/QRCodeCard.test.tsx +31 -0
- package/src/components/QRCodeCard/index.ts +6 -0
- package/src/components/QRCodeCard/types.ts +22 -0
- package/src/components/RoundedPill/RoundedPill.stories.tsx +21 -0
- package/src/components/RoundedPill/RoundedPill.tsx +137 -0
- package/src/components/RoundedPill/index.ts +5 -0
- package/src/components/RoundedSquare/RoundedSquare.stories.tsx +28 -0
- package/src/components/RoundedSquare/RoundedSquare.tsx +69 -0
- package/src/components/RoundedSquare/__tests__/RoundedSquare.test.tsx +35 -0
- package/src/components/RoundedSquare/constants.ts +63 -0
- package/src/components/RoundedSquare/index.ts +6 -0
- package/src/components/RoundedSquare/roudnedquarenew +0 -0
- package/src/components/SchoolIdCard/SchoolIDCard.stories.tsx +30 -0
- package/src/components/SchoolIdCard/SchoolIDCard.tsx +81 -0
- package/src/components/SchoolIdCard/index.ts +6 -0
- package/src/components/SchoolIdCard/types.ts +42 -0
- package/src/components/SkillTabCard/SkillTabCard.stories.tsx +25 -0
- package/src/components/SkillTabCard/SkillTabCard.tsx +44 -0
- package/src/components/SkillTabCard/index.ts +5 -0
- package/src/components/SkillVerticalCard/SkillVerticalCard.stories.tsx +20 -0
- package/src/components/SkillVerticalCard/SkillVerticalCard.tsx +32 -0
- package/src/components/SkillVerticalCard/index.ts +5 -0
- package/src/components/SkillsCard/SkillsCard.stories.tsx +24 -0
- package/src/components/SkillsCard/SkillsCard.tsx +68 -0
- package/src/components/SkillsCard/index.ts +5 -0
- package/src/components/SkillsStatsCard/SkillsStatsCard.stories.tsx +63 -0
- package/src/components/SkillsStatsCard/SkillsStatsCard.tsx +92 -0
- package/src/components/SkillsStatsCard/index.ts +5 -0
- package/src/components/SmallAchievementCard/SmallAchievementCard.stories.tsx +23 -0
- package/src/components/SmallAchievementCard/SmallAchievementCard.tsx +50 -0
- package/src/components/SmallAchievementCard/index.ts +5 -0
- package/src/components/UserProfilePicture/UserProfilePicture.test.tsx +44 -0
- package/src/components/UserProfilePicture/UserProfilePicture.tsx +119 -0
- package/src/components/UserProfilePicture/index.ts +5 -0
- package/src/components/VCCard/VCCard.stories.tsx +64 -0
- package/src/components/VCCard/VCCard.tsx +84 -0
- package/src/components/VCCard/index.ts +5 -0
- package/src/components/VCDisplayBackFace/VCDisplayBackFace.tsx +112 -0
- package/src/components/VCDisplayBackFace/index.ts +5 -0
- package/src/components/VCDisplayCard/VCDisplayCard.stories.tsx +167 -0
- package/src/components/VCDisplayCard/VCDisplayCard.tsx +98 -0
- package/src/components/VCDisplayCard/index.ts +5 -0
- package/src/components/VCDisplayCard2/FitText.tsx +85 -0
- package/src/components/VCDisplayCard2/InfoBox.tsx +30 -0
- package/src/components/VCDisplayCard2/IssueHistoryBox.tsx +50 -0
- package/src/components/VCDisplayCard2/MediaAttachmentsBox.tsx +306 -0
- package/src/components/VCDisplayCard2/RibbonEnd.tsx +67 -0
- package/src/components/VCDisplayCard2/SelectedSkills.tsx +70 -0
- package/src/components/VCDisplayCard2/SkillsBox.tsx +53 -0
- package/src/components/VCDisplayCard2/Subskill.tsx +50 -0
- package/src/components/VCDisplayCard2/TopLevelSkill.tsx +63 -0
- package/src/components/VCDisplayCard2/TruncateTextBox.tsx +89 -0
- package/src/components/VCDisplayCard2/VC2BackFace.tsx +185 -0
- package/src/components/VCDisplayCard2/VC2FrontFaceInfo.tsx +279 -0
- package/src/components/VCDisplayCard2/VCDisplayCard2.stories.tsx +191 -0
- package/src/components/VCDisplayCard2/VCDisplayCard2.tsx +526 -0
- package/src/components/VCDisplayCard2/VCDisplayCard2AvatarFallbacks.stories.tsx +312 -0
- package/src/components/VCDisplayCard2/VCDisplayCardCategoryType.tsx +19 -0
- package/src/components/VCDisplayCard2/VCDisplayCardSkillsCount.tsx +46 -0
- package/src/components/VCDisplayCard2/VCIDDIsplayCard.tsx +159 -0
- package/src/components/VCDisplayCard2/VCIDDisplayFrontFace.tsx +213 -0
- package/src/components/VCDisplayCard2/VerificationRow.tsx +69 -0
- package/src/components/VCDisplayCard2/VerificationsBox.tsx +44 -0
- package/src/components/VCDisplayCard2/__tests__/VC2FrontFaceInfo.test.tsx +134 -0
- package/src/components/VCDisplayCard2/index.ts +23 -0
- package/src/components/VCDisplayFrontFace/VCDisplayFrontFace.tsx +143 -0
- package/src/components/VCDisplayFrontFace/index.ts +5 -0
- package/src/components/VCThumbnail/VCThumbnail.stories.tsx +32 -0
- package/src/components/VCThumbnail/VCThumbnail.tsx +182 -0
- package/src/components/VCThumbnail/__tests__/VCThumbnail.test.tsx +114 -0
- package/src/components/VCThumbnail/index.ts +6 -0
- package/src/components/VCThumbnail/types.ts +46 -0
- package/src/components/VCVerificationCheck/VCVerificationCheck.tsx +89 -0
- package/src/components/VCVerificationCheck/index.ts +5 -0
- package/src/components/VCVerificationPill/VCVerificationPill.tsx +85 -0
- package/src/components/VCVerificationPill/index.ts +5 -0
- package/src/components/index.ts +48 -0
- package/src/components/svgs/AccommodationsIcon.tsx +38 -0
- package/src/components/svgs/AccomplishmentsIcon.tsx +34 -0
- package/src/components/svgs/AchievementWithTitle.tsx +137 -0
- package/src/components/svgs/AcuteCheckmark.tsx +25 -0
- package/src/components/svgs/AwardDisplayIcon.tsx +37 -0
- package/src/components/svgs/AwardRibbon.tsx +29 -0
- package/src/components/svgs/BadgeDisplayIcon.tsx +31 -0
- package/src/components/svgs/Briefcase.tsx +48 -0
- package/src/components/svgs/Camera.tsx +25 -0
- package/src/components/svgs/CertificateDisplayIcon.tsx +56 -0
- package/src/components/svgs/Checkmark.tsx +59 -0
- package/src/components/svgs/CircleWithText.tsx +36 -0
- package/src/components/svgs/Coins.tsx +14 -0
- package/src/components/svgs/CourseDisplayIcon.tsx +43 -0
- package/src/components/svgs/DownRightArrow.tsx +29 -0
- package/src/components/svgs/ExclamationPoint.tsx +25 -0
- package/src/components/svgs/ExperienceIcon.tsx +34 -0
- package/src/components/svgs/FatArrow.tsx +44 -0
- package/src/components/svgs/GenericArrow.tsx +29 -0
- package/src/components/svgs/GenericDocumentIcon.tsx +26 -0
- package/src/components/svgs/Graduation.tsx +24 -0
- package/src/components/svgs/IDDisplayIcon.tsx +63 -0
- package/src/components/svgs/IDIcon.tsx +59 -0
- package/src/components/svgs/IDSleeve.tsx +21 -0
- package/src/components/svgs/InfoIcon.tsx +26 -0
- package/src/components/svgs/IssuerSeal.tsx +26 -0
- package/src/components/svgs/KeyIcon.tsx +31 -0
- package/src/components/svgs/LeftArrow.tsx +27 -0
- package/src/components/svgs/Lightbulb.tsx +14 -0
- package/src/components/svgs/Line.tsx +22 -0
- package/src/components/svgs/LinkIcon.tsx +35 -0
- package/src/components/svgs/PdfIcon.tsx +38 -0
- package/src/components/svgs/PersonBadge.tsx +55 -0
- package/src/components/svgs/PuzzlePiece.tsx +89 -0
- package/src/components/svgs/QRCodeIcon.tsx +21 -0
- package/src/components/svgs/RedFlag.tsx +41 -0
- package/src/components/svgs/RoundedCorner.tsx +28 -0
- package/src/components/svgs/RoundedX.tsx +35 -0
- package/src/components/svgs/ScoutsLogo.tsx +41 -0
- package/src/components/svgs/ScoutsPledge.tsx +33 -0
- package/src/components/svgs/ShieldChevron.tsx +24 -0
- package/src/components/svgs/Smiley.tsx +43 -0
- package/src/components/svgs/SocialBadgesIcon.tsx +43 -0
- package/src/components/svgs/ThreeDotVertical.tsx +41 -0
- package/src/components/svgs/Trophy.tsx +25 -0
- package/src/components/svgs/UnknownVerifierBadge.tsx +25 -0
- package/src/components/svgs/User.tsx +34 -0
- package/src/components/svgs/VerifiedBadge.tsx +37 -0
- package/src/components/svgs/VideoIcon.tsx +28 -0
- package/src/components/svgs/X.tsx +35 -0
- package/src/components/svgs/index.ts +54 -0
- package/src/constants/icons.ts +87 -0
- package/src/constants/index.ts +109 -0
- package/src/constants/notifications.ts +14 -0
- package/src/constants/skills.ts +2202 -0
- package/src/declaration.d.ts +21 -0
- package/src/helpers/__tests__/credentialFormat.helpers.test.ts +100 -0
- package/src/helpers/color.helpers.ts +35 -0
- package/src/helpers/credential.helpers.test.ts +108 -0
- package/src/helpers/credential.helpers.tsx +249 -0
- package/src/helpers/credentialFormat.helpers.ts +68 -0
- package/src/helpers/did-display.helpers.ts +230 -0
- package/src/helpers/display.helpers.ts +53 -0
- package/src/helpers/string.helpers.ts +7 -0
- package/src/helpers/test.helpers.ts +680 -0
- package/src/helpers/url.helpers.ts +3 -0
- package/src/helpers/useHorizontalPages.ts +130 -0
- package/src/helpers/useOnMomentumScrollEnd.ts +28 -0
- package/src/helpers/useScrollBorders.ts +59 -0
- package/src/helpers/video.helpers.ts +125 -0
- package/src/hooks/useCredentialFormat.tsx +23 -0
- package/src/hooks/useParsedSdJwtVc.tsx +64 -0
- package/src/index.ts +16 -0
- package/src/types/index.ts +390 -0
- package/LICENSE +0 -21
- package/dist/cjs/SchoolIDCard-e22d0d80.js.map +0 -1
- package/dist/cjs/VCDisplayCard2-6c87eade.js.map +0 -1
- package/dist/cjs/VerifierStateBadgeAndText-5229da1a.js.map +0 -1
- package/dist/cjs/credential.helpers-473e89c5.js.map +0 -1
- package/dist/cjs/index-0cac2c5b.js.map +0 -1
- package/dist/cjs/types.esm-12bb5eed.js.map +0 -1
- package/dist/esm/SchoolIDCard-8b151cd3.js.map +0 -1
- package/dist/esm/VCDisplayCard2-c6a81e42.js.map +0 -1
- package/dist/esm/VerifierStateBadgeAndText-6946e820.js.map +0 -1
- package/dist/esm/credential.helpers-ff461699.js.map +0 -1
- package/dist/esm/index-2ef835bd.js.map +0 -1
- package/dist/esm/index-eae3ca64.js.map +0 -1
- package/dist/esm/types.esm-f32fc00a.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare module '*.jpeg' {
|
|
2
|
+
const value: any;
|
|
3
|
+
export default value;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module '*.webp' {
|
|
7
|
+
const value: any;
|
|
8
|
+
export default value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module '*.png' {
|
|
12
|
+
const value: any;
|
|
13
|
+
export default value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module '*.svg' {
|
|
17
|
+
const value: any;
|
|
18
|
+
export default value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module 'react-barcode';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { humanizeClaimLabel, formatClaimValue } from '../credentialFormat.helpers';
|
|
2
|
+
|
|
3
|
+
describe('credentialFormat.helpers', () => {
|
|
4
|
+
describe('humanizeClaimLabel', () => {
|
|
5
|
+
it('handles snake_case', () => {
|
|
6
|
+
expect(humanizeClaimLabel('given_name')).toBe('Given Name');
|
|
7
|
+
expect(humanizeClaimLabel('date_of_birth')).toBe('Date Of Birth');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('handles camelCase', () => {
|
|
11
|
+
expect(humanizeClaimLabel('givenName')).toBe('Given Name');
|
|
12
|
+
expect(humanizeClaimLabel('dateOfBirth')).toBe('Date Of Birth');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('handles kebab-case', () => {
|
|
16
|
+
expect(humanizeClaimLabel('given-name')).toBe('Given Name');
|
|
17
|
+
expect(humanizeClaimLabel('date-of-birth')).toBe('Date Of Birth');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('preserves all-caps acronyms', () => {
|
|
21
|
+
expect(humanizeClaimLabel('SSN')).toBe('SSN');
|
|
22
|
+
expect(humanizeClaimLabel('ID')).toBe('ID');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('handles empty string', () => {
|
|
26
|
+
expect(humanizeClaimLabel('')).toBe('');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('formatClaimValue', () => {
|
|
31
|
+
it('handles null and undefined', () => {
|
|
32
|
+
expect(formatClaimValue(null)).toBe('');
|
|
33
|
+
expect(formatClaimValue(undefined)).toBe('');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('handles booleans', () => {
|
|
37
|
+
expect(formatClaimValue(true)).toBe('Yes');
|
|
38
|
+
expect(formatClaimValue(false)).toBe('No');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('handles strings', () => {
|
|
42
|
+
expect(formatClaimValue('hello')).toBe('hello');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('handles full ISO date-time in long form', () => {
|
|
46
|
+
const dateStr = '2023-10-25T12:00:00Z';
|
|
47
|
+
const expected = new Date(dateStr).toLocaleDateString(undefined, {
|
|
48
|
+
year: 'numeric',
|
|
49
|
+
month: 'long',
|
|
50
|
+
day: 'numeric',
|
|
51
|
+
});
|
|
52
|
+
expect(formatClaimValue(dateStr)).toBe(expected);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('handles date-only strings without timezone drift', () => {
|
|
56
|
+
const expected = new Date(Date.UTC(1990, 0, 1)).toLocaleDateString(undefined, {
|
|
57
|
+
year: 'numeric',
|
|
58
|
+
month: 'long',
|
|
59
|
+
day: 'numeric',
|
|
60
|
+
timeZone: 'UTC',
|
|
61
|
+
});
|
|
62
|
+
expect(formatClaimValue('1990-01-01')).toBe(expected);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('handles ancient date-only strings (no TZ rollback)', () => {
|
|
66
|
+
const expected = new Date(Date.UTC(1815, 11, 10)).toLocaleDateString(undefined, {
|
|
67
|
+
year: 'numeric',
|
|
68
|
+
month: 'long',
|
|
69
|
+
day: 'numeric',
|
|
70
|
+
timeZone: 'UTC',
|
|
71
|
+
});
|
|
72
|
+
expect(formatClaimValue('1815-12-10')).toBe(expected);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('handles numbers', () => {
|
|
76
|
+
expect(formatClaimValue(42)).toBe('42');
|
|
77
|
+
expect(formatClaimValue(3.14)).toBe('3.14');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('handles arrays of primitives as comma-separated list', () => {
|
|
81
|
+
expect(formatClaimValue([1, 2, 3])).toBe('1, 2, 3');
|
|
82
|
+
expect(formatClaimValue(['a', 'b'])).toBe('a, b');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('handles arrays of objects with friendly count', () => {
|
|
86
|
+
expect(formatClaimValue([{ a: 1 }, { b: 2 }])).toBe('2 items');
|
|
87
|
+
expect(formatClaimValue([{ a: 1 }])).toBe('1 item');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('handles nested objects with humanized inline labels', () => {
|
|
91
|
+
expect(formatClaimValue({ given_name: 'Ada', family_name: 'Lovelace' })).toBe(
|
|
92
|
+
'Given Name: Ada; Family Name: Lovelace'
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('handles empty object', () => {
|
|
97
|
+
expect(formatClaimValue({})).toBe('');
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WalletCategoryTypes } from '../types';
|
|
2
|
+
|
|
3
|
+
export const getDarkBGColor = (type: WalletCategoryTypes) => {
|
|
4
|
+
if (!type) return '';
|
|
5
|
+
|
|
6
|
+
if (type === WalletCategoryTypes?.achievements) {
|
|
7
|
+
return 'bg-orange-500';
|
|
8
|
+
} else if (type === WalletCategoryTypes?.learningHistory) {
|
|
9
|
+
return 'bg-emerald-500';
|
|
10
|
+
} else if (type === WalletCategoryTypes?.skills) {
|
|
11
|
+
return 'bg-violet-500';
|
|
12
|
+
} else if (type === WalletCategoryTypes?.jobHistory) {
|
|
13
|
+
return 'bg-blue-500';
|
|
14
|
+
} else if (type === WalletCategoryTypes?.socialBadge) {
|
|
15
|
+
return 'bg-cyan-500';
|
|
16
|
+
} else if (type === WalletCategoryTypes?.relationships) {
|
|
17
|
+
return 'bg-pink-500';
|
|
18
|
+
} else if (type === WalletCategoryTypes?.accommodations) {
|
|
19
|
+
return 'bg-amber-500';
|
|
20
|
+
} else if (type === WalletCategoryTypes?.accomplishments) {
|
|
21
|
+
return 'bg-lime-500';
|
|
22
|
+
} else if (type === WalletCategoryTypes?.events) {
|
|
23
|
+
return 'bg-fuchsia-500';
|
|
24
|
+
} else if (type === WalletCategoryTypes?.membership) {
|
|
25
|
+
return 'bg-teal-500';
|
|
26
|
+
} else if (type === WalletCategoryTypes?.goals) {
|
|
27
|
+
return 'bg-rose-500';
|
|
28
|
+
} else if (type === WalletCategoryTypes?.ids) {
|
|
29
|
+
return 'bg-yellow-500';
|
|
30
|
+
} else if (type === WalletCategoryTypes?.currency) {
|
|
31
|
+
return 'bg-cyan-500';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return 'bg-grayscale-900';
|
|
35
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { Image } from '@learncard/types';
|
|
3
|
+
import {
|
|
4
|
+
getImageFromImage,
|
|
5
|
+
getNameFromProfile,
|
|
6
|
+
getImageFromProfile,
|
|
7
|
+
getInfoFromCredential,
|
|
8
|
+
} from './credential.helpers';
|
|
9
|
+
import { JffCredential, VC2CredentialWithValidFrom, VC2CredentialNoDate } from './test.helpers';
|
|
10
|
+
|
|
11
|
+
describe('Credential Helpers', () => {
|
|
12
|
+
describe('getImageFromImage', () => {
|
|
13
|
+
it('correctly gets simple images', () => {
|
|
14
|
+
expect(getImageFromImage('nice')).toEqual('nice');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('correctly gets complex images', () => {
|
|
18
|
+
expect(getImageFromImage({ id: 'nice', type: 'image' })).toEqual('nice');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('returns an empty string if image is missing id', () => {
|
|
22
|
+
expect(getImageFromImage({ type: 'image' } as Image)).toEqual('');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('getNameFromProfile', () => {
|
|
27
|
+
it('correctly gets simple names', () => {
|
|
28
|
+
expect(getNameFromProfile('nice')).toEqual('nice');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('correctly gets complex names', () => {
|
|
32
|
+
expect(getNameFromProfile({ name: 'nice' })).toEqual('nice');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('returns an empty string if profile is missing name', () => {
|
|
36
|
+
expect(getNameFromProfile({ url: 'nice' })).toEqual('');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('getImageFromProfile', () => {
|
|
41
|
+
it('correctly gets simple names', () => {
|
|
42
|
+
expect(getImageFromProfile({ image: 'nice' })).toEqual('nice');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('correctly gets complex names', () => {
|
|
46
|
+
expect(getImageFromProfile({ image: { id: 'nice', type: 'image' } })).toEqual('nice');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('returns an empty string if profile is a string', () => {
|
|
50
|
+
expect(getImageFromProfile('nice')).toEqual('');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('returns an empty string if profile image is missing id', () => {
|
|
54
|
+
expect(getImageFromProfile({ image: { type: 'image' } as Image })).toEqual('');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('getInfoFromCredential', () => {
|
|
59
|
+
it('correctly handles VC 1.0 credentials with issuanceDate', () => {
|
|
60
|
+
const result = getInfoFromCredential(JffCredential as any);
|
|
61
|
+
expect(result.createdAt).toEqual('27 JUL 2022');
|
|
62
|
+
expect(result.title).toEqual('Our Wallet Passed JFF Plugfest #1 2022');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('correctly handles VC 2.0 credentials with validFrom', () => {
|
|
66
|
+
const result = getInfoFromCredential(VC2CredentialWithValidFrom as any);
|
|
67
|
+
expect(result.createdAt).toEqual('15 JAN 2024');
|
|
68
|
+
expect(result.title).toEqual('Advanced TypeScript Development');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('gracefully handles credentials with no date fields', () => {
|
|
72
|
+
const result = getInfoFromCredential(VC2CredentialNoDate as any);
|
|
73
|
+
expect(result.createdAt).toEqual('');
|
|
74
|
+
expect(result.title).toEqual('Lifetime Learning Award');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('prioritizes validFrom over issuanceDate when both exist', () => {
|
|
78
|
+
const credentialWithBothDates = {
|
|
79
|
+
...JffCredential,
|
|
80
|
+
validFrom: '2024-06-01T10:00:00.000Z',
|
|
81
|
+
};
|
|
82
|
+
const result = getInfoFromCredential(credentialWithBothDates as any);
|
|
83
|
+
expect(result.createdAt).toEqual('01 JUN 2024');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('handles invalid date formats gracefully', () => {
|
|
87
|
+
const credentialWithInvalidDate = {
|
|
88
|
+
...JffCredential,
|
|
89
|
+
issuanceDate: 'invalid-date-string',
|
|
90
|
+
};
|
|
91
|
+
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
92
|
+
const result = getInfoFromCredential(credentialWithInvalidDate as any);
|
|
93
|
+
expect(result.createdAt).toEqual('');
|
|
94
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
|
95
|
+
'Invalid date format in credential:',
|
|
96
|
+
'invalid-date-string'
|
|
97
|
+
);
|
|
98
|
+
consoleSpy.mockRestore();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('respects custom date format options', () => {
|
|
102
|
+
const result = getInfoFromCredential(JffCredential as any, 'yyyy-MM-dd', {
|
|
103
|
+
uppercaseDate: false,
|
|
104
|
+
});
|
|
105
|
+
expect(result.createdAt).toEqual('2022-07-27');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { format } from 'date-fns';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Image,
|
|
6
|
+
Profile,
|
|
7
|
+
VC,
|
|
8
|
+
AchievementCredential,
|
|
9
|
+
VerificationStatusEnum,
|
|
10
|
+
} from '@learncard/types';
|
|
11
|
+
import { CredentialInfo, LCCategoryEnum } from '../types';
|
|
12
|
+
|
|
13
|
+
import SocialBadgesIcon from '../components/svgs/SocialBadgesIcon';
|
|
14
|
+
import PuzzlePiece from '../components/svgs/PuzzlePiece';
|
|
15
|
+
import KeyIcon from '../components/svgs/KeyIcon';
|
|
16
|
+
import User from '../components/svgs/User';
|
|
17
|
+
import Trophy from '../components/svgs/Trophy';
|
|
18
|
+
import Graduation from '../components/svgs/Graduation';
|
|
19
|
+
import Briefcase from '../components/svgs/Briefcase';
|
|
20
|
+
import AccommodationsIcon from '../components/svgs/AccommodationsIcon';
|
|
21
|
+
import AccomplishmentsIcon from '../components/svgs/AccomplishmentsIcon';
|
|
22
|
+
import ScoutsLogo from '../components/svgs/ScoutsLogo';
|
|
23
|
+
|
|
24
|
+
export const getImageFromImage = (image: Image): string => {
|
|
25
|
+
if (typeof image === 'string') return image;
|
|
26
|
+
|
|
27
|
+
return image.id ?? '';
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const getNameFromProfile = (profile: Profile): string => {
|
|
31
|
+
if (typeof profile === 'string') return profile;
|
|
32
|
+
|
|
33
|
+
return profile.name || profile.displayName || '';
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const getImageFromProfile = (profile: Profile): string => {
|
|
37
|
+
if (typeof profile === 'string') return '';
|
|
38
|
+
|
|
39
|
+
return getImageFromImage(profile.image ?? '');
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const getInfoFromCredential = (
|
|
43
|
+
credential: VC | AchievementCredential,
|
|
44
|
+
dateFormat: string = 'dd MMM yyyy',
|
|
45
|
+
options: { uppercaseDate?: boolean } = { uppercaseDate: true }
|
|
46
|
+
): CredentialInfo => {
|
|
47
|
+
const { issuer, issuanceDate, validFrom } = credential;
|
|
48
|
+
|
|
49
|
+
const credentialSubject = Array.isArray(credential.credentialSubject)
|
|
50
|
+
? credential.credentialSubject[0]
|
|
51
|
+
: credential.credentialSubject;
|
|
52
|
+
|
|
53
|
+
const title = credentialSubject.achievement?.name;
|
|
54
|
+
const issuee = credentialSubject.id;
|
|
55
|
+
const imageUrl = credentialSubject.achievement?.image;
|
|
56
|
+
|
|
57
|
+
// Support both VC 2.0 (validFrom) and VC 1.0 (issuanceDate)
|
|
58
|
+
// Gracefully handle missing dates
|
|
59
|
+
const dateValue = validFrom || issuanceDate;
|
|
60
|
+
let createdAt = '';
|
|
61
|
+
|
|
62
|
+
if (dateValue) {
|
|
63
|
+
try {
|
|
64
|
+
createdAt = format(new Date(dateValue), dateFormat);
|
|
65
|
+
if (options.uppercaseDate) {
|
|
66
|
+
createdAt = createdAt.toUpperCase();
|
|
67
|
+
}
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.warn('Invalid date format in credential:', dateValue);
|
|
70
|
+
createdAt = '';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return { title, createdAt, issuer, issuee, credentialSubject, imageUrl };
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const getColorForVerificationStatus = (
|
|
78
|
+
status: (typeof VerificationStatusEnum)[keyof typeof VerificationStatusEnum]
|
|
79
|
+
) => {
|
|
80
|
+
switch (status) {
|
|
81
|
+
case VerificationStatusEnum.Success:
|
|
82
|
+
return '#39B54A';
|
|
83
|
+
case VerificationStatusEnum.Failed:
|
|
84
|
+
return '#D01012';
|
|
85
|
+
case VerificationStatusEnum.Error:
|
|
86
|
+
return '#FFBD06';
|
|
87
|
+
default:
|
|
88
|
+
return '#000000';
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const getCategoryColor = (category = LCCategoryEnum.achievement) => {
|
|
93
|
+
switch (category) {
|
|
94
|
+
case LCCategoryEnum.socialBadge:
|
|
95
|
+
return 'blue-600';
|
|
96
|
+
case LCCategoryEnum.skill:
|
|
97
|
+
return 'indigo-600';
|
|
98
|
+
case LCCategoryEnum.achievement:
|
|
99
|
+
return 'pink-600';
|
|
100
|
+
case LCCategoryEnum.learningHistory:
|
|
101
|
+
return 'emerald-700';
|
|
102
|
+
case LCCategoryEnum.id:
|
|
103
|
+
return 'yellow-400';
|
|
104
|
+
case LCCategoryEnum.workHistory:
|
|
105
|
+
return 'blue-400';
|
|
106
|
+
case LCCategoryEnum.job:
|
|
107
|
+
return 'rose-600';
|
|
108
|
+
case LCCategoryEnum.course:
|
|
109
|
+
return 'emerald-700';
|
|
110
|
+
case LCCategoryEnum.currency:
|
|
111
|
+
return 'blue-600';
|
|
112
|
+
case LCCategoryEnum.membership:
|
|
113
|
+
return 'teal-500';
|
|
114
|
+
default:
|
|
115
|
+
return 'spice-600';
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const getCategoryPrimaryColor = (category = LCCategoryEnum.achievement) => {
|
|
120
|
+
switch (category) {
|
|
121
|
+
case LCCategoryEnum.socialBadge:
|
|
122
|
+
return 'blue';
|
|
123
|
+
case LCCategoryEnum.skill:
|
|
124
|
+
return 'indigo';
|
|
125
|
+
case LCCategoryEnum.achievement:
|
|
126
|
+
return 'pink';
|
|
127
|
+
case LCCategoryEnum.learningHistory:
|
|
128
|
+
return 'emerald';
|
|
129
|
+
case LCCategoryEnum.id:
|
|
130
|
+
return 'yellow';
|
|
131
|
+
case LCCategoryEnum.workHistory:
|
|
132
|
+
return 'cyan';
|
|
133
|
+
case LCCategoryEnum.job:
|
|
134
|
+
return 'rose';
|
|
135
|
+
case LCCategoryEnum.course:
|
|
136
|
+
return 'emerald';
|
|
137
|
+
case LCCategoryEnum.currency:
|
|
138
|
+
return 'cyan';
|
|
139
|
+
case LCCategoryEnum.membership:
|
|
140
|
+
return 'teal';
|
|
141
|
+
case LCCategoryEnum.accommodations:
|
|
142
|
+
return 'violet';
|
|
143
|
+
case LCCategoryEnum.accomplishments:
|
|
144
|
+
return 'yellow';
|
|
145
|
+
default:
|
|
146
|
+
return 'spice';
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const getCategoryLightColor = (category = LCCategoryEnum.achievement) => {
|
|
151
|
+
if (category === LCCategoryEnum.meritBadge) {
|
|
152
|
+
return 'sp-purple-base';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return `${getCategoryPrimaryColor(category)}-500`;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const getCategoryDarkColor = (category = LCCategoryEnum.achievement) => {
|
|
159
|
+
if (category === LCCategoryEnum.meritBadge) {
|
|
160
|
+
return 'sp-purple-base';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return `${getCategoryPrimaryColor(category)}-700`;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const getCategoryIcon = (category = LCCategoryEnum.achievement, size: string = '21') => {
|
|
167
|
+
switch (category) {
|
|
168
|
+
case LCCategoryEnum.socialBadge:
|
|
169
|
+
return <SocialBadgesIcon size={size} />;
|
|
170
|
+
case LCCategoryEnum.skill:
|
|
171
|
+
return <PuzzlePiece size={size} />;
|
|
172
|
+
case LCCategoryEnum.achievement:
|
|
173
|
+
return <Trophy size={size} />;
|
|
174
|
+
case LCCategoryEnum.course:
|
|
175
|
+
case LCCategoryEnum.learningHistory:
|
|
176
|
+
return <Graduation size={size} />;
|
|
177
|
+
case LCCategoryEnum.job:
|
|
178
|
+
case LCCategoryEnum.workHistory:
|
|
179
|
+
return <Briefcase size={size} />;
|
|
180
|
+
case LCCategoryEnum.id:
|
|
181
|
+
return <User size={size} />;
|
|
182
|
+
case LCCategoryEnum.membership:
|
|
183
|
+
return <KeyIcon size={size} />;
|
|
184
|
+
case LCCategoryEnum.currency:
|
|
185
|
+
case LCCategoryEnum.accommodations:
|
|
186
|
+
return <AccommodationsIcon size={size} />;
|
|
187
|
+
case LCCategoryEnum.accomplishments:
|
|
188
|
+
return <AccomplishmentsIcon size={size} />;
|
|
189
|
+
case LCCategoryEnum.meritBadge:
|
|
190
|
+
return <ScoutsLogo size={size} />;
|
|
191
|
+
case LCCategoryEnum.currency:
|
|
192
|
+
default:
|
|
193
|
+
console.log('🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥');
|
|
194
|
+
console.log('getCategoryIcon - unhandled category:', category);
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const categorizeSkills = (skills: any) => {
|
|
200
|
+
let categorizedSkills = skills.reduce((acc, obj) => {
|
|
201
|
+
// If the category doesn't exist in the accumulator, create a new array for it
|
|
202
|
+
if (!acc[obj.category]) {
|
|
203
|
+
acc[obj.category] = [];
|
|
204
|
+
acc[obj.category].totalSkills = 0; // Initialize totalSkills count
|
|
205
|
+
acc[obj.category].totalSubskills = 0; // Initialize totalSubskills count
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Check if the skill already exists for this category
|
|
209
|
+
let existingSkill = acc[obj.category].find(skill => skill.skill === obj.skill);
|
|
210
|
+
if (existingSkill) {
|
|
211
|
+
// Update the existing object's subskills
|
|
212
|
+
existingSkill.subskills = [
|
|
213
|
+
...new Set(existingSkill?.subskills?.concat(obj?.subskills)),
|
|
214
|
+
];
|
|
215
|
+
} else {
|
|
216
|
+
// Add a new object to the array for this category
|
|
217
|
+
acc[obj.category].push(obj);
|
|
218
|
+
acc[obj.category].totalSkills++; // Increment totalSkills count
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Calculate total subskills count for this category
|
|
222
|
+
let totalSubskillsCount = acc[obj.category].reduce(
|
|
223
|
+
(total, skill) => total + (skill?.subskills?.length ?? 0),
|
|
224
|
+
0
|
|
225
|
+
);
|
|
226
|
+
acc[obj.category].totalSubskillsCount = totalSubskillsCount;
|
|
227
|
+
|
|
228
|
+
return acc;
|
|
229
|
+
}, {});
|
|
230
|
+
|
|
231
|
+
return categorizedSkills;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export const getTotalCountOfSkills = (
|
|
235
|
+
skills: { skill: string; category: string; subSkills: string[] }[]
|
|
236
|
+
) => {
|
|
237
|
+
if (!skills || skills.length === 0) return 0;
|
|
238
|
+
let totalCount = 0;
|
|
239
|
+
|
|
240
|
+
skills?.forEach(skill => {
|
|
241
|
+
totalCount++; // Increment for each skill
|
|
242
|
+
|
|
243
|
+
if (skill?.subSkills) {
|
|
244
|
+
totalCount += skill?.subSkills.length; // Increment for each subskill
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
return totalCount;
|
|
249
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export const humanizeClaimLabel = (key: string): string => {
|
|
2
|
+
if (!key) return '';
|
|
3
|
+
|
|
4
|
+
// Preserve acronyms if all-caps
|
|
5
|
+
if (/^[A-Z]+$/.test(key)) {
|
|
6
|
+
return key;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Convert snake_case and kebab-case to space-separated
|
|
10
|
+
let humanized = key.replace(/[_-]/g, ' ');
|
|
11
|
+
|
|
12
|
+
// Convert camelCase to space-separated
|
|
13
|
+
humanized = humanized.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
14
|
+
|
|
15
|
+
// Capitalize first letter of each word
|
|
16
|
+
return humanized
|
|
17
|
+
.split(' ')
|
|
18
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
19
|
+
.join(' ');
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const LONG_DATE_FORMAT: Intl.DateTimeFormatOptions = {
|
|
23
|
+
year: 'numeric',
|
|
24
|
+
month: 'long',
|
|
25
|
+
day: 'numeric',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const formatClaimValue = (value: unknown): string => {
|
|
29
|
+
if (value === null || value === undefined) {
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (typeof value === 'boolean') {
|
|
34
|
+
return value ? 'Yes' : 'No';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof value === 'string') {
|
|
38
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
39
|
+
const [y, m, d] = value.split('-').map(Number);
|
|
40
|
+
const date = new Date(Date.UTC(y, m - 1, d));
|
|
41
|
+
if (!isNaN(date.getTime())) {
|
|
42
|
+
return date.toLocaleDateString(undefined, { ...LONG_DATE_FORMAT, timeZone: 'UTC' });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (/^\d{4}-\d{2}-\d{2}T/.test(value)) {
|
|
46
|
+
const date = new Date(value);
|
|
47
|
+
if (!isNaN(date.getTime())) {
|
|
48
|
+
return date.toLocaleDateString(undefined, LONG_DATE_FORMAT);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (typeof value === 'object') {
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
const allPrimitive = value.every(v => v === null || typeof v !== 'object');
|
|
57
|
+
if (allPrimitive) return value.map(formatClaimValue).filter(Boolean).join(', ');
|
|
58
|
+
return value.length === 1 ? '1 item' : `${value.length} items`;
|
|
59
|
+
}
|
|
60
|
+
const entries = Object.entries(value as Record<string, unknown>);
|
|
61
|
+
if (entries.length === 0) return '';
|
|
62
|
+
return entries
|
|
63
|
+
.map(([k, v]) => `${humanizeClaimLabel(k)}: ${formatClaimValue(v)}`)
|
|
64
|
+
.join('; ');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return String(value);
|
|
68
|
+
};
|