ux: chat header + greeting + brain avatar + share button + terms + badge
Restores inline-JS styles.el (the obfuscated /assets/js/*.js path
broke the chat widget) and threads four UX fixes through it:
- Chat header: drop the all-caps "NEURON / Live Demo" subtitle, keep
just "Neuron" in bold white at 1rem.
- Greeting: replace the canned "Hi. I am Neuron. You get 5 questions"
with "Hey. What is on your mind?" in all three callsites (open,
reset, turnstile-verified). The questions counter is already in
the header, so we don't need to repeat it.
- Avatar: switch chat avatar from neuron-icon.png to the brain mark
(/assets/brand/neuron-brain.png). Thinking state now shows the
pulsing brain plus three-dot animation instead of "thinking..."
text.
- Share button: from a muted t3 link to a navy pill with subtle
background, uppercase letter-spacing, and active-press feedback.
main.el: drop the FOUNDING_SOLD = 47 floor and rewrite
fetch_founding_count_stripe to count succeeded PaymentIntents (the
live Stripe Elements path) AND legacy Checkout Sessions, excluding
refunded charges.
founding_badge.el: rewrite to the Option C "Tag" design picked from
/tmp/founding-badge-preview.html - tall card, navy top stroke, brain
mark prominent, "Neuron, LLC" footer.
terms.el: kill the "Neuron Inference - our own inference layer, live
now" claim. Inference launches Q3 2026 and the wording now says so.
This commit is contained in:
+39
-26
@@ -49,7 +49,7 @@ from account import { account_page }
|
||||
// ── Founding counter ──────────────────────────────────────────────────────────
|
||||
|
||||
let FOUNDING_TOTAL: Int = 1000
|
||||
let FOUNDING_SOLD: Int = 47 // floor — real count comes from Stripe at startup
|
||||
let FOUNDING_SOLD: Int = 0 // no artificial floor - real count comes from Stripe
|
||||
|
||||
// ── Founding count helpers ─────────────────────────────────────────────────────
|
||||
|
||||
@@ -76,35 +76,48 @@ fn fetch_founding_count_stripe(stripe_key: String) -> Int {
|
||||
if str_eq(stripe_key, "") {
|
||||
return FOUNDING_SOLD
|
||||
}
|
||||
// Fetch all complete checkout sessions and count founding ones.
|
||||
// Note: metadata[] filter in URL causes 400 — filter client-side instead.
|
||||
let url: String = "https://api.stripe.com/v1/checkout/sessions?status=complete&limit=100"
|
||||
let resp: String = http_get_auth(url, stripe_key)
|
||||
if str_eq(resp, "") {
|
||||
return FOUNDING_SOLD
|
||||
}
|
||||
let data_raw: String = json_get_raw(resp, "data")
|
||||
if str_eq(data_raw, "") {
|
||||
return FOUNDING_SOLD
|
||||
}
|
||||
// Count only sessions where metadata.plan = "founding"
|
||||
// json_get uses literal key search, so extract metadata object first
|
||||
let total: Int = json_array_len(data_raw)
|
||||
let count: Int = 0
|
||||
let idx: Int = 0
|
||||
while idx < total {
|
||||
let session: String = json_array_get(data_raw, idx)
|
||||
// json_get_raw handles multi-line JSON; json_get stops at newlines
|
||||
let metadata: String = json_get_raw(session, "metadata")
|
||||
let plan: String = if str_eq(metadata, "") { "" } else { json_get(metadata, "plan") }
|
||||
if str_eq(plan, "founding") {
|
||||
let count = count + 1
|
||||
|
||||
// 1) PaymentIntents (Stripe Elements path - this is what the live site uses)
|
||||
let pi_url: String = "https://api.stripe.com/v1/payment_intents?limit=100"
|
||||
let pi_resp: String = http_get_auth(pi_url, stripe_key)
|
||||
let pi_data: String = if str_eq(pi_resp, "") { "" } else { json_get_raw(pi_resp, "data") }
|
||||
if !str_eq(pi_data, "") {
|
||||
let pi_total: Int = json_array_len(pi_data)
|
||||
let pi_idx: Int = 0
|
||||
while pi_idx < pi_total {
|
||||
let pi: String = json_array_get(pi_data, pi_idx)
|
||||
let status: String = json_get(pi, "status")
|
||||
let metadata: String = json_get_raw(pi, "metadata")
|
||||
let plan: String = if str_eq(metadata, "") { "" } else { json_get(metadata, "plan") }
|
||||
// Count only fully-charged founding PIs that are not refunded
|
||||
let amt_refunded: String = json_get(pi, "amount_refunded")
|
||||
let refunded_n: Int = str_to_int(amt_refunded)
|
||||
if str_eq(status, "succeeded") && str_eq(plan, "founding") && refunded_n <= 0 {
|
||||
let count = count + 1
|
||||
}
|
||||
let pi_idx = pi_idx + 1
|
||||
}
|
||||
let idx = idx + 1
|
||||
}
|
||||
if count <= 0 {
|
||||
return FOUNDING_SOLD
|
||||
|
||||
// 2) Hosted Checkout Sessions (legacy /api/checkout path - kept for completeness)
|
||||
let cs_url: String = "https://api.stripe.com/v1/checkout/sessions?status=complete&limit=100"
|
||||
let cs_resp: String = http_get_auth(cs_url, stripe_key)
|
||||
let cs_data: String = if str_eq(cs_resp, "") { "" } else { json_get_raw(cs_resp, "data") }
|
||||
if !str_eq(cs_data, "") {
|
||||
let cs_total: Int = json_array_len(cs_data)
|
||||
let cs_idx: Int = 0
|
||||
while cs_idx < cs_total {
|
||||
let session: String = json_array_get(cs_data, cs_idx)
|
||||
let metadata: String = json_get_raw(session, "metadata")
|
||||
let plan: String = if str_eq(metadata, "") { "" } else { json_get(metadata, "plan") }
|
||||
if str_eq(plan, "founding") {
|
||||
let count = count + 1
|
||||
}
|
||||
let cs_idx = cs_idx + 1
|
||||
}
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user