@ikas/storefront 5.0.54 → 5.0.56
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.js +1 -1
- package/build/components/checkout/components/offer-product/index.js +1 -1
- package/build/components/checkout/components/offer-product/style.module.scss.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +1 -0
- package/build/components/checkout/model.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +1 -1
- package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +1 -1
- package/build/models/data/order/index.d.ts +1 -0
- package/build/models/data/order/index.js +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as o}from"mobx-react-lite";import a from"lodash/sortBy";import c from"../input-with-button/index.js";import r from"../notification-box/index.js";import{CheckoutStep as l}from"../../model.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{formatCurrency as s}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import{CartItem as m}from"./cart-item/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as p}from"../form-item/model.js";import C from"../tooltip/index.js";import E from"../svg/arrow-down.js";import h from"../svg/cross.js";import v from"../svg/gift.js";import g from"../../styles/common.module.scss.js";import f from"./style.module.scss.js";import k from"../svg/ikas.js";import{Button as y}from"../button/index.js";import{IkasGiftCardType as N}from"@ikas/storefront-models";import S from"../../../../hooks/useDimension.js";import T from"../svg/coupon-code-tag.js";import b from"../svg/gift-cart-tag.js";import O from"../svg/store-credit-tag.js";var I;!function(e){e.COUPON_CODE_NOT_EXIST="COUPON_CODE_NOT_EXIST",e.COUPON_CODE_NOT_EXIST_FOR_GUESS="COUPON_CODE_NOT_EXIST_FOR_GUESS",e.COUPON_APPLIED_WITHOUT_DISCOUNT="COUPON_APPLIED_WITHOUT_DISCOUNT"}(I||(I={}));var x=o((function(e){var t,o,a,c,d,p,C=e.vm,h=e.allowExpand,v=e.isSuccessPageSummary,g=C.checkout,y=u().t,N=n.useState(!h),T=N[0],b=N[1],O=n.useState(!1),x=O[0],D=O[1],L=n.useState(null),R=L[0],U=L[1],M=n.useState(0),B=M[0],F=M[1],G=n.useState(null),V=G[0],X=G[1],H=n.useState(!1),W=H[0],q=H[1],z=n.useState(!1),$=z[0],K=z[1],Q=n.useState(!1),J=Q[0],Y=Q[1];S().isMobile,n.useEffect((function(){h&&(T?V&&F(V.getBoundingClientRect().height):F(0))}),[T,V,h,W,$,x,J]);var Z=n.useMemo((function(){switch(R){case I.COUPON_CODE_NOT_EXIST:return y("checkout-page:giftCodeErrorDescription");case I.COUPON_CODE_NOT_EXIST_FOR_GUESS:return y("checkout-page:mustBeSignInToApplyCampaign");case I.COUPON_APPLIED_WITHOUT_DISCOUNT:return y("checkout-page:couponInvalidForCartItems");default:return""}}),[R]),ee=[f.CartSummary,h?f.HideOnDesktop:"",v?f.SuccessPageCartSummary:""].join(" "),te=h?{height:B+"px"}:void 0,ne=[f.ArrowDown,T?f.Rotated:""].join(" ");return g?n.createElement(n.Fragment,null,!!h&&n.createElement(n.Fragment,null,n.createElement("div",{id:"checkout-mobile-summary-header"}),n.createElement("div",{className:f.ExpandHeader,onClick:function(){if(!T){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}b(!T)}},n.createElement("div",{className:f.Left},y("checkout-page:summary")),n.createElement("div",{className:f.Price},n.createElement("span",{className:f.PriceText},"".concat(s(C.finalPrice||0,g.currencyCode,g.currencySymbol)," (").concat(g.itemQuantity," ").concat(y("checkout-page:cartItemProduct"),")")),n.createElement("span",{className:ne},n.createElement(E,null))))),n.createElement("div",{className:ee},n.createElement("div",{className:[f.DetailsContainer,v?f.SuccessPageDetailContainer:""].join(" "),style:te},n.createElement("div",{className:f.Details,ref:X},n.createElement("div",{className:f.ItemsContainer},n.createElement("div",null,g.items.map((function(e,t){return n.createElement(m,{key:t,vm:C,cartItem:e,currencyCode:g.currencyCode,onChange:Y,isSuccessPageSummary:v})})))),n.createElement("div",{className:f.Divider}),n.createElement("div",{className:f.SubTotalInfo},x&&n.createElement("div",{className:f.NotificationContainer},n.createElement(r,{type:"warning",title:y("checkout-page:giftCodeErrorTitle"),content:Z,onClose:function(){D(!1),U(null)}})),n.createElement(P,{label:y("checkout-page:subtotal"),value:g.formattedTotalPrice,tooltipText:y("checkout-page:subtotalTooltip"),hideMarginBottom:!C.isCouponCodeVisible}),!!(null===(t=g.shippingLines)||void 0===t?void 0:t.length)&&(C.step===l.SUCCESS?n.createElement(P,{label:y("checkout-page:cartShippingTitle"),value:g.shippingTotal?g.formattedShippingTotal:y("checkout-page:free")}):g.shippingLines.map((function(e,t){return n.createElement(P,{key:t,label:e.paymentMethod?e.title:y("checkout-page:cartShippingTitle"),value:e.finalPrice?s(e.finalPrice,g.currencyCode,g.currencySymbol):y("checkout-page:free")})}))),n.createElement(_,{vm:C}),n.createElement(j,{vm:C}),(C.step===l.SUCCESS&&(!!C.checkout.note||!!C.checkout.appliedCouponCode)||C.step!==l.SUCCESS)&&C.isCouponCodeVisible&&n.createElement("div",{className:f.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(A,{vm:C,isAddingCoupon:$,setAddingCoupon:K,setCouponError:D,setCouponErrorCode:U}),n.createElement(w,{vm:C,isAddingNote:W,setAddingNote:q}),!!C.installmentExtraPrice&&C.installmentExtraPrice>0&&n.createElement(n.Fragment,null,n.createElement("div",{className:f.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(P,{label:y("checkout-page:cartInterest"),value:s(C.installmentExtraPrice,g.currencyCode,g.currencySymbol)}))),C.isOpenEditOrderWithTransaction&&n.createElement("div",{className:f.SubTotalInfo,style:{}},!!(null===(o=C.openEditOrderTransaction)||void 0===o?void 0:o.chargedAmount)&&n.createElement(P,{label:y("checkout-page:chargedAmount"),value:s((null===(a=C.openEditOrderTransaction)||void 0===a?void 0:a.chargedAmount)||0,g.currencyCode,g.currencySymbol)}),!!(null===(c=C.openEditOrderTransaction)||void 0===c?void 0:c.refundedAmount)&&n.createElement(P,{label:y("checkout-page:refundedAmount"),value:s((null===(d=C.openEditOrderTransaction)||void 0===d?void 0:d.refundedAmount)||0,g.currencyCode,g.currencySymbol)})),n.createElement("div",{className:[f.TotalContainer,v?f.SuccessPageTotalContainer:""].join(" ")},n.createElement("div",{className:f.TitleContainer},n.createElement("div",{className:f.Title},C.isOpenEditOrderWithTransaction?y("checkout-page:totalAmountPayable"):y("checkout-page:total"))),n.createElement("div",null,n.createElement("div",{className:f.TotalPricesContainer},n.createElement("div",{className:f.TotalPrice},s(C.finalPrice||0,g.currencyCode,g.currencySymbol)),!!g.$totalTax&&!!(null===(p=C.customizationProps)||void 0===p?void 0:p.showTax)&&n.createElement("div",{className:[f.TotalTax].join(" ")},y("checkout-page:cartTaxTitle")+" "+g.$formattedTotalTax)))),!v&&!C.isPoweredByHidden&&n.createElement("div",{className:f.PoweredBy},n.createElement("span",null,"powered by"),n.createElement("a",{href:"https://ikas.com"+("tr"===i.getCurrentLocale()?"/tr":""),target:"_blank"},n.createElement(k,null))))))):null})),P=o((function(e){var t=e.label,o=e.value,a=e.tooltipText,c=e.hideMarginBottom;return n.createElement("div",{className:[f.InfoRow,c?f.hideMb:""].join(" ")},n.createElement("div",{className:f.Label},n.createElement("span",null,t),!!a&&n.createElement(C,{text:a,style:{marginLeft:"8px"}})),n.createElement("div",{className:f.Value},o))})),_=o((function(e){var t=e.vm,o=u().t;return t.checkout?n.createElement(n.Fragment,null,a(t.checkout.nonCouponAdjustments||[],"order").map((function(e,a){return n.createElement("div",{className:f.InfoRow,key:a},n.createElement("div",{className:f.Label},"INTEREST"===e.name?o("checkout-page:cartInterest"):e.name),n.createElement("div",{className:f.Value},n.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",n.createElement("span",null,s(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),j=o((function(e){var t,o=e.vm,a=u().t;return o.checkout?n.createElement(n.Fragment,null,null===(t=o.checkout.giftPackageLines)||void 0===t?void 0:t.map((function(e,t){return n.createElement("div",{className:f.InfoRow,key:t},n.createElement("div",{className:f.Label},n.createElement("div",{className:f.GiftLabel},n.createElement(v,{style:{position:"relative",top:"-1px"}}),n.createElement("span",null,a("checkout-page:giftPackage")))),n.createElement("div",{className:f.Value},n.createElement("span",null,s(e.price,o.checkout.currencyCode,o.checkout.currencySymbol))))}))):null})),A=o((function(o){var a=o.vm,r=o.isAddingCoupon,i=o.setAddingCoupon,s=o.setCouponError,m=o.setCouponErrorCode,C=o.isOpenCouponCode,E=o.isMobile,h=o.showOnlyMobile,v=u().t,k=n.useState(""),N=k[0],S=k[1],T=n.useState(!1),b=T[0],O=T[1],I=n.useRef(null);n.useEffect((function(){r&&I.current&&I.current.focus()}),[r]);var x=function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return a.checkout.couponCode=N,O(!0),[4,a.onCouponCodeApply()];case 1:return t.sent(),O(!1),S(""),e=a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length,a.couponError?[3,4]:a.checkout.appliedCouponCode||e?(s(!1),m(null),[4,a.reInitPaymentMethod()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:a.checkout.couponCode=null,s(!0),m(a.couponError),t.label=5;case 5:return[2]}}))}))},P=function(n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return O(!0),[4,a.removeGiftCardLine(n)];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),O(!1),[2]}}))}))};a.step,l.SUCCESS;var _=a.step===l.SHIPPING,j=!!a.checkout.appliedCouponCode||!!(a.checkout.giftCardLines&&a.checkout.giftCardLines.length>0),A=!!a.checkout.appliedCouponCode&&C,w=!r&&a.isCouponCodeVisible&&!a.isCouponCodeRequirementOpen&&a.step!==l.SUCCESS,L=j&&(!C||E);return n.createElement(n.Fragment,null,!!C&&n.createElement(n.Fragment,null,n.createElement("div",{className:[f.CartSummary,f.OpenCouponCodeSummary].join(" ")},n.createElement("div",{className:g.FormSectionTitle},n.createElement("div",{style:{paddingBottom:A?0:6},className:g.Title},v("checkout-page:couponCode"))))),j&&!_&&!a.isCouponCodeRequirementDefult&&n.createElement("div",{className:f.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement("div",{className:w?f.InfoRow:""},w&&n.createElement("div",{className:f.ActionTextBtn,onClick:function(){return i(!0)}},v("checkout-page:addCouponCode")),r&&!C&&n.createElement("div",{style:{marginBottom:"10px"}},n.createElement(c,{value:N,placeholder:v("checkout-page:couponCode"),buttonLabel:v("checkout-page:actions.apply"),inputRef:I,onClick:x,isLoading:b,onChange:S})),C&&n.createElement("div",{tabIndex:0,onKeyDown:function(e){"Enter"===e.key&&x()},className:[f.OpenCouponCodeMain,L?f.OpenCouponCodeMainWithMb:""].join(" ")},n.createElement(d,{name:"couponCode",label:v("checkout-page:addCouponCode"),type:p.TEXT,value:N,onChange:S}),n.createElement(y,{style:{width:"33%"},text:v("checkout-page:actions.apply"),isLoading:b,onClick:x}))),L&&n.createElement(n.Fragment,null,!!a.checkout.appliedCouponCode&&n.createElement("div",{className:[f.InfoRow,h?f.InfoRowGiftCardMobile:""].join(" ")},n.createElement(D,{vm:a,onClearCouponCode:function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=null,O(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),O(!1),[2]}}))}))},couponCode:a.checkout.appliedCouponCode})),!!a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length&&a.checkout.giftCardLines.map((function(e){return n.createElement("div",{className:[f.InfoRow,h?f.InfoRowGiftCardMobile:""].join(" ")},n.createElement(D,{vm:a,onClearGiftCode:P,couponCode:e.code,giftCardLine:e}))}))))})),D=o((function(e){var t=e.vm,o=e.onClearCouponCode,a=e.couponCode,c=e.giftCardLine,r=e.onClearGiftCode,i=t.checkout.couponAdjustment,m=u().t,d=!c,p=(null==c?void 0:c.type)===N.STORE_CREDIT;return n.createElement(n.Fragment,null,n.createElement("div",{className:[f.ActionTextBtn,f.NoUnderline].join(" ")},c&&p&&n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"5px"}},n.createElement("span",{style:{height:"20px"}},n.createElement(O,null)),n.createElement("span",{className:f.StoreCreditTag},m("checkout-page:storeCredit"))),!p&&n.createElement("span",{className:[f.AppliedCoupon,t.isCouponCodeRequirementDefult?"":f.NotClosed].join(" ")},d?n.createElement("span",{style:{height:"16px"}},n.createElement(T,null)):!p&&n.createElement("span",{style:{height:"16px"}},n.createElement(b,null)),n.createElement("span",{className:f.CouponCode},a),t.step!==l.SUCCESS&&!t.isOpenEditOrderWithTransaction&&n.createElement("span",{className:f.ClearCoupon,onClick:function(){return c?r&&r(c.giftCardId):o&&o()}},n.createElement(h,null)))),n.createElement("div",null,c?n.createElement("div",{className:f.Value},n.createElement("span",null,"-")," ",n.createElement("span",null,s((null==c?void 0:c.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol))):n.createElement("div",{className:f.Value},n.createElement("span",null,"DECREMENT"===(null==i?void 0:i.type)?"- ":"")," ",n.createElement("span",null,s((null==i?void 0:i.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol)))))})),w=o((function(e){var t=e.vm,o=e.isAddingNote,a=e.setAddingNote,c=u().t,r=n.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=n.useCallback((function(){a(!0)}),[]),s=n.useCallback((function(e){t.checkout.note=e}),[t,t.checkout]);if(!t.checkoutSettings.showCheckoutNote)return null;var m=t.step===l.SUCCESS;return m&&!t.checkout.note?null:n.createElement("div",{className:f.InfoRow},!o&&!m&&n.createElement("div",{className:f.ActionTextBtn,onClick:i},r),(o||m)&&n.createElement("div",{className:[f.CheckoutNoteContainer,m?f.Success:""].join(" ")},n.createElement("div",{className:f.Title},c("checkout-page:orderNote")),m?n.createElement("div",{className:f.CheckoutNoteDisplay},t.checkout.note):n.createElement(d,{style:{width:"100%"},type:p.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:s,maxLength:320})))}));export{x as CartSummary,A as Coupon,I as CouponErrorCode};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as o}from"mobx-react-lite";import a from"lodash/sortBy";import c from"../input-with-button/index.js";import r from"../notification-box/index.js";import{CheckoutStep as l}from"../../model.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{formatCurrency as s}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import{CartItem as m}from"./cart-item/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as p}from"../form-item/model.js";import C from"../tooltip/index.js";import E from"../svg/arrow-down.js";import h from"../svg/cross.js";import v from"../svg/gift.js";import f from"../../styles/common.module.scss.js";import g from"./style.module.scss.js";import k from"../svg/ikas.js";import{Button as y}from"../button/index.js";import{IkasGiftCardType as N}from"@ikas/storefront-models";import S from"../../../../hooks/useDimension.js";import T from"../svg/coupon-code-tag.js";import b from"../svg/gift-cart-tag.js";import O from"../svg/store-credit-tag.js";var I;!function(e){e.COUPON_CODE_NOT_EXIST="COUPON_CODE_NOT_EXIST",e.COUPON_CODE_NOT_EXIST_FOR_GUESS="COUPON_CODE_NOT_EXIST_FOR_GUESS",e.COUPON_APPLIED_WITHOUT_DISCOUNT="COUPON_APPLIED_WITHOUT_DISCOUNT"}(I||(I={}));var x=o((function(e){var t,o,a,c,d,p,C=e.vm,h=e.allowExpand,v=e.isSuccessPageSummary,f=C.checkout,y=u().t,N=n.useState(!h),T=N[0],b=N[1],O=n.useState(!1),x=O[0],D=O[1],L=n.useState(null),R=L[0],U=L[1],M=n.useState(0),B=M[0],F=M[1],G=n.useState(null),X=G[0],H=G[1],V=n.useState(!1),W=V[0],q=V[1],z=n.useState(!1),$=z[0],K=z[1],Q=n.useState(!1),J=Q[0],Y=Q[1];S().isMobile,n.useEffect((function(){h&&(T?X&&F(X.getBoundingClientRect().height):F(0))}),[T,X,h,W,$,x,J]);var Z=n.useMemo((function(){switch(R){case I.COUPON_CODE_NOT_EXIST:return y("checkout-page:giftCodeErrorDescription");case I.COUPON_CODE_NOT_EXIST_FOR_GUESS:return y("checkout-page:mustBeSignInToApplyCampaign");case I.COUPON_APPLIED_WITHOUT_DISCOUNT:return y("checkout-page:couponInvalidForCartItems");default:return""}}),[R]),ee=[g.CartSummary,h?g.HideOnDesktop:"",v?g.SuccessPageCartSummary:""].join(" "),te=h?{height:B+"px"}:void 0,ne=[g.ArrowDown,T?g.Rotated:""].join(" ");return f?n.createElement(n.Fragment,null,!!h&&n.createElement(n.Fragment,null,n.createElement("div",{id:"checkout-mobile-summary-header"}),n.createElement("div",{className:g.ExpandHeader,onClick:function(){if(!T){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}b(!T)}},n.createElement("div",{className:g.Left},y("checkout-page:summary")),n.createElement("div",{className:g.Price},n.createElement("span",{className:g.PriceText},"".concat(s(C.finalPrice||0,f.currencyCode,f.currencySymbol)," (").concat(f.itemQuantity," ").concat(y("checkout-page:cartItemProduct"),")")),n.createElement("span",{className:ne},n.createElement(E,null))))),n.createElement("div",{className:ee},n.createElement("div",{className:[g.DetailsContainer,v?g.SuccessPageDetailContainer:""].join(" "),style:te},n.createElement("div",{className:g.Details,ref:H},n.createElement("div",{className:g.ItemsContainer},n.createElement("div",null,f.items.map((function(e,t){return n.createElement(m,{key:t,vm:C,cartItem:e,currencyCode:f.currencyCode,onChange:Y,isSuccessPageSummary:v})})))),n.createElement("div",{className:g.Divider}),n.createElement("div",{className:g.SubTotalInfo},x&&n.createElement("div",{className:g.NotificationContainer},n.createElement(r,{type:"warning",title:y("checkout-page:giftCodeErrorTitle"),content:Z,onClose:function(){D(!1),U(null)}})),n.createElement(P,{label:y("checkout-page:subtotal"),value:f.formattedTotalPrice,tooltipText:y("checkout-page:subtotalTooltip")}),!!(null===(t=f.shippingLines)||void 0===t?void 0:t.length)&&(C.step===l.SUCCESS?n.createElement(P,{label:y("checkout-page:cartShippingTitle"),value:f.shippingTotal?f.formattedShippingTotal:y("checkout-page:free")}):f.shippingLines.map((function(e,t){return n.createElement(P,{key:t,label:e.paymentMethod?e.title:y("checkout-page:cartShippingTitle"),value:e.finalPrice?s(e.finalPrice,f.currencyCode,f.currencySymbol):y("checkout-page:free")})}))),n.createElement(_,{vm:C}),n.createElement(j,{vm:C}),(C.step===l.SUCCESS&&(!!C.checkout.note||!!C.checkout.appliedCouponCode)||C.step!==l.SUCCESS)&&C.isCouponCodeVisible&&n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(A,{vm:C,isAddingCoupon:$,setAddingCoupon:K,setCouponError:D,setCouponErrorCode:U}),n.createElement(w,{vm:C,isAddingNote:W,setAddingNote:q}),!!C.installmentExtraPrice&&C.installmentExtraPrice>0&&n.createElement(n.Fragment,null,n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(P,{label:y("checkout-page:cartInterest"),value:s(C.installmentExtraPrice,f.currencyCode,f.currencySymbol)}))),C.isOpenEditOrderWithTransaction&&n.createElement("div",{className:g.SubTotalInfo,style:{}},!!(null===(o=C.openEditOrderTransaction)||void 0===o?void 0:o.chargedAmount)&&n.createElement(P,{label:y("checkout-page:chargedAmount"),value:s((null===(a=C.openEditOrderTransaction)||void 0===a?void 0:a.chargedAmount)||0,f.currencyCode,f.currencySymbol)}),!!(null===(c=C.openEditOrderTransaction)||void 0===c?void 0:c.refundedAmount)&&n.createElement(P,{label:y("checkout-page:refundedAmount"),value:s((null===(d=C.openEditOrderTransaction)||void 0===d?void 0:d.refundedAmount)||0,f.currencyCode,f.currencySymbol)})),n.createElement("div",{className:[g.TotalContainer,v?g.SuccessPageTotalContainer:""].join(" ")},n.createElement("div",{className:g.TitleContainer},n.createElement("div",{className:g.Title},C.isOpenEditOrderWithTransaction?y("checkout-page:totalAmountPayable"):y("checkout-page:total"))),n.createElement("div",null,n.createElement("div",{className:g.TotalPricesContainer},n.createElement("div",{className:g.TotalPrice},s(C.finalPrice||0,f.currencyCode,f.currencySymbol)),!!f.$totalTax&&!!(null===(p=C.customizationProps)||void 0===p?void 0:p.showTax)&&n.createElement("div",{className:[g.TotalTax].join(" ")},y("checkout-page:cartTaxTitle")+" "+f.$formattedTotalTax)))),!v&&!C.isPoweredByHidden&&n.createElement("div",{className:g.PoweredBy},n.createElement("span",null,"powered by"),n.createElement("a",{href:"https://ikas.com"+("tr"===i.getCurrentLocale()?"/tr":""),target:"_blank"},n.createElement(k,null))))))):null})),P=o((function(e){var t=e.label,o=e.value,a=e.tooltipText,c=e.hideMarginBottom;return n.createElement("div",{className:[g.InfoRow,c?g.hideMb:""].join(" ")},n.createElement("div",{className:g.Label},n.createElement("span",null,t),!!a&&n.createElement(C,{text:a,style:{marginLeft:"8px"}})),n.createElement("div",{className:g.Value},o))})),_=o((function(e){var t=e.vm,o=u().t;return t.checkout?n.createElement(n.Fragment,null,a(t.checkout.nonCouponAdjustments||[],"order").map((function(e,a){return n.createElement("div",{className:g.InfoRow,key:a},n.createElement("div",{className:g.Label},"INTEREST"===e.name?o("checkout-page:cartInterest"):e.name),n.createElement("div",{className:g.Value},n.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",n.createElement("span",null,s(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),j=o((function(e){var t,o=e.vm,a=u().t;return o.checkout?n.createElement(n.Fragment,null,null===(t=o.checkout.giftPackageLines)||void 0===t?void 0:t.map((function(e,t){return n.createElement("div",{className:g.InfoRow,key:t},n.createElement("div",{className:g.Label},n.createElement("div",{className:g.GiftLabel},n.createElement(v,{style:{position:"relative",top:"-1px"}}),n.createElement("span",null,a("checkout-page:giftPackage")))),n.createElement("div",{className:g.Value},n.createElement("span",null,s(e.price,o.checkout.currencyCode,o.checkout.currencySymbol))))}))):null})),A=o((function(o){var a=o.vm,r=o.isAddingCoupon,i=o.setAddingCoupon,s=o.setCouponError,m=o.setCouponErrorCode,C=o.isOpenCouponCode,E=o.isMobile,h=o.showOnlyMobile,v=u().t,k=n.useState(""),N=k[0],S=k[1],T=n.useState(!1),b=T[0],O=T[1],I=n.useRef(null);n.useEffect((function(){r&&I.current&&I.current.focus()}),[r]);var x=function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return a.checkout.couponCode=N,O(!0),[4,a.onCouponCodeApply()];case 1:return t.sent(),O(!1),S(""),e=a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length,a.couponError?[3,4]:a.checkout.appliedCouponCode||e?(s(!1),m(null),[4,a.reInitPaymentMethod()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:a.checkout.couponCode=null,s(!0),m(a.couponError),t.label=5;case 5:return[2]}}))}))},P=function(n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return O(!0),[4,a.removeGiftCardLine(n)];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),O(!1),[2]}}))}))};a.step,l.SUCCESS;var _=a.step===l.SHIPPING,j=!!a.checkout.appliedCouponCode||!!(a.checkout.giftCardLines&&a.checkout.giftCardLines.length>0),A=!!a.checkout.appliedCouponCode&&C,w=!r&&a.isCouponCodeVisible&&!a.isCouponCodeRequirementOpen&&a.step!==l.SUCCESS,L=j&&(!C||E);return n.createElement(n.Fragment,null,!!C&&n.createElement(n.Fragment,null,n.createElement("div",{className:[g.CartSummary,g.OpenCouponCodeSummary].join(" ")},n.createElement("div",{className:f.FormSectionTitle},n.createElement("div",{style:{paddingBottom:A?0:6},className:f.Title},v("checkout-page:couponCode"))))),j&&!_&&!a.isCouponCodeRequirementDefult&&n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement("div",{className:w?g.InfoRow:""},w&&n.createElement("div",{className:g.ActionTextBtn,onClick:function(){return i(!0)}},v("checkout-page:addCouponCode")),r&&!C&&n.createElement("div",{style:{marginBottom:"10px"}},n.createElement(c,{value:N,placeholder:v("checkout-page:couponCode"),buttonLabel:v("checkout-page:actions.apply"),inputRef:I,onClick:x,isLoading:b,onChange:S})),C&&n.createElement("div",{tabIndex:0,onKeyDown:function(e){"Enter"===e.key&&x()},className:[g.OpenCouponCodeMain,L?g.OpenCouponCodeMainWithMb:""].join(" ")},n.createElement(d,{name:"couponCode",label:v("checkout-page:addCouponCode"),type:p.TEXT,value:N,onChange:S}),n.createElement(y,{style:{width:"33%"},text:v("checkout-page:actions.apply"),isLoading:b,onClick:x}))),L&&n.createElement(n.Fragment,null,!!a.checkout.appliedCouponCode&&n.createElement("div",{className:[g.InfoRow,h?g.InfoRowGiftCardMobile:""].join(" ")},n.createElement(D,{vm:a,onClearCouponCode:function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=null,O(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),O(!1),[2]}}))}))},couponCode:a.checkout.appliedCouponCode})),!!a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length&&a.checkout.giftCardLines.map((function(e){return n.createElement("div",{className:[g.InfoRow,h?g.InfoRowGiftCardMobile:""].join(" ")},n.createElement(D,{vm:a,onClearGiftCode:P,couponCode:e.code,giftCardLine:e}))}))))})),D=o((function(e){var t=e.vm,o=e.onClearCouponCode,a=e.couponCode,c=e.giftCardLine,r=e.onClearGiftCode,i=t.checkout.couponAdjustment,m=u().t,d=!c,p=(null==c?void 0:c.type)===N.STORE_CREDIT;return n.createElement(n.Fragment,null,n.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline].join(" ")},c&&p&&n.createElement("div",{style:{display:"flex",alignItems:"center",gap:"5px"}},n.createElement("span",{style:{height:"20px"}},n.createElement(O,null)),n.createElement("span",{className:g.StoreCreditTag},m("checkout-page:storeCredit"))),!p&&n.createElement("span",{className:[g.AppliedCoupon,t.isCouponCodeRequirementDefult?"":g.NotClosed].join(" ")},d?n.createElement("span",{style:{height:"16px"}},n.createElement(T,null)):!p&&n.createElement("span",{style:{height:"16px"}},n.createElement(b,null)),n.createElement("span",{className:g.CouponCode},a),t.step!==l.SUCCESS&&!t.isOpenEditOrderWithTransaction&&n.createElement("span",{className:g.ClearCoupon,onClick:function(){return c?r&&r(c.giftCardId):o&&o()}},n.createElement(h,null)))),n.createElement("div",null,c?n.createElement("div",{className:g.Value},n.createElement("span",null,"-")," ",n.createElement("span",null,s((null==c?void 0:c.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol))):n.createElement("div",{className:g.Value},n.createElement("span",null,"DECREMENT"===(null==i?void 0:i.type)?"- ":"")," ",n.createElement("span",null,s((null==i?void 0:i.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol)))))})),w=o((function(e){var t=e.vm,o=e.isAddingNote,a=e.setAddingNote,c=u().t,r=n.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=n.useCallback((function(){a(!0)}),[]),s=n.useCallback((function(e){t.checkout.note=e}),[t,t.checkout]);if(!t.checkoutSettings.showCheckoutNote)return null;var m=t.step===l.SUCCESS;return m&&!t.checkout.note?null:n.createElement("div",{className:g.InfoRow},!o&&!m&&n.createElement("div",{className:g.ActionTextBtn,onClick:i},r),(o||m)&&n.createElement("div",{className:[g.CheckoutNoteContainer,m?g.Success:""].join(" ")},n.createElement("div",{className:g.Title},c("checkout-page:orderNote")),m?n.createElement("div",{className:g.CheckoutNoteDisplay},t.checkout.note):n.createElement(d,{style:{width:"100%"},type:p.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:s,maxLength:320})))}));export{x as CartSummary,A as Coupon,I as CouponErrorCode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import{CheckoutStep as n}from"../../model.js";import{Button as a}from"../button/index.js";import i from"./select/index.js";import o from"../svg/cross.js";import{useTranslation as r}from"../../../../utils/i18n.js";import c from"./style.module.scss.js";import{IkasAmountType as s}from"@ikas/storefront-models";import"@ikas/storefront-config";import{formatCurrency as
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import{CheckoutStep as n}from"../../model.js";import{Button as a}from"../button/index.js";import i from"./select/index.js";import o from"../svg/cross.js";import{useTranslation as r}from"../../../../utils/i18n.js";import c from"./style.module.scss.js";import{IkasAmountType as s}from"@ikas/storefront-models";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{formatCurrency as u}from"../../../../utils/currency.js";var d=function(t){var a,i,o=t.seconds,s=t.onFinish,l=t.campaignOffer,u=t.vm,d=t.isPopupClosed,m=t.step,p=r().t,v=e.useState(o),g=v[0],C=v[1];e.useEffect((function(){C(o)}),[o]),e.useEffect((function(){var e=setInterval((function(){g>0?C(g-1):(clearInterval(e),s())}),1e3);return function(){return clearInterval(e)}}),[g]);var S=l.offer.countdownMinutes&&(m!==n.SUCCESS?!!(null===(a=u.customizationProps)||void 0===a?void 0:a.campaignOfferCountdownStyleIsLine):!!(null===(i=u.customizationProps)||void 0===i?void 0:i.campaignOfferCountdownStyleIsLineSuccessPage))||d;return e.createElement("div",{className:S?c.CountdownContainerIsLine:c.CountdownContainer},e.createElement("div",{className:c.CountdownTextMain},!S&&e.createElement("span",{className:c.CountdownText},p("checkout-page:timeRemaining")),e.createElement("span",{className:c.CountdownTime},f(g))))},f=function(e){var t=Math.floor(e/60/60),n=Math.floor(e/60)-60*t,a=e%60;return 0!==t?t.toString().padStart(2,"0")+":":n.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")},m=t((function(t){var f,m,p,v,g,C,S,h=t.vm,E=t.campaignOffer,O=t.index,P=t.activeIndex,I=t.offersLength,V=t.handleNext,w=t.handlePrev,N=t.setActiveIndex,y=t.isPopupShow,B=t.closePopup,M=t.showPopup,j=t.isPopupClosed,k=t.desktopMiddlePhase,T=t.step,A=r().t,x=E.product,D=T!==n.SUCCESS?!!(null===(f=h.customizationProps)||void 0===f?void 0:f.campaignOfferIsSmallDesign)&&y:!!(null===(m=h.customizationProps)||void 0===m?void 0:m.showCampaignIsBiggerImage)&&T===n.SUCCESS,L=e.useRef(null),z=e.useRef(null),b=e.useRef(null),R=e.useState(0),U=R[0],F=R[1],H=["0ead1005-b19c-4680-8ab7-a8a1cca3244e","ec27eadf-1953-4c71-9680-f213332694a2"].includes(l.getStorefrontId()||"");e.useEffect((function(){var e,t,a,i,o,r,c,s;if(void 0!==typeof window){var l=.8*window.innerHeight,u=0,d=0,f=0;L.current&&(u=null===(t=null===(e=L.current)||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height),z.current&&(d=null===(i=null===(a=z.current)||void 0===a?void 0:a.getBoundingClientRect())||void 0===i?void 0:i.height),b.current&&(f=null===(r=null===(o=b.current)||void 0===o?void 0:o.getBoundingClientRect())||void 0===r?void 0:r.height);var m=(T===n.SUCCESS?null===(c=h.customizationProps)||void 0===c?void 0:c.campaignOfferCountdownStyleIsLineSuccessPage:null===(s=h.customizationProps)||void 0===s?void 0:s.campaignOfferCountdownStyleIsLine)?25:70,p=navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)?20:0;F(l-u-d-f-p-m)}}),[y]);var X=e.useState(null),q=X[0],G=X[1],J=e.useState(null),K=J[0],Q=J[1],W=e.useMemo((function(){var e,t,n,a,i,o,r,c=null===(e=x.selectedVariant.images)||void 0===e?void 0:e.filter((function(e){return!e.isVideo}));return(null===(t=x.selectedVariant.mainImage)||void 0===t?void 0:t.isVideo)&&(null==c?void 0:c.length)?null===(n=c[0].image)||void 0===n?void 0:n.thumbnailSrc:D||k?null===(i=null===(a=x.selectedVariant.mainImage)||void 0===a?void 0:a.image)||void 0===i?void 0:i.getSrc(360):null===(r=null===(o=x.selectedVariant.mainImage)||void 0===o?void 0:o.image)||void 0===r?void 0:r.thumbnailSrc}),[x.selectedVariant,D,k]),Y=function(e){N(0),h.updateCartCampaignOffer({accepted:e,cartId:h.checkout.id,campaignOfferId:E.campaignOffer.campaignOfferId,campaignOfferProductId:E.offer.id,productId:E.offer.productId,variantId:x.selectedVariant.id})},Z=function(){Y(!1)},$=function(){Y(!0)},_=e.useMemo((function(){if(!E.offer.countdownMinutes||!E.campaignOffer.offerStartDate)return 0;var e=Math.round(((new Date).getTime()-new Date(E.campaignOffer.offerStartDate).getTime())/1e3);return e>60*E.offer.countdownMinutes?(Z(),0):60*E.offer.countdownMinutes-e}),[E]),ee=function(e,t){var n=null;x.displayedVariantTypes.forEach((function(t){t.displayedVariantValues.forEach((function(t){t.variant.id===e&&(n=t.variantValue)}))}));var a=x.variants.find((function(t){return t.id===e})),i=!!a&&!!a.variantValues&&!!a.variantValues.length&&a.variantValues[t];i&&x.selectVariantValue(i,!0),x.displayedVariantTypes.forEach((function(t){t.displayedVariantValues.forEach((function(t){t.variant.id===e&&(n=t.variantValue)}))})),n?x.selectVariantValue(n,!0):ee(e,t+1)},te=E.offer.countdownMinutes&&(T!==n.SUCCESS?!!(null===(p=h.customizationProps)||void 0===p?void 0:p.campaignOfferCountdownStyleIsLine):!!(null===(v=h.customizationProps)||void 0===v?void 0:v.campaignOfferCountdownStyleIsLineSuccessPage))||j&&E.offer.countdownMinutes;return e.createElement("div",{style:{transform:"translateX(-".concat(100*P,"%)")},className:[c.Container,O===P?c.ActiveOffer:"",y?c.PopupContainer:"",k?c.PopupContainerDesktop:"",T===n.SUCCESS?c.Border:""].join(" ")},E.offer.countdownMinutes&&(T!==n.SUCCESS?!(null===(g=h.customizationProps)||void 0===g?void 0:g.campaignOfferCountdownStyleIsLine):!(null===(C=h.customizationProps)||void 0===C?void 0:C.campaignOfferCountdownStyleIsLineSuccessPage))&&!j&&e.createElement(d,{seconds:_,onFinish:Z,vm:h,campaignOffer:E,step:T}),e.createElement("div",{onTouchStart:function(e){Q(null),G(e.targetTouches[0].clientX)},onTouchMove:function(e){return Q(e.targetTouches[0].clientX)},onTouchEnd:function(){if(q&&K&&I>1){var e=q-K,t=e>50;(t||e<-50)&&(t?V():w())}},className:[c.ContentContainer,I>1?c.ContentContainerItems:"",j?I>1?c.ContentContainerPopup:c.ContentContainerPopupItems:""].join(" ")},!!y&&e.createElement("div",{className:c.RejectButton,onClick:function(){return B&&B()}},e.createElement(o,null)),e.createElement("div",{ref:L,className:[c.HeaderMain,D&&!j?c.IsBigProductImage:"",te?c.IsLineCountDown:"",j?c.MobileSmallHeader:""].join(" ")},e.createElement("div",{className:c.Header},e.createElement("div",{className:c.Title},E.offer.title),!!E.offer.description&&!j&&e.createElement("div",{className:c.Description},E.offer.description)),te&&e.createElement(d,{seconds:_,onFinish:Z,vm:h,campaignOffer:E,isPopupClosed:j,step:T})),e.createElement("div",{className:[c.ProductContainer,D&&!j?c.IsLineProductContainer:""].join(" ")},e.createElement("div",{style:y?{width:U,height:U}:{},className:[c.ImageContainer,D&&!j?c.BigImage:"",j?c.SmallImage:"",k?c.BiggerImage:""].join(" ")},e.createElement("img",{className:c.Image,src:W})),e.createElement("div",{ref:z,className:c.ProductDetails},e.createElement("div",{className:c.ProductName},x.name),x.hasVariant&&1===x.variants.length&&e.createElement("div",{className:c.VariantName},x.selectedVariant.variantValues.map((function(e){return e.name})).join(", ")),!(null===(S=h.customizationProps)||void 0===S?void 0:S.showCampaignHideDiscountBadge)&&x.selectedVariant.hasDiscount&&e.createElement("span",{className:c.DiscountBadge},E.offer.discountType===s.RATIO?"%".concat(x.selectedVariant.discountPercentage):u(E.offer.discountAmount||0,x.selectedVariant.price.currency||"",x.selectedVariant.price.currencySymbol||"")," ",A("checkout-page:discount")),e.createElement("div",{className:c.ProductPriceMain},x.selectedVariant.hasDiscount&&e.createElement("span",{className:c.Discount},x.selectedVariant.formattedSellPrice," "),e.createElement("span",{className:c.ProductPrice},E.offer.discountType===s.AMOUNT?u(x.selectedVariant.price.sellPrice-(E.offer.discountAmount||0),x.selectedVariant.price.currency||"",x.selectedVariant.price.currencySymbol||""):x.selectedVariant.formattedFinalPrice)),!j&&x.variants.length>1&&e.createElement("div",{className:c.Actions},x.variants.length>1&&e.createElement(i,{value:x.selectedVariant.id,onSelectChange:function(e){ee(e,0)},options:x.variants.map((function(e){return{label:e.variantValues.map((function(e){return e.name})).join(", "),value:e.id}}))})),!!j&&e.createElement(a,{classes:[c.OfferButton,D?c.OfferAcceptButton:"",H?c.ProteinOceanOfferButton:"",c.PopupOfferButton].join(" "),text:A("checkout-page:actions.acceptOffer"),onClick:function(){x.hasVariant&&x.variants.length>1?M&&M():$()}}),!!k&&e.createElement("div",{className:[c.OfferActionsMain,D?c.OfferActionsMainBigImage:"",c.OfferActionsMainMiddlePhase].join(" ")},e.createElement(a,{classes:c.OfferButton,isLine:!0,text:A("checkout-page:actions.rejectOffer"),onClick:Z}),e.createElement(a,{classes:[c.OfferButton,D?c.OfferAcceptButton:"",H?c.ProteinOceanOfferButton:""].join(" "),text:e.createElement("div",null,e.createElement("span",null,A("checkout-page:actions.acceptOffer")),e.createElement("span",null),e.createElement("span",null,x.selectedVariant.price.formattedFinalPrice)),onClick:$})))),!(j||k)&&e.createElement("div",{ref:b,className:[c.OfferActionsMain,D?c.OfferActionsMainBigImage:""].join(" ")},e.createElement(a,{classes:c.OfferButton,isLine:!0,text:A("checkout-page:actions.rejectOffer"),onClick:Z}),e.createElement(a,{classes:[c.OfferButton,D?c.OfferAcceptButton:"",H?c.ProteinOceanOfferButton:""].join(" "),text:A("checkout-page:actions.acceptOffer"),onClick:$}))))}));export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from'./../../../../ext/style-inject/dist/style-inject.es.js';var e={Container:"style-module_Container__-EKYc",Border:"style-module_Border__DqZgC",ActiveOffer:"style-module_ActiveOffer__JZyW-",CountdownContainer:"style-module_CountdownContainer__bc-5v",CountdownContainerIsLine:"style-module_CountdownContainerIsLine__YtdAv",CountdownTextMain:"style-module_CountdownTextMain__S9Rrn",CountdownText:"style-module_CountdownText__Hd-3I",CountdownTime:"style-module_CountdownTime__a2aRF",ContentContainer:"style-module_ContentContainer__tC3zO",HeaderMain:"style-module_HeaderMain__-tiUy",Header:"style-module_Header__J2wyt",IsLineCountDown:"style-module_IsLineCountDown__xgFDT",IsBigProductImage:"style-module_IsBigProductImage__YdAgY",IsLineProductContainer:"style-module_IsLineProductContainer__3Nkqr",Title:"style-module_Title__4T394",Description:"style-module_Description__GPKR-",RejectButton:"style-module_RejectButton__3SwP8",ProductContainer:"style-module_ProductContainer__9qr9n",ImageContainer:"style-module_ImageContainer__gxlXU",PlaceHolderProductContainer:"style-module_PlaceHolderProductContainer__XVvyr",BigImage:"style-module_BigImage__n1DH9",SmallImage:"style-module_SmallImage__42qY-",BiggerImage:"style-module_BiggerImage__2M7Dw",Image:"style-module_Image__gDla7",ProductDetails:"style-module_ProductDetails__a-gJx",ProductName:"style-module_ProductName__yTmJx",VariantName:"style-module_VariantName__DF1mY",Brand:"style-module_Brand__UxK7C",ProductPriceMain:"style-module_ProductPriceMain__IJHv-",ProductPrice:"style-module_ProductPrice__U6Lhy",Discount:"style-module_Discount__tjllJ",Actions:"style-module_Actions__XZsJD",DiscountBadge:"style-module_DiscountBadge__deWxZ",ContentContainerItems:"style-module_ContentContainerItems__SIB05",OfferActionsMain:"style-module_OfferActionsMain__9axsN",OfferActionsMainMiddlePhase:"style-module_OfferActionsMainMiddlePhase__7VryS",OfferButton:"style-module_OfferButton__pkhNI",OfferActionsMainBigImage:"style-module_OfferActionsMainBigImage__qCPQB",MobileSmallHeader:"style-module_MobileSmallHeader__zrlIx",ContentContainerPopup:"style-module_ContentContainerPopup__Pburr",ContentContainerPopupItems:"style-module_ContentContainerPopupItems__7Azct",PopupOfferButton:"style-module_PopupOfferButton__-9ljg",PopupContainer:"style-module_PopupContainer__sL4sY",PopupContainerDesktop:"style-module_PopupContainerDesktop__c13p-"};n(".style-module_Container__-EKYc {\n margin: 32px 0 48px 0;\n border: 1px solid var(--checkout-border-color);\n border-radius: 8px;\n flex-shrink: 0;\n width: 100%;\n transition: 0.5s ease;\n background-color: var(--checkout-campaign-container-bg-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Container__-EKYc {\n margin: 0;\n border-radius: 0;\n border: unset;\n border-bottom: 1px solid var(--checkout-border-color);\n }\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Container__-EKYc.style-module_Border__DqZgC {\n border-top: 1px solid var(--checkout-border-color);\n }\n}\n\n.style-module_ActiveOffer__JZyW- {\n position: relative;\n opacity: 1;\n}\n\n.style-module_CountdownContainer__bc-5v {\n display: flex;\n justify-content: center;\n padding: 12px 16px;\n border-radius: 8px 8px 0 0;\n background-color: var(--checkout-campaign-countdown-bg-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CountdownContainer__bc-5v {\n border-radius: 0;\n }\n}\n\n.style-module_CountdownContainerIsLine__YtdAv {\n display: flex;\n justify-content: center;\n padding: 4px 12px;\n border-radius: 8px;\n background-color: var(--checkout-campaign-countdown-bg-color);\n height: 32px;\n}\n\n.style-module_CountdownTextMain__S9Rrn {\n gap: 6px;\n display: flex;\n}\n\n.style-module_CountdownText__Hd-3I {\n color: var(--checkout-campaign-countdown-text-color);\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.style-module_CountdownTime__a2aRF {\n color: var(--checkout-campaign-countdown-time-color);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n}\n\n.style-module_ContentContainer__tC3zO {\n padding: 24px;\n width: 100%;\n position: relative;\n}\n\n.style-module_HeaderMain__-tiUy {\n display: flex;\n flex-direction: column;\n margin-bottom: 16px;\n}\n\n.style-module_Header__J2wyt {\n display: flex;\n flex-direction: column;\n}\n\n.style-module_IsLineCountDown__xgFDT {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n}\n.style-module_IsLineCountDown__xgFDT .style-module_Header__J2wyt {\n width: 75%;\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_IsBigProductImage__YdAgY {\n flex-direction: column;\n justify-content: center;\n text-align: center;\n row-gap: 16px;\n align-items: center;\n }\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_IsLineProductContainer__3Nkqr {\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 256px;\n margin: 0 auto;\n row-gap: 12px;\n }\n}\n\n.style-module_Title__4T394 {\n font-size: 20px;\n color: var(--checkout-campaign-title-color);\n font-weight: 500;\n line-height: 32px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Title__4T394 {\n font-size: 18px;\n line-height: 26px;\n }\n}\n\n.style-module_Description__GPKR- {\n color: var(--checkout-campaign-description-color);\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n}\n\n.style-module_RejectButton__3SwP8 {\n height: 35px;\n width: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n right: 16px;\n top: 10px;\n cursor: pointer;\n position: absolute;\n}\n\n.style-module_ProductContainer__9qr9n {\n display: flex;\n}\n\n.style-module_ImageContainer__gxlXU {\n height: 80px;\n width: 80px;\n position: relative;\n background-color: #fff;\n margin-right: 12px;\n border-radius: 8px;\n border: 1px solid var(--checkout-border-color);\n}\n.style-module_ImageContainer__gxlXU svg {\n width: 40px;\n height: 40px;\n}\n\n.style-module_PlaceHolderProductContainer__XVvyr {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.style-module_BigImage__n1DH9 {\n height: 152px;\n width: 152px;\n margin-right: 16px;\n}\n.style-module_BigImage__n1DH9 svg {\n width: 80px;\n height: 80px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_BigImage__n1DH9 {\n height: 256px;\n width: 256px;\n margin-right: 0;\n }\n}\n\n.style-module_SmallImage__42qY- {\n height: 52px;\n width: 52px;\n}\n\n.style-module_BiggerImage__2M7Dw {\n height: 320px;\n width: 320px;\n}\n\n.style-module_Image__gDla7 {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: 8px;\n}\n\n.style-module_ProductDetails__a-gJx {\n flex: 1;\n width: 100%;\n position: relative;\n}\n\n.style-module_ProductName__yTmJx {\n margin-bottom: 4px;\n font-size: 16px;\n color: var(--checkout-primary-text-color);\n font-weight: 500;\n line-height: 24px;\n}\n\n.style-module_VariantName__DF1mY {\n margin-bottom: 4px;\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n line-height: 20px;\n}\n\n.style-module_Brand__UxK7C {\n margin-bottom: 2px;\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n line-height: 20px;\n}\n\n.style-module_ProductPriceMain__IJHv- {\n gap: 6px;\n display: flex;\n}\n\n.style-module_ProductPrice__U6Lhy {\n font-size: 16px;\n font-weight: 500;\n color: var(--checkout-primary-text-color);\n line-height: 24px;\n}\n\n.style-module_Discount__tjllJ {\n font-size: 16px;\n font-weight: 400;\n color: var(--checkout-secondary-text-color);\n text-decoration: line-through;\n line-height: 24px;\n}\n\n.style-module_Actions__XZsJD {\n display: flex;\n margin-top: 16px;\n width: 100%;\n}\n\n.style-module_DiscountBadge__deWxZ {\n color: var(--checkout-campaign-discount-percentage-color);\n background-color: var(--checkout-campaign-discount-percentage-bg-color);\n display: flex;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 14px;\n font-weight: 700;\n line-height: 20px;\n width: max-content;\n margin-bottom: 4px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_DiscountBadge__deWxZ {\n font-size: 12px;\n }\n}\n\n.style-module_ContentContainerItems__SIB05 {\n position: relative;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_ContentContainerItems__SIB05 {\n padding-bottom: 60px;\n }\n}\n\n.style-module_OfferActionsMain__9axsN {\n display: flex;\n gap: 12px;\n margin-top: 24px;\n}\n\n.style-module_OfferActionsMainMiddlePhase__7VryS {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin-top: 24px;\n flex-direction: column-reverse;\n position: absolute;\n bottom: 0;\n width: 100%;\n}\n.style-module_OfferActionsMainMiddlePhase__7VryS .style-module_OfferButton__pkhNI div span:nth-child(2) {\n background-color: rgb(255, 255, 255);\n width: 2px;\n height: 2px;\n display: flex;\n}\n.style-module_OfferActionsMainMiddlePhase__7VryS .style-module_OfferButton__pkhNI div {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 500;\n}\n.style-module_OfferActionsMainMiddlePhase__7VryS .style-module_OfferButton__pkhNI div span {\n font-weight: 500;\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_OfferActionsMainBigImage__qCPQB {\n display: flex;\n flex-direction: column;\n flex-direction: column-reverse;\n }\n}\n\n.style-module_OfferButton__pkhNI {\n font-weight: 500 !important;\n width: 100%;\n height: 52px !important;\n font-size: 16px;\n}\n\n.style-module_MobileSmallHeader__zrlIx {\n margin-bottom: 10px;\n}\n.style-module_MobileSmallHeader__zrlIx .style-module_Header__J2wyt .style-module_Title__4T394 {\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.style-module_ContentContainerPopup__Pburr {\n padding: 16px;\n padding-bottom: 60px;\n}\n.style-module_ContentContainerPopup__Pburr .style-module_ProductContainer__9qr9n .style-module_ProductDetails__a-gJx {\n position: relative;\n}\n\n.style-module_ContentContainerPopupItems__7Azct {\n padding: 16px;\n}\n.style-module_ContentContainerPopupItems__7Azct .style-module_ProductContainer__9qr9n .style-module_ProductDetails__a-gJx {\n position: relative;\n}\n\n.style-module_PopupOfferButton__-9ljg {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 40%;\n font-size: 12px;\n height: 44px !important;\n}\n\n.style-module_PopupContainer__sL4sY {\n border-bottom: unset;\n}\n.style-module_PopupContainer__sL4sY .style-module_ContentContainer__tC3zO {\n padding-bottom: 16px;\n}\n\n.style-module_PopupContainerDesktop__c13p- {\n border: 1px solid var(--checkout-border-color);\n}");export{e as default};
|
|
1
|
+
import n from'./../../../../ext/style-inject/dist/style-inject.es.js';var e={Container:"style-module_Container__-EKYc",Border:"style-module_Border__DqZgC",ActiveOffer:"style-module_ActiveOffer__JZyW-",CountdownContainer:"style-module_CountdownContainer__bc-5v",CountdownContainerIsLine:"style-module_CountdownContainerIsLine__YtdAv",CountdownTextMain:"style-module_CountdownTextMain__S9Rrn",CountdownText:"style-module_CountdownText__Hd-3I",CountdownTime:"style-module_CountdownTime__a2aRF",ContentContainer:"style-module_ContentContainer__tC3zO",HeaderMain:"style-module_HeaderMain__-tiUy",Header:"style-module_Header__J2wyt",IsLineCountDown:"style-module_IsLineCountDown__xgFDT",IsBigProductImage:"style-module_IsBigProductImage__YdAgY",IsLineProductContainer:"style-module_IsLineProductContainer__3Nkqr",Title:"style-module_Title__4T394",Description:"style-module_Description__GPKR-",RejectButton:"style-module_RejectButton__3SwP8",ProductContainer:"style-module_ProductContainer__9qr9n",ImageContainer:"style-module_ImageContainer__gxlXU",PlaceHolderProductContainer:"style-module_PlaceHolderProductContainer__XVvyr",BigImage:"style-module_BigImage__n1DH9",SmallImage:"style-module_SmallImage__42qY-",BiggerImage:"style-module_BiggerImage__2M7Dw",Image:"style-module_Image__gDla7",ProductDetails:"style-module_ProductDetails__a-gJx",ProductName:"style-module_ProductName__yTmJx",VariantName:"style-module_VariantName__DF1mY",Brand:"style-module_Brand__UxK7C",ProductPriceMain:"style-module_ProductPriceMain__IJHv-",ProductPrice:"style-module_ProductPrice__U6Lhy",Discount:"style-module_Discount__tjllJ",Actions:"style-module_Actions__XZsJD",DiscountBadge:"style-module_DiscountBadge__deWxZ",ContentContainerItems:"style-module_ContentContainerItems__SIB05",OfferActionsMain:"style-module_OfferActionsMain__9axsN",OfferActionsMainMiddlePhase:"style-module_OfferActionsMainMiddlePhase__7VryS",OfferButton:"style-module_OfferButton__pkhNI",OfferActionsMainBigImage:"style-module_OfferActionsMainBigImage__qCPQB",ProteinOceanOfferButton:"style-module_ProteinOceanOfferButton__ypr7i",MobileSmallHeader:"style-module_MobileSmallHeader__zrlIx",ContentContainerPopup:"style-module_ContentContainerPopup__Pburr",ContentContainerPopupItems:"style-module_ContentContainerPopupItems__7Azct",PopupOfferButton:"style-module_PopupOfferButton__-9ljg",PopupContainer:"style-module_PopupContainer__sL4sY",PopupContainerDesktop:"style-module_PopupContainerDesktop__c13p-"};n(".style-module_Container__-EKYc {\n margin: 32px 0 48px 0;\n border: 1px solid var(--checkout-border-color);\n border-radius: 8px;\n flex-shrink: 0;\n width: 100%;\n transition: 0.5s ease;\n background-color: var(--checkout-campaign-container-bg-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Container__-EKYc {\n margin: 0;\n border-radius: 0;\n border: unset;\n border-bottom: 1px solid var(--checkout-border-color);\n }\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Container__-EKYc.style-module_Border__DqZgC {\n border-top: 1px solid var(--checkout-border-color);\n }\n}\n\n.style-module_ActiveOffer__JZyW- {\n position: relative;\n opacity: 1;\n}\n\n.style-module_CountdownContainer__bc-5v {\n display: flex;\n justify-content: center;\n padding: 12px 16px;\n border-radius: 8px 8px 0 0;\n background-color: var(--checkout-campaign-countdown-bg-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CountdownContainer__bc-5v {\n border-radius: 0;\n }\n}\n\n.style-module_CountdownContainerIsLine__YtdAv {\n display: flex;\n justify-content: center;\n padding: 4px 12px;\n border-radius: 8px;\n background-color: var(--checkout-campaign-countdown-bg-color);\n height: 32px;\n}\n\n.style-module_CountdownTextMain__S9Rrn {\n gap: 6px;\n display: flex;\n}\n\n.style-module_CountdownText__Hd-3I {\n color: var(--checkout-campaign-countdown-text-color);\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.style-module_CountdownTime__a2aRF {\n color: var(--checkout-campaign-countdown-time-color);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n}\n\n.style-module_ContentContainer__tC3zO {\n padding: 24px;\n width: 100%;\n position: relative;\n}\n\n.style-module_HeaderMain__-tiUy {\n display: flex;\n flex-direction: column;\n margin-bottom: 16px;\n}\n\n.style-module_Header__J2wyt {\n display: flex;\n flex-direction: column;\n}\n\n.style-module_IsLineCountDown__xgFDT {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n}\n.style-module_IsLineCountDown__xgFDT .style-module_Header__J2wyt {\n width: 75%;\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_IsBigProductImage__YdAgY {\n flex-direction: column;\n justify-content: center;\n text-align: center;\n row-gap: 16px;\n align-items: center;\n }\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_IsLineProductContainer__3Nkqr {\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 256px;\n margin: 0 auto;\n row-gap: 12px;\n }\n}\n\n.style-module_Title__4T394 {\n font-size: 20px;\n color: var(--checkout-campaign-title-color);\n font-weight: 500;\n line-height: 32px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Title__4T394 {\n font-size: 18px;\n line-height: 26px;\n }\n}\n\n.style-module_Description__GPKR- {\n color: var(--checkout-campaign-description-color);\n font-size: 16px;\n font-weight: 400;\n line-height: 24px;\n}\n\n.style-module_RejectButton__3SwP8 {\n height: 35px;\n width: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n right: 16px;\n top: 10px;\n cursor: pointer;\n position: absolute;\n}\n\n.style-module_ProductContainer__9qr9n {\n display: flex;\n}\n\n.style-module_ImageContainer__gxlXU {\n height: 80px;\n width: 80px;\n position: relative;\n background-color: #fff;\n margin-right: 12px;\n border-radius: 8px;\n border: 1px solid var(--checkout-border-color);\n}\n.style-module_ImageContainer__gxlXU svg {\n width: 40px;\n height: 40px;\n}\n\n.style-module_PlaceHolderProductContainer__XVvyr {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.style-module_BigImage__n1DH9 {\n height: 152px;\n width: 152px;\n margin-right: 16px;\n}\n.style-module_BigImage__n1DH9 svg {\n width: 80px;\n height: 80px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_BigImage__n1DH9 {\n height: 256px;\n width: 256px;\n margin-right: 0;\n }\n}\n\n.style-module_SmallImage__42qY- {\n height: 52px;\n width: 52px;\n}\n\n.style-module_BiggerImage__2M7Dw {\n height: 320px;\n width: 320px;\n}\n\n.style-module_Image__gDla7 {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: 8px;\n}\n\n.style-module_ProductDetails__a-gJx {\n flex: 1;\n width: 100%;\n position: relative;\n}\n\n.style-module_ProductName__yTmJx {\n margin-bottom: 4px;\n font-size: 16px;\n color: var(--checkout-primary-text-color);\n font-weight: 500;\n line-height: 24px;\n}\n\n.style-module_VariantName__DF1mY {\n margin-bottom: 4px;\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n line-height: 20px;\n}\n\n.style-module_Brand__UxK7C {\n margin-bottom: 2px;\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n line-height: 20px;\n}\n\n.style-module_ProductPriceMain__IJHv- {\n gap: 6px;\n display: flex;\n}\n\n.style-module_ProductPrice__U6Lhy {\n font-size: 16px;\n font-weight: 500;\n color: var(--checkout-primary-text-color);\n line-height: 24px;\n}\n\n.style-module_Discount__tjllJ {\n font-size: 16px;\n font-weight: 400;\n color: var(--checkout-secondary-text-color);\n text-decoration: line-through;\n line-height: 24px;\n}\n\n.style-module_Actions__XZsJD {\n display: flex;\n margin-top: 16px;\n width: 100%;\n}\n\n.style-module_DiscountBadge__deWxZ {\n color: var(--checkout-campaign-discount-percentage-color);\n background-color: var(--checkout-campaign-discount-percentage-bg-color);\n display: flex;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 14px;\n font-weight: 700;\n line-height: 20px;\n width: max-content;\n margin-bottom: 4px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_DiscountBadge__deWxZ {\n font-size: 12px;\n }\n}\n\n.style-module_ContentContainerItems__SIB05 {\n position: relative;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_ContentContainerItems__SIB05 {\n padding-bottom: 60px;\n }\n}\n\n.style-module_OfferActionsMain__9axsN {\n display: flex;\n gap: 12px;\n margin-top: 24px;\n}\n\n.style-module_OfferActionsMainMiddlePhase__7VryS {\n display: flex;\n flex-direction: column;\n gap: 12px;\n margin-top: 24px;\n flex-direction: column-reverse;\n position: absolute;\n bottom: 0;\n width: 100%;\n}\n.style-module_OfferActionsMainMiddlePhase__7VryS .style-module_OfferButton__pkhNI div span:nth-child(2) {\n background-color: rgb(255, 255, 255);\n width: 2px;\n height: 2px;\n display: flex;\n}\n.style-module_OfferActionsMainMiddlePhase__7VryS .style-module_OfferButton__pkhNI div {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 500;\n}\n.style-module_OfferActionsMainMiddlePhase__7VryS .style-module_OfferButton__pkhNI div span {\n font-weight: 500;\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_OfferActionsMainBigImage__qCPQB {\n display: flex;\n flex-direction: column;\n flex-direction: column-reverse;\n }\n}\n\n.style-module_OfferButton__pkhNI {\n font-weight: 500 !important;\n width: 100%;\n height: 52px !important;\n font-size: 16px;\n}\n\n.style-module_ProteinOceanOfferButton__ypr7i {\n font-weight: 600 !important;\n}\n\n.style-module_MobileSmallHeader__zrlIx {\n margin-bottom: 10px;\n}\n.style-module_MobileSmallHeader__zrlIx .style-module_Header__J2wyt .style-module_Title__4T394 {\n font-size: 16px;\n font-weight: 500;\n line-height: 24px;\n}\n\n.style-module_ContentContainerPopup__Pburr {\n padding: 16px;\n padding-bottom: 60px;\n}\n.style-module_ContentContainerPopup__Pburr .style-module_ProductContainer__9qr9n .style-module_ProductDetails__a-gJx {\n position: relative;\n}\n\n.style-module_ContentContainerPopupItems__7Azct {\n padding: 16px;\n}\n.style-module_ContentContainerPopupItems__7Azct .style-module_ProductContainer__9qr9n .style-module_ProductDetails__a-gJx {\n position: relative;\n}\n\n.style-module_PopupOfferButton__-9ljg {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 40%;\n font-size: 12px;\n height: 44px !important;\n}\n\n.style-module_PopupContainer__sL4sY {\n border-bottom: unset;\n}\n.style-module_PopupContainer__sL4sY .style-module_ContentContainer__tC3zO {\n padding-bottom: 16px;\n}\n\n.style-module_PopupContainerDesktop__c13p- {\n border: 1px solid var(--checkout-border-color);\n}");export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import n from"react-tooltip";import a,{CheckoutStep as s}from"./model.js";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{formatCurrency as c}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-filter/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 b}from"./components/error/stock-error/index.js";import{FullscreenLoading as S}from"./components/fullscreen-loading/index.js";import M from"./components/notification-box/index.js";import{FormItem as F}from"./components/form-item/index.js";import{FormItemType as T}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as I}from"../page/head.js";import A from"./components/offer-product/index.js";import B from"./components/offer-product/placeholder-offer-product.js";import L from"./components/svg/ikas.js";import D from"./style.module.scss.js";import{Analytics as V}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import U from"./components/svg/success-circle.js";import R from"./components/offer-product/offer-dots/index.js";import z from"./components/offer-product/offer-arrows/index.js";import _ from"./components/offer-product/useCampaignOffer.js";import H from"../../hooks/useDimension.js";var G=r((function(e){var t,r,c,d,p,u,f,g=e.checkout,E=e.checkoutSettings,N=e.customizationProps,O=e.returnPolicy,M=e.privacyPolicy,F=e.termsOfService,T=e.imprint,A=e.shippingPolicy,R=m().t,z=i(),H=o.useState(Date.now()),G=H[0],X=H[1],K=o.useState((function(){return new a(g,E,z,O,M,F,T,A,R,N||{})}))[0];o.useEffect((function(){X(Date.now())}),[g.campaignOffers,K.campaignOffers,K.isCampaignOfferLoaded]);var ee=_(K),te=ee.setShowDetailPage,oe=ee.isPopupShowIndexPage,re=ee.isShowSuccessPageMiddlePhase;o.useMemo((function(){return Date.now()}),[]);return K.step,s.PAYMENT,o.useEffect((function(){var e;K.checkoutSettings.isAccountRequired&&!K.checkout.hasCustomer&&z.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==s.SUCCESS&&(K.checkoutSettings.isAccountRequired&&(null===(e=K.checkout.customer)||void 0===e?void 0:e.isGuestCheckout)||V.beginCheckout(K.checkout)),V.pageView(h.CHECKOUT)}),[]),o.useEffect((function(){K.customizationProps=N,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")}(N)}),[N]),K.isCheckoutLoaded&&K.store.customerStore.initialized?K.checkout.hasCustomer&&(null===(t=K.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=K.checkout.customer)||void 0===r?void 0:r.id)?(z.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(I,{pageType:h.CHECKOUT,pageTitle:((null===(c=K.merchantSettings)||void 0===c?void 0:c.merchantName)||"")+" - "+R("checkout-page:securePayment"),pageDescription:R("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:D.CheckoutPage},re?o.createElement("div",{className:D.FullPageOfferMain},o.createElement("div",{className:D.FullPageOfferContainer},o.createElement("div",{className:D.LogoMain},(null===(d=K.customizationProps)||void 0===d?void 0:d.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:K.customizationProps.logo,sizes:"360px"})):(null===(p=K.merchantSettings)||void 0===p?void 0:p.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:K.merchantSettings.logo,sizes:"360px"})):(null===(u=K.merchantSettings)||void 0===u?void 0:u.merchantName)||""),o.createElement("div",{className:D.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:D.OfferSuccessHeader},o.createElement(U,{className:D.SuccessCircle}),o.createElement("span",{className:D.SuccessTitle},R("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:D.OfferOrderInfoMain},o.createElement("div",{className:D.InfoTitle},R("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:D.InfoText},"#"+(K.checkout.orderNumber||"")," ",K.checkout.dateStr))),o.createElement("div",null,o.createElement(w,{classes:D.OfferButton,isLine:!0,text:R("checkout-page:actions.goOrderDetailPage"),onClick:function(){te(!1)}}))),o.createElement("div",null,o.createElement(Z,{vm:K,key:G})))):null,o.createElement(n,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:D.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[D.Left].join(" ")},o.createElement("div",{className:D.LeftContent},o.createElement("div",null,o.createElement(W,{vm:K}),K.hasStockError&&o.createElement("div",{className:D.ErrorContainer},o.createElement(b,{vm:K,error:K.error})),!K.hasStockError&&o.createElement(o.Fragment,null,K.step!==s.SUCCESS&&o.createElement(v,{vm:K,allowExpand:!0}),K.step===s.SUCCESS?o.createElement(y,{vm:K}):o.createElement(o.Fragment,null,!!(null===(f=K.customizationProps)||void 0===f?void 0:f.showCampaignOffersDesign)&&l.getIsEditor()&&o.createElement(B,{vm:K}),oe&&o.createElement("div",{className:[D.MiddlePhaseOverlay,oe?D.MiddlePhaseOverlayPopup:""].join(" ")}),K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement($,{key:G,vm:K}),K.isCouponCodeRequirementOpen&&o.createElement(Y,{vm:K}),o.createElement(q,{vm:K}))),o.createElement("div",{className:D.Space})),o.createElement(J,{vm:K}))),o.createElement("div",{className:D.Right},o.createElement("div",{className:D.RightContent},o.createElement(v,{vm:K}),!K.isPoweredByHidden&&o.createElement("div",{className:D.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(L,null))))),!!K.policyModalText&&o.createElement(x,{title:K.policyModalTitle,modalContent:K.policyModalText,onClose:function(){K.policyModalText=""},isPolicyModal:!0}),K.isContactModalVisible&&o.createElement(Q,{vm:K,setVisible:K.setContactModalVisible}),K.mpVM.isOtpModalVisible&&o.createElement(k,{vm:K,visible:K.mpVM.isOtpModalVisible,type:K.mpVM.otpModalType,onClose:K.mpVM.hideOtpModal}),K.mpVM.isResponseModalVisible&&o.createElement(C,{visible:K.mpVM.isResponseModalVisible,text:K.mpVM.mfsResponseModalText,onClose:K.mpVM.onResponseModalClose}),K.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:K.mpVM.isSuccessModalVisible,type:K.mpVM.successModalType,onClose:K.mpVM.onSuccessModalClose}))):o.createElement(S,null)})),W=r((function(e){var t,r,i,n,a=e.vm,s=l.getCurrentRouting(),c=(null==s?void 0:s.path)?"/".concat(s.path):"/",d=m().t;return o.createElement("div",{className:D.Header},o.createElement("a",{href:c},(null===(t=a.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:a.customizationProps.logo,sizes:"360px"})):(null===(r=a.merchantSettings)||void 0===r?void 0:r.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:a.merchantSettings.logo,sizes:"360px"})):(null===(i=a.merchantSettings)||void 0===i?void 0:i.merchantName)||""),!a.checkout.hasCustomer&&o.createElement("div",{className:D.LoginText},o.createElement("span",{className:D.LoginCta},d("checkout-page:alreadyHaveAnAccount")),o.createElement("a",{href:a.getGoToLoginHref(),className:D.LoginBtn},d("checkout-page:actions.login"))),a.checkout.hasCustomer&&o.createElement("div",{className:D.CustomerInfo},o.createElement("div",{className:D.Name},a.checkout.customerFullName),o.createElement("div",{className:D.Email},null===(n=a.checkout.customer)||void 0===n?void 0:n.email)))})),Y=r((function(e){var t=e.vm,r=m().t,i=o.useState(!1),n=i[0],a=i[1],s=o.useState(null),l=s[0],c=s[1],d=H().isMobile,p=o.useMemo((function(){switch(l){case f.COUPON_CODE_NOT_EXIST:return r("checkout-page:giftCodeErrorDescription");case f.COUPON_CODE_NOT_EXIST_FOR_GUESS:return r("checkout-page:mustBeSignInToApplyCampaign");case f.COUPON_APPLIED_WITHOUT_DISCOUNT:return r("checkout-page:couponInvalidForCartItems");default:return""}}),[l]);return o.createElement("div",{className:D.CouponContainer},n&&o.createElement("div",{className:D.NotificationContainer},o.createElement(M,{type:"warning",title:r("checkout-page:giftCodeErrorTitle"),content:p,onClose:function(){a(!1),c(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:c,showOnlyMobile:!0,isMobile:d})))})),q=r((function(e){var t=e.vm,r=m().t,i=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=[new O(r("checkout-page:address"),t.step===s.INFO,t.step!==s.INFO,t.step!==s.INFO?o.createElement("div",{className:D.AdressStepInfo},o.createElement(X,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&o.createElement("div",{className:D.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==s.INFO?o.createElement("div",{className:D.AddressStepInfoMobile},o.createElement(X,{vm:t})):void 0),new O(r("checkout-page:payment"),t.step===s.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new O(r("checkout-page:shipping"),t.step===s.SHIPPING,t.step===s.PAYMENT,t.step===s.PAYMENT?o.createElement("div",{className:D.AdressStepInfo},o.createElement(K,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:D.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===s.PAYMENT?o.createElement("div",{className:D.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(N,{steps:n,stepContent:i})})),X=r((function(e){var t,r,i,n,a,s,l,c,d,p=e.vm,u=m().t,f=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=p.checkout.billingAddress)||void 0===r?void 0:r.lastName)||""):((null===(i=p.checkout.shippingAddress)||void 0===i?void 0:i.firstName)||"")+" "+((null===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:D.Address},o.createElement("div",{className:[D.Text,D.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:D.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:D.Text},u("checkout-page:receiver")),o.createElement("div",{className:[D.Text,D.Gray].join(" ")},f)),o.createElement("div",{className:[D.Text,D.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(l=p.checkout.shippingAddress)||void 0===l?void 0:l.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[D.Text,D.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[D.Text,D.Gray].join(" ")},p.isDigitalOnly?null===(c=p.checkout.billingAddress)||void 0===c?void 0:c.addressText:null===(d=p.checkout.shippingAddress)||void 0===d?void 0:d.addressText))})),K=r((function(e){var t=e.vm,r=m().t;return o.createElement("div",{className:D.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:D.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?r("checkout-page:free"):c(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):r("checkout-page:standartShipping"))})),J=r((function(e){var t=e.vm,r=m().t;return o.createElement("div",{className:D.Footer},o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:imprint"),t.policyModalText=t.imprint}},r("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},r("checkout-page:shippingPolicy"))))})),Q=r((function(r){var i,n,a,s=r.vm,l=r.setVisible,c=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===(i=s.checkout.customer)||void 0===i?void 0:i.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,l(!1)]:(u(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&v(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(x,{title:c("checkout-page:contactForm"),modalContent:o.createElement("div",null,g&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(M,{type:"success",title:c("checkout-page:contactFormSent"),content:c("checkout-page:contactFormDescription")})),o.createElement(F,{name:"message",type:T.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:c("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:c(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:y})),onClose:function(){return l(!1)}})})),Z=r((function(e){var t=e.vm,r=_(t),i=r.setActiveIndex,n=r.handlePrev,a=r.handleNext,s=r.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:D.CampaignOfferMain},o.createElement("div",{className:D.OfferSlider},t.campaignOffers.map((function(e,r){var l;return o.createElement(A,{vm:t,campaignOffer:e,index:r,activeIndex:s,offersLength:(null===(l=t.campaignOffers)||void 0===l?void 0:l.length)||0,handlePrev:n,handleNext:a,setActiveIndex:function(e){return i(e)},desktopMiddlePhase:!0,step:t.step})}))),t.campaignOffers.length>1&&o.createElement(z,{handlePrev:n,handleNext:a}),t.campaignOffers.length>1&&o.createElement(R,{vm:t,activeIndex:s})):null})),$=r((function(e){var t=e.vm,r=_(t),i=r.setActiveIndex,n=r.setIsActiveOverlay,a=r.handlePrev,s=r.handleNext,l=r.isPopupClosedIndexPage,c=r.isPopupShowIndexPage,m=r.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:[D.CampaignOfferMain,c?D.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:D.OfferSlider},t.campaignOffers.map((function(e,r){var d;return o.createElement(A,{vm:t,campaignOffer:e,index:r,activeIndex:m,offersLength:(null===(d=t.campaignOffers)||void 0===d?void 0:d.length)||0,handlePrev:a,handleNext:s,setActiveIndex:function(e){return i(e)},step:t.step,isPopupClosed:l,isPopupShow:c,closePopup:function(){return n(!1)},showPopup:function(){return n(!0)}})}))),t.campaignOffers.length>1&&o.createElement(z,{handlePrev:a,handleNext:s}),t.campaignOffers.length>1&&o.createElement(R,{isPopupShow:c,vm:t,activeIndex:m})):null}));export{G as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}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-filter/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 b}from"./components/error/stock-error/index.js";import{FullscreenLoading as S}from"./components/fullscreen-loading/index.js";import M from"./components/notification-box/index.js";import{FormItem as F}from"./components/form-item/index.js";import{FormItemType as T}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as I}from"../page/head.js";import A from"./components/offer-product/index.js";import B from"./components/offer-product/placeholder-offer-product.js";import L from"./components/svg/ikas.js";import D from"./style.module.scss.js";import{Analytics as V}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import U from"./components/svg/success-circle.js";import R from"./components/offer-product/offer-dots/index.js";import z from"./components/offer-product/offer-arrows/index.js";import _ from"./components/offer-product/useCampaignOffer.js";import H from"../../hooks/useDimension.js";var W=r((function(e){var t,r,l,d,p,u,f,g=e.checkout,E=e.checkoutSettings,N=e.customizationProps,O=e.returnPolicy,M=e.privacyPolicy,F=e.termsOfService,T=e.imprint,A=e.shippingPolicy,R=m().t,z=i(),H=o.useState(Date.now()),W=H[0],X=H[1],K=o.useState((function(){return new a(g,E,z,O,M,F,T,A,R,N||{})}))[0];o.useEffect((function(){X(Date.now())}),[g.campaignOffers,K.campaignOffers,K.isCampaignOfferLoaded]);var ee=_(K),te=ee.setShowDetailPage,oe=ee.isPopupShowIndexPage,re=ee.isShowSuccessPageMiddlePhase;o.useMemo((function(){return Date.now()}),[]);return K.step,s.PAYMENT,o.useEffect((function(){var e;K.checkoutSettings.isAccountRequired&&!K.checkout.hasCustomer&&z.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==s.SUCCESS&&(K.checkoutSettings.isAccountRequired&&(null===(e=K.checkout.customer)||void 0===e?void 0:e.isGuestCheckout)||V.beginCheckout(K.checkout)),V.pageView(h.CHECKOUT)}),[]),o.useEffect((function(){K.customizationProps=N,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")}(N)}),[N]),K.isCheckoutLoaded&&K.store.customerStore.initialized?K.checkout.hasCustomer&&(null===(t=K.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=K.checkout.customer)||void 0===r?void 0:r.id)?(z.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(I,{pageType:h.CHECKOUT,pageTitle:((null===(l=K.merchantSettings)||void 0===l?void 0:l.merchantName)||"")+" - "+R("checkout-page:securePayment"),pageDescription:R("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:D.CheckoutPage},re?o.createElement("div",{className:D.FullPageOfferMain},o.createElement("div",{className:D.FullPageOfferContainer},o.createElement("div",{className:D.LogoMain},(null===(d=K.customizationProps)||void 0===d?void 0:d.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:K.customizationProps.logo,sizes:"360px"})):(null===(p=K.merchantSettings)||void 0===p?void 0:p.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:K.merchantSettings.logo,sizes:"360px"})):(null===(u=K.merchantSettings)||void 0===u?void 0:u.merchantName)||""),o.createElement("div",{className:D.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:D.OfferSuccessHeader},o.createElement(U,{className:D.SuccessCircle}),o.createElement("span",{className:D.SuccessTitle},R("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:D.OfferOrderInfoMain},o.createElement("div",{className:D.InfoTitle},R("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:D.InfoText},"#"+(K.checkout.orderNumber||"")," ",K.checkout.dateStr))),o.createElement("div",null,o.createElement(w,{classes:D.OfferButton,isLine:!0,text:R("checkout-page:actions.goOrderDetailPage"),onClick:function(){te(!1)}}))),o.createElement("div",null,o.createElement(Z,{vm:K,key:W})))):null,o.createElement(n,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:D.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[D.Left].join(" ")},o.createElement("div",{className:D.LeftContent},o.createElement("div",null,o.createElement(G,{vm:K}),K.hasStockError&&o.createElement("div",{className:D.ErrorContainer},o.createElement(b,{vm:K,error:K.error})),!K.hasStockError&&o.createElement(o.Fragment,null,K.step!==s.SUCCESS&&o.createElement(v,{vm:K,allowExpand:!0}),K.step===s.SUCCESS?o.createElement(y,{vm:K}):o.createElement(o.Fragment,null,!!(null===(f=K.customizationProps)||void 0===f?void 0:f.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(B,{vm:K}),oe&&o.createElement("div",{className:[D.MiddlePhaseOverlay,oe?D.MiddlePhaseOverlayPopup:""].join(" ")}),K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement($,{key:W,vm:K}),K.isCouponCodeRequirementOpen&&o.createElement(Y,{vm:K}),o.createElement(q,{vm:K}))),o.createElement("div",{className:D.Space})),o.createElement(J,{vm:K}))),o.createElement("div",{className:D.Right},o.createElement("div",{className:D.RightContent},o.createElement(v,{vm:K}),!K.isPoweredByHidden&&o.createElement("div",{className:D.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(L,null))))),!!K.policyModalText&&o.createElement(x,{title:K.policyModalTitle,modalContent:K.policyModalText,onClose:function(){K.policyModalText=""},isPolicyModal:!0}),K.isContactModalVisible&&o.createElement(Q,{vm:K,setVisible:K.setContactModalVisible}),K.mpVM.isOtpModalVisible&&o.createElement(k,{vm:K,visible:K.mpVM.isOtpModalVisible,type:K.mpVM.otpModalType,onClose:K.mpVM.hideOtpModal}),K.mpVM.isResponseModalVisible&&o.createElement(C,{visible:K.mpVM.isResponseModalVisible,text:K.mpVM.mfsResponseModalText,onClose:K.mpVM.onResponseModalClose}),K.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:K.mpVM.isSuccessModalVisible,type:K.mpVM.successModalType,onClose:K.mpVM.onSuccessModalClose}))):o.createElement(S,null)})),G=r((function(e){var t,r,i,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:D.Header},o.createElement("a",{href:l},(null===(t=a.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:a.customizationProps.logo,sizes:"360px"})):(null===(r=a.merchantSettings)||void 0===r?void 0:r.logo)?o.createElement("div",{className:D.Logo},o.createElement(P,{layout:"fill",image:a.merchantSettings.logo,sizes:"360px"})):(null===(i=a.merchantSettings)||void 0===i?void 0:i.merchantName)||""),!a.checkout.hasCustomer&&!a.isOpenEditOrderWithTransaction&&!a.checkout.edited&&o.createElement("div",{className:D.LoginText},o.createElement("span",{className:D.LoginCta},d("checkout-page:alreadyHaveAnAccount")),o.createElement("a",{href:a.getGoToLoginHref(),className:D.LoginBtn},d("checkout-page:actions.login"))),(a.checkout.hasCustomer||a.isOpenEditOrderWithTransaction||a.checkout.edited)&&o.createElement("div",{className:D.CustomerInfo},o.createElement("div",{className:D.Name},a.checkout.customerFullName),o.createElement("div",{className:D.Email},null===(n=a.checkout.customer)||void 0===n?void 0:n.email)))})),Y=r((function(e){var t=e.vm,r=m().t,i=o.useState(!1),n=i[0],a=i[1],s=o.useState(null),c=s[0],l=s[1],d=H().isMobile,p=o.useMemo((function(){switch(c){case f.COUPON_CODE_NOT_EXIST:return r("checkout-page:giftCodeErrorDescription");case f.COUPON_CODE_NOT_EXIST_FOR_GUESS:return r("checkout-page:mustBeSignInToApplyCampaign");case f.COUPON_APPLIED_WITHOUT_DISCOUNT:return r("checkout-page:couponInvalidForCartItems");default:return""}}),[c]);return o.createElement("div",{className:D.CouponContainer},n&&o.createElement("div",{className:D.NotificationContainer},o.createElement(M,{type:"warning",title:r("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=r((function(e){var t=e.vm,r=m().t,i=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=[new O(r("checkout-page:address"),t.step===s.INFO,t.step!==s.INFO,t.step!==s.INFO?o.createElement("div",{className:D.AdressStepInfo},o.createElement(X,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&o.createElement("div",{className:D.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==s.INFO?o.createElement("div",{className:D.AddressStepInfoMobile},o.createElement(X,{vm:t})):void 0),new O(r("checkout-page:payment"),t.step===s.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new O(r("checkout-page:shipping"),t.step===s.SHIPPING,t.step===s.PAYMENT,t.step===s.PAYMENT?o.createElement("div",{className:D.AdressStepInfo},o.createElement(K,{vm:t}),!(t.isUpsellOrder||t.isOpenEditOrderWithTransaction)&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:D.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===s.PAYMENT?o.createElement("div",{className:D.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(N,{steps:n,stepContent:i})})),X=r((function(e){var t,r,i,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===(r=p.checkout.billingAddress)||void 0===r?void 0:r.lastName)||""):((null===(i=p.checkout.shippingAddress)||void 0===i?void 0:i.firstName)||"")+" "+((null===(n=p.checkout.shippingAddress)||void 0===n?void 0:n.lastName)||"");return o.createElement("div",{className:D.Address},o.createElement("div",{className:[D.Text,D.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:D.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:D.Text},u("checkout-page:receiver")),o.createElement("div",{className:[D.Text,D.Gray].join(" ")},f)),o.createElement("div",{className:[D.Text,D.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:[D.Text,D.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[D.Text,D.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))})),K=r((function(e){var t=e.vm,r=m().t;return o.createElement("div",{className:D.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:D.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?r("checkout-page:free"):l(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):r("checkout-page:standartShipping"))})),J=r((function(e){var t=e.vm,r=m().t;return o.createElement("div",{className:D.Footer},o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:imprint"),t.policyModalText=t.imprint}},r("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:D.FooterBullet},"•"),o.createElement("div",{className:D.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},r("checkout-page:shippingPolicy"))))})),Q=r((function(r){var i,n,a,s=r.vm,c=r.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===(i=s.checkout.customer)||void 0===i?void 0:i.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(M,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(F,{name:"message",type:T.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(w,{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)}})})),Z=r((function(e){var t=e.vm,r=_(t),i=r.setActiveIndex,n=r.handlePrev,a=r.handleNext,s=r.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:D.CampaignOfferMain},o.createElement("div",{className:D.OfferSlider},t.campaignOffers.map((function(e,r){var c;return o.createElement(A,{vm:t,campaignOffer:e,index:r,activeIndex:s,offersLength:(null===(c=t.campaignOffers)||void 0===c?void 0:c.length)||0,handlePrev:n,handleNext:a,setActiveIndex:function(e){return i(e)},desktopMiddlePhase:!0,step:t.step})}))),t.campaignOffers.length>1&&o.createElement(z,{handlePrev:n,handleNext:a}),t.campaignOffers.length>1&&o.createElement(R,{vm:t,activeIndex:s})):null})),$=r((function(e){var t=e.vm,r=_(t),i=r.setActiveIndex,n=r.setIsActiveOverlay,a=r.handlePrev,s=r.handleNext,c=r.isPopupClosedIndexPage,l=r.isPopupShowIndexPage,m=r.activeIndex;return t.campaignOffers&&t.campaignOffers.length&&t.isCampaignOfferLoaded?o.createElement("div",{className:[D.CampaignOfferMain,l?D.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:D.OfferSlider},t.campaignOffers.map((function(e,r){var d;return o.createElement(A,{vm:t,campaignOffer:e,index:r,activeIndex:m,offersLength:(null===(d=t.campaignOffers)||void 0===d?void 0:d.length)||0,handlePrev:a,handleNext:s,setActiveIndex:function(e){return i(e)},step:t.step,isPopupClosed:c,isPopupShow:l,closePopup:function(){return n(!1)},showPopup:function(){return n(!0)}})}))),t.campaignOffers.length>1&&o.createElement(z,{handlePrev:a,handleNext:s}),t.campaignOffers.length>1&&o.createElement(R,{isPopupShow:l,vm:t,activeIndex:m})):null}));export{W as default};
|
|
@@ -79,6 +79,7 @@ export default class CheckoutViewModel {
|
|
|
79
79
|
constructor(checkout: IkasCheckout, checkoutSettings: IkasCheckoutSettings, router: NextRouter, returnPolicy: string, privacyPolicy: string, termsOfService: string, imprint: string, shippingPolicy: string, t: TFunction, customizationProps: IkasCheckoutCustomizationProps);
|
|
80
80
|
init: () => Promise<void>;
|
|
81
81
|
initStep: () => Promise<void>;
|
|
82
|
+
getOpenEditOrderTransaction: () => Promise<void>;
|
|
82
83
|
getSuccessTransaction: () => Promise<void>;
|
|
83
84
|
get merchantSettings(): IkasMerchantSettings;
|
|
84
85
|
get selectedPaymentGatewayIndex(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";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{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasCorporateInvoiceRequirement as d,IkasPaymentMethodType as u,IkasPaymentGatewayType as l,IkasOrderShippingMethod as h,IkasOrderStatus as p,IkasOrderPaymentStatus as m,IkasTransactionStatus as g,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as v,IkasOrderLineItemStatus as y,IkasAmountType as S,IkasCampaignOfferProductApplicablePriceEnum as b}from"@ikas/storefront-models";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{IkasCheckout as k}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as P}from"../../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{IkasCustomerAddress as A}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as C}from"../../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{IkasMerchantSettings as I}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as O}from"../../models/data/order/customer/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{IkasProductPrice as w}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as E}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as R}from"../../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-filter/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{LocalizedAddressModel as N}from"@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 T from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import D from"../../store/checkout/index.js";import M from"../../store/cart/api.js";import L,{MFS_ELEMENT_ID as G,MFS_SCRIPT_URL as x}from"./modelMasterPass.js";import _ from"../../store/product/index.js";import{TransactionCardAssociationEnum as U,SaveCartInput as V,CheckStocksLineInput as F,CampaignOfferTargetPageTypeEnum as B}from"@ikas/storefront-api";import{IkasBaseStore as H}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as K}from"@ikas/storefront-config";import{Analytics as Y}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Z from"../../models/data/order/address/ikas-localized-order-address.js";import W from"../../store/location/index.js";import{isEqual as q,getCookieValue as Q}from"../../utils/helper.js";import z from"../../analytics/ikasV3.js";var X,J,$=/^\d+$/,ee="undefined"==typeof localStorage,te=function(){function $(a,d,p,C,I,$,te,ne,re,oe){var ae=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isPaymentMethodVisible=!0,this.step=X.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.hepsipayFrameInitResponse=null,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.storeCreditBalance=null,this.showTestModal=!1,this.openEditOrderTransaction=null,this.init=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return e.sent(),[4,H.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 3:return e.sent(),[2]}}))}))},this.initStep=function(){return e(ae,void 0,void 0,(function(){var e,s,n,r,o,a,d,u;return t(this,(function(t){switch(t.label){case 0:if(K.getIsEditor())return this.step=X.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===X.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(X.INFO)];if(this.step!==X.PAYMENT||this.canProceedToPayment){if(this.step===X.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(X.INFO)];if(![X.INFO,X.SUCCESS,X.SHIPPING,X.PAYMENT].includes(this.step))return[2,this.changeStep(X.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings||this.isManualOrderWithoutShippingLines?[2,this.changeStep(X.INFO)]:[2,this.changeStep(X.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),this.step!==X.SHIPPING&&this.step!==X.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new P(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==X.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==X.SHIPPING||1!==(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=X.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==X.SHIPPING||(null===(u=this.checkout.availableShippingMethods)||void 0===u?void 0:u.length)?this.step!==X.SUCCESS||this.checkout.orderPaymentStatus!==m.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:J.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==X.PAYMENT&&this.step!==X.SUCCESS?[3,15]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.checkout.hasCustomer?[4,this.getStoreCreditBalance()]:[3,12];case 11:t.sent(),t.label=12;case 12:return this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,14];case 13:t.sent(),t.label=14;case 14:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:J.NO_SHIPPING_ERROR},this.isMinTransactionError&&(this.error={type:J.API_ERROR,data:this.t("checkout-page:minTransactionErrorMessage",{value:200})}),this.isCheckoutLoaded=!0,[2];t.label=15;case 15:return this.step===X.SUCCESS?[3,21]:this.isOpenEditOrder?[4,j.listOrderTransactionsWithPrices({input:{orderId:this.checkout.id}})]:[3,17];case 16:return(o=t.sent()).isSuccess&&o.data&&o.data.chargedAmount&&(this.openEditOrderTransaction=o.data),[3,20];case 17:return this.checkout.isComplete?[2,this.changeStep(X.SUCCESS)]:[3,18];case 18:return[4,this.initialStockCheck()];case 19:t.sent(),t.label=20;case 20:return[3,23];case 21:return[4,this.getSuccessTransaction()];case 22:t.sent(),this.successTransaction&&(a=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===a}))),t.label=23;case 23:return n&&(this.error={type:J.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,Y.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getSuccessTransaction=function(){return e(ae,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransactions=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data:[],this.successTransaction=e.isSuccess&&(null===(s=e.data)||void 0===s?void 0:s.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,a,c,d,u;return t(this,(function(t){switch(t.label){case 0:return e=new V(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=t.sent(),t.label=2;case 2:return this.step!==X.INFO&&this.step!==X.SHIPPING||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||(e.billingAddress=null),this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress&&e.billingAddress&&(e.billingAddress.company=(null===(n=e.shippingAddress)||void 0===n?void 0:n.company)||null,e.billingAddress.taxNumber=(null===(r=e.shippingAddress)||void 0===r?void 0:r.taxNumber)||null,e.billingAddress.taxOffice=(null===(a=e.shippingAddress)||void 0===a?void 0:a.taxOffice)||null)),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,M.saveCart({input:e})];case 3:if((null==(i=t.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(c=s.extensions)||void 0===c?void 0:c.code)?{type:J.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(d=s.extensions)||void 0===d?void 0:d.code)?{type:J.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(u=s.extensions)||void 0===u?void 0:u.code)?{type:J.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:J.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(ae,void 0,void 0,(function(){var e,s,n=this;return t(this,(function(t){return e=i,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&e.shippingAddress&&s.address&&(e.shippingAddress.country=s.address.country,e.shippingAddress.city=s.address.city,e.shippingAddress.state=s.address.state,e.shippingAddress.district=s.address.district,e.shippingAddress.postalCode=s.address.postalCode,e.shippingAddress.addressLine1=s.address.address||"",e.shippingAddress.addressLine2=null),[2,e]}))}))},this.checkStocks=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p,m,g;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===h.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(p=K.getStockLocationIds())||void 0===p?void 0:p.length)?K.getStockLocationIds():null,[4,D.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw s="UPSELL"===this.checkout.createdBy,n=s?this.t("checkout-page:upsellTimeErrorMessage"):i.firstErrorMessage,{type:J.API_ERROR,data:n};if(null==(r=null===(g=null===(m=i.data)||void 0===m?void 0:m.lines)||void 0===g?void 0:g.filter((function(e){return!e.isAvailable})))?void 0:r.length){for(o=[],a=function(e){var t=c.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&o.push({item:t,stockCount:e.stockCount})},c=this,d=0,u=r;d<u.length;d++)l=u[d],a(l);throw{type:J.STOCK_ERROR,data:o}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,H.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getAvailableShippingCountries({salesChannelId:K.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(ae,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return K.getPickupStockLocationIds()?[4,D.listStockLocation({id:{in:K.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=t.sent()).isSuccess||!(null===(i=e.data)||void 0===i?void 0:i.length))return this.error={type:J.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return K.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,D.getAvailableStockLocations({lines:e.map((function(e){return new F(e)})),stockLocationIdList:K.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:J.API_ERROR},[2];s=K.getCurrentRouting(),this.availableStockLocations=(i.data||[]).filter((function(e){var t,i,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(r=n.shippingCountryIds)||void 0===r?void 0:r.includes(e.address.country.id))&&(!(null===(o=null==s?void 0:s.countryCodes)||void 0===o?void 0:o.length)||s.countryCodes.includes(e.address.country.iso2))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=ae.shippingCountryIds)||void 0===e?void 0:e.length)||(ae.error={type:J.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;ae.deliveryMethod!==e&&("address"===e&&(ae.checkout.stockLocationId=null,(null===(t=ae.customerAddresses)||void 0===t?void 0:t.length)?ae.onSelectedShippingAddressIdChange(ae.customerAddresses[0].id||"-1"):(ae.checkout.shippingAddress=new Z,ae.checkout.shippingAddress.countrySettings=ae.countrySettings,ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones)),ae.deliveryMethod=e,ae.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return t.sent(),[3,3];case 2:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.getStoreCreditBalance=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getStoreCreditBalance()];case 1:return e=t.sent(),this.storeCreditBalance=e.data,[2]}}))}))},this.listPaymentGateways=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,g,f,v=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=K.getPaymentGateways().map((function(e){return e.id})),[4,D.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:K.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess?(null===(p=s.data)||void 0===p?void 0:p.length)||this.isFree?(this.error=void 0,n=null===(m=s.data)||void 0===m?void 0:m.some((function(e){return"IKAS_WALLET"===e.code})),this.isMinTransactionError=n&&this.finalPrice<200&&!this.isDigitalOnly,this.isMinTransactionError?[2]:(o=s.data||[],this.step===X.PAYMENT&&(o=o.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(v.checkout.currencyCode)})),(a=null===(g=this.checkout.shippingAddress)||void 0===g?void 0:g.country)&&a.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")}))),c=null===(f=this.checkout.billingAddress)||void 0===f?void 0:f.country,!a&&c&&c.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(c.iso2||"")})))),d=[],r(K.getPaymentGateways(),"order").forEach((function(e){var t=null==o?void 0:o.find((function(t){return t.id===e.id}));t&&d.push(t)})),this.paymentGateways=e?o:d,u=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code})),this.checkout.selectedPaymentGateway&&this.paymentGateways.some((function(e){var t;return e.id===(null===(t=v.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==u?u:0),[3,4]))):(this.error={type:J.NO_SHIPPING_ERROR},[2]):(this.error={type:J.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==X.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===X.PAYMENT&&(l=o.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=l,(h=document.createElement("script")).id=G,h.src=x,h.onload=function(){v.mpVM.checkMasterPass({checkout:v.checkout,store:H.getInstance()})},document.head.appendChild(h)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,D.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var e;ae.store.customerStore.customer?(null===(e=ae.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=ae.checkoutSettings,e.shippingZones=ae.shippingZones})),ae.checkout.customer=new O(i(i({},ae.store.customerStore.customer),{notificationsAccepted:ae.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):ae.checkout.customer=new O(ae.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ae.checkout.shippingAddress&&(ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones,ae.checkout.shippingAddress.countrySettings=ae.countrySettings,ae.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){ae.checkout.billingAddress&&(ae.checkout.billingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.billingAddress.shippingZones=ae.shippingZones,ae.checkout.billingAddress.countrySettings=ae.countrySettings,ae.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!ae.isDigitalOnly)if(ae.isInStoreDelivery)ae.setCheckoutShippingAddressSettings();else if(ae.checkout.shippingAddress){if(ae.store.customerStore.customer){var e=null==(t=ae.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ae.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return ae.onSelectedShippingAddressIdChange(e.id||"-1"),void ae.setCheckoutShippingAddressSettings()}ae.checkout.shippingAddress=new Z(n(ae.checkout.shippingAddress)||{}),ae.setCheckoutShippingAddressSettings()}else if(ae.store.customerStore.customer){var t=ae.customerAddresses;ae.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else ae.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ae.useDifferentAddress=!!localStorage.getItem("sAddr"),ae.checkout.billingAddress){if(ae.store.customerStore.customer){var e=null==(t=ae.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ae.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return ae.onSelectedBillingAddressIdChange(e.id||"-1"),void ae.setCheckoutBillingAddressSettings()}ae.checkout.billingAddress=new Z(n(ae.checkout.billingAddress)||{}),ae.setCheckoutBillingAddressSettings()}else if(ae.store.customerStore.customer){var t=ae.customerAddresses;ae.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||ae.useDifferentAddress||!ae.checkout.shippingAddress||ae.isInStoreDelivery||(ae.checkout.billingAddress=new Z(n(ae.checkout.shippingAddress)),ae.setCheckoutBillingAddressSettings())}else ae.onSelectedBillingAddressIdChange("-1"),ae.useDifferentAddress||!ae.checkout.shippingAddress||ae.isInStoreDelivery||(ae.checkout.billingAddress=new Z(n(ae.checkout.shippingAddress)),ae.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCart()]);case 1:return(e=t.sent())&&(this.checkout=new k(e,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(ae,void 0,void 0,(function(){var e,s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,M.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(e=t.sent()).isSuccess&&e.data?(s=e.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===X.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return s?(r=this.checkout,this.checkout=new k(i(i({},s),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=s.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(ae,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,M.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===X.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,W.getAvailableShippingZones({salesChannelId:K.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingZones=e.data||null,[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(e){var t;if(ae.selectedShippingAddressId=e,"-1"===e)ae.checkout.shippingAddress=new Z,ae.checkout.shippingAddress.countrySettings=ae.countrySettings;else{var i=null===(t=ae.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ae.checkout.shippingAddress=new Z(i),ae.checkout.shippingAddress.countrySettings=ae.countrySettings)}ae.checkout.shippingAddress&&(ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(ae.selectedBillingAddressId=e,"-1"===e)ae.checkout.billingAddress=new Z,ae.checkout.billingAddress.countrySettings=ae.countrySettings;else{var i=null===(t=ae.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ae.checkout.billingAddress=new Z(i),ae.checkout.billingAddress.countrySettings=ae.countrySettings)}ae.checkout.billingAddress&&(ae.checkout.billingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.billingAddress.shippingZones=ae.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){ae.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(ae.cardData&&(!(e.length>ae.cardData.cardNumber.length)||se(e))){var i=(ae.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!ae.installmentInfo?ae.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(ae.cardData.installmentCount=1,ae.installmentInfo=void 0),(null===(t=ae.installmentInfo)||void 0===t?void 0:t.cardAssociation)===U.AMERICAN_EXPRESS?ae.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(s).join(" "):ae.cardData.cardNumber=ie(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){ae.cardData&&(ae.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(ae.cardData&&(!(e.length>ae.cardData.expirationDate.length)||se(e))){if(0===(null===(t=ae.cardData.expirationDate)||void 0===t?void 0:t.length)){var i=e.replace(".","/").split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(ae.cardData.expirationDate=ie(d,2).join(" / "))}},this.onCvcChange=function(e){if(ae.cardData&&(!(e.length>ae.cardData.cvv.length)||se(e))){if(ae.installmentInfo){if(ae.installmentInfo.cardAssociation===U.AMERICAN_EXPRESS&&e.length>4)return;if(ae.installmentInfo.cardAssociation!==U.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;ae.cardData.cvv=e}},this.saveAddress=function(s){return e(ae,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,g,f=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new A(i(i({},e),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=f.checkoutSettings,e.shippingZones=f.shippingZones})),c=null===(g=this.customerAddresses)||void 0===g?void 0:g.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.getRoutingPath=function(){var e=K.getCurrentRouting();return(null==e?void 0:e.path)?"/".concat(e.path):""},this.getGoToCartHref=function(){var e=ae.getRoutingPath();return"".concat(e,"/cart")},this.getBackToShoppingHref=function(){var e=ae.getRoutingPath();return"".concat(e,"/")},this.getGoToLoginHref=function(){var e=ae.getRoutingPath();return"".concat(e)+"/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)},this.onHandleBillingAddressOnShippingStep=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new Z(i({},this.checkout.shippingAddress)):this.checkout.billingAddress=new Z(i({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,10,,11]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,5]:[4,this.saveAddress("shipping")];case 4:t.sent(),t.label=5;case 5:return this.isShowBillingAddressOnShippingStep?[4,this.saveAddress("billing")]:[3,7];case 6:t.sent(),t.label=7;case 7:return[4,this.checkStocks()];case 8:return t.sent(),[4,this.saveCart()];case 9:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(X.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(X.SHIPPING):this.changeStep(X.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,6,,7]),this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.changeStep(X.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return t.sent(),[4,this.saveCart()];case 3:return t.sent(),this.error=void 0,this.changeStep(X.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ae.canPerformPayment||(ae.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){ae.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c;return t(this,(function(t){switch(t.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];t.label=3;case 3:return t.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(o=this.hepsipayFrameInitResponse)||void 0===o?void 0:o.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return t.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),t.label=6;case 6:return[3,8];case 7:return t.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return t.trys.push([9,15,,16]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,12];case 11:t.sent(),t.label=12;case 12:return[4,this.saveCart()];case 13:return e=t.sent(),this.checkout.shippingMethod===h.SHIPMENT&&(i=null!==(a=null==e?void 0:e.availableShippingMethods)&&void 0!==a?a:[],s=null!==(c=this.checkout.availableShippingMethods)&&void 0!==c?c:[],!q(i,s))?(this.changeStep(X.SHIPPING),[2]):!this.isFree&&this.isCustomFlowStripe?((n=document.querySelector("#stripe-form-btn"))&&n.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 14:return t.sent(),[3,16];case 15:return void 0!==typeof(r=t.sent()).type?this.error=r:this.error={type:J.UNKNOWN},this.isStepLoading=!1,[3,16];case 16:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];t.label=3;case 3:return t.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(s=this.hepsipayFrameInitResponse)||void 0===s?void 0:s.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return t.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),t.label=6;case 6:return[3,8];case 7:return t.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return t.trys.push([9,13,,14]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return t.sent(),[4,this.saveCart()];case 11:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 12:return t.sent(),[3,14];case 13:return(i=t.sent()).type?this.error=i:this.error={type:J.UNKNOWN},this.isStepLoading=!1,[3,14];case 14:return[2]}}))}))},this.createSaleTransaction=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,m,f,v,y,S,b,k,P,A,C,I;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,D.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:Q("_fbp"),_fbc:Q("_fbc"),_ga:Q("_ga")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,D.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(v=this.mpVM.selectedCard)||void 0===v?void 0:v.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(y=this.checkout.selectedPaymentGateway)||void 0===y?void 0:y.id,paymentMethodDetail:this.isFree||i?void 0:(null===(S=this.checkout.selectedPaymentGateway)||void 0===S?void 0:S.paymentMethodType)===u.CREDIT_CARD&&(null===(b=this.checkout.selectedPaymentGateway)||void 0===b?void 0:b.type)===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Q("_fbp"),_fbc:Q("_fbc"),_ga:Q("_ga")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(k=null==s?void 0:s.data)||void 0===k?void 0:k.transactionStatus,o=r&&[g.SUCCESS,g.AUTHORIZED].includes(r),a=r===g.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(A=null==s?void 0:s.data)||void 0===A?void 0:A.returnSlug))throw c=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(I=null===(C=s.data)||void 0===C?void 0:C.error)||void 0===I?void 0:I.code)&&(c=this.t("checkout-page:errorContactStore")),{data:c,type:J.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(ae,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return z.refreshJourneyId(),this.changeStep(X.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){ae.changeStep(X.INFO)},this.onBackToShippingClick=function(){ae.changeStep(X.SHIPPING)},this.setCustomerConsentGranted=function(e){ae.checkout.customer&&(ae.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e,t){var s;ae.useDifferentAddress=e,ae.useDifferentAddress?(localStorage.setItem("sAddr","1"),ae.checkout.billingAddress=ae.checkout.billingAddress||new Z,ae.checkout.billingAddress.countrySettings=ae.countrySettings):(localStorage.removeItem("sAddr"),ae.checkout.billingAddress=new Z(i({},ae.checkout.shippingAddress)),ae.store.customerStore.customer&&(null===(s=ae.customerAddresses)||void 0===s?void 0:s.length)&&t&&ae.isShowBillingAddressOnShippingStep&&ae.onSelectedBillingAddressIdChange(ae.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){ae.shouldSaveAddress=e},this.setAddressTitle=function(e){ae.addressTitle=e},this.reInitPaymentMethod=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,8];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return this.isHepsiPay?[4,this.hepsipayFrameInit(this.checkout.selectedPaymentGateway)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[2]}}))}))},this.createStripePaymentIntent=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:J.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:J.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.hepsipayFrameInit=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.hepsipayFrameInitResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(ae,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?(e=this.paymentGateways[i],s=!0,this.step!==X.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==e.code?[3,2]:[4,this.updatePaymentGateway(e)]):[2];case 1:s=t.sent(),t.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(e)];case 4:return s=t.sent(),[3,7];case 5:return"CUSTOM"!==e.code?[3,7]:[4,this.updatePaymentGateway(e)];case 6:s=t.sent(),t.label=7;case 7:return s?"STRIPE"!==e.code&&"STRIPE_EU"!==e.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(e)]:[2];case 8:t.sent(),t.label=9;case 9:return"KLARNA"!==e.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(e)];case 10:t.sent(),t.label=11;case 11:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 12:t.sent(),t.label=13;case 13:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(e)];case 14:t.sent(),t.label=15;case 15:return"HEPSIPAY"!==e.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(e)];case 16:t.sent(),t.label=17;case 17:return this.checkout.selectedPaymentGateway=e,this.step!==X.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new T,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(ae,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,M.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id,targetPageType:B.CHECKOUT})];case 1:return(e=t.sent()).isSuccess?((n=e.data)&&(r=this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),this.isPaymentMethodVisible=!0,[2,!0]):(this.isPaymentMethodVisible=!0,[2,!1])}}))}))},this.setInstallmentCount=function(e){ae.cardData&&(ae.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return ee||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return e.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(e){ae.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(ae,void 0,void 0,(function(){var r,o,a=this;return t(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===f.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,_.searchProducts({input:{productIdList:n,priceListId:K.getPriceListId(),salesChannelId:K.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){if(!e.discountAmount)return t;var s=!1;return e.discountType===S.AMOUNT&&(s=!0),new E(i(i({},t),{prices:t.prices.map((function(t){var n=t.finalPrice,r=t.finalPrice-(s?e.discountAmount:t.finalPrice*e.discountAmount/100);return e.applicablePrice===b.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new w(i(i({},t),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new R(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===X.SUCCESS?v.POST_CHECKOUT:v.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,M.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===X.SUCCESS?X.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(ae,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(t){switch(t.label){case 0:return this.checkout.customer?(e=this.checkout.customer,s=e.firstName,n=e.lastName,r=e.email,s&&n&&r?[4,j.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(ae,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==y.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,D.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(ae,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,D.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=d,this.router=p,this.returnPolicy=C,this.privacyPolicy=I,this.termsOfService=$,this.imprint=te,this.shippingPolicy=ne,this.t=re,this.customizationProps=oe,this.mpVM=new L,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new N({currentLocale:K.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty($.prototype,"merchantSettings",{get:function(){return new I(K.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"selectedPaymentGatewayIndex",{get:function(){var e=this;return this.paymentGateways.findIndex((function(t){var i;return t.id===(null===(i=e.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"selectedInstallmentIndex",{get:function(){var e,t,i=this;return(null===(t=null===(e=this.installmentInfo)||void 0===e?void 0:e.installmentPrices)||void 0===t?void 0:t.findIndex((function(e){var t;return e.installmentCount===(null===(t=i.cardData)||void 0===t?void 0:t.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=H.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"installmentPrice",{get:function(){var e,t,i,s=this;if(this.installmentInfo&&(null===(e=this.cardData)||void 0===e?void 0:e.installmentCount))return null===(i=null===(t=this.installmentInfo.installmentPrices)||void 0===t?void 0:t.find((function(e){var t;return e.installmentCount===(null===(t=s.cardData)||void 0===t?void 0:t.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice){var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e-=(t.chargedAmount||0)+(t.pendingAmount||0)+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice-e}},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"finalPrice",{get:function(){if(this.step===X.SUCCESS)return this.checkout.totalFinalPrice-this.giftCardTotalPrice;var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e-=(t.chargedAmount||0)+(t.pendingAmount||0)+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice?this.installmentPrice:e},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===J.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly||this.isShowBillingAddressOnShippingStep?null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress:null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValidAddress)&&(this.checkout.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==J.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canProceedToInStoreDelivery",{get:function(){var e,t,i;return!!((null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.firstName)&&(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)&&(!this.isShowBillingAddressOnShippingStep||this.canProceedToShipping)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrderWithoutShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&!(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"klarnaPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"payPalPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hepsiPayPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"store",{get:function(){return H.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canPerformPayment",{get:function(){var e,t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress),r=!!this.isFree||(!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===u.CREDIT_CARD&&i.type===l.INTERNAL?!!this.isCustomFlowStripe||(!!(this.isKlarna||this.isPayPal||this.isHepsiPay)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=K.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(e){var t=new C(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isOpenEditOrder",{get:function(){return this.checkout.status===p.OPEN&&!!this.checkout.orderNumber},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isOpenEditOrderWithTransaction",{get:function(){var e,t;return this.checkout.status===p.OPEN&&!!this.checkout.orderNumber&&!!(null===(e=this.openEditOrderTransaction)||void 0===e?void 0:e.chargedAmount)&&(null===(t=this.openEditOrderTransaction)||void 0===t?void 0:t.chargedAmount)>0},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isEPayKolayEnabled",{get:function(){var e=K.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPoweredByHidden",{get:function(){var e=K.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),$.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},$}();function ie(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function se(e){return e&&$.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(X||(X={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR",e[e.ARGUMENT_VALIDATION_ERROR=7]="ARGUMENT_VALIDATION_ERROR"}(J||(J={}));export{X as CheckoutStep,J as ErrorType,te as default};
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";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{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasCorporateInvoiceRequirement as d,IkasPaymentMethodType as u,IkasPaymentGatewayType as l,IkasOrderShippingMethod as h,IkasOrderStatus as p,IkasOrderPaymentStatus as m,IkasTransactionStatus as g,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as v,IkasOrderLineItemStatus as y,IkasAmountType as S,IkasCampaignOfferProductApplicablePriceEnum as b}from"@ikas/storefront-models";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{IkasCheckout as k}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as P}from"../../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{IkasCustomerAddress as A}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as C}from"../../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{IkasMerchantSettings as I}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as O}from"../../models/data/order/customer/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{IkasProductPrice as w}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as E}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as R}from"../../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-filter/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{LocalizedAddressModel as N}from"@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 T from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import D from"../../store/checkout/index.js";import M from"../../store/cart/api.js";import L,{MFS_ELEMENT_ID as G,MFS_SCRIPT_URL as x}from"./modelMasterPass.js";import _ from"../../store/product/index.js";import{TransactionCardAssociationEnum as U,SaveCartInput as V,CheckStocksLineInput as F,CampaignOfferTargetPageTypeEnum as B}from"@ikas/storefront-api";import{IkasBaseStore as H}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as K}from"@ikas/storefront-config";import{Analytics as Y}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Z from"../../models/data/order/address/ikas-localized-order-address.js";import W from"../../store/location/index.js";import{isEqual as q,getCookieValue as Q}from"../../utils/helper.js";import z from"../../analytics/ikasV3.js";var X,J,$=/^\d+$/,ee="undefined"==typeof localStorage,te=function(){function $(a,d,p,C,I,$,te,ne,re,oe){var ae=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isPaymentMethodVisible=!0,this.step=X.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.hepsipayFrameInitResponse=null,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.storeCreditBalance=null,this.showTestModal=!1,this.openEditOrderTransaction=null,this.init=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,H.getInstance().customerStore.waitUntilInitialized()];case 2:return t.sent(),(e=this.isOpenEditOrder||this.checkout.edited)?[4,this.getOpenEditOrderTransaction()]:[3,4];case 3:t.sent(),t.label=4;case 4:return e&&(this.openEditOrderTransaction||this.checkout.edited)||this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 5:return t.sent(),[2]}}))}))},this.initStep=function(){return e(ae,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(K.getIsEditor())return this.step=X.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===X.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(X.INFO)];if(this.step!==X.PAYMENT||this.canProceedToPayment){if(this.step===X.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(X.INFO)];if(![X.INFO,X.SUCCESS,X.SHIPPING,X.PAYMENT].includes(this.step))return[2,this.changeStep(X.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings||this.isManualOrderWithoutShippingLines?[2,this.changeStep(X.INFO)]:[2,this.changeStep(X.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),this.step!==X.SHIPPING&&this.step!==X.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new P(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==X.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==X.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=X.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==X.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==X.SUCCESS||this.checkout.orderPaymentStatus!==m.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:J.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==X.PAYMENT&&this.step!==X.SUCCESS?[3,15]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.checkout.hasCustomer?[4,this.getStoreCreditBalance()]:[3,12];case 11:t.sent(),t.label=12;case 12:return this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,14];case 13:t.sent(),t.label=14;case 14:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:J.NO_SHIPPING_ERROR},this.isMinTransactionError&&(this.error={type:J.API_ERROR,data:this.t("checkout-page:minTransactionErrorMessage",{value:200})}),this.isCheckoutLoaded=!0,[2];t.label=15;case 15:return this.step===X.SUCCESS?[3,19]:this.isOpenEditOrder?[3,18]:this.checkout.isComplete?[2,this.changeStep(X.SUCCESS)]:[3,16];case 16:return[4,this.initialStockCheck()];case 17:t.sent(),t.label=18;case 18:return[3,21];case 19:return[4,this.getSuccessTransaction()];case 20:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=21;case 21:return n&&(this.error={type:J.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,Y.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getOpenEditOrderTransaction=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactionsWithPrices({input:{orderId:this.checkout.id}})];case 1:return(e=t.sent()).isSuccess&&e.data&&e.data.chargedAmount&&(this.openEditOrderTransaction=e.data),[2]}}))}))},this.getSuccessTransaction=function(){return e(ae,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransactions=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data:[],this.successTransaction=e.isSuccess&&(null===(s=e.data)||void 0===s?void 0:s.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,a,c,d,u;return t(this,(function(t){switch(t.label){case 0:return e=new V(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=t.sent(),t.label=2;case 2:return this.step!==X.INFO&&this.step!==X.SHIPPING||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||(e.billingAddress=null),this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress&&e.billingAddress&&(e.billingAddress.company=(null===(n=e.shippingAddress)||void 0===n?void 0:n.company)||null,e.billingAddress.taxNumber=(null===(r=e.shippingAddress)||void 0===r?void 0:r.taxNumber)||null,e.billingAddress.taxOffice=(null===(a=e.shippingAddress)||void 0===a?void 0:a.taxOffice)||null)),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,M.saveCart({input:e})];case 3:if((null==(i=t.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(c=s.extensions)||void 0===c?void 0:c.code)?{type:J.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(d=s.extensions)||void 0===d?void 0:d.code)?{type:J.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(u=s.extensions)||void 0===u?void 0:u.code)?{type:J.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:J.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(ae,void 0,void 0,(function(){var e,s,n=this;return t(this,(function(t){return e=i,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&e.shippingAddress&&s.address&&(e.shippingAddress.country=s.address.country,e.shippingAddress.city=s.address.city,e.shippingAddress.state=s.address.state,e.shippingAddress.district=s.address.district,e.shippingAddress.postalCode=s.address.postalCode,e.shippingAddress.addressLine1=s.address.address||"",e.shippingAddress.addressLine2=null),[2,e]}))}))},this.checkStocks=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p,m,g;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===h.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(p=K.getStockLocationIds())||void 0===p?void 0:p.length)?K.getStockLocationIds():null,[4,D.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw s="UPSELL"===this.checkout.createdBy,n=s?this.t("checkout-page:upsellTimeErrorMessage"):i.firstErrorMessage,{type:J.API_ERROR,data:n};if(null==(r=null===(g=null===(m=i.data)||void 0===m?void 0:m.lines)||void 0===g?void 0:g.filter((function(e){return!e.isAvailable})))?void 0:r.length){for(o=[],a=function(e){var t=c.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&o.push({item:t,stockCount:e.stockCount})},c=this,d=0,u=r;d<u.length;d++)l=u[d],a(l);throw{type:J.STOCK_ERROR,data:o}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,H.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getAvailableShippingCountries({salesChannelId:K.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(ae,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return K.getPickupStockLocationIds()?[4,D.listStockLocation({id:{in:K.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=t.sent()).isSuccess||!(null===(i=e.data)||void 0===i?void 0:i.length))return this.error={type:J.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return K.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,D.getAvailableStockLocations({lines:e.map((function(e){return new F(e)})),stockLocationIdList:K.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:J.API_ERROR},[2];s=K.getCurrentRouting(),this.availableStockLocations=(i.data||[]).filter((function(e){var t,i,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(r=n.shippingCountryIds)||void 0===r?void 0:r.includes(e.address.country.id))&&(!(null===(o=null==s?void 0:s.countryCodes)||void 0===o?void 0:o.length)||s.countryCodes.includes(e.address.country.iso2))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=ae.shippingCountryIds)||void 0===e?void 0:e.length)||(ae.error={type:J.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;ae.deliveryMethod!==e&&("address"===e&&(ae.checkout.stockLocationId=null,(null===(t=ae.customerAddresses)||void 0===t?void 0:t.length)?ae.onSelectedShippingAddressIdChange(ae.customerAddresses[0].id||"-1"):(ae.checkout.shippingAddress=new Z,ae.checkout.shippingAddress.countrySettings=ae.countrySettings,ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones)),ae.deliveryMethod=e,ae.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return t.sent(),[3,3];case 2:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.getStoreCreditBalance=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getStoreCreditBalance()];case 1:return e=t.sent(),this.storeCreditBalance=e.data,[2]}}))}))},this.listPaymentGateways=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,g,f,v=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=K.getPaymentGateways().map((function(e){return e.id})),[4,D.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:K.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess?(null===(p=s.data)||void 0===p?void 0:p.length)||this.isFree?(this.error=void 0,n=null===(m=s.data)||void 0===m?void 0:m.some((function(e){return"IKAS_WALLET"===e.code})),this.isMinTransactionError=n&&this.finalPrice<200&&!this.isDigitalOnly,this.isMinTransactionError?[2]:(o=s.data||[],this.step===X.PAYMENT&&(o=o.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(v.checkout.currencyCode)})),(a=null===(g=this.checkout.shippingAddress)||void 0===g?void 0:g.country)&&a.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")}))),c=null===(f=this.checkout.billingAddress)||void 0===f?void 0:f.country,!a&&c&&c.iso2&&(o=o.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(c.iso2||"")})))),d=[],r(K.getPaymentGateways(),"order").forEach((function(e){var t=null==o?void 0:o.find((function(t){return t.id===e.id}));t&&d.push(t)})),this.paymentGateways=e?o:d,u=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code})),this.checkout.selectedPaymentGateway&&this.paymentGateways.some((function(e){var t;return e.id===(null===(t=v.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==u?u:0),[3,4]))):(this.error={type:J.NO_SHIPPING_ERROR},[2]):(this.error={type:J.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==X.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===X.PAYMENT&&(l=o.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=l,(h=document.createElement("script")).id=G,h.src=x,h.onload=function(){v.mpVM.checkMasterPass({checkout:v.checkout,store:H.getInstance()})},document.head.appendChild(h)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,D.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var e;ae.store.customerStore.customer?(null===(e=ae.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=ae.checkoutSettings,e.shippingZones=ae.shippingZones})),ae.checkout.customer=new O(i(i({},ae.store.customerStore.customer),{notificationsAccepted:ae.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):ae.checkout.customer=new O(ae.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ae.checkout.shippingAddress&&(ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones,ae.checkout.shippingAddress.countrySettings=ae.countrySettings,ae.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){ae.checkout.billingAddress&&(ae.checkout.billingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.billingAddress.shippingZones=ae.shippingZones,ae.checkout.billingAddress.countrySettings=ae.countrySettings,ae.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!ae.isDigitalOnly)if(ae.isInStoreDelivery)ae.setCheckoutShippingAddressSettings();else if(ae.checkout.shippingAddress){if(ae.store.customerStore.customer){var e=null==(t=ae.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ae.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return ae.onSelectedShippingAddressIdChange(e.id||"-1"),void ae.setCheckoutShippingAddressSettings()}ae.checkout.shippingAddress=new Z(n(ae.checkout.shippingAddress)||{}),ae.setCheckoutShippingAddressSettings()}else if(ae.store.customerStore.customer){var t=ae.customerAddresses;ae.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else ae.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ae.useDifferentAddress=!!localStorage.getItem("sAddr"),ae.checkout.billingAddress){if(ae.store.customerStore.customer){var e=null==(t=ae.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ae.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return ae.onSelectedBillingAddressIdChange(e.id||"-1"),void ae.setCheckoutBillingAddressSettings()}ae.checkout.billingAddress=new Z(n(ae.checkout.billingAddress)||{}),ae.setCheckoutBillingAddressSettings()}else if(ae.store.customerStore.customer){var t=ae.customerAddresses;ae.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||ae.useDifferentAddress||!ae.checkout.shippingAddress||ae.isInStoreDelivery||(ae.checkout.billingAddress=new Z(n(ae.checkout.shippingAddress)),ae.setCheckoutBillingAddressSettings())}else ae.onSelectedBillingAddressIdChange("-1"),ae.useDifferentAddress||!ae.checkout.shippingAddress||ae.isInStoreDelivery||(ae.checkout.billingAddress=new Z(n(ae.checkout.shippingAddress)),ae.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCart()]);case 1:return(e=t.sent())&&(this.checkout=new k(e,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(ae,void 0,void 0,(function(){var e,s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,M.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(e=t.sent()).isSuccess&&e.data?(s=e.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===X.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return s?(r=this.checkout,this.checkout=new k(i(i({},s),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=s.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(ae,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,M.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===X.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==X.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,W.getAvailableShippingZones({salesChannelId:K.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingZones=e.data||null,[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(e){var t;if(ae.selectedShippingAddressId=e,"-1"===e)ae.checkout.shippingAddress=new Z,ae.checkout.shippingAddress.countrySettings=ae.countrySettings;else{var i=null===(t=ae.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ae.checkout.shippingAddress=new Z(i),ae.checkout.shippingAddress.countrySettings=ae.countrySettings)}ae.checkout.shippingAddress&&(ae.checkout.shippingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.shippingAddress.shippingZones=ae.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(ae.selectedBillingAddressId=e,"-1"===e)ae.checkout.billingAddress=new Z,ae.checkout.billingAddress.countrySettings=ae.countrySettings;else{var i=null===(t=ae.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ae.checkout.billingAddress=new Z(i),ae.checkout.billingAddress.countrySettings=ae.countrySettings)}ae.checkout.billingAddress&&(ae.checkout.billingAddress.checkoutSettings=ae.checkoutSettings,ae.checkout.billingAddress.shippingZones=ae.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){ae.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(ae.cardData&&(!(e.length>ae.cardData.cardNumber.length)||se(e))){var i=(ae.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!ae.installmentInfo?ae.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(ae.cardData.installmentCount=1,ae.installmentInfo=void 0),(null===(t=ae.installmentInfo)||void 0===t?void 0:t.cardAssociation)===U.AMERICAN_EXPRESS?ae.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(s).join(" "):ae.cardData.cardNumber=ie(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){ae.cardData&&(ae.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(ae.cardData&&(!(e.length>ae.cardData.expirationDate.length)||se(e))){if(0===(null===(t=ae.cardData.expirationDate)||void 0===t?void 0:t.length)){var i=e.replace(".","/").split("/");if(2===i.length){var s=i[0].trim(),n=i[1].trim();if(4===s.length&&2===n.length){var r=parseInt(s.slice(2)),o=parseInt(n);if(!isNaN(r)&&!isNaN(o))return void(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&4===n.length){o=parseInt(s),r=parseInt(n.slice(2));if(!isNaN(r)&&!isNaN(o))return void(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(ae.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(ae.cardData.expirationDate=ie(d,2).join(" / "))}},this.onCvcChange=function(e){if(ae.cardData&&(!(e.length>ae.cardData.cvv.length)||se(e))){if(ae.installmentInfo){if(ae.installmentInfo.cardAssociation===U.AMERICAN_EXPRESS&&e.length>4)return;if(ae.installmentInfo.cardAssociation!==U.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;ae.cardData.cvv=e}},this.saveAddress=function(s){return e(ae,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,g,f=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new A(i(i({},e),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=f.checkoutSettings,e.shippingZones=f.shippingZones})),c=null===(g=this.customerAddresses)||void 0===g?void 0:g.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.getRoutingPath=function(){var e=K.getCurrentRouting();return(null==e?void 0:e.path)?"/".concat(e.path):""},this.getGoToCartHref=function(){var e=ae.getRoutingPath();return"".concat(e,"/cart")},this.getBackToShoppingHref=function(){var e=ae.getRoutingPath();return"".concat(e,"/")},this.getGoToLoginHref=function(){var e=ae.getRoutingPath();return"".concat(e)+"/account/login?redirect="+encodeURIComponent(ae.checkoutUrl)},this.onHandleBillingAddressOnShippingStep=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new Z(i({},this.checkout.shippingAddress)):this.checkout.billingAddress=new Z(i({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,10,,11]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,5]:[4,this.saveAddress("shipping")];case 4:t.sent(),t.label=5;case 5:return this.isShowBillingAddressOnShippingStep?[4,this.saveAddress("billing")]:[3,7];case 6:t.sent(),t.label=7;case 7:return[4,this.checkStocks()];case 8:return t.sent(),[4,this.saveCart()];case 9:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(X.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(X.SHIPPING):this.changeStep(X.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,6,,7]),this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.changeStep(X.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return t.sent(),[4,this.saveCart()];case 3:return t.sent(),this.error=void 0,this.changeStep(X.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:J.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ae.canPerformPayment||(ae.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){ae.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c;return t(this,(function(t){switch(t.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];t.label=3;case 3:return t.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(o=this.hepsipayFrameInitResponse)||void 0===o?void 0:o.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return t.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),t.label=6;case 6:return[3,8];case 7:return t.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return t.trys.push([9,15,,16]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,12];case 11:t.sent(),t.label=12;case 12:return[4,this.saveCart()];case 13:return e=t.sent(),this.checkout.shippingMethod===h.SHIPMENT&&(i=null!==(a=null==e?void 0:e.availableShippingMethods)&&void 0!==a?a:[],s=null!==(c=this.checkout.availableShippingMethods)&&void 0!==c?c:[],!q(i,s))?(this.changeStep(X.SHIPPING),[2]):!this.isFree&&this.isCustomFlowStripe?((n=document.querySelector("#stripe-form-btn"))&&n.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 14:return t.sent(),[3,16];case 15:return void 0!==typeof(r=t.sent()).type?this.error=r:this.error={type:J.UNKNOWN},this.isStepLoading=!1,[3,16];case 16:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(ae,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(this.isFree||!this.isHepsiPay)return[3,9];t.label=3;case 3:return t.trys.push([3,7,,8]),window.HepsipaySdk&&(null===(s=this.hepsipayFrameInitResponse)||void 0===s?void 0:s.frameUrl)?(this.isStepLoading=!0,[4,this.saveCart()]):[3,5];case 4:return t.sent(),window.HepsipaySdk.initPayment(),[3,6];case 5:console.error("HepsipaySdk is not available"),t.label=6;case 6:return[3,8];case 7:return t.sent(),this.isStepLoading=!1,[2];case 8:return[2];case 9:return t.trys.push([9,13,,14]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 10:return t.sent(),[4,this.saveCart()];case 11:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 12:return t.sent(),[3,14];case 13:return(i=t.sent()).type?this.error=i:this.error={type:J.UNKNOWN},this.isStepLoading=!1,[3,14];case 14:return[2]}}))}))},this.createSaleTransaction=function(){return e(ae,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,m,f,v,y,S,b,k,P,A,C,I;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,D.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:Q("_fbp"),_fbc:Q("_fbc"),_ga:Q("_ga")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,D.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(v=this.mpVM.selectedCard)||void 0===v?void 0:v.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(y=this.checkout.selectedPaymentGateway)||void 0===y?void 0:y.id,paymentMethodDetail:this.isFree||i?void 0:(null===(S=this.checkout.selectedPaymentGateway)||void 0===S?void 0:S.paymentMethodType)===u.CREDIT_CARD&&(null===(b=this.checkout.selectedPaymentGateway)||void 0===b?void 0:b.type)===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Q("_fbp"),_fbc:Q("_fbc"),_ga:Q("_ga")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(k=null==s?void 0:s.data)||void 0===k?void 0:k.transactionStatus,o=r&&[g.SUCCESS,g.AUTHORIZED].includes(r),a=r===g.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(A=null==s?void 0:s.data)||void 0===A?void 0:A.returnSlug))throw c=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(I=null===(C=s.data)||void 0===C?void 0:C.error)||void 0===I?void 0:I.code)&&(c=this.t("checkout-page:errorContactStore")),{data:c,type:J.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(ae,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return z.refreshJourneyId(),this.changeStep(X.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){ae.changeStep(X.INFO)},this.onBackToShippingClick=function(){ae.changeStep(X.SHIPPING)},this.setCustomerConsentGranted=function(e){ae.checkout.customer&&(ae.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e,t){var s;ae.useDifferentAddress=e,ae.useDifferentAddress?(localStorage.setItem("sAddr","1"),ae.checkout.billingAddress=ae.checkout.billingAddress||new Z,ae.checkout.billingAddress.countrySettings=ae.countrySettings):(localStorage.removeItem("sAddr"),ae.checkout.billingAddress=new Z(i({},ae.checkout.shippingAddress)),ae.store.customerStore.customer&&(null===(s=ae.customerAddresses)||void 0===s?void 0:s.length)&&t&&ae.isShowBillingAddressOnShippingStep&&ae.onSelectedBillingAddressIdChange(ae.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){ae.shouldSaveAddress=e},this.setAddressTitle=function(e){ae.addressTitle=e},this.reInitPaymentMethod=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,8];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return this.isHepsiPay?[4,this.hepsipayFrameInit(this.checkout.selectedPaymentGateway)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[2]}}))}))},this.createStripePaymentIntent=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:J.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:J.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.hepsipayFrameInit=function(i){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.hepsipayFrameInitResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(ae,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?(e=this.paymentGateways[i],s=!0,this.step!==X.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==e.code?[3,2]:[4,this.updatePaymentGateway(e)]):[2];case 1:s=t.sent(),t.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(e)];case 4:return s=t.sent(),[3,7];case 5:return"CUSTOM"!==e.code?[3,7]:[4,this.updatePaymentGateway(e)];case 6:s=t.sent(),t.label=7;case 7:return s?"STRIPE"!==e.code&&"STRIPE_EU"!==e.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(e)]:[2];case 8:t.sent(),t.label=9;case 9:return"KLARNA"!==e.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(e)];case 10:t.sent(),t.label=11;case 11:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 12:t.sent(),t.label=13;case 13:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(e)];case 14:t.sent(),t.label=15;case 15:return"HEPSIPAY"!==e.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(e)];case 16:t.sent(),t.label=17;case 17:return this.checkout.selectedPaymentGateway=e,this.step!==X.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new T,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(ae,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,M.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id,targetPageType:B.CHECKOUT})];case 1:return(e=t.sent()).isSuccess?((n=e.data)&&(r=this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),this.isPaymentMethodVisible=!0,[2,!0]):(this.isPaymentMethodVisible=!0,[2,!1])}}))}))},this.setInstallmentCount=function(e){ae.cardData&&(ae.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(ae,void 0,void 0,(function(){return t(this,(function(e){return ee||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(ae,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return e.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(e){ae.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(ae,void 0,void 0,(function(){var r,o,a=this;return t(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===f.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,_.searchProducts({input:{productIdList:n,priceListId:K.getPriceListId(),salesChannelId:K.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){if(!e.discountAmount)return t;var s=!1;return e.discountType===S.AMOUNT&&(s=!0),new E(i(i({},t),{prices:t.prices.map((function(t){var n=t.finalPrice,r=t.finalPrice-(s?e.discountAmount:t.finalPrice*e.discountAmount/100);return e.applicablePrice===b.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new w(i(i({},t),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new R(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return e(ae,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===X.SUCCESS?v.POST_CHECKOUT:v.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(ae,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,M.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===X.SUCCESS?X.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(ae,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(t){switch(t.label){case 0:return this.checkout.customer?(e=this.checkout.customer,s=e.firstName,n=e.lastName,r=e.email,s&&n&&r?[4,j.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(ae,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==y.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,D.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(ae,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,D.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=d,this.router=p,this.returnPolicy=C,this.privacyPolicy=I,this.termsOfService=$,this.imprint=te,this.shippingPolicy=ne,this.t=re,this.customizationProps=oe,this.mpVM=new L,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new N({currentLocale:K.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty($.prototype,"merchantSettings",{get:function(){return new I(K.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"selectedPaymentGatewayIndex",{get:function(){var e=this;return this.paymentGateways.findIndex((function(t){var i;return t.id===(null===(i=e.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"selectedInstallmentIndex",{get:function(){var e,t,i=this;return(null===(t=null===(e=this.installmentInfo)||void 0===e?void 0:e.installmentPrices)||void 0===t?void 0:t.findIndex((function(e){var t;return e.installmentCount===(null===(t=i.cardData)||void 0===t?void 0:t.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=H.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"installmentPrice",{get:function(){var e,t,i,s=this;if(this.installmentInfo&&(null===(e=this.cardData)||void 0===e?void 0:e.installmentCount))return null===(i=null===(t=this.installmentInfo.installmentPrices)||void 0===t?void 0:t.find((function(e){var t;return e.installmentCount===(null===(t=s.cardData)||void 0===t?void 0:t.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice){var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e-=(t.chargedAmount||0)+(t.pendingAmount||0)+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice-e}},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"finalPrice",{get:function(){if(this.step===X.SUCCESS)return this.checkout.totalFinalPrice-this.giftCardTotalPrice;var e=this.checkout.totalFinalPrice;if(this.isOpenEditOrderWithTransaction&&this.openEditOrderTransaction){var t=this.openEditOrderTransaction;e-=(t.chargedAmount||0)+(t.pendingAmount||0)+(t.refundedAmount||0)}else e-=this.giftCardTotalPrice;return this.installmentPrice?this.installmentPrice:e},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===J.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly||this.isShowBillingAddressOnShippingStep?null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress:null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValidAddress)&&(this.checkout.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==J.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canProceedToInStoreDelivery",{get:function(){var e,t,i;return!!((null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.firstName)&&(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)&&(!this.isShowBillingAddressOnShippingStep||this.canProceedToShipping)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrderWithoutShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&!(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"klarnaPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"payPalPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hepsiPayPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"store",{get:function(){return H.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"canPerformPayment",{get:function(){var e,t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress),r=!!this.isFree||(!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===u.CREDIT_CARD&&i.type===l.INTERNAL?!!this.isCustomFlowStripe||(!!(this.isKlarna||this.isPayPal||this.isHepsiPay)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=K.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(e){var t=new C(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isOpenEditOrder",{get:function(){return this.checkout.status===p.OPEN&&!!this.checkout.orderNumber},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isOpenEditOrderWithTransaction",{get:function(){var e,t;return this.checkout.status===p.OPEN&&!!this.checkout.orderNumber&&!!(null===(e=this.openEditOrderTransaction)||void 0===e?void 0:e.chargedAmount)&&(null===(t=this.openEditOrderTransaction)||void 0===t?void 0:t.chargedAmount)>0},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isEPayKolayEnabled",{get:function(){var e=K.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"isPoweredByHidden",{get:function(){var e=K.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),$.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},$}();function ie(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function se(e){return e&&$.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(X||(X={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR",e[e.ARGUMENT_VALIDATION_ERROR=7]="ARGUMENT_VALIDATION_ERROR"}(J||(J={}));export{X as CheckoutStep,J as ErrorType,te 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 i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/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-filter/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{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as d}from"@ikas/storefront-config";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"../paypal-express-checkout/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 l}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var c=o((function(o){var s,c,g,f=o.pageType,v=o.pageTitle,h=o.pageDescription,j=o.canonicals,x=o.disableIndex,y=o.pageSpecificData,b=o.merchantSettings,T=o.addOgpMetas,C=o.productReviewSummary,D=o.pageComponentPropValues,L=a(),O="undefined"!=typeof window,k="local"===process.env.NEXT_PUBLIC_ENV,w=L.asPath.split(/[?#]/)[0].replace("/",""),P=(w="/"===w.charAt(w.length-1)?w.slice(0,-1):w).startsWith("pages/"),R=d.getCurrentRouting(),E=((null===(s=d.getMerchantSettings())||void 0===s?void 0:s.defaultLocale)||"tr")===(null==R?void 0:R.locale),I=!!y&&f===r.PRODUCT,_=!!y&&f===r.CATEGORY,S=!!y&&f===r.BRAND,V=I||_||S,A=null;(I||S||_)&&(A=y);var M=null===(c=null==A?void 0:A.translations)||void 0===c?void 0:c.find((function(e){return e.locale===(null==R?void 0:R.locale)})),N=(null==R?void 0:R.path)?"/"+R.path:"",B=k?"http://localhost:3333":"https://"+d.getDomain(),U=null===(g=d.getIndexPageSeoSettings())||void 0===g?void 0:g.find((function(e){return e.locale===d.getCurrentLocale()})),G=U?new n(U):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[f,y]);var F=t.useMemo((function(){if(y&&y.href)return"".concat(B).concat(y.href)}),[y]),Y=t.useMemo((function(){if(y&&y.href){var e=y.href;return N?"".concat(B).concat(N).concat(e):"".concat(B).concat(e)}}),[y]),z=t.useMemo((function(){var e,t,o,i=[];if(T){if(i.push({property:"og:type",content:"website"}),i.push({property:"og:site_name",content:(null==G?void 0:G.pageTitle)||"https://"+d.getDomain()}),v&&i.push({property:"og:title",content:v}),h&&i.push({property:"og:description",content:h}),f===r.INDEX){var a=null,n=null;!v&&(null==G?void 0:G.pageTitle)&&(a=G.pageTitle),!h&&(null==G?void 0:G.description)&&(n=G.description),(s=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f})))&&(a=u(y,f,s.titleTemplate||""),n=u(y,f,s.descriptionTemplate||"")),a&&i.push({property:"og:title",content:a}),n&&i.push({property:"og:description",content:n})}if(f===r.PRODUCT||f===r.CATEGORY||f===r.BRAND){var s,l=null,c=null;if((s=null===(t=d.getMetaTemplates())||void 0===t?void 0:t.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f})))&&(l=u(y,f,s.titleTemplate||""),c=u(y,f,s.descriptionTemplate||"")),!v){var p=l||V&&E&&(null==A?void 0:A.name)||V&&!E&&(null==M?void 0:M.name);p&&i.push({property:"og:title",content:p})}if(!h){var m=c||V&&!E&&(null==M?void 0:M.description);m&&i.push({property:"og:description",content:m})}}i.push({property:"og:url",content:Y||(O?window.location.href:"")||"https://".concat(d.getDomain())});var g=null;if(y&&f===r.PRODUCT){var j=y.selectedVariant.mainImage;(null==j?void 0:j.image)&&(g={property:"og:image",content:j.image.src.replace(".webp",".jpg")})}if(y&&f===r.CATEGORY){var x=y;x.image&&(g={property:"og:image",content:x.image.src.replace(".webp",".jpg")})}if(y&&f===r.BRAND){var C=y;C.image&&(g={property:"og:image",content:C.image.src.replace(".webp",".jpg")})}if(y&&f===r.BLOG_CATEGORY){var D=y;D.image&&(g={property:"og:image",content:D.image.src.replace(".webp",".jpg")})}if(y&&f===r.BLOG){var L=y;L.image&&(g={property:"og:image",content:L.image.src.replace(".webp",".jpg")})}!g&&(null==G?void 0:G.icon)&&(g={property:"og:image",content:null===(o=null==G?void 0:G.icon)||void 0===o?void 0:o.src.replace(".webp",".jpg")}),!g&&(null==b?void 0:b.logo)&&(g={property:"og:image",content:b.logo.src.replace(".webp",".jpg")}),g&&i.push(g)}return i}),[v,y,F,h,b,T,b]),H=t.useMemo((function(){var t=[],o=(null==G?void 0:G.pageTitle)||(null==b?void 0:b.merchantName)||"";if(b){var i={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,i,a,r,n,s,l=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:l,image:l,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(b);t.push(i),t.push(a)}if(y&&f===r.PRODUCT){var n=y,s=function(t,o){var i,a,n,s,l,c,p;try{var m=["c7d934c7-2d44-43c3-b023-de7aa93fe435"],g=null===(i=d.getMerchantSettings())||void 0===i?void 0:i.merchantId,f=d.getCurrentRouting(),v=null==f?void 0:f.path,h=function(e){return v?"https://".concat(d.getDomain(),"/").concat(v).concat(e):"https://".concat(d.getDomain()).concat(e)},j=t.selectedVariant,x=null,y=null===(a=d.getMetaTemplates())||void 0===a?void 0:a.find((function(e){return e.locale===d.getCurrentLocale()&&r.PRODUCT}));return y&&(x=u(t,r.PRODUCT,y.descriptionTemplate||"")),e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:(null===(n=t.metaData)||void 0===n?void 0:n.description)||x,image:null===(s=j.images)||void 0===s?void 0:s.map((function(e){return e.image?e.image.src:""})),productId:j.id,sku:j.sku,mpn:(null===(l=j.barcodeList)||void 0===l?void 0:l.length)?j.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(c=t.brand)||void 0===c?void 0:c.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),m.some((function(e){return e!==g}))?{offers:{"@type":"Offer",url:h(t.href),priceCurrency:j.price.currency||"TRY",price:(null!==(p=j.campaignPrice)&&void 0!==p?p:j.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:j.stock>0||j.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}:{})}catch(e){}}(n,C||null);if(s&&t.push(s),n.categories.length)(c=p(n.categories[0],o,n))&&t.push(c)}if(y&&f===r.CATEGORY){var l=function(e){var t,o;try{var i=d.getCurrentRouting(),a=null==i?void 0:i.path,r=function(e){return a?"https://".concat(d.getDomain(),"/").concat(a).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(y),c=p(y,o),g=m(D);l&&t.push(l),c&&t.push(c),g&&t.push(g)}y&&f===r.BRAND&&((g=m(D))&&t.push(g));if(y&&f===r.BLOG){var v=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a=function(e){var t=new Date(e),o=t.getFullYear(),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getDate().toString().padStart(2,"0");return"".concat(o,"-").concat(i,"-").concat(a)},r="".concat(t.writer.firstName," ").concat(t.writer.lastName),n=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:a(t.createdAt),dateCreated:a(t.createdAt),dateModified:a(t.updatedAt),description:t.shortDescription,articleBody:n,author:{"@type":"Person",name:r}})}catch(e){}}(y);v&&t.push(v)}return t}),[y,b]),X=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f}));return t?u(y,f,t.titleTemplate||""):null}),[f,y]),W=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f}));return t?u(y,f,t.descriptionTemplate||""):null}),[f,y]),J=t.useMemo((function(){return!d.getFavicon()&&(null==G?void 0:G.favIcon)?G.favIcon:null}),[]),q=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){q.push({routing:e,hrefLang:e.locale+"-"+t})})):q.push({routing:e,hrefLang:e.locale})}));var K=function(e){var t,o,i,a,r,n=y,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=q.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(a=null===(i=null==n?void 0:n.metaData)||void 0===i?void 0:i.translations)||void 0===a?void 0:a.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},Q=l.getInstance();return t.createElement(i,null,t.createElement("title",null,v||X||(V?E?(null==A?void 0:A.name)||"":(null==M?void 0:M.name)||"":(null==G?void 0:G.pageTitle)||"")),t.createElement("meta",{name:"description",content:h||W||(V?(null==M?void 0:M.description)||"":(null==G?void 0:G.description)||"")}),q.length>1&&q.filter((function(e){return!P||e.routing.id===(null==R?void 0:R.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(B+(e.routing.path?"/"+e.routing.path:""),"/").concat(K(e.routing))})})),!!x&&t.createElement("meta",{name:"robots",content:"noindex"}),!!T&&z.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!j&&j.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(B).concat(N).concat(e)})})),J&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(J,"/image_180.webp"),type:"image/webp"}),!j&&Q.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(B).concat(N,"/").concat(w)}),!!H.length&&H.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function p(e,t,o){try{var i=l.getInstance(),a=d.getCurrentRouting(),n=null==a?void 0:a.path,s=function(e){return n?"https://".concat(d.getDomain(),"/").concat(n).concat(e):"https://".concat(d.getDomain()).concat(e)},c=[{"@type":"ListItem",position:1,name:t,item:"https://".concat(d.getDomain())}];return(c=c.concat(e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+2,name:e.name,item:s(e.href)}})))).push({"@type":"ListItem",position:c.length+1,name:e.name,item:s(e.href)}),i.currentPageType===r.PRODUCT&&o&&c.push({"@type":"ListItem",position:c.length+1,name:o.name,item:s(o.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:c}}catch(e){}}function m(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var i=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(i){var a=Object.values(i.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(a)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(a.data||[]).slice(0,10).map((function(e,t){var i,a,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(a=null===(i=e.selectedVariant.mainImage)||void 0===i?void 0:i.image)||void 0===a?void 0:a.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",c=s.selectedVariant.sku||"",p=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"",m=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",p)),n.includes("{{price}}")&&(n=g(n,"{{price}}",m.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var f=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",f))}}catch(e){}return n.trimEnd()}function g(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{c as IkasPageHead};
|
|
1
|
+
import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import i from"next/head.js";import{useRouter as a}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as r}from"@ikas/storefront-models";import"mobx";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/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-filter/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{IkasIndexPageSeoSetting as n}from"../../models/data/storefront/index-page-seo-setting/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductList as s}from"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as d}from"@ikas/storefront-config";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"../paypal-express-checkout/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 l}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var c=o((function(o){var s,c,g,f=o.pageType,v=o.pageTitle,h=o.pageDescription,j=o.canonicals,x=o.disableIndex,y=o.pageSpecificData,b=o.merchantSettings,T=o.addOgpMetas,C=o.productReviewSummary,D=o.pageComponentPropValues,O=a(),L="undefined"!=typeof window,w="local"===process.env.NEXT_PUBLIC_ENV,k=O.asPath.split(/[?#]/)[0].replace("/",""),P=(k="/"===k.charAt(k.length-1)?k.slice(0,-1):k).startsWith("pages/"),R=f===r.BLOG,E=d.getCurrentRouting(),I=((null===(s=d.getMerchantSettings())||void 0===s?void 0:s.defaultLocale)||"tr")===(null==E?void 0:E.locale),S=!!y&&f===r.PRODUCT,_=!!y&&f===r.CATEGORY,V=!!y&&f===r.BRAND,A=S||_||V,M=null;(S||V||_)&&(M=y);var N=null===(c=null==M?void 0:M.translations)||void 0===c?void 0:c.find((function(e){return e.locale===(null==E?void 0:E.locale)})),B=(null==E?void 0:E.path)?"/"+E.path:"",G=w?"http://localhost:3333":"https://"+d.getDomain(),U=null===(g=d.getIndexPageSeoSettings())||void 0===g?void 0:g.find((function(e){return e.locale===d.getCurrentLocale()})),F=U?new n(U):null;t.useEffect((function(){document.documentElement.lang=d.getCurrentLocale()}),[f,y]);var Y=t.useMemo((function(){if(y&&y.href)return"".concat(G).concat(y.href)}),[y]),z=t.useMemo((function(){if(y&&y.href){var e=y.href;return B?"".concat(G).concat(B).concat(e):"".concat(G).concat(e)}}),[y]),H=t.useMemo((function(){var e,t,o,i=[];if(T){if(i.push({property:"og:type",content:"website"}),i.push({property:"og:site_name",content:(null==F?void 0:F.pageTitle)||"https://"+d.getDomain()}),v&&i.push({property:"og:title",content:v}),h&&i.push({property:"og:description",content:h}),f===r.INDEX){var a=null,n=null;!v&&(null==F?void 0:F.pageTitle)&&(a=F.pageTitle),!h&&(null==F?void 0:F.description)&&(n=F.description),(s=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f})))&&(a=u(y,f,s.titleTemplate||""),n=u(y,f,s.descriptionTemplate||"")),a&&i.push({property:"og:title",content:a}),n&&i.push({property:"og:description",content:n})}if(f===r.PRODUCT||f===r.CATEGORY||f===r.BRAND){var s,l=null,c=null;if((s=null===(t=d.getMetaTemplates())||void 0===t?void 0:t.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f})))&&(l=u(y,f,s.titleTemplate||""),c=u(y,f,s.descriptionTemplate||"")),!v){var p=l||A&&I&&(null==M?void 0:M.name)||A&&!I&&(null==N?void 0:N.name);p&&i.push({property:"og:title",content:p})}if(!h){var m=c||A&&!I&&(null==N?void 0:N.description);m&&i.push({property:"og:description",content:m})}}i.push({property:"og:url",content:z||(L?window.location.href:"")||"https://".concat(d.getDomain())});var g=null;if(y&&f===r.PRODUCT){var j=y.selectedVariant.mainImage;(null==j?void 0:j.image)&&(g={property:"og:image",content:j.image.src.replace(".webp",".jpg")})}if(y&&f===r.CATEGORY){var x=y;x.image&&(g={property:"og:image",content:x.image.src.replace(".webp",".jpg")})}if(y&&f===r.BRAND){var C=y;C.image&&(g={property:"og:image",content:C.image.src.replace(".webp",".jpg")})}if(y&&f===r.BLOG_CATEGORY){var D=y;D.image&&(g={property:"og:image",content:D.image.src.replace(".webp",".jpg")})}if(y&&f===r.BLOG){var O=y;O.image&&(g={property:"og:image",content:O.image.src.replace(".webp",".jpg")})}!g&&(null==F?void 0:F.icon)&&(g={property:"og:image",content:null===(o=null==F?void 0:F.icon)||void 0===o?void 0:o.src.replace(".webp",".jpg")}),!g&&(null==b?void 0:b.logo)&&(g={property:"og:image",content:b.logo.src.replace(".webp",".jpg")}),g&&i.push(g)}return i}),[v,y,Y,h,b,T,b]),X=t.useMemo((function(){var t=[],o=(null==F?void 0:F.pageTitle)||(null==b?void 0:b.merchantName)||"";if(b){var i={"@context":"https://schema.org","@type":"Website",url:"https://"+d.getDomain()},a=function(t){var o,i,a,r,n,s,l=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:l,image:l,url:"https://"+d.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(a=null===(i=t.address)||void 0===i?void 0:i.city)||void 0===a?void 0:a.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(r=t.address)||void 0===r?void 0:r.postalCode,addressCountry:null===(s=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===s?void 0:s.code})}}(b);t.push(i),t.push(a)}if(y&&f===r.PRODUCT){var n=y,s=function(t,o){var i,a,n,s,l,c,p;try{var m=["c7d934c7-2d44-43c3-b023-de7aa93fe435"],g=null===(i=d.getMerchantSettings())||void 0===i?void 0:i.merchantId,f=d.getCurrentRouting(),v=null==f?void 0:f.path,h=function(e){return v?"https://".concat(d.getDomain(),"/").concat(v).concat(e):"https://".concat(d.getDomain()).concat(e)},j=t.selectedVariant,x=null,y=null===(a=d.getMetaTemplates())||void 0===a?void 0:a.find((function(e){return e.locale===d.getCurrentLocale()&&r.PRODUCT}));return y&&(x=u(t,r.PRODUCT,y.descriptionTemplate||"")),e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:(null===(n=t.metaData)||void 0===n?void 0:n.description)||x,image:null===(s=j.images)||void 0===s?void 0:s.map((function(e){return e.image?e.image.src:""})),productId:j.id,sku:j.sku,mpn:(null===(l=j.barcodeList)||void 0===l?void 0:l.length)?j.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(c=t.brand)||void 0===c?void 0:c.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),m.some((function(e){return e!==g}))?{offers:{"@type":"Offer",url:h(t.href),priceCurrency:j.price.currency||"TRY",price:(null!==(p=j.campaignPrice)&&void 0!==p?p:j.price.finalPrice).toFixed(2),priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:j.stock>0||j.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}:{})}catch(e){}}(n,C||null);if(s&&t.push(s),n.categories.length)(c=p(n.categories[0],o,n))&&t.push(c)}if(y&&f===r.CATEGORY){var l=function(e){var t,o;try{var i=d.getCurrentRouting(),a=null==i?void 0:i.path,r=function(e){return a?"https://".concat(d.getDomain(),"/").concat(a).concat(e):"https://".concat(d.getDomain()).concat(e)};return{"@context":"http://schema.org","@type":"CollectionPage",url:r(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(y),c=p(y,o),g=m(D);l&&t.push(l),c&&t.push(c),g&&t.push(g)}y&&f===r.BRAND&&((g=m(D))&&t.push(g));if(y&&f===r.BLOG){var v=function(t){var o;try{var i="https://".concat(d.getDomain()).concat(t.href),a="".concat(t.writer.firstName," ").concat(t.writer.lastName),r=(new DOMParser).parseFromString(t.blogContent.content,"text/html").body.textContent;return e(e({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,image:null===(o=t.image)||void 0===o?void 0:o.src},t.category&&{genre:t.category.name}),{url:i,datePublished:new Date(t.createdAt).toISOString(),dateCreated:new Date(t.createdAt).toISOString(),dateModified:new Date(t.updatedAt).toISOString(),description:t.shortDescription,articleBody:r,author:{"@type":"Person",name:a}})}catch(e){}}(y);v&&t.push(v)}return t}),[y,b]),W=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f}));return t?u(y,f,t.titleTemplate||""):null}),[f,y]),J=t.useMemo((function(){var e,t=null===(e=d.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===d.getCurrentLocale()&&e.pageType===f}));return t?u(y,f,t.descriptionTemplate||""):null}),[f,y]),q=t.useMemo((function(){return!d.getFavicon()&&(null==F?void 0:F.favIcon)?F.favIcon:null}),[]),K=[];d.getRoutings().forEach((function(e){var t;(null===(t=e.countryCodes)||void 0===t?void 0:t.length)?e.countryCodes.forEach((function(t){K.push({routing:e,hrefLang:e.locale+"-"+t})})):K.push({routing:e,hrefLang:e.locale})}));var Q=function(e){var t,o,i,a,r,n=y,s=null===(o=null===(t=null==n?void 0:n.metaData)||void 0===t?void 0:t.translations)||void 0===o?void 0:o.find((function(t){return t.locale===e.locale}));if(s&&(null==s?void 0:s.slug))return s.slug;var d=K.find((function(e){return!e.routing.path}));return d&&(null===(r=null===(a=null===(i=null==n?void 0:n.metaData)||void 0===i?void 0:i.translations)||void 0===a?void 0:a.find((function(e){return e.locale===d.routing.locale})))||void 0===r?void 0:r.slug)||""},Z=l.getInstance();return t.createElement(i,null,t.createElement("title",null,v||W||(A?I?(null==M?void 0:M.name)||"":(null==N?void 0:N.name)||"":(null==F?void 0:F.pageTitle)||"")),t.createElement("meta",{name:"description",content:h||J||(A?(null==N?void 0:N.description)||"":(null==F?void 0:F.description)||"")}),K.length>1&&!P&&!R&&K.filter((function(e){return!P||e.routing.id===(null==E?void 0:E.id)})).map((function(e){return t.createElement("link",{key:e.routing.id+e.hrefLang,rel:"alternate",hrefLang:e.hrefLang,href:"".concat(G+(e.routing.path?"/"+e.routing.path:""),"/").concat(Q(e.routing))})})),!!x&&t.createElement("meta",{name:"robots",content:"noindex"}),!!T&&H.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!j&&j.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(G).concat(B).concat(e)})})),q&&t.createElement("link",{rel:"shortcut icon",href:"".concat(process.env.NEXT_PUBLIC_CDN_URL,"images/").concat(q,"/image_180.webp"),type:"image/webp"}),!j&&Z.currentPageType!==r.NOT_FOUND&&t.createElement("link",{rel:"canonical",href:"".concat(G).concat(B,"/").concat(k)}),!!X.length&&X.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function p(e,t,o){try{var i=l.getInstance(),a=d.getCurrentRouting(),n=null==a?void 0:a.path,s=function(e){return n?"https://".concat(d.getDomain(),"/").concat(n).concat(e):"https://".concat(d.getDomain()).concat(e)},c=[{"@type":"ListItem",position:1,name:t,item:"https://".concat(d.getDomain())}];return(c=c.concat(e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+2,name:e.name,item:s(e.href)}})))).push({"@type":"ListItem",position:c.length+1,name:e.name,item:s(e.href)}),i.currentPageType===r.PRODUCT&&o&&c.push({"@type":"ListItem",position:c.length+1,name:o.name,item:s(o.productHref)}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:c}}catch(e){}}function m(e){try{var t=d.getCurrentRouting(),o=null==t?void 0:t.path;if(e){var i=(e.filter((function(e){return!e.component.isHeader&&!e.component.isFooter}))||[]).find((function(e){return Object.values(e.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}))}));if(i){var a=Object.values(i.propValues).find((function(e){var t;return e instanceof s&&(null===(t=e._productListPropValue)||void 0===t?void 0:t.usePageFilter)}));if(a)return{"@context":"http://schema.org","@type":"ItemList",itemListElement:(a.data||[]).slice(0,10).map((function(e,t){var i,a,r,n;return{"@type":"ListItem",position:t+1,item:{"@type":"Product",name:e.name,image:(null===(a=null===(i=e.selectedVariant.mainImage)||void 0===i?void 0:i.image)||void 0===a?void 0:a.src)||"",offers:{"@type":"Offer",url:(n=e.href,o?"https://".concat(d.getDomain(),"/").concat(o).concat(n):"https://".concat(d.getDomain()).concat(n)),priceCurrency:e.selectedVariant.price.currency||"TRY",price:(null!==(r=e.selectedVariant.campaignPrice)&&void 0!==r?r:e.selectedVariant.finalPrice).toFixed(2),availability:e.selectedVariant.stock>0||e.selectedVariant.sellIfOutOfStock?"https://schema.org/InStock":"https://schema.org/OutOfStock"}}}}))}}}}catch(e){}}function u(e,t,o){var i,a,n=o;try{switch(t){case r.PRODUCT:var s=e,d=s.name,l=(null===(i=s.brand)||void 0===i?void 0:i.name)||"",c=s.selectedVariant.sku||"",p=(null===(a=s.selectedVariant.barcodeList)||void 0===a?void 0:a.length)?s.selectedVariant.barcodeList[0]:"",m=s.selectedVariant.campaignPrice?s.selectedVariant.formattedCampaignPrice:s.selectedVariant.formattedFinalPrice;n.includes("{{name}}")&&(n=g(n,"{{name}}",d)),n.includes("{{brand}}")&&(n=g(n,"{{brand}}",l)),n.includes("{{sku}}")&&(n=g(n,"{{sku}}",c)),n.includes("{{barcode}}")&&(n=g(n,"{{barcode}}",p)),n.includes("{{price}}")&&(n=g(n,"{{price}}",m.toString()));break;case r.BRAND:case r.CATEGORY:case r.BLOG_CATEGORY:var u=e.name||"";n.includes("{{name}}")&&(n=g(n,"{{name}}",u));break;case r.BLOG:var f=e.title;n.includes("{{name}}")&&(n=g(n,"{{name}}",f))}}catch(e){}return n.trimEnd()}function g(e,t,o){var i=new RegExp(t,"g");return e.replace(i,o)}export{c as IkasPageHead};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from"../../../ext/tslib/tslib.es6.mjs.js";import e from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ButtonActionTypeEnum as o}from"../../models/modal/step/elements/button/index.js";import{getHorizontalAlignment as r,injectFontScript as i}from"../../helpers/index.js";var
|
|
1
|
+
import{__assign as t}from"../../../ext/tslib/tslib.es6.mjs.js";import e from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ButtonActionTypeEnum as o}from"../../models/modal/step/elements/button/index.js";import{getHorizontalAlignment as r,injectFontScript as i,normalizeUrl as a}from"../../helpers/index.js";var c=n((function(n){var c=n.element,l=n.isStandaloneButtonComponent,s=n.onClose,d=n.disableButtonAction,u=e.useRef(null),m=c,f={display:"flex",alignItems:"center",justifyContent:r(m.horizontalAlignment),padding:"".concat(m.outerVerticalPadding,"px ").concat(m.outerHorizontalPadding,"px"),backgroundColor:m.bgColor},p={color:m.color,backgroundColor:m.buttonBgColor,fontSize:m.fontSize,fontWeight:m.fontWeight,fontFamily:i(m.fontFamily),textAlign:"center",border:"".concat(m.borderWidth,"px ").concat(m.borderStyle," ").concat(m.borderColor),borderRadius:m.borderRadius,padding:"".concat(m.verticalPadding,"px ").concat(m.horizontalPadding,"px")},b={width:"".concat(m.width,"%"),minWidth:"fit-content",cursor:"pointer"},g=e.useCallback((function(){if(u.current&&!d){var t=m.link||void 0;if(!l&&t)u.current.href=a(t)||"",u.current.click();else switch(m.actionType){case o.NAVIGATE_TO_LINK_AND_CLOSE:u.current.href=a(t)||"",null==s||s(!0),u.current.click();break;case o.NAVIGATE_TO_LINK:u.current.href=a(t)||"",u.current.click();break;case o.CLOSE:null==s||s(!0)}}}),[u,u.current]);return e.createElement("div",{style:f},e.createElement("a",{onClick:g,style:b,target:m.openLinkInNewWindow?"_blank":"_self",ref:u},e.createElement("div",{dangerouslySetInnerHTML:{__html:m.text},style:t({},p)})))}));export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ImageFitEnum as r}from"../../models/modal/step/elements/image/index.js";var
|
|
1
|
+
import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ImageFitEnum as r}from"../../models/modal/step/elements/image/index.js";import{normalizeUrl as i}from"../../helpers/index.js";var a=t((function(t){var a=t.element,o=t.popup,d=t.editModeChildren,n=t.isMobile,m=a;m.cdnURL||(m.cdnURL=o.cdnURL),m.merchantId||(m.merchantId=o.merchantId);var c=o.modal.windowSettings,l={width:c.takeFullWidth||n?"100%":c.maxWidth,backgroundColor:m.bgColor,padding:"".concat(m.verticalPadding,"px ").concat(m.horizontalPadding,"px"),borderRadius:m.borderRadius};if(!m.src&&o.isPreviewMode&&d)return e.createElement("div",{style:l},d);var s={objectFit:m.objectFit===r.CONTAIN?"contain":"cover",height:"100%"};return e.createElement("a",{href:i(m.link),style:l,target:"_blank"},m.src&&e.createElement("img",{src:m.src||void 0,width:"100% !important",style:s}))}));export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{ImagePositionEnum as i,ImageFitEnum as a}from"../../models/modal/step/elements/image/index.js";var o=t((function(t){var o=t.element,
|
|
1
|
+
import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{normalizeUrl as r}from"../../helpers/index.js";import{ImagePositionEnum as i,ImageFitEnum as a}from"../../models/modal/step/elements/image/index.js";var o=t((function(t){var o=t.element,n=t.popup,d=t.editModeChildren,m=o;if(m.cdnURL||(m.cdnURL=n.cdnURL),m.merchantId||(m.merchantId=n.merchantId),!m.src&&n.isPreviewMode&&d)return d;var c={display:"flex",alignItems:"center",justifyContent:m.imagePosition===i.DISABLE_FLOAT?"center":m.imagePosition===i.FLOAT_LEFT?"flex-start":"flex-end",padding:"".concat(m.verticalPadding,"px ").concat(m.horizontalPadding,"px"),backgroundColor:m.bgColor,maxWidth:"100%"},s={borderRadius:"".concat(m.borderRadius,"px"),objectFit:m.objectFit===a.CONTAIN?"contain":"cover",width:"".concat(m.maxWidth,"%")};return e.createElement("a",{href:r(m.link),style:c,target:"_blank"},e.createElement("img",{src:m.src||void 0,width:100===m.maxWidth?"100% !important":void 0,style:s}))}));export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as r}from"../../helpers/index.js";var
|
|
1
|
+
import e from"react";import{observer as t}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as r,normalizeUrl as n}from"../../helpers/index.js";var i=t((function(t){var i=t.element,o=i.socialMediaLinks.filter((function(e){return!!e.link})).sort((function(e,t){return e.order-t.order}));if(!o.length&&t.editModeChildren&&t.popup.isPreviewMode)return t.editModeChildren;var a={display:"flex",alignItems:"center",justifyContent:r(i.horizontalAlignment),padding:"".concat(i.verticalPadding,"px ").concat(i.horizontalPadding,"px"),backgroundColor:i.bgColor,width:"100%"},l={display:"flex",alignItems:"center",gap:"".concat(i.gapBetweenLogos,"px")};return e.createElement("div",{style:a},e.createElement("div",{style:l},o.map((function(t,r){return e.createElement("a",{href:n(t.link)||"",key:r,target:"_blank"},e.createElement("img",{src:t.iconUrlWithoutHash||"",width:24,height:24}))}))))}));export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__spreadArray as
|
|
1
|
+
import{__spreadArray as t}from"../../ext/tslib/tslib.es6.mjs.js";import"../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js";import"../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js";import{isValidPhoneNumber as e}from"../../ext/libphonenumber-js/min/exports/isValidPhoneNumber.js";import"../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js";import"../../ext/libphonenumber-js/min/exports/AsYouType.js";import"../../ext/libphonenumber-js/min/exports/Metadata.js";import"../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js";import"../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js";import{ComponentHorizontalAlignmentEnum as n,PopupElementTypeEnum as a}from"../models/modal/step/elements/base/index.js";var r=function(e){var n=[];return e.modal.steps.forEach((function(e){e.elements.forEach((function(e){if(e.type===a.PRODUCT_LIST){var r=e.variantPairs;r&&(n=t(t([],n,!0),r,!0))}}))})),{variantPairs:n}},i=function(t){var e="";switch(t){case n.LEFT:e="flex-start";break;case n.CENTER:e="center";break;case n.RIGHT:e="flex-end"}return e},s=function(t){if(t.name){var e=t.name.replace(/ /g,"+"),n="";if(t.variants){n+=":";var a=t.variants.some((function(t){return"italic"===t}));if(a&&(n+="ital,"),n+="wght@",a){var r=new RegExp("italic","i");n+=t.variants.reduce((function(t,e){return r.test(e)?t:t+"0,".concat(e.replace("regular","400"),";")}),""),n+=t.variants.reduce((function(t,e){return r.test(e)?t+"1,".concat("italic"===e?"400":e.replace("italic",""),";"):t}),"")}else n+=t.variants.reduce((function(t,e){return t+"".concat(e.replace("regular","400"),";")}),"");n=n.substring(0,n.length-1),n+="&display=swap"}return"https://fonts.googleapis.com/css2?family=".concat(e).concat(n)}},o=function(t){var e="'".concat(t.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif');if(document.getElementById("ikas-popup-font-".concat(t.name)))return e;var n=s(t);if(n){var a=document.createElement("link");return a.setAttribute("id","ikas-popup-font-".concat(t.name)),a.setAttribute("rel","stylesheet"),a.setAttribute("href",n),document.getElementsByTagName("head")[0].appendChild(a),e}},m=function(t){return!(t.length>320)&&/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(t)},u=function(t,n){return e(t,n?n.toUpperCase():"TR")},l=function(t){var e;return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)+(null!==(e=null==t?void 0:t.length)&&void 0!==e?e:0)},c=function(t){if(t&&""!==t.trim()){var e=t.trim();return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")||e.startsWith("ftp://")||e.startsWith("//")?e:"https://".concat(e)}};export{l as generateRandomId,s as getGoogleFontHref,i as getHorizontalAlignment,r as getPopupDynamicData,o as injectFontScript,c as normalizeUrl,m as validateEmail,u as validatePhoneNumber};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as i}from"../../../../../../ext/tslib/tslib.es6.mjs.js";import{makeObservable as t,observable as e,computed as n}from"mobx";import{PopupElementTypeEnum as a,BaseElement as o}from"../base/index.js";import{POPUP_DEFAULT_IMAGE_PATH as
|
|
1
|
+
import{__extends as i}from"../../../../../../ext/tslib/tslib.es6.mjs.js";import{makeObservable as t,observable as e,computed as n}from"mobx";import{PopupElementTypeEnum as a,BaseElement as o}from"../base/index.js";import{POPUP_DEFAULT_IMAGE_PATH as c}from"../../../index.js";var d,s,m,r=1080;(m=d||(d={})).FLOAT_LEFT="FLOAT_LEFT",m.FLOAT_RIGHT="FLOAT_RIGHT",m.DISABLE_FLOAT="DISABLE_FLOAT",function(i){i.CONTAIN="CONTAIN",i.COVER="COVER"}(s||(s={}));var l=function(o){function m(i){var c,m,r,l,g=this;return(g=o.call(this,i)||this).type=a.IMAGE,g.imagePosition=i.imagePosition||d.DISABLE_FLOAT,g.imageId=i.imageId||null,g.bgColor=i.bgColor||"",g.cdnURL=null,g.merchantId=null,g.objectFit=i.objectFit||s.CONTAIN,g.link=i.link||null,g.maxWidth=null!==(c=i.maxWidth)&&void 0!==c?c:100,g.verticalPadding=null!==(m=i.verticalPadding)&&void 0!==m?m:0,g.horizontalPadding=null!==(r=i.horizontalPadding)&&void 0!==r?r:0,g.borderRadius=null!==(l=i.borderRadius)&&void 0!==l?l:0,t(g,{imagePosition:e,imageId:e,bgColor:e,cdnURL:e,merchantId:e,objectFit:e,link:e,maxWidth:e,borderRadius:e,src:n}),g}return i(m,o),Object.defineProperty(m.prototype,"src",{get:function(){if(this.imageId)return this.imageId.includes(c)?"".concat(this.cdnURL).concat(this.imageId):this.imageId.includes("/")?"".concat(this.cdnURL,"images/").concat(this.merchantId).concat(this.imageId,"/image_").concat(r,".jpeg"):"".concat(this.cdnURL,"images/").concat(this.merchantId,"/").concat(this.imageId,"/image_").concat(r,".jpeg")},enumerable:!1,configurable:!0}),m}(o);export{r as IMAGE_SIZE,l as ImageElement,s as ImageFitEnum,d as ImagePositionEnum};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as i}from"../../../../../../ext/tslib/tslib.es6.mjs.js";import{makeObservable as
|
|
1
|
+
import{__extends as i}from"../../../../../../ext/tslib/tslib.es6.mjs.js";import{makeObservable as n,observable as o,computed as t}from"mobx";import{PopupElementTypeEnum as e,BaseElement as a}from"../base/index.js";import{IMAGE_SIZE as m,ImageFitEnum as s}from"../image/index.js";import{POPUP_DEFAULT_IMAGE_PATH as c}from"../../../index.js";var r,d,l;(l=r||(r={})).LEFT_ALIGN="LEFT_ALIGN",l.RIGTH_ALIGN="RIGTH_ALIGN",function(i){i.TOP="TOP",i.BOTTOM="BOTTOM",i.HIDE="HIDE"}(d||(d={}));var g=function(a){function l(i){var m,c,l,g=this;return(g=a.call(this,i)||this).type=e.IMAGE_COLUMN,g.imagePosition=i.imagePosition||r.RIGTH_ALIGN,g.mobilePosition=i.mobilePosition||d.HIDE,g.imageId=i.imageId||null,g.bgColor=i.bgColor||"",g.cdnURL=null,g.merchantId=null,g.objectFit=i.objectFit||s.COVER,g.link=i.link||null,g.verticalPadding=null!==(m=i.verticalPadding)&&void 0!==m?m:0,g.horizontalPadding=null!==(c=i.horizontalPadding)&&void 0!==c?c:0,g.borderRadius=null!==(l=i.borderRadius)&&void 0!==l?l:0,n(g,{imagePosition:o,mobilePosition:o,imageId:o,bgColor:o,cdnURL:o,merchantId:o,objectFit:o,link:o,borderRadius:o,src:t}),g}return i(l,a),Object.defineProperty(l.prototype,"src",{get:function(){if(this.imageId)return this.imageId.includes(c)?"".concat(this.cdnURL).concat(this.imageId):this.imageId.includes("/")?"".concat(this.cdnURL,"images/").concat(this.merchantId).concat(this.imageId,"/image_").concat(m,".jpeg"):"".concat(this.cdnURL,"images/").concat(this.merchantId,"/").concat(this.imageId,"/image_").concat(m,".jpeg")},enumerable:!1,configurable:!0}),l}(a);export{g as ImageColumnElement,r as ImageColumnPositionEnum,d as MobileImageColumnPositionEnum};
|
|
@@ -24,6 +24,7 @@ export declare class IkasOrder extends IkasBaseModel implements IOrder {
|
|
|
24
24
|
currencySymbol: string | null;
|
|
25
25
|
customer: IkasOrderCustomer | null;
|
|
26
26
|
customerId: string | null;
|
|
27
|
+
edited: boolean | null;
|
|
27
28
|
giftCardLines: IkasOrderGiftCardLine[] | null;
|
|
28
29
|
giftPackageLines: IkasOrderGiftPackageLine[] | null;
|
|
29
30
|
giftPackageNote: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasOrderAddress as t}from"./address/index.js";import{IkasOrderShippingLine as n}from"./shipping-line/index.js";import{IkasOrderLineItem as r}from"./line-item/index.js";import{IkasOrderCustomer as
|
|
1
|
+
import{__extends as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasOrderAddress as t}from"./address/index.js";import{IkasOrderShippingLine as n}from"./shipping-line/index.js";import{IkasOrderLineItem as r}from"./line-item/index.js";import{IkasOrderCustomer as i}from"./customer/index.js";import{IkasOrderGiftPackageLine as o}from"./gift-line/index.js";import{IkasInvoice as u}from"./invoice/index.js";import{IkasOrderPaymentMethod as l}from"./payment-method/index.js";import{IkasOrderAdjustment as a}from"./adjustment/index.js";import{IkasOrderPackage as s}from"./package/index.js";import{IkasOrderTaxLine as d}from"./tax-line/index.js";import{IkasBaseModel as c}from"../base/index.js";import{IkasOrderLineItemStatus as m,IkasCampaignType as f,IkasOrderShippingMethod as p,IkasOrderStatus as g}from"@ikas/storefront-models";export{IkasOrderCancelReason,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus}from"@ikas/storefront-models";import{makeObservable as b,observable as y,computed as h}from"mobx";import{IkasOrderFunctions as P}from"@ikas/storefront-model-functions";import{formatCurrency as j}from"../../../utils/currency.js";import{IkasOrderGiftCardLine as v}from"./gift-card-line/index.js";var A=function(c){function A(e,m){var f,P,j,A,k,I,O,S,C,x,L,T=this;(T=c.call(this,e)||this).billingAddress=null,T.cancelReason=null,T.cancelledAt=null,T.currencySymbol=null,T.customer=null,T.customerId=null,T.edited=null,T.giftPackageLines=null,T.giftPackageNote=null,T.invoices=null,T.isGiftPackage=null,T.note=null,T.orderAdjustments=null,T.orderNumber=null,T.orderPackageStatus=null,T.orderPackages=null,T.orderPaymentStatus=null,T.orderedAt=null,T.priceListId=null,T.paymentMethods=null,T.shippingAddress=null,T.shippingLines=null,T.taxLines=null,T.billingAddress=e.billingAddress?new t(e.billingAddress):null,T.cancelReason=e.cancelReason||null,T.cancelledAt=e.cancelledAt||null,T.currencyCode=e.currencyCode||"",T.currencySymbol=e.currencySymbol||null,T.customer=e.customer?new i(e.customer):null,T.customerId=e.customerId||null,T.edited=e.edited||null,T.giftCardLines=(null===(f=e.giftCardLines)||void 0===f?void 0:f.map((function(e){return new v(e)})))||null,T.giftPackageLines=(null===(P=e.giftPackageLines)||void 0===P?void 0:P.map((function(e){return new o(e)})))||null,T.giftPackageNote=e.giftPackageNote||null,T.invoices=(null===(j=e.invoices)||void 0===j?void 0:j.map((function(e){return new u(e)})))||null,T.isGiftPackage=e.isGiftPackage||null,T.note=e.note||null,T.orderAdjustments=(null===(A=e.orderAdjustments)||void 0===A?void 0:A.map((function(e){return new a(e)})))||null,T.orderLineItems=(null===(k=e.orderLineItems)||void 0===k?void 0:k.map((function(e){return new r(e)})).filter((function(e){return!e.deleted})))||[],T.orderNumber=e.orderNumber||null,T.orderPackageStatus=e.orderPackageStatus||null,T.orderPackages=(null===(I=e.orderPackages)||void 0===I?void 0:I.map((function(e){return new s(e)})))||null,T.orderPaymentStatus=e.orderPaymentStatus||null,T.orderedAt=e.orderedAt||null,T.priceListId=e.priceListId||null,T.paymentMethods=(null===(O=e.paymentMethods)||void 0===O?void 0:O.map((function(e){return new l(e)})))||null,T.shippingAddress=e.shippingAddress?new t(e.shippingAddress):null,T.shippingLines=(null===(S=e.shippingLines)||void 0===S?void 0:S.map((function(e){return new n(e)})))||null,T.shippingMethod=e.shippingMethod||p.SHIPMENT,T.status=e.status||g.CREATED,T.taxLines=(null===(C=e.taxLines)||void 0===C?void 0:C.map((function(e){return new d(e)})))||null,T.totalFinalPrice=null!==(x=e.totalFinalPrice)&&void 0!==x?x:0,T.totalPrice=null!==(L=e.totalPrice)&&void 0!==L?L:0,T.refundSettings=e.refundSettings;var N={billingAddress:y,cancelReason:y,cancelledAt:y,currencyCode:y,currencySymbol:y,customer:y,customerId:y,edited:y,giftCardLines:y,giftPackageLines:y,giftPackageNote:y,invoices:y,isGiftPackage:y,note:y,orderAdjustments:y,orderLineItems:y,orderNumber:y,orderPackageStatus:y,orderPackages:y,orderPaymentStatus:y,orderedAt:y,paymentMethods:y,shippingAddress:y,shippingLines:y,shippingMethod:y,status:y,taxLines:y,totalFinalPrice:y,totalPrice:y,refundSettings:y,items:h,itemCount:h,refundableItems:h,unfullfilledItems:h,refundedItems:h,totalTax:h,formattedTotalTax:h,shippingTotal:h,formattedShippingTotal:h,formattedTotalFinalPrice:h,formattedTotalPrice:h,hasCustomer:h,hasValidCustomerEmail:h,customerFullName:h,formattedDate:h,couponAdjustment:h,nonCouponAdjustments:h,orderProductFileIds:h};return m&&(delete N.billingAddress,delete N.shippingAddress),b(T,N),T}return e(A,c),Object.defineProperty(A.prototype,"items",{get:function(){return this.orderLineItems.filter((function(e){return e.status!==m.CANCELLED}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"itemCount",{get:function(){var e;return(null===(e=this.items)||void 0===e?void 0:e.length)||0},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"itemQuantity",{get:function(){return this.items.reduce((function(e,t){return e+t.quantity}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"refundableItems",{get:function(){return this.refundSettings?P.getRefundableItems(this,this.refundSettings):[]},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"displayedPackages",{get:function(){return P.getDisplayedPackages(this).map((function(e){return new s(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"unfullfilledItems",{get:function(){return P.getUnfullfilledItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"refundedItems",{get:function(){return P.getRefundedItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"totalTax",{get:function(){return P.getTotalTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"formattedTotalTax",{get:function(){return j(this.totalTax,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"shippingTotal",{get:function(){return P.getShippingTotal(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"formattedShippingTotal",{get:function(){return j(this.shippingTotal,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"formattedTotalFinalPrice",{get:function(){return j(this.totalFinalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"formattedTotalPrice",{get:function(){return j(this.totalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasCustomer",{get:function(){return P.hasCustomer(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hasValidCustomerEmail",{get:function(){return P.hasValidCustomerEmail(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"customerFullName",{get:function(){return P.getCustomerFullName(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"formattedDate",{get:function(){return P.getFormattedDate(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"couponAdjustment",{get:function(){return P.getCouponAdjustment(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"nonCouponAdjustments",{get:function(){return P.getNonCouponAdjustments(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"isRefundEnabled",{get:function(){return this.refundableItems.some((function(e){return null!==e.refundQuantity}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"displayedOrderAdjustments",{get:function(){var e;return null===(e=this.orderAdjustments)||void 0===e?void 0:e.filter((function(e){return e.campaignType!==f.FREE_SHIPPING}))},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"orderProductFileIds",{get:function(){return P.getOrderProductFiles(this)},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),A}(c);export{A as IkasOrder};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.56",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"build": "rm -rf build && rollup -c"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ikas/popup-renderer": "1.0.
|
|
20
|
+
"@ikas/popup-renderer": "1.0.220",
|
|
21
21
|
"swiper": "11.0.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@ikas/storefront-api": "^5.0.
|
|
25
|
-
"@ikas/storefront-config": "^5.0.
|
|
26
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
27
|
-
"@ikas/storefront-models": "^5.0.
|
|
28
|
-
"@ikas/storefront-providers": "^5.0.
|
|
24
|
+
"@ikas/storefront-api": "^5.0.56",
|
|
25
|
+
"@ikas/storefront-config": "^5.0.56",
|
|
26
|
+
"@ikas/storefront-model-functions": "^5.0.56",
|
|
27
|
+
"@ikas/storefront-models": "^5.0.56",
|
|
28
|
+
"@ikas/storefront-providers": "^5.0.56",
|
|
29
29
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
30
30
|
"@adyen/adyen-web": "^5.57.0",
|
|
31
31
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@ikas/localized-address": "1.0.0-beta.6",
|
|
63
|
-
"@ikas/storefront-api": "^5.0.
|
|
64
|
-
"@ikas/storefront-config": "^5.0.
|
|
65
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
66
|
-
"@ikas/storefront-models": "^5.0.
|
|
67
|
-
"@ikas/storefront-providers": "^5.0.
|
|
63
|
+
"@ikas/storefront-api": "^5.0.56",
|
|
64
|
+
"@ikas/storefront-config": "^5.0.56",
|
|
65
|
+
"@ikas/storefront-model-functions": "^5.0.56",
|
|
66
|
+
"@ikas/storefront-models": "^5.0.56",
|
|
67
|
+
"@ikas/storefront-providers": "^5.0.56",
|
|
68
68
|
"mobx": "^6.1.3",
|
|
69
69
|
"mobx-react-lite": "^3.1.5",
|
|
70
70
|
"next": "12.2.0",
|