@ikas/storefront 6.1.0-beta.80 → 6.1.0-beta.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/components/checkout/components/hepsipay/index.js +1 -1
  2. package/build/components/checkout/model.js +1 -1
  3. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/formatIncompletePhoneNumber.js +1 -0
  4. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/es6/getCountries.js +1 -0
  5. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js +1 -0
  6. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountries.js +1 -0
  7. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/getCountryCallingCode.js +1 -0
  8. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/isSupportedCountry.js +1 -0
  9. package/build/ext/@ikas/popup-renderer/build/ext/libphonenumber-js/min/exports/parsePhoneNumber.js +1 -0
  10. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/ObserverComponent.js +1 -0
  11. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/index.js +1 -0
  12. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/observer.js +1 -0
  13. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/useObserver.js +1 -0
  14. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +1 -0
  15. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/assertEnvironment.js +1 -0
  16. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerBatching.js +1 -0
  17. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/observerFinalizationRegistry.js +1 -0
  18. package/build/ext/@ikas/popup-renderer/build/ext/mobx-react-lite/es/utils/printDebugValue.js +1 -0
  19. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -1
  20. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -1
  21. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -1
  22. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/get-countries.js +1 -0
  23. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/phone-input-item-view/index.js +1 -0
  24. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -1
  25. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -1
  26. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js +1 -1
  27. package/package.json +12 -12
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as n}from'./../../../../ext/tslib/tslib.es6.js';import*as a from"react";import{observer as i}from"mobx-react-lite";import"@adyen/adyen-web/dist/adyen.css";var o=i((function(i){var o=i.vm;i.isSelected;var r=a.useCallback((function(){if(o.hepsipayFrameInitResponse)if(window.HepsipaySdk){var a={frameUrl:o.hepsipayFrameInitResponse.frameUrl,frameDivId:"hepsipayFrameContainer",paymentStatusCallback:function(a){return e(void 0,void 0,void 0,(function(){return n(this,(function(e){return[2]}))}))},frameFailureCallback:function(){return console.error("Frame failed to load")},onPaymentFailureLogCallback:function(e){console.log("pa",e),console.error("Payment failed:",e)},onPaymentSuccessCallback:function(a){return e(void 0,void 0,void 0,(function(){return n(this,(function(e){return console.log("pa",a),a&&"hp-payment-success"===a.messageType&&(window.location.href=a.merchantCallBackUrl),[2]}))}))},maxHeight:"300",disableDynamicHeight:!1,showFramePaymentButton:!1,useApiCallOnSuccessCallback:!1,overrideFontFamily:"Inter",hideHeader:!1};window.HepsipaySdk.init(a)}else console.error("HepsipaySdk is not available")}),[o.hepsipayFrameInitResponse]);return a.useEffect((function(){var a=document.createElement("script");a.src="https://images.hepsiburada.net/hepsipay/packages/pf/hepsipay-0.3.1.min.js",a.async=!0,a.onload=r,a.onerror=function(){return console.error("Failed to load Hepsipay SDK")},document.body.appendChild(a);var i=function(a){return e(void 0,void 0,void 0,(function(){var e;return n(this,(function(n){return a.origin!==window.location.origin||((e=a.data).messageType,e.data),[2]}))}))};return window.addEventListener("message",i),function(){document.body.removeChild(a),window.removeEventListener("message",i)}}),[r]),a.createElement("div",null,a.createElement("div",{id:"hepsipayFrameContainer"}))}));export{o as HepsiPay};
1
+ import{__awaiter as e,__generator as n}from'./../../../../ext/tslib/tslib.es6.js';import*as a from"react";import{observer as i}from"mobx-react-lite";import"@adyen/adyen-web/dist/adyen.css";var o=i((function(i){var o=i.vm;i.isSelected;var r=a.useCallback((function(){if(o.hepsipayFrameInitResponse)if(window.HepsipaySdk){var a={frameUrl:o.hepsipayFrameInitResponse.frameUrl,frameDivId:"hepsipayFrameContainer",paymentStatusCallback:function(a){return e(void 0,void 0,void 0,(function(){return n(this,(function(e){return[2]}))}))},frameFailureCallback:function(){return console.error("Frame failed to load")},onPaymentFailureLogCallback:function(e){console.log("onPaymentFailureLogCallback",e)},onPaymentSuccessCallback:function(a){return e(void 0,void 0,void 0,(function(){return n(this,(function(e){return console.log("onPaymentSuccessCallback",a),a&&"hp-payment-success"===a.messageType&&(window.location.href=a.merchantCallBackUrl),[2]}))}))},maxHeight:"300",disableDynamicHeight:!1,showFramePaymentButton:!1,useApiCallOnSuccessCallback:!1,overrideFontFamily:"Inter",hideHeader:!1};window.HepsipaySdk.init(a)}else console.error("HepsipaySdk is not available")}),[o.hepsipayFrameInitResponse]);return a.useEffect((function(){var a=document.createElement("script");a.src="https://images.hepsiburada.net/hepsipay/packages/pf/hepsipay-0.3.1.min.js",a.async=!0,a.onload=r,a.onerror=function(){return console.error("Failed to load Hepsipay SDK")},document.body.appendChild(a);var i=function(a){return e(void 0,void 0,void 0,(function(){var e;return n(this,(function(n){return a.origin!==window.location.origin||((e=a.data).messageType,e.data),[2]}))}))};return window.addEventListener("message",i),function(){document.body.removeChild(a),window.removeEventListener("message",i)}}),[r]),a.createElement("div",null,a.createElement("div",{id:"hepsipayFrameContainer"}))}));export{o as HepsiPay};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasCorporateInvoiceRequirement as d,IkasPaymentMethodType as u,IkasPaymentGatewayType as l,IkasOrderShippingMethod as h,IkasOrderPaymentStatus as p,IkasTransactionStatus as m,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as g,IkasOrderLineItemStatus as y,IkasAmountType as v,IkasCampaignOfferProductApplicablePriceEnum as S}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as k}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as b}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import{IkasCustomerAddress as P}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as C}from"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as A}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as I}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import{IkasProductPrice as w}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as O}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as E}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import{LocalizedAddressModel as R}from"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-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 N from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import T from"../../store/checkout/index.js";import D from"../../store/cart/api.js";import G,{MFS_ELEMENT_ID as L,MFS_SCRIPT_URL as M}from"./modelMasterPass.js";import x from"../../store/product/index.js";import{TransactionCardAssociationEnum as _,SaveCartInput as V,CheckStocksLineInput as F}from"@ikas/storefront-api";import{IkasBaseStore as U}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as B}from"@ikas/storefront-config";import{Analytics as H}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Y from"../../models/data/order/address/ikas-localized-order-address.js";import K from"../../store/location/index.js";import{getCookieValue as Z}from"../../utils/helper.js";import q from"../../analytics/ikasV3.js";var W,Q,z=/^\d+$/,X="undefined"==typeof localStorage,J=function(){function z(a,d,C,A,z,J,te,ie,se,ne){var re=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isPaymentMethodVisible=!0,this.step=W.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.hepsipayFrameInitResponse=null,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return e.sent(),[4,U.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 3:return e.sent(),[2]}}))}))},this.initStep=function(){return e(re,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(B.getIsEditor())return this.step=W.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===W.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(W.INFO)];if(this.step!==W.PAYMENT||this.canProceedToPayment){if(this.step===W.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(W.INFO)];if(![W.INFO,W.SUCCESS,W.SHIPPING,W.PAYMENT].includes(this.step))return[2,this.changeStep(W.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(W.INFO)]:[2,this.changeStep(W.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),this.step!==W.SHIPPING&&this.step!==W.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new b(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==W.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==W.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=W.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==W.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==W.SUCCESS||this.checkout.orderPaymentStatus!==p.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:Q.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==W.PAYMENT&&this.step!==W.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:Q.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===W.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(W.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return n&&(this.error={type:Q.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,H.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getSuccessTransaction=function(){return e(re,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransactions=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data:[],this.successTransaction=e.isSuccess&&(null===(s=e.data)||void 0===s?void 0:s.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,r,a,c,d,u;return t(this,(function(t){switch(t.label){case 0:return e=new V(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=t.sent(),t.label=2;case 2:return this.step!==W.INFO&&this.step!==W.SHIPPING||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||(e.billingAddress=null),this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress&&e.billingAddress&&(e.billingAddress.company=(null===(n=e.shippingAddress)||void 0===n?void 0:n.company)||null,e.billingAddress.taxNumber=(null===(r=e.shippingAddress)||void 0===r?void 0:r.taxNumber)||null,e.billingAddress.taxOffice=(null===(a=e.shippingAddress)||void 0===a?void 0:a.taxOffice)||null)),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,D.saveCart({input:e})];case 3:if((null==(i=t.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(c=s.extensions)||void 0===c?void 0:c.code)?{type:Q.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(d=s.extensions)||void 0===d?void 0:d.code)?{type:Q.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(u=s.extensions)||void 0===u?void 0:u.code)?{type:Q.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:Q.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(re,void 0,void 0,(function(){var e,s,n=this;return t(this,(function(t){return e=i,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&e.shippingAddress&&s.address&&(e.shippingAddress.country=s.address.country,e.shippingAddress.city=s.address.city,e.shippingAddress.state=s.address.state,e.shippingAddress.district=s.address.district,e.shippingAddress.postalCode=s.address.postalCode,e.shippingAddress.addressLine1=s.address.address||"",e.shippingAddress.addressLine2=null),[2,e]}))}))},this.checkStocks=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===h.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(u=B.getStockLocationIds())||void 0===u?void 0:u.length)?B.getStockLocationIds():null,[4,T.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:Q.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:Q.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(re,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(re,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,U.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getAvailableShippingCountries({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?[4,T.listStockLocation({id:{in:B.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=t.sent()).isSuccess||!(null===(i=e.data)||void 0===i?void 0:i.length))return this.error={type:Q.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(re,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,T.getAvailableStockLocations({lines:e.map((function(e){return new F(e)})),stockLocationIdList:B.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:Q.API_ERROR},[2];s=B.getCurrentRouting(),this.availableStockLocations=(i.data||[]).filter((function(e){var t,i,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(r=n.shippingCountryIds)||void 0===r?void 0:r.includes(e.address.country.id))&&(!(null===(o=null==s?void 0:s.countryCodes)||void 0===o?void 0:o.length)||s.countryCodes.includes(e.address.country.iso2))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=re.shippingCountryIds)||void 0===e?void 0:e.length)||(re.error={type:Q.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;re.deliveryMethod!==e&&("address"===e&&(re.checkout.stockLocationId=null,(null===(t=re.customerAddresses)||void 0===t?void 0:t.length)?re.onSelectedShippingAddressIdChange(re.customerAddresses[0].id||"-1"):(re.checkout.shippingAddress=new Y,re.checkout.shippingAddress.countrySettings=re.countrySettings,re.checkout.shippingAddress.checkoutSettings=re.checkoutSettings,re.checkout.shippingAddress.shippingZones=re.shippingZones)),re.deliveryMethod=e,re.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return t.sent(),[3,3];case 2:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,f=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=B.getPaymentGateways().map((function(e){return e.id})),[4,T.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:B.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess?(null===(h=s.data)||void 0===h?void 0:h.length)||this.isFree?(this.error=void 0,n=s.data||[],this.step===W.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(f.checkout.currencyCode)})),(o=null===(p=this.checkout.shippingAddress)||void 0===p?void 0:p.country)&&o.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(o.iso2||"")}))),a=null===(m=this.checkout.billingAddress)||void 0===m?void 0:m.country,!o&&a&&a.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")})))),c=[],r(B.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&c.push(t)})),this.paymentGateways=e?n:c,d=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code})),this.checkout.selectedPaymentGateway&&this.paymentGateways.some((function(e){var t;return e.id===(null===(t=f.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==d?d:0),[3,4])):(this.error={type:Q.NO_SHIPPING_ERROR},[2]):(this.error={type:Q.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==W.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===W.PAYMENT&&(u=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=u,(l=document.createElement("script")).id=L,l.src=M,l.onload=function(){f.mpVM.checkMasterPass({checkout:f.checkout,store:U.getInstance()})},document.head.appendChild(l)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(re,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var e;re.store.customerStore.customer?(null===(e=re.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=re.checkoutSettings,e.shippingZones=re.shippingZones})),re.checkout.customer=new I(i(i({},re.store.customerStore.customer),{notificationsAccepted:re.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):re.checkout.customer=new I(re.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){re.checkout.shippingAddress&&(re.checkout.shippingAddress.checkoutSettings=re.checkoutSettings,re.checkout.shippingAddress.shippingZones=re.shippingZones,re.checkout.shippingAddress.countrySettings=re.countrySettings,re.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){re.checkout.billingAddress&&(re.checkout.billingAddress.checkoutSettings=re.checkoutSettings,re.checkout.billingAddress.shippingZones=re.shippingZones,re.checkout.billingAddress.countrySettings=re.countrySettings,re.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!re.isDigitalOnly)if(re.isInStoreDelivery)re.setCheckoutShippingAddressSettings();else if(re.checkout.shippingAddress){if(re.store.customerStore.customer){var e=null==(t=re.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=re.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return re.onSelectedShippingAddressIdChange(e.id||"-1"),void re.setCheckoutShippingAddressSettings()}re.checkout.shippingAddress=new Y(n(re.checkout.shippingAddress)||{}),re.setCheckoutShippingAddressSettings()}else if(re.store.customerStore.customer){var t=re.customerAddresses;re.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else re.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(re.useDifferentAddress=!!localStorage.getItem("sAddr"),re.checkout.billingAddress){if(re.store.customerStore.customer){var e=null==(t=re.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=re.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return re.onSelectedBillingAddressIdChange(e.id||"-1"),void re.setCheckoutBillingAddressSettings()}re.checkout.billingAddress=new Y(n(re.checkout.billingAddress)||{}),re.setCheckoutBillingAddressSettings()}else if(re.store.customerStore.customer){var t=re.customerAddresses;re.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||re.useDifferentAddress||!re.checkout.shippingAddress||re.isInStoreDelivery||(re.checkout.billingAddress=new Y(n(re.checkout.shippingAddress)),re.setCheckoutBillingAddressSettings())}else re.onSelectedBillingAddressIdChange("-1"),re.useDifferentAddress||!re.checkout.shippingAddress||re.isInStoreDelivery||(re.checkout.billingAddress=new Y(n(re.checkout.shippingAddress)),re.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.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(e=t.sent())&&(this.checkout=new k(e,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return e(re,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(re,void 0,void 0,(function(){var e,s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,D.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(e=t.sent()).isSuccess&&e.data?(s=e.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===W.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return s?(r=this.checkout,this.checkout=new k(i(i({},s),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==W.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=s.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(re,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,D.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===W.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==W.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,K.getAvailableShippingZones({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingZones=e.data||null,[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(e){var t;if(re.selectedShippingAddressId=e,"-1"===e)re.checkout.shippingAddress=new Y,re.checkout.shippingAddress.countrySettings=re.countrySettings;else{var i=null===(t=re.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(re.checkout.shippingAddress=new Y(i),re.checkout.shippingAddress.countrySettings=re.countrySettings)}re.checkout.shippingAddress&&(re.checkout.shippingAddress.checkoutSettings=re.checkoutSettings,re.checkout.shippingAddress.shippingZones=re.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(re.selectedBillingAddressId=e,"-1"===e)re.checkout.billingAddress=new Y,re.checkout.billingAddress.countrySettings=re.countrySettings;else{var i=null===(t=re.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(re.checkout.billingAddress=new Y(i),re.checkout.billingAddress.countrySettings=re.countrySettings)}re.checkout.billingAddress&&(re.checkout.billingAddress.checkoutSettings=re.checkoutSettings,re.checkout.billingAddress.shippingZones=re.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){re.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(re.cardData&&(!(e.length>re.cardData.cardNumber.length)||ee(e))){var i=(re.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!re.installmentInfo?re.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(re.cardData.installmentCount=1,re.installmentInfo=void 0),(null===(t=re.installmentInfo)||void 0===t?void 0:t.cardAssociation)===_.AMERICAN_EXPRESS?re.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(s).join(" "):re.cardData.cardNumber=$(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){re.cardData&&(re.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(re.cardData&&(!(e.length>re.cardData.expirationDate.length)||ee(e))){if(0===(null===(t=re.cardData.expirationDate)||void 0===t?void 0:t.length)){var i=e.replace(".","/").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(re.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(re.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(re.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(re.cardData.expirationDate=$(d,2).join(" / "))}},this.onCvcChange=function(e){if(re.cardData&&(!(e.length>re.cardData.cvv.length)||ee(e))){if(re.installmentInfo){if(re.installmentInfo.cardAssociation===_.AMERICAN_EXPRESS&&e.length>4)return;if(re.installmentInfo.cardAssociation!==_.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;re.cardData.cvv=e}},this.saveAddress=function(s){return e(re,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new P(i(i({},e),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){re.router.push("/cart")},this.onBackToShoppingClick=function(){re.router.push("/")},this.onGoToLoginClick=function(){re.router.push("/account/login")},this.onHandleBillingAddressOnShippingStep=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new Y(i({},this.checkout.shippingAddress)):this.checkout.billingAddress=new Y(i({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,10,,11]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,5]:[4,this.saveAddress("shipping")];case 4:t.sent(),t.label=5;case 5:return this.isShowBillingAddressOnShippingStep?[4,this.saveAddress("billing")]:[3,7];case 6:t.sent(),t.label=7;case 7:return[4,this.checkStocks()];case 8:return t.sent(),[4,this.saveCart()];case 9:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(W.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(W.SHIPPING):this.changeStep(W.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,6,,7]),this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.changeStep(W.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return t.sent(),[4,this.saveCart()];case 3:return t.sent(),this.error=void 0,this.changeStep(W.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!re.canPerformPayment||(re.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){re.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:if(!this.isFree&&this.isHepsiPay)return window.HepsipaySdk?(this.isStepLoading=!0,window.HepsipaySdk.initPayment()):console.error("HepsipaySdk is not available"),[2];t.label=3;case 3:return t.trys.push([3,9,,10]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,6];case 5:t.sent(),t.label=6;case 6:return[4,this.saveCart()];case 7:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 8:return t.sent(),[3,10];case 9:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:Q.UNKNOWN},this.isStepLoading=!1,[3,10];case 10:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return t.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),[4,this.saveCart()];case 4:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 5:return t.sent(),[3,7];case 6:return(i=t.sent()).type?this.error=i:this.error={type:Q.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,f,g,y,v,S,k,b,P,C,A,I;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(f=this.mpVM.selectedCard)||void 0===f?void 0:f.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(g=this.cardData)||void 0===g?void 0:g.threeDSecure)},metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(y=this.mpVM.selectedCard)||void 0===y?void 0:y.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(v=this.checkout.selectedPaymentGateway)||void 0===v?void 0:v.id,paymentMethodDetail:this.isFree||i?void 0:(null===(S=this.checkout.selectedPaymentGateway)||void 0===S?void 0:S.paymentMethodType)===u.CREDIT_CARD&&(null===(k=this.checkout.selectedPaymentGateway)||void 0===k?void 0:k.type)===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(b=null==s?void 0:s.data)||void 0===b?void 0:b.transactionStatus,o=r&&[m.SUCCESS,m.AUTHORIZED].includes(r),a=r===m.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(C=null==s?void 0:s.data)||void 0===C?void 0:C.returnSlug))throw c=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(I=null===(A=s.data)||void 0===A?void 0:A.error)||void 0===I?void 0:I.code)&&(c=this.t("checkout-page:errorContactStore")),{data:c,type:Q.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(re,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return q.refreshJourneyId(),this.changeStep(W.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){re.changeStep(W.INFO)},this.onBackToShippingClick=function(){re.changeStep(W.SHIPPING)},this.setCustomerConsentGranted=function(e){re.checkout.customer&&(re.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e,t){var s;re.useDifferentAddress=e,re.useDifferentAddress?(localStorage.setItem("sAddr","1"),re.checkout.billingAddress=re.checkout.billingAddress||new Y,re.checkout.billingAddress.countrySettings=re.countrySettings):(localStorage.removeItem("sAddr"),re.checkout.billingAddress=new Y(i({},re.checkout.shippingAddress)),re.store.customerStore.customer&&(null===(s=re.customerAddresses)||void 0===s?void 0:s.length)&&t&&re.isShowBillingAddressOnShippingStep&&re.onSelectedBillingAddressIdChange(re.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){re.shouldSaveAddress=e},this.setAddressTitle=function(e){re.addressTitle=e},this.reInitPaymentMethod=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,8];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return this.isHepsiPay?[4,this.hepsipayFrameInit(this.checkout.selectedPaymentGateway)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[2]}}))}))},this.createStripePaymentIntent=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:Q.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:Q.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.hepsipayFrameInit=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.hepsipayFrameInitResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(re,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?(e=this.paymentGateways[i],s=!0,this.step!==W.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==e.code?[3,2]:[4,this.updatePaymentGateway(e)]):[2];case 1:s=t.sent(),t.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(e)];case 4:return s=t.sent(),[3,7];case 5:return"CUSTOM"!==e.code?[3,7]:[4,this.updatePaymentGateway(e)];case 6:s=t.sent(),t.label=7;case 7:return s?"STRIPE"!==e.code&&"STRIPE_EU"!==e.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(e)]:[2];case 8:t.sent(),t.label=9;case 9:return"KLARNA"!==e.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(e)];case 10:t.sent(),t.label=11;case 11:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 12:t.sent(),t.label=13;case 13:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(e)];case 14:t.sent(),t.label=15;case 15:return"HEPSIPAY"!==e.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(e)];case 16:t.sent(),t.label=17;case 17:return this.checkout.selectedPaymentGateway=e,this.step!==W.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new N,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(re,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,D.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id})];case 1:return(e=t.sent()).isSuccess?((n=e.data)&&(r=this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),this.isPaymentMethodVisible=!0,[2,!0]):(this.isPaymentMethodVisible=!0,[2,!1])}}))}))},this.setInstallmentCount=function(e){re.cardData&&(re.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(re,void 0,void 0,(function(){return t(this,(function(e){return X||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return e.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(e){re.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(re,void 0,void 0,(function(){var r,o,a=this;return t(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===f.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,x.searchProducts({input:{productIdList:n,priceListId:B.getPriceListId(),salesChannelId:B.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){if(!e.discountAmount)return t;var s=!1;return e.discountType===v.AMOUNT&&(s=!0),new O(i(i({},t),{prices:t.prices.map((function(t){var n=t.finalPrice,r=t.finalPrice-(s?e.discountAmount:t.finalPrice*e.discountAmount/100);return e.applicablePrice===S.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new w(i(i({},t),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new E(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===W.SUCCESS?g.POST_CHECKOUT:g.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(re,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,D.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===W.SUCCESS?W.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(re,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(t){switch(t.label){case 0:return this.checkout.customer?(e=this.checkout.customer,s=e.firstName,n=e.lastName,r=e.email,s&&n&&r?[4,j.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==y.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,T.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(re,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,T.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=d,this.router=C,this.returnPolicy=A,this.privacyPolicy=z,this.termsOfService=J,this.imprint=te,this.shippingPolicy=ie,this.t=se,this.customizationProps=ne,this.mpVM=new G,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new R({currentLocale:B.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(z.prototype,"merchantSettings",{get:function(){return new A(B.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"selectedPaymentGatewayIndex",{get:function(){var e=this;return this.paymentGateways.findIndex((function(t){var i;return t.id===(null===(i=e.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"selectedInstallmentIndex",{get:function(){var e,t,i=this;return(null===(t=null===(e=this.installmentInfo)||void 0===e?void 0:e.installmentPrices)||void 0===t?void 0:t.findIndex((function(e){var t;return e.installmentCount===(null===(t=i.cardData)||void 0===t?void 0:t.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=U.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"installmentPrice",{get:function(){var e,t,i,s=this;if(this.installmentInfo&&(null===(e=this.cardData)||void 0===e?void 0:e.installmentCount))return null===(i=null===(t=this.installmentInfo.installmentPrices)||void 0===t?void 0:t.find((function(e){var t;return e.installmentCount===(null===(t=s.cardData)||void 0===t?void 0:t.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-(this.checkout.totalFinalPrice-this.giftCardTotalPrice)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"finalPrice",{get:function(){return this.step===W.SUCCESS?this.checkout.totalFinalPrice-this.giftCardTotalPrice:this.installmentPrice?this.installmentPrice:this.checkout.totalFinalPrice-this.giftCardTotalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===Q.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly||this.isShowBillingAddressOnShippingStep?null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress:null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValidAddress)&&(this.checkout.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==Q.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canProceedToInStoreDelivery",{get:function(){var e,t,i;return!!((null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.firstName)&&(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)&&(!this.isShowBillingAddressOnShippingStep||this.canProceedToShipping)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"klarnaPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"payPalPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hepsiPayPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"store",{get:function(){return U.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canPerformPayment",{get:function(){var e,t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress),r=!!this.isFree||(!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===u.CREDIT_CARD&&i.type===l.INTERNAL?!!this.isCustomFlowStripe||(!!(this.isKlarna||this.isPayPal||this.isHepsiPay)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=B.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(e){var t=new C(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isEPayKolayEnabled",{get:function(){var e=B.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isPoweredByHidden",{get:function(){var e=B.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),z.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},z}();function $(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function ee(e){return e&&z.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(W||(W={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR",e[e.ARGUMENT_VALIDATION_ERROR=7]="ARGUMENT_VALIDATION_ERROR"}(Q||(Q={}));export{W as CheckoutStep,Q as ErrorType,J as default};
1
+ import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasCorporateInvoiceRequirement as d,IkasPaymentMethodType as u,IkasPaymentGatewayType as l,IkasOrderShippingMethod as h,IkasOrderPaymentStatus as p,IkasTransactionStatus as m,IkasCartCampaignOfferStatus as f,IkasCampaignOfferTargetPageType as g,IkasOrderLineItemStatus as y,IkasAmountType as v,IkasCampaignOfferProductApplicablePriceEnum as S}from"@ikas/storefront-models";import"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import{IkasCheckout as k}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as b}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import{IkasCustomerAddress as P}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as C}from"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/filter-category/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import{IkasMerchantSettings as A}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as I}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import{IkasProductPrice as w}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as O}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as E}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import{LocalizedAddressModel as R}from"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-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 N from"./components/credit-card-form/model.js";import j from"../../store/customer/api.js";import T from"../../store/checkout/index.js";import D from"../../store/cart/api.js";import G,{MFS_ELEMENT_ID as L,MFS_SCRIPT_URL as M}from"./modelMasterPass.js";import x from"../../store/product/index.js";import{TransactionCardAssociationEnum as _,SaveCartInput as V,CheckStocksLineInput as F}from"@ikas/storefront-api";import{IkasBaseStore as U}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as B}from"@ikas/storefront-config";import{Analytics as H}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import Y from"../../models/data/order/address/ikas-localized-order-address.js";import K from"../../store/location/index.js";import{getCookieValue as Z}from"../../utils/helper.js";import q from"../../analytics/ikasV3.js";var W,Q,z=/^\d+$/,X="undefined"==typeof localStorage,J=function(){function z(a,d,C,A,z,J,te,ie,se,ne){var re=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isPaymentMethodVisible=!0,this.step=W.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.hepsipayFrameInitResponse=null,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return e.sent(),[4,U.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 3:return e.sent(),[2]}}))}))},this.initStep=function(){return e(re,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(B.getIsEditor())return this.step=W.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===W.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(W.INFO)];if(this.step!==W.PAYMENT||this.canProceedToPayment){if(this.step===W.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(W.INFO)];if(![W.INFO,W.SUCCESS,W.SHIPPING,W.PAYMENT].includes(this.step))return[2,this.changeStep(W.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(W.INFO)]:[2,this.changeStep(W.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),this.step!==W.SHIPPING&&this.step!==W.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new b(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==W.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==W.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=W.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==W.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==W.SUCCESS||this.checkout.orderPaymentStatus!==p.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:Q.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==W.PAYMENT&&this.step!==W.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length&&!this.isFree)return this.error={type:Q.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===W.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(W.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return n&&(this.error={type:Q.PAYMENT_ERROR,data:r||null}),this.isCheckoutLoaded=!0,H.checkoutStep(this.checkout,this.step,this.checkoutSettings),[2]}}))}))},this.getSuccessTransaction=function(){return e(re,void 0,void 0,(function(){var e,i,s;return t(this,(function(t){switch(t.label){case 0:return[4,j.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransactions=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data:[],this.successTransaction=e.isSuccess&&(null===(s=e.data)||void 0===s?void 0:s.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,r,a,c,d,u;return t(this,(function(t){switch(t.label){case 0:return e=new V(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(e)];case 1:e=t.sent(),t.label=2;case 2:return this.step!==W.INFO&&this.step!==W.SHIPPING||this.isDigitalOnly||(this.isShowBillingAddressOnShippingStep||(e.billingAddress=null),this.isShowBillingAddressOnShippingStep&&this.useDifferentAddress&&e.billingAddress&&(e.billingAddress.company=(null===(n=e.shippingAddress)||void 0===n?void 0:n.company)||null,e.billingAddress.taxNumber=(null===(r=e.shippingAddress)||void 0===r?void 0:r.taxNumber)||null,e.billingAddress.taxOffice=(null===(a=e.shippingAddress)||void 0===a?void 0:a.taxOffice)||null)),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,D.saveCart({input:e})];case 3:if((null==(i=t.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(c=s.extensions)||void 0===c?void 0:c.code)?{type:Q.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(d=s.extensions)||void 0===d?void 0:d.code)?{type:Q.CUSTOMER_ACCOUNT_DISABLED_ERROR}:"ARGUMENT_VALIDATION_ERROR"===(null===(u=s.extensions)||void 0===u?void 0:u.code)?{type:Q.ARGUMENT_VALIDATION_ERROR,data:s.extensions.validationErrors}:{type:Q.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(re,void 0,void 0,(function(){var e,s,n=this;return t(this,(function(t){return e=i,(s=this.stockLocations.find((function(e){return e.id===n.checkout.stockLocationId})))&&e.shippingAddress&&s.address&&(e.shippingAddress.country=s.address.country,e.shippingAddress.city=s.address.city,e.shippingAddress.state=s.address.state,e.shippingAddress.district=s.address.district,e.shippingAddress.postalCode=s.address.postalCode,e.shippingAddress.addressLine1=s.address.address||"",e.shippingAddress.addressLine2=null),[2,e]}))}))},this.checkStocks=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===h.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(u=B.getStockLocationIds())||void 0===u?void 0:u.length)?B.getStockLocationIds():null,[4,T.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:Q.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:Q.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(re,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(re,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,U.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getAvailableShippingCountries({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?[4,T.listStockLocation({id:{in:B.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(e=t.sent()).isSuccess||!(null===(i=e.data)||void 0===i?void 0:i.length))return this.error={type:Q.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(re,void 0,void 0,(function(){var e,i,s,n=this;return t(this,(function(t){switch(t.label){case 0:return B.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,T.getAvailableStockLocations({lines:e.map((function(e){return new F(e)})),stockLocationIdList:B.getPickupStockLocationIds(),cartId:this.checkout.id})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:Q.API_ERROR},[2];s=B.getCurrentRouting(),this.availableStockLocations=(i.data||[]).filter((function(e){var t,i,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(r=n.shippingCountryIds)||void 0===r?void 0:r.includes(e.address.country.id))&&(!(null===(o=null==s?void 0:s.countryCodes)||void 0===o?void 0:o.length)||s.countryCodes.includes(e.address.country.iso2))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=re.shippingCountryIds)||void 0===e?void 0:e.length)||(re.error={type:Q.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;re.deliveryMethod!==e&&("address"===e&&(re.checkout.stockLocationId=null,(null===(t=re.customerAddresses)||void 0===t?void 0:t.length)?re.onSelectedShippingAddressIdChange(re.customerAddresses[0].id||"-1"):(re.checkout.shippingAddress=new Y,re.checkout.shippingAddress.countrySettings=re.countrySettings,re.checkout.shippingAddress.checkoutSettings=re.checkoutSettings,re.checkout.shippingAddress.shippingZones=re.shippingZones)),re.deliveryMethod=e,re.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return t.sent(),[3,3];case 2:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h,p,m,f=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=B.getPaymentGateways().map((function(e){return e.id})),[4,T.listPaymentGateway({cartId:this.checkout.id,id:e?void 0:{in:i},locale:B.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess?(null===(h=s.data)||void 0===h?void 0:h.length)||this.isFree?(this.error=void 0,n=s.data||[],this.step===W.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(f.checkout.currencyCode)})),(o=null===(p=this.checkout.shippingAddress)||void 0===p?void 0:p.country)&&o.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(o.iso2||"")}))),a=null===(m=this.checkout.billingAddress)||void 0===m?void 0:m.country,!o&&a&&a.iso2&&(n=n.filter((function(e){var t;return!(null===(t=e.availableCountries)||void 0===t?void 0:t.length)||e.availableCountries.includes(a.iso2||"")})))),c=[],r(B.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&c.push(t)})),this.paymentGateways=e?n:c,d=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code})),this.checkout.selectedPaymentGateway&&this.paymentGateways.some((function(e){var t;return e.id===(null===(t=f.checkout.selectedPaymentGateway)||void 0===t?void 0:t.id)}))?[3,2]:(this.setPaymentGateway(-1!==d?d:0),[3,4])):(this.error={type:Q.NO_SHIPPING_ERROR},[2]):(this.error={type:Q.API_ERROR,data:s.firstErrorMessage},[2]);case 2:return this.step!==W.PAYMENT?[3,4]:[4,this.updatePaymentGateway(this.checkout.selectedPaymentGateway)];case 3:t.sent(),t.label=4;case 4:return this.step===W.PAYMENT&&(u=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=u,(l=document.createElement("script")).id=L,l.src=M,l.onload=function(){f.mpVM.checkMasterPass({checkout:f.checkout,store:U.getInstance()})},document.head.appendChild(l)),[2]}}))}))},this.retrieveInstallmentInfo=function(i){return e(re,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,T.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var e;re.store.customerStore.customer?(null===(e=re.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=re.checkoutSettings,e.shippingZones=re.shippingZones})),re.checkout.customer=new I(i(i({},re.store.customerStore.customer),{notificationsAccepted:re.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):re.checkout.customer=new I(re.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){re.checkout.shippingAddress&&(re.checkout.shippingAddress.checkoutSettings=re.checkoutSettings,re.checkout.shippingAddress.shippingZones=re.shippingZones,re.checkout.shippingAddress.countrySettings=re.countrySettings,re.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){re.checkout.billingAddress&&(re.checkout.billingAddress.checkoutSettings=re.checkoutSettings,re.checkout.billingAddress.shippingZones=re.shippingZones,re.checkout.billingAddress.countrySettings=re.countrySettings,re.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!re.isDigitalOnly)if(re.isInStoreDelivery)re.setCheckoutShippingAddressSettings();else if(re.checkout.shippingAddress){if(re.store.customerStore.customer){var e=null==(t=re.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=re.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return re.onSelectedShippingAddressIdChange(e.id||"-1"),void re.setCheckoutShippingAddressSettings()}re.checkout.shippingAddress=new Y(n(re.checkout.shippingAddress)||{}),re.setCheckoutShippingAddressSettings()}else if(re.store.customerStore.customer){var t=re.customerAddresses;re.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else re.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(re.useDifferentAddress=!!localStorage.getItem("sAddr"),re.checkout.billingAddress){if(re.store.customerStore.customer){var e=null==(t=re.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=re.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return re.onSelectedBillingAddressIdChange(e.id||"-1"),void re.setCheckoutBillingAddressSettings()}re.checkout.billingAddress=new Y(n(re.checkout.billingAddress)||{}),re.setCheckoutBillingAddressSettings()}else if(re.store.customerStore.customer){var t=re.customerAddresses;re.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||re.useDifferentAddress||!re.checkout.shippingAddress||re.isInStoreDelivery||(re.checkout.billingAddress=new Y(n(re.checkout.shippingAddress)),re.setCheckoutBillingAddressSettings())}else re.onSelectedBillingAddressIdChange("-1"),re.useDifferentAddress||!re.checkout.shippingAddress||re.isInStoreDelivery||(re.checkout.billingAddress=new Y(n(re.checkout.shippingAddress)),re.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.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(e=t.sent())&&(this.checkout=new k(e,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings,this.checkout.shippingAddress.shippingZones=this.shippingZones),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return e(re,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(re,void 0,void 0,(function(){var e,s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,D.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(e=t.sent()).isSuccess&&e.data?(s=e.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===W.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return s?(r=this.checkout,this.checkout=new k(i(i({},s),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==W.PAYMENT||this.checkout.totalFinalPrice===r.totalFinalPrice&&!this.checkout.giftCardLines?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=s.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.removeGiftCardLine=function(s){return e(re,void 0,void 0,(function(){var e,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,8,,9]),[4,D.removeGiftCardFromCart({cartId:this.checkout.id,giftCardId:s})];case 1:return(e=t.sent()).isSuccess&&e.data?(n=e.data,r=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===W.PAYMENT&&(null==r?void 0:r.length)&&r.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:r.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:n.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,7];case 2:t.sent(),t.label=3;case 3:return n?(this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:this.checkout.shippingAddress,billingAddress:this.checkout.billingAddress,customer:this.checkout.customer,selectedPaymentGateway:this.checkout.selectedPaymentGateway}),this.countrySettings),this.step!==W.PAYMENT?[3,5]:[4,this.listPaymentGateways()]):[3,7];case 4:t.sent(),t.label=5;case 5:return this.checkout.campaignOffers=n.campaignOffers,this.isCampaignOfferLoaded=!1,[4,this.createCampaignOffer()];case 6:t.sent(),this.isCampaignOfferLoaded=!0,t.label=7;case 7:return[3,9];case 8:return t.sent(),[3,9];case 9:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,K.getAvailableShippingZones({salesChannelId:B.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingZones=e.data||null,[3,3];case 2:return t.sent(),[3,3];case 3:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(e){var t;if(re.selectedShippingAddressId=e,"-1"===e)re.checkout.shippingAddress=new Y,re.checkout.shippingAddress.countrySettings=re.countrySettings;else{var i=null===(t=re.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(re.checkout.shippingAddress=new Y(i),re.checkout.shippingAddress.countrySettings=re.countrySettings)}re.checkout.shippingAddress&&(re.checkout.shippingAddress.checkoutSettings=re.checkoutSettings,re.checkout.shippingAddress.shippingZones=re.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(re.selectedBillingAddressId=e,"-1"===e)re.checkout.billingAddress=new Y,re.checkout.billingAddress.countrySettings=re.countrySettings;else{var i=null===(t=re.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(re.checkout.billingAddress=new Y(i),re.checkout.billingAddress.countrySettings=re.countrySettings)}re.checkout.billingAddress&&(re.checkout.billingAddress.checkoutSettings=re.checkoutSettings,re.checkout.billingAddress.shippingZones=re.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){re.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(re.cardData&&(!(e.length>re.cardData.cardNumber.length)||ee(e))){var i=(re.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!re.installmentInfo?re.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(re.cardData.installmentCount=1,re.installmentInfo=void 0),(null===(t=re.installmentInfo)||void 0===t?void 0:t.cardAssociation)===_.AMERICAN_EXPRESS?re.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(s).join(" "):re.cardData.cardNumber=$(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){re.cardData&&(re.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(re.cardData&&(!(e.length>re.cardData.expirationDate.length)||ee(e))){if(0===(null===(t=re.cardData.expirationDate)||void 0===t?void 0:t.length)){var i=e.replace(".","/").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(re.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(re.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}if(2===s.length&&2===n.length){var a=parseInt(s),c=parseInt(n);o=a<=12?a:c,r=c>12?c:a;if(!isNaN(r)&&!isNaN(o))return void(re.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(re.cardData.expirationDate=$(d,2).join(" / "))}},this.onCvcChange=function(e){if(re.cardData&&(!(e.length>re.cardData.cvv.length)||ee(e))){if(re.installmentInfo){if(re.installmentInfo.cardAssociation===_.AMERICAN_EXPRESS&&e.length>4)return;if(re.installmentInfo.cardAssociation!==_.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;re.cardData.cvv=e}},this.saveAddress=function(s){return e(re,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new P(i(i({},e),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){re.router.push("/cart")},this.onBackToShoppingClick=function(){re.router.push("/")},this.onGoToLoginClick=function(){re.router.push("/account/login")},this.onHandleBillingAddressOnShippingStep=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){return this.isShowBillingAddressOnShippingStep&&!this.useDifferentAddress&&("address"===this.deliveryMethod&&this.checkout.shippingAddress?this.checkout.billingAddress=new Y(i({},this.checkout.shippingAddress)):this.checkout.billingAddress=new Y(i({},this.checkout.billingAddress))),[2]}))}))},this.onProceedToShippingClick=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,10,,11]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,5]:[4,this.saveAddress("shipping")];case 4:t.sent(),t.label=5;case 5:return this.isShowBillingAddressOnShippingStep?[4,this.saveAddress("billing")]:[3,7];case 6:t.sent(),t.label=7;case 7:return[4,this.checkStocks()];case 8:return t.sent(),[4,this.saveCart()];case 9:return t.sent(),this.isManualOrderWithShippingLines?[2,this.changeStep(W.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(W.SHIPPING):this.changeStep(W.PAYMENT),[3,11]);case 10:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isShowBillingAddressOnShippingStep?[4,this.onHandleBillingAddressOnShippingStep()]:[3,2];case 1:t.sent(),t.label=2;case 2:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=3;case 3:return t.trys.push([3,6,,7]),this.isStepLoading=!0,[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),this.changeStep(W.PAYMENT),[3,7];case 6:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return t.sent(),[4,this.saveCart()];case 3:return t.sent(),this.error=void 0,this.changeStep(W.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:Q.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!re.canPerformPayment||(re.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){re.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return this.isFree||!this.isHepsiPay?[3,6]:window.HepsipaySdk?(this.isStepLoading=!0,[4,this.saveCart()]):[3,4];case 3:return t.sent(),window.HepsipaySdk.initPayment(),[3,5];case 4:console.error("HepsipaySdk is not available"),t.label=5;case 5:return[2];case 6:return t.trys.push([6,12,,13]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 7:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,9];case 8:t.sent(),t.label=9;case 9:return[4,this.saveCart()];case 10:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 11:return t.sent(),[3,13];case 12:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:Q.UNKNOWN},this.isStepLoading=!1,[3,13];case 13:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return!this.canProceedToPayment||this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked?(this.isErrorsVisible=!0,[2]):this.isKlarna?[4,this.saveCart()]:[3,2];case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return this.isFree||!this.isHepsiPay?[3,6]:window.HepsipaySdk?(this.isStepLoading=!0,[4,this.saveCart()]):[3,4];case 3:return t.sent(),window.HepsipaySdk.initPayment(),[3,5];case 4:console.error("HepsipaySdk is not available"),t.label=5;case 5:return[2];case 6:return t.trys.push([6,10,,11]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 7:return t.sent(),[4,this.saveCart()];case 8:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 9:return t.sent(),[3,11];case 10:return(i=t.sent()).type?this.error=i:this.error={type:Q.UNKNOWN},this.isStepLoading=!1,[3,11];case 11:return[2]}}))}))},this.createSaleTransaction=function(){return e(re,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,h,p,f,g,y,v,S,k,b,P,C,A,I;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(d=this.mpVM.selectedCard)||void 0===d?void 0:d.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(f=this.mpVM.selectedCard)||void 0===f?void 0:f.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(g=this.cardData)||void 0===g?void 0:g.threeDSecure)},metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway||this.isFree?[4,T.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(y=this.mpVM.selectedCard)||void 0===y?void 0:y.Name}:void 0,paymentGatewayId:this.isFree?"9d41af41-4793-4879-a19c-e9a66c929726":null===(v=this.checkout.selectedPaymentGateway)||void 0===v?void 0:v.id,paymentMethodDetail:this.isFree||i?void 0:(null===(S=this.checkout.selectedPaymentGateway)||void 0===S?void 0:S.paymentMethodType)===u.CREDIT_CARD&&(null===(k=this.checkout.selectedPaymentGateway)||void 0===k?void 0:k.type)===l.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(b=null==s?void 0:s.data)||void 0===b?void 0:b.transactionStatus,o=r&&[m.SUCCESS,m.AUTHORIZED].includes(r),a=r===m.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(P=null==s?void 0:s.data)||void 0===P?void 0:P.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(C=null==s?void 0:s.data)||void 0===C?void 0:C.returnSlug))throw c=s.firstErrorMessage,"IKAS_WALLET_501"===(null===(I=null===(A=s.data)||void 0===A?void 0:A.error)||void 0===I?void 0:I.code)&&(c=this.t("checkout-page:errorContactStore")),{data:c,type:Q.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(re,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return q.refreshJourneyId(),this.changeStep(W.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){re.changeStep(W.INFO)},this.onBackToShippingClick=function(){re.changeStep(W.SHIPPING)},this.setCustomerConsentGranted=function(e){re.checkout.customer&&(re.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e,t){var s;re.useDifferentAddress=e,re.useDifferentAddress?(localStorage.setItem("sAddr","1"),re.checkout.billingAddress=re.checkout.billingAddress||new Y,re.checkout.billingAddress.countrySettings=re.countrySettings):(localStorage.removeItem("sAddr"),re.checkout.billingAddress=new Y(i({},re.checkout.shippingAddress)),re.store.customerStore.customer&&(null===(s=re.customerAddresses)||void 0===s?void 0:s.length)&&t&&re.isShowBillingAddressOnShippingStep&&re.onSelectedBillingAddressIdChange(re.checkout.billingAddress.id||"-1"))},this.setShouldSaveAddress=function(e){re.shouldSaveAddress=e},this.setAddressTitle=function(e){re.addressTitle=e},this.reInitPaymentMethod=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,8];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return this.isHepsiPay?[4,this.hepsipayFrameInit(this.checkout.selectedPaymentGateway)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[2]}}))}))},this.createStripePaymentIntent=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:Q.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:Q.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.hepsipayFrameInit=function(i){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,T.hepsipayFrameInit({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.hepsipayFrameInitResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(re,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?(e=this.paymentGateways[i],s=!0,this.step!==W.PAYMENT?[3,7]:this.checkout.selectedPaymentGateway?[3,3]:"CUSTOM"!==e.code?[3,2]:[4,this.updatePaymentGateway(e)]):[2];case 1:s=t.sent(),t.label=2;case 2:return[3,7];case 3:return"CUSTOM"!==this.checkout.selectedPaymentGateway.code?[3,5]:[4,this.updatePaymentGateway(e)];case 4:return s=t.sent(),[3,7];case 5:return"CUSTOM"!==e.code?[3,7]:[4,this.updatePaymentGateway(e)];case 6:s=t.sent(),t.label=7;case 7:return s?"STRIPE"!==e.code&&"STRIPE_EU"!==e.code||this.stripeResponse?[3,9]:[4,this.createStripePaymentIntent(e)]:[2];case 8:t.sent(),t.label=9;case 9:return"KLARNA"!==e.code||this.klarnaResponse?[3,11]:[4,this.createKlarnaClientToken(e)];case 10:t.sent(),t.label=11;case 11:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,13]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 12:t.sent(),t.label=13;case 13:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,15]:[4,this.getPayPalClientId(e)];case 14:t.sent(),t.label=15;case 15:return"HEPSIPAY"!==e.code||this.hepsipayFrameInitResponse?[3,17]:[4,this.hepsipayFrameInit(e)];case 16:t.sent(),t.label=17;case 17:return this.checkout.selectedPaymentGateway=e,this.step!==W.SUCCESS&&(e.paymentMethodType===u.CREDIT_CARD&&e.type===l.INTERNAL&&(this.cardData=new N,e.masterPassClientId&&this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store})),this.installmentInfo=void 0),[2]}}))}))},this.updatePaymentGateway=function(s){return e(re,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return this.isPaymentMethodVisible=!1,[4,D.getCartById({id:this.checkout.id,getCompletedCart:!1,paymentGatewayId:s.id})];case 1:return(e=t.sent()).isSuccess?((n=e.data)&&(r=this.checkout,this.checkout=new k(i(i({},n),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),this.isPaymentMethodVisible=!0,[2,!0]):(this.isPaymentMethodVisible=!0,[2,!1])}}))}))},this.setInstallmentCount=function(e){re.cardData&&(re.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(re,void 0,void 0,(function(){return t(this,(function(e){return X||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(re,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return e.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(e){re.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(re,void 0,void 0,(function(){var r,o,a=this;return t(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===f.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,x.searchProducts({input:{productIdList:n,priceListId:B.getPriceListId(),salesChannelId:B.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){if(!e.discountAmount)return t;var s=!1;return e.discountType===v.AMOUNT&&(s=!0),new O(i(i({},t),{prices:t.prices.map((function(t){var n=t.finalPrice,r=t.finalPrice-(s?e.discountAmount:t.finalPrice*e.discountAmount/100);return e.applicablePrice===S.SELL_PRICE&&(n=t.sellPrice,r=t.sellPrice-(s?e.discountAmount:t.sellPrice*e.discountAmount/100)),new w(i(i({},t),{sellPrice:n,discountPrice:r}))}))}))}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new E(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return e(re,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===W.SUCCESS?g.POST_CHECKOUT:g.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(re,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,D.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===W.SUCCESS?W.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(re,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(t){switch(t.label){case 0:return this.checkout.customer?(e=this.checkout.customer,s=e.firstName,n=e.lastName,r=e.email,s&&n&&r?[4,j.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(re,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==y.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,T.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(re,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,T.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=d,this.router=C,this.returnPolicy=A,this.privacyPolicy=z,this.termsOfService=J,this.imprint=te,this.shippingPolicy=ie,this.t=se,this.customizationProps=ne,this.mpVM=new G,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new R({currentLocale:B.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(z.prototype,"merchantSettings",{get:function(){return new A(B.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"selectedPaymentGatewayIndex",{get:function(){var e=this;return this.paymentGateways.findIndex((function(t){var i;return t.id===(null===(i=e.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"selectedInstallmentIndex",{get:function(){var e,t,i=this;return(null===(t=null===(e=this.installmentInfo)||void 0===e?void 0:e.installmentPrices)||void 0===t?void 0:t.findIndex((function(e){var t;return e.installmentCount===(null===(t=i.cardData)||void 0===t?void 0:t.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=U.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"installmentPrice",{get:function(){var e,t,i,s=this;if(this.installmentInfo&&(null===(e=this.cardData)||void 0===e?void 0:e.installmentCount))return null===(i=null===(t=this.installmentInfo.installmentPrices)||void 0===t?void 0:t.find((function(e){var t;return e.installmentCount===(null===(t=s.cardData)||void 0===t?void 0:t.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"giftCardTotalPrice",{get:function(){var e;return(null===(e=this.checkout.giftCardLines)||void 0===e?void 0:e.reduce((function(e,t){return e+t.amount}),0))||0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-(this.checkout.totalFinalPrice-this.giftCardTotalPrice)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"finalPrice",{get:function(){return this.step===W.SUCCESS?this.checkout.totalFinalPrice-this.giftCardTotalPrice:this.installmentPrice?this.installmentPrice:this.checkout.totalFinalPrice-this.giftCardTotalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===Q.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly||this.isShowBillingAddressOnShippingStep?null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress:null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.isValidAddress)&&(this.checkout.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==Q.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canProceedToInStoreDelivery",{get:function(){var e,t,i;return!!((null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.firstName)&&(null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)&&(!this.isShowBillingAddressOnShippingStep||this.canProceedToShipping)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"klarnaPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"payPalPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hepsiPayPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"hepsiPayPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"HEPSIPAY"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&("STRIPE"===e.code||"STRIPE_EU"===e.code)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isHepsiPay",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"HEPSIPAY"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice||0===this.finalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"store",{get:function(){return U.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isCorporateInvoiceVisible",{get:function(){return this.checkoutSettings.corporateInvoiceRequirement!==d.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isShowBillingAddressOnShippingStep",{get:function(){return this.checkoutSettings.showBillingAddressOnShippingStep},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"canPerformPayment",{get:function(){var e,t;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(e=this.checkout.billingAddress)||void 0===e?void 0:e.isValidAddress),r=!!this.isFree||(!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===u.CREDIT_CARD&&i.type===l.INTERNAL?!!this.isCustomFlowStripe||(!!(this.isKlarna||this.isPayPal||this.isHepsiPay)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===h.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=B.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(e){var t=new C(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isEPayKolayEnabled",{get:function(){var e=B.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isPoweredByHidden",{get:function(){var e=B.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),z.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},z}();function $(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function ee(e){return e&&z.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(W||(W={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR",e[e.ARGUMENT_VALIDATION_ERROR=7]="ARGUMENT_VALIDATION_ERROR"}(Q||(Q={}));export{W as CheckoutStep,Q as ErrorType,J as default};
@@ -0,0 +1 @@
1
+ import o from"./AsYouType.js";function t(t,e,n){return n||(n=e,e=void 0),new o(e,n).input(t)}export{t as default};
@@ -0,0 +1 @@
1
+ import t from"./metadata.js";function e(e){return new t(e).getCountries()}export{e as default};
@@ -0,0 +1 @@
1
+ import e from"./withMetadataArgument.js";import"../../es6/PhoneNumberMatcher.js";import"../../es6/AsYouTypeFormatter.js";import r from"../../es6/formatIncompletePhoneNumber.js";function t(){return e(r,arguments)}export{t as formatIncompletePhoneNumber};
@@ -0,0 +1 @@
1
+ import t from"./withMetadataArgument.js";import"../../es6/PhoneNumberMatcher.js";import"../../es6/AsYouTypeFormatter.js";import e from"../../es6/getCountries.js";function r(){return t(e,arguments)}export{r as getCountries};
@@ -0,0 +1 @@
1
+ import t from"./withMetadataArgument.js";import{getCountryCallingCode as e}from"../../es6/metadata.js";import"../../es6/PhoneNumberMatcher.js";import"../../es6/AsYouTypeFormatter.js";function r(){return t(e,arguments)}export{r as getCountryCallingCode};
@@ -0,0 +1 @@
1
+ import t from"./withMetadataArgument.js";import{isSupportedCountry as r}from"../../es6/metadata.js";import"../../es6/PhoneNumberMatcher.js";import"../../es6/AsYouTypeFormatter.js";function e(){return t(r,arguments)}export{e as isSupportedCountry};
@@ -0,0 +1 @@
1
+ import e from"./withMetadataArgument.js";import r from"../../es6/parsePhoneNumber.js";import"../../es6/PhoneNumberMatcher.js";import"../../es6/AsYouTypeFormatter.js";function t(){return e(r,arguments)}export{t as parsePhoneNumber};
@@ -0,0 +1 @@
1
+ import"mobx";import"react";import"./utils/observerFinalizationRegistry.js";process.env.NODE_ENV;
@@ -0,0 +1 @@
1
+ import"./utils/assertEnvironment.js";import{unstable_batchedUpdates as r}from"react-dom";import{observerBatching as e}from"./utils/observerBatching.js";export{observerBatching}from"./utils/observerBatching.js";import"mobx";import"react";import{observerFinalizationRegistry as o}from"./utils/observerFinalizationRegistry.js";export{observer}from"./observer.js";import"./ObserverComponent.js";e(r),o.finalizeAllImmediately;
@@ -0,0 +1 @@
1
+ import{forwardRef as e,memo as r}from"react";import{useObserver as o}from"./useObserver.js";var t=!0,n="function"==typeof Symbol&&Symbol.for,a=n?Symbol.for("react.forward_ref"):"function"==typeof e&&e((function(e){return null})).$$typeof,f=n?Symbol.for("react.memo"):"function"==typeof r&&r((function(e){return null})).$$typeof;function c(n,c){var i;if("production"!==process.env.NODE_ENV&&t&&c&&(t=!1,console.warn("[mobx-react-lite] `observer(fn, { forwardRef: true })` is deprecated, use `observer(React.forwardRef(fn))`")),f&&n.$$typeof===f)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var s=null!==(i=null==c?void 0:c.forwardRef)&&void 0!==i&&i,y=n,u=n.displayName||n.name;if(a&&n.$$typeof===a&&(s=!0,"function"!=typeof(y=n.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var m,l,d=function(e,r){return o((function(){return y(e,r)}),u)};return""!==u&&(d.displayName=u),n.contextTypes&&(d.contextTypes=n.contextTypes),s&&(d=e(d)),d=r(d),m=n,l=d,Object.keys(m).forEach((function(e){p[e]||Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(m,e))})),"production"!==process.env.NODE_ENV&&Object.defineProperty(d,"contextTypes",{set:function(){var e;throw new Error("[mobx-react-lite] `".concat(this.displayName||(null===(e=this.type)||void 0===e?void 0:e.displayName)||"Component",".contextTypes` must be set before applying `observer`."))}}),d}var p={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};export{c as observer};
@@ -0,0 +1 @@
1
+ import{Reaction as e}from"mobx";import r from"react";import{printDebugValue as n}from"./utils/printDebugValue.js";import{observerFinalizationRegistry as t}from"./utils/observerFinalizationRegistry.js";var o=function(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var t,o,u=n.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(t=u.next()).done;)i.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}return i};function u(e){return"observer".concat(e)}var i=function(){};function a(){return new i}function c(i,c){void 0===c&&(c="observed");var f=o(r.useState(a),1)[0],s=o(r.useState(),2)[1],l=function(){return s([])},d=r.useRef(null);d.current||(d.current={reaction:null,mounted:!1,changedBeforeMount:!1});var m,v,g=d.current;if(g.reaction||(g.reaction=new e(u(c),(function(){g.mounted?l():g.changedBeforeMount=!0})),t.register(f,g,g)),r.useDebugValue(g.reaction,n),r.useEffect((function(){return t.unregister(g),g.mounted=!0,g.reaction?g.changedBeforeMount&&(g.changedBeforeMount=!1,l()):(g.reaction=new e(u(c),(function(){l()})),l()),function(){g.reaction.dispose(),g.reaction=null,g.mounted=!1,g.changedBeforeMount=!1}}),[]),g.reaction.track((function(){try{m=i()}catch(e){v=e}})),v)throw v;return m}export{c as useObserver};
@@ -0,0 +1 @@
1
+ var e=function(){function e(e){var i=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=1e4),clearTimeout(i.sweepTimeout),i.sweepTimeout=void 0;var t=Date.now();i.registrations.forEach((function(r,n){t-r.registeredAt>=e&&(i.finalize(r.value),i.registrations.delete(n))})),i.registrations.size>0&&i.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){i.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,i,t){this.registrations.set(t,{value:i,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.registrations.delete(e)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))}}),e}(),i="undefined"!=typeof FinalizationRegistry?FinalizationRegistry:e;export{e as TimerBasedFinalizationRegistry,i as UniversalFinalizationRegistry};
@@ -0,0 +1 @@
1
+ import{makeObservable as r}from"mobx";import{useState as o}from"react";if(!o)throw new Error("mobx-react-lite requires React with Hooks support");if(!r)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");
@@ -0,0 +1 @@
1
+ import{configure as o}from"mobx";function e(o){o()}function t(t){t||(t=e,"production"!==process.env.NODE_ENV&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),o({reactionScheduler:t})}export{e as defaultNoopBatch,t as observerBatching};
@@ -0,0 +1 @@
1
+ import{UniversalFinalizationRegistry as i}from"./UniversalFinalizationRegistry.js";var n=new i((function(i){var n;null===(n=i.reaction)||void 0===n||n.dispose(),i.reaction=null}));export{n as observerFinalizationRegistry};
@@ -0,0 +1 @@
1
+ import{getDependencyTree as r}from"mobx";function o(o){return r(o)}export{o as printDebugValue};
@@ -1 +1 @@
1
- import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=t.checkboxItem;e.useEffect((function(){r.showInCheckedStatus?r.isChecked=!0:r.isChecked=!1}),[r.showInCheckedStatus]);var i=r.requiredToBeChecked,o=e.useCallback((function(){var e=/<pre[^>]*>([\s\S]*?)<\/pre>/.exec(r.text);return e?e[1]:r.text}),[r.text]);return e.createElement("div",{style:{width:"100%",display:"flex",gap:6,flexDirection:"column"}},e.createElement("div",{style:{width:"100%",display:"flex",gap:8,flexDirection:"row",alignItems:"baseline",wordBreak:"break-word"}},e.createElement("input",{style:{width:"16px",height:"16px",cursor:"pointer",position:"relative",top:3},type:"checkbox",checked:r.isChecked,onChange:function(){r.isChecked=!r.isChecked,i&&i.hasError&&r.isChecked&&(i.hasError=!1)}}),e.createElement("div",{dangerouslySetInnerHTML:{__html:o()}})),!!i&&i.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},i.validationErrorMessage))}));export{r as CheckboxItemView};
1
+ import e from"react";import{observer as r}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";import{generateRandomId as t}from"../../../helpers/index.js";var o=r((function(r){var o=r.checkboxItem,c=r.formInputSettings,i="checkbox-".concat(t());e.useEffect((function(){o.showInCheckedStatus?o.isChecked=!0:o.isChecked=!1}),[o.showInCheckedStatus]);var a=o.requiredToBeChecked,n={width:"16px",height:"16px",cursor:"pointer",position:"relative",top:3,appearance:"none",border:"1px solid ".concat(c.borderColor),borderRadius:"4px"},s=e.useCallback((function(){var e=/<pre[^>]*>([\s\S]*?)<\/pre>/.exec(o.text);return e?e[1]:o.text}),[o.text]);return e.createElement("div",{style:{width:"100%",display:"flex",gap:6,flexDirection:"column"}},e.createElement("div",{style:{width:"100%",display:"flex",gap:8,flexDirection:"row",alignItems:"baseline",wordBreak:"break-word"}},e.createElement("input",{style:n,type:"checkbox",checked:o.isChecked,onChange:function(){o.isChecked=!o.isChecked,a&&a.hasError&&o.isChecked&&(a.hasError=!1)},id:i}),e.createElement("div",{style:{color:c.checkboxTextColor},dangerouslySetInnerHTML:{__html:s()}})),!!a&&a.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},a.validationErrorMessage))}));export{o as CheckboxItemView};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as r}from"../../../ext/tslib/tslib.es6.mjs.js";import t from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as a,injectFontScript as o,validateEmail as i,validatePhoneNumber as s}from"../../helpers/index.js";import{FormItemTypeEnum as l}from"../../models/modal/step/elements/form/index.js";import u from"../button-element-renderer/index.js";import m from"./input-item-view/index.js";import{CheckboxItemView as d}from"./checkbox-item-view/index.js";import c from"./date-item-view/index.js";import f from"./gender-item-view/index.js";var E=n((function(n){var E=n.element,p=n.popup,v=n.isPreviewMode,C=n.sfProps,I=t.useState(!1);I[0];var h=I[1],M=E,S=M.rows.slice().sort((function(e,r){return e.order-r.order})),g=M.formSettings,R=M.buttonSettings,O=M.bgColor,_={display:"flex",flexDirection:"column",justifyContent:a(M.horizontalAlignment),gap:"".concat(g.gapBetweenItems,"px"),padding:"".concat(M.outerVerticalPadding,"px ").concat(M.outerHorizontalPadding,"px"),backgroundColor:O,width:"100%"},T={display:"flex",flexDirection:"row",width:"100%",gap:"".concat(g.gapBetweenItems,"px")},b={flex:1,display:"flex",alignItems:"flex-end",fontFamily:o(g.fontFamily),fontSize:g.fontSize},U=function(){return e(void 0,void 0,void 0,(function(){var e,t,a;return r(this,(function(r){switch(r.label){case 0:return e=p.modal.steps.findIndex((function(e){return e.id===p.modal.selectedStep.id})),t=e===p.modal.steps.length-2,!v&&C&&t?(h(!0),o=0,M.rows.forEach((function(e){e.columns.forEach((function(e){switch(e.type){case l.CUSTOMER_BIRTHDAY:var r=e.formItem;r.required&&!r.value&&(r.required.hasError=!0,o++);break;case l.CUSTOMER_EMAIL:case l.CUSTOMER_PHONE:case l.CUSTOMER_NAME:case l.CUSTOMER_SURNAME:var t=e.formItem;if(t.required&&!t.value){if(t.type===l.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn))return;t.required.hasError=!0,o++}else if(e.type===l.CUSTOMER_EMAIL){var n=i(t.value||"");t.validEmailError.hasError=!n,n||o++}else if(e.type===l.CUSTOMER_PHONE&&t.required){var a=s(t.value||"",null==C?void 0:C.currentCountryCode);t.validPhoneError.hasError=!a,a||o++}break;case l.CUSTOMER_GENDER:var u=e.formItem,m=u.genders.find((function(e){return e.isSelected}));u.required&&!m&&(u.required.hasError=!0,o++);break;case l.CHECKBOX_FORM_ITEM:var d=e.formItem;d.requiredToBeChecked&&!d.isChecked&&(d.requiredToBeChecked.hasError=!0,o++)}}))})),o>0?(h(!1),[2]):(a={},M.rows.forEach((function(e){e.columns.forEach((function(e){var r;switch(e.type){case l.CUSTOMER_BIRTHDAY:a.birthday=e.formItem.value;break;case l.CUSTOMER_EMAIL:a.email=e.formItem.value;break;case l.CUSTOMER_GENDER:a.gender=(null===(r=e.formItem.genders.find((function(e){return e.isSelected})))||void 0===r?void 0:r.type)||"";break;case l.CUSTOMER_PHONE:a.phone=e.formItem.value;break;case l.CUSTOMER_NAME:a.firstName=e.formItem.value||"";break;case l.CUSTOMER_SURNAME:a.lastName=e.formItem.value||"";break;case l.CHECKBOX_FORM_ITEM:a.hasPermission=e.formItem.isChecked}}))})),[4,C.onCustomerSave(a)])):[3,2];case 1:r.sent(),n.setIsCustomerSaved(!0),h(!1),r.label=2;case 2:return-1!==e&&e<p.modal.steps.length&&(p.modal.selectedStep=p.modal.steps[e+1]),[2]}var o}))}))};return t.createElement("div",{style:_},S.map((function(e,r){return t.createElement("div",{style:T,key:r},e.columns.slice().sort((function(e,r){return e.order-r.order})).map((function(e,r){return t.createElement("div",{style:b,key:r},function(e){switch(e.type){case l.CUSTOMER_EMAIL:case l.CUSTOMER_PHONE:case l.CUSTOMER_NAME:case l.CUSTOMER_SURNAME:var r=e.formItem;if(r.type===l.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn)&&!v)return null;var n=null;if(e.type===l.CUSTOMER_EMAIL){var a=r;a.validEmailError.hasError&&(n=a.validEmailError.validationErrorMessage)}else if(e.type===l.CUSTOMER_PHONE){var o=r;o.validPhoneError.hasError&&(n=o.validPhoneError.validationErrorMessage)}return t.createElement(m,{formInputSettings:g.formInputSettings,inputLabel:r.inputLabel,isRequired:r.required,onValueChange:function(e){return v?null:r.value=e},placeholder:r.placeholder,updateCurrentInfo:r.updateCurrentInfo,value:r.value||"",validationErrorMessage:n});case l.CUSTOMER_BIRTHDAY:var i=e.formItem;return t.createElement(c,{formInputSettings:g.formInputSettings,inputLabel:i.inputLabel,isRequired:i.required,onValueChange:function(e){return v?null:i.value=e},placeholder:i.placeholder,updateCurrentInfo:i.updateCurrentInfo,value:i.value||""});case l.CUSTOMER_GENDER:var s=e.formItem;return t.createElement(f,{genderFormItem:s,formInputSettings:g.formInputSettings,onValueChange:function(e){return v?null:s.genders.forEach((function(r){r.isSelected=r.label===e}))}});case l.CHECKBOX_FORM_ITEM:return t.createElement(d,{checkboxItem:e.formItem})}}(e))})))})),t.createElement("div",{style:{width:"100%",minWidth:"fit-content"},onClick:function(e){U(),e.preventDefault(),e.stopPropagation()}},t.createElement(u,{element:R})," "))}));export{E as default};
1
+ import{__awaiter as e,__generator as r}from"../../../ext/tslib/tslib.es6.mjs.js";import t from"react";import{observer as n}from"../../../../../../mobx-react/dist/mobxreact.esm.js";import{getHorizontalAlignment as o,injectFontScript as a,validateEmail as i,validatePhoneNumber as s}from"../../helpers/index.js";import{FormItemTypeEnum as l}from"../../models/modal/step/elements/form/index.js";import u from"../button-element-renderer/index.js";import m from"./input-item-view/index.js";import{CheckboxItemView as d}from"./checkbox-item-view/index.js";import c from"./date-item-view/index.js";import f from"./gender-item-view/index.js";var E=n((function(n){var E=n.element,p=n.popup,v=n.isPreviewMode,C=n.sfProps,I=t.useState(!1);I[0];var S=I[1],h=E,M=h.rows.slice().sort((function(e,r){return e.order-r.order})),g=h.formSettings,R=h.buttonSettings,O=h.bgColor,_={display:"flex",flexDirection:"column",justifyContent:o(h.horizontalAlignment),gap:"".concat(g.gapBetweenItems,"px"),padding:"".concat(h.outerVerticalPadding,"px ").concat(h.outerHorizontalPadding,"px"),backgroundColor:O,width:"100%"},T={display:"flex",flexDirection:"row",width:"100%",gap:"".concat(g.gapBetweenItems,"px")},b={flex:1,display:"flex",alignItems:"flex-end",fontFamily:a(g.fontFamily),fontSize:g.fontSize},U=function(){return e(void 0,void 0,void 0,(function(){var e,t,o;return r(this,(function(r){switch(r.label){case 0:return e=p.modal.steps.findIndex((function(e){return e.id===p.modal.selectedStep.id})),t=e===p.modal.steps.length-2,!v&&C&&t?(S(!0),a=0,h.rows.forEach((function(e){e.columns.forEach((function(e){switch(e.type){case l.CUSTOMER_BIRTHDAY:var r=e.formItem;r.required&&!r.value&&(r.required.hasError=!0,a++);break;case l.CUSTOMER_EMAIL:case l.CUSTOMER_PHONE:case l.CUSTOMER_NAME:case l.CUSTOMER_SURNAME:var t=e.formItem;if(t.required&&!t.value){if(t.type===l.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn))return;t.required.hasError=!0,a++}else if(e.type===l.CUSTOMER_EMAIL){var n=i(t.value||"");t.validEmailError.hasError=!n,n||a++}else if(e.type===l.CUSTOMER_PHONE&&t.required){var o=s(t.value||"",null==C?void 0:C.currentCountryCode);t.validPhoneError.hasError=!o,o||a++}break;case l.CUSTOMER_GENDER:var u=e.formItem,m=u.genders.find((function(e){return e.isSelected}));u.required&&!m&&(u.required.hasError=!0,a++);break;case l.CHECKBOX_FORM_ITEM:var d=e.formItem;d.requiredToBeChecked&&!d.isChecked&&(d.requiredToBeChecked.hasError=!0,a++)}}))})),a>0?(S(!1),[2]):(o={},h.rows.forEach((function(e){e.columns.forEach((function(e){var r;switch(e.type){case l.CUSTOMER_BIRTHDAY:o.birthday=e.formItem.value;break;case l.CUSTOMER_EMAIL:o.email=e.formItem.value;break;case l.CUSTOMER_GENDER:o.gender=(null===(r=e.formItem.genders.find((function(e){return e.isSelected})))||void 0===r?void 0:r.type)||"";break;case l.CUSTOMER_PHONE:o.phone=e.formItem.value;break;case l.CUSTOMER_NAME:o.firstName=e.formItem.value||"";break;case l.CUSTOMER_SURNAME:o.lastName=e.formItem.value||"";break;case l.CHECKBOX_FORM_ITEM:o.hasPermission=e.formItem.isChecked}}))})),[4,C.onCustomerSave(o)])):[3,2];case 1:r.sent(),n.setIsCustomerSaved(!0),S(!1),r.label=2;case 2:return-1!==e&&e<p.modal.steps.length&&(p.modal.selectedStep=p.modal.steps[e+1]),[2]}var a}))}))};return t.createElement("div",{style:_},M.map((function(e,r){return t.createElement("div",{style:T,key:r},e.columns.slice().sort((function(e,r){return e.order-r.order})).map((function(e,r){return t.createElement("div",{style:b,key:r},function(e){switch(e.type){case l.CUSTOMER_EMAIL:case l.CUSTOMER_PHONE:case l.CUSTOMER_NAME:case l.CUSTOMER_SURNAME:var r=e.formItem;if(r.type===l.CUSTOMER_EMAIL&&(null==C?void 0:C.isCustomerLoggedIn)&&!v)return null;var n=null;if(e.type===l.CUSTOMER_EMAIL){var o=r;o.validEmailError.hasError&&(n=o.validEmailError.validationErrorMessage)}else if(e.type===l.CUSTOMER_PHONE){var a=r;a.validPhoneError.hasError&&(n=a.validPhoneError.validationErrorMessage)}return t.createElement(m,{formInputSettings:g.formInputSettings,inputLabel:r.inputLabel,isRequired:r.required,onValueChange:function(e){return v?null:r.value=e},placeholder:r.placeholder,updateCurrentInfo:r.updateCurrentInfo,value:r.value||"",validationErrorMessage:n,isPhoneInput:e.type===l.CUSTOMER_PHONE});case l.CUSTOMER_BIRTHDAY:var i=e.formItem;return t.createElement(c,{formInputSettings:g.formInputSettings,inputLabel:i.inputLabel,isRequired:i.required,onValueChange:function(e){return v?null:i.value=e},placeholder:i.placeholder,updateCurrentInfo:i.updateCurrentInfo,value:i.value||""});case l.CUSTOMER_GENDER:var s=e.formItem;return t.createElement(f,{genderFormItem:s,formInputSettings:g.formInputSettings,onValueChange:function(e){return v?null:s.genders.forEach((function(r){r.isSelected=r.label===e}))}});case l.CHECKBOX_FORM_ITEM:return t.createElement(d,{checkboxItem:e.formItem,formInputSettings:g.formInputSettings})}}(e))})))})),t.createElement("div",{style:{width:"100%",minWidth:"fit-content"},onClick:function(e){U(),e.preventDefault(),e.stopPropagation()}},t.createElement(u,{element:R})," "))}));export{E as default};
@@ -1 +1 @@
1
- import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";var r=t((function(t){var r=e.useState(!1),o=r[0],n=r[1];e.useRef(null);var l=t.placeholder,a=t.isRequired,i=t.inputLabel;t.updateCurrentInfo;var c=t.validationErrorMessage,d=t.formInputSettings,u=t.value,s=t.onValueChange,p={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(o?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},x=a?((null==l?void 0:l.text)||"")+" *":(null==l?void 0:l.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(i||a)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},i&&e.createElement("label",{style:{color:"black",fontSize:"14px"}},i.text)),a&&a.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},a.validationErrorMessage),!!c&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},c)),e.createElement("input",{type:"text",placeholder:x,value:u||"",onChange:function(e){return function(e){s(e),a&&a.hasError&&e.length>0&&(a.hasError=!1)}(e.target.value)},style:p,onFocus:function(){return n(!0)},onBlur:function(){return n(!1)}}))}));export{r as default};
1
+ import e from"react";import{observer as t}from"../../../../../../../mobx-react/dist/mobxreact.esm.js";import{generateRandomId as r}from"../../../helpers/index.js";import{PhoneNumberInput as o}from"../phone-input-item-view/index.js";var n=t((function(t){var n=e.useState(!1),a=n[0],l=n[1];e.useRef(null);var i=e.useMemo((function(){return r()}),[]),c=t.placeholder,s=t.isRequired,u=t.inputLabel;t.updateCurrentInfo;var p=t.validationErrorMessage,d=t.formInputSettings,m=t.value,f=t.onValueChange,x=t.isPhoneInput,h=t.sfProps,v={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(a?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},g=function(e){f(e),s&&s.hasError&&e.length>0&&(s.hasError=!1)},E=s?((null==c?void 0:c.text)||"")+" *":(null==c?void 0:c.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(u||s)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},u&&e.createElement("label",{style:{color:d.titleColor,fontSize:"14px"}},u.text)),s&&s.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},s.validationErrorMessage),!!p&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},p)),x?e.createElement(o,{onChange:function(e){return g(e)},placeholder:E,value:m||"",inputStyle:v,sfProps:h,className:"ikas-form-input-item-view-".concat(i)}):e.createElement("input",{type:"text",placeholder:E,value:m||"",onChange:function(e){return g(e.target.value)},style:v,onFocus:function(){return l(!0)},onBlur:function(){return l(!1)},className:"ikas-form-input-item-view-".concat(i)}),e.createElement("style",null,"\n .ikas-form-input-item-view-".concat(i,"::placeholder {\n color: ").concat(d.placeholderColor,";\n }\n ")))}));export{n as default};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as t}from"../../../../ext/tslib/tslib.es6.mjs.js";import"../../../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js";import"../../../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js";import"../../../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js";import"../../../../ext/libphonenumber-js/min/exports/AsYouType.js";import{getCountries as r}from"../../../../ext/libphonenumber-js/min/exports/getCountries.js";import"../../../../ext/libphonenumber-js/min/exports/Metadata.js";import"../../../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js";import"../../../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js";var n=function(n){return e(void 0,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return e=function(e){if(!e)return"https://cdn.myikas.com/sf/static/locale/country/en.json";var t=e;return["de","el","en","es","fi","fr","it","nb","pl","pt-BR","pt","ru","sv","tr","ua","vi"].some((function(e){return e===t}))||(t="en"),"https://cdn.myikas.com/sf/static/locale/country/".concat(t,".json")}(n),[4,fetch(e)];case 1:return[4,t.sent().json()];case 2:return s=t.sent(),[2,r().map((function(e){return{value:e,label:s[e]}})).sort((function(e,t){return function(e,t){return e.localeCompare(t)}(e.label,t.label)}))]}}))}))};export{n as default};
@@ -0,0 +1 @@
1
+ import{__awaiter as e,__generator as t,__assign as r}from"../../../../ext/tslib/tslib.es6.mjs.js";import*as o from"react";import"../../../../ext/mobx-react-lite/es/index.js";import n from"../../../../ext/libphonenumber-js/es6/parseIncompletePhoneNumber.js";import"../../../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js";import"../../../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js";import{parsePhoneNumber as i}from"../../../../ext/libphonenumber-js/min/exports/parsePhoneNumber.js";import"../../../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js";import"../../../../ext/libphonenumber-js/min/exports/AsYouType.js";import{isSupportedCountry as s}from"../../../../ext/libphonenumber-js/min/exports/isSupportedCountry.js";import{getCountryCallingCode as a}from"../../../../ext/libphonenumber-js/min/exports/getCountryCallingCode.js";import"../../../../ext/libphonenumber-js/min/exports/Metadata.js";import{formatIncompletePhoneNumber as l}from"../../../../ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js";import"../../../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js";import"../../../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js";import m from"./get-countries.js";import{observer as p}from"../../../../ext/mobx-react-lite/es/observer.js";var u=p((function(p){var u=p.disabled,d=void 0!==u&&u,c=p.placeholder,b=p.value,h=p.onChange,v=p.inputStyle,x=p.className,f=p.sfProps,g=o.useState([]),j=g[0],y=g[1],C=o.useState((null==f?void 0:f.currentCountryCode)||"TR"),N=C[0],E=C[1],P=o.useState(""),w=P[0],S=P[1];o.useEffect((function(){I();var e=N;if(s(e)||(e="US"),b){var t=i(b);t&&t.country&&(e=t.country),S(l(b,e))}else _(e);E(e)}),[null==f?void 0:f.currentCountryCode]);var I=function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,m(null==f?void 0:f.currentLocale)];case 1:return e=t.sent(),y(e),[2]}}))}))},_=function(e){var t=a(e);S("+".concat(t))},k=function(e){return l(e,N)};return o.createElement("div",{style:r({position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",gap:8,pointerEvents:f?void 0:"none"},v)},o.createElement("div",{style:{}},o.createElement("div",{style:{position:"relative",width:"35px",height:"24px",flex:"0 0 35px"}},o.createElement("div",{style:{position:"relative",width:"35px",height:"24px",display:"flex",alignItems:"center"}},o.createElement("img",{style:{width:"24px",flex:"0 0 24px"},alt:N,src:"https://cdn.myikas.com/sf/assets/flags/3x2/".concat(N,".svg")}),o.createElement("div",{style:{display:"block",width:"0.3em",height:"0.3em",marginLeft:"0.35em",marginTop:"-0.2em",borderStyle:"solid",borderColor:"inherit",borderTopWidth:0,borderBottomWidth:"1px",borderLeftWidth:0,borderRightWidth:"1px",transform:"rotate(45deg)",opacity:.45,flex:"0 0 0.3em"}})),o.createElement("select",{style:{position:"absolute",top:0,left:0,zIndex:1,padding:0,opacity:0,border:0,width:"100%",height:"100%",cursor:"pointer"},value:N,onChange:function(e){if(e.target.value){var t=e.target.value;E(t),_(t)}},disabled:d},j.map((function(e){return o.createElement("option",{key:e.value,value:e.value},e.label)}))))),o.createElement("input",{type:"tel",autoComplete:"tel",value:w,onChange:function(e){var t=j.find((function(t){var r;return t.value===(null===(r=i(e.target.value))||void 0===r?void 0:r.country)}));t&&E(t.value);var r=k(e.target.value);S(r),h(r?n(r):e.target.value)},placeholder:c,disabled:d,className:x,style:{width:"100%",backgroundColor:"transparent",background:"transparent",border:"none",outline:"none"}}))}));export{u as PhoneNumberInput};
@@ -1 +1 @@
1
- import{__spreadArray as e}from"../../ext/tslib/tslib.es6.mjs.js";import"../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js";import"../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js";import{isValidPhoneNumber as t}from"../../ext/libphonenumber-js/min/exports/isValidPhoneNumber.js";import"../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js";import"../../ext/libphonenumber-js/min/exports/AsYouType.js";import"../../ext/libphonenumber-js/min/exports/Metadata.js";import"../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js";import"../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js";import{ComponentHorizontalAlignmentEnum as n,PopupElementTypeEnum as a}from"../models/modal/step/elements/base/index.js";var r=function(t){var n=[];return t.modal.steps.forEach((function(t){t.elements.forEach((function(t){if(t.type===a.PRODUCT_LIST){var r=t.variantPairs;r&&(n=e(e([],n,!0),r,!0))}}))})),{variantPairs:n}},i=function(e){var t="";switch(e){case n.LEFT:t="flex-start";break;case n.CENTER:t="center";break;case n.RIGHT:t="flex-end"}return t},s=function(e){if(e.name){var t=e.name.replace(/ /g,"+"),n="";if(e.variants){n+=":";var a=e.variants.some((function(e){return"italic"===e}));if(a&&(n+="ital,"),n+="wght@",a){var r=new RegExp("italic","i");n+=e.variants.reduce((function(e,t){return r.test(t)?e:e+"0,".concat(t.replace("regular","400"),";")}),""),n+=e.variants.reduce((function(e,t){return r.test(t)?e+"1,".concat("italic"===t?"400":t.replace("italic",""),";"):e}),"")}else n+=e.variants.reduce((function(e,t){return e+"".concat(t.replace("regular","400"),";")}),"");n=n.substring(0,n.length-1),n+="&display=swap"}return"https://fonts.googleapis.com/css2?family=".concat(t).concat(n)}},o=function(e){var t="'".concat(e.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif');if(document.getElementById("ikas-popup-font-".concat(e.name)))return t;var n=s(e);if(n){var a=document.createElement("link");return a.setAttribute("id","ikas-popup-font-".concat(e.name)),a.setAttribute("rel","stylesheet"),a.setAttribute("href",n),document.getElementsByTagName("head")[0].appendChild(a),t}},m=function(e){return!(e.length>320)&&/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)},c=function(e,n){return t(e,n?n.toUpperCase():"TR")};export{s as getGoogleFontHref,i as getHorizontalAlignment,r as getPopupDynamicData,o as injectFontScript,m as validateEmail,c as validatePhoneNumber};
1
+ import{__spreadArray as e}from"../../ext/tslib/tslib.es6.mjs.js";import"../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js";import"../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js";import{isValidPhoneNumber as t}from"../../ext/libphonenumber-js/min/exports/isValidPhoneNumber.js";import"../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js";import"../../ext/libphonenumber-js/min/exports/AsYouType.js";import"../../ext/libphonenumber-js/min/exports/Metadata.js";import"../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js";import"../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js";import{ComponentHorizontalAlignmentEnum as n,PopupElementTypeEnum as a}from"../models/modal/step/elements/base/index.js";var r=function(t){var n=[];return t.modal.steps.forEach((function(t){t.elements.forEach((function(t){if(t.type===a.PRODUCT_LIST){var r=t.variantPairs;r&&(n=e(e([],n,!0),r,!0))}}))})),{variantPairs:n}},i=function(e){var t="";switch(e){case n.LEFT:t="flex-start";break;case n.CENTER:t="center";break;case n.RIGHT:t="flex-end"}return t},s=function(e){if(e.name){var t=e.name.replace(/ /g,"+"),n="";if(e.variants){n+=":";var a=e.variants.some((function(e){return"italic"===e}));if(a&&(n+="ital,"),n+="wght@",a){var r=new RegExp("italic","i");n+=e.variants.reduce((function(e,t){return r.test(t)?e:e+"0,".concat(t.replace("regular","400"),";")}),""),n+=e.variants.reduce((function(e,t){return r.test(t)?e+"1,".concat("italic"===t?"400":t.replace("italic",""),";"):e}),"")}else n+=e.variants.reduce((function(e,t){return e+"".concat(t.replace("regular","400"),";")}),"");n=n.substring(0,n.length-1),n+="&display=swap"}return"https://fonts.googleapis.com/css2?family=".concat(t).concat(n)}},o=function(e){var t="'".concat(e.name,'\', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif');if(document.getElementById("ikas-popup-font-".concat(e.name)))return t;var n=s(e);if(n){var a=document.createElement("link");return a.setAttribute("id","ikas-popup-font-".concat(e.name)),a.setAttribute("rel","stylesheet"),a.setAttribute("href",n),document.getElementsByTagName("head")[0].appendChild(a),t}},m=function(e){return!(e.length>320)&&/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)},u=function(e,n){return t(e,n?n.toUpperCase():"TR")},l=function(e){var t;return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)+(null!==(t=null==e?void 0:e.length)&&void 0!==t?t:0)};export{l as generateRandomId,s as getGoogleFontHref,i as getHorizontalAlignment,r as getPopupDynamicData,o as injectFontScript,m as validateEmail,u as validatePhoneNumber};
@@ -1 +1 @@
1
- import{makeObservable as o,observable as r}from"mobx";import{IkasPopupRendererFontFamily as t}from"../../base/index.js";var e=function(e){var n,s;void 0===e&&(e={}),this.formInputSettings=e.formInputSettings?new i(e.formInputSettings):new i({borderColor:"#E3E8EF",focusBorderColor:"#000000"}),this.gapBetweenItems=null!==(n=e.gapBetweenItems)&&void 0!==n?n:12,this.fontFamily=new t(e.fontFamily),this.fontSize=null!==(s=e.fontSize)&&void 0!==s?s:14,o(this,{formInputSettings:r,gapBetweenItems:r,fontFamily:r,fontSize:r})},i=function(t){var e,i,n;void 0===t&&(t={}),this.bgColor=t.bgColor||"",this.borderWidth=null!==(e=t.borderWidth)&&void 0!==e?e:1,this.borderRadius=null!==(i=t.borderRadius)&&void 0!==i?i:4,this.borderColor=t.borderColor||"",this.focusBorderColor=t.focusBorderColor||"",this.height=null!==(n=t.height)&&void 0!==n?n:40,o(this,{bgColor:r,borderWidth:r,borderRadius:r,borderColor:r,focusBorderColor:r,height:r})};export{i as FormInputSettings,e as FormSettings};
1
+ import{makeObservable as o,observable as r}from"mobx";import{IkasPopupRendererFontFamily as t}from"../../base/index.js";var e=function(e){var l,s;void 0===e&&(e={}),this.formInputSettings=e.formInputSettings?new i(e.formInputSettings):new i({borderColor:"#E3E8EF",focusBorderColor:"#000000"}),this.gapBetweenItems=null!==(l=e.gapBetweenItems)&&void 0!==l?l:12,this.fontFamily=new t(e.fontFamily),this.fontSize=null!==(s=e.fontSize)&&void 0!==s?s:14,o(this,{formInputSettings:r,gapBetweenItems:r,fontFamily:r,fontSize:r})},i=function(t){var e,i,l;void 0===t&&(t={}),this.bgColor=t.bgColor||"",this.borderWidth=null!==(e=t.borderWidth)&&void 0!==e?e:1,this.borderRadius=null!==(i=t.borderRadius)&&void 0!==i?i:4,this.borderColor=t.borderColor||"",this.focusBorderColor=t.focusBorderColor||"",this.height=null!==(l=t.height)&&void 0!==l?l:40,this.placeholderColor=t.placeholderColor?t.placeholderColor:"#697586",this.titleColor=t.titleColor?t.titleColor:"#121926",this.checkboxTextColor=t.checkboxTextColor?t.checkboxTextColor:"#121926",o(this,{bgColor:r,borderWidth:r,borderRadius:r,borderColor:r,focusBorderColor:r,height:r,placeholderColor:r,titleColor:r,checkboxTextColor:r})};export{i as FormInputSettings,e as FormSettings};
@@ -1 +1 @@
1
- import{__extends as t,__assign as e}from"../../../../../../ext/tslib/tslib.es6.mjs.js";import{makeObservable as o,observable as r,action as n}from"mobx";import{PopupElementTypeEnum as i,BaseElement as s}from"../base/index.js";import{ButtonElement as a}from"../button/index.js";import{FormSettings as m}from"./form-settings/index.js";import{CustomerNameFormItem as u}from"./customer-name/index.js";import{CustomerSurnameFormItem as l}from"./customer-surname/index.js";import{CustomerEmailFormItem as d}from"./customer-email/index.js";import{CustomerPhoneFormItem as p}from"./customer-phone/index.js";import{CustomerBirthdayFormItem as E}from"./customer-birthday/index.js";import{CustomerGenderFormItem as c}from"./customer-gender/index.js";import{CheckboxFormItem as C}from"./checkbox/index.js";import{CustomerAttributeFormItem as h}from"./customer-attribute/index.js";import{Popup as T}from"../../../../index.js";var M,R;(R=M||(M={})).CUSTOMER_NAME="CUSTOMER_NAME",R.CUSTOMER_SURNAME="CUSTOMER_SURNAME",R.CUSTOMER_EMAIL="CUSTOMER_EMAIL",R.CUSTOMER_PHONE="CUSTOMER_PHONE",R.CUSTOMER_BIRTHDAY="CUSTOMER_BIRTHDAY",R.CUSTOMER_GENDER="CUSTOMER_GENDER",R.CHECKBOX_FORM_ITEM="CHECKBOX_FORM_ITEM",R.CUSTOMER_ATTRIBUTE="CUSTOMER_ATTRIBUTE";var f=function(e){function s(t,s){void 0===t&&(t={});var u,l,d,p,E=this;return(E=e.call(this,t)||this).type=i.FORM,E.rows=t.rows?t.rows.map((function(t){return new S(t)})):[],E.formSettings=t.formSettings||new m,E.buttonSettings=t.buttonSettings||new a({outerHorizontalPadding:0,outerVerticalPadding:0,buttonBgColor:"#000000",borderColor:"#000000"}),E.bgColor=t.bgColor||"",E.outerVerticalPadding=null!==(u=t.outerVerticalPadding)&&void 0!==u?u:10,E.outerHorizontalPadding=null!==(l=t.outerHorizontalPadding)&&void 0!==l?l:0,E.verticalPadding=null!==(d=t.verticalPadding)&&void 0!==d?d:0,E.horizontalPadding=null!==(p=t.horizontalPadding)&&void 0!==p?p:0,o(E,{rows:r,formSettings:r,buttonSettings:r,bgColor:r,addNewElement:n.bound}),0===E.rows.length&&1===s&&E.addNewElement(M.CUSTOMER_EMAIL),E}return t(s,e),s.prototype.addNewElement=function(t){var e=new S({order:this.rows.length,columns:[new w({type:t,order:0})]});this.rows.push(e)},s}(s),S=function(){function t(t){var e;void 0===t&&(t={}),this.id=t.id||Date.now().toString(),this.order=null!==(e=t.order)&&void 0!==e?e:0,this.columns=t.columns?t.columns.map((function(t){return new w(t)})):[],o(this,{id:r,order:r,columns:r,addNewElement:n.bound,changeColumnSort:n.bound})}return t.prototype.addNewElement=function(t){this.columns.push(new w({type:t,order:this.columns.length}))},t.prototype.changeColumnSort=function(){this.columns.forEach((function(t,e){0===e?t.order=t.order+1:1===e&&(t.order=t.order-1)})),this.columns=this.columns.sort((function(t,e){return t.order-e.order}))},t}(),w=function(){function t(t){var e;void 0===t&&(t={}),this.id=t.id||Date.now().toString(),this.order=null!==(e=t.order)&&void 0!==e?e:0,this.type=t.type||M.CUSTOMER_NAME,this.formItem=this.setFormItems(t.formItem),o(this,{id:r,order:r,type:r,formItem:r,setFormItems:n.bound})}return t.prototype.setFormItems=function(t){switch(this.type){case M.CUSTOMER_NAME:return new u(t?e({},t):{inputLabel:new g({text:T.t("popup:initialClassTranslations.firstName")})});case M.CUSTOMER_SURNAME:return new l(t?e({},t):{inputLabel:new g({text:T.t("popup:initialClassTranslations.lastName")})});case M.CUSTOMER_EMAIL:return new d(t?e({},t):{inputLabel:new g({text:T.t("popup:initialClassTranslations.email")})});case M.CUSTOMER_PHONE:return new p(t?e({},t):{inputLabel:new g({text:T.t("popup:initialClassTranslations.phone")})});case M.CUSTOMER_BIRTHDAY:return new E(t?e({},t):{inputLabel:new g({text:T.t("popup:initialClassTranslations.birthday")})});case M.CUSTOMER_GENDER:return new c(t?e({},t):{inputLabel:new g({text:T.t("popup:initialClassTranslations.gender")})});case M.CHECKBOX_FORM_ITEM:return new C(e({},t));case M.CUSTOMER_ATTRIBUTE:return new h(e({},t))}},t}(),g=function(t){void 0===t&&(t={}),this.text=t.text||T.t("popup:initialClassTranslations.inputLabel"),o(this,{text:r})},O=function(t){void 0===t&&(t={}),this.validationErrorMessage=t.validationErrorMessage||T.t("popup:initialClassTranslations.requiredFieldErrorMessage"),this.hasError=t.hasError||!1,o(this,{validationErrorMessage:r,hasError:r})},_=function(t){void 0===t&&(t={}),this.text=t.text||T.t("popup:initialClassTranslations.placeholder"),o(this,{text:r})};export{w as FormColumn,f as FormElement,M as FormItemTypeEnum,S as FormRow,g as InputLabel,_ as InputPlaceholder,O as RequiredInput};
1
+ import{__extends as t,__assign as e}from"../../../../../../ext/tslib/tslib.es6.mjs.js";import{makeObservable as o,observable as r,action as n}from"mobx";import{PopupElementTypeEnum as i,BaseElement as s}from"../base/index.js";import{ButtonElement as a}from"../button/index.js";import{FormSettings as m}from"./form-settings/index.js";import{CustomerNameFormItem as u}from"./customer-name/index.js";import{CustomerSurnameFormItem as l}from"./customer-surname/index.js";import{CustomerEmailFormItem as d}from"./customer-email/index.js";import{CustomerPhoneFormItem as p}from"./customer-phone/index.js";import{CustomerBirthdayFormItem as E}from"./customer-birthday/index.js";import{CustomerGenderFormItem as c}from"./customer-gender/index.js";import{CheckboxFormItem as C}from"./checkbox/index.js";import{CustomerAttributeFormItem as h}from"./customer-attribute/index.js";import{Popup as T}from"../../../../index.js";var M;!function(t){t.CUSTOMER_NAME="CUSTOMER_NAME",t.CUSTOMER_SURNAME="CUSTOMER_SURNAME",t.CUSTOMER_EMAIL="CUSTOMER_EMAIL",t.CUSTOMER_PHONE="CUSTOMER_PHONE",t.CUSTOMER_BIRTHDAY="CUSTOMER_BIRTHDAY",t.CUSTOMER_GENDER="CUSTOMER_GENDER",t.CHECKBOX_FORM_ITEM="CHECKBOX_FORM_ITEM",t.CUSTOMER_ATTRIBUTE="CUSTOMER_ATTRIBUTE"}(M||(M={}));var f=function(e){function s(t,s){void 0===t&&(t={});var u,l,d,p,E=this;return(E=e.call(this,t)||this).type=i.FORM,E.rows=t.rows?t.rows.map((function(t){return new R(t)})):[],E.formSettings=t.formSettings||new m,E.buttonSettings=t.buttonSettings||new a({outerHorizontalPadding:0,outerVerticalPadding:0,buttonBgColor:"#000000",borderColor:"#000000"}),E.bgColor=t.bgColor||"",E.outerVerticalPadding=null!==(u=t.outerVerticalPadding)&&void 0!==u?u:10,E.outerHorizontalPadding=null!==(l=t.outerHorizontalPadding)&&void 0!==l?l:0,E.verticalPadding=null!==(d=t.verticalPadding)&&void 0!==d?d:0,E.horizontalPadding=null!==(p=t.horizontalPadding)&&void 0!==p?p:0,o(E,{rows:r,formSettings:r,buttonSettings:r,bgColor:r,addNewElement:n.bound}),0===E.rows.length&&1===s&&E.addNewElement(M.CUSTOMER_EMAIL),E}return t(s,e),s.prototype.addNewElement=function(t){var e=new R({order:this.rows.length,columns:[new S({type:t,order:0})]});this.rows.push(e)},s}(s),R=function(){function t(t){var e;void 0===t&&(t={}),this.id=t.id||Date.now().toString(),this.order=null!==(e=t.order)&&void 0!==e?e:0,this.columns=t.columns?t.columns.map((function(t){return new S(t)})):[],o(this,{id:r,order:r,columns:r,addNewElement:n.bound,changeColumnSort:n.bound})}return t.prototype.addNewElement=function(t){this.columns.push(new S({type:t,order:this.columns.length}))},t.prototype.changeColumnSort=function(){this.columns.forEach((function(t,e){0===e?t.order=t.order+1:1===e&&(t.order=t.order-1)})),this.columns=this.columns.sort((function(t,e){return t.order-e.order}))},t}(),S=function(){function t(t){var e;void 0===t&&(t={}),this.id=t.id||Date.now().toString(),this.order=null!==(e=t.order)&&void 0!==e?e:0,this.type=t.type||M.CUSTOMER_NAME,this.formItem=this.setFormItems(t.formItem),o(this,{id:r,order:r,type:r,formItem:r,setFormItems:n.bound})}return t.prototype.setFormItems=function(t){switch(this.type){case M.CUSTOMER_NAME:return new u(t?e({},t):{inputLabel:new w({text:T.t("popup:initialClassTranslations.firstName")})});case M.CUSTOMER_SURNAME:return new l(t?e({},t):{inputLabel:new w({text:T.t("popup:initialClassTranslations.lastName")})});case M.CUSTOMER_EMAIL:return new d(t?e({},t):{inputLabel:new w({text:T.t("popup:initialClassTranslations.email")})});case M.CUSTOMER_PHONE:return new p(t?e({},t):{inputLabel:new w({text:T.t("popup:initialClassTranslations.phone")})});case M.CUSTOMER_BIRTHDAY:return new E(t?e({},t):{inputLabel:new w({text:T.t("popup:initialClassTranslations.birthday")})});case M.CUSTOMER_GENDER:return new c(t?e({},t):{inputLabel:new w({text:T.t("popup:initialClassTranslations.gender")})});case M.CHECKBOX_FORM_ITEM:return new C(e({},t));case M.CUSTOMER_ATTRIBUTE:return new h(e({},t))}},t}(),w=function(t){void 0===t&&(t={}),this.text=t.text||T.t("popup:initialClassTranslations.inputLabel"),o(this,{text:r})},g=function(t){void 0===t&&(t={}),this.validationErrorMessage=t.validationErrorMessage||T.t("popup:initialClassTranslations.requiredFieldErrorMessage"),this.hasError=t.hasError||!1,o(this,{validationErrorMessage:r,hasError:r})},O=function(t){void 0===t&&(t={}),this.text=t.text||T.t("popup:initialClassTranslations.placeholder"),o(this,{text:r})};export{S as FormColumn,f as FormElement,M as FormItemTypeEnum,R as FormRow,w as InputLabel,O as InputPlaceholder,g as RequiredInput};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "6.1.0-beta.80",
3
+ "version": "6.1.0-beta.82",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -17,15 +17,15 @@
17
17
  "build": "rm -rf build && rollup -c"
18
18
  },
19
19
  "dependencies": {
20
- "@ikas/popup-renderer": "^1.0.190",
20
+ "@ikas/popup-renderer": "^1.0.202",
21
21
  "swiper": "11.0.6"
22
22
  },
23
23
  "devDependencies": {
24
- "@ikas/storefront-api": "^6.1.0-beta.80",
25
- "@ikas/storefront-config": "^6.1.0-beta.80",
26
- "@ikas/storefront-model-functions": "^6.1.0-beta.80",
27
- "@ikas/storefront-models": "^6.1.0-beta.80",
28
- "@ikas/storefront-providers": "^6.1.0-beta.80",
24
+ "@ikas/storefront-api": "^6.1.0-beta.82",
25
+ "@ikas/storefront-config": "^6.1.0-beta.82",
26
+ "@ikas/storefront-model-functions": "^6.1.0-beta.82",
27
+ "@ikas/storefront-models": "^6.1.0-beta.82",
28
+ "@ikas/storefront-providers": "^6.1.0-beta.82",
29
29
  "@ikas/localized-address": "1.0.0-beta.6",
30
30
  "@adyen/adyen-web": "^5.57.0",
31
31
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -60,11 +60,11 @@
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@ikas/localized-address": "1.0.0-beta.6",
63
- "@ikas/storefront-api": "^6.1.0-beta.80",
64
- "@ikas/storefront-config": "^6.1.0-beta.80",
65
- "@ikas/storefront-model-functions": "^6.1.0-beta.80",
66
- "@ikas/storefront-models": "^6.1.0-beta.80",
67
- "@ikas/storefront-providers": "^6.1.0-beta.80",
63
+ "@ikas/storefront-api": "^6.1.0-beta.82",
64
+ "@ikas/storefront-config": "^6.1.0-beta.82",
65
+ "@ikas/storefront-model-functions": "^6.1.0-beta.82",
66
+ "@ikas/storefront-models": "^6.1.0-beta.82",
67
+ "@ikas/storefront-providers": "^6.1.0-beta.82",
68
68
  "mobx": "^6.1.3",
69
69
  "mobx-react-lite": "^3.1.5",
70
70
  "next": "12.2.0",