Add integrated checkout, child safety section, and content polish
- checkout.el: Custom Stripe Payment Element page at /checkout?plan=... - safety.el: Hard Bell and emergency routing architecture section - main.el: Wire checkout + safety, /api/payment-intent, STRIPE_PUBLISHABLE_KEY - enterprise_terms.el: Add nav bar (was missing, page had no navigation) - styles.el: Checkout buttons now link to integrated page, not hosted Stripe - El runtime: Auto-detect HTML responses, serve text/html vs application/json - footer.el: Wordmark image centered above "Built Different." tagline - environmental.el: Replace SQLite with custom on-device storage - enterprise.el: Replace SQLite with custom on-device storage - pricing.el: Local models degraded performance note near Ollama feature - about.el: "left home at fifteen", remove programming language mention
This commit is contained in:
+41
@@ -40,6 +40,8 @@ from about import { about_page }
|
||||
from founding_badge import { founding_badge, founding_badge_css }
|
||||
from terms import { terms_page }
|
||||
from enterprise_terms import { enterprise_terms_page }
|
||||
from checkout import { checkout_page }
|
||||
from safety import { safety }
|
||||
|
||||
// ── Founding counter ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -78,6 +80,7 @@ fn page(sold: Int, total: Int) -> String {
|
||||
+ enterprise()
|
||||
+ mission()
|
||||
+ local_first()
|
||||
+ safety()
|
||||
+ environmental()
|
||||
+ pricing(sold, total)
|
||||
+ viral()
|
||||
@@ -131,6 +134,42 @@ fn handle_request(method: String, path: String, body: String) -> String {
|
||||
return "{\"__status__\":404,\"error\":\"not found\"}"
|
||||
}
|
||||
|
||||
// ── Checkout page ─────────────────────────────────────────────────────────
|
||||
if str_starts_with(path, "/checkout") {
|
||||
let plan: String = "founding"
|
||||
if str_contains(path, "plan=professional") {
|
||||
plan = "professional"
|
||||
}
|
||||
let pub_key: String = state_get("__stripe_publishable_key__")
|
||||
return page_open() + checkout_page(plan, pub_key) + page_close()
|
||||
}
|
||||
|
||||
// ── Stripe payment intent ─────────────────────────────────────────────────
|
||||
if str_eq(path, "/api/payment-intent") {
|
||||
let stripe_key: String = state_get("__stripe_secret_key__")
|
||||
if str_eq(stripe_key, "") {
|
||||
return "{\"__status__\":503,\"error\":\"Stripe not configured\"}"
|
||||
}
|
||||
let plan: String = "founding"
|
||||
if str_contains(body, "\"professional\"") {
|
||||
plan = "professional"
|
||||
}
|
||||
let amount: String = "19900"
|
||||
if str_eq(plan, "professional") {
|
||||
amount = "1900"
|
||||
}
|
||||
let pi_body: String = "amount=" + amount
|
||||
+ "¤cy=usd"
|
||||
+ "&payment_method_types[]=card"
|
||||
+ "&metadata[plan]=" + plan
|
||||
let response: String = http_post_form_auth(
|
||||
"https://api.stripe.com/v1/payment_intents",
|
||||
stripe_key,
|
||||
pi_body
|
||||
)
|
||||
return response
|
||||
}
|
||||
|
||||
// ── Health check ──────────────────────────────────────────────────────────
|
||||
if str_eq(path, "/api/health") {
|
||||
return "{\"status\":\"ok\",\"service\":\"neuron-landing\"}"
|
||||
@@ -279,10 +318,12 @@ state_set("__founding_total__", int_to_str(FOUNDING_TOTAL))
|
||||
|
||||
// Stripe config from environment.
|
||||
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 license_api_url: String = env("NEURON_LICENSE_API_URL")
|
||||
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("__license_api_url__", license_api_url)
|
||||
|
||||
Reference in New Issue
Block a user