"use client"; import "./components/ui/tidal.css"; import { useState } from "react"; import { TidalSubscriptionCancel, type TidalCancellationStep, type TidalCancellationValue } from "./components/ui/subscription-cancel"; import "./components/ui/subscription-cancel.css"; const tidalExampleStyles = ".tidal-scope .subscription-cancel-demo {\n display: grid;\n gap: 12px;\n inline-size: min(100%, 760px);\n min-inline-size: 0;\n margin-inline: auto;\n}\n\n.tidal-scope .subscription-cancel-demo-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n min-inline-size: 0;\n padding-inline: 5px;\n}\n\n.tidal-scope .subscription-cancel-demo-footer p,\n.tidal-scope .subscription-cancel-demo-note {\n min-inline-size: 0;\n margin: 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.45;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .subscription-cancel-demo-footer button {\n flex: 0 0 auto;\n min-inline-size: 44px;\n min-block-size: 44px;\n border: 0;\n padding: 8px 10px;\n background: transparent;\n color: var(--t-ink);\n font: inherit;\n font-size: 11px;\n font-weight: 760;\n cursor: pointer;\n}\n\n.tidal-scope .subscription-cancel-demo-footer button:focus-visible {\n outline: 3px solid var(--t-accent);\n outline-offset: 2px;\n}\n\n.tidal-scope .subscription-cancel-demo-note {\n border-block-start: 1px solid var(--t-border);\n padding: 12px 5px 0;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .subscription-cancel-demo * {\n animation: none !important;\n transition-duration: 0s !important;\n }\n}"; const REASONS = [ { id: "usage", label: "We are not using it enough", description: "The sample workspace is quieter than expected.", }, { id: "temporary", label: "We need a temporary break", description: "The team may return after the current project.", }, { id: "other", label: "Another reason", description: "Add optional context below.", }, ] as const; const CHOICES = [ { id: "keep", label: "Keep the current plan", description: "Return to the sample workspace with no prepared change.", consequence: "Nothing changes in this preview.", retainedAccessApplies: false, }, { id: "pause", label: "Prepare a pause", description: "Record a local pause choice for review.", consequence: "A pause choice is prepared locally. No schedule is created.", }, { id: "cancel", label: "Prepare cancellation", description: "Keep access through the supplied date, then stop renewal.", consequence: "The sample workspace remains available through November 15, 2026. No cancellation is sent.", }, ] as const; const INITIAL: TidalCancellationValue = { step: "reason", reasonId: null, note: "", choiceId: null, confirmed: false, }; const NEXT: Record = { reason: "choice", choice: "confirm", confirm: "complete", complete: "complete", }; export function SubscriptionCancelDemo() { const [value, setValue] = useState(INITIAL); const [message, setMessage] = useState("Choose a reason to begin."); return (
setValue((current) => ({ ...current, reasonId })) } onNoteChange={(note) => setValue((current) => ({ ...current, note }))} onChoiceChange={(choiceId) => setValue((current) => ({ ...current, choiceId, confirmed: false, })) } onConfirmedChange={(confirmed) => setValue((current) => ({ ...current, confirmed })) } onStepChange={(step) => { setValue((current) => ({ ...current, step })); setMessage( step === "reason" ? "Review the reason." : step === "choice" ? "Choose a local outcome." : "Review the supplied consequence and access date.", ); }} onConfirm={(event) => { event.preventDefault(); setValue((current) => ({ ...current, step: NEXT[current.step] })); setMessage("Choice prepared locally. No subscription was changed."); }} completion="The selected outcome was prepared for review. No subscription was changed." />

{message}

Sample data. Choices stay in this preview and do not affect billing.

); } export default function AgentExample() { return (
); }