import { type AxiosInstance } from 'axios'; import type { GoogleLoginPayload, User } from '../types/auth'; import type { AuthTokens, LoginResponse } from './authAxiosTypes'; export interface AuthAxiosPaths { refreshToken: string; signup: string; login: string; loginOtp: string; resetPassword: string; forgotPassword: string; googleLogin: string; } export interface CreateAuthAxiosClientConfig { baseURL: string; tenant: string; /** * localStorage key for auth (same default as `AuthProvider` `storageKey`: `AUTH_STORAGE_KEY` / `auth_data`). * Login, silent refresh, and API clients read/write this single blob. */ tokenStorageKey?: string; paths?: Partial; } export interface AuthAxiosClient { getStoredTokens: () => AuthTokens | null; setStoredTokens: (tokens: AuthTokens) => void; clearStoredTokens: () => void; getAxios: () => AxiosInstance; mapLoginResponseToUser: (data: LoginResponse) => User; signup: (params: { firstName: string; lastName: string; username: string; email: string; password: string; }) => Promise; login: (params: { email: string; password: string; otp?: string; }) => Promise; loginOtp: (params: { email: string; password: string; otp: string; }) => Promise; refreshToken: (refreshTokenValue: string) => Promise; resetPassword: (params: { token: string; newPassword: string; }) => Promise; forgotPassword: (email: string) => Promise; googleLogin: (payload: GoogleLoginPayload) => Promise; } /** * Axios-based auth HTTP client with tenant/accept headers and bearer tokens from localStorage. * Call `refreshToken` explicitly when you need a new access token — there is no automatic * refresh-and-retry on failed resource requests. * * Refresh (`POST` …`/refreshToken`, body `{ refreshToken }`): * - Persists `{ success, data: { jwtToken, refreshToken, … } }` into the same `tokenStorageKey` as `AuthProvider`. * - Clears stored auth only on refresh responses **400 / 401 / 403**, or `success: false` on HTTP 2xx — not on network errors or 5xx-only failures. * * Requires `axios` as a peer dependency. */ export declare function createAuthAxiosClient(config: CreateAuthAxiosClientConfig): AuthAxiosClient; //# sourceMappingURL=createAuthAxiosClient.d.ts.map