undoToast(message) shows a Sonner toast with an Undo button. It resolves true when the toast closes and false if Undo is clicked, so run the action only on true.
pnpm dlx shadcn@latest add "https://sureui.com/r/undo-toast.json"