@openfin/workspace 11.0.1 → 11.0.2
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 +131 -95
- package/client-api/src/shapes/common.d.ts +1 -1
- package/client-api-platform/src/init/panels.d.ts +1 -1
- package/common/src/api/pages/shapes.d.ts +21 -0
- package/home.js +1 -1
- package/home.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/notifications.js +1 -1
- package/notifications.js.map +1 -1
- package/package.json +1 -1
- package/store.js +1 -1
- package/store.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,124 +1,160 @@
|
|
|
1
|
-
# Workspace Client API
|
|
1
|
+
# OpenFin Workspace Client API
|
|
2
2
|
|
|
3
|
-
The Workspace Client APIs enable custom integrations with OpenFin Workspace.
|
|
4
|
-
be used in _any_ and _only_ OpenFin apps.
|
|
3
|
+
The Workspace Client APIs enable custom integrations with OpenFin Workspace.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Prerequisites
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- [Node.js](https://nodejs.org/en/) v16.0.0 or higher
|
|
8
|
+
- [npm](https://www.npmjs.com/)
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Install
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
With npm:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```
|
|
15
|
+
$ npm i @openfin/workspace@latest
|
|
16
|
+
```
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
- [API Reference](https://cdn.openfin.co/workspace/docs/api/interfaces/StorefrontAPI.html)
|
|
18
|
+
With yarn:
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
```
|
|
21
|
+
$ yarn global add @openfin/workspace
|
|
22
|
+
```
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
## Usage and Code Samples
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
import { Storefront, launchApp } from '@openfin/workspace';
|
|
25
|
-
import { fetchMyApps, fetchMyLandingPage, fetchMyNavigation, fetchMyFooter } from './my-storefront-provider';
|
|
26
|
+
Prior to using Workspace, a Workspace Platform must be initialized.
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
id: 'my-storefront',
|
|
29
|
-
title: 'My Storefront',
|
|
30
|
-
getApps: fetchMyApps,
|
|
31
|
-
getLandingPage: fetchMyLandingPage,
|
|
32
|
-
getNavigation: fetchMyNavigation,
|
|
33
|
-
getFooter: fetchMyFooter,
|
|
34
|
-
launchApp: launchApp // OpenFin's default implementation of launchApp, you can also define your own
|
|
35
|
-
});
|
|
28
|
+
### Home API
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
30
|
+
- [Overview](https://developers.openfin.co/of-docs/docs/cli-providers)
|
|
31
|
+
- [API Reference](https://developer.openfin.co/workspace/docs/api/latest/modules/home.html)
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
-
```
|
|
33
|
+
```ts
|
|
34
|
+
import Home, CLIProvider from '@openfin/workspace';
|
|
45
35
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
id: 'my-storefront',
|
|
57
|
-
title: 'My Storefront',
|
|
58
|
-
getApps: fetchMyApps,
|
|
59
|
-
getLandingPage: fetchMyLandingPage,
|
|
60
|
-
getNavigation: fetchMyNavigation,
|
|
61
|
-
getFooter: fetchMyFooter,
|
|
62
|
-
launchApp: launchApp // OpenFin's default implementation of launchApp, you can also define your own
|
|
63
|
-
});
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<>
|
|
68
|
-
<button onClick={Storefront.show}>Show Store</button>
|
|
69
|
-
<button onClick={Storefront.hide}>Hide Store</button>
|
|
70
|
-
</>
|
|
71
|
-
);
|
|
36
|
+
import { fetchMySearchResults } from "./my-fetch-implementation";
|
|
37
|
+
|
|
38
|
+
const searchQueryMap: Map<string, (query: string) => void> = new Map();
|
|
39
|
+
|
|
40
|
+
// CLIProvider or HomeProvider
|
|
41
|
+
const myCLIProvider: CLIProvider = {
|
|
42
|
+
id: "my-cli-provider",
|
|
43
|
+
title: "My CLI Provider",
|
|
44
|
+
icon: "https://google.com/favicon.ico",
|
|
45
|
+
onUserInput: (req) => fetchMySearchResults(req.query)
|
|
72
46
|
};
|
|
47
|
+
|
|
48
|
+
// register home and get back a function to inject search string into home search
|
|
49
|
+
const { setSearchQuery } = await Home.register(myCLIProvider);
|
|
50
|
+
|
|
51
|
+
// Store set query function in a map if you're using multiple providers
|
|
52
|
+
searchQueryMap.set(myCLIProvider.id, setSearchQuery);
|
|
53
|
+
|
|
54
|
+
// Call the set query function for a specific provider the search should be injected into
|
|
55
|
+
const searchButton = document.createElement('button');
|
|
56
|
+
searchButton.innerHTML = 'Search';
|
|
57
|
+
document.body.appendChild(searchButton);
|
|
58
|
+
|
|
59
|
+
searchButton.addEventListener('click', () => {
|
|
60
|
+
searchQueryMap.get('my-cli-provider')('my search string');
|
|
61
|
+
});
|
|
62
|
+
|
|
73
63
|
```
|
|
74
64
|
|
|
75
|
-
|
|
65
|
+
### Storefront API
|
|
66
|
+
|
|
67
|
+
- [Overview](https://developers.openfin.co/of-docs/docs/provide-storefront-content)
|
|
68
|
+
- [API Reference](https://developer.openfin.co/workspace/docs/api/latest/modules/store.html)
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
```ts
|
|
71
|
+
import { Storefront, StorefrontProvider } from "@openfin/workspace";
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
// Declare a storefront provider
|
|
74
|
+
const provider: StorefrontProvider = {
|
|
75
|
+
id: "my-storefront-id"
|
|
76
|
+
title: "My StorefrontProvider"
|
|
77
|
+
icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png"
|
|
78
|
+
getApps: () => {...},
|
|
79
|
+
getNavigation: () => {...},
|
|
80
|
+
getLandingPage: () => {...},
|
|
81
|
+
getFooter: () => {...},
|
|
82
|
+
launchApp: () => {...}
|
|
83
|
+
};
|
|
84
|
+
```
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
Register Storefront `provider` object.
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
```ts
|
|
89
|
+
await Storefront.register(myStorefrontProvider);
|
|
90
|
+
```
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
import { Home, HomeActionName, HomeSearchTemplate } from '@openfin/workspace';
|
|
87
|
-
import { fetchMyLongRunningQueryResults, executeMyAction } from './my-provider';
|
|
92
|
+
Show Storefront.
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return { results: fetchMyLongRunningQueryResults() };
|
|
93
|
-
}
|
|
94
|
+
```ts
|
|
95
|
+
await Storefront.show();
|
|
96
|
+
```
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
### Dock API
|
|
99
|
+
|
|
100
|
+
- [Overview](https://developers.openfin.co/of-docs/docs/dock-overview)
|
|
101
|
+
- [API Reference](https://developer.openfin.co/workspace/docs/api/latest/modules/dock.html)
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const provider: DockProvider = {
|
|
105
|
+
id: 'provider-id',
|
|
106
|
+
title: 'Sample Dock',
|
|
107
|
+
icon: 'https://www.openfin.co/favicon-32x32.png',
|
|
108
|
+
buttons: [
|
|
109
|
+
{
|
|
110
|
+
tooltip: 'Sample Button 1',
|
|
111
|
+
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
|
|
112
|
+
action: {
|
|
113
|
+
id: 'sampleButton1'
|
|
104
114
|
}
|
|
105
|
-
|
|
106
|
-
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: DockButtonNames.DropdownButton,
|
|
118
|
+
tooltip: 'Sample Dropdown Button',
|
|
119
|
+
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
|
|
120
|
+
options: [
|
|
121
|
+
{
|
|
122
|
+
tooltip: 'Dropdown Button 1',
|
|
123
|
+
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
|
|
124
|
+
action: {
|
|
125
|
+
id: 'dropdownButton1',
|
|
126
|
+
customData: 'dropdownButton1 clicked'
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
tooltip: 'Dropdown Button 2',
|
|
131
|
+
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
|
|
132
|
+
action: {
|
|
133
|
+
id: 'dropdownButton2',
|
|
134
|
+
customData: 'dropdownButton2 clicked'
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
]
|
|
107
140
|
};
|
|
141
|
+
```
|
|
108
142
|
|
|
109
|
-
|
|
110
|
-
* Optional method for executing actions that are specific to your Home provider.
|
|
111
|
-
*/
|
|
112
|
-
const onResultDispatch = (res) => {
|
|
113
|
-
if (res.action === 'execute-my-action') {
|
|
114
|
-
return executeMyAction(res.data);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
143
|
+
Register dock `provider` object.
|
|
117
144
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
title: 'My Home Provider',
|
|
121
|
-
onUserInput,
|
|
122
|
-
onResultDispatch
|
|
123
|
-
});
|
|
145
|
+
```ts
|
|
146
|
+
await Dock.register(provider);
|
|
124
147
|
```
|
|
148
|
+
|
|
149
|
+
Show Dock.
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
await Dock.show();
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## For more information
|
|
156
|
+
|
|
157
|
+
- [Developer guide](https://developers.openfin.co/of-docs/docs/overview-of-workspace).
|
|
158
|
+
- [API reference](https://developer.openfin.co/workspace/docs/api/latest/index.html).
|
|
159
|
+
- See the [workspace-starter](https://github.com/built-on-openfin/workspace-starter) project for example code.
|
|
160
|
+
- See the [versions page](https://developer.openfin.co/versions/#/?product=Workspace) for a list of all available versions.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { Action, DispatchedAction, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../../search-api/src/index';
|
|
2
2
|
export type { Workspace } from '../../../common/src/api/workspaces';
|
|
3
3
|
export type { LayoutExtended, LayoutContentExtended, LayoutSettingsExtended, LayoutContentItemExtended, LayoutComponentExtended, LayoutComponentStateExtended, LayoutStack } from '../../../common/src/utils/layout';
|
|
4
|
-
export type { Page, PageLayout, PageLayoutDetails } from '../../../common/src/api/pages/shapes';
|
|
4
|
+
export type { Page, PageLayout, PageLayoutDetails, PanelConfig, PanelConfigHorizontal, PanelConfigVertical, PanelPosition } from '../../../common/src/api/pages/shapes';
|
|
5
5
|
export { SearchTagBackground, ActionTrigger } from '../../../search-api/src/shapes';
|
|
6
6
|
export type { ProviderInfo } from './provider';
|
|
7
7
|
export type { BaseCustomButtonConfig, BaseCustomDropdownConfig, BaseCustomDropdownItem, BaseCustomDropdownItems, CustomActionSpecifier, CustomButtonConfig, CustomDropdownConfig } from '../../../common/src/api/action';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AttachedPage, ExtendedPanelConfig, PanelConfig } from '../../../common/src/api/pages/shapes';
|
|
2
2
|
export declare function convertPanelViewOpts(panels: PanelConfig[]): ExtendedPanelConfig[];
|
|
3
|
-
export declare function createPanelViewsForPages(pages: AttachedPage[]): Promise<
|
|
3
|
+
export declare function createPanelViewsForPages(pages: AttachedPage[]): Promise<void>;
|
|
4
4
|
export declare function createPanelViews(panels: PanelConfig[]): Promise<import("@openfin/core/src/api/view").View[]>;
|
|
@@ -99,18 +99,27 @@ export interface GetSavedPageMetadataPayload {
|
|
|
99
99
|
/** The id of the page to get the save state of. */
|
|
100
100
|
pageId: string;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Possible positions than a fixed view panel can take.
|
|
104
|
+
*/
|
|
102
105
|
export declare enum PanelPosition {
|
|
103
106
|
Left = "Left",
|
|
104
107
|
Right = "Right",
|
|
105
108
|
Top = "Top",
|
|
106
109
|
Bottom = "Bottom"
|
|
107
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Properties specific to a horizontal fixed view panel (top or bottom)
|
|
113
|
+
*/
|
|
108
114
|
export interface PanelConfigHorizontal {
|
|
109
115
|
/** Position of the panel in the page. */
|
|
110
116
|
position: PanelPosition.Top | PanelPosition.Bottom;
|
|
111
117
|
/** Size of the top/bottom panel, formatted as CSS property value with units. E.g. "0px", "10%", "3rem". */
|
|
112
118
|
height: string;
|
|
113
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Properties specific to a vertical fixed view panel (left or right)
|
|
122
|
+
*/
|
|
114
123
|
export interface PanelConfigVertical {
|
|
115
124
|
/** Position of the panel in the page. */
|
|
116
125
|
position: PanelPosition.Left | PanelPosition.Right;
|
|
@@ -123,6 +132,18 @@ export interface PanelConfigVertical {
|
|
|
123
132
|
* thus taking priority over the bottom panel.*/
|
|
124
133
|
extendToBottom?: boolean;
|
|
125
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Configuration of an individual fixed view panel
|
|
137
|
+
*
|
|
138
|
+
* Example:
|
|
139
|
+
* ```ts
|
|
140
|
+
* {
|
|
141
|
+
* position: PanelPosition.Left,
|
|
142
|
+
* width: '140px',
|
|
143
|
+
* viewOptions: { url: 'https://example.com'}
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
126
147
|
export declare type PanelConfig = (PanelConfigHorizontal | PanelConfigVertical) & {
|
|
127
148
|
/** The options with which to initialize the panel view.*/
|
|
128
149
|
viewOptions: Omit<OpenFin.PlatformViewCreationOptions, 'bounds' | 'target'>;
|