@ikas/storefront 4.5.13 → 4.6.1
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.
- package/build/analytics/analytics.js +1 -1
- package/build/analytics/googleAnalytics.js +1 -1
- package/build/analytics/googleTagManager.js +1 -1
- package/build/analytics/googleUniversal.js +1 -1
- package/build/analytics/ikas.js +1 -1
- package/build/components/checkout/components/address-form/index.js +1 -1
- package/build/components/checkout/components/address-form/model.d.ts +13 -2
- package/build/components/checkout/components/address-form/model.js +1 -1
- package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
- package/build/components/checkout/components/customer-addresses/model.js +1 -1
- package/build/components/checkout/components/quick-registration/model.js +1 -1
- package/build/components/checkout/components/select-box/index.d.ts +1 -0
- package/build/components/checkout/components/select-box/index.js +1 -1
- package/build/components/checkout/components/toggle/index.d.ts +1 -0
- package/build/components/checkout/components/toggle/index.js +1 -1
- package/build/components/checkout/components/toggle/style.module.scss.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.d.ts +6 -2
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/index.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/build/components/checkout/steps/step-shipping/index.js +1 -1
- package/build/components/checkout/steps/step-success/index.js +1 -1
- package/build/components/page/head.js +1 -1
- package/build/components/page/index.js +1 -1
- package/build/components/page-editor/ThemeComponentEditor.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/hooks/useCustomerReviews.js +1 -1
- package/build/hooks/useStore.js +1 -1
- package/build/index.js +1 -1
- package/build/models/data/cart/available-shipping-method/estimated-delivery-time/index.d.ts +6 -0
- package/build/models/data/cart/available-shipping-method/estimated-delivery-time/index.js +1 -0
- package/build/models/data/cart/available-shipping-method/index.d.ts +2 -0
- package/build/models/data/cart/available-shipping-method/index.js +1 -1
- package/build/models/data/category/conditions/index.d.ts +21 -0
- package/build/models/data/category/conditions/index.js +1 -0
- package/build/models/data/category/index.d.ts +3 -0
- package/build/models/data/category/index.js +1 -1
- package/build/models/data/customer/address/ikas-localized-customer-address.d.ts +9 -0
- package/build/models/data/customer/address/ikas-localized-customer-address.js +1 -1
- package/build/models/data/customer/address/index.d.ts +5 -0
- package/build/models/data/customer/address/index.js +1 -1
- package/build/models/data/customer/address/region/index.d.ts +6 -0
- package/build/models/data/customer/address/region/index.js +1 -0
- package/build/models/data/customer/review/index.d.ts +1 -0
- package/build/models/data/customer/review/index.js +1 -1
- package/build/models/data/index.d.ts +7 -0
- package/build/models/data/order/address/ikas-localized-order-address.d.ts +9 -0
- package/build/models/data/order/address/ikas-localized-order-address.js +1 -1
- package/build/models/data/order/address/index.d.ts +5 -0
- package/build/models/data/order/address/index.js +1 -1
- package/build/models/data/order/address/region/index.d.ts +6 -0
- package/build/models/data/order/address/region/index.js +1 -0
- package/build/models/data/shipping-zone/index.d.ts +9 -0
- package/build/models/data/shipping-zone/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/district/index.d.ts +7 -0
- package/build/models/data/shipping-zone/state/city/district/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/district/region/index.d.ts +6 -0
- package/build/models/data/shipping-zone/state/city/district/region/index.js +1 -0
- package/build/models/data/shipping-zone/state/city/index.d.ts +8 -0
- package/build/models/data/shipping-zone/state/city/index.js +1 -0
- package/build/models/data/shipping-zone/state/index.d.ts +9 -0
- package/build/models/data/shipping-zone/state/index.js +1 -0
- package/build/models/ui/blog-category-list/index.js +1 -1
- package/build/models/ui/brand-list/index.js +1 -1
- package/build/models/ui/category-list/index.js +1 -1
- package/build/models/ui/customer-review-list/index.js +1 -1
- package/build/models/ui/customer-review-summary-list/index.js +1 -1
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/raffle-list/index.js +1 -1
- package/build/models/ui/validator/form/account-info.js +1 -1
- package/build/models/ui/validator/form/address.js +1 -1
- package/build/models/ui/validator/form/ikas-address.d.ts +15 -0
- package/build/models/ui/validator/form/ikas-address.js +1 -1
- package/build/models/ui/validator/form/register.js +1 -1
- package/build/page-data-init/index.js +1 -1
- package/build/pages/checkout.js +1 -1
- package/build/store/blog/index.js +1 -1
- package/build/store/brand/index.js +1 -1
- package/build/store/category/index.js +1 -1
- package/build/store/checkout/index.js +1 -1
- package/build/store/customer/api.js +1 -1
- package/build/store/customer/index.js +1 -1
- package/build/store/html-meta-data/index.js +1 -1
- package/build/store/location/index.d.ts +2 -1
- package/build/store/location/index.js +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import i from"lodash/cloneDeep";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"@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"../../../../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{IkasCustomerAddress as d}from"../../../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as o}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"../../../../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/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"../../../../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";var r=function(){function r(r,a){var m=this;this.editingCustomerAddress=null,this.isDeleteAddressLoading=!1,this.isEditAddressLoading=!1,this.isEditAddressErrorsVisible=!1,this.onAddressSelect=function(e){("shipping"===m.addressType?m.vm.onSelectedShippingAddressIdChange:m.vm.onSelectedBillingAddressIdChange)((null==e?void 0:e.id)||"-1")},this.onEditAddressClick=function(e){var t=new o(i(e));t.countrySettings=m.vm.countrySettings,t.checkoutSettings=m.vm.checkoutSettings,m.editingCustomerAddress=t},this.onCancelEditAddressClick=function(){m.isDeleteAddressLoading||m.isEditAddressLoading||(m.editingCustomerAddress=null)},this.onDeleteAddressClick=function(){return e(m,void 0,void 0,(function(){var e,s,d,o,r,a=this;return t(this,(function(t){switch(t.label){case 0:if(-1===(e=null===(o=null===(d=this.vm.store.customerStore.customer)||void 0===d?void 0:d.addresses)||void 0===o?void 0:o.findIndex((function(e){var t;return e.id===(null===(t=a.editingCustomerAddress)||void 0===t?void 0:t.id)})))||void 0===e)return[3,5];s=i(this.vm.store.customerStore.customer),null===(r=s.addresses)||void 0===r||r.splice(e,1),t.label=1;case 1:return t.trys.push([1,3,4,5]),this.isDeleteAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(s)];case 2:return t.sent()&&(this.editingCustomerAddress=null),[3,5];case 3:return t.sent(),[3,5];case 4:return this.isDeleteAddressLoading=!1,[7];case 5:return[2]}}))}))},this.onSaveAddressClick=function(){return e(m,void 0,void 0,(function(){var e,s,o,r,a,m,n,l=this;return t(this,(function(t){switch(t.label){case 0:if(this.isDeleteAddressLoading||this.isEditAddressLoading)return[2];if(!(null===(o=this.editingCustomerAddress)||void 0===o?void 0:o.isValidAddress))return this.isEditAddressErrorsVisible=!0,[2];if(-1===(e=null===(a=null===(r=this.vm.store.customerStore.customer)||void 0===r?void 0:r.addresses)||void 0===a?void 0:a.findIndex((function(e){var t;return e.id===(null===(t=l.editingCustomerAddress)||void 0===t?void 0:t.id)})))||void 0===e)return[3,5];(s=i(this.vm.store.customerStore.customer)).addresses[e]=new d(i(this.editingCustomerAddress)),t.label=1;case 1:return t.trys.push([1,3,4,5]),this.isEditAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(s)];case 2:return t.sent()&&(null===(n=null===(m=this.vm.store.customerStore.customer)||void 0===m?void 0:m.addresses)||void 0===n||n.forEach((function(e){return e.checkoutSettings=l.vm.checkoutSettings})),this.onAddressSelect(this.editingCustomerAddress),this.editingCustomerAddress=null,this.isEditAddressErrorsVisible=!1),[3,5];case 3:return t.sent(),[3,5];case 4:return this.isEditAddressLoading=!1,[7];case 5:return[2]}}))}))},this.firstNameChangeCallback=function(e){(!m.vm.checkout.hasCustomer&&"shipping"===m.addressType||m.vm.isDigitalOnly)&&(m.vm.checkout.customer.firstName=e)},this.lastNameChangeCallback=function(e){(!m.vm.checkout.hasCustomer&&"shipping"===m.addressType||m.vm.isDigitalOnly)&&(m.vm.checkout.customer.lastName=e)},this.vm=r,this.addressType=a,s(this)}return Object.defineProperty(r.prototype,"address",{get:function(){return"shipping"===this.addressType?this.vm.checkout.shippingAddress:this.vm.checkout.billingAddress},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedAddressId",{get:function(){return"shipping"===this.addressType?this.vm.selectedShippingAddressId:this.vm.selectedBillingAddressId},enumerable:!1,configurable:!0}),r}();export{r as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import i from"lodash/cloneDeep";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"@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"../../../../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{IkasCustomerAddress as d}from"../../../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as o}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"../../../../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"../../../../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";var r=function(){function r(r,a){var m=this;this.editingCustomerAddress=null,this.isDeleteAddressLoading=!1,this.isEditAddressLoading=!1,this.isEditAddressErrorsVisible=!1,this.onAddressSelect=function(e){("shipping"===m.addressType?m.vm.onSelectedShippingAddressIdChange:m.vm.onSelectedBillingAddressIdChange)((null==e?void 0:e.id)||"-1")},this.onEditAddressClick=function(e){var t=new o(i(e));t.countrySettings=m.vm.countrySettings,t.checkoutSettings=m.vm.checkoutSettings,m.editingCustomerAddress=t},this.onCancelEditAddressClick=function(){m.isDeleteAddressLoading||m.isEditAddressLoading||(m.editingCustomerAddress=null)},this.onDeleteAddressClick=function(){return e(m,void 0,void 0,(function(){var e,s,d,o,r,a=this;return t(this,(function(t){switch(t.label){case 0:if(-1===(e=null===(o=null===(d=this.vm.store.customerStore.customer)||void 0===d?void 0:d.addresses)||void 0===o?void 0:o.findIndex((function(e){var t;return e.id===(null===(t=a.editingCustomerAddress)||void 0===t?void 0:t.id)})))||void 0===e)return[3,5];s=i(this.vm.store.customerStore.customer),null===(r=s.addresses)||void 0===r||r.splice(e,1),t.label=1;case 1:return t.trys.push([1,3,4,5]),this.isDeleteAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(s)];case 2:return t.sent()&&(this.editingCustomerAddress=null),[3,5];case 3:return t.sent(),[3,5];case 4:return this.isDeleteAddressLoading=!1,[7];case 5:return[2]}}))}))},this.onSaveAddressClick=function(){return e(m,void 0,void 0,(function(){var e,s,o,r,a,m,n,l=this;return t(this,(function(t){switch(t.label){case 0:if(this.isDeleteAddressLoading||this.isEditAddressLoading)return[2];if(!(null===(o=this.editingCustomerAddress)||void 0===o?void 0:o.isValidAddress))return this.isEditAddressErrorsVisible=!0,[2];if(-1===(e=null===(a=null===(r=this.vm.store.customerStore.customer)||void 0===r?void 0:r.addresses)||void 0===a?void 0:a.findIndex((function(e){var t;return e.id===(null===(t=l.editingCustomerAddress)||void 0===t?void 0:t.id)})))||void 0===e)return[3,5];(s=i(this.vm.store.customerStore.customer)).addresses[e]=new d(i(this.editingCustomerAddress)),t.label=1;case 1:return t.trys.push([1,3,4,5]),this.isEditAddressLoading=!0,[4,this.vm.store.customerStore.saveCustomer(s)];case 2:return t.sent()&&(null===(n=null===(m=this.vm.store.customerStore.customer)||void 0===m?void 0:m.addresses)||void 0===n||n.forEach((function(e){return e.checkoutSettings=l.vm.checkoutSettings})),this.onAddressSelect(this.editingCustomerAddress),this.editingCustomerAddress=null,this.isEditAddressErrorsVisible=!1),[3,5];case 3:return t.sent(),[3,5];case 4:return this.isEditAddressLoading=!1,[7];case 5:return[2]}}))}))},this.firstNameChangeCallback=function(e){(!m.vm.checkout.hasCustomer&&"shipping"===m.addressType||m.vm.isDigitalOnly)&&(m.vm.checkout.customer.firstName=e)},this.lastNameChangeCallback=function(e){(!m.vm.checkout.hasCustomer&&"shipping"===m.addressType||m.vm.isDigitalOnly)&&(m.vm.checkout.customer.lastName=e)},this.vm=r,this.addressType=a,s(this)}return Object.defineProperty(r.prototype,"address",{get:function(){return"shipping"===this.addressType?this.vm.checkout.shippingAddress:this.vm.checkout.billingAddress},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedAddressId",{get:function(){return"shipping"===this.addressType?this.vm.selectedShippingAddressId:this.vm.selectedBillingAddressId},enumerable:!1,configurable:!0}),r}();export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o,observable as i}from"mobx";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"@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"../../../../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/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/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/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"../../../../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{Validator as
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as o,observable as i}from"mobx";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"@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"../../../../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"../../../../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{Validator as s}from"../../../../models/ui/validator/index.js";import{RequiredRule as r,MinRule as d}from"../../../../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";var a=function(){function a(a,m){var n=this;this.model={password:""},this._isLoading=!1,this._isRegisteredCustomer=!1,this.onPasswordChange=function(e){n.model.password=e},this.validateAll=function(){return n.validator.validateAll()},this.onSubmit=function(){return e(n,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.validateAll()];case 1:return t.sent()?[3,3]:(this._isLoading=!0,[4,this.vm.registerCustomer(this.password)]);case 2:(null==(e=t.sent())?void 0:e.isSuccess)&&(this._isRegisteredCustomer=!0),this._isLoading=!1,t.label=3;case 3:return[2]}}))}))},o(this,{model:i}),this.vm=a,this.t=m,this.validator=new s(this.model,[new r({fieldKey:"password",valuePath:"password",message:m("checkout-page:passwordRequiredError")}),new d({fieldKey:"password",valuePath:"password",minValue:6,message:m("checkout-page:passwordMinError",{value:6})})])}return Object.defineProperty(a.prototype,"password",{get:function(){return this.model.password},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isRegisteredCustomer",{get:function(){return this._isRegisteredCustomer},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"passwordErrorMessage",{get:function(){return this.validator.results.password.errorMessage},enumerable:!1,configurable:!0}),a}();export{a as QuickRegistrationViewModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import o from"./style.module.scss.js";import{Toggle as r}from"../toggle/index.js";var n=t((function(t){var n=t.label,a=t.
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import o from"./style.module.scss.js";import{Toggle as r}from"../toggle/index.js";var n=t((function(t){var n=t.label,a=t.description,l=t.isSelected,i=t.rightContent,m=t.bottomContent,s=t.bottomContentVisible,c=t.hasError,d=t.errorText,u=t.onClick,v=e.useMemo((function(){var e=[o.SelectBox];return l&&e.push(o.Selected),l&&c&&e.push(o.Error),e.join(" ")}),[l]),p=e.useMemo((function(){return e.createElement("div",{className:o.BottomContent},m)}),[m]);return e.createElement("div",{className:o.SelectBoxContainer},e.createElement("div",{className:v,onClick:u},e.createElement("div",{className:o.TopContent},e.createElement(r,{value:l,label:n,description:a,removePadding:!0}),!!i&&e.createElement("div",{className:o.RightContent},i)),!!m&&(l||s)&&p),!!d&&c&&l&&e.createElement("div",{className:o.SelectBoxError},d))}));export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as
|
|
1
|
+
import*as e from"react";import{observer as a}from"mobx-react-lite";import o from"../checkbox/check.js";import r from"./style.module.scss.js";var c=a((function(a){var c=a.value,t=a.label,i=a.description,n=a.hasError,l=a.removePadding,s=a.onChange,m=[r.CheckboxBorder],h=[r.CheckboxLabel],b=[r.CheckboxDescription],d=[r.CheckboxTick];return c&&(m.push(r.Checked),d.push(r.Visible)),n&&h.push(r.CheckboxLabelError),e.createElement("div",{className:[r.CheckboxWrapper,l?r.WithoutPadding:"",t?"":r.WithoutLabel].join(" "),onClick:function(){s&&s(!c)}},e.createElement("div",{className:r.CheckboxContainer},e.createElement("div",{className:m.join(" ")}),e.createElement("div",{className:d.join(" ")},e.createElement(o,null))),e.createElement("div",{className:r.CheckboxLabelContainer},!!t&&e.createElement("div",{className:h.join(" ")},t),!!i&&e.createElement("div",{className:b.join(" ")},i)))}));export{c as Toggle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'./../../../../ext/style-inject/dist/style-inject.es.js';var o={CheckboxWrapper:"style-module_CheckboxWrapper__5RhYr",WithoutPadding:"style-module_WithoutPadding__dZ4VI",WithoutLabel:"style-module_WithoutLabel__YoWH0",CheckboxContainer:"style-module_CheckboxContainer__26lKe",CheckboxBorder:"style-module_CheckboxBorder__7A2SL",Checked:"style-module_Checked__PPUk8",CheckboxTick:"style-module_CheckboxTick__Qp5qA",Visible:"style-module_Visible__M3y9g",CheckboxLabel:"style-module_CheckboxLabel__Oj6l8",CheckboxLabelError:"style-module_CheckboxLabelError__tYedL"};e(".style-module_CheckboxWrapper__5RhYr {\n width: 100%;\n display: flex;\n padding: 0.5em 0;\n cursor: pointer;\n user-select: none;\n align-items: center;\n}\n.style-module_CheckboxWrapper__5RhYr.style-module_WithoutPadding__dZ4VI {\n padding: 0;\n}\n.style-module_CheckboxWrapper__5RhYr.style-module_WithoutLabel__YoWH0 {\n padding: 0;\n width: auto;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxContainer__26lKe {\n position: relative;\n width: 20px;\n height: 20px;\n margin-right: 16px;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxBorder__7A2SL {\n flex: 0 0 auto;\n width: 20px;\n height: 20px;\n border-radius: 100%;\n border: 1px solid var(--checkout-border-color);\n position: absolute;\n top: 0;\n left: 0;\n transition: border-width 0.2s ease-in-out;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxBorder__7A2SL.style-module_Checked__PPUk8 {\n border: 10px solid var(--checkout-button-bg-color);\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxTick__Qp5qA {\n width: 20px;\n height: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 0;\n left: 0;\n color: var(--checkout-button-text-color);\n z-index: 2;\n transition: all 0.2s ease-in-out;\n transition-delay: 0.1s;\n opacity: 0;\n transform: scale(0.2);\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxTick__Qp5qA.style-module_Visible__M3y9g {\n opacity: 1;\n transform: scale(1.2);\n}\n.style-module_CheckboxWrapper__5RhYr .style-
|
|
1
|
+
import e from'./../../../../ext/style-inject/dist/style-inject.es.js';var o={CheckboxWrapper:"style-module_CheckboxWrapper__5RhYr",WithoutPadding:"style-module_WithoutPadding__dZ4VI",WithoutLabel:"style-module_WithoutLabel__YoWH0",CheckboxContainer:"style-module_CheckboxContainer__26lKe",CheckboxBorder:"style-module_CheckboxBorder__7A2SL",Checked:"style-module_Checked__PPUk8",CheckboxTick:"style-module_CheckboxTick__Qp5qA",Visible:"style-module_Visible__M3y9g",CheckboxLabelContainer:"style-module_CheckboxLabelContainer__1g1JQ",CheckboxLabel:"style-module_CheckboxLabel__Oj6l8",CheckboxDescription:"style-module_CheckboxDescription__p7nar",CheckboxLabelError:"style-module_CheckboxLabelError__tYedL"};e(".style-module_CheckboxWrapper__5RhYr {\n width: 100%;\n display: flex;\n padding: 0.5em 0;\n cursor: pointer;\n user-select: none;\n align-items: center;\n}\n.style-module_CheckboxWrapper__5RhYr.style-module_WithoutPadding__dZ4VI {\n padding: 0;\n}\n.style-module_CheckboxWrapper__5RhYr.style-module_WithoutLabel__YoWH0 {\n padding: 0;\n width: auto;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxContainer__26lKe {\n position: relative;\n width: 20px;\n height: 20px;\n margin-right: 16px;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxBorder__7A2SL {\n flex: 0 0 auto;\n width: 20px;\n height: 20px;\n border-radius: 100%;\n border: 1px solid var(--checkout-border-color);\n position: absolute;\n top: 0;\n left: 0;\n transition: border-width 0.2s ease-in-out;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxBorder__7A2SL.style-module_Checked__PPUk8 {\n border: 10px solid var(--checkout-button-bg-color);\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxTick__Qp5qA {\n width: 20px;\n height: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 0;\n left: 0;\n color: var(--checkout-button-text-color);\n z-index: 2;\n transition: all 0.2s ease-in-out;\n transition-delay: 0.1s;\n opacity: 0;\n transform: scale(0.2);\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxTick__Qp5qA.style-module_Visible__M3y9g {\n opacity: 1;\n transform: scale(1.2);\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxLabelContainer__1g1JQ {\n flex: 1 1 auto;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxLabel__Oj6l8 {\n font-weight: normal;\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxDescription__p7nar {\n font-weight: normal;\n font-size: 0.9rem;\n color: var(--checkout-secondary-text-color);\n}\n.style-module_CheckboxWrapper__5RhYr .style-module_CheckboxLabelError__tYedL {\n color: var(--checkout-error-color);\n}");export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import a from"next/link.js";import s from"react-tooltip";import n,{CheckoutStep as c}from"./model.js";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CartSummary as h}from"./components/cart-summary/index.js";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{IkasThemeJsonPageType as g}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/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/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/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"../../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{ContactForm as y}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{StepSuccess as f}from"./steps/step-success/index.js";import{Modal as E}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import x from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as C}from"../image/index.js";import b,{Step as N}from"./components/step-container/index.js";import{StockError as F}from"./components/error/stock-error/index.js";import{FullscreenLoading as M}from"./components/fullscreen-loading/index.js";import P from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as S}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import I from"./components/offer-product/index.js";import O from"./components/svg/ikas.js";import B from"./style.module.scss.js";import{Analytics as L}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import V from"./components/epaykolay-button/index.js";var R=i((function(i){var a,m,p,u=i.checkout,v=i.checkoutSettings,y=i.customizationProps,C=i.returnPolicy,b=i.privacyPolicy,N=i.termsOfService,P=i.imprint,T=i.shippingPolicy,S=d().t,w=r(),R=o.useState((function(){return new n(u,v,w,C,b,N,P,T,S,y||{})}))[0];R.step===c.PAYMENT&&L.disableHTML();var _=function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/get-basket"),[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()},body:JSON.stringify({cartId:R.checkout.id,customerNumber:o,sessionsState:Date.now()})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){R.checkoutSettings.isAccountRequired&&!R.checkout.hasCustomer&&w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),L.beginCheckout(R.checkout),L.pageView(g.CHECKOUT)}),[]),o.useEffect((function(){R.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(y)}),[y]),o.useEffect((function(){if(R.isEPayKolayEnabled)var o=setInterval((function(){var i;window.setContainerService&&R.isCheckoutLoaded&&(window.setContainerService(null===(i=l.getMerchantSettings())||void 0===i?void 0:i.merchantId,_,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,K(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),R.isEPayKolayPayment=!0}),"https://cdn-epeykolay.mncdn.com/epay/"),clearInterval(o))}),100)}),[]);var K=o.useCallback((function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/complete-payment"),{method:"POST",body:JSON.stringify({data:o,cartId:R.checkout.id}),headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()}})];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),[2,"".concat(window.location.pathname,"?id=").concat(R.checkout.id,"&step=").concat(e.success?"success":"info")]}}))}))}),[]);if(!R.isCheckoutLoaded||!R.store.customerStore.initialized)return o.createElement(M,null);if(R.checkout.hasCustomer&&(null===(a=R.store.customerStore.customer)||void 0===a?void 0:a.id)!==(null===(m=R.checkout.customer)||void 0===m?void 0:m.id))return w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(A,{pageType:g.CHECKOUT,pageTitle:((null===(p=R.merchantSettings)||void 0===p?void 0:p.merchantName)||"")+" - "+S("checkout-page:securePayment"),pageDescription:S("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:B.CheckoutPage},o.createElement(s,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:B.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[B.Left,R.isEPayKolayPayment?B.epaykolay:""].join(" ")},R.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!R.isEPayKolayPayment&&o.createElement("div",{className:B.LeftContent},o.createElement("div",null,o.createElement(U,{vm:R}),o.createElement("div",null,R.step!==c.SUCCESS&&R.isEPayKolayEnabled&&o.createElement(V,{onClick:function(){window.frictionless()}})),R.hasStockError&&o.createElement("div",{className:B.ErrorContainer},o.createElement(F,{vm:R,error:R.error})),!R.hasStockError&&o.createElement(o.Fragment,null,o.createElement(h,{vm:R,allowExpand:!0}),R.step===c.SUCCESS?o.createElement(f,{vm:R}):o.createElement(o.Fragment,null,R.checkoutCampaignOffer&&o.createElement(I,{vm:R,campaignOffer:R.checkoutCampaignOffer}),o.createElement(D,{vm:R}))),o.createElement("div",{className:B.Space})),o.createElement(H,{vm:R}))),o.createElement("div",{className:B.Right},o.createElement("div",{className:B.RightContent},o.createElement(h,{vm:R}),o.createElement("div",{className:B.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(O,null))))),!!R.policyModalText&&o.createElement(E,{title:R.policyModalTitle,modalContent:R.policyModalText,onClose:function(){R.policyModalText=""}}),R.isContactModalVisible&&o.createElement(z,{vm:R,setVisible:R.setContactModalVisible}),R.mpVM.isOtpModalVisible&&o.createElement(k,{vm:R,visible:R.mpVM.isOtpModalVisible,type:R.mpVM.otpModalType,onClose:R.mpVM.hideOtpModal}),R.mpVM.isResponseModalVisible&&o.createElement(x,{visible:R.mpVM.isResponseModalVisible,text:R.mpVM.mfsResponseModalText,onClose:R.mpVM.onResponseModalClose}),R.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:R.mpVM.isSuccessModalVisible,type:R.mpVM.successModalType,onClose:R.mpVM.onSuccessModalClose})))})),U=i((function(e){var t,i,r,s=e.vm,n=d().t;return o.createElement("div",{className:B.Header},o.createElement(a,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:B.Logo},o.createElement(C,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:B.LoginText},o.createElement("span",{className:B.LoginCta},n("checkout-page:alreadyHaveAnAccount")),o.createElement(a,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:B.LoginBtn},n("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:B.CustomerInfo},o.createElement("div",{className:B.Name},s.checkout.customerFullName),o.createElement("div",{className:B.Email},null===(r=s.checkout.customer)||void 0===r?void 0:r.email)))})),D=i((function(e){var t=e.vm,i=d().t,r=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(p,{vm:t});case c.SHIPPING:return o.createElement(u,{vm:t});case c.PAYMENT:return o.createElement(v,{vm:t});case c.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),a=[new N(i("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:B.AdressStepInfo},o.createElement(_,{vm:t}),o.createElement("div",{className:B.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(_,{vm:t})):void 0),new N(i("checkout-page:payment"),t.step===c.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||a.splice(1,0,new N(i("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:B.AdressStepInfo},o.createElement(K,{vm:t}),(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:B.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(b,{steps:a,stepContent:r})})),_=i((function(e){var t,i,r,a,s,n,c,l,m,p=e.vm,u=d().t,v=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(i=p.checkout.billingAddress)||void 0===i?void 0:i.lastName)||""):((null===(r=p.checkout.shippingAddress)||void 0===r?void 0:r.firstName)||"")+" "+((null===(a=p.checkout.shippingAddress)||void 0===a?void 0:a.lastName)||"");return o.createElement("div",{className:B.Address},o.createElement("div",{className:[B.Text,B.WithMBottom].join(" ")},(null===(s=p.checkout.customer)||void 0===s?void 0:s.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:B.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:B.Text},u("checkout-page:receiver")),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},v)),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(n=p.checkout.billingAddress)||void 0===n?void 0:n.phone:null===(c=p.checkout.shippingAddress)||void 0===c?void 0:c.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[B.Text,B.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),K=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:B.LightText}," / "+(0===t.checkout.shippingLines[0].price?i("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),H=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Footer},o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:imprint"),t.policyModalText=t.imprint}},i("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),z=i((function(i){var r,a,s,n=i.vm,c=i.setVisible,l=d().t,m=o.useState(!1),p=m[0],u=m[1],v=o.useState(!1),h=v[0],g=v[1],f=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];f.email=(null===(r=n.checkout.customer)||void 0===r?void 0:r.email)||"",f.firstName=(null===(a=n.checkout.customer)||void 0===a?void 0:a.firstName)||"",f.lastName=(null===(s=n.checkout.customer)||void 0===s?void 0:s.lastName)||"";var k=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,c(!1)]:(u(!0),[4,f.saveContactForm()]);case 1:return e.sent()&&g(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(E,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(P,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(T,{type:S.TEXT_AREA,label:"",value:f.message||"",onChange:f.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:l(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!f.message,onClick:k})),onClose:function(){return c(!1)}})}));export{R as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as i}from"mobx-react-lite";import{useRouter as r}from"next/router.js";import a from"next/link.js";import s from"react-tooltip";import n,{CheckoutStep as c}from"./model.js";import{IkasStorefrontConfig as l}from"@ikas/storefront-config";import{formatCurrency as m}from"../../utils/currency.js";import{useTranslation as d}from"../../utils/i18n.js";import p from"./steps/step-info/index.js";import{CheckoutStepShipping as u}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CartSummary as h}from"./components/cart-summary/index.js";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{IkasThemeJsonPageType as g}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"../../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{ContactForm as y}from"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{StepSuccess as f}from"./steps/step-success/index.js";import{Modal as E}from"./components/modal/index.js";import k from"./components/master-pass/modal-otp/index.js";import x from"./components/master-pass/modal-response/index.js";import j from"./components/master-pass/modal-success/index.js";import{Image as C}from"../image/index.js";import b,{Step as N}from"./components/step-container/index.js";import{StockError as F}from"./components/error/stock-error/index.js";import{FullscreenLoading as M}from"./components/fullscreen-loading/index.js";import P from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as S}from"./components/form-item/model.js";import{Button as w}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import I from"./components/offer-product/index.js";import O from"./components/svg/ikas.js";import B from"./style.module.scss.js";import{Analytics as L}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import V from"./components/epaykolay-button/index.js";var R=i((function(i){var a,m,p,u=i.checkout,v=i.checkoutSettings,y=i.customizationProps,C=i.returnPolicy,b=i.privacyPolicy,N=i.termsOfService,P=i.imprint,T=i.shippingPolicy,S=d().t,w=r(),R=o.useState((function(){return new n(u,v,w,C,b,N,P,T,S,y||{})}))[0];R.step===c.PAYMENT&&L.disableHTML();var _=function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/get-basket"),[4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()},body:JSON.stringify({cartId:R.checkout.id,customerNumber:o,sessionsState:Date.now()})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){R.checkoutSettings.isAccountRequired&&!R.checkout.hasCustomer&&w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),L.beginCheckout(R.checkout),L.pageView(g.CHECKOUT)}),[]),o.useEffect((function(){R.customizationProps=y,function(e){document.documentElement.style.setProperty("--checkout-button-bg-color",(null==e?void 0:e.buttonBgColor)||"#272727"),document.documentElement.style.setProperty("--checkout-button-text-color",(null==e?void 0:e.buttonTextColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-button-disabled-bg-color",(null==e?void 0:e.buttonDisabledBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-button-disabled-text-color",(null==e?void 0:e.buttonDisabledTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-text-color",(null==e?void 0:e.primaryTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-text-color",(null==e?void 0:e.secondaryTextColor)||"#8A8B94"),document.documentElement.style.setProperty("--checkout-primary-bg-color",(null==e?void 0:e.primaryBgColor)||"#FFFFFF"),document.documentElement.style.setProperty("--checkout-secondary-bg-color",(null==e?void 0:e.secondaryBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-border-color",(null==e?void 0:e.borderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-card-bg-color",(null==e?void 0:e.cardBgColor)||"#F7F7F9"),document.documentElement.style.setProperty("--checkout-error-color",(null==e?void 0:e.errorColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-error-light-color",(null==e?void 0:e.errorLightColor)||"#FCF3F4"),document.documentElement.style.setProperty("--checkout-warning-color",(null==e?void 0:e.warningColor)||"#FFBC1F"),document.documentElement.style.setProperty("--checkout-warning-light-color",(null==e?void 0:e.warningLightColor)||"#FFFAEE"),document.documentElement.style.setProperty("--checkout-success-color",(null==e?void 0:e.successColor)||"#2DCA73"),document.documentElement.style.setProperty("--checkout-success-light-color",(null==e?void 0:e.successLightColor)||"#F6FFED")}(y)}),[y]),o.useEffect((function(){if(R.isEPayKolayEnabled)var o=setInterval((function(){var i;window.setContainerService&&R.isCheckoutLoaded&&(window.setContainerService(null===(i=l.getMerchantSettings())||void 0===i?void 0:i.merchantId,_,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,K(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),R.isEPayKolayPayment=!0}),"https://cdn-epeykolay.mncdn.com/epay/"),clearInterval(o))}),100)}),[]);var K=o.useCallback((function(o){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,fetch("".concat(process.env.NEXT_PUBLIC_BASE_URL,"/os/e-pay-kolay/complete-payment"),{method:"POST",body:JSON.stringify({data:o,cartId:R.checkout.id}),headers:{"Content-Type":"application/json","x-api-key":l.getApiKey()}})];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),[2,"".concat(window.location.pathname,"?id=").concat(R.checkout.id,"&step=").concat(e.success?"success":"info")]}}))}))}),[]);if(!R.isCheckoutLoaded||!R.store.customerStore.initialized)return o.createElement(M,null);if(R.checkout.hasCustomer&&(null===(a=R.store.customerStore.customer)||void 0===a?void 0:a.id)!==(null===(m=R.checkout.customer)||void 0===m?void 0:m.id))return w.push("/account/login?redirect="+encodeURIComponent(R.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(A,{pageType:g.CHECKOUT,pageTitle:((null===(p=R.merchantSettings)||void 0===p?void 0:p.merchantName)||"")+" - "+S("checkout-page:securePayment"),pageDescription:S("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:B.CheckoutPage},o.createElement(s,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:B.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[B.Left,R.isEPayKolayPayment?B.epaykolay:""].join(" ")},R.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!R.isEPayKolayPayment&&o.createElement("div",{className:B.LeftContent},o.createElement("div",null,o.createElement(U,{vm:R}),o.createElement("div",null,R.step!==c.SUCCESS&&R.isEPayKolayEnabled&&o.createElement(V,{onClick:function(){window.frictionless()}})),R.hasStockError&&o.createElement("div",{className:B.ErrorContainer},o.createElement(F,{vm:R,error:R.error})),!R.hasStockError&&o.createElement(o.Fragment,null,o.createElement(h,{vm:R,allowExpand:!0}),R.step===c.SUCCESS?o.createElement(f,{vm:R}):o.createElement(o.Fragment,null,R.checkoutCampaignOffer&&o.createElement(I,{vm:R,campaignOffer:R.checkoutCampaignOffer}),o.createElement(D,{vm:R}))),o.createElement("div",{className:B.Space})),o.createElement(H,{vm:R}))),o.createElement("div",{className:B.Right},o.createElement("div",{className:B.RightContent},o.createElement(h,{vm:R}),o.createElement("div",{className:B.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(O,null))))),!!R.policyModalText&&o.createElement(E,{title:R.policyModalTitle,modalContent:R.policyModalText,onClose:function(){R.policyModalText=""}}),R.isContactModalVisible&&o.createElement(z,{vm:R,setVisible:R.setContactModalVisible}),R.mpVM.isOtpModalVisible&&o.createElement(k,{vm:R,visible:R.mpVM.isOtpModalVisible,type:R.mpVM.otpModalType,onClose:R.mpVM.hideOtpModal}),R.mpVM.isResponseModalVisible&&o.createElement(x,{visible:R.mpVM.isResponseModalVisible,text:R.mpVM.mfsResponseModalText,onClose:R.mpVM.onResponseModalClose}),R.mpVM.isSuccessModalVisible&&o.createElement(j,{visible:R.mpVM.isSuccessModalVisible,type:R.mpVM.successModalType,onClose:R.mpVM.onSuccessModalClose})))})),U=i((function(e){var t,i,r,s=e.vm,n=d().t;return o.createElement("div",{className:B.Header},o.createElement(a,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.merchantSettings)||void 0===t?void 0:t.logo)?o.createElement("div",{className:B.Logo},o.createElement(C,{layout:"fill",image:s.merchantSettings.logo,sizes:"360px"})):(null===(i=s.merchantSettings)||void 0===i?void 0:i.merchantName)||"")),!s.checkout.hasCustomer&&o.createElement("div",{className:B.LoginText},o.createElement("span",{className:B.LoginCta},n("checkout-page:alreadyHaveAnAccount")),o.createElement(a,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:B.LoginBtn},n("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:B.CustomerInfo},o.createElement("div",{className:B.Name},s.checkout.customerFullName),o.createElement("div",{className:B.Email},null===(r=s.checkout.customer)||void 0===r?void 0:r.email)))})),D=i((function(e){var t=e.vm,i=d().t,r=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(p,{vm:t});case c.SHIPPING:return o.createElement(u,{vm:t});case c.PAYMENT:return o.createElement(v,{vm:t});case c.SUCCESS:return o.createElement(f,{vm:t})}}),[t,t.step]),a=[new N(i("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:B.AdressStepInfo},o.createElement(_,{vm:t}),o.createElement("div",{className:B.EditBtn,onClick:t.onBackToInfoClick},i("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(_,{vm:t})):void 0),new N(i("checkout-page:payment"),t.step===c.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||a.splice(1,0,new N(i("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:B.AdressStepInfo},o.createElement(K,{vm:t}),(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:B.EditBtn,onClick:t.onBackToShippingClick},i("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:B.AddressStepInfoMobile},o.createElement(K,{vm:t})):void 0)),o.createElement(b,{steps:a,stepContent:r})})),_=i((function(e){var t,i,r,a,s,n,c,l,m,p=e.vm,u=d().t,v=p.isDigitalOnly?((null===(t=p.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(i=p.checkout.billingAddress)||void 0===i?void 0:i.lastName)||""):((null===(r=p.checkout.shippingAddress)||void 0===r?void 0:r.firstName)||"")+" "+((null===(a=p.checkout.shippingAddress)||void 0===a?void 0:a.lastName)||"");return o.createElement("div",{className:B.Address},o.createElement("div",{className:[B.Text,B.WithMBottom].join(" ")},(null===(s=p.checkout.customer)||void 0===s?void 0:s.email)||""),"address"===p.deliveryMethod?o.createElement("div",{className:B.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:B.Text},u("checkout-page:receiver")),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},v)),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(n=p.checkout.billingAddress)||void 0===n?void 0:n.phone:null===(c=p.checkout.shippingAddress)||void 0===c?void 0:c.phone),"in-store"===p.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[B.Text,B.WithMTop].join(" ")},u("checkout-page:pickUpLocation"))),o.createElement("div",{className:[B.Text,B.Gray].join(" ")},p.isDigitalOnly?null===(l=p.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(m=p.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),K=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Address},t.checkout.shippingLines&&t.checkout.shippingLines.length?o.createElement(o.Fragment,null,o.createElement("span",null,t.checkout.shippingLines[0].title),o.createElement("span",{className:B.LightText}," / "+(0===t.checkout.shippingLines[0].price?i("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):i("checkout-page:standartShipping"))})),H=i((function(e){var t=e.vm,i=d().t;return o.createElement("div",{className:B.Footer},o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},i("checkout-page:returnPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},i("checkout-page:privacyPolicy")),o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},i("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:imprint"),t.policyModalText=t.imprint}},i("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:B.FooterBullet},"•"),o.createElement("div",{className:B.FooterItem,onClick:function(){t.policyModalTitle=i("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},i("checkout-page:shippingPolicy"))))})),z=i((function(i){var r,a,s,n=i.vm,c=i.setVisible,l=d().t,m=o.useState(!1),p=m[0],u=m[1],v=o.useState(!1),h=v[0],g=v[1],f=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];f.email=(null===(r=n.checkout.customer)||void 0===r?void 0:r.email)||"",f.firstName=(null===(a=n.checkout.customer)||void 0===a?void 0:a.firstName)||"",f.lastName=(null===(s=n.checkout.customer)||void 0===s?void 0:s.lastName)||"";var k=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return h?[2,c(!1)]:(u(!0),[4,f.saveContactForm()]);case 1:return e.sent()&&g(!0),u(!1),[2]}}))}))}),[p]);return o.createElement(E,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,h&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(P,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(T,{type:S.TEXT_AREA,label:"",value:f.message||"",onChange:f.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(w,{style:{width:"100%",marginTop:"24px"},text:l(h?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:p,isDisabled:!f.message,onClick:k})),onClose:function(){return c(!1)}})}));export{R as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextRouter } from "next/router.js";
|
|
2
|
-
import { IkasMerchantSettings, IkasAvailableShippingMethod, IkasOrderLineItem, IkasOrderTransaction, IkasProduct, IkasProductVariant, IkasCartCampaignOffer, IkasCheckout, IkasStockLocation, IkasAvailableStockLocation, IkasCampaignOfferTargetPageType, IkasCampaignOfferProduct, IkasLocalizedCustomerAddress } from "../../models";
|
|
2
|
+
import { IkasMerchantSettings, IkasAvailableShippingMethod, IkasOrderLineItem, IkasOrderTransaction, IkasProduct, IkasProductVariant, IkasCartCampaignOffer, IkasCheckout, IkasStockLocation, IkasAvailableStockLocation, IkasCampaignOfferTargetPageType, IkasCampaignOfferProduct, IkasLocalizedCustomerAddress, IkasShippingZone } from "../../models";
|
|
3
3
|
import { IkasPaymentGateway } from "../../models/data/payment-gateway";
|
|
4
4
|
import { IkasOrderLineVariant } from "../../models/data/order/line-item/variant";
|
|
5
5
|
import { IkasStorefront } from "../../models/data/storefront";
|
|
@@ -53,6 +53,7 @@ export default class CheckoutViewModel {
|
|
|
53
53
|
checkoutCampaignOffer: CampaignOfferType | undefined;
|
|
54
54
|
postCheckoutCampaignOffer: CampaignOfferType | undefined;
|
|
55
55
|
countrySettings: LocalizedAddressModel;
|
|
56
|
+
shippingZones: IkasShippingZone[] | null;
|
|
56
57
|
returnPolicy: string;
|
|
57
58
|
privacyPolicy: string;
|
|
58
59
|
termsOfService: string;
|
|
@@ -86,7 +87,8 @@ export default class CheckoutViewModel {
|
|
|
86
87
|
get hasQuickRegistration(): boolean | null;
|
|
87
88
|
get canProceedToShipping(): boolean | undefined;
|
|
88
89
|
get canProceedToInStoreDelivery(): boolean;
|
|
89
|
-
get canProceedToPayment(): boolean | undefined;
|
|
90
|
+
get canProceedToPayment(): boolean | "" | null | undefined;
|
|
91
|
+
get isValidShippingSettings(): boolean | "" | null | undefined;
|
|
90
92
|
get isInStoreDelivery(): boolean;
|
|
91
93
|
get klarnaPaymentGateway(): IkasPaymentGateway | undefined;
|
|
92
94
|
get klarnaPaymentGatewayIndex(): number;
|
|
@@ -98,6 +100,7 @@ export default class CheckoutViewModel {
|
|
|
98
100
|
get isKlarna(): boolean | null | undefined;
|
|
99
101
|
get isAdyen(): boolean | null | undefined;
|
|
100
102
|
get isPayPal(): boolean | null | undefined;
|
|
103
|
+
get isFree(): boolean;
|
|
101
104
|
get store(): IkasBaseStore;
|
|
102
105
|
get canPerformPayment(): boolean | undefined;
|
|
103
106
|
get isDigitalOnly(): boolean;
|
|
@@ -125,6 +128,7 @@ export default class CheckoutViewModel {
|
|
|
125
128
|
onShippingMethodChange: (shippingMethod: IkasAvailableShippingMethod) => Promise<void>;
|
|
126
129
|
onStockLocationChange: (location: IkasStockLocation) => Promise<void>;
|
|
127
130
|
onCouponCodeApply: () => Promise<void>;
|
|
131
|
+
getAvailableShippingZones: () => Promise<void>;
|
|
128
132
|
onSelectedShippingAddressIdChange: (value: string) => void;
|
|
129
133
|
onSelectedBillingAddressIdChange: (value: string) => void;
|
|
130
134
|
onTermsAndConditionsCheckedChange: (value: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"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{IkasPaymentMethodType as o,IkasPaymentGatewayType as a,IkasOrderShippingMethod as c,IkasCartCreatedBy as d,IkasTransactionStatus as u,IkasCartCampaignOfferStatus as l,IkasCampaignOfferTargetPageType as h}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 p}from"../../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{IkasCustomerAddress as m}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as f}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 g}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as v}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 y}from"../../models/data/product/index.js";import"../../models/data/raffle/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 S}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 k from"./components/credit-card-form/model.js";import b from"../../store/customer/api.js";import C from"../../store/checkout/index.js";import P from"../../store/cart/api.js";import I,{MFS_ELEMENT_ID as A,MFS_SCRIPT_URL as w}from"./modelMasterPass.js";import N from"../../store/product/index.js";import{IkasBaseStore as E}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as O}from"@ikas/storefront-config";import{Analytics as j}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as R,CheckStocksLineInput as x}from"@ikas/storefront-api";import D from"../../models/data/order/address/ikas-localized-order-address.js";var T,G,L=/^\d+$/,M="undefined"==typeof localStorage,_=function(){function L(c,d,f,g,L,_,K,F,Y,B){var H=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=T.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return t(H,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return t.sent(),[4,E.getInstance().customerStore.waitUntilInitialized()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getCampaignOffer()];case 3:return t.sent(),[4,this.initStep()];case 4:return t.sent(),[2]}}))}))},this.initStep=function(){return t(H,void 0,void 0,(function(){var t,i,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:if(O.getIsEditor())return this.step=T.INFO,this.isCheckoutLoaded=!0,[2];if(t=new URLSearchParams(window.location.search),i=t.get("step"),s=t.get("failed"),n=t.get("error"),i){if(this.step=i,this.step===T.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(T.INFO)];if(this.step!==T.PAYMENT||this.canProceedToPayment){if(this.step===T.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(T.INFO)];if(![T.INFO,T.SUCCESS,T.SHIPPING,T.PAYMENT].includes(this.step))return[2,this.changeStep(T.INFO)]}else{if(!this.isInStoreDelivery)return[2,this.changeStep(T.INFO)];this.deliveryMethod="in-store"}}return s&&(this.error={type:G.PAYMENT_ERROR,data:n||null}),this.step!==T.INFO?[3,4]:[4,this.getShippingCountries()];case 1:return e.sent(),this.checkShippingCountries(),[4,this.getStockLocations()];case 2:return e.sent(),[4,this.getAvailableStockLocations()];case 3:e.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),e.label=4;case 4:return this.step!==T.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=T.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==T.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==T.PAYMENT&&this.step!==T.SUCCESS?[3,8]:[4,this.listPaymentGateways()]:(this.error={type:G.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 5:return e.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,7];case 6:e.sent(),e.label=7;case 7:if(!this.paymentGateways.length)return this.error={type:G.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];e.label=8;case 8:return this.step===T.SUCCESS?[3,12]:this.checkout.isComplete?[2,this.changeStep(T.SUCCESS)]:[3,9];case 9:return[4,this.initialStockCheck()];case 10:e.sent(),e.label=11;case 11:return[3,14];case 12:return[4,this.getSuccessTransaction()];case 13:e.sent(),this.successTransaction&&(r=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(t){return t.id===r}))),e.label=14;case 14:return this.isCheckoutLoaded=!0,j.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,b.listOrderTransactions({orderId:{eq:this.checkout.id}})];case 1:return t=e.sent(),this.successTransaction=t.isSuccess&&(null===(i=t.data)||void 0===i?void 0:i.length)?t.data[t.data.length-1]:void 0,[2]}}))}))},this.saveCart=function(){return t(H,void 0,void 0,(function(){var t,i,s,n;return e(this,(function(e){switch(e.label){case 0:return t=new R(this.checkout),"in-store"!==this.deliveryMethod?[3,2]:[4,this.inStockDeliveryInputData(t)];case 1:t=e.sent(),e.label=2;case 2:return this.step!==T.INFO&&this.step!==T.SHIPPING||this.isDigitalOnly||(t.billingAddress=null),this.isDigitalOnly&&(t.shippingAddress=null),[4,P.saveCart({input:t})];case 3:if((null==(i=e.sent())?void 0:i.graphQLErrors)&&i.graphQLErrors.length)throw s=i.graphQLErrors[0],"CUSTOMER_LOGIN_REQUIRED"===(null===(n=s.extensions)||void 0===n?void 0:n.code)?{type:G.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:G.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return t(H,void 0,void 0,(function(){var t,s,n=this;return e(this,(function(e){return t=i,(s=this.stockLocations.find((function(t){return t.id===n.checkout.stockLocationId})))&&t.shippingAddress&&s.address&&(t.shippingAddress.country=s.address.country,t.shippingAddress.city=s.address.city,t.shippingAddress.state=s.address.state,t.shippingAddress.district=s.address.district,t.shippingAddress.postalCode=s.address.postalCode,t.shippingAddress.addressLine1=s.address.address||"",t.shippingAddress.addressLine2=null),[2,t]}))}))},this.checkStocks=function(){return t(H,void 0,void 0,(function(){var t,i,s,n,r,o,a,c,d,u,l,h;return e(this,(function(e){switch(e.label){case 0:return this.isManualOrder?[2]:(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,C.checkStocks({lines:t.map((function(t){return new x(t)})),stockLocationIdList:(null===(u=O.getStockLocationIds())||void 0===u?void 0:u.length)?O.getStockLocationIds():null})]);case 1:if(!(i=e.sent()).isSuccess)throw{type:G.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(h=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.filter((function(t){return!t.isAvailable})))?void 0:s.length){for(n=[],r=function(t){var e=o.checkout.items.find((function(e){return e.variant.id===t.variantId}));e&&n.push({item:e,stockCount:t.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:G.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return t(H,void 0,void 0,(function(){return e(this,(function(t){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return t(H,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:t=0,s=i,e.label=1;case 1:return t<s.length?(n=s[t],[4,E.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,C.getAvailableShippingCountries({salesChannelId:O.getSalesChannelId()})];case 1:return t=e.sent(),this.shippingCountryIds=t.data,[2]}}))}))},this.getStockLocations=function(){return t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return O.getPickupStockLocationIds()?[4,C.listStockLocation({id:{in:O.getPickupStockLocationIds()}})]:[3,2];case 1:if(!(t=e.sent()).isSuccess||!(null===(i=t.data)||void 0===i?void 0:i.length))return this.error={type:G.API_ERROR,data:t.firstErrorMessage},[2];this.stockLocations=t.data,e.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return O.getPickupStockLocationIds()?(t=this.checkout.items.map((function(t){return{quantity:t.quantity,variantId:t.variant.id,productId:t.variant.productId}})),[4,C.getAvailableStockLocations({lines:t.map((function(t){return new x(t)})),stockLocationIdList:O.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=e.sent()).isSuccess)return this.error={type:G.API_ERROR},[2];this.availableStockLocations=i.data||[],e.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var t;(null===(t=H.shippingCountryIds)||void 0===t?void 0:t.length)||(H.error={type:G.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(t){"address"===t&&(H.checkout.stockLocationId=null),H.deliveryMethod=t,H.isErrorsVisible=!1},this.initialStockCheck=function(){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.checkStocks()];case 1:return e.sent(),[3,3];case 2:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:G.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return t(H,void 0,void 0,(function(){var t,i,s,n,o,a,c,d,u,l,h=this;return e(this,(function(e){switch(e.label){case 0:return t="local"===process.env.NEXT_PUBLIC_ENV,i=O.getPaymentGateways().map((function(t){return t.id})),[4,C.listPaymentGateway({id:t?void 0:{in:i},locale:O.getCurrentLocale(),transactionAmount:this.checkout.totalFinalPrice})];case 1:return(s=e.sent()).isSuccess&&(null===(u=s.data)||void 0===u?void 0:u.length)?(n=s.data,this.step===T.PAYMENT&&(n=n.filter((function(t){var e;return!(null===(e=t.supportedCurrencies)||void 0===e?void 0:e.length)||t.supportedCurrencies.includes(h.checkout.currencyCode)})),(o=null===(l=this.checkout.shippingAddress)||void 0===l?void 0:l.country)&&o.iso2&&(n=n.filter((function(t){var e;return!(null===(e=t.availableCountries)||void 0===e?void 0:e.length)||t.availableCountries.includes(o.iso2||"")})))),a=[],r(O.getPaymentGateways(),"order").forEach((function(t){var e=null==n?void 0:n.find((function(e){return e.id===t.id}));e&&a.push(e)})),this.paymentGateways=t?n:a,this.checkout.selectedPaymentGateway||this.setPaymentGateway(0),this.step===T.PAYMENT&&(c=n.find((function(t){return!!t.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=A,d.src=w,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:E.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:G.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return t(H,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return[4,C.retrieveInstallmentInfo(i)];case 1:return t=e.sent(),s=t.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(t,e){return(t.installmentCount||-1)>(e.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var t;H.store.customerStore.customer?(null===(t=H.customerAddresses)||void 0===t||t.forEach((function(t){return t.checkoutSettings=H.checkoutSettings})),H.checkout.customer=new v(H.store.customerStore.customer)):H.checkout.customer=new v(H.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){H.checkout.shippingAddress&&(H.checkout.shippingAddress.checkoutSettings=H.checkoutSettings,H.checkout.shippingAddress.countrySettings=H.countrySettings)},this.setCheckoutBillingAddressSettings=function(){H.checkout.billingAddress&&(H.checkout.billingAddress.checkoutSettings=H.checkoutSettings,H.checkout.billingAddress.countrySettings=H.countrySettings)},this.createShippingAddress=function(){if(!H.isDigitalOnly)if(H.isInStoreDelivery)H.setCheckoutShippingAddressSettings();else if(H.checkout.shippingAddress){if(H.store.customerStore.customer){var t=null==(e=H.customerAddresses)?void 0:e.find((function(t){var e;return t.id===(null===(e=H.checkout.shippingAddress)||void 0===e?void 0:e.id)}));if(t)return H.onSelectedShippingAddressIdChange(t.id||"-1"),void H.setCheckoutShippingAddressSettings()}H.checkout.shippingAddress=new D(n(H.checkout.shippingAddress)||{}),H.setCheckoutShippingAddressSettings()}else if(H.store.customerStore.customer){var e=H.customerAddresses;H.onSelectedShippingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1")}else H.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(H.useDifferentAddress=!!localStorage.getItem("sAddr"),H.checkout.billingAddress){if(H.store.customerStore.customer){var t=null==(e=H.customerAddresses)?void 0:e.find((function(t){var e;return t.id===(null===(e=H.checkout.billingAddress)||void 0===e?void 0:e.id)}));if(t)return H.onSelectedBillingAddressIdChange(t.id||"-1"),void H.setCheckoutBillingAddressSettings()}H.checkout.billingAddress=new D(n(H.checkout.billingAddress)||{}),H.setCheckoutBillingAddressSettings()}else if(H.store.customerStore.customer){var e=H.customerAddresses;H.onSelectedBillingAddressIdChange((null==e?void 0:e.length)?e[0].id:"-1"),(null==e?void 0:e.length)||H.useDifferentAddress||!H.checkout.shippingAddress||H.isInStoreDelivery||(H.checkout.billingAddress=new D(n(H.checkout.shippingAddress)),H.setCheckoutBillingAddressSettings())}else H.onSelectedBillingAddressIdChange("-1"),H.useDifferentAddress||!H.checkout.shippingAddress||H.isInStoreDelivery||(H.checkout.billingAddress=new D(n(H.checkout.shippingAddress)),H.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isChangingShippingMethod?[2]:(this.isChangingShippingMethod=!0,this.checkout.shippingSettingsId=i.shippingSettingsId,this.checkout.shippingZoneRateId=i.shippingZoneRateId,[4,this.saveCart()]);case 1:return(t=e.sent())&&(this.checkout=new p(t,this.countrySettings)),this.checkout.shippingAddress&&(this.checkout.shippingAddress.checkoutSettings=this.checkoutSettings),this.isChangingShippingMethod=!1,[2]}}))}))},this.onStockLocationChange=function(i){return t(H,void 0,void 0,(function(){return e(this,(function(t){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return t(H,void 0,void 0,(function(){var t,s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,P.saveCartCouponCode({cartId:this.checkout.id,couponCode:this.checkout.couponCode||null})];case 1:return(t=e.sent()).isSuccess&&t.data?(s=t.data,n=null===(a=null===(o=this.cardData)||void 0===o?void 0:o.cardNumber)||void 0===a?void 0:a.split(" ").join(""),this.couponError=null,this.step===T.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:e.sent(),e.label=3;case 3:s&&(r=this.checkout,this.checkout=new p(i(i({},s),{shippingAddress:r.shippingAddress,billingAddress:r.billingAddress,customer:r.customer,selectedPaymentGateway:r.selectedPaymentGateway}),this.countrySettings)),e.label=4;case 4:return t.isSuccess||(this.couponError=t.errorCodes[0]),[3,6];case 5:return e.sent(),[3,6];case 6:return[2]}}))}))},this.onSelectedShippingAddressIdChange=function(t){var e;if(H.selectedShippingAddressId=t,"-1"===t)H.checkout.shippingAddress=new D,H.checkout.shippingAddress.countrySettings=H.countrySettings;else{var i=null===(e=H.customerAddresses)||void 0===e?void 0:e.find((function(e){return e.id===t}));i&&(H.checkout.shippingAddress=new D(i),H.checkout.shippingAddress.countrySettings=H.countrySettings)}H.checkout.shippingAddress&&(H.checkout.shippingAddress.checkoutSettings=H.checkoutSettings)},this.onSelectedBillingAddressIdChange=function(t){var e;if(H.selectedBillingAddressId=t,"-1"===t)H.checkout.billingAddress=new D,H.checkout.billingAddress.countrySettings=H.countrySettings;else{var i=null===(e=H.customerAddresses)||void 0===e?void 0:e.find((function(e){return e.id===t}));i&&(H.checkout.billingAddress=new D(i),H.checkout.billingAddress.countrySettings=H.countrySettings)}H.checkout.billingAddress&&(H.checkout.billingAddress.checkoutSettings=H.checkoutSettings)},this.onTermsAndConditionsCheckedChange=function(t){H.isTermsAndConditionsChecked=t},this.onCardNumberChange=function(t){if(H.cardData&&(!(t.length>H.cardData.cardNumber.length)||U(t))){var e=(H.cardData.cardNumber||"").split(" ").join(""),i=t.split(" ").join("");i.length>16||(e.length<6&&i.length>=6&&!H.installmentInfo?H.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:H.checkout.selectedPaymentGateway.id,price:H.checkout.totalFinalPrice}}):i.length<6&&e.length>i.length&&(H.cardData.installmentCount=1,H.installmentInfo=void 0),H.cardData.cardNumber=V(i,4).join(" "))}},this.onCardHolderNameChange=function(t){H.cardData&&(H.cardData.cardHolderName=t)},this.onExpirationDateChange=function(t){var e;if(H.cardData&&(!(t.length>H.cardData.expirationDate.length)||U(t))){if(0===(null===(e=H.cardData.expirationDate)||void 0===e?void 0:e.length)){var i=t.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(H.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(H.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(H.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=t.split(" / ").join("");d.length>4||(H.cardData.expirationDate=V(d,2).join(" / "))}},this.onCvcChange=function(t){H.cardData&&(t.length>H.cardData.cvv.length&&!U(t)||t.length>4||(H.cardData.cvv=t))},this.saveAddress=function(s){return t(H,void 0,void 0,(function(){var t,r,o,a,c,d,u,l,h,p,f,g,v=this;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(t="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(e){return e.id===(null==t?void 0:t.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(t){return t.id})),o=new m(i(i({},t),{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:e.sent(),null===(f=this.customerAddresses)||void 0===f||f.forEach((function(t){return t.checkoutSettings=v.checkoutSettings})),c=null===(g=this.customerAddresses)||void 0===g?void 0:g.map((function(t){return t.id})),d=null==c?void 0:c.filter((function(t){return!(null==r?void 0:r.includes(t))})),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"),e.label=2;case 2:return[3,4];case 3:return l=e.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){H.router.push("/cart")},this.onBackToShoppingClick=function(){H.router.push("/")},this.onGoToLoginClick=function(){H.router.push("/account/login")},this.onProceedToShippingClick=function(){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if("address"===this.deliveryMethod){if(!this.canProceedToShipping)return this.isErrorsVisible=!0,[2]}else if(!this.canProceedToInStoreDelivery)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,6,,7]),this.isStepLoading=!0,"address"!==this.deliveryMethod?[3,3]:[4,this.saveAddress("shipping")];case 2:e.sent(),e.label=3;case 3:return[4,this.checkStocks()];case 4:return e.sent(),[4,this.saveCart()];case 5:return e.sent(),"address"===this.deliveryMethod?this.changeStep(T.SHIPPING):this.changeStep(T.PAYMENT),[3,7];case 6:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:G.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.changeStep(T.PAYMENT),[3,5];case 4:return(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:G.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:if(!this.canProceedToPayment)return this.isErrorsVisible=!0,[2];this.isErrorsVisible=!1,e.label=1;case 1:return e.trys.push([1,4,,5]),this.isStepLoading=!0,[4,this.checkStocks()];case 2:return e.sent(),[4,this.saveCart()];case 3:return e.sent(),this.error=void 0,this.changeStep(T.PAYMENT),[3,5];case 4:return void 0!==typeof(t=e.sent()).type?this.error=t:(console.log(t),this.error={type:G.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!H.canPerformPayment||(H.isErrorsVisible=!0,!1)},this.onCompletePaymentClick=function(){return t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isKlarna?[4,this.saveCart()]:[3,2]):(this.isErrorsVisible=!0,[2]);case 1:return e.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return e.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return e.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:e.sent(),e.label=5;case 5:return[4,this.saveCart()];case 6:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 7:return e.sent(),[3,9];case 8:return void 0!==typeof(i=e.sent()).type?this.error=i:this.error={type:G.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.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 e.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return e.trys.push([2,6,,7]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return e.sent(),[4,this.saveCart()];case 4:return e.sent(),this.isCustomFlowStripe?((t=document.querySelector("#stripe-form-btn"))&&t.click(),[2]):this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):this.isPayPal?[2]:[4,this.createSaleTransaction()];case 5:return e.sent(),[3,7];case 6:return(i=e.sent()).type?this.error=i:this.error={type:G.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return t(H,void 0,void 0,(function(){var t,i,s,n,r,c,d,l,h,p,m,f,g,v,y;return e(this,(function(e){switch(e.label){case 0:return(i=this.mpVM.selectedCard)&&(null===(l=this.mpVM.selectedCard)||void 0===l?void 0:l.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(t=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,C.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:t,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)}}})]):[3,2];case 1:return s=e.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,C.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:i&&t?{phoneNumber:t,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===o.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===a.INTERNAL&&this.cardData?this.cardData.toInput():void 0}})]:[2];case 3:s=e.sent(),e.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,c=r&&[u.SUCCESS,u.AUTHORIZED].includes(r),d=r===u.PENDING,c?[4,this.getSuccessTransaction()]:[3,7];case 5:return e.sent(),[4,this.onCheckoutTransactionSuccess()];case 6:return e.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:G.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,e.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(){return t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return localStorage.removeItem("sAddr"),(null===(t=this.checkout.customer)||void 0===t?void 0:t.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(i=this.checkout.customer)||void 0===i?void 0:i.email)||"")]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.changeStep(T.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){H.changeStep(T.INFO)},this.onBackToShippingClick=function(){H.changeStep(T.SHIPPING)},this.setCustomerConsentGranted=function(t){H.checkout.customer&&(H.checkout.customer.notificationsAccepted=t)},this.setUseDifferentAddress=function(t){H.useDifferentAddress=t,H.useDifferentAddress?(localStorage.setItem("sAddr","1"),H.checkout.billingAddress=H.checkout.billingAddress||new D,H.checkout.billingAddress.countrySettings=H.countrySettings):(localStorage.removeItem("sAddr"),H.checkout.billingAddress=H.checkout.shippingAddress)},this.setShouldSaveAddress=function(t){H.shouldSaveAddress=t},this.setAddressTitle=function(t){H.addressTitle=t},this.setPaymentGateway=function(i){return t(H,void 0,void 0,(function(){var t,s,n;return e(this,(function(e){switch(e.label){case 0:return this.paymentGateways.length?"STRIPE"!==(t=this.paymentGateways[i]).code||!(null===(n=t.settings)||void 0===n?void 0:n.find((function(t){return"allow_custom_flow"===t.label&&"1"===t.value})))||this.stripeResponse?[3,2]:[4,C.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})]:[2];case 1:(s=e.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),e.label=2;case 2:return"KLARNA"!==t.code||this.klarnaResponse?[3,4]:[4,C.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 3:(s=e.sent()).isSuccess&&s.data&&(this.klarnaResponse=s.data),e.label=4;case 4:return"ADYEN"!==t.code||this.adyenResponse?[3,6]:[4,C.createAdyenClientToken({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 5:(s=e.sent()).isSuccess&&s.data&&(this.adyenResponse=s.data),e.label=6;case 6:return"PAYPAL"!==t.code||this.payPalClientIdResponse?[3,8]:[4,C.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:t.id||""}})];case 7:(s=e.sent()).isSuccess&&s.data&&(this.payPalClientIdResponse=s.data),e.label=8;case 8:return this.checkout.selectedPaymentGateway=t,this.step!==T.SUCCESS&&(t.paymentMethodType===o.CREDIT_CARD&&t.type===a.INTERNAL&&(this.cardData=new k,t.masterPassClientId&&(console.log("called 1511 ikas log"),this.mpVM.checkMasterPass({checkout:this.checkout,store:this.store}))),this.installmentInfo=void 0),[2]}}))}))},this.setInstallmentCount=function(t){H.cardData&&(H.cardData.installmentCount=t)},this.changeStep=function(i){return t(H,void 0,void 0,(function(){return e(this,(function(t){return M||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return t(H,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:this.checkout.customer=null,this.store.customerStore.logout(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.saveCart()];case 2:case 3:return t.sent(),[3,4];case 4:return this.createCustomer(),[2]}}))}))},this.setContactModalVisible=function(t){H.isContactModalVisible=t},this.getCampaignOfferProducts=function(i){return t(H,void 0,void 0,(function(){var t,s,n,r;return e(this,(function(o){switch(o.label){case 0:if(!this.checkout.campaignOffers||!this.checkout.campaignOffers.length)return[3,4];if(t=this.checkout.campaignOffers.filter((function(t){var e;return t.status===l.WAITING_FOR_ACTION&&(null===(e=t.campaignOffer)||void 0===e?void 0:e.targetPageTypes.some((function(t){return t===i})))})),!t.length)return[3,4];s=function(i){var s,n,r,o,a;return e(this,(function(e){switch(e.label){case 0:return(s=t[i]).campaignOffer&&(n=s.campaignOffer.offers.find((function(t){return t.id===s.campaignOfferProductId})))?[4,N.searchProducts({input:{productIdList:[n.productId]}})]:[3,2];case 1:if((r=e.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(t){var e;t.hasStock&&!(null===(e=n.excludedVariantIdList)||void 0===e?void 0:e.some((function(e){return e===t.id})))&&a.push(t)})):a.push.apply(a,o.variants.filter((function(t){return t.hasStock}))),a.length))return[2,{value:{product:new y(o),variants:a,campaignOffer:s,offer:n}}];e.label=2;case 2:return[2]}}))},n=0,o.label=1;case 1:return n<t.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 t(H,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return t=this,[4,this.getCampaignOfferProducts(h.CHECKOUT)];case 1:return t.checkoutCampaignOffer=e.sent(),i=this,[4,this.getCampaignOfferProducts(h.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=e.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return t(H,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return this.isCheckoutLoaded=!1,[4,P.updateCartCampaignOffer({input:i})];case 1:return(t=e.sent())&&t.isSuccess&&t.data&&(this.checkout=new p(t.data,this.countrySettings),i.accepted&&this.step===T.SUCCESS?this.changeStep(T.INFO):this.changeStep(this.step)),[2]}}))}))},this.registerCustomer=function(i){return t(H,void 0,void 0,(function(){var t,s,n,r;return e(this,(function(e){switch(e.label){case 0:return this.checkout.customer?(t=this.checkout.customer,s=t.firstName,n=t.lastName,r=t.email,s&&n&&r?[4,b.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,e.sent()];case 2:return[2]}}))}))},this.checkout=c,this.checkoutSettings=d,this.router=f,this.returnPolicy=g,this.privacyPolicy=L,this.termsOfService=_,this.imprint=K,this.shippingPolicy=F,this.t=Y,this.customizationProps=B,this.mpVM=new I,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new S({currentLocale:O.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(L.prototype,"merchantSettings",{get:function(){return new g(O.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"selectedPaymentGatewayIndex",{get:function(){var t=this;return this.paymentGateways.findIndex((function(e){var i;return e.id===(null===(i=t.checkout.selectedPaymentGateway)||void 0===i?void 0:i.id)}))},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"selectedInstallmentIndex",{get:function(){var t,e,i=this;return(null===(e=null===(t=this.installmentInfo)||void 0===t?void 0:t.installmentPrices)||void 0===e?void 0:e.findIndex((function(t){var e;return t.installmentCount===(null===(e=i.cardData)||void 0===e?void 0:e.installmentCount)})))||0},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"customerAddressOptions",{get:function(){var t,e,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(e=null===(t=E.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){return{label:t.title+" - "+t.addressText,value:t.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"installmentPrice",{get:function(){var t,e,i,s=this;if(this.installmentInfo&&(null===(t=this.cardData)||void 0===t?void 0:t.installmentCount))return null===(i=null===(e=this.installmentInfo.installmentPrices)||void 0===e?void 0:e.find((function(t){var e;return t.installmentCount===(null===(e=s.cardData)||void 0===e?void 0:e.installmentCount)})))||void 0===i?void 0:i.totalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"finalPrice",{get:function(){return this.step===T.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"hasStockError",{get:function(){var t;return(null===(t=this.error)||void 0===t?void 0:t.type)===G.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"canProceedToShipping",{get:function(){var t,e,i;return(this.isDigitalOnly?null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValidAddress:null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.isValidAddress)&&this.checkout.hasValidCustomerEmail&&(null===(i=this.error)||void 0===i?void 0:i.type)!==G.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"canProceedToInStoreDelivery",{get:function(){var t,e,i;return!!((null===(t=this.checkout.shippingAddress)||void 0===t?void 0:t.firstName)&&(null===(e=this.checkout.shippingAddress)||void 0===e?void 0:e.lastName)&&(null===(i=this.checkout.customer)||void 0===i?void 0:i.email)&&this.checkout.stockLocationId)},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"klarnaPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"KLARNA"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"adyenPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"ADYEN"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"ADYEN"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"payPalPaymentGateway",{get:function(){var t=this.paymentGateways.findIndex((function(t){return"PAYPAL"===t.code}));if(-1!==t)return this.paymentGateways[t]},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(t){return"PAYPAL"===t.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isCustomFlowStripe",{get:function(){var t,e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code&&(null===(t=e.settings)||void 0===t?void 0:t.find((function(t){return"allow_custom_flow"===t.label&&"1"===t.value})))},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isKlarna",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"KLARNA"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isAdyen",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"ADYEN"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isPayPal",{get:function(){var t=this.checkout.selectedPaymentGateway;return t&&"PAYPAL"===t.code},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"store",{get:function(){return E.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"canPerformPayment",{get:function(){var t,e;if(this.checkoutSettings.showTermsAndConditionsCheckbox&&!this.isTermsAndConditionsChecked)return!1;var i=this.checkout.selectedPaymentGateway,s=!!("in-store"===this.deliveryMethod)||!!this.canProceedToShipping,n=!!(null===(t=this.checkout.billingAddress)||void 0===t?void 0:t.isValidAddress),r=!!this.mpVM.selectedCard||((null==i?void 0:i.paymentMethodType)===o.CREDIT_CARD&&i.type===a.INTERNAL?!!this.isCustomFlowStripe||(!(!this.isKlarna&&!this.isPayPal)||(null===(e=this.cardData)||void 0===e?void 0:e.isValid)):!!i);return s&&n&&r},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===c.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"customerAddresses",{get:function(){var t,e,s=this;return null===(e=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.map((function(t){var e=new f(i({countrySettings:s.countrySettings},t));return e.checkoutSettings=s.checkoutSettings,e}))},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===d.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(L.prototype,"isEPayKolayEnabled",{get:function(){var t=O.getCustom();return!!t&&!!t.isEPayKolayEnabled},enumerable:!1,configurable:!0}),L.prototype.setAdyenDropinElement=function(t){this.adyenDropinElement=t},L}();function V(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))||[]}function U(t){return t&&L.test(t.charAt(t.length-1))}!function(t){t.INFO="info",t.SHIPPING="shipping",t.PAYMENT="payment",t.SUCCESS="success"}(T||(T={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.API_ERROR=1]="API_ERROR",t[t.STOCK_ERROR=2]="STOCK_ERROR",t[t.PAYMENT_ERROR=3]="PAYMENT_ERROR",t[t.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",t[t.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR"}(G||(G={}));export{T as CheckoutStep,G as ErrorType,_ 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{IkasPaymentMethodType as o,IkasPaymentGatewayType as a,IkasOrderShippingMethod as c,IkasCartCreatedBy as d,IkasTransactionStatus as u,IkasCartCampaignOfferStatus as l,IkasCampaignOfferTargetPageType as h}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 p}from"../../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{IkasCustomerAddress as m}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as g}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 f}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 v}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 y}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 S}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 k from"./components/credit-card-form/model.js";import b from"../../store/customer/api.js";import C from"../../store/checkout/index.js";import P from"../../store/cart/api.js";import I,{MFS_ELEMENT_ID as A,MFS_SCRIPT_URL as w}from"./modelMasterPass.js";import N from"../../store/product/index.js";import{IkasBaseStore as j}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as O}from"@ikas/storefront-config";import{Analytics as E}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import{SaveCartInput as R,CheckStocksLineInput as x}from"@ikas/storefront-api";import D from"../../models/data/order/address/ikas-localized-order-address.js";import T from"../../store/location/index.js";var G,L,M=/^\d+$/,V="undefined"==typeof localStorage,_=function(){function M(c,d,g,f,M,_,F,Z,B,Y){var H=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=G.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.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(H,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,j.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(H,void 0,void 0,(function(){var e,i,s,n,r,o,a;return t(this,(function(t){switch(t.label){case 0:if(O.getIsEditor())return this.step=G.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),i=e.get("step"),s=e.get("failed"),n=e.get("error"),i){if(this.step=i,this.step===G.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(G.INFO)];if(this.step!==G.PAYMENT||this.canProceedToPayment){if(this.step===G.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(G.INFO)];if(![G.INFO,G.SUCCESS,G.SHIPPING,G.PAYMENT].includes(this.step))return[2,this.changeStep(G.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(G.INFO)]:[2,this.changeStep(G.SHIPPING)];this.deliveryMethod="in-store"}}return s&&(this.error={type:L.PAYMENT_ERROR,data:n||null}),this.step!==G.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!==G.SHIPPING||1!==(null===(o=this.checkout.availableShippingMethods)||void 0===o?void 0:o.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=G.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==G.SHIPPING||(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)?this.step!==G.PAYMENT&&this.step!==G.SUCCESS?[3,10]:[4,this.listPaymentGateways()]:(this.error={type:L.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 7:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,9];case 8:t.sent(),t.label=9;case 9:if(!this.paymentGateways.length)return this.error={type:L.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=10;case 10:return this.step===G.SUCCESS?[3,14]:this.checkout.isComplete?[2,this.changeStep(G.SUCCESS)]:[3,11];case 11:return[4,this.initialStockCheck()];case 12:t.sent(),t.label=13;case 13:return[3,16];case 14:return[4,this.getSuccessTransaction()];case 15:t.sent(),this.successTransaction&&(r=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===r}))),t.label=16;case 16:return this.isCheckoutLoaded=!0,E.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(H,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,b.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(H,void 0,void 0,(function(){var e,i,s,n;return t(this,(function(t){switch(t.label){case 0:return e=new R(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!==G.INFO&&this.step!==G.SHIPPING||this.isDigitalOnly||(e.billingAddress=null),this.isDigitalOnly&&(e.shippingAddress=null),[4,P.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:L.CUSTOMER_LOGIN_REQUIRED_ERROR}:{type:L.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(H,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(H,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,l,h;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,C.checkStocks({lines:e.map((function(e){return new x(e)})),stockLocationIdList:(null===(u=O.getStockLocationIds())||void 0===u?void 0:u.length)?O.getStockLocationIds():null})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:L.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(h=null===(l=i.data)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:L.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(H,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(H,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,j.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(H,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,C.getAvailableShippingCountries({salesChannelId:O.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(H,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return O.getPickupStockLocationIds()?[4,C.listStockLocation({id:{in:O.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:L.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(H,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return O.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,C.getAvailableStockLocations({lines:e.map((function(e){return new x(e)})),stockLocationIdList:O.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:L.API_ERROR},[2];this.availableStockLocations=i.data||[],t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=H.shippingCountryIds)||void 0===e?void 0:e.length)||(H.error={type:L.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){"address"===e&&(H.checkout.stockLocationId=null),H.deliveryMethod=e,H.isErrorsVisible=!1},this.initialStockCheck=function(){return e(H,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:L.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(H,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=O.getPaymentGateways().map((function(e){return e.id})),[4,C.listPaymentGateway({id:e?void 0:{in:i},locale:O.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===G.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(O.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===G.PAYMENT&&(c=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=A,d.src=w,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:j.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:L.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return e(H,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,C.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;H.store.customerStore.customer?(null===(e=H.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=H.checkoutSettings,e.shippingZones=H.shippingZones})),H.checkout.customer=new v(H.store.customerStore.customer)):H.checkout.customer=new v(H.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){H.checkout.shippingAddress&&(H.checkout.shippingAddress.checkoutSettings=H.checkoutSettings,H.checkout.shippingAddress.shippingZones=H.shippingZones,H.checkout.shippingAddress.countrySettings=H.countrySettings,H.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){H.checkout.billingAddress&&(H.checkout.billingAddress.checkoutSettings=H.checkoutSettings,H.checkout.billingAddress.shippingZones=H.shippingZones,H.checkout.billingAddress.countrySettings=H.countrySettings,H.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!H.isDigitalOnly)if(H.isInStoreDelivery)H.setCheckoutShippingAddressSettings();else if(H.checkout.shippingAddress){if(H.store.customerStore.customer){var e=null==(t=H.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=H.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return H.onSelectedShippingAddressIdChange(e.id||"-1"),void H.setCheckoutShippingAddressSettings()}H.checkout.shippingAddress=new D(n(H.checkout.shippingAddress)||{}),H.setCheckoutShippingAddressSettings()}else if(H.store.customerStore.customer){var t=H.customerAddresses;H.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else H.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(H.useDifferentAddress=!!localStorage.getItem("sAddr"),H.checkout.billingAddress){if(H.store.customerStore.customer){var e=null==(t=H.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=H.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return H.onSelectedBillingAddressIdChange(e.id||"-1"),void H.setCheckoutBillingAddressSettings()}H.checkout.billingAddress=new D(n(H.checkout.billingAddress)||{}),H.setCheckoutBillingAddressSettings()}else if(H.store.customerStore.customer){var t=H.customerAddresses;H.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||H.useDifferentAddress||!H.checkout.shippingAddress||H.isInStoreDelivery||(H.checkout.billingAddress=new D(n(H.checkout.shippingAddress)),H.setCheckoutBillingAddressSettings())}else H.onSelectedBillingAddressIdChange("-1"),H.useDifferentAddress||!H.checkout.shippingAddress||H.isInStoreDelivery||(H.checkout.billingAddress=new D(n(H.checkout.shippingAddress)),H.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(H,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 p(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(H,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(H,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,P.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===G.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 p(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(H,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,T.getAvailableShippingZones({salesChannelId:O.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(H.selectedShippingAddressId=e,"-1"===e)H.checkout.shippingAddress=new D,H.checkout.shippingAddress.countrySettings=H.countrySettings;else{var i=null===(t=H.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(H.checkout.shippingAddress=new D(i),H.checkout.shippingAddress.countrySettings=H.countrySettings)}H.checkout.shippingAddress&&(H.checkout.shippingAddress.checkoutSettings=H.checkoutSettings,H.checkout.shippingAddress.shippingZones=H.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(H.selectedBillingAddressId=e,"-1"===e)H.checkout.billingAddress=new D,H.checkout.billingAddress.countrySettings=H.countrySettings;else{var i=null===(t=H.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(H.checkout.billingAddress=new D(i),H.checkout.billingAddress.countrySettings=H.countrySettings)}H.checkout.billingAddress&&(H.checkout.billingAddress.checkoutSettings=H.checkoutSettings,H.checkout.billingAddress.shippingZones=H.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){H.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){if(H.cardData&&(!(e.length>H.cardData.cardNumber.length)||K(e))){var t=(H.cardData.cardNumber||"").split(" ").join(""),i=e.split(" ").join("");i.length>16||(t.length<6&&i.length>=6&&!H.installmentInfo?H.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:H.checkout.selectedPaymentGateway.id,price:H.checkout.totalFinalPrice}}):i.length<6&&t.length>i.length&&(H.cardData.installmentCount=1,H.installmentInfo=void 0),H.cardData.cardNumber=U(i,4).join(" "))}},this.onCardHolderNameChange=function(e){H.cardData&&(H.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(H.cardData&&(!(e.length>H.cardData.expirationDate.length)||K(e))){if(0===(null===(t=H.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(H.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(H.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(H.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(H.cardData.expirationDate=U(d,2).join(" / "))}},this.onCvcChange=function(e){H.cardData&&(e.length>H.cardData.cvv.length&&!K(e)||e.length>4||(H.cardData.cvv=e))},this.saveAddress=function(s){return e(H,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,g,f,v=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 m(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===(g=this.customerAddresses)||void 0===g||g.forEach((function(e){e.checkoutSettings=v.checkoutSettings,e.shippingZones=v.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(){H.router.push("/cart")},this.onBackToShoppingClick=function(){H.router.push("/")},this.onGoToLoginClick=function(){H.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(H,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(G.SHIPPING):this.changeStep(G.PAYMENT),[3,7];case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:L.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(H,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(G.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:L.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(H,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(G.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:L.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!H.canPerformPayment||(H.isErrorsVisible=!0,!1)},this.onCompletePaymentClick=function(){return e(H,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.isKlarna?[4,this.saveCart()]:[3,2]):(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.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 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:L.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(H,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:L.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(H,void 0,void 0,(function(){var e,i,s,n,r,c,d,l,h,p,m,g,f,v,y;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(l=this.mpVM.selectedCard)||void 0===l?void 0:l.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(h=this.cardData)||void 0===h?void 0:h.installmentCount)?[2]:[4,C.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===(g=this.cardData)||void 0===g?void 0:g.threeDSecure)}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,C.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(f=this.mpVM.selectedCard)||void 0===f?void 0:f.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===o.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===a.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,c=r&&[u.SUCCESS,u.AUTHORIZED].includes(r),d=r===u.PENDING,c?[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:L.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(H,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(G.SUCCESS),[2]}}))}))},this.onBackToInfoClick=function(){H.changeStep(G.INFO)},this.onBackToShippingClick=function(){H.changeStep(G.SHIPPING)},this.setCustomerConsentGranted=function(e){H.checkout.customer&&(H.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){H.useDifferentAddress=e,H.useDifferentAddress?(localStorage.setItem("sAddr","1"),H.checkout.billingAddress=H.checkout.billingAddress||new D,H.checkout.billingAddress.countrySettings=H.countrySettings):(localStorage.removeItem("sAddr"),H.checkout.billingAddress=H.checkout.shippingAddress)},this.setShouldSaveAddress=function(e){H.shouldSaveAddress=e},this.setAddressTitle=function(e){H.addressTitle=e},this.setPaymentGateway=function(i){return e(H,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?"STRIPE"!==(e=this.paymentGateways[i]).code||!(null===(n=e.settings)||void 0===n?void 0:n.find((function(e){return"allow_custom_flow"===e.label&&"1"===e.value})))||this.stripeResponse?[3,2]:[4,C.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})]:[2];case 1:(s=t.sent()).isSuccess&&s.data&&(this.stripeResponse=s.data),t.label=2;case 2:return"KLARNA"!==e.code||this.klarnaResponse?[3,4]:[4,C.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 3:(s=t.sent()).isSuccess&&s.data&&(this.klarnaResponse=s.data),t.label=4;case 4:return"ADYEN"!==e.code||this.adyenResponse?[3,6]:[4,C.createAdyenClientToken({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 5:(s=t.sent()).isSuccess&&s.data&&(this.adyenResponse=s.data),t.label=6;case 6:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,8]:[4,C.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:e.id||""}})];case 7:(s=t.sent()).isSuccess&&s.data&&(this.payPalClientIdResponse=s.data),t.label=8;case 8:return this.checkout.selectedPaymentGateway=e,this.step!==G.SUCCESS&&(e.paymentMethodType===o.CREDIT_CARD&&e.type===a.INTERNAL&&(this.cardData=new k,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){H.cardData&&(H.cardData.installmentCount=e)},this.changeStep=function(i){return e(H,void 0,void 0,(function(){return t(this,(function(e){return V||window.location.replace("".concat(window.location.pathname,"?id=").concat(this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(H,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){H.isContactModalVisible=e},this.getCampaignOfferProducts=function(i){return e(H,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===l.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,N.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 y(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(H,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOfferProducts(h.CHECKOUT)];case 1:return e.checkoutCampaignOffer=t.sent(),i=this,[4,this.getCampaignOfferProducts(h.POST_CHECKOUT)];case 2:return i.postCheckoutCampaignOffer=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(H,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.isCheckoutLoaded=!1,[4,P.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent())&&e.isSuccess&&e.data&&(this.checkout=new p(e.data,this.countrySettings),i.accepted&&this.step===G.SUCCESS?this.changeStep(G.INFO):this.changeStep(this.step)),[2]}}))}))},this.registerCustomer=function(i){return e(H,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,b.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.checkout=c,this.checkoutSettings=d,this.router=g,this.returnPolicy=f,this.privacyPolicy=M,this.termsOfService=_,this.imprint=F,this.shippingPolicy=Z,this.t=B,this.customizationProps=Y,this.mpVM=new I,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new S({currentLocale:O.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(M.prototype,"merchantSettings",{get:function(){return new f(O.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.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(M.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=j.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(M.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(M.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"finalPrice",{get:function(){return this.step===G.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===L.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(M.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)!==L.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(M.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(M.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"store",{get:function(){return j.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(M.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)===o.CREDIT_CARD&&i.type===a.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(M.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===c.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(M.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 g(i({countrySettings:s.countrySettings},e));return t.checkoutSettings=s.checkoutSettings,t.shippingZones=s.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===d.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"isEPayKolayEnabled",{get:function(){var e=O.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),M.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},M}();function U(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function K(e){return e&&M.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(G||(G={})),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"}(L||(L={}));export{G as CheckoutStep,L as ErrorType,_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import{Checkbox as i}from"../../components/checkbox/index.js";import n from"../../components/error/index.js";import{PaymentGateways as
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import{IkasStorefrontConfig as o}from"@ikas/storefront-config";import{Checkbox as i}from"../../components/checkbox/index.js";import n from"../../components/error/index.js";import{PaymentGateways as r}from"./payment-gateways/index.js";import{BillingAddress as a}from"./billing-address/index.js";import{Button as c}from"../../components/button/index.js";import s from"../../components/master-pass/link-card-to-client/index.js";import{PayPal as m}from"../../components/paypal/index.js";import l from"../../components/notification-box/index.js";import{createTranslationInputData as p,useTranslation as d}from"../../../../utils/i18n.js";import u from"../../components/svg/lock.js";import y from"./style.module.scss.js";var k=t((function(t){var k=t.vm,f=d().t,g=e.useCallback((function(e){e.stopPropagation(),k.policyModalTitle=f("checkout-page:privacyPolicy"),k.policyModalText=k.privacyPolicy}),[k,k.privacyPolicy]),v=e.useCallback((function(e){e.stopPropagation(),k.policyModalTitle=f("checkout-page:termsOfService"),k.policyModalText=k.termsOfService}),[k,k.termsOfService]),C=o.getTranslations()["checkout-page"],E=p(C.ackPoliciesSentence).map((function(t){return t.isVariable?e.createElement("span",{className:[y.TermsLabelSpan,k.isErrorsVisible&&!k.isTermsAndConditionsChecked?y.Error:""].join(" "),onClick:"{{ ackPrivacyPolicy }}"===t.value?g:v},"{{ ackPrivacyPolicy }}"===t.value?f("checkout-page:ackPrivacyPolicy"):f("checkout-page:ackTermsOfService")):t.value}));return e.createElement("div",{className:[y.StepPayment].join(" ")},e.createElement(n,{vm:k}),k.isFree&&e.createElement(l,{type:"success",content:f("checkout-page:freeOrderDescription")}),!k.isFree&&e.createElement(e.Fragment,null,k.mpVM.isLinkCardToClientVisible&&e.createElement(s,{vm:k}),e.createElement(r,{vm:k})),e.createElement(a,{vm:k}),k.checkoutSettings.showTermsAndConditionsCheckbox&&e.createElement("div",{style:{marginTop:k.useDifferentAddress?"12px":"0px"}},e.createElement(i,{value:k.isTermsAndConditionsChecked,hasError:k.isErrorsVisible&&!k.isTermsAndConditionsChecked,label:e.createElement(e.Fragment,null,E),onChange:k.onTermsAndConditionsCheckedChange})),!k.isFree&&k.isPayPal?e.createElement("div",{className:y.PayPalContainer},e.createElement(m,{vm:k})):e.createElement(c,{style:{width:"100%",marginTop:"24px"},text:f("checkout-page:actions.completeOrder"),isLoading:k.isStepLoading,onClick:k.isDigitalOnly?k.onCompleteDigitalOnlyPaymentClick:k.onCompletePaymentClick}),!!f("checkout-page:securePaymentTooltip")&&e.createElement("div",{className:y.SecurePaymentContainer},e.createElement("span",{className:y.Lock},e.createElement(u,null)),e.createElement("span",null,f("checkout-page:securePaymentTooltip"))))}));export{k as CheckoutStepPayment};
|