@sphereon/ui-components.credential-branding 0.4.1-unstable.157 → 0.4.1-unstable.160

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 primitiveItems, objectItems, label, _j, objectItems_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,44 @@ 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, 5];
161
+ primitiveItems = value.filter(function (item) { return item !== undefined && item !== null && typeof item !== 'object'; });
162
+ objectItems = value.filter(function (item) { return typeof item === 'object' && item !== null; });
163
+ 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;
164
+ if (primitiveItems.length > 0) {
165
+ rows.push({
166
+ id: (0, uuid_1.v4)(),
167
+ label: label,
168
+ value: primitiveItems.map(function (item) { return "- ".concat(item); }).join('\n')
169
+ });
170
+ }
171
+ if (!(objectItems.length > 0)) return [3, 4];
172
+ _j = 0, objectItems_1 = objectItems;
173
+ _q.label = 1;
163
174
  case 1:
164
- rows = _h.apply(_g, [_k.sent()]);
165
- return [3, 7];
175
+ if (!(_j < objectItems_1.length)) return [3, 4];
176
+ item = objectItems_1[_j];
177
+ _l = (_k = rows).concat;
178
+ return [4, (0, exports.toCredentialDetailsRow)({ object: item, subject: subject, issuer: issuer, branding: branding, parentKey: parentKey ? "".concat(parentKey, ".").concat(key) : key })];
166
179
  case 2:
180
+ rows = _l.apply(_k, [_q.sent()]);
181
+ _q.label = 3;
182
+ case 3:
183
+ _j++;
184
+ return [3, 1];
185
+ case 4: return [3, 12];
186
+ case 5:
187
+ if (!(typeof value === 'object' && value !== null && value !== undefined)) return [3, 7];
188
+ _o = (_m = rows).concat;
189
+ return [4, (0, exports.toCredentialDetailsRow)({ object: value, subject: subject, issuer: issuer, branding: branding, parentKey: parentKey ? "".concat(parentKey, ".").concat(key) : key })];
190
+ case 6:
191
+ rows = _o.apply(_m, [_q.sent()]);
192
+ return [3, 12];
193
+ case 7:
167
194
  if (key === '0' || value === undefined || value === null) {
168
195
  return [2, "continue"];
169
196
  }
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;
197
+ 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
198
  if (key === 'id' && typeof value === 'string' && value.startsWith('did:')) {
172
199
  label = 'subject';
173
200
  }
@@ -176,37 +203,37 @@ var toCredentialDetailsRow = function (args) { return __awaiter(void 0, void 0,
176
203
  value = findCorrelationIdName(value, contacts);
177
204
  }
178
205
  return [4, (0, utils_2.isImageAddress)(value)];
179
- case 3:
180
- if (!(_k.sent())) return [3, 5];
206
+ case 8:
207
+ if (!(_q.sent())) return [3, 10];
181
208
  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;
209
+ case 9:
210
+ _p = _q.sent();
211
+ return [3, 11];
212
+ case 10:
213
+ _p = undefined;
214
+ _q.label = 11;
215
+ case 11:
216
+ imageSize = _p;
190
217
  rows.push({
191
218
  id: (0, uuid_1.v4)(),
192
219
  label: label,
193
220
  value: value,
194
221
  imageSize: imageSize
195
222
  });
196
- _k.label = 7;
197
- case 7: return [2];
223
+ _q.label = 12;
224
+ case 12: return [2];
198
225
  }
199
226
  });
200
227
  };
201
228
  _i = 0, _b = Object.entries(object);
202
- _f.label = 1;
229
+ _h.label = 1;
203
230
  case 1:
204
231
  if (!(_i < _b.length)) return [3, 4];
205
232
  _c = _b[_i], key = _c[0], value = _c[1];
206
233
  return [5, _loop_1(key, value)];
207
234
  case 2:
208
- _f.sent();
209
- _f.label = 3;
235
+ _h.sent();
236
+ _h.label = 3;
210
237
  case 3:
211
238
  _i++;
212
239
  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.157+5a78f4b",
4
+ "version": "0.4.1-unstable.160+9a3bad1",
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.157+5a78f4b",
34
+ "@sphereon/ui-components.core": "0.4.1-unstable.160+9a3bad1",
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": "5a78f4b294e94642ee2b642de1ccf268663feb7b"
54
+ "gitHead": "9a3bad1ec0bc88f6102cdbb039cd4a20441144fd"
55
55
  }