@ikas/storefront 3.0.0-alpha.31 → 3.0.0-alpha.33

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.
Files changed (30) hide show
  1. package/build/_virtual/index.js_commonjs-proxy2.js +1 -1
  2. package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
  3. package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
  4. package/build/components/checkout/components/button/index.d.ts +1 -0
  5. package/build/components/checkout/components/button/index.js +1 -1
  6. package/build/components/checkout/components/master-pass/index.js +1 -1
  7. package/build/components/checkout/components/master-pass/modal/style.module.scss.js +1 -1
  8. package/build/components/checkout/components/master-pass/modal-otp/index.d.ts +8 -0
  9. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
  10. package/build/components/checkout/components/master-pass/modal-otp/style.module.scss.js +1 -1
  11. package/build/components/checkout/components/master-pass/modal-response/index.d.ts +10 -0
  12. package/build/components/checkout/components/master-pass/modal-response/index.js +1 -0
  13. package/build/components/checkout/components/master-pass/modal-response/style.module.scss.js +1 -0
  14. package/build/components/checkout/components/master-pass/style.module.scss.js +1 -1
  15. package/build/components/checkout/components/select-box/index.d.ts +1 -1
  16. package/build/components/checkout/components/stripe/checkout-form.js +1 -1
  17. package/build/components/checkout/components/stripe/style.module.scss.js +1 -0
  18. package/build/components/checkout/index.d.ts +1 -1
  19. package/build/components/checkout/index.js +1 -1
  20. package/build/components/checkout/model.d.ts +2 -0
  21. package/build/components/checkout/model.js +1 -1
  22. package/build/components/checkout/modelMasterPass.d.ts +73 -19
  23. package/build/components/checkout/modelMasterPass.js +1 -1
  24. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  25. package/build/components/checkout/steps/step-payment/payment-gateways/style.module.scss.js +1 -1
  26. package/build/ikas.cjs +1 -1
  27. package/build/models/data/checkout/index.d.ts +1 -0
  28. package/build/models/data/checkout/index.js +1 -1
  29. package/build/scripts/generators/config/content.js +1 -1
  30. package/package.json +1 -1
@@ -1 +1 @@
1
- import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
1
+ import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
@@ -1 +1 @@
1
- import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
1
+ import o from'../ext/split-on-first/index.js';export{default}from"../node_modules/split-on-first/index.js";
@@ -1 +1 @@
1
- import o from'../ext/split-on-first/index.js';export{default}from"../node_modules/split-on-first/index.js";
1
+ import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  declare type Props = {
3
+ type?: React.ButtonHTMLAttributes<HTMLButtonElement>["type"];
3
4
  text: string | React.ReactNode;
4
5
  isLoading?: boolean;
5
6
  isDisabled?: boolean;
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import i from"./style.module.scss.js";var o=t((function(t){var o=t.text,r=t.style,s=t.onClick,a=t.size,m=t.isLoading,l=t.isDisabled,n=t.isLine;return e.createElement("button",{style:r,type:"button",className:[i.Button,i.Dark,"medium"===a?i.Medium:i.Large,n?i.Line:"",l?i.Disabled:""].join(" "),onClick:m?void 0:s},m?e.createElement("div",{className:i.loader}):o)}));export{o as Button};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import i from"./style.module.scss.js";var o=t((function(t){var o=t.type,r=void 0===o?"button":o,s=t.text,a=t.style,m=t.onClick,l=t.size,n=t.isLoading,c=t.isDisabled,d=t.isLine;return e.createElement("button",{style:a,type:r,className:[i.Button,i.Dark,"medium"===l?i.Medium:i.Large,d?i.Line:"",c?i.Disabled:""].join(" "),onClick:n?void 0:m},n?e.createElement("div",{className:i.loader}):s)}));export{o as Button};
@@ -1 +1 @@
1
- import e from"react";import{observer as a}from"mobx-react-lite";import{IkasStorefrontConfig as t}from"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{createTranslationInputData as r,useTranslation as o}from"../../../../utils/i18n.js";import{Checkbox as s}from"../checkbox/index.js";import{FormItem as m}from"../form-item/index.js";import{FormItemType as n}from"../form-item/model.js";import{Button as i}from"../button/index.js";import c from"./modal-otp/index.js";import d from"./modal-link-card-to-client/index.js";import l from"./svg/master-pass-by-master-card.js";import p from"../../style.module.scss.js";import u from"./style.module.scss.js";var C=a((function(a){var C=a.vm,M=o().t,h=t.translations["checkout-page"],v=e.useMemo((function(){return r(h.creditCardForm.checkboxLabel)}),[]),b=e.useMemo((function(){return e.createElement("div",{className:u.CheckboxLabel},v.map((function(a,t){return a.isVariable?e.createElement("span",{key:t,className:u.Logo},e.createElement(l,null)):e.createElement(e.Fragment,{key:t},"p.value")})))}),[v]);return e.createElement("div",null,e.createElement(s,{label:b,value:C.mpVM.saveCardToMasterPass.isCheckboxChecked,onChange:C.mpVM.onSaveCardToMasterPassCheckedChange}),C.mpVM.saveCardToMasterPass.isCheckboxChecked&&e.createElement(e.Fragment,null,e.createElement("div",{className:p.RowPB},e.createElement(m,{name:"masterPassCardName",type:n.TEXT,label:M("checkout-page:masterPass.creditCardForm.cardName"),value:C.mpVM.saveCardToMasterPass.cardName,onChange:C.mpVM.onSaveCardToMasterPassCardNameChange})),e.createElement("div",{className:p.RowPB},e.createElement(m,{name:"masterPassPhoneNumber",type:n.TEL,label:M("checkout-page:masterPass.creditCardForm.phoneNumber"),value:C.mpVM.saveCardToMasterPass.phoneNumber,onChange:C.mpVM.onSaveCardToMasterPassPhoneNumberChange})),e.createElement(i,{style:{width:"100%"},text:M("checkout-page:masterPass.creditCardForm.button"),isDisabled:C.mpVM.isSendConfirmationButtonDisabled,isLoading:C.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending,onClick:function(){C.checkout.selectedPaymentGateway&&C.cardData&&C.cardData.cardNumber&&C.cardData.expirationDate&&C.cardData.cvv&&C.mpVM.saveCardToMasterPass.cardName&&C.mpVM.saveCardToMasterPass.phoneNumber&&C.mpVM.onSaveCardToMasterPassSendConfirmationButtonClick({creditCard:{rtaPan:C.cardData.cardNumber,expiryDate:C.cardData.expirationDate,cvc:C.cardData.cvv,accountAliasName:C.mpVM.saveCardToMasterPass.cardName},store:C.store,checkout:C.checkout,paymentGateway:C.checkout.selectedPaymentGateway})}}),!!C.mpVM.isLinkCardToClientModalVisible&&e.createElement(d,{visible:!0,onClose:C.mpVM.hideLinkCardToClientModal,onButtonClick:function(){C.mpVM.onLinkCardToClientButtonClick({cartId:C.checkout.id,checkout:C.checkout,store:C.store})}}),C.mpVM.isOtpModalVisible&&!!C.mpVM.otpModalType&&e.createElement(c,{vm:C,visible:!0,type:C.mpVM.otpModalType,onClose:C.mpVM.hideOtpModal})))}));export{C as default};
1
+ import e from"react";import{observer as a}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{createTranslationInputData as t,useTranslation as r}from"../../../../utils/i18n.js";import{Checkbox as s}from"../checkbox/index.js";import{FormItem as n}from"../form-item/index.js";import{FormItemType as m}from"../form-item/model.js";import{Button as i}from"../button/index.js";import c from"./svg/master-pass-by-master-card.js";import d from"../../style.module.scss.js";import l from"./style.module.scss.js";var u=a((function(a){var u=a.vm,p=r().t,C=o.translations["checkout-page"],v=e.useMemo((function(){var e,a;return t(null===(a=null===(e=null==C?void 0:C.masterPass)||void 0===e?void 0:e.creditCardForm)||void 0===a?void 0:a.checkboxLabel)}),[C]),f=e.useMemo((function(){return e.createElement("div",{className:l.CheckboxLabel},v.map((function(a,o){return a.isVariable?e.createElement("span",{key:o,className:l.Logo},e.createElement(c,null)):e.createElement(e.Fragment,{key:o},a.value)})))}),[v]);return e.createElement("div",null,e.createElement(s,{label:f,value:u.mpVM.saveCardToMasterPass.isCheckboxChecked,onChange:u.mpVM.onSaveCardToMasterPassCheckedChange}),u.mpVM.saveCardToMasterPass.isCheckboxChecked&&e.createElement("div",{className:l.FormWrapper},e.createElement("div",{className:d.RowPB},e.createElement(n,{name:"masterPassCardName",type:m.TEXT,label:p("checkout-page:masterPass.creditCardForm.cardName"),value:u.mpVM.saveCardToMasterPass.cardName,onChange:u.mpVM.onSaveCardToMasterPassCardNameChange})),e.createElement("div",{className:d.RowPB},e.createElement(n,{name:"masterPassPhoneNumber",type:m.TEL,label:p("checkout-page:masterPass.creditCardForm.phoneNumber"),value:u.mpVM.saveCardToMasterPass.phoneNumber,onChange:u.mpVM.onSaveCardToMasterPassPhoneNumberChange})),e.createElement(i,{style:{width:"100%"},text:p("checkout-page:masterPass.creditCardForm.button"),isDisabled:u.mpVM.isSendConfirmationButtonDisabled,isLoading:u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending,onClick:function(){var e;if(!u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending&&(console.log("onSendConfirmationButtonClick 1"),u.checkout.selectedPaymentGateway&&(console.log("onSendConfirmationButtonClick 2"),u.cardData&&u.cardData.cardNumber&&u.cardData.expirationDate&&u.cardData.cvv&&(console.log("onSendConfirmationButtonClick 3"),u.mpVM.saveCardToMasterPass.cardName&&(console.log("onSendConfirmationButtonClick 4"),u.mpVM.saveCardToMasterPass.phoneNumber))))){var a,o,t,r,s={creditCard:{rtaPan:u.cardData.cardNumber.replace(/ /g,""),expiryDate:(a=u.cardData.expirationDate,o=a.replace(" / ",""),t=o.substring(0,2),r=o.substring(2,4),"".concat(r).concat(t)),cvc:u.cardData.cvv,accountAliasName:u.mpVM.saveCardToMasterPass.cardName,phoneNumber:null===(e=u.mpVM.saveCardToMasterPass.phoneNumber)||void 0===e?void 0:e.replace("+","")},store:u.store,checkout:u.checkout,paymentGateway:u.checkout.selectedPaymentGateway,callback:function(){u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending=!1}};console.log("onSendConfirmationButtonClick 5",s),u.mpVM.saveCardToMasterPass.isSendConfirmationButtonPending=!0,u.mpVM.onSaveCardToMasterPassSendConfirmationButtonClick(s)}}})))}));export{u as default};
@@ -1 +1 @@
1
- import n from'../../../../../ext/style-inject/dist/style-inject.es.js';var e={ModalContainer:"style-module_ModalContainer__8VqAb",Modal:"style-module_Modal__3dsE0",CloseButton:"style-module_CloseButton__21emM",ModalContent:"style-module_ModalContent__33YzL"};n(".style-module_ModalContainer__8VqAb {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgba(39, 39, 39, 0.7);\n z-index: 99999999;\n}\n\n.style-module_Modal__3dsE0 {\n position: relative;\n border-radius: 8px;\n background-color: #fff;\n width: 100%;\n max-width: 440px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Modal__3dsE0 {\n width: 100%;\n margin: 0 16px;\n }\n}\n\n.style-module_CloseButton__21emM {\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n display: flex;\n align-items: center;\n width: 24px;\n height: 24px;\n}\n\n.style-module_ModalContent__33YzL {\n padding: 24px 56px 24px 24px;\n}");export{e as default};
1
+ import n from'../../../../../ext/style-inject/dist/style-inject.es.js';var e={ModalContainer:"style-module_ModalContainer__8VqAb",Modal:"style-module_Modal__3dsE0",CloseButton:"style-module_CloseButton__21emM",ModalContent:"style-module_ModalContent__33YzL"};n(".style-module_ModalContainer__8VqAb {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgba(39, 39, 39, 0.7);\n z-index: 99999999;\n}\n\n.style-module_Modal__3dsE0 {\n position: relative;\n border-radius: 8px;\n background-color: #fff;\n width: 100%;\n max-width: 440px;\n}\n@media only screen and (max-width: 1000px) {\n .style-module_Modal__3dsE0 {\n width: calc(100% - 32px);\n margin: 0 16px;\n }\n}\n\n.style-module_CloseButton__21emM {\n position: absolute;\n top: 16px;\n right: 16px;\n cursor: pointer;\n display: flex;\n align-items: center;\n width: 24px;\n height: 24px;\n}\n\n.style-module_ModalContent__33YzL {\n padding: 24px;\n}");export{e as default};
@@ -8,3 +8,11 @@ declare const MasterPassOtpModal: React.FC<{
8
8
  onClose: () => void;
9
9
  }>;
10
10
  export default MasterPassOtpModal;
11
+ export declare class ErrorBoundary extends React.Component<any, any> {
12
+ constructor(props: any);
13
+ static getDerivedStateFromError(error: any): {
14
+ hasError: boolean;
15
+ };
16
+ componentDidCatch(error: any, errorInfo: any): void;
17
+ render(): React.ReactNode;
18
+ }
@@ -1 +1 @@
1
- import e,{useState as t,useEffect as a}from"react";import{observer as o}from"mobx-react-lite";import"../../../../../storefront/index.js";import'../../../../../ext/lodash/isArguments.js';import'../../../../../ext/lodash/isBuffer.js';import'../../../../../ext/lodash/isTypedArray.js';import'../../../../../ext/lodash/_baseGetTag.js';import{useTranslation as s}from"../../../../../utils/i18n.js";import{Button as r}from"../../button/index.js";import{FormItem as n}from"../../form-item/index.js";import{FormItemType as m}from"../../form-item/model.js";import l from"../modal/index.js";import c from"./svg/master-pass.js";import i from"./svg/success.js";import d from"./svg/master-pass-by-master-card-small.js";import u from"./style.module.scss.js";var p=o((function(o){var p=o.visible;o.type;var f=o.vm,v=o.onClose,g=s().t,h=t(180),E=h[0],j=h[1],k=t(!1),x=k[0],b=k[1],y=t(!1);y[0];var C=y[1],T=t("form");T[0],T[1];var M=t(""),N=M[0],P=M[1],w=t(!1),I=w[0];w[1];var _=t("idle"),G=_[0];_[1],a((function(){p?(j(180),b(!0)):(j(180),b(!1),C(!1))}),[p]),a((function(){var e=setInterval((function(){E>0?j(E-1):(C(!0),clearInterval(e))}),1e3);return p||clearInterval(e),function(){e&&clearInterval(e),j(180),b(!1),C(!1)}}),[p,E,x]);var L=e.createElement("button",{className:u.ResendButton,onClick:function(e){e.stopPropagation(),f.mpVM.resendOtp({store:f.store,checkout:f.checkout})}},g("checkout-page:masterPass.otpModal.resendText")),F=e.createElement("div",null,e.createElement("div",{className:u.Wrapper},e.createElement("span",{"data-marginRight":!0,className:u.Logo},e.createElement(c,null)),e.createElement("p",{className:u.Text},g("checkout-page:masterPassConfirmationModalText"))),e.createElement("div",{className:u.Countdown},g("checkout-page:masterPassConfirmationModalCountdownText"),e.createElement("strong",null,E)),e.createElement("form",{onSubmit:function(e){e.preventDefault(),N&&f.checkout.selectedPaymentGateway&&f.mpVM.onOtpFormSubmit({cartId:f.checkout.id,validationCode:N,paymentGateway:f.checkout.selectedPaymentGateway,store:f.store,checkout:f.checkout})}},e.createElement(n,{type:m.TEXT,label:g("checkout-page:masterPass.confirmationModal.inputLabel"),name:"validationCode",rightContent:L,value:N,onChange:function(e){P(e)}}),e.createElement(r,{text:g("checkout-page:masterPass.confirmationModal.buttonText"),isLoading:I,isDisabled:!N}))),A=e.createElement("div",{className:u.Wrapper},e.createElement("span",{className:u.Logo},e.createElement(i,null)),e.createElement("p",{className:u.Text},g("checkout-page:masterPass.confirmationModal.successText"))),B=e.createElement("footer",{className:u.ModalFooter},e.createElement(d,null)),D="success"===G?e.createElement("div",{className:u.ModalFooter},B):null;return e.createElement(l,{visible:p,footer:D,onClose:v},"idle"===G&&F,"success"===G&&A)}));export{p as default};
1
+ import{__extends as e}from'../../../../../ext/tslib/tslib.es6.js';import t,{useRef as o,useState as a,useEffect as r}from"react";import{observer as s}from"mobx-react-lite";import"../../../../../storefront/index.js";import'../../../../../ext/lodash/isArguments.js';import'../../../../../ext/lodash/isBuffer.js';import'../../../../../ext/lodash/isTypedArray.js';import'../../../../../ext/lodash/_baseGetTag.js';import{useTranslation as n}from"../../../../../utils/i18n.js";import{Button as c}from"../../button/index.js";import{FormItem as l}from"../../form-item/index.js";import{FormItemType as m}from"../../form-item/model.js";import i from"../modal/index.js";import u from"./svg/master-pass.js";import p from"./svg/success.js";import d from"./svg/master-pass-by-master-card-small.js";import f from"./style.module.scss.js";var h=s((function(e){var s=e.visible,h=e.type,g=e.vm,v=e.onClose,E=n().t,b=o(),k=a(180),y=k[0],x=k[1],j=a("form");j[0],j[1];var M=a(""),P=M[0],T=M[1],C=a(!1),N=C[0],w=C[1],_=a(!1),I=_[0],D=_[1],F=a("idle"),G=F[0];F[1];var L=t.createElement("button",{type:"button",className:f.ResendButton,disabled:N,onClick:function(e){if(e.stopPropagation(),!N){w(!0),g.mpVM.resendOtp({store:g.store,checkout:g.checkout,callback:function(){w(!1),B(),T("")}})}}},E("checkout-page:masterPass.otpModal.resendText")),O=function(){if(!I&&P&&g.checkout.selectedPaymentGateway){D(!0),g.mpVM.onOtpFormSubmit({cartId:g.checkout.id,validationCode:P,paymentGateway:g.checkout.selectedPaymentGateway,store:g.store,checkout:g.checkout,callback:function(){D(!1),T(""),S()}})}},S=function(){x(0)},B=function(){x(180)};r((function(){if(!(y<1&&b.current))return b.current&&clearInterval(b.current),b.current=setInterval((function(){x(y-1)}),1e3),function(){b.current&&clearInterval(b.current)};clearInterval(b.current)}),[y]);var A,R,V,W,X,q,z=t.createElement("div",null,t.createElement("div",{className:f.Wrapper},"masterPassOtp"===h&&t.createElement("span",{"data-marginRight":!0,className:f.Logo},t.createElement(u,null)),t.createElement("p",{className:f.Text},E("masterPassOtp"===h?"checkout-page:masterPass.otpModal.otpTextMasterPass":"checkout-page:masterPass.otpModal.otpTextBank"))),t.createElement("div",{className:f.Countdown},E("checkout-page:masterPass.otpModal.countdownText"),t.createElement("strong",null,(A=y%3600,R=Math.floor(A/60),V=A%60,W=Math.ceil(V),X=R<10?"0".concat(R):R,q=W<10?"0".concat(W):W,"".concat(X,":").concat(q)))),t.createElement("form",{onSubmit:function(e){e.preventDefault(),O()}},t.createElement(l,{type:m.TEXT,label:E("checkout-page:masterPass.otpModal.inputLabel"),name:"validationCode",rightContent:L,value:P,onChange:function(e){T(e)}}),t.createElement(c,{type:"submit",style:{width:"100%",marginTop:"16px"},text:E("checkout-page:masterPass.otpModal.buttonText"),isLoading:I,isDisabled:!P,onClick:O}))),H=t.createElement("div",{className:f.Wrapper},t.createElement("span",{className:f.Logo},t.createElement(p,null)),t.createElement("p",{className:f.Text},E("checkout-page:masterPass.otpModal.successText"))),J=t.createElement("footer",{className:f.ModalFooter},t.createElement(d,null)),K="success"===G?t.createElement("div",{className:f.ModalFooter},J):null;return r((function(){s?x(180):S()}),[s]),console.log("calisti modal",s),t.createElement(i,{visible:s,footer:K,onClose:v},"idle"===G&&z,"success"===G&&H)}));!function(o){function a(e){var t=o.call(this,e)||this;return t.state={hasError:!1},t}e(a,o),a.getDerivedStateFromError=function(e){return{hasError:!0}},a.prototype.componentDidCatch=function(e,t){console.error(e,t)},a.prototype.render=function(){return this.state.hasError?t.createElement("h1",null,"Something went wrong."):this.props.children}}(t.Component);export{h as default};
@@ -1 +1 @@
1
- import n from'../../../../../ext/style-inject/dist/style-inject.es.js';var e={Wrapper:"style-module_Wrapper__3h_6O",Logo:"style-module_Logo__uFuAV",LinkCardText:"style-module_LinkCardText__XY9eC",LinkCardSubInfoText:"style-module_LinkCardSubInfoText__2oMjI",Text:"style-module_Text__3rYej",Countdown:"style-module_Countdown__2znZ9",ModalFooter:"style-module_ModalFooter__1y5dY",ResendButton:"style-module_ResendButton__1gENj"};n(".style-module_Wrapper__3h_6O {\n display: flex;\n}\n\n.style-module_Logo__uFuAV[data-marginRight] {\n margin-right: 16px;\n}\n\n.style-module_Logo__uFuAV[data-marginBottom] {\n margin-bottom: 16px;\n}\n\n.style-module_LinkCardText__XY9eC {\n font-size: 16px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n margin-bottom: 32px;\n}\n\n.style-module_LinkCardSubInfoText__2oMjI {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_LinkCardSubInfoText__2oMjI span {\n display: inline-block;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n}\n\n.style-module_Text__3rYej {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n}\n\n.style-module_Countdown__2znZ9 {\n font-size: 14px;\n line-height: 20px;\n font-weight: 600;\n margin: 24px 0;\n}\n\n.style-module_ModalFooter__1y5dY {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 12px 0;\n}\n\n.style-module_ResendButton__1gENj {\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n text-decoration: underline;\n}");export{e as default};
1
+ import n from'../../../../../ext/style-inject/dist/style-inject.es.js';var e={Wrapper:"style-module_Wrapper__3h_6O",Logo:"style-module_Logo__uFuAV",LinkCardText:"style-module_LinkCardText__XY9eC",LinkCardSubInfoText:"style-module_LinkCardSubInfoText__2oMjI",Text:"style-module_Text__3rYej",Countdown:"style-module_Countdown__2znZ9",ModalFooter:"style-module_ModalFooter__1y5dY",ResendButton:"style-module_ResendButton__1gENj"};n(".style-module_Wrapper__3h_6O {\n display: flex;\n padding-right: 24px;\n}\n\n.style-module_Logo__uFuAV[data-marginRight] {\n margin-right: 16px;\n}\n\n.style-module_Logo__uFuAV[data-marginBottom] {\n margin-bottom: 16px;\n}\n\n.style-module_LinkCardText__XY9eC {\n font-size: 16px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n margin-bottom: 32px;\n}\n\n.style-module_LinkCardSubInfoText__2oMjI {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_LinkCardSubInfoText__2oMjI span {\n display: inline-block;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n}\n\n.style-module_Text__3rYej {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n}\n\n.style-module_Countdown__2znZ9 {\n font-size: 14px;\n line-height: 20px;\n font-weight: 600;\n margin: 24px 0;\n text-align: center;\n}\n.style-module_Countdown__2znZ9 strong {\n font-size: 14px;\n}\n\n.style-module_ModalFooter__1y5dY {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 12px 0;\n border-top: 1px solid var(--checkout-border-color);\n}\n\n.style-module_ResendButton__1gENj {\n height: 100%;\n padding-right: 8px;\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n text-decoration: underline;\n}");export{e as default};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ visible: boolean;
4
+ text: string;
5
+ onClose: () => void;
6
+ };
7
+ declare const ModalResponse: (({ visible, text, onClose }: Props) => JSX.Element) & {
8
+ displayName: string;
9
+ };
10
+ export default ModalResponse;
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as t}from"mobx-react-lite";import r from"../modal/index.js";import o from"./style.module.scss.js";var l=t((function(t){var l=t.visible,m=t.text,s=t.onClose;return e.createElement(r,{visible:l,onClose:s},e.createElement("div",null,e.createElement("p",{className:o.Text},m)))}));export{l as default};
@@ -0,0 +1 @@
1
+ import e from'../../../../../ext/style-inject/dist/style-inject.es.js';var t={Text:"style-module_Text__3BcVw"};e(".style-module_Text__3BcVw {\n font-size: 14px;\n color: var(--checkout-primary-text-color);\n padding-right: 24px;\n}");export{t as default};
@@ -1 +1 @@
1
- import e from'../../../../ext/style-inject/dist/style-inject.es.js';var o={CheckboxLabel:"style-module_CheckboxLabel__3yoWn",Logo:"style-module_Logo__EZVQ2"};e(".style-module_CheckboxLabel__3yoWn {\n margin-bottom: 16px;\n color: var(--checkout-primary-text-color);\n}\n.style-module_CheckboxLabel__3yoWn .style-module_Logo__EZVQ2 {\n display: inline-block;\n vertical-align: middle;\n margin: 0 8px;\n}");export{o as default};
1
+ import e from'../../../../ext/style-inject/dist/style-inject.es.js';var o={FormWrapper:"style-module_FormWrapper__3PB5t",CheckboxLabel:"style-module_CheckboxLabel__3yoWn",Logo:"style-module_Logo__EZVQ2"};e(".style-module_FormWrapper__3PB5t {\n margin-top: 16px;\n}\n\n.style-module_CheckboxLabel__3yoWn {\n color: var(--checkout-primary-text-color);\n}\n.style-module_CheckboxLabel__3yoWn .style-module_Logo__EZVQ2 {\n display: inline-block;\n vertical-align: middle;\n margin: 0 8px;\n}");export{o as default};
@@ -3,7 +3,7 @@ declare type Props = {
3
3
  label?: React.ReactNode;
4
4
  isSelected: boolean;
5
5
  rightContent?: React.ReactElement;
6
- bottomContent?: React.ReactElement;
6
+ bottomContent?: React.ReactNode;
7
7
  bottomContentVisible?: boolean;
8
8
  hasError?: boolean;
9
9
  errorText?: string;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as n}from"mobx-react-lite";import{useStripe as i,useElements as o,PaymentElement as m}from'../../../../ext/@stripe/react-stripe-js/dist/react-stripe.esm.js';var s=n((function(n){var s=n.callbackUrl,a=n.vm,l=i(),c=o();return t.createElement(t.Fragment,null,t.createElement("form",{id:"stripe-form",onSubmit:function(t){return e(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return t.preventDefault(),l&&c&&s?[4,l.confirmPayment({elements:c,confirmParams:{return_url:s}})]:[2];case 1:return e.sent().error&&(a.isStepLoading=!1),[2]}}))}))}},t.createElement(m,null),t.createElement("button",{id:"stripe-form-btn",hidden:!0,disabled:!l})))}));export{s as CheckoutForm};
1
+ import{__awaiter as e,__generator as t}from'../../../../ext/tslib/tslib.es6.js';import*as r from"react";import{observer as n}from"mobx-react-lite";import{useStripe as s,useElements as o,PaymentElement as i}from'../../../../ext/@stripe/react-stripe-js/dist/react-stripe.esm.js';import m from"./style.module.scss.js";var a=n((function(n){var a=n.callbackUrl,l=n.vm,c=s(),d=o(),u=r.useState(!0),f=u[0],p=u[1];return r.createElement(r.Fragment,null,r.createElement("form",{className:m.Form,id:"stripe-form",onSubmit:function(r){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return r.preventDefault(),c&&d&&a?(p(!0),[4,c.confirmPayment({elements:d,confirmParams:{return_url:a}})]):[2];case 1:return e.sent().error&&(l.isStepLoading=!1,p(!1)),[2]}}))}))}},r.createElement(i,{onReady:function(){return p(!1)}}),r.createElement("button",{id:"stripe-form-btn",hidden:!0,disabled:!c}),f&&r.createElement("div",{className:m.Disabled},r.createElement("div",{className:m.loader}))))}));export{a as CheckoutForm};
@@ -0,0 +1 @@
1
+ import e from'../../../../ext/style-inject/dist/style-inject.es.js';var n={Main:"style-module_Main__3dz6U",loader:"style-module_loader__1wW4A",load8:"style-module_load8__1V7yl",Form:"style-module_Form__38_IS",Disabled:"style-module_Disabled__1JtUC"};e(".style-module_Main__3dz6U {\n height: 240px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.style-module_loader__1wW4A,\n.style-module_loader__1wW4A:after {\n border-radius: 50%;\n width: 5em;\n height: 5em;\n}\n\n.style-module_loader__1wW4A {\n font-size: 6px;\n position: relative;\n text-indent: -9999em;\n border-top: 0.5em solid #a3a3a366;\n border-right: 0.5em solid #a3a3a366;\n border-bottom: 0.5em solid #a3a3a366;\n border-left: 0.5em solid #333333d6;\n -webkit-transform: translateZ(0);\n -ms-transform: translateZ(0);\n transform: translateZ(0);\n -webkit-animation: style-module_load8__1V7yl 1.1s infinite linear;\n animation: style-module_load8__1V7yl 1.1s infinite linear;\n}\n\n@-webkit-keyframes style-module_load8__1V7yl {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes style-module_load8__1V7yl {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n.style-module_Form__38_IS {\n position: relative;\n min-height: 200px;\n}\n\n.style-module_Disabled__1JtUC {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9;\n cursor: not-allowed;\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 200px;\n}");export{n as default};
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import { IkasMerchantSettings } from "../../models";
3
2
  import { IkasCheckoutSettings } from "../../models/data/checkout-settings";
4
3
  import IkasCheckout from "../../models/data/checkout";
4
+ import { IkasMerchantSettings } from "../../models";
5
5
  export declare type IkasCheckoutPageProps = {
6
6
  checkout: IkasCheckout;
7
7
  checkoutSettings: IkasCheckoutSettings;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import s,{CheckoutStep as a}from"./model.js";import n from"./steps/step-info/index.js";import{CheckoutStepShipping as m}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as l}from"./steps/step-payment/index.js";import{CartSummary as c}from"./components/cart-summary/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"mobx";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/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/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as d}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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{ContactForm as u}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{StepSuccess as p}from"./steps/step-success/index.js";import{Modal as v}from"./components/modal/index.js";import h from"./style.module.scss.js";import{IkasPageHead as g}from"../page/head.js";import{Analytics as E}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{Image as x}from"../image/index.js";import f from"next/link.js";import j,{Step as y}from"./components/step-container/index.js";import{IkasStorefrontConfig as k}from"../../storefront/index.js";import'../../ext/lodash/isArguments.js';import'../../ext/lodash/isBuffer.js';import'../../ext/lodash/isTypedArray.js';import'../../ext/lodash/_baseGetTag.js';import{formatMoney as C}from"../../utils/currency.js";import{useTranslation as N}from"../../utils/i18n.js";import{StockError as b}from"./components/error/stock-error/index.js";import F from"./components/svg/ikas.js";import T from'../../ext/react-tooltip/dist/index.es.js';import{FullscreenLoading as P}from"./components/fullscreen-loading/index.js";import S from"./components/notification-box/index.js";import{FormItem as M}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";var I=r((function(e){var t,r,n,m=e.checkout,l=e.checkoutSettings,u=e.merchantSettings,x=e.customizationProps,f=e.returnPolicy,j=e.privacyPolicy,y=e.termsOfService,C=N().t,S=i(),M=o.useState((function(){return new s(m,l,u,S,f,j,y,C,x||{})}))[0];return M.step===a.PAYMENT&&E.disableHTML(),o.useEffect((function(){M.checkoutSettings.isAccountRequired&&!M.checkout.hasCustomer&&S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),E.beginCheckout(M.checkout),E.pageView(d.CHECKOUT)}),[]),o.useEffect((function(){M.customizationProps=x,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(x)}),[x]),M.isCheckoutLoaded&&M.store.customerStore.initialized?M.checkout.hasCustomer&&(null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=M.checkout.customer)||void 0===r?void 0:r.id)?(S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(g,{pageType:d.CHECKOUT,pageTitle:((null===(n=M.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+C("checkout-page:securePayment"),pageDescription:C("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:h.CheckoutPage},o.createElement(T,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:h.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:h.Left},o.createElement("div",{className:h.LeftContent},o.createElement("div",null,o.createElement(B,{vm:M}),M.hasStockError&&o.createElement("div",{className:h.ErrorContainer},o.createElement(b,{vm:M,error:M.error})),!M.hasStockError&&o.createElement(o.Fragment,null,o.createElement(c,{vm:M,allowExpand:!0}),M.step===a.SUCCESS?o.createElement(p,{vm:M}):o.createElement(L,{vm:M})),o.createElement("div",{className:h.Space})),o.createElement(U,{vm:M}))),o.createElement("div",{className:h.Right},o.createElement("div",{className:h.RightContent},o.createElement(c,{vm:M}),o.createElement("div",{className:h.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===k.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(F,null))))),!!M.policyModalText&&o.createElement(v,{title:M.policyModalTitle,modalContent:M.policyModalText,onClose:function(){M.policyModalText=""}}),M.isContactModalVisible&&o.createElement(H,{vm:M,setVisible:M.setContactModalVisible}))):o.createElement(P,null)})),B=r((function(e){var t,r,i=e.vm,s=N().t;return o.createElement("div",{className:h.Header},o.createElement(f,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=i.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:h.Logo},o.createElement(x,{layout:"fill",image:i.merchantSettings.logo,sizes:"360px"})):(null===(r=i.merchantSettings)||void 0===r?void 0:r.merchantName)||"")),!i.checkout.hasCustomer&&o.createElement("div",{className:h.LoginText},o.createElement("span",{className:h.LoginCta},s("checkout-page:alreadyHaveAnAccount")),o.createElement(f,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:h.LoginBtn},s("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:h.CustomerInfo},o.createElement("div",{className:h.Name},i.checkout.customerFullName),o.createElement("div",{className:h.Email},i.checkout.customerEmail)))})),L=r((function(e){var t=e.vm,r=N().t,i=o.useMemo((function(){switch(t.step){case a.INFO:return o.createElement(n,{vm:t});case a.SHIPPING:return o.createElement(m,{vm:t});case a.PAYMENT:return o.createElement(l,{vm:t});case a.SUCCESS:return o.createElement(p,{vm:t})}}),[t,t.step]),s=[new y(r("checkout-page:address"),t.step===a.INFO,t.step!==a.INFO,t.step!==a.INFO?o.createElement("div",{className:h.AdressStepInfo},o.createElement(O,{vm:t}),o.createElement("div",{className:h.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==a.INFO?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(O,{vm:t})):void 0),new y(r("checkout-page:payment"),t.step===a.PAYMENT,!1)];return"address"===t.deliveryMethod&&s.splice(1,0,new y(r("checkout-page:shipping"),t.step===a.SHIPPING,t.step===a.PAYMENT,t.step===a.PAYMENT?o.createElement("div",{className:h.AdressStepInfo},o.createElement(R,{vm:t}),t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:h.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===a.PAYMENT?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(R,{vm:t})):void 0)),o.createElement(j,{steps:s,stepContent:i})})),O=r((function(e){var t,r,i,s,a,n=e.vm,m=N().t,l=((null===(t=n.checkout.shippingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=n.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:h.Address},o.createElement("div",{className:[h.Text,h.WithMBottom].join(" ")},(null===(i=n.checkout.customer)||void 0===i?void 0:i.email)||""),"address"===n.deliveryMethod?o.createElement("div",{className:h.Text},l):o.createElement(o.Fragment,null,o.createElement("div",{className:h.Text},m("checkout-page:receiver")),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},l)),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(s=n.checkout.shippingAddress)||void 0===s?void 0:s.phone),"in-store"===n.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[h.Text,h.WithMTop].join(" ")},m("checkout-page:pickUpLocation"))),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(a=n.checkout.shippingAddress)||void 0===a?void 0:a.addressText))})),R=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:h.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):C(t.checkout.shippingLines[0].price,t.checkout.currencyCode)))):r("checkout-page:standartShipping"))})),U=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Footer},o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),H=r((function(r){var i,s,a=r.vm,n=r.setVisible,m=N().t,l=o.useState(!1),c=l[0],d=l[1],p=o.useState(!1),h=p[0],g=p[1],E=o.useState(new u({message:{requiredRule:"",emailRule:"",minRule:""},store:a.store}))[0];E.email=a.checkout.customerEmail,E.firstName=(null===(i=a.checkout.customer)||void 0===i?void 0:i.firstName)||"",E.lastName=(null===(s=a.checkout.customer)||void 0===s?void 0:s.lastName)||"";var x=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,n(!1)]:(d(!0),[4,E.saveContactForm()]);case 1:return e.sent()&&g(!0),d(!1),[2]}}))}))}),[c]);return o.createElement(v,{title:m("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(S,{type:"success",title:m("checkout-page:contactFormSent"),content:m("checkout-page:contactFormDescription")})),o.createElement(M,{type:A.TEXT_AREA,label:"",value:E.message||"",onChange:E.onMessageChange,textAreaPlaceholder:m("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:m(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:c,isDisabled:!E.message,onClick:x})),onClose:function(){return n(!1)}})}));export{I as default};
1
+ import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import s from"next/link.js";import a from'../../ext/react-tooltip/dist/index.es.js';import n,{CheckoutStep as l}from"./model.js";import{Analytics as m}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{IkasStorefrontConfig as c}from"../../storefront/index.js";import'../../ext/lodash/isArguments.js';import'../../ext/lodash/isBuffer.js';import'../../ext/lodash/isTypedArray.js';import'../../ext/lodash/_baseGetTag.js';import{formatMoney as d}from"../../utils/currency.js";import{useTranslation as p}from"../../utils/i18n.js";import u from"./steps/step-info/index.js";import{CheckoutStepShipping as v}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as h}from"./steps/step-payment/index.js";import{CartSummary as g}from"./components/cart-summary/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"mobx";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/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/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as x}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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{ContactForm as E}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{StepSuccess as f}from"./steps/step-success/index.js";import{Modal as j}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import y from"./components/master-pass/modal-link-card-to-client/index.js";import M from"./components/master-pass/modal-response/index.js";import{Image as C}from"../image/index.js";import b,{Step as N}from"./components/step-container/index.js";import{StockError as T}from"./components/error/stock-error/index.js";import{FullscreenLoading as F}from"./components/fullscreen-loading/index.js";import P from"./components/notification-box/index.js";import{FormItem as S}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as V}from"./components/button/index.js";import{IkasPageHead as w}from"../page/head.js";import B from"./components/svg/ikas.js";import I from"./style.module.scss.js";var L=r((function(e){var t,r,s,d=e.checkout,u=e.checkoutSettings,v=e.merchantSettings,h=e.customizationProps,E=e.returnPolicy,C=e.privacyPolicy,b=e.termsOfService,N=p().t,P=i(),S=o.useState((function(){return new n(d,u,v,P,E,C,b,N,h||{})}))[0];return S.step===l.PAYMENT&&m.disableHTML(),o.useEffect((function(){S.checkoutSettings.isAccountRequired&&!S.checkout.hasCustomer&&P.push("/account/login?redirect="+encodeURIComponent(S.checkoutUrl)),m.beginCheckout(S.checkout),m.pageView(x.CHECKOUT)}),[]),o.useEffect((function(){S.customizationProps=h,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(h)}),[h]),S.isCheckoutLoaded&&S.store.customerStore.initialized?S.checkout.hasCustomer&&(null===(t=S.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=S.checkout.customer)||void 0===r?void 0:r.id)?(P.push("/account/login?redirect="+encodeURIComponent(S.checkoutUrl)),null):(console.log("vm.mpVM.visibleModal",S.mpVM.visibleModal),o.createElement(o.Fragment,null,o.createElement(w,{pageType:x.CHECKOUT,pageTitle:((null===(s=S.merchantSettings)||void 0===s?void 0:s.merchantName)||"")+" - "+N("checkout-page:securePayment"),pageDescription:N("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:I.CheckoutPage},o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:I.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:I.Left},o.createElement("div",{className:I.LeftContent},o.createElement("div",null,o.createElement(R,{vm:S}),S.hasStockError&&o.createElement("div",{className:I.ErrorContainer},o.createElement(T,{vm:S,error:S.error})),!S.hasStockError&&o.createElement(o.Fragment,null,o.createElement(g,{vm:S,allowExpand:!0}),S.step===l.SUCCESS?o.createElement(f,{vm:S}):o.createElement(O,{vm:S})),o.createElement("div",{className:I.Space})),o.createElement(_,{vm:S}))),o.createElement("div",{className:I.Right},o.createElement("div",{className:I.RightContent},o.createElement(g,{vm:S}),o.createElement("div",{className:I.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(B,null))))),!!S.policyModalText&&o.createElement(j,{title:S.policyModalTitle,modalContent:S.policyModalText,onClose:function(){S.policyModalText=""}}),S.isContactModalVisible&&o.createElement(D,{vm:S,setVisible:S.setContactModalVisible}),"linkCardToClientModal"===S.mpVM.visibleModal&&o.createElement(y,{visible:"linkCardToClientModal"===S.mpVM.visibleModal,onClose:S.mpVM.hideLinkCardToClientModal,onButtonClick:function(){S.mpVM.onLinkCardToClientButtonClick({cartId:S.checkout.id,checkout:S.checkout,store:S.store})}}),("otpModalBank"===S.mpVM.visibleModal||"otpModalMasterPass"===S.mpVM.visibleModal)&&o.createElement(k,{vm:S,visible:"otpModalBank"===S.mpVM.visibleModal||"otpModalMasterPass"===S.mpVM.visibleModal,type:"otpModalMasterPass"===S.mpVM.visibleModal?"masterPassOtp":"bankOtp",onClose:S.mpVM.hideOtpModal}),"mfsResponseModal"===S.mpVM.visibleModal&&S.mpVM.mfsResponseModalText&&o.createElement(M,{visible:"mfsResponseModal"===S.mpVM.visibleModal,text:S.mpVM.mfsResponseModalText,onClose:S.mpVM.onResponseModalClose})),o.createElement("input",{type:"text",value:S.mpVM.mfsResponseModalText,onChange:function(e){S.mpVM.mfsResponseModalText=e.target.value}}),":",S.mpVM.mfsResponseModalText,o.createElement("button",{onClick:function(){S.showTestModal=!S.showTestModal,S.mpVM.visibleModal=S.mpVM.visibleModal?void 0:"otpModalMasterPass"}},"MODALI AC/KAPAT (",S.mpVM.visibleModal,") (",S.showTestModal,")"))):o.createElement(F,null)})),R=r((function(e){var t,r,i=e.vm,a=p().t;return o.createElement("div",{className:I.Header},o.createElement(s,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=i.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:I.Logo},o.createElement(C,{layout:"fill",image:i.merchantSettings.logo,sizes:"360px"})):(null===(r=i.merchantSettings)||void 0===r?void 0:r.merchantName)||"")),!i.checkout.hasCustomer&&o.createElement("div",{className:I.LoginText},o.createElement("span",{className:I.LoginCta},a("checkout-page:alreadyHaveAnAccount")),o.createElement(s,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:I.LoginBtn},a("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:I.CustomerInfo},o.createElement("div",{className:I.Name},i.checkout.customerFullName),o.createElement("div",{className:I.Email},i.checkout.customerEmail)))})),O=r((function(e){var t=e.vm,r=p().t,i=o.useMemo((function(){switch(t.step){case l.INFO:return o.createElement(u,{vm:t});case l.SHIPPING:return o.createElement(v,{vm:t});case l.PAYMENT:return o.createElement(h,{vm:t});case l.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),s=[new N(r("checkout-page:address"),t.step===l.INFO,t.step!==l.INFO,t.step!==l.INFO?o.createElement("div",{className:I.AdressStepInfo},o.createElement(U,{vm:t}),o.createElement("div",{className:I.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==l.INFO?o.createElement("div",{className:I.AddressStepInfoMobile},o.createElement(U,{vm:t})):void 0),new N(r("checkout-page:payment"),t.step===l.PAYMENT,!1)];return"address"===t.deliveryMethod&&s.splice(1,0,new N(r("checkout-page:shipping"),t.step===l.SHIPPING,t.step===l.PAYMENT,t.step===l.PAYMENT?o.createElement("div",{className:I.AdressStepInfo},o.createElement(H,{vm:t}),t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:I.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===l.PAYMENT?o.createElement("div",{className:I.AddressStepInfoMobile},o.createElement(H,{vm:t})):void 0)),o.createElement(b,{steps:s,stepContent:i})})),U=r((function(e){var t,r,i,s,a,n=e.vm,l=p().t,m=((null===(t=n.checkout.shippingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=n.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:I.Address},o.createElement("div",{className:[I.Text,I.WithMBottom].join(" ")},(null===(i=n.checkout.customer)||void 0===i?void 0:i.email)||""),"address"===n.deliveryMethod?o.createElement("div",{className:I.Text},m):o.createElement(o.Fragment,null,o.createElement("div",{className:I.Text},l("checkout-page:receiver")),o.createElement("div",{className:[I.Text,I.Gray].join(" ")},m)),o.createElement("div",{className:[I.Text,I.Gray].join(" ")},null===(s=n.checkout.shippingAddress)||void 0===s?void 0:s.phone),"in-store"===n.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[I.Text,I.WithMTop].join(" ")},l("checkout-page:pickUpLocation"))),o.createElement("div",{className:[I.Text,I.Gray].join(" ")},null===(a=n.checkout.shippingAddress)||void 0===a?void 0:a.addressText))})),H=r((function(e){var t=e.vm,r=p().t;return o.createElement("div",{className:I.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:I.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):d(t.checkout.shippingLines[0].price,t.checkout.currencyCode)))):r("checkout-page:standartShipping"))})),_=r((function(e){var t=e.vm,r=p().t;return o.createElement("div",{className:I.Footer},o.createElement("div",{className:I.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:I.FooterBullet},"•"),o.createElement("div",{className:I.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:I.FooterBullet},"•"),o.createElement("div",{className:I.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),D=r((function(r){var i,s,a=r.vm,n=r.setVisible,l=p().t,m=o.useState(!1),c=m[0],d=m[1],u=o.useState(!1),v=u[0],h=u[1],g=o.useState(new E({message:{requiredRule:"",emailRule:"",minRule:""},store:a.store}))[0];g.email=a.checkout.customerEmail,g.firstName=(null===(i=a.checkout.customer)||void 0===i?void 0:i.firstName)||"",g.lastName=(null===(s=a.checkout.customer)||void 0===s?void 0:s.lastName)||"";var x=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return v?[2,n(!1)]:(d(!0),[4,g.saveContactForm()]);case 1:return e.sent()&&h(!0),d(!1),[2]}}))}))}),[c]);return o.createElement(j,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,v&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(P,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(S,{type:A.TEXT_AREA,label:"",value:g.message||"",onChange:g.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(V,{style:{width:"100%",marginTop:"24px"},text:l(v?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:c,isDisabled:!g.message,onClick:x})),onClose:function(){return n(!1)}})}));export{L as default};
@@ -51,6 +51,7 @@ export default class CheckoutViewModel {
51
51
  error?: CheckoutError | null;
52
52
  successTransaction?: IkasOrderTransaction;
53
53
  mpVM: MasterPassModel;
54
+ showTestModal: boolean;
54
55
  t: TFunction;
55
56
  constructor(checkout: IkasCheckout, checkoutSettings: IkasCheckoutSettings, merchantSettings: IkasMerchantSettings | null, router: NextRouter, returnPolicy: string, privacyPolicy: string, termsOfService: string, t: TFunction, customizationProps: IkasCheckoutCustomizationProps);
56
57
  init: () => Promise<void>;
@@ -73,6 +74,7 @@ export default class CheckoutViewModel {
73
74
  get canProceedToInStoreDelivery(): boolean;
74
75
  get canProceedToPayment(): boolean | undefined;
75
76
  get isInStoreDelivery(): boolean;
77
+ get isCustomFlowStripe(): false | import("../../__api/models/PaymentGatewaySettings").PaymentGatewaySettingsData | null | undefined;
76
78
  get canPerformPayment(): boolean | undefined;
77
79
  saveCart: () => Promise<import("../../models").IkasCart | null | undefined>;
78
80
  inStockDeliveryInputData: (input: SaveCartInput) => Promise<SaveCartInput>;
@@ -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'../../ext/lodash/cloneDeep.js';import r from'../../ext/lodash/sortBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import{IkasCustomerAddress as o}from"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import{IkasOrderAddress as a}from"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import{IkasOrderCustomer as d}from"../../models/data/order/customer/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/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/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import"../../models/data/payment-gateway/index.js";import c from"./components/credit-card-form/model.js";import{IkasStorefrontConfig as l}from"../../storefront/index.js";import{IkasCheckoutSettings as u}from"../../models/data/checkout-settings/index.js";import{Analytics as h}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import p from"../../models/data/checkout/index.js";import m from"../../store/customer/api.js";import v from"../../store/merchant/index.js";import f from"../../store/checkout/index.js";import{CheckStocksLineInput as g}from"../../__api/models/CheckStocksLineInput.js";import y from"../../store/cart/api.js";import{SaveCartInput as S}from"../../__api/models/SaveCartInput.js";import{PaymentMethodEnum as k,PaymentGatewayTypeEnum as b,TransactionStatusEnum as I}from"../../__api/types/index.js";import C from"./modelMasterPass.js";import P from'../../ext/uuid/dist/esm-node/v4.js';var A,j,w=/^\d+$/,R="undefined"==typeof localStorage,N=function(){function w(w,N,T,O,D,G,M,L,_){var U=this;this.checkout=new p,this.checkoutSettings=new u,this.storefront=null,this.store=l.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=A.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.policyModalTitle="",this.policyModalText="",this.error=null,this.init=function(){return t(U,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.store.customerStore.waitUntilInitialized()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getMerchantSettings()];case 2:return t.sent(),[4,this.initStep()];case 3:return t.sent(),[2]}}))}))},this.initStep=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(l.isEditor)return this.step=A.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===A.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(A.INFO)];if(this.step!==A.PAYMENT||this.canProceedToPayment){if(![A.INFO,A.SUCCESS,A.SHIPPING,A.PAYMENT].includes(this.step))return[2,this.changeStep(A.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(A.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:j.PAYMENT_ERROR,data:n||null}),this.step!==A.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!==A.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=A.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==A.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==A.PAYMENT&&this.step!==A.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:j.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:j.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===A.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(A.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,h.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getMerchantSettings=function(){return t(U,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.merchantSettings?[3,2]:[4,v.listMerchantSettings({})];case 1:t=e.sent(),this.merchantSettings=t.data||void 0,e.label=2;case 2:return[2]}}))}))},this.getSuccessTransaction=function(){return t(U,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,m.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(U,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return(t=new S(this.checkout)).cartId=this.checkout.id,"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return[4,y.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:j.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:j.API_ERROR};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(U,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),t.billingAddress=null,[2,t]}))}))},this.checkStocks=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,u,h,p;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,f.checkStocks({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.stockLocationIds||[]})];case 1:if(!(i=e.sent()).isSuccess)throw{type:j.API_ERROR};if(null==(s=null===(h=null===(u=i.data)||void 0===u?void 0:u.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(p=o.store.cartStore.cart)||void 0===p?void 0:p.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=this,a=0,d=s;a<d.length;a++)c=d[a],r(c);throw{type:j.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(U,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,this.store.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(U,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f.getAvailableShippingCountries({salesChannelId:l.salesChannelId})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(U,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return l.pickUpStockLocationIds?[4,f.listStockLocation({id:{in:l.pickUpStockLocationIds}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:j.API_ERROR},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(U,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return l.pickUpStockLocationIds?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,f.getAvailableStockLocations({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.pickUpStockLocationIds})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:j.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=U.shippingCountryIds)||void 0===t?void 0:t.length)||(U.error={type:j.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(U.checkout.stockLocationId=null),U.deliveryMethod=t,U.isErrorsVisible=!1},this.initialStockCheck=function(){return t(U,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(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:j.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,o,a,d,c,u=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=l.paymentGateways.map((function(t){return t.id})),[4,f.listPaymentGateway({id:t?void 0:{in:i}})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===A.PAYMENT&&(n=n.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(u.checkout.currencyCode)})),(o=null===(c=this.checkout.shippingAddress)||void 0===c?void 0:c.country)&&o.iso2&&(n=n.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(o.iso2||"")})))),a=[],r(l.paymentGateways,"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),console.log("1"),this.step===A.PAYMENT&&(console.log("2",{paymentGateways:n}),n.find((function(t){return!!t.masterPassClientId}))&&(console.log("3"),this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store}))),[2]):(this.error={type:j.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(U,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,f.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;U.store.customerStore.customer?(null===(t=U.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=U.checkoutSettings})),U.checkout.customer=new d(U.store.customerStore.customer)):U.checkout.customer||(U.checkout.customer=new d({}))},this.createShippingAddress=function(){var t;if(U.checkout.shippingAddress)U.selectedShippingAddressId=U.checkout.shippingAddress.id||"-1",U.checkout.shippingAddress.checkoutSettings=U.checkoutSettings;else{var e=null===(t=U.store.customerStore.customer)||void 0===t?void 0:t.addresses;U.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(U.useDifferentAddress=!!localStorage.getItem("sAddr"),U.useDifferentAddress?(U.checkout.billingAddress&&(U.selectedBillingAddressId=U.checkout.billingAddress.id||"-1"),U.checkout.billingAddress=U.checkout.billingAddress||new a):U.checkout.billingAddress=new a(n(U.checkout.shippingAddress)||{}),U.checkout.billingAddress.checkoutSettings=U.checkoutSettings)},this.onShippingMethodChange=function(i){return t(U,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 p(t)),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(U,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(U,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,y.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===A.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 p(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(U.selectedShippingAddressId=t,"-1"===t)U.checkout.shippingAddress=new a;else{var s=null===(i=null===(e=U.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(U.checkout.shippingAddress=new a(s))}U.checkout.shippingAddress&&(U.checkout.shippingAddress.checkoutSettings=U.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(U.selectedBillingAddressId=t,"-1"===t)U.checkout.billingAddress=new a;else{var s=null===(i=null===(e=U.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(U.checkout.billingAddress=new a(s))}U.checkout.billingAddress&&(U.checkout.billingAddress.checkoutSettings=U.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){U.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(U.cardData&&(!(t.length>U.cardData.cardNumber.length)||E(t))){var e=(U.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!U.installmentInfo?U.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:U.checkout.selectedPaymentGateway.id,price:U.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(U.cardData.installmentCount=1,U.installmentInfo=void 0),U.cardData.cardNumber=x(i,4).join(" "))}},this.onCardHolderNameChange=function(t){U.cardData&&(U.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(U.cardData&&(!(t.length>U.cardData.expirationDate.length)||E(t))){if(0===(null===(e=U.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(U.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(U.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(U.cardData.expirationDate=x(a,2).join(" / "))}},this.onCvcChange=function(t){U.cardData&&(t.length>U.cardData.cvv.length&&!E(t)||t.length>4||(U.cardData.cvv=t))},this.saveAddress=function(s){return t(U,void 0,void 0,(function(){var t,r,a,d,c;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 o(i(i({},t),{title:this.addressTitle||this.t("checkout-page:newAddress"),id:P()})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(r),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:e.sent(),"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 d=e.sent(),console.error(d),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){U.router.push("/cart")},this.onBackToShoppingClick=function(){U.router.push("/")},this.onProceedToShippingClick=function(){return t(U,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(A.SHIPPING):this.changeStep(A.PAYMENT),[3,7];case 6:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:j.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(U,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(A.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:j.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(U,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:if(!this.canPerformPayment)return this.isErrorsVisible=!0,[2];this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),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(),"STRIPE"===(null===(s=this.checkout.selectedPaymentGateway)||void 0===s?void 0:s.code)?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):[4,this.createSaleTransaction()];case 6:return e.sent(),[3,8];case 7:return(i=e.sent()).type?this.error=i:this.error={type:j.UNKNOWN},this.isStepLoading=!1,[3,8];case 8:return[2]}}))}))},this.createSaleTransaction=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,l;return e(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?((i=this.isPaymentGatewayHasMasterPass&&this.mpVM.selectedCard)&&(s=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(t=s),[4,f.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.cardName}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===k.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===b.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]):[2];case 1:return n=e.sent(),r=null===(c=null==n?void 0:n.data)||void 0===c?void 0:c.transactionStatus,o=r&&[I.SUCCESS,I.AUTHORIZED].includes(r),a=r===I.PENDING,o?[4,this.getSuccessTransaction()]:[3,4];case 2:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 3:return e.sent(),[3,5];case 4:if(!a||!(null===(l=null==n?void 0:n.data)||void 0===l?void 0:l.returnSlug))throw{type:j.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+n.data.returnSlug,e.label=5;case 5:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(U,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(A.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){U.changeStep(A.INFO)},this.onBackToShippingClick=function(){U.changeStep(A.SHIPPING)},this.setCustomerConsentGranted=function(t){U.checkout.customer&&(U.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){U.useDifferentAddress=t,U.useDifferentAddress?(localStorage.setItem("sAddr","1"),U.checkout.billingAddress=U.checkout.billingAddress||new a):(localStorage.removeItem("sAddr"),U.checkout.billingAddress=U.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){U.shouldSaveAddress=t},this.setAddressTitle=function(t){U.addressTitle=t},this.setPaymentGateway=function(i){return t(U,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||this.stripeResponse?[3,2]:[4,f.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 this.checkout.selectedPaymentGateway=t,this.step!==A.SUCCESS&&(t.paymentMethodType===k.CREDIT_CARD&&t.type===b.INTERNAL&&(this.cardData=new c),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){U.cardData&&(U.cardData.installmentCount=t)},this.changeStep=function(i){return t(U,void 0,void 0,(function(){return e(this,(function(t){return R||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(U,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){U.isContactModalVisible=t},this.checkout=w,this.checkoutSettings=N,this.router=O,this.returnPolicy=D,this.privacyPolicy=G,this.termsOfService=M,this.t=L,this.customizationProps=_,this.mpVM=new C,T&&(this.merchantSettings=T),this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.init(),s(this)}return Object.defineProperty(w.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(w.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(w.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=this.store.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(w.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(w.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"finalPrice",{get:function(){return this.step===A.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===j.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"canProceedToShipping",{get:function(){var t,e;return(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValid)&&this.checkout.hasValidCustomerEmail&&(null===(e=this.error)||void 0===e?void 0:e.type)!==j.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(w.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(w.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway;return("in-store"===this.deliveryMethod||this.canProceedToShipping)&&("in-store"===this.deliveryMethod||!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid))&&((null==i?void 0:i.paymentMethodType)===k.CREDIT_CARD&&i.type===b.INTERNAL?"STRIPE"===i.code||(null===(e=this.cardData)||void 0===e?void 0:e.isValid):!!i)},enumerable:!1,configurable:!0}),w}();function x(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function E(t){return t&&w.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(A||(A={})),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"}(j||(j={}));export{A as CheckoutStep,j as ErrorType,N 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'../../ext/lodash/cloneDeep.js';import r from'../../ext/lodash/sortBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import{IkasCustomerAddress as o}from"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import{IkasOrderAddress as a}from"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import{IkasOrderCustomer as d}from"../../models/data/order/customer/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/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/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/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"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import"../../models/data/payment-gateway/index.js";import c from"./components/credit-card-form/model.js";import{IkasStorefrontConfig as l}from"../../storefront/index.js";import{IkasCheckoutSettings as u}from"../../models/data/checkout-settings/index.js";import{Analytics as h}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import p from"../../models/data/checkout/index.js";import m from"../../store/customer/api.js";import v from"../../store/merchant/index.js";import f from"../../store/checkout/index.js";import{CheckStocksLineInput as g}from"../../__api/models/CheckStocksLineInput.js";import y from"../../store/cart/api.js";import{SaveCartInput as S}from"../../__api/models/SaveCartInput.js";import{PaymentMethodEnum as k,PaymentGatewayTypeEnum as b,TransactionStatusEnum as I}from"../../__api/types/index.js";import C from"./modelMasterPass.js";import P from'../../ext/uuid/dist/esm-node/v4.js';var A,j,w=/^\d+$/,N="undefined"==typeof localStorage,R=function(){function w(w,R,T,O,D,M,G,_,L){var U=this;this.checkout=new p,this.checkoutSettings=new u,this.storefront=null,this.store=l.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=A.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.policyModalTitle="",this.policyModalText="",this.error=null,this.showTestModal=!1,this.init=function(){return t(U,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.store.customerStore.waitUntilInitialized()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getMerchantSettings()];case 2:return t.sent(),[4,this.initStep()];case 3:return t.sent(),[2]}}))}))},this.initStep=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(l.isEditor)return this.step=A.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===A.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(A.INFO)];if(this.step!==A.PAYMENT||this.canProceedToPayment){if(![A.INFO,A.SUCCESS,A.SHIPPING,A.PAYMENT].includes(this.step))return[2,this.changeStep(A.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(A.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:j.PAYMENT_ERROR,data:n||null}),this.step!==A.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!==A.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=A.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==A.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==A.PAYMENT&&this.step!==A.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:j.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:j.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===A.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(A.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,h.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getMerchantSettings=function(){return t(U,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.merchantSettings?[3,2]:[4,v.listMerchantSettings({})];case 1:t=e.sent(),this.merchantSettings=t.data||void 0,e.label=2;case 2:return[2]}}))}))},this.getSuccessTransaction=function(){return t(U,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,m.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(U,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return(t=new S(this.checkout)).cartId=this.checkout.id,"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return[4,y.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:j.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:j.API_ERROR};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(U,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),t.billingAddress=null,[2,t]}))}))},this.checkStocks=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,u,h,p;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,f.checkStocks({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.pickUpStockLocationIds||[]})];case 1:if(!(i=e.sent()).isSuccess)throw{type:j.API_ERROR};if(null==(s=null===(h=null===(u=i.data)||void 0===u?void 0:u.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(p=o.store.cartStore.cart)||void 0===p?void 0:p.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=this,a=0,d=s;a<d.length;a++)c=d[a],r(c);throw{type:j.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(U,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,this.store.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(U,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f.getAvailableShippingCountries({salesChannelId:l.salesChannelId})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(U,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return l.pickUpStockLocationIds?[4,f.listStockLocation({id:{in:l.pickUpStockLocationIds}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:j.API_ERROR},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(U,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return l.pickUpStockLocationIds?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,f.getAvailableStockLocations({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.pickUpStockLocationIds})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:j.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=U.shippingCountryIds)||void 0===t?void 0:t.length)||(U.error={type:j.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(U.checkout.stockLocationId=null),U.deliveryMethod=t,U.isErrorsVisible=!1},this.initialStockCheck=function(){return t(U,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(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:j.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,o,a,d,c,u,h=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=l.paymentGateways.map((function(t){return t.id})),[4,f.listPaymentGateway({id:t?void 0:{in:i}})];case 1:return(s=e.sent()).isSuccess&&(null===(c=s.data)||void 0===c?void 0:c.length)?(n=s.data,this.step===A.PAYMENT&&(n=n.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(h.checkout.currencyCode)})),(o=null===(u=this.checkout.shippingAddress)||void 0===u?void 0:u.country)&&o.iso2&&(n=n.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(o.iso2||"")})))),a=[],r(l.paymentGateways,"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),console.log("1"),this.step===A.PAYMENT&&(console.log("2",{paymentGateways:n}),(d=n.find((function(t){return!!t.masterPassClientId})))&&(console.log("3"),this.checkout.masterPassPaymentGateway=d,this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store}))),[2]):(this.error={type:j.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(U,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,f.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;U.store.customerStore.customer?(null===(t=U.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=U.checkoutSettings})),U.checkout.customer=new d(U.store.customerStore.customer)):U.checkout.customer||(U.checkout.customer=new d({}))},this.createShippingAddress=function(){var t;if(U.checkout.shippingAddress)U.selectedShippingAddressId=U.checkout.shippingAddress.id||"-1",U.checkout.shippingAddress.checkoutSettings=U.checkoutSettings;else{var e=null===(t=U.store.customerStore.customer)||void 0===t?void 0:t.addresses;U.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(U.useDifferentAddress=!!localStorage.getItem("sAddr"),U.useDifferentAddress?(U.checkout.billingAddress&&(U.selectedBillingAddressId=U.checkout.billingAddress.id||"-1"),U.checkout.billingAddress=U.checkout.billingAddress||new a):U.checkout.billingAddress=new a(n(U.checkout.shippingAddress)||{}),U.checkout.billingAddress.checkoutSettings=U.checkoutSettings)},this.onShippingMethodChange=function(i){return t(U,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 p(t)),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(U,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(U,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,y.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===A.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 p(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(U.selectedShippingAddressId=t,"-1"===t)U.checkout.shippingAddress=new a;else{var s=null===(i=null===(e=U.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(U.checkout.shippingAddress=new a(s))}U.checkout.shippingAddress&&(U.checkout.shippingAddress.checkoutSettings=U.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(U.selectedBillingAddressId=t,"-1"===t)U.checkout.billingAddress=new a;else{var s=null===(i=null===(e=U.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(U.checkout.billingAddress=new a(s))}U.checkout.billingAddress&&(U.checkout.billingAddress.checkoutSettings=U.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){U.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(U.cardData&&(!(t.length>U.cardData.cardNumber.length)||E(t))){var e=(U.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!U.installmentInfo?U.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:U.checkout.selectedPaymentGateway.id,price:U.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(U.cardData.installmentCount=1,U.installmentInfo=void 0),U.cardData.cardNumber=x(i,4).join(" "))}},this.onCardHolderNameChange=function(t){U.cardData&&(U.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(U.cardData&&(!(t.length>U.cardData.expirationDate.length)||E(t))){if(0===(null===(e=U.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(U.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(U.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(U.cardData.expirationDate=x(a,2).join(" / "))}},this.onCvcChange=function(t){U.cardData&&(t.length>U.cardData.cvv.length&&!E(t)||t.length>4||(U.cardData.cvv=t))},this.saveAddress=function(s){return t(U,void 0,void 0,(function(){var t,r,a,d,c;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 o(i(i({},t),{title:this.addressTitle||this.t("checkout-page:newAddress"),id:P()})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(r),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:e.sent(),"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 d=e.sent(),console.error(d),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){U.router.push("/cart")},this.onBackToShoppingClick=function(){U.router.push("/")},this.onProceedToShippingClick=function(){return t(U,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(A.SHIPPING):this.changeStep(A.PAYMENT),[3,7];case 6:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:j.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(U,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(A.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:j.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(U,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];this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),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(i=e.sent()).type?this.error=i:this.error={type:j.UNKNOWN},this.isStepLoading=!1,[3,8];case 8:return[2]}}))}))},this.createSaleTransaction=function(){return t(U,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,l,u,h,p,m,v;return e(this,(function(e){switch(e.label){case 0:return(i=this.mpVM.selectedCard)&&(null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(t=n),void 0===(null===(c=this.cardData)||void 0===c?void 0:c.installmentCount)?[2]:[4,f.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:t,savedCardName:null===(l=this.mpVM.selectedCard)||void 0===l?void 0:l.Name},paymentGatewayId:null===(u=this.mpVM.selectedCard)||void 0===u?void 0:u.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===(h=this.cardData)||void 0===h?void 0:h.threeDSecure)}}})]):[3,2];case 1:return s=e.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,f.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===k.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===b.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=e.sent(),e.label=4;case 4:return r=null===(m=null==s?void 0:s.data)||void 0===m?void 0:m.transactionStatus,o=r&&[I.SUCCESS,I.AUTHORIZED].includes(r),a=r===I.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return e.sent(),[3,8];case 7:if(!a||!(null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.returnSlug))throw{type:j.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(U,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(A.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){U.changeStep(A.INFO)},this.onBackToShippingClick=function(){U.changeStep(A.SHIPPING)},this.setCustomerConsentGranted=function(t){U.checkout.customer&&(U.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){U.useDifferentAddress=t,U.useDifferentAddress?(localStorage.setItem("sAddr","1"),U.checkout.billingAddress=U.checkout.billingAddress||new a):(localStorage.removeItem("sAddr"),U.checkout.billingAddress=U.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){U.shouldSaveAddress=t},this.setAddressTitle=function(t){U.addressTitle=t},this.setPaymentGateway=function(i){return t(U,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,f.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 this.checkout.selectedPaymentGateway=t,this.step!==A.SUCCESS&&(t.paymentMethodType===k.CREDIT_CARD&&t.type===b.INTERNAL&&(this.cardData=new c),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){U.cardData&&(U.cardData.installmentCount=t)},this.changeStep=function(i){return t(U,void 0,void 0,(function(){return e(this,(function(t){return N||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(U,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){U.isContactModalVisible=t},this.checkout=w,this.checkoutSettings=R,this.router=O,this.returnPolicy=D,this.privacyPolicy=M,this.termsOfService=G,this.t=_,this.customizationProps=L,this.mpVM=new C,T&&(this.merchantSettings=T),this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.init(),s(this)}return Object.defineProperty(w.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(w.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(w.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=this.store.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(w.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(w.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"finalPrice",{get:function(){return this.step===A.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===j.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"canProceedToShipping",{get:function(){var t,e;return(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValid)&&this.checkout.hasValidCustomerEmail&&(null===(e=this.error)||void 0===e?void 0:e.type)!==j.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(w.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(w.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(w.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(w.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,n=!!s||!!this.canProceedToShipping,r=!!s||!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid),o=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===k.CREDIT_CARD&&i.type===b.INTERNAL?!!this.isCustomFlowStripe||(null===(e=this.cardData)||void 0===e?void 0:e.isValid):!!i);return n&&r&&o},enumerable:!1,configurable:!0}),w}();function x(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function E(t){return t&&w.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(A||(A={})),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"}(j||(j={}));export{A as CheckoutStep,j as ErrorType,R as default};