@ikas/storefront 6.1.0-beta.14 → 6.1.0-beta.16

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.
@@ -19,6 +19,8 @@ declare type CouponProps = {
19
19
  setCouponError: (value: boolean) => void;
20
20
  setCouponErrorCode: (value: CouponErrorCode | null) => void;
21
21
  isOpenCouponCode?: boolean;
22
+ isMobile?: boolean;
23
+ showOnlyMobile?: boolean;
22
24
  } & CommonProps;
23
25
  export declare const Coupon: React.FC<CouponProps>;
24
26
  export {};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as n}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 p}from"../form-item/index.js";import{FormItemType as d}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 N}from"../button/index.js";var y;!function(e){e.COUPON_CODE_NOT_EXIST="COUPON_CODE_NOT_EXIST",e.COUPON_CODE_NOT_EXIST_FOR_GUESS="COUPON_CODE_NOT_EXIST_FOR_GUESS"}(y||(y={}));var S=n((function(e){var t,n,a=e.vm,c=e.allowExpand,p=e.isSuccessPageSummary,d=a.checkout,C=u().t,h=o.useState(!c),v=h[0],f=h[1],N=o.useState(!1),S=N[0],j=N[1],_=o.useState(null),I=_[0],w=_[1],A=o.useState(0),D=A[0],R=A[1],B=o.useState(null),U=B[0],L=B[1],F=o.useState(!1),M=F[0],X=F[1],V=o.useState(!1),G=V[0],H=V[1],q=o.useState(!1),z=q[0],$=q[1];o.useEffect((function(){c&&(v?U&&R(U.getBoundingClientRect().height):R(0))}),[v,U,c,M,G,S,z]);var K=o.useMemo((function(){switch(I){case y.COUPON_CODE_NOT_EXIST:return C("checkout-page:giftCodeErrorDescription");case y.COUPON_CODE_NOT_EXIST_FOR_GUESS:return C("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[I]),Q=[g.CartSummary,c?g.HideOnDesktop:"",p?g.SuccessPageCartSummary:""].join(" "),J=c?{height:D+"px"}:void 0,W=[g.ArrowDown,v?g.Rotated:""].join(" ");return d?o.createElement(o.Fragment,null,!!c&&o.createElement(o.Fragment,null,o.createElement("div",{id:"checkout-mobile-summary-header"}),o.createElement("div",{className:g.ExpandHeader,onClick:function(){if(!v){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}f(!v)}},o.createElement("div",{className:g.Left},C("checkout-page:summary")),o.createElement("div",{className:g.Price},o.createElement("span",{className:g.PriceText},"".concat(s(a.finalPrice||0,d.currencyCode,d.currencySymbol)," (").concat(d.itemQuantity," ").concat(C("checkout-page:cartItemProduct"),")")),o.createElement("span",{className:W},o.createElement(E,null))))),o.createElement("div",{className:Q},o.createElement("div",{className:[g.DetailsContainer,p?g.SuccessPageDetailContainer:""].join(" "),style:J},o.createElement("div",{className:g.Details,ref:L},o.createElement("div",{className:g.ItemsContainer},o.createElement("div",null,d.items.map((function(e,t){return o.createElement(m,{key:t,vm:a,cartItem:e,currencyCode:d.currencyCode,onChange:$,isSuccessPageSummary:p})})))),o.createElement("div",{className:g.Divider}),o.createElement("div",{className:g.SubTotalInfo},S&&o.createElement("div",{className:g.NotificationContainer},o.createElement(r,{type:"warning",title:C("checkout-page:giftCodeErrorTitle"),content:K,onClose:function(){j(!1),w(null)}})),o.createElement(T,{label:C("checkout-page:subtotal"),value:d.formattedTotalPrice,tooltipText:C("checkout-page:subtotalTooltip"),hideMarginBottom:!a.isCouponCodeVisible}),!!(null===(t=d.shippingLines)||void 0===t?void 0:t.length)&&(a.step===l.SUCCESS?o.createElement(T,{label:C("checkout-page:cartShippingTitle"),value:d.shippingTotal?d.formattedShippingTotal:C("checkout-page:free")}):d.shippingLines.map((function(e,t){return o.createElement(T,{key:t,label:e.paymentMethod?e.title:C("checkout-page:cartShippingTitle"),value:e.finalPrice?s(e.finalPrice,d.currencyCode,d.currencySymbol):C("checkout-page:free")})}))),!!a.installmentExtraPrice&&o.createElement(T,{label:C("checkout-page:cartInterest"),value:s(a.installmentExtraPrice,d.currencyCode,d.currencySymbol)}),o.createElement(b,{vm:a}),o.createElement(x,{vm:a}),(a.step===l.SUCCESS&&(!!a.checkout.note||!!a.checkout.appliedCouponCode)||a.step!==l.SUCCESS)&&a.isCouponCodeVisible&&o.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),o.createElement(O,{vm:a,isAddingCoupon:G,setAddingCoupon:H,setCouponError:j,setCouponErrorCode:w}),o.createElement(P,{vm:a,isAddingNote:M,setAddingNote:X})),o.createElement("div",{className:[g.TotalContainer,p?g.SuccessPageTotalContainer:""].join(" ")},o.createElement("div",{className:g.TitleContainer},o.createElement("div",{className:g.Title},C("checkout-page:total"))),o.createElement("div",null,o.createElement("div",{className:g.TotalPricesContainer},o.createElement("div",{className:g.TotalPrice},s(a.finalPrice||0,d.currencyCode,d.currencySymbol)),!!d.$totalTax&&!!(null===(n=a.customizationProps)||void 0===n?void 0:n.showTax)&&o.createElement("div",{className:[g.TotalTax].join(" ")},C("checkout-page:cartTaxTitle")+" "+d.$formattedTotalTax)))),!p&&!a.isPoweredByHidden&&o.createElement("div",{className:g.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===i.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(k,null))))))):null})),T=n((function(e){var t=e.label,n=e.value,a=e.tooltipText,c=e.hideMarginBottom;return o.createElement("div",{className:[g.InfoRow,c?g.hideMb:""].join(" ")},o.createElement("div",{className:g.Label},o.createElement("span",null,t),!!a&&o.createElement(C,{text:a,style:{marginLeft:"8px"}})),o.createElement("div",{className:g.Value},n))})),b=n((function(e){var t=e.vm,n=u().t;return t.checkout?o.createElement(o.Fragment,null,a(t.checkout.nonCouponAdjustments||[],"order").map((function(e,a){return o.createElement("div",{className:g.InfoRow,key:a},o.createElement("div",{className:g.Label},"INTEREST"===e.name?n("checkout-page:cartInterest"):e.name),o.createElement("div",{className:g.Value},o.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",o.createElement("span",null,s(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),x=n((function(e){var t,n=e.vm,a=u().t;return n.checkout?o.createElement(o.Fragment,null,null===(t=n.checkout.giftPackageLines)||void 0===t?void 0:t.map((function(e,t){return o.createElement("div",{className:g.InfoRow,key:t},o.createElement("div",{className:g.Label},o.createElement("div",{className:g.GiftLabel},o.createElement(v,{style:{position:"relative",top:"-1px"}}),o.createElement("span",null,a("checkout-page:giftPackage")))),o.createElement("div",{className:g.Value},o.createElement("span",null,s(e.price,n.checkout.currencyCode,n.checkout.currencySymbol))))}))):null})),O=n((function(n){var a=n.vm,r=n.isAddingCoupon,i=n.setAddingCoupon,m=n.setCouponError,C=n.setCouponErrorCode,E=n.isOpenCouponCode,v=u().t,k=o.useState(""),y=k[0],S=k[1],T=o.useState(!1),b=T[0],x=T[1],O=o.useRef(null);o.useEffect((function(){r&&O.current&&O.current.focus()}),[r]);var P=function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=y,x(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),x(!1),S(""),!a.checkout.appliedCouponCode||a.couponError?[3,3]:(i(!1),m(!1),C(null),[4,a.reInitPaymentMethod()]);case 2:return e.sent(),[3,4];case 3:a.checkout.couponCode=null,m(!0),C(a.couponError),e.label=4;case 4:return[2]}}))}))},j=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,x(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),x(!1),[2]}}))}))},_=a.step===l.SUCCESS,I=a.step===l.SHIPPING;if(_&&!a.checkout.appliedCouponCode)return null;var w=a.checkout.couponAdjustment,A=!(!a.checkout.appliedCouponCode||r),D=!!a.checkout.appliedCouponCode&&E;return o.createElement(o.Fragment,null,!!E&&o.createElement(o.Fragment,null,o.createElement("div",{className:[g.CartSummary,g.OpenCouponCodeSummary].join(" ")},o.createElement("div",{className:f.FormSectionTitle},o.createElement("div",{style:{paddingBottom:D?0:6},className:f.Title},v("checkout-page:couponCode")),D&&o.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline,g.Light].join(" ")},o.createElement("span",{className:[g.AppliedCoupon,g.AppliedCouponBgGray].join(" ")},o.createElement("span",{className:g.CouponCode},a.checkout.appliedCouponCode),!_&&o.createElement("span",{className:g.ClearCoupon,onClick:j},o.createElement(h,null))))))),A&&!I&&!a.isCouponCodeRequirementDefult&&o.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),o.createElement("div",{className:g.InfoRow},!a.checkout.appliedCouponCode&&!r&&a.isCouponCodeVisible&&o.createElement("div",{className:g.ActionTextBtn,onClick:function(){return i(!0)}},v("checkout-page:addCouponCode")),r&&!E&&o.createElement(c,{value:y,placeholder:v("checkout-page:couponCode"),buttonLabel:v("checkout-page:actions.apply"),inputRef:O,onClick:P,isLoading:b,onChange:S}),E&&!D&&o.createElement("div",{tabIndex:0,onKeyDown:function(e){"Enter"===e.key&&P()},className:g.OpenCouponCodeMain},o.createElement(p,{label:v("checkout-page:couponCode"),type:d.TEXT,value:y,onChange:S}),o.createElement(N,{style:{width:"33%"},text:v("checkout-page:actions.apply"),isLoading:b,onClick:P})),A&&o.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline,g.Light].join(" ")},v("checkout-page:couponCode"),o.createElement("span",{className:[g.AppliedCoupon,a.isCouponCodeRequirementDefult?"":g.NotClosed].join(" ")},o.createElement("span",{className:g.CouponCode},a.checkout.appliedCouponCode),a.step!==l.SUCCESS&&a.isCouponCodeRequirementDefult&&o.createElement("span",{className:g.ClearCoupon,onClick:j},o.createElement(h,null)))),A&&o.createElement("div",{className:g.Value},o.createElement("span",null,"DECREMENT"===(null==w?void 0:w.type)?"- ":"")," ",o.createElement("span",null,s((null==w?void 0:w.amount)||0,a.checkout.currencyCode,a.checkout.currencySymbol)))))})),P=n((function(e){var t=e.vm,n=e.isAddingNote,a=e.setAddingNote,c=u().t,r=o.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=o.useCallback((function(){a(!0)}),[]),s=o.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:o.createElement("div",{className:g.InfoRow},!n&&!m&&o.createElement("div",{className:g.ActionTextBtn,onClick:i},r),(n||m)&&o.createElement("div",{className:[g.CheckoutNoteContainer,m?g.Success:""].join(" ")},o.createElement("div",{className:g.Title},c("checkout-page:orderNote")),m?o.createElement("div",{className:g.CheckoutNoteDisplay},t.checkout.note):o.createElement(p,{style:{width:"100%"},type:d.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:s,maxLength:320})))}));export{S as CartSummary,O as Coupon,y 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 u}from"../../../../utils/currency.js";import{useTranslation as s}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 f from"../svg/gift.js";import v from"../../styles/common.module.scss.js";import g from"./style.module.scss.js";import k from"../svg/ikas.js";import{Button as N}from"../button/index.js";import y from"../../../../hooks/useDimension.js";var S;!function(e){e.COUPON_CODE_NOT_EXIST="COUPON_CODE_NOT_EXIST",e.COUPON_CODE_NOT_EXIST_FOR_GUESS="COUPON_CODE_NOT_EXIST_FOR_GUESS"}(S||(S={}));var T=o((function(e){var t,o,a=e.vm,c=e.allowExpand,d=e.isSuccessPageSummary,p=a.checkout,C=s().t,h=n.useState(!c),f=h[0],v=h[1],N=n.useState(!1),T=N[0],P=N[1],w=n.useState(null),_=w[0],L=w[1],R=n.useState(0),D=R[0],A=R[1],M=n.useState(null),U=M[0],B=M[1],F=n.useState(!1),G=F[0],V=F[1],X=n.useState(!1),q=X[0],H=X[1],z=n.useState(!1),$=z[0],K=z[1];y().isMobile,n.useEffect((function(){c&&(f?U&&A(U.getBoundingClientRect().height):A(0))}),[f,U,c,G,q,T,$]);var Q=n.useMemo((function(){switch(_){case S.COUPON_CODE_NOT_EXIST:return C("checkout-page:giftCodeErrorDescription");case S.COUPON_CODE_NOT_EXIST_FOR_GUESS:return C("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[_]),W=[g.CartSummary,c?g.HideOnDesktop:"",d?g.SuccessPageCartSummary:""].join(" "),J=c?{height:D+"px"}:void 0,Y=[g.ArrowDown,f?g.Rotated:""].join(" ");return p?n.createElement(n.Fragment,null,!!c&&n.createElement(n.Fragment,null,n.createElement("div",{id:"checkout-mobile-summary-header"}),n.createElement("div",{className:g.ExpandHeader,onClick:function(){if(!f){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}v(!f)}},n.createElement("div",{className:g.Left},C("checkout-page:summary")),n.createElement("div",{className:g.Price},n.createElement("span",{className:g.PriceText},"".concat(u(a.finalPrice||0,p.currencyCode,p.currencySymbol)," (").concat(p.itemQuantity," ").concat(C("checkout-page:cartItemProduct"),")")),n.createElement("span",{className:Y},n.createElement(E,null))))),n.createElement("div",{className:W},n.createElement("div",{className:[g.DetailsContainer,d?g.SuccessPageDetailContainer:""].join(" "),style:J},n.createElement("div",{className:g.Details,ref:B},n.createElement("div",{className:g.ItemsContainer},n.createElement("div",null,p.items.map((function(e,t){return n.createElement(m,{key:t,vm:a,cartItem:e,currencyCode:p.currencyCode,onChange:K,isSuccessPageSummary:d})})))),n.createElement("div",{className:g.Divider}),n.createElement("div",{className:g.SubTotalInfo},T&&n.createElement("div",{className:g.NotificationContainer},n.createElement(r,{type:"warning",title:C("checkout-page:giftCodeErrorTitle"),content:Q,onClose:function(){P(!1),L(null)}})),n.createElement(b,{label:C("checkout-page:subtotal"),value:p.formattedTotalPrice,tooltipText:C("checkout-page:subtotalTooltip"),hideMarginBottom:!a.isCouponCodeVisible}),!!(null===(t=p.shippingLines)||void 0===t?void 0:t.length)&&(a.step===l.SUCCESS?n.createElement(b,{label:C("checkout-page:cartShippingTitle"),value:p.shippingTotal?p.formattedShippingTotal:C("checkout-page:free")}):p.shippingLines.map((function(e,t){return n.createElement(b,{key:t,label:e.paymentMethod?e.title:C("checkout-page:cartShippingTitle"),value:e.finalPrice?u(e.finalPrice,p.currencyCode,p.currencySymbol):C("checkout-page:free")})}))),!!a.installmentExtraPrice&&n.createElement(b,{label:C("checkout-page:cartInterest"),value:u(a.installmentExtraPrice,p.currencyCode,p.currencySymbol)}),n.createElement(x,{vm:a}),n.createElement(O,{vm:a}),(a.step===l.SUCCESS&&(!!a.checkout.note||!!a.checkout.appliedCouponCode)||a.step!==l.SUCCESS)&&a.isCouponCodeVisible&&n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement(j,{vm:a,isAddingCoupon:q,setAddingCoupon:H,setCouponError:P,setCouponErrorCode:L}),n.createElement(I,{vm:a,isAddingNote:G,setAddingNote:V})),n.createElement("div",{className:[g.TotalContainer,d?g.SuccessPageTotalContainer:""].join(" ")},n.createElement("div",{className:g.TitleContainer},n.createElement("div",{className:g.Title},C("checkout-page:total"))),n.createElement("div",null,n.createElement("div",{className:g.TotalPricesContainer},n.createElement("div",{className:g.TotalPrice},u(a.finalPrice||0,p.currencyCode,p.currencySymbol)),!!p.$totalTax&&!!(null===(o=a.customizationProps)||void 0===o?void 0:o.showTax)&&n.createElement("div",{className:[g.TotalTax].join(" ")},C("checkout-page:cartTaxTitle")+" "+p.$formattedTotalTax)))),!d&&!a.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})),b=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))})),x=o((function(e){var t=e.vm,o=s().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,u(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),O=o((function(e){var t,o=e.vm,a=s().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(f,{style:{position:"relative",top:"-1px"}}),n.createElement("span",null,a("checkout-page:giftPackage")))),n.createElement("div",{className:g.Value},n.createElement("span",null,u(e.price,o.checkout.currencyCode,o.checkout.currencySymbol))))}))):null})),j=o((function(o){var a=o.vm,r=o.isAddingCoupon,i=o.setAddingCoupon,u=o.setCouponError,m=o.setCouponErrorCode,C=o.isOpenCouponCode,E=o.isMobile,h=o.showOnlyMobile,f=s().t,k=n.useState(""),y=k[0],S=k[1],T=n.useState(!1),b=T[0],x=T[1],O=n.useRef(null);n.useEffect((function(){r&&O.current&&O.current.focus()}),[r]);var j=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=y,x(!0),[4,a.onCouponCodeApply()];case 1:return t.sent(),x(!1),S(""),e=a.checkout.giftCardLines&&!!a.checkout.giftCardLines.length,a.couponError?[3,4]:a.checkout.appliedCouponCode||e?(u(!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,u(!0),m(a.couponError),t.label=5;case 5:return[2]}}))}))},I=function(n){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return x(!0),[4,a.removeGiftCardLine(n)];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),x(!1),[2]}}))}))},w=a.step===l.SUCCESS,_=a.step===l.SHIPPING;if(w&&!a.checkout.appliedCouponCode)return null;var L=!!a.checkout.appliedCouponCode||!!(a.checkout.giftCardLines&&a.checkout.giftCardLines.length>0),R=!!a.checkout.appliedCouponCode&&C,D=!r&&a.isCouponCodeVisible&&!a.isCouponCodeRequirementOpen&&a.step!==l.SUCCESS,A=L&&(!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:v.FormSectionTitle},n.createElement("div",{style:{paddingBottom:R?0:6},className:v.Title},f("checkout-page:couponCode"))))),L&&!_&&!a.isCouponCodeRequirementDefult&&n.createElement("div",{className:g.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),n.createElement("div",{className:D?g.InfoRow:""},D&&n.createElement("div",{className:g.ActionTextBtn,onClick:function(){return i(!0)}},f("checkout-page:addCouponCode")),r&&!C&&n.createElement("div",{style:{marginBottom:"10px"}},n.createElement(c,{value:y,placeholder:f("checkout-page:couponCode"),buttonLabel:f("checkout-page:actions.apply"),inputRef:O,onClick:j,isLoading:b,onChange:S})),C&&n.createElement("div",{tabIndex:0,onKeyDown:function(e){"Enter"===e.key&&j()},className:[g.OpenCouponCodeMain,A?g.OpenCouponCodeMainWithMb:""].join(" ")},n.createElement(d,{label:f("checkout-page:couponCode"),type:p.TEXT,value:y,onChange:S}),n.createElement(N,{style:{width:"33%"},text:f("checkout-page:actions.apply"),isLoading:b,onClick:j}))),A&&n.createElement(n.Fragment,null,!!a.checkout.appliedCouponCode&&n.createElement("div",{className:[g.InfoRow,h?g.InfoRowGiftCardMobile:""].join(" ")},n.createElement(P,{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,x(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),[4,a.reInitPaymentMethod()];case 2:return e.sent(),x(!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(P,{vm:a,onClearGiftCode:I,couponCode:e.code,giftCardLine:e}))}))))})),P=o((function(e){var t=e.vm,o=e.onClearCouponCode,a=e.couponCode,c=e.giftCardLine,r=e.onClearGiftCode,i=t.checkout.couponAdjustment,m=s().t;return n.createElement(n.Fragment,null,n.createElement("div",{className:[g.ActionTextBtn,g.NoUnderline,g.Light].join(" ")},m(c?"checkout-page:giftCode":"checkout-page:couponCode"),n.createElement("span",{className:[g.AppliedCoupon,t.isCouponCodeRequirementDefult?"":g.NotClosed].join(" ")},n.createElement("span",{className:g.CouponCode},a),t.step!==l.SUCCESS&&t.isCouponCodeRequirementDefult&&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,u((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,u((null==i?void 0:i.amount)||0,t.checkout.currencyCode,t.checkout.currencySymbol)))))})),I=o((function(e){var t=e.vm,o=e.isAddingNote,a=e.setAddingNote,c=s().t,r=n.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=n.useCallback((function(){a(!0)}),[]),u=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:u,maxLength:320})))}));export{T as CartSummary,j as Coupon,S as CouponErrorCode};
@@ -1 +1 @@
1
- import e from'./../../../../ext/style-inject/dist/style-inject.es.js';var n={ExpandHeader:"style-module_ExpandHeader__LQwWm",Left:"style-module_Left__-N12h",Price:"style-module_Price__OT1Wh",PriceText:"style-module_PriceText__bq1pk",ArrowDown:"style-module_ArrowDown__YhRny",Rotated:"style-module_Rotated__ZPfId",CartSummary:"style-module_CartSummary__m77tn",OpenCouponCodeSummary:"style-module_OpenCouponCodeSummary__ua9wx",HideOnDesktop:"style-module_HideOnDesktop__Vs5AV",ItemsContainer:"style-module_ItemsContainer__QFKQV",DetailsContainer:"style-module_DetailsContainer__PK33m",SuccessPageDetailContainer:"style-module_SuccessPageDetailContainer__-p8kJ",Details:"style-module_Details__hWJ9o",Divider:"style-module_Divider__MNDti",ActionTextBtn:"style-module_ActionTextBtn__7yua4",NoUnderline:"style-module_NoUnderline__FphKn",Light:"style-module_Light__dIcW-",SubTotalInfo:"style-module_SubTotalInfo__JMqK9",InfoRow:"style-module_InfoRow__oAvZS",hideMb:"style-module_hideMb__j7VBr",Label:"style-module_Label__28Bij",Value:"style-module_Value__7rELF",TotalContainer:"style-module_TotalContainer__sGR7d",TitleContainer:"style-module_TitleContainer__LgmJI",Title:"style-module_Title__oMVSD",TotalPricesContainer:"style-module_TotalPricesContainer__-PsOD",TotalPrice:"style-module_TotalPrice__QBdM1",TotalTax:"style-module_TotalTax__9pA4Y",SuccessPageTotalContainer:"style-module_SuccessPageTotalContainer__NZGFF",AppliedCoupon:"style-module_AppliedCoupon__UNo1h",AppliedCouponBgGray:"style-module_AppliedCouponBgGray__MYoYu",NotClosed:"style-module_NotClosed__E-N9z",CouponCode:"style-module_CouponCode__UKPmf",ClearCoupon:"style-module_ClearCoupon__CBAzl",NotificationContainer:"style-module_NotificationContainer__AXfJT",CheckoutNoteContainer:"style-module_CheckoutNoteContainer__d-z4m",CheckoutNoteDisplay:"style-module_CheckoutNoteDisplay__DtnXo",Success:"style-module_Success__VI2Bw",GiftLabel:"style-module_GiftLabel__cazrS",PoweredBy:"style-module_PoweredBy__DKBJF",SuccessPageCartSummary:"style-module_SuccessPageCartSummary__pjgea",OpenCouponCodeMain:"style-module_OpenCouponCodeMain__lZtb3"};e(".style-module_ExpandHeader__LQwWm {\n position: sticky;\n top: 0;\n z-index: 10;\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n padding: 0 24px;\n width: 100%;\n border-top: 1px solid var(--checkout-border-color);\n border-bottom: 1px solid var(--checkout-border-color);\n transition: border-bottom 0.3s;\n user-select: none;\n background-color: var(--checkout-primary-bg-color);\n}\n@media only screen and (min-width: 1000px) {\n .style-module_ExpandHeader__LQwWm {\n display: none;\n }\n}\n.style-module_ExpandHeader__LQwWm .style-module_Left__-N12h {\n display: flex;\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh {\n font-weight: 600;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_PriceText__bq1pk {\n font-weight: 600;\n margin-right: 8px;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny {\n transition: all 0.3s;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny.style-module_Rotated__ZPfId {\n transform: rotate(-180deg);\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn {\n width: 100%;\n background-color: var(--checkout-card-bg-color);\n }\n .style-module_CartSummary__m77tn.style-module_OpenCouponCodeSummary__ua9wx {\n background-color: #fff;\n }\n}\n@media only screen and (min-width: 1000px) {\n .style-module_CartSummary__m77tn.style-module_HideOnDesktop__Vs5AV {\n display: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: 50vh;\n overflow-y: auto;\n margin-bottom: 24px;\n /* Track */\n /* Handle */\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: unset;\n overflow-y: unset;\n margin-bottom: 0;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar {\n width: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-track {\n box-shadow: inset 0 0 20px 20px #e3e7ef;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 20px 20px #000000;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n overflow: hidden;\n width: 100%;\n transition: height 0.3s ease-in-out;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n padding: 0 24px;\n box-shadow: 1px 2px 5px 0px rgba(0, 0, 0, 0.2);\n }\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ {\n padding: 0;\n box-shadow: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ .style-module_Details__hWJ9o {\n padding-top: 0;\n}\n.style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n overflow: hidden;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n padding-top: 24px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_Divider__MNDti {\n width: 100%;\n height: 1px;\n margin: auto;\n background-color: var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4 {\n color: var(--checkout-primary-text-color);\n user-select: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4:hover {\n text-decoration: underline;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_NoUnderline__FphKn:hover {\n text-decoration: none;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_Light__dIcW- {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 {\n padding: 24px 0;\n border-bottom: 1px solid var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS.style-module_hideMb__j7VBr {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Label__28Bij {\n color: var(--checkout-secondary-text-color);\n display: flex;\n align-items: center;\n flex: 1 1 auto;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Value__7rELF {\n flex: 0 0 auto;\n padding-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS:last-of-type {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n display: flex;\n justify-content: space-between;\n margin-top: 12px;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TitleContainer__LgmJI .style-module_Title__oMVSD {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPricesContainer__-PsOD {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPrice__QBdM1 {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalTax__9pA4Y {\n font-size: 14px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n height: 64px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF {\n height: unset;\n margin-top: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_Title__oMVSD {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_TotalPrice__QBdM1 {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 8px;\n background-color: white;\n border-radius: 6px;\n margin-left: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_AppliedCouponBgGray__MYoYu {\n background-color: var(--checkout-secondary-bg-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_NotClosed__E-N9z {\n padding: 4px 4px 4px 4px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_CouponCode__UKPmf {\n font-size: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl {\n cursor: pointer;\n display: flex;\n align-items: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl svg {\n transform: scale(0.8);\n}\n.style-module_CartSummary__m77tn .style-module_NotificationContainer__AXfJT {\n margin-bottom: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 24px;\n width: calc(100% - 2px);\n margin-left: 1px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_Title__oMVSD {\n font-size: 16px;\n color: var(--checkout-primary-text-color);\n margin-bottom: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_CheckoutNoteDisplay__DtnXo {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m.style-module_Success__VI2Bw {\n margin-top: 0;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 0px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS {\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS span {\n margin-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n width: 100%;\n height: 50px;\n justify-content: center;\n align-items: center;\n color: var(--checkout-primary-text-color);\n display: none;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n display: flex;\n }\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF span {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n margin-right: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF a {\n display: flex;\n align-items: center;\n}\n\n.style-module_SuccessPageCartSummary__pjgea {\n background-color: #fff;\n}\n\n.style-module_OpenCouponCodeMain__lZtb3 {\n display: flex;\n}\n.style-module_OpenCouponCodeMain__lZtb3 input {\n width: calc(100% - 12px);\n}");export{n as default};
1
+ import e from'./../../../../ext/style-inject/dist/style-inject.es.js';var n={ExpandHeader:"style-module_ExpandHeader__LQwWm",Left:"style-module_Left__-N12h",Price:"style-module_Price__OT1Wh",PriceText:"style-module_PriceText__bq1pk",ArrowDown:"style-module_ArrowDown__YhRny",Rotated:"style-module_Rotated__ZPfId",CartSummary:"style-module_CartSummary__m77tn",OpenCouponCodeSummary:"style-module_OpenCouponCodeSummary__ua9wx",HideOnDesktop:"style-module_HideOnDesktop__Vs5AV",ItemsContainer:"style-module_ItemsContainer__QFKQV",DetailsContainer:"style-module_DetailsContainer__PK33m",SuccessPageDetailContainer:"style-module_SuccessPageDetailContainer__-p8kJ",Details:"style-module_Details__hWJ9o",Divider:"style-module_Divider__MNDti",ActionTextBtn:"style-module_ActionTextBtn__7yua4",NoUnderline:"style-module_NoUnderline__FphKn",Light:"style-module_Light__dIcW-",SubTotalInfo:"style-module_SubTotalInfo__JMqK9",InfoRow:"style-module_InfoRow__oAvZS",hideMb:"style-module_hideMb__j7VBr",Label:"style-module_Label__28Bij",Value:"style-module_Value__7rELF",TotalContainer:"style-module_TotalContainer__sGR7d",TitleContainer:"style-module_TitleContainer__LgmJI",Title:"style-module_Title__oMVSD",TotalPricesContainer:"style-module_TotalPricesContainer__-PsOD",TotalPrice:"style-module_TotalPrice__QBdM1",TotalTax:"style-module_TotalTax__9pA4Y",SuccessPageTotalContainer:"style-module_SuccessPageTotalContainer__NZGFF",AppliedCoupon:"style-module_AppliedCoupon__UNo1h",AppliedCouponBgGray:"style-module_AppliedCouponBgGray__MYoYu",NotClosed:"style-module_NotClosed__E-N9z",CouponCode:"style-module_CouponCode__UKPmf",ClearCoupon:"style-module_ClearCoupon__CBAzl",NotificationContainer:"style-module_NotificationContainer__AXfJT",CheckoutNoteContainer:"style-module_CheckoutNoteContainer__d-z4m",CheckoutNoteDisplay:"style-module_CheckoutNoteDisplay__DtnXo",Success:"style-module_Success__VI2Bw",GiftLabel:"style-module_GiftLabel__cazrS",PoweredBy:"style-module_PoweredBy__DKBJF",SuccessPageCartSummary:"style-module_SuccessPageCartSummary__pjgea",OpenCouponCodeMain:"style-module_OpenCouponCodeMain__lZtb3",OpenCouponCodeMainWithMb:"style-module_OpenCouponCodeMainWithMb__DqVmh",InfoRowGiftCardMobile:"style-module_InfoRowGiftCardMobile__Kp-zh",Deneme:"style-module_Deneme__4H1Cb"};e(".style-module_ExpandHeader__LQwWm {\n position: sticky;\n top: 0;\n z-index: 10;\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n padding: 0 24px;\n width: 100%;\n border-top: 1px solid var(--checkout-border-color);\n border-bottom: 1px solid var(--checkout-border-color);\n transition: border-bottom 0.3s;\n user-select: none;\n background-color: var(--checkout-primary-bg-color);\n}\n@media only screen and (min-width: 1000px) {\n .style-module_ExpandHeader__LQwWm {\n display: none;\n }\n}\n.style-module_ExpandHeader__LQwWm .style-module_Left__-N12h {\n display: flex;\n align-items: center;\n font-size: 16px;\n font-weight: 600;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh {\n font-weight: 600;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_PriceText__bq1pk {\n font-weight: 600;\n margin-right: 8px;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny {\n transition: all 0.3s;\n display: flex;\n align-items: center;\n}\n.style-module_ExpandHeader__LQwWm .style-module_Price__OT1Wh .style-module_ArrowDown__YhRny.style-module_Rotated__ZPfId {\n transform: rotate(-180deg);\n}\n\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn {\n width: 100%;\n background-color: var(--checkout-card-bg-color);\n }\n .style-module_CartSummary__m77tn.style-module_OpenCouponCodeSummary__ua9wx {\n background-color: #fff;\n }\n}\n@media only screen and (min-width: 1000px) {\n .style-module_CartSummary__m77tn.style-module_HideOnDesktop__Vs5AV {\n display: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: 50vh;\n overflow-y: auto;\n margin-bottom: 24px;\n /* Track */\n /* Handle */\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV {\n max-height: unset;\n overflow-y: unset;\n margin-bottom: 0;\n }\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar {\n width: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-track {\n box-shadow: inset 0 0 20px 20px #e3e7ef;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_ItemsContainer__QFKQV::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 20px 20px #000000;\n border-left: 16px solid transparent;\n}\n.style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n overflow: hidden;\n width: 100%;\n transition: height 0.3s ease-in-out;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_DetailsContainer__PK33m {\n padding: 0 24px;\n box-shadow: 1px 2px 5px 0px rgba(0, 0, 0, 0.2);\n }\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ {\n padding: 0;\n box-shadow: none;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageDetailContainer__-p8kJ .style-module_Details__hWJ9o {\n padding-top: 0;\n}\n.style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n overflow: hidden;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_Details__hWJ9o {\n padding-top: 24px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_Divider__MNDti {\n width: 100%;\n height: 1px;\n margin: auto;\n background-color: var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4 {\n color: var(--checkout-primary-text-color);\n user-select: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4:hover {\n text-decoration: underline;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_NoUnderline__FphKn:hover {\n text-decoration: none;\n}\n.style-module_CartSummary__m77tn .style-module_ActionTextBtn__7yua4.style-module_Light__dIcW- {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 {\n padding: 24px 0;\n border-bottom: 1px solid var(--checkout-border-color);\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS.style-module_hideMb__j7VBr {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Label__28Bij {\n color: var(--checkout-secondary-text-color);\n display: flex;\n align-items: center;\n flex: 1 1 auto;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS .style-module_Value__7rELF {\n flex: 0 0 auto;\n padding-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_SubTotalInfo__JMqK9 .style-module_InfoRow__oAvZS:last-of-type {\n margin-bottom: 0;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n display: flex;\n justify-content: space-between;\n margin-top: 12px;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TitleContainer__LgmJI .style-module_Title__oMVSD {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPricesContainer__-PsOD {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalPrice__QBdM1 {\n font-size: 20px;\n font-weight: 600;\n}\n.style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d .style-module_TotalTax__9pA4Y {\n font-size: 14px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_TotalContainer__sGR7d {\n height: 64px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF {\n height: unset;\n margin-top: 10px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_Title__oMVSD {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_SuccessPageTotalContainer__NZGFF .style-module_TotalPrice__QBdM1 {\n font-weight: 500 !important;\n line-height: 32px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 8px;\n background-color: white;\n border-radius: 6px;\n margin-left: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_AppliedCouponBgGray__MYoYu {\n background-color: var(--checkout-secondary-bg-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h.style-module_NotClosed__E-N9z {\n padding: 4px 4px 4px 4px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_CouponCode__UKPmf {\n font-size: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl {\n cursor: pointer;\n display: flex;\n align-items: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl svg {\n transform: scale(0.8);\n}\n.style-module_CartSummary__m77tn .style-module_NotificationContainer__AXfJT {\n margin-bottom: 14px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 24px;\n width: calc(100% - 2px);\n margin-left: 1px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_Title__oMVSD {\n font-size: 16px;\n color: var(--checkout-primary-text-color);\n margin-bottom: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m .style-module_CheckoutNoteDisplay__DtnXo {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m.style-module_Success__VI2Bw {\n margin-top: 0;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_CheckoutNoteContainer__d-z4m {\n margin-top: 0px;\n }\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS {\n display: flex;\n align-items: center;\n}\n.style-module_CartSummary__m77tn .style-module_GiftLabel__cazrS span {\n margin-left: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n width: 100%;\n height: 50px;\n justify-content: center;\n align-items: center;\n color: var(--checkout-primary-text-color);\n display: none;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF {\n display: flex;\n }\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF span {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n margin-right: 8px;\n}\n.style-module_CartSummary__m77tn .style-module_PoweredBy__DKBJF a {\n display: flex;\n align-items: center;\n}\n\n.style-module_SuccessPageCartSummary__pjgea {\n background-color: #fff;\n}\n\n.style-module_OpenCouponCodeMain__lZtb3 {\n display: flex;\n}\n.style-module_OpenCouponCodeMain__lZtb3 input {\n width: calc(100% - 12px);\n}\n.style-module_OpenCouponCodeMain__lZtb3.style-module_OpenCouponCodeMainWithMb__DqVmh {\n margin-bottom: 12px;\n}\n\n.style-module_InfoRowGiftCardMobile__Kp-zh {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 10px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh.style-module_hideMb__j7VBr {\n margin-bottom: 0;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_Label__28Bij {\n color: var(--checkout-secondary-text-color);\n display: flex;\n align-items: center;\n flex: 1 1 auto;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_Value__7rELF {\n flex: 0 0 auto;\n padding-left: 8px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh:last-of-type {\n margin-bottom: 0;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4 {\n color: var(--checkout-primary-text-color);\n user-select: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4:hover {\n text-decoration: underline;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4.style-module_NoUnderline__FphKn:hover {\n text-decoration: none;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_ActionTextBtn__7yua4.style-module_Light__dIcW- {\n color: var(--checkout-secondary-text-color);\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h {\n display: flex;\n align-items: center;\n padding: 4px 4px 4px 8px;\n background-color: white;\n border-radius: 6px;\n margin-left: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h.style-module_AppliedCoupon__UNo1h {\n background-color: var(--checkout-secondary-bg-color);\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h.style-module_NotClosed__E-N9z {\n padding: 4px 4px 4px 4px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h .style-module_CouponCode__UKPmf {\n font-size: 14px;\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl {\n cursor: pointer;\n display: flex;\n align-items: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_InfoRowGiftCardMobile__Kp-zh .style-module_AppliedCoupon__UNo1h .style-module_ClearCoupon__CBAzl svg {\n transform: scale(0.8);\n}\n\n.style-module_Deneme__4H1Cb {\n margin-top: 10px;\n}");export{n 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"next/link.js";import a from"react-tooltip";import s,{CheckoutStep as l}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as f}from"./steps/step-payment/index.js";import{CouponErrorCode as g,Coupon as v,CartSummary as h}from"./components/cart-summary/index.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as E}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 y}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{StepSuccess as x}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import j from"./components/master-pass/modal-otp/index.js";import C from"./components/master-pass/modal-response/index.js";import N from"./components/master-pass/modal-success/index.js";import{Image as P}from"../image/index.js";import b,{Step as O}from"./components/step-container/index.js";import{StockError as S}from"./components/error/stock-error/index.js";import{FullscreenLoading as F}from"./components/fullscreen-loading/index.js";import M from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as w}from"./components/form-item/model.js";import{Button as I}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import B from"./components/offer-product/index.js";import L from"./components/offer-product/placeholder-offer-product.js";import D from"./components/svg/ikas.js";import V from"./style.module.scss.js";import{Analytics as U}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import R from"./components/svg/success-circle.js";import z from"./components/offer-product/offer-dots/index.js";import _ from"./components/offer-product/offer-arrows/index.js";import H from"./components/offer-product/useCampaignOffer.js";var G=r((function(e){var t,r,n,m,p,u,f,g=e.checkout,v=e.checkoutSettings,y=e.customizationProps,b=e.returnPolicy,O=e.privacyPolicy,M=e.termsOfService,T=e.imprint,w=e.shippingPolicy,G=d().t,X=i(),K=o.useState((function(){return new s(g,v,X,b,O,M,T,w,G,y||{})}))[0],Z=H(K),$=Z.setShowDetailPage,ee=Z.setActiveIndex,te=Z.setIsActiveOverlay,oe=Z.handlePrev,re=Z.handleNext,ie=Z.isPopupClosedIndexPage,ne=Z.isPopupShowIndexPage,ae=Z.isShowSuccessPageMiddlePhase,se=Z.activeIndex;o.useMemo((function(){return Date.now()}),[]);return K.step,l.PAYMENT,o.useEffect((function(){K.checkoutSettings.isAccountRequired&&!K.checkout.hasCustomer&&X.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==l.SUCCESS&&U.beginCheckout(K.checkout),U.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){K.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED"),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")}(y)}),[y]),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)?(X.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(A,{pageType:E.CHECKOUT,pageTitle:((null===(n=K.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+G("checkout-page:securePayment"),pageDescription:G("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:V.CheckoutPage},ae?o.createElement("div",{className:V.FullPageOfferMain},o.createElement("div",{className:V.FullPageOfferContainer},o.createElement("div",{className:V.LogoMain},(null===(m=K.customizationProps)||void 0===m?void 0:m.logo)?o.createElement("div",{className:V.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:V.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:V.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:V.OfferSuccessHeader},o.createElement(R,{className:V.SuccessCircle}),o.createElement("span",{className:V.SuccessTitle},G("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:V.OfferOrderInfoMain},o.createElement("div",{className:V.InfoTitle},G("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:V.InfoText},"#"+(K.checkout.orderNumber||"")," ",K.checkout.dateStr))),o.createElement("div",null,o.createElement(I,{classes:V.OfferButton,isLine:!0,text:G("checkout-page:actions.goOrderDetailPage"),onClick:function(){$(!1)}}))),o.createElement("div",null,K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:V.CampaignOfferMain},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},desktopMiddlePhase:!0,step:K.step})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{vm:K,activeIndex:se}))))):null,o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:V.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[V.Left].join(" ")},o.createElement("div",{className:V.LeftContent},o.createElement("div",null,o.createElement(Y,{vm:K}),K.hasStockError&&o.createElement("div",{className:V.ErrorContainer},o.createElement(S,{vm:K,error:K.error})),!K.hasStockError&&o.createElement(o.Fragment,null,K.step!==l.SUCCESS&&o.createElement(h,{vm:K,allowExpand:!0}),K.step===l.SUCCESS?o.createElement(x,{vm:K}):o.createElement(o.Fragment,null,!!(null===(f=K.customizationProps)||void 0===f?void 0:f.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(L,{vm:K}),ne&&o.createElement("div",{className:[V.MiddlePhaseOverlay,ne?V.MiddlePhaseOverlayPopup:""].join(" ")}),K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:[V.CampaignOfferMain,ne?V.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},step:K.step,isPopupClosed:ie,isPopupShow:ne,closePopup:function(){return te(!1)},showPopup:function(){return te(!0)}})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{isPopupShow:ne,vm:K,activeIndex:se})),K.isCouponCodeRequirementOpen&&o.createElement(W,{vm:K}),o.createElement(q,{vm:K}))),o.createElement("div",{className:V.Space})),o.createElement(J,{vm:K}))),o.createElement("div",{className:V.Right},o.createElement("div",{className:V.RightContent},o.createElement(h,{vm:K}),!K.isPoweredByHidden&&o.createElement("div",{className:V.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(D,null))))),!!K.policyModalText&&o.createElement(k,{title:K.policyModalTitle,modalContent:K.policyModalText,onClose:function(){K.policyModalText=""}}),K.isContactModalVisible&&o.createElement(Q,{vm:K,setVisible:K.setContactModalVisible}),K.mpVM.isOtpModalVisible&&o.createElement(j,{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(N,{visible:K.mpVM.isSuccessModalVisible,type:K.mpVM.successModalType,onClose:K.mpVM.onSuccessModalClose}))):o.createElement(F,null)})),Y=r((function(e){var t,r,i,a,s=e.vm,l=d().t;return o.createElement("div",{className:V.Header},o.createElement(n,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.customizationProps.logo,sizes:"360px"})):(null===(r=s.merchantSettings)||void 0===r?void 0:r.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:V.LoginText},o.createElement("span",{className:V.LoginCta},l("checkout-page:alreadyHaveAnAccount")),o.createElement(n,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:V.LoginBtn},l("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:V.CustomerInfo},o.createElement("div",{className:V.Name},s.checkout.customerFullName),o.createElement("div",{className:V.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),W=r((function(e){var t=e.vm,r=d().t,i=o.useState(!1),n=i[0],a=i[1],s=o.useState(null),l=s[0],c=s[1],m=o.useMemo((function(){switch(l){case g.COUPON_CODE_NOT_EXIST:return r("checkout-page:giftCodeErrorDescription");case g.COUPON_CODE_NOT_EXIST_FOR_GUESS:return r("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[l]);return o.createElement("div",{className:V.CouponContainer},n&&o.createElement("div",{className:V.NotificationContainer},o.createElement(M,{type:"warning",title:r("checkout-page:giftCodeErrorTitle"),content:m,onClose:function(){a(!1),c(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:n?12:0}},o.createElement(v,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:c})))})),q=r((function(e){var t=e.vm,r=d().t,i=o.useMemo((function(){switch(t.step){case l.INFO:return o.createElement(p,{vm:t});case l.SHIPPING:return o.createElement(u,{vm:t});case l.PAYMENT:return o.createElement(f,{vm:t});case l.SUCCESS:return o.createElement(x,{vm:t})}}),[t,t.step]),n=[new O(r("checkout-page:address"),t.step===l.INFO,t.step!==l.INFO,t.step!==l.INFO?o.createElement("div",{className:V.AdressStepInfo},o.createElement(X,{vm:t}),!t.isUpsellOrder&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==l.INFO?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(X,{vm:t})):void 0),new O(r("checkout-page:payment"),t.step===l.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new O(r("checkout-page:shipping"),t.step===l.SHIPPING,t.step===l.PAYMENT,t.step===l.PAYMENT?o.createElement("div",{className:V.AdressStepInfo},o.createElement(K,{vm:t}),!t.isUpsellOrder&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===l.PAYMENT?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(b,{steps:n,stepContent:i})})),X=r((function(e){var t,r,i,n,a,s,l,c,m,p=e.vm,u=d().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:V.Address},o.createElement("div",{className:[V.Text,V.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:V.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:V.Text},u("checkout-page:receiver")),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},f)),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(l=p.checkout.shippingAddress)||void 0===l?void 0:l.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[V.Text,V.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(c=p.checkout.billingAddress)||void 0===c?void 0:c.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),K=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:V.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?r("checkout-page:free"):m(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):r("checkout-page:standartShipping"))})),J=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Footer},o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.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:V.FooterBullet},"•"),o.createElement("div",{className:V.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:V.FooterBullet},"•"),o.createElement("div",{className:V.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=d().t,m=o.useState(!1),p=m[0],u=m[1],f=o.useState(!1),g=f[0],v=f[1],h=o.useState(new y({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 E=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(k,{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(T,{type:w.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:c("checkout-page:contactFormCta")}),o.createElement(I,{style:{width:"100%",marginTop:"24px"},text:c(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:E})),onClose:function(){return l(!1)}})}));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"next/link.js";import a from"react-tooltip";import s,{CheckoutStep as l}from"./model.js";import{IkasStorefrontConfig as c}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as f}from"./steps/step-payment/index.js";import{CouponErrorCode as g,Coupon as v,CartSummary as h}from"./components/cart-summary/index.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as E}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 y}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{StepSuccess as x}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import j from"./components/master-pass/modal-otp/index.js";import C from"./components/master-pass/modal-response/index.js";import N from"./components/master-pass/modal-success/index.js";import{Image as P}from"../image/index.js";import b,{Step as O}from"./components/step-container/index.js";import{StockError as M}from"./components/error/stock-error/index.js";import{FullscreenLoading as S}from"./components/fullscreen-loading/index.js";import F from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as w}from"./components/form-item/model.js";import{Button as I}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import B from"./components/offer-product/index.js";import L from"./components/offer-product/placeholder-offer-product.js";import D from"./components/svg/ikas.js";import V from"./style.module.scss.js";import{Analytics as U}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import R from"./components/svg/success-circle.js";import z from"./components/offer-product/offer-dots/index.js";import _ from"./components/offer-product/offer-arrows/index.js";import H from"./components/offer-product/useCampaignOffer.js";import G from"../../hooks/useDimension.js";var Y=r((function(e){var t,r,n,m,p,u,f,g=e.checkout,v=e.checkoutSettings,y=e.customizationProps,b=e.returnPolicy,O=e.privacyPolicy,F=e.termsOfService,T=e.imprint,w=e.shippingPolicy,G=d().t,Y=i(),K=o.useState((function(){return new s(g,v,Y,b,O,F,T,w,G,y||{})}))[0],J=H(K),$=J.setShowDetailPage,ee=J.setActiveIndex,te=J.setIsActiveOverlay,oe=J.handlePrev,re=J.handleNext,ie=J.isPopupClosedIndexPage,ne=J.isPopupShowIndexPage,ae=J.isShowSuccessPageMiddlePhase,se=J.activeIndex;o.useMemo((function(){return Date.now()}),[]);return K.step,l.PAYMENT,o.useEffect((function(){K.checkoutSettings.isAccountRequired&&!K.checkout.hasCustomer&&Y.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),new URLSearchParams(window.location.search).get("step")!==l.SUCCESS&&U.beginCheckout(K.checkout),U.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){K.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED"),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")}(y)}),[y]),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)?(Y.push("/account/login?redirect="+encodeURIComponent(K.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(A,{pageType:E.CHECKOUT,pageTitle:((null===(n=K.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+G("checkout-page:securePayment"),pageDescription:G("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:V.CheckoutPage},ae?o.createElement("div",{className:V.FullPageOfferMain},o.createElement("div",{className:V.FullPageOfferContainer},o.createElement("div",{className:V.LogoMain},(null===(m=K.customizationProps)||void 0===m?void 0:m.logo)?o.createElement("div",{className:V.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:V.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:V.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:V.OfferSuccessHeader},o.createElement(R,{className:V.SuccessCircle}),o.createElement("span",{className:V.SuccessTitle},G("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:V.OfferOrderInfoMain},o.createElement("div",{className:V.InfoTitle},G("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:V.InfoText},"#"+(K.checkout.orderNumber||"")," ",K.checkout.dateStr))),o.createElement("div",null,o.createElement(I,{classes:V.OfferButton,isLine:!0,text:G("checkout-page:actions.goOrderDetailPage"),onClick:function(){$(!1)}}))),o.createElement("div",null,K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:V.CampaignOfferMain},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},desktopMiddlePhase:!0,step:K.step})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{vm:K,activeIndex:se}))))):null,o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:V.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[V.Left].join(" ")},o.createElement("div",{className:V.LeftContent},o.createElement("div",null,o.createElement(W,{vm:K}),K.hasStockError&&o.createElement("div",{className:V.ErrorContainer},o.createElement(M,{vm:K,error:K.error})),!K.hasStockError&&o.createElement(o.Fragment,null,K.step!==l.SUCCESS&&o.createElement(h,{vm:K,allowExpand:!0}),K.step===l.SUCCESS?o.createElement(x,{vm:K}):o.createElement(o.Fragment,null,!!(null===(f=K.customizationProps)||void 0===f?void 0:f.showCampaignOffersDesign)&&c.getIsEditor()&&o.createElement(L,{vm:K}),ne&&o.createElement("div",{className:[V.MiddlePhaseOverlay,ne?V.MiddlePhaseOverlayPopup:""].join(" ")}),K.campaignOffers&&!!K.campaignOffers.length&&K.isCampaignOfferLoaded&&o.createElement("div",{className:[V.CampaignOfferMain,ne?V.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:V.OfferSlider},K.campaignOffers.map((function(e,t){var r;return o.createElement(B,{vm:K,campaignOffer:e,index:t,activeIndex:se,offersLength:(null===(r=K.campaignOffers)||void 0===r?void 0:r.length)||0,handlePrev:oe,handleNext:re,setActiveIndex:function(e){return ee(e)},step:K.step,isPopupClosed:ie,isPopupShow:ne,closePopup:function(){return te(!1)},showPopup:function(){return te(!0)}})}))),K.campaignOffers.length>1&&o.createElement(_,{handlePrev:oe,handleNext:re}),K.campaignOffers.length>1&&o.createElement(z,{isPopupShow:ne,vm:K,activeIndex:se})),K.isCouponCodeRequirementOpen&&o.createElement(q,{vm:K}),o.createElement(X,{vm:K}))),o.createElement("div",{className:V.Space})),o.createElement(Q,{vm:K}))),o.createElement("div",{className:V.Right},o.createElement("div",{className:V.RightContent},o.createElement(h,{vm:K}),!K.isPoweredByHidden&&o.createElement("div",{className:V.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(D,null))))),!!K.policyModalText&&o.createElement(k,{title:K.policyModalTitle,modalContent:K.policyModalText,onClose:function(){K.policyModalText=""}}),K.isContactModalVisible&&o.createElement(Z,{vm:K,setVisible:K.setContactModalVisible}),K.mpVM.isOtpModalVisible&&o.createElement(j,{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(N,{visible:K.mpVM.isSuccessModalVisible,type:K.mpVM.successModalType,onClose:K.mpVM.onSuccessModalClose}))):o.createElement(S,null)})),W=r((function(e){var t,r,i,a,s=e.vm,l=d().t;return o.createElement("div",{className:V.Header},o.createElement(n,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.customizationProps.logo,sizes:"360px"})):(null===(r=s.merchantSettings)||void 0===r?void 0:r.logo)?o.createElement("div",{className:V.Logo},o.createElement(P,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:V.LoginText},o.createElement("span",{className:V.LoginCta},l("checkout-page:alreadyHaveAnAccount")),o.createElement(n,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:V.LoginBtn},l("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:V.CustomerInfo},o.createElement("div",{className:V.Name},s.checkout.customerFullName),o.createElement("div",{className:V.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),q=r((function(e){var t=e.vm,r=d().t,i=o.useState(!1),n=i[0],a=i[1],s=o.useState(null),l=s[0],c=s[1],m=G().isMobile,p=o.useMemo((function(){switch(l){case g.COUPON_CODE_NOT_EXIST:return r("checkout-page:giftCodeErrorDescription");case g.COUPON_CODE_NOT_EXIST_FOR_GUESS:return r("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[l]);return o.createElement("div",{className:V.CouponContainer},n&&o.createElement("div",{className:V.NotificationContainer},o.createElement(F,{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(v,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:c,showOnlyMobile:!0,isMobile:m})))})),X=r((function(e){var t=e.vm,r=d().t,i=o.useMemo((function(){switch(t.step){case l.INFO:return o.createElement(p,{vm:t});case l.SHIPPING:return o.createElement(u,{vm:t});case l.PAYMENT:return o.createElement(f,{vm:t});case l.SUCCESS:return o.createElement(x,{vm:t})}}),[t,t.step]),n=[new O(r("checkout-page:address"),t.step===l.INFO,t.step!==l.INFO,t.step!==l.INFO?o.createElement("div",{className:V.AdressStepInfo},o.createElement(K,{vm:t}),!t.isUpsellOrder&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==l.INFO?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0),new O(r("checkout-page:payment"),t.step===l.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||n.splice(1,0,new O(r("checkout-page:shipping"),t.step===l.SHIPPING,t.step===l.PAYMENT,t.step===l.PAYMENT?o.createElement("div",{className:V.AdressStepInfo},o.createElement(J,{vm:t}),!t.isUpsellOrder&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:V.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===l.PAYMENT?o.createElement("div",{className:V.AddressStepInfoMobile},o.createElement(J,{vm:t})):void 0)),o.createElement(b,{steps:n,stepContent:i})})),K=r((function(e){var t,r,i,n,a,s,l,c,m,p=e.vm,u=d().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:V.Address},o.createElement("div",{className:[V.Text,V.WithMBottom].join(" ")},(null===(a=p.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:V.Text},f):o.createElement(o.Fragment,null,o.createElement("div",{className:V.Text},u("checkout-page:receiver")),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},f)),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(s=p.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(l=p.checkout.shippingAddress)||void 0===l?void 0:l.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[V.Text,V.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[V.Text,V.Gray].join(" ")},p.isDigitalOnly?null===(c=p.checkout.billingAddress)||void 0===c?void 0:c.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),J=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:V.LightText}," / "+(0===t.checkout.shippingLines[0].finalPrice?r("checkout-page:free"):m(t.checkout.shippingLines[0].finalPrice,t.checkout.currencyCode,t.checkout.currencySymbol)))):r("checkout-page:standartShipping"))})),Q=r((function(e){var t=e.vm,r=d().t;return o.createElement("div",{className:V.Footer},o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:V.FooterBullet},"•"),o.createElement("div",{className:V.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:V.FooterBullet},"•"),o.createElement("div",{className:V.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:V.FooterBullet},"•"),o.createElement("div",{className:V.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},r("checkout-page:shippingPolicy"))))})),Z=r((function(r){var i,n,a,s=r.vm,l=r.setVisible,c=d().t,m=o.useState(!1),p=m[0],u=m[1],f=o.useState(!1),g=f[0],v=f[1],h=o.useState(new y({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 E=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(k,{title:c("checkout-page:contactForm"),modalContent:o.createElement("div",null,g&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(F,{type:"success",title:c("checkout-page:contactFormSent"),content:c("checkout-page:contactFormDescription")})),o.createElement(T,{type:w.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:c("checkout-page:contactFormCta")}),o.createElement(I,{style:{width:"100%",marginTop:"24px"},text:c(g?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!h.message,onClick:E})),onClose:function(){return l(!1)}})}));export{Y as default};
@@ -67,6 +67,7 @@ export default class CheckoutViewModel {
67
67
  error?: CheckoutError | null;
68
68
  couponError?: string | null;
69
69
  successTransaction?: IkasOrderTransaction;
70
+ successTransactions?: IkasOrderTransaction[];
70
71
  mpVM: MasterPassModel;
71
72
  showTestModal: boolean;
72
73
  t: TFunction;
@@ -139,6 +140,7 @@ export default class CheckoutViewModel {
139
140
  onShippingMethodChange: (shippingMethod: IkasAvailableShippingMethod) => Promise<void>;
140
141
  onStockLocationChange: (location: IkasStockLocation) => Promise<void>;
141
142
  onCouponCodeApply: () => Promise<void>;
143
+ removeGiftCardLine: (giftCardId: string | null) => Promise<void>;
142
144
  getAvailableShippingZones: () => Promise<void>;
143
145
  onSelectedShippingAddressIdChange: (value: string) => void;
144
146
  onSelectedBillingAddressIdChange: (value: string) => void;
@@ -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,IkasOrderPaymentStatus as p,IkasTransactionStatus as m,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as g,IkasOrderLineItemStatus as v,IkasAmountType as y,IkasCampaignOfferProductApplicablePriceEnum as S}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 b}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 P}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 A}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 E}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as w}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 O}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 N from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import D from"../../store/checkout/index.js";import T from"../../store/cart/api.js";import M,{MFS_ELEMENT_ID as L,MFS_SCRIPT_URL as x}from"./modelMasterPass.js";import G from"../../store/product/index.js";import{TransactionCardAssociationEnum as _,SaveCartInput as U,CheckStocksLineInput as V}from"@ikas/storefront-api";import{IkasBaseStore as F}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as B}from"@ikas/storefront-config";import{Analytics as K}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Y from"../../models/data/order/address/ikas-localized-order-address.js";import Z from"../../store/location/index.js";import{getCookieValue as H}from"../../utils/helper.js";var q,W,Q=/^\d+$/,z="undefined"==typeof localStorage,X=function(){function Q(a,d,C,I,Q,X,ee,te,ie,se){var ne=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=q.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.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(ne,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,F.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(ne,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(B.getIsEditor())return this.step=q.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===q.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(q.INFO)];if(this.step!==q.PAYMENT||this.canProceedToPayment){if(this.step===q.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(q.INFO)];if(![q.INFO,q.SUCCESS,q.SHIPPING,q.PAYMENT].includes(this.step))return[2,this.changeStep(q.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(q.INFO)]:[2,this.changeStep(q.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),n&&(this.error={type:W.PAYMENT_ERROR,data:r||null}),this.step!==q.SHIPPING&&this.step!==q.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new b(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==q.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!==q.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=q.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==q.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==q.SUCCESS||this.checkout.orderPaymentStatus!==p.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:W.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==q.PAYMENT&&this.step!==q.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length)return this.error={type:W.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===q.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(q.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return this.isCheckoutLoaded=!0,K.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(ne,void 0,void 0,(function(){var e,i;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.successTransaction=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,r,a;return t(this,(function(t){switch(t.label){case 0:return e=new U(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!==q.INFO&&this.step!==q.SHIPPING||this.isDigitalOnly||(e.billingAddress=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,T.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===(n=s.extensions)||void 0===n?void 0:n.code)?{type:W.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(r=s.extensions)||void 0===r?void 0:r.code)?{type:W.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(a=s.extensions)||void 0===a?void 0:a.code)?{type:W.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:W.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(ne,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(ne,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p;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===(u=B.getStockLocationIds())||void 0===u?void 0:u.length)?B.getStockLocationIds():null,[4,D.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:W.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:W.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(ne,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,F.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(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,D.getAvailableShippingCountries({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(ne,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?[4,D.listStockLocation({id:{in:B.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:W.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return B.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 V(e)})),stockLocationIdList:B.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:W.API_ERROR},[2];s=B.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=ne.shippingCountryIds)||void 0===e?void 0:e.length)||(ne.error={type:W.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;ne.deliveryMethod!==e&&("address"===e&&(ne.checkout.stockLocationId=null,(null===(t=ne.customerAddresses)||void 0===t?void 0:t.length)?ne.onSelectedShippingAddressIdChange(ne.customerAddresses[0].id||"-1"):(ne.checkout.shippingAddress=new Y,ne.checkout.shippingAddress.countrySettings=ne.countrySettings,ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones)),ne.deliveryMethod=e,ne.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(ne,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:W.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,f=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=B.getPaymentGateways().map((function(e){return e.id})),[4,D.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:B.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess&&(null===(h=s.data)||void 0===h?void 0:h.length)?(n=s.data,this.step===q.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(f.checkout.currencyCode)})),(o=null===(p=this.checkout.shippingAddress)||void 0===p?void 0:p.country)&&o.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(o.iso2||"")}))),a=null===(m=this.checkout.billingAddress)||void 0===m?void 0:m.country,!o&&a&&a.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")})))),c=[],r(B.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&c.push(t)})),this.paymentGateways=e?n:c,d=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=f.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==d?d:0),[3,4])):(this.error={type:W.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==q.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===q.PAYMENT&&(u=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=u,(l=document.createElement("script")).id=L,l.src=x,l.onload=function(){f.mpVM.checkMasterPass({checkout:f.checkout,store:F.getInstance()})},document.head.appendChild(l)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(ne,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;ne.store.customerStore.customer?(null===(e=ne.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=ne.checkoutSettings,e.shippingZones=ne.shippingZones})),ne.checkout.customer=new A(i(i({},ne.store.customerStore.customer),{notificationsAccepted:ne.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):ne.checkout.customer=new A(ne.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ne.checkout.shippingAddress&&(ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones,ne.checkout.shippingAddress.countrySettings=ne.countrySettings,ne.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){ne.checkout.billingAddress&&(ne.checkout.billingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.billingAddress.shippingZones=ne.shippingZones,ne.checkout.billingAddress.countrySettings=ne.countrySettings,ne.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!ne.isDigitalOnly)if(ne.isInStoreDelivery)ne.setCheckoutShippingAddressSettings();else if(ne.checkout.shippingAddress){if(ne.store.customerStore.customer){var e=null==(t=ne.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ne.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return ne.onSelectedShippingAddressIdChange(e.id||"-1"),void ne.setCheckoutShippingAddressSettings()}ne.checkout.shippingAddress=new Y(n(ne.checkout.shippingAddress)||{}),ne.setCheckoutShippingAddressSettings()}else if(ne.store.customerStore.customer){var t=ne.customerAddresses;ne.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else ne.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ne.useDifferentAddress=!!localStorage.getItem("sAddr"),ne.checkout.billingAddress){if(ne.store.customerStore.customer){var e=null==(t=ne.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ne.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return ne.onSelectedBillingAddressIdChange(e.id||"-1"),void ne.setCheckoutBillingAddressSettings()}ne.checkout.billingAddress=new Y(n(ne.checkout.billingAddress)||{}),ne.setCheckoutBillingAddressSettings()}else if(ne.store.customerStore.customer){var t=ne.customerAddresses;ne.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||ne.useDifferentAddress||!ne.checkout.shippingAddress||ne.isInStoreDelivery||(ne.checkout.billingAddress=new Y(n(ne.checkout.shippingAddress)),ne.setCheckoutBillingAddressSettings())}else ne.onSelectedBillingAddressIdChange("-1"),ne.useDifferentAddress||!ne.checkout.shippingAddress||ne.isInStoreDelivery||(ne.checkout.billingAddress=new Y(n(ne.checkout.shippingAddress)),ne.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(ne,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(ne,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(ne,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,6,,7]),[4,T.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===q.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,5];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!==q.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice?[3,5]:[4,this.listPaymentGateways()]):[3,5];case 4:t.sent(),t.label=5;case 5:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(ne,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,Z.getAvailableShippingZones({salesChannelId:B.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(ne.selectedShippingAddressId=e,"-1"===e)ne.checkout.shippingAddress=new Y,ne.checkout.shippingAddress.countrySettings=ne.countrySettings;else{var i=null===(t=ne.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ne.checkout.shippingAddress=new Y(i),ne.checkout.shippingAddress.countrySettings=ne.countrySettings)}ne.checkout.shippingAddress&&(ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(ne.selectedBillingAddressId=e,"-1"===e)ne.checkout.billingAddress=new Y,ne.checkout.billingAddress.countrySettings=ne.countrySettings;else{var i=null===(t=ne.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ne.checkout.billingAddress=new Y(i),ne.checkout.billingAddress.countrySettings=ne.countrySettings)}ne.checkout.billingAddress&&(ne.checkout.billingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.billingAddress.shippingZones=ne.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){ne.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(ne.cardData&&(!(e.length>ne.cardData.cardNumber.length)||J(e))){var i=(ne.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!ne.installmentInfo?ne.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(ne.cardData.installmentCount=1,ne.installmentInfo=void 0),(null===(t=ne.installmentInfo)||void 0===t?void 0:t.cardAssociation)===_.AMERICAN_EXPRESS?ne.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(" "):ne.cardData.cardNumber=$(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(ne,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){ne.cardData&&(ne.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(ne.cardData&&(!(e.length>ne.cardData.expirationDate.length)||J(e))){if(0===(null===(t=ne.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(ne.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(ne.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(ne.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(ne.cardData.expirationDate=$(d,2).join(" / "))}},this.onCvcChange=function(e){if(ne.cardData&&(!(e.length>ne.cardData.cvv.length)||J(e))){if(ne.installmentInfo){if(ne.installmentInfo.cardAssociation===_.AMERICAN_EXPRESS&&e.length>4)return;if(ne.installmentInfo.cardAssociation!==_.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;ne.cardData.cvv=e}},this.saveAddress=function(s){return e(ne,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=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 P(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=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.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.onGoToCartClick=function(){ne.router.push("/cart")},this.onBackToShoppingClick=function(){ne.router.push("/")},this.onGoToLoginClick=function(){ne.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0: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=1;case 1:return t.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:t.sent(),t.label=3;case 3:return[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(q.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(q.SHIPPING):this.changeStep(q.PAYMENT),[3,7]);case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(ne,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.changeStep(q.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(ne,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(q.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ne.canPerformPayment||(ne.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){ne.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(ne,void 0,void 0,(function(){var e,i;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:return t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6: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 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:W.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(ne,void 0,void 0,(function(){var e,i;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:return t.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),[4,this.saveCart()];case 4:return t.sent(),this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 5:return t.sent(),[3,7];case 6:return(i=t.sent()).type?this.error=i:this.error={type:W.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,f,g,v,y,S;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(c=this.mpVM.selectedCard)||void 0===c?void 0:c.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(d=this.cardData)||void 0===d?void 0:d.installmentCount)?[2]:[4,D.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(h=this.mpVM.selectedCard)||void 0===h?void 0:h.Name},paymentGatewayId:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.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:H("_fbp"),_fbc:H("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,D.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===u.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:H("_fbp"),_fbc:H("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[m.SUCCESS,m.AUTHORIZED].includes(r),a=r===m.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(S=null==s?void 0:s.data)||void 0===S?void 0:S.returnSlug))throw{data:s.firstErrorMessage,type:W.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(ne,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 this.changeStep(q.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){ne.changeStep(q.INFO)},this.onBackToShippingClick=function(){ne.changeStep(q.SHIPPING)},this.setCustomerConsentGranted=function(e){ne.checkout.customer&&(ne.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){ne.useDifferentAddress=e,ne.useDifferentAddress?(localStorage.setItem("sAddr","1"),ne.checkout.billingAddress=ne.checkout.billingAddress||new Y,ne.checkout.billingAddress.countrySettings=ne.countrySettings):(localStorage.removeItem("sAddr"),ne.checkout.billingAddress=new Y(i({},ne.checkout.shippingAddress)))},this.setShouldSaveAddress=function(e){ne.shouldSaveAddress=e},this.setAddressTitle=function(e){ne.addressTitle=e},this.reInitPaymentMethod=function(){return e(ne,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,6];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[2]}}))}))},this.createStripePaymentIntent=function(i){return e(ne,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:W.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(ne,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:W.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(ne,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(ne,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.setPaymentGateway=function(i){return e(ne,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!==q.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 this.checkout.selectedPaymentGateway=e,this.step!==q.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new N,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(ne,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,T.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id})];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){ne.cardData&&(ne.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return z||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(ne,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){ne.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(ne,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,G.searchProducts({input:{productIdList:n,priceListId:B.getPriceListId(),salesChannelId:B.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===y.AMOUNT&&(s=!0),new w(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===S.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new E(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(ne,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===q.SUCCESS?g.POST_CHECKOUT:g.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(ne,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,T.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===q.SUCCESS?q.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(ne,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(ne,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!==v.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(ne,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=C,this.returnPolicy=I,this.privacyPolicy=Q,this.termsOfService=X,this.imprint=ee,this.shippingPolicy=te,this.t=ie,this.customizationProps=se,this.mpVM=new M,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new O({currentLocale:B.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(Q.prototype,"merchantSettings",{get:function(){return new I(B.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.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(Q.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=F.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(Q.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(Q.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"finalPrice",{get:function(){return this.step===q.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===W.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly?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)!==W.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.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(Q.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"store",{get:function(){return F.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=B.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(Q.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isEPayKolayEnabled",{get:function(){var e=B.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPoweredByHidden",{get:function(){var e=B.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),Q.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},Q}();function $(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function J(e){return e&&Q.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(q||(q={})),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"}(W||(W={}));export{q as CheckoutStep,W as ErrorType,X 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,IkasOrderPaymentStatus as p,IkasTransactionStatus as m,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as g,IkasOrderLineItemStatus as v,IkasAmountType as y,IkasCampaignOfferProductApplicablePriceEnum as S}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 b}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 P}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 A}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 O}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 N from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import T from"../../store/checkout/index.js";import D from"../../store/cart/api.js";import M,{MFS_ELEMENT_ID as G,MFS_SCRIPT_URL as L}from"./modelMasterPass.js";import x from"../../store/product/index.js";import{TransactionCardAssociationEnum as _,SaveCartInput as V,CheckStocksLineInput as U}from"@ikas/storefront-api";import{IkasBaseStore as F}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as B}from"@ikas/storefront-config";import{Analytics as K}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Y from"../../models/data/order/address/ikas-localized-order-address.js";import Z from"../../store/location/index.js";import{getCookieValue as H}from"../../utils/helper.js";var q,W,Q=/^\d+$/,z="undefined"==typeof localStorage,X=function(){function Q(a,d,C,I,Q,X,ee,te,ie,se){var ne=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=q.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.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(ne,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,F.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(ne,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(B.getIsEditor())return this.step=q.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===q.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(q.INFO)];if(this.step!==q.PAYMENT||this.canProceedToPayment){if(this.step===q.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(q.INFO)];if(![q.INFO,q.SUCCESS,q.SHIPPING,q.PAYMENT].includes(this.step))return[2,this.changeStep(q.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(q.INFO)]:[2,this.changeStep(q.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),n&&(this.error={type:W.PAYMENT_ERROR,data:r||null}),this.step!==q.SHIPPING&&this.step!==q.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new b(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==q.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!==q.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=q.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==q.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==q.SUCCESS||this.checkout.orderPaymentStatus!==p.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:W.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==q.PAYMENT&&this.step!==q.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length)return this.error={type:W.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===q.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(q.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return this.isCheckoutLoaded=!0,K.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(ne,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(ne,void 0,void 0,(function(){var e,i,s,n,r,a;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!==q.INFO&&this.step!==q.SHIPPING||this.isDigitalOnly||(e.billingAddress=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,D.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===(n=s.extensions)||void 0===n?void 0:n.code)?{type:W.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(r=s.extensions)||void 0===r?void 0:r.code)?{type:W.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(a=s.extensions)||void 0===a?void 0:a.code)?{type:W.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:W.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(ne,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(ne,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p;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===(u=B.getStockLocationIds())||void 0===u?void 0:u.length)?B.getStockLocationIds():null,[4,T.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:W.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:W.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(ne,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,F.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(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getAvailableShippingCountries({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(ne,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?[4,T.listStockLocation({id:{in:B.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:W.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,T.getAvailableStockLocations({lines:e.map((function(e){return new U(e)})),stockLocationIdList:B.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:W.API_ERROR},[2];s=B.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=ne.shippingCountryIds)||void 0===e?void 0:e.length)||(ne.error={type:W.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;ne.deliveryMethod!==e&&("address"===e&&(ne.checkout.stockLocationId=null,(null===(t=ne.customerAddresses)||void 0===t?void 0:t.length)?ne.onSelectedShippingAddressIdChange(ne.customerAddresses[0].id||"-1"):(ne.checkout.shippingAddress=new Y,ne.checkout.shippingAddress.countrySettings=ne.countrySettings,ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones)),ne.deliveryMethod=e,ne.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(ne,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:W.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,f=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=B.getPaymentGateways().map((function(e){return e.id})),[4,T.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:B.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess&&(null===(h=s.data)||void 0===h?void 0:h.length)?(n=s.data,this.step===q.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(f.checkout.currencyCode)})),(o=null===(p=this.checkout.shippingAddress)||void 0===p?void 0:p.country)&&o.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(o.iso2||"")}))),a=null===(m=this.checkout.billingAddress)||void 0===m?void 0:m.country,!o&&a&&a.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")})))),c=[],r(B.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&c.push(t)})),this.paymentGateways=e?n:c,d=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=f.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==d?d:0),[3,4])):(this.error={type:W.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==q.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===q.PAYMENT&&(u=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=u,(l=document.createElement("script")).id=G,l.src=L,l.onload=function(){f.mpVM.checkMasterPass({checkout:f.checkout,store:F.getInstance()})},document.head.appendChild(l)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(ne,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.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;ne.store.customerStore.customer?(null===(e=ne.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=ne.checkoutSettings,e.shippingZones=ne.shippingZones})),ne.checkout.customer=new A(i(i({},ne.store.customerStore.customer),{notificationsAccepted:ne.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):ne.checkout.customer=new A(ne.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){ne.checkout.shippingAddress&&(ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones,ne.checkout.shippingAddress.countrySettings=ne.countrySettings,ne.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){ne.checkout.billingAddress&&(ne.checkout.billingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.billingAddress.shippingZones=ne.shippingZones,ne.checkout.billingAddress.countrySettings=ne.countrySettings,ne.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!ne.isDigitalOnly)if(ne.isInStoreDelivery)ne.setCheckoutShippingAddressSettings();else if(ne.checkout.shippingAddress){if(ne.store.customerStore.customer){var e=null==(t=ne.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ne.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return ne.onSelectedShippingAddressIdChange(e.id||"-1"),void ne.setCheckoutShippingAddressSettings()}ne.checkout.shippingAddress=new Y(n(ne.checkout.shippingAddress)||{}),ne.setCheckoutShippingAddressSettings()}else if(ne.store.customerStore.customer){var t=ne.customerAddresses;ne.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else ne.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(ne.useDifferentAddress=!!localStorage.getItem("sAddr"),ne.checkout.billingAddress){if(ne.store.customerStore.customer){var e=null==(t=ne.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=ne.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return ne.onSelectedBillingAddressIdChange(e.id||"-1"),void ne.setCheckoutBillingAddressSettings()}ne.checkout.billingAddress=new Y(n(ne.checkout.billingAddress)||{}),ne.setCheckoutBillingAddressSettings()}else if(ne.store.customerStore.customer){var t=ne.customerAddresses;ne.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||ne.useDifferentAddress||!ne.checkout.shippingAddress||ne.isInStoreDelivery||(ne.checkout.billingAddress=new Y(n(ne.checkout.shippingAddress)),ne.setCheckoutBillingAddressSettings())}else ne.onSelectedBillingAddressIdChange("-1"),ne.useDifferentAddress||!ne.checkout.shippingAddress||ne.isInStoreDelivery||(ne.checkout.billingAddress=new Y(n(ne.checkout.shippingAddress)),ne.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(ne,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(ne,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(ne,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,6,,7]),[4,D.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===q.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,5];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!==q.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice?[3,5]:[4,this.listPaymentGateways()]):[3,5];case 4:t.sent(),t.label=5;case 5:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(ne,void 0,void 0,(function(){var e,n,r,o,a,c;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),[4,D.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.data,r=null===(c=null===(a=this.cardData)||void 0===a?void 0:a.cardNumber)||void 0===c?void 0:c.split(" ").join(""),this.couponError=null,this.step===q.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,5];case 2:t.sent(),t.label=3;case 3:return n?(o=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!==q.PAYMENT||this.checkout.totalFinalPrice===o.totalFinalPrice?[3,5]:[4,this.listPaymentGateways()]):[3,5];case 4:t.sent(),t.label=5;case 5:return[3,7];case 6:return t.sent(),[3,7];case 7:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(ne,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,Z.getAvailableShippingZones({salesChannelId:B.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(ne.selectedShippingAddressId=e,"-1"===e)ne.checkout.shippingAddress=new Y,ne.checkout.shippingAddress.countrySettings=ne.countrySettings;else{var i=null===(t=ne.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ne.checkout.shippingAddress=new Y(i),ne.checkout.shippingAddress.countrySettings=ne.countrySettings)}ne.checkout.shippingAddress&&(ne.checkout.shippingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.shippingAddress.shippingZones=ne.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(ne.selectedBillingAddressId=e,"-1"===e)ne.checkout.billingAddress=new Y,ne.checkout.billingAddress.countrySettings=ne.countrySettings;else{var i=null===(t=ne.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(ne.checkout.billingAddress=new Y(i),ne.checkout.billingAddress.countrySettings=ne.countrySettings)}ne.checkout.billingAddress&&(ne.checkout.billingAddress.checkoutSettings=ne.checkoutSettings,ne.checkout.billingAddress.shippingZones=ne.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){ne.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(ne.cardData&&(!(e.length>ne.cardData.cardNumber.length)||J(e))){var i=(ne.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!ne.installmentInfo?ne.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(ne.cardData.installmentCount=1,ne.installmentInfo=void 0),(null===(t=ne.installmentInfo)||void 0===t?void 0:t.cardAssociation)===_.AMERICAN_EXPRESS?ne.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(" "):ne.cardData.cardNumber=$(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(ne,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){ne.cardData&&(ne.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(ne.cardData&&(!(e.length>ne.cardData.expirationDate.length)||J(e))){if(0===(null===(t=ne.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(ne.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(ne.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(ne.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(ne.cardData.expirationDate=$(d,2).join(" / "))}},this.onCvcChange=function(e){if(ne.cardData&&(!(e.length>ne.cardData.cvv.length)||J(e))){if(ne.installmentInfo){if(ne.installmentInfo.cardAssociation===_.AMERICAN_EXPRESS&&e.length>4)return;if(ne.installmentInfo.cardAssociation!==_.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;ne.cardData.cvv=e}},this.saveAddress=function(s){return e(ne,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=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 P(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=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.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.onGoToCartClick=function(){ne.router.push("/cart")},this.onBackToShoppingClick=function(){ne.router.push("/")},this.onGoToLoginClick=function(){ne.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0: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=1;case 1:return t.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:t.sent(),t.label=3;case 3:return[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(q.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(q.SHIPPING):this.changeStep(q.PAYMENT),[3,7]);case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(ne,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.changeStep(q.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(ne,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(q.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:W.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!ne.canPerformPayment||(ne.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){ne.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(ne,void 0,void 0,(function(){var e,i;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:return t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6: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 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:W.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(ne,void 0,void 0,(function(){var e,i;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:return t.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),[4,this.saveCart()];case 4:return t.sent(),this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 5:return t.sent(),[3,7];case 6:return(i=t.sent()).type?this.error=i:this.error={type:W.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(ne,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,f,g,v,y,S;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(c=this.mpVM.selectedCard)||void 0===c?void 0:c.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(d=this.cardData)||void 0===d?void 0:d.installmentCount)?[2]:[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(h=this.mpVM.selectedCard)||void 0===h?void 0:h.Name},paymentGatewayId:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.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:H("_fbp"),_fbc:H("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===u.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:H("_fbp"),_fbc:H("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[m.SUCCESS,m.AUTHORIZED].includes(r),a=r===m.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(S=null==s?void 0:s.data)||void 0===S?void 0:S.returnSlug))throw{data:s.firstErrorMessage,type:W.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(ne,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 this.changeStep(q.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){ne.changeStep(q.INFO)},this.onBackToShippingClick=function(){ne.changeStep(q.SHIPPING)},this.setCustomerConsentGranted=function(e){ne.checkout.customer&&(ne.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){ne.useDifferentAddress=e,ne.useDifferentAddress?(localStorage.setItem("sAddr","1"),ne.checkout.billingAddress=ne.checkout.billingAddress||new Y,ne.checkout.billingAddress.countrySettings=ne.countrySettings):(localStorage.removeItem("sAddr"),ne.checkout.billingAddress=new Y(i({},ne.checkout.shippingAddress)))},this.setShouldSaveAddress=function(e){ne.shouldSaveAddress=e},this.setAddressTitle=function(e){ne.addressTitle=e},this.reInitPaymentMethod=function(){return e(ne,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,6];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[2]}}))}))},this.createStripePaymentIntent=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.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:W.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.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:W.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.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(ne,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(ne,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!==q.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 this.checkout.selectedPaymentGateway=e,this.step!==q.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new N,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(ne,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,D.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id})];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){ne.cardData&&(ne.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(ne,void 0,void 0,(function(){return t(this,(function(e){return z||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(ne,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){ne.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(ne,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,x.searchProducts({input:{productIdList:n,priceListId:B.getPriceListId(),salesChannelId:B.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===y.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===S.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(ne,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===q.SUCCESS?g.POST_CHECKOUT:g.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(ne,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,D.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===q.SUCCESS?q.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(ne,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(ne,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!==v.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,T.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(ne,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,T.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=C,this.returnPolicy=I,this.privacyPolicy=Q,this.termsOfService=X,this.imprint=ee,this.shippingPolicy=te,this.t=ie,this.customizationProps=se,this.mpVM=new M,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new O({currentLocale:B.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(Q.prototype,"merchantSettings",{get:function(){return new I(B.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.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(Q.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=F.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(Q.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(Q.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"finalPrice",{get:function(){var e,t=(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0;return this.step===q.SUCCESS?this.checkout.totalFinalPrice-t:(this.installmentPrice||this.checkout.totalFinalPrice)-t},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===W.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly?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)!==W.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.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(Q.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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(Q.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"store",{get:function(){return F.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(Q.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)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=B.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(Q.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isEPayKolayEnabled",{get:function(){var e=B.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(Q.prototype,"isPoweredByHidden",{get:function(){var e=B.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),Q.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},Q}();function $(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function J(e){return e&&Q.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(q||(q={})),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"}(W||(W={}));export{q as CheckoutStep,W as ErrorType,X as default};
@@ -1 +1 @@
1
- import{__spreadArray as e}from'./../../../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as a}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as s}from"../../../../store/cart/index.js";import r from"./style.module.scss.js";import i from"../../components/svg/success-circle.js";import n from"../../components/expandable-section/index.js";import c from"../../components/credit-card-form/svg/amex.js";import d from"../../components/credit-card-form/svg/master-card.js";import l from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as p}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.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{IkasPaymentMethodType as f,IkasPaymentGatewayType as v,IkasOrderPackageStatus as g,IkasTransactionCardAssociation as E}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"../../../../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 h from"../../components/offer-product/index.js";import{Analytics as x}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import{QuickRegistration as k}from"../../components/quick-registration/index.js";import{ProductFiles as j}from"../../components/product-files/index.js";import y from"../../components/offer-product/offer-arrows/index.js";import N from"../../components/offer-product/offer-dots/index.js";import I from"../../components/svg/shopping-bag.js";import{CartSummary as A}from"../../components/cart-summary/index.js";import T from"../../components/offer-product/useCampaignOffer.js";var P="eventSentCartIds",S=a((function(a){var g,P,S,L,C,D,R,O,b,_,M,w=a.vm,F=u().t,Y=T(w,!0),U=Y.setActiveIndex,V=Y.setIsActiveOverlay,z=Y.handlePrev,B=Y.handleNext,K=Y.isActiveOverlay,G=Y.activeIndex,H=Y.isMobile;t.useEffect((function(){if("undefined"!=typeof localStorage){var t=localStorage.getItem(s),a=localStorage.getItem("eventSentCartIds");if(t&&t===w.checkout.id){if(w.successTransaction){var o=JSON.parse(a||"[]");if(!o.some((function(e){return e===w.checkout.id}))){var r=w.checkout.orderedAt,i=Date.now();Math.floor(Math.abs(i-r)/1e3)<30&&x.purchase(w.checkout,w.successTransaction),localStorage.setItem("eventSentCartIds",JSON.stringify(e(e([],o,!0),[w.checkout.id],!1)))}}localStorage.removeItem(s)}window&&window.handleKlarna&&window.handleKlarna(void 0)}}),[]);var Q=((null===(g=w.checkout.customer)||void 0===g?void 0:g.firstName)||"")+" "+((null===(P=w.checkout.customer)||void 0===P?void 0:P.lastName)||""),J=((null===(S=w.checkout.shippingAddress)||void 0===S?void 0:S.firstName)||"")+" "+((null===(L=w.checkout.shippingAddress)||void 0===L?void 0:L.lastName)||""),q=w.paymentGateways.find((function(e){var t;return e.id===(null===(t=w.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),X=function(e){switch(e){case f.APP_PAYMENT:return F("checkout-page:appPayment");case f.BANK_REDIRECT:return F("checkout-page:bankRedirect");case f.BUY_ONLINE_PAY_AT_STORE:return F("checkout-page:buyOnlinePayAtStore");case f.CASH:return F("checkout-page:cash");case f.CASH_ON_DELIVERY:return F("checkout-page:cashOnDelivery");case f.CREDIT_CARD:return F("checkout-page:creditCard");case f.CREDIT_CARD_ON_DELIVERY:return F("checkout-page:creditCardOnDelivery");case f.DIRECT_DEBIT:return F("checkout-page:directDebit");case f.GIFT_CARD:return F("checkout-page:giftCard");case f.MONEY_ORDER:return F("checkout-page:moneyOrder");case f.OTHER:return F("checkout-page:other");case f.PAY_LATER:return F("checkout-page:payLater");case f.SLICE_IT:return F("checkout-page:sliceIt");case f.WALLET:return F("checkout-page:wallet");default:return""}},W=null===(C=w.successTransaction)||void 0===C?void 0:C.paymentMethodDetail,Z=null===(D=w.successTransaction)||void 0===D?void 0:D.paymentGatewayCode,$=t.useMemo((function(){var e,a,o,s,i,n,u,g,h,x;return t.createElement("div",{className:[r.InfoGrid].join(" ")},!w.isFree&&t.createElement("div",{className:r.PaymentMethodMain},t.createElement("div",{className:r.InfoTitle},F("checkout-page:paymentMethod")),q&&t.createElement(t.Fragment,null,!!q.logoUrl&&t.createElement("div",{className:r.PaymentLogoContainer},t.createElement("img",{src:q.logoUrl})),!q.logoUrl&&t.createElement("div",{className:r.InfoText},q.paymentMethodType===f.CREDIT_CARD&&q.type===v.INTERNAL?F("checkout-page:creditCard"):q.name),"STRIPE"!==q.code&&"STRIPE_EU"!==q.code&&"PAYPAL"!==q.code&&"KLARNA"!==q.code||!(null===(e=w.successTransaction)||void 0===e?void 0:e.paymentMethod)?!!q.description&&q.type!==v.EXTERNAL&&t.createElement("div",{className:r.InfoText},t.createElement("div",{dangerouslySetInnerHTML:{__html:q.description}})):t.createElement("div",{className:r.InfoText},X(w.successTransaction.paymentMethod))),"E_PAY_KOLAY"===Z&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.EPayKolayLogoContainer},t.createElement("img",{src:"https://cdn.myikas.com/sf/assets/payment/epaykolay.png"})),!!(null===(a=w.successTransaction)||void 0===a?void 0:a.paymentMethod)&&t.createElement("div",{className:r.InfoText},X(null===(o=w.successTransaction)||void 0===o?void 0:o.paymentMethod))),"E_PAY_KOLAY"!==Z&&"STRIPE"!==Z&&"STRIPE_EU"!==Z&&"PAYPAL"!==Z&&"KLARNA"!==Z&&"CREDIT_CARD"===(null===(s=w.successTransaction)||void 0===s?void 0:s.paymentMethod)&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.InfoText},t.createElement("div",{className:r.CardLogoContainer},function(){var e,a;switch(null===(a=null===(e=w.successTransaction)||void 0===e?void 0:e.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation){case E.AMERICAN_EXPRESS:return t.createElement(c,null);case E.MASTER_CARD:return t.createElement(d,null);case E.TROY:return t.createElement(l,null);case E.VISA:return t.createElement(m,null);default:return t.createElement("div",null)}}()),t.createElement("span",null,"**** ".concat((null==W?void 0:W.lastFourDigits)||""))),(null===(i=null==W?void 0:W.installment)||void 0===i?void 0:i.installmentCount)&&W.installment.installmentCount>1&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.InfoText},"".concat(W.installment.installmentCount," ").concat(F("checkout-page:installments"))),null!==W.installment.installmentPrice&&t.createElement("div",{className:r.InfoText},"".concat(W.installment.installmentCount," x ").concat(p(W.installment.installmentPrice,w.checkout.currencyCode,w.checkout.currencySymbol)))))),t.createElement("div",null,t.createElement("div",{className:r.InfoTitle},F("checkout-page:billingAddress")),!!(null===(n=w.checkout.billingAddress)||void 0===n?void 0:n.firstName)&&t.createElement("div",{className:[r.InfoText,r.InfoTextPrimary].join(" ")},w.checkout.billingAddress.firstName," ",w.checkout.billingAddress.lastName),!!(null===(u=w.checkout.billingAddress)||void 0===u?void 0:u.company)&&t.createElement("div",{className:r.InfoText},w.checkout.billingAddress.company),(!!(null===(g=w.checkout.billingAddress)||void 0===g?void 0:g.taxOffice)||!!(null===(h=w.checkout.billingAddress)||void 0===h?void 0:h.taxNumber))&&t.createElement("div",{className:r.InfoText},w.checkout.billingAddress.taxOffice," ",w.checkout.billingAddress.taxNumber),t.createElement("div",{className:r.InfoText},null===(x=w.checkout.billingAddress)||void 0===x?void 0:x.addressText)))}),[]),ee=t.useMemo((function(){return t.createElement(A,{vm:w,isSuccessPageSummary:!0})}),[]),te=t.useMemo((function(){var e,a,o,s,i,n;return t.createElement("div",{className:[r.InfoGrid].join(" ")},t.createElement("div",null,t.createElement("div",{className:r.InfoTitle},F("checkout-page:contactInfo")),t.createElement("div",{className:r.InfoText},null===(e=w.checkout.customer)||void 0===e?void 0:e.email),t.createElement("div",{className:r.InfoText},Q),!!(null===(a=w.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&t.createElement("div",{className:r.InfoText},null===(o=w.checkout.shippingAddress)||void 0===o?void 0:o.phone)),t.createElement("div",null,"in-store"===w.deliveryMethod&&t.createElement(t.Fragment,null,t.createElement("div",{className:r.InfoTitle},F("checkout-page:receiver")),t.createElement("div",{className:[r.InfoText,r.withMBottom].join(" ")},J)),t.createElement("div",{className:r.InfoTitle},"address"===w.deliveryMethod?F("checkout-page:shippingAddress"):F("checkout-page:pickUpLocation")),!!(null===(s=w.checkout.shippingAddress)||void 0===s?void 0:s.firstName)&&t.createElement("div",{className:[r.InfoText,r.InfoTextPrimary].join(" ")},w.checkout.shippingAddress.firstName," ",w.checkout.shippingAddress.lastName),!!(null===(i=w.checkout.shippingAddress)||void 0===i?void 0:i.company)&&t.createElement("div",{className:r.InfoText},w.checkout.shippingAddress.company),t.createElement("div",{className:r.InfoText},null===(n=w.checkout.shippingAddress)||void 0===n?void 0:n.addressText)))}),[]),ae=!!(null===(R=w.customizationProps)||void 0===R?void 0:R.campaignOffersEnableMiddlePhase)&&!!(null===(O=w.customizationProps)||void 0===O?void 0:O.showCampaignIsBiggerImage)&&H&&K,oe=!!(null===(b=w.customizationProps)||void 0===b?void 0:b.campaignOffersEnableMiddlePhase)&&!!(null===(_=w.customizationProps)||void 0===_?void 0:_.showCampaignIsBiggerImage)&&H&&!K;return t.createElement(t.Fragment,null,!!(null===(M=w.customizationProps)||void 0===M?void 0:M.campaignOffersEnableMiddlePhase)&&K&&w.campaignOffers&&w.campaignOffers.length>0&&H&&t.createElement("div",{className:[r.MiddlePhaseOverlay,ae?r.MiddlePhaseOverlayPopup:""].join(" ")}),w.campaignOffers&&!!w.campaignOffers.length&&w.isCampaignOfferLoaded&&t.createElement("div",{className:[r.CampaignOfferMain,ae?r.OverlayPopupMain:""].join(" ")},t.createElement("div",{className:r.OfferSlider},w.campaignOffers.map((function(e,a){var o;return t.createElement(h,{vm:w,campaignOffer:e,index:a,activeIndex:G,offersLength:(null===(o=w.campaignOffers)||void 0===o?void 0:o.length)||0,handlePrev:z,handleNext:B,setActiveIndex:function(e){return U(e)},isPopupShow:ae,closePopup:function(){return V(!1)},isPopupClosed:oe,showPopup:function(){return V(!0)},step:w.step})}))),w.campaignOffers.length>1&&t.createElement(y,{handlePrev:z,handleNext:B}),w.campaignOffers.length>1&&t.createElement(N,{isPopupShow:ae,vm:w,activeIndex:G})),t.createElement("div",{className:r.StepSuccess},t.createElement("div",{className:r.SuccessTitleContainer},t.createElement(i,{className:r.SuccessCircle}),t.createElement("span",{className:r.SuccessTitle},F("checkout-page:orderSuccessTitle"))),t.createElement("div",{className:r.SuccessSubTitle},F(w.isDigitalOnly?"checkout-page:orderSuccessDigitalOnlyDescription":"address"===w.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:Q})),w.productFiles.length>0&&t.createElement(j,{vm:w}),t.createElement("div",null,t.createElement("div",{className:r.OrderSummaryMain},t.createElement("div",null,t.createElement("span",{className:r.InfoTitle},F("checkout-page:orderNo")),t.createElement("span",{className:r.InfoText},"#"+(w.checkout.orderNumber||""))),t.createElement("div",null,t.createElement("span",{className:r.InfoTitle},F("checkout-page:orderDate")),t.createElement("span",{className:r.InfoText},w.checkout.dateStr)),t.createElement("div",{className:r.OrderAmountInfoMain},t.createElement("span",{className:r.InfoTitle},F("checkout-page:orderAmount")),t.createElement("span",{className:r.OrderAmountInfo},t.createElement("span",null,"".concat(p(w.finalPrice||0,w.checkout.currencyCode,w.checkout.currencySymbol))),t.createElement("span",{className:r.Slash},"/"),t.createElement("span",{className:r.OrderItemCount},t.createElement(I,null),t.createElement("span",null," ",w.checkout.itemQuantity," ",F("checkout-page:cartItemProduct"))))))),w.hasQuickRegistration&&t.createElement(k,{vm:w}),t.createElement("div",{className:r.HideOnDesktop},t.createElement(n,{title:F("checkout-page:summary")},ee)),t.createElement(n,{expanded:!0,title:F("checkout-page:paymentSummary")},$),!w.isDigitalOnly&&t.createElement(n,{title:F("checkout-page:shippingSummary")},te),t.createElement("div",{className:r.Actions},t.createElement("div",{className:r.HelpText},t.createElement("span",null,F("checkout-page:helpCtaQuestion")),t.createElement("span",{style:{marginLeft:"4px"},className:r.Cta,onClick:function(){return w.setContactModalVisible(!0)}},F("checkout-page:helpCta"))),t.createElement(o,{text:F("checkout-page:actions.backToShopping"),onClick:w.onBackToShoppingClick,style:{flex:"0 0 auto"}}))))}));a((function(e){var a,o=e.vm,s=u().t,i=r.Yellow;switch(o.checkout.orderPackageStatus){case g.FULFILLED:case g.PARTIALLY_FULFILLED:case g.DELIVERED:case g.PARTIALLY_DELIVERED:i=r.Green;break;case g.CANCELLED:case g.PARTIALLY_CANCELLED:case g.CANCEL_REJECTED:case g.CANCEL_REQUESTED:i=r.Red}return t.createElement("div",{className:[r.OrderStatus,i].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[g.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[g.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[g.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[g.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[g.DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[g.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.partiallyDelivered")},{types:[g.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[g.CANCELLED,g.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[g.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[g.REFUNDED,g.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[g.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[g.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[g.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(o.checkout.orderPackageStatus)})))||void 0===a?void 0:a.text:"")}));export{P as SENT_CART_IDS_LS_KEY,S as StepSuccess};
1
+ import{__spreadArray as e}from'./../../../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as a}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as s}from"../../../../store/cart/index.js";import n from"./style.module.scss.js";import r from"../../components/svg/success-circle.js";import i from"../../components/expandable-section/index.js";import c from"../../components/credit-card-form/svg/amex.js";import l from"../../components/credit-card-form/svg/master-card.js";import d from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as u}from"../../../../utils/currency.js";import{useTranslation as p}from"../../../../utils/i18n.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{IkasPaymentMethodType as v,IkasPaymentGatewayType as f,IkasOrderPackageStatus as g,IkasTransactionCardAssociation as E}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"../../../../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 h from"../../components/offer-product/index.js";import{Analytics as x}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";import{QuickRegistration as k}from"../../components/quick-registration/index.js";import{ProductFiles as y}from"../../components/product-files/index.js";import j from"../../components/offer-product/offer-arrows/index.js";import N from"../../components/offer-product/offer-dots/index.js";import I from"../../components/svg/shopping-bag.js";import{CartSummary as T}from"../../components/cart-summary/index.js";import A from"../../components/offer-product/useCampaignOffer.js";var C="eventSentCartIds",D=a((function(a){var g,C,D,P,S,L,R,b,O,_,M,F,w=a.vm,Y=p().t,U=A(w,!0),V=U.setActiveIndex,z=U.setIsActiveOverlay,B=U.handlePrev,G=U.handleNext,K=U.isActiveOverlay,H=U.activeIndex,Q=U.isMobile;t.useEffect((function(){if("undefined"!=typeof localStorage){var t=localStorage.getItem(s),a=localStorage.getItem("eventSentCartIds");if(t&&t===w.checkout.id){if(w.successTransaction){var o=JSON.parse(a||"[]");if(!o.some((function(e){return e===w.checkout.id}))){var n=w.checkout.orderedAt,r=Date.now();Math.floor(Math.abs(r-n)/1e3)<30&&x.purchase(w.checkout,w.successTransaction),localStorage.setItem("eventSentCartIds",JSON.stringify(e(e([],o,!0),[w.checkout.id],!1)))}}localStorage.removeItem(s)}window&&window.handleKlarna&&window.handleKlarna(void 0)}}),[]);var J=((null===(g=w.checkout.customer)||void 0===g?void 0:g.firstName)||"")+" "+((null===(C=w.checkout.customer)||void 0===C?void 0:C.lastName)||""),q=((null===(D=w.checkout.shippingAddress)||void 0===D?void 0:D.firstName)||"")+" "+((null===(P=w.checkout.shippingAddress)||void 0===P?void 0:P.lastName)||""),X=w.paymentGateways.find((function(e){var t;return e.id===(null===(t=w.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),W=function(e){var a,o;switch(e||(null===(o=null===(a=w.successTransaction)||void 0===a?void 0:a.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation)){case E.AMERICAN_EXPRESS:return t.createElement(c,null);case E.MASTER_CARD:return t.createElement(l,null);case E.TROY:return t.createElement(d,null);case E.VISA:return t.createElement(m,null);default:return t.createElement("div",null)}},Z=function(e){switch(e){case v.APP_PAYMENT:return Y("checkout-page:appPayment");case v.BANK_REDIRECT:return Y("checkout-page:bankRedirect");case v.BUY_ONLINE_PAY_AT_STORE:return Y("checkout-page:buyOnlinePayAtStore");case v.CASH:return Y("checkout-page:cash");case v.CASH_ON_DELIVERY:return Y("checkout-page:cashOnDelivery");case v.CREDIT_CARD:return Y("checkout-page:creditCard");case v.CREDIT_CARD_ON_DELIVERY:return Y("checkout-page:creditCardOnDelivery");case v.DIRECT_DEBIT:return Y("checkout-page:directDebit");case v.GIFT_CARD:return Y("checkout-page:giftCard");case v.MONEY_ORDER:return Y("checkout-page:moneyOrder");case v.OTHER:return Y("checkout-page:other");case v.PAY_LATER:return Y("checkout-page:payLater");case v.SLICE_IT:return Y("checkout-page:sliceIt");case v.WALLET:return Y("checkout-page:wallet");default:return""}},$=null===(S=w.successTransaction)||void 0===S?void 0:S.paymentMethodDetail,ee=null===(L=w.successTransaction)||void 0===L?void 0:L.paymentGatewayCode,te=null===(R=w.successTransactions)||void 0===R?void 0:R.some((function(e){return e.paymentMethod===v.GIFT_CARD})),ae=t.useMemo((function(){var e,a,o,s,r,i,c,l,d,m,p;return t.createElement("div",{className:[n.InfoGrid].join(" ")},!w.isFree&&t.createElement("div",{className:n.PaymentMethodMain},t.createElement("div",{className:n.InfoTitle},Y("checkout-page:paymentMethod")),te?null===(e=w.successTransactions)||void 0===e?void 0:e.map((function(e){var a,o,s;return t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},Z(e.paymentMethod)),e.paymentMethod===v.CREDIT_CARD&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},t.createElement("div",{className:n.CardLogoContainer},W(null===(a=e.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation)),t.createElement("span",null,"**** ".concat((null==$?void 0:$.lastFourDigits)||""))),(null===(s=null===(o=e.paymentMethodDetail)||void 0===o?void 0:o.installment)||void 0===s?void 0:s.installmentCount)&&e.paymentMethodDetail.installment.installmentCount>1&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},"".concat(e.paymentMethodDetail.installment.installmentCount," ").concat(Y("checkout-page:installments"))),null!==e.paymentMethodDetail.installment.installmentPrice&&t.createElement("div",{className:n.InfoText},"".concat(e.paymentMethodDetail.installment.installmentCount," x ").concat(u(e.paymentMethodDetail.installment.installmentPrice,w.checkout.currencyCode,w.checkout.currencySymbol))))))})):t.createElement(t.Fragment,null,X&&t.createElement(t.Fragment,null,!!X.logoUrl&&t.createElement("div",{className:n.PaymentLogoContainer},t.createElement("img",{src:X.logoUrl})),!X.logoUrl&&t.createElement("div",{className:n.InfoText},X.paymentMethodType===v.CREDIT_CARD&&X.type===f.INTERNAL?Y("checkout-page:creditCard"):X.name),"STRIPE"!==X.code&&"STRIPE_EU"!==X.code&&"PAYPAL"!==X.code&&"KLARNA"!==X.code||!(null===(a=w.successTransaction)||void 0===a?void 0:a.paymentMethod)?!!X.description&&X.type!==f.EXTERNAL&&t.createElement("div",{className:n.InfoText},t.createElement("div",{dangerouslySetInnerHTML:{__html:X.description}})):t.createElement("div",{className:n.InfoText},Z(w.successTransaction.paymentMethod))),"E_PAY_KOLAY"===ee&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.EPayKolayLogoContainer},t.createElement("img",{src:"https://cdn.myikas.com/sf/assets/payment/epaykolay.png"})),!!(null===(o=w.successTransaction)||void 0===o?void 0:o.paymentMethod)&&t.createElement("div",{className:n.InfoText},Z(null===(s=w.successTransaction)||void 0===s?void 0:s.paymentMethod))),"E_PAY_KOLAY"!==ee&&"STRIPE"!==ee&&"STRIPE_EU"!==ee&&"PAYPAL"!==ee&&"KLARNA"!==ee&&"CREDIT_CARD"===(null===(r=w.successTransaction)||void 0===r?void 0:r.paymentMethod)&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},t.createElement("div",{className:n.CardLogoContainer},W()),t.createElement("span",null,"**** ".concat((null==$?void 0:$.lastFourDigits)||""))),(null===(i=null==$?void 0:$.installment)||void 0===i?void 0:i.installmentCount)&&$.installment.installmentCount>1&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoText},"".concat($.installment.installmentCount," ").concat(Y("checkout-page:installments"))),null!==$.installment.installmentPrice&&t.createElement("div",{className:n.InfoText},"".concat($.installment.installmentCount," x ").concat(u($.installment.installmentPrice,w.checkout.currencyCode,w.checkout.currencySymbol))))))),t.createElement("div",null,t.createElement("div",{className:n.InfoTitle},Y("checkout-page:billingAddress")),!!(null===(c=w.checkout.billingAddress)||void 0===c?void 0:c.firstName)&&t.createElement("div",{className:[n.InfoText,n.InfoTextPrimary].join(" ")},w.checkout.billingAddress.firstName," ",w.checkout.billingAddress.lastName),!!(null===(l=w.checkout.billingAddress)||void 0===l?void 0:l.company)&&t.createElement("div",{className:n.InfoText},w.checkout.billingAddress.company),(!!(null===(d=w.checkout.billingAddress)||void 0===d?void 0:d.taxOffice)||!!(null===(m=w.checkout.billingAddress)||void 0===m?void 0:m.taxNumber))&&t.createElement("div",{className:n.InfoText},w.checkout.billingAddress.taxOffice," ",w.checkout.billingAddress.taxNumber),t.createElement("div",{className:n.InfoText},null===(p=w.checkout.billingAddress)||void 0===p?void 0:p.addressText)))}),[]),oe=t.useMemo((function(){return t.createElement(T,{vm:w,isSuccessPageSummary:!0})}),[]),se=t.useMemo((function(){var e,a,o,s,r,i;return t.createElement("div",{className:[n.InfoGrid].join(" ")},t.createElement("div",null,t.createElement("div",{className:n.InfoTitle},Y("checkout-page:contactInfo")),t.createElement("div",{className:n.InfoText},null===(e=w.checkout.customer)||void 0===e?void 0:e.email),t.createElement("div",{className:n.InfoText},J),!!(null===(a=w.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&t.createElement("div",{className:n.InfoText},null===(o=w.checkout.shippingAddress)||void 0===o?void 0:o.phone)),t.createElement("div",null,"in-store"===w.deliveryMethod&&t.createElement(t.Fragment,null,t.createElement("div",{className:n.InfoTitle},Y("checkout-page:receiver")),t.createElement("div",{className:[n.InfoText,n.withMBottom].join(" ")},q)),t.createElement("div",{className:n.InfoTitle},"address"===w.deliveryMethod?Y("checkout-page:shippingAddress"):Y("checkout-page:pickUpLocation")),!!(null===(s=w.checkout.shippingAddress)||void 0===s?void 0:s.firstName)&&t.createElement("div",{className:[n.InfoText,n.InfoTextPrimary].join(" ")},w.checkout.shippingAddress.firstName," ",w.checkout.shippingAddress.lastName),!!(null===(r=w.checkout.shippingAddress)||void 0===r?void 0:r.company)&&t.createElement("div",{className:n.InfoText},w.checkout.shippingAddress.company),t.createElement("div",{className:n.InfoText},null===(i=w.checkout.shippingAddress)||void 0===i?void 0:i.addressText)))}),[]),ne=!!(null===(b=w.customizationProps)||void 0===b?void 0:b.campaignOffersEnableMiddlePhase)&&!!(null===(O=w.customizationProps)||void 0===O?void 0:O.showCampaignIsBiggerImage)&&Q&&K,re=!!(null===(_=w.customizationProps)||void 0===_?void 0:_.campaignOffersEnableMiddlePhase)&&!!(null===(M=w.customizationProps)||void 0===M?void 0:M.showCampaignIsBiggerImage)&&Q&&!K;return t.createElement(t.Fragment,null,!!(null===(F=w.customizationProps)||void 0===F?void 0:F.campaignOffersEnableMiddlePhase)&&K&&w.campaignOffers&&w.campaignOffers.length>0&&Q&&t.createElement("div",{className:[n.MiddlePhaseOverlay,ne?n.MiddlePhaseOverlayPopup:""].join(" ")}),w.campaignOffers&&!!w.campaignOffers.length&&w.isCampaignOfferLoaded&&t.createElement("div",{className:[n.CampaignOfferMain,ne?n.OverlayPopupMain:""].join(" ")},t.createElement("div",{className:n.OfferSlider},w.campaignOffers.map((function(e,a){var o;return t.createElement(h,{vm:w,campaignOffer:e,index:a,activeIndex:H,offersLength:(null===(o=w.campaignOffers)||void 0===o?void 0:o.length)||0,handlePrev:B,handleNext:G,setActiveIndex:function(e){return V(e)},isPopupShow:ne,closePopup:function(){return z(!1)},isPopupClosed:re,showPopup:function(){return z(!0)},step:w.step})}))),w.campaignOffers.length>1&&t.createElement(j,{handlePrev:B,handleNext:G}),w.campaignOffers.length>1&&t.createElement(N,{isPopupShow:ne,vm:w,activeIndex:H})),t.createElement("div",{className:n.StepSuccess},t.createElement("div",{className:n.SuccessTitleContainer},t.createElement(r,{className:n.SuccessCircle}),t.createElement("span",{className:n.SuccessTitle},Y("checkout-page:orderSuccessTitle"))),t.createElement("div",{className:n.SuccessSubTitle},Y(w.isDigitalOnly?"checkout-page:orderSuccessDigitalOnlyDescription":"address"===w.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:J})),w.productFiles.length>0&&t.createElement(y,{vm:w}),t.createElement("div",null,t.createElement("div",{className:n.OrderSummaryMain},t.createElement("div",null,t.createElement("span",{className:n.InfoTitle},Y("checkout-page:orderNo")),t.createElement("span",{className:n.InfoText},"#"+(w.checkout.orderNumber||""))),t.createElement("div",null,t.createElement("span",{className:n.InfoTitle},Y("checkout-page:orderDate")),t.createElement("span",{className:n.InfoText},w.checkout.dateStr)),t.createElement("div",{className:n.OrderAmountInfoMain},t.createElement("span",{className:n.InfoTitle},Y("checkout-page:orderAmount")),t.createElement("span",{className:n.OrderAmountInfo},t.createElement("span",null,"".concat(u(w.finalPrice||0,w.checkout.currencyCode,w.checkout.currencySymbol))),t.createElement("span",{className:n.Slash},"/"),t.createElement("span",{className:n.OrderItemCount},t.createElement(I,null),t.createElement("span",null," ",w.checkout.itemQuantity," ",Y("checkout-page:cartItemProduct"))))))),w.hasQuickRegistration&&t.createElement(k,{vm:w}),t.createElement("div",{className:n.HideOnDesktop},t.createElement(i,{title:Y("checkout-page:summary")},oe)),t.createElement(i,{expanded:!0,title:Y("checkout-page:paymentSummary")},ae),!w.isDigitalOnly&&t.createElement(i,{title:Y("checkout-page:shippingSummary")},se),t.createElement("div",{className:n.Actions},t.createElement("div",{className:n.HelpText},t.createElement("span",null,Y("checkout-page:helpCtaQuestion")),t.createElement("span",{style:{marginLeft:"4px"},className:n.Cta,onClick:function(){return w.setContactModalVisible(!0)}},Y("checkout-page:helpCta"))),t.createElement(o,{text:Y("checkout-page:actions.backToShopping"),onClick:w.onBackToShoppingClick,style:{flex:"0 0 auto"}}))))}));a((function(e){var a,o=e.vm,s=p().t,r=n.Yellow;switch(o.checkout.orderPackageStatus){case g.FULFILLED:case g.PARTIALLY_FULFILLED:case g.DELIVERED:case g.PARTIALLY_DELIVERED:r=n.Green;break;case g.CANCELLED:case g.PARTIALLY_CANCELLED:case g.CANCEL_REJECTED:case g.CANCEL_REQUESTED:r=n.Red}return t.createElement("div",{className:[n.OrderStatus,r].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[g.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[g.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[g.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[g.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[g.DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[g.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.partiallyDelivered")},{types:[g.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[g.CANCELLED,g.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[g.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[g.REFUNDED,g.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[g.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[g.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[g.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(o.checkout.orderPackageStatus)})))||void 0===a?void 0:a.text:"")}));export{C as SENT_CART_IDS_LS_KEY,D as StepSuccess};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArray as r}from'./../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as i}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import s from"../../hooks/useDimension.js";import l from"./renderer/index.js";import{checkSavedSessionForPopups as u,checkIsPopupSavedToLocalStorage as c}from"./utils/index.js";import{IkasStorefrontPopupPageFilterTypeEnum as a,IkasStorefrontPopupPageFilterDataTypeEnum as p,IkasStorefrontPopupDeviceTypeEnum as d}from"@ikas/storefront-models";import{IkasBaseStore as f}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";var m=i((function(){var i=s().isMobile,m=n.useState([]),v=m[0],h=m[1];return n.useEffect((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){var t=setInterval((function(){var r=o.getSessionId();r&&(clearInterval(t),e(r))}),100)}))];case 1:return[2,e.sent()]}}))})),u(),f.getInstance().currentPageType;var n=[],s=o.getStorefrontPopups().filter((function(e){var t;if(c(e.id))return!1;var r=[];if((null===(t=e.pageFilters)||void 0===t?void 0:t.length)&&(r=e.pageFilters.filter((function(e){return e.pageType===a.CUSTOM}))).length){var o=window.location.href;o.includes("http://localhost:3333/")&&(o=o.replace("http://localhost:3333/","https://bundle.myikas.dev/")),r.forEach((function(e){var t;null===(t=e.filters)||void 0===t||t.forEach((function(e){e.type===p.CONTAINS&&o.includes(e.value)?n.push(p.CONTAINS):e.type===p.DOES_NOT_CONTAIN&&o.includes(e.value)?n.push(p.DOES_NOT_CONTAIN):e.type===p.EXACT_MATCH&&o===e.value&&n.push(p.EXACT_MATCH)}))}))}if(n.includes(p.DOES_NOT_CONTAIN))return!1;var s=function(){return i?[d.ALL,d.MOBILE].includes(e.visibleDevice):[d.ALL,d.DESKTOP].includes(e.visibleDevice)};return(n.length||!(!n.length&&!e.isFilteredOnServerSide))&&s()})),l=document.head.querySelector('link[href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"]');if(s.length&&!l){var m=document.createElement("link");m.type="text/css",m.rel="stylesheet",m.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",document.head.appendChild(m)}h(r([],s,!0))}),[i]),n.createElement(n.Fragment,null,v.map((function(e,t){return n.createElement(l,{storefrontPopup:e,key:e.id})})))}));export{m as PopupListRendererForPage};
1
+ import{__awaiter as e,__generator as t,__spreadArray as r}from'./../../ext/tslib/tslib.es6.js';import*as n from"react";import{observer as i}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import s from"../../hooks/useDimension.js";import l from"./renderer/index.js";import{checkSavedSessionForPopups as u,checkIsPopupSavedToLocalStorage as c}from"./utils/index.js";import{IkasStorefrontPopupPageFilterTypeEnum as a,IkasStorefrontPopupPageFilterDataTypeEnum as d,IkasStorefrontPopupDeviceTypeEnum as p}from"@ikas/storefront-models";var f=i((function(){var i=s().isMobile,f=n.useState([]),m=f[0],v=f[1];return n.useEffect((function(){e(void 0,void 0,void 0,(function(){var e,n,s,l;return t(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(e){var t=setInterval((function(){var r=o.getSessionId();r&&(clearInterval(t),e(r))}),100)}))];case 1:return t.sent(),u(),e=[],n=o.getStorefrontPopups().filter((function(t){var r;if(c(t.id))return!1;var n=[];if((null===(r=t.pageFilters)||void 0===r?void 0:r.length)&&(n=t.pageFilters.filter((function(e){return e.pageType===a.CUSTOM}))).length){var o=window.location.href;o.includes("http://localhost:3333/")&&(o=o.replace("http://localhost:3333/","https://bundle.myikas.dev/")),n.forEach((function(t){var r;null===(r=t.filters)||void 0===r||r.forEach((function(t){t.type===d.CONTAINS&&o.includes(t.value)?e.push(d.CONTAINS):t.type===d.DOES_NOT_CONTAIN&&o.includes(t.value)?e.push(d.DOES_NOT_CONTAIN):t.type===d.EXACT_MATCH&&o===t.value&&e.push(d.EXACT_MATCH)}))}))}if(e.includes(d.DOES_NOT_CONTAIN))return!1;var s=function(){return i?[p.ALL,p.MOBILE].includes(t.visibleDevice):[p.ALL,p.DESKTOP].includes(t.visibleDevice)};return(e.length||!(!e.length&&!t.isFilteredOnServerSide))&&s()})),s=document.head.querySelector('link[href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"]'),n.length&&!s&&((l=document.createElement("link")).type="text/css",l.rel="stylesheet",l.href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",document.head.appendChild(l)),v(r([],n,!0)),[2]}}))}))}),[i]),n.createElement(n.Fragment,null,m.map((function(e,t){return n.createElement(l,{storefrontPopup:e,key:e.id})})))}));export{f as PopupListRendererForPage};
@@ -0,0 +1,8 @@
1
+ import { IkasOrderGiftCardLine as IOrderGiftCardLine } from "@ikas/storefront-models";
2
+ export declare class IkasOrderGiftCardLine implements IOrderGiftCardLine {
3
+ amount: number;
4
+ code: string;
5
+ giftCardId: string;
6
+ id: string;
7
+ constructor(data: IOrderGiftCardLine);
8
+ }
@@ -0,0 +1 @@
1
+ import{makeAutoObservable as t}from"mobx";var i=function(i){this.amount=i.amount||0,this.code=i.code||"",this.giftCardId=i.giftCardId||"",this.id=i.id||"",t(this)};export{i as IkasOrderGiftCardLine};
@@ -12,6 +12,7 @@ import { IkasOrderTaxLine } from "./tax-line";
12
12
  import { IkasBaseModel } from "../base";
13
13
  import { IkasOrderCancelReason, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus } from "@ikas/storefront-models";
14
14
  import { IkasOrder as IOrder } from "@ikas/storefront-models";
15
+ import { IkasOrderGiftCardLine } from "./gift-card-line";
15
16
  declare type IOrderConstructorData = {
16
17
  refundSettings?: IkasOrderRefundSettings | null;
17
18
  } & IOrder;
@@ -23,6 +24,7 @@ export declare class IkasOrder extends IkasBaseModel implements IOrder {
23
24
  currencySymbol: string | null;
24
25
  customer: IkasOrderCustomer | null;
25
26
  customerId: string | null;
27
+ giftCardLines: IkasOrderGiftCardLine[] | null;
26
28
  giftPackageLines: IkasOrderGiftPackageLine[] | null;
27
29
  giftPackageNote: string | null;
28
30
  invoices: IkasInvoice[] | 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 o}from"./customer/index.js";import{IkasOrderGiftPackageLine as i}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 s}from"./adjustment/index.js";import{IkasOrderPackage as a}from"./package/index.js";import{IkasOrderTaxLine as d}from"./tax-line/index.js";import{IkasBaseModel as c}from"../base/index.js";import{IkasCampaignType as m,IkasOrderShippingMethod as p,IkasOrderStatus as f}from"@ikas/storefront-models";export{IkasOrderCancelReason,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus}from"@ikas/storefront-models";import{makeObservable as g,observable as b,computed as y}from"mobx";import{IkasOrderFunctions as h}from"@ikas/storefront-model-functions";import{formatCurrency as P}from"../../../utils/currency.js";var j=function(c){function j(e,m){var h,P,j,A,k,v,I,S,O,x,C=this;(C=c.call(this,e)||this).billingAddress=null,C.cancelReason=null,C.cancelledAt=null,C.currencySymbol=null,C.customer=null,C.customerId=null,C.giftPackageLines=null,C.giftPackageNote=null,C.invoices=null,C.isGiftPackage=null,C.note=null,C.orderAdjustments=null,C.orderNumber=null,C.orderPackageStatus=null,C.orderPackages=null,C.orderPaymentStatus=null,C.orderedAt=null,C.priceListId=null,C.paymentMethods=null,C.shippingAddress=null,C.shippingLines=null,C.taxLines=null,C.billingAddress=e.billingAddress?new t(e.billingAddress):null,C.cancelReason=e.cancelReason||null,C.cancelledAt=e.cancelledAt||null,C.currencyCode=e.currencyCode||"",C.currencySymbol=e.currencySymbol||null,C.customer=e.customer?new o(e.customer):null,C.customerId=e.customerId||null,C.giftPackageLines=(null===(h=e.giftPackageLines)||void 0===h?void 0:h.map((function(e){return new i(e)})))||null,C.giftPackageNote=e.giftPackageNote||null,C.invoices=(null===(P=e.invoices)||void 0===P?void 0:P.map((function(e){return new u(e)})))||null,C.isGiftPackage=e.isGiftPackage||null,C.note=e.note||null,C.orderAdjustments=(null===(j=e.orderAdjustments)||void 0===j?void 0:j.map((function(e){return new s(e)})))||null,C.orderLineItems=(null===(A=e.orderLineItems)||void 0===A?void 0:A.map((function(e){return new r(e)})).filter((function(e){return!e.deleted})))||[],C.orderNumber=e.orderNumber||null,C.orderPackageStatus=e.orderPackageStatus||null,C.orderPackages=(null===(k=e.orderPackages)||void 0===k?void 0:k.map((function(e){return new a(e)})))||null,C.orderPaymentStatus=e.orderPaymentStatus||null,C.orderedAt=e.orderedAt||null,C.priceListId=e.priceListId||null,C.paymentMethods=(null===(v=e.paymentMethods)||void 0===v?void 0:v.map((function(e){return new l(e)})))||null,C.shippingAddress=e.shippingAddress?new t(e.shippingAddress):null,C.shippingLines=(null===(I=e.shippingLines)||void 0===I?void 0:I.map((function(e){return new n(e)})))||null,C.shippingMethod=e.shippingMethod||p.SHIPMENT,C.status=e.status||f.CREATED,C.taxLines=(null===(S=e.taxLines)||void 0===S?void 0:S.map((function(e){return new d(e)})))||null,C.totalFinalPrice=null!==(O=e.totalFinalPrice)&&void 0!==O?O:0,C.totalPrice=null!==(x=e.totalPrice)&&void 0!==x?x:0,C.refundSettings=e.refundSettings;var T={billingAddress:b,cancelReason:b,cancelledAt:b,currencyCode:b,currencySymbol:b,customer:b,customerId:b,giftPackageLines:b,giftPackageNote:b,invoices:b,isGiftPackage:b,note:b,orderAdjustments:b,orderLineItems:b,orderNumber:b,orderPackageStatus:b,orderPackages:b,orderPaymentStatus:b,orderedAt:b,paymentMethods:b,shippingAddress:b,shippingLines:b,shippingMethod:b,status:b,taxLines:b,totalFinalPrice:b,totalPrice:b,refundSettings:b,items:y,itemCount:y,refundableItems:y,unfullfilledItems:y,refundedItems:y,totalTax:y,formattedTotalTax:y,shippingTotal:y,formattedShippingTotal:y,formattedTotalFinalPrice:y,formattedTotalPrice:y,hasCustomer:y,hasValidCustomerEmail:y,customerFullName:y,formattedDate:y,couponAdjustment:y,nonCouponAdjustments:y,orderProductFileIds:y};return m&&(delete T.billingAddress,delete T.shippingAddress),g(C,T),C}return e(j,c),Object.defineProperty(j.prototype,"items",{get:function(){return this.orderLineItems},enumerable:!1,configurable:!0}),Object.defineProperty(j.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(j.prototype,"itemQuantity",{get:function(){return this.items.reduce((function(e,t){return e+t.quantity}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"refundableItems",{get:function(){return this.refundSettings?h.getRefundableItems(this,this.refundSettings):[]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"displayedPackages",{get:function(){return h.getDisplayedPackages(this).map((function(e){return new a(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"unfullfilledItems",{get:function(){return h.getUnfullfilledItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"refundedItems",{get:function(){return h.getRefundedItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"totalTax",{get:function(){return h.getTotalTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedTotalTax",{get:function(){return P(this.totalTax,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"shippingTotal",{get:function(){return h.getShippingTotal(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedShippingTotal",{get:function(){return P(this.shippingTotal,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedTotalFinalPrice",{get:function(){return P(this.totalFinalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedTotalPrice",{get:function(){return P(this.totalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasCustomer",{get:function(){return h.hasCustomer(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasValidCustomerEmail",{get:function(){return h.hasValidCustomerEmail(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"customerFullName",{get:function(){return h.getCustomerFullName(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"formattedDate",{get:function(){return h.getFormattedDate(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"couponAdjustment",{get:function(){return h.getCouponAdjustment(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"nonCouponAdjustments",{get:function(){return h.getNonCouponAdjustments(this)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isRefundEnabled",{get:function(){return this.refundableItems.some((function(e){return null!==e.refundQuantity}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"displayedOrderAdjustments",{get:function(){var e;return null===(e=this.orderAdjustments)||void 0===e?void 0:e.filter((function(e){return e.campaignType!==m.FREE_SHIPPING}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"orderProductFileIds",{get:function(){return h.getOrderProductFiles(this)},enumerable:!1,configurable:!0}),j}(c);export{j as IkasOrder};
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 o}from"./customer/index.js";import{IkasOrderGiftPackageLine as i}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 s}from"./adjustment/index.js";import{IkasOrderPackage as a}from"./package/index.js";import{IkasOrderTaxLine as d}from"./tax-line/index.js";import{IkasBaseModel as c}from"../base/index.js";import{IkasCampaignType as m,IkasOrderShippingMethod as p,IkasOrderStatus as f}from"@ikas/storefront-models";export{IkasOrderCancelReason,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus}from"@ikas/storefront-models";import{makeObservable as g,observable as b,computed as y}from"mobx";import{IkasOrderFunctions as h}from"@ikas/storefront-model-functions";import{formatCurrency as P}from"../../../utils/currency.js";import{IkasOrderGiftCardLine as j}from"./gift-card-line/index.js";var v=function(c){function v(e,m){var h,P,v,A,k,I,S,O,x,C,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.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 o(e.customer):null,T.customerId=e.customerId||null,T.giftCardLines=(null===(h=e.giftCardLines)||void 0===h?void 0:h.map((function(e){return new j(e)})))||null,T.giftPackageLines=(null===(P=e.giftPackageLines)||void 0===P?void 0:P.map((function(e){return new i(e)})))||null,T.giftPackageNote=e.giftPackageNote||null,T.invoices=(null===(v=e.invoices)||void 0===v?void 0:v.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 s(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 a(e)})))||null,T.orderPaymentStatus=e.orderPaymentStatus||null,T.orderedAt=e.orderedAt||null,T.priceListId=e.priceListId||null,T.paymentMethods=(null===(S=e.paymentMethods)||void 0===S?void 0:S.map((function(e){return new l(e)})))||null,T.shippingAddress=e.shippingAddress?new t(e.shippingAddress):null,T.shippingLines=(null===(O=e.shippingLines)||void 0===O?void 0:O.map((function(e){return new n(e)})))||null,T.shippingMethod=e.shippingMethod||p.SHIPMENT,T.status=e.status||f.CREATED,T.taxLines=(null===(x=e.taxLines)||void 0===x?void 0:x.map((function(e){return new d(e)})))||null,T.totalFinalPrice=null!==(C=e.totalFinalPrice)&&void 0!==C?C:0,T.totalPrice=null!==(L=e.totalPrice)&&void 0!==L?L:0,T.refundSettings=e.refundSettings;var F={billingAddress:b,cancelReason:b,cancelledAt:b,currencyCode:b,currencySymbol:b,customer:b,customerId:b,giftCardLines:b,giftPackageLines:b,giftPackageNote:b,invoices:b,isGiftPackage:b,note:b,orderAdjustments:b,orderLineItems:b,orderNumber:b,orderPackageStatus:b,orderPackages:b,orderPaymentStatus:b,orderedAt:b,paymentMethods:b,shippingAddress:b,shippingLines:b,shippingMethod:b,status:b,taxLines:b,totalFinalPrice:b,totalPrice:b,refundSettings:b,items:y,itemCount:y,refundableItems:y,unfullfilledItems:y,refundedItems:y,totalTax:y,formattedTotalTax:y,shippingTotal:y,formattedShippingTotal:y,formattedTotalFinalPrice:y,formattedTotalPrice:y,hasCustomer:y,hasValidCustomerEmail:y,customerFullName:y,formattedDate:y,couponAdjustment:y,nonCouponAdjustments:y,orderProductFileIds:y};return m&&(delete F.billingAddress,delete F.shippingAddress),g(T,F),T}return e(v,c),Object.defineProperty(v.prototype,"items",{get:function(){return this.orderLineItems},enumerable:!1,configurable:!0}),Object.defineProperty(v.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(v.prototype,"itemQuantity",{get:function(){return this.items.reduce((function(e,t){return e+t.quantity}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"refundableItems",{get:function(){return this.refundSettings?h.getRefundableItems(this,this.refundSettings):[]},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"displayedPackages",{get:function(){return h.getDisplayedPackages(this).map((function(e){return new a(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"unfullfilledItems",{get:function(){return h.getUnfullfilledItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"refundedItems",{get:function(){return h.getRefundedItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"totalTax",{get:function(){return h.getTotalTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"formattedTotalTax",{get:function(){return P(this.totalTax,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"shippingTotal",{get:function(){return h.getShippingTotal(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"formattedShippingTotal",{get:function(){return P(this.shippingTotal,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"formattedTotalFinalPrice",{get:function(){return P(this.totalFinalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"formattedTotalPrice",{get:function(){return P(this.totalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"hasCustomer",{get:function(){return h.hasCustomer(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"hasValidCustomerEmail",{get:function(){return h.hasValidCustomerEmail(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"customerFullName",{get:function(){return h.getCustomerFullName(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"formattedDate",{get:function(){return h.getFormattedDate(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"couponAdjustment",{get:function(){return h.getCouponAdjustment(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"nonCouponAdjustments",{get:function(){return h.getNonCouponAdjustments(this)},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"isRefundEnabled",{get:function(){return this.refundableItems.some((function(e){return null!==e.refundQuantity}))},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"displayedOrderAdjustments",{get:function(){var e;return null===(e=this.orderAdjustments)||void 0===e?void 0:e.filter((function(e){return e.campaignType!==m.FREE_SHIPPING}))},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"orderProductFileIds",{get:function(){return h.getOrderProductFiles(this)},enumerable:!1,configurable:!0}),v}(c);export{v as IkasOrder};
@@ -1,10 +1,11 @@
1
- import { AddItemToCartQueryParams, GetCartByIdQueryParams, SaveCartCouponCodeQueryParams, SaveCartQueryParams, UpdateCartCampaignOfferQueryParams, CreateCartQueryParams } from "@ikas/storefront-api";
1
+ import { AddItemToCartQueryParams, GetCartByIdQueryParams, SaveCartCouponCodeQueryParams, SaveCartQueryParams, UpdateCartCampaignOfferQueryParams, CreateCartQueryParams, RemoveGiftCardFromCartQueryParams } from "@ikas/storefront-api";
2
2
  import { APIResponse } from "@ikas/fe-api-client";
3
3
  import { IkasCart } from "../../models/data/cart";
4
4
  export default class CartStoreAPI {
5
5
  static getCartById: (params: GetCartByIdQueryParams) => Promise<APIResponse<IkasCart | null>>;
6
6
  static saveCart: (params: SaveCartQueryParams) => Promise<APIResponse<IkasCart | null>>;
7
7
  static saveCartCouponCode: (params: SaveCartCouponCodeQueryParams) => Promise<APIResponse<IkasCart | null>>;
8
+ static removeGiftCardFromCart: (params: RemoveGiftCardFromCartQueryParams) => Promise<APIResponse<IkasCart | null>>;
8
9
  static addItemToCart: (params: AddItemToCartQueryParams) => Promise<APIResponse<IkasCart | null>>;
9
10
  static updateCartCampaignOffer: (params: UpdateCartCampaignOfferQueryParams) => Promise<APIResponse<IkasCart | null>>;
10
11
  static createCart: (params: CreateCartQueryParams) => Promise<APIResponse<IkasCart | null>>;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from'./../../ext/tslib/tslib.es6.js';import{getCartById as t,saveCart as n,saveCartCouponCode as a,addItemToCart as o,updateCartCampaignOffer as i,createCart as s}from"@ikas/storefront-api";import{APIResponse as u}from'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{IkasCart as d}from"../../models/data/cart/index.js";var l=function(){function l(){}var c;return c=l,l.getCartById=function(n){return e(void 0,void 0,void 0,(function(){var e;return r(c,(function(r){switch(r.label){case 0:return[4,t(n)];case 1:return e=r.sent(),[2,new u(e.data?new d(e.data):null,e.graphQLErrors)]}}))}))},l.saveCart=function(t){return e(void 0,void 0,void 0,(function(){var e;return r(c,(function(r){switch(r.label){case 0:return[4,n(t)];case 1:return e=r.sent(),[2,new u(e.data?new d(e.data):null,e.graphQLErrors)]}}))}))},l.saveCartCouponCode=function(t){return e(void 0,void 0,void 0,(function(){var e;return r(c,(function(r){switch(r.label){case 0:return[4,a(t)];case 1:return e=r.sent(),[2,new u(e.data?new d(e.data):null,e.graphQLErrors)]}}))}))},l.addItemToCart=function(t){return e(void 0,void 0,void 0,(function(){var e;return r(c,(function(r){switch(r.label){case 0:return[4,o(t)];case 1:return e=r.sent(),[2,new u(e.data?new d(e.data):null,e.graphQLErrors)]}}))}))},l.updateCartCampaignOffer=function(t){return e(void 0,void 0,void 0,(function(){var e;return r(c,(function(r){switch(r.label){case 0:return[4,i(t)];case 1:return e=r.sent(),[2,new u(e.data?new d(e.data):null,e.graphQLErrors)]}}))}))},l.createCart=function(t){return e(void 0,void 0,void 0,(function(){var e;return r(c,(function(r){switch(r.label){case 0:return[4,s(t)];case 1:return e=r.sent(),[2,new u(e.data?new d(e.data):null,e.graphQLErrors)]}}))}))},l}();export{l as default};
1
+ import{__awaiter as r,__generator as e}from'./../../ext/tslib/tslib.es6.js';import{getCartById as n,saveCart as t,saveCartCouponCode as a,removeGiftCardFromCart as o,addItemToCart as i,updateCartCampaignOffer as s,createCart as u}from"@ikas/storefront-api";import{APIResponse as d}from'./../../ext/@ikas/fe-api-client/build/utils/api.js';import'./../../ext/axios/index.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'./../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{IkasCart as l}from"../../models/data/cart/index.js";var c=function(){function c(){}var f;return f=c,c.getCartById=function(t){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,n(t)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c.saveCart=function(n){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,t(n)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c.saveCartCouponCode=function(n){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,a(n)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c.removeGiftCardFromCart=function(n){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,o(n)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c.addItemToCart=function(n){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,i(n)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c.updateCartCampaignOffer=function(n){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,s(n)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c.createCart=function(n){return r(void 0,void 0,void 0,(function(){var r;return e(f,(function(e){switch(e.label){case 0:return[4,u(n)];case 1:return r=e.sent(),[2,new d(r.data?new l(r.data):null,r.graphQLErrors)]}}))}))},c}();export{c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "6.1.0-beta.14",
3
+ "version": "6.1.0-beta.16",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -21,11 +21,11 @@
21
21
  "swiper": "11.0.6"
22
22
  },
23
23
  "devDependencies": {
24
- "@ikas/storefront-api": "^6.1.0-beta.14",
25
- "@ikas/storefront-config": "^6.1.0-beta.14",
26
- "@ikas/storefront-model-functions": "^6.1.0-beta.14",
27
- "@ikas/storefront-models": "^6.1.0-beta.14",
28
- "@ikas/storefront-providers": "^6.1.0-beta.14",
24
+ "@ikas/storefront-api": "^6.1.0-beta.16",
25
+ "@ikas/storefront-config": "^6.1.0-beta.16",
26
+ "@ikas/storefront-model-functions": "^6.1.0-beta.16",
27
+ "@ikas/storefront-models": "^6.1.0-beta.16",
28
+ "@ikas/storefront-providers": "^6.1.0-beta.16",
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": "^6.1.0-beta.14",
64
- "@ikas/storefront-config": "^6.1.0-beta.14",
65
- "@ikas/storefront-model-functions": "^6.1.0-beta.14",
66
- "@ikas/storefront-models": "^6.1.0-beta.14",
67
- "@ikas/storefront-providers": "^6.1.0-beta.14",
63
+ "@ikas/storefront-api": "^6.1.0-beta.16",
64
+ "@ikas/storefront-config": "^6.1.0-beta.16",
65
+ "@ikas/storefront-model-functions": "^6.1.0-beta.16",
66
+ "@ikas/storefront-models": "^6.1.0-beta.16",
67
+ "@ikas/storefront-providers": "^6.1.0-beta.16",
68
68
  "mobx": "^6.1.3",
69
69
  "mobx-react-lite": "^3.1.5",
70
70
  "next": "12.2.0",