Vape OS

Welcome to Vape OS

Your journey to a smoke-free life starts here

🚭

I am a...

Choose your user type to get personalized content

Let's get to know you

This helps us personalize your experience

Your smoking habits

Be honest - there's no judgment here

Your quit journey

Your experience helps us support you better

Tell us about your shop

Basic information about your vape business

Location & Contact Details

Help customers find and contact your shop

Services & Products

What do you offer to customers?

Create your account

Secure your progress and track your journey

At least 8 characters
// Redirect after delay setTimeout(function() { if (response.data.redirect) { window.location.href = response.data.redirect; } else if (response.data.refresh) { location.reload(); } }, 2000); } else { alert(response.data.message || 'An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }, error: function() { alert('An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }); }); // Handle login form submission $('#login-form').on('submit', function(e) { e.preventDefault(); var $form = $(this); var $submitBtn = $form.find('button[type="submit"]'); var originalText = $submitBtn.text(); $submitBtn.text('Signing in...').prop('disabled', true); $.ajax({ url: vape_os_ajax.ajax_url, type: 'POST', data: { action: 'vape_os_login', email: $('#login_email').val(), password: $('#login_password').val(), nonce: $('#login_nonce').val() || vape_os_ajax.nonce }, success: function(response) { if (response.success) { if (response.data.redirect) { window.location.href = response.data.redirect; } else { location.reload(); } } else { alert(response.data.message || 'Invalid login credentials'); $submitBtn.text(originalText).prop('disabled', false); } }, error: function() { alert('An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }); }); // Toggle between login and register forms $('#show-login').on('click', function(e) { e.preventDefault(); $('.onboarding-form').hide(); $('#login-form').show(); }); $('#show-register').on('click', function(e) { e.preventDefault(); $('#login-form').hide(); $('.onboarding-form').show(); }); // Handle smoking frequency change (consumer flow) $(document).on('change', 'input[name="smoking_frequency"]', function() { var value = $(this).val(); if (value === 'quit' || value === 'never') { $('.smoking-fields').hide(); $('.smoking-fields select').prop('required', false); } else { $('.smoking-fields').show(); } }); // Collect form data based on user type function collectFormData() { var formData = { action: 'vape_os_submit_form', nonce: vape_os_ajax.nonce, user_type: userType }; // Add account data if not logged in if (!false) { formData.email = $('#user_email').val(); formData.password = $('#user_password').val(); } // Add user name formData.name = $('#user_name').val() || ''; if (userType === 'consumer') { // Collect consumer data formData.age = $('#user_age').val() || ''; formData.smoking_frequency = $('input[name="smoking_frequency"]:checked').val() || ''; formData.cigarettes_per_day = $('#cigarettes_per_day').val() || ''; formData.years_smoking = $('#years_smoking').val() || ''; formData.quit_attempts = $('#quit_attempts').val() || ''; // Collect quit aids var quitAids = []; $('input[name="quit_aids[]"]:checked').each(function() { quitAids.push($(this).val()); }); formData.quit_aids = quitAids; } else if (userType === 'shop') { // Collect shop owner data formData.user_type = 'shop_owner'; // Correct the user type for backend formData.shop_name = $('#shop_name').val() || ''; formData.business_type = $('#business_type').val() || ''; formData.years_in_business = $('#years_in_business').val() || ''; formData.shop_description = $('#shop_description').val() || ''; formData.shop_address = $('#shop_address').val() || ''; formData.shop_city = $('#shop_city').val() || ''; formData.shop_postcode = $('#shop_postcode').val() || ''; formData.shop_country = 'United Kingdom'; // Default country formData.shop_phone = $('#shop_phone').val() || ''; formData.shop_email = $('#shop_email').val() || ''; formData.shop_website = $('#shop_website').val() || ''; formData.payment_methods = $('#payment_methods').val() || ''; formData.shop_languages = $('#languages_spoken').val() || ''; formData.special_features = $('#special_features').val() || ''; // Collect shop services var shopServices = []; $('input[name="shop_services[]"]:checked').each(function() { shopServices.push($(this).val()); }); formData.shop_services = shopServices.join(','); } return formData; } // Submit form data via AJAX $('#vape-os-onboarding-form').on('submit', function(e) { e.preventDefault(); var $form = $(this); var $submitBtn = $form.find('button[type="submit"]'); var originalText = $submitBtn.text(); $submitBtn.text('Creating account...').prop('disabled', true); // Collect all form data var formData = collectFormData(); $.ajax({ url: vape_os_ajax.ajax_url, type: 'POST', data: formData, success: function(response) { if (response.success) { // Show success message $('.onboarding-form').hide(); // Create and show success message var successHtml = '

Welcome to Vape OS!

' + response.data.message + '

'; $('.onboarding-content').html(successHtml); // Redirect after delay setTimeout(function() { if (response.data.redirect) { window.location.href = response.data.redirect; } else { location.reload(); } }, 2000); } else { alert(response.data.message || 'An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }, error: function() { alert('An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }); }); }); else { location.reload(); } } else { alert(response.data.message || 'Invalid login credentials'); $submitBtn.text(originalText).prop('disabled', false); } }, error: function() { alert('An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }); }); // Toggle between login and register forms $('#show-login').on('click', function(e) { e.preventDefault(); $('.onboarding-form').hide(); $('#login-form').show(); }); $('#show-register').on('click', function(e) { e.preventDefault(); $('#login-form').hide(); $('.onboarding-form').show(); }); // Handle smoking frequency change (consumer flow) $(document).on('change', 'input[name="smoking_frequency"]', function() { var value = $(this).val(); if (value === 'quit' || value === 'never') { $('.smoking-fields').hide(); $('.smoking-fields select').prop('required', false); } else { $('.smoking-fields').show(); } }); }); } else if (response.data.refresh) { location.reload(); } }, 2000); } else { alert(response.data.message || 'An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }, error: function() { alert('An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }); }); // Handle login form submission $('#login-form').on('submit', function(e) { e.preventDefault(); var $form = $(this); var $submitBtn = $form.find('button[type="submit"]'); var originalText = $submitBtn.text(); $submitBtn.text('Signing in...').prop('disabled', true); $.ajax({ url: vape_os_ajax.ajax_url, type: 'POST', data: { action: 'vape_os_login', email: $('#login_email').val(), password: $('#login_password').val(), nonce: $('#login_nonce').val() || vape_os_ajax.nonce }, success: function(response) { if (response.success) { if (response.data.redirect) { window.location.href = response.data.redirect; } else { location.reload(); } } else { alert(response.data.message || 'Invalid login credentials'); $submitBtn.text(originalText).prop('disabled', false); } }, error: function() { alert('An error occurred. Please try again.'); $submitBtn.text(originalText).prop('disabled', false); } }); }); // Toggle between login and register forms $('#show-login').on('click', function(e) { e.preventDefault(); $('.onboarding-form').hide(); $('#login-form').show(); }); $('#show-register').on('click', function(e) { e.preventDefault(); $('#login-form').hide(); $('.onboarding-form').show(); }); // Handle smoking frequency change (consumer flow) $(document).on('change', 'input[name="smoking_frequency"]', function() { var value = $(this).val(); if (value === 'quit' || value === 'never') { $('.smoking-fields').hide(); $('.smoking-fields select').prop('required', false); } else { $('.smoking-fields').show(); } }); }); $('#show-register').on('click', function(e) { e.preventDefault(); $('#login-form').hide(); $('.onboarding-form').show(); }); // Handle smoking frequency change $('#smoking_frequency').on('change', function() { var value = $(this).val(); if (value === 'quit' || value === 'never') { $('.smoking-fields').hide(); $('.smoking-fields select').prop('required', false); } else { $('.smoking-fields').show(); } }); });