@ikas/storefront 4.11.4 → 4.11.6

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{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-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{IkasStorefrontConfig as d}from"@ikas/storefront-config";var s=o((function(o){var s,c,p,u=o.pageType,g=o.pageTitle,v=o.pageDescription,f=o.canonicals,h=o.disableIndex,y=o.pageSpecificData,x=o.merchantSettings,j=o.addOgpMetas,b=o.productReviewSummary,C=a(),k="undefined"!=typeof window,E="local"===process.env.NEXT_PUBLIC_ENV,T=C.asPath.split("?")[0].replace("/",""),L=(T="/"===T.charAt(T.length-1)?T.slice(0,-1):T).startsWith("pages/"),w=d.getCurrentRouting(),D=(null==w?void 0:w.path)?"/"+w.path:"",R=E?"http://localhost:3333":"https://"+d.getDomain(),P=null===(s=d.getIndexPageSeoSettings())||void 0===s?void 0:s.find((function(e){return e.locale===d.getCurrentLocale()})),S=P?new n(P):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[u,y]);var O=t.useMemo((function(){if(y&&y.href)return"".concat(R).concat(y.href)}),[y]),A=t.useMemo((function(){var e,t,o=[];if(j){if(o.push({property:"og:type",content:"website"}),o.push({property:"og:site_name",content:"https://"+d.getDomain()}),g&&o.push({property:"og:title",content:g}),v&&o.push({property:"og:description",content:v}),u===r.INDEX){var i=null,a=null;!g&&(null==S?void 0:S.pageTitle)&&(i=S.pageTitle),!v&&(null==S?void 0:S.description)&&(a=S.description);var n=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===u}));n&&(i=m(y,u,n.titleTemplate||""),a=m(y,u,n.descriptionTemplate||"")),i&&o.push({property:"og:title",content:i}),a&&o.push({property:"og:description",content:a})}if(o.push({property:"og:url",content:O||(k?window.location.href:"")||"https://".concat(d.getDomain())}),y&&u===r.PRODUCT){var s=y.selectedVariant.mainImage;(null==s?void 0:s.image)&&o.push({property:"og:image",content:s.image.src})}else(null==S?void 0:S.icon)?o.push({property:"og:image",content:null===(t=null==S?void 0:S.icon)||void 0===t?void 0:t.src}):(null==x?void 0:x.logo)&&o.push({property:"og:image",content:x.logo.src});if(y&&u===r.CATEGORY){var l=y;l.image&&o.push({property:"og:image",content:l.image.src})}if(y&&u===r.BRAND){var c=y;c.image&&o.push({property:"og:image",content:c.image.src})}}return o}),[g,y,O,v,x,j,x]),I=t.useMemo((function(){var t=[];if(x){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},i=function(t){var o,i,a,r,n,s,l=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:l,image:l,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(x);t.push(o),t.push(i)}if(y&&u===r.PRODUCT){var a=y,n=function(t,o){var i,a,r,n;try{var s="https://".concat(d.getDomain()).concat(t.href),l=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(i=t.metaData)||void 0===i?void 0:i.description,image:null===(a=l.images)||void 0===a?void 0:a.map((function(e){return e.image?e.image.src:""})),productId:l.id,sku:l.sku,mpn:(null===(r=l.barcodeList)||void 0===r?void 0:r.length)?l.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=t.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:s,priceCurrency:l.price.currency||"TRY",price:l.price.finalPrice.toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:l.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(a,b||null);if(n&&t.push(n),a.categories.length)(m=l(a.categories[0]))&&t.push(m)}if(y&&u===r.CATEGORY){var s=function(e){var t,o;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(d.getDomain()).concat(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(y),m=l(y);s&&t.push(s),m&&t.push(m)}if(y&&u===r.BLOG){var c=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a=function(e){var t=new Date(e),o=t.getFullYear(),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(i,"-").concat(a)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:a(t.createdAt),dateCreated:a(t.createdAt),dateModified:a(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(y);c&&t.push(c)}return t}),[y,x]),M=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===u}));return t?m(y,u,t.titleTemplate||""):null}),[u,y]),N=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===u}));return t?m(y,u,t.descriptionTemplate||""):null}),[u,y]),B=t.useMemo((function(){var e,t=null===(e=d.getFavicon())||void 0===e?void 0:e.id;return(null==S?void 0:S.favIcon)&&(t=S.favIcon),t||null}),[]),_=t.useCallback((function(){var e=d.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),U=[];return d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){U.push({routing:e,hrefLang:e.locale+"-"+t})})):U.push({routing:e,hrefLang:e.locale})})),t.createElement(i,null,t.createElement("title",null,g||M||(null==S?void 0:S.pageTitle)||""),t.createElement("meta",{name:"description",content:v||N||(null==S?void 0:S.description)||""}),u===r.CHECKOUT&&_()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/".concat((null===(c=d.getApiUrl())||void 0===c?void 0:c.includes("myikas.com"))?"epay":"epay-uat","/").concat((null===(p=d.getApiUrl())||void 0===p?void 0:p.includes("myikas.com"))?"containerServices":"containerServicesTest",".js")}),U.length>1&&U.filter((function(e){return!L||e.routing.id===(null==w?void 0:w.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(R+(e.routing.path?"/"+e.routing.path:""),"/").concat(T)})})),!!h&&t.createElement("meta",{name:"robots",content:"noindex"}),!!j&&A.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!f&&f.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(R).concat(D).concat(e)})})),B&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(B,"/image_180.webp"),type:"image/webp"}),t.createElement("link",{rel:"canonical",href:"".concat(R).concat(D,"/").concat(T)}),!!I.length&&I.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function l(e){try{var t=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:"https://"+d.getDomain()+e.href}}));return t.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:"https://"+d.getDomain()+e.href}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:t}}catch(e){}}function m(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var d=e,s=d.name,l=(null===(i=d.brand)||void 0===i?void 0:i.name)||"",m=d.selectedVariant.sku||"",p=(null===(a=d.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?d.selectedVariant.barcodeList[0]:"";n.includes("{{name}}")&&(n=c(n,"{{name}}",s)),n.includes("{{brand}}")&&(n=c(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=c(n,"{{sku}}",m)),n.includes("{{barcode}}")&&(n=c(n,"{{barcode}}",p));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=c(n,"{{name}}",u));break;case r.BLOG:var g=e.title;n.includes("{{name}}")&&(n=c(n,"{{name}}",g))}}catch(e){}return n.trimEnd()}function c(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{s as IkasPageHead};
1
+ import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-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{IkasStorefrontConfig as s}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import"../../pages/account/activate.js";import{IkasBaseStore as d}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var m=o((function(o){var d,m,p,u=o.pageType,g=o.pageTitle,v=o.pageDescription,f=o.canonicals,h=o.disableIndex,j=o.pageSpecificData,x=o.merchantSettings,y=o.addOgpMetas,b=o.productReviewSummary,k=a(),C="undefined"!=typeof window,T="local"===process.env.NEXT_PUBLIC_ENV,E=k.asPath.split("?")[0].replace("/",""),w=(E="/"===E.charAt(E.length-1)?E.slice(0,-1):E).startsWith("pages/"),D=s.getCurrentRouting(),L=(null==D?void 0:D.path)?"/"+D.path:"",_=T?"http://localhost:3333":"https://"+s.getDomain(),P=null===(d=s.getIndexPageSeoSettings())||void 0===d?void 0:d.find((function(e){return e.locale===s.getCurrentLocale()})),R=P?new n(P):null;t.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[u,j]);var O=t.useMemo((function(){if(j&&j.href)return"".concat(_).concat(j.href)}),[j]),S=t.useMemo((function(){var e,t,o=[];if(y){if(o.push({property:"og:type",content:"website"}),o.push({property:"og:site_name",content:"https://"+s.getDomain()}),g&&o.push({property:"og:title",content:g}),v&&o.push({property:"og:description",content:v}),u===r.INDEX){var i=null,a=null;!g&&(null==R?void 0:R.pageTitle)&&(i=R.pageTitle),!v&&(null==R?void 0:R.description)&&(a=R.description);var n=null===(e=s.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===s.getCurrentLocale()&&e.pageType===u}));n&&(i=c(j,u,n.titleTemplate||""),a=c(j,u,n.descriptionTemplate||"")),i&&o.push({property:"og:title",content:i}),a&&o.push({property:"og:description",content:a})}if(o.push({property:"og:url",content:O||(C?window.location.href:"")||"https://".concat(s.getDomain())}),j&&u===r.PRODUCT){var d=j.selectedVariant.mainImage;(null==d?void 0:d.image)&&o.push({property:"og:image",content:d.image.src})}else(null==R?void 0:R.icon)?o.push({property:"og:image",content:null===(t=null==R?void 0:R.icon)||void 0===t?void 0:t.src}):(null==x?void 0:x.logo)&&o.push({property:"og:image",content:x.logo.src});if(j&&u===r.CATEGORY){var m=j;m.image&&o.push({property:"og:image",content:m.image.src})}if(j&&u===r.BRAND){var l=j;l.image&&o.push({property:"og:image",content:l.image.src})}}return o}),[g,j,O,v,x,y,x]),I=t.useMemo((function(){var t=[];if(x){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+s.getDomain()},i=function(t){var o,i,a,r,n,d,m=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:m,image:m,url:"https://"+s.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(d=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===d?void 0:d.code})}}(x);t.push(o),t.push(i)}if(j&&u===r.PRODUCT){var a=j,n=function(t,o){var i,a,r,n;try{var d="https://".concat(s.getDomain()).concat(t.href),m=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(i=t.metaData)||void 0===i?void 0:i.description,image:null===(a=m.images)||void 0===a?void 0:a.map((function(e){return e.image?e.image.src:""})),productId:m.id,sku:m.sku,mpn:(null===(r=m.barcodeList)||void 0===r?void 0:r.length)?m.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=t.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:d,priceCurrency:m.price.currency||"TRY",price:m.price.finalPrice.toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:m.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(a,b||null);if(n&&t.push(n),a.categories.length)(m=l(a.categories[0],a))&&t.push(m)}if(j&&u===r.CATEGORY){var d=function(e){var t,o;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(s.getDomain()).concat(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(j),m=l(j);d&&t.push(d),m&&t.push(m)}if(j&&u===r.BLOG){var c=function(t){var o;try{var i="https://".concat(s.getDomain()).concat(t.href),a=function(e){var t=new Date(e),o=t.getFullYear(),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(i,"-").concat(a)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:a(t.createdAt),dateCreated:a(t.createdAt),dateModified:a(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(j);c&&t.push(c)}return t}),[j,x]),A=t.useMemo((function(){var e,t=null===(e=s.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===s.getCurrentLocale()&&e.pageType===u}));return t?c(j,u,t.titleTemplate||""):null}),[u,j]),M=t.useMemo((function(){var e,t=null===(e=s.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===s.getCurrentLocale()&&e.pageType===u}));return t?c(j,u,t.descriptionTemplate||""):null}),[u,j]),N=t.useMemo((function(){var e,t=null===(e=s.getFavicon())||void 0===e?void 0:e.id;return(null==R?void 0:R.favIcon)&&(t=R.favIcon),t||null}),[]),B=t.useCallback((function(){var e=s.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),U=[];return s.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){U.push({routing:e,hrefLang:e.locale+"-"+t})})):U.push({routing:e,hrefLang:e.locale})})),t.createElement(i,null,t.createElement("title",null,g||A||(null==R?void 0:R.pageTitle)||""),t.createElement("meta",{name:"description",content:v||M||(null==R?void 0:R.description)||""}),u===r.CHECKOUT&&B()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/".concat((null===(m=s.getApiUrl())||void 0===m?void 0:m.includes("myikas.com"))?"epay":"epay-uat","/").concat((null===(p=s.getApiUrl())||void 0===p?void 0:p.includes("myikas.com"))?"containerServices":"containerServicesTest",".js")}),U.length>1&&U.filter((function(e){return!w||e.routing.id===(null==D?void 0:D.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(_+(e.routing.path?"/"+e.routing.path:""),"/").concat(E)})})),!!h&&t.createElement("meta",{name:"robots",content:"noindex"}),!!y&&S.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!f&&f.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(_).concat(L).concat(e)})})),N&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(N,"/image_180.webp"),type:"image/webp"}),t.createElement("link",{rel:"canonical",href:"".concat(_).concat(L,"/").concat(E)}),!!I.length&&I.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function l(e,t){try{var o=d.getInstance(),i=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:"https://"+s.getDomain()+e.href}}));return i.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:"https://"+s.getDomain()+e.href}),o.currentPageType===r.PRODUCT&&t&&i.push({"@type":"ListItem",position:i.length+1,name:t.name,item:"https://"+s.getDomain()+t.productHref}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:i}}catch(e){}}function c(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,m=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",l=s.selectedVariant.sku||"",c=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"";n.includes("{{name}}")&&(n=p(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=p(n,"{{brand}}",m)),n.includes("{{sku}}")&&(n=p(n,"{{sku}}",l)),n.includes("{{barcode}}")&&(n=p(n,"{{barcode}}",c));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=p(n,"{{name}}",u));break;case r.BLOG:var g=e.title;n.includes("{{name}}")&&(n=p(n,"{{name}}",g))}}catch(e){}return n.trimEnd()}function p(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{m as IkasPageHead};
@@ -1 +1 @@
1
- import{__assign as t}from'./../ext/tslib/tslib.es6.js';import{renderComponent as e}from"../components/page/index.js";import{IkasAttributeList as i}from"../models/ui/product-attribute-list/index.js";import{IkasBlogCategory as a}from"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import{IkasBlog as r}from"../models/data/blog/index.js";import{IkasBrand as o}from"../models/data/brand/index.js";import{IkasThemeJsonPageType as n,IkasThemeJsonComponentPropType as s}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as u}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as d}from"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as l}from"../models/data/product/index.js";import{IkasRaffle as p}from"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../models/data/theme-json/page/component/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasBlogList as c}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as f}from"../models/ui/blog-category-list/index.js";import{IkasBrandList as g}from"../models/ui/brand-list/index.js";import{IkasCategoryList as P}from"../models/ui/category-list/index.js";import{IkasNavigationLink as V}from"../models/ui/navigation-link/index.js";import{IkasProductList as j}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as L}from"../models/ui/product-attribute-detail/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/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as v}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as D}from"../models/ui/raffle-list/index.js";import{IkasPageComponentPropValue as h,getPlaceholderBrand as x,getPlaceholderCategory as C,getPlaceholderProduct as T,getPlaceholderBlog as I,getPlaceholderBlogCategory as S,getPlaceholderRaffle as w}from"@ikas/storefront-providers";import b from"lodash/flatten";import{IkasBaseStore as y}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var _=function(){function _(){}return _.setPageSpecificData=function(e,i,o){if(this.isBrowser=o,e)switch(i){case n.PRODUCT:var s=e;_.pageSpecificData=new l(t(t({},s),{selectedVariantValues:s.selectedVariantValues||s.variants[0].variantValues})),o&&this._initProductOnBrowser(_.pageSpecificData);break;case n.CATEGORY:var d=e;_.pageSpecificData=new u(d);break;case n.BRAND:var m=e;_.pageSpecificData=new u(m);break;case n.BLOG:var c=e;_.pageSpecificData=new r(c);break;case n.BLOG_CATEGORY:var f=e;_.pageSpecificData=new a(f);break;case n.RAFFLE_DETAIL:var g=e;_.pageSpecificData=new p(g)}else this.pageSpecificData=void 0},_.isServer=function(){return"undefined"==typeof window},_.initPagePropValues=function(t,e,i,a,r){return this.flatCustomDataList=b(i.map((function(t){return t.flat}))),t.map((function(t){return _.initPageComponentPropValue(t,e,a,r)}))},_.initPageComponentPropValue=function(e,i,a,r){var o=i.find((function(t){return t.id===e.pageComponent.componentId})),n=null==o?void 0:o.props,s={};return null==n||n.map((function(t){var i=e.propValues[t.name];s[t.name]=_.initPropValue(t,i,a,r)})),new h(t(t({},e),{pageComponent:new m(t(t({},e.pageComponent),{propValues:s,componentId:o.id})),component:o,propValues:s}))},_.initPropValue=function(t,e,i,a){if(null==e)return null;switch(t.type){case s.IMAGE:return _.initImagePropValue(e);case s.IMAGE_LIST:return _.initImageListPropValue(e);case s.BRAND:return _.initBrandPropValue(e);case s.BRAND_LIST:return _.initBrandListPropValue(e);case s.CATEGORY:return _.initCategoryPropValue(e);case s.CATEGORY_LIST:return _.initCategoryListPropValue(e);case s.PRODUCT_LIST:return _.initProductListPropValue(e);case s.PRODUCT_DETAIL:return _.initProductPropValue(e);case s.PRODUCT_ATTRIBUTE:return _.initAttributePropValue(e);case s.PRODUCT_ATTRIBUTE_LIST:return _.initAttributeListPropValue(e);case s.LINK:case s.LIST_OF_LINK:return _.initLinkPropValue(e);case s.COMPONENT:return _.initComponentPropValue(e,i,a);case s.COMPONENT_LIST:return _.initComponentListPropValue(e,i,a);case s.CUSTOM:return _.initCustomDataPropValue(e,i,a);case s.BLOG:return _.initBlogPropValue(e);case s.BLOG_LIST:return _.initBlogListPropValue(e);case s.BLOG_CATEGORY:return _.initBlogCategoryPropValue(e);case s.BLOG_LIST:return _.initBlogCategoryListPropValue(e);case s.RAFFLE:return _.initRafflePropValue(e);case s.RAFFLE_LIST:return _.initRaffleListPropValue(e);case s.SLIDER:return _.initSliderPropValue(e);case s.VIDEO:return _.initVideoPropValue(e);default:return e}},_.initBrandPropValue=function(t){return t.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.brand?new o(t.brand):x()},_.initBrandListPropValue=function(t){return new g(t)},_.initCategoryPropValue=function(t){return t.categoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.category?new u(t.category):C()},_.initCategoryListPropValue=function(t){return new P(t)},_.initProductListPropValue=function(t){return new j(t,y.getInstance().router)},_.initProductPropValue=function(e){var i=new l(T());if(e.productDetailPropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new l(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return i},_._initProductOnBrowser=function(t){var e=new URLSearchParams(window.location.search),i=e.get("vid");if(i){var a=t.variants.find((function(t){return t.id===i}));a&&(t.selectedVariantValues=a.variantValues)}else{var r=t.variantTypes.map((function(t){return t.variantType.slug})),o=[];r.forEach((function(i,a){var r=t.variantTypes[a],n=e.get(i);if(n){var s=r.variantType.values.find((function(t){return t.slug===n}));s&&o.push(s)}})),o.length===t.selectedVariantValues.length&&(t.selectedVariantValues=o)}},_.initAttributePropValue=function(e){var i=null;if(e.attributePropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new l(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return new L(i,e.attributePropValue)},_.initAttributeListPropValue=function(e){var a=null;if(e.attributeListPropValue.usePageData&&this.pageSpecificData)a=this.pageSpecificData;else if(e.productDetail){var r=e.productDetail;a=new l(t(t({},r),{selectedVariantValues:r.selectedVariantValues}))}return new i(a,e.attributeListPropValue)},_.initLinkPropValue=function(t){return Array.isArray(t)?t.map((function(t){return new V(t.href,t.label,t.subLinks,t.isExternal||void 0)})):t?new V(t.href,t.label,t.subLinks,t.isExternal||void 0):void 0},_.initImagePropValue=function(t){return new d(t)},_.initImageListPropValue=function(t){return t.map((function(t){return new d(t)}))},_.initCustomDataPropValue=function(t,e,i){if(t&&t.value&&t.customDataId){var a=this.flatCustomDataList.find((function(e){return e.id===t.customDataId}));if(a)return this._initCustomDataPropValue(t,a,e,i)}},_._initCustomDataPropValue=function(t,e,i,a){var r=this;if(!t)return null;var o=t.value;if(null==o)return null;switch(e.type){case s.BRAND:return this.initBrandPropValue(o);case s.BRAND_LIST:return this.initBrandListPropValue(o);case s.CATEGORY_LIST:return this.initCategoryListPropValue(o);case s.CATEGORY:return this.initCategoryPropValue(o);case s.IMAGE_LIST:return this.initImageListPropValue(o);case s.IMAGE:return this.initImagePropValue(o);case s.LINK:return this.initLinkPropValue(o);case s.PRODUCT_DETAIL:return this.initProductPropValue(o);case s.PRODUCT_LIST:return this.initProductListPropValue(o);case s.PRODUCT_ATTRIBUTE:return this.initAttributePropValue(o);case s.PRODUCT_ATTRIBUTE_LIST:return this.initAttributeListPropValue(o);case s.BLOG:return this.initBlogPropValue(o);case s.BLOG_LIST:return this.initBlogListPropValue(o);case s.BLOG_CATEGORY:return this.initBlogCategoryPropValue(o);case s.BLOG_CATEGORY_LIST:return this.initBlogCategoryListPropValue(o);case s.RAFFLE:return this.initRafflePropValue(o);case s.RAFFLE_LIST:return this.initRaffleListPropValue(o);case s.SLIDER:return this.initSliderPropValue(o);case s.VIDEO:return _.initVideoPropValue(o);case s.OBJECT:for(var n={},u=function(t){var e=o[t.key],r=void 0;t.customDataId&&(r=d.flatCustomDataList.find((function(t){return t.id===e.customDataId}))),n[t.key]=d._initCustomDataPropValue(e,r||t,i,a)},d=this,l=0,p=e.nestedData||[];l<p.length;l++){u(p[l])}return n;case s.DYNAMIC_LIST:case s.STATIC_LIST:try{if(!o||!o.length)return null;var m=[],c=e.nestedData[0];return o.forEach((function(t){var e;c.customDataId&&(e=r.flatCustomDataList.find((function(e){return e.id===t.customDataId}))),m.push(r._initCustomDataPropValue(t,e||c,i,a))})),m}catch(t){return[]}case s.COMPONENT:return this.initComponentPropValue(o,i,a);case s.COMPONENT_LIST:return this.initComponentListPropValue(o,i,a);default:return o}},_.initComponentPropValue=function(t,e,i){return this._initComponentPropValue(t,e,i)},_._initComponentPropValue=function(t,i,a){var r=t.length?t[0]:void 0;if(r){var o=new h(r),n=_.initPageComponentPropValue(o,[o.component],i,a);if(n)return new v((function(){return e(n,i,-10)}))}},_.initComponentListPropValue=function(t,e,i){return this._initComponentListPropValue(t,e,i)},_._initComponentListPropValue=function(t,i,a){return t&&t.length?t.map((function(t){var r=new h(t),o=_.initPageComponentPropValue(r,[r.component],i,a);return new v((function(){return e(o,i,-1)}))})):[]},_.initBlogPropValue=function(t){return t.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blog?new r(t.blog):I()},_.initBlogListPropValue=function(t){return new c(t)},_.initBlogCategoryPropValue=function(t){return t.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blogCategory?new a(t.blogCategory):S()},_.initBlogCategoryListPropValue=function(t){return new f(t)},_.initRafflePropValue=function(t){return t.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.raffle?new p(t.raffle):new p(w())},_.initRaffleListPropValue=function(t){return new D(t)},_.initSliderPropValue=function(t){return t},_.initVideoPropValue=function(e){return t(t({},e),{thumbnailImage:e.thumbnailImage?new d(e.thumbnailImage):null})},_.pageSpecificData={},_.flatCustomDataList=[],_.isBrowser=!1,_}();export{_ as IkasPageDataInit};
1
+ import{__assign as t}from'./../ext/tslib/tslib.es6.js';import{renderComponent as e}from"../components/page/index.js";import{IkasAttributeList as i}from"../models/ui/product-attribute-list/index.js";import{IkasBlogCategory as a}from"../models/data/blog/category/index.js";import"../models/data/blog/content/index.js";import"../models/data/blog/meta-data/index.js";import"../models/data/blog/tag/index.js";import{IkasBlog as r}from"../models/data/blog/index.js";import{IkasBrand as o}from"../models/data/brand/index.js";import{IkasThemeJsonPageType as n,IkasThemeJsonComponentPropType as s}from"@ikas/storefront-models";import"mobx";import"../models/data/campaign-offer/index.js";import"../models/data/cart/campaign-offer/index.js";import"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as u}from"../models/data/category/index.js";import"../models/data/checkout/index.js";import"../models/data/checkout-settings/index.js";import"../models/data/city/index.js";import"../models/data/country/index.js";import"../models/data/customer/address/region/index.js";import"../models/data/customer/address/index.js";import"../models/data/customer/address/ikas-localized-customer-address.js";import"../models/data/customer/attribute/index.js";import"../models/data/customer/review/summary/index.js";import"../models/data/customer/review/index.js";import"../models/data/customer/index.js";import"../models/data/district/index.js";import"../models/data/favorite-product/index.js";import"../models/data/filter-category/index.js";import"../models/data/html-meta-data/index.js";import{IkasImage as d}from"../models/data/image/index.js";import"../models/data/order/address/region/index.js";import"../models/data/order/address/index.js";import"../models/data/order/line-item/option/value/index.js";import"../models/data/order/line-item/variant/value/index.js";import"../models/data/order/line-item/variant/index.js";import"../models/data/order/line-item/index.js";import"../models/data/order/package/index.js";import"../models/data/order/transaction/index.js";import"../models/data/order/index.js";import"../models/data/payment-gateway/index.js";import"../models/data/product/attribute-value/index.js";import"../models/data/product/filter/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as l}from"../models/data/product/index.js";import{IkasRaffle as p}from"../models/data/raffle/index.js";import"../models/data/shipping-zone/state/city/district/region/index.js";import"../models/data/state/index.js";import"../models/data/theme-json/index.js";import"../models/data/theme-json/component/index.js";import"../models/data/theme-json/custom-data/index.js";import{IkasThemeJsonPageComponent as m}from"../models/data/theme-json/page/component/index.js";import"../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{IkasBlogList as c}from"../models/ui/blog-list/index.js";import{IkasBlogCategoryList as f}from"../models/ui/blog-category-list/index.js";import{IkasBrandList as g}from"../models/ui/brand-list/index.js";import{IkasCategoryList as P}from"../models/ui/category-list/index.js";import{IkasNavigationLink as V}from"../models/ui/navigation-link/index.js";import{IkasProductList as j}from"../models/ui/product-list/index.js";import{IkasAttributeDetail as v}from"../models/ui/product-attribute-detail/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/ikas-address.js";import"../models/ui/validator/form/register.js";import"../models/ui/validator/form/contact-form.js";import"../models/ui/validator/form/forgot-password.js";import"../models/ui/validator/form/recover-password.js";import"../models/ui/validator/form/account-info.js";import"../models/ui/validator/form/raffle-form.js";import"../models/ui/validator/form/customer-review.js";import{IkasComponentRenderer as L}from"../models/ui/component-renderer/index.js";import{IkasRaffleList as D}from"../models/ui/raffle-list/index.js";import{IkasPageComponentPropValue as h,getPlaceholderBrand as x,getPlaceholderCategory as C,getPlaceholderProduct as T,getPlaceholderBlog as I,getPlaceholderBlogCategory as S,getPlaceholderRaffle as w}from"@ikas/storefront-providers";import b from"lodash/flatten";import{IkasBaseStore as y}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import{IkasProductVariantFunctions as _}from"@ikas/storefront-model-functions";var O=function(){function O(){}return O.setPageSpecificData=function(e,i,o){var s;if(this.isBrowser=o,e)switch(i){case n.PRODUCT:var d=e;O.pageSpecificData=new l(t(t({},d),{selectedVariantValues:d.selectedVariantValues||(null===(s=d.variants.find((function(t){return _.hasStock(t)})))||void 0===s?void 0:s.variantValues)||d.variants[0].variantValues})),o&&this._initProductOnBrowser(O.pageSpecificData);break;case n.CATEGORY:var m=e;O.pageSpecificData=new u(m);break;case n.BRAND:var c=e;O.pageSpecificData=new u(c);break;case n.BLOG:var f=e;O.pageSpecificData=new r(f);break;case n.BLOG_CATEGORY:var g=e;O.pageSpecificData=new a(g);break;case n.RAFFLE_DETAIL:var P=e;O.pageSpecificData=new p(P)}else this.pageSpecificData=void 0},O.isServer=function(){return"undefined"==typeof window},O.initPagePropValues=function(t,e,i,a,r){return this.flatCustomDataList=b(i.map((function(t){return t.flat}))),t.map((function(t){return O.initPageComponentPropValue(t,e,a,r)}))},O.initPageComponentPropValue=function(e,i,a,r){var o=i.find((function(t){return t.id===e.pageComponent.componentId})),n=null==o?void 0:o.props,s={};return null==n||n.map((function(t){var i=e.propValues[t.name];s[t.name]=O.initPropValue(t,i,a,r)})),new h(t(t({},e),{pageComponent:new m(t(t({},e.pageComponent),{propValues:s,componentId:o.id})),component:o,propValues:s}))},O.initPropValue=function(t,e,i,a){if(null==e)return null;switch(t.type){case s.IMAGE:return O.initImagePropValue(e);case s.IMAGE_LIST:return O.initImageListPropValue(e);case s.BRAND:return O.initBrandPropValue(e);case s.BRAND_LIST:return O.initBrandListPropValue(e);case s.CATEGORY:return O.initCategoryPropValue(e);case s.CATEGORY_LIST:return O.initCategoryListPropValue(e);case s.PRODUCT_LIST:return O.initProductListPropValue(e);case s.PRODUCT_DETAIL:return O.initProductPropValue(e);case s.PRODUCT_ATTRIBUTE:return O.initAttributePropValue(e);case s.PRODUCT_ATTRIBUTE_LIST:return O.initAttributeListPropValue(e);case s.LINK:case s.LIST_OF_LINK:return O.initLinkPropValue(e);case s.COMPONENT:return O.initComponentPropValue(e,i,a);case s.COMPONENT_LIST:return O.initComponentListPropValue(e,i,a);case s.CUSTOM:return O.initCustomDataPropValue(e,i,a);case s.BLOG:return O.initBlogPropValue(e);case s.BLOG_LIST:return O.initBlogListPropValue(e);case s.BLOG_CATEGORY:return O.initBlogCategoryPropValue(e);case s.BLOG_LIST:return O.initBlogCategoryListPropValue(e);case s.RAFFLE:return O.initRafflePropValue(e);case s.RAFFLE_LIST:return O.initRaffleListPropValue(e);case s.SLIDER:return O.initSliderPropValue(e);case s.VIDEO:return O.initVideoPropValue(e);default:return e}},O.initBrandPropValue=function(t){return t.brandPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.brand?new o(t.brand):x()},O.initBrandListPropValue=function(t){return new g(t)},O.initCategoryPropValue=function(t){return t.categoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.category?new u(t.category):C()},O.initCategoryListPropValue=function(t){return new P(t)},O.initProductListPropValue=function(t){return new j(t,y.getInstance().router)},O.initProductPropValue=function(e){var i=new l(T());if(e.productDetailPropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new l(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return i},O._initProductOnBrowser=function(t){var e=new URLSearchParams(window.location.search),i=e.get("vid");if(i){var a=t.variants.find((function(t){return t.id===i}));a&&(t.selectedVariantValues=a.variantValues)}else{var r=t.variantTypes.map((function(t){return t.variantType.slug})),o=[];r.forEach((function(i,a){var r=t.variantTypes[a],n=e.get(i);if(n){var s=r.variantType.values.find((function(t){return t.slug===n}));s&&o.push(s)}})),o.length===t.selectedVariantValues.length&&(t.selectedVariantValues=o)}},O.initAttributePropValue=function(e){var i=null;if(e.attributePropValue.usePageData&&this.pageSpecificData)i=this.pageSpecificData;else if(e.productDetail){var a=e.productDetail;i=new l(t(t({},a),{selectedVariantValues:a.selectedVariantValues}))}return new v(i,e.attributePropValue)},O.initAttributeListPropValue=function(e){var a=null;if(e.attributeListPropValue.usePageData&&this.pageSpecificData)a=this.pageSpecificData;else if(e.productDetail){var r=e.productDetail;a=new l(t(t({},r),{selectedVariantValues:r.selectedVariantValues}))}return new i(a,e.attributeListPropValue)},O.initLinkPropValue=function(t){return Array.isArray(t)?t.map((function(t){return new V(t.href,t.label,t.subLinks,t.isExternal||void 0)})):t?new V(t.href,t.label,t.subLinks,t.isExternal||void 0):void 0},O.initImagePropValue=function(t){return new d(t)},O.initImageListPropValue=function(t){return t.map((function(t){return new d(t)}))},O.initCustomDataPropValue=function(t,e,i){if(t&&t.value&&t.customDataId){var a=this.flatCustomDataList.find((function(e){return e.id===t.customDataId}));if(a)return this._initCustomDataPropValue(t,a,e,i)}},O._initCustomDataPropValue=function(t,e,i,a){var r=this;if(!t)return null;var o=t.value;if(null==o)return null;switch(e.type){case s.BRAND:return this.initBrandPropValue(o);case s.BRAND_LIST:return this.initBrandListPropValue(o);case s.CATEGORY_LIST:return this.initCategoryListPropValue(o);case s.CATEGORY:return this.initCategoryPropValue(o);case s.IMAGE_LIST:return this.initImageListPropValue(o);case s.IMAGE:return this.initImagePropValue(o);case s.LINK:return this.initLinkPropValue(o);case s.PRODUCT_DETAIL:return this.initProductPropValue(o);case s.PRODUCT_LIST:return this.initProductListPropValue(o);case s.PRODUCT_ATTRIBUTE:return this.initAttributePropValue(o);case s.PRODUCT_ATTRIBUTE_LIST:return this.initAttributeListPropValue(o);case s.BLOG:return this.initBlogPropValue(o);case s.BLOG_LIST:return this.initBlogListPropValue(o);case s.BLOG_CATEGORY:return this.initBlogCategoryPropValue(o);case s.BLOG_CATEGORY_LIST:return this.initBlogCategoryListPropValue(o);case s.RAFFLE:return this.initRafflePropValue(o);case s.RAFFLE_LIST:return this.initRaffleListPropValue(o);case s.SLIDER:return this.initSliderPropValue(o);case s.VIDEO:return O.initVideoPropValue(o);case s.OBJECT:for(var n={},u=function(t){var e=o[t.key],r=void 0;t.customDataId&&(r=d.flatCustomDataList.find((function(t){return t.id===e.customDataId}))),n[t.key]=d._initCustomDataPropValue(e,r||t,i,a)},d=this,l=0,p=e.nestedData||[];l<p.length;l++){u(p[l])}return n;case s.DYNAMIC_LIST:case s.STATIC_LIST:try{if(!o||!o.length)return null;var m=[],c=e.nestedData[0];return o.forEach((function(t){var e;c.customDataId&&(e=r.flatCustomDataList.find((function(e){return e.id===t.customDataId}))),m.push(r._initCustomDataPropValue(t,e||c,i,a))})),m}catch(t){return[]}case s.COMPONENT:return this.initComponentPropValue(o,i,a);case s.COMPONENT_LIST:return this.initComponentListPropValue(o,i,a);default:return o}},O.initComponentPropValue=function(t,e,i){return this._initComponentPropValue(t,e,i)},O._initComponentPropValue=function(t,i,a){var r=t.length?t[0]:void 0;if(r){var o=new h(r),n=O.initPageComponentPropValue(o,[o.component],i,a);if(n)return new L((function(){return e(n,i,-10)}))}},O.initComponentListPropValue=function(t,e,i){return this._initComponentListPropValue(t,e,i)},O._initComponentListPropValue=function(t,i,a){return t&&t.length?t.map((function(t){var r=new h(t),o=O.initPageComponentPropValue(r,[r.component],i,a);return new L((function(){return e(o,i,-1)}))})):[]},O.initBlogPropValue=function(t){return t.blogPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blog?new r(t.blog):I()},O.initBlogListPropValue=function(t){return new c(t)},O.initBlogCategoryPropValue=function(t){return t.blogCategoryPropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.blogCategory?new a(t.blogCategory):S()},O.initBlogCategoryListPropValue=function(t){return new f(t)},O.initRafflePropValue=function(t){return t.rafflePropValue.usePageData&&this.pageSpecificData?this.pageSpecificData:t.raffle?new p(t.raffle):new p(w())},O.initRaffleListPropValue=function(t){return new D(t)},O.initSliderPropValue=function(t){return t},O.initVideoPropValue=function(e){return t(t({},e),{thumbnailImage:e.thumbnailImage?new d(e.thumbnailImage):null})},O.pageSpecificData={},O.flatCustomDataList=[],O.isBrowser=!1,O}();export{O as IkasPageDataInit};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "4.11.4",
3
+ "version": "4.11.6",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,11 +17,11 @@
17
17
  "build": "rm -rf build && rollup -c"
18
18
  },
19
19
  "devDependencies": {
20
- "@ikas/storefront-api": "^4.11.4",
21
- "@ikas/storefront-config": "^4.11.4",
22
- "@ikas/storefront-model-functions": "^4.11.4",
23
- "@ikas/storefront-models": "^4.11.4",
24
- "@ikas/storefront-providers": "^4.11.4",
20
+ "@ikas/storefront-api": "^4.11.6",
21
+ "@ikas/storefront-config": "^4.11.6",
22
+ "@ikas/storefront-model-functions": "^4.11.6",
23
+ "@ikas/storefront-models": "^4.11.6",
24
+ "@ikas/storefront-providers": "^4.11.6",
25
25
  "@ikas/localized-address": "^1.0.0-beta.3",
26
26
  "@adyen/adyen-web": "^5.28.2",
27
27
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -55,11 +55,11 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@ikas/localized-address": "^1.0.0-beta.3",
58
- "@ikas/storefront-api": "^4.11.4",
59
- "@ikas/storefront-config": "^4.11.4",
60
- "@ikas/storefront-model-functions": "^4.11.4",
61
- "@ikas/storefront-models": "^4.11.4",
62
- "@ikas/storefront-providers": "^4.11.4",
58
+ "@ikas/storefront-api": "^4.11.6",
59
+ "@ikas/storefront-config": "^4.11.6",
60
+ "@ikas/storefront-model-functions": "^4.11.6",
61
+ "@ikas/storefront-models": "^4.11.6",
62
+ "@ikas/storefront-providers": "^4.11.6",
63
63
  "mobx": "^6.1.3",
64
64
  "mobx-react-lite": "^3.1.5",
65
65
  "next": "12.2.0",