"use client"; import { useId } from "react"; import { useAssistant } from "@/components/Assistant"; import { cancelPrompt, cancelUrl, negotiatePrompt, type Negotiable, type Stream } from "@/lib/subscriptions"; // "Cancel" opens a small native popover with the cancel page (when known) and a broke AI draft. // "Negotiate" shows only on internet, phone and insurance bills. export function CancelActions({ stream, kind, state }: { stream: Stream; kind: Negotiable | null; state?: string }) { const { ask } = useAssistant(); const id = useId(); const url = cancelUrl(stream.merchant_name); const close = () => (document.getElementById(id) as HTMLElement & { hidePopover?: () => void })?.hidePopover?.(); return ( <> {kind && ( )}
Cancel {stream.merchant_name}
{url ? (

Cancel it yourself here:{" "} {url.replace(/^https:\/\/(www\.)?/, "")}

) : (

broke has no direct cancel link for {stream.merchant_name}. Check your account settings on their site, or send them a message.

)}
); }