From 3b83905603d44b1a08f8b2b36a605808ce686ad6 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 02 Jun 2026 00:46:48 +0000
Subject: [PATCH] =double checking schema outputs for legacytattooremoval

---
 assets/js/concise/Referral.js |   30 +++++++++++++-----------------
 1 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/assets/js/concise/Referral.js b/assets/js/concise/Referral.js
index 6435e98..e715af0 100644
--- a/assets/js/concise/Referral.js
+++ b/assets/js/concise/Referral.js
@@ -35,7 +35,7 @@
 		};
 
 		this.forms = this.container.querySelectorAll('form');
-		this.popup = new window.jvbPopup({
+		this.popup = window.jvbPopup.registerPopup({
 			toggle: this.toggle,
 			popup: this.container,
 			name: 'Referral Box',
@@ -50,7 +50,7 @@
 		this.tabs = null;
 
 		if (this.container.querySelector('nav.tabs')) {
-			this.tabs = new window.jvbTabs(this.container, {updateURL: false});
+			this.tabs = window.jvbTabs.registerTab(this.container, {updateURL: false});
 		}
 
 
@@ -63,7 +63,6 @@
 				btn.remove();
 			});
 		}
-		this.formController = null;
 	}
 
 	initStore() {
@@ -641,8 +640,9 @@
 					referral_code: formData.get('referral_code')
 				};
 
-				if (formData.get('cf-turnstile-response')) {
-					data['cf-turnstile-response'] = formData.get('cf-turnstile-response');
+				const turnstileInput = form.querySelector('input[name="cf-turnstile-response"]');
+				if (turnstileInput && turnstileInput.value) {
+					data['cf-turnstile-response'] = turnstileInput.value;
 				}
 
 				if (!data.name || !data.email || !data.referral_code) {
@@ -653,18 +653,19 @@
 			} else if (form.id === 'login-form') {
 				let data = {
 					type: 'login',
-					email: formData.get('login_email'),
+					user_email: formData.get('login_email'),
 					context: {
 						redirect_to: window.location.href + '?seeReferral=1'
 					}
 				};
-				if (formData.get('cf-turnstile-response')) {
-					data['cf-turnstile-response'] = formData.get('cf-turnstile-response');
+				const turnstileInput = form.querySelector('input[name="cf-turnstile-response"]');
+				if (turnstileInput && turnstileInput.value) {
+					data['cf-turnstile-response'] = turnstileInput.value;
 				}
-				if (!data.email) {
+				if (!data['user_email']) {
 					result.message = 'Please fill in your email';
 				} else {
-					result = await this.makeRequest('magic', data);
+					result = await this.makeRequest('auth/magic', data);
 				}
 			}
 
@@ -683,7 +684,7 @@
 
 	async makeRequest(endpoint, data) {
 		const validEndpoints = [
-			'magic',
+			'auth/magic',
 			'auth/register'
 		];
 
@@ -691,16 +692,11 @@
 			return { success: false, message: 'Invalid endpoint' };
 		}
 
-		const response = await fetch(`${jvbSettings.api}${endpoint}`, {
+		const response = await window.auth.fetch(`${jvbSettings.api}${endpoint}`, {
 			method: 'POST',
-			headers: {
-				'Content-Type': 'application/json',
-				'X-WP-Nonce': window.auth.getNonce(),
-			},
 			body: JSON.stringify(data)
 		});
 
-		// Add error handling to see the actual response
 		if (!response.ok) {
 			const errorText = await response.text();
 			console.error('Error response:', response.status, errorText);

--
Gitblit v1.10.0