@openfin/workspace 6.3.6 → 7.2.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.
Files changed (35) hide show
  1. package/client-api-platform/src/api/browser/browser-module.d.ts +3 -1
  2. package/client-api-platform/src/api/browser/index.d.ts +2 -0
  3. package/client-api-platform/src/api/context-menu/browser-savebutton-handler.d.ts +3 -0
  4. package/client-api-platform/src/api/context-menu/index.d.ts +6 -3
  5. package/client-api-platform/src/api/protocol.d.ts +11 -1
  6. package/client-api-platform/src/api/storage.d.ts +7 -1
  7. package/client-api-platform/src/api/utils.d.ts +1 -0
  8. package/client-api-platform/src/api/workspaces/idb.d.ts +12 -0
  9. package/client-api-platform/src/api/workspaces/index.d.ts +32 -0
  10. package/client-api-platform/src/shapes.d.ts +276 -9
  11. package/common/src/api/browser-protocol.d.ts +6 -1
  12. package/common/src/components/Indicator/Indicator.constants.d.ts +18 -0
  13. package/common/src/utils/a11y/search.a11y.d.ts +31 -0
  14. package/common/src/utils/a11y/speak.d.ts +6 -0
  15. package/common/src/utils/context-menu.d.ts +4 -0
  16. package/common/src/utils/env.d.ts +1 -0
  17. package/common/src/utils/global-context-menu.d.ts +13 -1
  18. package/common/src/utils/indicators/browser.d.ts +16 -0
  19. package/common/src/utils/indicators/helper.d.ts +2 -0
  20. package/common/src/utils/local-storage-key.d.ts +1 -1
  21. package/common/src/utils/route.d.ts +2 -2
  22. package/common/src/utils/router/base.d.ts +61 -0
  23. package/common/src/utils/router/index.d.ts +2 -0
  24. package/common/src/utils/router/next.d.ts +43 -0
  25. package/common/src/utils/save-button-context-menu.d.ts +2 -0
  26. package/common/src/utils/usage-register.d.ts +11 -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 +4 -4
  32. package/notifications.js.map +1 -1
  33. package/package.json +1 -1
  34. package/store.js +1 -1
  35. package/store.js.map +1 -1
@@ -1,7 +1,7 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
2
  import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
3
3
  import { OpenPageTabContextMenuRequest } from '../../../../client-api-platform/src/index';
4
- import { OpenGlobalContextMenuRequest, OpenViewTabContextMenuRequest, ToolbarOptions, WindowStateButtonOptions } from '../../../../client-api-platform/src/shapes';
4
+ import { OpenGlobalContextMenuRequest, OpenSaveButtonContextMenuRequest, OpenSaveMenuRequest, OpenViewTabContextMenuRequest, ToolbarOptions, WindowStateButtonOptions } from '../../../../client-api-platform/src/shapes';
5
5
  export declare const getBrowserModule: (identity: OpenFin.Identity) => {
6
6
  identity: OpenFin.Identity;
7
7
  openfinWindow: import("openfin-adapter").Window;
@@ -17,4 +17,6 @@ export declare const getBrowserModule: (identity: OpenFin.Identity) => {
17
17
  replaceWindowStateButtonOptions: (options: WindowStateButtonOptions) => Promise<void>;
18
18
  _openViewTabContextMenu: (req: OpenViewTabContextMenuRequest) => Promise<any>;
19
19
  _openPageTabContextMenu: (req: OpenPageTabContextMenuRequest) => Promise<any>;
20
+ _openSaveModal: (req: OpenSaveMenuRequest) => Promise<any>;
21
+ _openSaveButtonContextMenu: (req: OpenSaveButtonContextMenuRequest) => Promise<any>;
20
22
  };
@@ -17,6 +17,8 @@ export declare const getBrowserApi: (identity: OpenFin.ApplicationIdentity) => {
17
17
  replaceWindowStateButtonOptions: (options: import("../../shapes").WindowStateButtonOptions) => Promise<void>;
18
18
  _openViewTabContextMenu: (req: import("../../shapes").OpenViewTabContextMenuRequest) => Promise<any>;
19
19
  _openPageTabContextMenu: (req: import("../../shapes").OpenPageTabContextMenuRequest) => Promise<any>;
20
+ _openSaveModal: (req: import("../../shapes").OpenSaveMenuRequest) => Promise<any>;
21
+ _openSaveButtonContextMenu: (req: import("../../shapes").OpenSaveButtonContextMenuRequest) => Promise<any>;
20
22
  };
21
23
  createWindow: (options: BrowserCreateWindowRequest) => Promise<BrowserWindowModule>;
22
24
  getAllAttachedPages: () => Promise<AttachedPage[]>;
@@ -0,0 +1,3 @@
1
+ import { OpenSaveButtonContextMenuPayload } from '../../../../client-api-platform/src/index';
2
+ import { SaveButtonContextMenuItemData } from '../../../../client-api-platform/src/shapes';
3
+ export declare const saveButtonContextMenuItemHandler: (data: SaveButtonContextMenuItemData, payload: OpenSaveButtonContextMenuPayload) => Promise<void>;
@@ -1,13 +1,16 @@
1
1
  import { NamedIdentity } from 'openfin-adapter/src/identity';
2
- import { OpenPageTabContextMenuPayload } from '../../../../client-api-platform/src/index';
3
- import { OpenGlobalContextMenuPayload, OpenGlobalContextMenuRequest, OpenPageTabContextMenuRequest, OpenViewTabContextMenuPayload, OpenViewTabContextMenuRequest } from '../../../../client-api-platform/src/shapes';
2
+ import { OpenPageTabContextMenuPayload, OpenSaveButtonContextMenuPayload } from '../../../../client-api-platform/src/index';
3
+ import { OpenGlobalContextMenuPayload, OpenGlobalContextMenuRequest, OpenPageTabContextMenuRequest, OpenSaveButtonContextMenuRequest, OpenViewTabContextMenuPayload, OpenViewTabContextMenuRequest } from '../../../../client-api-platform/src/shapes';
4
4
  export declare function openGlobalContextMenuInternal(payload: OpenGlobalContextMenuRequest & {
5
5
  identity: NamedIdentity;
6
6
  }, callerIdentity: any): Promise<void>;
7
- export declare const openCommonContextMenu: (payload: OpenGlobalContextMenuPayload | OpenViewTabContextMenuPayload | OpenPageTabContextMenuPayload, callerIdentity: any) => Promise<void>;
7
+ export declare const openCommonContextMenu: (payload: OpenGlobalContextMenuPayload | OpenViewTabContextMenuPayload | OpenPageTabContextMenuPayload | OpenSaveButtonContextMenuPayload, callerIdentity: any) => Promise<void>;
8
8
  export declare function openViewTabContextMenuInternal(payload: OpenViewTabContextMenuRequest & {
9
9
  identity: NamedIdentity;
10
10
  }, callerIdentity: any): Promise<void>;
11
11
  export declare function openPageTabContextMenuInternal(payload: OpenPageTabContextMenuRequest & {
12
12
  identity: NamedIdentity;
13
13
  }, callerIdentity: any): Promise<void>;
14
+ export declare function openSaveButtonContextMenuInternal(payload: OpenSaveButtonContextMenuRequest & {
15
+ identity: NamedIdentity;
16
+ }, callerIdentity: any): Promise<void>;
@@ -36,7 +36,17 @@ export declare enum ChannelAction {
36
36
  OpenGlobalContextMenuInternal = "openGlobalContextMenuInternal",
37
37
  OpenViewTabContextMenuInternal = "openViewTabContextMenuInternal",
38
38
  OpenPageTabContextMenuInternal = "openPageTabContextMenuInternal",
39
- InvokeCustomActionInternal = "invokeCustomActionInternal"
39
+ OpenSaveButtonContextMenuInternal = "openSaveButtonContextMenuInternal",
40
+ InvokeCustomActionInternal = "invokeCustomActionInternal",
41
+ GetSavedWorkspace = "getSavedWorkspace",
42
+ CreateSavedWorkspace = "createSavedWorkspace",
43
+ UpdateSavedWorkspace = "updateSavedWorkspace",
44
+ DeleteSavedWorkspace = "deleteSavedWorkspace",
45
+ GetSavedWorkspaces = "getSavedWorkspaces",
46
+ SaveWorkspace = "saveWorkspace",
47
+ GetCurrentWorkspace = "getCurrentWorkspace",
48
+ ApplyWorkspace = "applyWorkspace",
49
+ SetActiveWorkspace = "setActiveWorkspace"
40
50
  }
41
51
  /**
42
52
  * Get a channel client for a specific Workspace platform.
@@ -1,5 +1,5 @@
1
1
  import { Page } from '../../../common/src/api/pages/shapes';
2
- import type { CreateSavedPageRequest, UpdateSavedPageRequest } from '../shapes';
2
+ import type { CreateSavedPageRequest, CreateSavedWorkspaceRequest, UpdateSavedPageRequest, UpdateSavedWorkspaceRequest, Workspace } from '../shapes';
3
3
  export declare const getStorageApi: (identity: any) => {
4
4
  createPage: (req: CreateSavedPageRequest) => Promise<any>;
5
5
  deletePage: (id: string) => Promise<any>;
@@ -7,4 +7,10 @@ export declare const getStorageApi: (identity: any) => {
7
7
  getPage: (id: string) => Promise<any>;
8
8
  getPages: (query?: string) => Promise<Page[]>;
9
9
  savePage: (page: Page) => Promise<any>;
10
+ createWorkspace: (req: CreateSavedWorkspaceRequest) => Promise<any>;
11
+ deleteWorkspace: (id: string) => Promise<any>;
12
+ updateWorkspace: (req: UpdateSavedWorkspaceRequest) => Promise<any>;
13
+ getWorkspace: (id: string) => Promise<any>;
14
+ getWorkspaces: (query?: string) => Promise<Workspace[]>;
15
+ saveWorkspace: (workspace: Workspace) => Promise<any>;
10
16
  };
@@ -0,0 +1 @@
1
+ export declare const handleNameCollision: (initialName: string, existingNames: string[]) => string;
@@ -0,0 +1,12 @@
1
+ import { Workspace } from '../../../../client-api/src/shapes';
2
+ export declare const store: import("idb-keyval").UseStore;
3
+ export declare function getWorkspace(id: string): Promise<Workspace>;
4
+ export declare function getWorkspaceList(filter?: string): Promise<Workspace[]>;
5
+ export declare function createWorkspace({ workspace }: {
6
+ workspace: any;
7
+ }): Promise<void>;
8
+ export declare function deleteWorkspace(id: string): Promise<void>;
9
+ export declare function updateWorkspace({ workspaceId, workspace }: {
10
+ workspaceId: any;
11
+ workspace: any;
12
+ }): Promise<void>;
@@ -0,0 +1,32 @@
1
+ import type { CreateSavedWorkspaceRequest, Workspace } from '../../../../client-api-platform/src/shapes';
2
+ /**
3
+ * Apply the given workspace and set it as active.
4
+ */
5
+ export declare function applyWorkspace(workspace: Workspace): Promise<void>;
6
+ /**
7
+ * Set the current active workspace.
8
+ */
9
+ export declare function setActiveWorkspace(workspace: Workspace): void;
10
+ /**
11
+ * Get the initial workspace data structure that represents the an untitled empty workspace.
12
+ * @returns the current active workspace.
13
+ */
14
+ export declare function getInitialWorkspace(): Promise<Workspace>;
15
+ /**
16
+ * Get a workspace data structure that represents the users current desktop.
17
+ * @returns the current active workspace.
18
+ */
19
+ export declare function getCurrentWorkspace(): Promise<Workspace>;
20
+ export declare const createWorkspaceInStorage: (req: CreateSavedWorkspaceRequest) => Promise<any>;
21
+ export declare const getWorkspacesInStorage: () => Promise<Workspace[]>;
22
+ export declare const getWorkspaceInStorage: (id: string) => Promise<Workspace>;
23
+ export declare const deleteWorkspaceInStorage: (id: string) => Promise<any>;
24
+ export declare const updateWorkspaceInStorage: (req: any) => Promise<any>;
25
+ export declare const saveWorkspace: (workspace: Workspace) => Promise<any>;
26
+ /**
27
+ * Checks if a given workspace name is unique
28
+ * If not, add a progressive number to it
29
+ * @param initialName The initial name to test
30
+ * @returns string: a unique workspace name
31
+ */
32
+ export declare function getUniqueWorkspaceTitle(initialName?: string): Promise<string>;
@@ -5,10 +5,10 @@ import { IconProps } from '@openfin/ui-library';
5
5
  import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
6
6
  import type { CustomThemes } from '../../common/src/api/theming';
7
7
  import type { App } from '../../client-api/src/shapes';
8
- export type { CustomThemes } from '../../common/src/api/theming';
9
- export type { App, Image, AppIntent } from '../../client-api/src/shapes';
10
8
  export { AppManifestType } from '../../client-api/src/shapes';
11
- export type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
9
+ export type { App, AppIntent, Image } from '../../client-api/src/shapes';
10
+ export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
11
+ export type { CustomThemes } from '../../common/src/api/theming';
12
12
  /**
13
13
  * Request for creating a saved page in persistent storage.
14
14
  */
@@ -53,7 +53,14 @@ export interface ContextMenuItemData {
53
53
  export declare enum GlobalContextMenuOptionType {
54
54
  NewWindow = "NewWindow",
55
55
  NewPage = "NewPage",
56
+ SaveWorkspace = "SaveWorkspace",
57
+ SavePage = "SavePage",
58
+ SavePageAs = "SavePageAs",
56
59
  CloseWindow = "CloseWindow",
60
+ SaveWorkspaceAs = "SaveWorkspaceAs",
61
+ RenameWorkspace = "RenameWorkspace",
62
+ SwitchWorkspace = "SwitchWorkspace",
63
+ DeleteWorkspace = "DeleteWorkspace",
57
64
  OpenStorefront = "OpenStorefront",
58
65
  Quit = "Quit",
59
66
  Custom = "Custom"
@@ -65,12 +72,16 @@ export declare enum PageTabContextMenuOptionType {
65
72
  Duplicate = "Duplicate",
66
73
  Rename = "Rename",
67
74
  Save = "Save",
75
+ SaveAs = "Save As",
68
76
  Custom = "Custom"
69
77
  }
70
78
  /**Shape of the data property of a global context menu template item */
71
79
  export interface GlobalContextMenuItemData extends ContextMenuItemData {
72
80
  type: GlobalContextMenuOptionType;
73
81
  }
82
+ export interface WorkspaceContextMenuItemData extends GlobalContextMenuItemData {
83
+ workspaceId: string;
84
+ }
74
85
  /**Configuration of an option in the global context menu */
75
86
  export interface GlobalContextMenuItemTemplate extends OpenFin.MenuItemTemplate {
76
87
  data: GlobalContextMenuItemData;
@@ -201,7 +212,7 @@ export declare enum BrowserButtonType {
201
212
  ShowHideTabs = "ShowHideTabs",
202
213
  ColorLinking = "ColorLinking",
203
214
  PresetLayouts = "PresetLayouts",
204
- SavePage = "SavePage",
215
+ SaveMenu = "SaveMenu",
205
216
  Minimise = "Minimise",
206
217
  Maximise = "Maximise",
207
218
  Close = "Close",
@@ -268,6 +279,59 @@ export declare type WindowStateButton = CustomBrowserButtonConfig | PreDefinedBu
268
279
  export interface WindowStateButtonOptions {
269
280
  buttons: WindowStateButton[];
270
281
  }
282
+ /**Types of context menu options for Save button, including pre-defined ones.
283
+ * User-defined context menu items should use the value `Custom` */
284
+ export declare enum SaveButtonContextMenuOptionType {
285
+ SavePage = "SavePage",
286
+ SaveWorkspace = "SaveWorkspace",
287
+ Custom = "Custom"
288
+ }
289
+ /**Shape of the data property of a save button context menu template item */
290
+ export interface SaveButtonContextMenuItemData extends ContextMenuItemData {
291
+ type: SaveButtonContextMenuOptionType;
292
+ }
293
+ /**Configuration of an option in the save button context menu */
294
+ export interface SaveButtonContextMenuItemTemplate extends OpenFin.MenuItemTemplate {
295
+ data: SaveButtonContextMenuItemData;
296
+ }
297
+ /**
298
+ * Request for opening a context menu from save button in Browser.
299
+ */
300
+ export interface OpenSaveButtonContextMenuRequest {
301
+ /** Screen x-coordinate where context menu should be shown. */
302
+ x: number;
303
+ /** Screen y-coordinate where context menu should be shown. */
304
+ y: number;
305
+ /** Screen x-coordinate of save button */
306
+ buttonLeft: number;
307
+ /** width of save button */
308
+ buttonWidth: number;
309
+ /** Miscellaneous options necessary for implementing custom logic in the provider override. */
310
+ customData?: any;
311
+ /** Id of the page on which the context menu is invoked */
312
+ pageId: string;
313
+ }
314
+ /**
315
+ * Payload received by the openSaveButtonContextMenu provider override.
316
+ */
317
+ export declare type OpenSaveButtonContextMenuPayload = OpenSaveButtonContextMenuRequest & {
318
+ /** Identity of the Browser window where context menu should be shown. */
319
+ identity: NamedIdentity;
320
+ /** Template defining the options to show in the context menu. */
321
+ template: SaveButtonContextMenuItemTemplate[];
322
+ /** Default function that handles stock context menu options. */
323
+ callback: (data: SaveButtonContextMenuItemData, req: OpenSaveButtonContextMenuPayload) => any;
324
+ };
325
+ /**Payload received by a Custom Action that is invoked by a custom save button context menu option */
326
+ export interface OpenSaveContextMenuOptionActionPayload {
327
+ callerType: CustomActionCallerType.SaveButtonContextMenu;
328
+ /** Identity of the browser window where the context menu is invoked */
329
+ windowIdentity: OpenFin.Identity;
330
+ /** Any data necessary for the functioning of specified custom action*/
331
+ customData?: any;
332
+ /** Id of the page on which the context menu is invoked */
333
+ pageId: string;
334
+ }
271
335
  /**
272
336
  * Request for creating a browser window.
273
337
  */
@@ -550,6 +614,30 @@ export interface BrowserWindowModule {
550
614
  _openGlobalContextMenu(req: OpenGlobalContextMenuRequest): Promise<void>;
551
615
  _openViewTabContextMenu(req: OpenViewTabContextMenuRequest): Promise<void>;
552
616
  _openPageTabContextMenu(req: OpenPageTabContextMenuRequest): Promise<void>;
617
+ _openSaveButtonContextMenu(req: OpenSaveButtonContextMenuRequest): Promise<void>;
618
+ /**
619
+ * ```ts
620
+ * import * as WorkspacePlatform from '@openfin/workspace-platform
621
+ *
622
+ * const browserIdentity = {
623
+ * name: 'example-browser-window-name',
624
+ * uuid:'my-app-id'
625
+ * };
626
+ *
627
+ * const wp = WorkspacePlatform.getCurrentSync();
628
+ *
629
+ * // eslint-disable-next-line no-underscore-dangle
630
+ * wp.Browser.wrapSync(browserIdentity)._openSaveModal({
631
+ * id: 'my-page-id',
632
+ * menuType: WorkspacePlatform.SaveModalType.SAVE_PAGE_AS,
633
+ * x: 50,
634
+ * y: 50
635
+ * });
636
+ * ```
637
+ * @param req the modal request object
638
+ * @internal
639
+ */
640
+ _openSaveModal(req: OpenSaveMenuRequest): Promise<NamedIdentity>;
553
641
  }
554
642
  /**
555
643
  * Factory for wrapping browser windows and global operations.
@@ -613,7 +701,7 @@ export interface BrowserWindowFactory {
613
701
  * layout
614
702
  * };
615
703
  * const options: BrowserCreateWindowRequest = {
616
- * workspacePlatform {
704
+ * workspacePlatform: {
617
705
  * pages: [page],
618
706
  * title: 'My Window Title',
619
707
  * favicon: 'https://google.com/favicon.ico',
@@ -643,11 +731,12 @@ export interface BrowserWindowFactory {
643
731
  * type: BrowserButtonType.PresetLayouts
644
732
  * },
645
733
  * {
646
- * type: BrowserButtonType.SavePage
734
+ * type: BrowserButtonType.SaveMenu
647
735
  * }
648
736
  * ]
649
737
  * }
650
- * windowStateButtonOptions: { configure the set of icons for setting window states
738
+ * windowStateButtonOptions: {
739
+ * //configure the set of icons for setting window states
651
740
  * buttons: [
652
741
  * { // adding a custom window state icon for the window
653
742
  * id: 'windowState123',
@@ -857,6 +946,62 @@ export interface WorkspacePlatformStorage {
857
946
  * @param page the page to save.
858
947
  */
859
948
  savePage(page: Page): Promise<void>;
949
+ /**
950
+ * Get all workspaces that are saved in persistent storage.
951
+ *
952
+ * ```ts
953
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
954
+ *
955
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
956
+ * const workspaces = await workspacePlatform.Storage.getWorkspaces();
957
+ * ```
958
+ */
959
+ getWorkspaces(): Promise<Workspace[]>;
960
+ /**
961
+ * Get a specific workspace in persistent storage.
962
+ *
963
+ * ```ts
964
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
965
+ *
966
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
967
+ * const myWorkspace = await workspacePlatform.Storage.getWorkspace('myWorkspaceId');
968
+ * ```
969
+ * @param id the id of the workspace to get.
970
+ */
971
+ getWorkspace(id: string): Promise<Workspace>;
972
+ /**
973
+ * Create a workspace in persistent storage.
974
+ *
975
+ * @param workspace the workspace to create in persistent storage.
976
+ */
977
+ createWorkspace(workspace: CreateSavedWorkspaceRequest): Promise<void>;
978
+ /**
979
+ * Update a workspace in persistent storage.
980
+ * @param req the update saved workspace request.
981
+ */
982
+ updateWorkspace(req: UpdateSavedWorkspaceRequest): Promise<void>;
983
+ /**
984
+ * Delete a workspace from persistent storage.
985
+ *
986
+ * ```ts
987
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
988
+ *
989
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
990
+ * await workspacePlatform.Storage.deleteWorkspace('myWorkspaceId');
991
+ * ```
992
+ * @param id the id of the workspace to delete.
993
+ */
994
+ deleteWorkspace(id: string): Promise<void>;
995
+ /**
996
+ * Save a workspace in persistent storage.
997
+ *
998
+ * This is a helper function that will call `getWorkspace` to determine if a workspace is already in storage.
999
+ * If the workspace is already in storage, it will call `updateWorkspace`.
1000
+ * If it does not exist in storage, the function will call `createWorkspace` instead.
1001
+ *
1002
+ * @param workspace the workspace to save.
1003
+ */
1004
+ saveWorkspace(workspace: Workspace): Promise<void>;
860
1005
  }
861
1006
  /**
862
1007
  * Request for launching an application.
@@ -917,6 +1062,21 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
917
1062
  * @param req the launch app request.
918
1063
  */
919
1064
  launchApp(req: LaunchAppRequest): Promise<void>;
1065
+ /**
1066
+ * Gets a workspace data structure that represents the current state of the user's desktop.
1067
+ */
1068
+ getCurrentWorkspace(): Promise<Workspace>;
1069
+ /**
1070
+ * Sets the workspace as the current active workspace. Does not apply the workspace to the user's desktop.
1071
+ * @param workspace the workspace to set as current active workspace.
1072
+ */
1073
+ setActiveWorkspace(workspace: Workspace): Promise<void>;
1074
+ /**
1075
+ * Closes content from the current workspace and applies the given workspace to the user's desktop. Makes that
1076
+ * workspace the active workspace.
1077
+ * @param workspace the workspace to apply to the desktop and set as the current active workspace.
1078
+ */
1079
+ applyWorkspace(workspace: Workspace): Promise<void>;
920
1080
  /**
921
1081
  * The browser window factory for the Workspace Platform.
922
1082
  */
@@ -956,6 +1116,31 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
956
1116
  * @param id of the id of the page to delete.
957
1117
  */
958
1118
  deleteSavedPage(id: string): Promise<void>;
1119
+ /**
1120
+ * Implementation for getting a list of saved workspaces from persistent storage.
1121
+ * @param query an optional query.
1122
+ */
1123
+ getSavedWorkspaces(query?: string): Promise<Workspace[]>;
1124
+ /**
1125
+ * Implementation for getting a single workspace in persistent storage.
1126
+ * @param id
1127
+ */
1128
+ getSavedWorkspace(id: string): Promise<Workspace>;
1129
+ /**
1130
+ * Implementation for creating a saved workspace in persistent storage.
1131
+ * @param req the create saved workspace request.
1132
+ */
1133
+ createSavedWorkspace(req: CreateSavedWorkspaceRequest): Promise<void>;
1134
+ /**
1135
+ * Implementation for updating a saved workspace in persistent storage.
1136
+ * @param req the update saved workspace request.
1137
+ */
1138
+ updateSavedWorkspace(req: UpdateSavedWorkspaceRequest): Promise<void>;
1139
+ /**
1140
+ * Implementation for deleting a saved workspace in persistent storage.
1141
+ * @param id of the id of the workspace to delete.
1142
+ */
1143
+ deleteSavedWorkspace(id: string): Promise<void>;
959
1144
  /**
960
1145
  * Implementation for showing a global context menu given a menu template,
961
1146
  * handler callback, and screen coordinates. For an example of overriding, see {@link BrowserOverrideCallback}.
@@ -977,6 +1162,13 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
977
1162
  * @param callerIdentity OF identity of the entity from which the request originated
978
1163
  */
979
1164
  openPageTabContextMenu(req: OpenPageTabContextMenuPayload, callerIdentity: OpenFin.Identity): any;
1165
+ /**
1166
+ * Implementation for showing a context menu for save button given a menu template,
1167
+ * handler callback, and screen coordinates. For an example of overriding, see {@link BrowserOverrideCallback}.
1168
+ * @param req the payload received by the provider call
1169
+ * @param callerIdentity OF identity of the entity from which the request originated
1170
+ */
1171
+ openSaveButtonContextMenu(req: OpenSaveButtonContextMenuPayload, callerIdentity: OpenFin.Identity): any;
980
1172
  }
981
1173
  /**
982
1174
  * The origins from which a custom action can be invoked
@@ -986,6 +1178,7 @@ export declare enum CustomActionCallerType {
986
1178
  GlobalContextMenu = "GlobalContextMenu",
987
1179
  ViewTabContextMenu = "ViewTabContextMenu",
988
1180
  PageTabContextMenu = "PageTabContextMenu",
1181
+ SaveButtonContextMenu = "SaveButtonContextMenu",
989
1182
  API = "API"
990
1183
  }
991
1184
  /**The payload received by a Custom Action.
@@ -993,7 +1186,7 @@ export declare enum CustomActionCallerType {
993
1186
  * When `callerType == CustomActionCallerType.API`, the payload is defined by the code directly invoking the action.*/
994
1187
  export declare type CustomActionPayload = {
995
1188
  callerType: CustomActionCallerType.API;
996
- } | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload;
1189
+ } | CustomButtonActionPayload | GlobalContextMenuOptionActionPayload | ViewTabCustomActionPayload | PageTabContextMenuOptionActionPayload | OpenSaveContextMenuOptionActionPayload;
997
1190
  /**
998
1191
  * Configures a custom action when the control is invoked
999
1192
  */
@@ -1129,7 +1322,31 @@ export interface WorkspacePlatformInitConfig {
1129
1322
  * }, callerIdentity);
1130
1323
  * };
1131
1324
  *
1132
- *
1325
+ * // add a custom menu item in Save Context Menu
1326
+ * openSaveButtonContextMenu = (req: WorkspacePlatform.OpenSaveButtonContextMenuPayload, callerIdentity: OpenFin.Identity) => {
1327
+ * return super.openSaveButtonContextMenu(
1328
+ * {
1329
+ * ...req,
1330
+ * template: [
1331
+ * ...req.template,
1332
+ * {
1333
+ * label: 'Save custom option',
1334
+ * data: {
1335
+ * type: SaveButtonContextMenuOptionType.Custom,
1336
+ * action: {
1337
+ * id: 'sample-custom-action-name',
1338
+ * customData: {
1339
+ * someProp: 'Save Button task'
1340
+ * }
1341
+ * }
1342
+ * }
1343
+ * }
1344
+ * ]
1345
+ * },
1346
+ * callerIdentity
1347
+ * );
1348
+ * }
1349
+ * }
1133
1350
  * }
1134
1351
  * return new Override();
1135
1352
  * };
@@ -1175,3 +1392,53 @@ export interface BrowserInitConfig {
1175
1392
  */
1176
1393
  interopOverride?: OpenFin.OverrideCallback<InteropBroker, InteropBroker>;
1177
1394
  }
1395
+ interface WorkspaceMetadata {
1396
+ APIVersion: string;
1397
+ }
1398
+ export interface Workspace {
1399
+ workspaceId: string;
1400
+ title: string;
1401
+ metadata: WorkspaceMetadata;
1402
+ snapshot: OpenFin.Snapshot;
1403
+ }
1404
+ /**
1405
+ * Request for creating a saved workspace in persistent storage.
1406
+ */
1407
+ export interface CreateSavedWorkspaceRequest {
1408
+ /** The workspace to create. */
1409
+ workspace: Workspace;
1410
+ }
1411
+ /**
1412
+ * Request for updating a saved workspace in persistent storage.
1413
+ */
1414
+ export interface UpdateSavedWorkspaceRequest {
1415
+ /** The ID of the workspace to update. */
1416
+ workspaceId: string;
1417
+ /** The updated workspace. */
1418
+ workspace: Workspace;
1419
+ }
1420
+ /**
1421
+ * @internal
1422
+ */
1423
+ export declare enum SaveModalType {
1424
+ SAVE_PAGE = "SAVE_PAGE",
1425
+ SAVE_WORKSPACE = "SAVE_WORKSPACE",
1426
+ SAVE_PAGE_AS = "SAVE_PAGE_AS",
1427
+ SAVE_WORKSPACE_AS = "SAVE_WORKSPACE_AS",
1428
+ RENAME_PAGE = "RENAME_PAGE",
1429
+ RENAME_WORKSPACE = "RENAME_WORKSPACE"
1430
+ }
1431
+ /**
1432
+ * Request to create a save modal.
1433
+ * @private
1434
+ */
1435
+ export declare type OpenSaveMenuRequest = {
1436
+ x?: number;
1437
+ y?: number;
1438
+ } & ({
1439
+ menuType: SaveModalType.SAVE_PAGE | SaveModalType.SAVE_PAGE_AS | SaveModalType.RENAME_PAGE;
1440
+ id: string;
1441
+ } | {
1442
+ menuType: SaveModalType.SAVE_WORKSPACE | SaveModalType.SAVE_WORKSPACE_AS | SaveModalType.RENAME_WORKSPACE;
1443
+ id?: never;
1444
+ });
@@ -12,12 +12,17 @@ export interface AddToChannelRequest {
12
12
  newChannelId: string;
13
13
  selectedViews: OpenFin.Identity[];
14
14
  }
15
+ /**
16
+ * These actions are used to handle functionality activated by user in the UI (e.g. context menu)
17
+ * and hence show dialogs, indicators etc.
18
+ * Not to be confused with attached pages actions, which are for API use.
19
+ */
15
20
  export declare enum ChannelAction {
16
21
  CloseBrowserWindow = "close-browser-window",
17
22
  QuitPlatform = "quit-platform",
18
23
  ClosePage = "close-page",
19
24
  AddToChannel = "add-to-channel",
20
25
  RemoveFromChannel = "remove-from-channel",
21
- SavePage = "save-page",
26
+ OpenSaveModalInternal = "open-save-modal-internal",
22
27
  DuplicatePage = "duplicate-page"
23
28
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Here we define an Indicator only explicitly by needing an ID for reference over the wire.
3
+ * Type and message are meant to provide actual context and meaning to an indicator, but
4
+ * they are not required in the case of destroying an existing indicator.
5
+ */
6
+ export interface Indicator {
7
+ id: string;
8
+ type?: IndicatorType;
9
+ message?: string;
10
+ }
11
+ /**
12
+ * Indicator types are meant to provide additional context to the indicator.
13
+ */
14
+ export declare enum IndicatorType {
15
+ ERROR = "error",
16
+ SUCCESS = "success",
17
+ INFO = "info"
18
+ }
@@ -0,0 +1,31 @@
1
+ export declare type Role = string;
2
+ export declare type AriaOwns = undefined | string;
3
+ export declare type AriaHaspopup = boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
4
+ export declare type AriaAutocomplete = 'none' | 'inline' | 'list' | 'both';
5
+ export declare type AriaControls = undefined | string;
6
+ export declare type AriaActivedescendant = undefined | string;
7
+ export declare type AriaExpanded = boolean | 'false' | 'true';
8
+ export declare type AriaLive = 'none' | 'polite' | 'assertive';
9
+ export declare type A11yBox = {
10
+ 'role': Role;
11
+ 'aria-expanded': AriaExpanded;
12
+ 'aria-owns': AriaOwns;
13
+ 'aria-haspopup': AriaHaspopup;
14
+ };
15
+ export declare type A11yInput = {
16
+ 'aria-controls': AriaControls;
17
+ 'aria-autocomplete': AriaAutocomplete;
18
+ 'aria-activedescendant': AriaActivedescendant;
19
+ };
20
+ export interface AriaSearchInput {
21
+ role: Role;
22
+ controls: AriaControls;
23
+ autocomplete: AriaAutocomplete;
24
+ owns: AriaOwns;
25
+ haspopup: AriaHaspopup;
26
+ searchLabelID: string;
27
+ searchResultID: string;
28
+ searchInputID: string;
29
+ labelText: string;
30
+ }
31
+ export declare const A11ySearch: AriaSearchInput;
@@ -0,0 +1,6 @@
1
+ import { AriaLive } from './search.a11y';
2
+ /**
3
+ * Makes the screen reader speak the provided message.
4
+ * https://a11y-guidelines.orange.com/en/web/components-examples/make-a-screen-reader-talk/
5
+ */
6
+ export declare const speak: (msg: string, priority?: AriaLive) => void;
@@ -10,3 +10,7 @@ export declare type ShowContextMenuResponse = OpenFin.MenuResult & {
10
10
  data: string;
11
11
  };
12
12
  export default function showContextMenu(opts: OpenFin.ShowPopupMenuOptions, win?: _Window): Promise<ShowContextMenuResponse>;
13
+ export declare const DefaultSaveMenuBounds: {
14
+ width: number;
15
+ height: number;
16
+ };
@@ -23,3 +23,4 @@ export declare const workspaceCdnEnvUrl: string;
23
23
  export declare const workspaceDocsPlatformUrl: string;
24
24
  export declare const workspaceDocsClientUrl: string;
25
25
  export declare const workspaceRuntimeVersion: string;
26
+ export declare const workspaceBuildVersion: string;
@@ -1,3 +1,15 @@
1
1
  import { NamedIdentity } from 'openfin-adapter/src/identity';
2
- import { GlobalContextMenuItemTemplate } from '../../../client-api-platform/src/shapes';
2
+ import { MenuItemType } from '../../../common/src/utils/context-menu';
3
+ import * as WP from '../../../client-api-platform/src/index';
4
+ import { GlobalContextMenuItemTemplate, GlobalContextMenuOptionType, Workspace } from '../../../client-api-platform/src/shapes';
5
+ export declare const getSavedWorkspaceContextMenuOptions: (activeWorkspace: Workspace, savedWorkspaces: Workspace[], contextMenuOptionType: GlobalContextMenuOptionType) => {
6
+ label: string;
7
+ type: MenuItemType;
8
+ enabled: boolean;
9
+ checked: boolean;
10
+ data: {
11
+ type: WP.GlobalContextMenuOptionType;
12
+ workspaceId: string;
13
+ };
14
+ }[];
3
15
  export declare const getGlobalContextMenuTemplate: (winIdentity: NamedIdentity) => Promise<GlobalContextMenuItemTemplate[]>;