@sphereon/ui-components.credential-branding 0.2.1-unstable.89 → 0.2.1-unstable.90
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,8 +1,8 @@
|
|
|
1
1
|
import { VerifiableCredential } from '@veramo/core';
|
|
2
2
|
import { IBasicCredentialLocaleBranding, IBasicIssuerLocaleBranding, Party } from '@sphereon/ssi-sdk.data-store';
|
|
3
3
|
import { CredentialSummary, ISelectAppLocaleBrandingArgs } from '../types';
|
|
4
|
-
import {
|
|
5
|
-
export declare const toNonPersistedCredentialSummary: (
|
|
4
|
+
import { ICredential } from '@sphereon/ssi-types';
|
|
5
|
+
export declare const toNonPersistedCredentialSummary: (verifiableCredential: ICredential | VerifiableCredential, branding?: Array<IBasicCredentialLocaleBranding>, issuer?: Party, subject?: Party) => Promise<CredentialSummary>;
|
|
6
6
|
export declare const getDate: (...dates: (number | string | undefined)[]) => number | undefined;
|
|
7
7
|
export declare const getCredentialDisplayName: ({ verifiableCredential, localeBranding, }: {
|
|
8
8
|
verifiableCredential: VerifiableCredential;
|
|
@@ -15,5 +15,5 @@ export declare const getCredentialIssuerNameAndAlias: ({ verifiableCredential, i
|
|
|
15
15
|
issuerAlias: string;
|
|
16
16
|
issuerName: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const toCredentialSummary: (
|
|
18
|
+
export declare const toCredentialSummary: (verifiableCredential: VerifiableCredential, hash: string, branding?: Array<IBasicCredentialLocaleBranding>, issuer?: Party, subject?: Party) => Promise<CredentialSummary>;
|
|
19
19
|
export declare const selectAppLocaleBranding: (args: ISelectAppLocaleBrandingArgs) => Promise<IBasicCredentialLocaleBranding | IBasicIssuerLocaleBranding | undefined>;
|
|
@@ -195,8 +195,8 @@ var toCredentialDetailsRow = function (object, subject, issuer) { return __await
|
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
}); };
|
|
198
|
-
var toNonPersistedCredentialSummary = function (
|
|
199
|
-
return (0, exports.toCredentialSummary)(
|
|
198
|
+
var toNonPersistedCredentialSummary = function (verifiableCredential, branding, issuer, subject) {
|
|
199
|
+
return (0, exports.toCredentialSummary)(verifiableCredential, (0, utils_1.computeEntryHash)(verifiableCredential), branding, issuer, subject);
|
|
200
200
|
};
|
|
201
201
|
exports.toNonPersistedCredentialSummary = toNonPersistedCredentialSummary;
|
|
202
202
|
var getDate = function () {
|
|
@@ -264,50 +264,46 @@ var getTermsOfUse = function (_a) {
|
|
|
264
264
|
return __assign((_a = {}, _a[type] = id, _a), rest);
|
|
265
265
|
});
|
|
266
266
|
};
|
|
267
|
-
var toCredentialSummary = function (
|
|
268
|
-
var
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
}];
|
|
307
|
-
}
|
|
308
|
-
});
|
|
267
|
+
var toCredentialSummary = function (verifiableCredential, hash, branding, issuer, subject) { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
+
var expirationDate, issueDate, localeBranding, credentialStatus, title, properties, logo, url, _a, issuerName, issuerAlias, termsOfUse;
|
|
269
|
+
var _b, _c;
|
|
270
|
+
return __generator(this, function (_d) {
|
|
271
|
+
switch (_d.label) {
|
|
272
|
+
case 0:
|
|
273
|
+
expirationDate = (_b = (0, exports.getDate)(verifiableCredential.expirationDate, verifiableCredential.validTo, verifiableCredential.exp)) !== null && _b !== void 0 ? _b : 0;
|
|
274
|
+
issueDate = (0, exports.getDate)(verifiableCredential.issuanceDate, verifiableCredential.validFrom, verifiableCredential.nbf, verifiableCredential.iat);
|
|
275
|
+
return [4, (0, exports.selectAppLocaleBranding)({ localeBranding: branding })];
|
|
276
|
+
case 1:
|
|
277
|
+
localeBranding = _d.sent();
|
|
278
|
+
credentialStatus = (0, utils_2.getCredentialStatus)(verifiableCredential);
|
|
279
|
+
title = (0, exports.getCredentialDisplayName)({ verifiableCredential: verifiableCredential, localeBranding: localeBranding });
|
|
280
|
+
return [4, toCredentialDetailsRow(__assign(__assign({}, (_c = verifiableCredential.vc) === null || _c === void 0 ? void 0 : _c.credentialSubject), verifiableCredential.credentialSubject), subject, issuer)];
|
|
281
|
+
case 2:
|
|
282
|
+
properties = _d.sent();
|
|
283
|
+
logo = (0, utils_2.getIssuerLogo)(verifiableCredential, localeBranding);
|
|
284
|
+
url = typeof verifiableCredential.issuer !== 'string' ? verifiableCredential.issuer.url : undefined;
|
|
285
|
+
_a = (0, exports.getCredentialIssuerNameAndAlias)({ verifiableCredential: verifiableCredential, issuer: issuer }), issuerName = _a.issuerName, issuerAlias = _a.issuerAlias;
|
|
286
|
+
termsOfUse = getTermsOfUse({ verifiableCredential: verifiableCredential });
|
|
287
|
+
return [2, {
|
|
288
|
+
hash: hash,
|
|
289
|
+
id: verifiableCredential.id,
|
|
290
|
+
title: title,
|
|
291
|
+
credentialStatus: credentialStatus,
|
|
292
|
+
issueDate: issueDate,
|
|
293
|
+
expirationDate: expirationDate,
|
|
294
|
+
properties: properties,
|
|
295
|
+
branding: localeBranding,
|
|
296
|
+
termsOfUse: termsOfUse,
|
|
297
|
+
issuer: {
|
|
298
|
+
name: issuerName,
|
|
299
|
+
alias: issuerAlias ? (issuerAlias.length > 50 ? "".concat(issuerAlias.substring(0, 50), "...") : issuerAlias) : '',
|
|
300
|
+
image: logo,
|
|
301
|
+
url: url
|
|
302
|
+
}
|
|
303
|
+
}];
|
|
304
|
+
}
|
|
309
305
|
});
|
|
310
|
-
};
|
|
306
|
+
}); };
|
|
311
307
|
exports.toCredentialSummary = toCredentialSummary;
|
|
312
308
|
var selectAppLocaleBranding = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
309
|
var appLocale, localeBranding, logo, imagePreloader, ReactNativeImagePreloader, WebImagePreloader, backgroundImage;
|
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.2.1-unstable.
|
|
4
|
+
"version": "0.2.1-unstable.90+23173d5",
|
|
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>",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@sphereon/ssi-sdk.credential-store": "00.28.1-next.39",
|
|
33
33
|
"@sphereon/ssi-sdk.data-store": "00.28.1-next.39",
|
|
34
34
|
"@sphereon/ssi-types": "00.28.1-next.39",
|
|
35
|
-
"@sphereon/ui-components.core": "0.2.1-unstable.
|
|
35
|
+
"@sphereon/ui-components.core": "0.2.1-unstable.90+23173d5",
|
|
36
36
|
"@veramo/core": "4.2.0",
|
|
37
37
|
"@veramo/utils": "4.2.0",
|
|
38
38
|
"i18n-js": "^3.8.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": ">= 18"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "23173d5edddf86b230d75e8a74777d7169fd60d9"
|
|
53
53
|
}
|