import type { Application } from './api/application/index'; import { AppVersionEvent } from './api/events/system'; import { TypedEventEmitter } from './api/events/typedEventEmitter'; import type { ExternalApplication } from './api/external-application/index'; import { FinApi } from './api/fin'; import type { _Frame } from './api/frame/index'; import type ChannelClient from './api/interappbus/channel/client'; import { MessagingProtocols } from './api/interappbus/channel/protocols/index'; import type { ChannelProvider } from './api/interappbus/channel/provider'; import type { InteropBroker, InteropClient } from './api/interop/index'; import type { Platform } from './api/platform/index'; import type { Layout } from './api/platform/layout/index'; import { PlatformProvider } from './api/platform/provider'; import { SnapshotSource } from './api/snapshot-source/index'; import type { View } from './api/view/index'; import { _Window } from './api/window/index'; import { ColumnOrRow, TabStack } from './api/platform/layout/entities/layout-entities'; export type Fin = FinApi; export type { Application, ExternalApplication, _Frame as Frame, ChannelClient, ChannelProvider, Platform, Layout, View, ColumnOrRow, TabStack, _Window as Window, InteropClient, InteropBroker, SnapshotSource }; export type { LayoutEntityDefinition, LayoutEntityTypes, LayoutPosition } from './api/platform/layout/entities/shapes'; export type WebContent = View | _Window; export type { PlatformProvider }; export type ApplicationIdentity = { uuid: string; }; export type Identity = { /** * Universally unique identifier of the compenent */ uuid: string; /** * The name of the component */ name: string; }; /** * Identity of a channel client */ export type ClientIdentity = Identity & { /** * Unique identifier for a client, because there can be multiple clients at one name/uuid entity. */ endpointId: string; isLocalEndpointId: boolean; }; /** * Extended channel client information */ export type ClientInfo = Omit & { /** * Indicates if the client belongs to a Window, View or IFrame */ entityType: EntityType; /** * URL of the Window, View or IFrame at the time of connection to the Channel Provider. */ connectionUrl: string; }; export type ClientIdentityMultiRuntime = ClientIdentity & { runtimeUuid: string; }; export type ClientConnectionPayload = ClientIdentity & ClientInfo; export type EntityInfo = { uuid: string; name: string; entityType: EntityType; }; export type EntityType = 'window' | 'iframe' | 'external connection' | 'view' | 'unknown'; export type Bounds = { top: number; left: number; height: number; width: number; }; /** * Returned from getBounds call. bottom and right are never used for setting. */ export type WindowBounds = Bounds & { bottom: number; right: number; }; /** * A rectangular area on the screen. */ export type Rectangle = { /** * The x coordinate of the rectangle's origin in pixels */ x: number; /** * The y coordinate of the rectangle's origin in pixels */ y: number; /** * The width of the rectangle in pixels */ width: number; /** * The height of the rectangle in pixels */ height: number; }; /** * The options object required by {@link Application.start Application.start}. * * The following options are required: * * `uuid` is required in the app manifest as well as by {@link Application.start Application.start} * * `name` is optional in the app manifest but required by {@link Application.start Application.start} * * `url` is optional in both the app manifest {@link Application.start Application.start} and but is usually given * (defaults to `"about:blank"` when omitted). * * _This jsdoc typedef mirrors the `ApplicationOption` TypeScript interface in `@types/openfin`._ * * **IMPORTANT NOTE:** * This object inherits all the properties of the window creation {@link Window~options options} object, * which will take priority over those of the same name that may be provided in `mainWindowOptions`. */ export type ApplicationCreationOptions = Partial & { name: string; uuid: string; }; /** * The complete set of options for an application. */ export type ApplicationOptions = LegacyWinOptionsInAppOptions & { /** * @defaultValue false * * Disables IAB secure logging for the app. */ disableIabSecureLogging: boolean; /** * @defaultValue 'There was an error loading the application.' * * An error message to display when the application (launched via manifest) fails to load. * A dialog box will be launched with the error message just before the runtime exits. * Load fails such as failed DNS resolutions or aborted connections as well as cancellations, _e.g.,_ `window.stop()`, * will trigger this dialog. * Client response codes such as `404 Not Found` are not treated as fails as they are valid server responses. */ loadErrorMessage: string; /** * The options of the main window of the application. */ mainWindowOptions: WindowCreationOptions; /** * The name of the application (and the application's main window). * * If provided, _must_ match `uuid`. */ name: string; /** * @defaultValue false * * A flag to configure the application as non-persistent. * Runtime exits when there are no persistent apps running. */ nonPersistent: boolean; /** * @defaultValue false * * Enable Flash at the application level. */ plugins: boolean; /** * @defaultValue false * Enable spell check at the application level. */ spellCheck: boolean; /** * @defaultValue 'about:blank' * The url to the application (specifically the application's main window). */ url: string; /** * The _Unique Universal Identifier_ (UUID) of the application, unique within the set of all other applications * running in the OpenFin Runtime. * * Note that `name` and `uuid` must match. */ uuid: string; /** * @defaultValue true * * When set to `false` it will disable the same-origin policy for the app. */ webSecurity: boolean; commands: ShortcutOverride[]; isPlatformController: boolean; /** * @defaultValue 1000 * * Platforms Only. The maximum number of "detached" or "pooled" Views that can exist in the Platform before being closed. * If you do not wish for views to be pooled on your platform, set this property to zero. */ maxViewPoolSize: number; defaultWindowOptions: Partial; defaultViewOptions: Partial; snapshot: Snapshot; /** * @defaultValue false * * Platforms Only. Prevent the Platform Provider from quitting automatically when the last Platform Window is closed. * Note: if the Platform Provider is showing, it won't close automatically. * If you want a hidden Platform Provider to remain open after the last Platform Window has been closed, set this property to true. */ preventQuitOnLastWindowClosed: boolean; interopBrokerConfiguration: InteropBrokerOptions; apiDiagnostics: boolean; defaultDomainSettings: DefaultDomainSettings; /** * @defaultValue false * Enables the use of the Jumplists API and the 'pin to taskbar' functionality. * Only relevant in Windows. */ enableJumpList: boolean; enableBeforeUnload: boolean; }; export type InteropBrokerOptions = { contextGroups?: ContextGroupInfo; logging?: InteropLoggingOptions; }; export type ContextGroupInfo = { /** * Name of the context group. */ id: string; /** * Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker. */ displayMetadata?: DisplayMetadata; }; /** * The display data for a context group. */ export type DisplayMetadata = { /** * A user-readable name for this context group, e.g: `"Red"` */ readonly name?: string; /** * The color that should be associated within this context group when displaying this context group in a UI, e.g: `0xFF0000`. */ readonly color?: string; /** * A URL of an image that can be used to display this context group */ readonly glyph?: string; }; export type LegacyWinOptionsInAppOptions = Pick; export type Snapshot = { windows: WindowCreationOptions[]; snapshotDetails?: { monitorInfo: MonitorInfo; runtimeVersion: string; timestamp: string; }; interopSnapshotDetails?: { contextGroupStates: ContextGroupStates; }; }; export type ContextGroupStates = { [key: string]: { [key: string]: Context; }; }; /** * Data passed between entities and applications. */ export type Context = { /** * An object containing string key-value pairs for the bulk of the data for the context. Differs between context types. */ id?: { [key: string]: string; }; /** * User-readable name for the incoming context. */ name?: string; /** * Conserved type for the context (e.g. `instrument` or `country`). */ type: string; }; export type MonitorInfo = { /** * The device scale factor. */ deviceScaleFactor: number; dpi: Point; nonPrimaryMonitors: MonitorDetails[]; primaryMonitor: MonitorDetails; /** * Always "api-query". */ reason: string; taskbar: TaskBar; /** * The virtual display screen coordinates. */ virtualScreen: DipRect; }; export type Point = { /** * The mouse x position */ x: number; /** * The mouse y position */ y: number; }; export type PointTopLeft = { /** * The mouse top position in virtual screen coordinates */ top: number; /** * The mouse left position in virtual screen coordinates */ left: number; }; export type RectangleByEdgePositions = { top: number; left: number; bottom: number; right: number; }; export type MonitorDetails = { /** * The available DIP scale coordinates. */ available: DipScaleRects; /** * The available monitor coordinates. */ availableRect: RectangleByEdgePositions; /** * The device id of the display. */ deviceId: string | number; /** * True if the display is active. */ displayDeviceActive: boolean; /** * The device scale factor. */ deviceScaleFactor: number; /** * The monitor coordinates. */ monitorRect: RectangleByEdgePositions; /** * The name of the display. */ name: string | number; dpi: Point; /** * The monitor coordinates. */ monitor: DipScaleRects; }; export type DipRect = RectangleByEdgePositions & { dipRect: RectangleByEdgePositions; scaledRect: RectangleByEdgePositions; }; export type DipScaleRects = { dipRect: RectangleByEdgePositions; scaledRect: RectangleByEdgePositions; }; export type TaskBar = DipScaleRects & { /** * Which edge of a monitor the taskbar is on */ edge: string; /** * The taskbar coordinates. */ rect: RectangleByEdgePositions; }; /** * Options required to create a new window with {@link Window.create Window.create}. * * Note that `name` is the only required property — albeit the `url` property is usually provided as well * (defaults to `"about:blank"` when omitted). */ export type WindowCreationOptions = Partial & { name: string; }; export type UpdatableWindowOptions = Partial; export type WindowOptions = MutableWindowOptions & ConstWindowOptions; /** * Configuration for view visibility settings */ export type ViewVisibilityOption = { enabled?: boolean; }; /** * _Platform Windows Only_. Enables views to be shown when a Platform Window is being resized by the user. */ export type ShowViewOnWindowResizeOptions = ViewVisibilityOption & { /** * @defaultValue false * * Enables showing Views when a Platform Window is being resized. */ enabled?: boolean; /** * @defaultValue 0 * * Number of milliseconds to wait between view repaints. */ paintIntervalMs?: number; }; /** * _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user. */ export type ViewVisibilityOptions = { /** * Enables views to be shown when a Platform Window is being resized by the user. */ showViewsOnWindowResize?: ShowViewOnWindowResizeOptions; /** * Allows views to be shown when they are resized by the user dragging the splitter between layout stacks. */ showViewsOnSplitterDrag?: ViewVisibilityOption; /** * _Supported on Windows Operating Systems only_. Allows views to be shown when the user is dragging a tab around a layout. */ showViewsOnTabDrag?: ViewVisibilityOption; }; /** * Visibility state of a window. */ export type WindowState = 'maximized' | 'minimized' | 'normal'; /** * Autoplay policy to apply to content in the window, can be * `no-user-gesture-required`, `user-gesture-required`, * `document-user-activation-required`. Defaults to `no-user-gesture-required`. */ export type AutoplayPolicyOptions = 'no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required'; /** * Window options that cannot be changed after creation. */ export type ConstWindowOptions = { /** * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache. */ accelerator: Partial; /** * Configurations for API injection. */ api: Api; /** * @deprecated use `icon` instead. */ applicationIcon: string; /** * Autoplay policy to apply to content in the window, can be * `no-user-gesture-required`, `user-gesture-required`, * `document-user-activation-required`. Defaults to `no-user-gesture-required`. */ autoplayPolicy: AutoplayPolicyOptions; /** * Automatically show the window when it is created. */ autoShow: boolean; /** * The window’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color * (`document.body.style.backgroundColor`), * this color briefly fills a window’s (a) content area before its content is loaded as well as (b) newly exposed * areas when growing a window. Setting * this value to the anticipated content background color can help improve user experience. * Default is white. */ backgroundColor: string; /** * Configures how new content (e,g, from `window.open` or a link) is opened. */ contentCreation: ContentCreationOptions; /** * Restrict navigation to URLs that match a whitelisted pattern. * In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited. * See [here](https://developer.chrome.com/extensions/match_patterns) for more details. */ contentNavigation: ContentNavigation; /** * Restrict redirects to URLs that match a whitelisted pattern. * In the lack of a whitelist, redirects to URLs that match a blacklisted pattern would be prohibited. * See [here](https://developer.chrome.com/extensions/match_patterns) for more details. */ contentRedirect: Partial; /** * Custom headers for requests sent by the window. */ customRequestHeaders: CustomRequestHeaders[]; /** * @defaultValue true * * Toggling off would keep the Window alive even if all its Views were closed. * This is meant for advanced users and should be used with caution. * Limitations - Once a Layout has been emptied out of all views it's not usable anymore, and certain API calls will fail. * Use `layout.replace` to create a fresh Layout instance in case you want to populate it with Views again. * ** note ** - This option is ignored in non-Platforms apps. */ closeOnLastViewRemoved: boolean; /** * Centers the window in the primary monitor. This option overrides `defaultLeft` and `defaultTop`. When `saveWindowState` is `true`, * this value will be ignored for subsequent launches in favor of the cached value. **NOTE:** On macOS _defaultCenter_ is * somewhat above center vertically. */ defaultCentered: boolean; /** * @defaultValue 500 * * The default height of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent launches * in favor of the cached value. */ defaultHeight: number; /** * @defaultValue 100 * * The default left position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent * launches in favor of the cached value. */ defaultLeft: number; /** * @defaultValue 100 * * The default top position of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent * launches in favor of the cached value. */ defaultTop: number; /** * @defaultValue 800 * * The default width of the window. When `saveWindowState` is `true`, this value will be ignored for subsequent * launches in favor of the cached value. */ defaultWidth: number; height: number; layout: any; /** * Parent identity of a modal window. It will create a modal child window when this option is set. */ modalParentIdentity: Identity; /** * The name of the window. */ name: string; permissions: Partial; /** * Scripts that run before page load. When omitted, inherits from the parent application. */ preloadScripts: PreloadScript[]; /** * String tag that attempts to group like-tagged renderers together. Will only be used if pages are on the same origin. */ processAffinity: string; /** * @defaultValue false * * Displays a shadow on frameless windows. * `shadow` and `cornerRounding` are mutually exclusive. * On Windows 7, Aero theme is required. */ shadow: boolean; /** * @defaultValue true * * Caches the location of the window. * Note: this option is ignored in Platforms as it would cause inconsistent {@link Platform#applySnapshot applySnapshot} behavior. */ saveWindowState: boolean; /** * Ignores the cached state of the window. * Defaults the opposite value of `saveWindowState` to maintain backwards compatibility. */ ignoreSavedWindowState: boolean; /** * @defaultValue false * * Makes this window a frameless window that can be created and resized to less than 41x36 px (width x height). * _Note: Caveats of small windows are no Aero Snap and drag to/from maximize._ * _Windows 10: Requires `maximizable` to be false. Resizing with the mouse is only possible down to 38x39 px._ */ smallWindow: boolean; /** * @defaultValue "normal" * * The visible state of the window on creation. * One of: * * `"maximized"` * * `"minimized"` * * `"normal"` */ state: WindowState; /** * @Deprecated - use `icon` instead. */ taskbarIcon: string; /** * Specify a taskbar group for the window. * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._ */ taskbarIconGroup: string; /** * @defaultValue "about:blank" * * The URL of the window */ url: string; /** * @defaultValue * * The `uuid` of the application, unique within the set of all `Application`s running in OpenFin Runtime. * If omitted, defaults to the `uuid` of the application spawning the window. * If given, must match the `uuid` of the application spawning the window. * In other words, the application's `uuid` is the only acceptable value, but is the default, so there's * really no need to provide it. */ uuid: string; /** * @defaultValue false * * When set to `true`, the window will not appear until the `window` object's `load` event fires. * When set to `false`, the window will appear immediately without waiting for content to be loaded. */ waitForPageLoad: boolean; width: number; x: number; y: number; experimental?: any; fdc3InteropApi?: string; /** * _Platform Windows Only_. Controls behavior for showing views when they are being resized by the user. */ viewVisibility?: ViewVisibilityOptions; }; /** * Window options that can be changed after window creation. */ export type MutableWindowOptions = { /** * Turns anything of matching RGB value transparent. * * Caveats: * * Runtime flags --disable-gpu and --allow-unsafe-compositing are required. Note: Unclear behavior on remote Desktop support * * User cannot click-through transparent regions * * Not supported on Mac * * Windows Aero must be enabled * * Won't make visual sense on Pixel-pushed environments such as Citrix * * Not supported on rounded corner windows */ alphaMask: RGB; /** * @defaultValue false * * Always position the window at the top of the window stack. */ alwaysOnTop: boolean; /** * @defaultValue 0 * * The aspect ratio of width to height to enforce for the window. If this value is equal to or less than zero, * an aspect ratio will not be enforced. */ aspectRatio: number; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * * @defaultValue true * * Show the context menu when right-clicking on the window. * Gives access to the devtools for the window. */ contextMenu: boolean; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * * Configure the context menu when right-clicking on a window. */ contextMenuSettings: ContextMenuSettings; /** * Configure the context menu when right-clicking on a window. */ contextMenuOptions: ContextMenuOptions; /** * Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the * average of _height_ and _width_. */ cornerRounding: Partial; /** * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot} * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls. * _When omitted, _inherits_ from the parent application._ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext} */ customContext: any; /** * A field that the user can attach serializable data to be ferried around with the window options. * _When omitted, _inherits_ from the parent application._ */ customData: any; /** * @defaultValue true * * Show the window's frame. */ frame: boolean; /** * @defaultValue false * * Hides the window instead of closing it when the close button is pressed. */ hideOnClose: boolean; /** * Defines the hotkeys that will be emitted as a `hotkey` event on the window. For usage example see [example]{@tutorial hotkeys}. * Within Platform, OpenFin also implements a set of pre-defined actions called * [keyboard commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands} * that can be assigned to a specific hotkey in the platform manifest. */ hotkeys: Hotkey[]; /** * A URL for the icon to be shown in the window title bar and the taskbar. * When omitted, inherits from the parent application._ * note: Window OS caches taskbar icons, therefore an icon change might only be visible after the cache is removed or the uuid is changed. */ icon: string; /** * @defaultValue true * * Include window in snapshots returned by Platform.getSnapshot(). Turning this off may be desirable when dealing with * inherently temporary windows whose state shouldn't be preserved, such as modals, menus, or popups. */ includeInSnapshots: boolean; /** * @defaultValue -1 * * The maximum height of a window. Will default to the OS defined value if set to -1. */ maxHeight: number; /** * @defaultValue true * * Allows the window to be maximized. */ maximizable: boolean; /** * @defaultValue -1 * * The maximum width of a window. Will default to the OS defined value if set to -1. */ maxWidth: number; /** * @defaultValue 0 * * The minimum height of the window. */ minHeight: number; /** * @defaultValue true * * Allows the window to be minimized. */ minimizable: boolean; /** * @defaultValue true * * The minimum width of the window. */ minWidth: number; /** * @defaultValue 1 * * A flag that specifies how transparent the window will be. * Changing opacity doesn't work on Windows 7 without Aero so setting this value will have no effect there. * This value is clamped between `0.0` and `1.0`. * In software composition mode, the runtime flag --allow-unsafe-compositing is required. */ opacity: number; /** * @defaultValue true * * A flag to allow the user to resize the window. */ resizable: boolean; /** * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. */ resizeRegion: ResizeRegion; /** * @defaultValue false * * Platforms Only. If true, will show background images in the layout when the Views are hidden. * This occurs when the window is resizing or a tab is being dragged within the layout. */ showBackgroundImages: boolean; /** * @defaultValue true * * Shows the window's icon in the taskbar. */ showTaskbarIcon: boolean; interop: InteropConfig; /** * @internal * Used by Workspace to store custom data. Overwriting or modifying this field may impact the functionality of Workspace */ _internalWorkspaceData: any; workspacePlatform: WorkspacePlatformOptions; }; export type WorkspacePlatformOptions = { /** Leaving this as any for now until we figure out what the shape should look like in Workspace */ [key: string]: any; }; /** * Object representing headers and their values, where the * object key is the name of header and value key is the value of the header */ export type WebRequestHeader = { [key: string]: string; }; /** * Custom headers for requests sent by the window. */ export type CustomRequestHeaders = { /** * The URL patterns for which the headers will be applied. */ urlPatterns: string[]; /** * Headers for requests sent by window; {key: value} results * in a header of `key=value`. */ headers: WebRequestHeader[]; }; export type WindowOptionDiff = { [key in keyof WindowOptions]: { oldVal: WindowOptions[key]; newVal: WindowOptions[key]; }; }; /** * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. */ export type ResizeRegion = { /** * @defaultValue 7 * * The size of the resize region in pixels. */ size?: number; /** * @defaultValue 9 * * The size in pixels of an additional square resizable region located at the bottom right corner of a frameless window. */ bottomRightCorner?: number; /** * Enables resizing interaction for each side of the window. */ sides?: { /** * @defaultValue true * * Enables resizing from the top of the window. */ top?: boolean; /** * @defaultValue true * * Enables resizing from the bottom of the window. */ bottom?: boolean; /** * @defaultValue true * * Enables resizing from the left side of the window. */ left?: boolean; /** * @defaultValue true * * Enables resizing from the right side of the window. */ right?: boolean; }; }; /** * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache. */ export type Accelerator = { /** * If `true`, enables the devtools keyboard shortcut:
* `Ctrl` + `Shift` + `I` _(Toggles Devtools)_ */ devtools: boolean; /** * If `true`, enables the reload keyboard shortcuts:
* `Ctrl` + `R` _(Windows)_
* `F5` _(Windows)_
* `Command` + `R` _(Mac)_ */ reload: boolean; /** * If `true`, enables the reload-from-source keyboard shortcuts:
* `Ctrl` + `Shift` + `R` _(Windows)_
* `Shift` + `F5` _(Windows)_
* `Command` + `Shift` + `R` _(Mac)_ */ reloadIgnoringCache: boolean; /** * NOTE: It is not recommended to set this value to true for Windows in Platforms as that may lead to unexpected visual shifts in layout. * If `true`, enables the zoom keyboard shortcuts:
* `Ctrl` + `+` _(Zoom In)_
* `Ctrl` + `Shift` + `+` _(Zoom In)_
* `Ctrl` + `NumPad+` _(Zoom In)_
* `Ctrl` + `-` _(Zoom Out)_
* `Ctrl` + `Shift` + `-` _(Zoom Out)_
* `Ctrl` + `NumPad-` _(Zoom Out)_
* `Ctrl` + `Scroll` _(Zoom In & Out)_
* `Ctrl` + `0` _(Restore to 100%)_ */ zoom: boolean; }; /** * Configurations for API injection. */ export type Api = { /** * Configure injection of OpenFin API into iframes based on domain */ iframe?: { /** * Inject OpenFin API into cross-origin iframes */ crossOriginInjection?: boolean; /** * Inject OpenFin API into same-origin iframes */ sameOriginInjection?: boolean; enableDeprecatedSharedName?: boolean; }; }; /** * Restrict navigation to URLs that match a whitelisted pattern. * In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited. * See [here](https://developer.chrome.com/extensions/match_patterns) for more details. */ export type ContentNavigation = { /** * Allowed URLs for navigation. */ whitelist?: string[]; /** * Forbidden URLs for navigation. */ blacklist?: string[]; }; /** * Restrict redirects to URLs that match a whitelisted pattern. * In the lack of a whitelist, redirects to URLs that match a blacklisted pattern would be prohibited. * See [here](https://developer.chrome.com/extensions/match_patterns) for more details. */ export type ContentRedirect = { /** * Allowed URLs for redirects. */ whitelist: string[]; /** * Forbidden URLs for redirects. */ blacklist: string[]; }; /** * Defines and applies rounded corners for a frameless window. **NOTE:** On macOS corner is not ellipse but circle rounded by the * average of _height_ and _width_. */ export type CornerRounding = { /** * @defaultValue 0 * * The height in pixels. */ height: number; /** * @defaultValue 0 * * The width in pixels. */ width: number; }; /** * Options for downloading a preload script. */ export type DownloadPreloadOption = { /** * URL from which to download the preload script. */ url: string; }; /** * Metadata returned from a preload script download request. */ export type DownloadPreloadInfo = { /** * Whether the download was successful. */ success: boolean; /** * URL from which the preload script should be downloaded. */ url?: string; /** * Error during preload script download. */ error: string; }; export type RGB = { red: number; blue: number; green: number; }; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * Configure the context menu when right-clicking on a window. */ export type ContextMenuSettings = { /** * Should the context menu display on right click. */ enable: boolean; /** * Should the context menu contain a button for opening devtools. */ devtools?: boolean; /** * Should the context menu contain a button for reloading the page. */ reload?: boolean; }; /** * A hotkey binding. */ export type Hotkey = { /** * The key combination of the hotkey, i.e. "Ctrl+T". */ keys: string; /** * @defaultValue false * * Prevent default key handling before emitting the event. */ preventDefault?: boolean; }; export type ShortcutOverride = Hotkey & { command: string; }; /** * A script that is run before page load. */ export type PreloadScript = { /** * @defaultValue false * * Fail to load the window if this preload script fails */ mandatory?: boolean; /** * Preload script execution state. */ state?: 'load-started' | 'load-failed' | 'load-succeeded' | 'failed' | 'succeeded'; /** * The URL from which the script was loaded. */ url: string; }; export type AutoResizeOptions = { /** * If true, the view's width will grow and shrink together with the window. false * by default. */ width?: boolean; /** * If true, the view's height will grow and shrink together with the window. false * by default. */ height?: boolean; /** * If true, the view's x position and width will grow and shrink proportionally with * the window. false by default. */ horizontal?: boolean; /** * If true, the view's y position and height will grow and shrink proportionally with * the window. false by default. */ vertical?: boolean; }; export type InteropConfig = { /** * Context Group for the client. (green, yellow, red, etc.). */ currentContextGroup?: string | null; /** * When provided, automatically connects the client to the specified provider uuid. */ providerId?: string; }; export type ViewInfo = { canNavigateBack: boolean; canNavigateForward: boolean; processAffinity: string; title: string; url: string; favicons: string[]; }; /** * View options that can be updated after creation. */ export type UpdatableViewOptions = Partial; /** * The options object required by {@link View.create View.create}. * * Note that `name` and `target` are the only required properties — albeit the `url` property is usually provided as well * (defaults to `"about:blank"` when omitted). */ export type ViewCreationOptions = Partial & { name: string; url: string; target: Identity; }; export type MutableViewOptions = { autoResize: AutoResizeOptions; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * * @defaultValue true * * Show the context menu when right-clicking on the view. * Gives access to the devtools for the view. */ contextMenu: boolean; /** * @deprecated Superseded by {@link contextMenuOptions}, which offers a larger feature-set and cleaner syntax. * * Configure the context menu when right-clicking on a window. */ contextMenuSettings: ContextMenuSettings; /** * Configure the context menu when right-clicking on a window. */ contextMenuOptions: ContextMenuOptions; /** * The view’s _backfill_ color as a hexadecimal value. Not to be confused with the content background color * (`document.body.style.backgroundColor`), * this color briefly fills a view’s (a) content area before its content is loaded as well as (b) newly exposed * areas when growing a view. Setting * this value to the anticipated content background color can help improve user experience. * Default is white. */ backgroundColor: string; /** * A field that the user can attach serializable data to be ferried around with the window options. * _When omitted, _inherits_ from the parent application._ */ customData: any; /** * A field that the user can use to attach serializable data that will be saved when {@link Platform#getSnapshot Platform.getSnapshot} * is called. If a window in a Platform is trying to update or retrieve its own context, it can use the * {@link Platform#setWindowContext Platform.setWindowContext} and {@link Platform#getWindowContext Platform.getWindowContext} calls. * _When omitted, _inherits_ from the parent application._ * As opposed to customData, this is meant for frequent updates and sharing with other contexts. [Example]{@tutorial customContext} */ customContext: any; /** * Configurations for API injection. */ api: Api; /** * Restrict navigation to URLs that match a whitelisted pattern. * In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited. * See [here](https://developer.chrome.com/extensions/match_patterns) for more details. */ contentNavigation: ContentNavigation; /** * @defaultValue false * * Platforms Only. If true, will hide and detach the View from the window for later use instead of closing, * allowing the state of the View to be saved and the View to be immediately shown in a new Layout. */ detachOnClose: boolean; /** * @defaultValue true * * **Platforms Only.** If false, the view will be persistent and can't be closed through * either UI or `Platform.closeView`. Note that the view will still be closed if the host window is closed or * if the view isn't part of the new layout when running `Layout.replace`. */ isClosable: boolean; /** * @defaultValue false * * @property {boolean} [preventDragOut=false] **Platforms Only.** If true, the tab of the view can't be dragged out of its host window. */ preventDragOut: boolean; interop?: InteropConfig; /** * @internal * Used by Workspace to store custom data. Overwriting or modifying this field may impact the functionality of Workspace */ _internalWorkspaceData: any; }; /** * User-facing options for a view. */ export type ViewOptions = ConstViewOptions & MutableViewOptions; /** * View options that cannot be updated after creation. */ export type ConstViewOptions = { /** * The name of the view. */ name: string; /** * @defaultValue "about:blank" * * The URL of the window */ url: string; /** * The identity of the window this view should be attached to. */ target: Identity; /** * Configures how new content (e,g, from `window.open` or a link) is opened. */ contentCreation: ContentCreationOptions; /** * Custom headers for requests sent by the view. */ customRequestHeaders: CustomRequestHeaders[]; /** * Initial bounds given relative to the window. */ bounds: Bounds; permissions: Partial; /** * String tag that attempts to group like-tagged renderers together. Will only be used if pages are on the same origin. */ processAffinity: string; /** * Defines the hotkeys that will be emitted as a `hotkey` event on the view. For usage example see [example]{@tutorial hotkeys}. * Within Platform, OpenFin also implements a set of pre-defined actions called * [keyboard commands]{@link https://developers.openfin.co/docs/platform-api#section-5-3-using-keyboard-commands} * that can be assigned to a specific hotkey in the platform manifest. */ hotkeys: Hotkey[]; /** * Scripts that run before page load. When omitted, inherits from the parent application. */ preloadScripts: PreloadScript[]; /** * **Platforms Only.** Url to a manifest that contains View Options. Properties other than manifestUrl can still be used * but the properties in the manifest will take precedence if there is any collision. */ manifestUrl: string; zoomLevel: number; experimental: any; fdc3InteropApi?: string; enableBeforeUnload: boolean; /** * Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache. */ accelerator?: Partial; /** * Autoplay policy to apply to content in the window, can be * `no-user-gesture-required`, `user-gesture-required`, * `document-user-activation-required`. Defaults to `no-user-gesture-required`. */ autoplayPolicy: AutoplayPolicyOptions; }; export type ViewState = ViewCreationOptions & { backgroundThrottling: boolean; componentName: 'view'; initialUrl: string; minWidth?: number; }; export type Certificate = { data: string; fingerprint: string; issuer: CertificatePrincipal; issuerCert: Certificate; issuerName: string; serialNumber: string; subject: CertificatePrincipal; subjectName: string; validExpiry: number; validStart: number; }; type CertificatePrincipal = { commonName: string; country: string; locality: string; organizations: string[]; organizationUnits: string[]; state: string; }; export type HostContextChangedPayload = { /** * The new context object */ context: any; /** * The reason for the update. */ reason: HostContextChangedReasons; }; export type ApplySnapshotOptions = { /** * @defaultValue false * * When true, applySnapshot will close existing windows, * replacing current Platform state with the given snapshot. */ closeExistingWindows?: boolean; /** * @defaultValue false * * When true, applySnapshot will close existing includeInSnapshots: true windows, * replacing current Platform state with the given snapshot. */ closeSnapshotWindows?: boolean; /** * @defaultValue false * * When true, applySnapshot will not check whether any windows in a * snapshot are off-screen. By default, such windows will be repositioned to be on-screen, * as defined by {@link PlatformProvider#positionOutOfBoundsWindows PlatformProvider.positionOutOfBoundsWindows}. */ skipOutOfBoundsCheck?: boolean; }; /** * Payload sent to Platform Provider when {@link Platform#applySnapshot Platform.applySnapshot} is called. */ export type ApplySnapshotPayload = { /** * TThe snapshot to be applied. */ snapshot: Snapshot; /** * Options to customize snapshot application. */ options?: ApplySnapshotOptions; }; export type AddViewToStackOptions = { /** * Optional index within the stack to insert the view. Defaults to 0 */ index?: number; }; export type CreateViewTarget = Identity & { /** * If specified, view creation will not attach to a window and caller must * insert the view into the layout explicitly */ location?: { id: string; index?: number; }; }; export type CreateViewPayload = { /** * Options for the view to be added. */ opts: Partial; /** * Window the view will be added to. If no target is provided, a new window will be created. */ target?: CreateViewTarget; targetView?: Identity; }; export type ReplaceViewPayload = { opts: { viewToReplace: Identity; newView: Partial; }; target: Identity; }; export type CloseViewPayload = { /** *View to be closed. */ view: Identity; }; export type FetchManifestPayload = { /** * The URL of the manifest to fetch. */ manifestUrl: string; }; export type ReplaceLayoutOpts = { /** * Layout config to be applied. */ layout: LayoutOptions; }; export type ReplaceLayoutPayload = { /** * Object containing the layout to be applied. */ opts: ReplaceLayoutOpts; /** * Identity of the window whose layout will be replace. */ target: Identity; }; export type SetWindowContextPayload = { /** * The requested context update. */ context: any; /** * Entity type of the target of the context update ('view' or 'window'). */ entityType: EntityType; /** * Identity of the entity targeted by the call to {@link Platform#setWindowContext Platform.setWindowContext}. */ target: Identity; }; export type LaunchIntoPlatformPayload = { manifest: any; }; export type GetWindowContextPayload = { /** * Entity type of the target of the context update ('view' or 'window'). */ entityType: EntityType; /** * Identity of the entity targeted by the call to {@link Platform#setWindowContext Platform.setWindowContext}. */ target: Identity; }; export type ApplicationPermissions = { setFileDownloadLocation: boolean; getFileDownloadLocation: boolean; }; export type LaunchExternalProcessRule = { behavior: 'allow' | 'block'; match: string[]; }; export type SystemPermissions = { getAllExternalWindows: boolean; launchExternalProcess: boolean | { enabled: boolean; assets?: { enabled: boolean; srcRules?: LaunchExternalProcessRule[]; }; downloads?: { enabled: boolean; }; executables?: { enabled: boolean; pathRules?: LaunchExternalProcessRule[]; }; }; readRegistryValue: boolean | { enabled: boolean; registryKeys: string[]; }; terminateExternalProcess: boolean; openUrlWithBrowser: { enabled: boolean; protocols: string[]; }; }; export type WebPermission = 'audio' | 'video' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' | 'clipboard-read' | 'clipboard-sanitized-write'; export type Permissions = { Application?: Partial; System?: Partial; webAPIs?: WebPermission[]; }; export type PlatformWindowCreationOptions = Partial & { updateStateIfExists?: boolean; reason?: WindowCreationReason; }; /** * Window options apply to all platform windows. * Any {@link Window~options Window option} is also a valid Default Window option * used by default in any window that is created in the current platform's scope. * Individual window options will override these defaults. */ export type PlatformWindowOptions = WindowCreationOptions & { /** * Specify a path of a custom CSS file to be injected to all of the platform's windows. * _note_: this option is only applied to windows that use the Default OpenFin Window. * Windows with a specified url (Custom Windows) will not be affected by this option. */ stylesheetUrl: string; }; export type PlatformViewCreationOptions = Partial; /** * Strategy to assign views to process affinity by domain. * * `same`: views in the same domain will have the same process affinity. * `different`: views in the same domain will have different process affinities. */ export type ProcessAffinityStrategy = 'same' | 'different'; /** * The options object required by {@link Platform#start Platform.start} * Any {@link ApplicationOptions Application option} is also a valid platform option */ export type PlatformOptions = ApplicationCreationOptions & { /** * Default window options apply to all platform windows. */ defaultWindowOptions?: Partial; /** * Default view options apply to all platform views. */ defaultViewOptions?: Partial; disableDefaultCommands?: boolean; /** * Strategy to assign views to process affinity by domain. */ viewProcessAffinityStrategy?: ProcessAffinityStrategy; providerUrl?: string; permissions?: Partial; }; export type Manifest = { appAssets?: { alias: string; args?: string; src: string; target?: string; version: string; }[]; assetsUrl?: string; devtools_port?: number; dialogSettings?: { bgColor?: number; logo?: string; progressBarBgColor?: number; progressBarBorderColor?: number; progressBarFillColor?: number; textColor?: number; }; licenseKey: string; offlineAccess?: boolean; platform?: PlatformOptions; proxy?: { proxyAddress: string; proxyPort: number; type: string; }; runtime: { arguments?: string; fallbackVersion?: string; forceLatest?: boolean; futureVersion?: string; version: string; }; services?: string[]; shortcut?: { 'company': string; 'description'?: string; 'force'?: boolean; 'icon': string; 'name': string; 'startMenuRootFolder'?: string; 'target'?: ('desktop' | 'start-menu' | 'automatic-start-up')[]; 'uninstall-shortcut'?: boolean; }; snapshot?: Snapshot; splashScreenImage?: string; startup_app: WindowOptions; supportInformation?: { company: string; email: string; product: string; forwardErrorReports?: boolean; enableErrorReporting?: boolean; }; interopBrokerConfiguration: InteropBrokerOptions; }; export type LayoutContent = Array; /** * Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying * to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our * {@link https://openfin.github.io/golden-prototype/config-gen Layout Config Generation Tool }.. */ export type LayoutItemConfig = { /** * The type of the item. Possible values are 'row', 'column', 'stack', and 'component'. */ type: string; /** * Array of configurations for items that will be created as children of this item. */ content?: LayoutContent; width?: number; height?: number; id?: string | string[]; isClosable?: boolean; title?: string; }; export interface LayoutRow extends LayoutItemConfig { type: 'row'; } export interface LayoutColumn extends LayoutItemConfig { type: 'column'; } export interface LayoutComponent extends LayoutItemConfig { componentName: 'view'; componentState?: Partial; } export type LayoutOptions = { /** * Represents a potential ways to customize behavior of your Layout */ settings?: { /** * @defaultValue false * * Whether the popout button will only act on the entire stack, * as opposed to only the active tab. */ popoutWholeStack?: boolean; /** * @defaultValue false * * Limits the area to which tabs can be dragged. * If true, stack headers are the only areas where tabs can be dropped. */ constrainDragToContainer?: boolean; /** * @defaultValue false * * Whether to show the popout button on stack header. * The button will create a new window with current tab as its content. * In case `popoutWholeStack` is set to true, all tabs in the stack will be in the new window. */ showPopoutIcon?: boolean; /** * @defaultValue false * * Whether to show the maximize button on stack header. * The button will maximize the current tab to fill the entire window. */ showMaximiseIcon?: boolean; /** * @defaultValue false * * Whether to show the close button on stack header * (not to be confused with close button on every tab). */ showCloseIcon?: boolean; constrainDragToHeaders?: boolean; /** * @defaultValue true * * Turns tab headers on or off. * If false, the layout will be displayed with splitters only. */ hasHeaders?: boolean; /** * @defaultValue true * * If true, the user can re-arrange the layout by * dragging items by their tabs to the desired location. */ reorderEnabled?: boolean; /** * @defaultValue false * * If true, tabs can't be dragged out of the window. */ preventDragOut?: boolean; /** * @defaultValue=false * * If true, tabs can't be dragged into the window. */ preventDragIn?: boolean; }; content?: LayoutContent; dimensions?: { borderWidth?: number; minItemHeight?: number; minItemWidth?: number; headerHeight?: number; }; }; export type OverrideCallback = (arg: Constructor) => U | Promise; export type Constructor = new () => T; export type HostContextChangedReasons = 'updated' | 'reparented'; export type WindowCreationReason = 'tearout' | 'create-view-without-target' | 'api-call' | 'app-creation' | 'restore' | 'apply-snapshot'; export type InitPlatformOptions = { overrideCallback?: OverrideCallback; /** * A callback function that can be used to extend or replace default Provider behavior. */ interopOverride?: OverrideCallback; }; export type ProcessDetails = { /** * The percentage of total CPU usage. */ cpuUsage: number; /** * The current nonpaged pool usage in bytes. */ nonPagedPoolUsage: number; pageFaultCount: number; /** * The current paged pool usage in bytes. */ pagedPoolUsage: number; /** * The total amount of memory in bytes that the memory manager has committed */ pagefileUsage: number; /** * The peak nonpaged pool usage in bytes. */ peakNonPagedPoolUsage: number; /** * The peak paged pool usage in bytes. */ peakPagedPoolUsage: number; /** * The peak value in bytes of pagefileUsage during the lifetime of this process. */ peakPagefileUsage: number; /** * The peak working set size in bytes. */ peakWorkingSetSize: number; /** * The current working set size (both shared and private data) in bytes. */ workingSetSize: number; privateSetSize: number; /** * The native process identifier. */ pid: number; }; export type FrameProcessDetails = ProcessDetails & { /** * Current URL associated with the process. */ url: string; /** * Type for the frame. */ entityType: string; }; export type EntityProcessDetails = FrameProcessDetails & { name: string; uuid: string; iframes: FrameProcessDetails[]; }; export type AppProcessInfo = { /** * The uuid of the application. */ uuid: string; /** * Process info for each window and view for the application. */ entities: EntityProcessDetails[]; }; export type NonAppProcessDetails = ProcessDetails & { name: string; }; export type SystemProcessInfo = { apps: AppProcessInfo[]; browserProcess: NonAppProcessDetails; nonApps: NonAppProcessDetails[]; }; export type ClearCacheOption = { /** * html5 application cache */ appcache?: boolean; /** * browser data cache for html files and images */ cache?: boolean; /** * browser cookies */ cookies?: boolean; /** * browser data that can be used across sessions */ localStorage?: boolean; }; export type CookieInfo = { name: string; domain: string; path: string; }; export type CookieOption = { name: string; }; export type CrashReporterOptions = { /** * In diagnostics mode the crash reporter will send diagnostic logs to * the OpenFin reporting service on runtime shutdown */ diagnosticsMode: boolean; }; export type CrashReporterState = CrashReporterOptions & { /** * Whether the crash reporter is running */ isRunning: boolean; diagnosticMode: boolean; }; export type Time = { /** * The number of milliseconds the CPU has spent in user mode. */ user: number; /** * The number of milliseconds the CPU has spent in nice mode. */ nice: number; /** * The number of milliseconds the CPU has spent in sys mode. */ sys: number; /** * The number of milliseconds the CPU has spent in idle mode. */ idle: number; /** * The number of milliseconds the CPU has spent in irq mode. */ irq: number; }; export type CpuInfo = { /** * The model of the cpu */ model: string; /** * The CPU clock speed in MHz */ speed: number; /** * The numbers of milliseconds the CPU has spent in different modes. */ times: Time; }; export type GpuInfo = { name: string; }; export type HostSpecs = { /** * True if Aero Glass theme is supported on Windows platforms */ aeroGlassEnabled?: boolean; /** * "x86" for 32-bit or "x86_64" for 64-bit */ arch: string; /** * The same payload as Node's os.cpus() */ cpus: CpuInfo[]; /** * The graphics card name */ gpu: GpuInfo; /** * The same payload as Node's os.totalmem() */ memory: number; /** * The OS name and version/edition */ name: string; /** * True if screensaver is running. Supported on Windows only. */ screenSaver?: boolean; }; export type PrinterInfo = { name: string; description: string; status: number; isDefault: boolean; }; /** * DPI (dots per inch) configuration for printing. */ export type Dpi = { /** * DPI (dots per inch) in the horizontal direction. */ horizontal?: number; /** * DPI (dots per inch) in the vertical direction. */ vertical?: number; }; /** * Margins configuration for printing. */ export type Margins = { marginType?: 'default' | 'none' | 'printableArea' | 'custom'; /** * The top margin of the printed webpage, in pixels. */ top?: number; /** * The bottom margin of the printed webpage, in pixels. */ bottom?: number; /** * The left margin of the printed webpage, in pixels. */ left?: number; /** * The right margin of the printed webpage, in pixels. */ right?: number; }; /** * Options for printing a webpage in OpenFin. */ export type PrintOptions = { content?: 'self'; /** * Disables prompting the user for print settings. */ silent?: boolean; /** * Includes the webpage background color and image when printing. */ printBackground?: boolean; /** * Name of the printer device to use. */ deviceName?: string; /** * Prints in full color (greyscale otherwise). */ color?: boolean; /** * Margins for printed webpage. */ margins?: Margins; /** * Prints in landscape mode (portrait otherwise). */ landscape?: boolean; /** * Scale factor of the printer webpage. */ scaleFactor?: number; /** * Number of webpage pages to print per printer sheet. */ pagesPerSheet?: number; /** * Collates the webpage before printing. */ collate?: boolean; /** * Number of copies to be printed. */ copies?: number; /** * Page range to print. */ pageRanges?: Array>; /** * Duplex mode of the printed webpage. */ duplexMode?: 'simplex' | 'shortEdge' | 'longEdge'; /** * Dots per inch of the printed webpage. */ dpi?: Dpi; }; export type ScreenshotPrintOptions = { content: 'screenshot'; }; export type WindowViewsPrintOptions = { content: 'views'; includeSelf?: boolean; }; export type WindowPrintOptions = PrintOptions | ScreenshotPrintOptions | WindowViewsPrintOptions; /** * A request to write data to the clipboard. */ export type WriteRequestType = { /** * Data to write to the clipboard. */ data: string; /** * The type of clipboard to write to. */ type?: string; }; export type WriteAnyRequestType = { data: { text?: string; html?: string; rtf?: string; }; type?: string; }; export type SubscriptionOptions = { /** * The event timestamp. */ timestamp?: number; }; export type SharedWorkerInfo = { id: string; url: string; }; export type ServiceIdentifier = { /** * The name of the service. */ name: string; }; export type ServiceConfiguration = { config: object; /** * The name of the service. */ name: string; }; export type RVMInfo = { /** * The name of action: "get-rvm-info". */ 'action': string; /** * The app log directory. */ 'appLogDirectory': string; /** * The path of OpenfinRVM.exe. */ 'path': string; /** * The start time of RVM. */ 'start-time': string; /** * The version of RVM. */ 'version': string; /** * The path to the working directory. */ 'working-dir': string; }; export type AppVersionProgress = { manifest: string | null; srcManifest: string; }; export type AppVersionError = { error: string; srcManifest: string; }; export type AppVersionRuntimeInfo = { version: string | null; exists: boolean | null; writeAccess: boolean | null; reachable: boolean | null; healthCheck: boolean | null; error: string | null; }; export type LaunchEmitter = TypedEventEmitter; export type RvmLaunchOptions = { /** * True if no UI when launching */ noUi?: boolean; userAppConfigArgs?: object; /** * Timeout in seconds until RVM launch request expires. */ timeToLive?: number; /** * Called whenever app version resolver events occur. */ subscribe?: (launch: LaunchEmitter) => void; }; export type ShortCutConfig = { /** * True if application has a shortcut on the desktop. */ desktop?: boolean; /** * True if application has shortcut in the start menu. */ startMenu?: boolean; /** * True if application will be launched on system startup. */ systemStartup?: boolean; }; export type TerminateExternalRequestType = { /** * The uuid of the running application. */ uuid: string; /** * Time out period before the running application terminates. */ timeout: number; /** * Value to terminate the running application. */ killTree: boolean; }; export type TrayInfo = { /** * The bound of tray icon in virtual screen pixels. */ bounds: Rectangle; /** * Please see fin.System.getMonitorInfo for more information. */ monitorInfo: MonitorInfo; /** * Copy of `bounds.x`. */ x: number; /** * Copy of `bounds.y`. */ y: number; }; export type Transition = { opacity?: Opacity; position?: Position; size?: Size; }; export type Size = TransitionBase & { /** * Optional if height is present. Defaults to the window's current width. */ width: number; /** * Optional if width is present. Defaults to the window's current height. */ height: number; }; export type Opacity = TransitionBase & { /** * The opacity from 0.0 (transparent) to 1.0 (normal). */ opacity: number; }; /** * Base configuration options needed for all types of transitions. */ export type TransitionBase = { /** * The total time in milliseconds this transition should take. */ duration: number; /** * @defaultValue false * * Treats 'opacity' as absolute or as a delta. Defaults to false. */ relative?: boolean; }; export type Position = TransitionBase & { /** * Defaults to the window's current left position in virtual screen coordinates. */ left: number; /** * Defaults to the window's current top position in virtual screen coordinates. */ top: number; }; export type AnchorType = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; /** * Configuration for transition between windows. */ export type TransitionOptions = { /** * Interrupts the current animation (otherwise, the animation is added to the end of the queue). */ interrupt: boolean; /** * @defaultValue false * * Treats 'opacity' as absolute or as a delta. Defaults to false. */ relative?: boolean; tween?: tween; }; export type tween = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-in-quad' | 'ease-out-quad' | 'ease-in-out-quad' | 'ease-in-cubic' | 'ease-out-cubic' | 'ease-in-out-cubic' | 'ease-out-bounce' | 'ease-in-back' | 'ease-out-back' | 'ease-in-out-back' | 'ease-in-elastic' | 'ease-out-elastic' | 'ease-in-out-elastic'; /** * Configuration for find-in-page requests. */ export type FindInPageOptions = { /** * @defaultValue true * * Searches in the forward direction (backward otherwise) */ forward?: boolean; /** * @defaultValue false * * Begins a new text-finding session; should be true for first request only, and false on subsequent requests. */ findNext?: boolean; /** * @defaultValue false * * Enables case-sensitive searching. */ matchCase?: boolean; /** * @defaultValue false * * Only searches from the start of words. */ wordStart?: boolean; /** * @defaultValue false * * When combined with wordStart, accepts a match in the middle of a word if the match begins with an uppercase letter followed by a
* lowercase or non-letter. Accepts several other intra-word matches. */ medialCapitalAsWordStart?: boolean; }; export type FindInPageResult = { requestId: number; /** * Position of the active match. */ activeMatchOrdinal: number; /** * Number of Matches. */ matches: number; /** * Coordinates of first match region. */ selectionArea: Rectangle; finalUpdate: boolean; }; export type FrameInfo = { name: string; uuid: string; url: string; entityType: EntityType; parent: Identity; }; export type ExternalApplicationInfo = { parent: Identity; }; export type ExternalConnection = { /** * The token to broker an external connection. */ token: string; /** * Unique identifier for the connection. */ uuid: string; }; export type ExternalProcessRequestType = { /** * The file path to where the running application resides. */ path?: string; alias?: string; /** * The arguments to pass to the application. */ arguments?: string; listener?: LaunchExternalProcessListener; lifetime?: string; certificate?: CertificationInfo; uuid?: string; /** * Initial window state after launching: 'normal' (default), 'minimized', 'maximized'. */ initialWindowState?: string; /** * Current working directory. */ cwd?: string; }; export type CertificationInfo = { serial?: string; subject?: string; publickey?: string; thumbprint?: string; trusted?: boolean; }; export type ExitCode = { topic: string; uuid: string; exitCode: number; }; export type LaunchExternalProcessListener = { (code: ExitCode): void; }; export type ExternalProcessInfo = { pid: number; listener?: LaunchExternalProcessListener; }; export type AppAssetInfo = { /** * The URL to a zip file containing the package files (executables, dlls, etc…) */ src: string; /** * The name of the asset */ alias: string; /** * The version of the package */ version: string; /** * Specify default executable to launch. This option can be overridden in launchExternalProcess */ target?: string; /** * The default command line arguments for the aforementioned target. */ args?: string; /** * When set to true, the app will fail to load if the asset cannot be downloaded. * When set to false, the app will continue to load if the asset cannot be downloaded. (Default: true) */ mandatory?: boolean; }; /** * The options object required by the downloadRuntime function. */ export type RuntimeDownloadOptions = { /** * The given version to download. */ version: string; }; export type AppAssetRequest = { alias: string; }; export type RuntimeDownloadProgress = { /** * @property { string } alias The name of the asset */ downloadedBytes: number; totalBytes: number; }; export type CertifiedAppInfo = { isRunning: boolean; isOptedIntoCertfiedApp?: boolean; isCertified?: boolean; isSSLCertified?: boolean; isPresentInAppDirectory?: boolean; }; export type JumpListCategory = { /** * The display title for the category. * * If omitted, items in this category will be placed into the standard 'Tasks' category. * There can be only one such category, and it will always be displayed at the bottom of the JumpList. */ name?: string; /** * The set of tasks that will populate the JumpList. */ items: Array; }; export type JumpListItem = JumpListTask | JumpListSeparator; export type JumpListTask = { type: 'task'; /** * The text to be displayed for the JumpList Item. */ title: string; /** * Tooltip description of the task (displayed in a tooltip). */ description: string; /** * @property Deep link to a manifest, i.e: fins://path.to/manifest.json?$$param1=value1. * See {@link https://developers.openfin.co/docs/deep-linking deep-linking} for more information. */ deepLink: string; /** * The absolute path to an icon to be displayed for the item, which can be an arbitrary resource file that contains an icon (e.g. .ico, .exe, .dll). */ iconPath?: string; /** * The index of the icon in the resource file. * * If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. * If a resource file contains only one icon, this property should be set to zero. */ iconIndex?: number; }; export type JumpListSeparator = { type: 'separator'; }; export type ApplicationInfo = { initialOptions: ApplicationCreationOptions; launchMode: string; manifest: Manifest & { [key: string]: any; }; manifestUrl: string; parentUuid?: string; runtime: { version: string; }; }; export type ManifestInfo = { /** * The uuid of the application. */ uuid: string; /** * The runtime manifest URL. */ manifestUrl: string; }; export type ClickedMenuResult = { result: 'clicked'; data: any; }; export type ClosedMenuResult = { result: 'closed'; }; export type MenuResult = ClickedMenuResult | ClosedMenuResult; export type ShowPopupMenuOptions = { template: MenuItemTemplate[]; x?: number; y?: number; }; export type MenuItemTemplate = { /** * Can be `normal`, `separator`, `submenu`, or `checkbox`. * Defaults to 'normal' unless a 'submenu' key exists */ type?: 'normal' | 'separator' | 'submenu' | 'checkbox'; role?: 'cut' | 'copy' | 'paste' | 'toggleDevTools' | 'reload'; label?: string; /** * If false, the menu item will be greyed out and unclickable. */ enabled?: boolean; /** * If false, the menu item will be entirely hidden. */ visible?: boolean; /** * Should only be specified for `checkbox` type menu items. */ checked?: boolean; /** * Should be specified for `submenu` type menu items. If `submenu` is specified, * the `type: 'submenu'` can be omitted. */ submenu?: MenuItemTemplate[]; /** * Data to be returned if the user selects the element. Must be serializable */ data?: any; /** * Image Data URI with image dimensions inferred from the encoded string */ icon?: string; }; export type NativeWindowIntegrationProviderAuthorization = { authorizedUuid: string; }; export type RuntimeInfo = { /** * The runtime build architecture. */ architecture: string; /** * The runtime manifest URL. */ manifestUrl: string; /** * The runtime websocket port. */ port: number; /** * The runtime security realm. */ securityRealm?: string; /** * The runtime version. */ version: string; /** * the command line argument used to start the Runtime. */ args: object; chromeVersion: string; electronVersion: string; devtoolsPort?: number; }; export type DefaultDomainSettings = { rules: DefaultDomainSettingsRule[]; }; export type DefaultDomainSettingsRule = { match: string[]; options: { downloadSettings: FileDownloadSettings; }; }; export type FileDownloadBehaviorNames = 'prompt' | 'no-prompt' | 'block'; export type FileDownloadSettings = { rules: DownloadRule[]; }; export type DownloadRule = { behavior: FileDownloadBehaviorNames; match: string[]; }; export type ContextHandler = (context: Context) => void; /** * Combination of an action and a context that is passed to an application for resolution. */ export type Intent = { /** * Name of the intent. */ name: string; /** * Data associated with the intent. */ context: Context; metadata?: MetadataType; }; export type IntentMetadata = { target?: TargetType; resultType?: string; intentResolutionResultId?: string; }; export type IntentHandler = (intent: Intent) => void; export type ContentCreationBehaviorNames = 'window' | 'view' | 'block' | 'browser'; export type MatchPattern = string; /** * A rule for creating content in OpenFin; maps a content type to the way in which * newly-opened content of that type will be handled. * * @property { string } behavior 'view' | 'window' | 'browser' | 'block' * @property { string[] } match List of [match patterns](https://developer.chrome.com/extensions/match_patterns). * @property { object } options Window creation options or View creation options. */ export type ContentCreationRule = { /** * Behavior to use when opening matched content. */ behavior: T; /** * List of [match patterns](https://developer.chrome.com/extensions/match_patterns) that indicate the specified * behavior should be used */ match: MatchPattern[]; /** * Options for newly-created view or window (if applicable). */ options?: T extends 'window' ? Partial : T extends 'view' ? Partial : never; }; /** * Configures how new content (e,g, from `window.open` or a link) is opened. */ export type ContentCreationOptions = { /** * List of rules for creation of new content. */ rules: ContentCreationRule[]; }; export type SnapshotProvider = { getSnapshot: () => Promise; applySnapshot: (snapshot: T) => Promise; }; export type QueryPermissionResult = { /** * The full name of a secured API. */ permission: string; state: PermissionState; /** * True if permission is granted. */ granted: boolean; /** * The value of permission. */ rawValue?: unknown; }; export type SessionContextGroup = { id: string; setContext: (context: Context) => Promise; getCurrentContext: (type?: string) => Promise; addContextHandler: (handler: ContextHandler, contextType?: string) => Promise<{ unsubscribe: () => void; }>; }; export type { MessagingProtocols }; /** * Channel provider creation options. */ export type ChannelCreateOptions = { /** * EXPERIMENTAL: Messaging protocols supported by the channel provider. */ protocols?: MessagingProtocols[]; }; /** * Options provided on a client connection to a channel. * */ export type ChannelConnectOptions = ChannelCreateOptions & { /** * @defaultValue true * * If true will wait for ChannelProvider to connect. If false will fail if ChannelProvider is not found. */ wait?: boolean; /** * Payload to pass to ChannelProvider onConnection action. */ payload?: any; }; export type ContextForIntent = Context & { metadata?: MetadataType; }; export type InfoForIntentOptions = { /** * Name of the intent to get info for. */ name: string; context?: Context; metadata?: MetadataType; }; export type FindIntentsByContextOptions = { context: Context; metadata?: MetadataType; }; /** * Identity of a channel provider. */ export type ProviderIdentity = Identity & { /** * Identifier of the channel. */ channelId: string; /** * Channel provider name. */ channelName: string; }; export type RegisterUsageData = { data: unknown; type: string; }; export interface ViewsPreventingUnloadPayload { /** * Specifies if the Window should close. */ windowShouldClose: boolean; /** * Identity of the Window. */ windowId: Identity; /** * Identities of the Views that are preventing an unload */ viewsPreventingUnload: Identity[]; /** * Identities of the Views that are not preventing an unload */ viewsNotPreventingUnload: Identity[]; /** * Source of the close action. */ closeType: 'view' | 'window'; } export interface BeforeUnloadUserDecision { /** * Specifies if the Window should close. */ windowShouldClose: boolean; /** * Array of views that will close. */ viewsToClose: Identity[]; } export interface ViewStatuses { /** * Identities of the Views that are preventing an unload. */ viewsPreventingUnload: Identity[]; /** * Identities of the Views that are not preventing an unload. */ viewsNotPreventingUnload: Identity[]; } export interface CloseWindowPayload { /** * * Identity of the Window */ windowId: Identity; options: { /** * @defaultValue false * * When set to true skips any before handler set on views that are part of the window */ skipBeforeUnload?: boolean; }; } export type ProxyInfo = { config: ProxyConfig; system: ProxySystemInfo; }; export type ProxyConfig = { /** * The configured proxy address. */ proxyAddress: string; /** * The configured proxy port. */ proxyPort: number; type: string; }; export type ProxySystemInfo = { /** * The auto configuration url. */ autoConfigUrl: string; /** * The proxy bypass info. */ bypass: string; /** * Value to check if a proxy is enabled. */ enabled: boolean; /** * The proxy info. */ proxy: string; }; export type ChannelAction = (payload: unknown, id: ProviderIdentity | ClientIdentity) => unknown; export type ChannelMiddleware = (topic: string, payload: unknown, senderIdentity: ProviderIdentity | ClientIdentity) => Promise | unknown; export type ErrorMiddleware = (topic: string, error: Error, id: ProviderIdentity | ClientIdentity) => unknown; export type ApplicationState = { /** * True when the application is a Platform controller */ isPlatform: boolean; /** * True when the application is running */ isRunning: boolean; /** * uuid of the application */ uuid: string; /** * uuid of the application that launches this application */ parentUuid?: string; }; export type InstalledApps = { [key: string]: InstallationInfo; }; export type InstallationInfo = { cachedManifest: any; }; export type GetLogRequestType = { /** * The name of the running application */ name: string; /** * The file length of the log file */ endFile?: string; /** * The size limit of the log file. */ sizeLimit?: number; }; export type LogInfo = { /** * The filename of the log */ name: string; /** * The size of the log in bytes */ size: number; /** * The unix time at which the log was created "Thu Jan 08 2015 14:40:30 GMT-0500 (Eastern Standard Time)" */ date: string; }; export type SendApplicationLogResponse = { logId: string; }; /** * Describes the minimum level (inclusive) above which logs will be written. * * `verbose`: all logs written * `info`: info and above * `warning` warning and above * `error` and above * `fatal`: fatal only, indicates a crash is imminent */ export type LogLevel = 'verbose' | 'info' | 'warning' | 'error' | 'fatal'; export type PermissionState = 'granted' | 'denied' | 'unavailable'; export type RegistryInfo = { data: any; rootKey: string; subkey: string; type: string; value: string; }; export type ApplicationType = { type: 'application' | 'external-app'; uuid: string; }; export type WindowInfo = { canNavigateBack: boolean; canNavigateForward: boolean; preloadScripts: Array; title: string; url: string; }; export type ApplicationWindowInfo = { childWindows: Array; mainWindow: WindowDetail; /** * @property { string } uuid The uuid of the application */ uuid: string; }; export type WindowDetail = { /** * The bottom-most coordinate of the window. */ bottom: number; /** * The height of the window. */ height: number; isShowing: boolean; /** * The left-most coordinate of the window. */ left: number; /** * The name of the window. */ name: string; /** * The right-most coordinate of the window */ right: number; state: string; /** * The top-most coordinate of the window. */ top: number; /** * The width of the window. */ width: number; }; export type LayoutPresetType = 'columns' | 'grid' | 'rows' | 'tabs'; export type InitLayoutOptions = { /** * The id attribute of the container where the window's Layout should be initialized. If not provided * then an element with id `layout-container` is used. We recommend using a div element. */ containerId?: string; }; export type PresetLayoutOptions = { /** * Which preset layout arrangement to use. * The preset options are `columns`, `grid`, `rows`, and `tabs`. */ presetType: LayoutPresetType; }; export type ResultBehavior = 'close' | 'hide' | 'none'; export type PopupBaseBehavior = 'close' | 'hide'; export type PopupResultBehavior = 'none' | PopupBaseBehavior; export type PopupBlurBehavior = 'modal' | PopupBaseBehavior; export type Optional = Pick, K> & Omit; export interface PopupOptions { initialOptions?: Optional; additionalOptions?: UpdatableWindowOptions; name?: string; url?: string; height?: number; width?: number; x?: number; y?: number; blurBehavior?: PopupBlurBehavior; resultDispatchBehavior?: PopupResultBehavior; hideOnClose?: boolean; focus?: boolean; onPopupReady?: (popupWindow: _Window) => any; onPopupResult?: (payload: PopupResult) => any; } export type PopupInteraction = 'clicked' | 'dismissed'; export interface PopupResult { identity: { name: string; uuid: string; }; result: PopupInteraction; data?: T; lastDispatchResult?: PopupResult; } export type SystemShutdownHandler = (shutdownEvent: { proceed: () => void; }) => void; export type AppVersionProgressEvent = { type: 'app-version-progress'; } & AppVersionProgress; export type AppVersionErrorEvent = { type: 'app-version-error'; } & AppVersionError; export type AppVersionCompleteEvent = { type: 'app-version-complete'; } & AppVersionProgress; export type AppVersionRuntimeStatusEvent = { type: 'runtime-status'; } & AppVersionRuntimeInfo; import type * as BaseEvents from './api/events/base'; import type * as WebContentsEvents from './api/events/webcontents'; import type * as SystemEvents from './api/events/system'; import type * as ApplicationEvents from './api/events/application'; import type * as WindowEvents from './api/events/window'; import type * as ViewEvents from './api/events/view'; import type * as GlobalHotkeyEvents from './api/events/globalHotkey'; import type * as FrameEvents from './api/events/frame'; import type * as PlatformEvents from './api/events/platform'; import type * as ExternalApplicationEvents from './api/events/externalApplication'; export type { BaseEvents, WebContentsEvents, SystemEvents, ApplicationEvents, WindowEvents, ViewEvents, GlobalHotkeyEvents, FrameEvents, PlatformEvents, ExternalApplicationEvents }; export type BaseEvent = BaseEvents.BaseEvent; export type WebContentsEvent = WebContentsEvents.WebContentsEvent; export type SystemEvent = SystemEvents.SystemEvent; export type ApplicationEvent = ApplicationEvents.ApplicationEvent; export type WindowEvent = WindowEvents.WindowEvent; export type ViewEvent = ViewEvents.ViewEvent; export type GlobalHotkeyEvent = GlobalHotkeyEvents.GlobalHotkeyEvent; export type FrameEvent = FrameEvents.FrameEvent; export type PlatformEvent = PlatformEvents.PlatformEvent; export type ExternalApplicationEvent = ExternalApplicationEvents.ExternalApplicationEvent; /** * Configure the context menu when right-clicking on a window. */ export type ContextMenuOptions = { /** * Context menu items to display on right-click. */ template?: Array; /** * Displays the context menu on right click. */ enabled?: boolean; }; /** * Context menu item with an implementation provided by OpenFin. */ export type PrebuiltContextMenuItem = 'separator' | 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'spellCheck' | 'inspect' | 'reload' | 'navigateForward' | 'navigateBack' | 'print'; export type InteropBrokerDisconnectionEvent = { type: string; topic: string; brokerName: string; }; export type InteropClientOnDisconnectionListener = (InteropBrokerDisconnectionEvent: InteropBrokerDisconnectionEvent) => any; export interface InteropActionLoggingOption { enabled: boolean; } export type InteropLoggingActions = 'beforeAction' | 'afterAction'; export type InteropLoggingOptions = Record; export type { Me } from './api/me'; /** * Configuration for page capture. */ export interface CapturePageOptions { /** * The area of the window to be captured. */ area?: Rectangle; /** * @defaultValue 'png' * * The format of the captured image. Can be 'png', 'jpg', or 'bmp'. */ format?: 'bmp' | 'jpg' | 'png'; /** * @defaultValue 100 * * Quality of JPEG image. Between 0 - 100. */ quality?: number; }