import { IUrlHash, IUrlQuerystring, IUrlPath, AppRoute, GuidValue, Theming, IBusinessProfile, IMessageBusTopicSubscription, HttpHeaders, IOmniaPropertyBag, ITenant, OmniaServiceManifests, TenantWithProperties, UserWithProperties, RollupFilterComponentState, LoadableBundleManifest, UserWithPropertyBag, FilterEngineRouterState } from "."; import { AxiosResponse } from "axios"; import { BusinessProfileWithProperties } from "./BusinessProfile"; import { AppRoutePropertyBagModel, AppRouteWithProperties, ITokenBasedUrlPath, IAppRoute } from "./Routing"; import { Guid, OmniaSharedBootstrapData, OmniaToken } from "@omnia/fx-models/internal-do-not-import-from-here/shared/models"; import { BundleTargetTypes, OmniaBackendRuntimes, OmniaClientRuntimes } from "./Enums"; export interface OmniaBootstrapData extends OmniaSharedBootstrapData { manifests: OmniaServiceManifests; enviroment: OmniaEnvironmentContext; user: UserWithProperties; theming: Theming; businessProfile: BusinessProfileWithProperties; tenant: TenantWithProperties; appRoute: AppRouteWithProperties; activatedFeatures: Guid[]; localization: { [key: string]: {}; }; runtime?: OmniaRuntimeConfiguration; } export interface ILoadManifestResourceProvider { getBundleUrl(manifest: LoadableBundleManifest, bundleType: BundleTargetTypes): string; } export interface OmniaRuntimeConfiguration { enableSettingsService?: boolean; enableAppRoute?: boolean; enableTheming?: boolean; enableMultilingual?: boolean; enableWorker?: boolean; loadableManifestProvider?: ILoadManifestResourceProvider; blockedManifest?: { omniaServiceId: GuidValue; resourceId: GuidValue; }[]; } declare global { interface Window { omnia: OmniaBootstrapData; } } declare global { var omnia: OmniaSharedBootstrapData; } export interface OmniaEnvironmentContext { readonly isOmniaApp: boolean; clientRuntime: OmniaClientRuntimes; backendRuntime: OmniaBackendRuntimes; isBackendSharePointServer: boolean; isBackendM365: boolean; } export interface OmniaTenantContext { tenantId: string; profileId: string; } export interface AppInstanceContext { appRouteWithProperties: AppRouteWithProperties; businessProfileWithProperties: BusinessProfileWithProperties; activatedFeatures: Guid[]; } export interface OmniaTokenContext { omniaToken: Promise; } export interface IAppRouteContext { readonly appRoute: AppRoute; readonly propertyBag: IOmniaPropertyBag; } /** * Provides filtered Routing Context based on Router implementation */ export interface IRouteContext { path: IUrlPath; querystring: IUrlQuerystring; hash: IUrlHash; state?: any; readonly appInstanceContext?: AppInstanceContext; } export interface TokenBasedRouteStateData { } export interface TokenBasedRoute { } export interface ITokenBasedRouteContext { readonly path: ITokenBasedUrlPath; readonly route: T1; readonly stateData: T2; } export interface AdminRoute extends TokenBasedRoute { manifestId: GuidValue; relativePath: string; } export interface BusinessProfileRoute extends TokenBasedRoute { profileId: GuidValue; } export interface IContextProvider extends IContextProviderHttpActions { getProviderUniqueId: () => string; getSerializeableContextRepresentation: () => Promise; createFromContextRepresentation: (contextRepresentation: any) => void; getContext: () => T; } export interface IMutableContextProvider> extends IContextProvider { getMutableContext: () => IMutableContext; } export interface IOmniaContext extends IMutableContext { language: string; environment: OmniaEnvironmentContext; businessProfile: IBusinessProfile; appRoute: IAppRoute; tenant: ITenant; theming: Theming; user: Promise; tokens: OmniaTokenContext; activatedFeatures: Guid[]; customDomain?: string; defaultDomain: string; routePrefixes: string[]; } export interface IMutableContext { onContextChanged: () => IMessageBusTopicSubscription; } export interface IContextProviderHttpActions { /** * This type of headers may be encoded in the http request to avoid preflight etc * * These headers should match the serverside headers used in middleware to create context * */ getContextHttpHeaders: () => Promise; /** * These headers will be passed normally, take care not to add custom headers triggering preflight * */ getHttpHeaders: () => Promise; /** * A hook used to analyse responses for any error related to context, i.e. refresh needed etc * (If context error make sure the context is refreshed, and pass back true) * */ shouldRetryHttpRequest: (httpResponse: AxiosResponse) => Promise; } export interface RollupFilterRoute extends TokenBasedRoute { rollupFilterComponentStates: Array; } export interface FilterEngineRoute extends TokenBasedRoute { filterEngineStates: Array; } export interface IContextProviderCollection { getContextHttpHeaders: () => Promise; getHttpHeaders: () => Promise; getSerializedContextRepresentation: () => Promise; createFromContextRepresentation: (serializedContextRepresentation: string) => void; shouldRetryHttpRequest: (httpResponse: AxiosResponse) => Promise; } export interface AnchorLinkRoute extends TokenBasedRoute { id: string; anchorPath: string; }