/**
 * AuthProvider Component
 *
 * Provider that handles authentication state and route protection.
 * It manages authentication checks, public route access, and redirects to auth SPA when needed.
 *
 * Platform Support:
 * - Web (Next.js): Uses cookies for cross-SPA synchronization
 * - React Native (Expo): Uses AsyncStorage only (no cookies)
 *
 * IMPORTANT: Cross-SPA Synchronization (Web Only)
 * ================================================
 * On web platforms, this component uses cookies to keep authentication state synchronized
 * across multiple SPAs (e.g., skills and mentor) that share the same domain.
 *
 * To ensure proper synchronization on web, you MUST call the following functions:
 *
 * 1. On Login:
 *    ```typescript
 *    await storageService.setItem(LOCAL_STORAGE_KEYS.USER_DATA, userData);
 *    await storageService.setItem(LOCAL_STORAGE_KEYS.CURRENT_TENANT, tenantKey);
 *    await storageService.setItem(LOCAL_STORAGE_KEYS.TENANTS, tenants);
 *    await syncAuthToCookies(storageService);
 *    ```
 *
 * 2. On Logout:
 *    ```typescript
 *    await storageService.clear();
 *    clearAuthCookies();
 *    ```
 *
 * 3. On Tenant Switch:
 *    ```typescript
 *    await storageService.setItem(LOCAL_STORAGE_KEYS.CURRENT_TENANT, newTenantKey);
 *    await syncAuthToCookies(storageService);
 *    ```
 *
 * The AuthProvider automatically (web only):
 * - Syncs cookies to localStorage on mount
 * - Polls for cookie changes every 2 seconds
 * - Refreshes the page when cross-SPA changes are detected
 * - Listens for storage events to update cookies when localStorage changes
 * - Monitors logout timestamp cookie to trigger cross-SPA logout
 * - Automatically logs out when another SPA initiates logout
 *
 * For React Native:
 * - Relies on AsyncStorage only (handled by StorageService)
 * - No cookie synchronization
 * - No cross-app automatic sync
 */
import React from "react";
import { StorageService } from "@iblai/data-layer";
/**
 * Sync authentication state to cookies (web only)
 * Should be called on login, logout, and tenant switch
 * On React Native, this is a no-op
 */
export declare function syncAuthToCookies(storageService: StorageService): Promise<void>;
/**
 * Clear current tenant cookie only (web only)
 * Should be called before tenant switching
 * On React Native, this is a no-op
 */
export declare function clearCurrentTenantCookie(): void;
/**
 * Clear all authentication cookies (web only)
 * Should be called on logout
 * On React Native, this is a no-op
 */
export declare function clearAuthCookies(): void;
export declare function getUserName(storageService: StorageService): Promise<any>;
export declare function useAuthProvider({ middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, storageService, skipAuthCheck, token, enableStorageSync, }: Props): {
    isAuthenticating: boolean;
    userIsAccessingPublicRoute: boolean;
    setUserIsAccessingPublicRoute: React.Dispatch<React.SetStateAction<boolean>>;
};
/**
 * Type definition for the authentication context
 * Tracks whether the user is accessing a public route and provides a setter
 */
export type AuthContextType = {
    userIsAccessingPublicRoute: boolean;
    isLoggedIn: boolean;
    setUserIsAccessingPublicRoute: (iuserIsAccessingPublicRoute: boolean) => void;
};
export declare const AuthContext: React.Context<AuthContextType | undefined>;
/**
 * Hook to access the auth context
 * @throws Error if used outside of AuthContextProvider
 */
export declare const useAuthContext: () => AuthContextType;
/**
 * Context Provider component that wraps children with auth context
 */
export declare const AuthContextProvider: ({ value, children, }: {
    value: AuthContextType;
    children: React.ReactNode;
}) => import("react/jsx-runtime").JSX.Element;
/**
 * Props for the AuthProvider component
 */
type Props = {
    children?: React.ReactNode;
    fallback?: React.ReactNode;
    middleware?: Map<string | RegExp, () => Promise<boolean>>;
    onAuthSuccess?: () => void;
    onAuthFailure?: (reason: string) => void;
    redirectToAuthSpa: (redirectTo?: string, platformKey?: string, logout?: boolean, saveRedirect?: boolean) => void;
    hasNonExpiredAuthToken: () => boolean;
    username: string;
    pathname: string;
    skipAuthCheck?: boolean;
    storageService?: StorageService;
    token?: string;
    enableStorageSync?: boolean;
    skip?: boolean;
};
/**
 * AuthProvider Component
 *
 * Main authentication provider that:
 * 1. Checks if the current route requires authentication
 * 2. Validates the auth token
 * 3. Fetches user metadata to verify authentication
 * 4. Handles redirects to auth SPA when needed
 * 5. Manages public route access state
 */
export declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
export {};
