@ikas/storefront-providers 4.13.18 → 4.14.1

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,4 +1,5 @@
1
1
  export declare type IkasCategoryPropValue = {
2
2
  categoryId?: string | null;
3
3
  usePageData?: boolean | null;
4
+ excludedFieldsCategory?: string[] | null;
4
5
  };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import{listBlogCategory as i}from"@ikas/storefront-api";import{IkasBlogCategoryListType as r}from"./index.js";function n(i){var r,n,u,l;return t(this,void 0,void 0,(function(){var t,d;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,a(i,e(i)?1:i.page,e(i)?(null===(r=i.blogCategoryListPropValue.blogCategoryIds)||void 0===r?void 0:r.length)||10:i.limit)];case 1:return t=o.sent(),e(i)?i.data=(null===(n=i.blogCategoryListPropValue.blogCategoryIds)||void 0===n?void 0:n.map((function(o){var i,r;return null===(r=null===(i=t.data)||void 0===i?void 0:i.data)||void 0===r?void 0:r.find((function(t){return t.id===o}))})).filter((function(t){return!!t})))||[]:i.data=(null===(u=t.data)||void 0===u?void 0:u.data)||[],i.count=(null===(l=t.data)||void 0===l?void 0:l.count)||0,i.initialized=!0,i.minPage=i.page,[3,3];case 2:return d=o.sent(),console.error(d),[3,3];case 3:return[2]}}))}))}function e(t){return t.type===r.STATIC}function a(r,n,a){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i({id:e(r)&&r.blogCategoryListPropValue.blogCategoryIds?{in:r.blogCategoryListPropValue.blogCategoryIds}:void 0,pagination:{page:n,limit:a}})];case 1:return[2,t.sent()]}}))}))}export{n as getInitial};
1
+ import{__awaiter as t,__generator as o}from'./../../../ext/tslib/tslib.es6.js';import{listBlogCategory as i}from"@ikas/storefront-api";import{IkasBlogCategoryListType as r}from"./index.js";function n(i){var r,n,u,l;return t(this,void 0,void 0,(function(){var t,d;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,a(i,e(i)?1:i.page,e(i)?(null===(r=i.blogCategoryListPropValue.blogCategoryIds)||void 0===r?void 0:r.length)||20:i.limit)];case 1:return t=o.sent(),e(i)?i.data=(null===(n=i.blogCategoryListPropValue.blogCategoryIds)||void 0===n?void 0:n.map((function(o){var i,r;return null===(r=null===(i=t.data)||void 0===i?void 0:i.data)||void 0===r?void 0:r.find((function(t){return t.id===o}))})).filter((function(t){return!!t})))||[]:i.data=(null===(u=t.data)||void 0===u?void 0:u.data)||[],i.count=(null===(l=t.data)||void 0===l?void 0:l.count)||0,i.initialized=!0,i.minPage=i.page,[3,3];case 2:return d=o.sent(),console.error(d),[3,3];case 3:return[2]}}))}))}function e(t){return t.type===r.STATIC}function a(r,n,a){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i({id:e(r)&&r.blogCategoryListPropValue.blogCategoryIds?{in:r.blogCategoryListPropValue.blogCategoryIds}:void 0,pagination:{page:n,limit:a}})];case 1:return[2,t.sent()]}}))}))}export{n as getInitial};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__assign as n}from'./../ext/tslib/tslib.es6.js';import r from"lodash/uniq";import a from"lodash/flatten";import{makeAutoObservable as i}from"mobx";import{IkasThemeJsonPageType as s,IkasCampaignOfferProductApplicablePriceEnum as o,IkasCategoryConditionTypeEnum as u,IkasRaffleMetadataTargetType as c,IkasBlogMetaDataTargetType as p,IkasHTMLMetaDataTargetType as l,IkasThemeJsonComponentPropType as d}from"@ikas/storefront-models";import{IkasStorefrontConfig as f}from"@ikas/storefront-config";import{IkasProductFunctions as g,IkasProductVariantFunctions as h}from"@ikas/storefront-model-functions";import{IkasProductListPropValueProvider as v}from"./prop-value/product-list.js";import{IkasProductPropValueProvider as m}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as T}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as S}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as P}from"./prop-value/link.js";import{IkasImageListPropValueProvider as I}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as y}from"./prop-value/text.js";import{IkasColorPropValueProvider as D}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as L}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as O}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as b}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as C}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as w}from"./prop-value/custom.js";import{IkasSliderPropValueProvider as R}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as E}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as A}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as G}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as V}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as j}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as F}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as _}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as B}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as M}from"./prop-value/raffle-list.js";import{listMerchantSettings as k,listCustomerReviewSummary as U,searchProducts as N,listCampaignOffer as q,listProductOptionSet as x,listProductBrand as Y,listCategory as J,listBlog as K,listBlogCategory as H,listStorefrontRaffle as X,listHTMLMetaData as $,listRaffleMetaData as z,listBlogMetaData as Q}from"@ikas/storefront-api";import{populateRaffleProducts as W}from"./helpers/raffle.js";import{IkasVideoPropValueProvider as Z}from"./prop-value/video.js";var ee=function(){function ee(e,t,n){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.productReviewSummary=null,this.theme=e,this.pageParams=t||{},this.pageType=n,i(this)}return Object.defineProperty(ee.prototype,"page",{get:function(){var e=this;if(this.pageType===s.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===s.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(ee.prototype,"nextPageData",{get:function(){var e,t,r,a,i,o=[],u=[];return this.pageComponentPropValues.forEach((function(e){if(u.push({pageComponent:{id:e.pageComponent.id,componentId:e.pageComponent.componentId},propValues:e.propValues}),!o.find((function(t){return t.id===e.component.id}))){var t=n({},e.component);t.props.forEach((function(e){delete e.description,delete e.displayName,delete e.translations,delete e.groupId})),delete t.translations,delete t.defaultPropValues,delete t.displayName,delete t.description,delete t.dir,o.push(t)}})),{props:JSON.parse(JSON.stringify({propValues:u,themeJsonComponents:o,customDataList:this.theme.customData,pageSpecificData:this.pageSpecificData||null,pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||s.CUSTOM,pageTitle:(null===(t=this.page)||void 0===t?void 0:t.pageTitle)||null,pageDescription:(null===(r=this.page)||void 0===r?void 0:r.description)||null,canonicals:(null===(a=this.page)||void 0===a?void 0:a.canonicals)||null,disableIndex:(null===(i=this.page)||void 0===i?void 0:i.disableIndex)||null,settings:this.theme.settings||{},productReviewSummary:this.productReviewSummary,configJson:f.toJSON(),merchantSettings:this.getMerchantSettings()}))}},enumerable:!1,configurable:!0}),Object.defineProperty(ee.prototype,"specification",{get:function(){var e,t,n=this,r=this.page;return(null==r?void 0:r.type)===s.PRODUCT?null===(e=r.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=n.pageSpecificData)||void 0===t?void 0:t.id)})):null===(t=null==r?void 0:r.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=n.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(ee.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(ee.prototype,"$pageComponentPropValues",{get:function(){return this.pageComponentPropValues},enumerable:!1,configurable:!0}),ee.prototype.getMerchantSettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,k({})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.merchantSettings=e.data),[2]}}))}))},ee.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,n=this;return t(this,(function(t){switch(t.label){case 0:return this.pageSpecificData?[3,2]:[4,this.getPageSpecificData()];case 1:t.sent(),t.label=2;case 2:return this.page?[4,this.getMerchantSettings()]:[2];case 3:return t.sent(),e=this,[4,Promise.all(this.pageComponents.map((function(e){return n.getPageComponentPropValues(e)})))];case 4:return e.pageComponentPropValues=t.sent(),[4,this.setLinkSlugs()];case 5:return t.sent(),[4,this.getProductReviewSummary()];case 6:return t.sent(),[2]}}))}))},ee.prototype.getProductReviewSummary=function(){var n,r,a;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageType!==s.PRODUCT?[3,2]:[4,U({productId:{eq:null===(n=this.pageSpecificData)||void 0===n?void 0:n.id}})];case 1:(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)&&(this.productReviewSummary=e.data.data[0]),t.label=2;case 2:return[2]}}))}))},ee.prototype.getPageSpecificData=function(){var r,a,i,d;return e(this,void 0,void 0,(function(){var v,m,T,S,P,I,y,D,L,O,b=this;return t(this,(function(C){switch(C.label){case 0:return this.pageType&&![s.BRAND,s.PRODUCT,s.CATEGORY,s.BLOG,s.BLOG_CATEGORY,s.RAFFLE_DETAIL].includes(this.pageType)?[2]:(v=this.pageParams.slug)?(m=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(s.BLOG))||(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(s.BLOG_CATEGORY))?[4,Q({slug:{eq:v}})]:[3,2]):[2];case 1:return T=C.sent(),(m=(null===(i=T.data)||void 0===i?void 0:i.data)||[]).length?[3,6]:[2];case 2:return(null===(d=this.possiblePageTypes)||void 0===d?void 0:d.includes(s.RAFFLE_DETAIL))?[4,z({slug:{eq:v}})]:[3,4];case 3:return T=C.sent(),(m=T.data||[]).length?[3,6]:[2];case 4:return[4,$({slug:{eq:v}})];case 5:if(T=C.sent(),!(m=T.data||[])||!m.length)return[2];C.label=6;case 6:if(!(S=m[0]).targetId)return[2];switch(P=function(){return e(b,void 0,void 0,(function(){var e,r,a,i,u,c,p,l,d,v,m,T,P,I,y,D,L,O,b,C;return t(this,(function(t){switch(t.label){case 0:return[4,N({input:{productIdList:[S.targetId],priceListId:f.getPriceListId(),salesChannelId:f.getSalesChannelId()}})];case 1:return e=t.sent(),(null===(D=null===(y=null==e?void 0:e.data)||void 0===y?void 0:y.data)||void 0===D?void 0:D.length)?(r=e.data.data[0]).productOptionSetId?[4,x({id:{eq:r.productOptionSetId}})]:[3,3]:[2];case 2:(a=t.sent()).isSuccess&&(null===(L=null==a?void 0:a.data)||void 0===L?void 0:L.length)&&(r.productOptionSet=a.data[0]),t.label=3;case 3:return(null===(O=r.campaignOffers)||void 0===O?void 0:O.length)?[4,q({id:{in:r.campaignOffers.map((function(e){return e.id}))}})]:[3,6];case 4:return(i=t.sent()).isSuccess&&(null===(b=i.data)||void 0===b?void 0:b.length)?(u=i.data[0],c=[],p=[],u.offers.forEach((function(e){return c.push(e.productId)})),[4,N({input:{productIdList:c,priceListId:f.getPriceListId(),salesChannelId:f.getSalesChannelId()}})]):[3,6];case 5:(l=t.sent()).isSuccess&&l.data&&u.offers.forEach((function(e){var t,r,a=null===(r=null===(t=l.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.find((function(t){return t.id===e.productId}));if(a){var i=a.variants.filter((function(t){return h.hasStock(t)&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){return e.discountAmount?n(n({},t),{prices:t.prices.map((function(t){var r=null!==t.discountPrice?t.discountPrice:t.sellPrice,a=r,i=r-r*e.discountAmount/100;return e.applicablePrice===o.SELL_PRICE&&(a=t.sellPrice,i=t.sellPrice-t.sellPrice*e.discountAmount/100),n(n({},t),{sellPrice:a,discountPrice:i})}))}):t}));i.length&&p.push({campaignOfferId:u.id,campaignOfferProductId:e.id,product:n(n({},a),{variants:i})})}})),r.offers=p,t.label=6;case 6:return r.productGroup?[4,N({input:{productGroupId:r.productGroup.id,productGroupKey:r.productGroup.groupKey,priceListId:f.getPriceListId(),salesChannelId:f.getSalesChannelId(),perPage:200}})]:[3,8];case 7:(d=t.sent()).isSuccess&&(null===(C=d.data)||void 0===C?void 0:C.data)&&(r.productGroupItems=d.data.data.map((function(e){var t;return{productId:e.id,image:e.variants[0].images?e.variants[0].images[0].image:null,href:g.getProductHref(e),groupValues:null===(t=e.productGroup)||void 0===t?void 0:t.values}}))),t.label=8;case 8:return(v=r.variants.find((function(e){return e.isActive})))?(r.selectedVariantValues=v.variantValues,m=g.getDisplayedVariantTypes,this.pageSpecificData=r,(T=m(this.pageSpecificData,r.selectedVariantValues)).length&&(P=T[0]).displayedVariantValues.length&&(I=P.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=I.variant.variantValues),this.pageType=s.PRODUCT,this.setPageMetaData(S),[2]):[2]}}))}))},I=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,Y({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],this.pageSpecificData=n,this.pageType=s.BRAND,this.setPageMetaData(S),[2]):[2]}}))}))},y=function(){return e(b,void 0,void 0,(function(){var e,n,r,a,i,o,c,p;return t(this,(function(t){switch(t.label){case 0:return[4,J({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(o=null===(i=e.data)||void 0===i?void 0:i.data)||void 0===o?void 0:o.length)?(n=e.data.data[0]).conditions&&(r=n.conditions.find((function(e){return e.conditionType===u.PRODUCT_BRAND})))?[4,Y({id:{eq:r.valueList[0]}})]:[3,3]:[2];case 2:if(!(a=t.sent()).isSuccess||!(null===(p=null===(c=a.data)||void 0===c?void 0:c.data)||void 0===p?void 0:p.length))return[2];n.conditionValues={brand:a.data.data[0]},t.label=3;case 3:return this.pageSpecificData=n,this.pageType=s.CATEGORY,this.setPageMetaData(S),[2]}}))}))},D=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,K({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],this.pageSpecificData=n,this.pageType=s.BLOG,this.setPageMetaData(S),[2]):[2]}}))}))},L=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,H({id:{eq:S.targetId},pagination:{page:1,limit:1}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],this.pageSpecificData=n,this.pageType=s.BLOG_CATEGORY,this.setPageMetaData(S),[2]):[2]}}))}))},O=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,X({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],[4,W([n])]):[2];case 2:return t.sent(),this.pageSpecificData=n,this.pageType=s.RAFFLE_DETAIL,this.setPageMetaData(S),[2]}}))}))},S.targetType){case l.BRAND:return[3,7];case l.CATEGORY:return[3,9];case l.PRODUCT:return[3,11];case p.BLOG:return[3,13];case p.BLOG_CATEGORY:return[3,15];case c.RAFFLE:return[3,17]}return[3,19];case 7:return[4,I()];case 8:return[2,C.sent()];case 9:return[4,y()];case 10:return[2,C.sent()];case 11:return[4,P()];case 12:return[2,C.sent()];case 13:return[4,D()];case 14:return[2,C.sent()];case 15:return[4,L()];case 16:return[2,C.sent()];case 17:return[4,O()];case 18:return[2,C.sent()];case 19:return[3,20];case 20:return[2]}}))}))},ee.prototype.getPageComponentPropValues=function(n){return e(this,void 0,void 0,(function(){var r,a,i,s=this;return t(this,(function(o){switch(o.label){case 0:return r=this.theme.components.find((function(e){return e.id===n.componentId})),a={pageComponent:n,component:r,propValues:{}},i=function(r){return e(s,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,i=r.name,[4,this.getPageComponentPropValue(n,r)];case 1:return e[i]=t.sent(),[2]}}))}))},[4,Promise.all(r.props.map(i))];case 1:return o.sent(),[2,a]}}))}))},ee.prototype.getPageComponentPropValue=function(r,a){return e(this,void 0,void 0,(function(){var e,i,s,o,u,c,p,l,f=this;return t(this,(function(t){switch(t.label){case 0:if(i=r.propValues[a.name],s=[d.RAFFLE_LIST],null==i&&!s.includes(a.type))return[2,null];switch(a.type){case d.TEXT:return[3,1];case d.RICH_TEXT:return[3,2];case d.BOOLEAN:return[3,3];case d.IMAGE:return[3,4];case d.IMAGE_LIST:return[3,5];case d.BRAND:return[3,6];case d.BRAND_LIST:return[3,7];case d.PRODUCT_LIST:return[3,8];case d.PRODUCT_DETAIL:return[3,9];case d.PRODUCT_ATTRIBUTE:return[3,10];case d.PRODUCT_ATTRIBUTE_LIST:return[3,11];case d.CATEGORY:return[3,12];case d.CATEGORY_LIST:return[3,13];case d.LINK:case d.LIST_OF_LINK:return[3,14];case d.COLOR:return[3,15];case d.CUSTOM:return[3,16];case d.COMPONENT:case d.COMPONENT_LIST:return[3,17];case d.BLOG:return[3,19];case d.BLOG_LIST:return[3,20];case d.BLOG_CATEGORY:return[3,21];case d.BLOG_CATEGORY_LIST:return[3,22];case d.RAFFLE:return[3,23];case d.RAFFLE_LIST:return[3,24];case d.SLIDER:return[3,25];case d.VIDEO:return[3,26]}return[3,27];case 1:return e=new y(i),[3,28];case 2:return e=new E(i),[3,28];case 3:return e=new L(i),[3,28];case 4:return e=new O(i),[3,28];case 5:return e=new I(i),[3,28];case 6:return e=new S(i),[3,28];case 7:return e=new T(i),[3,28];case 8:return o=this.theme.components.find((function(e){return e.id===r.componentId})),u=[],o&&(c=o.props.find((function(e){return e.name===a.name})))&&(u=c.excludedFields||[]),e=new v(this.pageType,n(n({},i),{excludedFields:u}),this.pageSpecificData),[3,28];case 9:return e=new m(i),[3,28];case 10:return e=new V(i),[3,28];case 11:return e=new j(i),[3,28];case 12:return e=new b(i),[3,28];case 13:return e=new C(i),[3,28];case 14:return e=new P(i,this.theme,this.linkMetaDataTargetIds),[3,28];case 15:return e=new D(i),[3,28];case 16:return(p=this.theme.customData.find((function(e){return e.id===a.customDataId})))?(e=new w(i,p,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,28]):[2];case 17:return l=i,[4,Promise.all(l.map((function(e){return f.getPageComponentPropValues(e)})))];case 18:case 29:return[2,t.sent()];case 19:return e=new A(i),[3,28];case 20:return e=new G(this.pageType,i,this.pageSpecificData),[3,28];case 21:return e=new F(i),[3,28];case 22:return e=new _(i),[3,28];case 23:return e=new B(i),[3,28];case 24:return e=new M,[3,28];case 25:return e=new R(i),[3,28];case 26:return e=new Z(i),[3,28];case 27:return[3,28];case 28:return[4,null==e?void 0:e.getValue()]}}))}))},ee.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle||null,this.page.description=e.description||null,this.page.canonicals=e.canonicals||null,this.page.disableIndex=e.disableIndex||null)},ee.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return e=[],n=[],r=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":n.push(t);break;case"RAFFLE":r.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(n,"BLOG"),this.getLinkSlugs(r,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},ee.prototype.getLinkSlugs=function(n,a){return e(this,void 0,void 0,(function(){var i,s,o=this;return t(this,(function(u){switch(u.label){case 0:return i=r(n.map((function(e){return e.id}))),s=[],i.length?[4,function(){return e(o,void 0,void 0,(function(){var e,n,r,o,u;return t(this,(function(t){switch(t.label){case 0:switch(e=[],a){case"DEFAULT":return[3,1];case"BLOG":return[3,3];case"RAFFLE":return[3,5]}return[3,7];case 1:return[4,$({targetId:{in:i}})];case 2:return n=t.sent(),e=n.data||[],[3,8];case 3:return[4,Q({targetId:{in:i}})];case 4:return r=t.sent(),e=(null===(u=r.data)||void 0===u?void 0:u.data)||[],[3,8];case 5:return[4,z({targetId:{in:i}})];case 6:return o=t.sent(),e=o.data||[],[3,8];case 7:return[3,8];case 8:return e.length&&(s=e),[2]}}))}))}()]:[2];case 1:return u.sent(),n.forEach((function(e){var t=s.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},ee.prototype.getFlatCustomData=function(e){var t=this;if(!e.nestedData||!e.nestedData.length)return[e];var n=a(e.nestedData.map((function(e){return t.getFlatCustomData(e)}))),r=[];return r.push(e),r=r.concat(n)},ee}();export{ee as IkasPageDataProvider};
1
+ import{__awaiter as e,__generator as t,__assign as n}from'./../ext/tslib/tslib.es6.js';import r from"lodash/uniq";import a from"lodash/flatten";import{makeAutoObservable as i}from"mobx";import{IkasThemeJsonPageType as s,IkasCampaignOfferProductApplicablePriceEnum as o,IkasCategoryConditionTypeEnum as u,IkasRaffleMetadataTargetType as c,IkasBlogMetaDataTargetType as p,IkasHTMLMetaDataTargetType as l,IkasThemeJsonComponentPropType as d}from"@ikas/storefront-models";import{IkasStorefrontConfig as f}from"@ikas/storefront-config";import{IkasProductFunctions as g,IkasProductVariantFunctions as h}from"@ikas/storefront-model-functions";import{IkasProductListPropValueProvider as v}from"./prop-value/product-list.js";import{IkasProductPropValueProvider as m}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as T}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as S}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as I}from"./prop-value/link.js";import{IkasImageListPropValueProvider as P}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as y}from"./prop-value/text.js";import{IkasColorPropValueProvider as D}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as L}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as O}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as b}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as C}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as w}from"./prop-value/custom.js";import{IkasSliderPropValueProvider as R}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as E}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as A}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as G}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as V}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as j}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as F}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as _}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as B}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as M}from"./prop-value/raffle-list.js";import{listMerchantSettings as k,listCustomerReviewSummary as U,searchProducts as N,listCampaignOffer as x,listProductOptionSet as q,listProductBrand as Y,listCategory as J,listBlog as K,listBlogCategory as H,listStorefrontRaffle as X,listHTMLMetaData as $,listRaffleMetaData as z,listBlogMetaData as Q}from"@ikas/storefront-api";import{populateRaffleProducts as W}from"./helpers/raffle.js";import{IkasVideoPropValueProvider as Z}from"./prop-value/video.js";var ee=function(){function ee(e,t,n){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.productReviewSummary=null,this.theme=e,this.pageParams=t||{},this.pageType=n,i(this)}return Object.defineProperty(ee.prototype,"page",{get:function(){var e=this;if(this.pageType===s.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===s.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(ee.prototype,"nextPageData",{get:function(){var e,t,r,a,i,o=[],u=[];return this.pageComponentPropValues.forEach((function(e){if(u.push({pageComponent:{id:e.pageComponent.id,componentId:e.pageComponent.componentId},propValues:e.propValues}),!o.find((function(t){return t.id===e.component.id}))){var t=n({},e.component);t.props.forEach((function(e){delete e.description,delete e.displayName,delete e.translations,delete e.groupId})),delete t.translations,delete t.defaultPropValues,delete t.displayName,delete t.description,delete t.dir,o.push(t)}})),{props:JSON.parse(JSON.stringify({propValues:u,themeJsonComponents:o,customDataList:this.theme.customData,pageSpecificData:this.pageSpecificData||null,pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||s.CUSTOM,pageTitle:(null===(t=this.page)||void 0===t?void 0:t.pageTitle)||null,pageDescription:(null===(r=this.page)||void 0===r?void 0:r.description)||null,canonicals:(null===(a=this.page)||void 0===a?void 0:a.canonicals)||null,disableIndex:(null===(i=this.page)||void 0===i?void 0:i.disableIndex)||null,settings:this.theme.settings||{},productReviewSummary:this.productReviewSummary,configJson:f.toJSON(),merchantSettings:this.getMerchantSettings()}))}},enumerable:!1,configurable:!0}),Object.defineProperty(ee.prototype,"specification",{get:function(){var e,t,n=this,r=this.page;return(null==r?void 0:r.type)===s.PRODUCT?null===(e=r.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=n.pageSpecificData)||void 0===t?void 0:t.id)})):null===(t=null==r?void 0:r.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=n.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(ee.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(ee.prototype,"$pageComponentPropValues",{get:function(){return this.pageComponentPropValues},enumerable:!1,configurable:!0}),ee.prototype.getMerchantSettings=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,k({})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.merchantSettings=e.data),[2]}}))}))},ee.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,n=this;return t(this,(function(t){switch(t.label){case 0:return this.pageSpecificData?[3,2]:[4,this.getPageSpecificData()];case 1:t.sent(),t.label=2;case 2:return this.page?[4,this.getMerchantSettings()]:[2];case 3:return t.sent(),e=this,[4,Promise.all(this.pageComponents.map((function(e){return n.getPageComponentPropValues(e)})))];case 4:return e.pageComponentPropValues=t.sent(),[4,this.setLinkSlugs()];case 5:return t.sent(),[4,this.getProductReviewSummary()];case 6:return t.sent(),[2]}}))}))},ee.prototype.getProductReviewSummary=function(){var n,r,a;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageType!==s.PRODUCT?[3,2]:[4,U({productId:{eq:null===(n=this.pageSpecificData)||void 0===n?void 0:n.id}})];case 1:(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)&&(this.productReviewSummary=e.data.data[0]),t.label=2;case 2:return[2]}}))}))},ee.prototype.getPageSpecificData=function(){var r,a,i,d;return e(this,void 0,void 0,(function(){var v,m,T,S,I,P,y,D,L,O,b=this;return t(this,(function(C){switch(C.label){case 0:return this.pageType&&![s.BRAND,s.PRODUCT,s.CATEGORY,s.BLOG,s.BLOG_CATEGORY,s.RAFFLE_DETAIL].includes(this.pageType)?[2]:(v=this.pageParams.slug)?(m=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(s.BLOG))||(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(s.BLOG_CATEGORY))?[4,Q({slug:{eq:v}})]:[3,2]):[2];case 1:return T=C.sent(),(m=(null===(i=T.data)||void 0===i?void 0:i.data)||[]).length?[3,6]:[2];case 2:return(null===(d=this.possiblePageTypes)||void 0===d?void 0:d.includes(s.RAFFLE_DETAIL))?[4,z({slug:{eq:v}})]:[3,4];case 3:return T=C.sent(),(m=T.data||[]).length?[3,6]:[2];case 4:return[4,$({slug:{eq:v}})];case 5:if(T=C.sent(),!(m=T.data||[])||!m.length)return[2];C.label=6;case 6:if(!(S=m[0]).targetId)return[2];switch(I=function(){return e(b,void 0,void 0,(function(){var e,r,a,i,u,c,p,l,d,v,m,T,I,P,y,D,L,O,b,C,w;return t(this,(function(t){switch(t.label){case 0:return[4,N({input:{productIdList:[S.targetId],priceListId:f.getPriceListId(),salesChannelId:f.getSalesChannelId()}})];case 1:return e=t.sent(),(null===(L=null===(D=null==e?void 0:e.data)||void 0===D?void 0:D.data)||void 0===L?void 0:L.length)?(r=e.data.data[0]).productOptionSetId?[4,q({id:{eq:r.productOptionSetId}})]:[3,3]:[2];case 2:(a=t.sent()).isSuccess&&(null===(O=null==a?void 0:a.data)||void 0===O?void 0:O.length)&&(r.productOptionSet=a.data[0]),t.label=3;case 3:return(null===(b=r.campaignOffers)||void 0===b?void 0:b.length)?[4,x({id:{in:r.campaignOffers.map((function(e){return e.id}))}})]:[3,6];case 4:return(i=t.sent()).isSuccess&&(null===(C=i.data)||void 0===C?void 0:C.length)?(u=i.data[0],c=[],p=[],u.offers.forEach((function(e){return c.push(e.productId)})),[4,N({input:{productIdList:c,priceListId:f.getPriceListId(),salesChannelId:f.getSalesChannelId()}})]):[3,6];case 5:(d=t.sent()).isSuccess&&d.data&&u.offers.forEach((function(e){var t,r,a=null===(r=null===(t=d.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.find((function(t){return t.id===e.productId}));if(a){var i=a.variants.filter((function(t){return h.hasStock(t)&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){return e.discountAmount?n(n({},t),{prices:t.prices.map((function(t){var r=null!==t.discountPrice?t.discountPrice:t.sellPrice,a=r,i=r-r*e.discountAmount/100;return e.applicablePrice===o.SELL_PRICE&&(a=t.sellPrice,i=t.sellPrice-t.sellPrice*e.discountAmount/100),n(n({},t),{sellPrice:a,discountPrice:i})}))}):t}));i.length&&p.push({campaignOfferId:u.id,campaignOfferProductId:e.id,product:n(n({},a),{variants:i})})}l||(l={campaignOfferId:u.id,title:e.title,description:e.description})})),r.appliedCampaignOffer=l,r.offers=p,t.label=6;case 6:return r.productGroup?[4,N({input:{productGroupId:r.productGroup.id,productGroupKey:r.productGroup.groupKey,priceListId:f.getPriceListId(),salesChannelId:f.getSalesChannelId(),perPage:200}})]:[3,8];case 7:(v=t.sent()).isSuccess&&(null===(w=v.data)||void 0===w?void 0:w.data)&&(r.productGroupItems=v.data.data.map((function(e){var t;return{productId:e.id,image:e.variants[0].images?e.variants[0].images[0].image:null,href:g.getProductHref(e),groupValues:null===(t=e.productGroup)||void 0===t?void 0:t.values}}))),t.label=8;case 8:return(m=r.variants.find((function(e){return e.isActive})))?(r.selectedVariantValues=m.variantValues,T=g.getDisplayedVariantTypes,this.pageSpecificData=r,(I=T(this.pageSpecificData,r.selectedVariantValues)).length&&(P=I[0]).displayedVariantValues.length&&(y=P.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=y.variant.variantValues),this.pageType=s.PRODUCT,this.setPageMetaData(S),[2]):[2]}}))}))},P=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,Y({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],this.pageSpecificData=n,this.pageType=s.BRAND,this.setPageMetaData(S),[2]):[2]}}))}))},y=function(){return e(b,void 0,void 0,(function(){var e,n,r,a,i,o,c,p;return t(this,(function(t){switch(t.label){case 0:return[4,J({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(o=null===(i=e.data)||void 0===i?void 0:i.data)||void 0===o?void 0:o.length)?(n=e.data.data[0]).conditions&&(r=n.conditions.find((function(e){return e.conditionType===u.PRODUCT_BRAND})))?[4,Y({id:{eq:r.valueList[0]}})]:[3,3]:[2];case 2:if(!(a=t.sent()).isSuccess||!(null===(p=null===(c=a.data)||void 0===c?void 0:c.data)||void 0===p?void 0:p.length))return[2];n.conditionValues={brand:a.data.data[0]},t.label=3;case 3:return this.pageSpecificData=n,this.pageType=s.CATEGORY,this.setPageMetaData(S),[2]}}))}))},D=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,K({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],this.pageSpecificData=n,this.pageType=s.BLOG,this.setPageMetaData(S),[2]):[2]}}))}))},L=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,H({id:{eq:S.targetId},pagination:{page:1,limit:1}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],this.pageSpecificData=n,this.pageType=s.BLOG_CATEGORY,this.setPageMetaData(S),[2]):[2]}}))}))},O=function(){return e(b,void 0,void 0,(function(){var e,n,r,a;return t(this,(function(t){switch(t.label){case 0:return[4,X({id:{eq:S.targetId}})];case 1:return(e=t.sent()).isSuccess&&(null===(a=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===a?void 0:a.length)?(n=e.data.data[0],[4,W([n])]):[2];case 2:return t.sent(),this.pageSpecificData=n,this.pageType=s.RAFFLE_DETAIL,this.setPageMetaData(S),[2]}}))}))},S.targetType){case l.BRAND:return[3,7];case l.CATEGORY:return[3,9];case l.PRODUCT:return[3,11];case p.BLOG:return[3,13];case p.BLOG_CATEGORY:return[3,15];case c.RAFFLE:return[3,17]}return[3,19];case 7:return[4,P()];case 8:return[2,C.sent()];case 9:return[4,y()];case 10:return[2,C.sent()];case 11:return[4,I()];case 12:return[2,C.sent()];case 13:return[4,D()];case 14:return[2,C.sent()];case 15:return[4,L()];case 16:return[2,C.sent()];case 17:return[4,O()];case 18:return[2,C.sent()];case 19:return[3,20];case 20:return[2]}}))}))},ee.prototype.getPageComponentPropValues=function(n){return e(this,void 0,void 0,(function(){var r,a,i,s=this;return t(this,(function(o){switch(o.label){case 0:return r=this.theme.components.find((function(e){return e.id===n.componentId})),a={pageComponent:n,component:r,propValues:{}},i=function(r){return e(s,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,i=r.name,[4,this.getPageComponentPropValue(n,r)];case 1:return e[i]=t.sent(),[2]}}))}))},[4,Promise.all(r.props.map(i))];case 1:return o.sent(),[2,a]}}))}))},ee.prototype.getPageComponentPropValue=function(r,a){return e(this,void 0,void 0,(function(){var e,i,s,o,u,c,p,l,f,g,h=this;return t(this,(function(t){switch(t.label){case 0:if(i=r.propValues[a.name],s=[d.RAFFLE_LIST],null==i&&!s.includes(a.type))return[2,null];switch(a.type){case d.TEXT:return[3,1];case d.RICH_TEXT:return[3,2];case d.BOOLEAN:return[3,3];case d.IMAGE:return[3,4];case d.IMAGE_LIST:return[3,5];case d.BRAND:return[3,6];case d.BRAND_LIST:return[3,7];case d.PRODUCT_LIST:return[3,8];case d.PRODUCT_DETAIL:return[3,9];case d.PRODUCT_ATTRIBUTE:return[3,10];case d.PRODUCT_ATTRIBUTE_LIST:return[3,11];case d.CATEGORY:return[3,12];case d.CATEGORY_LIST:return[3,13];case d.LINK:case d.LIST_OF_LINK:return[3,14];case d.COLOR:return[3,15];case d.CUSTOM:return[3,16];case d.COMPONENT:case d.COMPONENT_LIST:return[3,17];case d.BLOG:return[3,19];case d.BLOG_LIST:return[3,20];case d.BLOG_CATEGORY:return[3,21];case d.BLOG_CATEGORY_LIST:return[3,22];case d.RAFFLE:return[3,23];case d.RAFFLE_LIST:return[3,24];case d.SLIDER:return[3,25];case d.VIDEO:return[3,26]}return[3,27];case 1:return e=new y(i),[3,28];case 2:return e=new E(i),[3,28];case 3:return e=new L(i),[3,28];case 4:return e=new O(i),[3,28];case 5:return e=new P(i),[3,28];case 6:return e=new S(i),[3,28];case 7:return e=new T(i),[3,28];case 8:return o=this.theme.components.find((function(e){return e.id===r.componentId})),u=[],o&&(l=o.props.find((function(e){return e.name===a.name})))&&(u=l.excludedFields||[]),e=new v(this.pageType,n(n({},i),{excludedFields:u}),this.pageSpecificData),[3,28];case 9:return e=new m(i),[3,28];case 10:return e=new V(i),[3,28];case 11:return e=new j(i),[3,28];case 12:return c=this.theme.components.find((function(e){return e.id===r.componentId})),p=[],c&&(l=c.props.find((function(e){return e.name===a.name})))&&(p=l.excludedFieldsCategory||[]),e=new b(n(n({},i),{excludedFieldsCategory:p})),[3,28];case 13:return e=new C(i),[3,28];case 14:return e=new I(i,this.theme,this.linkMetaDataTargetIds),[3,28];case 15:return e=new D(i),[3,28];case 16:return(f=this.theme.customData.find((function(e){return e.id===a.customDataId})))?(e=new w(i,f,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,28]):[2];case 17:return g=i,[4,Promise.all(g.map((function(e){return h.getPageComponentPropValues(e)})))];case 18:case 29:return[2,t.sent()];case 19:return e=new A(i),[3,28];case 20:return e=new G(this.pageType,i,this.pageSpecificData),[3,28];case 21:return e=new F(i),[3,28];case 22:return e=new _(i),[3,28];case 23:return e=new B(i),[3,28];case 24:return e=new M,[3,28];case 25:return e=new R(i),[3,28];case 26:return e=new Z(i),[3,28];case 27:return[3,28];case 28:return[4,null==e?void 0:e.getValue()]}}))}))},ee.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle||null,this.page.description=e.description||null,this.page.canonicals=e.canonicals||null,this.page.disableIndex=e.disableIndex||null)},ee.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return e=[],n=[],r=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":n.push(t);break;case"RAFFLE":r.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(n,"BLOG"),this.getLinkSlugs(r,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},ee.prototype.getLinkSlugs=function(n,a){return e(this,void 0,void 0,(function(){var i,s,o=this;return t(this,(function(u){switch(u.label){case 0:return i=r(n.map((function(e){return e.id}))),s=[],i.length?[4,function(){return e(o,void 0,void 0,(function(){var e,n,r,o,u;return t(this,(function(t){switch(t.label){case 0:switch(e=[],a){case"DEFAULT":return[3,1];case"BLOG":return[3,3];case"RAFFLE":return[3,5]}return[3,7];case 1:return[4,$({targetId:{in:i}})];case 2:return n=t.sent(),e=n.data||[],[3,8];case 3:return[4,Q({targetId:{in:i}})];case 4:return r=t.sent(),e=(null===(u=r.data)||void 0===u?void 0:u.data)||[],[3,8];case 5:return[4,z({targetId:{in:i}})];case 6:return o=t.sent(),e=o.data||[],[3,8];case 7:return[3,8];case 8:return e.length&&(s=e),[2]}}))}))}()]:[2];case 1:return u.sent(),n.forEach((function(e){var t=s.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},ee.prototype.getFlatCustomData=function(e){var t=this;if(!e.nestedData||!e.nestedData.length)return[e];var n=a(e.nestedData.map((function(e){return t.getFlatCustomData(e)}))),r=[];return r.push(e),r=r.concat(n)},ee}();export{ee as IkasPageDataProvider};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.js';import{listCategory as r}from"@ikas/storefront-api";import{getPlaceholderCategory as o}from"../placeholders.js";var a=function(){function a(t){this.categoryPropValue=t}return a.prototype.getValue=function(){var a,l;return t(this,void 0,void 0,(function(){var t,u;return e(this,(function(e){switch(e.label){case 0:if(this.categoryPropValue.usePageData)return[2,{category:null,categoryPropValue:this.categoryPropValue}];if(!this.categoryPropValue.categoryId)return[2,null];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r({id:{eq:this.categoryPropValue.categoryId}})];case 2:return t=e.sent(),[2,{category:(null===(l=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===l?void 0:l.length)?t.data.data[0]:o(),categoryPropValue:this.categoryPropValue}];case 3:return u=e.sent(),console.log(u),[3,4];case 4:return[2,null]}}))}))},a}();export{a as IkasCategoryPropValueProvider};
1
+ import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import{listCategory as r}from"@ikas/storefront-api";import{getPlaceholderCategory as o}from"../placeholders.js";var a=function(){function a(e){this.categoryPropValue=e}return a.prototype.getValue=function(){var a,l;return e(this,void 0,void 0,(function(){var e,u;return t(this,(function(t){switch(t.label){case 0:if(this.categoryPropValue.usePageData)return[2,{category:null,categoryPropValue:this.categoryPropValue}];if(!this.categoryPropValue.categoryId)return[2,null];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r({id:{eq:this.categoryPropValue.categoryId}},this.categoryPropValue.excludedFieldsCategory)];case 2:return e=t.sent(),[2,{category:(null===(l=null===(a=e.data)||void 0===a?void 0:a.data)||void 0===l?void 0:l.length)?e.data.data[0]:o(),categoryPropValue:this.categoryPropValue}];case 3:return u=t.sent(),console.log(u),[3,4];case 4:return[2,null]}}))}))},a}();export{a as IkasCategoryPropValueProvider};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import a from"lodash/cloneDeep";import{IkasBrandListPropValueProvider as s}from"./brand-list.js";import{IkasBrandPropValueProvider as u}from"./brand.js";import{IkasCategoryListPropValueProvider as i}from"./category-list.js";import{IkasCategoryPropValueProvider as n}from"./category.js";import{IkasColorPropValueProvider as o}from"./color.js";import{IkasBooleanPropValueProvider as c}from"./boolean.js";import{IkasTextPropValueProvider as l}from"./text.js";import{IkasImageListPropValueProvider as h}from"./image-list.js";import{IkasImagePropValueProvider as d}from"./image.js";import{IkasVideoPropValueProvider as p}from"./video.js";import{IkasLinkPropValueProvider as m}from"./link.js";import{IkasProductPropValueProvider as f}from"./product-detail.js";import{IkasProductListPropValueProvider as g}from"./product-list.js";import{IkasRichTextPropValueProvider as v}from"./rich-text.js";import{IkasBlogPropValueProvider as D}from"./blog.js";import{IkasBlogListPropValueProvider as V}from"./blog-list.js";import{IkasAttributePropValueProvider as w}from"./attribute.js";import{IkasAttributeListPropValueProvider as I}from"./attribute-list.js";import{IkasBlogCategoryPropValueProvider as y}from"./blog-category.js";import{IkasBlogCategoryListPropValueProvider as P}from"./blog-category-list.js";import{IkasRaffleListPropValueProvider as T}from"./raffle-list.js";import{IkasRafflePropValueProvider as b}from"./raffle.js";import{IkasSliderPropValueProvider as L}from"./slider.js";import{IkasThemeJsonComponentPropType as R}from"@ikas/storefront-models";var C=function(){function C(t,e,r,a,s,u,i){this.value=t,this.customData=e,this.theme=r,this.pageType=a,this.pageDataProvider=s,this.pageSpecificData=u,this.pageParams=i}return C.prototype.getValue=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if((void 0===this.value||null===this.value)&&this.customData.type!==R.RAFFLE_LIST)return[2,{value:null,customDataId:this.customData.id}];e.label=1;case 1:switch(e.trys.push([1,60,,61]),this.customData.type){case R.TEXT:return[3,2];case R.RICH_TEXT:return[3,4];case R.BOOLEAN:return[3,6];case R.BRAND_LIST:return[3,8];case R.BRAND:return[3,10];case R.CATEGORY_LIST:return[3,12];case R.CATEGORY:return[3,14];case R.COLOR:return[3,16];case R.IMAGE_LIST:return[3,18];case R.IMAGE:return[3,20];case R.LINK:case R.LIST_OF_LINK:return[3,22];case R.PRODUCT_DETAIL:return[3,24];case R.PRODUCT_LIST:return[3,26];case R.PRODUCT_ATTRIBUTE:return[3,28];case R.PRODUCT_ATTRIBUTE_LIST:return[3,30];case R.OBJECT:return[3,32];case R.DYNAMIC_LIST:case R.STATIC_LIST:return[3,34];case R.ENUM:return[3,36];case R.CUSTOM:return[3,38];case R.COMPONENT:case R.COMPONENT_LIST:return[3,40];case R.BLOG:return[3,42];case R.BLOG_LIST:return[3,44];case R.BLOG_CATEGORY:return[3,46];case R.BLOG_CATEGORY_LIST:return[3,48];case R.RAFFLE:return[3,50];case R.RAFFLE_LIST:return[3,52];case R.SLIDER:return[3,54];case R.VIDEO:return[3,56]}return[3,58];case 2:return[4,this.getTextValue()];case 3:return t=e.sent(),[3,59];case 4:return[4,this.getRichTextPropValue()];case 5:return t=e.sent(),[3,59];case 6:return[4,this.getBooleanValue()];case 7:return t=e.sent(),[3,59];case 8:return[4,this.getBrandListPropValue()];case 9:return t=e.sent(),[3,59];case 10:return[4,this.getBrandPropValue()];case 11:return t=e.sent(),[3,59];case 12:return[4,this.getCategoryListPropValue()];case 13:return t=e.sent(),[3,59];case 14:return[4,this.getCategoryPropValue()];case 15:return t=e.sent(),[3,59];case 16:return[4,this.getColorPropValue()];case 17:return t=e.sent(),[3,59];case 18:return[4,this.getImageListPropValue()];case 19:return t=e.sent(),[3,59];case 20:return[4,this.getImagePropValue()];case 21:return t=e.sent(),[3,59];case 22:return[4,this.getLinkPropValue()];case 23:return t=e.sent(),[3,59];case 24:return[4,this.getProductDetailPropValue()];case 25:return t=e.sent(),[3,59];case 26:return[4,this.getProductListPropValue()];case 27:return t=e.sent(),[3,59];case 28:return[4,this.getProductAttributePropValue()];case 29:return t=e.sent(),[3,59];case 30:return[4,this.getProductAttributeListPropValue()];case 31:return t=e.sent(),[3,59];case 32:return[4,this.getObjectValue()];case 33:return t=e.sent(),[3,59];case 34:return[4,this.getArrayValue()];case 35:return t=e.sent(),[3,59];case 36:return[4,this.getEnumValue()];case 37:return t=e.sent(),[3,59];case 38:return[4,this.getCustomDataValue()];case 39:return t=e.sent(),[3,59];case 40:return[4,this.getComponentListValue()];case 41:return t=e.sent(),[3,59];case 42:return[4,this.getBlogValue()];case 43:return t=e.sent(),[3,59];case 44:return[4,this.getBlogListValue()];case 45:return t=e.sent(),[3,59];case 46:return[4,this.getBlogCategoryValue()];case 47:return t=e.sent(),[3,59];case 48:return[4,this.getBlogCategoryListValue()];case 49:return t=e.sent(),[3,59];case 50:return[4,this.getRaffleValue()];case 51:return t=e.sent(),[3,59];case 52:return[4,this.getRaffleListValue()];case 53:return t=e.sent(),[3,59];case 54:return[4,this.getSliderValue()];case 55:return t=e.sent(),[3,59];case 56:return[4,this.getVideoPropValue()];case 57:return t=e.sent(),[3,59];case 58:return[3,59];case 59:return[3,61];case 60:return e.sent(),[2];case 61:return!this.customData.isRequired||void 0!==(null==t?void 0:t.value)&&null!==(null==t?void 0:t.value)?[2,t]:[2]}}))}))},C.prototype.getBooleanValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new c(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBrandListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new s(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBrandPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new u(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getCategoryListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new i(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getCategoryPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new n(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getColorPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new o(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getRichTextPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new v(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getImageListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new h(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getImagePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new d(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getLinkPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new m(this.value,this.theme,this.pageDataProvider.linkMetaDataTargetIds).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductDetailPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new f(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new g(this.pageType,r(r({},this.value),{excludedFields:this.customData.excludedFields}),this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductAttributePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new w(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductAttributeListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new I(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getTextValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new l(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getObjectValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,s,u,i;return e(this,(function(e){switch(e.label){case 0:t={},r=0,a=this.customData.nestedData||[],e.label=1;case 1:if(!(r<a.length))return[3,4];if(!(s=a[r]).key)return[3,3];if(u=this.value[s.key],s.isRequired&&s.type!==R.RAFFLE_LIST&&null==u)throw new Error("Required data is missing");return[4,new C(u,s,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(i=e.sent(),s.isRequired&&null==i)throw new Error("Required data is missing");t[s.key]=i,e.label=3;case 3:return r++,[3,1];case 4:return[2,{value:t,customDataId:this.customData.id}]}}))}))},C.prototype.getArrayValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,s,u,i;return e(this,(function(e){switch(e.label){case 0:if(!this.value||!Array.isArray(this.value))throw new Error("Incorrect data!");t=[],r=this.customData.nestedData[0],a=0,s=this.value,e.label=1;case 1:if(!(a<s.length))return[3,4];if(u=s[a],r.isRequired&&r.type!==R.RAFFLE_LIST&&null==u)throw new Error("Required data is missing");return[4,new C(u,r,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(i=e.sent(),r.isRequired&&null==i)throw new Error("Required data is missing");t.push(i),e.label=3;case 3:return a++,[3,1];case 4:return[2,{value:t,customDataId:this.customData.id}]}}))}))},C.prototype.getEnumValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,{value:this.value,customDataId:this.customData.id}]}))}))},C.prototype.getCustomDataValue=function(){return t(this,void 0,void 0,(function(){var t,r=this;return e(this,(function(e){switch(e.label){case 0:return(t=this.theme.customData.find((function(t){return t.id===r.customData.customDataId})))?((t=a(t)).isRequired=this.customData.isRequired,[4,new C(this.value,t,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()]):[2,{value:null,customDataId:this.customData.id}];case 1:return[2,e.sent()]}}))}))},C.prototype.getComponentListValue=function(){return t(this,void 0,void 0,(function(){var t,a,s=this;return e(this,(function(e){switch(e.label){case 0:return t=this.value?this.value.map((function(t){return r({},t)})):[],a={},[4,Promise.all(t.map((function(t){return s.pageDataProvider.getPageComponentPropValues(t)})))];case 1:return[2,(a.value=e.sent(),a.customDataId=this.customData.id,a)]}}))}))},C.prototype.getBlogValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new D(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBlogListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new V(this.pageType,this.value,this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBlogCategoryValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new y(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBlogCategoryListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new P(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getRaffleValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new b(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getRaffleListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,(new T).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getSliderValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new L(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getVideoPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new p(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C}();export{C as IkasCustomPropValueProvider};
1
+ import{__awaiter as t,__generator as e,__assign as r}from'./../../ext/tslib/tslib.es6.js';import a from"lodash/cloneDeep";import{IkasBrandListPropValueProvider as s}from"./brand-list.js";import{IkasBrandPropValueProvider as u}from"./brand.js";import{IkasCategoryListPropValueProvider as i}from"./category-list.js";import{IkasCategoryPropValueProvider as n}from"./category.js";import{IkasColorPropValueProvider as o}from"./color.js";import{IkasBooleanPropValueProvider as c}from"./boolean.js";import{IkasTextPropValueProvider as l}from"./text.js";import{IkasImageListPropValueProvider as h}from"./image-list.js";import{IkasImagePropValueProvider as d}from"./image.js";import{IkasVideoPropValueProvider as p}from"./video.js";import{IkasLinkPropValueProvider as m}from"./link.js";import{IkasProductPropValueProvider as f}from"./product-detail.js";import{IkasProductListPropValueProvider as g}from"./product-list.js";import{IkasRichTextPropValueProvider as v}from"./rich-text.js";import{IkasBlogPropValueProvider as D}from"./blog.js";import{IkasBlogListPropValueProvider as V}from"./blog-list.js";import{IkasAttributePropValueProvider as w}from"./attribute.js";import{IkasAttributeListPropValueProvider as I}from"./attribute-list.js";import{IkasBlogCategoryPropValueProvider as y}from"./blog-category.js";import{IkasBlogCategoryListPropValueProvider as P}from"./blog-category-list.js";import{IkasRaffleListPropValueProvider as T}from"./raffle-list.js";import{IkasRafflePropValueProvider as b}from"./raffle.js";import{IkasSliderPropValueProvider as L}from"./slider.js";import{IkasThemeJsonComponentPropType as R}from"@ikas/storefront-models";var C=function(){function C(t,e,r,a,s,u,i){this.value=t,this.customData=e,this.theme=r,this.pageType=a,this.pageDataProvider=s,this.pageSpecificData=u,this.pageParams=i}return C.prototype.getValue=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if((void 0===this.value||null===this.value)&&this.customData.type!==R.RAFFLE_LIST)return[2,{value:null,customDataId:this.customData.id}];e.label=1;case 1:switch(e.trys.push([1,60,,61]),this.customData.type){case R.TEXT:return[3,2];case R.RICH_TEXT:return[3,4];case R.BOOLEAN:return[3,6];case R.BRAND_LIST:return[3,8];case R.BRAND:return[3,10];case R.CATEGORY_LIST:return[3,12];case R.CATEGORY:return[3,14];case R.COLOR:return[3,16];case R.IMAGE_LIST:return[3,18];case R.IMAGE:return[3,20];case R.LINK:case R.LIST_OF_LINK:return[3,22];case R.PRODUCT_DETAIL:return[3,24];case R.PRODUCT_LIST:return[3,26];case R.PRODUCT_ATTRIBUTE:return[3,28];case R.PRODUCT_ATTRIBUTE_LIST:return[3,30];case R.OBJECT:return[3,32];case R.DYNAMIC_LIST:case R.STATIC_LIST:return[3,34];case R.ENUM:return[3,36];case R.CUSTOM:return[3,38];case R.COMPONENT:case R.COMPONENT_LIST:return[3,40];case R.BLOG:return[3,42];case R.BLOG_LIST:return[3,44];case R.BLOG_CATEGORY:return[3,46];case R.BLOG_CATEGORY_LIST:return[3,48];case R.RAFFLE:return[3,50];case R.RAFFLE_LIST:return[3,52];case R.SLIDER:return[3,54];case R.VIDEO:return[3,56]}return[3,58];case 2:return[4,this.getTextValue()];case 3:return t=e.sent(),[3,59];case 4:return[4,this.getRichTextPropValue()];case 5:return t=e.sent(),[3,59];case 6:return[4,this.getBooleanValue()];case 7:return t=e.sent(),[3,59];case 8:return[4,this.getBrandListPropValue()];case 9:return t=e.sent(),[3,59];case 10:return[4,this.getBrandPropValue()];case 11:return t=e.sent(),[3,59];case 12:return[4,this.getCategoryListPropValue()];case 13:return t=e.sent(),[3,59];case 14:return[4,this.getCategoryPropValue()];case 15:return t=e.sent(),[3,59];case 16:return[4,this.getColorPropValue()];case 17:return t=e.sent(),[3,59];case 18:return[4,this.getImageListPropValue()];case 19:return t=e.sent(),[3,59];case 20:return[4,this.getImagePropValue()];case 21:return t=e.sent(),[3,59];case 22:return[4,this.getLinkPropValue()];case 23:return t=e.sent(),[3,59];case 24:return[4,this.getProductDetailPropValue()];case 25:return t=e.sent(),[3,59];case 26:return[4,this.getProductListPropValue()];case 27:return t=e.sent(),[3,59];case 28:return[4,this.getProductAttributePropValue()];case 29:return t=e.sent(),[3,59];case 30:return[4,this.getProductAttributeListPropValue()];case 31:return t=e.sent(),[3,59];case 32:return[4,this.getObjectValue()];case 33:return t=e.sent(),[3,59];case 34:return[4,this.getArrayValue()];case 35:return t=e.sent(),[3,59];case 36:return[4,this.getEnumValue()];case 37:return t=e.sent(),[3,59];case 38:return[4,this.getCustomDataValue()];case 39:return t=e.sent(),[3,59];case 40:return[4,this.getComponentListValue()];case 41:return t=e.sent(),[3,59];case 42:return[4,this.getBlogValue()];case 43:return t=e.sent(),[3,59];case 44:return[4,this.getBlogListValue()];case 45:return t=e.sent(),[3,59];case 46:return[4,this.getBlogCategoryValue()];case 47:return t=e.sent(),[3,59];case 48:return[4,this.getBlogCategoryListValue()];case 49:return t=e.sent(),[3,59];case 50:return[4,this.getRaffleValue()];case 51:return t=e.sent(),[3,59];case 52:return[4,this.getRaffleListValue()];case 53:return t=e.sent(),[3,59];case 54:return[4,this.getSliderValue()];case 55:return t=e.sent(),[3,59];case 56:return[4,this.getVideoPropValue()];case 57:return t=e.sent(),[3,59];case 58:return[3,59];case 59:return[3,61];case 60:return e.sent(),[2];case 61:return!this.customData.isRequired||void 0!==(null==t?void 0:t.value)&&null!==(null==t?void 0:t.value)?[2,t]:[2]}}))}))},C.prototype.getBooleanValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new c(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBrandListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new s(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBrandPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new u(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getCategoryListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new i(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getCategoryPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new n(r(r({},this.value),{excludedFieldsCategory:this.customData.excludedFieldsCategory})).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getColorPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new o(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getRichTextPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new v(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getImageListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new h(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getImagePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new d(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getLinkPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new m(this.value,this.theme,this.pageDataProvider.linkMetaDataTargetIds).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductDetailPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new f(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new g(this.pageType,r(r({},this.value),{excludedFields:this.customData.excludedFields}),this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductAttributePropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new w(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getProductAttributeListPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new I(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getTextValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new l(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getObjectValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,s,u,i;return e(this,(function(e){switch(e.label){case 0:t={},r=0,a=this.customData.nestedData||[],e.label=1;case 1:if(!(r<a.length))return[3,4];if(!(s=a[r]).key)return[3,3];if(u=this.value[s.key],s.isRequired&&s.type!==R.RAFFLE_LIST&&null==u)throw new Error("Required data is missing");return[4,new C(u,s,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(i=e.sent(),s.isRequired&&null==i)throw new Error("Required data is missing");t[s.key]=i,e.label=3;case 3:return r++,[3,1];case 4:return[2,{value:t,customDataId:this.customData.id}]}}))}))},C.prototype.getArrayValue=function(){return t(this,void 0,void 0,(function(){var t,r,a,s,u,i;return e(this,(function(e){switch(e.label){case 0:if(!this.value||!Array.isArray(this.value))throw new Error("Incorrect data!");t=[],r=this.customData.nestedData[0],a=0,s=this.value,e.label=1;case 1:if(!(a<s.length))return[3,4];if(u=s[a],r.isRequired&&r.type!==R.RAFFLE_LIST&&null==u)throw new Error("Required data is missing");return[4,new C(u,r,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()];case 2:if(i=e.sent(),r.isRequired&&null==i)throw new Error("Required data is missing");t.push(i),e.label=3;case 3:return a++,[3,1];case 4:return[2,{value:t,customDataId:this.customData.id}]}}))}))},C.prototype.getEnumValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,{value:this.value,customDataId:this.customData.id}]}))}))},C.prototype.getCustomDataValue=function(){return t(this,void 0,void 0,(function(){var t,r=this;return e(this,(function(e){switch(e.label){case 0:return(t=this.theme.customData.find((function(t){return t.id===r.customData.customDataId})))?((t=a(t)).isRequired=this.customData.isRequired,[4,new C(this.value,t,this.theme,this.pageType,this.pageDataProvider,this.pageSpecificData).getValue()]):[2,{value:null,customDataId:this.customData.id}];case 1:return[2,e.sent()]}}))}))},C.prototype.getComponentListValue=function(){return t(this,void 0,void 0,(function(){var t,a,s=this;return e(this,(function(e){switch(e.label){case 0:return t=this.value?this.value.map((function(t){return r({},t)})):[],a={},[4,Promise.all(t.map((function(t){return s.pageDataProvider.getPageComponentPropValues(t)})))];case 1:return[2,(a.value=e.sent(),a.customDataId=this.customData.id,a)]}}))}))},C.prototype.getBlogValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new D(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBlogListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new V(this.pageType,this.value,this.pageSpecificData).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBlogCategoryValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new y(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getBlogCategoryListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new P(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getRaffleValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new b(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getRaffleListValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,(new T).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getSliderValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new L(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C.prototype.getVideoPropValue=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,new p(this.value).getValue()];case 1:return[2,{value:t.sent(),customDataId:this.customData.id}]}}))}))},C}();export{C as IkasCustomPropValueProvider};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as e}from"@ikas/storefront-models";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductListType as a,IkasRelatedProductsType as r,IkasProductListSortType as o}from"../../models/ui/product-list/index.js";import{getInitial as s}from"../../models/ui/product-list/init.js";var d=function(){function d(t,i,e){this.relatedProductData=null,this.viewedTogetherProductData=null,this.pageType=t,this.productListPropValue=i,this.pageSpecificData=e,this.relatedProductData=null,this.viewedTogetherProductData=null}return d.prototype.getValue=function(){var d,p;return t(this,void 0,void 0,(function(){var t,u,c,l,h;return i(this,(function(i){switch(i.label){case 0:return this.productListPropValue.productListType===a.ALL&&this.productListPropValue.usePageFilter&&(this.pageType===e.CATEGORY?(c=this.pageSpecificData,u=c.id):this.pageType===e.BRAND&&(l=this.pageSpecificData,t=l.id)),this.productListPropValue.productListType===a.CATEGORY&&this.productListPropValue.category&&(u=this.productListPropValue.category),this.pageType===e.PRODUCT&&this.productListPropValue.productListType===a.RELATED_PRODUCTS&&this.productListPropValue.relatedProductsType&&this.pageSpecificData&&(this.relatedProductData={brandIds:null,categoryIds:null,productId:""},this.productListPropValue.relatedProductsType===r.CATEGORY?this.relatedProductData.categoryIds=this.pageSpecificData.categories.map((function(t){return t.id})):this.relatedProductData.brandIds=[null===(p=null===(d=this.pageSpecificData)||void 0===d?void 0:d.brand)||void 0===p?void 0:p.id],this.relatedProductData.productId=this.pageSpecificData.id),this.pageType===e.PRODUCT&&this.productListPropValue.productListType===a.VIEWED_TOGETHER&&this.pageSpecificData&&(this.viewedTogetherProductData={productIds:[]},this.viewedTogetherProductData.productIds=[this.pageSpecificData.id]),h={data:[],count:0,page:1,limit:this.productListPropValue.initialLimit||10,type:this.productListPropValue.productListType||a.ALL,sort:this.productListPropValue.initialSort||o.LAST_ADDED,productListPropValue:this.productListPropValue,filterBrandId:t,filterCategoryId:u,pageType:this.pageType,pageSpecificData:[e.CATEGORY,e.BRAND].includes(this.pageType)?this.pageSpecificData:void 0,relatedProductData:this.relatedProductData,viewedTogetherProductData:this.viewedTogetherProductData,excludedFields:this.productListPropValue.excludedFields,filters:null,infiniteScrollPage:null},[4,s(h)];case 1:return i.sent(),h.pageSpecificData=null,[2,h]}}))}))},d}();export{d as IkasProductListPropValueProvider};
1
+ import{__awaiter as t,__generator as i}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as e}from"@ikas/storefront-models";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductListType as r,IkasRelatedProductsType as a,IkasProductListSortType as o}from"../../models/ui/product-list/index.js";import{getInitial as s}from"../../models/ui/product-list/init.js";var d=function(){function d(t,i,e){this.relatedProductData=null,this.viewedTogetherProductData=null,this.pageType=t,this.productListPropValue=i,this.pageSpecificData=e,this.relatedProductData=null,this.viewedTogetherProductData=null}return d.prototype.getValue=function(){var d,p;return t(this,void 0,void 0,(function(){var t,u,c,l,h;return i(this,(function(i){switch(i.label){case 0:return this.productListPropValue.productListType===r.ALL&&this.productListPropValue.usePageFilter&&(this.pageType===e.CATEGORY?(c=this.pageSpecificData,u=c.id):this.pageType===e.BRAND&&(l=this.pageSpecificData,t=l.id)),this.productListPropValue.productListType===r.CATEGORY&&this.productListPropValue.category&&(u=this.productListPropValue.category),this.pageType===e.PRODUCT&&this.productListPropValue.productListType===r.RELATED_PRODUCTS&&this.productListPropValue.relatedProductsType&&this.pageSpecificData&&(this.relatedProductData={brandIds:null,categoryIds:null,productId:""},this.productListPropValue.relatedProductsType===a.CATEGORY?this.relatedProductData.categoryIds=this.pageSpecificData.categories.map((function(t){return t.id})):this.relatedProductData.brandIds=[null===(p=null===(d=this.pageSpecificData)||void 0===d?void 0:d.brand)||void 0===p?void 0:p.id],this.relatedProductData.productId=this.pageSpecificData.id),this.pageType===e.PRODUCT&&this.productListPropValue.productListType===r.VIEWED_TOGETHER&&this.pageSpecificData&&(this.viewedTogetherProductData={productIds:[]},this.viewedTogetherProductData.productIds=[this.pageSpecificData.id]),h={data:[],count:0,page:1,limit:this.productListPropValue.initialLimit||10,type:this.productListPropValue.productListType||r.ALL,sort:this.productListPropValue.initialSort||o.LAST_ADDED,productListPropValue:this.productListPropValue,filterBrandId:t,filterCategoryId:u,pageType:this.pageType,pageSpecificData:null,relatedProductData:this.relatedProductData,viewedTogetherProductData:this.viewedTogetherProductData,excludedFields:this.productListPropValue.excludedFields,filters:null,infiniteScrollPage:null},[4,s(h)];case 1:return i.sent(),h.pageSpecificData=null,[2,h]}}))}))},d}();export{d as IkasProductListPropValueProvider};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-providers",
3
- "version": "4.13.18",
3
+ "version": "4.14.1",
4
4
  "description": "Data providers for ikas storefront theme components.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,10 +17,10 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@rollup/plugin-commonjs": "^22.0.0",
20
- "@ikas/storefront-api": "^4.13.18",
21
- "@ikas/storefront-config": "^4.13.18",
22
- "@ikas/storefront-model-functions": "^4.13.18",
23
- "@ikas/storefront-models": "^4.13.18",
20
+ "@ikas/storefront-api": "^4.14.1",
21
+ "@ikas/storefront-config": "^4.14.1",
22
+ "@ikas/storefront-model-functions": "^4.14.1",
23
+ "@ikas/storefront-models": "^4.14.1",
24
24
  "@rollup/plugin-node-resolve": "^13.3.0",
25
25
  "rollup-plugin-rename-node-modules": "^1.2.0",
26
26
  "@types/lodash": "^4.14.168",
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "peerDependencies": {
40
40
  "mobx": "^6.1.3",
41
- "@ikas/storefront-api": "^4.13.18",
42
- "@ikas/storefront-config": "^4.13.18",
43
- "@ikas/storefront-model-functions": "^4.13.18",
44
- "@ikas/storefront-models": "^4.13.18",
41
+ "@ikas/storefront-api": "^4.14.1",
42
+ "@ikas/storefront-config": "^4.14.1",
43
+ "@ikas/storefront-model-functions": "^4.14.1",
44
+ "@ikas/storefront-models": "^4.14.1",
45
45
  "lodash": "^4.17.21"
46
46
  }
47
47
  }