@openfin/workspace-platform 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,17 @@ 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
+ * Default implementation of handlePagesAndWindowClose. Will abort closing of the window if any of the pages within it are prevented from closing.
41
+ * @param payload Contains pages that were prevented from closing, pages that weren't, and identity of the window
42
+ * @returns {shouldWindowClose: boolean} which determines whether closing of the window will proceed
43
+ */
44
+ export declare function handlePagesAndWindowClose(this: WorkspacePlatformProvider, { pagesPreventingClose, pagesNotPreventingClose, identity }: HandlePagesAndWindowClosePayload): Promise<HandlePagesAndWindowCloseResult>;
34
45
  export declare function copyPageOverride({ page }: CopyPagePayload): Promise<Page>;
35
46
  export declare function handlePageChanges(payload: HandlePageChangesPayload): Promise<ModifiedPageState>;
36
47
  /**
@@ -2,7 +2,7 @@ import type OpenFin from '@openfin/core';
2
2
  import { IconProps, Languages } from '@openfin/ui-library';
3
3
  import type { AnalyticsEvent, AnalyticsEventInternal } from '../../common/src/utils/usage-register';
4
4
  import { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
5
- import type { AddDefaultPagePayload, AttachedPage, CopyPagePayload, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult } from '../../common/src/api/pages/shapes';
5
+ import type { AddDefaultPagePayload, AttachedPage, CopyPagePayload, HandlePagesAndWindowClosePayload, HandlePagesAndWindowCloseResult, HandleSaveModalOnPageClosePayload, Page, PageWithUpdatableRuntimeAttribs, SaveModalOnPageCloseResult, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
6
6
  import { SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
7
7
  import { NotificationsCustomManifestOptions } from '../../common/src/api/shapes/notifications';
8
8
  import type { CustomThemes } from '../../common/src/api/theming';
@@ -11,7 +11,7 @@ import type { WorkflowIntegration } from '../../client-api/src/shapes/integratio
11
11
  export { AppManifestType } from '../../client-api/src/shapes';
12
12
  export type { App, AppIntent, Image } from '../../client-api/src/shapes';
13
13
  export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
14
- export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload } from '../../common/src/api/pages/shapes';
14
+ export type { AttachedPage, Page, PageLayout, PageLayoutDetails, PageWithUpdatableRuntimeAttribs, PanelConfigHorizontal, PanelConfigVertical, PanelConfig, ExtendedPanelConfig, CopyPagePayload, HandleSaveModalOnPageClosePayload, SaveModalOnPageCloseResult, SetActivePageForWindowPayload, ShouldPageClosePayload, ShouldPageCloseResult, ViewsPreventingUnloadPayload } from '../../common/src/api/pages/shapes';
15
15
  export { PanelPosition } from '../../common/src/api/pages/shapes';
16
16
  export type { CustomThemes, CustomThemeOptions, CustomThemeOptionsWithScheme, CustomPaletteSet, BaseThemeOptions, ThemeExtension, WorkspaceThemeSet, NotificationIndicatorColorsSet, NotificationIndicatorColorsSetDarkScheme, NotificationIndicatorColorsSetLightScheme, NotificationIndicatorColorsWithScheme } from '../../common/src/api/theming';
17
17
  export type { AnalyticsEvent } from '../../common/src/utils/usage-register';
@@ -663,11 +663,15 @@ export interface BrowserWorkspacePlatformWindowOptions {
663
663
  * When true, disables the ability to close pages in the window. False by default.
664
664
  */
665
665
  preventPageClose?: boolean;
666
+ /**
667
+ * Taskbar Icon for the Browser Window. If light and dark icon are defined, then the taskbar icon will change when the scheme changes.
668
+ */
669
+ icon?: string | TaskbarIcon;
666
670
  }
667
671
  /**
668
672
  * Request for creating a browser window.
669
673
  */
670
- export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform'> {
674
+ export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform' | 'icon'> {
671
675
  /** WorkspacePlatform specific window options. These options will not work unless a workspace platform has been initialized. */
672
676
  workspacePlatform: BrowserWorkspacePlatformWindowOptions | {
673
677
  /** For internal usage. Defaults to 'browser' when Browser is enabled when the WorkspacePlatform is initialized. In order to use
@@ -676,6 +680,10 @@ export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowC
676
680
  * */
677
681
  windowType: WindowType.Platform;
678
682
  };
683
+ /** The icon to display on the taskbar.
684
+ * @deprecated Use the icon property in the workspacePlatform object instead.
685
+ */
686
+ icon?: string;
679
687
  }
680
688
  /**
681
689
  * A window that is part of a browser snapshot.
@@ -1651,6 +1659,66 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
1651
1659
  * and `false` otherwise.
1652
1660
  */
1653
1661
  handleSaveModalOnPageClose(payload: HandleSaveModalOnPageClosePayload): Promise<SaveModalOnPageCloseResult>;
1662
+ /**
1663
+ * This override is called upon closing of the page by user or for each page in a window that is being closed by user.
1664
+ *
1665
+ * In case of closing a page individually, the close operation will be aborted if a False value is returned.
1666
+ *
1667
+ * 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.
1668
+ *
1669
+ * Default behavior: if beforeunload is disabled for the platform, True is always returned.
1670
+ * If enableBeforeUnload is set to true and getUserDecisionForBeforeUnload override is configured to respect beforeunload decisions of views,
1671
+ * then True is only returned if no views are preventing unload.
1672
+ */
1673
+ shouldPageClose(payload: ShouldPageClosePayload): Promise<ShouldPageCloseResult>;
1674
+ /**
1675
+ * This override is called upon closing of a window by user and its return value determines whether the window should proceed closing.
1676
+ * pagesPreventingClose and pagesNotPreventingClose represent pages in the window, grouped based on the value returned by shouldPageClose override for each page.
1677
+ * Default implementation will abort closing of the window if any of the pages within it are prevented from closing.
1678
+ * @param payload Contains pages that were prevented from closing, pages that weren't, and identity of the window
1679
+ * @returns `Promise<{shouldWindowClose: boolean}>` which determines whether closing of the window will proceed
1680
+ */
1681
+ handlePagesAndWindowClose(payload: HandlePagesAndWindowClosePayload): Promise<HandlePagesAndWindowCloseResult>;
1682
+ /**
1683
+ * 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.
1684
+ * Called in {@link WorkspacePlatformProvider.closeWindow} and {@link WorkspacePlatformProvider.closeView}.
1685
+ *
1686
+ * When closing a Page, this override is called by {@link WorkspacePlatformProvider.shouldPageClose}
1687
+ * and page proceeds to close if all views passed in are determined to close. In this case, the `closeType` property will have `'page'` value.
1688
+ *
1689
+ * Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
1690
+ * By default it will always return all Views passed into it as meaning to close.
1691
+ * @param payload
1692
+ * @example
1693
+ *
1694
+ * ```js
1695
+ * const overrideCallback = (PlatformProvider) => {
1696
+ * class Override extends PlatformProvider {
1697
+ * async getUserDecisionForBeforeUnload(payload, callerIdentity) {
1698
+ * const { windowShouldClose, viewsPreventingUnload, viewsNotPreventingUnload, windowId, closeType } = payload;
1699
+ *
1700
+ * // launch dialog and wait for user response
1701
+ * const continueWithClose = await showDialog(viewsPreventingUnload, windowId, closeType);
1702
+ *
1703
+ * if (continueWithClose) {
1704
+ * return { windowShouldClose, viewsToClose: [...viewsNotPreventingUnload, ...viewsPreventingUnload] };
1705
+ * } else {
1706
+ * return { windowShouldClose: false, viewsToClose: [] };
1707
+ * }
1708
+ * }
1709
+ * }
1710
+ * return new Override();
1711
+ * }
1712
+ *
1713
+ * fin.Platform.init({ overrideCallback });
1714
+ *
1715
+ * async function showDialog(viewsPreventingUnload, windowId, closeType) {
1716
+ * // Show a dialog and await for user response
1717
+ * }
1718
+ * ```
1719
+ *
1720
+ */
1721
+ getUserDecisionForBeforeUnload(payload: ViewsPreventingUnloadPayload): Promise<OpenFin.BeforeUnloadUserDecision>;
1654
1722
  /**
1655
1723
  * Implementation for setting the active page in a browser window.
1656
1724
  * Called when the active page is changed and on browser window creation.
@@ -2105,3 +2173,7 @@ export type OpenSaveMenuRequest = {
2105
2173
  menuType: SaveModalType.SAVE_WORKSPACE | SaveModalType.SAVE_WORKSPACE_AS | SaveModalType.RENAME_WORKSPACE;
2106
2174
  id?: never;
2107
2175
  };
2176
+ export type TaskbarIcon = {
2177
+ dark: string;
2178
+ light: string;
2179
+ };
@@ -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