import { DeployInfo, SDServerInfo, ProjectConfig } from "../FEA";
import { StandardCallback, StandardError } from "../types";
import { AppDefinition } from "../services/Interop/types";
import { Progress } from "../FEA";
declare type InstallerDescription = {
    name: string;
    version?: string;
    authors?: string;
    description?: string;
};
export declare type CSS = {
    [key: string]: string;
};
declare type AssetType = "JS" | "CSS" | "JSON" | "Text" | "Image" | "GIF" | "Icon";
declare type Asset = {
    type: AssetType[];
    file: File;
    targetPath: string;
};
declare type PreloadType = {
    alias: string;
    url: string;
};
declare type PreloadUsage = {
    all?: boolean;
    launchable?: boolean;
    apps?: string[];
};
declare type PreloadObjType = PreloadType[];
declare type MenuObjType = {
    displayName: string;
    applications: string[];
    position: number;
};
declare type MenuType = {
    [key: string]: MenuObjType;
};
declare type ProjectSettings = {
    name: string;
    path?: string;
    version?: string;
    authors?: string;
    description?: string;
};
/**
 *
 * @class SmartDesktopClient
 *
 * @example
 *
 * Test Driver Example (can paste into component console)
 *
 window.smartDesktopClientDriver = async function makerClientDriver() {
    {
        let { err, apps } = await SmartDesktopClient.getApps();
        Logger.log("getApps", err ? err : "ok" , apps);
    }
    {
        let { err, config } = await SmartDesktopClient.getAppConfig("Rates");
        Logger.log("getAppConfig", err ? err : "ok" , config);
    }
    {
        let { config } = await SmartDesktopClient.getAppConfigTemplate();
        let { err } = await SmartDesktopClient.addApp("testApp1", config);
        Logger.log("addApp", err ? err : "ok" );
    }
    {
        let { err } = await SmartDesktopClient.deleteApp("testApp1");
        Logger.log("deleteApp", err ? err : "ok" );
    }
    {
        Logger.log("updateTheme", err ? err : "ok" );
        let { err } = await SmartDesktopClient.updateInstallerDescription({ name: "sample installer name", version: "V0.0.0", authors: "M. Smith", description: "sample installer descriptions" });
        Logger.log("updateInstallerDescription", err ? err : "ok" );
    }
    {
        let blob = await fetch("http://localhost:3375/assets/img/test.png").then(r => r.blob());
        var file = new File([blob], "foo.png");
        let { err } = await SmartDesktopClient.updateToolbarIcon(file);
        console.log("updateToolbarIcon", err ? err : "ok" );
    }
    {
        let blob = await fetch("http://localhost:3375/assets/img/test.png").then(r => r.blob());
        var file = new File([blob], "foo.png");
        let { err } = await SmartDesktopClient.updateTaskbarIcon(file);
        console.log("updateTaskbarIcon", err ? err : "ok" );
    }
    {
        let blob = await fetch("http://localhost:3375/assets/img/test.png").then(r => r.blob());
        var file = new File([blob], "foo.png");
        let { err } = await SmartDesktopClient.updateSystemTrayIcon(file);
        console.log("updateSystemTrayIcon", err ? err : "ok" );
    }
    {
        let blob = await fetch("http://localhost:3375/assets/img/test.ico").then(r => r.blob());
        var file = new File([blob], "foo.ico");
        let { err } = await SmartDesktopClient.updateInstallerIcon(file);
        console.log("updateInstallerIcon", err ? err : "ok" );
    }
    {
        let blob = await fetch("http://localhost:3375/assets/img/install-spinner.gif").then(r => r.blob());
        var file = new File([blob], "foo.gif");
        let { err } = await SmartDesktopClient.updateInstallerGraphic(file);
        console.log("updateInstallerGraphic", err ? err : "ok" );
    }
    {
        let blob = await fetch("http://localhost:3375/assets/img/test.svg").then(r => r.blob());
        var file = new File([blob], "foo.svg");
        let { err } = await SmartDesktopClient.updateSplashScreen(file);
        console.log("updateSplashScreen", err ? err : "ok" );
    }
    {
        let { err } = await SmartDesktopClient.updateTheme({ cssSampleData: 1 });
        console.log("updateTheme", err ? err : "ok" );
    }
    {
        let { err } = await SmartDesktopClient.createProjectZip("testApp", "~/Downloads/");
        Logger.log("createProjectZip", err ? err : "ok" );
    }
    {
        <input type="file" onChange={(e) => {
            const file = e.target.files?.[0];

            let { err } = await SmartDesktopClient.uploadAssets([
                {
                    file,
                    type: AssetType.Image,
                    targetPath: 'image.png',
                }
            ], (progress) => {
                // ...
            });

            Logger.log("uploadAssets", err ? err : "ok" );
        }} />
    }
}
 */
export default class SmartDesktopClient {
    getSDServerInfo(): Promise<SDServerInfo>;
    /**
     * Confirm the Smart Desktop Server is enabled.  This should be true before constructing and using a client.
     *
     * @static
     * @returns {Promise<Boolean>}
     * @memberof SmartDesktopClient
     */
    static isEnabled(): Promise<Boolean>;
    /**
     * Get the smart desktop server base URL.
     *
     * @static
     * @returns {Promise<Boolean>}
     * @memberof SmartDesktopClient
     */
    applicationRoot(): Promise<string | null>;
    /**
     *
     */
    projectConfig(): Promise<ProjectConfig | null>;
    /**
     * Get list of all AppD applications
     *
     * @private
     * @returns {Promise<{ err:any, data:any}>}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err, apps } = await SmartDesktopClient.getApps();
     */
    getApps(): Promise<{
        err: any;
        apps: any;
    }>;
    /**
     * Get list of all Menus
     *
     * @private
     * @returns {Promise<{ err:any, data:any}>}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err, menus } = await SmartDesktopClient.getMenus();
     */
    getMenus(): Promise<{
        err: any;
        menus: MenuType;
    }>;
    getPreloads(): Promise<{
        err: any;
        preloads: PreloadObjType;
    }>;
    /**
     * Get config for the specified AppD app.
     *
     * @private
     * @param {string} appId
     * @returns {Promise<{ err:any, config:any}>}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err, config } = await SmartDesktopClient.getAppConfig("testApp");
     */
    getAppConfig(appId: string): Promise<{
        err: any;
        config: any;
    }>;
    /**
     * Helper function returning a AppD config template with Finsemble component in manifest property.
     *
     * @private
     * @returns {Promise<{ config: any }>}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { config } = await SmartDesktopClient.getAppConfigTemplate();
     */
    getAppConfigTemplate(): Promise<{
        config: AppDefinition;
    }>;
    /**
     * Add AppD application, which will modify Finsemble config and invoke REST API to persist the change
     *
     * @private
     * @param {string} appId
     * @param {AppDefinition} appConfig
     * @returns {Promise<{ err }>}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.addApp("testApp", config);
     */
    addApp(appId: string, appConfig: AppDefinition): Promise<{
        err: any;
    }>;
    addMenu(menuConfig: MenuObjType): Promise<{
        err: any;
    }>;
    /**
     * Adds a preload
     *
     */
    addPreload(preload: PreloadType, usage?: PreloadUsage): Promise<{
        err: any;
    }>;
    syncMenuConfig(): Promise<void>;
    updateMenu(menuId: string, menuConfig: MenuObjType): Promise<{
        err: any;
    }>;
    /**
     * Add AppD application, which will modify Finsemble config and invoke REST API to persist the change
     *
     * @private
     * @param {string} appId
     * @param {AppDefinition} appConfig
     * @returns {Promise<{ err }>}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.updateApp("testApp", config);
     */
    updateApp(appId: string, appConfig: AppDefinition): Promise<{
        err: any;
    }>;
    /**
     * Updates the preload with the specific preload alias. If the preload alias is changed, all usages are updated
     *
     * @param preloadAlias
     * @param preload
     */
    updatePreload(preloadAlias: string, preload: PreloadType, usage?: PreloadUsage): Promise<{
        err: any;
    }>;
    /**
     * Remove AppD application, which will modify Finsemble config and invoke REST API to persist the change
     *
     * @private
     * @param {string} appId
     * @returns {Promise<{ err }>}
     * @memberOf SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.deleteApp("testApp");
     */
    deleteApp(appId: string): Promise<{
        err: any;
    }>;
    deleteMenu(menuId: string): Promise<{
        err: any;
    }>;
    deletePreload(preloadAlias: string): Promise<{
        err: any;
    }>;
    /**
     * Update the theme of all components and invoke REST API to persist the change in Finsemble's theme.css file
     *
     * @param {CSS} theme
     * @returns {Promise<{ err }>}
     * @memberOf SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.updateTheme(cssData);
     */
    updateTheme(theme: CSS): Promise<{
        err: any;
    }>;
    /**
     * Add handler listening for theme updates
     *
     * @param {StandardCallback<StandardError, any>} themeUpdatedHandler:
     * @returns {Function} When called, unsubscribes the handler
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.updateTheme(cssData);
     */
    static onThemeUpdated(themeUpdatedHandler: StandardCallback<StandardError, any>): Function;
    /**
     * Post a file to the smart desktop server
     *
     * @param {Asset[]} assets
     * @param {Function} progress
     * @returns {Promise<{ err }>}
     * @memberOf SmartDesktopClient
     *
     * @example
     * ...
     */
    uploadAssets(assets: Asset[], progress: Function): Promise<{
        err: string | null;
        paths: string[];
    }>;
    /**
     * Post images to the smart desktop server
     *
     * @param {File[]} files
     * @param {Function} progress
     * @returns {Promise<{ err }>}
     * @memberOf SmartDesktopClient
     *
     * @example
     * ...
     */
    uploadImages(files: File[], progress: Function): Promise<{
        err: any;
        paths: string[];
    }>;
    /**
     * Post an image to the smart desktop server
     *
     * @param {File} file
     * @param {Function} progress
     * @returns {Promise<{ err }>}
     * @memberof SmartDesktopClient
     *
     * @example
     * ...
     */
    uploadImage(file: File, progress: Function): Promise<{
        err: any;
        path: string;
    }>;
    /**
     * Update installer description by using REST API to persist the change
     *
     * @param {object} InstallerDescription
     *
     * @example
     * let { err } = await SmartDesktopClient.updateInstallerDescription(installerDescription);
     */
    updateInstallerDescription(installerDescription: InstallerDescription): Promise<{
        err: any;
    }>;
    /**
     * Update installer description by using REST API to persist the change
     *
     * @param {object} InstallerDescription
     *
     * @example
     * let { err } = await SmartDesktopClient.updateInstallerDescription(installerDescription);
     */
    updateProjectSettings(settings: ProjectSettings): Promise<{
        err: any;
    }>;
    /**
     * Get project settings
     *
     * @example
     * let { settings, err } = await SmartDesktopClient.getProjectSettings();
     */
    getProjectSettings(): Promise<{
        settings: ProjectSettings;
        err: any;
    }>;
    /**
     * Helper function -- progress descriptor for updating files
     *
     * @private
     * @param {*} progress
     * @memberof SmartDesktopClient
     */
    private progressIndicator;
    /**
     * Update Finsemble toolbar icon file and transmit correspond ui-changed message so UI will pick up change
     *
     * @param {File} imageFile
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    updateToolbarIcon(imageFile: File): Promise<{
        err: string | null;
        path: string;
    }>;
    /**
     * Update Finsemble taskbar icon file and transmit correspond ui-changed message so UI will pick up change
     *
     * @param {File} imageFile
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    updateTaskbarIcon(imageFile: File): Promise<{
        err: string | null;
        path: string;
    }>;
    /**
     * Update system tray icon file and refresh config entry to trigger notification
     *
     * @param {File} imageFile
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    updateSystemTrayIcon(imageFile: File): Promise<{
        err: string | null;
        path: string;
    }>;
    /**
     * Update the installer Icon file -- the change will not be picked up until the installer is built
     *
     * @param {File} iconFile
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    updateInstallerIcon(iconFile: File): Promise<{
        err: string | null;
        path: string;
    }>;
    /**
     * Update the installer graphic file -- the change will not be picked up until the installer is built
     *
     * @param {File} gifFile
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    updateInstallerGraphic(gifFile: File): Promise<{
        err: string | null;
        path: string;
    }>;
    /**
     * Update the splash screen image file -- the change will not be picked up until Finsemble/FEA is restarted
     *
     * @param {File} svgFile
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    updateSplashScreen(svgFile: File): Promise<{
        err: string | null;
        path: string;
    }>;
    /**
     * Helper function to update a single theme variable within Finsemble's theme
     *
     * @static
     * @param {string} varName
     * @param {string} varValue
     * @returns {Promise<{ err: any }>}
     * @memberof SmartDesktopClient
     */
    static updateThemeVariable(varName: string, varValue: string): Promise<{
        err: any;
    }>;
    /**
     * Save a .zip file of the project with `appName` to the local filesystem at `targetPath`
     *
     * @param {string} appName name of app to zip
     * @param {string|undefined} targetPath output path for zip file
     * @returns {Promise}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.createProjectZip("testApp", "~/Downloads/");
     */
    createProjectZip(appName: string, targetPath?: string | undefined): Promise<string>;
    /**
     * Copy project assets/config to target dir
     *
     * @param {string} appName name of app to zip
     * @param {string|undefined} targetPath option to manually specify targetPath (without showNativeOpenDialog) for unit tests
     * @returns {Promise}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.createProjectZip("testApp", "~/Downloads/");
     */
    copyProjectFiles(appName: string, targetPath?: string | undefined): Promise<{
        source: string;
        target: string;
    }[]>;
    /**
     * Change the path of the current project in smartDesktops.json
     *
     * @param {string} appName name of app to zip
     * @param {string} [targetPath] output path for zip file
     * @returns {Promise}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.createProjectZip("testApp", "~/Downloads/");
     */
    selectProjectPath(): Promise<string>;
    /**
     * checkValidProjectName
     */
    static checkValidProjectName(name: string): boolean;
    /**
     * Check an arbitrary string to see if it is a valid url
     * The only checks for validity are:
     * * if the string begins with "http://" or "https://"
     *
     * @param {string} url - the potential URL
     * @return {boolean}
     */
    static checkValidURL(url: string): boolean;
    static isInteropAuthorized(sourceApp: AppDefinition, targetApp: AppDefinition, contextType?: string): Promise<boolean>;
    static isInboundInteropAuthorized(sourceApp: AppDefinition, targetApp: AppDefinition, contextType?: string): Promise<boolean>;
    static isOutboundInteropAuthorized(sourceApp: AppDefinition, targetApp: AppDefinition, contextType?: string): Promise<boolean>;
    /**
     * Publish `.zip` file to the Cosaic Cloud
     *
     * @returns {Promise}
     * @memberof SmartDesktopClient
     *
     * @example
     * let { err } = await SmartDesktopClient.publishToCosaicCloud();
     */
    publishToCosaicCloud(uuid?: string): Promise<DeployInfo>;
    /**
     * Get the progress of a publish request
     *
     * @returns {Promise}
     * @memberof SmartDesktopClient
     *
     */
    getPublishProgress(): Promise<Progress>;
    /**
     * Resets the current project to factory defaults. Once complete, Finsemble is restarted
     * so that the changes can take effect.
     */
    resetProject(): Promise<[Error | null, any]>;
    /**
     * Saves the auth providers to config.json
     */
    getAuthenticationProviders(): Promise<any[]>;
    /**
     * Saves the auth providers to config.json
     */
    setAuthenticationProviders(authenticationProviders: any): Promise<Error | null>;
}
export {};
//# sourceMappingURL=smartDesktopClient.d.ts.map