import { ColumnsView } from './column'; import { Segment, SegmentCountry, SegmentUser, SelectedBrand, SelectedCountry, User } from './user'; import type { i18n } from 'i18next'; import { Theme } from '@mui/material'; import { CalenderMode } from './theme'; import { Timezone } from './appConfig'; import { Brand, Entity, Override, TableMode } from './index.js'; import { TextAndLang } from './common'; export type AppPayload = object> = { services: { [key in TServiceCodes]?: ServicePayload; }; }; export type DefaultServicePayload = { columnFilters?: Record; filteredIds?: string[]; dateRange?: [Date, Date]; filterStatus?: string; scrollToId?: string; isTextShown?: boolean; tableViews?: ColumnsView[]; calendarTimezone?: number; reportTypes?: string[]; }; export type ServicePayload = object> = Override; export interface AppDetails { id: string; appCode: string; appId: string; segmentId: string; serviceCode: string; serviceId: string; isMinimized: boolean; isMaximized: boolean; order: number; openOrder?: number; color: string; sandboxMode: boolean; dimensions: { width: number | string; height: number | string; maxWidth: number | string; maxHeight: number | string; minWidth: number | string; minHeight: number | string; }; payload?: Record & ServicePayload; toolbarIconUrl?: string; hideMaximizedApp?: boolean; hideMinimizeApp?: boolean; hideSandboxApp?: boolean; hideHeader?: boolean; servicesVisibility?: Record; /** * When true, this window never drives the host URL: clicking/reordering it * won't navigate the host to its app/service route, and the mount-time URL * sync is skipped. Used when an app is opened as a sub-app whose opener * keeps its own route (e.g. the Account Widget opened from Business). */ isUrlNavigationDisabled?: boolean; /** * True when the window should render without the host's OS chrome — the app * draws its own UI. Such windows are excluded from window * ordering/reordering. */ isAppWindowHidden?: boolean; /** * The ids of the app windows considered children of this app. When this app * is closed, the host automatically closes its children. */ childApps?: { id: string; }[]; } export interface ServiceFunction { id: string; code: string; name: TextAndLang[]; } export interface AppService { id: string; code: string; name: TextAndLang[]; functions: ServiceFunction[]; visible?: boolean; } export interface UserApp { id: string; code: string; iconUrl: string; toolbarIconUrl: string; name: TextAndLang[]; visible?: boolean; app_services: AppService[]; } export type NavigateFunctionOptions = { /** * Open the app as a bare window with no main app window shell: the app draws * its own chrome, and the window is excluded from window ordering/reordering. */ isAppWindowHidden?: boolean; }; export type NavigateFunction = (params: { windowId?: string; appCode: string; serviceCode: string; sandboxMode?: boolean; state?: any; }, options?: NavigateFunctionOptions) => void; export interface WindowPreview { id: string; img: string; status: 'idle' | 'completed' | 'error' | 'loading'; appCode: string; } export type MFWidgetBaseProps = { windowId: string; i18n?: i18n; app: UserApp; appWindow: { isMinimized: boolean; isMaximized: boolean; order: number; dimensions: Pick; }; features: { calendarMode: CalenderMode; tableMode: TableMode; hasReportsApp: boolean; hasHeader: boolean; sandboxMode: boolean; initialServiceCode?: string; initialAppPayload?: AppPayload; }; user: User; segment: { id: string; name: TextAndLang[]; code: string; type: string; brands: Brand[]; countries: SegmentCountry[]; defaultCountry: SegmentCountry; defaultEntity: Entity; apps: UserApp[]; users: SegmentUser[]; operator: Segment['operator']; organizationId: string; isBusinessSegment: boolean; isAnyMerchantHasMarketplace: boolean; isSegmentHasMoreThanOneMerchant: boolean; marketplaceMerchantsCount: number; }; segments: Segment[]; selectedSegment: { id: string; selectedBrands: SelectedBrand[]; selectedCountries: SelectedCountry[]; }; ui: { theme: Theme; }; timezone: { current: Timezone | null; default: Timezone | null; }; };