@ikas/storefront 5.0.0-beta.24 → 5.0.0-beta.26
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/analytics/analytics.js +1 -1
- package/build/analytics/head/index.js +1 -1
- package/build/analytics/ikas.js +1 -1
- package/build/components/checkout/components/address-form/index.js +1 -1
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/adyen/adyen.module.scss.js +1 -1
- package/build/components/checkout/components/adyen/index.js +1 -1
- package/build/components/checkout/components/button/style.module.scss.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/style.module.scss.js +1 -1
- package/build/components/checkout/components/cart-summary/index.js +1 -1
- package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
- package/build/components/checkout/components/checkbox/style.module.scss.js +1 -1
- package/build/components/checkout/components/credit-card-form/style.module.scss.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/components/customer-addresses/style.module.scss.js +1 -1
- package/build/components/checkout/components/delivery-methods/icon-button/style.module.scss.js +1 -1
- package/build/components/checkout/components/delivery-methods/style.module.scss.js +1 -1
- package/build/components/checkout/components/epaykolay-button/style.module.scss.js +1 -1
- package/build/components/checkout/components/error/stock-error/index.js +1 -1
- package/build/components/checkout/components/error/stock-error/style.module.scss.js +1 -1
- package/build/components/checkout/components/expandable-section/style.module.scss.js +1 -1
- package/build/components/checkout/components/form-item/style.module.scss.js +1 -1
- package/build/components/checkout/components/fullscreen-loading/style.module.scss.js +1 -1
- package/build/components/checkout/components/input-with-button/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/credit-card-form/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/link-card-to-client/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/modal/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/modal-otp/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/modal-response/style.module.scss.js +1 -1
- package/build/components/checkout/components/master-pass/modal-success/style.module.scss.js +1 -1
- package/build/components/checkout/components/modal/style.module.scss.js +1 -1
- package/build/components/checkout/components/notification-box/style.module.scss.js +1 -1
- package/build/components/checkout/components/offer-product/select/style.module.scss.js +1 -1
- package/build/components/checkout/components/offer-product/style.module.scss.js +1 -1
- package/build/components/checkout/components/paypal/index.js +1 -1
- package/build/components/checkout/components/paypal/style.module.scss.js +1 -1
- package/build/components/checkout/components/phone-number-input/get-countries.js +1 -1
- package/build/components/checkout/components/phone-number-input/index.js +1 -1
- package/build/components/checkout/components/phone-number-input/style.module.scss.js +1 -1
- package/build/components/checkout/components/quick-registration/model.js +1 -1
- package/build/components/checkout/components/quick-registration/style.module.scss.js +1 -1
- package/build/components/checkout/components/select-box/style.module.scss.js +1 -1
- package/build/components/checkout/components/step-container/style.module.scss.js +1 -1
- package/build/components/checkout/components/stripe/checkout-form.js +1 -1
- package/build/components/checkout/components/stripe/index.js +1 -1
- package/build/components/checkout/components/stripe/style.module.scss.js +1 -1
- package/build/components/checkout/components/toggle/style.module.scss.js +1 -1
- package/build/components/checkout/components/tooltip/style.module.scss.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/modelMasterPass.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/installments/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-payment/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-shipping/style.module.scss.js +1 -1
- package/build/components/checkout/steps/step-success/style.module.scss.js +1 -1
- package/build/components/checkout/style.module.scss.js +1 -1
- package/build/components/checkout/styles/common.module.scss.js +1 -1
- package/build/components/google-captcha/index.js +1 -1
- package/build/components/image/index.js +1 -1
- package/build/components/link/index.js +1 -1
- package/build/components/page/ThemeComponent.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/index.js +1 -1
- package/build/components/page-editor/loader/style.module.scss.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/ext/style-inject/dist/style-inject.es.js +1 -0
- package/build/ext/tslib/tslib.es6.js +1 -0
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/model-helpers/order/line-item/option/value/functions.js +1 -1
- package/build/model-helpers/product/attribute-value/functions.js +1 -1
- package/build/model-helpers/product/functions.js +1 -1
- package/build/model-helpers/product/option-set/option/functions.js +1 -1
- package/build/model-helpers/product/variant/functions.js +1 -1
- package/build/models/data/localized-customer-address/functions.js +1 -1
- package/build/models/data/theme-json/custom-data/index.js +1 -1
- package/build/models/ui/blog-category-list/functions.js +1 -1
- package/build/models/ui/blog-list/functions.js +1 -1
- package/build/models/ui/brand-list/functions.js +1 -1
- package/build/models/ui/category-list/functions.js +1 -1
- package/build/models/ui/customer-review-list/functions.js +1 -1
- package/build/models/ui/customer-review-summary-list/functions.js +1 -1
- package/build/models/ui/product-list/functions.js +1 -1
- package/build/models/ui/raffle-list/functions.js +1 -1
- package/build/models/ui/validator/form/account-info.js +1 -1
- package/build/models/ui/validator/form/address.js +1 -1
- package/build/models/ui/validator/form/contact-form.js +1 -1
- package/build/models/ui/validator/form/customer-review.js +1 -1
- package/build/models/ui/validator/form/forgot-password.js +1 -1
- package/build/models/ui/validator/form/ikas-address.js +1 -1
- package/build/models/ui/validator/form/login.js +1 -1
- package/build/models/ui/validator/form/raffle-form.js +1 -1
- package/build/models/ui/validator/form/recover-password.js +1 -1
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/models/ui/validator/index.js +1 -1
- package/build/models/ui/validator/rules/index.js +1 -1
- package/build/page-data-init/index.js +1 -1
- package/build/pages/404.js +1 -1
- package/build/pages/_slug_/index.js +1 -1
- package/build/pages/account/activate.js +1 -1
- package/build/pages/account/addresses.js +1 -1
- package/build/pages/account/favorite-products.js +1 -1
- package/build/pages/account/forgot-password.js +1 -1
- package/build/pages/account/index.js +1 -1
- package/build/pages/account/login.js +1 -1
- package/build/pages/account/orders/_id_.js +1 -1
- package/build/pages/account/orders/index.js +1 -1
- package/build/pages/account/raffles.js +1 -1
- package/build/pages/account/recover-password.js +1 -1
- package/build/pages/account/register.js +1 -1
- package/build/pages/blog/_slug_.js +1 -1
- package/build/pages/blog/index.js +1 -1
- package/build/pages/cart.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/build/pages/editor.js +1 -1
- package/build/pages/home.js +1 -1
- package/build/pages/pages/_slug_.js +1 -1
- package/build/pages/raffle/_slug_.js +1 -1
- package/build/pages/raffle/index.js +1 -1
- package/build/pages/search.js +1 -1
- package/build/store/base/functions.js +1 -1
- package/build/store/cart/functions.js +1 -1
- package/build/store/customer/account-auth/functions.js +1 -1
- package/build/store/customer/captcha/functions.js +1 -1
- package/build/store/customer/functions.js +1 -1
- package/build/store/customer/marketing/functions.js +1 -1
- package/build/store/customer/order/functions.js +1 -1
- package/build/store/customer/product/functions.js +1 -1
- package/build/store/customer/raffle/functions.js +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e,__assign as o}from
|
|
1
|
+
import{__extends as e,__assign as o}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import r from"./error/index.js";import{makeObservable as n,computed as i}from"mobx";import s from"../checkout/index.js";import{Observer as a}from"mobx-react-lite";import{IkasThemeJsonPageType as l,IkasOrderLineItemStatus as p,IkasCheckoutRequirement as u,IkasThemeJsonComponentPropType as m}from"@ikas/storefront-models";import"@ikas/localized-address";import"@ikas/storefront-api";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasStorefrontConfig as d}from"@ikas/storefront-config";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/product-list/functions.js";import"../../models/ui/product-list/index.js";import"@ikas/storefront-providers";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import{IkasPageDataInit as c}from"../../page-data-init/index.js";import{IkasBaseStore as f}from"../../store/base/index.js";import"lodash/flatten";import"lodash/sortBy";import"@ikas/storefront-model-functions";import"../../store/cart/index.js";import"../checkout/types.js";import"../../store/customer/index.js";import"../../analytics/events.js";import"lodash/cloneDeep";import"../../store/analytics/index.js";import"../../analytics/ikas.js";import"../../store/customer/consent/data.js";import"../../analytics/head/index.js";import"../../store/customer/account-auth/data.js";import"../../store/customer/captcha/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"@ikas/fe-api-client";import"../../store/customer/marketing/data.js";import"../../store/customer/order/data.js";var v=function(v){function g(e){var o=v.call(this,e)||this;return o.state={hasError:!1},o.onMouseEnter=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseOver(r.id)},o.onMouseLeave=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onMouseLeave(r.id)},o.onClick=function(){var e=o.props,t=e.vm,r=e.pageComponent;t.onClick(r.id)},o.ref=t.createRef(),n(o,{pageComponentPropValue:i,propValues:i,isSelected:i,isHovered:i,hasNullValue:i,rendered:i,Component:i}),o}return e(g,v),g.prototype.componentDidMount=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},g.prototype.componentDidUpdate=function(){var e=this.props,o=e.vm,t=e.pageComponent;o.setComponentRef(this.ref.current,t)},g.getDerivedStateFromError=function(e){return console.error(e),{hasError:!0}},Object.defineProperty(g.prototype,"pageComponentPropValue",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.initializedPropValues.find((function(e){return e.pageComponent.id===t.id}))},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"propValues",{get:function(){var e,t,r=this.props.vm,n=null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.propValues;(null===(t=r.page)||void 0===t?void 0:t.type)===l.CHECKOUT&&(n={checkout:{id:"",billingAddress:null,shippingAddress:null,currencyCode:"TRY",currencySymbol:"₺",orderLineItems:[{id:"",createdAt:0,updatedAt:0,currencyCode:"TRY",currencySymbol:"₺",discount:null,discountPrice:null,finalPrice:100,options:null,originalOrderLineItemId:null,price:100,quantity:1,status:p.UNFULFILLED,statusUpdatedAt:null,stockLocationId:null,taxValue:null,unitPrice:null,finalUnitPrice:null,variant:{barcodeList:null,brand:null,categories:null,id:null,mainImageId:null,name:"",prices:null,productId:null,sku:null,slug:null,tagIds:null,taxValue:null,type:null,weight:null,variantValues:[],baseUnit:null,unit:null,tags:null},orderedAt:0}]},checkoutSettings:{createdAt:0,updatedAt:0,id:"",giftPackagePriceList:null,identityNumberRequirement:u.OPTIONAL,isAccountRequired:!1,isGiftPackageEnabled:!1,isQuickRegistrationEnabled:!1,isShowPostalCode:!0,isTermsAndConditionsDefaultChecked:null,options:null,phoneRequirement:u.OPTIONAL,postalCodeRequirement:u.OPTIONAL,showCheckoutNote:!0,showTermsAndConditionsCheckbox:!0,storefrontId:""},customizationProps:o({},n),returnPolicy:"",privacyPolicy:"",termsOfService:"",imprint:"",shippingPolicy:""});return n},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isSelected",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.selectedPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isHovered",{get:function(){var e=this.props,o=e.vm,t=e.pageComponent;return o.hoveredPageComponentId===t.id},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"hasNullValue",{get:function(){var e,o=this;return!!(null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.props.some((function(e){var t;if(e.isRequired){var r=(o.propValues||{})[e.name],n=null===(t=o.pageComponentPropValue)||void 0===t?void 0:t.component.props.find((function(o){return o.id===e.requiredPropId}));if(n){var i=(o.propValues||{})[n.name];if(n.type===m.BOOLEAN&&!i||n.type===m.CUSTOM&&i!==e.requiredEnumOptionValue)return!1}return null===r||null==r}})))},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"rendered",{get:function(){var e,n,i=this.Component,s=this.props.vm;return this.hasNullValue||this.state.hasError?t.createElement(r,{name:null===(e=this.pageComponentPropValue)||void 0===e?void 0:e.component.displayName}):t.createElement(i,o({},this.propValues,{store:f,settings:null===(n=s.theme)||void 0===n?void 0:n.settings,pageSpecificData:c.pageSpecificData}))},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"Component",{get:function(){var e,o=this.props,t=o.vm,r=o.pageComponent,n=d.getCurrentPageComponents();if(!n)return null;var i=n[r.componentId];return(null===(e=t.page)||void 0===e?void 0:e.type)===l.CHECKOUT&&(i=s),i},enumerable:!1,configurable:!0}),g.prototype.render=function(){var e=this;return t.createElement(a,null,(function(){var o;return e.state.hasError?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,onClick:e.onClick},t.createElement(r,{name:null===(o=e.pageComponentPropValue)||void 0===o?void 0:o.component.displayName}),";"):d.getCurrentPageComponents()?t.createElement("div",{ref:e.ref,style:{position:"relative"},onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave},e.rendered):(console.error("Components for the page not found."),null)}))},g}(t.Component);export{v as ThemeEditorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from
|
|
1
|
+
import{__extends as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{Observer as o}from"mobx-react-lite";import{withRouter as n}from"next/router.js";import{ThemeEditorComponent as r}from"./ThemeComponentEditor.js";import i from"./model.js";import{IkasPageHead as s}from"../page/head.js";import{IkasEditorComponentLoader as a}from"./loader/index.js";import{reaction as m,makeObservable as p,computed as l}from"mobx";import{getGoogleFontHref as d}from"../../utils/google-fonts.js";import{IkasBaseStore as c}from"../../store/base/index.js";import"@ikas/storefront-api";import"@ikas/storefront-config";import"lodash/flatten";import"lodash/sortBy";import"@ikas/storefront-model-functions";import"../../store/cart/index.js";import"../checkout/types.js";import"../../store/customer/index.js";import"../../analytics/events.js";import"lodash/cloneDeep";import"../../store/analytics/index.js";import"../../analytics/ikas.js";import"../../store/customer/consent/data.js";import"../../analytics/head/index.js";import"../../store/customer/account-auth/data.js";import"../../store/customer/captcha/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"@ikas/fe-api-client";import"@ikas/storefront-models";import"@ikas/localized-address";import"../../store/customer/marketing/data.js";import"../../store/customer/order/data.js";import"@ikas/storefront-providers";var u=n(function(n){function u(e){var t=n.call(this,e)||this;return t.interceptClickEvent=function(e){var t=e.target;"A"===t.tagName&&(t.getAttribute("href"),e.preventDefault())},t.handleRouteChangeStart=function(e,o){throw t.vm.onPageChange(e),""},t.injectFontScript=function(){var e;if(null===(e=t.vm.theme)||void 0===e?void 0:e.settings.fontFamily.name){var o=t.vm.theme.settings.fontFamily,n=document.getElementById("ikas-font");n&&n.remove();var r=d(o);if(r){var i=document.createElement("link");i.setAttribute("id","ikas-font"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",r),document.getElementsByTagName("head")[0].appendChild(i),document.body.style.setProperty("font-family","'".concat(o.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'),"important")}}else document.body.style.setProperty("font-family",'-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif')},t.vm=new i(e.router),p(t,{headerPageComponent:l,footerPageComponent:l,otherComponents:l}),t}return e(u,n),u.prototype.componentDidMount=function(){var e=this;this.props.router.events.on("routeChangeStart",this.handleRouteChangeStart),c.router=this.props.router,document.addEventListener&&document.addEventListener("click",this.interceptClickEvent),this.disposer&&this.disposer(),this.disposer=m((function(){var t;return null===(t=e.vm.theme)||void 0===t?void 0:t.settings}),(function(){var t;null===(t=e.vm.theme)||void 0===t||t.settings.colors.map((function(e){return document.documentElement.style.setProperty(e.key,e.color)})),e.injectFontScript()}))},u.prototype.componentWillUnmount=function(){this.props.router.events.off("routeChangeStart",this.handleRouteChangeStart),document.removeEventListener("click",this.interceptClickEvent),this.disposer&&this.disposer()},Object.defineProperty(u.prototype,"headerPageComponent",{get:function(){var e,t,o=this.vm,n=null===(e=o.theme)||void 0===e?void 0:e.components.find((function(e){return e.isHeader}));return null===(t=o.pageComponents)||void 0===t?void 0:t.find((function(e){return e.componentId===(null==n?void 0:n.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"footerPageComponent",{get:function(){var e,t,o=this.vm,n=null===(e=o.theme)||void 0===e?void 0:e.components.find((function(e){return e.isFooter}));return null===(t=o.pageComponents)||void 0===t?void 0:t.find((function(e){return e.componentId===(null==n?void 0:n.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"otherComponents",{get:function(){var e,t,o,n=this.vm,r=null===(e=n.theme)||void 0===e?void 0:e.components.find((function(e){return e.isHeader})),i=null===(t=n.theme)||void 0===t?void 0:t.components.find((function(e){return e.isFooter}));return null===(o=n.pageComponents)||void 0===o?void 0:o.filter((function(e){return e.componentId!==(null==r?void 0:r.id)&&e.componentId!==(null==i?void 0:i.id)}))},enumerable:!1,configurable:!0}),u.prototype.render=function(){var e=this,n=this.vm;return t.createElement(o,null,(function(){var o;return n.isLoading?t.createElement(a,{isFullPage:!0}):t.createElement(t.Fragment,null,!!n.page&&t.createElement(s,{pageType:n.page.type,pageTitle:n.page.pageTitle,pageDescription:n.page.description}),t.createElement("div",{style:f},t.createElement("div",null,!!e.headerPageComponent&&t.createElement(r,{key:e.headerPageComponent.id,vm:n,pageComponent:e.headerPageComponent}),null===(o=e.otherComponents)||void 0===o?void 0:o.map((function(e){return t.createElement(r,{key:e.id,vm:n,pageComponent:e})}))),!!e.footerPageComponent&&t.createElement(r,{key:e.footerPageComponent.id,vm:n,pageComponent:e.footerPageComponent})))}))},u}(t.Component)),f={minHeight:"100vh",width:"100vw",display:"flex",flexDirection:"column",justifyContent:"space-between"};export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from
|
|
1
|
+
import e from'./../../../ext/style-inject/dist/style-inject.es.js';var t={Container:"style-module_Container__P0FwV",fullPage:"style-module_fullPage__LtR1g",loader:"style-module_loader__6N3Tm",load8:"style-module_load8__a-tru"};e(".style-module_Container__P0FwV {\n width: 100%;\n height: 300px;\n background-color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.style-module_Container__P0FwV.style-module_fullPage__LtR1g {\n height: 100vh;\n}\n.style-module_Container__P0FwV .style-module_loader__6N3Tm,\n.style-module_Container__P0FwV .style-module_loader__6N3Tm:after {\n border-radius: 50%;\n width: 5em;\n height: 5em;\n}\n.style-module_Container__P0FwV .style-module_loader__6N3Tm {\n font-size: 6px;\n position: relative;\n text-indent: -9999em;\n border-top: 0.5em solid rgba(255, 255, 255, 0.2);\n border-right: 0.5em solid rgba(255, 255, 255, 0.2);\n border-bottom: 0.5em solid rgba(255, 255, 255, 0.2);\n border-left: 0.5em solid black;\n -webkit-transform: translateZ(0);\n -ms-transform: translateZ(0);\n transform: translateZ(0);\n -webkit-animation: style-module_load8__a-tru 1.1s infinite linear;\n animation: style-module_load8__a-tru 1.1s infinite linear;\n}\n@-webkit-keyframes style-module_load8__a-tru {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes style-module_load8__a-tru {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}");export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from"../../node_modules/tslib/tslib.es6.js";import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import{IkasThemeJsonPageType as i,IkasBlogMetaDataTargetType as o,IkasHTMLMetaDataTargetType as s}from"@ikas/storefront-models";import"@ikas/localized-address";import{reaction as a,makeAutoObservable as r,runInAction as d}from"mobx";import{listRaffleMetaData as c,listBlogMetaData as p,listHTMLMetaData as u,setAPIClientConfig as l,listCustomerSettings as m,searchProducts as g}from"@ikas/storefront-api";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/product-list/functions.js";import"../../models/ui/product-list/index.js";import{IkasPageDataProvider as h}from"@ikas/storefront-providers";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import{IkasPageDataInit as f}from"../../page-data-init/index.js";import{IkasVariantTypeFunctions as E,IkasVariantValueFunctions as v}from"@ikas/storefront-model-functions";import"../../store/cart/index.js";import"../checkout/types.js";import"../../store/customer/index.js";import"../../analytics/events.js";import"lodash/cloneDeep";import"../../store/analytics/index.js";import"../../analytics/ikas.js";import"../../store/customer/consent/data.js";import"../../analytics/head/index.js";import"../page/index.js";import"../page/head.js";import"react";import"next/image.js";import"../link/index.js";import"./loader/style.module.scss.js";import"../google-captcha/index.js";import{IkasBaseStore as P}from"../../store/base/index.js";import"lodash/flatten";import"lodash/sortBy";import"../../store/customer/account-auth/data.js";import"../../store/customer/captcha/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"@ikas/fe-api-client";import"../../store/customer/marketing/data.js";import"../../store/customer/order/data.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import"lodash/get";import{IkasThemeJson as O}from"../../models/data/theme-json/index.js";import{IkasThemeJsonPageComponent as T}from"../../models/data/theme-json/page/component/index.js";import{IkasThemeJsonComponent as C}from"../../models/data/theme-json/component/index.js";import{IkasThemeJsonSettings as _}from"../../models/data/theme-json/settings/index.js";var D,A=function(){function A(a){var g=this;this.theme=null,this.page=null,this.selectedPageComponentId=null,this.hoveredPageComponentId=null,this.componentRefs={},this.isLoading=!1,this.updateId="",this.locale="en",this.pageParams={},this.apiKey=null,this.pageDataProvider=null,this.initializedPropValues=[],this.startMessaging=function(){window.addEventListener("message",g.onMessage,!1),g.sendMessage(D.FRAME_DID_LOAD,"4.5.0"),g.createLoadingListener()},this.onMessage=function(n){return e(g,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:switch(e=n.data.type,i=n.data.data,e){case D.UPDATE_FRAME_DATA:return[3,1];case D.UPDATE_THEME_JSON:return[3,3];case D.UPDATE_PROP_VALUE:return[3,5];case D.UPDATE_PAGE_PARAMS:return[3,7];case D.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case D.ADD_COMPONENT:return[3,11];case D.DELETE_COMPONENT:return[3,12];case D.UPDATE_COMPONENT:return[3,13];case D.ADD_PAGE_COMPONENT:return[3,14];case D.DELETE_PAGE_COMPONENT:return[3,16];case D.SET_SELECTED_COMPONENT:return[3,17];case D.SET_HOVERED_COMPONENT:return[3,18];case D.SCROLL_TO_COMPONENT:return[3,19];case D.EDITOR_RELOAD:return[3,20];case D.UPDATE_THEME_SETTINGS:return[3,21]}return[3,22];case 1:return[4,this.handleUpdateFrameData(i)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,23];case 3:return[4,this.handleUpdateThemeJson(i)];case 5:return[4,this.handleUpdatePropValue(i)];case 7:return[4,this.handleUpdatePageParams(i)];case 9:return[4,this.handleUpdatePageComponentOrder(i)];case 11:return this.handleAddNewComponent(i),[3,23];case 12:return this.handleDeleteComponent(i),[3,23];case 13:return this.handleUpdateComponent(i),[3,23];case 14:return[4,this.handleAddNewPageComponent(i)];case 16:return this.handleDeletePageComponent(i),[3,23];case 17:return this.handleSetSelectedComponent(i),[3,23];case 18:return this.handleSetHoveredComponent(i),[3,23];case 19:return this.handleScrollToComponent(i),[3,23];case 20:return this.handleEditorReload(),[3,23];case 21:return this.updateThemeSettings(i),[3,23];case 22:return[3,23];case 23:return[2]}}))}))},this.onClick=function(e){g.sendMessage(D.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){g.sendMessage(D.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){g.sendMessage(D.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(n){return e(g,void 0,void 0,(function(){var e,a,r,l,m,g,h,f,E,v,O,T,C,_=this;return t(this,(function(t){switch(t.label){case 0:return e=n.slice(1),a=e.split("?"),e=a[0],r=a[1],this.pageParams={},n.startsWith("/account/orders/")?l=i.ORDER_DETAIL:n.startsWith("/account/orders")?l=i.ORDERS:n.startsWith("/account/addresses")?l=i.ADDRESSES:n.startsWith("/account/favorite-products")?l=i.FAVORITE_PRODUCTS:n.startsWith("/account/forgot-password")?l=i.FORGOT_PASSWORD:n.startsWith("/account/login")?l=i.LOGIN:n.startsWith("/account/raffles")?l=i.RAFFLE_ACCOUNT:n.startsWith("/account/recover-password")?l=i.RECOVER_PASSWORD:n.startsWith("/account/activate")?l=i.ACTIVATE_CUSTOMER:n.startsWith("/account/register")?l=i.REGISTER:n.startsWith("/account")?l=i.ACCOUNT:n.startsWith("/blog/")?l=i.BLOG:n.startsWith("/blog")?l=i.BLOG_INDEX:n.startsWith("/pages")?(l=i.CUSTOM,this.pageParams={slug:e.split("/")[1]}):l=n.startsWith("/raffle/")?i.RAFFLE_DETAIL:n.startsWith("/raffle")?i.RAFFLE:n.startsWith("/404")?i.NOT_FOUND:n.startsWith("/cart")?i.CART:n.startsWith("/checkout")?i.CHECKOUT:"/"===n?i.INDEX:n.startsWith("/search")?i.SEARCH:i.PRODUCT,l!==i.PRODUCT?[3,6]:[4,u({slug:{eq:e}})];case 1:return(g=t.sent()).isSuccess&&(null===(E=g.data)||void 0===E?void 0:E.length)?(h=g.data[0]).targetType!==s.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(h.targetId,r)]:[3,5];case 2:return m=t.sent(),this.pageParams={productId:h.targetId,variantId:m,slug:e},[3,4];case 3:if(h.targetType===s.CATEGORY)l=i.CATEGORY,this.pageParams={categoryId:h.targetId,slug:e};else{if(h.targetType!==s.BRAND)return[2];l=i.BRAND,this.pageParams={brandId:h.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return l!==i.BLOG?[3,8]:[4,p({slug:{eq:e}})];case 7:if(!(g=t.sent()).isSuccess||!(null===(O=null===(v=g.data)||void 0===v?void 0:v.data)||void 0===O?void 0:O.length))return[2];if((h=g.data.data[0]).targetType===o.BLOG)this.pageParams={blogId:h.targetId,slug:e};else{if(h.targetType!==o.BLOG_CATEGORY)return[2];l=i.BLOG_CATEGORY,this.pageParams={blogCategoryId:h.targetId,slug:e}}t.label=8;case 8:return l!==i.RAFFLE_DETAIL?[3,10]:[4,c({slug:{eq:e}})];case 9:if(!(g=t.sent()).isSuccess||!(null===(T=g.data)||void 0===T?void 0:T.length))return[2];h=g.data[0],this.pageParams={raffleId:h.targetId,slug:e},t.label=10;case 10:return this.isLoading=!0,[4,this.getPagePropValues(this.theme,l,this.pageParams)];case 11:return f=t.sent(),d((function(){var e,t;P.currentPageType=l,_.pageDataProvider=f,l===i.CUSTOM?_.page=null===(e=_.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===l&&e.slug===_.pageParams.slug})):_.page=null===(t=_.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===l})),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(D.EDITOR_PAGE_CHANGE,{pageType:l,pageParams:this.pageParams,pageSpecificData:(null===(C=this.pageDataProvider)||void 0===C?void 0:C.pageSpecificData)||null}),this.isLoading=!1,[2]}}))}))},this.onLoadingChange=function(){g.sendMessage(D.EDITOR_LOADING_CHANGE,{isLoading:g.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(n,o,s){return e(g,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new h(n,s,o),(s.blogId||s.blogCategoryId)&&(e.possiblePageTypes=[i.BLOG,i.BLOG_CATEGORY]),s.raffleId&&(e.possiblePageTypes=[i.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(f.setPageSpecificData(e.pageSpecificData,o,!0),o===i.PRODUCT&&f.pageSpecificData&&(a=f.pageSpecificData,(r=a.variants.find((function(e){return e.id===s.variantId})))&&(a.selectedVariantValues=r.variantValues))):f.pageSpecificData=void 0,this.initializedPropValues=f.initPagePropValues(e.$pageComponentPropValues,n.components,n.customData,n.settings,!1),[2,e]}}))}))},this.setComponentRef=function(e,t){g.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.bottom;return n<window.innerHeight&&i>=0&&i<window.innerHeight&&n>0},this.handleUpdateFrameData=function(i){return e(g,void 0,void 0,(function(){var e,o,s,a,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new O(i.theme),this.page=null===(r=this.theme)||void 0===r?void 0:r.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.page?((e=i.storefront?i.storefront:null)&&(o=e.routings.find((function(e){return e.locale===c.locale})),n.init({storefrontId:e.id,storefrontRoutingId:null==o?void 0:o.id,storefrontThemeId:e.mainStorefrontThemeId||void 0,salesChannelId:e.salesChannelId||void 0,priceListId:(null==o?void 0:o.priceListId)||void 0,routings:e.routings,stockPreference:null===(d=this.theme)||void 0===d?void 0:d.settings.stockPreference,translations:this.translations||n.getTranslations(),isEditor:!0,apiKey:i.apiKey,apiUrl:i.apiUrl,cdnUrl:i.cdnUrl,merchantSettings:i.merchantSettings}),l(),this.setCustomerSettings()),s=Date.now()+"",this.updateId=s,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return a=t.sent(),this.updateId===s&&(this.pageDataProvider=a,this.isLoading=!1),[2]}}))}))},this.setCustomerSettings=function(){return e(g,void 0,void 0,(function(){var e,i,o;return t(this,(function(t){switch(t.label){case 0:return n.getCustomerSettings()?[3,2]:[4,m({storefrontId:{eq:n.getStorefrontId()}})];case 1:(e=t.sent()).isSuccess&&(null===(o=e.data)||void 0===o?void 0:o.data.length)&&(i=e.data.data[0],n.init({customerSettings:i})),t.label=2;case 2:return[2]}}))}))},this.handleUpdateThemeJson=function(n){return e(g,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new O(n.theme),[2]}))}))},this.handleUpdatePropValue=function(n){return e(g,void 0,void 0,(function(){var e,i,o,s,a,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return e=n.propName,i=n.value,(o=null===(d=null===(r=this.selectedComponent)||void 0===r?void 0:r.props)||void 0===d?void 0:d.find((function(t){return t.name===e})))&&this.selectedPageComponent?(s=this.initializedPropValues.find((function(e){return e.pageComponent.id===c.selectedPageComponentId})),this.pageDataProvider&&s?(this.selectedPageComponent.propValues[e]=i,[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,o)]):[2]):[2];case 1:return(a=t.sent())&&JSON.stringify(a).includes("href")?[4,this.pageDataProvider.setLinkSlugs()]:[3,3];case 2:t.sent(),t.label=3;case 3:return s.propValues[e]=f.initPropValue(o,a,this.theme.settings,!0),[2]}}))}))},this.handleUpdatePageParams=function(n){return e(g,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=n.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(n){return e(g,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=n.pageComponents.map((function(e){return new T(e)})):this.page.components=n.pageComponents.map((function(e){return new T(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,n=new C(e.component);null===(t=g.theme)||void 0===t||t.components.push(n)},this.handleDeleteComponent=function(e){var t,n;(null===(t=g.theme)||void 0===t?void 0:t.components)&&(g.theme.components=g.theme.components.filter((function(t){return t.id!==e.componentId})));var i=g.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];g.specification&&g.specification.components&&(g.specification.components=i),!g.specification&&(null===(n=g.page)||void 0===n?void 0:n.components)&&(g.page.components=i)},this.handleUpdateComponent=function(e){var t=g.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(g.theme.components[t]=new C(e.component))},this.handleAddNewPageComponent=function(n){return e(g,void 0,void 0,(function(){var e,o,s,a,r,d,c;return t(this,(function(t){switch(t.label){case 0:return e=new T(n.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return o=t.sent(),s=f.initPageComponentPropValue(o,[o.component],this.theme.settings,!0),this.initializedPropValues.push(s),(null===(d=this.page)||void 0===d?void 0:d.type)===i.CHECKOUT?[2]:(a=null===(c=this.theme)||void 0===c?void 0:c.components.find((function(t){return t.id===e.componentId})),r=this.pageComponents.find((function(e){return e.componentId===(null==a?void 0:a.id)})),(null==a?void 0:a.isCommon)&&r||(n.customIndex?this.pageComponents.splice(n.customIndex,0,e):this.pageComponents.push(e)),[2])}}))}))},this.handleDeletePageComponent=function(e){g.specification?g.specification.components=g.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):g.page.components=g.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){g.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){g.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,n=g.componentRefs[t];n&&(g.isScrolledIntoView(n)||window.scrollTo({top:n.offsetTop,behavior:"smooth"}))},this.handleEditorReload=function(){window.location.reload()},this.updateThemeSettings=function(e){var t=e.settings;g.theme&&(g.theme.settings=new _(t))},this.router=a,r(this),this.startMessaging()}return Object.defineProperty(A.prototype,"specification",{get:function(){var e,t,n,o,s,a,r,d=this,c=this.page;return(null==c?void 0:c.type)===i.PRODUCT&&(r=null===(e=c.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.productId)}))),(null==c?void 0:c.type)===i.CATEGORY&&(r=null===(t=c.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==c?void 0:c.type)===i.BRAND&&(r=null===(n=c.specifications)||void 0===n?void 0:n.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==c?void 0:c.type)===i.BLOG&&(r=null===(o=c.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogId)}))),(null==c?void 0:c.type)===i.BLOG_CATEGORY&&(r=null===(s=c.specifications)||void 0===s?void 0:s.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==c?void 0:c.type)===i.RAFFLE_DETAIL&&(r=null===(a=c.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var n;return e.id===(null===(n=t.selectedPageComponent)||void 0===n?void 0:n.componentId)}))},enumerable:!1,configurable:!0}),A.prototype.createLoadingListener=function(){var e=this;a((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},A.prototype.getVariantIdFromParams=function(i,o){var s,a;return e(this,void 0,void 0,(function(){var e,r,d,c,p,u,l,m,h;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+o),[4,g({input:{productIdList:[i],priceListId:n.getPriceListId(),salesChannelId:n.getSalesChannelId()}})];case 1:return(r=t.sent()).isSuccess&&!(null===(a=null===(s=null==r?void 0:r.data)||void 0===s?void 0:s.data)||void 0===a?void 0:a.length)?[2]:(d=E.getVariantTypeSlug,c=v.getVariantValueSlug,p=r.data.data[0],u=p.variantTypes.map((function(e){return d(e.variantType)})),l=[],u.forEach((function(t,n){var i=p.variantTypes[n],o=e.get(t);if(o){var s=i.variantType.values.find((function(e){return c(e)===o}));s&&l.push(s)}})),(m=p.variants.find((function(e){return e.variantValues.every((function(e){return l.some((function(t){return t.id===e.id}))}))})))?[2,m.id]:[3,3]);case 2:return h=t.sent(),console.error(h),[3,3];case 3:return[2]}}))}))},A}();!function(e){e.FRAME_DID_LOAD="FRAME_DID_LOAD",e.UPDATE_FRAME_DATA="UPDATE_FRAME_DATA",e.UPDATE_THEME_JSON="UPDATE_THEME_JSON",e.UPDATE_PROP_VALUE="UPDATE_PROP_VALUE",e.UPDATE_PAGE_PARAMS="UPDATE_PAGE_PARAMS",e.UPDATE_PAGE_COMPONENT_ORDER="UPDATE_PAGE_COMPONENT_ORDER",e.ADD_COMPONENT="ADD_COMPONENT",e.DELETE_COMPONENT="DELETE_COMPONENT",e.UPDATE_COMPONENT="UPDATE_COMPONENT",e.ADD_PAGE_COMPONENT="ADD_PAGE_COMPONENT",e.DELETE_PAGE_COMPONENT="DELETE_PAGE_COMPONENT",e.COMPONENT_MOUSE_OVER="COMPONENT_MOUSE_OVER",e.COMPONENT_MOUSE_LEAVE="COMPONENT_MOUSE_LEAVE",e.COMPONENT_CLICK="COMPONENT_CLICK",e.SET_SELECTED_COMPONENT="SET_SELECTED_COMPONENT",e.SET_HOVERED_COMPONENT="SET_HOVERED_COMPONENT",e.SCROLL_TO_COMPONENT="SCROLL_TO_COMPONENT",e.UPDATE_THEME_SETTINGS="UPDATE_THEME_SETTINGS",e.EDITOR_PAGE_CHANGE="EDITOR_PAGE_CHANGE",e.EDITOR_LOADING_CHANGE="EDITOR_LOADING_CHANGE",e.EDITOR_RELOAD="EDITOR_RELOAD"}(D||(D={}));export{D as BridgeMessageType,A as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as n}from"@ikas/storefront-config";import{IkasThemeJsonPageType as i,IkasBlogMetaDataTargetType as o,IkasHTMLMetaDataTargetType as s}from"@ikas/storefront-models";import"@ikas/localized-address";import{reaction as a,makeAutoObservable as r,runInAction as d}from"mobx";import{listRaffleMetaData as c,listBlogMetaData as p,listHTMLMetaData as u,setAPIClientConfig as l,listCustomerSettings as m,searchProducts as g}from"@ikas/storefront-api";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/product-list/functions.js";import"../../models/ui/product-list/index.js";import{IkasPageDataProvider as h}from"@ikas/storefront-providers";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import{IkasPageDataInit as f}from"../../page-data-init/index.js";import{IkasVariantTypeFunctions as E,IkasVariantValueFunctions as v}from"@ikas/storefront-model-functions";import"../../store/cart/index.js";import"../checkout/types.js";import"../../store/customer/index.js";import"../../analytics/events.js";import"lodash/cloneDeep";import"../../store/analytics/index.js";import"../../analytics/ikas.js";import"../../store/customer/consent/data.js";import"../../analytics/head/index.js";import"../page/index.js";import"../page/head.js";import"react";import"next/image.js";import"../link/index.js";import"./loader/style.module.scss.js";import"../google-captcha/index.js";import{IkasBaseStore as P}from"../../store/base/index.js";import"lodash/flatten";import"lodash/sortBy";import"../../store/customer/account-auth/data.js";import"../../store/customer/captcha/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"@ikas/fe-api-client";import"../../store/customer/marketing/data.js";import"../../store/customer/order/data.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import"lodash/get";import{IkasThemeJson as O}from"../../models/data/theme-json/index.js";import{IkasThemeJsonPageComponent as T}from"../../models/data/theme-json/page/component/index.js";import{IkasThemeJsonComponent as C}from"../../models/data/theme-json/component/index.js";import{IkasThemeJsonSettings as _}from"../../models/data/theme-json/settings/index.js";var D,A=function(){function A(a){var g=this;this.theme=null,this.page=null,this.selectedPageComponentId=null,this.hoveredPageComponentId=null,this.componentRefs={},this.isLoading=!1,this.updateId="",this.locale="en",this.pageParams={},this.apiKey=null,this.pageDataProvider=null,this.initializedPropValues=[],this.startMessaging=function(){window.addEventListener("message",g.onMessage,!1),g.sendMessage(D.FRAME_DID_LOAD,"4.5.0"),g.createLoadingListener()},this.onMessage=function(n){return e(g,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:switch(e=n.data.type,i=n.data.data,e){case D.UPDATE_FRAME_DATA:return[3,1];case D.UPDATE_THEME_JSON:return[3,3];case D.UPDATE_PROP_VALUE:return[3,5];case D.UPDATE_PAGE_PARAMS:return[3,7];case D.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case D.ADD_COMPONENT:return[3,11];case D.DELETE_COMPONENT:return[3,12];case D.UPDATE_COMPONENT:return[3,13];case D.ADD_PAGE_COMPONENT:return[3,14];case D.DELETE_PAGE_COMPONENT:return[3,16];case D.SET_SELECTED_COMPONENT:return[3,17];case D.SET_HOVERED_COMPONENT:return[3,18];case D.SCROLL_TO_COMPONENT:return[3,19];case D.EDITOR_RELOAD:return[3,20];case D.UPDATE_THEME_SETTINGS:return[3,21]}return[3,22];case 1:return[4,this.handleUpdateFrameData(i)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,23];case 3:return[4,this.handleUpdateThemeJson(i)];case 5:return[4,this.handleUpdatePropValue(i)];case 7:return[4,this.handleUpdatePageParams(i)];case 9:return[4,this.handleUpdatePageComponentOrder(i)];case 11:return this.handleAddNewComponent(i),[3,23];case 12:return this.handleDeleteComponent(i),[3,23];case 13:return this.handleUpdateComponent(i),[3,23];case 14:return[4,this.handleAddNewPageComponent(i)];case 16:return this.handleDeletePageComponent(i),[3,23];case 17:return this.handleSetSelectedComponent(i),[3,23];case 18:return this.handleSetHoveredComponent(i),[3,23];case 19:return this.handleScrollToComponent(i),[3,23];case 20:return this.handleEditorReload(),[3,23];case 21:return this.updateThemeSettings(i),[3,23];case 22:return[3,23];case 23:return[2]}}))}))},this.onClick=function(e){g.sendMessage(D.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){g.sendMessage(D.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){g.sendMessage(D.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(n){return e(g,void 0,void 0,(function(){var e,a,r,l,m,g,h,f,E,v,O,T,C,_=this;return t(this,(function(t){switch(t.label){case 0:return e=n.slice(1),a=e.split("?"),e=a[0],r=a[1],this.pageParams={},n.startsWith("/account/orders/")?l=i.ORDER_DETAIL:n.startsWith("/account/orders")?l=i.ORDERS:n.startsWith("/account/addresses")?l=i.ADDRESSES:n.startsWith("/account/favorite-products")?l=i.FAVORITE_PRODUCTS:n.startsWith("/account/forgot-password")?l=i.FORGOT_PASSWORD:n.startsWith("/account/login")?l=i.LOGIN:n.startsWith("/account/raffles")?l=i.RAFFLE_ACCOUNT:n.startsWith("/account/recover-password")?l=i.RECOVER_PASSWORD:n.startsWith("/account/activate")?l=i.ACTIVATE_CUSTOMER:n.startsWith("/account/register")?l=i.REGISTER:n.startsWith("/account")?l=i.ACCOUNT:n.startsWith("/blog/")?l=i.BLOG:n.startsWith("/blog")?l=i.BLOG_INDEX:n.startsWith("/pages")?(l=i.CUSTOM,this.pageParams={slug:e.split("/")[1]}):l=n.startsWith("/raffle/")?i.RAFFLE_DETAIL:n.startsWith("/raffle")?i.RAFFLE:n.startsWith("/404")?i.NOT_FOUND:n.startsWith("/cart")?i.CART:n.startsWith("/checkout")?i.CHECKOUT:"/"===n?i.INDEX:n.startsWith("/search")?i.SEARCH:i.PRODUCT,l!==i.PRODUCT?[3,6]:[4,u({slug:{eq:e}})];case 1:return(g=t.sent()).isSuccess&&(null===(E=g.data)||void 0===E?void 0:E.length)?(h=g.data[0]).targetType!==s.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(h.targetId,r)]:[3,5];case 2:return m=t.sent(),this.pageParams={productId:h.targetId,variantId:m,slug:e},[3,4];case 3:if(h.targetType===s.CATEGORY)l=i.CATEGORY,this.pageParams={categoryId:h.targetId,slug:e};else{if(h.targetType!==s.BRAND)return[2];l=i.BRAND,this.pageParams={brandId:h.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return l!==i.BLOG?[3,8]:[4,p({slug:{eq:e}})];case 7:if(!(g=t.sent()).isSuccess||!(null===(O=null===(v=g.data)||void 0===v?void 0:v.data)||void 0===O?void 0:O.length))return[2];if((h=g.data.data[0]).targetType===o.BLOG)this.pageParams={blogId:h.targetId,slug:e};else{if(h.targetType!==o.BLOG_CATEGORY)return[2];l=i.BLOG_CATEGORY,this.pageParams={blogCategoryId:h.targetId,slug:e}}t.label=8;case 8:return l!==i.RAFFLE_DETAIL?[3,10]:[4,c({slug:{eq:e}})];case 9:if(!(g=t.sent()).isSuccess||!(null===(T=g.data)||void 0===T?void 0:T.length))return[2];h=g.data[0],this.pageParams={raffleId:h.targetId,slug:e},t.label=10;case 10:return this.isLoading=!0,[4,this.getPagePropValues(this.theme,l,this.pageParams)];case 11:return f=t.sent(),d((function(){var e,t;P.currentPageType=l,_.pageDataProvider=f,l===i.CUSTOM?_.page=null===(e=_.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===l&&e.slug===_.pageParams.slug})):_.page=null===(t=_.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===l})),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(D.EDITOR_PAGE_CHANGE,{pageType:l,pageParams:this.pageParams,pageSpecificData:(null===(C=this.pageDataProvider)||void 0===C?void 0:C.pageSpecificData)||null}),this.isLoading=!1,[2]}}))}))},this.onLoadingChange=function(){g.sendMessage(D.EDITOR_LOADING_CHANGE,{isLoading:g.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(n,o,s){return e(g,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new h(n,s,o),(s.blogId||s.blogCategoryId)&&(e.possiblePageTypes=[i.BLOG,i.BLOG_CATEGORY]),s.raffleId&&(e.possiblePageTypes=[i.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(f.setPageSpecificData(e.pageSpecificData,o,!0),o===i.PRODUCT&&f.pageSpecificData&&(a=f.pageSpecificData,(r=a.variants.find((function(e){return e.id===s.variantId})))&&(a.selectedVariantValues=r.variantValues))):f.pageSpecificData=void 0,this.initializedPropValues=f.initPagePropValues(e.$pageComponentPropValues,n.components,n.customData,n.settings,!1),[2,e]}}))}))},this.setComponentRef=function(e,t){g.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.bottom;return n<window.innerHeight&&i>=0&&i<window.innerHeight&&n>0},this.handleUpdateFrameData=function(i){return e(g,void 0,void 0,(function(){var e,o,s,a,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new O(i.theme),this.page=null===(r=this.theme)||void 0===r?void 0:r.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.page?((e=i.storefront?i.storefront:null)&&(o=e.routings.find((function(e){return e.locale===c.locale})),n.init({storefrontId:e.id,storefrontRoutingId:null==o?void 0:o.id,storefrontThemeId:e.mainStorefrontThemeId||void 0,salesChannelId:e.salesChannelId||void 0,priceListId:(null==o?void 0:o.priceListId)||void 0,routings:e.routings,stockPreference:null===(d=this.theme)||void 0===d?void 0:d.settings.stockPreference,translations:this.translations||n.getTranslations(),isEditor:!0,apiKey:i.apiKey,apiUrl:i.apiUrl,cdnUrl:i.cdnUrl,merchantSettings:i.merchantSettings}),l(),this.setCustomerSettings()),s=Date.now()+"",this.updateId=s,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return a=t.sent(),this.updateId===s&&(this.pageDataProvider=a,this.isLoading=!1),[2]}}))}))},this.setCustomerSettings=function(){return e(g,void 0,void 0,(function(){var e,i,o;return t(this,(function(t){switch(t.label){case 0:return n.getCustomerSettings()?[3,2]:[4,m({storefrontId:{eq:n.getStorefrontId()}})];case 1:(e=t.sent()).isSuccess&&(null===(o=e.data)||void 0===o?void 0:o.data.length)&&(i=e.data.data[0],n.init({customerSettings:i})),t.label=2;case 2:return[2]}}))}))},this.handleUpdateThemeJson=function(n){return e(g,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new O(n.theme),[2]}))}))},this.handleUpdatePropValue=function(n){return e(g,void 0,void 0,(function(){var e,i,o,s,a,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return e=n.propName,i=n.value,(o=null===(d=null===(r=this.selectedComponent)||void 0===r?void 0:r.props)||void 0===d?void 0:d.find((function(t){return t.name===e})))&&this.selectedPageComponent?(s=this.initializedPropValues.find((function(e){return e.pageComponent.id===c.selectedPageComponentId})),this.pageDataProvider&&s?(this.selectedPageComponent.propValues[e]=i,[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,o)]):[2]):[2];case 1:return(a=t.sent())&&JSON.stringify(a).includes("href")?[4,this.pageDataProvider.setLinkSlugs()]:[3,3];case 2:t.sent(),t.label=3;case 3:return s.propValues[e]=f.initPropValue(o,a,this.theme.settings,!0),[2]}}))}))},this.handleUpdatePageParams=function(n){return e(g,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=n.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(n){return e(g,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=n.pageComponents.map((function(e){return new T(e)})):this.page.components=n.pageComponents.map((function(e){return new T(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,n=new C(e.component);null===(t=g.theme)||void 0===t||t.components.push(n)},this.handleDeleteComponent=function(e){var t,n;(null===(t=g.theme)||void 0===t?void 0:t.components)&&(g.theme.components=g.theme.components.filter((function(t){return t.id!==e.componentId})));var i=g.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];g.specification&&g.specification.components&&(g.specification.components=i),!g.specification&&(null===(n=g.page)||void 0===n?void 0:n.components)&&(g.page.components=i)},this.handleUpdateComponent=function(e){var t=g.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(g.theme.components[t]=new C(e.component))},this.handleAddNewPageComponent=function(n){return e(g,void 0,void 0,(function(){var e,o,s,a,r,d,c;return t(this,(function(t){switch(t.label){case 0:return e=new T(n.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return o=t.sent(),s=f.initPageComponentPropValue(o,[o.component],this.theme.settings,!0),this.initializedPropValues.push(s),(null===(d=this.page)||void 0===d?void 0:d.type)===i.CHECKOUT?[2]:(a=null===(c=this.theme)||void 0===c?void 0:c.components.find((function(t){return t.id===e.componentId})),r=this.pageComponents.find((function(e){return e.componentId===(null==a?void 0:a.id)})),(null==a?void 0:a.isCommon)&&r||(n.customIndex?this.pageComponents.splice(n.customIndex,0,e):this.pageComponents.push(e)),[2])}}))}))},this.handleDeletePageComponent=function(e){g.specification?g.specification.components=g.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):g.page.components=g.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){g.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){g.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,n=g.componentRefs[t];n&&(g.isScrolledIntoView(n)||window.scrollTo({top:n.offsetTop,behavior:"smooth"}))},this.handleEditorReload=function(){window.location.reload()},this.updateThemeSettings=function(e){var t=e.settings;g.theme&&(g.theme.settings=new _(t))},this.router=a,r(this),this.startMessaging()}return Object.defineProperty(A.prototype,"specification",{get:function(){var e,t,n,o,s,a,r,d=this,c=this.page;return(null==c?void 0:c.type)===i.PRODUCT&&(r=null===(e=c.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.productId)}))),(null==c?void 0:c.type)===i.CATEGORY&&(r=null===(t=c.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==c?void 0:c.type)===i.BRAND&&(r=null===(n=c.specifications)||void 0===n?void 0:n.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==c?void 0:c.type)===i.BLOG&&(r=null===(o=c.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogId)}))),(null==c?void 0:c.type)===i.BLOG_CATEGORY&&(r=null===(s=c.specifications)||void 0===s?void 0:s.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==c?void 0:c.type)===i.RAFFLE_DETAIL&&(r=null===(a=c.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var n;return e.id===(null===(n=t.selectedPageComponent)||void 0===n?void 0:n.componentId)}))},enumerable:!1,configurable:!0}),A.prototype.createLoadingListener=function(){var e=this;a((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},A.prototype.getVariantIdFromParams=function(i,o){var s,a;return e(this,void 0,void 0,(function(){var e,r,d,c,p,u,l,m,h;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+o),[4,g({input:{productIdList:[i],priceListId:n.getPriceListId(),salesChannelId:n.getSalesChannelId()}})];case 1:return(r=t.sent()).isSuccess&&!(null===(a=null===(s=null==r?void 0:r.data)||void 0===s?void 0:s.data)||void 0===a?void 0:a.length)?[2]:(d=E.getVariantTypeSlug,c=v.getVariantValueSlug,p=r.data.data[0],u=p.variantTypes.map((function(e){return d(e.variantType)})),l=[],u.forEach((function(t,n){var i=p.variantTypes[n],o=e.get(t);if(o){var s=i.variantType.values.find((function(e){return c(e)===o}));s&&l.push(s)}})),(m=p.variants.find((function(e){return e.variantValues.every((function(e){return l.some((function(t){return t.id===e.id}))}))})))?[2,m.id]:[3,3]);case 2:return h=t.sent(),console.error(h),[3,3];case 3:return[2]}}))}))},A}();!function(e){e.FRAME_DID_LOAD="FRAME_DID_LOAD",e.UPDATE_FRAME_DATA="UPDATE_FRAME_DATA",e.UPDATE_THEME_JSON="UPDATE_THEME_JSON",e.UPDATE_PROP_VALUE="UPDATE_PROP_VALUE",e.UPDATE_PAGE_PARAMS="UPDATE_PAGE_PARAMS",e.UPDATE_PAGE_COMPONENT_ORDER="UPDATE_PAGE_COMPONENT_ORDER",e.ADD_COMPONENT="ADD_COMPONENT",e.DELETE_COMPONENT="DELETE_COMPONENT",e.UPDATE_COMPONENT="UPDATE_COMPONENT",e.ADD_PAGE_COMPONENT="ADD_PAGE_COMPONENT",e.DELETE_PAGE_COMPONENT="DELETE_PAGE_COMPONENT",e.COMPONENT_MOUSE_OVER="COMPONENT_MOUSE_OVER",e.COMPONENT_MOUSE_LEAVE="COMPONENT_MOUSE_LEAVE",e.COMPONENT_CLICK="COMPONENT_CLICK",e.SET_SELECTED_COMPONENT="SET_SELECTED_COMPONENT",e.SET_HOVERED_COMPONENT="SET_HOVERED_COMPONENT",e.SCROLL_TO_COMPONENT="SCROLL_TO_COMPONENT",e.UPDATE_THEME_SETTINGS="UPDATE_THEME_SETTINGS",e.EDITOR_PAGE_CHANGE="EDITOR_PAGE_CHANGE",e.EDITOR_LOADING_CHANGE="EDITOR_LOADING_CHANGE",e.EDITOR_RELOAD="EDITOR_RELOAD"}(D||(D={}));export{D as BridgeMessageType,A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){void 0===t&&(t={});var d=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===d&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},t(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var r=function(){return r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};function e(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)n.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(r[e[o]]=t[e[o]])}return r}function o(t,n,r,e){return new(r||(r=Promise))((function(o,c){function a(t){try{i(e.next(t))}catch(t){c(t)}}function l(t){try{i(e.throw(t))}catch(t){c(t)}}function i(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(a,l)}i((e=e.apply(t,n||[])).next())}))}function c(t,n){var r,e,o,c,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(l){return function(i){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(a=0)),a;)try{if(r=1,e&&(o=2&l[0]?e.return:l[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,l[1])).done)return o;switch(e=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,e=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=n.call(t,a)}catch(t){l=[6,t],e=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,i])}}}function a(t,n,r){if(r||2===arguments.length)for(var e,o=0,c=n.length;o<c;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}export{r as __assign,o as __awaiter,n as __extends,c as __generator,e as __rest,a as __spreadArray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as i,__generator as t}from
|
|
1
|
+
import{__awaiter as i,__generator as t}from'./../ext/tslib/tslib.es6.js';import{createCustomerReviewList as o,getInitial as r}from"../models/ui/customer-review-list/functions.js";var e=function(e){return i(void 0,void 0,void 0,(function(){var i;return t(this,(function(t){switch(t.label){case 0:return i=o({productId:null==e?void 0:e.productId,limit:(null==e?void 0:e.limit)||10,page:(null==e?void 0:e.page)||1}),[4,r(i)];case 1:return t.sent(),[2,i]}}))}))};export{e as useCustomerReviews};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../../../ext/tslib/tslib.es6.js';import{getOrderLineFile as r}from"@ikas/storefront-api";function n(e){try{return decodeURIComponent(e.value.split("/")[e.value.split("/").length-1])}catch(e){return""}}function o(o){return e(this,void 0,void 0,(function(){var e,s,u,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,r({input:{url:o.value}})];case 1:return e=t.sent(),(s=e.data)?((u=document.createElement("a")).href=s,u.download=n(o),u.click(),u.remove(),[2,e.data]):[3,3];case 2:return a=t.sent(),console.error(a),[3,3];case 3:return[2]}}))}))}export{o as downloadFile,n as getFileName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as r}from
|
|
1
|
+
import{__awaiter as t,__generator as r}from'./../../../ext/tslib/tslib.es6.js';import{searchProducts as o}from"@ikas/storefront-api";import{IkasProductAttributeValueFunctions as e}from"@ikas/storefront-model-functions";import{IkasProductAttributeType as s}from"@ikas/storefront-models";function i(i){var n,u;return t(this,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:if((null===(n=i.productAttribute)||void 0===n?void 0:n.type)!==s.PRODUCT||!i.value)return[2,[]];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,o({input:{productIdList:e.getProductIds(i)}})];case 2:return t=r.sent(),[2,(null===(u=t.data)||void 0===u?void 0:u.data)||[]];case 3:return a=r.sent(),console.error(a),[2,[]];case 4:return[2]}}))}))}export{i as getProducts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as o}from
|
|
1
|
+
import{__awaiter as t,__generator as o}from'./../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{getProductCampaigns as r,getVariantStockLocations as s,listProductOptionSet as e}from"@ikas/storefront-api";import"../../store/base/index.js";import"lodash/flatten";import"lodash/sortBy";import"@ikas/storefront-model-functions";import"../../store/cart/index.js";import"../../components/checkout/types.js";import{IkasCustomerStore as n}from"../../store/customer/index.js";import"../../analytics/events.js";import"lodash/cloneDeep";import"../../store/analytics/index.js";import"../../analytics/ikas.js";import"../../store/customer/consent/data.js";import"../../analytics/head/index.js";import"../../store/customer/account-auth/data.js";import"../../store/customer/captcha/data.js";import"../../store/customer/product/data.js";import"lodash/xorBy";import"@ikas/fe-api-client";import"@ikas/storefront-models";import"@ikas/localized-address";import"../../store/customer/marketing/data.js";import"../../store/customer/order/data.js";import"@ikas/storefront-providers";import{createCustomerReviewList as a,getInitial as d}from"../../models/ui/customer-review-list/functions.js";import"mobx";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/product-list/functions.js";import"../../models/ui/product-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";function u(s){return t(this,void 0,void 0,(function(){var t,e,a,d;return o(this,(function(o){switch(o.label){case 0:return t=n.customer,e=t?t.customerGroupIds:null,a=s.variants.map((function(t){return t.id})),[4,r({input:{customerGroupIds:e,salesChannelId:i.getSalesChannelId()||"",variantIds:a}})];case 1:return d=o.sent(),s.campaigns=d.data,s.campaigns?(s.campaigns.map((function(t){s.variants.map((function(o){var i;t.variantIds.some((function(t){return t===o.id}))&&(null===(i=o.campaigns)||void 0===i||i.push(t))}))})),[2,s.campaigns]):[2]}}))}))}function c(r){return t(this,void 0,void 0,(function(){var t,e;return o(this,(function(o){switch(o.label){case 0:return t=r.variants.map((function(t){return t.id})),e=i.getPickupStockLocationIds(),[4,s({stockLocationIdList:e,variantIds:t})];case 1:return[2,o.sent().data||[]]}}))}))}function m(i,r){return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return t=a({productId:i.id,limit:null==r?void 0:r.limit,page:null==r?void 0:r.page}),[4,d(t)];case 1:return o.sent(),[2,t]}}))}))}function l(i){var r;return t(this,void 0,void 0,(function(){var t,s;return o(this,(function(o){switch(o.label){case 0:return i.productOptionSet?[2,i.productOptionSet]:i.productOptionSetId?[4,e({id:{eq:i.productOptionSetId}})]:[2,null];case 1:return t=o.sent(),s=function(){var t,o=i.variants[0];if(!o)return null;var r=o.price.currency;null===(t=i.productOptionSet)||void 0===t||t.options.forEach((function(t){var o;t.selectSettings&&t.selectSettings.values.forEach((function(t){var o;t.otherPrices&&(t.price=(null===(o=t.otherPrices.find((function(t){return t.currencyCode===r})))||void 0===o?void 0:o.price)||t.price)})),t.otherPrices&&(t.price=(null===(o=t.otherPrices.find((function(t){return t.currencyCode===r})))||void 0===o?void 0:o.price)||t.price)}))},t.isSuccess&&(null===(r=t.data)||void 0===r?void 0:r.length)?(i.productOptionSet=t.data[0],s(),[2,i.productOptionSet]):[2,null]}}))}))}function p(){return i.isCustomerReviewEnabled()}function f(){return i.isCustomerReviewLoginRequired()}export{c as getAvailableStockLocations,m as getCustomerReviews,u as getProductCampaigns,l as getProductOptionSet,p as isCustomerReviewEnabled,f as isCustomerReviewLoginRequired};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from
|
|
1
|
+
import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{uploadFile as n,getProductOptionFileUrl as i}from"@ikas/storefront-api";function r(r,a){return t(this,void 0,void 0,(function(){var t,o,s,l,u;return e(this,(function(e){switch(e.label){case 0:return 0===a.length||r.fileSettings&&r.fileSettings.maxQuantity&&r.fileSettings.maxQuantity<a.length?[2,[]]:[4,Promise.all(a.map((function(t){return i({fileName:t.name,productOptionSetId:r.productOptionSetId,productOptionId:r.id},t)})))];case 1:t=e.sent().filter((function(t){return t.data})),o=[],s=0,l=t,e.label=2;case 2:return s<l.length?(u=l[s],[4,n(u.data,u.data.file)]):[3,5];case 3:e.sent()&&o.push(u.data.optionUrl),e.label=4;case 4:return s++,[3,2];case 5:return[2,o]}}))}))}export{r as productOptionFileUpload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../ext/tslib/tslib.es6.js';import{saveProductBackInStockRemind as r,listProductBackInStockRemind as i}from"@ikas/storefront-api";function n(n,d){var a;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,i({email:{eq:d},productId:{eq:n.productId},variantId:{eq:n.id}})];case 1:return(e=t.sent())&&(null===(a=e.data)||void 0===a?void 0:a.length)?(n.isBackInStockReminderSaved=!0,[2,!1]):[3,2];case 2:return[4,r({input:{email:d,productId:n.productId,variantId:n.id}})];case 3:return t.sent().isSuccess?(n.isBackInStockReminderSaved=!0,[2,!0]):(n.isBackInStockReminderSaved=!1,[2,!1]);case 4:return[2]}}))}))}export{n as saveBackInStockReminder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from
|
|
1
|
+
import{__assign as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasCheckoutRequirement as e}from"@ikas/storefront-models";import{AddressFormItem as n}from"@ikas/localized-address";function i(t,e,n){return{addressLine1:t.addressLine1||"",addressLine2:t.addressLine2||null,company:t.company||null,firstName:t.firstName||"",id:t.id||"",identityNumber:t.identityNumber||null,isDefault:t.isDefault||!1,lastName:t.lastName||"",phone:t.phone||null,postalCode:t.postalCode||null,taxNumber:t.taxNumber||null,taxOffice:t.taxOffice||null,title:t.title||"",attributes:t.attributes||[],createdAt:t.createdAt||Date.now(),updatedAt:t.updatedAt||Date.now(),country:t.country||null,state:t.state||null,city:t.city||null,district:t.district||null,checkoutSettings:e||null,countrySettings:n||null}}function r(t){var e;return(null===(e=t.country)||void 0===e?void 0:e.iso2)||"TR"}function u(t){if(t.checkoutSettings){var i=[];return t.checkoutSettings.identityNumberRequirement===e.INVISIBLE&&i.push(n.IDENTITY_NUMBER),t.checkoutSettings.postalCodeRequirement===e.INVISIBLE&&i.push(n.POSTAL_CODE),t.checkoutSettings.phoneRequirement===e.INVISIBLE&&i.push(n.PHONE),i}}function s(t){if(t.checkoutSettings){var n={};return t.checkoutSettings.phoneRequirement&&(n.phone={required:t.checkoutSettings.phoneRequirement===e.MANDATORY}),t.checkoutSettings.postalCodeRequirement&&(n.postalCode={required:t.checkoutSettings.postalCodeRequirement===e.MANDATORY}),t.checkoutSettings.identityNumberRequirement&&(n.identityNumber={required:t.checkoutSettings.identityNumberRequirement===e.MANDATORY}),n}}function o(e){if(e.countrySettings){var n=e.countrySettings.getFieldSettings({country:r(e),invisibleAddressFields:u(e),customAddressFormSettings:s(e)});if(n)return t({title:{required:!0}},n)}}function c(t){if(t.countrySettings)return t.countrySettings.getAddressFormat(r(t),u(t))}function d(t){if(t.countrySettings)return t.countrySettings.getAddressFormatIgnoreCountry(r(t),u(t))}function a(t){if(t.countrySettings)return t.countrySettings.getBillingFormat(r(t))}function l(e){if(e.countrySettings){var n=e.countrySettings.getValidationResult({address:S(e),country:r(e),invisibleAddressFields:u(e),customAddressFormSettings:s(e)});if(n)return t({title:{hasError:!e.title,isInvalid:!1,isEmpty:!e.title}},n)}}function m(t){var e=l(t);return e&&Object.values(e).every((function(t){return t}))}function f(t){if(t.countrySettings)return t.countrySettings.getFieldLabels(r(t))}function y(t){if(t.countrySettings)return t.countrySettings.isFreeTextCity(r(t))}function g(t){if(t.countrySettings)return t.countrySettings.isFreeTextDistrict(r(t))}var S=function(t){var e,n,i,r;return{firstName:t.firstName||"",lastName:t.lastName||"",identityNumber:t.identityNumber||"",addressLine1:t.addressLine1||"",addressLine2:t.addressLine2||"",postalCode:t.postalCode||"",country:(null===(e=t.country)||void 0===e?void 0:e.name)||"",state:(null===(n=t.state)||void 0===n?void 0:n.name)||"",city:(null===(i=t.city)||void 0===i?void 0:i.name)||"",district:(null===(r=t.district)||void 0===r?void 0:r.name)||"",phone:t.phone||"",company:t.company||"",taxOffice:t.taxOffice||"",taxNumber:t.taxNumber||""}};export{S as addressToParams,i as createIkasLocalizedCustomerAddress,c as getAddressFormat,d as getAddressFormatIgnoreCountry,a as getBillingFormat,r as getCountryCode,s as getCustomAddressFormSettings,f as getFieldLabels,o as getFieldSettings,u as getInvisibleFields,y as isFreeTextCity,g as isFreeTextDistrict,m as isValidLocalizedCustomerAddress,l as validateIkasLocalizedCustomerAddress};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from
|
|
1
|
+
import{__assign as t}from'./../../../../ext/tslib/tslib.es6.js';import i from"lodash/flatten";import{IkasThemeJsonComponentPropType as e}from"@ikas/storefront-models";var n=function(){function n(i){void 0===i&&(i={});var a,o=this;this.translations={},this.customDataId=null,this.id=i.id||"",this.name=i.name||null,this.description=i.description||null,this.typescriptName=i.name||null,this.type=i.type||e.TEXT,this.isRequired=void 0===i.isRequired||i.isRequired,this.translations=i.translations||{},this.key=i.key||null,this.parent=i.parent||null,this.itemCount=i.itemCount||null,this.attributeTypes=i.attributeTypes||null,this.enumOptions=(null===(a=i.enumOptions)||void 0===a?void 0:a.map((function(t){return new s(t)})))||null,this.customDataId=i.customDataId||null,this.sliderData=i.sliderData||{},this.isRoot=i.isRoot||!1,this.nestedData=i.nestedData?i.nestedData.map((function(i){return new n(t(t({},i),{parent:o}))})):null,this.type!==e.STATIC_LIST||this.itemCount||(this.itemCount=1)}return Object.defineProperty(n.prototype,"flat",{get:function(){if(!this.nestedData||!this.nestedData.length)return[this];var t=i(this.nestedData.map((function(t){return t.flat}))),e=[];return e.push(this),e=e.concat(t)},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){var i=t({},this);return delete i.parent,i},n}(),s=function(t){void 0===t&&(t={}),this.translations={},this.id=t.id||"",this.displayName=t.displayName||"",this.value=t.value||"",this.translations=t.translations||{}};export{n as IkasThemeJsonCustomData,s as IkasThemeJsonEnumOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{observable as a}from"mobx";import{listBlogCategory as n}from"@ikas/storefront-api";import{IkasBlogCategoryListType as o}from"./index.js";import{isStatic as e,hasPrev as r,hasNext as s}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function u(t){return a({data:t.data||[],type:t.type||o.ALL,limit:t.limit||20,page:t.page||1,count:t.count||0,initialized:t.initialized||!1,minPage:t.minPage||t.page||1,blogCategoryListPropValue:t.blogCategoryListPropValue||{blogCategoryListType:o.ALL},isLoading:t.isLoading||!1})}function d(a){var n,o,s;return t(this,void 0,void 0,(function(){var t,u,d;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading||e(a)||!r(a))return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=a.minPage-1,[4,g(a,t,a.limit)];case 2:return u=i.sent(),a.data=(null===(o=null===(n=u.data)||void 0===n?void 0:n.data)||void 0===o?void 0:o.concat(a.data))||a.data,a.count=(null===(s=u.data)||void 0===s?void 0:s.count)||a.count,a.minPage=t,[3,5];case 3:return d=i.sent(),console.log(d),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function l(a){var n,o;return t(this,void 0,void 0,(function(){var t,r;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading||e(a)||!s(a))return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,g(a,a.page+1,a.limit)];case 2:return t=i.sent(),a.data=a.data.concat((null===(n=t.data)||void 0===n?void 0:n.data)||[]),a.count=(null===(o=t.data)||void 0===o?void 0:o.count)||a.count,a.page=a.page+1,[3,5];case 3:return r=i.sent(),console.log(r),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function c(a,n){var o,r;return t(this,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading||e(a))return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,g(a,n,a.limit)];case 2:return t=i.sent(),a.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],a.count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,a.page=n,a.minPage=n,[3,5];case 3:return s=i.sent(),console.log(s),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function g(a,o,r){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,n({id:e(a)&&a.blogCategoryListPropValue.blogCategoryIds?{in:a.blogCategoryListPropValue.blogCategoryIds}:void 0,pagination:{page:o,limit:r}})];case 1:return[2,t.sent()]}}))}))}export{u as createIkasBlogCategoryList,l as getNext,c as getPage,d as getPrev};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{observable as n}from"mobx";import{listBlog as a}from"@ikas/storefront-api";import{IkasBlogListType as e}from"./index.js";import{isStatic as o,hasPrev as r,hasNext as s}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function u(t){return n({data:t.data||[],type:t.type||e.ALL,limit:t.limit||20,page:t.page||1,count:t.count||0,initialized:t.initialized||!1,minPage:t.minPage||t.page||1,blogListPropValue:t.blogListPropValue||{blogListType:e.ALL,categoryId:t.filterCategoryId||null},filterCategoryId:t.filterCategoryId||null,isLoading:t.isLoading||!1})}function d(n){var a,e,s;return t(this,void 0,void 0,(function(){var t,u,d;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||o(n)||!r(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=n.minPage-1,[4,g(n,t,n.limit)];case 2:return u=i.sent(),n.data=(null===(e=null===(a=u.data)||void 0===a?void 0:a.data)||void 0===e?void 0:e.concat(n.data))||n.data,n.count=(null===(s=u.data)||void 0===s?void 0:s.count)||n.count,n.minPage=t,[3,5];case 3:return d=i.sent(),console.log(d),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function l(n){var a,e;return t(this,void 0,void 0,(function(){var t,r;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||o(n)||!s(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,g(n,n.page+1,n.limit)];case 2:return t=i.sent(),n.data=n.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),n.count=(null===(e=t.data)||void 0===e?void 0:e.count)||n.count,n.page=n.page+1,[3,5];case 3:return r=i.sent(),console.log(r),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function c(n,a){var e,r;return t(this,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||o(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,g(n,a,n.limit)];case 2:return t=i.sent(),n.data=(null===(e=t.data)||void 0===e?void 0:e.data)||[],n.count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,n.page=a,n.minPage=a,[3,5];case 3:return s=i.sent(),console.log(s),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function g(n,e,r){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a({id:o(n)&&n.blogListPropValue.blogIds?{in:n.blogListPropValue.blogIds}:void 0,categoryId:n.filterCategoryId?{eq:n.filterCategoryId}:void 0,pagination:{page:e,limit:r}})];case 1:return[2,t.sent()]}}))}))}export{u as createIkasBlogList,l as getNext,c as getPage,d as getPrev};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{IkasBrandListType as n,IkasBrandListSortType as a}from"./index.js";import{observable as o}from"mobx";import{isStatic as e,hasPrev as r,hasNext as s}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";import{listProductBrand as d}from"@ikas/storefront-api";function u(t){return o({data:t.data||[],type:t.type||n.ALL,sort:t.sort||a.A_Z,limit:t.limit||20,page:t.page||1,count:t.count||0,initialized:t.initialized||!1,minPage:t.minPage||t.page||1,brandListPropValue:t.brandListPropValue||{brandIds:[]},isLoading:t.isLoading||!1})}function l(n){var a,o,r;return t(this,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading)return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,d({id:e(n)&&n.brandListPropValue.brandIds?{in:n.brandListPropValue.brandIds}:void 0,pagination:{page:e(n)?void 0:n.page,limit:e(n)?void 0:n.limit},sort:m(n)})];case 2:return t=i.sent(),e(n)?n.data=(null===(a=n.brandListPropValue.brandIds)||void 0===a?void 0:a.map((function(i){var n,a;return null===(a=null===(n=t.data)||void 0===n?void 0:n.data)||void 0===a?void 0:a.find((function(t){return t.id===i}))})).filter((function(t){return!!t})))||[]:n.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],n.count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,n.initialized=!0,n.minPage=n.page,[3,5];case 3:return s=i.sent(),console.log(s),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function c(n){var a,o,s;return t(this,void 0,void 0,(function(){var t,u,l;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||e(n)||!r(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=n.minPage-1,[4,d({pagination:{page:t,limit:n.limit},sort:m(n)})];case 2:return u=i.sent(),n.data=(null===(o=null===(a=u.data)||void 0===a?void 0:a.data)||void 0===o?void 0:o.concat(n.data))||n.data,n.count=(null===(s=u.data)||void 0===s?void 0:s.count)||0,n.minPage=t,[3,5];case 3:return l=i.sent(),console.log(l),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function v(n){var a,o;return t(this,void 0,void 0,(function(){var t,r;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||e(n)||!s(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,d({pagination:{page:n.page+1,limit:n.limit},sort:m(n)})];case 2:return t=i.sent(),n.data=n.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),n.count=(null===(o=t.data)||void 0===o?void 0:o.count)||n.count,n.page=n.page+1,[3,5];case 3:return r=i.sent(),console.log(r),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function g(n,a){var o,r;return t(this,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||e(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,d({pagination:{page:a,limit:n.limit},sort:m(n)})];case 2:return t=i.sent(),n.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],n.count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,n.page=a,n.minPage=a,[3,5];case 3:return s=i.sent(),console.log(s),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function p(n,a){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return n.sort=a,[4,l(n)];case 1:return t.sent(),[2]}}))}))}function m(t){return t.sort===a.A_Z?"name":"-name"}export{u as createIkasBrandList,l as getInitial,v as getNext,g as getPage,c as getPrev,p as setSortType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{listCategory as n}from"@ikas/storefront-api";import{observable as a}from"mobx";import{IkasCategoryListType as o,IkasCategoryListSortType as e}from"./index.js";import{isStatic as r,hasPrev as s,hasNext as u}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function d(t){return a({data:t.data||[],type:t.type||o.ALL,sort:t.sort||e.A_Z,limit:t.limit||20,page:t.page||1,count:t.count||0,initialized:t.initialized||!1,minPage:t.minPage||t.page||1,categoryListPropValue:t.categoryListPropValue||{categoryIds:[]},isLoading:t.isLoading||!1})}function c(a){var o,e,s;return t(this,void 0,void 0,(function(){var t,u;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading)return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,n({id:r(a)&&a.categoryListPropValue.categoryIds?{in:a.categoryListPropValue.categoryIds}:void 0,pagination:{page:r(a)?void 0:a.page,limit:r(a)?void 0:a.limit},sort:m(a)})];case 2:return t=i.sent(),r(a)?a.data=(null===(o=a.categoryListPropValue.categoryIds)||void 0===o?void 0:o.map((function(i){var n,a;return null===(a=null===(n=t.data)||void 0===n?void 0:n.data)||void 0===a?void 0:a.find((function(t){return t.id===i}))})).filter((function(t){return!!t})))||[]:a.data=(null===(e=t.data)||void 0===e?void 0:e.data)||[],a.count=(null===(s=t.data)||void 0===s?void 0:s.count)||0,a.initialized=!0,a.minPage=a.page,[3,5];case 3:return u=i.sent(),console.log(u),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function l(a){var o,e,u;return t(this,void 0,void 0,(function(){var t,d,c;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading||r(a)||!s(a))return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=a.minPage-1,[4,n({pagination:{page:t,limit:a.limit},sort:m(a)})];case 2:return d=i.sent(),a.data=(null===(e=null===(o=d.data)||void 0===o?void 0:o.data)||void 0===e?void 0:e.concat(a.data))||a.data,a.count=(null===(u=d.data)||void 0===u?void 0:u.count)||0,a.minPage=t,[3,5];case 3:return c=i.sent(),console.log(c),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function g(a){var o,e;return t(this,void 0,void 0,(function(){var t,s;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading||r(a)||!u(a))return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,n({pagination:{page:a.page+1,limit:a.limit},sort:m(a)})];case 2:return t=i.sent(),a.data=a.data.concat((null===(o=t.data)||void 0===o?void 0:o.data)||[]),a.count=(null===(e=t.data)||void 0===e?void 0:e.count)||a.count,a.page=a.page+1,[3,5];case 3:return s=i.sent(),console.log(s),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function v(a,o){var e,s;return t(this,void 0,void 0,(function(){var t,u;return i(this,(function(i){switch(i.label){case 0:if(a.isLoading||r(a))return[2];a.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,n({pagination:{page:o,limit:a.limit},sort:m(a)})];case 2:return t=i.sent(),a.data=(null===(e=t.data)||void 0===e?void 0:e.data)||[],a.count=(null===(s=t.data)||void 0===s?void 0:s.count)||0,a.page=o,a.minPage=o,[3,5];case 3:return u=i.sent(),console.log(u),[3,5];case 4:return a.isLoading=!1,[7];case 5:return[2]}}))}))}function p(n,a){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return n.sort=a,[4,c(n)];case 1:return t.sent(),[2]}}))}))}function m(t){return t.sort===e.A_Z?"name":"-name"}export{d as createIkasCategoryList,c as getInitial,g as getNext,v as getPage,l as getPrev,p as setSortType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as n,__assign as i}from
|
|
1
|
+
import{__awaiter as t,__generator as n,__assign as i}from'./../../../ext/tslib/tslib.es6.js';import{searchProducts as a,listCustomerReviews as o}from"@ikas/storefront-api";import{IkasStorefrontConfig as e}from"@ikas/storefront-config";import{observable as r}from"mobx";import{hasPrev as d,hasNext as u}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function s(t){return r({data:t.data||[],limit:t.limit||20,page:t.page||1,count:t.count||0,productId:t.productId||"",initialized:t.initialized||!1,minPage:t.minPage||t.page||1,isLoading:t.isLoading||!1})}function c(r,d,u){var s,c,l;return t(this,void 0,void 0,(function(){var t,v,g;return n(this,(function(n){switch(n.label){case 0:return[4,o({productId:r.productId,input:{salesChannelId:e.getSalesChannelId()||""},pagination:{page:d,limit:u}})];case 1:return t=n.sent(),!(null===(s=t.data)||void 0===s?void 0:s.data)||r.productId?[3,3]:(v=null===(c=null==t?void 0:t.data)||void 0===c?void 0:c.data.map((function(t){return null==t?void 0:t.productId})),[4,a({input:{productIdList:v}})]);case 2:g=n.sent(),t.data.data=null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.data.map((function(t){var n,a,o=null===(a=null===(n=null==g?void 0:g.data)||void 0===n?void 0:n.data)||void 0===a?void 0:a.find((function(n){return n.id===t.productId}));return i(i({},t),{product:o})})).filter((function(t){return t.product&&!t.product.deleted})),n.label=3;case 3:return[2,t]}}))}))}function l(i){var a,o;return t(this,void 0,void 0,(function(){var t,e;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading)return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,c(i,i.page,i.limit)];case 2:return t=n.sent(),i.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],i.count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,i.initialized=!0,i.minPage=i.page,[3,5];case 3:return e=n.sent(),console.log(e),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function v(i){var a,o;return t(this,void 0,void 0,(function(){var t,e,r;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading||!d(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),t=i.minPage-1,[4,c(i,t,i.limit)];case 2:return e=n.sent(),i.data=(null===(a=e.data)||void 0===a?void 0:a.data.concat(i.data))||i.data,i.count=(null===(o=e.data)||void 0===o?void 0:o.count)||i.count,i.minPage=t,[3,5];case 3:return r=n.sent(),console.log(r),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function g(i){var a,o;return t(this,void 0,void 0,(function(){var t,e;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading||!u(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,c(i,i.page+1,i.limit)];case 2:return t=n.sent(),i.data=i.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),i.count=(null===(o=t.data)||void 0===o?void 0:o.count)||i.count,i.page=i.page+1,[3,5];case 3:return e=n.sent(),console.log(e),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function p(i,a){var o,e;return t(this,void 0,void 0,(function(){var t,r;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading)return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,c(i,a,i.limit)];case 2:return t=n.sent(),i.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],i.count=(null===(e=t.data)||void 0===e?void 0:e.count)||0,i.page=a,i.minPage=a,[3,5];case 3:return r=n.sent(),console.log(r),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}export{s as createCustomerReviewList,l as getInitial,g as getNext,p as getPage,v as getPrev};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{listCustomerReviewSummary as n}from"@ikas/storefront-api";import{observable as a}from"mobx";import{hasPrev as e,hasNext as o}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function r(t){return a({data:t.data||[],limit:t.limit||20,page:t.page||1,count:t.count||0,productId:t.productId||"",initialized:t.initialized||!1,minPage:t.minPage||t.page||1,isLoading:t.isLoading||!1})}function s(a,e,o){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,n({productId:{eq:a.productId},pagination:{page:e,limit:o}})];case 1:return[2,t.sent()]}}))}))}function u(n){var a,e;return t(this,void 0,void 0,(function(){var t,o;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading)return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,s(n,n.page,n.limit)];case 2:return t=i.sent(),n.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],n.count=(null===(e=t.data)||void 0===e?void 0:e.count)||0,n.initialized=!0,n.minPage=n.page,[3,5];case 3:return o=i.sent(),console.log(o),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function d(n){var a,o,r;return t(this,void 0,void 0,(function(){var t,u,d;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||!e(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=n.minPage-1,[4,s(n,t,n.limit)];case 2:return u=i.sent(),n.data=(null===(o=null===(a=u.data)||void 0===a?void 0:a.data)||void 0===o?void 0:o.concat(n.data))||n.data,n.count=(null===(r=u.data)||void 0===r?void 0:r.count)||n.count,n.minPage=t,[3,5];case 3:return d=i.sent(),console.log(d),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function c(n){var a,e;return t(this,void 0,void 0,(function(){var t,r;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading||!o(n))return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,s(n,n.page+1,n.limit)];case 2:return t=i.sent(),n.data=n.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),n.count=(null===(e=t.data)||void 0===e?void 0:e.count)||n.count,n.page=n.page+1,[3,5];case 3:return r=i.sent(),console.log(r),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}function l(n,a){var e,o;return t(this,void 0,void 0,(function(){var t,r;return i(this,(function(i){switch(i.label){case 0:if(n.isLoading)return[2];n.isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,s(n,a,n.limit)];case 2:return t=i.sent(),n.data=(null===(e=t.data)||void 0===e?void 0:e.data)||[],n.count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,n.page=a,n.minPage=a,[3,5];case 3:return r=i.sent(),console.log(r),[3,5];case 4:return n.isLoading=!1,[7];case 5:return[2]}}))}))}export{r as createCustomerReviewSummaryList,u as getInitial,c as getNext,l as getPage,d as getPrev};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from"../../../node_modules/tslib/tslib.es6.js";import{IkasProductListSortType as r,IkasProductListType as i}from"./index.js";import{observable as n}from"mobx";import a from"query-string";import{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType as u,IkasThemeJsonStockPreference as l}from"@ikas/storefront-models";import{searchProducts as c,getSuggestedProducts as s,GetSuggestedProductsMethodEnum as d,getProductFilterData as f,SortByDirectionEnum as v,SortByTypeEnum as p}from"@ikas/storefront-api";import{IkasStorefrontConfig as g}from"@ikas/storefront-config";import{setSavedLastViewedProductsResponse as h,shouldUseLastViewedProductResponse as C,getLastViewedProducts as I}from"../../../store/customer/product/functions.js";import{IkasCustomerProductData as E}from"../../../store/customer/product/data.js";import{IkasProductFilterFunctions as y,IkasProductFilterCategoryFunctions as m}from"@ikas/storefront-model-functions";import{isServer as S}from"../../../utils/helper.js";import{waitForCustomerStoreInit as T}from"../../../store/customer/functions.js";import{IkasBaseStore as A}from"../../../store/base/index.js";import{search as D,viewSearchResults as L,viewListing as R}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"@ikas/localized-address";import P from"lodash/debounce";var N,b=((N={})[r.INCREASING_PRICE]=1,N[r.DECREASING_PRICE]=2,N[r.LAST_ADDED]=3,N[r.FIRST_ADDED]=4,N[r.INCREASING_DISCOUNT]=5,N[r.DECRASING_DISCOUNT]=6,N[r.FEATURED]=7,N[r.DEFAULT]=8,N);function w(e){var t,a,l,c,s=n({data:e.data||[],type:e.type||(null===(t=e.productListPropValue)||void 0===t?void 0:t.productListType)||i.ALL,pageType:e.pageType||o.INDEX,sort:e.sort||(null===(a=e.productListPropValue)||void 0===a?void 0:a.initialSort)||r.LAST_ADDED,limit:e.limit||(null===(l=e.productListPropValue)||void 0===l?void 0:l.initialLimit)||20,page:e.page||1,minPage:e.minPage||e.page||1,infiniteScrollPage:null!==(c=e.infiniteScrollPage)&&void 0!==c?c:null,count:e.count||0,searchKeyword:e.searchKeyword||"",productListPropValue:e.productListPropValue||{id:"",productListType:i.ALL},filters:e.filters||null,filterCategories:e.filterCategories||null,filterBrandId:e.filterBrandId||null,filterCategoryId:e.filterCategoryId||null,relatedProductData:e.relatedProductData||null,viewedTogetherProductData:e.viewedTogetherProductData||null,pageSpecificData:e.pageSpecificData||null,recommendFor:e.recommendFor||null,isLoading:!1,fetchRequestTime:0,initialized:!1});return function(e){var t;if((null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&[i.ALL].includes(e.type))switch(e.pageSpecificData.orderType){case u.HIGHEST_DISCOUNT_RATIO:e.sort=r.DECRASING_DISCOUNT;break;case u.LOWEST_DISCOUNT_RATIO:e.sort=r.INCREASING_DISCOUNT;break;case u.HIGHEST_PRICE:e.sort=r.DECREASING_PRICE;break;case u.LOWEST_PRICE:e.sort=r.INCREASING_PRICE;break;case u.NEWEST:e.sort=r.LAST_ADDED;break;case u.OLDEST:e.sort=r.FIRST_ADDED;break;case u.MANUALLY:e.sort=r.FEATURED}}(s),_(s),O(s),s}function _(e){e.data.forEach((function(t){return t.isFiltered=B(e)}))}function O(e){e.data.forEach((function(t){return t.isStatic=z(e)}))}function V(e){var t,r,i,n={},u=m.getFilterCategorySlug;if(null===(t=e.filters)||void 0===t||t.forEach((function(e){var t=y.getKeyList(e);t.length&&(n[e.key]=t)})),e.searchKeyword&&(n.s=e.searchKeyword),e.sort&&(n.o=b[e.sort]),e.infiniteScrollPage&&(n.page=e.infiniteScrollPage),e.pageType!==o.CATEGORY){var l=null===(r=e.filterCategories)||void 0===r?void 0:r.filter((function(e){return e.isSelected}));if(!!(null==l?void 0:l.length))n.c=null==l?void 0:l.map(u);else if(e.filterCategoryId){var c=null===(i=e.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===e.filterCategoryId})),s=c?u(c):null;s&&(n.c=s)}}return a.stringify(n,{arrayFormat:"comma"})}function k(n,a,u,f){var h,C,I,E;return e(this,void 0,void 0,(function(){var e,m,S,T,A;return t(this,(function(t){switch(t.label){case 0:return e=[],m=[],S=y.getValueList,null===(h=n.filters)||void 0===h||h.forEach((function(t){var r=S(t);r.length&&e.push({id:t.id,type:t.type,displayType:t.displayType,valueList:r}),t.isFacetFilter&&m.push({id:t.id,type:t.type,displayType:t.displayType})})),T=null===(C=n.filterCategories)||void 0===C?void 0:C.filter((function(e){return e.isSelected})).map((function(e){return e.id})),A=function(e){var t,i;switch(e.sort){case r.INCREASING_PRICE:t=v.ASC,i=p.PRICE;break;case r.DECREASING_PRICE:t=v.DESC,i=p.PRICE;break;case r.FIRST_ADDED:t=v.ASC,i=p.CREATED_AT;break;case r.LAST_ADDED:t=v.DESC,i=p.CREATED_AT;break;case r.INCREASING_DISCOUNT:t=v.ASC,i=p.DISCOUNT_RATIO;break;case r.DECRASING_DISCOUNT:t=v.DESC,i=p.DISCOUNT_RATIO;break;case r.FEATURED:if(ee(e))return;t=v.ASC,i=p.MANUAL_SORT;break;case r.DEFAULT:t=void 0,i=void 0}if(t&&i)return{direction:t,type:i}}(n),n.relatedProductData&&Z(n)?[4,s({priceListId:g.getPriceListId(),salesChannelId:g.getSalesChannelId(),productId:n.relatedProductData.productId,brandIds:n.relatedProductData.brandIds,categoryIds:n.relatedProductData.categoryIds,locale:g.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:return[2,t.sent()];case 2:return n.viewedTogetherProductData&&$(n)?[4,s({priceListId:g.getPriceListId(),salesChannelId:g.getSalesChannelId(),method:d.VIEWED_TOGETHER,productIds:n.viewedTogetherProductData.productIds,locale:g.getCurrentLocale()})]:[3,4];case 4:return[4,c({input:{page:a,perPage:u,productIdList:z(n)?null===(E=null===(I=n.productListPropValue)||void 0===I?void 0:I.productIds)||void 0===E?void 0:E.map((function(e){return e.productId})):f,filterList:e,facetList:m,brandId:n.pageType===o.BRAND&&n.type!==i.SEARCH?n.filterBrandId:void 0,categoryIdList:T&&T.length?T:n.filterCategoryId?[n.filterCategoryId]:void 0,priceListId:g.getPriceListId(),salesChannelId:g.getSalesChannelId(),query:n.searchKeyword,order:A?[A]:[],showStockOption:g.getStockPreference()||l.SHOW_ALL}})]}}))}))}function G(r){var i,n,a;return e(this,void 0,void 0,(function(){var e,u;return t(this,(function(t){switch(t.label){case 0:return[4,f({categoryId:r.filterCategoryId?r.filterCategoryId:void 0,locale:g.getCurrentLocale()})];case 1:return e=t.sent(),r.filters=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.filters,r.filterCategories=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.categories,r.pageType!==o.CATEGORY&&r.filterCategoryId&&(u=null===(a=r.filterCategories)||void 0===a?void 0:a.find((function(e){return e.id===r.filterCategoryId})))&&(u.isSelected=!0),r.filters&&r.filters.sort((function(e,t){return e.order>t.order?1:-1})),[2]}}))}))}function U(r){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,se(r)];case 1:return e=t.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(r.pageType)?(e&&F(r),[2]):[2]}}))}))}function F(e){var t;if(!S()&&!ee(e)&&!g.getIsEditor()){var r=V(e);null===(t=A.router)||void 0===t||t.replace("".concat(location.pathname).concat(r?"?"+r:""),void 0,{shallow:!0})}}function K(){if(!S())return new URLSearchParams(location.search)}function H(e){e.searchKeyword&&e.data.length?L(e.searchKeyword,e.data):e.data.length&&e.type===i.ALL&&R(e.data)}var j=P((function(e){U(e)}),500),Y=P((function(e){e.searchKeyword&&D(e.searchKeyword)}),1e3);function W(e){S()||(function(e){var t=K(),r=null==t?void 0:t.get("page");if(r){var i=parseInt(r);isNaN(i)||(e.page=i,e.infiniteScrollPage=i)}}(e),location.search&&(x(e)||e.type===i.SEARCH)?se(e,K(),e.page>1):e.page>1?se(e,void 0,!0):J(e)?se(e):H(e))}function q(e){return Math.ceil(e.count/e.limit)}function M(e,t){t!==e.searchKeyword&&(e.searchKeyword=t,j(e),Y(e))}function x(e){return e.type===i.ALL||e.type===i.CATEGORY}function B(e){var t,r;return(null===(t=e.filters)||void 0===t?void 0:t.some((function(e){return!!y.getValueList(e).length})))||!!e.searchKeyword||e.pageType!==o.CATEGORY&&(!!e.filterCategoryId||(null===(r=e.filterCategories)||void 0===r?void 0:r.some((function(e){return e.isSelected}))))||!1}function z(e){return e.type===i.STATIC}function Q(e){return e.type===i.DISCOUNTED}function X(e){return e.type===i.RECOMMENDED}function J(e){return e.type===i.LAST_VIEWED}function Z(e){return e.type===i.RELATED_PRODUCTS}function $(e){return e.type===i.VIEWED_TOGETHER}function ee(e){return e.type===i.SEARCH}function te(e){var t;return(null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)===u.MANUALLY&&[i.ALL,i.CATEGORY].includes(e.type)}function re(e){return!(z(e)||Q(e)||X(e)||!e.minPage)&&e.minPage>1}function ie(e){return!(z(e)||Q(e)||X(e))&&e.page*e.limit<e.count}function ne(e){var t;return null===(t=e.filterCategories)||void 0===t?void 0:t.filter((function(e){return 0!==e.resultCount}))}function ae(e){var t,r=y.getValueList;return!!e.searchKeyword||(null===(t=e.filters)||void 0===t?void 0:t.some((function(e){return!!r(e).length})))}function oe(e){var t,r;null===(t=e.filters)||void 0===t||t.forEach(y.clear),e.searchKeyword="",e.pageType!==o.CATEGORY&&(e.filterCategoryId=void 0),null===(r=e.filterCategories)||void 0===r||r.forEach((function(e){return e.isSelected=!1})),U(e)}function ue(e,t,r){y.handleFilterValueClick(t,r),U(e)}function le(e,t,r){y.handleNumberRangeClick(t,r),U(e)}function ce(e,t,r){y.handleNumberRangeChange(t,r),U(e)}function se(r,i,n){var a,u,l,c,s;return e(this,void 0,void 0,(function(){var e,d,f,v,p,g,A,D,L,R,P;return t(this,(function(t){switch(t.label){case 0:r.isLoading=!0,e=Date.now(),r.fetchRequestTime=e,t.label=1;case 1:return t.trys.push([1,14,15,16]),d=n?r.page:1,f=r.limit,!x(r)||r.filters?[3,3]:[4,G(r)];case 2:t.sent(),t.label=3;case 3:return function(e,t){var r;try{var i=y.applyQueryParam,n=m.getFilterCategorySlug;null==t||t.forEach((function(t,r){var n,a=null===(n=e.filters)||void 0===n?void 0:n.find((function(e){return e.key===r}));a&&i(a,t)}));var a=null==t?void 0:t.get("s");a&&(e.searchKeyword=a);var u=null==t?void 0:t.get("o");if(u){var l=parseInt(u),c=Object.entries(b).find((function(e){return e[1]===l}));c&&(e.sort=c[0])}if(e.pageType!==o.CATEGORY){var s=null==t?void 0:t.get("c"),d=null==s?void 0:s.split(",");d&&d.length&&(null===(r=e.filterCategories)||void 0===r||r.forEach((function(e){e.isSelected=d.some((function(t){return t===n(e)}))})))}}catch(e){console.log(e)}}(r,i),ee(r)&&!ae(r)?(r.data=[],r.page=1,r.minPage=1,r.count=0,r.initialized=!0,[2,!0]):(v=void 0,p=!1,z(r)?(d=void 0,f=200,[3,10]):[3,4]);case 4:return Q(r)?(d=1,f=10,[3,10]):[3,5];case 5:return X(r)?(d=1,f=10,[3,10]):[3,6];case 6:return J(r)?S()?[3,9]:[4,T()]:[3,10];case 7:return t.sent(),[4,I()];case 8:return(g=t.sent())&&g.length?(v=g.map((function(e){return e.productId})),p=C(),[3,10]):[2];case 9:return[2];case 10:return p?(D=E.savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,k(r,d||1,f||10,v)];case 12:D=t.sent(),t.label=13;case 13:return(A=D)&&r.fetchRequestTime===e?(L=[],!p&&J(r)&&h(A),z(r)||J(r)?(R=z(r)?null===(a=r.productListPropValue)||void 0===a?void 0:a.productIds:E.lastViewedProducts,L=(null==R?void 0:R.map((function(e){var t,r,i=null===(r=null===(t=A.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.find((function(t){return t.id===e.productId})),n=null==i?void 0:i.variants.find((function(t){return t.id===e.variantId}));if((null==n?void 0:n.isActive)||(n=null==i?void 0:i.variants.find((function(e){return e.isActive}))),i&&n)return i.selectedVariantValues=n.variantValues,i})).filter((function(e){return!!e})))||[]):L=(null===(l=null===(u=A.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})))||[],function(e,t){var r,i,n=y.isCustomValueFilter;null===(r=e.filters)||void 0===r||r.forEach((function(e){var r,i,a,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(r=e.values)||void 0===r||r.forEach((function(t){var r=o.values.find((function(e){return e.id===t.id}));r?t.resultCount=r.count:n(e)?t.resultCount=null:t.resultCount=0})):n(e)?null===(i=e.values)||void 0===i||i.forEach((function(e){return e.resultCount=null})):null===(a=e.values)||void 0===a||a.forEach((function(e){return e.resultCount=0}))}));var a=null==t?void 0:t.find((function(e){return"category"===e.id}));a&&(null===(i=e.filterCategories)||void 0===i||i.forEach((function(e){var t=a.values.find((function(t){return t.id===e.id}));e.resultCount=t?t.count:0})))}(r,null===(c=A.data)||void 0===c?void 0:c.facets),r.data=L,r.count=(null===(s=A.data)||void 0===s?void 0:s.count)||0,r.initialized=!0,r.page=d||1,r.minPage=r.page,_(r),O(r),n||(r.infiniteScrollPage=null),H(r),[2,!0]):[2];case 14:return P=t.sent(),console.log(P),[3,16];case 15:return e===r.fetchRequestTime&&(r.isLoading=!1),[7];case 16:return[2]}}))}))}function de(r){var i,n,a;return e(this,void 0,void 0,(function(){var e,o,u,l;return t(this,(function(t){switch(t.label){case 0:if(r.isLoading||z(r)||Q(r)||X(r)||J(r)||!re(r))return[2];r.isLoading=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),e=r.minPage-1,[4,k(r,e,r.limit)];case 2:return(o=t.sent())?(u=null===(n=null===(i=o.data)||void 0===i?void 0:i.data)||void 0===n?void 0:n.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})),r.data=(null==u?void 0:u.concat(r.data))||r.data,r.count=(null===(a=o.data)||void 0===a?void 0:a.count)||r.count,r.minPage=e,_(r),O(r),[3,5]):[2];case 3:return l=t.sent(),console.log(l),[3,5];case 4:return r.isLoading=!1,[7];case 5:return[2]}}))}))}function fe(r){var i,n,a;return e(this,void 0,void 0,(function(){var e,o,u;return t(this,(function(t){switch(t.label){case 0:if(r.isLoading||z(r)||Q(r)||X(r)||J(r)||!ie(r))return[2];r.isLoading=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,k(r,r.page+1,r.limit)];case 2:return(e=t.sent())?(o=null===(n=null===(i=e.data)||void 0===i?void 0:i.data)||void 0===n?void 0:n.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})),r.data=r.data.concat(o||[]),r.count=(null===(a=e.data)||void 0===a?void 0:a.count)||r.count,r.page=r.page+1,_(r),O(r),[3,5]):[2];case 3:return u=t.sent(),console.log(u),[3,5];case 4:return r.isLoading=!1,[7];case 5:return[2]}}))}))}function ve(r,i){var n,a,o;return e(this,void 0,void 0,(function(){var e,u,l;return t(this,(function(t){switch(t.label){case 0:if(r.isLoading||z(r)||Q(r)||X(r)||J(r))return[2];r.isLoading=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,k(r,i,r.limit)];case 2:return(e=t.sent())?(u=null===(a=null===(n=e.data)||void 0===n?void 0:n.data)||void 0===a?void 0:a.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})),r.data=u||[],r.count=(null===(o=e.data)||void 0===o?void 0:o.count)||0,r.page=i,r.minPage=i,_(r),O(r),[3,5]):[2];case 3:return l=t.sent(),console.log(l),[3,5];case 4:return r.isLoading=!1,[7];case 5:return[2]}}))}))}function pe(r,i){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r.sort=i,[4,se(r)];case 1:return e.sent()&&F(r),[2]}}))}))}function ge(r,i,n){var a,o;return void 0===n&&(n=!1),e(this,void 0,void 0,(function(){var e,u;return t(this,(function(t){switch(t.label){case 0:return n?(null===(a=r.filterCategories)||void 0===a||a.forEach((function(e){e.id===i.id&&(e.isSelected=!e.isSelected)})),[4,U(r)]):[3,2];case 1:return t.sent(),[3,3];case 2:g.getIsEditor()||(e=m.getFilterCategoryHref,u=V(r),null===(o=A.router)||void 0===o||o.push(e(i)+(u?"?"+u:""))),t.label=3;case 3:return[2]}}))}))}function he(e,t){var r;if(e.infiniteScrollPage!==t&&(e.infiniteScrollPage=t,!g.getIsEditor())){var i=V(e);null===(r=A.router)||void 0===r||r.replace("".concat(location.pathname).concat(i?"?"+i:""),void 0,{shallow:!0})}}export{oe as clearFilters,w as createIkasProductList,ne as getDisplayedFilterCategories,se as getInitial,fe as getNext,ve as getPage,q as getPageCount,de as getPrev,ge as handleFilterCategoryClick,ue as handleFilterValueClick,ce as handleNumberRangeFilterChange,le as handleNumberRangeFilterValueClick,ae as hasAppliedFilter,ie as hasNext,re as hasPrev,W as initOnBrowser,Q as isDiscounted,te as isFeaturedSortEnabled,x as isFilterable,B as isFiltered,J as isLastViewed,X as isRecommended,Z as isRelatedProducts,ee as isSearch,z as isStatic,$ as isViewedTogetherProducts,M as setSearchKeyword,pe as setSortType,he as setVisibleInfiniteScrollPage};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasProductListSortType as r,IkasProductListType as i}from"./index.js";import{observable as n}from"mobx";import a from"query-string";import{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType as u,IkasThemeJsonStockPreference as l}from"@ikas/storefront-models";import{searchProducts as c,getSuggestedProducts as s,GetSuggestedProductsMethodEnum as d,getProductFilterData as f,SortByDirectionEnum as v,SortByTypeEnum as p}from"@ikas/storefront-api";import{IkasStorefrontConfig as g}from"@ikas/storefront-config";import{setSavedLastViewedProductsResponse as h,shouldUseLastViewedProductResponse as C,getLastViewedProducts as I}from"../../../store/customer/product/functions.js";import{IkasCustomerProductData as E}from"../../../store/customer/product/data.js";import{IkasProductFilterFunctions as y,IkasProductFilterCategoryFunctions as m}from"@ikas/storefront-model-functions";import{isServer as S}from"../../../utils/helper.js";import{waitForCustomerStoreInit as T}from"../../../store/customer/functions.js";import{IkasBaseStore as A}from"../../../store/base/index.js";import{search as D,viewSearchResults as L,viewListing as R}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"@ikas/localized-address";import P from"lodash/debounce";var N,b=((N={})[r.INCREASING_PRICE]=1,N[r.DECREASING_PRICE]=2,N[r.LAST_ADDED]=3,N[r.FIRST_ADDED]=4,N[r.INCREASING_DISCOUNT]=5,N[r.DECRASING_DISCOUNT]=6,N[r.FEATURED]=7,N[r.DEFAULT]=8,N);function w(e){var t,a,l,c,s=n({data:e.data||[],type:e.type||(null===(t=e.productListPropValue)||void 0===t?void 0:t.productListType)||i.ALL,pageType:e.pageType||o.INDEX,sort:e.sort||(null===(a=e.productListPropValue)||void 0===a?void 0:a.initialSort)||r.LAST_ADDED,limit:e.limit||(null===(l=e.productListPropValue)||void 0===l?void 0:l.initialLimit)||20,page:e.page||1,minPage:e.minPage||e.page||1,infiniteScrollPage:null!==(c=e.infiniteScrollPage)&&void 0!==c?c:null,count:e.count||0,searchKeyword:e.searchKeyword||"",productListPropValue:e.productListPropValue||{id:"",productListType:i.ALL},filters:e.filters||null,filterCategories:e.filterCategories||null,filterBrandId:e.filterBrandId||null,filterCategoryId:e.filterCategoryId||null,relatedProductData:e.relatedProductData||null,viewedTogetherProductData:e.viewedTogetherProductData||null,pageSpecificData:e.pageSpecificData||null,recommendFor:e.recommendFor||null,isLoading:!1,fetchRequestTime:0,initialized:!1});return function(e){var t;if((null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&[i.ALL].includes(e.type))switch(e.pageSpecificData.orderType){case u.HIGHEST_DISCOUNT_RATIO:e.sort=r.DECRASING_DISCOUNT;break;case u.LOWEST_DISCOUNT_RATIO:e.sort=r.INCREASING_DISCOUNT;break;case u.HIGHEST_PRICE:e.sort=r.DECREASING_PRICE;break;case u.LOWEST_PRICE:e.sort=r.INCREASING_PRICE;break;case u.NEWEST:e.sort=r.LAST_ADDED;break;case u.OLDEST:e.sort=r.FIRST_ADDED;break;case u.MANUALLY:e.sort=r.FEATURED}}(s),_(s),O(s),s}function _(e){e.data.forEach((function(t){return t.isFiltered=B(e)}))}function O(e){e.data.forEach((function(t){return t.isStatic=z(e)}))}function V(e){var t,r,i,n={},u=m.getFilterCategorySlug;if(null===(t=e.filters)||void 0===t||t.forEach((function(e){var t=y.getKeyList(e);t.length&&(n[e.key]=t)})),e.searchKeyword&&(n.s=e.searchKeyword),e.sort&&(n.o=b[e.sort]),e.infiniteScrollPage&&(n.page=e.infiniteScrollPage),e.pageType!==o.CATEGORY){var l=null===(r=e.filterCategories)||void 0===r?void 0:r.filter((function(e){return e.isSelected}));if(!!(null==l?void 0:l.length))n.c=null==l?void 0:l.map(u);else if(e.filterCategoryId){var c=null===(i=e.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===e.filterCategoryId})),s=c?u(c):null;s&&(n.c=s)}}return a.stringify(n,{arrayFormat:"comma"})}function k(n,a,u,f){var h,C,I,E;return e(this,void 0,void 0,(function(){var e,m,S,T,A;return t(this,(function(t){switch(t.label){case 0:return e=[],m=[],S=y.getValueList,null===(h=n.filters)||void 0===h||h.forEach((function(t){var r=S(t);r.length&&e.push({id:t.id,type:t.type,displayType:t.displayType,valueList:r}),t.isFacetFilter&&m.push({id:t.id,type:t.type,displayType:t.displayType})})),T=null===(C=n.filterCategories)||void 0===C?void 0:C.filter((function(e){return e.isSelected})).map((function(e){return e.id})),A=function(e){var t,i;switch(e.sort){case r.INCREASING_PRICE:t=v.ASC,i=p.PRICE;break;case r.DECREASING_PRICE:t=v.DESC,i=p.PRICE;break;case r.FIRST_ADDED:t=v.ASC,i=p.CREATED_AT;break;case r.LAST_ADDED:t=v.DESC,i=p.CREATED_AT;break;case r.INCREASING_DISCOUNT:t=v.ASC,i=p.DISCOUNT_RATIO;break;case r.DECRASING_DISCOUNT:t=v.DESC,i=p.DISCOUNT_RATIO;break;case r.FEATURED:if(ee(e))return;t=v.ASC,i=p.MANUAL_SORT;break;case r.DEFAULT:t=void 0,i=void 0}if(t&&i)return{direction:t,type:i}}(n),n.relatedProductData&&Z(n)?[4,s({priceListId:g.getPriceListId(),salesChannelId:g.getSalesChannelId(),productId:n.relatedProductData.productId,brandIds:n.relatedProductData.brandIds,categoryIds:n.relatedProductData.categoryIds,locale:g.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:return[2,t.sent()];case 2:return n.viewedTogetherProductData&&$(n)?[4,s({priceListId:g.getPriceListId(),salesChannelId:g.getSalesChannelId(),method:d.VIEWED_TOGETHER,productIds:n.viewedTogetherProductData.productIds,locale:g.getCurrentLocale()})]:[3,4];case 4:return[4,c({input:{page:a,perPage:u,productIdList:z(n)?null===(E=null===(I=n.productListPropValue)||void 0===I?void 0:I.productIds)||void 0===E?void 0:E.map((function(e){return e.productId})):f,filterList:e,facetList:m,brandId:n.pageType===o.BRAND&&n.type!==i.SEARCH?n.filterBrandId:void 0,categoryIdList:T&&T.length?T:n.filterCategoryId?[n.filterCategoryId]:void 0,priceListId:g.getPriceListId(),salesChannelId:g.getSalesChannelId(),query:n.searchKeyword,order:A?[A]:[],showStockOption:g.getStockPreference()||l.SHOW_ALL}})]}}))}))}function G(r){var i,n,a;return e(this,void 0,void 0,(function(){var e,u;return t(this,(function(t){switch(t.label){case 0:return[4,f({categoryId:r.filterCategoryId?r.filterCategoryId:void 0,locale:g.getCurrentLocale()})];case 1:return e=t.sent(),r.filters=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.filters,r.filterCategories=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.categories,r.pageType!==o.CATEGORY&&r.filterCategoryId&&(u=null===(a=r.filterCategories)||void 0===a?void 0:a.find((function(e){return e.id===r.filterCategoryId})))&&(u.isSelected=!0),r.filters&&r.filters.sort((function(e,t){return e.order>t.order?1:-1})),[2]}}))}))}function U(r){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,se(r)];case 1:return e=t.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(r.pageType)?(e&&F(r),[2]):[2]}}))}))}function F(e){var t;if(!S()&&!ee(e)&&!g.getIsEditor()){var r=V(e);null===(t=A.router)||void 0===t||t.replace("".concat(location.pathname).concat(r?"?"+r:""),void 0,{shallow:!0})}}function K(){if(!S())return new URLSearchParams(location.search)}function H(e){e.searchKeyword&&e.data.length?L(e.searchKeyword,e.data):e.data.length&&e.type===i.ALL&&R(e.data)}var j=P((function(e){U(e)}),500),Y=P((function(e){e.searchKeyword&&D(e.searchKeyword)}),1e3);function W(e){S()||(function(e){var t=K(),r=null==t?void 0:t.get("page");if(r){var i=parseInt(r);isNaN(i)||(e.page=i,e.infiniteScrollPage=i)}}(e),location.search&&(x(e)||e.type===i.SEARCH)?se(e,K(),e.page>1):e.page>1?se(e,void 0,!0):J(e)?se(e):H(e))}function q(e){return Math.ceil(e.count/e.limit)}function M(e,t){t!==e.searchKeyword&&(e.searchKeyword=t,j(e),Y(e))}function x(e){return e.type===i.ALL||e.type===i.CATEGORY}function B(e){var t,r;return(null===(t=e.filters)||void 0===t?void 0:t.some((function(e){return!!y.getValueList(e).length})))||!!e.searchKeyword||e.pageType!==o.CATEGORY&&(!!e.filterCategoryId||(null===(r=e.filterCategories)||void 0===r?void 0:r.some((function(e){return e.isSelected}))))||!1}function z(e){return e.type===i.STATIC}function Q(e){return e.type===i.DISCOUNTED}function X(e){return e.type===i.RECOMMENDED}function J(e){return e.type===i.LAST_VIEWED}function Z(e){return e.type===i.RELATED_PRODUCTS}function $(e){return e.type===i.VIEWED_TOGETHER}function ee(e){return e.type===i.SEARCH}function te(e){var t;return(null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)===u.MANUALLY&&[i.ALL,i.CATEGORY].includes(e.type)}function re(e){return!(z(e)||Q(e)||X(e)||!e.minPage)&&e.minPage>1}function ie(e){return!(z(e)||Q(e)||X(e))&&e.page*e.limit<e.count}function ne(e){var t;return null===(t=e.filterCategories)||void 0===t?void 0:t.filter((function(e){return 0!==e.resultCount}))}function ae(e){var t,r=y.getValueList;return!!e.searchKeyword||(null===(t=e.filters)||void 0===t?void 0:t.some((function(e){return!!r(e).length})))}function oe(e){var t,r;null===(t=e.filters)||void 0===t||t.forEach(y.clear),e.searchKeyword="",e.pageType!==o.CATEGORY&&(e.filterCategoryId=void 0),null===(r=e.filterCategories)||void 0===r||r.forEach((function(e){return e.isSelected=!1})),U(e)}function ue(e,t,r){y.handleFilterValueClick(t,r),U(e)}function le(e,t,r){y.handleNumberRangeClick(t,r),U(e)}function ce(e,t,r){y.handleNumberRangeChange(t,r),U(e)}function se(r,i,n){var a,u,l,c,s;return e(this,void 0,void 0,(function(){var e,d,f,v,p,g,A,D,L,R,P;return t(this,(function(t){switch(t.label){case 0:r.isLoading=!0,e=Date.now(),r.fetchRequestTime=e,t.label=1;case 1:return t.trys.push([1,14,15,16]),d=n?r.page:1,f=r.limit,!x(r)||r.filters?[3,3]:[4,G(r)];case 2:t.sent(),t.label=3;case 3:return function(e,t){var r;try{var i=y.applyQueryParam,n=m.getFilterCategorySlug;null==t||t.forEach((function(t,r){var n,a=null===(n=e.filters)||void 0===n?void 0:n.find((function(e){return e.key===r}));a&&i(a,t)}));var a=null==t?void 0:t.get("s");a&&(e.searchKeyword=a);var u=null==t?void 0:t.get("o");if(u){var l=parseInt(u),c=Object.entries(b).find((function(e){return e[1]===l}));c&&(e.sort=c[0])}if(e.pageType!==o.CATEGORY){var s=null==t?void 0:t.get("c"),d=null==s?void 0:s.split(",");d&&d.length&&(null===(r=e.filterCategories)||void 0===r||r.forEach((function(e){e.isSelected=d.some((function(t){return t===n(e)}))})))}}catch(e){console.log(e)}}(r,i),ee(r)&&!ae(r)?(r.data=[],r.page=1,r.minPage=1,r.count=0,r.initialized=!0,[2,!0]):(v=void 0,p=!1,z(r)?(d=void 0,f=200,[3,10]):[3,4]);case 4:return Q(r)?(d=1,f=10,[3,10]):[3,5];case 5:return X(r)?(d=1,f=10,[3,10]):[3,6];case 6:return J(r)?S()?[3,9]:[4,T()]:[3,10];case 7:return t.sent(),[4,I()];case 8:return(g=t.sent())&&g.length?(v=g.map((function(e){return e.productId})),p=C(),[3,10]):[2];case 9:return[2];case 10:return p?(D=E.savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,k(r,d||1,f||10,v)];case 12:D=t.sent(),t.label=13;case 13:return(A=D)&&r.fetchRequestTime===e?(L=[],!p&&J(r)&&h(A),z(r)||J(r)?(R=z(r)?null===(a=r.productListPropValue)||void 0===a?void 0:a.productIds:E.lastViewedProducts,L=(null==R?void 0:R.map((function(e){var t,r,i=null===(r=null===(t=A.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.find((function(t){return t.id===e.productId})),n=null==i?void 0:i.variants.find((function(t){return t.id===e.variantId}));if((null==n?void 0:n.isActive)||(n=null==i?void 0:i.variants.find((function(e){return e.isActive}))),i&&n)return i.selectedVariantValues=n.variantValues,i})).filter((function(e){return!!e})))||[]):L=(null===(l=null===(u=A.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})))||[],function(e,t){var r,i,n=y.isCustomValueFilter;null===(r=e.filters)||void 0===r||r.forEach((function(e){var r,i,a,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(r=e.values)||void 0===r||r.forEach((function(t){var r=o.values.find((function(e){return e.id===t.id}));r?t.resultCount=r.count:n(e)?t.resultCount=null:t.resultCount=0})):n(e)?null===(i=e.values)||void 0===i||i.forEach((function(e){return e.resultCount=null})):null===(a=e.values)||void 0===a||a.forEach((function(e){return e.resultCount=0}))}));var a=null==t?void 0:t.find((function(e){return"category"===e.id}));a&&(null===(i=e.filterCategories)||void 0===i||i.forEach((function(e){var t=a.values.find((function(t){return t.id===e.id}));e.resultCount=t?t.count:0})))}(r,null===(c=A.data)||void 0===c?void 0:c.facets),r.data=L,r.count=(null===(s=A.data)||void 0===s?void 0:s.count)||0,r.initialized=!0,r.page=d||1,r.minPage=r.page,_(r),O(r),n||(r.infiniteScrollPage=null),H(r),[2,!0]):[2];case 14:return P=t.sent(),console.log(P),[3,16];case 15:return e===r.fetchRequestTime&&(r.isLoading=!1),[7];case 16:return[2]}}))}))}function de(r){var i,n,a;return e(this,void 0,void 0,(function(){var e,o,u,l;return t(this,(function(t){switch(t.label){case 0:if(r.isLoading||z(r)||Q(r)||X(r)||J(r)||!re(r))return[2];r.isLoading=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),e=r.minPage-1,[4,k(r,e,r.limit)];case 2:return(o=t.sent())?(u=null===(n=null===(i=o.data)||void 0===i?void 0:i.data)||void 0===n?void 0:n.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})),r.data=(null==u?void 0:u.concat(r.data))||r.data,r.count=(null===(a=o.data)||void 0===a?void 0:a.count)||r.count,r.minPage=e,_(r),O(r),[3,5]):[2];case 3:return l=t.sent(),console.log(l),[3,5];case 4:return r.isLoading=!1,[7];case 5:return[2]}}))}))}function fe(r){var i,n,a;return e(this,void 0,void 0,(function(){var e,o,u;return t(this,(function(t){switch(t.label){case 0:if(r.isLoading||z(r)||Q(r)||X(r)||J(r)||!ie(r))return[2];r.isLoading=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,k(r,r.page+1,r.limit)];case 2:return(e=t.sent())?(o=null===(n=null===(i=e.data)||void 0===i?void 0:i.data)||void 0===n?void 0:n.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})),r.data=r.data.concat(o||[]),r.count=(null===(a=e.data)||void 0===a?void 0:a.count)||r.count,r.page=r.page+1,_(r),O(r),[3,5]):[2];case 3:return u=t.sent(),console.log(u),[3,5];case 4:return r.isLoading=!1,[7];case 5:return[2]}}))}))}function ve(r,i){var n,a,o;return e(this,void 0,void 0,(function(){var e,u,l;return t(this,(function(t){switch(t.label){case 0:if(r.isLoading||z(r)||Q(r)||X(r)||J(r))return[2];r.isLoading=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,k(r,i,r.limit)];case 2:return(e=t.sent())?(u=null===(a=null===(n=e.data)||void 0===n?void 0:n.data)||void 0===a?void 0:a.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return e.selectedVariantValues=(t||e.variants[0]).variantValues,e})),r.data=u||[],r.count=(null===(o=e.data)||void 0===o?void 0:o.count)||0,r.page=i,r.minPage=i,_(r),O(r),[3,5]):[2];case 3:return l=t.sent(),console.log(l),[3,5];case 4:return r.isLoading=!1,[7];case 5:return[2]}}))}))}function pe(r,i){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r.sort=i,[4,se(r)];case 1:return e.sent()&&F(r),[2]}}))}))}function ge(r,i,n){var a,o;return void 0===n&&(n=!1),e(this,void 0,void 0,(function(){var e,u;return t(this,(function(t){switch(t.label){case 0:return n?(null===(a=r.filterCategories)||void 0===a||a.forEach((function(e){e.id===i.id&&(e.isSelected=!e.isSelected)})),[4,U(r)]):[3,2];case 1:return t.sent(),[3,3];case 2:g.getIsEditor()||(e=m.getFilterCategoryHref,u=V(r),null===(o=A.router)||void 0===o||o.push(e(i)+(u?"?"+u:""))),t.label=3;case 3:return[2]}}))}))}function he(e,t){var r;if(e.infiniteScrollPage!==t&&(e.infiniteScrollPage=t,!g.getIsEditor())){var i=V(e);null===(r=A.router)||void 0===r||r.replace("".concat(location.pathname).concat(i?"?"+i:""),void 0,{shallow:!0})}}export{oe as clearFilters,w as createIkasProductList,ne as getDisplayedFilterCategories,se as getInitial,fe as getNext,ve as getPage,q as getPageCount,de as getPrev,ge as handleFilterCategoryClick,ue as handleFilterValueClick,ce as handleNumberRangeFilterChange,le as handleNumberRangeFilterValueClick,ae as hasAppliedFilter,ie as hasNext,re as hasPrev,W as initOnBrowser,Q as isDiscounted,te as isFeaturedSortEnabled,x as isFilterable,B as isFiltered,J as isLastViewed,X as isRecommended,Z as isRelatedProducts,ee as isSearch,z as isStatic,$ as isViewedTogetherProducts,M as setSearchKeyword,pe as setSortType,he as setVisibleInfiniteScrollPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as n}from
|
|
1
|
+
import{__awaiter as t,__generator as n}from'./../../../ext/tslib/tslib.es6.js';import{listStorefrontRaffle as i}from"@ikas/storefront-api";import{populateRaffleProducts as e}from"@ikas/storefront-providers";import{observable as a}from"mobx";import{hasPrev as o,hasNext as r}from"../list-commons/index.js";export{getPageCount,hasNext,hasPrev,isStatic}from"../list-commons/index.js";function s(t){var n,i;return a({data:t.data||[],limit:t.limit||10,page:t.page||1,count:t.count||0,initialized:t.initialized||!1,minPage:t.minPage||1,start:null!==(n=t.start)&&void 0!==n?n:null,end:null!==(i=t.end)&&void 0!==i?i:null,includeDeleted:t.includeDeleted||!1,name:t.name||null,search:t.search||null,id:t.id||"",customerId:t.customerId||null,isLoading:t.isLoading||!1})}function d(a,o,r){var s;return t(this,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,i({start:a.start?{eq:a.start}:void 0,end:a.end?{eq:a.end}:void 0,includeDeleted:a.includeDeleted||!1,name:a.name?{eq:a.name}:void 0,id:a.id?{eq:a.id}:void 0,search:a.search||void 0,pagination:{limit:r,page:o}})];case 1:return t=n.sent(),[4,e((null===(s=t.data)||void 0===s?void 0:s.data)||[])];case 2:return n.sent(),[2,t]}}))}))}function u(i){var e,a,r;return t(this,void 0,void 0,(function(){var t,s,u;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading||!o(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),t=i.minPage-1,[4,d(i,t,i.limit)];case 2:return s=n.sent(),i.data=(null===(a=null===(e=s.data)||void 0===e?void 0:e.data)||void 0===a?void 0:a.concat(i.data))||i.data,i.count=(null===(r=s.data)||void 0===r?void 0:r.count)||i.count,i.minPage=t,[3,5];case 3:return u=n.sent(),console.log(u),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function l(i){var e,a;return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading||!r(i))return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,d(i,i.page+1,i.limit)];case 2:return t=n.sent(),i.data=i.data.concat((null===(e=t.data)||void 0===e?void 0:e.data)||[]),i.count=(null===(a=t.data)||void 0===a?void 0:a.count)||i.count,i.page=i.page+1,[3,5];case 3:return o=n.sent(),console.log(o),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}function c(i,e){var a,o;return t(this,void 0,void 0,(function(){var t,r;return n(this,(function(n){switch(n.label){case 0:if(i.isLoading)return[2];i.isLoading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,d(i,e,i.limit)];case 2:return t=n.sent(),i.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],i.count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,i.page=e,i.minPage=e,[3,5];case 3:return r=n.sent(),console.log(r),[3,5];case 4:return i.isLoading=!1,[7];case 5:return[2]}}))}))}export{s as createIkasRaffleList,l as getNext,c as getPage,u as getPrev};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__spreadArray as t,__generator as r}from
|
|
1
|
+
import{__awaiter as e,__spreadArray as t,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as o,action as i}from"mobx";import{Validator as a}from"../index.js";import{PhoneRule as n,RequiredRule as u}from"../rules/index.js";import{IkasCustomerEmailSubscriptionStatus as l}from"@ikas/storefront-models";import"@ikas/localized-address";import{saveCustomer as m}from"../../../../store/customer/account-auth/functions.js";import{IkasCustomerFunctions as c}from"@ikas/storefront-model-functions";var f=function(){function f(e){var r=this;this.validatorRules=function(e){return void 0===e&&(e=!1),t([new u({model:r.customer,fieldKey:"firstName",valuePath:"firstName",message:r.message.requiredRule}),new u({model:r.customer,fieldKey:"lastName",valuePath:"lastName",message:r.message.requiredRule})],e?[new n({model:r.customer,fieldKey:"phone",valuePath:"phone",message:r.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(e){r.customer.firstName=e},this.onLastNameChange=function(e){r.customer.lastName=e},this.onPhoneChange=function(e){r.customer.phone=e||null,e||r.validator.setRules(r.validatorRules())},s(this,{firstNameErrorMessage:o,lastNameErrorMessage:o,phoneErrorMessage:o,isMarketingAccepted:o,hasError:o,firstName:o,lastName:o,phone:o,validateAll:i,submit:i}),this.customer=e.customer,this.message=e.message,this.validator=new a(this.customer,this.validatorRules())}return Object.defineProperty(f.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(e){this.customer.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(e){this.customer.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(e){this.customer.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isMarketingAccepted",{get:function(){return(0,c.isCustomerSubscribedToEmails)(this.customer)},set:function(e){this.customer.subscriptionStatus=e?l.SUBSCRIBED:l.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"firstNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.firstName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"lastNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.lastName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"phoneErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),f.prototype.validateAll=function(){return this.validator.validateAll()},f.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:return e={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,m(this.customer)];case 3:return t.sent()&&(e.isSuccess=!0),[2,e];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},f}();export{f as AccountInfoForm};
|