import { Manager } from "../core/Manager"; import { SSOConfig } from "../core/SSOLoginHandler"; import { Config, OAuthConfig } from "../state/AppConfig"; /** * @module Flex * @category Core * @private */ /** * Creates an instance FlexHelper that can be used to render Flex * @param {Config} config configuration object * @returns {Promise} if Flex was successfully initialized * @example * import * as Flex from "@twilio/flex-ui"; * const flexHelper = await Flex.create({}); */ export declare function create(config: Config): Promise; /** * Renders a progress spinner * @template T * @param {T} this invoking instance * @param {string | Element} [nodeOrSelector="body"] selector of element where to render the component * @returns {T} the invoking instance * @example * import * as Flex from "@twilio/flex-ui"; * Flex.progress("#container"); */ export declare function progress(this: T, nodeOrSelector?: string | Element): T; /** * Render a user-friendly error message screen * @param {Error | string} e Error to render * @param {string | Element} [nodeOrSelector="body"] selector of element where to render the component * @example * import * as Flex from "@twilio/flex-ui"; * * const mountNode = document.getElementById("root"); * const handleError = (error) => { * Flex.errorPage(error, mountNode); * console.error("Failed to initialize Flex", error); * } */ export declare const errorPage: (e: Error | string, nodeOrSelector: string | Element) => void; /** * Renders a login form if needed to provide account information and log user in. * Updates the provided configuration object. * * Renders a LoginFormView component if accountSid is not provided or there are problems with signing user in. * @param {Config} config configuration object * @param {string | Element} [nodeOrSelector="body"] DOM node or selector where to render the component * @returns {Promise} if resolved, then Flex instance can be created with provided config object * @example * import * as Flex from "@twilio/flex-ui"; * * const mountNode = document.getElementById("root"); * Flex.provideLoginInfo(configuration, mountNode) */ export declare function provideLoginInfo(config?: Config, nodeOrSelector?: string | Element): Promise; /** * Runs Flex with default setup. * Renders a loading spinner and prompts for login information if needed. * @param {Config} [config] configuration object * @param {string | Element} [nodeOrSelector="body"] DOM node or selector string where to render Flex * @returns {Promise} * @example * import * as Flex from "@twilio/flex-ui"; * await Flex.runDefault({}, "#root"); */ export declare function runDefault(config?: Config, nodeOrSelector?: string | Element): Promise; /** * Tries to log user in to Flex. * Can redirect the current browser window to the identity provider URL or * open a new window to navigate to IdP URL if config.loginPopup is set. * @param {(Config.SSOConfig | Config.OAuthConfig)} [config={}] SSO or OAuth 2.0 configuration object * @returns {Promise} true if there is valid token and user can be logged in. * @example * import * as Flex from '@twilio/flex-ui'; * await Flex.tryLogin({}); */ export declare function tryLogin(config?: SSOConfig | OAuthConfig): Promise; /** * Helper class to run flex * @package * @private */ declare class FlexHelper { private _manager; private constructor(); static create(config: Config): Promise; /** * Gets the instance of Manager * @readonly * @returns {Manager} Flex Manager * @example * const manager = FlexHelper.manager; */ get manager(): Manager; /** * Renders an instance of Flex to the container specified by selector. * Renders {@link ContextProvider} with created {@link Manager} instance and {@link RootContainer}. * @param {string | Element} [nodeOrSelector="body"] DOM node or selector string where to render the component * @example * import * as Flex from "@twilio/flex-ui"; * Flex.init("#root"); */ init(nodeOrSelector?: string | Element): void; } export {};