/** * Auth-config fetch helper for the Rebase React frontend. * * The former per-endpoint auth client (login, register, refresh, OAuth, * sessions, …) has been removed: `useRebaseAuthController` now delegates to * the headless SDK's `client.auth` (from `@rebasepro/client`), which is the * single source of truth for the auth session. The only piece that remains * here is the unauthenticated `/api/auth/config` probe used to detect * bootstrap mode and enabled providers before a session exists. */ import type { AuthAdapterCapabilities } from "@rebasepro/types"; /** * What `GET /api/auth/config` answers. * * The wire contract is declared once, in `@rebasepro/types`, and re-exported * here under the name this module uses. Three near-copies of it used to exist — * this one listed an `emailServiceEnabled` flag no backend sends, and marked as * optional fields every backend always returns. */ export type AuthConfigResponse = AuthAdapterCapabilities; /** * Cache container for `fetchAuthConfig` — holds both the inflight promise * (to deduplicate concurrent calls) and the cached result. */ export interface AuthConfigCache { cached: AuthConfigResponse | null; inflight: Promise | null; } /** * Create a fresh `AuthConfigCache` instance. * Callers own the cache object and pass it into `fetchAuthConfig` / `clearAuthConfigCache`. */ export declare function createAuthConfigCache(): AuthConfigCache; /** * Fetch auth configuration / status from the backend * This is an unauthenticated endpoint used to detect bootstrap mode. * * Results are cached for the session lifetime. * Concurrent calls are deduplicated: only one network request is made * and all callers share the same promise. */ export declare function fetchAuthConfig(apiUrl: string, cache: AuthConfigCache, /** The backend's `basePath`; only needed if it is not the default. */ apiPath?: string): Promise; /** * Clear the cached auth config (e.g. on logout or for testing). */ export declare function clearAuthConfigCache(cache: AuthConfigCache): void;