@openfin/workspace 19.1.18 → 19.1.20

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.
@@ -1,5 +1,6 @@
1
1
  import { type CustomButtonConfig, type CustomDropdownConfig } from '../../../common/src/api/action';
2
2
  import { type RegistrationMetaInfo } from '../../../client-api/src/shapes/common';
3
+ import { TaskbarIcon } from '../../../client-api-platform/src/shapes';
3
4
  import { type ProviderInfo } from './provider';
4
5
  /**
5
6
  * Allows you to hide buttons for different Workspace components in the Dock UI.
@@ -177,7 +178,7 @@ export interface DockProviderConfig {
177
178
  /**
178
179
  * Icon for the provider.
179
180
  */
180
- icon: string;
181
+ icon: string | TaskbarIcon;
181
182
  }
182
183
  export interface DockProviderConfigWithIdentity extends ProviderInfo, DockProviderConfig {
183
184
  }
@@ -1,3 +1,4 @@
1
+ import { TaskbarIcon } from '../../../client-api-platform/src/shapes';
1
2
  export interface ProviderInfo {
2
3
  /**
3
4
  * Unique identifier for the provider.
@@ -12,9 +13,13 @@ export interface ProviderInfo {
12
13
  /**
13
14
  * Icon for the provider.
14
15
  */
15
- icon: string;
16
+ icon: string | TaskbarIcon;
16
17
  /**
17
18
  * version of client SDK, set by the API
18
19
  */
19
20
  clientAPIVersion?: string;
21
+ /**
22
+ * The group name to group the taskbar icon with.
23
+ */
24
+ taskbarIconGroup?: string;
20
25
  }
@@ -1,6 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
- import type { AttachedPage, CopyPagePayload, DetachPagesFromWindowPayload, ExtendedAttachPagesToWindowPayload, HandleSaveModalOnPageClosePayload, ReorderPagesForWindowPayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, UpdatePageForWindowPayload } from '../../../../common/src/api/pages/shapes';
3
- import type { CreateSavedPageRequest, HandlePageChangesPayload, ModifiedPageState, Page, UpdateSavedPageRequest } from '../../../../client-api-platform/src/shapes';
2
+ import type { AttachedPage, CopyPagePayload, DetachPagesFromWindowPayload, ExtendedAttachPagesToWindowPayload, HandlePagesAndWindowClosePayload, HandlePagesAndWindowCloseResult, HandleSaveModalOnPageClosePayload, ReorderPagesForWindowPayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, UpdatePageForWindowPayload } from '../../../../common/src/api/pages/shapes';
3
+ import type { CreateSavedPageRequest, HandlePageChangesPayload, ModifiedPageState, Page, UpdateSavedPageRequest, WorkspacePlatformProvider } from '../../../../client-api-platform/src/shapes';
4
4
  /**
5
5
  * Get all open pages in which are attached to a window.
6
6
  * @returns the list of attached pages.
@@ -31,6 +31,29 @@ export declare const getActivePageIdForWindow: (identity: OpenFin.Identity) => P
31
31
  */
32
32
  export declare function getUniquePageTitle(initialName?: string): Promise<string>;
33
33
  export declare function handleSaveModalOnPageClose({ page }: HandleSaveModalOnPageClosePayload): Promise<SaveModalOnPageCloseResult>;
34
+ /**
35
+ * Default implementation of shouldPageClose. If enableBeforeUnload isn't set to true, always returns True (proceed with close).
36
+ * If beforeunload handling is enabled, will return False if any views in the page are determined not to close.
37
+ */
38
+ export declare function shouldPageClose(this: WorkspacePlatformProvider, { page, identity }: ShouldPageClosePayload): Promise<ShouldPageCloseResult>;
39
+ /**
40
+ * Internal function to broker closing of the window. It needs to live here to call multiple overrides directly instead of via channels.
41
+ * @param payload Accepts pages and window identity
42
+ * @returns a flag indicating whether to continue closing the window
43
+ * @internal
44
+ */
45
+ export declare function shouldWindowClose(this: WorkspacePlatformProvider, { pages, identity }: {
46
+ pages: AttachedPage[];
47
+ identity: OpenFin.Identity;
48
+ }): Promise<{
49
+ shouldWindowClose: boolean;
50
+ }>;
51
+ /**
52
+ * Default implementation of handlePagesAndWindowClose. Will abort closing of the window if any of the pages within it are prevented from closing.
53
+ * @param payload Contains pages that were prevented from closing, pages that weren't, and identity of the window
54
+ * @returns {shouldWindowClose: boolean} which determines whether closing of the window will proceed
55
+ */
56
+ export declare function handlePagesAndWindowClose(this: WorkspacePlatformProvider, { pagesPreventingClose, pagesNotPreventingClose, identity }: HandlePagesAndWindowClosePayload): Promise<HandlePagesAndWindowCloseResult>;
34
57
  export declare function copyPageOverride({ page }: CopyPagePayload): Promise<Page>;
35
58
  export declare function handlePageChanges(payload: HandlePageChangesPayload): Promise<ModifiedPageState>;
36
59
  /**
@@ -4,7 +4,7 @@ import type { AnalyticsEvent, AnalyticsEventInternal } from '../../common/src/ut
4
4
  import { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
5
5
  import { Resource } from '../../common/src/api/i18next';
6
6
  import { TrackedSite } from '../../common/src/api/pages/idb';
7
- import type { AddDefaultPagePayload, AttachedPage, CopyPagePayload, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult } from '../../common/src/api/pages/shapes';
7
+ import type { AddDefaultPagePayload, AttachedPage, CopyPagePayload, HandlePagesAndWindowClosePayload, HandlePagesAndWindowCloseResult, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
8
8
  import { SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
9
9
  import { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
10
10
  import type { CustomThemes } from '../../common/src/api/theming';
@@ -13,7 +13,7 @@ import type { WorkflowIntegration } from '../../client-api/src/shapes/integratio
13
13
  export { AppManifestType } from '../../client-api/src/shapes';
14
14
  export type { App, AppIntent, Image } from '../../client-api/src/shapes';
15
15
  export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
16
- export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
16
+ export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
17
17
  export { PanelPosition } from '../../common/src/api/pages/shapes';
18
18
  export type { CustomThemes, CustomThemeOptions, CustomThemeOptionsWithScheme, CustomPaletteSet, BaseThemeOptions, ThemeExtension, WorkspaceThemeSet, NotificationIndicatorColorsSet, NotificationIndicatorColorsSetDarkScheme, NotificationIndicatorColorsSetLightScheme, NotificationIndicatorColorsWithScheme } from '../../common/src/api/theming';
19
19
  export type { AnalyticsEvent } from '../../common/src/utils/usage-register';
@@ -696,11 +696,15 @@ export interface BrowserWorkspacePlatformWindowOptions {
696
696
  * When true, disables the ability to close pages in the window. False by default.
697
697
  */
698
698
  preventPageClose?: boolean;
699
+ /**
700
+ * Taskbar Icon for the Browser Window. If light and dark icon are defined, then the taskbar icon will change when the scheme changes.
701
+ */
702
+ icon?: string | TaskbarIcon;
699
703
  }
700
704
  /**
701
705
  * Request for creating a browser window.
702
706
  */
703
- export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform'> {
707
+ export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform' | 'icon'> {
704
708
  /** WorkspacePlatform specific window options. These options will not work unless a workspace platform has been initialized. */
705
709
  workspacePlatform: BrowserWorkspacePlatformWindowOptions | {
706
710
  /** For internal usage. Defaults to 'browser' when Browser is enabled when the WorkspacePlatform is initialized. In order to use
@@ -709,6 +713,10 @@ export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowC
709
713
  * */
710
714
  windowType: WindowType.Platform;
711
715
  };
716
+ /** The icon to display on the taskbar.
717
+ * @deprecated Use the icon property in the workspacePlatform object instead.
718
+ */
719
+ icon?: string;
712
720
  }
713
721
  /**
714
722
  * A window that is part of a browser snapshot.
@@ -1868,6 +1876,66 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
1868
1876
  * and `false` otherwise.
1869
1877
  */
1870
1878
  handleSaveModalOnPageClose(payload: HandleSaveModalOnPageClosePayload): Promise<SaveModalOnPageCloseResult>;
1879
+ /**
1880
+ * This override is called upon closing of the page by user or for each page in a window that is being closed by user.
1881
+ *
1882
+ * In case of closing a page individually, the close operation will be aborted if a False value is returned.
1883
+ *
1884
+ * In case of closing a window, the return value will be used to form payload of handlePagesAndWindowClose override, which determines whether the window should proceed with closing.
1885
+ *
1886
+ * Default behavior: if beforeunload is disabled for the platform, True is always returned.
1887
+ * If enableBeforeUnload is set to true and getUserDecisionForBeforeUnload override is configured to respect beforeunload decisions of views,
1888
+ * then True is only returned if no views are preventing unload.
1889
+ */
1890
+ shouldPageClose(payload: ShouldPageClosePayload): Promise<ShouldPageCloseResult>;
1891
+ /**
1892
+ * This override is called upon closing of a window by user and its return value determines whether the window should proceed closing.
1893
+ * pagesPreventingClose and pagesNotPreventingClose represent pages in the window, grouped based on the value returned by shouldPageClose override for each page.
1894
+ * Default implementation will abort closing of the window if any of the pages within it are prevented from closing.
1895
+ * @param payload Contains pages that were prevented from closing, pages that weren't, and identity of the window
1896
+ * @returns `Promise<{shouldWindowClose: boolean}>` which determines whether closing of the window will proceed
1897
+ */
1898
+ handlePagesAndWindowClose(payload: HandlePagesAndWindowClosePayload): Promise<HandlePagesAndWindowCloseResult>;
1899
+ /**
1900
+ * Handle the decision of whether a Window, Page or specific View should close when trying to prevent an unload. This is meant to be overridden.
1901
+ * Called in {@link WorkspacePlatformProvider.closeWindow} and {@link WorkspacePlatformProvider.closeView}.
1902
+ *
1903
+ * When closing a Page, this override is called by {@link WorkspacePlatformProvider.shouldPageClose}
1904
+ * and page proceeds to close if all views passed in are determined to close. In this case, the `closeType` property will have `'page'` value.
1905
+ *
1906
+ * Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
1907
+ * By default it will always return all Views passed into it as meaning to close.
1908
+ * @param payload
1909
+ * @example
1910
+ *
1911
+ * ```js
1912
+ * const overrideCallback = (PlatformProvider) => {
1913
+ * class Override extends PlatformProvider {
1914
+ * async getUserDecisionForBeforeUnload(payload, callerIdentity) {
1915
+ * const { windowShouldClose, viewsPreventingUnload, viewsNotPreventingUnload, windowId, closeType } = payload;
1916
+ *
1917
+ * // launch dialog and wait for user response
1918
+ * const continueWithClose = await showDialog(viewsPreventingUnload, windowId, closeType);
1919
+ *
1920
+ * if (continueWithClose) {
1921
+ * return { windowShouldClose, viewsToClose: [...viewsNotPreventingUnload, ...viewsPreventingUnload] };
1922
+ * } else {
1923
+ * return { windowShouldClose: false, viewsToClose: [] };
1924
+ * }
1925
+ * }
1926
+ * }
1927
+ * return new Override();
1928
+ * }
1929
+ *
1930
+ * fin.Platform.init({ overrideCallback });
1931
+ *
1932
+ * async function showDialog(viewsPreventingUnload, windowId, closeType) {
1933
+ * // Show a dialog and await for user response
1934
+ * }
1935
+ * ```
1936
+ *
1937
+ */
1938
+ getUserDecisionForBeforeUnload(payload: ViewsPreventingUnloadPayload): Promise<OpenFin.BeforeUnloadUserDecision>;
1871
1939
  /**
1872
1940
  * Implementation for setting the active page in a browser window.
1873
1941
  * Called when the active page is changed and on browser window creation.
@@ -2367,3 +2435,7 @@ export type OpenSaveMenuRequest = {
2367
2435
  menuType: SaveModalType.SAVE_WORKSPACE | SaveModalType.SAVE_WORKSPACE_AS | SaveModalType.RENAME_WORKSPACE;
2368
2436
  id?: never;
2369
2437
  };
2438
+ export type TaskbarIcon = {
2439
+ dark: string;
2440
+ light: string;
2441
+ };
@@ -196,6 +196,29 @@ export type PanelConfig = (PanelConfigHorizontal | PanelConfigVertical) & {
196
196
  export type ExtendedPanelConfig = PanelConfig & {
197
197
  viewOptions: PanelConfig['viewOptions'] & OpenFin.Identity;
198
198
  };
199
+ export interface ShouldPageClosePayload {
200
+ /** The page that is closing. */
201
+ page: AttachedPage;
202
+ /** The OF window identity containing the page. */
203
+ identity: OpenFin.Identity;
204
+ /** The type of close operation that triggered the override */
205
+ closeType: 'page' | 'window' | 'view';
206
+ }
207
+ export interface ViewsPreventingUnloadPayload extends Omit<OpenFin.ViewsPreventingUnloadPayload, 'closeType'> {
208
+ closeType: OpenFin.ViewsPreventingUnloadPayload['closeType'] | 'page';
209
+ }
210
+ export interface HandlePagesAndWindowClosePayload {
211
+ /** Pages for which `shouldPageClose` override returned false */
212
+ pagesPreventingClose: AttachedPage[];
213
+ /** Pages for which `shouldPageClose` override returned true */
214
+ pagesNotPreventingClose: AttachedPage[];
215
+ /** Identity of the Browser window */
216
+ identity: OpenFin.Identity;
217
+ }
218
+ export interface HandlePagesAndWindowCloseResult {
219
+ /** Determines whether closing of the window should proceed. */
220
+ shouldWindowClose: boolean;
221
+ }
199
222
  export interface HandleSaveModalOnPageClosePayload {
200
223
  /** The page that is closing. */
201
224
  page: AttachedPage;
@@ -206,6 +229,9 @@ export interface SaveModalOnPageCloseResult {
206
229
  /** If false, a modal informing that unsaved changes will be lost will not be displayed. */
207
230
  shouldShowModal: boolean;
208
231
  }
232
+ export interface ShouldPageCloseResult {
233
+ shouldPageClose: boolean;
234
+ }
209
235
  export interface CopyPagePayload {
210
236
  /** The OF browser identity containing the page to copy. */
211
237
  identity: OpenFin.Identity;
@@ -227,5 +253,7 @@ export type AddPagePayload = {
227
253
  identity: OpenFin.Identity;
228
254
  /** The page to attach. */
229
255
  page: PageWithUpdatableRuntimeAttribs;
256
+ /** Index at which the page should be added */
257
+ insertionIndex?: number;
230
258
  };
231
259
  export {};
@@ -59,6 +59,8 @@ export declare enum WorkspacePlatformChannelAction {
59
59
  GetDockProviderConfig = "getDockProviderConfig",
60
60
  SaveDockProviderConfig = "saveDockProviderConfig",
61
61
  HandleSaveModalOnPageClose = "handleSaveModalOnPageClose",
62
+ ShouldPageClose = "shouldPageClose",
63
+ ShouldWindowClose = "shouldWindowClose",
62
64
  CopyPage = "copyPage",
63
65
  HandlePageChanges = "handlePageChanges",
64
66
  MarkUnsavedPagesAsSavedInternal = "markUnsavedPagesAsSavedInternal",
@@ -28,8 +28,8 @@ export declare enum PageRoute {
28
28
  export declare const Assets: {
29
29
  readonly IconOpenFinLogo: "/icons/openfinlogo.svg";
30
30
  readonly IconFilter: "/icons/filter.svg";
31
- readonly LightStorefront: "/icons/lightstorefront.png";
32
- readonly DarkStorefront: "/icons/darkstorefront.png";
31
+ readonly LightStorefront: "/icons/store-icon-light.png";
32
+ readonly DarkStorefront: "/icons/store-icon-dark.png";
33
33
  readonly CallIconLight: "/icons/call-icon-light.svg";
34
34
  readonly CallIconDark: "/icons/call-icon-dark.svg";
35
35
  readonly ChatIconLight: "/icons/chat-icon-light.svg";
@@ -45,6 +45,8 @@ export declare const Assets: {
45
45
  readonly Microsoft365Icon: "/microsoft-365-integration-assets/microsoft-365-icon.svg";
46
46
  readonly PDFFileIcon: "/microsoft-365-integration-assets/pdf-file-icon.svg";
47
47
  };
48
+ readonly DockIconLight: "/icons/dock-icon-light.png";
49
+ readonly DockIconDark: "/icons/dock-icon-dark.png";
48
50
  };
49
51
  /**
50
52
  * Home DeepLink Options