import React, { useState } from 'react' import { useNavigate } from 'react-router-dom' import { useMutation } from '@tanstack/react-query' import { billingAPI } from '@/services/api' import { useAuthStore } from '@/store/authStore' import { Button, Card } from '@/components/ui' import { Check, Zap, Building2, Star } from 'lucide-react' const PLANS = [ { id: 'free', name: 'Free', price: 0, description: 'Perfect for testing and development', icon: '🆓', color: 'gray', features: [ { text: 'Unlimited chatbot creation', included: true }, { text: 'Upload PDF, DOCX, CSV, XLSX', included: true }, { text: 'Unlimited preview testing', included: true }, { text: 'Shareable preview links', included: true }, { text: 'Publish to marketplace', included: false }, { text: 'Premium AI models', included: false }, { text: 'Code export', included: false }, { text: 'Analytics dashboard', included: false }, ], }, { id: 'starter', name: 'Starter', price: 39, description: 'For small businesses launching their first chatbot', icon: '🚀', color: 'blue', badge: 'Popular', features: [ { text: 'Everything in Free', included: true }, { text: 'Publish 1 chatbot to marketplace', included: true }, { text: 'Fireworks AI models (Llama, Mixtral)', included: true }, { text: '5,000 conversations/month', included: true }, { text: 'Analytics dashboard', included: true }, { text: 'Custom branding', included: true }, { text: 'Email support', included: true }, { text: 'Premium AI models (GPT-4, Claude)', included: false }, { text: 'Code export', included: false }, ], }, { id: 'pro', name: 'Pro', price: 119, description: 'For growing businesses with multiple products', icon: '⚡', color: 'purple', highlighted: true, features: [ { text: 'Everything in Starter', included: true }, { text: 'Build & publish 3 chatbots', included: true }, { text: 'GPT-4o, Claude 3.5, Gemini 1.5', included: true }, { text: '20,000 conversations/month', included: true }, { text: 'Code export (FastAPI + React widget)', included: true }, { text: 'Advanced analytics', included: true }, { text: 'Remove "Powered by" badge', included: true }, { text: 'Priority support', included: true }, { text: 'Custom domain', included: true }, ], }, { id: 'enterprise', name: 'Enterprise', price: null, description: 'For large organizations with custom needs', icon: '🏢', color: 'orange', features: [ { text: 'Everything in Pro', included: true }, { text: 'Unlimited chatbots', included: true }, { text: 'Unlimited conversations', included: true }, { text: 'Custom model fine-tuning', included: true }, { text: 'White-label platform', included: true }, { text: 'SSO (SAML)', included: true }, { text: 'SLA guarantees', included: true }, { text: 'Dedicated account manager', included: true }, { text: '24/7 phone support', included: true }, ], }, ] export const PricingPage: React.FC = () => { const { user } = useAuthStore() const navigate = useNavigate() const [loading, setLoading] = useState(null) const handleSubscribe = async (planId: string) => { if (!user) { navigate('/login'); return } if (planId === 'enterprise') { window.open('mailto:enterprise@contexta.ai?subject=Enterprise Inquiry', '_blank') return } if (planId === 'free') { navigate('/dashboard') return } setLoading(planId) try { const { checkout_url } = await billingAPI.createCheckout( planId, `${window.location.origin}/settings/billing?success=true`, `${window.location.origin}/pricing` ) window.location.href = checkout_url } catch (err: any) { alert(err.response?.data?.detail || 'Failed to create checkout session') } finally { setLoading(null) } } return (

Simple, transparent pricing

Start free and build as many chatbots as you want. Upgrade when you're ready to publish and go live.

{PLANS.map((plan) => (
{plan.badge && (
{plan.badge}
)}
{plan.icon}

{plan.name}

{plan.description}

{plan.price !== null ? (
${plan.price} /month
) : ( Custom )}
    {plan.features.map(({ text, included }) => (
  • {included ? : }
    {text}
  • ))}
))}
{/* FAQ */}

Frequently Asked Questions

{[ { q: 'What is preview mode?', a: 'Preview mode lets you build and test your chatbot for free with unlimited conversations. Only you (and people you share the link with) can access it until you publish.' }, { q: 'Can I cancel anytime?', a: 'Yes, you can cancel anytime. Your chatbots will remain in preview mode but will be removed from the marketplace.' }, { q: 'What is code export?', a: 'Pro plan users can export their chatbot as a complete, production-ready package including a FastAPI backend and React TypeScript widget — giving you full control to self-host.' }, { q: 'Do I need my own API keys?', a: 'No! Your API keys are handled by Contexta. However, if you export the code, you\'ll need your own API keys for self-hosted deployment.' }, ].map(({ q, a }) => (

{q}

{a}

))}
) }