Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da5d498de5 |
+41
-6
@@ -651,7 +651,8 @@ fn account_roadmap_phase2() -> String {
|
||||
el_li("", "Process and knowledge packets") +
|
||||
el_li("", "Local inference via Ollama") +
|
||||
el_li("", "Additional connectors — GitHub, Notion, Linear, more") +
|
||||
el_li("", "Mobile companion app")
|
||||
el_li("", "Mobile companion app") +
|
||||
el_li("", "Family accounts")
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -691,6 +692,33 @@ fn account_roadmap_section() -> String {
|
||||
)
|
||||
}
|
||||
|
||||
fn account_family_section() -> String {
|
||||
let child_attest: String = "<label style=\"display:flex;gap:.5rem;align-items:flex-start;cursor:pointer;margin:.75rem 0\">" +
|
||||
"<input type=\"checkbox\" id=\"family-attest\" style=\"margin-top:.2rem;accent-color:var(--navy)\">" +
|
||||
"<span style=\"font-size:.8rem;color:var(--t2)\">I confirm this person is a minor under my care and is using this account under my supervision.</span>" +
|
||||
"</label>"
|
||||
el_div(
|
||||
"id=\"family-section\" style=\"display:none\"",
|
||||
el_div(
|
||||
"class=\"card-dark\"",
|
||||
el_div(
|
||||
"class=\"acct-section-header\"",
|
||||
el_p("class=\"card-label\"", "Family members") +
|
||||
el_p("style=\"font-size:.8125rem;font-weight:300;color:var(--t2);line-height:1.65\"", "Add up to 5 children to your Founding Member plan. $10/month per child.")
|
||||
) +
|
||||
el_div("id=\"family-list\"", "") +
|
||||
el_div(
|
||||
"id=\"add-child-form\"",
|
||||
el_input("email", "id=\"child-email\" placeholder=\"Child's email\" class=\"acct-input\"") +
|
||||
el_input("number", "id=\"child-dob-year\" placeholder=\"Birth year (e.g. 2012)\" min=\"1990\" max=\"2007\" class=\"acct-input\"") +
|
||||
child_attest +
|
||||
el_button("class=\"btn-primary\" onclick=\"addFamilyMember()\" style=\"padding:.75rem 1.5rem\"", "Add family member") +
|
||||
el_p("id=\"family-msg\" style=\"display:none;font-size:.8rem;margin-top:.5rem\"", "")
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn account_badge_section() -> String {
|
||||
el_div(
|
||||
"id=\"badge-section\" style=\"display:none\"",
|
||||
@@ -772,11 +800,17 @@ fn account_download_card() -> String {
|
||||
el_div(
|
||||
"class=\"card-dark\" style=\"border-top:3px solid var(--navy)\"",
|
||||
el_p("class=\"card-label\"", "Download") +
|
||||
el_p("class=\"download-status\" style=\"color:var(--navy)\"", "Shipping within 30 days") +
|
||||
el_p("class=\"download-title\"", "Neuron for Mac & Windows") +
|
||||
el_p("class=\"download-body\"", "macOS and Windows simultaneously. You'll receive a download link and license key by email the moment it ships. Nothing to do right now.") +
|
||||
el_button("type=\"button\" class=\"download-btn-disabled\" disabled aria-disabled=\"true\"",
|
||||
account_signin_svg_download() + " Download arriving soon"
|
||||
el_p("class=\"download-status\" style=\"color:var(--navy)\"", "Available now — macOS") +
|
||||
el_p("class=\"download-title\"", "Neuron for Mac") +
|
||||
el_p("class=\"download-body\"", "The macOS build (Apple Silicon) is ready to download now. Windows and Linux are coming soon. Your license key is in your launch email.") +
|
||||
el_div(
|
||||
"style=\"display:flex;gap:.75rem;flex-wrap:wrap;align-items:center\"",
|
||||
el_a(
|
||||
"https://downloads.neurontechnologies.ai/installers/Neuron-1.1.0-macos-arm64.dmg",
|
||||
"class=\"btn-primary\" download",
|
||||
account_signin_svg_download() + " Download for macOS"
|
||||
) +
|
||||
el_a("/downloads", "class=\"btn-ghost\"", "All platforms →")
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -924,6 +958,7 @@ fn account_dashboard_section() -> String {
|
||||
account_plan_card() +
|
||||
account_api_keys_section() +
|
||||
account_roadmap_section() +
|
||||
account_family_section() +
|
||||
account_badge_section() +
|
||||
account_timeline_card() +
|
||||
account_download_card() +
|
||||
|
||||
+2
-2
@@ -129,8 +129,8 @@ fn comparison_rows() -> String {
|
||||
"<td style=\"text-align:center;padding:1rem;color:var(--t3)\"><span style=\"font-weight:500;color:var(--t2)\">$30/mo</span><br><span style=\"font-size:0.7rem\">Microsoft 365</span></td>" +
|
||||
"</tr>"
|
||||
let row10: String = "<tr>" +
|
||||
"<td style=\"padding:1rem 1.5rem 1rem 0;color:var(--t1);font-weight:500\">Free trial</td>" +
|
||||
"<td style=\"text-align:center;padding:1rem\"><span style=\"color:#008040;font-weight:700;font-size:1.1rem\">✓</span><br><span style=\"font-size:0.7rem;color:var(--t3);font-weight:400\">Full app, 14 days</span></td>" +
|
||||
"<td style=\"padding:1rem 1.5rem 1rem 0;color:var(--t1);font-weight:500\">Free tier</td>" +
|
||||
"<td style=\"text-align:center;padding:1rem\"><span style=\"color:#008040;font-weight:700;font-size:1.1rem\">✓</span><br><span style=\"font-size:0.7rem;color:var(--t3);font-weight:400\">Full app, forever</span></td>" +
|
||||
"<td style=\"text-align:center;padding:1rem;color:var(--t3)\"><span style=\"color:#D4A017\">●</span><br><span style=\"font-size:0.7rem\">GPT-3.5 only</span></td>" +
|
||||
"<td style=\"text-align:center;padding:1rem;color:var(--t3)\"><span style=\"color:#D4A017\">●</span><br><span style=\"font-size:0.7rem\">Limited</span></td>" +
|
||||
"<td style=\"text-align:center;padding:1rem;color:var(--t3)\"><span style=\"color:#D4A017\">●</span><br><span style=\"font-size:0.7rem\">Limited</span></td>" +
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
// components/downloads.el - Public downloads page.
|
||||
//
|
||||
// Landing-styled inner page (page_open_seo + nav + content + footer +
|
||||
// page_close, assembled by main.el). Client-side OS detection via
|
||||
// navigator.platform highlights the visitor's platform and updates the
|
||||
// detected-OS banner. macOS is the shipping build; Windows and Linux are
|
||||
// linked but clearly marked "coming soon" per the current product state
|
||||
// (Windows chat not yet enabled, Linux soul backend not yet complete).
|
||||
|
||||
from nav import { nav }
|
||||
from footer import { footer }
|
||||
|
||||
extern fn el_section(attrs: String, children: String) -> String
|
||||
extern fn el_div(attrs: String, children: String) -> String
|
||||
extern fn el_span(attrs: String, children: String) -> String
|
||||
extern fn el_h1(attrs: String, text: String) -> String
|
||||
extern fn el_p(attrs: String, children: String) -> String
|
||||
extern fn el_a(href: String, attrs: String, children: String) -> String
|
||||
|
||||
// Scoped presentation. Uses the landing stylesheet's CSS variables
|
||||
// (--navy, --head, --body, --t2, --t3) so it inherits the site palette.
|
||||
// No # colors or quoted font names inline — routed through vars to stay
|
||||
// clear of the elc CSS tokenizer edge cases.
|
||||
fn dl_style() -> String {
|
||||
"<style>" +
|
||||
".dl-wrap{max-width:960px}" +
|
||||
".dl-detected{font-size:.85rem;font-weight:500;color:var(--navy);margin:1.5rem 0 2.5rem;min-height:1.2em}" +
|
||||
".dl-card{padding:2rem}" +
|
||||
".dl-featured{border-top:3px solid var(--navy)}" +
|
||||
".dl-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-top:1.5rem}" +
|
||||
"@media (max-width:720px){.dl-grid{grid-template-columns:1fr}}" +
|
||||
".dl-badge{display:inline-block;font-size:.6rem;font-weight:700;letter-spacing:.18em;text-transform:uppercase;padding:.35rem .7rem;border-radius:999px;margin-bottom:1rem}" +
|
||||
".dl-badge-ready{color:var(--navy);background:rgba(0,82,160,.10)}" +
|
||||
".dl-badge-soon{color:var(--t3);background:rgba(0,0,0,.05)}" +
|
||||
".dl-title{font-family:var(--head);font-size:1.4rem;font-weight:600;margin-bottom:.4rem}" +
|
||||
".dl-sub{font-family:var(--body);font-weight:300;font-size:.9rem;color:var(--t2);line-height:1.6;margin-bottom:1.25rem}" +
|
||||
".dl-note{font-size:.78rem;color:var(--t3);line-height:1.6;margin-top:1rem}" +
|
||||
".dl-btnrow{display:flex;gap:.75rem;flex-wrap:wrap;align-items:center}" +
|
||||
"[data-detected=true]{box-shadow:0 0 0 2px rgba(0,82,160,.45);border-radius:2px}" +
|
||||
"</style>"
|
||||
}
|
||||
|
||||
fn dl_header() -> String {
|
||||
el_p("class=\"label reveal\"", "Download") +
|
||||
el_h1("class=\"display-lg reveal\" style=\"margin-top:.75rem\"", "Get Neuron.") +
|
||||
el_div("class=\"navy-line-left reveal\" style=\"width:4rem;margin:1.5rem 0 2rem\"", "") +
|
||||
el_p(
|
||||
"class=\"dl-sub reveal\" style=\"max-width:34rem;font-size:1rem\"",
|
||||
"Your AI that remembers you, running on your own machine. macOS is available to download today. Windows and Linux are on the way."
|
||||
) +
|
||||
el_p("id=\"os-detected\" class=\"dl-detected reveal\"", "Detecting your platform…")
|
||||
}
|
||||
|
||||
fn dl_mac_card() -> String {
|
||||
el_div(
|
||||
"id=\"card-mac\" class=\"card-dark dl-card dl-featured reveal\"",
|
||||
el_span("class=\"dl-badge dl-badge-ready\"", "Available now") +
|
||||
el_p("class=\"dl-title\"", "Neuron for macOS") +
|
||||
el_p("class=\"dl-sub\"", "Apple Silicon (M1–M4). macOS 13 Ventura or later.") +
|
||||
el_div(
|
||||
"class=\"dl-btnrow\"",
|
||||
el_a(
|
||||
"https://downloads.neurontechnologies.ai/installers/Neuron-1.1.0-macos-arm64.dmg",
|
||||
"class=\"btn-primary\" download",
|
||||
"Download for macOS →"
|
||||
)
|
||||
) +
|
||||
el_p("class=\"dl-note\"", "Version 1.1.0 · Apple Silicon · .dmg")
|
||||
)
|
||||
}
|
||||
|
||||
fn dl_windows_card() -> String {
|
||||
el_div(
|
||||
"id=\"card-windows\" class=\"card-dark dl-card reveal\"",
|
||||
el_span("class=\"dl-badge dl-badge-soon\"", "Coming soon") +
|
||||
el_p("class=\"dl-title\"", "Neuron for Windows") +
|
||||
el_p("class=\"dl-sub\"", "Windows 10 and 11 (x64).") +
|
||||
el_div(
|
||||
"class=\"dl-btnrow\"",
|
||||
el_a(
|
||||
"https://downloads.neurontechnologies.ai/installers/Neuron-1.1.0-windows-x64.msi",
|
||||
"class=\"btn-ghost\" download",
|
||||
"Download .msi"
|
||||
)
|
||||
) +
|
||||
el_p(
|
||||
"class=\"dl-note\"",
|
||||
"The Windows build is still landing — this link may not be live yet. Chat is not enabled on Windows in this release."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn dl_linux_card() -> String {
|
||||
el_div(
|
||||
"id=\"card-linux\" class=\"card-dark dl-card reveal\"",
|
||||
el_span("class=\"dl-badge dl-badge-soon\"", "Coming soon") +
|
||||
el_p("class=\"dl-title\"", "Neuron for Linux") +
|
||||
el_p("class=\"dl-sub\"", "Debian / Ubuntu (.deb) or portable (.AppImage), x64.") +
|
||||
el_div(
|
||||
"class=\"dl-btnrow\"",
|
||||
el_a(
|
||||
"https://downloads.neurontechnologies.ai/installers/Neuron-1.1.0-linux-x64.deb",
|
||||
"class=\"btn-ghost\" download",
|
||||
"Download .deb"
|
||||
) +
|
||||
el_a(
|
||||
"https://downloads.neurontechnologies.ai/installers/Neuron-1.1.0-linux-x64.AppImage",
|
||||
"class=\"btn-ghost\" download",
|
||||
"Download .AppImage"
|
||||
)
|
||||
) +
|
||||
el_p(
|
||||
"class=\"dl-note\"",
|
||||
"Linux packages install today, but the on-device soul backend is still being finished. Full support is coming soon."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn dl_fineprint() -> String {
|
||||
el_p(
|
||||
"class=\"dl-note reveal\" style=\"margin-top:2.5rem\"",
|
||||
"All installers are served from downloads.neurontechnologies.ai. After checkout your license key arrives by email — manage it from your " +
|
||||
el_a("/account", "style=\"color:var(--navy)\"", "account") +
|
||||
"."
|
||||
)
|
||||
}
|
||||
|
||||
// Inline OS detection. CSP allows script-src 'unsafe-inline'. Single-quoted
|
||||
// JS, ASCII only, no // comments — keeps the .el string simple and avoids
|
||||
// tokenizer surprises.
|
||||
fn dl_script() -> String {
|
||||
"<script>(function(){var p=(navigator.platform||'')+' '+(navigator.userAgent||'');var os='mac';if(/Win/i.test(p)){os='windows';}else if(/Linux|X11/i.test(p)&&!/Android/i.test(p)){os='linux';}else if(/Mac/i.test(p)){os='mac';}var L={mac:'macOS',windows:'Windows',linux:'Linux'};var b=document.getElementById('os-detected');if(b){b.textContent=(os==='mac')?'We detected macOS on this device. You are ready to download.':('We detected '+L[os]+'. '+L[os]+' support is coming soon; macOS is available to download today.');}var c=document.getElementById('card-'+os);if(c){c.setAttribute('data-detected','true');}})();</script>"
|
||||
}
|
||||
|
||||
fn downloads_content() -> String {
|
||||
let grid: String = el_div("class=\"dl-grid\"", dl_windows_card() + dl_linux_card())
|
||||
el_section(
|
||||
"id=\"downloads\" aria-label=\"Download Neuron\"",
|
||||
el_div(
|
||||
"class=\"container dl-wrap\"",
|
||||
dl_header() + dl_mac_card() + grid + dl_fineprint()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fn downloads_page() -> String {
|
||||
return nav() + dl_style() + downloads_content() + footer() + dl_script()
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// account-dashboard.el -- Account dashboard: session check, plan card.
|
||||
// Handles onAuthStateChange and plan card rendering.
|
||||
// account-dashboard.el -- Account dashboard: session check, plan card, family.
|
||||
// Handles onAuthStateChange, plan card rendering, family member management.
|
||||
// Compiled with: elc --target=js --bundle --minify --obfuscate
|
||||
//
|
||||
// Required globals: window.NEURON_CFG.supabase_url, window.NEURON_CFG.supabase_anon_key
|
||||
@@ -127,8 +127,77 @@ fn main() -> Void {
|
||||
|
||||
var roadmapSection = document.getElementById('roadmap-section');
|
||||
if (plan === 'founding' && roadmapSection) roadmapSection.style.display = '';
|
||||
|
||||
if (plan === 'founding') {
|
||||
var famSection = document.getElementById('family-section');
|
||||
if (famSection) famSection.style.display = 'block';
|
||||
var session = await sb.auth.getSession();
|
||||
var userEmail = session.data.session && session.data.session.user ? session.data.session.user.email : '';
|
||||
if (userEmail) loadFamilyMembers(userEmail);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadFamilyMembers(parentEmail) {
|
||||
var r = await fetch('/api/family/members?parent_email=' + encodeURIComponent(parentEmail));
|
||||
var members = await r.json();
|
||||
var list = document.getElementById('family-list');
|
||||
if (!list) return;
|
||||
if (!members || !members.length) {
|
||||
list.innerHTML = '<p style=\"color:var(--t3);font-size:.875rem;margin-bottom:1rem\">No family members yet.</p>';
|
||||
return;
|
||||
}
|
||||
list.innerHTML = members.map(function(m) {
|
||||
return '<div style=\"display:flex;justify-content:space-between;align-items:center;padding:.75rem 0;border-bottom:1px solid var(--border)\">'
|
||||
+ '<div><p style=\"font-size:.875rem;color:var(--t1)\">' + m.child_email + '</p>'
|
||||
+ '<p style=\"font-size:.75rem;color:var(--t3);text-transform:uppercase;letter-spacing:.06em\">' + m.status + '</p></div>'
|
||||
+ '<button onclick=\"removeFamilyMember(\'' + m.child_email + '\')\" style=\"background:none;border:none;color:var(--t3);cursor:pointer;font-size:.75rem\">Remove</button>'
|
||||
+ '</div>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
window.addFamilyMember = async function() {
|
||||
var email = document.getElementById('child-email').value.trim();
|
||||
var year = document.getElementById('child-dob-year').value;
|
||||
var attest = document.getElementById('family-attest').checked;
|
||||
var msg = document.getElementById('family-msg');
|
||||
if (!email || !year || !attest) {
|
||||
msg.style.display='block'; msg.style.color='#c44'; msg.textContent='Please fill in all fields and confirm the attestation.'; return;
|
||||
}
|
||||
if (parseInt(year) < 2008) {
|
||||
msg.style.display='block'; msg.style.color='#c44'; msg.textContent='Child must be under 18. Birth year must be 2008 or later.'; return;
|
||||
}
|
||||
var session = await sb.auth.getSession();
|
||||
var parentEmail = session.data.session && session.data.session.user ? session.data.session.user.email : '';
|
||||
var r = await fetch('/api/family/invite', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({parent_email: parentEmail, child_email: email, child_dob_year: parseInt(year), attested: true})
|
||||
});
|
||||
var d = await r.json();
|
||||
msg.style.display = 'block';
|
||||
if (d.ok) {
|
||||
msg.style.color = 'var(--navy)';
|
||||
msg.textContent = 'Invitation sent to ' + email + '. They will receive an email to set up their account.';
|
||||
document.getElementById('child-email').value = '';
|
||||
document.getElementById('child-dob-year').value = '';
|
||||
document.getElementById('family-attest').checked = false;
|
||||
loadFamilyMembers(parentEmail);
|
||||
} else {
|
||||
msg.style.color = '#c44';
|
||||
msg.textContent = d.error || 'Something went wrong.';
|
||||
}
|
||||
};
|
||||
|
||||
window.removeFamilyMember = async function(childEmail) {
|
||||
var session = await sb.auth.getSession();
|
||||
var parentEmail = session.data.session && session.data.session.user ? session.data.session.user.email : '';
|
||||
await fetch('/api/family/remove', {
|
||||
method: 'POST', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({parent_email: parentEmail, child_email: childEmail})
|
||||
});
|
||||
loadFamilyMembers(parentEmail);
|
||||
};
|
||||
|
||||
function renderUserChip(user) {
|
||||
var email = user.email || '';
|
||||
var avatarEl = document.getElementById('user-avatar-el');
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ fn local_first() -> String {
|
||||
let principle3: String = el_div(
|
||||
"class=\"lf-principle reveal\" style=\"transition-delay:240ms\"",
|
||||
el_p("class=\"lf-principle-label\"", "No ads. Ever.") +
|
||||
el_p("class=\"lf-principle-body\"", "Not during your trial. Not on paid. Not in any future version. Ads require surveillance. Surveillance requires your data. I'm not building that.")
|
||||
el_p("class=\"lf-principle-body\"", "Not on the free tier. Not on paid. Not in any future version. Ads require surveillance. Surveillance requires your data. I'm not building that.")
|
||||
)
|
||||
let principle4: String = el_div(
|
||||
"class=\"lf-principle reveal\" style=\"transition-delay:360ms\"",
|
||||
|
||||
+172
-2
@@ -87,6 +87,7 @@ from checkout import { checkout_page }
|
||||
from safety import { safety }
|
||||
from gallery import { gallery_page }
|
||||
from account import { account_page }
|
||||
from downloads import { downloads_page }
|
||||
|
||||
// ── Share-card HTML allowlist ─────────────────────────────────────────────────
|
||||
//
|
||||
@@ -628,7 +629,7 @@ fn handle_request_inner(method: String, path: String, headers: Map, body: String
|
||||
"Founding Member Checkout — Neuron"
|
||||
} else {
|
||||
if str_eq(plan, "free") {
|
||||
"Start Your Free Trial — Neuron"
|
||||
"Get Started Free — Neuron"
|
||||
} else {
|
||||
"Professional Plan Checkout — Neuron"
|
||||
}
|
||||
@@ -637,7 +638,7 @@ fn handle_request_inner(method: String, path: String, headers: Map, body: String
|
||||
"Secure your Founding Member spot. Pay once, $199 lifetime — Neuron inference included at launch, priced below the major APIs. First 1,000 only."
|
||||
} else {
|
||||
if str_eq(plan, "free") {
|
||||
"Start your 14-day free trial. No credit card required. Your AI that remembers you — runs on your machine, never resets."
|
||||
"Create your free Neuron account. No credit card required. Your AI that remembers you — runs on your machine, never resets."
|
||||
} else {
|
||||
"Subscribe to Neuron Professional for $19/month. The AI that remembers you — persistent memory, runs locally, bring your own API keys."
|
||||
}
|
||||
@@ -1971,6 +1972,15 @@ fn handle_request_inner(method: String, path: String, headers: Map, body: String
|
||||
) + badge_css + success_body + page_close()
|
||||
}
|
||||
|
||||
// ── Downloads ─────────────────────────────────────────────────────────────
|
||||
// Public installer page. macOS ships today; Windows/Linux linked but marked
|
||||
// coming soon. Live-rendered like /about (page shell wraps downloads_page()).
|
||||
if str_starts_with(path, "/downloads") {
|
||||
let dl_title: String = "Download Neuron - macOS, Windows & Linux"
|
||||
let dl_desc: String = "Download Neuron for macOS. Your AI that remembers you, running on your own machine. Windows and Linux support is on the way."
|
||||
return page_open_seo(dl_title, dl_desc, "/downloads", dl_desc, "false") + downloads_page() + page_close()
|
||||
}
|
||||
|
||||
// ── Account dashboard ─────────────────────────────────────────────────────
|
||||
// Use prefix match so OAuth/email-confirmation redirects with query strings still hit.
|
||||
if str_starts_with(path, "/account") {
|
||||
@@ -1991,6 +2001,164 @@ fn handle_request_inner(method: String, path: String, headers: Map, body: String
|
||||
return badge_css + badge_html
|
||||
}
|
||||
|
||||
// ── Family plan — POST /api/family/invite ────────────────────────────────
|
||||
if str_eq(path, "/api/family/invite") {
|
||||
if !str_eq(method, "POST") {
|
||||
return "{\"error\":\"POST required\"}"
|
||||
}
|
||||
let parent_email: String = json_get(body, "parent_email")
|
||||
let child_email: String = json_get(body, "child_email")
|
||||
let child_dob_year_str: String = json_get(body, "child_dob_year")
|
||||
let attested_str: String = json_get(body, "attested")
|
||||
if str_eq(parent_email, "") || str_eq(child_email, "") || str_eq(child_dob_year_str, "") {
|
||||
return "{\"error\":\"parent_email, child_email, and child_dob_year are required\"}"
|
||||
}
|
||||
if !str_eq(attested_str, "true") {
|
||||
return "{\"error\":\"attestation required\"}"
|
||||
}
|
||||
let child_dob_year: Int = str_to_int(child_dob_year_str)
|
||||
if child_dob_year < 2008 {
|
||||
return "{\"error\":\"Child must be under 18. Birth year must be 2008 or later.\"}"
|
||||
}
|
||||
// Check existing family member count
|
||||
let fam_sb_url: String = state_get("__supabase_project_url__")
|
||||
let fam_sb_key: String = state_get("__supabase_service_key__")
|
||||
if str_eq(fam_sb_key, "") {
|
||||
return "{\"error\":\"not configured\"}"
|
||||
}
|
||||
let pe_safe: String = str_replace(str_replace(parent_email, "\\", "\\\\"), "\"", "\\\"")
|
||||
let ce_safe: String = str_replace(str_replace(child_email, "\\", "\\\\"), "\"", "\\\"")
|
||||
let members_resp: String = http_get_auth(
|
||||
fam_sb_url + "/rest/v1/family_members?parent_email=eq." + parent_email + "&status=neq.cancelled&select=child_email",
|
||||
fam_sb_key
|
||||
)
|
||||
let member_count: Int = json_array_len(members_resp)
|
||||
if member_count >= 5 {
|
||||
return "{\"error\":\"Maximum of 5 family members reached.\"}"
|
||||
}
|
||||
// Check child not already added
|
||||
let dup_resp: String = http_get_auth(
|
||||
fam_sb_url + "/rest/v1/family_members?parent_email=eq." + parent_email + "&child_email=eq." + child_email + "&select=child_email",
|
||||
fam_sb_key
|
||||
)
|
||||
let dup_count: Int = json_array_len(dup_resp)
|
||||
if dup_count > 0 {
|
||||
return "{\"error\":\"This child email is already in your family plan.\"}"
|
||||
}
|
||||
// Create Stripe customer for child
|
||||
let fam_stripe_key: String = state_get("__stripe_secret_key__")
|
||||
if str_eq(fam_stripe_key, "") {
|
||||
return "{\"error\":\"Stripe not configured\"}"
|
||||
}
|
||||
let child_email_safe: String = str_replace(child_email, "@", "%40")
|
||||
let customer_body: String = "email=" + child_email_safe
|
||||
let customer_resp: String = http_post_auth("https://api.stripe.com/v1/customers", fam_stripe_key, customer_body)
|
||||
let child_customer_id: String = json_get(customer_resp, "id")
|
||||
if str_eq(child_customer_id, "") {
|
||||
return "{\"error\":\"Failed to create Stripe customer\"}"
|
||||
}
|
||||
// Create Stripe subscription for child
|
||||
let price_id: String = state_get("__stripe_price_family_child__")
|
||||
if str_eq(price_id, "") {
|
||||
return "{\"error\":\"Family child price not configured\"}"
|
||||
}
|
||||
let parent_email_safe: String = str_replace(parent_email, "@", "%40")
|
||||
let sub_body: String = "customer=" + child_customer_id
|
||||
+ "&items[0][price]=" + price_id
|
||||
+ "&trial_period_days=7"
|
||||
+ "&metadata[parent_email]=" + parent_email_safe
|
||||
+ "&metadata[type]=family_child"
|
||||
let sub_resp: String = http_post_auth("https://api.stripe.com/v1/subscriptions", fam_stripe_key, sub_body)
|
||||
let sub_id: String = json_get(sub_resp, "id")
|
||||
if str_eq(sub_id, "") {
|
||||
return "{\"error\":\"Failed to create Stripe subscription\"}"
|
||||
}
|
||||
// Generate invite token
|
||||
let ts_str: String = int_to_str(unix_timestamp())
|
||||
let email_prefix: String = str_slice(child_email, 0, 4)
|
||||
let invite_token: String = ts_str + email_prefix
|
||||
// Insert into family_members table
|
||||
let fam_row: String = "{\"parent_email\":\"" + pe_safe + "\",\"parent_user_id\":\"\",\"child_email\":\"" + ce_safe + "\",\"child_dob_year\":" + child_dob_year_str + ",\"status\":\"invited\",\"stripe_subscription_id\":\"" + sub_id + "\",\"invite_token\":\"" + invite_token + "\"}"
|
||||
let fam_insert_resp: String = supabase_insert(fam_sb_url, fam_sb_key, "family_members", fam_row)
|
||||
println("[family/invite] insert -> " + fam_insert_resp)
|
||||
// Send invite email
|
||||
let invite_text: String = "You have been invited to join Neuron by " + parent_email
|
||||
+ ". Visit https://neurontechnologies.ai/account to set up your account."
|
||||
let invite_send: String = send_email(
|
||||
"Neuron <no-reply@neurontechnologies.ai>",
|
||||
child_email,
|
||||
"You have been invited to Neuron",
|
||||
"",
|
||||
invite_text
|
||||
)
|
||||
println("[family/invite] " + invite_send)
|
||||
return "{\"ok\":true,\"invite_token\":\"" + invite_token + "\"}"
|
||||
}
|
||||
|
||||
// ── Family plan — GET /api/family/members ────────────────────────────────
|
||||
if str_starts_with(path, "/api/family/members") {
|
||||
let fml_sb_url: String = state_get("__supabase_project_url__")
|
||||
let fml_sb_key: String = state_get("__supabase_service_key__")
|
||||
if str_eq(fml_sb_key, "") {
|
||||
return "[]"
|
||||
}
|
||||
// Extract parent_email from query string
|
||||
let fml_parent_email: String = ""
|
||||
let q_idx: Int = str_index_of(path, "parent_email=")
|
||||
if q_idx >= 0 {
|
||||
let fml_parent_email = str_slice(path, q_idx + 13, str_len(path))
|
||||
}
|
||||
if str_eq(fml_parent_email, "") {
|
||||
return "{\"error\":\"parent_email required\"}"
|
||||
}
|
||||
let fml_resp: String = http_get_auth(
|
||||
fml_sb_url + "/rest/v1/family_members?parent_email=eq." + fml_parent_email + "&select=child_email,status,child_dob_year,created_at",
|
||||
fml_sb_key
|
||||
)
|
||||
if str_eq(fml_resp, "") {
|
||||
return "[]"
|
||||
}
|
||||
return fml_resp
|
||||
}
|
||||
|
||||
// ── Family plan — POST /api/family/remove ────────────────────────────────
|
||||
if str_eq(path, "/api/family/remove") {
|
||||
if !str_eq(method, "POST") {
|
||||
return "{\"error\":\"POST required\"}"
|
||||
}
|
||||
let rem_parent_email: String = json_get(body, "parent_email")
|
||||
let rem_child_email: String = json_get(body, "child_email")
|
||||
if str_eq(rem_parent_email, "") || str_eq(rem_child_email, "") {
|
||||
return "{\"error\":\"parent_email and child_email required\"}"
|
||||
}
|
||||
let rem_sb_url: String = state_get("__supabase_project_url__")
|
||||
let rem_sb_key: String = state_get("__supabase_service_key__")
|
||||
if str_eq(rem_sb_key, "") {
|
||||
return "{\"error\":\"not configured\"}"
|
||||
}
|
||||
// Fetch the subscription ID
|
||||
let sub_lookup: String = http_get_auth(
|
||||
rem_sb_url + "/rest/v1/family_members?parent_email=eq." + rem_parent_email + "&child_email=eq." + rem_child_email + "&select=stripe_subscription_id",
|
||||
rem_sb_key
|
||||
)
|
||||
let rem_sub_id: String = json_get(sub_lookup, "0.stripe_subscription_id")
|
||||
// Cancel Stripe subscription if present
|
||||
if !str_eq(rem_sub_id, "") {
|
||||
let rem_stripe_key: String = state_get("__stripe_secret_key__")
|
||||
if !str_eq(rem_stripe_key, "") {
|
||||
let cancel_resp: String = http_post_auth("https://api.stripe.com/v1/subscriptions/" + rem_sub_id + "/cancel", rem_stripe_key, "")
|
||||
println("[family/remove] cancel sub " + rem_sub_id + " -> " + cancel_resp)
|
||||
}
|
||||
}
|
||||
// Update status to cancelled
|
||||
let rpe_safe: String = str_replace(str_replace(rem_parent_email, "\\", "\\\\"), "\"", "\\\"")
|
||||
let rce_safe: String = str_replace(str_replace(rem_child_email, "\\", "\\\\"), "\"", "\\\"")
|
||||
let cancel_row: String = "{\"status\":\"cancelled\"}"
|
||||
supabase_insert(rem_sb_url, rem_sb_key, "family_members?parent_email=eq." + rem_parent_email + "&child_email=eq." + rem_child_email, cancel_row)
|
||||
println("[family/remove] cancelled " + rce_safe + " from " + rpe_safe)
|
||||
return "{\"ok\":true}"
|
||||
}
|
||||
|
||||
// ── API key provisioning — POST /api/api-keys ────────────────────────────
|
||||
// Returns user's stored provider keys (masked) for display on /account.
|
||||
// Body: { access_token: "<jwt>" }
|
||||
@@ -2187,6 +2355,7 @@ let stripe_key: String = env("STRIPE_SECRET_KEY")
|
||||
let stripe_pub_key: String = env("STRIPE_PUBLISHABLE_KEY")
|
||||
let stripe_price_founding: String = env("STRIPE_PRICE_FOUNDING")
|
||||
let stripe_price_professional: String = env("STRIPE_PRICE_PROFESSIONAL")
|
||||
let family_child_price: String = env("STRIPE_PRICE_FAMILY_CHILD")
|
||||
let stripe_webhook_secret: String = env("STRIPE_WEBHOOK_SECRET")
|
||||
let license_api_url: String = env("NEURON_LICENSE_API_URL")
|
||||
let resend_api_key: String = env("RESEND_API_KEY")
|
||||
@@ -2237,6 +2406,7 @@ state_set("__stripe_secret_key__", stripe_key)
|
||||
state_set("__stripe_publishable_key__", stripe_pub_key)
|
||||
state_set("__stripe_price_founding__", stripe_price_founding)
|
||||
state_set("__stripe_price_professional__", stripe_price_professional)
|
||||
state_set("__stripe_price_family_child__", family_child_price)
|
||||
state_set("__license_api_url__", license_api_url)
|
||||
state_set("__resend_api_key__", resend_api_key)
|
||||
state_set("__supabase_anon_key__", supabase_anon_key)
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
// components/pricing.el - Three pricing cards: Free trial / Professional / Founding Member.
|
||||
// components/pricing.el - Three pricing cards: Free / Professional / Founding Member.
|
||||
// Accepts the founding counter values as parameters so main.el can inject
|
||||
// server-side rendered counts without JS.
|
||||
|
||||
@@ -89,14 +89,14 @@ fn pricing(sold: Int, total: Int) -> String {
|
||||
el_div(
|
||||
"class=\"pricing-price-row\"",
|
||||
el_span("class=\"pricing-price\"", "$0") +
|
||||
el_span("class=\"pricing-cadence\"", "for 14 days")
|
||||
el_span("class=\"pricing-cadence\"", "forever")
|
||||
) +
|
||||
el_p("class=\"pricing-tagline\"", "Try everything free for 14 days. No card required.") +
|
||||
el_p("class=\"pricing-tagline\"", "Start building your memory. No card required.") +
|
||||
el_ul("class=\"pricing-features\"", pricing_free_features()) +
|
||||
el_div("style=\"flex:1\"", "") +
|
||||
el_div(
|
||||
"class=\"pricing-cta pricing-cta-ghost\"",
|
||||
el_button("class=\"pricing-cta-ghost\" data-checkout=\"free\"", "Start free trial →")
|
||||
el_button("class=\"pricing-cta-ghost\" data-checkout=\"free\"", "Preorder free tier →")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -78,9 +78,9 @@ fn page_head() -> String {
|
||||
return page_head_base()
|
||||
+ page_seo_block(
|
||||
"Neuron — The AI That Remembers You",
|
||||
"Every AI resets when you close the tab. Neuron doesn't. Runs on your machine. Remembers everything. Start with a 14-day free trial — no credit card required.",
|
||||
"Every AI resets when you close the tab. Neuron doesn't. Runs on your machine. Remembers everything. Start free — no credit card required.",
|
||||
"/",
|
||||
"Every other AI forgets you. Neuron doesn't. Runs on your machine, builds a persistent memory over time, and gets sharper the longer you use it. 14-day free trial."
|
||||
"Every other AI forgets you. Neuron doesn't. Runs on your machine, builds a persistent memory over time, and gets sharper the longer you use it. Free tier available."
|
||||
)
|
||||
+ page_schema()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user