import { BaseRequest } from '.'; export declare namespace system { interface BaseBrowserConfig { url: string; openExternal: boolean; close?: boolean; useNativeLoading?: boolean; } interface FourdBrowserConfigV2 { closeHandler?: string; fixedWindowSize?: boolean; height?: number; independentWindow?: boolean; maxHeight?: number; maxWidth?: number; minHeight?: number; minWidth?: number; showAddressBar?: boolean; showControls?: boolean; width?: number; windowTitle?: string; } interface FourdBrowserConfig extends Omit { hideControls?: boolean; } type WebBrowserConfig = {}; type BrowserConfig = BaseBrowserConfig & (WebBrowserConfig | FourdBrowserConfig); type BrowserConfigV2 = BaseBrowserConfig & (WebBrowserConfig | FourdBrowserConfigV2); interface MessageRequest extends BaseRequest { message: string; } interface DialogRequest extends MessageRequest { dialogType: 'alert' | 'error' | 'confirmation' | 'info' | '3button'; icon?: 'none' | 'warning' | 'error' | 'info' | 'success' | 'update' | 'licence' | 'question' | 'offline' | 'locked'; title?: string; confirmButtonText?: string; refuseButtonText?: string; cancelButtonText?: string; } interface SystemInfo { hostType: 'desktop' | 'web' | 'android' | 'ios'; hostVersion: string; } interface FeatureList { [featureName: string]: { id: string; /** * `true` or `false` for a toggle. A number value for a dropdown selection with multiple values */ active: boolean | number; group: string; server: boolean | null; enum?: { name: string; value: number; }[]; }; } interface SetWindowTitleRequest extends BaseRequest { title: string; } interface enableCloseConfirmationRequest extends BaseRequest { isEnabled: boolean; } enum DialogButtonType { Confirm = 1, Refuse = 2, Cancel = 3 } interface Api { openTwitter(request: BaseRequest): void; close(): void; hide(): void; wait(request?: MessageRequest): void; resume(): void; cancelClose(): void; /** * (Deprecated, replaced with openDialogV2) Open up an alert dialog box. * @param request Provide the message you want to display on the dialog box. */ alert(request: MessageRequest): void; /** * (Deprecated, replaced with openDialogV2) Open up an error dialog box. * @param request Provide the message you want to display on the dialog box. */ error(request: MessageRequest): void; /** * (Deprecated, replaced with openDialogV2, this will no longer be supported from LEAP desktop 2.5.53.0) * Open up a dialog box with custom message. * @param request Provide the dialog box type and message you want to display on the dialog box. */ openDialog(request: DialogRequest): Promise; /** * Open up a dialog box with custom message. * @param request Provide the dialog box type and message you want to display on the dialog box. */ openDialogV2(request: DialogRequest): Promise; /** * (Deprecated, replaced with openUrlV2) Open an URL in browser. * Note: the `hideControls` field actually shows the browser controls when set to `true`. * @param config Provide the browser configuration. * @deprecated Use {@link openUrlV2} instead, which uses the correctly named `showControls` field. */ openUrl(config: BrowserConfig): void; /** * Open an URL in browser. * @param config Provide the browser configuration. Set `showControls` to `true` to show the browser controls. */ openUrlV2(config: BrowserConfigV2): void; getSystemInfo(): Promise; /** * Fetch system feature list. * @param forceRefresh defaults to `false`, the function only fetches new data the first time it's called. Set to `true` to make a new request every time the function is called */ getFeatureList(forceRefresh?: boolean): Promise; setWindowTitle(request: SetWindowTitleRequest): void; /** * Register a handler when the "Close" button of the window that hosts the * app is clicked. An app developer is expected to reply within 0.5 second * whether the host should cancel the closure, otherwise the host system * will close * @param handler a function that will be invoked when "Close" button is * clicked. This is a good time to clean up resources or notify users when * the data entry form is dirty. The function returns a promise whose value * indicates whether the host should cancel the closure. */ onBeforeClose(handler: () => Promise): void; /** * Send a custom request object to the host - Dedicated only for requests from internal LEAP Apps * Either the host or this sdk should prevent the operation if the app not trusted * TODO: finalise decision and handle calls from non-trusted apps * @param hasResponse default to false */ send(request: any, hasResponse?: boolean): Promise; /** * Notify the host system when your app has finished loading */ finishLoading(): void; /** * Enable close confirmation dialog when closing the window (only for LEAP Web) * @param isEnabled to specify if the close confirmation dialog pops out */ enableCloseConfirmation(request: enableCloseConfirmationRequest): void; } }