@ikas/storefront 0.0.160-alpha.3 → 0.0.160-alpha.5

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
@@ -1,5 +1,5 @@
1
1
  import { makeAutoObservable, runInAction, reaction, makeObservable, computed, observable, action, toJS, configure } from 'mobx';
2
- import React, { createElement, Fragment, useState, useEffect, useCallback, useRef, useMemo } from 'react';
2
+ import React, { createElement, Fragment, useEffect, useState, useCallback, useRef, useMemo } from 'react';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import Head from 'next/head';
5
5
  import { useRouter } from 'next/router';
@@ -23014,8 +23014,10 @@ var PhoneRule = /** @class */ (function (_super) {
23014
23014
  });
23015
23015
  PhoneRule.prototype.run = function () {
23016
23016
  return __awaiter(this, void 0, void 0, function () {
23017
+ var result;
23017
23018
  return __generator(this, function (_a) {
23018
- return [2 /*return*/, !!/^\+(\d{12})$/gm.test(this.value)];
23019
+ result = this.value.match(/\d/g);
23020
+ return [2 /*return*/, ((!!result && result.length <= 11) || !!/^\+(\d{12})$/gm.test(this.value))];
23019
23021
  });
23020
23022
  });
23021
23023
  };
@@ -25229,7 +25231,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
25229
25231
  switch (_b.label) {
25230
25232
  case 0:
25231
25233
  if (this.value === undefined || this.value === null)
25232
- return [2 /*return*/];
25234
+ return [2 /*return*/, { value: null, customData: this.customData }];
25233
25235
  _b.label = 1;
25234
25236
  case 1:
25235
25237
  _b.trys.push([1, 48, , 49]);
@@ -25735,6 +25737,8 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
25735
25737
  value: null,
25736
25738
  customData: this.customData,
25737
25739
  }];
25740
+ selectedCustomData = new IkasThemeCustomData(cloneDeep_1(selectedCustomData));
25741
+ selectedCustomData.isRequired = this.customData.isRequired;
25738
25742
  nestedProvider = new IkasCustomPropValueProvider(this.value, selectedCustomData, this.theme, this.pageType, this.pageDataProvider, this.pageSpecificData);
25739
25743
  return [4 /*yield*/, nestedProvider.getValue()];
25740
25744
  case 1: return [2 /*return*/, _a.sent()];
@@ -25868,16 +25872,17 @@ var ThemeComponent = observer(function (_a) {
25868
25872
  });
25869
25873
 
25870
25874
  var IkasPageHead = observer(function (_a) {
25871
- var _b, _c;
25875
+ var _b;
25872
25876
  var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
25873
25877
  var ogpMetas = [];
25874
25878
  var schemas = [];
25875
25879
  var isCanonicalLinkAdd = false;
25876
25880
  var canonicalHref = "";
25877
- if (typeof window !== "undefined") {
25881
+ useEffect(function () {
25882
+ var _a;
25878
25883
  document.documentElement.lang =
25879
- ((_b = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; })) === null || _b === void 0 ? void 0 : _b.locale) || "tr";
25880
- }
25884
+ ((_a = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; })) === null || _a === void 0 ? void 0 : _a.locale) || "tr";
25885
+ }, []);
25881
25886
  if (props.addOgpMetas) {
25882
25887
  ogpMetas.push({
25883
25888
  property: "og:type",
@@ -25914,7 +25919,7 @@ var IkasPageHead = observer(function (_a) {
25914
25919
  if (productDetail.selectedVariant.mainImage) {
25915
25920
  ogpMetas.push({
25916
25921
  property: "og:image",
25917
- content: (_c = productDetail.selectedVariant.mainImage) === null || _c === void 0 ? void 0 : _c.src,
25922
+ content: (_b = productDetail.selectedVariant.mainImage) === null || _b === void 0 ? void 0 : _b.src,
25918
25923
  });
25919
25924
  }
25920
25925
  }
@@ -26106,8 +26111,8 @@ function styleInject(css, ref) {
26106
26111
  }
26107
26112
  }
26108
26113
 
26109
- var css_248z = ".style-module_IkasPage__ATOib {\n position: relative;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n visibility: hidden; }\n .style-module_IkasPage__ATOib.style-module_Visible__gfjnC {\n visibility: visible; }\n";
26110
- var styles = {"IkasPage":"style-module_IkasPage__ATOib","Visible":"style-module_Visible__gfjnC"};
26114
+ var css_248z = ".style-module_IkasPage__ATOib {\n position: relative;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n visibility: hidden; }\n";
26115
+ var styles = {"IkasPage":"style-module_IkasPage__ATOib"};
26111
26116
  styleInject(css_248z);
26112
26117
 
26113
26118
  var IkasPage = observer(function (_a) {
@@ -26129,11 +26134,14 @@ var IkasPage = observer(function (_a) {
26129
26134
  var headerComponentPropValue = propValues.find(function (pv) { return pv.component.isHeader; });
26130
26135
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
26131
26136
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
26137
+ var visibilityStyle = {
26138
+ visibility: mounted ? "visible" : "hidden",
26139
+ };
26132
26140
  if (!page)
26133
26141
  return null;
26134
26142
  return (createElement(Fragment, null,
26135
26143
  createElement(IkasPageHead, { page: page, pageTitle: page.pageTitle, description: page.description, pageSpecificDataStr: pageSpecificDataStr, merchantSettings: merchantSettings, addOgpMetas: addOgpMetas }),
26136
- createElement("div", { className: [styles.IkasPage, mounted ? styles.Visible : ""].join(" ") },
26144
+ createElement("div", { style: visibilityStyle, className: styles.IkasPage },
26137
26145
  createElement("div", null,
26138
26146
  headerComponentPropValue &&
26139
26147
  renderComponent(headerComponentPropValue, settings, -1),
@@ -30824,6 +30832,9 @@ var IkasCheckoutPage = observer(function (_a) {
30824
30832
  var vm = useState(function () {
30825
30833
  return new CheckoutViewModel(checkout, checkoutSettings, queryParams, router, returnPolicy, privacyPolicy, termsOfService);
30826
30834
  })[0];
30835
+ if (vm.step === CheckoutStep.PAYMENT) {
30836
+ Analytics.disableHTML();
30837
+ }
30827
30838
  useEffect(function () {
30828
30839
  if (vm.checkoutSettings.isAccountRequired && !vm.checkout.hasCustomer) {
30829
30840
  router.push("/account/login?redirect=" + encodeURIComponent(vm.checkoutUrl));
@@ -31994,7 +32005,6 @@ var _slug_ = /*#__PURE__*/Object.freeze({
31994
32005
  var CheckoutPage = function (_a) {
31995
32006
  var checkoutStr = _a.checkoutStr, checkoutSettingsStr = _a.checkoutSettingsStr, configJson = _a.configJson, others = __rest(_a, ["checkoutStr", "checkoutSettingsStr", "configJson"]);
31996
32007
  IkasStorefrontConfig.initWithJson(configJson);
31997
- Analytics.disableHTML();
31998
32008
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
31999
32009
  var checkoutSettings = checkoutSettingsStr
32000
32010
  ? new IkasCheckoutSettings(JSON.parse(checkoutSettingsStr))
package/build/index.js CHANGED
@@ -22993,8 +22993,10 @@ var PhoneRule = /** @class */ (function (_super) {
22993
22993
  });
22994
22994
  PhoneRule.prototype.run = function () {
22995
22995
  return __awaiter(this, void 0, void 0, function () {
22996
+ var result;
22996
22997
  return __generator(this, function (_a) {
22997
- return [2 /*return*/, !!/^\+(\d{12})$/gm.test(this.value)];
22998
+ result = this.value.match(/\d/g);
22999
+ return [2 /*return*/, ((!!result && result.length <= 11) || !!/^\+(\d{12})$/gm.test(this.value))];
22998
23000
  });
22999
23001
  });
23000
23002
  };
@@ -25208,7 +25210,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
25208
25210
  switch (_b.label) {
25209
25211
  case 0:
25210
25212
  if (this.value === undefined || this.value === null)
25211
- return [2 /*return*/];
25213
+ return [2 /*return*/, { value: null, customData: this.customData }];
25212
25214
  _b.label = 1;
25213
25215
  case 1:
25214
25216
  _b.trys.push([1, 48, , 49]);
@@ -25714,6 +25716,8 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
25714
25716
  value: null,
25715
25717
  customData: this.customData,
25716
25718
  }];
25719
+ selectedCustomData = new IkasThemeCustomData(cloneDeep_1(selectedCustomData));
25720
+ selectedCustomData.isRequired = this.customData.isRequired;
25717
25721
  nestedProvider = new IkasCustomPropValueProvider(this.value, selectedCustomData, this.theme, this.pageType, this.pageDataProvider, this.pageSpecificData);
25718
25722
  return [4 /*yield*/, nestedProvider.getValue()];
25719
25723
  case 1: return [2 /*return*/, _a.sent()];
@@ -25847,16 +25851,17 @@ var ThemeComponent = mobxReactLite.observer(function (_a) {
25847
25851
  });
25848
25852
 
25849
25853
  var IkasPageHead = mobxReactLite.observer(function (_a) {
25850
- var _b, _c;
25854
+ var _b;
25851
25855
  var page = _a.page, pageTitle = _a.pageTitle, description = _a.description, pageSpecificDataStr = _a.pageSpecificDataStr, props = __rest(_a, ["page", "pageTitle", "description", "pageSpecificDataStr"]);
25852
25856
  var ogpMetas = [];
25853
25857
  var schemas = [];
25854
25858
  var isCanonicalLinkAdd = false;
25855
25859
  var canonicalHref = "";
25856
- if (typeof window !== "undefined") {
25860
+ React.useEffect(function () {
25861
+ var _a;
25857
25862
  document.documentElement.lang =
25858
- ((_b = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; })) === null || _b === void 0 ? void 0 : _b.locale) || "tr";
25859
- }
25863
+ ((_a = IkasStorefrontConfig.routings.find(function (r) { return r.id === IkasStorefrontConfig.storefrontRoutingId; })) === null || _a === void 0 ? void 0 : _a.locale) || "tr";
25864
+ }, []);
25860
25865
  if (props.addOgpMetas) {
25861
25866
  ogpMetas.push({
25862
25867
  property: "og:type",
@@ -25893,7 +25898,7 @@ var IkasPageHead = mobxReactLite.observer(function (_a) {
25893
25898
  if (productDetail.selectedVariant.mainImage) {
25894
25899
  ogpMetas.push({
25895
25900
  property: "og:image",
25896
- content: (_c = productDetail.selectedVariant.mainImage) === null || _c === void 0 ? void 0 : _c.src,
25901
+ content: (_b = productDetail.selectedVariant.mainImage) === null || _b === void 0 ? void 0 : _b.src,
25897
25902
  });
25898
25903
  }
25899
25904
  }
@@ -26085,8 +26090,8 @@ function styleInject(css, ref) {
26085
26090
  }
26086
26091
  }
26087
26092
 
26088
- var css_248z = ".style-module_IkasPage__ATOib {\n position: relative;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n visibility: hidden; }\n .style-module_IkasPage__ATOib.style-module_Visible__gfjnC {\n visibility: visible; }\n";
26089
- var styles = {"IkasPage":"style-module_IkasPage__ATOib","Visible":"style-module_Visible__gfjnC"};
26093
+ var css_248z = ".style-module_IkasPage__ATOib {\n position: relative;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n visibility: hidden; }\n";
26094
+ var styles = {"IkasPage":"style-module_IkasPage__ATOib"};
26090
26095
  styleInject(css_248z);
26091
26096
 
26092
26097
  var IkasPage = mobxReactLite.observer(function (_a) {
@@ -26108,11 +26113,14 @@ var IkasPage = mobxReactLite.observer(function (_a) {
26108
26113
  var headerComponentPropValue = propValues.find(function (pv) { return pv.component.isHeader; });
26109
26114
  var footerComponentPropValue = propValues.find(function (pv) { return pv.component.isFooter; });
26110
26115
  var others = propValues.filter(function (pv) { return !pv.component.isHeader && !pv.component.isFooter; }) || [];
26116
+ var visibilityStyle = {
26117
+ visibility: mounted ? "visible" : "hidden",
26118
+ };
26111
26119
  if (!page)
26112
26120
  return null;
26113
26121
  return (React.createElement(React.Fragment, null,
26114
26122
  React.createElement(IkasPageHead, { page: page, pageTitle: page.pageTitle, description: page.description, pageSpecificDataStr: pageSpecificDataStr, merchantSettings: merchantSettings, addOgpMetas: addOgpMetas }),
26115
- React.createElement("div", { className: [styles.IkasPage, mounted ? styles.Visible : ""].join(" ") },
26123
+ React.createElement("div", { style: visibilityStyle, className: styles.IkasPage },
26116
26124
  React.createElement("div", null,
26117
26125
  headerComponentPropValue &&
26118
26126
  renderComponent(headerComponentPropValue, settings, -1),
@@ -30802,6 +30810,9 @@ var IkasCheckoutPage = mobxReactLite.observer(function (_a) {
30802
30810
  var vm = React.useState(function () {
30803
30811
  return new CheckoutViewModel(checkout, checkoutSettings, queryParams, router$1, returnPolicy, privacyPolicy, termsOfService);
30804
30812
  })[0];
30813
+ if (vm.step === CheckoutStep.PAYMENT) {
30814
+ Analytics.disableHTML();
30815
+ }
30805
30816
  React.useEffect(function () {
30806
30817
  if (vm.checkoutSettings.isAccountRequired && !vm.checkout.hasCustomer) {
30807
30818
  router$1.push("/account/login?redirect=" + encodeURIComponent(vm.checkoutUrl));
@@ -31972,7 +31983,6 @@ var _slug_ = /*#__PURE__*/Object.freeze({
31972
31983
  var CheckoutPage = function (_a) {
31973
31984
  var checkoutStr = _a.checkoutStr, checkoutSettingsStr = _a.checkoutSettingsStr, configJson = _a.configJson, others = __rest(_a, ["checkoutStr", "checkoutSettingsStr", "configJson"]);
31974
31985
  IkasStorefrontConfig.initWithJson(configJson);
31975
- Analytics.disableHTML();
31976
31986
  var checkout = new IkasCheckout(JSON.parse(checkoutStr));
31977
31987
  var checkoutSettings = checkoutSettingsStr
31978
31988
  ? new IkasCheckoutSettings(JSON.parse(checkoutSettingsStr))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.160-alpha.3",
3
+ "version": "0.0.160-alpha.5",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",