import React, { ComponentType, JSX } from "react";
import type { User } from "../../types/index.js";
/**
 * Options to customize the withPageAuthRequired higher order component.
 */
export interface WithPageAuthRequiredOptions {
    /**
     * ```js
     * withPageAuthRequired(Profile, {
     *   returnTo: '/profile'
     * });
     * ```
     *
     * Add a path to return the user to after login.
     */
    returnTo?: string;
    /**
     * ```js
     * withPageAuthRequired(Profile, {
     *   onRedirecting: () => <div>Redirecting...</div>
     * });
     * ```
     *
     * Render a message to show that the user is being redirected.
     */
    onRedirecting?: () => JSX.Element;
    /**
     * ```js
     * withPageAuthRequired(Profile, {
     *   onError: error => <div>Error: {error.message}</div>
     * });
     * ```
     *
     * Render a fallback in case of error fetching the user from the profile API route.
     */
    onError?: (error: Error) => JSX.Element;
}
export interface UserProps {
    user: User;
}
/**
 * ```js
 * const MyProtectedPage = withPageAuthRequired(MyPage);
 * ```
 *
 * When you wrap your pages in this higher order component and an anonymous user visits your page,
 * they will be redirected to the login page and then returned to the page they were redirected from (after login).
 */
export type WithPageAuthRequired = <P extends object>(Component: ComponentType<P & UserProps>, options?: WithPageAuthRequiredOptions) => React.FC<P>;
export declare const withPageAuthRequired: WithPageAuthRequired;
