| 1 |
(()=>{"use strict";var o,e,t=function(o){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(o(".rtsb-shopify-checkout-form-and-summery").length<1)){var t=o("p.form-row input:not([type='checkbox']):not([type='radio']), p.form-row select, p.form-row textarea"),i=function(){t.each(function(){var e=o(this),t=e.closest("p.form-row");t.find("label").removeClass("screen-reader-text"),e.removeAttr("placeholder"),""===o.trim(e.val())?(t.addClass("shopify-input-empty"),t.removeClass("shopify-input-data-added")):(t.addClass("shopify-input-data-added"),t.removeClass("shopify-input-empty")),"hidden"===e.attr("type")&&e.closest("p.form-row").addClass("shopify-hidden-field woocommerce-validated")})};i(),o.selectWoo&&o("form.checkout").find("select").each(function(){var e=o(this),t=o.extend({placeholder:e.attr("data-placeholder")||e.attr("placeholder")||"",label:e.attr("data-label")||null,required:"true"===e.attr("aria-required")||null,width:"100%"},{});o(this).selectWoo(t)}),t.on("input change",function(){null==e||e.delete("section_data"),i()}),t.on("focus",function(){o(this).closest("p.form-row").addClass("shopify-input-data-added")}),t.on("blur",function(){""===o.trim(o(this).val())&&o(this).closest("p.form-row").removeClass("shopify-input-data-added")}),o(document.body).on("update_checkout",function(){setTimeout(function(){o(".rtsb-shopify-checkout-form-and-summery").css({opacity:1})},300);var t=".rtsb-shopify-order-summery, .rtsb-checkout-page-form";setTimeout(function(){o(t).addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var i=null==e?void 0:e.get("section_data");if(i)return o("body").find(".shopify-order-footer").html(i.order_calculate),o("body").find(".rtsb-shopify-shipping-method").html(i.shipping_method),void o(t).removeClass("processing").unblock();o.ajax({type:"POST",url:rtsbPublicParams.ajaxUrl,data:{action:"rtsb_shopify_checkout_section_update"},success:function(i){i.success&&(null==e||e.set("section_data",i.data),o("body").find(".shopify-order-footer").html(i.data.order_calculate),o("body").find(".rtsb-shopify-shipping-method").html(i.data.shipping_method)),o(t).removeClass("processing").unblock()},error:function(o){console.log(o),console.log("Error Checkout Changes.")}})},200)})}};o=jQuery,window.RTSB&&window.RTSB._initialized&&(null===(e=RTSB.modules.register("shopifyCheckout",function(){var e=(window.RTSB||{}).cache,i=null==e?void 0:e.create("shopifyCheckout");return{name:"shopifyCheckout",version:"1.0.0",init:function(){return t(o,i),i.set("initialized",!0),this},refresh:function(){t(o,i)},destroy:function(){i.clear("shopifyCheckout")}}}))||void 0===e||e.init())})(); |