import { UseQueryResult } from '../../../../.external/lib/@tanstack/react-query'; import { AuthUser } from '../../auth/types'; export interface AuthContextValue { /** The raw React Query object used to fetch the authenticated user. */ query: UseQueryResult; /** The authenticated user object, or null if not authenticated. */ user: AuthUser | null; /** Indicates whether the authentication state is currently loading. */ loading: boolean; /** An error object if the authentication request failed. */ error: { message: string; originalError: Error; } | null; /** A function to sign in the user with a username and password. */ signin: (username: string, password: string) => Promise; /** A function to sign out the user. */ signout: () => Promise; /** A function to update the authenticated user's data. */ update: (data: Partial) => Promise; /** A function to reset the user's password. */ resetPassword: (password: string) => Promise; /** Signs in the user via OAuth with the given provider; `popup` opens a popup window for the flow. */ oauth_signin: (provider: string, popup?: boolean) => Promise; /** A function to refetch the authenticated user's data. */ refetch: () => Promise; /** A function to reset the error state. */ resetError: () => void; } export interface Info { /** The icon associated with the API. */ icon: string; /** The level of the API. */ level: string; /** The name of the API. */ name: string; /** The path of the API. */ path: string; /** The permission name associated with the API. */ permission_name: string; /** The type of the API. */ type: string; } export interface InfoContextValue { /** The base URL for the API. */ baseUrl: string; /** The raw React Query object used to fetch info. */ query: UseQueryResult; /** An array of Info objects or null if not available. */ info: Info[] | null; /** Indicates whether the info is currently loading. */ loading: boolean; /** An error object if the info request failed. */ error: { message: string; originalError: Error; } | null; /** Whether the app runs in fab-react-toolkit backward-compatibility mode. Set by `useProvideInfo`. */ fab?: boolean; }