fix(billing): resolve react query cache conflict rendering undefined values, update enterprise CTA label and show plan cards for all tiers
This commit is contained in:
@@ -54,17 +54,18 @@ export function BillingPlans() {
|
||||
},
|
||||
});
|
||||
|
||||
const { data: quotas } = useQuery({
|
||||
const { data: usageData } = useQuery({
|
||||
queryKey: ['usage', 'current'],
|
||||
queryFn: async () => {
|
||||
const res = await fetch('/api/usage/current');
|
||||
if (!res.ok) throw new Error('Failed to fetch quotas');
|
||||
const data = await res.json();
|
||||
return data.quotas as Record<string, { remaining: number; limit: number; used: number }>;
|
||||
return res.json();
|
||||
},
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
const quotas = usageData?.quotas;
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const sessionId = params.get('session_id');
|
||||
@@ -455,8 +456,7 @@ export function BillingPlans() {
|
||||
{/* Billing History (Only for paid users) */}
|
||||
{isPaid && <BillingHistory />}
|
||||
|
||||
{/* Interval Toggle & Plan Cards (Only for BASIC/Free users) */}
|
||||
{!isPaid && (
|
||||
{/* Interval Toggle & Plan Cards */}
|
||||
<div className="space-y-8 pt-6 border-t border-border/40">
|
||||
<div className="text-center space-y-2">
|
||||
<h3 className="text-xs font-bold uppercase tracking-[0.2em] text-concrete">
|
||||
@@ -541,7 +541,6 @@ export function BillingPlans() {
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Footer Info */}
|
||||
<div className="bg-slate-50 dark:bg-black/20 rounded-[32px] p-8 border border-border/40 flex flex-col md:flex-row items-center justify-between gap-8">
|
||||
|
||||
@@ -2860,7 +2860,7 @@
|
||||
"businessFeature4": "1,000 chat messages / month",
|
||||
"enterpriseTitle": "Enterprise",
|
||||
"enterpriseDescription": "Custom quotas, SSO, priority support.",
|
||||
"contactSales": "Contact Sales",
|
||||
"contactSales": "Contact us",
|
||||
"startCheckout": "Get Started",
|
||||
"checkoutLoading": "Loading checkout…",
|
||||
"checkoutSuccess": "Subscription activated! Welcome to {tier}.",
|
||||
|
||||
@@ -2864,7 +2864,7 @@
|
||||
"businessFeature4": "1 000 messages de chat / mois",
|
||||
"enterpriseTitle": "Entreprise",
|
||||
"enterpriseDescription": "Quotas personnalisés, SSO, support prioritaire.",
|
||||
"contactSales": "Contacter les ventes",
|
||||
"contactSales": "Contactez-nous",
|
||||
"startCheckout": "Commencer",
|
||||
"checkoutLoading": "Chargement du paiement…",
|
||||
"checkoutSuccess": "Abonnement activé ! Bienvenue dans {tier}.",
|
||||
|
||||
Reference in New Issue
Block a user