@sphereon/ui-components.credential-branding 0.4.1-unstable.158 → 0.4.1-unstable.161

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.
@@ -132,9 +132,9 @@ var getImageSize = function (image) { return __awaiter(void 0, void 0, void 0, f
132
132
  }); };
133
133
  var toCredentialDetailsRow = function (args) { return __awaiter(void 0, void 0, void 0, function () {
134
134
  var object, subject, issuer, branding, _a, parentKey, rows, _loop_1, _i, _b, _c, key, value;
135
- var _d, _e;
136
- return __generator(this, function (_f) {
137
- switch (_f.label) {
135
+ var _d, _e, _f, _g;
136
+ return __generator(this, function (_h) {
137
+ switch (_h.label) {
138
138
  case 0:
139
139
  object = args.object, subject = args.subject, issuer = args.issuer, branding = args.branding, _a = args.parentKey, parentKey = _a === void 0 ? '' : _a;
140
140
  rows = [];
@@ -142,9 +142,9 @@ var toCredentialDetailsRow = function (args) { return __awaiter(void 0, void 0,
142
142
  return [2, rows];
143
143
  }
144
144
  _loop_1 = function (key, value) {
145
- var _g, _h, label, contacts, imageSize, _j;
146
- return __generator(this, function (_k) {
147
- switch (_k.label) {
145
+ var label, items, isFirst, _j, items_1, item, _k, _l, _m, _o, label, contacts, imageSize, _p;
146
+ return __generator(this, function (_q) {
147
+ switch (_q.label) {
148
148
  case 0:
149
149
  if (!key) {
150
150
  return [2, "continue"];
@@ -157,17 +157,47 @@ var toCredentialDetailsRow = function (args) { return __awaiter(void 0, void 0,
157
157
  });
158
158
  return [2, "continue"];
159
159
  }
160
- if (!(typeof value === 'object' && value !== null && value !== undefined)) return [3, 2];
161
- _h = (_g = rows).concat;
162
- return [4, (0, exports.toCredentialDetailsRow)({ object: value, subject: subject, issuer: issuer, branding: branding, parentKey: parentKey ? "".concat(parentKey, ".").concat(key) : key })];
160
+ if (!Array.isArray(value)) return [3, 7];
161
+ label = (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.find(function (claim) { return claim.key === (parentKey ? "".concat(parentKey, ".").concat(key) : key); })) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : key;
162
+ items = value.filter(function (item) { return item !== undefined && item !== null; });
163
+ isFirst = true;
164
+ _j = 0, items_1 = items;
165
+ _q.label = 1;
163
166
  case 1:
164
- rows = _h.apply(_g, [_k.sent()]);
165
- return [3, 7];
167
+ if (!(_j < items_1.length)) return [3, 6];
168
+ item = items_1[_j];
169
+ if (!(typeof item === 'object')) return [3, 3];
170
+ _l = (_k = rows).concat;
171
+ return [4, (0, exports.toCredentialDetailsRow)({ object: item, subject: subject, issuer: issuer, branding: branding, parentKey: parentKey ? "".concat(parentKey, ".").concat(key) : key })];
166
172
  case 2:
173
+ rows = _l.apply(_k, [_q.sent()]);
174
+ return [3, 4];
175
+ case 3:
176
+ rows.push({
177
+ id: (0, uuid_1.v4)(),
178
+ label: isFirst ? label : '',
179
+ value: "- ".concat(item)
180
+ });
181
+ _q.label = 4;
182
+ case 4:
183
+ isFirst = false;
184
+ _q.label = 5;
185
+ case 5:
186
+ _j++;
187
+ return [3, 1];
188
+ case 6: return [3, 14];
189
+ case 7:
190
+ if (!(typeof value === 'object' && value !== null && value !== undefined)) return [3, 9];
191
+ _o = (_m = rows).concat;
192
+ return [4, (0, exports.toCredentialDetailsRow)({ object: value, subject: subject, issuer: issuer, branding: branding, parentKey: parentKey ? "".concat(parentKey, ".").concat(key) : key })];
193
+ case 8:
194
+ rows = _o.apply(_m, [_q.sent()]);
195
+ return [3, 14];
196
+ case 9:
167
197
  if (key === '0' || value === undefined || value === null) {
168
198
  return [2, "continue"];
169
199
  }
170
- label = (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.find(function (claim) { return claim.key === (parentKey ? "".concat(parentKey, ".").concat(key) : key); })) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : key;
200
+ label = (_g = (_f = branding === null || branding === void 0 ? void 0 : branding.find(function (claim) { return claim.key === (parentKey ? "".concat(parentKey, ".").concat(key) : key); })) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : key;
171
201
  if (key === 'id' && typeof value === 'string' && value.startsWith('did:')) {
172
202
  label = 'subject';
173
203
  }
@@ -176,37 +206,37 @@ var toCredentialDetailsRow = function (args) { return __awaiter(void 0, void 0,
176
206
  value = findCorrelationIdName(value, contacts);
177
207
  }
178
208
  return [4, (0, utils_2.isImageAddress)(value)];
179
- case 3:
180
- if (!(_k.sent())) return [3, 5];
209
+ case 10:
210
+ if (!(_q.sent())) return [3, 12];
181
211
  return [4, getImageSize(value)];
182
- case 4:
183
- _j = _k.sent();
184
- return [3, 6];
185
- case 5:
186
- _j = undefined;
187
- _k.label = 6;
188
- case 6:
189
- imageSize = _j;
212
+ case 11:
213
+ _p = _q.sent();
214
+ return [3, 13];
215
+ case 12:
216
+ _p = undefined;
217
+ _q.label = 13;
218
+ case 13:
219
+ imageSize = _p;
190
220
  rows.push({
191
221
  id: (0, uuid_1.v4)(),
192
222
  label: label,
193
223
  value: value,
194
224
  imageSize: imageSize
195
225
  });
196
- _k.label = 7;
197
- case 7: return [2];
226
+ _q.label = 14;
227
+ case 14: return [2];
198
228
  }
199
229
  });
200
230
  };
201
231
  _i = 0, _b = Object.entries(object);
202
- _f.label = 1;
232
+ _h.label = 1;
203
233
  case 1:
204
234
  if (!(_i < _b.length)) return [3, 4];
205
235
  _c = _b[_i], key = _c[0], value = _c[1];
206
236
  return [5, _loop_1(key, value)];
207
237
  case 2:
208
- _f.sent();
209
- _f.label = 3;
238
+ _h.sent();
239
+ _h.label = 3;
210
240
  case 3:
211
241
  _i++;
212
242
  return [3, 1];
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.4.1-unstable.158+2ea744b",
4
+ "version": "0.4.1-unstable.161+ee5b24d",
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.34.1-feature.SSISDK.45.94",
32
32
  "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.45.94",
33
33
  "@sphereon/ssi-types": "0.34.1-feature.SSISDK.45.94",
34
- "@sphereon/ui-components.core": "0.4.1-unstable.158+2ea744b",
34
+ "@sphereon/ui-components.core": "0.4.1-unstable.161+ee5b24d",
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.2"
53
53
  },
54
- "gitHead": "2ea744b590935165982ce48a99b9513b6a44e291"
54
+ "gitHead": "ee5b24d61e75955da6e2e4e43572807db7c4aa40"
55
55
  }