diff --git a/frontend/src/components/basejump/account-billing-status.tsx b/frontend/src/components/basejump/account-billing-status.tsx index 11014aba..6a2c7ae6 100644 --- a/frontend/src/components/basejump/account-billing-status.tsx +++ b/frontend/src/components/basejump/account-billing-status.tsx @@ -3,7 +3,7 @@ import { Alert, AlertDescription, AlertTitle } from "../ui/alert"; import { createClient } from "@/lib/supabase/server"; import { SubmitButton } from "../ui/submit-button"; import { manageSubscription } from "@/lib/actions/billing"; -import { PlanComparison } from "../billing/PlanComparison"; +import { PlanComparison, SUBSCRIPTION_PLANS } from "../billing/PlanComparison"; type Props = { accountId: string; @@ -80,7 +80,9 @@ export default async function AccountBillingStatus({ accountId, returnUrl }: Pro
Status - {billingData.status === 'active' ? 'Active' : 'Inactive'} + + {(!currentPlanId || currentPlanId === SUBSCRIPTION_PLANS.FREE) ? 'Active (Free)' : billingData.status === 'active' ? 'Active' : 'Inactive'} +
{billingData.plan_name && (
diff --git a/frontend/src/components/billing/PlanComparison.tsx b/frontend/src/components/billing/PlanComparison.tsx index 2c278da8..7adc8b7a 100644 --- a/frontend/src/components/billing/PlanComparison.tsx +++ b/frontend/src/components/billing/PlanComparison.tsx @@ -7,7 +7,7 @@ import { setupNewSubscription } from "@/lib/actions/billing"; import { createClient } from "@/lib/supabase/client"; import { useEffect, useState } from "react"; -const SUBSCRIPTION_PLANS = { +export const SUBSCRIPTION_PLANS = { FREE: 'price_1RDQbOG6l1KZGqIrgrYzMbnL', BASIC: 'price_1RC2PYG6l1KZGqIrpbzFB9Lp', // Example price ID PRO: 'price_1RDQWqG6l1KZGqIrChli4Ys4' @@ -60,7 +60,11 @@ export function PlanComparison({ .eq('status', 'active') .single(); - setCurrentPlanId(data?.price_id); + // Set to FREE plan if no active subscription found, otherwise use the subscription's plan + setCurrentPlanId(data?.price_id || SUBSCRIPTION_PLANS.FREE); + } else { + // Default to FREE plan if no accountId + setCurrentPlanId(SUBSCRIPTION_PLANS.FREE); } }