'use client' import { useState, useEffect } from 'react' import Link from 'next/link' const plans = [ { name: 'Free', price: '$0', credits: '30 / month', features: ['9 endpoints', '1 concurrent', 'Community support'] }, { name: 'Hobby', price: '$9', credits: '1,000 / month', features: ['9 endpoints', '3 concurrent', 'Email support', 'Webhooks'] }, { name: 'Starter', price: '$19', credits: '3,000 / month', features: ['9 endpoints', '5 concurrent', 'Priority support', 'Webhooks', 'AI extraction'] }, { name: 'Pro', price: '$49', credits: '10,000 / month', features: ['All endpoints', '10 concurrent', 'Priority support', 'Webhooks', 'AI extraction', 'Proxy rotation'] }, { name: 'Startup', price: '$99', credits: '25,000 / month', features: ['All endpoints', '20 concurrent', 'Dedicated support', 'Custom integrations', 'SLA'] }, ] export default function Billing() { const [token, setToken] = useState('') const [credits, setCredits] = useState(null) const [usage, setUsage] = useState(0) useEffect(() => { const t = localStorage.getItem('crawlapi_token') if (t) { setToken(t) fetchUser(t) } }, []) async function fetchUser(t: string) { try { const res = await fetch('http://localhost:3000/api/auth/api-keys', { headers: { 'x-auth-token': t } }) // Just a mock - in production this would call a /me endpoint setCredits(30) setUsage(12) } catch (e) { console.error(e) } } return (

Billing

Manage your subscription and usage.

{token && credits !== null && (

Current Usage

{credits - usage}
Credits remaining
{usage}
Used this month
{credits}
Total credits
)}
{plans.map(plan => (
{plan.name}
{plan.price}/mo
{plan.credits}
    {plan.features.map((f, i) => (
  • ✓ {f}
  • ))}
))}
) }