import type { Connection, OAuthClientSummary } from "@executor-js/sdk/shared"; import { ownerLabel } from "../api/owner-display"; import { Alert, AlertDescription, AlertTitle } from "./alert"; import { Button } from "./button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "./dialog"; // --------------------------------------------------------------------------- // Remove-confirm dialog for a registered OAuth app — warns (does not block) // when the app still backs connections. Removal never cascades into those // connections; they keep their stored slug and surface a reconnect prompt at // their next token refresh. // --------------------------------------------------------------------------- export function RemoveOAuthAppDialog(props: { readonly client: OAuthClientSummary; readonly connections: readonly Connection[]; readonly onConfirm: () => void; readonly onClose: () => void; }) { const { client, connections } = props; const inUse = connections.length > 0; return ( (open ? undefined : props.onClose())}> Remove {String(client.slug)}? This permanently removes the {ownerLabel(client.owner).toLowerCase()} OAuth app and its stored client credentials. {inUse ? ( This app backs {connections.length} connection {connections.length === 1 ? "" : "s"}

Removing it won't delete those connections, but they'll need to reconnect at their next token refresh.

    {connections.map((connection: Connection) => (
  • {String(connection.integration)} / {String(connection.name)}
  • ))}
) : null}
); }