@ikas/storefront 2.0.52 → 2.0.54

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.
@@ -8,6 +8,7 @@ export declare class IkasThemePage {
8
8
  description: string | null;
9
9
  components: IkasThemePageComponent[];
10
10
  specifications: IkasThemePageSpecification[] | null;
11
+ canonicalUrl: string | null;
11
12
  constructor(data: Partial<IkasThemePage>);
12
13
  }
13
14
  export declare class IkasThemePageSpecification {
@@ -1 +1 @@
1
- import{makeAutoObservable as n}from"mobx";import{IkasThemePageComponent as R}from"./component/index.js";var O,t=function(t){this.id=t.id||Date.now()+"",this.name=t.name||null,this.type=t.type||O.INDEX,this.slug=t.slug||null,this.pageTitle=t.pageTitle||null,this.description=t.description||null,this.components=t.components?t.components.map((function(n){return new R(n)})):[],this.specifications=t.specifications?t.specifications.map((function(n){return new E(n)})):null,n(this)},E=function(O){this.id=O.id||"",this.components=O.components?O.components.map((function(n){return new R(n)})):[],n(this)};!function(n){n.INDEX="INDEX",n.CATEGORY="CATEGORY",n.BRAND="BRAND",n.PRODUCT="PRODUCT",n.CUSTOM="CUSTOM",n.ACCOUNT="ACCOUNT",n.ADDRESSES="ADDRESSES",n.ORDERS="ORDERS",n.ORDER_DETAIL="ORDER_DETAIL",n.LOGIN="LOGIN",n.REGISTER="REGISTER",n.FORGOT_PASSWORD="FORGOT_PASSWORD",n.RECOVER_PASSWORD="RECOVER_PASSWORD",n.CART="CART",n.FAVORITE_PRODUCTS="FAVORITE_PRODUCTS",n.SEARCH="SEARCH",n.NOT_FOUND="NOT_FOUND",n.BLOG="BLOG",n.BLOG_INDEX="BLOG_INDEX",n.BLOG_CATEGORY="BLOG_CATEGORY",n.CHECKOUT="CHECKOUT",n.RAFFLE="RAFFLE",n.RAFFLE_DETAIL="RAFFLE_DETAIL",n.RAFFLE_ACCOUNT="RAFFLE_ACCOUNT"}(O||(O={}));export{t as IkasThemePage,E as IkasThemePageSpecification,O as IkasThemePageType};
1
+ import{makeAutoObservable as n}from"mobx";import{IkasThemePageComponent as R}from"./component/index.js";var O,i=function(i){this.id=i.id||Date.now()+"",this.name=i.name||null,this.type=i.type||O.INDEX,this.slug=i.slug||null,this.pageTitle=i.pageTitle||null,this.description=i.description||null,this.components=i.components?i.components.map((function(n){return new R(n)})):[],this.specifications=i.specifications?i.specifications.map((function(n){return new t(n)})):null,this.canonicalUrl=i.canonicalUrl||null,n(this)},t=function(O){this.id=O.id||"",this.components=O.components?O.components.map((function(n){return new R(n)})):[],n(this)};!function(n){n.INDEX="INDEX",n.CATEGORY="CATEGORY",n.BRAND="BRAND",n.PRODUCT="PRODUCT",n.CUSTOM="CUSTOM",n.ACCOUNT="ACCOUNT",n.ADDRESSES="ADDRESSES",n.ORDERS="ORDERS",n.ORDER_DETAIL="ORDER_DETAIL",n.LOGIN="LOGIN",n.REGISTER="REGISTER",n.FORGOT_PASSWORD="FORGOT_PASSWORD",n.RECOVER_PASSWORD="RECOVER_PASSWORD",n.CART="CART",n.FAVORITE_PRODUCTS="FAVORITE_PRODUCTS",n.SEARCH="SEARCH",n.NOT_FOUND="NOT_FOUND",n.BLOG="BLOG",n.BLOG_INDEX="BLOG_INDEX",n.BLOG_CATEGORY="BLOG_CATEGORY",n.CHECKOUT="CHECKOUT",n.RAFFLE="RAFFLE",n.RAFFLE_DETAIL="RAFFLE_DETAIL",n.RAFFLE_ACCOUNT="RAFFLE_ACCOUNT"}(O||(O={}));export{i as IkasThemePage,t as IkasThemePageSpecification,O as IkasThemePageType};
@@ -20,6 +20,7 @@ export declare class IkasPageDataProvider {
20
20
  pageType: IkasThemePageType;
21
21
  pageTitle: string | null;
22
22
  pageDescription: string | null;
23
+ canonicalUrl: string | null;
23
24
  settingsStr: string;
24
25
  merchantSettingsStr: string | null;
25
26
  configJson: {
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import i from'../ext/lodash/uniq.js';import a from'../ext/lzutf8/build/production/lzutf8.js';import{IkasBlogMetadataTargetType as s}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 n}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"../api/product-option-file/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{IkasRaffleMetadataTargetType as o}from"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import{IkasTheme as p}from"../models/theme/theme.js";import{IkasThemePageType as u}from"../models/theme/page/index.js";import{IkasThemePageComponent as c}from"../models/theme/page/component/index.js";import{IkasThemeComponent as d}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as l}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{IkasProductDetail as m}from"../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/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasBlogAPI as f}from"../api/blog/index.js";import{IkasBrandAPI as g}from"../api/brand/index.js";import"../api/cart/index.js";import{IkasCategoryAPI as h}from"../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{IkasCustomerReviewSummaryAPI as v}from"../api/customer-review-summary/index.js";import"../api/district/index.js";import{IkasHTMLMetaDataAPI as j}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as T}from"../api/merchant/index.js";import{IkasProductSearchAPI as y}from"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import{IkasProductOptionSetAPI as x}from"../api/product-option-set/index.js";import{IkasRaffleAPI as S}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{IkasProductListPropValueProvider as b}from"./prop-value/product-list.js";import{IkasProductDetailPropValueProvider as D}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as w}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as L}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as P}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as R}from"./prop-value/text.js";import{IkasColorPropValueProvider as C}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as I}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as E}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as A}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as B}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as M}from"./prop-value/custom.js";import{IkasStorefrontConfig as G}from"../storefront/index.js";import{IkasSliderPropValueProvider as _}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as V}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as F}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as k}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as U}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as N}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as Y}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as J}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as H}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as q}from"./prop-value/raffle-list.js";import{populateRaffleProducts as z}from"./helpers/raffles.js";var K=function(){function c(e,t,i){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.productReviewSummary=null,this.theme=new p(e),this.pageParams=t||{},this.pageType=i,r(this)}return Object.defineProperty(c.prototype,"page",{get:function(){var e=this;if(this.pageType===u.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===u.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"nextPageData",{get:function(){var e,t,r;return{props:{propValuesStr:a.compress(JSON.stringify(this.pageComponentPropValues),{outputEncoding:"Base64"}),pageSpecificDataStr:this.pageSpecificData?JSON.stringify(this.pageSpecificData||{}):"",pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||u.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,settingsStr:JSON.stringify(this.theme.settings||{}),merchantSettingsStr:this.merchantSettings?JSON.stringify(this.merchantSettings):null,configJson:G.getJson(),productReviewSummary:JSON.stringify(this.productReviewSummary)}}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"specification",{get:function(){var e,t,r=this,i=this.page;return(null==i?void 0:i.type)===u.PRODUCT?null===(e=i.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.product.id)})):null===(t=null==i?void 0:i.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.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}),c.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,T.listMerchantSettings()];case 1:return(e=t.sent())&&(this.merchantSettings=e),[2]}}))}))},c.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,r=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 r.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]}}))}))},c.prototype.getProductReviewSummary=function(){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageType!==u.PRODUCT?[3,2]:[4,v.listCustomerReviewSummary({productId:{eq:null===(r=this.pageSpecificData)||void 0===r?void 0:r.product.id}})];case 1:(e=t.sent())&&e.data.length&&(this.productReviewSummary=e.data[0]),t.label=2;case 2:return[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,d,l,v,T,b,D,w,L=this;return t(this,(function(O){switch(O.label){case 0:return this.pageType&&![u.BRAND,u.PRODUCT,u.CATEGORY,u.BLOG,u.BLOG_CATEGORY,u.RAFFLE_DETAIL].includes(this.pageType)?[2]:(p=this.pageParams.slug)?(c=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(u.BLOG))||(null===(i=this.possiblePageTypes)||void 0===i?void 0:i.includes(u.BLOG_CATEGORY))?[4,f.listBlogMetaData(p)]:[3,2]):[2];case 1:return(c=O.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,S.listRaffleMetaData(p)]:[3,4];case 3:return(c=O.sent()).length?[3,6]:[2];case 4:return[4,j.listHTMLMetaData(p)];case 5:if(!(c=O.sent())||!c.length)return[2];O.label=6;case 6:if(!(d=c[0]).targetId)return[2];switch(l=function(){return e(L,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,y.searchProducts({productIdList:[d.targetId],priceListId:G.priceListId,salesChannelId:G.salesChannelId})];case 1:return(null==(e=t.sent())?void 0:e.data.length)?(r=e.data[0]).productOptionSetId?[4,x.list([r.productOptionSetId])]:[3,3]:[2];case 2:(null==(i=t.sent())?void 0:i.length)&&(r.productOptionSet=i[0]),t.label=3;case 3:return(a=r.variants.find((function(e){return e.isActive})))?(this.pageSpecificData=new m(r,a.variantValues),this.pageSpecificData.displayedVariantTypes.length&&(s=this.pageSpecificData.displayedVariantTypes[0]).displayedVariantValues.length&&(n=s.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=n.variant.variantValues),this.pageType=u.PRODUCT,this.setPageMetaData(d),[2]):[2]}}))}))},v=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,g.listBrands({idList:[d.targetId]})];case 1:return(e=t.sent()).brands.length?(r=e.brands[0],this.pageSpecificData=r,this.pageType=u.BRAND,this.setPageMetaData(d),[2]):[2]}}))}))},T=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h.listCategories({idList:[d.targetId]})];case 1:return(e=t.sent()).categories.length?(r=e.categories[0],this.pageSpecificData=r,this.pageType=u.CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},b=function(){return e(L,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,f.getBlog({id:d.targetId})];case 1:return(e=t.sent())?(this.pageSpecificData=e,this.pageType=u.BLOG,this.setPageMetaData(d),[2]):[2]}}))}))},D=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,f.listBlogCategory({idList:[d.targetId],page:1,limit:1})];case 1:return(e=t.sent())&&e.blogCategories.length?(r=e.blogCategories[0],this.pageSpecificData=r,this.pageType=u.BLOG_CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},w=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,S.listRaffles({id:d.targetId})];case 1:return(e=t.sent())&&e.raffles.length?(r=e.raffles[0],[4,z([r])]):[2];case 2:return t.sent(),this.pageSpecificData=r,this.pageType=u.RAFFLE_DETAIL,this.setPageMetaData(d),[2]}}))}))},d.targetType){case n.BRAND:return[3,7];case n.CATEGORY:return[3,9];case n.PRODUCT:return[3,11];case s.BLOG:return[3,13];case s.BLOG_CATEGORY:return[3,15];case o.RAFFLE:return[3,17]}return[3,19];case 7:return[4,v()];case 8:return[2,O.sent()];case 9:return[4,T()];case 10:return[2,O.sent()];case 11:return[4,l()];case 12:return[2,O.sent()];case 13:return[4,b()];case 14:return[2,O.sent()];case 15:return[4,D()];case 16:return[2,O.sent()];case 17:return[4,w()];case 18:return[2,O.sent()];case 19:return[3,20];case 20:return[2]}}))}))},c.prototype.getPageComponentPropValues=function(r){return e(this,void 0,void 0,(function(){var i,a,s,n=this;return t(this,(function(o){switch(o.label){case 0:return i=this.theme.components.find((function(e){return e.id===r.componentId})),a={pageComponent:r,component:i,propValues:{}},s=function(i){return e(n,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,s=i.name,[4,this.getPageComponentPropValue(r,i)];case 1:return e[s]=t.sent(),[2]}}))}))},[4,Promise.all(i.props.map(s))];case 1:return o.sent(),[2,a]}}))}))},c.prototype.getPageComponentPropValue=function(r,i){return e(this,void 0,void 0,(function(){var e,a,s,n,o,p=this;return t(this,(function(t){switch(t.label){case 0:if(a=r.propValues[i.name],s=[l.RAFFLE_LIST],null==a&&!s.includes(i.type))return[2,null];switch(i.type){case l.TEXT:return[3,1];case l.RICH_TEXT:return[3,2];case l.BOOLEAN:return[3,3];case l.IMAGE:return[3,4];case l.IMAGE_LIST:return[3,5];case l.BRAND:return[3,6];case l.BRAND_LIST:return[3,7];case l.PRODUCT_LIST:return[3,8];case l.PRODUCT_DETAIL:return[3,9];case l.PRODUCT_ATTRIBUTE:return[3,10];case l.PRODUCT_ATTRIBUTE_LIST:return[3,11];case l.CATEGORY:return[3,12];case l.CATEGORY_LIST:return[3,13];case l.LINK:case l.LIST_OF_LINK:return[3,14];case l.COLOR:return[3,15];case l.CUSTOM:return[3,16];case l.COMPONENT:case l.COMPONENT_LIST:return[3,17];case l.BLOG:return[3,19];case l.BLOG_LIST:return[3,20];case l.BLOG_CATEGORY:return[3,21];case l.BLOG_CATEGORY_LIST:return[3,22];case l.RAFFLE:return[3,23];case l.RAFFLE_LIST:return[3,24];case l.SLIDER:return[3,25]}return[3,26];case 1:return e=new R(a),[3,27];case 2:return e=new V(a),[3,27];case 3:return e=new I(a),[3,27];case 4:return e=new E(a),[3,27];case 5:return e=new P(a),[3,27];case 6:return e=new L(a),[3,27];case 7:return e=new w(a),[3,27];case 8:return e=new b(this.pageType,a,this.pageSpecificData),[3,27];case 9:return e=new D(a),[3,27];case 10:return e=new U(a),[3,27];case 11:return e=new N(a),[3,27];case 12:return e=new A(a),[3,27];case 13:return e=new B(a),[3,27];case 14:return e=new O(a,this.theme,this.linkMetaDataTargetIds),[3,27];case 15:return e=new C(a),[3,27];case 16:return(n=this.theme.customData.find((function(e){return e.id===i.customDataId})))?(e=new M(a,n,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,27]):[2];case 17:return o=a,[4,Promise.all(o.map((function(e){return p.getPageComponentPropValues(e)})))];case 18:case 28:return[2,t.sent()];case 19:return e=new F(a),[3,27];case 20:return e=new k(this.pageType,a,this.pageSpecificData),[3,27];case 21:return e=new Y(a),[3,27];case 22:return e=new J(a),[3,27];case 23:return e=new H(a),[3,27];case 24:return e=new q,[3,27];case 25:return e=new _(a),[3,27];case 26:return[3,27];case 27:return[4,null==e?void 0:e.getValue()]}}))}))},c.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle,this.page.description=e.description)},c.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){switch(t.label){case 0:return e=[],r=[],i=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":r.push(t);break;case"RAFFLE":i.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(r,"BLOG"),this.getLinkSlugs(i,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},c.prototype.getLinkSlugs=function(r,a){return e(this,void 0,void 0,(function(){var s,n,o=this;return t(this,(function(p){switch(p.label){case 0:return s=i(r.map((function(e){return e.id}))),n=[],[4,function(){return e(o,void 0,void 0,(function(){var e;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,j.listHTMLMetaData(void 0,s,void 0)];case 2:case 4:case 6:return e=t.sent(),[3,8];case 3:return[4,f.listBlogMetaData(void 0,s,void 0)];case 5:return[4,S.listRaffleMetaData(void 0,s,void 0)];case 7:return[3,8];case 8:return e.length&&(n=e),[2]}}))}))}()];case 1:return p.sent(),r.forEach((function(e){var t=n.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},c}(),X=function(e){this.pageComponent=e.pageComponent?new c(e.pageComponent):new c({}),this.component=e.component?new d(e.component):new d({}),this.propValues=e.propValues||{}};export{X as IkasPageComponentPropValue,K as IkasPageDataProvider};
1
+ import{__awaiter as e,__generator as t}from'../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import i from'../ext/lodash/uniq.js';import a from'../ext/lzutf8/build/production/lzutf8.js';import{IkasBlogMetadataTargetType as s}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 n}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"../api/product-option-file/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{IkasRaffleMetadataTargetType as o}from"../models/data/raffle/index.js";import"../models/data/product-campaing/campaign/index.js";import"../models/data/customer-attribute/index.js";import"../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import{IkasTheme as p}from"../models/theme/theme.js";import{IkasThemePageType as u}from"../models/theme/page/index.js";import{IkasThemePageComponent as c}from"../models/theme/page/component/index.js";import{IkasThemeComponent as d}from"../models/theme/component/index.js";import{IkasThemeComponentPropType as l}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{IkasProductDetail as m}from"../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/customer-review-summary-list/index.js";import"../models/ui/validator/index.js";import"../models/ui/validator/rules/index.js";import"../models/ui/validator/form/login.js";import"../models/ui/validator/form/address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import"../models/ui/raffle-list/index.js";import"../models/theme/settings/index.js";import"../models/theme/custom-data/index.js";import{IkasBlogAPI as f}from"../api/blog/index.js";import{IkasBrandAPI as g}from"../api/brand/index.js";import"../api/cart/index.js";import{IkasCategoryAPI as h}from"../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{IkasCustomerReviewSummaryAPI as v}from"../api/customer-review-summary/index.js";import"../api/district/index.js";import{IkasHTMLMetaDataAPI as j}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as T}from"../api/merchant/index.js";import{IkasProductSearchAPI as y}from"../api/product-search/index.js";import"../api/apollo.js";import"../api/favorite-product/index.js";import"../api/contact-form/index.js";import"../api/state/index.js";import{IkasProductOptionSetAPI as x}from"../api/product-option-set/index.js";import{IkasRaffleAPI as S}from"../api/raffle/index.js";import"../api/back-in-stock-reminder/index.js";import"../api/product-campaign/index.js";import{IkasProductListPropValueProvider as b}from"./prop-value/product-list.js";import{IkasProductDetailPropValueProvider as D}from"./prop-value/product-detail.js";import{IkasBrandListPropValueProvider as w}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as L}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as P}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as R}from"./prop-value/text.js";import{IkasColorPropValueProvider as C}from"./prop-value/color.js";import{IkasBooleanPropValueProvider as I}from"./prop-value/boolean.js";import{IkasImagePropValueProvider as E}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as A}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as B}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as M}from"./prop-value/custom.js";import{IkasStorefrontConfig as G}from"../storefront/index.js";import{IkasSliderPropValueProvider as _}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as V}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as F}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as U}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as k}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as N}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as Y}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as J}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as H}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as q}from"./prop-value/raffle-list.js";import{populateRaffleProducts as z}from"./helpers/raffles.js";var K=function(){function c(e,t,i){this.pageType=null,this.pageParams={},this.pageComponentPropValues=[],this.pageSpecificData=null,this.merchantSettings=null,this.possiblePageTypes=[],this.linkMetaDataTargetIds=[],this.productReviewSummary=null,this.theme=new p(e),this.pageParams=t||{},this.pageType=i,r(this)}return Object.defineProperty(c.prototype,"page",{get:function(){var e=this;if(this.pageType===u.CUSTOM){var t=this.pageParams.slug;return this.theme.pages.find((function(e){return e.type===u.CUSTOM&&e.slug===t}))}return this.theme.pages.find((function(t){return t.type===e.pageType}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"nextPageData",{get:function(){var e,t,r,i;return{props:{propValuesStr:a.compress(JSON.stringify(this.pageComponentPropValues),{outputEncoding:"Base64"}),pageSpecificDataStr:this.pageSpecificData?JSON.stringify(this.pageSpecificData||{}):"",pageType:(null===(e=this.page)||void 0===e?void 0:e.type)||u.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,canonicalUrl:(null===(i=this.page)||void 0===i?void 0:i.canonicalUrl)||null,settingsStr:JSON.stringify(this.theme.settings||{}),merchantSettingsStr:this.merchantSettings?JSON.stringify(this.merchantSettings):null,configJson:G.getJson(),productReviewSummary:JSON.stringify(this.productReviewSummary)}}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"specification",{get:function(){var e,t,r=this,i=this.page;return(null==i?void 0:i.type)===u.PRODUCT?null===(e=i.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.product.id)})):null===(t=null==i?void 0:i.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=r.pageSpecificData)||void 0===t?void 0:t.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(c.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}),c.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,T.listMerchantSettings()];case 1:return(e=t.sent())&&(this.merchantSettings=e),[2]}}))}))},c.prototype.getPageData=function(){return e(this,void 0,void 0,(function(){var e,r=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 r.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]}}))}))},c.prototype.getProductReviewSummary=function(){var r;return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageType!==u.PRODUCT?[3,2]:[4,v.listCustomerReviewSummary({productId:{eq:null===(r=this.pageSpecificData)||void 0===r?void 0:r.product.id}})];case 1:(e=t.sent())&&e.data.length&&(this.productReviewSummary=e.data[0]),t.label=2;case 2:return[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,d,l,v,T,b,D,w,L=this;return t(this,(function(O){switch(O.label){case 0:return this.pageType&&![u.BRAND,u.PRODUCT,u.CATEGORY,u.BLOG,u.BLOG_CATEGORY,u.RAFFLE_DETAIL].includes(this.pageType)?[2]:(p=this.pageParams.slug)?(c=[],(null===(r=this.possiblePageTypes)||void 0===r?void 0:r.includes(u.BLOG))||(null===(i=this.possiblePageTypes)||void 0===i?void 0:i.includes(u.BLOG_CATEGORY))?[4,f.listBlogMetaData(p)]:[3,2]):[2];case 1:return(c=O.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,S.listRaffleMetaData(p)]:[3,4];case 3:return(c=O.sent()).length?[3,6]:[2];case 4:return[4,j.listHTMLMetaData(p)];case 5:if(!(c=O.sent())||!c.length)return[2];O.label=6;case 6:if(!(d=c[0]).targetId)return[2];switch(l=function(){return e(L,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,y.searchProducts({productIdList:[d.targetId],priceListId:G.priceListId,salesChannelId:G.salesChannelId})];case 1:return(null==(e=t.sent())?void 0:e.data.length)?(r=e.data[0]).productOptionSetId?[4,x.list([r.productOptionSetId])]:[3,3]:[2];case 2:(null==(i=t.sent())?void 0:i.length)&&(r.productOptionSet=i[0]),t.label=3;case 3:return(a=r.variants.find((function(e){return e.isActive})))?(this.pageSpecificData=new m(r,a.variantValues),this.pageSpecificData.displayedVariantTypes.length&&(s=this.pageSpecificData.displayedVariantTypes[0]).displayedVariantValues.length&&(n=s.displayedVariantValues.find((function(e){return e.hasStock})))&&(this.pageSpecificData.selectedVariantValues=n.variant.variantValues),this.pageType=u.PRODUCT,this.setPageMetaData(d),[2]):[2]}}))}))},v=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,g.listBrands({idList:[d.targetId]})];case 1:return(e=t.sent()).brands.length?(r=e.brands[0],this.pageSpecificData=r,this.pageType=u.BRAND,this.setPageMetaData(d),[2]):[2]}}))}))},T=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,h.listCategories({idList:[d.targetId]})];case 1:return(e=t.sent()).categories.length?(r=e.categories[0],this.pageSpecificData=r,this.pageType=u.CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},b=function(){return e(L,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,f.getBlog({id:d.targetId})];case 1:return(e=t.sent())?(this.pageSpecificData=e,this.pageType=u.BLOG,this.setPageMetaData(d),[2]):[2]}}))}))},D=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,f.listBlogCategory({idList:[d.targetId],page:1,limit:1})];case 1:return(e=t.sent())&&e.blogCategories.length?(r=e.blogCategories[0],this.pageSpecificData=r,this.pageType=u.BLOG_CATEGORY,this.setPageMetaData(d),[2]):[2]}}))}))},w=function(){return e(L,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,S.listRaffles({id:d.targetId})];case 1:return(e=t.sent())&&e.raffles.length?(r=e.raffles[0],[4,z([r])]):[2];case 2:return t.sent(),this.pageSpecificData=r,this.pageType=u.RAFFLE_DETAIL,this.setPageMetaData(d),[2]}}))}))},d.targetType){case n.BRAND:return[3,7];case n.CATEGORY:return[3,9];case n.PRODUCT:return[3,11];case s.BLOG:return[3,13];case s.BLOG_CATEGORY:return[3,15];case o.RAFFLE:return[3,17]}return[3,19];case 7:return[4,v()];case 8:return[2,O.sent()];case 9:return[4,T()];case 10:return[2,O.sent()];case 11:return[4,l()];case 12:return[2,O.sent()];case 13:return[4,b()];case 14:return[2,O.sent()];case 15:return[4,D()];case 16:return[2,O.sent()];case 17:return[4,w()];case 18:return[2,O.sent()];case 19:return[3,20];case 20:return[2]}}))}))},c.prototype.getPageComponentPropValues=function(r){return e(this,void 0,void 0,(function(){var i,a,s,n=this;return t(this,(function(o){switch(o.label){case 0:return i=this.theme.components.find((function(e){return e.id===r.componentId})),a={pageComponent:r,component:i,propValues:{}},s=function(i){return e(n,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=a.propValues,s=i.name,[4,this.getPageComponentPropValue(r,i)];case 1:return e[s]=t.sent(),[2]}}))}))},[4,Promise.all(i.props.map(s))];case 1:return o.sent(),[2,a]}}))}))},c.prototype.getPageComponentPropValue=function(r,i){return e(this,void 0,void 0,(function(){var e,a,s,n,o,p=this;return t(this,(function(t){switch(t.label){case 0:if(a=r.propValues[i.name],s=[l.RAFFLE_LIST],null==a&&!s.includes(i.type))return[2,null];switch(i.type){case l.TEXT:return[3,1];case l.RICH_TEXT:return[3,2];case l.BOOLEAN:return[3,3];case l.IMAGE:return[3,4];case l.IMAGE_LIST:return[3,5];case l.BRAND:return[3,6];case l.BRAND_LIST:return[3,7];case l.PRODUCT_LIST:return[3,8];case l.PRODUCT_DETAIL:return[3,9];case l.PRODUCT_ATTRIBUTE:return[3,10];case l.PRODUCT_ATTRIBUTE_LIST:return[3,11];case l.CATEGORY:return[3,12];case l.CATEGORY_LIST:return[3,13];case l.LINK:case l.LIST_OF_LINK:return[3,14];case l.COLOR:return[3,15];case l.CUSTOM:return[3,16];case l.COMPONENT:case l.COMPONENT_LIST:return[3,17];case l.BLOG:return[3,19];case l.BLOG_LIST:return[3,20];case l.BLOG_CATEGORY:return[3,21];case l.BLOG_CATEGORY_LIST:return[3,22];case l.RAFFLE:return[3,23];case l.RAFFLE_LIST:return[3,24];case l.SLIDER:return[3,25]}return[3,26];case 1:return e=new R(a),[3,27];case 2:return e=new V(a),[3,27];case 3:return e=new I(a),[3,27];case 4:return e=new E(a),[3,27];case 5:return e=new P(a),[3,27];case 6:return e=new L(a),[3,27];case 7:return e=new w(a),[3,27];case 8:return e=new b(this.pageType,a,this.pageSpecificData),[3,27];case 9:return e=new D(a),[3,27];case 10:return e=new k(a),[3,27];case 11:return e=new N(a),[3,27];case 12:return e=new A(a),[3,27];case 13:return e=new B(a),[3,27];case 14:return e=new O(a,this.theme,this.linkMetaDataTargetIds),[3,27];case 15:return e=new C(a),[3,27];case 16:return(n=this.theme.customData.find((function(e){return e.id===i.customDataId})))?(e=new M(a,n,this.theme,this.pageType,this,this.pageSpecificData,this.pageParams),[3,27]):[2];case 17:return o=a,[4,Promise.all(o.map((function(e){return p.getPageComponentPropValues(e)})))];case 18:case 28:return[2,t.sent()];case 19:return e=new F(a),[3,27];case 20:return e=new U(this.pageType,a,this.pageSpecificData),[3,27];case 21:return e=new Y(a),[3,27];case 22:return e=new J(a),[3,27];case 23:return e=new H(a),[3,27];case 24:return e=new q,[3,27];case 25:return e=new _(a),[3,27];case 26:return[3,27];case 27:return[4,null==e?void 0:e.getValue()]}}))}))},c.prototype.setPageMetaData=function(e){this.page&&(this.page.pageTitle=e.pageTitle,this.page.description=e.description)},c.prototype.setLinkSlugs=function(){return e(this,void 0,void 0,(function(){var e,r,i;return t(this,(function(t){switch(t.label){case 0:return e=[],r=[],i=[],this.linkMetaDataTargetIds.forEach((function(t){switch(t.type){case"DEFAULT":e.push(t);break;case"BLOG":r.push(t);break;case"RAFFLE":i.push(t)}})),[4,Promise.all([this.getLinkSlugs(e,"DEFAULT"),this.getLinkSlugs(r,"BLOG"),this.getLinkSlugs(i,"RAFFLE")])];case 1:return[2,t.sent()]}}))}))},c.prototype.getLinkSlugs=function(r,a){return e(this,void 0,void 0,(function(){var s,n,o=this;return t(this,(function(p){switch(p.label){case 0:return s=i(r.map((function(e){return e.id}))),n=[],[4,function(){return e(o,void 0,void 0,(function(){var e;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,j.listHTMLMetaData(void 0,s,void 0)];case 2:case 4:case 6:return e=t.sent(),[3,8];case 3:return[4,f.listBlogMetaData(void 0,s,void 0)];case 5:return[4,S.listRaffleMetaData(void 0,s,void 0)];case 7:return[3,8];case 8:return e.length&&(n=e),[2]}}))}))}()];case 1:return p.sent(),r.forEach((function(e){var t=n.find((function(t){return t.targetId===e.id}));t&&(e.navigationLink.href+=t.slug)})),[2]}}))}))},c}(),X=function(e){this.pageComponent=e.pageComponent?new c(e.pageComponent):new c({}),this.component=e.component?new d(e.component):new d({}),this.propValues=e.propValues||{}};export{X as IkasPageComponentPropValue,K as IkasPageDataProvider};
@@ -24,6 +24,7 @@ export declare class IkasNextPageDataProvider {
24
24
  pageType: IkasThemePageType;
25
25
  pageTitle: string | null;
26
26
  pageDescription: string | null;
27
+ canonicalUrl: string | null;
27
28
  settingsStr: string;
28
29
  merchantSettingsStr: string | null;
29
30
  configJson: {
@@ -58,6 +59,7 @@ export declare class IkasNextPageDataProvider {
58
59
  pageType: IkasThemePageType;
59
60
  pageTitle: string | null;
60
61
  pageDescription: string | null;
62
+ canonicalUrl: string | null;
61
63
  settingsStr: string;
62
64
  merchantSettingsStr: string | null;
63
65
  configJson: {
@@ -101,6 +103,7 @@ export declare class IkasNextPageDataProvider {
101
103
  pageType: IkasThemePageType;
102
104
  pageTitle: string | null;
103
105
  pageDescription: string | null;
106
+ canonicalUrl: string | null;
104
107
  settingsStr: string;
105
108
  merchantSettingsStr: string | null;
106
109
  configJson: {
@@ -135,6 +138,7 @@ export declare class IkasNextPageDataProvider {
135
138
  pageType: IkasThemePageType;
136
139
  pageTitle: string | null;
137
140
  pageDescription: string | null;
141
+ canonicalUrl: string | null;
138
142
  settingsStr: string;
139
143
  merchantSettingsStr: string | null;
140
144
  configJson: {
@@ -178,6 +182,7 @@ export declare class IkasNextPageDataProvider {
178
182
  pageType: IkasThemePageType;
179
183
  pageTitle: string | null;
180
184
  pageDescription: string | null;
185
+ canonicalUrl: string | null;
181
186
  settingsStr: string;
182
187
  merchantSettingsStr: string | null;
183
188
  configJson: {
@@ -212,6 +217,7 @@ export declare class IkasNextPageDataProvider {
212
217
  pageType: IkasThemePageType;
213
218
  pageTitle: string | null;
214
219
  pageDescription: string | null;
220
+ canonicalUrl: string | null;
215
221
  settingsStr: string;
216
222
  merchantSettingsStr: string | null;
217
223
  configJson: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.52",
3
+ "version": "2.0.54",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",