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 { ArrowRight, Check, Coins, Crown, Loader2, Scale, Shield, Zap } 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; enterprise: boolean | string; } const FEATURES: PlanFeature[] = [ { key: 'credits', free: '50 credits/30 days', pro: '500 credits/30 days', enterprise: 'Unlimited' }, { key: 'apiAccess', free: false, pro: true, enterprise: true }, { key: 'apiRequests', free: '—', pro: '1,000/month', enterprise: 'Unlimited' }, { key: 'maxFileSize', free: '50 MB', pro: '100 MB', enterprise: '500 MB' }, { key: 'historyRetention', free: '25 files', pro: '250 files', enterprise: 'Unlimited' }, { key: 'allTools', free: true, pro: true, enterprise: true }, { key: 'aiTools', free: true, pro: true, enterprise: true }, { key: 'priorityProcessing', free: false, pro: true, enterprise: true }, { key: 'noAds', free: false, pro: true, enterprise: true }, { key: 'emailSupport', free: false, pro: true, enterprise: true }, { key: 'customIntegrations', free: false, pro: false, enterprise: true }, { key: 'dedicatedSupport', free: false, pro: false, enterprise: true }, { key: 'userManagement', free: false, pro: false, enterprise: true }, ]; const MONTHLY_PRICES = { free: 0, pro: 9.99, enterprise: 29.99 }; const YEARLY_PRICES = { free: 0, pro: 7.99, enterprise: 24.99 }; 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); const [billing, setBilling] = useState<'monthly' | 'yearly'>('yearly'); async function handleUpgrade(plan: 'pro' | 'enterprise') { // Track interest in paid plan try { await api.post('/internal/admin/plan-interest/record', { plan, billing }); } catch { // Non-critical — don't block the flow } if (plan === 'enterprise') { window.location.href = '/contact'; return; } 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 { alert(t('pages.pricing.stripeNotReady', 'Payment system is being set up. Please try again later.')); } finally { setLoading(false); } } const prices = billing === 'yearly' ? YEARLY_PRICES : MONTHLY_PRICES; return ( <>
{/* Header + billing toggle */}

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

{t('pages.pricing.subtitle', 'Unlock the power of your PDFs with flexible plans.')}

{/* Billing toggle */}
{/* Transparency callout */}

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

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

{t('pages.pricing.transparencyAction')}
{/* 3-tier Plan Cards */}
{/* Free Plan */}

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

${prices.free} / {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')}
{/* Pro Plan */}
{t('pages.pricing.popular', 'MOST POPULAR')}

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

${prices.pro} / {t('pages.pricing.month', 'month')}
    {FEATURES.filter((f) => f.pro !== false).map((f) => (
  • {t(`pages.pricing.features.${f.key}`, f.key)} {typeof f.pro === 'string' && ( ({f.pro}) )}
  • ))}
{/* Enterprise Plan */}

{t('pages.pricing.enterprisePlan', 'Enterprise')}

${prices.enterprise} / {t('pages.pricing.month', 'month')}
    {FEATURES.filter((f) => f.enterprise !== false).map((f) => (
  • {t(`pages.pricing.features.${f.key}`, f.key)} {typeof f.enterprise === 'string' && ( ({f.enterprise}) )}
  • ))}
{/* Trust section */}

{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')}

{/* Bottom trust badges */}
{t('pages.pricing.securePayment', 'Secure Payment')}
{t('pages.pricing.moneyBack', '30-Day Money Back Guarantee')}
{/* 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.')}

); }