import { LayerGroups, OfflineCreatePackOptions, } from '../interfaces/gis.interface' import { CheckList } from '../models/_default/checkList' import { CheckPoint } from '../models/_default/checkPoint' import { GisFeature } from '../models/_default/gisFeature' import { ListingConfig } from '../models/_default/listingConfig' import { Record as RecordModel } from '../models/_default/record' import { Request } from '../models/_default/request' import { Ticket } from '../models/_default/ticket' import { UserElement } from '../models/_default/userElement' import { Element } from '../models/element' import { MainStore } from '../stores/mainStore' import { ElementSchemaVersion, LocalFile } from './element.interface' import { LayerMetadataConfig } from './gis.interface' import { FullCalendarEvent, NativeFile } from '.' export enum MODELS { LISTING_CONFIG = 'listingConfig', USER_ELEMENT = 'userElement', GIS_FEATURE = 'gisFeature', CHECKLIST = 'checkList', CHECKPOINT = 'checkPoint', TICKET = 'ticket', REQUEST = 'request', // V2 of Ticket RECORD = 'record', // V2 of Work Record } interface ElementModels extends Record { [MODELS.LISTING_CONFIG]: typeof ListingConfig [MODELS.USER_ELEMENT]: typeof UserElement [MODELS.TICKET]: typeof Ticket [MODELS.CHECKLIST]: typeof CheckList [MODELS.CHECKPOINT]: typeof CheckPoint [MODELS.REQUEST]: typeof Request [MODELS.RECORD]: typeof RecordModel } export interface ApplicationModels extends Record { elementModels?: Partial [MODELS.GIS_FEATURE]?: typeof GisFeature } export interface MenuItemBase { displayName: string icon?: string buttonStyle?: { color?: string backgroundColor?: string iconColor?: string } } export interface MenuItem extends MenuItemBase { type: 'item' name: string screen: string arguments?: { [arg: string]: unknown } } export interface NestedMenu extends MenuItemBase { type: 'group' id: string items: (MenuItem | NestedMenu)[] } export type Screen = string | { screen: string; params: Record } export interface AppConfiguration { usesWorkgroups?: boolean getMenuItems: (store: MainStore) => (MenuItem | NestedMenu)[] /** * Organization-settings navigation items whose link (`to`/`href`) contains * any of these substrings are not rendered in the app menu. */ ignoredNavigationLinks?: string[] showEditElementButton?: (element: Element) => boolean showEditListingButton?: (store: MainStore) => boolean onScanText?: ( payload: string, ) => { readonly type: string readonly payload?: Record | undefined readonly source?: string | undefined readonly target?: string | undefined } capturePhotosTransform?: ( files: LocalFile[], element: Element, ) => Promise[]> initialScreen: Screen | ((store: MainStore) => Screen) inactivityLogout?: { timeoutMinutes: number securityGroupIds?: string[] } offline?: { preloadTypes: typeof Element[] mapTilesConfig?: OfflineCreatePackOptions[] gisDataConfig?: { enabled: boolean } setupOfflineResources?: ( store: MainStore, onMessage?: (message: string) => void, ) => Promise } } export interface OrganizationConfiguration { forceVersion?: ElementSchemaVersion usesUserElement?: boolean userElementRequired?: boolean models?: ApplicationModels map?: { initialMapCenter?: [number, number] initialMapZoom?: number minFeatureRenderZoom?: number layerMetadata?: Record elementCreate?: typeof Element[] featureElementCreateEnabled?: boolean featureElementProjection?: Record // type -> attributes[] getPreselectedLayers?: (layerGroups: LayerGroups) => string[] region?: string searchBias?: [number, number] // LEGACY - replaced by initialMapCenter selectionSetEnabled?: boolean listingProjectionAttributes?: string[] needsSecurityGroupForGisAttributes?: boolean // If enabled, only "GIS" SG members can see attributes } app?: AppConfiguration recurrenceEvents?: (elType: string | undefined) => { isLoading: boolean events: FullCalendarEvent[] } }