Files
podcastdistributiona/app/(marketing)/pricing/page.tsx
T
Leon SerfatyandClaude Opus 5 3e9ba07175 feat: Cloudflare Turnstile on auth, CSP fixes, admin/SEO/analytics additions
Turnstile bot protection (sign-in, sign-up, password-reset):
- Register Better Auth's captcha plugin with the cloudflare-turnstile
  provider; endpoints listed explicitly rather than relying on defaults.
  /reset-password is intentionally excluded — it is reached only via a
  single-use emailed token.
- Add an explicit-render Turnstile widget component. Tokens are single-use,
  so each form resets the challenge after a failed submit; submit stays
  disabled until a token is held.
- Read the site key server-side and pass it down as a prop, so rotating it
  does not require a rebuild.
- Fail fast in production when TURNSTILE_SECRET_KEY is missing, and when a
  secret is set without a site key (that combination would demand a token
  no form can produce, locking every user out).
- Pass a throwaway secret during `next build` in the Dockerfile, mirroring
  the existing BETTER_AUTH_SECRET treatment, so image builds don't need it.

CSP fixes in middleware (these blocked Turnstile entirely):
- Add frame-src for challenges.cloudflare.com. Without it the widget's
  iframe fell back to default-src 'self' and was blocked outright.
- Allow 'unsafe-eval' and websockets in DEVELOPMENT only. `next dev`
  compiles with eval(), so the strict policy threw EvalError and killed
  hydration — no client JS ran at all, which also meant form submit
  handlers never fired. Production policy is unchanged and still strict.

Also included (concurrent work in the tree):
- Admin organizations pages and lib/admin/orgs.
- Episode moderation migration, SEO metadata (sitemap, robots, JSON-LD,
  OG/Twitter images, manifest), Umami analytics, not-found page.

Local dev database: docker-compose.dev.yml provisions Postgres 18 on port
5443 (5432-5442 are in use by other local projects).

Note: `npx tsc --noEmit` currently fails in app/(app)/team/page.tsx — an
`invitations` prop the component does not accept. This predates the commit
and will fail `next build` until fixed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 11:10:55 -04:00

96 lines
3.9 KiB
TypeScript

import type { Metadata } from "next";
import Link from "next/link";
import { Check } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent } from "@/components/ui/card";
import { PLAN_ORDER, PLANS } from "@/lib/billing/plans";
import { formatPrice } from "@/lib/utils";
import { JsonLd } from "@/components/seo/json-ld";
import { breadcrumbSchema, graph, softwareApplicationSchema, webPageSchema } from "@/lib/schema";
import { pageMetadata } from "@/lib/seo";
/** Shared by the page metadata and this page's structured data. */
const DESCRIPTION =
"Simple plans for every podcaster — start free with 3 scripts a month and upgrade for unlimited scripts, longer episodes, an API, and a white-label team workspace.";
export const metadata: Metadata = pageMetadata({
title: "Pricing",
description: DESCRIPTION,
path: "/pricing",
});
export default function PricingPage() {
return (
<div className="bg-hero-wash">
<JsonLd
data={graph(
webPageSchema({
path: "/pricing",
name: "Pricing",
description: DESCRIPTION,
}),
breadcrumbSchema([{ name: "Pricing", path: "/pricing" }]),
softwareApplicationSchema()
)}
/>
<div className="container py-24 md:py-28">
<div className="mx-auto max-w-2xl text-center">
<p className="text-[13px] font-semibold uppercase tracking-[0.04em] text-brand">Pricing</p>
<h1 className="mt-3 font-display text-5xl font-extrabold tracking-tight md:text-6xl">
Start free, scale anytime
</h1>
<p className="mt-4 text-lg text-muted-foreground">
Upgrade for higher limits and more features. Cancel anytime. Pay with Stripe
or PayPal.
</p>
</div>
<div className="mt-16 grid gap-6 lg:grid-cols-4">
{PLAN_ORDER.map((key) => {
const plan = PLANS[key];
return (
<Card
key={key}
className={plan.highlight ? "relative ring-2 ring-brand shadow-lg" : "relative"}
>
{plan.highlight && (
<Badge className="absolute -top-3 left-1/2 -translate-x-1/2 bg-brand text-brand-foreground shadow-sm">
Most popular
</Badge>
)}
<CardContent className="flex h-full flex-col gap-6 p-7">
<div>
<h3 className="font-display text-lg font-bold tracking-tight">{plan.name}</h3>
<p className="mt-1 text-sm text-muted-foreground">{plan.tagline}</p>
</div>
<div className="flex items-baseline gap-1">
<span className="font-display text-5xl font-extrabold tracking-tight">{formatPrice(plan.priceMonthly)}</span>
<span className="text-sm text-muted-foreground">/mo</span>
</div>
<Button asChild className="w-full" variant={plan.highlight ? "default" : "outline"}>
<Link href="/sign-up">{key === "free" ? "Start free" : `Choose ${plan.name}`}</Link>
</Button>
<ul className="space-y-2.5 text-sm">
{plan.bullets.map((b) => (
<li key={b} className="flex gap-2.5">
<Check className="mt-0.5 h-4 w-4 shrink-0 text-brand" />
<span className="text-muted-foreground">{b}</span>
</li>
))}
</ul>
</CardContent>
</Card>
);
})}
</div>
<p className="mx-auto mt-12 max-w-2xl text-center text-xs text-muted-foreground">
Prices in USD. Annual billing saves roughly two months. Usage limits reset on the first of
each month.
</p>
</div>
</div>
);
}