import { SilentRequest } from '@azure/msal-browser';

declare const useAutoSetActiveAccount: () => void;

/**
 * A Hook to define an event handler with an always-stable function identity.
 * @param handler
 * @returns
 * @see https://github.com/facebook/react/issues/14099#issuecomment-440013892
 * @see https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md#internal-implementation
 */
declare function useEventCallback<T extends (...args: any[]) => any>(handler: T): T;

declare enum TokenType {
    id = "id",
    access = "access"
}
interface IGetTokenOptions {
    tokenType?: TokenType;
    requestConfigs?: SilentRequest;
}
type GetToken = (opts?: IGetTokenOptions) => Promise<string | undefined>;
declare class RequestInProgressError extends Error {
    constructor();
}

declare const useFetchWithStatus: <T>(input: string | URL | globalThis.Request, init?: RequestInit) => {
    isLoading: boolean;
    _fetch: (payload?: RequestInit, getTokenOpts?: IGetTokenOptions) => Promise<T>;
};

declare const useFetchWithToken: (tokenRequestConfigs?: SilentRequest) => (input: string | URL | globalThis.Request, init?: RequestInit, getTokenOpts?: IGetTokenOptions) => Promise<Response>;

declare const useGetToken: (defaultRequestConfigs?: SilentRequest) => GetToken;

declare const sleep: (ms: number) => Promise<unknown>;

declare const getResponseData: <T>(response: Response) => Promise<T>;

declare class MSALConfigSingleton {
    private static instance;
    private config;
    private constructor();
    static getInstance(): MSALConfigSingleton;
    setDefaultSilentRequest(config: SilentRequest): void;
    getDefaultSilentRequest(): SilentRequest | undefined;
    setDefaultTenantId(tenantId: string): void;
    getDefaultTenantId(): string | undefined;
    reset(): void;
}
declare const msalConfig: MSALConfigSingleton;

export { type GetToken, type IGetTokenOptions, RequestInProgressError, TokenType, getResponseData, msalConfig, sleep, useAutoSetActiveAccount, useEventCallback, useFetchWithStatus, useFetchWithToken, useGetToken };
