@openfin/workspace 17.0.3 → 17.0.4

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 (27) hide show
  1. package/client-api/src/notifications.d.ts +6 -1
  2. package/client-api/src/shapes/templates.d.ts +4 -3
  3. package/client-api-platform/src/init/browser-window-focus.d.ts +0 -4
  4. package/client-api-platform/src/init/{browser-defaults.d.ts → override-callback/browser-defaults.d.ts} +2 -2
  5. package/client-api-platform/src/init/{dialogs.d.ts → override-callback/dialogs.d.ts} +1 -1
  6. package/client-api-platform/src/init/{override-callback.d.ts → override-callback/index.d.ts} +1 -1
  7. package/client-api-platform/src/init/{page-defaults.d.ts → override-callback/page-defaults.d.ts} +2 -2
  8. package/client-api-platform/src/init/override-callback/snapshot.d.ts +3 -0
  9. package/client-api-platform/src/init/override-callback/view-options.d.ts +12 -0
  10. package/client-api-platform/src/init/utils.d.ts +1 -4
  11. package/client-api-platform/src/shapes.d.ts +112 -1
  12. package/common/src/api/protocol/workspace-platform.d.ts +1 -2
  13. package/common/src/utils/modal-bounds.d.ts +1 -1
  14. package/common/src/utils/route.d.ts +0 -1
  15. package/common/src/utils/snapshot.d.ts +1 -2
  16. package/common/src/utils/window.d.ts +2 -0
  17. package/common/src/utils/workspace-modals.d.ts +1 -0
  18. package/home.js +23 -22
  19. package/home.js.map +1 -1
  20. package/index.js +23 -22
  21. package/index.js.map +1 -1
  22. package/notifications.js +63 -62
  23. package/notifications.js.map +1 -1
  24. package/package.json +3 -3
  25. package/store.js +24 -23
  26. package/store.js.map +1 -1
  27. /package/{client-api-platform/src/init → common/src/utils}/browser-base-url.d.ts +0 -0
@@ -3,9 +3,14 @@ import type { NotificationsPlatform, NotificationsRegisterOptions } from './shap
3
3
  export * from 'openfin-notifications/dist/client/without-auto-launch';
4
4
  export * from './shapes/notifications';
5
5
  /**
6
- * @deprecated
6
+ * @deprecated Use `register` with {@link NotificationsRegisterOptions | options?: NotificationsRegisterOptions} argument instead.
7
7
  */
8
8
  export declare function register(platform: NotificationsPlatform): Promise<Notifications.NotificationsRegistration>;
9
+ /**
10
+ * Launches Notifications service and registers a notifications platform. Throws if workspace platform is not initialized or if you run version of notifications-service which doesn't support platforms.
11
+ *
12
+ * @param options {@link NotificationsPlatform} object
13
+ */
9
14
  export declare function register(options?: NotificationsRegisterOptions): Promise<Notifications.NotificationsRegistration>;
10
15
  /**
11
16
  * Deregisters notifications platform. Throws if you run version of notifications-service which doesn't support platforms.
@@ -111,6 +111,7 @@ export declare enum ButtonStyle {
111
111
  Secondary = "secondary",
112
112
  TextOnly = "textOnly"
113
113
  }
114
+ export type SplitButtonStyle = Extract<ButtonStyle, ButtonStyle.Primary | ButtonStyle.Secondary>;
114
115
  export type PlainContainerTemplateFragment = ContainerTemplateFragment<'Container'>;
115
116
  export type ButtonTemplateFragment = ContainerTemplateFragment<'Button'> & FragmentAction & {
116
117
  /**
@@ -120,9 +121,9 @@ export type ButtonTemplateFragment = ContainerTemplateFragment<'Button'> & Fragm
120
121
  };
121
122
  export type SplitButtonFragment = ContainerTemplateFragment<'SplitButton'> & {
122
123
  /**
123
- * The type of button that determines styling.
124
+ * Determines the styling of the split button.
124
125
  */
125
- buttonType: 'primary' | 'secondary';
126
+ buttonStyle: SplitButtonStyle;
126
127
  /**
127
128
  * Data key of the template fragment.
128
129
  *
@@ -132,7 +133,7 @@ export type SplitButtonFragment = ContainerTemplateFragment<'SplitButton'> & {
132
133
  * ```ts
133
134
  * const myTemplateLayout = {
134
135
  * type: FragmentTypes.SplitButton,
135
- * buttonType: 'primary',
136
+ * buttonStyle: ButtonStyle.Primary,
136
137
  * dataKey: 'splitButton1',
137
138
  * }
138
139
  *
@@ -4,10 +4,6 @@ import type OpenFin from '@openfin/core';
4
4
  * @returns the last focused browser window.
5
5
  */
6
6
  export declare function getLastFocusedBrowserWindow(): Promise<OpenFin.Identity | undefined>;
7
- /**
8
- * Set the OpenFin identity of the last focused browser window.
9
- */
10
- export declare function setLastFocusedBrowserWindow(identity?: OpenFin.Identity): Promise<void>;
11
7
  /**
12
8
  * Listen for a browser window to be focused.
13
9
  * When a browser window is focused, store it in local storage as the last focused browser window.
@@ -1,6 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
- import type { CustomThemeOptions, CustomThemeOptionsWithScheme } from '../../../common/src/api/theming';
3
- import { BrowserInitConfig } from '../../../client-api-platform/src/shapes';
2
+ import type { CustomThemeOptions, CustomThemeOptionsWithScheme } from '../../../../common/src/api/theming';
3
+ import { BrowserInitConfig } from '../../../../client-api-platform/src/shapes';
4
4
  /**
5
5
  * Applies default options to the creation of browser windows.
6
6
  */
@@ -1,3 +1,3 @@
1
1
  import type OpenFin from '@openfin/core';
2
- import { ShowQuitPlatformDialogRequest } from '..';
2
+ import { ShowQuitPlatformDialogRequest } from '../../../../client-api-platform/src/shapes';
3
3
  export declare const showQuitPlatformDialogInternal: (req: ShowQuitPlatformDialogRequest, identity: OpenFin.ProviderIdentity | OpenFin.ClientIdentity) => Promise<void>;
@@ -1,3 +1,3 @@
1
1
  import type OpenFin from '@openfin/core';
2
- import { BrowserInitConfig, WorkspacePlatformOverrideCallback, WorkspacePlatformProvider } from '../../../client-api-platform/src/shapes';
2
+ import { BrowserInitConfig, WorkspacePlatformOverrideCallback, WorkspacePlatformProvider } from '../../../../client-api-platform/src/shapes';
3
3
  export declare const getOverrideCallback: (browserInitOptions: BrowserInitConfig | null, overrideCallback?: WorkspacePlatformOverrideCallback) => OpenFin.OverrideCallback<WorkspacePlatformProvider>;
@@ -1,3 +1,3 @@
1
- import type { AttachedPage } from '../../../common/src/api/pages/shapes';
2
- import type { BrowserInitConfig } from '..';
1
+ import type { AttachedPage } from '../../../../common/src/api/pages/shapes';
2
+ import type { BrowserInitConfig } from '../..';
3
3
  export declare const applyPageDefaults: (pages: AttachedPage[], defaultPageOptions?: BrowserInitConfig['defaultPageOptions']) => Promise<AttachedPage[]>;
@@ -0,0 +1,3 @@
1
+ import type OpenFin from '@openfin/core';
2
+ export declare const parseInternalWorkspaceDataOnWindows: <T extends OpenFin.Snapshot>(snapshot: T) => T;
3
+ export declare const parseWorkspacePlatformOnWindows: <T extends OpenFin.Snapshot>(snapshot: T) => T;
@@ -0,0 +1,12 @@
1
+ import type OpenFin from '@openfin/core';
2
+ import { BrowserCreateViewRequest, BrowserViewState, BrowserWorkspacePlatformViewOptions } from '../../../../client-api-platform/src/shapes';
3
+ export declare function overrideViewOptions(options: Partial<OpenFin.ViewOptions>, initOptions: Partial<OpenFin.ViewOptions>): any;
4
+ export declare function preserveInteropIfManifestConflict(opts: Partial<OpenFin.ViewOptions>, fetchManifest: ({ manifestUrl }: {
5
+ manifestUrl: string;
6
+ }, callerIdentity: OpenFin.Identity) => any, callerIdentity: OpenFin.Identity): Promise<any>;
7
+ type ViewStateBase = Pick<BrowserViewState, '_internalWorkspaceData' | 'workspacePlatform'>;
8
+ export declare const mapInternalWorkspaceDataToWorkspacePlatform: <T extends ViewStateBase>(viewState: T) => T;
9
+ export declare const mapWorkspacePlatformToInternalWorkspaceData: <T extends ViewStateBase>(viewState: T) => T;
10
+ export declare const setHotkeysIfNavigationButtonsEnabled: (options: BrowserCreateViewRequest) => Promise<BrowserCreateViewRequest>;
11
+ export declare const registerHotkeyListenersIfEnabled: (viewIdentity: OpenFin.Identity, buttonOptions?: BrowserWorkspacePlatformViewOptions['browserNavigationButtons']) => void;
12
+ export {};
@@ -1,10 +1,6 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import type { Page } from '../../../common/src/api/pages/shapes';
3
3
  import type { BrowserSnapshot } from '..';
4
- export declare function overrideViewOptions(options: Partial<OpenFin.ViewOptions>, initOptions: OpenFin.ViewOptions): any;
5
- export declare function preserveInteropIfManifestConflict(opts: Partial<OpenFin.ViewOptions>, fetchManifest: ({ manifestUrl }: {
6
- manifestUrl: string;
7
- }, callerIdentity: OpenFin.Identity) => any, callerIdentity: OpenFin.Identity): Promise<any>;
8
4
  export declare const filterSnapshotWindows: (win: OpenFin.WindowOptions) => boolean;
9
5
  /**
10
6
  * fitToMonitor()
@@ -37,4 +33,5 @@ export type WindowType = 'browser' | 'platform' | 'classic' | 'mixed';
37
33
  * @returns - Whether the snapshot has browser windows.
38
34
  */
39
35
  export declare function checkHasBrowserWindows(snapshot: BrowserSnapshot): boolean;
36
+ export declare const copyObject: <T>(obj: T) => T;
40
37
  export {};
@@ -486,6 +486,27 @@ export declare enum WindowType {
486
486
  Browser = "browser",
487
487
  Platform = "platform"
488
488
  }
489
+ export interface BrowserWorkspacePlatformViewOptions {
490
+ browserNavigationButtons?: RequireAtLeastOne<{
491
+ back?: boolean;
492
+ forward?: boolean;
493
+ reload?: boolean;
494
+ }>;
495
+ }
496
+ type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
497
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
498
+ }[Keys];
499
+ export interface BrowserCreateViewPayload {
500
+ opts: BrowserCreateViewRequest;
501
+ target?: OpenFin.CreateViewTarget;
502
+ targetView?: OpenFin.Identity;
503
+ }
504
+ export interface BrowserCreateViewRequest extends OpenFin.PlatformViewCreationOptions {
505
+ workspacePlatform?: BrowserWorkspacePlatformViewOptions;
506
+ }
507
+ export interface BrowserViewState extends OpenFin.ViewState {
508
+ workspacePlatform?: BrowserWorkspacePlatformViewOptions;
509
+ }
489
510
  export interface BrowserWorkspacePlatformWindowOptions {
490
511
  /** For internal usage. Defaults to 'browser' when Browser is enabled when the WorkspacePlatform is initialized. In order to use
491
512
  * non-Browser layout windows ('platform' windows) in a Browser-enabled workspace platform, set windowType to `platform`. In that instance, the other properties
@@ -510,6 +531,46 @@ export interface BrowserWorkspacePlatformWindowOptions {
510
531
  newPageUrl?: string;
511
532
  toolbarOptions?: ToolbarOptions;
512
533
  windowStateButtonOptions?: WindowStateButtonOptions;
534
+ /**
535
+ * Use when you want to display navigation buttons in Browser toolbar. Disabled by default.
536
+ *
537
+ * @example
538
+ * ```
539
+ * import * as WP from "@openfin/workspace-platform";
540
+ *
541
+ * const platform = WP.getCurrentSync();
542
+ * const browserWin = platform.Browser.createWindow({
543
+ * ...,
544
+ * workspacePlatform: {
545
+ * ...,
546
+ * navigationButtons: {
547
+ * enabled: true;
548
+ * }
549
+ * }
550
+ * });
551
+ * ```
552
+ *
553
+ * @example
554
+ * ```
555
+ * // With disabled default keyboard shortcuts
556
+ * const browserWin = platform.Browser.createWindow({
557
+ * ...,
558
+ * workspacePlatform: {
559
+ * ...,
560
+ * navigationButtons: {
561
+ * enabled: true;
562
+ * hotkeysDisabled: true;
563
+ * }
564
+ * }
565
+ * });
566
+ * ```
567
+ */
568
+ navigationButtons?: {
569
+ enabled: false;
570
+ } | {
571
+ enabled: true;
572
+ hotkeysDisabled?: boolean;
573
+ };
513
574
  /**
514
575
  * Remove the Page UI and only allow a single page in the browser window.
515
576
  * Must be set to true for this behavior. If this is not set to false,
@@ -1231,6 +1292,49 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1231
1292
  * Get a snapshot that contains browser windows with pages.
1232
1293
  */
1233
1294
  getSnapshot(): Promise<BrowserSnapshot>;
1295
+ /**
1296
+ * Preferred way of getting View options with Workspace Platform.
1297
+ *
1298
+ * @param viewIdentity
1299
+ *
1300
+ * @example
1301
+ * ```
1302
+ * import * as WP from "@openfin/workspace-platform";
1303
+ *
1304
+ * const platform = WP.getCurrentSync();
1305
+ * const view = await platform.createView(options);
1306
+ * const viewOptions = await platform.getViewSnapshot(view.identity);
1307
+ *
1308
+ * console.log(viewOptions.workspacePlatform);
1309
+ * ```
1310
+ */
1311
+ getViewSnapshot(viewIdentity: OpenFin.Identity): Promise<BrowserViewState>;
1312
+ /**
1313
+ * Use when you need to create a View into Browser window. In addition to what regular platfom `createView` offers, here you can specify `workspacePlatform` options for settings related to Workspace Platform.
1314
+ *
1315
+ * For general details about this method, see docs for `@openfin/core`.
1316
+ *
1317
+ *
1318
+ * @example
1319
+ * ```
1320
+ * import * as WP from "@openfin/workspace-platform";
1321
+ *
1322
+ * const platform = WP.getCurrentSync();
1323
+ *
1324
+ * platform.createView({
1325
+ * url: "https://url-to-your-app.com",
1326
+ * ...,
1327
+ * workspacePlatform: {
1328
+ * browserNavigationButtons: {
1329
+ * reload: false,
1330
+ * back: true,
1331
+ * forward: true
1332
+ * }
1333
+ * }
1334
+ * });
1335
+ * ```
1336
+ */
1337
+ createView(viewOptions: Partial<OpenFin.ViewOptions> | BrowserCreateViewRequest, target?: OpenFin.CreateViewTarget, targetView?: OpenFin.Identity): Promise<OpenFin.View>;
1234
1338
  /**
1235
1339
  * Invokes a custom action defined by platform provider
1236
1340
  * @internal
@@ -1440,6 +1544,13 @@ export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
1440
1544
  * @param req the payload received by the provider
1441
1545
  */
1442
1546
  handleAnalytics(req: AnalyticsEvent[]): Promise<void>;
1547
+ /**
1548
+ * Override when you need to add custom functionality when creating a view.
1549
+ *
1550
+ * @param payload creatin options for the new view
1551
+ * @param callerIdentity identity of the entity that called {@link WorkspacePlatformModule.createView}
1552
+ */
1553
+ createView(payload: BrowserCreateViewPayload, callerIdentity: OpenFin.Identity): Promise<OpenFin.View>;
1443
1554
  /**
1444
1555
  * Implementation for deciding whether a modal informing about loss of unsaved changes will be displayed when closing a page.
1445
1556
  * The default implementation returns `{ shouldShowModal: true }` if the page has unsaved changes (`hasUnsavedChanges` page property)
@@ -1813,7 +1924,7 @@ export interface BrowserInitConfig {
1813
1924
  /**
1814
1925
  * The default options when creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createView(options) call will default to the value provided in this field.
1815
1926
  */
1816
- defaultViewOptions?: OpenFin.ViewOptions;
1927
+ defaultViewOptions?: Partial<OpenFin.ViewOptions>;
1817
1928
  /**
1818
1929
  * The platform title. UI friendly title for the platform in browser.
1819
1930
  */
@@ -6,7 +6,7 @@ import type OpenFin from '@openfin/core';
6
6
  * When adding a new channel action make sure to add a function that's name matches
7
7
  * the value of the enum for the remote procedure in the Workspace Platform overrides and the override-callback.
8
8
  * All of the registered channel action handlers can be found here in the platform's overrides:
9
- * @see link: [Provider Protocol Handlers](https://github.com/openfin/workspace/client-api-platform/src/init/override-callback.ts)
9
+ * @see link: [Provider Protocol Handlers](https://github.com/openfin/workspace/client-api-platform/src/init/override-callback/index.ts)
10
10
  */
11
11
  export declare enum WorkspacePlatformChannelAction {
12
12
  LaunchApp = "launchApp",
@@ -19,7 +19,6 @@ export declare enum WorkspacePlatformChannelAction {
19
19
  CreateSavedPageInternal = "createSavedPageInternal",
20
20
  UpdateSavedPageInternal = "updateSavedPageInternal",
21
21
  DeleteSavedPageInternal = "deleteSavedPageInternal",
22
- SharePage = "sharePage",
23
22
  UpdatePageForWindow = "updatePageForWindow",
24
23
  AttachPagesToWindow = "attachPagesToWindow",
25
24
  DetachPagesFromWindow = "detachPagesFromWindow",
@@ -7,7 +7,7 @@ import { ResponseModalConfig } from './menu-config';
7
7
  * @param modalOptions window options including height/width so that we can calculate the correct bounds
8
8
  * @param parentWindowIdentity the window to get the bounds from. If this is undefined, the primary monitor will be used
9
9
  * @param centerOnMonitor whether the modal should be centered on the monitor
10
- * @returns a point (top/left) as to where the window should be placed
10
+ * @returns the bounds for where the modal is to be displayed
11
11
  */
12
12
  export declare const getResponseModalBounds: (modalOptions: ResponseModalConfig['windowOptions'], parentWindowIdentity?: OpenFin.Identity, centerOnMonitor?: boolean) => Promise<OpenFin.Bounds>;
13
13
  /**
@@ -11,7 +11,6 @@ export declare enum PageRoute {
11
11
  Browser = "/browser/",
12
12
  BrowserPopupMenu = "/browser/popup-menu/",
13
13
  Provider = "/provider/",
14
- BrowserPopupMenuSharePage = "/browser/popup-menu/share-page/",
15
14
  BrowserPopupMenuSaveModal = "/browser/popup-menu/save-modal/",
16
15
  BrowserPopupMenuLayouts = "/browser/popup-menu/layouts/layouts/",
17
16
  BrowserPopupMenuColorLinking = "/browser/popup-menu/color-linking/color-linking/",
@@ -3,9 +3,8 @@ export type SnapshotDetailsExtended = OpenFin.Snapshot['snapshotDetails'] & {
3
3
  machineId: string;
4
4
  machineName?: string;
5
5
  };
6
- export type SnapshotExtended = {
6
+ export type SnapshotExtended = OpenFin.Snapshot & {
7
7
  snapshotDetails: SnapshotDetailsExtended;
8
- windows: OpenFin.WindowOptions[];
9
8
  };
10
9
  export type ApplySnapshotOptionsExtended = OpenFin.ApplySnapshotOptions & {
11
10
  attachToExistingWindow: boolean;
@@ -157,4 +157,6 @@ export declare const getComponentWindowStatus: () => Promise<{
157
157
  storefrontRunning: boolean;
158
158
  homeRunning: boolean;
159
159
  }>;
160
+ export declare const deserializeWindowBounds: (serialized: string) => OpenFin.WindowBounds | null;
161
+ export declare const serializeWindowBounds: (bounds: OpenFin.WindowBounds) => string;
160
162
  export {};
@@ -7,6 +7,7 @@ export declare const showDeleteWorkspaceModal: (windowIdentity: OpenFin.Identity
7
7
  *
8
8
  * @param windowIdentity Parent or Current OpenFin Window Identity
9
9
  * @param workspaceTitle The platform label
10
+ * @param shouldCenterOnMonitor Boolean - determines if modal window is centered on the monitor.
10
11
  * @returns Boolean - Affirmative or Negative response from user
11
12
  */
12
13
  export declare const showPlatformQuitModal: (windowIdentity: OpenFin.Identity, workspaceTitle: string, shouldCenterOnMonitor?: boolean) => Promise<boolean>;