@ikas/storefront 3.0.0-alpha.34 → 3.0.0-alpha.36

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 (25) hide show
  1. package/build/assets/translations/checkout/en.js +1 -1
  2. package/build/assets/translations/checkout/tr.js +1 -1
  3. package/build/components/checkout/components/customer-addresses/index.js +1 -1
  4. package/build/components/checkout/components/master-pass/modal-link-card-to-client/index.d.ts +3 -2
  5. package/build/components/checkout/components/master-pass/modal-link-card-to-client/index.js +1 -1
  6. package/build/components/checkout/components/master-pass/modal-link-card-to-client/style.module.scss.js +1 -1
  7. package/build/components/checkout/components/master-pass/modal-otp/index.d.ts +0 -8
  8. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
  9. package/build/components/checkout/components/master-pass/modal-otp/style.module.scss.js +1 -1
  10. package/build/components/checkout/components/master-pass/modal-success/index.d.ts +11 -0
  11. package/build/components/checkout/components/master-pass/modal-success/index.js +1 -0
  12. package/build/components/checkout/components/master-pass/modal-success/style.module.scss.js +1 -0
  13. package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/master-pass-by-master-card-small.d.ts +0 -0
  14. package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/master-pass-by-master-card-small.js +0 -0
  15. package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/success.d.ts +0 -0
  16. package/build/components/checkout/components/master-pass/{modal-otp → modal-success}/svg/success.js +0 -0
  17. package/build/components/checkout/index.js +1 -1
  18. package/build/components/checkout/model.js +1 -1
  19. package/build/components/checkout/modelMasterPass.d.ts +18 -3
  20. package/build/components/checkout/modelMasterPass.js +1 -1
  21. package/build/components/checkout/steps/step-payment/billing-address/index.js +1 -1
  22. package/build/components/checkout/steps/step-success/index.js +1 -1
  23. package/build/ikas.cjs +1 -1
  24. package/build/scripts/generators/config/content.js +1 -1
  25. package/package.json +1 -1
@@ -1 +1 @@
1
- var e={actions:{login:"Login",edit:"Edit",apply:"Apply",close:"Close",cancel:"Cancel",save:"Save",continue:"Continue",show:"Show",hide:"Hide",sendMessage:"Send Message",continueWithShipping:"Continue with Shipping",continueWithPayment:"Continue with Payment",completeOrder:"Complete the Order",backToShopping:"Back to Shopping",backToCart:"Back to Cart"},securePayment:"Secure Payment",alreadyHaveAnAccount:"Already have an account?",address:"Address",addressError:"Enter address",missingAddressFields:"There are some missing required fields in this address.",editAddress:"Edit Address",deleteAddress:"Delete Address",saveAddressCta:"Save this address for future purchases",firstName:"Name",firstNameError:"Enter name",lastName:"Surname",lastNameError:"Enter surname",identityNumber:"Identity Number",identityNumberError:"Enter identity number",addressTitle:"Adress Title",adressTitleError:"Enter address title",addressLine1:"Address",addressLine2:"Address Second Line",postalCode:"Postal Code",postalCodeError:"Enter postal code",country:"Country",countryError:"Select country",state:"State",stateError:"Select state",city:"City",cityError:"Select city",district:"District",districtError:"Select district",phone:"Phone",phoneError:"Enter a valid phone number",companyName:"Company Name",taxOffice:"Tax Office",taxNumber:"Tax Number",deliveryMethod:"Delivery Method",deliveryToAddress:"Delivery to Address",inStoreDelivery:"In Store Delivery",stockLocation:{deliveryTime:{WITHIN_ONE_HOUR:"Usually ready in 1 hour",WITHIN_TWO_HOURS:"Usually ready in 2 hours",WITHIN_FOUR_HOURS:"Usually ready in 4 hours",WITHIN_TWENTY_FOUR_HOURS:"Usually ready in 24 hours",TWO_IN_FOUR_DAYS:"Usually ready in 2-4 days",WITHIN_PLUS_FIVE_DAYS:"Usually ready in +5 days"}},recipientsInfo:"Recipient Information",pickUpLocation:"Pick Up Location",receiver:"Receiver",shipping:"Shipping",payment:"Payment",summary:"Summary",free:"Free",standartShipping:"Standart Shipping",returnPolicy:"Return Policy",privacyPolicy:"Privacy Policy",termsOfService:"Terms of Service",newAddress:"New Address",billingAddress:"Billing Address",shippingAddress:"Shipping Address",corporateInvoice:"Corporate invoice",contactInfo:"Contact Information",email:"E-Mail",emailError:"Enter a valid e-mail",guestEmailTooltip:"Your order information will be sent to this e-mail address",customerConsentCta:"Contact me about the news and promotions",useShippingForBilling:"Use shipping address for billing",installmentOptions:"Installment Options",singleInstallment:"Single Payment",installments:"Installments",creditCard:"Credit Card",ackPrivacyPolicy:"Privacy Policy",ackTermsOfService:"Terms of Service",ackPoliciesSentence:"I acknowledge the {{ ackPrivacyPolicy }} and {{ ackTermsOfService }}.",securePaymentTooltip:"All payments are secure and encrypted",giftPackage:"Gift Package",giftPackageCta:"Gift wrap this order",giftPackageCtaPlaceholder:"Enter your gift message",paymentMethod:"Payment Method",paymentMethodDiscount:"Discount",paymentMethodAdditionalPrice:"Fee",orderSuccessTitle:"Thank you for your order!",orderSuccessDescription:"Dear {{ customerName }}, we have received your order. We will notify you when your order is shipped.",orderSuccessInStoreDeliveryDescription:"Dear {{ customerName }}, we have received your order. We will notify you by e-mail when your order is delivered to the store.",orderNoAndDate:"Order Number / Date",paymentSummary:"Payment Summary",shippingSummary:"Shipping Summary",helpCtaQuestion:"Do you need help?",helpCta:"Contact us",contactForm:"Contact Form",contactFormSent:"Message sent successfully",contactFormDescription:"We will respond to your message as soon as possible",contactFormCta:"Type your message",orderPackageStatus:{unfulfilled:"Unfulfilled",readyForShipment:"Ready For Shipment",fulfilled:"Fulfilled",partiallyFulfilled:"Partially Fulfilled",delivered:"Delivered",unableToDeliver:"Unable to Deliver",cancelled:"Cancelled",cancelRejected:"Cancel Rejected",cancelRequested:"Cancel Requested",refunded:"Refunded",refundRequestAccepted:"Refund Request Accepted",refundRejected:"Refund Rejected",refundRequested:"Refund Requested"},quantity:"Quantity",cartItemProduct:"product",giftCodeErrorTitle:"Gift Code Error",giftCodeErrorDescription:"The gift code you entered is not valid or not applicable to the products in your cart. Please check your code and try again.",subtotal:"Subtotal",total:"Total",subtotalTooltip:"Subtotal reflects the total for your cart before the discounts and does not include the shipping fees.",cartShippingTitle:"Delivery / Shipping",cartTaxTitle:"Tax",cartInterest:"Interest",couponCode:"Coupon Code",addCouponCode:"Add coupon code",addOrderNote:"Add order note",editOrderNote:"Edit order note",orderNote:"Order Note",enterPhoneNumber:"Enter phone number",cardNumber:"Card Number",cardNumberError:"Please enter a valid card number",cardHolderName:"Cardholder Name",cardHolderError:"Enter cardholder name",cardExpiry:"Month / Year",cardExpiryError:"Enter a valid date",cardCVC:"CVC",cardCVCError:"Enter a valid CVC",cardCVCTooltip:"CVC is the 3 digit number behind your card",masterPass:{paymentGatewaySelectBox:{delete:"Delete"},creditCardForm:{checkboxLabel:"I want to store my card in the {{ masterpassLogo }} infrastructure.",cardName:"Card Name",phoneNumber:"Phone Number",button:"Send Verification Code"},otpModal:{otpTextBank:"Enter the SMS verification code sent by your bank.",otpTextMasterPass:"Enter the SMS verification code sent by Masterpass.",countdownText:"Remaining time: ",resendText:"Resend code",linkCardToClient:{text:"You have a card registered to Masterpass. Click OK to use your card for your shopping.",buttonText:"OK",subInfoText:"Payment process will not be made at this stage."},inputLabel:"Enter the verification code",buttonText:"Verify",successText:"Your Masterpass account has been successfully confirmed."}},errorCustomerRequired:"This e-mail address belongs to a registered user. Please login to your account.",errorNoShipping:"Your region is not available for shipping.",errorPayment:"Your payment could not be received. Please check your information and try again.",errorStockTitle:"Stock Update!",errorStockDescription:"Some items in your cart are out of stock. Would you like to continue by removing these products from your cart?",errorUnknown:"An unexpected error has occurred. Please try again.",errorPickupLocationRequired:"Choose pickup location",customizedProduct:"Customized Product",yes:"Yes",no:"No"};export{e as default};
1
+ var e={actions:{login:"Login",edit:"Edit",apply:"Apply",close:"Close",cancel:"Cancel",save:"Save",continue:"Continue",show:"Show",hide:"Hide",sendMessage:"Send Message",continueWithShipping:"Continue with Shipping",continueWithPayment:"Continue with Payment",completeOrder:"Complete the Order",backToShopping:"Back to Shopping",backToCart:"Back to Cart"},securePayment:"Secure Payment",alreadyHaveAnAccount:"Already have an account?",address:"Address",addressError:"Enter address",missingAddressFields:"There are some missing required fields in this address.",editAddress:"Edit Address",deleteAddress:"Delete Address",saveAddressCta:"Save this address for future purchases",firstName:"Name",firstNameError:"Enter name",lastName:"Surname",lastNameError:"Enter surname",identityNumber:"Identity Number",identityNumberError:"Enter identity number",addressTitle:"Adress Title",adressTitleError:"Enter address title",addressLine1:"Address",addressLine2:"Address Second Line",postalCode:"Postal Code",postalCodeError:"Enter postal code",country:"Country",countryError:"Select country",state:"State",stateError:"Select state",city:"City",cityError:"Select city",district:"District",districtError:"Select district",phone:"Phone",phoneError:"Enter a valid phone number",companyName:"Company Name",taxOffice:"Tax Office",taxNumber:"Tax Number",deliveryMethod:"Delivery Method",deliveryToAddress:"Delivery to Address",inStoreDelivery:"In Store Delivery",stockLocation:{deliveryTime:{WITHIN_ONE_HOUR:"Usually ready in 1 hour",WITHIN_TWO_HOURS:"Usually ready in 2 hours",WITHIN_FOUR_HOURS:"Usually ready in 4 hours",WITHIN_TWENTY_FOUR_HOURS:"Usually ready in 24 hours",TWO_IN_FOUR_DAYS:"Usually ready in 2-4 days",WITHIN_PLUS_FIVE_DAYS:"Usually ready in +5 days"}},recipientsInfo:"Recipient Information",pickUpLocation:"Pick Up Location",receiver:"Receiver",shipping:"Shipping",payment:"Payment",summary:"Summary",free:"Free",standartShipping:"Standart Shipping",returnPolicy:"Return Policy",privacyPolicy:"Privacy Policy",termsOfService:"Terms of Service",newAddress:"New Address",billingAddress:"Billing Address",shippingAddress:"Shipping Address",corporateInvoice:"Corporate invoice",contactInfo:"Contact Information",email:"E-Mail",emailError:"Enter a valid e-mail",guestEmailTooltip:"Your order information will be sent to this e-mail address",customerConsentCta:"Contact me about the news and promotions",useShippingForBilling:"Use shipping address for billing",installmentOptions:"Installment Options",singleInstallment:"Single Payment",installments:"Installments",creditCard:"Credit Card",ackPrivacyPolicy:"Privacy Policy",ackTermsOfService:"Terms of Service",ackPoliciesSentence:"I acknowledge the {{ ackPrivacyPolicy }} and {{ ackTermsOfService }}.",securePaymentTooltip:"All payments are secure and encrypted",giftPackage:"Gift Package",giftPackageCta:"Gift wrap this order",giftPackageCtaPlaceholder:"Enter your gift message",paymentMethod:"Payment Method",paymentMethodDiscount:"Discount",paymentMethodAdditionalPrice:"Fee",orderSuccessTitle:"Thank you for your order!",orderSuccessDescription:"Dear {{ customerName }}, we have received your order. We will notify you when your order is shipped.",orderSuccessInStoreDeliveryDescription:"Dear {{ customerName }}, we have received your order. We will notify you by e-mail when your order is delivered to the store.",orderNoAndDate:"Order Number / Date",paymentSummary:"Payment Summary",shippingSummary:"Shipping Summary",helpCtaQuestion:"Do you need help?",helpCta:"Contact us",contactForm:"Contact Form",contactFormSent:"Message sent successfully",contactFormDescription:"We will respond to your message as soon as possible",contactFormCta:"Type your message",orderPackageStatus:{unfulfilled:"Unfulfilled",readyForShipment:"Ready For Shipment",fulfilled:"Fulfilled",partiallyFulfilled:"Partially Fulfilled",delivered:"Delivered",unableToDeliver:"Unable to Deliver",cancelled:"Cancelled",cancelRejected:"Cancel Rejected",cancelRequested:"Cancel Requested",refunded:"Refunded",refundRequestAccepted:"Refund Request Accepted",refundRejected:"Refund Rejected",refundRequested:"Refund Requested"},quantity:"Quantity",cartItemProduct:"product",giftCodeErrorTitle:"Gift Code Error",giftCodeErrorDescription:"The gift code you entered is not valid or not applicable to the products in your cart. Please check your code and try again.",subtotal:"Subtotal",total:"Total",subtotalTooltip:"Subtotal reflects the total for your cart before the discounts and does not include the shipping fees.",cartShippingTitle:"Delivery / Shipping",cartTaxTitle:"Tax",cartInterest:"Interest",couponCode:"Coupon Code",addCouponCode:"Add coupon code",addOrderNote:"Add order note",editOrderNote:"Edit order note",orderNote:"Order Note",enterPhoneNumber:"Enter phone number",cardNumber:"Card Number",cardNumberError:"Please enter a valid card number",cardHolderName:"Cardholder Name",cardHolderError:"Enter cardholder name",cardExpiry:"Month / Year",cardExpiryError:"Enter a valid date",cardCVC:"CVC",cardCVCError:"Enter a valid CVC",cardCVCTooltip:"CVC is the 3 digit number behind your card",masterPass:{paymentGatewaySelectBox:{delete:"Delete"},creditCardForm:{checkboxLabel:"I want to store my card in the {{ masterpassLogo }} infrastructure.",cardName:"Card Name",phoneNumber:"Phone Number",button:"Send Verification Code"},linkCardToClientModal:{text:"You have a card registered to Masterpass. Click OK to use your card for your shopping.",buttonText:"OK",subInfoText:"Payment process will not be made at this stage."},otpModal:{otpTextBank:"Enter the SMS verification code sent by your bank.",otpTextMasterPass:"Enter the SMS verification code sent by Masterpass.",countdownText:"Remaining time: ",resendText:"Resend code",inputLabel:"Enter the verification code",buttonText:"Verify"},successModal:{otpSuccessText:"Your card successfully registered.",linkCardToClientSuccessText:"Your Masterpass account has been successfully confirmed."}},errorCustomerRequired:"This e-mail address belongs to a registered user. Please login to your account.",errorNoShipping:"Your region is not available for shipping.",errorPayment:"Your payment could not be received. Please check your information and try again.",errorStockTitle:"Stock Update!",errorStockDescription:"Some items in your cart are out of stock. Would you like to continue by removing these products from your cart?",errorUnknown:"An unexpected error has occurred. Please try again.",errorPickupLocationRequired:"Choose pickup location",customizedProduct:"Customized Product",yes:"Yes",no:"No"};export{e as default};
@@ -1 +1 @@
1
- var e={actions:{login:"Giriş Yap",edit:"Düzenle",apply:"Uygula",close:"Kapat",cancel:"Vazgeç",save:"Kaydet",continue:"Devam Et",show:"Göster",hide:"Gizle",sendMessage:"Mesajı Gönder",continueWithShipping:"Kargo ile Devam Et",continueWithPayment:"Ödeme ile Devam Et",completeOrder:"Siparişi Tamamla",backToShopping:"Alışverişe Dön",backToCart:"Sepete Dön"},securePayment:"Güvenli Ödeme",alreadyHaveAnAccount:"Zaten hesabınız var mı?",address:"Adres",addressError:"Adres girin",missingAddressFields:"Adres bilgilerinde bazı zorunlu alanlar eksik.",editAddress:"Adres Düzenle",deleteAddress:"Adresi Sil",saveAddressCta:"Bir sonraki işlem için bu adresi kaydet",firstName:"Ad",firstNameError:"Ad girin",lastName:"Soyad",lastNameError:"Soyad girin",identityNumber:"TC Kimlik No",identityNumberError:"TC kimlik no girin",addressTitle:"Adres Başlığı",adressTitleError:"Adres başlığı girin",addressLine1:"Adres",addressLine2:"Apartman, daire, vb.",postalCode:"Posta Kodu",postalCodeError:"Posta kodu girin",country:"Ülke",countryError:"Ülke seçin",state:"Eyalet",stateError:"Eyalet seçin",city:"İl",cityError:"İl seçin",district:"İlçe",districtError:"İlçe seçin",phone:"Telefon",phoneError:"Geçerli bir telefon girin",companyName:"Firma Adı",taxOffice:"Vergi Dairesi",taxNumber:"Vergi Numarası",deliveryMethod:"Teslimat Yöntemi",deliveryToAddress:"Adrese Teslimat",inStoreDelivery:"Mağazadan Teslimat",stockLocation:{deliveryTime:{WITHIN_ONE_HOUR:"Genelde 1 saat içinde hazır olur",WITHIN_TWO_HOURS:"Genelde 2 saat içinde hazır olur",WITHIN_FOUR_HOURS:"Genelde 4 saat içinde hazır olur",WITHIN_TWENTY_FOUR_HOURS:"Genelde 24 saat içinde hazır olur",TWO_IN_FOUR_DAYS:"Genelde 2-4 gün içinde hazır olur",WITHIN_PLUS_FIVE_DAYS:"Genelde +5 gün içinde hazır olur"}},recipientsInfo:"Teslim Alacak Kişi Bilgileri",pickUpLocation:"Teslim Alınacak Konum",receiver:"Teslim Alacak Kişi",shipping:"Kargo",payment:"Ödeme",summary:"Özet",free:"Ücretsiz",standartShipping:"Standart Kargo",returnPolicy:"Para İade Politikası",privacyPolicy:"Gizlilik Politikası",termsOfService:"Hizmet Şartları",newAddress:"Yeni Adres",billingAddress:"Fatura Adresi",shippingAddress:"Teslimat Adresi",corporateInvoice:"Kurumsal fatura",contactInfo:"İletişim Bilgileri",email:"E-Posta",emailError:"Geçerli bir e-posta girin",guestEmailTooltip:"Sipariş bilgileri bu e-posta adresine gönderilecektir",customerConsentCta:"Beni haberlerden ve özel tekliflerden haberdar et",useShippingForBilling:"Fatura adresim teslimat adresimle aynı",installmentOptions:"Taksit Seçenekleri",singleInstallment:"Tek Çekim",installments:"Taksit",creditCard:"Kredi Kartı",ackPrivacyPolicy:"Gizlilik Sözleşmesini",ackTermsOfService:"Satış Sözleşmesini",ackPoliciesSentence:"{{ ackPrivacyPolicy }} ve {{ ackTermsOfService }} okudum, onaylıyorum.",securePaymentTooltip:"Ödemeler güvenli ve şifrelidir",giftPackage:"Hediye Paketi",giftPackageCta:"Hediye paketi istiyorum",giftPackageCtaPlaceholder:"Hediye mesajınızı giriniz",paymentMethod:"Ödeme Yöntemi",paymentMethodDiscount:"İndirim",paymentMethodAdditionalPrice:"İşlem Bedeli",orderSuccessTitle:"Siparişiniz için teşekkür ederiz!",orderSuccessDescription:"Sevgili {{ customerName }}, siparişiniz bize ulaşmıştır. Siparişiniz kargoya verildiğinde sizi e-posta ile bilgilendireceğiz.",orderSuccessInStoreDeliveryDescription:"Sevgili {{ customerName }}, siparişiniz bize ulaşmıştır. Siparişiniz mağazaya teslim edildiğinde sizi e-posta ile bilgilendireceğiz.",orderNoAndDate:"Sipariş No / Tarih",paymentSummary:"Ödeme Özeti",shippingSummary:"Teslimat Özeti",helpCtaQuestion:"Yardıma mı ihtiyacınız var?",helpCta:"Bizimle iletişime geçin",contactForm:"İletişim Formu",contactFormSent:"Mesaj başarıyla gönderildi",contactFormDescription:"Mesajınızla ilgili olarak size en kısa zamanda e-posta veya telefon aracılığıyla geri dönüş yapılacaktır.",contactFormCta:"Mesajınızı yazın",orderPackageStatus:{unfulfilled:"Oluşturuldu",readyForShipment:"Kargoya Hazır",fulfilled:"Gönderildi",partiallyFulfilled:"Kısmi Gönderildi",delivered:"Teslim Edildi",unableToDeliver:"Teslim Edilemedi",cancelled:"İptal Edildi",cancelRejected:"İptal Talebi Reddedildi",cancelRequested:"İptal İstendi",refunded:"İade Edildi",refundRequestAccepted:"İade Talebi Onaylandı",refundRejected:"İade Talebi Reddedildi",refundRequested:"İade Talep Edildi"},quantity:"Adet",cartItemProduct:"ürün",giftCodeErrorTitle:"İndirim Kodu Hatası",giftCodeErrorDescription:"İndirim kodunuz geçersiz veya sepetinizdeki ürünlere uygulanabilir değil. Lütfen kodunuzu kontrol edip tekrar deneyin.",subtotal:"Ara Toplam",total:"Toplam",subtotalTooltip:"Ara toplam, tüm geçerli indirimlerden önce siparişinizin toplam fiyatını yansıtır. kargo ücretini içermez.",cartShippingTitle:"Teslimat / Kargo",cartTaxTitle:"Vergi",cartInterest:"Vade Farkı",couponCode:"İndirim Kodu",addCouponCode:"İndirim kodu ekle",addOrderNote:"Sipariş notu ekle",editOrderNote:"Sipariş notu düzenle",orderNote:"Sipariş Notu",enterPhoneNumber:"Telefon numarası girin",cardNumber:"Kart Numarası",cardNumberError:"Geçerli bir kart numarası girin",cardHolderName:"Kart Üzerindeki İsim",cardHolderError:"Ad soyad girin",cardExpiry:"Ay / Yıl",cardExpiryError:"Geçerli bir tarih girin",cardCVC:"CVC",cardCVCError:"Geçerli bir güvenlik kodu girin",cardCVCTooltip:"Kartınızın arkasındaki 3 haneli güvenlik kodu",masterPass:{paymentGatewaySelectBox:{delete:"Sil"},creditCardForm:{checkboxLabel:"Kartımı {{ masterPassLogo }} altyapısında saklamak istiyorum.",cardName:"Kart İsmi",phoneNumber:"Telefon Numarası",button:"Onay Kodu Gönder"},otpModal:{otpTextBank:"Bankanız tarafından gönderilen SMS doğrulama kodunu giriniz.",otpTextMasterPass:"Masterpass tarafından gönderilen SMS doğrulama kodunu giriniz.",countdownText:"Kalan Süre: ",resendText:"Yeni kod gönder",linkCardToClient:{text:"MasterPass’e kayıtlı kartınız bulunmaktadır. Kartınızı alışverişinizde kullanmak için TAMAM’a tıklayınız.",buttonText:"Tamam",subInfoText:"Bu aşamada kartınızdan tahsilat yapılmayacaktır."},inputLabel:"Doğrulama Kodunu Giriniz",buttonText:"Doğrula",successText:"Masterpass hesabınız başarılı bir şekilde doğrulandı."}},errorCustomerRequired:"Bu e-posta adresine ait kayıtlı bir hesap bulunuyor. Lütfen hesabınıza giriş yapınız.",errorNoShipping:"Bulunduğunuz konuma gönderim yapılmamaktadır.",errorPayment:"Ödemeniz alınamadı. Lütfen bilgilerinizi kontrol edip tekrar deneyin.",errorStockTitle:"Stoklar Güncellendi!",errorStockDescription:"Sepetinizdeki bazı ürünlerin stoğu tükenmiştir. Bu ürünleri sepetinizden çıkararak devam etmek ister misiniz?",errorUnknown:"Beklenmedik bir hata oluştu. Lütfen tekrar deneyin.",errorPickupLocationRequired:"Teslim alınacak konumu seçin",customizedProduct:"Kişiselleştirilmiş Ürün",yes:"Evet",no:"Hayır"};export{e as default};
1
+ var e={actions:{login:"Giriş Yap",edit:"Düzenle",apply:"Uygula",close:"Kapat",cancel:"Vazgeç",save:"Kaydet",continue:"Devam Et",show:"Göster",hide:"Gizle",sendMessage:"Mesajı Gönder",continueWithShipping:"Kargo ile Devam Et",continueWithPayment:"Ödeme ile Devam Et",completeOrder:"Siparişi Tamamla",backToShopping:"Alışverişe Dön",backToCart:"Sepete Dön"},securePayment:"Güvenli Ödeme",alreadyHaveAnAccount:"Zaten hesabınız var mı?",address:"Adres",addressError:"Adres girin",missingAddressFields:"Adres bilgilerinde bazı zorunlu alanlar eksik.",editAddress:"Adres Düzenle",deleteAddress:"Adresi Sil",saveAddressCta:"Bir sonraki işlem için bu adresi kaydet",firstName:"Ad",firstNameError:"Ad girin",lastName:"Soyad",lastNameError:"Soyad girin",identityNumber:"TC Kimlik No",identityNumberError:"TC kimlik no girin",addressTitle:"Adres Başlığı",adressTitleError:"Adres başlığı girin",addressLine1:"Adres",addressLine2:"Apartman, daire, vb.",postalCode:"Posta Kodu",postalCodeError:"Posta kodu girin",country:"Ülke",countryError:"Ülke seçin",state:"Eyalet",stateError:"Eyalet seçin",city:"İl",cityError:"İl seçin",district:"İlçe",districtError:"İlçe seçin",phone:"Telefon",phoneError:"Geçerli bir telefon girin",companyName:"Firma Adı",taxOffice:"Vergi Dairesi",taxNumber:"Vergi Numarası",deliveryMethod:"Teslimat Yöntemi",deliveryToAddress:"Adrese Teslimat",inStoreDelivery:"Mağazadan Teslimat",stockLocation:{deliveryTime:{WITHIN_ONE_HOUR:"Genelde 1 saat içinde hazır olur",WITHIN_TWO_HOURS:"Genelde 2 saat içinde hazır olur",WITHIN_FOUR_HOURS:"Genelde 4 saat içinde hazır olur",WITHIN_TWENTY_FOUR_HOURS:"Genelde 24 saat içinde hazır olur",TWO_IN_FOUR_DAYS:"Genelde 2-4 gün içinde hazır olur",WITHIN_PLUS_FIVE_DAYS:"Genelde +5 gün içinde hazır olur"}},recipientsInfo:"Teslim Alacak Kişi Bilgileri",pickUpLocation:"Teslim Alınacak Konum",receiver:"Teslim Alacak Kişi",shipping:"Kargo",payment:"Ödeme",summary:"Özet",free:"Ücretsiz",standartShipping:"Standart Kargo",returnPolicy:"Para İade Politikası",privacyPolicy:"Gizlilik Politikası",termsOfService:"Hizmet Şartları",newAddress:"Yeni Adres",billingAddress:"Fatura Adresi",shippingAddress:"Teslimat Adresi",corporateInvoice:"Kurumsal fatura",contactInfo:"İletişim Bilgileri",email:"E-Posta",emailError:"Geçerli bir e-posta girin",guestEmailTooltip:"Sipariş bilgileri bu e-posta adresine gönderilecektir",customerConsentCta:"Beni haberlerden ve özel tekliflerden haberdar et",useShippingForBilling:"Fatura adresim teslimat adresimle aynı",installmentOptions:"Taksit Seçenekleri",singleInstallment:"Tek Çekim",installments:"Taksit",creditCard:"Kredi Kartı",ackPrivacyPolicy:"Gizlilik Sözleşmesini",ackTermsOfService:"Satış Sözleşmesini",ackPoliciesSentence:"{{ ackPrivacyPolicy }} ve {{ ackTermsOfService }} okudum, onaylıyorum.",securePaymentTooltip:"Ödemeler güvenli ve şifrelidir",giftPackage:"Hediye Paketi",giftPackageCta:"Hediye paketi istiyorum",giftPackageCtaPlaceholder:"Hediye mesajınızı giriniz",paymentMethod:"Ödeme Yöntemi",paymentMethodDiscount:"İndirim",paymentMethodAdditionalPrice:"İşlem Bedeli",orderSuccessTitle:"Siparişiniz için teşekkür ederiz!",orderSuccessDescription:"Sevgili {{ customerName }}, siparişiniz bize ulaşmıştır. Siparişiniz kargoya verildiğinde sizi e-posta ile bilgilendireceğiz.",orderSuccessInStoreDeliveryDescription:"Sevgili {{ customerName }}, siparişiniz bize ulaşmıştır. Siparişiniz mağazaya teslim edildiğinde sizi e-posta ile bilgilendireceğiz.",orderNoAndDate:"Sipariş No / Tarih",paymentSummary:"Ödeme Özeti",shippingSummary:"Teslimat Özeti",helpCtaQuestion:"Yardıma mı ihtiyacınız var?",helpCta:"Bizimle iletişime geçin",contactForm:"İletişim Formu",contactFormSent:"Mesaj başarıyla gönderildi",contactFormDescription:"Mesajınızla ilgili olarak size en kısa zamanda e-posta veya telefon aracılığıyla geri dönüş yapılacaktır.",contactFormCta:"Mesajınızı yazın",orderPackageStatus:{unfulfilled:"Oluşturuldu",readyForShipment:"Kargoya Hazır",fulfilled:"Gönderildi",partiallyFulfilled:"Kısmi Gönderildi",delivered:"Teslim Edildi",unableToDeliver:"Teslim Edilemedi",cancelled:"İptal Edildi",cancelRejected:"İptal Talebi Reddedildi",cancelRequested:"İptal İstendi",refunded:"İade Edildi",refundRequestAccepted:"İade Talebi Onaylandı",refundRejected:"İade Talebi Reddedildi",refundRequested:"İade Talep Edildi"},quantity:"Adet",cartItemProduct:"ürün",giftCodeErrorTitle:"İndirim Kodu Hatası",giftCodeErrorDescription:"İndirim kodunuz geçersiz veya sepetinizdeki ürünlere uygulanabilir değil. Lütfen kodunuzu kontrol edip tekrar deneyin.",subtotal:"Ara Toplam",total:"Toplam",subtotalTooltip:"Ara toplam, tüm geçerli indirimlerden önce siparişinizin toplam fiyatını yansıtır. kargo ücretini içermez.",cartShippingTitle:"Teslimat / Kargo",cartTaxTitle:"Vergi",cartInterest:"Vade Farkı",couponCode:"İndirim Kodu",addCouponCode:"İndirim kodu ekle",addOrderNote:"Sipariş notu ekle",editOrderNote:"Sipariş notu düzenle",orderNote:"Sipariş Notu",enterPhoneNumber:"Telefon numarası girin",cardNumber:"Kart Numarası",cardNumberError:"Geçerli bir kart numarası girin",cardHolderName:"Kart Üzerindeki İsim",cardHolderError:"Ad soyad girin",cardExpiry:"Ay / Yıl",cardExpiryError:"Geçerli bir tarih girin",cardCVC:"CVC",cardCVCError:"Geçerli bir güvenlik kodu girin",cardCVCTooltip:"Kartınızın arkasındaki 3 haneli güvenlik kodu",masterPass:{paymentGatewaySelectBox:{delete:"Sil"},creditCardForm:{checkboxLabel:"Kartımı {{ masterPassLogo }} altyapısında saklamak istiyorum.",cardName:"Kart İsmi",phoneNumber:"Telefon Numarası",button:"Onay Kodu Gönder"},linkCardToClientModal:{text:"MasterPass’e kayıtlı kartınız bulunmaktadır. Kartınızı alışverişinizde kullanmak için TAMAM’a tıklayınız.",buttonText:"Tamam",subInfoText:"Bu aşamada kartınızdan tahsilat yapılmayacaktır."},otpModal:{otpTextBank:"Bankanız tarafından gönderilen SMS doğrulama kodunu giriniz.",otpTextMasterPass:"Masterpass tarafından gönderilen SMS doğrulama kodunu giriniz.",countdownText:"Kalan Süre: ",resendText:"Yeni kod gönder",inputLabel:"Doğrulama Kodunu Giriniz",buttonText:"Doğrula"},successModal:{otpSuccessText:"Kartınız başarılı bir şekilde tanımlandı.",linkCardToClientSuccessText:"Masterpass hesabınız başarılı bir şekilde doğrulandı."}},errorCustomerRequired:"Bu e-posta adresine ait kayıtlı bir hesap bulunuyor. Lütfen hesabınıza giriş yapınız.",errorNoShipping:"Bulunduğunuz konuma gönderim yapılmamaktadır.",errorPayment:"Ödemeniz alınamadı. Lütfen bilgilerinizi kontrol edip tekrar deneyin.",errorStockTitle:"Stoklar Güncellendi!",errorStockDescription:"Sepetinizdeki bazı ürünlerin stoğu tükenmiştir. Bu ürünleri sepetinizden çıkararak devam etmek ister misiniz?",errorUnknown:"Beklenmedik bir hata oluştu. Lütfen tekrar deneyin.",errorPickupLocationRequired:"Teslim alınacak konumu seçin",customizedProduct:"Kişiselleştirilmiş Ürün",yes:"Evet",no:"Hayır"};export{e as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as s}from"mobx-react-lite";import t from"../../style.module.scss.js";import r from"../select-box/index.js";import{AddressForm as d}from"../address-form/index.js";import{Checkbox as o}from"../checkbox/index.js";import{FormItem as a}from"../form-item/index.js";import{FormItemType as i}from"../form-item/model.js";import n from"./style.module.scss.js";import l from"../../styles/common.module.scss.js";import{Button as c}from"../button/index.js";import{IkasStorefrontConfig as m}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{useTranslation as u}from"../../../../utils/i18n.js";import v from"../delivery-methods/index.js";import{CheckoutStep as p}from"../../model.js";var h=s((function(s){var d,o=s.vm,a=u().t,i=e.useMemo((function(){return e.createElement("div",null,e.createElement(g,{vm:o}),e.createElement(C,{vm:o}))}),[o]),h=e.useMemo((function(){return e.createElement("div",null,e.createElement(E,{vm:o}))}),[o]),k=e.useState("-1"),f=k[0],A=k[1];e.useEffect((function(){o.vm.checkout.stockLocationId&&A(o.vm.checkout.stockLocationId)}),[]);var y=function(e){if(!e.address)return"";var s=[];return e.address.address&&s.push(e.address.address),e.address.postalCode&&s.push(e.address.postalCode),e.address.district&&e.address.district.name&&s.push(e.address.district.name),e.address.city&&e.address.city.name&&s.push(e.address.city.name),e.address.state&&e.address.state.name&&"Default"!==e.address.state.name&&s.push(e.address.state.name),e.address.country&&e.address.country.name&&s.push(e.address.country.name),s.join(", ")};return e.createElement(e.Fragment,null,!!m.pickUpStockLocationIds&&o.vm.availableStockLocations.length>0&&o.vm.step!==p.PAYMENT&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},a("checkout-page:deliveryMethod"))),e.createElement(v,{deliveryMethod:o.vm.deliveryMethod,onClick:function(e){"address"===e&&A("-1"),o.vm.onDeliveryMethodChange(e)}})),e.createElement("div",{className:l.FormSectionTitle},"address"===o.vm.deliveryMethod?e.createElement("div",{className:l.Title},o.editingCustomerAddress?a("checkout-page:editAddress"):"billing"===o.addressType?a("checkout-page:billingAddress"):a("checkout-page:shippingAddress")):e.createElement("div",{className:l.Title},a("checkout-page:pickUpLocation"),e.createElement("span",{className:n.ErrorMessage},o.vm.isErrorsVisible&&!o.vm.checkout.stockLocationId&&a("checkout-page:errorPickupLocationRequired"))),!!o.editingCustomerAddress&&e.createElement("div",{className:n.CancelEdit,onClick:o.onCancelEditAddressClick},a("checkout-page:actions.cancel"))),!!o.vm.store.customerStore.customer&&!o.editingCustomerAddress&&"address"===o.vm.deliveryMethod&&e.createElement("div",{className:t.RowPB},null===(d=o.vm.store.customerStore.customer.addresses)||void 0===d?void 0:d.map((function(s){return e.createElement(r,{key:s.id,label:s.title||"",isSelected:s.id===o.selectedAddressId,rightContent:e.createElement("div",{onClick:function(){return o.onEditAddressClick(s)}},a("checkout-page:actions.edit")),bottomContent:e.createElement("div",{className:n.AddressText},s.addressText),bottomContentVisible:!0,hasError:!s.isValid,errorText:a("checkout-page:missingAddressFields"),onClick:function(){return s.id!==o.selectedAddressId&&o.onAddressSelect(s)}})})),e.createElement(r,{label:a("checkout-page:newAddress"),isSelected:"-1"===o.selectedAddressId,bottomContent:i,onClick:function(){return"-1"!==o.selectedAddressId&&o.onAddressSelect()}})),!o.vm.store.customerStore.customer&&"address"===o.vm.deliveryMethod&&i,"in-store"===o.vm.deliveryMethod&&e.createElement("div",{className:t.RowPB},o.vm.stockLocations.map((function(s){return function(e){return e.address&&e.address.address&&e.address.city&&e.address.country&&o.vm.availableStockLocations.find((function(s){return s.id===e.id}))}(s)&&e.createElement(r,{key:s.id,label:s.name||"",isSelected:f===s.id,bottomContent:e.createElement("div",null,e.createElement("div",{className:n.AddressText},y(s)),s.deliveryTime&&e.createElement("div",{className:n.DeliveryTime},a("checkout-page:stockLocation.deliveryTime.".concat(s.deliveryTime)))),bottomContentVisible:!0,onClick:function(){o.vm.onStockLocationChange(s),A(s.id)}})}))),"in-store"===o.vm.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},a("checkout-page:recipientsInfo"))),h),!!o.editingCustomerAddress&&e.createElement(g,{vm:o}),!!o.editingCustomerAddress&&e.createElement("div",{className:n.EditAddressActions},e.createElement(c,{style:{width:"100%"},text:a("checkout-page:deleteAddress"),isLine:!0,isLoading:o.isDeleteAddressLoading,isDisabled:o.isEditAddressLoading,onClick:o.onDeleteAddressClick}),e.createElement(c,{style:{width:"100%",marginTop:o.vm.store.customerStore.customer?"0px":"32px"},text:a("checkout-page:actions.save"),isLoading:o.isEditAddressLoading,isDisabled:o.isDeleteAddressLoading,onClick:o.onSaveAddressClick})))})),g=s((function(s){var t=s.vm;return e.createElement(d,{address:t.editingCustomerAddress||t.address,isErrorsVisible:t.isEditAddressErrorsVisible||t.vm.isErrorsVisible,allowedCountryIds:t.vm.shippingCountryIds||void 0,allowCorporateInfo:"billing"===t.addressType,firstNameChangeCallback:t.firstNameChangeCallback,lastNameChangeCallback:t.lastNameChangeCallback,allowTitleChange:!!t.editingCustomerAddress,deliveryMethod:"address"})})),E=s((function(s){var t=s.vm;return e.createElement(d,{address:t.editingCustomerAddress||t.address,isErrorsVisible:t.isEditAddressErrorsVisible||t.vm.isErrorsVisible,firstNameChangeCallback:t.firstNameChangeCallback,lastNameChangeCallback:t.lastNameChangeCallback,deliveryMethod:"in-store"})})),C=s((function(s){var t=s.vm,r=u().t;return t.vm.store.customerStore.customer&&"-1"===t.selectedAddressId?e.createElement("div",{style:{marginTop:"12px"}},e.createElement(o,{value:t.vm.shouldSaveAddress,label:r("checkout-page:saveAddressCta"),onChange:t.vm.setShouldSaveAddress}),t.vm.shouldSaveAddress&&e.createElement("div",{style:{marginTop:"8px"}},e.createElement(a,{type:i.TEXT,label:r("checkout-page:addressTitle"),value:t.vm.addressTitle,onChange:t.vm.setAddressTitle}))):null}));export{g as CustomerAddressForm,E as RecipientForm,C as SaveAddressCheckboxAndTitle,h as default};
1
+ import*as e from"react";import{observer as s}from"mobx-react-lite";import t from"../../style.module.scss.js";import r from"../select-box/index.js";import{AddressForm as d}from"../address-form/index.js";import{Checkbox as a}from"../checkbox/index.js";import{FormItem as i}from"../form-item/index.js";import{FormItemType as o}from"../form-item/model.js";import n from"./style.module.scss.js";import l from"../../styles/common.module.scss.js";import{Button as c}from"../button/index.js";import{IkasStorefrontConfig as m}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{useTranslation as u}from"../../../../utils/i18n.js";import v from"../delivery-methods/index.js";import{CheckoutStep as p}from"../../model.js";var h=s((function(s){var d,a=s.vm,i=u().t,o=e.useMemo((function(){return e.createElement("div",null,e.createElement(g,{vm:a}),e.createElement(k,{vm:a}))}),[a]),h=e.useMemo((function(){return e.createElement("div",null,e.createElement(E,{vm:a}))}),[a]),C=e.useState("-1"),f=C[0],A=C[1];e.useEffect((function(){a.vm.checkout.stockLocationId&&A(a.vm.checkout.stockLocationId)}),[]);var b=function(e){if(!e.address)return"";var s=[];return e.address.address&&s.push(e.address.address),e.address.postalCode&&s.push(e.address.postalCode),e.address.district&&e.address.district.name&&s.push(e.address.district.name),e.address.city&&e.address.city.name&&s.push(e.address.city.name),e.address.state&&e.address.state.name&&"Default"!==e.address.state.name&&s.push(e.address.state.name),e.address.country&&e.address.country.name&&s.push(e.address.country.name),s.join(", ")};return e.createElement(e.Fragment,null,!!m.pickUpStockLocationIds&&a.vm.availableStockLocations.length>0&&a.vm.step!==p.PAYMENT&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},i("checkout-page:deliveryMethod"))),e.createElement(v,{deliveryMethod:a.vm.deliveryMethod,onClick:function(e){"address"===e&&A("-1"),a.vm.onDeliveryMethodChange(e)}})),e.createElement("div",{className:l.FormSectionTitle},"address"===a.vm.deliveryMethod?e.createElement("div",{className:l.Title},a.editingCustomerAddress?i("checkout-page:editAddress"):"billing"===a.addressType?i("checkout-page:billingAddress"):i("checkout-page:shippingAddress")):a.vm.step===p.PAYMENT?e.createElement("div",{className:l.Title},i("checkout-page:billingAddress")):e.createElement("div",{className:l.Title},i("checkout-page:pickUpLocation"),e.createElement("span",{className:n.ErrorMessage},a.vm.isErrorsVisible&&!a.vm.checkout.stockLocationId&&i("checkout-page:errorPickupLocationRequired"))),!!a.editingCustomerAddress&&e.createElement("div",{className:n.CancelEdit,onClick:a.onCancelEditAddressClick},i("checkout-page:actions.cancel"))),!!a.vm.store.customerStore.customer&&!a.editingCustomerAddress&&"address"===a.vm.deliveryMethod&&e.createElement("div",{className:t.RowPB},null===(d=a.vm.store.customerStore.customer.addresses)||void 0===d?void 0:d.map((function(s){return e.createElement(r,{key:s.id,label:s.title||"",isSelected:s.id===a.selectedAddressId,rightContent:e.createElement("div",{onClick:function(){return a.onEditAddressClick(s)}},i("checkout-page:actions.edit")),bottomContent:e.createElement("div",{className:n.AddressText},s.addressText),bottomContentVisible:!0,hasError:!s.isValid,errorText:i("checkout-page:missingAddressFields"),onClick:function(){return s.id!==a.selectedAddressId&&a.onAddressSelect(s)}})})),e.createElement(r,{label:i("checkout-page:newAddress"),isSelected:"-1"===a.selectedAddressId,bottomContent:o,onClick:function(){return"-1"!==a.selectedAddressId&&a.onAddressSelect()}})),a.vm.store.customerStore.customer||a.vm.step!==p.INFO||"address"!==a.vm.deliveryMethod?a.vm.step===p.PAYMENT&&o:o,"in-store"===a.vm.deliveryMethod&&e.createElement("div",{className:t.RowPB},a.vm.stockLocations.map((function(s){return function(e){return e.address&&e.address.address&&e.address.city&&e.address.country&&a.vm.availableStockLocations.find((function(s){return s.id===e.id}))}(s)&&e.createElement(r,{key:s.id,label:s.name||"",isSelected:f===s.id,bottomContent:e.createElement("div",null,e.createElement("div",{className:n.AddressText},b(s)),s.deliveryTime&&e.createElement("div",{className:n.DeliveryTime},i("checkout-page:stockLocation.deliveryTime.".concat(s.deliveryTime)))),bottomContentVisible:!0,onClick:function(){a.vm.onStockLocationChange(s),A(s.id)}})}))),"in-store"===a.vm.deliveryMethod&&a.vm.step!==p.PAYMENT&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},i("checkout-page:recipientsInfo"))),h),!!a.editingCustomerAddress&&e.createElement(g,{vm:a}),!!a.editingCustomerAddress&&e.createElement("div",{className:n.EditAddressActions},e.createElement(c,{style:{width:"100%"},text:i("checkout-page:deleteAddress"),isLine:!0,isLoading:a.isDeleteAddressLoading,isDisabled:a.isEditAddressLoading,onClick:a.onDeleteAddressClick}),e.createElement(c,{style:{width:"100%",marginTop:a.vm.store.customerStore.customer?"0px":"32px"},text:i("checkout-page:actions.save"),isLoading:a.isEditAddressLoading,isDisabled:a.isDeleteAddressLoading,onClick:a.onSaveAddressClick})))})),g=s((function(s){var t=s.vm;return e.createElement(d,{address:t.editingCustomerAddress||t.address,isErrorsVisible:t.isEditAddressErrorsVisible||t.vm.isErrorsVisible,allowedCountryIds:t.vm.shippingCountryIds||void 0,allowCorporateInfo:"billing"===t.addressType,firstNameChangeCallback:t.firstNameChangeCallback,lastNameChangeCallback:t.lastNameChangeCallback,allowTitleChange:!!t.editingCustomerAddress,deliveryMethod:"address"})})),E=s((function(s){var t=s.vm;return e.createElement(d,{address:t.editingCustomerAddress||t.address,isErrorsVisible:t.isEditAddressErrorsVisible||t.vm.isErrorsVisible,firstNameChangeCallback:t.firstNameChangeCallback,lastNameChangeCallback:t.lastNameChangeCallback,deliveryMethod:"in-store"})})),k=s((function(s){var t=s.vm,r=u().t;return t.vm.store.customerStore.customer&&"-1"===t.selectedAddressId?e.createElement("div",{style:{marginTop:"12px"}},e.createElement(a,{value:t.vm.shouldSaveAddress,label:r("checkout-page:saveAddressCta"),onChange:t.vm.setShouldSaveAddress}),t.vm.shouldSaveAddress&&e.createElement("div",{style:{marginTop:"8px"}},e.createElement(i,{type:o.TEXT,label:r("checkout-page:addressTitle"),value:t.vm.addressTitle,onChange:t.vm.setAddressTitle}))):null}));export{g as CustomerAddressForm,E as RecipientForm,k as SaveAddressCheckboxAndTitle,h as default};
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import CheckoutViewModel from "src/components/checkout/model";
2
3
  declare type Props = {
3
4
  visible: boolean;
4
- onButtonClick: () => void;
5
+ vm: CheckoutViewModel;
5
6
  onClose: () => void;
6
7
  };
7
- declare const ModalLinkCardToClient: (({ visible, onClose, onButtonClick }: Props) => JSX.Element) & {
8
+ declare const ModalLinkCardToClient: (({ visible, onClose, vm }: Props) => JSX.Element) & {
8
9
  displayName: string;
9
10
  };
10
11
  export default ModalLinkCardToClient;
@@ -1 +1 @@
1
- import e from"react";import{observer as t}from"mobx-react-lite";import o from"../modal/index.js";import s from"./svg/master-pass-by-master-card-big.js";import r from"./svg/info-mark.js";import a from"./style.module.scss.js";import{Button as l}from"../../button/index.js";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 m}from"../../../../../utils/i18n.js";var n=t((function(t){var n=t.visible,i=t.onClose,d=t.onButtonClick,p=m().t;return e.createElement(o,{visible:n,onClose:i},e.createElement("div",null,e.createElement("div",{className:a.Wrapper}),e.createElement("span",{className:a.Logo,"data-marginBottom":!0},e.createElement(s,null)),e.createElement("p",{className:a.LinkCardText},p("checkout-page:masterPass.otpModal.linkCardToClientText")),e.createElement(l,{text:p("checkout-page:masterPass.otpModal.linkCardToClient.subInfoText"),onClick:d}),e.createElement("p",null,e.createElement("span",null,e.createElement(r,null)),p("checkout-page:masterPass.otpModal.linkCardToClientSubInfoText"))))}));export{n as default};
1
+ import e,{useState as t}from"react";import{observer as o}from"mobx-react-lite";import s from"../modal/index.js";import r from"./svg/master-pass-by-master-card-big.js";import a from"./svg/info-mark.js";import n from"./style.module.scss.js";import{Button as l}from"../../button/index.js";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 m}from"../../../../../utils/i18n.js";var i=o((function(o){var i=o.visible,c=o.onClose,d=o.vm,u=m().t,p=t(!1),f=p[0],b=p[1],j="checkout-page:masterPass.linkCardToClientModal";return e.createElement(s,{visible:i,onClose:c},e.createElement("div",null,e.createElement("div",{className:n.Logo,"data-mb":!0},e.createElement(r,null)),e.createElement("p",{className:n.Text},u("".concat(j,".text"))),e.createElement(l,{style:{width:"100%"},text:u("".concat(j,".buttonText")),isLoading:f,isDisabled:f,onClick:function(){b(!0),d.mpVM.onLinkCardToClientButtonClick({cartId:d.checkout.id,checkout:d.checkout,store:d.store,callback:function(){b(!1)}})}}),e.createElement("p",{className:n.SubInfoText},e.createElement("span",null,e.createElement(a,null)),u("".concat(j,".subInfoText")))))}));export{i as default};
@@ -1 +1 @@
1
- import n from'../../../../../ext/style-inject/dist/style-inject.es.js';var e={Wrapper:"style-module_Wrapper__28R5h",Logo:"style-module_Logo__27F3L",LinkCardText:"style-module_LinkCardText__2PMZT",LinkCardSubInfoText:"style-module_LinkCardSubInfoText__ZsNKo",Text:"style-module_Text__3ar44",Countdown:"style-module_Countdown__1TfKg",ModalFooter:"style-module_ModalFooter__tlLYQ"};n(".style-module_Wrapper__28R5h {\n display: flex;\n}\n\n.style-module_Logo__27F3L[data-marginRight] {\n margin-right: 16px;\n}\n\n.style-module_Logo__27F3L[data-marginBottom] {\n margin-bottom: 16px;\n}\n\n.style-module_LinkCardText__2PMZT {\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__ZsNKo {\n font-size: 14px;\n line-height: 20px;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_LinkCardSubInfoText__ZsNKo span {\n display: inline-block;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n}\n\n.style-module_Text__3ar44 {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n}\n\n.style-module_Countdown__1TfKg {\n font-size: 14px;\n line-height: 20px;\n font-weight: 600;\n margin: 24px 0;\n}\n\n.style-module_ModalFooter__tlLYQ {\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 12px 0;\n}");export{e as default};
1
+ import e from'../../../../../ext/style-inject/dist/style-inject.es.js';var t={Logo:"style-module_Logo__27F3L",Text:"style-module_Text__3ar44",SubInfoText:"style-module_SubInfoText__3qW0t"};e(".style-module_Logo__27F3L[data-mb] {\n margin-bottom: 16px;\n}\n\n.style-module_Text__3ar44 {\n font-size: 16px;\n line-height: 24px;\n color: var(--checkout-secondary-text-color);\n margin-bottom: 32px;\n}\n\n.style-module_SubInfoText__3qW0t {\n margin-top: 12px;\n font-size: 14px;\n line-height: 20px;\n text-align: center;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_SubInfoText__3qW0t span {\n display: inline-block;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n}");export{t as default};
@@ -8,11 +8,3 @@ 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{__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
+ import e,{useRef as t,useState as o,useEffect as a}from"react";import{observer as n}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 c}from"../../form-item/index.js";import{FormItemType as m}from"../../form-item/model.js";import l from"../modal/index.js";import i from"./svg/master-pass.js";import p from"./style.module.scss.js";var u=n((function(n){var u=n.visible,d=n.type,f=n.vm,h=n.onClose,v=s().t,b=t(),k=o(180),g=k[0],x=k[1],M=o(""),y=M[0],E=M[1],j=o(!1),P=j[0],T=j[1],C=o(!1),O=C[0],w=C[1],N=function(){if(!O&&y&&f.checkout.selectedPaymentGateway){w(!0),f.mpVM.onOtpFormSubmit({cartId:f.checkout.id,validationCode:y,paymentGateway:f.checkout.selectedPaymentGateway,store:f.store,checkout:f.checkout,callback:function(){w(!1),E(""),V()}})}},V=function(){x(0)},I=function(){x(180)};a((function(){if(!(g<1&&b.current))return b.current&&clearInterval(b.current),b.current=setInterval((function(){x(g-1)}),1e3),function(){b.current&&clearInterval(b.current)};clearInterval(b.current)}),[g]);var R,_,G,L,A,B,S=e.createElement("div",null,e.createElement("div",{className:p.Wrapper},"masterPassOtp"===d&&e.createElement("span",{"data-mr":!0,className:p.Logo},e.createElement(i,null)),e.createElement("p",{className:p.Text},v("masterPassOtp"===d?"checkout-page:masterPass.otpModal.otpTextMasterPass":"checkout-page:masterPass.otpModal.otpTextBank"))),e.createElement("div",{className:p.Countdown},v("checkout-page:masterPass.otpModal.countdownText"),e.createElement("strong",null,(R=g%3600,_=Math.floor(R/60),G=R%60,L=Math.ceil(G),A=_<10?"0".concat(_):_,B=L<10?"0".concat(L):L,"".concat(A,":").concat(B)))),f.mpVM.otpResponse.text&&e.createElement("div",{role:"error"===f.mpVM.otpResponse.status?"alert":"",className:p.OtpResponseText},f.mpVM.otpResponse.text),e.createElement("form",{onSubmit:function(e){e.preventDefault(),N()}},e.createElement(c,{type:m.TEXT,label:v("checkout-page:masterPass.otpModal.inputLabel"),name:"validationCode",rightContent:f.mpVM.isOtpFormSubmitAtLeastOnce?e.createElement("button",{type:"button",className:p.ResendButton,disabled:P,onClick:function(e){e.stopPropagation(),P||(T(!0),f.mpVM.resendOtp({store:f.store,checkout:f.checkout,callback:function(){T(!1),I(),E("")}}))}},v("checkout-page:masterPass.otpModal.resendText")):void 0,value:y,onChange:function(e){E(e)}}),e.createElement(r,{type:"submit",style:{width:"100%",marginTop:"16px"},text:v("checkout-page:masterPass.otpModal.buttonText"),isLoading:O,isDisabled:!y,onClick:N})));return a((function(){u?x(180):V()}),[u]),console.log("calisti modal",u),e.createElement(l,{visible:u,onClose:h},S)}));export{u 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 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};
1
+ import e from'../../../../../ext/style-inject/dist/style-inject.es.js';var n={Wrapper:"style-module_Wrapper__3h_6O",Logo:"style-module_Logo__uFuAV",Text:"style-module_Text__3rYej",Countdown:"style-module_Countdown__2znZ9",OtpResponseText:"style-module_OtpResponseText__2AnTl",ResendButton:"style-module_ResendButton__1gENj"};e(".style-module_Wrapper__3h_6O {\n display: flex;\n padding-right: 24px;\n}\n\n.style-module_Logo__uFuAV[data-mr] {\n margin-right: 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 color: var(--checkout-primary-text-color);\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_OtpResponseText__2AnTl {\n color: var(--checkout-primary-text-color);\n font-size: 14px;\n line-height: 20px;\n text-align: center;\n margin-bottom: 24px;\n}\n.style-module_OtpResponseText__2AnTl[data-role=error] {\n color: var(--checkout-error-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{n as default};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare type SuccessModalType = "register" | "linkCardToClient";
3
+ declare type Props = {
4
+ visible: boolean;
5
+ type: SuccessModalType;
6
+ onClose: () => void;
7
+ };
8
+ declare const ModalSuccess: (({ visible, type, onClose }: Props) => JSX.Element) & {
9
+ displayName: string;
10
+ };
11
+ export default ModalSuccess;
@@ -0,0 +1 @@
1
+ import e from"react";import{observer as s}from"mobx-react-lite";import t from"../modal/index.js";import o from"./svg/success.js";import r from"./svg/master-pass-by-master-card-small.js";import a from"./style.module.scss.js";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 l}from"../../../../../utils/i18n.js";var m=s((function(s){var m=s.visible,i=s.type,c=s.onClose,n=l().t,d=e.createElement("div",{className:a.Wrapper},e.createElement("span",{"data-mr":!0,className:a.Logo},e.createElement(o,null)),e.createElement("p",{className:a.Text},"linkCardToClient"===i&&n("checkout-page:masterPass.successModal.linkCardToClientSuccessText"),"register"===i&&n("checkout-page:masterPass.successModal.otpSuccessText"))),p=e.createElement("footer",{className:a.ModalFooter},e.createElement("div",null,e.createElement(r,null)));return e.createElement(t,{visible:m,footer:p,onClose:c},d)}));export{m as default};
@@ -0,0 +1 @@
1
+ import e from'../../../../../ext/style-inject/dist/style-inject.es.js';var o={Wrapper:"style-module_Wrapper__1uOCG",Logo:"style-module_Logo__1RxNM",Text:"style-module_Text__6l3NF",ModalFooter:"style-module_ModalFooter__1xQSh"};e(".style-module_Wrapper__1uOCG {\n display: flex;\n padding-right: 24px;\n margin-bottom: 70px;\n}\n\n.style-module_Logo__1RxNM[data-mr] {\n margin-right: 16px;\n}\n\n.style-module_Text__6l3NF {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n}\n\n.style-module_ModalFooter__1xQSh {\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}");export{o as default};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import 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};
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 m,{CheckoutStep as n}from"./model.js";import{Analytics as l}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 E}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 x}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 y from"./components/master-pass/modal-otp/index.js";import k from"./components/master-pass/modal-link-card-to-client/index.js";import C from"./components/master-pass/modal-response/index.js";import b from"./components/master-pass/modal-success/index.js";import{Image as M}from"../image/index.js";import N,{Step as F}from"./components/step-container/index.js";import{StockError as T}from"./components/error/stock-error/index.js";import{FullscreenLoading as P}from"./components/fullscreen-loading/index.js";import S from"./components/notification-box/index.js";import{FormItem as V}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";import{IkasPageHead as L}from"../page/head.js";import I from"./components/svg/ikas.js";import B from"./style.module.scss.js";var O=r((function(e){var t,r,s,d=e.checkout,u=e.checkoutSettings,v=e.merchantSettings,h=e.customizationProps,x=e.returnPolicy,M=e.privacyPolicy,N=e.termsOfService,F=p().t,S=i(),V=o.useState((function(){return new m(d,u,v,S,x,M,N,F,h||{})}))[0];return V.step===n.PAYMENT&&l.disableHTML(),o.useEffect((function(){V.checkoutSettings.isAccountRequired&&!V.checkout.hasCustomer&&S.push("/account/login?redirect="+encodeURIComponent(V.checkoutUrl)),l.beginCheckout(V.checkout),l.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){V.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]),V.isCheckoutLoaded&&V.store.customerStore.initialized?V.checkout.hasCustomer&&(null===(t=V.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=V.checkout.customer)||void 0===r?void 0:r.id)?(S.push("/account/login?redirect="+encodeURIComponent(V.checkoutUrl)),null):(console.log("vm.mpVM.visibleModal",V.mpVM.visibleModal),o.createElement(o.Fragment,null,o.createElement(L,{pageType:E.CHECKOUT,pageTitle:((null===(s=V.merchantSettings)||void 0===s?void 0:s.merchantName)||"")+" - "+F("checkout-page:securePayment"),pageDescription:F("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:B.CheckoutPage},o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:B.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:B.Left},o.createElement("div",{className:B.LeftContent},o.createElement("div",null,o.createElement(R,{vm:V}),V.hasStockError&&o.createElement("div",{className:B.ErrorContainer},o.createElement(T,{vm:V,error:V.error})),!V.hasStockError&&o.createElement(o.Fragment,null,o.createElement(g,{vm:V,allowExpand:!0}),V.step===n.SUCCESS?o.createElement(f,{vm:V}):o.createElement(U,{vm:V})),o.createElement("div",{className:B.Space})),o.createElement(D,{vm:V}))),o.createElement("div",{className:B.Right},o.createElement("div",{className:B.RightContent},o.createElement(g,{vm:V}),o.createElement("div",{className:B.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===c.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(I,null))))),!!V.policyModalText&&o.createElement(j,{title:V.policyModalTitle,modalContent:V.policyModalText,onClose:function(){V.policyModalText=""}}),V.isContactModalVisible&&o.createElement(G,{vm:V,setVisible:V.setContactModalVisible}),V.mpVM.isLinkCardToClientModalVisible&&o.createElement(k,{visible:V.mpVM.isLinkCardToClientModalVisible,vm:V,onClose:V.mpVM.hideLinkCardToClientModal}),V.mpVM.isOtpModalVisible&&o.createElement(y,{vm:V,visible:V.mpVM.isOtpModalVisible,type:V.mpVM.otpModalType,onClose:V.mpVM.hideOtpModal}),V.mpVM.isResponseModalVisible&&o.createElement(C,{visible:V.mpVM.isResponseModalVisible,text:V.mpVM.mfsResponseModalText,onClose:V.mpVM.onResponseModalClose}),V.mpVM.isSuccessModalVisible&&o.createElement(b,{visible:V.mpVM.isSuccessModalVisible,type:V.mpVM.successModalType,onClose:V.mpVM.onSuccessModalClose})))):o.createElement(P,null)})),R=r((function(e){var t,r,i=e.vm,a=p().t;return o.createElement("div",{className:B.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:B.Logo},o.createElement(M,{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:B.LoginText},o.createElement("span",{className:B.LoginCta},a("checkout-page:alreadyHaveAnAccount")),o.createElement(s,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:B.LoginBtn},a("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:B.CustomerInfo},o.createElement("div",{className:B.Name},i.checkout.customerFullName),o.createElement("div",{className:B.Email},i.checkout.customerEmail)))})),U=r((function(e){var t=e.vm,r=p().t,i=o.useMemo((function(){switch(t.step){case n.INFO:return o.createElement(u,{vm:t});case n.SHIPPING:return o.createElement(v,{vm:t});case n.PAYMENT:return o.createElement(h,{vm:t});case n.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),s=[new F(r("checkout-page:address"),t.step===n.INFO,t.step!==n.INFO,t.step!==n.INFO?o.createElement("div",{className:B.AdressStepInfo},o.createElement(H,{vm:t}),o.createElement("div",{className:B.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==n.INFO?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(H,{vm:t})):void 0),new F(r("checkout-page:payment"),t.step===n.PAYMENT,!1)];return"address"===t.deliveryMethod&&s.splice(1,0,new F(r("checkout-page:shipping"),t.step===n.SHIPPING,t.step===n.PAYMENT,t.step===n.PAYMENT?o.createElement("div",{className:B.AdressStepInfo},o.createElement(_,{vm:t}),t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:B.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===n.PAYMENT?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(_,{vm:t})):void 0)),o.createElement(N,{steps:s,stepContent:i})})),H=r((function(e){var t,r,i,s,a,m=e.vm,n=p().t,l=((null===(t=m.checkout.shippingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=m.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:B.Address},o.createElement("div",{className:[B.Text,B.WithMBottom].join(" ")},(null===(i=m.checkout.customer)||void 0===i?void 0:i.email)||""),"address"===m.deliveryMethod?o.createElement("div",{className:B.Text},l):o.createElement(o.Fragment,null,o.createElement("div",{className:B.Text},n("checkout-page:receiver")),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},l)),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},null===(s=m.checkout.shippingAddress)||void 0===s?void 0:s.phone),"in-store"===m.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[B.Text,B.WithMTop].join(" ")},n("checkout-page:pickUpLocation"))),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},null===(a=m.checkout.shippingAddress)||void 0===a?void 0:a.addressText))})),_=r((function(e){var t=e.vm,r=p().t;return o.createElement("div",{className:B.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:B.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):d(t.checkout.shippingLines[0].price,t.checkout.currencyCode)))):r("checkout-page:standartShipping"))})),D=r((function(e){var t=e.vm,r=p().t;return o.createElement("div",{className:B.Footer},o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),G=r((function(r){var i,s,a=r.vm,m=r.setVisible,n=p().t,l=o.useState(!1),c=l[0],d=l[1],u=o.useState(!1),v=u[0],h=u[1],g=o.useState(new x({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 E=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,m(!1)]:(d(!0),[4,g.saveContactForm()]);case 1:return e.sent()&&h(!0),d(!1),[2]}}))}))}),[c]);return o.createElement(j,{title:n("checkout-page:contactForm"),modalContent:o.createElement("div",null,v&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(S,{type:"success",title:n("checkout-page:contactFormSent"),content:n("checkout-page:contactFormDescription")})),o.createElement(V,{type:A.TEXT_AREA,label:"",value:g.message||"",onChange:g.onMessageChange,textAreaPlaceholder:n("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:n(v?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:c,isDisabled:!g.message,onClick:E})),onClose:function(){return m(!1)}})}));export{O as default};
@@ -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+$/,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};
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,w,j=/^\d+$/,N="undefined"==typeof localStorage,R=function(){function j(j,R,T,D,O,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,d;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:w.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===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==A.PAYMENT&&this.step!==A.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:w.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:w.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===A.PAYMENT&&this.isInStoreDelivery&&(this.checkout.billingAddress=new a),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:w.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:w.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),[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:w.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:w.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:w.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:w.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:w.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:w.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:w.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.isInStoreDelivery?U.checkout.billingAddress=new a(n(U.checkout.billingAddress)||{}):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:w.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:w.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:w.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:w.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=j,this.checkoutSettings=R,this.router=D,this.returnPolicy=O,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(j.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"selectedInstallmentIndex",{get:function(){var t,e,i=this;return(null===(e=null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices)||void 0===e?void 0:e.findIndex((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=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(j.prototype,"installmentPrice",{get:function(){var t,e,i,s=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(i=null===(e=this.installmentInfo.installmentPrices)||void 0===e?void 0:e.find((function(t){var e;return t.installmentCount===(null===(e=s.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"finalPrice",{get:function(){return this.step===A.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===w.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToShipping",{get:function(){var t,e;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)!==w.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"isCustomFlowStripe",{get:function(){var t,e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(t){return"allow_custom_flow"===t.label&&"true"===t.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid),r=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===k.CREDIT_CARD&&i.type===b.INTERNAL?!!this.isCustomFlowStripe||(null===(e=this.cardData)||void 0===e?void 0:e.isValid):!!i);return s&&n&&r},enumerable:!1,configurable:!0}),j}();function x(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function E(t){return t&&j.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"}(w||(w={}));export{A as CheckoutStep,w as ErrorType,R as default};