@openfin/workspace 22.3.0 → 22.3.1

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.
Files changed (36) hide show
  1. package/client-api-platform/src/api/performance.d.ts +7 -0
  2. package/client-api-platform/src/api/workspaces/index.d.ts +2 -2
  3. package/client-api-platform/src/index.d.ts +2 -1
  4. package/client-api-platform/src/init/index.d.ts +1 -2
  5. package/client-api-platform/src/init/utils.d.ts +1 -0
  6. package/client-api-platform/src/shapes.d.ts +50 -82
  7. package/common/src/api/protocol/workspace-platform.d.ts +1 -0
  8. package/common/src/utils/defer-show.d.ts +1 -1
  9. package/common/src/utils/enterpriseBrowser.d.ts +2 -0
  10. package/common/src/utils/global-context-menu.d.ts +1 -1
  11. package/common/src/utils/indicators/browser.d.ts +1 -1
  12. package/common/src/utils/page-tab-context-menu.d.ts +1 -1
  13. package/common/src/utils/pick.d.ts +7 -0
  14. package/common/src/utils/promise-with-resolvers.d.ts +9 -0
  15. package/common/src/utils/types.d.ts +23 -0
  16. package/{common/src/utils/enterprise-dock.d.ts → dock3/src/api/constants.d.ts} +2 -0
  17. package/dock3/src/api/idb.d.ts +3 -0
  18. package/dock3/src/api/index.d.ts +14 -0
  19. package/dock3/src/api/launch.d.ts +3 -0
  20. package/dock3/src/api/protocol.d.ts +73 -0
  21. package/dock3/src/api/provider.d.ts +89 -0
  22. package/dock3/src/shapes/enterprise.d.ts +22 -0
  23. package/dock3/src/shapes/index.d.ts +2 -0
  24. package/dock3/src/shapes/shapes.d.ts +63 -0
  25. package/dock3/src/utils.d.ts +2 -0
  26. package/externals.report.json +6 -0
  27. package/home.js +1 -1
  28. package/home.js.map +1 -1
  29. package/index.js +1 -1
  30. package/index.js.map +1 -1
  31. package/notifications.js +1 -1
  32. package/notifications.js.map +1 -1
  33. package/package.json +3 -3
  34. package/store.js +1 -1
  35. package/store.js.map +1 -1
  36. package/client-api-platform/src/api/perfomance.d.ts +0 -3
@@ -0,0 +1,7 @@
1
+ export declare const browserWindowPerformanceMarkStart: () => string;
2
+ export declare const browserWindowPerformanceMarkAPIReturn: (performanceMarkTitle: string) => void;
3
+ export declare const setupBrowserWindowShownPerformanceMark: (performanceMarkTitle: string) => void;
4
+ export declare const contextMenuPerformanceMarkStart: () => string;
5
+ export declare const contextMenuPerformanceMarkEnd: (performanceMarkTitle: string) => void;
6
+ export declare const contextMenuPerformanceMarkAPIReturn: (performanceMarkTitle: string) => void;
7
+ export declare const setupContextMenuPerformanceMark: (performanceMarkTitle: string) => void;
@@ -1,4 +1,4 @@
1
- import type { ApplyWorkspacePayload, CreateSavedWorkspaceRequest, RestoreLastSavedWorkspacePayload, RestoreLastSavedWorkspaceResult, Workspace } from '../../../../client-api-platform/src/shapes';
1
+ import type { ApplyWorkspacePayload, CreateSavedWorkspaceRequest, GetCurrentWorkspaceOptions, RestoreLastSavedWorkspacePayload, RestoreLastSavedWorkspaceResult, Workspace } from '../../../../client-api-platform/src/shapes';
2
2
  /**
3
3
  * Apply the given workspace and set it as active.
4
4
  * @param payload, the workspace to apply and the options to apply it with.
@@ -20,7 +20,7 @@ export declare function getInitialWorkspace(): Promise<Workspace>;
20
20
  * Get a workspace data structure that represents the users current desktop.
21
21
  * @returns the current active workspace.
22
22
  */
23
- export declare function getCurrentWorkspace(): Promise<Workspace>;
23
+ export declare function getCurrentWorkspace(options?: GetCurrentWorkspaceOptions): Promise<Workspace>;
24
24
  export declare function getLastSavedWorkspace(): Promise<Workspace | undefined>;
25
25
  export declare const createWorkspaceInStorage: (req: CreateSavedWorkspaceRequest) => Promise<any>;
26
26
  export declare const getWorkspacesInStorage: () => Promise<Workspace[]>;
@@ -1,3 +1,4 @@
1
1
  export * from './shapes';
2
- export { init, initDockCompanion } from './init';
2
+ export * as Dock from '../../dock3/src/api';
3
+ export { init } from './init';
3
4
  export { getCurrentSync, wrapSync } from './api';
@@ -1,6 +1,5 @@
1
1
  import OpenFin from '@openfin/core';
2
- import { CompanionDockConfig, WorkspacePlatformInitConfig } from '../../../client-api-platform/src/shapes';
3
- export declare function initDockCompanion(config: CompanionDockConfig, platform: OpenFin.Platform): Promise<void>;
2
+ import { WorkspacePlatformInitConfig } from '../../../client-api-platform/src/shapes';
4
3
  /**
5
4
  * Initilaize a Workspace Platform.
6
5
  *
@@ -34,4 +34,5 @@ export type WindowType = 'browser' | 'platform' | 'classic' | 'mixed' | 'enterpr
34
34
  */
35
35
  export declare function checkHasBrowserWindows(snapshot: BrowserSnapshot): boolean;
36
36
  export declare const copyObject: <T>(obj: T) => T;
37
+ export declare function validateTabDimensionsIfAny(overrideOptions: OpenFin.PlatformWindowCreationOptions): void;
37
38
  export {};
@@ -2,7 +2,6 @@ import type OpenFin from '@openfin/core';
2
2
  import { IconProps, IconType, Languages } from '@openfin/ui-library';
3
3
  import { ModalResponseEvent } from '../../common/src/utils/menu-window-provider';
4
4
  import type { AnalyticsEvent, AnalyticsEventInternal } from '../../common/src/utils/usage-register';
5
- import { Point } from '../../common/src/utils/window';
6
5
  import { BaseCustomDropdownItem, CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
7
6
  import { Resource } from '../../common/src/api/i18next';
8
7
  import { TrackedSite } from '../../common/src/api/pages/idb';
@@ -10,8 +9,10 @@ import { AddDefaultPagePayload, AttachedPage, BookmarkNode, CopyPagePayload, Cre
10
9
  import { SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
11
10
  import { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
12
11
  import type { CustomThemes } from '../../common/src/api/theming';
13
- import { App, DockProviderConfigWithIdentity, StoreButtonConfig, WorkspaceButton } from '../../client-api/src/shapes';
12
+ import { App, DockProviderConfigWithIdentity, StoreButtonConfig } from '../../client-api/src/shapes';
14
13
  import type { WorkflowIntegration } from '../../client-api/src/shapes/integrations';
14
+ import { DockCompanionButton } from '../../dock3/src/shapes/index';
15
+ export * from '../../dock3/src/shapes';
15
16
  export { AppManifestType } from '../../client-api/src/shapes';
16
17
  export type { App, AppIntent, Image } from '../../client-api/src/shapes';
17
18
  export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
@@ -653,6 +654,28 @@ export interface BrowserWorkspacePlatformWindowOptions {
653
654
  newPageUrl?: string;
654
655
  toolbarOptions?: ToolbarOptions;
655
656
  windowStateButtonOptions?: WindowStateButtonOptions;
657
+ /** Specifies the min and max sizes for page tabs.
658
+ * Page tabs will expand to take all available space up to the specified maximum size.
659
+ * Similarly, they will collapse down to the specified minimum size.
660
+ * When there is not enough room to fit the tabs, the tabstrip will become scrollable.
661
+ * Sizes can be specified as pixels (e.g. "100px") or as percentage of tab strip width (e.g. "20%").
662
+ * The default value for both min and max is "120px". To maintain usability, minimum values below 28px will be ignored and 28px will be used as the minimum.
663
+ */
664
+ pageTabDimensions?: {
665
+ minWidth?: string;
666
+ maxWidth?: string;
667
+ };
668
+ /** Specifies the min and max sizes for view tabs in a layout.
669
+ * View tabs will expand to take all available space up to the specified maximum size.
670
+ * Similarly, they will collapse down to the specified minimum size.
671
+ * When there is not enough room to fit the tabs, the tabstrip will become scrollable.
672
+ * Sizes can be specified as pixels (e.g. "100px") or as percentage of tab strip width (e.g. "20%").
673
+ * The default value for both min and max is "120px". To maintain usability, minimum values below 28px will be ignored and 28px will be used as the minimum.
674
+ */
675
+ viewTabDimensions?: {
676
+ minWidth?: string;
677
+ maxWidth?: string;
678
+ };
656
679
  /**
657
680
  * Use when you want to display navigation buttons in Browser toolbar. Disabled by default.
658
681
  *
@@ -1261,7 +1284,7 @@ export type AppSite = SiteInfo & {
1261
1284
  * @internal
1262
1285
  */
1263
1286
  export type WorkspaceSite = SiteInfo & {
1264
- type: 'page' | 'workspace';
1287
+ type: 'page' | 'workspace' | 'collection';
1265
1288
  };
1266
1289
  /**
1267
1290
  * @internal
@@ -1608,6 +1631,17 @@ export interface WorkspacePlatformStorage {
1608
1631
  * ```
1609
1632
  */
1610
1633
  getWorkspaces(): Promise<Workspace[]>;
1634
+ /**
1635
+ * Get all workspaces metadata including the workspaceId and title that are saved in persistent storage.
1636
+ *
1637
+ * ```ts
1638
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
1639
+ *
1640
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
1641
+ * const workspacesMetadata = await workspacePlatform.Storage.getWorkspacesMetadata();
1642
+ * ```
1643
+ */
1644
+ getWorkspacesMetadata(): Promise<Pick<Workspace, 'workspaceId' | 'title'>[]>;
1611
1645
  /**
1612
1646
  * Get a specific workspace in persistent storage.
1613
1647
  *
@@ -1793,8 +1827,9 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1793
1827
  launchApp(req: LaunchAppRequest): Promise<void>;
1794
1828
  /**
1795
1829
  * Gets a workspace data structure that represents the current state of the user's desktop.
1830
+ * @param options Options for getting the current workspace.
1796
1831
  */
1797
- getCurrentWorkspace(): Promise<Workspace>;
1832
+ getCurrentWorkspace(options?: GetCurrentWorkspaceOptions): Promise<Workspace>;
1798
1833
  /**
1799
1834
  * Sets the workspace as the current active workspace. Does not apply the workspace to the user's desktop.
1800
1835
  * @param workspace the workspace to set as current active workspace.
@@ -2004,6 +2039,11 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
2004
2039
  * @param query an optional query.
2005
2040
  */
2006
2041
  getSavedWorkspaces(query?: string): Promise<Workspace[]>;
2042
+ /**
2043
+ * Implementation for getting a list of saved workspaces metadata from persistent storage.
2044
+ * @param query an optional query.
2045
+ */
2046
+ getSavedWorkspacesMetadata(query?: string): Promise<Pick<Workspace, 'workspaceId' | 'title'>[]>;
2007
2047
  /**
2008
2048
  * Implementation for getting a single workspace in persistent storage.
2009
2049
  * @param id
@@ -2275,6 +2315,9 @@ export interface ShowQuitPlatformDialogRequest {
2275
2315
  /** Should the dialog be centered on the monitor instead of on top of the platform window */
2276
2316
  shouldCenterOnMonitor?: boolean;
2277
2317
  }
2318
+ export interface GetCurrentWorkspaceOptions {
2319
+ skipSnapshotUpdate?: boolean;
2320
+ }
2278
2321
  /**
2279
2322
  * Options for the {@link WorkspacePlatformModule.applyWorkspace applyWorkspace} method.
2280
2323
  *
@@ -2515,44 +2558,6 @@ export interface WorkspacePlatformInitConfig {
2515
2558
  */
2516
2559
  workspaceAsar?: WorkspaceAsarAssetConfig | WorkspaceAsarPathConfig;
2517
2560
  }
2518
- /**
2519
- * @internal
2520
- */
2521
- export interface CompanionDockConfig {
2522
- /**
2523
- * Base URL for the companion dock
2524
- */
2525
- baseUrl?: string;
2526
- /**
2527
- * Companion dock window position
2528
- */
2529
- dockPosition?: Point;
2530
- /**
2531
- * Favorites to be displayed in the dock
2532
- */
2533
- favorites?: DockEntry[];
2534
- /**
2535
- * Favorites to be displayed in the dock
2536
- */
2537
- contentMenu?: ContentMenuEntry[];
2538
- defaultDockButtons?: DockCompanionButton[];
2539
- /**
2540
- * Taskbar Icon for the Browser Window. If light and dark icon are defined, then the taskbar icon will change when the scheme changes.
2541
- */
2542
- icon?: string | TaskbarIcon;
2543
- title?: string;
2544
- windowType: 'enterprise' | undefined;
2545
- uiConfig?: {
2546
- hideDragHandle?: boolean;
2547
- providerIconContentMenu?: boolean;
2548
- moreMenu?: {
2549
- quitPlatform?: {
2550
- hidePlatformTitle?: boolean;
2551
- skipDialog?: boolean;
2552
- };
2553
- };
2554
- };
2555
- }
2556
2561
  /**
2557
2562
  * Extend or replace default functionality in order to customize behavior of a Workspace Platform Provider.
2558
2563
  *
@@ -2688,7 +2693,6 @@ export type WorkspacePlatformOverrideCallback = OpenFin.OverrideCallback<Workspa
2688
2693
  * @deprecated
2689
2694
  */
2690
2695
  export type BrowserOverrideCallback = WorkspacePlatformOverrideCallback;
2691
- export type DockCompanionButton = Exclude<WorkspaceButton, 'store'> | 'contentMenu' | 'bookmarks' | 'searchShortcut';
2692
2696
  /**
2693
2697
  * Content menu entry shape cloned and re-exported from UI Library.
2694
2698
  * @internal
@@ -2711,6 +2715,9 @@ export type LaunchDockEntryPayload = {
2711
2715
  entry: DockEntry;
2712
2716
  sourceEvent?: Pick<MouseEvent, 'ctrlKey' | 'metaKey' | 'shiftKey'>;
2713
2717
  };
2718
+ export type BookmarkDockEntryPayload = {
2719
+ entry: DockEntry;
2720
+ };
2714
2721
  /**
2715
2722
  * Represents dock entry for favorites
2716
2723
  * @internal
@@ -2846,45 +2853,6 @@ export interface LaunchBookmarkPayload {
2846
2853
  sourceIdentity: OpenFin.Identity;
2847
2854
  sourceEvent: Pick<MouseEvent, 'ctrlKey' | 'metaKey' | 'shiftKey'>;
2848
2855
  }
2849
- /**
2850
- * These are channel actions registered by the platform.
2851
- *
2852
- * @internal
2853
- */
2854
- type EnterpriseDockChannelProviderChannelActions = {
2855
- 'launch-entry': (payload: LaunchDockEntryPayload) => void;
2856
- 'set-dock-favorites-order': (newFavorites: DockEntry[]) => void;
2857
- 'set-default-dock-buttons-order': (newFavorites: DockCompanionButton[]) => void;
2858
- 'get-dock-workspaces-context-menu': () => BaseCustomDropdownItem[];
2859
- 'handle-dock-workspaces-menu-response': (payload: any) => void;
2860
- 'remove-favorite-entry': (entry: DockEntry) => void;
2861
- 'add-favorite-entry': (entry: DockEntry) => void;
2862
- };
2863
- /**
2864
- * These are channel actions registered by the client (enterprise dock)
2865
- * @internal
2866
- */
2867
- type EnterpriseDockChannelClientChannelActions = {
2868
- 'update-favorite-entries': () => void;
2869
- 'update-content-menu': () => void;
2870
- 'navigate-content-menu': () => void;
2871
- };
2872
- /**
2873
- * Used by Enterprise Dock for communication with the platform.
2874
- * @internal
2875
- */
2876
- export interface EnterpriseDockChannelClient extends Omit<OpenFin.ChannelClient, 'dispatch' | 'register'> {
2877
- dispatch: <T extends keyof EnterpriseDockChannelProviderChannelActions>(action: T, payload: Parameters<EnterpriseDockChannelProviderChannelActions[T]>[0]) => Promise<Awaited<ReturnType<EnterpriseDockChannelProviderChannelActions[T]>>>;
2878
- register: <T extends keyof EnterpriseDockChannelClientChannelActions>(action: T, handler: (payload: Parameters<EnterpriseDockChannelClientChannelActions[T]>[0], id: OpenFin.ProviderIdentity | OpenFin.ClientIdentity) => Promise<Awaited<ReturnType<EnterpriseDockChannelClientChannelActions[T]>>>) => boolean;
2879
- }
2880
- /**
2881
- * Used by the platform for communication with Enterprise Dock.
2882
- * @internal
2883
- */
2884
- export interface EnterpriseDockChannelProvider extends Omit<OpenFin.ChannelProvider, 'dispatch' | 'register'> {
2885
- dispatch: <T extends keyof EnterpriseDockChannelClientChannelActions>(to: OpenFin.ClientIdentity, action: T, payload: Parameters<EnterpriseDockChannelClientChannelActions[T]>[0]) => Promise<Awaited<ReturnType<EnterpriseDockChannelClientChannelActions[T]>>>;
2886
- register: <T extends keyof EnterpriseDockChannelProviderChannelActions>(action: T, handler: (payload: Parameters<EnterpriseDockChannelProviderChannelActions[T]>[0], id: OpenFin.ProviderIdentity | OpenFin.ClientIdentity) => Promise<Awaited<ReturnType<EnterpriseDockChannelProviderChannelActions[T]>>>) => boolean;
2887
- }
2888
2856
  export type SearchProviderFilter = {
2889
2857
  id: string;
2890
2858
  title: string;
@@ -48,6 +48,7 @@ export declare enum WorkspacePlatformChannelAction {
48
48
  UpdateSavedWorkspace = "updateSavedWorkspace",
49
49
  DeleteSavedWorkspace = "deleteSavedWorkspace",
50
50
  GetSavedWorkspaces = "getSavedWorkspaces",
51
+ GetSavedWorkspacesMetadata = "getSavedWorkspacesMetadata",
51
52
  SaveWorkspace = "saveWorkspace",
52
53
  GetCurrentWorkspace = "getCurrentWorkspace",
53
54
  ApplyWorkspace = "applyWorkspace",
@@ -24,7 +24,7 @@ interface InternalWindowOptions extends OpenFin.PlatformWindowCreationOptions {
24
24
  * @param setAsForeground the option to focus the window when it is shown
25
25
  * @returns the modified options.
26
26
  */
27
- export declare const applyDeferShowOptions: (opts: OpenFin.PlatformWindowCreationOptions, setAsForeground?: boolean) => InternalWindowOptions;
27
+ export declare const applyDeferShowOptions: <T>(opts: T, setAsForeground?: boolean) => InternalWindowOptions & T;
28
28
  /**
29
29
  * This function is a middleware that can be applied to a platform's `createWindow` function.
30
30
  * If the defer show API has been enabled in window options using the `applyDeferShowOptions` function
@@ -2,6 +2,8 @@ import type OpenFin from '@openfin/core';
2
2
  import { BrowserInitConfig } from '../../../client-api-platform/src/shapes';
3
3
  export declare const DEFAULT_ENTERPRISE_WINDOW_HEIGHT = 600;
4
4
  export declare const DEFAULT_ENTERPRISE_WINDOW_WIDTH = 900;
5
+ export declare const ENTERPRISE_MIN_WINDOW_HEIGHT = 488;
6
+ export declare const ENTERPRISE_MIN_WINDOW_WIDTH = 654;
5
7
  export declare const isEnterpriseBrowser: (id?: OpenFin.Identity) => Promise<boolean>;
6
8
  export declare const isEnterpriseBrowserPlatform: (browserInitOptions: BrowserInitConfig) => boolean;
7
9
  export declare function formatUrl(url: string): string;
@@ -86,7 +86,7 @@ export declare const downloads: () => {
86
86
  export declare const appearance: () => {
87
87
  label: string;
88
88
  };
89
- export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Workspace[], contextMenuOptionType: GlobalContextMenuOptionType) => {
89
+ export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Pick<Workspace, 'workspaceId' | 'title'>[], contextMenuOptionType: GlobalContextMenuOptionType) => {
90
90
  label: string;
91
91
  type: MenuItemType;
92
92
  enabled: boolean;
@@ -1,7 +1,7 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { IconType } from '@openfin/ui-library';
3
3
  import { IndicatorType } from '../../../../common/src/components/Indicator/Indicator.constants';
4
- export type BrowserIndicatorIcon = Extract<IconType, 'LockClosedIcon' | 'LockOpen1Icon' | 'PageIcon' | 'BlockedIcon' | 'SupertabIcon'>;
4
+ export type BrowserIndicatorIcon = Extract<IconType, 'LockClosedIcon' | 'LockOpen1Icon' | 'PageIcon' | 'BlockedIcon' | 'SupertabIcon' | 'BookmarkFilled'>;
5
5
  export interface ShowBrowserIndicatorPayload {
6
6
  type: IndicatorType;
7
7
  message: string;
@@ -1,3 +1,3 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { PageTabContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
3
- export declare const getPageTabMenuTemplate: (pageId: string, winIdentity: OpenFin.Identity) => Promise<PageTabContextMenuItemTemplate[]>;
3
+ export declare const getPageTabMenuTemplate: (pageId: string, winIdentity: OpenFin.Identity, isEnterprise: boolean) => Promise<PageTabContextMenuItemTemplate[]>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Pick specific keys from an object.
3
+ * lodash.pick is deprecated and says to use destructuring instead, but that has one key flaw, it adds undefined properties to the result if the key is not present in the object.
4
+ * ie `const { a, b } = obj; return {a,b};` will result in `{ a: undefined, b: undefined }` if `a` or `b` are not present in `obj`.
5
+ * pick({}, ['a', 'b']) will result in `{}` if `a` or `b` are not present in the object.
6
+ */
7
+ export declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Polyfill for `Promise.withResolvers` which is not available in this typescript version.
3
+ */
4
+ export declare function withResolvers<T>(): PromiseWithResolvers<T>;
5
+ export type PromiseWithResolvers<T> = {
6
+ promise: Promise<T>;
7
+ resolve: (value: T | PromiseLike<T>) => void;
8
+ reject: (reason?: any) => void;
9
+ };
@@ -33,3 +33,26 @@ export type Awaitable<T> = Awaited<T> | Promise<Awaited<T>>;
33
33
  export type RemoveFunctions<T> = Pick<T, {
34
34
  [K in keyof T]: T[K] extends Function ? never : K;
35
35
  }[keyof T]>;
36
+ type MissingKeys<T, U> = Exclude<keyof T, U>;
37
+ /**
38
+ * A utility function that checks if the provided keys are valid for the given type T.
39
+ * The key thing it does is to ensure that all keys in T are present in the array, typescript can check for extra keys but not missing keys.
40
+ * While it is a function, it is really just a type check. The function is needed to encapsulate the type logic.
41
+ * It will throw a type error if any of the keys are not present in T.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * type Foo = {
46
+ * bar: string;
47
+ * qux?: string;
48
+ * };
49
+ *
50
+ * const fooChecker = makeKeyChecker<Foo>();
51
+ * const allFooKeys = fooChecker(['bar', 'qux']); // Valid
52
+ * fooChecker(['bar']); // Error: Missing keys: qux
53
+ * fooChecker(['qux']); // Error: Missing keys: bar
54
+ * fooChecker(['bar', 'qux', 'baz']); // 'baz' is not assignable to type keyof Foo;
55
+ * ```
56
+ */
57
+ export declare const makeKeyChecker: <T extends object>() => <const K extends (keyof T)[]>(arr: K & (Exclude<keyof T, K[number]> extends never ? unknown : `Error: Missing keys: ${string & Exclude<keyof T, K[number]>}`)) => K;
58
+ export {};
@@ -1,3 +1,5 @@
1
1
  export declare const DOCK_COMPANION_HEIGHT = 56;
2
2
  export declare const DOCK_COMPANION_WIDTH = 728;
3
3
  export declare const DOCK_COMPANION_TOP = 150;
4
+ export declare const DOCK3_WINDOW_NAME = "dock3";
5
+ export declare const getDock3ChannelName: (uuid?: string) => string;
@@ -0,0 +1,3 @@
1
+ import { Dock3Config } from '../../../client-api-platform/src/shapes';
2
+ export declare function getDock3ProviderConfig(): Promise<Dock3Config | undefined>;
3
+ export declare function saveDock3ProviderConfig(config: Dock3Config): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { Dock3Config, DockAllowedWindowOptions } from '../../../dock3/src/shapes';
2
+ import { Dock3ConstructorOverride, Dock3Provider } from './provider';
3
+ export type DockInitOptions = {
4
+ config: Dock3Config;
5
+ override: Dock3ConstructorOverride;
6
+ windowOptions?: DockAllowedWindowOptions;
7
+ };
8
+ /**
9
+ *
10
+ * @param config Dock3 configuration object
11
+ * @param override Constructor override to customize the Dock3Provider
12
+ * @returns instance of Dock3Provider
13
+ */
14
+ export declare function init(options: DockInitOptions): Promise<Dock3Provider>;
@@ -0,0 +1,3 @@
1
+ import type { CompanionDockConfig } from '../shapes/enterprise';
2
+ import type { Dock3Config, DockAllowedWindowOptions } from '../shapes/shapes';
3
+ export declare function launchDock(dockName: string, baseUrl: string, config: CompanionDockConfig | Dock3Config, additionalOptions?: DockAllowedWindowOptions): Promise<void>;
@@ -0,0 +1,73 @@
1
+ import type { OpenFin } from '@openfin/core';
2
+ import { BaseCustomDropdownItem } from '../../../client-api/src/shapes';
3
+ import { BookmarkDockEntryPayload, DockEntry, LaunchDockEntryPayload } from '../../../client-api-platform/src/shapes';
4
+ import { Dock3Config, DockCompanionButton } from '../../../dock3/src/shapes';
5
+ type ChannelActionMap = {
6
+ [action: string]: (...args: any[]) => any;
7
+ };
8
+ type TypedChannelClient<ProviderActions extends ChannelActionMap, ClientActions extends ChannelActionMap> = Omit<OpenFin.ChannelClient, 'dispatch' | 'register'> & {
9
+ dispatch: <T extends keyof ProviderActions>(action: T, payload: Parameters<ProviderActions[T]>[0]) => Promise<Awaited<ReturnType<ProviderActions[T]>>>;
10
+ register: <T extends keyof ClientActions>(action: T, handler: (payload: Parameters<ClientActions[T]>[0], id: OpenFin.ProviderIdentity | OpenFin.ClientIdentity) => Promise<Awaited<ReturnType<ClientActions[T]>>>) => boolean;
11
+ };
12
+ type TypedChannelProvider<ProviderActions extends ChannelActionMap, ClientActions extends ChannelActionMap> = Omit<OpenFin.ChannelProvider, 'dispatch' | 'register'> & {
13
+ dispatch: <T extends keyof ClientActions>(to: OpenFin.ClientIdentity, action: T, payload: Parameters<ClientActions[T]>[0]) => Promise<Awaited<ReturnType<ClientActions[T]>>>;
14
+ register: <T extends keyof ProviderActions>(action: T, handler: (payload: Parameters<ProviderActions[T]>[0], id: OpenFin.ProviderIdentity | OpenFin.ClientIdentity) => Promise<Awaited<ReturnType<ProviderActions[T]>>>) => boolean;
15
+ };
16
+ /**
17
+ * @internal
18
+ */
19
+ export type Dock3ChannelProviderChannelActions = {
20
+ 'launch-entry': (payload: LaunchDockEntryPayload) => void;
21
+ 'ready': () => void;
22
+ 'save-config': (payload: {
23
+ config: Dock3Config;
24
+ }) => Promise<void>;
25
+ 'bookmark-content-menu-entry': (payload: BookmarkDockEntryPayload) => Promise<void>;
26
+ };
27
+ /**
28
+ * @internal
29
+ */
30
+ export type Dock3ChannelClientChannelActions = {
31
+ 'handle-dock-config-updated': (payload: Dock3Config) => void;
32
+ };
33
+ /**
34
+ * @internal
35
+ */
36
+ export type Dock3ChannelProvider = TypedChannelProvider<Dock3ChannelProviderChannelActions, Dock3ChannelClientChannelActions>;
37
+ /**
38
+ * @internal
39
+ */
40
+ export type Dock3ChannelClient = TypedChannelClient<Dock3ChannelProviderChannelActions, Dock3ChannelClientChannelActions>;
41
+ /**
42
+ * These are channel actions registered by the platform.
43
+ *
44
+ * @internal
45
+ */
46
+ export type EnterpriseDockChannelProviderChannelActions = Dock3ChannelProviderChannelActions & {
47
+ 'set-dock-favorites-order': (newFavorites: DockEntry[]) => void;
48
+ 'set-default-dock-buttons-order': (newFavorites: DockCompanionButton[]) => void;
49
+ 'get-dock-workspaces-context-menu': () => BaseCustomDropdownItem[];
50
+ 'handle-dock-workspaces-menu-response': (payload: any) => void;
51
+ 'remove-favorite-entry': (entry: DockEntry) => void;
52
+ 'add-favorite-entry': (entry: DockEntry) => void;
53
+ };
54
+ /**
55
+ * These are channel actions registered by the client (enterprise dock)
56
+ * @internal
57
+ */
58
+ export type EnterpriseDockChannelClientChannelActions = Dock3ChannelClientChannelActions & {
59
+ 'update-favorite-entries': () => void;
60
+ 'update-content-menu': () => void;
61
+ 'navigate-content-menu': () => void;
62
+ };
63
+ /**
64
+ * Used by Enterprise Dock for communication with the platform.
65
+ * @internal
66
+ */
67
+ export type EnterpriseDockChannelClient = TypedChannelClient<EnterpriseDockChannelProviderChannelActions, EnterpriseDockChannelClientChannelActions>;
68
+ /**
69
+ * Used by the platform for communication with Enterprise Dock.
70
+ * @internal
71
+ */
72
+ export type EnterpriseDockChannelProvider = TypedChannelProvider<EnterpriseDockChannelProviderChannelActions, EnterpriseDockChannelClientChannelActions>;
73
+ export {};
@@ -0,0 +1,89 @@
1
+ import type { OpenFin } from '@openfin/core';
2
+ import { BookmarkDockEntryPayload, LaunchDockEntryPayload } from '../../../client-api-platform/src/index';
3
+ import { Dock3Config } from '../../../dock3/src/shapes';
4
+ import { Async, CamelCase } from '../../../dock3/src/utils';
5
+ import { Dock3ChannelProvider, Dock3ChannelProviderChannelActions } from './protocol';
6
+ type InternalDock3ChannelActions = 'ready';
7
+ type Dock3ProviderAPI = {
8
+ [K in keyof Omit<Dock3ChannelProviderChannelActions, InternalDock3ChannelActions> as CamelCase<K>]: Async<Dock3ChannelProviderChannelActions[K]>;
9
+ };
10
+ type ExtendsProtocolProvider<T extends Dock3ProviderAPI> = T extends Dock3ProviderAPI ? T : never;
11
+ export type EnsureProviderMatchesProtocol = ExtendsProtocolProvider<Dock3Provider>;
12
+ export declare class Dock3Provider {
13
+ #private;
14
+ static getOverrideConstructor(...args: ConstructorParameters<typeof Dock3Provider>): new () => Dock3Provider;
15
+ static instance: Dock3Provider | null;
16
+ constructor(config: Dock3Config, channel: Dock3ChannelProvider);
17
+ launchEntry(payload: LaunchDockEntryPayload): Promise<void>;
18
+ /**
19
+ * Returns a promise that resolves when the Dock3Provider is ready.
20
+ * This is useful to ensure that the dock is fully initialized before performing any operations.
21
+ * The promise will resolve when the dock sends the 'ready' action.
22
+ */
23
+ get ready(): Promise<void>;
24
+ bookmarkContentMenuEntry(payload: BookmarkDockEntryPayload): Promise<void>;
25
+ /**
26
+ * Read-only access to the current configuration of the Dock3Provider.
27
+ */
28
+ get config(): Dock3Config;
29
+ /**
30
+ * Protected setter for the configuration of the Dock3Provider.
31
+ * This does not save the configuration in storage nor notify the dock about the change.
32
+ * Use `updateConfig` method to update the configuration and save it.
33
+ * This should only be used internally in a `saveConfig` override if `super.saveConfig` is not called.
34
+ */
35
+ protected set config(newConfig: Dock3Config);
36
+ /**
37
+ * Updates the configuration of the Dock3Provider.
38
+ * This method updates the configuration, notifies the dock about the change and saves the new configuration to storage (via `saveConfig`).
39
+ * @param newConfig The new configuration to be applied.
40
+ */
41
+ updateConfig(config: Dock3Config): Promise<void>;
42
+ /**
43
+ * Shuts down the Dock3Provider and closes the dock window.
44
+ * This method sends a shutdown message to the dock and then closes the window.
45
+ */
46
+ shutdown(): Promise<void>;
47
+ /**
48
+ * Called whenever the configuration is updated, this method saves the configuration to the storage.
49
+ * This should not be called directly, if you need to update the configuration, use `updateConfig` method instead.
50
+ */
51
+ saveConfig({ config }: {
52
+ config: Dock3Config;
53
+ }): Promise<void>;
54
+ private handleConfigChange;
55
+ /**
56
+ * Called on startup to load the current configuration of the Dock3Provider.
57
+ * If you've overridden the `saveConfig` method, this should load the configuration from your storage.
58
+ * By default it will load the configuration from local storage. This can be overriden to prevent loading from local storage.
59
+ * @example Prevent loading from local storage:
60
+ * ```typescript
61
+ * class MyDock3Provider extends Dock3Provider {
62
+ * async loadConfig(): Promise<Dock3Config> {
63
+ * // Do not load from local storage, return the default config
64
+ * return this.config;
65
+ * }
66
+ * }
67
+ * ```
68
+ * @example Load from a custom storage:
69
+ * ```typescript
70
+ * class MyDock3Provider extends Dock3Provider {
71
+ * async loadConfig(): Promise<Dock3Config> {
72
+ * // Load from a custom storage
73
+ * const configFromStorage = await myCustomStorage.getDockConfig();
74
+ * // Update local config to ensure it is used.
75
+ * if (configFromStorage) {
76
+ * this.config = configFromStorage;
77
+ * }
78
+ * return this.config;
79
+ * }
80
+ * }
81
+ * ```
82
+ * @returns The current configuration of the Dock3Provider.
83
+ */
84
+ loadConfig(): Promise<Dock3Config>;
85
+ getWindowSync(): OpenFin.Window;
86
+ private registerChannelActions;
87
+ }
88
+ export type Dock3ConstructorOverride = (Base: new () => Dock3Provider) => new () => Dock3Provider;
89
+ export {};
@@ -0,0 +1,22 @@
1
+ import { Point } from '../../../common/src/utils/window';
2
+ import { Dock3Button, Dock3Config } from './shapes';
3
+ export type { EnterpriseDockChannelClient, EnterpriseDockChannelProvider } from '../api/protocol';
4
+ /**
5
+ * @internal
6
+ */
7
+ export type DockCompanionButton = Exclude<Dock3Button, 'store'> | 'bookmarks' | 'searchShortcut';
8
+ /**
9
+ * @internal
10
+ */
11
+ export type CompanionDockConfig = Omit<Dock3Config, 'defaultDockButtons'> & {
12
+ /**
13
+ * Companion dock window position
14
+ */
15
+ dockPosition?: Point;
16
+ /**
17
+ * Base URL for the companion dock
18
+ */
19
+ baseUrl?: string;
20
+ defaultDockButtons?: DockCompanionButton[];
21
+ windowType?: 'enterprise';
22
+ };
@@ -0,0 +1,2 @@
1
+ export * from './shapes';
2
+ export * from './enterprise';