@ikas/storefront 4.11.2 → 4.11.3
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.
|
@@ -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{IkasCouponCodeRequirement as o,IkasPaymentMethodType as a,IkasPaymentGatewayType as c,IkasOrderShippingMethod as d,IkasCartCreatedBy as u,IkasOrderPaymentStatus as l,IkasTransactionStatus as h,IkasCartCampaignOfferStatus as p,IkasCampaignOfferTargetPageType as m,IkasOrderLineItemStatus as f,IkasCustomerEmailSubscriptionStatus as g}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 v}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as y}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 k}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as S}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/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 b}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 C}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/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/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as P}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/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 I}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 A from"./components/credit-card-form/model.js";import w from"../../store/customer/api.js";import N from"../../store/checkout/index.js";import E from"../../store/cart/api.js";import O,{MFS_ELEMENT_ID as j,MFS_SCRIPT_URL as R}from"./modelMasterPass.js";import D from"../../store/product/index.js";import{IkasBaseStore as x}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as T}from"@ikas/storefront-config";import{Analytics as G}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as L,CheckStocksLineInput as M}from"@ikas/storefront-api";import _ from"../../models/data/order/address/ikas-localized-order-address.js";import V from"../../store/location/index.js";import{getCookieValue as U}from"../../utils/helper.js";var F,K,B=/^\d+$/,Z="undefined"==typeof localStorage,Y=function(){function B(u,S,b,B,Y,W,Q,z,X,$){var J=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isEPayKolayPayment=!1,this.step=F.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.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(J,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,x.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 3:return e.sent(),[4,this.initStep()];case 4:return e.sent(),[2]}}))}))},this.initStep=function(){return e(J,void 0,void 0,(function(){var e,s,n,r,a,c,d;return t(this,(function(t){switch(t.label){case 0:if(T.getIsEditor())return this.step=F.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===F.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(F.INFO)];if(this.step!==F.PAYMENT||this.canProceedToPayment){if(this.step===F.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(F.INFO)];if(![F.INFO,F.SUCCESS,F.SHIPPING,F.PAYMENT].includes(this.step))return[2,this.changeStep(F.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(F.INFO)]:[2,this.changeStep(F.SHIPPING)];this.deliveryMethod="in-store"}}return n&&(this.error={type:K.PAYMENT_ERROR,data:r||null}),this.step!==F.SHIPPING&&this.step!==F.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new y(i(i({},this.checkoutSettings),{couponCodeRequirement:o.DEFAULT}))),this.step!==F.INFO?[3,6]:this.isDigitalOnly?[3,3]:[4,this.getAvailableShippingZones()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 2:t.sent(),this.checkShippingCountries(),t.label=3;case 3:return[4,this.getStockLocations()];case 4:return t.sent(),[4,this.getAvailableStockLocations()];case 5:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=6;case 6:return this.step!==F.SHIPPING||1!==(null===(c=this.checkout.availableShippingMethods)||void 0===c?void 0:c.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=F.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==F.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==F.SUCCESS||this.checkout.orderPaymentStatus!==l.PAID?[3,8]:[4,this.listProductFile()]:(this.error={type:K.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 7:t.sent(),t.label=8;case 8:return this.step!==F.PAYMENT&&this.step!==F.SUCCESS?[3,12]:[4,this.listPaymentGateways()];case 9:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,11];case 10:t.sent(),t.label=11;case 11:if(!this.paymentGateways.length)return this.error={type:K.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=12;case 12:return this.step===F.SUCCESS?[3,16]:this.checkout.isComplete?[2,this.changeStep(F.SUCCESS)]:[3,13];case 13:return[4,this.initialStockCheck()];case 14:t.sent(),t.label=15;case 15:return[3,18];case 16:return[4,this.getSuccessTransaction()];case 17:t.sent(),this.successTransaction&&(a=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===a}))),t.label=18;case 18:return this.isCheckoutLoaded=!0,G.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,w.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransaction=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(J,void 0,void 0,(function(){var e,i,s,n;return t(this,(function(t){switch(t.label){case 0:return e=new L(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!==F.INFO&&this.step!==F.SHIPPING||this.isDigitalOnly||(e.billingAddress=null),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===g.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,E.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===(n=s.extensions)||void 0===n?void 0:n.code)?{type:K.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:K.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(J,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(J,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,u,l,h,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===d.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(l=T.getStockLocationIds())||void 0===l?void 0:l.length)?T.getStockLocationIds():null,[4,N.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:K.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(h=i.data)||void 0===h?void 0:h.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++)u=c[a],r(u);throw{type:K.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(J,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(J,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,x.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(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getAvailableShippingCountries({salesChannelId:T.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return T.getPickupStockLocationIds()?[4,N.listStockLocation({id:{in:T.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:K.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return T.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,N.getAvailableStockLocations({lines:e.map((function(e){return new M(e)})),stockLocationIdList:T.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:K.API_ERROR},[2];this.availableStockLocations=i.data||[],t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=J.shippingCountryIds)||void 0===e?void 0:e.length)||(J.error={type:K.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){"address"===e&&(J.checkout.stockLocationId=null,J.checkout.shippingAddress=new _,J.checkout.shippingAddress.countrySettings=J.countrySettings,J.checkout.shippingAddress.checkoutSettings=J.checkoutSettings,J.checkout.shippingAddress.shippingZones=J.shippingZones),J.deliveryMethod=e,J.isErrorsVisible=!1},this.initialStockCheck=function(){return e(J,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:K.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(J,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=T.getPaymentGateways().map((function(e){return e.id})),[4,N.listPaymentGateway({id:e?void 0:{in:i},locale:T.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess&&(null===(u=s.data)||void 0===u?void 0:u.length)?(n=s.data,this.step===F.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(h.checkout.currencyCode)})),(o=null===(l=this.checkout.shippingAddress)||void 0===l?void 0:l.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=[],r(T.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&a.push(t)})),this.paymentGateways=e?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===F.PAYMENT&&(c=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=j,d.src=R,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:x.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:K.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return e(J,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,N.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;J.store.customerStore.customer?(null===(e=J.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=J.checkoutSettings,e.shippingZones=J.shippingZones})),J.checkout.customer=new C(J.store.customerStore.customer)):J.checkout.customer=new C(J.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){J.checkout.shippingAddress&&(J.checkout.shippingAddress.checkoutSettings=J.checkoutSettings,J.checkout.shippingAddress.shippingZones=J.shippingZones,J.checkout.shippingAddress.countrySettings=J.countrySettings,J.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){J.checkout.billingAddress&&(J.checkout.billingAddress.checkoutSettings=J.checkoutSettings,J.checkout.billingAddress.shippingZones=J.shippingZones,J.checkout.billingAddress.countrySettings=J.countrySettings,J.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!J.isDigitalOnly)if(J.isInStoreDelivery)J.setCheckoutShippingAddressSettings();else if(J.checkout.shippingAddress){if(J.store.customerStore.customer){var e=null==(t=J.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=J.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return J.onSelectedShippingAddressIdChange(e.id||"-1"),void J.setCheckoutShippingAddressSettings()}J.checkout.shippingAddress=new _(n(J.checkout.shippingAddress)||{}),J.setCheckoutShippingAddressSettings()}else if(J.store.customerStore.customer){var t=J.customerAddresses;J.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else J.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(J.useDifferentAddress=!!localStorage.getItem("sAddr"),J.checkout.billingAddress){if(J.store.customerStore.customer){var e=null==(t=J.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=J.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return J.onSelectedBillingAddressIdChange(e.id||"-1"),void J.setCheckoutBillingAddressSettings()}J.checkout.billingAddress=new _(n(J.checkout.billingAddress)||{}),J.setCheckoutBillingAddressSettings()}else if(J.store.customerStore.customer){var t=J.customerAddresses;J.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||J.useDifferentAddress||!J.checkout.shippingAddress||J.isInStoreDelivery||(J.checkout.billingAddress=new _(n(J.checkout.shippingAddress)),J.setCheckoutBillingAddressSettings())}else J.onSelectedBillingAddressIdChange("-1"),J.useDifferentAddress||!J.checkout.shippingAddress||J.isInStoreDelivery||(J.checkout.billingAddress=new _(n(J.checkout.shippingAddress)),J.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(J,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 v(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(J,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(J,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,5,,6]),[4,E.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===F.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice}})]:[3,3]):[3,4];case 2:t.sent(),t.label=3;case 3:s&&(r=this.checkout,this.checkout=new v(i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),t.label=4;case 4:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,6];case 5:return t.sent(),[3,6];case 6:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(J,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,V.getAvailableShippingZones({salesChannelId:T.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(J.selectedShippingAddressId=e,"-1"===e)J.checkout.shippingAddress=new _,J.checkout.shippingAddress.countrySettings=J.countrySettings;else{var i=null===(t=J.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(J.checkout.shippingAddress=new _(i),J.checkout.shippingAddress.countrySettings=J.countrySettings)}J.checkout.shippingAddress&&(J.checkout.shippingAddress.checkoutSettings=J.checkoutSettings,J.checkout.shippingAddress.shippingZones=J.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(J.selectedBillingAddressId=e,"-1"===e)J.checkout.billingAddress=new _,J.checkout.billingAddress.countrySettings=J.countrySettings;else{var i=null===(t=J.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(J.checkout.billingAddress=new _(i),J.checkout.billingAddress.countrySettings=J.countrySettings)}J.checkout.billingAddress&&(J.checkout.billingAddress.checkoutSettings=J.checkoutSettings,J.checkout.billingAddress.shippingZones=J.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){J.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){if(J.cardData&&(!(e.length>J.cardData.cardNumber.length)||q(e))){var t=(J.cardData.cardNumber||"").split(" ").join(""),i=e.split(" ").join("");i.length>16||(t.length<6&&i.length>=6&&!J.installmentInfo?J.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:J.checkout.selectedPaymentGateway.id,price:J.checkout.totalFinalPrice}}):i.length<6&&t.length>i.length&&(J.cardData.installmentCount=1,J.installmentInfo=void 0),J.cardData.cardNumber=H(i,4).join(" "))}},this.onCardHolderNameChange=function(e){J.cardData&&(J.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(J.cardData&&(!(e.length>J.cardData.expirationDate.length)||q(e))){if(0===(null===(t=J.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(J.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(J.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(J.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(J.cardData.expirationDate=H(d,2).join(" / "))}},this.onCvcChange=function(e){J.cardData&&(e.length>J.cardData.cvv.length&&!q(e)||e.length>4||(J.cardData.cvv=e))},this.saveAddress=function(s){return e(J,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 k(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(){J.router.push("/cart")},this.onBackToShoppingClick=function(){J.router.push("/")},this.onGoToLoginClick=function(){J.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:t.sent(),t.label=3;case 3:return[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),"address"===this.deliveryMethod?this.changeStep(F.SHIPPING):this.changeStep(F.PAYMENT),[3,7];case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:K.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(J,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.changeStep(F.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:K.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(J,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(F.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:K.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!J.canPerformPayment||(J.isErrorsVisible=!0,!1)},this.onCompletePaymentClick=function(){return e(J,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 t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6: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 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:K.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(J,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.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):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:K.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(J,void 0,void 0,(function(){var e,i,s,n,r,o,d,u,l,p,m,f,g,v,y;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(u=this.mpVM.selectedCard)||void 0===u?void 0:u.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(l=this.cardData)||void 0===l?void 0:l.installmentCount)?[2]:[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.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===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:U("_fbp"),_fbc:U("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===a.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===c.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[h.SUCCESS,h.AUTHORIZED].includes(r),d=r===h.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return t.sent(),[3,8];case 7:if(!d||!(null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.returnSlug))throw{data:s.firstErrorMessage,type:K.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return e(J,void 0,void 0,(function(){var e,i;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===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.changeStep(F.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){J.changeStep(F.INFO)},this.onBackToShippingClick=function(){J.changeStep(F.SHIPPING)},this.setCustomerConsentGranted=function(e){J.checkout.customer&&(J.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){J.useDifferentAddress=e,J.useDifferentAddress?(localStorage.setItem("sAddr","1"),J.checkout.billingAddress=J.checkout.billingAddress||new _,J.checkout.billingAddress.countrySettings=J.countrySettings):(localStorage.removeItem("sAddr"),J.checkout.billingAddress=J.checkout.shippingAddress)},this.setShouldSaveAddress=function(e){J.shouldSaveAddress=e},this.setAddressTitle=function(e){J.addressTitle=e},this.reInitPaymentMethod=function(){return e(J,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,6];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenClientToken(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[2]}}))}))},this.createStripePaymentIntent=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.stripeResponse=e.data),[2]}}))}))},this.createKlarnaClientToken=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.klarnaResponse=e.data),[2]}}))}))},this.createAdyenClientToken=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createAdyenClientToken({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(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(J,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?"STRIPE"!==(e=this.paymentGateways[i]).code||!(null===(s=e.settings)||void 0===s?void 0:s.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))||this.stripeResponse?[3,2]:[4,this.createStripePaymentIntent(e)]:[2];case 1:t.sent(),t.label=2;case 2:return"KLARNA"!==e.code||this.klarnaResponse?[3,4]:[4,this.createKlarnaClientToken(e)];case 3:t.sent(),t.label=4;case 4:return"ADYEN"!==e.code||this.adyenResponse?[3,6]:[4,this.createAdyenClientToken(e)];case 5:t.sent(),t.label=6;case 6:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,8]:[4,this.getPayPalClientId(e)];case 7:t.sent(),t.label=8;case 8:return this.checkout.selectedPaymentGateway=e,this.step!==F.SUCCESS&&(e.paymentMethodType===a.CREDIT_CARD&&e.type===c.INTERNAL&&(this.cardData=new A,e.masterPassClientId&&(console.log("called 1511 ikas log"),this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store}))),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(e){J.cardData&&(J.cardData.installmentCount=e)},this.changeStep=function(i){return e(J,void 0,void 0,(function(){return t(this,(function(e){return Z||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(J,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){J.isContactModalVisible=e},this.getCampaignOfferProducts=function(i){return e(J,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(o){switch(o.label){case 0:if(!this.checkout.campaignOffers||!this.checkout.campaignOffers.length)return[3,4];if(e=this.checkout.campaignOffers.filter((function(e){var t;return e.status===p.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===i})))})),!e.length)return[3,4];s=function(i){var s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return(s=e[i]).campaignOffer&&(n=s.campaignOffer.offers.find((function(e){return e.id===s.campaignOfferProductId})))?[4,D.searchProducts({input:{productIdList:[n.productId]}})]:[3,2];case 1:if((r=t.sent()).isSuccess&&r.data&&r.data.data&&r.data.data.length&&(o=r.data.data[0],a=[],n.excludedVariantIdList&&n.excludedVariantIdList.length?o.variants.map((function(e){var t;e.hasStock&&!(null===(t=n.excludedVariantIdList)||void 0===t?void 0:t.some((function(t){return t===e.id})))&&a.push(e)})):a.push.apply(a,o.variants.filter((function(e){return e.hasStock}))),a.length))return[2,{value:{product:new P(o),variants:a,campaignOffer:s,offer:n}}];t.label=2;case 2:return[2]}}))},n=0,o.label=1;case 1:return n<e.length?[5,s(n)]:[3,4];case 2:if("object"==typeof(r=o.sent()))return[2,r.value];o.label=3;case 3:return n++,[3,1];case 4:return[2,void 0]}}))}))},this.getCampaignOffer=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOfferProducts(m.CHECKOUT)];case 1:return e.checkoutCampaignOffer=t.sent(),i=this,[4,this.getCampaignOfferProducts(m.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isCheckoutLoaded=!1,[4,E.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent())&&e.isSuccess&&e.data&&(this.checkout=new v(e.data,this.countrySettings),i.accepted&&this.step===F.SUCCESS?this.changeStep(F.INFO):this.changeStep(this.step)),[2]}}))}))},this.registerCustomer=function(i){return e(J,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,w.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(J,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!==f.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,N.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(J,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,N.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=u,this.checkoutSettings=S,this.router=b,this.returnPolicy=B,this.privacyPolicy=Y,this.termsOfService=W,this.imprint=Q,this.shippingPolicy=z,this.t=X,this.customizationProps=$,this.mpVM=new O,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new I({currentLocale:T.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(B.prototype,"merchantSettings",{get:function(){return new b(T.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.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(B.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=x.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(B.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(B.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"finalPrice",{get:function(){return this.step===F.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===K.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly?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.hasValidCustomerEmail&&(null===(i=this.error)||void 0===i?void 0:i.type)!==K.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(B.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)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!(!this.isInStoreDelivery&&!this.isDigitalOnly)||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(B.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCustomFlowStripe",{get:function(){var e,t=this.checkout.selectedPaymentGateway;return t&&"STRIPE"===t.code&&(null===(e=t.settings)||void 0===e?void 0:e.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"store",{get:function(){return x.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===o.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===o.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===o.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(B.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)===a.CREDIT_CARD&&i.type===c.INTERNAL?!!this.isCustomFlowStripe||(!(!this.isKlarna&&!this.isPayPal)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===d.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"customerAddresses",{get:function(){var e,t,s=this;return null===(t=null===(e=this.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){var t=new S(i({countrySettings:s.countrySettings},e));return t.checkoutSettings=s.checkoutSettings,t.shippingZones=s.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===u.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isEPayKolayEnabled",{get:function(){var e=T.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isPoweredByHidden",{get:function(){var e=T.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),B.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},B}();function H(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function q(e){return e&&B.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(F||(F={})),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"}(K||(K={}));export{F as CheckoutStep,K as ErrorType,Y 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{IkasCouponCodeRequirement as o,IkasPaymentMethodType as a,IkasPaymentGatewayType as c,IkasOrderShippingMethod as d,IkasCartCreatedBy as u,IkasOrderPaymentStatus as l,IkasTransactionStatus as h,IkasCartCampaignOfferStatus as p,IkasCampaignOfferTargetPageType as m,IkasOrderLineItemStatus as f,IkasCustomerEmailSubscriptionStatus as g}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 v}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as y}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 k}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as S}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/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 b}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 C}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/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/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as P}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/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 I}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 A from"./components/credit-card-form/model.js";import w from"../../store/customer/api.js";import N from"../../store/checkout/index.js";import E from"../../store/cart/api.js";import O,{MFS_ELEMENT_ID as j,MFS_SCRIPT_URL as R}from"./modelMasterPass.js";import D from"../../store/product/index.js";import{IkasBaseStore as x}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as T}from"@ikas/storefront-config";import{Analytics as G}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as L,CheckStocksLineInput as M}from"@ikas/storefront-api";import _ from"../../models/data/order/address/ikas-localized-order-address.js";import V from"../../store/location/index.js";import{getCookieValue as U}from"../../utils/helper.js";var F,K,B=/^\d+$/,Z="undefined"==typeof localStorage,Y=function(){function B(u,S,b,B,Y,W,Q,z,X,$){var J=this;this.storefront=null,this.isCheckoutLoaded=!1,this.isErrorsVisible=!1,this.isStepLoading=!1,this.isTermsAndConditionsChecked=!1,this.isChangingShippingMethod=!1,this.isContactModalVisible=!1,this.isEPayKolayPayment=!1,this.step=F.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.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(J,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,x.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 3:return e.sent(),[4,this.initStep()];case 4:return e.sent(),[2]}}))}))},this.initStep=function(){return e(J,void 0,void 0,(function(){var e,s,n,r,a,c,d;return t(this,(function(t){switch(t.label){case 0:if(T.getIsEditor())return this.step=F.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===F.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(F.INFO)];if(this.step!==F.PAYMENT||this.canProceedToPayment){if(this.step===F.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(F.INFO)];if(![F.INFO,F.SUCCESS,F.SHIPPING,F.PAYMENT].includes(this.step))return[2,this.changeStep(F.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(F.INFO)]:[2,this.changeStep(F.SHIPPING)];this.deliveryMethod="in-store"}}return n&&(this.error={type:K.PAYMENT_ERROR,data:r||null}),this.step!==F.SHIPPING&&this.step!==F.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new y(i(i({},this.checkoutSettings),{couponCodeRequirement:o.DEFAULT}))),this.step!==F.INFO?[3,6]:this.isDigitalOnly?[3,3]:[4,this.getAvailableShippingZones()];case 1:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 2:t.sent(),this.checkShippingCountries(),t.label=3;case 3:return[4,this.getStockLocations()];case 4:return t.sent(),[4,this.getAvailableStockLocations()];case 5:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=6;case 6:return this.step!==F.SHIPPING||1!==(null===(c=this.checkout.availableShippingMethods)||void 0===c?void 0:c.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=F.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==F.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==F.SUCCESS||this.checkout.orderPaymentStatus!==l.PAID?[3,8]:[4,this.listProductFile()]:(this.error={type:K.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 7:t.sent(),t.label=8;case 8:return this.step!==F.PAYMENT&&this.step!==F.SUCCESS?[3,12]:[4,this.listPaymentGateways()];case 9:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,11];case 10:t.sent(),t.label=11;case 11:if(!this.paymentGateways.length)return this.error={type:K.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=12;case 12:return this.step===F.SUCCESS?[3,16]:this.checkout.isComplete?[2,this.changeStep(F.SUCCESS)]:[3,13];case 13:return[4,this.initialStockCheck()];case 14:t.sent(),t.label=15;case 15:return[3,18];case 16:return[4,this.getSuccessTransaction()];case 17:t.sent(),this.successTransaction&&(a=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===a}))),t.label=18;case 18:return this.isCheckoutLoaded=!0,G.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,w.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return e=t.sent(),this.successTransaction=e.isSuccess&&(null===(i=e.data)||void 0===i?void 0:i.length)?e.data[e.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return e(J,void 0,void 0,(function(){var e,i,s,n;return t(this,(function(t){switch(t.label){case 0:return e=new L(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!==F.INFO&&this.step!==F.SHIPPING||this.isDigitalOnly||(e.billingAddress=null),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===g.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,E.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===(n=s.extensions)||void 0===n?void 0:n.code)?{type:K.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:K.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(J,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(J,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,u,l,h,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===d.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(l=T.getStockLocationIds())||void 0===l?void 0:l.length)?T.getStockLocationIds():null,[4,N.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:K.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(h=i.data)||void 0===h?void 0:h.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++)u=c[a],r(u);throw{type:K.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(J,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(J,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,x.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(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getAvailableShippingCountries({salesChannelId:T.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return T.getPickupStockLocationIds()?[4,N.listStockLocation({id:{in:T.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:K.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return T.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,N.getAvailableStockLocations({lines:e.map((function(e){return new M(e)})),stockLocationIdList:T.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:K.API_ERROR},[2];this.availableStockLocations=i.data||[],t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=J.shippingCountryIds)||void 0===e?void 0:e.length)||(J.error={type:K.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){"address"===e&&(J.checkout.stockLocationId=null,J.checkout.shippingAddress=new _,J.checkout.shippingAddress.countrySettings=J.countrySettings,J.checkout.shippingAddress.checkoutSettings=J.checkoutSettings,J.checkout.shippingAddress.shippingZones=J.shippingZones),J.deliveryMethod=e,J.isErrorsVisible=!1},this.initialStockCheck=function(){return e(J,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:K.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(J,void 0,void 0,(function(){var e,i,s,n,o,a,c,d,u,l,h=this;return t(this,(function(t){switch(t.label){case 0:return e="local"===process.env.NEXT_PUBLIC_ENV,i=T.getPaymentGateways().map((function(e){return e.id})),[4,N.listPaymentGateway({id:e?void 0:{in:i},locale:T.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=t.sent()).isSuccess&&(null===(u=s.data)||void 0===u?void 0:u.length)?(n=s.data,this.step===F.PAYMENT&&(n=n.filter((function(e){var t;return!(null===(t=e.supportedCurrencies)||void 0===t?void 0:t.length)||e.supportedCurrencies.includes(h.checkout.currencyCode)})),(o=null===(l=this.checkout.shippingAddress)||void 0===l?void 0:l.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=[],r(T.getPaymentGateways(),"order").forEach((function(e){var t=null==n?void 0:n.find((function(t){return t.id===e.id}));t&&a.push(t)})),this.paymentGateways=e?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===F.PAYMENT&&(c=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=j,d.src=R,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:x.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:K.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return e(J,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,N.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;J.store.customerStore.customer?(null===(e=J.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=J.checkoutSettings,e.shippingZones=J.shippingZones})),J.checkout.customer=new C(J.store.customerStore.customer)):J.checkout.customer=new C(J.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){J.checkout.shippingAddress&&(J.checkout.shippingAddress.checkoutSettings=J.checkoutSettings,J.checkout.shippingAddress.shippingZones=J.shippingZones,J.checkout.shippingAddress.countrySettings=J.countrySettings,J.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){J.checkout.billingAddress&&(J.checkout.billingAddress.checkoutSettings=J.checkoutSettings,J.checkout.billingAddress.shippingZones=J.shippingZones,J.checkout.billingAddress.countrySettings=J.countrySettings,J.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!J.isDigitalOnly)if(J.isInStoreDelivery)J.setCheckoutShippingAddressSettings();else if(J.checkout.shippingAddress){if(J.store.customerStore.customer){var e=null==(t=J.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=J.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return J.onSelectedShippingAddressIdChange(e.id||"-1"),void J.setCheckoutShippingAddressSettings()}J.checkout.shippingAddress=new _(n(J.checkout.shippingAddress)||{}),J.setCheckoutShippingAddressSettings()}else if(J.store.customerStore.customer){var t=J.customerAddresses;J.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else J.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(J.useDifferentAddress=!!localStorage.getItem("sAddr"),J.checkout.billingAddress){if(J.store.customerStore.customer){var e=null==(t=J.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=J.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return J.onSelectedBillingAddressIdChange(e.id||"-1"),void J.setCheckoutBillingAddressSettings()}J.checkout.billingAddress=new _(n(J.checkout.billingAddress)||{}),J.setCheckoutBillingAddressSettings()}else if(J.store.customerStore.customer){var t=J.customerAddresses;J.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||J.useDifferentAddress||!J.checkout.shippingAddress||J.isInStoreDelivery||(J.checkout.billingAddress=new _(n(J.checkout.shippingAddress)),J.setCheckoutBillingAddressSettings())}else J.onSelectedBillingAddressIdChange("-1"),J.useDifferentAddress||!J.checkout.shippingAddress||J.isInStoreDelivery||(J.checkout.billingAddress=new _(n(J.checkout.shippingAddress)),J.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(J,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 v(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(J,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(J,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,5,,6]),[4,E.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===F.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,4];case 2:t.sent(),t.label=3;case 3:s&&(r=this.checkout,this.checkout=new v(i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),t.label=4;case 4:return e.isSuccess||(this.couponError=e.errorCodes[0]),[3,6];case 5:return t.sent(),[3,6];case 6:return[2]}}))}))},this.getAvailableShippingZones=function(){return e(J,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,V.getAvailableShippingZones({salesChannelId:T.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(J.selectedShippingAddressId=e,"-1"===e)J.checkout.shippingAddress=new _,J.checkout.shippingAddress.countrySettings=J.countrySettings;else{var i=null===(t=J.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(J.checkout.shippingAddress=new _(i),J.checkout.shippingAddress.countrySettings=J.countrySettings)}J.checkout.shippingAddress&&(J.checkout.shippingAddress.checkoutSettings=J.checkoutSettings,J.checkout.shippingAddress.shippingZones=J.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(J.selectedBillingAddressId=e,"-1"===e)J.checkout.billingAddress=new _,J.checkout.billingAddress.countrySettings=J.countrySettings;else{var i=null===(t=J.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(J.checkout.billingAddress=new _(i),J.checkout.billingAddress.countrySettings=J.countrySettings)}J.checkout.billingAddress&&(J.checkout.billingAddress.checkoutSettings=J.checkoutSettings,J.checkout.billingAddress.shippingZones=J.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){J.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){if(J.cardData&&(!(e.length>J.cardData.cardNumber.length)||q(e))){var t=(J.cardData.cardNumber||"").split(" ").join(""),i=e.split(" ").join("");i.length>16||(t.length<6&&i.length>=6&&!J.installmentInfo?J.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:J.checkout.selectedPaymentGateway.id,price:J.checkout.totalFinalPrice,currencyCode:J.checkout.currencyCode}}):i.length<6&&t.length>i.length&&(J.cardData.installmentCount=1,J.installmentInfo=void 0),J.cardData.cardNumber=H(i,4).join(" "))}},this.onCardHolderNameChange=function(e){J.cardData&&(J.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(J.cardData&&(!(e.length>J.cardData.expirationDate.length)||q(e))){if(0===(null===(t=J.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(J.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(J.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(J.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(J.cardData.expirationDate=H(d,2).join(" / "))}},this.onCvcChange=function(e){J.cardData&&(e.length>J.cardData.cvv.length&&!q(e)||e.length>4||(J.cardData.cvv=e))},this.saveAddress=function(s){return e(J,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 k(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(){J.router.push("/cart")},this.onBackToShoppingClick=function(){J.router.push("/")},this.onGoToLoginClick=function(){J.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,t.label=1;case 1:return t.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:t.sent(),t.label=3;case 3:return[4,this.checkStocks()];case 4:return t.sent(),[4,this.saveCart()];case 5:return t.sent(),"address"===this.deliveryMethod?this.changeStep(F.SHIPPING):this.changeStep(F.PAYMENT),[3,7];case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:K.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(J,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.changeStep(F.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:K.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(J,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(F.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:K.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!J.canPerformPayment||(J.isErrorsVisible=!0,!1)},this.onCompletePaymentClick=function(){return e(J,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 t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6: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 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:K.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(J,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.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):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:K.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(J,void 0,void 0,(function(){var e,i,s,n,r,o,d,u,l,p,m,f,g,v,y;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(u=this.mpVM.selectedCard)||void 0===u?void 0:u.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(l=this.cardData)||void 0===l?void 0:l.installmentCount)?[2]:[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.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===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:U("_fbp"),_fbc:U("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===a.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===c.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[h.SUCCESS,h.AUTHORIZED].includes(r),d=r===h.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return t.sent(),[3,8];case 7:if(!d||!(null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.returnSlug))throw{data:s.firstErrorMessage,type:K.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return e(J,void 0,void 0,(function(){var e,i;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===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.changeStep(F.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){J.changeStep(F.INFO)},this.onBackToShippingClick=function(){J.changeStep(F.SHIPPING)},this.setCustomerConsentGranted=function(e){J.checkout.customer&&(J.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){J.useDifferentAddress=e,J.useDifferentAddress?(localStorage.setItem("sAddr","1"),J.checkout.billingAddress=J.checkout.billingAddress||new _,J.checkout.billingAddress.countrySettings=J.countrySettings):(localStorage.removeItem("sAddr"),J.checkout.billingAddress=J.checkout.shippingAddress)},this.setShouldSaveAddress=function(e){J.shouldSaveAddress=e},this.setAddressTitle=function(e){J.addressTitle=e},this.reInitPaymentMethod=function(){return e(J,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,6];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenClientToken(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[2]}}))}))},this.createStripePaymentIntent=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.stripeResponse=e.data),[2]}}))}))},this.createKlarnaClientToken=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.klarnaResponse=e.data),[2]}}))}))},this.createAdyenClientToken=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createAdyenClientToken({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(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(J,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?"STRIPE"!==(e=this.paymentGateways[i]).code||!(null===(s=e.settings)||void 0===s?void 0:s.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))||this.stripeResponse?[3,2]:[4,this.createStripePaymentIntent(e)]:[2];case 1:t.sent(),t.label=2;case 2:return"KLARNA"!==e.code||this.klarnaResponse?[3,4]:[4,this.createKlarnaClientToken(e)];case 3:t.sent(),t.label=4;case 4:return"ADYEN"!==e.code||this.adyenResponse?[3,6]:[4,this.createAdyenClientToken(e)];case 5:t.sent(),t.label=6;case 6:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,8]:[4,this.getPayPalClientId(e)];case 7:t.sent(),t.label=8;case 8:return this.checkout.selectedPaymentGateway=e,this.step!==F.SUCCESS&&(e.paymentMethodType===a.CREDIT_CARD&&e.type===c.INTERNAL&&(this.cardData=new A,e.masterPassClientId&&(console.log("called 1511 ikas log"),this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store}))),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(e){J.cardData&&(J.cardData.installmentCount=e)},this.changeStep=function(i){return e(J,void 0,void 0,(function(){return t(this,(function(e){return Z||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(J,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){J.isContactModalVisible=e},this.getCampaignOfferProducts=function(i){return e(J,void 0,void 0,(function(){var e,s,n,r;return t(this,(function(o){switch(o.label){case 0:if(!this.checkout.campaignOffers||!this.checkout.campaignOffers.length)return[3,4];if(e=this.checkout.campaignOffers.filter((function(e){var t;return e.status===p.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===i})))})),!e.length)return[3,4];s=function(i){var s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:return(s=e[i]).campaignOffer&&(n=s.campaignOffer.offers.find((function(e){return e.id===s.campaignOfferProductId})))?[4,D.searchProducts({input:{productIdList:[n.productId]}})]:[3,2];case 1:if((r=t.sent()).isSuccess&&r.data&&r.data.data&&r.data.data.length&&(o=r.data.data[0],a=[],n.excludedVariantIdList&&n.excludedVariantIdList.length?o.variants.map((function(e){var t;e.hasStock&&!(null===(t=n.excludedVariantIdList)||void 0===t?void 0:t.some((function(t){return t===e.id})))&&a.push(e)})):a.push.apply(a,o.variants.filter((function(e){return e.hasStock}))),a.length))return[2,{value:{product:new P(o),variants:a,campaignOffer:s,offer:n}}];t.label=2;case 2:return[2]}}))},n=0,o.label=1;case 1:return n<e.length?[5,s(n)]:[3,4];case 2:if("object"==typeof(r=o.sent()))return[2,r.value];o.label=3;case 3:return n++,[3,1];case 4:return[2,void 0]}}))}))},this.getCampaignOffer=function(){return e(J,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOfferProducts(m.CHECKOUT)];case 1:return e.checkoutCampaignOffer=t.sent(),i=this,[4,this.getCampaignOfferProducts(m.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(J,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isCheckoutLoaded=!1,[4,E.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent())&&e.isSuccess&&e.data&&(this.checkout=new v(e.data,this.countrySettings),i.accepted&&this.step===F.SUCCESS?this.changeStep(F.INFO):this.changeStep(this.step)),[2]}}))}))},this.registerCustomer=function(i){return e(J,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,w.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(J,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!==f.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,N.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(J,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,N.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=u,this.checkoutSettings=S,this.router=b,this.returnPolicy=B,this.privacyPolicy=Y,this.termsOfService=W,this.imprint=Q,this.shippingPolicy=z,this.t=X,this.customizationProps=$,this.mpVM=new O,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new I({currentLocale:T.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(B.prototype,"merchantSettings",{get:function(){return new b(T.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.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(B.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=x.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(B.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(B.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"finalPrice",{get:function(){return this.step===F.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===K.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"canProceedToShipping",{get:function(){var e,t,i;return(this.isDigitalOnly?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.hasValidCustomerEmail&&(null===(i=this.error)||void 0===i?void 0:i.type)!==K.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(B.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)},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!(!this.isInStoreDelivery&&!this.isDigitalOnly)||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(B.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.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(B.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCustomFlowStripe",{get:function(){var e,t=this.checkout.selectedPaymentGateway;return t&&"STRIPE"===t.code&&(null===(e=t.settings)||void 0===e?void 0:e.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"store",{get:function(){return x.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===o.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===o.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===o.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(B.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)===a.CREDIT_CARD&&i.type===c.INTERNAL?!!this.isCustomFlowStripe||(!(!this.isKlarna&&!this.isPayPal)||(null===(t=this.cardData)||void 0===t?void 0:t.isValid)):!!i));return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===d.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"customerAddresses",{get:function(){var e,t,s=this;return null===(t=null===(e=this.store.customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){var t=new S(i({countrySettings:s.countrySettings},e));return t.checkoutSettings=s.checkoutSettings,t.shippingZones=s.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===u.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isEPayKolayEnabled",{get:function(){var e=T.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(B.prototype,"isPoweredByHidden",{get:function(){var e=T.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),B.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},B}();function H(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function q(e){return e&&B.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(F||(F={})),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"}(K||(K={}));export{F as CheckoutStep,K as ErrorType,Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";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{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";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"../../../../../models/data/checkout/index.js";import"../../../../../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"../../../../../models/data/customer/address/index.js";import"../../../../../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/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"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/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/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/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/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"@ikas/localized-address";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as d}from"./installments/index.js";import i from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import y from"next/dynamic";import u from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as v}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import g from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import E from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=y((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),C=y((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),h=t((function(t){var y=t.vm,h=c().t,G=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},k=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){var t;return"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))},b=function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(k,null,I(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(G,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(C,{vm:y})))):null},M=function(){var t,a=y.selectedPaymentGatewayIndex===y.adyenPaymentGatewayIndex;return y.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.adyenPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.adyenPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.adyenPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(k,null,I(y.adyenPaymentGateway.additionalPrices[0])):e.createElement(G,null,!!y.adyenPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.adyenPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(w,{vm:y})))):null},T=function(){var t,a=y.selectedPaymentGatewayIndex===y.payPalPaymentGatewayIndex;return y.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.payPalPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(k,null,I(y.payPalPaymentGateway.additionalPrices[0])):e.createElement(G,null,!!y.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,o){var r,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),v=c("9"),f=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},p&&e.createElement(E,null),x&&e.createElement(g,null),v&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===n.INTERNAL?y.installmentInfo&&e.createElement(d,{vm:y}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:f,rightContent:s,bottomContent:P,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new u,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod&&!y.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&y.klarnaPaymentGateway)return b();if(function(e){return"ADYEN"===e.code}(t)&&y.adyenPaymentGateway)return M();if(function(e){return"PAYPAL"===e.code}(t)&&y.payPalPaymentGateway)return T();var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(P,{vm:y,pg:t}):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:y}),y.installmentInfo&&e.createElement(d,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(k,null,I(t.additionalPrices[0])):e.createElement(G,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==o&&(y.setPaymentGateway(o),y.mpVM.selectedCard=void 0)}})})))}));export{h as PaymentGateways};
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";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{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";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"../../../../../models/data/checkout/index.js";import"../../../../../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"../../../../../models/data/customer/address/index.js";import"../../../../../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/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"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/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/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/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/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"@ikas/localized-address";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as d}from"./installments/index.js";import i from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import y from"next/dynamic";import u from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as v}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import g from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import E from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=y((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),C=y((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),h=t((function(t){var y=t.vm,h=c().t,G=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},k=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){var t;return"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))},b=function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(k,null,I(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(G,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(C,{vm:y})))):null},M=function(){var t,a=y.selectedPaymentGatewayIndex===y.adyenPaymentGatewayIndex;return y.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.adyenPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.adyenPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.adyenPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(k,null,I(y.adyenPaymentGateway.additionalPrices[0])):e.createElement(G,null,!!y.adyenPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.adyenPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(w,{vm:y})))):null},T=function(){var t,a=y.selectedPaymentGatewayIndex===y.payPalPaymentGatewayIndex;return y.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.payPalPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(k,null,I(y.payPalPaymentGateway.additionalPrices[0])):e.createElement(G,null,!!y.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,o){var r,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),v=c("9"),f=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},p&&e.createElement(E,null),x&&e.createElement(g,null),v&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===n.INTERNAL?y.installmentInfo&&e.createElement(d,{vm:y}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:f,rightContent:s,bottomContent:P,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new u,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice,currencyCode:y.checkout.currencyCode}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod&&!y.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&y.klarnaPaymentGateway)return b();if(function(e){return"ADYEN"===e.code}(t)&&y.adyenPaymentGateway)return M();if(function(e){return"PAYPAL"===e.code}(t)&&y.payPalPaymentGateway)return T();var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(P,{vm:y,pg:t}):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:y}),y.installmentInfo&&e.createElement(d,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(k,null,I(t.additionalPrices[0])):e.createElement(G,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==o&&(y.setPaymentGateway(o),y.mpVM.selectedCard=void 0)}})})))}));export{h as PaymentGateways};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.3",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"build": "rm -rf build && rollup -c"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@ikas/storefront-api": "^4.11.
|
|
21
|
-
"@ikas/storefront-config": "^4.11.
|
|
22
|
-
"@ikas/storefront-model-functions": "^4.11.
|
|
23
|
-
"@ikas/storefront-models": "^4.11.
|
|
24
|
-
"@ikas/storefront-providers": "^4.11.
|
|
20
|
+
"@ikas/storefront-api": "^4.11.3",
|
|
21
|
+
"@ikas/storefront-config": "^4.11.3",
|
|
22
|
+
"@ikas/storefront-model-functions": "^4.11.3",
|
|
23
|
+
"@ikas/storefront-models": "^4.11.3",
|
|
24
|
+
"@ikas/storefront-providers": "^4.11.3",
|
|
25
25
|
"@ikas/localized-address": "^1.0.0-beta.3",
|
|
26
26
|
"@adyen/adyen-web": "^5.28.2",
|
|
27
27
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@ikas/localized-address": "^1.0.0-beta.3",
|
|
58
|
-
"@ikas/storefront-api": "^4.11.
|
|
59
|
-
"@ikas/storefront-config": "^4.11.
|
|
60
|
-
"@ikas/storefront-model-functions": "^4.11.
|
|
61
|
-
"@ikas/storefront-models": "^4.11.
|
|
62
|
-
"@ikas/storefront-providers": "^4.11.
|
|
58
|
+
"@ikas/storefront-api": "^4.11.3",
|
|
59
|
+
"@ikas/storefront-config": "^4.11.3",
|
|
60
|
+
"@ikas/storefront-model-functions": "^4.11.3",
|
|
61
|
+
"@ikas/storefront-models": "^4.11.3",
|
|
62
|
+
"@ikas/storefront-providers": "^4.11.3",
|
|
63
63
|
"mobx": "^6.1.3",
|
|
64
64
|
"mobx-react-lite": "^3.1.5",
|
|
65
65
|
"next": "12.2.0",
|