Add marketplace section, OAuth checkout, social icons, 35% efficiency claim, preorder CTAs, enterprise Q1 2027, founding member limits, paragraph spacing in demo chat, no em dashes

This commit is contained in:
Will Anderson
2026-05-01 09:20:45 -05:00
parent 269eed41aa
commit ff1f9577db
38 changed files with 12432 additions and 39 deletions
+82 -9
View File
@@ -33,6 +33,7 @@ from enterprise import { enterprise }
from mission import { mission }
from local_first import { local_first }
from pricing import { pricing }
from marketplace import { marketplace }
from viral import { viral }
from footer import { footer }
from styles import { page_open, page_close }
@@ -55,7 +56,7 @@ fn get_sold() -> Int {
if str_eq(s, "") {
return FOUNDING_SOLD
}
return parse_int(s)
return str_to_int(s)
}
fn get_total() -> Int {
@@ -63,7 +64,7 @@ fn get_total() -> Int {
if str_eq(s, "") {
return FOUNDING_TOTAL
}
return parse_int(s)
return str_to_int(s)
}
// fetch_founding_count_stripe queries Stripe PaymentIntents search for the
@@ -90,7 +91,7 @@ fn fetch_founding_count_stripe(stripe_key: String) -> Int {
fn load_founding_count(sold_file: String, stripe_key: String) -> Int {
if fs_exists(sold_file) {
let s: String = str_trim(fs_read(sold_file))
let n: Int = parse_int(s)
let n: Int = str_to_int(s)
if n > 0 {
return n
}
@@ -124,6 +125,7 @@ fn page(sold: Int, total: Int) -> String {
+ safety()
+ environmental()
+ pricing(sold, total)
+ marketplace()
+ viral()
+ footer()
+ page_close()
@@ -148,6 +150,24 @@ fn read_asset(abs_path: String) -> String {
fn handle_request(method: String, path: String, body: String) -> String {
let src_dir: String = state_get("__src_dir__")
// Root serve El-generated landing page
if str_eq(path, "/") {
let index_path: String = state_get("__html_file__")
if !str_eq(index_path, "") {
return fs_read(index_path)
}
}
// llms.txt for AI crawlers (Perplexity, ChatGPT, Google SGE)
if str_eq(path, "/llms.txt") {
return fs_read(src_dir + "/llms.txt")
}
// robots.txt
if str_eq(path, "/robots.txt") {
return "User-agent: *\nAllow: /\nSitemap: https://neurontechnologies.ai/sitemap.xml\n"
}
// About page
if str_eq(path, "/about") {
let about_path: String = state_get("__about_html_file__")
@@ -181,6 +201,9 @@ fn handle_request(method: String, path: String, body: String) -> String {
if str_contains(path, "plan=professional") {
plan = "professional"
}
if str_contains(path, "plan=free") {
plan = "free"
}
let pub_key: String = state_get("__stripe_publishable_key__")
return page_open() + checkout_page(plan, pub_key) + page_close()
}
@@ -203,10 +226,11 @@ fn handle_request(method: String, path: String, body: String) -> String {
+ "&currency=usd"
+ "&payment_method_types[]=card"
+ "&metadata[plan]=" + plan
let auth_header: String = "Bearer " + stripe_key
let response: String = http_post_form_auth(
"https://api.stripe.com/v1/payment_intents",
stripe_key,
pi_body
pi_body,
auth_header
)
return response
}
@@ -227,6 +251,17 @@ fn handle_request(method: String, path: String, body: String) -> String {
return "{\"sold\":" + sold_s + ",\"total\":" + total_s + ",\"remaining\":" + rem_s + "}"
}
// Static assets: /assets/*
if str_starts_with(path, "/assets/") {
let rel: String = str_slice(path, 8, str_len(path))
let abs: String = src_dir + "/assets/" + rel
let content: String = read_asset(abs)
if str_eq(content, "") {
return "{\"__status__\":404,\"error\":\"not found\"}"
}
return content
}
// Brand assets: /brand/*
if str_starts_with(path, "/brand/") {
let rel: String = str_slice(path, 7, str_len(path))
@@ -269,10 +304,11 @@ fn handle_request(method: String, path: String, body: String) -> String {
+ "&cancel_url=" + origin + "/#pricing"
+ "&allow_promotion_codes=true"
+ "&metadata[plan]=" + plan
let auth_hdr: String = "Bearer " + stripe_key
let response: String = http_post_form_auth(
"https://api.stripe.com/v1/checkout/sessions",
stripe_key,
form_body
form_body,
auth_hdr
)
if str_contains(response, "\"url\"") {
return response
@@ -302,6 +338,37 @@ fn handle_request(method: String, path: String, body: String) -> String {
return "{\"received\":true}"
}
// Supabase public config
if str_eq(path, "/api/supabase-config") {
let proj_url: String = "https://ocojsghaonltunidkzpw.supabase.co"
let anon_key: String = state_get("__supabase_anon_key__")
return "{\"url\":\"" + proj_url + "\",\"anon_key\":\"" + anon_key + "\"}"
}
// Demo chat proxies to the demo soul at 7772
if str_eq(path, "/api/demo") {
if str_eq(method, "POST") {
let msg: String = json_get(body, "message")
if str_eq(msg, "") {
return "{\"error\":\"message required\"}"
}
// Escape the message for embedding in JSON strings
let msg_safe: String = str_replace(str_replace(msg, "\\", "\\\\"), "\"", "\\\"")
// Build inner content: {"event_type":"chat","payload":{"message":"..."}}
let inner: String = "{\"event_type\":\"chat\",\"payload\":{\"message\":\"" + msg_safe + "\"}}"
// Escape inner for the outer content field
let inner_safe: String = str_replace(str_replace(inner, "\\", "\\\\"), "\"", "\\\"")
// Build dharma envelope
let envelope: String = "{\"channel\":\"ntn-demo\",\"from\":\"ntn-site\",\"content\":\"" + inner_safe + "\"}"
let resp: String = http_post("http://localhost:7772/dharma/recv", envelope)
if str_eq(resp, "") {
return "{\"error\":\"demo soul not responding\"}"
}
return resp
}
return "{\"error\":\"POST required\"}"
}
// Stripe webhook
if str_eq(path, "/api/webhooks/stripe") {
if str_contains(body, "checkout.session.completed") {
@@ -352,7 +419,8 @@ fn handle_request(method: String, path: String, body: String) -> String {
// 3. Generate all HTML with the real count
// 4. Register with El HTTP runtime and serve
let src_dir: String = cwd() + "/src"
let landing_root: String = env("LANDING_ROOT")
let src_dir: String = if str_eq(landing_root, "") { cwd() + "/src" } else { landing_root }
let html_path: String = src_dir + "/index.html"
// Stripe config from environment loaded first so founding count can use it.
@@ -362,6 +430,7 @@ 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")
let resend_api_key: String = env("RESEND_API_KEY")
let supabase_anon_key: String = env("SUPABASE_ANON_KEY")
// Origin drives Stripe redirect URLs; never hardcoded to localhost.
let neuron_origin: String = env("NEURON_ORIGIN")
@@ -400,6 +469,7 @@ state_set("__stripe_price_founding__", stripe_price_founding)
state_set("__stripe_price_professional__", stripe_price_professional)
state_set("__license_api_url__", license_api_url)
state_set("__resend_api_key__", resend_api_key)
state_set("__supabase_anon_key__", supabase_anon_key)
state_set("__origin__", neuron_origin)
state_set("__founding_sold_file__", sold_file)
state_set("__founding_sold__", int_to_str(real_sold))
@@ -425,6 +495,9 @@ println(" POST /api/webhooks/stripe → Stripe webhook")
println(" GET /marketplace/success → post-purchase success page")
println(" GET /assets/* → static files")
println(" GET /brand/* → brand files")
println(" GET /api/supabase-config → public Supabase config (URL + anon key)")
println("")
http_serve(3001)
let port: Int = if str_eq(env("PORT"), "") { 3001 } else { str_to_int(env("PORT")) }
http_set_handler("handle_request")
http_serve(port, "handle_request")