94f6e749a0
Recovers original JS from git history and ports it into proper El source files under src/js/. Each file wraps the original JS in a native_js call inside a main() function, making it valid El that compiles to a self-contained IIFE via elc --target=js --bundle. Files added: src/js/account-auth.el - Supabase OTP magic-link (sendMagicLink) src/js/account-dashboard.el - Account dashboard: session, plan card, family src/js/chat-widget.el - Demo chat widget (neuronDemoToggle/Send/Reset) src/js/checkout-auth.el - Checkout auth: OAuth, email sign-in/up src/js/checkout-free.el - Free plan: auth-badge watch -> payment reveal src/js/checkout-stripe.el - Stripe Payment Element (reads NEURON_CFG) src/js/enterprise.el - Enterprise inquiry form + headcount filter src/js/environmental.el - Efficiency calculator slider src/js/gallery.el - Gallery nav, search/sort, Supabase voting src/js/main.el - Share page voting + copyForPlatform src/js/marketplace.el - Developer interest form src/js/nav.el - Nav hamburger + Mission dropdown src/js/styles.el - Landing: nav scroll, reveal, founding counter
67 lines
2.8 KiB
EmacsLisp
67 lines
2.8 KiB
EmacsLisp
// enterprise.el -- Enterprise inquiry form submission and headcount filter.
|
|
// Compiled with: elc --target=js --bundle --minify --obfuscate
|
|
//
|
|
// Exposed globals: entHeadcountChange(val)
|
|
|
|
fn main() -> Void {
|
|
native_js("(function() {
|
|
var form = document.getElementById('enterprise-form');
|
|
var submitBtn = document.getElementById('ent-submit');
|
|
var successDiv = document.getElementById('enterprise-success');
|
|
var errorDiv = document.getElementById('ent-form-error');
|
|
|
|
if (!form) return;
|
|
|
|
window.entHeadcountChange = function(val) {
|
|
var msgSecondary = document.getElementById('ent-filter-msg-secondary');
|
|
var msgYes = document.getElementById('ent-filter-msg-yes');
|
|
if (msgSecondary) msgSecondary.style.display = val === 'secondary' ? 'block' : 'none';
|
|
if (msgYes) msgYes.style.display = val === 'yes' ? 'block' : 'none';
|
|
if (submitBtn) {
|
|
submitBtn.disabled = val === 'yes';
|
|
submitBtn.style.opacity = val === 'yes' ? '0.35' : '1';
|
|
submitBtn.style.cursor = val === 'yes' ? 'not-allowed' : 'pointer';
|
|
}
|
|
};
|
|
|
|
form.addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
var headcount = document.getElementById('ent-headcount').value;
|
|
if (headcount === 'yes') {
|
|
var msgYes = document.getElementById('ent-filter-msg-yes');
|
|
if (msgYes) msgYes.style.display = 'block';
|
|
return;
|
|
}
|
|
|
|
var name = document.getElementById('ent-name').value.trim();
|
|
var email = document.getElementById('ent-email').value.trim();
|
|
var company = document.getElementById('ent-company').value.trim();
|
|
var size = document.getElementById('ent-size').value;
|
|
var useCase = document.getElementById('ent-use').value.trim();
|
|
|
|
if (!name || !email || !company || !size || !useCase || !headcount) {
|
|
if (errorDiv) { errorDiv.textContent = 'Please fill out all fields.'; errorDiv.style.display = 'block'; }
|
|
return;
|
|
}
|
|
|
|
if (errorDiv) errorDiv.style.display = 'none';
|
|
if (submitBtn) { submitBtn.textContent = 'Sending...'; submitBtn.disabled = true; }
|
|
|
|
fetch('/api/enterprise-inquiry', {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({ name: name, email: email, company: company, size: size, use_case: useCase, headcount: headcount })
|
|
})
|
|
.then(function(r) { return r.json(); })
|
|
.then(function() {
|
|
if (form) form.style.display = 'none';
|
|
if (successDiv) successDiv.style.display = 'block';
|
|
})
|
|
.catch(function() {
|
|
if (submitBtn) { submitBtn.textContent = 'Send inquiry →'; submitBtn.disabled = false; }
|
|
if (errorDiv) { errorDiv.textContent = 'Something went wrong. Email enterprise@neurontechnologies.ai directly.'; errorDiv.style.display = 'block'; }
|
|
});
|
|
});
|
|
})()")
|
|
}
|