@ikas/storefront 6.1.0-beta.388 → 6.1.0-beta.389
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.
- package/build/components/checkout/components/cart-summary/index.d.ts +0 -7
- package/build/components/checkout/components/cart-summary/index.js +1 -1
- package/build/components/checkout/components/cart-summary/loyalty/icons.d.ts +4 -0
- package/build/components/checkout/components/cart-summary/loyalty/icons.js +1 -0
- package/build/components/checkout/components/cart-summary/loyalty/index.d.ts +13 -0
- package/build/components/checkout/components/cart-summary/loyalty/index.js +1 -0
- package/build/components/checkout/components/cart-summary/loyalty/style.module.scss.js +1 -0
- package/build/components/checkout/components/cart-summary/style.module.scss.js +1 -1
- package/build/components/checkout/components/step-container/index.js +1 -1
- package/build/components/checkout/components/svg/star-loyalty.js +1 -1
- package/build/components/checkout/components/tkpay/index.js +1 -1
- package/build/components/checkout/index.d.ts +1 -0
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +36 -3
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/miles-smiles/style.module.scss.js +1 -1
- package/build/models/data/theme-json/index.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/package.json +11 -11
- package/build/components/checkout/components/svg/arrow-loyalty.d.ts +0 -6
- package/build/components/checkout/components/svg/arrow-loyalty.js +0 -1
- package/build/components/checkout/components/svg/arrow-right-loyalty.d.ts +0 -6
- package/build/components/checkout/components/svg/arrow-right-loyalty.js +0 -1
- package/build/components/checkout/components/svg/left-arrow-loyalty.d.ts +0 -6
- package/build/components/checkout/components/svg/left-arrow-loyalty.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import n from"react-tooltip";import a,{CheckoutStep as s}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as l}from"../../utils/currency.js";import{useTranslation as m}from"../../utils/i18n.js";import d from"./steps/step-info/index.js";import{CheckoutStepShipping as p}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as u}from"./steps/step-payment/index.js";import{CouponErrorCode as f,Coupon as g,CartSummary as v}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 h}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/customer-form-data-input/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/order-transaction-with-prices/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"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/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 E}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 y}from"./steps/step-success/index.js";import{Modal as x}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import C from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as P}from"../image/index.js";import N,{Step as O}from"./components/step-container/index.js";import{StockError as S}from"./components/error/stock-error/index.js";import{FullscreenLoading as b}from"./components/fullscreen-loading/index.js";import{CheckoutLoadFailed as M,getCheckoutHomeHref as F}from"./components/checkout-load-failed/index.js";import T from"./components/notification-box/index.js";import{FormItem as w}from"./components/form-item/index.js";import{FormItemType as I}from"./components/form-item/model.js";import{Button as A}from"./components/button/index.js";import{IkasPageHead as L}from"../page/head.js";import B from"./components/offer-product/index.js";import D from"./components/offer-product/placeholder-offer-product.js";import U from"./components/svg/ikas.js";import V from"./style.module.scss.js";import{Analytics as R}from"../../analytics/analytics.js";import{isPaymentScriptPolicyEnabled as _,PAYMENT_SCRIPT_POLICY_META as z}from"../../analytics/head/index.js";import G from"./components/svg/success-circle.js";import H from"./components/offer-product/offer-dots/index.js";import W from"./components/offer-product/offer-arrows/index.js";import q from"./components/offer-product/useCampaignOffer.js";import Y from"../../hooks/useDimension.js";var X=i((function(e){var t,i,l,d,p,u,f,g,E,N,O=e.checkout,T=e.checkoutSettings,w=e.customizationProps,I=e.returnPolicy,B=e.privacyPolicy,H=e.termsOfService,W=e.imprint,Y=e.shippingPolicy,X=m().t,Z=r(),$=o.useState(Date.now()),re=$[0],ne=$[1],ae=o.useState((function(){return new a(O,T,Z,I,B,H,W,Y,X,w||{})}))[0];o.useEffect((function(){ne(Date.now())}),[O.campaignOffers,ae.campaignOffers,ae.isCampaignOfferLoaded]);var se=q(ae),ce=se.setShowDetailPage,le=se.isPopupShowIndexPage,me=se.isShowSuccessPageMiddlePhase;o.useMemo((function(){return Date.now()}),[]);return o.useEffect((function(){if(ae.step===s.PAYMENT&&_()){var e="ikas-script-policy-reload";try{if(document.querySelector('meta[name="'.concat(z,'"]')))return void sessionStorage.removeItem(e);if(sessionStorage.getItem(e)===window.location.href)return;sessionStorage.setItem(e,window.location.href)}catch(e){return}window.location.replace(window.location.href)}}),[ae.step]),o.useEffect((function(){var e;ae.checkoutSettings.isAccountRequired&&!ae.checkout.hasCustomer&&Z.push("/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==s.SUCCESS&&(ae.checkoutSettings.isAccountRequired&&(null===(e=ae.checkout.customer)||void 0===e?void 0:e.isGuestCheckout)||R.beginCheckout(ae.checkout)),R.pageView(h.CHECKOUT)}),[]),o.useEffect((function(){ae.customizationProps=w,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"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==e?void 0:e.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==e?void 0:e.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==e?void 0:e.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==e?void 0:e.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==e?void 0:e.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==e?void 0:e.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==e?void 0:e.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==e?void 0:e.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==e?void 0:e.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==e?void 0:e.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==e?void 0:e.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==e?void 0:e.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(w)}),[w]),o.useEffect((function(){var e=document.querySelector(".ikas-storefront-widget");e&&e.remove()}),[]),ae.isCheckoutLoadFailed?o.createElement(M,{logo:(null===(t=ae.customizationProps)||void 0===t?void 0:t.logo)||(null===(i=ae.merchantSettings)||void 0===i?void 0:i.logo),merchantName:null===(l=ae.merchantSettings)||void 0===l?void 0:l.merchantName,backHref:F(),returnPolicy:ae.returnPolicy,privacyPolicy:ae.privacyPolicy,termsOfService:ae.termsOfService,imprint:ae.milesSmilesPaymentGateway?void 0:ae.imprint,shippingPolicy:ae.shippingPolicy}):ae.isCheckoutLoaded&&ae.store.customerStore.initialized?ae.checkout.hasCustomer&&(null===(d=ae.store.customerStore.customer)||void 0===d?void 0:d.id)!==(null===(p=ae.checkout.customer)||void 0===p?void 0:p.id)?(Z.push("/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(L,{pageType:h.CHECKOUT,pageTitle:((null===(u=ae.merchantSettings)||void 0===u?void 0:u.merchantName)||"")+" - "+X("checkout-page:securePayment"),pageDescription:X("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:V.CheckoutPage},me?o.createElement("div",{className:V.FullPageOfferMain},o.createElement("div",{className:V.FullPageOfferContainer},o.createElement("div",{className:V.LogoMain},(null===(f=ae.customizationProps)||void 0===f?void 0:f.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:ae.customizationProps.logo,sizes:"360px"})):(null===(g=ae.merchantSettings)||void 0===g?void 0:g.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:ae.merchantSettings.logo,sizes:"360px"})):(null===(E=ae.merchantSettings)||void 0===E?void 0:E.merchantName)||""),o.createElement("div",{className:V.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:V.OfferSuccessHeader},o.createElement(G,{className:V.SuccessCircle}),o.createElement("span",{className:V.SuccessTitle},X("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:V.OfferOrderInfoMain},o.createElement("div",{className:V.InfoTitle},X("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:V.InfoText},"#"+(ae.checkout.orderNumber||"")," ",ae.checkout.dateStr))),o.createElement("div",null,o.createElement(A,{classes:V.OfferButton,isLine:!0,text:X("checkout-page:actions.goOrderDetailPage"),onClick:function(){ce(!1)}}))),o.createElement("div",null,o.createElement(oe,{vm:ae,key:re})))):null,o.createElement(n,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:V.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[V.Left].join(" ")},o.createElement("div",{className:V.LeftContent},o.createElement("div",null,o.createElement(K,{vm:ae}),ae.hasStockError&&o.createElement("div",{className:V.ErrorContainer},o.createElement(S,{vm:ae,error:ae.error})),!ae.hasStockError&&o.createElement(o.Fragment,null,ae.step!==s.SUCCESS&&o.createElement(v,{vm:ae,allowExpand:!0}),ae.step===s.SUCCESS?o.createElement(y,{vm:ae}):o.createElement(o.Fragment,null,!!(null===(N=ae.customizationProps)||void 0===N?void 0:N.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(D,{vm:ae}),le&&o.createElement("div",{className:[V.MiddlePhaseOverlay,le?V.MiddlePhaseOverlayPopup:""].join(" ")}),ae.campaignOffers&&!!ae.campaignOffers.length&&ae.isCampaignOfferLoaded&&o.createElement(ie,{key:re,vm:ae}),ae.isCouponCodeRequirementOpen&&o.createElement(J,{vm:ae}),o.createElement(Q,{vm:ae}))),o.createElement("div",{className:V.Space})),o.createElement(ee,{vm:ae}))),o.createElement("div",{className:V.Right},o.createElement("div",{className:V.RightContent},o.createElement(v,{vm:ae}),!ae.isPoweredByHidden&&o.createElement("div",{className:V.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(U,null))))),!!ae.policyModalText&&o.createElement(x,{title:ae.policyModalTitle,modalContent:ae.policyModalText,onClose:function(){ae.policyModalText=""},isPolicyModal:!0}),ae.isContactModalVisible&&o.createElement(te,{vm:ae,setVisible:ae.setContactModalVisible}),ae.mpVM.isOtpModalVisible&&o.createElement(k,{vm:ae,visible:ae.mpVM.isOtpModalVisible,type:ae.mpVM.otpModalType,onClose:ae.mpVM.hideOtpModal}),ae.mpVM.isResponseModalVisible&&o.createElement(C,{visible:ae.mpVM.isResponseModalVisible,text:ae.mpVM.mfsResponseModalText,onClose:ae.mpVM.onResponseModalClose}),ae.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:ae.mpVM.isSuccessModalVisible,type:ae.mpVM.successModalType,onClose:ae.mpVM.onSuccessModalClose}))):o.createElement(b,null)})),K=i((function(e){var t,i,r,n,a=e.vm,s=c.getCurrentRouting(),l=(null==s?void 0:s.path)?"/".concat(s.path):"/",d=m().t;return o.createElement("div",{className:V.Header},o.createElement("a",{href:l},(null===(t=a.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:a.customizationProps.logo,sizes:"360px"})):(null===(i=a.merchantSettings)||void 0===i?void 0:i.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:a.merchantSettings.logo,sizes:"360px"})):(null===(r=a.merchantSettings)||void 0===r?void 0:r.merchantName)||""),!a.checkout.hasCustomer&&!a.isOpenEditOrderWithTransaction&&!a.checkout.edited&&o.createElement("div",{className:V.LoginText},o.createElement("span",{className:V.LoginCta},d("checkout-page:alreadyHaveAnAccount")),o.createElement("a",{href:a.getGoToLoginHref(),className:V.LoginBtn},d("checkout-page:actions.login"))),(a.checkout.hasCustomer||a.isOpenEditOrderWithTransaction||a.checkout.edited)&&o.createElement("div",{className:V.CustomerInfo},o.createElement("div",{className:V.Name},a.checkout.customerFullName),o.createElement("div",{className:V.Email},null===(n=a.checkout.customer)||void 0===n?void 0:n.email)))})),J=i((function(e){var t=e.vm,i=m().t,r=o.useState(!1),n=r[0],a=r[1],s=o.useState(null),c=s[0],l=s[1],d=Y().isMobile,p=o.useMemo((function(){switch(c){case f.COUPON_CODE_NOT_EXIST:return i("checkout-page:giftCodeErrorDescription");case f.COUPON_CODE_NOT_EXIST_FOR_GUESS:return i("checkout-page:mustBeSignInToApplyCampaign");case f.COUPON_APPLIED_WITHOUT_DISCOUNT:return i("checkout-page:couponInvalidForCartItems");case f.COUPON_PERIOD_USAGE_LIMIT_EXCEEDED:return i("checkout-page:couponPeriodUsageLimitExceeded");default:return""}}),[c]);return o.createElement("div",{className:V.CouponContainer},n&&o.createElement("div",{className:V.NotificationContainer},o.createElement(T,{type:"warning",title:i("checkout-page:giftCodeErrorTitle"),content:p,onClose:function(){a(!1),l(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:n?12:0}},o.createElement(g,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:l,showOnlyMobile:!0,isMobile:d})))})),Q=i((function(e){var t=e.vm,i=m().t,r=o.useMemo((function(){switch(t.step){case s.INFO:return o.createElement(d,{vm:t});case s.SHIPPING:return o.createElement(p,{vm:t});case s.PAYMENT:return o.createElement(u,{vm:t});case s.SUCCESS:return o.createElement(y,{vm:t})}}),[t,t.step]),n=Y().isMobile,a=[new O(i("checkout-page:address"),t.step===s.INFO,t.step!==s.INFO,t.step!==s.INFO?o.createElement("div",{className:V.AdressStepInfo},o.createElement(Z,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==s.INFO?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(Z,{vm:t})):void 0),new O(i("checkout-page:payment"),t.step===s.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||a.splice(1,0,new O(i("checkout-page:shipping"),t.step===s.SHIPPING,t.step===s.PAYMENT,t.step===s.PAYMENT?o.createElement("div",{className:V.AdressStepInfo},o.createElement($,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===s.PAYMENT?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement($,{vm:t})):void 0)),o.createElement(N,{steps:a,stepContent:r,step:t.step,hasTopMargin:t.isCouponCodeRequirementOpen||t.campaignOffers&&!!t.campaignOffers.length&&t.isCampaignOfferLoaded,vm:t,isMobile:n})})),Z=i((function(e){var t,i,r,n,a,s,c,l,d,p=e.vm,u=m().t,f=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===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:V.Address},o.createElement("div",{className:[V.Text,V.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:V.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:V.Text},u("checkout-page:receiver")),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},f)),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.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:[V.Text,V.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(d=p.checkout.shippingAddress)||void 0===d?void 0:d.addressText))})),$=i((function(e){var t=e.vm,i=m().t;return o.createElement("div",{className:V.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:V.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?i("checkout-page:free"):l(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),ee=i((function(e){var t=e.vm,i=m().t;return o.createElement("div",{className:V.Footer},o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&!t.milesSmilesPaymentGateway&&o.createElement(o.Fragment,null,o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.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:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),te=i((function(i){var r,n,a,s=i.vm,c=i.setVisible,l=m().t,d=o.useState(!1),p=d[0],u=d[1],f=o.useState(!1),g=f[0],v=f[1],h=o.useState(new E({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];h.email=(null===(r=s.checkout.customer)||void 0===r?void 0:r.email)||"",h.firstName=(null===(n=s.checkout.customer)||void 0===n?void 0:n.firstName)||"",h.lastName=(null===(a=s.checkout.customer)||void 0===a?void 0:a.lastName)||"";var y=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return g?[2,c(!1)]:(u(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&v(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(x,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,g&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(T,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(w,{name:"message",type:I.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(A,{style:{width:"100%",marginTop:"24px"},text:l(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:y})),onClose:function(){return c(!1)}})})),oe=i((function(e){var t=e.vm,i=q(t),r=i.setActiveIndex,n=i.handlePrev,a=i.handleNext,s=i.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:V.CampaignOfferMain},o.createElement("div",{className:V.OfferSlider},t.campaignOffers.map((function(e,i){var c;return o.createElement(B,{vm:t,campaignOffer:e,index:i,activeIndex:s,offersLength:(null===(c=t.campaignOffers)||void 0===c?void 0:c.length)||0,handlePrev:n,handleNext:a,setActiveIndex:function(e){return r(e)},desktopMiddlePhase:!0,step:t.step})}))),t.campaignOffers.length>1&&o.createElement(W,{handlePrev:n,handleNext:a}),t.campaignOffers.length>1&&o.createElement(H,{vm:t,activeIndex:s})):null})),ie=i((function(e){var t=e.vm,i=q(t),r=i.setActiveIndex,n=i.setIsActiveOverlay,a=i.handlePrev,s=i.handleNext,c=i.isPopupClosedIndexPage,l=i.isPopupShowIndexPage,m=i.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:[V.CampaignOfferMain,l?V.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:V.OfferSlider},t.campaignOffers.map((function(e,i){var d;return o.createElement(B,{vm:t,campaignOffer:e,index:i,activeIndex:m,offersLength:(null===(d=t.campaignOffers)||void 0===d?void 0:d.length)||0,handlePrev:a,handleNext:s,setActiveIndex:function(e){return r(e)},step:t.step,isPopupClosed:c,isPopupShow:l,closePopup:function(){return n(!1)},showPopup:function(){return n(!0)}})}))),t.campaignOffers.length>1&&o.createElement(W,{handlePrev:a,handleNext:s}),t.campaignOffers.length>1&&o.createElement(H,{isPopupShow:l,vm:t,activeIndex:m})):null}));export{X 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 n from"react-tooltip";import a,{CheckoutStep as s}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as l}from"../../utils/currency.js";import{useTranslation as m}from"../../utils/i18n.js";import d from"./steps/step-info/index.js";import{CheckoutStepShipping as p}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as u}from"./steps/step-payment/index.js";import{CouponErrorCode as f,Coupon as g,CartSummary as v}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 h}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/customer-form-data-input/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/order-transaction-with-prices/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"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/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 E}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 y}from"./steps/step-success/index.js";import{Modal as x}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import C from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as P}from"../image/index.js";import N,{Step as O}from"./components/step-container/index.js";import{StockError as S}from"./components/error/stock-error/index.js";import{FullscreenLoading as b}from"./components/fullscreen-loading/index.js";import{CheckoutLoadFailed as M,getCheckoutHomeHref as F}from"./components/checkout-load-failed/index.js";import T from"./components/notification-box/index.js";import{FormItem as w}from"./components/form-item/index.js";import{FormItemType as I}from"./components/form-item/model.js";import{Button as A}from"./components/button/index.js";import{IkasPageHead as L}from"../page/head.js";import B from"./components/offer-product/index.js";import D from"./components/offer-product/placeholder-offer-product.js";import U from"./components/svg/ikas.js";import V from"./style.module.scss.js";import{Analytics as R}from"../../analytics/analytics.js";import{isPaymentScriptPolicyEnabled as _,PAYMENT_SCRIPT_POLICY_META as z}from"../../analytics/head/index.js";import G from"./components/svg/success-circle.js";import H from"./components/offer-product/offer-dots/index.js";import W from"./components/offer-product/offer-arrows/index.js";import q from"./components/offer-product/useCampaignOffer.js";import Y from"../../hooks/useDimension.js";var X=i((function(e){var t,i,l,d,p,u,f,g,E,N,O=e.checkout,T=e.checkoutSettings,w=e.customizationProps,I=e.returnPolicy,B=e.privacyPolicy,H=e.termsOfService,W=e.imprint,Y=e.shippingPolicy,X=m().t,Z=r(),$=o.useState(Date.now()),re=$[0],ne=$[1],ae=o.useState((function(){return new a(O,T,Z,I,B,H,W,Y,X,w||{})}))[0];o.useEffect((function(){ne(Date.now())}),[O.campaignOffers,ae.campaignOffers,ae.isCampaignOfferLoaded]);var se=q(ae),ce=se.setShowDetailPage,le=se.isPopupShowIndexPage,me=se.isShowSuccessPageMiddlePhase;o.useMemo((function(){return Date.now()}),[]);return o.useEffect((function(){if(ae.step===s.PAYMENT&&_()){var e="ikas-script-policy-reload";try{if(document.querySelector('meta[name="'.concat(z,'"]')))return void sessionStorage.removeItem(e);if(sessionStorage.getItem(e)===window.location.href)return;sessionStorage.setItem(e,window.location.href)}catch(e){return}window.location.replace(window.location.href)}}),[ae.step]),o.useEffect((function(){var e;ae.checkoutSettings.isAccountRequired&&!ae.checkout.hasCustomer&&Z.push("/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==s.SUCCESS&&(ae.checkoutSettings.isAccountRequired&&(null===(e=ae.checkout.customer)||void 0===e?void 0:e.isGuestCheckout)||R.beginCheckout(ae.checkout)),R.pageView(h.CHECKOUT)}),[]),o.useEffect((function(){ae.customizationProps=w,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"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==e?void 0:e.secondaryButtonBgColor)||"#ffffff00"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==e?void 0:e.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==e?void 0:e.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-loyalty-icon-color",(null==e?void 0:e.loyaltyIconColor)||"#F5B53F"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==e?void 0:e.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==e?void 0:e.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-container-bg-color",(null==e?void 0:e.campaignOffersContainerBgColor)||"#ffffff"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==e?void 0:e.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==e?void 0:e.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==e?void 0:e.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==e?void 0:e.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==e?void 0:e.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==e?void 0:e.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(w)}),[w]),o.useEffect((function(){var e=document.querySelector(".ikas-storefront-widget");e&&e.remove()}),[]),ae.isCheckoutLoadFailed?o.createElement(M,{logo:(null===(t=ae.customizationProps)||void 0===t?void 0:t.logo)||(null===(i=ae.merchantSettings)||void 0===i?void 0:i.logo),merchantName:null===(l=ae.merchantSettings)||void 0===l?void 0:l.merchantName,backHref:F(),returnPolicy:ae.returnPolicy,privacyPolicy:ae.privacyPolicy,termsOfService:ae.termsOfService,imprint:ae.milesSmilesPaymentGateway?void 0:ae.imprint,shippingPolicy:ae.shippingPolicy}):ae.isCheckoutLoaded&&ae.store.customerStore.initialized?ae.checkout.hasCustomer&&(null===(d=ae.store.customerStore.customer)||void 0===d?void 0:d.id)!==(null===(p=ae.checkout.customer)||void 0===p?void 0:p.id)?(Z.push("/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(L,{pageType:h.CHECKOUT,pageTitle:((null===(u=ae.merchantSettings)||void 0===u?void 0:u.merchantName)||"")+" - "+X("checkout-page:securePayment"),pageDescription:X("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:V.CheckoutPage},me?o.createElement("div",{className:V.FullPageOfferMain},o.createElement("div",{className:V.FullPageOfferContainer},o.createElement("div",{className:V.LogoMain},(null===(f=ae.customizationProps)||void 0===f?void 0:f.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:ae.customizationProps.logo,sizes:"360px"})):(null===(g=ae.merchantSettings)||void 0===g?void 0:g.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:ae.merchantSettings.logo,sizes:"360px"})):(null===(E=ae.merchantSettings)||void 0===E?void 0:E.merchantName)||""),o.createElement("div",{className:V.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:V.OfferSuccessHeader},o.createElement(G,{className:V.SuccessCircle}),o.createElement("span",{className:V.SuccessTitle},X("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:V.OfferOrderInfoMain},o.createElement("div",{className:V.InfoTitle},X("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:V.InfoText},"#"+(ae.checkout.orderNumber||"")," ",ae.checkout.dateStr))),o.createElement("div",null,o.createElement(A,{classes:V.OfferButton,isLine:!0,text:X("checkout-page:actions.goOrderDetailPage"),onClick:function(){ce(!1)}}))),o.createElement("div",null,o.createElement(oe,{vm:ae,key:re})))):null,o.createElement(n,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:V.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[V.Left].join(" ")},o.createElement("div",{className:V.LeftContent},o.createElement("div",null,o.createElement(K,{vm:ae}),ae.hasStockError&&o.createElement("div",{className:V.ErrorContainer},o.createElement(S,{vm:ae,error:ae.error})),!ae.hasStockError&&o.createElement(o.Fragment,null,ae.step!==s.SUCCESS&&o.createElement(v,{vm:ae,allowExpand:!0}),ae.step===s.SUCCESS?o.createElement(y,{vm:ae}):o.createElement(o.Fragment,null,!!(null===(N=ae.customizationProps)||void 0===N?void 0:N.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(D,{vm:ae}),le&&o.createElement("div",{className:[V.MiddlePhaseOverlay,le?V.MiddlePhaseOverlayPopup:""].join(" ")}),ae.campaignOffers&&!!ae.campaignOffers.length&&ae.isCampaignOfferLoaded&&o.createElement(ie,{key:re,vm:ae}),ae.isCouponCodeRequirementOpen&&o.createElement(J,{vm:ae}),o.createElement(Q,{vm:ae}))),o.createElement("div",{className:V.Space})),o.createElement(ee,{vm:ae}))),o.createElement("div",{className:V.Right},o.createElement("div",{className:V.RightContent},o.createElement(v,{vm:ae}),!ae.isPoweredByHidden&&o.createElement("div",{className:V.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(U,null))))),!!ae.policyModalText&&o.createElement(x,{title:ae.policyModalTitle,modalContent:ae.policyModalText,onClose:function(){ae.policyModalText=""},isPolicyModal:!0}),ae.isContactModalVisible&&o.createElement(te,{vm:ae,setVisible:ae.setContactModalVisible}),ae.mpVM.isOtpModalVisible&&o.createElement(k,{vm:ae,visible:ae.mpVM.isOtpModalVisible,type:ae.mpVM.otpModalType,onClose:ae.mpVM.hideOtpModal}),ae.mpVM.isResponseModalVisible&&o.createElement(C,{visible:ae.mpVM.isResponseModalVisible,text:ae.mpVM.mfsResponseModalText,onClose:ae.mpVM.onResponseModalClose}),ae.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:ae.mpVM.isSuccessModalVisible,type:ae.mpVM.successModalType,onClose:ae.mpVM.onSuccessModalClose}))):o.createElement(b,null)})),K=i((function(e){var t,i,r,n,a=e.vm,s=c.getCurrentRouting(),l=(null==s?void 0:s.path)?"/".concat(s.path):"/",d=m().t;return o.createElement("div",{className:V.Header},o.createElement("a",{href:l},(null===(t=a.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:a.customizationProps.logo,sizes:"360px"})):(null===(i=a.merchantSettings)||void 0===i?void 0:i.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:a.merchantSettings.logo,sizes:"360px"})):(null===(r=a.merchantSettings)||void 0===r?void 0:r.merchantName)||""),!a.checkout.hasCustomer&&!a.isOpenEditOrderWithTransaction&&!a.checkout.edited&&o.createElement("div",{className:V.LoginText},o.createElement("span",{className:V.LoginCta},d("checkout-page:alreadyHaveAnAccount")),o.createElement("a",{href:a.getGoToLoginHref(),className:V.LoginBtn},d("checkout-page:actions.login"))),(a.checkout.hasCustomer||a.isOpenEditOrderWithTransaction||a.checkout.edited)&&o.createElement("div",{className:V.CustomerInfo},o.createElement("div",{className:V.Name},a.checkout.customerFullName),o.createElement("div",{className:V.Email},null===(n=a.checkout.customer)||void 0===n?void 0:n.email)))})),J=i((function(e){var t=e.vm,i=m().t,r=o.useState(!1),n=r[0],a=r[1],s=o.useState(null),c=s[0],l=s[1],d=Y().isMobile,p=o.useMemo((function(){switch(c){case f.COUPON_CODE_NOT_EXIST:return i("checkout-page:giftCodeErrorDescription");case f.COUPON_CODE_NOT_EXIST_FOR_GUESS:return i("checkout-page:mustBeSignInToApplyCampaign");case f.COUPON_APPLIED_WITHOUT_DISCOUNT:return i("checkout-page:couponInvalidForCartItems");case f.COUPON_PERIOD_USAGE_LIMIT_EXCEEDED:return i("checkout-page:couponPeriodUsageLimitExceeded");default:return""}}),[c]);return o.createElement("div",{className:V.CouponContainer},n&&o.createElement("div",{className:V.NotificationContainer},o.createElement(T,{type:"warning",title:i("checkout-page:giftCodeErrorTitle"),content:p,onClose:function(){a(!1),l(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:n?12:0}},o.createElement(g,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:l,showOnlyMobile:!0,isMobile:d})))})),Q=i((function(e){var t=e.vm,i=m().t,r=o.useMemo((function(){switch(t.step){case s.INFO:return o.createElement(d,{vm:t});case s.SHIPPING:return o.createElement(p,{vm:t});case s.PAYMENT:return o.createElement(u,{vm:t});case s.SUCCESS:return o.createElement(y,{vm:t})}}),[t,t.step]),n=Y().isMobile,a=[new O(i("checkout-page:address"),t.step===s.INFO,t.step!==s.INFO,t.step!==s.INFO?o.createElement("div",{className:V.AdressStepInfo},o.createElement(Z,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==s.INFO?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(Z,{vm:t})):void 0),new O(i("checkout-page:payment"),t.step===s.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||a.splice(1,0,new O(i("checkout-page:shipping"),t.step===s.SHIPPING,t.step===s.PAYMENT,t.step===s.PAYMENT?o.createElement("div",{className:V.AdressStepInfo},o.createElement($,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===s.PAYMENT?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement($,{vm:t})):void 0)),o.createElement(N,{steps:a,stepContent:r,step:t.step,hasTopMargin:t.isCouponCodeRequirementOpen||t.campaignOffers&&!!t.campaignOffers.length&&t.isCampaignOfferLoaded,vm:t,isMobile:n})})),Z=i((function(e){var t,i,r,n,a,s,c,l,d,p=e.vm,u=m().t,f=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===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:V.Address},o.createElement("div",{className:[V.Text,V.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:V.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:V.Text},u("checkout-page:receiver")),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},f)),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.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:[V.Text,V.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(d=p.checkout.shippingAddress)||void 0===d?void 0:d.addressText))})),$=i((function(e){var t=e.vm,i=m().t;return o.createElement("div",{className:V.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:V.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?i("checkout-page:free"):l(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),ee=i((function(e){var t=e.vm,i=m().t;return o.createElement("div",{className:V.Footer},o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&!t.milesSmilesPaymentGateway&&o.createElement(o.Fragment,null,o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.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:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),te=i((function(i){var r,n,a,s=i.vm,c=i.setVisible,l=m().t,d=o.useState(!1),p=d[0],u=d[1],f=o.useState(!1),g=f[0],v=f[1],h=o.useState(new E({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];h.email=(null===(r=s.checkout.customer)||void 0===r?void 0:r.email)||"",h.firstName=(null===(n=s.checkout.customer)||void 0===n?void 0:n.firstName)||"",h.lastName=(null===(a=s.checkout.customer)||void 0===a?void 0:a.lastName)||"";var y=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return g?[2,c(!1)]:(u(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&v(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(x,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,g&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(T,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(w,{name:"message",type:I.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(A,{style:{width:"100%",marginTop:"24px"},text:l(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:y})),onClose:function(){return c(!1)}})})),oe=i((function(e){var t=e.vm,i=q(t),r=i.setActiveIndex,n=i.handlePrev,a=i.handleNext,s=i.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:V.CampaignOfferMain},o.createElement("div",{className:V.OfferSlider},t.campaignOffers.map((function(e,i){var c;return o.createElement(B,{vm:t,campaignOffer:e,index:i,activeIndex:s,offersLength:(null===(c=t.campaignOffers)||void 0===c?void 0:c.length)||0,handlePrev:n,handleNext:a,setActiveIndex:function(e){return r(e)},desktopMiddlePhase:!0,step:t.step})}))),t.campaignOffers.length>1&&o.createElement(W,{handlePrev:n,handleNext:a}),t.campaignOffers.length>1&&o.createElement(H,{vm:t,activeIndex:s})):null})),ie=i((function(e){var t=e.vm,i=q(t),r=i.setActiveIndex,n=i.setIsActiveOverlay,a=i.handlePrev,s=i.handleNext,c=i.isPopupClosedIndexPage,l=i.isPopupShowIndexPage,m=i.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:[V.CampaignOfferMain,l?V.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:V.OfferSlider},t.campaignOffers.map((function(e,i){var d;return o.createElement(B,{vm:t,campaignOffer:e,index:i,activeIndex:m,offersLength:(null===(d=t.campaignOffers)||void 0===d?void 0:d.length)||0,handlePrev:a,handleNext:s,setActiveIndex:function(e){return r(e)},step:t.step,isPopupClosed:c,isPopupShow:l,closePopup:function(){return n(!1)},showPopup:function(){return n(!0)}})}))),t.campaignOffers.length>1&&o.createElement(W,{handlePrev:a,handleNext:s}),t.campaignOffers.length>1&&o.createElement(H,{isPopupShow:l,vm:t,activeIndex:m})):null}));export{X as default};
|
|
@@ -89,6 +89,13 @@ export default class CheckoutViewModel {
|
|
|
89
89
|
tkPayResponse: CreateTkPayCheckoutFormResponse | null;
|
|
90
90
|
isTkPayLoading: boolean;
|
|
91
91
|
showTkPayContainer: boolean;
|
|
92
|
+
/** Miles the current TK Pay form was created with (0 = none). */
|
|
93
|
+
private tkPayFormMiles;
|
|
94
|
+
/**
|
|
95
|
+
* Set once the hosted TK Pay form reports success. From then on the form
|
|
96
|
+
* must never be re-created: a new form re-arms the Miles leg on the backend.
|
|
97
|
+
*/
|
|
98
|
+
isTkPayPaymentCompleted: boolean;
|
|
92
99
|
stripeExpressCheckoutSessionResponse: CreateStripePaymentIntentResponse | null;
|
|
93
100
|
isStripeExpressCheckoutSessionVisible: boolean;
|
|
94
101
|
campaignOffers: CampaignOfferType[] | undefined;
|
|
@@ -122,6 +129,12 @@ export default class CheckoutViewModel {
|
|
|
122
129
|
t: TFunction;
|
|
123
130
|
constructor(checkout: IkasCheckout, checkoutSettings: IkasCheckoutSettings, router: NextRouter, returnPolicy: string, privacyPolicy: string, termsOfService: string, imprint: string, shippingPolicy: string, t: TFunction, customizationProps: IkasCheckoutCustomizationProps);
|
|
124
131
|
init: () => Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Checkout loaded inside an iframe whose top window is this same store
|
|
134
|
+
* (e.g. the TK Pay callback): navigate the top window to this URL.
|
|
135
|
+
* The editor preview runs on another origin, so it is left alone.
|
|
136
|
+
*/
|
|
137
|
+
private redirectTopIfInsideIframe;
|
|
125
138
|
private waitForCountrySettingsOrFail;
|
|
126
139
|
initStep: () => Promise<void>;
|
|
127
140
|
getOpenEditOrderTransaction: () => Promise<void>;
|
|
@@ -192,6 +205,12 @@ export default class CheckoutViewModel {
|
|
|
192
205
|
get milesSmilesAmountToPay(): number;
|
|
193
206
|
/** "Use all my miles" checkbox state: the max redeemable amount is entered. */
|
|
194
207
|
get isMilesSmilesAllMilesUsed(): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Nothing is left to pay before miles are applied (store credit / gift
|
|
210
|
+
* cards cover the cart). Unlike `isFree`, this stays false when the miles
|
|
211
|
+
* themselves cover the order, so the Miles block remains visible then.
|
|
212
|
+
*/
|
|
213
|
+
get isMilesSmilesNothingToPay(): boolean;
|
|
195
214
|
/** `milesSmiles` create-sale input, or undefined when miles are not applied. */
|
|
196
215
|
get milesSmilesInput(): MilesSmilesPaymentInput | undefined;
|
|
197
216
|
get store(): IkasBaseStore;
|
|
@@ -233,10 +252,15 @@ export default class CheckoutViewModel {
|
|
|
233
252
|
* Miles block gate: TK_PAY gateway with `milesSmilesEnabled`, TRY cart and
|
|
234
253
|
* no "feature unavailable" error from the payment service.
|
|
235
254
|
*/
|
|
236
|
-
/** Miles are
|
|
255
|
+
/** Miles are entered but the Miles&Smiles terms are not accepted yet. */
|
|
237
256
|
get isMilesSmilesTermsMissing(): boolean;
|
|
238
257
|
isMilesSmilesActive(): boolean;
|
|
239
258
|
listPaymentGateways: () => Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Store credit / gift cards cover the cart: drop the Miles selection so the
|
|
261
|
+
* block comes back switched off once the balance is removed.
|
|
262
|
+
*/
|
|
263
|
+
resetMilesSmilesIfNothingToPay: () => void;
|
|
240
264
|
/**
|
|
241
265
|
* Fetches the member balance for the payment step. Handles the
|
|
242
266
|
* "linked but session expired" case by switching to the bind CTA.
|
|
@@ -252,11 +276,13 @@ export default class CheckoutViewModel {
|
|
|
252
276
|
*/
|
|
253
277
|
startMilesSmilesBind: () => Promise<void>;
|
|
254
278
|
setUseMilesSmiles: (value: boolean) => Promise<void>;
|
|
255
|
-
/** Terms consent checkbox:
|
|
256
|
-
setMilesSmilesTermsAccepted: (value: boolean) =>
|
|
279
|
+
/** Terms consent checkbox: only records consent, the entered miles stay as is. */
|
|
280
|
+
setMilesSmilesTermsAccepted: (value: boolean) => void;
|
|
257
281
|
setMilesToRedeem: (value: number) => void;
|
|
258
282
|
/** Clamps the entered miles to what the UI may offer. */
|
|
259
283
|
clampMilesToRedeem: () => Promise<void>;
|
|
284
|
+
/** Quick-pick chip: redeem exactly `value` miles. */
|
|
285
|
+
selectMilesSmilesChip: (value: number) => Promise<void>;
|
|
260
286
|
/** "Use all my miles" checkbox: redeem the max, or clear the amount. */
|
|
261
287
|
setUseAllMilesSmiles: (value: boolean) => Promise<void>;
|
|
262
288
|
/**
|
|
@@ -269,6 +295,11 @@ export default class CheckoutViewModel {
|
|
|
269
295
|
* user-facing message when the failure belongs to the Miles leg.
|
|
270
296
|
*/
|
|
271
297
|
private handleMilesSmilesSaleError;
|
|
298
|
+
/**
|
|
299
|
+
* Shared by create-sale and the TK Pay form: login-required codes switch
|
|
300
|
+
* the block to the reconnect CTA, unavailable codes hide it.
|
|
301
|
+
*/
|
|
302
|
+
private handleMilesSmilesErrorCodes;
|
|
272
303
|
getMilesSmilesErrorMessage: (code?: string | null) => string;
|
|
273
304
|
retrieveInstallmentInfo: (params: RetrieveInstallmentInfoQueryParams) => Promise<void>;
|
|
274
305
|
createCustomer: () => void;
|
|
@@ -332,6 +363,8 @@ export default class CheckoutViewModel {
|
|
|
332
363
|
shippingZoneRateId?: string | null;
|
|
333
364
|
}) => Promise<StripeExpressCheckoutSessionContextResponse | null>;
|
|
334
365
|
setShowIyzicoContainer: (value: boolean) => void;
|
|
366
|
+
/** Hosted TK Pay form reported success: freeze the form, then go to success. */
|
|
367
|
+
onTkPayPaymentSuccess: (postCallback: () => Promise<void>) => Promise<void>;
|
|
335
368
|
setShowTkPayContainer: (value: boolean) => void;
|
|
336
369
|
setPaymentGateway: (index: number) => Promise<void>;
|
|
337
370
|
updatePaymentGateway: (paymentGateway: IkasPaymentGateway) => Promise<boolean>;
|