import { Container } from '../components/container';
import { EventEmitter } from '../helper/event-emitter';
import { InstructionModule } from './helpers/instruction-module';
import { ApiInternal } from '../api/api-internal';
import { InstructionDestroyable, InstructionHandleable } from './helpers/instruction-handler';
import { IEventData } from '../components/iframe-event';
import { ApiCheckoutInternal } from '../api/api-checkout-internal';
export declare const EVENT: {
    PAYMENT_SUCCESSFUL: string;
    PAYMENT_FAILURE: string;
    PAYMENT_EXPIRED: string;
};
interface IntentTokenPayload {
    env: string;
    intent_id: string;
    version: number;
    env_alias: string;
    whitelist_domains: string[];
}
export declare const SELECTORS: {
    LIST: string;
    WIDGETS: string;
};
export interface InstructionResponse {
    event?: string;
    instruction_token?: string;
    next_instruction?: boolean;
    [key: string]: any;
}
/**
 * Class CheckoutButton transform usual button into checkout
 *
 * @constructor
 *
 * @param {string} selector - Selector of html element.
 * @param {string} intentToken - PayDock intent token
 * @example
 * var widget = new Checkout('#widget', 'intent_token');
 **/
export declare class Checkout {
    protected formSelector: string;
    protected intentToken: string;
    protected debug: boolean;
    protected window: Window;
    protected eventEmitter: EventEmitter;
    protected container: Container;
    protected intentTokenPayload: IntentTokenPayload;
    protected api: ApiInternal;
    protected checkoutApi: ApiCheckoutInternal;
    protected instructions: InstructionModule;
    protected currentInstruction: InstructionDestroyable & InstructionHandleable;
    private timeoutTimer;
    private requestInFlight;
    private inTimeoutRange;
    private checkoutFinished;
    constructor(formSelector: string, intentToken: string, debug?: boolean);
    fetchInstruction(): void;
    finaliseCheckout(): void;
    private setupTimeoutTimer;
    private extractIntentTokenPayload;
    validateJWTWhitelistedDomains(whitelist_domains: string[]): boolean;
    private ready;
    private initContractVersion;
    private isTimeoutInstruction;
    private handleInstruction;
    private handleTimeoutInstructions;
    private getInstructionFromResponse;
    private extractInstructionPayloadFromResponse;
    private setEnv;
    /**
     * If the payment was successful, the function passed as parameter will be called.
     * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
     *
     * @example
     * widget.onPaymentSuccessful((data) => {
     *      console.log('Payment successful!');
     * });
     */
    onPaymentSuccessful(handler: (data: IEventData) => void): () => void;
    /**
     * If the payment was not successful, the function passed as parameter will be called.
     * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
     *
     * @example
     * widget.onPaymentError((err) => {
     *      console.log('Payment not successful');
     * });
     */
    onPaymentFailure(handler: (data: IEventData) => void): () => void;
    /**
     * If the payment was expired, the function passed as parameter will be called.
     * Important: Do not perform thread blocking operations in callback such as window.alert() calls.
     *
     * @example
     * widget.onPaymentInReview((data) => {
     *      console.log('Payment in fraud review');
     * });
     */
    onPaymentExpired(handler: (data: IEventData) => void): () => void;
    createWidgetStructure(): void;
    private setStyles;
}
export declare class InstructionDebugger {
    constructor(selector: string, formSelector: string, version: number, instructionName: string, context: object, token?: string);
}
export {};
//# sourceMappingURL=checkout.d.ts.map