diff --git a/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx b/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx index ea00748da..ff3f8b425 100644 --- a/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx +++ b/apps/dashboard/src/app/(dashboard)/settings/billing/client.tsx @@ -84,6 +84,7 @@ export function Client() { const { data: workspace } = useQuery(trpc.workspace.get.queryOptions()); // Captured on mount: the toasts clear the params while the dialog is open. const [askIntent, setAskIntent] = useState(Boolean(success || trial)); + const [startedTrial] = useState(Boolean(trial)); const { data: hasIntent } = useQuery({ ...trpc.feedback.hasSubmitted.queryOptions({ source: "upgrade-intent" }), enabled: askIntent, @@ -167,7 +168,14 @@ export function Client() { } await new Promise((resolve) => setTimeout(resolve, 1_000)); } - if (!cancelled) setSearchParams({ trial: null }); + if (cancelled) return; + // Webhook still pending: confirm checkout without claiming the trial. + toast.success("Checkout complete", { + description: "Your trial starts as soon as Stripe confirms it.", + duration: 5_000, + onAutoClose: () => setSearchParams({ trial: null }), + onDismiss: () => setSearchParams({ trial: null }), + }); })(); return () => { cancelled = true; @@ -212,6 +220,7 @@ export function Client() {
diff --git a/apps/dashboard/src/components/dialogs/upgrade-intent.tsx b/apps/dashboard/src/components/dialogs/upgrade-intent.tsx index b2b424c7b..b4c866893 100644 --- a/apps/dashboard/src/components/dialogs/upgrade-intent.tsx +++ b/apps/dashboard/src/components/dialogs/upgrade-intent.tsx @@ -1,5 +1,6 @@ "use client"; +import { TRIAL_DAYS } from "@openstatus/api/src/router/stripe/trial-config"; import { Button } from "@openstatus/ui/components/ui/button"; import { Dialog, @@ -19,7 +20,10 @@ import { toast } from "sonner"; import { useTRPC } from "@/lib/trpc/client"; /** Asked after an upgrade or trial start; stored as `upgrade-intent` feedback. */ -export function UpgradeIntentDialog(props: DialogProps) { +export function UpgradeIntentDialog({ + trial, + ...props +}: DialogProps & { trial?: boolean }) { const trpc = useTRPC(); const queryClient = useQueryClient(); const id = useId(); @@ -45,6 +49,9 @@ export function UpgradeIntentDialog(props: DialogProps) { What are you using openstatus for? + {trial + ? `Your ${TRIAL_DAYS}-day Starter trial has started.` + : "Your plan is active."}{" "} A sentence or two helps us tailor openstatus to you.