@openfin/workspace-platform 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-api/src/shapes.d.ts +596 -0
- package/{index.ts → client-api-platform/index.d.ts} +0 -0
- package/client-api-platform/src/api/app-directory.d.ts +7 -0
- package/client-api-platform/src/api/browser/browser-module.d.ts +13 -0
- package/client-api-platform/src/api/browser/index.d.ts +22 -0
- package/client-api-platform/src/api/pages/helper.d.ts +22 -0
- package/client-api-platform/src/api/pages/index.d.ts +30 -0
- package/client-api-platform/src/api/protocol.d.ts +47 -0
- package/client-api-platform/src/api/storage.d.ts +10 -0
- package/client-api-platform/src/api/workspace-module.d.ts +3 -0
- package/client-api-platform/src/index.d.ts +6 -0
- package/client-api-platform/src/init/browser-window-focus.d.ts +19 -0
- package/client-api-platform/src/init/cleanup.d.ts +1 -0
- package/client-api-platform/src/init/index.d.ts +5 -0
- package/client-api-platform/src/init/override-callback.d.ts +3 -0
- package/client-api-platform/src/init/utils.d.ts +39 -0
- package/{src/shapes.ts → client-api-platform/src/shapes.d.ts} +2 -29
- package/client-api-platform/src/umd.d.ts +1 -0
- package/common/src/api/pages/attached.d.ts +101 -0
- package/common/src/api/pages/idb.d.ts +12 -0
- package/common/src/api/pages/index.d.ts +16 -0
- package/common/src/api/pages/legacy.d.ts +16 -0
- package/common/src/api/pages/shapes.d.ts +77 -0
- package/common/src/api/protocol.d.ts +63 -0
- package/common/src/api/workspaces/index.d.ts +7 -0
- package/common/src/utils/application.d.ts +38 -0
- package/common/src/utils/channels.d.ts +8 -0
- package/common/src/utils/debounce.d.ts +16 -0
- package/common/src/utils/env.d.ts +30 -0
- package/common/src/utils/layout.d.ts +52 -0
- package/common/src/utils/local-storage-key.d.ts +8 -0
- package/common/src/utils/logger/index.d.ts +26 -0
- package/common/src/utils/logger/manager.d.ts +35 -0
- package/common/src/utils/logger/shapes.d.ts +27 -0
- package/common/src/utils/route.d.ts +55 -0
- package/common/src/utils/shared-emitter.d.ts +10 -0
- package/common/src/utils/snapshot.d.ts +33 -0
- package/common/src/utils/strings.d.ts +5 -0
- package/common/src/utils/umd.d.ts +2 -0
- package/common/src/utils/window.d.ts +146 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +1 -34
- package/search-api/src/client/index.d.ts +6 -0
- package/search-api/src/client/internal.d.ts +38 -0
- package/search-api/src/client/remote/channel-client-factory.d.ts +2 -0
- package/search-api/src/client/remote/channel-client.d.ts +9 -0
- package/search-api/src/client/remote/data.d.ts +16 -0
- package/search-api/src/client/remote/disconnect.d.ts +7 -0
- package/search-api/src/client/remote/dispatch.d.ts +9 -0
- package/search-api/src/client/remote/requests.d.ts +5 -0
- package/search-api/src/client/remote/search-close.d.ts +14 -0
- package/search-api/src/common.d.ts +104 -0
- package/search-api/src/errors.d.ts +5 -0
- package/search-api/src/fin/index.d.ts +6 -0
- package/search-api/src/fin/shapes.d.ts +23 -0
- package/search-api/src/index.d.ts +7 -0
- package/search-api/src/internal-shapes.d.ts +134 -0
- package/search-api/src/logger.d.ts +1 -0
- package/search-api/src/provider/index.d.ts +8 -0
- package/search-api/src/provider/internal.d.ts +33 -0
- package/search-api/src/provider/remote/channel-factory.d.ts +6 -0
- package/search-api/src/provider/remote/channel.d.ts +23 -0
- package/search-api/src/provider/remote/connection.d.ts +20 -0
- package/search-api/src/provider/remote/data.d.ts +23 -0
- package/search-api/src/provider/remote/deregistration.d.ts +5 -0
- package/search-api/src/provider/remote/disconnect.d.ts +1 -0
- package/search-api/src/provider/remote/disconnection.d.ts +9 -0
- package/search-api/src/provider/remote/dispatch.d.ts +7 -0
- package/search-api/src/provider/remote/info.d.ts +5 -0
- package/search-api/src/provider/remote/registration.d.ts +23 -0
- package/search-api/src/provider/remote/search-close.d.ts +14 -0
- package/search-api/src/provider/remote/search.d.ts +8 -0
- package/search-api/src/shapes.d.ts +541 -0
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -2
- package/.prettierrc.js +0 -2
- package/babel.config.js +0 -2
- package/jest.config.js +0 -2
- package/src/api/app-directory.ts +0 -45
- package/src/api/browser/browser-module.ts +0 -65
- package/src/api/browser/index.ts +0 -46
- package/src/api/pages/helper.ts +0 -113
- package/src/api/pages/index.ts +0 -164
- package/src/api/protocol.ts +0 -60
- package/src/api/storage.ts +0 -32
- package/src/api/workspace-module.ts +0 -36
- package/src/index.ts +0 -35
- package/src/init/browser-window-focus.ts +0 -59
- package/src/init/cleanup.ts +0 -87
- package/src/init/index.ts +0 -42
- package/src/init/override-callback.ts +0 -159
- package/src/init/utils.ts +0 -164
- package/src/umd.ts +0 -5
- package/tsconfig.json +0 -13
- package/webpack.common.config.js +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum Env {
|
|
2
|
+
Local = "local",
|
|
3
|
+
Dev = "dev",
|
|
4
|
+
Staging = "staging",
|
|
5
|
+
Prod = "prod"
|
|
6
|
+
}
|
|
7
|
+
export declare const isFin: boolean;
|
|
8
|
+
export declare const isJest: boolean;
|
|
9
|
+
export declare const isWindowDefined: boolean;
|
|
10
|
+
export declare const isDocumentDefined: boolean;
|
|
11
|
+
export declare const isWindowDefinedWithIndexDB: boolean;
|
|
12
|
+
export declare const finUUID: string;
|
|
13
|
+
export declare const finName: string;
|
|
14
|
+
export declare const finEntityType: "" | import("openfin-adapter/src/shapes/EntityType").EntityType;
|
|
15
|
+
export declare const env: Env;
|
|
16
|
+
export declare const isEnvLocal: boolean;
|
|
17
|
+
export declare const isEnvDev: boolean;
|
|
18
|
+
export declare const isEnvStaging: boolean;
|
|
19
|
+
export declare const isEnvProd: boolean;
|
|
20
|
+
export declare const isLibrary: boolean;
|
|
21
|
+
export declare const workspaceProviderFinsLink: string;
|
|
22
|
+
export declare const workspaceProviderFallbackUrl: string;
|
|
23
|
+
export declare const workspaceAppsUrl: string;
|
|
24
|
+
export declare const workspaceStorefrontFooterUrl: string;
|
|
25
|
+
export declare const workspaceStorefrontLandingPageUrl: string;
|
|
26
|
+
export declare const workspaceStorefrontNavigationUrl: string;
|
|
27
|
+
export declare const workspaceShareUrl: string;
|
|
28
|
+
export declare const workspaceCdnUrl: string;
|
|
29
|
+
export declare const workspaceCdnEnvUrl: string;
|
|
30
|
+
export declare const workspaceRuntimeVersion: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
export declare type LayoutComponentStateExtended = OpenFin.LayoutComponent['componentState'] & {
|
|
3
|
+
name: string;
|
|
4
|
+
uuid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type LayoutComponentExtended = Omit<OpenFin.LayoutComponent, 'componentState'> & {
|
|
7
|
+
componentState: LayoutComponentStateExtended;
|
|
8
|
+
};
|
|
9
|
+
export declare type LayoutStack = {
|
|
10
|
+
type: 'stack';
|
|
11
|
+
content: OpenFin.LayoutContent;
|
|
12
|
+
};
|
|
13
|
+
export declare type LayoutContentItemExtended = OpenFin.LayoutRow | OpenFin.LayoutColumn | LayoutComponentExtended | LayoutStack;
|
|
14
|
+
export declare type LayoutContentExtended = LayoutContentItemExtended[];
|
|
15
|
+
export declare type LayoutSettingsExtended = OpenFin.LayoutOptions['settings'] & {
|
|
16
|
+
reorderEnabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare type LayoutExtended = {
|
|
19
|
+
settings?: LayoutSettingsExtended;
|
|
20
|
+
content: LayoutContentExtended;
|
|
21
|
+
};
|
|
22
|
+
export declare enum LayoutDOMEventType {
|
|
23
|
+
TabCreated = "tab-created",
|
|
24
|
+
ContainerCreated = "container-created",
|
|
25
|
+
ContainerResized = "container-resized"
|
|
26
|
+
}
|
|
27
|
+
export interface LayoutDOMEvent {
|
|
28
|
+
type: LayoutDOMEventType;
|
|
29
|
+
detail: {
|
|
30
|
+
containerSelector: string;
|
|
31
|
+
tabSelector: string;
|
|
32
|
+
};
|
|
33
|
+
isInitialized: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare type LayoutDOMEventListener = (ev: LayoutDOMEvent) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Deep clones a layout and removes view names.
|
|
38
|
+
* @param layout The Layout to be cloned
|
|
39
|
+
* @returns A copy of the layout with names removed
|
|
40
|
+
*/
|
|
41
|
+
export declare const cloneLayoutAndRemoveNames: (layout: any) => any;
|
|
42
|
+
export declare const mapContentComponentState: (content: OpenFin.LayoutContent | LayoutContentExtended) => LayoutComponentStateExtended[];
|
|
43
|
+
export declare const getLayoutWithSingleView: (title: string, url: string) => Promise<any>;
|
|
44
|
+
export declare const isLayoutTabActive: (tabSelector: string) => boolean;
|
|
45
|
+
export declare const containerId = "layout_container";
|
|
46
|
+
export declare const getViewComponents: () => LayoutContentExtended;
|
|
47
|
+
export declare const removeLayoutView: (name: string) => Promise<void>;
|
|
48
|
+
export declare const addLayoutEventListener: (event: LayoutDOMEventType, listener: LayoutDOMEventListener) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Initialize the layout for the current OF window.
|
|
51
|
+
*/
|
|
52
|
+
export declare const initLayout: () => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare enum LocalStorageKey {
|
|
2
|
+
LastLaunchedWorkspaceId = "activeWorkspaceId",
|
|
3
|
+
LastFocusedBrowserWindow = "lastFocusedBrowserWindow",
|
|
4
|
+
MachineName = "machineName",
|
|
5
|
+
NewTabPageLayout = "NewTabPageLayout",
|
|
6
|
+
NewTabPageSort = "NewTabPageSort"
|
|
7
|
+
}
|
|
8
|
+
export default LocalStorageKey;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LogLocal } from './shapes';
|
|
2
|
+
/**
|
|
3
|
+
* Responsible of capturing log information locally and centrally alongside the logs of other windows/views.
|
|
4
|
+
*
|
|
5
|
+
* **Warning: if you don't specify a name then it will still log out your messages but it becomes harder to distinguish where the log entry came from**
|
|
6
|
+
*
|
|
7
|
+
* Basic usage example:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import logger from '../utils/logger';
|
|
11
|
+
* const log = logger("My Component");
|
|
12
|
+
*
|
|
13
|
+
* log.info("Initialised.");
|
|
14
|
+
* ```
|
|
15
|
+
* More information can be found [here](https://github.com/openfin/browser/blob/main/docs/Logging.md)
|
|
16
|
+
* @param name Specify a name for this logger that will be the prefix of all log messages.
|
|
17
|
+
* @param logLocal Specify an object to say what loglevel should be logged to the local window console e.g. { info: true }.
|
|
18
|
+
*/
|
|
19
|
+
export default function logger(name?: string, logLocal?: LogLocal): {
|
|
20
|
+
trace: (message: string, ...args: any[]) => void;
|
|
21
|
+
debug: (message: string, ...args: any[]) => void;
|
|
22
|
+
info: (message: string, ...args: any[]) => void;
|
|
23
|
+
warn: (message: string, ...args: any[]) => void;
|
|
24
|
+
error: (message: string, error?: any, ...args: any[]) => void;
|
|
25
|
+
fatal: (message: string, error?: any, ...args: any[]) => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LogEntry, LogOptions } from './shapes';
|
|
2
|
+
declare class LogInterface {
|
|
3
|
+
private worker;
|
|
4
|
+
private name;
|
|
5
|
+
private requestResponseHandler;
|
|
6
|
+
private errorListeners;
|
|
7
|
+
constructor();
|
|
8
|
+
getLogs(fromId?: number): Promise<LogEntry[]>;
|
|
9
|
+
trace(message: string, sourceName?: string, args?: any[]): void;
|
|
10
|
+
debug(message: string, sourceName?: string, args?: any[]): void;
|
|
11
|
+
info(message: string, sourceName?: string, args?: any[]): void;
|
|
12
|
+
warn(message: string, sourceName?: string, args?: any[]): void;
|
|
13
|
+
error(message: string, error?: any, sourceName?: string, args?: any[]): void;
|
|
14
|
+
fatal(message: string, error?: any, sourceName?: string, args?: any[]): void;
|
|
15
|
+
configure(options: LogOptions): void;
|
|
16
|
+
onLogError(listener: (error: Error) => void): void;
|
|
17
|
+
removeListener(listener: (...args: unknown[]) => void): void;
|
|
18
|
+
private log;
|
|
19
|
+
private listener;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Responsible for managing the way logging behaves and retrieving logs. Additionally exposes logging functions but logger should be used for logging.
|
|
23
|
+
*
|
|
24
|
+
* Basic usage example:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import logManager from '../utils/log-manager';
|
|
28
|
+
*
|
|
29
|
+
* const logs = await logManager.getLogs();
|
|
30
|
+
*
|
|
31
|
+
* ```
|
|
32
|
+
* More information can be found [here](https://github.com/openfin/browser/blob/main/docs/Logging.md)
|
|
33
|
+
*/
|
|
34
|
+
declare let instance: LogInterface | undefined;
|
|
35
|
+
export default instance;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
2
|
+
export interface LogOptions {
|
|
3
|
+
instanceId?: string;
|
|
4
|
+
auditLimit?: number;
|
|
5
|
+
auditLevel?: LogLevel;
|
|
6
|
+
logLevel?: LogLevel;
|
|
7
|
+
}
|
|
8
|
+
export declare type LogLocal = {
|
|
9
|
+
[key in LogLevel]?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export interface LogEntry {
|
|
12
|
+
id?: number;
|
|
13
|
+
level: LogLevel;
|
|
14
|
+
name: string;
|
|
15
|
+
source?: string;
|
|
16
|
+
message: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
ts?: number;
|
|
19
|
+
data?: any[];
|
|
20
|
+
}
|
|
21
|
+
export interface GetLogOptions {
|
|
22
|
+
from?: number;
|
|
23
|
+
responseId: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const LogColors: {
|
|
26
|
+
[key in LogLevel]: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All routes that serve HTML pages for the app.
|
|
3
|
+
* Routes should include the zone the the HTML page is a part of.
|
|
4
|
+
* Make sure to include trailing slash, as it is essential for deployed version to route correctly.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum PageRoute {
|
|
7
|
+
HomeIndex = "/home/",
|
|
8
|
+
HomeSearch = "/home/search/",
|
|
9
|
+
HomePagesRename = "/home/pages/rename/",
|
|
10
|
+
Dock = "/home/dock/",
|
|
11
|
+
BrowserPagesLanding = "/browser/pages/landing/",
|
|
12
|
+
HomeIndicator = "/home/indicator/",
|
|
13
|
+
Browser = "/browser/",
|
|
14
|
+
BrowserPopupMenu = "/browser/popup-menu/",
|
|
15
|
+
Provider = "/provider/",
|
|
16
|
+
BrowserPopupMenuSharePage = "/browser/popup-menu/share-page/",
|
|
17
|
+
BrowserPopupMenuSavePage = "/browser/popup-menu/save-page/",
|
|
18
|
+
BrowserPopupMenuLayouts = "/browser/popup-menu/layouts/layouts/",
|
|
19
|
+
BrowserPopupMenuColorLinking = "/browser/popup-menu/color-linking/color-linking/",
|
|
20
|
+
BrowserIndicator = "/browser/indicator/",
|
|
21
|
+
ResponseModal = "/browser/popup-menu/response-modal/",
|
|
22
|
+
Docs = "/provider/docs/",
|
|
23
|
+
Storefront = "/storefront/",
|
|
24
|
+
DeprecatedAlert = "/provider/deprecated-alert/"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* All routes that serve assets. (icons, json, etc.)
|
|
28
|
+
*/
|
|
29
|
+
export declare enum AssetRoute {
|
|
30
|
+
IconOpenFinLogo = "/icons/openfinlogo.svg",
|
|
31
|
+
IconFilter = "/icons/filter.svg"
|
|
32
|
+
}
|
|
33
|
+
declare const _default: {
|
|
34
|
+
HomeIndex: PageRoute.HomeIndex;
|
|
35
|
+
HomeSearch: PageRoute.HomeSearch;
|
|
36
|
+
HomePagesRename: PageRoute.HomePagesRename;
|
|
37
|
+
Dock: PageRoute.Dock;
|
|
38
|
+
BrowserPagesLanding: PageRoute.BrowserPagesLanding;
|
|
39
|
+
HomeIndicator: PageRoute.HomeIndicator;
|
|
40
|
+
Browser: PageRoute.Browser;
|
|
41
|
+
BrowserPopupMenu: PageRoute.BrowserPopupMenu;
|
|
42
|
+
Provider: PageRoute.Provider;
|
|
43
|
+
BrowserPopupMenuSharePage: PageRoute.BrowserPopupMenuSharePage;
|
|
44
|
+
BrowserPopupMenuSavePage: PageRoute.BrowserPopupMenuSavePage;
|
|
45
|
+
BrowserPopupMenuLayouts: PageRoute.BrowserPopupMenuLayouts;
|
|
46
|
+
BrowserPopupMenuColorLinking: PageRoute.BrowserPopupMenuColorLinking;
|
|
47
|
+
BrowserIndicator: PageRoute.BrowserIndicator;
|
|
48
|
+
ResponseModal: PageRoute.ResponseModal;
|
|
49
|
+
Docs: PageRoute.Docs;
|
|
50
|
+
Storefront: PageRoute.Storefront;
|
|
51
|
+
DeprecatedAlert: PageRoute.DeprecatedAlert;
|
|
52
|
+
IconOpenFinLogo: AssetRoute.IconOpenFinLogo;
|
|
53
|
+
IconFilter: AssetRoute.IconFilter;
|
|
54
|
+
};
|
|
55
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare type Listener = (...args: any[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Creates an event emitter that is shared between all windows within the same domain.
|
|
4
|
+
*/
|
|
5
|
+
export default function makeSharedEmitter<E extends string | number, L extends Listener>(id: string): {
|
|
6
|
+
emit: (event: E, ...payload: any[]) => Promise<void>;
|
|
7
|
+
addListener: (event: E, listener: L) => void;
|
|
8
|
+
removeListener: (event: E, listener: L) => void;
|
|
9
|
+
once: (event: E, listener: L) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
export declare type SnapshotDetailsExtended = OpenFin.Snapshot['snapshotDetails'] & {
|
|
3
|
+
machineId: string;
|
|
4
|
+
machineName?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type SnapshotExtended = {
|
|
7
|
+
snapshotDetails: SnapshotDetailsExtended;
|
|
8
|
+
windows: OpenFin.WindowOptions[];
|
|
9
|
+
};
|
|
10
|
+
export declare type ApplySnapshotOptionsExtended = OpenFin.ApplySnapshotOptions & {
|
|
11
|
+
attachToExistingWindow: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Set a friendly name of the current machine.
|
|
15
|
+
* @param name the friendly name.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setMachineName(name: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Get the machine's friendly name.
|
|
20
|
+
* @returns the machine's friendly name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMachineName(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Get the current machine ID.
|
|
25
|
+
* @returns the machine ID.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getMachineId(): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a snapshot with extra snapshot details.
|
|
30
|
+
* @param snapshot the snapshot to extend.
|
|
31
|
+
* @returns the snapshot with more snapshot details.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getSnapshotExtended(snapshot?: OpenFin.Snapshot): Promise<SnapshotExtended>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const capitalize: (s: string) => string;
|
|
2
|
+
export declare const titleize: (s: string) => string;
|
|
3
|
+
export declare const pascalize: (s: string) => string;
|
|
4
|
+
export declare const slugify: (s: string) => string;
|
|
5
|
+
export declare const isStringMatchesQuery: (title: string, query?: string) => boolean;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import type { Fin } from 'openfin-adapter';
|
|
3
|
+
import type { _Window } from 'openfin-adapter/src/api/window';
|
|
4
|
+
import { ApplicationUUID } from './application';
|
|
5
|
+
export declare type WindowFin = Fin<'window'>;
|
|
6
|
+
export declare enum WindowName {
|
|
7
|
+
Home = "openfin-home",
|
|
8
|
+
Dock = "openfin-dock",
|
|
9
|
+
Storefront = "openfin-storefront",
|
|
10
|
+
HomeInternal = "openfin-home-internal",
|
|
11
|
+
BrowserMenu = "openfin-browser-menu",
|
|
12
|
+
BrowserIndicator = "openfin-browser-indicator",
|
|
13
|
+
BrowserWindow = "internal-generated-window"
|
|
14
|
+
}
|
|
15
|
+
export declare enum WindowEvent {
|
|
16
|
+
Shown = "shown",
|
|
17
|
+
BoundsChanged = "bounds-changed",
|
|
18
|
+
LayoutReady = "layout-ready",
|
|
19
|
+
EndUserBoundsChanging = "end-user-bounds-changing",
|
|
20
|
+
Blurred = "blurred",
|
|
21
|
+
CloseRequested = "close-requested",
|
|
22
|
+
Focused = "focused",
|
|
23
|
+
ShowRequested = "show-requested",
|
|
24
|
+
ViewCrashed = "view-crashed",
|
|
25
|
+
ViewAttached = "view-attached",
|
|
26
|
+
ViewDetached = "view-detached",
|
|
27
|
+
ViewPageTitleUpdated = "view-page-title-updated",
|
|
28
|
+
ViewDestroyed = "view-destroyed"
|
|
29
|
+
}
|
|
30
|
+
export interface WindowIdentity {
|
|
31
|
+
uuid: ApplicationUUID | string;
|
|
32
|
+
name: WindowName | string;
|
|
33
|
+
}
|
|
34
|
+
interface Point {
|
|
35
|
+
left: number;
|
|
36
|
+
top: number;
|
|
37
|
+
}
|
|
38
|
+
interface Size {
|
|
39
|
+
height: number;
|
|
40
|
+
width: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the center point of a window given its bounds
|
|
44
|
+
* @param bounds OpenFin bounds - left, top, height, width
|
|
45
|
+
* @returns coords representing the center - left, top
|
|
46
|
+
*/
|
|
47
|
+
export declare const getCenterFromBounds: (bounds: OpenFin.WindowBounds) => Point;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the top and left coords of a window given its size and center point
|
|
50
|
+
* @param center point representing the desired center coords
|
|
51
|
+
* @param size height and width of the window
|
|
52
|
+
* @returns coords representing the left, top of window given the center point
|
|
53
|
+
*/
|
|
54
|
+
export declare const getBoundsFromCenter: (center: Point, size: Size) => Point;
|
|
55
|
+
/**
|
|
56
|
+
* Get a wrapped OpenFin window.
|
|
57
|
+
*
|
|
58
|
+
* This method can only be used in an OF env.
|
|
59
|
+
* If used outside of OF, such as in a pre-rendering context, will throw a clear and traceable error.
|
|
60
|
+
*
|
|
61
|
+
* @param identity the window identity.
|
|
62
|
+
* @returns the wrapped OpenFin window identity.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getOFWindow(identity: WindowIdentity): _Window;
|
|
65
|
+
/**
|
|
66
|
+
* The OpenFin identity for the current window.
|
|
67
|
+
*/
|
|
68
|
+
export declare const currentOFIdentity: WindowIdentity;
|
|
69
|
+
/**
|
|
70
|
+
* Get the current OpenFin window.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getCurrentOFWindow(): _Window;
|
|
73
|
+
/**
|
|
74
|
+
* The OpenFin identity for Home.
|
|
75
|
+
*/
|
|
76
|
+
export declare const homeOFIdentity: WindowIdentity;
|
|
77
|
+
export declare const dockOFIdentity: WindowIdentity;
|
|
78
|
+
export declare const StorefrontOFIdentity: WindowIdentity;
|
|
79
|
+
export declare const providerOFIdentity: WindowIdentity;
|
|
80
|
+
/**
|
|
81
|
+
* Get the Home OpenFin window.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getHomeOFWindow(): _Window;
|
|
84
|
+
export declare function getDockOFWindow(): _Window;
|
|
85
|
+
/**
|
|
86
|
+
* Helper for max and restoring a window.
|
|
87
|
+
* @param identity the identity of the window to maximize or restore.
|
|
88
|
+
*/
|
|
89
|
+
export declare function maxOrRestore(identity: WindowIdentity): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Helper for showing a window.
|
|
92
|
+
* This method ensures the window is shown, brought to front and focused.
|
|
93
|
+
* @param identity the identity of the window to show.
|
|
94
|
+
*/
|
|
95
|
+
export declare function showAndFocus(identity: WindowIdentity): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Helper for hiding a window.
|
|
98
|
+
* This method ensures the window is hidden and blurred.
|
|
99
|
+
* @param identity the identity of the window to hide.
|
|
100
|
+
*/
|
|
101
|
+
export declare function hideAndBlur(identity: WindowIdentity): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Helper for showing / hiding a window.
|
|
104
|
+
* This method calls showAndFocus / hideAndBlur
|
|
105
|
+
* @param identity the identity of the window to hide.
|
|
106
|
+
*/
|
|
107
|
+
export declare function toggleVisibility(identity: WindowIdentity): Promise<void>;
|
|
108
|
+
export declare const toggleDock: () => Promise<void>;
|
|
109
|
+
export declare const showAndFocusDock: () => Promise<void>;
|
|
110
|
+
export declare function isAnimatingSize(): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Resizes a window to width and height saved in the store
|
|
113
|
+
* if they differ from current window size.
|
|
114
|
+
*/
|
|
115
|
+
export declare function restoreWindowSize(): Promise<void>;
|
|
116
|
+
export declare function animateSize(width: number, height: number): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Returns true if the window name is that of a browser window.
|
|
119
|
+
* @param name the window name.
|
|
120
|
+
* @returns true if the name is that of a browser window's.
|
|
121
|
+
*/
|
|
122
|
+
export declare const isBrowserWindow: (name: string) => boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Force document body size. Called when resizing or on scaling changes.
|
|
125
|
+
*/
|
|
126
|
+
export declare function forceBodySize(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Gets all currently open browser windows.
|
|
129
|
+
*/
|
|
130
|
+
export declare function getBrowserWindows(): Promise<_Window[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Closes all currently open Browser windows.
|
|
133
|
+
*/
|
|
134
|
+
export declare function closeBrowserWindows(): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Returns true if the OpenFin window for the provided identity is running.
|
|
137
|
+
* */
|
|
138
|
+
export declare const isWindowRunning: (identity: WindowIdentity) => Promise<boolean>;
|
|
139
|
+
/**
|
|
140
|
+
* Check if Storefront window is running.
|
|
141
|
+
* @returns true if the Storefront window is running.
|
|
142
|
+
*/
|
|
143
|
+
export declare const isStorefrontWindowRunning: () => Promise<boolean>;
|
|
144
|
+
export declare const isHomeWindowRunning: () => Promise<boolean>;
|
|
145
|
+
export declare const showAndFocusStorefront: () => Promise<void>;
|
|
146
|
+
export {};
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client-api-platform/src';
|
package/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(()=>{var e={485:function(e){var t;t=function(){var e=JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"\'","’":"\'","“":"\\"","”":"\\"","„":"\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial"}'),t=JSON.parse('{"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"}}');function n(n,a){if("string"!=typeof n)throw new Error("slugify: string argument expected");var o=t[(a="string"==typeof a?{replacement:a}:a||{}).locale]||{},i=void 0===a.replacement?"-":a.replacement,r=n.normalize().split("").reduce((function(t,n){return t+(o[n]||e[n]||(n===i?" ":n)).replace(a.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")}),"");return a.strict&&(r=r.replace(/[^A-Za-z0-9\s]/g,"")),r=r.trim().replace(/\s+/g,i),a.lower&&(r=r.toLowerCase()),r}return n.extend=function(t){Object.assign(e,t)},n},e.exports=t(),e.exports.default=t()}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var i=t[a]={exports:{}};return e[a].call(i.exports,i,i.exports,n),i.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{"use strict";n.r(a),n.d(a,{AppManifestType:()=>wn,getCurrentSync:()=>Hn,init:()=>Nn,wrapSync:()=>Vn});var e={};n.r(e),n.d(e,{subscribe:()=>Ft});var t,o,i={};n.r(i),n.d(i,{create:()=>dn}),function(e){e.Local="local",e.Dev="dev",e.Staging="staging",e.Prod="prod"}(o||(o={}));const r="undefined"!=typeof window&&"undefined"!=typeof fin,s=("undefined"==typeof process||null===(t=process.env)||void 0===t||t.JEST_WORKER_ID,"undefined"!=typeof window),c=s&&"undefined"!=typeof indexedDB,d=s?window.origin:o.Local,u=r&&fin.me.uuid,l=r&&fin.me.name,p=r&&fin.me.entityType,g="undefined"!=typeof ENV?ENV:o.Local,f=(o.Local,o.Dev,o.Staging,o.Prod,e=>e.startsWith("http://")||e.startsWith("https://")?e:d+e),w=("undefined"!=typeof WORKSPACE_APPS_URL&&f(WORKSPACE_APPS_URL),"undefined"!=typeof WORKSPACE_STOREFRONT_FOOTER_URL&&f(WORKSPACE_STOREFRONT_FOOTER_URL),"undefined"!=typeof WORKSPACE_STOREFRONT_LANDING_PAGE_URL&&f(WORKSPACE_STOREFRONT_LANDING_PAGE_URL),"undefined"!=typeof WORKSPACE_STOREFRONT_NAVIGATION_URL&&f(WORKSPACE_STOREFRONT_NAVIGATION_URL),"undefined"!=typeof WORKSPACE_SHARE_URL&&f(WORKSPACE_SHARE_URL),f("https://cdn.openfin.co/workspace/staging"),f("https://cdn.openfin.co/workspace/staging"));var h,y;(y=h||(h={})).LaunchApp="launchApp",y.SavePage="savePage",y.GetSavedPage="getSavedPage",y.CreateSavedPage="createSavedPage",y.UpdateSavedPage="updateSavedPage",y.DeleteSavedPage="deleteSavedPage",y.GetSavedPages="getSavedPages",y.CreateSavedPageInternal="createSavedPageInternal",y.UpdateSavedPageInternal="updateSavedPageInternal",y.DeleteSavedPageInternal="deleteSavedPageInternal",y.SharePage="sharePage",y.LaunchPage="launchPage",y.UpdatePageForWindow="updatePageForWindow",y.AttachPagesToWindow="attachPagesToWindow",y.DetachPagesFromWindow="detachPagesFromWindow",y.ReorderPagesForWindow="reorderPagesForWindow",y.SetActivePageForWindow="setActivePageForWindow",y.GetOpenPages="getOpenPages",y.GetActivePageIdForWindow="getActivePageIdForWindow",y.GetPagesForWindow="getPagesForWindow",y.GetPageForWindow="getPageForWindow",y.GetSavedPageMetadata="getSavedPageMetadata",y.GetUniquePageTitle="getUniquePageTitle",y.GetLastFocusedBrowserWindow="getLastFocusedBrowserWindow";const v=async e=>{const t=fin.Platform.wrapSync(e),n=await t.getClient(),a="Target is not a Workspace Platform. Target must call WorkspacePlatform.init";try{if(!0===await n.dispatch("isWorkspacePlatform"))return n;throw new Error(a)}catch(e){throw new Error(a)}},m=e=>({identity:e,openfinWindow:fin.Window.wrapSync(e),getPages:async()=>(await v(e)).dispatch(h.GetPagesForWindow,e),getPage:async t=>(await v(e)).dispatch(h.GetPageForWindow,{identity:e,pageId:t}),addPage:async t=>{const n=await v(e);(null==t?void 0:t.title)||(t.title=await n.dispatch(h.GetUniquePageTitle,void 0));const a=(await n.dispatch(h.GetOpenPages,void 0)).find((e=>e.pageId===t.pageId||e.title===t.title));if(a)throw a.pageId===t.pageId?new Error(`page with id ${t.pageId} is already attached to a browser window ${a.parentIdentity.name}`):new Error(`page with title ${t.title} is already attached to a browser window ${a.parentIdentity.name}`);const o={identity:e,pages:[t]};return n.dispatch(h.AttachPagesToWindow,o)},removePage:async t=>(await v(e)).dispatch(h.DetachPagesFromWindow,{identity:e,pageIds:[t]}),setActivePage:async t=>(await v(e)).dispatch(h.SetActivePageForWindow,{identity:e,pageId:t}),updatePage:async t=>{const n=await v(e);return t.identity=e,n.dispatch(h.UpdatePageForWindow,t)},reorderPages:async t=>{const n=await v(e);return t.identity=e,n.dispatch(h.ReorderPagesForWindow,t)}}),P=e=>{const t=fin.Platform.wrapSync(e),n=async()=>(await t.getClient()).dispatch(h.GetOpenPages,void 0);return{wrapSync:e=>m(e),createWindow:async e=>{const n=await t.createWindow(e);return m(n.identity)},getOpenPages:n,getAllWindows:async()=>(await fin.Application.wrapSync(e).getChildWindows()).filter((e=>e.identity.name.includes("internal-generated-window-"))).map((e=>m(e.identity))),launchPage:async e=>{const a=await t.getClient();await a.dispatch(h.LaunchPage,{page:e,attachToExistingWindow:!0});const o=(await n()).find((t=>t.pageId===e.pageId));return m(o.parentIdentity)},getUniquePageTitle:async t=>(await v(e)).dispatch(h.GetUniquePageTitle,t),getLastFocusedWindow:async()=>(await v(e)).dispatch(h.GetLastFocusedBrowserWindow,void 0)}},S=e=>({createPage:async t=>(await v(e)).dispatch(h.CreateSavedPageInternal,t),deletePage:async t=>(await v(e)).dispatch(h.DeleteSavedPageInternal,t),updatePage:async t=>(await v(e)).dispatch(h.UpdateSavedPageInternal,t),getPage:async t=>(await v(e)).dispatch(h.GetSavedPage,t),getPages:async t=>(await v(e)).dispatch(h.GetSavedPages,t),savePage:async t=>(await v(e)).dispatch(h.SavePage,t)});var I,b,W;!function(e){e.Workspace="openfin-browser"}(I||(I={})),function(e){e.RunRequested="run-requested",e.WindowOptionsChanged="window-options-changed",e.WindowClosed="window-closed",e.WindowCreated="window-created"}(b||(b={})),function(e){e.FinProtocol="fin-protocol"}(W||(W={}));const R={uuid:u,name:u},O=(I.Workspace,I.Workspace,e=>{if(!r)throw new Error("getApplication cannot be used in a non OpenFin env. Avoid using this during pre-rendering.");return fin.Application.wrapSync(e)});var A,E,C;function F(e){if(!r)throw new Error("getOFWindow can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");return fin.Window.wrapSync(e)}!function(e){e.Home="openfin-home",e.Dock="openfin-dock",e.Storefront="openfin-storefront",e.HomeInternal="openfin-home-internal",e.BrowserMenu="openfin-browser-menu",e.BrowserIndicator="openfin-browser-indicator",e.BrowserWindow="internal-generated-window"}(A||(A={})),(C=E||(E={})).Shown="shown",C.BoundsChanged="bounds-changed",C.LayoutReady="layout-ready",C.EndUserBoundsChanging="end-user-bounds-changing",C.Blurred="blurred",C.CloseRequested="close-requested",C.Focused="focused",C.ShowRequested="show-requested",C.ViewCrashed="view-crashed",C.ViewAttached="view-attached",C.ViewDetached="view-detached",C.ViewPageTitleUpdated="view-page-title-updated",C.ViewDestroyed="view-destroyed";const k={name:l,uuid:u};function T(){return F(k)}A.Home,I.Workspace,A.Dock,I.Workspace,A.Storefront,I.Workspace,I.Workspace,I.Workspace;const L=e=>e.startsWith(A.BrowserWindow);async function U(){return(await fin.Application.getCurrentSync().getChildWindows()).filter((e=>L(e.identity.name)))}var $,D;(D=$||($={})).LastLaunchedWorkspaceId="activeWorkspaceId",D.LastFocusedBrowserWindow="lastFocusedBrowserWindow",D.MachineName="machineName",D.NewTabPageLayout="NewTabPageLayout",D.NewTabPageSort="NewTabPageSort";const B=$,M={trace:!0,debug:"undefined"!=typeof LOG_DEBUG&&LOG_DEBUG,info:!1,warn:!0,error:!0,fatal:!0};function G(e,t){const n=void 0===t?M:{...M,...t},a=e?`${e} : `:"";return{trace:n.trace?(e,...t)=>{console.trace(`%c${a}${e}`,"color:#7795f7",...t)}:(e,...t)=>{},debug:n.debug?(e,...t)=>{console.info(`%c${a}${e}`,"color:#86db94",...t)}:(e,...t)=>{},info:n.info?(e,...t)=>{console.debug(`%c${a}${e}`,"color:#ffffff",...t)}:(e,...t)=>{},warn:n.warn?(e,...t)=>{console.warn(`%c${a}${e}`,"color:#edad68",...t)}:(e,...t)=>{},error:n.error?(e,t,...n)=>{console.error(`%c${a}${e}`,"color:#f55d67",...n,t)}:(e,t,...n)=>{},fatal:n.fatal?(e,t,...n)=>{console.error(`%c${a}${e}`,"color:#f70723",...n,t)}:(e,t,...n)=>{}}}const _=G("api.platform-window-focus");async function x(){if("undefined"!=typeof localStorage)try{const e=localStorage.getItem(B.LastFocusedBrowserWindow),t=JSON.parse(e);if(await(e=>F(e).getOptions().then((()=>!0)).catch((()=>!1)))(t))return t}catch(e){_.error("failed to get last focused browser window: ",e)}}function N(e=fin.me.identity){L(e.name)&&function(e){if("undefined"!=typeof localStorage)try{const t=JSON.stringify(e);localStorage.setItem(B.LastFocusedBrowserWindow,t)}catch(e){_.error("failed to save last focused browser window: ",e)}}(e)}var V;G("utils.layout"),function(e){e.TabCreated="tab-created",e.ContainerCreated="container-created",e.ContainerResized="container-resized"}(V||(V={}));const H=e=>{const t=[];return(e&&Array.isArray(e)?e:[]).forEach((e=>{if("component"===e.type)return t.push(e.componentState);const n=H(e.content);t.push(...n)})),t};new Map;const q=G("utils.channels"),j=s&&"complete"!==document.readyState&&new Promise((e=>document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&e()}))));function z(e){let t;return()=>{if(!r)throw new Error("getChannelClient cannot be used outside an OpenFin env. Avoid using this method during pre-rendering.");return t||(q.debug(`connecting to channel provider ${e}`),t=(async()=>{await j;const n=await fin.InterApplicationBus.Channel.connect(e);return n.onDisconnection((async()=>{q.warn(`disconnected from channel provider ${e}`),t=void 0})),n})().then((t=>(q.debug(`connected to channel provider ${e}`),t))).catch((t=>{q.error(`failed to connect to channel provider ${e}`,t)}))),t}}var Y,K;!function(e){e.GetPages="get-pages",e.GetActivePageForWindow="get-active-page-for-window",e.AttachPagesToWindow="attach-pages-to-window",e.DetachPagesFromWindow="detach-pages-from-window",e.SetActivePageForWindow="set-active-page-for-window",e.RenamePage="rename-page",e.ReorderPagesForWindow="reorder-pages-for-window",e.UpdatePageForWindow="update-page-for-window",e.UpdatePagesWindowOptions="update-pages-window-options",e.IsDetachingPages="is-detaching-pages",e.IsActivePageChanging="is-active-page-changing"}(Y||(Y={})),function(e){e.AttachedPagesToWindow="attached-pages-to-window",e.DetachedPagesFromWindow="detached-pages-from-window"}(K||(K={}));const J=new Map,Z=e=>{const t=(e=>`__running_pages__-${e.uuid}-${e.name}`)(e);return J.has(t)||J.set(t,z(t)),J.get(t)()},X=(new Map,async e=>{const t=await Z(e);return await t.dispatch(Y.GetPages)}),Q=async e=>(await Z(e.identity)).dispatch(Y.UpdatePageForWindow,e),ee=async()=>{const e=await U();return(await Promise.all(e.map((async({identity:e})=>X(e))))).reduce(((e,t)=>e.concat(t)),[])},te=async()=>(await v(k)).dispatch(h.GetSavedPages,void 0),ne=async e=>(await v(k)).dispatch(h.GetSavedPage,e),ae=async(e,t)=>{const n=await(async e=>(await ee()).find((t=>t.pageId===e)))(e);return!n||n.title===t.title&&e===t.pageId||await Q({identity:n.parentIdentity,pageId:e,page:{pageId:t.pageId,title:t.title}}),n},oe=async({page:e})=>{await ae(e.pageId,e),await(async e=>(await v(k)).dispatch(h.CreateSavedPage,e))({page:e})},ie=async e=>{await ne(e)&&await(async e=>(await v(k)).dispatch(h.DeleteSavedPage,e))(e)},re=async({pageId:e,page:t})=>(await ae(e,t),await(async e=>(await v(k)).dispatch(h.UpdateSavedPage,e))({pageId:e,page:t})),se=async e=>await ne(e.pageId)?re({pageId:e.pageId,page:e}):oe({page:e}),ce=async e=>{await(async e=>(await Z(e.identity)).dispatch(Y.AttachPagesToWindow,e))(e)},de=async e=>{await Q(e)},ue=async e=>{await(async e=>(await Z(e.identity)).dispatch(Y.DetachPagesFromWindow,e))(e)},le=async e=>{await(async e=>(await Z(e.identity)).dispatch(Y.SetActivePageForWindow,e))(e)},pe=e=>X(e),ge=async({identity:e,pageId:t})=>(await pe(e)).find((e=>e.pageId===t)),fe=async e=>{await(async e=>(await Z(e.identity)).dispatch(Y.ReorderPagesForWindow,e))(e)},we=(e,t)=>!t.find((t=>t===e)),he=(e,t)=>`${e} (${t})`;async function ye(e="Untitled Page"){const[t,n]=await Promise.all([te(),ee()]),a=[...t,...n].map((({title:e})=>e));if(!a.find((t=>t===e)))return e;let o=1;const i=e.replace(/ \(.+\)$/,"");for(;!we(he(i,o),a);)o+=1;return he(i,o)}const ve=G("api.cleanup"),me=new Map,Pe=e=>`${e.uuid}-${e.name}`,Se=((e,t=0)=>{let n,a,o=!1;const i=async a=>{const r=await e(...a);if(o){await new Promise((e=>setTimeout(e,t)));const e=n;return n=void 0,o=!1,i(e)}return r};return(...e)=>(a?(o=!0,n=e):a=i(e).then((e=>(a=void 0,e))),a)})((async function(){ve.debug("scheduling views to cleanup");const e=await ee(),t=new Set;e.forEach((e=>{H(e.layout.content).forEach((e=>{if(e.name){const n=Pe(e);t.add(n),ve.debug(`preserving view with id ${n}`)}}))}));const n=T();(await n.getCurrentViews()).forEach((({identity:e})=>{const n=Pe(e);if(t.has(n)||me.has(n))return;const a=setTimeout((()=>{ve.debug(`destroying view with id ${n}`),fin.View.wrapSync(e).destroy(),me.delete(n)}),5e3);ve.debug(`scheduled cleanup of view with id ${n}`),me.set(n,a)})),me.forEach(((e,n)=>{t.has(n)&&(clearTimeout(e),me.delete(n),ve.debug(`cancelled scheduled cleanup of view with id ${n}`))}))}),2500),Ie=({name:e})=>{L(e)&&Se()};function be(){return localStorage.getItem(B.MachineName)}let We,Re;async function Oe(){return We||(We=await fin.System.getMachineId()),We}async function Ae(e){var t;const n=e||await fin.Platform.getCurrentSync().getSnapshot();if(null===(t=n.snapshotDetails)||void 0===t?void 0:t.machineId)return n;const a=be();return{...n,snapshotDetails:{...e.snapshotDetails,machineId:await Oe(),machineName:a}}}function Ee(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}function Ce(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const a=Ee(n);return(e,n)=>a.then((a=>n(a.transaction(t,e).objectStore(t))))}function Fe(){return Re||(Re=Ce("keyval-store","keyval")),Re}n(485);const ke=c&&Ce("openfin-home-pages","pages");async function Te(e){const t=await function(e,t=Fe()){return t("readonly",(t=>Ee(t.get(e))))}(e,ke);return t?(t.pageId=e.toString(),t.title=t.title||t.pageId,t):null}async function Le(e){const t=await function(e=Fe()){const t=[];return function(e,t){return e("readonly",(e=>(e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Ee(e.transaction))))}(e,(e=>t.push(e.key))).then((()=>t))}(ke),n=await Promise.all(t.map((e=>Te(e.toString()))));return e?n.filter((t=>((e,t="")=>e.toLowerCase().includes(t.toLowerCase()))(t.title,e))):n}async function Ue({page:e}){await function(e,t,n=Fe()){return n("readwrite",(n=>(n.put(t,e),Ee(n.transaction))))}(e.pageId,e,ke)}async function $e(e){await function(e,t=Fe()){return t("readwrite",(t=>(t.delete(e),Ee(t.transaction))))}(e,ke)}async function De({pageId:e,page:t}){return void 0!==await Te(e)&&(await Ue({page:t}),e!==t.pageId&&await $e(e),!0)}var Be;!function(e){e[e.Initial=0]="Initial",e[e.Open=1]="Open",e[e.Close=2]="Close"}(Be||(Be={}));const Me="0",Ge="5",_e="6",xe=()=>{};function Ne(e,t){return e?`${e}-${t}`:t}function Ve(e){return`__search-${e}-topic__`}const He=new Map;function qe(e,t){He.has(e)||He.set(e,new Set),He.get(e).add(t)}function je(e,t){const n=He.get(e);n&&n.delete(t)}const ze=new Map;function Ye(e,t){ze.has(e)||ze.set(e,new Set),ze.get(e).add(t)}function Ke(e,t){const n=ze.get(e);n&&n.delete(t)}const Je=new Map;function Ze(e,t){Je.has(e)||Je.set(e,new Map),Je.get(e).set(t.id,t);const n=He.get(e);n&&n.forEach((e=>e()))}function Xe(e,t){const n=Je.get(e);if(!n)return;n.delete(t);const a=ze.get(e);a&&a.forEach((e=>e()))}function Qe(e){return Je.get(e)?[...Je.get(e).values()]:[]}function et(e){const t=Je.get(e);t&&t.clear()}function tt(e,t){const n=Je.get(e);return n?n.get(t):null}function nt(e,t,n){return{...e,action:n||e.actions[0],dispatcherIdentity:t}}function at(e,t,n="ascending"){const a=e||[];if(!(null==t?void 0:t.length))return a;const o=[],i=new Map;t.forEach((e=>{if(e.key)return i.set(e.key,e);o.push(e)}));let r=a.map((e=>{const{key:t}=e;if(t&&i.has(t)){const e=i.get(t);return i.delete(t),e}return e}));return r.push(...i.values(),...o),r="ascending"===n?r.sort(((e,t)=>(null!==e.score&&void 0!==e.score?e.score:1/0)-(null!==t.score&&void 0!==t.score?t.score:1/0))):r.sort(((e,t)=>(null!==t.score&&void 0!==t.score?t.score:1/0)-(null!==e.score&&void 0!==e.score?e.score:1/0))),r}function ot(e){const t={};let n=[],a=[],o=Be.Initial;t.getStatus=()=>o,t.getResultBuffer=()=>n,t.setResultBuffer=e=>{n=e,(null==n?void 0:n.length)&&t.onChange()},t.getRevokedBuffer=()=>a,t.setRevokedBuffer=e=>{a=e,(null==a?void 0:a.length)&&t.onChange()},t.onChange=xe;const i={};return t.res=i,i.close=()=>{o!==Be.Close&&(o=Be.Close,t.onChange())},i.open=()=>{o!==Be.Open&&(o=Be.Open,t.onChange())},i.respond=n=>{const a=at(t.getResultBuffer(),n,e);t.setResultBuffer(a)},i.revoke=(...e)=>{const n=new Set(e),a=t.getResultBuffer().filter((({key:e})=>{const t=n.has(e);return t&&n.delete(e),!t}));t.setResultBuffer(a),n.size&&(t.getRevokedBuffer().forEach((e=>n.add(e))),t.setRevokedBuffer([...n]))},t}function it(e,t,n){const a=new Set;let o=!1;return{close:()=>{o=!0;for(const e of a)e()},req:{id:t,topic:e,...n,context:(null==n?void 0:n.context)||{},onClose:e=>{a.add(e),o&&e()},removeListener:e=>{a.delete(e)}}}}function rt(){return{name:fin.me.name,uuid:fin.me.uuid}}function st(){let e;try{const t=fin.Platform.getCurrentSync();if(!(null==t?void 0:t.identity))return;e=t.identity.uuid}catch(e){}return e}const ct="deregistered or does not exist",dt=new Error(`provider ${ct}`),ut=new Error("provider with name already exists"),lt=new Error("bad payload"),pt=new Error("subscription rejected"),gt=new Error(`channel ${ct}`),ft=new Map;function wt(e){const t=ht(e);if(t)return t;throw gt}function ht(e){const t=ft.get(e);if(t)return t}function yt(e,t){ft.set(e,t)}function vt(e){console.error("OpenFin Search API: ",e)}const mt=new Map;function Pt(e){mt.has(e)||mt.set(e,new Map);const t=mt.get(e);return{getRequestsForIdentity:e=>{const n=function(e){return`${e.uuid}:${e.name}`}(e);return t.has(n)||t.set(n,new Map),t.get(n)}}}async function St(e,t){return(await wt(e)).dispatch(Me,t)}function It({namespacedTopic:e,topic:t}){const n=tt.bind(null,e),a=Pt(e),o=St.bind(null,e);return async(e,i)=>{if(!e||!e.id||!e.providerId){const e=lt;return vt(e),{error:e.message}}const{id:r,providerId:s}=e,c=n(s);if(!c){const e=dt;return vt(e),{error:e.message}}const d=a.getRequestsForIdentity(i);let u=d.get(e.id);u||(u=it(t,r,e),d.set(e.id,u));const l=ot(),p=()=>{const e=l.getResultBuffer();l.setResultBuffer([]);const t=l.getRevokedBuffer();l.setRevokedBuffer([]);const n=l.getStatus();o({id:r,providerId:s,results:e,revoked:t,status:n})};let g=!0,f=!1;l.onChange=()=>{if(g)return g=!1,void p();f||(f=!0,setTimeout((()=>{f=!1,p()}),100))};try{const{results:e,context:t}=await c.onUserInput(u.req,l.res),n=l.getStatus();return{id:r,providerId:s,status:n,results:e,context:t}}catch(e){return vt(e),{id:r,providerId:s,error:e.message}}}}async function bt(e,t,n){const a=n||await wt(e),o=rt(),i={identity:o,...t,onUserInput:void 0,onResultDispatch:void 0};await a.dispatch("2",i),Ze(e,{identity:o,...t})}async function Wt(e,t){const n=await wt(e);return await n.dispatch("3",t),Xe(e,t)}async function Rt(e,t,n,a){const o=nt(n,rt(),a),i=tt(e,t);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(o)}const r={providerId:t,result:o};return(await wt(e)).dispatch(Ge,r)}async function Ot(e,t){const n={...t,context:(null==t?void 0:t.context)||{}},a={},o=async function*(e,t,{setState:n}){const a=await wt(e);for(;;){const e=await a.dispatch("1",t),o=e.error;if(o)throw new Error(o);const i=e;if(t.id=i.id,n(i.state),i.done)return i.value;yield i.value}}(e,n,{setState:e=>{a.state=e}});let i=await o.next();return a.id=n.id,a.close=()=>{!async function(e,t){(await wt(e)).dispatch(_e,{id:t})}(e,a.id)},a.next=()=>{if(i){const e=i;return i=void 0,e}return o.next()},a}async function At(e){return(await wt(e)).dispatch("4",null)}async function Et(e){const t=await wt(e);var n;n=e,ft.delete(n),et(e),await t.disconnect()}async function Ct(e){const{namespacedTopic:t}=e,n=Ve(t),a=await async function(e){for(let t=0;t<50;t++)try{return await fin.InterApplicationBus.Channel.connect(e,{wait:!1})}catch(e){if(49===t)throw e;await new Promise((e=>setTimeout(e,1e3)))}}(n);return a.register(Me,It(e)),a.register(_e,function(e){const t=Pt(e);return(e,n)=>{const a=t.getRequestsForIdentity(n),o=a.get(e.id);o&&(o.close(),a.delete(e.id))}}(t)),a.register(Ge,function(e){return async(t,n)=>{if(!t||!t.providerId||!t.result)return void vt(lt);const a=tt(e,t.providerId);if(!a)return void vt(dt);const{onResultDispatch:o}=a;return o?(t.result.dispatcherIdentity=n,o(t.result)):void 0}}(t)),a.onDisconnection(function(e){const{namespacedTopic:t}=e,n=Pt(t);return async a=>{if(!ht(t))return;const o=n.getRequestsForIdentity(a);for(const{req:e,close:t}of o.values())t(),o.delete(e.id);yt(t,(async e=>{const{namespacedTopic:t}=e,n=await Ct(e);for(const e of Qe(t))await bt(t,e,n);return n})(e))}}(e)),a}async function Ft(e){const t=("string"==typeof e?e:null==e?void 0:e.topic)||"all",n=("string"==typeof e?null:null==e?void 0:e.uuid)||st(),a=Ne(n,t),o={topic:t,namespace:n,namespacedTopic:a};let i=ht(a);return i||(i=Ct(o),yt(a,i),await i),{getAllProviders:At.bind(null,a),register:bt.bind(null,a),search:Ot.bind(null,a),deregister:Wt.bind(null,a),dispatch:Rt.bind(null,a),disconnect:Et.bind(null,a)}}const kt=new Map;function Tt(e){const t=Lt(e);if(t)return t;throw gt}function Lt(e){const t=kt.get(e);if(t)return t}const Ut=new Map;function $t(e,t){Ut.has(e)||Ut.set(e,new Set),Ut.get(e).add(t)}function Dt(e,t){const n=Ut.get(e);n&&n.delete(t)}var Bt,Mt;function Gt(e){return[...Qe(e)].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}function _t(e,t){if(tt(e,t.id))throw new Error("provider with name already exists");Ze(e,{identity:rt(),...t})}function xt(e,t){Xe(e,t)}async function Nt(e,t,n,a){const o=tt(e,t);if(!o)throw dt;const{onResultDispatch:i}=o;if(i)return i(nt(n,rt(),a))}!function(e){e.Fetching="fetching",e.Fetched="fetched",e.Complete="complete"}(Bt||(Bt={})),function(e){e.Active="active",e.Default="default"}(Mt||(Mt={}));let Vt=0;function Ht({namespacedTopic:e,topic:t},n){Vt+=1;const a=it(t,Vt.toString(),n);let o;return o=async function*(e,t,n){const a=function(e,t){const n=[],a=[],o=[],i=[];for(const r of e){const e=ot(r.scoreOrder),s={results:[],provider:{id:r.id,identity:r.identity,title:r.title,scoreOrder:r.scoreOrder,icon:r.icon}};n.push(s),a.push(e);const c=(async()=>{try{const{results:n,context:a}=await r.onUserInput(t,e.res);s.results=at(s.results,n),s.context={...s.context,...a}}catch(e){s.error=e}c.done=!0})();i.push(c),o.push(o.length)}return{providerResponses:n,listenerResponses:a,openListenerResponses:o,initialResponsePromises:i}}(t.targets?t.targets.map((t=>tt(e,t))).filter((e=>!!e)):[...Qe(e).filter((e=>!e.hidden))],t),{providerResponses:o,listenerResponses:i}=a;let{openListenerResponses:r,initialResponsePromises:s}=a,c=Bt.Fetching;const d=e=>{c=e,n.setState(c)};let u,l=!1;t.onClose((()=>{l=!0,u&&u()}));do{let e=!1;if(s.length){const t=[];for(const n of s)n.done?e=!0:t.push(n);s=t,s.length||(d(Bt.Fetched),e=!0)}let t,n=!1;const a=()=>{n=!0,t&&t()},p=[];for(const t of r){const n=i[t],r=o[t],s=n.getStatus();(s===Be.Open||c===Bt.Fetching&&s===Be.Initial)&&(p.push(t),n.onChange=a);const d=n.getResultBuffer();d.length&&(n.setResultBuffer([]),r.results=at(r.results,d),e=!0);const u=n.getRevokedBuffer();if(u.length){n.setRevokedBuffer([]);const t=new Set(u);r.results=r.results.filter((({key:e})=>!t.has(e))),e=!0}}if(r=p,e&&(yield o),l)break;n||(r.length||s.length)&&await Promise.race([...s,new Promise((e=>{t=e})),new Promise((e=>{u=e}))])}while(r.length||s.length);return d(Bt.Complete),o}(e,a.req,{setState:e=>{o.state=e}}),o.id=Vt.toString(),o.close=a.close,o.state=Bt.Fetching,o}const qt=new Map;function jt(e,t){return`${e}:${t}`}function zt(e,t,n){return Tt(e).dispatch(t,_e,{id:n})}async function Yt(e,t,{id:n,query:a,context:o,targets:i}){const r=Tt(e),s={id:n,query:a,context:o,targets:i,providerId:t.id},c=await r.dispatch(t.identity,Me,s),d=c.error;if(d)throw new Error(d);return c}const Kt=new Map;function Jt(e,t,n){return`${e}:${t.name}:${t.uuid}:${n}`}const Zt=new Map;function Xt(e,t,n){return`${e}:${t}:${n}`}function Qt(e,t){const n=Jt.bind(null,e,t.identity),a=zt.bind(null,e,t.identity),o=Yt.bind(null,e,t);return async(i,r)=>{const s=n(i.id);if(!Kt.has(s)){const e=()=>{a(i.id),Kt.delete(s)};Kt.set(s,e),i.onClose(e)}const c=Xt(e,t.id,i.id),d=()=>{Zt.delete(c),r.close()};i.onClose(d),Zt.set(c,(e=>{var t,n;(null===(t=e.results)||void 0===t?void 0:t.length)&&r.respond(e.results),(null===(n=e.revoked)||void 0===n?void 0:n.length)&&r.revoke(...e.revoked),e.status===Be.Open&&r.open(),e.status===Be.Close&&d()}));const u=await o(i);return u.status===Be.Open&&r.open(),u.status!==Be.Close&&u.status!==Be.Initial||d(),u}}function en(e,t){return async n=>{const a=Tt(e),o={providerId:t.id,result:n};return a.dispatch(t.identity,Ge,o)}}const tn=new Map;function nn(e,t){return`${e}-${t.name}-${t.uuid}`}const an=new Map;function on(e,t){an.has(e)||an.set(e,new Set),an.get(e).add(t)}function rn(e,t){const n=an.get(e);n&&n.delete(t)}async function sn(e){const{namespacedTopic:t}=e,n=Ve(e.namespacedTopic),a=await(o=n,fin.InterApplicationBus.Channel.create(o));var o;return a.onConnection(function({namespacedTopic:e}){return async t=>{const n=Ut.get(e);if(n)for(const e of n)if(!await e(t))throw pt}}(e)),a.onDisconnection(function(e){return async t=>{!function(e,t){const n=nn(e,t),a=tn.get(n);if(a){for(const t of a)Xe(e,t);tn.delete(n)}}(e,t);const n=an.get(e);n&&n.forEach((e=>e(t)))}}(t)),a.register(_e,function(e){return t=>function(e,t){const n=jt(e,t),a=qt.get(n);a&&a.generator.close()}(e,t.id)}(t)),a.register(Me,function(e){return t=>{const n=Xt(e,t.providerId,t.id),a=Zt.get(n);a&&a(t)}}(t)),a.register("2",function(e){return(t,n)=>{if(!t||!t.id)return vt(new Error(JSON.stringify(t))),void vt(lt);if(tt(e,t.id))throw ut;t.identity=n,function(e,t){const n=nn(e,t.identity);tn.has(n)||tn.set(n,[]),tn.get(n).push(t.id),Ze(e,{...t,onUserInput:Qt(e,t),onResultDispatch:en(e,t)})}(e,t)}}(t)),a.register("3",function(e){return t=>{t?function(e,t){const n=tt(e,t);if(!n)return;const a=nn(e,n.identity),o=tn.get(a);if(o){const n=o.findIndex((e=>e===t));-1!==n&&(o.splice(n,1),Xe(e,t))}}(e,t):vt(lt)}}(t)),a.register("4",function(e){return async()=>Gt(e)}(t)),a.register("1",function(e){return async(t,...n)=>{if(!t)return vt(lt),{error:lt.message};let a;if(t.id)a=jt(e.namespacedTopic,t.id);else{const n=Ht(e,t);a=jt(e.namespacedTopic,n.id),t.id=n.id,qt.set(a,{generator:n})}const o=qt.get(a);clearTimeout(o.timeout);const i=await o.generator.next();return o.timeout=function(e){return window.setTimeout((()=>{qt.delete(e)}),1e4)}(a),{...i,id:t.id,state:o.generator.state}}}(e)),a.register(Ge,function(e){return async(t,n)=>{if(!t||!t.providerId||!t.result)return void vt(lt);const a=tt(e,t.providerId);if(!a)throw dt;const{onResultDispatch:o}=a;return o?(t.result.dispatcherIdentity=n,o(t.result)):void 0}}(t)),a}async function cn(e){const t=Tt(e);var n;n=e,kt.delete(n),await t.destroy(),et(e)}async function dn(e){const t=("string"==typeof e?e:null==e?void 0:e.topic)||"all",n=st(),a=Ne(n,t),o={topic:t,namespace:n,namespacedTopic:a};let i=Lt(a);i||(i=await sn(o),function(e,t){kt.set(e,t)}(a,i));const r=Dt.bind(null,a),s=rn.bind(null,a),c=je.bind(null,a),d=Ke.bind(null,a);return{getAllProviders:Gt.bind(null,a),search:Ht.bind(null,o),register:_t.bind(null,a),deregister:xt.bind(null,a),onSubscription:$t.bind(null,a),onDisconnect:on.bind(null,a),onRegister:qe.bind(null,a),onDeregister:Ye.bind(null,a),dispatch:Nt.bind(null,o),disconnect:cn.bind(null,a),removeListener:e=>{r(e),s(e),c(e),d(e)}}}const{create:un}=i,{subscribe:ln}=e,pn={create:un,subscribe:ln,defaultTopic:"all"},gn=()=>{const e=window;e.search=pn,e.fin&&(e.fin.Search=pn)},fn=e=>{const t=()=>{gn(),window.removeEventListener(e,t)};return t};if("undefined"!=typeof window){gn();const e="load",t=fn(e);window.addEventListener(e,t);const n="DOMContentLoaded",a=fn(n);window.addEventListener(n,a)}var wn,hn,yn,vn,mn,Pn;async function Sn({app:e,target:t}){const n=fin.Platform.getCurrentSync();switch(e.manifestType){case wn.Snapshot:return n.applySnapshot(e.manifest);case wn.View:return async function(e,t){const n=fin.Platform.getCurrentSync();if("view"===t.entityType){const n=fin.View.wrapSync(t),a=await n.getParentLayout();return await a.replaceView(t,{manifestUrl:e.manifest,url:void 0,target:void 0}),n.destroy()}return n.createView({name:void 0,url:void 0,manifestUrl:e.manifest,target:void 0})}(e,t);case wn.External:return fin.System.launchExternalProcess({path:e.manifest,uuid:e.appId});default:return fin.Application.startFromManifest(e.manifest)}}!function(e){e.Snapshot="snapshot",e.Manifest="manifest",e.View="view",e.External="external"}(wn||(wn={})),function(e){e.LandingPage="landingPage",e.AppGrid="appGrid"}(hn||(hn={})),function(e){e.Suggestion="suggestion"}(yn||(yn={})),function(e){e.Contact="Contact",e.List="List",e.Plain="Plain",e.SimpleText="SimpleText"}(vn||(vn={})),function(e){e.MultiSelect="MultiSelect"}(mn||(mn={}));var In=new Uint8Array(16);function bn(){if(!Pn&&!(Pn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pn(In)}const Wn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Rn=function(e){return"string"==typeof e&&Wn.test(e)};for(var On=[],An=0;An<256;++An)On.push((An+256).toString(16).substr(1));const En=function(e,t,n){var a=(e=e||{}).random||(e.rng||bn)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=a[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(On[e[t+0]]+On[e[t+1]]+On[e[t+2]]+On[e[t+3]]+"-"+On[e[t+4]]+On[e[t+5]]+"-"+On[e[t+6]]+On[e[t+7]]+"-"+On[e[t+8]]+On[e[t+9]]+"-"+On[e[t+10]]+On[e[t+11]]+On[e[t+12]]+On[e[t+13]]+On[e[t+14]]+On[e[t+15]]).toLowerCase();if(!Rn(n))throw TypeError("Stringified UUID is invalid");return n}(a)};var Cn;!function(e){e.RegisterStorefrontProvider="register-storefront-provider",e.DeregisterStorefrontProvider="deregister-storefront-provider",e.GetStorefrontProviders="get-storefront-providers",e.HideStorefront="hide-storefront",e.GetStorefrontProviderApps="get-storefront-provider-apps",e.GetStorefrontProviderLandingPage="get-storefront-provider-landing-page",e.GetStorefrontProviderFooter="get-storefront-provider-footer",e.GetStorefrontProviderNavigation="get-storefront-provider-navigation",e.LaunchStorefrontProviderApp="launch-storefront-provider-app",e.ShowStorefront="show-storefront",e.CreateStorefrontWindow="create-storefront-window",e.ShowHome="show-home",e.HideHome="hide-home",e.AssignHomeSearchContext="assign-home-search-context",e.GetLegacyPages="get-legacy-pages",e.GetLegacyWorkspaces="get-legacy-workspaces"}(Cn||(Cn={})),z("__of_workspace_protocol__");var Fn,kn;!function(e){e.HomeIndex="/home/",e.HomeSearch="/home/search/",e.HomePagesRename="/home/pages/rename/",e.Dock="/home/dock/",e.BrowserPagesLanding="/browser/pages/landing/",e.HomeIndicator="/home/indicator/",e.Browser="/browser/",e.BrowserPopupMenu="/browser/popup-menu/",e.Provider="/provider/",e.BrowserPopupMenuSharePage="/browser/popup-menu/share-page/",e.BrowserPopupMenuSavePage="/browser/popup-menu/save-page/",e.BrowserPopupMenuLayouts="/browser/popup-menu/layouts/layouts/",e.BrowserPopupMenuColorLinking="/browser/popup-menu/color-linking/color-linking/",e.BrowserIndicator="/browser/indicator/",e.ResponseModal="/browser/popup-menu/response-modal/",e.Docs="/provider/docs/",e.Storefront="/storefront/",e.DeprecatedAlert="/provider/deprecated-alert/"}(Fn||(Fn={})),function(e){e.IconOpenFinLogo="/icons/openfinlogo.svg",e.IconFilter="/icons/filter.svg"}(kn||(kn={}));const Tn=w+{...kn,...Fn}.Browser;function Ln(e){e.detachOnClose=!0}const Un=e=>{var t,n;const a=e.name===A.Home,o=null===(t=e.name)||void 0===t?void 0:t.startsWith(A.HomeInternal),i=null===(n=e.name)||void 0===n?void 0:n.startsWith(A.BrowserMenu);return!a&&!o&&!i},$n=e=>"workspacePlatform"in e?e:(({workstacks:e,pages:t,...n})=>({...n,workspacePlatform:{pages:t||e||null}}))(e),Dn={contextMenuSettings:{reload:!1},url:Tn,contextMenu:!0,waitForPageLoad:!0,cornerRounding:{height:8,width:8},closeOnLastViewRemoved:!1,experimental:{showFavicons:!0,defaultFaviconUrl:`${w}/icons/defaultFavicon.svg`},permissions:{System:{openUrlWithBrowser:{enabled:!0,protocols:["mailto"]}}}},Bn={dimensions:{borderWidth:3,headerHeight:30}},Mn=e=>{const t=fin.Window.wrapSync(e);return Promise.all([t.bringToFront(),t.restore(),t.focus()])};const Gn=e=>async t=>{class n extends t{constructor(){super(...arguments),this.isWorkspacePlatform=()=>!0,this.getSavedPage=Te,this.getSavedPages=Le,this.createSavedPage=Ue,this.deleteSavedPage=$e,this.updateSavedPage=De,this.attachPagesToWindow=ce,this.addPage=ce,this.detachPagesFromWindow=ue,this.getOpenPages=ee,this.getPagesForWindow=pe,this.getPageForWindow=ge,this.setActivePageForWindow=le,this.launchApp=Sn,this.savePage=se,this.createSavedPageInternal=oe,this.updateSavedPageInternal=re,this.deleteSavedPageInternal=ie,this.reorderPagesForWindow=fe,this.getUniquePageTitle=ye,this.updatePageForWindow=de,this.getLastFocusedBrowserWindow=x}async getSnapshot(){const e=await async function(e){const t=await U();return await Promise.all(t.map((({identity:e})=>(async e=>(await Z(e)).dispatch(Y.UpdatePagesWindowOptions))(e)))),e?e():Ae()}((async()=>Ae(await super.getSnapshot(void 0,fin.me.identity))));return{...e,windows:e.windows.filter(Un)}}async applySnapshot({snapshot:e,options:t}){(null==t?void 0:t.closeExistingWindows)&&await async function(){const e=await U();await Promise.all(e.map((e=>e.close(!0).catch((()=>{})))))}();let n=e;return"string"==typeof n&&(n=await super.fetchManifest({manifestUrl:n},fin.me.identity)),async function(e,t){var n;const a=await ee(),o=(null===(n=e.snapshotDetails)||void 0===n?void 0:n.monitorInfo)||await fin.System.getMonitorInfo(),i=(e.windows||[]).filter((({layout:e})=>!!e)),r=new Map;a.forEach((e=>r.set(e.pageId,e)));const s=[],c=i.map((async e=>{var t;const n=$n(e),a=[],o=(e=>{let t=!1;const n=(e||[]).map((e=>{const n={pageId:(a=e).pageId||a.id,title:a.title||a.name,isReadOnly:a.isReadOnly,layout:a.layout,isActive:a.isActive};var a;return t&&n.isActive&&(n.isActive=!1),n.isActive&&(t=!0),n}));return!t&&n.length&&(n[0].isActive=!0),n})(null===(t=null==n?void 0:n.workspacePlatform)||void 0===t?void 0:t.pages);if(!(null==o?void 0:o.length)){const e=await ye();a.push(await(async(e,t)=>{const n=await(async e=>({...e,layoutDetails:{machineId:await Oe(),machineName:be()}}))(t);return{pageId:En(),title:e,layout:n,isReadOnly:!1,hasUnsavedChanges:!0}})(e,n.layout))}let i;o.forEach((e=>{const t=r.get(e.pageId);t?i=t:a.push(e)})),i&&await Promise.all([le({identity:i.parentIdentity,pageId:i.pageId}),Mn(i.parentIdentity)]),a.length&&s.push({...n,workspacePlatform:{...n.workspacePlatform,pages:a}})}));if(await Promise.all(c),!s.length)return;const d=fin.Platform.getCurrentSync();return(t||d.applySnapshot.bind(d))({...e,snapshotDetails:{...e.snapshotDetails,monitorInfo:o},windows:s})}(n,(e=>super.applySnapshot({snapshot:e,options:{...t,closeExistingWindows:!1}})))}async createWindow(e,t){let n=$n(e);return n=(e=>{var t;const n=null===(t=null==e?void 0:e.workspacePlatform)||void 0===t?void 0:t.pages;if(n){const t=n.find((e=>e.isActive));t?e.layout=t.layout:(n[0].isActive=!0,e.layout=n[0].layout)}if(e.layout){Object.assign(e,Dn),e.layout=Object.assign(e.layout,Bn),(e.icon||e.taskbarIcon)&&(e.taskbarIconGroup=e.taskbarIconGroup||fin.me.identity.uuid);const t=e.workspacePlatform.newTabUrl;t&&(e.layout.settings||(e.layout.settings={}),e.layout.settings.newTabButton={url:t})}return e})(n),n=await(async e=>{const t=await fin.System.getMonitorInfo(),n=t.primaryMonitor.availableRect.bottom-t.primaryMonitor.availableRect.top,a=t.primaryMonitor.availableRect.right-t.primaryMonitor.availableRect.left;return e.defaultHeight=e.defaultHeight||"800",e.defaultWidth=e.defaultWidth||"800",n<e.defaultHeight&&(e.defaultHeight=n),a<e.defaultWidth&&(e.defaultWidth=a),e})(n),super.createWindow(n,t)}async createView(e,t){return Ln(e.opts),super.createView(e,t)}async replaceView(e,t){return Ln(e.opts.newView),super.replaceView(e,t)}async replaceLayout(e,t){var n;return null===(n=e.opts.layout)||void 0===n||delete n.dimensions,super.replaceLayout(e,t)}async closeView(e,t){const n=fin.View.wrapSync(e.view);await super.closeView(e,t),await n.destroy().catch((e=>e))}}return"function"==typeof(null==e?void 0:e.overrideCallback)?e.overrideCallback(n):new n};async function _n(){(function(){const e=O(R);e.addListener(b.WindowOptionsChanged,Se),e.addListener(b.WindowClosed,Ie),e.addListener(b.WindowCreated,Ie)})(),async function(){const e=fin.Application.getCurrentSync();await e.addListener("window-focused",N)}(),g!==o.Local&&T().addListener(E.ShowRequested,(()=>async function(e){const t=F(e);await t.blur(),await t.hide()}(k)))}let xn;const Nn=async e=>{const t="23.96.67.7".split(".").map((e=>parseInt(e)));if(await(async e=>new Promise((async t=>{const n=(await fin.System.getVersion()).split(".").map((e=>parseInt(e)));t(e.every(((t,a)=>!(a<3)||n[a]===e[a])))})))(t))return function(e){if(!r)throw new Error("Cannot be used outside an OpenFin env.");return xn||(fin.Platform.getCurrentSync().once("platform-api-ready",(()=>_n())),xn=fin.Platform.init({overrideCallback:Gn(e),interopOverride:null==e?void 0:e.interopOverride})),xn}(null==e?void 0:e.browser);throw new Error(`Runtime version is not supported. ${t[0]}.${t[1]}.${t[2]}.* is required`)},Vn=e=>(e=>{const t=fin.Platform.wrapSync(e);return Object.assign(t,{applySnapshot:async t=>{if("string"!=typeof t&&!(null==t?void 0:t.windows))throw new Error("Not a valid browser snapshot");return fin.Platform.wrapSync(e).applySnapshot(t)},getSnapshot:()=>fin.Platform.wrapSync(e).getSnapshot().then((e=>e)),launchApp:async t=>(t.target||(t.target={uuid:u,name:l,entityType:p||"unknown"}),(await v(e)).dispatch(h.LaunchApp,t)),Browser:P(e),Storage:S(e)})})(e),Hn=()=>Vn(fin.me.identity)})(),module.exports=a})();
|
|
2
|
+
//# sourceMappingURL=index.js.map
|