export declare interface WebComponentSettings {
type?: string;
selfRegistered?: boolean;
tagName?: string;
}
export default class LuigiContainer extends HTMLElement {
/**
* The URL of the microfrontend to be rendered.
* @since 1.0.0
*
* @example
* @example myContainer.viewurl = "/index.html"
*/
viewurl: string;
/**
* If set to true defers from initializing the microfronted automatically. In that case init() can be used.
* @since 1.0.0
*
* @example
* @example myContainer.deferInit = true
*/
deferInit: boolean;
/**
* The stringified context object to be passed to the microfrontend.
* @since 1.0.0
*
*
* @example
* @example myContainer.context = {label: "Dashboard"}
*/
context: string;
/**
* Label information for the microfrontend.
* @since 1.0.0
*
* @example
* @example myContainer.label = "Dashboard"
*/
label: string;
/**
* Predicate that sets whether the microfrontend is to be rendered in a web component or not. It can also be an object with the following attributes:
* @param {boolean} specifies if a microfrontend is a webcomponent or not without any other settings.
* @param {Object} [WebComponentSettings] specifies that the microfrontend is a webcomponent with addtional settings.
* @param {string} WebComponentSettings.type: string, like module.
* @param {boolean} WebComponentSettings.selfRegistered: if it is true, the web component bundle will be added via script tag.
* @param {string} WebComponentSettings.tagName: tag name where web component is added to DOM.
* @param {string} string must be a stringified boolean or JSON object from type `WebComponentSettings`.
*
*
*
*
* Note: If you have to use the mechanism of `selfRegistered`, we recommend using the following code in your web component:
*
*
*
* window.Luigi._registerWebcomponent(new URL(document.currentScript?.getAttribute('src'), location), );
*
* The advantage of this line of code is: you don't have to specify a tag name, thus avoiding the duplication of self-defined tag names.
*
* @since 1.0.0
* @example
* @example myContainer.webcomponent = { type: 'module', selfRegistered: true, tagName: 'my-webcomponent'}
*/
webcomponent: boolean | WebComponentSettings | string;
/**
* The locale to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.locale = "en_us"
*/
locale: string;
/**
* The theme to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.theme = 'sap_horizon'
*/
theme: string;
/**
* The list of active feature toggles to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example myContainer.activeFeatureToggleList = ["enable-foo", "allow-bar"]
* @example
*/
activeFeatureToggleList: string[];
/**
* If set to true, skips third party cookie check
* @since 1.4.0
*
* @example
* @example myContainer.skipCookieCheck = true
*/
skipCookieCheck: boolean;
/**
* If set to true, skips handshake and ready event is fired immediately.
* @since 1.0.0
* TODO: https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML says booleans should not use "true"/"false", find a consistent style for our docs.
* @example
* @example myContainer.skipInitCheck = true
*/
skipInitCheck: boolean;
/**
* The parameters to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.nodeParams = {foo: bar}
*/
nodeParams: Object;
/**
* If set to true, the Luigi container webcomponent will not use the shadow DOM for rendering.
* @since 1.2.0
*
* @example
* @example myContainer.noShadow = true
*/
noShadow: boolean;
/**
* The search parameters to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.searchParams = {foo: bar}
*/
searchParams: Object;
/**
* The path parameters to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.pathParams = {foo: "bar"}
*/
pathParams: Object;
/**
* The clientPermissions to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.clientPermissions = {permission: "adminGroup"}
*/
clientPermissions: Object;
/**
* The user settings to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.userSettings = {language: 'de', theme: 'sap_horizon'}
*/
userSettings: Object;
/**
* The anchor value to be passed to the web-component-based micro frontend.
* @since 1.0.0
*
* @example
* @example myContainer.anchor = '#foo'
*/
anchor: string;
/**
* The list of rules for the content in the iframe, managed by the HTML `allow` attribute.
* You can use one or more rules by adding them to the array, for example allowRules: ["microphone", "camera"].
* @example
* @example containerElement.allowRules = ['microphone', 'camera']
* @since 1.2.0
*/
allowRules: string[];
/**
* The list of rules for the content in the iframe, managed by the HTML `sandbox` attribute.
* You can use one or more rules by adding them to the array, for example sandboxRules: ["allow-scripts", "allow-same-origin"].
* @example
* @example containerElement.sandboxRules = ['allow-modals', 'allow-popups']
* @since 1.2.0
*/
sandboxRules: string[];
/**
* The document title value to be passed to the web-component-based micro frontend.
* @since 1.2.0
*
* @example
* @example myContainer.documentTitle = 'Luigi App'
*/
documentTitle: string;
/**
* The hasBack value to be passed to the web-component-based micro frontend.
* It indicates that there is one or more preserved views. Useful when you need to show a back button.
* @since 1.2.0
*
* @example
* @example myContainer.hasBack = true
*/
hasBack: boolean;
/**
* The dirty status value to be passed to the web-component-based micro frontend.
* It's used to indicate that there are unsaved changes when navigating away.
* @since 1.2.0
*
* @example
* @example myContainer.dirtyStatus = true
*/
dirtyStatus: boolean;
/**
* Function that updates the context of the microfrontend.
* @param {Object} contextObj The context data
* @param {Object} internal internal luigi legacy data used for iframes
* @example
* containerElement.updateContext({newContextData: 'some data'})
* @since 1.0.0
*/
updateContext(contextObj: Object, internal?: Object): void;
/**
* Send a custom message to the microfronted.
* @param id a string containing the message id
* @param data data to be sent alongside the custom message
* @example
* containerElement.sendCustomMessage('my-message-id', {dataToSend: 'some data'})
* @since 1.0.0
*/
sendCustomMessage(id: string, data?: Object): void;
/**
* A function that notifies the microfrontend that the opened alert has been closed.
* This function is deprecated, please use `notifyAlertClosed`.
* @param id the id of the opened alert
* @param dismissKey the key specifying which dismiss link was clicked on the alert message (optional)
* @example
* containerElement.closeAlert('my-alert-id', 'my-dismiss-key')
* @since 1.0.0
* @deprecated
*/
closeAlert(id: string, dismissKey?: string): void;
/**
* A function that notifies the microfrontend that the opened alert has been closed.
* @param id the id of the opened alert
* @param dismissKey the key specifying which dismiss link was clicked on the alert message (optional)
* @example
* containerElement.notifyAlertClosed('my-alert-id', 'my-dismiss-key')
* @since 1.6.0
*/
notifyAlertClosed(id: string, dismissKey?: string): void;
/**
* A function that notifies the microfrontend that the opened confirmation modal has been closed.
* @param {boolean} result the output of the opened confirmation modal (true/false)
* @example
* containerElement.notifyConfirmationModalClosed(true)
* @since 1.7.0
*/
notifyConfirmationModalClosed(result: boolean): void;
/**
* Updates route of the microfrontend by sending a message to the iframe that sets new view URL.
* @param {string} viewurl new view URL
* @param {Object} internal Luigi legacy data (optional)
* @since 1.5.0
*/
updateViewUrl(viewurl: string, internal?: object): void;
/**
* Manually triggers the micro frontend rendering process when using defer-init attribute.
* @example
* containerElement.init()
* @since 1.0.0
*/
init(): void;
/**
* The authData value to be passed to the iframe-based micro frontend.
* @since 1.2.0
*/
authData: Object;
}