@c8y/bootstrap
Version:
Bootstrap layer
72 lines (71 loc) • 2.99 kB
TypeScript
import type { ApplicationRemotePlugins } from '@c8y/client';
declare global {
interface Window {
C8Y_APP?: {
modules: any[];
[key: string]: unknown;
};
C8Y_OPTIONS_TO_MERGE?: OptionsToMerge;
}
}
export interface Options {
languages?: object;
brandingCssVars?: Record<string, string>;
dynamicOptionsUrl?: boolean | string;
remotes?: ApplicationRemotePlugins;
remoteModules?: [];
versions?: object;
[key: string]: unknown;
}
export interface OptionsToMerge {
urlOptions: any;
staticOptions: any;
/** Options loaded public-options app (options.json) */
dynamicOptions: any;
/** Options loaded from cumulocity.json of app */
localDynamicOptions: any;
loadedLoginOptions: any;
previewOptions: any;
}
export declare function mergeOptions(inputOptions: OptionsToMerge): Options;
export declare function loadOptions(): Promise<Options>;
export declare function getOptionsToMerge(): OptionsToMerge;
export declare function getAllMFRemotes(options: Array<{
remotes?: object;
}>): ApplicationRemotePlugins;
export declare function loadUrlOptions(): Options;
export declare function clearUrlOptionsCache(): void;
/**
* Update the window object with the given options and modules.
* @param windowObj - The global window object.
* @param c8yAppVarName - The variable name used for the C8Y_APP object.
* @param options - An object containing configuration options for the C8Y_APP object.
* @param modulesToCopy - An array of angularjs modules to be added to the C8Y_APP object.
* @returns - The updated window object.
*/
export declare function updateWindowObject<T extends Record<string, unknown>>(windowObj: Window, options: T): T;
/**
* Apply the given options to the C8Y_APP object in the window and update the document elements.
* @param options - An object containing configuration options for the C8Y_APP object.
* @returns - The updated options object.
*/
export declare function applyOptions(options: Record<string, unknown>): Record<string, unknown>;
export declare function setImportMap(options: Record<string, unknown>): void;
export declare function applyBrandingOptions(options: Record<string, unknown>): void;
export declare function setVersion(options: any): void;
export declare function updateTitle({ globalTitle }: {
globalTitle: any;
}, document: any): void;
export declare function updateFavicon({ faviconUrl }: {
faviconUrl?: string;
}, document: Document): void;
export declare function updateBrandingUrl({ brandingUrl }: {
brandingUrl: any;
}, document: Document): void;
export declare function updateCss({ brandingCssVars, extraCssUrls, extraCss }: {
brandingCssVars: Record<string, string>;
extraCssUrls: Array<string>;
extraCss: string;
}, document: Document): void;
export declare function applyBrandingVars(brandingCssVars: Record<string, string>): void;
export declare function updateTranslations(options: any): void;