import React, { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { useUser } from '@clerk/clerk-react'; import toast from 'react-hot-toast'; import { analytics } from '../utils/analytics'; import './Pricing.css'; // ─── Typy ──────────────────────────────────────────────────────────────────── interface PlanFeature { text: string; available: boolean; highlight?: boolean; } interface Plan { id: 'free' | 'pro' | 'enterprise'; name: string; price: string; priceSuffix: string; description: string; badge?: string; cta: string; ctaVariant: 'secondary' | 'primary' | 'enterprise'; features: PlanFeature[]; stripePriceId?: string; } // ─── Dane planów ───────────────────────────────────────────────────────────── const PLANS: Plan[] = [ { id: 'free', name: 'Free', price: '0 zł', priceSuffix: '/miesiąc', description: 'Idealne do testowania i małych projektów', cta: 'Zacznij za darmo', ctaVariant: 'secondary', features: [ { text: '3 aktywne projekty', available: true }, { text: '3 dokumenty PDF / projekt', available: true }, { text: 'Generator wniosków AI (Gemini)', available: true }, { text: 'Audytor wniosku (podstawowy)', available: true }, { text: 'Wyszukiwarka naborów GUS', available: true }, { text: 'Export DOCX', available: true }, { text: 'Analiza RAG (Pinecone)', available: false }, { text: 'Priorytetowe wsparcie', available: false }, { text: 'Custom branding', available: false }, { text: 'API access', available: false }, ], }, { id: 'pro', name: 'Pro', price: '299 zł', priceSuffix: '/miesiąc', description: 'Dla firm aktywnie pozyskujących dofinansowanie', badge: 'Najpopularniejszy', cta: 'Wybierz Pro', ctaVariant: 'primary', stripePriceId: import.meta.env.VITE_STRIPE_PRICE_ID_PRO, features: [ { text: 'Nieograniczone projekty', available: true, highlight: true }, { text: '50 dokumentów PDF / projekt', available: true, highlight: true }, { text: 'Generator wniosków AI (Gemini Pro)', available: true }, { text: 'Audytor wniosku (zaawansowany + DNSH)', available: true }, { text: 'Wyszukiwarka naborów GUS', available: true }, { text: 'Export DOCX + PDF', available: true }, { text: 'Analiza RAG (Pinecone wektoryzacja)', available: true, highlight: true }, { text: 'Priorytetowe wsparcie (48h)', available: true }, { text: 'Custom branding', available: false }, { text: 'API access', available: false }, ], }, { id: 'enterprise', name: 'Enterprise', price: 'Wycena', priceSuffix: 'indywidualna', description: 'Dla biur rachunkowych i agencji doradczych', cta: 'Skontaktuj się', ctaVariant: 'enterprise', features: [ { text: 'Nieograniczone projekty & dokumenty', available: true, highlight: true }, { text: 'Dedykowane środowisko Pinecone', available: true, highlight: true }, { text: 'Modele Bielik (polskie prawo)', available: true, highlight: true }, { text: 'Multi-tenant — wiele spółek', available: true, highlight: true }, { text: 'Audytor CrewAI (pełny pipeline)', available: true }, { text: 'Custom domain + white-label', available: true }, { text: 'SLA 99.9% uptime', available: true }, { text: 'API access + webhooks', available: true }, { text: 'Onboarding + szkolenie (4h)', available: true }, { text: 'Dedykowany opiekun klienta', available: true }, ], }, ]; // ─── FAQ ───────────────────────────────────────────────────────────────────── const FAQ_ITEMS = [ { q: 'Czy mogę zmienić plan w dowolnym momencie?', a: 'Tak. Upgrade następuje natychmiastowo, a opłata jest proporcjonalna do pozostałego okresu w danym miesiącu. Downgrade skutkuje zmianą od następnego okresu rozliczeniowego.', }, { q: 'Jak działa analiza RAG (Pinecone)?', a: 'Twoje dokumenty PDF są indeksowane wektorowo w Pinecone. Przy generowaniu wniosków AI automatycznie wyszukuje i cytuje odpowiednie fragmenty (regulaminy, wytyczne MFiPR), co eliminuje halucynacje i zwiększa wierność treści.', }, { q: 'Co się stanie z moimi danymi po anulowaniu subskrypcji?', a: 'Twoje projekty i dokumenty pozostają dostępne przez 30 dni po anulowaniu. Możesz je wyeksportować w tym czasie. Po 30 dniach dane są trwale usuwane.', }, { q: 'Czy plan Enterprise obejmuje integrację z GUS REGON?', a: 'Tak. Enterprise zawiera pełną integrację z GUS REGON API do automatycznego pobierania danych firmy, a także integrację z BDO i e-Zamówienia.', }, { q: 'Czy mogę przetestować plan Pro za darmo?', a: 'Oferujemy 14-dniowy trial Pro bez karty kredytowej. Skontaktuj się z nami na kontakt@grantforge.pl lub kliknij Wybierz Pro.', }, ]; // ─── Komponenty ────────────────────────────────────────────────────────────── const CheckIcon = () => ( ); const XIcon = () => ( ); const PlanCard: React.FC<{ plan: Plan; isPopular: boolean; onSelect: (plan: Plan) => void; loading: boolean; }> = ({ plan, isPopular, onSelect, loading }) => { return (
{plan.badge && (
{plan.badge}
)}
{plan.name}
{plan.price} {plan.priceSuffix}

{plan.description}

{plan.features.map((f, i) => (
{f.available ? : } {f.text}
))}
); }; const FAQItem: React.FC<{ q: string; a: string; index: number }> = ({ q, a, index }) => { const [open, setOpen] = useState(false); return (
{open &&
{a}
}
); }; // ─── Strona główna ──────────────────────────────────────────────────────────── const Pricing: React.FC = () => { const navigate = useNavigate(); const { user } = useUser(); const [loading, setLoading] = useState(null); const [billingAnnual, setBillingAnnual] = useState(false); const [visible, setVisible] = useState(false); useEffect(() => { const t = setTimeout(() => setVisible(true), 50); return () => clearTimeout(t); }, []); const handleSelectPlan = async (plan: Plan) => { if (plan.id === 'free') { navigate('/projects'); return; } if (plan.id === 'enterprise') { window.location.href = 'mailto:kontakt@grantforge.pl?subject=Enterprise%20-%20Zapytanie%20ofertowe'; return; } // Pro — Stripe checkout if (!user) { navigate('/sign-in'); return; } setLoading(plan.id); try { analytics.checkoutStarted(plan.id); const token = await (window as any).Clerk?.session?.getToken(); const res = await fetch('/api/subscription/checkout', { method: 'POST', headers: { 'Content-Type': 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}), }, body: JSON.stringify({ plan: plan.id }), }); if (!res.ok) { const err = await res.json().catch(() => ({})); throw new Error(err.detail || 'Błąd serwera'); } const data = await res.json(); if (data.checkout_url) { window.location.href = data.checkout_url; } } catch (err: unknown) { const msg = err instanceof Error ? err.message : 'Błąd płatności'; toast.error(`Nie udało się otworzyć płatności: ${msg}`); } finally { setLoading(null); } }; const annualDiscount = 0.2; // 20% rabatu rocznego const getPrice = (plan: Plan) => { if (plan.id !== 'pro' || !billingAnnual) return plan.price; return `${Math.round(299 * (1 - annualDiscount))} zł`; }; return (
{/* Hero */}
💡 Transparentne ceny bez ukrytych kosztów

Wybierz plan
dopasowany do skali

Od pierwszego wniosku testowego do kompleksowej obsługi portfela projektów.
Każdy plan zawiera pełny generator AI i audytor wniosków.

{/* Billing toggle */}
Miesięcznie Rocznie -20%
{/* Karty planów */}
{PLANS.map((plan) => ( ))}
{/* Trust signals */}
🔒 Płatności Stripe — PCI DSS Level 1
🇵🇱 Dane w Polsce (EU-West3)
📄 Faktura VAT
↩️ Zwrot w 14 dni
{/* FAQ */}

Najczęstsze pytania

{FAQ_ITEMS.map((item, i) => ( ))}
{/* CTA Bottom */}

Masz pytania? Napisz do nas.

Pomożemy dobrać plan i skonfigurować GrantForge AI dla Twojej organizacji.

📩 kontakt@grantforge.pl
); }; export default Pricing;