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

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
@@ -11446,15 +11446,12 @@ var IkasOrderLineVariant = /** @class */ (function () {
11446
11446
  get: function () {
11447
11447
  if (!this.slug)
11448
11448
  return;
11449
- var variantParams = this.variantValues
11450
- .map(function (vv) {
11451
- return vv.variantTypeSlug + "=" + vv.variantNameSlug;
11452
- })
11453
- .join("&");
11454
- if (variantParams)
11455
- return "/" + this.slug + "?" + variantParams;
11456
- else
11457
- return "/" + this.slug;
11449
+ if (!!this.variantValues.length) {
11450
+ return "/" + this.slug + "-" + this.variantValues
11451
+ .map(function (vv) { return vv.variantNameSlug; })
11452
+ .join("-");
11453
+ }
11454
+ return "/" + this.slug;
11458
11455
  },
11459
11456
  enumerable: false,
11460
11457
  configurable: true
@@ -17885,7 +17882,7 @@ var FacebookPixel = /** @class */ (function () {
17885
17882
  try {
17886
17883
  !isServer &&
17887
17884
  window.fbq &&
17888
- window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventID: eventId });
17885
+ window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventId: eventId });
17889
17886
  return;
17890
17887
  }
17891
17888
  catch (err) {
@@ -17907,7 +17904,7 @@ var FacebookPixel = /** @class */ (function () {
17907
17904
  try {
17908
17905
  !isServer &&
17909
17906
  window.fbq &&
17910
- window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventID: eventId });
17907
+ window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventId: eventId });
17911
17908
  return;
17912
17909
  }
17913
17910
  catch (err) {
@@ -23612,7 +23609,11 @@ var CheckoutViewModel = /** @class */ (function () {
23612
23609
  this.changeStep = function (step) { return __awaiter(_this, void 0, void 0, function () {
23613
23610
  return __generator(this, function (_a) {
23614
23611
  if (!isServer$1) {
23615
- window.location.replace(window.location.pathname + "?id=" + this.checkout.id + "&step=" + step);
23612
+ window.location.replace("/checkout?id=" + this.checkout.id + "&step=" + step);
23613
+ // await this.router.replace(
23614
+ // `/checkout?id=${this.checkout.id}&step=${step}`
23615
+ // );
23616
+ // this.router.reload();
23616
23617
  }
23617
23618
  return [2 /*return*/];
23618
23619
  });
@@ -32295,10 +32296,10 @@ var AnalyticsHead = function (_a) {
32295
32296
  blockHTML && (createElement("script", { dangerouslySetInnerHTML: {
32296
32297
  __html: "dataLayer = [{'gtm.blocklist': ['html']}];",
32297
32298
  } })),
32298
- gtmId && (createElement("script", { defer: true, dangerouslySetInnerHTML: {
32299
+ gtmId && (createElement("script", { dangerouslySetInnerHTML: {
32299
32300
  __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
32301
  } })),
32301
- fbpId && (createElement("script", { defer: true, dangerouslySetInnerHTML: {
32302
+ fbpId && (createElement("script", { dangerouslySetInnerHTML: {
32302
32303
  __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
32304
  } })),
32304
32305
  storefrontJSScripts.map(function (script) { return htmlReactParser(script); })));
@@ -41466,14 +41467,18 @@ var IkasPage = observer(function (_a) {
41466
41467
  IkasStorefrontConfig.initWithJson(configJson);
41467
41468
  var store = IkasStorefrontConfig.store;
41468
41469
  var router = useRouter();
41469
- var _b = useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
41470
+ var _b = useState(false), mounted = _b[0], setMounted = _b[1];
41471
+ var _c = useState(false), isBrowser = _c[0], setIsBrowser = _c[1];
41470
41472
  var settings = useState(new IkasThemeSettings(JSON.parse(settingsStr)))[0];
41471
- var _c = useState(IkasPageDataProvider.initPropValues(propValuesStr, router, settingsStr)), propValues = _c[0], setPropValues = _c[1];
41473
+ var _d = useState(IkasPageDataProvider.initPropValues(propValuesStr, router, settingsStr)), propValues = _d[0], setPropValues = _d[1];
41472
41474
  store.currentPageType = pageType;
41473
41475
  useEffect(function () {
41476
+ //@ts-ignore
41477
+ store.setSettings(settingsStr);
41474
41478
  //@ts-ignore
41475
41479
  store.cartStore.getCart();
41476
41480
  store.checkLocalization();
41481
+ setMounted(true);
41477
41482
  }, []);
41478
41483
  useEffect(function () {
41479
41484
  if (reInitOnBrowser)
@@ -41487,6 +41492,7 @@ var IkasPage = observer(function (_a) {
41487
41492
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
41488
41493
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
41489
41494
  var pageStyle = {
41495
+ visibility: mounted ? "visible" : "hidden",
41490
41496
  position: "relative",
41491
41497
  minHeight: "100vh",
41492
41498
  display: "flex",
@@ -69912,7 +69918,6 @@ var ThemeEditorComponent = observer(function (_a) {
69912
69918
  }),
69913
69919
  }),
69914
69920
  checkoutSettings: new IkasCheckoutSettings(),
69915
- merchantSettings: null,
69916
69921
  customizationProps: __assign({}, propValues),
69917
69922
  returnPolicy: "",
69918
69923
  privacyPolicy: "",
@@ -70121,7 +70126,7 @@ var SettingsHelper = /** @class */ (function () {
70121
70126
  SettingsHelper.getSettings = function (locale) {
70122
70127
  var _this = this;
70123
70128
  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;
70129
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, storefrontJSScripts_1, domain_1, themeLocalizationPath, routing_1;
70125
70130
  return __generator(this, function (_a) {
70126
70131
  switch (_a.label) {
70127
70132
  case 0:
@@ -70140,7 +70145,6 @@ var SettingsHelper = /** @class */ (function () {
70140
70145
  return [4 /*yield*/, SettingsHelper.readLocalTheme()];
70141
70146
  case 2:
70142
70147
  localTheme = _a.sent();
70143
- colorScript = SettingsHelper.createColorScript(localTheme.settings);
70144
70148
  resolve({
70145
70149
  storefront: storefront,
70146
70150
  themeLocalization: new IkasStorefrontThemeLocalization({
@@ -70155,7 +70159,7 @@ var SettingsHelper = /** @class */ (function () {
70155
70159
  : new IkasStorefrontRouting({}),
70156
70160
  favicon: localTheme.settings.favicon,
70157
70161
  stockPreference: localTheme.settings.stockPreference,
70158
- storefrontJSScripts: colorScript ? [colorScript] : [],
70162
+ storefrontJSScripts: [],
70159
70163
  domain: "",
70160
70164
  });
70161
70165
  return [3 /*break*/, 5];
@@ -70187,11 +70191,6 @@ var SettingsHelper = /** @class */ (function () {
70187
70191
  var themeLocalization = new IkasStorefrontThemeLocalization(result);
70188
70192
  var favicon = themeLocalization.themeJson.settings.favicon;
70189
70193
  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
70194
  resolve({
70196
70195
  storefront: storefront_1,
70197
70196
  themeLocalization: themeLocalization,
@@ -70352,15 +70351,6 @@ var SettingsHelper = /** @class */ (function () {
70352
70351
  });
70353
70352
  });
70354
70353
  };
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
70354
  return SettingsHelper;
70365
70355
  }());
70366
70356
 
package/build/index.js CHANGED
@@ -11462,15 +11462,12 @@ var IkasOrderLineVariant = /** @class */ (function () {
11462
11462
  get: function () {
11463
11463
  if (!this.slug)
11464
11464
  return;
11465
- var variantParams = this.variantValues
11466
- .map(function (vv) {
11467
- return vv.variantTypeSlug + "=" + vv.variantNameSlug;
11468
- })
11469
- .join("&");
11470
- if (variantParams)
11471
- return "/" + this.slug + "?" + variantParams;
11472
- else
11473
- return "/" + this.slug;
11465
+ if (!!this.variantValues.length) {
11466
+ return "/" + this.slug + "-" + this.variantValues
11467
+ .map(function (vv) { return vv.variantNameSlug; })
11468
+ .join("-");
11469
+ }
11470
+ return "/" + this.slug;
11474
11471
  },
11475
11472
  enumerable: false,
11476
11473
  configurable: true
@@ -17893,7 +17890,7 @@ var FacebookPixel = /** @class */ (function () {
17893
17890
  try {
17894
17891
  !isServer &&
17895
17892
  window.fbq &&
17896
- window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventID: eventId });
17893
+ window.fbq("track", "AddToCart", orderLineItemToFBPItem(item, quantity), { eventId: eventId });
17897
17894
  return;
17898
17895
  }
17899
17896
  catch (err) {
@@ -17915,7 +17912,7 @@ var FacebookPixel = /** @class */ (function () {
17915
17912
  try {
17916
17913
  !isServer &&
17917
17914
  window.fbq &&
17918
- window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventID: eventId });
17915
+ window.fbq("track", "Purchase", beginCheckoutFBPItem(checkout), { eventId: eventId });
17919
17916
  return;
17920
17917
  }
17921
17918
  catch (err) {
@@ -23620,7 +23617,11 @@ var CheckoutViewModel = /** @class */ (function () {
23620
23617
  this.changeStep = function (step) { return __awaiter(_this, void 0, void 0, function () {
23621
23618
  return __generator(this, function (_a) {
23622
23619
  if (!isServer$1) {
23623
- window.location.replace(window.location.pathname + "?id=" + this.checkout.id + "&step=" + step);
23620
+ window.location.replace("/checkout?id=" + this.checkout.id + "&step=" + step);
23621
+ // await this.router.replace(
23622
+ // `/checkout?id=${this.checkout.id}&step=${step}`
23623
+ // );
23624
+ // this.router.reload();
23624
23625
  }
23625
23626
  return [2 /*return*/];
23626
23627
  });
@@ -32303,10 +32304,10 @@ var AnalyticsHead = function (_a) {
32303
32304
  blockHTML && (React.createElement("script", { dangerouslySetInnerHTML: {
32304
32305
  __html: "dataLayer = [{'gtm.blocklist': ['html']}];",
32305
32306
  } })),
32306
- gtmId && (React.createElement("script", { defer: true, dangerouslySetInnerHTML: {
32307
+ gtmId && (React.createElement("script", { dangerouslySetInnerHTML: {
32307
32308
  __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
32309
  } })),
32309
- fbpId && (React.createElement("script", { defer: true, dangerouslySetInnerHTML: {
32310
+ fbpId && (React.createElement("script", { dangerouslySetInnerHTML: {
32310
32311
  __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
32312
  } })),
32312
32313
  storefrontJSScripts.map(function (script) { return htmlReactParser(script); })));
@@ -41446,14 +41447,18 @@ var IkasPage = mobxReactLite.observer(function (_a) {
41446
41447
  IkasStorefrontConfig.initWithJson(configJson);
41447
41448
  var store = IkasStorefrontConfig.store;
41448
41449
  var router$1 = router.useRouter();
41449
- var _b = React.useState(false), isBrowser = _b[0], setIsBrowser = _b[1];
41450
+ var _b = React.useState(false), mounted = _b[0], setMounted = _b[1];
41451
+ var _c = React.useState(false), isBrowser = _c[0], setIsBrowser = _c[1];
41450
41452
  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];
41453
+ var _d = React.useState(IkasPageDataProvider.initPropValues(propValuesStr, router$1, settingsStr)), propValues = _d[0], setPropValues = _d[1];
41452
41454
  store.currentPageType = pageType;
41453
41455
  React.useEffect(function () {
41456
+ //@ts-ignore
41457
+ store.setSettings(settingsStr);
41454
41458
  //@ts-ignore
41455
41459
  store.cartStore.getCart();
41456
41460
  store.checkLocalization();
41461
+ setMounted(true);
41457
41462
  }, []);
41458
41463
  React.useEffect(function () {
41459
41464
  if (reInitOnBrowser)
@@ -41467,6 +41472,7 @@ var IkasPage = mobxReactLite.observer(function (_a) {
41467
41472
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
41468
41473
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
41469
41474
  var pageStyle = {
41475
+ visibility: mounted ? "visible" : "hidden",
41470
41476
  position: "relative",
41471
41477
  minHeight: "100vh",
41472
41478
  display: "flex",
@@ -69891,7 +69897,6 @@ var ThemeEditorComponent = mobxReactLite.observer(function (_a) {
69891
69897
  }),
69892
69898
  }),
69893
69899
  checkoutSettings: new IkasCheckoutSettings(),
69894
- merchantSettings: null,
69895
69900
  customizationProps: __assign({}, propValues),
69896
69901
  returnPolicy: "",
69897
69902
  privacyPolicy: "",
@@ -70100,7 +70105,7 @@ var SettingsHelper = /** @class */ (function () {
70100
70105
  SettingsHelper.getSettings = function (locale) {
70101
70106
  var _this = this;
70102
70107
  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;
70108
+ var isLocal, storefrontResponse, storefront, localTheme, settings, storefront_1, salesChannel_1, localizationMap, storefrontJSScripts_1, domain_1, themeLocalizationPath, routing_1;
70104
70109
  return __generator(this, function (_a) {
70105
70110
  switch (_a.label) {
70106
70111
  case 0:
@@ -70119,7 +70124,6 @@ var SettingsHelper = /** @class */ (function () {
70119
70124
  return [4 /*yield*/, SettingsHelper.readLocalTheme()];
70120
70125
  case 2:
70121
70126
  localTheme = _a.sent();
70122
- colorScript = SettingsHelper.createColorScript(localTheme.settings);
70123
70127
  resolve({
70124
70128
  storefront: storefront,
70125
70129
  themeLocalization: new IkasStorefrontThemeLocalization({
@@ -70134,7 +70138,7 @@ var SettingsHelper = /** @class */ (function () {
70134
70138
  : new IkasStorefrontRouting({}),
70135
70139
  favicon: localTheme.settings.favicon,
70136
70140
  stockPreference: localTheme.settings.stockPreference,
70137
- storefrontJSScripts: colorScript ? [colorScript] : [],
70141
+ storefrontJSScripts: [],
70138
70142
  domain: "",
70139
70143
  });
70140
70144
  return [3 /*break*/, 5];
@@ -70166,11 +70170,6 @@ var SettingsHelper = /** @class */ (function () {
70166
70170
  var themeLocalization = new IkasStorefrontThemeLocalization(result);
70167
70171
  var favicon = themeLocalization.themeJson.settings.favicon;
70168
70172
  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
70173
  resolve({
70175
70174
  storefront: storefront_1,
70176
70175
  themeLocalization: themeLocalization,
@@ -70331,15 +70330,6 @@ var SettingsHelper = /** @class */ (function () {
70331
70330
  });
70332
70331
  });
70333
70332
  };
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
70333
  return SettingsHelper;
70344
70334
  }());
70345
70335
 
@@ -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.3",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",