import { ApplicationConfig } from "@glue42/schemas"; import { Glue42Core } from "@glue42/core"; import { Glue42Workspaces } from "@glue42/workspaces-api"; import { UnsubscribeFunction } from "callback-registry"; /** * Factory function that creates a new Glue42 instance. */ export default function Glue(config?: Glue42.Config): Promise; /** * @docname Glue * @intro * **Glue42 Enterprise** is a real-time user interface (UI) integration platform. Apps are combined at the user * interface level to provide a better user experience (UX). * UI integration makes it easier for users to access the right data and functionality at the right time and also reduce * the number of times they need to copy/paste their way between one app and another. * **Glue42 Enterprise** provides intuitive paths from one function to the next, in order to deliver business outcomes quickly and reliably. * It allows developers to connect to any (legacy, 3rd party or modern) * web or desktop app and have multiple apps interact with each other in real time. * * The Glue42 JavaScript library enables JavaScript apps to participate in **Glue42 Enterprise** and use Glue42 functionalities via a set of APIs. * * ## Referencing the Library * * ### From a JavaScript File * * Glue42 JavaScript is a library available as a single JavaScript file, which you can include in your web apps using a ` * ``` * * When deploying your app in production, it is recommended to always reference a specific minified version: * * ```html * * ``` * * **Using the Glue42 CDN** * * You can alternatively point to Glue42 JavaScript `npm` packages and files via the [Glue42 CDN](https://cdn.glue42.com/) by using URLs in the format: * * ```html * https://cdn.glue42.com/:package@:version/:file * ``` * * - Using the latest version: `https://cdn.glue42.com/desktop@latest`; * - Using a fixed version: `https://cdn.glue42.com/desktop@5.6.1` * - Using a specific file different from the one defined in the `package.json`: `https://cdn.glue42.com/browse/desktop@5.6.1/dist/web/@glue42/desktop.min.js` * - To see all available versions and files, append `/` to the URL: `https://cdn.glue42.com/desktop/` * * ### From an NPM Module * * The Glue42 JavaScript library is also available as an `npm` package, which you can include as a dependency in your project and import in your code. * The currently available packages are [`@glue42/core`](https://www.npmjs.com/package/@glue42/core) and * [`@glue42/desktop`](https://www.npmjs.com/package/@glue42/desktop). * The Core package is a subset of the Desktop package and offers basic functionalities for sharing data between apps * (Interop, Shared Contexts, Pub/Sub, Metrics), * while the Desktop package offers additional options for sharing data between apps (Channels), as well as advanced window management * functionalities (App Management, Layouts, Window Management). * * To include any of the packages as a dependency in your project, navigate to the root directory of your project and run: * * ```cmd * npm install @glue42/desktop * ``` * * Your `package.json` file now should have an entry similar to this: * * ```json * { * "dependencies": { * "@glue42/desktop": "^5.6.1" * } * } * ``` * * ## Initializing the Library * * When included, the JavaScript library will register a global factory function called `Glue()`. * It should be invoked with an *optional* configuration object to initialize the library. The factory function will resolve with the initialized `glue` API object. * * Initialization in a Glue42 Window: * * ```javascript * import Glue from "@glue42/desktop" * * // You don't need to specify any configuration. * const initializeGlue42 = async () => { * window.glue = await Glue(); * }; * * initializeGlue42().catch(console.error); * ``` * See also the [**Glue42 Enterprise** documentation](../../../../getting-started/how-to/glue42-enable-your-app/javascript/index.html) for more details. */ export declare namespace Glue42 { export import AGM = Glue42Core.AGM; export import Contexts = Glue42Core.Contexts; export import Connection = Glue42Core.Connection; export import Logger = Glue42Core.Logger; export import Metrics = Glue42Core.Metrics; export import Auth = Glue42Core.Auth; export import FeedbackInfo = Glue42Core.FeedbackInfo; export import Channels = Glue42.Channels.API; export import ChannelContext = Glue42.Channels.ChannelContext; export import Interop = Glue42Core.Interop; export import GDObject = Glue42Core.GDObject; export import GlueDesktopObject = Glue42Core.GlueDesktopObject; export import GatewayConfig = Glue42Core.GatewayConfig; export import MetricsConfig = Glue42Core.MetricsConfig; export import InprocGWSettings = Glue42Core.InprocGWSettings; export import GwTokenProvider = Glue42Core.GwTokenProvider; export import LoggerConfig = Glue42Core.LoggerConfig; /** * Optional configuration object when initializing the Glue42 library. */ export interface Config extends Glue42Core.Config { /** * Initializes or disables the App Management API. * @default "startOnly" */ appManager?: boolean | Glue42.AppManager.Mode; /** * Initializes or disables the Layouts API. * @default "slim" */ layouts?: boolean | Glue42.Layouts.Mode | Glue42.Layouts.Configuration; /** * Initializes or disables the Activities API. * @default "trackMyTypeAndInitiatedFromMe" */ activities?: boolean | Glue42.Activities.ActivitiesModes; /** * Initializes or disables the Window Management API. * @default true */ windows?: boolean; /** * Initializes or disables the Channels API. * @default false */ channels?: boolean; /** * Initializes or disables the Displays API. * @default true */ displays?: boolean; /** * Configuration for the Intents Resolver UI. */ intents?: Intents.Config; /** * A list of Glue42 factory functions that will be initialized internally to provide access to specific functionalities. */ libraries?: ((glue: Glue42.Glue, config?: Glue42.Config) => Promise)[]; /** * Determines whether Glue42 will share the initialized API object upon request via a custom web event. * @default true */ exposeGlue?: boolean; } /** * Instance of the initialized Glue42 library. */ export interface Glue extends Glue42Core.GlueCore { /** * Window Management API. */ windows: Glue42.Windows.API; /** * Activities API. */ activities: Glue42.Activities.API; /** * App Management API. */ appManager: Glue42.AppManager.API; /** * Layouts API. */ layouts: Glue42.Layouts.API; /** * Channels API. */ channels: Glue42.Channels.API; /** * Hotkeys API. * @since Glue42 3.6 */ hotkeys: Glue42.Hotkeys.API; /** * Displays API. * @since Glue42 3.9 */ displays: Glue42.Displays.API; /** * Intents API. * @since Glue42 3.9 */ intents: Glue42.Intents.API; /** * Notifications API. * @since Glue42 3.9 */ notifications: Glue42.Notifications.API; /** * Workspaces API. * @since Glue42 3.10 */ workspaces?: Glue42Workspaces.API; /** * Themes API. * @since Glue42 3.10 */ themes?: Glue42.Themes.API; /** * App Preferences API. * @since Glue42 3.12 */ prefs: Glue42.Preferences.API; /** * Cookies API. * @since Glue42 3.16 */ cookies: Glue42.Cookies.API; } /** * @intro * An Activity is a collection of windows organized in a layout and sharing a private context. Here is an example of an Activity consisting of four windows: * * ![Example Activity](../../../../images/activities/activity.gif) * * Activities are usually registered as components in the application configuration and can be instantiated either as applications from the toolbar or programmatically - on demand. * * An *Activity type* is a definition template for an Activity, consisting of a collection of *window types*, their layout and an initial *Activity context*. * * A *window type* is a definition of a window, typically configured in the application configuration settings. However, the Activities API allows for an application to dynamically define both (window types and Activity types) at runtime. * * An *Activity context* is an object containing a set of key/value pairs which hold the current state of an Activity - e.g., the currently selected `party`, `instrument`, `order`, etc. * * An *Activity instance* is an instance of an *Activity type*, just like an object is an instance of a class in class-based languages. "Activity" is often used as a synonym for Activity instance. * * The Activities API enables: * * - the definition of window types and Activity types (collection of window types, layout and an initial context); * - starting an Activity instance of a specific Activity type; * - reacting to Activity events from an Activity-aware window, such as joining and leaving an Activity; * - application state synchronization via Activity context management functions; * - intra-Activity application collaboration via Activity Interop extension functions; * * The Activities API is accessible through the `glue.activities` object. */ namespace Activities { /** @ignore */ export interface LoggerConfig { publish: string; console: string; metrics: string; } /** Activities configuration object. */ // eslint-disable-next-line @typescript-eslint/no-shadow export interface Config { /** * @ignore * Activities mode. */ mode?: boolean | ActivitiesModes; /** Types of activities to track. */ typesToTrack: string[]; /** @ignore */ logger?: LoggerConfig; } /** * Activities API mode. */ export type ActivitiesModes = "trackMyOnly" | "trackMyTypeAndInitiatedFromMe" | "trackAll" | "trackTypes"; /** * Activities API */ export interface API { /** API version string. */ version: string; /** * Returns `true` if the current window is activity aware, meaning that the window was created as * an activity participant - either a helper or an owner window. */ aware: boolean; /** Returns `true` if the current window is activity aware and is currently participating in an activity. */ inActivity: boolean; /** A lightweight, single activity oriented subset of the API which should be used by most activity applications. */ my: My; /** Extended API that provides access to all running activities and windows and the available activity and window types. */ all: ActivitiesManagement; /** * This method notifies applications when the API is ready to be used. * Note: If you are using the Glue42 library, you don't need to use this * as the Glue42 library is initialized when all included libraries are initialized. * @param callback Optional callback function to notify the application when the API is initialized. */ ready(callback?: (api: API) => void): Promise; /** Returns a list of frame colors that can be used for the activity frame. */ getAvailableFrameColors(): string[]; } /** * A lightweight, single activity oriented subset of the API which should be used * by most activity applications. */ export interface My { /** The current activity of the application. Can be `undefined` if currently not part of any activity. */ activity: Activity; /** The current activity window. Can be `undefined` if the window is not part of any activity. */ window: ActivityWindow; /** The context of the activity the application is part of. */ context: any; /** * Updates the activity context using the properties of the `context` argument. * If the old context values are `{ a: 1, b: 2, c: 3 }`, invoking `updateContext({ b: 3, c: null, d: 4 })` will result in * the following context state: `{ a: 1, b: 3, d: 4 }`. * @param context Context object with which to update the current activity context. * @param callback Optional callback function that will be executed when the context has been updated. */ updateContext(context: any, callback?: any): Promise; /** * Replaces the specified activity context. * @param context Context object with which to replace the existing activity context. * @param callback Optional callback function that will be executed when the context has been replaced. */ setContext(context: any, callback?: any): Promise; /** * Creates a new window and joins it to the activity. * @param windowType The name or the window definition of the window you want to create and add to the activity. */ createWindow(windowType: string | WindowDefinition): Promise; /** * Creates a stacked set of windows and joins them to the activity. * @param windowTypes An array of window names or definitions you want to create and add to the activity. * @param timeout Optional timeout for the operation. */ // tslint:disable-next-line:array-type createStackedWindows(windowTypes: (string | WindowDefinition)[], timeout?: number): Promise; /** * Subscribes for the event which fires when the current window joins an activity. * @param callback Handler function for the event. */ onActivityJoined(callback: (activity: Activity) => void): void; /** * Subscribes for the event which fires when the current window leaves an activity. * @param callback Handler function for the event. */ onActivityLeft(callback: (activity: Activity) => void): void; /** * Subscribes for context updates. * @param callback Handler function that receives the updated context object, a delta object, * an array of removed context properties and the activity instance as arguments. */ onContextChanged(callback: (context: object, delta: object, removed: string[], activity: Activity) => void): void; /** * @ignore * Creates a new activity by cloning the current one. * @param options Options for cloning an activity. * @param callback Handler function for the cloned activity. */ clone(options: CloneOptions, callback: (activity: Activity) => void): Promise; /** * @ignore * Attaches the current activity to another activity. * This stops the current activity. It can be restored by using the returned `AttachedActivityDescriptor` object. * @param activity Activity to which to attach the current activity. * @param tag */ attach(activity: Activity | string, tag?: object): Promise; /** Sets the frame color of the current activity. * @param color The color you want to set for activity frame color. * @param callback Callback function invoked when the activity frame color has been changed. */ setFrameColor(color: string, callback: () => void): Promise; /** Returns the frame color of the current activity. */ getFrameColor(): string; /** Subscribes for the event which fires when the activity frame color is changed. */ onFrameColorChanged(callback: () => void): void; } /** * Extended API that provides access to all running activities and windows and all * available activity and window types. */ export interface ActivitiesManagement { /** Access point to the activity types. */ activityTypes: ActivityTypesAPI; /** Access point to the window types. */ windowTypes: WindowTypesAPI; /** Access point to the running activity windows. */ windows: WindowingAPI; /** Access point to the running activity instances. */ instances: InstancesAPI; /** * @ignore * Subscribes for the event which fires when an activity is attached to another activity. * @param callback */ onAttached(callback: (activity: Activity, descriptor: AttachedActivityDescriptor) => void): void; /** * @ignore * Subscribes for the event which fires when two activities are detached. * @param callback */ onDetached(callback: (newActivity: Activity, oldActivity: Activity, descriptor: AttachedActivityDescriptor) => void): void; /** Subscribes for the event which fires when the color of the activity frame is changed. * @param callback Handler function for the event. Receives the activity and the new activity frame color as arguments. */ onActivityFrameColorChanged(callback: (activity: Activity, frameColor: string) => void): void; } /** * The Activity Types API enables you to define templates for activities. You can specify the window types the activity should contain, * the layout of the activity windows and the initial context they should share. */ export interface ActivityTypesAPI { /** Returns all known activity types or a specific activity type by name. */ get(name?: string): ActivityType[] | ActivityType; /** * Registers a new activity type. * @param activityTypeName The name of the activity type to be created. * @param ownerWindowType The type of the owner window or a `WindowDefinition` of the owner window. * @param helperWindowTypes Types of helper windows (or `WindowDefinitions` of helper windows). * @param layoutConfig Layout configuration. * @param description Description of the new activity type. * @param callback Callback function to handle the result. If not specified, the method will return a `Promise` that resolves with the created activity type. */ register(activityTypeName: string, ownerWindowType: string | WindowDefinition, helperWindowTypes?: string[] | WindowDefinition[], layoutConfig?: any, description?: string, callback?: (at: ActivityType) => void): Promise; /** * Unregisters an existing activity type. * @param type The name of the activity type to be removed. */ unregister(type: string): void; /** * Initiates a new activity of the specified type. * @param activityType The activity type to initiate. * @param context The initial context of the activity. * @param configuration Configuration with which you can override the predefined activity type configuration. * @param callback Callback function to handle the result. */ initiate(activityType: string, context?: object, configuration?: OverrideTypeDefinition | WindowDefinition[], callback?: (act: Activity) => void): Promise; /** Subscribes for `ActivityType` events. * @param handler Handler function for the event. Receives the activity type and the event name as arguments. */ subscribe(handler: (act: ActivityType, event: string) => void): void; /** Unsubscribes from `ActivityType` events. * @param handler Handler function for the event. Receives the activity type and the event name as arguments. */ unsubscribe(handler: (act: ActivityType, event: string) => void): void; } /** * The Window Types API enables you to create and handle windows by type. */ export interface WindowTypesAPI { /** Get all available window types or a specific type by name. */ get(name?: string): WindowType[] | WindowType; /** * Allows you to subscribe for window events - e.g., registering a window type. * @param handler Handler function for the event. Receives the window type and the event name as arguments. */ subscribe(handler: (act: WindowType, event: string) => void): void; /** Unsubscribes from window events. * @param handler Handler function for the event. Receives the window type and the event name as arguments. */ unsubscribe(handler: (act: WindowType, action: string) => void): void; /** * Registers a factory function for a given `WindowType`. It will be called once a window of that type is requested. * @param windowType Window type that will be constructed by the factory function. Can be a string (name of the window type) * or an object with `name` and `description` properties. * @param factoryMethod The factory function that will construct windows of the specified type. */ registerFactory(windowType: string | { name: string, description: string }, factoryMethod: (activityInfo: ActivityWindowCreateRequest) => Promise): Promise; /** * Unregisters all factory methods for a given `WindowType`. * @param windowType Window type that is constructed by the factory function. */ unregisterFactory(windowType: string): Promise; } /** Request object for creating an activity window. Passed to the factory function for creating activity windows. */ export interface ActivityWindowCreateRequest { /** ID of the activity for which the window will be created. */ activityId?: string; /** Type of the activity for which the window will be created. */ activityType?: string; /** Type of the window that will be created as an activity window. */ type: string; /** Gateway token for the window that will be created as an activity window. */ gwToken?: string; /** Configuration for the window that will be created as an activity window. */ configuration?: any; } /** * The Windowing API enables you to handle activity windows. */ export interface WindowingAPI { /** * Returns activity windows based on a filter. If no filter is supplied, all activity windows are returned. * @param filter Filter object describing which activity windows to return. */ get(filter: { id?: string, type?: string, name?: string, activityId?: string }): ActivityWindow[]; /** * Initializes an activity for the current window. By doing this, the window is announced as activity aware to the other activity participants. * @param activityWindowId The ID of the window that was created. * @param windowType Type of the window. */ announce(activityWindowId?: string, windowType?: string): Promise; /** * Creates a new window of a given type and joins it to an activity. * * @param activity Activity to which to join the window. * @param windowType The type of the window to be created and joined to the activity. * @param callback Optional callback to handle the result. */ create(activity: Activity, windowType: string | WindowDefinition, callback?: (aw: ActivityWindow) => void): Promise; /** * Allows you to subscribe for activity window events (e.g., window joining or leaving an activity). * @param handler Handler function which receives the activity, the activity window and the event as parameters. */ subscribe(handler: (activity: Activity, window: ActivityWindow, event: any) => void): void; /** Unsubscribes from an activity window event. */ unsubscribe(handler: (activity: Activity, window: ActivityWindow, event: any) => void): void; } /** * API for managing activity instances. */ export interface InstancesAPI { /** * Returns all started activities. * @param activityType Can be a string or an `ActivityType`. */ get(activityType?: string | ActivityType | string[] | ActivityType[]): Activity[]; /** * Subscribes for activity status events. * @param handler Handler function that receives the activity, the new and the old activity statuses as parameters. */ subscribe(handler: (activity: Activity, newStatus: ActivityStatus, oldStatus: ActivityStatus) => void): void; /** Unsubscribes from receiving activity status events. * @param handler Handler function that receives the activity, the new and the old activity statuses as parameters. */ unsubscribe(handler: (activity: Activity, newStatus: ActivityStatus, oldStatus: ActivityStatus) => void): void; } /** * Object describing an activity. */ export interface Activity { /** ID of the activity. */ id: string; /** Type of the activity. */ type: ActivityType; /** Context of the activity. */ context: any; /** Status of the activity. */ status: ActivityStatus; /** Owner window. */ owner: ActivityWindow; /** List of all windows participating in the activity (including the owner window). */ windows: ActivityWindow[]; /** * Creates a new window and joins it to the activity. * @param windowType Type of the window to be created and joined to the activity. * @param callback Optional callback function to handle the result. Receives the created activity window as a parameter. */ createWindow(windowType: string | WindowDefinition, callback?: (aw: ActivityWindow) => void): Promise; /** * Creates a stacked set of windows and joins them to the activity. * @param windowTypes Types of windows to create and join to the activity. * @param timeout Optional timeout. * @param callback Optional callback to handle the result. Receives an array of the created activity windows as a parameter. */ createStackedWindows(windowTypes: (string | WindowDefinition)[], timeout?: number, callback?: (aw: ActivityWindow[]) => void): Promise; /** * Returns all windows of a given type participating in the activity. * @param windowType Type of activity windows to return. */ getWindowsByType(windowType: string): ActivityWindow[]; /** * Replaces the activity context with a new one. * @param context Context object with which to replace the current activity context. * @param callback Optional callback function to handle the result. Receives the activity as a parameter. */ setContext(context: any, callback?: (activity: Activity) => void): Promise; /** * Updates the activity context with the properties from the provided context object. * If the old context values are `{ a: 1, b: 2, c: 3 }`, invoking `updateContext({ b: 3, c: null, d: 4 })` will result in * the following context state: `{ a: 1, b: 3, d: 4 }`. * @param context Context object with which to update the existing activity context. * @param callback Optional callback function to handle the result. Receives the activity as a parameter. */ updateContext(context: any, callback?: (activity: Activity) => void): Promise; /** * Subscribes for activity status change events. * @param handler Handler function for the event. Receives the activity, the new and the old activity statuses as parameters. */ onStatusChange(handler: (activity: Activity, newStatus: ActivityStatus, oldStatus: ActivityStatus) => void): () => void; /** * Subscribes for window related events, like joining or removing a window from the activity. * @param handler Handler function for the event. Receives the activity, the window and the event as parameters. */ onWindowEvent(handler: (activity: Activity, window: ActivityWindow, event: ActivityWindowEvent) => void): () => void; /** * Subscribes for activity context updates. * @param handler Handler function for the event. */ onContextChanged(handler: ContextUpdateHandler): void; /** Stops the activity and closes all windows. */ stop(): void; /** * @ignore * Creates a new activity with the same set of windows. * @param options Cloning options. */ clone(options: CloneOptions): Promise; /** * @ignore * Attaches the current activity to another activity. This stops the current activity. It can be restored by using the returned `AttachedActivityDescriptor`. * @param activity Activity to which to attach the current activity. * @param tag */ attach(activity: Activity | string, tag?: object): Promise; /** * @ignore * Subscribes for the event which fires when another activity is attached the current one. * @param callback Callback function to handle the event. Receives the `AttachedActivityDescriptor` object of the attached activity as an argument. */ onActivityAttached(callback: (descriptor: AttachedActivityDescriptor) => void): void; /** * @ignore * Subscribes for the event which fires when another activity is detached from this one. * @param callback Callback function to handle the event. Receives the restored activity and its `AttachedActivityDescriptor` object as arguments. */ onDetached(callback: (newActivity: Activity, descriptor: AttachedActivityDescriptor) => void): void; } /** * Object for overriding the activity type definition when initiating a new activity of a specified type. */ export interface OverrideTypeDefinition { /** Owner window. */ owner: WindowDefinition; /** Helper windows. */ helpers: WindowDefinition[]; } /** * Activity context update handler. * * @param context The full context object after the update. * @param delta Object that contains only the changed context properties. * @param removed Array of strings with the names of the removed properties. * @param activity The activity that was updated. */ type ContextUpdateHandler = (context: object, delta: object, removed: string[], activity: Activity) => void; /** The status of the activity instance. */ interface ActivityStatus { /** Returns the activity instance state. */ getState(): string; /** Returns the message for the activity status. */ getMessage(): string; /** Returns the time of the activity status. */ getTime(): Date; } /** Activity window events for joining and leaving an activity. */ enum ActivityWindowEvent { Joined, Removed } /** Defines an activity window. */ interface WindowDefinition { /** Window type. */ type: string; /** Window name. */ name: string; /** Whether the window is independent or not. */ isIndependent: boolean; /** Distance of the top left window corner from the left edge of the screen. */ left?: number; /** Distance of the top left window corner from the top edge of the screen. */ top?: number; /** Width of the window. */ width?: number; /** Height of the window. */ height?: number; /** Positions the new window relatively to an existing window. */ relativeTo?: string | RelativeWindow; /** Relative direction of positioning the new window. Considered only if `relativeTo` is supplied. Can be "bottom", "top", "left", "right". */ relativeDirection?: string; /** Whether to use an existing window when creating a new window. */ useExisting?: boolean; /** The context of the new window. */ context?: object; /** Deprecated. Do not use, to be removed. */ arguments?: object; /** Deprecated. */ windowStyleAttributes?: object; } /** Existing window used to relatively position another window. */ export interface RelativeWindow { /** Type of the window that will be used to relatively position the new window. */ type?: string; /** ID of the window that will be used to relatively position the new window. */ windowId?: string; } /** * An activity type is a definition template for an activity consisting of a collection of window types, * their layout and an initial activity context. */ interface ActivityType { /** Name of the activity type. */ name: string; /** Description of the activity type. */ description: string; /** A list of window types that will be created when initiating a new instance of that activity type. */ helperWindows: WindowDefinition[]; /** Returns the definition of the owner window of that activity type. */ ownerWindow: WindowDefinition; /** * Initiates a new activity of this type. * @param context The initial context to be used for the new activity. * @param callback Optional callback to handle the result. Receives the created activity and a configuration object * with which you can override the default activity definition. */ initiate(context: object, callback?: (activity: Activity) => void, configuration?: OverrideTypeDefinition | WindowDefinition[]): Promise; } /** A window type is a definition of a window, typically configured in Glue42 Desktop. */ interface WindowType { /** Name of the window type. */ name: string; /** Returns the Glue42 Desktop configuration related to this window type (as an application object from the AppManager API) */ config: object; /** All windows from that type. */ windows: ActivityWindow[]; } /** Object defining the window bounds. */ interface WindowBounds { /** Distance of the top left window corner from the top edge of the screen. */ top?: number; /** Distance of the top left window corner from the left edge of the screen. */ left?: number; /** Width of the window. */ width?: number; /** Height of the window. */ height?: number; } /** * A window participating in an activity. */ interface ActivityWindow { /** ID of the window. */ id: string; /** Name of the window. */ name: string; /** Type of the window. */ type: WindowType; /** The activity that the window is a part of. */ activity: Activity; /** If `true`, the window is the owner of the activity. */ isOwner: boolean; /** The Interop instance of that window. You can use it to invoke Interop methods for that window. */ instance: Glue42Core.AGM.Instance; /** Returns the window as an object from the Window Management API (`glue.windows`). */ underlyingWindow: Windows.GDWindow; /** If `true`, this is an independent window. */ isIndependent(): boolean; /** * Sets window visibility. * @param isVisible If `true`, the window will be visible. * @param callback Optional callback to handle the result. Receives the activity window as an argument. */ setVisible(isVisible: boolean, callback?: (aw: ActivityWindow) => void): Promise; /** * Activates the window. * @param focus If `true`, the window will be on focus. */ activate(focus: boolean): Promise; /** Returns the window bounds. */ getBounds(): Promise; /** * Sets the window bounds. * @param bounds Window bounds object. * @param callback Optional callback to handle the result. Receives the activity window as an argument. */ setBounds(bounds: WindowBounds, callback?: (aw: ActivityWindow) => void): Promise; /** Closes the window. */ close(): Promise; /** * Subscribes for the event which fires when the window joins an activity. * @param callback Callback to handle the event. Receives as an argument the activity which the window has joined. */ onActivityJoined(callback: (activity: Activity) => void): void; /** * Subscribes for the event which fires when the window leaves an activity. * @param callback Callback to handle the event. Receives as an argument the activity which the window has left. */ onActivityRemoved(callback: (activity: Activity) => void): void; } /** * @ignore * Object describing an activity that has been attached to another activity. * Can be used to restore the attached activity. */ interface AttachedActivityDescriptor { /** ID of the owner window of the attached activity. */ ownerId: string; /** Helper windows IDs. */ windowIds: string[]; /** The frame color of the attached activity. */ frameColor: string; /** Context object of the attached activity. */ context: object; /** */ tag: object; /** * Restores the activity by detaching it from the activity it was previously attached to. * @param descriptor Object describing the attached activity. */ detach(descriptor?: AttachedActivityDescriptor): Promise; } /** * @ignore * Options for cloning an activity. */ interface CloneOptions { /** Context for the new activity. */ context: object; /** Offset from the top left corner of the original activity. */ offset: { left: number, top: number }; } } /** * @docname App Management * @intro * The App Management API provides a way to manage **Glue42 Enterprise** apps. It offers abstractions for: * * - *Application* - a program as a logical entity, registered in **Glue42 Enterprise** with some metadata (name, description, icon, etc.) * and with all the configuration needed to spawn one or more instances of it. * The App Management API provides facilities for retrieving app metadata and for detecting when an app is started. * * - *Instance* - a running copy of an app. The App Management API provides facilities for starting/stopping app instances and tracking app-related events. * * The App Management API is accessible through the `glue.appManager` object. */ namespace AppManager { /** * App Management API */ export interface API extends AppManager, Entitlements { /** * Returns the current app instance. */ myInstance: Instance; /** * Returns the current app. */ myApplication: Application; /** * API for handling app definitions at runtime. * @since Glue42 3.12 */ inMemory: InMemoryStore; /** * Notifies when the App Management API is ready to be used. */ ready(): Promise; /** * Exits Glue42. */ exit(options?: ExitOpts): Promise; /** * Restarts Glue42. */ restart(options?: ExitOpts): Promise; /** * Notifies when Glue42 will shut down or restart. If the callback is asynchronous, it will be awaited up to 60 seconds before shutdown continues. * @param callback Callback function for handling the event. * @since Glue42 3.11 */ onShuttingDown(callback: (args: ShuttingDownEventArgs) => Promise<{ prevent: boolean }>): void; } /** * Object passed as an argument to the callback for handling the Glue42 shutdown event. */ export interface ShuttingDownEventArgs { /** * If `true`, Glue42 is restarting. */ restarting: boolean; /** * Describes the Interop instance that has initiated the shutdown. */ initiator?: Glue42.Interop.Instance; /** * Reason for the shutdown. */ reason?: string; } /** * API for handling app definitions at runtime. The API methods operate only on in-memory app definitions. */ export interface InMemoryStore { /** * Imports the provided collection of app definitions. * @param definitions A collection of app definition objects to be imported. * @param mode Mode for importing app definitions. Use `"replace"` (default) to replace all existing in-memory app definitions. * Use `"merge"` to update the existing ones and add new ones. */ import(definitions: Definition[], mode?: "replace" | "merge"): Promise; /** * Exports all available app definitions from the in-memory store. */ export(): Promise; /** * Removes an app definition from the in-memory store. * @param name Name of the app to be removed. */ remove(name: string): Promise; /** * Removes all app definitions from the in-memory store. */ clear(): Promise; } /** * Describes the result from importing app definitions at runtime. */ export interface ImportResult { /** * Array of names of the successfully imported apps as specified in their definitions. */ imported: string[]; /** * Array of objects describing errors from importing app definitions. */ errors: { app: string; error: string }[]; } /** App Management API that allows you to handle your Glue42 enabled apps. */ export interface AppManager { /** * Retrieves an app by name. * @param name Name of the desired app. */ application(name: string): Application; /** * Retrieves a collection of the available apps. */ applications(): Application[]; /** * Retrieves a collection of all running app instances. */ instances(): Instance[]; /** * Retrieves the configurations of the specified apps. * @param apps List of names of the apps for which to retrieve configurations. * @since Glue42 3.17 */ getConfigurations(apps?: string[]): Promise; getConfigurations(apps: string[]): Promise>; /** * Notifies when a new app instance is started. * @param callback Callback function for handling the event. */ onInstanceStarted(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when starting a new app instance has failed. * @param callback Callback function for handling the event. */ onInstanceStartFailed(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when an app instance is stopped. * @param callback Callback function for handling the event. */ onInstanceStopped(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when an app instance is updated. * @param callback Callback function for handling the event. */ onInstanceUpdated(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when an app is registered in the environment. * @param callback Callback function for handling the event. */ onAppAdded(callback: (app: Application) => any): UnsubscribeFunction; /** * Notifies when an app is removed from the environment. * @param callback Callback function for handling the event. */ onAppRemoved(callback: (app: Application) => any): UnsubscribeFunction; /** * Notifies when an app is available and can be started. * @param callback Callback function for handling the event. */ onAppAvailable(callback: (app: Application) => any): UnsubscribeFunction; /** * Notifies when an app is no longer available and can't be started. * @param callback Callback function for handling the event. */ onAppUnavailable(callback: (app: Application) => any): UnsubscribeFunction; /** * Notifies when the configuration for an app has changed. * @param callback Callback function for handling the event. */ onAppChanged(callback: (app: Application) => any): UnsubscribeFunction; } /** @ignore */ interface Entitlements { /** Returns the region under which the API operates. */ getRegion(success?: (region: string) => any, error?: (err: any) => any): void | Promise; /** * Returns the list of branches for which the user has coverage. * Returns an error if your application does not have access to App Management admin functionality. */ getBranches(success?: (branches: Branch[]) => any, error?: (err: any) => any): void | Promise; /** * Retrieves the user branch that the API operates under. * Returns an error if your application does not have access to App Management admin functionality. */ getCurrentBranch(success?: (branch: Branch) => any, error?: (err: any) => any): void | Promise; /** * Returns the effective entitlement value for a specific function. * Returns null if there's no such functional entitlement. * The entitlements depend on the branch that is selected. * Most applications will typically only care about the function name. * However, the API allows a functional entitlement to be associated with a scalar value. */ getFunctionalEntitlement(funct: string, success?: (entitlement: string) => any, error?: (err: any) => any): void | Promise; /** Same as getFunctionalEntitlement but you can specify a branch */ getFunctionalEntitlementBranch(funct: string, branch: string, success?: (entitlement: string) => any, error?: (err: any) => any): void | Promise; /** * Changes the current branch under which the API operates. * Functional entitlements and the list of applications * a user is entitled to run depend on the selected branch. */ setCurrentBranch(branch: string, success?: (resMsg: string) => any, error?: (err: any) => any): void | Promise; /** Changes the region under which the API operates. */ setRegion(region: string, success?: (resMsg: string) => any, error?: (err: any) => any): void | Promise; /** Returns info about the currently logged on user. */ currentUser(success?: (user: UserInfo) => any, error?: (err: any) => any): void | Promise; /** Checks whether the currently logged on user is entitled to perform a certain function. */ canI(functionName: string, success?: (allowed: boolean) => any, error?: (err: any) => any): void | Promise; /** Checks whether the currently logged on user is entitled to perform a certain function on a given branch. */ canIBranch(functionName: string, branch: string, success?: (allowed: boolean) => any, error?: (err: any) => any): void | Promise; /** Allows you to track when branches collection has been modified */ onBranchesChanged(callback: (branches: Branch[]) => any): void; /** Allows you to track when the current branch has changed */ onBranchChanged?(callback: (branch: Branch) => any): void; } /** * Mode for initializing the App Management API. * Use `"full"` to enable all features of the API. * Use `"skipIcons"` to enable all features of the API, omitting the information about the app icons. * Use `"startOnly"` to start the API in a restricted mode. You will be able to start apps, * but the App Management API events and the information about the apps and their instances won't be available. */ type Mode = "startOnly" | "skipIcons" | "full"; /** @ignore */ // eslint-disable-next-line @typescript-eslint/no-shadow interface Config { activities: Glue42.Activities.API; agm: Glue42Core.AGM.API; logger: Glue42Core.Logger.API; mode: Mode; windows: Glue42.Windows.API; gdMajorVersion: number; } /** * Describes an app. */ interface Application { /** * App name. */ name: string; /** * App title. */ title: string; /** * App version. */ version: string; /** * If `true`, the app is auto started with the framework. */ autoStart: boolean; /** * If `true`, the app is a shell app. * @default false */ isShell: boolean; /** * Caption of the app. */ caption: string; /** * If `true`, the app will be hidden in the Glue42 Toolbar. * @default false */ hidden: boolean; /** * Container identifier. */ container: string; /** * The activity type associated with this app (populated only if this is an activity app). * @ignore */ activityType: string; /** * The activity window type associated with this app (populated only if this is an activity app). * @ignore */ activityWindowType: string; /** * Describes the settings for the app window. */ windowSettings: Glue42.Windows.WindowSettings; /** * If `true`, the app can have multiple instances. * @default true */ allowMultiple: boolean; /** * If `true`, the app is available and can be started. */ available: boolean; /** * App icon. */ icon: string; /** * URL of the app icon. */ iconURL: string; /** * Sort indicator used when ordering apps in a list. */ sortOrder: number; /** * Custom configuration object attached to the app. */ userProperties: PropertiesObject; /** * An array of keywords for discovering the app more easily. */ keywords?: string[]; /** * If `true`, the app is an activity. * @ignore */ isActivity: boolean; /** * Deprecated. Use `getConfiguration()` instead. * Legacy configuration object for the app. * This is kept for legacy apps, all properties are available in the app object now. * @ignore */ configuration: LegacyAppConfigProperties; /** * Array of objects describing the running app instances. */ instances: Instance[]; /** * Type of the app. */ type: string; /** * Mode of the app window. * Possible values are `"flat"`, `"tab"`, `"html"` or `"frameless"`. * If the mode can't be determined (e.g., for external apps), the value is `"unknown"`. */ mode: Glue42.Windows.WindowMode | "unknown"; /** * Retrieves the app configuration. * @since Glue42 3.17 */ getConfiguration(): Promise; /** * Starts an instance of the app. * @param context Context to be passed to the started app instance. * @param options Options for the started app instance that will override the default app configuration. */ start(context?: object, options?: ApplicationStartOptions): Promise; /** * Notifies when an instance of the app is started. * @param callback Callback function for handling the event. */ onInstanceStarted(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when an instance of this app is stopped. * @param callback Callback function for handling the event. */ onInstanceStopped(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when the app becomes available. * @param callback Callback function for handling the event. */ onAvailable(callback: (app: Application) => any): UnsubscribeFunction; /** * Notifies when the app becomes unavailable. * @param callback Callback function for handling the event. */ onUnavailable(callback: (app: Application) => any): UnsubscribeFunction; /** * Notifies when the app configuration is changed. * @param callback Callback function for handling the event. */ onChanged(callback: (app: Application) => any): void; /** * Notifies when the app is removed. * @param callback Callback function for handling the event. */ onRemoved(callback: (app: Application) => any): void; } /** * Generic object for passing properties or settings in the form of key/value pairs. */ export interface PropertiesObject { [key: string]: any } /** * Describes an app instance. */ export interface Instance { /** * App instance ID. */ id: string; /** * The app object of that instance. */ application: Application; /** * Returns the activity object if the instance is part of an activity. * @ignore */ activity: Activities.Activity; /** * Returns the instances of the other windows in the activity if this instance is part of an activity. * @ignore */ activityInstances: Instance[]; /** * Returns the instance of the owner window of the activity if this instance is part of an activity. * @ignore */ activityOwnerInstance: Instance; /** * Deprecated. Use `getWindow()` instead. * The window associated with the instance (as an object from the Window Management API). * If the app instance is an activity instance, this is `undefined`. * @ingore */ window: Windows.GDWindow; /** * Deprecated. Use `getContext()` instead. * The starting context of the instance. * @ignore */ context: object; /** * Title of the app instance. */ title: string; /** * Whether the app instance is an activity instance. * @ignore */ isActivityInstance: boolean; /** * The activity ID (only if the apps is part of an activity). * @ignore */ activityId: string; /** * If `true`, the instance is running as part of an activity. * @ignore */ inActivity: boolean; /** * If `true`, the instance is running as a single window app (not part of an activity). * @ingore */ isSingleWindowApp: boolean; /** * Access to the Interop instance. Use this to invoke Interop methods for the app instance. */ agm: Partial; /** * Stops the app instance. */ stop(): Promise; /** * Activates the app instance. */ activate(): Promise>; /** * Retrieves the starting context of the instance. */ getContext(): Promise; /** * Retrieves the window object corresponding to the app instance. */ getWindow(): Promise; /** * Notifies when the Interop library is ready to be used. * @param callback Callback function for handling the event. */ onAgmReady(callback: (instance: Instance) => any): UnsubscribeFunction; /** * Notifies when the instance is stopped. * @param callback Callback function for handling the event. */ onStopped(callback: (instance: Instance) => any): UnsubscribeFunction; } /** * @ignore */ export interface Branch { Name: string; Roles: Roles[]; } /** * @ignore */ export interface UserInfo { FirstName: string; LastName: string; LoginName: string; } /** * Options for shutdown or restart of Glue42. */ export interface ExitOpts { /** * @ignore */ autoSave?: boolean; /** * If `true`, will show a confirmation dialog when shutting down or restarting Glue42. */ showDialog: boolean; } /** * Options for starting an app. */ export interface ApplicationStartOptions extends Glue42.Windows.WindowSettings { /** * If `true`, will wait for the Interop library to be initialized. * @default true */ waitForAGMReady?: boolean; /** * If `true`, the App Default Layout of the app (last saved bounds, context, window state) will be ignored when starting the app. * The app will always start with the bounds, context and state specified in its configuration. * @default false */ ignoreSavedLayout?: boolean; } /** * Legacy app configuration options. * @ignore */ export interface LegacyAppConfigProperties { /** Whether to auto start the app. */ autoStart?: boolean; /** Caption for the app. */ caption?: string; hidden?: boolean; /** Container identifier. */ container?: string; /** Activity type (if the app is in an activity). */ activityType?: string; /** If `true`, multiple instances of the app can be started. */ allowMultiple?: boolean; } /** @ignore */ export type Roles = "Full" | "ReadWrite" | "ReadOnly"; /** App definition. */ export type Definition = ApplicationConfig /** * Describes an Intent. */ export interface Intent { /** * Name of the Intent. */ name: string; /** * The human readable name of the Intent. Can be used in context menus or other UI elements to visualize the Intent. */ displayName?: string; /** * The type of predefined data structures with which the Intent handler app works. */ contexts?: string[]; /** * Custom configuration for the Intent. */ customConfig?: object; /** * The type of predefined data structure which the Intent handler app returns. */ resultType?: string; } } /** * @intro * **Glue42 Enterprise** provides a way for apps to programmatically capture screenshots of the available monitors, of windows and window groups. * Based on custom logic you can capture one or all monitors in order to save a snapshot of the visual state at a given moment. * * The Displays API is accessible through the `glue.displays` object. */ namespace Displays { /** * Displays API * @since Glue42 3.9 */ export interface API { /** * Returns all available displays. */ all(): Promise; /** Returns a single display by ID. * @param id ID of the desired display. */ get(id: number): Promise; /** Returns a single display by window ID. * @param id Window ID of the desired display. * @since 3.12 */ getByWindowId(id: string): Promise; /** * Returns the primary display. */ getPrimary(): Promise; /** Returns a Base64 string of the screenshots of all displays. The returned value depends on the `combined` property specified in the options object. * @param options Options for capturing the displays. */ captureAll(options: CaptureAllOptions): Promise; /** Returns a Base64 string of the screenshot of a single display. * @param options Options for capturing the display. */ capture(options: CaptureOptions): Promise; /** * Returns the X and Y coordinates of the mouse cursor. */ getMousePosition(): Promise; /** * Notifies when the display is changed. * @param callback Callback function for handling the event. */ onDisplayChanged(cb: (displays: Glue42.Displays.Display[]) => void): UnsubscribeFunction; } /** * Describes a display. */ interface Display { /** * Unique identifier associated with the display. */ id: number; /** * Bounds of the display (width, height, left and top coordinates). */ bounds: Bounds; /** * The working area of the display. */ workArea: Bounds; /** * Display resolution. */ dpi: number; /** * If `true`, this is the primary display. */ isPrimary: boolean; /** * Index assigned to the display by the operating system. */ index: number; /** * Name assigned to the display by the operating system. */ name: string; /** * Aspect ratio of the display (e.g., 16:9). */ aspectRatio: string; /** * The scale factor of the returned display. */ scaleFactor: number; /** * Captures a screenshot of the current display. * @param size Size options for the returned image. Can be absolute or relative size. */ capture: (size: ScaleOptions | AbsoluteSizeOptions) => Promise; } /** * Describes the display bounds. */ interface Bounds { /** * Height of the display in pixels. */ height: number; /** * Width of the display in pixels. */ width: number; /** * The horizontal coordinate of the top left corner of the display in pixels. */ left: number; /** * The vertical coordinate of the top left corner of the display in pixels. */ top: number; } /** * Coordinates of a point on the screen. */ export interface Point { /** * The X coordinate of the point. */ x: number; /** * The Y coordinate of the point. */ y: number; } /** * Options for capturing a single display. */ interface CaptureOptions { /** * ID of the targeted display. */ id: number; /** * Size of the output image. */ size?: ScaleOptions | AbsoluteSizeOptions; } /** * Options for capturing all displays. */ interface CaptureAllOptions { /** * If `true`, will return a single image of all captured displays. Else, will return a separate image for each captured display. */ combined: boolean; /** * Size of the output image. */ size?: ScaleOptions | AbsoluteSizeOptions; } /** * Absolute size of the returned image. */ interface AbsoluteSizeOptions { /** * Width of the returned image in pixels. */ width?: number; /** * Height of the returned image in pixels. */ height?: number; /** * Specifies whether to keep the aspect ratio of the output image when you specify `width` and/or `height` of the output image. * If `true` and both `width` and `height` are set, then the specified `width` will be used as a basis for the output image aspect ratio. */ keepAspectRatio?: boolean; } /** * Relative size of the returned image. */ interface ScaleOptions { /** * Specifies the size of the output image relative to the actual screen size. */ scale: number; } } /** * @intro * The Layouts API allows you to save the arrangement and context of any set of apps running in **Glue42 Enterprise** as a named Layout and later restore it. * You can also choose a default Global Layout which **Glue42 Enterprise** will load upon startup. * * The Layouts library supports different types of Layouts - e.g., Global, App Default, Workspace. * * The Layouts API is accessible through the `glue.layouts` object. */ namespace Layouts { /** * The supported Layout types are `"Global"`, `"ApplicationDefault"` and `"Workspace"`. * The `"Activity"` and `"Swimlane"` types are deprecated. * In a Global Layout, all running apps and their state is saved. By default, hidden windows are ignored. * The App Default Layout describes the default Layout for an app instance - the last saved window bounds, * state and context. The Workspace Layout describes the arrangement of the Workspace elements, its bounds and context of individual windows. */ export type LayoutType = "Global" | "ApplicationDefault" | "Workspace" | "Activity" | "Swimlane"; /** * Layouts library initialization mode: * - `"full"` - all Layout functionalities are available; * - `"fullWaitSnapshot"` - same as the `"full"` mode, except that the Layouts library * will notify that it is ready a little later - when a snapshot of the available Layouts has been received; * - `"slim"` - Layout events aren't tracked and Layouts can't be manipulated; */ export type Mode = "full" | "fullWaitSnapshot" | "slim"; /** * Mode for importing Layouts. * - `"replace"` - all existing Layouts will be removed and replaced with the imported ones (default); * - `"merge"` - the imported Layouts will be merged with the existing ones; */ export type ImportMode = "replace" | "merge"; /** * Configuration for the Layouts library. */ export interface Configuration { /** * Layouts library mode. */ mode: Mode; /** * If `true`, the context of the current window will be saved. * Since Glue42 Enterprise 3.13.1 you can also specify a list of Layout types for which to save the window context. * @since Glue42 3.10 * @default false */ autoSaveWindowContext: boolean | LayoutType[]; } /** * Layouts API. */ export interface API { /** * Retrieves a Layout. * @param type Type of the Layout to retrieve. * @param name Name of the Layout to retrieve. */ get(name: string, type: LayoutType): Promise; /** * Retrieves a lightweight, summarized version of all Layouts of the provided type. * @param type Type of the Layouts whose summaries to retrieve. */ getAll(type: LayoutType): Promise; /** * Notifies when the Layouts library is ready to be used. * @ignore */ ready(): Promise; /** * Retrieves a list of all Layouts. */ list(): Layout[]; /** * Saves a new Layout. * @param layout Options for saving a Layout. */ save(layout: NewLayoutOptions): Promise; /** * Imports one or more Layouts. * @param layouts Array of Layouts to import. * @param mode Mode for importing the Layouts. */ import(layouts: Layout[], mode?: ImportMode): Promise; /** * Retrieves all available Layouts. * @param layoutType Type of the Layouts to retrieve. */ export(layoutType?: LayoutType): Promise; /** * Restores a Layout. * @param options Options for restoring a Layout. */ restore(options: RestoreOptions): Promise; /** * Removes a Layout * @param type Type of the Layout to remove. * @param name Name of the Layout to remove. */ remove(type: string, name: string): Promise; /** * Renames a Layout. * @param layout Existing Layout to rename. * @param newName New name for the Layout. */ rename(layout: Layout, newName: string): Promise; /** * Updates the metadata of a Layout. * @param layout Existing Layout to update. */ updateMetadata(layout: Layout): Promise; /** * Retrieves the last restored Global Layout. */ getCurrentLayout(): Promise; /** * Hibernates a Layout. * @param name Name of the Layout to hibernate. * @param options Options for hibernating a Layout. * @since Glue42 3.9 */ hibernate(name: string, options?: Glue42.Layouts.HibernationOptions): Promise; /** * Resumes a Layout. * @param name Name of the Layout to resume. * @param context Context for the Layout. * @param options Options for resuming a Layout. * @since Glue42 3.9 */ resume(name: string, context?: any, options?: Glue42.Layouts.ResumeOptions): Promise; /** * Updates the context saved for your app in the currently loaded Layout. * @param context New context for the app. */ updateAppContextInCurrent(context: object): Promise; /** * Updates the context that will be saved as a default context for the current window. * @param context New context that will be saved as a default window context. * @since Glue42 3.10 */ updateDefaultContext(context: object): Promise /** * Sets a new default Global Layout. * @param name Name of the Layout to set as the new default Global Layout. */ setDefaultGlobal(name: string): Promise; /** * Removes the default Global Layout. */ clearDefaultGlobal(): Promise; /** * Retrieves the default Global Layout, if any. */ getDefaultGlobal(): Promise; /** * Forces a refresh of the connection to the Glue42 Server or any other REST Layout stores, updating the list of available Layouts. */ forceRefresh(): Promise; /** * Notifies when a new Layout is added. * @param callback Callback function for handling the event. */ onAdded(callback: (layout: Layout) => void): UnsubscribeFunction; /** * Notifies when a Layout is removed. * @param callback Callback function for handling the event. */ onRemoved(callback: (layout: Layout) => void): UnsubscribeFunction; /** * Notifies when a Layout is changed. * @param callback Callback function for handling the event. */ onChanged(callback: (layout: Layout) => void): UnsubscribeFunction; /** * Notifies when a Layout is renamed. * @param callback Callback function for handling the event. */ onRenamed(callback: (layout: Layout) => void): UnsubscribeFunction; /** * Notifies when a Layout is restored. * @param callback Callback function for handling the event. */ onRestored(callback: (Layout: Layout) => void): UnsubscribeFunction; /** * Notifies when a Layout save is requested. * @param callback Callback function for handling the event. */ onSaveRequested(callback: (info?: SaveRequestContext) => SaveRequestResponse): UnsubscribeFunction; /** * Notifies when a Layout is modified. * @param callback Callback function for handling the event. * @since Glue42 3.21 */ onLayoutModified(callback: (info: LayoutModifiedEvent) => SaveRequestResponse): UnsubscribeFunction; /** * @ignore * Subscribes for raw stream events. For debugging purposes only. * @param callback Callback function for handling the event. */ onEvent(callback: (event: any) => void): UnsubscribeFunction; } /** * Describes a Layout. */ export interface Layout extends LayoutSummary { /** * Array of component objects describing the apps that are saved in the Layout. */ components: LayoutComponent[]; /** * Version of the Layout. */ version?: number; } /** * Summarized description of a Layout. */ export interface LayoutSummary { /** * Name of the Layout, unique per Layout type. */ name: string; /** * Type of the Layout. */ type: LayoutType; /** * Layout context. */ context?: any; /** * Layout metadata. */ metadata?: any; } /** * Describes the base result returned by methods for * manipulating Layouts - e.g., renaming, hibernating, updating default context. */ export interface LayoutResult { /** * Status of the Layout operation. If successful, will be set to `"Success"`, * otherwise, will contain the returned error message. */ status: string; } /** * Describes the result returned from hibernating a Layout. */ export interface HibernateResult extends LayoutResult { /** * Hibernated layout. */ layout: Layout; } /** * Describes the result returned from resuming a Layout. */ export interface ResumeResult extends LayoutResult { /** * Array of objects describing all resumed app instances participating in the Layout. * Each object contains the instance ID and the app name of the resumed app instance. */ instances: { instanceId: string, appName: string }[]; } /** * Describes the result returned from importing Layouts. */ export interface ImportLayoutResult extends LayoutResult { /** * Array of objects describing all Layouts that failed to import. * Each object contains the name and the type of the Layout. */ failed: { name: string, type: LayoutType }[]; } /** * Type of the Layout component - an activity or an app. * @ignore */ export type ComponentType = "activity" | "application"; /** * Describes a Layout component - an app participating in the Layout and its state. */ export interface LayoutComponent { /** * Name of the app to which belongs window instance, * or the name of the Workspaces App to which belongs the Workspace instance. */ application: string; /** * Type of the Layout component. If `"window"`, the component is a window instance of an app. * If `"Workspace"`, the component is a Workspace instance in a Layout of type `"Workspace"`. * If `"workspaceFrame"`, the component is a Workspaces App with one or more Workspaces in it, * participating in a Layout of type `"Global"`. */ type: string; /** * Type of the component - can be app or activity. * @ignore */ componentType?: ComponentType; /** * Provides information about the instance ID, bounds, context, state and more of the Layout component. */ state: any; } /** * Options for saving a new Layout. */ export interface NewLayoutOptions { /** * Name for the Layout. */ name: string; /** * Type of the Layout. * @default "Global" */ type?: LayoutType; /** * Context to be saved with the Layout. */ context?: any; /** * Metadata to be saved with the Layout. */ metadata?: any; /** * Only if the Layout type is `"Global"`. The instances with the provided IDs will be saved. */ instances?: string[]; /** * Only if the Layout type is `"Global"`. The instances with the provided IDs will be ignored. */ ignoreInstances?: string[]; /** * Only if the Layout type is `"Activity"`. Will save the Layout of the activity with the provided ID. * If not passed, will use the activity in which the calling app participates. If the current * app isn't in an activity, an error will be thrown. * @ignore */ activityId?: string; /** * Deprecated. Only if the Layout type is `"Global"`. If `true` (default), the layout won't include hidden apps. * @ignore */ ignoreHidden?: boolean; /** * Deprecated. Only if the Layout type is `"Global"`. Ignores the current instance when saving a Layout. * @default false * @ignore */ ignoreMyInstance?: boolean; } /** * Options for restoring a Layout. */ export interface RestoreOptions { /** * Name of the Layout to restore. */ name: string; /** * Type of the Layout to restore. * @default "Global" */ type?: string; /** * Deprecated. Use `closeRunningInstances` instead. * @ignore */ closeRunningInstance?: boolean; /** * Only if the Layout type is `"Global"`. If `true`, will close all visible running instances before restoring * the Layout. Exceptions are apps which are configured as shell, service, auto started, or ignored from Layouts. * @default true */ closeRunningInstances?: boolean; /** * If `true`, will close the current app before restoring a Layout. * If `closeRunningInstances` is set to `false`, this will default to `false` too. * @default true */ closeMe?: boolean; /** * Context object that will be passed to the restored apps. It will be merged with the saved context object. */ context?: unknown; /** * Timeout in milliseconds for restoring the Layout. * If the time limit is hit, all apps opened up to this point will be closed and an error will be thrown. */ timeout?: number; /** * Only if the type is `"Activity"`. If `true`, will try to reuse existing windows when restoring the Layout. * @default true * @ignore */ reuseWindows?: boolean; /** * Only if the type is `"Activity"`. If set, the activity will be restored and joined to the specified activity. * If not set, a new activity instance will be created from the saved layout. * @ignore */ activityIdToJoin?: string; /** * Only if the type is `"Activity"`. If `true`, will set the activity context upon restore. * @default true * @ignore */ setActivityContext?: boolean; /** * Only if the type is `"Activity"` and `activityId` is set. * With this you can specify that certain window types should not be restored. * @ignore */ ignoreActivityWindowTypes?: string[]; /** * Deprecated. Only if the type is `"Activity"` and `activityId` is set. * If `true`, will restore the activity owner window. * @ignore */ restoreActivityOwner?: boolean; /** * Deprecated. Restore options for the splash screen. * @ignore */ splash?: RestoreSplashOptions; } /** * Options for hibernating Layouts. */ export interface HibernationOptions { /** * Context object that will be passed to the restored apps. It will be merged with the saved context object. */ context?: object; /** * Metadata to be saved with the Layout. */ metadata?: any; } /** * Options for resuming a Layout. */ export interface ResumeOptions { /** * Whether to stop any already running apps before resuming the Layout. */ cleanUp?: boolean; } /** * Options for the restore splash screen. * @ignore */ export interface RestoreSplashOptions { /** Text for the splash screen. */ text: string; /** Text color. */ textColor: string; /** Background color. */ backgroundColor: string; /** Animation color. */ animationColor: string; } /** * Result returned in response to a request for saving a Layout. */ export interface SaveRequestResponse { /** * Context object specific to the app. */ windowContext: object; /** * The window can return activity context if it is an owner window of the activity. * On restore, this context will be merged with the activity context passed when restoring the layout. * @ignore */ activityContext: object; } /** * Context passed as an argument to the callback for handling Layout save request events. */ export interface SaveRequestContext { /** * Context to be saved. */ context?: unknown; /** * Name of the Layout that is to be saved. */ layoutName: string; /** * Type of the Layout to be saved. */ layoutType: LayoutType; } /** * Object describing a modified Layout and the reason for its modification. */ export interface LayoutModifiedEvent { /** * Object holding the name and the type of the modified Layout. */ layout: { name: string, type: string }; /** * Object holding information about the name of the app or the ID of the instance that is responsible for the Layout changes, * and the action that has caused them (e.g., started or stopped instance, changed state of a Workspaces App, and more). */ reason: { application?: string, action?: string, instance?: string }; } } /** * @intro * The Window Management API lets you create and manipulate windows and is the basis of the App Management API. * It allows users to group Glue42 Windows so that they move, maximize and minimize together, * and provides the following features, not found in any normal browser: * * - 4 types of window modes: flat, tab, HTML and frameless. * - visibility - create hidden windows, show them later; * - bounds - set window location and size; * - user interaction - allow a window to be sticky, enable or disable default system buttons ("Minimize", "Maximize", "Close"); * - add custom frame buttons to the windows and respond accordingly to user interaction with them; * - organize windows into tabs that the user can also tear off; * * Native apps, as opposed to web apps, can have more than one window. After you Glue42 enable your native app, * your app windows aren't automatically registered as Glue42 Windows. You can choose which ones to register as Glue42 Windows * so that they can use **Glue42 Enterprise** functionalities. * * Web and native windows are handled by **Glue42 Enterprise** as window abstractions, which means that: * * - You can use any technology adapter provided by Glue42 (JavaScript, .NET, Java, and many more) to control any window, web or native. * - From an end user perspective, there is no difference between web or native windows. * - Feature parity is provided by the different technology adapters. * * The Window Management API is accessible through the `glue.windows` object. */ namespace Windows { export import Screen = Glue42.Screen; /** * Settings for cascading windows. */ export interface CascadeSettings { /** * If `true`, will enable cascading windows. * @default true */ enabled?: boolean; /** * Offset in pixels for opening windows in a cascade. * @default 50 */ offset?: number; } /** * Settings for Glue42 Windows. */ export interface WindowSettings { /** * Distance of the top left window corner from the top edge of the screen in pixels. * @default 0 */ top?: number; /** * Distance of the top left window corner from the left edge of the screen in pixels. * @default 0 */ left?: number; /** * Window width in pixels. * @default 400 */ width?: number; /** * Window height in pixels. * @default 400 */ height?: number; /** * If `true`, the window will contain a "Close" button. * @default true */ allowClose?: boolean; /** * If `true`, the tab header will contain a "Close" button. * @default true */ allowTabClose?: boolean; /** * If `true`, the window will contain a "Collapse/Expand" button. * @default false */ allowCollapse?: boolean; /** * If `true`, the window will contain a "Forward" button. * @default true * @ignore */ allowForward?: boolean; /** * If `true`, the window will contain a "Maximize" button. * @default true */ allowMaximize?: boolean; /** * If `true`, the window will contain a "Minimize" button. * @default true */ allowMinimize?: boolean; /** * If `true`, the window will be able to unstick from other Glue42 Windows. * @default true */ allowUnstick?: boolean; /** * If `true`, the window will contain a "Lock/Unlock" button. * @default false */ allowLockUnlock?: boolean; /** * If `true`, the window will contain an "Extract" button when in a window group. The button can be used to break out the window from the window group. * @default false */ allowExtract?: boolean; /** * If `true`, when moving the window operation ends, the window will snap to one of the approaching edges * of another window, if its close enough. * @default true */ autoSnap?: boolean; /** * If `true`, a snapped window will adjust its bounds to the same width/height of the window it has stuck to, * and will occupy the space between other windows, if any. * @default true */ autoAlign?: boolean; /** * Base64 image that will be used as a taskbar icon for the window. The supported formats are PNG, ICO, JPG and APNG. */ base64ImageSource?: string; /** * Color for the window border. Can be a color name such as `"red"`, or a hexadecimal RGB or ARGB value. */ borderColor?: string; /** * Name of the Channel which the window will join. */ channelId?: string; /** * If `true`, Channels will be enabled for the window and it will show the Channel Selector. * @default false */ allowChannels?: boolean; /** * Defines the height of the window when collapsed. * @default -1 */ collapseHeight?: number; /** * If `true`, allows opening a developer console using `F12` for the new window. * @default true */ devToolsEnable?: boolean; /** * Defines the file download behavior of the window. */ downloadSettings?: DownloadSettings; /** * If `true`, the window will start collapsed. * @default false */ isCollapsed?: boolean; /** * Deprecated. Use `isChild` instead. If `true`, the window will open as a child window, sharing the lifetime and the environment of the opener. * @default false * @ignore */ isPopup?: boolean; /** * If `true`, the window will open as a child window, sharing the lifetime and the environment of the opener. * This property won't work if the window is opened by a Workspaces App or a Web Group App. * @default false */ isChild?: boolean; /** * If `true`, the window will stick to other Glue42 Windows forming groups. * @default true */ isSticky?: boolean; /** * If `true`, the window will be on focus when created. * @default true */ focus?: boolean; /** * If `true`, the window will have move areas and the user will be able to move it. Valid only for Glue42 Windows with `mode` set to `"html"`. * @default true */ hasMoveAreas?: boolean; /** * If `true`, the user will be able to resize the window by dragging its borders. Valid only for Glue42 Windows with `mode` set to `"html"`. * @default true */ hasSizeAreas?: boolean; /** * If `true`, the window will be started as a hidden window. * @default false */ hidden?: boolean; /** * If `true`, this will allow the users to navigate back (`CTRL + Left`) and forward (`CTRL + Right`) through the web page history. * @default true */ historyNavigationEnabled?: boolean; /** * Specifies the maximum window height in pixels. */ maxHeight?: number; /** * Specifies the maximum window width in pixels. */ maxWidth?: number; /** * Specifies the minimum window height in pixels. * @default 30 */ minHeight?: number; /** * Specifies the minimum window width in pixels. * @default 50 */ minWidth?: number; /** * Glue42 Window mode. Possible values are `"flat"`, `"tab"`, `"html"` and `"frameless"`. * @default "flat" */ mode?: WindowMode; /** * How much of the window area is to be considered as a moving area. * The string value corresponds to the left, top, right and bottom borders of the window. * Setting this to "0, 20, 0, 0" will set a 20 pixel thick move area at the top of the window. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 12, 0, 0" */ moveAreaThickness?: string; /** * Margin for the move area located at the left border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "0, 10, 0, 10" will take away 10 pixels from the top and the bottom of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaLeftMargin?: string; /** * Margin for the move area located at the top border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "10, 0, 10, 0" will take away 10 pixels from the left and the right sides of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaTopMargin?: string; /** * Margin for the move area located at the right border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "0, 10, 0, 10" will take away 10 pixels from the top and the bottom of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaRightMargin?: string; /** * Margin for the move area located at the bottom border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "10, 0, 10, 0" will take away 10 pixels from the left and the right sides of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaBottomMargin?: string; /** * Determines the conditions under which the window buttons will be visible. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "onDemand" */ buttonsVisibility?: "off" | "onDemand" | "always" | "onFocus"; /** * If `true`, the window will appear on top of the Z-order. * @default false */ onTop?: boolean; /** * ID of the window that will be used to relatively position the new window. Can be combined with `relativeDirection`. */ relativeTo?: string; /** * Direction for positioning the window relatively to the window specified in the `relativeTo` property. * Considered only if `relativeTo` is supplied. * Possible values are `"bottom"`, `"top"`, `"left"`and `"right"`. * @default "right" */ relativeDirection?: RelativeDirection; /** * If `true`, the window icon will appear on the Windows taskbar. This property won't work for apps of type `"exe"`, unless they are registered as Glue42 Windows. * @default true */ showInTaskbar?: boolean; /** * If `true`, the window will have a title bar. * @default true */ showTitleBar?: boolean; /** * How much of the window area in pixels is to be considered as a sizing area. * The string value corresponds to the left, top, right and bottom borders of the window. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "5, 5, 5, 5" */ sizeAreaThickness?: string; /** * Specifies the active Glue42 Window snapping edges. * Possible values are `"top"`, `"left"`, `"right"`, `"bottom"` and `"all"`, or any combination of them (e.g., `"left, right"`). * @default "all" */ snappingEdges?: string; /** * Specifies the window start location. * Possible options are `"center"`, `"topCenter"`, `"bottomCenter"`, `"leftCenter"`, * `"rightCenter"`, `"full"`, `"topFull"`, `"bottomFull"`, `"leftFull"` and `"rightFull"`. */ startLocation?: string; /** * Specifies the Glue42 Window frame color. Accepts a hexadecimal color as string (e.g., `"#666666"`) or named HTML colors (e.g., `"red"`). * @default "#5b8dc9" */ stickyFrameColor?: string; /** * If set, the Glue42 Window can only stick to windows that have the same group. * @default "Any" */ stickyGroup?: string; /** * Specifies the tab group ID. If two or more tab windows are defined with the same ID, they will be hosted in the same container as tabs. */ tabGroupId?: string; /** * The tab index of the current window. All tabs in a common tab container have different indices. */ tabIndex?: number; /** * If `true`, the tab will be selected. * @default true */ tabSelected?: boolean; /** * Sets the tab title. * @default "" */ tabTitle?: string; /** * Sets the tab tooltip. * @default "" */ tabTooltip?: string; /** * Sets the window title. To work properly, there should be a `` HTML tag in the page. */ title?: string; /** * Defines loader behavior. */ loader?: Loader; /** * If `true`, this will set a random frame color for the new window (from a predefined list of colors). * @default false */ useRandomFrameColor?: boolean; /** * If set, the window will start in the specified state (`"maximized"`, `"minimized"`, `"normal"`). * @default "normal" */ windowState?: WindowState; /** * If `true`, the window won't be saved when saving a Layout, nor closed or restored when restoring a Layout. */ ignoreFromLayouts?: boolean; /** * Options for loading the window URL. Can be used for POST requests, like uploading a file or specifying additional headers. * @since Glue42 3.17 */ urlLoadOptions?: LoadURLOptions; /** * Specifies the window position relative to the screen. * @since Glue42 3.11 */ placement?: PlacementSettings; /** * Settings for opening new window instances of the same app in a cascade. */ cascade?: CascadeSettings; /** * A list of preload scripts (URLs) that will be loaded and executed before the actual page is executed. */ preloadScripts?: string[]; } /** * Options for loading a window URL. */ export interface LoadURLOptions { /** * URL for the `Referer` request header or a `Referrer` object specifying a URL and a policy for the `Referrer-Policy` request header. */ httpReferrer?: (string) | (Referrer); /** * Value for the `User-Agent` request header, describing the user agent originating the request. */ userAgent?: string; /** * A string with extra headers for the request. Separate the headers with a `"\n"`. */ extraHeaders?: string; /** * Data for the POST request. Either an array of `UploadFile` objects describing the location and other properties of the file to upload, * or an array of `UploadBase64Data` objects containing data encoded as a Base64 string. */ postData?: ((UploadBase64Data) | (UploadFile))[]; /** * Base URL for files loaded by a data URL. Must end with a trailing path separator. This property is necessary only when the loaded URL is a data URL. */ baseURLForDataURL?: string; } /** * Describes the values that will be used for the `Referer` and the `Referrer-Policy` request headers. */ interface Referrer { /** * Value for the `Referrer-Policy` request header. For more details, see the [`Referrer-Policy` request header documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy). */ policy: ("default" | "unsafe-url" | "no-referrer-when-downgrade" | "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "same-origin" | "strict-origin"); /** * URL for the `Referer` request header. */ url: string; } /** * Describes a file to upload. */ interface UploadFile { /** * Path to the file to upload. */ filePath: string; /** * Number of bytes to read starting from the value set in `offset`. * @default 0 */ length: number; /** * The time the file was last modified expressed as a number of seconds since the UNIX epoch. */ modificationTime: number; /** * Position of the first byte to read. * @default 0 */ offset: number; /** * Type of the uploaded data. Must be set to `"file"`. */ type: "file"; } /** * Describes data to upload encoded as a Base64 string. */ interface UploadBase64Data { /** * The data to upload encoded as a Base64 string. */ data: string; /** * Type of the uploaded data. Must be set to `"base64"`. */ type: "base64"; } /** * Options for creating a new window. */ export interface WindowCreateOptions extends WindowSettings { /** * Name of the window. */ windowName?: string; /** * URL of the app to be loaded in the new window. */ url?: string; /** * Context for the new window. */ context?: any; } /** * Describes the buttons for the window frame. */ export interface WindowButtons { /** * If `true`, the window frame will have a "Close" button. */ allowClose?: boolean; /** * If `true`, the window frame will have a "Collapse/Expand" button. */ allowCollapse?: boolean; /** * If `true`, the window frame will have a "Lock/Unlock" button. */ allowLockUnlock?: boolean; /** * If `true`, the window frame will have a "Maximize" button. */ allowMaximize?: boolean; /** * If `true`, the window frame will have a "Minimize" button. */ allowMinimize?: boolean; } /** * Describes the minimum and maximum constraints for the window size. */ export interface SizeConstraints { /** * Maximum width in pixels for the window. */ maxWidth?: number; /** * Maximum height in pixels for the window. */ maxHeight?: number; /** * Minimum width in pixels for the window. */ minWidth?: number; /** * Minimum height in pixels for the window. */ minHeight?: number; } /** * Describes various settings for the window. * @ignore */ export interface WindowStyle extends WindowButtons, SizeConstraints { /** * If `true`, the window will be hidden. */ hidden?: boolean; /** * If `true`, the window will be on focus. */ focus?: boolean; } /** * Describes the window download behavior. */ export interface DownloadSettings { /** * If `true`, will autosave the file without asking the user where to save it. If `false`, a system save dialog will appear. * @default true */ autoSave?: boolean; /** * If `true`, will open the folder that contains the downloaded file after the download is completed. * @default false */ autoOpenPath?: boolean; /** * If `true`, will open the download file after the download is completed. * @default false */ autoOpenDownload?: boolean; /** * If `true`, will enable the window to download files. * @default true */ enable?: boolean; /** * If `true`, a download bar tracking the progress will appear at the bottom of the window when downloading. If `false`, the download process will be invisible. * @default true */ enableDownloadBar?: boolean; } /** * Window button settings. */ export interface ButtonInfo { /** * Unique ID for the button. */ buttonId: string; /** * Button position. */ order?: number; /** * Button tooltip. */ tooltip?: string; /** * Button image in Base64 format. */ imageBase64: string; } /** * Describes the window bounds. */ export interface Bounds { /** * Distance of the top left window corner from the top edge of the screen in pixels. */ top: number; /** * Distance of the top left window corner from the left edge of the screen in pixels. */ left: number; /** * Window width in pixels. */ width: number; /** * Window height in pixels. */ height: number; [key: string]: number | undefined; } /** * Describes the size of the window. */ export interface Size { /** * Window width in pixels. */ width?: number; /** * Window height in pixels. */ height?: number; } /** * Options for creating flydown windows. */ export interface FlydownOptions { /** * Array of defined zones which when triggered will show a flydown window. */ zones: FlydownZone[]; /** * Range where the flydown will remain active. */ activeArea?: Bounds; /** * Default horizontal offset for all flydown zones in pixels. */ horizontalOffset?: number; /** * Default vertical offset for all flydown zones in pixels. */ verticalOffset?: number; /** * Location (`"bottom"`, `"top"`, `"left"`, `"right"` or `"none"`) where the flydown will appear, relative to the defined flydown zone. * If `"none"` is passed, the flydown will appear at `{ left: 0, top: 0 }` of the flydown trigger zone. */ targetLocation?: PopupTargetLocation; /** * ID of the window which will be used as a flydown window. */ windowId?: string; /** * Size of the rendered flydown window. * Can be an object with a specific size, or a callback that calculates the size. * The callback receives the flydown data and a function to cancel the flydown. */ size?: ((data: ShowFlydownData, cancel: () => void) => Promise<Size>) | Size; } /** * Describes a flydown window. */ export interface ShowFlydownData { /** * ID of the zone which triggered the flydown. */ zoneId: string; /** * Initial bounds of the flydown, if set before the callback is invoked. * If not set, this defaults to `{ left: 0, top: 0, height: 200, width: 200}`. */ flydownWindowBounds: Bounds; /** * ID of the window used as a flydown. */ flydownWindowId: string; } /** * Describes a flydown trigger zone. */ export interface FlydownZone { /** * Unique ID of the flydown trigger zone. */ id: string; /** * Size of the rendered flydown window. * Can be an object with a specific size, or a callback that calculates the size. * The callback receives the flydown data and a function to cancel the flydown. */ flydownSize?: ((data: ShowFlydownData, cancel: () => void) => Promise<Size>) | Size; /** * Bounds of the zone which can trigger a flydown window. * The bounds are relative to the target window, so the coordinates `{ left: 0, top: 0 }` * correspond to the top left corner of the target window, rather than the top left corner of the monitor. */ bounds: Bounds; /** * Location (`"bottom"`, `"top"`, `"left"`, `"right"` or `"none"`) where the flydown will appear, relative to the defined flydown zone. * If `"none"` is passed, the flydown will appear at `{ left: 0, top: 0 }` of the flydown trigger zone. */ targetLocation?: PopupTargetLocation; /** * ID of the window which will be used as a flydown window. */ windowId?: string; } /** * Flydown instance returned when creating flydown windows. */ export interface Flydown { /** * Function that clears all flydown trigger zones from the window when invoked. */ destroy: () => Promise<void>; /** * The options object used when the flydown was created. */ options: FlydownOptions; } /** * Options for creating popup windows. */ export interface PopupOptions { /** * ID of the window which will be used as a popup window. */ windowId: string; /** * Bounds of the area around which the popup will appear. */ targetBounds: Bounds; /** * Size of the rendered popup window. */ size: Size; /** * Location (`"bottom"`, `"top"`, `"left"`, `"right"` or `"none"`) where the popup will appear, relative to the defined popup area. * If `"none"` is passed, the popup will appear at `{ left: 0, top: 0 }` of the popup area. */ targetLocation: PopupTargetLocation; /** * Horizontal offset from the target bounds (applied only to `left` and `right` target locations). */ horizontalOffset?: number; /** * Vertical offset from the target bounds (applied only to `top` and `bottom` target locations). */ verticalOffset?: number; } /** * Location of the window (flydown or popup) relative to the defined trigger zone (flydown trigger zone or popup trigger area). */ export enum PopupTargetLocation { None = "none", Left = "left", Right = "right", Top = "top", Bottom = "bottom" } /** * Window loader settings. */ export interface Loader { /** * Enable or disable the loader. * @default true */ enabled?: boolean; /** * Hide the loader once the page is loaded. * @default true */ loaderHideOnLoad?: boolean; /** * Changes the loader animation speed. * @default 1 */ loaderSpeed?: number; /** * Changes the background of the loader page. * @default "#1C2D3B" */ loaderBackground?: string; /** * Type of the loading animation. * @default "DoubleBounce" */ loaderType?: string; /** * Sets a specific size in pixels for the loader animation. */ loaderSize?: number; /** * Sets a size factor for the loader animation relative to the window size. * @default 0.3 */ loaderSizeFactor?: number; /** * Text that will show below the loader animation. * @default "Loading" */ loaderText?: string; /** Size of the loader text. * @default 12 */ loaderTextSize?: number; /** * Color for the loader text. * @default "#F1F1F1" */ loaderTextColor?: string; /** * Interval in milliseconds after which the loader will be hidden. */ timeout?: number; } /** * Settings for a window detached from a window group. */ export interface DetachOptions { /** * Positions the new window relatively to an existing window. */ relativeTo?: GDWindow; /** * Direction for positioning the window relatively to the window specified in the `relativeTo` property. * Considered only if `relativeTo` is supplied. * Possible values are `"bottom"`, `"top"`, `"left"`and `"right"`. */ relativeDirection?: RelativeDirection; /** * Window width in pixels. */ width?: number; /** * Window height in pixels. */ height?: number; /** * Window bounds. */ bounds?: Partial<Bounds>; /** * If `true`, will show to window header. */ hideTabHeader?: boolean; } /** * Settings for a window being attached to a tab group. */ export interface AttachOptions { /** * Determines the position of the tab in the tab group. */ index?: number; /** * If `true`, the tab will be selected. */ selected?: boolean; } /** * Settings for a window extracted from a window group. */ export interface UngroupOptions { /** * Bounds for the extracted window. */ bounds?: Partial<Bounds>; /** * If `true`, the extracted window will be on focus. */ focus?: boolean; } /** * Relative direction for positioning the window. * @default "right" */ export type RelativeDirection = "top" | "left" | "right" | "bottom"; /** * Options for snapping a window to another window or a window group. */ export interface SnappingOptions { /** * Direction for snapping the window relative to the target window. */ direction?: RelativeDirection; /** * If `true`, the bounds of the window will be aligned automatically to the neighboring windows * when snapping it to another window or a window group. */ autoAlign?: boolean } /** * Glue42 Window mode. * @default "flat" */ export type WindowMode = "html" | "flat" | "tab" | "frameless"; /** * Window state. * @default "normal" */ export type WindowState = "normal" | "maximized" | "minimized"; /** * Options for capturing a display. */ export interface CaptureOptions { /** * Size of the output image. Can be relative or absolute. */ size?: Displays.ScaleOptions | Displays.AbsoluteSizeOptions; } /** * Configuration settings for overriding the default global Glue42 Windows settings. */ export interface WindowsConfiguration { /** * If `true`, the caption of window groups won't be visible. */ hideGroupCaption?: boolean; /** * If `true`, the "Sticky" button will be visible. */ showStickyButton?: boolean; /** * If `true`, the "Extract" button will be visible. */ showExtractButton?: boolean; /** * If `true`, the "Feedback" button will be visible. */ showFeedbackButton?: boolean; /** * If `true`, the Glue42 Windows will be able to stick to each other and form groups. */ sticky?: boolean; /** * Sets the distance in pixels at which the approaching edges of Glue42 Windows will be highlighted indicating that the windows will be snapped together. */ approachingDistance?: number; /** * If `true`, the bounds of the Glue42 Window will be aligned automatically to the neighboring windows when adding it to a Glue42 Window group. */ autoAlign?: boolean; } /** * Configuration options for a Glue42 Window. */ export interface WindowConfiguration { /** * If `true`, the window will have move areas and the user will be able to move it. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default true */ hasMoveAreas?: boolean; /** * If `true`, the user will be able to resize the window by dragging its borders. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default true */ hasSizeAreas?: boolean; /** * How much of the window area is to be considered as a moving area. * The string value corresponds to the left, top, right and bottom borders of the window. * Setting this to "0, 20, 0, 0" will set a 20 pixel thick move area at the top of the window. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 12, 0, 0" */ moveAreaThickness?: string; /** * Margin for the move area located at the left border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "0, 10, 0, 10" will take away 10 pixels from the top and the bottom of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaLeftMargin?: string; /** * Margin for the move area located at the top border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "10, 0, 10, 0" will take away 10 pixels from the left and the right sides of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaTopMargin?: string; /** * Margin for the move area located at the right border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "0, 10, 0, 10" will take away 10 pixels from the top and the bottom of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaRightMargin?: string; /** * Margin for the move area located at the bottom border of the window. The string value corresponds to the left, top, right and bottom borders of the move area. * Setting this to "10, 0, 10, 0" will take away 10 pixels from the left and the right sides of the move area. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "0, 0, 0, 0" */ moveAreaBottomMargin?: string; /** * How much of the window area in pixels is to be considered as a sizing area. * The string value corresponds to the left, top, right and bottom borders of the window. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "5, 5, 5, 5" */ sizeAreaThickness?: string; /** * Determines the conditions under which the window buttons will be visible. * Valid only for Glue42 Windows with `mode` set to `"html"`. * @default "onDemand" */ buttonsVisibility?: "off" | "onDemand" | "always" | "onFocus"; } /** * Options for printing PDF files. */ export interface PrintToPDFOptions { /** * If `true`, will autosave the file without asking the user where to save it. If `false`, a system save dialog will appear. * @default false */ autoSave?: boolean; /** * If `true`, will open the folder that contains the PDF file. * @default false */ autoOpenPath?: boolean; /** * If `true`, will open the PDF file. * @default false */ autoOpen?: boolean; /** * Header and footer for the PDF. */ headerFooter?: { /** * Title for the PDF header. */ title?: string; /** * URL for the PDF footer. */ url?: string; }; /** * Set to `true` for landscape layout, `false` for portrait layout. */ landscape?: boolean; /** * Specifies the type of margins to use. Use 0 for default margin, 1 for no * margin, and 2 for minimum margin. */ marginsType?: number; /** * The scale factor of the web page. Can range from 0 to 100. */ scaleFactor?: number; /** * The page range to print. */ pageRanges?: PageRange[]; /** * Page size of the generated PDF file. */ pageSize?: ("A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid") | Size; /** * If `true`, will print CSS backgrounds. */ printBackground?: boolean; /** * If `true`, will print selection only. */ printSelectionOnly?: boolean; } /** * Options for printing web pages. */ export interface PrintOptions { /** * If `true`, will ask the user for print settings. * @default false */ silent?: boolean; /** * Prints the background color and image of the web page. * @default false */ printBackground?: boolean; /** * Set the printer device name to use. Must be the system-defined name and not the user-friendly name. */ deviceName?: string; /** * If `true`, the printed web page will be in color. Set to `false` for grayscale. * @default true */ color?: boolean; /** * Margins for the printed web page. */ margins?: Margins; /** * If `true`, the web page will be printed in landscape mode. * @default false */ landscape?: boolean; /** * Scale factor of the web page. */ scaleFactor?: number; /** * Number of pages to print per sheet. */ pagesPerSheet?: number; /** * If `true`, the web page will be collated when printing multiple copies. */ collate?: boolean; /** * The number of copies of the web page to print. */ copies?: number; /** * Page range to print. */ pageRanges?: PageRange[]; /** * Duplex mode for the printed web page. */ duplexMode?: "simplex" | "shortEdge" | "longEdge"; /** * Print resolution in pixels. */ dpi?: { horizontal?: number; vertical?: number; }; /** * String to be printed as a page header. */ header?: string; /** * String to be printed as a page footer. */ footer?: string; /** * Page size for the printed web page. */ pageSize?: ("A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid") | Size; } /** * Page range to print. */ export interface PageRange { /** * Index of the first page to print (0-based). */ from: number; /** * Index of the last page to print (inclusive, 0-based). */ to: number; } /** * Margins for the printed web page. */ export interface Margins { /** * Margin type. If `"custom"` is chosen, `top`, `bottom`, `left` and `right` must also be specified. */ marginType?: "default" | "none" | "printableArea" | "custom"; /** * Top margin for the printed web page in pixels. */ top?: number; /** * Bottom margin for the printed web page in pixels. */ bottom?: number; /** * Left margin for the printed web page in pixels. */ left?: number; /** * Right margin for the printed web page in pixels. */ right?: number; } /** * Describes the window position relative to the screen. */ export interface PlacementSettings { /** * If `true`, the Glue42 Window will remain snapped to the specified screen position even in cases of resolution changes, * window visibility changes or when the app virtualization window hosting the Glue42 Window has been resized. * However, this doesn't include any API calls or manual user interaction which affect the window placement or bounds. * If `false`, the window will be positioned at the specified screen location only once when created. */ snapped: boolean; /** * Vertical alignment for the placed window. If `horizontalAlignment` is set, then `verticalAlignment` will default to "stretch". */ verticalAlignment?: "top" | "bottom" | "center" | "stretch"; /** * Horizontal alignment for the placed window. If `verticalAlignment` is set, then `horizontalAlignment` will default to "stretch". */ horizontalAlignment?: "left" | "right" | "center" | "stretch"; /** * Top margin for the placed window. Use a `number` to define the value in pixels, or use a `string` to define the value in pixels * or in percentage of the screen - e.g., `"10px"` or `"10%"`. */ top?: number | string; /** * Right margin for the placed window. Use a `number` to define the value in pixels, or use a `string` to define the value in pixels * or in percentage of the screen - e.g., `"10px"` or `"10%"`. */ right?: number | string; /** * Bottom margin for the placed window. Use a `number` to define the value in pixels, or use a `string` to define the value in pixels * or in percentage of the screen - e.g., `"10px"` or `"10%"`. */ bottom?: number | string; /** * Left margin for the placed window. Use a `number` to define the value in pixels, or use a `string` to define the value in pixels * or in percentage of the screen - e.g., `"10px"` or `"10%"`. */ left?: number | string; /** * Defines the window width. * Use a `number` to define the width in pixels. Use a `string` to define the width in pixels or percentage of the screen width - e.g., "10px" or "10%". */ width?: number | string; /** * Defines the window height. * Use a `number` to define the height in pixels. Use a `string` to define the height in pixels or percentage of the screen height - e.g., "10px" or "10%". */ height?: number | string; /** * Defines the current display. */ display?: Glue42.Displays.Display | "current"; } /** * Modes for flashing the window icon in the taskbar: * - `"auto"` - the icon will flash only if the window isn't on focus and will stop flashing when the window is activated; * - `"force"` - the icon will flash even if the window is on focus, but still turns off when the window is activated; * - `"forceAndKeep"` - the icon will flash until the `flash()` method is called with `false` as an argument; * @default "auto" */ export type FlashMode = "auto" | "force" | "forceAndKeep" /** * Describes the window neighbors of a Glue42 Window. */ export interface Neighbours { /** * Window neighbors on the left side of the Glue42 Window. */ leftNeighbours: GDWindow[]; /** * Window neighbors on top of the Glue42 Window. */ topNeighbours: GDWindow[]; /** * Window neighbors on the right side of the Glue42 Window. */ rightNeighbours: GDWindow[]; /** * Window neighbors to the bottom of the Glue42 Window. */ bottomNeighbours: GDWindow[]; } /** * Options for downloading a file. */ export interface DownloadOptions { /** * If `true`, won't show the download bar on the page. * @default false */ silent?: boolean; /** * If specified, will be used as a name for the downloaded file. */ name?: string; /** * If `true`, will open the folder that contains the downloaded file after the download is completed. * @default false */ autoOpenPath?: boolean; /** * If `true`, will open the download file after the download is completed. * @default false */ autoOpenDownload?: boolean; } /** * Describes the result from downloading a file. */ export interface DownloadResult { /** * URL to the downloaded file. */ url: string; /** * Size of the downloaded file. */ size: number; /** * Location of the downloaded file. */ path: string; } /** * Settings for app jump lists. */ export interface JumpListSettings { /** * If `true`, will enable jump lists. When the user right-clicks on the taskbar icon of a Glue42 app * (or on grouped taskbar icons), the context menu will show predefined categorized lists with actions. * @default true */ enabled: boolean; /** * Categorized lists with actions to execute when the user clicks on them. */ categories: JumpListCategorySettings[] } /** * Settings for a jump list category. */ export interface JumpListCategorySettings { /** * Title of the category to be displayed in the context menu. */ title: string; /** * List of actions contained in the category. */ actions: JumpListActionSettings[]; } /** * Settings for a jump list action. */ export interface JumpListActionSettings { /** * Icon for the action to be displayed in the context menu. */ icon: string; /** * Callback that will be executed when the user clicks on the action. */ callback: () => Promise<void>; /** * Title of the action to be displayed in the context menu when there is a single instance with a single taskbar icon. */ singleInstanceTitle: string; /** * Title of the action to be displayed in the context menu when there are multiple instances with grouped taskbar icons. */ multiInstanceTitle: string; } /** * Options for moving a file from a web page to the OS. */ export interface StartDragOptions { /** * Type of the file to be moved. */ type: "file" | "base64" | "base64url" | "utf8"; /** * File data in string format. */ data: string; /** * Icon that will be shown under the mouse cursor when the user drags the file. */ icon?: string; /** * Name for the file. */ filename?: string; } /** * Options for closing a Glue42 Window. */ export interface CloseOptions { /** * If `true`, will enable the window to prevent closing. */ allowPrevent?: boolean; /** * If `true`, a confirmation dialog will be shown before closing the window. */ showDialog?: boolean } /** * Options for the `prevent()` function passed as an argument to the `onClosing()` method when a Glue42 Window is about to be closed. */ export interface PreventClosingOptions { /** * If `true`, a confirmation dialog will be shown before closing the window. */ showDialog?: boolean } /** * API for managing window groups. */ export interface GroupsAPI { /** * Returns the current group of the window. */ my: Group; /** * Lists all window groups. * @param success Callback function for handling the successfully returned result. */ list(success?: (groups: Group[]) => void): Group[]; /** * Finds a group by a provided window object or window ID. * @param winId A Glue42 Window object or a window ID by which to find a window group. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ findGroupByWindow(winId: string | GDWindow, success?: (group: Group) => void, error?: (error: string) => void): Group; /** * Waits for a group to be loaded (e.g., when the group is still in the pool). * @param groupId ID of the group to be awaited. */ waitForGroup(groupId: string): Promise<Glue42.Windows.Group>; /** * Hibernates a window group. * @param groupId ID of the window group to hibernate. * @since Glue42 3.21 */ hibernate(groupId: string): Promise<string>; /** * Resumes a previously hibernated window group. * @param groupId ID of the window group to resume. * @param activate Flag indicating whether to activate the group and focus the last focused app window. * @since Glue42 3.21 */ resume(groupId: string, activate?: boolean): Promise<void>; /** * Notifies when a new window group is added. * @param callback Callback function for handling the event. */ onGroupAdded(callback: (group: Glue42.Windows.Group) => void): UnsubscribeFunction; /** * Notifies when a window group is removed. * @param callback Callback function for handling the event. */ onGroupRemoved(callback: (group: Glue42.Windows.Group) => void): UnsubscribeFunction; /** * Notifies when a window group is hibernated. * @param callback Callback function for handling the event. * @since Glue42 3.21 */ onHibernated(callback?: (groupId: string) => void): () => void; /** * Notifies when a window group is resumed. * @param callback Callback function for handling the event. * @since Glue42 3.21 */ onResumed(callback?: (group: Glue42.Windows.Group) => void): () => void; } /** * Type of the dialog to show. Can be either a predefined Glue42 dialog type, or a custom one. * * - `YesNo` - dialog with "Yes" and "No" buttons; * - `YesNoCancel` - dialog with "Yes", "No" and "Cancel" buttons; * - `OkCancel` - dialog with "OK" and "Cancel" buttons; * - `Ok` - dialog with "OK" button; * - `Custom` - custom dialog; * - `SingleInputDialog` - dialog with a text input field; */ export const enum DialogType { YesNo = "YesNo", YesNoCancel = "YesNoCancel", OkCancel = "OkCancel", Ok = "Ok", Custom = "Custom", SingleInputDialog = "SingleInputDialog" } /** * Mode for the dialog. * * - `WindowContainer` - only the container (a Workspaces Frame, or a Glue42 Window group) of the window that is showing the dialog will be blocked for user interaction; * - `Global` - all visible containers (including frameless Glue42 Windows) will be blocked. All windows within a blocked container are blocked too; */ export const enum DialogMode { WindowContainer = "WindowContainer", Global = "Global" } /** * Options for showing a dialog. */ export interface DialogOptions { /** * Mode for the dialog. */ mode?: DialogMode; /** * Type of the dialog to show. Can be either a predefined Glue42 dialog type, or a custom one. */ type: DialogType | string; /** * Size for the dialog to show. */ size?: Size; /** * Message to the user that the dialog will contain. */ message: string; /** * If `true`, the user will be able to move the dialog. * @default true */ movable?: boolean; /** * If `true`, the Glue42 Window containing the dialog will be transparent. * @default false */ transparent?: boolean; /** * Title for the dialog to show. */ title?: string; /** * Context data that can be used by a custom dialog. */ context?: unknown; /** * Name for the affirmative response button. */ affirmativeButtonName?: string; /** * If `true`, the affirmative response button will be shown in the dialog. The default value is for custom dialogs, predefined dialog types have different defaults. * @default false */ showAffirmativeButton?: boolean; /** * Name for the canceling button. */ cancelButtonName?: string; /** * If `true`, the canceling button will be shown in the dialog. The default value is for custom dialogs, predefined dialog types have different defaults. * @default false */ showCancelButton?: boolean; /** * Name for the negative response button. */ negativeButtonName?: string; /** * If `true`, the negative response button will be shown in the dialog. The default value is for custom dialogs, predefined dialog types have different defaults. * @default false */ showNegativeButton?: boolean; /** * Determines which dialog button to be the default one. * The action tied to the default button will be executed when the user presses `Enter` when no button is active * (i.e., when the buttons aren't on focus and none is selected). */ defaultAction?: "affirmative" | "negative" | "cancel"; /** * Interval in seconds after which the dialog will close automatically. * If `showTimer` is set to `true`, a countdown timer will be displayed in the dialog, * otherwise the dialog will close silently without a warning for the user. * If the user doesn't interact with the dialog before the timer expires, * the `action` property of the `DialogResult` object will be set to `"expired"`. */ timerDuration?: number; /** * If `true`, a countdown timer will be shown in the dialog, warning the user that the dialog will close automatically after the specified time. * You must also specify a value for `timerDuration`, otherwise a timer won't be shown. * @default false */ showTimer?: boolean; /** * The amount of characters that can be entered in the input field of a `SingleInputDialog`. * @since Glue42 3.22 */ inputMaxLength?: number; /** * String pattern that serves as a regular expression for validating the input from the user in a `SingleInputDialog`. * If such pattern is specified and the input doesn't match it, an error will be displayed and the input field * will indicate visually that the user input is invalid. * @since Glue42 3.22 */ inputPattern?: string; /** * Error message to be displayed if the user input doesn't match the specified validation pattern for a `SingleInputDialog`. * @since Glue42 3.22 */ inputPatternErrorMessage?: string; /** * Placeholder that will be displayed in the input field of a `SingleInputDialog`. * @since Glue42 3.22 */ inputPlaceholder?: string; } /** * Describes the result returned from showing a dialog. */ export interface DialogResult { /** * If the user clicks a button in the dialog, this will be set to `"clicked"`. If the dialog was closed using its "Close" button, this will be set to `"closed"`. * If the dialog has a timer and it expires before any user interaction occurs, this will be set to `"expired"`. */ action: "clicked" | "closed" | "expired", /** * Which button the user has clicked. */ button?: "negative" | "affirmative" | "cancel"; /** * The string value from the user input of a `SingleInputDialog` dialog. This value will be available * only when the value of the `button` property is `"affirmative"`. It will be an empty string if the * user did not enter a value. */ value?: string; } /** * Describes a window group. */ export interface Group { /** * ID of the current group. */ id: string; /** * Lists all windows in the group. */ windows: GDWindow[]; /** * If `true`, the header of the group is visible. */ isHeaderVisible: boolean; /** * If `true`, the window group is hibernated. * @since Glue42 3.21 */ isHibernated: boolean; /** * If `true`, the window group is visible. * @since Glue42 3.21 */ isVisible: boolean; /** * Finds a window by ID or by a window object. * @param window Window ID or a window object by which to find a window in the group. * @param success Callback function for handling the successfully returned result. */ find(window: string | GDWindow, success?: (window: GDWindow) => void): GDWindow; /** * Restores a window group. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ restore(success?: (group: Group) => void, error?: (error: string) => void): void; /** * Maximizes a window group. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ maximize(success?: (group: Group) => void, error?: (error: string) => void): void; /** * Shows the window group header. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ showHeader(success?: (group: Group) => void, error?: (error: string) => void): Promise<Group>; /** * Hides the window group header. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ hideHeader(success?: (group: Group) => void, error?: (error: string) => void): Promise<Group>; /** * Returns the current title of the window group. */ getTitle(): Promise<string>; /** * Changes the title of the window group. * @param title New title for the window group. */ setTitle(title: string): Promise<Group>; /** * Captures the entire window group as a Base64 encoded string. * @param options Options for capturing the window group. */ capture(options?: CaptureOptions): Promise<string>; /** * Shows a previously hidden window group. * @param activate Flag indicating whether to activate the group and focus the last focused app window. * @since Glue42 3.21 */ show(activate?: boolean): Promise<void>; /** * Hides a window group. * @since Glue42 3.21 */ hide(): Promise<void>; /** * Notifies when the visibility of the window group header is changed. * @param callback Callback function for handling the event. */ onHeaderVisibilityChanged(callback: (group: Group) => void): UnsubscribeFunction; /** * Notifies when a new window is added to the group. * @param callback Callback function for handling the event. */ onWindowAdded(callback: (group: Group, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a window is removed from the group. * @param callback Callback function for handling the event. */ onWindowRemoved(callback: (group: Group, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the visibility of a window group is changed. * @param callback Callback function for handling the event. * @since Glue42 3.21 */ onVisibilityChanged(callback: (group: Group) => void): UnsubscribeFunction; } /** * Window Management API */ export interface API { /** * API for managing window groups. */ groups: GroupsAPI; /** * Retrieves the current window. */ my(): GDWindow; /** * Opens a new Glue42 Window. * @param name Unique window name. * @param url URL to be loaded in the new window. * @param options Options for creating a new window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ open(name: string, url: string, options?: WindowCreateOptions, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Finds a window by name. * @param name Unique window name. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ find(name: string, success?: (window: GDWindow) => void, error?: (error: string) => void): GDWindow; /** * Finds a window by ID. * @param id Window ID. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ findById(id: string, success?: (window: GDWindow) => void, error?: (error: string) => void): GDWindow; /** * Lists all windows. * @param success Callback function for handling the successfully returned result. */ list(success?: (windows: GDWindow[]) => void): GDWindow[]; /** * Creates a flydown window. * @param targetWindowId ID of the window for which to create the flydown. * @param config Options for creating a flydown window. */ createFlydown(targetWindowId: string, config: FlydownOptions): Promise<Flydown>; /** * Creates a popup window. * @param targetWindowId ID of the window for which to create the popup. * @param config Options for creating a popup window. */ showPopup(targetWindowId: string, config: PopupOptions): Promise<void>; /** * Configures global Glue42 Windows settings. * @param options configuration options. */ configure(options: WindowsConfiguration): Promise<void>; /** * Notifies when the Window Management library has been fully initialized. */ ready(): Promise<any>; /** * Notifies when a new window is opened. * @param callback Callback function for handling the event. */ onWindowAdded(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Deprecated. Use `onWindowAdded()` instead. * @param callback Callback function for handling the event. * @ignore */ windowAdded(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a window is closed. * @param callback Callback function for handling the event. */ onWindowRemoved(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Deprecated. Use `onWindowRemoved()` instead. * @param callback Callback function for handling the event. * @ignore */ windowRemoved(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a tab window is attached to a tab group. * @param callback Callback function for handling the event. */ onTabAttached(callback: (tabWindow: GDWindow, newTabGroupId: string, tabHeaderVisible: boolean) => void): UnsubscribeFunction; /** * Notifies when a tab window is detached from a tab group. * @param callback Callback function for handling the event. */ onTabDetached(callback: (window: GDWindow, tabGroupId: string, oldTabGroupId: string) => void): UnsubscribeFunction; /** * Notifies when the window frame color is changed. * @param callback Callback function for handling the event. */ onWindowFrameColorChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a window receives focus. * @param callback Callback function for handling the event. */ onWindowGotFocus(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a window loses focus. * @param callback Callback function for handling the event. */ onWindowLostFocus(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Generic event handler. * @ignore * @param callback Callback function for handling the event. */ onEvent(callback: (stream: any) => void): UnsubscribeFunction; } /** * Describes a Glue42 Window. */ export interface GDWindow { /** * Type of the window. */ windowType: "electron" | "remote"; /** * Name of the current window. Window names are unique within the framework. */ name: string; /** * Interop instance corresponding to the window. */ hostInstance: Glue42Core.AGM.Instance | string; /** * Interop instance of the window. Used for easier access to the Interop API. */ agmInstance: Glue42.AGM.Instance | undefined; /** * URL of the current window. */ url: string; /** * ID of the current window. */ id: string; /** * The app associated with the current window. Can be `undefined` if the window wasn't started as an app. */ application: AppManager.Application | undefined; /** * Title of the current window. */ title: string; /** * Deprecated. Use `settings` instead. * The window styles of the current window. * @ignore */ windowStyleAttributes: WindowSettings; /** * Settings of the current window. */ settings: WindowSettings; /** * ID of the tab group in which the current window is located. */ tabGroupId: string; /** * Tab index of the current window. */ tabIndex: number; /** * The ID of the frame in which the window is placed. */ frameId: string; /** * Retrieves all frame buttons. */ frameButtons: ButtonInfo[]; /** * Retrieves the mode of the window. */ mode: WindowMode; /** * Retrieves the state of the window. */ state: WindowState; /** * If `true`, the window is collapsed. */ isCollapsed: boolean; /** * If `true`, the window is visible. */ isVisible: boolean; /** * If `true`, the window is locked. */ isLocked: boolean; /** * If `true`, the window is on focus. */ isFocused: boolean; /** * If `true`, the header of the window group is visible. */ isGroupHeaderVisible: boolean; /** * Deprecated. Use `getContext()` instead. Retrieves the context of the window. */ context: any; /** * Retrieves the bounds of the window. */ bounds: Bounds; /** * Retrieves the minimum height of the window in pixels. */ minHeight: number; /** * Retrieves the maximum height of the window in pixels. */ maxHeight: number; /** * Retrieves the minimum width of the window in pixels. */ minWidth: number; /** * Retrieves the maximum width of the window in pixels. */ maxWidth: number; /** * Retrieves the color of the window frame. */ frameColor: string; /** * If `true`, the window is opened. */ opened: boolean; /** * Retrieves the group of the window. */ group: Group; /** * Retrieves the ID of the group of the window. */ groupId: string; /** * If `true`, the window will is able to stick to other windows. */ isSticky: boolean; /** * Retrieves the top neighbors of the window. */ topNeighbours: GDWindow[]; /** * Retrieves the left neighbors of the window. */ leftNeighbours: GDWindow[]; /** * Retrieves the right neighbors of the window. */ rightNeighbours: GDWindow[]; /** * Retrieves the bottom neighbors of the window. */ bottomNeighbours: GDWindow[]; /** * Retrieves the ID of the activity the window participates in (`undefined` if it is not part of an activity). * @ignore */ activityId: string; /** * Retrieves the ID of the window if the window is an activity window (`undefined` if it is not part of an activity). * @ignore */ activityWindowId: string; /** * Retrieves all tabs that are in the same tab group as the current window. Available only when the window is in `"tab"` mode. */ tabs: GDWindow[]; /** * If `true`, the tab header of the window is visible. */ isTabHeaderVisible: boolean; /** * If `true`, the tab window is selected. */ isTabSelected: boolean; /** * Retrieves the current zoom factor. */ zoomFactor: number; /** * Deprecated. Use `getDisplay()` instead. * @ignore */ screen: Glue42.Screen; /** * Retrieves the current placement settings. */ placementSettings: PlacementSettings; /** * API for managing window jump lists. */ jumpList: Glue42.Windows.JumpList; /** * Attaches a tab window to the current tab window. * @param tab The instance or the name of the tab window to attach. * @param options Settings for the attached tab. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ attachTab(tab: GDWindow | string, options?: number | AttachOptions, success?: () => void, error?: (error: string) => void): Promise<GDWindow>; /** * Detaches a tab window from the current tab window. * @param opt Settings for the detached window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ detachTab(opt: DetachOptions, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Maximizes a window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ maximize(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Restores a window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ restore(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Minimizes a window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ minimize(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Maximizes or restores the current window based on the current window state. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ maximizeRestore(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Collapses a window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ collapse(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Expands a window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ expand(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Collapses or expands the current window based on the current window state. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ toggleCollapse(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Focuses the current window. This is the same as calling `activate()`. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ focus(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Activates the current window. This is the same as calling `focus()`. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ activate(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Extracts the current window from the window group. If the window is part of a tab group, the entire tab group will be extracted. * @param options Settings for the extracted window. */ ungroup(options?: UngroupOptions): Promise<GDWindow | undefined>; /** * Moves and/or resizes the window. * @param dimension Location and size for the window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ moveResize(dimension: Partial<Bounds>, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Resizes a window to the specified size. * @param width Width in pixels to which to resize the window. * @param height Height in pixels to which to resize the window. */ resizeTo(width?: number, height?: number): Promise<GDWindow>; // resizeBy(width?: number, height?: number): Promise<GDWindow>; /** * Moves a window to the specified position on the screen. * @param top Distance in pixels from the top edge of the screen for the top window border. * @param left Distance in pixels from the left edge of the screen for the left window border. */ moveTo(top?: number, left?: number): Promise<GDWindow>; // moveBy(top?: number, left?: number): Promise<GDWindow>; /** * Sets the title of the current window. * @param title New title for the window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setTitle(title: string, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Sets the style of the current window. * @param styles An object defining the window frame buttons, window size constraints, focus and visibility. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. * @ignore */ setStyle(styles: WindowStyle, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Resets the visible buttons of the window frame. * @param buttons Describes which buttons to be shown on the window frame. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ resetButtons(buttons: WindowButtons, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Retrieves the visible buttons of the window frame. * @since Glue42 3.21 */ getButtons(): Promise<WindowButtons>; /** * Z-index setting for the window. * @param onTop If `true` is passed as an argument, the window will be set on top of the Z-order. * This, however, will last only until the window is visible and not joined to a Glue42 Window group. * If the window is hidden programmatically or the user snaps it to another Glue42 Window or window group, * it will no longer be on top of the Z-order when it becomes visible or when the user tears it off from the group. * If `"always"` is passed, the window will remain permanently on top of the Z-order, regardless of changes to its visibility * or whether it joins or leaves a Glue42 Window group. Note that because each Glue42 app window is in fact * in a Glue42 Window group container (even though being a single window), the `onTop` setting actually determines the Z-order * of the group container at the moment of its creation. Snapping a Glue42 Window to another Glue42 Window in reality destroys * the group container of the snapped window and that window joins the group container of the window to which it is being snapped. * Therefore, when joining a window with a specified `onTop` setting to another window or a window group, * its initial `onTop` value will be overwritten - either permanently (when set to `true`), or temporarily (when set to `"always"`). * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setOnTop(onTop: boolean | "always", success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Changes the size constraints of the window. * @param constraints Minimum and maximum width and height constraints for the window in pixels. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setSizeConstraints(constraints: SizeConstraints, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Retrieves the size constraints of the window. * @since Glue42 3.21 */ getSizeConstraints(): Promise<SizeConstraints>; /** * Changes the tooltip of a tab window. * @param tabTooltip Text to be used as a tooltip. */ setTabTooltip(tabTooltip: string): Promise<GDWindow>; /** * Retrieves the tooltip of a tab window. * @since Glue42 3.21 */ getTabTooltip(): Promise<string>; /** * Navigates the window to a new URL. * @param url URL to which to navigate. * @param options Options for loading the URL. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ navigate(url: string, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; navigate(url: string, options?: LoadURLOptions): Promise<GDWindow>; /** * Adds a frame button to the window. * @param buttonInfo Frame button settings. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ addFrameButton(buttonInfo: ButtonInfo, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Removes a frame button from the window. * @param buttonId ID of the button to remove. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ removeFrameButton(buttonId: string, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Hides or shows the current window. * @param toBeVisible Flag indicating whether the window will become visible or hidden. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setVisible(toBeVisible?: boolean, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Shows the current window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ show(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Hides the current window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ hide(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Closes the window. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. * @param options Options for closing the window that can be used to prevent closing the window and control whether to show a confirmation dialog before closing it. */ close(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; close(options?: Glue42.Windows.CloseOptions): Promise<boolean>; /** * Snaps the window to another window. * @param target ID or instance of the window to which to snap the current window. * @param direction Direction for snapping the window. Relative to the target window. * @param options Relative direction or options for snapping a window to another window or window group. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ snap(target: string | GDWindow, options?: SnappingOptions | RelativeDirection, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Shows a loader animation for the window or updates the loader properties (animation type, background or text). * @param options Settings for the loader animation. */ showLoader(options?: Loader): Promise<GDWindow>; /** * Hides the loader animation for the window. */ hideLoader(): Promise<GDWindow>; /** * Updates the window context. * @param context Context object with which to update the current context (or create a new one if it doesn't exist). * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ updateContext(context: any, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Locks the window. When in locked state, moving the window will result in moving the entire group (if it's part of any). * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ lock(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Unlocks the window. When in unlocked state, moving the window will result in tearing it out from the window group (if it's part of any). * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ unlock(success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Retrieves the window icon. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ getIcon(success?: (icon: string) => void, error?: (error: string) => void): Promise<string>; /** * Sets the window icon. * @param base64Image Icon as a Base64 encoded string. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setIcon(base64Image: string, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Sets the window frame color. * @param frameColor Can be a color name, such as "red", or a hexadecimal RGB or ARGB value. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setFrameColor(frameColor: string, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Hides or shows the tab header of the current window. * @param toBeVisible Flag indicating whether to show or hide the tab header. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. */ setTabHeaderVisible(toBeVisible?: boolean, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Shows a popup window. * @param config Options for the popup window. */ showPopup(config: PopupOptions): Promise<GDWindow>; /** * Creates a flydown window. * @param config Options for the flydown window. */ createFlydown(config: FlydownOptions): Promise<Flydown>; /** * Makes a window behave like a modal window when it's used as a flydown. * @param isModal Flag indicating whether the modal behavior is to be turned on or off. */ setModalState(isModal: boolean): Promise<void>; /** * Zooms in the window. */ zoomIn(): Promise<GDWindow>; /** * Zooms out the window. */ zoomOut(): Promise<GDWindow>; /** * Changes the zoom level. * @param factor Zoom factor. */ setZoomFactor(factor: number): Promise<GDWindow>; /** * @ignore * Opens the Chrome DevTools. */ showDevTools(): Promise<GDWindow>; /** * Captures a screenshot of the window. * @param options Options for capturing the window. */ capture(options: CaptureOptions): Promise<string>; /** * Makes the taskbar window icon flash (e.g., to prompt the user to take action). * @param options Flag indicating whether to start or stop flashing the taskbar window icon. Defaults to `true`. * @param mode Mode for determining the flashing behavior of the window taskbar icon. */ flash(options?: boolean, mode?: FlashMode): Promise<Glue42.Windows.GDWindow>; /** * Makes the tab of the window flash (e.g., to prompt the user to take action). * @param options Flag indicating whether to start or stop flashing the window tab. Defaults to `true`. */ flashTab(options?: boolean): Promise<Glue42.Windows.GDWindow>; /** * Moves the window to the center of the screen. * @param display Describes the display on which to center the window. */ center(display?: Glue42.Displays.Display): Promise<GDWindow>; /** * Retrieves the window URL. */ getURL(): Promise<string>; /** * Retrieves the window title. */ getTitle(): Promise<string>; /** * Retrieves the window bounds. */ getBounds(): Promise<Bounds>; /** * Retrieves the window context. */ getContext(): Promise<any>; /** * Sets the window context. */ setContext(context: any): Promise<GDWindow>; /** * Retrieves the display on which the window is located. */ getDisplay(): Promise<Glue42.Displays.Display>; /** * Enables or disables the stickiness of the current window. * @param isSticky Flag indicating whether the window will be able to stick to other windows. * @param success Callback function for handling the successfully returned result. * @param error Callback function for handling errors. * @since Glue42 3.11 */ setSticky(isSticky: boolean, success?: (window: GDWindow) => void, error?: (error: string) => void): Promise<GDWindow>; /** * Refreshes the current window. * @param ignoreCache Flag indicating whether to refresh the page with or without cache. Defaults to `false`. * @since Glue42 3.12 */ refresh(ignoreCache: boolean): Promise<GDWindow>; /** * Downloads a file. * @param url URL, data URL or blob which to download. * @param options Download options. * @since Glue42 3.13 */ download(url: string, options: DownloadOptions): Promise<DownloadResult>; /** * Configures the window. * @param options Configuration options. * @since Glue42 3.12 */ configure(options: WindowConfiguration): Promise<GDWindow>; /** * Retrieves the window configuration. * @since Glue42 3.21 */ getConfiguration(): Promise<WindowConfiguration>; /** * Retrieves the current Channel of the window, if any. */ getChannel(): Promise<string | undefined>; /** * Enables moving files from a web page to the OS when a user starts dragging a web page element. * Based on the Electron [Native File Drag & Drop](https://www.electronjs.org/docs/latest/tutorial/native-file-drag-drop) functionality. * @param options Options for the file that will be moved. * @since Glue42 3.18 */ startDrag(options: StartDragOptions): Promise<GDWindow>; /** * Retrieves all child windows of the window. */ getChildWindows(): Promise<GDWindow[]>; /** * Retrieves the parent window of the window. */ getParentWindow(): Promise<GDWindow | undefined>; /** * Prints the window web page. * @since Glue42 3.11 */ print(options?: PrintOptions): Promise<GDWindow | undefined>; /** * Prints the window web page as a PDF file. * @since Glue42 3.11 */ printToPDF(option?: PrintToPDFOptions): Promise<string | undefined>; /** * Places the window at the specified position. */ place(options: PlacementSettings): Promise<void>; /** * Makes the window navigate back to the previous web page. * @since Glue42 3.17 */ goBack(): Promise<void>; /** * Makes the window navigate forward to the next web page. * @since Glue42 3.17 */ goForward(): Promise<void>; /** * Joins a new Channel. * @param name The name of the Channel to join. */ joinChannel(name: string): Promise<void>; /** * Leaves the current Channel. */ leaveChannel(): Promise<void>; /** * Shows a dialog with a title, message and response buttons to the user. * @since Glue42 3.19 */ showDialog<T>(options: DialogOptions): Promise<T | DialogResult> /** * Notifies when a window is attached to the current window. * @param callback Callback function for handling the event. */ onWindowAttached(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a window is detached from the current window. * @param callback Callback function for handling the event. */ onWindowDetached(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the visibility of the window tab header changes. * @param callback Callback function for handling the event. */ onTabHeaderVisibilityChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is closed. * @param callback Callback function for handling the event. */ onClose(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window URL is changed. * @param callback Callback function for handling the event. */ onUrlChanged(callback: (url: string, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the title of the window is changed. * @param callback Callback function for handling the event. */ onTitleChanged(callback: (title: string, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a frame button is added. * @param callback Callback function for handling the event. */ onFrameButtonAdded(callback: (buttonInfo: ButtonInfo, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a frame button is removed. * @param callback Callback function for handling the event. */ onFrameButtonRemoved(callback: (buttonInfo: ButtonInfo, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when a frame button is clicked. * @param callback Callback function for handling the event. */ onFrameButtonClicked(callback: (buttonInfo: ButtonInfo, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is collapsed. * @param callback Callback function for handling the event. */ onCollapsed(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is expanded. * @param callback Callback function for handling the event. */ onExpanded(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is minimized. * @param callback Callback function for handling the event. */ onMinimized(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is maximized. * @param callback Callback function for handling the event. */ onMaximized(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is restored from minimized or maximized state to normal state. * @param callback Callback function for handling the event. */ onNormal(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the current window is attached to another window. * @param callback Callback function for handling the event. */ onAttached(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the current window is detached from another window. * @param callback Callback function for handling the event. */ onDetached(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window visibility changes. * @param callback Callback function for handling the event. */ onVisibilityChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window context is updated. * @param callback Callback function for handling the event. */ onContextUpdated(callback: (context: any, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is locked or unlocked. * @param callback Callback function for handling the event. */ onLockingChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window bounds are changed. * @param callback Callback function for handling the event. */ onBoundsChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window frame color is changed. * @param callback Callback function for handling the event. */ onFrameColorChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window focus is changed. * @param callback Callback function for handling the event. */ onFocusChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window stickiness is changed. * @param callback Callback function for handling the event. */ onStickyChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window group is changed. * @param callback Callback function for handling the event. */ onGroupChanged(callback: (window: GDWindow, newGroup: Group, oldGroup: Group) => void): UnsubscribeFunction; /** * Notifies when the active tab is changed. * @param callback Callback function for handling the event. */ onTabSelectionChanged(callback: (selectedWindow: GDWindow, previousWindow: GDWindow, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is about to be closed. * @param callback Callback function for handling the event. Returns a `Promise` that will be awaited * before the window is closed. The timeout for waiting is subject to configuration in Glue42 Enterprise. * A function for preventing the closing is passed to the callback as a parameter. */ onClosing(callback: (prevent: (options?: PreventClosingOptions) => void) => Promise<void>): void; /** * Notifies when the window is about to be refreshed. * @param callback Callback function for handling the event. Returns a `Promise` that will be awaited * before the window is refreshed. The timeout for waiting is subject to configuration in Glue42 Enterprise. * A function for preventing the refresh is passed to the callback as a parameter. */ onRefreshing(callback: (prevent: () => void) => Promise<void>): void; /** * Notifies when the zoom factor is changed. * @param callback Callback function for handling the event. */ onZoomFactorChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the placement settings for the window are changed. * @param callback Callback function for handling the event. */ onPlacementSettingsChanged(callback: (window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the neighbors of the window are changed. * @param callback Callback function for handling the event. */ onNeighboursChanged(callback: (neighbours: Glue42.Windows.Neighbours, window: GDWindow) => void): UnsubscribeFunction; /** * Notifies when the window is about to be navigated to a new URL. * @param callback Callback function for handling the event. */ onNavigating(callback: (args: { newUrl: string }) => Promise<void>): void; } /** * API for managing window jump lists. */ export interface JumpList { /** * API for managing jump list categories. */ categories: JumpListCategoriesAPI; /** * If `true`, jump lists are enabled. */ isEnabled(): Promise<boolean>; /** * Enables or disables jump lists. * @param enabled Flag indicating whether to enable or disable jump lists. */ setEnabled(enabled: boolean): Promise<void>; } /** * Describes a jump list category. */ export interface JumpListCategory { /** * Title of the category. */ title: string; /** * API for managing jump list actions within a category. */ actions: JumpListActionsAPI; } /** * API for managing jump list categories. */ export interface JumpListCategoriesAPI { /** * Lists all available jump list categories. */ list(): Promise<Glue42.Windows.JumpListCategory[]>; /** * Creates a jump list category. * @param title Title for the category. * @param actions List of objects describing the actions in the category. */ create(title: string, actions: Glue42.Windows.JumpListActionSettings[]): Promise<void>; /** * Removes a jump list category. * @param title Title of the category to remove. */ remove(title: string): Promise<void>; /** * Retrieves a jump list category. * @param title Title of the category to retrieve. */ find(title: string): Promise<Glue42.Windows.JumpListCategory>; } /** * API for managing jump list actions within a category. */ export interface JumpListActionsAPI { /** * Lists all available actions for the jump list category. */ list(): Promise<Glue42.Windows.JumpListActionSettings[]>; /** * Creates jump list actions for the category. * @param actions List of objects describing the actions to create. */ create(actions: Glue42.Windows.JumpListActionSettings[]): Promise<void>; /** * Removes actions from the jump list category. * @param actions List of objects describing the actions to remove. */ remove(actions: Glue42.Windows.JumpListActionSettings[]): Promise<void>; } } /** * @intro * The Glue42 Channels are globally accessed named contexts that allow users to dynamically group apps, * instructing them to work over the same shared data object. * When apps are on the same Channel, they share a context data object which they can monitor and/or update. * * The Channels API is accessible through the `glue.channels` object. */ namespace Channels { /** * Channels API */ export interface API { /** * Subscribes for data updates of the current Channel. Persisted after a Channel change. Returns an unsubscribe function. * @param callback Callback function to handle the received data. */ subscribe(callback: (data: any, context: ChannelContext, updaterId: string) => void): () => void; /** * Subscribes for data updates of a specified Channel. Returns a `Promise` that resolves with an unsubscribe function. * @param name The Channel to track. * @param callback Callback function to handle the received data. */ subscribeFor(name: string, callback: (data: any, context: ChannelContext, updaterId: string) => void): Promise<() => void>; /** * Updates the context of the current or a specified Channel. * @param data Data object with which to update the Channel context. * @param name The name of the Channel to update. If not provided, will update the current Channel. */ publish(data: any, name?: string): Promise<void>; /** * Retrieves a list of all Channel names. */ all(): Promise<string[]>; /** * Retrieves a list of all Channel contexts. */ list(): Promise<ChannelContext[]>; /** * Retrieves the context of a specified Channel. * @param name The name of the Channel whose context to retrieve. */ get(name: string): Promise<ChannelContext>; /** * Retrieves the context of the current Channel. */ getMy(): Promise<ChannelContext>; /** * Joins a new Channel by name. Leaves the current Channel. * @param name The name of the Channel to join. * @param windowId ID of a window which to join to a Channel. If not provided, will join the current window to the specified Channel. */ join(name: string, windowId?: string): Promise<void>; /** * Leaves the current Channel. * @param windowId ID of a window which to force to leave a Channel. If not provided, will force the current window to leave the current Channel. */ leave(windowId?: string): Promise<void>; /** * Retrieves the name of the current Channel. * @ignore */ current(): string; /** * Retrieves the name of the current Channel. */ my(): string; /** * Adds a new Channel. * @param info Initial Channel context. * @since Glue42 3.18 */ add(info: ChannelContext): Promise<ChannelContext>; /** * Removes a Channel. * @param channel The name of the Channel to remove. * @since Glue42 3.18 */ remove(channel: string): Promise<void> /** * Retrieves all windows on a specified Channel. * @since Glue42 3.12 */ getWindowsOnChannel(channel: string): Promise<Glue42.Windows.GDWindow[]>; /** * Retrieves all windows that can use Channels together with their current Channel. * @param filter Filter describing which windows to retrieve. If no filter is supplied, will return all windows that can use Channels. * @since Glue42 3.12 */ getWindowsWithChannels(filter?: WindowWithChannelFilter): Promise<WindowOnChannelInfo[]>; // remove(name: string): void; // ??? // onChannelAdded(cb: () => void): void; // onChannelRemoved(cb: () => void): void; // advanced 1 (list, join, leave) - use-cases: // * draw my own selector in my application or join leave channels based on some other condition // * participate if not in SW // advanced 2 - manage channels at runtime - use-cases: // * give the user of the system the ability to define/update channels from some UI // meta(name: string, meta: object): Promise<void>; // updates the meta of some context // advanced 3 - discover peers that are on the same channel: // * some apps might be interested who else is on their channel // * there might be some UI logic that for example groups all windows that are on the blue channel // apps(name?: string): Promise<any[]>; /** * Notifies when a Channel is changed. * @param callback Callback function for handling the event. * @ignore */ changed(callback: (channel: string) => void): () => void; /** * Notifies when a Channel is changed. Returns an unsubscribe function. * @param callback Callback function for handling the event. */ onChanged(callback: (channel: string) => void): () => void; } /** * Describes a Glue42 Window that can use Channels. */ export interface WindowOnChannelInfo { /** * The Glue42 Window object. */ window: Glue42.Windows.GDWindow; /** * The current Channel of the Glue42 Window. May be `undefined` if no Channel is selected. */ channel: string; /** * The name of the app of which the Glue42 Window is an instance. */ application: string; } /** * Filter that will be applied when looking for Glue42 Windows that can use Channels. */ export interface WindowWithChannelFilter { /** * Will retrieve only Glue42 Windows that are instances of the specified app. */ application?: string; /** * IDs of Glue42 Windows which to retrieve. */ windowIds?: string[]; /** * Will retrieve all Glue42 Windows that are on the specified Channel. */ channels?: string[]; } /** * Describes a Channel context. */ export interface ChannelContext { /** * Unique name of the Channel context. */ name: string; /** * Channel meta data (display name, color, image and more). */ meta: any; /** * Channel context data. */ data: any; } } /** * @intro * The Hotkeys API allows apps to register key combinations and receive notifications * when a key combination is pressed by the user irrespectively of whether the app is on focus or not. * Hotkeys are useful for web apps that don't have access to system resources and can't register global shortcuts. * * The Hotkeys API is accessible through the `glue.hotkeys` object. */ namespace Hotkeys { /** * Information about the hotkey. */ interface HotkeyInfo { /** * The key or key combination that will be used as a hotkey. */ hotkey: string; /** * Description of the hotkey. */ description?: string; } /** * Callback function that is invoked when the hotkey is activated. */ type HotkeyCallback = () => void; /** * Hotkeys API * @since Glue42 3.6 */ interface API { /** * Registers a hotkey. The same hotkey can be registered just once. * @param hotkey The key or key combination (as a string or as a `HotkeyInfo` object) that will be registered. * @param callback Callback function that will be invoked when the hotkey is activated. */ register(hotkey: string | HotkeyInfo, callback: HotkeyCallback): Promise<void>; /** * Unregisters a hotkey. Notifications will no longer be received about this hotkey. * @param hotkey The hotkey to unregister. */ unregister(hotkey: string): Promise<void>; /** * Unregister all hotkeys registered by the current app. */ unregisterAll(): Promise<void>; /** * Whether the current app has registered a hotkey. * @param hotkey The name of the hotkey you want to check. */ isRegistered(hotkey: string): void; } } /** * @intro * In certain workflow scenarios, your app may need to start (or activate) a specific app. * For instance, you may have an app showing client portfolios with financial instruments. * When the user clicks on an instrument, you want to start an app which shows a chart for that instrument. * In other cases, you may want to present the user with several options for executing an action or handling data from the current app. * The Intents API makes all that possible by enabling apps to register, find and raise Intents. * * The Intents API is accessible through the `glue.intents` object. */ namespace Intents { /** * Intents API * @since Glue42 3.9 */ export interface API { /** * Raises an intent. * @param request The name of the Intent to raise, or an `IntentRequest` object holding * settings for targeting Intent handlers, passing context, app start options and more. */ raise(request: string | IntentRequest): Promise<IntentResult>; /** * Retrieves all registered Intents. */ all(): Promise<Intent[]>; /** * Deprecated. Use `register()` instead. * @param intent The intent to be handled, or an object specifying the Intent name and additional settings for handling the Intent. * @param handler Handler function for the raised Intent. * @ignore */ addIntentListener(intent: string | AddIntentListenerRequest, handler: (context: IntentContext) => any): { unsubscribe: UnsubscribeFunction }; /** * Registers an Intent handler. If your app is already registered as an Intent handler through its configuration, * use this method to supply a handler for the specified Intent. Otherwise, you can use it to register your app as an Intent handler * dynamically at runtime. Dynamically registered Intent handlers share the life span of the respective app instance. * @param intent The name of the Intent to be handled, or an object specifying the Intent name and additional settings for handling the Intent. * @param handler Handler function for the raised Intent. */ register(intent: string | AddIntentListenerRequest, handler: (context: IntentContext) => any): Promise<{ unsubscribe: UnsubscribeFunction }>; /** * Retrieves Intents by a specified filter. If no filter is supplied, all available Intents will be retrieved. * @param intentFilter can be the intent name or a IntentFilter filtering criteria. */ find(intentFilter?: string | IntentFilter): Promise<Intent[]>; /** * API for controlling the Intents Resolver UI app. */ resolver?: Resolver; } /** * Global Intent API settings. */ // eslint-disable-next-line @typescript-eslint/no-shadow export interface Config { /** * If `true`, will enable using the Intents Resolver UI for handling raised Intents. * The Intents Resolver UI provides the user with a list of all available apps and running instances which can handle the raised Intent. * In case there is only one Intent handler available, it will be automatically selected for handling the raised Intent, * without displaying the Intents Resolver UI to the user. * @default true */ enableIntentsResolverUI?: boolean; /** * Specify the name of your custom Intents Resolver app to be used for raised Intents. * If not provided, the Intents API will use the default Intents Resolver UI app. */ intentsResolverAppName?: string; /** * Interval in milliseconds to wait for a response from Intents Resolver UI. * @default 60000 */ methodResponseTimeoutMs?: number; } /** * API for controlling the Intents Resolver UI app. */ export interface Resolver { /** * Name of the raised Intent. */ intent: string; /** * Notifies when a handler for the current Intent is added. Replays already existing handlers. * @param callback Callback function for handling the event. */ onHandlerAdded(callback: (handler: ResolverIntentHandler) => void): UnsubscribeFunction; /** * Notifies when a handler for the current Intent is removed. * @param callback Callback function for handling the event. */ onHandlerRemoved(callback: (removedHandler: ResolverIntentHandler) => void): UnsubscribeFunction; /** * Sends the chosen Intent handler to the app which raised the Intent. */ sendResponse(handler: ResolverIntentHandler): Promise<Glue42.Interop.InvocationResult | undefined>; } /** * Object used in the Intents Resolver API for describing an Intent handler app. */ interface ResolverIntentHandler { /** * Name of the Intent handler app. */ applicationName: string; /** * Icon of the Intent handler app. */ applicationIcon?: string; /** * ID of the Intent handler app instance. */ instanceId?: string; } /** * Object used for defining Intents dynamically. Dynamically registered Intent handlers share the life span of the respective app instance. */ export interface AddIntentListenerRequest { /** * Name of the Intent to register. */ intent: string; /** * The types of predefined data structures with which the app can work. */ contextTypes?: string[]; /** * The human readable name of the Intent. Can be used in context menus or other UI elements to visualize the Intent. */ displayName?: string; /** * Icon for the Intent to be displayed in a UI. */ icon?: string; /** * Description for the Intent. */ description?: string; /** * The type of predefined data structure which the Intent handler returns. */ resultType?: string; } /** * Filter for retrieving Intents. */ export interface IntentFilter { /** * Name of the Intent to retrieve. */ name?: string; /** * The type of predefined data structure with which the Intent handler works. */ contextType?: string; /** * The type of predefined data structure which the Intent handler returns. */ resultType?: string; } /** * Describes an Intent. */ export interface Intent { /** * Name of the Intent. */ name: string; /** * Collection of objects describing Intent handler implementations for the Intent. */ handlers: IntentHandler[]; } /** * Describes an Intent handler implementation. */ export interface IntentHandler { /** * Name of the app that has registered the Intent, as specified in the app configuration. */ applicationName: string; /** * Title of the app that has registered the Intent, as specified in the app configuration. */ applicationTitle?: string; /** * User-friendly description of the app, as specified in the app configuration. */ applicationDescription?: string; /** * Icon of the app that has registered the Intent handler, as specified in the app configuration. */ applicationIcon?: string; /** * The type of the Intent handler - an app declared as an Intent handler via its configuration, * or a running instance of an app. Dynamically registered Intent handlers are also counted as running instances. */ type: "app" | "instance"; /** * The human readable name of the Intent, as specified in the Intent definition. */ displayName?: string; /** * The types of predefined data structures with which the Intent handler works. */ contextTypes?: string[]; /** * ID of the running app instance. */ instanceId?: string; /** * Title of the window of the running app instance. */ instanceTitle?: string; /** * The type of predefined data structure which the Intent handler returns. */ resultType?: string; } /** * Describes a request for raising an Intent. */ export interface IntentRequest { /** * Name of the intent to raise. */ readonly intent: string; /** * Target for the raised Intent. Use `"startNew"` to start a new instance of the first available Intent handler. * Use `"reuse"` to reuse the first available running instance of an Intent handler. Will fall back to `"startNew"` if there are no running instances available. * Use an object with optional `app` and `instance` properties to target specific apps or app instances. * The `app` property accepts an app name, the `instance` property - an ID of a running app instance. * Provide a value for the `app` property to start a new instance of a specific Intent handler app. * Provide a value for the `instance` property to reuse a specific running instance of an Intent handler. * If both `app` and `instance` are set, `instance` will take precedence. */ readonly target?: "startNew" | "reuse" | { app?: string; instance?: string }; /** * Context data that will be provided to the Intent handler. */ readonly context?: IntentContext; /** * `ApplicationStartOptions` object that will be passed to a newly started app instance, if such is to be used as an Intent handler. */ readonly options?: AppManager.ApplicationStartOptions; /** * Collection of Intent handlers that can be presented to the user via an Intents Resolver UI. If there isn't an Intents Resolver app available * (or if the list consists of only one handler), the first member of the collection will be used as an Intent handler. */ readonly handlers?: IntentHandler[]; /** * Interval in milliseconds to wait for the `raise()` method to resolve when raising an Intent. * @default 90000 * @since Glue42 3.21 */ readonly timeout?: number; /** * If `true`, the framework will wait for the user to choose a handler for the raised Intent from the Intents Resolver UI * before starting the timeout specified in the `timeout` property of the Intent request. * Otherwise, the timeout will start when the `raise()` method is invoked. * @default false * @since Glue42 3.21 */ readonly waitUserResponseIndefinitely?: boolean; } /** * Describes the predefined data structure that will be passed to an Intent handler. */ export interface IntentContext { /** * Type of the predefined data structure. */ readonly type?: string; /** * Data passed as an argument to the Intent handler implementation. */ readonly data?: { [key: string]: any }; } /** * Describes the result from a raised Intent. */ export interface IntentResult { /** * The `IntentRequest` object that was used for raising the Intent. */ request: IntentRequest; /** * The Intent handler implementation used for handling the Intent. */ handler: IntentHandler; /** * Data returned by the Intent handler implementation. */ result?: any; } } /** * @intro * The Notifications API allows you to raise notifications, handle notification and action clicks via Interop methods, * control the Notification Panel and subscribe for notification events. * * The Notifications API is accessible through the `glue.notifications` object. */ export namespace Notifications { /** * Notifications API * @since Glue42 3.9 */ export interface API { /** * The maximum number of notification actions that is supported. */ readonly maxActions: number; /** * API for controlling the Notification Panel. * @since Glue42 3.12.1 */ panel: NotificationPanelAPI; /** * Raises a new notification. * @param notification Object with options for the raised notification. */ raise(notification: Glue42NotificationOptions): Promise<Glue42Notification>; /** * Sets a filter with apps allowed or not allowed to raise notifications. * @param filter Filter with names of apps allowed or not allowed to raise notifications. */ setFilter(filter: NotificationFilter): Promise<NotificationFilter>; /** * Retrieves the current filter with apps allowed or not allowed to raise notifications. */ getFilter(): Promise<NotificationFilter>; /** * Configures the global notification settings. * @param options Object holding global notification settings. */ configure(options: Configuration): Promise<void>; /** * Retrieves the current global notification settings. */ getConfiguration(): Promise<Configuration>; /** * Retrieves a list of objects describing all available notifications. */ list(): Promise<Glue42.Notifications.NotificationData[]>; /** * Clears all notifications. * @since Glue42 3.22 */ clearAll(): Promise<void>; /** * Clears all notifications in the Notification Panel that the user has already seen. * @since Glue42 3.22 */ clearOld(): Promise<void>; /** * Clears a notification by ID. * @param id ID of the notification to clear. * @since Glue42 3.22 */ clear(id: string): Promise<void>; /** * Clicks programmatically a notification or a notification action. * @param id ID of the notification to click. * @param action ID of the action to click. * @since Glue42 3.22 */ click(id: string, action?: string): Promise<void>; /** * Sets the state of a notification. * @param id ID of the notification to change. * @param state Value for the new notification state. * @since Glue42 3.22 */ setState(id: string, state: State): Promise<void>; /** * Sets or updates the arbitrary data associated with the notification which is available in the `data` property of the notification. * @param id ID of the notification whose data to update. * @param data New notification data. * @since Glue42 3.24 */ updateData(id: string, data: unknown): Promise<void>; /** * Notifies when a new notification is raised. * @param callback Callback function for handling the event. * @since Glue42 3.22 */ onRaised(callback: (notification: Glue42.Notifications.NotificationData) => void): UnsubscribeFunction; /** * Notifies when the state of a notification is changed. * @param callback Callback function for handling the event. * @since Glue42 3.22 */ onStateChanged(callback: (notification: { id: string }, state: State) => void): UnsubscribeFunction; /** * Notifies when a notification is closed. * @param callback Callback function for handling the event. * @since Glue42 3.22 */ onClosed(callback: (notification: { id: string }) => void): UnsubscribeFunction; /** * Notifies when the global notification settings are changed. * @param callback Callback function for handling the event. * @param apps All apps that are allowed to raise notifications. * @since Glue42 3.22 */ onConfigurationChanged(callback: (config: Configuration, apps: number) => void): UnsubscribeFunction; /** * Notifies when the notification counter is changed. * @param callback Callback function for handling the event. * @since Glue42 3.22 */ onCounterChanged(callback: (info: { count: number }) => void): UnsubscribeFunction; /** * Notifies when the arbitrary data associated with the notification (available in the `data` property of the notification) is changed. * @param callback Callback function for handling the event. * @since Glue42 3.24 */ onDataChanged<T>(callback: (data: T) => void): UnsubscribeFunction } /** * API for controlling the Notification Panel. * @since Glue42 3.12.1 */ export interface NotificationPanelAPI { /** * Toggles the visibility of the Notification Panel. */ toggle(): Promise<void>; /** * Shows the Notification Panel. */ show(): Promise<void>; /** * Hides the Notification Panel. */ hide(): Promise<void>; /** * Checks whether the Notification Panel is visible. */ isVisible(): Promise<boolean>; /** * Notifies when the visibility of the Notification Panel changes. * @param callback Callback function for handling the event. * @since Glue42 3.22 */ onVisibilityChanged(callback: (isVisible: boolean) => any): UnsubscribeFunction; } /** * Filter with names of apps that are allowed or not allowed to raise notifications. */ export interface NotificationFilter { /** * Array of names of apps allowed to raise notifications. */ allowed?: string[]; /** * Array of names of apps not allowed to raise notifications. */ blocked?: string[]; } /** * Describes a notification action event. */ export interface ActionEvent { /** * The name of the notification action executed by the user. */ action: string; } /** * Notification state. * - `"Active"` - based on configuration, the notification is either visible as a toast, or is raised only in the Notification Panel, but the user hasn't seen it yet. * When the toast is hidden, the user clicks on the toast, or sees the notification in the Notification Panel, the state will change; * - `"Acknowledged"` - the user has seen the notification in the Notification Panel; * - `"Closed"` - the notification has either been closed from its "Close" button, or the user has clicked on it or on an action in it; * - `"Stale"` - the time specified in `toastExpiry` has elapsed; */ export type State = "Active" | "Acknowledged" | "Closed" | "Stale"; /** * Object describing a notification. */ export interface NotificationData extends Glue42NotificationOptions { /** * ID for the notification. */ id: string; /** * ID of the app instance that has raised the notification. */ instanceId: string; /** * Title of the app that has raised the notification. */ appTitle?: string; /** * Icon of the app that has raised the notification. */ appIcon?: string; /** * State of the raised notification. */ state?: State; /** * @ignore */ publishExtraEvents?: any } /** * Object describing a raised notification. */ export interface Glue42Notification extends NotificationData { /** * Array of objects describing the available notification actions. */ actions: Glue42NotificationAction[]; /** * Notifies when a notification action has been clicked. */ onaction: (ev: ActionEvent) => any; /** * Notifies when the notification has been clicked. */ onclick: (ev: Event) => any; /** * Notifies when the notification has been shown. */ onshow: (ev: Event) => any; /** * Notifies when the notification has been closed. */ onclose: (ev: Event) => any; /** * Closes the notification. */ close: () => void; } /** * Options for raising a notification. */ export interface Glue42NotificationOptions extends NotificationOptions { /** * Id for the notification. */ id?: string; /** * Title for the notification. */ title: string; /** * Array of objects describing notification actions. The notification actions will be displayed as buttons in the notification. */ actions?: Glue42NotificationAction[]; /** * Object with settings for invoking an Interop method when the notification is clicked. */ clickInterop?: InteropActionSettings; /** * Type of the notification. `"Notification"` is usually a general non-urgent notification, while `"Alert"` is an urgent one. */ type?: "Notification" | "Alert"; /** * Severity of the notification. */ severity?: "Low" | "Medium" | "High" | "Critical" | "None"; /** * Notification state. * @default "Active" */ state?: State; /** * Can be used for overwriting the name of the actual notification source. */ source?: string; /** * Interval in seconds after which the notification will be removed from the Notification Panel. */ panelExpiry?: number; /** * Interval in seconds after which the notification toast will be hidden. */ toastExpiry?: number; } /** * Object describing a notification action. */ export interface Glue42NotificationAction { /** * Name of the notification action. */ action: string; /** * Title of the notification action that will be used in the notification action button. */ title: string; /** * Icon for the notification action. */ icon?: string; /** * Object with settings for invoking an Interop method when the notification action is clicked. */ interop?: InteropActionSettings; } /** * Object with settings for invoking an Interop method when a notification or a notification action is clicked. */ export interface InteropActionSettings { /** * Name of the Interop method to invoke. */ method: string; /** * Object with arguments for the Interop method invocation. */ arguments?: any; /** * Specifies which Interop servers to target when invoking the Interop method - * `"all"` will invoke the method on all apps that have registered it, * while `"best"` will invoke it only on the first app that has registered it. */ target?: "all" | "best"; } /** * Global notification settings. */ export interface Configuration { /** * If `true`, will enable all notifications - notification toasts and notifications in the Notification Panel. */ enable?: boolean; /** * If `true`, will enable notification toasts. */ enableToasts?: boolean; /** * Filter with names of apps that are allowed or not allowed to raise notifications. */ sourceFilter?: Glue42.Notifications.NotificationFilter; /** * Interval in seconds after which the notification toasts will be hidden. */ toastExpiry?: number; toasts?: { mode?: "single" | "stacked"; stackBy?: "severity" | "application"; } } } /** * @intro * **Glue42 Enterprise** has two built-in themes - **Day** and **Night**. * You can control the themes programmatically by using the Themes API. * The themes can also be customized and new themes can be added through the `themes.json` configuration file. * * The Themes API is accessible through the `glue.themes` object. */ export namespace Themes { /** * Themes API * @since Glue42 3.10 */ export interface API { /** * Retrieves a list of the available themes. */ list(): Promise<Glue42.Themes.Theme[]>; /** * Retrieves the current theme. */ getCurrent(): Promise<Glue42.Themes.Theme>; /** * Selects a new theme. * @param name The name of the theme to select. */ select(name: string): Promise<void>; /** * Notifies when the theme is changed. * @param callback Callback function for handling the event. */ onChanged(callback: (theme: Glue42.Themes.Theme) => any): void; } /** * Describes a theme. */ export interface Theme { /** * Name of the theme. */ name: string; /** * Display name of the theme. */ displayName: string; } } /** * @docname App Preferences * @intro * The App Preferences API enables apps to store custom user-specific data and retrieve it when necessary. * This allows you to enhance the UX of your apps by instrumenting them to preserve specific user settings and apply them when the app is relaunched. * * The App Preferences API provides methods for updating, replacing and clearing user settings stored for the current or a specific app, * as well as for all apps of the current user. * * The App Preferences API is accessible through the `glue.prefs` object. */ export namespace Preferences { /** * App Preferences API * @since Glue42 3.12 */ export interface API { /** * Retrieves the user preferences for the current app. * @param app Name of the app for which to retrieve the user preferences. */ get(app?: string): Promise<AppPreferences | undefined>; /** * Replaces the user preferences for the current app. All existing properties will be removed and replaced with the ones supplied in the `data` object. * @param data Data to replace the existing user preferences. * @param options Object with an `app` property that accepts an app name as a value. Can be used to target a specific app whose user preferences to replace. */ set(data: any, options?: { app: string }): Promise<void>; /** Replaces the user preferences of a specified app. All existing properties will be removed and replaced with the ones supplied in the `data` object. * @param app Name of the app whose user preferences to replace. * @param data Data to replace the existing user preferences. */ setFor(app: string, data: any): Promise<void>; /** * Updates the preferences for the current app. The properties specified in the `data` object will be merged with the existing user preferences. * Other existing properties will remain intact, and non-existent ones will be added. * @param data Data to be merged with the existing user preferences. * @param options Object with an `app` property that accepts an app name as a value. Can be used to target a specific app whose user preferences to update. */ update(data: any, options?: { app: string }): Promise<void>; /** * Updates the preferences for a specified app. The properties specified in the `data` object will be merged with the existing user preferences. * Other existing properties will remain intact, and non-existent ones will be added. * @param app Name of the app whose user preferences to update. * @param data Data to be merged with the existing user preferences. */ updateFor(app: string, data: any): Promise<void>; /** * Removes the user preferences for the current app. */ clear(): Promise<void>; /** * Removes preferences of a specified app. * @param app Name of the app whose user preferences to remove. */ clearFor(app: string): Promise<void>; /** * Retrieves all preferences stored for the current user. */ getAll(): Promise<AppPreferences[]>; /** * Removes all preferences stored for the current user. */ clearAll(): Promise<void>; /** * Subscribes for changes to the user preferences of the current app. * @param callback Callback function that will be invoked once with the initial user preferences and after that on every change of the user preferences. * @since Glue42 3.14 */ subscribe(callback: (prefs: AppPreferences) => void): () => void; /** * Subscribes for changes to the user preferences of a specified app. * @param app Name of the app for which to subscribe. * @param callback Callback function that will be invoked once with the initial user preferences and after that on every change of the user preferences. * @since Glue42 3.14 */ subscribeFor(app: string, callback: (prefs: AppPreferences) => void): () => void; } /** * Describes the user preferences for an app. */ export interface AppPreferences { /** * Name of the app. */ app: string; /** * Object holding the user preferences as key/value pairs. */ data: any; /** * Timestamp of the last update of the user preferences. */ lastUpdate: Date; } } /** * Describes a screen. */ export interface Screen { /** * Screen height. */ height: number; /** * Whether this is the primary screen. */ isPrimary: boolean; /** * Horizontal coordinate of the top left corner of the screen. */ left: number; /** * Name of the screen assigned by the operating system. */ name: string; /** * Screen scale factor. */ scale: number; /** * Scale factor of the horizontal axis of the screen. */ scaleX: number; /** * Scale factor of the vertical axis of the screen. */ scaleY: number; /** * Vertical coordinate of the top left corner of the screen. */ top: number; /** * Screen width. */ width: number; /** * Height of the working area. */ workingAreaHeight: number; /** * Horizontal coordinate of the top left corner of the screen working area. */ workingAreaLeft: number; /** * Vertical coordinate of the top left corner of the screen working area. */ workingAreaTop: number; /** * Width of the working area. */ workingAreaWidth: number; } /** * @intro * The Cookies API enables your web app to manage cookies. You can get a list of cookies by applying a filter * that will be matched against all cookies, and also set and modify cookies, or remove cookies by name and URL. * * The Cookies API is accessible through the `glue.cookies` object. */ export namespace Cookies { /** * Cookies API * @since Glue42 3.16 */ export interface API { /** * Retrieves a list of cookies matching an optional filter object. If no filter is specified, will return all cookies. * @param filter Filter object that will be matched against all cookies. Only the cookies whose properties match the properties specified in the filter object will be returned. */ get(filter?: Glue42.Cookies.CookiesGetFilter): Promise<Glue42.Cookies.Cookie[]>; /** * Sets a cookie or modifies an existing one with the specified values. * @param cookie Object specifying which properties of the cookie to set. */ set(cookie: Glue42.Cookies.CookiesSetDetails): Promise<void>; /** * Removes a cookie with the specified URL and name. * @param url URL of the cookie to remove. * @param name Name of the cookie to remove. */ remove(url: string, name: string): Promise<void>; } /** * Filter object whose properties will be matched against all cookies to be retrieved. */ export interface CookiesGetFilter { /** * Retrieves the cookies which are associated with the specified URL. If not specified, will retrieve the cookies for all URLs. */ url?: string; /** * Filters the cookies by name. */ name?: string; /** * Retrieves the cookies whose domains match or are subdomains of the specified domain. */ domain?: string; /** * Retrieves the cookies whose path matches the specified path. */ path?: string; /** * Filters cookies by their `Secure` attribute. */ secure?: boolean; /** * If `true`, will return only the session cookies. If `false`, will return only the persistent cookies. */ session?: boolean; } /** * Describes the cookie to set. */ export interface CookiesSetDetails { /** * URL to associate with the cookie. */ url: string; /** * Name for the cookie. */ name?: string; /** * Value for the cookie. */ value?: string; /** * Domain for the cookie. Will be normalized with a preceding dot in order to be valid for subdomains too. */ domain?: string; /** * Path for the cookie. */ path?: string; /** * If `true`, the cookie will be marked with a `Secure` attribute. Default is `false`, unless the `SameSite` attribute has been set to `None`. * @default false */ secure?: boolean; /** * If `true`, the cookie will be marked with an `HttpOnly` attribute. * @default false */ httpOnly?: boolean; /** * The expiration date of the cookie as a number of seconds since the UNIX epoch. * If not specified, the cookie will become a session cookie and won't be persisted between sessions. */ expirationDate?: number; /** * The value to be applied to the `SameSite` attribute. If set to "no_restriction", the `secure` property will be set automatically to `true`. * @default "lax" */ sameSite?: ("unspecified" | "no_restriction" | "lax" | "strict"); } /** * Describes a cookie. */ export interface Cookie { /** * Domain for the cookie. Normalized with a preceding dot in order to be valid for subdomains too. */ domain?: string; /** * Expiration date of the cookie as a number of seconds since the UNIX epoch. Not available for session cookies. */ expirationDate?: number; /** * If `true`, the cookie has been flagged as a host-only cookie. Will be `true` only if the `domain` property hasn't been set. */ hostOnly?: boolean; /** * If `true`, the cookie has been marked with the `HttpOnly` attribute. */ httpOnly?: boolean; /** * Name of the cookie. */ name: string; /** * Path for the cookie. */ path?: string; /** * The value applied to the `SameSite` attribute. Can be `"unspecified"`, `"no_restriction"`, `"lax"` or `"strict"`. */ sameSite: ("unspecified" | "no_restriction" | "lax" | "strict"); /** * If `true`, the cookie has been marked with a `Secure` attribute. */ secure?: boolean; /** * If `true`, the cookie is a session cookie. If `false`, the cookie is a persistent cookie with an expiration date. */ session?: boolean; /** * Value of the cookie. */ value: string; } } } type NodeRequireFunction = (moduleName: "glue42") => typeof Glue42;