@ikas/storefront 4.0.0-alpha.71 → 4.0.0-alpha.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import e from'./../../../../../ext/style-inject/dist/style-inject.es.js';var t={CheckoutItem:"style-module_CheckoutItem__DaU-Y",ImageContainer:"style-module_ImageContainer__Nr1VF",Image:"style-module_Image__EskwT",QuantityCircle:"style-module_QuantityCircle__sv1mk",Center:"style-module_Center__ZOloc",Name:"style-module_Name__z-5-n",OptionsText:"style-module_OptionsText__7Gcy6",Right:"style-module_Right__WoFoc",Price:"style-module_Price__4WmJv",GrayPrice:"style-module_GrayPrice__Gtch1",LightText:"style-module_LightText__uO43H",Small:"style-module_Small__peZjv",OptionRow:"style-module_OptionRow__lt6CJ",OptionName:"style-module_OptionName__09oij",OptionValue:"style-module_OptionValue__4fCYP",OptionsHorContainer:"style-module_OptionsHorContainer__eTmOO",OptionColorValue:"style-module_OptionColorValue__oNEyN"};e(".style-module_CheckoutItem__DaU-Y {\n display: flex;\n width: 100%;\n margin-bottom: 24px;\n}\n.style-module_CheckoutItem__DaU-Y:last-child {\n margin-bottom: 0;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF {\n flex: 0 0 auto;\n width: 80px;\n height: 74px;\n position: relative;\n padding-right: 16px;\n overflow: hidden;\n padding-top: 10px;\n}\n@media only screen and (max-width: 375px) {\n .style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF {\n width: 72px;\n height: 66px;\n }\n}\n.style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF .style-module_Image__EskwT {\n object-fit: contain;\n border-radius: 8px;\n width: 64px;\n height: 64px;\n}\n@media only screen and (max-width: 375px) {\n .style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF .style-module_Image__EskwT {\n width: 56px;\n height: 56px;\n }\n}\n.style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF .style-module_QuantityCircle__sv1mk {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: var(--checkout-button-bg-color);\n color: var(--checkout-button-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 12px;\n font-weight: 500;\n position: absolute;\n top: 0px;\n right: 8px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc {\n position: relative;\n flex: 1 1 auto;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc .style-module_Name__z-5-n {\n font-size: 14px;\n font-weight: 600;\n color: var(--checkout-primary-text-color);\n line-height: 20px;\n max-height: 40px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc .style-module_OptionsText__7Gcy6 {\n font-size: 12px;\n color: var(--checkout-primary-text-color);\n line-height: 16px;\n margin-top: 2px;\n user-select: none;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc .style-module_OptionsText__7Gcy6:hover {\n cursor: pointer;\n text-decoration: underline;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Right__WoFoc {\n flex: 0 0 auto;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n padding-left: 12px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Right__WoFoc .style-module_Price__4WmJv {\n font-size: 14px;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n color: var(--checkout-primary-text-color);\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Right__WoFoc .style-module_GrayPrice__Gtch1 {\n font-size: 14px;\n color: var(--checkout-secondary-text-color);\n text-decoration: line-through;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_LightText__uO43H {\n font-size: 14px;\n color: var(--checkout-secondary-text-color);\n line-height: 20px;\n margin-top: 2px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_LightText__uO43H.style-module_Small__peZjv {\n font-size: 12px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ {\n display: flex;\n flex-direction: column;\n margin-bottom: 24px;\n max-width: 400px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionName__09oij {\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n margin-right: 8px;\n font-weight: 500;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionValue__4fCYP {\n font-size: 14px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionsHorContainer__eTmOO {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionColorValue__oNEyN {\n width: 24px;\n height: 24px;\n border-radius: 4px;\n margin-right: 4px;\n}");export{t as default};
1
+ import e from'./../../../../../ext/style-inject/dist/style-inject.es.js';var t={CheckoutItem:"style-module_CheckoutItem__DaU-Y",ImageContainer:"style-module_ImageContainer__Nr1VF",Image:"style-module_Image__EskwT",QuantityCircle:"style-module_QuantityCircle__sv1mk",Center:"style-module_Center__ZOloc",Name:"style-module_Name__z-5-n",OptionsText:"style-module_OptionsText__7Gcy6",Right:"style-module_Right__WoFoc",Price:"style-module_Price__4WmJv",GrayPrice:"style-module_GrayPrice__Gtch1",LightText:"style-module_LightText__uO43H",Small:"style-module_Small__peZjv",OptionRow:"style-module_OptionRow__lt6CJ",OptionName:"style-module_OptionName__09oij",OptionValue:"style-module_OptionValue__4fCYP",OptionsHorContainer:"style-module_OptionsHorContainer__eTmOO",OptionColorValue:"style-module_OptionColorValue__oNEyN"};e(".style-module_CheckoutItem__DaU-Y {\n display: flex;\n width: 100%;\n margin-bottom: 24px;\n}\n.style-module_CheckoutItem__DaU-Y:last-child {\n margin-bottom: 0;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF {\n flex: 0 0 auto;\n width: 80px;\n height: 74px;\n position: relative;\n padding-right: 16px;\n overflow: hidden;\n padding-top: 10px;\n}\n@media only screen and (max-width: 375px) {\n .style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF {\n width: 72px;\n height: 66px;\n }\n}\n.style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF .style-module_Image__EskwT {\n object-fit: contain;\n border-radius: 8px;\n width: 64px;\n height: 64px;\n}\n@media only screen and (max-width: 375px) {\n .style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF .style-module_Image__EskwT {\n width: 56px;\n height: 56px;\n }\n}\n.style-module_CheckoutItem__DaU-Y .style-module_ImageContainer__Nr1VF .style-module_QuantityCircle__sv1mk {\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: var(--checkout-button-bg-color);\n color: var(--checkout-button-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 12px;\n font-weight: 500;\n position: absolute;\n top: 0px;\n right: 8px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc {\n position: relative;\n flex: 1 1 auto;\n padding-top: 10px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc .style-module_Name__z-5-n {\n font-size: 14px;\n font-weight: 600;\n color: var(--checkout-primary-text-color);\n line-height: 20px;\n max-height: 40px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc .style-module_OptionsText__7Gcy6 {\n font-size: 12px;\n color: var(--checkout-primary-text-color);\n line-height: 16px;\n margin-top: 2px;\n user-select: none;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Center__ZOloc .style-module_OptionsText__7Gcy6:hover {\n cursor: pointer;\n text-decoration: underline;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Right__WoFoc {\n flex: 0 0 auto;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n padding-left: 12px;\n padding-top: 10px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Right__WoFoc .style-module_Price__4WmJv {\n font-size: 14px;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n color: var(--checkout-primary-text-color);\n}\n.style-module_CheckoutItem__DaU-Y .style-module_Right__WoFoc .style-module_GrayPrice__Gtch1 {\n font-size: 14px;\n color: var(--checkout-secondary-text-color);\n text-decoration: line-through;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_LightText__uO43H {\n font-size: 14px;\n color: var(--checkout-secondary-text-color);\n line-height: 20px;\n margin-top: 2px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_LightText__uO43H.style-module_Small__peZjv {\n font-size: 12px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ {\n display: flex;\n flex-direction: column;\n margin-bottom: 24px;\n max-width: 400px;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionName__09oij {\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n margin-right: 8px;\n font-weight: 500;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionValue__4fCYP {\n font-size: 14px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionsHorContainer__eTmOO {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n}\n.style-module_CheckoutItem__DaU-Y .style-module_OptionRow__lt6CJ .style-module_OptionColorValue__oNEyN {\n width: 24px;\n height: 24px;\n border-radius: 4px;\n margin-right: 4px;\n}");export{t 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 n}from"mobx-react-lite";import a from"lodash/sortBy";import c from"../input-with-button/index.js";import l from"../notification-box/index.js";import{CheckoutStep as r}from"../../model.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{formatCurrency as m}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import{CartItem as s}from"./cart-item/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as p}from"../form-item/model.js";import E from"../tooltip/index.js";import v from"../svg/arrow-down.js";import h from"../svg/cross.js";import C from"../svg/gift.js";import f from"./style.module.scss.js";import k from"../svg/ikas.js";var g=n((function(e){var t,n,a=e.vm,c=e.allowExpand,d=a.checkout,p=u().t,E=o.useState(!c),h=E[0],C=E[1],g=o.useState(!1),x=g[0],j=g[1],w=o.useState(0),A=w[0],P=w[1],I=o.useState(null),L=I[0],R=I[1],D=o.useState(!1),B=D[0],U=D[1],F=o.useState(!1),V=F[0],M=F[1];o.useEffect((function(){c&&(h?L&&P(L.getBoundingClientRect().height):P(0))}),[h,L,c,B,V,x]);var O=[f.CartSummary,c?f.HideOnDesktop:""].join(" "),_=c?{height:A+"px"}:void 0,z=[f.ArrowDown,h?f.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:f.ExpandHeader,onClick:function(){if(!h){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}C(!h)}},o.createElement("div",{className:f.Left},p("checkout-page:summary")),o.createElement("div",{className:f.Price},o.createElement("span",{className:f.PriceText},"".concat(m(a.finalPrice||0,d.currencyCode,d.currencySymbol)," (").concat(d.items.length," ").concat(p("checkout-page:cartItemProduct"),")")),o.createElement("span",{className:z},o.createElement(v,null))))),o.createElement("div",{className:O},o.createElement("div",{className:f.DetailsContainer,style:_},o.createElement("div",{className:f.Details,ref:R},o.createElement("div",{className:f.ItemsContainer},d.items.map((function(e,t){return o.createElement(s,{key:t,vm:a,cartItem:e,currencyCode:d.currencyCode})}))),o.createElement("div",{className:f.Divider}),o.createElement("div",{className:f.SubTotalInfo},x&&o.createElement("div",{className:f.NotificationContainer},o.createElement(l,{type:"warning",title:p("checkout-page:giftCodeErrorTitle"),content:p("checkout-page:giftCodeErrorDescription"),onClose:function(){return j(!1)}})),o.createElement(N,{label:p("checkout-page:subtotal"),value:d.formattedTotalPrice,tooltipText:p("checkout-page:subtotalTooltip")}),!!(null===(t=d.shippingLines)||void 0===t?void 0:t.length)&&o.createElement(N,{label:p("checkout-page:cartShippingTitle"),value:d.shippingTotal?d.formattedShippingTotal:p("checkout-page:free")}),!!a.installmentExtraPrice&&o.createElement(N,{label:p("checkout-page:cartInterest"),value:m(a.installmentExtraPrice,d.currencyCode,d.currencySymbol)}),o.createElement(y,{vm:a}),o.createElement(S,{vm:a}),(a.step===r.SUCCESS&&(!!a.checkout.note||!!a.checkout.appliedCouponCode)||a.step!==r.SUCCESS)&&o.createElement("div",{className:f.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),o.createElement(b,{vm:a,isAddingCoupon:V,setAddingCoupon:M,setCouponError:j}),o.createElement(T,{vm:a,isAddingNote:B,setAddingNote:U})),o.createElement("div",{className:f.TotalContainer},o.createElement("div",{className:f.TitleContainer},o.createElement("div",{className:f.Title},p("checkout-page:total"))),o.createElement("div",null,o.createElement("div",{className:f.TotalPricesContainer},o.createElement("div",{className:f.TotalPrice},m(a.finalPrice||0,d.currencyCode,d.currencySymbol)),!!d.$totalTax&&!!(null===(n=a.customizationProps)||void 0===n?void 0:n.showTax)&&o.createElement("div",{className:[f.TotalTax].join(" ")},p("checkout-page:cartTaxTitle")+" "+d.$formattedTotalTax)))),o.createElement("div",{className:f.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})),N=n((function(e){var t=e.label,n=e.value,a=e.tooltipText;return o.createElement("div",{className:f.InfoRow},o.createElement("div",{className:f.Label},o.createElement("span",null,t),!!a&&o.createElement(E,{text:a,style:{marginLeft:"8px"}})),o.createElement("div",{className:f.Value},n))})),y=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:f.InfoRow,key:a},o.createElement("div",{className:f.Label},"INTEREST"===e.name?n("checkout-page:cartInterest"):e.name),o.createElement("div",{className:f.Value},o.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",o.createElement("span",null,m(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),S=n((function(e){var t,n,a=e.vm,c=u().t;return a.checkout?o.createElement(o.Fragment,null,a.step!==r.SUCCESS&&((null===(t=a.checkout.selectedPaymentGateway)||void 0===t?void 0:t.getCalculatedAdditionalPrices(a.checkout.totalFinalPrice||0,a.checkout.shippingLines||null))||[]).filter((function(e){return 0!==e.amount})).map((function(e,t){return o.createElement("div",{className:f.InfoRow,key:t},o.createElement("div",{className:f.Label},e.name),o.createElement("div",{className:f.Value},o.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",o.createElement("span",null,m(e.amount,a.checkout.currencyCode,a.checkout.currencySymbol))))})),null===(n=a.checkout.giftPackageLines)||void 0===n?void 0:n.map((function(e,t){return o.createElement("div",{className:f.InfoRow,key:t},o.createElement("div",{className:f.Label},o.createElement("div",{className:f.GiftLabel},o.createElement(C,{style:{position:"relative",top:"-1px"}}),o.createElement("span",null,c("checkout-page:giftPackage")))),o.createElement("div",{className:f.Value},o.createElement("span",null,m(e.price,a.checkout.currencyCode,a.checkout.currencySymbol))))}))):null})),b=n((function(n){var a=n.vm,l=n.isAddingCoupon,i=n.setAddingCoupon,s=n.setCouponError,d=u().t,p=o.useState(""),E=p[0],v=p[1],C=o.useState(!1),k=C[0],g=C[1];if(a.step===r.SUCCESS&&!a.checkout.appliedCouponCode)return null;var N=a.checkout.couponAdjustment;return o.createElement("div",{className:f.InfoRow},!a.checkout.appliedCouponCode&&!l&&o.createElement("div",{className:f.ActionTextBtn,onClick:function(){return i(!0)}},d("checkout-page:addCouponCode")),l&&o.createElement(c,{value:E,placeholder:d("checkout-page:couponCode"),buttonLabel:d("checkout-page:actions.apply"),onClick:function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=E,g(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),g(!1),v(""),a.checkout.appliedCouponCode?(i(!1),s(!1)):(s(!0),a.checkout.couponCode=null),[2]}}))}))},isLoading:k,onChange:v}),!!a.checkout.appliedCouponCode&&!l&&o.createElement("div",{className:[f.ActionTextBtn,f.NoUnderline,f.Light].join(" ")},d("checkout-page:couponCode"),o.createElement("span",{className:f.AppliedCoupon},o.createElement("span",{className:f.CouponCode},a.checkout.appliedCouponCode),a.step!==r.SUCCESS&&o.createElement("span",{className:f.ClearCoupon,onClick: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,g(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),g(!1),[2]}}))}))}},o.createElement(h,null)))),!!a.checkout.appliedCouponCode&&!l&&o.createElement("div",{className:f.Value},o.createElement("span",null,"DECREMENT"===(null==N?void 0:N.type)?"- ":"")," ",o.createElement("span",null,m((null==N?void 0:N.amount)||0,a.checkout.currencyCode,a.checkout.currencySymbol))))})),T=n((function(e){var t=e.vm,n=e.isAddingNote,a=e.setAddingNote,c=u().t,l=o.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=o.useCallback((function(){a(!0)}),[]),m=o.useCallback((function(e){t.checkout.note=e}),[t,t.checkout]);if(!t.checkoutSettings.showCheckoutNote)return null;var s=t.step===r.SUCCESS;return s&&!t.checkout.note?null:o.createElement("div",{className:f.InfoRow},!n&&!s&&o.createElement("div",{className:f.ActionTextBtn,onClick:i},l),(n||s)&&o.createElement("div",{className:[f.CheckoutNoteContainer,s?f.Success:""].join(" ")},o.createElement("div",{className:f.Title},c("checkout-page:orderNote")),s?o.createElement("div",{className:f.CheckoutNoteDisplay},t.checkout.note):o.createElement(d,{style:{width:"100%"},type:p.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:m})))}));export{g as CartSummary};
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 l from"../notification-box/index.js";import{CheckoutStep as r}from"../../model.js";import{IkasStorefrontConfig as i}from"@ikas/storefront-config";import{formatCurrency as m}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.js";import{CartItem as s}from"./cart-item/index.js";import{FormItem as d}from"../form-item/index.js";import{FormItemType as p}from"../form-item/model.js";import E from"../tooltip/index.js";import v from"../svg/arrow-down.js";import h from"../svg/cross.js";import C from"../svg/gift.js";import f from"./style.module.scss.js";import k from"../svg/ikas.js";var g=n((function(e){var t,n,a=e.vm,c=e.allowExpand,d=a.checkout,p=u().t,E=o.useState(!c),h=E[0],C=E[1],g=o.useState(!1),x=g[0],j=g[1],w=o.useState(0),A=w[0],P=w[1],I=o.useState(null),L=I[0],R=I[1],D=o.useState(!1),B=D[0],U=D[1],F=o.useState(!1),V=F[0],M=F[1];o.useEffect((function(){c&&(h?L&&P(L.getBoundingClientRect().height):P(0))}),[h,L,c,B,V,x]);var O=[f.CartSummary,c?f.HideOnDesktop:""].join(" "),_=c?{height:A+"px"}:void 0,z=[f.ArrowDown,h?f.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:f.ExpandHeader,onClick:function(){if(!h){var e=document.getElementById("Checkout"),t=document.getElementById("checkout-mobile-summary-header");e&&t&&e.scrollTo({top:t.offsetTop,behavior:"smooth"})}C(!h)}},o.createElement("div",{className:f.Left},p("checkout-page:summary")),o.createElement("div",{className:f.Price},o.createElement("span",{className:f.PriceText},"".concat(m(a.finalPrice||0,d.currencyCode,d.currencySymbol)," (").concat(d.itemQuantity," ").concat(p("checkout-page:cartItemProduct"),")")),o.createElement("span",{className:z},o.createElement(v,null))))),o.createElement("div",{className:O},o.createElement("div",{className:f.DetailsContainer,style:_},o.createElement("div",{className:f.Details,ref:R},o.createElement("div",{className:f.ItemsContainer},d.items.map((function(e,t){return o.createElement(s,{key:t,vm:a,cartItem:e,currencyCode:d.currencyCode})}))),o.createElement("div",{className:f.Divider}),o.createElement("div",{className:f.SubTotalInfo},x&&o.createElement("div",{className:f.NotificationContainer},o.createElement(l,{type:"warning",title:p("checkout-page:giftCodeErrorTitle"),content:p("checkout-page:giftCodeErrorDescription"),onClose:function(){return j(!1)}})),o.createElement(N,{label:p("checkout-page:subtotal"),value:d.formattedTotalPrice,tooltipText:p("checkout-page:subtotalTooltip")}),!!(null===(t=d.shippingLines)||void 0===t?void 0:t.length)&&o.createElement(N,{label:p("checkout-page:cartShippingTitle"),value:d.shippingTotal?d.formattedShippingTotal:p("checkout-page:free")}),!!a.installmentExtraPrice&&o.createElement(N,{label:p("checkout-page:cartInterest"),value:m(a.installmentExtraPrice,d.currencyCode,d.currencySymbol)}),o.createElement(y,{vm:a}),o.createElement(S,{vm:a}),(a.step===r.SUCCESS&&(!!a.checkout.note||!!a.checkout.appliedCouponCode)||a.step!==r.SUCCESS)&&o.createElement("div",{className:f.Divider,style:{marginTop:"24px",marginBottom:"24px"}}),o.createElement(b,{vm:a,isAddingCoupon:V,setAddingCoupon:M,setCouponError:j}),o.createElement(T,{vm:a,isAddingNote:B,setAddingNote:U})),o.createElement("div",{className:f.TotalContainer},o.createElement("div",{className:f.TitleContainer},o.createElement("div",{className:f.Title},p("checkout-page:total"))),o.createElement("div",null,o.createElement("div",{className:f.TotalPricesContainer},o.createElement("div",{className:f.TotalPrice},m(a.finalPrice||0,d.currencyCode,d.currencySymbol)),!!d.$totalTax&&!!(null===(n=a.customizationProps)||void 0===n?void 0:n.showTax)&&o.createElement("div",{className:[f.TotalTax].join(" ")},p("checkout-page:cartTaxTitle")+" "+d.$formattedTotalTax)))),o.createElement("div",{className:f.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})),N=n((function(e){var t=e.label,n=e.value,a=e.tooltipText;return o.createElement("div",{className:f.InfoRow},o.createElement("div",{className:f.Label},o.createElement("span",null,t),!!a&&o.createElement(E,{text:a,style:{marginLeft:"8px"}})),o.createElement("div",{className:f.Value},n))})),y=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:f.InfoRow,key:a},o.createElement("div",{className:f.Label},"INTEREST"===e.name?n("checkout-page:cartInterest"):e.name),o.createElement("div",{className:f.Value},o.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",o.createElement("span",null,m(e.amount,t.checkout.currencyCode,t.checkout.currencySymbol))))}))):null})),S=n((function(e){var t,n,a=e.vm,c=u().t;return a.checkout?o.createElement(o.Fragment,null,a.step!==r.SUCCESS&&((null===(t=a.checkout.selectedPaymentGateway)||void 0===t?void 0:t.getCalculatedAdditionalPrices(a.checkout.totalFinalPrice||0,a.checkout.shippingLines||null))||[]).filter((function(e){return 0!==e.amount})).map((function(e,t){return o.createElement("div",{className:f.InfoRow,key:t},o.createElement("div",{className:f.Label},e.name),o.createElement("div",{className:f.Value},o.createElement("span",null,"DECREMENT"===e.type?"- ":"")," ",o.createElement("span",null,m(e.amount,a.checkout.currencyCode,a.checkout.currencySymbol))))})),null===(n=a.checkout.giftPackageLines)||void 0===n?void 0:n.map((function(e,t){return o.createElement("div",{className:f.InfoRow,key:t},o.createElement("div",{className:f.Label},o.createElement("div",{className:f.GiftLabel},o.createElement(C,{style:{position:"relative",top:"-1px"}}),o.createElement("span",null,c("checkout-page:giftPackage")))),o.createElement("div",{className:f.Value},o.createElement("span",null,m(e.price,a.checkout.currencyCode,a.checkout.currencySymbol))))}))):null})),b=n((function(n){var a=n.vm,l=n.isAddingCoupon,i=n.setAddingCoupon,s=n.setCouponError,d=u().t,p=o.useState(""),E=p[0],v=p[1],C=o.useState(!1),k=C[0],g=C[1];if(a.step===r.SUCCESS&&!a.checkout.appliedCouponCode)return null;var N=a.checkout.couponAdjustment;return o.createElement("div",{className:f.InfoRow},!a.checkout.appliedCouponCode&&!l&&o.createElement("div",{className:f.ActionTextBtn,onClick:function(){return i(!0)}},d("checkout-page:addCouponCode")),l&&o.createElement(c,{value:E,placeholder:d("checkout-page:couponCode"),buttonLabel:d("checkout-page:actions.apply"),onClick:function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return a.checkout.couponCode=E,g(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),g(!1),v(""),a.checkout.appliedCouponCode?(i(!1),s(!1)):(s(!0),a.checkout.couponCode=null),[2]}}))}))},isLoading:k,onChange:v}),!!a.checkout.appliedCouponCode&&!l&&o.createElement("div",{className:[f.ActionTextBtn,f.NoUnderline,f.Light].join(" ")},d("checkout-page:couponCode"),o.createElement("span",{className:f.AppliedCoupon},o.createElement("span",{className:f.CouponCode},a.checkout.appliedCouponCode),a.step!==r.SUCCESS&&o.createElement("span",{className:f.ClearCoupon,onClick: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,g(!0),[4,a.onCouponCodeApply()];case 1:return e.sent(),g(!1),[2]}}))}))}},o.createElement(h,null)))),!!a.checkout.appliedCouponCode&&!l&&o.createElement("div",{className:f.Value},o.createElement("span",null,"DECREMENT"===(null==N?void 0:N.type)?"- ":"")," ",o.createElement("span",null,m((null==N?void 0:N.amount)||0,a.checkout.currencyCode,a.checkout.currencySymbol))))})),T=n((function(e){var t=e.vm,n=e.isAddingNote,a=e.setAddingNote,c=u().t,l=o.useState(t.checkout.note?c("checkout-page:editOrderNote"):c("checkout-page:addOrderNote"))[0],i=o.useCallback((function(){a(!0)}),[]),m=o.useCallback((function(e){t.checkout.note=e}),[t,t.checkout]);if(!t.checkoutSettings.showCheckoutNote)return null;var s=t.step===r.SUCCESS;return s&&!t.checkout.note?null:o.createElement("div",{className:f.InfoRow},!n&&!s&&o.createElement("div",{className:f.ActionTextBtn,onClick:i},l),(n||s)&&o.createElement("div",{className:[f.CheckoutNoteContainer,s?f.Success:""].join(" ")},o.createElement("div",{className:f.Title},c("checkout-page:orderNote")),s?o.createElement("div",{className:f.CheckoutNoteDisplay},t.checkout.note):o.createElement(d,{style:{width:"100%"},type:p.TEXT_AREA,disableResize:!0,label:"",value:t.checkout.note||"",onChange:m})))}));export{g as CartSummary};
@@ -1,9 +1,7 @@
1
1
  import * as React from "react";
2
2
  import CheckoutViewModel from "../../model";
3
- import { IkasPaymentGateway } from "../../../../models";
4
3
  declare type Props = {
5
4
  vm: CheckoutViewModel;
6
- pg: IkasPaymentGateway;
7
5
  };
8
6
  export declare const Klarna: React.FC<Props>;
9
7
  export {};
@@ -1 +1 @@
1
- import*as n from"react";import{observer as e}from"mobx-react-lite";import t from"next/script";import"@ikas/storefront-config";import{useTranslation as a}from"../../../../utils/i18n.js";var r=e((function(e){var r=e.vm;return a().t,r.klarnaResponse?n.createElement(n.Fragment,null,n.createElement("div",{id:"klarna-payments-container"}),n.createElement(t,{dangerouslySetInnerHTML:{__html:'window.klarnaAsyncCallback = function () {\n try {\n Klarna.Payments.init({\n client_token: "'.concat(r.klarnaResponse.clientToken,'",\n });\n Klarna.Payments.load({\n container: "#klarna-payments-container",\n },\n function (res) {\n }\n );\n } catch (e) {\n console.log("error", e);\n }\n };')}}),n.createElement(t,{dangerouslySetInnerHTML:{__html:" ".concat(r.isKlarnaPaymentCompleted&&'Klarna.Payments.authorize({ auto_finalize: true }, function (res) {\n if (res.approved && !!res.authorization_token) {\n window.location.replace("'.concat(r.klarnaResponse.authorizeUrl,'");\n } else{\n ').concat(setTimeout((function(n){r.setIsKlarnaPaymentCompleted(!1)}),2e3),"\n }\n });"))}}),n.createElement(t,{src:"https://x.klarnacdn.net/kp/lib/v1/api.js"})):null}));export{r as Klarna};
1
+ import*as n from"react";import{observer as e}from"mobx-react-lite";import t from"next/script";import"@ikas/storefront-config";import{useTranslation as a}from"../../../../utils/i18n.js";var r=e((function(e){var r=e.vm;return a().t,n.useEffect((function(){window.handleKlarna=function(n){var e;n&&window.location.replace((null===(e=r.klarnaResponse)||void 0===e?void 0:e.authorizeUrl)+"&data="+n)}}),[]),r.klarnaResponse?n.createElement(n.Fragment,null,n.createElement("div",{id:"klarna-payments-container"}),n.createElement(t,{dangerouslySetInnerHTML:{__html:'window.klarnaAsyncCallback = function () {\n try {\n Klarna.Payments.init({\n client_token: "'.concat(r.klarnaResponse.clientToken,'",\n });\n Klarna.Payments.load({\n container: "#klarna-payments-container",\n },\n function (res) {\n }\n );\n } catch (e) {\n console.log("error", e);\n }\n };')}}),n.createElement(t,{dangerouslySetInnerHTML:{__html:"".concat(r.isKlarnaPaymentCompleted&&"Klarna.Payments.authorize({ auto_finalize: true }, function (res) {\n if (res.approved && !!res.authorization_token) {\n window.handleKlarna(JSON.stringify(res))\n } else{\n ".concat(setTimeout((function(){r.setIsKlarnaPaymentCompleted(!1)}),2e3),"\n }\n });"))}}),n.createElement(t,{src:"https://x.klarnacdn.net/kp/lib/v1/api.js"})):null}));export{r as Klarna};
@@ -74,6 +74,8 @@ export default class CheckoutViewModel {
74
74
  get canProceedToInStoreDelivery(): boolean;
75
75
  get canProceedToPayment(): boolean | undefined;
76
76
  get isInStoreDelivery(): boolean;
77
+ get klarnaPaymentGateway(): IkasPaymentGateway | undefined;
78
+ get klarnaPaymentGatewayIndex(): number;
77
79
  get isCustomFlowStripe(): false | import("../../models").IkasPaymentGatewaySettings | null | undefined;
78
80
  get isKlarna(): boolean | null | undefined;
79
81
  get store(): IkasBaseStore;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as e,__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{IkasTransactionStatus as o,IkasPaymentMethodType as a,IkasPaymentGatewayType as c,IkasCartCampaignOfferStatus as d,IkasCampaignOfferTargetPageType as u,IkasOrderShippingMethod as l}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 h}from"../../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{IkasCustomerAddress as p}from"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as m}from"../../models/data/merchant-settings/index.js";import{IkasOrderAddress as f}from"../../models/data/order/address/index.js";import{IkasOrderCustomer as v}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as g}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";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/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 y from"./components/credit-card-form/model.js";import S from"../../store/customer/api.js";import k from"../../store/checkout/index.js";import b from"../../store/cart/api.js";import C from"./modelMasterPass.js";import I from"../../store/product/index.js";import{IkasBaseStore as P}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as A}from"@ikas/storefront-config";import{Analytics as w}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as N,CheckStocksLineInput as O}from"@ikas/storefront-api";var E,R,j=/^\d+$/,T="undefined"==typeof localStorage,x=function(){function j(l,m,j,x,L,G,_,V,U,K){var F=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=E.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],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.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.policyModalTitle="",this.policyModalText="",this.error=null,this.showTestModal=!1,this.init=function(){return t(F,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,P.getInstance().customerStore.waitUntilInitialized()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 2:return t.sent(),[4,this.initStep()];case 3:return t.sent(),[2]}}))}))},this.initStep=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(A.getIsEditor())return this.step=E.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===E.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(E.INFO)];if(this.step!==E.PAYMENT||this.canProceedToPayment){if(this.step===E.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(E.INFO)];if(![E.INFO,E.SUCCESS,E.SHIPPING,E.PAYMENT].includes(this.step))return[2,this.changeStep(E.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(E.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:R.PAYMENT_ERROR,data:n||null}),this.step!==E.INFO?[3,4]:[4,this.getShippingCountries()];case 1:return e.sent(),this.checkShippingCountries(),[4,this.getStockLocations()];case 2:return e.sent(),[4,this.getAvailableStockLocations()];case 3:e.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),e.label=4;case 4:return this.step!==E.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=E.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==E.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==E.PAYMENT&&this.step!==E.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:R.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 5:return e.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,7];case 6:e.sent(),e.label=7;case 7:if(!this.paymentGateways.length)return this.error={type:R.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===E.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(E.SUCCESS)]:[3,9];case 9:return[4,this.initialStockCheck()];case 10:e.sent(),e.label=11;case 11:return[3,14];case 12:return[4,this.getSuccessTransaction()];case 13:e.sent(),this.successTransaction&&(r=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===r}))),e.label=14;case 14:return this.isCheckoutLoaded=!0,w.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,S.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return t=e.sent(),this.successTransaction=t.isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)?t.data[0]:void 0,[2]}}))}))},this.saveCart=function(){return t(F,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return t=new N(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return this.step!==E.INFO&&this.step!==E.SHIPPING||this.isDigitalOnly||(t.billingAddress=null),this.isDigitalOnly&&(t.shippingAddress=null),[4,b.saveCart({input:t})];case 3:if((null==(i=e.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:R.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:R.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(F,void 0,void 0,(function(){var t,s,n=this;return e(this,(function(e){return t=i,(s=this.stockLocations.find((function(t){return t.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,l,h;return e(this,(function(e){switch(e.label){case 0:return t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,k.checkStocks({lines:t.map((function(t){return new O(t)})),stockLocationIdList:(null===(d=A.getStockLocationIds())||void 0===d?void 0:d.length)?A.getStockLocationIds():null})];case 1:if(!(i=e.sent()).isSuccess)throw{type:R.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(l=null===(u=i.data)||void 0===u?void 0:u.lines)||void 0===l?void 0:l.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(h=P.getInstance().cartStore.cart)||void 0===h?void 0:h.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=0,a=s;o<a.length;o++)c=a[o],r(c);throw{type:R.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return t(F,void 0,void 0,(function(){return e(this,(function(t){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return t(F,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,P.getInstance().cartStore.removeItem(n)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,k.getAvailableShippingCountries({salesChannelId:A.getSalesChannelId()})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return A.getPickupStockLocationIds()?[4,k.listStockLocation({id:{in:A.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:R.API_ERROR,data:t.firstErrorMessage},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return A.getPickupStockLocationIds()?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,k.getAvailableStockLocations({lines:t.map((function(t){return new O(t)})),stockLocationIdList:A.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:R.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=F.shippingCountryIds)||void 0===t?void 0:t.length)||(F.error={type:R.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(F.checkout.stockLocationId=null),F.deliveryMethod=t,F.isErrorsVisible=!1},this.initialStockCheck=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,o,a,c,d,u,l=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=A.getPaymentGateways().map((function(t){return t.id})),[4,k.listPaymentGateway({id:t?void 0:{in:i},locale:A.getCurrentLocale()})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===E.PAYMENT&&(n=n.filter((function(t){var e;return!(null===(e=t.supportedCurrencies)||void 0===e?void 0:e.length)||t.supportedCurrencies.includes(l.checkout.currencyCode)})),(o=null===(u=this.checkout.shippingAddress)||void 0===u?void 0:u.country)&&o.iso2&&(n=n.filter((function(t){var e;return!(null===(e=t.availableCountries)||void 0===e?void 0:e.length)||t.availableCountries.includes(o.iso2||"")})))),a=[],r(A.getPaymentGateways(),"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===E.PAYMENT&&(c=n.find((function(t){return!!t.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,this.mpVM.checkMasterPass({checkout:this.checkout,store:P.getInstance()})),[2]):(this.error={type:R.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(F,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,k.retrieveInstallmentInfo(i)];case 1:return t=e.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;F.store.customerStore.customer?(null===(t=F.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=F.checkoutSettings})),F.checkout.customer=new v(F.store.customerStore.customer)):F.checkout.customer=new v(F.checkout.customer||{})},this.createShippingAddress=function(){if(!F.isDigitalOnly)if(F.checkout.shippingAddress)F.checkout.shippingAddress=new f(n(F.checkout.shippingAddress)||{}),F.checkout.shippingAddress.checkoutSettings=F.checkoutSettings;else if(F.store.customerStore.customer){var t=F.store.customerStore.customer.addresses;F.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else F.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(F.useDifferentAddress=!!localStorage.getItem("sAddr"),F.checkout.billingAddress)F.checkout.billingAddress=new f(n(F.checkout.billingAddress)||{}),F.checkout.billingAddress.checkoutSettings=F.checkoutSettings;else if(F.store.customerStore.customer){var t=F.store.customerStore.customer.addresses;F.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else F.onSelectedBillingAddressIdChange("-1"),F.useDifferentAddress||!F.checkout.shippingAddress||F.isInStoreDelivery||(F.checkout.billingAddress=new f(n(F.checkout.shippingAddress)),F.checkout.billingAddress.checkoutSettings=F.checkoutSettings)},this.onShippingMethodChange=function(i){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.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(t=e.sent())&&(this.checkout=new h(t)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(F,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(F,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,b.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=e.sent()).isSuccess&&t.data&&(s=t.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.step===E.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice}}),s&&(r=this.checkout,this.checkout=new h(i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway})))),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e,i;if(F.selectedShippingAddressId=t,"-1"===t)F.checkout.shippingAddress=new f;else{var s=null===(i=null===(e=F.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(F.checkout.shippingAddress=new f(s))}F.checkout.shippingAddress&&(F.checkout.shippingAddress.checkoutSettings=F.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(F.selectedBillingAddressId=t,"-1"===t)F.checkout.billingAddress=new f;else{var s=null===(i=null===(e=F.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(F.checkout.billingAddress=new f(s))}F.checkout.billingAddress&&(F.checkout.billingAddress.checkoutSettings=F.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){F.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(F.cardData&&(!(t.length>F.cardData.cardNumber.length)||M(t))){var e=(F.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!F.installmentInfo?F.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:F.checkout.selectedPaymentGateway.id,price:F.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(F.cardData.installmentCount=1,F.installmentInfo=void 0),F.cardData.cardNumber=D(i,4).join(" "))}},this.onCardHolderNameChange=function(t){F.cardData&&(F.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(F.cardData&&(!(t.length>F.cardData.expirationDate.length)||M(t))){if(0===(null===(e=F.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.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(F.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(F.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(F.cardData.expirationDate=D(a,2).join(" / "))}},this.onCvcChange=function(t){F.cardData&&(t.length>F.cardData.cvv.length&&!M(t)||t.length>4||(F.cardData.cvv=t))},this.saveAddress=function(s){return t(F,void 0,void 0,(function(){var t,r,o,a,c,d,u=this;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(c=this.store.customerStore.customer.addresses)||void 0===c?void 0:c.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(r=new p(i(i({},t),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(o=n(this.store.customerStore.customer)).addresses||(o.addresses=[]),o.addresses.push(r),[4,this.store.customerStore.saveCustomer(o)])):[3,2];case 1:e.sent(),null===(d=this.store.customerStore.customer.addresses)||void 0===d||d.forEach((function(t){return t.checkoutSettings=u.checkoutSettings})),"shipping"===s?(this.checkout.shippingAddress.id=r.id,this.selectedShippingAddressId=r.id||"-1"):(this.checkout.billingAddress.id=r.id,this.selectedBillingAddressId=r.id||"-1"),e.label=2;case 2:return[3,4];case 3:return a=e.sent(),console.error(a),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){F.router.push("/cart")},this.onBackToShoppingClick=function(){F.router.push("/")},this.onProceedToShippingClick=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.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,e.label=1;case 1:return e.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:e.sent(),e.label=3;case 3:return[4,this.checkStocks()];case 4:return e.sent(),[4,this.saveCart()];case 5:return e.sent(),"address"===this.deliveryMethod?this.changeStep(E.SHIPPING):this.changeStep(E.PAYMENT),[3,7];case 6:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.changeStep(E.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.error=void 0,this.changeStep(E.PAYMENT),[3,5];case 4:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!this.canPerformPayment)return this.isErrorsVisible=!0,[2];if(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isKlarna)return this.setIsKlarnaPaymentCompleted(!0),[2];e.label=1;case 1:return e.trys.push([1,7,,8]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),"address"!==this.deliveryMethod?[3,4]:[4,this.saveAddress("billing")];case 3:e.sent(),e.label=4;case 4:return[4,this.saveCart()];case 5:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):[4,this.createSaleTransaction()];case 6:return e.sent(),[3,8];case 7:return void 0!==typeof(i=e.sent()).type?this.error=i:this.error={type:R.UNKNOWN},this.isStepLoading=!1,[3,8];case 8:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return this.isErrorsVisible=!0,[2];if(this.isKlarna)return this.setIsKlarnaPaymentCompleted(!0),[2];e.label=1;case 1:return e.trys.push([1,5,,6]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):[4,this.createSaleTransaction()];case 4:return e.sent(),[3,6];case 5:return(i=e.sent()).type?this.error=i:this.error={type:R.UNKNOWN},this.isStepLoading=!1,[3,6];case 6:return[2]}}))}))},this.createSaleTransaction=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,r,d,u,l,h,p,m,f,v,g,y;return e(this,(function(e){switch(e.label){case 0:return(i=this.mpVM.selectedCard)&&(null===(l=this.mpVM.selectedCard)||void 0===l?void 0:l.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(t=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,k.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:t,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)}}})]):[3,2];case 1:return s=e.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,k.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(v=this.mpVM.selectedCard)||void 0===v?void 0:v.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===a.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===c.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=e.sent(),e.label=4;case 4:return r=null===(g=null==s?void 0:s.data)||void 0===g?void 0:g.transactionStatus,d=r&&[o.SUCCESS,o.AUTHORIZED].includes(r),u=r===o.PENDING,d?[4,this.getSuccessTransaction()]:[3,7];case 5:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return e.sent(),[3,8];case 7:if(!u||!(null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.returnSlug))throw{data:s.firstErrorMessage,type:R.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,e.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(E.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){F.changeStep(E.INFO)},this.onBackToShippingClick=function(){F.changeStep(E.SHIPPING)},this.setCustomerConsentGranted=function(t){F.checkout.customer&&(F.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){F.useDifferentAddress=t,F.useDifferentAddress?(localStorage.setItem("sAddr","1"),F.checkout.billingAddress=F.checkout.billingAddress||new f):(localStorage.removeItem("sAddr"),F.checkout.billingAddress=F.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){F.shouldSaveAddress=t},this.setAddressTitle=function(t){F.addressTitle=t},this.setPaymentGateway=function(i){return t(F,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||!(null===(n=t.settings)||void 0===n?void 0:n.find((function(t){return"allow_custom_flow"===t.label&&"true"===t.value})))||this.stripeResponse?[3,2]:[4,k.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})]:[2];case 1:(s=e.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),e.label=2;case 2:return"KLARNA"!==t.code||this.klarnaResponse?[3,4]:[4,k.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 3:(s=e.sent()).isSuccess&&s.data&&(this.klarnaResponse=s.data),e.label=4;case 4:return this.checkout.selectedPaymentGateway=t,this.step!==E.SUCCESS&&(t.paymentMethodType===a.CREDIT_CARD&&t.type===c.INTERNAL&&(this.cardData=new y),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){F.cardData&&(F.cardData.installmentCount=t)},this.changeStep=function(i){return t(F,void 0,void 0,(function(){return e(this,(function(t){return T||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(F,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){F.isContactModalVisible=t},this.getWaitingForActionCampaignOffers=function(t){if(F.checkout.campaignOffers&&F.checkout.campaignOffers.length)return F.checkout.campaignOffers.filter((function(e){var i;return e.status===d.WAITING_FOR_ACTION&&(null===(i=e.campaignOffer)||void 0===i?void 0:i.targetPageTypes.some((function(e){return e===t})))}))},this.getOffer=function(t){return t.campaignOffer?t.campaignOffer.offers.find((function(e){return e.id===t.campaignOfferProductId})):null},this.getProduct=function(s){return t(F,void 0,void 0,(function(){var t,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return[4,I.searchProducts({input:{productIdList:[s]}})];case 1:return(t=e.sent()).isSuccess&&(null===(a=null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)?(n=t.data.data[0],r=n.variants.find((function(t){return t.isActive})),[2,new g(i(i({},n),{selectedVariantValues:(r||n.variants[0]).variantValues}))]):[2,null]}}))}))},this.getOfferProductVariants=function(t){var e,i=t.offer,s=t.product,n=[];return(null===(e=i.excludedVariantIdList)||void 0===e?void 0:e.length)?s.variants.forEach((function(t){var e,s=null===(e=i.excludedVariantIdList)||void 0===e?void 0:e.some((function(e){return e===t.id}));t.hasStock&&!s&&n.push(t)})):n.push.apply(n,s.variants.filter((function(t){return t.hasStock}))),n},this.getCampaignOfferProducts=function(i){return t(F,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(!(t=this.getWaitingForActionCampaignOffers(i))||!t.length)return[2];s=0,e.label=1;case 1:return s<t.length?(n=t[s],(r=this.getOffer(n))?[4,this.getProduct(r.productId)]:[3,3]):[3,4];case 2:return(o=e.sent())&&(a=this.getOfferProductVariants({offer:r,product:o})).length?[2,{product:o,variants:a,campaignOffer:n,offer:r}]:[3,3];case 3:return s++,[3,1];case 4:return[2]}}))}))},this.getCampaignOffer=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getCampaignOfferProducts(u.CHECKOUT)];case 1:return t.checkoutCampaignOffer=e.sent(),i=this,[4,this.getCampaignOfferProducts(u.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=e.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isCheckoutLoaded=!1,[4,b.updateCartCampaignOffer({input:i})];case 1:return(t=e.sent())&&t.isSuccess&&t.data?(this.checkout=new h(t.data),[4,this.init()]):[3,3];case 2:e.sent(),e.label=3;case 3:return this.isCheckoutLoaded=!0,[2]}}))}))},this.checkout=l,this.checkoutSettings=m,this.router=j,this.returnPolicy=x,this.privacyPolicy=L,this.termsOfService=G,this.imprint=_,this.shippingPolicy=V,this.t=U,this.customizationProps=K,this.mpVM=new C,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.init(),s(this)}return Object.defineProperty(j.prototype,"merchantSettings",{get:function(){return new m(A.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedInstallmentIndex",{get:function(){var t,e,i=this;return(null===(e=null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices)||void 0===e?void 0:e.findIndex((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=P.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return{label:t.title+" - "+t.addressText,value:t.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"installmentPrice",{get:function(){var t,e,i,s=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(i=null===(e=this.installmentInfo.installmentPrices)||void 0===e?void 0:e.find((function(t){var e;return t.installmentCount===(null===(e=s.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){return this.step===E.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===R.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToShipping",{get:function(){var t,e,i;return(this.isDigitalOnly?null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid:null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.isValid)&&this.checkout.hasValidCustomerEmail&&(null===(i=this.error)||void 0===i?void 0:i.type)!==R.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCustomFlowStripe",{get:function(){var t,e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(t){return"allow_custom_flow"===t.label&&"true"===t.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isKlarna",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"KLARNA"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"store",{get:function(){return P.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid),r=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===a.CREDIT_CARD&&i.type===c.INTERNAL?!!this.isCustomFlowStripe||(!!this.isKlarna||(null===(e=this.cardData)||void 0===e?void 0:e.isValid)):!!i);return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===l.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),j}();function D(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function M(t){return t&&j.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(E||(E={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.API_ERROR=1]="API_ERROR",t[t.STOCK_ERROR=2]="STOCK_ERROR",t[t.PAYMENT_ERROR=3]="PAYMENT_ERROR",t[t.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",t[t.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR"}(R||(R={}));export{E as CheckoutStep,R as ErrorType,x as default};
1
+ import{__awaiter as t,__generator as e,__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{IkasTransactionStatus as o,IkasPaymentMethodType as a,IkasPaymentGatewayType as c,IkasCartCampaignOfferStatus as d,IkasCampaignOfferTargetPageType as u,IkasOrderShippingMethod as l}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 h}from"../../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{IkasCustomerAddress as p}from"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as m}from"../../models/data/merchant-settings/index.js";import{IkasOrderAddress as f}from"../../models/data/order/address/index.js";import{IkasOrderCustomer as v}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as g}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";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/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 y from"./components/credit-card-form/model.js";import S from"../../store/customer/api.js";import k from"../../store/checkout/index.js";import b from"../../store/cart/api.js";import C from"./modelMasterPass.js";import I from"../../store/product/index.js";import{IkasBaseStore as P}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as A}from"@ikas/storefront-config";import{Analytics as w}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as N,CheckStocksLineInput as O}from"@ikas/storefront-api";var E,R,j=/^\d+$/,T="undefined"==typeof localStorage,x=function(){function j(l,m,j,x,L,M,_,V,U,K){var F=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=E.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],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.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.policyModalTitle="",this.policyModalText="",this.error=null,this.showTestModal=!1,this.init=function(){return t(F,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,P.getInstance().customerStore.waitUntilInitialized()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 2:return t.sent(),[4,this.initStep()];case 3:return t.sent(),[2]}}))}))},this.initStep=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(A.getIsEditor())return this.step=E.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===E.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(E.INFO)];if(this.step!==E.PAYMENT||this.canProceedToPayment){if(this.step===E.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(E.INFO)];if(![E.INFO,E.SUCCESS,E.SHIPPING,E.PAYMENT].includes(this.step))return[2,this.changeStep(E.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(E.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:R.PAYMENT_ERROR,data:n||null}),this.step!==E.INFO?[3,4]:[4,this.getShippingCountries()];case 1:return e.sent(),this.checkShippingCountries(),[4,this.getStockLocations()];case 2:return e.sent(),[4,this.getAvailableStockLocations()];case 3:e.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),e.label=4;case 4:return this.step!==E.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=E.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==E.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==E.PAYMENT&&this.step!==E.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:R.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 5:return e.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,7];case 6:e.sent(),e.label=7;case 7:if(!this.paymentGateways.length)return this.error={type:R.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===E.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(E.SUCCESS)]:[3,9];case 9:return[4,this.initialStockCheck()];case 10:e.sent(),e.label=11;case 11:return[3,14];case 12:return[4,this.getSuccessTransaction()];case 13:e.sent(),this.successTransaction&&(r=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===r}))),e.label=14;case 14:return this.isCheckoutLoaded=!0,w.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,S.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return t=e.sent(),this.successTransaction=t.isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)?t.data[0]:void 0,[2]}}))}))},this.saveCart=function(){return t(F,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return t=new N(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return this.step!==E.INFO&&this.step!==E.SHIPPING||this.isDigitalOnly||(t.billingAddress=null),this.isDigitalOnly&&(t.shippingAddress=null),[4,b.saveCart({input:t})];case 3:if((null==(i=e.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:R.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:R.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(F,void 0,void 0,(function(){var t,s,n=this;return e(this,(function(e){return t=i,(s=this.stockLocations.find((function(t){return t.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,l,h;return e(this,(function(e){switch(e.label){case 0:return t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,k.checkStocks({lines:t.map((function(t){return new O(t)})),stockLocationIdList:(null===(d=A.getStockLocationIds())||void 0===d?void 0:d.length)?A.getStockLocationIds():null})];case 1:if(!(i=e.sent()).isSuccess)throw{type:R.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(l=null===(u=i.data)||void 0===u?void 0:u.lines)||void 0===l?void 0:l.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(h=P.getInstance().cartStore.cart)||void 0===h?void 0:h.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=0,a=s;o<a.length;o++)c=a[o],r(c);throw{type:R.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return t(F,void 0,void 0,(function(){return e(this,(function(t){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return t(F,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,P.getInstance().cartStore.removeItem(n)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,k.getAvailableShippingCountries({salesChannelId:A.getSalesChannelId()})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return A.getPickupStockLocationIds()?[4,k.listStockLocation({id:{in:A.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:R.API_ERROR,data:t.firstErrorMessage},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return A.getPickupStockLocationIds()?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,k.getAvailableStockLocations({lines:t.map((function(t){return new O(t)})),stockLocationIdList:A.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:R.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=F.shippingCountryIds)||void 0===t?void 0:t.length)||(F.error={type:R.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(F.checkout.stockLocationId=null),F.deliveryMethod=t,F.isErrorsVisible=!1},this.initialStockCheck=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,o,a,c,d,u,l=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=A.getPaymentGateways().map((function(t){return t.id})),[4,k.listPaymentGateway({id:t?void 0:{in:i},locale:A.getCurrentLocale()})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===E.PAYMENT&&(n=n.filter((function(t){var e;return!(null===(e=t.supportedCurrencies)||void 0===e?void 0:e.length)||t.supportedCurrencies.includes(l.checkout.currencyCode)})),(o=null===(u=this.checkout.shippingAddress)||void 0===u?void 0:u.country)&&o.iso2&&(n=n.filter((function(t){var e;return!(null===(e=t.availableCountries)||void 0===e?void 0:e.length)||t.availableCountries.includes(o.iso2||"")})))),a=[],r(A.getPaymentGateways(),"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===E.PAYMENT&&(c=n.find((function(t){return!!t.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,this.mpVM.checkMasterPass({checkout:this.checkout,store:P.getInstance()})),[2]):(this.error={type:R.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(F,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,k.retrieveInstallmentInfo(i)];case 1:return t=e.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;F.store.customerStore.customer?(null===(t=F.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=F.checkoutSettings})),F.checkout.customer=new v(F.store.customerStore.customer)):F.checkout.customer=new v(F.checkout.customer||{})},this.createShippingAddress=function(){if(!F.isDigitalOnly)if(F.checkout.shippingAddress)F.checkout.shippingAddress=new f(n(F.checkout.shippingAddress)||{}),F.checkout.shippingAddress.checkoutSettings=F.checkoutSettings;else if(F.store.customerStore.customer){var t=F.store.customerStore.customer.addresses;F.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else F.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(F.useDifferentAddress=!!localStorage.getItem("sAddr"),F.checkout.billingAddress)F.checkout.billingAddress=new f(n(F.checkout.billingAddress)||{}),F.checkout.billingAddress.checkoutSettings=F.checkoutSettings;else if(F.store.customerStore.customer){var t=F.store.customerStore.customer.addresses;F.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else F.onSelectedBillingAddressIdChange("-1"),F.useDifferentAddress||!F.checkout.shippingAddress||F.isInStoreDelivery||(F.checkout.billingAddress=new f(n(F.checkout.shippingAddress)),F.checkout.billingAddress.checkoutSettings=F.checkoutSettings)},this.onShippingMethodChange=function(i){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.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(t=e.sent())&&(this.checkout=new h(t)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(F,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(F,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,b.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=e.sent()).isSuccess&&t.data&&(s=t.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.step===E.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice}}),s&&(r=this.checkout,this.checkout=new h(i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway})))),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e,i;if(F.selectedShippingAddressId=t,"-1"===t)F.checkout.shippingAddress=new f;else{var s=null===(i=null===(e=F.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(F.checkout.shippingAddress=new f(s))}F.checkout.shippingAddress&&(F.checkout.shippingAddress.checkoutSettings=F.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(F.selectedBillingAddressId=t,"-1"===t)F.checkout.billingAddress=new f;else{var s=null===(i=null===(e=F.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(F.checkout.billingAddress=new f(s))}F.checkout.billingAddress&&(F.checkout.billingAddress.checkoutSettings=F.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){F.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(F.cardData&&(!(t.length>F.cardData.cardNumber.length)||G(t))){var e=(F.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!F.installmentInfo?F.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:F.checkout.selectedPaymentGateway.id,price:F.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(F.cardData.installmentCount=1,F.installmentInfo=void 0),F.cardData.cardNumber=D(i,4).join(" "))}},this.onCardHolderNameChange=function(t){F.cardData&&(F.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(F.cardData&&(!(t.length>F.cardData.expirationDate.length)||G(t))){if(0===(null===(e=F.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.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(F.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(F.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(F.cardData.expirationDate=D(a,2).join(" / "))}},this.onCvcChange=function(t){F.cardData&&(t.length>F.cardData.cvv.length&&!G(t)||t.length>4||(F.cardData.cvv=t))},this.saveAddress=function(s){return t(F,void 0,void 0,(function(){var t,r,o,a,c,d,u=this;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(c=this.store.customerStore.customer.addresses)||void 0===c?void 0:c.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(r=new p(i(i({},t),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(o=n(this.store.customerStore.customer)).addresses||(o.addresses=[]),o.addresses.push(r),[4,this.store.customerStore.saveCustomer(o)])):[3,2];case 1:e.sent(),null===(d=this.store.customerStore.customer.addresses)||void 0===d||d.forEach((function(t){return t.checkoutSettings=u.checkoutSettings})),"shipping"===s?(this.checkout.shippingAddress.id=r.id,this.selectedShippingAddressId=r.id||"-1"):(this.checkout.billingAddress.id=r.id,this.selectedBillingAddressId=r.id||"-1"),e.label=2;case 2:return[3,4];case 3:return a=e.sent(),console.error(a),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){F.router.push("/cart")},this.onBackToShoppingClick=function(){F.router.push("/")},this.onProceedToShippingClick=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.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,e.label=1;case 1:return e.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:e.sent(),e.label=3;case 3:return[4,this.checkStocks()];case 4:return e.sent(),[4,this.saveCart()];case 5:return e.sent(),"address"===this.deliveryMethod?this.changeStep(E.SHIPPING):this.changeStep(E.PAYMENT),[3,7];case 6:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.changeStep(E.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.error=void 0,this.changeStep(E.PAYMENT),[3,5];case 4:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:R.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!this.canPerformPayment)return this.isErrorsVisible=!0,[2];if(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isKlarna)return this.setIsKlarnaPaymentCompleted(!0),[2];e.label=1;case 1:return e.trys.push([1,7,,8]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),"address"!==this.deliveryMethod?[3,4]:[4,this.saveAddress("billing")];case 3:e.sent(),e.label=4;case 4:return[4,this.saveCart()];case 5:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):[4,this.createSaleTransaction()];case 6:return e.sent(),[3,8];case 7:return void 0!==typeof(i=e.sent()).type?this.error=i:this.error={type:R.UNKNOWN},this.isStepLoading=!1,[3,8];case 8:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return this.isErrorsVisible=!0,[2];if(this.isKlarna)return this.setIsKlarnaPaymentCompleted(!0),[2];e.label=1;case 1:return e.trys.push([1,5,,6]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):[4,this.createSaleTransaction()];case 4:return e.sent(),[3,6];case 5:return(i=e.sent()).type?this.error=i:this.error={type:R.UNKNOWN},this.isStepLoading=!1,[3,6];case 6:return[2]}}))}))},this.createSaleTransaction=function(){return t(F,void 0,void 0,(function(){var t,i,s,n,r,d,u,l,h,p,m,f,v,g,y;return e(this,(function(e){switch(e.label){case 0:return(i=this.mpVM.selectedCard)&&(null===(l=this.mpVM.selectedCard)||void 0===l?void 0:l.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(t=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,k.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:t,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)}}})]):[3,2];case 1:return s=e.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,k.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(v=this.mpVM.selectedCard)||void 0===v?void 0:v.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===a.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===c.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=e.sent(),e.label=4;case 4:return r=null===(g=null==s?void 0:s.data)||void 0===g?void 0:g.transactionStatus,d=r&&[o.SUCCESS,o.AUTHORIZED].includes(r),u=r===o.PENDING,d?[4,this.getSuccessTransaction()]:[3,7];case 5:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return e.sent(),[3,8];case 7:if(!u||!(null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.returnSlug))throw{data:s.firstErrorMessage,type:R.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,e.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(E.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){F.changeStep(E.INFO)},this.onBackToShippingClick=function(){F.changeStep(E.SHIPPING)},this.setCustomerConsentGranted=function(t){F.checkout.customer&&(F.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){F.useDifferentAddress=t,F.useDifferentAddress?(localStorage.setItem("sAddr","1"),F.checkout.billingAddress=F.checkout.billingAddress||new f):(localStorage.removeItem("sAddr"),F.checkout.billingAddress=F.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){F.shouldSaveAddress=t},this.setAddressTitle=function(t){F.addressTitle=t},this.setPaymentGateway=function(i){return t(F,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||!(null===(n=t.settings)||void 0===n?void 0:n.find((function(t){return"allow_custom_flow"===t.label&&"true"===t.value})))||this.stripeResponse?[3,2]:[4,k.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})]:[2];case 1:(s=e.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),e.label=2;case 2:return"KLARNA"!==t.code||this.klarnaResponse?[3,4]:[4,k.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 3:(s=e.sent()).isSuccess&&s.data&&(this.klarnaResponse=s.data),e.label=4;case 4:return this.checkout.selectedPaymentGateway=t,this.step!==E.SUCCESS&&(t.paymentMethodType===a.CREDIT_CARD&&t.type===c.INTERNAL&&(this.cardData=new y),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){F.cardData&&(F.cardData.installmentCount=t)},this.changeStep=function(i){return t(F,void 0,void 0,(function(){return e(this,(function(t){return T||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(F,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){F.isContactModalVisible=t},this.getWaitingForActionCampaignOffers=function(t){if(F.checkout.campaignOffers&&F.checkout.campaignOffers.length)return F.checkout.campaignOffers.filter((function(e){var i;return e.status===d.WAITING_FOR_ACTION&&(null===(i=e.campaignOffer)||void 0===i?void 0:i.targetPageTypes.some((function(e){return e===t})))}))},this.getOffer=function(t){return t.campaignOffer?t.campaignOffer.offers.find((function(e){return e.id===t.campaignOfferProductId})):null},this.getProduct=function(s){return t(F,void 0,void 0,(function(){var t,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return[4,I.searchProducts({input:{productIdList:[s]}})];case 1:return(t=e.sent()).isSuccess&&(null===(a=null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.length)?(n=t.data.data[0],r=n.variants.find((function(t){return t.isActive})),[2,new g(i(i({},n),{selectedVariantValues:(r||n.variants[0]).variantValues}))]):[2,null]}}))}))},this.getOfferProductVariants=function(t){var e,i=t.offer,s=t.product,n=[];return(null===(e=i.excludedVariantIdList)||void 0===e?void 0:e.length)?s.variants.forEach((function(t){var e,s=null===(e=i.excludedVariantIdList)||void 0===e?void 0:e.some((function(e){return e===t.id}));t.hasStock&&!s&&n.push(t)})):n.push.apply(n,s.variants.filter((function(t){return t.hasStock}))),n},this.getCampaignOfferProducts=function(i){return t(F,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(!(t=this.getWaitingForActionCampaignOffers(i))||!t.length)return[2];s=0,e.label=1;case 1:return s<t.length?(n=t[s],(r=this.getOffer(n))?[4,this.getProduct(r.productId)]:[3,3]):[3,4];case 2:return(o=e.sent())&&(a=this.getOfferProductVariants({offer:r,product:o})).length?[2,{product:o,variants:a,campaignOffer:n,offer:r}]:[3,3];case 3:return s++,[3,1];case 4:return[2]}}))}))},this.getCampaignOffer=function(){return t(F,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getCampaignOfferProducts(u.CHECKOUT)];case 1:return t.checkoutCampaignOffer=e.sent(),i=this,[4,this.getCampaignOfferProducts(u.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=e.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return t(F,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isCheckoutLoaded=!1,[4,b.updateCartCampaignOffer({input:i})];case 1:return(t=e.sent())&&t.isSuccess&&t.data?(this.checkout=new h(t.data),[4,this.init()]):[3,3];case 2:e.sent(),e.label=3;case 3:return this.isCheckoutLoaded=!0,[2]}}))}))},this.checkout=l,this.checkoutSettings=m,this.router=j,this.returnPolicy=x,this.privacyPolicy=L,this.termsOfService=M,this.imprint=_,this.shippingPolicy=V,this.t=U,this.customizationProps=K,this.mpVM=new C,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.init(),s(this)}return Object.defineProperty(j.prototype,"merchantSettings",{get:function(){return new m(A.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedInstallmentIndex",{get:function(){var t,e,i=this;return(null===(e=null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices)||void 0===e?void 0:e.findIndex((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=P.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return{label:t.title+" - "+t.addressText,value:t.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"installmentPrice",{get:function(){var t,e,i,s=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(i=null===(e=this.installmentInfo.installmentPrices)||void 0===e?void 0:e.find((function(t){var e;return t.installmentCount===(null===(e=s.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){return this.step===E.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===R.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToShipping",{get:function(){var t,e,i;return(this.isDigitalOnly?null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid:null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.isValid)&&this.checkout.hasValidCustomerEmail&&(null===(i=this.error)||void 0===i?void 0:i.type)!==R.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"klarnaPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCustomFlowStripe",{get:function(){var t,e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(t){return"allow_custom_flow"===t.label&&"true"===t.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isKlarna",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"KLARNA"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"store",{get:function(){return P.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid),r=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===a.CREDIT_CARD&&i.type===c.INTERNAL?!!this.isCustomFlowStripe||(!!this.isKlarna||(null===(e=this.cardData)||void 0===e?void 0:e.isValid)):!!i);return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===l.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),j}();function D(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function G(t){return t&&j.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(E||(E={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.API_ERROR=1]="API_ERROR",t[t.STOCK_ERROR=2]="STOCK_ERROR",t[t.PAYMENT_ERROR=3]="PAYMENT_ERROR",t[t.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",t[t.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR"}(R||(R={}));export{E as CheckoutStep,R as ErrorType,x as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";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"mobx";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as o,IkasPaymentGatewayTransactionFeeType as n,IkasPaymentGatewayAdditionalPriceType as r}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"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import{CreditCardForm as d}from"../../../components/credit-card-form/index.js";import{Installments as i}from"./installments/index.js";import m from"../../../components/select-box/index.js";import s from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as l}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import u from"../../../components/master-pass/payment-gateway/svg/master-card.js";import y from"next/dynamic";import x from"../../../components/credit-card-form/model.js";import j from"../../../components/master-pass/credit-card-form/index.js";import{Klarna as f}from"../../../components/klarna/index.js";var v=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.StripeForm}))})),g=t((function(t){var y=t.vm,g=c().t,E=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},h=function(t){return e.createElement("div",{className:s.AdditionalPrice},t.children)},I=function(e){var t;return"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(e){return"allow_custom_flow"===e.label&&"true"===e.value})))},C=function(e){return"KLARNA"===e.code};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,n){var r,d=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),l=e.createElement("button",{className:s.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},g("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:s.MasterPassSelectBoxLabelLogo},e.createElement(u,null)),t.Name," ",t.Value1),p=(null==d?void 0:d.id)&&d.paymentMethodType===a.CREDIT_CARD&&d.type===o.INTERNAL?y.installmentInfo&&e.createElement(i,{vm:y}):void 0;return e.createElement(m,{key:n,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:c,rightContent:l,bottomContent:p,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new x,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,c){var u,x,k=t.paymentMethodType===a.CREDIT_CARD&&t.type===o.INTERNAL?e.createElement(e.Fragment,null,I(t)?e.createElement(v,{vm:y,pg:t}):C(t)?e.createElement(f,{vm:y,pg:t}):e.createElement("div",null,e.createElement(d,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(j,{vm:y}),y.installmentInfo&&e.createElement(i,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===o.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(m,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===o.INTERNAL?I(t)?" ":C(t)?t.name:g("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===c,rightContent:(null===(u=t.additionalPrices)||void 0===u?void 0:u.length)?e.createElement(h,null,(x=t.additionalPrices[0],0===x.amount?"":"".concat(x.amountType===n.AMOUNT?l(x.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+x.amount).concat(x.type===r.DECREMENT?" "+g("checkout-page:paymentMethodDiscount"):" "+g("checkout-page:paymentMethodAdditionalPrice")))):e.createElement(E,null,!!t.logoUrl&&e.createElement("div",{className:s.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:k,onClick:function(){y.selectedPaymentGatewayIndex!==c&&(y.setPaymentGateway(c),y.mpVM.selectedCard=void 0)}})})))}));export{g as PaymentGateways};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";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"mobx";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayTransactionFeeType as n,IkasPaymentGatewayAdditionalPriceType as o,IkasPaymentGatewayType as r}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"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as i}from"./installments/index.js";import d from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import u from"../../../components/master-pass/payment-gateway/svg/master-card.js";import y from"next/dynamic";import x from"../../../components/credit-card-form/model.js";import f from"../../../components/master-pass/credit-card-form/index.js";import{Klarna as v}from"../../../components/klarna/index.js";import{Toggle as j}from"../../../components/toggle/index.js";import g from"../../../components/select-box/style.module.scss.js";var E=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.StripeForm}))})),h=t((function(t){var y=t.vm,h=c().t,C=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},P=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},k=function(e){return 0===e.amount?"":"".concat(e.amountType===n.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===o.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},w=function(e){var t;return"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(e){return"allow_custom_flow"===e.label&&"true"===e.value})))};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,n){var o,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},e.createElement(u,null)),t.Name," ",t.Value1),p=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===r.INTERNAL?y.installmentInfo&&e.createElement(i,{vm:y}):void 0;return e.createElement(d,{key:n,isSelected:(null===(o=y.mpVM.selectedCard)||void 0===o?void 0:o.UniqueId)===t.UniqueId,label:c,rightContent:s,bottomContent:p,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new x,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,n){var o;if(function(e){return"KLARNA"===e.code}(t))return null;var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===r.INTERNAL?e.createElement(e.Fragment,null,w(t)?e.createElement(E,{vm:y,pg:t}):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(f,{vm:y}),y.installmentInfo&&e.createElement(i,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===r.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(d,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===r.INTERNAL?w(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===n,rightContent:(null===(o=t.additionalPrices)||void 0===o?void 0:o.length)?e.createElement(P,null,k(t.additionalPrices[0])):e.createElement(C,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==n&&(y.setPaymentGateway(n),y.mpVM.selectedCard=void 0)}})})),y.klarnaPaymentGateway&&function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:g.SelectBoxContainer},e.createElement("div",{className:"".concat(g.SelectBox," ").concat(a?g.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:g.TopContent},e.createElement(j,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:g.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(P,null,k(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(C,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?g.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(v,{vm:y})))):null}())}));export{h as PaymentGateways};
@@ -1 +1 @@
1
- import e from'./../../../../../ext/style-inject/dist/style-inject.es.js';var t={PaymentLogoContainer:"style-module_PaymentLogoContainer__h4VF0",AdditionalPrice:"style-module_AdditionalPrice__42TO1",MasterPassSelectBoxDeleteButton:"style-module_MasterPassSelectBoxDeleteButton__J1RSJ",MasterPassSelectBoxLabelLogo:"style-module_MasterPassSelectBoxLabelLogo__fIhG7"};e(".style-module_PaymentLogoContainer__h4VF0 {\n margin-left: 10px;\n font-size: 0.7em;\n}\n.style-module_PaymentLogoContainer__h4VF0 img {\n height: 20px;\n}\n\n.style-module_AdditionalPrice__42TO1 {\n color: var(--checkout-primary-text-color);\n font-weight: 600;\n}\n\n.style-module_MasterPassSelectBoxDeleteButton__J1RSJ {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-primary-text-color);\n padding: 4px 8px;\n margin-right: -8px;\n}\n.style-module_MasterPassSelectBoxDeleteButton__J1RSJ:hover {\n text-decoration: underline;\n}\n\n.style-module_MasterPassSelectBoxLabelLogo__fIhG7 {\n display: inline-block;\n margin-right: 12px;\n}");export{t as default};
1
+ import e from'./../../../../../ext/style-inject/dist/style-inject.es.js';var t={PaymentLogoContainer:"style-module_PaymentLogoContainer__h4VF0",AdditionalPrice:"style-module_AdditionalPrice__42TO1",MasterPassSelectBoxDeleteButton:"style-module_MasterPassSelectBoxDeleteButton__J1RSJ",MasterPassSelectBoxLabelLogo:"style-module_MasterPassSelectBoxLabelLogo__fIhG7",Hidden:"style-module_Hidden__5-IfX"};e(".style-module_PaymentLogoContainer__h4VF0 {\n margin-left: 10px;\n font-size: 0.7em;\n}\n.style-module_PaymentLogoContainer__h4VF0 img {\n height: 20px;\n}\n\n.style-module_AdditionalPrice__42TO1 {\n color: var(--checkout-primary-text-color);\n font-weight: 600;\n}\n\n.style-module_MasterPassSelectBoxDeleteButton__J1RSJ {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-primary-text-color);\n padding: 4px 8px;\n margin-right: -8px;\n}\n.style-module_MasterPassSelectBoxDeleteButton__J1RSJ:hover {\n text-decoration: underline;\n}\n\n.style-module_MasterPassSelectBoxLabelLogo__fIhG7 {\n display: inline-block;\n margin-right: 12px;\n}\n\n.style-module_Hidden__5-IfX {\n display: none;\n}");export{t as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as a}from"../../components/button/index.js";import{CART_LS_KEY as o}from"../../../../store/cart/index.js";import i from"./style.module.scss.js";import s from"../../components/svg/success-circle.js";import r from"../../components/expandable-section/index.js";import n from"../../components/credit-card-form/svg/amex.js";import d from"../../components/credit-card-form/svg/master-card.js";import c from"../../components/credit-card-form/svg/troy.js";import l from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as m}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"mobx";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import{IkasPaymentMethodType as p,IkasPaymentGatewayType as v,IkasOrderPackageStatus as E,IkasTransactionCardAssociation as f}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"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/theme-json/index.js";import"../../../../models/data/theme-json/custom-data/index.js";import"../../../../models/data/variant-type/variant-value/index.js";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/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 g from"../../components/offer-product/index.js";import{Analytics as x}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";var h=t((function(t){var E,h,k,T,y,N,I=t.vm,L=u().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(o);e&&e===I.checkout.id&&(I.successTransaction&&x.purchase(I.checkout,I.successTransaction),localStorage.removeItem(o))}}),[]);var A=((null===(E=I.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(h=I.checkout.customer)||void 0===h?void 0:h.lastName)||""),C=((null===(k=I.checkout.shippingAddress)||void 0===k?void 0:k.firstName)||"")+" "+((null===(T=I.checkout.shippingAddress)||void 0===T?void 0:T.lastName)||""),D=I.paymentGateways.find((function(e){var t;return e.id===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),S=null===(y=I.successTransaction)||void 0===y?void 0:y.paymentMethodDetail,R=e.useMemo((function(){var t,a,o,s;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:paymentMethod")),D&&e.createElement(e.Fragment,null,!!D.logoUrl&&e.createElement("div",{className:i.PaymentLogoContainer},e.createElement("img",{src:D.logoUrl})),!D.logoUrl&&e.createElement("div",{className:i.InfoText},D.paymentMethodType===p.CREDIT_CARD&&D.type===v.INTERNAL?L("checkout-page:creditCard"):D.name),!!D.description&&D.type!==v.EXTERNAL&&e.createElement("div",{className:i.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:D.description}}))),"CREDIT_CARD"===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},e.createElement("div",{className:i.CardLogoContainer},function(){var t,a;switch(null===(a=null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation){case f.AMERICAN_EXPRESS:return e.createElement(n,null);case f.MASTER_CARD:return e.createElement(d,null);case f.TROY:return e.createElement(c,null);case f.VISA:return e.createElement(l,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==S?void 0:S.lastFourDigits)||""))),(null===(a=null==S?void 0:S.installment)||void 0===a?void 0:a.installmentCount)&&S.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},"".concat(S.installment.installmentCount," ").concat(L("checkout-page:installments"))),null!==S.installment.installmentPrice&&e.createElement("div",{className:i.InfoText},"".concat(S.installment.installmentCount," x ").concat(m(S.installment.installmentPrice,I.checkout.currencyCode,I.checkout.currencySymbol)))))),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:billingAddress")),!!(null===(o=I.checkout.billingAddress)||void 0===o?void 0:o.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},I.checkout.billingAddress.company),e.createElement("div",{className:i.InfoText},null===(s=I.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),b=e.useMemo((function(){var t,a,o,s,r;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(t=I.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:i.InfoText},A),!!(null===(a=I.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&e.createElement("div",{className:i.InfoText},null===(o=I.checkout.shippingAddress)||void 0===o?void 0:o.phone)),e.createElement("div",null,"in-store"===I.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:receiver")),e.createElement("div",{className:[i.InfoText,i.withMBottom].join(" ")},C)),e.createElement("div",{className:i.InfoTitle},"address"===I.deliveryMethod?L("checkout-page:shippingAddress"):L("checkout-page:pickUpLocation")),!!(null===(s=I.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},I.checkout.shippingAddress.company),e.createElement("div",{className:i.InfoText},null===(r=I.checkout.shippingAddress)||void 0===r?void 0:r.addressText)))}),[]);return e.createElement("div",{className:i.StepSuccess},e.createElement("div",{className:i.SuccessTitleContainer},e.createElement(s,null),e.createElement("span",{className:i.SuccessTitle},L("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:i.SuccessSubTitle},L("address"===I.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:A})),e.createElement("div",{className:[i.InfoGrid,i.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:orderNoAndDate")),e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},"#"+(I.checkout.orderNumber||"")),e.createElement("div",{className:i.InfoText},I.checkout.dateStr),e.createElement(j,{vm:I})),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(N=I.checkout.customer)||void 0===N?void 0:N.email),e.createElement("div",{className:i.InfoText},A))),I.postCheckoutCampaignOffer&&e.createElement(g,{vm:I,campaignOffer:I.postCheckoutCampaignOffer}),e.createElement(r,{title:L("checkout-page:paymentSummary")},R),!I.isDigitalOnly&&e.createElement(r,{title:L("checkout-page:shippingSummary")},b),e.createElement("div",{className:i.Actions},e.createElement("div",{className:i.HelpText},e.createElement("span",null,L("checkout-page:helpCtaQuestion")),e.createElement("span",{className:i.Cta,onClick:function(){return I.setContactModalVisible(!0)}},L("checkout-page:helpCta"))),e.createElement(a,{text:L("checkout-page:actions.backToShopping"),onClick:I.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),j=t((function(t){var a,o=t.vm,s=u().t,r=i.Yellow;switch(o.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:r=i.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:r=i.Red}return e.createElement("div",{className:[i.OrderStatus,r].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[E.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED,E.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[E.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[E.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{h as StepSuccess};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as a}from"../../components/button/index.js";import{CART_LS_KEY as o}from"../../../../store/cart/index.js";import i from"./style.module.scss.js";import s from"../../components/svg/success-circle.js";import r from"../../components/expandable-section/index.js";import n from"../../components/credit-card-form/svg/amex.js";import d from"../../components/credit-card-form/svg/master-card.js";import c from"../../components/credit-card-form/svg/troy.js";import l from"../../components/credit-card-form/svg/visa.js";import"@ikas/storefront-config";import{formatCurrency as m}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"mobx";import"../../../../models/data/blog/index.js";import"../../../../models/data/brand/index.js";import{IkasPaymentMethodType as p,IkasPaymentGatewayType as v,IkasOrderPackageStatus as E,IkasTransactionCardAssociation as f}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"../../../../models/data/checkout/index.js";import"../../../../models/data/checkout-settings/index.js";import"../../../../models/data/city/index.js";import"../../../../models/data/country/index.js";import"../../../../models/data/customer/address/index.js";import"../../../../models/data/customer/attribute/index.js";import"../../../../models/data/customer/review/summary/index.js";import"../../../../models/data/customer/review/index.js";import"../../../../models/data/customer/index.js";import"../../../../models/data/district/index.js";import"../../../../models/data/favorite-product/index.js";import"../../../../models/data/filter-category/index.js";import"../../../../models/data/html-meta-data/index.js";import"../../../../models/data/image/index.js";import"../../../../models/data/order/address/index.js";import"../../../../models/data/order/line-item/variant/value/index.js";import"../../../../models/data/order/line-item/variant/index.js";import"../../../../models/data/order/line-item/index.js";import"../../../../models/data/order/package/index.js";import"../../../../models/data/order/index.js";import"../../../../models/data/payment-gateway/index.js";import"../../../../models/data/product/attribute-value/index.js";import"../../../../models/data/product/filter/index.js";import"../../../../models/data/product/option-set/option/index.js";import"../../../../models/data/product/option-set/index.js";import"../../../../models/data/product/variant/price/index.js";import"../../../../models/data/product/variant/index.js";import"../../../../models/data/variant-type/index.js";import"../../../../models/data/product/index.js";import"../../../../models/data/raffle/index.js";import"../../../../models/data/state/index.js";import"../../../../models/data/theme-json/index.js";import"../../../../models/data/theme-json/custom-data/index.js";import"../../../../models/data/variant-type/variant-value/index.js";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/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 g from"../../components/offer-product/index.js";import{Analytics as x}from"../../../../analytics/analytics.js";import"../../../../analytics/head/index.js";var h=t((function(t){var E,h,k,T,y,N,I=t.vm,L=u().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(o);e&&e===I.checkout.id&&(I.successTransaction&&x.purchase(I.checkout,I.successTransaction),localStorage.removeItem(o)),window.handleKlarna(void 0)}}),[]);var A=((null===(E=I.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(h=I.checkout.customer)||void 0===h?void 0:h.lastName)||""),C=((null===(k=I.checkout.shippingAddress)||void 0===k?void 0:k.firstName)||"")+" "+((null===(T=I.checkout.shippingAddress)||void 0===T?void 0:T.lastName)||""),D=I.paymentGateways.find((function(e){var t;return e.id===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),S=null===(y=I.successTransaction)||void 0===y?void 0:y.paymentMethodDetail,R=e.useMemo((function(){var t,a,o,s;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:paymentMethod")),D&&e.createElement(e.Fragment,null,!!D.logoUrl&&e.createElement("div",{className:i.PaymentLogoContainer},e.createElement("img",{src:D.logoUrl})),!D.logoUrl&&e.createElement("div",{className:i.InfoText},D.paymentMethodType===p.CREDIT_CARD&&D.type===v.INTERNAL?L("checkout-page:creditCard"):D.name),!!D.description&&D.type!==v.EXTERNAL&&e.createElement("div",{className:i.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:D.description}}))),"CREDIT_CARD"===(null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},e.createElement("div",{className:i.CardLogoContainer},function(){var t,a;switch(null===(a=null===(t=I.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===a?void 0:a.cardAssociation){case f.AMERICAN_EXPRESS:return e.createElement(n,null);case f.MASTER_CARD:return e.createElement(d,null);case f.TROY:return e.createElement(c,null);case f.VISA:return e.createElement(l,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==S?void 0:S.lastFourDigits)||""))),(null===(a=null==S?void 0:S.installment)||void 0===a?void 0:a.installmentCount)&&S.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},"".concat(S.installment.installmentCount," ").concat(L("checkout-page:installments"))),null!==S.installment.installmentPrice&&e.createElement("div",{className:i.InfoText},"".concat(S.installment.installmentCount," x ").concat(m(S.installment.installmentPrice,I.checkout.currencyCode,I.checkout.currencySymbol)))))),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:billingAddress")),!!(null===(o=I.checkout.billingAddress)||void 0===o?void 0:o.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},I.checkout.billingAddress.company),e.createElement("div",{className:i.InfoText},null===(s=I.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),b=e.useMemo((function(){var t,a,o,s,r;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(t=I.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:i.InfoText},A),!!(null===(a=I.checkout.shippingAddress)||void 0===a?void 0:a.phone)&&e.createElement("div",{className:i.InfoText},null===(o=I.checkout.shippingAddress)||void 0===o?void 0:o.phone)),e.createElement("div",null,"in-store"===I.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:receiver")),e.createElement("div",{className:[i.InfoText,i.withMBottom].join(" ")},C)),e.createElement("div",{className:i.InfoTitle},"address"===I.deliveryMethod?L("checkout-page:shippingAddress"):L("checkout-page:pickUpLocation")),!!(null===(s=I.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},I.checkout.shippingAddress.company),e.createElement("div",{className:i.InfoText},null===(r=I.checkout.shippingAddress)||void 0===r?void 0:r.addressText)))}),[]);return e.createElement("div",{className:i.StepSuccess},e.createElement("div",{className:i.SuccessTitleContainer},e.createElement(s,null),e.createElement("span",{className:i.SuccessTitle},L("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:i.SuccessSubTitle},L("address"===I.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:A})),e.createElement("div",{className:[i.InfoGrid,i.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:orderNoAndDate")),e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},"#"+(I.checkout.orderNumber||"")),e.createElement("div",{className:i.InfoText},I.checkout.dateStr),e.createElement(j,{vm:I})),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},L("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(N=I.checkout.customer)||void 0===N?void 0:N.email),e.createElement("div",{className:i.InfoText},A))),I.postCheckoutCampaignOffer&&e.createElement(g,{vm:I,campaignOffer:I.postCheckoutCampaignOffer}),e.createElement(r,{title:L("checkout-page:paymentSummary")},R),!I.isDigitalOnly&&e.createElement(r,{title:L("checkout-page:shippingSummary")},b),e.createElement("div",{className:i.Actions},e.createElement("div",{className:i.HelpText},e.createElement("span",null,L("checkout-page:helpCtaQuestion")),e.createElement("span",{className:i.Cta,onClick:function(){return I.setContactModalVisible(!0)}},L("checkout-page:helpCta"))),e.createElement(a,{text:L("checkout-page:actions.backToShopping"),onClick:I.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),j=t((function(t){var a,o=t.vm,s=u().t,r=i.Yellow;switch(o.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:r=i.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:r=i.Red}return e.createElement("div",{className:[i.OrderStatus,r].join(" ")},o.checkout.orderPackageStatus?null===(a=[{types:[E.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED,E.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[E.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[E.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{h as StepSuccess};
@@ -1 +1 @@
1
- import{__assign as t}from'./../../ext/tslib/tslib.es6.js';import*as e from"react";import{observer as o}from"mobx-react-lite";import r from"next/head.js";import{useRouter as i}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"mobx";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as a}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"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";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/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as s}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import{IkasBaseStore as n}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var d=o((function(o){var n=o.pageType,d=o.pageTitle,p=o.pageDescription,l=o.canonicals,c=o.disableIndex,u=o.pageSpecificData,g=o.merchantSettings,j=o.addOgpMetas,f=o.productReviewSummary,h=i(),v="undefined"!=typeof window,x="local"===process.env.NEXT_PUBLIC_ENV,y=h.asPath.split("?")[0].replace("/",""),b=s.getRoutings().filter((function(t){return t.id!==s.getStorefrontRoutingId()})),k=s.getCurrentRouting(),w=(null==k?void 0:k.path)?"/"+k.path:"",D=x?"http://localhost:3333":"https://"+s.getDomain();e.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[n,u]);var E=e.useMemo((function(){if(u&&u.href)return"".concat(D).concat(u.href)}),[u]),_=e.useMemo((function(){var t=[];if(j)if(t.push({property:"og:type",content:"website"}),t.push({property:"og:site_name",content:"https://"+s.getDomain()}),d&&t.push({property:"og:title",content:d}),p&&t.push({property:"og:description",content:p}),t.push({property:"og:url",content:E||(v?window.location.href:"")||"https://".concat(s.getDomain())}),u&&n===a.PRODUCT){var e=u.selectedVariant.mainImage;(null==e?void 0:e.image)&&t.push({property:"og:image",content:e.image.src})}else(null==g?void 0:g.logo)&&t.push({property:"og:image",content:g.logo.src});return t}),[d,u,E,p,g,j,g]),C=e.useMemo((function(){var e=[];if(g){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+s.getDomain()},r=function(e){var o,r,i,a,n,d,m=(null==e?void 0:e.logo)?e.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==e?void 0:e.merchantName,logo:m,image:m,url:"https://"+s.getDomain(),telephone:null==e?void 0:e.phone,address:t(t({"@type":"PostalAddress",streetAddress:null===(o=e.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(i=null===(r=e.address)||void 0===r?void 0:r.city)||void 0===i?void 0:i.name},e.address&&e.address.state&&{addressRegion:e.address.state.code}),{postalCode:null===(a=e.address)||void 0===a?void 0:a.postalCode,addressCountry:null===(d=null===(n=e.address)||void 0===n?void 0:n.country)||void 0===d?void 0:d.code})}}(g);e.push(o),e.push(r)}if(u&&n===a.PRODUCT){var i=u,d=function(e,o){var r,i,a,n;try{var d="https://".concat(s.getDomain()).concat(e.href),m=e.selectedVariant;return t(t({"@context":"https://schema.org/","@type":"Product",name:e.name,description:null===(r=e.metaData)||void 0===r?void 0:r.description,image:null===(i=m.images)||void 0===i?void 0:i.map((function(t){return t.image?t.image.src:""})),productId:m.id,sku:m.sku,mpn:(null===(a=m.barcodeList)||void 0===a?void 0:a.length)?m.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=e.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:d,priceCurrency:m.price.currency||"TRY",price:m.price.finalPrice,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:m.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(t){}}(i,f||null);if(d&&e.push(d),i.categories.length)(l=m(i.categories[0]))&&e.push(l)}if(u&&n===a.CATEGORY){var p=function(t){var e,o;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(s.getDomain()).concat(t.href),name:null===(e=t.metaData)||void 0===e?void 0:e.pageTitle,description:null===(o=t.metaData)||void 0===o?void 0:o.description,image:t.image?t.image.src:void 0}}catch(t){}}(u),l=m(u);p&&e.push(p),l&&e.push(l)}return e}),[u,g]);return e.createElement(r,null,e.createElement("title",null,d||""),e.createElement("meta",{name:"description",content:p||""}),b.map((function(t){return e.createElement("link",{key:t.id,rel:"alternate",hrefLang:t.locale,href:"".concat(D+(t.path?"/"+t.path:""),"/").concat(y)})})),!!k&&!!b.length&&e.createElement("link",{key:"current-routing-hreflang",rel:"alternate",hrefLang:k.locale,href:"".concat(D).concat(w,"/").concat(y)}),!!c&&e.createElement("meta",{name:"robots",content:"noindex"}),!!j&&_.map((function(t,o){return e.createElement("meta",{key:"".concat(t.content,"-").concat(o),property:t.property,content:t.content})})),!!l&&l.map((function(t,o){return e.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(D).concat(w).concat(t)})})),e.createElement("link",{rel:"canonical",href:"".concat(D).concat(w,"/").concat(y)}),!!C.length&&C.map((function(t,o){return e.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(t)}})})))}));function m(t){try{var e=n.getInstance(),o=t.categoryPathItems.map((function(t,e){return{"@type":"ListItem",position:e+1,name:t.name,item:"https://"+s.getDomain()+t.href}}));return e.currentPageType===a.CATEGORY&&o.push({"@type":"ListItem",position:t.categoryPathItems.length+1,name:t.name,item:"https://"+s.getDomain()+t.href}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:t.categoryPathItems.length?o:[{"@type":"ListItem",position:1,name:t.name,item:"https://"+s.getDomain()+t.href}]}}catch(t){}}export{d as IkasPageHead};
1
+ import{__assign as e}from'./../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as o}from"mobx-react-lite";import a from"next/head.js";import{useRouter as r}from"next/router";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"mobx";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasThemeJsonPageType as i}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"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";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/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasStorefrontConfig as s}from"@ikas/storefront-config";import"../../analytics/analytics.js";import"../../analytics/head/index.js";import"./index.js";import"next/image.js";import"@ikas/storefront-model-functions";import"../link/index.js";import"../page-editor/loader/style.module.scss.js";import"../google-captcha/index.js";import"../../pages/home.js";import"../../pages/_slug_/index.js";import"../../pages/pages/_slug_.js";import"../../pages/checkout.js";import"../../pages/account/index.js";import"../../pages/account/addresses.js";import"../../pages/account/orders/index.js";import"../../pages/account/orders/_id_.js";import"../../pages/account/login.js";import"../../pages/account/register.js";import"../../pages/account/forgot-password.js";import"../../pages/account/recover-password.js";import"../../pages/cart.js";import"../../pages/editor.js";import"../../pages/account/favorite-products.js";import"../../pages/search.js";import"next/error.js";import"../../pages/blog/index.js";import"../../pages/blog/_slug_.js";import"../../pages/raffle/_slug_.js";import"../../pages/raffle/index.js";import"../../pages/account/raffles.js";import{IkasBaseStore as n}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import"lodash/get";var d=o((function(o){var n=o.pageType,d=o.pageTitle,p=o.pageDescription,c=o.canonicals,u=o.disableIndex,g=o.pageSpecificData,f=o.merchantSettings,j=o.addOgpMetas,v=o.productReviewSummary,h=r(),x="undefined"!=typeof window,y="local"===process.env.NEXT_PUBLIC_ENV,b=h.asPath.split("?")[0].replace("/",""),k=s.getRoutings().filter((function(e){return e.id!==s.getStorefrontRoutingId()})),w=s.getCurrentRouting(),C=(null==w?void 0:w.path)?"/"+w.path:"",E=y?"http://localhost:3333":"https://"+s.getDomain();t.useEffect((function(){document.documentElement.lang=s.getCurrentLocale()}),[n,g]);var L=t.useMemo((function(){if(g&&g.href)return"".concat(E).concat(g.href)}),[g]),T=t.useMemo((function(){var e=[];if(j)if(e.push({property:"og:type",content:"website"}),e.push({property:"og:site_name",content:"https://"+s.getDomain()}),d&&e.push({property:"og:title",content:d}),p&&e.push({property:"og:description",content:p}),e.push({property:"og:url",content:L||(x?window.location.href:"")||"https://".concat(s.getDomain())}),g&&n===i.PRODUCT){var t=g.selectedVariant.mainImage;(null==t?void 0:t.image)&&e.push({property:"og:image",content:t.image.src})}else(null==f?void 0:f.logo)&&e.push({property:"og:image",content:f.logo.src});return e}),[d,g,L,p,f,j,f]),D=t.useMemo((function(){var t=[];if(f){var o={"@context":"https://schema.org","@type":"Website",url:"https://"+s.getDomain()},a=function(t){var o,a,r,i,n,d,m=(null==t?void 0:t.logo)?t.logo.src:void 0;return{"@context":"https://schema.org","@type":"Store",name:null==t?void 0:t.merchantName,logo:m,image:m,url:"https://"+s.getDomain(),telephone:null==t?void 0:t.phone,address:e(e({"@type":"PostalAddress",streetAddress:null===(o=t.address)||void 0===o?void 0:o.addressLine1,addressLocality:null===(r=null===(a=t.address)||void 0===a?void 0:a.city)||void 0===r?void 0:r.name},t.address&&t.address.state&&{addressRegion:t.address.state.code}),{postalCode:null===(i=t.address)||void 0===i?void 0:i.postalCode,addressCountry:null===(d=null===(n=t.address)||void 0===n?void 0:n.country)||void 0===d?void 0:d.code})}}(f);t.push(o),t.push(a)}if(g&&n===i.PRODUCT){var r=g,d=function(t,o){var a,r,i,n;try{var d="https://".concat(s.getDomain()).concat(t.href),m=t.selectedVariant;return e(e({"@context":"https://schema.org/","@type":"Product",name:t.name,description:null===(a=t.metaData)||void 0===a?void 0:a.description,image:null===(r=m.images)||void 0===r?void 0:r.map((function(e){return e.image?e.image.src:""})),productId:m.id,sku:m.sku,mpn:(null===(i=m.barcodeList)||void 0===i?void 0:i.length)?m.barcodeList[0]:"",brand:{"@type":"Brand",name:null===(n=t.brand)||void 0===n?void 0:n.name}},o&&{aggregateRating:{"@type":"AggregateRating",ratingValue:o.averageStar,reviewCount:o.totalReview}}),{offers:{"@type":"Offer",url:d,priceCurrency:m.price.currency||"TRY",price:m.price.finalPrice,priceValidUntil:"",itemCondition:"https://schema.org/NewCondition",availability:m.stock>0?"https://schema.org/InStock":"https://schema.org/OutOfStock"}})}catch(e){}}(r,v||null);if(d&&t.push(d),r.categories.length)(p=m(r.categories[0]))&&t.push(p)}if(g&&n===i.CATEGORY){var l=function(e){var t,o;try{return{"@context":"http://schema.org","@type":"CollectionPage",url:"https://".concat(s.getDomain()).concat(e.href),name:null===(t=e.metaData)||void 0===t?void 0:t.pageTitle,description:null===(o=e.metaData)||void 0===o?void 0:o.description,image:e.image?e.image.src:void 0}}catch(e){}}(g),p=m(g);l&&t.push(l),p&&t.push(p)}return t}),[g,f]),R=t.useMemo((function(){var e,t=null===(e=s.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===s.getCurrentLocale()&&e.pageType===n}));return t?l(g,n,t.titleTemplate||""):null}),[n,g]),_=t.useMemo((function(){var e,t=null===(e=s.getMetaTemplates())||void 0===e?void 0:e.find((function(e){return e.locale===s.getCurrentLocale()&&e.pageType===n}));return t?l(g,n,t.descriptionTemplate||""):null}),[n,g]);return t.createElement(a,null,t.createElement("title",null,d||R||""),t.createElement("meta",{name:"description",content:p||_||""}),k.map((function(e){return t.createElement("link",{key:e.id,rel:"alternate",hrefLang:e.locale,href:"".concat(E+(e.path?"/"+e.path:""),"/").concat(b)})})),!!w&&!!k.length&&t.createElement("link",{key:"current-routing-hreflang",rel:"alternate",hrefLang:w.locale,href:"".concat(E).concat(C,"/").concat(b)}),!!u&&t.createElement("meta",{name:"robots",content:"noindex"}),!!j&&T.map((function(e,o){return t.createElement("meta",{key:"".concat(e.content,"-").concat(o),property:e.property,content:e.content})})),!!c&&c.map((function(e,o){return t.createElement("link",{key:o+"url",rel:"canonical",href:"".concat(E).concat(C).concat(e)})})),t.createElement("link",{rel:"canonical",href:"".concat(E).concat(C,"/").concat(b)}),!!D.length&&D.map((function(e,o){return t.createElement("script",{key:o,type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})))}));function m(e){try{var t=n.getInstance(),o=e.categoryPathItems.map((function(e,t){return{"@type":"ListItem",position:t+1,name:e.name,item:"https://"+s.getDomain()+e.href}}));return t.currentPageType===i.CATEGORY&&o.push({"@type":"ListItem",position:e.categoryPathItems.length+1,name:e.name,item:"https://"+s.getDomain()+e.href}),{"@context":"http://schema.org","@type":"BreadcrumbList",itemListElement:e.categoryPathItems.length?o:[{"@type":"ListItem",position:1,name:e.name,item:"https://"+s.getDomain()+e.href}]}}catch(e){}}function l(e,t,o){var a,r,s=o;try{switch(t){case i.PRODUCT:var n=e,d=n.name,m=(null===(a=n.brand)||void 0===a?void 0:a.name)||"",l=n.selectedVariant.sku||"",p=(null===(r=n.selectedVariant.barcodeList)||void 0===r?void 0:r.length)?n.selectedVariant.barcodeList[0]:"";s.includes("{{name}}")&&(s=s.replace("{{name}}",d)),s.includes("{{brand}}")&&(s=s.replace("{{brand}}",m)),s.includes("{{sku}}")&&(s=s.replace("{{sku}}",l)),s.includes("{{barcode}}")&&(s=s.replace("{{barcode}}",p));break;case i.BRAND:case i.CATEGORY:case i.BLOG_CATEGORY:var c=e.name||"";s.includes("{{name}}")&&(s=s.replace("{{name}}",c));break;case i.BLOG:var u=e.title;s.includes("{{name}}")&&(s=s.replace("{{name}}",u))}}catch(e){}return s.trimEnd()}export{d as IkasPageHead};
@@ -47,6 +47,7 @@ export declare class IkasOrder extends IkasBaseModel implements IOrder {
47
47
  constructor(data: Partial<IOrderConstructorData>);
48
48
  get items(): IkasOrderLineItem[];
49
49
  get itemCount(): number;
50
+ get itemQuantity(): number;
50
51
  get refundableItems(): IkasOrderLineItem[];
51
52
  get unfullfilledItems(): IkasOrderLineItem[];
52
53
  get refundedItems(): IkasOrderLineItem[];
@@ -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 l}from"./invoice/index.js";import{IkasOrderPaymentMethod as u}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{IkasOrderShippingMethod as m,IkasOrderStatus as p}from"@ikas/storefront-models";export{IkasOrderCancelReason,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus}from"@ikas/storefront-models";import{makeObservable as f,observable as g,computed as b}from"mobx";import{IkasOrderFunctions as y}from"@ikas/storefront-model-functions";import{formatCurrency as h}from"../../../utils/currency.js";var P=function(c){function P(e){var y,h,P,j,k,A,S,v,x,I,O=this;return(O=c.call(this,e)||this).billingAddress=null,O.cancelReason=null,O.cancelledAt=null,O.currencySymbol=null,O.customer=null,O.customerId=null,O.giftPackageLines=null,O.giftPackageNote=null,O.invoices=null,O.isGiftPackage=null,O.note=null,O.orderAdjustments=null,O.orderNumber=null,O.orderPackageStatus=null,O.orderPackages=null,O.orderPaymentStatus=null,O.orderedAt=null,O.paymentMethods=null,O.shippingAddress=null,O.shippingLines=null,O.taxLines=null,O.billingAddress=e.billingAddress?new t(e.billingAddress):null,O.cancelReason=e.cancelReason||null,O.cancelledAt=e.cancelledAt||null,O.currencyCode=e.currencyCode||"",O.currencySymbol=e.currencySymbol||null,O.customer=e.customer?new o(e.customer):null,O.customerId=e.customerId||null,O.giftPackageLines=(null===(y=e.giftPackageLines)||void 0===y?void 0:y.map((function(e){return new i(e)})))||null,O.giftPackageNote=e.giftPackageNote||null,O.invoices=(null===(h=e.invoices)||void 0===h?void 0:h.map((function(e){return new l(e)})))||null,O.isGiftPackage=e.isGiftPackage||null,O.note=e.note||null,O.orderAdjustments=(null===(P=e.orderAdjustments)||void 0===P?void 0:P.map((function(e){return new s(e)})))||null,O.orderLineItems=(null===(j=e.orderLineItems)||void 0===j?void 0:j.map((function(e){return new r(e)})).filter((function(e){return!e.deleted})))||[],O.orderNumber=e.orderNumber||null,O.orderPackageStatus=e.orderPackageStatus||null,O.orderPackages=(null===(k=e.orderPackages)||void 0===k?void 0:k.map((function(e){return new a(e)})))||null,O.orderPaymentStatus=e.orderPaymentStatus||null,O.orderedAt=e.orderedAt||null,O.paymentMethods=(null===(A=e.paymentMethods)||void 0===A?void 0:A.map((function(e){return new u(e)})))||null,O.shippingAddress=e.shippingAddress?new t(e.shippingAddress):null,O.shippingLines=(null===(S=e.shippingLines)||void 0===S?void 0:S.map((function(e){return new n(e)})))||null,O.shippingMethod=e.shippingMethod||m.SHIPMENT,O.status=e.status||p.CREATED,O.taxLines=(null===(v=e.taxLines)||void 0===v?void 0:v.map((function(e){return new d(e)})))||null,O.totalFinalPrice=null!==(x=e.totalFinalPrice)&&void 0!==x?x:0,O.totalPrice=null!==(I=e.totalPrice)&&void 0!==I?I:0,O.refundSettings=e.refundSettings,f(O,{billingAddress:g,cancelReason:g,cancelledAt:g,currencyCode:g,currencySymbol:g,customer:g,customerId:g,giftPackageLines:g,giftPackageNote:g,invoices:g,isGiftPackage:g,note:g,orderAdjustments:g,orderLineItems:g,orderNumber:g,orderPackageStatus:g,orderPackages:g,orderPaymentStatus:g,orderedAt:g,paymentMethods:g,shippingAddress:g,shippingLines:g,shippingMethod:g,status:g,taxLines:g,totalFinalPrice:g,totalPrice:g,refundSettings:g,items:b,itemCount:b,refundableItems:b,unfullfilledItems:b,refundedItems:b,totalTax:b,formattedTotalTax:b,shippingTotal:b,formattedShippingTotal:b,formattedTotalFinalPrice:b,formattedTotalPrice:b,hasCustomer:b,hasValidCustomerEmail:b,customerFullName:b,formattedDate:b,couponAdjustment:b,nonCouponAdjustments:b}),O}return e(P,c),Object.defineProperty(P.prototype,"items",{get:function(){return this.orderLineItems},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"refundableItems",{get:function(){return this.refundSettings?y.getRefundableItems(this,this.refundSettings):[]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"unfullfilledItems",{get:function(){return y.getUnfullfilledItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"refundedItems",{get:function(){return y.getRefundedItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"totalTax",{get:function(){return y.getTotalTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedTotalTax",{get:function(){return h(this.totalTax,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingTotal",{get:function(){return y.getShippingTotal(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedShippingTotal",{get:function(){return h(this.shippingTotal,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedTotalFinalPrice",{get:function(){return h(this.totalFinalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedTotalPrice",{get:function(){return h(this.totalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasCustomer",{get:function(){return y.hasCustomer(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasValidCustomerEmail",{get:function(){return y.hasValidCustomerEmail(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"customerFullName",{get:function(){return y.getCustomerFullName(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedDate",{get:function(){return y.getFormattedDate(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"couponAdjustment",{get:function(){return y.getCouponAdjustment(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"nonCouponAdjustments",{get:function(){return y.getNonCouponAdjustments(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRefundEnabled",{get:function(){return!this.refundableItems.some((function(e){return null===e.refundQuantity}))},enumerable:!1,configurable:!0}),P}(c);export{P 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 a}from"./adjustment/index.js";import{IkasOrderPackage as s}from"./package/index.js";import{IkasOrderTaxLine as d}from"./tax-line/index.js";import{IkasBaseModel as c}from"../base/index.js";import{IkasOrderShippingMethod as m,IkasOrderStatus as f}from"@ikas/storefront-models";export{IkasOrderCancelReason,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus}from"@ikas/storefront-models";import{makeObservable as p,observable as g,computed as b}from"mobx";import{IkasOrderFunctions as y}from"@ikas/storefront-model-functions";import{formatCurrency as h}from"../../../utils/currency.js";var P=function(c){function P(e){var y,h,P,j,k,A,S,v,x,I,O=this;return(O=c.call(this,e)||this).billingAddress=null,O.cancelReason=null,O.cancelledAt=null,O.currencySymbol=null,O.customer=null,O.customerId=null,O.giftPackageLines=null,O.giftPackageNote=null,O.invoices=null,O.isGiftPackage=null,O.note=null,O.orderAdjustments=null,O.orderNumber=null,O.orderPackageStatus=null,O.orderPackages=null,O.orderPaymentStatus=null,O.orderedAt=null,O.paymentMethods=null,O.shippingAddress=null,O.shippingLines=null,O.taxLines=null,O.billingAddress=e.billingAddress?new t(e.billingAddress):null,O.cancelReason=e.cancelReason||null,O.cancelledAt=e.cancelledAt||null,O.currencyCode=e.currencyCode||"",O.currencySymbol=e.currencySymbol||null,O.customer=e.customer?new o(e.customer):null,O.customerId=e.customerId||null,O.giftPackageLines=(null===(y=e.giftPackageLines)||void 0===y?void 0:y.map((function(e){return new i(e)})))||null,O.giftPackageNote=e.giftPackageNote||null,O.invoices=(null===(h=e.invoices)||void 0===h?void 0:h.map((function(e){return new u(e)})))||null,O.isGiftPackage=e.isGiftPackage||null,O.note=e.note||null,O.orderAdjustments=(null===(P=e.orderAdjustments)||void 0===P?void 0:P.map((function(e){return new a(e)})))||null,O.orderLineItems=(null===(j=e.orderLineItems)||void 0===j?void 0:j.map((function(e){return new r(e)})).filter((function(e){return!e.deleted})))||[],O.orderNumber=e.orderNumber||null,O.orderPackageStatus=e.orderPackageStatus||null,O.orderPackages=(null===(k=e.orderPackages)||void 0===k?void 0:k.map((function(e){return new s(e)})))||null,O.orderPaymentStatus=e.orderPaymentStatus||null,O.orderedAt=e.orderedAt||null,O.paymentMethods=(null===(A=e.paymentMethods)||void 0===A?void 0:A.map((function(e){return new l(e)})))||null,O.shippingAddress=e.shippingAddress?new t(e.shippingAddress):null,O.shippingLines=(null===(S=e.shippingLines)||void 0===S?void 0:S.map((function(e){return new n(e)})))||null,O.shippingMethod=e.shippingMethod||m.SHIPMENT,O.status=e.status||f.CREATED,O.taxLines=(null===(v=e.taxLines)||void 0===v?void 0:v.map((function(e){return new d(e)})))||null,O.totalFinalPrice=null!==(x=e.totalFinalPrice)&&void 0!==x?x:0,O.totalPrice=null!==(I=e.totalPrice)&&void 0!==I?I:0,O.refundSettings=e.refundSettings,p(O,{billingAddress:g,cancelReason:g,cancelledAt:g,currencyCode:g,currencySymbol:g,customer:g,customerId:g,giftPackageLines:g,giftPackageNote:g,invoices:g,isGiftPackage:g,note:g,orderAdjustments:g,orderLineItems:g,orderNumber:g,orderPackageStatus:g,orderPackages:g,orderPaymentStatus:g,orderedAt:g,paymentMethods:g,shippingAddress:g,shippingLines:g,shippingMethod:g,status:g,taxLines:g,totalFinalPrice:g,totalPrice:g,refundSettings:g,items:b,itemCount:b,refundableItems:b,unfullfilledItems:b,refundedItems:b,totalTax:b,formattedTotalTax:b,shippingTotal:b,formattedShippingTotal:b,formattedTotalFinalPrice:b,formattedTotalPrice:b,hasCustomer:b,hasValidCustomerEmail:b,customerFullName:b,formattedDate:b,couponAdjustment:b,nonCouponAdjustments:b}),O}return e(P,c),Object.defineProperty(P.prototype,"items",{get:function(){return this.orderLineItems},enumerable:!1,configurable:!0}),Object.defineProperty(P.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(P.prototype,"itemQuantity",{get:function(){return this.items.reduce((function(e,t){return e+t.quantity}),0)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"refundableItems",{get:function(){return this.refundSettings?y.getRefundableItems(this,this.refundSettings):[]},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"unfullfilledItems",{get:function(){return y.getUnfullfilledItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"refundedItems",{get:function(){return y.getRefundedItems(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"totalTax",{get:function(){return y.getTotalTax(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedTotalTax",{get:function(){return h(this.totalTax,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"shippingTotal",{get:function(){return y.getShippingTotal(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedShippingTotal",{get:function(){return h(this.shippingTotal,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedTotalFinalPrice",{get:function(){return h(this.totalFinalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedTotalPrice",{get:function(){return h(this.totalPrice,this.currencyCode,this.currencySymbol||"")},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasCustomer",{get:function(){return y.hasCustomer(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"hasValidCustomerEmail",{get:function(){return y.hasValidCustomerEmail(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"customerFullName",{get:function(){return y.getCustomerFullName(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"formattedDate",{get:function(){return y.getFormattedDate(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"couponAdjustment",{get:function(){return y.getCouponAdjustment(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"nonCouponAdjustments",{get:function(){return y.getNonCouponAdjustments(this)},enumerable:!1,configurable:!0}),Object.defineProperty(P.prototype,"isRefundEnabled",{get:function(){return!this.refundableItems.some((function(e){return null===e.refundQuantity}))},enumerable:!1,configurable:!0}),P}(c);export{P as IkasOrder};
@@ -4,11 +4,13 @@ import { IkasStorefrontRouting } from "./routing";
4
4
  import { IkasStorefrontTheme } from "./theme";
5
5
  import { IkasStorefrontStatus } from "@ikas/storefront-models";
6
6
  import { IkasStorefront as IStorefront } from "@ikas/storefront-models";
7
+ import { IkasStorefontMetaTemplates } from "./meta-templates";
7
8
  export declare class IkasStorefront implements IStorefront {
8
9
  id: string;
9
10
  name: string;
10
11
  status: IkasStorefrontStatus;
11
12
  mainStorefrontThemeId: string | null;
13
+ metaTemplates: IkasStorefontMetaTemplates[] | null;
12
14
  pickUpStockLocationIds: string[] | null;
13
15
  emailSettingsId: string | null;
14
16
  salesChannelId: string | null;
@@ -18,6 +20,7 @@ export declare class IkasStorefront implements IStorefront {
18
20
  universalAnalyticsId: string | null;
19
21
  tiktokPixelId: string | null;
20
22
  token: string | null;
23
+ robotsTxt: string | null;
21
24
  localizations: IkasStorefrontLocalization[];
22
25
  routings: IkasStorefrontRouting[];
23
26
  domains: IkasStorefrontDomain[];
@@ -1 +1 @@
1
- import{IkasStorefrontLocalization as t}from"./localization/index.js";import{IkasStorefrontDomain as i}from"./domain/index.js";import{IkasStorefrontRouting as n}from"./routing/index.js";import{IkasStorefrontTheme as o}from"./theme/index.js";import{IkasStorefrontStatus as s}from"@ikas/storefront-models";export{IkasStorefrontStatus}from"@ikas/storefront-models";import{makeAutoObservable as e}from"mobx";var l=function(l){void 0===l&&(l={}),this.id=l.id||"",this.name=l.name||"",this.status=l.status||s.WAITING,this.mainStorefrontThemeId=l.mainStorefrontThemeId||null,this.pickUpStockLocationIds=l.pickUpStockLocationIds||null,this.emailSettingsId=l.emailSettingsId||null,this.salesChannelId=l.salesChannelId||null,this.gtmId=l.gtmId||null,this.fbpId=l.fbpId||null,this.analytics4Id=l.analytics4Id||null,this.universalAnalyticsId=l.universalAnalyticsId||null,this.tiktokPixelId=l.tiktokPixelId||null,this.token=l.token||null,this.localizations=l.localizations?l.localizations.map((function(i){return new t(i)})):[],this.routings=l.routings?l.routings.map((function(t){return new n(t)})):[],this.domains=l.domains?l.domains.map((function(t){return new i(t)})):[],this.themes=l.themes?l.themes.map((function(t){return new o(t)})):[],e(this)};export{l as IkasStorefront};
1
+ import{IkasStorefrontLocalization as t}from"./localization/index.js";import{IkasStorefrontDomain as i}from"./domain/index.js";import{IkasStorefrontRouting as n}from"./routing/index.js";import{IkasStorefrontTheme as s}from"./theme/index.js";import{IkasStorefrontStatus as o}from"@ikas/storefront-models";export{IkasStorefrontStatus}from"@ikas/storefront-models";import{makeAutoObservable as e}from"mobx";import{IkasStorefontMetaTemplates as a}from"./meta-templates/index.js";var l=function(l){void 0===l&&(l={}),this.id=l.id||"",this.name=l.name||"",this.status=l.status||o.WAITING,this.mainStorefrontThemeId=l.mainStorefrontThemeId||null,this.pickUpStockLocationIds=l.pickUpStockLocationIds||null,this.emailSettingsId=l.emailSettingsId||null,this.salesChannelId=l.salesChannelId||null,this.gtmId=l.gtmId||null,this.fbpId=l.fbpId||null,this.analytics4Id=l.analytics4Id||null,this.universalAnalyticsId=l.universalAnalyticsId||null,this.tiktokPixelId=l.tiktokPixelId||null,this.token=l.token||null,this.robotsTxt=l.robotsTxt||null,this.metaTemplates=l.metaTemplates?l.metaTemplates.map((function(t){return new a(t)})):null,this.localizations=l.localizations?l.localizations.map((function(i){return new t(i)})):[],this.routings=l.routings?l.routings.map((function(t){return new n(t)})):[],this.domains=l.domains?l.domains.map((function(t){return new i(t)})):[],this.themes=l.themes?l.themes.map((function(t){return new s(t)})):[],e(this)};export{l as IkasStorefront};
@@ -0,0 +1,8 @@
1
+ import { IkasStorefontMetaTemplates as IStorefontMetaTemplates, StorefrontPageTypesEnum } from "@ikas/storefront-models";
2
+ export declare class IkasStorefontMetaTemplates implements IStorefontMetaTemplates {
3
+ descriptionTemplate: string | null;
4
+ locale: string | null;
5
+ pageType: StorefrontPageTypesEnum | null;
6
+ titleTemplate: string | null;
7
+ constructor(data: IStorefontMetaTemplates);
8
+ }
@@ -0,0 +1 @@
1
+ import{makeAutoObservable as e}from"mobx";var t=function(t){this.descriptionTemplate=t.descriptionTemplate,this.locale=t.locale,this.pageType=t.pageType,this.titleTemplate=t.titleTemplate,e(this)};export{t as IkasStorefontMetaTemplates};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "4.0.0-alpha.71",
3
+ "version": "4.0.0-alpha.73",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "Umut Ozan Yıldırım",
6
6
  "license": "ISC",
@@ -23,11 +23,11 @@
23
23
  "libphonenumber-js": "^1.10.6"
24
24
  },
25
25
  "devDependencies": {
26
- "@ikas/storefront-api": "^4.0.0-alpha.71",
27
- "@ikas/storefront-config": "^4.0.0-alpha.71",
28
- "@ikas/storefront-model-functions": "^4.0.0-alpha.71",
29
- "@ikas/storefront-models": "^4.0.0-alpha.71",
30
- "@ikas/storefront-providers": "^4.0.0-alpha.71",
26
+ "@ikas/storefront-api": "^4.0.0-alpha.73",
27
+ "@ikas/storefront-config": "^4.0.0-alpha.73",
28
+ "@ikas/storefront-model-functions": "^4.0.0-alpha.73",
29
+ "@ikas/storefront-models": "^4.0.0-alpha.73",
30
+ "@ikas/storefront-providers": "^4.0.0-alpha.73",
31
31
  "@rollup/plugin-commonjs": "^22.0.0",
32
32
  "@rollup/plugin-json": "^4.1.0",
33
33
  "@rollup/plugin-node-resolve": "^13.3.0",
@@ -53,11 +53,11 @@
53
53
  "query-string": "^6.13.8"
54
54
  },
55
55
  "peerDependencies": {
56
- "@ikas/storefront-api": "^4.0.0-alpha.71",
57
- "@ikas/storefront-config": "^4.0.0-alpha.71",
58
- "@ikas/storefront-model-functions": "^4.0.0-alpha.71",
59
- "@ikas/storefront-models": "^4.0.0-alpha.71",
60
- "@ikas/storefront-providers": "^4.0.0-alpha.71",
56
+ "@ikas/storefront-api": "^4.0.0-alpha.73",
57
+ "@ikas/storefront-config": "^4.0.0-alpha.73",
58
+ "@ikas/storefront-model-functions": "^4.0.0-alpha.73",
59
+ "@ikas/storefront-models": "^4.0.0-alpha.73",
60
+ "@ikas/storefront-providers": "^4.0.0-alpha.73",
61
61
  "mobx": "^6.1.3",
62
62
  "mobx-react-lite": "^3.1.5",
63
63
  "next": "12.2.0",