@ikas/storefront 0.0.136 → 0.0.138

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
@@ -24738,12 +24738,16 @@ var ThemeComponent = observer(function (_a) {
24738
24738
  });
24739
24739
 
24740
24740
  var IkasPageHead = observer(function (_a) {
24741
- var _b;
24741
+ var _b, _c;
24742
24742
  var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
24743
24743
  var ogpMetas = [];
24744
24744
  var schemas = [];
24745
24745
  var isCanonicalLinkAdd = false;
24746
24746
  var canonicalHref = "";
24747
+ if (typeof window !== "undefined") {
24748
+ document.documentElement.lang =
24749
+ ((_b = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; })) === null || _b === void 0 ? void 0 : _b.locale) || "tr";
24750
+ }
24747
24751
  if (props.addOgpMetas) {
24748
24752
  ogpMetas.push({
24749
24753
  property: "og:type",
@@ -24780,7 +24784,7 @@ var IkasPageHead = observer(function (_a) {
24780
24784
  if (productDetail.selectedVariant.mainImage) {
24781
24785
  ogpMetas.push({
24782
24786
  property: "og:image",
24783
- content: (_b = productDetail.selectedVariant.mainImage) === null || _b === void 0 ? void 0 : _b.src,
24787
+ content: (_c = productDetail.selectedVariant.mainImage) === null || _c === void 0 ? void 0 : _c.src,
24784
24788
  });
24785
24789
  }
24786
24790
  }
@@ -24949,6 +24953,7 @@ var IkasPage = observer(function (_a) {
24949
24953
  var propValues = _a.propValues, page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, addOgpMetas = _a.addOgpMetas;
24950
24954
  var store = IkasStorefrontConfig.store;
24951
24955
  var settings = useState(new IkasThemeSettings(JSON.parse(settingsStr)))[0];
24956
+ var _b = useState(false), mounted = _b[0], setMounted = _b[1];
24952
24957
  if (page) {
24953
24958
  store.currentPageType = page.type;
24954
24959
  }
@@ -24958,15 +24963,17 @@ var IkasPage = observer(function (_a) {
24958
24963
  //@ts-ignore
24959
24964
  store.cartStore.getCart();
24960
24965
  store.checkLocalization();
24966
+ setMounted(true);
24961
24967
  }, []);
24962
24968
  var headerComponentPropValue = propValues.find(function (pv) { return pv.component.isHeader; });
24963
24969
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
24964
24970
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
24971
+ var _pageStyle = __assign(__assign({}, pageStyle), { visibility: mounted ? "visible" : "hidden" });
24965
24972
  if (!page)
24966
24973
  return null;
24967
24974
  return (createElement(Fragment, null,
24968
24975
  createElement(IkasPageHead, { page: page, pageTitle: page.pageTitle, description: page.description, pageSpecificDataStr: pageSpecificDataStr, merchantSettings: merchantSettings, addOgpMetas: addOgpMetas }),
24969
- createElement("div", { style: pageStyle },
24976
+ createElement("div", { style: _pageStyle },
24970
24977
  createElement("div", null,
24971
24978
  headerComponentPropValue &&
24972
24979
  renderComponent(headerComponentPropValue, settings, -1),
@@ -29640,7 +29647,7 @@ var style = {
29640
29647
  backgroundColor: "rgba(255, 0, 0, 0.5)",
29641
29648
  };
29642
29649
 
29643
- var PACKAGE_VERSION = "0.0.133";
29650
+ var PACKAGE_VERSION = "0.0.138";
29644
29651
  var PageViewModel = /** @class */ (function () {
29645
29652
  function PageViewModel(router) {
29646
29653
  var _this = this;
@@ -30325,7 +30332,7 @@ var SettingsHelper = /** @class */ (function () {
30325
30332
  SettingsHelper.getSettings = function (locale) {
30326
30333
  var _this = this;
30327
30334
  return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
30328
- var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, favicon_1, themeLocalizationPath, routing_1;
30335
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, themeLocalizationPath, routing_1;
30329
30336
  return __generator(this, function (_a) {
30330
30337
  switch (_a.label) {
30331
30338
  case 0:
@@ -30367,7 +30374,6 @@ var SettingsHelper = /** @class */ (function () {
30367
30374
  storefront_1 = new IkasStorefront(settings.storefront);
30368
30375
  salesChannel_1 = new IkasSalesChannel(settings.salesChannel);
30369
30376
  localizationMap = settings.localizationMap;
30370
- favicon_1 = settings.favicon;
30371
30377
  themeLocalizationPath = localizationMap[locale];
30372
30378
  routing_1 = storefront_1.routings.find(function (r) { return r.id === locale || r.path === locale; });
30373
30379
  if (!themeLocalizationPath || !routing_1) {
@@ -30383,12 +30389,14 @@ var SettingsHelper = /** @class */ (function () {
30383
30389
  return resolve(null);
30384
30390
  }
30385
30391
  var result = file.length ? JSON.parse(file.toString()) : {};
30392
+ var themeLocalization = new IkasStorefrontThemeLocalization(result);
30393
+ var favicon = themeLocalization.themeJson.settings.favicon;
30386
30394
  resolve({
30387
30395
  storefront: storefront_1,
30388
- themeLocalization: new IkasStorefrontThemeLocalization(result),
30396
+ themeLocalization: themeLocalization,
30389
30397
  salesChannel: salesChannel_1,
30390
30398
  routing: routing_1,
30391
- favicon: favicon_1,
30399
+ favicon: favicon,
30392
30400
  });
30393
30401
  });
30394
30402
  _a.label = 5;
package/build/index.js CHANGED
@@ -24718,12 +24718,16 @@ var ThemeComponent = mobxReactLite.observer(function (_a) {
24718
24718
  });
24719
24719
 
24720
24720
  var IkasPageHead = mobxReactLite.observer(function (_a) {
24721
- var _b;
24721
+ var _b, _c;
24722
24722
  var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
24723
24723
  var ogpMetas = [];
24724
24724
  var schemas = [];
24725
24725
  var isCanonicalLinkAdd = false;
24726
24726
  var canonicalHref = "";
24727
+ if (typeof window !== "undefined") {
24728
+ document.documentElement.lang =
24729
+ ((_b = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; })) === null || _b === void 0 ? void 0 : _b.locale) || "tr";
24730
+ }
24727
24731
  if (props.addOgpMetas) {
24728
24732
  ogpMetas.push({
24729
24733
  property: "og:type",
@@ -24760,7 +24764,7 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
24760
24764
  if (productDetail.selectedVariant.mainImage) {
24761
24765
  ogpMetas.push({
24762
24766
  property: "og:image",
24763
- content: (_b = productDetail.selectedVariant.mainImage) === null || _b === void 0 ? void 0 : _b.src,
24767
+ content: (_c = productDetail.selectedVariant.mainImage) === null || _c === void 0 ? void 0 : _c.src,
24764
24768
  });
24765
24769
  }
24766
24770
  }
@@ -24929,6 +24933,7 @@ var IkasPage = mobxReactLite.observer(function (_a) {
24929
24933
  var propValues = _a.propValues, page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, settingsStr = _a.settingsStr, merchantSettings = _a.merchantSettings, addOgpMetas = _a.addOgpMetas;
24930
24934
  var store = IkasStorefrontConfig.store;
24931
24935
  var settings = React.useState(new IkasThemeSettings(JSON.parse(settingsStr)))[0];
24936
+ var _b = React.useState(false), mounted = _b[0], setMounted = _b[1];
24932
24937
  if (page) {
24933
24938
  store.currentPageType = page.type;
24934
24939
  }
@@ -24938,15 +24943,17 @@ var IkasPage = mobxReactLite.observer(function (_a) {
24938
24943
  //@ts-ignore
24939
24944
  store.cartStore.getCart();
24940
24945
  store.checkLocalization();
24946
+ setMounted(true);
24941
24947
  }, []);
24942
24948
  var headerComponentPropValue = propValues.find(function (pv) { return pv.component.isHeader; });
24943
24949
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
24944
24950
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
24951
+ var _pageStyle = __assign(__assign({}, pageStyle), { visibility: mounted ? "visible" : "hidden" });
24945
24952
  if (!page)
24946
24953
  return null;
24947
24954
  return (React.createElement(React.Fragment, null,
24948
24955
  React.createElement(IkasPageHead, { page: page, pageTitle: page.pageTitle, description: page.description, pageSpecificDataStr: pageSpecificDataStr, merchantSettings: merchantSettings, addOgpMetas: addOgpMetas }),
24949
- React.createElement("div", { style: pageStyle },
24956
+ React.createElement("div", { style: _pageStyle },
24950
24957
  React.createElement("div", null,
24951
24958
  headerComponentPropValue &&
24952
24959
  renderComponent(headerComponentPropValue, settings, -1),
@@ -29619,7 +29626,7 @@ var style = {
29619
29626
  backgroundColor: "rgba(255, 0, 0, 0.5)",
29620
29627
  };
29621
29628
 
29622
- var PACKAGE_VERSION = "0.0.133";
29629
+ var PACKAGE_VERSION = "0.0.138";
29623
29630
  var PageViewModel = /** @class */ (function () {
29624
29631
  function PageViewModel(router) {
29625
29632
  var _this = this;
@@ -30304,7 +30311,7 @@ var SettingsHelper = /** @class */ (function () {
30304
30311
  SettingsHelper.getSettings = function (locale) {
30305
30312
  var _this = this;
30306
30313
  return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
30307
- var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, favicon_1, themeLocalizationPath, routing_1;
30314
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, themeLocalizationPath, routing_1;
30308
30315
  return __generator(this, function (_a) {
30309
30316
  switch (_a.label) {
30310
30317
  case 0:
@@ -30346,7 +30353,6 @@ var SettingsHelper = /** @class */ (function () {
30346
30353
  storefront_1 = new IkasStorefront(settings.storefront);
30347
30354
  salesChannel_1 = new IkasSalesChannel(settings.salesChannel);
30348
30355
  localizationMap = settings.localizationMap;
30349
- favicon_1 = settings.favicon;
30350
30356
  themeLocalizationPath = localizationMap[locale];
30351
30357
  routing_1 = storefront_1.routings.find(function (r) { return r.id === locale || r.path === locale; });
30352
30358
  if (!themeLocalizationPath || !routing_1) {
@@ -30362,12 +30368,14 @@ var SettingsHelper = /** @class */ (function () {
30362
30368
  return resolve(null);
30363
30369
  }
30364
30370
  var result = file.length ? JSON.parse(file.toString()) : {};
30371
+ var themeLocalization = new IkasStorefrontThemeLocalization(result);
30372
+ var favicon = themeLocalization.themeJson.settings.favicon;
30365
30373
  resolve({
30366
30374
  storefront: storefront_1,
30367
- themeLocalization: new IkasStorefrontThemeLocalization(result),
30375
+ themeLocalization: themeLocalization,
30368
30376
  salesChannel: salesChannel_1,
30369
30377
  routing: routing_1,
30370
- favicon: favicon_1,
30378
+ favicon: favicon,
30371
30379
  });
30372
30380
  });
30373
30381
  _a.label = 5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.136",
3
+ "version": "0.0.138",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",