@openfin/workspace-platform 5.3.0 → 5.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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Workspace Client API
1
+ # Workspace Platform API
2
2
 
3
3
  The Workspace Platform Client APIs allow integrators to create their own Workspace platforms.
4
4
 
@@ -10,13 +10,40 @@ Run `npm i -E @openfin/workspace-platform`.
10
10
 
11
11
  ## Workspace Platform API documentation
12
12
 
13
- - [Overview](https://developers.openfin.co/of-docs/doc/)
14
- - [API Reference](https://cdn.openfin.co/workspace/api/platform/docs/)
13
+ - [Overview](https://developers.openfin.co/of-docs/docs/workspace-sdk)
14
+ - [API Reference](https://cdn.openfin.co/workspace/api/platform/docs/latest/index.html)
15
+ - [Example projects using Workspace Platform](https://github.com/built-on-openfin/workspace-starter)
15
16
 
16
17
  ## Code examples
17
18
 
19
+ ### Initilaize a Workspace Platform
20
+
18
21
  ```typescript
19
22
  import * as WorkspacePlatform from '@openfin/workspace-platform';
20
23
 
21
- WorkspacePlatform.init();
24
+ const customThemes: WorkspacePlatform.CustomThemes = [
25
+ {
26
+ label: "OpenFin's Custom Theme",
27
+ palette: {
28
+ brandPrimary: ‘#F51F63, // required
29
+ brandSecondary: ‘#1FF58A’, // required
30
+ backgroundPrimary: ‘#F8E71C’, // required - hex, rgb/rgba, hsl/hsla only - no string colors: ‘red’
31
+ background2: ‘#7D808A’ // any of the optional colors
32
+ }
33
+ }
34
+ ];
35
+
36
+ const overrideCallback: WorkspacePlatform.BrowserOverrideCallback = async (WorkspacePlatformProvider) => {
37
+ class Override extends WorkspacePlatformProvider {
38
+ async quit(payload, callerIdentity) {
39
+ return super.quit(payload, callerIdentity);
40
+ }
41
+ }
42
+ return new Override();
43
+ };
44
+
45
+ await WorkspacePlatform.init({
46
+ browser: { overrideCallback },
47
+ theme: customThemes
48
+ });
22
49
  ```
@@ -4,11 +4,12 @@
4
4
  */
5
5
  import type { Page } from '../../common/src/api/pages/shapes';
6
6
  import type { Workspace } from '../../common/src/api/workspaces';
7
- import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src';
8
- export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src';
7
+ import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src/index';
8
+ export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src/index';
9
9
  export type { Workspace } from '../../common/src/api/workspaces';
10
- export type { Page } from '../../common/src/api/pages/shapes';
11
- export { SearchTagBackground } from '../../search-api/src';
10
+ export type { LayoutExtended, LayoutContentExtended, LayoutSettingsExtended, LayoutContentItemExtended, LayoutComponentExtended, LayoutComponentStateExtended, LayoutStack } from '../../common/src/utils/layout';
11
+ export type { Page, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
12
+ export { SearchTagBackground } from '../../search-api/src/index';
12
13
  /**
13
14
  * Describes the type of the app directory entry `manifest` attributes.
14
15
  * Launch mechanics are determined by the manifest type.
@@ -1,7 +1,7 @@
1
- import type { LaunchAppPayload } from '../shapes';
1
+ import type { LaunchAppRequest } from '../shapes';
2
2
  /**
3
3
  * Launch the app described by an App Directory entry.
4
4
  * @param app the app directory entry.
5
5
  * @param opts launch options.
6
6
  */
7
- export declare function launchApp({ app, target }: LaunchAppPayload): Promise<void | import("openfin-adapter").View | import("openfin-adapter").Application | import("openfin-adapter/src/api/platform").Platform | import("openfin-adapter").Identity>;
7
+ export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | import("openfin-adapter").View | import("openfin-adapter").Application | import("openfin-adapter/src/api/platform").Platform | import("openfin-adapter").Identity>;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { AttachedPage, Page } from '@common/api/pages/shapes';
2
+ import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
3
3
  export declare const getBrowserModule: (identity: OpenFin.Identity) => {
4
4
  identity: OpenFin.Identity;
5
5
  openfinWindow: import("openfin-adapter").Window;
6
6
  getPages: () => Promise<AttachedPage[]>;
7
7
  getPage: (pageId: string) => Promise<AttachedPage>;
8
- addPage: (page: Page) => Promise<void>;
8
+ addPage: (page: PageWithUpdatableRuntimeAttribs) => Promise<void>;
9
9
  removePage: (id: Page['pageId']) => Promise<void>;
10
10
  setActivePage: (id: Page['pageId']) => Promise<void>;
11
11
  updatePage: (req: any) => Promise<any>;
@@ -1,20 +1,20 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { AttachedPage, Page } from '@common/api/pages/shapes';
2
+ import type { AttachedPage, Page } from '../../../../common/src/api/pages/shapes';
3
3
  import type { BrowserCreateWindowRequest, BrowserWindowModule } from '../../shapes';
4
- export declare const getBrowserApi: (identity: OpenFin.Identity) => {
4
+ export declare const getBrowserApi: (identity: OpenFin.ApplicationIdentity) => {
5
5
  wrapSync: (windowIdentity: OpenFin.Identity) => {
6
6
  identity: OpenFin.Identity;
7
7
  openfinWindow: import("openfin-adapter").Window;
8
8
  getPages: () => Promise<AttachedPage[]>;
9
9
  getPage: (pageId: string) => Promise<AttachedPage>;
10
- addPage: (page: Page) => Promise<void>;
10
+ addPage: (page: import("@common/api/pages/shapes").PageWithUpdatableRuntimeAttribs) => Promise<void>;
11
11
  removePage: (id: string) => Promise<void>;
12
12
  setActivePage: (id: string) => Promise<void>;
13
13
  updatePage: (req: any) => Promise<any>;
14
14
  reorderPages: (req: any) => Promise<any>;
15
15
  };
16
16
  createWindow: (options: BrowserCreateWindowRequest) => Promise<BrowserWindowModule>;
17
- getOpenPages: () => Promise<AttachedPage[]>;
17
+ getAllAttachedPages: () => Promise<AttachedPage[]>;
18
18
  getAllWindows: () => Promise<BrowserWindowModule[]>;
19
19
  launchPage: (page: Page) => Promise<BrowserWindowModule>;
20
20
  getUniquePageTitle: (title?: string) => Promise<any>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import { SnapshotExtended } from '@common/utils/snapshot';
2
+ import { SnapshotExtended } from '../../../../common/src/utils/snapshot';
3
3
  /**
4
4
  * Get a snapshot with pages.
5
5
  *
@@ -1,11 +1,11 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { AttachPagesToWindowPayload } from '@common/api/pages/shapes';
3
- import type { CreateSavedPageRequest, Page, UpdateSavedPageRequest } from '@client-platform/shapes';
2
+ import type { AttachPagesToWindowPayload } from '../../../../common/src/api/pages/shapes';
3
+ import type { CreateSavedPageRequest, Page, UpdateSavedPageRequest } 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.
7
7
  */
8
- export declare const getOpenPages: () => Promise<import("@common/api/pages/shapes").AttachedPage[]>;
8
+ export declare const getAllAttachedPages: () => Promise<import("@client-platform/shapes").AttachedPage[]>;
9
9
  export declare const createSavedPageInternal: ({ page }: CreateSavedPageRequest) => Promise<void>;
10
10
  export declare const deleteSavedPageInternal: (id: string) => Promise<void>;
11
11
  export declare const updateSavedPageInternal: ({ pageId, page }: UpdateSavedPageRequest) => Promise<any>;
@@ -13,12 +13,12 @@ export declare const savePage: (page: Page) => Promise<any>;
13
13
  export declare const attachPagesToWindow: (payload: AttachPagesToWindowPayload) => Promise<void>;
14
14
  export declare const updatePageForWindow: (payload: any) => Promise<void>;
15
15
  export declare const detachPagesFromWindow: (payload: any) => Promise<void>;
16
- export declare const setActivePageForWindow: (payload: any) => Promise<void>;
17
- export declare const getPagesForWindow: (identity: OpenFin.Identity) => Promise<import("@common/api/pages/shapes").AttachedPage[]>;
16
+ export declare const setActivePage: (payload: any) => Promise<void>;
17
+ export declare const getPagesForWindow: (identity: OpenFin.Identity) => Promise<import("@client-platform/shapes").AttachedPage[]>;
18
18
  export declare const getPageForWindow: ({ identity, pageId }: {
19
19
  identity: any;
20
20
  pageId: any;
21
- }) => Promise<import("@common/api/pages/shapes").AttachedPage>;
21
+ }) => Promise<import("@client-platform/shapes").AttachedPage>;
22
22
  export declare const reorderPagesForWindow: (payload: any) => Promise<void>;
23
23
  export declare const getActivePageIdForWindow: (identity: any) => Promise<string>;
24
24
  /**
@@ -25,14 +25,15 @@ export declare enum ChannelAction {
25
25
  AttachPagesToWindow = "attachPagesToWindow",
26
26
  DetachPagesFromWindow = "detachPagesFromWindow",
27
27
  ReorderPagesForWindow = "reorderPagesForWindow",
28
- SetActivePageForWindow = "setActivePageForWindow",
29
- GetOpenPages = "getOpenPages",
28
+ SetActivePage = "setActivePage",
29
+ GetAllAttachedPages = "getAllAttachedPages",
30
30
  GetActivePageIdForWindow = "getActivePageIdForWindow",
31
31
  GetPagesForWindow = "getPagesForWindow",
32
32
  GetPageForWindow = "getPageForWindow",
33
33
  GetSavedPageMetadata = "getSavedPageMetadata",
34
34
  GetUniquePageTitle = "getUniquePageTitle",
35
- GetLastFocusedBrowserWindow = "getLastFocusedBrowserWindow"
35
+ GetLastFocusedBrowserWindow = "getLastFocusedBrowserWindow",
36
+ GetThemes = "getThemes"
36
37
  }
37
38
  /**
38
39
  * Get a channel client for a specific Workspace platform.
@@ -44,4 +45,4 @@ export declare enum ChannelAction {
44
45
  *
45
46
  * @returns the channel client for the Workspace platform.
46
47
  */
47
- export declare const getChannelClient: (identity: OpenFin.Identity) => Promise<import("openfin-adapter").ChannelClient>;
48
+ export declare const getChannelClient: (identity: OpenFin.ApplicationIdentity) => Promise<import("openfin-adapter").ChannelClient>;
@@ -1,4 +1,4 @@
1
- import { Page } from '@common/api/pages/shapes';
1
+ import { Page } from '../../../common/src/api/pages/shapes';
2
2
  import type { CreateSavedPageRequest, UpdateSavedPageRequest } from '../shapes';
3
3
  export declare const getStorageApi: (identity: any) => {
4
4
  createPage: (req: CreateSavedPageRequest) => Promise<any>;
@@ -0,0 +1,5 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ import type { CustomThemes } from '../../../common/src/api/theming';
3
+ export declare const getThemingApi: (identity: OpenFin.ApplicationIdentity) => {
4
+ getThemes: () => Promise<CustomThemes>;
5
+ };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
2
  import type { WorkspacePlatformModule } from '../shapes';
3
- export declare const getWorkspacePlatformModule: (identity: OpenFin.Identity) => WorkspacePlatformModule;
3
+ export declare const getWorkspacePlatformModule: (identity: OpenFin.ApplicationIdentity) => WorkspacePlatformModule;
@@ -1,6 +1,41 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
2
  import type { WorkspacePlatformInitConfig, WorkspacePlatformModule } from './shapes';
3
3
  export * from './shapes';
4
+ /**
5
+ * Initilaize a Workspace Platform.
6
+ *
7
+ * ```ts
8
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
9
+ *
10
+ * const customThemes: WorkspacePlatform.CustomThemes = [{
11
+ * label: "OpenFin's Custom Theme",
12
+ * palette: {
13
+ * brandPrimary: '#F51F63, // required
14
+ * brandSecondary: '#1FF58A', // required
15
+ * backgroundPrimary: '#F8E71C', // required - hex, rgb/rgba, hsl/hsla only - no string colors: 'red'
16
+ * background2: '#7D808A' // any of the optional colors
17
+ * }
18
+ * }
19
+ *
20
+ * const overrideCallback: WorkspacePlatform.BrowserOverrideCallback = async (
21
+ * WorkspacePlatformProvider
22
+ * ) => {
23
+ * class Override extends WorkspacePlatformProvider {
24
+ * async quit(payload, callerIdentity) {
25
+ * return super.quit(payload, callerIdentity);
26
+ * }
27
+ * }
28
+ * return new Override();
29
+ * };
30
+ *
31
+ *
32
+ * await WorkspacePlatform.init({
33
+ * browser: { overrideCallback },
34
+ * theme: customThemes
35
+ * });
36
+ * ```
37
+ * @param options options for configuring the platform.
38
+ */
4
39
  export declare const init: (options: WorkspacePlatformInitConfig) => Promise<void>;
5
- export declare const wrapSync: (identity: OpenFin.Identity) => WorkspacePlatformModule;
40
+ export declare const wrapSync: (identity: OpenFin.ApplicationIdentity) => WorkspacePlatformModule;
6
41
  export declare const getCurrentSync: () => WorkspacePlatformModule;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- import type { BrowserInitConfig } from '@client-platform/shapes';
2
+ import type { BrowserInitConfig } from '../../../client-api-platform/src/shapes';
3
3
  export declare const getOverrideCallback: (initOptions: BrowserInitConfig) => OpenFin.OverrideCallback<OpenFin.PlatformProvider>;
@@ -0,0 +1,9 @@
1
+ import { CustomThemes } from '../shapes';
2
+ export declare const getThemes: () => CustomThemes;
3
+ /**
4
+ * initTheming()
5
+ * Accepts an array of CustomThemes objects and stores it
6
+ * @param customPaletteOptions - optional - array of custom color pallettes
7
+ * @returns array of custom theme objects
8
+ */
9
+ export default function initTheming(customPalettes: CustomThemes): void;
@@ -1,5 +1,10 @@
1
1
  /// <reference types="openfin-adapter/fin" />
2
- export declare function overrideViewOptions(options: Partial<OpenFin.ViewOptions>): void;
2
+ import { Identity } from 'openfin-adapter';
3
+ import { BrowserCreateWindowRequest } from '..';
4
+ export declare function overrideViewOptions(options: Partial<OpenFin.ViewOptions>, initOptions: OpenFin.ViewOptions): OpenFin.ViewOptions & Partial<OpenFin.ViewOptions>;
5
+ export declare function preserveInteropIfManifestConflict(opts: Partial<OpenFin.ViewOptions>, fetchManifest: ({ manifestUrl: string }: {
6
+ manifestUrl: any;
7
+ }, callerIdentity: Identity) => any, callerIdentity: Identity): Promise<any>;
3
8
  export declare const filterSnapshotWindows: (win: OpenFin.WindowOptions) => boolean;
4
9
  /**
5
10
  * fitToMonitor()
@@ -35,5 +40,5 @@ export declare const initWorkspacePlatformOptions: (options: LegacyWindowOptions
35
40
  * @param options - options used to handle layout settings
36
41
  * @returns processed or unprocesseed options
37
42
  */
38
- export declare const applyBrowserDefaults: (options: OpenFin.PlatformWindowCreationOptions) => OpenFin.PlatformWindowCreationOptions;
43
+ export declare const applyBrowserDefaults: (options: OpenFin.PlatformWindowCreationOptions, initOptions: BrowserCreateWindowRequest) => OpenFin.PlatformWindowCreationOptions;
39
44
  export {};