"use client"; import { signOut } from "next-auth/react"; import { useState } from "react"; import { SUPPORT_EMAIL } from "@/lib/plans"; type Props = { email: string; }; export function AccountPrivacyActions({ email }: Props) { const [deleting, setDeleting] = useState(false); const [error, setError] = useState(null); async function handleDeleteAccount() { if ( !confirm( "Delete your account permanently? This removes your jobs, uploads, and YouTube connection. This cannot be undone.", ) ) { return; } setDeleting(true); setError(null); try { const res = await fetch("/api/account/delete", { method: "POST" }); const data = await res.json(); if (!res.ok) throw new Error(data.error || "Failed to delete account"); await signOut({ callbackUrl: "/" }); } catch (err) { setError(err instanceof Error ? err.message : "Failed to delete account"); setDeleting(false); } } const dataRequestSubject = encodeURIComponent("Data export request"); const dataRequestBody = encodeURIComponent( `Hello,\n\nI would like to request a copy of my personal data associated with my Songs2YT account (${email}).\n\nThank you.`, ); return (
{error && (
{error}
)}
Request my data

Data requests are handled within the timelines described in our{" "} Privacy Policy .

); }