Add enterprise inquiry form with headcount filter, wire /api/enterprise-inquiry
This commit is contained in:
+24
@@ -239,6 +239,28 @@ fn handle_request(method: String, path: String, body: String) -> String {
|
||||
return "{\"__status__\":500,\"error\":\"Stripe session creation failed\"}"
|
||||
}
|
||||
|
||||
// ── Enterprise inquiry ────────────────────────────────────────────────────
|
||||
if str_eq(path, "/api/enterprise-inquiry") {
|
||||
let resend_key: String = state_get("__resend_api_key__")
|
||||
let name_val: String = if str_contains(body, "\"name\"") { "submitted" } else { "" }
|
||||
if str_eq(name_val, "") {
|
||||
return "{\"error\":\"invalid request\"}"
|
||||
}
|
||||
// Log to stdout regardless of email delivery
|
||||
println("[enterprise-inquiry] " + body)
|
||||
// Send via Resend if key is configured
|
||||
if !str_eq(resend_key, "") {
|
||||
let email_body: String = "{\"from\":\"Neuron Enterprise <enterprise@neurontechnologies.ai>\",\"to\":[\"enterprise@neurontechnologies.ai\"],\"subject\":\"Enterprise Inquiry\",\"text\":" + body + "}"
|
||||
let resp: String = http_post_auth(
|
||||
"https://api.resend.com/emails",
|
||||
resend_key,
|
||||
email_body
|
||||
)
|
||||
println("[enterprise-inquiry] resend: " + resp)
|
||||
}
|
||||
return "{\"received\":true}"
|
||||
}
|
||||
|
||||
// ── Stripe webhook ────────────────────────────────────────────────────────
|
||||
if str_eq(path, "/api/webhooks/stripe") {
|
||||
if str_contains(body, "checkout.session.completed") {
|
||||
@@ -322,11 +344,13 @@ 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")
|
||||
let resend_api_key: String = env("RESEND_API_KEY")
|
||||
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)
|
||||
state_set("__resend_api_key__", resend_api_key)
|
||||
|
||||
println(color_bold("Neuron landing") + " — http://localhost:3001")
|
||||
println(" HTML generated by El → " + html_path)
|
||||
|
||||
Reference in New Issue
Block a user