@openfin/workspace 6.2.4 → 6.3.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/home.d.ts +2 -1
- package/client-api/src/index.d.ts +8 -5
- package/client-api/src/notifications.d.ts +13 -0
- package/client-api/src/shapes/common.d.ts +5 -0
- package/client-api/src/shapes/home.d.ts +415 -0
- package/client-api/src/shapes/index.d.ts +7 -0
- package/client-api/src/shapes/notifications.d.ts +20 -0
- package/client-api/src/shapes/store.d.ts +467 -0
- package/client-api/src/{templates.d.ts → shapes/templates.d.ts} +0 -0
- package/client-api/src/storefront.d.ts +2 -1
- package/client-api-platform/src/api/app-directory.d.ts +7 -0
- package/client-api-platform/src/api/browser/browser-module.d.ts +20 -0
- package/client-api-platform/src/api/browser/index.d.ts +26 -0
- package/client-api-platform/src/api/context-menu/browser-logo-handler.d.ts +3 -0
- package/client-api-platform/src/api/context-menu/browser-pagetab-handler.d.ts +3 -0
- package/client-api-platform/src/api/context-menu/browser-viewtab-handler.d.ts +3 -0
- package/client-api-platform/src/api/context-menu/index.d.ts +13 -0
- package/client-api-platform/src/api/index.d.ts +4 -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 +51 -0
- package/client-api-platform/src/api/storage.d.ts +10 -0
- package/client-api-platform/src/api/theming.d.ts +5 -0
- package/client-api-platform/src/index.d.ts +3 -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/custom-actions.d.ts +3 -0
- package/client-api-platform/src/init/index.d.ts +37 -0
- package/client-api-platform/src/init/override-callback.d.ts +4 -0
- package/client-api-platform/src/init/theming.d.ts +9 -0
- package/client-api-platform/src/init/utils.d.ts +33 -0
- package/client-api-platform/src/shapes.d.ts +1177 -0
- package/common/src/api/browser-protocol.d.ts +23 -0
- package/common/src/api/pages/attached.d.ts +100 -0
- package/common/src/api/pages/idb.d.ts +12 -0
- package/common/src/api/pages/legacy.d.ts +16 -0
- package/common/src/api/theming.d.ts +62 -0
- package/common/src/utils/context-menu.d.ts +12 -0
- package/common/src/utils/debounce.d.ts +16 -0
- package/common/src/utils/defer-show.d.ts +46 -0
- package/common/src/utils/global-context-menu.d.ts +3 -0
- package/common/src/utils/landing-page.d.ts +11 -0
- package/common/src/utils/merge-deep.d.ts +6 -0
- package/common/src/utils/page-tab-context-menu.d.ts +2 -0
- package/common/src/utils/route.d.ts +55 -0
- package/common/src/utils/shared-emitter.d.ts +10 -0
- package/common/src/utils/strings.d.ts +3 -0
- package/common/src/utils/theming.d.ts +57 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/client-api/src/logger.d.ts +0 -1
- package/client-api/src/shapes.d.ts +0 -883
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
export declare const getWindowChannelId: (identity: OpenFin.Identity) => string;
|
|
3
|
+
export declare const getChannelClient: (identity: OpenFin.Identity) => Promise<import("openfin-adapter").ChannelClient>;
|
|
4
|
+
/**
|
|
5
|
+
* If the browser window is reloaded too quickly, runtime will
|
|
6
|
+
* respond that the channel provider has already been created.
|
|
7
|
+
* Hence, we retry a couple of times to make sure this does not occur.
|
|
8
|
+
* (Should only happen in local development)
|
|
9
|
+
*/
|
|
10
|
+
export declare const createChannel: () => Promise<import("openfin-adapter").ChannelProvider>;
|
|
11
|
+
export interface AddToChannelRequest {
|
|
12
|
+
newChannelId: string;
|
|
13
|
+
selectedViews: OpenFin.Identity[];
|
|
14
|
+
}
|
|
15
|
+
export declare enum ChannelAction {
|
|
16
|
+
CloseBrowserWindow = "close-browser-window",
|
|
17
|
+
QuitPlatform = "quit-platform",
|
|
18
|
+
ClosePage = "close-page",
|
|
19
|
+
AddToChannel = "add-to-channel",
|
|
20
|
+
RemoveFromChannel = "remove-from-channel",
|
|
21
|
+
SavePage = "save-page",
|
|
22
|
+
DuplicatePage = "duplicate-page"
|
|
23
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import type { AttachedPage, AttachPagesToWindowPayload, DetachPagesFromWindowPayload, ReorderPagesForWindowPayload, SetActivePageForWindowPayload, UpdatePageForWindowPayload } from './shapes';
|
|
3
|
+
/**
|
|
4
|
+
* All of the remote procedures that can be called in the
|
|
5
|
+
* platform window's address space regarding attached pages.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ChannelAction {
|
|
8
|
+
GetPages = "get-pages",
|
|
9
|
+
GetActivePageForWindow = "get-active-page-for-window",
|
|
10
|
+
AttachPagesToWindow = "attach-pages-to-window",
|
|
11
|
+
DetachPagesFromWindow = "detach-pages-from-window",
|
|
12
|
+
SetActivePageForWindow = "set-active-page-for-window",
|
|
13
|
+
RenamePage = "rename-page",
|
|
14
|
+
ReorderPagesForWindow = "reorder-pages-for-window",
|
|
15
|
+
UpdatePageForWindow = "update-page-for-window",
|
|
16
|
+
UpdatePagesWindowOptions = "update-pages-window-options",
|
|
17
|
+
IsDetachingPages = "is-detaching-pages",
|
|
18
|
+
IsActivePageChanging = "is-active-page-changing"
|
|
19
|
+
}
|
|
20
|
+
export declare enum EventType {
|
|
21
|
+
AttachedPagesToWindow = "attached-pages-to-window",
|
|
22
|
+
DetachedPagesFromWindow = "detached-pages-from-window"
|
|
23
|
+
}
|
|
24
|
+
export declare const getEventEmitter: (identity: OpenFin.Identity) => {
|
|
25
|
+
emit: (event: string | number, ...payload: any[]) => Promise<void>;
|
|
26
|
+
addListener: (event: string | number, listener: import("@common/utils/shared-emitter").Listener) => void;
|
|
27
|
+
removeListener: (event: string | number, listener: import("@common/utils/shared-emitter").Listener) => void;
|
|
28
|
+
once: (event: string | number, listener: import("@common/utils/shared-emitter").Listener) => void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Get the pages attached to a window.
|
|
32
|
+
* @param identity the identity of the window to get the attached pages of.
|
|
33
|
+
* @returns the pages attached to the window.
|
|
34
|
+
*/
|
|
35
|
+
export declare const getPages: (identity: OpenFin.Identity) => Promise<AttachedPage[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the active attached page for the specified window.
|
|
38
|
+
* @param identity the window identity to get the active attached page of.
|
|
39
|
+
* @returns the active attached page for the window.
|
|
40
|
+
*/
|
|
41
|
+
export declare const getActivePageForWindow: (identity: OpenFin.Identity) => Promise<AttachedPage>;
|
|
42
|
+
/**
|
|
43
|
+
* Set the active attached page for the specified window.
|
|
44
|
+
* @param identity the window identity to set the active attached page of.
|
|
45
|
+
*/
|
|
46
|
+
export declare const setActivePageForWindow: (payload: SetActivePageForWindowPayload) => Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Attach a page to an open window.
|
|
49
|
+
* If the page is already attached to a window, an error will be thrown.
|
|
50
|
+
*
|
|
51
|
+
* @param payload the attach pages to window payload.
|
|
52
|
+
*/
|
|
53
|
+
export declare const attachPagesToWindow: (payload: AttachPagesToWindowPayload) => Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Detach pages from the window they are currently attached to.
|
|
56
|
+
* A detached page will not have its views cleaned up.
|
|
57
|
+
*
|
|
58
|
+
* @param payload the detach pages from window payload.
|
|
59
|
+
*/
|
|
60
|
+
export declare const detachPagesFromWindow: (payload: DetachPagesFromWindowPayload) => Promise<void>;
|
|
61
|
+
export interface RenamePagePayload {
|
|
62
|
+
/** The OF window identity the page is attached to. */
|
|
63
|
+
identity: OpenFin.Identity;
|
|
64
|
+
/** The id of the page to change the name of. */
|
|
65
|
+
pageId: string;
|
|
66
|
+
/** The new title of the page. */
|
|
67
|
+
newTitle: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Rename an attached page.
|
|
71
|
+
* The page must be attached to the specified window.
|
|
72
|
+
*
|
|
73
|
+
* @param page the page to rename.
|
|
74
|
+
*/
|
|
75
|
+
export declare const renamePage: (payload: RenamePagePayload) => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Reorder pages attached to an open window.
|
|
78
|
+
* @param payload the reorder pages for window payload.
|
|
79
|
+
*/
|
|
80
|
+
export declare const reorderPagesForWindow: (payload: ReorderPagesForWindowPayload) => Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Update a page attached to a window.
|
|
83
|
+
* @param payload the update page for window payload.
|
|
84
|
+
*/
|
|
85
|
+
export declare const updatePageForWindow: (payload: UpdatePageForWindowPayload) => Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Forces a window to save its attached page state to window options.
|
|
88
|
+
* @param identity the identity of the window to save the pages of in window options.
|
|
89
|
+
*/
|
|
90
|
+
export declare const updatePagesWindowOptions: (identity: OpenFin.Identity) => Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Check if the window identity is currently detaching pages.
|
|
93
|
+
* @param identity the OF window identity to check.
|
|
94
|
+
*/
|
|
95
|
+
export declare const isDetachingPages: (identity: OpenFin.Identity) => Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Check if the window identity is in the middle of changing active pages.
|
|
98
|
+
* @param identity the OF window identity to check.
|
|
99
|
+
*/
|
|
100
|
+
export declare const isActivePageChanging: (identity: OpenFin.Identity) => Promise<boolean>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Page } from '../../../../common/src/api/pages/shapes';
|
|
2
|
+
export declare const store: import("idb-keyval").UseStore;
|
|
3
|
+
export declare function getPage(id: string): Promise<Page>;
|
|
4
|
+
export declare function getPageList(filter?: string): Promise<Page[]>;
|
|
5
|
+
export declare function createPage({ page }: {
|
|
6
|
+
page: any;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare function deletePage(id: string): Promise<void>;
|
|
9
|
+
export declare function updatePage({ pageId, page }: {
|
|
10
|
+
pageId: any;
|
|
11
|
+
page: any;
|
|
12
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AttachedPage, PageLayout } from '../../../../common/src/api/pages/shapes';
|
|
2
|
+
interface Workstack {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
isReadOnly: boolean;
|
|
6
|
+
layout: PageLayout;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function convertWorkstackToAttachedPage({ id, name, ...rest }: Workstack & AttachedPage): AttachedPage;
|
|
10
|
+
/**
|
|
11
|
+
* Attempts to fix any misconfigurations in a list of attached pages.
|
|
12
|
+
* @param pages the pages to fix.
|
|
13
|
+
* @returns the fixed pages.
|
|
14
|
+
*/
|
|
15
|
+
export declare const fixAttachedPages: (pages: AttachedPage[]) => AttachedPage[];
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import type { ThemePaletteSet } from '@openfin/ui-library';
|
|
3
|
+
export interface ComputedThemes extends Array<ComputedTheme> {
|
|
4
|
+
}
|
|
5
|
+
export interface ComputedTheme {
|
|
6
|
+
label: string;
|
|
7
|
+
logoUrl?: string;
|
|
8
|
+
theme: ThemePaletteSet;
|
|
9
|
+
}
|
|
10
|
+
export interface CustomThemes extends Array<CustomThemeOptions> {
|
|
11
|
+
}
|
|
12
|
+
export interface CustomThemeOptions {
|
|
13
|
+
label: string;
|
|
14
|
+
logoUrl?: string;
|
|
15
|
+
palette: CustomPaletteSet;
|
|
16
|
+
}
|
|
17
|
+
export interface DefaultPaletteSet {
|
|
18
|
+
brandPrimary: string;
|
|
19
|
+
brandSecondary: string;
|
|
20
|
+
backgroundPrimary: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CustomPaletteSet extends DefaultPaletteSet {
|
|
23
|
+
functional1?: string;
|
|
24
|
+
functional2?: string;
|
|
25
|
+
functional3?: string;
|
|
26
|
+
functional4?: string;
|
|
27
|
+
functional5?: string;
|
|
28
|
+
functional6?: string;
|
|
29
|
+
functional7?: string;
|
|
30
|
+
functional8?: string;
|
|
31
|
+
functional9?: string;
|
|
32
|
+
functional10?: string;
|
|
33
|
+
statusSuccess?: string;
|
|
34
|
+
statusWarning?: string;
|
|
35
|
+
statusCritical?: string;
|
|
36
|
+
statusActive?: string;
|
|
37
|
+
inputBackground?: string;
|
|
38
|
+
inputColor?: string;
|
|
39
|
+
inputPlaceholder?: string;
|
|
40
|
+
inputDisabled?: string;
|
|
41
|
+
inputFocused?: string;
|
|
42
|
+
textDefault?: string;
|
|
43
|
+
textHelp?: string;
|
|
44
|
+
textInactive?: string;
|
|
45
|
+
background1?: string;
|
|
46
|
+
background2?: string;
|
|
47
|
+
background3?: string;
|
|
48
|
+
background4?: string;
|
|
49
|
+
background5?: string;
|
|
50
|
+
background6?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* computeThemes()
|
|
54
|
+
* Accepts the array of registered CustomThemes objects
|
|
55
|
+
* Creates a light and dark palette from a tempalte overriding with custom options
|
|
56
|
+
* Uses createTheme to build theme object
|
|
57
|
+
* Creates a ThemePaletteSet
|
|
58
|
+
* @param customPalettes
|
|
59
|
+
* @returns theme object ready to be applied to the UI
|
|
60
|
+
*/
|
|
61
|
+
export declare const computeThemes: (customPalettes: CustomThemes) => ComputedThemes;
|
|
62
|
+
export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<ComputedTheme>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import { _Window } from 'openfin-adapter/src/api/window';
|
|
3
|
+
export declare enum MenuItemType {
|
|
4
|
+
Label = "normal",
|
|
5
|
+
Separator = "separator",
|
|
6
|
+
Submenu = "submenu",
|
|
7
|
+
Checkbox = "checkbox"
|
|
8
|
+
}
|
|
9
|
+
export declare type ShowContextMenuResponse = OpenFin.MenuResult & {
|
|
10
|
+
data: string;
|
|
11
|
+
};
|
|
12
|
+
export default function showContextMenu(opts: OpenFin.ShowPopupMenuOptions, win?: _Window): Promise<ShowContextMenuResponse>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const makeDebouncedFunc: <T extends (...args: any[]) => Promise<any>>(func: T, debounceTimeout?: number) => T;
|
|
2
|
+
/**
|
|
3
|
+
* Debounce a specified function.
|
|
4
|
+
*
|
|
5
|
+
* When the debounced function is called, the underlying wrapped function
|
|
6
|
+
* will be called.
|
|
7
|
+
*
|
|
8
|
+
* If the function is called again while the promise returned by the wrapped
|
|
9
|
+
* function is still resolving, the call will be blocked until the promise has
|
|
10
|
+
* resolved.
|
|
11
|
+
*
|
|
12
|
+
* Once the promise has been resolved, the wrapped function will be called again
|
|
13
|
+
* after a specified debounce timeout.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export default makeDebouncedFunc;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
interface InternalWindowOptions extends OpenFin.PlatformWindowCreationOptions {
|
|
3
|
+
workspacePlatform: OpenFin.WindowOptions['workspacePlatform'] & {
|
|
4
|
+
_internalAutoShow: boolean;
|
|
5
|
+
_internalDeferShowEnabled: boolean;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* This function prevents a created window from being auto shown by the Core.
|
|
10
|
+
* The Core will auto show the window before the window has a chance to register a listener to prevent it.
|
|
11
|
+
* With these options applied, the window must call `setCanShow(true)` when it is ready to be shown.
|
|
12
|
+
* If `autoShow` was originally true, the window will be show upon the first call to `setCanShow(true)`.
|
|
13
|
+
*
|
|
14
|
+
* By applying these options it is assumed that the window calls `registerDeferShow()` and `setCanShow(true)`.
|
|
15
|
+
*
|
|
16
|
+
* This function should be used in conjunction the `withDeferShow` platform middleware.
|
|
17
|
+
* `withDeferShow` will prevent the window from being shown before the window has launched and registered
|
|
18
|
+
* its show requested listener.
|
|
19
|
+
*
|
|
20
|
+
* @param opts the options to modify.
|
|
21
|
+
* @returns the modified options.
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyDeferShowOptions: (opts: OpenFin.PlatformWindowCreationOptions) => InternalWindowOptions;
|
|
24
|
+
/**
|
|
25
|
+
* This function is a middleware that can be applied to a platform's `createWindow` function.
|
|
26
|
+
* If the defer show API has been enabled in window options using the `applyDeferShowOptions` function
|
|
27
|
+
* the window will be prevented from showing.
|
|
28
|
+
* @param superCreateWindow the create window method to decorate.
|
|
29
|
+
* @returns the `createWindow` method wrapped with this middleware.
|
|
30
|
+
*/
|
|
31
|
+
export declare const withDeferShow: (superCreateWindow: (opts: OpenFin.PlatformWindowCreationOptions, callerIdentity: OpenFin.Identity) => Promise<OpenFin.Window>) => (opts: OpenFin.PlatformWindowCreationOptions, callerIdentity?: OpenFin.Identity) => Promise<import("openfin-adapter").Window>;
|
|
32
|
+
/**
|
|
33
|
+
* Assert if the window is able to be shown or not.
|
|
34
|
+
* Upon calling `setCanShow(true)`, if the window was previously prevented
|
|
35
|
+
* from being shown, this function will show the window.
|
|
36
|
+
* @param bool true if the window should be able to be shown. (Default is false)
|
|
37
|
+
*/
|
|
38
|
+
export declare const setCanShow: (bool: boolean) => Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Add a listener that defers showing the current window.
|
|
41
|
+
* To allow the window to be shown, `setCanShow(true)` must be called.
|
|
42
|
+
* Upon calling `setCanShow(true)`, if the window was previously prevented
|
|
43
|
+
* from being shown, it will show.
|
|
44
|
+
*/
|
|
45
|
+
export declare const registerDeferShow: () => Promise<void>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
2
|
+
import { GlobalContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
|
|
3
|
+
export declare const getGlobalContextMenuTemplate: (winIdentity: NamedIdentity) => Promise<GlobalContextMenuItemTemplate[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
3
|
+
interface LandingPageUrls {
|
|
4
|
+
newPageUrl: string | false;
|
|
5
|
+
newTabUrl: string | false;
|
|
6
|
+
}
|
|
7
|
+
export declare const getLandingPageUrls: (winIdentity?: NamedIdentity) => Promise<LandingPageUrls>;
|
|
8
|
+
export declare const checkHasNewTabUrl: () => Promise<boolean>;
|
|
9
|
+
export declare const getNewLandingTabViewOptions: (target: OpenFin.Identity) => Promise<OpenFin.PlatformViewCreationOptions>;
|
|
10
|
+
export declare const makeNewLandingPage: (winIdentity?: NamedIdentity) => Promise<import("@client-platform/shapes").PageWithUpdatableRuntimeAttribs>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep merge a set of source objects into a single target object.
|
|
3
|
+
* @param target the target object to merge sources into.
|
|
4
|
+
* @param sources the source objects to merge into the target. (FIFO)
|
|
5
|
+
*/
|
|
6
|
+
export declare function mergeDeep(target: any, ...sources: any[]): any;
|
|
@@ -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,57 @@
|
|
|
1
|
+
import { CustomPaletteSet } from '../../../common/src/api/theming';
|
|
2
|
+
/**
|
|
3
|
+
* Get hue from a CSS color
|
|
4
|
+
*
|
|
5
|
+
* The getHue function is used manage extracting hue from 3 types of css
|
|
6
|
+
* string input types. An object including hue, hsl, hsla, lightness and
|
|
7
|
+
* saturation are returned.
|
|
8
|
+
*
|
|
9
|
+
* Each function was copied css tricks and modified to fit this platform.
|
|
10
|
+
* Links above each function for technical details.
|
|
11
|
+
*
|
|
12
|
+
* Allowed formats:
|
|
13
|
+
* RGB with or with out the alpha rgb(x,x,x) or rgba(x,x,x,x)
|
|
14
|
+
* HEX 3 or 6 characters, plus hashtag #333 or #333333
|
|
15
|
+
* HSL with or with out the alhpa hsl(x,x%,x%) or hsla(x,x%,x%,x)
|
|
16
|
+
*
|
|
17
|
+
* The hue value is used later to build an array of background colors in the
|
|
18
|
+
* theme that are various shades of the hue returned from this function.
|
|
19
|
+
*
|
|
20
|
+
* An invalid format should error telling the integrator how to fix the error.
|
|
21
|
+
* - Error for missing required options
|
|
22
|
+
* - Error for invalid css strings that are unable to be processed
|
|
23
|
+
*
|
|
24
|
+
* @param colorInput string - Supported formats rgb/RGB/rgba/RGBA, #000/#000000, hsl/HSL/hsla/HSLA
|
|
25
|
+
* @returns hue as string
|
|
26
|
+
*/
|
|
27
|
+
export declare const getHue: (colorInput: string) => string;
|
|
28
|
+
export declare const makeBackgroundLayers: (hue: string) => {
|
|
29
|
+
light: {
|
|
30
|
+
background1: string;
|
|
31
|
+
background2: string;
|
|
32
|
+
background3: string;
|
|
33
|
+
background4: string;
|
|
34
|
+
background5: string;
|
|
35
|
+
background6: string;
|
|
36
|
+
};
|
|
37
|
+
dark: {
|
|
38
|
+
background1: string;
|
|
39
|
+
background2: string;
|
|
40
|
+
background3: string;
|
|
41
|
+
background4: string;
|
|
42
|
+
background5: string;
|
|
43
|
+
background6: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* makePalette() - generic - doesn't care about scheme
|
|
48
|
+
*
|
|
49
|
+
* Accepts a default palette object, and a custom palette object.
|
|
50
|
+
* The default object gets overrides from customPalette and returns a new palette object.
|
|
51
|
+
* @param defaultPalette
|
|
52
|
+
* @param customPalette
|
|
53
|
+
* @returns { light: newPalette, dark: newPalette }
|
|
54
|
+
*
|
|
55
|
+
* TODO: DefaultPaletteSet isn't working, need to redo.
|
|
56
|
+
*/
|
|
57
|
+
export declare const makePalette: (defaultPalette: any, customPalette: CustomPaletteSet) => CustomPaletteSet;
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AppManifestType:()=>D,ButtonStyle:()=>x,CLIAction:()=>_,CLIFilterOptionType:()=>q,CLITemplate:()=>$,ContainerTemplateFragmentNames:()=>B,Home:()=>Ut,Legacy:()=>Vt,PresentationTemplateFragmentNames:()=>E,SearchTagBackground:()=>A,Storefront:()=>Ht,StorefrontTemplate:()=>F,TemplateFragmentTypes:()=>W});var n={};e.r(n),e.d(n,{subscribe:()=>Ae});var r={};e.r(r),e.d(r,{create:()=>yt});var o={};e.r(o),e.d(o,{deregister:()=>kt,hide:()=>Bt,register:()=>Tt,show:()=>Ot});var i={};e.r(i),e.d(i,{getPages:()=>xt,getWorkspaces:()=>Mt});var s,a={};e.r(a),e.d(a,{deregister:()=>qt,hide:()=>Gt,register:()=>$t,show:()=>Nt}),function(e){e.Local="local",e.Dev="dev",e.Staging="staging",e.Prod="prod"}(s||(s={}));const c="undefined"!=typeof window&&"undefined"!=typeof fin,d=("undefined"==typeof process||process.env?.JEST_WORKER_ID,"undefined"!=typeof window),u=d?window.origin:s.Local,f=(c&&fin.me.uuid,c&&fin.me.name,c&&fin.me.entityType,"prod"===s.Local),l=(s.Dev,s.Staging,s.Prod,e=>e.startsWith("http://")||e.startsWith("https://")?e:u+e),p=(l("https://cdn.openfin.co/workspace/6.2.4"),l("https://cdn.openfin.co/workspace/6.2.4"),"undefined"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&l(WORKSPACE_DOCS_PLATFORM_URL),"undefined"!=typeof WORKSPACE_DOCS_CLIENT_URL&&l(WORKSPACE_DOCS_CLIENT_URL),d&&"complete"!==document.readyState&&new Promise((e=>document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&e()})))));var g,w,h;!function(e){e.Workspace="openfin-browser"}(g||(g={})),function(e){e.RunRequested="run-requested",e.WindowOptionsChanged="window-options-changed",e.WindowClosed="window-closed",e.WindowCreated="window-created"}(w||(w={})),function(e){e.FinProtocol="fin-protocol"}(h||(h={}));g.Workspace,g.Workspace;var y,v;!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"}(y||(y={})),function(e){e.Shown="shown",e.BoundsChanged="bounds-changed",e.LayoutReady="layout-ready",e.EndUserBoundsChanging="end-user-bounds-changing",e.Blurred="blurred",e.CloseRequested="close-requested",e.Focused="focused",e.ShowRequested="show-requested",e.ViewCrashed="view-crashed",e.ViewAttached="view-attached",e.ViewDetached="view-detached",e.ViewPageTitleUpdated="view-page-title-updated",e.ViewDestroyed="view-destroyed",e.OptionsChanged="options-changed"}(v||(v={}));function m(e){if(!c)throw new Error("getOFWindow can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");return fin.Window.wrapSync(e)}y.Home,g.Workspace,y.Dock,g.Workspace,y.Storefront,g.Workspace;const S={name:g.Workspace,uuid:g.Workspace};const C=e=>m(e).getOptions().then((()=>!0)).catch((()=>!1));var R;!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",e.GetComputedPlatformTheme="get-computed-platform-theme"}(R||(R={}));const P=function(e){let t;return()=>{if(!c)throw new Error("getChannelClient cannot be used outside an OpenFin env. Avoid using this method during pre-rendering.");return t||(t=(async()=>{await p;const n=await fin.InterApplicationBus.Channel.connect(e);return n.onDisconnection((async()=>{t=void 0})),n})().then((e=>e)).catch((n=>{throw t=void 0,new Error(`failed to connect to channel provider ${e}: ${n}`)}))),t}}("__of_workspace_protocol__"),b="isLaunchedViaLib",L=e=>{const t=new URL(e);return t.searchParams.append(b,"true"),t.toString()},I=async()=>{if(!await C(S))return(f||-1===navigator.userAgent.indexOf("Win"))&&await fin.Application.startFromManifest(L("https://cdn.openfin.co/workspace/6.2.4/app.json")),fin.System.openUrlWithBrowser(L("fins://system-apps/workspace"))},T=async()=>(await I(),P()),k="home";var O;!function(e){e.Commands="home-commands"}(O||(O={}));const B={Container:"Container",Button:"Button"},E={Text:"Text",Image:"Image",List:"List"},W={...B,...E};var x,M,A,D,F,_,$,q,G;!function(e){e.Primary="primary",e.Secondary="secondary",e.TextOnly="textOnly"}(x||(x={})),function(e){e.Fetching="fetching",e.Fetched="fetched",e.Complete="complete"}(M||(M={})),function(e){e.Active="active",e.Default="default"}(A||(A={})),function(e){e.Snapshot="snapshot",e.Manifest="manifest",e.View="view",e.External="external"}(D||(D={})),function(e){e.LandingPage="landingPage",e.AppGrid="appGrid"}(F||(F={})),function(e){e.Suggestion="suggestion"}(_||(_={})),function(e){e.Contact="Contact",e.Custom="Custom",e.List="List",e.Plain="Plain",e.SimpleText="SimpleText"}($||($={})),function(e){e.MultiSelect="MultiSelect"}(q||(q={})),function(e){e[e.Initial=0]="Initial",e[e.Open=1]="Open",e[e.Close=2]="Close"}(G||(G={}));const N="all",H="0",U="5",V="6",j=()=>{};function K(e,t){return e?`${e}-${t}`:t}function z(e){return`__search-${e}-topic__`}const J=new Map;function Q(e,t){J.has(e)||J.set(e,new Set),J.get(e).add(t)}function X(e,t){const n=J.get(e);n&&n.delete(t)}const Y=new Map;function Z(e,t){Y.has(e)||Y.set(e,new Set),Y.get(e).add(t)}function ee(e,t){const n=Y.get(e);n&&n.delete(t)}const te=new Map;async function ne(e,t){te.has(e)||te.set(e,new Map),te.get(e).set(t.id,t);const n=J.get(e);if(!n)return;const r=[...n].map((e=>e()));await Promise.all(r)}async function re(e,t){const n=te.get(e);if(!n)return;n.delete(t);const r=Y.get(e);if(!r)return;const o=[...r].map((e=>e()));await Promise.all(o)}function oe(e){return te.get(e)?[...te.get(e).values()]:[]}function ie(e){const t=te.get(e);t&&t.clear()}function se(e,t){const n=te.get(e);return n?n.get(t):null}function ae(e,t,n){return{...e,action:n||e.actions[0],dispatcherIdentity:t}}function ce(e,t,n="ascending"){const r=e||[];if(!t?.length)return r;const o=[],i=new Map;t.forEach((e=>{if(e.key)return i.set(e.key,e);o.push(e)}));let s=r.map((e=>{const{key:t}=e;if(t&&i.has(t)){const e=i.get(t);return i.delete(t),e}return e}));return s.push(...i.values(),...o),s="ascending"===n?s.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))):s.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))),s}function de(e){const t={};let n=[];let r=[];let o=G.Initial;t.getStatus=()=>o,t.getResultBuffer=()=>n,t.setResultBuffer=e=>{n=e,n?.length&&t.onChange()},t.getRevokedBuffer=()=>r,t.setRevokedBuffer=e=>{r=e,r?.length&&t.onChange()},t.onChange=j;const i={};return t.res=i,i.close=()=>{o!==G.Close&&(o=G.Close,t.onChange())},i.open=()=>{o!==G.Open&&(o=G.Open,t.onChange())},i.respond=n=>{const r=ce(t.getResultBuffer(),n,e);t.setResultBuffer(r)},i.revoke=(...e)=>{const n=new Set(e),r=t.getResultBuffer().filter((({key:e})=>{const t=n.has(e);return t&&n.delete(e),!t}));t.setResultBuffer(r),n.size&&(t.getRevokedBuffer().forEach((e=>n.add(e))),t.setRevokedBuffer([...n]))},t}function ue(e,t,n){const r=new Set;let o=!1;return{close:()=>{o=!0;for(const e of r)e()},req:{id:t,topic:e,...n,context:n?.context||{},onClose:e=>{r.add(e),o&&e()},removeListener:e=>{r.delete(e)}}}}function fe(){return{name:fin.me.name,uuid:fin.me.uuid}}function le(){let e;try{const t=fin.Platform.getCurrentSync();if(!t?.identity)return;e=t.identity.uuid}catch(e){}return e}const pe="deregistered or does not exist",ge=new Error(`provider ${pe}`),we=new Error("provider with name already exists"),he=new Error("bad payload"),ye=new Error("subscription rejected"),ve=new Error(`channel ${pe}`),me=new Map;function Se(e){const t=Ce(e);if(t)return t;throw ve}function Ce(e){const t=me.get(e);if(t)return t}function Re(e,t){me.set(e,t)}const Pe=new Map;function be(e){Pe.has(e)||Pe.set(e,new Map);const t=Pe.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 Le(e,t){return(await Se(e)).dispatch(H,t)}function Ie({namespacedTopic:e,topic:t}){const n=se.bind(null,e),r=be(e),o=Le.bind(null,e);return async(e,i)=>{if(!e||!e.id||!e.providerId){const e=he;return{error:e.message}}const{id:s,providerId:a}=e,c=n(a);if(!c){const e=ge;return{error:e.message}}const d=r.getRequestsForIdentity(i);let u=d.get(e.id);u||(u=ue(t,s,e),d.set(e.id,u));const f=de(),l=()=>{const e=f.getResultBuffer();f.setResultBuffer([]);const t=f.getRevokedBuffer();f.setRevokedBuffer([]);const n=f.getStatus();o({id:s,providerId:a,results:e,revoked:t,status:n})};let p=!0,g=!1;f.onChange=()=>{if(p)return p=!1,void l();g||(g=!0,setTimeout((()=>{g=!1,l()}),100))};try{const{results:e,context:t}=await c.onUserInput(u.req,f.res),n=f.getStatus();return{id:s,providerId:a,status:n,results:e,context:t}}catch(e){return{id:s,providerId:a,error:e.message}}}}async function Te(e,t,n){const r=n||await Se(e),o=fe(),i={identity:o,...t,onUserInput:void 0,onResultDispatch:void 0};await r.dispatch("2",i),await ne(e,{identity:o,...t})}async function ke(e,t){const n=await Se(e);return await n.dispatch("3",t),re(e,t)}async function Oe(e,t,n,r){const o=ae(n,fe(),r),i=se(e,t);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(o)}const s={providerId:t,result:o};return(await Se(e)).dispatch(U,s)}async function Be(e,t){const n={...t,context:t?.context||{}},r={},o=async function*(e,t,{setState:n}){const r=await Se(e);for(;;){const e=await r.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=>{r.state=e}});let i=await o.next();return r.id=n.id,r.close=()=>{!async function(e,t){(await Se(e)).dispatch(V,{id:t})}(e,r.id)},r.next=()=>{if(i){const e=i;return i=void 0,e}return o.next()},r}async function Ee(e){return(await Se(e)).dispatch("4",null)}async function We(e){const t=await Se(e);var n;n=e,me.delete(n),ie(e),await t.disconnect()}function xe(e){const{namespacedTopic:t}=e,n=be(t);return async r=>{if(!Ce(t))return;const o=n.getRequestsForIdentity(r);for(const{req:e,close:t}of o.values())t(),o.delete(e.id);Re(t,(async e=>{const{namespacedTopic:t}=e,n=await Me(e);for(const e of oe(t))await Te(t,e,n);return n})(e))}}async function Me(e){const{namespacedTopic:t}=e,n=z(t),r=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 r.register(H,Ie(e)),r.register(V,function(e){const t=be(e);return(e,n)=>{const r=t.getRequestsForIdentity(n),o=r.get(e.id);o&&(o.close(),r.delete(e.id))}}(t)),r.register(U,function(e){return async(t,n)=>{if(!t||!t.providerId||!t.result)return;const r=se(e,t.providerId);if(!r)return;const{onResultDispatch:o}=r;return o?(t.result.dispatcherIdentity=n,o(t.result)):void 0}}(t)),r.onDisconnection(xe(e)),r}async function Ae(e){const t=("string"==typeof e?e:e?.topic)||N,n=("string"==typeof e?null:e?.uuid)||le(),r=K(n,t),o={topic:t,namespace:n,namespacedTopic:r};let i=Ce(r);return i||(i=Me(o),Re(r,i),await i),{getAllProviders:Ee.bind(null,r),register:Te.bind(null,r),search:Be.bind(null,r),deregister:ke.bind(null,r),dispatch:Oe.bind(null,r),disconnect:We.bind(null,r)}}const De=new Map;function Fe(e){const t=_e(e);if(t)return t;throw ve}function _e(e){const t=De.get(e);if(t)return t}const $e=new Map;function qe(e,t){$e.has(e)||$e.set(e,new Set),$e.get(e).add(t)}function Ge(e,t){const n=$e.get(e);n&&n.delete(t)}function Ne(e){return[...oe(e)].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}async function He(e,t){if(se(e,t.id))throw new Error("provider with name already exists");const n=fe();await ne(e,{identity:n,...t})}function Ue(e,t){re(e,t)}async function Ve(e,t,n,r){const o=se(e,t);if(!o)throw ge;const{onResultDispatch:i}=o;if(!i)return;return i(ae(n,fe(),r))}async function*je(e,t,n){const r=function(e,t){const n=[],r=[],o=[],i=[];for(const s of e){const e=de(s.scoreOrder),a={results:[],provider:{id:s.id,identity:s.identity,title:s.title,scoreOrder:s.scoreOrder,icon:s.icon}};n.push(a),r.push(e);const c=(async()=>{try{const{results:n,context:r}=await s.onUserInput(t,e.res);a.results=ce(a.results,n),a.context={...a.context,...r}}catch(e){a.error=e}c.done=!0})();i.push(c),o.push(o.length)}return{providerResponses:n,listenerResponses:r,openListenerResponses:o,initialResponsePromises:i}}(t.targets?t.targets.map((t=>se(e,t))).filter((e=>!!e)):[...oe(e).filter((e=>!e.hidden))],t),{providerResponses:o,listenerResponses:i}=r;let{openListenerResponses:s,initialResponsePromises:a}=r,c=M.Fetching;const d=e=>{c=e,n.setState(c)};let u,f=!1;t.onClose((()=>{f=!0,u&&u()}));do{let e=!1;if(a.length){const t=[];for(const n of a)n.done?e=!0:t.push(n);a=t,a.length||(d(M.Fetched),e=!0)}let t,n=!1;const r=()=>{n=!0,t&&t()},l=[];for(const t of s){const n=i[t],s=o[t],a=n.getStatus();(a===G.Open||c===M.Fetching&&a===G.Initial)&&(l.push(t),n.onChange=r);const d=n.getResultBuffer();d.length&&(n.setResultBuffer([]),s.results=ce(s.results,d),e=!0);const u=n.getRevokedBuffer();if(u.length){n.setRevokedBuffer([]);const t=new Set(u);s.results=s.results.filter((({key:e})=>!t.has(e))),e=!0}}if(s=l,e&&(yield o),f)break;n||(s.length||a.length)&&await Promise.race([...a,new Promise((e=>{t=e})),new Promise((e=>{u=e}))])}while(s.length||a.length);return d(M.Complete),o}let Ke=0;function ze({namespacedTopic:e,topic:t},n){Ke+=1;const r=ue(t,Ke.toString(),n),o=je(e,r.req,{setState:e=>{o.state=e}});return o.id=Ke.toString(),o.close=r.close,o.state=M.Fetching,o}const Je=new Map;function Qe(e,t){return`${e}:${t}`}function Xe(e){return async(t,...n)=>{if(!t)return{error:he.message};let r;if(t.id)r=Qe(e.namespacedTopic,t.id);else{const n=ze(e,t);r=Qe(e.namespacedTopic,n.id),t.id=n.id,Je.set(r,{generator:n})}const o=Je.get(r);clearTimeout(o.timeout);const i=await o.generator.next();return o.timeout=function(e){return window.setTimeout((()=>{Je.delete(e)}),1e4)}(r),{...i,id:t.id,state:o.generator.state}}}function Ye(e,t,n){return Fe(e).dispatch(t,V,{id:n})}function Ze(e){return t=>function(e,t){const n=Qe(e,t),r=Je.get(n);r&&r.generator.close()}(e,t.id)}async function et(e,t,{id:n,query:r,context:o,targets:i}){const s=Fe(e),a={id:n,query:r,context:o,targets:i,providerId:t.id},c=await s.dispatch(t.identity,H,a),d=c.error;if(d)throw new Error(d);return c}const tt=new Map;function nt(e,t,n){return`${e}:${t.name}:${t.uuid}:${n}`}const rt=new Map;function ot(e,t,n){return`${e}:${t}:${n}`}function it(e,t){const n=nt.bind(null,e,t.identity),r=Ye.bind(null,e,t.identity),o=et.bind(null,e,t);return async(i,s)=>{const a=n(i.id);if(!tt.has(a)){const e=()=>{r(i.id),tt.delete(a)};tt.set(a,e),i.onClose(e)}const c=ot(e,t.id,i.id),d=()=>{rt.delete(c),s.close()};i.onClose(d),rt.set(c,(e=>{e.results?.length&&s.respond(e.results),e.revoked?.length&&s.revoke(...e.revoked),e.status===G.Open&&s.open(),e.status===G.Close&&d()}));const u=await o(i);return u.status===G.Open&&s.open(),u.status!==G.Close&&u.status!==G.Initial||d(),u}}function st(e,t){return async n=>{const r=Fe(e),o={providerId:t.id,result:n};return r.dispatch(t.identity,U,o)}}const at=new Map;function ct(e,t){return`${e}-${t.name}-${t.uuid}`}function dt(e){return async(t,n)=>{if(!t||!t.id)return void new Error(JSON.stringify(t));if(se(e,t.id))throw we;t.identity=n,await async function(e,t){const n=ct(e,t.identity);at.has(n)||at.set(n,[]),at.get(n).push(t.id),await ne(e,{...t,onUserInput:it(e,t),onResultDispatch:st(e,t)})}(e,t)}}function ut(e){return t=>{t&&function(e,t){const n=se(e,t);if(!n)return;const r=ct(e,n.identity),o=at.get(r);if(o){const n=o.findIndex((e=>e===t));-1!==n&&(o.splice(n,1),re(e,t))}}(e,t)}}const ft=new Map;function lt(e,t){ft.has(e)||ft.set(e,new Set),ft.get(e).add(t)}function pt(e,t){const n=ft.get(e);n&&n.delete(t)}function gt(e){return async t=>{!function(e,t){const n=ct(e,t),r=at.get(n);if(r){for(const t of r)re(e,t);at.delete(n)}}(e,t);const n=ft.get(e);n&&n.forEach((e=>e(t)))}}async function wt(e){const{namespacedTopic:t}=e,n=z(e.namespacedTopic),r=await(o=n,fin.InterApplicationBus.Channel.create(o));var o;return r.onConnection(function({namespacedTopic:e}){return async t=>{const n=$e.get(e);if(n)for(const e of n)if(!await e(t))throw ye}}(e)),r.onDisconnection(gt(t)),r.register(V,Ze(t)),r.register(H,function(e){return t=>{const n=ot(e,t.providerId,t.id),r=rt.get(n);r&&r(t)}}(t)),r.register("2",dt(t)),r.register("3",ut(t)),r.register("4",function(e){return async()=>Ne(e)}(t)),r.register("1",Xe(e)),r.register(U,function(e){return async(t,n)=>{if(!t||!t.providerId||!t.result)return;const r=se(e,t.providerId);if(!r)throw ge;const{onResultDispatch:o}=r;return o?(t.result.dispatcherIdentity=n,o(t.result)):void 0}}(t)),r}async function ht(e){const t=Fe(e);var n;n=e,De.delete(n),await t.destroy(),ie(e)}async function yt(e){const t=("string"==typeof e?e:e?.topic)||N,n=le(),r=K(n,t),o={topic:t,namespace:n,namespacedTopic:r};let i=_e(r);i||(i=await wt(o),function(e,t){De.set(e,t)}(r,i));const s=Ge.bind(null,r),a=pt.bind(null,r),c=X.bind(null,r),d=ee.bind(null,r);return{getAllProviders:Ne.bind(null,r),search:ze.bind(null,o),register:He.bind(null,r),deregister:Ue.bind(null,r),onSubscription:qe.bind(null,r),onDisconnect:lt.bind(null,r),onRegister:Q.bind(null,r),onDeregister:Z.bind(null,r),dispatch:Ve.bind(null,o),disconnect:ht.bind(null,r),removeListener:e=>{s(e),a(e),c(e),d(e)}}}const{create:vt}=r,{subscribe:mt}=n,St={create:vt,subscribe:mt,defaultTopic:"all"},Ct=()=>{const e=window;e.search=St,e.fin&&(e.fin.Search=St)},Rt=e=>{const t=()=>{Ct(),window.removeEventListener(e,t)};return t};if("undefined"!=typeof window){Ct();const e="load",t=Rt(e);window.addEventListener(e,t);const n="DOMContentLoaded",r=Rt(n);window.addEventListener(n,r)}const Pt=new Map;async function bt(){await async function(e){Pt.set(e,await mt({topic:e,uuid:g.Workspace}))}(k)}let Lt;async function It(e){return await async function(){return Lt||(Lt=bt()),Lt}(),Pt.get(e)}const Tt=async e=>{if(!e.icon)throw new Error(`${e.id} provider needs to have icon property defined.`);await I();return(await It(k)).register(e)},kt=async e=>{await I();return(await It(k)).deregister(e)};async function Ot(){return(await T()).dispatch(R.ShowHome,void 0)}async function Bt(){return(await T()).dispatch(R.HideHome,void 0)}var Et;!function(e){e.TabCreated="tab-created",e.ContainerCreated="container-created",e.ContainerResized="container-resized"}(Et||(Et={}));new Map;var Wt;!function(e){e.LastLaunchedWorkspaceId="activeWorkspaceId",e.LastFocusedBrowserWindow="lastFocusedBrowserWindow",e.MachineName="machineName",e.NewTabPageLayout="NewTabPageLayout",e.NewTabPageSort="NewTabPageSort"}(Wt||(Wt={}));const xt=()=>async function(){return(await P()).dispatch(R.GetLegacyPages,void 0)}(),Mt=()=>(async()=>(await P()).dispatch(R.GetLegacyWorkspaces,void 0))();let At;const Dt=new Map,Ft=e=>{if(!Dt.has(e))throw new Error(`Storefront Provider with id ${e} is not registered`);return Dt.get(e)},_t=async e=>{const t=await T();if(Dt.has(e.id))throw new Error(`Storefront provider with id ${e.id} already registered`);return Dt.set(e.id,e),(e=>{e.isStorefrontActionsRegistered||(e.isStorefrontActionsRegistered=!0,e.register(R.GetStorefrontProviderApps,(e=>Ft(e).getApps())),e.register(R.GetStorefrontProviderFooter,(e=>Ft(e).getFooter())),e.register(R.GetStorefrontProviderLandingPage,(e=>Ft(e).getLandingPage())),e.register(R.GetStorefrontProviderNavigation,(e=>Ft(e).getNavigation())),e.register(R.LaunchStorefrontProviderApp,(({id:e,app:t})=>Ft(e).launchApp(t))))})(t),t.dispatch(R.RegisterStorefrontProvider,e)},$t=e=>(At=_t(e),At),qt=async e=>{await At,Dt.delete(e);return(await T()).dispatch(R.DeregisterStorefrontProvider,e)},Gt=async()=>{await At,await I(),await(async()=>(await P()).dispatch(R.HideStorefront,void 0))()},Nt=async()=>{await At,await I(),await(async()=>(await P()).dispatch(R.ShowStorefront,null))()},Ht=a,Ut=o,Vt=i;module.exports=t})();
|
|
1
|
+
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ButtonStyle:()=>q,ContainerTemplateFragmentNames:()=>F,Home:()=>o,Legacy:()=>i,PresentationTemplateFragmentNames:()=>_,SearchTagBackground:()=>E,Storefront:()=>a,TemplateFragmentTypes:()=>$});var n={};e.r(n),e.d(n,{subscribe:()=>Ae});var r={};e.r(r),e.d(r,{create:()=>yt});var o={};e.r(o),e.d(o,{CLIAction:()=>W,CLIFilterOptionType:()=>M,CLITemplate:()=>x,deregister:()=>kt,hide:()=>Bt,register:()=>Tt,show:()=>Ot});var i={};e.r(i),e.d(i,{getPages:()=>xt,getWorkspaces:()=>Mt});var s,a={};e.r(a),e.d(a,{AppManifestType:()=>A,StorefrontTemplate:()=>D,deregister:()=>qt,hide:()=>Gt,register:()=>$t,show:()=>Nt}),function(e){e.Local="local",e.Dev="dev",e.Staging="staging",e.Prod="prod"}(s||(s={}));const c="undefined"!=typeof window&&"undefined"!=typeof fin,d=("undefined"==typeof process||process.env?.JEST_WORKER_ID,"undefined"!=typeof window),u=d?window.origin:s.Local,f=(c&&fin.me.uuid,c&&fin.me.name,c&&fin.me.entityType,"prod"===s.Local),l=(s.Dev,s.Staging,s.Prod,e=>e.startsWith("http://")||e.startsWith("https://")?e:u+e),p=(l("https://cdn.openfin.co/workspace/6.3.0"),l("https://cdn.openfin.co/workspace/6.3.0"),"undefined"!=typeof WORKSPACE_DOCS_PLATFORM_URL&&l(WORKSPACE_DOCS_PLATFORM_URL),"undefined"!=typeof WORKSPACE_DOCS_CLIENT_URL&&l(WORKSPACE_DOCS_CLIENT_URL),d&&"complete"!==document.readyState&&new Promise((e=>document.addEventListener("readystatechange",(()=>{"complete"===document.readyState&&e()})))));var g,w,h;!function(e){e.Workspace="openfin-browser"}(g||(g={})),function(e){e.RunRequested="run-requested",e.WindowOptionsChanged="window-options-changed",e.WindowClosed="window-closed",e.WindowCreated="window-created"}(w||(w={})),function(e){e.FinProtocol="fin-protocol"}(h||(h={}));g.Workspace,g.Workspace;var y,v;!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"}(y||(y={})),function(e){e.Shown="shown",e.BoundsChanged="bounds-changed",e.LayoutReady="layout-ready",e.EndUserBoundsChanging="end-user-bounds-changing",e.Blurred="blurred",e.CloseRequested="close-requested",e.Focused="focused",e.ShowRequested="show-requested",e.ViewCrashed="view-crashed",e.ViewAttached="view-attached",e.ViewDetached="view-detached",e.ViewPageTitleUpdated="view-page-title-updated",e.ViewDestroyed="view-destroyed",e.OptionsChanged="options-changed"}(v||(v={}));function m(e){if(!c)throw new Error("getOFWindow can only be used in an OpenFin env. Avoid calling this method during pre-rendering.");return fin.Window.wrapSync(e)}y.Home,g.Workspace,y.Dock,g.Workspace,y.Storefront,g.Workspace;const S={name:g.Workspace,uuid:g.Workspace};const C=e=>m(e).getOptions().then((()=>!0)).catch((()=>!1));var R;!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",e.GetComputedPlatformTheme="get-computed-platform-theme"}(R||(R={}));const P=function(e){let t;return()=>{if(!c)throw new Error("getChannelClient cannot be used outside an OpenFin env. Avoid using this method during pre-rendering.");return t||(t=(async()=>{await p;const n=await fin.InterApplicationBus.Channel.connect(e);return n.onDisconnection((async()=>{t=void 0})),n})().then((e=>e)).catch((n=>{throw t=void 0,new Error(`failed to connect to channel provider ${e}: ${n}`)}))),t}}("__of_workspace_protocol__"),b="isLaunchedViaLib",L=e=>{const t=new URL(e);return t.searchParams.append(b,"true"),t.toString()},I=async()=>{if(!await C(S))return(f||-1===navigator.userAgent.indexOf("Win"))&&await fin.Application.startFromManifest(L("https://cdn.openfin.co/workspace/6.3.0/app.json")),fin.System.openUrlWithBrowser(L("fins://system-apps/workspace"))},T=async()=>(await I(),P()),k="home";var O,B,E,W,x,M,A,D;!function(e){e.Commands="home-commands"}(O||(O={})),function(e){e.Fetching="fetching",e.Fetched="fetched",e.Complete="complete"}(B||(B={})),function(e){e.Active="active",e.Default="default"}(E||(E={})),function(e){e.Suggestion="suggestion"}(W||(W={})),function(e){e.Contact="Contact",e.Custom="Custom",e.List="List",e.Plain="Plain",e.SimpleText="SimpleText"}(x||(x={})),function(e){e.MultiSelect="MultiSelect"}(M||(M={})),function(e){e.Snapshot="snapshot",e.Manifest="manifest",e.View="view",e.External="external"}(A||(A={})),function(e){e.LandingPage="landingPage",e.AppGrid="appGrid"}(D||(D={}));const F={Container:"Container",Button:"Button"},_={Text:"Text",Image:"Image",List:"List"},$={...F,..._};var q,G;!function(e){e.Primary="primary",e.Secondary="secondary",e.TextOnly="textOnly"}(q||(q={})),function(e){e[e.Initial=0]="Initial",e[e.Open=1]="Open",e[e.Close=2]="Close"}(G||(G={}));const N="all",H="0",U="5",V="6",j=()=>{};function K(e,t){return e?`${e}-${t}`:t}function z(e){return`__search-${e}-topic__`}const J=new Map;function Q(e,t){J.has(e)||J.set(e,new Set),J.get(e).add(t)}function X(e,t){const n=J.get(e);n&&n.delete(t)}const Y=new Map;function Z(e,t){Y.has(e)||Y.set(e,new Set),Y.get(e).add(t)}function ee(e,t){const n=Y.get(e);n&&n.delete(t)}const te=new Map;async function ne(e,t){te.has(e)||te.set(e,new Map),te.get(e).set(t.id,t);const n=J.get(e);if(!n)return;const r=[...n].map((e=>e()));await Promise.all(r)}async function re(e,t){const n=te.get(e);if(!n)return;n.delete(t);const r=Y.get(e);if(!r)return;const o=[...r].map((e=>e()));await Promise.all(o)}function oe(e){return te.get(e)?[...te.get(e).values()]:[]}function ie(e){const t=te.get(e);t&&t.clear()}function se(e,t){const n=te.get(e);return n?n.get(t):null}function ae(e,t,n){return{...e,action:n||e.actions[0],dispatcherIdentity:t}}function ce(e,t,n="ascending"){const r=e||[];if(!t?.length)return r;const o=[],i=new Map;t.forEach((e=>{if(e.key)return i.set(e.key,e);o.push(e)}));let s=r.map((e=>{const{key:t}=e;if(t&&i.has(t)){const e=i.get(t);return i.delete(t),e}return e}));return s.push(...i.values(),...o),s="ascending"===n?s.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))):s.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))),s}function de(e){const t={};let n=[];let r=[];let o=G.Initial;t.getStatus=()=>o,t.getResultBuffer=()=>n,t.setResultBuffer=e=>{n=e,n?.length&&t.onChange()},t.getRevokedBuffer=()=>r,t.setRevokedBuffer=e=>{r=e,r?.length&&t.onChange()},t.onChange=j;const i={};return t.res=i,i.close=()=>{o!==G.Close&&(o=G.Close,t.onChange())},i.open=()=>{o!==G.Open&&(o=G.Open,t.onChange())},i.respond=n=>{const r=ce(t.getResultBuffer(),n,e);t.setResultBuffer(r)},i.revoke=(...e)=>{const n=new Set(e),r=t.getResultBuffer().filter((({key:e})=>{const t=n.has(e);return t&&n.delete(e),!t}));t.setResultBuffer(r),n.size&&(t.getRevokedBuffer().forEach((e=>n.add(e))),t.setRevokedBuffer([...n]))},t}function ue(e,t,n){const r=new Set;let o=!1;return{close:()=>{o=!0;for(const e of r)e()},req:{id:t,topic:e,...n,context:n?.context||{},onClose:e=>{r.add(e),o&&e()},removeListener:e=>{r.delete(e)}}}}function fe(){return{name:fin.me.name,uuid:fin.me.uuid}}function le(){let e;try{const t=fin.Platform.getCurrentSync();if(!t?.identity)return;e=t.identity.uuid}catch(e){}return e}const pe="deregistered or does not exist",ge=new Error(`provider ${pe}`),we=new Error("provider with name already exists"),he=new Error("bad payload"),ye=new Error("subscription rejected"),ve=new Error(`channel ${pe}`),me=new Map;function Se(e){const t=Ce(e);if(t)return t;throw ve}function Ce(e){const t=me.get(e);if(t)return t}function Re(e,t){me.set(e,t)}const Pe=new Map;function be(e){Pe.has(e)||Pe.set(e,new Map);const t=Pe.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 Le(e,t){return(await Se(e)).dispatch(H,t)}function Ie({namespacedTopic:e,topic:t}){const n=se.bind(null,e),r=be(e),o=Le.bind(null,e);return async(e,i)=>{if(!e||!e.id||!e.providerId){const e=he;return{error:e.message}}const{id:s,providerId:a}=e,c=n(a);if(!c){const e=ge;return{error:e.message}}const d=r.getRequestsForIdentity(i);let u=d.get(e.id);u||(u=ue(t,s,e),d.set(e.id,u));const f=de(),l=()=>{const e=f.getResultBuffer();f.setResultBuffer([]);const t=f.getRevokedBuffer();f.setRevokedBuffer([]);const n=f.getStatus();o({id:s,providerId:a,results:e,revoked:t,status:n})};let p=!0,g=!1;f.onChange=()=>{if(p)return p=!1,void l();g||(g=!0,setTimeout((()=>{g=!1,l()}),100))};try{const{results:e,context:t}=await c.onUserInput(u.req,f.res),n=f.getStatus();return{id:s,providerId:a,status:n,results:e,context:t}}catch(e){return{id:s,providerId:a,error:e.message}}}}async function Te(e,t,n){const r=n||await Se(e),o=fe(),i={identity:o,...t,onUserInput:void 0,onResultDispatch:void 0};await r.dispatch("2",i),await ne(e,{identity:o,...t})}async function ke(e,t){const n=await Se(e);return await n.dispatch("3",t),re(e,t)}async function Oe(e,t,n,r){const o=ae(n,fe(),r),i=se(e,t);if(i){const{onResultDispatch:e}=i;if(!e)return;return e(o)}const s={providerId:t,result:o};return(await Se(e)).dispatch(U,s)}async function Be(e,t){const n={...t,context:t?.context||{}},r={},o=async function*(e,t,{setState:n}){const r=await Se(e);for(;;){const e=await r.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=>{r.state=e}});let i=await o.next();return r.id=n.id,r.close=()=>{!async function(e,t){(await Se(e)).dispatch(V,{id:t})}(e,r.id)},r.next=()=>{if(i){const e=i;return i=void 0,e}return o.next()},r}async function Ee(e){return(await Se(e)).dispatch("4",null)}async function We(e){const t=await Se(e);var n;n=e,me.delete(n),ie(e),await t.disconnect()}function xe(e){const{namespacedTopic:t}=e,n=be(t);return async r=>{if(!Ce(t))return;const o=n.getRequestsForIdentity(r);for(const{req:e,close:t}of o.values())t(),o.delete(e.id);Re(t,(async e=>{const{namespacedTopic:t}=e,n=await Me(e);for(const e of oe(t))await Te(t,e,n);return n})(e))}}async function Me(e){const{namespacedTopic:t}=e,n=z(t),r=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 r.register(H,Ie(e)),r.register(V,function(e){const t=be(e);return(e,n)=>{const r=t.getRequestsForIdentity(n),o=r.get(e.id);o&&(o.close(),r.delete(e.id))}}(t)),r.register(U,function(e){return async(t,n)=>{if(!t||!t.providerId||!t.result)return;const r=se(e,t.providerId);if(!r)return;const{onResultDispatch:o}=r;return o?(t.result.dispatcherIdentity=n,o(t.result)):void 0}}(t)),r.onDisconnection(xe(e)),r}async function Ae(e){const t=("string"==typeof e?e:e?.topic)||N,n=("string"==typeof e?null:e?.uuid)||le(),r=K(n,t),o={topic:t,namespace:n,namespacedTopic:r};let i=Ce(r);return i||(i=Me(o),Re(r,i),await i),{getAllProviders:Ee.bind(null,r),register:Te.bind(null,r),search:Be.bind(null,r),deregister:ke.bind(null,r),dispatch:Oe.bind(null,r),disconnect:We.bind(null,r)}}const De=new Map;function Fe(e){const t=_e(e);if(t)return t;throw ve}function _e(e){const t=De.get(e);if(t)return t}const $e=new Map;function qe(e,t){$e.has(e)||$e.set(e,new Set),$e.get(e).add(t)}function Ge(e,t){const n=$e.get(e);n&&n.delete(t)}function Ne(e){return[...oe(e)].map((e=>({...e,onUserInput:void 0,onResultDispatch:void 0})))}async function He(e,t){if(se(e,t.id))throw new Error("provider with name already exists");const n=fe();await ne(e,{identity:n,...t})}function Ue(e,t){re(e,t)}async function Ve(e,t,n,r){const o=se(e,t);if(!o)throw ge;const{onResultDispatch:i}=o;if(!i)return;return i(ae(n,fe(),r))}async function*je(e,t,n){const r=function(e,t){const n=[],r=[],o=[],i=[];for(const s of e){const e=de(s.scoreOrder),a={results:[],provider:{id:s.id,identity:s.identity,title:s.title,scoreOrder:s.scoreOrder,icon:s.icon}};n.push(a),r.push(e);const c=(async()=>{try{const{results:n,context:r}=await s.onUserInput(t,e.res);a.results=ce(a.results,n),a.context={...a.context,...r}}catch(e){a.error=e}c.done=!0})();i.push(c),o.push(o.length)}return{providerResponses:n,listenerResponses:r,openListenerResponses:o,initialResponsePromises:i}}(t.targets?t.targets.map((t=>se(e,t))).filter((e=>!!e)):[...oe(e).filter((e=>!e.hidden))],t),{providerResponses:o,listenerResponses:i}=r;let{openListenerResponses:s,initialResponsePromises:a}=r,c=B.Fetching;const d=e=>{c=e,n.setState(c)};let u,f=!1;t.onClose((()=>{f=!0,u&&u()}));do{let e=!1;if(a.length){const t=[];for(const n of a)n.done?e=!0:t.push(n);a=t,a.length||(d(B.Fetched),e=!0)}let t,n=!1;const r=()=>{n=!0,t&&t()},l=[];for(const t of s){const n=i[t],s=o[t],a=n.getStatus();(a===G.Open||c===B.Fetching&&a===G.Initial)&&(l.push(t),n.onChange=r);const d=n.getResultBuffer();d.length&&(n.setResultBuffer([]),s.results=ce(s.results,d),e=!0);const u=n.getRevokedBuffer();if(u.length){n.setRevokedBuffer([]);const t=new Set(u);s.results=s.results.filter((({key:e})=>!t.has(e))),e=!0}}if(s=l,e&&(yield o),f)break;n||(s.length||a.length)&&await Promise.race([...a,new Promise((e=>{t=e})),new Promise((e=>{u=e}))])}while(s.length||a.length);return d(B.Complete),o}let Ke=0;function ze({namespacedTopic:e,topic:t},n){Ke+=1;const r=ue(t,Ke.toString(),n),o=je(e,r.req,{setState:e=>{o.state=e}});return o.id=Ke.toString(),o.close=r.close,o.state=B.Fetching,o}const Je=new Map;function Qe(e,t){return`${e}:${t}`}function Xe(e){return async(t,...n)=>{if(!t)return{error:he.message};let r;if(t.id)r=Qe(e.namespacedTopic,t.id);else{const n=ze(e,t);r=Qe(e.namespacedTopic,n.id),t.id=n.id,Je.set(r,{generator:n})}const o=Je.get(r);clearTimeout(o.timeout);const i=await o.generator.next();return o.timeout=function(e){return window.setTimeout((()=>{Je.delete(e)}),1e4)}(r),{...i,id:t.id,state:o.generator.state}}}function Ye(e,t,n){return Fe(e).dispatch(t,V,{id:n})}function Ze(e){return t=>function(e,t){const n=Qe(e,t),r=Je.get(n);r&&r.generator.close()}(e,t.id)}async function et(e,t,{id:n,query:r,context:o,targets:i}){const s=Fe(e),a={id:n,query:r,context:o,targets:i,providerId:t.id},c=await s.dispatch(t.identity,H,a),d=c.error;if(d)throw new Error(d);return c}const tt=new Map;function nt(e,t,n){return`${e}:${t.name}:${t.uuid}:${n}`}const rt=new Map;function ot(e,t,n){return`${e}:${t}:${n}`}function it(e,t){const n=nt.bind(null,e,t.identity),r=Ye.bind(null,e,t.identity),o=et.bind(null,e,t);return async(i,s)=>{const a=n(i.id);if(!tt.has(a)){const e=()=>{r(i.id),tt.delete(a)};tt.set(a,e),i.onClose(e)}const c=ot(e,t.id,i.id),d=()=>{rt.delete(c),s.close()};i.onClose(d),rt.set(c,(e=>{e.results?.length&&s.respond(e.results),e.revoked?.length&&s.revoke(...e.revoked),e.status===G.Open&&s.open(),e.status===G.Close&&d()}));const u=await o(i);return u.status===G.Open&&s.open(),u.status!==G.Close&&u.status!==G.Initial||d(),u}}function st(e,t){return async n=>{const r=Fe(e),o={providerId:t.id,result:n};return r.dispatch(t.identity,U,o)}}const at=new Map;function ct(e,t){return`${e}-${t.name}-${t.uuid}`}function dt(e){return async(t,n)=>{if(!t||!t.id)return void new Error(JSON.stringify(t));if(se(e,t.id))throw we;t.identity=n,await async function(e,t){const n=ct(e,t.identity);at.has(n)||at.set(n,[]),at.get(n).push(t.id),await ne(e,{...t,onUserInput:it(e,t),onResultDispatch:st(e,t)})}(e,t)}}function ut(e){return t=>{t&&function(e,t){const n=se(e,t);if(!n)return;const r=ct(e,n.identity),o=at.get(r);if(o){const n=o.findIndex((e=>e===t));-1!==n&&(o.splice(n,1),re(e,t))}}(e,t)}}const ft=new Map;function lt(e,t){ft.has(e)||ft.set(e,new Set),ft.get(e).add(t)}function pt(e,t){const n=ft.get(e);n&&n.delete(t)}function gt(e){return async t=>{!function(e,t){const n=ct(e,t),r=at.get(n);if(r){for(const t of r)re(e,t);at.delete(n)}}(e,t);const n=ft.get(e);n&&n.forEach((e=>e(t)))}}async function wt(e){const{namespacedTopic:t}=e,n=z(e.namespacedTopic),r=await(o=n,fin.InterApplicationBus.Channel.create(o));var o;return r.onConnection(function({namespacedTopic:e}){return async t=>{const n=$e.get(e);if(n)for(const e of n)if(!await e(t))throw ye}}(e)),r.onDisconnection(gt(t)),r.register(V,Ze(t)),r.register(H,function(e){return t=>{const n=ot(e,t.providerId,t.id),r=rt.get(n);r&&r(t)}}(t)),r.register("2",dt(t)),r.register("3",ut(t)),r.register("4",function(e){return async()=>Ne(e)}(t)),r.register("1",Xe(e)),r.register(U,function(e){return async(t,n)=>{if(!t||!t.providerId||!t.result)return;const r=se(e,t.providerId);if(!r)throw ge;const{onResultDispatch:o}=r;return o?(t.result.dispatcherIdentity=n,o(t.result)):void 0}}(t)),r}async function ht(e){const t=Fe(e);var n;n=e,De.delete(n),await t.destroy(),ie(e)}async function yt(e){const t=("string"==typeof e?e:e?.topic)||N,n=le(),r=K(n,t),o={topic:t,namespace:n,namespacedTopic:r};let i=_e(r);i||(i=await wt(o),function(e,t){De.set(e,t)}(r,i));const s=Ge.bind(null,r),a=pt.bind(null,r),c=X.bind(null,r),d=ee.bind(null,r);return{getAllProviders:Ne.bind(null,r),search:ze.bind(null,o),register:He.bind(null,r),deregister:Ue.bind(null,r),onSubscription:qe.bind(null,r),onDisconnect:lt.bind(null,r),onRegister:Q.bind(null,r),onDeregister:Z.bind(null,r),dispatch:Ve.bind(null,o),disconnect:ht.bind(null,r),removeListener:e=>{s(e),a(e),c(e),d(e)}}}const{create:vt}=r,{subscribe:mt}=n,St={create:vt,subscribe:mt,defaultTopic:"all"},Ct=()=>{const e=window;e.search=St,e.fin&&(e.fin.Search=St)},Rt=e=>{const t=()=>{Ct(),window.removeEventListener(e,t)};return t};if("undefined"!=typeof window){Ct();const e="load",t=Rt(e);window.addEventListener(e,t);const n="DOMContentLoaded",r=Rt(n);window.addEventListener(n,r)}const Pt=new Map;async function bt(){await async function(e){Pt.set(e,await mt({topic:e,uuid:g.Workspace}))}(k)}let Lt;async function It(e){return await async function(){return Lt||(Lt=bt()),Lt}(),Pt.get(e)}const Tt=async e=>{if(!e.icon)throw new Error(`${e.id} provider needs to have icon property defined.`);await I();return(await It(k)).register(e)},kt=async e=>{await I();return(await It(k)).deregister(e)};async function Ot(){return(await T()).dispatch(R.ShowHome,void 0)}async function Bt(){return(await T()).dispatch(R.HideHome,void 0)}var Et;!function(e){e.TabCreated="tab-created",e.ContainerCreated="container-created",e.ContainerResized="container-resized"}(Et||(Et={}));new Map;var Wt;!function(e){e.LastLaunchedWorkspaceId="activeWorkspaceId",e.LastFocusedBrowserWindow="lastFocusedBrowserWindow",e.MachineName="machineName",e.NewTabPageLayout="NewTabPageLayout",e.NewTabPageSort="NewTabPageSort"}(Wt||(Wt={}));const xt=()=>async function(){return(await P()).dispatch(R.GetLegacyPages,void 0)}(),Mt=()=>(async()=>(await P()).dispatch(R.GetLegacyWorkspaces,void 0))();let At;const Dt=new Map,Ft=e=>{if(!Dt.has(e))throw new Error(`Storefront Provider with id ${e} is not registered`);return Dt.get(e)},_t=async e=>{const t=await T();if(Dt.has(e.id))throw new Error(`Storefront provider with id ${e.id} already registered`);return Dt.set(e.id,e),(e=>{e.isStorefrontActionsRegistered||(e.isStorefrontActionsRegistered=!0,e.register(R.GetStorefrontProviderApps,(e=>Ft(e).getApps())),e.register(R.GetStorefrontProviderFooter,(e=>Ft(e).getFooter())),e.register(R.GetStorefrontProviderLandingPage,(e=>Ft(e).getLandingPage())),e.register(R.GetStorefrontProviderNavigation,(e=>Ft(e).getNavigation())),e.register(R.LaunchStorefrontProviderApp,(({id:e,app:t})=>Ft(e).launchApp(t))))})(t),t.dispatch(R.RegisterStorefrontProvider,e)},$t=e=>(At=_t(e),At),qt=async e=>{await At,Dt.delete(e);return(await T()).dispatch(R.DeregisterStorefrontProvider,e)},Gt=async()=>{await At,await I(),await(async()=>(await P()).dispatch(R.HideStorefront,void 0))()},Nt=async()=>{await At,await I(),await(async()=>(await P()).dispatch(R.ShowStorefront,null))()};module.exports=t})();
|
|
2
2
|
//# sourceMappingURL=index.js.map
|