@ikas/storefront 3.0.0-alpha.27 → 3.0.0-alpha.29

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 (32) hide show
  1. package/build/__api/models/CreateStripePaymentIntentResponse.d.ts +12 -0
  2. package/build/__api/models/CreateStripePaymentIntentResponse.js +1 -0
  3. package/build/__api/mutations/createStripePaymentIntent.d.ts +13 -0
  4. package/build/__api/mutations/createStripePaymentIntent.js +1 -0
  5. package/build/__api/types/index.d.ts +6 -0
  6. package/build/_virtual/index.js_commonjs-proxy13.js +1 -1
  7. package/build/_virtual/index.js_commonjs-proxy14.js +1 -1
  8. package/build/_virtual/index.js_commonjs-proxy2.js +1 -1
  9. package/build/_virtual/index.js_commonjs-proxy4.js +1 -1
  10. package/build/assets/translations/checkout/en.js +1 -1
  11. package/build/assets/translations/checkout/tr.js +1 -1
  12. package/build/components/checkout/components/stripe/checkout-form.d.ts +8 -0
  13. package/build/components/checkout/components/stripe/checkout-form.js +1 -0
  14. package/build/components/checkout/components/stripe/index.d.ts +9 -0
  15. package/build/components/checkout/components/stripe/index.js +1 -0
  16. package/build/components/checkout/index.js +1 -1
  17. package/build/components/checkout/model.d.ts +3 -1
  18. package/build/components/checkout/model.js +1 -1
  19. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  20. package/build/components/checkout/steps/step-success/index.js +1 -1
  21. package/build/components/checkout/steps/step-success/style.module.scss.js +1 -1
  22. package/build/ext/@stripe/react-stripe-js/dist/react-stripe.esm.js +1 -0
  23. package/build/ext/@stripe/stripe-js/dist/stripe.esm.js +1 -0
  24. package/build/ikas.cjs +1 -1
  25. package/build/models/data/order/index.js +1 -1
  26. package/build/providers/page-data-next.d.ts +4 -0
  27. package/build/providers/page-data-next.js +1 -1
  28. package/build/scripts/generators/config/content.js +1 -1
  29. package/build/store/checkout/index.d.ts +3 -0
  30. package/build/store/checkout/index.js +1 -1
  31. package/build/store/customer/index.js +1 -1
  32. package/package.json +3 -1
@@ -0,0 +1,12 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ export declare class CreateStripePaymentIntentResponseData {
3
+ accountId: string;
4
+ apiKey: string;
5
+ callbackUrl: string;
6
+ clientSecret: string;
7
+ constructor(data?: Partial<CreateStripePaymentIntentResponseData>);
8
+ }
9
+ export declare class CreateStripePaymentIntentResponse extends CreateStripePaymentIntentResponseData {
10
+ }
11
+ export declare type PartialCreateStripePaymentIntentResponse = Partial<CreateStripePaymentIntentResponse>;
12
+ export declare type ReadOnlyCreateStripePaymentIntentResponse = DeepReadonly<CreateStripePaymentIntentResponse>;
@@ -0,0 +1 @@
1
+ import{__extends as t}from'../../ext/tslib/tslib.es6.js';import{makeObservable as c,observable as i}from"mobx";var e=function(t){void 0===t&&(t={}),this.accountId=t.accountId||"",this.apiKey=t.apiKey||"",this.callbackUrl=t.callbackUrl||"",this.clientSecret=t.clientSecret||"",c(this,{accountId:i,apiKey:i,callbackUrl:i,clientSecret:i})},l=function(c){function i(){return null!==c&&c.apply(this,arguments)||this}return t(i,c),i}(e);export{l as CreateStripePaymentIntentResponse,e as CreateStripePaymentIntentResponseData};
@@ -0,0 +1,13 @@
1
+ import { ConfigType, APIResponse } from "@ikas/fe-api-client";
2
+ import { CreateSaleTransactionWithCartInput, CreateStripePaymentIntentResponse } from "../types";
3
+ declare const createStripePaymentIntent: (variables: QueryParams, fields?: string[] | undefined, config?: ConfigType | undefined) => Promise<APIResponse<undefined> | APIResponse<CreateStripePaymentIntentResponse>>;
4
+ export default createStripePaymentIntent;
5
+ export declare type QueryParams = {
6
+ input: CreateSaleTransactionWithCartInput;
7
+ };
8
+ export declare enum ResponseField {
9
+ ACCOUNT_ID = "accountId",
10
+ API_KEY = "apiKey",
11
+ CALLBACK_URL = "callbackUrl",
12
+ CLIENT_SECRET = "clientSecret"
13
+ }
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as e}from'../../ext/tslib/tslib.es6.js';import{handleAPIError as n,APIResponse as r}from'../../ext/@ikas/fe-api-client/build/utils/api.js';import a from'../../ext/@ikas/fe-api-client/build/utils/fetch-query.js';var i,c=function(i,c,s){return t(void 0,void 0,void 0,(function(){var t,u,l,p;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a({operationName:"createStripePaymentIntent",config:s,variables:i,allReturnFields:o,fields:c,query:function(t){return"\n\t\t\t\tmutation createStripePaymentIntent (\n\t\t\t\t\t$input: CreateSaleTransactionWithCartInput!,\n\t\t\t\t) {\n\t\t\t\t\tcreateStripePaymentIntent (\n\t\t\t\t\t\tinput: $input,\n\t\t\t\t\t) ".concat(t,"\n\t\t\t\t}\n\t\t\t")}})];case 1:return t=e.sent(),u=t.data,l=t.errors,[2,new r(null==u?void 0:u.createStripePaymentIntent,l)];case 2:return p=e.sent(),[2,n(p)];case 3:return[2]}}))}))},o="{accountId apiKey callbackUrl clientSecret }";!function(t){t.ACCOUNT_ID="accountId",t.API_KEY="apiKey",t.CALLBACK_URL="callbackUrl",t.CLIENT_SECRET="clientSecret"}(i||(i={}));export{i as ResponseField,c as default};
@@ -1108,6 +1108,12 @@ export interface AdditionalPrice {
1108
1108
  name: string;
1109
1109
  type: PaymentGatewayAdditionalPriceTypeEnum;
1110
1110
  }
1111
+ export interface CreateStripePaymentIntentResponse {
1112
+ accountId: string;
1113
+ apiKey: string;
1114
+ callbackUrl: string;
1115
+ clientSecret: string;
1116
+ }
1111
1117
  export interface MasterPassTokenResponse {
1112
1118
  requestReferenceNumber: string;
1113
1119
  timeZone: string;
@@ -1 +1 @@
1
- import e from'../ext/safe-buffer/index.js';export{default}from"../node_modules/safe-buffer/index.js";
1
+ import e from'../ext/inline-style-parser/index.js';export{default}from"../node_modules/inline-style-parser/index.js";
@@ -1 +1 @@
1
- import e from'../ext/inline-style-parser/index.js';export{default}from"../node_modules/inline-style-parser/index.js";
1
+ import e from'../ext/safe-buffer/index.js';export{default}from"../node_modules/safe-buffer/index.js";
@@ -1 +1 @@
1
- import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
1
+ import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
@@ -1 +1 @@
1
- import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
1
+ import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
@@ -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:"Information of Recipients",pickUpLocation:"Pick Up Location",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",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",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şilerin Bilgileri",pickUpLocation:"Teslim Alınacak Konum",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",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",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};
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import CheckoutViewModel from "../../model";
3
+ declare type Props = {
4
+ callbackUrl: string;
5
+ vm: CheckoutViewModel;
6
+ };
7
+ export declare const CheckoutForm: React.FC<Props>;
8
+ export {};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import*as t from"react";import{observer as n}from"mobx-react-lite";import{useStripe as i,useElements as o,PaymentElement as m}from'../../../../ext/@stripe/react-stripe-js/dist/react-stripe.esm.js';var s=n((function(n){var s=n.callbackUrl,a=n.vm,l=i(),c=o();return t.createElement(t.Fragment,null,t.createElement("form",{id:"stripe-form",onSubmit:function(t){return e(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return t.preventDefault(),l&&c&&s?[4,l.confirmPayment({elements:c,confirmParams:{return_url:s}})]:[2];case 1:return e.sent().error&&(a.isStepLoading=!1),[2]}}))}))}},t.createElement(m,null),t.createElement("button",{id:"stripe-form-btn",hidden:!0,disabled:!l})))}));export{s as CheckoutForm};
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import CheckoutViewModel from "../../model";
3
+ import { IkasPaymentGateway } from "src/models/data/payment-gateway";
4
+ declare type Props = {
5
+ vm: CheckoutViewModel;
6
+ pg: IkasPaymentGateway;
7
+ };
8
+ export declare const StripeForm: React.FC<Props>;
9
+ export {};
@@ -0,0 +1 @@
1
+ import{__awaiter as o,__generator as r}from'../../../../ext/tslib/tslib.es6.js';import*as e from"react";import{observer as t}from"mobx-react-lite";import{Elements as i}from'../../../../ext/@stripe/react-stripe-js/dist/react-stripe.esm.js';import{loadStripe as s}from'../../../../ext/@stripe/stripe-js/dist/stripe.esm.js';import{CheckoutForm as n}from"./checkout-form.js";var l=t((function(t){var l,p,a,c,d,u,m,v,b,f=t.vm;if(!f.stripeResponse)return null;var x=e.useState(null),E=x[0],z=x[1];e.useEffect((function(){!function(){o(this,void 0,void 0,(function(){var o;return r(this,(function(r){switch(r.label){case 0:return f.stripeResponse?[4,s(f.stripeResponse.apiKey,{stripeAccount:f.stripeResponse.accountId})]:[3,2];case 1:o=r.sent(),z(o),r.label=2;case 2:return[2]}}))}))}()}),[f.stripeResponse]);var C={clientSecret:f.stripeResponse.clientSecret,appearance:{variables:{borderRadius:"8px"},labels:"floating",rules:{".Input":{lineHeight:"16px",boxShadow:"0 0 0 1px transparent",transition:"padding .1s, border-color .5s, box-shadow .5s",padding:"8px 16px",border:"1px solid ".concat((null===(l=f.customizationProps)||void 0===l?void 0:l.borderColor)||"#E5E4E9")},".Input::placeholder":{fontSize:"14px",color:(null===(p=f.customizationProps)||void 0===p?void 0:p.secondaryTextColor)||"#8A8B94"},".Input:focus":{boxShadow:"0 0 0 1px ".concat((null===(a=f.customizationProps)||void 0===a?void 0:a.buttonBgColor)||"##272727"),borderColor:(null===(c=f.customizationProps)||void 0===c?void 0:c.buttonBgColor)||"##272727"},".Input--invalid":{boxShadow:"0 0 0 1px ".concat((null===(d=f.customizationProps)||void 0===d?void 0:d.errorColor)||"#FB4E4E"),borderColor:(null===(u=f.customizationProps)||void 0===u?void 0:u.errorColor)||"#FB4E4E",color:(null===(m=f.customizationProps)||void 0===m?void 0:m.errorColor)||"#FB4E4E"},".Label":{fontSize:"14px",color:(null===(v=f.customizationProps)||void 0===v?void 0:v.secondaryTextColor)||"#8A8B94"},".Error":{fontSize:"12px",marginTop:"8px",color:(null===(b=f.customizationProps)||void 0===b?void 0:b.errorColor)||"#FB4E4E"}}}};return e.createElement(e.Fragment,null,e.createElement(i,{stripe:E,options:C},e.createElement(n,{callbackUrl:f.stripeResponse.callbackUrl,vm:f})))}));export{l as StripeForm};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import s,{CheckoutStep as a}from"./model.js";import n from"./steps/step-info/index.js";import{CheckoutStepShipping as m}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as c}from"./steps/step-payment/index.js";import{CartSummary as l}from"./components/cart-summary/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"mobx";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as d}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import{ContactForm as u}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{StepSuccess as p}from"./steps/step-success/index.js";import{Modal as v}from"./components/modal/index.js";import h from"./style.module.scss.js";import{IkasPageHead as g}from"../page/head.js";import{Analytics as E}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{Image as x}from"../image/index.js";import f from"next/link.js";import j,{Step as y}from"./components/step-container/index.js";import{IkasStorefrontConfig as k}from"../../storefront/index.js";import'../../ext/lodash/isArguments.js';import'../../ext/lodash/isBuffer.js';import'../../ext/lodash/isTypedArray.js';import'../../ext/lodash/_baseGetTag.js';import{formatMoney as C}from"../../utils/currency.js";import{useTranslation as N}from"../../utils/i18n.js";import{StockError as b}from"./components/error/stock-error/index.js";import F from"./components/svg/ikas.js";import T from'../../ext/react-tooltip/dist/index.es.js';import{FullscreenLoading as P}from"./components/fullscreen-loading/index.js";import S from"./components/notification-box/index.js";import{FormItem as M}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";var I=r((function(e){var t,r,n,m=e.checkout,c=e.checkoutSettings,u=e.merchantSettings,x=e.customizationProps,f=e.returnPolicy,j=e.privacyPolicy,y=e.termsOfService,C=N().t,S=i(),M=o.useState((function(){return new s(m,c,u,S,f,j,y,C,x||{})}))[0];return M.step===a.PAYMENT&&E.disableHTML(),o.useEffect((function(){M.checkoutSettings.isAccountRequired&&!M.checkout.hasCustomer&&S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),E.beginCheckout(M.checkout),E.pageView(d.CHECKOUT)}),[]),o.useEffect((function(){M.customizationProps=x,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(x)}),[x]),M.isCheckoutLoaded&&M.store.customerStore.initialized?M.checkout.hasCustomer&&(null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=M.checkout.customer)||void 0===r?void 0:r.id)?(S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(g,{pageType:d.CHECKOUT,pageTitle:((null===(n=M.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+C("checkout-page:securePayment"),pageDescription:C("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:h.CheckoutPage},o.createElement(T,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:h.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:h.Left},o.createElement("div",{className:h.LeftContent},o.createElement("div",null,o.createElement(B,{vm:M}),M.hasStockError&&o.createElement("div",{className:h.ErrorContainer},o.createElement(b,{vm:M,error:M.error})),!M.hasStockError&&o.createElement(o.Fragment,null,o.createElement(l,{vm:M,allowExpand:!0}),M.step===a.SUCCESS?o.createElement(p,{vm:M}):o.createElement(L,{vm:M})),o.createElement("div",{className:h.Space})),o.createElement(U,{vm:M}))),o.createElement("div",{className:h.Right},o.createElement("div",{className:h.RightContent},o.createElement(l,{vm:M}),o.createElement("div",{className:h.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===k.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(F,null))))),!!M.policyModalText&&o.createElement(v,{title:M.policyModalTitle,modalContent:M.policyModalText,onClose:function(){M.policyModalText=""}}),M.isContactModalVisible&&o.createElement(H,{vm:M,setVisible:M.setContactModalVisible}))):o.createElement(P,null)})),B=r((function(e){var t,r,i=e.vm,s=N().t;return o.createElement("div",{className:h.Header},o.createElement(f,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=i.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:h.Logo},o.createElement(x,{layout:"fill",image:i.merchantSettings.logo,sizes:"360px"})):(null===(r=i.merchantSettings)||void 0===r?void 0:r.merchantName)||"")),!i.checkout.hasCustomer&&o.createElement("div",{className:h.LoginText},o.createElement("span",{className:h.LoginCta},s("checkout-page:alreadyHaveAnAccount")),o.createElement(f,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:h.LoginBtn},s("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:h.CustomerInfo},o.createElement("div",{className:h.Name},i.checkout.customerFullName),o.createElement("div",{className:h.Email},i.checkout.customerEmail)))})),L=r((function(e){var t=e.vm,r=N().t,i=o.useMemo((function(){switch(t.step){case a.INFO:return o.createElement(n,{vm:t});case a.SHIPPING:return o.createElement(m,{vm:t});case a.PAYMENT:return o.createElement(c,{vm:t});case a.SUCCESS:return o.createElement(p,{vm:t})}}),[t,t.step]),s=[new y(r("checkout-page:address"),t.step===a.INFO,t.step!==a.INFO,t.step!==a.INFO?o.createElement("div",{className:h.AdressStepInfo},o.createElement(O,{vm:t}),o.createElement("div",{className:h.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==a.INFO?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(O,{vm:t})):void 0),new y(r("checkout-page:payment"),t.step===a.PAYMENT,!1)];return"address"===t.deliveryMethod&&s.splice(1,0,new y(r("checkout-page:shipping"),t.step===a.SHIPPING,t.step===a.PAYMENT,t.step===a.PAYMENT?o.createElement("div",{className:h.AdressStepInfo},o.createElement(R,{vm:t}),t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:h.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===a.PAYMENT?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(R,{vm:t})):void 0)),o.createElement(j,{steps:s,stepContent:i})})),O=r((function(e){var t,r,i,s,a,n=e.vm,m=N().t;return o.createElement("div",{className:h.Address},o.createElement("div",{className:[h.Text,h.WithMBottom].join(" ")},(null===(t=n.checkout.customer)||void 0===t?void 0:t.email)||""),o.createElement("div",{className:h.Text},((null===(r=n.checkout.customer)||void 0===r?void 0:r.firstName)||"")+" "+((null===(i=n.checkout.customer)||void 0===i?void 0:i.lastName)||"")),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(s=n.checkout.shippingAddress)||void 0===s?void 0:s.phone),"in-store"===n.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[h.Text,h.WithMTop].join(" ")},m("checkout-page:pickUpLocation"))),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(a=n.checkout.shippingAddress)||void 0===a?void 0:a.addressText))})),R=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:h.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):C(t.checkout.shippingLines[0].price,t.checkout.currencyCode)))):r("checkout-page:standartShipping"))})),U=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Footer},o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),H=r((function(r){var i,s,a=r.vm,n=r.setVisible,m=N().t,c=o.useState(!1),l=c[0],d=c[1],p=o.useState(!1),h=p[0],g=p[1],E=o.useState(new u({message:{requiredRule:"",emailRule:"",minRule:""},store:a.store}))[0];E.email=a.checkout.customerEmail,E.firstName=(null===(i=a.checkout.customer)||void 0===i?void 0:i.firstName)||"",E.lastName=(null===(s=a.checkout.customer)||void 0===s?void 0:s.lastName)||"";var x=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,n(!1)]:(d(!0),[4,E.saveContactForm()]);case 1:return e.sent()&&g(!0),d(!1),[2]}}))}))}),[l]);return o.createElement(v,{title:m("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(S,{type:"success",title:m("checkout-page:contactFormSent"),content:m("checkout-page:contactFormDescription")})),o.createElement(M,{type:A.TEXT_AREA,label:"",value:E.message||"",onChange:E.onMessageChange,textAreaPlaceholder:m("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:m(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:l,isDisabled:!E.message,onClick:x})),onClose:function(){return n(!1)}})}));export{I as default};
1
+ import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as r}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import s,{CheckoutStep as a}from"./model.js";import n from"./steps/step-info/index.js";import{CheckoutStepShipping as m}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as l}from"./steps/step-payment/index.js";import{CartSummary as c}from"./components/cart-summary/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"mobx";import"../../models/data/country/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import{IkasThemePageType as d}from"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import{ContactForm as u}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{StepSuccess as p}from"./steps/step-success/index.js";import{Modal as v}from"./components/modal/index.js";import h from"./style.module.scss.js";import{IkasPageHead as g}from"../page/head.js";import{Analytics as E}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{Image as x}from"../image/index.js";import f from"next/link.js";import j,{Step as y}from"./components/step-container/index.js";import{IkasStorefrontConfig as k}from"../../storefront/index.js";import'../../ext/lodash/isArguments.js';import'../../ext/lodash/isBuffer.js';import'../../ext/lodash/isTypedArray.js';import'../../ext/lodash/_baseGetTag.js';import{formatMoney as C}from"../../utils/currency.js";import{useTranslation as N}from"../../utils/i18n.js";import{StockError as b}from"./components/error/stock-error/index.js";import F from"./components/svg/ikas.js";import T from'../../ext/react-tooltip/dist/index.es.js';import{FullscreenLoading as P}from"./components/fullscreen-loading/index.js";import S from"./components/notification-box/index.js";import{FormItem as M}from"./components/form-item/index.js";import{FormItemType as A}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";var I=r((function(e){var t,r,n,m=e.checkout,l=e.checkoutSettings,u=e.merchantSettings,x=e.customizationProps,f=e.returnPolicy,j=e.privacyPolicy,y=e.termsOfService,C=N().t,S=i(),M=o.useState((function(){return new s(m,l,u,S,f,j,y,C,x||{})}))[0];return M.step===a.PAYMENT&&E.disableHTML(),o.useEffect((function(){M.checkoutSettings.isAccountRequired&&!M.checkout.hasCustomer&&S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),E.beginCheckout(M.checkout),E.pageView(d.CHECKOUT)}),[]),o.useEffect((function(){M.customizationProps=x,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(x)}),[x]),M.isCheckoutLoaded&&M.store.customerStore.initialized?M.checkout.hasCustomer&&(null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.id)!==(null===(r=M.checkout.customer)||void 0===r?void 0:r.id)?(S.push("/account/login?redirect="+encodeURIComponent(M.checkoutUrl)),null):o.createElement(o.Fragment,null,o.createElement(g,{pageType:d.CHECKOUT,pageTitle:((null===(n=M.merchantSettings)||void 0===n?void 0:n.merchantName)||"")+" - "+C("checkout-page:securePayment"),pageDescription:C("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:h.CheckoutPage},o.createElement(T,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:h.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:h.Left},o.createElement("div",{className:h.LeftContent},o.createElement("div",null,o.createElement(B,{vm:M}),M.hasStockError&&o.createElement("div",{className:h.ErrorContainer},o.createElement(b,{vm:M,error:M.error})),!M.hasStockError&&o.createElement(o.Fragment,null,o.createElement(c,{vm:M,allowExpand:!0}),M.step===a.SUCCESS?o.createElement(p,{vm:M}):o.createElement(L,{vm:M})),o.createElement("div",{className:h.Space})),o.createElement(U,{vm:M}))),o.createElement("div",{className:h.Right},o.createElement("div",{className:h.RightContent},o.createElement(c,{vm:M}),o.createElement("div",{className:h.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===k.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(F,null))))),!!M.policyModalText&&o.createElement(v,{title:M.policyModalTitle,modalContent:M.policyModalText,onClose:function(){M.policyModalText=""}}),M.isContactModalVisible&&o.createElement(H,{vm:M,setVisible:M.setContactModalVisible}))):o.createElement(P,null)})),B=r((function(e){var t,r,i=e.vm,s=N().t;return o.createElement("div",{className:h.Header},o.createElement(f,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=i.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:h.Logo},o.createElement(x,{layout:"fill",image:i.merchantSettings.logo,sizes:"360px"})):(null===(r=i.merchantSettings)||void 0===r?void 0:r.merchantName)||"")),!i.checkout.hasCustomer&&o.createElement("div",{className:h.LoginText},o.createElement("span",{className:h.LoginCta},s("checkout-page:alreadyHaveAnAccount")),o.createElement(f,{href:"/account/login?redirect="+encodeURIComponent(i.checkoutUrl),passHref:!0},o.createElement("a",{className:h.LoginBtn},s("checkout-page:actions.login")))),i.checkout.hasCustomer&&o.createElement("div",{className:h.CustomerInfo},o.createElement("div",{className:h.Name},i.checkout.customerFullName),o.createElement("div",{className:h.Email},i.checkout.customerEmail)))})),L=r((function(e){var t=e.vm,r=N().t,i=o.useMemo((function(){switch(t.step){case a.INFO:return o.createElement(n,{vm:t});case a.SHIPPING:return o.createElement(m,{vm:t});case a.PAYMENT:return o.createElement(l,{vm:t});case a.SUCCESS:return o.createElement(p,{vm:t})}}),[t,t.step]),s=[new y(r("checkout-page:address"),t.step===a.INFO,t.step!==a.INFO,t.step!==a.INFO?o.createElement("div",{className:h.AdressStepInfo},o.createElement(O,{vm:t}),o.createElement("div",{className:h.EditBtn,onClick:t.onBackToInfoClick},r("checkout-page:actions.edit"))):void 0,t.step!==a.INFO?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(O,{vm:t})):void 0),new y(r("checkout-page:payment"),t.step===a.PAYMENT,!1)];return"address"===t.deliveryMethod&&s.splice(1,0,new y(r("checkout-page:shipping"),t.step===a.SHIPPING,t.step===a.PAYMENT,t.step===a.PAYMENT?o.createElement("div",{className:h.AdressStepInfo},o.createElement(R,{vm:t}),t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1&&o.createElement("div",{className:h.EditBtn,onClick:t.onBackToShippingClick},r("checkout-page:actions.edit"))):void 0,t.step===a.PAYMENT?o.createElement("div",{className:h.AddressStepInfoMobile},o.createElement(R,{vm:t})):void 0)),o.createElement(j,{steps:s,stepContent:i})})),O=r((function(e){var t,r,i,s,a,n=e.vm,m=N().t,l=((null===(t=n.checkout.shippingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(r=n.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:h.Address},o.createElement("div",{className:[h.Text,h.WithMBottom].join(" ")},(null===(i=n.checkout.customer)||void 0===i?void 0:i.email)||""),"address"===n.deliveryMethod?o.createElement("div",{className:h.Text},l):o.createElement(o.Fragment,null,o.createElement("div",{className:h.Text},m("checkout-page:receiver")),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},l)),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(s=n.checkout.shippingAddress)||void 0===s?void 0:s.phone),"in-store"===n.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[h.Text,h.WithMTop].join(" ")},m("checkout-page:pickUpLocation"))),o.createElement("div",{className:[h.Text,h.Gray].join(" ")},null===(a=n.checkout.shippingAddress)||void 0===a?void 0:a.addressText))})),R=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:h.LightText}," / "+(0===t.checkout.shippingLines[0].price?r("checkout-page:free"):C(t.checkout.shippingLines[0].price,t.checkout.currencyCode)))):r("checkout-page:standartShipping"))})),U=r((function(e){var t=e.vm,r=N().t;return o.createElement("div",{className:h.Footer},o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},r("checkout-page:returnPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},r("checkout-page:privacyPolicy")),o.createElement("div",{className:h.FooterBullet},"•"),o.createElement("div",{className:h.FooterItem,onClick:function(){t.policyModalTitle=r("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},r("checkout-page:termsOfService")))})),H=r((function(r){var i,s,a=r.vm,n=r.setVisible,m=N().t,l=o.useState(!1),c=l[0],d=l[1],p=o.useState(!1),h=p[0],g=p[1],E=o.useState(new u({message:{requiredRule:"",emailRule:"",minRule:""},store:a.store}))[0];E.email=a.checkout.customerEmail,E.firstName=(null===(i=a.checkout.customer)||void 0===i?void 0:i.firstName)||"",E.lastName=(null===(s=a.checkout.customer)||void 0===s?void 0:s.lastName)||"";var x=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,n(!1)]:(d(!0),[4,E.saveContactForm()]);case 1:return e.sent()&&g(!0),d(!1),[2]}}))}))}),[c]);return o.createElement(v,{title:m("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(S,{type:"success",title:m("checkout-page:contactFormSent"),content:m("checkout-page:contactFormDescription")})),o.createElement(M,{type:A.TEXT_AREA,label:"",value:E.message||"",onChange:E.onMessageChange,textAreaPlaceholder:m("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:m(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:c,isDisabled:!E.message,onClick:x})),onClose:function(){return n(!1)}})}));export{I as default};
@@ -12,6 +12,7 @@ import { QueryParams as RetrieveInstallmentInfoQueryParams } from "../../__api/m
12
12
  import { SaveCartInput } from "../../__api/models/SaveCartInput";
13
13
  import { StockLocation } from "../../__api/models/StockLocation";
14
14
  import { GetAvailableStockLocation } from "../../__api/models/GetAvailableStockLocation";
15
+ import { CreateStripePaymentIntentResponse } from "../../__api/models/CreateStripePaymentIntentResponse";
15
16
  import { IkasCheckoutCustomizationProps } from ".";
16
17
  export default class CheckoutViewModel {
17
18
  checkout: IkasCheckout;
@@ -40,6 +41,7 @@ export default class CheckoutViewModel {
40
41
  stockLocations: StockLocation[];
41
42
  availableStockLocations: GetAvailableStockLocation[];
42
43
  deliveryMethod: "address" | "in-store";
44
+ stripeResponse: CreateStripePaymentIntentResponse | null;
43
45
  returnPolicy: string;
44
46
  privacyPolicy: string;
45
47
  termsOfService: string;
@@ -108,7 +110,7 @@ export default class CheckoutViewModel {
108
110
  setUseDifferentAddress: (value: boolean) => void;
109
111
  setShouldSaveAddress: (value: boolean) => void;
110
112
  setAddressTitle: (value: string) => void;
111
- setPaymentGateway: (index: number) => void;
113
+ setPaymentGateway: (index: number) => Promise<void>;
112
114
  setInstallmentCount: (count: number) => void;
113
115
  changeStep: (step: CheckoutStep) => Promise<void>;
114
116
  logout: () => Promise<void>;
@@ -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 u}from"../../storefront/index.js";import{IkasCheckoutSettings as l}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 S from"../../store/cart/api.js";import{SaveCartInput as y}from"../../__api/models/SaveCartInput.js";import{PaymentMethodEnum as k,PaymentGatewayTypeEnum as b,TransactionStatusEnum as I}from"../../__api/types/index.js";import C from'../../ext/uuid/dist/esm-node/v4.js';var A,P,j=/^\d+$/,w="undefined"==typeof localStorage,R=function(){function j(j,R,E,O,T,D,L,_,G){var M=this;this.checkout=new p,this.checkoutSettings=new l,this.storefront=null,this.store=u.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.policyModalTitle="",this.policyModalText="",this.error=null,this.init=function(){return t(M,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(M,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(u.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:P.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:P.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:P.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(M,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(M,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(M,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return(t=new y(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,S.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:P.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:P.API_ERROR};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(M,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(M,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,l,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:u.stockLocationIds||[]})];case 1:if(!(i=e.sent()).isSuccess)throw{type:P.API_ERROR};if(null==(s=null===(h=null===(l=i.data)||void 0===l?void 0:l.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:P.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(M,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(M,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f.getAvailableShippingCountries({salesChannelId:u.salesChannelId})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(M,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return u.pickUpStockLocationIds?[4,f.listStockLocation({id:{in:u.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:P.API_ERROR},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(M,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return u.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:u.pickUpStockLocationIds})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:P.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=M.shippingCountryIds)||void 0===t?void 0:t.length)||(M.error={type:P.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(M.checkout.stockLocationId=null),M.deliveryMethod=t,M.isErrorsVisible=!1},this.initialStockCheck=function(){return t(M,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:P.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(M,void 0,void 0,(function(){var t,i,s,n,o,a,d,c,l=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=u.paymentGateways.map((function(t){return t.id})),[4,f.listPaymentGateway({id:t?void 0:{in:i}})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===A.PAYMENT&&(n=n.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(l.checkout.currencyCode)})),(o=null===(c=this.checkout.shippingAddress)||void 0===c?void 0:c.country)&&o.iso2&&(n=n.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(o.iso2||"")})))),a=[],r(u.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),[2]):(this.error={type:P.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(M,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;M.store.customerStore.customer?(null===(t=M.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=M.checkoutSettings})),M.checkout.customer=new d(M.store.customerStore.customer)):M.checkout.customer||(M.checkout.customer=new d({}))},this.createShippingAddress=function(){var t;if(M.checkout.shippingAddress)M.selectedShippingAddressId=M.checkout.shippingAddress.id||"-1",M.checkout.shippingAddress.checkoutSettings=M.checkoutSettings;else{var e=null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.addresses;M.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(M.useDifferentAddress=!!localStorage.getItem("sAddr"),M.useDifferentAddress?(M.checkout.billingAddress&&(M.selectedBillingAddressId=M.checkout.billingAddress.id||"-1"),M.checkout.billingAddress=M.checkout.billingAddress||new a):M.checkout.billingAddress=new a(n(M.checkout.shippingAddress)||{}),M.checkout.billingAddress.checkoutSettings=M.checkoutSettings)},this.onShippingMethodChange=function(i){return t(M,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(M,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(M,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,S.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(M.selectedShippingAddressId=t,"-1"===t)M.checkout.shippingAddress=new a;else{var s=null===(i=null===(e=M.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(M.checkout.shippingAddress=new a(s))}M.checkout.shippingAddress&&(M.checkout.shippingAddress.checkoutSettings=M.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(M.selectedBillingAddressId=t,"-1"===t)M.checkout.billingAddress=new a;else{var s=null===(i=null===(e=M.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(M.checkout.billingAddress=new a(s))}M.checkout.billingAddress&&(M.checkout.billingAddress.checkoutSettings=M.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){M.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(M.cardData&&(!(t.length>M.cardData.cardNumber.length)||N(t))){var e=(M.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!M.installmentInfo?M.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:M.checkout.selectedPaymentGateway.id,price:M.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(M.cardData.installmentCount=1,M.installmentInfo=void 0),M.cardData.cardNumber=x(i,4).join(" "))}},this.onCardHolderNameChange=function(t){M.cardData&&(M.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(M.cardData&&(!(t.length>M.cardData.expirationDate.length)||N(t))){if(0===(null===(e=M.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(M.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(M.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(M.cardData.expirationDate=x(a,2).join(" / "))}},this.onCvcChange=function(t){M.cardData&&(t.length>M.cardData.cvv.length&&!N(t)||t.length>4||(M.cardData.cvv=t))},this.saveAddress=function(s){return t(M,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:C()})),(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(){M.router.push("/cart")},this.onBackToShoppingClick=function(){M.router.push("/")},this.onProceedToShippingClick=function(){return t(M,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:P.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(M,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:P.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(M,void 0,void 0,(function(){var t;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(),[4,this.createSaleTransaction()];case 6:return e.sent(),[3,8];case 7:return(t=e.sent()).type?this.error=t:this.error={type:P.UNKNOWN},this.isStepLoading=!1,[3,8];case 8:return[2]}}))}))},this.createSaleTransaction=function(){return t(M,void 0,void 0,(function(){var t,i,s,n,r,o;return e(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?[4,f.createSaleTransactionWithCart({input:{cartId:this.checkout.id,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.checkout.selectedPaymentGateway.paymentMethodType===k.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===b.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 1:return t=e.sent(),i=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.transactionStatus,s=i&&[I.SUCCESS,I.AUTHORIZED].includes(i),n=i===I.PENDING,s?[4,this.getSuccessTransaction()]:[3,4];case 2:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 3:return e.sent(),[3,5];case 4:if(!n||!(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.returnSlug))throw{type:P.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+t.data.returnSlug,e.label=5;case 5:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(M,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(){M.changeStep(A.INFO)},this.onBackToShippingClick=function(){M.changeStep(A.SHIPPING)},this.setCustomerConsentGranted=function(t){M.checkout.customer&&(M.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){M.useDifferentAddress=t,M.useDifferentAddress?(localStorage.setItem("sAddr","1"),M.checkout.billingAddress=M.checkout.billingAddress||new a):(localStorage.removeItem("sAddr"),M.checkout.billingAddress=M.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){M.shouldSaveAddress=t},this.setAddressTitle=function(t){M.addressTitle=t},this.setPaymentGateway=function(t){if(M.paymentGateways.length){var e=M.paymentGateways[t];M.checkout.selectedPaymentGateway=e,M.step!==A.SUCCESS&&(e.paymentMethodType===k.CREDIT_CARD&&e.type===b.INTERNAL&&(M.cardData=new c),M.installmentInfo=void 0)}},this.setInstallmentCount=function(t){M.cardData&&(M.cardData.installmentCount=t)},this.changeStep=function(i){return t(M,void 0,void 0,(function(){return e(this,(function(t){return w||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(M,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){M.isContactModalVisible=t},this.checkout=j,this.checkoutSettings=R,this.router=O,this.returnPolicy=T,this.privacyPolicy=D,this.termsOfService=L,this.t=_,this.customizationProps=G,E&&(this.merchantSettings=E),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)===P.STOCK_ERROR},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)!==P.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.customer)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.customer)||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,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway;return("in-store"===this.deliveryMethod||this.canProceedToShipping)&&("in-store"===this.deliveryMethod||!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid))&&((null==i?void 0:i.paymentMethodType)===k.CREDIT_CARD&&i.type===b.INTERNAL?null===(e=this.cardData)||void 0===e?void 0:e.isValid:!!i)},enumerable:!1,configurable:!0}),j}();function x(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function N(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"}(P||(P={}));export{A as CheckoutStep,P 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 u}from"../../storefront/index.js";import{IkasCheckoutSettings as l}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 S from"../../store/cart/api.js";import{SaveCartInput as y}from"../../__api/models/SaveCartInput.js";import{PaymentMethodEnum as k,PaymentGatewayTypeEnum as b,TransactionStatusEnum as I}from"../../__api/types/index.js";import C from'../../ext/uuid/dist/esm-node/v4.js';var P,A,j=/^\d+$/,w="undefined"==typeof localStorage,R=function(){function j(j,R,E,T,O,D,L,G,_){var M=this;this.checkout=new p,this.checkoutSettings=new l,this.storefront=null,this.store=u.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=P.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.init=function(){return t(M,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(M,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(u.isEditor)return this.step=P.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===P.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(P.INFO)];if(this.step!==P.PAYMENT||this.canProceedToPayment){if(![P.INFO,P.SUCCESS,P.SHIPPING,P.PAYMENT].includes(this.step))return[2,this.changeStep(P.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(P.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:A.PAYMENT_ERROR,data:n||null}),this.step!==P.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!==P.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=P.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==P.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==P.PAYMENT&&this.step!==P.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:A.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:A.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===P.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(P.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(M,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(M,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(M,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return(t=new y(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,S.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:A.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:A.API_ERROR};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(M,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(M,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,l,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:u.stockLocationIds||[]})];case 1:if(!(i=e.sent()).isSuccess)throw{type:A.API_ERROR};if(null==(s=null===(h=null===(l=i.data)||void 0===l?void 0:l.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:A.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(M,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(M,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f.getAvailableShippingCountries({salesChannelId:u.salesChannelId})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(M,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return u.pickUpStockLocationIds?[4,f.listStockLocation({id:{in:u.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:A.API_ERROR},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(M,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return u.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:u.pickUpStockLocationIds})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:A.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=M.shippingCountryIds)||void 0===t?void 0:t.length)||(M.error={type:A.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(M.checkout.stockLocationId=null),M.deliveryMethod=t,M.isErrorsVisible=!1},this.initialStockCheck=function(){return t(M,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:A.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(M,void 0,void 0,(function(){var t,i,s,n,o,a,d,c,l=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=u.paymentGateways.map((function(t){return t.id})),[4,f.listPaymentGateway({id:t?void 0:{in:i}})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===P.PAYMENT&&(n=n.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(l.checkout.currencyCode)})),(o=null===(c=this.checkout.shippingAddress)||void 0===c?void 0:c.country)&&o.iso2&&(n=n.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(o.iso2||"")})))),a=[],r(u.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),[2]):(this.error={type:A.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(M,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;M.store.customerStore.customer?(null===(t=M.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=M.checkoutSettings})),M.checkout.customer=new d(M.store.customerStore.customer)):M.checkout.customer||(M.checkout.customer=new d({}))},this.createShippingAddress=function(){var t;if(M.checkout.shippingAddress)M.selectedShippingAddressId=M.checkout.shippingAddress.id||"-1",M.checkout.shippingAddress.checkoutSettings=M.checkoutSettings;else{var e=null===(t=M.store.customerStore.customer)||void 0===t?void 0:t.addresses;M.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(M.useDifferentAddress=!!localStorage.getItem("sAddr"),M.useDifferentAddress?(M.checkout.billingAddress&&(M.selectedBillingAddressId=M.checkout.billingAddress.id||"-1"),M.checkout.billingAddress=M.checkout.billingAddress||new a):M.checkout.billingAddress=new a(n(M.checkout.shippingAddress)||{}),M.checkout.billingAddress.checkoutSettings=M.checkoutSettings)},this.onShippingMethodChange=function(i){return t(M,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(M,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(M,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,S.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===P.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(M.selectedShippingAddressId=t,"-1"===t)M.checkout.shippingAddress=new a;else{var s=null===(i=null===(e=M.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(M.checkout.shippingAddress=new a(s))}M.checkout.shippingAddress&&(M.checkout.shippingAddress.checkoutSettings=M.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(M.selectedBillingAddressId=t,"-1"===t)M.checkout.billingAddress=new a;else{var s=null===(i=null===(e=M.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(M.checkout.billingAddress=new a(s))}M.checkout.billingAddress&&(M.checkout.billingAddress.checkoutSettings=M.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){M.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(M.cardData&&(!(t.length>M.cardData.cardNumber.length)||N(t))){var e=(M.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!M.installmentInfo?M.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:M.checkout.selectedPaymentGateway.id,price:M.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(M.cardData.installmentCount=1,M.installmentInfo=void 0),M.cardData.cardNumber=x(i,4).join(" "))}},this.onCardHolderNameChange=function(t){M.cardData&&(M.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(M.cardData&&(!(t.length>M.cardData.expirationDate.length)||N(t))){if(0===(null===(e=M.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(M.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(M.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(M.cardData.expirationDate=x(a,2).join(" / "))}},this.onCvcChange=function(t){M.cardData&&(t.length>M.cardData.cvv.length&&!N(t)||t.length>4||(M.cardData.cvv=t))},this.saveAddress=function(s){return t(M,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:C()})),(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(){M.router.push("/cart")},this.onBackToShoppingClick=function(){M.router.push("/")},this.onProceedToShippingClick=function(){return t(M,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(P.SHIPPING):this.changeStep(P.PAYMENT),[3,7];case 6:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:A.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(M,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(P.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:A.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onCompletePaymentClick=function(){return t(M,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:if(!this.canPerformPayment)return this.isErrorsVisible=!0,[2];this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),e.label=1;case 1:return e.trys.push([1,7,,8]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),"address"!==this.deliveryMethod?[3,4]:[4,this.saveAddress("billing")];case 3:e.sent(),e.label=4;case 4:return[4,this.saveCart()];case 5:return e.sent(),"STRIPE"===(null===(s=this.checkout.selectedPaymentGateway)||void 0===s?void 0:s.code)?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):[4,this.createSaleTransaction()];case 6:return e.sent(),[3,8];case 7:return(i=e.sent()).type?this.error=i:this.error={type:A.UNKNOWN},this.isStepLoading=!1,[3,8];case 8:return[2]}}))}))},this.createSaleTransaction=function(){return t(M,void 0,void 0,(function(){var t,i,s,n,r,o;return e(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?[4,f.createSaleTransactionWithCart({input:{cartId:this.checkout.id,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.checkout.selectedPaymentGateway.paymentMethodType===k.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===b.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 1:return t=e.sent(),i=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.transactionStatus,s=i&&[I.SUCCESS,I.AUTHORIZED].includes(i),n=i===I.PENDING,s?[4,this.getSuccessTransaction()]:[3,4];case 2:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 3:return e.sent(),[3,5];case 4:if(!n||!(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.returnSlug))throw{type:A.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+t.data.returnSlug,e.label=5;case 5:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(M,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(P.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){M.changeStep(P.INFO)},this.onBackToShippingClick=function(){M.changeStep(P.SHIPPING)},this.setCustomerConsentGranted=function(t){M.checkout.customer&&(M.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){M.useDifferentAddress=t,M.useDifferentAddress?(localStorage.setItem("sAddr","1"),M.checkout.billingAddress=M.checkout.billingAddress||new a):(localStorage.removeItem("sAddr"),M.checkout.billingAddress=M.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){M.shouldSaveAddress=t},this.setAddressTitle=function(t){M.addressTitle=t},this.setPaymentGateway=function(i){return t(M,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||this.stripeResponse?[3,2]:[4,f.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})]:[2];case 1:(s=e.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),e.label=2;case 2:return this.checkout.selectedPaymentGateway=t,this.step!==P.SUCCESS&&(t.paymentMethodType===k.CREDIT_CARD&&t.type===b.INTERNAL&&(this.cardData=new c),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){M.cardData&&(M.cardData.installmentCount=t)},this.changeStep=function(i){return t(M,void 0,void 0,(function(){return e(this,(function(t){return w||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(M,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){M.isContactModalVisible=t},this.checkout=j,this.checkoutSettings=R,this.router=T,this.returnPolicy=O,this.privacyPolicy=D,this.termsOfService=L,this.t=G,this.customizationProps=_,E&&(this.merchantSettings=E),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===P.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)===A.STOCK_ERROR},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)!==A.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,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway;return("in-store"===this.deliveryMethod||this.canProceedToShipping)&&("in-store"===this.deliveryMethod||!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValid))&&((null==i?void 0:i.paymentMethodType)===k.CREDIT_CARD&&i.type===b.INTERNAL?"STRIPE"===i.code||(null===(e=this.cardData)||void 0===e?void 0:e.isValid):!!i)},enumerable:!1,configurable:!0}),j}();function x(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function N(t){return t&&j.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(P||(P={})),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"}(A||(A={}));export{P as CheckoutStep,A as ErrorType,R as default};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/payment-gateway/index.js";import{CreditCardForm as n}from"../../../components/credit-card-form/index.js";import{Installments as o}from"./installments/index.js";import r from"../../../components/select-box/index.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{formatMoney as m}from"../../../../../utils/currency.js";import{useTranslation as i}from"../../../../../utils/i18n.js";import l from"../../../components/svg/external.js";import{PaymentMethodEnum as s,PaymentGatewayTypeEnum as c,PaymentGatewayTransactionFeeTypeEnum as d,PaymentGatewayAdditionalPriceTypeEnum as p}from"../../../../../__api/types/index.js";var u=t((function(t){var u=t.vm,y=i().t,f=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},E=function(t){return e.createElement("div",{className:a.AdditionalPrice},t.children)};return e.createElement(e.Fragment,null,u.paymentGateways.map((function(t,i){var g,h;return e.createElement(r,{key:t.id,label:t.paymentMethodType===s.CREDIT_CARD&&t.type===c.INTERNAL?y("checkout-page:creditCard"):t.name,isSelected:u.selectedPaymentGatewayIndex===i,rightContent:(null===(g=t.additionalPrices)||void 0===g?void 0:g.length)?e.createElement(E,null,(h=t.additionalPrices[0],0===h.amount?"":"".concat(h.amountType===d.AMOUNT?m(h.amount,u.checkout.currencyCode):" %"+h.amount).concat(h.type===p.DECREMENT?" "+y("checkout-page:paymentMethodDiscount"):" "+y("checkout-page:paymentMethodAdditionalPrice")))):e.createElement(f,null,!!t.logoUrl&&e.createElement("div",{className:a.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:t.paymentMethodType===s.CREDIT_CARD&&t.type===c.INTERNAL?e.createElement("div",null,e.createElement(n,{vm:u}),u.installmentInfo&&e.createElement(o,{vm:u})):t.description?e.createElement(e.Fragment,null,t.type===c.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(l,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0,onClick:function(){return u.selectedPaymentGatewayIndex!==i&&u.setPaymentGateway(i)}})})))}));export{u as PaymentGateways};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/payment-gateway/index.js";import{CreditCardForm as n}from"../../../components/credit-card-form/index.js";import{Installments as o}from"./installments/index.js";import r from"../../../components/select-box/index.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{formatMoney as m}from"../../../../../utils/currency.js";import{useTranslation as i}from"../../../../../utils/i18n.js";import l from"../../../components/svg/external.js";import{StripeForm as s}from"../../../components/stripe/index.js";import{PaymentMethodEnum as c,PaymentGatewayTypeEnum as d,PaymentGatewayTransactionFeeTypeEnum as p,PaymentGatewayAdditionalPriceTypeEnum as u}from"../../../../../__api/types/index.js";var y=t((function(t){var y=t.vm,f=i().t,E=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},g=function(t){return e.createElement("div",{className:a.AdditionalPrice},t.children)};return e.createElement(e.Fragment,null,y.paymentGateways.map((function(t,i){var h,x;return e.createElement(r,{key:t.id,label:t.paymentMethodType===c.CREDIT_CARD&&t.type===d.INTERNAL?f("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===i,rightContent:(null===(h=t.additionalPrices)||void 0===h?void 0:h.length)?e.createElement(g,null,(x=t.additionalPrices[0],0===x.amount?"":"".concat(x.amountType===p.AMOUNT?m(x.amount,y.checkout.currencyCode):" %"+x.amount).concat(x.type===u.DECREMENT?" "+f("checkout-page:paymentMethodDiscount"):" "+f("checkout-page:paymentMethodAdditionalPrice")))):e.createElement(E,null,!!t.logoUrl&&e.createElement("div",{className:a.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:t.paymentMethodType===c.CREDIT_CARD&&t.type===d.INTERNAL?e.createElement(e.Fragment,null,"STRIPE"===t.code?e.createElement(s,{vm:y,pg:t}):e.createElement("div",null,e.createElement(n,{vm:y}),y.installmentInfo&&e.createElement(o,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===d.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(l,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0,onClick:function(){return y.selectedPaymentGatewayIndex!==i&&y.setPaymentGateway(i)}})})))}));export{y as PaymentGateways};
@@ -1 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as a}from"../../../../store/cart/index.js";import i from"./style.module.scss.js";import r from"../../components/svg/success-circle.js";import s from"../../components/expandable-section/index.js";import d from"../../components/credit-card-form/svg/amex.js";import n from"../../components/credit-card-form/svg/master-card.js";import m from"../../components/credit-card-form/svg/troy.js";import l from"../../components/credit-card-form/svg/visa.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{formatMoney as c}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.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"../../../../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{PaymentMethodEnum as p,PaymentGatewayTypeEnum as v,OrderPackageStatusEnum as E,TransactionCardAssociationEnum as x}from"../../../../__api/types/index.js";var f=t((function(t){var E,f,g,h,k=t.vm,T=u().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(a);e&&e===k.checkout.id&&localStorage.removeItem(a)}}),[]);var y=((null===(E=k.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(f=k.checkout.customer)||void 0===f?void 0:f.lastName)||""),N=k.paymentGateways.find((function(e){var t;return e.id===(null===(t=k.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),I=null===(g=k.successTransaction)||void 0===g?void 0:g.paymentMethodDetail,L=e.useMemo((function(){var t,o,a,r;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},T("checkout-page:paymentMethod")),N&&e.createElement(e.Fragment,null,!!N.logoUrl&&e.createElement("div",{className:i.PaymentLogoContainer},e.createElement("img",{src:N.logoUrl})),!N.logoUrl&&e.createElement("div",{className:i.InfoText},N.paymentMethodType===p.CREDIT_CARD&&N.type===v.INTERNAL?T("checkout-page:creditCard"):N.name),!!N.description&&N.type!==v.EXTERNAL&&e.createElement("div",{className:i.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:N.description}}))),"CREDIT_CARD"===(null===(t=k.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},e.createElement("div",{className:i.CardLogoContainer},function(){var t,o;switch(null===(o=null===(t=k.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation){case x.AMERICAN_EXPRESS:return e.createElement(d,null);case x.MASTER_CARD:return e.createElement(n,null);case x.TROY:return e.createElement(m,null);case x.VISA:return e.createElement(l,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==I?void 0:I.lastFourDigits)||""))),(null===(o=null==I?void 0:I.installment)||void 0===o?void 0:o.installmentCount)&&I.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},"".concat(I.installment.installmentCount," ").concat(T("checkout-page:installments"))),null!==I.installment.installmentPrice&&e.createElement("div",{className:i.InfoText},"".concat(I.installment.installmentCount," x ").concat(c(I.installment.installmentPrice,k.checkout.currencyCode)))))),"address"===k.deliveryMethod&&e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},T("checkout-page:billingAddress")),!!(null===(a=k.checkout.billingAddress)||void 0===a?void 0:a.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},k.checkout.billingAddress.company),e.createElement("div",{className:i.InfoText},null===(r=k.checkout.billingAddress)||void 0===r?void 0:r.addressText)))}),[]),A=e.useMemo((function(){var t,o,a,r,s;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},T("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(t=k.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:i.InfoText},y),!!(null===(o=k.checkout.shippingAddress)||void 0===o?void 0:o.phone)&&e.createElement("div",{className:i.InfoText},null===(a=k.checkout.shippingAddress)||void 0===a?void 0:a.phone)),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},"address"===k.deliveryMethod?T("checkout-page:shippingAddress"):T("checkout-page:pickUpLocation")),!!(null===(r=k.checkout.shippingAddress)||void 0===r?void 0:r.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},k.checkout.shippingAddress.company),e.createElement("div",{className:i.InfoText},null===(s=k.checkout.shippingAddress)||void 0===s?void 0:s.addressText)))}),[]);return e.createElement("div",{className:i.StepSuccess},e.createElement("div",{className:i.SuccessTitleContainer},e.createElement(r,null),e.createElement("span",{className:i.SuccessTitle},T("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:i.SuccessSubTitle},T("address"===k.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:y})),e.createElement("div",{className:[i.InfoGrid,i.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},T("checkout-page:orderNoAndDate")),e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},"#"+(k.checkout.orderNumber||"")),e.createElement("div",{className:i.InfoText},k.checkout.dateStr),e.createElement(j,{vm:k})),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},T("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(h=k.checkout.customer)||void 0===h?void 0:h.email),e.createElement("div",{className:i.InfoText},y))),e.createElement(s,{title:T("checkout-page:paymentSummary")},L),e.createElement(s,{title:T("checkout-page:shippingSummary")},A),e.createElement("div",{className:i.Actions},e.createElement("div",{className:i.HelpText},e.createElement("span",null,T("checkout-page:helpCtaQuestion")),e.createElement("span",{className:i.Cta,onClick:function(){return k.setContactModalVisible(!0)}},T("checkout-page:helpCta"))),e.createElement(o,{text:T("checkout-page:actions.backToShopping"),onClick:k.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),j=t((function(t){var o,a=t.vm,r=u().t,s=i.Yellow;switch(a.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:s=i.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:s=i.Red}return e.createElement("div",{className:[i.OrderStatus,s].join(" ")},a.checkout.orderPackageStatus?null===(o=[{types:[E.UNFULFILLED],text:r("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:r("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:r("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:r("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED,E.PARTIALLY_DELIVERED],text:r("checkout-page:orderPackageStatus.delivered")},{types:[E.UNABLE_TO_DELIVER],text:r("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:r("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:r("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:r("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:r("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:r("checkout-page:orderPackageStatus.refundRejected")},{types:[E.REFUND_REQUESTED],text:r("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(a.checkout.orderPackageStatus)})))||void 0===o?void 0:o.text:"")}));export{f as StepSuccess};
1
+ import*as e from"react";import{observer as t}from"mobx-react-lite";import{Button as o}from"../../components/button/index.js";import{CART_LS_KEY as a}from"../../../../store/cart/index.js";import i from"./style.module.scss.js";import s from"../../components/svg/success-circle.js";import r from"../../components/expandable-section/index.js";import d from"../../components/credit-card-form/svg/amex.js";import n from"../../components/credit-card-form/svg/master-card.js";import l from"../../components/credit-card-form/svg/troy.js";import m from"../../components/credit-card-form/svg/visa.js";import"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{formatMoney as c}from"../../../../utils/currency.js";import{useTranslation as u}from"../../../../utils/i18n.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"../../../../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{PaymentMethodEnum as p,PaymentGatewayTypeEnum as v,OrderPackageStatusEnum as E,TransactionCardAssociationEnum as x}from"../../../../__api/types/index.js";var f=t((function(t){var E,f,j,h,k,T,N=t.vm,y=u().t;e.useEffect((function(){if("undefined"!=typeof localStorage){var e=localStorage.getItem(a);e&&e===N.checkout.id&&localStorage.removeItem(a)}}),[]);var I=((null===(E=N.checkout.customer)||void 0===E?void 0:E.firstName)||"")+" "+((null===(f=N.checkout.customer)||void 0===f?void 0:f.lastName)||""),L=((null===(j=N.checkout.shippingAddress)||void 0===j?void 0:j.firstName)||"")+" "+((null===(h=N.checkout.shippingAddress)||void 0===h?void 0:h.lastName)||""),A=N.paymentGateways.find((function(e){var t;return e.id===(null===(t=N.successTransaction)||void 0===t?void 0:t.paymentGatewayId)})),D=null===(k=N.successTransaction)||void 0===k?void 0:k.paymentMethodDetail,S=e.useMemo((function(){var t,o,a,s;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:paymentMethod")),A&&e.createElement(e.Fragment,null,!!A.logoUrl&&e.createElement("div",{className:i.PaymentLogoContainer},e.createElement("img",{src:A.logoUrl})),!A.logoUrl&&e.createElement("div",{className:i.InfoText},A.paymentMethodType===p.CREDIT_CARD&&A.type===v.INTERNAL?y("checkout-page:creditCard"):A.name),!!A.description&&A.type!==v.EXTERNAL&&e.createElement("div",{className:i.InfoText},e.createElement("div",{dangerouslySetInnerHTML:{__html:A.description}}))),"CREDIT_CARD"===(null===(t=N.successTransaction)||void 0===t?void 0:t.paymentMethod)&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},e.createElement("div",{className:i.CardLogoContainer},function(){var t,o;switch(null===(o=null===(t=N.successTransaction)||void 0===t?void 0:t.paymentMethodDetail)||void 0===o?void 0:o.cardAssociation){case x.AMERICAN_EXPRESS:return e.createElement(d,null);case x.MASTER_CARD:return e.createElement(n,null);case x.TROY:return e.createElement(l,null);case x.VISA:return e.createElement(m,null);default:return e.createElement("div",null)}}()),e.createElement("span",null,"**** ".concat((null==D?void 0:D.lastFourDigits)||""))),(null===(o=null==D?void 0:D.installment)||void 0===o?void 0:o.installmentCount)&&D.installment.installmentCount>1&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoText},"".concat(D.installment.installmentCount," ").concat(y("checkout-page:installments"))),null!==D.installment.installmentPrice&&e.createElement("div",{className:i.InfoText},"".concat(D.installment.installmentCount," x ").concat(c(D.installment.installmentPrice,N.checkout.currencyCode)))))),"address"===N.deliveryMethod&&e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:billingAddress")),!!(null===(a=N.checkout.billingAddress)||void 0===a?void 0:a.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},N.checkout.billingAddress.company),e.createElement("div",{className:i.InfoText},null===(s=N.checkout.billingAddress)||void 0===s?void 0:s.addressText)))}),[]),C=e.useMemo((function(){var t,o,a,s,r;return e.createElement("div",{className:[i.InfoGrid].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(t=N.checkout.customer)||void 0===t?void 0:t.email),e.createElement("div",{className:i.InfoText},I),!!(null===(o=N.checkout.shippingAddress)||void 0===o?void 0:o.phone)&&e.createElement("div",{className:i.InfoText},null===(a=N.checkout.shippingAddress)||void 0===a?void 0:a.phone)),e.createElement("div",null,"in-store"===N.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:receiver")),e.createElement("div",{className:[i.InfoText,i.withMBottom].join(" ")},L)),e.createElement("div",{className:i.InfoTitle},"address"===N.deliveryMethod?y("checkout-page:shippingAddress"):y("checkout-page:pickUpLocation")),!!(null===(s=N.checkout.shippingAddress)||void 0===s?void 0:s.company)&&e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},N.checkout.shippingAddress.company),e.createElement("div",{className:i.InfoText},null===(r=N.checkout.shippingAddress)||void 0===r?void 0:r.addressText)))}),[]);return e.createElement("div",{className:i.StepSuccess},e.createElement("div",{className:i.SuccessTitleContainer},e.createElement(s,null),e.createElement("span",{className:i.SuccessTitle},y("checkout-page:orderSuccessTitle"))),e.createElement("div",{className:i.SuccessSubTitle},y("address"===N.deliveryMethod?"checkout-page:orderSuccessDescription":"checkout-page:orderSuccessInStoreDeliveryDescription",{customerName:I})),e.createElement("div",{className:[i.InfoGrid,i.WithBorder].join(" ")},e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:orderNoAndDate")),e.createElement("div",{className:[i.InfoText,i.InfoTextBold].join(" ")},"#"+(N.checkout.orderNumber||"")),e.createElement("div",{className:i.InfoText},N.checkout.dateStr),e.createElement(g,{vm:N})),e.createElement("div",null,e.createElement("div",{className:i.InfoTitle},y("checkout-page:contactInfo")),e.createElement("div",{className:i.InfoText},null===(T=N.checkout.customer)||void 0===T?void 0:T.email),e.createElement("div",{className:i.InfoText},I))),e.createElement(r,{title:y("checkout-page:paymentSummary")},S),e.createElement(r,{title:y("checkout-page:shippingSummary")},C),e.createElement("div",{className:i.Actions},e.createElement("div",{className:i.HelpText},e.createElement("span",null,y("checkout-page:helpCtaQuestion")),e.createElement("span",{className:i.Cta,onClick:function(){return N.setContactModalVisible(!0)}},y("checkout-page:helpCta"))),e.createElement(o,{text:y("checkout-page:actions.backToShopping"),onClick:N.onBackToShoppingClick,style:{flex:"0 0 auto"}})))})),g=t((function(t){var o,a=t.vm,s=u().t,r=i.Yellow;switch(a.checkout.orderPackageStatus){case E.FULFILLED:case E.PARTIALLY_FULFILLED:case E.DELIVERED:case E.PARTIALLY_DELIVERED:r=i.Green;break;case E.CANCELLED:case E.PARTIALLY_CANCELLED:case E.CANCEL_REJECTED:case E.CANCEL_REQUESTED:r=i.Red}return e.createElement("div",{className:[i.OrderStatus,r].join(" ")},a.checkout.orderPackageStatus?null===(o=[{types:[E.UNFULFILLED],text:s("checkout-page:orderPackageStatus.unfulfilled")},{types:[E.READY_FOR_SHIPMENT],text:s("checkout-page:orderPackageStatus.readyForShipment")},{types:[E.PARTIALLY_FULFILLED],text:s("checkout-page:orderPackageStatus.partiallyFulfilled")},{types:[E.FULFILLED],text:s("checkout-page:orderPackageStatus.fulfilled")},{types:[E.DELIVERED,E.PARTIALLY_DELIVERED],text:s("checkout-page:orderPackageStatus.delivered")},{types:[E.UNABLE_TO_DELIVER],text:s("checkout-page:orderPackageStatus.unableToDeliver")},{types:[E.CANCELLED,E.PARTIALLY_CANCELLED],text:s("checkout-page:orderPackageStatus.cancelled")},{types:[E.CANCEL_REJECTED],text:s("checkout-page:orderPackageStatus.cancelRejected")},{types:[E.REFUNDED,E.PARTIALLY_REFUNDED],text:s("checkout-page:orderPackageStatus.refunded")},{types:[E.REFUND_REQUEST_ACCEPTED],text:s("checkout-page:orderPackageStatus.refundRequestAccepted")},{types:[E.REFUND_REJECTED],text:s("checkout-page:orderPackageStatus.refundRejected")},{types:[E.REFUND_REQUESTED],text:s("checkout-page:orderPackageStatus.refundRequested")}].find((function(e){return e.types.includes(a.checkout.orderPackageStatus)})))||void 0===o?void 0:o.text:"")}));export{f as StepSuccess};