@ikas/storefront 4.0.7 → 4.0.8
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/ikas.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/image/index.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/models/data/blog/category/index.js +1 -1
- package/build/models/data/blog/content/index.js +1 -1
- package/build/models/data/blog/index.js +1 -1
- package/build/models/data/blog/meta-data/index.js +1 -1
- package/build/models/data/blog/tag/index.js +1 -1
- package/build/models/data/blog/writer/index.js +1 -1
- package/build/models/data/brand/index.js +1 -1
- package/build/models/data/brand/translation/index.js +1 -1
- package/build/models/data/category/index.js +1 -1
- package/build/models/data/category/path-item/index.js +1 -1
- package/build/models/data/category/translations/index.js +1 -1
- package/build/models/data/checkout-settings/index.js +1 -1
- package/build/models/data/checkout-settings/option/index.js +1 -1
- package/build/models/data/checkout-settings/price/index.js +1 -1
- package/build/models/data/city/index.js +1 -1
- package/build/models/data/html-meta-data/index.js +1 -1
- package/build/models/data/html-meta-data/translations/index.js +1 -1
- package/build/models/data/product/attribute/index.js +1 -1
- package/build/models/data/product/attribute/option/index.js +1 -1
- package/build/models/data/product/attribute/table-cell/index.js +1 -1
- package/build/models/data/product/attribute/table-template/index.js +1 -1
- package/build/models/data/product/attribute/translation/index.js +1 -1
- package/build/models/data/product/attribute-value/index.js +1 -1
- package/build/models/data/product/back-in-stock-settings/index.js +1 -1
- package/build/models/data/product/base-unit/index.js +1 -1
- package/build/models/data/product/campaign/data/index.js +1 -1
- package/build/models/data/product/campaign/filter/index.js +1 -1
- package/build/models/data/product/campaign/index.js +1 -1
- package/build/models/data/product/campaign/product-buyx-then-gety/index.js +1 -1
- package/build/models/data/product/campaign/product-campaign-date-range-field/index.js +1 -1
- package/build/models/data/product/campaign/product-fixed-discount/index.js +1 -1
- package/build/models/data/product/image/index.js +1 -1
- package/build/models/data/product/index.d.ts +5 -5
- package/build/models/data/product/index.js +1 -1
- package/build/models/data/product/option-set/index.js +1 -1
- package/build/models/data/product/option-set/option/index.js +1 -1
- package/build/models/data/product/tag/index.js +1 -1
- package/build/models/data/product/variant/index.js +1 -1
- package/build/models/data/product/variant/price/index.js +1 -1
- package/build/models/data/product/variant/unit/index.js +1 -1
- package/build/models/data/product/variant-type/index.js +1 -1
- package/build/models/ui/brand-list/index.js +1 -1
- package/build/models/ui/category-list/index.js +1 -1
- package/build/models/ui/product-list/index.js +1 -1
- package/build/page-data-init/index.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/build/store/blog/index.js +1 -1
- package/build/store/brand/index.js +1 -1
- package/build/store/category/index.js +1 -1
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.js +1 -1
- package/build/store/html-meta-data/index.js +1 -1
- package/build/store/location/index.js +1 -1
- package/package.json +11 -11
- package/build/models/data/product/variant-type/init.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import{IkasBlogMetaDataTargetType as o}from"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import{reaction as n,makeAutoObservable as a,runInAction as s}from"mobx";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import{IkasHTMLMetaDataTargetType as d}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import{IkasThemeJson as p}from"../../models/data/theme-json/index.js";import{IkasStorefront as l}from"../../models/data/storefront/index.js";import{IkasThemeJsonComponent as c}from"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../../models/data/theme-json/page/component/index.js";import{IkasThemeJsonSettings as u}from"../../models/data/theme-json/settings/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-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/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"../../models/ui/raffle-list/index.js";import{IkasPageDataProvider as g}from"@ikas/storefront-providers";import{IkasPageDataInit as h}from"../../page-data-init/index.js";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"../page/index.js";import"../page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"./loader/style.module.scss.js";import"../google-captcha/index.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{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";import E from"../../store/html-meta-data/index.js";import v from"../../store/blog/index.js";import P from"../../store/raffle/index.js";import O from"../../store/product/index.js";import{setAPIClientConfig as T,listCustomerSettings as C}from"@ikas/storefront-api";var _,D=function(){function D(n){var O=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",O.onMessage,!1),O.sendMessage(_.FRAME_DID_LOAD,"4.0.0"),O.createLoadingListener()},this.onMessage=function(i){return e(O,void 0,void 0,(function(){var e,o;return t(this,(function(t){switch(t.label){case 0:switch(e=i.data.type,o=i.data.data,e){case _.UPDATE_FRAME_DATA:return[3,1];case _.UPDATE_THEME_JSON:return[3,3];case _.UPDATE_PROP_VALUE:return[3,5];case _.UPDATE_PAGE_PARAMS:return[3,7];case _.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case _.ADD_COMPONENT:return[3,11];case _.DELETE_COMPONENT:return[3,12];case _.UPDATE_COMPONENT:return[3,13];case _.ADD_PAGE_COMPONENT:return[3,14];case _.DELETE_PAGE_COMPONENT:return[3,16];case _.SET_SELECTED_COMPONENT:return[3,17];case _.SET_HOVERED_COMPONENT:return[3,18];case _.SCROLL_TO_COMPONENT:return[3,19];case _.EDITOR_RELOAD:return[3,20];case _.UPDATE_THEME_SETTINGS:return[3,21]}return[3,22];case 1:return[4,this.handleUpdateFrameData(o)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,23];case 3:return[4,this.handleUpdateThemeJson(o)];case 5:return[4,this.handleUpdatePropValue(o)];case 7:return[4,this.handleUpdatePageParams(o)];case 9:return[4,this.handleUpdatePageComponentOrder(o)];case 11:return this.handleAddNewComponent(o),[3,23];case 12:return this.handleDeleteComponent(o),[3,23];case 13:return this.handleUpdateComponent(o),[3,23];case 14:return[4,this.handleAddNewPageComponent(o)];case 16:return this.handleDeletePageComponent(o),[3,23];case 17:return this.handleSetSelectedComponent(o),[3,23];case 18:return this.handleSetHoveredComponent(o),[3,23];case 19:return this.handleScrollToComponent(o),[3,23];case 20:return this.handleEditorReload(),[3,23];case 21:return this.updateThemeSettings(o),[3,23];case 22:return[3,23];case 23:return[2]}}))}))},this.onClick=function(e){O.sendMessage(_.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){O.sendMessage(_.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){O.sendMessage(_.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(i){return e(O,void 0,void 0,(function(){var e,n,a,p,l,c,m,u,g,h,O,T,C,D=this;return t(this,(function(t){switch(t.label){case 0:return e=i.slice(1),n=e.split("?"),e=n[0],a=n[1],this.pageParams={},i.startsWith("/account/orders/")?p=r.ORDER_DETAIL:i.startsWith("/account/orders")?p=r.ORDERS:i.startsWith("/account/addresses")?p=r.ADDRESSES:i.startsWith("/account/favorite-products")?p=r.FAVORITE_PRODUCTS:i.startsWith("/account/forgot-password")?p=r.FORGOT_PASSWORD:i.startsWith("/account/login")?p=r.LOGIN:i.startsWith("/account/raffles")?p=r.RAFFLE_ACCOUNT:i.startsWith("/account/recover-password")?p=r.RECOVER_PASSWORD:i.startsWith("/account/register")?p=r.REGISTER:i.startsWith("/account")?p=r.ACCOUNT:i.startsWith("/blog/")?p=r.BLOG:i.startsWith("/blog")?p=r.BLOG_INDEX:i.startsWith("/pages")?(p=r.CUSTOM,this.pageParams={slug:e.split("/")[1]}):p=i.startsWith("/raffle/")?r.RAFFLE_DETAIL:i.startsWith("/raffle")?r.RAFFLE:i.startsWith("/404")?r.NOT_FOUND:i.startsWith("/cart")?r.CART:i.startsWith("/checkout")?r.CHECKOUT:"/"===i?r.INDEX:i.startsWith("/search")?r.SEARCH:r.PRODUCT,p!==r.PRODUCT?[3,6]:[4,E.listHTMLMetaData({slug:{eq:e}})];case 1:return(c=t.sent()).isSuccess&&(null===(g=c.data)||void 0===g?void 0:g.length)?(m=c.data[0]).targetType!==d.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(m.targetId,a)]:[3,5];case 2:return l=t.sent(),this.pageParams={productId:m.targetId,variantId:l,slug:e},[3,4];case 3:if(m.targetType===d.CATEGORY)p=r.CATEGORY,this.pageParams={categoryId:m.targetId,slug:e};else{if(m.targetType!==d.BRAND)return[2];p=r.BRAND,this.pageParams={brandId:m.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return p!==r.BLOG?[3,8]:[4,v.listBlogMetaData({slug:{eq:e}})];case 7:if(!(c=t.sent()).isSuccess||!(null===(O=null===(h=c.data)||void 0===h?void 0:h.data)||void 0===O?void 0:O.length))return[2];if((m=c.data.data[0]).targetType===o.BLOG)this.pageParams={blogId:m.targetId,slug:e};else{if(m.targetType!==o.BLOG_CATEGORY)return[2];p=r.BLOG_CATEGORY,this.pageParams={blogCategoryId:m.targetId,slug:e}}t.label=8;case 8:return p!==r.RAFFLE_DETAIL?[3,10]:[4,P.listRaffleMetaData({slug:{eq:e}})];case 9:if(!(c=t.sent()).isSuccess||!(null===(T=c.data)||void 0===T?void 0:T.length))return[2];m=c.data[0],this.pageParams={raffleId:m.targetId,slug:e},t.label=10;case 10:return this.isLoading=!0,[4,this.getPagePropValues(this.theme,p,this.pageParams)];case 11:return u=t.sent(),s((function(){var e,t;f.getInstance().currentPageType=p,D.pageDataProvider=u,p===r.CUSTOM?D.page=null===(e=D.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===p&&e.slug===D.pageParams.slug})):D.page=null===(t=D.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===p})),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(_.EDITOR_PAGE_CHANGE,{pageType:p,pageParams:this.pageParams,pageSpecificData:(null===(C=this.pageDataProvider)||void 0===C?void 0:C.pageSpecificData)||null}),this.isLoading=!1,[2]}}))}))},this.onLoadingChange=function(){O.sendMessage(_.EDITOR_LOADING_CHANGE,{isLoading:O.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(i,o,n){return e(O,void 0,void 0,(function(){var e,a,s;return t(this,(function(t){switch(t.label){case 0:return e=new g(i,n,o),(n.blogId||n.blogCategoryId)&&(e.possiblePageTypes=[r.BLOG,r.BLOG_CATEGORY]),n.raffleId&&(e.possiblePageTypes=[r.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(h.setPageSpecificData(e.pageSpecificData,o,!0),o===r.PRODUCT&&h.pageSpecificData&&(a=h.pageSpecificData,(s=a.variants.find((function(e){return e.id===n.variantId})))&&(a.selectedVariantValues=s.variantValues))):h.pageSpecificData=void 0,this.initializedPropValues=h.initPagePropValues(e.$pageComponentPropValues,i.components,i.customData,i.settings,!1),[2,e]}}))}))},this.setComponentRef=function(e,t){O.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),i=t.top,o=t.bottom;return i<window.innerHeight&&o>=0&&o<window.innerHeight&&i>0},this.handleUpdateFrameData=function(o){return e(O,void 0,void 0,(function(){var e,n,a,s,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new p(o.theme),this.page=null===(r=this.theme)||void 0===r?void 0:r.pages.find((function(e){return e.id===o.selectedPage.id})),this.pageParams=o.pageParams,this.apiKey=o.apiKey,this.locale=o.locale||"en",this.translations=o.translations||void 0,this.page?((e=o.storefront?new l(o.storefront):null)&&(n=e.routings.find((function(e){return e.locale===c.locale})),i.init({storefrontId:e.id,storefrontRoutingId:null==n?void 0:n.id,storefrontThemeId:e.mainStorefrontThemeId||void 0,salesChannelId:e.salesChannelId||void 0,priceListId:(null==n?void 0:n.priceListId)||void 0,routings:e.routings,stockPreference:null===(d=this.theme)||void 0===d?void 0:d.settings.stockPreference,translations:this.translations||{},isEditor:!0,apiKey:o.apiKey,apiUrl:o.apiUrl,adminApiUrl:o.adminApiUrl,cdnUrl:o.cdnUrl,merchantSettings:o.merchantSettings}),T(),this.setCustomerSettings()),a=Date.now()+"",this.updateId=a,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return s=t.sent(),this.updateId===a&&(this.pageDataProvider=s,this.isLoading=!1),[2]}}))}))},this.setCustomerSettings=function(){return e(O,void 0,void 0,(function(){var e,o,n;return t(this,(function(t){switch(t.label){case 0:return i.getCustomerSettings()?[3,2]:[4,C({storefrontId:{eq:i.getStorefrontId()}})];case 1:(e=t.sent()).isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.data.length)&&(o=e.data.data[0],i.init({customerSettings:o})),t.label=2;case 2:return[2]}}))}))},this.handleUpdateThemeJson=function(i){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new p(i.theme),[2]}))}))},this.handleUpdatePropValue=function(i){return e(O,void 0,void 0,(function(){var e,o,n,a,s,r,d,p=this;return t(this,(function(t){switch(t.label){case 0:return e=i.propName,o=i.value,(n=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?(a=this.initializedPropValues.find((function(e){return e.pageComponent.id===p.selectedPageComponentId})),this.pageDataProvider&&a?(this.selectedPageComponent.propValues[e]=o,[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,n)]):[2]):[2];case 1:return(s=t.sent())&&JSON.stringify(s).includes("href")?[4,this.pageDataProvider.setLinkSlugs()]:[3,3];case 2:t.sent(),t.label=3;case 3:return a.propValues[e]=h.initPropValue(n,s,this.theme.settings,!0),[2]}}))}))},this.handleUpdatePageParams=function(i){return e(O,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=i.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(i){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=i.pageComponents.map((function(e){return new m(e)})):this.page.components=i.pageComponents.map((function(e){return new m(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,i=new c(e.component);null===(t=O.theme)||void 0===t||t.components.push(i)},this.handleDeleteComponent=function(e){var t,i;(null===(t=O.theme)||void 0===t?void 0:t.components)&&(O.theme.components=O.theme.components.filter((function(t){return t.id!==e.componentId})));var o=O.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];O.specification&&O.specification.components&&(O.specification.components=o),!O.specification&&(null===(i=O.page)||void 0===i?void 0:i.components)&&(O.page.components=o)},this.handleUpdateComponent=function(e){var t=O.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(O.theme.components[t]=new c(e.component))},this.handleAddNewPageComponent=function(i){return e(O,void 0,void 0,(function(){var e,o,n;return t(this,(function(t){switch(t.label){case 0:return e=new m(i.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return o=t.sent(),n=h.initPageComponentPropValue(o,[o.component],this.theme.settings,!0),this.initializedPropValues.push(n),i.customIndex?this.pageComponents.splice(i.customIndex,0,e):this.pageComponents.push(e),[2]}}))}))},this.handleDeletePageComponent=function(e){O.specification?O.specification.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):O.page.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){O.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){O.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,i=O.componentRefs[t];i&&(O.isScrolledIntoView(i)||window.scrollTo({top:i.offsetTop,behavior:"smooth"}))},this.handleEditorReload=function(){window.location.reload()},this.updateThemeSettings=function(e){var t=e.settings;O.theme&&(O.theme.settings=new u(t))},this.router=n,a(this),this.startMessaging()}return Object.defineProperty(D.prototype,"specification",{get:function(){var e,t,i,o,n,a,s,d=this,p=this.page;return(null==p?void 0:p.type)===r.PRODUCT&&(s=null===(e=p.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==p?void 0:p.type)===r.CATEGORY&&(s=null===(t=p.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==p?void 0:p.type)===r.BRAND&&(s=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===r.BLOG&&(s=null===(o=p.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==p?void 0:p.type)===r.BLOG_CATEGORY&&(s=null===(n=p.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.blogCategoryId)}))),(null==p?void 0:p.type)===r.RAFFLE_DETAIL&&(s=null===(a=p.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)}))),s},enumerable:!1,configurable:!0}),Object.defineProperty(D.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(D.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var i;return e.id===(null===(i=t.selectedPageComponent)||void 0===i?void 0:i.componentId)}))},enumerable:!1,configurable:!0}),D.prototype.createLoadingListener=function(){var e=this;n((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},D.prototype.getVariantIdFromParams=function(o,n){var a,s;return e(this,void 0,void 0,(function(){var e,r,d,p,l,c,m;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+n),[4,O.searchProducts({input:{productIdList:[o],priceListId:i.getPriceListId(),salesChannelId:i.getSalesChannelId()}})];case 1:return(r=t.sent()).isSuccess&&!(null===(s=null===(a=null==r?void 0:r.data)||void 0===a?void 0:a.data)||void 0===s?void 0:s.length)?[2]:(d=r.data.data[0],p=d.variantTypes.map((function(e){return e.variantType.slug})),l=[],p.forEach((function(t,i){var o=d.variantTypes[i],n=e.get(t);if(n){var a=o.variantType.values.find((function(e){return e.slug===n}));a&&l.push(a)}})),(c=d.variants.find((function(e){return e.variantValues.every((function(e){return l.some((function(t){return t.id===e.id}))}))})))?[2,c.id]:[3,3]);case 2:return m=t.sent(),console.error(m),[3,3];case 3:return[2]}}))}))},D}();!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"}(_||(_={}));export{_ as BridgeMessageType,D as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import{IkasBlogMetaDataTargetType as o}from"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as n}from"@ikas/storefront-models";import{reaction as a,makeAutoObservable as s,runInAction as r}from"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import{IkasHTMLMetaDataTargetType as d}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import{IkasThemeJson as p}from"../../models/data/theme-json/index.js";import{IkasStorefront as l}from"../../models/data/storefront/index.js";import{IkasThemeJsonComponent as c}from"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../../models/data/theme-json/page/component/index.js";import{IkasThemeJsonSettings as u}from"../../models/data/theme-json/settings/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-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/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"../../models/ui/raffle-list/index.js";import{IkasPageDataProvider as g}from"@ikas/storefront-providers";import{IkasPageDataInit as h}from"../../page-data-init/index.js";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"../page/index.js";import"../page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"./loader/style.module.scss.js";import"../google-captcha/index.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{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";import E from"../../store/html-meta-data/index.js";import v from"../../store/blog/index.js";import P from"../../store/raffle/index.js";import O from"../../store/product/index.js";import{setAPIClientConfig as T,listCustomerSettings as C}from"@ikas/storefront-api";var _,D=function(){function D(a){var O=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",O.onMessage,!1),O.sendMessage(_.FRAME_DID_LOAD,"4.0.0"),O.createLoadingListener()},this.onMessage=function(i){return e(O,void 0,void 0,(function(){var e,o;return t(this,(function(t){switch(t.label){case 0:switch(e=i.data.type,o=i.data.data,e){case _.UPDATE_FRAME_DATA:return[3,1];case _.UPDATE_THEME_JSON:return[3,3];case _.UPDATE_PROP_VALUE:return[3,5];case _.UPDATE_PAGE_PARAMS:return[3,7];case _.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case _.ADD_COMPONENT:return[3,11];case _.DELETE_COMPONENT:return[3,12];case _.UPDATE_COMPONENT:return[3,13];case _.ADD_PAGE_COMPONENT:return[3,14];case _.DELETE_PAGE_COMPONENT:return[3,16];case _.SET_SELECTED_COMPONENT:return[3,17];case _.SET_HOVERED_COMPONENT:return[3,18];case _.SCROLL_TO_COMPONENT:return[3,19];case _.EDITOR_RELOAD:return[3,20];case _.UPDATE_THEME_SETTINGS:return[3,21]}return[3,22];case 1:return[4,this.handleUpdateFrameData(o)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,23];case 3:return[4,this.handleUpdateThemeJson(o)];case 5:return[4,this.handleUpdatePropValue(o)];case 7:return[4,this.handleUpdatePageParams(o)];case 9:return[4,this.handleUpdatePageComponentOrder(o)];case 11:return this.handleAddNewComponent(o),[3,23];case 12:return this.handleDeleteComponent(o),[3,23];case 13:return this.handleUpdateComponent(o),[3,23];case 14:return[4,this.handleAddNewPageComponent(o)];case 16:return this.handleDeletePageComponent(o),[3,23];case 17:return this.handleSetSelectedComponent(o),[3,23];case 18:return this.handleSetHoveredComponent(o),[3,23];case 19:return this.handleScrollToComponent(o),[3,23];case 20:return this.handleEditorReload(),[3,23];case 21:return this.updateThemeSettings(o),[3,23];case 22:return[3,23];case 23:return[2]}}))}))},this.onClick=function(e){O.sendMessage(_.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){O.sendMessage(_.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){O.sendMessage(_.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(i){return e(O,void 0,void 0,(function(){var e,a,s,p,l,c,m,u,g,h,O,T,C,D=this;return t(this,(function(t){switch(t.label){case 0:return e=i.slice(1),a=e.split("?"),e=a[0],s=a[1],this.pageParams={},i.startsWith("/account/orders/")?p=n.ORDER_DETAIL:i.startsWith("/account/orders")?p=n.ORDERS:i.startsWith("/account/addresses")?p=n.ADDRESSES:i.startsWith("/account/favorite-products")?p=n.FAVORITE_PRODUCTS:i.startsWith("/account/forgot-password")?p=n.FORGOT_PASSWORD:i.startsWith("/account/login")?p=n.LOGIN:i.startsWith("/account/raffles")?p=n.RAFFLE_ACCOUNT:i.startsWith("/account/recover-password")?p=n.RECOVER_PASSWORD:i.startsWith("/account/register")?p=n.REGISTER:i.startsWith("/account")?p=n.ACCOUNT:i.startsWith("/blog/")?p=n.BLOG:i.startsWith("/blog")?p=n.BLOG_INDEX:i.startsWith("/pages")?(p=n.CUSTOM,this.pageParams={slug:e.split("/")[1]}):p=i.startsWith("/raffle/")?n.RAFFLE_DETAIL:i.startsWith("/raffle")?n.RAFFLE:i.startsWith("/404")?n.NOT_FOUND:i.startsWith("/cart")?n.CART:i.startsWith("/checkout")?n.CHECKOUT:"/"===i?n.INDEX:i.startsWith("/search")?n.SEARCH:n.PRODUCT,p!==n.PRODUCT?[3,6]:[4,E.listHTMLMetaData({slug:{eq:e}})];case 1:return(c=t.sent()).isSuccess&&(null===(g=c.data)||void 0===g?void 0:g.length)?(m=c.data[0]).targetType!==d.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(m.targetId,s)]:[3,5];case 2:return l=t.sent(),this.pageParams={productId:m.targetId,variantId:l,slug:e},[3,4];case 3:if(m.targetType===d.CATEGORY)p=n.CATEGORY,this.pageParams={categoryId:m.targetId,slug:e};else{if(m.targetType!==d.BRAND)return[2];p=n.BRAND,this.pageParams={brandId:m.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return p!==n.BLOG?[3,8]:[4,v.listBlogMetaData({slug:{eq:e}})];case 7:if(!(c=t.sent()).isSuccess||!(null===(O=null===(h=c.data)||void 0===h?void 0:h.data)||void 0===O?void 0:O.length))return[2];if((m=c.data.data[0]).targetType===o.BLOG)this.pageParams={blogId:m.targetId,slug:e};else{if(m.targetType!==o.BLOG_CATEGORY)return[2];p=n.BLOG_CATEGORY,this.pageParams={blogCategoryId:m.targetId,slug:e}}t.label=8;case 8:return p!==n.RAFFLE_DETAIL?[3,10]:[4,P.listRaffleMetaData({slug:{eq:e}})];case 9:if(!(c=t.sent()).isSuccess||!(null===(T=c.data)||void 0===T?void 0:T.length))return[2];m=c.data[0],this.pageParams={raffleId:m.targetId,slug:e},t.label=10;case 10:return this.isLoading=!0,[4,this.getPagePropValues(this.theme,p,this.pageParams)];case 11:return u=t.sent(),r((function(){var e,t;f.getInstance().currentPageType=p,D.pageDataProvider=u,p===n.CUSTOM?D.page=null===(e=D.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===p&&e.slug===D.pageParams.slug})):D.page=null===(t=D.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===p})),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(_.EDITOR_PAGE_CHANGE,{pageType:p,pageParams:this.pageParams,pageSpecificData:(null===(C=this.pageDataProvider)||void 0===C?void 0:C.pageSpecificData)||null}),this.isLoading=!1,[2]}}))}))},this.onLoadingChange=function(){O.sendMessage(_.EDITOR_LOADING_CHANGE,{isLoading:O.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(i,o,a){return e(O,void 0,void 0,(function(){var e,s,r;return t(this,(function(t){switch(t.label){case 0:return e=new g(i,a,o),(a.blogId||a.blogCategoryId)&&(e.possiblePageTypes=[n.BLOG,n.BLOG_CATEGORY]),a.raffleId&&(e.possiblePageTypes=[n.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(h.setPageSpecificData(e.pageSpecificData,o,!0),o===n.PRODUCT&&h.pageSpecificData&&(s=h.pageSpecificData,(r=s.variants.find((function(e){return e.id===a.variantId})))&&(s.selectedVariantValues=r.variantValues))):h.pageSpecificData=void 0,this.initializedPropValues=h.initPagePropValues(e.$pageComponentPropValues,i.components,i.customData,i.settings,!1),[2,e]}}))}))},this.setComponentRef=function(e,t){O.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),i=t.top,o=t.bottom;return i<window.innerHeight&&o>=0&&o<window.innerHeight&&i>0},this.handleUpdateFrameData=function(o){return e(O,void 0,void 0,(function(){var e,n,a,s,r,d,c=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new p(o.theme),this.page=null===(r=this.theme)||void 0===r?void 0:r.pages.find((function(e){return e.id===o.selectedPage.id})),this.pageParams=o.pageParams,this.apiKey=o.apiKey,this.locale=o.locale||"en",this.translations=o.translations||void 0,this.page?((e=o.storefront?new l(o.storefront):null)&&(n=e.routings.find((function(e){return e.locale===c.locale})),i.init({storefrontId:e.id,storefrontRoutingId:null==n?void 0:n.id,storefrontThemeId:e.mainStorefrontThemeId||void 0,salesChannelId:e.salesChannelId||void 0,priceListId:(null==n?void 0:n.priceListId)||void 0,routings:e.routings,stockPreference:null===(d=this.theme)||void 0===d?void 0:d.settings.stockPreference,translations:this.translations||{},isEditor:!0,apiKey:o.apiKey,apiUrl:o.apiUrl,adminApiUrl:o.adminApiUrl,cdnUrl:o.cdnUrl,merchantSettings:o.merchantSettings}),T(),this.setCustomerSettings()),a=Date.now()+"",this.updateId=a,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return s=t.sent(),this.updateId===a&&(this.pageDataProvider=s,this.isLoading=!1),[2]}}))}))},this.setCustomerSettings=function(){return e(O,void 0,void 0,(function(){var e,o,n;return t(this,(function(t){switch(t.label){case 0:return i.getCustomerSettings()?[3,2]:[4,C({storefrontId:{eq:i.getStorefrontId()}})];case 1:(e=t.sent()).isSuccess&&(null===(n=e.data)||void 0===n?void 0:n.data.length)&&(o=e.data.data[0],i.init({customerSettings:o})),t.label=2;case 2:return[2]}}))}))},this.handleUpdateThemeJson=function(i){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new p(i.theme),[2]}))}))},this.handleUpdatePropValue=function(i){return e(O,void 0,void 0,(function(){var e,o,n,a,s,r,d,p=this;return t(this,(function(t){switch(t.label){case 0:return e=i.propName,o=i.value,(n=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?(a=this.initializedPropValues.find((function(e){return e.pageComponent.id===p.selectedPageComponentId})),this.pageDataProvider&&a?(this.selectedPageComponent.propValues[e]=o,[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,n)]):[2]):[2];case 1:return(s=t.sent())&&JSON.stringify(s).includes("href")?[4,this.pageDataProvider.setLinkSlugs()]:[3,3];case 2:t.sent(),t.label=3;case 3:return a.propValues[e]=h.initPropValue(n,s,this.theme.settings,!0),[2]}}))}))},this.handleUpdatePageParams=function(i){return e(O,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=i.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(i){return e(O,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=i.pageComponents.map((function(e){return new m(e)})):this.page.components=i.pageComponents.map((function(e){return new m(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,i=new c(e.component);null===(t=O.theme)||void 0===t||t.components.push(i)},this.handleDeleteComponent=function(e){var t,i;(null===(t=O.theme)||void 0===t?void 0:t.components)&&(O.theme.components=O.theme.components.filter((function(t){return t.id!==e.componentId})));var o=O.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];O.specification&&O.specification.components&&(O.specification.components=o),!O.specification&&(null===(i=O.page)||void 0===i?void 0:i.components)&&(O.page.components=o)},this.handleUpdateComponent=function(e){var t=O.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(O.theme.components[t]=new c(e.component))},this.handleAddNewPageComponent=function(i){return e(O,void 0,void 0,(function(){var e,o,n;return t(this,(function(t){switch(t.label){case 0:return e=new m(i.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return o=t.sent(),n=h.initPageComponentPropValue(o,[o.component],this.theme.settings,!0),this.initializedPropValues.push(n),i.customIndex?this.pageComponents.splice(i.customIndex,0,e):this.pageComponents.push(e),[2]}}))}))},this.handleDeletePageComponent=function(e){O.specification?O.specification.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):O.page.components=O.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){O.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){O.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,i=O.componentRefs[t];i&&(O.isScrolledIntoView(i)||window.scrollTo({top:i.offsetTop,behavior:"smooth"}))},this.handleEditorReload=function(){window.location.reload()},this.updateThemeSettings=function(e){var t=e.settings;O.theme&&(O.theme.settings=new u(t))},this.router=a,s(this),this.startMessaging()}return Object.defineProperty(D.prototype,"specification",{get:function(){var e,t,i,o,a,s,r,d=this,p=this.page;return(null==p?void 0:p.type)===n.PRODUCT&&(r=null===(e=p.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==p?void 0:p.type)===n.CATEGORY&&(r=null===(t=p.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==p?void 0:p.type)===n.BRAND&&(r=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===n.BLOG&&(r=null===(o=p.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==p?void 0:p.type)===n.BLOG_CATEGORY&&(r=null===(a=p.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.blogCategoryId)}))),(null==p?void 0:p.type)===n.RAFFLE_DETAIL&&(r=null===(s=p.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.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(D.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(D.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var i;return e.id===(null===(i=t.selectedPageComponent)||void 0===i?void 0:i.componentId)}))},enumerable:!1,configurable:!0}),D.prototype.createLoadingListener=function(){var e=this;a((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},D.prototype.getVariantIdFromParams=function(o,n){var a,s;return e(this,void 0,void 0,(function(){var e,r,d,p,l,c,m;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+n),[4,O.searchProducts({input:{productIdList:[o],priceListId:i.getPriceListId(),salesChannelId:i.getSalesChannelId()}})];case 1:return(r=t.sent()).isSuccess&&!(null===(s=null===(a=null==r?void 0:r.data)||void 0===a?void 0:a.data)||void 0===s?void 0:s.length)?[2]:(d=r.data.data[0],p=d.variantTypes.map((function(e){return e.variantType.slug})),l=[],p.forEach((function(t,i){var o=d.variantTypes[i],n=e.get(t);if(n){var a=o.variantType.values.find((function(e){return e.slug===n}));a&&l.push(a)}})),(c=d.variants.find((function(e){return e.variantValues.every((function(e){return l.some((function(t){return t.id===e.id}))}))})))?[2,c.id]:[3,3]);case 2:return m=t.sent(),console.error(m),[3,3];case 3:return[2]}}))}))},D}();!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"}(_||(_={}));export{_ as BridgeMessageType,D as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as t}from"../../base/index.js";import{IkasBlogMetaData as
|
|
1
|
+
import{__extends as e}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as t}from"../../base/index.js";import{IkasBlogMetaData as i}from"../meta-data/index.js";import{IkasImage as r}from"../../image/index.js";import{IkasBlogCategoryFunctions as a}from"@ikas/storefront-model-functions";var o=function(t){function o(e){var a=t.call(this,e)||this;return a.imageId=e.imageId,a.metadata=new i(e.metadata),a.name=e.name,a.image=e.image?new r(e.image):e.imageId?new r({id:e.imageId,isVideo:!1}):null,a}return e(o,t),Object.defineProperty(o.prototype,"href",{get:function(){return a.getIkasBlogCategoryHref(this)},enumerable:!1,configurable:!0}),o}(t);export{o as IkasBlogCategory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as
|
|
1
|
+
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as n}from"../../base/index.js";var o=function(n){function o(t){var o=n.call(this,t)||this;return o.content=t.content,o}return t(o,n),o}(n);export{o as IkasBlogContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../ext/tslib/tslib.es6.js';import{
|
|
1
|
+
import{__extends as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as e}from"../base/index.js";import{IkasImage as o}from"../image/index.js";import{IkasBlogTag as r}from"./tag/index.js";import{IkasBlogContent as i}from"./content/index.js";import{IkasBlogMetaData as n}from"./meta-data/index.js";import{IkasBlogWriter as l}from"./writer/index.js";import{IkasBlogCategory as a}from"./category/index.js";import{IkasBlogFunctions as s}from"@ikas/storefront-model-functions";var m=function(e){function m(t){var s,m=this;return(m=e.call(this,t)||this).locale=null,m.publishedAt=null,m.tagIds=null,m.tags=null,m.image=null,m.blogContent=new i(t.blogContent),m.categoryId=t.categoryId,m.imageId=t.imageId,m.isPublished=t.isPublished,m.locale=t.locale||null,m.metadata=new n(t.metadata),m.publishedAt=t.publishedAt||null,m.shortDescription=t.shortDescription,m.storefrontId=t.storefrontId,m.tagIds=t.tagIds||null,m.tags=(null===(s=t.tags)||void 0===s?void 0:s.map((function(t){return new r(t)})))||null,m.title=t.title,m.writer=new l(t.writer),m.image=t.image?new o(t.image):null,m.category=new a(t.category),m}return t(m,e),Object.defineProperty(m.prototype,"href",{get:function(){return s.getIkasBlogHref(this)},enumerable:!1,configurable:!0}),m}(e);export{m as IkasBlog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as l}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as
|
|
1
|
+
import{__extends as l}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as n}from"../../base/index.js";var e,t=function(n){function e(l){var e=n.call(this,l)||this;return e.canonicals=null,e.description=null,e.disableIndex=null,e.pageTitle=null,e.targetId=null,e.targetType=null,e.canonicals=l.canonicals||null,e.description=l.description||null,e.disableIndex=l.disableIndex||null,e.pageTitle=l.pageTitle||null,e.slug=l.slug,e.targetId=l.targetId||null,e.targetType=l.targetType||null,e}return l(e,n),e}(n);!function(l){l.BLOG="BLOG",l.BLOG_CATEGORY="BLOG_CATEGORY"}(e||(e={}));export{t as IkasBlogMetaData,e as IkasBlogMetaDataTargetType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as r}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as
|
|
1
|
+
import{__extends as r}from'./../../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as t}from"../../base/index.js";var e=function(t){function e(r){var e=t.call(this,r)||this;return e.name=r.name,e}return r(e,t),e}(t);export{e as IkasBlogTag};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t=function(t){this.firstName=t.firstName,this.lastName=t.lastName};export{t as IkasBlogWriter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as
|
|
1
|
+
import{__extends as n}from'./../../../ext/tslib/tslib.es6.js';import{IkasImage as e}from"../image/index.js";import{IkasBaseModel as t}from"../base/index.js";import{IkasProductBrandTranslation as r}from"./translation/index.js";import{IkasBrandFunctions as i}from"@ikas/storefront-model-functions";var l,o=function(t){function l(n){var i,l=this;return(l=t.call(this,n)||this).description=null,l.imageId=null,l.metaData=null,l.orderType=null,l.image=null,l.translations=null,l.description=n.description||null,l.imageId=n.imageId||null,l.name=n.name,l.metaData=n.metaData||null,l.orderType=n.orderType||null,l.image=n.image?new e(n.image):null,l.translations=(null===(i=n.translations)||void 0===i?void 0:i.map((function(n){return new r(n)})))||null,l}return n(l,t),Object.defineProperty(l.prototype,"href",{get:function(){return i.getIkasBrandHref(this)},enumerable:!1,configurable:!0}),l}(t);!function(n){n.BEST_SELLER="BEST_SELLER",n.HIGHEST_DISCOUNT_RATIO="HIGHEST_DISCOUNT_RATIO",n.HIGHEST_PRICE="HIGHEST_PRICE",n.LOWEST_DISCOUNT_RATIO="LOWEST_DISCOUNT_RATIO",n.LOWEST_PRICE="LOWEST_PRICE",n.MANUALLY="MANUALLY",n.NEWEST="NEWEST",n.OLDEST="OLDEST"}(l||(l={}));export{o as IkasBrand,l as IkasBrandOrderType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var i=function(i){this.description=null,this.name=null,this.description=i.description||null,this.locale=i.locale,this.name=i.name||null};export{i as IkasProductBrandTranslation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasImage as t}from"../image/index.js";import{IkasBaseModel as r}from"../base/index.js";import{IkasCategoryPathItem as
|
|
1
|
+
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasImage as t}from"../image/index.js";import{IkasBaseModel as r}from"../base/index.js";import{IkasCategoryPathItem as n}from"./path-item/index.js";import{IkasCategoryTranslation as a}from"./translations/index.js";export{IkasCategoryProductsOrderType as IkasCategoryOrderType}from"@ikas/storefront-models";import{IkasCategoryFunctions as o}from"@ikas/storefront-model-functions";var i=function(r){function i(e){var o,i,l=this;return(l=r.call(this,e)||this).categoryPath=null,l.description=null,l.imageId=null,l.parentId=null,l.metaData=null,l.orderType=null,l.image=null,l.translations=null,l.categoryPath=e.categoryPath||null,l.description=e.description||null,l.imageId=e.imageId||null,l.name=e.name,l.parentId=e.parentId||null,l.metaData=e.metaData||null,l.categoryPathItems=(null===(o=e.categoryPathItems)||void 0===o?void 0:o.map((function(e){return new n(e)})))||[],l.orderType=e.orderType,l.image=e.image?new t(e.image):null,l.translations=(null===(i=e.translations)||void 0===i?void 0:i.map((function(e){return new a(e)})))||null,l}return e(i,r),Object.defineProperty(i.prototype,"href",{get:function(){return o.getIkasCategoryHref(this)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"path",{get:function(){return this.categoryPathItems},enumerable:!1,configurable:!0}),i}(r);export{i as IkasCategory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';import{IkasHTMLMetaData as e}from"../../html-meta-data/index.js";import{IkasBaseModel as
|
|
1
|
+
import{__extends as t}from'./../../../../ext/tslib/tslib.es6.js';import{IkasHTMLMetaData as e}from"../../html-meta-data/index.js";import{IkasBaseModel as n}from"../../base/index.js";import{IkasCategoryPathItemFunctions as r}from"@ikas/storefront-model-functions";var a=function(n){function a(t){var r=n.call(this,t)||this;return r.translations=null,r.metaData=t.metaData?new e(t.metaData):null,r.description=t.description||null,r.imageId=t.imageId||null,r.name=t.name,r.translations=t.translations||null,r}return t(a,n),Object.defineProperty(a.prototype,"slug",{get:function(){return r.getIkasCategoryPathItemSlug(this)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"href",{get:function(){return r.getIkasCategoryPathItemHref(this)},enumerable:!1,configurable:!0}),a}(n);export{a as IkasCategoryPathItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var i=function(i){this.description=null,this.name=null,this.description=i.description||null,this.locale=i.locale,this.name=i.name||null};export{i as IkasCategoryTranslation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';export{IkasCheckoutRequirement}from"@ikas/storefront-models";import{
|
|
1
|
+
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';export{IkasCheckoutRequirement}from"@ikas/storefront-models";import{IkasBaseModel as o}from"../base/index.js";import{IkasCheckoutOption as i}from"./option/index.js";import{IkasCheckoutSettingsPrice as t}from"./price/index.js";var n=function(o){function n(e){var n,s,r=this;return(r=o.call(this,e)||this).giftPackagePriceList=null,r.isGiftPackageEnabled=null,r.isShowPostalCode=null,r.isTermsAndConditionsDefaultChecked=null,r.options=null,r.postalCodeRequirement=null,r.showCheckoutNote=null,r.giftPackagePriceList=(null===(n=e.giftPackagePriceList)||void 0===n?void 0:n.map((function(e){return new t(e)})))||null,r.identityNumberRequirement=e.identityNumberRequirement,r.isAccountRequired=e.isAccountRequired,r.isGiftPackageEnabled=e.isGiftPackageEnabled,r.isShowPostalCode=e.isShowPostalCode,r.isTermsAndConditionsDefaultChecked=e.isTermsAndConditionsDefaultChecked,r.options=(null===(s=e.options)||void 0===s?void 0:s.map((function(e){return new i(e)})))||null,r.phoneRequirement=e.phoneRequirement,r.postalCodeRequirement=e.postalCodeRequirement||null,r.showCheckoutNote=e.showCheckoutNote||null,r.showTermsAndConditionsCheckbox=e.showTermsAndConditionsCheckbox,r.storefrontId=e.storefrontId,r}return e(n,o),n}(o);export{n as IkasCheckoutSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=function(e){this.name=e.name,this.required=e.required};export{e as IkasCheckoutOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var r=function(r){this.currencyCode=r.currencyCode,this.currencySymbol=r.currencySymbol||null,this.price=r.price};export{r as IkasCheckoutSettingsPrice};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as e}from"../base/index.js";
|
|
1
|
+
import{__extends as t}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as e}from"../base/index.js";var o=function(e){function o(t){var o=e.call(this,t)||this;return o.cityCode=null,o.latitude=null,o.longitude=null,o.order=null,o.cityCode=t.cityCode,o.countryId=t.countryId,o.latitude=t.latitude,o.longitude=t.longitude,o.name=t.name,o.order=t.order,o.stateId=t.stateId,o}return t(o,e),o}(e);export{o as IkasCity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as n}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as
|
|
1
|
+
import{__extends as n}from'./../../../ext/tslib/tslib.es6.js';import{IkasBaseModel as l}from"../base/index.js";import{IkasHTMLMetaDataTranslations as t}from"./translations/index.js";var e,i=function(l){function e(n){var e,i=this;return(i=l.call(this,n)||this).canonicals=null,i.description=null,i.disableIndex=null,i.pageTitle=null,i.targetId=null,i.targetType=null,i.translations=null,i.canonicals=n.canonicals||null,i.description=n.description||null,i.disableIndex=n.disableIndex||null,i.pageTitle=n.pageTitle||null,i.slug=n.slug,i.targetId=n.targetId||null,i.targetType=n.targetType||null,i.translations=(null===(e=n.translations)||void 0===e?void 0:e.map((function(n){return new t(n)})))||null,i}return n(e,l),e}(l),s=function(n){this.language=null,this.storefrontId=null,this.storefrontRegionId=null,this.description=n.description,this.language=n.language||null,this.pageTitle=n.pageTitle,this.storefrontId=n.storefrontId||null,this.storefrontRegionId=n.storefrontRegionId||null};!function(n){n.BRAND="BRAND",n.CATEGORY="CATEGORY",n.PAGE="PAGE",n.PRODUCT="PRODUCT"}(e||(e={}));export{i as IkasHTMLMetaData,s as IkasHTMLMetaDataOverride,e as IkasHTMLMetaDataTargetType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var i=function(i){this.description=null,this.pageTitle=null,this.description=i.description||null,this.locale=i.locale,this.pageTitle=i.pageTitle||null};export{i as IkasHTMLMetaDataTranslations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasProductAttributeTableTemplate as t}from"./table-template/index.js";import{IkasProductAttributeOption as
|
|
1
|
+
import{IkasProductAttributeTableTemplate as t}from"./table-template/index.js";import{IkasProductAttributeOption as n}from"./option/index.js";import{IkasProductAttributeTranslation as i}from"./translation/index.js";export{IkasProductAttributeType}from"@ikas/storefront-models";var l=function(l){var e,o;this.description=null,this.options=null,this.tableTemplate=null,this.translations=null,this.id=l.id,this.name=l.name,this.description=l.description||null,this.type=l.type||null,this.options=(null===(e=l.options)||void 0===e?void 0:e.map((function(t){return new n(t)})))||null,this.tableTemplate=l.tableTemplate?new t(l.tableTemplate):null,this.translations=(null===(o=l.translations)||void 0===o?void 0:o.map((function(t){return new i(t)})))||null};export{l as IkasProductAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var i=function(i){this.id=i.id,this.name=i.name};export{i as IkasProductAttributeOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var n=function(n){this.name=null,this.id=n.id,this.name=n.name||null};export{n as IkasProductAttributeTableCell};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasProductAttributeTableCell as n}from"../table-cell/index.js";
|
|
1
|
+
import{IkasProductAttributeTableCell as n}from"../table-cell/index.js";var o=function(o){var l,i;this.columns=(null===(l=o.columns)||void 0===l?void 0:l.map((function(o){return new n(o)})))||null,this.rows=(null===(i=o.rows)||void 0===i?void 0:i.map((function(o){return new n(o)})))||null};export{o as IkasProductAttributeTableTemplate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var i=function(i){var t;this.description=null,this.name=null,this.options=null,this.description=i.description,this.locale=i.locale,this.name=i.name,this.options=(null===(t=i.options)||void 0===t?void 0:t.map((function(i){return new n(i)})))||null},n=function(i){this.name=null,this.id=i.id,this.name=i.name};export{n as IkasProductAttributeOptionTranslation,i as IkasProductAttributeTranslation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{IkasImage as e}from"../../image/index.js";import{IkasProductAttribute as i}from"../attribute/index.js";import{IkasProductAttributeOption as u}from"../attribute/option/index.js";import{IkasProductAttributeType as o}from"@ikas/storefront-models";import{makeAutoObservable as n}from"mobx";import{IkasProductAttributeValueFunctions as s}from"@ikas/storefront-model-functions";import d from"../../../../store/product/index.js";var l=function(){function l(t){var r;this.imageIds=null,this.productAttributeId=null,this.productAttributeOptionId=null,this.value=null,this.productAttribute=null,this.productAttributeOption=null,this.imageIds=t.imageIds,this.productAttributeId=t.productAttributeId,this.productAttributeOptionId=t.productAttributeOptionId,this.value=t.value||null,this.images=null===(r=t.images)||void 0===r?void 0:r.map((function(t){return new e(t)})),this.productAttribute=t.productAttribute?new i(t.productAttribute):null,this.productAttributeOption=t.productAttributeOption?new u(t.productAttributeOption):null,n(this)}return Object.defineProperty(l.prototype,"tableValue",{get:function(){return s.getTableValue(this.value)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"productIds",{get:function(){var t;if((null===(t=this.productAttribute)||void 0===t?void 0:t.type)!==o.PRODUCT||!this.value)return[];try{return JSON.parse(this.value)}catch(t){return console.error(t),[]}},enumerable:!1,configurable:!0}),l.prototype.getProducts=function(){var e,i;return t(this,void 0,void 0,(function(){var t,u;return r(this,(function(r){switch(r.label){case 0:if((null===(e=this.productAttribute)||void 0===e?void 0:e.type)!==o.PRODUCT||!this.value)return[2,[]];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,d.searchProducts({input:{productIdList:this.productIds}})];case 2:return t=r.sent(),[2,(null===(i=t.data)||void 0===i?void 0:i.data)||[]];case 3:return u=r.sent(),console.error(u),[2,[]];case 4:return[2]}}))}))},l}(),a=function(t){this.colId=t.colId,this.rowId=t.rowId,this.value=t.value
|
|
1
|
+
import{__awaiter as t,__generator as r}from'./../../../../ext/tslib/tslib.es6.js';import{IkasImage as e}from"../../image/index.js";import{IkasProductAttribute as i}from"../attribute/index.js";import{IkasProductAttributeOption as u}from"../attribute/option/index.js";import{IkasProductAttributeType as o}from"@ikas/storefront-models";import{makeAutoObservable as n}from"mobx";import{IkasProductAttributeValueFunctions as s}from"@ikas/storefront-model-functions";import d from"../../../../store/product/index.js";var l=function(){function l(t){var r;this.imageIds=null,this.productAttributeId=null,this.productAttributeOptionId=null,this.value=null,this.productAttribute=null,this.productAttributeOption=null,this.imageIds=t.imageIds,this.productAttributeId=t.productAttributeId,this.productAttributeOptionId=t.productAttributeOptionId,this.value=t.value||null,this.images=null===(r=t.images)||void 0===r?void 0:r.map((function(t){return new e(t)})),this.productAttribute=t.productAttribute?new i(t.productAttribute):null,this.productAttributeOption=t.productAttributeOption?new u(t.productAttributeOption):null,n(this)}return Object.defineProperty(l.prototype,"tableValue",{get:function(){return s.getTableValue(this.value)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"productIds",{get:function(){var t;if((null===(t=this.productAttribute)||void 0===t?void 0:t.type)!==o.PRODUCT||!this.value)return[];try{return JSON.parse(this.value)}catch(t){return console.error(t),[]}},enumerable:!1,configurable:!0}),l.prototype.getProducts=function(){var e,i;return t(this,void 0,void 0,(function(){var t,u;return r(this,(function(r){switch(r.label){case 0:if((null===(e=this.productAttribute)||void 0===e?void 0:e.type)!==o.PRODUCT||!this.value)return[2,[]];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,d.searchProducts({input:{productIdList:this.productIds}})];case 2:return t=r.sent(),[2,(null===(i=t.data)||void 0===i?void 0:i.data)||[]];case 3:return u=r.sent(),console.error(u),[2,[]];case 4:return[2]}}))}))},l}(),a=function(t){this.colId=t.colId,this.rowId=t.rowId,this.value=t.value},p=function(t){this.attribute=t.attribute,this.values=t.values.map((function(t){return new l(t)}))};export{a as IkasAttributeTableCellValue,p as IkasProductAttributeMap,l as IkasProductAttributeValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=function(e){this.customerLoginRequired=e.customerLoginRequired};export{e as IkasProductBackInStockSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t=function(t){this.baseAmount=t.baseAmount,this.type=t.type,this.unit=new i(t.unit)},i=function(t){this.id=t.id,this.name=t.name};export{t as IkasProductBaseUnit,i as IkasProductUnit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasCampaignApplicablePrice as e,IkasCampaignType as t}from"@ikas/storefront-models";export{IkasCampaignApplicablePrice,IkasCampaignCreatedFor,IkasCampaignType}from"@ikas/storefront-models";import{
|
|
1
|
+
import{IkasCampaignApplicablePrice as e,IkasCampaignType as t}from"@ikas/storefront-models";export{IkasCampaignApplicablePrice,IkasCampaignCreatedFor,IkasCampaignType}from"@ikas/storefront-models";import{IkasProductBuyXThenGetY as i}from"../product-buyx-then-gety/index.js";import{IkasProductCampaignDateRangeField as s}from"../product-campaign-date-range-field/index.js";import{IkasProductFixedDiscount as n}from"../product-fixed-discount/index.js";var a=function(a){this.applicableCustomerGroupIds=a.applicableCustomerGroupIds||null,this.applicableCustomerIds=a.applicableCustomerIds||null,this.applicablePrice=a.applicablePrice||e.DISCOUNT_PRICE,this.buyXThenGetY=a.buyXThenGetY?new i(a.buyXThenGetY):new i,this.canCombineWithOtherCampaigns=a.canCombineWithOtherCampaigns||!1,this.createdFor=a.createdFor||null,this.currencyCodes=a.currencyCodes||null,this.dateRange=a.dateRange?new s(a.dateRange):null,this.deleted=a.deleted||!1,this.fixedDiscount=a.fixedDiscount?new n(a.fixedDiscount):null,this.hasCoupon=a.hasCoupon||!1,this.id=a.id||"",this.includeDiscountedProducts=a.includeDiscountedProducts||null,this.salesChannelIds=a.salesChannelIds||null,this.title=a.title||"",this.type=a.type||t.BUY_X_THEN_GET_Y,this.usageCount=a.usageCount||0,this.usageLimit=a.usageLimit||null,this.usageLimitPerCustomer=a.usageLimitPerCustomer||null};export{a as IkasProductCampaignData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasCampaignFilterType as
|
|
1
|
+
import{IkasCampaignFilterType as t}from"@ikas/storefront-models";export{IkasCampaignFilterType}from"@ikas/storefront-models";var i=function(i){this.idList=(null==i?void 0:i.idList)||[],this.type=(null==i?void 0:i.type)||t.PRODUCT};export{i as IkasProductCampaignFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var a=function(a){this.campaign=a.campaign,this.variantIds=a.variantIds};export{a as IkasProductCampaign};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{IkasProductCampaignFilter as t}from"../filter/index.js";var i=function(i){void 0===i&&(i={}),this.amount=i.amount||0,this.applyByQuantity=i.applyByQuantity||!1,this.filter=i.filter?new t(i.filter):new t},e=function(i){void 0===i&&(i={}),this.amount=i.amount||0,this.discountRatio=i.discountRatio||0,this.filter=i.filter?new t(i.filter):new t},n=function(t){void 0===t&&(t={}),this.buyX=t.buyX?new i(t.buyX):new i,this.getY=t.getY?new e(t.getY):new e,this.maxUsagePerOrder=t.maxUsagePerOrder||0};export{i as IkasProductBuyX,n as IkasProductBuyXThenGetY,e as IkasProductGetY};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t=function(t){this.start=null,this.end=null,this.start=t.start||null,this.end=t.end||null};export{t as IkasProductCampaignDateRangeField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasProductCampaignFilter as n}from"../filter/index.js";
|
|
1
|
+
import{IkasProductCampaignFilter as n}from"../filter/index.js";var i=function(n){this.min=n.min||null,this.max=n.max||null},t=function(t){this.amount=t.amount||null,this.filters=t.filters?new n(t.filters):null,this.lineItemQuantityRange=t.lineItemQuantityRange?new i(t.lineItemQuantityRange):null,this.priceRange=t.priceRange?new i(t.priceRange):null};export{i as IkasCampaignMinMaxRangeField,t as IkasProductFixedDiscount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasImage as i}from"../../image/index.js";
|
|
1
|
+
import{IkasImage as i}from"../../image/index.js";var e=function(e){this.imageId=e.imageId||null,this.isMain=e.isMain||!1,this.isVideo=e.isVideo||!1,this.order=e.order,this.image=e.image?new i(e.image):null};export{e as IkasProductImage};
|
|
@@ -48,13 +48,13 @@ export declare class IkasProduct implements IProduct {
|
|
|
48
48
|
get isAddToCartEnabled(): boolean;
|
|
49
49
|
get groupedAttributeValues(): IkasProductAttributeMap[];
|
|
50
50
|
get selectedVariantUnitPriceText(): string | undefined;
|
|
51
|
-
selectVariantValue(variantValue: IkasVariantValue, disableRoute?: boolean)
|
|
52
|
-
getVariantUnitPriceText(variant: IkasProductVariant)
|
|
53
|
-
getCampaigns()
|
|
54
|
-
getCustomerReviews(params?: {
|
|
51
|
+
selectVariantValue: (variantValue: IkasVariantValue, disableRoute?: boolean) => void;
|
|
52
|
+
getVariantUnitPriceText: (variant: IkasProductVariant) => string | undefined;
|
|
53
|
+
getCampaigns: () => Promise<IkasProductCampaign[] | undefined>;
|
|
54
|
+
getCustomerReviews: (params?: {
|
|
55
55
|
limit?: number;
|
|
56
56
|
page?: number;
|
|
57
|
-
})
|
|
57
|
+
}) => Promise<IkasCustomerReviewList>;
|
|
58
58
|
private setOptionPrices;
|
|
59
59
|
}
|
|
60
60
|
export { IkasProductType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as t,__awaiter as e,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import r from"lodash/sortBy";import{IkasCategory as n}from"../category/index.js";import{IkasProductVariant as a}from"./variant/index.js";import{IkasProductAttributeValue as o}from"./attribute-value/index.js";import{IkasProductVariantType as s}from"./variant-type/index.js";import{IkasBrand as u}from"../brand/index.js";import{IkasHTMLMetaData as c}from"../html-meta-data/index.js";import{IkasProductTag as l}from"./tag/index.js";import{IkasProductType as
|
|
1
|
+
import{__spreadArray as t,__awaiter as e,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import r from"lodash/sortBy";import{IkasCategory as n}from"../category/index.js";import{IkasProductVariant as a}from"./variant/index.js";import{IkasProductAttributeValue as o}from"./attribute-value/index.js";import{IkasProductVariantType as s}from"./variant-type/index.js";import{IkasBrand as u}from"../brand/index.js";import{IkasHTMLMetaData as c}from"../html-meta-data/index.js";import{IkasProductTag as l}from"./tag/index.js";import{IkasProductType as d}from"@ikas/storefront-models";export{IkasProductType}from"@ikas/storefront-models";import{IkasProductOptionSet as p}from"./option-set/index.js";import{makeObservable as f,observable as m,computed as v}from"mobx";import{IkasProductFunctions as h}from"@ikas/storefront-model-functions";import{IkasProductCampaign as g}from"./campaign/index.js";import{IkasStorefrontConfig as b}from"@ikas/storefront-config";import{Analytics as y}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasBaseStore as V}from"../../../store/base.js";import P from"lodash/groupBy";import{IkasProductBaseUnit as j}from"./base-unit/index.js";import{formatCurrency as O}from"../../../utils/currency.js";import"lodash/get";import w from"../../../store/product/index.js";import{IkasCustomerReviewList as T}from"../../ui/customer-review-list/index.js";var I=function(){function I(h){void 0===h&&(h={});var P,I,S,x=this;this.metaData=null,this.brand=null,this.tags=null,this.productOptionSetId=null,this.productOptionSet=null,this.campaigns=null,this.selectedVariantValues=[],this.selectVariantValue=function(e,i){var r,n=x.metaData,a=x.selectedVariantValues.map((function(t){return t.variantTypeId===e.variantTypeId?e:t})),o=x.variants.find((function(t){return t.isActive&&a.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}));if(o)x.selectedVariantValues=a;else{var s=x.variantTypes.findIndex((function(t){return t.variantType.id===e.variantTypeId}));if(s>0){var u=x.variantTypes.slice(0,s),c=x.selectedVariantValues.filter((function(t){return u.some((function(e){return e.variantType.id===t.variantTypeId}))})),l=t(t([],c,!0),[e],!1);o=x.variants.find((function(t){return t.isActive&&l.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))}))}else{var d=a.slice(0,a.length-1);(o=x.variants.find((function(t){return t.isActive&&d.every((function(e){return t.variantValues.some((function(t){return t.id===e.id}))}))})))||(o=x.variants.find((function(t){return t.isActive&&t.variantValues.some((function(t){return t.id===e.id}))})))}if(!o)return;x.selectedVariantValues=o.variantValues}var p=x.variantTypes.map((function(t){var e=t.variantType,i=e.values.find((function(t){return x.selectedVariantValues.some((function(e){return e.id===t.id}))}));if(i)return"".concat(e.slug,"=").concat(i.slug)})).filter((function(t){return!!t})).join("&");if(!i){var f="/".concat(n.slug);if(p&&(f="/".concat(n.slug,"?").concat(p)),f===window.location.pathname)return;var m="production"!==process.env.NODE_ENV;null===(r=V.getInstance().router)||void 0===r||r.replace(f,void 0,{shallow:m,scroll:!1})}y.productView(x)},this.getVariantUnitPriceText=function(t){var e,i,r=t.price;if(r.unitPrice&&x.baseUnit)return"".concat(O(r.unitPrice,r.currency||"",r.currencySymbol||"")," / ").concat(null===(i=null===(e=x.baseUnit)||void 0===e?void 0:e.unit)||void 0===i?void 0:i.name)},this.getCampaigns=function(){return e(x,void 0,void 0,(function(){var t,e,r,n,a,o=this;return i(this,(function(i){switch(i.label){case 0:return t=V.getInstance(),e=t.customerStore.customer,r=e?e.customerGroupIds:null,n=this.variants.map((function(t){return t.id})),[4,w.getProductCampaigns({input:{customerGroupIds:r,salesChannelId:b.getSalesChannelId()||"",variantIds:n}})];case 1:return a=i.sent(),this.campaigns=a.data,this.campaigns?(this.campaigns.map((function(t){o.variants.map((function(e){var i;t.variantIds.some((function(t){return t===e.id}))&&(null===(i=e.campaigns)||void 0===i||i.push(t))}))})),[2,this.campaigns]):[2]}}))}))},this.getCustomerReviews=function(t){return e(x,void 0,void 0,(function(){var e;return i(this,(function(i){switch(i.label){case 0:return[4,(e=new T({productId:this.id,limit:null==t?void 0:t.limit,page:null==t?void 0:t.page})).getInitial()];case 1:return i.sent(),[2,e]}}))}))},this.setOptionPrices=function(){var t,e=x.variants[0];if(e){var i=e.price.currency;null===(t=x.productOptionSet)||void 0===t||t.options.forEach((function(t){var e;t.selectSettings&&t.selectSettings.values.forEach((function(t){var e;t.otherPrices&&(t.price=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.price)})),t.otherPrices&&(t.price=(null===(e=t.otherPrices.find((function(t){return t.currencyCode===i})))||void 0===e?void 0:e.price)||t.price)}))}},this.id=h.id||Date.now()+"",this.name=h.name||"",this.type=h.type||d.PHYSICAL,this.description=h.description||"",this.shortDescription=h.shortDescription||"",this.metaData=h.metaData?new c(h.metaData):null,this.brand=h.brand?new u(h.brand):null,this.categories=h.categories?h.categories.map((function(t){return new n(t)})):[],this.tags=h.tags?h.tags.map((function(t){return new l(t)})):[],this.variants=h.variants?h.variants.map((function(t){return new a(t)})):[],this.attributes=h.attributes?h.attributes.map((function(t){return new o(t)})):[],this.variantTypes=h.variantTypes?h.variantTypes.map((function(t){return new s(t)})):[],this.productOptionSetId=h.productOptionSetId||null,this.averageRating=null!==(P=h.averageRating)&&void 0!==P?P:null,this.reviewCount=null!==(I=h.reviewCount)&&void 0!==I?I:null,this.baseUnit=h.baseUnit?new j(h.baseUnit):null,this.productOptionSet=h.productOptionSet?new p(h.productOptionSet):null,this.campaigns=(null===(S=h.campaigns)||void 0===S?void 0:S.map((function(t){return new g(t)})))||null,this.selectedVariantValues=h.selectedVariantValues||[],this.variantTypes=r(this.variantTypes,"order"),this.setOptionPrices(),f(this,{selectedVariantValues:m,hasVariant:v,hasStock:v,hasValidProductOptionValues:v,href:v,productHref:v,mainVariantType:v,mainVariantValue:v,selectedVariant:v,displayedVariantTypes:v,isCustomerReviewEnabled:v,isCustomerReviewLoginRequired:v,isAddToCartEnabled:v,groupedAttributeValues:v,selectedVariantUnitPriceText:v})}return Object.defineProperty(I.prototype,"hasVariant",{get:function(){return h.hasVariant(this)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasStock",{get:function(){return h.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasValidProductOptionValues",{get:function(){return!this.productOptionSet||this.productOptionSet.hasValidValues},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"href",{get:function(){return h.getSelectedVariantHref(this,this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"productHref",{get:function(){return h.getProductHref(this)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"mainVariantType",{get:function(){return h.getMainVariantType(this)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"mainVariantValue",{get:function(){return h.getMainVariantValue(this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"selectedVariant",{get:function(){if(!this.hasVariant)return this.variants[0];var t=this.selectedVariantValues.map((function(t){return t.id}));return this.variants.find((function(e){return e.variantValues.every((function(e){return t.includes(e.id)}))}))},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"displayedVariantTypes",{get:function(){return h.getDisplayedVariantTypes(this,this.selectedVariantValues)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isCustomerReviewEnabled",{get:function(){return b.isCustomerReviewEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isCustomerReviewLoginRequired",{get:function(){return b.isCustomerReviewLoginRequired()},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isAddToCartEnabled",{get:function(){return this.hasValidProductOptionValues&&(this.selectedVariant.hasStock||this.selectedVariant.sellIfOutOfStock)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"groupedAttributeValues",{get:function(){var t,e=P(this.attributes,"productAttributeId");return(null===(t=this.attributes)||void 0===t?void 0:t.map((function(t){var i=t.productAttributeId;if(i){var r=e[i];return(null==r?void 0:r.length)&&r[0].productAttribute?{attribute:r[0].productAttribute,values:r}:void 0}})).filter((function(t){return!!t})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"selectedVariantUnitPriceText",{get:function(){return this.getVariantUnitPriceText(this.selectedVariant)},enumerable:!1,configurable:!0}),I}();export{I as IkasProduct};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i,__assign as n}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import{IkasProductOption as e}from"./option/index.js";import{IkasProductOptionSetFunctions as
|
|
1
|
+
import{__awaiter as t,__generator as i,__assign as n}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}from"mobx";import{IkasProductOption as e}from"./option/index.js";import{IkasProductOptionSetFunctions as r}from"@ikas/storefront-model-functions";var s=function(t){this.id=t.id||"",this.value=t.value||null},u=function(t){var i;this.id=t.id||"",this.name=t.name||null,this.optionalText=t.optionalText||null,this.values=(null===(i=t.values)||void 0===i?void 0:i.map((function(t){return new s(t)})))||[]},l=function(t){var i;this.locale=t.locale||"",this.options=(null===(i=t.options)||void 0===i?void 0:i.map((function(t){return new u(t)})))||[]},a=function(){function s(r){var s,u,a=this;this.initOptionValues=function(){return t(a,void 0,void 0,(function(){return i(this,(function(t){return this.options.forEach((function(t){return t.initValues()})),[2]}))}))},this.id=r.id||"",this.name=r.name||"",this.options=(null===(s=r.options)||void 0===s?void 0:s.map((function(t){return new e(n(n({},t),{productOptionSetId:a.id}))})))||[],this.translations=r.translations?null===(u=r.translations)||void 0===u?void 0:u.map((function(t){return new l(t)})):null,this.initOptionValues(),o(this)}return Object.defineProperty(s.prototype,"displayedOptions",{get:function(){return r.getDisplayedOptions(this)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasValidValues",{get:function(){return this.displayedOptions.every((function(t){return t.hasValidValues}))},enumerable:!1,configurable:!0}),s}();export{s as IkasProductOptionSelectValueTranslations,a as IkasProductOptionSet,l as IkasProductOptionSetTranslations,u as IkasProductOptionTranslations};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as i}from'./../../../../../ext/tslib/tslib.es6.js';import{IkasProductOptionSelectType as e,IkasProductOptionType as n}from"@ikas/storefront-models";export{IkasProductOptionSelectType,IkasProductOptionType}from"@ikas/storefront-models";import{makeAutoObservable as l}from"mobx";import{IkasImage as s}from"../../../image/index.js";import o from"lodash/sortBy";import{IkasProductOptionFunctions as a}from"@ikas/storefront-model-functions";import{uploadFile as r,getProductOptionFileUrl as u}from"@ikas/storefront-api";var
|
|
1
|
+
import{__awaiter as t,__generator as i}from'./../../../../../ext/tslib/tslib.es6.js';import{IkasProductOptionSelectType as e,IkasProductOptionType as n}from"@ikas/storefront-models";export{IkasProductOptionSelectType,IkasProductOptionType}from"@ikas/storefront-models";import{makeAutoObservable as l}from"mobx";import{IkasImage as s}from"../../../image/index.js";import o from"lodash/sortBy";import{IkasProductOptionFunctions as a}from"@ikas/storefront-model-functions";import{uploadFile as r,getProductOptionFileUrl as u}from"@ikas/storefront-api";var d=function(t){this.currencyCode=t.currencyCode,this.price=t.price},h=function(t){void 0===t&&(t={}),this.id=t.id||"",this.order=t.order||0,this.value=t.value||"",this.price=t.price||null,this.otherPrices=t.otherPrices||null,this.thumbnailImageId=t.thumbnailImageId||null,this.colorCode=t.colorCode||null,this.thumbnailImage=t.thumbnailImage?new s(t.thumbnailImage):t.thumbnailImageId?new s({id:t.thumbnailImageId,isVideo:!1}):null},c=function(t){var i;void 0===t&&(t={}),this.type=t.type||e.BOX,this.minSelect=null!==t.minSelect&&void 0!==t.minSelect?t.minSelect:null,this.maxSelect=null!==t.maxSelect&&void 0!==t.maxSelect?t.maxSelect:null,this.values=o((null===(i=t.values)||void 0===i?void 0:i.map((function(t){return new h(t)})))||[],"order")},m=function(t){this.min=t.min||null,this.max=t.max||null,this.minRelativeNextDate=void 0!==t.minRelativeNextDate?t.minRelativeNextDate:null,this.maxRelativeNextDate=void 0!==t.maxRelativeNextDate?t.maxRelativeNextDate:null},p=function(t){void 0===t&&(t={}),this.min=null!==t.min&&void 0!==t.min?t.min:null,this.max=null!==t.max&&void 0!==t.max?t.max:null},f=function(t){this.allowedExtensions=t.allowedExtensions||null,this.minQuantity=null!==t.minQuantity&&void 0!==t.minQuantity?t.minQuantity:null,this.maxQuantity=null!==t.maxQuantity&&void 0!==t.maxQuantity?t.maxQuantity:null},v=function(){function e(s){var o=this;this._values=[],this._childOptions=[],this.productOptionFileUpload=function(e){return t(o,void 0,void 0,(function(){var t,n,l,s,o,a=this;return i(this,(function(i){switch(i.label){case 0:return 0===e.length||this.fileSettings&&this.fileSettings.maxQuantity&&this.fileSettings.maxQuantity<e.length?[2,[]]:[4,Promise.all(e.map((function(t){return u({fileName:t.name,productOptionSetId:a.productOptionSetId,productOptionId:a.id},t)})))];case 1:t=i.sent().filter((function(t){return t.data})),n=[],l=0,s=t,i.label=2;case 2:return l<s.length?(o=s[l],[4,r(o.data,o.data.file)]):[3,5];case 3:i.sent()&&n.push(o.data.optionUrl),i.label=4;case 4:return l++,[3,2];case 5:return[2,n]}}))}))},this.initValues=function(){o.isOptional||(o.values=[],o.childOptions&&o.childOptions.forEach((function(t){return t.initValues()})))},this.id=s.id||"",this.productOptionSetId=s.productOptionSetId||"",this.name=s.name||"",this.order=s.order||0,this.type=s.type||n.CHOICE,this.selectSettings=s.selectSettings?new c(s.selectSettings||{}):null,this.textSettings=s.textSettings?new p(s.textSettings||{}):null,this.fileSettings=s.fileSettings?new f(s.fileSettings||{}):null,this.dateSettings=s.dateSettings?new m(s.dateSettings||{}):null,this.price=s.price||null,this.otherPrices=s.otherPrices||null,this.isOptional=s.isOptional||!1,this.optionalText=s.optionalText||null,this.requiredOptionId=s.requiredOptionId||null,this.requiredOptionValueIds=s.requiredOptionValueIds||null,this.values=s.values||[],this.childOptions=s.childOptions?s.childOptions.map((function(t){return new e(t)})):[],l(this)}return Object.defineProperty(e.prototype,"displayedChildOptions",{get:function(){return a.getDisplayedChildOptions(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasValidValues",{get:function(){return a.hasValidValues(this)&&this.displayedChildOptions.every((function(t){return t.hasValidValues}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){return this._values},set:function(t){this._values=t,t.length||this.childOptions.forEach((function(t){return t.values=[]}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childOptions",{get:function(){return this._childOptions},set:function(t){this._childOptions=t},enumerable:!1,configurable:!0}),e}();export{v as IkasProductOption,m as IkasProductOptionDateSettings,f as IkasProductOptionFileSettings,d as IkasProductOptionOtherPrice,c as IkasProductOptionSelectSettings,h as IkasProductOptionSelectValue,p as IkasProductOptionTextSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var i=function(i){this.id=i.id,this.name=i.name};export{i as IkasProductTag};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{IkasProductPrice as i}from"./price/index.js";import{IkasVariantValue as r}from"../../variant-type/variant-value/index.js";import{IkasProductAttributeValue as n}from"../attribute-value/index.js";import{IkasProductImage as o}from"../image/index.js";import{
|
|
1
|
+
import{__awaiter as t,__generator as e}from'./../../../../ext/tslib/tslib.es6.js';import{IkasProductPrice as i}from"./price/index.js";import{IkasVariantValue as r}from"../../variant-type/variant-value/index.js";import{IkasProductAttributeValue as n}from"../attribute-value/index.js";import{IkasProductImage as o}from"../image/index.js";import{IkasProductVariantFunctions as a}from"@ikas/storefront-model-functions";import{IkasStorefrontConfig as s}from"@ikas/storefront-config";import{saveProductBackInStockRemind as u,listProductBackInStockRemind as c}from"@ikas/storefront-api";import d from"lodash/groupBy";import p from"lodash/sortBy";import{IkasProductVariantUnit as m}from"./unit/index.js";var f=function(){function f(t){void 0===t&&(t={}),this._backInStockReminderSaved=!1,this.id=t.id||Date.now()+"",this.productId=t.productId||"",this.sku=t.sku||null,this.barcodeList=t.barcodeList||[],this.variantValues=t.variantValues?t.variantValues.map((function(t){return new r(t)})):[],this.images=t.images?t.images.map((function(t){return new o(t)})):[],this.attributes=t.attributes?t.attributes.map((function(t){return new n(t)})):[],this.price=t.price?new i(t.price):new i,this.stock=t.stock||0,this.isActive=void 0===t.isActive||t.isActive,this.campaigns=t.campaigns||[],this.unit=t.unit?new m(t.unit):null,this.sellIfOutOfStock=t.sellIfOutOfStock||!1,this.images=p(this.images,"order")}return Object.defineProperty(f.prototype,"mainImage",{get:function(){var t=a.getMainImage(this);return t?new o(t):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hasStock",{get:function(){return a.hasStock(this)},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isBackInStockEnabled",{get:function(){return s.isBackInStockEnabled()},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isBackInStockCustomerLoginRequired",{get:function(){return s.isCustomerLoginRequiredForBackInStock()},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isBackInStockReminderSaved",{get:function(){return this._backInStockReminderSaved},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"groupedAttributeValues",{get:function(){var t,e=d(this.attributes,"productAttributeId");return(null===(t=this.attributes)||void 0===t?void 0:t.map((function(t){var i=t.productAttributeId;if(i){var r=e[i];return(null==r?void 0:r.length)&&r[0].productAttribute?{attribute:r[0].productAttribute,values:r}:void 0}})).filter((function(t){return!!t})))||[]},enumerable:!1,configurable:!0}),f.prototype.saveBackInStockReminder=function(i){var r;return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,c({email:{eq:i},productId:{eq:this.productId},variantId:{eq:this.id}})];case 1:return(t=e.sent())&&(null===(r=t.data)||void 0===r?void 0:r.length)?(this._backInStockReminderSaved=!0,[2,!1]):[3,2];case 2:return[4,u({input:{email:i,productId:this.productId,variantId:this.id}})];case 3:return e.sent().isSuccess?(this._backInStockReminderSaved=!0,[2,!0]):(this._backInStockReminderSaved=!1,[2,!1]);case 4:return[2]}}))}))},f}();export{f as IkasProductVariant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasProductPriceFunctions as e}from"@ikas/storefront-model-functions";import{
|
|
1
|
+
import{IkasProductPriceFunctions as e}from"@ikas/storefront-model-functions";import{formatCurrency as r}from"../../../../../utils/currency.js";var t=function(){function t(e){var r,t,i,n,u,c,o;this.buyPrice=null,this.currency=null,this.currencySymbol=null,this.discountPrice=null,this.priceListId=null,this.unitPrice=null,this.buyPrice=null!==(r=null==e?void 0:e.buyPrice)&&void 0!==r?r:null,this.currency=null!==(t=null==e?void 0:e.currency)&&void 0!==t?t:null,this.currencySymbol=null!==(i=null==e?void 0:e.currencySymbol)&&void 0!==i?i:"",this.discountPrice=null!==(n=null==e?void 0:e.discountPrice)&&void 0!==n?n:null,this.priceListId=null!==(u=null==e?void 0:e.priceListId)&&void 0!==u?u:null,this.sellPrice=null!==(c=null==e?void 0:e.sellPrice)&&void 0!==c?c:0,this.unitPrice=null!==(o=null==e?void 0:e.unitPrice)&&void 0!==o?o:null}return Object.defineProperty(t.prototype,"finalPrice",{get:function(){return e.getFinalPrice(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"formattedFinalPrice",{get:function(){return r(this.finalPrice,this.currency||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"formattedBuyPrice",{get:function(){return r(this.buyPrice||0,this.currency||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"formattedDiscountPrice",{get:function(){return r(this.discountPrice||0,this.currency||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"formattedSellPrice",{get:function(){return r(this.sellPrice||0,this.currency||"",this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasDiscount",{get:function(){return e.hasDiscount(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"discountAmount",{get:function(){return e.getDiscountAmount(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"discountPercentage",{get:function(){return e.getDiscountPercentage(this)},enumerable:!1,configurable:!0}),t}();export{t as IkasProductPrice};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t=function(t){this.amount=t.amount,this.type=t.type};export{t as IkasProductVariantUnit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasVariantType as
|
|
1
|
+
import{IkasVariantType as a}from"../../variant-type/index.js";var r=function(r){this.order=r.order||0,this.variantType=r.variantType?new a(r.variantType):new a,this.variantValueIds=r.variantValueIds||[]};export{r as IkasProductVariantType};
|