@ikas/storefront 2.0.37-alpha.6 → 2.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
1
+ import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
@@ -1 +1 @@
1
- import o from'../ext/split-on-first/index.js';export{default}from"../node_modules/split-on-first/index.js";
1
+ import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
@@ -1 +1 @@
1
- import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
1
+ import o from'../ext/split-on-first/index.js';export{default}from"../node_modules/split-on-first/index.js";
@@ -7,6 +7,7 @@ declare type Props = {
7
7
  pageSpecificDataStr?: string;
8
8
  merchantSettingsStr?: string;
9
9
  addOgpMetas?: boolean;
10
+ productReviewSummary: string | null;
10
11
  };
11
12
  export declare const IkasPageHead: React.FC<Props>;
12
13
  export {};
@@ -1 +1 @@
1
- import*as t from"react";import{observer as e}from"mobx-react-lite";import o from"next/head.js";import"../../models/data/blog/index.js";import{IkasBrand as i}from"../../models/data/brand/index.js";import{IkasCategory as r}from"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"mobx";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import{IkasMerchantSettings as a}from"../../models/data/merchant-settings/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"../../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"../../models/theme/theme.js";import{IkasThemePageType as n}from"../../models/theme/page/index.js";import"../../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 d}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{IkasStorefrontConfig as s}from"../../storefront/index.js";import{IkasPageDataInit as m}from"../../providers/page-data-init.js";var p=e((function(e){var p=e.pageType,l=e.pageTitle,c=e.pageDescription,u=e.pageSpecificDataStr,f=e.merchantSettingsStr,h=e.addOgpMetas,v="undefined"!=typeof window;t.useEffect((function(){var t;document.documentElement.lang=(null===(t=s.routings.find((function(t){return t.id===s.storefrontRoutingId})))||void 0===t?void 0:t.locale)||"tr"}),[p]);var g=t.useMemo((function(){if(f)return new a(JSON.parse(f))}),[f]),j=t.useMemo((function(){if(!u)return u;var t=JSON.parse(u);switch(p){case n.PRODUCT:return new d(t.product,t.selectedVariantValues);case n.CATEGORY:return new r(t);case n.BRAND:return new i(t);default:return u}}),[u]),x=t.useMemo((function(){if(j&&j.href)return"https://".concat(s.domain).concat(j.href)}),[j]),y=t.useMemo((function(){var t,e=[];if(h)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+s.domain}),l&&e.push({property:"og:title",content:l}),c&&e.push({property:"og:description",content:c}),e.push({property:"og:url",content:x||(v?window.location.href:"")||"https://".concat(s.domain)}),j&&p===n.PRODUCT){var o=j;o.selectedVariant.mainImage&&e.push({property:"og:image",content:null===(t=o.selectedVariant.mainImage)||void 0===t?void 0:t.src})}else g&&e.push({property:"og:image",content:g.logo.src});return e}),[l,j,x,c,g,h,g]),b=t.useMemo((function(){var t=[];if(g){var e={"@context":"https://schema.org","@type":"Website",url:"https://"+s.domain},o=function(t){var e,o;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:null===(e=null==t?void 0:t.logo)||void 0===e?void 0:e.src,image:null===(o=null==t?void 0:t.logo)||void 0===o?void 0:o.src,url:"https://"+s.domain}}(g);t.push(e),t.push(o)}if(j&&p===n.PRODUCT){var i=function(t){var e,o;try{"undefined"!=typeof window&&m._initProductDetailOnBrowser(t);var i="https://".concat(s.domain).concat(t.href);return{"@context":"https://schema.org/","@type":"Product",name:t.product.name,description:null===(e=t.product.metaData)||void 0===e?void 0:e.description,image:t.selectedVariant.images.map((function(t){return t.src})),productId:t.selectedVariant.id,sku:t.selectedVariant.sku,mpn:t.selectedVariant.barcodeList.length?t.selectedVariant.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(o=t.product.brand)||void 0===o?void 0:o.name},offers:{"@type":"Offer",url:i,priceCurrency:t.selectedVariant.price.currency||"TRY",price:t.selectedVariant.price.finalPrice,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:t.selectedVariant.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}catch(t){}}(j);i&&t.push(i)}if(j&&p===n.CATEGORY){var r=function(t){var e,o,i;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(s.domain).concat(t.href),name:null===(e=t.metaData)||void 0===e?void 0:e.pageTitle,description:null===(o=t.metaData)||void 0===o?void 0:o.description,image:null===(i=t.image)||void 0===i?void 0:i.src}}catch(t){}}(j),a=function(t){try{return{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:t.path.map((function(t,e){return{"@type":"ListItem",position:e+1,name:t.name,item:"https://"+s.domain+t.href}}))}}catch(t){}}(j);r&&t.push(r),a&&t.push(a)}return t}),[j,g]);return t.createElement(o,null,t.createElement("title",null,l||""),t.createElement("meta",{name:"description",content:c||""}),!!h&&y.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!b.length&&b.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));export{p as IkasPageHead};
1
+ import{__assign as t}from'../../ext/tslib/tslib.es6.js';import*as e from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import"../../models/data/blog/index.js";import{IkasBrand as r}from"../../models/data/brand/index.js";import{IkasCategory as a}from"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import"mobx";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import{IkasMerchantSettings as n}from"../../models/data/merchant-settings/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"../../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"../../models/theme/theme.js";import{IkasThemePageType as s}from"../../models/theme/page/index.js";import"../../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 d}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{IkasStorefrontConfig as m}from"../../storefront/index.js";import{IkasPageDataInit as p}from"../../providers/page-data-init.js";var l=o((function(o){var l=o.pageType,c=o.pageTitle,u=o.pageDescription,f=o.pageSpecificDataStr,g=o.merchantSettingsStr,h=o.addOgpMetas,v=o.productReviewSummary,j="undefined"!=typeof window,x=e.useState([]);x[0],x[1],e.useEffect((function(){var t;document.documentElement.lang=(null===(t=m.routings.find((function(t){return t.id===m.storefrontRoutingId})))||void 0===t?void 0:t.locale)||"tr"}),[l]);var y=e.useMemo((function(){if(g)return new n(JSON.parse(g))}),[g]),b=e.useMemo((function(){if(!f)return f;var t=JSON.parse(f);switch(l){case s.PRODUCT:return new d(t.product,t.selectedVariantValues);case s.CATEGORY:return new a(t);case s.BRAND:return new r(t);default:return f}}),[f]),w=e.useMemo((function(){if(b&&b.href)return"https://".concat(m.domain).concat(b.href)}),[b]),S=e.useMemo((function(){var t,e=[];if(h)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+m.domain}),c&&e.push({property:"og:title",content:c}),u&&e.push({property:"og:description",content:u}),e.push({property:"og:url",content:w||(j?window.location.href:"")||"https://".concat(m.domain)}),b&&l===s.PRODUCT){var o=b;o.selectedVariant.mainImage&&e.push({property:"og:image",content:null===(t=o.selectedVariant.mainImage)||void 0===t?void 0:t.src})}else y&&e.push({property:"og:image",content:y.logo.src});return e}),[c,b,w,u,y,h,y]),O=e.useMemo((function(){var e=[];if(y){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+m.domain},i=function(t){var e,o;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:null===(e=null==t?void 0:t.logo)||void 0===e?void 0:e.src,image:null===(o=null==t?void 0:t.logo)||void 0===o?void 0:o.src,url:"https://"+m.domain}}(y);e.push(o),e.push(i)}if(b&&l===s.PRODUCT){var r=function(e,o){var i,r;try{"undefined"!=typeof window&&p._initProductDetailOnBrowser(e);var a="https://".concat(m.domain).concat(e.href);return t(t({"@context":"https://schema.org/","@type":"Product",name:e.product.name,description:null===(i=e.product.metaData)||void 0===i?void 0:i.description,image:e.selectedVariant.images.map((function(t){return t.src})),productId:e.selectedVariant.id,sku:e.selectedVariant.sku,mpn:e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(r=e.product.brand)||void 0===r?void 0:r.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:a,priceCurrency:e.selectedVariant.price.currency||"TRY",price:e.selectedVariant.price.finalPrice,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:e.selectedVariant.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(t){}}(b,v?JSON.parse(v):null);r&&e.push(r)}if(b&&l===s.CATEGORY){var a=function(t){var e,o,i;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(m.domain).concat(t.href),name:null===(e=t.metaData)||void 0===e?void 0:e.pageTitle,description:null===(o=t.metaData)||void 0===o?void 0:o.description,image:null===(i=t.image)||void 0===i?void 0:i.src}}catch(t){}}(b),n=function(t){try{return{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:t.path.length?t.path.map((function(t,e){return{"@type":"ListItem",position:e+1,name:t.name,item:"https://"+m.domain+t.href}})):[{"@type":"ListItem",position:1,name:t.name,item:"https://"+m.domain+t.href}]}}catch(t){}}(b);a&&e.push(a),n&&e.push(n)}return e}),[b,y]);return e.createElement(i,null,e.createElement("title",null,c||""),e.createElement("meta",{name:"description",content:u||""}),!!h&&S.map((function(t,o){return e.createElement("meta",{key:"".concat(t.content,"-").concat(o),property:t.property,content:t.content})})),!!O.length&&O.map((function(t,o){return e.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(t)}})})))}));export{l as IkasPageHead};
@@ -13,6 +13,7 @@ export declare type IkasPageProps = {
13
13
  reInitOnBrowser?: boolean;
14
14
  addOgpMetas?: boolean;
15
15
  components?: Record<string, any>;
16
+ productReviewSummary: string | null;
16
17
  };
17
18
  export declare const IkasPage: React.FC<IkasPageProps>;
18
19
  export declare const renderComponent: (pageComponentPropValue: IkasPageComponentPropValue, settings: IkasThemeSettings, index: number) => JSX.Element;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import"../../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"mobx";import"../../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"../../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"../../models/theme/theme.js";import{IkasThemePageType as a}from"../../models/theme/page/index.js";import"../../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 s}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{IkasThemeSettings as n}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{Analytics as m}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasPageDataInit as d}from"../../providers/page-data-init.js";import{ThemeComponent as p}from"./ThemeComponent.js";import{IkasPageHead as l}from"./head.js";import{IkasStorefrontConfig as u}from"../../storefront/index.js";import{initIkasEvents as c}from"../../analytics/events.js";var f=i((function(i){var p=i.propValuesStr,f=i.pageType,x=i.pageTitle,g=i.pageDescription,v=i.pageSpecificDataStr,h=i.settingsStr,S=i.merchantSettingsStr,w=i.configJson,y=i.reInitOnBrowser,b=i.addOgpMetas,C=i.components,E=r();u.initWithJson(w,E),u.currentPageComponents=C;var O=u.store;O.currentPageType=f;var T=o.useState(!1),V=T[0],D=T[1],P=o.useState(new n(JSON.parse(h)))[0],J=o.useMemo((function(){return d.setPageSpecificData(v,f,V),d.initPropValues(p,E,h,!0,V)}),[V,p,f,h,v]);o.useEffect((function(){y&&D("undefined"!=typeof window),O.cartStore.getCart(),O.checkLocalization(),c()}),[]),o.useEffect((function(){var e=function(){u.store.customerStore.routeChangeInit()};return E.events.on("routeChangeStart",e),function(){E.events.off("routeChangeStart",e)}}),[]),o.useEffect((function(){!function(o,i,r){e(this,void 0,void 0,(function(){var e,n,p,l,c;return t(this,(function(t){switch(t.label){case 0:m.pageView(o),t.label=1;case 1:return t.trys.push([1,4,,5]),o===a.PRODUCT&&(e=JSON.parse(i),n=new s(e.product,e.selectedVariantValues),"undefined"!=typeof window&&d._initProductDetailOnBrowser(n),m.productView(n),u.store.customerStore.onProductView(n.product.id,n.selectedVariant.id)),o===a.CATEGORY&&(p=JSON.parse(i),l=p.path.map((function(e){return e.name})).join(" > "),l=p.path.length>0?l+" > "+p.name:p.name,m.viewCategory(l,p)),o!==a.CART?[3,3]:[4,r.cartStore.waitUntilInitialized()];case 2:t.sent(),m.viewCart(r.cartStore.cart),t.label=3;case 3:return[3,5];case 4:return c=t.sent(),console.error(c),[3,5];case 5:return[2]}}))}))}(f,v,O)}),[f,v]);var k=o.useMemo((function(){var e=J.find((function(e){return e.component.isHeader})),t=J.find((function(e){return e.component.isFooter})),i=J.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[];return o.createElement("div",{style:{position:"relative",minHeight:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"}},o.createElement("div",null,e&&j(e,P,-1),i.map((function(e,t){return j(e,P,t)}))),t&&j(t,P,-1))}),[J,P]);return o.createElement(o.Fragment,null,o.createElement(l,{pageType:f,pageTitle:x,pageDescription:g,pageSpecificDataStr:v,merchantSettingsStr:S,addOgpMetas:b}),k)})),j=function(e,t,i){return o.createElement(p,{key:e.pageComponent.id,index:i,pageComponentPropValue:e,settings:t})};export{f as IkasPage,j as renderComponent};
1
+ import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import"../../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"mobx";import"../../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"../../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"../../models/theme/theme.js";import{IkasThemePageType as a}from"../../models/theme/page/index.js";import"../../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 s}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{IkasThemeSettings as n}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{Analytics as m}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasPageDataInit as d}from"../../providers/page-data-init.js";import{ThemeComponent as p}from"./ThemeComponent.js";import{IkasPageHead as l}from"./head.js";import{IkasStorefrontConfig as u}from"../../storefront/index.js";import{initIkasEvents as c}from"../../analytics/events.js";var f=i((function(i){var p=i.propValuesStr,f=i.pageType,x=i.pageTitle,v=i.pageDescription,g=i.pageSpecificDataStr,h=i.settingsStr,S=i.merchantSettingsStr,w=i.configJson,y=i.reInitOnBrowser,b=i.addOgpMetas,C=i.components,E=i.productReviewSummary,O=r();u.initWithJson(w,O),u.currentPageComponents=C;var T=u.store;T.currentPageType=f;var V=o.useState(!1),D=V[0],P=V[1],J=o.useState(new n(JSON.parse(h)))[0],R=o.useMemo((function(){return d.setPageSpecificData(g,f,D),d.initPropValues(p,O,h,!0,D)}),[D,p,f,h,g]);o.useEffect((function(){y&&P("undefined"!=typeof window),T.cartStore.getCart(),T.checkLocalization(),c()}),[]),o.useEffect((function(){var e=function(){u.store.customerStore.routeChangeInit()};return O.events.on("routeChangeStart",e),function(){O.events.off("routeChangeStart",e)}}),[]),o.useEffect((function(){!function(o,i,r){e(this,void 0,void 0,(function(){var e,n,p,l,c;return t(this,(function(t){switch(t.label){case 0:m.pageView(o),t.label=1;case 1:return t.trys.push([1,4,,5]),o===a.PRODUCT&&(e=JSON.parse(i),n=new s(e.product,e.selectedVariantValues),"undefined"!=typeof window&&d._initProductDetailOnBrowser(n),m.productView(n),u.store.customerStore.onProductView(n.product.id,n.selectedVariant.id)),o===a.CATEGORY&&(p=JSON.parse(i),l=p.path.map((function(e){return e.name})).join(" > "),l=p.path.length>0?l+" > "+p.name:p.name,m.viewCategory(l,p)),o!==a.CART?[3,3]:[4,r.cartStore.waitUntilInitialized()];case 2:t.sent(),m.viewCart(r.cartStore.cart),t.label=3;case 3:return[3,5];case 4:return c=t.sent(),console.error(c),[3,5];case 5:return[2]}}))}))}(f,g,T)}),[f,g]);var k=o.useMemo((function(){var e=R.find((function(e){return e.component.isHeader})),t=R.find((function(e){return e.component.isFooter})),i=R.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[];return o.createElement("div",{style:{position:"relative",minHeight:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"}},o.createElement("div",null,e&&j(e,J,-1),i.map((function(e,t){return j(e,J,t)}))),t&&j(t,J,-1))}),[R,J]);return o.createElement(o.Fragment,null,o.createElement(l,{pageType:f,pageTitle:x,pageDescription:v,pageSpecificDataStr:g,merchantSettingsStr:S,addOgpMetas:b,productReviewSummary:E}),k)})),j=function(e,t,i){return o.createElement(p,{key:e.pageComponent.id,index:i,pageComponentPropValue:e,settings:t})};export{f as IkasPage,j as renderComponent};
@@ -1,4 +1,4 @@
1
- import { IkasTheme, IkasThemePageType, IkasThemePageComponent, IkasThemeComponentProp, IkasThemeComponent, IkasThemePage, IkasMerchantSettings } from "../models";
1
+ import { IkasTheme, IkasThemePageType, IkasThemePageComponent, IkasThemeComponentProp, IkasThemeComponent, IkasThemePage, IkasMerchantSettings, IkasCustomerReviewSummary } from "../models";
2
2
  import { IkasLinkMetaDataTargetId } from "./prop-value/link";
3
3
  import { IkasThemePageSpecification } from "../models/theme/page";
4
4
  export declare class IkasPageDataProvider {
@@ -10,6 +10,7 @@ export declare class IkasPageDataProvider {
10
10
  merchantSettings?: IkasMerchantSettings | null;
11
11
  possiblePageTypes?: IkasThemePageType[];
12
12
  linkMetaDataTargetIds: IkasLinkMetaDataTargetId[];
13
+ productReviewSummary: IkasCustomerReviewSummary | null;
13
14
  constructor(theme: IkasTheme, pageParams?: Record<string, any>, pageType?: IkasThemePageType);
14
15
  get page(): IkasThemePage | undefined;
15
16
  get nextPageData(): {
@@ -42,12 +43,14 @@ export declare class IkasPageDataProvider {
42
43
  customerReviewSettings: import("../models").IkasCustomerReviewSettings | null;
43
44
  productBackInStockSettings: any;
44
45
  };
46
+ productReviewSummary: string;
45
47
  };
46
48
  };
47
49
  get specification(): IkasThemePageSpecification | undefined;
48
50
  get pageComponents(): IkasThemePageComponent[];
49
51
  getMerchantSettings(): Promise<void>;
50
52
  getPageData(): Promise<void>;
53
+ getProductReviewSummary(): Promise<void>;
51
54
  getPageSpecificData(): Promise<void>;
52
55
  getPageComponentPropValues(pageComponent: IkasThemePageComponent): Promise<IkasPageComponentPropValue>;
53
56
  getPageComponentPropValue(pageComponent: IkasThemePageComponent, prop: IkasThemeComponentProp): Promise<any>;
@@ -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"../api/customer-review-summary/index.js";import"../api/district/index.js";import{IkasHTMLMetaDataAPI as v}from"../api/html-meta-data/index.js";import{IkasMerchantAPI as j}from"../api/merchant/index.js";import{IkasProductSearchAPI as T}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 y}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 L}from"./prop-value/brand-list.js";import{IkasBrandPropValueProvider as S}from"./prop-value/brand.js";import{IkasLinkPropValueProvider as O}from"./prop-value/link.js";import{IkasImageListPropValueProvider as w}from"./prop-value/image-list.js";import{IkasTextPropValueProvider as P}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 R}from"./prop-value/image.js";import{IkasCategoryPropValueProvider as E}from"./prop-value/category.js";import{IkasCategoryListPropValueProvider as A}from"./prop-value/category-list.js";import{IkasCustomPropValueProvider as B}from"./prop-value/custom.js";import{IkasStorefrontConfig as M}from"../storefront/index.js";import{IkasSliderPropValueProvider as G}from"./prop-value/slider.js";import{IkasRichTextPropValueProvider as _}from"./prop-value/rich-text.js";import{IkasBlogPropValueProvider as V}from"./prop-value/blog.js";import{IkasBlogListPropValueProvider as F}from"./prop-value/blog-list.js";import{IkasAttributePropValueProvider as k}from"./prop-value/attribute.js";import{IkasAttributeListPropValueProvider as U}from"./prop-value/attribute-list.js";import{IkasBlogCategoryPropValueProvider as N}from"./prop-value/blog-category.js";import{IkasBlogCategoryListPropValueProvider as Y}from"./prop-value/blog-category-list.js";import{IkasRafflePropValueProvider as J}from"./prop-value/raffle.js";import{IkasRaffleListPropValueProvider as H}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.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:M.getJson()}}},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,j.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(),[2]}}))}))},c.prototype.getPageSpecificData=function(){var r,i,a;return e(this,void 0,void 0,(function(){var p,c,d,l,j,b,D,L,S,O=this;return t(this,(function(w){switch(w.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=w.sent()).length?[3,6]:[2];case 2:return(null===(a=this.possiblePageTypes)||void 0===a?void 0:a.includes(u.RAFFLE_DETAIL))?[4,y.listRaffleMetaData(p)]:[3,4];case 3:return(c=w.sent()).length?[3,6]:[2];case 4:return[4,v.listHTMLMetaData(p)];case 5:if(!(c=w.sent())||!c.length)return[2];w.label=6;case 6:if(!(d=c[0]).targetId)return[2];switch(l=function(){return e(O,void 0,void 0,(function(){var e,r,i,a,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.searchProducts({productIdList:[d.targetId],priceListId:M.priceListId,salesChannelId:M.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]}}))}))},j=function(){return e(O,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]}}))}))},b=function(){return e(O,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]}}))}))},D=function(){return e(O,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]}}))}))},L=function(){return e(O,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]}}))}))},S=function(){return e(O,void 0,void 0,(function(){var e,r;return t(this,(function(t){switch(t.label){case 0:return[4,y.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,j()];case 8:return[2,w.sent()];case 9:return[4,b()];case 10:return[2,w.sent()];case 11:return[4,l()];case 12:return[2,w.sent()];case 13:return[4,D()];case 14:return[2,w.sent()];case 15:return[4,L()];case 16:return[2,w.sent()];case 17:return[4,S()];case 18:return[2,w.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 P(a),[3,27];case 2:return e=new _(a),[3,27];case 3:return e=new I(a),[3,27];case 4:return e=new R(a),[3,27];case 5:return e=new w(a),[3,27];case 6:return e=new S(a),[3,27];case 7:return e=new L(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 U(a),[3,27];case 12:return e=new E(a),[3,27];case 13:return e=new A(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 B(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 V(a),[3,27];case 20:return e=new F(this.pageType,a,this.pageSpecificData),[3,27];case 21:return e=new N(a),[3,27];case 22:return e=new Y(a),[3,27];case 23:return e=new J(a),[3,27];case 24:return e=new H,[3,27];case 25:return e=new G(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,v.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,y.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 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};
@@ -47,6 +47,7 @@ export declare class IkasNextPageDataProvider {
47
47
  customerReviewSettings: IkasCustomerReviewSettings | null;
48
48
  productBackInStockSettings: any;
49
49
  };
50
+ productReviewSummary: string;
50
51
  };
51
52
  notFound?: undefined;
52
53
  revalidate?: undefined;
@@ -80,6 +81,7 @@ export declare class IkasNextPageDataProvider {
80
81
  customerReviewSettings: IkasCustomerReviewSettings | null;
81
82
  productBackInStockSettings: any;
82
83
  };
84
+ productReviewSummary: string;
83
85
  };
84
86
  revalidate: number;
85
87
  notFound?: undefined;
@@ -122,6 +124,7 @@ export declare class IkasNextPageDataProvider {
122
124
  customerReviewSettings: IkasCustomerReviewSettings | null;
123
125
  productBackInStockSettings: any;
124
126
  };
127
+ productReviewSummary: string;
125
128
  };
126
129
  notFound?: undefined;
127
130
  revalidate?: undefined;
@@ -155,6 +158,7 @@ export declare class IkasNextPageDataProvider {
155
158
  customerReviewSettings: IkasCustomerReviewSettings | null;
156
159
  productBackInStockSettings: any;
157
160
  };
161
+ productReviewSummary: string;
158
162
  };
159
163
  revalidate: number;
160
164
  notFound?: undefined;
@@ -197,6 +201,7 @@ export declare class IkasNextPageDataProvider {
197
201
  customerReviewSettings: IkasCustomerReviewSettings | null;
198
202
  productBackInStockSettings: any;
199
203
  };
204
+ productReviewSummary: string;
200
205
  };
201
206
  notFound?: undefined;
202
207
  revalidate?: undefined;
@@ -230,6 +235,7 @@ export declare class IkasNextPageDataProvider {
230
235
  customerReviewSettings: IkasCustomerReviewSettings | null;
231
236
  productBackInStockSettings: any;
232
237
  };
238
+ productReviewSummary: string;
233
239
  };
234
240
  revalidate: number;
235
241
  notFound?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.37-alpha.6",
3
+ "version": "2.0.37",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",