// Type definitions for Luigi Client export as namespace LuigiClient; export declare interface AuthData { accessToken?: string; accessTokenExpirationDate?: number; idToken?: string; [key: string]: any; } export declare interface ConfirmationModalSettings { type?: string; header?: string; body?: string; buttonConfirm?: string | boolean; buttonDismiss?: string; } export declare interface ModalSettings { title?: string; size?: 'fullscreen' | 'l' | 'm' | 's'; width?: string; height?: string; keepPrevious?: boolean; closebtn_data_testid?: string; } export declare interface SplitViewSettings { title?: string; size?: number; collapsed?: boolean; } export enum SplitViewEvents { 'expand', 'collapse', 'resize', 'close' } export declare interface SplitViewInstance { collapse: () => void; expand: () => void; setSize: (value: number) => void; on: (key: SplitViewEvents, callback: () => void) => string; // exists: () => boolean; getSize: () => number; isCollapsed: () => boolean; isExpanded: () => boolean; } export declare interface DrawerSettings { header?: any; size?: 'l' | 'm' | 's' | 'xs'; backdrop?: boolean; overlap?: boolean; } export declare interface Context { authData?: AuthData; context?: { parentNavigationContext?: string[] }; internal?: { userSettings?: getUserSettings; }; nodeParams?: NodeParams; pathParams?: PathParams; anchor?: string; [key: string]: any; } export declare interface NodeParams { [key: string]: string; } export declare interface ClientPermissions { [key: string]: any; } export declare interface AlertSettings { text?: string; type: 'info' | 'success' | 'warning' | 'error'; links?: { [key: string]: { text: string; url?: string; dismissKey?: string }; }; closeAfter?: number; } export declare interface PathParams { [key: string]: string; } export declare interface CoreSearchParams { [key: string]: string; } export declare interface RouteChangingOptions { [key: string]: boolean; } export declare interface UserSettings { [key: string]: number | string | boolean; } export declare interface UxManager { /** * Adds a backdrop to block the top and side navigation. It is based on the Fundamental UI Modal, which you can use in your micro frontend to achieve the same behavior. * @memberof uxManager */ addBackdrop: () => void; /** * Removes the backdrop. * @memberof uxManager */ removeBackdrop: () => void; /** * Adds a backdrop with a loading indicator for the micro frontend frame. This overrides the {@link navigation-parameters-reference.md#node-parameters loadingIndicator.enabled} setting. * @memberof uxManager */ showLoadingIndicator: () => void; /** * Removes the loading indicator. Use it after calling {@link #showLoadingIndicator showLoadingIndicator()} or to hide the indicator when you use the {@link navigation-parameters-reference.md#node-parameters loadingIndicator.hideAutomatically: false} node configuration. * @memberof uxManager */ hideLoadingIndicator: () => void; /** * Closes the currently opened micro frontend modal. * @memberof uxManager */ closeCurrentModal: () => void; /** * This method informs the main application that there are unsaved changes in the current view in the iframe. For example, that can be a view with form fields which were edited but not submitted. * @param {boolean} isDirty indicates if there are any unsaved changes on the current page or in the component * @memberof uxManager */ setDirtyStatus: (isDirty: boolean) => void; /** * Shows an alert. * @memberof uxManager * @param {Object} settings the settings for the alert * @param {string} settings.text the content of the alert. To add a link to the content, you have to set up the link in the `links` object. The key(s) in the `links` object must be used in the text to reference the links, wrapped in curly brackets with no spaces. If you don't specify any text, the alert is not displayed * @param {('info'|'success'|'warning'|'error')} settings.type sets the type of alert * @param {Object} settings.links provides links data * @param {Object} settings.links.LINK_KEY object containing the data for a particular link. To properly render the link in the alert message refer to the description of the **settings.text** parameter * @param {string} settings.links.LINK_KEY.text text which replaces the link identifier in the alert content * @param {string} settings.links.LINK_KEY.url URL to navigate when you click the link. Currently, only internal links are supported in the form of relative or absolute paths * @param {string} settings.links.LINK_KEY.dismissKey dismissKey which represents the key of the link. * @param {number} settings.closeAfter (optional) time in milliseconds that tells Luigi when to close the Alert automatically. If not provided, the Alert will stay on until closed manually. It has to be greater than `100` * @returns {promise} which is resolved when the alert is dismissed * @example * import LuigiClient from '@luigi-project/client'; * const settings = { * text: "Ut enim ad minim veniam, {goToHome} quis nostrud exercitation ullamco {relativePath}. Duis aute irure dolor {goToOtherProject} or {neverShowItAgain}", * type: 'info', * links: { * goToHome: { text: 'homepage', url: '/overview' }, * goToOtherProject: { text: 'other project', url: '/projects/pr2' }, * relativePath: { text: 'relative hide side nav', url: 'hideSideNav' }, * neverShowItAgain: { text: 'Never show it again', dismissKey: 'neverShowItAgain' } * }, * closeAfter: 3000 * } * LuigiClient * .uxManager() * .showAlert(settings) * .then(() => { * // Logic to execute when the alert is dismissed * }); */ showAlert: (settings: AlertSettings) => Promise; /** * Shows a confirmation modal. * @memberof uxManager * @param {Object} settings the settings of the confirmation modal. If you don't provide any value for any of the fields, a default value is used * @param {string} [settings.header="Confirmation"] the content of the modal header * @param {string} [settings.body="Are you sure you want to do this?"] the content of the modal body * @param {string} [settings.buttonConfirm="Yes"] the label for the modal confirm button * @param {string} [settings.buttonDismiss="No"] the label for the modal dismiss button * @returns {promise} which is resolved when accepting the confirmation modal and rejected when dismissing it * @example * import LuigiClient from '@luigi-project/client'; * const settings = { * header: "Confirmation", * body: "Are you sure you want to do this?", * buttonConfirm: "Yes", * buttonDismiss: "No" * } * LuigiClient * .uxManager() * .showConfirmationModal(settings) * .then(() => { * // Logic to execute when the confirmation modal is dismissed * }); */ showConfirmationModal: (settings: ConfirmationModalSettings) => Promise; /** * Gets the current locale. * @returns {string} current locale * @memberof uxManager */ getCurrentLocale: () => string; /** * Gets the current theme. * @returns {*} current themeObj * @memberof uxManager */ getCurrentTheme: () => any; /** * Sets current locale to the specified one. * * **NOTE:** this must be explicitly allowed on the navigation node level by setting `clientPermissions.changeCurrentLocale` to `true`. (See {@link navigation-parameters-reference.md Node parameters}.) * * @param {string} locale locale to be set as the current locale * @memberof uxManager */ setCurrentLocale: (locale: string) => void; /** * Checks if the current micro frontend is displayed inside a split view * @returns {boolean} indicating if it is loaded inside a split view * @memberof uxManager * @since 0.6.0 */ isSplitView: () => boolean; /** * Checks if the current micro frontend is displayed inside a modal * @returns {boolean} indicating if it is loaded inside a modal * @memberof uxManager * @since 0.6.0 */ isModal: () => boolean; /** * Checks if the current micro frontend is displayed inside a drawer * @returns {boolean} indicating if it is loaded inside a drawer * @memberof uxManager * @since 1.26.0 */ isDrawer: () => boolean; /** * Gets the CSS variables from Luigi Core with their key and value. * @returns {Object} CSS variables with their key and value. * @memberof uxManager * @since 2.3.0 * @example LuigiClient.uxManager().getCSSVariables(); */ getCSSVariables: () => Object; /** * Adds the CSS variables from Luigi Core in a