@ikas/storefront 0.0.167-alpha.20 → 0.0.167-alpha.4

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
@@ -17885,7 +17885,7 @@ var FacebookPixel = /** @class */ (function () {
17885
17885
  try {
17886
17886
  !isServer &&
17887
17887
  window.fbq &&
17888
- window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventID: eventId });
17888
+ window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventId: eventId });
17889
17889
  return;
17890
17890
  }
17891
17891
  catch (err) {
@@ -17907,7 +17907,7 @@ var FacebookPixel = /** @class */ (function () {
17907
17907
  try {
17908
17908
  !isServer &&
17909
17909
  window.fbq &&
17910
- window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventID: eventId });
17910
+ window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventId: eventId });
17911
17911
  return;
17912
17912
  }
17913
17913
  catch (err) {
@@ -23612,7 +23612,11 @@ var CheckoutViewModel = /** @class */ (function () {
23612
23612
  this.changeStep = function (step) { return __awaiter(_this, void 0, void 0, function () {
23613
23613
  return __generator(this, function (_a) {
23614
23614
  if (!isServer$1) {
23615
- window.location.replace(window.location.pathname + "?id=" + this.checkout.id + "&step=" + step);
23615
+ window.location.replace("/checkout?id=" + this.checkout.id + "&step=" + step);
23616
+ // await this.router.replace(
23617
+ // `/checkout?id=${this.checkout.id}&step=${step}`
23618
+ // );
23619
+ // this.router.reload();
23616
23620
  }
23617
23621
  return [2 /*return*/];
23618
23622
  });
@@ -32295,10 +32299,10 @@ var AnalyticsHead = function (_a) {
32295
32299
  blockHTML && (createElement("script", { dangerouslySetInnerHTML: {
32296
32300
  __html: "dataLayer = [{'gtm.blocklist': ['html']}];",
32297
32301
  } })),
32298
- gtmId && (createElement("script", { defer: true, dangerouslySetInnerHTML: {
32302
+ gtmId && (createElement("script", { dangerouslySetInnerHTML: {
32299
32303
  __html: "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','" + gtmId + "');",
32300
32304
  } })),
32301
- fbpId && (createElement("script", { defer: true, dangerouslySetInnerHTML: {
32305
+ fbpId && (createElement("script", { dangerouslySetInnerHTML: {
32302
32306
  __html: "!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '" + fbpId + "');\n fbq('track', 'PageView');",
32303
32307
  } })),
32304
32308
  storefrontJSScripts.map(function (script) { return htmlReactParser(script); })));
@@ -41466,14 +41470,18 @@ var IkasPage = observer(function (_a) {
41466
41470
  IkasStorefrontConfig.initWithJson(configJson);
41467
41471
  var store = IkasStorefrontConfig.store;
41468
41472
  var router = useRouter();
41469
- var _b = useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
41473
+ var _b = useState(false), mounted = _b[0], setMounted = _b[1];
41474
+ var _c = useState(false), isBrowser = _c[0], setIsBrowser = _c[1];
41470
41475
  var settings = useState(new IkasThemeSettings(JSON.parse(settingsStr)))[0];
41471
- var _c = useState(IkasPageDataProvider.initPropValues(propValuesStr, router, settingsStr)), propValues = _c[0], setPropValues = _c[1];
41476
+ var _d = useState(IkasPageDataProvider.initPropValues(propValuesStr, router, settingsStr)), propValues = _d[0], setPropValues = _d[1];
41472
41477
  store.currentPageType = pageType;
41473
41478
  useEffect(function () {
41479
+ //@ts-ignore
41480
+ store.setSettings(settingsStr);
41474
41481
  //@ts-ignore
41475
41482
  store.cartStore.getCart();
41476
41483
  store.checkLocalization();
41484
+ setMounted(true);
41477
41485
  }, []);
41478
41486
  useEffect(function () {
41479
41487
  if (reInitOnBrowser)
@@ -41487,6 +41495,7 @@ var IkasPage = observer(function (_a) {
41487
41495
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
41488
41496
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
41489
41497
  var pageStyle = {
41498
+ visibility: mounted ? "visible" : "hidden",
41490
41499
  position: "relative",
41491
41500
  minHeight: "100vh",
41492
41501
  display: "flex",
@@ -69912,7 +69921,6 @@ var ThemeEditorComponent = observer(function (_a) {
69912
69921
  }),
69913
69922
  }),
69914
69923
  checkoutSettings: new IkasCheckoutSettings(),
69915
- merchantSettings: null,
69916
69924
  customizationProps: __assign({}, propValues),
69917
69925
  returnPolicy: "",
69918
69926
  privacyPolicy: "",
@@ -70121,7 +70129,7 @@ var SettingsHelper = /** @class */ (function () {
70121
70129
  SettingsHelper.getSettings = function (locale) {
70122
70130
  var _this = this;
70123
70131
  return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
70124
- var isLocal, storefrontResponse, storefront, localTheme, colorScript, settings, storefront_1, salesChannel_1, localizationMap, storefrontJSScripts_1, domain_1, themeLocalizationPath, routing_1;
70132
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, storefrontJSScripts_1, domain_1, themeLocalizationPath, routing_1;
70125
70133
  return __generator(this, function (_a) {
70126
70134
  switch (_a.label) {
70127
70135
  case 0:
@@ -70140,7 +70148,6 @@ var SettingsHelper = /** @class */ (function () {
70140
70148
  return [4 /*yield*/, SettingsHelper.readLocalTheme()];
70141
70149
  case 2:
70142
70150
  localTheme = _a.sent();
70143
- colorScript = SettingsHelper.createColorScript(localTheme.settings);
70144
70151
  resolve({
70145
70152
  storefront: storefront,
70146
70153
  themeLocalization: new IkasStorefrontThemeLocalization({
@@ -70155,7 +70162,7 @@ var SettingsHelper = /** @class */ (function () {
70155
70162
  : new IkasStorefrontRouting({}),
70156
70163
  favicon: localTheme.settings.favicon,
70157
70164
  stockPreference: localTheme.settings.stockPreference,
70158
- storefrontJSScripts: colorScript ? [colorScript] : [],
70165
+ storefrontJSScripts: [],
70159
70166
  domain: "",
70160
70167
  });
70161
70168
  return [3 /*break*/, 5];
@@ -70187,11 +70194,6 @@ var SettingsHelper = /** @class */ (function () {
70187
70194
  var themeLocalization = new IkasStorefrontThemeLocalization(result);
70188
70195
  var favicon = themeLocalization.themeJson.settings.favicon;
70189
70196
  var stockPreference = themeLocalization.themeJson.settings.stockPreference;
70190
- if (themeLocalization.themeJson.settings) {
70191
- var colorScript = SettingsHelper.createColorScript(themeLocalization.themeJson.settings);
70192
- if (colorScript)
70193
- storefrontJSScripts_1.push(colorScript);
70194
- }
70195
70197
  resolve({
70196
70198
  storefront: storefront_1,
70197
70199
  themeLocalization: themeLocalization,
@@ -70352,15 +70354,6 @@ var SettingsHelper = /** @class */ (function () {
70352
70354
  });
70353
70355
  });
70354
70356
  };
70355
- SettingsHelper.createColorScript = function (settings) {
70356
- if (!settings.colors)
70357
- return;
70358
- return "<script>" + settings.colors
70359
- .map(function (sc) {
70360
- return "document.documentElement.style.setProperty(\"" + sc.key + "\",\"" + sc.color + "\");";
70361
- })
70362
- .join("\r\n") + "</script> \n ";
70363
- };
70364
70357
  return SettingsHelper;
70365
70358
  }());
70366
70359
 
package/build/index.js CHANGED
@@ -17893,7 +17893,7 @@ var FacebookPixel = /** @class */ (function () {
17893
17893
  try {
17894
17894
  !isServer &&
17895
17895
  window.fbq &&
17896
- window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventID: eventId });
17896
+ window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventId: eventId });
17897
17897
  return;
17898
17898
  }
17899
17899
  catch (err) {
@@ -17915,7 +17915,7 @@ var FacebookPixel = /** @class */ (function () {
17915
17915
  try {
17916
17916
  !isServer &&
17917
17917
  window.fbq &&
17918
- window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventID: eventId });
17918
+ window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventId: eventId });
17919
17919
  return;
17920
17920
  }
17921
17921
  catch (err) {
@@ -23620,7 +23620,11 @@ var CheckoutViewModel = /** @class */ (function () {
23620
23620
  this.changeStep = function (step) { return __awaiter(_this, void 0, void 0, function () {
23621
23621
  return __generator(this, function (_a) {
23622
23622
  if (!isServer$1) {
23623
- window.location.replace(window.location.pathname + "?id=" + this.checkout.id + "&step=" + step);
23623
+ window.location.replace("/checkout?id=" + this.checkout.id + "&step=" + step);
23624
+ // await this.router.replace(
23625
+ // `/checkout?id=${this.checkout.id}&step=${step}`
23626
+ // );
23627
+ // this.router.reload();
23624
23628
  }
23625
23629
  return [2 /*return*/];
23626
23630
  });
@@ -32303,10 +32307,10 @@ var AnalyticsHead = function (_a) {
32303
32307
  blockHTML && (React.createElement("script", { dangerouslySetInnerHTML: {
32304
32308
  __html: "dataLayer = [{'gtm.blocklist': ['html']}];",
32305
32309
  } })),
32306
- gtmId && (React.createElement("script", { defer: true, dangerouslySetInnerHTML: {
32310
+ gtmId && (React.createElement("script", { dangerouslySetInnerHTML: {
32307
32311
  __html: "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','" + gtmId + "');",
32308
32312
  } })),
32309
- fbpId && (React.createElement("script", { defer: true, dangerouslySetInnerHTML: {
32313
+ fbpId && (React.createElement("script", { dangerouslySetInnerHTML: {
32310
32314
  __html: "!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n fbq('init', '" + fbpId + "');\n fbq('track', 'PageView');",
32311
32315
  } })),
32312
32316
  storefrontJSScripts.map(function (script) { return htmlReactParser(script); })));
@@ -41446,14 +41450,18 @@ var IkasPage = mobxReactLite.observer(function (_a) {
41446
41450
  IkasStorefrontConfig.initWithJson(configJson);
41447
41451
  var store = IkasStorefrontConfig.store;
41448
41452
  var router$1 = router.useRouter();
41449
- var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
41453
+ var _b = React.useState(false), mounted = _b[0], setMounted = _b[1];
41454
+ var _c = React.useState(false), isBrowser = _c[0], setIsBrowser = _c[1];
41450
41455
  var settings = React.useState(new IkasThemeSettings(JSON.parse(settingsStr)))[0];
41451
- var _c = React.useState(IkasPageDataProvider.initPropValues(propValuesStr, router$1, settingsStr)), propValues = _c[0], setPropValues = _c[1];
41456
+ var _d = React.useState(IkasPageDataProvider.initPropValues(propValuesStr, router$1, settingsStr)), propValues = _d[0], setPropValues = _d[1];
41452
41457
  store.currentPageType = pageType;
41453
41458
  React.useEffect(function () {
41459
+ //@ts-ignore
41460
+ store.setSettings(settingsStr);
41454
41461
  //@ts-ignore
41455
41462
  store.cartStore.getCart();
41456
41463
  store.checkLocalization();
41464
+ setMounted(true);
41457
41465
  }, []);
41458
41466
  React.useEffect(function () {
41459
41467
  if (reInitOnBrowser)
@@ -41467,6 +41475,7 @@ var IkasPage = mobxReactLite.observer(function (_a) {
41467
41475
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
41468
41476
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
41469
41477
  var pageStyle = {
41478
+ visibility: mounted ? "visible" : "hidden",
41470
41479
  position: "relative",
41471
41480
  minHeight: "100vh",
41472
41481
  display: "flex",
@@ -69891,7 +69900,6 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
69891
69900
  }),
69892
69901
  }),
69893
69902
  checkoutSettings: new IkasCheckoutSettings(),
69894
- merchantSettings: null,
69895
69903
  customizationProps: __assign({}, propValues),
69896
69904
  returnPolicy: "",
69897
69905
  privacyPolicy: "",
@@ -70100,7 +70108,7 @@ var SettingsHelper = /** @class */ (function () {
70100
70108
  SettingsHelper.getSettings = function (locale) {
70101
70109
  var _this = this;
70102
70110
  return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
70103
- var isLocal, storefrontResponse, storefront, localTheme, colorScript, settings, storefront_1, salesChannel_1, localizationMap, storefrontJSScripts_1, domain_1, themeLocalizationPath, routing_1;
70111
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, storefrontJSScripts_1, domain_1, themeLocalizationPath, routing_1;
70104
70112
  return __generator(this, function (_a) {
70105
70113
  switch (_a.label) {
70106
70114
  case 0:
@@ -70119,7 +70127,6 @@ var SettingsHelper = /** @class */ (function () {
70119
70127
  return [4 /*yield*/, SettingsHelper.readLocalTheme()];
70120
70128
  case 2:
70121
70129
  localTheme = _a.sent();
70122
- colorScript = SettingsHelper.createColorScript(localTheme.settings);
70123
70130
  resolve({
70124
70131
  storefront: storefront,
70125
70132
  themeLocalization: new IkasStorefrontThemeLocalization({
@@ -70134,7 +70141,7 @@ var SettingsHelper = /** @class */ (function () {
70134
70141
  : new IkasStorefrontRouting({}),
70135
70142
  favicon: localTheme.settings.favicon,
70136
70143
  stockPreference: localTheme.settings.stockPreference,
70137
- storefrontJSScripts: colorScript ? [colorScript] : [],
70144
+ storefrontJSScripts: [],
70138
70145
  domain: "",
70139
70146
  });
70140
70147
  return [3 /*break*/, 5];
@@ -70166,11 +70173,6 @@ var SettingsHelper = /** @class */ (function () {
70166
70173
  var themeLocalization = new IkasStorefrontThemeLocalization(result);
70167
70174
  var favicon = themeLocalization.themeJson.settings.favicon;
70168
70175
  var stockPreference = themeLocalization.themeJson.settings.stockPreference;
70169
- if (themeLocalization.themeJson.settings) {
70170
- var colorScript = SettingsHelper.createColorScript(themeLocalization.themeJson.settings);
70171
- if (colorScript)
70172
- storefrontJSScripts_1.push(colorScript);
70173
- }
70174
70176
  resolve({
70175
70177
  storefront: storefront_1,
70176
70178
  themeLocalization: themeLocalization,
@@ -70331,15 +70333,6 @@ var SettingsHelper = /** @class */ (function () {
70331
70333
  });
70332
70334
  });
70333
70335
  };
70334
- SettingsHelper.createColorScript = function (settings) {
70335
- if (!settings.colors)
70336
- return;
70337
- return "<script>" + settings.colors
70338
- .map(function (sc) {
70339
- return "document.documentElement.style.setProperty(\"" + sc.key + "\",\"" + sc.color + "\");";
70340
- })
70341
- .join("\r\n") + "</script> \n ";
70342
- };
70343
70336
  return SettingsHelper;
70344
70337
  }());
70345
70338
 
@@ -7,7 +7,7 @@ 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
9
  import { IkasThemeFavicon } from "../models/theme/settings/prop/favicon/index";
10
- import { IkasThemeSettings, IkasThemeStockPreference } from "../models/theme/settings/index";
10
+ import { IkasThemeStockPreference } from "../models/theme/settings/index";
11
11
  export declare class SettingsHelper {
12
12
  static readLocalTheme(): Promise<IkasTheme>;
13
13
  static readSettingsFile(): Promise<any>;
@@ -213,7 +213,6 @@ export declare class SettingsHelper {
213
213
  notFound?: undefined;
214
214
  revalidate?: undefined;
215
215
  }>;
216
- static createColorScript(settings: IkasThemeSettings): string | undefined;
217
216
  }
218
217
  export declare type SettingsData = {
219
218
  storefront: IkasStorefront;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.167-alpha.20",
3
+ "version": "0.0.167-alpha.4",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",