import { AIMSSessionDescriptor } from '@al/core';
import { AlBehaviorPromise } from '@al/core';
import { AlExecutionContext } from '@al/core';
import { AlNetworkRequestDescriptor } from '@al/core';
import { AlNetworkResponse } from '@al/core';
import { AlTriggerStream } from '@al/core';
import { AxiosInstance } from 'axios';
import { AxiosRequestConfig } from 'axios';
import { AxiosResponse } from 'axios';

export declare class AlBrowserExecutionContext extends AlExecutionContext {
    axios: AxiosInstance;
    constructor();
    base64Decode(input: string): string;
    base64Encode(input: string): string;
    handleRequest<YieldType = any>(requestConfig: AlNetworkRequestDescriptor): Promise<AlNetworkResponse<YieldType>>;
    /**
     * Instantiate a properly configured axios client for services
     */
    protected getAxiosInstance(): AxiosInstance;
    protected axiosRequestHook(config: AxiosRequestConfig): AxiosRequestConfig;
    protected axiosResponseHook(response: AxiosResponse<any>): Promise<AxiosResponse<any>>;
}

export declare class AlConduitClient {
    context: AlExecutionContext;
    static events: AlTriggerStream;
    protected static document: Document;
    protected static conduitUri: string;
    protected static conduitWindow: Window;
    protected static conduitOrigin: string;
    protected static refCount: number;
    protected static ready: AlBehaviorPromise<boolean>;
    protected static requests: {
        [requestId: string]: {
            resolve: any;
            reject: any;
            canceled: boolean;
        };
    };
    protected static externalSessions: {
        [locationId: string]: {
            promise?: Promise<void>;
            resolver: any;
            resolved: boolean;
        };
    };
    protected static requestIndex: number;
    constructor(context?: AlExecutionContext);
    start(targetDocument?: Document): Promise<void>;
    render(): DocumentFragment;
    calculateConduitURI(): Promise<string>;
    ready(): Promise<void>;
    stop(): void;
    destroy(): void;
    /**
     * Checks to see if a session with an external resource has been established.
     *
     * @param insightLocationId The external location ID.  If unspecified, the associated contextual location will be used by default.
     * @returns Boolean true or false.
     */
    checkExternalSession(insightLocationId?: string): boolean;
    /**
     * Waits for a session with an external resource to be established.
     *
     * @param insightLocationId The external location ID.  If unspecified, the contextual location will be used by default.
     * @returns A promise that resolves once the external resource's session has been established.
     *
     * Please note that attempting to await an unknown or gibberishy location will return a promise that never resolves.
     */
    awaitExternalSession(insightLocationId?: string): Promise<void>;
    /**
     * Retrieves session information from the conduit.  Resolves with valid session information if a session exists, or null if no session is established;
     * an error indicates a problem with conduit operation rather than the absence of a session.
     */
    getSession(): Promise<AIMSSessionDescriptor>;
    /**
     * Sets session information TO the conduit.  Should always resolve with a copy of the session (including acting
     * account and active datacenter) that conduit considers most fresh.  Note that in rare cases this may
     * deviate from the session provided to this method, in which case the caller should update its data to reflect
     * conduit's.
     */
    setSession(sessionData: AIMSSessionDescriptor): Promise<AIMSSessionDescriptor>;
    /**
     * Deletes existing session information.
     */
    deleteSession(): Promise<boolean>;
    /**
     * Retrieves a global setting from conduit's local storage
     */
    getGlobalSetting(settingKey: string): Promise<any>;
    /**
     * Sets a global setting to conduit's local storage
     */
    setGlobalSetting(key: string, data: any): Promise<any>;
    /**
     * Deletes a global setting from conduit's local storage
     */
    deleteGlobalSetting(settingKey: string): Promise<boolean>;
    /**
     * Retrieves a global resource.
     */
    getGlobalResource(resourceName: string, ttl: number): Promise<any>;
    /**
     * Receives a message from conduit, and dispatches it to the correct handler.
     */
    onReceiveMessage: (event: any) => void;
    onConduitReady(event: any): void;
    onDispatchReply(event: any): void;
    /**
     * Responds to external session ready messages.  If no one is awaiting readiness, it will simply create a resolved promise for that location.
     */
    protected onExternalSessionEstablished(event: any): void;
    /**
     * Raises an AlDatacenterSessionEventEvent
     */
    protected onExternalSessionError(event: any): void;
    /**
     * Pass the event upstream on the internal event bus
     */
    protected onExternalTrackableEvent(event: any): void;
    /**
     * This validation step is included *mostly* for the sanity of developers.  It is remarkably easy to forget to start o3-portero :)  It
     * may help detect problems in production as a fringe benefit.
     */
    protected validateReadiness: () => void;
    protected request(methodName: string, data?: any, timeout?: number): Promise<any>;
}

export { }
