@ikas/storefront 0.0.129 → 0.0.131

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/build/index.es.js CHANGED
@@ -10901,6 +10901,7 @@ var IkasStorefrontConfig = /** @class */ (function () {
10901
10901
  null,
10902
10902
  gtmId: IkasStorefrontConfig.gtmId || null,
10903
10903
  fbpId: IkasStorefrontConfig.fbpId || null,
10904
+ favicon: JSON.parse(JSON.stringify(IkasStorefrontConfig.favicon)),
10904
10905
  };
10905
10906
  };
10906
10907
  IkasStorefrontConfig.components = {};
@@ -10965,84 +10966,10 @@ var Apollo = /** @class */ (function () {
10965
10966
  }());
10966
10967
  var apollo = new Apollo();
10967
10968
 
10968
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
10969
- // require the crypto API and do not support built-in fallback to lower quality random number
10970
- // generators (like Math.random()).
10971
- var getRandomValues;
10972
- var rnds8 = new Uint8Array(16);
10973
- function rng() {
10974
- // lazy load so that environments that need to polyfill have a chance to do so
10975
- if (!getRandomValues) {
10976
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
10977
- // find the complete implementation of crypto (msCrypto) on IE11.
10978
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
10979
-
10980
- if (!getRandomValues) {
10981
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
10982
- }
10983
- }
10984
-
10985
- return getRandomValues(rnds8);
10986
- }
10987
-
10988
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
10989
-
10990
- function validate(uuid) {
10991
- return typeof uuid === 'string' && REGEX.test(uuid);
10992
- }
10993
-
10994
- /**
10995
- * Convert array of 16 byte values to UUID string format of the form:
10996
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
10997
- */
10998
-
10999
- var byteToHex = [];
11000
-
11001
- for (var i = 0; i < 256; ++i) {
11002
- byteToHex.push((i + 0x100).toString(16).substr(1));
11003
- }
11004
-
11005
- function stringify(arr) {
11006
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
11007
- // Note: Be careful editing this code! It's been tuned for performance
11008
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
11009
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
11010
- // of the following:
11011
- // - One or more input array values don't map to a hex octet (leading to
11012
- // "undefined" in the uuid)
11013
- // - Invalid input values for the RFC `version` or `variant` fields
11014
-
11015
- if (!validate(uuid)) {
11016
- throw TypeError('Stringified UUID is invalid');
11017
- }
11018
-
11019
- return uuid;
11020
- }
11021
-
11022
- function v4(options, buf, offset) {
11023
- options = options || {};
11024
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
11025
-
11026
- rnds[6] = rnds[6] & 0x0f | 0x40;
11027
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
11028
-
11029
- if (buf) {
11030
- offset = offset || 0;
11031
-
11032
- for (var i = 0; i < 16; ++i) {
11033
- buf[offset + i] = rnds[i];
11034
- }
11035
-
11036
- return buf;
11037
- }
11038
-
11039
- return stringify(rnds);
11040
- }
11041
-
11042
10969
  var IkasBlog = /** @class */ (function () {
11043
10970
  function IkasBlog(data) {
11044
10971
  if (data === void 0) { data = {}; }
11045
- this.id = data.id || v4();
10972
+ this.id = data.id || Date.now() + "";
11046
10973
  this.createdAt = data.createdAt || Date.now() + "";
11047
10974
  this.updatedAt = data.updatedAt || Date.now() + "";
11048
10975
  this.categoryId = data.categoryId || null;
@@ -11067,7 +10994,7 @@ var IkasBlog = /** @class */ (function () {
11067
10994
  var IkasBlogContent = /** @class */ (function () {
11068
10995
  function IkasBlogContent(data) {
11069
10996
  if (data === void 0) { data = {}; }
11070
- this.id = data.id || v4();
10997
+ this.id = data.id || Date.now() + "";
11071
10998
  this.createdAt = data.createdAt || Date.now() + "";
11072
10999
  this.updatedAt = data.updatedAt || Date.now() + "";
11073
11000
  this.content = data.content || "";
@@ -11094,7 +11021,7 @@ var IkasBlogMetaData = /** @class */ (function () {
11094
11021
  if (data === void 0) { data = {}; }
11095
11022
  this.pageTitle = null;
11096
11023
  this.description = null;
11097
- this.id = data.id || v4();
11024
+ this.id = data.id || Date.now() + "";
11098
11025
  this.createdAt = data.createdAt || Date.now() + "";
11099
11026
  this.updatedAt = data.updatedAt || Date.now() + "";
11100
11027
  this.description = data.description || "";
@@ -13455,7 +13382,7 @@ var IkasBrand = /** @class */ (function () {
13455
13382
  if (data === void 0) { data = {}; }
13456
13383
  this.metaData = null;
13457
13384
  this.image = null;
13458
- this.id = data.id || v4();
13385
+ this.id = data.id || Date.now() + "";
13459
13386
  this.name = data.name || "";
13460
13387
  this.metaData = data.metaData
13461
13388
  ? new IkasHTMLMetaData(data.metaData)
@@ -13481,7 +13408,7 @@ var IkasCategory = /** @class */ (function () {
13481
13408
  if (data === void 0) { data = {}; }
13482
13409
  this.metaData = null;
13483
13410
  this.image = null;
13484
- this.id = data.id || v4();
13411
+ this.id = data.id || Date.now() + "";
13485
13412
  this.name = data.name || "";
13486
13413
  this.parentId = data.parentId || null;
13487
13414
  this.metaData = data.metaData
@@ -20473,7 +20400,7 @@ var IkasProductAttributeValue = /** @class */ (function () {
20473
20400
  var IkasProductVariant = /** @class */ (function () {
20474
20401
  function IkasProductVariant(data) {
20475
20402
  if (data === void 0) { data = {}; }
20476
- this.id = data.id || v4();
20403
+ this.id = data.id || Date.now() + "";
20477
20404
  this.sku = data.sku || null;
20478
20405
  this.barcodeList = data.barcodeList || [];
20479
20406
  this.variantValues = data.variantValues
@@ -20564,7 +20491,7 @@ var IkasProductTag = /** @class */ (function () {
20564
20491
  var IkasProduct = /** @class */ (function () {
20565
20492
  function IkasProduct(data) {
20566
20493
  if (data === void 0) { data = {}; }
20567
- this.id = data.id || v4();
20494
+ this.id = data.id || Date.now() + "";
20568
20495
  this.name = data.name || "";
20569
20496
  this.type = data.type || IkasProductType.PHYSICAL;
20570
20497
  this.description = data.description || "";
@@ -21042,7 +20969,7 @@ var IkasTransactionTypeEnum;
21042
20969
 
21043
20970
  var IkasThemeComponentProp = /** @class */ (function () {
21044
20971
  function IkasThemeComponentProp(data) {
21045
- this.id = data.id || v4();
20972
+ this.id = data.id || Date.now() + "";
21046
20973
  this.name = data.name || "";
21047
20974
  this.displayName = data.displayName || "";
21048
20975
  this.type = data.type || IkasThemeComponentPropType.TEXT;
@@ -21156,7 +21083,7 @@ var IkasThemePageComponent = /** @class */ (function () {
21156
21083
 
21157
21084
  var IkasThemePage = /** @class */ (function () {
21158
21085
  function IkasThemePage(data) {
21159
- this.id = data.id || v4();
21086
+ this.id = data.id || Date.now() + "";
21160
21087
  this.name = data.name || null;
21161
21088
  this.type = data.type || IkasThemePageType.INDEX;
21162
21089
  this.slug = data.slug || null;
@@ -21206,6 +21133,80 @@ var IkasThemePageType;
21206
21133
  IkasThemePageType["BLOG_CATEGORY"] = "BLOG_CATEGORY";
21207
21134
  })(IkasThemePageType || (IkasThemePageType = {}));
21208
21135
 
21136
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
21137
+ // require the crypto API and do not support built-in fallback to lower quality random number
21138
+ // generators (like Math.random()).
21139
+ var getRandomValues;
21140
+ var rnds8 = new Uint8Array(16);
21141
+ function rng() {
21142
+ // lazy load so that environments that need to polyfill have a chance to do so
21143
+ if (!getRandomValues) {
21144
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
21145
+ // find the complete implementation of crypto (msCrypto) on IE11.
21146
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
21147
+
21148
+ if (!getRandomValues) {
21149
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
21150
+ }
21151
+ }
21152
+
21153
+ return getRandomValues(rnds8);
21154
+ }
21155
+
21156
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
21157
+
21158
+ function validate(uuid) {
21159
+ return typeof uuid === 'string' && REGEX.test(uuid);
21160
+ }
21161
+
21162
+ /**
21163
+ * Convert array of 16 byte values to UUID string format of the form:
21164
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
21165
+ */
21166
+
21167
+ var byteToHex = [];
21168
+
21169
+ for (var i = 0; i < 256; ++i) {
21170
+ byteToHex.push((i + 0x100).toString(16).substr(1));
21171
+ }
21172
+
21173
+ function stringify(arr) {
21174
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
21175
+ // Note: Be careful editing this code! It's been tuned for performance
21176
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
21177
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
21178
+ // of the following:
21179
+ // - One or more input array values don't map to a hex octet (leading to
21180
+ // "undefined" in the uuid)
21181
+ // - Invalid input values for the RFC `version` or `variant` fields
21182
+
21183
+ if (!validate(uuid)) {
21184
+ throw TypeError('Stringified UUID is invalid');
21185
+ }
21186
+
21187
+ return uuid;
21188
+ }
21189
+
21190
+ function v4(options, buf, offset) {
21191
+ options = options || {};
21192
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
21193
+
21194
+ rnds[6] = rnds[6] & 0x0f | 0x40;
21195
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
21196
+
21197
+ if (buf) {
21198
+ offset = offset || 0;
21199
+
21200
+ for (var i = 0; i < 16; ++i) {
21201
+ buf[offset + i] = rnds[i];
21202
+ }
21203
+
21204
+ return buf;
21205
+ }
21206
+
21207
+ return stringify(rnds);
21208
+ }
21209
+
21209
21210
  var IkasThemeColor = /** @class */ (function () {
21210
21211
  function IkasThemeColor(data) {
21211
21212
  this.id = data.id || v4();
@@ -21217,12 +21218,22 @@ var IkasThemeColor = /** @class */ (function () {
21217
21218
  return IkasThemeColor;
21218
21219
  }());
21219
21220
 
21221
+ var IkasThemeFavicon = /** @class */ (function () {
21222
+ function IkasThemeFavicon(data) {
21223
+ this.id = (data === null || data === void 0 ? void 0 : data.id) || null;
21224
+ makeAutoObservable(this);
21225
+ }
21226
+ return IkasThemeFavicon;
21227
+ }());
21228
+
21220
21229
  var IkasThemeSettings = /** @class */ (function () {
21221
21230
  function IkasThemeSettings(data) {
21222
21231
  if (data === void 0) { data = {}; }
21232
+ var _a;
21223
21233
  this.colors = data.colors
21224
21234
  ? data.colors.map(function (c) { return new IkasThemeColor(c); })
21225
21235
  : [];
21236
+ this.favicon = ((_a = data.favicon) === null || _a === void 0 ? void 0 : _a.id) ? data.favicon : new IkasThemeFavicon();
21226
21237
  makeAutoObservable(this);
21227
21238
  }
21228
21239
  return IkasThemeSettings;
@@ -30186,7 +30197,7 @@ var SettingsHelper = /** @class */ (function () {
30186
30197
  SettingsHelper.getSettings = function (locale) {
30187
30198
  var _this = this;
30188
30199
  return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
30189
- var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, themeLocalizationPath, routing_1;
30200
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, favicon_1, themeLocalizationPath, routing_1;
30190
30201
  return __generator(this, function (_a) {
30191
30202
  switch (_a.label) {
30192
30203
  case 0:
@@ -30217,6 +30228,7 @@ var SettingsHelper = /** @class */ (function () {
30217
30228
  ? storefront.routings.find(function (r) { return !r.path && !r.domain; }) ||
30218
30229
  storefront.routings[0]
30219
30230
  : new IkasStorefrontRouting({}),
30231
+ favicon: localTheme.settings.favicon,
30220
30232
  });
30221
30233
  return [3 /*break*/, 5];
30222
30234
  case 3: return [4 /*yield*/, SettingsHelper.readSettingsFile()];
@@ -30227,6 +30239,7 @@ var SettingsHelper = /** @class */ (function () {
30227
30239
  storefront_1 = new IkasStorefront(settings.storefront);
30228
30240
  salesChannel_1 = new IkasSalesChannel(settings.salesChannel);
30229
30241
  localizationMap = settings.localizationMap;
30242
+ favicon_1 = settings.favicon;
30230
30243
  themeLocalizationPath = localizationMap[locale];
30231
30244
  routing_1 = storefront_1.routings.find(function (r) { return r.id === locale || r.path === locale; });
30232
30245
  if (!themeLocalizationPath || !routing_1) {
@@ -30247,6 +30260,7 @@ var SettingsHelper = /** @class */ (function () {
30247
30260
  themeLocalization: new IkasStorefrontThemeLocalization(result),
30248
30261
  salesChannel: salesChannel_1,
30249
30262
  routing: routing_1,
30263
+ favicon: favicon_1,
30250
30264
  });
30251
30265
  });
30252
30266
  _a.label = 5;
@@ -30258,7 +30272,7 @@ var SettingsHelper = /** @class */ (function () {
30258
30272
  SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
30259
30273
  var _a;
30260
30274
  return __awaiter(this, void 0, void 0, function () {
30261
- var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
30275
+ var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, provider;
30262
30276
  return __generator(this, function (_b) {
30263
30277
  switch (_b.label) {
30264
30278
  case 0:
@@ -30281,7 +30295,7 @@ var SettingsHelper = /** @class */ (function () {
30281
30295
  notFound: true,
30282
30296
  }];
30283
30297
  }
30284
- storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
30298
+ storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing, favicon = settings.favicon;
30285
30299
  IkasStorefrontConfig.storefrontId = storefront.id;
30286
30300
  IkasStorefrontConfig.storefrontRoutingId = routing.id;
30287
30301
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
@@ -30292,6 +30306,7 @@ var SettingsHelper = /** @class */ (function () {
30292
30306
  IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
30293
30307
  IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
30294
30308
  IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
30309
+ IkasStorefrontConfig.favicon = favicon || null;
30295
30310
  provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
30296
30311
  provider.possiblePageTypes = possiblePageTypes;
30297
30312
  return [4 /*yield*/, provider.getPageData()];
package/build/index.js CHANGED
@@ -10916,6 +10916,7 @@ var IkasStorefrontConfig = /** @class */ (function () {
10916
10916
  null,
10917
10917
  gtmId: IkasStorefrontConfig.gtmId || null,
10918
10918
  fbpId: IkasStorefrontConfig.fbpId || null,
10919
+ favicon: JSON.parse(JSON.stringify(IkasStorefrontConfig.favicon)),
10919
10920
  };
10920
10921
  };
10921
10922
  IkasStorefrontConfig.components = {};
@@ -10980,84 +10981,10 @@ var Apollo = /** @class */ (function () {
10980
10981
  }());
10981
10982
  var apollo = new Apollo();
10982
10983
 
10983
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
10984
- // require the crypto API and do not support built-in fallback to lower quality random number
10985
- // generators (like Math.random()).
10986
- var getRandomValues;
10987
- var rnds8 = new Uint8Array(16);
10988
- function rng() {
10989
- // lazy load so that environments that need to polyfill have a chance to do so
10990
- if (!getRandomValues) {
10991
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
10992
- // find the complete implementation of crypto (msCrypto) on IE11.
10993
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
10994
-
10995
- if (!getRandomValues) {
10996
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
10997
- }
10998
- }
10999
-
11000
- return getRandomValues(rnds8);
11001
- }
11002
-
11003
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
11004
-
11005
- function validate(uuid) {
11006
- return typeof uuid === 'string' && REGEX.test(uuid);
11007
- }
11008
-
11009
- /**
11010
- * Convert array of 16 byte values to UUID string format of the form:
11011
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
11012
- */
11013
-
11014
- var byteToHex = [];
11015
-
11016
- for (var i = 0; i < 256; ++i) {
11017
- byteToHex.push((i + 0x100).toString(16).substr(1));
11018
- }
11019
-
11020
- function stringify(arr) {
11021
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
11022
- // Note: Be careful editing this code! It's been tuned for performance
11023
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
11024
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
11025
- // of the following:
11026
- // - One or more input array values don't map to a hex octet (leading to
11027
- // "undefined" in the uuid)
11028
- // - Invalid input values for the RFC `version` or `variant` fields
11029
-
11030
- if (!validate(uuid)) {
11031
- throw TypeError('Stringified UUID is invalid');
11032
- }
11033
-
11034
- return uuid;
11035
- }
11036
-
11037
- function v4(options, buf, offset) {
11038
- options = options || {};
11039
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
11040
-
11041
- rnds[6] = rnds[6] & 0x0f | 0x40;
11042
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
11043
-
11044
- if (buf) {
11045
- offset = offset || 0;
11046
-
11047
- for (var i = 0; i < 16; ++i) {
11048
- buf[offset + i] = rnds[i];
11049
- }
11050
-
11051
- return buf;
11052
- }
11053
-
11054
- return stringify(rnds);
11055
- }
11056
-
11057
10984
  var IkasBlog = /** @class */ (function () {
11058
10985
  function IkasBlog(data) {
11059
10986
  if (data === void 0) { data = {}; }
11060
- this.id = data.id || v4();
10987
+ this.id = data.id || Date.now() + "";
11061
10988
  this.createdAt = data.createdAt || Date.now() + "";
11062
10989
  this.updatedAt = data.updatedAt || Date.now() + "";
11063
10990
  this.categoryId = data.categoryId || null;
@@ -11082,7 +11009,7 @@ var IkasBlog = /** @class */ (function () {
11082
11009
  var IkasBlogContent = /** @class */ (function () {
11083
11010
  function IkasBlogContent(data) {
11084
11011
  if (data === void 0) { data = {}; }
11085
- this.id = data.id || v4();
11012
+ this.id = data.id || Date.now() + "";
11086
11013
  this.createdAt = data.createdAt || Date.now() + "";
11087
11014
  this.updatedAt = data.updatedAt || Date.now() + "";
11088
11015
  this.content = data.content || "";
@@ -11108,7 +11035,7 @@ var IkasBlogMetaData = /** @class */ (function () {
11108
11035
  if (data === void 0) { data = {}; }
11109
11036
  this.pageTitle = null;
11110
11037
  this.description = null;
11111
- this.id = data.id || v4();
11038
+ this.id = data.id || Date.now() + "";
11112
11039
  this.createdAt = data.createdAt || Date.now() + "";
11113
11040
  this.updatedAt = data.updatedAt || Date.now() + "";
11114
11041
  this.description = data.description || "";
@@ -13468,7 +13395,7 @@ var IkasBrand = /** @class */ (function () {
13468
13395
  if (data === void 0) { data = {}; }
13469
13396
  this.metaData = null;
13470
13397
  this.image = null;
13471
- this.id = data.id || v4();
13398
+ this.id = data.id || Date.now() + "";
13472
13399
  this.name = data.name || "";
13473
13400
  this.metaData = data.metaData
13474
13401
  ? new IkasHTMLMetaData(data.metaData)
@@ -13494,7 +13421,7 @@ var IkasCategory = /** @class */ (function () {
13494
13421
  if (data === void 0) { data = {}; }
13495
13422
  this.metaData = null;
13496
13423
  this.image = null;
13497
- this.id = data.id || v4();
13424
+ this.id = data.id || Date.now() + "";
13498
13425
  this.name = data.name || "";
13499
13426
  this.parentId = data.parentId || null;
13500
13427
  this.metaData = data.metaData
@@ -20470,7 +20397,7 @@ var IkasProductAttributeValue = /** @class */ (function () {
20470
20397
  var IkasProductVariant = /** @class */ (function () {
20471
20398
  function IkasProductVariant(data) {
20472
20399
  if (data === void 0) { data = {}; }
20473
- this.id = data.id || v4();
20400
+ this.id = data.id || Date.now() + "";
20474
20401
  this.sku = data.sku || null;
20475
20402
  this.barcodeList = data.barcodeList || [];
20476
20403
  this.variantValues = data.variantValues
@@ -20560,7 +20487,7 @@ var IkasProductTag = /** @class */ (function () {
20560
20487
  var IkasProduct = /** @class */ (function () {
20561
20488
  function IkasProduct(data) {
20562
20489
  if (data === void 0) { data = {}; }
20563
- this.id = data.id || v4();
20490
+ this.id = data.id || Date.now() + "";
20564
20491
  this.name = data.name || "";
20565
20492
  this.type = data.type || exports.IkasProductType.PHYSICAL;
20566
20493
  this.description = data.description || "";
@@ -21032,7 +20959,7 @@ var IkasTransactionCardTypeEnum;
21032
20959
 
21033
20960
  var IkasThemeComponentProp = /** @class */ (function () {
21034
20961
  function IkasThemeComponentProp(data) {
21035
- this.id = data.id || v4();
20962
+ this.id = data.id || Date.now() + "";
21036
20963
  this.name = data.name || "";
21037
20964
  this.displayName = data.displayName || "";
21038
20965
  this.type = data.type || exports.IkasThemeComponentPropType.TEXT;
@@ -21144,7 +21071,7 @@ var IkasThemePageComponent = /** @class */ (function () {
21144
21071
 
21145
21072
  var IkasThemePage = /** @class */ (function () {
21146
21073
  function IkasThemePage(data) {
21147
- this.id = data.id || v4();
21074
+ this.id = data.id || Date.now() + "";
21148
21075
  this.name = data.name || null;
21149
21076
  this.type = data.type || exports.IkasThemePageType.INDEX;
21150
21077
  this.slug = data.slug || null;
@@ -21193,6 +21120,80 @@ var IkasThemePageSpecification = /** @class */ (function () {
21193
21120
  IkasThemePageType["BLOG_CATEGORY"] = "BLOG_CATEGORY";
21194
21121
  })(exports.IkasThemePageType || (exports.IkasThemePageType = {}));
21195
21122
 
21123
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
21124
+ // require the crypto API and do not support built-in fallback to lower quality random number
21125
+ // generators (like Math.random()).
21126
+ var getRandomValues;
21127
+ var rnds8 = new Uint8Array(16);
21128
+ function rng() {
21129
+ // lazy load so that environments that need to polyfill have a chance to do so
21130
+ if (!getRandomValues) {
21131
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
21132
+ // find the complete implementation of crypto (msCrypto) on IE11.
21133
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
21134
+
21135
+ if (!getRandomValues) {
21136
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
21137
+ }
21138
+ }
21139
+
21140
+ return getRandomValues(rnds8);
21141
+ }
21142
+
21143
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
21144
+
21145
+ function validate(uuid) {
21146
+ return typeof uuid === 'string' && REGEX.test(uuid);
21147
+ }
21148
+
21149
+ /**
21150
+ * Convert array of 16 byte values to UUID string format of the form:
21151
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
21152
+ */
21153
+
21154
+ var byteToHex = [];
21155
+
21156
+ for (var i = 0; i < 256; ++i) {
21157
+ byteToHex.push((i + 0x100).toString(16).substr(1));
21158
+ }
21159
+
21160
+ function stringify(arr) {
21161
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
21162
+ // Note: Be careful editing this code! It's been tuned for performance
21163
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
21164
+ var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
21165
+ // of the following:
21166
+ // - One or more input array values don't map to a hex octet (leading to
21167
+ // "undefined" in the uuid)
21168
+ // - Invalid input values for the RFC `version` or `variant` fields
21169
+
21170
+ if (!validate(uuid)) {
21171
+ throw TypeError('Stringified UUID is invalid');
21172
+ }
21173
+
21174
+ return uuid;
21175
+ }
21176
+
21177
+ function v4(options, buf, offset) {
21178
+ options = options || {};
21179
+ var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
21180
+
21181
+ rnds[6] = rnds[6] & 0x0f | 0x40;
21182
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
21183
+
21184
+ if (buf) {
21185
+ offset = offset || 0;
21186
+
21187
+ for (var i = 0; i < 16; ++i) {
21188
+ buf[offset + i] = rnds[i];
21189
+ }
21190
+
21191
+ return buf;
21192
+ }
21193
+
21194
+ return stringify(rnds);
21195
+ }
21196
+
21196
21197
  var IkasThemeColor = /** @class */ (function () {
21197
21198
  function IkasThemeColor(data) {
21198
21199
  this.id = data.id || v4();
@@ -21204,12 +21205,22 @@ var IkasThemeColor = /** @class */ (function () {
21204
21205
  return IkasThemeColor;
21205
21206
  }());
21206
21207
 
21208
+ var IkasThemeFavicon = /** @class */ (function () {
21209
+ function IkasThemeFavicon(data) {
21210
+ this.id = (data === null || data === void 0 ? void 0 : data.id) || null;
21211
+ mobx.makeAutoObservable(this);
21212
+ }
21213
+ return IkasThemeFavicon;
21214
+ }());
21215
+
21207
21216
  var IkasThemeSettings = /** @class */ (function () {
21208
21217
  function IkasThemeSettings(data) {
21209
21218
  if (data === void 0) { data = {}; }
21219
+ var _a;
21210
21220
  this.colors = data.colors
21211
21221
  ? data.colors.map(function (c) { return new IkasThemeColor(c); })
21212
21222
  : [];
21223
+ this.favicon = ((_a = data.favicon) === null || _a === void 0 ? void 0 : _a.id) ? data.favicon : new IkasThemeFavicon();
21213
21224
  mobx.makeAutoObservable(this);
21214
21225
  }
21215
21226
  return IkasThemeSettings;
@@ -30164,7 +30175,7 @@ var SettingsHelper = /** @class */ (function () {
30164
30175
  SettingsHelper.getSettings = function (locale) {
30165
30176
  var _this = this;
30166
30177
  return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
30167
- var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, themeLocalizationPath, routing_1;
30178
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, favicon_1, themeLocalizationPath, routing_1;
30168
30179
  return __generator(this, function (_a) {
30169
30180
  switch (_a.label) {
30170
30181
  case 0:
@@ -30195,6 +30206,7 @@ var SettingsHelper = /** @class */ (function () {
30195
30206
  ? storefront.routings.find(function (r) { return !r.path && !r.domain; }) ||
30196
30207
  storefront.routings[0]
30197
30208
  : new IkasStorefrontRouting({}),
30209
+ favicon: localTheme.settings.favicon,
30198
30210
  });
30199
30211
  return [3 /*break*/, 5];
30200
30212
  case 3: return [4 /*yield*/, SettingsHelper.readSettingsFile()];
@@ -30205,6 +30217,7 @@ var SettingsHelper = /** @class */ (function () {
30205
30217
  storefront_1 = new IkasStorefront(settings.storefront);
30206
30218
  salesChannel_1 = new IkasSalesChannel(settings.salesChannel);
30207
30219
  localizationMap = settings.localizationMap;
30220
+ favicon_1 = settings.favicon;
30208
30221
  themeLocalizationPath = localizationMap[locale];
30209
30222
  routing_1 = storefront_1.routings.find(function (r) { return r.id === locale || r.path === locale; });
30210
30223
  if (!themeLocalizationPath || !routing_1) {
@@ -30225,6 +30238,7 @@ var SettingsHelper = /** @class */ (function () {
30225
30238
  themeLocalization: new IkasStorefrontThemeLocalization(result),
30226
30239
  salesChannel: salesChannel_1,
30227
30240
  routing: routing_1,
30241
+ favicon: favicon_1,
30228
30242
  });
30229
30243
  });
30230
30244
  _a.label = 5;
@@ -30236,7 +30250,7 @@ var SettingsHelper = /** @class */ (function () {
30236
30250
  SettingsHelper.getPageData = function (context, isServer, pageType, possiblePageTypes) {
30237
30251
  var _a;
30238
30252
  return __awaiter(this, void 0, void 0, function () {
30239
- var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, provider;
30253
+ var isLocal, locale, settings, storefront, themeLocalization, salesChannel, routing, favicon, provider;
30240
30254
  return __generator(this, function (_b) {
30241
30255
  switch (_b.label) {
30242
30256
  case 0:
@@ -30259,7 +30273,7 @@ var SettingsHelper = /** @class */ (function () {
30259
30273
  notFound: true,
30260
30274
  }];
30261
30275
  }
30262
- storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing;
30276
+ storefront = settings.storefront, themeLocalization = settings.themeLocalization, salesChannel = settings.salesChannel, routing = settings.routing, favicon = settings.favicon;
30263
30277
  IkasStorefrontConfig.storefrontId = storefront.id;
30264
30278
  IkasStorefrontConfig.storefrontRoutingId = routing.id;
30265
30279
  IkasStorefrontConfig.storefrontThemeId = storefront.mainStorefrontThemeId;
@@ -30270,6 +30284,7 @@ var SettingsHelper = /** @class */ (function () {
30270
30284
  IkasStorefrontConfig.paymentGateways = salesChannel.paymentGateways || [];
30271
30285
  IkasStorefrontConfig.gtmId = storefront.gtmId || undefined;
30272
30286
  IkasStorefrontConfig.fbpId = storefront.fbpId || undefined;
30287
+ IkasStorefrontConfig.favicon = favicon || null;
30273
30288
  provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
30274
30289
  provider.possiblePageTypes = possiblePageTypes;
30275
30290
  return [4 /*yield*/, provider.getPageData()];
@@ -1,5 +1,7 @@
1
- import { IkasThemeColor } from "./prop/index";
1
+ import { IkasThemeColor } from "./prop/color/index";
2
+ import { IkasThemeFavicon } from "./prop/favicon/index";
2
3
  export declare class IkasThemeSettings {
3
4
  colors: IkasThemeColor[];
5
+ favicon: IkasThemeFavicon;
4
6
  constructor(data?: Partial<IkasThemeSettings>);
5
7
  }
@@ -0,0 +1,4 @@
1
+ export declare class IkasThemeFavicon {
2
+ id: string | null;
3
+ constructor(data?: Partial<IkasThemeFavicon>);
4
+ }
@@ -1,5 +1,6 @@
1
1
  import { IkasSalesChannelPaymentGateway } from "../models/data/sales-channel/index";
2
2
  import { IkasStorefrontRouting } from "../models/data/storefront/routing/index";
3
+ import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon/index";
3
4
  import { IkasBaseStore } from "../store/index";
4
5
  export declare class IkasStorefrontConfig {
5
6
  static store: IkasBaseStore;
@@ -16,6 +17,7 @@ export declare class IkasStorefrontConfig {
16
17
  static paymentGateways: IkasSalesChannelPaymentGateway[];
17
18
  static gtmId?: string;
18
19
  static fbpId?: string;
20
+ static favicon: IkasThemeFavicon;
19
21
  static init(store: IkasBaseStore, components: any, config: Record<string, any>, apiUrlOverride?: string): void;
20
22
  static initWithJson(json: Record<string, any>): void;
21
23
  static getJson(): {
@@ -29,5 +31,6 @@ export declare class IkasStorefrontConfig {
29
31
  paymentGateways: any;
30
32
  gtmId: string | null;
31
33
  fbpId: string | null;
34
+ favicon: any;
32
35
  };
33
36
  }
@@ -34,6 +34,7 @@ export declare class IkasPageDataProvider {
34
34
  paymentGateways: any;
35
35
  gtmId: string | null;
36
36
  fbpId: string | null;
37
+ favicon: any;
37
38
  };
38
39
  };
39
40
  };
@@ -6,6 +6,7 @@ import { IkasStorefront } from "../models/data/storefront/index";
6
6
  import { IkasSalesChannel } from "../models/data/sales-channel/index";
7
7
  import { IkasStorefrontRouting } from "../models/data/storefront/routing/index";
8
8
  import { IkasStorefrontThemeLocalization } from "../models/data/storefront/theme-localization/index";
9
+ import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon/index";
9
10
  export declare class SettingsHelper {
10
11
  static readLocalTheme(): Promise<IkasTheme>;
11
12
  static readSettingsFile(): Promise<any>;
@@ -28,6 +29,7 @@ export declare class SettingsHelper {
28
29
  paymentGateways: any;
29
30
  gtmId: string | null;
30
31
  fbpId: string | null;
32
+ favicon: any;
31
33
  };
32
34
  };
33
35
  } | {
@@ -52,6 +54,7 @@ export declare class SettingsHelper {
52
54
  paymentGateways: any;
53
55
  gtmId: string | null;
54
56
  fbpId: string | null;
57
+ favicon: any;
55
58
  };
56
59
  };
57
60
  revalidate: number;
@@ -75,6 +78,7 @@ export declare class SettingsHelper {
75
78
  paymentGateways: any;
76
79
  gtmId: string | null;
77
80
  fbpId: string | null;
81
+ favicon: any;
78
82
  };
79
83
  };
80
84
  } | {
@@ -99,6 +103,7 @@ export declare class SettingsHelper {
99
103
  paymentGateways: any;
100
104
  gtmId: string | null;
101
105
  fbpId: string | null;
106
+ favicon: any;
102
107
  };
103
108
  };
104
109
  revalidate: number;
@@ -122,6 +127,7 @@ export declare class SettingsHelper {
122
127
  paymentGateways: any;
123
128
  gtmId: string | null;
124
129
  fbpId: string | null;
130
+ favicon: any;
125
131
  };
126
132
  };
127
133
  } | {
@@ -146,6 +152,7 @@ export declare class SettingsHelper {
146
152
  paymentGateways: any;
147
153
  gtmId: string | null;
148
154
  fbpId: string | null;
155
+ favicon: any;
149
156
  };
150
157
  };
151
158
  revalidate: number;
@@ -157,4 +164,5 @@ export declare type SettingsData = {
157
164
  themeLocalization: IkasStorefrontThemeLocalization;
158
165
  salesChannel: IkasSalesChannel;
159
166
  routing: IkasStorefrontRouting;
167
+ favicon: IkasThemeFavicon;
160
168
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.129",
3
+ "version": "0.0.131",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",