@learncard/react 2.6.57 → 2.6.59

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.
Files changed (152) hide show
  1. package/dist/cjs/{AchievementCard-6e875eff.js → AchievementCard-a52e4f25.js} +3 -3
  2. package/dist/cjs/{AchievementCard-6e875eff.js.map → AchievementCard-a52e4f25.js.map} +1 -1
  3. package/dist/cjs/{BoostGenericCard-78173946.js → BoostGenericCard-7426cbea.js} +2 -2
  4. package/dist/cjs/{BoostGenericCard-78173946.js.map → BoostGenericCard-7426cbea.js.map} +1 -1
  5. package/dist/cjs/{BoostSmallCard-a18bc6b0.js → BoostSmallCard-0b3a3dd8.js} +2 -2
  6. package/dist/cjs/{BoostSmallCard-a18bc6b0.js.map → BoostSmallCard-0b3a3dd8.js.map} +1 -1
  7. package/dist/cjs/{CertificateDisplayCard-405573a7.js → CertificateDisplayCard-d93af598.js} +1885 -18
  8. package/dist/cjs/CertificateDisplayCard-d93af598.js.map +1 -0
  9. package/dist/cjs/{CircleCheckButton-533f6909.js → CircleCheckButton-abff235d.js} +2 -2
  10. package/dist/cjs/{CircleCheckButton-533f6909.js.map → CircleCheckButton-abff235d.js.map} +1 -1
  11. package/dist/cjs/{CircleIcon-4b16b093.js → CircleIcon-dace003c.js} +2 -2
  12. package/dist/cjs/{CircleIcon-4b16b093.js.map → CircleIcon-dace003c.js.map} +1 -1
  13. package/dist/cjs/{CourseVerticalCard-192f2b04.js → CourseVerticalCard-2958d043.js} +3 -3
  14. package/dist/cjs/{CourseVerticalCard-192f2b04.js.map → CourseVerticalCard-2958d043.js.map} +1 -1
  15. package/dist/cjs/{GenericCard-3805a866.js → GenericCard-6f8770f5.js} +2 -2
  16. package/dist/cjs/{GenericCard-3805a866.js.map → GenericCard-6f8770f5.js.map} +1 -1
  17. package/dist/cjs/{RoundedPill-e30b61f8.js → RoundedPill-4bce9068.js} +2 -2
  18. package/dist/cjs/{RoundedPill-e30b61f8.js.map → RoundedPill-4bce9068.js.map} +1 -1
  19. package/dist/cjs/{RoundedSquare-71308a4a.js → RoundedSquare-caa49231.js} +3 -3
  20. package/dist/cjs/{RoundedSquare-71308a4a.js.map → RoundedSquare-caa49231.js.map} +1 -1
  21. package/dist/cjs/{SkillTabCard-16609965.js → SkillTabCard-2be1570e.js} +3 -3
  22. package/dist/cjs/{SkillTabCard-16609965.js.map → SkillTabCard-2be1570e.js.map} +1 -1
  23. package/dist/cjs/{VCCard-397ba465.js → VCCard-a698fb77.js} +4 -4
  24. package/dist/cjs/{VCCard-397ba465.js.map → VCCard-a698fb77.js.map} +1 -1
  25. package/dist/cjs/{VCDisplayBackFace-3cc78d41.js → VCDisplayBackFace-91668901.js} +2 -2
  26. package/dist/cjs/{VCDisplayBackFace-3cc78d41.js.map → VCDisplayBackFace-91668901.js.map} +1 -1
  27. package/dist/cjs/{VCDisplayCard-0f7226d7.js → VCDisplayCard-d5fcddb7.js} +3 -3
  28. package/dist/cjs/{VCDisplayCard-0f7226d7.js.map → VCDisplayCard-d5fcddb7.js.map} +1 -1
  29. package/dist/cjs/VCDisplayCard2-f99e286c.js +835 -0
  30. package/dist/cjs/VCDisplayCard2-f99e286c.js.map +1 -0
  31. package/dist/cjs/{credential.helpers-f1087746.js → credential.helpers-a3c3d503.js} +2 -2
  32. package/dist/cjs/{credential.helpers-f1087746.js.map → credential.helpers-a3c3d503.js.map} +1 -1
  33. package/dist/cjs/{icons-9d37a8b8.js → icons-9878f84c.js} +5 -4
  34. package/dist/cjs/icons-9878f84c.js.map +1 -0
  35. package/dist/cjs/idIcon.svg +4 -0
  36. package/dist/cjs/index.js +20 -19
  37. package/dist/cjs/index.js.map +1 -1
  38. package/dist/cjs/index10.js +5 -4
  39. package/dist/cjs/index10.js.map +1 -1
  40. package/dist/cjs/index12.js +5 -4
  41. package/dist/cjs/index12.js.map +1 -1
  42. package/dist/cjs/index13.js +20 -19
  43. package/dist/cjs/index13.js.map +1 -1
  44. package/dist/cjs/index2.js +5 -4
  45. package/dist/cjs/index2.js.map +1 -1
  46. package/dist/cjs/index27.js +3 -2
  47. package/dist/cjs/index27.js.map +1 -1
  48. package/dist/cjs/index28.js +4 -3
  49. package/dist/cjs/index28.js.map +1 -1
  50. package/dist/cjs/index3.js +5 -4
  51. package/dist/cjs/index3.js.map +1 -1
  52. package/dist/cjs/index32.js +5 -4
  53. package/dist/cjs/index32.js.map +1 -1
  54. package/dist/cjs/index36.js +8 -7
  55. package/dist/cjs/index36.js.map +1 -1
  56. package/dist/cjs/index37.js +4 -3
  57. package/dist/cjs/index37.js.map +1 -1
  58. package/dist/cjs/index38.js +5 -4
  59. package/dist/cjs/index38.js.map +1 -1
  60. package/dist/cjs/index39.js +11 -10
  61. package/dist/cjs/index39.js.map +1 -1
  62. package/dist/cjs/index4.js +5 -4
  63. package/dist/cjs/index4.js.map +1 -1
  64. package/dist/cjs/index40.js +2 -1
  65. package/dist/cjs/index40.js.map +1 -1
  66. package/dist/cjs/index6.js +4 -3
  67. package/dist/cjs/index6.js.map +1 -1
  68. package/dist/cjs/index7.js +4 -3
  69. package/dist/cjs/index7.js.map +1 -1
  70. package/dist/cjs/index8.js +3 -2
  71. package/dist/cjs/index8.js.map +1 -1
  72. package/dist/esm/{AchievementCard-33b363b2.js → AchievementCard-e83fb98a.js} +3 -3
  73. package/dist/esm/{AchievementCard-33b363b2.js.map → AchievementCard-e83fb98a.js.map} +1 -1
  74. package/dist/esm/{BoostGenericCard-e60fdb61.js → BoostGenericCard-d691d173.js} +2 -2
  75. package/dist/esm/{BoostGenericCard-e60fdb61.js.map → BoostGenericCard-d691d173.js.map} +1 -1
  76. package/dist/esm/{BoostSmallCard-5c843cd0.js → BoostSmallCard-ece551a1.js} +2 -2
  77. package/dist/esm/{BoostSmallCard-5c843cd0.js.map → BoostSmallCard-ece551a1.js.map} +1 -1
  78. package/dist/esm/{CertificateDisplayCard-e0fb8f15.js → CertificateDisplayCard-5fbb5a9d.js} +1875 -19
  79. package/dist/esm/CertificateDisplayCard-5fbb5a9d.js.map +1 -0
  80. package/dist/esm/{CircleCheckButton-fca4676f.js → CircleCheckButton-aba0f804.js} +2 -2
  81. package/dist/esm/{CircleCheckButton-fca4676f.js.map → CircleCheckButton-aba0f804.js.map} +1 -1
  82. package/dist/esm/{CircleIcon-69ee6f6e.js → CircleIcon-b45511e1.js} +2 -2
  83. package/dist/esm/{CircleIcon-69ee6f6e.js.map → CircleIcon-b45511e1.js.map} +1 -1
  84. package/dist/esm/{CourseVerticalCard-78de56d0.js → CourseVerticalCard-da219627.js} +3 -3
  85. package/dist/esm/{CourseVerticalCard-78de56d0.js.map → CourseVerticalCard-da219627.js.map} +1 -1
  86. package/dist/esm/{GenericCard-dfa82091.js → GenericCard-a4de814a.js} +2 -2
  87. package/dist/esm/{GenericCard-dfa82091.js.map → GenericCard-a4de814a.js.map} +1 -1
  88. package/dist/esm/{RoundedPill-fb5c7ccb.js → RoundedPill-3f27d4ac.js} +2 -2
  89. package/dist/esm/{RoundedPill-fb5c7ccb.js.map → RoundedPill-3f27d4ac.js.map} +1 -1
  90. package/dist/esm/{RoundedSquare-0b89fe31.js → RoundedSquare-80a5d236.js} +3 -3
  91. package/dist/esm/{RoundedSquare-0b89fe31.js.map → RoundedSquare-80a5d236.js.map} +1 -1
  92. package/dist/esm/{SkillTabCard-ddf067a7.js → SkillTabCard-3670457e.js} +3 -3
  93. package/dist/esm/{SkillTabCard-ddf067a7.js.map → SkillTabCard-3670457e.js.map} +1 -1
  94. package/dist/esm/{VCCard-138e9793.js → VCCard-387f2a5d.js} +4 -4
  95. package/dist/esm/{VCCard-138e9793.js.map → VCCard-387f2a5d.js.map} +1 -1
  96. package/dist/esm/{VCDisplayBackFace-07fcf920.js → VCDisplayBackFace-b2024cfb.js} +2 -2
  97. package/dist/esm/{VCDisplayBackFace-07fcf920.js.map → VCDisplayBackFace-b2024cfb.js.map} +1 -1
  98. package/dist/esm/{VCDisplayCard-c7aee3a6.js → VCDisplayCard-69585484.js} +3 -3
  99. package/dist/esm/{VCDisplayCard-c7aee3a6.js.map → VCDisplayCard-69585484.js.map} +1 -1
  100. package/dist/esm/VCDisplayCard2-1af6a4c1.js +828 -0
  101. package/dist/esm/VCDisplayCard2-1af6a4c1.js.map +1 -0
  102. package/dist/esm/{credential.helpers-56ed8ed6.js → credential.helpers-96c9bb51.js} +2 -2
  103. package/dist/esm/{credential.helpers-56ed8ed6.js.map → credential.helpers-96c9bb51.js.map} +1 -1
  104. package/dist/esm/{icons-25993244.js → icons-6ed3416f.js} +4 -3
  105. package/dist/esm/icons-6ed3416f.js.map +1 -0
  106. package/dist/esm/idIcon.svg +4 -0
  107. package/dist/esm/index.js +19 -18
  108. package/dist/esm/index.js.map +1 -1
  109. package/dist/esm/index10.js +5 -4
  110. package/dist/esm/index10.js.map +1 -1
  111. package/dist/esm/index12.js +5 -4
  112. package/dist/esm/index12.js.map +1 -1
  113. package/dist/esm/index13.js +19 -18
  114. package/dist/esm/index13.js.map +1 -1
  115. package/dist/esm/index2.js +5 -4
  116. package/dist/esm/index2.js.map +1 -1
  117. package/dist/esm/index27.js +3 -2
  118. package/dist/esm/index27.js.map +1 -1
  119. package/dist/esm/index28.js +4 -3
  120. package/dist/esm/index28.js.map +1 -1
  121. package/dist/esm/index3.js +5 -4
  122. package/dist/esm/index3.js.map +1 -1
  123. package/dist/esm/index32.js +5 -4
  124. package/dist/esm/index32.js.map +1 -1
  125. package/dist/esm/index36.js +8 -7
  126. package/dist/esm/index36.js.map +1 -1
  127. package/dist/esm/index37.js +4 -3
  128. package/dist/esm/index37.js.map +1 -1
  129. package/dist/esm/index38.js +5 -4
  130. package/dist/esm/index38.js.map +1 -1
  131. package/dist/esm/index39.js +9 -8
  132. package/dist/esm/index39.js.map +1 -1
  133. package/dist/esm/index4.js +5 -4
  134. package/dist/esm/index4.js.map +1 -1
  135. package/dist/esm/index40.js +2 -1
  136. package/dist/esm/index40.js.map +1 -1
  137. package/dist/esm/index6.js +4 -3
  138. package/dist/esm/index6.js.map +1 -1
  139. package/dist/esm/index7.js +4 -3
  140. package/dist/esm/index7.js.map +1 -1
  141. package/dist/esm/index8.js +3 -2
  142. package/dist/esm/index8.js.map +1 -1
  143. package/dist/index.d.ts +3 -0
  144. package/package.json +1 -1
  145. package/dist/cjs/CertificateDisplayCard-405573a7.js.map +0 -1
  146. package/dist/cjs/VCDisplayCard2-594288c0.js +0 -2691
  147. package/dist/cjs/VCDisplayCard2-594288c0.js.map +0 -1
  148. package/dist/cjs/icons-9d37a8b8.js.map +0 -1
  149. package/dist/esm/CertificateDisplayCard-e0fb8f15.js.map +0 -1
  150. package/dist/esm/VCDisplayCard2-c6f9f62e.js +0 -2674
  151. package/dist/esm/VCDisplayCard2-c6f9f62e.js.map +0 -1
  152. package/dist/esm/icons-25993244.js.map +0 -1
@@ -0,0 +1,828 @@
1
+ import React, { useRef, useEffect, useState, useLayoutEffect } from 'react';
2
+ import { h, y } from './index.es-76d64136.js';
3
+ import { a as VCVerificationCheckWithSpinner } from './VCVerificationCheck-80249524.js';
4
+ import DefaultFace from './default-face.jpeg';
5
+ import { g as getColorForVerificationStatus, i as format, f as getNameFromProfile, h as getImageFromProfile, j as getCategoryColor, a as getInfoFromCredential } from './credential.helpers-96c9bb51.js';
6
+ import { g as getBaseUrl, a as VideoIcon, b as Camera, G as GenericDocumentIcon, L as LinkIcon, p as prettyBytes, c as capitalize, X, E as ExclamationPoint, A as AcuteCheckmark, I as InfoIcon, d as SkillsBox, t as truncateWithEllipsis, C as CertificateDisplayCard, V as VCDisplayCardSkillsCount } from './CertificateDisplayCard-5fbb5a9d.js';
7
+ import { L as Lightbox } from './Lightbox-a1aab9ea.js';
8
+ import { a as VerificationStatusEnum } from './VCVerificationPill-1a8e55d1.js';
9
+ import { A as AwardRibbon } from './AwardRibbon-3e682281.js';
10
+ import { a as LCCategoryEnum } from './index-43f63ea7.js';
11
+ import 'react-dom';
12
+ import './athletics.svg';
13
+ import './business.svg';
14
+ import './creative.svg';
15
+ import './digital.svg';
16
+ import './durable.svg';
17
+ import './medical.svg';
18
+ import './social.svg';
19
+ import './stem.svg';
20
+ import './trade.svg';
21
+
22
+ const LeftArrow = ({ className = "", size = "20" }) => {
23
+ return /* @__PURE__ */ React.createElement("svg", {
24
+ width: size,
25
+ height: size,
26
+ viewBox: "0 0 20 20",
27
+ fill: "none",
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ className
30
+ }, /* @__PURE__ */ React.createElement("path", {
31
+ d: "M8.93299 17.942L1.43299 10.442C1.31582 10.3247 1.25 10.1657 1.25 9.99999C1.25 9.83423 1.31582 9.67526 1.43299 9.55802L8.93299 2.05802C9.02041 1.97062 9.13178 1.91111 9.25301 1.887C9.37425 1.8629 9.49991 1.87528 9.61412 1.92258C9.72832 1.96989 9.82593 2.04999 9.89461 2.15277C9.96329 2.25554 9.99995 2.37638 9.99996 2.49999V5.62499H16.25C16.5814 5.62537 16.8991 5.75718 17.1334 5.99152C17.3678 6.22586 17.4996 6.54358 17.5 6.87499V13.125C17.4996 13.4564 17.3678 13.7741 17.1334 14.0085C16.8991 14.2428 16.5814 14.3746 16.25 14.375H9.99996V17.5C9.99995 17.6236 9.96329 17.7444 9.89461 17.8472C9.82593 17.95 9.72832 18.0301 9.61412 18.0774C9.49991 18.1247 9.37425 18.1371 9.25301 18.113C9.13178 18.0889 9.02041 18.0294 8.93299 17.942Z",
32
+ fill: "currentColor"
33
+ }));
34
+ };
35
+
36
+ const RoundedX = ({ className = "" }) => {
37
+ return /* @__PURE__ */ React.createElement("svg", {
38
+ width: "24",
39
+ height: "24",
40
+ viewBox: "0 0 24 24",
41
+ fill: "none",
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ className
44
+ }, /* @__PURE__ */ React.createElement("path", {
45
+ d: "M18.75 5.25L5.25 18.75",
46
+ stroke: "#18224E",
47
+ strokeWidth: "4",
48
+ strokeLinecap: "round",
49
+ strokeLinejoin: "round"
50
+ }), /* @__PURE__ */ React.createElement("path", {
51
+ d: "M18.75 18.75L5.25 5.25",
52
+ stroke: "#18224E",
53
+ strokeWidth: "4",
54
+ strokeLinecap: "round",
55
+ strokeLinejoin: "round"
56
+ }));
57
+ };
58
+
59
+ const FitText = ({
60
+ text,
61
+ width,
62
+ className = "",
63
+ minFontSize = 10,
64
+ maxFontSize = 100
65
+ }) => {
66
+ const textRef = useRef(null);
67
+ let animationFrameId = null;
68
+ const adjustFontSize = () => {
69
+ var _a;
70
+ if (textRef.current) {
71
+ const currentFontSize = parseFloat(window.getComputedStyle(textRef.current).getPropertyValue("font-size"));
72
+ textRef.current.style.whiteSpace = "nowrap";
73
+ const parentWidth = (_a = textRef.current.parentNode) == null ? void 0 : _a.clientWidth;
74
+ const scrollWidth = textRef.current.scrollWidth || textRef.current.offsetWidth;
75
+ if (scrollWidth === 0) {
76
+ if (animationFrameId !== null) {
77
+ cancelAnimationFrame(animationFrameId);
78
+ }
79
+ animationFrameId = requestAnimationFrame(adjustFontSize);
80
+ return;
81
+ }
82
+ const newFontSize = Math.min(Math.max(parentWidth / scrollWidth * currentFontSize, minFontSize), maxFontSize);
83
+ textRef.current.style.fontSize = `${newFontSize}px`;
84
+ textRef.current.style.whiteSpace = newFontSize === minFontSize ? "normal" : "nowrap";
85
+ }
86
+ };
87
+ const handleResize = () => {
88
+ if (animationFrameId !== null) {
89
+ cancelAnimationFrame(animationFrameId);
90
+ }
91
+ animationFrameId = requestAnimationFrame(adjustFontSize);
92
+ };
93
+ useEffect(() => {
94
+ window.addEventListener("resize", handleResize);
95
+ adjustFontSize();
96
+ return () => {
97
+ window.removeEventListener("resize", handleResize);
98
+ if (animationFrameId !== null) {
99
+ cancelAnimationFrame(animationFrameId);
100
+ }
101
+ };
102
+ }, [text]);
103
+ return /* @__PURE__ */ React.createElement("div", {
104
+ style: { width },
105
+ className: `text-center ${className}`
106
+ }, /* @__PURE__ */ React.createElement("span", {
107
+ className: `text-[${minFontSize}px] transition-[font-size] whitespace-nowrap`,
108
+ ref: textRef
109
+ }, text));
110
+ };
111
+
112
+ const InfoBox = ({ text, handleClose, backgroundColor = "#6366F1" }) => {
113
+ const bgColorWithOpacity = `${backgroundColor}1F`;
114
+ return /* @__PURE__ */ React.createElement("div", {
115
+ className: "info-box p-[10px] rounded-[10px] w-full font-poppins text-[12px] leading[18px]",
116
+ style: { backgroundColor: bgColorWithOpacity }
117
+ }, text, " ", /* @__PURE__ */ React.createElement("button", {
118
+ onClick: handleClose,
119
+ className: "text-indigo-500 font-[700] select-none"
120
+ }, "Close"));
121
+ };
122
+
123
+ const IssueHistoryBox = ({
124
+ issueHistory,
125
+ customIssueHistoryComponent
126
+ }) => {
127
+ let renderIssueHistory = issueHistory == null ? void 0 : issueHistory.map((issueItem) => {
128
+ return /* @__PURE__ */ React.createElement("div", {
129
+ className: "flex items-center issue-log-item border-b-[1px] py-[5px] border-grayscale-200 border-solid w-full",
130
+ key: issueItem == null ? void 0 : issueItem.id
131
+ }, /* @__PURE__ */ React.createElement("div", {
132
+ className: "profile-thumb-img vc-issuee-image h-[35px] w-[35px] rounded-full overflow-hidden"
133
+ }, /* @__PURE__ */ React.createElement("img", {
134
+ className: "h-full w-full object-cover select-none",
135
+ src: (issueItem == null ? void 0 : issueItem.thumb) || DefaultFace,
136
+ alt: "profile"
137
+ })), /* @__PURE__ */ React.createElement("div", {
138
+ className: "ml-[9px] flex flex-col justify-center"
139
+ }, /* @__PURE__ */ React.createElement("p", {
140
+ className: "issue-item-name font-montserrat font-semibold text-grayscale-900 text-[14px] "
141
+ }, issueItem == null ? void 0 : issueItem.name), /* @__PURE__ */ React.createElement("p", {
142
+ className: "issue-item-date font-montserrat text-[12px] text-grayscale-600 "
143
+ }, issueItem == null ? void 0 : issueItem.date)));
144
+ });
145
+ return /* @__PURE__ */ React.createElement("div", {
146
+ className: "bg-white flex flex-col items-start gap-[10px] rounded-[20px] shadow-bottom px-[15px] py-[20px] w-full relative"
147
+ }, /* @__PURE__ */ React.createElement("h3", {
148
+ className: "text-[20px] leading-[20px] text-grayscale-900"
149
+ }, "Issue Log"), !customIssueHistoryComponent ? renderIssueHistory : customIssueHistoryComponent);
150
+ };
151
+
152
+ var __async = (__this, __arguments, generator) => {
153
+ return new Promise((resolve, reject) => {
154
+ var fulfilled = (value) => {
155
+ try {
156
+ step(generator.next(value));
157
+ } catch (e) {
158
+ reject(e);
159
+ }
160
+ };
161
+ var rejected = (value) => {
162
+ try {
163
+ step(generator.throw(value));
164
+ } catch (e) {
165
+ reject(e);
166
+ }
167
+ };
168
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
169
+ step((generator = generator.apply(__this, __arguments)).next());
170
+ });
171
+ };
172
+ const defaultGetFileMetadata = (url) => __async(undefined, null, function* () {
173
+ var _a;
174
+ const isFilestack = url.includes("filestack");
175
+ if (!isFilestack)
176
+ return;
177
+ const urlParams = (_a = url.split(".com/")[1]) == null ? void 0 : _a.split("/");
178
+ if (!urlParams)
179
+ return;
180
+ const handle = urlParams[urlParams.length - 1];
181
+ let fetchFailed = false;
182
+ const data = yield fetch(`https://cdn.filestackcontent.com/${handle}/metadata`).then((res) => res.json()).catch(() => fetchFailed = true);
183
+ if (fetchFailed)
184
+ return;
185
+ const fileExtension = data.filename.split(".")[1];
186
+ return {
187
+ fileExtension,
188
+ sizeInBytes: data.size,
189
+ numberOfPages: void 0
190
+ };
191
+ });
192
+ const defaultGetVideoMetadata = (url) => __async(undefined, null, function* () {
193
+ const isYoutube = url.includes("youtube");
194
+ if (!isYoutube)
195
+ return;
196
+ const metadataUrl = `http://youtube.com/oembed?url=${url}&format=json`;
197
+ let fetchFailed = false;
198
+ const metadata = yield fetch(metadataUrl).then((res) => res.json()).catch(() => fetchFailed = true);
199
+ if (fetchFailed)
200
+ return;
201
+ return {
202
+ title: metadata.title,
203
+ imageUrl: metadata.thumbnail_url,
204
+ videoLength: ""
205
+ };
206
+ });
207
+ const MediaAttachmentsBox = ({
208
+ attachments,
209
+ getFileMetadata = defaultGetFileMetadata,
210
+ getVideoMetadata = defaultGetVideoMetadata,
211
+ onMediaAttachmentClick,
212
+ enableLightbox = false
213
+ }) => {
214
+ const [documentMetadata, setDocumentMetadata] = useState({});
215
+ const [videoMetadata, setVideoMetadata] = useState({});
216
+ const mediaAttachments = [];
217
+ const documentsAndLinks = [];
218
+ attachments.forEach((a) => {
219
+ switch (a.type) {
220
+ case "document":
221
+ case "link":
222
+ documentsAndLinks.push(a);
223
+ break;
224
+ case "photo":
225
+ case "video":
226
+ mediaAttachments.push(a);
227
+ break;
228
+ }
229
+ });
230
+ useEffect(() => {
231
+ const getMetadata = (attachments2) => __async(undefined, null, function* () {
232
+ const docMetadata = {};
233
+ const videoMetadata2 = {};
234
+ yield Promise.all(attachments2.map((attachment) => __async(this, null, function* () {
235
+ if (attachment.type === "document") {
236
+ docMetadata[attachment.url] = yield getFileMetadata(attachment.url);
237
+ } else if (attachment.type === "video") {
238
+ videoMetadata2[attachment.url] = yield getVideoMetadata(attachment.url);
239
+ }
240
+ })));
241
+ setVideoMetadata(videoMetadata2);
242
+ setDocumentMetadata(docMetadata);
243
+ });
244
+ const videos = attachments.filter((a) => a.type === "video");
245
+ getMetadata([...documentsAndLinks, ...videos]);
246
+ }, []);
247
+ const [currentLightboxUrl, setCurrentLightboxUrl] = useState(void 0);
248
+ const lightboxItems = mediaAttachments.filter((a) => a.type === "photo" || a.type === "video");
249
+ const handleMediaAttachmentClick = (url, type) => {
250
+ if (type === "photo" || type === "video") {
251
+ setCurrentLightboxUrl(url);
252
+ }
253
+ onMediaAttachmentClick == null ? void 0 : onMediaAttachmentClick(url, type);
254
+ };
255
+ return /* @__PURE__ */ React.createElement("div", {
256
+ className: "media-attachments-box bg-white flex flex-col items-start gap-[10px] rounded-[20px] shadow-bottom px-[15px] py-[20px] w-full"
257
+ }, /* @__PURE__ */ React.createElement("h3", {
258
+ className: "text-[20px] leading-[20px] text-grayscale-900"
259
+ }, "Media Attachments"), mediaAttachments.length > 0 && /* @__PURE__ */ React.createElement("div", {
260
+ className: "flex gap-[5px] justify-between flex-wrap w-full"
261
+ }, enableLightbox && /* @__PURE__ */ React.createElement(Lightbox, {
262
+ items: lightboxItems,
263
+ currentUrl: currentLightboxUrl,
264
+ setCurrentUrl: setCurrentLightboxUrl
265
+ }), mediaAttachments.map((media, index) => {
266
+ var _a, _b;
267
+ let innerContent;
268
+ let title = media.title;
269
+ if (media.type === "video") {
270
+ const metadata = videoMetadata[media.url];
271
+ title = (_a = title || (metadata == null ? void 0 : metadata.title)) != null ? _a : "";
272
+ const baseUrl = getBaseUrl(media.url);
273
+ const iconTop = title || baseUrl;
274
+ innerContent = /* @__PURE__ */ React.createElement("div", {
275
+ className: "absolute top-0 left-0 right-0 bottom-0 bg-cover bg-no-repeat font-poppins text-white text-[12px] font-[400] leading-[17px] flex flex-col justify-end items-start p-[10px] text-left bg-rose-600 rounded-[15px]",
276
+ style: {
277
+ backgroundImage: (metadata == null ? void 0 : metadata.imageUrl) ? `linear-gradient(180deg, rgba(0, 0, 0, 0) 44.20%, rgba(0, 0, 0, 0.6) 69%), url(${(_b = metadata == null ? void 0 : metadata.imageUrl) != null ? _b : ""})` : void 0
278
+ }
279
+ }, !(metadata == null ? void 0 : metadata.imageUrl) && /* @__PURE__ */ React.createElement(VideoIcon, {
280
+ size: "60",
281
+ className: "m-auto"
282
+ }), /* @__PURE__ */ React.createElement("div", {
283
+ className: `absolute ${iconTop ? "top-[10px]" : "bottom-[10px]"} left-[10px] z-10 flex items-center gap-[5px]`
284
+ }, (metadata == null ? void 0 : metadata.imageUrl) && /* @__PURE__ */ React.createElement(VideoIcon, null), (metadata == null ? void 0 : metadata.videoLength) && /* @__PURE__ */ React.createElement("span", {
285
+ className: "leading-[23px]"
286
+ }, metadata.videoLength)), baseUrl && /* @__PURE__ */ React.createElement("span", {
287
+ className: "font-[600]"
288
+ }, baseUrl), title && /* @__PURE__ */ React.createElement("span", {
289
+ className: "line-clamp-2"
290
+ }, title));
291
+ } else {
292
+ innerContent = /* @__PURE__ */ React.createElement("div", {
293
+ className: "absolute top-0 left-0 right-0 bottom-0 h-min"
294
+ }, /* @__PURE__ */ React.createElement("img", {
295
+ className: "rounded-[15px]",
296
+ src: media.url
297
+ }), /* @__PURE__ */ React.createElement(Camera, {
298
+ className: "relative bottom-[30px] left-[10px] z-10"
299
+ }));
300
+ }
301
+ const className = `media-attachment ${media.type} w-[49%] pt-[49%] overflow-hidden relative`;
302
+ if (onMediaAttachmentClick || enableLightbox) {
303
+ return /* @__PURE__ */ React.createElement("button", {
304
+ key: index,
305
+ className,
306
+ onClick: () => handleMediaAttachmentClick(media.url, media.type)
307
+ }, innerContent);
308
+ }
309
+ return /* @__PURE__ */ React.createElement("div", {
310
+ key: index,
311
+ className
312
+ }, innerContent);
313
+ })), documentsAndLinks.length > 0 && /* @__PURE__ */ React.createElement("div", {
314
+ className: "w-full flex flex-col gap-[5px]"
315
+ }, documentsAndLinks.map((docOrLink, index) => {
316
+ var _a;
317
+ const metadata = docOrLink.type === "document" ? documentMetadata[docOrLink.url] : void 0;
318
+ const { fileExtension, sizeInBytes, numberOfPages } = metadata != null ? metadata : {};
319
+ let baseUrl = "";
320
+ if (docOrLink.type === "link") {
321
+ baseUrl = getBaseUrl(docOrLink.url);
322
+ }
323
+ const innerContent = /* @__PURE__ */ React.createElement("div", {
324
+ className: "flex flex-col gap-[5px]"
325
+ }, /* @__PURE__ */ React.createElement("div", {
326
+ className: "flex gap-[5px] items-center"
327
+ }, docOrLink.type === "document" && /* @__PURE__ */ React.createElement(GenericDocumentIcon, {
328
+ className: "shrink-0"
329
+ }), docOrLink.type === "link" && /* @__PURE__ */ React.createElement(LinkIcon, {
330
+ className: "shrink-0"
331
+ }), /* @__PURE__ */ React.createElement("span", {
332
+ className: "text-grayscale-900 font-[400]"
333
+ }, (_a = docOrLink.title) != null ? _a : "No title")), docOrLink.type === "document" && metadata && /* @__PURE__ */ React.createElement("a", {
334
+ href: docOrLink.url,
335
+ target: "_blank",
336
+ rel: "noreferrer",
337
+ className: "text-grayscale-600 font-[600] px-[5px] hover:underline"
338
+ }, fileExtension && /* @__PURE__ */ React.createElement("span", {
339
+ className: "uppercase"
340
+ }, fileExtension), fileExtension && (numberOfPages || sizeInBytes) && " \u2022 ", numberOfPages && /* @__PURE__ */ React.createElement("span", null, numberOfPages, " page", numberOfPages === 1 ? "" : "s"), numberOfPages && sizeInBytes && " \u2022 ", sizeInBytes && /* @__PURE__ */ React.createElement("span", null, prettyBytes(sizeInBytes))), docOrLink.type === "link" && /* @__PURE__ */ React.createElement("a", {
341
+ href: docOrLink.url,
342
+ target: "_blank",
343
+ rel: "noreferrer",
344
+ className: "text-indigo-500 font-[600] px-[5px] hover:underline"
345
+ }, baseUrl));
346
+ const className = `row-attachment ${docOrLink.type} bg-grayscale-100 rounded-[15px] p-[10px] w-full font-poppins text-[12px] leading-[18px] tracking-[-0.33px] text-left`;
347
+ if (onMediaAttachmentClick) {
348
+ return /* @__PURE__ */ React.createElement("button", {
349
+ key: index,
350
+ className,
351
+ onClick: () => handleMediaAttachmentClick(docOrLink.url, docOrLink.type)
352
+ }, innerContent);
353
+ }
354
+ return /* @__PURE__ */ React.createElement("div", {
355
+ key: index,
356
+ className
357
+ }, innerContent);
358
+ })));
359
+ };
360
+
361
+ const RibbonEnd = ({
362
+ side,
363
+ className = "",
364
+ height = "64"
365
+ }) => {
366
+ const halfHeight = parseInt(height) / 2;
367
+ return /* @__PURE__ */ React.createElement("svg", {
368
+ className,
369
+ width: "30",
370
+ height,
371
+ viewBox: `0 0 30 ${height}`,
372
+ fill: "none",
373
+ xmlns: "http://www.w3.org/2000/svg",
374
+ style: { transform: `scaleX(${side === "left" ? "1" : "-1"})` }
375
+ }, /* @__PURE__ */ React.createElement("g", {
376
+ filter: "url(#filter0_d_4620_22659)"
377
+ }, /* @__PURE__ */ React.createElement("path", {
378
+ d: `M0 0H30V${height}H0L6.36364 ${halfHeight}L0 0Z`,
379
+ fill: "white"
380
+ }), /* @__PURE__ */ React.createElement("path", {
381
+ d: `M3.08593 2.5H27.5V${height}H3.08593L8.80922 ${halfHeight}L8.91926 30L8.80922 29.4812L3.08593 2.5Z`,
382
+ stroke: "#EEF2FF",
383
+ strokeWidth: "5"
384
+ })), /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement("filter", {
385
+ id: "filter0_d_4620_22659",
386
+ x: "0",
387
+ y: "0",
388
+ width: "30",
389
+ height,
390
+ filterUnits: "userSpaceOnUse",
391
+ colorInterpolationFilters: "sRGB"
392
+ }, /* @__PURE__ */ React.createElement("feFlood", {
393
+ floodOpacity: "0",
394
+ result: "BackgroundImageFix"
395
+ }), /* @__PURE__ */ React.createElement("feColorMatrix", {
396
+ in: "SourceAlpha",
397
+ type: "matrix",
398
+ values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
399
+ result: "hardAlpha"
400
+ }), /* @__PURE__ */ React.createElement("feOffset", {
401
+ dy: "4"
402
+ }), /* @__PURE__ */ React.createElement("feComposite", {
403
+ in2: "hardAlpha",
404
+ operator: "out"
405
+ }), /* @__PURE__ */ React.createElement("feColorMatrix", {
406
+ type: "matrix",
407
+ values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"
408
+ }), /* @__PURE__ */ React.createElement("feBlend", {
409
+ mode: "normal",
410
+ in2: "BackgroundImageFix",
411
+ result: "effect1_dropShadow_4620_22659"
412
+ }), /* @__PURE__ */ React.createElement("feBlend", {
413
+ mode: "normal",
414
+ in: "SourceGraphic",
415
+ in2: "effect1_dropShadow_4620_22659",
416
+ result: "shape"
417
+ }))));
418
+ };
419
+
420
+ const TruncateTextBox = ({
421
+ headerText,
422
+ headerClassName = "",
423
+ text,
424
+ truncateThreshold = 132,
425
+ children,
426
+ className = "truncate-text-box"
427
+ }) => {
428
+ const needsTruncate = (text == null ? void 0 : text.length) > truncateThreshold;
429
+ const [showFullText, setShowFullText] = useState(false);
430
+ const truncated = needsTruncate && !showFullText;
431
+ const displayText = truncated ? text.substring(0, truncateThreshold) : text;
432
+ return /* @__PURE__ */ React.createElement("div", {
433
+ className: `${className} bg-white flex flex-col items-start gap-[10px] rounded-[20px] shadow-bottom px-[15px] py-[20px] w-full"`
434
+ }, /* @__PURE__ */ React.createElement("h3", {
435
+ className: `${headerClassName} text-[20px] leading-[20px] text-grayscale-900`
436
+ }, headerText), /* @__PURE__ */ React.createElement("p", {
437
+ className: "text-[12px] text-grayscale-700 leading-[18px] font-poppins font-[400] mb-0"
438
+ }, displayText, truncated && /* @__PURE__ */ React.createElement(React.Fragment, null, "...", " ", /* @__PURE__ */ React.createElement("button", {
439
+ className: "text-indigo-500 font-[700]",
440
+ onClick: () => setShowFullText(true)
441
+ }, "More")), needsTruncate && showFullText && /* @__PURE__ */ React.createElement(React.Fragment, null, " ", /* @__PURE__ */ React.createElement("button", {
442
+ className: "text-indigo-500 font-[700]",
443
+ onClick: () => setShowFullText(false)
444
+ }, "Close"))), children);
445
+ };
446
+
447
+ const VerificationRow = ({ verification }) => {
448
+ var _a, _b;
449
+ const [showInfo, setShowInfo] = useState(false);
450
+ const statusColor = getColorForVerificationStatus(verification.status);
451
+ const getIcon = () => {
452
+ switch (verification.status) {
453
+ case VerificationStatusEnum.Success:
454
+ return /* @__PURE__ */ React.createElement(AcuteCheckmark, null);
455
+ case VerificationStatusEnum.Error:
456
+ return /* @__PURE__ */ React.createElement(ExclamationPoint, null);
457
+ case VerificationStatusEnum.Failed:
458
+ return /* @__PURE__ */ React.createElement(X, null);
459
+ }
460
+ };
461
+ let primaryText = verification.check ? `${verification.check}: ${verification.message}` : verification.message;
462
+ if (verification.status === VerificationStatusEnum.Failed) {
463
+ primaryText = (_b = (_a = verification.message) != null ? _a : verification.details) != null ? _b : "";
464
+ }
465
+ primaryText = capitalize(primaryText);
466
+ const infoText = "";
467
+ return /* @__PURE__ */ React.createElement("div", {
468
+ className: "verification-row flex flex-col gap-[5px] font-poppins border-b-[1px] border-grayscale-200 border-solid w-full py-[10px] last:border-0 last:pb-0"
469
+ }, /* @__PURE__ */ React.createElement("span", {
470
+ className: "font-[700] text-[11px] leading-[16px] uppercase flex items-center gap-[3px] select-none",
471
+ style: { color: statusColor }
472
+ }, getIcon(), verification.status, infoText ), showInfo && infoText && /* @__PURE__ */ React.createElement(InfoBox, {
473
+ text: infoText,
474
+ handleClose: () => setShowInfo(false),
475
+ backgroundColor: statusColor
476
+ }), /* @__PURE__ */ React.createElement("span", {
477
+ className: "font-[400] text-[14px] leading-[21px] text-grayscale-900"
478
+ }, primaryText));
479
+ };
480
+
481
+ const VerificationsBox = ({ verificationItems }) => {
482
+ const [showInfo, setShowInfo] = useState(false);
483
+ return /* @__PURE__ */ React.createElement("div", {
484
+ className: "verifications-box bg-white flex flex-col items-start gap-[10px] rounded-[20px] shadow-bottom px-[15px] py-[20px] w-full relative"
485
+ }, /* @__PURE__ */ React.createElement("h3", {
486
+ className: "text-[20px] leading-[20px] text-grayscale-900"
487
+ }, "Credential Verifications"), /* @__PURE__ */ React.createElement("button", {
488
+ className: "absolute top-[17px] right-[17px]",
489
+ onClick: () => setShowInfo(!showInfo)
490
+ }, /* @__PURE__ */ React.createElement(InfoIcon, {
491
+ color: showInfo ? "#6366F1" : void 0
492
+ })), showInfo && /* @__PURE__ */ React.createElement(InfoBox, {
493
+ text: "Credential verifications check the cryptographic proof of digital credentials to ensure their authenticity and accuracy.",
494
+ handleClose: () => setShowInfo(false)
495
+ }), verificationItems.map((verification, index) => /* @__PURE__ */ React.createElement(VerificationRow, {
496
+ key: index,
497
+ verification
498
+ })));
499
+ };
500
+
501
+ const VC2BackFace = ({
502
+ credential,
503
+ verificationItems,
504
+ getFileMetadata,
505
+ getVideoMetadata,
506
+ onMediaAttachmentClick,
507
+ issueHistory,
508
+ showBackButton,
509
+ showFrontFace,
510
+ customDescription,
511
+ customCriteria,
512
+ customSkillsComponent,
513
+ customIssueHistoryComponent,
514
+ enableLightbox
515
+ }) => {
516
+ var _a, _b, _c, _d;
517
+ const expiration = credential.expirationDate ? format(new Date(credential.expirationDate), "MMM dd, yyyy") : void 0;
518
+ const isExpired = credential.expirationDate && Number(new Date(credential.expirationDate)) < Number(new Date());
519
+ const achievement = "achievement" in credential.credentialSubject ? credential.credentialSubject.achievement : void 0;
520
+ const criteria = (_a = achievement == null ? void 0 : achievement.criteria) == null ? void 0 : _a.narrative;
521
+ const description = achievement == null ? void 0 : achievement.description;
522
+ return /* @__PURE__ */ React.createElement("section", {
523
+ className: "vc-back-face flex flex-col gap-[20px] w-full px-[15px]"
524
+ }, showBackButton && /* @__PURE__ */ React.createElement("div", {
525
+ className: "w-full"
526
+ }, /* @__PURE__ */ React.createElement("button", {
527
+ className: "vc-card-back-button rounded-full h-[50px] px-[15px] flex items-center justify-center gap-[5px] z-50 text-[30px] text-white select-none",
528
+ onClick: showFrontFace
529
+ }, /* @__PURE__ */ React.createElement(LeftArrow, {
530
+ className: "text-white",
531
+ size: "25"
532
+ }), "Details")), customDescription && /* @__PURE__ */ React.createElement(TruncateTextBox, {
533
+ headerText: "About",
534
+ text: description,
535
+ className: "description-box"
536
+ }, customDescription), !customDescription && (description || expiration) && /* @__PURE__ */ React.createElement(TruncateTextBox, {
537
+ headerText: "About",
538
+ text: description,
539
+ className: "description-box"
540
+ }, expiration && /* @__PURE__ */ React.createElement("p", {
541
+ className: "text-grayscale-800 font-poppins font-[600] text-[12px] leading-[18px] mb-0"
542
+ }, "Expire", isExpired ? "d" : "s", " on ", expiration)), customCriteria && /* @__PURE__ */ React.createElement(TruncateTextBox, {
543
+ headerText: "Criteria",
544
+ text: description,
545
+ className: "description-box"
546
+ }, customCriteria), !customCriteria && criteria && /* @__PURE__ */ React.createElement(TruncateTextBox, {
547
+ headerText: "Criteria",
548
+ text: criteria,
549
+ className: "criteria-box"
550
+ }), ((_c = (_b = credential.skills) == null ? void 0 : _b.length) != null ? _c : 0) > 0 && (customSkillsComponent ? customSkillsComponent : /* @__PURE__ */ React.createElement(SkillsBox, {
551
+ skills: (_d = credential.skills) != null ? _d : []
552
+ })), issueHistory && (issueHistory == null ? void 0 : issueHistory.length) > 0 && /* @__PURE__ */ React.createElement(IssueHistoryBox, {
553
+ issueHistory,
554
+ customIssueHistoryComponent
555
+ }), credential.attachments && credential.attachments.length > 0 && /* @__PURE__ */ React.createElement(MediaAttachmentsBox, {
556
+ attachments: credential.attachments,
557
+ getFileMetadata,
558
+ getVideoMetadata,
559
+ onMediaAttachmentClick,
560
+ enableLightbox
561
+ }), verificationItems && verificationItems.length > 0 && /* @__PURE__ */ React.createElement(VerificationsBox, {
562
+ verificationItems
563
+ }));
564
+ };
565
+
566
+ const VC2FrontFaceInfo = ({
567
+ issuee,
568
+ issuer,
569
+ subjectDID,
570
+ subjectImageComponent,
571
+ issuerImageComponent,
572
+ customBodyCardComponent,
573
+ createdAt,
574
+ imageUrl,
575
+ customThumbComponent
576
+ }) => {
577
+ const issuerName = truncateWithEllipsis(getNameFromProfile(issuer != null ? issuer : ""), 25);
578
+ const issueeName = truncateWithEllipsis(getNameFromProfile(issuee != null ? issuee : ""), 25);
579
+ const issuerImage = getImageFromProfile(issuer != null ? issuer : "");
580
+ const issueeImage = getImageFromProfile(issuee != null ? issuee : "");
581
+ const getImageElement = (imageUrl2, alt, overrideComponent) => {
582
+ if (overrideComponent)
583
+ return overrideComponent;
584
+ return /* @__PURE__ */ React.createElement("img", {
585
+ className: "h-full w-full object-cover select-none",
586
+ src: imageUrl2 || DefaultFace,
587
+ alt
588
+ });
589
+ };
590
+ const issueeImageEl = getImageElement(issueeImage, "Issuee image", subjectImageComponent);
591
+ const issuerImageEl = getImageElement(issuerImage, "Issuer image", issuerImageComponent);
592
+ return /* @__PURE__ */ React.createElement("section", {
593
+ className: "vc-front-face w-full px-[15px] flex flex-col items-center gap-[15px]"
594
+ }, imageUrl && !customThumbComponent && /* @__PURE__ */ React.createElement("img", {
595
+ className: "vc-front-image h-[130px] w-[130px] rounded-[10px]",
596
+ src: imageUrl
597
+ }), customThumbComponent && customThumbComponent, /* @__PURE__ */ React.createElement("div", {
598
+ className: "vc-issue-info-box bg-white flex flex-col items-center gap-[5px] rounded-[20px] shadow-bottom px-[15px] py-[20px] w-full"
599
+ }, customBodyCardComponent && customBodyCardComponent, !customBodyCardComponent && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h3", {
600
+ className: "text-[27px] flex flex-col text-center leading-[130%] text-grayscale-900 capitalize"
601
+ }, issueeName, subjectDID && /* @__PURE__ */ React.createElement("span", {
602
+ className: "text-[12px] text-grayscale-700 leading-[18px] font-poppins font-[400] m-0 p-0 normal-case"
603
+ }, subjectDID)), /* @__PURE__ */ React.createElement("div", {
604
+ className: "relative"
605
+ }, /* @__PURE__ */ React.createElement("div", {
606
+ className: "vc-issuee-image h-[60px] w-[60px] rounded-full overflow-hidden"
607
+ }, issueeImageEl), /* @__PURE__ */ React.createElement("div", {
608
+ className: "vc-issuer-image h-[30px] w-[30px] rounded-full overflow-hidden absolute bottom-[-12px] right-[-12px]"
609
+ }, issuerImageEl)), /* @__PURE__ */ React.createElement("div", {
610
+ className: "vc-issue-details mt-[10px] flex flex-col items-center font-montserrat text-[14px] leading-[20px]"
611
+ }, /* @__PURE__ */ React.createElement("span", {
612
+ className: "created-at text-grayscale-700"
613
+ }, createdAt), /* @__PURE__ */ React.createElement("span", {
614
+ className: "issued-by text-grayscale-900 font-[500]"
615
+ }, "by ", /* @__PURE__ */ React.createElement("strong", {
616
+ className: "font-[700]"
617
+ }, issuerName))))));
618
+ };
619
+
620
+ const VCDisplayCardCategoryType = ({
621
+ categoryType = LCCategoryEnum.achievement
622
+ }) => {
623
+ const categoryColor = getCategoryColor(categoryType);
624
+ return /* @__PURE__ */ React.createElement("span", {
625
+ className: `uppercase font-poppins text-[12px] font-[600] leading-[12px] select-none text-${categoryColor}`
626
+ }, categoryType);
627
+ };
628
+
629
+ const VCDisplayCard2 = ({
630
+ categoryType,
631
+ credential,
632
+ verificationItems,
633
+ issueeOverride,
634
+ issuerOverride,
635
+ subjectDID,
636
+ subjectImageComponent,
637
+ issuerImageComponent,
638
+ verificationInProgress = false,
639
+ handleXClick,
640
+ getFileMetadata,
641
+ getVideoMetadata,
642
+ onMediaAttachmentClick,
643
+ bottomRightIcon,
644
+ customFooterComponent,
645
+ customBodyCardComponent,
646
+ customThumbComponent,
647
+ customCriteria,
648
+ customDescription,
649
+ customIssueHistoryComponent,
650
+ issueHistory,
651
+ titleOverride,
652
+ showBackButton = true,
653
+ enableLightbox,
654
+ customRibbonCategoryComponent,
655
+ customFrontButton,
656
+ trustedAppRegistry,
657
+ hideIssueDate,
658
+ onDotsClick,
659
+ customSkillsComponent
660
+ }) => {
661
+ var _a, _b, _c, _d, _e, _f;
662
+ console.log("credential", credential);
663
+ const {
664
+ title = "",
665
+ createdAt,
666
+ issuer: _issuer = "",
667
+ issuee: _issuee = "",
668
+ imageUrl
669
+ } = getInfoFromCredential(credential, "MMM dd, yyyy");
670
+ const issuee = issueeOverride || _issuee;
671
+ const issuer = issuerOverride || _issuer;
672
+ const [isFront, setIsFront] = useState(true);
673
+ const [headerHeight, setHeaderHeight] = useState(100);
674
+ const [headerWidth, setHeaderWidth] = useState(0);
675
+ const headerRef = useRef(null);
676
+ useLayoutEffect(() => {
677
+ setTimeout(() => {
678
+ var _a2, _b2, _c2, _d2;
679
+ setHeaderHeight((_b2 = (_a2 = headerRef.current) == null ? void 0 : _a2.clientHeight) != null ? _b2 : 100);
680
+ setHeaderWidth((_d2 = (_c2 = headerRef.current) == null ? void 0 : _c2.clientWidth) != null ? _d2 : 0);
681
+ }, 10);
682
+ });
683
+ let worstVerificationStatus = verificationItems.reduce((currentWorst, verification) => {
684
+ switch (currentWorst) {
685
+ case VerificationStatusEnum.Success:
686
+ return verification.status;
687
+ case VerificationStatusEnum.Error:
688
+ return verification.status === VerificationStatusEnum.Failed ? verification.status : currentWorst;
689
+ case VerificationStatusEnum.Failed:
690
+ return currentWorst;
691
+ }
692
+ }, VerificationStatusEnum.Success);
693
+ const statusColor = getColorForVerificationStatus(worstVerificationStatus);
694
+ const backgroundStyle = {
695
+ backgroundColor: (_a = credential == null ? void 0 : credential.display) == null ? void 0 : _a.backgroundColor,
696
+ backgroundImage: ((_b = credential == null ? void 0 : credential.display) == null ? void 0 : _b.backgroundImage) ? `linear-gradient(to bottom, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.25)), url(${(_c = credential.display) == null ? void 0 : _c.backgroundImage})` : void 0,
697
+ backgroundSize: "cover",
698
+ backgroundPosition: "center",
699
+ backgroundAttachment: "fixed"
700
+ };
701
+ const _title = titleOverride || title;
702
+ if (((_d = credential == null ? void 0 : credential.display) == null ? void 0 : _d.displayType) === "certificate") {
703
+ return /* @__PURE__ */ React.createElement(CertificateDisplayCard, {
704
+ credential,
705
+ categoryType,
706
+ issueeOverride: issuee,
707
+ issuerOverride: issuer,
708
+ verificationItems,
709
+ getFileMetadata,
710
+ getVideoMetadata,
711
+ onMediaAttachmentClick,
712
+ enableLightbox,
713
+ trustedAppRegistry,
714
+ handleXClick,
715
+ subjectImageComponent,
716
+ issuerImageComponent,
717
+ customBodyCardComponent,
718
+ hideIssueDate,
719
+ onDotsClick
720
+ });
721
+ }
722
+ return /* @__PURE__ */ React.createElement(h, {
723
+ className: "w-full",
724
+ flipKey: isFront
725
+ }, /* @__PURE__ */ React.createElement(y, {
726
+ flipId: "card"
727
+ }, /* @__PURE__ */ React.createElement("section", {
728
+ className: "vc-display-card font-mouse flex flex-col items-center border-solid border-[5px] border-white rounded-[30px] overflow-visible z-10 min-h-[800px] max-w-[400px] relative bg-white shadow-3xl"
729
+ }, /* @__PURE__ */ React.createElement(RibbonEnd, {
730
+ side: "left",
731
+ className: "absolute left-[-30px] top-[50px] z-0",
732
+ height: "100"
733
+ }), /* @__PURE__ */ React.createElement(RibbonEnd, {
734
+ side: "right",
735
+ className: "absolute right-[-30px] top-[50px] z-0",
736
+ height: "100"
737
+ }), /* @__PURE__ */ React.createElement("h1", {
738
+ ref: headerRef,
739
+ className: "vc-card-header px-[20px] pb-[10px] pt-[3px] overflow-visible mt-[40px] absolute text-center bg-white border-y-[5px] border-[#EEF2FF] shadow-bottom w-[calc(100%_+_16px)] rounded-t-[8px] z-50",
740
+ style: { wordBreak: "break-word" }
741
+ }, customRibbonCategoryComponent && customRibbonCategoryComponent, !customRibbonCategoryComponent && /* @__PURE__ */ React.createElement(VCDisplayCardCategoryType, {
742
+ categoryType
743
+ }), /* @__PURE__ */ React.createElement(FitText, {
744
+ text: _title != null ? _title : "",
745
+ maxFontSize: 32,
746
+ minFontSize: 20,
747
+ width: ((headerWidth != null ? headerWidth : 290) - 40).toString(),
748
+ className: "vc-card-header-main-title text-[#18224E] leading-[100%] text-shadow text-[32px]"
749
+ })), isFront && handleXClick && /* @__PURE__ */ React.createElement("button", {
750
+ className: "vc-card-x-button absolute top-[-25px] bg-white rounded-full h-[50px] w-[50px] flex items-center justify-center z-50",
751
+ onClick: handleXClick
752
+ }, /* @__PURE__ */ React.createElement(RoundedX, null)), /* @__PURE__ */ React.createElement("div", {
753
+ className: "relative pt-[114px] vc-card-content-container flex flex-col items-center grow basis-0 min-h-0 h-full w-full rounded-t-[30px] bg-[#353E64] rounded-b-[200px]",
754
+ style: backgroundStyle
755
+ }, /* @__PURE__ */ React.createElement(y, {
756
+ flipId: "scroll-container"
757
+ }, /* @__PURE__ */ React.createElement("div", {
758
+ className: "vc-card-content-scroll-container w-full pt-[20px] min-h-full flex flex-col justify-start items-center rounded-t-[30px] rounded-b-[200px] overflow-y-auto scrollbar-hide pb-[50px]"
759
+ }, isFront && /* @__PURE__ */ React.createElement(y, {
760
+ flipId: "face"
761
+ }, /* @__PURE__ */ React.createElement(VC2FrontFaceInfo, {
762
+ issuee,
763
+ subjectDID,
764
+ issuer,
765
+ title,
766
+ subjectImageComponent,
767
+ issuerImageComponent,
768
+ customBodyCardComponent,
769
+ customThumbComponent,
770
+ createdAt: createdAt != null ? createdAt : "",
771
+ imageUrl
772
+ })), !isFront && /* @__PURE__ */ React.createElement(y, {
773
+ flipId: "face"
774
+ }, /* @__PURE__ */ React.createElement(VC2BackFace, {
775
+ credential,
776
+ verificationItems,
777
+ issueHistory,
778
+ getFileMetadata,
779
+ getVideoMetadata,
780
+ onMediaAttachmentClick,
781
+ showBackButton,
782
+ showFrontFace: () => setIsFront(true),
783
+ customDescription,
784
+ customCriteria,
785
+ customIssueHistoryComponent,
786
+ enableLightbox,
787
+ customSkillsComponent
788
+ })), /* @__PURE__ */ React.createElement(VCDisplayCardSkillsCount, {
789
+ skills: credential == null ? void 0 : credential.skills,
790
+ onClick: () => setIsFront(!isFront)
791
+ }), isFront && customFrontButton, isFront && !customFrontButton && /* @__PURE__ */ React.createElement(y, {
792
+ flipId: "details-back-button"
793
+ }, /* @__PURE__ */ React.createElement("button", {
794
+ type: "button",
795
+ className: "vc-toggle-side-button text-white shadow-bottom bg-[#00000099] px-[30px] py-[8px] rounded-[40px] text-[28px] tracking-[0.75px] uppercase leading-[28px] mt-[40px] w-fit select-none",
796
+ onClick: () => setIsFront(!isFront)
797
+ }, "Details")), !isFront && /* @__PURE__ */ React.createElement(y, {
798
+ flipId: "details-back-button"
799
+ }, /* @__PURE__ */ React.createElement("button", {
800
+ type: "button",
801
+ className: "vc-toggle-side-button text-white shadow-bottom bg-[#00000099] px-[30px] py-[8px] rounded-[40px] text-[28px] tracking-[0.75px] uppercase leading-[28px] mt-[40px] w-fit select-none",
802
+ onClick: () => setIsFront(!isFront)
803
+ }, /* @__PURE__ */ React.createElement("span", {
804
+ className: "flex gap-[10px] items-center"
805
+ }, /* @__PURE__ */ React.createElement(LeftArrow, null), "Back")))))), /* @__PURE__ */ React.createElement("footer", {
806
+ className: "vc-card-footer w-full flex justify-between p-[5px] mt-[5px]"
807
+ }, customFooterComponent && customFooterComponent, !customFooterComponent && /* @__PURE__ */ React.createElement(React.Fragment, null, worstVerificationStatus === VerificationStatusEnum.Failed ? /* @__PURE__ */ React.createElement("div", {
808
+ className: "w-[40px]",
809
+ role: "presentation"
810
+ }) : /* @__PURE__ */ React.createElement(VCVerificationCheckWithSpinner, {
811
+ spinnerSize: "40px",
812
+ size: "32px",
813
+ loading: verificationInProgress
814
+ }), /* @__PURE__ */ React.createElement("div", {
815
+ className: "vc-footer-text font-montserrat flex flex-col items-center justify-center text-[12px] font-[700] leading-[15px] select-none"
816
+ }, /* @__PURE__ */ React.createElement("span", {
817
+ className: "text-[#4F4F4F]"
818
+ }, "Verified Credential"), /* @__PURE__ */ React.createElement("span", {
819
+ className: "vc-footer-status uppercase",
820
+ style: { color: statusColor }
821
+ }, worstVerificationStatus)), /* @__PURE__ */ React.createElement("div", {
822
+ className: "vc-footer-icon rounded-[20px] h-[40px] w-[40px] flex items-center justify-center overflow-hidden",
823
+ style: { backgroundColor: (_e = bottomRightIcon == null ? void 0 : bottomRightIcon.color) != null ? _e : "#6366F1" }
824
+ }, (_f = bottomRightIcon == null ? void 0 : bottomRightIcon.image) != null ? _f : /* @__PURE__ */ React.createElement(AwardRibbon, null)))))));
825
+ };
826
+
827
+ export { VCDisplayCard2 as V };
828
+ //# sourceMappingURL=VCDisplayCard2-1af6a4c1.js.map