@sphereon/ui-components.credential-branding 0.3.1-unstable.12 → 0.3.1-unstable.13
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.
|
@@ -107,82 +107,67 @@ function findCorrelationIdName(correlationId, parties, activeUser) {
|
|
|
107
107
|
})) === null || _a === void 0 ? void 0 : _a.contact.displayName) !== null && _b !== void 0 ? _b : correlationId);
|
|
108
108
|
}
|
|
109
109
|
var getImageSize = function (image) { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
|
-
var downloadedImage
|
|
111
|
-
return __generator(this, function (
|
|
112
|
-
switch (
|
|
113
|
-
case 0: return [4, (0,
|
|
110
|
+
var downloadedImage;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4, (0, utils_2.isImageAddress)(image)];
|
|
114
114
|
case 1:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (!
|
|
119
|
-
return [4, (0,
|
|
115
|
+
if (!(_a.sent())) {
|
|
116
|
+
return [2];
|
|
117
|
+
}
|
|
118
|
+
if (!(image.startsWith('http://') && !image.startsWith('https://'))) return [3, 3];
|
|
119
|
+
return [4, (0, ssi_sdk_core_1.downloadImage)(image)];
|
|
120
120
|
case 2:
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
downloadedImage = _a.sent();
|
|
122
|
+
if (downloadedImage) {
|
|
123
|
+
return [2, (0, ssi_sdk_core_1.getImageDimensions)(downloadedImage.base64Content)];
|
|
124
|
+
}
|
|
125
|
+
return [3, 4];
|
|
123
126
|
case 3:
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
case 5: return [2, imageSize];
|
|
127
|
+
if (ui_components_core_1.IS_IMAGE_URI_REGEX.test(image)) {
|
|
128
|
+
return [2, (0, ssi_sdk_core_1.getImageDimensions)(image.split('base64,')[1])];
|
|
129
|
+
}
|
|
130
|
+
_a.label = 4;
|
|
131
|
+
case 4: return [2];
|
|
130
132
|
}
|
|
131
133
|
});
|
|
132
134
|
}); };
|
|
133
135
|
var toCredentialDetailsRow = function (_a) {
|
|
134
136
|
var object = _a.object, subject = _a.subject, issuer = _a.issuer;
|
|
135
137
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
136
|
-
var rows, _i, _b, _c, key, value,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
switch (_k.label) {
|
|
138
|
+
var rows, _i, _b, _c, key, value, _d, _e, label, contacts, imageSize, _f;
|
|
139
|
+
return __generator(this, function (_g) {
|
|
140
|
+
switch (_g.label) {
|
|
140
141
|
case 0:
|
|
141
142
|
rows = [];
|
|
142
143
|
if (!object) {
|
|
143
144
|
return [2, rows];
|
|
144
145
|
}
|
|
145
146
|
_i = 0, _b = Object.entries(object);
|
|
146
|
-
|
|
147
|
+
_g.label = 1;
|
|
147
148
|
case 1:
|
|
148
|
-
if (!(_i < _b.length)) return [3,
|
|
149
|
+
if (!(_i < _b.length)) return [3, 9];
|
|
149
150
|
_c = _b[_i], key = _c[0], value = _c[1];
|
|
150
151
|
if (!key) {
|
|
151
|
-
return [3,
|
|
152
|
+
return [3, 8];
|
|
152
153
|
}
|
|
153
|
-
if (!key.toLowerCase().includes('image')) return [3, 3];
|
|
154
|
-
image = typeof value === 'string' ? value : value.id;
|
|
155
|
-
_e = (_d = rows).push;
|
|
156
|
-
_j = {
|
|
157
|
-
id: (0, uuid_1.v4)(),
|
|
158
|
-
label: 'image',
|
|
159
|
-
value: image
|
|
160
|
-
};
|
|
161
|
-
return [4, getImageSize(image)];
|
|
162
|
-
case 2:
|
|
163
|
-
_e.apply(_d, [(_j.imageSize = _k.sent(),
|
|
164
|
-
_j)]);
|
|
165
|
-
return [3, 11];
|
|
166
|
-
case 3:
|
|
167
154
|
if (key === 'type') {
|
|
168
155
|
rows.push({
|
|
169
156
|
id: (0, uuid_1.v4)(),
|
|
170
157
|
label: key,
|
|
171
158
|
value: value
|
|
172
159
|
});
|
|
173
|
-
return [3,
|
|
160
|
+
return [3, 8];
|
|
174
161
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!(typeof value === 'object' && value !== null && value !== undefined)) return [3, 6];
|
|
178
|
-
_g = (_f = rows).concat;
|
|
162
|
+
if (!(typeof value === 'object' && value !== null && value !== undefined)) return [3, 3];
|
|
163
|
+
_e = (_d = rows).concat;
|
|
179
164
|
return [4, toCredentialDetailsRow({ object: value, subject: subject, issuer: issuer })];
|
|
180
|
-
case
|
|
181
|
-
rows =
|
|
182
|
-
return [3,
|
|
183
|
-
case
|
|
165
|
+
case 2:
|
|
166
|
+
rows = _e.apply(_d, [_g.sent()]);
|
|
167
|
+
return [3, 8];
|
|
168
|
+
case 3:
|
|
184
169
|
if (key === '0' || value === undefined || value === null) {
|
|
185
|
-
return [3,
|
|
170
|
+
return [3, 8];
|
|
186
171
|
}
|
|
187
172
|
label = key;
|
|
188
173
|
if (key === 'id' && typeof value === 'string' && value.startsWith('did:')) {
|
|
@@ -193,28 +178,28 @@ var toCredentialDetailsRow = function (_a) {
|
|
|
193
178
|
value = findCorrelationIdName(value, contacts);
|
|
194
179
|
}
|
|
195
180
|
return [4, (0, utils_2.isImageAddress)(value)];
|
|
196
|
-
case
|
|
197
|
-
if (!(
|
|
181
|
+
case 4:
|
|
182
|
+
if (!(_g.sent())) return [3, 6];
|
|
198
183
|
return [4, getImageSize(value)];
|
|
199
|
-
case
|
|
200
|
-
|
|
201
|
-
return [3,
|
|
202
|
-
case
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
case
|
|
206
|
-
imageSize =
|
|
184
|
+
case 5:
|
|
185
|
+
_f = _g.sent();
|
|
186
|
+
return [3, 7];
|
|
187
|
+
case 6:
|
|
188
|
+
_f = undefined;
|
|
189
|
+
_g.label = 7;
|
|
190
|
+
case 7:
|
|
191
|
+
imageSize = _f;
|
|
207
192
|
rows.push({
|
|
208
193
|
id: (0, uuid_1.v4)(),
|
|
209
194
|
label: label,
|
|
210
195
|
value: value,
|
|
211
196
|
imageSize: imageSize
|
|
212
197
|
});
|
|
213
|
-
|
|
214
|
-
case
|
|
198
|
+
_g.label = 8;
|
|
199
|
+
case 8:
|
|
215
200
|
_i++;
|
|
216
201
|
return [3, 1];
|
|
217
|
-
case
|
|
202
|
+
case 9: return [2, rows];
|
|
218
203
|
}
|
|
219
204
|
});
|
|
220
205
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ui-components.credential-branding",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.1-unstable.
|
|
4
|
+
"version": "0.3.1-unstable.13+a83d5f0",
|
|
5
5
|
"description": "SSI UI components credential branding",
|
|
6
6
|
"repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
|
|
7
7
|
"author": "Sphereon <dev@sphereon.com>",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@sphereon/ssi-sdk.core": "0.29.0",
|
|
32
32
|
"@sphereon/ssi-sdk.data-store": "0.29.0",
|
|
33
33
|
"@sphereon/ssi-types": "0.29.0",
|
|
34
|
-
"@sphereon/ui-components.core": "0.3.1-unstable.
|
|
34
|
+
"@sphereon/ui-components.core": "0.3.1-unstable.13+a83d5f0",
|
|
35
35
|
"@veramo/core": "4.2.0",
|
|
36
36
|
"@veramo/utils": "4.2.0",
|
|
37
37
|
"i18n-js": "^3.8.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "a83d5f09209403b80922c098cb599772ea43d3f1"
|
|
55
55
|
}
|