import type { AuthSession } from "../server/auth.js"; export type { AuthSession }; interface ClientAuthSession extends AuthSession { identitySsoEnabled?: boolean; } export { hasSessionHint, isSessionNavigationPending, } from "../shared/ssr-session-bootstrap.js"; /** * True while the app tree is mounted hidden ahead of the session read (a hinted * load). Identity-scoped onboarding reads and their events hold until it clears, * so they never record under the anonymous fallback identity. Other effects in * the tree run during the preload; each one must be safe before the session. */ export declare const SessionPreloadContext: import("react").Context; export declare function useSessionPreloading(): boolean; /** * What the session endpoint said that the page acted on: a signed-out body, * an HTTP 401, or a signed-in answer. Recorded with every session-driven * navigation, so a redirect to sign-in names its evidence. */ export type SessionEvidence = "signed_in" | "signed_out_body" | "http_401"; export type SessionNavigationReason = "signed_out" | "signed_in_app" | "sso_probe" | "beta_lane"; /** * The one way the client leaves a page because of what the session says (at * most once per document), and the one place that says why: `session_navigation` * carries the reason and, for a redirect to sign-in, the 401 or signed-out * evidence that decided it. The destination is never recorded. */ export declare function navigateForSession(href: string, reason?: SessionNavigationReason): boolean; export type SessionStatus = "loading" | "authenticated" | "unauthenticated" | "unavailable" | "signing-out"; interface UseSessionResult { session: ClientAuthSession | null; isLoading: boolean; status: SessionStatus; error: Error | null; retry: () => void; } export declare function registerBeforeSignOutCleanup(cleanup: () => Promise): () => void; export declare function runBeforeSignOutCleanups(): Promise | undefined; /** * Resolves once the session is re-read, so the new identity is in place before * callers refetch anything that is scoped by it. */ export declare function notifySessionInvalidated(): Promise; export declare function isSigningOut(): boolean; /** * Whether the session this tab holds is the answer to the page load's first * session read. A request the load sent before the session was known belongs * to the account this session names only while this holds: once a retry or an * invalidation answers instead, another tab may have changed the cookies. */ export declare function isSessionFromFirstRead(): boolean; /** * Re-resolve the session because an authenticated request came back 401. * * `status` is only written when a session fetch resolves, so a 401 anywhere * else leaves every mounted consumer holding the previous `"authenticated"` * answer. The app shell stays mounted over a session the server no longer * recognises, and each data query paints its own generic load error instead of * the visitor being sent to sign in — which is what a stale cookie surviving * logout looks like on screen. Re-reading the session lets the gate reach the * truth and redirect. * * This asks the server rather than forcing `"unauthenticated"` from here: a * 401 can also come from one request a live session is not allowed to make, * and assuming otherwise would sign that visitor out of a working session. * Throttled because one screen can fail many requests at once, and each * invalidation schedules a fresh read. */ export declare function recheckSessionAfterUnauthorized(): void; export declare function beginSignOut(): void; export declare function completeSignOut(): void; export declare function useSession(): UseSessionResult;