Components
ElvixLeave

ElvixLeave

State-aware soft-delete (leave) wizard with 90-day grace restore and owner-locked pane for admin removals.

Leave Acme

Your membership is hidden right away. You have 90 days to change your mind and restore from this same surface. After that, the app stops showing up in your list. Your data on the app's side stays governed by their own policies.

Do you understand?

app/account/[appId]/leave/page.tsx
"use client";
import { ElvixLeave } from "@elvix.is/sdk/react";
import { useRouter } from "next/navigation";
export default function LeavePane({
appId,
appName,
deletedAt,
deletedBy,
}: {
appId: string;
appName: string;
deletedAt: string | null;
deletedBy: string | null;
}) {
const router = useRouter();
return (
<ElvixLeave
appId={appId}
appName={appName}
deletedAt={deletedAt}
deletedBy={deletedBy}
privacyPolicyUrl="https://yourapp.com/privacy"
termsOfServiceUrl="https://yourapp.com/terms"
onSuccess={(state) => {
// state is "left" (Active -> Leave wizard) or "restored" (in-grace -> Restore wizard).
// SDK skips its own done pane if you navigate here.
router.push(state === "left" ? "/account" : "/app");
}}
onFail={(error) => console.warn("[ElvixLeave]", error)}
/>
);
}

Props

PropTypeRequiredDefaultDescription
appIdstringoptionalactive session appScopes the wizard to a specific app membership. Accepts EITHER your public clientId OR the internal Application.id. Defaults to the active session's app.
appNamestringoptionalapp contextDisplay name shown in the warn copy.
deletedAtstring | nulloptionalmembership contextDrives surface selection. Non-null inside grace renders the Restore wizard.
deletedBystring | nulloptionalmembership contextIf set and not the current user, renders the owner-locked pane.
privacyPolicyUrlstring | nulloptionalapp contextSurfaced on the warn2 pane so the user sees the app's data policy before OTP.
termsOfServiceUrlstring | nulloptionalapp contextSurfaced on the warn2 pane next to the privacy link.
onSuccess(state: "left" | "restored") => voidoptionalnoneFires before the in-frame done pane. Host navigation here skips the done pane (host wins).
onFail(error: string) => voidoptionalnoneFires alongside the in-frame error pane. Notification hook only.
onResult(r: ElvixLeaveResult) => voidoptionalnoneFull discriminated callback. Narrow on r.ok before reading r.state or r.error.

Leaving never deletes data the app itself stores about the user. elvix only soft-deletes the membership and surfaces the app's privacy and ToS links on the warn2 pane so the user knows where to take that conversation next.

Owner-initiated removals (deletedBy set to someone other than the current user) render the locked pane. The user cannot self-restore in that state. The app owner must reverse the soft-delete from the Console.

Related