mirror of https://github.com/kortix-ai/suna.git
show no plan as free plan
This commit is contained in:
parent
338a2da546
commit
5456ac042f
|
@ -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
|
|||
<div className="flex flex-col gap-2">
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="text-sm font-medium text-foreground/90">Status</span>
|
||||
<span className="text-sm font-medium text-card-title">{billingData.status === 'active' ? 'Active' : 'Inactive'}</span>
|
||||
<span className="text-sm font-medium text-card-title">
|
||||
{(!currentPlanId || currentPlanId === SUBSCRIPTION_PLANS.FREE) ? 'Active (Free)' : billingData.status === 'active' ? 'Active' : 'Inactive'}
|
||||
</span>
|
||||
</div>
|
||||
{billingData.plan_name && (
|
||||
<div className="flex justify-between items-center">
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue