@velocitycareerlabs/vc-renderer-sample 1.25.0-dev-build.1dac6d5c5 → 1.25.0-dev-build.1382844eb
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/package.json +3 -3
- package/src/App.tsx +94 -83
- package/src/components/PDFReport/index.tsx +57 -52
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@velocitycareerlabs/vc-renderer-sample",
|
3
|
-
"version": "1.25.0-dev-build.
|
3
|
+
"version": "1.25.0-dev-build.1382844eb",
|
4
4
|
"description": "VC Renderer Sample",
|
5
5
|
"repository": "https://github.com/velocitycareerlabs/packages",
|
6
6
|
"publishConfig": {
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"@types/node": "^16.18.119",
|
21
21
|
"@types/react": "18.3.20",
|
22
22
|
"@types/react-dom": "18.3.5",
|
23
|
-
"@velocitycareerlabs/vc-renderer": "1.25.0-dev-build.
|
23
|
+
"@velocitycareerlabs/vc-renderer": "1.25.0-dev-build.1382844eb",
|
24
24
|
"react": "18.3.1",
|
25
25
|
"react-dom": "^18.3.1",
|
26
26
|
"react-scripts": "5.0.1",
|
@@ -58,5 +58,5 @@
|
|
58
58
|
"last 1 safari version"
|
59
59
|
]
|
60
60
|
},
|
61
|
-
"gitHead": "
|
61
|
+
"gitHead": "2a8e1fe4dfcf8d5890dc21fa056f5945648371f4"
|
62
62
|
}
|
package/src/App.tsx
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { useCallback, useState } from 'react';
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
CredentialsSummaryRenderer,
|
4
|
+
CredentialDetailsRenderer,
|
5
|
+
CredentialStatusEnum,
|
6
6
|
} from '@velocitycareerlabs/vc-renderer';
|
7
7
|
import { Typography, Box } from '@mui/material';
|
8
8
|
import { Sidebar } from './components/Sidebar';
|
@@ -10,13 +10,13 @@ import { SummaryFooter } from './components/SummaryFooter';
|
|
10
10
|
import { VcDetailsFooter } from './components/VcDetailsFooter';
|
11
11
|
import { PrintPdfButton } from './components/PrintPdfButton';
|
12
12
|
import {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
PdfPreparedCredential,
|
14
|
+
PdfPreparedCredentials,
|
15
|
+
PdfRawCredential,
|
16
|
+
PdfRawCredentials,
|
17
|
+
PdfPreparedCredentialMissingData,
|
18
|
+
PdfPreparedCredentialsMissingData,
|
19
|
+
PdfRawCredentialsMissingData,
|
20
20
|
} from './components/PDFReport';
|
21
21
|
import {
|
22
22
|
CREDENTIALS,
|
@@ -28,10 +28,12 @@ import {
|
|
28
28
|
import './App.css';
|
29
29
|
|
30
30
|
const App = () => {
|
31
|
-
const [
|
31
|
+
const [credentialsSelected, setcredentialsSelected] = useState<
|
32
|
+
Record<string, boolean>
|
33
|
+
>({});
|
32
34
|
|
33
35
|
const handleSelectMapped = useCallback((vcId?: string) => {
|
34
|
-
|
36
|
+
setcredentialsSelected((prev) => {
|
35
37
|
if (!vcId) return prev;
|
36
38
|
if (prev[vcId]) {
|
37
39
|
delete prev[vcId];
|
@@ -46,209 +48,218 @@ const App = () => {
|
|
46
48
|
return (
|
47
49
|
<div className="App">
|
48
50
|
<Typography variant="h6" pt={8} mb={1}>
|
49
|
-
Using
|
51
|
+
Using prepered credential data
|
50
52
|
</Typography>
|
51
53
|
<Box sx={[styles.demoContainer, styles.containerSize2]}>
|
52
|
-
<
|
54
|
+
<CredentialsSummaryRenderer
|
53
55
|
onClick={(id?: string) => alert(`credential id: ${id}`)}
|
54
|
-
|
55
|
-
|
56
|
-
|
56
|
+
credentialsData={{ credentialsPrepared: CREDENTIALS_MAPPED }}
|
57
|
+
credentialsStatus={STATUS}
|
58
|
+
recentlyAddedCredentials={{ '6703a5192f771a68797aceb1': true }}
|
57
59
|
onSelect={handleSelectMapped}
|
58
|
-
|
60
|
+
credentialsSelected={credentialsSelected}
|
59
61
|
/>
|
60
62
|
</Box>
|
61
63
|
<Typography variant="h6" pt={8} mb={1}>
|
62
|
-
Using
|
64
|
+
Using prepered credential data + Footer
|
63
65
|
</Typography>
|
64
66
|
<Box sx={[styles.demoContainer, styles.containerSize2]}>
|
65
|
-
<
|
67
|
+
<CredentialsSummaryRenderer
|
66
68
|
onClick={(id?: string) => alert(`credential id: ${id}`)}
|
67
|
-
|
68
|
-
|
69
|
+
credentialsData={{ credentialsPrepared: CREDENTIALS_MAPPED }}
|
70
|
+
credentialsStatus={STATUS}
|
69
71
|
onSelect={handleSelectMapped}
|
70
|
-
|
72
|
+
credentialsSelected={credentialsSelected}
|
71
73
|
Footer={SummaryFooter}
|
72
74
|
/>
|
73
75
|
</Box>
|
74
76
|
<Typography variant="h6" pt={8} mb={1}>
|
75
|
-
Using
|
77
|
+
Using prepered credential data + Styles
|
76
78
|
</Typography>
|
77
79
|
<Box sx={[styles.demoContainer, styles.containerSize2]}>
|
78
|
-
<
|
80
|
+
<CredentialsSummaryRenderer
|
79
81
|
onClick={(id?: string) => alert(`credential id: ${id}`)}
|
80
|
-
|
81
|
-
|
82
|
+
credentialsData={{ credentialsPrepared: CREDENTIALS_MAPPED }}
|
83
|
+
credentialsStatus={STATUS}
|
82
84
|
onSelect={handleSelectMapped}
|
83
|
-
|
85
|
+
credentialsSelected={credentialsSelected}
|
84
86
|
style={styles.overriddenStyle}
|
85
87
|
/>
|
86
88
|
</Box>
|
87
89
|
<Typography variant="h6" pt={8}>
|
88
90
|
Using raw data
|
89
91
|
</Typography>
|
90
|
-
<
|
92
|
+
<CredentialsSummaryRenderer
|
91
93
|
onClick={(id?: string) => alert(`credential id: ${id}`)}
|
92
|
-
|
94
|
+
credentialsData={{
|
93
95
|
vcs: CREDENTIALS,
|
94
96
|
descriptors: DESCRIPTORS,
|
95
97
|
issuers: ISSUERS,
|
96
98
|
}}
|
97
|
-
|
99
|
+
credentialsStatus={STATUS}
|
98
100
|
isSelectable={false}
|
99
101
|
/>
|
100
102
|
<Typography variant="h6" pt={8} color="red">
|
101
103
|
Using raw data. Missing Descriptors
|
102
104
|
</Typography>
|
103
|
-
<
|
105
|
+
<CredentialsSummaryRenderer
|
104
106
|
onClick={(id?: string) => alert(`credential id: ${id}`)}
|
105
|
-
|
106
|
-
|
107
|
+
credentialsData={{
|
108
|
+
vcs: CREDENTIALS,
|
109
|
+
descriptors: {},
|
110
|
+
issuers: ISSUERS,
|
111
|
+
}}
|
112
|
+
credentialsStatus={STATUS}
|
107
113
|
isSelectable={false}
|
108
114
|
/>
|
109
115
|
<Typography variant="h6" pt={8} color="red">
|
110
116
|
Using raw data. Missing Issuers
|
111
117
|
</Typography>
|
112
|
-
<
|
118
|
+
<CredentialsSummaryRenderer
|
113
119
|
onClick={(id?: string) => alert(`credential id: ${id}`)}
|
114
|
-
|
115
|
-
|
120
|
+
credentialsData={{
|
121
|
+
vcs: CREDENTIALS,
|
122
|
+
descriptors: DESCRIPTORS,
|
123
|
+
issuers: {},
|
124
|
+
}}
|
125
|
+
credentialsStatus={STATUS}
|
116
126
|
isSelectable={false}
|
117
127
|
/>
|
118
128
|
<Typography variant="h6" pt={8}>
|
119
|
-
Credential Details: Assessments. Using
|
129
|
+
Credential Details: Assessments. Using prepered credential data{' '}
|
120
130
|
</Typography>
|
121
|
-
<
|
131
|
+
<CredentialDetailsRenderer
|
122
132
|
categoryTitle="Assessments"
|
123
|
-
|
124
|
-
|
133
|
+
credentialData={{ credentialPrepared: CREDENTIALS_MAPPED[0] }}
|
134
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
125
135
|
/>
|
126
136
|
|
127
137
|
<Typography variant="h6" pt={8}>
|
128
138
|
Credential Details: Assessments. Using Raw Data{' '}
|
129
139
|
</Typography>
|
130
|
-
<
|
140
|
+
<CredentialDetailsRenderer
|
131
141
|
categoryTitle="Assessments"
|
132
|
-
|
142
|
+
credentialData={{
|
133
143
|
vc: CREDENTIALS[0],
|
134
144
|
descriptor: DESCRIPTORS['AssessmentV1.1'],
|
135
145
|
issuer:
|
136
146
|
ISSUERS['did:ion:EiBMsw27IKRYIdwUOfDeBd0LnWVeG2fPxxJi9L1fvjM20g'],
|
137
147
|
}}
|
138
|
-
|
148
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
139
149
|
/>
|
140
150
|
|
141
151
|
<Typography variant="h6" pt={8}>
|
142
152
|
Credential Details: Assessments. Using Raw Data outside of
|
143
153
|
credentialSubject. Relative to credential root.
|
144
154
|
</Typography>
|
145
|
-
<
|
155
|
+
<CredentialDetailsRenderer
|
146
156
|
categoryTitle="Assessments"
|
147
|
-
|
157
|
+
credentialData={{
|
148
158
|
vc: CREDENTIALS[7],
|
149
159
|
descriptor: DESCRIPTORS['AssessmentV1.1'],
|
150
160
|
issuer:
|
151
161
|
ISSUERS['did:ion:EiBMsw27IKRYIdwUOfDeBd0LnWVeG2fPxxJi9L1fvjM20g'],
|
152
162
|
}}
|
153
|
-
|
163
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
154
164
|
/>
|
155
165
|
|
156
166
|
<Typography variant="h6" pt={8}>
|
157
|
-
Credential Details: Badges & Achievements. Using
|
167
|
+
Credential Details: Badges & Achievements. Using prepered credential
|
168
|
+
data + Footer{' '}
|
158
169
|
</Typography>
|
159
|
-
<
|
170
|
+
<CredentialDetailsRenderer
|
160
171
|
categoryTitle="Badges & Achievements"
|
161
|
-
|
172
|
+
credentialData={{ credentialPrepared: CREDENTIALS_MAPPED[2] }}
|
162
173
|
Footer={VcDetailsFooter}
|
163
|
-
|
174
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
164
175
|
/>
|
165
176
|
|
166
177
|
<Typography variant="h6" pt={8}>
|
167
|
-
Credential Details: Contacts. Using
|
178
|
+
Credential Details: Contacts. Using credentialsPrepared{' '}
|
168
179
|
</Typography>
|
169
|
-
<
|
180
|
+
<CredentialDetailsRenderer
|
170
181
|
categoryTitle="Contacts"
|
171
|
-
|
172
|
-
|
182
|
+
credentialData={{ credentialPrepared: CREDENTIALS_MAPPED[1] }}
|
183
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
173
184
|
/>
|
174
185
|
|
175
186
|
<Typography variant="h6" pt={8}>
|
176
|
-
Credential Details: Contacts. Using
|
187
|
+
Credential Details: Contacts. Using prepered credential data + Footer
|
177
188
|
</Typography>
|
178
|
-
<
|
189
|
+
<CredentialDetailsRenderer
|
179
190
|
categoryTitle="Contacts"
|
180
|
-
|
191
|
+
credentialData={{ credentialPrepared: CREDENTIALS_MAPPED[1] }}
|
181
192
|
Footer={VcDetailsFooter}
|
182
|
-
|
193
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
183
194
|
/>
|
184
195
|
|
185
196
|
<Typography variant="h6" pt={8}>
|
186
197
|
Credential Details: Contacts. Using Raw Data + Footer{' '}
|
187
198
|
</Typography>
|
188
|
-
<
|
199
|
+
<CredentialDetailsRenderer
|
189
200
|
categoryTitle="Contacts"
|
190
|
-
|
201
|
+
credentialData={{
|
191
202
|
vc: CREDENTIALS[1],
|
192
203
|
descriptor: DESCRIPTORS['EmailV1.0'],
|
193
204
|
issuer:
|
194
205
|
ISSUERS['did:ion:EiAehWmpX5mHBuc93SIhPXF8bsEx68G6mPcdIaLNGbozPA'],
|
195
206
|
}}
|
196
207
|
Footer={VcDetailsFooter}
|
197
|
-
|
208
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
198
209
|
/>
|
199
210
|
|
200
211
|
<Typography variant="h6" pt={8}>
|
201
212
|
Credential Details: Contacts. Using Raw Data + style
|
202
213
|
</Typography>
|
203
|
-
<
|
214
|
+
<CredentialDetailsRenderer
|
204
215
|
categoryTitle="Contacts"
|
205
|
-
|
216
|
+
credentialData={{
|
206
217
|
vc: CREDENTIALS[1],
|
207
218
|
descriptor: DESCRIPTORS['EmailV1.0'],
|
208
219
|
issuer:
|
209
220
|
ISSUERS['did:ion:EiAehWmpX5mHBuc93SIhPXF8bsEx68G6mPcdIaLNGbozPA'],
|
210
221
|
}}
|
211
222
|
style={styles.overriddenStyle2}
|
212
|
-
|
223
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
213
224
|
/>
|
214
225
|
|
215
226
|
<Typography variant="h6" pt={8}>
|
216
227
|
Credential Details: Badge. Using Raw Data + Footer{' '}
|
217
228
|
</Typography>
|
218
|
-
<
|
229
|
+
<CredentialDetailsRenderer
|
219
230
|
categoryTitle="Badges & Achievements"
|
220
|
-
|
231
|
+
credentialData={{
|
221
232
|
vc: CREDENTIALS[2],
|
222
233
|
descriptor: DESCRIPTORS.OpenBadgeCredential,
|
223
234
|
issuer:
|
224
235
|
ISSUERS['did:ion:EiBMsw27IKRYIdwUOfDeBd0LnWVeG2fPxxJi9L1fvjM20g'],
|
225
236
|
}}
|
226
237
|
Footer={VcDetailsFooter}
|
227
|
-
|
238
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
228
239
|
/>
|
229
240
|
|
230
241
|
<Typography variant="h6" pt={8}>
|
231
242
|
Credential Details: Employment History. Using Raw Data + Sidebar{' '}
|
232
243
|
</Typography>
|
233
|
-
<
|
244
|
+
<CredentialDetailsRenderer
|
234
245
|
categoryTitle="Employment History"
|
235
|
-
|
246
|
+
credentialData={{
|
236
247
|
vc: CREDENTIALS[3],
|
237
248
|
descriptor: DESCRIPTORS['EmploymentPastV1.1'],
|
238
249
|
issuer:
|
239
250
|
ISSUERS['did:ion:EiBMsw27IKRYIdwUOfDeBd0LnWVeG2fPxxJi9L1fvjM20g'],
|
240
251
|
}}
|
241
252
|
Sidebar={Sidebar}
|
242
|
-
|
253
|
+
credentialStatus={CredentialStatusEnum.VERIFIED}
|
243
254
|
/>
|
244
255
|
|
245
256
|
<Typography variant="h6" pt={8} color="red">
|
246
257
|
Credential Details: Employment History. Using Raw Data. Missing
|
247
258
|
Descriptor{' '}
|
248
259
|
</Typography>
|
249
|
-
<
|
260
|
+
<CredentialDetailsRenderer
|
250
261
|
categoryTitle="Employment History"
|
251
|
-
|
262
|
+
credentialData={{
|
252
263
|
vc: CREDENTIALS[3],
|
253
264
|
descriptor: {},
|
254
265
|
issuer:
|
@@ -259,9 +270,9 @@ const App = () => {
|
|
259
270
|
<Typography variant="h6" pt={8} color="red">
|
260
271
|
Credential Details: Employment History. Using Raw Data. Missing Issuer{' '}
|
261
272
|
</Typography>
|
262
|
-
<
|
273
|
+
<CredentialDetailsRenderer
|
263
274
|
categoryTitle="Employment History"
|
264
|
-
|
275
|
+
credentialData={{
|
265
276
|
vc: CREDENTIALS[3],
|
266
277
|
descriptor: DESCRIPTORS['EmploymentPastV1.1'],
|
267
278
|
issuer:
|
@@ -270,15 +281,15 @@ const App = () => {
|
|
270
281
|
/>
|
271
282
|
|
272
283
|
<Typography variant="h6" pt={8}>
|
273
|
-
Printable. Using
|
284
|
+
Printable. Using prepered credential data
|
274
285
|
</Typography>
|
275
286
|
<Box sx={styles.buttonContainer}>
|
276
287
|
<PrintPdfButton
|
277
|
-
pdfDocument={<
|
288
|
+
pdfDocument={<PdfPreparedCredential />}
|
278
289
|
label="Print Credentail Details"
|
279
290
|
/>
|
280
291
|
<PrintPdfButton
|
281
|
-
pdfDocument={<
|
292
|
+
pdfDocument={<PdfPreparedCredentials />}
|
282
293
|
label="Print Multiple Credentils"
|
283
294
|
/>
|
284
295
|
</Box>
|
@@ -288,11 +299,11 @@ const App = () => {
|
|
288
299
|
</Typography>
|
289
300
|
<Box sx={styles.buttonContainer}>
|
290
301
|
<PrintPdfButton
|
291
|
-
pdfDocument={<
|
302
|
+
pdfDocument={<PdfRawCredential />}
|
292
303
|
label="Print Credentail Details"
|
293
304
|
/>
|
294
305
|
<PrintPdfButton
|
295
|
-
pdfDocument={<
|
306
|
+
pdfDocument={<PdfRawCredentials />}
|
296
307
|
label="Print Multiple Credentils"
|
297
308
|
/>
|
298
309
|
</Box>
|
@@ -302,11 +313,11 @@ const App = () => {
|
|
302
313
|
</Typography>
|
303
314
|
<Box sx={styles.buttonContainer}>
|
304
315
|
<PrintPdfButton
|
305
|
-
pdfDocument={<
|
316
|
+
pdfDocument={<PdfPreparedCredentialMissingData />}
|
306
317
|
label="Print Credentail wo header data"
|
307
318
|
/>
|
308
319
|
<PrintPdfButton
|
309
|
-
pdfDocument={<
|
320
|
+
pdfDocument={<PdfPreparedCredentialsMissingData />}
|
310
321
|
label="Print Multiple Credentails wo header data"
|
311
322
|
/>
|
312
323
|
</Box>
|
@@ -315,7 +326,7 @@ const App = () => {
|
|
315
326
|
Printable. Missing Data Raw
|
316
327
|
</Typography>
|
317
328
|
<PrintPdfButton
|
318
|
-
pdfDocument={<
|
329
|
+
pdfDocument={<PdfRawCredentialsMissingData />}
|
319
330
|
label="Print Credentail missing data"
|
320
331
|
/>
|
321
332
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Document, Text, StyleSheet } from '@react-pdf/renderer';
|
3
|
-
import {
|
3
|
+
import { CredentialRendererPDF } from '@velocitycareerlabs/vc-renderer';
|
4
4
|
import {
|
5
5
|
CREDENTIALS,
|
6
6
|
CREDENTIALS_MAPPED,
|
@@ -28,38 +28,39 @@ const sidebarItems = [
|
|
28
28
|
<Text style={styles.sideBarItem}>In validity period</Text>,
|
29
29
|
];
|
30
30
|
|
31
|
-
export const
|
31
|
+
export const PdfPreparedCredential = () => {
|
32
32
|
return (
|
33
33
|
<Document>
|
34
|
-
<
|
35
|
-
|
34
|
+
<CredentialRendererPDF
|
35
|
+
credentialsData={{ credentialsPrepared: [CREDENTIALS_MAPPED[2]] }}
|
36
36
|
applicantName="John Doe"
|
37
37
|
userName="Jane Doe"
|
38
38
|
appLogo={logo192}
|
39
39
|
categoriesTitle={{
|
40
40
|
[CREDENTIALS_MAPPED[2].summary.id]: 'Badges & Achievements',
|
41
41
|
}}
|
42
|
-
|
42
|
+
credentialsStatus={{
|
43
|
+
[CREDENTIALS_MAPPED[2].summary.id]: 'Revoked' as any,
|
44
|
+
}}
|
43
45
|
sidebarItems={{ [CREDENTIALS_MAPPED[2].summary.id]: sidebarItems }}
|
44
46
|
/>
|
45
47
|
</Document>
|
46
48
|
);
|
47
49
|
};
|
48
50
|
|
49
|
-
export const
|
51
|
+
export const PdfPreparedCredentials = () => {
|
50
52
|
const categoriesTitle = {
|
51
53
|
[CREDENTIALS_MAPPED[2].summary.id]: 'Badges & Achievements',
|
52
54
|
[CREDENTIALS_MAPPED[1].summary.id]: 'Employment History',
|
53
55
|
[CREDENTIALS_MAPPED[0].summary.id]: 'Assessments',
|
54
56
|
};
|
55
|
-
const
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
);
|
57
|
+
const credentialsStatus = CREDENTIALS_MAPPED.reduce<{
|
58
|
+
[key: string]: string;
|
59
|
+
}>((acc, vc) => {
|
60
|
+
const { id } = vc.summary;
|
61
|
+
acc[id] = 'Verified';
|
62
|
+
return acc;
|
63
|
+
}, {});
|
63
64
|
|
64
65
|
const sidebarItemsMapped = CREDENTIALS_MAPPED.reduce<{
|
65
66
|
[key: string]: React.ReactNode[];
|
@@ -71,24 +72,24 @@ export const PdfCredentialsDetailsVcPrepared = () => {
|
|
71
72
|
|
72
73
|
return (
|
73
74
|
<Document>
|
74
|
-
<
|
75
|
-
|
75
|
+
<CredentialRendererPDF
|
76
|
+
credentialsData={{ credentialsPrepared: CREDENTIALS_MAPPED }}
|
76
77
|
applicantName="John Doe"
|
77
78
|
userName="Jane Doe"
|
78
79
|
appLogo={logo192}
|
79
80
|
categoriesTitle={categoriesTitle}
|
80
|
-
|
81
|
+
credentialsStatus={credentialsStatus as any}
|
81
82
|
sidebarItems={sidebarItemsMapped}
|
82
83
|
/>
|
83
84
|
</Document>
|
84
85
|
);
|
85
86
|
};
|
86
87
|
|
87
|
-
export const
|
88
|
+
export const PdfRawCredential = () => {
|
88
89
|
return (
|
89
90
|
<Document>
|
90
|
-
<
|
91
|
-
|
91
|
+
<CredentialRendererPDF
|
92
|
+
credentialsData={{
|
92
93
|
vcs: [CREDENTIALS[0]],
|
93
94
|
descriptors: DESCRIPTORS,
|
94
95
|
issuers: ISSUERS,
|
@@ -97,14 +98,14 @@ export const PdfCredentialDetailsVcRaw = () => {
|
|
97
98
|
userName="Jane Doe"
|
98
99
|
appLogo={logo192}
|
99
100
|
categoriesTitle={{ [CREDENTIALS[0].id]: 'Assessments' }}
|
100
|
-
|
101
|
+
credentialsStatus={{ [CREDENTIALS[0].id]: 'Verified' as any }}
|
101
102
|
sidebarItems={{ [CREDENTIALS[0].id]: sidebarItems }}
|
102
103
|
/>
|
103
104
|
</Document>
|
104
105
|
);
|
105
106
|
};
|
106
107
|
|
107
|
-
export const
|
108
|
+
export const PdfRawCredentials = () => {
|
108
109
|
const categoriesTitle = {
|
109
110
|
[CREDENTIALS[6].id]: 'Contacts',
|
110
111
|
[CREDENTIALS[5].id]: 'Contacts',
|
@@ -114,11 +115,14 @@ export const PdfCredentialsDetailsVcsRaw = () => {
|
|
114
115
|
[CREDENTIALS[1].id]: 'Contacts',
|
115
116
|
[CREDENTIALS[0].id]: 'Assessments',
|
116
117
|
};
|
117
|
-
const
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
const credentialsStatus = CREDENTIALS.reduce<{ [key: string]: string }>(
|
119
|
+
(acc, vc) => {
|
120
|
+
const { id } = vc;
|
121
|
+
acc[id] = 'Verified';
|
122
|
+
return acc;
|
123
|
+
},
|
124
|
+
{}
|
125
|
+
);
|
122
126
|
|
123
127
|
const sidebarItemsMapped = CREDENTIALS.reduce<{
|
124
128
|
[key: string]: React.ReactNode[];
|
@@ -129,8 +133,8 @@ export const PdfCredentialsDetailsVcsRaw = () => {
|
|
129
133
|
}, {});
|
130
134
|
return (
|
131
135
|
<Document>
|
132
|
-
<
|
133
|
-
|
136
|
+
<CredentialRendererPDF
|
137
|
+
credentialsData={{
|
134
138
|
vcs: CREDENTIALS,
|
135
139
|
descriptors: DESCRIPTORS,
|
136
140
|
issuers: ISSUERS,
|
@@ -139,44 +143,45 @@ export const PdfCredentialsDetailsVcsRaw = () => {
|
|
139
143
|
userName="Jane Doe"
|
140
144
|
appLogo={logo192}
|
141
145
|
categoriesTitle={categoriesTitle}
|
142
|
-
|
146
|
+
credentialsStatus={credentialsStatus as any}
|
143
147
|
sidebarItems={sidebarItemsMapped}
|
144
148
|
/>
|
145
149
|
</Document>
|
146
150
|
);
|
147
151
|
};
|
148
152
|
|
149
|
-
export const
|
150
|
-
// Missing sidebarItems, applicantName, userName, appLogo, for some credentials:
|
153
|
+
export const PdfPreparedCredentialMissingData = () => {
|
154
|
+
// Missing sidebarItems, applicantName, userName, appLogo, for some credentials: credentialsStatus and categoriesTitle
|
151
155
|
return (
|
152
156
|
<Document>
|
153
|
-
<
|
154
|
-
|
157
|
+
<CredentialRendererPDF
|
158
|
+
credentialsData={{ credentialsPrepared: [CREDENTIALS_MAPPED[2]] }}
|
155
159
|
applicantName=""
|
156
160
|
userName=""
|
157
161
|
appLogo=""
|
158
162
|
categoriesTitle={{
|
159
163
|
[CREDENTIALS_MAPPED[2].summary.id]: 'Badges & Achievements',
|
160
164
|
}}
|
161
|
-
|
165
|
+
credentialsStatus={{
|
166
|
+
[CREDENTIALS_MAPPED[2].summary.id]: 'Verified' as any,
|
167
|
+
}}
|
162
168
|
/>
|
163
169
|
</Document>
|
164
170
|
);
|
165
171
|
};
|
166
172
|
|
167
|
-
export const
|
173
|
+
export const PdfPreparedCredentialsMissingData = () => {
|
168
174
|
const categoriesTitle = {
|
169
175
|
[CREDENTIALS_MAPPED[2].summary.id]: 'Badges & Achievements',
|
170
176
|
[CREDENTIALS_MAPPED[1].summary.id]: 'Employment History',
|
171
177
|
};
|
172
|
-
const
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
);
|
178
|
+
const credentialsStatus = [CREDENTIALS_MAPPED[1]].reduce<{
|
179
|
+
[key: string]: string;
|
180
|
+
}>((acc, vc) => {
|
181
|
+
const { id } = vc.summary;
|
182
|
+
acc[id] = 'Verified';
|
183
|
+
return acc;
|
184
|
+
}, {});
|
180
185
|
|
181
186
|
const sidebarItemsMapped = [CREDENTIALS_MAPPED[1]].reduce<{
|
182
187
|
[key: string]: React.ReactNode[];
|
@@ -188,20 +193,20 @@ export const PdfCredentialsDetailsVcPreparedMissingData = () => {
|
|
188
193
|
|
189
194
|
return (
|
190
195
|
<Document>
|
191
|
-
<
|
192
|
-
|
196
|
+
<CredentialRendererPDF
|
197
|
+
credentialsData={{ credentialsPrepared: CREDENTIALS_MAPPED }}
|
193
198
|
applicantName=""
|
194
199
|
userName="Jane Doe"
|
195
200
|
appLogo=""
|
196
201
|
categoriesTitle={categoriesTitle}
|
197
|
-
|
202
|
+
credentialsStatus={credentialsStatus as any}
|
198
203
|
sidebarItems={sidebarItemsMapped}
|
199
204
|
/>
|
200
205
|
</Document>
|
201
206
|
);
|
202
207
|
};
|
203
208
|
|
204
|
-
export const
|
209
|
+
export const PdfRawCredentialsMissingData = () => {
|
205
210
|
const categoriesTitle = {
|
206
211
|
[CREDENTIALS[5].id]: 'Contacts',
|
207
212
|
[CREDENTIALS[4].id]: 'Documents',
|
@@ -209,7 +214,7 @@ export const PdfCredentialsDetailsVcsRawMissingData = () => {
|
|
209
214
|
[CREDENTIALS[2].id]: 'Badges & Achievements',
|
210
215
|
[CREDENTIALS[1].id]: 'Contacts',
|
211
216
|
};
|
212
|
-
const
|
217
|
+
const credentialsStatus = [CREDENTIALS[1]].reduce<{ [key: string]: string }>(
|
213
218
|
(acc, vc) => {
|
214
219
|
const { id } = vc;
|
215
220
|
acc[id] = 'Verified';
|
@@ -229,8 +234,8 @@ export const PdfCredentialsDetailsVcsRawMissingData = () => {
|
|
229
234
|
const oneIssuer = ISSUERS[CREDENTIALS[1].issuer.id];
|
230
235
|
return (
|
231
236
|
<Document>
|
232
|
-
<
|
233
|
-
|
237
|
+
<CredentialRendererPDF
|
238
|
+
credentialsData={{
|
234
239
|
vcs: CREDENTIALS,
|
235
240
|
descriptors: DESCRIPTORS,
|
236
241
|
issuers: oneIssuer,
|
@@ -239,7 +244,7 @@ export const PdfCredentialsDetailsVcsRawMissingData = () => {
|
|
239
244
|
userName="Jane Doe"
|
240
245
|
appLogo={logo192}
|
241
246
|
categoriesTitle={categoriesTitle}
|
242
|
-
|
247
|
+
credentialsStatus={credentialsStatus as any}
|
243
248
|
sidebarItems={sidebarItemsMapped}
|
244
249
|
/>
|
245
250
|
</Document>
|