@ikas/storefront 2.0.6 → 2.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.
@@ -1 +1 @@
1
- import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
1
+ import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
@@ -1 +1 @@
1
- import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
1
+ import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
@@ -21,12 +21,14 @@ export default class IkasPageEditorViewModel {
21
21
  get pageComponents(): IkasThemePageComponent[];
22
22
  get selectedPageComponent(): IkasThemePageComponent | undefined;
23
23
  get selectedComponent(): IkasThemeComponent | undefined;
24
+ createLoadingListener(): void;
24
25
  startMessaging: () => void;
25
26
  onMessage: (event: MessageEvent) => Promise<void>;
26
27
  onClick: (id: string) => void;
27
28
  onMouseOver: (id: string) => void;
28
29
  onMouseLeave: (id: string) => void;
29
30
  onPageChange: (url: string) => Promise<void>;
31
+ onLoadingChange: () => void;
30
32
  getVariantIdFromParams(productId: string, queryParamsStr: string): Promise<string | undefined>;
31
33
  sendMessage: (type: BridgeMessageType, data?: any) => void;
32
34
  getPagePropValues: (theme: IkasTheme, pageType: IkasThemePageType, pageParams: Record<string, any>) => Promise<IkasPageDataProvider>;
@@ -66,5 +68,6 @@ export declare enum BridgeMessageType {
66
68
  SET_HOVERED_COMPONENT = "SET_HOVERED_COMPONENT",
67
69
  SCROLL_TO_COMPONENT = "SCROLL_TO_COMPONENT",
68
70
  UPDATE_THEME_SETTINGS = "UPDATE_THEME_SETTINGS",
69
- EDITOR_PAGE_CHANGE = "EDITOR_PAGE_CHANGE"
71
+ EDITOR_PAGE_CHANGE = "EDITOR_PAGE_CHANGE",
72
+ EDITOR_LOADING_CHANGE = "EDITOR_LOADING_CHANGE"
70
73
  }
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i,runInAction as n}from"mobx";import{IkasBlogMetadataTargetType as o}from"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import{IkasHTMLMetaDataTargetType as a}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import{IkasTheme as r}from"../../models/theme/theme.js";import{IkasThemePageType as s}from"../../models/theme/page/index.js";import{IkasThemePageComponent as d}from"../../models/theme/page/component/index.js";import{IkasThemeComponent as p}from"../../models/theme/component/index.js";import{IkasThemeComponentPropType as u}from"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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/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{IkasThemeSettings as l}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasPageDataProvider as c}from"../../providers/page-data-get.js";import{IkasPageDataInit as m}from"../../providers/page-data-init.js";import{IkasBlogAPI as h}from"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import"../../api/checkout/index.js";import"../../api/city/index.js";import"../../api/country/index.js";import"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/district/index.js";import{IkasHTMLMetaDataAPI as g}from"../../api/html-meta-data/index.js";import"../../api/merchant/index.js";import{IkasProductSearchAPI as f}from"../../api/product-search/index.js";import{apollo as E}from"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import"../../api/product-option-set/index.js";import{IkasRaffleAPI as P}from"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import{IkasStorefrontConfig as v}from"../../storefront/index.js";import{IkasStorefront as O}from"../../models/data/storefront/index.js";import T from'../../ext/uuid/dist/esm-browser/v4.js';var C,_=function(){function _(f){var _=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.startMessaging=function(){window.addEventListener("message",_.onMessage,!1),_.sendMessage(C.FRAME_DID_LOAD,"2.0.0")},this.onMessage=function(i){return e(_,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:switch(e=i.data.type,n=i.data.data,e){case C.UPDATE_FRAME_DATA:return[3,1];case C.UPDATE_THEME_JSON:return[3,3];case C.UPDATE_PROP_VALUE:return[3,5];case C.UPDATE_PAGE_PARAMS:return[3,7];case C.UPDATE_PAGE_COMPONENT_ORDER:return[3,9];case C.ADD_COMPONENT:return[3,11];case C.DELETE_COMPONENT:return[3,12];case C.UPDATE_COMPONENT:return[3,13];case C.ADD_PAGE_COMPONENT:return[3,14];case C.DELETE_PAGE_COMPONENT:return[3,16];case C.SET_SELECTED_COMPONENT:return[3,17];case C.SET_HOVERED_COMPONENT:return[3,18];case C.SCROLL_TO_COMPONENT:return[3,19];case C.UPDATE_THEME_SETTINGS:return[3,20]}return[3,21];case 1:return[4,this.handleUpdateFrameData(n)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,22];case 3:return[4,this.handleUpdateThemeJson(n)];case 5:return[4,this.handleUpdatePropValue(n)];case 7:return[4,this.handleUpdatePageParams(n)];case 9:return[4,this.handleUpdatePageComponentOrder(n)];case 11:return this.handleAddNewComponent(n),[3,22];case 12:return this.handleDeleteComponent(n),[3,22];case 13:return this.handleUpdateComponent(n),[3,22];case 14:return[4,this.handleAddNewPageComponent(n)];case 16:return this.handleDeletePageComponent(n),[3,22];case 17:return this.handleSetSelectedComponent(n),[3,22];case 18:return this.handleSetHoveredComponent(n),[3,22];case 19:return this.handleScrollToComponent(n),[3,22];case 20:return this.updateThemeSettings(n),[3,22];case 21:return[3,22];case 22:return[2]}}))}))},this.onClick=function(e){_.sendMessage(C.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){_.sendMessage(C.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){_.sendMessage(C.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(i){return e(_,void 0,void 0,(function(){var e,r,d,p,u,l,c,m,f,E=this;return t(this,(function(t){switch(t.label){case 0:return e=i.slice(1),r=e.split("?"),e=r[0],d=r[1],this.pageParams={},i.startsWith("/account/orders/")?p=s.ORDER_DETAIL:i.startsWith("/account/orders")?p=s.ORDERS:i.startsWith("/account/addresses")?p=s.ADDRESSES:i.startsWith("/account/favorite-products")?p=s.FAVORITE_PRODUCTS:i.startsWith("/account/forgot-password")?p=s.FORGOT_PASSWORD:i.startsWith("/account/login")?p=s.LOGIN:i.startsWith("/account/raffles")?p=s.RAFFLE_ACCOUNT:i.startsWith("/account/recover-password")?p=s.RECOVER_PASSWORD:i.startsWith("/account/register")?p=s.REGISTER:i.startsWith("/account")?p=s.ACCOUNT:i.startsWith("/blog/")?p=s.BLOG:i.startsWith("/blog")?p=s.BLOG_INDEX:i.startsWith("/pages")?(p=s.CUSTOM,this.pageParams={slug:e.split("/")[1]}):p=i.startsWith("/raffle/")?s.RAFFLE_DETAIL:i.startsWith("/raffle")?s.RAFFLE:i.startsWith("/404")?s.NOT_FOUND:i.startsWith("/cart")?s.CART:i.startsWith("/checkout")?s.CHECKOUT:"/"===i?s.INDEX:i.startsWith("/search")?s.SEARCH:s.PRODUCT,p!==s.PRODUCT?[3,6]:[4,g.listHTMLMetaData(e)];case 1:return(l=t.sent()).length?(c=l[0]).targetType!==a.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(c.targetId,d)]:[3,5];case 2:return u=t.sent(),this.pageParams={productId:c.targetId,variantId:u,slug:e},[3,4];case 3:if(c.targetType===a.CATEGORY)p=s.CATEGORY,this.pageParams={categoryId:c.targetId,slug:e};else{if(c.targetType!==a.BRAND)return[2];p=s.BRAND,this.pageParams={brandId:c.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return p!==s.BLOG?[3,8]:[4,h.listBlogMetaData(e)];case 7:if(!(l=t.sent()).length)return[2];if((c=l[0]).targetType===o.BLOG)this.pageParams={blogId:c.targetId,slug:e};else{if(c.targetType!==o.BLOG_CATEGORY)return[2];p=s.BLOG_CATEGORY,this.pageParams={blogCategoryId:c.targetId,slug:e}}t.label=8;case 8:return p!==s.RAFFLE_DETAIL?[3,10]:[4,P.listRaffleMetaData(e)];case 9:if(!(l=t.sent()).length)return[2];c=l[0],this.pageParams={raffleId:c.targetId,slug:e},t.label=10;case 10:return[4,this.getPagePropValues(this.theme,p,this.pageParams)];case 11:return m=t.sent(),n((function(){var e,t;v.store.currentPageType=p,E.pageDataProvider=m,p===s.CUSTOM?E.page=null===(e=E.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===p&&e.slug===E.pageParams.slug})):E.page=null===(t=E.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(C.EDITOR_PAGE_CHANGE,{pageType:p,pageParams:this.pageParams,pageSpecificData:(null===(f=this.pageDataProvider)||void 0===f?void 0:f.pageSpecificData)||null}),[2]}}))}))},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(i,n,o){return e(_,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new c(i,o,n),(o.blogId||o.blogCategoryId)&&(e.possiblePageTypes=[s.BLOG,s.BLOG_CATEGORY]),o.raffleId&&(e.possiblePageTypes=[s.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(m.setPageSpecificData(JSON.stringify(e.pageSpecificData),n,!0),n===s.PRODUCT&&m.pageSpecificData&&(a=m.pageSpecificData,(r=a.product.variants.find((function(e){return e.id===o.variantId})))&&(a.selectedVariantValues=r.variantValues))):m.pageSpecificData=void 0,e.pageComponentPropValues=m.initPropValues(JSON.stringify(e.pageComponentPropValues),this.router,JSON.stringify(i.settings),!1),[2,e]}}))}))},this.setComponentRef=function(e,t){_.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),i=t.top,n=t.bottom;return i<window.innerHeight&&n>=0&&n<window.innerHeight&&i>0},this.handleUpdateFrameData=function(i){return e(_,void 0,void 0,(function(){var e,n,o,a,s,d=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new r(i.theme),this.page=this.theme.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.page?((e=i.storefront)&&(n=new O(e),o=n.routings.find((function(e){return e.locale===d.locale})),v.storefrontId=n.id,v.storefrontRoutingId=null==o?void 0:o.id,n.mainStorefrontThemeId&&(v.storefrontThemeId=n.mainStorefrontThemeId),n.salesChannelId&&(v.salesChannelId=n.salesChannelId),(null==o?void 0:o.priceListId)?v.priceListId=o.priceListId:v.priceListId=void 0,v.routings=n.routings,v.stockPreference=this.theme.settings.stockPreference),this.translations&&(v.translations=this.translations),v.isEditor=!0,E.createApolloClient(this.apiKey||void 0),window.editorApiKey=i.apiKey,a=T(),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.handleUpdateThemeJson=function(i){return e(_,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new r(i.theme),[2]}))}))},this.handleUpdatePropValue=function(i){return e(_,void 0,void 0,(function(){var e,o,a,r,s,d,p,l,c=this;return t(this,(function(t){switch(t.label){case 0:return e=i.propName,o=i.value,(a=null===(p=null===(d=this.selectedComponent)||void 0===d?void 0:d.props)||void 0===p?void 0:p.find((function(t){return t.name===e})))&&this.selectedPageComponent?(r=null===(l=this.pageDataProvider)||void 0===l?void 0:l.pageComponentPropValues.find((function(e){return e.pageComponent.id===c.selectedPageComponentId})),this.selectedPageComponent.propValues[e]=o,this.pageDataProvider?[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,a)]:[2]):[2];case 1:return s=t.sent(),[4,this.pageDataProvider.setLinkSlugs()];case 2:return t.sent(),n((function(){r&&(r.propValues[e]=s,a.type===u.CUSTOM?m.initCustomDataPropValue(a,s,r,c.router,c.theme.settings,!0):a.type===u.COMPONENT?m.initComponentPropValue(a,s,r,c.router,c.theme.settings,!0):a.type===u.COMPONENT_LIST?m.initComponentListPropValue(a,s,r,c.router,c.theme.settings,!0):a.type===u.PRODUCT_DETAIL?m.initProductDetailPropValue(a,s,r,c.router):a.type===u.CATEGORY?m.initCategoryPropValue(a,s,r):a.type===u.BRAND?m.initBrandPropValue(a,s,r):a.type===u.BLOG?m.initBlogPropValue(a,s,r):a.type===u.BLOG_CATEGORY?m.initBlogCategoryPropValue(a,s,r):a.type===u.RAFFLE?m.initRafflePropValue(a,s,r):a.type!==u.LINK&&a.type!==u.LIST_OF_LINK||m.initLinkPropValue(a,s,r))})),[2]}}))}))},this.handleUpdatePageParams=function(i){return e(_,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(_,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=i.pageComponents.map((function(e){return new d(e)})):this.page.components=i.pageComponents.map((function(e){return new d(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,i=new p(e.component);null===(t=_.theme)||void 0===t||t.components.push(i)},this.handleDeleteComponent=function(e){var t,i;(null===(t=_.theme)||void 0===t?void 0:t.components)&&(_.theme.components=_.theme.components.filter((function(t){return t.id!==e.componentId})));var n=_.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];_.specification&&_.specification.components&&(_.specification.components=n),!_.specification&&(null===(i=_.page)||void 0===i?void 0:i.components)&&(_.page.components=n)},this.handleUpdateComponent=function(e){var t=_.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(_.theme.components[t]=new p(e.component))},this.handleAddNewPageComponent=function(i){return e(_,void 0,void 0,(function(){var e,o,a=this;return t(this,(function(t){switch(t.label){case 0:return e=new d(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((function(){o.component.props.filter((function(e){return e.type===u.CUSTOM})).forEach((function(e){m.initCustomDataPropValue(e,o.propValues[e.name],o,a.router,a.theme.settings,!0)})),a.pageDataProvider.pageComponentPropValues.push(o),a.pageComponents.push(e)})),[2]}}))}))},this.handleDeletePageComponent=function(e){_.specification?_.specification.components=_.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):_.page.components=_.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){_.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){_.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,i=_.componentRefs[t];i&&(_.isScrolledIntoView(i)||window.scrollTo({top:i.offsetTop,behavior:"smooth"}))},this.updateThemeSettings=function(e){var t=e.settings;_.theme&&(_.theme.settings=new l(t))},this.router=f,i(this),this.startMessaging()}return Object.defineProperty(_.prototype,"specification",{get:function(){var e,t,i,n,o,a,r,d=this,p=this.page;return(null==p?void 0:p.type)===s.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)===s.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)===s.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)===s.BLOG&&(r=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.blogId)}))),(null==p?void 0:p.type)===s.BLOG_CATEGORY&&(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.blogCategoryId)}))),(null==p?void 0:p.type)===s.RAFFLE_DETAIL&&(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.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(_.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(_.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(_.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}),_.prototype.getVariantIdFromParams=function(i,n){return e(this,void 0,void 0,(function(){var e,o,a,r,s,d,p;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+n),[4,f.searchProducts({productIdList:[i],priceListId:v.priceListId,salesChannelId:v.salesChannelId})];case 1:return(null==(o=t.sent())?void 0:o.data.length)?(a=o.data[0],r=a.variantTypes.map((function(e){return e.variantType.slug})),s=[],r.forEach((function(t,i){var n=a.variantTypes[i],o=e.get(t);if(o){var r=n.variantType.values.find((function(e){return e.slug===o}));r&&s.push(r)}})),(d=a.variants.find((function(e){return e.variantValues.every((function(e){return s.some((function(t){return t.id===e.id}))}))})))?[2,d.id]:[3,3]):[2];case 2:return p=t.sent(),console.error(p),[3,3];case 3:return[2]}}))}))},_}();!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"}(C||(C={}));export{C as BridgeMessageType,_ as default};
1
+ import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import{reaction as n,makeAutoObservable as i,runInAction as o}from"mobx";import{IkasBlogMetadataTargetType as a}from"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import{IkasHTMLMetaDataTargetType as r}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import{IkasTheme as s}from"../../models/theme/theme.js";import{IkasThemePageType as d}from"../../models/theme/page/index.js";import{IkasThemePageComponent as p}from"../../models/theme/page/component/index.js";import{IkasThemeComponent as u}from"../../models/theme/component/index.js";import{IkasThemeComponentPropType as c}from"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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/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{IkasThemeSettings as l}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasPageDataProvider as m}from"../../providers/page-data-get.js";import{IkasPageDataInit as h}from"../../providers/page-data-init.js";import{IkasBlogAPI as g}from"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import"../../api/checkout/index.js";import"../../api/city/index.js";import"../../api/country/index.js";import"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/district/index.js";import{IkasHTMLMetaDataAPI as f}from"../../api/html-meta-data/index.js";import"../../api/merchant/index.js";import{IkasProductSearchAPI as E}from"../../api/product-search/index.js";import{apollo as P}from"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import"../../api/product-option-set/index.js";import{IkasRaffleAPI as v}from"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import{IkasStorefrontConfig as O}from"../../storefront/index.js";import{IkasStorefront as T}from"../../models/data/storefront/index.js";import C from'../../ext/uuid/dist/esm-browser/v4.js';var _,D=function(){function D(n){var E=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.startMessaging=function(){window.addEventListener("message",E.onMessage,!1),E.sendMessage(_.FRAME_DID_LOAD,"2.0.0"),E.createLoadingListener()},this.onMessage=function(n){return e(E,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:switch(e=n.data.type,i=n.data.data,e){case _.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 _.UPDATE_THEME_SETTINGS:return[3,20]}return[3,21];case 1:return[4,this.handleUpdateFrameData(i)];case 2:case 4:case 6:case 8:case 10:case 15:return t.sent(),[3,22];case 3:return[4,this.handleUpdateThemeJson(i)];case 5:return[4,this.handleUpdatePropValue(i)];case 7:return[4,this.handleUpdatePageParams(i)];case 9:return[4,this.handleUpdatePageComponentOrder(i)];case 11:return this.handleAddNewComponent(i),[3,22];case 12:return this.handleDeleteComponent(i),[3,22];case 13:return this.handleUpdateComponent(i),[3,22];case 14:return[4,this.handleAddNewPageComponent(i)];case 16:return this.handleDeletePageComponent(i),[3,22];case 17:return this.handleSetSelectedComponent(i),[3,22];case 18:return this.handleSetHoveredComponent(i),[3,22];case 19:return this.handleScrollToComponent(i),[3,22];case 20:return this.updateThemeSettings(i),[3,22];case 21:return[3,22];case 22:return[2]}}))}))},this.onClick=function(e){E.sendMessage(_.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){E.sendMessage(_.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){E.sendMessage(_.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(n){return e(E,void 0,void 0,(function(){var e,i,s,p,u,c,l,m,h,E=this;return t(this,(function(t){switch(t.label){case 0:return e=n.slice(1),i=e.split("?"),e=i[0],s=i[1],this.pageParams={},n.startsWith("/account/orders/")?p=d.ORDER_DETAIL:n.startsWith("/account/orders")?p=d.ORDERS:n.startsWith("/account/addresses")?p=d.ADDRESSES:n.startsWith("/account/favorite-products")?p=d.FAVORITE_PRODUCTS:n.startsWith("/account/forgot-password")?p=d.FORGOT_PASSWORD:n.startsWith("/account/login")?p=d.LOGIN:n.startsWith("/account/raffles")?p=d.RAFFLE_ACCOUNT:n.startsWith("/account/recover-password")?p=d.RECOVER_PASSWORD:n.startsWith("/account/register")?p=d.REGISTER:n.startsWith("/account")?p=d.ACCOUNT:n.startsWith("/blog/")?p=d.BLOG:n.startsWith("/blog")?p=d.BLOG_INDEX:n.startsWith("/pages")?(p=d.CUSTOM,this.pageParams={slug:e.split("/")[1]}):p=n.startsWith("/raffle/")?d.RAFFLE_DETAIL:n.startsWith("/raffle")?d.RAFFLE:n.startsWith("/404")?d.NOT_FOUND:n.startsWith("/cart")?d.CART:n.startsWith("/checkout")?d.CHECKOUT:"/"===n?d.INDEX:n.startsWith("/search")?d.SEARCH:d.PRODUCT,p!==d.PRODUCT?[3,6]:[4,f.listHTMLMetaData(e)];case 1:return(c=t.sent()).length?(l=c[0]).targetType!==r.PRODUCT?[3,3]:[4,this.getVariantIdFromParams(l.targetId,s)]:[3,5];case 2:return u=t.sent(),this.pageParams={productId:l.targetId,variantId:u,slug:e},[3,4];case 3:if(l.targetType===r.CATEGORY)p=d.CATEGORY,this.pageParams={categoryId:l.targetId,slug:e};else{if(l.targetType!==r.BRAND)return[2];p=d.BRAND,this.pageParams={brandId:l.targetId,slug:e}}t.label=4;case 4:return[3,6];case 5:return[2];case 6:return p!==d.BLOG?[3,8]:[4,g.listBlogMetaData(e)];case 7:if(!(c=t.sent()).length)return[2];if((l=c[0]).targetType===a.BLOG)this.pageParams={blogId:l.targetId,slug:e};else{if(l.targetType!==a.BLOG_CATEGORY)return[2];p=d.BLOG_CATEGORY,this.pageParams={blogCategoryId:l.targetId,slug:e}}t.label=8;case 8:return p!==d.RAFFLE_DETAIL?[3,10]:[4,v.listRaffleMetaData(e)];case 9:if(!(c=t.sent()).length)return[2];l=c[0],this.pageParams={raffleId:l.targetId,slug:e},t.label=10;case 10:return[4,this.getPagePropValues(this.theme,p,this.pageParams)];case 11:return m=t.sent(),o((function(){var e,t;O.store.currentPageType=p,E.pageDataProvider=m,p===d.CUSTOM?E.page=null===(e=E.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===p&&e.slug===E.pageParams.slug})):E.page=null===(t=E.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===(h=this.pageDataProvider)||void 0===h?void 0:h.pageSpecificData)||null}),[2]}}))}))},this.onLoadingChange=function(){E.sendMessage(_.EDITOR_LOADING_CHANGE,{isLoading:E.isLoading})},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(n,i,o){return e(E,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new m(n,o,i),(o.blogId||o.blogCategoryId)&&(e.possiblePageTypes=[d.BLOG,d.BLOG_CATEGORY]),o.raffleId&&(e.possiblePageTypes=[d.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData?(h.setPageSpecificData(JSON.stringify(e.pageSpecificData),i,!0),i===d.PRODUCT&&h.pageSpecificData&&(a=h.pageSpecificData,(r=a.product.variants.find((function(e){return e.id===o.variantId})))&&(a.selectedVariantValues=r.variantValues))):h.pageSpecificData=void 0,e.pageComponentPropValues=h.initPropValues(JSON.stringify(e.pageComponentPropValues),this.router,JSON.stringify(n.settings),!1),[2,e]}}))}))},this.setComponentRef=function(e,t){E.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.bottom;return n<window.innerHeight&&i>=0&&i<window.innerHeight&&n>0},this.handleUpdateFrameData=function(n){return e(E,void 0,void 0,(function(){var e,i,o,a,r,d=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new s(n.theme),this.page=this.theme.pages.find((function(e){return e.id===n.selectedPage.id})),this.pageParams=n.pageParams,this.apiKey=n.apiKey,this.locale=n.locale||"en",this.translations=n.translations||void 0,this.page?((e=n.storefront)&&(i=new T(e),o=i.routings.find((function(e){return e.locale===d.locale})),O.storefrontId=i.id,O.storefrontRoutingId=null==o?void 0:o.id,i.mainStorefrontThemeId&&(O.storefrontThemeId=i.mainStorefrontThemeId),i.salesChannelId&&(O.salesChannelId=i.salesChannelId),(null==o?void 0:o.priceListId)?O.priceListId=o.priceListId:O.priceListId=void 0,O.routings=i.routings,O.stockPreference=this.theme.settings.stockPreference),this.translations&&(O.translations=this.translations),O.isEditor=!0,P.createApolloClient(this.apiKey||void 0),window.editorApiKey=n.apiKey,a=C(),this.updateId=a,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return r=t.sent(),this.updateId===a&&(this.pageDataProvider=r,this.isLoading=!1),[2]}}))}))},this.handleUpdateThemeJson=function(n){return e(E,void 0,void 0,(function(){return t(this,(function(e){return this.theme=new s(n.theme),[2]}))}))},this.handleUpdatePropValue=function(n){return e(E,void 0,void 0,(function(){var e,i,a,r,s,d,p,u,l=this;return t(this,(function(t){switch(t.label){case 0:return e=n.propName,i=n.value,(a=null===(p=null===(d=this.selectedComponent)||void 0===d?void 0:d.props)||void 0===p?void 0:p.find((function(t){return t.name===e})))&&this.selectedPageComponent?(r=null===(u=this.pageDataProvider)||void 0===u?void 0:u.pageComponentPropValues.find((function(e){return e.pageComponent.id===l.selectedPageComponentId})),this.selectedPageComponent.propValues[e]=i,this.pageDataProvider?[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,a)]:[2]):[2];case 1:return s=t.sent(),[4,this.pageDataProvider.setLinkSlugs()];case 2:return t.sent(),o((function(){r&&(r.propValues[e]=s,a.type===c.CUSTOM?h.initCustomDataPropValue(a,s,r,l.router,l.theme.settings,!0):a.type===c.COMPONENT?h.initComponentPropValue(a,s,r,l.router,l.theme.settings,!0):a.type===c.COMPONENT_LIST?h.initComponentListPropValue(a,s,r,l.router,l.theme.settings,!0):a.type===c.PRODUCT_DETAIL?h.initProductDetailPropValue(a,s,r,l.router):a.type===c.CATEGORY?h.initCategoryPropValue(a,s,r):a.type===c.BRAND?h.initBrandPropValue(a,s,r):a.type===c.BLOG?h.initBlogPropValue(a,s,r):a.type===c.BLOG_CATEGORY?h.initBlogCategoryPropValue(a,s,r):a.type===c.RAFFLE?h.initRafflePropValue(a,s,r):a.type!==c.LINK&&a.type!==c.LIST_OF_LINK||h.initLinkPropValue(a,s,r))})),[2]}}))}))},this.handleUpdatePageParams=function(n){return e(E,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=n.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(n){return e(E,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=n.pageComponents.map((function(e){return new p(e)})):this.page.components=n.pageComponents.map((function(e){return new p(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,n=new u(e.component);null===(t=E.theme)||void 0===t||t.components.push(n)},this.handleDeleteComponent=function(e){var t,n;(null===(t=E.theme)||void 0===t?void 0:t.components)&&(E.theme.components=E.theme.components.filter((function(t){return t.id!==e.componentId})));var i=E.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];E.specification&&E.specification.components&&(E.specification.components=i),!E.specification&&(null===(n=E.page)||void 0===n?void 0:n.components)&&(E.page.components=i)},this.handleUpdateComponent=function(e){var t=E.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(E.theme.components[t]=new u(e.component))},this.handleAddNewPageComponent=function(n){return e(E,void 0,void 0,(function(){var e,i,a=this;return t(this,(function(t){switch(t.label){case 0:return e=new p(n.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return i=t.sent(),o((function(){i.component.props.filter((function(e){return e.type===c.CUSTOM})).forEach((function(e){h.initCustomDataPropValue(e,i.propValues[e.name],i,a.router,a.theme.settings,!0)})),a.pageDataProvider.pageComponentPropValues.push(i),a.pageComponents.push(e)})),[2]}}))}))},this.handleDeletePageComponent=function(e){E.specification?E.specification.components=E.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):E.page.components=E.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){E.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){E.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,n=E.componentRefs[t];n&&(E.isScrolledIntoView(n)||window.scrollTo({top:n.offsetTop,behavior:"smooth"}))},this.updateThemeSettings=function(e){var t=e.settings;E.theme&&(E.theme.settings=new l(t))},this.router=n,i(this),this.startMessaging()}return Object.defineProperty(D.prototype,"specification",{get:function(){var e,t,n,i,o,a,r,s=this,p=this.page;return(null==p?void 0:p.type)===d.PRODUCT&&(r=null===(e=p.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=s.pageParams)||void 0===t?void 0:t.productId)}))),(null==p?void 0:p.type)===d.CATEGORY&&(r=null===(t=p.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=s.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==p?void 0:p.type)===d.BRAND&&(r=null===(n=p.specifications)||void 0===n?void 0:n.find((function(e){var t;return e.id===(null===(t=s.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===d.BLOG&&(r=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=s.pageParams)||void 0===t?void 0:t.blogId)}))),(null==p?void 0:p.type)===d.BLOG_CATEGORY&&(r=null===(o=p.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=s.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==p?void 0:p.type)===d.RAFFLE_DETAIL&&(r=null===(a=p.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=s.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 n;return e.id===(null===(n=t.selectedPageComponent)||void 0===n?void 0:n.componentId)}))},enumerable:!1,configurable:!0}),D.prototype.createLoadingListener=function(){var e=this;n((function(){return e.isLoading}),(function(){e.onLoadingChange()}))},D.prototype.getVariantIdFromParams=function(n,i){return e(this,void 0,void 0,(function(){var e,o,a,r,s,d,p;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=new URLSearchParams("?"+i),[4,E.searchProducts({productIdList:[n],priceListId:O.priceListId,salesChannelId:O.salesChannelId})];case 1:return(null==(o=t.sent())?void 0:o.data.length)?(a=o.data[0],r=a.variantTypes.map((function(e){return e.variantType.slug})),s=[],r.forEach((function(t,n){var i=a.variantTypes[n],o=e.get(t);if(o){var r=i.variantType.values.find((function(e){return e.slug===o}));r&&s.push(r)}})),(d=a.variants.find((function(e){return e.variantValues.every((function(e){return s.some((function(t){return t.id===e.id}))}))})))?[2,d.id]:[3,3]):[2];case 2:return p=t.sent(),console.error(p),[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"}(_||(_={}));export{_ as BridgeMessageType,D as default};
@@ -1 +1 @@
1
- import{renderComponent as e}from"../components/page/index.js";import{IkasBlogCategory as t,IkasBlog as i}from"../models/data/blog/index.js";import{IkasBrand as a}from"../models/data/brand/index.js";import{IkasCategory as r}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as o}from"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import{observable as n}from"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import{IkasRaffle as u}from"../models/data/raffle/index.js";import{IkasSlider as s}from"../models/data/slider/index.js";import"../models/theme/theme.js";import{IkasThemePageType as l}from"../models/theme/page/index.js";import{IkasThemePageComponent as p}from"../models/theme/page/component/index.js";import{IkasThemeComponent as c}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as m}from"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import{IkasBrandList as d}from"../models/ui/brand-list/index.js";import{IkasBlogList as f}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as V}from"../models/ui/blog-category-list/index.js";import{IkasCategoryList as P}from"../models/ui/category-list/index.js";import{IkasNavigationLink as g}from"../models/ui/navigation-link/index.js";import{IkasProductDetail as _}from"../models/ui/product-detail/index.js";import{IkasProductList as L}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as h}from"../models/ui/product-attribute-detail/index.js";import{IkasAttributeList as D}from"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-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{IkasComponentRenderer as v}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as C}from"../models/ui/raffle-list/index.js";import{IkasThemeSettings as T}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import b from'../ext/lzutf8/build/production/lzutf8.js';import{IkasPageComponentPropValue as j}from"./page-data-get.js";import{getPlaceholderBrand as S,getPlaceholderCategory as B,getPlaceholderProduct as I,getPlaceholderBlog as w,getPlaceholderBlogCategory as x,getPlaceholderRaffle as O}from"./placeholders.js";var y=function(){function y(){}return y.setPageSpecificData=function(e,a,o){if(e){var n=JSON.parse(e);switch(a){case l.PRODUCT:var s=n;y.pageSpecificData=new _(s.product,s.selectedVariantValues),o&&this._initProductDetailOnBrowser(y.pageSpecificData);break;case l.CATEGORY:var p=n;y.pageSpecificData=new r(p);break;case l.BRAND:var c=n;y.pageSpecificData=new r(c);break;case l.BLOG:var m=n;y.pageSpecificData=new i(m);break;case l.BLOG_CATEGORY:var d=n;y.pageSpecificData=new t(d);break;case l.RAFFLE_DETAIL:var f=n;y.pageSpecificData=new u(f)}}else this.pageSpecificData=void 0},y.isServer=function(){return"undefined"==typeof window},y.initPropValues=function(e,t,i,a,r){var o=new T(JSON.parse(i)),n=a?b.decompress(e,{inputEncoding:"Base64"}):e,u=JSON.parse(n).map((function(e){return{pageComponent:new p(e.pageComponent),component:new c(e.component),propValues:e.propValues}}));return u.forEach((function(e){e.component.props.forEach((function(i){var a=e.propValues[i.name];if(null!=a)switch(i.type){case m.IMAGE:y.initImagePropValue(i,a,e);break;case m.IMAGE_LIST:y.initImageListPropValue(i,a,e);break;case m.BRAND:y.initBrandPropValue(i,a,e);break;case m.BRAND_LIST:y.initBrandListPropValue(i,a,e);break;case m.CATEGORY:y.initCategoryPropValue(i,a,e);break;case m.CATEGORY_LIST:y.initCategoryListPropValue(i,a,e);break;case m.PRODUCT_LIST:y.initProductListPropValue(i,a,e,t);break;case m.PRODUCT_DETAIL:y.initProductDetailPropValue(i,a,e,t);break;case m.PRODUCT_ATTRIBUTE:y.initAttributePropValue(i,a,e);break;case m.PRODUCT_ATTRIBUTE_LIST:y.initAttributeListPropValue(i,a,e);break;case m.LINK:case m.LIST_OF_LINK:y.initLinkPropValue(i,a,e);break;case m.COMPONENT:y.initComponentPropValue(i,a,e,t,o,r);break;case m.COMPONENT_LIST:y.initComponentListPropValue(i,a,e,t,o,r);break;case m.CUSTOM:y.initCustomDataPropValue(i,a,e,t,o,r);break;case m.BLOG:y.initBlogPropValue(i,a,e);break;case m.BLOG_LIST:y.initBlogListPropValue(i,a,e);break;case m.BLOG_CATEGORY:y.initBlogCategoryPropValue(i,a,e);break;case m.BLOG_LIST:y.initBlogCategoryListPropValue(i,a,e);break;case m.RAFFLE:y.initRafflePropValue(i,a,e);break;case m.RAFFLE_LIST:y.initRaffleListPropValue(i,a,e);break;case m.SLIDER:y.initSliderPropValue(i,a,e)}}))})),u},y.initBrandPropValue=function(e,t,i){i.propValues[e.name]=y._initBrandPropValue(t)},y._initBrandPropValue=function(e){return e.brandPropValue.usePageData?this.pageSpecificData:e.brand?new a(e.brand):S()},y.initBrandListPropValue=function(e,t,i){i.propValues[e.name]=y._initBrandListPropValue(t)},y._initBrandListPropValue=function(e){return new d(e)},y.initCategoryPropValue=function(e,t,i){i.propValues[e.name]=y._initCategoryPropValue(t)},y._initCategoryPropValue=function(e){return e.categoryPropValue.usePageData?this.pageSpecificData:e.category?new r(e.category):B()},y.initCategoryListPropValue=function(e,t,i){var a=new P(t);i.propValues[e.name]=a},y._initCategoryListPropValue=function(e){return new P(e)},y.initProductListPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductListPropValue(t,a)},y._initProductListPropValue=function(e,t){return new L(e,t)},y.initProductDetailPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductDetailPropValue(t,a)},y._initProductDetailPropValue=function(e,t){var i=I();return e.productDetailPropValue.usePageData?i=this.pageSpecificData:e.productDetail&&(i=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),i.router=t,i},y._initProductDetailOnBrowser=function(e){var t=new URLSearchParams(window.location.search),i=t.get("vid");if(i){var a=e.product.variants.find((function(e){return e.id===i}));a&&(e.selectedVariantValues=a.variantValues)}else{var r=e.product.variantTypes.map((function(e){return e.variantType.slug})),o=[];r.forEach((function(i,a){var r=e.product.variantTypes[a],n=t.get(i);if(n){var u=r.variantType.values.find((function(e){return e.slug===n}));u&&o.push(u)}})),o.length===e.selectedVariantValues.length&&(e.selectedVariantValues=o)}},y.initAttributePropValue=function(e,t,i){i.propValues[e.name]=y._initAttributePropValue(t)},y._initAttributePropValue=function(e){var t=null;return e.attributePropValue.usePageData?t=this.pageSpecificData:e.productDetail&&(t=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),new h(t,e.attributePropValue)},y.initAttributeListPropValue=function(e,t,i){i.propValues[e.name]=y._initAttributeListPropValue(t)},y._initAttributeListPropValue=function(e){var t=null;return e.attributeListPropValue.usePageData?t=this.pageSpecificData:e.productDetail&&(t=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),new D(t,e.attributeListPropValue)},y.initLinkPropValue=function(e,t,i){i.propValues[e.name]=this._initLinkPropValue(t)},y._initLinkPropValue=function(e){return Array.isArray(e)?e.map((function(e){return new g(e.href,e.label,e.subLinks,e.isExternal||void 0)})):e?new g(e.href,e.label,e.subLinks,e.isExternal):void 0},y.initImagePropValue=function(e,t,i){i.propValues[e.name]=this._initImagePropValue(t)},y._initImagePropValue=function(e){return new o(e.id)},y.initImageListPropValue=function(e,t,i){i.propValues[e.name]=this._initImageListPropValue(t)},y._initImageListPropValue=function(e){return e.map((function(e){return new o(e.id)}))},y.initCustomDataPropValue=function(e,t,i,a,r,o){t&&t.value&&t.customData&&(i.propValues[e.name]=this._initCustomDataPropValue(t,t.customData,a,r,o))},y._initCustomDataPropValue=function(e,t,i,a,r){var o=this;if(!e)return null;var n=e.value;if(null==n)return null;switch(t.type){case m.BRAND:return this._initBrandPropValue(n);case m.BRAND_LIST:return this._initBrandListPropValue(n);case m.CATEGORY_LIST:return this._initCategoryListPropValue(n);case m.CATEGORY:return this._initCategoryPropValue(n);case m.IMAGE_LIST:return this._initImageListPropValue(n);case m.IMAGE:return this._initImagePropValue(n);case m.LINK:return this._initLinkPropValue(n);case m.PRODUCT_DETAIL:return this._initProductDetailPropValue(n,i);case m.PRODUCT_LIST:return this._initProductListPropValue(n,i);case m.PRODUCT_ATTRIBUTE:return this._initAttributePropValue(n);case m.PRODUCT_ATTRIBUTE_LIST:return this._initAttributeListPropValue(n);case m.BLOG:return this._initBlogPropValue(n);case m.BLOG_LIST:return this._initBlogListPropValue(n);case m.BLOG_CATEGORY:return this._initBlogCategoryPropValue(n);case m.BLOG_CATEGORY_LIST:return this._initBlogCategoryListPropValue(n);case m.RAFFLE:return this._initRafflePropValue(n);case m.RAFFLE_LIST:return this._initRaffleListPropValue(n);case m.SLIDER:return this._initSliderPropValue(n);case m.OBJECT:for(var u={},s=0,l=t.nestedData||[];s<l.length;s++){var p=l[s],c=n[p.key],d=void 0;p.customDataId&&(d=c.customData),u[p.key]=this._initCustomDataPropValue(c,d||p,i,a,r)}return u;case m.DYNAMIC_LIST:case m.STATIC_LIST:try{if(!n||!n.length)return null;var f=[],V=t.nestedData[0];return n.forEach((function(e){var t;V.customDataId&&(t=e.customData),f.push(o._initCustomDataPropValue(e,t||V,i,a,r))})),f}catch(e){return[]}case m.COMPONENT:return this._initComponentPropValue(n,i,a,r);case m.COMPONENT_LIST:return this._initComponentListPropValue(n,i,a,r);default:return n}},y.initComponentPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentPropValue(t,a,r,o)},y._initComponentPropValue=function(t,i,a,r){var o=t.length?t[0]:void 0;if(o){var n=new j(o),u=this.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);if(u.length)return new v((function(){return e(u[0],a,-10)}))}},y.initComponentListPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentListPropValue(t,a,r,o)},y._initComponentListPropValue=function(t,i,a,r){var o=this;return t&&t.length?t.map((function(t){var n=new j(t),u=o.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);return new v((function(){return e(u[0],a,-1)}))})):[]},y.initBlogPropValue=function(e,t,i){i.propValues[e.name]=y._initBlogPropValue(t)},y._initBlogPropValue=function(e){return e.blogPropValue.usePageData?this.pageSpecificData:e.blog?new i(e.blog):w()},y.initBlogListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogListPropValue(t)},y._initBlogListPropValue=function(e){return new f(e)},y.initBlogCategoryPropValue=function(e,t,i){i.propValues[e.name]=y._initBlogCategoryPropValue(t)},y._initBlogCategoryPropValue=function(e){return e.blogCategoryPropValue.usePageData?this.pageSpecificData:e.blogCategory?new t(e.blogCategory):x()},y.initBlogCategoryListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogCategoryListPropValue(t)},y._initBlogCategoryListPropValue=function(e){return new V(e)},y.initRafflePropValue=function(e,t,i){i.propValues[e.name]=y._initRafflePropValue(t)},y._initRafflePropValue=function(e){return e.rafflePropValue.usePageData?this.pageSpecificData:e.raffle?new u(e.raffle):O()},y.initRaffleListPropValue=function(e,t,i){i.propValues[e.name]=this._initRaffleListPropValue(t)},y._initRaffleListPropValue=function(e){return new C(e)},y.initSliderPropValue=function(e,t,i){i.propValues[e.name]=this._initSliderPropValue(t)},y._initSliderPropValue=function(e){return new s(e)},y.pageSpecificData=n({}),y}();export{y as IkasPageDataInit};
1
+ import{renderComponent as e}from"../components/page/index.js";import{IkasBlogCategory as t,IkasBlog as i}from"../models/data/blog/index.js";import{IkasBrand as a}from"../models/data/brand/index.js";import{IkasCategory as r}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/index.js";import"../models/data/customer-review/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as o}from"../models/data/image/index.js";import"../models/data/installment-info/index.js";import"../models/data/order/index.js";import"../models/data/order/line-item/index.js";import{observable as n}from"mobx";import"../models/data/product/index.js";import"../models/data/variant-type/index.js";import"../models/data/product/variant/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product-attribute/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product-filter/index.js";import"../models/data/variant-type/variant-value/index.js";import"../models/data/order-transaction/index.js";import"../models/data/product-option-set/index.js";import{IkasRaffle as u}from"../models/data/raffle/index.js";import{IkasSlider as s}from"../models/data/slider/index.js";import"../models/theme/theme.js";import{IkasThemePageType as p}from"../models/theme/page/index.js";import{IkasThemePageComponent as l}from"../models/theme/page/component/index.js";import{IkasThemeComponent as c}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as m}from"../models/theme/component/prop/index.js";import"../models/theme/page/component/prop-value/link.js";import{IkasBrandList as d}from"../models/ui/brand-list/index.js";import{IkasBlogList as f}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as V}from"../models/ui/blog-category-list/index.js";import{IkasCategoryList as P}from"../models/ui/category-list/index.js";import{IkasNavigationLink as g}from"../models/ui/navigation-link/index.js";import{IkasProductDetail as _}from"../models/ui/product-detail/index.js";import{IkasProductList as L}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as h}from"../models/ui/product-attribute-detail/index.js";import{IkasAttributeList as D}from"../models/ui/product-attribute-list/index.js";import"../models/ui/customer-review-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{IkasComponentRenderer as v}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as C}from"../models/ui/raffle-list/index.js";import{IkasThemeSettings as T}from"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import S from'../ext/lzutf8/build/production/lzutf8.js';import{IkasPageComponentPropValue as b}from"./page-data-get.js";import{getPlaceholderBrand as j,getPlaceholderCategory as B,getPlaceholderProduct as I,getPlaceholderBlog as w,getPlaceholderBlogCategory as x,getPlaceholderRaffle as O}from"./placeholders.js";var y=function(){function y(){}return y.setPageSpecificData=function(e,a,o){if(e){var n=JSON.parse(e);switch(a){case p.PRODUCT:var s=n;y.pageSpecificData=new _(s.product,s.selectedVariantValues),o&&this._initProductDetailOnBrowser(y.pageSpecificData);break;case p.CATEGORY:var l=n;y.pageSpecificData=new r(l);break;case p.BRAND:var c=n;y.pageSpecificData=new r(c);break;case p.BLOG:var m=n;y.pageSpecificData=new i(m);break;case p.BLOG_CATEGORY:var d=n;y.pageSpecificData=new t(d);break;case p.RAFFLE_DETAIL:var f=n;y.pageSpecificData=new u(f)}}else this.pageSpecificData=void 0},y.isServer=function(){return"undefined"==typeof window},y.initPropValues=function(e,t,i,a,r){var o=new T(JSON.parse(i)),n=a?S.decompress(e,{inputEncoding:"Base64"}):e,u=JSON.parse(n).map((function(e){return{pageComponent:new l(e.pageComponent),component:new c(e.component),propValues:e.propValues}}));return u.forEach((function(e){e.component.props.forEach((function(i){var a=e.propValues[i.name];if(null!=a)switch(i.type){case m.IMAGE:y.initImagePropValue(i,a,e);break;case m.IMAGE_LIST:y.initImageListPropValue(i,a,e);break;case m.BRAND:y.initBrandPropValue(i,a,e);break;case m.BRAND_LIST:y.initBrandListPropValue(i,a,e);break;case m.CATEGORY:y.initCategoryPropValue(i,a,e);break;case m.CATEGORY_LIST:y.initCategoryListPropValue(i,a,e);break;case m.PRODUCT_LIST:y.initProductListPropValue(i,a,e,t);break;case m.PRODUCT_DETAIL:y.initProductDetailPropValue(i,a,e,t);break;case m.PRODUCT_ATTRIBUTE:y.initAttributePropValue(i,a,e);break;case m.PRODUCT_ATTRIBUTE_LIST:y.initAttributeListPropValue(i,a,e);break;case m.LINK:case m.LIST_OF_LINK:y.initLinkPropValue(i,a,e);break;case m.COMPONENT:y.initComponentPropValue(i,a,e,t,o,r);break;case m.COMPONENT_LIST:y.initComponentListPropValue(i,a,e,t,o,r);break;case m.CUSTOM:y.initCustomDataPropValue(i,a,e,t,o,r);break;case m.BLOG:y.initBlogPropValue(i,a,e);break;case m.BLOG_LIST:y.initBlogListPropValue(i,a,e);break;case m.BLOG_CATEGORY:y.initBlogCategoryPropValue(i,a,e);break;case m.BLOG_LIST:y.initBlogCategoryListPropValue(i,a,e);break;case m.RAFFLE:y.initRafflePropValue(i,a,e);break;case m.RAFFLE_LIST:y.initRaffleListPropValue(i,a,e);break;case m.SLIDER:y.initSliderPropValue(i,a,e)}}))})),u},y.initBrandPropValue=function(e,t,i){i.propValues[e.name]=y._initBrandPropValue(t)},y._initBrandPropValue=function(e){return e.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.brand?new a(e.brand):j()},y.initBrandListPropValue=function(e,t,i){i.propValues[e.name]=y._initBrandListPropValue(t)},y._initBrandListPropValue=function(e){return new d(e)},y.initCategoryPropValue=function(e,t,i){i.propValues[e.name]=y._initCategoryPropValue(t)},y._initCategoryPropValue=function(e){return e.categoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.category?new r(e.category):B()},y.initCategoryListPropValue=function(e,t,i){var a=new P(t);i.propValues[e.name]=a},y._initCategoryListPropValue=function(e){return new P(e)},y.initProductListPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductListPropValue(t,a)},y._initProductListPropValue=function(e,t){return new L(e,t)},y.initProductDetailPropValue=function(e,t,i,a){i.propValues[e.name]=this._initProductDetailPropValue(t,a)},y._initProductDetailPropValue=function(e,t){var i=I();return e.productDetailPropValue.usePageData&&this.pageSpecificData?i=this.pageSpecificData:e.productDetail&&(i=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),i.router=t,i},y._initProductDetailOnBrowser=function(e){var t=new URLSearchParams(window.location.search),i=t.get("vid");if(i){var a=e.product.variants.find((function(e){return e.id===i}));a&&(e.selectedVariantValues=a.variantValues)}else{var r=e.product.variantTypes.map((function(e){return e.variantType.slug})),o=[];r.forEach((function(i,a){var r=e.product.variantTypes[a],n=t.get(i);if(n){var u=r.variantType.values.find((function(e){return e.slug===n}));u&&o.push(u)}})),o.length===e.selectedVariantValues.length&&(e.selectedVariantValues=o)}},y.initAttributePropValue=function(e,t,i){i.propValues[e.name]=y._initAttributePropValue(t)},y._initAttributePropValue=function(e){var t=null;return e.attributePropValue.usePageData&&this.pageSpecificData?t=this.pageSpecificData:e.productDetail&&(t=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),new h(t,e.attributePropValue)},y.initAttributeListPropValue=function(e,t,i){i.propValues[e.name]=y._initAttributeListPropValue(t)},y._initAttributeListPropValue=function(e){var t=null;return e.attributeListPropValue.usePageData&&this.pageSpecificData?t=this.pageSpecificData:e.productDetail&&(t=new _(e.productDetail.product,e.productDetail.selectedVariantValues)),new D(t,e.attributeListPropValue)},y.initLinkPropValue=function(e,t,i){i.propValues[e.name]=this._initLinkPropValue(t)},y._initLinkPropValue=function(e){return Array.isArray(e)?e.map((function(e){return new g(e.href,e.label,e.subLinks,e.isExternal||void 0)})):e?new g(e.href,e.label,e.subLinks,e.isExternal):void 0},y.initImagePropValue=function(e,t,i){i.propValues[e.name]=this._initImagePropValue(t)},y._initImagePropValue=function(e){return new o(e.id)},y.initImageListPropValue=function(e,t,i){i.propValues[e.name]=this._initImageListPropValue(t)},y._initImageListPropValue=function(e){return e.map((function(e){return new o(e.id)}))},y.initCustomDataPropValue=function(e,t,i,a,r,o){t&&t.value&&t.customData&&(i.propValues[e.name]=this._initCustomDataPropValue(t,t.customData,a,r,o))},y._initCustomDataPropValue=function(e,t,i,a,r){var o=this;if(!e)return null;var n=e.value;if(null==n)return null;switch(t.type){case m.BRAND:return this._initBrandPropValue(n);case m.BRAND_LIST:return this._initBrandListPropValue(n);case m.CATEGORY_LIST:return this._initCategoryListPropValue(n);case m.CATEGORY:return this._initCategoryPropValue(n);case m.IMAGE_LIST:return this._initImageListPropValue(n);case m.IMAGE:return this._initImagePropValue(n);case m.LINK:return this._initLinkPropValue(n);case m.PRODUCT_DETAIL:return this._initProductDetailPropValue(n,i);case m.PRODUCT_LIST:return this._initProductListPropValue(n,i);case m.PRODUCT_ATTRIBUTE:return this._initAttributePropValue(n);case m.PRODUCT_ATTRIBUTE_LIST:return this._initAttributeListPropValue(n);case m.BLOG:return this._initBlogPropValue(n);case m.BLOG_LIST:return this._initBlogListPropValue(n);case m.BLOG_CATEGORY:return this._initBlogCategoryPropValue(n);case m.BLOG_CATEGORY_LIST:return this._initBlogCategoryListPropValue(n);case m.RAFFLE:return this._initRafflePropValue(n);case m.RAFFLE_LIST:return this._initRaffleListPropValue(n);case m.SLIDER:return this._initSliderPropValue(n);case m.OBJECT:for(var u={},s=0,p=t.nestedData||[];s<p.length;s++){var l=p[s],c=n[l.key],d=void 0;l.customDataId&&(d=c.customData),u[l.key]=this._initCustomDataPropValue(c,d||l,i,a,r)}return u;case m.DYNAMIC_LIST:case m.STATIC_LIST:try{if(!n||!n.length)return null;var f=[],V=t.nestedData[0];return n.forEach((function(e){var t;V.customDataId&&(t=e.customData),f.push(o._initCustomDataPropValue(e,t||V,i,a,r))})),f}catch(e){return[]}case m.COMPONENT:return this._initComponentPropValue(n,i,a,r);case m.COMPONENT_LIST:return this._initComponentListPropValue(n,i,a,r);default:return n}},y.initComponentPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentPropValue(t,a,r,o)},y._initComponentPropValue=function(t,i,a,r){var o=t.length?t[0]:void 0;if(o){var n=new b(o),u=this.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);if(u.length)return new v((function(){return e(u[0],a,-10)}))}},y.initComponentListPropValue=function(e,t,i,a,r,o){i.propValues[e.name]=this._initComponentListPropValue(t,a,r,o)},y._initComponentListPropValue=function(t,i,a,r){var o=this;return t&&t.length?t.map((function(t){var n=new b(t),u=o.initPropValues(JSON.stringify([n]),i,JSON.stringify(a),!1,r);return new v((function(){return e(u[0],a,-1)}))})):[]},y.initBlogPropValue=function(e,t,i){i.propValues[e.name]=y._initBlogPropValue(t)},y._initBlogPropValue=function(e){return e.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.blog?new i(e.blog):w()},y.initBlogListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogListPropValue(t)},y._initBlogListPropValue=function(e){return new f(e)},y.initBlogCategoryPropValue=function(e,t,i){i.propValues[e.name]=y._initBlogCategoryPropValue(t)},y._initBlogCategoryPropValue=function(e){return e.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.blogCategory?new t(e.blogCategory):x()},y.initBlogCategoryListPropValue=function(e,t,i){i.propValues[e.name]=this._initBlogCategoryListPropValue(t)},y._initBlogCategoryListPropValue=function(e){return new V(e)},y.initRafflePropValue=function(e,t,i){i.propValues[e.name]=y._initRafflePropValue(t)},y._initRafflePropValue=function(e){return e.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:e.raffle?new u(e.raffle):O()},y.initRaffleListPropValue=function(e,t,i){i.propValues[e.name]=this._initRaffleListPropValue(t)},y._initRaffleListPropValue=function(e){return new C(e)},y.initSliderPropValue=function(e,t,i){i.propValues[e.name]=this._initSliderPropValue(t)},y._initSliderPropValue=function(e){return new s(e)},y.pageSpecificData=n({}),y}();export{y as IkasPageDataInit};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",