@ikas/bp-storefront 1.4.0-beta.170 → 1.4.0-beta.171

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.
@@ -1 +1 @@
1
- import{__awaiter as n,__generator as i}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as t}from"../../../packages/storefront-config/src/index.js";import o from'./../../../ext/lodash/flatten.js';import e from'./../../../ext/lodash/sortBy.js';import{baseStore as r}from"../../../stores/base/index.js";function a(a){r.currentPageType=a,function(){n(this,void 0,void 0,function(){var n,a,c,u,s,d,l,v;return i(this,function(i){switch(i.label){case 0:return[4,import("../../api/location/index.js")];case 1:return[4,(0,i.sent().apiGetMyCountry)()];case 2:return n=i.sent(),a=n.data,n.isSuccess&&a?(c=t.routings.filter(function(n){var i;return null===(i=n.countryCodes)||void 0===i?void 0:i.includes(a)}),c.length?(u=o(t.routings.map(function(n){return n.countryCodes||[]})),[4,import("../../api/location/index.js")]):[2]):[2];case 3:return[4,(0,i.sent().apiListCountry)({iso2:{in:u}})];case 4:return(s=i.sent()).isSuccess?(d=s.data||[],l=[],v=[],t.routings.forEach(function(n){var i;if(null===(i=n.countryCodes)||void 0===i?void 0:i.length)n.countryCodes.forEach(function(i){var t=d.find(function(n){return n.iso2===i});if(!v.some(function(n){return n.iso2===(null==t?void 0:t.iso2)})){var o={id:(null==t?void 0:t.iso2)||(null==t?void 0:t.iso3)||Date.now()+"",countryName:(null==t?void 0:t.native)||(null==t?void 0:t.name)||"",iso2:(null==t?void 0:t.iso2)||void 0,iso3:(null==t?void 0:t.iso3)||void 0,routing:n,isRecommended:i===a};v.push(o)}});else{var o={id:n.id,routing:n,isRecommended:!t.routings.some(function(n){var i;return null===(i=n.countryCodes)||void 0===i?void 0:i.includes(a)})};v.push(o)}}),t.routings.forEach(function(n){var i;if(c.some(function(i){return i.id===n.id})){var o={id:n.id,currencyCode:n.currencyCode,currencySymbol:n.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(n.locale)||n.locale,locale:n.locale,isSelected:n.id===(null===(i=t.getCurrentRouting())||void 0===i?void 0:i.id)||!1};l.push(o)}}),r.languageOptions=e(l,"language"),r.localeOptions=e(v,"countryName"),[2]):[2]}})})}()}function c(n,i){var t=s(i.routing);window.location.replace(t)}function u(n,i){var o=t.routings.find(function(n){return n.id===i.id});if(o){var e=s(o);window.location.replace(e)}}function s(n){var i,o,e,a;if(n.domain)return"https://".concat(n.domain);var c=window.location,u=c.origin,s=c.pathname,d=c.search,l=c.hash,v=n.path?"/".concat(n.path):"",f=r.currentPageType;if("CATEGORY"===f||"BRAND"===f||"PRODUCT"===f){var p=null===(i=window.__IKAS_DATA__)||void 0===i?void 0:i.pageSpecificData,m=null===(e=null===(o=null==p?void 0:p.metaData)||void 0===o?void 0:o.translations)||void 0===e?void 0:e.find(function(i){return i.locale===n.locale});if(null==m?void 0:m.slug)return"".concat(u).concat(v,"/").concat(m.slug).concat(d).concat(l)}var g=null===(a=t.getCurrentRouting())||void 0===a?void 0:a.path,h=s;if(g){var y="/".concat(g);s===y?h="/":s.startsWith("".concat(y,"/"))&&(h=s.slice(y.length))}return"".concat(u).concat(v).concat(h).concat(d).concat(l)}function d(t,o){return n(this,void 0,void 0,function(){var n,t,e,r,a;return i(this,function(i){switch(i.label){case 0:return[4,import("../../api/product/index.js")];case 1:return[4,(0,i.sent().apiSearchProducts)({input:{productIdList:[o.productId]}})];case 2:return n=i.sent(),(t=(null===(a=null===(r=n.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0])||null)&&(e=t.variants.find(function(n){return n.isActive})||t.variants[0])&&(t.selectedVariantValues=e.variantValues),[2,{isSuccess:n.isSuccess,product:t}]}})})}function l(t,o){return n(this,void 0,void 0,function(){var n,t,e;return i(this,function(i){switch(i.label){case 0:return o.productIds.length?[4,import("../../api/product/index.js")]:[2,{isSuccess:!0,products:[]}];case 1:return[4,(0,i.sent().apiSearchProducts)({input:{productIdList:o.productIds}})];case 2:return n=i.sent(),(t=(null===(e=n.data)||void 0===e?void 0:e.data)||null)&&t.forEach(function(n){var i=n.variants.find(function(n){return n.isActive})||n.variants[0];i&&(n.selectedVariantValues=i.variantValues)}),[2,{isSuccess:n.isSuccess,products:t}]}})})}export{d as bs_searchProductById,l as bs_searchProductsById,a as initBaseStore,u as setLanguage,c as setLocalization};
1
+ import{__awaiter as n,__generator as o}from'./../../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as i}from"../../../packages/storefront-config/src/index.js";import t from'./../../../ext/lodash/flatten.js';import e from'./../../../ext/lodash/sortBy.js';import{baseStore as r}from"../../../stores/base/index.js";function c(c){r.currentPageType=c,function(){n(this,void 0,void 0,function(){var n,c,a,u,s,d,l,v;return o(this,function(o){switch(o.label){case 0:return[4,import("../../api/location/index.js")];case 1:return[4,(0,o.sent().apiGetMyCountry)()];case 2:return n=o.sent(),c=n.data,n.isSuccess&&c?(a=i.routings.filter(function(n){var o;return null===(o=n.countryCodes)||void 0===o?void 0:o.includes(c)}),a.length?(u=t(i.routings.map(function(n){return n.countryCodes||[]})),[4,import("../../api/location/index.js")]):[2]):[2];case 3:return[4,(0,o.sent().apiListCountry)({iso2:{in:u}})];case 4:return(s=o.sent()).isSuccess?(d=s.data||[],l=[],v=[],i.routings.forEach(function(n){var o;if(null===(o=n.countryCodes)||void 0===o?void 0:o.length)n.countryCodes.forEach(function(o){var i=d.find(function(n){return n.iso2===o});if(!v.some(function(n){return n.iso2===(null==i?void 0:i.iso2)})){var t={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:n,isRecommended:o===c};v.push(t)}});else{var t={id:n.id,routing:n,isRecommended:!i.routings.some(function(n){var o;return null===(o=n.countryCodes)||void 0===o?void 0:o.includes(c)})};v.push(t)}}),i.routings.forEach(function(n){var o;if(a.some(function(o){return o.id===n.id})){var t={id:n.id,currencyCode:n.currencyCode,currencySymbol:n.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(n.locale)||n.locale,locale:n.locale,isSelected:n.id===(null===(o=i.getCurrentRouting())||void 0===o?void 0:o.id)||!1};l.push(t)}}),r.languageOptions=e(l,"language"),r.localeOptions=e(v,"countryName"),[2]):[2]}})})}()}function a(n,o){var i=s(o.routing);window.location.replace(i)}function u(n,o){var t=i.routings.find(function(n){return n.id===o.id});if(t){var e=s(t);window.location.replace(e)}}function s(n){var o,t,e,c;if(n.domain)return"https://".concat(n.domain);var a=window.location,u=a.origin,s=a.pathname,d=a.search,l=a.hash,v=n.path?"/".concat(n.path):"",f=r.currentPageType;if("CATEGORY"===f||"BRAND"===f||"PRODUCT"===f){var p=null===(o=window.__IKAS_DATA__)||void 0===o?void 0:o.pageSpecificData,m=null===(e=null===(t=null==p?void 0:p.metaData)||void 0===t?void 0:t.translations)||void 0===e?void 0:e.find(function(o){return o.locale===n.locale});if(null==m?void 0:m.slug)return"".concat(u).concat(v,"/").concat(m.slug).concat(d).concat(l)}var g=null===(c=i.getCurrentRouting())||void 0===c?void 0:c.path,h=s;if(g){var y="/".concat(g);s===y?h="/":s.startsWith("".concat(y,"/"))&&(h=s.slice(y.length))}return"".concat(u).concat(v).concat(h).concat(d).concat(l)}function d(i,t){return n(this,void 0,void 0,function(){var n,i,e,r;return o(this,function(o){switch(o.label){case 0:return[4,import("../../api/product/index.js")];case 1:return[4,(0,o.sent().apiSearchProducts)({input:{productIdList:[t.productId]}})];case 2:return n=o.sent(),(i=(null===(r=null===(e=n.data)||void 0===e?void 0:e.data)||void 0===r?void 0:r[0])||null)&&l(i),[2,{isSuccess:n.isSuccess,product:i}]}})})}function l(n){var o=n.variants.find(function(n){return n.isActive})||n.variants[0];o&&(n.selectedVariantValues=o.variantValues)}function v(i,t){return n(this,void 0,void 0,function(){var n,i,e;return o(this,function(o){switch(o.label){case 0:return t.productIds.length?[4,import("../../api/product/index.js")]:[2,{isSuccess:!0,products:[]}];case 1:return[4,(0,o.sent().apiSearchProducts)({input:{productIdList:t.productIds}})];case 2:return n=o.sent(),(i=(null===(e=n.data)||void 0===e?void 0:e.data)||null)&&i.forEach(l),[2,{isSuccess:n.isSuccess,products:i}]}})})}export{d as bs_searchProductById,v as bs_searchProductsById,c as initBaseStore,u as setLanguage,a as setLocalization};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "1.4.0-beta.170",
3
+ "version": "1.4.0-beta.171",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",