/** Copyright 2022 Mia srl Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import type { BaseExtension, MicrolcApi } from '@micro-lc/orchestrator'; import type { Theme } from './lib/utils'; export interface User { avatar?: string; name?: string; } export type VoidFn = () => void; export type OnThemeChange = (newTheme: Theme) => void; interface MlcApiEvent { [key: string]: unknown; theme: Theme; user: Record; } export type MlcApi = MicrolcApi; /** How the layout will be structured */ export type Mode = 'fixedSideBar' | 'overlaySideBar' | 'topBar'; /** Translatable text. It can be a string constant for all language or a map linking rfc5646 language codes to * localized strings */ export type LocalizedText = string | Record; /** Definition of a dynamically loaded icon */ export interface Icon { /** Library from witch the icon is pulled */ library: '@ant-design/icons-svg' | '@fortawesome/free-brands-svg-icons' | '@fortawesome/free-regular-svg-icons' | '@fortawesome/free-solid-svg-icons' | 'phosphor/bold' | 'phosphor/duotone' | 'phosphor/fill' | 'phosphor/light' | 'phosphor/regular' | 'phosphor/thin'; /** Name of the icon according to the chosen library */ selector: string; } export interface HrefMenuItem { /** Link's destination */ href: string; icon?: Icon; /** Unique identifier of the href */ id: string; label?: LocalizedText; /** Specifies where to open the linked document */ target?: '_blank' | '_self' | '_parent' | '_top'; /** Type of the item: hyperlink to another page */ type: 'href'; } export interface ApplicationMenuItem { icon?: Icon; /** Unique identifier of the corresponding micro-lc application */ id: string; label?: LocalizedText; selectedAlsoOn?: string[]; /** Type of the item: micro-lc application */ type: 'application'; } export interface CategoryMenuItem { children?: MenuItem[]; icon?: Icon; /** Unique identifier of the category */ id: string; label?: LocalizedText; /** Type of the item: collapsable sub-menu */ type: 'category'; } export interface GroupMenuItem { children?: MenuItem[]; /** Unique identifier of the group */ id: string; label?: LocalizedText; /** Type of the item: non-collapsable group of items */ type: 'group'; } export type MenuItem = HrefMenuItem | ApplicationMenuItem | CategoryMenuItem | GroupMenuItem; /** Information needed to display the company logo */ export interface Logo { /** Alternative text to display if the logo is not found */ altText?: string; /** Link to navigate to when the logo is clicked */ onClickHref?: string; /** URL of the logo image */ url?: string | { /** URL of the logo image for dark theme */ urlDarkImage: string; /** URL of the logo image for light theme */ urlLightImage: string; }; } /** Configuration of the help menu rendered on the top bar */ export interface HelpMenu { /** Link to the help page */ helpHref: string; } /** Configuration of the user menu rendered on the top bar */ export interface UserMenu { /** Configuration needed to perform user logout */ logout?: { /** Method used to perform the call to the URL specified in the 'url' property */ method?: 'GET' | 'POST'; /** URL to be redirected to after the logout */ redirectUrl?: string; /** URL called to log out the user. The method used is the one specified in the 'method' property */ url?: string; }; /** URL called in GET to retrieve user data */ userInfoUrl: string; /** Mapping between the properties returned from the user info URL call and the ones expected by the component */ userPropertiesMapping?: Record; } /** Configuration for the HTML document head */ export interface Head { /** Url of the fav icon */ favIconUrl?: string; /** Title of the tab */ title?: string; } export {};