'use client'; import { ExternalLink, Receipt } from 'lucide-react'; import { useState } from 'react'; import { Loader2 } from 'lucide-react'; import { useLanguage } from '@/lib/i18n'; export function BillingHistory() { const { t } = useLanguage(); const [loading, setLoading] = useState(false); const handleOpenPortal = async () => { setLoading(true); try { const res = await fetch('/api/billing/portal', { method: 'POST' }); const data = await res.json(); if (!res.ok) throw new Error(data.error ?? 'Failed'); window.location.href = data.url; } catch { // ignore — portal not configured } finally { setLoading(false); } }; return (
{t('billing.noUsage')}