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