import { useAbstraxnWallet, useConnectionType } from "@abstraxn/signer-react";
export function DeleteAccountButton() {
const { deleteAccount, disconnect, isConnected } = useAbstraxnWallet();
const { connectorMeta } = useConnectionType();
const isEmbedded =
isConnected &&
(connectorMeta?.category === "auth" || connectorMeta?.category === "oauth");
if (!isEmbedded || !deleteAccount) {
return null;
}
const handleDelete = async () => {
const ok = window.confirm(
"Permanently delete this account and wallet? This cannot be undone."
);
if (!ok) return;
try {
await deleteAccount();
await disconnect();
// Clear any app-specific session state here
} catch (error) {
console.error("Delete account failed:", error);
}
};
return <button onClick={() => void handleDelete()}>Delete account</button>;
}