@sphereon/ui-components.credential-branding 0.2.1-unstable.42 → 0.2.1-unstable.44

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.
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
  <h1 align="center">
3
3
  <br>
4
4
  <a href="https://www.sphereon.com"><img src="https://sphereon.com/content/themes/sphereon/assets/img/logo.svg" alt="Sphereon" width="400"></a>
5
- <br>UI Components Credential Branding (Typescript)
5
+ <br>UI Components Credential Mapper (Typescript)
6
6
  <br>
7
7
  </h1>
8
8
 
9
- A UI Core package for shared logic / styling and localization between components related to Credential Branding
9
+ A UI Core package for shared logic between components related to Credential Branding
10
10
 
11
11
  ### Build
12
12
 
@@ -17,5 +17,5 @@ pnpm build
17
17
  ### Installation
18
18
 
19
19
  ```shell
20
- pnpm install @sphereon/ui-components.credential-branding
20
+ pnpm install @sphereon/ui-components.credential-mapper
21
21
  ```
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -50,7 +73,6 @@ var uuid_1 = require("uuid");
50
73
  var utils_1 = require("@veramo/utils");
51
74
  var ui_components_core_1 = require("@sphereon/ui-components.core");
52
75
  var ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
53
- var services_1 = require("../services");
54
76
  var utils_2 = require("../utils");
55
77
  function findCorrelationIdName(correlationId, contacts) {
56
78
  var contact = contacts.find(function (contact) {
@@ -226,28 +248,37 @@ var toCredentialSummary = function (_a, branding, issuer, subject) {
226
248
  };
227
249
  exports.toCredentialSummary = toCredentialSummary;
228
250
  var selectAppLocaleBranding = function (args) { return __awaiter(void 0, void 0, void 0, function () {
229
- var appLocale, localeBranding, logo, imagePreloader, backgroundImage;
251
+ var appLocale, localeBranding, logo, imagePreloader, ReactNativeImagePreloader, WebImagePreloader, backgroundImage;
230
252
  var _a, _b, _c, _d, _e, _f, _g;
231
253
  return __generator(this, function (_h) {
232
- appLocale = ui_components_core_1.Localization.getLocale();
233
- 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; });
234
- 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);
235
- if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
236
- imagePreloader = new services_1.ReactNativeImagePreloader();
237
- }
238
- else {
239
- imagePreloader = new services_1.WebImagePreloader();
240
- }
241
- if (logo) {
242
- imagePreloader.preload([{ uri: logo }])["catch"](function () {
243
- });
244
- }
245
- 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);
246
- if (backgroundImage) {
247
- imagePreloader.preload([{ uri: backgroundImage }])["catch"](function () {
248
- });
254
+ switch (_h.label) {
255
+ case 0:
256
+ appLocale = ui_components_core_1.Localization.getLocale();
257
+ 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; });
258
+ 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);
259
+ if (!(typeof window === 'undefined')) return [3, 2];
260
+ return [4, Promise.resolve().then(function () { return __importStar(require('../services/ReactNativeImagePreloader')); })];
261
+ case 1:
262
+ ReactNativeImagePreloader = (_h.sent()).ReactNativeImagePreloader;
263
+ imagePreloader = new ReactNativeImagePreloader();
264
+ return [3, 4];
265
+ case 2: return [4, Promise.resolve().then(function () { return __importStar(require('../services/WebImagePreloader')); })];
266
+ case 3:
267
+ WebImagePreloader = (_h.sent()).WebImagePreloader;
268
+ imagePreloader = new WebImagePreloader();
269
+ _h.label = 4;
270
+ case 4:
271
+ if (logo) {
272
+ imagePreloader.preload([{ uri: logo }])["catch"](function () {
273
+ });
274
+ }
275
+ 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);
276
+ if (backgroundImage) {
277
+ imagePreloader.preload([{ uri: backgroundImage }])["catch"](function () {
278
+ });
279
+ }
280
+ return [2, localeBranding];
249
281
  }
250
- return [2, localeBranding];
251
282
  });
252
283
  }); };
253
284
  exports.selectAppLocaleBranding = selectAppLocaleBranding;
@@ -42,8 +42,23 @@ var ReactNativeImagePreloader = (function () {
42
42
  }
43
43
  ReactNativeImagePreloader.prototype.preload = function (sources) {
44
44
  return __awaiter(this, void 0, void 0, function () {
45
+ var promises;
45
46
  return __generator(this, function (_a) {
46
- return [2];
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
+ }
47
62
  });
48
63
  });
49
64
  };
@@ -1,3 +1 @@
1
- export * from './WebImagePreloader';
2
1
  export * from './IPreloadImage';
3
- export * from './ReactNativeImagePreloader';
@@ -14,6 +14,4 @@ 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
16
  exports.__esModule = true;
17
- __exportStar(require("./WebImagePreloader"), exports);
18
17
  __exportStar(require("./IPreloadImage"), exports);
19
- __exportStar(require("./ReactNativeImagePreloader"), exports);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@sphereon/ui-components.credential-branding",
3
3
  "private": false,
4
- "version": "0.2.1-unstable.42+4300018",
5
- "description": "SSI UI components credential Branding",
4
+ "version": "0.2.1-unstable.44+5dc2b62",
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>",
8
8
  "license": "Apache-2.0",
@@ -10,6 +10,7 @@
10
10
  "Frontend",
11
11
  "User interface",
12
12
  "Self-sovereign identity (SSI)",
13
+ "Credential mapper",
13
14
  "Credential branding"
14
15
  ],
15
16
  "scripts": {
@@ -28,10 +29,10 @@
28
29
  "access": "public"
29
30
  },
30
31
  "dependencies": {
31
- "@sphereon/ssi-sdk.core": "0.23.5-unstable.74+9c3c2083",
32
- "@sphereon/ssi-sdk.data-store": "0.23.5-unstable.74+9c3c2083",
33
- "@sphereon/ssi-types": "0.23.5-unstable.74+9c3c2083",
34
- "@sphereon/ui-components.core": "0.2.1-unstable.42+4300018",
32
+ "@sphereon/ssi-sdk.core": "0.26.1-next.6",
33
+ "@sphereon/ssi-sdk.data-store": "0.26.1-next.6",
34
+ "@sphereon/ssi-types": "0.26.1-next.6",
35
+ "@sphereon/ui-components.core": "0.2.1-unstable.44+5dc2b62",
35
36
  "@veramo/core": "4.2.0",
36
37
  "@veramo/utils": "4.2.0",
37
38
  "i18n-js": "^3.8.0",
@@ -48,5 +49,5 @@
48
49
  "peerDependencies": {
49
50
  "react": ">= 18"
50
51
  },
51
- "gitHead": "430001815157ebe09ea6b10fc66a58068ebbe3e0"
52
+ "gitHead": "5dc2b62ecd2eb2d4bee5dc72544d523de3d4d4e4"
52
53
  }