import type { Passkey } from "@better-auth/passkey" import type { BetterFetchError } from "@better-fetch/fetch" import type { Account, User } from "better-auth" import type { Member } from "better-auth/plugins/organization" import type { AnyAuthClient } from "./any-auth-client" import type { ApiKey } from "./api-key" import type { AuthClient } from "./auth-client" import type { Invitation } from "./invitation" import type { Refetch } from "./refetch" type AnyAuthSession = AnyAuthClient["$Infer"]["Session"] type AuthHook = { isPending: boolean data?: T | null error?: BetterFetchError | null refetch?: Refetch } export type AuthHooks = { useSession: () => ReturnType useListAccounts: () => AuthHook useAccountInfo: ( params: Parameters[0] ) => AuthHook<{ user: User }> useListDeviceSessions: () => AuthHook useListSessions: () => AuthHook useListPasskeys: () => AuthHook useListApiKeys: () => AuthHook useActiveOrganization: () => Partial< ReturnType > useListOrganizations: () => Partial< ReturnType > useHasPermission: ( params: Parameters[0] ) => AuthHook<{ error: null success: boolean }> useInvitation: ( params: Parameters[0] ) => AuthHook< Invitation & { organizationName: string organizationSlug: string organizationLogo?: string } > useListInvitations: ( params: Parameters[0] ) => AuthHook useListUserInvitations: () => AuthHook useListMembers: ( params: Parameters[0] ) => AuthHook<{ members: (Member & { user?: Partial | null })[] total: number }> useListTeams: (params?: { organizationId?: string }) => AuthHook useListTeamMembers: (params: { teamId?: string }) => AuthHook useListUserTeams: () => AuthHook useIsRestoring?: () => boolean } export type Team = { id: string name: string organizationId: string createdAt: Date updatedAt: Date } export type TeamMember = { id: string teamId: string userId: string createdAt: Date user?: Partial | null }