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

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.
@@ -1,4 +1,4 @@
1
- import type { IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding } from '@sphereon/ssi-sdk.data-store';
1
+ import type { IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding } from '@sphereon/ssi-sdk.data-store-types';
2
2
  import { CredentialDetailsRow, CredentialSummary, GetCredentialDisplayNameArgs, GetCredentialIssuerNameAndAliasArgs, ISelectAppLocaleBrandingArgs, ToCredentialDetailsRowArgs, ToCredentialSummaryArgs, ToNonPersistedCredentialSummaryArgs } from '../types';
3
3
  export declare const toCredentialDetailsRow: (args: ToCredentialDetailsRowArgs) => Promise<CredentialDetailsRow[]>;
4
4
  export declare const toNonPersistedCredentialSummary: (args: ToNonPersistedCredentialSummaryArgs) => Promise<CredentialSummary>;
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -26,49 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
26
15
  }) : function(o, v) {
27
16
  o["default"] = v;
28
17
  });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- var __generator = (this && this.__generator) || function (thisArg, body) {
46
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
- function verb(n) { return function (v) { return step([n, v]); }; }
49
- function step(op) {
50
- if (f) throw new TypeError("Generator is already executing.");
51
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
- if (y = 0, t) op = [op[0] & 2, t.value];
54
- switch (op[0]) {
55
- case 0: case 1: t = op; break;
56
- case 4: _.label++; return { value: op[1], done: false };
57
- case 5: _.label++; y = op[1]; op = [0]; continue;
58
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
- default:
60
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
- if (t[2]) _.ops.pop();
65
- _.trys.pop(); continue;
66
- }
67
- op = body.call(thisArg, _);
68
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
- }
71
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
72
35
  var __rest = (this && this.__rest) || function (s, e) {
73
36
  var t = {};
74
37
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -80,190 +43,131 @@ var __rest = (this && this.__rest) || function (s, e) {
80
43
  }
81
44
  return t;
82
45
  };
83
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
84
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
85
- if (ar || !(i in from)) {
86
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
87
- ar[i] = from[i];
88
- }
89
- }
90
- return to.concat(ar || Array.prototype.slice.call(from));
91
- };
92
- exports.__esModule = true;
46
+ Object.defineProperty(exports, "__esModule", { value: true });
93
47
  exports.selectAppLocaleBranding = exports.toCredentialSummary = exports.getCredentialIssuerNameAndAlias = exports.getCredentialDisplayName = exports.getDate = exports.toNonPersistedCredentialSummary = exports.toCredentialDetailsRow = void 0;
94
- var uuid_1 = require("uuid");
95
- var utils_1 = require("@veramo/utils");
96
- var ui_components_core_1 = require("@sphereon/ui-components.core");
97
- var ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
98
- var utils_2 = require("../utils");
48
+ const uuid_1 = require("uuid");
49
+ const utils_1 = require("@veramo/utils");
50
+ const ui_components_core_1 = require("@sphereon/ui-components.core");
51
+ const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
52
+ const utils_2 = require("../utils");
99
53
  function findCorrelationIdName(correlationId, parties, activeUser) {
100
54
  var _a, _b;
101
- var allParties = parties;
55
+ let allParties = parties;
102
56
  if (activeUser) {
103
57
  parties.push(activeUser);
104
58
  }
105
- return ((_b = (_a = allParties === null || allParties === void 0 ? void 0 : allParties.find(function (contact) { var _a; return (_a = contact.identities) === null || _a === void 0 ? void 0 : _a.some(function (identity) { return identity.identifier.correlationId === correlationId; }); })) === null || _a === void 0 ? void 0 : _a.contact.displayName) !== null && _b !== void 0 ? _b : correlationId);
59
+ return ((_b = (_a = allParties === null || allParties === void 0 ? void 0 : allParties.find((contact) => { var _a; return (_a = contact.identities) === null || _a === void 0 ? void 0 : _a.some((identity) => identity.identifier.correlationId === correlationId); })) === null || _a === void 0 ? void 0 : _a.contact.displayName) !== null && _b !== void 0 ? _b : correlationId);
106
60
  }
107
- var getImageSize = function (image) { return __awaiter(void 0, void 0, void 0, function () {
108
- var downloadedImage;
109
- return __generator(this, function (_a) {
110
- switch (_a.label) {
111
- case 0: return [4, (0, utils_2.isImageAddress)(image)];
112
- case 1:
113
- if (!(_a.sent())) {
114
- return [2];
115
- }
116
- if (!(image.startsWith('http://') && !image.startsWith('https://'))) return [3, 3];
117
- return [4, (0, ssi_sdk_core_1.downloadImage)(image)];
118
- case 2:
119
- downloadedImage = _a.sent();
120
- if (downloadedImage) {
121
- return [2, (0, ssi_sdk_core_1.getImageDimensions)(downloadedImage.base64Content)];
122
- }
123
- return [3, 4];
124
- case 3:
125
- if (ui_components_core_1.IS_IMAGE_URI_REGEX.test(image)) {
126
- return [2, (0, ssi_sdk_core_1.getImageDimensions)(image.split('base64,')[1])];
127
- }
128
- _a.label = 4;
129
- case 4: return [2];
61
+ const getImageSize = async (image) => {
62
+ if (!(await (0, utils_2.isImageAddress)(image))) {
63
+ return;
64
+ }
65
+ if (image.startsWith('http://') && !image.startsWith('https://')) {
66
+ const downloadedImage = await (0, ssi_sdk_core_1.downloadImage)(image);
67
+ if (downloadedImage) {
68
+ return (0, ssi_sdk_core_1.getImageDimensions)(downloadedImage.base64Content);
130
69
  }
131
- });
132
- }); };
133
- var toCredentialDetailsRow = function (args) { return __awaiter(void 0, void 0, void 0, function () {
134
- var object, subject, issuer, branding, _a, parentKey, rows, _loop_1, _i, _b, _c, key, value;
135
- var _d, _e, _f, _g;
136
- return __generator(this, function (_h) {
137
- switch (_h.label) {
138
- case 0:
139
- object = args.object, subject = args.subject, issuer = args.issuer, branding = args.branding, _a = args.parentKey, parentKey = _a === void 0 ? '' : _a;
140
- rows = [];
141
- if (!object) {
142
- return [2, rows];
70
+ }
71
+ else if (ui_components_core_1.IS_IMAGE_URI_REGEX.test(image)) {
72
+ return (0, ssi_sdk_core_1.getImageDimensions)(image.split('base64,')[1]);
73
+ }
74
+ };
75
+ const toCredentialDetailsRow = async (args) => {
76
+ var _a, _b, _c, _d;
77
+ const { object, subject, issuer, branding, parentKey = '' } = args;
78
+ let rows = [];
79
+ if (!object) {
80
+ return rows;
81
+ }
82
+ const entries = Object.entries(object);
83
+ if (branding === null || branding === void 0 ? void 0 : branding.some(claim => claim.order != null)) {
84
+ entries.sort(([keyA], [keyB]) => {
85
+ var _a, _b;
86
+ const fullKeyA = parentKey ? `${parentKey}.${keyA}` : keyA;
87
+ const fullKeyB = parentKey ? `${parentKey}.${keyB}` : keyB;
88
+ const orderA = (_a = branding.find(claim => claim.key === fullKeyA)) === null || _a === void 0 ? void 0 : _a.order;
89
+ const orderB = (_b = branding.find(claim => claim.key === fullKeyB)) === null || _b === void 0 ? void 0 : _b.order;
90
+ if (orderA != null && orderB != null)
91
+ return orderA - orderB;
92
+ if (orderA != null)
93
+ return -1;
94
+ if (orderB != null)
95
+ return 1;
96
+ return 0;
97
+ });
98
+ }
99
+ for (let [key, value] of entries) {
100
+ if (!key) {
101
+ continue;
102
+ }
103
+ if (key === 'type') {
104
+ rows.push({
105
+ id: (0, uuid_1.v4)(),
106
+ label: key,
107
+ value: value,
108
+ });
109
+ continue;
110
+ }
111
+ if (Array.isArray(value)) {
112
+ const label = (_b = (_a = branding === null || branding === void 0 ? void 0 : branding.find(claim => claim.key === (parentKey ? `${parentKey}.${key}` : key))) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : key;
113
+ const items = value.filter(item => item !== undefined && item !== null);
114
+ let isFirst = true;
115
+ for (const item of items) {
116
+ if (typeof item === 'object') {
117
+ rows = rows.concat(await (0, exports.toCredentialDetailsRow)({ object: item, subject, issuer, branding, parentKey: parentKey ? `${parentKey}.${key}` : key }));
143
118
  }
144
- _loop_1 = function (key, value) {
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
- case 0:
149
- if (!key) {
150
- return [2, "continue"];
151
- }
152
- if (key === 'type') {
153
- rows.push({
154
- id: (0, uuid_1.v4)(),
155
- label: key,
156
- value: value
157
- });
158
- return [2, "continue"];
159
- }
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;
166
- case 1:
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 })];
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:
197
- if (key === '0' || value === undefined || value === null) {
198
- return [2, "continue"];
199
- }
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;
201
- if (key === 'id' && typeof value === 'string' && value.startsWith('did:')) {
202
- label = 'subject';
203
- }
204
- if (typeof value === 'string' && value.startsWith('did:')) {
205
- contacts = __spreadArray(__spreadArray([], (issuer ? [issuer] : []), true), (subject ? [subject] : []), true);
206
- value = findCorrelationIdName(value, contacts);
207
- }
208
- return [4, (0, utils_2.isImageAddress)(value)];
209
- case 10:
210
- if (!(_q.sent())) return [3, 12];
211
- return [4, getImageSize(value)];
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;
220
- rows.push({
221
- id: (0, uuid_1.v4)(),
222
- label: label,
223
- value: value,
224
- imageSize: imageSize
225
- });
226
- _q.label = 14;
227
- case 14: return [2];
228
- }
119
+ else {
120
+ rows.push({
121
+ id: (0, uuid_1.v4)(),
122
+ label: isFirst ? label : '',
123
+ value: ` ${item}`,
229
124
  });
230
- };
231
- _i = 0, _b = Object.entries(object);
232
- _h.label = 1;
233
- case 1:
234
- if (!(_i < _b.length)) return [3, 4];
235
- _c = _b[_i], key = _c[0], value = _c[1];
236
- return [5, _loop_1(key, value)];
237
- case 2:
238
- _h.sent();
239
- _h.label = 3;
240
- case 3:
241
- _i++;
242
- return [3, 1];
243
- case 4: return [2, rows];
125
+ }
126
+ isFirst = false;
127
+ }
244
128
  }
245
- });
246
- }); };
129
+ else if (typeof value === 'object' && value !== null && value !== undefined) {
130
+ rows = rows.concat(await (0, exports.toCredentialDetailsRow)({ object: value, subject, issuer, branding, parentKey: parentKey ? `${parentKey}.${key}` : key }));
131
+ }
132
+ else {
133
+ if (key === '0' || value === undefined || value === null) {
134
+ continue;
135
+ }
136
+ 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;
137
+ if (key === 'id' && typeof value === 'string' && value.startsWith('did:')) {
138
+ label = 'subject';
139
+ }
140
+ if (typeof value === 'string' && value.startsWith('did:')) {
141
+ const contacts = [...(issuer ? [issuer] : []), ...(subject ? [subject] : [])];
142
+ value = findCorrelationIdName(value, contacts);
143
+ }
144
+ const imageSize = (await (0, utils_2.isImageAddress)(value)) ? await getImageSize(value) : undefined;
145
+ rows.push({
146
+ id: (0, uuid_1.v4)(),
147
+ label,
148
+ value,
149
+ imageSize,
150
+ });
151
+ }
152
+ }
153
+ return rows;
154
+ };
247
155
  exports.toCredentialDetailsRow = toCredentialDetailsRow;
248
- var toNonPersistedCredentialSummary = function (args) {
249
- var verifiableCredential = args.verifiableCredential, credentialRole = args.credentialRole, branding = args.branding, issuer = args.issuer, subject = args.subject, linkedVp = args.linkedVp;
156
+ const toNonPersistedCredentialSummary = (args) => {
157
+ const { verifiableCredential, credentialRole, branding, issuer, subject, linkedVp } = args;
250
158
  return (0, exports.toCredentialSummary)({
251
159
  verifiableCredential: verifiableCredential,
252
160
  hash: (0, utils_1.computeEntryHash)(verifiableCredential),
253
- credentialRole: credentialRole,
254
- branding: branding,
255
- issuer: issuer,
256
- subject: subject,
257
- linkedVp: linkedVp
161
+ credentialRole,
162
+ branding,
163
+ issuer,
164
+ subject,
165
+ linkedVp
258
166
  });
259
167
  };
260
168
  exports.toNonPersistedCredentialSummary = toNonPersistedCredentialSummary;
261
- var getDate = function () {
262
- var dates = [];
263
- for (var _i = 0; _i < arguments.length; _i++) {
264
- dates[_i] = arguments[_i];
265
- }
266
- var date = dates === null || dates === void 0 ? void 0 : dates.find(function (date) { return date !== null && date !== undefined; });
169
+ const getDate = (...dates) => {
170
+ const date = dates === null || dates === void 0 ? void 0 : dates.find(date => date !== null && date !== undefined);
267
171
  if (!date) {
268
172
  return;
269
173
  }
@@ -273,12 +177,12 @@ var getDate = function () {
273
177
  return Math.round(new Date(date + '').valueOf() / ui_components_core_1.EPOCH_MILLISECONDS);
274
178
  };
275
179
  exports.getDate = getDate;
276
- var getCredentialDisplayName = function (args) {
180
+ const getCredentialDisplayName = (args) => {
277
181
  var _a, _b;
278
- var verifiableCredential = args.verifiableCredential, localeBranding = args.localeBranding;
279
- var title = (_b = (_a = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.alias) !== null && _a !== void 0 ? _a : verifiableCredential.name) !== null && _b !== void 0 ? _b : (!verifiableCredential.type ? 'unknown' : undefined);
182
+ const { verifiableCredential, localeBranding } = args;
183
+ let title = (_b = (_a = localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.alias) !== null && _a !== void 0 ? _a : verifiableCredential.name) !== null && _b !== void 0 ? _b : (!verifiableCredential.type ? 'unknown' : undefined);
280
184
  if (verifiableCredential.type) {
281
- var types = (0, utils_1.asArray)(verifiableCredential.type).filter(function (val) { return val !== 'VerifiableCredential'; });
185
+ const types = (0, utils_1.asArray)(verifiableCredential.type).filter(val => val !== 'VerifiableCredential');
282
186
  if (types.length === 1) {
283
187
  title = types[0];
284
188
  }
@@ -292,11 +196,11 @@ var getCredentialDisplayName = function (args) {
292
196
  return title;
293
197
  };
294
198
  exports.getCredentialDisplayName = getCredentialDisplayName;
295
- var getCredentialIssuerNameAndAlias = function (args) {
199
+ const getCredentialIssuerNameAndAlias = (args) => {
296
200
  var _a;
297
- var verifiableCredential = args.verifiableCredential, issuer = args.issuer;
298
- var issuerName = typeof verifiableCredential.issuer === 'string' ? verifiableCredential.issuer : (_a = verifiableCredential.issuer) === null || _a === void 0 ? void 0 : _a.id;
299
- var issuerAlias = undefined;
201
+ const { verifiableCredential, issuer } = args;
202
+ const issuerName = typeof verifiableCredential.issuer === 'string' ? verifiableCredential.issuer : (_a = verifiableCredential.issuer) === null || _a === void 0 ? void 0 : _a.id;
203
+ let issuerAlias = undefined;
300
204
  if (typeof (verifiableCredential === null || verifiableCredential === void 0 ? void 0 : verifiableCredential.issuer) === 'object') {
301
205
  issuerAlias = verifiableCredential.issuer.name;
302
206
  }
@@ -306,102 +210,82 @@ var getCredentialIssuerNameAndAlias = function (args) {
306
210
  if (!issuerAlias) {
307
211
  issuerAlias = issuerName;
308
212
  }
309
- return { issuerName: issuerName, issuerAlias: issuerAlias };
213
+ return { issuerName, issuerAlias };
310
214
  };
311
215
  exports.getCredentialIssuerNameAndAlias = getCredentialIssuerNameAndAlias;
312
- var getTermsOfUse = function (args) {
313
- var verifiableCredential = args.verifiableCredential;
216
+ const getTermsOfUse = (args) => {
217
+ const { verifiableCredential } = args;
314
218
  if (!verifiableCredential.termsOfUse) {
315
219
  return;
316
220
  }
317
- var termsOfUse = (0, utils_1.asArray)(verifiableCredential.termsOfUse);
318
- return termsOfUse.map(function (tou) {
319
- var _a;
320
- var type = tou.type, id = tou.id, rest = __rest(tou, ["type", "id"]);
321
- return __assign((_a = {}, _a[type] = id, _a), rest);
221
+ const termsOfUse = (0, utils_1.asArray)(verifiableCredential.termsOfUse);
222
+ return termsOfUse.map((tou) => {
223
+ const { type, id } = tou, rest = __rest(tou, ["type", "id"]);
224
+ return Object.assign({ [type]: id }, rest);
322
225
  });
323
226
  };
324
- var toCredentialSummary = function (args) { return __awaiter(void 0, void 0, void 0, function () {
325
- var verifiableCredential, hash, credentialRole, branding, issuer, subject, linkedVp, expirationDate, issueDate, localeBranding, credentialStatus, title, properties, logo, url, _a, issuerName, issuerAlias, termsOfUse;
326
- var _b, _c;
327
- return __generator(this, function (_d) {
328
- switch (_d.label) {
329
- case 0:
330
- verifiableCredential = args.verifiableCredential, hash = args.hash, credentialRole = args.credentialRole, branding = args.branding, issuer = args.issuer, subject = args.subject, linkedVp = args.linkedVp;
331
- expirationDate = (_b = (0, exports.getDate)(verifiableCredential.expirationDate, verifiableCredential.validTo, verifiableCredential.exp)) !== null && _b !== void 0 ? _b : 0;
332
- issueDate = (0, exports.getDate)(verifiableCredential.issuanceDate, verifiableCredential.validFrom, verifiableCredential.nbf, verifiableCredential.iat);
333
- return [4, (0, exports.selectAppLocaleBranding)({ localeBranding: branding })];
334
- case 1:
335
- localeBranding = _d.sent();
336
- credentialStatus = (0, utils_2.getCredentialStatus)(verifiableCredential);
337
- title = (0, exports.getCredentialDisplayName)({ verifiableCredential: verifiableCredential, localeBranding: localeBranding });
338
- return [4, (0, exports.toCredentialDetailsRow)({
339
- object: __assign(__assign({}, (_c = verifiableCredential.vc) === null || _c === void 0 ? void 0 : _c.credentialSubject), verifiableCredential.credentialSubject),
340
- subject: subject,
341
- issuer: issuer,
342
- branding: localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.claims
343
- })];
344
- case 2:
345
- properties = _d.sent();
346
- logo = (0, utils_2.getIssuerLogo)(verifiableCredential, localeBranding);
347
- url = verifiableCredential.issuer && typeof verifiableCredential.issuer !== 'string' ? verifiableCredential.issuer.url : undefined;
348
- _a = (0, exports.getCredentialIssuerNameAndAlias)({ verifiableCredential: verifiableCredential, issuer: issuer }), issuerName = _a.issuerName, issuerAlias = _a.issuerAlias;
349
- termsOfUse = getTermsOfUse({ verifiableCredential: verifiableCredential });
350
- return [2, {
351
- hash: hash,
352
- id: verifiableCredential.id,
353
- title: title,
354
- credentialStatus: credentialStatus,
355
- credentialRole: credentialRole,
356
- issueDate: issueDate,
357
- expirationDate: expirationDate,
358
- properties: properties,
359
- branding: localeBranding,
360
- termsOfUse: termsOfUse,
361
- issuer: {
362
- name: issuerName,
363
- alias: issuerAlias ? (issuerAlias.length > 50 ? "".concat(issuerAlias.substring(0, 50), "...") : issuerAlias) : '',
364
- image: logo,
365
- url: url
366
- },
367
- linkedVp: linkedVp
368
- }];
369
- }
227
+ const toCredentialSummary = async (args) => {
228
+ var _a, _b;
229
+ const { verifiableCredential, hash, credentialRole, branding, issuer, subject, linkedVp } = args;
230
+ const expirationDate = (_a = (0, exports.getDate)(verifiableCredential.expirationDate, verifiableCredential.validTo, verifiableCredential.exp)) !== null && _a !== void 0 ? _a : 0;
231
+ const issueDate = (0, exports.getDate)(verifiableCredential.issuanceDate, verifiableCredential.validFrom, verifiableCredential.nbf, verifiableCredential.iat);
232
+ const localeBranding = await (0, exports.selectAppLocaleBranding)({ localeBranding: branding });
233
+ const credentialStatus = (0, utils_2.getCredentialStatus)(verifiableCredential);
234
+ const title = (0, exports.getCredentialDisplayName)({ verifiableCredential, localeBranding });
235
+ const properties = await (0, exports.toCredentialDetailsRow)({
236
+ object: Object.assign(Object.assign({}, (_b = verifiableCredential.vc) === null || _b === void 0 ? void 0 : _b.credentialSubject), verifiableCredential.credentialSubject),
237
+ subject,
238
+ issuer,
239
+ branding: localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.claims,
370
240
  });
371
- }); };
241
+ const logo = (0, utils_2.getIssuerLogo)(verifiableCredential, localeBranding);
242
+ const url = verifiableCredential.issuer && typeof verifiableCredential.issuer !== 'string' ? verifiableCredential.issuer.url : undefined;
243
+ const { issuerName, issuerAlias } = (0, exports.getCredentialIssuerNameAndAlias)({ verifiableCredential, issuer });
244
+ const termsOfUse = getTermsOfUse({ verifiableCredential });
245
+ return {
246
+ hash,
247
+ id: verifiableCredential.id,
248
+ title,
249
+ credentialStatus,
250
+ credentialRole,
251
+ issueDate,
252
+ expirationDate,
253
+ properties,
254
+ branding: localeBranding,
255
+ termsOfUse,
256
+ issuer: {
257
+ name: issuerName,
258
+ alias: issuerAlias ? (issuerAlias.length > 50 ? `${issuerAlias.substring(0, 50)}...` : issuerAlias) : '',
259
+ image: logo,
260
+ url,
261
+ },
262
+ linkedVp
263
+ };
264
+ };
372
265
  exports.toCredentialSummary = toCredentialSummary;
373
- var selectAppLocaleBranding = function (args) { return __awaiter(void 0, void 0, void 0, function () {
374
- var appLocale, localeBranding, logo, imagePreloader, ReactNativeImagePreloader, WebImagePreloader, backgroundImage;
266
+ const selectAppLocaleBranding = async (args) => {
375
267
  var _a, _b, _c, _d, _e, _f, _g;
376
- return __generator(this, function (_h) {
377
- switch (_h.label) {
378
- case 0:
379
- appLocale = ui_components_core_1.Localization.getLocale();
380
- localeBranding = (_a = args.localeBranding) === null || _a === void 0 ? void 0 : _a.find(function (branding) { var _a; return ((_a = branding.locale) === null || _a === void 0 ? void 0 : _a.startsWith(appLocale)) || branding.locale === undefined; });
381
- 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);
382
- if (!(typeof window === 'undefined')) return [3, 2];
383
- return [4, Promise.resolve().then(function () { return __importStar(require('../services/ReactNativeImagePreloader')); })];
384
- case 1:
385
- ReactNativeImagePreloader = (_h.sent()).ReactNativeImagePreloader;
386
- imagePreloader = new ReactNativeImagePreloader();
387
- return [3, 4];
388
- case 2: return [4, Promise.resolve().then(function () { return __importStar(require('../services/WebImagePreloader')); })];
389
- case 3:
390
- WebImagePreloader = (_h.sent()).WebImagePreloader;
391
- imagePreloader = new WebImagePreloader();
392
- _h.label = 4;
393
- case 4:
394
- if (logo) {
395
- imagePreloader.preload([{ uri: logo }])["catch"](function () {
396
- });
397
- }
398
- 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);
399
- if (backgroundImage) {
400
- imagePreloader.preload([{ uri: backgroundImage }])["catch"](function () {
401
- });
402
- }
403
- return [2, localeBranding];
404
- }
405
- });
406
- }); };
268
+ const appLocale = ui_components_core_1.Localization.getLocale();
269
+ 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; });
270
+ 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);
271
+ let imagePreloader;
272
+ if (typeof window === 'undefined') {
273
+ const { ReactNativeImagePreloader } = await Promise.resolve().then(() => __importStar(require('../services/ReactNativeImagePreloader')));
274
+ imagePreloader = new ReactNativeImagePreloader();
275
+ }
276
+ else {
277
+ const { WebImagePreloader } = await Promise.resolve().then(() => __importStar(require('../services/WebImagePreloader')));
278
+ imagePreloader = new WebImagePreloader();
279
+ }
280
+ if (logo) {
281
+ imagePreloader.preload([{ uri: logo }]).catch(() => {
282
+ });
283
+ }
284
+ 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);
285
+ if (backgroundImage) {
286
+ imagePreloader.preload([{ uri: backgroundImage }]).catch(() => {
287
+ });
288
+ }
289
+ return localeBranding;
290
+ };
407
291
  exports.selectAppLocaleBranding = selectAppLocaleBranding;
@@ -13,5 +13,5 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CredentialDetails"), exports);
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./details"), exports);
18
18
  __exportStar(require("./services"), exports);
19
19
  __exportStar(require("./types"), exports);
@@ -1,2 +1,2 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,67 +1,15 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.ReactNativeImagePreloader = void 0;
40
- var ReactNativeImagePreloader = (function () {
41
- function ReactNativeImagePreloader() {
4
+ class ReactNativeImagePreloader {
5
+ async preload(sources) {
6
+ const promises = sources.map(source => new Promise((resolve, reject) => {
7
+ const img = new Image();
8
+ img.src = source.uri;
9
+ img.onload = () => resolve();
10
+ img.onerror = error => reject(error);
11
+ }));
12
+ await Promise.all(promises);
42
13
  }
43
- ReactNativeImagePreloader.prototype.preload = function (sources) {
44
- return __awaiter(this, void 0, void 0, function () {
45
- var promises;
46
- return __generator(this, function (_a) {
47
- switch (_a.label) {
48
- case 0:
49
- promises = sources.map(function (source) {
50
- return new Promise(function (resolve, reject) {
51
- var img = new Image();
52
- img.src = source.uri;
53
- img.onload = function () { return resolve(); };
54
- img.onerror = function (error) { return reject(error); };
55
- });
56
- });
57
- return [4, Promise.all(promises)];
58
- case 1:
59
- _a.sent();
60
- return [2];
61
- }
62
- });
63
- });
64
- };
65
- return ReactNativeImagePreloader;
66
- }());
14
+ }
67
15
  exports.ReactNativeImagePreloader = ReactNativeImagePreloader;
@@ -1,67 +1,17 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.WebImagePreloader = void 0;
40
- var WebImagePreloader = (function () {
41
- function WebImagePreloader() {
42
- }
43
- WebImagePreloader.prototype.preload = function (sources) {
44
- return __awaiter(this, void 0, void 0, function () {
45
- var promises;
46
- return __generator(this, function (_a) {
47
- switch (_a.label) {
48
- case 0:
49
- promises = sources.map(function (source) {
50
- return new Promise(function (resolve, reject) {
51
- var img = new Image();
52
- img.src = source.uri;
53
- img.onload = function () { return resolve(); };
54
- img.onerror = function (error) { return reject(error); };
55
- });
56
- });
57
- return [4, Promise.all(promises)];
58
- case 1:
59
- _a.sent();
60
- return [2];
61
- }
4
+ class WebImagePreloader {
5
+ async preload(sources) {
6
+ const promises = sources.map(source => {
7
+ return new Promise((resolve, reject) => {
8
+ const img = new Image();
9
+ img.src = source.uri;
10
+ img.onload = () => resolve();
11
+ img.onerror = error => reject(error);
62
12
  });
63
13
  });
64
- };
65
- return WebImagePreloader;
66
- }());
14
+ await Promise.all(promises);
15
+ }
16
+ }
67
17
  exports.WebImagePreloader = WebImagePreloader;
@@ -13,5 +13,5 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IPreloadImage"), exports);
@@ -1,5 +1,5 @@
1
1
  import { CredentialStatus, ImageSize, IssuerStatus } from '@sphereon/ui-components.core';
2
- import type { IBasicCredentialClaim, IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding, Party } from '@sphereon/ssi-sdk.data-store';
2
+ import type { IBasicCredentialClaim, IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding, Party } from '@sphereon/ssi-sdk.data-store-types';
3
3
  import { CredentialRole } from '@sphereon/ssi-types';
4
4
  import { ICredential } from '@sphereon/ssi-types';
5
5
  import { VerifiableCredential } from '@veramo/core';
@@ -1,2 +1,2 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import { VerifiableCredential } from '@veramo/core';
2
2
  import { CredentialSummary } from '../types';
3
- import type { IBasicCredentialLocaleBranding } from '@sphereon/ssi-sdk.data-store';
3
+ import type { IBasicCredentialLocaleBranding } from '@sphereon/ssi-sdk.data-store-types';
4
4
  export declare const isImageAddress: (value: string) => Promise<boolean>;
5
5
  export declare function getIssuerLogo(verifiableCredential: VerifiableCredential | CredentialSummary, localeBranding?: IBasicCredentialLocaleBranding): string | undefined;
6
6
  export declare const getImageFromObjectOrString: (image?: string | object) => string | undefined;
@@ -1,52 +1,15 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getImageFromObjectOrString = exports.isImageAddress = void 0;
4
+ exports.getIssuerLogo = getIssuerLogo;
5
+ const ui_components_core_1 = require("@sphereon/ui-components.core");
6
+ const isImageAddress = async (value) => {
7
+ return ui_components_core_1.IS_IMAGE_URI_REGEX.test(value) || ui_components_core_1.IS_IMAGE_FILE_EXTENSION_REGEX.test(value);
37
8
  };
38
- exports.__esModule = true;
39
- exports.getImageFromObjectOrString = exports.getIssuerLogo = exports.isImageAddress = void 0;
40
- var ui_components_core_1 = require("@sphereon/ui-components.core");
41
- var isImageAddress = function (value) { return __awaiter(void 0, void 0, void 0, function () {
42
- return __generator(this, function (_a) {
43
- return [2, ui_components_core_1.IS_IMAGE_URI_REGEX.test(value) || ui_components_core_1.IS_IMAGE_FILE_EXTENSION_REGEX.test(value)];
44
- });
45
- }); };
46
9
  exports.isImageAddress = isImageAddress;
47
10
  function getIssuerLogo(verifiableCredential, localeBranding) {
48
11
  var _a;
49
- var logo;
12
+ let logo;
50
13
  if (localeBranding === null || localeBranding === void 0 ? void 0 : localeBranding.logo) {
51
14
  logo = (_a = localeBranding.logo.dataUri) !== null && _a !== void 0 ? _a : localeBranding.logo.uri;
52
15
  }
@@ -60,8 +23,7 @@ function getIssuerLogo(verifiableCredential, localeBranding) {
60
23
  }
61
24
  return logo;
62
25
  }
63
- exports.getIssuerLogo = getIssuerLogo;
64
- var getImageFromObjectOrString = function (image) {
26
+ const getImageFromObjectOrString = (image) => {
65
27
  if (!image) {
66
28
  return undefined;
67
29
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isExpired = exports.isRevoked = exports.getCredentialStatus = void 0;
4
- var ui_components_core_1 = require("@sphereon/ui-components.core");
5
- var getCredentialStatus = function (credential) {
4
+ const ui_components_core_1 = require("@sphereon/ui-components.core");
5
+ const getCredentialStatus = (credential) => {
6
6
  if ((0, exports.isRevoked)()) {
7
7
  return ui_components_core_1.CredentialStatus.REVOKED;
8
8
  }
@@ -12,15 +12,15 @@ var getCredentialStatus = function (credential) {
12
12
  return ui_components_core_1.CredentialStatus.VALID;
13
13
  };
14
14
  exports.getCredentialStatus = getCredentialStatus;
15
- var isRevoked = function () {
15
+ const isRevoked = () => {
16
16
  return false;
17
17
  };
18
18
  exports.isRevoked = isRevoked;
19
- var isExpired = function (value) {
19
+ const isExpired = (value) => {
20
20
  if (!value) {
21
21
  return false;
22
22
  }
23
- var expirationDate = typeof value === 'string' ? new Date(value).valueOf() : value;
23
+ let expirationDate = typeof value === 'string' ? new Date(value).valueOf() : value;
24
24
  expirationDate = (0, ui_components_core_1.makeEpochMilli)(expirationDate);
25
25
  return expirationDate < Date.now();
26
26
  };
@@ -13,6 +13,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ImageUtils"), exports);
18
18
  __exportStar(require("./MappingUtils"), exports);
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.161+ee5b24d",
4
+ "version": "0.4.1-unstable.163+38cc1a5",
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.34.1-feature.SSISDK.45.94",
32
- "@sphereon/ssi-sdk.data-store": "0.34.1-feature.SSISDK.45.94",
33
- "@sphereon/ssi-types": "0.34.1-feature.SSISDK.45.94",
34
- "@sphereon/ui-components.core": "0.4.1-unstable.161+ee5b24d",
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.163+38cc1a5",
35
35
  "@veramo/core": "4.2.0",
36
36
  "@veramo/utils": "4.2.0",
37
37
  "i18n-js": "^3.8.0",
@@ -46,10 +46,10 @@
46
46
  "jest": "^29.7.0",
47
47
  "react": "18.3.1",
48
48
  "ts-jest": "^29.2.5",
49
- "typescript": "4.9.5"
49
+ "typescript": "~5.8.3"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">= 18.2"
53
53
  },
54
- "gitHead": "ee5b24d61e75955da6e2e4e43572807db7c4aa40"
54
+ "gitHead": "38cc1a518b1cd568f7b2fad0f1036f772ebd4a2e"
55
55
  }