import * as react from 'react';
import { ReactNode, JSX } from 'react';
import { ConfigApi, FrontendFeature, FrontendFeatureLoader, ExtensionFactoryMiddleware } from '@backstage/frontend-plugin-api';
import { CreateAppRouteBinder } from '@backstage/frontend-app-api';
import { Config } from '@backstage/config';

/**
 * A source of dynamically loaded frontend features.
 *
 * @public
 * @deprecated Use the {@link @backstage/frontend-plugin-api#createFrontendFeatureLoader} function instead.
 */
interface CreateAppFeatureLoader {
    /**
     * Returns name of this loader. suitable for showing to users.
     */
    getLoaderName(): string;
    /**
     * Loads a number of features dynamically.
     */
    load(options: {
        config: ConfigApi;
    }): Promise<{
        features: FrontendFeature[];
    }>;
}
/**
 * Options for {@link createApp}.
 *
 * @public
 */
interface CreateAppOptions {
    features?: (FrontendFeature | FrontendFeatureLoader | CreateAppFeatureLoader)[];
    configLoader?: () => Promise<{
        config: ConfigApi;
    }>;
    bindRoutes?(context: {
        bind: CreateAppRouteBinder;
    }): void;
    /**
     * The component to render while loading the app (waiting for config, features, etc)
     *
     * Is the text "Loading..." by default.
     * If set to "null" then no loading fallback component is rendered.   *
     */
    loadingComponent?: ReactNode;
    extensionFactoryMiddleware?: ExtensionFactoryMiddleware | ExtensionFactoryMiddleware[];
}
/**
 * Creates a new Backstage frontend app instance. See https://backstage.io/docs/frontend-system/building-apps/index
 *
 * @public
 */
declare function createApp(options?: CreateAppOptions): {
    createRoot(): JSX.Element;
};

/**
 * Creates an app that is suitable for the public sign-in page, for use in the `index-public-experimental.tsx` file.
 *
 * @remarks
 *
 * This app has an override for the `app/layout` extension, which means that
 * most extension typically installed in an app will be ignored. However, you
 * can still for example install API and root element extensions.
 *
 * A typical setup of this app will only install a custom sign-in page.
 *
 * @example
 * ```ts
 * const app = createPublicSignInApp({
 *   features: [signInPageModule],
 * });
 * ```
 *
 * @public
 */
declare function createPublicSignInApp(options?: CreateAppOptions): {
    createRoot(): react.JSX.Element;
};

/**
 * @public
 */
declare function discoverAvailableFeatures(config: Config): {
    features: (FrontendFeature | FrontendFeatureLoader)[];
};

/** @public */
declare function resolveAsyncFeatures(options: {
    config: Config;
    features?: (FrontendFeature | FrontendFeatureLoader | CreateAppFeatureLoader)[];
}): Promise<{
    features: FrontendFeature[];
}>;

export { type CreateAppFeatureLoader, type CreateAppOptions, createApp, createPublicSignInApp, discoverAvailableFeatures, resolveAsyncFeatures };
