/*!
 * Copyright 2017 - 2020 by ChartIQ, Inc.
 * All rights reserved.
 */
/**
 * The Dialog Manager Client simplifies interacting with dialog windows by spawning them and getting data back from them.
 * In this context, a dialog window is simply a child window spawned to interact with the user, such as a confirmation dialog.
 * Functions are provided here for both the parent-window side and the dialog/child-window side.
 *
 *`FSBL.Clients.DialogManager` is always pre-initialized with one instance of the Dialog Manager in the Finsemble Library (making it essentially, a singleton when referenced in the same window). This means when developing Finsemble components, you directly access the Dialog Manager without using the constructor (e.g., `FSBL.Clients.DialogManager.spawnDialog(...);`). **The constructor is not exposed to components.**
 *
 * @module DialogManagerClient
 */
import { SpawnResponse } from "./launcherClient";
import { SpawnParams } from "../platform/services/window/types";
import { WindowIdentifier } from "../platform/services/window/types";
import { StandardErrorCallback, StandardPromise } from "../types";
import { ResponderMessage } from "./routerClient";
/**
 * @language javascript, java
 * @deprecated
 * Registers this window as a modal that can be used by the dialog manager. This will set
 * the window as a "scrim" – taking up the entire size of the monitor and being invisible or lightly opaque.
 *
 * Sometimes, clicking anywhere on this window will dismiss the modal.
 */
export declare const registerModal: () => Promise<string | null>;
/**
 * @language javascript, java
 * @deprecated
 * Shows a semi-transparent black modal behind the dialog.
 * @param {function} cb The callback to be invoked after the method completes successfully.
 */
export declare const showModal: (cb?: (error?: string) => void) => Promise<string | null>;
/**
 * @language javascript, java
 * @deprecated
 * Hides the dialog's modal.
 */
export declare const hideModal: () => Promise<string | null>;
/**
 * @language javascript, java
 * Spawns an app or url in "dialog mode". The app's window will not be dockable.
 * The app does not need to be explicitly coded as a dialog.
 *
 * Parameters passed as `params.inputParams` can be retrieved in the dialog window by
 * calling `FSBL.Clients.DialogManager.getParametersFromInDialog()`.
 *
 * ```javascript
 * FSBL.Clients.DialogManager.spawnDialog(
 * {
 * 	name: "dialogTemplate",
 * 	height:300,
 * 	width:400,
 * 	url:"http://localhost/components/system/dialogs/dialog1.html"
 * },
 * {
 * 	someData: 12345
 * },
 * (error, responseParameters) => {
 *	if (!error) {
 * 		console.log(">>>> spawnDialog response: " + JSON.stringify(responseParameters));
 *	}
 * });
 * ```
 * @param {object} params Parameters. Same as <a href="/docs/reference/typedocs/modules/LauncherClient#spawn">LauncherClient.spawn()</a> with the following exceptions.
 * @param {string} params.url URL of dialog to launch
 * @param {string} [params.name] - The name of the dialog
 * @param {number|string} params.x - Same as <a href="/docs/reference/typedocs/modules/LauncherClient#spawn">LauncherClient.spawn()</a> except defaults to "center".
 * @param {number | string} [params.y="center"] - Same as <a href="/docs/reference/typedocs/modules/LauncherClient#spawn">LauncherClient.spawn()</a> except defaults to "center".
 * @param {object} inputParams Object or any data type needed by your dialog.
 * @param {function} dialogResponseCallback called when response received back from dialog window (typically on dialog completion). `responseParameters` is defined by the dialog.
 * @param {function} cb Returns response from <a href="/docs/reference/typedocs/modules/LauncherClient#spawn">LauncherClient.spawn()</a>
 */
export declare const spawnDialog: (params: SpawnParams, inputParams: any, dialogResponseCallback: StandardErrorCallback<any>, cb?: StandardErrorCallback<SpawnResponse>) => StandardPromise<SpawnResponse>;
/**
 * @language javascript, java
 * Opens an existing dialog that is registered under the requested type.
 * If no dialog is found then one will be spawned (with the options passed as the second parameter).
 *
 * Resolves to an error string if the dialog could not be opened, or null if it was successfully opened.
 *
 * @param {string} type Component type to open. The <code>type</code> must be a key in the finsemble.components configuration object.
 * If "yesNo" or "singleInput" are provided (legacy component names) then these will be converted to "YesNoDialog" and "SingleInputDialog"
 * (current component names).
 * @param {object} options Options to pass into the opened window. See the [Dialogs tutorial](/docs/customize/customize-with-SDK/user-experience/component-catalog/dialogs) for more info about the options that you can pass to the "YesNoDialog" and the "SingleInputDialog".
 * @param {function} onUserInput Callback to be invoked when the user interacts with the dialog.
 */
export declare const open: (type: string, options: any, onUserInput: StandardErrorCallback<any>) => Promise<string | null>;
/**
 * @language javascript
 * Called from within a dialog window to get the `inputParams` passed by the originating window when
 * it called `spawnDialog()`.
 *
 * ```javascript
 * var dialogData = await FSBL.Clients.DialogManager.getParametersFromInDialog();
 * ```
 */
export declare const getParametersFromInDialog: () => Promise<any>;
/**
 * @language javascript
 * Called within a dialog to pass a response back to the originating window.
 * This will invoke the originating window's callback function that it passed to `spawnDialog()`.
 *
 * ```javascript
 * FSBL.Clients.DialogManager.respondAndExitFromInDialog({ choice: response });
 * ```
 * @param {object} responseParameters Data to be returned to the originating window's callback
 */
export declare const respondAndExitFromInDialog: (responseParameters: any) => Promise<void>;
/**
 * @language javascript
 * Must be called by the dialog window when it is ready to be displayed.
 */
export declare const showDialog: () => Promise<void>;
/**
 * @language javascript
 * Dialog windows *must* run this method so that results can be sent back to
 * originating windows. This method must *only* be run once in any given dialog window.
 *
 * ```javascript
 * FSBL.Clients.DialogManager.registerDialogCallback((err, request) => {
 *    if(err) return;
 *    console.log("Originating window sent", request.data);
 *    request.sendQueryResponse("your response");
 *    FSBL.System.Window.getCurrent().hide();
 * });
 *
 * ```
 *
 * @param {function} callback Callback that is invoked when the originating window
 * connects. Data passed by the originating window can be found in the `data` member of the
 * second parameter to the callback.
 */
export declare const registerDialogCallback: (cb?: StandardErrorCallback<ResponderMessage>) => Promise<void>;
/**
 * @language javascript
 * Dialogs may call this to respond to the originating window (instead of responding
 * directly to callbacks from `registerDialogCallback()`). The main advantage of using
 * this method is that it automatically hides the dialog.
 *
 * @param {any} data Data to be passed back to the originating window.
 */
export declare const respondToOpener: (data?: any) => Promise<void>;
/**
 * @ignore
 */
export declare const DialogManagerClient: {
    /**
     * Used to set a timeout. This will be refactored.
     */
    userInputTimeout: number | null;
    /**
     * Used to check response from dialog. This will be refactored.
     */
    readonly openerMessage: ResponderMessage | null;
    /**
     * For backward compatibility
     * @private
     * @deprecated
     */
    initialize: () => void;
    /**
     * For backward compatibility
     * @private
     * @deprecated
     */
    onReady: (cb?: any) => void;
    createStore: (cb?: () => void) => Promise<void>;
    getAvailableDialog: (type: string, cb?: (dialog: WindowIdentifier | null) => void) => Promise<WindowIdentifier | null>;
    sendQueryToDialog: (identifier: WindowIdentifier, options: any, onUserInput: StandardErrorCallback<any>) => Promise<void>;
    open: (type: string, options: any, onUserInput: StandardErrorCallback<any>) => Promise<string | null>;
    spawnDialog: (params: SpawnParams, inputParams: any, dialogResponseCallback: StandardErrorCallback<any>, cb?: StandardErrorCallback<SpawnResponse>) => StandardPromise<SpawnResponse>;
    registerDialogCallback: (cb?: StandardErrorCallback<ResponderMessage>) => Promise<void>;
    getParametersFromInDialog: () => Promise<any>;
    respondAndExitFromInDialog: (responseParameters: any) => Promise<void>;
    showDialog: () => Promise<void>;
    registerModal: () => Promise<string | null>;
    showModal: (cb?: (error?: string) => void) => Promise<string | null>;
    hideModal: () => Promise<string | null>;
    respondToOpener: (data?: any) => Promise<void>;
};
/**
 * @ignore
 */
export default DialogManagerClient;
//# sourceMappingURL=dialogManagerClient.d.ts.map