import { useActionMutation, useActionQuery, } from "@agent-native/core/client/hooks"; import { toast } from "sonner"; import { ActionQueryError } from "../../components/action-query-error"; import { DispatchShell } from "../../components/dispatch-shell"; import { Button } from "../../components/ui/button"; export function meta() { return [{ title: "Identities — Dispatch" }]; } export default function IdentitiesRoute() { const query = useActionQuery("list-linked-identities", {}); const { data } = query; const createToken = useActionMutation("create-link-token", { onSuccess: () => toast.success("Link token created"), }); return ( {query.isError ? ( void query.refetch()} /> ) : (

Active links

{(data?.links || []).map((link: any) => (
{link.externalUserName || link.externalUserId}
{link.platform} → {link.ownerEmail}
))} {(data?.links?.length || 0) === 0 && (
No linked identities yet. Generate a token and ask the user to send /link TOKEN from Slack or Telegram.
)}

Link tokens

{(data?.tokens || []).map((token: any) => (
/link {token.token}
{token.platform} · expires{" "} {new Date(token.expiresAt).toLocaleString()} {token.claimedAt ? ` · claimed by ${token.claimedByExternalUserName || token.claimedByExternalUserId}` : " · waiting to be claimed"}
))} {(data?.tokens?.length || 0) === 0 && (
No active link tokens.
)}
)}
); }