import type { BrowserAccountsClientLike, ManagedAuthDeepLinkResolution, ManagedAuthLoginTransaction, ManagedAuthSessionSetProjection } from "@opengeni/sdk/accounts"; import { type ReactNode } from "react"; export type BrowserAccountTransitionPhase = "preflight" | "blocked" | "committing" | "loading" | "ready" | "recoverable_error"; export type BrowserAccountTransitionKind = "add" | "select" | "logout_one" | "logout_all" | "reauth" | "cross_tab"; export type BrowserAccountTransitionBlocker = { id: string; label: string; detail?: string | undefined; }; export type BrowserAccountTransition = { kind: BrowserAccountTransitionKind; from: ManagedAuthSessionSetProjection | null; to: ManagedAuthSessionSetProjection | null; signal: AbortSignal; }; export type BrowserAccountsProviderProps = { client: BrowserAccountsClientLike; /** * Hide the authenticated tree, abort old actor work, clear tenant-bound * state, recreate credentials/clients, and refetch principal access here. * Cross-tab/server invalidation first calls this with `to: null` as a * neutral fence before authority is reread, then calls it with the accepted * projection after the new actor is known. */ onActorTransition: (transition: BrowserAccountTransition) => Promise; children?: ReactNode; broadcastChannelName?: string | null | undefined; /** Adopt the already-authenticated legacy provider session during dual-mode rollout. */ bootstrapLegacySession?: boolean | undefined; }; type BlockerInspector = () => BrowserAccountTransitionBlocker | null; export type BrowserAccountsContextValue = { projection: ManagedAuthSessionSetProjection | null; phase: BrowserAccountTransitionPhase; blockers: BrowserAccountTransitionBlocker[]; error: Error | null; transaction: ManagedAuthLoginTransaction | null; hasPendingTransition: boolean; refresh: () => Promise; invalidateActor: () => Promise; registerTransitionBlocker: (id: string, inspect: BlockerInspector) => () => void; continueTransition: () => Promise; cancelPendingTransition: () => void; beginAdd: (returnIntent?: string | undefined) => Promise; beginReauth: (slotId: string, returnIntent?: string | undefined) => Promise; completeEmailPassword: (input: { email: string; password: string; }) => Promise; settleExternalLoginTransaction: (transactionId: string) => Promise; cancelLoginTransaction: () => Promise; selectSlot: (slotId: string) => Promise; logoutSlot: (slotId: string, replacementSlotId: string | null) => Promise; logoutAll: () => Promise; resolveDeepLink: (path: string) => Promise; }; export declare function BrowserAccountsProvider({ client, onActorTransition, children, broadcastChannelName, bootstrapLegacySession, }: BrowserAccountsProviderProps): import("react").JSX.Element; export declare function useBrowserAccounts(): BrowserAccountsContextValue; /** Read the optional controller without requiring non-legacy hosts to mount it. */ export declare function useOptionalBrowserAccounts(): BrowserAccountsContextValue | null; export declare function useBrowserAccountTransitionBlocker(id: string, inspect: BlockerInspector): void; /** No-op on legacy hosts that do not mount the optional accounts provider. */ export declare function useOptionalBrowserAccountTransitionBlocker(id: string, inspect: BlockerInspector): void; export {};