PageSourceSearch

https://www.american-gymnast.com/wp-content/plugins/woocommerce-re…/assets/js/afrfq_front.js?ver=1.3.2

js american-gymnast.com collected 2026-09-26 10:01:29 UTC 25,880 bytes, 889 lines download raw bytes

1jQuery(document).ready(function () {
2	"use strict";
3	var ajaxUrl  = afrfq_phpvars.admin_url;
4	var nonce    = afrfq_phpvars.nonce;
5	var redirect = afrfq_phpvars.redirect;
6	var pageurl  = afrfq_phpvars.pageurl;
7
8
9	jQuery('#loader-wrapper').hide();
10
11	jQuery('.adf-multi-select').select2();
12	jQuery('.adf-rqst-select').select2();
13
14	jQuery(document).on('click', '.afrfq-proceed-btn', function(){
15        window.location.href = jQuery(this).data('url');
16    });
17	
18	
19	jQuery('div.menu ul').append( '<li>' + jQuery('li.quote-li a:eq(1)').text() + '</li>' );
20
21	jQuery(document).on( 'change', '.variation_id', function (e) {
22
23		jQuery(this).closest('form').find('button.afrfq_single_page_atc').remove();
24		jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
25		jQuery( '.afrfqbt_single_page' ).show();
26
27		if ( !jQuery(this).val() ) {
28			return;
29		}
30
31		var variation_id   = parseInt( jQuery(this).val() );
32		var current_button = jQuery(this);
33
34		jQuery.ajax({
35			url: ajaxUrl,
36			type: 'POST',
37			data: {
38				action       : 'check_availability_of_quote',
39				nonce        : nonce,
40				variation_id : variation_id,
41			},
42			success: function ( response ) {
43
44				if ( 'disabled' == response['display'] ) {
45					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
46					jQuery( '.afrfqbt_single_page' ).show();
47
48					if ( jQuery('button.single_add_to_cart_button').length < 1 ) {
49						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
50					}
51
52				} else if ( 'disabled_swap' == response['display'] ) {
53					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
54					jQuery( '.afrfqbt_single_page' ).show();
55					if ( jQuery('button.single_add_to_cart_button').length < 1  ) {
56						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
57					}
58				} else if ( 'hide' == response['display'] ) {
59					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
60					jQuery( '.afrfqbt_single_page' ).hide();
61					if ( jQuery('button.single_add_to_cart_button').length < 1  ) {
62						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
63					}
64				} else if ( 'hide_swap' == response['display'] ) {
65					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
66					jQuery( '.afrfqbt_single_page' ).hide();
67
68					if ( jQuery('button.single_add_to_cart_button').length < 1 ) {
69						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
70					}
71				} else {
72					jQuery( '.afrfqbt_single_page' ).removeClass( 'disabled' );
73					jQuery( '.afrfqbt_single_page' ).show();
74					if ( jQuery('button.single_add_to_cart_button').length < 1  ) {
75						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
76					}
77				}
78			},
79			error: function (response) {
80				current_button.removeClass('loading');
81				current_button.css('opacity', '1' );
82				current_button.css('border', '1px solid red' );
83			}
84		});
85
86	});
87	
88	jQuery('.addify_converty_to_order_button button').click( function (e) {
89		jQuery(this).addClass('loading');
90		jQuery('table.quote_details').css( 'opacity', '0.67' );
91	});
92
93	jQuery('div.af_quote_fields input:not([type="submit"]), div.af_quote_fields textarea, div.af_quote_fields select').each( function(){
94
95		var current_button = jQuery(this);
96
97		if ( !current_button.val() || current_button.val().length < 1 ) {
98
99			if ( 'required' === current_button.attr('required')  ) {
100				current_button.css('border-left', '2px solid #ca1010');
101			}
102		} else {
103			current_button.css('border-left', '2px solid green');
104		}
105	});
106
107	jQuery( document ).on( 'focusout', 'div.af_quote_fields input, div.af_quote_fields textarea, div.af_quote_fields select', function(ev) {
108				
109		var current_button = jQuery(this);
110		if ( !current_button.val() || current_button.val().length < 1 ) {
111			if ( 'required' === current_button.attr('required')  ) {
112				current_button.css('border-left', '2px solid #ca1010');
113			}
114			return;
115		}
116		
117		jQuery.ajax({
118			url: ajaxUrl,
119			type: 'POST',
120			data: {
121				action   : 'cache_quote_fields',
122				nonce    : nonce,
123				form_data : jQuery(this).closest('form').serialize(),
124			},
125			success: function (response) {
126				current_button.css('border-left', '2px solid green');
127			},
128			error: function (response) {
129				current_button.css('border-left', '2px solid #ca1010');
130			}
131		});
132	});
133
134	jQuery(document).on('change', 'div.af_quote_fields input[type="checkbox"], div.af_quote_fields select[multiple]', function(ev) {
135		
136		var current_button = jQuery(this);
137		if ( !current_button.val() || current_button.val().length < 1 ) {
138			if ( 'required' === current_button.attr('required')  ) {
139				current_button.css('border-left', '2px solid #ca1010');
140			}
141			return;
142		}		
143
144		jQuery.ajax({
145			url: ajaxUrl,
146			type: 'POST',
147			data: {
148				action   : 'cache_quote_fields',
149				nonce    : nonce,
150				form_data : jQuery(this).closest('form').serialize(),
151			},
152			success: function (response) {
153				current_button.css('border-left', '2px solid green');
154			},
155			error: function (response) {
156				current_button.css('border-left', '2px solid #ca1010');
157			}
158		});
159	});
160
161	(function ($) {
162		let ajaxRequest = null; 
163		let debounceTimer = null;
164	
165		$(document).on('click', 'button.afrfq_update_quote_btn', function (e) {
166			e.preventDefault();
167	
168			const current_button = $(this);
169			const form_type = $('form.addify-quote-form').data('form-type');
170			
171			var form_data = $(this).closest('form.addify-quote-form').serialize();
172				
173			current_button.addClass('loading');
174	
175			clearTimeout(debounceTimer);
176	
177			debounceTimer = setTimeout(function () {
178
179				if (ajaxRequest && ajaxRequest.readyState !== 4) {
180					ajaxRequest.abort();
181				}
182	
183				ajaxRequest = $.ajax({
184					url: ajaxUrl,
185					type: 'POST',
186					dataType: 'JSON',
187					data: {
188						action: 'update_quote_items',
189						nonce: nonce,
190						form_data: form_data,
191						quote_id: current_button.data('quote_id'),
192						form_type: form_type
193					},
194	
195					success: function (response) {
196						current_button.removeClass('loading').addClass('disabled');
197						$('.error, .woocommerce-error').remove();
198	
199						if (response['quote_empty']) {
200							location.reload();
201							return;
202						}
203	
204						$('div.woocommerce-notices-wrapper').html(response['message']);
205						$('table.addify-quote-form__contents').replaceWith(response['quote-table']);
206						$('table.table_quote_totals').replaceWith(response['quote-totals']);
207						$('li.quote-li').replaceWith(response['mini-quote']);
208	
209						$('body').animate({
210							scrollTop: $('div.woocommerce-notices-wrapper').offset().top
211						}, 500);
212	
213						$('.error, .woocommerce-error').remove();
214					},
215	
216					error: function (xhr, status) {
217						if (status !== 'abort') {
218							console.error('Quote update failed:', status);
219						}
220						current_button.removeClass('loading').addClass('disabled');
221					}
222				});
223			}, 200); 
224		});
225	})(jQuery);
226
227	jQuery(document).on('click', '.afrfqbt', function () {				
228
229		jQuery(this).closest('li').find('a.added_to_quote').remove();
230		var redirect = afrfq_phpvars.redirect;
231
232
233		if (jQuery(this).is('.product_type_simple')) {
234
235			var productId = jQuery(this).attr('data-product_id');
236			var ruleId = jQuery(this).attr('data-rule_id');
237			var quantity  = 1;
238
239			jQuery(this).addClass('loading');
240			var current_button = jQuery(this);
241			jQuery.ajax({
242				url: ajaxUrl,
243				type: 'POST',
244				data: {
245					action: 'add_to_quote',
246					product_id: productId,
247					rule_id:ruleId,
248					quantity: quantity,
249					nonce: nonce
250				},
251				success: function (response) {
252					if(response['price_calculator_product']){
253						window.location.href = response['redirect_to'];						
254						return;
255					}
256
257					if (response['popup_is_enabled'] === 'yes') {
258						jQuery(".afrfq-quote-popup-content").load(location.href + " .afrfq-quote-popup-content > *",function(){
259							jQuery('.adf-multi-select').select2();
260							//render captcha in popup
261							renderAfrfqCaptchaForPopup();
262						});
263						
264						jQuery(".afrfq-quote-popup-modal").css("display", "flex");
265						
266					 }else{
267						jQuery(".afrfq-quote-popup-modal").css("display", "none");
268					 }
269
270					if ( 'success' == jQuery.trim(response) ) {
271						if ( "yes" == redirect ) {
272							window.location.href = pageurl;
273						} else {
274
275							window.location = location.href;
276						}
277						
278					} else if ( 'failed' == jQuery.trim(response) ) {
279
280						window.location = location.href;
281						
282					} else {
283
284						current_button.removeClass('loading');
285						current_button.after( response['view_button'] );
286						jQuery('.quote-li').replaceWith(response['mini-quote']);
287
288					}	
289				}
290			});
291
292		}
293		return false;
294	});
295
296});
297
298
299function renderAfrfqCaptchaForPopup() {
300    const captchaEl = jQuery('#afrfq-recaptcha');
301
302    if (!captchaEl.is(':visible')) {
303        setTimeout(renderAfrfqCaptchaForPopup, 1000);
304        return;
305    }
306
307    // If already rendered, don't re-render
308    if (captchaEl.find('.g-recaptcha').length > 0) {
309        return;
310    }
311
312    const freshEl = jQuery('<div class="g-recaptcha"></div>')
313        .attr('data-sitekey', captchaEl.data('sitekey'));
314
315    captchaEl.append(freshEl);
316
317    try {
318        grecaptcha.render(freshEl.get(0), {
319            sitekey: freshEl.data('sitekey')
320        });
321    } catch (e) {
322        console.error("Failed to render reCAPTCHA", e);
323    }
324}
325
326
327jQuery(document).ready(function () {
328
329	"use strict";
330	var ajaxUrl  = afrfq_phpvars.admin_url;
331	var nonce    = afrfq_phpvars.nonce;
332	var redirect = afrfq_phpvars.redirect;
333	var pageurl  = afrfq_phpvars.pageurl;
334	var required = false;
335
336	jQuery(document).on('click','.afrfqbt_single_page', function ($) {				
337		
338		var current_button = jQuery(this);
339
340		jQuery(this).closest('form').find('a.added_to_quote').remove();
341
342		if(jQuery(this).data('button_type') && 'custom' == jQuery(this).data('button_type')){
343			jQuery('a.added_to_quote').remove();
344		}
345
346		if (jQuery(this).is('.product_type_variable')) {
347
348			if ( jQuery(this).hasClass('disabled') ) {
349				return;
350			}
351
352			jQuery(this).addClass('loading');
353
354			jQuery.ajax({
355				url: ajaxUrl,
356				type: 'POST',
357				data: {
358					action: 'add_to_quote_single_vari',
359					form_data: jQuery(this).closest('form').serialize(),
360					product_id: jQuery(this).data('product_id'),
361					rule_id: jQuery(this).data('rule_id'),
362					popup_enabled: jQuery(this).data('popup_enabled'),
363					button_type: jQuery(this).data('button_type'),
364					product_quantity:jQuery(this).data('product_quantity'),
365					parent_product_id:jQuery(this).data('parent_product_id'),
366					nonce: nonce
367				},
368				success: function (response) {
369
370					
371					if (response['popup_is_enabled'] === 'yes') {
372						jQuery(".afrfq-quote-popup-content").load(location.href + " .afrfq-quote-popup-content > *",function(){
373							jQuery('.adf-multi-select').select2();
374							//render captcha in popup
375							renderAfrfqCaptchaForPopup();
376						});
377
378						jQuery(".afrfq-quote-popup-modal").css("display", "flex");
379
380						
381						
382					 }else{
383						jQuery(".afrfq-quote-popup-modal").css("display", "none");
384					 }
385
386					if ('success' == jQuery.trim(response)) {
387						if ("yes" == redirect) {
388
389							window.location.href = pageurl;
390						} else {
391
392							window.location = location.href; 
393						}
394					} else if ( 'failed' == jQuery.trim(response) ) {
395
396						window.location = location.href;
397						
398					} else {
399
400						current_button.removeClass('loading');
401						if (response['popup_is_enabled'] !== 'yes') {
402							current_button.after( response['view_button'] );
403						}
404						jQuery('.quote-li').replaceWith(response['mini-quote']);
405					}
406				}
407			});
408
409		} else {
410			
411			var productId = jQuery(this).attr('data-product_id');
412			var quantity  = jQuery('.qty').val();				
413
414			jQuery(this).addClass('loading');
415
416			jQuery.ajax({
417				url: ajaxUrl,
418				type: 'POST',
419				data: {
420					action: 'add_to_quote_single',
421					form_data : jQuery(this).closest('form').serialize(),
422					product_id: jQuery(this).data('product_id'),
423					rule_id: jQuery(this).data('rule_id'),
424					popup_enabled: jQuery(this).data('popup_enabled'),
425					button_type: jQuery(this).data('button_type'),
426					product_quantity:jQuery(this).data('product_quantity'),
427					nonce: nonce
428				},
429				success: function (response) {				
430
431
432					if (response['popup_is_enabled'] === 'yes') {
433						jQuery(".afrfq-quote-popup-content").load(location.href + " .afrfq-quote-popup-content > *",function(){
434							jQuery('.adf-multi-select').select2();
435							//render captcha in popup
436							renderAfrfqCaptchaForPopup();
437						});
438
439						jQuery(".afrfq-quote-popup-modal").css("display", "flex");
440
441						
442					 }else{
443						jQuery(".afrfq-quote-popup-modal").css("display", "none");
444					 }
445
446					if ( 'success' == jQuery.trim(response) ) {
447						if ( "yes" == redirect ) {
448							window.location.href = pageurl;
449						} else {							
450							window.location = location.href;
451						}
452						
453					} else if ( 'failed' == jQuery.trim(response) ) {
454						window.location = location.href;	
455					} else {
456						current_button.removeClass('loading');
457						if(response['popup_is_enabled'] !== 'yes'){
458							current_button.after( response['view_button'] );
459						}
460						jQuery('.quote-li').replaceWith(response['mini-quote']);
461					}
462				}
463			});
464
465		}
466		return false;
467	});
468
469});
470
471// remove from quote
472jQuery(document).on('click', '.remove-quote-item', function (e) {
473	"use strict";
474	e.preventDefault();
475	var quoteKey = jQuery(this).data('cart_item_key');
476	var ajaxUrl  = afrfq_phpvars.admin_url;
477	var nonce    = afrfq_phpvars.nonce;
478	
479	jQuery(this).closest('tr').css('opacity', '0.5' );
480
481	const form_type = jQuery('form.addify-quote-form').data('form-type');
482
483	jQuery.ajax({
484		url: ajaxUrl,
485		type: 'POST',
486
487		data: {
488			action: 'remove_quote_item',
489			quote_key: jQuery(this).data('cart_item_key'),
490			nonce: nonce,
491			form_type: form_type,
492		},
493		success: function (response) {
494
495			if ( response['quote_empty'] ) {
496				location.reload();
497			}
498
499			jQuery('div.woocommerce-notices-wrapper').html(response['message'] );
500			jQuery('table.addify-quote-form__contents').replaceWith( response['quote-table'] );
501			jQuery('table.table_quote_totals').replaceWith( response['quote-totals'] );
502			jQuery('li.quote-li').replaceWith( response['mini-quote'] );
503			jQuery('body').animate({
504				scrollTop: jQuery('div.woocommerce-notices-wrapper').offset().top,
505				}, 500
506			);
507		}
508	});
509});
510
511// removal from mini quote
512jQuery(document).on('click', '.quote-remove', function (event) {
513	"use strict";
514	event.preventDefault();
515	var quoteKey = jQuery(this).data('cart_item_key');
516	var ajaxUrl  = afrfq_phpvars.admin_url;
517	var nonce    = afrfq_phpvars.nonce;
518	
519	jQuery(this).closest('li.mini_quote_item').css('opacity', '0.5' );
520
521	jQuery.ajax({
522		url: ajaxUrl,
523		type: 'POST',
524		data: {
525			action: 'remove_quote_item',
526			quote_key: jQuery(this).data('cart_item_key'),
527			nonce: nonce
528		},
529		success: function (response) {
530
531			jQuery('div.woocommerce-notices-wrapper').html(response['message'] );
532			jQuery('table.addify-quote-form__contents').replaceWith( response['quote-table'] );
533			jQuery('table.table_quote_totals').replaceWith( response['quote-totals'] );
534			jQuery('li.quote-li').replaceWith( response['mini-quote'] );
535		}
536	});
537
538	// Check if the WooCommerce shop block exists
539
540});
541
542// Update quantity
543jQuery(document).on('change', 
544  '.addify-quote-form__contents .product-quantity .qty, .offered-price .offered-price-input', 
545  function (e) {
546    "use strict";
547    e.preventDefault();
548    
549    var quoteKey = jQuery(this).val(); // yeh current input ka value leta hai.
550    var updateButton = jQuery(this).closest('.addify-quote-form').find('.afrfq_update_quote_btn'); // update button select karta hai.
551
552    
553      updateButton.trigger('click'); // 5 seconds baad update button par click trigger karta hai.
554     
555});
556
557jQuery(document).ready(function($){
558	setTimeout(function(){
559		if ($('.wp-block-woocommerce-product-template').length || $('.wp-block-group.woocommerce.product ').length) {
560			 $('.afrfqbt.button').each(function() {
561	            $(this).parent('li').css('text-align', 'center');
562	        });
563	        $('.afrfqbt.button').addClass('wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive');
564	    }
565	    if ($('.woocommerce .wp-block-column').length) {
566	        $('.afrfqbt_single_page.button').addClass('wp-element-button');
567	        $('.afrfqbt_single_page.button').css({'float': 'none', 'margin-bottom': '10px', 'display': 'inline-block'});
568	    }
569	}, 2000);
570
571
572	//quote popup setting
573	$(document).on('click','.afrfq-close-popup,.afrfq-continue-button',function(){
574		$(".afrfq-quote-popup-modal").hide();
575	})
576
577	function popup_checkout_place_quote(formData,popupTemplate,currentPage=''){
578
579		formData.append('action', 'afrfq_submit_quote_via_popup');
580		formData.append('popup_template',popupTemplate);
581		formData.append('current_page',currentPage);
582
583
584		var ajaxUrl  = afrfq_phpvars.admin_url;
585
586			return new Promise((resolve, reject) => {
587				jQuery.ajax({
588					url: ajaxUrl,
589					type: 'POST',
590					data: formData,
591					processData: false,
592					contentType: false,
593					success: function(response) {
594						$('.addify_popup_checkout_place_quote').removeClass('loading');
595						$('.addify_popup_checkout_place_quote').removeClass('disabled');
596						if (response.status === 'fail') {
597							var noticeContainer = $('#popup-notice-container');
598							noticeContainer.html(response.notices_html).show();
599							$('.afrfq-quote-popup-content').animate({ scrollTop: 0 }, 'slow');
600							// $('.afrfq-product-selection-section').animate({ scrollTop: 0 }, 'slow');
601							
602							resolve(false); 
603						} else if (response.status === 'pass') {
604							if('template_two' == popupTemplate && '1' == currentPage){
605								resolve(true); 
606							}
607							else if('template_two' == popupTemplate && '2' == currentPage){
608								$('.popup-form-template_two').append(response.data);
609								$('.af_quote_fields_template_two').toggle();
610							}
611							else{
612								$('#popup-notice-container').hide();
613								$('.afrfq-quote-inner-content').remove();
614								$('.afrfq-popup-form-inner').remove();
615								$('.afrfq-quote-popup-content').append(response.data);
616							}
617							resolve(true); 
618							
619							
620						}
621					},
622					error: function(xhr, status, error) {
623						console.error("Error submitting form", error);
624						resolve(false); 
625					}
626				});
627			});
628		
629
630		
631	}
632
633	//handling quote submission via ajax
634	jQuery(document).on('click', '.addify_popup_checkout_place_quote', function(event) {
635		event.preventDefault();
636		
637		var form = jQuery(this).closest('form')[0];
638		
639		if (form.checkValidity()) {
640			var formData = new FormData(form);
641			$(this).addClass('loading disabled');
642			popup_checkout_place_quote(formData, 'template_one');			
643			if(afrfq_phpvars.redirect_to_url){
644				window.location.href = afrfq_phpvars.redirect_to_url;
645			}
646		} else {
647			
648			form.reportValidity();
649		}
650	});
651
652	function popup_data_saved(){
653		return new Promise((resolve, reject) => {
654			jQuery.ajax({
655				url: ajaxUrl,
656				type: 'POST',
657				data: {
658					action   : 'cache_quote_fields',
659					nonce    : nonce,
660					form_data : jQuery('form.popup-form-template_two').serialize(),
661				},
662				success: function (response) {
663					resolve(true); 				
664				},
665				error: function (response) {
666					resolve(false); 
667				}
668			});
669		});
670	}
671
672	if($('.adf-request-quote-popup.template_two').length){
673		updateFormState();
674		
675		jQuery(document).on('click', '.afrfq-right-button', async function(){ 
676			let currentStep = parseInt($('.afrfq-popup-form-steps').attr('data-current-page')) || 1;
677			if (currentStep === 1 ) {
678
679				var form = jQuery('.af_quote_fields_template_two').closest('form')[0];
680				var screenTwoFields = $('.af_quote_fields').find(':input'); // Target only screen 2 fields
681
682				// Disable screen 2 fields before validation
683				screenTwoFields.prop('disabled', true);
684
685				if (!form.checkValidity()) {
686					// updateFormState();
687					form.reportValidity();
688				}
689
690				// } else {
691				// }
692
693				$(this).addClass('loading disabled'); 
694				$('.afrfq-left-button').addClass('disabled');
695
696				var formData = new FormData(form);
697
698				const isSuccess = await popup_checkout_place_quote(formData,'template_two','1');
699				
700				if (isSuccess) {
701					$('.afrfq-popup-form-steps').attr('data-current-page', currentStep + 1);
702					$(this).removeClass('loading disabled'); 
703					$('.afrfq-left-button').removeClass('disabled');            
704					updateFormState();
705				}
706				else{
707					$(this).removeClass('loading disabled'); 
708					$('.afrfq-left-button').removeClass('disabled');  
709					$('.afrfq-product-selection-section').animate({ scrollTop: 0 }, 'slow');
710				}
711
712				
713				// Re-enable screen 2 fields after validation
714				screenTwoFields.prop('disabled', false);
715
716			}
717			else if (currentStep === 2) {
718				
719				var form = jQuery('.af_quote_fields_template_two').closest('form')[0];
720
721				jQuery('#popup-notice-container').hide();
722
723
724				if (form.checkValidity()) {
725					var formData = new FormData(form);
726					$(this).addClass('loading disabled'); 
727					$('.afrfq-left-button').addClass('disabled');  
728					
729					const isDataSaved = await popup_data_saved();
730					const isSuccess = await popup_checkout_place_quote(formData,'template_two','2');
731				
732					if (isSuccess) {
733						$('.afrfq-popup-form-steps').attr('data-current-page', currentStep + 1);
734						$(this).removeClass('loading disabled'); 
735						$('.afrfq-left-button').removeClass('disabled');            
736						updateFormState();
737					}
738					else{
739						$(this).removeClass('loading disabled'); 
740						$('.afrfq-left-button').removeClass('disabled');  
741						$('.afrfq-product-selection-section').animate({ scrollTop: 0 }, 'slow');
742					}
743
744				} else {
745					form.reportValidity();
746				}
747				
748			} 
749			else if (currentStep === 3) {					
750				var form = jQuery('.af_quote_fields_template_two').closest('form')[0];
751				var formData = new FormData(form);
752				$(this).addClass('loading disabled'); 
753				popup_checkout_place_quote(formData,'template_two');
754				if(''!= afrfq_phpvars.redirect_to_url){
755					window.location.href = afrfq_phpvars.redirect_to_url;
756				}
757				
758			}
759		});
760		
761		jQuery(document).on('click', '.afrfq-left-button', function(){
762			let currentStep = parseInt($('.afrfq-popup-form-steps').attr('data-current-page')) || 1;
763			if (currentStep > 1) {
764				$('.afrfq-popup-form-steps').attr('data-current-page', currentStep - 1);
765				updateFormState();
766			} else {
767				$(".afrfq-quote-popup-modal").hide();
768			}
769		});
770		
771		function updateFormState() {
772
773			if (!$('.adf-multi-select').hasClass('select2-hidden-accessible')) {
774				$('.adf-multi-select').select2();
775			}
776
777			let currentStep = parseInt($('.afrfq-popup-form-steps').attr('data-current-page')) || 1;
778			
779			currentStep = Math.max(1, Math.min(3, currentStep));
780			
781			$('.afrfq-popup-form-step').removeAttr('data-active');
782			$(`.afrfq-popup-form-step:nth-child(${currentStep})`).attr('data-active', 'true');
783			
784			$('.afrfq-left-button').text(currentStep === 1 ? 'Continue Shopping' : 'Previous step');
785			
786			$('.afrfq-right-button').text(currentStep === 3 ? 'Submit Request' : 'Next step');
787			
788			$('.adf-quote-detail-wrap').toggle(currentStep === 1);
789			$('.af_quote_fields_template_two').toggle(currentStep == 2 );
790
791			if(currentStep == 1 || currentStep == 2){
792				$('.afrfq-popup-review-info-page').remove();
793			}
794		}
795	}
796
797	// Remove remove links in blocks cart in case of quote to cart conversion
798	if ( window.wc && window.wc.blocksCheckout ) {
799		const { registerCheckoutFilters } = window.wc.blocksCheckout;
800
801		const modifyShowRemoveItemLink = ( defaultValue, extensions, args ) => {
802			const isCartContext = args?.context === 'cart';
803
804			if ( ! isCartContext ) {
805				return defaultValue;
806			}
807			if ( args.cart?.extensions?.addify_rfq?.quote_conversion ) {
808				return false;
809			}
810			return defaultValue;
811		};
812
813		registerCheckoutFilters( 'afrfq-remove-item-link-extension', {
814			showRemoveItemLink: modifyShowRemoveItemLink,
815		} );
816	}
817
818	//for checkout blocks -- Comapring email at checkout for guest users
819	setTimeout(function() {
820		const placeOrderBtn = document.querySelector('.wc-block-components-checkout-place-order-button');
821		
822		if (placeOrderBtn) {
823			placeOrderBtn.addEventListener('click', function(e) {
824				// Get the email from the form
825				const emailInput = document.getElementById('email');
826				const enteredEmail = emailInput.value;
827				
828				// Check if the entered email matches the quote email
829				if (afrfq_phpvars.quote_to_cart_data && 
830					afrfq_phpvars.quote_to_cart_data.quote_email &&
831					enteredEmail !== afrfq_phpvars.quote_to_cart_data.quote_email) {
832					
833					// Show error message
834					addErrorNotice(afrfq_phpvars.quote_to_cart_data.quote_message);
835					window.scrollTo({ top: 0, behavior: 'smooth' });
836					
837					e.preventDefault();
838					e.stopPropagation();
839					return false;
840				}
841				
842				// If emails match, allow form submission
843				return true;
844			});
845		}
846	}, 1000);
847
848	const ajaxUrl  = afrfq_phpvars.admin_url;
849	const nonce    = afrfq_phpvars.nonce;
850
851	jQuery(document).on('click', 'button[name="afrfq_clear_cart"]', function() {
852		$(this).addClass('loading');
853		jQuery.ajax({
854			url: ajaxUrl,
855			type: 'POST',
856			data: {
857				action     : 'afrfq_clear_cart',
858				nonce      : nonce,
859			},
860			success: function (response) {
861				if(response.success){
862					location.reload();
863				}
864			},
865			error: function (response) {
866	
867				// console.log( response );
868				
869			}
870		});
871	});
872
873	
874
875	function addErrorNotice(message){
876		jQuery('#guest-user-email-notice').remove();
877		jQuery('#main').before(
878			'<div class="wc-block-components-notice-banner is-error" id="guest-user-email-notice" role="alert">' +
879				'<div class="wc-block-components-notice-banner__content">' +
880				message +
881				'</div></div>'
882		);
883	}
884	
885
886	
887	
888
889});

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.