@ikas/storefront 3.0.0-alpha.22 → 3.0.0-alpha.24

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.
@@ -0,0 +1 @@
1
+ import{__extends as t}from'../../ext/tslib/tslib.es6.js';import{makeObservable as s,observable as i}from"mobx";import{GetAvailableStockLocationAddressData as e}from"./GetAvailableStockLocationAddress.js";var n=function(t){void 0===t&&(t={}),this.address=t.address?new e(t.address):null,this.id=t.id||"",this.name=t.name||"",this.type=t.type||null,s(this,{address:i,id:i,name:i,type:i})},o=function(s){function i(){return null!==s&&s.apply(this,arguments)||this}return t(i,s),i}(n);export{o as GetAvailableStockLocation,n as GetAvailableStockLocationData};
@@ -0,0 +1 @@
1
+ import{__extends as t}from'../../ext/tslib/tslib.es6.js';import{makeObservable as s,observable as i}from"mobx";import{GetAvailableStockLocationAddressCityData as o}from"./GetAvailableStockLocationAddressCity.js";var n=function(t){void 0===t&&(t={}),this.address=t.address||null,this.city=t.city?new o(t.city):null,this.country=t.country?new o(t.country):null,this.district=t.district?new o(t.district):null,this.phone=t.phone||null,this.postalCode=t.postalCode||null,this.state=t.state?new o(t.state):null,s(this,{address:i,city:i,country:i,district:i,phone:i,postalCode:i,state:i})};!function(s){function i(){return null!==s&&s.apply(this,arguments)||this}t(i,s)}(n);export{n as GetAvailableStockLocationAddressData};
@@ -0,0 +1 @@
1
+ import{__extends as i}from'../../ext/tslib/tslib.es6.js';import{makeObservable as n,observable as o}from"mobx";var t=function(i){void 0===i&&(i={}),this.code=i.code||null,this.id=i.id||null,this.name=i.name||null,n(this,{code:o,id:o,name:o})};!function(n){function o(){return null!==n&&n.apply(this,arguments)||this}i(o,n)}(t);export{t as GetAvailableStockLocationAddressCityData};
@@ -0,0 +1 @@
1
+ import{__awaiter as t,__generator as s}from'../../ext/tslib/tslib.es6.js';import{handleAPIError as o,APIResponse as _}from'../../ext/@ikas/fe-api-client/build/utils/api.js';import e from'../../ext/@ikas/fe-api-client/build/utils/fetch-query.js';var a,i=function(a,i,n){return t(void 0,void 0,void 0,(function(){var t,S,d,O;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,e({operationName:"getAvailableStockLocations",config:n,variables:a,allReturnFields:c,fields:i,query:function(t){return"\n\t\t\t\tquery getAvailableStockLocations (\n\t\t\t\t\t$lines: [CheckStocksLineInput!]!,\n\t\t\t\t\t$stockLocationIdList: [String!],\n\t\t\t\t) {\n\t\t\t\t\tgetAvailableStockLocations (\n\t\t\t\t\t\tlines: $lines,\n\t\t\t\t\t\tstockLocationIdList: $stockLocationIdList,\n\t\t\t\t\t) ".concat(t,"\n\t\t\t\t}\n\t\t\t")}})];case 1:return t=s.sent(),S=t.data,d=t.errors,[2,new _(null==S?void 0:S.getAvailableStockLocations,d)];case 2:return O=s.sent(),[2,o(O)];case 3:return[2]}}))}))},c="{stockLocations {address {address city {code id name } country {code id name } district {code id name } phone postalCode state {code id name } } id name type } }";!function(t){t.STOCK_LOCATIONS__ADDRESS__ADDRESS="stockLocations.address.address",t.STOCK_LOCATIONS__ADDRESS__CITY__CODE="stockLocations.address.city.code",t.STOCK_LOCATIONS__ADDRESS__CITY__ID="stockLocations.address.city.id",t.STOCK_LOCATIONS__ADDRESS__CITY__NAME="stockLocations.address.city.name",t.STOCK_LOCATIONS__ADDRESS__COUNTRY__CODE="stockLocations.address.country.code",t.STOCK_LOCATIONS__ADDRESS__COUNTRY__ID="stockLocations.address.country.id",t.STOCK_LOCATIONS__ADDRESS__COUNTRY__NAME="stockLocations.address.country.name",t.STOCK_LOCATIONS__ADDRESS__DISTRICT__CODE="stockLocations.address.district.code",t.STOCK_LOCATIONS__ADDRESS__DISTRICT__ID="stockLocations.address.district.id",t.STOCK_LOCATIONS__ADDRESS__DISTRICT__NAME="stockLocations.address.district.name",t.STOCK_LOCATIONS__ADDRESS__PHONE="stockLocations.address.phone",t.STOCK_LOCATIONS__ADDRESS__POSTAL_CODE="stockLocations.address.postalCode",t.STOCK_LOCATIONS__ADDRESS__STATE__CODE="stockLocations.address.state.code",t.STOCK_LOCATIONS__ADDRESS__STATE__ID="stockLocations.address.state.id",t.STOCK_LOCATIONS__ADDRESS__STATE__NAME="stockLocations.address.state.name",t.STOCK_LOCATIONS__ID="stockLocations.id",t.STOCK_LOCATIONS__NAME="stockLocations.name",t.STOCK_LOCATIONS__TYPE="stockLocations.type"}(a||(a={}));export{a as ResponseField,i as default};
@@ -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",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 and SMS 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",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 +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",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 ve SMS 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",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 +1 @@
1
- import*as e from"react";import{observer as t}from"mobx-react-lite";import s from"../../style.module.scss.js";import r from"../select-box/index.js";import{AddressForm as d}from"../address-form/index.js";import{Checkbox as o}from"../checkbox/index.js";import{FormItem as i}from"../form-item/index.js";import{FormItemType as a}from"../form-item/model.js";import l from"./style.module.scss.js";import n from"../../styles/common.module.scss.js";import{Button as c}from"../button/index.js";import{IkasStorefrontConfig as m}from"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{useTranslation as u}from"../../../../utils/i18n.js";import v from"../delivery-methods/index.js";import{CheckoutStep as p}from"../../model.js";var g=t((function(t){var d,o=t.vm,i=u().t,a=e.useMemo((function(){return e.createElement("div",null,e.createElement(h,{vm:o}),e.createElement(C,{vm:o}))}),[o]),g=e.useMemo((function(){return e.createElement("div",null,e.createElement(E,{vm:o}))}),[o]),k=e.useState("-1"),f=k[0],A=k[1];return e.useEffect((function(){o.vm.checkout.stockLocationId&&A(o.vm.checkout.stockLocationId)}),[]),e.createElement(e.Fragment,null,!!m.pickUpStockLocationIds&&o.vm.step!==p.PAYMENT&&e.createElement(e.Fragment,null,e.createElement("div",{className:n.FormSectionTitle},e.createElement("div",{className:n.Title},i("checkout-page:deliveryMethod"))),e.createElement(v,{deliveryMethod:o.vm.deliveryMethod,onClick:function(e){"address"===e&&A("-1"),o.vm.onDeliveryMethodChange(e)}})),e.createElement("div",{className:n.FormSectionTitle},"address"===o.vm.deliveryMethod?e.createElement("div",{className:n.Title},o.editingCustomerAddress?i("checkout-page:editAddress"):"billing"===o.addressType?i("checkout-page:billingAddress"):i("checkout-page:shippingAddress")):e.createElement("div",{className:n.Title},i("checkout-page:pickUpLocation"),e.createElement("span",{className:l.ErrorMessage},o.vm.isErrorsVisible&&!o.vm.checkout.stockLocationId&&i("checkout-page:errorPickupLocationRequired"))),!!o.editingCustomerAddress&&e.createElement("div",{className:l.CancelEdit,onClick:o.onCancelEditAddressClick},i("checkout-page:actions.cancel"))),!!o.vm.store.customerStore.customer&&!o.editingCustomerAddress&&"address"===o.vm.deliveryMethod&&e.createElement("div",{className:s.RowPB},null===(d=o.vm.store.customerStore.customer.addresses)||void 0===d?void 0:d.map((function(t){return e.createElement(r,{key:t.id,label:t.title||"",isSelected:t.id===o.selectedAddressId,rightContent:e.createElement("div",{onClick:function(){return o.onEditAddressClick(t)}},i("checkout-page:actions.edit")),bottomContent:e.createElement("div",{className:l.AddressText},t.addressText),bottomContentVisible:!0,hasError:!t.isValid,errorText:i("checkout-page:missingAddressFields"),onClick:function(){return t.id!==o.selectedAddressId&&o.onAddressSelect(t)}})})),e.createElement(r,{label:i("checkout-page:newAddress"),isSelected:"-1"===o.selectedAddressId,bottomContent:a,onClick:function(){return"-1"!==o.selectedAddressId&&o.onAddressSelect()}})),!o.vm.store.customerStore.customer&&"address"===o.vm.deliveryMethod&&a,"in-store"===o.vm.deliveryMethod&&e.createElement("div",{className:s.RowPB},o.vm.stockLocations.map((function(t){var s;return function(e){return e.address&&e.address.city&&e.address.country}(t)&&e.createElement(r,{key:t.id,label:t.name||"",isSelected:f===t.id,bottomContent:e.createElement("div",null,e.createElement("div",{className:l.AddressText},null===(s=t.address)||void 0===s?void 0:s.address),t.deliveryTime&&e.createElement("div",{className:l.DeliveryTime},i("checkout-page:stockLocation.deliveryTime.".concat(t.deliveryTime)))),bottomContentVisible:!0,onClick:function(){o.vm.onStockLocationChange(t),A(t.id)}})}))),"in-store"===o.vm.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:n.FormSectionTitle},e.createElement("div",{className:n.Title},i("checkout-page:recipientsInfo"))),g),!!o.editingCustomerAddress&&e.createElement(h,{vm:o}),!!o.editingCustomerAddress&&e.createElement("div",{className:l.EditAddressActions},e.createElement(c,{style:{width:"100%"},text:i("checkout-page:deleteAddress"),isLine:!0,isLoading:o.isDeleteAddressLoading,isDisabled:o.isEditAddressLoading,onClick:o.onDeleteAddressClick}),e.createElement(c,{style:{width:"100%",marginTop:o.vm.store.customerStore.customer?"0px":"32px"},text:i("checkout-page:actions.save"),isLoading:o.isEditAddressLoading,isDisabled:o.isDeleteAddressLoading,onClick:o.onSaveAddressClick})))})),h=t((function(t){var s=t.vm;return e.createElement(d,{address:s.editingCustomerAddress||s.address,isErrorsVisible:s.isEditAddressErrorsVisible||s.vm.isErrorsVisible,allowedCountryIds:s.vm.shippingCountryIds||void 0,allowCorporateInfo:"billing"===s.addressType,firstNameChangeCallback:s.firstNameChangeCallback,lastNameChangeCallback:s.lastNameChangeCallback,allowTitleChange:!!s.editingCustomerAddress,deliveryMethod:"address"})})),E=t((function(t){var s=t.vm;return e.createElement(d,{address:s.editingCustomerAddress||s.address,isErrorsVisible:s.isEditAddressErrorsVisible||s.vm.isErrorsVisible,firstNameChangeCallback:s.firstNameChangeCallback,lastNameChangeCallback:s.lastNameChangeCallback,deliveryMethod:"in-store"})})),C=t((function(t){var s=t.vm,r=u().t;return s.vm.store.customerStore.customer&&"-1"===s.selectedAddressId?e.createElement("div",{style:{marginTop:"12px"}},e.createElement(o,{value:s.vm.shouldSaveAddress,label:r("checkout-page:saveAddressCta"),onChange:s.vm.setShouldSaveAddress}),s.vm.shouldSaveAddress&&e.createElement("div",{style:{marginTop:"8px"}},e.createElement(i,{type:a.TEXT,label:r("checkout-page:addressTitle"),value:s.vm.addressTitle,onChange:s.vm.setAddressTitle}))):null}));export{h as CustomerAddressForm,E as RecipientForm,C as SaveAddressCheckboxAndTitle,g as default};
1
+ import*as e from"react";import{observer as s}from"mobx-react-lite";import t from"../../style.module.scss.js";import r from"../select-box/index.js";import{AddressForm as d}from"../address-form/index.js";import{Checkbox as o}from"../checkbox/index.js";import{FormItem as a}from"../form-item/index.js";import{FormItemType as i}from"../form-item/model.js";import n from"./style.module.scss.js";import l from"../../styles/common.module.scss.js";import{Button as c}from"../button/index.js";import{IkasStorefrontConfig as m}from"../../../../storefront/index.js";import'../../../../ext/lodash/isArguments.js';import'../../../../ext/lodash/isBuffer.js';import'../../../../ext/lodash/isTypedArray.js';import'../../../../ext/lodash/_baseGetTag.js';import{useTranslation as u}from"../../../../utils/i18n.js";import v from"../delivery-methods/index.js";import{CheckoutStep as p}from"../../model.js";var h=s((function(s){var d,o=s.vm,a=u().t,i=e.useMemo((function(){return e.createElement("div",null,e.createElement(g,{vm:o}),e.createElement(C,{vm:o}))}),[o]),h=e.useMemo((function(){return e.createElement("div",null,e.createElement(E,{vm:o}))}),[o]),k=e.useState("-1"),f=k[0],A=k[1];e.useEffect((function(){o.vm.checkout.stockLocationId&&A(o.vm.checkout.stockLocationId)}),[]);var y=function(e){if(!e.address)return"";var s=[];return e.address.address&&s.push(e.address.address),e.address.postalCode&&s.push(e.address.postalCode),e.address.district&&e.address.district.name&&s.push(e.address.district.name),e.address.city&&e.address.city.name&&s.push(e.address.city.name),e.address.state&&e.address.state.name&&"Default"!==e.address.state.name&&s.push(e.address.state.name),e.address.country&&e.address.country.name&&s.push(e.address.country.name),s.join(", ")};return e.createElement(e.Fragment,null,!!m.pickUpStockLocationIds&&o.vm.availableStockLocations.length>0&&o.vm.step!==p.PAYMENT&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},a("checkout-page:deliveryMethod"))),e.createElement(v,{deliveryMethod:o.vm.deliveryMethod,onClick:function(e){"address"===e&&A("-1"),o.vm.onDeliveryMethodChange(e)}})),e.createElement("div",{className:l.FormSectionTitle},"address"===o.vm.deliveryMethod?e.createElement("div",{className:l.Title},o.editingCustomerAddress?a("checkout-page:editAddress"):"billing"===o.addressType?a("checkout-page:billingAddress"):a("checkout-page:shippingAddress")):e.createElement("div",{className:l.Title},a("checkout-page:pickUpLocation"),e.createElement("span",{className:n.ErrorMessage},o.vm.isErrorsVisible&&!o.vm.checkout.stockLocationId&&a("checkout-page:errorPickupLocationRequired"))),!!o.editingCustomerAddress&&e.createElement("div",{className:n.CancelEdit,onClick:o.onCancelEditAddressClick},a("checkout-page:actions.cancel"))),!!o.vm.store.customerStore.customer&&!o.editingCustomerAddress&&"address"===o.vm.deliveryMethod&&e.createElement("div",{className:t.RowPB},null===(d=o.vm.store.customerStore.customer.addresses)||void 0===d?void 0:d.map((function(s){return e.createElement(r,{key:s.id,label:s.title||"",isSelected:s.id===o.selectedAddressId,rightContent:e.createElement("div",{onClick:function(){return o.onEditAddressClick(s)}},a("checkout-page:actions.edit")),bottomContent:e.createElement("div",{className:n.AddressText},s.addressText),bottomContentVisible:!0,hasError:!s.isValid,errorText:a("checkout-page:missingAddressFields"),onClick:function(){return s.id!==o.selectedAddressId&&o.onAddressSelect(s)}})})),e.createElement(r,{label:a("checkout-page:newAddress"),isSelected:"-1"===o.selectedAddressId,bottomContent:i,onClick:function(){return"-1"!==o.selectedAddressId&&o.onAddressSelect()}})),!o.vm.store.customerStore.customer&&"address"===o.vm.deliveryMethod&&i,"in-store"===o.vm.deliveryMethod&&e.createElement("div",{className:t.RowPB},o.vm.stockLocations.map((function(s){return function(e){return e.address&&e.address.address&&e.address.city&&e.address.country&&o.vm.availableStockLocations.find((function(s){return s.id===e.id}))}(s)&&e.createElement(r,{key:s.id,label:s.name||"",isSelected:f===s.id,bottomContent:e.createElement("div",null,e.createElement("div",{className:n.AddressText},y(s)),s.deliveryTime&&e.createElement("div",{className:n.DeliveryTime},a("checkout-page:stockLocation.deliveryTime.".concat(s.deliveryTime)))),bottomContentVisible:!0,onClick:function(){o.vm.onStockLocationChange(s),A(s.id)}})}))),"in-store"===o.vm.deliveryMethod&&e.createElement(e.Fragment,null,e.createElement("div",{className:l.FormSectionTitle},e.createElement("div",{className:l.Title},a("checkout-page:recipientsInfo"))),h),!!o.editingCustomerAddress&&e.createElement(g,{vm:o}),!!o.editingCustomerAddress&&e.createElement("div",{className:n.EditAddressActions},e.createElement(c,{style:{width:"100%"},text:a("checkout-page:deleteAddress"),isLine:!0,isLoading:o.isDeleteAddressLoading,isDisabled:o.isEditAddressLoading,onClick:o.onDeleteAddressClick}),e.createElement(c,{style:{width:"100%",marginTop:o.vm.store.customerStore.customer?"0px":"32px"},text:a("checkout-page:actions.save"),isLoading:o.isEditAddressLoading,isDisabled:o.isDeleteAddressLoading,onClick:o.onSaveAddressClick})))})),g=s((function(s){var t=s.vm;return e.createElement(d,{address:t.editingCustomerAddress||t.address,isErrorsVisible:t.isEditAddressErrorsVisible||t.vm.isErrorsVisible,allowedCountryIds:t.vm.shippingCountryIds||void 0,allowCorporateInfo:"billing"===t.addressType,firstNameChangeCallback:t.firstNameChangeCallback,lastNameChangeCallback:t.lastNameChangeCallback,allowTitleChange:!!t.editingCustomerAddress,deliveryMethod:"address"})})),E=s((function(s){var t=s.vm;return e.createElement(d,{address:t.editingCustomerAddress||t.address,isErrorsVisible:t.isEditAddressErrorsVisible||t.vm.isErrorsVisible,firstNameChangeCallback:t.firstNameChangeCallback,lastNameChangeCallback:t.lastNameChangeCallback,deliveryMethod:"in-store"})})),C=s((function(s){var t=s.vm,r=u().t;return t.vm.store.customerStore.customer&&"-1"===t.selectedAddressId?e.createElement("div",{style:{marginTop:"12px"}},e.createElement(o,{value:t.vm.shouldSaveAddress,label:r("checkout-page:saveAddressCta"),onChange:t.vm.setShouldSaveAddress}),t.vm.shouldSaveAddress&&e.createElement("div",{style:{marginTop:"8px"}},e.createElement(a,{type:i.TEXT,label:r("checkout-page:addressTitle"),value:t.vm.addressTitle,onChange:t.vm.setAddressTitle}))):null}));export{g as CustomerAddressForm,E as RecipientForm,C as SaveAddressCheckboxAndTitle,h as default};
@@ -11,6 +11,7 @@ import { RetrieveInstallmentInfoResponse } from "../../__api/models/RetrieveInst
11
11
  import { QueryParams as RetrieveInstallmentInfoQueryParams } from "../../__api/mutations/retrieveInstallmentInfo";
12
12
  import { SaveCartInput } from "../../__api/models/SaveCartInput";
13
13
  import { StockLocation } from "src/__api/models/StockLocation";
14
+ import { GetAvailableStockLocation } from "src/__api/models/GetAvailableStockLocation";
14
15
  export default class CheckoutViewModel {
15
16
  checkout: IkasCheckout;
16
17
  checkoutSettings: IkasCheckoutSettings;
@@ -35,6 +36,7 @@ export default class CheckoutViewModel {
35
36
  selectedShippingAddressId?: string;
36
37
  selectedBillingAddressId?: string;
37
38
  stockLocations: StockLocation[];
39
+ availableStockLocations: GetAvailableStockLocation[];
38
40
  deliveryMethod: "address" | "in-store";
39
41
  returnPolicy: string;
40
42
  privacyPolicy: string;
@@ -70,6 +72,7 @@ export default class CheckoutViewModel {
70
72
  removeUnavailableItems: (items: IkasOrderLineItem[]) => Promise<void>;
71
73
  getShippingCountries: () => Promise<void>;
72
74
  getStockLocations: () => Promise<void>;
75
+ getAvailableStockLocations: () => Promise<void>;
73
76
  checkShippingCountries: () => void;
74
77
  onDeliveryMethodChange: (deliveryMethod: "address" | "in-store") => void;
75
78
  initialStockCheck: () => 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 l}from"../../storefront/index.js";import{IkasCheckoutSettings as u}from"../../models/data/checkout-settings/index.js";import{Analytics as h}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import p from"../../models/data/checkout/index.js";import m from"../../store/customer/api.js";import f from"../../store/merchant/index.js";import v from"../../store/checkout/index.js";import{CheckStocksLineInput as g}from"../../__api/models/CheckStocksLineInput.js";import y from"../../store/cart/api.js";import{SaveCartInput as S}from"../../__api/models/SaveCartInput.js";import{PaymentMethodEnum as k,PaymentGatewayTypeEnum as b,TransactionStatusEnum as I}from"../../__api/types/index.js";import C from'../../ext/uuid/dist/esm-node/v4.js';var A,P,j=/^\d+$/,w="undefined"==typeof localStorage,x=function(){function j(j,x,E,O,T,D,G,_){var M=this;this.checkout=new p,this.checkoutSettings=new u,this.storefront=null,this.store=l.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=A.INFO,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!1,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],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,d,c;return e(this,(function(e){switch(e.label){case 0:if(l.isEditor)return this.step=A.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===A.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(A.INFO)];if(this.step!==A.PAYMENT||this.canProceedToPayment){if(![A.INFO,A.SUCCESS,A.SHIPPING,A.PAYMENT].includes(this.step))return[2,this.changeStep(A.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(A.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:P.PAYMENT_ERROR,data:n||null}),this.step!==A.INFO?[3,3]:[4,this.getShippingCountries()];case 1:return e.sent(),this.checkShippingCountries(),[4,this.getStockLocations()];case 2:e.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),e.label=3;case 3:return this.step!==A.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=A.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==A.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==A.PAYMENT&&this.step!==A.SUCCESS?[3,7]:[4,this.listPaymentGateways()]:(this.error={type:P.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 4:return e.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,6];case 5:e.sent(),e.label=6;case 6:if(!this.paymentGateways.length)return this.error={type:P.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=7;case 7:return this.step===A.SUCCESS?[3,11]:this.checkout.isComplete?[2,this.changeStep(A.SUCCESS)]:[3,8];case 8:return[4,this.initialStockCheck()];case 9:e.sent(),e.label=10;case 10:return[3,13];case 11:return[4,m.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 12:r=e.sent(),this.successTransaction=r.isSuccess&&(null===(c=r.data)||void 0===c?void 0:c.length)?r.data[0]:void 0,this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===o}))),e.label=13;case 13: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,f.listMerchantSettings({})];case 1:t=e.sent(),this.merchantSettings=t.data||void 0,e.label=2;case 2:return[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 S(this.checkout)).cartId=this.checkout.id,"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return[4,y.saveCart({input:t})];case 3:if((null==(i=e.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(n=s.extensions)||void 0===n?void 0:n.code)?{type: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.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,u,h,p;return e(this,(function(e){switch(e.label){case 0:return t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,v.checkStocks({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.stockLocationIds||[]})];case 1:if(!(i=e.sent()).isSuccess)throw{type:P.API_ERROR};if(null==(s=null===(h=null===(u=i.data)||void 0===u?void 0:u.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(p=o.store.cartStore.cart)||void 0===p?void 0:p.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=this,a=0,d=s;a<d.length;a++)c=d[a],r(c);throw{type: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,v.getAvailableShippingCountries({salesChannelId:l.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 l.pickUpStockLocationIds?[4,v.listStockLocation({id:{in:l.pickUpStockLocationIds}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:P.API_ERROR},[2];this.stockLocations=t.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,u=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=l.paymentGateways.map((function(t){return t.id})),[4,v.listPaymentGateway({id:t?void 0:{in:i}})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===A.PAYMENT&&(n=n.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(u.checkout.currencyCode)})),(o=null===(c=this.checkout.shippingAddress)||void 0===c?void 0:c.country)&&o.iso2&&(n=n.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(o.iso2||"")})))),a=[],r(l.paymentGateways,"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),[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,v.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:if(!this.checkout.couponCode)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,y.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode})];case 2: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,4];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},this.onCouponCodeDelete=function(){return t(M,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.saveCart()];case 1:return(t=e.sent())&&(s=this.checkout,this.checkout=new p(i(i({},t),{shippingAddress:s.shippingAddress,billingAddress:s.billingAddress,customer:s.customer,selectedPaymentGateway:s.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)||R(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=N(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)||R(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=N(a,2).join(" / "))}},this.onCvcChange=function(t){M.cardData&&(t.length>M.cardData.cvv.length&&!R(t)||t.length>4||(M.cardData.cvv=t))},this.saveAddress=function(s){return t(M,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.shouldSaveAddress?(t=new o(i(i({},"shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress),{title:this.addressTitle||this.t("checkout-page:newAddress"),id:C()})),(r=n(this.store.customerStore.customer)).addresses||(r.addresses=[]),r.addresses.push(t),[4,this.store.customerStore.saveCustomer(r)]):[3,2];case 1:e.sent(),"shipping"===s?(this.checkout.shippingAddress.id=t.id,this.selectedShippingAddressId=t.id||"-1"):(this.checkout.billingAddress.id=t.id,this.selectedBillingAddressId=t.id||"-1"),e.label=2;case 2: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,v.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.onCheckoutTransactionSuccess()]:[3,3];case 2:return e.sent(),[3,4];case 3: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=4;case 4: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=x,this.router=O,this.returnPolicy=T,this.privacyPolicy=D,this.termsOfService=G,this.t=_,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 N(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function R(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,x as default};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from'../../ext/lodash/cloneDeep.js';import r from'../../ext/lodash/sortBy.js';import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import{IkasCustomerAddress as o}from"../../models/data/customer/address/index.js";import"../../models/data/customer/attribute-value/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-attribute/customer-attribute-option/index.js";import"../../models/data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../models/data/customer-attribute/index.js";import"../../models/data/customer-review/index.js";import"../../models/data/customer-review-summary/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/merchant-settings/index.js";import{IkasOrderAddress as a}from"../../models/data/order/address/index.js";import"../../models/data/order/adjustment/index.js";import{IkasOrderCustomer as d}from"../../models/data/order/customer/index.js";import"../../models/data/order/gift-line/index.js";import"../../models/data/order/invoice/index.js";import"../../models/data/order/line-item/discount/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/option/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/tracking-info/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/payment-method/index.js";import"../../models/data/order/refund/line-item/index.js";import"../../models/data/order/shipping-line/index.js";import"../../models/data/order/tax-line/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/product-campaign/campaign/index.js";import"../../models/data/product-campaign/filter/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import"../../models/data/state/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/theme/theme.js";import"../../models/theme/page/index.js";import"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import"../../models/data/payment-gateway/index.js";import c from"./components/credit-card-form/model.js";import{IkasStorefrontConfig as l}from"../../storefront/index.js";import{IkasCheckoutSettings as u}from"../../models/data/checkout-settings/index.js";import{Analytics as h}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import p from"../../models/data/checkout/index.js";import m from"../../store/customer/api.js";import v from"../../store/merchant/index.js";import f from"../../store/checkout/index.js";import{CheckStocksLineInput as g}from"../../__api/models/CheckStocksLineInput.js";import y from"../../store/cart/api.js";import{SaveCartInput as S}from"../../__api/models/SaveCartInput.js";import{PaymentMethodEnum as k,PaymentGatewayTypeEnum as b,TransactionStatusEnum as I}from"../../__api/types/index.js";import C from'../../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 _=this;this.checkout=new p,this.checkoutSettings=new u,this.storefront=null,this.store=l.store,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.step=A.INFO,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!1,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(_,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(_,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c;return e(this,(function(e){switch(e.label){case 0:if(l.isEditor)return this.step=A.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===A.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(A.INFO)];if(this.step!==A.PAYMENT||this.canProceedToPayment){if(![A.INFO,A.SUCCESS,A.SHIPPING,A.PAYMENT].includes(this.step))return[2,this.changeStep(A.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(A.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type: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===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=A.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==A.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==A.PAYMENT&&this.step!==A.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type: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,m.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 13:r=e.sent(),this.successTransaction=r.isSuccess&&(null===(c=r.data)||void 0===c?void 0:c.length)?r.data[0]:void 0,this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===o}))),e.label=14;case 14:return this.isCheckoutLoaded=!0,h.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getMerchantSettings=function(){return t(_,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.saveCart=function(){return t(_,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return(t=new S(this.checkout)).cartId=this.checkout.id,"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return[4,y.saveCart({input:t})];case 3:if((null==(i=e.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(n=s.extensions)||void 0===n?void 0:n.code)?{type:P.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:P.API_ERROR};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(_,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(_,void 0,void 0,(function(){var t,i,s,n,r,o,a,d,c,u,h,p;return e(this,(function(e){switch(e.label){case 0:return t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,f.checkStocks({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.stockLocationIds||[]})];case 1:if(!(i=e.sent()).isSuccess)throw{type:P.API_ERROR};if(null==(s=null===(h=null===(u=i.data)||void 0===u?void 0:u.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=null===(p=o.store.cartStore.cart)||void 0===p?void 0:p.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push(e)},o=this,a=0,d=s;a<d.length;a++)c=d[a],r(c);throw{type:P.STOCK_ERROR,data:n}}return[2]}}))}))},this.removeUnavailableItems=function(i){return t(_,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(_,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,f.getAvailableShippingCountries({salesChannelId:l.salesChannelId})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(_,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return l.pickUpStockLocationIds?[4,f.listStockLocation({id:{in:l.pickUpStockLocationIds}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:P.API_ERROR},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(_,void 0,void 0,(function(){var t,i,s;return e(this,(function(e){switch(e.label){case 0:return l.pickUpStockLocationIds?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,f.getAvailableStockLocations({lines:t.map((function(t){return new g(t)})),stockLocationIdList:l.pickUpStockLocationIds})]):[3,2];case 1:if(!(i=e.sent()).isSuccess||!(null===(s=i.data)||void 0===s?void 0:s.length))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=_.shippingCountryIds)||void 0===t?void 0:t.length)||(_.error={type:P.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(_.checkout.stockLocationId=null),_.deliveryMethod=t,_.isErrorsVisible=!1},this.initialStockCheck=function(){return t(_,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(_,void 0,void 0,(function(){var t,i,s,n,o,a,d,c,u=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=l.paymentGateways.map((function(t){return t.id})),[4,f.listPaymentGateway({id:t?void 0:{in:i}})];case 1:return(s=e.sent()).isSuccess&&(null===(d=s.data)||void 0===d?void 0:d.length)?(n=s.data,this.step===A.PAYMENT&&(n=n.filter((function(t){return!t.supportedCurrencies.length||t.supportedCurrencies.includes(u.checkout.currencyCode)})),(o=null===(c=this.checkout.shippingAddress)||void 0===c?void 0:c.country)&&o.iso2&&(n=n.filter((function(t){return!t.availableCountries.length||t.availableCountries.includes(o.iso2||"")})))),a=[],r(l.paymentGateways,"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),[2]):(this.error={type:P.API_ERROR},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(_,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;_.store.customerStore.customer?(null===(t=_.store.customerStore.customer.addresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=_.checkoutSettings})),_.checkout.customer=new d(_.store.customerStore.customer)):_.checkout.customer||(_.checkout.customer=new d({}))},this.createShippingAddress=function(){var t;if(_.checkout.shippingAddress)_.selectedShippingAddressId=_.checkout.shippingAddress.id||"-1",_.checkout.shippingAddress.checkoutSettings=_.checkoutSettings;else{var e=null===(t=_.store.customerStore.customer)||void 0===t?void 0:t.addresses;_.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}},this.createBillingAddress=function(){"undefined"!=typeof localStorage&&(_.useDifferentAddress=!!localStorage.getItem("sAddr"),_.useDifferentAddress?(_.checkout.billingAddress&&(_.selectedBillingAddressId=_.checkout.billingAddress.id||"-1"),_.checkout.billingAddress=_.checkout.billingAddress||new a):_.checkout.billingAddress=new a(n(_.checkout.shippingAddress)||{}),_.checkout.billingAddress.checkoutSettings=_.checkoutSettings)},this.onShippingMethodChange=function(i){return t(_,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(_,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(_,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(!this.checkout.couponCode)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,y.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode})];case 2: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,4];case 3:return e.sent(),[3,4];case 4:return[2]}}))}))},this.onCouponCodeDelete=function(){return t(_,void 0,void 0,(function(){var t,s;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.saveCart()];case 1:return(t=e.sent())&&(s=this.checkout,this.checkout=new p(i(i({},t),{shippingAddress:s.shippingAddress,billingAddress:s.billingAddress,customer:s.customer,selectedPaymentGateway:s.selectedPaymentGateway}))),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e,i;if(_.selectedShippingAddressId=t,"-1"===t)_.checkout.shippingAddress=new a;else{var s=null===(i=null===(e=_.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(_.checkout.shippingAddress=new a(s))}_.checkout.shippingAddress&&(_.checkout.shippingAddress.checkoutSettings=_.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e,i;if(_.selectedBillingAddressId=t,"-1"===t)_.checkout.billingAddress=new a;else{var s=null===(i=null===(e=_.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===i?void 0:i.find((function(e){return e.id===t}));s&&(_.checkout.billingAddress=new a(s))}_.checkout.billingAddress&&(_.checkout.billingAddress.checkoutSettings=_.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){_.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(_.cardData&&(!(t.length>_.cardData.cardNumber.length)||N(t))){var e=(_.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!_.installmentInfo?_.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:_.checkout.selectedPaymentGateway.id,price:_.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(_.cardData.installmentCount=1,_.installmentInfo=void 0),_.cardData.cardNumber=x(i,4).join(" "))}},this.onCardHolderNameChange=function(t){_.cardData&&(_.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(_.cardData&&(!(t.length>_.cardData.expirationDate.length)||N(t))){if(0===(null===(e=_.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(_.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(_.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var a=t.split(" / ").join("");a.length>4||(_.cardData.expirationDate=x(a,2).join(" / "))}},this.onCvcChange=function(t){_.cardData&&(t.length>_.cardData.cvv.length&&!N(t)||t.length>4||(_.cardData.cvv=t))},this.saveAddress=function(s){return t(_,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return this.shouldSaveAddress?(t=new o(i(i({},"shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress),{title:this.addressTitle||this.t("checkout-page:newAddress"),id:C()})),(r=n(this.store.customerStore.customer)).addresses||(r.addresses=[]),r.addresses.push(t),[4,this.store.customerStore.saveCustomer(r)]):[3,2];case 1:e.sent(),"shipping"===s?(this.checkout.shippingAddress.id=t.id,this.selectedShippingAddressId=t.id||"-1"):(this.checkout.billingAddress.id=t.id,this.selectedBillingAddressId=t.id||"-1"),e.label=2;case 2:return[2]}}))}))},this.onGoToCartClick=function(){_.router.push("/cart")},this.onBackToShoppingClick=function(){_.router.push("/")},this.onProceedToShippingClick=function(){return t(_,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(_,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(_,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(_,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.onCheckoutTransactionSuccess()]:[3,3];case 2:return e.sent(),[3,4];case 3: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=4;case 4:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(_,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(){_.changeStep(A.INFO)},this.onBackToShippingClick=function(){_.changeStep(A.SHIPPING)},this.setCustomerConsentGranted=function(t){_.checkout.customer&&(_.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){_.useDifferentAddress=t,_.useDifferentAddress?(localStorage.setItem("sAddr","1"),_.checkout.billingAddress=_.checkout.billingAddress||new a):(localStorage.removeItem("sAddr"),_.checkout.billingAddress=_.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){_.shouldSaveAddress=t},this.setAddressTitle=function(t){_.addressTitle=t},this.setPaymentGateway=function(t){if(_.paymentGateways.length){var e=_.paymentGateways[t];_.checkout.selectedPaymentGateway=e,_.step!==A.SUCCESS&&(e.paymentMethodType===k.CREDIT_CARD&&e.type===b.INTERNAL&&(_.cardData=new c),_.installmentInfo=void 0)}},this.setInstallmentCount=function(t){_.cardData&&(_.cardData.installmentCount=t)},this.changeStep=function(i){return t(_,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(_,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){_.isContactModalVisible=t},this.checkout=j,this.checkoutSettings=R,this.router=O,this.returnPolicy=T,this.privacyPolicy=D,this.termsOfService=L,this.t=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};
@@ -5,10 +5,12 @@ import { QueryParams as CheckStocksQueryParams } from "src/__api/queries/checkSt
5
5
  import { QueryParams as ListCheckoutSettingsQueryParams } from "src/__api/queries/listCheckoutSettings";
6
6
  import { QueryParams as GetAvailableShippingCountriesQueryParams } from "src/__api/queries/getAvailableShippingCountries";
7
7
  import { QueryParams as ListStockLocationQueryParams } from "src/__api/queries/listStockLocation";
8
+ import { QueryParams as GetAvailableStockLocationQueryParams } from "src/__api/queries/getAvailableStockLocations";
8
9
  import { APIResponse } from "@ikas/fe-api-client";
9
10
  import { IkasCheckoutSettings } from "src/models/data/checkout-settings";
10
11
  import { IkasPaymentGateway } from "src/models/data/payment-gateway";
11
12
  import { StockLocation } from "../../__api/models/StockLocation";
13
+ import { GetAvailableStockLocation } from "../../__api/models/GetAvailableStockLocation";
12
14
  export default class CheckoutStore {
13
15
  static createSaleTransactionWithCart(params: CreateSaleTransaction): Promise<APIResponse<undefined> | APIResponse<import("../../__api/types").TransactionResponse>>;
14
16
  static listPaymentGateway(params: ListPaymentGatewayQueryParams): Promise<APIResponse<IkasPaymentGateway[]>>;
@@ -17,4 +19,5 @@ export default class CheckoutStore {
17
19
  static listCheckoutSettings(params: ListCheckoutSettingsQueryParams): Promise<APIResponse<IkasCheckoutSettings[]>>;
18
20
  static getAvailableShippingCountries(params: GetAvailableShippingCountriesQueryParams): Promise<APIResponse<undefined> | APIResponse<string[]>>;
19
21
  static listStockLocation(params: ListStockLocationQueryParams): Promise<APIResponse<StockLocation[]>>;
22
+ static getAvailableStockLocations(params: GetAvailableStockLocationQueryParams): Promise<APIResponse<GetAvailableStockLocation[]>>;
20
23
  }
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'../../ext/tslib/tslib.es6.js';import e from"../../__api/mutations/createSaleTransactionWithCart.js";import n from"../../__api/queries/listPaymentGateway.js";import r from"../../__api/mutations/retrieveInstallmentInfo.js";import o from"../../__api/queries/checkStocks.js";import s from"../../__api/queries/listCheckoutSettings.js";import a from"../../__api/queries/getAvailableShippingCountries.js";import u from"../../__api/queries/listStockLocation.js";import{APIResponse as c}from'../../ext/@ikas/fe-api-client/build/utils/api.js';import'../../ext/axios/lib/axios.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{IkasCheckoutSettings as l}from"../../models/data/checkout-settings/index.js";import{IkasPaymentGateway as d}from"../../models/data/payment-gateway/index.js";import{StockLocation as m}from"../../__api/models/StockLocation.js";var f=function(){function f(){}return f.createSaleTransactionWithCart=function(n){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,e(n)];case 1:return[2,t.sent()]}}))}))},f.listPaymentGateway=function(e){var r;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,n(e)];case 1:return t=i.sent(),[2,new c(null===(r=t.data)||void 0===r?void 0:r.map((function(t){return new d(t)})),t.graphQLErrors)]}}))}))},f.retrieveInstallmentInfo=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,r(e)];case 1:return[2,t.sent()]}}))}))},f.checkStocks=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,o(e)];case 1:return[2,t.sent()]}}))}))},f.listCheckoutSettings=function(e){var n;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,s(e)];case 1:return t=i.sent(),[2,new c(null===(n=t.data)||void 0===n?void 0:n.map((function(t){return new l(t)})),t.graphQLErrors)]}}))}))},f.getAvailableShippingCountries=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a(e)];case 1:return[2,t.sent()]}}))}))},f.listStockLocation=function(e){var n;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,u(e)];case 1:return t=i.sent(),[2,new c(null===(n=t.data)||void 0===n?void 0:n.map((function(t){return new m(t)})),t.graphQLErrors)]}}))}))},f}();export{f as default};
1
+ import{__awaiter as t,__generator as i}from'../../ext/tslib/tslib.es6.js';import e from"../../__api/mutations/createSaleTransactionWithCart.js";import n from"../../__api/queries/listPaymentGateway.js";import r from"../../__api/mutations/retrieveInstallmentInfo.js";import o from"../../__api/queries/checkStocks.js";import s from"../../__api/queries/listCheckoutSettings.js";import a from"../../__api/queries/getAvailableShippingCountries.js";import u from"../../__api/queries/listStockLocation.js";import c from"../../__api/queries/getAvailableStockLocations.js";import{APIResponse as l}from'../../ext/@ikas/fe-api-client/build/utils/api.js';import'../../ext/axios/lib/axios.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_defineProperty.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_baseGetTag.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_stringToPath.js';import'../../ext/@ikas/fe-api-client/build/ext/lodash/_baseToString.js';import{IkasCheckoutSettings as d}from"../../models/data/checkout-settings/index.js";import{IkasPaymentGateway as m}from"../../models/data/payment-gateway/index.js";import{StockLocation as f}from"../../__api/models/StockLocation.js";import{GetAvailableStockLocation as p}from"../../__api/models/GetAvailableStockLocation.js";var h=function(){function h(){}return h.createSaleTransactionWithCart=function(n){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,e(n)];case 1:return[2,t.sent()]}}))}))},h.listPaymentGateway=function(e){var r;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,n(e)];case 1:return t=i.sent(),[2,new l(null===(r=t.data)||void 0===r?void 0:r.map((function(t){return new m(t)})),t.graphQLErrors)]}}))}))},h.retrieveInstallmentInfo=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,r(e)];case 1:return[2,t.sent()]}}))}))},h.checkStocks=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,o(e)];case 1:return[2,t.sent()]}}))}))},h.listCheckoutSettings=function(e){var n;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,s(e)];case 1:return t=i.sent(),[2,new l(null===(n=t.data)||void 0===n?void 0:n.map((function(t){return new d(t)})),t.graphQLErrors)]}}))}))},h.getAvailableShippingCountries=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a(e)];case 1:return[2,t.sent()]}}))}))},h.listStockLocation=function(e){var n;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,u(e)];case 1:return t=i.sent(),[2,new l(null===(n=t.data)||void 0===n?void 0:n.map((function(t){return new f(t)})),t.graphQLErrors)]}}))}))},h.getAvailableStockLocations=function(e){var n;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,c(e)];case 1:return t=i.sent(),[2,new l(null===(n=t.data)||void 0===n?void 0:n.stockLocations.map((function(t){return new p(t)})),t.graphQLErrors)]}}))}))},h}();export{h as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "3.0.0-alpha.22",
3
+ "version": "3.0.0-alpha.24",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",