@sphereon/ui-components.credential-branding 0.4.1-unstable.167 → 0.4.1-unstable.169

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.
@@ -73,8 +73,8 @@ const getImageSize = async (image) => {
73
73
  }
74
74
  };
75
75
  const toCredentialDetailsRow = async (args) => {
76
- var _a, _b, _c, _d;
77
- const { object, subject, issuer, branding, parentKey = '' } = args;
76
+ var _a, _b, _c, _d, _e, _f;
77
+ const { object, subject, issuer, branding, parentKey = '', depth = 0 } = args;
78
78
  let rows = [];
79
79
  if (!object) {
80
80
  return rows;
@@ -105,6 +105,7 @@ const toCredentialDetailsRow = async (args) => {
105
105
  id: (0, uuid_1.v4)(),
106
106
  label: key,
107
107
  value: value,
108
+ depth,
108
109
  });
109
110
  continue;
110
111
  }
@@ -118,20 +119,28 @@ const toCredentialDetailsRow = async (args) => {
118
119
  id: (0, uuid_1.v4)(),
119
120
  label,
120
121
  value: primitiveItems.length === 1 ? primitiveItems[0] : primitiveItems,
122
+ depth,
121
123
  });
122
124
  }
123
125
  for (const item of objectItems) {
124
- rows = rows.concat(await (0, exports.toCredentialDetailsRow)({ object: item, subject, issuer, branding, parentKey: parentKey ? `${parentKey}.${key}` : key }));
126
+ rows = rows.concat(await (0, exports.toCredentialDetailsRow)({ object: item, subject, issuer, branding, parentKey: parentKey ? `${parentKey}.${key}` : key, depth: depth + 1 }));
125
127
  }
126
128
  }
127
129
  else if (typeof value === 'object' && value !== null && value !== undefined) {
128
- rows = rows.concat(await (0, exports.toCredentialDetailsRow)({ object: value, subject, issuer, branding, parentKey: parentKey ? `${parentKey}.${key}` : key }));
130
+ const label = (_d = (_c = branding === null || branding === void 0 ? void 0 : branding.find(claim => claim.key === (parentKey ? `${parentKey}.${key}` : key))) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : key;
131
+ rows.push({
132
+ id: (0, uuid_1.v4)(),
133
+ label,
134
+ value: undefined,
135
+ depth,
136
+ });
137
+ rows = rows.concat(await (0, exports.toCredentialDetailsRow)({ object: value, subject, issuer, branding, parentKey: parentKey ? `${parentKey}.${key}` : key, depth: depth + 1 }));
129
138
  }
130
139
  else {
131
140
  if (key === '0' || value === undefined || value === null) {
132
141
  continue;
133
142
  }
134
- let label = (_d = (_c = branding === null || branding === void 0 ? void 0 : branding.find(claim => claim.key === (parentKey ? `${parentKey}.${key}` : key))) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : key;
143
+ let label = (_f = (_e = branding === null || branding === void 0 ? void 0 : branding.find(claim => claim.key === (parentKey ? `${parentKey}.${key}` : key))) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : key;
135
144
  if (key === 'id' && typeof value === 'string' && value.startsWith('did:')) {
136
145
  label = 'subject';
137
146
  }
@@ -144,6 +153,7 @@ const toCredentialDetailsRow = async (args) => {
144
153
  id: (0, uuid_1.v4)(),
145
154
  label,
146
155
  value,
156
+ depth,
147
157
  imageSize,
148
158
  });
149
159
  }
@@ -262,10 +272,12 @@ const toCredentialSummary = async (args) => {
262
272
  };
263
273
  exports.toCredentialSummary = toCredentialSummary;
264
274
  const selectAppLocaleBranding = async (args) => {
265
- var _a, _b, _c, _d, _e, _f, _g;
275
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
266
276
  const appLocale = ui_components_core_1.Localization.getLocale();
267
- const localeBranding = (_a = args.localeBranding) === null || _a === void 0 ? void 0 : _a.find((branding) => { var _a; return ((_a = branding.locale) === null || _a === void 0 ? void 0 : _a.startsWith(appLocale)) || branding.locale === undefined; });
268
- const logo = ((_b = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.logo) === null || _b === void 0 ? void 0 : _b.dataUri) || ((_c = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.logo) === null || _c === void 0 ? void 0 : _c.uri);
277
+ const byLocalePrefix = (locale) => (b) => { var _a; return (_a = b.locale) === null || _a === void 0 ? void 0 : _a.startsWith(locale); };
278
+ const noLocale = (b) => b.locale === undefined || b.locale === '';
279
+ const localeBranding = (_f = (_d = (_b = (_a = args.localeBranding) === null || _a === void 0 ? void 0 : _a.find(byLocalePrefix(appLocale))) !== null && _b !== void 0 ? _b : (_c = args.localeBranding) === null || _c === void 0 ? void 0 : _c.find(noLocale)) !== null && _d !== void 0 ? _d : (appLocale !== 'en' ? (_e = args.localeBranding) === null || _e === void 0 ? void 0 : _e.find(byLocalePrefix('en')) : undefined)) !== null && _f !== void 0 ? _f : (_g = args.localeBranding) === null || _g === void 0 ? void 0 : _g[0];
280
+ const logo = ((_h = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.logo) === null || _h === void 0 ? void 0 : _h.dataUri) || ((_j = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.logo) === null || _j === void 0 ? void 0 : _j.uri);
269
281
  let imagePreloader;
270
282
  if (typeof window === 'undefined') {
271
283
  const { ReactNativeImagePreloader } = await Promise.resolve().then(() => __importStar(require('../services/ReactNativeImagePreloader')));
@@ -279,7 +291,7 @@ const selectAppLocaleBranding = async (args) => {
279
291
  imagePreloader.preload([{ uri: logo }]).catch(() => {
280
292
  });
281
293
  }
282
- const backgroundImage = ((_e = (_d = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.background) === null || _d === void 0 ? void 0 : _d.image) === null || _e === void 0 ? void 0 : _e.dataUri) || ((_g = (_f = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.background) === null || _f === void 0 ? void 0 : _f.image) === null || _g === void 0 ? void 0 : _g.uri);
294
+ const backgroundImage = ((_l = (_k = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.background) === null || _k === void 0 ? void 0 : _k.image) === null || _l === void 0 ? void 0 : _l.dataUri) || ((_o = (_m = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.background) === null || _m === void 0 ? void 0 : _m.image) === null || _o === void 0 ? void 0 : _o.uri);
283
295
  if (backgroundImage) {
284
296
  imagePreloader.preload([{ uri: backgroundImage }]).catch(() => {
285
297
  });
@@ -29,6 +29,7 @@ export type CredentialDetailsRow = {
29
29
  id: string;
30
30
  label: string;
31
31
  value: any;
32
+ depth?: number;
32
33
  isEditable?: boolean;
33
34
  status?: LabelStatus;
34
35
  imageSize?: ImageSize;
@@ -41,6 +42,7 @@ export interface ISelectAppLocaleBrandingArgs {
41
42
  export type ToCredentialDetailsRowArgs = {
42
43
  object: Record<string, any>;
43
44
  parentKey?: string;
45
+ depth?: number;
44
46
  subject?: Party;
45
47
  issuer?: Party;
46
48
  branding?: Array<IBasicCredentialClaim>;
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.167+74ae756",
4
+ "version": "0.4.1-unstable.169+31255b3",
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>",
@@ -28,10 +28,10 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@sphereon/ssi-sdk.core": "0.36.1-next.155",
32
- "@sphereon/ssi-sdk.data-store-types": "0.36.1-next.155",
33
- "@sphereon/ssi-types": "0.36.1-next.155",
34
- "@sphereon/ui-components.core": "0.4.1-unstable.167+74ae756",
31
+ "@sphereon/ssi-sdk.core": "0.36.1-next.159",
32
+ "@sphereon/ssi-sdk.data-store-types": "0.36.1-next.159",
33
+ "@sphereon/ssi-types": "0.36.1-next.159",
34
+ "@sphereon/ui-components.core": "0.4.1-unstable.169+31255b3",
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": "74ae756159b3b15b66563f47cb9a8142aafde21d"
54
+ "gitHead": "31255b3215b56170050a1e6cd85c4a279b57625a"
55
55
  }