@ikas/storefront 5.0.8 → 5.0.10
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.d.ts +8 -36
- package/build/analytics/googleTagManager.js +1 -1
- package/build/components/checkout/index.js +1 -1
- package/build/components/checkout/model.js +1 -1
- package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}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{IkasBrand as i}from"../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{IkasCart as s}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as a}from"../models/data/category/index.js";import{IkasCheckout as c}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"../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/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as n}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"@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{FacebookPixel as d}from"./facebookPixel.js";import{GoogleTagManager as m}from"./googleTagManager.js";import{IkasEventType as l}from"./events.js";import u from"lodash/cloneDeep";import{tryForEach as p}from"../utils/helper.js";import b from"./ikas.js";import{GoogleAnalytics as f}from"./googleAnalytics.js";import{TiktokPixel as h}from"./tiktokPixel.js";import{IkasBaseStore as g}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var j=function(){function j(){o(this)}return j.getCustomerInfo=function(){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,(t=g.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),(o=t.customerStore.customer)?[2,r(r({},o.basicInfo),{consentGranted:t.customerStore.customerConsentGranted})]:[2,null]}}))}))},j.pageView=function(r){return t(this,void 0,void 0,(function(){var t,o,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=window.location.href,[4,j.getCustomerInfo()];case 1:return o=e.sent(),m.pageView(t),b.pageView(r),h.pageView(t),p(j.subscribers,(function(e){e.callback({type:l.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,3];case 2:return i=e.sent(),console.error(i),[3,3];case 3:return[2]}}))}))},j.productView=function(t){try{if(d.productView(t),m.productView(t),b.productView(t),f.productView(t),h.productView(t),j.subscribers.length){var e=new n(u(t));p(j.subscribers,(function(t){t.callback({type:l.PRODUCT_VIEW,data:{productDetail:e}})}))}}catch(t){console.error(t)}},j.addToCart=function(t,e,r,o,i){try{if(d.addToCart(t,e,r),m.addToCart(t,e,i),b.addToCart(t,e,o),f.addToCart(t,e),h.addToCart(t,e),j.subscribers.length){var a=u(t),c=new s(u(o));p(j.subscribers,(function(t){t.callback({type:l.ADD_TO_CART,data:{item:a,quantity:e,cart:c}})}))}}catch(t){console.error(t)}},j.removeFromCart=function(t,e,r){try{if(m.removeFromCart(t,e),f.removeFromCart(t,e),j.subscribers.length){var o=u(t),i=new s(u(r));p(j.subscribers,(function(t){t.callback({type:l.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:i}})}))}}catch(t){console.error(t)}},j.beginCheckout=function(t){try{var e=localStorage.getItem("gtmBeginCheckout");if(e&&t.id===e)return;if(localStorage.setItem("gtmBeginCheckout",t.id),d.beginCheckout(t),m.beginCheckout(t),b.beginCheckout(t),f.beginCheckout(t),h.beginCheckout(t),j.subscribers.length){var r=new c(u(t));p(j.subscribers,(function(t){t.callback({type:l.BEGIN_CHECKOUT,data:{checkout:r}})}))}}catch(t){console.error(t)}},j.purchase=function(t,e){try{if(localStorage.removeItem("gtmBeginCheckout"),d.purchase(t,e.id||""),m.purchase(t,t.orderNumber||""),b.orderSuccess(t),f.purchase(t,t.orderNumber||""),h.purchase(t),j.subscribers.length){var r=new c(u(t)),o=u(e);p(j.subscribers,(function(t){t.callback({type:l.COMPLETE_CHECKOUT,data:{checkout:r,transaction:o}})}))}}catch(t){console.error(t)}},j.checkoutStep=function(t,e){try{if(m.checkoutStep(t,e),b.checkoutStep(t,e),f.checkoutStep(t,e),j.subscribers.length){var r=new c(u(t));p(j.subscribers,(function(t){t.callback({type:l.CHECKOUT_STEP,data:{checkout:r,step:e}})}))}}catch(t){console.error(t)}},j.disableHTML=function(){try{m.disableHTML()}catch(t){console.error(t)}},j.addToWishlist=function(t,e){try{d.addToWishlist(t),h.addToWishlist(t),j.subscribers.length&&p(j.subscribers,(function(r){r.callback({type:e?l.REMOVE_FROM_WISHLIST:l.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},j.search=function(t){try{d.search(t),m.search(t),h.search(t),f.search(t),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},j.completeRegistration=function(t){try{d.completeRegistration(),m.completeRegistration(t),h.completeRegistration(),b.customerRegister(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_REGISTER,data:{email:t.email,firstName:t.firstName,lastName:t.lastName}})}))}catch(t){console.error(t)}},j.createEmailSubscripition=function(t){try{j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.EMAIL_SUBSCRIPTION,data:{email:t}})}))}catch(t){console.error(t)}},j.customerLogin=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerLogin(t),b.customerLogin(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_LOGIN,data:{customer:t}})})),[3,3]):[2];case 2:return r=e.sent(),console.error(r),[3,3];case 3:return[2]}}))}))},j.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{m.customerLogout(),j.subscribers.length&&p(j.subscribers,(function(t){t.callback({type:l.CUSTOMER_LOGOUT,data:{}})}))}catch(t){console.error(t)}return[2]}))}))},j.customerVisit=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerVisit(t),b.customerVisit(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_VISIT,data:{customer:t}})})),[3,3]):[2];case 2:return r=e.sent(),console.error(r),[3,3];case 3:return[2]}}))}))},j.viewCart=function(t){try{if(t&&(d.viewCart(t),b.viewCart(t),f.viewCart(t),m.viewCart(t),j.subscribers.length)){var e=new s(u(t));p(j.subscribers,(function(t){t.callback({type:l.VIEW_CART,data:{cart:e}})}))}}catch(t){console.error(t)}},j.viewCategory=function(t,e){try{if(d.viewCategory(t),m.viewCategory(e,t),b.viewCategory(e),h.viewCategory(e),j.subscribers.length){var r=new a(u(e));p(j.subscribers,(function(e){e.callback({type:l.VIEW_CATEGORY,data:{categoryPath:t,category:r}})}))}}catch(t){console.error(t)}},j.viewBrand=function(t){try{if(b.viewBrand(t),j.subscribers.length){var e=new i(u(t));p(j.subscribers,(function(t){t.callback({type:l.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},j.viewSearchResults=function(t,e){try{if(j.subscribers.length){var r=u(e).map((function(t){return new n(t)}));p(j.subscribers,(function(e){e.callback({type:l.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},j.viewListing=function(t){try{if(j.subscribers.length){var e=u(t).map((function(t){return new n(t)}));p(j.subscribers,(function(t){t.callback({type:l.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},j.contactForm=function(t){try{if(d.contactForm(),h.contactForm(),j.subscribers.length){var e=u(t);p(j.subscribers,(function(t){t.callback({type:l.CONTACT_FORM,data:{form:e}})}))}}catch(t){console.error(t)}},j.subscribers=[],j}();export{j as Analytics};
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as r}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as o}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{IkasBrand as i}from"../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{IkasCart as s}from"../models/data/cart/index.js";import"../models/data/category/path-item/index.js";import{IkasCategory as a}from"../models/data/category/index.js";import{IkasCheckout as c}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"../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/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as n}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"@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{FacebookPixel as d}from"./facebookPixel.js";import{GoogleTagManager as m}from"./googleTagManager.js";import{IkasEventType as l}from"./events.js";import u from"lodash/cloneDeep";import{tryForEach as p}from"../utils/helper.js";import b from"./ikas.js";import{GoogleAnalytics as f}from"./googleAnalytics.js";import{TiktokPixel as h}from"./tiktokPixel.js";import{IkasBaseStore as g}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";var j=function(){function j(){o(this)}return j.getCustomerInfo=function(){return t(this,void 0,void 0,(function(){var t,o;return e(this,(function(e){switch(e.label){case 0:return[4,(t=g.getInstance()).customerStore.waitUntilInitialized()];case 1:return e.sent(),(o=t.customerStore.customer)?[2,r(r({},o.basicInfo),{consentGranted:t.customerStore.customerConsentGranted})]:[2,null]}}))}))},j.pageView=function(r){return t(this,void 0,void 0,(function(){var t,o,i;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=window.location.href,[4,j.getCustomerInfo()];case 1:return o=e.sent(),m.pageView(t),b.pageView(r),h.pageView(t),p(j.subscribers,(function(e){e.callback({type:l.PAGE_VIEW,data:{url:t,pageType:r,customer:o}})})),[3,3];case 2:return i=e.sent(),console.error(i),[3,3];case 3:return[2]}}))}))},j.productView=function(t){try{if(d.productView(t),m.productView(t),b.productView(t),f.productView(t),h.productView(t),j.subscribers.length){var e=new n(u(t));p(j.subscribers,(function(t){t.callback({type:l.PRODUCT_VIEW,data:{productDetail:e}})}))}}catch(t){console.error(t)}},j.addToCart=function(t,e,r,o,i){try{if(d.addToCart(t,e,r),m.addToCart(t,e,i),b.addToCart(t,e,o),f.addToCart(t,e),h.addToCart(t,e),j.subscribers.length){var a=u(t),c=new s(u(o));p(j.subscribers,(function(t){t.callback({type:l.ADD_TO_CART,data:{item:a,quantity:e,cart:c}})}))}}catch(t){console.error(t)}},j.removeFromCart=function(t,e,r){try{if(m.removeFromCart(t,e),f.removeFromCart(t,e),j.subscribers.length){var o=u(t),i=new s(u(r));p(j.subscribers,(function(t){t.callback({type:l.REMOVE_FROM_CART,data:{item:o,quantity:e,cart:i}})}))}}catch(t){console.error(t)}},j.beginCheckout=function(t){try{var e=localStorage.getItem("gtmBeginCheckout");if(e&&t.id===e)return;if(localStorage.setItem("gtmBeginCheckout",t.id),d.beginCheckout(t),m.beginCheckout(t),b.beginCheckout(t),f.beginCheckout(t),h.beginCheckout(t),j.subscribers.length){var r=new c(u(t));p(j.subscribers,(function(t){t.callback({type:l.BEGIN_CHECKOUT,data:{checkout:r}})}))}}catch(t){console.error(t)}},j.purchase=function(t,e){try{if(localStorage.removeItem("gtmBeginCheckout"),d.purchase(t,e.id||""),m.purchase(t,t.orderNumber||""),b.orderSuccess(t),f.purchase(t,t.orderNumber||""),h.purchase(t),j.subscribers.length){var r=new c(u(t)),o=u(e);p(j.subscribers,(function(t){t.callback({type:l.COMPLETE_CHECKOUT,data:{checkout:r,transaction:o}})}))}}catch(t){console.error(t)}},j.checkoutStep=function(t,e){try{if(m.checkoutStep(t,e),b.checkoutStep(t,e),f.checkoutStep(t,e),j.subscribers.length){var r=new c(u(t));p(j.subscribers,(function(t){t.callback({type:l.CHECKOUT_STEP,data:{checkout:r,step:e}})}))}}catch(t){console.error(t)}},j.disableHTML=function(){try{m.disableHTML()}catch(t){console.error(t)}},j.addToWishlist=function(t,e){try{d.addToWishlist(t),h.addToWishlist(t),j.subscribers.length&&p(j.subscribers,(function(r){r.callback({type:e?l.REMOVE_FROM_WISHLIST:l.ADD_TO_WISHLIST,data:{productId:t}})}))}catch(t){console.error(t)}},j.search=function(t){try{d.search(t),m.search(t),h.search(t),f.search(t),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.SEARCH,data:{searchKeyword:t}})}))}catch(t){console.error(t)}},j.completeRegistration=function(t){try{d.completeRegistration(),m.completeRegistration(t),h.completeRegistration(),b.customerRegister(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_REGISTER,data:{email:t.email,firstName:t.firstName,lastName:t.lastName,notificationsAccepted:t.subscriptionStatus}})}))}catch(t){console.error(t)}},j.createEmailSubscripition=function(t){try{j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.EMAIL_SUBSCRIPTION,data:{email:t}})}))}catch(t){console.error(t)}},j.customerLogin=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerLogin(t),b.customerLogin(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_LOGIN,data:{customer:t}})})),[3,3]):[2];case 2:return r=e.sent(),console.error(r),[3,3];case 3:return[2]}}))}))},j.customerLogout=function(){return t(this,void 0,void 0,(function(){return e(this,(function(t){try{m.customerLogout(),j.subscribers.length&&p(j.subscribers,(function(t){t.callback({type:l.CUSTOMER_LOGOUT,data:{}})}))}catch(t){console.error(t)}return[2]}))}))},j.customerVisit=function(){return t(this,void 0,void 0,(function(){var t,r;return e(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,j.getCustomerInfo()];case 1:return(t=e.sent())&&t.email?(m.customerVisit(t),b.customerVisit(),j.subscribers.length&&p(j.subscribers,(function(e){e.callback({type:l.CUSTOMER_VISIT,data:{customer:t}})})),[3,3]):[2];case 2:return r=e.sent(),console.error(r),[3,3];case 3:return[2]}}))}))},j.viewCart=function(t){try{if(t&&(d.viewCart(t),b.viewCart(t),f.viewCart(t),m.viewCart(t),j.subscribers.length)){var e=new s(u(t));p(j.subscribers,(function(t){t.callback({type:l.VIEW_CART,data:{cart:e}})}))}}catch(t){console.error(t)}},j.viewCategory=function(t,e){try{if(d.viewCategory(t),m.viewCategory(e,t),b.viewCategory(e),h.viewCategory(e),j.subscribers.length){var r=new a(u(e));p(j.subscribers,(function(e){e.callback({type:l.VIEW_CATEGORY,data:{categoryPath:t,category:r}})}))}}catch(t){console.error(t)}},j.viewBrand=function(t){try{if(b.viewBrand(t),j.subscribers.length){var e=new i(u(t));p(j.subscribers,(function(t){t.callback({type:l.VIEW_BRAND,data:{brand:e}})}))}}catch(t){console.error(t)}},j.viewSearchResults=function(t,e){try{if(j.subscribers.length){var r=u(e).map((function(t){return new n(t)}));p(j.subscribers,(function(e){e.callback({type:l.VIEW_SEARCH_RESULTS,data:{searchKeyword:t,productDetails:r}})}))}}catch(t){console.error(t)}},j.viewListing=function(t){try{if(j.subscribers.length){var e=u(t).map((function(t){return new n(t)}));p(j.subscribers,(function(t){t.callback({type:l.VIEW_LISTING,data:{productDetails:e}})}))}}catch(t){console.error(t)}},j.contactForm=function(t){try{if(d.contactForm(),h.contactForm(),j.subscribers.length){var e=u(t);p(j.subscribers,(function(t){t.callback({type:l.CONTACT_FORM,data:{form:e}})}))}}catch(t){console.error(t)}},j.subscribers=[],j}();export{j as Analytics};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as e}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/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as t}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"@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{CheckoutStep as i}from"../components/checkout/model.js";var o="undefined"==typeof window,r=function(){function r(){e(this)}return r.productView=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_item",{currency:""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency,value:e.selectedVariant.price.finalPrice,items:[a(e)]}))}catch(e){console.error(e)}},r.addToCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","add_to_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.finalPrice*i:e.finalPrice?e.finalPrice*i:null,items:[e instanceof t?a(e,i):n(e,i)]}))}catch(e){console.error(e)}},r.removeFromCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","remove_from_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.price.finalPrice:e.finalPrice,items:[e instanceof t?a(e,i):n(e,i)]}))}catch(e){console.error(e)}},r.viewCart=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_cart",{currency:e.currencyCode,value:e.totalPrice,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}},r.beginCheckout=function(e){try{return void(!o&&window.gtag&&window.gtag("event","begin_checkout",{currency:e.currencyCode,value:e.totalFinalPrice,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}},r.purchase=function(e,t){try{return void(!o&&window.gtag&&window.gtag("event","purchase",{transaction_id:t,affiliation:window.location.hostname,value:
|
|
1
|
+
import{makeAutoObservable as e}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/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as t}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"@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{CheckoutStep as i}from"../components/checkout/model.js";var o="undefined"==typeof window,r=function(){function r(){e(this)}return r.productView=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_item",{currency:""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency,value:e.selectedVariant.price.finalPrice,items:[a(e)]}))}catch(e){console.error(e)}},r.addToCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","add_to_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.finalPrice*i:e.finalPrice?e.finalPrice*i:null,items:[e instanceof t?a(e,i):n(e,i)]}))}catch(e){console.error(e)}},r.removeFromCart=function(e,i){try{return void(!o&&window.gtag&&window.gtag("event","remove_from_cart",{currency:e instanceof t?""===e.selectedVariant.price.currency?"TRY":e.selectedVariant.price.currency:e.currencyCode,value:e instanceof t?e.selectedVariant.price.finalPrice:e.finalPrice,items:[e instanceof t?a(e,i):n(e,i)]}))}catch(e){console.error(e)}},r.viewCart=function(e){try{return void(!o&&window.gtag&&window.gtag("event","view_cart",{currency:e.currencyCode,value:e.totalPrice,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}},r.beginCheckout=function(e){try{return void(!o&&window.gtag&&window.gtag("event","begin_checkout",{currency:e.currencyCode,value:e.totalFinalPrice,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}},r.purchase=function(e,t){try{return void(!o&&window.gtag&&window.gtag("event","purchase",{transaction_id:t,affiliation:window.location.hostname,value:e.totalFinalPrice,tax:e.totalTax,shipping:e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}},r.checkoutStep=function(e,t){var r;if(t===i.SHIPPING)try{return void(!o&&window.gtag&&window.gtag("event","add_shipping_info",{currency:e.currencyCode,value:e.totalFinalPrice,shipping_tier:"Ground",coupon:e.couponCode,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}if(t===i.PAYMENT)try{return void(!o&&window.gtag&&window.gtag("event","add_payment_info",{currency:e.currencyCode,value:e.totalFinalPrice,coupon:e.couponCode,payment_type:null===(r=e.selectedPaymentGateway)||void 0===r?void 0:r.paymentMethodType,items:e.items.map((function(e){return n(e,e.quantity)}))}))}catch(e){console.error(e)}},r.search=function(e){try{return void(!o&&window.gtag&&window.gtag("event","search",{search_term:e}))}catch(e){console.error(e)}},r}();function a(e,t){var i;void 0===t&&(t=1);var o=[],r=e.categories;return r&&r.length&&(r[0].categoryPath&&r[0].categoryPath.map((function(e){return o.push(e)})),o.push(r[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(i=e.brand)||void 0===i?void 0:i.name)||"",item_category:o.length?o[0]:"",item_category_2:o.length>1?o[1]:"",item_category_3:o.length>2?o[2]:"",item_category_4:o.length>3?o.slice(3,o.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function n(e,t){var i,o;void 0===t&&(t=1);var r=[],a=e.variant.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e.name)})),r.push(a[0].name)),{item_name:e.variant.name,item_id:e.variant.id,price:e.finalPrice||"",item_brand:(null===(i=e.variant.brand)||void 0===i?void 0:i.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:null===(o=e.variant.variantValues)||void 0===o?void 0:o.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}export{r as GoogleAnalytics};
|
|
@@ -36,21 +36,7 @@ export declare class GoogleTagManager {
|
|
|
36
36
|
static addToCart(item: IkasProduct | IkasOrderLineItem, quantity: number, product?: IkasProduct): {
|
|
37
37
|
event: string;
|
|
38
38
|
ecommerce: {
|
|
39
|
-
items:
|
|
40
|
-
item_name: string;
|
|
41
|
-
item_id: string;
|
|
42
|
-
price: number;
|
|
43
|
-
item_brand: string;
|
|
44
|
-
item_category: string;
|
|
45
|
-
item_category_2: string;
|
|
46
|
-
item_category_3: string;
|
|
47
|
-
item_category_4: string;
|
|
48
|
-
item_variant: string;
|
|
49
|
-
item_list_name: string;
|
|
50
|
-
item_list_id: string;
|
|
51
|
-
index: number;
|
|
52
|
-
quantity: number;
|
|
53
|
-
} | {
|
|
39
|
+
items: {
|
|
54
40
|
item_variant: string | undefined;
|
|
55
41
|
item_list_name: string;
|
|
56
42
|
item_list_id: string;
|
|
@@ -63,29 +49,15 @@ export declare class GoogleTagManager {
|
|
|
63
49
|
item_category_4: string;
|
|
64
50
|
item_name: string;
|
|
65
51
|
item_id: string | null;
|
|
66
|
-
price: string;
|
|
67
|
-
}
|
|
52
|
+
price: string | number;
|
|
53
|
+
}[];
|
|
68
54
|
cart: IkasCart | null | undefined;
|
|
69
55
|
};
|
|
70
56
|
} | undefined;
|
|
71
57
|
static removeFromCart(item: IkasProduct | IkasOrderLineItem, quantity: number): {
|
|
72
58
|
event: string;
|
|
73
59
|
ecommerce: {
|
|
74
|
-
items:
|
|
75
|
-
item_name: string;
|
|
76
|
-
item_id: string;
|
|
77
|
-
price: number;
|
|
78
|
-
item_brand: string;
|
|
79
|
-
item_category: string;
|
|
80
|
-
item_category_2: string;
|
|
81
|
-
item_category_3: string;
|
|
82
|
-
item_category_4: string;
|
|
83
|
-
item_variant: string;
|
|
84
|
-
item_list_name: string;
|
|
85
|
-
item_list_id: string;
|
|
86
|
-
index: number;
|
|
87
|
-
quantity: number;
|
|
88
|
-
} | {
|
|
60
|
+
items: {
|
|
89
61
|
item_variant: string | undefined;
|
|
90
62
|
item_list_name: string;
|
|
91
63
|
item_list_id: string;
|
|
@@ -98,8 +70,8 @@ export declare class GoogleTagManager {
|
|
|
98
70
|
item_category_4: string;
|
|
99
71
|
item_name: string;
|
|
100
72
|
item_id: string | null;
|
|
101
|
-
price: string;
|
|
102
|
-
}
|
|
73
|
+
price: string | number;
|
|
74
|
+
}[];
|
|
103
75
|
cart: IkasCart | null | undefined;
|
|
104
76
|
};
|
|
105
77
|
} | undefined;
|
|
@@ -119,7 +91,7 @@ export declare class GoogleTagManager {
|
|
|
119
91
|
item_category_4: string;
|
|
120
92
|
item_name: string;
|
|
121
93
|
item_id: string | null;
|
|
122
|
-
price: string;
|
|
94
|
+
price: string | number;
|
|
123
95
|
}[];
|
|
124
96
|
};
|
|
125
97
|
} | undefined;
|
|
@@ -147,7 +119,7 @@ export declare class GoogleTagManager {
|
|
|
147
119
|
item_category_4: string;
|
|
148
120
|
item_name: string;
|
|
149
121
|
item_id: string | null;
|
|
150
|
-
price: string;
|
|
122
|
+
price: string | number;
|
|
151
123
|
}[];
|
|
152
124
|
};
|
|
153
125
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}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/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as o}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"@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{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as a}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"@ikas/storefront-config";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:""}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)}))}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t){var o,a,d=i(e);null===(o=d.shippingAddress)||void 0===o||delete o.checkoutSettings,null===(a=d.billingAddress)||void 0===a||delete a.checkoutSettings;var n="";t===r.INFO?n="checkout_info-GTM":t===r.SHIPPING?n="checkout_shipping-GTM":t===r.PAYMENT?n="checkout_payment-GTM":t===r.SUCCESS&&(n="checkout_success-GTM");try{var m={event:n,ecommerce:{cart:d}};return!s&&window.dataLayer&&window.dataLayer.push(m),m}catch(e){console.error(e)}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:""+t.finalPrice},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
|
|
1
|
+
import{__assign as e}from'./../ext/tslib/tslib.es6.js';import{makeAutoObservable as t}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/campaign-offer/index.js";import"../models/data/product/option-set/option/index.js";import"../models/data/product/option-set/index.js";import"../models/data/product/stock-location/index.js";import"../models/data/product/variant/price/index.js";import"../models/data/product/variant/index.js";import"../models/data/variant-type/index.js";import{IkasProduct as o}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"@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{CheckoutStep as r}from"../components/checkout/model.js";import"./analytics.js";import"./head/index.js";import"../components/page/index.js";import"../components/page/head.js";import"react";import"next/image.js";import"@ikas/storefront-model-functions";import"../components/link/index.js";import"../components/page-editor/loader/style.module.scss.js";import"../components/google-captcha/index.js";import"../pages/home.js";import"../pages/_slug_/index.js";import"../pages/pages/_slug_.js";import"../pages/checkout.js";import"../pages/account/index.js";import"../pages/account/addresses.js";import"../pages/account/orders/index.js";import"../pages/account/orders/_id_.js";import"../pages/account/login.js";import"../pages/account/register.js";import"../pages/account/forgot-password.js";import"../pages/account/recover-password.js";import"../pages/cart.js";import"../pages/editor.js";import"../pages/account/favorite-products.js";import"../pages/search.js";import"next/error.js";import"../pages/blog/index.js";import"../pages/blog/_slug_.js";import"../pages/raffle/_slug_.js";import"../pages/raffle/index.js";import"../pages/account/raffles.js";import"../pages/account/activate.js";import{IkasBaseStore as a}from"../store/base.js";import"../store/customer/index.js";import"../store/cart/index.js";import"@ikas/storefront-config";import"lodash/get";import i from"lodash/cloneDeep";var s="undefined"==typeof window,d=function(){function e(){t(this)}return e.pageView=function(e){try{var t={event:"page-view-GTM",page:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.productView=function(e){var t,o;try{var r={event:"view_item-GTM",ecommerce:{items:[n(e)],extraParams:{parent_id:e.id,currency:e.selectedVariant.price.currency,url:"https://".concat(window.location.hostname).concat(e.href),item_image:(null===(o=null===(t=e.selectedVariant.mainImage)||void 0===t?void 0:t.image)||void 0===o?void 0:o.src)||"",barcode:e.selectedVariant.barcodeList&&e.selectedVariant.barcodeList.length?e.selectedVariant.barcodeList[0]:""}}};return!s&&window.dataLayer&&window.dataLayer.push(r),r}catch(e){console.error(e)}},e.addToCart=function(e,t,r){var i=a.getInstance().cartStore.cart;try{var d={event:"add_to_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t,r)],cart:i}};return!s&&window.dataLayer&&window.dataLayer.push(d),d}catch(e){console.error(e)}},e.removeFromCart=function(e,t){var r=a.getInstance().cartStore.cart;try{var i={event:"remove_from_cart-GTM",ecommerce:{items:[e instanceof o?n(e,t):m(e,t)],cart:0===(null==r?void 0:r.itemCount)?null:r}};return!s&&window.dataLayer&&window.dataLayer.push(i),i}catch(e){console.error(e)}},e.beginCheckout=function(e){try{var t={event:"begin_checkout-GTM",ecommerce:{items:e.items.map((function(e){return m(e,e.quantity)}))}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.purchase=function(e,t){try{var o={event:"purchase-GTM",ecommerce:{purchase:{transaction_id:t,affiliation:window.location.hostname,value:""+e.totalFinalPrice,tax:""+e.totalTax,shipping:""+e.shippingTotal,currency:e.currencyCode,coupon:e.couponCode,items:e.items.map((function(e){return m(e,e.quantity)}))}}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.checkoutStep=function(e,t){var o,a,d=i(e);null===(o=d.shippingAddress)||void 0===o||delete o.checkoutSettings,null===(a=d.billingAddress)||void 0===a||delete a.checkoutSettings;var n="";t===r.INFO?n="checkout_info-GTM":t===r.SHIPPING?n="checkout_shipping-GTM":t===r.PAYMENT?n="checkout_payment-GTM":t===r.SUCCESS&&(n="checkout_success-GTM");try{var m={event:n,ecommerce:{cart:d}};return!s&&window.dataLayer&&window.dataLayer.push(m),m}catch(e){console.error(e)}},e.disableHTML=function(){try{!s&&window.dataLayer&&window.dataLayer.push({"gtm.blocklist":["html","customScripts","customPixels","nonGoogleScripts"]})}catch(e){console.error(e)}},e.completeRegistration=function(e){try{var t={event:"customer_register-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.search=function(e){try{var t={event:"search-GTM",search_string:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCategory=function(e,t){try{var o={event:"view_category-GTM",ecommerce:{category:[{id:e.id,name:e.name,metaData:e.metaData,href:e.href,image:e.image,path:t}]}};return!s&&window.dataLayer&&window.dataLayer.push(o),o}catch(e){console.error(e)}},e.customerLogin=function(e){try{var t={event:"customer_login-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.customerLogout=function(){try{var e={event:"customer_logout-GTM"};return!s&&window.dataLayer&&window.dataLayer.push(e),e}catch(e){console.error(e)}},e.customerVisit=function(e){try{var t={event:"customer_visit-GTM",customer:e};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e.viewCart=function(e){try{var t={event:"view_cart-GTM",ecommerce:{cart:e}};return!s&&window.dataLayer&&window.dataLayer.push(t),t}catch(e){console.error(e)}},e}();function n(e,t){var o;void 0===t&&(t=1);var r=[],a=e.categories;return a&&a.length&&(a[0].categoryPath&&a[0].categoryPath.map((function(e){return r.push(e)})),r.push(a[0].name)),{item_name:e.name,item_id:e.selectedVariant.id,price:e.selectedVariant.price.finalPrice,item_brand:(null===(o=e.brand)||void 0===o?void 0:o.name)||"",item_category:r.length?r[0]:"",item_category_2:r.length>1?r[1]:"",item_category_3:r.length>2?r[2]:"",item_category_4:r.length>3?r.slice(3,r.length).join(" > "):"",item_variant:e.selectedVariant.variantValues.map((function(e){return e.name})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:t}}function m(t,o,r){var a,i;void 0===o&&(o=1);var s=[],d=null==r?void 0:r.categories;return d&&d.length&&(d[0].categoryPath&&d[0].categoryPath.map((function(e){return s.push(e)})),s.push(d[0].name)),e(e({item_name:t.variant.name,item_id:t.variant.id,price:t.finalPrice||""},r?{item_brand:(null===(a=r.brand)||void 0===a?void 0:a.name)||"",item_category:s.length?s[0]:"",item_category_2:s.length>1?s[1]:"",item_category_3:s.length>2?s[2]:"",item_category_4:s.length>3?s.slice(3,s.length).join(" > "):""}:{item_brand:"",item_category:"",item_category_2:"",item_category_3:"",item_category_4:""}),{item_variant:null===(i=t.variant.variantValues)||void 0===i?void 0:i.map((function(e){return e.variantValueName})).join(" / "),item_list_name:"",item_list_id:"",index:1,quantity:o})}export{d as GoogleTagManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as n}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import r from"next/link.js";import a from"react-tooltip";import s,{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 u from"./steps/step-info/index.js";import{CheckoutStepShipping as p}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CouponErrorCode as f,Coupon as g,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 E}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/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../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 x}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import C from"./components/master-pass/modal-otp/index.js";import j from"./components/master-pass/modal-response/index.js";import P from"./components/master-pass/modal-success/index.js";import{Image as N}from"../image/index.js";import b,{Step as S}from"./components/step-container/index.js";import{StockError as O}from"./components/error/stock-error/index.js";import{FullscreenLoading as F}from"./components/fullscreen-loading/index.js";import M from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as w}from"./components/form-item/model.js";import{Button as I}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import B from"./components/offer-product/index.js";import L from"./components/offer-product/placeholder-offer-product.js";import D from"./components/svg/ikas.js";import U from"./style.module.scss.js";import{Analytics as V}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import R from"./components/epaykolay-button/index.js";import _ from"./components/svg/success-circle.js";import z from"./components/offer-product/offer-dots/index.js";import H from"./components/offer-product/offer-arrows/index.js";import K from"./components/offer-product/useCampaignOffer.js";var G=n((function(n){var r,m,u,p,v,f,g,y=n.checkout,b=n.checkoutSettings,S=n.customizationProps,M=n.returnPolicy,T=n.privacyPolicy,w=n.termsOfService,G=n.imprint,q=n.shippingPolicy,J=d().t,$=i(),ee=o.useState((function(){return new s(y,b,$,M,T,w,G,q,J,S||{})}))[0],te=K(ee),oe=te.setShowDetailPage,ne=te.setActiveIndex,ie=te.setIsActiveOverlay,re=te.handlePrev,ae=te.handleNext,se=te.isPopupClosedIndexPage,ce=te.isPopupShowIndexPage,le=te.isShowSuccessPageMiddlePhase,me=te.activeIndex,de=o.useMemo((function(){return Date.now()}),[]);ee.step===c.PAYMENT&&V.disableHTML();var ue=function(o,n,i,r,a){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:ee.checkout.id,customerNumber:o,sessionsState:de,addressDto:i,paymentType:r,totalPrice:a})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){ee.checkoutSettings.isAccountRequired&&!ee.checkout.hasCustomer&&$.push("/account/login?redirect="+encodeURIComponent(ee.checkoutUrl)),V.beginCheckout(ee.checkout),V.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){ee.customizationProps=S,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"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==e?void 0:e.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==e?void 0:e.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==e?void 0:e.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==e?void 0:e.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==e?void 0:e.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==e?void 0:e.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==e?void 0:e.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==e?void 0:e.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==e?void 0:e.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==e?void 0:e.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==e?void 0:e.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(S)}),[S]),o.useEffect((function(){if(ee.isEPayKolayEnabled)var o=setInterval((function(){var n,i;window.setContainerService&&ee.isCheckoutLoaded&&(window.setContainerService(null===(n=l.getMerchantSettings())||void 0===n?void 0:n.merchantId,ue,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,pe(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),ee.isEPayKolayPayment=!0}),"https://cdn-epeykolay.mncdn.com/".concat((null===(i=l.getApiUrl())||void 0===i?void 0:i.includes("myikas.com"))?"epay":"epay-uat","/")),clearInterval(o))}),100)}),[]);var pe=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:ee.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,{redirectUrl:"".concat(window.location.pathname,"?id=").concat(ee.checkout.id,"&step=").concat(e.success?"success":"info"),orderId:e.orderNumber||null}]}}))}))}),[]);if(!ee.isCheckoutLoaded||!ee.store.customerStore.initialized)return o.createElement(F,null);if(ee.checkout.hasCustomer&&(null===(r=ee.store.customerStore.customer)||void 0===r?void 0:r.id)!==(null===(m=ee.checkout.customer)||void 0===m?void 0:m.id))return $.push("/account/login?redirect="+encodeURIComponent(ee.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(A,{pageType:E.CHECKOUT,pageTitle:((null===(u=ee.merchantSettings)||void 0===u?void 0:u.merchantName)||"")+" - "+J("checkout-page:securePayment"),pageDescription:J("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:U.CheckoutPage},le?o.createElement("div",{className:U.FullPageOfferMain},o.createElement("div",{className:U.FullPageOfferContainer},o.createElement("div",{className:U.LogoMain},(null===(p=ee.customizationProps)||void 0===p?void 0:p.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{layout:"fill",image:ee.customizationProps.logo,sizes:"360px"})):(null===(v=ee.merchantSettings)||void 0===v?void 0:v.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{layout:"fill",image:ee.merchantSettings.logo,sizes:"360px"})):(null===(f=ee.merchantSettings)||void 0===f?void 0:f.merchantName)||""),o.createElement("div",{className:U.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:U.OfferSuccessHeader},o.createElement(_,{className:U.SuccessCircle}),o.createElement("span",{className:U.SuccessTitle},J("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:U.OfferOrderInfoMain},o.createElement("div",{className:U.InfoTitle},J("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:U.InfoText},"#"+(ee.checkout.orderNumber||"")," ",ee.checkout.dateStr))),o.createElement("div",null,o.createElement(I,{classes:U.OfferButton,isLine:!0,text:J("checkout-page:actions.goOrderDetailPage"),onClick:function(){oe(!1)}}))),o.createElement("div",null,ee.campaignOffers&&!!ee.campaignOffers.length&&ee.isCampaignOfferLoaded&&o.createElement("div",{className:U.CampaignOfferMain},o.createElement("div",{className:U.OfferSlider},ee.campaignOffers.map((function(e,t){var n;return o.createElement(B,{vm:ee,campaignOffer:e,index:t,activeIndex:me,offersLength:(null===(n=ee.campaignOffers)||void 0===n?void 0:n.length)||0,handlePrev:re,handleNext:ae,setActiveIndex:function(e){return ne(e)},desktopMiddlePhase:!0,step:ee.step})}))),ee.campaignOffers.length>1&&o.createElement(H,{handlePrev:re,handleNext:ae}),ee.campaignOffers.length>1&&o.createElement(z,{vm:ee,activeIndex:me}))))):null,o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:U.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[U.Left,ee.isEPayKolayPayment?U.epaykolay:""].join(" ")},ee.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!ee.isEPayKolayPayment&&o.createElement("div",{className:U.LeftContent},o.createElement("div",null,o.createElement(Y,{vm:ee}),ee.hasStockError&&o.createElement("div",{className:U.ErrorContainer},o.createElement(O,{vm:ee,error:ee.error})),!ee.hasStockError&&o.createElement(o.Fragment,null,ee.step!==c.SUCCESS&&o.createElement(h,{vm:ee,allowExpand:!0}),o.createElement("div",null,ee.step!==c.SUCCESS&&ee.isEPayKolayEnabled&&o.createElement(R,{onClick:function(){window.frictionless()}})),ee.step===c.SUCCESS?o.createElement(x,{vm:ee}):o.createElement(o.Fragment,null,!!(null===(g=ee.customizationProps)||void 0===g?void 0:g.showCampaignOffersDesign)&&l.getIsEditor()&&o.createElement(L,{vm:ee}),ce&&o.createElement("div",{className:[U.MiddlePhaseOverlay,ce?U.MiddlePhaseOverlayPopup:""].join(" ")}),ee.campaignOffers&&!!ee.campaignOffers.length&&ee.isCampaignOfferLoaded&&o.createElement("div",{className:[U.CampaignOfferMain,ce?U.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:U.OfferSlider},ee.campaignOffers.map((function(e,t){var n;return o.createElement(B,{vm:ee,campaignOffer:e,index:t,activeIndex:me,offersLength:(null===(n=ee.campaignOffers)||void 0===n?void 0:n.length)||0,handlePrev:re,handleNext:ae,setActiveIndex:function(e){return ne(e)},step:ee.step,isPopupClosed:se,isPopupShow:ce,closePopup:function(){return ie(!1)},showPopup:function(){return ie(!0)}})}))),ee.campaignOffers.length>1&&o.createElement(H,{handlePrev:re,handleNext:ae}),ee.campaignOffers.length>1&&o.createElement(z,{isPopupShow:ce,vm:ee,activeIndex:me})),ee.isCouponCodeRequirementOpen&&o.createElement(W,{vm:ee}),o.createElement(X,{vm:ee}))),o.createElement("div",{className:U.Space})),o.createElement(Q,{vm:ee}))),o.createElement("div",{className:U.Right},o.createElement("div",{className:U.RightContent},o.createElement(h,{vm:ee}),!ee.isPoweredByHidden&&o.createElement("div",{className:U.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(D,null))))),!!ee.policyModalText&&o.createElement(k,{title:ee.policyModalTitle,modalContent:ee.policyModalText,onClose:function(){ee.policyModalText=""}}),ee.isContactModalVisible&&o.createElement(Z,{vm:ee,setVisible:ee.setContactModalVisible}),ee.mpVM.isOtpModalVisible&&o.createElement(C,{vm:ee,visible:ee.mpVM.isOtpModalVisible,type:ee.mpVM.otpModalType,onClose:ee.mpVM.hideOtpModal}),ee.mpVM.isResponseModalVisible&&o.createElement(j,{visible:ee.mpVM.isResponseModalVisible,text:ee.mpVM.mfsResponseModalText,onClose:ee.mpVM.onResponseModalClose}),ee.mpVM.isSuccessModalVisible&&o.createElement(P,{visible:ee.mpVM.isSuccessModalVisible,type:ee.mpVM.successModalType,onClose:ee.mpVM.onSuccessModalClose})))})),Y=n((function(e){var t,n,i,a,s=e.vm,c=d().t;return o.createElement("div",{className:U.Header},o.createElement(r,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{layout:"fill",image:s.customizationProps.logo,sizes:"360px"})):(null===(n=s.merchantSettings)||void 0===n?void 0:n.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{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:U.LoginText},o.createElement("span",{className:U.LoginCta},c("checkout-page:alreadyHaveAnAccount")),o.createElement(r,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:U.LoginBtn},c("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:U.CustomerInfo},o.createElement("div",{className:U.Name},s.checkout.customerFullName),o.createElement("div",{className:U.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),W=n((function(e){var t=e.vm,n=d().t,i=o.useState(!1),r=i[0],a=i[1],s=o.useState(null),c=s[0],l=s[1],m=o.useMemo((function(){switch(c){case f.COUPON_CODE_NOT_EXIST:return n("checkout-page:giftCodeErrorDescription");case f.COUPON_CODE_NOT_EXIST_FOR_GUESS:return n("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[c]);return o.createElement("div",{className:U.CouponContainer},r&&o.createElement("div",{className:U.NotificationContainer},o.createElement(M,{type:"warning",title:n("checkout-page:giftCodeErrorTitle"),content:m,onClose:function(){a(!1),l(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:r?12:0}},o.createElement(g,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:l})))})),X=n((function(e){var t=e.vm,n=d().t,i=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(u,{vm:t});case c.SHIPPING:return o.createElement(p,{vm:t});case c.PAYMENT:return o.createElement(v,{vm:t});case c.SUCCESS:return o.createElement(x,{vm:t})}}),[t,t.step]),r=[new S(n("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:U.AdressStepInfo},o.createElement(q,{vm:t}),!t.isUpsellOrder&&o.createElement("div",{className:U.EditBtn,onClick:t.onBackToInfoClick},n("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:U.AddressStepInfoMobile},o.createElement(q,{vm:t})):void 0),new S(n("checkout-page:payment"),t.step===c.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||r.splice(1,0,new S(n("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:U.AdressStepInfo},o.createElement(J,{vm:t}),!t.isUpsellOrder&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:U.EditBtn,onClick:t.onBackToShippingClick},n("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:U.AddressStepInfoMobile},o.createElement(J,{vm:t})):void 0)),o.createElement(b,{steps:r,stepContent:i})})),q=n((function(e){var t,n,i,r,a,s,c,l,m,u=e.vm,p=d().t,v=u.isDigitalOnly?((null===(t=u.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(n=u.checkout.billingAddress)||void 0===n?void 0:n.lastName)||""):((null===(i=u.checkout.shippingAddress)||void 0===i?void 0:i.firstName)||"")+" "+((null===(r=u.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:U.Address},o.createElement("div",{className:[U.Text,U.WithMBottom].join(" ")},(null===(a=u.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===u.deliveryMethod?o.createElement("div",{className:U.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:U.Text},p("checkout-page:receiver")),o.createElement("div",{className:[U.Text,U.Gray].join(" ")},v)),o.createElement("div",{className:[U.Text,U.Gray].join(" ")},u.isDigitalOnly?null===(s=u.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(c=u.checkout.shippingAddress)||void 0===c?void 0:c.phone),"in-store"===u.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[U.Text,U.WithMTop].join(" ")},p("checkout-page:pickUpLocation"))),o.createElement("div",{className:[U.Text,U.Gray].join(" ")},u.isDigitalOnly?null===(l=u.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(m=u.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),J=n((function(e){var t=e.vm,n=d().t;return o.createElement("div",{className:U.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:U.LightText}," / "+(0===t.checkout.shippingLines[0].price?n("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):n("checkout-page:standartShipping"))})),Q=n((function(e){var t=e.vm,n=d().t;return o.createElement("div",{className:U.Footer},o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},n("checkout-page:returnPolicy")),o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},n("checkout-page:privacyPolicy")),o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},n("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:imprint"),t.policyModalText=t.imprint}},n("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},n("checkout-page:shippingPolicy"))))})),Z=n((function(n){var i,r,a,s=n.vm,c=n.setVisible,l=d().t,m=o.useState(!1),u=m[0],p=m[1],v=o.useState(!1),f=v[0],g=v[1],h=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];h.email=(null===(i=s.checkout.customer)||void 0===i?void 0:i.email)||"",h.firstName=(null===(r=s.checkout.customer)||void 0===r?void 0:r.firstName)||"",h.lastName=(null===(a=s.checkout.customer)||void 0===a?void 0:a.lastName)||"";var E=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return f?[2,c(!1)]:(p(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&g(!0),p(!1),[2]}}))}))}),[u]);return o.createElement(k,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,f&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(M,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(T,{type:w.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(I,{style:{width:"100%",marginTop:"24px"},text:l(f?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:u,isDisabled:!h.message,onClick:E})),onClose:function(){return c(!1)}})}));export{G as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'./../../ext/tslib/tslib.es6.js';import*as o from"react";import{observer as n}from"mobx-react-lite";import{useRouter as i}from"next/router.js";import r from"next/link.js";import a from"react-tooltip";import s,{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 u from"./steps/step-info/index.js";import{CheckoutStepShipping as p}from"./steps/step-shipping/index.js";import{CheckoutStepPayment as v}from"./steps/step-payment/index.js";import{CouponErrorCode as f,Coupon as g,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 E}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/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import"../../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 x}from"./steps/step-success/index.js";import{Modal as k}from"./components/modal/index.js";import C from"./components/master-pass/modal-otp/index.js";import j from"./components/master-pass/modal-response/index.js";import P from"./components/master-pass/modal-success/index.js";import{Image as N}from"../image/index.js";import b,{Step as S}from"./components/step-container/index.js";import{StockError as O}from"./components/error/stock-error/index.js";import{FullscreenLoading as F}from"./components/fullscreen-loading/index.js";import M from"./components/notification-box/index.js";import{FormItem as T}from"./components/form-item/index.js";import{FormItemType as w}from"./components/form-item/model.js";import{Button as I}from"./components/button/index.js";import{IkasPageHead as A}from"../page/head.js";import B from"./components/offer-product/index.js";import L from"./components/offer-product/placeholder-offer-product.js";import D from"./components/svg/ikas.js";import U from"./style.module.scss.js";import{Analytics as V}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import R from"./components/epaykolay-button/index.js";import _ from"./components/svg/success-circle.js";import z from"./components/offer-product/offer-dots/index.js";import H from"./components/offer-product/offer-arrows/index.js";import K from"./components/offer-product/useCampaignOffer.js";var G=n((function(n){var r,m,u,p,v,f,g,y=n.checkout,b=n.checkoutSettings,S=n.customizationProps,M=n.returnPolicy,T=n.privacyPolicy,w=n.termsOfService,G=n.imprint,q=n.shippingPolicy,J=d().t,$=i(),ee=o.useState((function(){return new s(y,b,$,M,T,w,G,q,J,S||{})}))[0],te=K(ee),oe=te.setShowDetailPage,ne=te.setActiveIndex,ie=te.setIsActiveOverlay,re=te.handlePrev,ae=te.handleNext,se=te.isPopupClosedIndexPage,ce=te.isPopupShowIndexPage,le=te.isShowSuccessPageMiddlePhase,me=te.activeIndex,de=o.useMemo((function(){return Date.now()}),[]);ee.step,c.PAYMENT;var ue=function(o,n,i,r,a){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:ee.checkout.id,customerNumber:o,sessionsState:de,addressDto:i,paymentType:r,totalPrice:a})})];case 1:return[2,t.sent().json()]}}))}))};o.useEffect((function(){ee.checkoutSettings.isAccountRequired&&!ee.checkout.hasCustomer&&$.push("/account/login?redirect="+encodeURIComponent(ee.checkoutUrl)),V.beginCheckout(ee.checkout),V.pageView(E.CHECKOUT)}),[]),o.useEffect((function(){ee.customizationProps=S,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"),document.documentElement.style.setProperty("--checkout-secondary-button-bg-color",(null==e?void 0:e.secondaryButtonBgColor)||"#ffffff0"),document.documentElement.style.setProperty("--checkout-secondary-button-text-color",(null==e?void 0:e.secondaryButtonTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-secondary-button-border-color",(null==e?void 0:e.secondaryButtonBorderColor)||"#E5E4E9"),document.documentElement.style.setProperty("--checkout-campaign-title-color",(null==e?void 0:e.campaignOffersTitleColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-description-color",(null==e?void 0:e.campaignOffersDescriptionColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-color",(null==e?void 0:e.campaignOffersDiscountPercentageColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-discount-percentage-bg-color",(null==e?void 0:e.campaignOffersDiscountPercentageBgColor)||"#FFF1BD"),document.documentElement.style.setProperty("--checkout-campaign-countdown-text-color",(null==e?void 0:e.campaignOffersCountdownTextColor)||"#272727"),document.documentElement.style.setProperty("--checkout-campaign-countdown-time-color",(null==e?void 0:e.campaignOffersCountdownTimeColor)||"#FB4E4E"),document.documentElement.style.setProperty("--checkout-campaign-countdown-bg-color",(null==e?void 0:e.campaignOffersCountdownBgColor)||"#FFF5F6"),document.documentElement.style.setProperty("--checkout-campaign-middle-phase-overlay-color",(null==e?void 0:e.campaignOffersMiddlePhaseOverlayColor)||"#292727ad")}(S)}),[S]),o.useEffect((function(){if(ee.isEPayKolayEnabled)var o=setInterval((function(){var n,i;window.setContainerService&&ee.isCheckoutLoaded&&(window.setContainerService(null===(n=l.getMerchantSettings())||void 0===n?void 0:n.merchantId,ue,(function(o){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,pe(o)];case 1:return[2,e.sent()]}}))}))}),(function(){console.log("Switching to epaykolay"),ee.isEPayKolayPayment=!0}),"https://cdn-epeykolay.mncdn.com/".concat((null===(i=l.getApiUrl())||void 0===i?void 0:i.includes("myikas.com"))?"epay":"epay-uat","/")),clearInterval(o))}),100)}),[]);var pe=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:ee.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,{redirectUrl:"".concat(window.location.pathname,"?id=").concat(ee.checkout.id,"&step=").concat(e.success?"success":"info"),orderId:e.orderNumber||null}]}}))}))}),[]);if(!ee.isCheckoutLoaded||!ee.store.customerStore.initialized)return o.createElement(F,null);if(ee.checkout.hasCustomer&&(null===(r=ee.store.customerStore.customer)||void 0===r?void 0:r.id)!==(null===(m=ee.checkout.customer)||void 0===m?void 0:m.id))return $.push("/account/login?redirect="+encodeURIComponent(ee.checkoutUrl)),null;return o.createElement(o.Fragment,null,o.createElement(A,{pageType:E.CHECKOUT,pageTitle:((null===(u=ee.merchantSettings)||void 0===u?void 0:u.merchantName)||"")+" - "+J("checkout-page:securePayment"),pageDescription:J("checkout-page:securePayment")}),o.createElement("div",{id:"Checkout",className:U.CheckoutPage},le?o.createElement("div",{className:U.FullPageOfferMain},o.createElement("div",{className:U.FullPageOfferContainer},o.createElement("div",{className:U.LogoMain},(null===(p=ee.customizationProps)||void 0===p?void 0:p.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{layout:"fill",image:ee.customizationProps.logo,sizes:"360px"})):(null===(v=ee.merchantSettings)||void 0===v?void 0:v.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{layout:"fill",image:ee.merchantSettings.logo,sizes:"360px"})):(null===(f=ee.merchantSettings)||void 0===f?void 0:f.merchantName)||""),o.createElement("div",{className:U.OfferSuccessInfo},o.createElement("div",null,o.createElement("div",{className:U.OfferSuccessHeader},o.createElement(_,{className:U.SuccessCircle}),o.createElement("span",{className:U.SuccessTitle},J("checkout-page:orderSuccessShortTitle"))),o.createElement("div",{className:U.OfferOrderInfoMain},o.createElement("div",{className:U.InfoTitle},J("checkout-page:orderNoAndDate"),":"),o.createElement("div",{className:U.InfoText},"#"+(ee.checkout.orderNumber||"")," ",ee.checkout.dateStr))),o.createElement("div",null,o.createElement(I,{classes:U.OfferButton,isLine:!0,text:J("checkout-page:actions.goOrderDetailPage"),onClick:function(){oe(!1)}}))),o.createElement("div",null,ee.campaignOffers&&!!ee.campaignOffers.length&&ee.isCampaignOfferLoaded&&o.createElement("div",{className:U.CampaignOfferMain},o.createElement("div",{className:U.OfferSlider},ee.campaignOffers.map((function(e,t){var n;return o.createElement(B,{vm:ee,campaignOffer:e,index:t,activeIndex:me,offersLength:(null===(n=ee.campaignOffers)||void 0===n?void 0:n.length)||0,handlePrev:re,handleNext:ae,setActiveIndex:function(e){return ne(e)},desktopMiddlePhase:!0,step:ee.step})}))),ee.campaignOffers.length>1&&o.createElement(H,{handlePrev:re,handleNext:ae}),ee.campaignOffers.length>1&&o.createElement(z,{vm:ee,activeIndex:me}))))):null,o.createElement(a,{place:"top",type:"dark",effect:"solid",arrowColor:"transparent",multiline:!0,className:U.ReactTooltipWrap,globalEventOff:"touchstart"}),o.createElement("div",{className:[U.Left,ee.isEPayKolayPayment?U.epaykolay:""].join(" ")},ee.isEPayKolayEnabled&&o.createElement("div",{id:"plateau_ui_placeholder",style:{width:"100%"}}),!ee.isEPayKolayPayment&&o.createElement("div",{className:U.LeftContent},o.createElement("div",null,o.createElement(Y,{vm:ee}),ee.hasStockError&&o.createElement("div",{className:U.ErrorContainer},o.createElement(O,{vm:ee,error:ee.error})),!ee.hasStockError&&o.createElement(o.Fragment,null,ee.step!==c.SUCCESS&&o.createElement(h,{vm:ee,allowExpand:!0}),o.createElement("div",null,ee.step!==c.SUCCESS&&ee.isEPayKolayEnabled&&o.createElement(R,{onClick:function(){window.frictionless()}})),ee.step===c.SUCCESS?o.createElement(x,{vm:ee}):o.createElement(o.Fragment,null,!!(null===(g=ee.customizationProps)||void 0===g?void 0:g.showCampaignOffersDesign)&&l.getIsEditor()&&o.createElement(L,{vm:ee}),ce&&o.createElement("div",{className:[U.MiddlePhaseOverlay,ce?U.MiddlePhaseOverlayPopup:""].join(" ")}),ee.campaignOffers&&!!ee.campaignOffers.length&&ee.isCampaignOfferLoaded&&o.createElement("div",{className:[U.CampaignOfferMain,ce?U.OverlayPopupMain:""].join(" ")},o.createElement("div",{className:U.OfferSlider},ee.campaignOffers.map((function(e,t){var n;return o.createElement(B,{vm:ee,campaignOffer:e,index:t,activeIndex:me,offersLength:(null===(n=ee.campaignOffers)||void 0===n?void 0:n.length)||0,handlePrev:re,handleNext:ae,setActiveIndex:function(e){return ne(e)},step:ee.step,isPopupClosed:se,isPopupShow:ce,closePopup:function(){return ie(!1)},showPopup:function(){return ie(!0)}})}))),ee.campaignOffers.length>1&&o.createElement(H,{handlePrev:re,handleNext:ae}),ee.campaignOffers.length>1&&o.createElement(z,{isPopupShow:ce,vm:ee,activeIndex:me})),ee.isCouponCodeRequirementOpen&&o.createElement(W,{vm:ee}),o.createElement(X,{vm:ee}))),o.createElement("div",{className:U.Space})),o.createElement(Q,{vm:ee}))),o.createElement("div",{className:U.Right},o.createElement("div",{className:U.RightContent},o.createElement(h,{vm:ee}),!ee.isPoweredByHidden&&o.createElement("div",{className:U.PoweredBy},o.createElement("span",null,"powered by"),o.createElement("a",{href:"https://ikas.com"+("tr"===l.getCurrentLocale()?"/tr":""),target:"_blank"},o.createElement(D,null))))),!!ee.policyModalText&&o.createElement(k,{title:ee.policyModalTitle,modalContent:ee.policyModalText,onClose:function(){ee.policyModalText=""}}),ee.isContactModalVisible&&o.createElement(Z,{vm:ee,setVisible:ee.setContactModalVisible}),ee.mpVM.isOtpModalVisible&&o.createElement(C,{vm:ee,visible:ee.mpVM.isOtpModalVisible,type:ee.mpVM.otpModalType,onClose:ee.mpVM.hideOtpModal}),ee.mpVM.isResponseModalVisible&&o.createElement(j,{visible:ee.mpVM.isResponseModalVisible,text:ee.mpVM.mfsResponseModalText,onClose:ee.mpVM.onResponseModalClose}),ee.mpVM.isSuccessModalVisible&&o.createElement(P,{visible:ee.mpVM.isSuccessModalVisible,type:ee.mpVM.successModalType,onClose:ee.mpVM.onSuccessModalClose})))})),Y=n((function(e){var t,n,i,a,s=e.vm,c=d().t;return o.createElement("div",{className:U.Header},o.createElement(r,{href:"/",passHref:!0},o.createElement("a",null,(null===(t=s.customizationProps)||void 0===t?void 0:t.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{layout:"fill",image:s.customizationProps.logo,sizes:"360px"})):(null===(n=s.merchantSettings)||void 0===n?void 0:n.logo)?o.createElement("div",{className:U.Logo},o.createElement(N,{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:U.LoginText},o.createElement("span",{className:U.LoginCta},c("checkout-page:alreadyHaveAnAccount")),o.createElement(r,{href:"/account/login?redirect="+encodeURIComponent(s.checkoutUrl),passHref:!0},o.createElement("a",{className:U.LoginBtn},c("checkout-page:actions.login")))),s.checkout.hasCustomer&&o.createElement("div",{className:U.CustomerInfo},o.createElement("div",{className:U.Name},s.checkout.customerFullName),o.createElement("div",{className:U.Email},null===(a=s.checkout.customer)||void 0===a?void 0:a.email)))})),W=n((function(e){var t=e.vm,n=d().t,i=o.useState(!1),r=i[0],a=i[1],s=o.useState(null),c=s[0],l=s[1],m=o.useMemo((function(){switch(c){case f.COUPON_CODE_NOT_EXIST:return n("checkout-page:giftCodeErrorDescription");case f.COUPON_CODE_NOT_EXIST_FOR_GUESS:return n("checkout-page:mustBeSignInToApplyCampaign");default:return""}}),[c]);return o.createElement("div",{className:U.CouponContainer},r&&o.createElement("div",{className:U.NotificationContainer},o.createElement(M,{type:"warning",title:n("checkout-page:giftCodeErrorTitle"),content:m,onClose:function(){a(!1),l(null)},ignoreScroll:!0})),o.createElement("div",{style:{marginTop:r?12:0}},o.createElement(g,{vm:t,isOpenCouponCode:!0,isAddingCoupon:!0,setAddingCoupon:function(){},setCouponError:a,setCouponErrorCode:l})))})),X=n((function(e){var t=e.vm,n=d().t,i=o.useMemo((function(){switch(t.step){case c.INFO:return o.createElement(u,{vm:t});case c.SHIPPING:return o.createElement(p,{vm:t});case c.PAYMENT:return o.createElement(v,{vm:t});case c.SUCCESS:return o.createElement(x,{vm:t})}}),[t,t.step]),r=[new S(n("checkout-page:address"),t.step===c.INFO,t.step!==c.INFO,t.step!==c.INFO?o.createElement("div",{className:U.AdressStepInfo},o.createElement(q,{vm:t}),!t.isUpsellOrder&&o.createElement("div",{className:U.EditBtn,onClick:t.onBackToInfoClick},n("checkout-page:actions.edit"))):void 0,t.step!==c.INFO?o.createElement("div",{className:U.AddressStepInfoMobile},o.createElement(q,{vm:t})):void 0),new S(n("checkout-page:payment"),t.step===c.PAYMENT,!1)];return"address"!==t.deliveryMethod||t.isDigitalOnly||r.splice(1,0,new S(n("checkout-page:shipping"),t.step===c.SHIPPING,t.step===c.PAYMENT,t.step===c.PAYMENT?o.createElement("div",{className:U.AdressStepInfo},o.createElement(J,{vm:t}),!t.isUpsellOrder&&!t.isManualOrderWithShippingLines&&(t.checkout.availableShippingMethods&&t.checkout.availableShippingMethods.length>1||t.checkoutSettings.isGiftPackageEnabled)&&o.createElement("div",{className:U.EditBtn,onClick:t.onBackToShippingClick},n("checkout-page:actions.edit"))):void 0,t.step===c.PAYMENT?o.createElement("div",{className:U.AddressStepInfoMobile},o.createElement(J,{vm:t})):void 0)),o.createElement(b,{steps:r,stepContent:i})})),q=n((function(e){var t,n,i,r,a,s,c,l,m,u=e.vm,p=d().t,v=u.isDigitalOnly?((null===(t=u.checkout.billingAddress)||void 0===t?void 0:t.firstName)||"")+" "+((null===(n=u.checkout.billingAddress)||void 0===n?void 0:n.lastName)||""):((null===(i=u.checkout.shippingAddress)||void 0===i?void 0:i.firstName)||"")+" "+((null===(r=u.checkout.shippingAddress)||void 0===r?void 0:r.lastName)||"");return o.createElement("div",{className:U.Address},o.createElement("div",{className:[U.Text,U.WithMBottom].join(" ")},(null===(a=u.checkout.customer)||void 0===a?void 0:a.email)||""),"address"===u.deliveryMethod?o.createElement("div",{className:U.Text},v):o.createElement(o.Fragment,null,o.createElement("div",{className:U.Text},p("checkout-page:receiver")),o.createElement("div",{className:[U.Text,U.Gray].join(" ")},v)),o.createElement("div",{className:[U.Text,U.Gray].join(" ")},u.isDigitalOnly?null===(s=u.checkout.billingAddress)||void 0===s?void 0:s.phone:null===(c=u.checkout.shippingAddress)||void 0===c?void 0:c.phone),"in-store"===u.deliveryMethod&&o.createElement(o.Fragment,null,o.createElement("div",{className:[U.Text,U.WithMTop].join(" ")},p("checkout-page:pickUpLocation"))),o.createElement("div",{className:[U.Text,U.Gray].join(" ")},u.isDigitalOnly?null===(l=u.checkout.billingAddress)||void 0===l?void 0:l.addressText:null===(m=u.checkout.shippingAddress)||void 0===m?void 0:m.addressText))})),J=n((function(e){var t=e.vm,n=d().t;return o.createElement("div",{className:U.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:U.LightText}," / "+(0===t.checkout.shippingLines[0].price?n("checkout-page:free"):m(t.checkout.shippingLines[0].price,t.checkout.currencyCode,t.checkout.currencySymbol)))):n("checkout-page:standartShipping"))})),Q=n((function(e){var t=e.vm,n=d().t;return o.createElement("div",{className:U.Footer},o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:returnPolicy"),t.policyModalText=t.returnPolicy}},n("checkout-page:returnPolicy")),o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:privacyPolicy"),t.policyModalText=t.privacyPolicy}},n("checkout-page:privacyPolicy")),o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:termsOfService"),t.policyModalText=t.termsOfService}},n("checkout-page:termsOfService")),t.imprint&&o.createElement(o.Fragment,null,o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:imprint"),t.policyModalText=t.imprint}},n("checkout-page:imprint"))),t.shippingPolicy&&o.createElement(o.Fragment,null,o.createElement("div",{className:U.FooterBullet},"•"),o.createElement("div",{className:U.FooterItem,onClick:function(){t.policyModalTitle=n("checkout-page:shippingPolicy"),t.policyModalText=t.shippingPolicy}},n("checkout-page:shippingPolicy"))))})),Z=n((function(n){var i,r,a,s=n.vm,c=n.setVisible,l=d().t,m=o.useState(!1),u=m[0],p=m[1],v=o.useState(!1),f=v[0],g=v[1],h=o.useState(new y({message:{requiredRule:"",emailRule:"",minRule:""}}))[0];h.email=(null===(i=s.checkout.customer)||void 0===i?void 0:i.email)||"",h.firstName=(null===(r=s.checkout.customer)||void 0===r?void 0:r.firstName)||"",h.lastName=(null===(a=s.checkout.customer)||void 0===a?void 0:a.lastName)||"";var E=o.useCallback((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return f?[2,c(!1)]:(p(!0),[4,h.saveContactForm()]);case 1:return e.sent()&&g(!0),p(!1),[2]}}))}))}),[u]);return o.createElement(k,{title:l("checkout-page:contactForm"),modalContent:o.createElement("div",null,f&&o.createElement("div",{style:{marginBottom:"12px",maxWidth:"352px"}},o.createElement(M,{type:"success",title:l("checkout-page:contactFormSent"),content:l("checkout-page:contactFormDescription")})),o.createElement(T,{type:w.TEXT_AREA,label:"",value:h.message||"",onChange:h.onMessageChange,textAreaPlaceholder:l("checkout-page:contactFormCta")}),o.createElement(I,{style:{width:"100%",marginTop:"24px"},text:l(f?"checkout-page:actions.close":"checkout-page:actions.sendMessage"),isLoading:u,isDisabled:!h.message,onClick:E})),onClose:function(){return c(!1)}})}));export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCartCreatedBy as o,IkasCouponCodeRequirement as a,IkasPaymentMethodType as c,IkasPaymentGatewayType as d,IkasOrderShippingMethod as u,IkasOrderPaymentStatus as l,IkasTransactionStatus as h,IkasCartCampaignOfferStatus as p,IkasCampaignOfferTargetPageType as m,IkasOrderLineItemStatus as f,IkasCustomerEmailSubscriptionStatus as g,IkasCampaignOfferProductApplicablePriceEnum as v}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 y}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as S}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import{IkasCustomerAddress as k}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as b}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 P}from"../../models/data/merchant-settings/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import{IkasOrderCustomer as C}from"../../models/data/order/customer/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/filter/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import{IkasProductPrice as I}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as A}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as E}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/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 w}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 R from"./components/credit-card-form/model.js";import O from"../../store/customer/api.js";import N from"../../store/checkout/index.js";import j from"../../store/cart/api.js";import D,{MFS_ELEMENT_ID as T,MFS_SCRIPT_URL as L}from"./modelMasterPass.js";import x from"../../store/product/index.js";import{TransactionCardAssociationEnum as M,SaveCartInput as G,CheckStocksLineInput as _}from"@ikas/storefront-api";import{IkasBaseStore as U}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as V}from"@ikas/storefront-config";import{Analytics as F}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import B from"../../models/data/order/address/ikas-localized-order-address.js";import K from"../../store/location/index.js";import{getCookieValue as Z}from"../../utils/helper.js";var Y,H,q=/^\d+$/,W="undefined"==typeof localStorage,Q=function(){function q(o,b,P,q,Q,$,J,ee,te,ie){var se=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=Y.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(se,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return e.sent(),[4,U.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 3:return e.sent(),[2]}}))}))},this.initStep=function(){return e(se,void 0,void 0,(function(){var e,s,n,r,o,c,d;return t(this,(function(t){switch(t.label){case 0:if(V.getIsEditor())return this.step=Y.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===Y.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(Y.INFO)];if(this.step!==Y.PAYMENT||this.canProceedToPayment){if(this.step===Y.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(Y.INFO)];if(![Y.INFO,Y.SUCCESS,Y.SHIPPING,Y.PAYMENT].includes(this.step))return[2,this.changeStep(Y.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(Y.INFO)]:[2,this.changeStep(Y.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),n&&(this.error={type:H.PAYMENT_ERROR,data:r||null}),this.step!==Y.SHIPPING&&this.step!==Y.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new S(i(i({},this.checkoutSettings),{couponCodeRequirement:a.DEFAULT}))),this.step!==Y.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==Y.SHIPPING||1!==(null===(c=this.checkout.availableShippingMethods)||void 0===c?void 0:c.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=Y.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==Y.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==Y.SUCCESS||this.checkout.orderPaymentStatus!==l.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:H.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==Y.PAYMENT&&this.step!==Y.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length)return this.error={type:H.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===Y.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(Y.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return this.isCheckoutLoaded=!0,F.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,O.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(se,void 0,void 0,(function(){var e,i,s,n,r;return t(this,(function(t){switch(t.label){case 0:return e=new G(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!==Y.INFO&&this.step!==Y.SHIPPING||this.isDigitalOnly||(e.billingAddress=null),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===g.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,j.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:H.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(r=s.extensions)||void 0===r?void 0:r.code)?{type:H.CUSTOMER_ACCOUNT_DISABLED_ERROR}:{type:H.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(se,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(se,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,l,h,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===u.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(l=V.getStockLocationIds())||void 0===l?void 0:l.length)?V.getStockLocationIds():null,[4,N.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:H.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(h=i.data)||void 0===h?void 0:h.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:H.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(se,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(se,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,U.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getAvailableShippingCountries({salesChannelId:V.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return V.getPickupStockLocationIds()?[4,N.listStockLocation({id:{in:V.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:H.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return V.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,N.getAvailableStockLocations({lines:e.map((function(e){return new _(e)})),stockLocationIdList:V.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:H.API_ERROR},[2];this.availableStockLocations=i.data||[],t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=se.shippingCountryIds)||void 0===e?void 0:e.length)||(se.error={type:H.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;se.deliveryMethod!==e&&("address"===e&&(se.checkout.stockLocationId=null,(null===(t=se.customerAddresses)||void 0===t?void 0:t.length)?se.onSelectedShippingAddressIdChange(se.customerAddresses[0].id||"-1"):(se.checkout.shippingAddress=new B,se.checkout.shippingAddress.countrySettings=se.countrySettings,se.checkout.shippingAddress.checkoutSettings=se.checkoutSettings,se.checkout.shippingAddress.shippingZones=se.shippingZones)),se.deliveryMethod=e,se.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(se,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:H.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(se,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=V.getPaymentGateways().map((function(e){return e.id})),[4,N.listPaymentGateway({cartId:this.isUpsellOrder?this.checkout.id:void 0,id:e?void 0:{in:i},locale:V.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===Y.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(V.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===Y.PAYMENT&&(c=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=T,d.src=L,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:U.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:H.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return e(se,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,N.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var e;se.store.customerStore.customer?(null===(e=se.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=se.checkoutSettings,e.shippingZones=se.shippingZones})),se.checkout.customer=new C(se.store.customerStore.customer)):se.checkout.customer=new C(se.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){se.checkout.shippingAddress&&(se.checkout.shippingAddress.checkoutSettings=se.checkoutSettings,se.checkout.shippingAddress.shippingZones=se.shippingZones,se.checkout.shippingAddress.countrySettings=se.countrySettings,se.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){se.checkout.billingAddress&&(se.checkout.billingAddress.checkoutSettings=se.checkoutSettings,se.checkout.billingAddress.shippingZones=se.shippingZones,se.checkout.billingAddress.countrySettings=se.countrySettings,se.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!se.isDigitalOnly)if(se.isInStoreDelivery)se.setCheckoutShippingAddressSettings();else if(se.checkout.shippingAddress){if(se.store.customerStore.customer){var e=null==(t=se.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=se.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return se.onSelectedShippingAddressIdChange(e.id||"-1"),void se.setCheckoutShippingAddressSettings()}se.checkout.shippingAddress=new B(n(se.checkout.shippingAddress)||{}),se.setCheckoutShippingAddressSettings()}else if(se.store.customerStore.customer){var t=se.customerAddresses;se.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else se.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(se.useDifferentAddress=!!localStorage.getItem("sAddr"),se.checkout.billingAddress){if(se.store.customerStore.customer){var e=null==(t=se.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=se.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return se.onSelectedBillingAddressIdChange(e.id||"-1"),void se.setCheckoutBillingAddressSettings()}se.checkout.billingAddress=new B(n(se.checkout.billingAddress)||{}),se.setCheckoutBillingAddressSettings()}else if(se.store.customerStore.customer){var t=se.customerAddresses;se.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||se.useDifferentAddress||!se.checkout.shippingAddress||se.isInStoreDelivery||(se.checkout.billingAddress=new B(n(se.checkout.shippingAddress)),se.setCheckoutBillingAddressSettings())}else se.onSelectedBillingAddressIdChange("-1"),se.useDifferentAddress||!se.checkout.shippingAddress||se.isInStoreDelivery||(se.checkout.billingAddress=new B(n(se.checkout.shippingAddress)),se.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(se,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 y(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(se,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(se,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,j.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===Y.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,4];case 2:t.sent(),t.label=3;case 3:s&&(r=this.checkout,this.checkout=new y(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(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,K.getAvailableShippingZones({salesChannelId:V.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(se.selectedShippingAddressId=e,"-1"===e)se.checkout.shippingAddress=new B,se.checkout.shippingAddress.countrySettings=se.countrySettings;else{var i=null===(t=se.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(se.checkout.shippingAddress=new B(i),se.checkout.shippingAddress.countrySettings=se.countrySettings)}se.checkout.shippingAddress&&(se.checkout.shippingAddress.checkoutSettings=se.checkoutSettings,se.checkout.shippingAddress.shippingZones=se.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(se.selectedBillingAddressId=e,"-1"===e)se.checkout.billingAddress=new B,se.checkout.billingAddress.countrySettings=se.countrySettings;else{var i=null===(t=se.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(se.checkout.billingAddress=new B(i),se.checkout.billingAddress.countrySettings=se.countrySettings)}se.checkout.billingAddress&&(se.checkout.billingAddress.checkoutSettings=se.checkoutSettings,se.checkout.billingAddress.shippingZones=se.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){se.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(se.cardData&&(!(e.length>se.cardData.cardNumber.length)||X(e))){var i=(se.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!se.installmentInfo?se.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(se.cardData.installmentCount=1,se.installmentInfo=void 0),(null===(t=se.installmentInfo)||void 0===t?void 0:t.cardAssociation)===M.AMERICAN_EXPRESS?se.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(s).join(" "):se.cardData.cardNumber=z(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){se.cardData&&(se.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(se.cardData&&(!(e.length>se.cardData.expirationDate.length)||X(e))){if(0===(null===(t=se.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(se.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(se.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(se.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(se.cardData.expirationDate=z(d,2).join(" / "))}},this.onCvcChange=function(e){if(se.cardData&&(!(e.length>se.cardData.cvv.length)||X(e))){if(se.installmentInfo){if(se.installmentInfo.cardAssociation===M.AMERICAN_EXPRESS&&e.length>4)return;if(se.installmentInfo.cardAssociation!==M.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;se.cardData.cvv=e}},this.saveAddress=function(s){return e(se,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new k(i(i({},e),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){se.router.push("/cart")},this.onBackToShoppingClick=function(){se.router.push("/")},this.onGoToLoginClick=function(){se.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(se,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(),this.isManualOrderWithShippingLines?[2,this.changeStep(Y.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(Y.SHIPPING):this.changeStep(Y.PAYMENT),[3,7]);case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:H.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(se,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(Y.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:H.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(se,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(Y.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:H.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!se.canPerformPayment||(se.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){se.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:H.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(se,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:H.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(se,void 0,void 0,(function(){var e,i,s,n,r,o,a,u,l,p,m,f,g,v,y,S;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(u=this.mpVM.selectedCard)||void 0===u?void 0:u.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(l=this.cardData)||void 0===l?void 0:l.installmentCount)?[2]:[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(p=this.mpVM.selectedCard)||void 0===p?void 0:p.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===c.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===d.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[h.SUCCESS,h.AUTHORIZED].includes(r),a=r===h.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(S=null==s?void 0:s.data)||void 0===S?void 0:S.returnSlug))throw{data:s.firstErrorMessage,type:H.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(se,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.changeStep(Y.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){se.changeStep(Y.INFO)},this.onBackToShippingClick=function(){se.changeStep(Y.SHIPPING)},this.setCustomerConsentGranted=function(e){se.checkout.customer&&(se.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){se.useDifferentAddress=e,se.useDifferentAddress?(localStorage.setItem("sAddr","1"),se.checkout.billingAddress=se.checkout.billingAddress||new B,se.checkout.billingAddress.countrySettings=se.countrySettings):(localStorage.removeItem("sAddr"),se.checkout.billingAddress=new B(i({},se.checkout.shippingAddress)))},this.setShouldSaveAddress=function(e){se.shouldSaveAddress=e},this.setAddressTitle=function(e){se.addressTitle=e},this.reInitPaymentMethod=function(){return e(se,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,6];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return[2]}}))}))},this.createStripePaymentIntent=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:H.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:H.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?"STRIPE"!==(e=this.paymentGateways[i]).code||this.stripeResponse?[3,2]:[4,this.createStripePaymentIntent(e)]:[2];case 1:t.sent(),t.label=2;case 2:return"KLARNA"!==e.code||this.klarnaResponse?[3,4]:[4,this.createKlarnaClientToken(e)];case 3:t.sent(),t.label=4;case 4:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,6]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 5:t.sent(),t.label=6;case 6:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,8]:[4,this.getPayPalClientId(e)];case 7:t.sent(),t.label=8;case 8:return this.checkout.selectedPaymentGateway=e,this.step!==Y.SUCCESS&&(e.paymentMethodType===c.CREDIT_CARD&&e.type===d.INTERNAL&&(this.cardData=new R,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){se.cardData&&(se.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(se,void 0,void 0,(function(){return t(this,(function(e){return W||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(se,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){se.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(se,void 0,void 0,(function(){var r,o,a=this;return t(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===p.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,x.searchProducts({input:{productIdList:n,priceListId:V.getPriceListId(),salesChannelId:V.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){return e.discountAmount?new A(i(i({},t),{prices:t.prices.map((function(t){var s=t.finalPrice,n=t.finalPrice-t.finalPrice*e.discountAmount/100;return e.applicablePrice===v.SELL_PRICE&&(s=t.sellPrice,n=t.sellPrice-t.sellPrice*e.discountAmount/100),new I(i(i({},t),{sellPrice:s,discountPrice:n}))}))})):t}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new E(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===Y.SUCCESS?m.POST_CHECKOUT:m.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(se,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,j.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===Y.SUCCESS?Y.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(se,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,O.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==f.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,N.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(se,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,N.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=o,this.checkoutSettings=b,this.router=P,this.returnPolicy=q,this.privacyPolicy=Q,this.termsOfService=$,this.imprint=J,this.shippingPolicy=ee,this.t=te,this.customizationProps=ie,this.mpVM=new D,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new w({currentLocale:V.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(q.prototype,"merchantSettings",{get:function(){return new P(V.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.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(q.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=U.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"finalPrice",{get:function(){return this.step===Y.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===H.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(q.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.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==H.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===o.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"store",{get:function(){return U.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===a.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(q.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)===c.CREDIT_CARD&&i.type===d.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(q.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===u.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=V.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(e){var t=new b(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===o.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===o.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isEPayKolayEnabled",{get:function(){var e=V.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isPoweredByHidden",{get:function(){var e=V.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),q.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},q}();function z(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function X(e){return e&&q.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(Y||(Y={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR"}(H||(H={}));export{Y as CheckoutStep,H as ErrorType,Q as default};
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as i}from'./../../ext/tslib/tslib.es6.js';import{makeAutoObservable as s}from"mobx";import n from"lodash/cloneDeep";import r from"lodash/sortBy";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import{IkasCustomerEmailSubscriptionStatus as o,IkasCartCreatedBy as a,IkasCouponCodeRequirement as c,IkasPaymentMethodType as d,IkasPaymentGatewayType as u,IkasOrderShippingMethod as l,IkasOrderPaymentStatus as h,IkasTransactionStatus as p,IkasCartCampaignOfferStatus as m,IkasCampaignOfferTargetPageType as f,IkasOrderLineItemStatus as g,IkasCampaignOfferProductApplicablePriceEnum as v}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 y}from"../../models/data/checkout/index.js";import{IkasCheckoutSettings as S}from"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import{IkasCustomerAddress as k}from"../../models/data/customer/address/index.js";import{IkasLocalizedCustomerAddress as b}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 C}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 P}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/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/option-set/index.js";import"../../models/data/product/stock-location/index.js";import{IkasProductPrice as I}from"../../models/data/product/variant/price/index.js";import{IkasProductVariant as A}from"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import{IkasProduct as E}from"../../models/data/product/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/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 w}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 R from"./components/credit-card-form/model.js";import O from"../../store/customer/api.js";import N from"../../store/checkout/index.js";import j from"../../store/cart/api.js";import D,{MFS_ELEMENT_ID as T,MFS_SCRIPT_URL as L}from"./modelMasterPass.js";import x from"../../store/product/index.js";import{TransactionCardAssociationEnum as M,SaveCartInput as G,CheckStocksLineInput as _}from"@ikas/storefront-api";import{IkasBaseStore as U}from"../../store/base.js";import"../../store/customer/index.js";import"../../store/cart/index.js";import{IkasStorefrontConfig as V}from"@ikas/storefront-config";import{Analytics as F}from"../../analytics/analytics.js";import"../../analytics/head/index.js";import B from"../../models/data/order/address/ikas-localized-order-address.js";import K from"../../store/location/index.js";import{getCookieValue as Z}from"../../utils/helper.js";var Y,H,q=/^\d+$/,W="undefined"==typeof localStorage,Q=function(){function q(a,b,C,q,Q,$,J,ee,te,ie){var se=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=Y.INFO,this.customizationProps=null,this.cardData=null,this.paymentGateways=[],this.productFiles=[],this.installmentInfo=null,this.useDifferentAddress=!1,this.shouldSaveAddress=!0,this.addressTitle="",this.shippingCountryIds=null,this.selectedShippingAddressId="-1",this.selectedBillingAddressId="-1",this.stockLocations=[],this.availableStockLocations=[],this.deliveryMethod="address",this.stripeResponse=null,this.stripeError=null,this.klarnaResponse=null,this.isKlarnaPaymentCompleted=!1,this.klarnaError=null,this.adyenResponse=null,this.payPalClientIdResponse=null,this.paypalOrderResponse=null,this.isCampaignOfferLoaded=!0,this.shippingZones=null,this.policyModalTitle="",this.policyModalText="",this.error=null,this.couponError=null,this.showTestModal=!1,this.init=function(){return e(se,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this.countrySettings.waitUntilInitialized()];case 1:return e.sent(),[4,U.getInstance().customerStore.waitUntilInitialized()];case 2:return e.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.initStep()];case 3:return e.sent(),[2]}}))}))},this.initStep=function(){return e(se,void 0,void 0,(function(){var e,s,n,r,o,a,d;return t(this,(function(t){switch(t.label){case 0:if(V.getIsEditor())return this.step=Y.INFO,this.isCheckoutLoaded=!0,[2];if(e=new URLSearchParams(window.location.search),s=e.get("step"),n=e.get("failed"),r=e.get("error"),s){if(this.step=s,this.step===Y.SHIPPING&&!this.canProceedToShipping)return[2,this.changeStep(Y.INFO)];if(this.step!==Y.PAYMENT||this.canProceedToPayment){if(this.step===Y.SUCCESS&&!this.canProceedToPayment)return[2,this.changeStep(Y.INFO)];if(![Y.INFO,Y.SUCCESS,Y.SHIPPING,Y.PAYMENT].includes(this.step))return[2,this.changeStep(Y.INFO)]}else{if(!this.isInStoreDelivery)return this.isValidShippingSettings?[2,this.changeStep(Y.INFO)]:[2,this.changeStep(Y.SHIPPING)];this.deliveryMethod="in-store"}}return[4,this.createCampaignOffer()];case 1:return t.sent(),n&&(this.error={type:H.PAYMENT_ERROR,data:r||null}),this.step!==Y.SHIPPING&&this.step!==Y.PAYMENT||this.isCouponCodeRequirementInvisible||(this.checkoutSettings=new S(i(i({},this.checkoutSettings),{couponCodeRequirement:c.DEFAULT}))),this.step!==Y.INFO?[3,7]:this.isDigitalOnly?[3,4]:[4,this.getAvailableShippingZones()];case 2:return t.sent(),this.createCustomer(),this.createShippingAddress(),this.createBillingAddress(),[4,this.getShippingCountries()];case 3:t.sent(),this.checkShippingCountries(),t.label=4;case 4:return[4,this.getStockLocations()];case 5:return t.sent(),[4,this.getAvailableStockLocations()];case 6:t.sent(),this.isInStoreDelivery&&(this.deliveryMethod="in-store"),t.label=7;case 7:return this.step!==Y.SHIPPING||1!==(null===(a=this.checkout.availableShippingMethods)||void 0===a?void 0:a.length)||this.checkoutSettings.isGiftPackageEnabled||(this.step=Y.PAYMENT,this.router.replace("/checkout?id=".concat(this.checkout.id,"&step=").concat(this.step),void 0,{shallow:!0})),this.step!==Y.SHIPPING||(null===(d=this.checkout.availableShippingMethods)||void 0===d?void 0:d.length)?this.step!==Y.SUCCESS||this.checkout.orderPaymentStatus!==h.PAID?[3,9]:[4,this.listProductFile()]:(this.error={type:H.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2]);case 8:t.sent(),t.label=9;case 9:return this.step!==Y.PAYMENT&&this.step!==Y.SUCCESS?[3,13]:[4,this.listPaymentGateways()];case 10:return t.sent(),this.isInStoreDelivery?(this.deliveryMethod="in-store",[4,this.getStockLocations()]):[3,12];case 11:t.sent(),t.label=12;case 12:if(!this.paymentGateways.length)return this.error={type:H.NO_SHIPPING_ERROR},this.isCheckoutLoaded=!0,[2];t.label=13;case 13:return this.step===Y.SUCCESS?[3,17]:this.checkout.isComplete?[2,this.changeStep(Y.SUCCESS)]:[3,14];case 14:return[4,this.initialStockCheck()];case 15:t.sent(),t.label=16;case 16:return[3,19];case 17:return[4,this.getSuccessTransaction()];case 18:t.sent(),this.successTransaction&&(o=this.successTransaction.paymentGatewayId,this.checkout.selectedPaymentGateway=this.paymentGateways.find((function(e){return e.id===o}))),t.label=19;case 19:return this.isCheckoutLoaded=!0,F.checkoutStep(this.checkout,this.step),[2]}}))}))},this.getSuccessTransaction=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,O.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(se,void 0,void 0,(function(){var e,i,s,n,r;return t(this,(function(t){switch(t.label){case 0:return e=new G(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!==Y.INFO&&this.step!==Y.SHIPPING||this.isDigitalOnly||(e.billingAddress=null),this.isDigitalOnly&&(e.shippingAddress=null),e.customer&&(this.store.customerStore.customer?e.customer.notificationsAccepted=this.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED:this.checkout.customer&&(e.customer.notificationsAccepted=this.checkout.customer.notificationsAccepted||!1)),[4,j.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:H.CUSTOMER_LOGIN_REQUIRED_ERROR}:"CUSTOMER_ACCOUNT_DISABLED"===(null===(r=s.extensions)||void 0===r?void 0:r.code)?{type:H.CUSTOMER_ACCOUNT_DISABLED_ERROR}:{type:H.API_ERROR,data:i.firstErrorMessage};return[2,i.data]}}))}))},this.inStockDeliveryInputData=function(i){return e(se,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(se,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,d,u,h,p;return t(this,(function(t){switch(t.label){case 0:return this.isManualOrder?[2]:(e=this.checkout.stockLocationId&&this.checkout.shippingMethod===l.CLICK_AND_COLLECT?[this.checkout.stockLocationId]:(null===(u=V.getStockLocationIds())||void 0===u?void 0:u.length)?V.getStockLocationIds():null,[4,N.checkCartStocks({cartId:this.checkout.id,stockLocationIdList:e})]);case 1:if(!(i=t.sent()).isSuccess)throw{type:H.API_ERROR,data:i.firstErrorMessage};if(null==(s=null===(p=null===(h=i.data)||void 0===h?void 0:h.lines)||void 0===p?void 0:p.filter((function(e){return!e.isAvailable})))?void 0:s.length){for(n=[],r=function(e){var t=o.checkout.items.find((function(t){return t.variant.id===e.variantId}));t&&n.push({item:t,stockCount:e.stockCount})},o=this,a=0,c=s;a<c.length;a++)d=c[a],r(d);throw{type:H.STOCK_ERROR,data:n}}return[2]}}))}))},this.setIsKlarnaPaymentCompleted=function(i){return e(se,void 0,void 0,(function(){return t(this,(function(e){return this.isKlarnaPaymentCompleted=i,[2]}))}))},this.removeUnavailableItems=function(i){return e(se,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:e=0,s=i,t.label=1;case 1:return e<s.length?(n=s[e],[4,U.getInstance().cartStore.changeItemQuantity(n.item,n.stockCount<0?0:n.stockCount)]):[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},this.getShippingCountries=function(){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getAvailableShippingCountries({salesChannelId:V.getSalesChannelId()})];case 1:return e=t.sent(),this.shippingCountryIds=e.data,[2]}}))}))},this.getStockLocations=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return V.getPickupStockLocationIds()?[4,N.listStockLocation({id:{in:V.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:H.API_ERROR,data:e.firstErrorMessage},[2];this.stockLocations=e.data,t.label=2;case 2:return[2]}}))}))},this.getAvailableStockLocations=function(){return e(se,void 0,void 0,(function(){var e,i,s=this;return t(this,(function(t){switch(t.label){case 0:return V.getPickupStockLocationIds()?(e=this.checkout.items.map((function(e){return{quantity:e.quantity,variantId:e.variant.id,productId:e.variant.productId}})),[4,N.getAvailableStockLocations({lines:e.map((function(e){return new _(e)})),stockLocationIdList:V.getPickupStockLocationIds()})]):[3,2];case 1:if(!(i=t.sent()).isSuccess)return this.error={type:H.API_ERROR},[2];this.availableStockLocations=(i.data||[]).filter((function(e){var t,i,n,r,o;return(null===(i=null===(t=e.address)||void 0===t?void 0:t.country)||void 0===i?void 0:i.id)&&e.address.country.iso2&&(null===(n=s.shippingCountryIds)||void 0===n?void 0:n.includes(e.address.country.id))&&(null===(o=null===(r=V.getCurrentRouting())||void 0===r?void 0:r.countryCodes)||void 0===o?void 0:o.includes(e.address.country.iso2))})),t.label=2;case 2:return[2]}}))}))},this.checkShippingCountries=function(){var e;(null===(e=se.shippingCountryIds)||void 0===e?void 0:e.length)||(se.error={type:H.NO_SHIPPING_ERROR})},this.onDeliveryMethodChange=function(e){var t;se.deliveryMethod!==e&&("address"===e&&(se.checkout.stockLocationId=null,(null===(t=se.customerAddresses)||void 0===t?void 0:t.length)?se.onSelectedShippingAddressIdChange(se.customerAddresses[0].id||"-1"):(se.checkout.shippingAddress=new B,se.checkout.shippingAddress.countrySettings=se.countrySettings,se.checkout.shippingAddress.checkoutSettings=se.checkoutSettings,se.checkout.shippingAddress.shippingZones=se.shippingZones)),se.deliveryMethod=e,se.isErrorsVisible=!1)},this.initialStockCheck=function(){return e(se,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:H.UNKNOWN}),[3,3];case 3:return[2]}}))}))},this.listPaymentGateways=function(){return e(se,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=V.getPaymentGateways().map((function(e){return e.id})),[4,N.listPaymentGateway({cartId:this.isUpsellOrder?this.checkout.id:void 0,id:e?void 0:{in:i},locale:V.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===Y.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(V.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===Y.PAYMENT&&(c=n.find((function(e){return!!e.masterPassClientId})))&&(this.checkout.masterPassPaymentGateway=c,(d=document.createElement("script")).id=T,d.src=L,d.onload=function(){h.mpVM.checkMasterPass({checkout:h.checkout,store:U.getInstance()})},document.head.appendChild(d)),[2]):(this.error={type:H.API_ERROR,data:s.firstErrorMessage},[2])}}))}))},this.retrieveInstallmentInfo=function(i){return e(se,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return[4,N.retrieveInstallmentInfo(i)];case 1:return e=t.sent(),s=e.data,null===(n=null==s?void 0:s.installmentPrices)||void 0===n||n.sort((function(e,t){return(e.installmentCount||-1)>(t.installmentCount||-1)?1:-1})),this.installmentInfo=s,[2]}}))}))},this.createCustomer=function(){var e;se.store.customerStore.customer?(null===(e=se.customerAddresses)||void 0===e||e.forEach((function(e){e.checkoutSettings=se.checkoutSettings,e.shippingZones=se.shippingZones})),se.checkout.customer=new P(i(i({},se.store.customerStore.customer),{notificationsAccepted:se.store.customerStore.customer.subscriptionStatus===o.SUBSCRIBED}))):se.checkout.customer=new P(se.checkout.customer||{})},this.setCheckoutShippingAddressSettings=function(){se.checkout.shippingAddress&&(se.checkout.shippingAddress.checkoutSettings=se.checkoutSettings,se.checkout.shippingAddress.shippingZones=se.shippingZones,se.checkout.shippingAddress.countrySettings=se.countrySettings,se.checkout.shippingAddress.getValidatedCustomerAddress())},this.setCheckoutBillingAddressSettings=function(){se.checkout.billingAddress&&(se.checkout.billingAddress.checkoutSettings=se.checkoutSettings,se.checkout.billingAddress.shippingZones=se.shippingZones,se.checkout.billingAddress.countrySettings=se.countrySettings,se.checkout.billingAddress.getValidatedCustomerAddress())},this.createShippingAddress=function(){if(!se.isDigitalOnly)if(se.isInStoreDelivery)se.setCheckoutShippingAddressSettings();else if(se.checkout.shippingAddress){if(se.store.customerStore.customer){var e=null==(t=se.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=se.checkout.shippingAddress)||void 0===t?void 0:t.id)}));if(e)return se.onSelectedShippingAddressIdChange(e.id||"-1"),void se.setCheckoutShippingAddressSettings()}se.checkout.shippingAddress=new B(n(se.checkout.shippingAddress)||{}),se.setCheckoutShippingAddressSettings()}else if(se.store.customerStore.customer){var t=se.customerAddresses;se.onSelectedShippingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1")}else se.onSelectedShippingAddressIdChange("-1")},this.createBillingAddress=function(){if("undefined"!=typeof localStorage)if(se.useDifferentAddress=!!localStorage.getItem("sAddr"),se.checkout.billingAddress){if(se.store.customerStore.customer){var e=null==(t=se.customerAddresses)?void 0:t.find((function(e){var t;return e.id===(null===(t=se.checkout.billingAddress)||void 0===t?void 0:t.id)}));if(e)return se.onSelectedBillingAddressIdChange(e.id||"-1"),void se.setCheckoutBillingAddressSettings()}se.checkout.billingAddress=new B(n(se.checkout.billingAddress)||{}),se.setCheckoutBillingAddressSettings()}else if(se.store.customerStore.customer){var t=se.customerAddresses;se.onSelectedBillingAddressIdChange((null==t?void 0:t.length)?t[0].id:"-1"),(null==t?void 0:t.length)||se.useDifferentAddress||!se.checkout.shippingAddress||se.isInStoreDelivery||(se.checkout.billingAddress=new B(n(se.checkout.shippingAddress)),se.setCheckoutBillingAddressSettings())}else se.onSelectedBillingAddressIdChange("-1"),se.useDifferentAddress||!se.checkout.shippingAddress||se.isInStoreDelivery||(se.checkout.billingAddress=new B(n(se.checkout.shippingAddress)),se.setCheckoutBillingAddressSettings())},this.onShippingMethodChange=function(i){return e(se,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 y(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(se,void 0,void 0,(function(){return t(this,(function(e){return this.checkout.stockLocationId=i.id,[2]}))}))},this.onCouponCodeApply=function(){return e(se,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,j.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===Y.PAYMENT&&(null==n?void 0:n.length)&&n.length>=6&&this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:n.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}}),this.mpVM.selectedCard&&this.mpVM.selectedCard.Value1?[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:this.mpVM.selectedCard.Value1.slice(0,6),paymentGatewayId:this.mpVM.selectedCard.paymentGatewayId,price:s.totalFinalPrice,currencyCode:this.checkout.currencyCode}})]:[3,3]):[3,4];case 2:t.sent(),t.label=3;case 3:s&&(r=this.checkout,this.checkout=new y(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(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,K.getAvailableShippingZones({salesChannelId:V.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(se.selectedShippingAddressId=e,"-1"===e)se.checkout.shippingAddress=new B,se.checkout.shippingAddress.countrySettings=se.countrySettings;else{var i=null===(t=se.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(se.checkout.shippingAddress=new B(i),se.checkout.shippingAddress.countrySettings=se.countrySettings)}se.checkout.shippingAddress&&(se.checkout.shippingAddress.checkoutSettings=se.checkoutSettings,se.checkout.shippingAddress.shippingZones=se.shippingZones)},this.onSelectedBillingAddressIdChange=function(e){var t;if(se.selectedBillingAddressId=e,"-1"===e)se.checkout.billingAddress=new B,se.checkout.billingAddress.countrySettings=se.countrySettings;else{var i=null===(t=se.customerAddresses)||void 0===t?void 0:t.find((function(t){return t.id===e}));i&&(se.checkout.billingAddress=new B(i),se.checkout.billingAddress.countrySettings=se.countrySettings)}se.checkout.billingAddress&&(se.checkout.billingAddress.checkoutSettings=se.checkoutSettings,se.checkout.billingAddress.shippingZones=se.shippingZones)},this.onTermsAndConditionsCheckedChange=function(e){se.isTermsAndConditionsChecked=e},this.onCardNumberChange=function(e){var t;if(se.cardData&&(!(e.length>se.cardData.cardNumber.length)||X(e))){var i=(se.cardData.cardNumber||"").split(" ").join(""),s=e.split(" ").join("");s.length>16||(i.length<6&&s.length>=6&&!se.installmentInfo?se.getRetrieveInstallmentInfo(s):s.length<6&&i.length>s.length&&(se.cardData.installmentCount=1,se.installmentInfo=void 0),(null===(t=se.installmentInfo)||void 0===t?void 0:t.cardAssociation)===M.AMERICAN_EXPRESS?se.cardData.cardNumber=function(e){var t=[],i=e.slice(0,4),s=e.slice(4,10),n=e.slice(10,15);i&&t.push(i);s&&t.push(s);n&&t.push(n);return t}(s).join(" "):se.cardData.cardNumber=z(s,4).join(" "))}},this.getRetrieveInstallmentInfo=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,this.retrieveInstallmentInfo({input:{orderId:this.checkout.id,binNumber:i.slice(0,6),paymentGatewayId:this.checkout.selectedPaymentGateway.id,price:this.checkout.totalFinalPrice,currencyCode:this.checkout.currencyCode}})];case 1:return t.sent(),(null===(e=this.cardData)||void 0===e?void 0:e.cardNumber)&&this.onCardNumberChange(this.cardData.cardNumber),[2]}}))}))},this.onCardHolderNameChange=function(e){se.cardData&&(se.cardData.cardHolderName=e)},this.onExpirationDateChange=function(e){var t;if(se.cardData&&(!(e.length>se.cardData.expirationDate.length)||X(e))){if(0===(null===(t=se.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(se.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(se.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(se.cardData.expirationDate="".concat(o<10?"0"+o:o," / ").concat(r<10?"0"+r:r))}}}var d=e.split(" / ").join("");d.length>4||(se.cardData.expirationDate=z(d,2).join(" / "))}},this.onCvcChange=function(e){if(se.cardData&&(!(e.length>se.cardData.cvv.length)||X(e))){if(se.installmentInfo){if(se.installmentInfo.cardAssociation===M.AMERICAN_EXPRESS&&e.length>4)return;if(se.installmentInfo.cardAssociation!==M.AMERICAN_EXPRESS&&e.length>3)return}else if(e.length>3)return;se.cardData.cvv=e}},this.saveAddress=function(s){return e(se,void 0,void 0,(function(){var e,r,o,a,c,d,u,l,h,p,m,f,g=this;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),this.shouldSaveAddress&&this.store.customerStore.customer?(e="shipping"===s?this.checkout.shippingAddress:this.checkout.billingAddress,(null===(h=this.customerAddresses)||void 0===h?void 0:h.find((function(t){return t.id===(null==e?void 0:e.id)})))?[2]:(r=null===(p=this.customerAddresses)||void 0===p?void 0:p.map((function(e){return e.id})),o=new k(i(i({},e),{title:this.addressTitle||this.t("checkout-page:newAddress")})),(a=n(this.store.customerStore.customer)).addresses||(a.addresses=[]),a.addresses.push(o),[4,this.store.customerStore.saveCustomer(a)])):[3,2];case 1:t.sent(),null===(m=this.customerAddresses)||void 0===m||m.forEach((function(e){e.checkoutSettings=g.checkoutSettings,e.shippingZones=g.shippingZones})),c=null===(f=this.customerAddresses)||void 0===f?void 0:f.map((function(e){return e.id})),d=null==c?void 0:c.filter((function(e){return!(null==r?void 0:r.includes(e))})),u=(null==d?void 0:d.length)?d[0]:void 0,"shipping"===s?(this.checkout.shippingAddress.id=u||"",this.selectedShippingAddressId=u||"-1"):(this.checkout.billingAddress.id=u||"",this.selectedBillingAddressId=u||"-1"),t.label=2;case 2:return[3,4];case 3:return l=t.sent(),console.error(l),[3,4];case 4:return[2]}}))}))},this.onGoToCartClick=function(){se.router.push("/cart")},this.onBackToShoppingClick=function(){se.router.push("/")},this.onGoToLoginClick=function(){se.router.push("/account/login")},this.onProceedToShippingClick=function(){return e(se,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(),this.isManualOrderWithShippingLines?[2,this.changeStep(Y.PAYMENT)]:("address"===this.deliveryMethod?this.changeStep(Y.SHIPPING):this.changeStep(Y.PAYMENT),[3,7]);case 6:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:H.UNKNOWN}),this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.onProceedToDigitalOnlyPaymentClick=function(){return e(se,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(Y.PAYMENT),[3,5];case 4:return(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:H.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.onProceedToPaymentClick=function(){return e(se,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(Y.PAYMENT),[3,5];case 4:return void 0!==typeof(e=t.sent()).type?this.error=e:(console.log(e),this.error={type:H.UNKNOWN}),this.isStepLoading=!1,[3,5];case 5:return[2]}}))}))},this.checkPaypalButtonAvailable=function(){return!!se.canPerformPayment||(se.isErrorsVisible=!0,!1)},this.handlePaymentError=function(e,t){se.error={type:e,data:t}},this.onCompletePaymentClick=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return this.canPerformPayment?(this.useDifferentAddress||(this.checkout.billingAddress=this.checkout.shippingAddress),this.isFree||!this.isKlarna?[3,2]:[4,this.saveCart()]):(this.isErrorsVisible=!0,[2]);case 1:return t.sent(),this.setIsKlarnaPaymentCompleted(!0),[2];case 2:return t.trys.push([2,8,,9]),this.isErrorsVisible=!1,this.isStepLoading=!0,[4,this.checkStocks()];case 3:return t.sent(),"address"===this.deliveryMethod&&this.useDifferentAddress?[4,this.saveAddress("billing")]:[3,5];case 4:t.sent(),t.label=5;case 5:return[4,this.saveCart()];case 6:return t.sent(),!this.isFree&&this.isCustomFlowStripe?((e=document.querySelector("#stripe-form-btn"))&&e.click(),[2]):!this.isFree&&this.isAdyen?(this.adyenDropinElement.submit(),this.adyenDropinElement.isValid||(this.isStepLoading=!1),[2]):!this.isFree&&this.isPayPal?[2]:[4,this.createSaleTransaction()];case 7:return t.sent(),[3,9];case 8:return void 0!==typeof(i=t.sent()).type?this.error=i:this.error={type:H.UNKNOWN},this.isStepLoading=!1,[3,9];case 9:return[2]}}))}))},this.onCompleteDigitalOnlyPaymentClick=function(){return e(se,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:H.UNKNOWN},this.isStepLoading=!1,[3,7];case 7:return[2]}}))}))},this.createSaleTransaction=function(){return e(se,void 0,void 0,(function(){var e,i,s,n,r,o,a,c,l,h,m,f,g,v,y,S;return t(this,(function(t){switch(t.label){case 0:return i=this.mpVM.selectedCard,!this.isFree&&i&&(null===(c=this.mpVM.selectedCard)||void 0===c?void 0:c.Name)?((n=this.mpVM.phoneNumber({store:this.store,checkout:this.checkout}))&&(e=n),void 0===(null===(l=this.cardData)||void 0===l?void 0:l.installmentCount)?[2]:[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:{phoneNumber:e,savedCardName:null===(h=this.mpVM.selectedCard)||void 0===h?void 0:h.Name},paymentGatewayId:null===(m=this.mpVM.selectedCard)||void 0===m?void 0:m.paymentGatewayId,paymentMethodDetail:{cardNumber:this.mpVM.selectedCard.Value1,cardHolderName:this.mpVM.selectedCard.Name,cvv:this.mpVM.selectedCard.Value2,expiredMonth:11,expiredYear:11,installmentCount:this.cardData.installmentCount,threeDSecure:!!(null===(f=this.cardData)||void 0===f?void 0:f.threeDSecure)},metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]):[3,2];case 1:return s=t.sent(),[3,4];case 2:return this.checkout.selectedPaymentGateway?[4,N.createSaleTransactionWithCart({input:{cartId:this.checkout.id,masterPassDetail:this.isFree?void 0:i&&e?{phoneNumber:e,savedCardName:null===(g=this.mpVM.selectedCard)||void 0===g?void 0:g.Name}:void 0,paymentGatewayId:this.checkout.selectedPaymentGateway.id,paymentMethodDetail:this.isFree||i?void 0:this.checkout.selectedPaymentGateway.paymentMethodType===d.CREDIT_CARD&&this.checkout.selectedPaymentGateway.type===u.INTERNAL&&this.cardData?this.cardData.toInput():void 0,metadata:{_fbp:Z("_fbp"),_fbc:Z("_fbc")}}})]:[2];case 3:s=t.sent(),t.label=4;case 4:return r=null===(v=null==s?void 0:s.data)||void 0===v?void 0:v.transactionStatus,o=r&&[p.SUCCESS,p.AUTHORIZED].includes(r),a=r===p.PENDING,o?[4,this.getSuccessTransaction()]:[3,7];case 5:return t.sent(),[4,this.onCheckoutTransactionSuccess((null===(y=null==s?void 0:s.data)||void 0===y?void 0:y.orderId)||void 0)];case 6:return t.sent(),[3,8];case 7:if(!a||!(null===(S=null==s?void 0:s.data)||void 0===S?void 0:S.returnSlug))throw{data:s.firstErrorMessage,type:H.UNKNOWN};window.location.href=process.env.NEXT_PUBLIC_BASE_URL+s.data.returnSlug,t.label=8;case 8:return[2]}}))}))},this.onCheckoutTransactionSuccess=function(i){return e(se,void 0,void 0,(function(){var e,s;return t(this,(function(t){switch(t.label){case 0:return localStorage.removeItem("sAddr"),(null===(e=this.checkout.customer)||void 0===e?void 0:e.notificationsAccepted)?[4,this.store.customerStore.createEmailSubscription((null===(s=this.checkout.customer)||void 0===s?void 0:s.email)||"")]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.changeStep(Y.SUCCESS,i),[2]}}))}))},this.onBackToInfoClick=function(){se.changeStep(Y.INFO)},this.onBackToShippingClick=function(){se.changeStep(Y.SHIPPING)},this.setCustomerConsentGranted=function(e){se.checkout.customer&&(se.checkout.customer.notificationsAccepted=e)},this.setUseDifferentAddress=function(e){se.useDifferentAddress=e,se.useDifferentAddress?(localStorage.setItem("sAddr","1"),se.checkout.billingAddress=se.checkout.billingAddress||new B,se.checkout.billingAddress.countrySettings=se.countrySettings):(localStorage.removeItem("sAddr"),se.checkout.billingAddress=new B(i({},se.checkout.shippingAddress)))},this.setShouldSaveAddress=function(e){se.shouldSaveAddress=e},this.setAddressTitle=function(e){se.addressTitle=e},this.reInitPaymentMethod=function(){return e(se,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.checkout.selectedPaymentGateway?this.isCustomFlowStripe?[4,this.createStripePaymentIntent(this.checkout.selectedPaymentGateway)]:[3,2]:[3,6];case 1:e.sent(),e.label=2;case 2:return this.isKlarna&&window.location.reload(),this.isAdyen?[4,this.createAdyenBalancePlatformPaymentSession(this.checkout.selectedPaymentGateway)]:[3,4];case 3:e.sent(),e.label=4;case 4:return this.isPayPal?[4,this.getPayPalClientId(this.checkout.selectedPaymentGateway)]:[3,6];case 5:e.sent(),e.label=6;case 6:return[2]}}))}))},this.createStripePaymentIntent=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createStripePaymentIntent({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.stripeResponse=e.data,this.stripeError=null):this.stripeError={type:H.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createKlarnaClientToken=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createKlarnaClientToken({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data?(this.klarnaResponse=e.data,this.klarnaError=null):this.klarnaError={type:H.API_ERROR,data:e.firstErrorMessage},[2]}}))}))},this.createAdyenBalancePlatformPaymentSession=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.createAdyenBalancePlatformPaymentSession({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.adyenResponse=e.data),[2]}}))}))},this.getPayPalClientId=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,N.getPayPalClientId({input:{cartId:this.checkout.id,paymentGatewayId:i.id||""}})];case 1:return(e=t.sent()).isSuccess&&e.data&&(this.payPalClientIdResponse=e.data),[2]}}))}))},this.setPaymentGateway=function(i){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.paymentGateways.length?"STRIPE"!==(e=this.paymentGateways[i]).code||this.stripeResponse?[3,2]:[4,this.createStripePaymentIntent(e)]:[2];case 1:t.sent(),t.label=2;case 2:return"KLARNA"!==e.code||this.klarnaResponse?[3,4]:[4,this.createKlarnaClientToken(e)];case 3:t.sent(),t.label=4;case 4:return"ADYEN_PLATFORM"!==e.code||this.adyenResponse?[3,6]:[4,this.createAdyenBalancePlatformPaymentSession(e)];case 5:t.sent(),t.label=6;case 6:return"PAYPAL"!==e.code||this.payPalClientIdResponse?[3,8]:[4,this.getPayPalClientId(e)];case 7:t.sent(),t.label=8;case 8:return this.checkout.selectedPaymentGateway=e,this.step!==Y.SUCCESS&&(e.paymentMethodType===d.CREDIT_CARD&&e.type===u.INTERNAL&&(this.cardData=new R,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){se.cardData&&(se.cardData.installmentCount=e)},this.changeStep=function(i,s){return e(se,void 0,void 0,(function(){return t(this,(function(e){return W||window.location.replace("".concat(window.location.pathname,"?id=").concat(s||this.checkout.id,"&step=").concat(i)),[2]}))}))},this.logout=function(){return e(se,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){se.isContactModalVisible=e},this.getCampaignOffer=function(s,n){return e(se,void 0,void 0,(function(){var r,o,a=this;return t(this,(function(c){switch(c.label){case 0:return(null==n?void 0:n.length)?(r=n.filter((function(e){var t;return e.status===m.WAITING_FOR_ACTION&&(null===(t=e.campaignOffer)||void 0===t?void 0:t.targetPageTypes.some((function(e){return e===s})))})),o=r.map((function(s){return e(a,void 0,void 0,(function(){var e,n,r,o,a,c,d,u,l;return t(this,(function(t){switch(t.label){case 0:return(e=null===(d=s.campaignOffer)||void 0===d?void 0:d.offers.find((function(e){return e.id===s.campaignOfferProductId})))?(n=[e.productId],[4,x.searchProducts({input:{productIdList:n,priceListId:V.getPriceListId(),salesChannelId:V.getSalesChannelId()}})]):[2,Promise.reject()];case 1:return(r=t.sent()).isSuccess&&(null===(l=null===(u=r.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.length)?(o=r.data.data[0],(a=o.variants.filter((function(t){return t.hasStock&&!(e.excludedVariantIdList||[]).some((function(e){return e===t.id}))})).map((function(t){return e.discountAmount?new A(i(i({},t),{prices:t.prices.map((function(t){var s=t.finalPrice,n=t.finalPrice-t.finalPrice*e.discountAmount/100;return e.applicablePrice===v.SELL_PRICE&&(s=t.sellPrice,n=t.sellPrice-t.sellPrice*e.discountAmount/100),new I(i(i({},t),{sellPrice:s,discountPrice:n}))}))})):t}))).length?(c=a.find((function(e){return e.isActive})),[2,{product:new E(i(i({},o),{selectedVariantValues:(c||a[0]).variantValues,variants:a})),offer:e,campaignOffer:s}]):[2,Promise.reject()]):[2,Promise.reject()]}}))}))})),[4,Promise.allSettled(o)]):[2,[]];case 1:return[2,c.sent().filter((function(e){return"fulfilled"===e.status&&e.value})).map((function(e){return e.value}))]}}))}))},this.createCampaignOffer=function(){return e(se,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e=this,[4,this.getCampaignOffer(this.step===Y.SUCCESS?f.POST_CHECKOUT:f.CHECKOUT,this.checkout.campaignOffers)];case 1:return e.campaignOffers=t.sent(),[2]}}))}))},this.updateCartCampaignOffer=function(i){return e(se,void 0,void 0,(function(){var e,s,n;return t(this,(function(t){switch(t.label){case 0:return i.accepted?this.isCheckoutLoaded=!1:this.isCampaignOfferLoaded=!1,[4,j.updateCartCampaignOffer({input:i})];case 1:return(e=t.sent()).isSuccess?i.accepted?(this.changeStep(this.step===Y.SUCCESS?Y.PAYMENT:this.step,null===(s=e.data)||void 0===s?void 0:s.id),[3,4]):[3,2]:[3,4];case 2:return this.checkout.campaignOffers=(null===(n=e.data)||void 0===n?void 0:n.campaignOffers)||[],[4,this.createCampaignOffer()];case 3:t.sent(),this.isCampaignOfferLoaded=!0,t.label=4;case 4:return[2]}}))}))},this.registerCustomer=function(i){return e(se,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,O.register({orderId:this.checkout.id,firstName:s,lastName:n,email:r,password:i})]:[3,2]):[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},this.listProductFile=function(){return e(se,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return(e=this.checkout.orderLineItems.filter((function(e){return!!e.variant.fileId&&e.status!==g.REFUNDED})).map((function(e){return e.variant.fileId}))).length?[4,N.listProductFile({id:{in:e}})]:[3,2];case 1:(i=t.sent()).isSuccess&&(this.productFiles=i.data||[]),t.label=2;case 2:return[2]}}))}))},this.getDigitalProductFileDownloadUrl=function(i){return e(se,void 0,void 0,(function(){var e,s,n,r,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=this.checkout.orderLineItems.find((function(e){return e.variant.id===i.variantId})))?[4,N.getDigitalProductFileDownloadUrl({orderId:this.checkout.id,orderLineItemId:e.id})]:[3,2];case 1:s=t.sent(),(n=s.data)&&((r=document.createElement("a")).href=n,r.download=function(e){try{return decodeURIComponent(e.split("/")[e.split("/").length-1])}catch(e){return""}}(i.name),r.click(),r.remove()),t.label=2;case 2:return[3,4];case 3:return o=t.sent(),console.error(o),[3,4];case 4:return[2]}}))}))},this.checkout=a,this.checkoutSettings=b,this.router=C,this.returnPolicy=q,this.privacyPolicy=Q,this.termsOfService=$,this.imprint=J,this.shippingPolicy=ee,this.t=te,this.customizationProps=ie,this.mpVM=new D,this.isTermsAndConditionsChecked=this.checkoutSettings.isTermsAndConditionsDefaultChecked||!1,this.countrySettings=new w({currentLocale:V.getCurrentLocale()}),this.init(),s(this)}return Object.defineProperty(q.prototype,"merchantSettings",{get:function(){return new C(V.getMerchantSettings())},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.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(q.prototype,"checkoutUrl",{get:function(){return"/checkout?id=".concat(this.checkout.id,"&step=info")},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"customerAddressOptions",{get:function(){var e,t,i={label:this.t("checkout-page:newAddress"),value:"-1"},s=(null===(t=null===(e=U.getInstance().customerStore.customer)||void 0===e?void 0:e.addresses)||void 0===t?void 0:t.map((function(e){return{label:e.title+" - "+e.addressText,value:e.id}})))||[];return[i].concat(s)},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"installmentExtraPrice",{get:function(){if(this.installmentPrice&&this.checkout.totalFinalPrice)return this.installmentPrice-this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"finalPrice",{get:function(){return this.step===Y.SUCCESS?this.checkout.totalFinalPrice:this.installmentPrice||this.checkout.$totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"hasStockError",{get:function(){var e;return(null===(e=this.error)||void 0===e?void 0:e.type)===H.STOCK_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isPaymentGatewayHasMasterPass",{get:function(){return-1!==this.selectedPaymentGatewayIndex&&(!!this.paymentGateways.length&&!!this.paymentGateways[this.selectedPaymentGatewayIndex].masterPassClientId)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"hasQuickRegistration",{get:function(){return this.checkoutSettings.isQuickRegistrationEnabled&&this.checkout.customer&&this.checkout.customer.isGuestCheckout},enumerable:!1,configurable:!0}),Object.defineProperty(q.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.hasCustomer||this.checkout.hasValidCustomerEmail)&&(null===(i=this.error)||void 0===i?void 0:i.type)!==H.NO_SHIPPING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"canProceedToPayment",{get:function(){return this.canProceedToShipping&&this.isValidShippingSettings},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isValidShippingSettings",{get:function(){var e,t=this;return!!(this.isInStoreDelivery||this.isDigitalOnly||this.isManualOrderWithShippingLines)||this.checkout.shippingSettingsId&&this.checkout.shippingZoneRateId&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.some((function(e){return e.shippingSettingsId===t.checkout.shippingSettingsId&&e.shippingZoneRateId===t.checkout.shippingZoneRateId})))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isManualOrderWithShippingLines",{get:function(){var e,t;return this.checkout.createdBy===a.ADMIN&&(null===(e=this.checkout.shippingLines)||void 0===e?void 0:e.length)&&!(null===(t=this.checkout.availableShippingMethods)||void 0===t?void 0:t.length)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isInStoreDelivery",{get:function(){return!!this.checkout.stockLocationId},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"klarnaPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"KLARNA"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"adyenPaymentGateway",{get:function(){var e=this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}));if(-1!==e)return this.paymentGateways[e]},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"adyenPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"ADYEN_PLATFORM"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.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(q.prototype,"payPalPaymentGatewayIndex",{get:function(){return this.paymentGateways.findIndex((function(e){return"PAYPAL"===e.code}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCustomFlowStripe",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"STRIPE"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isKlarna",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"KLARNA"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isAdyen",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"ADYEN_PLATFORM"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isPayPal",{get:function(){var e=this.checkout.selectedPaymentGateway;return e&&"PAYPAL"===e.code},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isFree",{get:function(){return 0===this.checkout.totalFinalPrice},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"store",{get:function(){return U.getInstance()},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeRequirementDefult",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.DEFAULT||null===this.checkoutSettings.couponCodeRequirement},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeRequirementOpen",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeRequirementInvisible",{get:function(){return this.checkoutSettings.couponCodeRequirement===c.INVISIBLE},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isCouponCodeVisible",{get:function(){return this.isCouponCodeRequirementDefult&&!this.isCouponCodeRequirementInvisible},enumerable:!1,configurable:!0}),Object.defineProperty(q.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)===d.CREDIT_CARD&&i.type===u.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(q.prototype,"isDigitalOnly",{get:function(){return this.checkout.shippingMethod===l.DIGITAL_DELIVERY},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"customerAddresses",{get:function(){var e,t,s,n=this,r=null===(e=V.getCurrentRouting())||void 0===e?void 0:e.countryCodes;return null===(s=null===(t=this.store.customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===s?void 0:s.filter((function(e){var t;return!(null==r?void 0:r.length)||(null===(t=e.country)||void 0===t?void 0:t.iso2)&&r.includes(e.country.iso2)})).map((function(e){var t=new b(i({countrySettings:n.countrySettings},e));return t.checkoutSettings=n.checkoutSettings,t.shippingZones=n.shippingZones,t.getValidatedCustomerAddress(),t}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isManualOrder",{get:function(){return this.checkout.createdBy===a.ADMIN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isUpsellOrder",{get:function(){return this.checkout.createdBy===a.UPSELL},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isEPayKolayEnabled",{get:function(){var e=V.getCustom();return!!e&&!!e.isEPayKolayEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isPoweredByHidden",{get:function(){var e=V.getCustom();return!!e&&!!e.hidePoweredBy},enumerable:!1,configurable:!0}),q.prototype.setAdyenDropinElement=function(e){this.adyenDropinElement=e},q}();function z(e,t){return e.match(new RegExp(".{1,"+t+"}","g"))||[]}function X(e){return e&&q.test(e.charAt(e.length-1))}!function(e){e.INFO="info",e.SHIPPING="shipping",e.PAYMENT="payment",e.SUCCESS="success"}(Y||(Y={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.API_ERROR=1]="API_ERROR",e[e.STOCK_ERROR=2]="STOCK_ERROR",e[e.PAYMENT_ERROR=3]="PAYMENT_ERROR",e[e.NO_SHIPPING_ERROR=4]="NO_SHIPPING_ERROR",e[e.CUSTOMER_LOGIN_REQUIRED_ERROR=5]="CUSTOMER_LOGIN_REQUIRED_ERROR",e[e.CUSTOMER_ACCOUNT_DISABLED_ERROR=6]="CUSTOMER_ACCOUNT_DISABLED_ERROR"}(H||(H={}));export{Y as CheckoutStep,H as ErrorType,Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/component/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as d}from"./installments/index.js";import i from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import y from"next/dynamic";import u from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as v}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import E from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import g from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=y((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),C=y((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),h=t((function(t){var y=t.vm,h=c().t,k=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},G=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){return"STRIPE"===e.code},M=function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(C,{vm:y}),y.klarnaError&&e.createElement("div",{className:l.ErrorMessage},y.klarnaError.data)))):null},b=function(){var t=y.selectedPaymentGatewayIndex===y.adyenPaymentGatewayIndex;return y.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(f.AdyenSelectBox),onClick:function(){y.setPaymentGateway(y.adyenPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent}),e.createElement("div",{className:"".concat(t?f.BottomContent:""," ")},e.createElement(w,{vm:y,isSelected:t})))):null},T=function(){var t,a=y.selectedPaymentGatewayIndex===y.payPalPaymentGatewayIndex;return y.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.payPalPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.payPalPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,o){var r,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),v=c("9"),f=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},p&&e.createElement(g,null),x&&e.createElement(E,null),v&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===n.INTERNAL?y.installmentInfo&&e.createElement(d,{vm:y}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:f,rightContent:s,bottomContent:P,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new u,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice,currencyCode:y.checkout.currencyCode}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod&&!y.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&y.klarnaPaymentGateway)return M();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&y.adyenPaymentGateway)return b();if(function(e){return"PAYPAL"===e.code}(t)&&y.payPalPaymentGateway)return T();var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(e.Fragment,null,e.createElement(P,{vm:y,pg:t}),y.stripeError&&e.createElement("div",{className:l.ErrorMessage},y.stripeError.data)):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:y}),y.installmentInfo&&e.createElement(d,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(G,null,I(t.additionalPrices[0])):e.createElement(k,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==o&&(y.setPaymentGateway(o),y.mpVM.selectedCard=void 0)}})})))}));export{h as PaymentGateways};
|
|
1
|
+
import*as e from"react";import{observer as t}from"mobx-react-lite";import"../../../../../models/data/blog/category/index.js";import"../../../../../models/data/blog/content/index.js";import"../../../../../models/data/blog/meta-data/index.js";import"../../../../../models/data/blog/tag/index.js";import"../../../../../models/data/blog/index.js";import"../../../../../models/data/brand/index.js";import{IkasPaymentMethodType as a,IkasPaymentGatewayType as n,IkasPaymentGatewayTransactionFeeType as o,IkasPaymentGatewayAdditionalPriceType as r}from"@ikas/storefront-models";import"mobx";import"../../../../../models/data/campaign-offer/index.js";import"../../../../../models/data/cart/campaign-offer/index.js";import"../../../../../models/data/cart/index.js";import"../../../../../models/data/category/path-item/index.js";import"../../../../../models/data/category/index.js";import"../../../../../models/data/checkout/index.js";import"../../../../../models/data/checkout-settings/index.js";import"../../../../../models/data/city/index.js";import"../../../../../models/data/country/index.js";import"../../../../../models/data/customer/address/region/index.js";import"../../../../../models/data/customer/address/index.js";import"../../../../../models/data/customer/address/ikas-localized-customer-address.js";import"../../../../../models/data/customer/attribute/index.js";import"../../../../../models/data/customer/review/summary/index.js";import"../../../../../models/data/customer/review/index.js";import"../../../../../models/data/customer/index.js";import"../../../../../models/data/district/index.js";import"../../../../../models/data/favorite-product/index.js";import"../../../../../models/data/filter-category/index.js";import"../../../../../models/data/html-meta-data/index.js";import"../../../../../models/data/image/index.js";import"../../../../../models/data/order/address/region/index.js";import"../../../../../models/data/order/address/index.js";import"../../../../../models/data/order/line-item/option/value/index.js";import"../../../../../models/data/order/line-item/variant/value/index.js";import"../../../../../models/data/order/line-item/variant/index.js";import"../../../../../models/data/order/line-item/index.js";import"../../../../../models/data/order/package/index.js";import"../../../../../models/data/order/transaction/index.js";import"../../../../../models/data/order/index.js";import"../../../../../models/data/payment-gateway/index.js";import"../../../../../models/data/product/attribute-value/index.js";import"../../../../../models/data/product/filter/index.js";import"../../../../../models/data/product/campaign-offer/index.js";import"../../../../../models/data/product/option-set/option/index.js";import"../../../../../models/data/product/option-set/index.js";import"../../../../../models/data/product/stock-location/index.js";import"../../../../../models/data/product/variant/price/index.js";import"../../../../../models/data/product/variant/index.js";import"../../../../../models/data/variant-type/index.js";import"../../../../../models/data/product/index.js";import"../../../../../models/data/raffle/index.js";import"../../../../../models/data/shipping-zone/state/city/district/region/index.js";import"../../../../../models/data/state/index.js";import"../../../../../models/data/theme-json/index.js";import"../../../../../models/data/theme-json/component/index.js";import"../../../../../models/data/theme-json/custom-data/index.js";import"../../../../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import{CreditCardForm as m}from"../../../components/credit-card-form/index.js";import{Installments as d}from"./installments/index.js";import i from"../../../components/select-box/index.js";import l from"./style.module.scss.js";import"@ikas/storefront-config";import{formatCurrency as s}from"../../../../../utils/currency.js";import{useTranslation as c}from"../../../../../utils/i18n.js";import p from"../../../components/svg/external.js";import y from"next/dynamic";import u from"../../../components/credit-card-form/model.js";import x from"../../../components/master-pass/credit-card-form/index.js";import{Toggle as v}from"../../../components/toggle/index.js";import f from"../../../components/select-box/style.module.scss.js";import E from"../../../components/master-pass/payment-gateway/svg/master-card.js";import j from"../../../components/master-pass/payment-gateway/svg/troy.js";import g from"../../../components/master-pass/payment-gateway/svg/visa.js";var P=y((function(){return import("../../../components/stripe/index.js").then((function(e){return e.default}))})),w=y((function(){return import("../../../components/adyen/index.js").then((function(e){return e.Adyen}))})),C=y((function(){return import("../../../components/klarna/index.js").then((function(e){return e.Klarna}))})),h=t((function(t){var y=t.vm,h=c().t,k=function(t){return e.createElement("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",flexWrap:"wrap"}},t.children)},G=function(t){return e.createElement("div",{className:l.AdditionalPrice},t.children)},I=function(e){return 0===e.amount?"":"".concat(e.amountType===o.AMOUNT?s(e.amount,y.checkout.currencyCode,y.checkout.currencySymbol):" %"+e.amount).concat(e.type===r.DECREMENT?" "+h("checkout-page:paymentMethodDiscount"):" "+h("checkout-page:paymentMethodAdditionalPrice"))},N=function(e){return"STRIPE"===e.code},M=function(){var t,a=y.selectedPaymentGatewayIndex===y.klarnaPaymentGatewayIndex;return y.klarnaPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.klarnaPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.klarnaPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.klarnaPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.klarnaPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.klarnaPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.klarnaPaymentGateway.logoUrl}))))),e.createElement("div",{className:"".concat(a?f.BottomContent:""," ").concat(a?"":l.Hidden)},e.createElement(C,{vm:y}),y.klarnaError&&e.createElement("div",{className:l.ErrorMessage},y.klarnaError.data)))):null},b=function(){var t=y.selectedPaymentGatewayIndex===y.adyenPaymentGatewayIndex;return y.adyenPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(f.AdyenSelectBox),onClick:function(){y.setPaymentGateway(y.adyenPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent}),e.createElement("div",{className:"".concat(t?f.BottomContent:""," ")},e.createElement(w,{vm:y,isSelected:t})))):null},T=function(){var t,a=y.selectedPaymentGatewayIndex===y.payPalPaymentGatewayIndex;return y.payPalPaymentGateway?e.createElement("div",{className:f.SelectBoxContainer},e.createElement("div",{className:"".concat(f.SelectBox," ").concat(a?f.Selected:""),onClick:function(){y.setPaymentGateway(y.payPalPaymentGatewayIndex),y.mpVM.selectedCard=void 0}},e.createElement("div",{className:f.TopContent},e.createElement(v,{value:a,label:y.payPalPaymentGateway.name,removePadding:!0}),e.createElement("div",{className:f.RightContent},(null===(t=y.payPalPaymentGateway.additionalPrices)||void 0===t?void 0:t.length)?e.createElement(G,null,I(y.payPalPaymentGateway.additionalPrices[0])):e.createElement(k,null,!!y.payPalPaymentGateway.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:y.payPalPaymentGateway.logoUrl}))))))):null};return e.createElement(e.Fragment,null,!!y.mpVM.cards.length&&y.mpVM.cards.map((function(t,o){var r,m=y.paymentGateways.find((function(e){return e.id===t.paymentGatewayId})),s=e.createElement("button",{className:l.MasterPassSelectBoxDeleteButton,onClick:function(e){e.stopPropagation(),y.mpVM.deleteCard({store:y.store,checkout:y.checkout,card:t})}},h("checkout-page:masterPass.paymentGatewaySelectBox.delete")),c=function(e){return t.Value1.startsWith(e)},p=c("4"),x=c("5")||c("6"),v=c("9"),f=e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("span",{className:l.MasterPassSelectBoxLabelLogo},p&&e.createElement(g,null),x&&e.createElement(E,null),v&&e.createElement(j,null)),t.Name," ",t.Value1),P=(null==m?void 0:m.id)&&m.paymentMethodType===a.CREDIT_CARD&&m.type===n.INTERNAL?y.installmentInfo&&e.createElement(d,{vm:y}):void 0;return e.createElement(i,{key:o,isSelected:(null===(r=y.mpVM.selectedCard)||void 0===r?void 0:r.UniqueId)===t.UniqueId,label:f,rightContent:s,bottomContent:P,onClick:function(){var e;(null===(e=y.mpVM.selectedCard)||void 0===e?void 0:e.UniqueId)!==t.UniqueId&&(y.checkout.selectedPaymentGateway=null,y.cardData=new u,y.installmentInfo=void 0,y.mpVM.selectedCard=t,t.Value1&&t.paymentGatewayId&&y.checkout.totalFinalPrice&&y.retrieveInstallmentInfo({input:{orderId:y.checkout.id,binNumber:t.Value1.slice(0,6),paymentGatewayId:t.paymentGatewayId,price:y.checkout.totalFinalPrice,currencyCode:y.checkout.currencyCode}}))}})})),y.paymentGateways.filter((function(e){return"in-store"!==y.deliveryMethod&&!y.isDigitalOnly||e.paymentMethodType!==a.CASH_ON_DELIVERY&&e.paymentMethodType!==a.CREDIT_CARD_ON_DELIVERY})).map((function(t,o){var r;if(function(e){return"KLARNA"===e.code}(t)&&y.klarnaPaymentGateway)return M();if(function(e){return"ADYEN_PLATFORM"===e.code}(t)&&y.adyenPaymentGateway)return b();if(function(e){return"PAYPAL"===e.code}(t)&&y.payPalPaymentGateway)return T();var s=t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?e.createElement(e.Fragment,null,N(t)?e.createElement(e.Fragment,null,e.createElement(P,{vm:y,pg:t}),y.stripeError&&e.createElement("div",{className:l.ErrorMessage},y.stripeError.data)):e.createElement("div",null,e.createElement(m,{vm:y}),y.isPaymentGatewayHasMasterPass&&e.createElement(x,{vm:y}),y.installmentInfo&&e.createElement(d,{vm:y}))):t.description?e.createElement(e.Fragment,null,t.type===n.EXTERNAL&&e.createElement("div",{style:{height:"52px",display:"flex",justifyContent:"center",margin:"24px 0"}},e.createElement(p,null)),e.createElement("div",{dangerouslySetInnerHTML:{__html:t.description}})):void 0;return e.createElement(i,{key:t.id,label:t.paymentMethodType===a.CREDIT_CARD&&t.type===n.INTERNAL?N(t)?" ":h("checkout-page:creditCard"):t.name,isSelected:y.selectedPaymentGatewayIndex===o,rightContent:(null===(r=t.additionalPrices)||void 0===r?void 0:r.length)?e.createElement(G,null,I(t.additionalPrices[0])):e.createElement(k,null,!!t.logoUrl&&e.createElement("div",{className:l.PaymentLogoContainer},e.createElement("img",{src:t.logoUrl}))),bottomContent:s,onClick:function(){y.selectedPaymentGatewayIndex!==o&&(y.setPaymentGateway(o),y.mpVM.selectedCard=void 0)}})})))}));export{h as PaymentGateways};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.10",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"build": "rm -rf build && rollup -c"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@ikas/storefront-api": "^5.0.
|
|
21
|
-
"@ikas/storefront-config": "^5.0.
|
|
22
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
23
|
-
"@ikas/storefront-models": "^5.0.
|
|
24
|
-
"@ikas/storefront-providers": "^5.0.
|
|
20
|
+
"@ikas/storefront-api": "^5.0.10",
|
|
21
|
+
"@ikas/storefront-config": "^5.0.10",
|
|
22
|
+
"@ikas/storefront-model-functions": "^5.0.10",
|
|
23
|
+
"@ikas/storefront-models": "^5.0.10",
|
|
24
|
+
"@ikas/storefront-providers": "^5.0.10",
|
|
25
25
|
"@ikas/localized-address": "1.0.0-beta.3",
|
|
26
26
|
"@adyen/adyen-web": "^5.57.0",
|
|
27
27
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@ikas/localized-address": "1.0.0-beta.3",
|
|
58
|
-
"@ikas/storefront-api": "^5.0.
|
|
59
|
-
"@ikas/storefront-config": "^5.0.
|
|
60
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
61
|
-
"@ikas/storefront-models": "^5.0.
|
|
62
|
-
"@ikas/storefront-providers": "^5.0.
|
|
58
|
+
"@ikas/storefront-api": "^5.0.10",
|
|
59
|
+
"@ikas/storefront-config": "^5.0.10",
|
|
60
|
+
"@ikas/storefront-model-functions": "^5.0.10",
|
|
61
|
+
"@ikas/storefront-models": "^5.0.10",
|
|
62
|
+
"@ikas/storefront-providers": "^5.0.10",
|
|
63
63
|
"mobx": "^6.1.3",
|
|
64
64
|
"mobx-react-lite": "^3.1.5",
|
|
65
65
|
"next": "12.2.0",
|