@ikas/storefront 4.5.5 → 4.5.7
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{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as a}from"next/router.js";import r from"next/link.js";import s from"react-tooltip";import n,{CheckoutStep as c}from"./model.js";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CartSummary as h}from"./components/cart-summary/index.js";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 g}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/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/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/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"../../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{ContactForm as y}from"../../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{StepSuccess as f}from"./steps/step-success/index.js";import{Modal as E}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import x from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as C}from"../image/index.js";import b,{Step as N}from"./components/step-container/index.js";import{StockError as F}from"./components/error/stock-error/index.js";import{FullscreenLoading as M}from"./components/fullscreen-loading/index.js";import P from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as S}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import I from"./components/offer-product/index.js";import O from"./components/svg/ikas.js";import B from"./style.module.scss.js";import{Analytics as L}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import V from"./components/epaykolay-button/index.js";var R=i((function(i){var r,m,p,u=i.checkout,v=i.checkoutSettings,y=i.customizationProps,C=i.returnPolicy,b=i.privacyPolicy,N=i.termsOfService,P=i.imprint,T=i.shippingPolicy,S=d().t,w=a(),R=o.useState((function(){return new n(u,v,w,C,b,N,P,T,S,y||{})}))[0];R.step===c.PAYMENT&&L.disableHTML();var _=function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/get-basket"),[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()},body:JSON.stringify({cartId:R.checkout.id,customerNumber:o,sessionsState:Date.now()})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){R.checkoutSettings.isAccountRequired&&!R.checkout.hasCustomer&&w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),L.beginCheckout(R.checkout),L.pageView(g.CHECKOUT)}),[]),o.useEffect((function(){R.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(y)}),[y]),o.useEffect((function(){if(R.isEPayKolayEnabled)var o=setInterval((function(){var i;window.setContainerService&&R.isCheckoutLoaded&&(window.setContainerService(null===(i=l.getMerchantSettings())||void 0===i?void 0:i.merchantId,_,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,K(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),R.isEPayKolayPayment=!0}),"https://cdn.myikas.com/sf/static/e-pay-kolay/"),clearInterval(o))}),100)}),[]);var K=o.useCallback((function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/complete-payment"),{method:"POST",body:JSON.stringify({data:o,cartId:R.checkout.id}),headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()}})];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),[2,"".concat(window.location.pathname,"?id=").concat(R.checkout.id,"&step=").concat(e.success?"success":"info")]}}))}))}),[]);if(!R.isCheckoutLoaded||!R.store.customerStore.initialized)return o.createElement(M,null);if(R.checkout.hasCustomer&&(null===(r=R.store.customerStore.customer)||void 0===r?void 0:r.id)!==(null===(m=R.checkout.customer)||void 0===m?void 0:m.id))return w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(A,{pageType:g.CHECKOUT,pageTitle:((null===(p=R.merchantSettings)||void 0===p?void 0:p.merchantName)||"")+" - "+S("checkout-page:securePayment"),pageDescription:S("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:B.CheckoutPage},o.createElement(s,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:B.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[B.Left,R.isEPayKolayPayment?B.epaykolay:""].join(" ")},R.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!R.isEPayKolayPayment&&o.createElement("div",{className:B.LeftContent},o.createElement("div",null,o.createElement(U,{vm:R}),o.createElement("div",null,R.step!==c.SUCCESS&&R.isEPayKolayEnabled&&o.createElement(V,{onClick:function(){window.frictionless()}})),R.hasStockError&&o.createElement("div",{className:B.ErrorContainer},o.createElement(F,{vm:R,error:R.error})),!R.hasStockError&&o.createElement(o.Fragment,null,o.createElement(h,{vm:R,allowExpand:!0}),R.step===c.SUCCESS?o.createElement(f,{vm:R}):o.createElement(o.Fragment,null,R.checkoutCampaignOffer&&o.createElement(I,{vm:R,campaignOffer:R.checkoutCampaignOffer}),o.createElement(D,{vm:R}))),o.createElement("div",{className:B.Space})),o.createElement(H,{vm:R}))),o.createElement("div",{className:B.Right},o.createElement("div",{className:B.RightContent},o.createElement(h,{vm:R}),o.createElement("div",{className:B.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(O,null))))),!!R.policyModalText&&o.createElement(E,{title:R.policyModalTitle,modalContent:R.policyModalText,onClose:function(){R.policyModalText=""}}),R.isContactModalVisible&&o.createElement(z,{vm:R,setVisible:R.setContactModalVisible}),R.mpVM.isOtpModalVisible&&o.createElement(k,{vm:R,visible:R.mpVM.isOtpModalVisible,type:R.mpVM.otpModalType,onClose:R.mpVM.hideOtpModal}),R.mpVM.isResponseModalVisible&&o.createElement(x,{visible:R.mpVM.isResponseModalVisible,text:R.mpVM.mfsResponseModalText,onClose:R.mpVM.onResponseModalClose}),R.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:R.mpVM.isSuccessModalVisible,type:R.mpVM.successModalType,onClose:R.mpVM.onSuccessModalClose})))})),U=i((function(e){var t,i,a,s=e.vm,n=d().t;return o.createElement("div",{className:B.Header},o.createElement(r,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:B.Logo},o.createElement(C,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:B.LoginText},o.createElement("span",{className:B.LoginCta},n("checkout-page:alreadyHaveAnAccount")),o.createElement(r,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:B.LoginBtn},n("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:B.CustomerInfo},o.createElement("div",{className:B.Name},s.checkout.customerFullName),o.createElement("div",{className:B.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),D=i((function(e){var t=e.vm,i=d().t,a=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(p,{vm:t});case c.SHIPPING:return o.createElement(u,{vm:t});case c.PAYMENT:return o.createElement(v,{vm:t});case c.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),r=[new N(i("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:B.AdressStepInfo},o.createElement(_,{vm:t}),o.createElement("div",{className:B.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(_,{vm:t})):void 0),new N(i("checkout-page:payment"),t.step===c.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||r.splice(1,0,new N(i("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:B.AdressStepInfo},o.createElement(K,{vm:t}),(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:B.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(b,{steps:r,stepContent:a})})),_=i((function(e){var t,i,a,r,s,n,c,l,m,p=e.vm,u=d().t,v=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(i=p.checkout.billingAddress)||void 0===i?void 0:i.lastName)||""):((null===(a=p.checkout.shippingAddress)||void 0===a?void 0:a.firstName)||"")+" "+((null===(r=p.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:B.Address},o.createElement("div",{className:[B.Text,B.WithMBottom].join(" ")},(null===(s=p.checkout.customer)||void 0===s?void 0:s.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:B.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:B.Text},u("checkout-page:receiver")),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},v)),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(n=p.checkout.billingAddress)||void 0===n?void 0:n.phone:null===(c=p.checkout.shippingAddress)||void 0===c?void 0:c.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[B.Text,B.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),K=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:B.LightText}," / "+(0===t.checkout.shippingLines[0].price?i("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),H=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Footer},o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:imprint"),t.policyModalText=t.imprint}},i("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),z=i((function(i){var a,r,s,n=i.vm,c=i.setVisible,l=d().t,m=o.useState(!1),p=m[0],u=m[1],v=o.useState(!1),h=v[0],g=v[1],f=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];f.email=(null===(a=n.checkout.customer)||void 0===a?void 0:a.email)||"",f.firstName=(null===(r=n.checkout.customer)||void 0===r?void 0:r.firstName)||"",f.lastName=(null===(s=n.checkout.customer)||void 0===s?void 0:s.lastName)||"";var k=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,c(!1)]:(u(!0),[4,f.saveContactForm()]);case 1:return e.sent()&&g(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(E,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(P,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(T,{type:S.TEXT_AREA,label:"",value:f.message||"",onChange:f.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:l(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!f.message,onClick:k})),onClose:function(){return c(!1)}})}));export{R as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import a from"next/link.js";import s from"react-tooltip";import n,{CheckoutStep as c}from"./model.js";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CartSummary as h}from"./components/cart-summary/index.js";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 g}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/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/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/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"../../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{ContactForm as y}from"../../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{StepSuccess as f}from"./steps/step-success/index.js";import{Modal as E}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import x from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as C}from"../image/index.js";import b,{Step as N}from"./components/step-container/index.js";import{StockError as F}from"./components/error/stock-error/index.js";import{FullscreenLoading as M}from"./components/fullscreen-loading/index.js";import P from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as S}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import I from"./components/offer-product/index.js";import O from"./components/svg/ikas.js";import B from"./style.module.scss.js";import{Analytics as L}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import V from"./components/epaykolay-button/index.js";var R=i((function(i){var a,m,p,u=i.checkout,v=i.checkoutSettings,y=i.customizationProps,C=i.returnPolicy,b=i.privacyPolicy,N=i.termsOfService,P=i.imprint,T=i.shippingPolicy,S=d().t,w=r(),R=o.useState((function(){return new n(u,v,w,C,b,N,P,T,S,y||{})}))[0];R.step===c.PAYMENT&&L.disableHTML();var _=function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/get-basket"),[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()},body:JSON.stringify({cartId:R.checkout.id,customerNumber:o,sessionsState:Date.now()})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){R.checkoutSettings.isAccountRequired&&!R.checkout.hasCustomer&&w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),L.beginCheckout(R.checkout),L.pageView(g.CHECKOUT)}),[]),o.useEffect((function(){R.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(y)}),[y]),o.useEffect((function(){if(R.isEPayKolayEnabled)var o=setInterval((function(){var i;window.setContainerService&&R.isCheckoutLoaded&&(window.setContainerService(null===(i=l.getMerchantSettings())||void 0===i?void 0:i.merchantId,_,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,K(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),R.isEPayKolayPayment=!0}),"https://cdn-epeykolay.mncdn.com/epay/"),clearInterval(o))}),100)}),[]);var K=o.useCallback((function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/complete-payment"),{method:"POST",body:JSON.stringify({data:o,cartId:R.checkout.id}),headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()}})];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),[2,"".concat(window.location.pathname,"?id=").concat(R.checkout.id,"&step=").concat(e.success?"success":"info")]}}))}))}),[]);if(!R.isCheckoutLoaded||!R.store.customerStore.initialized)return o.createElement(M,null);if(R.checkout.hasCustomer&&(null===(a=R.store.customerStore.customer)||void 0===a?void 0:a.id)!==(null===(m=R.checkout.customer)||void 0===m?void 0:m.id))return w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(A,{pageType:g.CHECKOUT,pageTitle:((null===(p=R.merchantSettings)||void 0===p?void 0:p.merchantName)||"")+" - "+S("checkout-page:securePayment"),pageDescription:S("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:B.CheckoutPage},o.createElement(s,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:B.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[B.Left,R.isEPayKolayPayment?B.epaykolay:""].join(" ")},R.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!R.isEPayKolayPayment&&o.createElement("div",{className:B.LeftContent},o.createElement("div",null,o.createElement(U,{vm:R}),o.createElement("div",null,R.step!==c.SUCCESS&&R.isEPayKolayEnabled&&o.createElement(V,{onClick:function(){window.frictionless()}})),R.hasStockError&&o.createElement("div",{className:B.ErrorContainer},o.createElement(F,{vm:R,error:R.error})),!R.hasStockError&&o.createElement(o.Fragment,null,o.createElement(h,{vm:R,allowExpand:!0}),R.step===c.SUCCESS?o.createElement(f,{vm:R}):o.createElement(o.Fragment,null,R.checkoutCampaignOffer&&o.createElement(I,{vm:R,campaignOffer:R.checkoutCampaignOffer}),o.createElement(D,{vm:R}))),o.createElement("div",{className:B.Space})),o.createElement(H,{vm:R}))),o.createElement("div",{className:B.Right},o.createElement("div",{className:B.RightContent},o.createElement(h,{vm:R}),o.createElement("div",{className:B.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(O,null))))),!!R.policyModalText&&o.createElement(E,{title:R.policyModalTitle,modalContent:R.policyModalText,onClose:function(){R.policyModalText=""}}),R.isContactModalVisible&&o.createElement(z,{vm:R,setVisible:R.setContactModalVisible}),R.mpVM.isOtpModalVisible&&o.createElement(k,{vm:R,visible:R.mpVM.isOtpModalVisible,type:R.mpVM.otpModalType,onClose:R.mpVM.hideOtpModal}),R.mpVM.isResponseModalVisible&&o.createElement(x,{visible:R.mpVM.isResponseModalVisible,text:R.mpVM.mfsResponseModalText,onClose:R.mpVM.onResponseModalClose}),R.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:R.mpVM.isSuccessModalVisible,type:R.mpVM.successModalType,onClose:R.mpVM.onSuccessModalClose})))})),U=i((function(e){var t,i,r,s=e.vm,n=d().t;return o.createElement("div",{className:B.Header},o.createElement(a,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:B.Logo},o.createElement(C,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:B.LoginText},o.createElement("span",{className:B.LoginCta},n("checkout-page:alreadyHaveAnAccount")),o.createElement(a,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:B.LoginBtn},n("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:B.CustomerInfo},o.createElement("div",{className:B.Name},s.checkout.customerFullName),o.createElement("div",{className:B.Email},null===(r=s.checkout.customer)||void 0===r?void 0:r.email)))})),D=i((function(e){var t=e.vm,i=d().t,r=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(p,{vm:t});case c.SHIPPING:return o.createElement(u,{vm:t});case c.PAYMENT:return o.createElement(v,{vm:t});case c.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),a=[new N(i("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:B.AdressStepInfo},o.createElement(_,{vm:t}),o.createElement("div",{className:B.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(_,{vm:t})):void 0),new N(i("checkout-page:payment"),t.step===c.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||a.splice(1,0,new N(i("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:B.AdressStepInfo},o.createElement(K,{vm:t}),(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:B.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(b,{steps:a,stepContent:r})})),_=i((function(e){var t,i,r,a,s,n,c,l,m,p=e.vm,u=d().t,v=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(i=p.checkout.billingAddress)||void 0===i?void 0:i.lastName)||""):((null===(r=p.checkout.shippingAddress)||void 0===r?void 0:r.firstName)||"")+" "+((null===(a=p.checkout.shippingAddress)||void 0===a?void 0:a.lastName)||"");return o.createElement("div",{className:B.Address},o.createElement("div",{className:[B.Text,B.WithMBottom].join(" ")},(null===(s=p.checkout.customer)||void 0===s?void 0:s.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:B.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:B.Text},u("checkout-page:receiver")),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},v)),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(n=p.checkout.billingAddress)||void 0===n?void 0:n.phone:null===(c=p.checkout.shippingAddress)||void 0===c?void 0:c.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[B.Text,B.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),K=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:B.LightText}," / "+(0===t.checkout.shippingLines[0].price?i("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),H=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Footer},o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:imprint"),t.policyModalText=t.imprint}},i("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),z=i((function(i){var r,a,s,n=i.vm,c=i.setVisible,l=d().t,m=o.useState(!1),p=m[0],u=m[1],v=o.useState(!1),h=v[0],g=v[1],f=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];f.email=(null===(r=n.checkout.customer)||void 0===r?void 0:r.email)||"",f.firstName=(null===(a=n.checkout.customer)||void 0===a?void 0:a.firstName)||"",f.lastName=(null===(s=n.checkout.customer)||void 0===s?void 0:s.lastName)||"";var k=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,c(!1)]:(u(!0),[4,f.saveContactForm()]);case 1:return e.sent()&&g(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(E,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(P,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(T,{type:S.TEXT_AREA,label:"",value:f.message||"",onChange:f.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:l(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!f.message,onClick:k})),onClose:function(){return c(!1)}})}));export{R as default};
|
|
@@ -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 r}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 i}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/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/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/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"../../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 n}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var d=o((function(o){var n=o.pageType,d=o.pageTitle,c=o.pageDescription,p=o.canonicals,u=o.disableIndex,g=o.pageSpecificData,j=o.merchantSettings,f=o.addOgpMetas,v=o.productReviewSummary,h=r(),x="undefined"!=typeof window,y="local"===process.env.NEXT_PUBLIC_ENV,b=h.asPath.split("?")[0].replace("/","");b="/"===b.charAt(b.length-1)?b.slice(0,-1):b;var k=s.getRoutings().filter((function(e){return e.id!==s.getStorefrontRoutingId()})),C=s.getCurrentRouting(),E=(null==C?void 0:C.path)?"/"+C.path:"",T=y?"http://localhost:3333":"https://"+s.getDomain();t.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[n,g]);var w=t.useMemo((function(){if(g&&g.href)return"".concat(T).concat(g.href)}),[g]),L=t.useMemo((function(){var e=[];if(f)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+s.getDomain()}),d&&e.push({property:"og:title",content:d}),c&&e.push({property:"og:description",content:c}),e.push({property:"og:url",content:w||(x?window.location.href:"")||"https://".concat(s.getDomain())}),g&&n===i.PRODUCT){var t=g.selectedVariant.mainImage;(null==t?void 0:t.image)&&e.push({property:"og:image",content:t.image.src})}else(null==j?void 0:j.logo)&&e.push({property:"og:image",content:j.logo.src});return e}),[d,g,w,c,j,f,j]),D=t.useMemo((function(){var t=[];if(j){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+s.getDomain()},a=function(t){var o,a,r,i,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===(r=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===r?void 0:r.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(i=t.address)||void 0===i?void 0:i.postalCode,addressCountry:null===(d=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===d?void 0:d.code})}}(j);t.push(o),t.push(a)}if(g&&n===i.PRODUCT){var r=g,d=function(t,o){var a,r,i,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===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(r=m.images)||void 0===r?void 0:r.map((function(e){return e.image?e.image.src:""})),productId:m.id,sku:m.sku,mpn:(null===(i=m.barcodeList)||void 0===i?void 0:i.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,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:m.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(r,v||null);if(d&&t.push(d),r.categories.length)(c=m(r.categories[0]))&&t.push(c)}if(g&&n===i.CATEGORY){var l=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){}}(g),c=m(g);l&&t.push(l),c&&t.push(c)}return t}),[g,j]),R=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===n}));return t?l(g,n,t.titleTemplate||""):null}),[n,g]),_=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===n}));return t?l(g,n,t.descriptionTemplate||""):null}),[n,g]),O=t.useCallback((function(){var e=s.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]);return t.createElement(a,null,t.createElement("title",null,d||R||""),t.createElement("meta",{name:"description",content:c||_||""}),n===i.CHECKOUT&&O()&&t.createElement("script",{type:"text/javascript",src:"https://cdn.myikas.com/sf/static/e-pay-kolay/containerServices.js"}),k.map((function(e){return t.createElement("link",{key:e.id,rel:"alternate",hrefLang:e.locale,href:"".concat(T+(e.path?"/"+e.path:""),"/").concat(b)})})),!!C&&!!k.length&&t.createElement("link",{key:"current-routing-hreflang",rel:"alternate",hrefLang:C.locale,href:"".concat(T).concat(E,"/").concat(b)}),!!u&&t.createElement("meta",{name:"robots",content:"noindex"}),!!f&&L.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!p&&p.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(T).concat(E).concat(e)})})),t.createElement("link",{rel:"canonical",href:"".concat(T).concat(E,"/").concat(b)}),!!D.length&&D.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function m(e){try{var t=n.getInstance(),o=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:"https://"+s.getDomain()+e.href}}));return t.currentPageType===i.CATEGORY&&o.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:"https://"+s.getDomain()+e.href}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:e.categoryPathItems.length?o:[{"@type":"ListItem",position:1,name:e.name,item:"https://"+s.getDomain()+e.href}]}}catch(e){}}function l(e,t,o){var a,r,s=o;try{switch(t){case i.PRODUCT:var n=e,d=n.name,m=(null===(a=n.brand)||void 0===a?void 0:a.name)||"",l=n.selectedVariant.sku||"",c=(null===(r=n.selectedVariant.barcodeList)||void 0===r?void 0:r.length)?n.selectedVariant.barcodeList[0]:"";s.includes("{{name}}")&&(s=s.replace("{{name}}",d)),s.includes("{{brand}}")&&(s=s.replace("{{brand}}",m)),s.includes("{{sku}}")&&(s=s.replace("{{sku}}",l)),s.includes("{{barcode}}")&&(s=s.replace("{{barcode}}",c));break;case i.BRAND:case i.CATEGORY:case i.BLOG_CATEGORY:var p=e.name||"";s.includes("{{name}}")&&(s=s.replace("{{name}}",p));break;case i.BLOG:var u=e.title;s.includes("{{name}}")&&(s=s.replace("{{name}}",u))}}catch(e){}return s.trimEnd()}export{d 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 r}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 i}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/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/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/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"../../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 n}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var d=o((function(o){var n=o.pageType,d=o.pageTitle,c=o.pageDescription,p=o.canonicals,u=o.disableIndex,g=o.pageSpecificData,j=o.merchantSettings,f=o.addOgpMetas,v=o.productReviewSummary,h=r(),x="undefined"!=typeof window,y="local"===process.env.NEXT_PUBLIC_ENV,b=h.asPath.split("?")[0].replace("/","");b="/"===b.charAt(b.length-1)?b.slice(0,-1):b;var k=s.getCurrentRouting(),C=(null==k?void 0:k.path)?"/"+k.path:"",E=y?"http://localhost:3333":"https://"+s.getDomain();t.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[n,g]);var L=t.useMemo((function(){if(g&&g.href)return"".concat(E).concat(g.href)}),[g]),T=t.useMemo((function(){var e=[];if(f)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+s.getDomain()}),d&&e.push({property:"og:title",content:d}),c&&e.push({property:"og:description",content:c}),e.push({property:"og:url",content:L||(x?window.location.href:"")||"https://".concat(s.getDomain())}),g&&n===i.PRODUCT){var t=g.selectedVariant.mainImage;(null==t?void 0:t.image)&&e.push({property:"og:image",content:t.image.src})}else(null==j?void 0:j.logo)&&e.push({property:"og:image",content:j.logo.src});return e}),[d,g,L,c,j,f,j]),w=t.useMemo((function(){var t=[];if(j){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+s.getDomain()},a=function(t){var o,a,r,i,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===(r=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===r?void 0:r.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(i=t.address)||void 0===i?void 0:i.postalCode,addressCountry:null===(d=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===d?void 0:d.code})}}(j);t.push(o),t.push(a)}if(g&&n===i.PRODUCT){var r=g,d=function(t,o){var a,r,i,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===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(r=m.images)||void 0===r?void 0:r.map((function(e){return e.image?e.image.src:""})),productId:m.id,sku:m.sku,mpn:(null===(i=m.barcodeList)||void 0===i?void 0:i.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,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:m.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(r,v||null);if(d&&t.push(d),r.categories.length)(c=m(r.categories[0]))&&t.push(c)}if(g&&n===i.CATEGORY){var l=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){}}(g),c=m(g);l&&t.push(l),c&&t.push(c)}return t}),[g,j]),D=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===n}));return t?l(g,n,t.titleTemplate||""):null}),[n,g]),_=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===n}));return t?l(g,n,t.descriptionTemplate||""):null}),[n,g]),R=t.useCallback((function(){var e=s.getCustom();return!!e&&!!e.isEPayKolayEnabled}),[]),O=[];return s.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){O.push({routing:e,hrefLang:e.locale+"-"+t})})):O.push({routing:e,hrefLang:e.locale})})),t.createElement(a,null,t.createElement("title",null,d||D||""),t.createElement("meta",{name:"description",content:c||_||""}),n===i.CHECKOUT&&R()&&t.createElement("script",{type:"text/javascript",src:"https://cdn-epeykolay.mncdn.com/epay/containerServices.js"}),O.map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(E+(e.routing.path?"/"+e.routing.path:""),"/").concat(b)})})),!!u&&t.createElement("meta",{name:"robots",content:"noindex"}),!!f&&T.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!p&&p.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(E).concat(C).concat(e)})})),t.createElement("link",{rel:"canonical",href:"".concat(E).concat(C,"/").concat(b)}),!!w.length&&w.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function m(e){try{var t=n.getInstance(),o=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:"https://"+s.getDomain()+e.href}}));return t.currentPageType===i.CATEGORY&&o.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:"https://"+s.getDomain()+e.href}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:e.categoryPathItems.length?o:[{"@type":"ListItem",position:1,name:e.name,item:"https://"+s.getDomain()+e.href}]}}catch(e){}}function l(e,t,o){var a,r,s=o;try{switch(t){case i.PRODUCT:var n=e,d=n.name,m=(null===(a=n.brand)||void 0===a?void 0:a.name)||"",l=n.selectedVariant.sku||"",c=(null===(r=n.selectedVariant.barcodeList)||void 0===r?void 0:r.length)?n.selectedVariant.barcodeList[0]:"";s.includes("{{name}}")&&(s=s.replace("{{name}}",d)),s.includes("{{brand}}")&&(s=s.replace("{{brand}}",m)),s.includes("{{sku}}")&&(s=s.replace("{{sku}}",l)),s.includes("{{barcode}}")&&(s=s.replace("{{barcode}}",c));break;case i.BRAND:case i.CATEGORY:case i.BLOG_CATEGORY:var p=e.name||"";s.includes("{{name}}")&&(s=s.replace("{{name}}",p));break;case i.BLOG:var u=e.title;s.includes("{{name}}")&&(s=s.replace("{{name}}",u))}}catch(e){}return s.trimEnd()}export{d as IkasPageHead};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.7",
|
|
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.5.
|
|
21
|
-
"@ikas/storefront-config": "^4.5.
|
|
22
|
-
"@ikas/storefront-model-functions": "^4.5.
|
|
23
|
-
"@ikas/storefront-models": "^4.5.
|
|
24
|
-
"@ikas/storefront-providers": "^4.5.
|
|
20
|
+
"@ikas/storefront-api": "^4.5.7",
|
|
21
|
+
"@ikas/storefront-config": "^4.5.7",
|
|
22
|
+
"@ikas/storefront-model-functions": "^4.5.7",
|
|
23
|
+
"@ikas/storefront-models": "^4.5.7",
|
|
24
|
+
"@ikas/storefront-providers": "^4.5.7",
|
|
25
25
|
"@ikas/localized-address": "^1.0.0-beta.2",
|
|
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.2",
|
|
58
|
-
"@ikas/storefront-api": "^4.5.
|
|
59
|
-
"@ikas/storefront-config": "^4.5.
|
|
60
|
-
"@ikas/storefront-model-functions": "^4.5.
|
|
61
|
-
"@ikas/storefront-models": "^4.5.
|
|
62
|
-
"@ikas/storefront-providers": "^4.5.
|
|
58
|
+
"@ikas/storefront-api": "^4.5.7",
|
|
59
|
+
"@ikas/storefront-config": "^4.5.7",
|
|
60
|
+
"@ikas/storefront-model-functions": "^4.5.7",
|
|
61
|
+
"@ikas/storefront-models": "^4.5.7",
|
|
62
|
+
"@ikas/storefront-providers": "^4.5.7",
|
|
63
63
|
"mobx": "^6.1.3",
|
|
64
64
|
"mobx-react-lite": "^3.1.5",
|
|
65
65
|
"next": "12.2.0",
|