@ikas/storefront 4.14.6 → 4.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import a from"next/head.js";import{useRouter as i}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/campaign-offer/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 l=o((function(o){var d,l,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,C=i(),k="undefined"!=typeof window,w="local"===process.env.NEXT_PUBLIC_ENV,D=C.asPath.split("?")[0].replace("/",""),T=(D="/"===D.charAt(D.length-1)?D.slice(0,-1):D).startsWith("pages/"),E=s.getCurrentRouting(),L=(null==E?void 0:E.path)?"/"+E.path:"",P=w?"http://localhost:3333":"https://"+s.getDomain(),R=null===(d=s.getIndexPageSeoSettings())||void 0===d?void 0:d.find((function(e){return e.locale===s.getCurrentLocale()})),_=R?new n(R):null;t.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[u,j]);var O=t.useMemo((function(){if(j&&j.href)return"".concat(P).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 a=null,i=null;!g&&(null==_?void 0:_.pageTitle)&&(a=_.pageTitle),!v&&(null==_?void 0:_.description)&&(i=_.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&&(a=m(j,u,n.titleTemplate||""),i=m(j,u,n.descriptionTemplate||"")),a&&o.push({property:"og:title",content:a}),i&&o.push({property:"og:description",content:i})}if(o.push({property:"og:url",content:O||(k?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.replace(".webp",".jpg")})}else(null==_?void 0:_.icon)?o.push({property:"og:image",content:null===(t=null==_?void 0:_.icon)||void 0===t?void 0:t.src.replace(".webp",".jpg")}):(null==x?void 0:x.logo)&&o.push({property:"og:image",content:x.logo.src.replace(".webp",".jpg")});if(j&&u===r.CATEGORY){var l=j;l.image&&o.push({property:"og:image",content:l.image.src.replace(".webp",".jpg")})}if(j&&u===r.BRAND){var c=j;c.image&&o.push({property:"og:image",content:c.image.src.replace(".webp",".jpg")})}}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()},a=function(t){var o,a,i,r,n,d,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://"+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===(i=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===i?void 0:i.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(a)}if(j&&u===r.PRODUCT){var i=j,n=function(t,o){var a,i,r,n,d;try{var l=s.getCurrentRouting(),c=null==l?void 0:l.path,m=function(e){return c?"https://".concat(s.getDomain(),"/").concat(c).concat(e):"https://".concat(s.getDomain()).concat(e)},p=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(i=p.images)||void 0===i?void 0:i.map((function(e){return e.image?e.image.src:""})),productId:p.id,sku:p.sku,mpn:(null===(r=p.barcodeList)||void 0===r?void 0:r.length)?p.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:m(t.href),priceCurrency:p.price.currency||"TRY",price:(null!==(d=p.campaignPrice)&&void 0!==d?d:p.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:p.stock>0||p.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(i,b||null);if(n&&t.push(n),i.categories.length)(l=c(i.categories[0],i))&&t.push(l)}if(j&&u===r.CATEGORY){var d=function(e){var t,o;try{var a=s.getCurrentRouting(),i=null==a?void 0:a.path,r=function(e){return i?"https://".concat(s.getDomain(),"/").concat(i).concat(e):"https://".concat(s.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(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),l=c(j);d&&t.push(d),l&&t.push(l)}if(j&&u===r.BLOG){var m=function(t){var o;try{var a="https://".concat(s.getDomain()).concat(t.href),i=function(e){var t=new Date(e),o=t.getFullYear(),a=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(a,"-").concat(i)},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:a,datePublished:i(t.createdAt),dateCreated:i(t.createdAt),dateModified:i(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(j);m&&t.push(m)}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?m(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?m(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==_?void 0:_.favIcon)&&(t=_.favIcon),t||null}),[]),B=t.useCallback((function(){var e=s.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),U=[];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})}));var V=function(e){var t,o,a,i,r,n=j,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=U.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(i=null===(a=null==n?void 0:n.metaData)||void 0===a?void 0:a.translations)||void 0===i?void 0:i.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""};return t.createElement(a,null,t.createElement("title",null,g||A||(null==_?void 0:_.pageTitle)||""),t.createElement("meta",{name:"description",content:v||M||(null==_?void 0:_.description)||""}),u===r.CHECKOUT&&B()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/".concat((null===(l=s.getApiUrl())||void 0===l?void 0:l.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!T||e.routing.id===(null==E?void 0:E.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(P+(e.routing.path?"/"+e.routing.path:""),"/").concat(V(e.routing))})})),!!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(P).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(P).concat(L,"/").concat(D)}),!!I.length&&I.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function c(e,t){try{var o=d.getInstance(),a=s.getCurrentRouting(),i=null==a?void 0:a.path,n=function(e){return i?"https://".concat(s.getDomain(),"/").concat(i).concat(e):"https://".concat(s.getDomain()).concat(e)},l=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:n(e.href)}}));return l.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:n(e.href)}),o.currentPageType===r.PRODUCT&&t&&l.push({"@type":"ListItem",position:l.length+1,name:t.name,item:n(t.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:l}}catch(e){}}function m(e,t,o){var a,i,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(a=s.brand)||void 0===a?void 0:a.name)||"",c=s.selectedVariant.sku||"",m=(null===(i=s.selectedVariant.barcodeList)||void 0===i?void 0:i.length)?s.selectedVariant.barcodeList[0]:"",u=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=p(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=p(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=p(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=p(n,"{{barcode}}",m)),n.includes("{{price}}")&&(n=p(n,"{{price}}",u.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var g=e.name||"";n.includes("{{name}}")&&(n=p(n,"{{name}}",g));break;case r.BLOG:var v=e.title;n.includes("{{name}}")&&(n=p(n,"{{name}}",v))}}catch(e){}return n.trimEnd()}function p(e,t,o){var a=new RegExp(t,"g");return e.replace(a,o)}export{l 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 a from"next/head.js";import{useRouter as i}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/campaign-offer/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 l=o((function(o){var d,l,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,C=i(),k="undefined"!=typeof window,w="local"===process.env.NEXT_PUBLIC_ENV,D=C.asPath.split("?")[0].replace("/",""),T=(D="/"===D.charAt(D.length-1)?D.slice(0,-1):D).startsWith("pages/"),E=s.getCurrentRouting(),L=(null==E?void 0:E.path)?"/"+E.path:"",P=w?"http://localhost:3333":"https://"+s.getDomain(),R=null===(d=s.getIndexPageSeoSettings())||void 0===d?void 0:d.find((function(e){return e.locale===s.getCurrentLocale()})),_=R?new n(R):null;t.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[u,j]);var O=t.useMemo((function(){if(j&&j.href)return"".concat(P).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 a=null,i=null;!g&&(null==_?void 0:_.pageTitle)&&(a=_.pageTitle),!v&&(null==_?void 0:_.description)&&(i=_.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&&(a=m(j,u,n.titleTemplate||""),i=m(j,u,n.descriptionTemplate||"")),a&&o.push({property:"og:title",content:a}),i&&o.push({property:"og:description",content:i})}if(o.push({property:"og:url",content:O||(k?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.replace(".webp",".jpg")})}else(null==_?void 0:_.icon)?o.push({property:"og:image",content:null===(t=null==_?void 0:_.icon)||void 0===t?void 0:t.src.replace(".webp",".jpg")}):(null==x?void 0:x.logo)&&o.push({property:"og:image",content:x.logo.src.replace(".webp",".jpg")});if(j&&u===r.CATEGORY){var l=j;l.image&&o.push({property:"og:image",content:l.image.src.replace(".webp",".jpg")})}if(j&&u===r.BRAND){var c=j;c.image&&o.push({property:"og:image",content:c.image.src.replace(".webp",".jpg")})}}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()},a=function(t){var o,a,i,r,n,d,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://"+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===(i=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===i?void 0:i.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(a)}if(j&&u===r.PRODUCT){var i=j,n=function(t,o){var a,i,r,n,d;try{var l=s.getCurrentRouting(),c=null==l?void 0:l.path,m=function(e){return c?"https://".concat(s.getDomain(),"/").concat(c).concat(e):"https://".concat(s.getDomain()).concat(e)},p=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(i=p.images)||void 0===i?void 0:i.map((function(e){return e.image?e.image.src:""})),productId:p.id,sku:p.sku,mpn:(null===(r=p.barcodeList)||void 0===r?void 0:r.length)?p.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:m(t.href),priceCurrency:p.price.currency||"TRY",price:(null!==(d=p.campaignPrice)&&void 0!==d?d:p.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:p.stock>0||p.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(i,b||null);if(n&&t.push(n),i.categories.length)(l=c(i.categories[0],i))&&t.push(l)}if(j&&u===r.CATEGORY){var d=function(e){var t,o;try{var a=s.getCurrentRouting(),i=null==a?void 0:a.path,r=function(e){return i?"https://".concat(s.getDomain(),"/").concat(i).concat(e):"https://".concat(s.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(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),l=c(j);d&&t.push(d),l&&t.push(l)}if(j&&u===r.BLOG){var m=function(t){var o;try{var a="https://".concat(s.getDomain()).concat(t.href),i=function(e){var t=new Date(e),o=t.getFullYear(),a=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(a,"-").concat(i)},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:a,datePublished:i(t.createdAt),dateCreated:i(t.createdAt),dateModified:i(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(j);m&&t.push(m)}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?m(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?m(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==_?void 0:_.favIcon)&&(t=_.favIcon),t||null}),[]),B=t.useCallback((function(){var e=s.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),U=[];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})}));var V=function(e){var t,o,a,i,r,n=j,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=U.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(i=null===(a=null==n?void 0:n.metaData)||void 0===a?void 0:a.translations)||void 0===i?void 0:i.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""};return t.createElement(a,null,t.createElement("title",null,g||A||(null==_?void 0:_.pageTitle)||""),t.createElement("meta",{name:"description",content:v||M||(null==_?void 0:_.description)||""}),u===r.CHECKOUT&&B()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/".concat((null===(l=s.getApiUrl())||void 0===l?void 0:l.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!T||e.routing.id===(null==E?void 0:E.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(P+(e.routing.path?"/"+e.routing.path:""),"/").concat(V(e.routing))})})),!!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(P).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"}),!f&&t.createElement("link",{rel:"canonical",href:"".concat(P).concat(L,"/").concat(D)}),!!I.length&&I.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function c(e,t){try{var o=d.getInstance(),a=s.getCurrentRouting(),i=null==a?void 0:a.path,n=function(e){return i?"https://".concat(s.getDomain(),"/").concat(i).concat(e):"https://".concat(s.getDomain()).concat(e)},l=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:n(e.href)}}));return l.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:n(e.href)}),o.currentPageType===r.PRODUCT&&t&&l.push({"@type":"ListItem",position:l.length+1,name:t.name,item:n(t.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:l}}catch(e){}}function m(e,t,o){var a,i,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(a=s.brand)||void 0===a?void 0:a.name)||"",c=s.selectedVariant.sku||"",m=(null===(i=s.selectedVariant.barcodeList)||void 0===i?void 0:i.length)?s.selectedVariant.barcodeList[0]:"",u=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=p(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=p(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=p(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=p(n,"{{barcode}}",m)),n.includes("{{price}}")&&(n=p(n,"{{price}}",u.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var g=e.name||"";n.includes("{{name}}")&&(n=p(n,"{{name}}",g));break;case r.BLOG:var v=e.title;n.includes("{{name}}")&&(n=p(n,"{{name}}",v))}}catch(e){}return n.trimEnd()}function p(e,t,o){var a=new RegExp(t,"g");return e.replace(a,o)}export{l as IkasPageHead};
|
package/build/store/base.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare class IkasBaseStore {
|
|
|
17
17
|
router?: NextRouter;
|
|
18
18
|
private constructor();
|
|
19
19
|
static getInstance(): IkasBaseStore;
|
|
20
|
+
handleRouting(routing: IkasStorefrontRouting): void;
|
|
20
21
|
setLocalization(localeOption: IkasLocaleOption): void;
|
|
21
22
|
setLanguage(language: IkasLanguageOption): void;
|
|
22
23
|
private checkLocalization;
|
package/build/store/base.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as o,__generator as t}from'./../ext/tslib/tslib.es6.js';import{configure as
|
|
1
|
+
import{__awaiter as o,__generator as t}from'./../ext/tslib/tslib.es6.js';import{configure as n,makeObservable as i,observable as e}from"mobx";import{enableStaticRendering as r}from"mobx-react-lite";import s from"lodash/sortBy";import a from"lodash/flatten";import{IkasCartStore as u}from"./cart/index.js";import{IkasCustomerStore as c}from"./customer/index.js";import l from"./location/index.js";import{IkasThemeJsonPageType as d}from"@ikas/storefront-models";import{IkasStorefrontConfig as h}from"@ikas/storefront-config";import{IkasPageDataInit as p}from"../page-data-init/index.js";n({enforceActions:"never"}),r("undefined"==typeof window);var g=function(){function n(){this.currentPageType=null,this.localeOptions=[],this.languageOptions=[],this.showLocaleOptions=!1,this.currentCountryCode=null,this.spaLinksDisabled=!1,this.localeChecked=!1,this.customerStore=new c(this),this.cartStore=new u(this),"undefined"!=typeof window&&(this.spaLinksDisabled=navigator.userAgent.includes("Instagram")),this.init(),i(this,{currentPageType:e,localeOptions:e,languageOptions:e,showLocaleOptions:e,currentCountryCode:e,spaLinksDisabled:e})}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.handleRouting=function(o){var t,n;if(this.currentPageType===d.CATEGORY||this.currentPageType===d.BRAND||this.currentPageType===d.PRODUCT){var i=null===(n=null===(t=p.pageSpecificData.metaData)||void 0===t?void 0:t.translations)||void 0===n?void 0:n.find((function(t){return t.locale===o.locale}));if(i&&(null==i?void 0:i.slug)){var e="";e=o.path?"".concat(window.location.origin,"/").concat(o.path,"/").concat(i.slug):"".concat(window.location.origin,"/").concat(i.slug),window.location.replace(e)}else window.location.replace(window.location.origin+(o.path?"/"+o.path:"")+(this.router?this.router.asPath:""))}else window.location.replace(window.location.origin+(o.path?"/"+o.path:"")+(this.router?this.router.asPath:""))},n.prototype.setLocalization=function(o){var t=o.routing;t.domain?window.location.replace("https://"+t.domain):this.handleRouting(t)},n.prototype.setLanguage=function(o){var t=h.getRoutings().find((function(t){return t.id===o.id}));t&&this.handleRouting(t)},n.prototype.checkLocalization=function(){return o(this,void 0,void 0,(function(){var o,n,i,e,r,u,c,d,p,g,f;return t(this,(function(t){switch(t.label){case 0:return this.localeChecked?[2]:"undefined"==typeof window?(console.warn("checkLocalization should be called on the client side!"),[2]):[4,l.getMyCountry()];case 1:return(o=t.sent()).isSuccess?(n=o.data,i=h.getCurrentRouting(),this.currentCountryCode=n,i&&n?(e=!0,r=h.getRoutings().filter((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)})),u=h.getRoutings().find((function(o){var t;return!(null===(t=o.countryCodes)||void 0===t?void 0:t.length)})),r.length?r.some((function(o){return o.id===i.id}))||(e=!1):u&&i.id!==u.id&&(e=!1),c=[],d=[],p=a(h.getRoutings().map((function(o){return o.countryCodes||[]}))),[4,l.listCountry({iso2:{in:p}})]):[3,3]):[2];case 2:if(!(g=t.sent()).isSuccess)return[2];f=g.data||[],h.getRoutings().forEach((function(o){var t;(null===(t=o.countryCodes)||void 0===t?void 0:t.length)?o.countryCodes.forEach((function(t){var i=f.find((function(o){return o.iso2===t}));c.some((function(o){return o.iso2===(null==i?void 0:i.iso2)}))||c.push({id:(null==i?void 0:i.iso2)||(null==i?void 0:i.iso3)||Date.now()+"",countryName:(null==i?void 0:i.native)||(null==i?void 0:i.name)||"",iso2:(null==i?void 0:i.iso2)||void 0,iso3:(null==i?void 0:i.iso3)||void 0,routing:o,isRecommended:t===n})})):c.push({id:o.id,routing:o,isRecommended:!h.getRoutings().some((function(o){var t;return null===(t=o.countryCodes)||void 0===t?void 0:t.includes(n)}))})})),r.length&&(h.getRoutings().forEach((function(o){var t;r.some((function(t){return t.id===o.id}))&&d.push({id:o.id,currencyCode:o.currencyCode,currencySymbol:o.currencySymbol,language:"undefined"!=typeof Intl&&void 0!==Intl.DisplayNames&&new Intl.DisplayNames([],{type:"language"}).of(o.locale)||o.locale,locale:o.locale,isSelected:o.id===(null===(t=h.getCurrentRouting())||void 0===t?void 0:t.id)||!1})})),this.languageOptions=s(d,"language")),this.localeOptions=s(c,"countryName"),e||(this.showLocaleOptions=!0),this.localeChecked=!0,t.label=3;case 3:return[2]}}))}))},n.prototype.init=function(){this.customerStore.init()},n}();export{g as IkasBaseStore};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IkasContactForm, IkasCustomer, IkasCustomerAttributeValue, IkasFavoriteProduct, IkasOrderTransaction, IkasProduct, IkasOrder, IkasRaffleParticipant, IkasProductFile } from "../../models/data";
|
|
2
2
|
import { IkasLoginError, IkasRegisterError } from "@ikas/storefront-api";
|
|
3
3
|
import { IkasBaseStore } from "../base";
|
|
4
|
+
export declare type SocialLoginProvider = "facebook" | "google" | "twitch";
|
|
4
5
|
export declare class IkasCustomerStore {
|
|
5
6
|
customer?: IkasCustomer | null;
|
|
6
7
|
private token?;
|
|
@@ -21,7 +22,7 @@ export declare class IkasCustomerStore {
|
|
|
21
22
|
get isCaptchaRequired(): boolean;
|
|
22
23
|
private get useLastViewedProductResponse();
|
|
23
24
|
private toAnalyticsCustomer;
|
|
24
|
-
socialLogin(provider:
|
|
25
|
+
socialLogin(provider: SocialLoginProvider): Promise<void>;
|
|
25
26
|
socialLoginToken(token: string): Promise<boolean>;
|
|
26
27
|
refundOrder(order: IkasOrder, email?: string | null): Promise<boolean>;
|
|
27
28
|
/**
|
package/build/store/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.8",
|
|
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.14.
|
|
21
|
-
"@ikas/storefront-config": "^4.14.
|
|
22
|
-
"@ikas/storefront-model-functions": "^4.14.
|
|
23
|
-
"@ikas/storefront-models": "^4.14.
|
|
24
|
-
"@ikas/storefront-providers": "^4.14.
|
|
20
|
+
"@ikas/storefront-api": "^4.14.8",
|
|
21
|
+
"@ikas/storefront-config": "^4.14.8",
|
|
22
|
+
"@ikas/storefront-model-functions": "^4.14.8",
|
|
23
|
+
"@ikas/storefront-models": "^4.14.8",
|
|
24
|
+
"@ikas/storefront-providers": "^4.14.8",
|
|
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.14.
|
|
59
|
-
"@ikas/storefront-config": "^4.14.
|
|
60
|
-
"@ikas/storefront-model-functions": "^4.14.
|
|
61
|
-
"@ikas/storefront-models": "^4.14.
|
|
62
|
-
"@ikas/storefront-providers": "^4.14.
|
|
58
|
+
"@ikas/storefront-api": "^4.14.8",
|
|
59
|
+
"@ikas/storefront-config": "^4.14.8",
|
|
60
|
+
"@ikas/storefront-model-functions": "^4.14.8",
|
|
61
|
+
"@ikas/storefront-models": "^4.14.8",
|
|
62
|
+
"@ikas/storefront-providers": "^4.14.8",
|
|
63
63
|
"mobx": "^6.1.3",
|
|
64
64
|
"mobx-react-lite": "^3.1.5",
|
|
65
65
|
"next": "12.2.0",
|