From 2c4d04d542e4e1669cce99850117b45833197554 Mon Sep 17 00:00:00 2001 From: Bereket Engida <86073083+Bekacru@users.noreply.github.com> Date: Mon, 8 Dec 2025 01:45:48 -0800 Subject: [PATCH] docs: add enterprise page and form for support (#6607) Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- .cspell/third-party.txt | 3 +- docs/app/api/support/route.ts | 76 +++-- docs/app/community/_components/stats.tsx | 22 +- .../_components/enterprise-form.tsx | 265 ++++++++++++++++++ .../_components/enterprise-hero.tsx | 193 +++++++++++++ docs/app/enterprise/page.tsx | 72 +++++ docs/app/global.css | 2 +- docs/components/nav-bar.tsx | 5 +- docs/components/nav-mobile.tsx | 6 +- docs/components/theme-toggler.tsx | 4 +- docs/package.json | 1 + docs/public/enterprise.png | Bin 0 -> 690386 bytes pnpm-lock.yaml | 33 ++- 13 files changed, 638 insertions(+), 44 deletions(-) create mode 100644 docs/app/enterprise/_components/enterprise-form.tsx create mode 100644 docs/app/enterprise/_components/enterprise-hero.tsx create mode 100644 docs/app/enterprise/page.tsx create mode 100644 docs/public/enterprise.png diff --git a/.cspell/third-party.txt b/.cspell/third-party.txt index aa3420c372..7a2477187b 100644 --- a/.cspell/third-party.txt +++ b/.cspell/third-party.txt @@ -32,4 +32,5 @@ vinxi giget segoe conar -nuxtzzle \ No newline at end of file +nuxtzzle +Deel \ No newline at end of file diff --git a/docs/app/api/support/route.ts b/docs/app/api/support/route.ts index 5eb55d6ce0..ffe9c4901d 100644 --- a/docs/app/api/support/route.ts +++ b/docs/app/api/support/route.ts @@ -1,4 +1,17 @@ import { NextResponse } from "next/server"; +import { Resend } from "resend"; + +// Helper function to escape HTML entities +function escapeHtml(text: string): string { + const map: Record = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + }; + return text.replace(/[&<>"']/g, (m) => map[m]); +} export async function POST(request: Request) { try { @@ -12,6 +25,8 @@ export async function POST(request: Request) { interest, features, additional, + migrating, + currentPlatform, } = body ?? {}; if (!name || !email) { @@ -20,34 +35,47 @@ export async function POST(request: Request) { { status: 400 }, ); } - - const payload = { - name, - email, - company: company ?? "", - website: website ?? "", - userCount: userCount ?? "", - interest: interest ?? "", - features: features ?? "", - additional: additional ?? "", - submittedAt: new Date().toISOString(), - userAgent: request.headers.get("user-agent") ?? undefined, - referer: request.headers.get("referer") ?? undefined, - }; - - const webhook = process.env.SUPPORT_WEBHOOK_URL; - if (webhook) { + const toEmail = process.env.SUPPORT_EMAIL; + if (!toEmail) { + return NextResponse.json( + { error: "Missing required fields" }, + { status: 400 }, + ); + } + const resendApiKey = process.env.RESEND_API_KEY; + if (resendApiKey) { try { - await fetch(webhook, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(payload), + const resend = new Resend(resendApiKey); + await resend.emails.send({ + from: "Enterprise Support ", + to: toEmail || "", + subject: `${interest === "enterprise" ? "Enterprise" : "Support"} Inquiry from ${name}`, + html: ` +
+

${interest === "enterprise" ? "Enterprise" : "Support"} Inquiry

+
+

Name: ${escapeHtml(name)}

+

Email: ${escapeHtml(email)}

+ ${company ? `

Company: ${escapeHtml(company)}

` : ""} + ${website ? `

Website: ${escapeHtml(website)}

` : ""} + ${userCount ? `

User Count: ${escapeHtml(userCount)}

` : ""} + ${migrating ? `

Migrating: ${migrating === "yes" ? "Yes" : "No"}

` : ""} + ${currentPlatform ? `

Current Platform: ${escapeHtml(currentPlatform)}

` : ""} + ${interest ? `

Interest: ${escapeHtml(interest)}

` : ""} + ${features ? `

Features: ${escapeHtml(features)}

` : ""} + ${additional ? `

Message:
${escapeHtml(additional).replace(/\n/g, "
")}

` : ""} +
+

+ Submitted: ${new Date().toLocaleString()}
+ User Agent: ${escapeHtml(request.headers.get("user-agent") || "N/A")}
+ Referer: ${escapeHtml(request.headers.get("referer") || "N/A")} +

+
+ `, }); } catch (e) { - console.error("Support webhook failed", e); + console.error("Resend email failed", e); } - } else { - console.log("[support] submission", payload); } return NextResponse.json({ ok: true }); diff --git a/docs/app/community/_components/stats.tsx b/docs/app/community/_components/stats.tsx index 9156ea6316..806d0bc3d5 100644 --- a/docs/app/community/_components/stats.tsx +++ b/docs/app/community/_components/stats.tsx @@ -27,7 +27,7 @@ export default function Stats({ - + Discord @@ -71,7 +71,7 @@ export default function Stats({ >