1(function($){'use strict' 2$(document).on('click','#wpfunnels_next_step_controller',function(e){e.preventDefault() 3var ajaxurl=window.wpfnl_obj.ajaxurl 4var sPageURL='' 5var sURLVariables='' 6sPageURL=window.location.search.substring(1) 7sURLVariables=sPageURL.split('=') 8if(sURLVariables[0]=='elementor-preview'){console.log('elementor')}else{$(this).addClass('disabled show-loader') 9$(this).find('.wpfnl-loader').css('display','inline-block') 10$('.et_pb_button.wpfnl_next_step_button').addClass('show-loader') 11var products=$(this).attr('data-products') 12var button_type=$(this).attr('data-button-type') 13var url=$(this).attr('data-url') 14let that=this;if('url-path'===button_type||'another-funnel'===button_type){window.location.href=url}else{var step_id=window.wpfnl_obj.step_id 15jQuery.ajax({type:'POST',url:ajaxurl,data:{action:'wpfnl_next_button_ajax',step_id:step_id,url:window.location.href,products:products,},success:function(response){$(that).removeClass('disabled') 16$(that).removeClass('show-loader') 17$('#wpfnl-next-button-loader').hide() 18if(response=='error'){console.log(response)}else{console.log(response) 19window.location.href=response}},})}}}) 20jQuery(document).ready(function(){function carryDataToNextStep(){const cookieData=getCookie('wpfunnels_send_data_checkout'),checkoutData=cookieData?.after_optin_submit_send_for_checkout 21if(undefined!==checkoutData){if('yes'===checkoutData?.data_to_checkout){const fieldMappings={first_name:'#billing_first_name',last_name:'#billing_last_name',email:'#billing_email',phone:'#billing_phone',message:'.wpfnl-message',} 22Object.entries(checkoutData).forEach(([key,value])=>{const fieldSelector=fieldMappings[key] 23if(fieldSelector){const field=$(fieldSelector) 24if(field[0]){field.val(value)}}}) 25const optinData={first_name:'.wpfnl-first-name',last_name:'.wpfnl-last-name',email:'.wpfnl-email',phone:'.wpfnl-phone',message:'.wpfnl-message',} 26Object.entries(checkoutData).forEach(([key,value])=>{const optinDataSelector=optinData[key] 27if(optinDataSelector){const optinField=$(optinDataSelector) 28if(optinField[0]){optinField.val(value)}}})}}} 29carryDataToNextStep() 30function getCookie(name){var cookieArr=document.cookie.split(';') 31for(var i=0;i<cookieArr.length;i++){var cookiePair=cookieArr[i].split('=') 32if(name==cookiePair[0].trim()){return JSON.parse(decodeURIComponent(cookiePair[1]))}} 33return!1} 34$('.floating-label #customer_details .form-row .input-text, .floating-label form.woocommerce-form-login .form-row-first .input-text, .floating-label form.woocommerce-form-login .form-row-last .input-text',).each(function(){$(this).attr('placeholder','') 35if($(this).val().length>0){$(this).parents('.form-row').find('label').addClass('floated')}}) 36$(document).on('focus','.floating-label #customer_details .form-row .input-text, .floating-label form.woocommerce-form-login .form-row-first .input-text, .floating-label form.woocommerce-form-login .form-row-last .input-text',function(){$(this).parents('.form-row').find('label').addClass('floated')},) 37$(document).on('blur','.floating-label #customer_details .form-row .input-text, .floating-label form.woocommerce-form-login .form-row-first .input-text, .floating-label form.woocommerce-form-login .form-row-last .input-text',function(){if($(this).val().length==0){$(this).parents('.form-row').find('label').removeClass('floated')}},) 38$(document).on('click','.floating-label #customer_details .form-row label[for="billing_state"], .floating-label #customer_details .form-row label[for="shipping_state"]',function(){$(this).addClass('floated')},) 39if($('#billing_country').length&&$('#billing_country').val().length>0){$('#billing_country').parents('.form-row').find('label').addClass('floated')} 40if($('#billing_state').length&&$('#billing_state').val().length>0){$('#billing_state').parents('.form-row').find('label').addClass('floated')} 41if($('#shipping_country').length&&$('#shipping_country').val().length>0){$('#shipping_country').parents('.form-row').find('label').addClass('floated')} 42if($('#shipping_state').length&&$('#shipping_state').val().length>0){$('#shipping_state').parents('.form-row').find('label').addClass('floated')} 43$('.wpfnl-checkout input, .wpfnl-checkout select').on('change',function(){var fieldType=$(this).attr('type');var newValue;if(fieldType==='checkbox'){var dataStep=$(this).data('step');if(typeof dataStep==='undefined'){newValue=$(this).is(':checked')?$(this).val():'';$(this).val(newValue);$(this).attr('value',newValue)}}else if(fieldType==='radio'){newValue=$('input[name="'+$(this).attr('name')+'"]:checked').val();$(this).val(newValue);$(this).attr('value',newValue)}else{newValue=$(this).val();$(this).val(newValue);$(this).attr('value',newValue)}});var is_user_logged_in=window.wpfnl_obj.is_user_logged_in 44var is_login_reminder=window.wpfnl_obj.is_login_reminder 45var billingStepSelector='#wpfnl_customer_information, #wpfnl_checkout_billing' 46function scroll_to_top(){$('html, body').animate({scrollTop:$('.wpfnl-multistep, .wpfnl-checkout-form-wpfnl-multistep').offset().top-100,},800,)}
47function show_checkout_step(targetID){if('login'==targetID){$('.wpfnl-multistep .woocommerce-form-login-toggle').show() 48$('.wpfnl-multistep .woocommerce-form-coupon').fadeOut() 49$('.wpfnl-multistep #customer_details.col2-set').fadeOut() 50$('.wpfnl-multistep #wpfnl_checkout_billing').fadeOut() 51$('.wpfnl-multistep #wpfnl_checkout_shipping').fadeOut() 52$('.wpfnl-multistep #order_review').fadeOut() 53$('.wpfnl-multistep .woocommerce-form-coupon-toggle').fadeOut().removeClass('show-form') 54$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login-toggle').show() 55$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon').fadeOut() 56$('.wpfnl-checkout-form-wpfnl-multistep #customer_details.col2-set').fadeOut() 57$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_billing').fadeOut() 58$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_shipping').fadeOut() 59$('.wpfnl-checkout-form-wpfnl-multistep #order_review').fadeOut() 60$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon-toggle').fadeOut().removeClass('show-form')}else if('billing'==targetID){$('.wpfnl-multistep #customer_details.col2-set').fadeIn() 61$('.wpfnl-multistep #wpfnl_checkout_billing').fadeIn() 62$('.wpfnl-multistep .woocommerce-form-login').fadeOut() 63$('.wpfnl-multistep .woocommerce-form-login-toggle').fadeOut() 64$('.wpfnl-multistep .woocommerce-form-coupon-toggle').fadeOut().removeClass('show-form') 65$('.wpfnl-multistep .woocommerce-form-coupon').fadeOut() 66$('.wpfnl-multistep #wpfnl_checkout_shipping').fadeOut() 67$('.wpfnl-multistep.wpfnl-2-step #wpfnl_checkout_shipping').fadeIn() 68$('.wpfnl-multistep #order_review').fadeOut() 69$('.wpfnl-checkout-form-wpfnl-multistep #customer_details.col2-set').fadeIn() 70$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_billing').fadeIn() 71$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login').fadeOut() 72$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login-toggle').fadeOut() 73$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon-toggle').fadeOut().removeClass('show-form') 74$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon').fadeOut() 75$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_shipping').fadeOut() 76$('.wpfnl-checkout-form-wpfnl-multistep #order_review').fadeOut()}else if('shipping'==targetID){$('.wpfnl-multistep #customer_details.col2-set').fadeIn() 77$('.wpfnl-multistep #wpfnl_checkout_shipping').fadeIn() 78$('.wpfnl-multistep .woocommerce-form-login-toggle').fadeOut() 79$('.wpfnl-multistep .woocommerce-form-login').fadeOut() 80$('.wpfnl-multistep .woocommerce-form-coupon-toggle').fadeOut().removeClass('show-form') 81$('.wpfnl-multistep .woocommerce-form-coupon').fadeOut() 82$('.wpfnl-multistep #wpfnl_checkout_billing').fadeOut() 83$('.wpfnl-multistep #order_review').fadeOut() 84$('.wpfnl-checkout-form-wpfnl-multistep #customer_details.col2-set').fadeIn() 85$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_shipping').fadeIn() 86$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login-toggle').fadeOut() 87$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login').fadeOut() 88$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon-toggle').fadeOut().removeClass('show-form') 89$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon').fadeOut() 90$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_billing').fadeOut() 91$('.wpfnl-checkout-form-wpfnl-multistep #order_review').fadeOut()}else if('order-review'==targetID){$('.wpfnl-multistep #order_review').fadeIn() 92$('.wpfnl-multistep .woocommerce-form-coupon-toggle').fadeIn() 93$('.wpfnl-multistep .woocommerce-form-login-toggle').fadeOut() 94$('.wpfnl-multistep .woocommerce-form-login').fadeOut() 95$('.wpfnl-multistep .woocommerce-form-coupon').fadeOut() 96$('.wpfnl-multistep #customer_details.col2-set').fadeOut() 97$('.wpfnl-multistep #wpfnl_checkout_billing').fadeOut() 98$('.wpfnl-multistep #wpfnl_checkout_shipping').fadeOut() 99$('.wpfnl-checkout-form-wpfnl-multistep #order_review').fadeIn() 100$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon-toggle').fadeIn() 101$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login-toggle').fadeOut() 102$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-login').fadeOut() 103$('.wpfnl-checkout-form-wpfnl-multistep .woocommerce-form-coupon').fadeOut() 104$('.wpfnl-checkout-form-wpfnl-multistep #customer_details.col2-set').fadeOut() 105$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_billing').fadeOut() 106$('.wpfnl-checkout-form-wpfnl-multistep #wpfnl_checkout_shipping').fadeOut()}} 107var initialStep=$('.wpfnl-multistep-wizard > li.current > button').attr('data-target') 108if(initialStep){show_checkout_step(initialStep)} 109$(document).on('click','.wpfnl-multistep-wizard > li > button',function(){var targetID=$(this).attr('data-target') 110checkoutFieldValidation() 111var isValidate=!0 112if('billing'==targetID){$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 113$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 114$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 115$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 116$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 117$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide()}else if('shipping'==targetID){$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 118$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 119$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 120$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 121$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 122$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 123checkoutFieldValidation(billingStepSelector) 124$(billingStepSelector).find('.validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}}) 125if(isValidate==!1){return!1}}else if('order-review'==targetID){var is_enabled_dirrerent_address=$('input[name="ship_to_different_address"]').is(':checked',) 126$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).show() 127$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).show() 128$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).show() 129$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).show() 130if($(this).hasClass('two-step')){checkoutFieldValidation(billingStepSelector) 131$(billingStepSelector).find('.validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}})} 132if(is_enabled_dirrerent_address==!0){checkoutFieldValidation('#wpfnl_checkout_shipping') 133$('#wpfnl_checkout_shipping .validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}}) 134if(isValidate==!1){return!1}}
134else{checkoutFieldValidation('.woocommerce-additional-fields') 135$('.woocommerce-additional-fields .validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}}) 136if(isValidate==!1){return!1}}} 137$(this).parent('li').addClass('current') 138$(this).parent('li').prevAll().addClass('completed').removeClass('current') 139$(this).parent('li').nextAll().removeClass('completed current') 140show_checkout_step(targetID) 141if('login'==targetID){$('.wpfnl-multistep-navigation button.previous').attr('data-target','').prop('disabled',!0) 142var hasShippingStep=$('.wpfnl-multistep-wizard li.shipping').length>0&&$('.wpfnl-multistep-wizard li.shipping').is(':visible');$('.wpfnl-multistep-navigation button.next').attr('data-target',hasShippingStep?'shipping':'billing').prop('disabled',!1)}else if('shipping'==targetID){$('.wpfnl-multistep-navigation button.previous').attr('data-target','login').prop('disabled',is_user_logged_in||'yes'!==is_login_reminder) 143$('.wpfnl-multistep-navigation button.next').attr('data-target','billing').prop('disabled',!1)}else if('billing'==targetID){var hasShippingStep=$('.wpfnl-multistep-wizard li.shipping').length>0&&$('.wpfnl-multistep-wizard li.shipping').is(':visible');if(hasShippingStep){$('.wpfnl-multistep-navigation button.previous').attr('data-target','shipping').prop('disabled',!1)}else{$('.wpfnl-multistep-navigation button.previous').attr('data-target','login').prop('disabled',is_user_logged_in||'yes'!==is_login_reminder)} 144$('.wpfnl-multistep-navigation button.next').attr('data-target','order-review').prop('disabled',!1)}else if('order-review'==targetID){$('.wpfnl-multistep-navigation button.previous').attr('data-target','billing').prop('disabled',!1) 145$('.wpfnl-multistep-navigation button.next').attr('data-target','').prop('disabled',!0)}}) 146$('#get-qrcode').on('click',function(){var inputVal=$('#pix_emv').val();var tempInput=$("<input>");$("body").append(tempInput);tempInput.val(inputVal).select();document.execCommand("copy");tempInput.remove();var message=$('<div class="copied-message">Copied</div>');$("body").append(message);var buttonOffset=$(this).offset();var messageTop=buttonOffset.top-message.outerHeight()-10;var messageLeft=buttonOffset.left+($(this).outerWidth()-message.outerWidth())/2;message.css({top:messageTop,left:messageLeft});message.fadeIn();setTimeout(function(){message.fadeOut(function(){$(this).remove()})},2000)});$('.wpfnl-multistep-navigation button.next').on('click',function(){var targetID=$(this).attr('data-target') 147var isValidate=!0 148if('billing'==targetID){$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 149$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 150$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 151$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 152$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 153$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide()}else if('shipping'==targetID){$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 154$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 155$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 156$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 157$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 158$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 159checkoutFieldValidation(billingStepSelector) 160$(billingStepSelector).find('.validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}}) 161if(isValidate==!1){return!1}}else if('order-review'==targetID){var is_enabled_dirrerent_address=$('input[name="ship_to_different_address"]').is(':checked',) 162$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).show() 163$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).show() 164$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).show() 165$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).show() 166if($(this).hasClass('two-step')){checkoutFieldValidation(billingStepSelector) 167$(billingStepSelector).find('.validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}})} 168if(is_enabled_dirrerent_address==!0){checkoutFieldValidation('#wpfnl_checkout_shipping') 169$('#wpfnl_checkout_shipping .validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}}) 170if(isValidate==!1){return!1}}
170else{checkoutFieldValidation('.woocommerce-additional-fields') 171$('.woocommerce-additional-fields .validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')){isValidate=!1}}) 172if(isValidate==!1){return!1}}} 173scroll_to_top() 174$('.wpfnl-multistep-wizard > li.'+targetID).addClass('current') 175$('.wpfnl-multistep-wizard > li.'+targetID).prevAll().addClass('completed').removeClass('current') 176$('.wpfnl-multistep-wizard > li.'+targetID).nextAll().removeClass('completed current') 177show_checkout_step(targetID) 178if('billing'==targetID){var hasShippingStep=$('.wpfnl-multistep-wizard li.shipping').length>0&&$('.wpfnl-multistep-wizard li.shipping').is(':visible');if(hasShippingStep){$(this).siblings().attr('data-target','shipping').prop('disabled',!1)}else{$(this).siblings().attr('data-target','login').prop('disabled',is_user_logged_in||'yes'!==is_login_reminder)} 179$(this).attr('data-target','order-review')}else if('shipping'==targetID){$(this).siblings().attr('data-target','login').prop('disabled',is_user_logged_in||'yes'!==is_login_reminder) 180$(this).attr('data-target','billing')}else if('order-review'==targetID){$(this).siblings().attr('data-target','billing').prop('disabled',!1) 181$(this).prop('disabled',!0)}}) 182let maybeNeedAccount=!1 183$('#createaccount').on('change',function(){if($(this).is(':checked')){maybeNeedAccount=!0}else{maybeNeedAccount=!1}}) 184function ensureCheckoutValidationStyles(){if($('#wpfnl-checkout-validation-style').length){return} 185$('<style id="wpfnl-checkout-validation-style">'+'.wpfnl-checkout .form-row.wpfnl-js-invalid > label{color:#a00 !important;}'+'.wpfnl-checkout .form-row.wpfnl-js-invalid input.input-text,'+'.wpfnl-checkout .form-row.wpfnl-js-invalid input[type="email"],'+'.wpfnl-checkout .form-row.wpfnl-js-invalid input[type="tel"],'+'.wpfnl-checkout .form-row.wpfnl-js-invalid input[type="password"],'+'.wpfnl-checkout .form-row.wpfnl-js-invalid input[type="number"],'+'.wpfnl-checkout .form-row.wpfnl-js-invalid input[type="text"],'+'.wpfnl-checkout .form-row.wpfnl-js-invalid select,'+'.wpfnl-checkout .form-row.wpfnl-js-invalid textarea{border-color:#a00 !important;}'+'.wpfnl-checkout .form-row.wpfnl-js-invalid .select2-container--default .select2-selection--single,'+'.wpfnl-checkout .form-row.wpfnl-js-invalid .select2-container--default .select2-selection--multiple{border-color:#a00 !important;}'+'</style>').appendTo('head')} 186function updateCheckoutFieldState($field,isInvalid){var $row=$field.closest('.form-row') 187if(!$row.length){return} 188if(isInvalid){$row.removeClass('woocommerce-validated').addClass('required-field-appended woocommerce-invalid woocommerce-invalid-required-field wpfnl-js-invalid',)}else{$row.removeClass('required-field-appended woocommerce-invalid woocommerce-invalid-required-field wpfnl-js-invalid',)}} 189function checkoutFieldValidation(step){ensureCheckoutValidationStyles() 190let msgEnabled=window.wpfnl_obj&&window.wpfnl_obj.field_validation_enabled==='yes';let msgTemplate=(window.wpfnl_obj&&window.wpfnl_obj.field_validation_message)?window.wpfnl_obj.field_validation_message:'{field} is required';function appendFieldMessage($element,message){$element.parent().find('.field-required').remove() 191if(msgEnabled){$element.parent().append('<span class="field-required">'+message+'</span>')}} 192function getErrorMessage($element){if(!msgEnabled)return'Field required';let $label=$element.closest('.form-row').find('label').clone();$label.find('*').remove();let fieldName=$.trim($label.text()).replace(/\*+$/,'').trim();return msgTemplate.replace('{field}',fieldName)} 193$(step).find('.validate-required input').each(function(){var fieldValue=$(this).val() 194if(!fieldValue){var errorMsg=getErrorMessage($(this));if(!maybeNeedAccount){if('account_username'===$(this).attr('name')||'account_password'===$(this).attr('name')){appendFieldMessage($(this),'') 195updateCheckoutFieldState($(this),!1) 196return!0}else{appendFieldMessage($(this),errorMsg) 197updateCheckoutFieldState($(this),!0)}}else{appendFieldMessage($(this),errorMsg) 198updateCheckoutFieldState($(this),!0)}}else if(fieldValue){appendFieldMessage($(this),'') 199updateCheckoutFieldState($(this),!1)}}) 200$(step).find('.validate-required select').each(function(){var fieldValue=$(this).children('option:selected').val() 201if(!fieldValue){var errorMsg=getErrorMessage($(this));appendFieldMessage($(this),errorMsg) 202updateCheckoutFieldState($(this),!0)}else if(fieldValue){appendFieldMessage($(this),'') 203updateCheckoutFieldState($(this),!1)}}) 204$(step).find('.validate-required input[type="checkbox"]').each(function(){var fieldValue=$(this).is(':checked') 205if(!fieldValue){var errorMsg=getErrorMessage($(this));appendFieldMessage($(this),errorMsg) 206updateCheckoutFieldState($(this),!0)}else if(fieldValue){appendFieldMessage($(this),'') 207updateCheckoutFieldState($(this),!1)}})} 208$('form.checkout').on('checkout_place_order',function(){var isValidate=!0;checkoutFieldValidation('form.checkout');$('form.checkout .validate-required').each(function(){if($(this).hasClass('woocommerce-invalid-required-field')&&$(this).is(':visible')){isValidate=!1;$(this).removeClass('woocommerce-validated').addClass('woocommerce-invalid woocommerce-invalid-required-field')}});if(!isValidate){var $firstErrorField=$('.field-required:visible').first();var $firstInvalidRow=$('form.checkout .validate-required.woocommerce-invalid-required-field:visible').first();var scrollTarget=$firstErrorField.length?$firstErrorField.offset().top:$firstInvalidRow.offset().top;if(scrollTarget){$('html, body').animate({scrollTop:scrollTarget-100},800)} 209return!1}});$(document).on('input change focusout','form.checkout .validate-required input, form.checkout .validate-required select, form.checkout .validate-required textarea',function(e){ensureCheckoutValidationStyles();var msgEnabled=window.wpfnl_obj&&window.wpfnl_obj.field_validation_enabled==='yes';
209var isCheckable=$(this).is('[type="checkbox"], [type="radio"]');var val=isCheckable?$(this).is(':checked'):$.trim($(this).val());if(val){$(this).parent().find('.field-required').remove();updateCheckoutFieldState($(this),!1)}else if(e.type==='focusout'||(isCheckable&&e.type==='change')){if(!maybeNeedAccount&&('account_username'===$(this).attr('name')||'account_password'===$(this).attr('name'))){return} 210let msgTemplate=(window.wpfnl_obj&&window.wpfnl_obj.field_validation_message)||'{field} is required';let $label=$(this).parents('.form-row').find('label').clone();$label.find('*').remove();let fieldName=$.trim($label.text()).replace(/\*+$/,'').trim();let errorMsg=msgTemplate.replace('{field}',fieldName);$(this).parent().find('.field-required').remove();if(msgEnabled){$(this).parent().append('<span class="field-required">'+errorMsg+'</span>')} 211var $row=$(this).parents('.form-row');setTimeout(function(){updateCheckoutFieldState($row.find('input, select, textarea').first(),!0)},10)}});$('.wpfnl-multistep-navigation button.previous').on('click',function(){var targetID=$(this).attr('data-target') 212scroll_to_top() 213$('.wpfnl-multistep-wizard > li.'+targetID).addClass('current') 214$('.wpfnl-multistep-wizard > li.'+targetID).prevAll().addClass('completed').removeClass('current') 215$('.wpfnl-multistep-wizard > li.'+targetID).nextAll().removeClass('completed current') 216show_checkout_step(targetID) 217if('login'==targetID){var hasShippingStep=$('.wpfnl-multistep-wizard li.shipping').length>0&&$('.wpfnl-multistep-wizard li.shipping').is(':visible');$(this).attr('data-target','').prop('disabled',!0) 218$(this).siblings().attr('data-target',hasShippingStep?'shipping':'billing').prop('disabled',!1)}else if('shipping'==targetID){$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 219$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 220$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 221$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 222$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 223$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 224$(this).attr('data-target','billing') 225$(this).siblings().attr('data-target','order-review').prop('disabled',!1)}else if('billing'==targetID){$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 226$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 227$('.theme-woostify.checkout-layout-2 .wpfnl-checkout.wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 228$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content',).hide() 229$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-content[data-step="first"]',).show() 230$('.theme-woostify.checkout-layout-2 .wpfnl-checkout-form-wpfnl-multistep .multi-step-checkout-wrapper .multi-step-checkout-button-wrapper',).hide() 231var hasShippingStep=$('.wpfnl-multistep-wizard li.shipping').length>0&&$('.wpfnl-multistep-wizard li.shipping').is(':visible');if(hasShippingStep){$(this).attr('data-target','shipping').prop('disabled',!1)}else{if(is_user_logged_in){$(this).attr('data-target','login').prop('disabled',!0)}else{if('yes'===is_login_reminder){$(this).attr('data-target','login').prop('disabled',!1)}else{$(this).attr('data-target','login').prop('disabled',!0)}}} 232$(this).siblings().attr('data-target','order-review').prop('disabled',!1)}}) 233$(".wpfnl-learndash-pay form input[type='submit']").on('click',function(){var ajaxurl=window.wpfnl_obj.ajaxurl 234let step_id=$('.wpfnl-learndash-pay').data('id') 235jQuery.ajax({type:'POST',url:ajaxurl,data:{action:'wpfnl_set_learndash_session',step_i
235d:step_id,},success:function(response){console.log(response)},})}) 236var wpf_remove_spinner=function(response){if($('.wc_payment_methods').length){if(response.hasOwnProperty('wc_custom_fragments')){if(response.hasOwnProperty('fragments')){$.each(response.fragments,function(key,value){$(key).replaceWith(value)})} 237if(parseFloat(response.cart_total)<=0){$('body').trigger('update_checkout')}}}else{$('body').trigger('update_checkout')}} 238$(document).on('change','.wpfnl-update-variation',function(e){e.preventDefault() 239var ajaxurl=window.wpfnl_obj.ajaxurl 240let variations=[],i=0,thisProductID=$(this).data('product-id') 241$('.wpfnl-update-variation').each(function(){if(thisProductID==$(this).data('product-id')){variations[i]={attr:$(this).data('attr'),product_id:$(this).data('product-id'),variation_id:$(this).data('variation-id'),quantity:$(this).data('quantity'),value:$(this).val().trim(),} 242i++}}) 243$("input[name='_wpfunnels_variable_product']").val('selected') 244jQuery.ajax({type:'POST',url:ajaxurl,data:{action:'wpfnl_update_variation',variations:variations,},success:function(response){$('body').trigger('update_checkout')},})}) 245$(document).on('click','.wpfnl-place-order-add-overlay',function(e){$('.wpfnl-order-bump__popup-wrapper').addClass('show').css('top','30px')}) 246$(document).on('change','.wpfnl-order-bump-cb',function(e){e.preventDefault() 247var clickedChecked=$(this).prop('checked') 248$('.wpfnl-order-bump-cb[data-key="'+$(this).attr('data-key')+'"]').not(this).prop('checked',clickedChecked) 249$(this).parents('.wpfnl-reset').find('.oderbump-loader').css('display','flex') 250var ajaxurl=window.wpfnl_obj.ajaxurl 251var user_id=window.wpfnl_obj.user_id 252var step_id=$(this).attr('data-step') 253var quantity=$(this).attr('data-quantity') 254var replace=$(this).attr('data-replace') 255var key=$(this).attr('data-key') 256var isLms=$(this).attr('data-lms') 257var product=$(this).val() 258let checker=!1,main_products=$(this).attr('data-main-products') 259quantity=parseInt(quantity,10);if(isNaN(quantity)||quantity<1){quantity=1} 260var specificLabel=$('#wpfnl-order-bump-add-btn-'+key);if($(this).prop('checked')==!0){checker=!0 261specificLabel.text('Remove')}else if($(this).prop('checked')==!1){checker=!1 262specificLabel.text('Add')} 263if(checker){$("input[name='_wpfunnels_order_bump_product_"+key+"']").val(product)}else{$("input[name='_wpfunnels_order_bump_product_"+key+"']").val('')} 264$("input[name='_wpfunnels_order_bump_clicked']").val('yes') 265$('.wpfnl-order-bump-cb').each(function(){$(this).prop('disabled',!0)});let variation_id='';let variation_data={};var $variationForm=$('.variations_form[data-product_id="'+product+'"]');
265if($variationForm.length){variation_id=$variationForm.find('input[name="variation_id"]').val();$variationForm.find('select[name^="attribute_"]').each(function(){var name=$(this).attr('name');var value=$(this).val();if(value){variation_data[name]=value}})} 266jQuery.ajax({type:'POST',url:ajaxurl,data:{action:'wpfnl_order_bump_ajax',security:window.wpfnl_obj.ajax_nonce,step_id:step_id,quantity:quantity,product:product,checker:checker,is_lms:isLms,user_id:user_id,key:key,main_products:main_products,variation_id:variation_id,variation_data:variation_data,},success:function(response){$('.wpfnl-lms-access-course-message').text('') 267wpf_remove_spinner(response) 268if($('.gwpf-acrrodion-total').length){$('.gwpf-acrrodion-total').html(response.cart_total_currency)} 269$('.oderbump-loader').css('display','none') 270if(isLms==='wc'){jQuery('body').trigger('update_checkout')}else{$('.wpfnl-order-bump-cb').each(function(index){if($(this).val()!=product){$(this).prop('checked',!1)}}) 271$('.wpfnl-lms-checkout').empty().append(response.html)} 272if(response.wpfunnels_data&&response.wpfunnels_data.product_name){var titleLabel=$('#wpfnl-order-bump-title-'+key);titleLabel.text(response.wpfunnels_data.product_name)} 273if(response.wpfunnels_data&&response.wpfunnels_data.product_description){var descriptionLabel=$('#wpfnl-order-bump-description-'+key);descriptionLabel.html(response.wpfunnels_data.product_description)} 274if(response.wpfunnels_data&&response.wpfunnels_data.product_price){var priceLabel=$('#wpfnl-order-bump-price-'+key);var labelText=priceLabel.find('strong').text();priceLabel.html('<strong>'+labelText+'</strong> '+response.wpfunnels_data.product_price)} 275if(response.wpfunnels_data&&response.wpfunnels_data.product_image){var imageWrapper=$('#wpfnl-order-bump-image-'+key);imageWrapper.css('background-image','url('+response.wpfunnels_data.product_image+')');imageWrapper.find('img.for-mobile').attr('src',response.wpfunnels_data.product_image)} 276$('.wpfnl-order-bump-cb').each(function(index){if('yes'===isLms){if($(this).val()!=product){$(this).prop('checked',!1)}}}) 277if(response.wpfunnels_data&&response.wpfunnels_data.isAllReplace===!0&&checker){$('.wpfnl-order-bump-cb').each(function(index,checkbox){if($(checkbox).attr('data-key')!==key){$(checkbox).prop('checked',!1)}})} 278$('.wpfnl-order-bump-cb').each(function(){$(this).prop('disabled',!1)});var $popupWrapper=$('.wpfnl-order-bump__popup-wrapper');var inner_height=$popupWrapper.innerHeight()+30;$popupWrapper.removeClass('show').css('top','-'+inner_height+'px') 279$('.wpfnl-place-order').removeClass('wpfnl-place-order-add-overlay')},})}) 280function wpfnlInitOrderBumpPopup(){setTimeout(function(){var $popupWrapper=$('.wpfnl-order-bump__popup-wrapper');if($popupWrapper.length){var inner_height=$popupWrapper.innerHeight()+30;$popupWrapper.css('top','-'+inner_height+'px');if(!$popupWrapper.hasClass('wpfnl-pre-purchase')){$popupWrapper.addClass('show').css('top','30px')}}},500)}
281if(document.readyState==='complete'){wpfnlInitOrderBumpPopup()}else{$(window).on('load',wpfnlInitOrderBumpPopup)} 282$(document).on('click','.close-order-bump',function(){var $popupWrapper=$('.wpfnl-order-bump__popup-wrapper');var inner_height=$popupWrapper.innerHeight()+30;$popupWrapper.removeClass('show').css('top','-'+inner_height+'px') 283$('.wpfnl-place-order').removeClass('wpfnl-place-order-add-overlay')}) 284$('.wpfnl-checkout .woocommerce-form-coupon-toggle .showcoupon').on('click',function(){$(this).parents('.woocommerce-form-coupon-toggle').toggleClass('show-form')}) 285$(document).on('click','.wpfnl-coupon-toggle-link',function(e){e.preventDefault() 286var $wrapper=$(this).closest('.wpfnl-coupon-toggle-wrapper') 287$wrapper.find('.wpfnl-coupon-collapsible').slideToggle(300) 288$(this).closest('.wpfnl-coupon-toggle-notice').toggleClass('wpfnl-coupon-expanded')}) 289function initCollapsibleCheckoutFields(){var $rows=$('.wpfnl-checkout .form-row.wpfnl-field-collapsible') 290if(!$rows.length){return} 291$rows.each(function(){var $row=$(this) 292if($row.data('wpfnlCollapsibleReady')){return} 293var $inputWrapper=$row.children('.woocommerce-input-wrapper').first() 294if(!$inputWrapper.length){$inputWrapper=$row.find('.woocommerce-input-wrapper').first()} 295if(!$inputWrapper.length){return} 296var $label=$row.children('label').first() 297var labelText='' 298if($label.length){var $labelClone=$label.clone() 299$labelClone.find('*').remove() 300labelText=$.trim($labelClone.text()).replace(/\*/g,'') 301$label.addClass('wpfnl-field-original-label')} 302if(!labelText){labelText='Field'} 303$row.attr('data-collapse-label',labelText) 304var $toggle=$('<button type="button" class="wpfnl-field-collapse-toggle" aria-expanded="false">'+'<span class="wpfnl-field-collapse-icon" aria-hidden="true"></span>'+'<span class="wpfnl-field-collapse-text"></span>'+'</button>') 305$toggle.find('.wpfnl-field-collapse-text').text('Add '+labelText) 306$row.prepend($toggle) 307$row.addClass('wpfnl-field-collapsible-ready wpfnl-field-collapsed') 308$row.data('wpfnlCollapsibleReady',!0) 309$inputWrapper.hide()})} 310$(document).on('click','.wpfnl-checkout .wpfnl-field-collapse-toggle',function(e){e.preventDefault() 311var $button=$(this) 312var $row=$button.closest('.form-row.wpfnl-field-collapsible') 313var $inputWrapper=$row.children('.woocommerce-input-wrapper').first() 314if(!$inputWrapper.length){$inputWrapper=$row.find('.woocommerce-input-wrapper').first()} 315if(!$inputWrapper.length){return} 316if(!$row.hasClass('wpfnl-field-collapsed')){return} 317$row.removeClass('wpfnl-field-collapsed').addClass('wpfnl-field-expanded') 318$button.attr('aria-expanded','true').hide() 319$inputWrapper.stop(!0,!0).slideDown(200)}) 320$(document.body).on('checkout_error',function(){$('.wpfnl-checkout .form-row.wpfnl-field-collapsible.woocommerce-invalid').each(function(){var $row=$(this) 321if($row.hasClass('wpfnl-field-expanded')){return} 322var $inputWrapper=$row.children('.woocommerce-input-wrapper').first() 323if(!$inputWrapper.length){$inputWrapper=$row.find('.woocommerce-input-wrapper').first()} 324if(!$inputWrapper.length){return} 325$row.removeClass('wpfnl-field-collapsed').addClass('wpfnl-field-expanded') 326$row.find('.wpfnl-field-collapse-toggle').attr('aria-expanded','true').hide() 327$inputWrapper.stop(!0,!0).slideDown(200)})}) 328function initModernCheckoutCouponFlow(){var $checkoutWrapper=$('.wpfnl-checkout.wpfnl-modern-checkout, .wpfnl-checkout.wpfnl-modern-one-column') 329if(!$checkoutWrapper.length){return} 330function renderCouponMessages(messages){$checkoutWrapper.find('.wpfnl-custom-coupon-messages').remove() 331if(!messages){return} 332var $container=$('<div class="wpfnl-custom-coupon-messages"></div>').html(messages) 333var $target=$checkoutWrapper.find('.wpfnl-modern-checkout-right .wpfnl-modern-order-summary').first() 334if(!$target.length){$target=$checkoutWrapper.find('.wpfnl-modern-section--order-summary .wpfnl-modern-section__content').first()} 335if($target.length){$target.prepend($container)}} 336function applyCoupon(couponCode,$button){if(!couponCode){renderCouponMessages('<ul class="woocommerce-error" role="alert"><li>Please enter a coupon code.</li></ul>') 337return} 338$button.prop('disabled',!0).addClass('wpfnl-loading') 339$.ajax({type:'POST',url:window.wpfnl_obj.ajaxurl,dataType:'json',data:{action:'wpfnl_apply_checkout_coupon',coupon_code:couponCode,security:window.wpfnl_obj.ajax_nonce,},success:function(response){renderCouponMessages(response&&response.data?response.data.messages:'') 340$('body').trigger('update_checkout')},error:function(){renderCouponMessages('<ul class="woocommerce-error" role="alert"><li>Unable to apply coupon right now.</li></ul>')},complete:function(){$button.prop('disabled',!1).removeClass('wpfnl-loading')},})} 341$(document).off('click.wpfnlCouponFlow','.wpfnl-submit-coupon').on('click.wpfnlCouponFlow','.wpfnl-submit-coupon',function(e){e.preventDefault() 342var $button=$(this)
343var couponCode=$button.closest('.wpfnl-custom-coupon-field').find('.wpfnl-coupon-code-input').val() 344applyCoupon($.trim(couponCode),$button)}) 345$(document).off('keypress.wpfnlCouponFlow','.wpfnl-coupon-code-input').on('keypress.wpfnlCouponFlow','.wpfnl-coupon-code-input',function(e){if(13!==e.which){return} 346e.preventDefault() 347var $input=$(this) 348var $button=$input.closest('.wpfnl-custom-coupon-field').find('.wpfnl-submit-coupon') 349applyCoupon($.trim($input.val()),$button)}) 350$(document).off('click.wpfnlCouponRemove','.wpfnl-modern-checkout-right .woocommerce-remove-coupon, .wpfnl-modern-one-column-wrapper .woocommerce-remove-coupon').on('click.wpfnlCouponRemove','.wpfnl-modern-checkout-right .woocommerce-remove-coupon, .wpfnl-modern-one-column-wrapper .woocommerce-remove-coupon',function(e){e.preventDefault() 351var couponCode=$(this).attr('data-coupon') 352$.ajax({type:'POST',url:window.wpfnl_obj.ajaxurl,dataType:'json',data:{action:'wpfnl_remove_checkout_coupon',coupon_code:couponCode,security:window.wpfnl_obj.ajax_nonce,},success:function(response){renderCouponMessages(response&&response.data?response.data.messages:'') 353$('body').trigger('update_checkout')},})})} 354initModernCheckoutCouponFlow() 355initCollapsibleCheckoutFields() 356$(document.body).on('updated_checkout',function(){initModernCheckoutCouponFlow() 357initCollapsibleCheckoutFields()}) 358$('.wpfnl-elementor-optin-form-wrapper form').on('submit',function(e){e.preventDefault() 359var thisParents=$(this).parents('.wpfnl-elementor-optin-form-wrapper') 360var thisEmail=thisParents.find('.wpfnl-email') 361var thisFirstName=thisParents.find('.wpfnl-first-name') 362var thisLastName=thisParents.find('.wpfnl-last-name') 363var thisAcceptance=thisParents.find('.wpfnl-acceptance_checkbox') 364var thisPhone=thisParents.find('.wpfnl-phone') 365$('.wpfnl-elementor-optin-form-wrapper .response').css('display','none') 366if((thisEmail.val()==''&&thisEmail.prop('required'))||(thisLastName.val()==''&&thisLastName.prop('required'))||(thisFirstName.val()==''&&thisFirstName.prop('required'))||(thisAcceptance.val()==''&&thisAcceptance.prop('required'))||(thisPhone.val()==''&&thisPhone.prop('required'))){thisParents.find('.response').css('color','red') 367thisParents.find('.response').text('Please fill all the required fields') 368thisParents.find('.response').css('display','flex') 369return!1} 370var ajaxurl=wpfnl_obj.ajaxurl,security=wpfnl_obj.optin_form_nonce,step_id=wpfnl_obj.step_id,email='',data={action:'wpfnl_optin_submission',security:security,step_id:step_id,url:window.location.href,postData:$(this).serialize(),},postData=data.postData.split('&'),form=$(this) 371form.find('.wpfnl-loader').show() 372form.find('button[type="submit"]').prop('disabled',!0) 373$.ajax({type:'POST',url:ajaxurl,data:data,dataType:'json',success:function(response){if(response.success){form.hide() 374form.find('button[type="submit"]').prop('disabled',!1) 375thisParents.find('.response').fadeIn('fast') 376thisParents.find('.response').css('color','green') 377thisParents.find('.response').text(response.notification_text) 378if(response.redirect){setTimeout(function(){window.location.href=response.redirect_url},1000)}}else{thisParents.find('.response').fadeIn('fast') 379form.find('button[type="submit"]').prop('disabled',!1) 380form.find('.wpfnl-loader').css('display','none') 381thisParents.find('.response').css('color','red') 382thisParents.find('.response').text(response.notification_text)}},})}) 383$('.wpfnl-shortcode-optin-form-wrapper form').on('submit',function(e){e.preventDefault() 384var thisParents=$(this).parents('.wpfnl-shortcode-optin-form-wrapper') 385optinSubmit(thisParents)}) 386$('.wpfnl-shortcode-optin-form-wrapper form #wpfunnels_optin-button').on('click',function(e){e.preventDefault() 387var thisParents=$(this).parents('.wpfnl-shortcode-optin-form-wrapper') 388optinSubmit(thisParents)},) 389$('.wpfnl-bricks-optin-form-wrapper form button').on('click',function(e){e.preventDefault() 390var thisParents=$(this).parents('.wpfnl-bricks-optin-form-wrapper') 391optinSubmit(thisParents)},) 392function optinSubmit(thisParents){var thisEmail=thisParents.find('.wpfnl-email') 393var thisFirstName=thisParents.find('.wpfnl-first-name') 394var thisLastName=thisParents.find('.wpfnl-last-name') 395var thisAcceptance=thisParents.find('.wpfnl-acceptance_checkbox') 396var thisPhone=thisParents.find('.wpfnl-phone') 397thisParents.find('response').css('display','none') 398if((thisEmail.val()==''&&thisEmail.prop('required'))||(thisLastName.val()==''&&thisLastName.prop('required'))||(thisFirstName.val()==''&&thisFirstName.prop('required'))||(thisAcceptance.val()==''&&thisAcceptance.prop('required'))||(thisPhone.val()==''&&thisPhone.prop('required'))){thisParents.find('.response').css('color','red') 399if(thisEmail.val()==''){thisParents.find('.response').text('Email field is required')}else{thisParents.find('.response').text('Please fill all the required fields')} 400thisParents.find('.response').css('display','flex') 401return!1} 402var ajaxurl=wpfnl_obj.ajaxurl,security=wpfnl_obj.optin_form_nonce,step_id=wpfnl_obj.step_id,funnel_id=wpfnl_obj.funnel_id,email='',data={action:'wpfnl_shortcode_optin_submission',security:security,step_id:step_id,funnel_id:funnel_id,url:window.location.href,postData:thisParents.find('form').serialize(),},postData=data.postData.split('&'),form=thisParents.find('form') 403form.find('.et_pb_button.btn-optin').addClass('disabled') 404form.find('.btn-optin').prop('disabled',!0) 405form.find('.wpfnl-loader').css('display','inline-block') 406$.ajax({type:'POST',url:ajaxurl,data:data,dataType:'json',success:function(response){if(response.success){form.hide() 407form.find('.et_pb_button.btn-optin').removeClass('disabled') 408form.find('.btn-optin').prop('disabled',!1) 409thisParents.find('.response').fadeIn('fast') 410thisParents.find('.response').css('color','green') 411thisParents.find('.response').text(response.notification_text) 412if(response.redirect){setTimeout(function(){window.location.href=response.redirect_url},1000)}}else{form.find('.et_pb_button.btn-optin').removeClass('disabled') 413form.find('.btn-optin').prop('disabled',!1) 414thisParents.find('.response').fadeIn('fast') 415form.find('.wpfnl-loader').css('display','none') 416thisParents.find('.response').css('color','red') 417thisParents.find('.response').text(response.notification_text)}},})} 418$(document).ready(function(){var get_optin=$('#wpf-optin-g-guternburg').val() 419if(get_optin!=undefined){if(get_optin!=''||get_optin!=NUll){grecaptcha.ready(function(){gre
419captcha.execute(get_optin,{action:'homepage'}).then(function(token){document.getElementById('wpf-optin-g-guternburg').value=token})})}}}) 420$('.wpfnl-gutenberg-optin-form-wrapper form').on('submit',function(e){e.preventDefault() 421var thisParents=$(this).parents('.wpfnl-gutenberg-optin-form-wrapper') 422var thisEmail=thisParents.find('.wpfnl-email') 423var thisFirstName=thisParents.find('.wpfnl-first-name') 424var thisLastName=thisParents.find('.wpfnl-last-name') 425var thisAcceptance=thisParents.find('.wpfnl-acceptance_checkbox') 426var thisPhone=thisParents.find('.wpfnl-phone') 427thisParents.find('.response').css('display','none') 428if((thisEmail.val()==''&&thisEmail.prop('required'))||(thisLastName.val()==''&&thisLastName.prop('required'))||(thisFirstName.val()==''&&thisFirstName.prop('required'))||(thisAcceptance.val()==''&&thisAcceptance.prop('required'))||(thisPhone.val()==''&&thisPhone.prop('required'))){thisParents.find('.response').css('color','red') 429thisParents.find('.response').text('Please fill all the required fields') 430thisParents.find('.response').css('display','flex') 431return!1} 432$('.wpfnl-optin-form .wpfnl-optin-form-group .btn-optin').prop('disabled',!0).addClass('show-loader') 433var ajaxurl=wpfnl_obj.ajaxurl,security=wpfnl_obj.optin_form_nonce,step_id=wpfnl_obj.step_id,email='',data={action:'wpfnl_gutenberg_optin_submission',security:security,step_id:step_id,url:window.location.href,postData:$(this).serialize(),},form=$(this) 434form.find('.wpfnl-loader').show() 435$.ajax({type:'POST',url:ajaxurl,data:data,dataType:'json',success:function(response){if(response.success){form.hide() 436let post_action=response.post_action 437$('.wpfnl-optin-form .wpfnl-optin-form-group .btn-optin').prop('disabled',!1).removeClass('show-loader') 438thisParents.find('.response').fadeIn('fast') 439thisParents.find('.response').css('color','green') 440thisParents.find('.response').text(response.notification_text) 441if('notification'!==post_action){setTimeout(function(){window.location.href=response.redirect_url},1000)}}else{thisParents.find('.response').fadeIn('fast') 442form.find('.wpfnl-loader').css('display','none') 443thisParents.find('.response').css('color','red') 444thisParents.find('.response').text(response.notification_text)}},})}) 445$(document).on('click','#wpfnl-lms-access-course',function(e){e.preventDefault() 446var next_step_url=$(this).attr('href') 447var ajaxurl=window.wpfnl_obj.ajaxurl 448var data={action:'wpfnl_learndash_already_enroll_course',step_id:window.wpfnl_obj.step_id,user_id:window.wpfnl_obj.user_id,} 449$.ajax({type:'POST',url:ajaxurl,data:data,dataType:'json',success:function(response){if(response.success){$('.wpfnl-lms-access-course-message').text('You are already enrolled in this course.',) 450setTimeout(function(){window.location=next_step_url},2500)}},})}) 451$(document).ready(function(){$(document).on('keypress','.wpfnl-quantity-setect',function(e){if(['-','+','e','E','.'].includes(e.key)){e.preventDefault()}});$(document).on('input','.wpfnl-quantity-setect',function(e){let quantity=parseInt($(this).val(),10);if(isNaN(quantity)||quantity<1){$(this).val(1);quantity=1}});$(document).on('blur','.wpfnl-quantity-setect',function(e){let quantity=parseInt($(this).val(),10);if(isNaN(quantity)||quantity<1){$(this).val(1)}})}) 452function initModernCheckoutCustomerFlow(){var $wrapper=$('.wpfnl-modern-checkout-wrapper .wpfnl-customer-info, .wpfnl-modern-one-column-wrapper .wpfnl-customer-info') 453if(!$wrapper.length){return} 454var $email=$wrapper.find('input[name="billing_email"]') 455var $passwordSection=$wrapper.find('.wpfnl-customer-login-section') 456var $createAccountSection=$wrapper.find('.wpfnl-create-account-section') 457var $inlineError=$wrapper.find('.wpfnl-email-inline-error') 458var hasClickedLogin=!1 459var lastCheckedEmail='' 460var checkTimer=null 461if(!$inlineError.length&&$email.length){$inlineError=$('<p class="wpfnl-email-inline-error" style="display:none;color:#c62828;font-size:12px;margin-top:6px;"></p>') 462$email.first().closest('.form-row').append($inlineError)} 463if($passwordSection.length){$passwordSection.stop(!0,!0).hide()} 464if($createAccountSection.length){$createAccountSection.attr('hidden',!0).stop(!0,!0).hide()} 465$(document).off('click.wpfnlModernCustomerFlow','.wpfnl-customer-login-url').on('click.wpfnlModernCustomerFlow','.wpfnl-customer-login-url',function(e){e.preventDefault() 466hasClickedLogin=!0 467if($createAccountSection.length){$createAccountSection.stop(!0,!0).slideUp(180).attr('hidden',!0)} 468if($passwordSection.length){$passwordSection.stop(!0,!0).slideDown(220)}}) 469function isValidEmail(email){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)} 470function showInlineEmailError(message){if(!$inlineError.length){return} 471$inlineError.text(message).stop(!0,!0).slideDown(140)} 472function hideInlineEmailError(){if(!$inlineError.length){return}
473$inlineError.stop(!0,!0).slideUp(120)} 474function updateSectionsForEmailCheck(result){if(hasClickedLogin){return} 475if(!result||!result.data){return} 476var payload=result.data 477var emailExists=!!payload.success 478var loginAllowed=!!payload.is_login_allowed 479if(emailExists&&loginAllowed){if($createAccountSection.length){$createAccountSection.stop(!0,!0).slideUp(180).attr('hidden',!0)} 480if($passwordSection.length){$passwordSection.stop(!0,!0).slideDown(220)} 481return} 482if($passwordSection.length){$passwordSection.stop(!0,!0).slideUp(180)} 483if($createAccountSection.length){$createAccountSection.removeAttr('hidden').stop(!0,!0).slideDown(220)}} 484function checkEmailExistence(){if(!$email.length||hasClickedLogin){return} 485var email=($email.val()||'').trim() 486if(!email.length){hideInlineEmailError() 487return} 488if(!isValidEmail(email)){showInlineEmailError('Entered email address is not a valid email.') 489return} 490hideInlineEmailError() 491if(email===lastCheckedEmail){return} 492lastCheckedEmail=email 493$.ajax({type:'POST',url:window.wpfnl_obj.ajaxurl,dataType:'json',data:{action:'wpf_check_email_exists',email:email,security:window.wpfnl_obj.ajax_nonce,},success:function(response){updateSectionsForEmailCheck(response)},error:function(){},})} 494$(document).off('input.wpfnlModernCustomerFlow keyup.wpfnlModernCustomerFlow paste.wpfnlModernCustomerFlow blur.wpfnlModernCustomerFlow change.wpfnlModernCustomerFlow','.wpfnl-modern-checkout-wrapper input[name="billing_email"], .wpfnl-modern-one-column-wrapper input[name="billing_email"]').on('input.wpfnlModernCustomerFlow keyup.wpfnlModernCustomerFlow paste.wpfnlModernCustomerFlow blur.wpfnlModernCustomerFlow change.wpfnlModernCustomerFlow','.wpfnl-modern-checkout-wrapper input[name="billing_email"], .wpfnl-modern-one-column-wrapper input[name="billing_email"]',function(){clearTimeout(checkTimer) 495checkTimer=setTimeout(checkEmailExistence,250)})} 496initModernCheckoutCustomerFlow() 497$(document.body).on('updated_checkout',function(){initModernCheckoutCustomerFlow()}) 498$('.clickto-expand-btn').on('click',function(e){$(this).parents('.wpfnl-optin-clickto-expand').hide() 499$('.wpfnl-optin-form.clickto-expand-optin').show()}) 500var wpfnlPlaceOrderHTML=null 501function wpfnlCachePlaceOrderBtn(){var $btn=$('#place_order') 502if($btn.find('.wpfnl-place-order-icon, .wpfnl-place-order-price, .wpfnl-place-order-sub-text').length){wpfnlPlaceOrderHTML=$btn.html()}} 503function wpfnlRestorePlaceOrderBtn(){if(wpfnlPlaceOrderHTML){$('#place_order').html(wpfnlPlaceOrderHTML)}} 504$(document.body).on('updated_checkout',function(){wpfnlCachePlaceOrderBtn()}) 505$(document.body).on('payment_method_selected',function(){wpfnlRestorePlaceOrderBtn()}) 506$(document.body).on('init_checkout',function(){wpfnlCachePlaceOrderBtn()}) 507function initEnhancedPhoneField(){if(window.wpfnl_obj&&window.wpfnl_obj.enhanced_phone_field_enabled==='yes'){if($('#wpfnl-iti-styles').length===0){$('<style id="wpfnl-iti-styles">.iti { width: 100%; } .wpfnl-invalid-phone { border-color: #a00 !important; }</style>').appendTo('head')} 508var phoneInputs=document.querySelectorAll('#billing_phone, .wpfnl-phone, input[type="tel"]');phoneInputs.forEach(function(input){if(!input.classList.contains('iti__tel-input')&&window.intlTelInput){input.classList.add('iti__tel-input');var iti=window.intlTelInput(input,{initialCountry:"auto",separateDialCode:!0,geoIpLookup:function(success,failure){$.get('https://ipinfo.io',function(){},"jsonp").always(function(resp){var countryCode=(resp&&resp.country)?resp.country:"us";success(countryCode)})},utilsScript:window.wpfnl_obj.phone_utils_url,});if(window.wpfnl_obj.phone_help_text){var helpText=document.createElement('small');helpText.className='wpfnl-phone-help-text';helpText.style.display='block';helpText.style.color='#686F7F';helpText.style.marginTop='4px';helpText.style.fontSize='12px';helpText.innerText=window.wpfnl_obj.phone_help_text;input.parentNode.parentNode.appendChild(helpText)} 509if(window.wpfnl_obj.validate_phone_number==='yes'){input.addEventListener('blur',function(){if(input.value.trim()){if(iti.isValidNumber()){input.classList.remove('wpfnl-invalid-phone');$(input).parents('.form-row').removeClass('woocommerce-invalid')}else{input.classList.add('wpfnl-invalid-phone');$(input).parents('.form-row').addClass('woocommerce-invalid')}}})} 510if(window.wpfnl_obj.save_phone_number_format==='with_country_code'){var $form=$(input).closest('form.checkout');if($form.length){$form.on('checkout_place_order',function(){if(iti.isValidNumber()){input.value=iti.getNumber()}})}}}})}} 511initEnhancedPhoneField();function initCollapsibleOrderSummary(){if(window.wpfnl_obj&&window.wpfnl_obj.collapsible_order_summary_enabled!=='no'){var $table=$('.woocommerce-checkout-review-order-table');if($table.length>0&&$('.wpfnl-mobile-order-summary-toggle').length===0){var toggleHtml='<div class="wpfnl-mobile-order-summary-toggle">'+'<span class="wpfnl-mos-text">Show order summary</span>'+'<span class="wpfnl-mos-icon">â¼</span>'+'</div>';$(toggleHtml).insertBefore($table);$('.wpfnl-mobile-order-summary-toggle').on('click',function(){var $content=$(this).next('.woocommerce-checkout-review-order-table');var $icon=$(this).find('.wpfnl-mos-icon');var $text=$(this).find('.wpfnl-mos-text');$(this).toggleClass('active-toggle');$content.slideToggle(300,function(){var isVisible=$content.is(':visible');$text.text(isVisible?'Hide order summary':'Show order summary');$icon.css('transform',isVisible?'rotate(180deg)':'rotate(0deg)')})})} 512var handleResize=function(){if($(window).width()<=768){if(!$('.woocommerce-checkout-review-order-table').hasClass('wpfnl-mos-collapsed')&&!$('.woocommerce-checkout-review-order-table').is(':visible')){}else if(!$('.woocommerce-checkout-review-order-table').hasClass('wpfnl-mos-collapsed')){$('.woocommerce-checkout-review-order-table').addClass('wpfnl-mos-collapsed');$('.wpfnl-mobile-order-summary-toggle .wpfnl-mos-text').text('Show order summary');$('.wpfnl-mobile-order-summary-toggle .wpfnl-mos-icon').css('transform','rotate(0deg)')}}else{$('.woocommerce-checkout-review-order-table').removeClass('wpfnl-mos-collapsed')}};$(window).on('resize',handleResize);handleResize()}} 513initCollapsibleOrderSummary();$(document.body).on('updated_checkout',function(){initEnhancedPhoneField();if($('.wpfnl-mobile-order-summary-toggle').length===0){initCollapsibleOrderSummary()}else{if($(window).width()<=768&&$('.woocommerce-checkout-review-order-table').hasClass('wpfnl-mos-collapsed')){$('.woocommerce-checkout-review-order-table').hide()}else if($(window).width()>768){$('.woocommerce-checkout-review-order-table').show()}}});function wpfnlSyncBillingFromShipping(){var $chk=$('#billing-same-as-shipping-checkbox');if($chk.length&&$chk.is(':checked')){$('.wpfnl-billing-fields').hide();var fields=['first_name','last_name','company','country','address_1','address_2','city','state','postcode','phone'];$.each(fields,function(i,field){var $shipField=$('#shipping_'+field);if($shipField.length){var val=$shipField.val();var $billField=$('#billing_'+field);if($billField.length&&$billField.val()!==val){$billField.val(val).trigger('change')}}})}else if($chk.length){$('.wpfnl-billing-fields').show()}} 514$(document).on('change','#billing-same-as-shipping-checkbox',function(){if($(this).is(':checked')){$('.wpfnl-billing-fields').slide
514Up();wpfnlSyncBillingFromShipping()}else{$('.wpfnl-billing-fields').slideDown()}});$(document).on('change input','[id^="shipping_"]',function(){if($('#billing-same-as-shipping-checkbox').is(':checked')){wpfnlSyncBillingFromShipping()}});$(document).on('submit','form.checkout',function(){if($('#billing-same-as-shipping-checkbox').is(':checked')){wpfnlSyncBillingFromShipping()}});wpfnlSyncBillingFromShipping();function wpfnlGetMultistepOrder(){var order=['information'];if($('.wpfnl-modern-multistep-nav-step[data-step="billing"]').length>0&&$('.wpfnl-modern-multistep-nav-step[data-step="billing"]').is(':visible')){order.push('billing')} 515order.push('payment');return order} 516function wpfnlGetStepContainers(step){var $containers=$();if('information'===step){$containers=$('.wpfnl-modern-multistep .wpfnl-modern-section--customer-information');if($('.wpfnl-modern-multistep-nav-step[data-step="billing"]').length>0&&$('.wpfnl-modern-multistep-nav-step[data-step="billing"]').is(':visible')){$containers=$containers.add('.wpfnl-modern-multistep .wpfnl-shipping-fields').add('.wpfnl-modern-multistep .woocommerce-a
516dditional-fields')}else{$containers=$containers.add('.wpfnl-modern-multistep .wpfnl-billing-fields')}}else if('billing'===step){if($('#billing-same-as-shipping-checkbox').length===0||!$('#billing-same-as-shipping-checkbox').is(':checked')){$containers=$('.wpfnl-modern-multistep .wpfnl-billing-fields')}}else if('payment'===step){} 517return $containers} 518function wpfnlIsStepValid(step){var isValid=!0;wpfnlGetStepContainers(step).find('.form-row.validate-required').each(function(){if(!isValid)return!1;var $row=$(this);if(!$row.is(':visible'))return;var $select=$row.find('select').first();var $checkbox=$row.find('input[type="checkbox"]').first();var $textInput=$row.find('input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), textarea').first();if($select.length){if(!$select.val())isValid=!1}else if($checkbox.length){if(!$checkbox.is(':checked'))isValid=!1}else if($textInput.length){if(!$.trim($textInput.val()))isValid=!1}});return isValid} 519function wpfnlSyncNextStepBtn(activeStep){var $btn=$('.wpfnl-modern-multistep-navigation .next-step-btn');if(!$btn.length)return;var order=wpfnlGetMultistepOrder();var currentIndex=order.indexOf(activeStep);var nextIndex=currentIndex+1;if(nextIndex<order.length){$btn.attr('current-step',activeStep);$btn.attr('next-step',order[nextIndex]);$btn.prop('disabled',!1)}else{$btn.prop('disabled',!0);return} 520wpfnlValidateCurrentStep()} 521function wpfnlValidateCurrentStep(){var $btn=$('.wpfnl-modern-multistep-navigation .next-step-btn');if(!$btn.length)return;var currentStep=$btn.attr('current-step')||'information';$btn.prop('disabled',!wpfnlIsStepValid(currentStep))} 522$(document).on('input change','.wpfnl-modern-multistep .wpfnl-modern-section--customer-information input, '+'.wpfnl-modern-multistep .wpfnl-billing-fields input, '+'.wpfnl-modern-multistep .wpfnl-billing-fields select, '+'.wpfnl-modern-multistep .wpfnl-shipping-fields input, '+'.wpfnl-modern-multistep .wpfnl-shipping-fields select, '+'.wpfnl-modern-multistep .woocommerce-a
522dditional-fields input, '+'.wpfnl-modern-multistep .woocommerce-additional-fields textarea',wpfnlValidateCurrentStep);$(document).on('change','#ship-to-different-address-checkbox, #billing-same-as-shipping-checkbox',wpfnlValidateCurrentStep);$(document.body).on('updated_checkout',function(){wpfnlSyncBillingFromShipping();var $activeBtn=$('.wpfnl-modern-multistep-nav .wpfnl-modern-multistep-nav-step.active .wpfnl-modern-multistep-nav-step-btn');var currentStep=$activeBtn.length?$activeBtn.data('step'):'information';if(currentStep==='billing'&&$('.wpfnl-modern-multistep-nav-step[data-step="billing"]').length===0){currentStep='information';$('.wpfnl-modern-multistep-nav-step[data-step="information"]').addClass('active').siblings().removeClass('active')} 523initModernMultistepCheckoutToggle(currentStep);wpfnlSyncNextStepBtn(currentStep);wpfnlValidateCurrentStep();var currentWizardStep=$('.wpfnl-multistep-wizard > li.current > button').attr('data-target');if(currentWizardStep==='shipping'&&$('.wpfnl-multistep-wizard > li.shipping').length===0){currentWizardStep='billing';$('.wpfnl-multistep-wizard > li.billing').addClass('current').siblings().removeClass('current')} 524if(currentWizardStep&&typeof show_checkout_step==='function'){show_checkout_step(currentWizardStep)}});var initialModernStep=$('.wpfnl-modern-multistep-nav .wpfnl-modern-multistep-nav-step.active .wpfnl-modern-multistep-nav-step-btn').data('step')||'information';initModernMultistepCheckoutToggle(initialModernStep);wpfnlValidateCurrentStep();function initModernMultistepCheckoutToggle(target){var hasBillingStep=$('.wpfnl-modern-multistep-nav-step[data-step="billing"]').length>0&&$('.wpfnl-modern-multistep-nav-step[data-step="billing"]').is(':visible');if('information'==target){$('.wpfnl-modern-multistep .wpfnl-modern-section--customer-information').show();if(hasBillingStep){$('.wpfnl-modern-multistep .wpfnl-shipping-fields').show();
524$('.wpfnl-modern-multistep .woocommerce-additional-fields').show();$('.wpfnl-modern-multistep .wpfnl-billing-fields').hide()}else{$('.wpfnl-modern-multistep .wpfnl-shipping-fields').hide();$('.wpfnl-modern-multistep .woocommerce-additional-fields').hide();$('.wpfnl-modern-multistep .wpfnl-billing-fields').show()} 525$('.wpfnl-modern-multistep .wpfnl-billing-same-as-shipping').hide();$('.wpfnl-modern-multistep .wpfnl-customer-shipping').show();$('.wpfnl-modern-multistep .wpfnl-modern-section--payment').hide();$('.wpfnl-modern-multistep .wpfnl-modern-multistep-navigation').show();$('.wpfnl-modern-multistep .money-back-guarantee-text').show()}else if('billing'==target){$('.wpfnl-modern-multistep .wpfnl-modern-section--customer-information').hide();$('.wpfnl-modern-multistep .wpfnl-shipping-fields').hide();$('.wpfnl-modern-multistep .woocommerce-additional-fields').hide();$('.wpfnl-modern-multistep .wpfnl-customer-shipping').hide();$('.wpfnl-modern-multistep .wpfnl-billing-same-as-shipping').show();$('.wpfnl-modern-multistep .wpfnl-modern-section--payment').hide();$('.wpfnl-modern-multistep .wpfnl-modern-multistep-navigation').show();$('.wpfnl-modern-multistep .money-back-guarantee-text').show();let isSameAsShipping=$('#billing-same-as-shipping-checkbox').is(':checked');if(isSameAsShipping){$('.wpfnl-modern-multistep .wpfnl-billing-fields').hide()}else{$('.wpfnl-modern-multistep .wpfnl-billing-fields').show()}}else if('payment'==target){$('.wpfnl-modern-multistep .wpfnl-modern-section--customer-information').hide();$('.wpfnl-modern-multistep .wpfnl-shipping-fields').hide();
525$('.wpfnl-modern-multistep .woocommerce-additional-fields').hide();$('.wpfnl-modern-multistep .wpfnl-billing-same-as-shipping').hide();$('.wpfnl-modern-multistep .wpfnl-billing-fields').hide();$('.wpfnl-modern-multistep .wpfnl-modern-section--payment').show();$('.wpfnl-modern-multistep .wpfnl-modern-multistep-navigation').hide();$('.wpfnl-modern-multistep .money-back-guarantee-text').hide()}} 526$(document).on('click','.wpfnl-modern-multistep-nav .wpfnl-modern-multistep-nav-step-btn',function(e){e.preventDefault();var target=$(this).data('step');var order=wpfnlGetMultistepOrder();var $activeBtn=$('.wpfnl-modern-multistep-nav .wpfnl-modern-multistep-nav-step.active .wpfnl-modern-multistep-nav-step-btn');var currentStep=$activeBtn.length?$activeBtn.data('step'):order[0];var currentIndex=order.indexOf(currentStep);var targetIndex=order.indexOf(target);if(targetIndex>currentIndex&&!wpfnlIsStepValid(currentStep)){return} 527var $btn=$(this);var $nav=$btn.closest('.wpfnl-modern-multistep-nav');var $li=$btn.closest('li');$li.addClass('active').siblings().removeClass('active');$li.prevAll('li[data-step]').addClass('completed');$li.nextAll('li[data-step]').removeClass('completed');$nav.find('.wpfnl-modern-multistep-nav-step-btn').attr('aria-selected','false').attr('tabindex','-1');$btn.attr('aria-selected','true').attr('tabindex','0');initModernMultistepCheckoutToggle(target);wpfnlSyncNextStepBtn(target)});$(document).on('click','.wpfnl-modern-multistep-navigation .next-step-btn',function(e){e.preventDefault();var $btn=$(this);var nextStep=$btn.attr('next-step');if(!nextStep)return;$('.wpfnl-modern-multistep-nav-step-btn[data-step="'+nextStep+'"]').trigger('click');wpfnlSyncNextStepBtn(nextStep)});function wpfnlInitButtonAnimations(){var $buttons=$('.wpfnl-animation');if(!$buttons.length)return;if('IntersectionObserver' in window){var observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){if(entry.isIntersecting){$(entry.target).addClass('wpfnl-animated');observer.unobserve(entry.target)}})},{threshold:0.2});$buttons.each(function(){observer.observe(this)})}else{function wpfnlCheckButtonsInView(){$buttons.each(function(){if($(this).hasClass('wpfnl-animated'))return;var top=$(this).offset().top;var bottom=top+$(this).outerHeight();var viewTop=$(window).scrollTop();var viewBottom=viewTop+$(window).height();if(bottom>viewTop&&top<viewBottom){$(this).addClass('wpfnl-animated')}})} 528$(window).on('scroll.wpfnlAnim resize.wpfnlAnim',wpfnlCheckButtonsInView);wpfnlCheckButtonsInView()}}
529wpfnlInitButtonAnimations();var checkboxIcon='<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x=".5" y=".5" width="21" height="21" rx="4.5" fill="#fff" stroke="#dedede"></rect><path d="M8.87459 15.3313C8.53396 15.3315 8.20728 15.1961 7.96662 14.955L5.22153 12.2109C4.92616 11.9155 4.92616 11.4365 5.22153 11.141C5.517 10.8457 5.99595 10.8457 6.29142 11.141L8.87459 13.7242L15.7086 6.89023C16.004 6.59486 16.483 6.59486 16.7785 6.89023C17.0738 7.1857 17.0738 7.66465 16.7785 7.96012L9.78256 14.955C9.5419 15.1961 9.21523 15.3315 8.87459 15.3313Z" fill="#fff"></path></svg>';function initLoginCheckboxIcon(){$('.wpfnl-checkout .woocommerce-form-login.login .woocommerce-form-login__rememberme>span').prepend(checkboxIcon)} 530function initTermsCheckboxIcon(){$('.woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox .woocommerce-terms-and-conditions-checkbox-text').prepend(checkboxIcon);$('.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods-saveNew>label').prepend(checkboxIcon)} 531$(document).ready(function(){initLoginCheckboxIcon();initTermsCheckboxIcon()});$(document.body).on('updated_checkout',function(){initTermsCheckboxIcon()})})})(jQuery) 532;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.