// Langfuse Cloud only import { useMemo } from "react"; import { Button } from "@/src/components/ui/button"; import Link from "next/link"; import { useSupportDrawer } from "@/src/features/support-chat/SupportDrawerProvider"; import { StripeCustomerPortalButton } from "./StripeCustomerPortalButton"; import { BillingSwitchPlanDialog } from "./BillingSwitchPlanDialog"; import { useBillingInformation } from "./useBillingInformation"; import { StripeCancellationButton } from "./StripeCancellationButton"; export const BillingActionButtons = () => { const { organization, hasValidPaymentMethod, isLoading } = useBillingInformation(); const { setOpen } = useSupportDrawer(); // Show pricing page button const shouldDisableChangePlan = useMemo(() => { if (!organization?.cloudConfig?.stripe?.activeSubscriptionId) { return false; // always show for hobby plan users } return !hasValidPaymentMethod; }, [ organization?.cloudConfig?.stripe?.activeSubscriptionId, hasValidPaymentMethod, ]); // Do not show checkout or customer portal if manual plan is set in cloud config if (organization?.cloudConfig?.plan) { return (
); } return (
{/* Always show – also for people who are currently on hobby plan */} {organization?.cloudConfig?.stripe?.activeSubscriptionId && ( <> )}
{organization?.cloudConfig?.stripe?.activeSubscriptionId && !hasValidPaymentMethod && !isLoading && (

You do not have a valid payment method. Please Update Billing Details.

)}
); };