@sphereon/ui-components.credential-branding 0.2.1-unstable.32 → 0.2.1-unstable.41

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,27 +1,4 @@
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
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -73,6 +50,7 @@ var uuid_1 = require("uuid");
73
50
  var utils_1 = require("@veramo/utils");
74
51
  var ui_components_core_1 = require("@sphereon/ui-components.core");
75
52
  var ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
53
+ var services_1 = require("../services");
76
54
  var utils_2 = require("../utils");
77
55
  function findCorrelationIdName(correlationId, contacts) {
78
56
  var contact = contacts.find(function (contact) {
@@ -248,37 +226,28 @@ var toCredentialSummary = function (_a, branding, issuer, subject) {
248
226
  };
249
227
  exports.toCredentialSummary = toCredentialSummary;
250
228
  var selectAppLocaleBranding = function (args) { return __awaiter(void 0, void 0, void 0, function () {
251
- var appLocale, localeBranding, logo, imagePreloader, ReactNativeImagePreloader_1, WebImagePreloader_1, backgroundImage;
229
+ var appLocale, localeBranding, logo, imagePreloader, backgroundImage;
252
230
  var _a, _b, _c, _d, _e, _f, _g;
253
231
  return __generator(this, function (_h) {
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 navigator !== 'undefined' && navigator.product === 'ReactNative')) return [3, 2];
260
- return [4, Promise.resolve().then(function () { return __importStar(require('../services/ReactNativeImagePreloader')); })];
261
- case 1:
262
- ReactNativeImagePreloader_1 = (_h.sent()).ReactNativeImagePreloader;
263
- imagePreloader = new ReactNativeImagePreloader_1();
264
- return [3, 4];
265
- case 2: return [4, Promise.resolve().then(function () { return __importStar(require('../services/WebImagePreloader')); })];
266
- case 3:
267
- WebImagePreloader_1 = (_h.sent()).WebImagePreloader;
268
- imagePreloader = new WebImagePreloader_1();
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];
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
+ });
281
249
  }
250
+ return [2, localeBranding];
282
251
  });
283
252
  }); };
284
253
  exports.selectAppLocaleBranding = selectAppLocaleBranding;
@@ -42,23 +42,8 @@ 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;
46
45
  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
- }
46
+ return [2];
62
47
  });
63
48
  });
64
49
  };
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.32+552a747",
4
+ "version": "0.2.1-unstable.41+d51b793",
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.23.5-unstable.74+9c3c2083",
32
32
  "@sphereon/ssi-sdk.data-store": "0.23.5-unstable.74+9c3c2083",
33
33
  "@sphereon/ssi-types": "0.23.5-unstable.74+9c3c2083",
34
- "@sphereon/ui-components.core": "0.2.1-unstable.32+552a747",
34
+ "@sphereon/ui-components.core": "0.2.1-unstable.41+d51b793",
35
35
  "@veramo/core": "4.2.0",
36
36
  "@veramo/utils": "4.2.0",
37
37
  "i18n-js": "^3.8.0",
@@ -48,5 +48,5 @@
48
48
  "peerDependencies": {
49
49
  "react": ">= 18"
50
50
  },
51
- "gitHead": "552a747128c30a8e71f27a05c7d8a4da4e021789"
51
+ "gitHead": "d51b7933fbb6682fd52a6401b64229e555035a07"
52
52
  }