import { useState } from "react"; import { Button } from "@/src/components/ui/button"; import { Dialog, DialogBody, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/src/components/ui/dialog"; import { api } from "@/src/utils/api"; import { toast } from "sonner"; import { nanoid } from "nanoid"; export const StripeKeepPlanButton = ({ orgId, stripeProductId, onProcessing, processing, }: { orgId: string | undefined; stripeProductId: string; onProcessing: (id: string | null) => void; processing: boolean; }) => { const [_opId, setOpId] = useState(null); const clearSchedule = api.cloudBilling.clearPlanSwitchSchedule.useMutation({ onSuccess: () => { toast.success("Kept current plan"); onProcessing(null); setOpId(null); setTimeout(() => window.location.reload(), 500); }, onError: () => { onProcessing(null); setOpId(null); toast.error("Failed to keep current plan"); }, }); if (!orgId) return null; return ( Confirm Keeping Current Plan

You have a scheduled plan change on your current subscription. Keeping your current plan will remove that schedule and you will remain on your existing plan.

Your features and pricing will stay as-is; usage continues to be billed under your current plan. Do you want to keep your current plan and cancel the scheduled change?

); };