"use client"; import { useAuthQuery } from "@/hooks/use-auth-query"; import { useTranslations } from "next-intl"; import { Check } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { api } from "@/convex/_generated/api"; import { authClient } from "@/lib/auth-client"; import { normalizeTier, SUBSCRIPTION_PRODUCTS, TIER_MONTHLY_CREDITS, } from "@/lib/polar-products"; import { toast } from "@/lib/toast"; const TIER_ORDER = ["free", "starter", "pro", "max"] as const; export function PricingCards() { const t = useTranslations('toasts'); const subscription = useAuthQuery(api.credits.getSubscription); const currentTier = normalizeTier(subscription?.tier); async function handleCheckout(polarProductId: string) { toast.info( t('billing.redirectingToCheckoutTitle'), t('billing.redirectingToCheckoutDesc'), ); await authClient.checkout({ products: [polarProductId] }); } return (
EUR 0
{TIER_MONTHLY_CREDITS.free} Credits / month
EUR {product.price}
{product.credits.toLocaleString("de-DE")} Credits / month