import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import SEOHead from '@/components/seo/SEOHead'; import { generateWebPage, getSiteOrigin } from '@/utils/seo'; import { Check, X, Zap, Crown, Loader2 } from 'lucide-react'; import { useAuthStore } from '@/stores/authStore'; import SocialProofStrip from '@/components/shared/SocialProofStrip'; import { getApiClient } from '@/services/api'; const API_BASE = import.meta.env.VITE_API_URL || ''; const api = getApiClient(); interface PlanFeature { key: string; free: boolean | string; pro: boolean | string; } const FEATURES: PlanFeature[] = [ { key: 'credits', free: '50 credits/30 days', pro: '500 credits/30 days' }, { key: 'apiAccess', free: false, pro: true }, { key: 'apiRequests', free: '—', pro: '1,000/month' }, { key: 'maxFileSize', free: '50 MB', pro: '100 MB' }, { key: 'historyRetention', free: '25 files', pro: '250 files' }, { key: 'allTools', free: true, pro: true }, { key: 'aiTools', free: true, pro: true }, { key: 'priorityProcessing', free: false, pro: true }, { key: 'noAds', free: false, pro: true }, { key: 'emailSupport', free: false, pro: true }, ]; export default function PricingPage() { const { t } = useTranslation(); const siteOrigin = getSiteOrigin(typeof window !== 'undefined' ? window.location.origin : ''); const user = useAuthStore((s) => s.user); const [loading, setLoading] = useState(false); async function handleUpgrade(billing: 'monthly' | 'yearly') { // Track interest in paid plan try { await api.post('/internal/admin/plan-interest/record', { plan: 'pro', billing }); } catch { // Non-critical — don't block the flow } if (!user) { window.location.href = '/account?redirect=pricing'; return; } setLoading(true); try { const { data } = await api.post(`${API_BASE}/stripe/create-checkout-session`, { billing }); if (data.url) window.location.href = data.url; } catch { // Stripe not configured yet — show message alert(t('pages.pricing.stripeNotReady', 'Payment system is being set up. Please try again later.')); } finally { setLoading(false); } } function renderValue(val: boolean | string) { if (val === true) return ; if (val === false) return ; return {val}; } return ( <>
{/* Header */}

{t('pages.pricing.title', 'Simple, Transparent Pricing')}

{t('pages.pricing.subtitle', 'Start free with all tools. Upgrade when you need more power.')}

{/* Plan Cards */}
{/* Free Plan */}

{t('pages.pricing.freePlan', 'Free')}

{t('pages.pricing.freeDesc', 'For personal use')}

$0 / {t('pages.pricing.month', 'month')}
    {FEATURES.filter((f) => f.free !== false).map((f) => (
  • {t(`pages.pricing.features.${f.key}`, f.key)} {typeof f.free === 'string' && ( ({f.free}) )}
  • ))}
{t('pages.pricing.getStarted', 'Get Started Free')}
{/* Pro Plan */}
{t('pages.pricing.popular', 'MOST POPULAR')}

{t('pages.pricing.proPlan', 'Pro')}

{t('pages.pricing.proDesc', 'For professionals & teams')}

$9 / {t('pages.pricing.month', 'month')}
    {FEATURES.map((f) => (
  • {t(`pages.pricing.features.${f.key}`, f.key)} {typeof f.pro === 'string' && ( ({f.pro}) )}
  • ))}

{t('pages.pricing.securePayment', 'Secure payment via Stripe')}

{t('pages.pricing.trustTitle')}

{t('pages.pricing.trustSubtitle')}

{t('pages.pricing.trustFastTitle')}

{t('pages.pricing.trustFastDesc')}

{t('pages.pricing.trustPrivateTitle')}

{t('pages.pricing.trustPrivateDesc')}

{t('pages.pricing.trustApiTitle')}

{t('pages.pricing.trustApiDesc')}

{/* Comparison Table */}
{FEATURES.map((f, idx) => ( ))}
{t('pages.pricing.feature', 'Feature')} {t('pages.pricing.freePlan', 'Free')} {t('pages.pricing.proPlan', 'Pro')}
{t(`pages.pricing.features.${f.key}`, f.key)} {renderValue(f.free)} {renderValue(f.pro)}
{/* FAQ */}

{t('pages.pricing.faqTitle', 'Frequently Asked Questions')}

{t('pages.pricing.faq1q', 'Is the Free plan really free?')}

{t('pages.pricing.faq1a', 'Yes! All 32+ tools are available for free with generous monthly limits. No credit card required.')}

{t('pages.pricing.faq2q', 'Can I cancel the Pro plan anytime?')}

{t('pages.pricing.faq2a', 'Absolutely. Cancel anytime — no questions asked. Your account reverts to the Free plan.')}

{t('pages.pricing.faq3q', 'What payment methods do you accept?')}

{t('pages.pricing.faq3a', 'We accept all major credit/debit cards via Stripe. Your payment information is securely processed — we never see your card details.')}

); }