@sphereon/ui-components.credential-branding 0.4.1-unstable.166 → 0.4.1-unstable.168

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
  }
@@ -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.166+3fcd8a4",
4
+ "version": "0.4.1-unstable.168+baff244",
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.36.1-next.155",
32
32
  "@sphereon/ssi-sdk.data-store-types": "0.36.1-next.155",
33
33
  "@sphereon/ssi-types": "0.36.1-next.155",
34
- "@sphereon/ui-components.core": "0.4.1-unstable.166+3fcd8a4",
34
+ "@sphereon/ui-components.core": "0.4.1-unstable.168+baff244",
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": "3fcd8a4faf1efd4f8d2ed29df599f0de450ef113"
54
+ "gitHead": "baff244e484348d5f1a9aac488c52ce90880fd12"
55
55
  }