2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
/*! elementor-pro - v3.21.0 - 30-04-2024 */
|
|
"use strict";(self.webpackChunkelementor_pro=self.webpackChunkelementor_pro||[]).push([[124],{915:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class Base extends elementorModules.frontend.handlers.Base{getDefaultSettings(){return{selectors:{stickyRightColumn:".e-sticky-right-column"},classes:{stickyRightColumnActive:"e-sticky-right-column--active"}}}getDefaultElements(){const e=this.getSettings("selectors");return{$stickyRightColumn:this.$element.find(e.stickyRightColumn)}}bindEvents(){elementorFrontend.elements.$document.on("select2:open",(e=>{this.addSelect2Wrapper(e)}))}addSelect2Wrapper(e){const t=jQuery(e.target).data("select2");t.$dropdown&&t.$dropdown.addClass("e-woo-select2-wrapper")}isStickyRightColumnActive(){const e=this.getSettings("classes");return this.elements.$stickyRightColumn.hasClass(e.stickyRightColumnActive)}activateStickyRightColumn(){const e=this.getElementSettings(),t=elementorFrontend.elements.$wpAdminBar,o=this.getSettings("classes");let n=e.sticky_right_column_offset||0;t.length&&"fixed"===t.css("position")&&(n+=t.height()),"yes"===this.getElementSettings("sticky_right_column")&&(this.elements.$stickyRightColumn.addClass(o.stickyRightColumnActive),this.elements.$stickyRightColumn.css("top",n+"px"))}deactivateStickyRightColumn(){if(!this.isStickyRightColumnActive())return;const e=this.getSettings("classes");this.elements.$stickyRightColumn.removeClass(e.stickyRightColumnActive)}toggleStickyRightColumn(){this.getElementSettings("sticky_right_column")?this.isStickyRightColumnActive()||this.activateStickyRightColumn():this.deactivateStickyRightColumn()}equalizeElementHeight(e){if(e.length){e.removeAttr("style");let t=0;e.each(((e,o)=>{t=Math.max(t,o.offsetHeight)})),0<t&&e.css({height:t+"px"})}}removePaddingBetweenPurchaseNote(e){e&&e.each(((e,t)=>{jQuery(t).prev().children("td").addClass("product-purchase-note-is-below")}))}updateWpReferers(){const e=this.getSettings("selectors"),t=this.$element.find(e.wpHttpRefererInputs),o=new URL(document.location);o.searchParams.set("elementorPageId",elementorFrontend.config.post.id),o.searchParams.set("elementorWidgetId",this.getID()),t.attr("value",o)}}t.default=Base},9035:(e,t,o)=>{var n=o(3203);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=n(o(915));class Checkout extends s.default{getDefaultSettings(){const e=super.getDefaultSettings(...arguments);return{selectors:{...e.selectors,container:".elementor-widget-woocommerce-checkout-page",loginForm:".e-woocommerce-login-anchor",loginSubmit:".e-woocommerce-form-login-submit",loginSection:".e-woocommerce-login-section",showCouponForm:".e-show-coupon-form",couponSection:".e-coupon-anchor",showLoginForm:".e-show-login",applyCoupon:".e-apply-coupon",checkoutForm:"form.woocommerce-checkout",couponBox:".e-coupon-box",address:"address",wpHttpRefererInputs:'[name="_wp_http_referer"]'},classes:e.classes,ajaxUrl:elementorProFrontend.config.ajaxurl}}getDefaultElements(){const e=this.getSettings("selectors");return{...super.getDefaultElements(...arguments),$container:this.$element.find(e.container),$loginForm:this.$element.find(e.loginForm),$showCouponForm:this.$element.find(e.showCouponForm),$couponSection:this.$element.find(e.couponSection),$showLoginForm:this.$element.find(e.showLoginForm),$applyCoupon:this.$element.find(e.applyCoupon),$loginSubmit:this.$element.find(e.loginSubmit),$couponBox:this.$element.find(e.couponBox),$checkoutForm:this.$element.find(e.checkoutForm),$loginSection:this.$element.find(e.loginSection),$address:this.$element.find(e.address)}}bindEvents(){super.bindEvents(...arguments),this.elements.$showCouponForm.on("click",(e=>{e.preventDefault(),this.elements.$couponSection.slideToggle()})),this.elements.$showLoginForm.on("click",(e=>{e.preventDefault(),this.elements.$loginForm.slideToggle()})),this.elements.$applyCoupon.on("click",(e=>{e.preventDefault(),this.applyCoupon()})),this.elements.$loginSubmit.on("click",(e=>{e.preventDefault(),this.loginUser()})),elementorFrontend.elements.$body.on("updated_checkout",(()=>{this.applyPurchaseButtonHoverAnimation(),this.updateWpReferers()}))}onInit(){super.onInit(...arguments),this.toggleStickyRightColumn(),this.updateWpReferers(),this.equalizeElementHeight(this.elements.$address),elementorFrontend.isEditMode()&&(this.elements.$loginForm.show(),this.elements.$couponSection.show(),this.applyPurchaseButtonHoverAnimation())}onElementChange(e){"sticky_right_column"===e&&this.toggleStickyRightColumn()}onDestroy(){super.onDestroy(...arguments),this.deactivateStickyRightColumn()}applyPurchaseButtonHoverAnimation(){const e=this.getElementSettings("purchase_button_hover_animation");e&&jQuery("#place_order").addClass("elementor-animation-"+e)}applyCoupon(){if(!wc_checkout_params)return;this.startProcessing(this.elements.$couponBox);const e={security:wc_checkout_params.apply_coupon_nonce,coupon_code:this.elements.$couponBox.find('input[name="coupon_code"]').val()};jQuery.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),context:this,data:e,success(t){jQuery(".woocommerce-error, .woocommerce-message").remove(),this.elements.$couponBox.removeClass("processing").unblock(),t&&(this.elements.$checkoutForm.before(t),this.elements.$couponSection.slideUp(),elementorFrontend.elements.$body.trigger("applied_coupon_in_checkout",[e.coupon_code]),elementorFrontend.elements.$body.trigger("update_checkout",{update_shipping_method:!1}))},dataType:"html"})}loginUser(){this.startProcessing(this.elements.$loginSection);const e={action:"elementor_woocommerce_checkout_login_user",username:this.elements.$loginSection.find('input[name="username"]').val(),password:this.elements.$loginSection.find('input[name="password"]').val(),nonce:this.elements.$loginSection.find('input[name="woocommerce-login-nonce"]').val(),remember:this.elements.$loginSection.find("input#rememberme").prop("checked")};jQuery.ajax({type:"POST",url:this.getSettings("ajaxUrl"),context:this,data:e,success(e){e=JSON.parse(e),this.elements.$loginSection.removeClass("processing").unblock();jQuery(".woocommerce-error, .woocommerce-message").remove(),e.logged_in?location.reload():(this.elements.$checkoutForm.before(e.message),elementorFrontend.elements.$body.trigger("checkout_error",[e.message]))}})}startProcessing(e){e.is(".processing")||e.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}}t.default=Checkout}}]); |