import type { ClientUser, SanitizedPermissions, TypedUser } from 'payload'; export type AuthSession = { /** Whether qualifying activity has been recorded for the current token. */ readonly activityRecorded: boolean; readonly activityTrackingStartsAt: number; readonly expiresAt: number; readonly refreshStartsAt: number; readonly reminderStartsAt: number; }; export type UserWithToken = { /** seconds until expiration */ exp: number; refreshedToken?: string; token?: string; user: T; }; export type AuthContext = { /** Lifecycle state for the current auth session. */ authSession?: AuthSession; fetchFullUser: () => Promise; logOut: () => Promise; /** * These are the permissions for the current user from a global scope. * * When checking for permissions on document specific level, use the `useDocumentInfo` hook instead. * * @example * * ```tsx * import { useAuth } from 'payload/ui' * * const MyComponent: React.FC = () => { * const { permissions } = useAuth() * * if (permissions?.collections?.myCollection?.create) { * // user can create documents in 'myCollection' * } * * return null * } * ``` * * with useDocumentInfo: * * ```tsx * import { useDocumentInfo } from 'payload/ui' * * const MyComponent: React.FC = () => { * const { docPermissions } = useDocumentInfo() * if (docPermissions?.create) { * // user can create this document * } * return null * } ``` */ permissions?: SanitizedPermissions; refreshCookie: (forceRefresh?: boolean) => void; refreshCookieAsync: () => Promise; refreshPermissions: () => Promise; setPermissions: (permissions: SanitizedPermissions) => void; setUser: (user: null | UserWithToken) => void; strategy?: string; token?: string; /** * @deprecated Use `authSession?.expiresAt` instead. */ tokenExpirationMs?: number; user?: null | T; }; //# sourceMappingURL=types.d.ts.map