@ikas/storefront 4.13.2 → 4.13.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.
Files changed (2) hide show
  1. package/build/store/base.js +1 -1
  2. package/package.json +11 -11
@@ -1 +1 @@
1
- import{__awaiter as o,__generator as t}from'./../ext/tslib/tslib.es6.js';import{configure as n,makeObservable as i,observable as e}from"mobx";import{enableStaticRendering as r}from"mobx-react-lite";import s from"lodash/sortBy";import u from"lodash/flatten";import{IkasCartStore as a}from"./cart/index.js";import{IkasCustomerStore as c}from"./customer/index.js";import l from"./location/index.js";import{IkasStorefrontConfig as d}from"@ikas/storefront-config";n({enforceActions:"never"}),r("undefined"==typeof window);var h=function(){function n(){this.currentPageType=null,this.localeOptions=[],this.languageOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.spaLinksDisabled=!1,this.localeChecked=!1,this.customerStore=new c(this),this.cartStore=new a(this),"undefined"!=typeof window&&(this.spaLinksDisabled=navigator.userAgent.includes("Instagram")),this.init(),i(this,{currentPageType:e,localeOptions:e,languageOptions:e,showLocaleOptions:e,currentCountryCode:e,spaLinksDisabled:e})}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setLocalization=function(o){o.routing.domain?window.location.replace("https://"+o.routing.domain):window.location.replace(window.location.origin+(o.routing.path?"/"+o.routing.path:"")+(this.router?this.router.asPath:""))},n.prototype.setLanguage=function(o){var t=d.getRoutings().find((function(t){return t.id===o.id}));t&&window.location.replace(window.location.origin+(t.path?"/"+t.path:"")+(this.router?this.router.asPath:""))},n.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,n,i,e,r,a,c,h,g,f,p;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:"undefined"==typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,l.getMyCountry()];case 1:return(o=t.sent()).isSuccess?(n=o.data,i=d.getCurrentRouting(),this.currentCountryCode=n,i&&n?(e=!0,r=d.getRoutings().filter((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)})),a=d.getRoutings().find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),r.length?r.some((function(o){return o.id===i.id}))||(e=!1):a&&i.id!==a.id&&(e=!1),c=[],h=[],g=u(d.getRoutings().map((function(o){return o.countryCodes||[]}))),[4,l.listCountry({iso2:{in:g}})]):[3,3]):[2];case 2:if(!(f=t.sent()).isSuccess)return[2];p=f.data||[],d.getRoutings().forEach((function(o){var t;(null===(t=o.countryCodes)||void 0===t?void 0:t.length)?o.countryCodes.forEach((function(t){var i=p.find((function(o){return o.iso2===t}));c.some((function(o){return o.iso2===(null==i?void 0:i.iso2)}))||c.push({id:(null==i?void 0:i.iso2)||(null==i?void 0:i.iso3)||Date.now()+"",countryName:(null==i?void 0:i.native)||(null==i?void 0:i.name)||"",iso2:(null==i?void 0:i.iso2)||void 0,iso3:(null==i?void 0:i.iso3)||void 0,routing:o,isRecommended:t===n})})):c.push({id:o.id,routing:o,isRecommended:!d.getRoutings().some((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)}))})})),r.length&&(d.getRoutings().forEach((function(o){var t;r.some((function(t){return t.id===o.id}))&&h.push({id:o.id,currencyCode:o.currencyCode,currencySymbol:o.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(o.locale)||o.locale,locale:o.locale,isSelected:o.id===(null===(t=d.getCurrentRouting())||void 0===t?void 0:t.id)||!1})})),this.languageOptions=s(h,"language")),this.localeOptions=s(c,"countryName"),e||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},n.prototype.init=function(){this.customerStore.init()},n}();export{h as IkasBaseStore};
1
+ import{__awaiter as o,__generator as t}from'./../ext/tslib/tslib.es6.js';import{configure as n,makeObservable as i,observable as e}from"mobx";import{enableStaticRendering as r}from"mobx-react-lite";import s from"lodash/sortBy";import a from"lodash/flatten";import{IkasCartStore as c}from"./cart/index.js";import{IkasCustomerStore as u}from"./customer/index.js";import l from"./location/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";import{IkasPageDataInit as g}from"../page-data-init/index.js";n({enforceActions:"never"}),r("undefined"==typeof window);var p=function(){function n(){this.currentPageType=null,this.localeOptions=[],this.languageOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.spaLinksDisabled=!1,this.localeChecked=!1,this.customerStore=new u(this),this.cartStore=new c(this),"undefined"!=typeof window&&(this.spaLinksDisabled=navigator.userAgent.includes("Instagram")),this.init(),i(this,{currentPageType:e,localeOptions:e,languageOptions:e,showLocaleOptions:e,currentCountryCode:e,spaLinksDisabled:e})}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setLocalization=function(o){o.routing.domain?window.location.replace("https://"+o.routing.domain):window.location.replace(window.location.origin+(o.routing.path?"/"+o.routing.path:"")+(this.router?this.router.asPath:""))},n.prototype.setLanguage=function(o){var t,n,i=h.getRoutings().find((function(t){return t.id===o.id}));if(i)if(this.currentPageType===d.CATEGORY||this.currentPageType===d.BRAND||this.currentPageType===d.PRODUCT){var e=null===(n=null===(t=g.pageSpecificData.metaData)||void 0===t?void 0:t.translations)||void 0===n?void 0:n.find((function(o){return o.locale===i.locale}));if(e&&(null==e?void 0:e.slug)){var r="";r=i.path?"".concat(window.location.origin,"/").concat(e.locale,"/").concat(e.slug):"".concat(window.location.origin,"/").concat(e.slug),window.location.replace(r)}}else window.location.replace(window.location.origin+(i.path?"/"+i.path:"")+(this.router?this.router.asPath:""))},n.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,n,i,e,r,c,u,d,g,p,f;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:"undefined"==typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,l.getMyCountry()];case 1:return(o=t.sent()).isSuccess?(n=o.data,i=h.getCurrentRouting(),this.currentCountryCode=n,i&&n?(e=!0,r=h.getRoutings().filter((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)})),c=h.getRoutings().find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),r.length?r.some((function(o){return o.id===i.id}))||(e=!1):c&&i.id!==c.id&&(e=!1),u=[],d=[],g=a(h.getRoutings().map((function(o){return o.countryCodes||[]}))),[4,l.listCountry({iso2:{in:g}})]):[3,3]):[2];case 2:if(!(p=t.sent()).isSuccess)return[2];f=p.data||[],h.getRoutings().forEach((function(o){var t;(null===(t=o.countryCodes)||void 0===t?void 0:t.length)?o.countryCodes.forEach((function(t){var i=f.find((function(o){return o.iso2===t}));u.some((function(o){return o.iso2===(null==i?void 0:i.iso2)}))||u.push({id:(null==i?void 0:i.iso2)||(null==i?void 0:i.iso3)||Date.now()+"",countryName:(null==i?void 0:i.native)||(null==i?void 0:i.name)||"",iso2:(null==i?void 0:i.iso2)||void 0,iso3:(null==i?void 0:i.iso3)||void 0,routing:o,isRecommended:t===n})})):u.push({id:o.id,routing:o,isRecommended:!h.getRoutings().some((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)}))})})),r.length&&(h.getRoutings().forEach((function(o){var t;r.some((function(t){return t.id===o.id}))&&d.push({id:o.id,currencyCode:o.currencyCode,currencySymbol:o.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(o.locale)||o.locale,locale:o.locale,isSelected:o.id===(null===(t=h.getCurrentRouting())||void 0===t?void 0:t.id)||!1})})),this.languageOptions=s(d,"language")),this.localeOptions=s(u,"countryName"),e||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},n.prototype.init=function(){this.customerStore.init()},n}();export{p as IkasBaseStore};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "4.13.2",
3
+ "version": "4.13.3",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,11 +17,11 @@
17
17
  "build": "rm -rf build && rollup -c"
18
18
  },
19
19
  "devDependencies": {
20
- "@ikas/storefront-api": "^4.13.2",
21
- "@ikas/storefront-config": "^4.13.2",
22
- "@ikas/storefront-model-functions": "^4.13.2",
23
- "@ikas/storefront-models": "^4.13.2",
24
- "@ikas/storefront-providers": "^4.13.2",
20
+ "@ikas/storefront-api": "^4.13.3",
21
+ "@ikas/storefront-config": "^4.13.3",
22
+ "@ikas/storefront-model-functions": "^4.13.3",
23
+ "@ikas/storefront-models": "^4.13.3",
24
+ "@ikas/storefront-providers": "^4.13.3",
25
25
  "@ikas/localized-address": "^1.0.0-beta.3",
26
26
  "@adyen/adyen-web": "^5.28.2",
27
27
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -55,11 +55,11 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@ikas/localized-address": "^1.0.0-beta.3",
58
- "@ikas/storefront-api": "^4.13.2",
59
- "@ikas/storefront-config": "^4.13.2",
60
- "@ikas/storefront-model-functions": "^4.13.2",
61
- "@ikas/storefront-models": "^4.13.2",
62
- "@ikas/storefront-providers": "^4.13.2",
58
+ "@ikas/storefront-api": "^4.13.3",
59
+ "@ikas/storefront-config": "^4.13.3",
60
+ "@ikas/storefront-model-functions": "^4.13.3",
61
+ "@ikas/storefront-models": "^4.13.3",
62
+ "@ikas/storefront-providers": "^4.13.3",
63
63
  "mobx": "^6.1.3",
64
64
  "mobx-react-lite": "^3.1.5",
65
65
  "next": "12.2.0",