@openfin/workspace-platform 5.2.0 → 5.5.0
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 +31 -4
- package/client-api/src/shapes.d.ts +597 -0
- package/{index.ts → client-api-platform/index.d.ts} +0 -0
- package/client-api-platform/src/api/app-directory.d.ts +7 -0
- package/client-api-platform/src/api/browser/browser-module.d.ts +13 -0
- package/client-api-platform/src/api/browser/index.d.ts +22 -0
- package/client-api-platform/src/api/pages/helper.d.ts +22 -0
- package/client-api-platform/src/api/pages/index.d.ts +30 -0
- package/client-api-platform/src/api/protocol.d.ts +48 -0
- package/client-api-platform/src/api/storage.d.ts +10 -0
- package/client-api-platform/src/api/theming.d.ts +5 -0
- package/client-api-platform/src/api/workspace-module.d.ts +3 -0
- package/client-api-platform/src/index.d.ts +41 -0
- package/client-api-platform/src/init/browser-window-focus.d.ts +19 -0
- package/client-api-platform/src/init/cleanup.d.ts +1 -0
- package/client-api-platform/src/init/index.d.ts +5 -0
- package/client-api-platform/src/init/override-callback.d.ts +3 -0
- package/client-api-platform/src/init/theming.d.ts +9 -0
- package/client-api-platform/src/init/utils.d.ts +45 -0
- package/client-api-platform/src/shapes.d.ts +673 -0
- package/client-api-platform/src/umd.d.ts +1 -0
- package/common/src/api/pages/attached.d.ts +101 -0
- package/common/src/api/pages/idb.d.ts +12 -0
- package/common/src/api/pages/index.d.ts +22 -0
- package/common/src/api/pages/legacy.d.ts +16 -0
- package/common/src/api/pages/shapes.d.ts +77 -0
- package/common/src/api/protocol.d.ts +64 -0
- package/common/src/api/theming.d.ts +62 -0
- package/common/src/api/workspaces/index.d.ts +7 -0
- package/common/src/utils/application.d.ts +38 -0
- package/common/src/utils/channels.d.ts +8 -0
- package/common/src/utils/debounce.d.ts +16 -0
- package/common/src/utils/defer-auto-show.d.ts +18 -0
- package/common/src/utils/env.d.ts +36 -0
- package/common/src/utils/layout.d.ts +52 -0
- package/common/src/utils/local-storage-key.d.ts +8 -0
- package/common/src/utils/logger/index.d.ts +26 -0
- package/common/src/utils/logger/manager.d.ts +35 -0
- package/common/src/utils/logger/shapes.d.ts +27 -0
- package/common/src/utils/route.d.ts +55 -0
- package/common/src/utils/shared-emitter.d.ts +10 -0
- package/common/src/utils/snapshot.d.ts +33 -0
- package/common/src/utils/strings.d.ts +5 -0
- package/common/src/utils/theming.d.ts +57 -0
- package/common/src/utils/umd.d.ts +2 -0
- package/common/src/utils/window.d.ts +150 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +1 -34
- package/search-api/src/client/index.d.ts +6 -0
- package/search-api/src/client/internal.d.ts +38 -0
- package/search-api/src/client/remote/channel-client-factory.d.ts +2 -0
- package/search-api/src/client/remote/channel-client.d.ts +9 -0
- package/search-api/src/client/remote/data.d.ts +16 -0
- package/search-api/src/client/remote/disconnect.d.ts +7 -0
- package/search-api/src/client/remote/dispatch.d.ts +9 -0
- package/search-api/src/client/remote/requests.d.ts +5 -0
- package/search-api/src/client/remote/search-close.d.ts +14 -0
- package/search-api/src/common.d.ts +104 -0
- package/search-api/src/errors.d.ts +5 -0
- package/search-api/src/fin/index.d.ts +6 -0
- package/search-api/src/fin/shapes.d.ts +23 -0
- package/search-api/src/index.d.ts +7 -0
- package/search-api/src/internal-shapes.d.ts +134 -0
- package/search-api/src/logger.d.ts +1 -0
- package/search-api/src/provider/index.d.ts +8 -0
- package/search-api/src/provider/internal.d.ts +33 -0
- package/search-api/src/provider/remote/channel-factory.d.ts +6 -0
- package/search-api/src/provider/remote/channel.d.ts +23 -0
- package/search-api/src/provider/remote/connection.d.ts +20 -0
- package/search-api/src/provider/remote/data.d.ts +23 -0
- package/search-api/src/provider/remote/deregistration.d.ts +5 -0
- package/search-api/src/provider/remote/disconnect.d.ts +1 -0
- package/search-api/src/provider/remote/disconnection.d.ts +9 -0
- package/search-api/src/provider/remote/dispatch.d.ts +7 -0
- package/search-api/src/provider/remote/info.d.ts +5 -0
- package/search-api/src/provider/remote/registration.d.ts +23 -0
- package/search-api/src/provider/remote/search-close.d.ts +14 -0
- package/search-api/src/provider/remote/search.d.ts +8 -0
- package/search-api/src/shapes.d.ts +542 -0
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -2
- package/.prettierrc.js +0 -2
- package/babel.config.js +0 -2
- package/jest.config.js +0 -2
- package/src/api/app-directory.ts +0 -45
- package/src/api/browser/browser-module.ts +0 -65
- package/src/api/browser/index.ts +0 -46
- package/src/api/pages/helper.ts +0 -113
- package/src/api/pages/index.ts +0 -164
- package/src/api/protocol.ts +0 -60
- package/src/api/storage.ts +0 -32
- package/src/api/workspace-module.ts +0 -36
- package/src/index.ts +0 -35
- package/src/init/browser-window-focus.ts +0 -59
- package/src/init/cleanup.ts +0 -87
- package/src/init/index.ts +0 -42
- package/src/init/override-callback.ts +0 -159
- package/src/init/utils.ts +0 -164
- package/src/shapes.ts +0 -160
- package/src/umd.ts +0 -5
- package/tsconfig.json +0 -13
- package/webpack.common.config.js +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Workspace
|
|
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/
|
|
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.
|
|
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
|
```
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use relative paths here rather than aliases which mess
|
|
3
|
+
* up the packaged typing files
|
|
4
|
+
*/
|
|
5
|
+
import type { Page } from '../../common/src/api/pages/shapes';
|
|
6
|
+
import type { Workspace } from '../../common/src/api/workspaces';
|
|
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
|
+
export type { Workspace } from '../../common/src/api/workspaces';
|
|
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';
|
|
13
|
+
/**
|
|
14
|
+
* Describes the type of the app directory entry `manifest` attributes.
|
|
15
|
+
* Launch mechanics are determined by the manifest type.
|
|
16
|
+
*/
|
|
17
|
+
export declare enum AppManifestType {
|
|
18
|
+
/**
|
|
19
|
+
* A snapshot manifest.
|
|
20
|
+
*/
|
|
21
|
+
Snapshot = "snapshot",
|
|
22
|
+
/**
|
|
23
|
+
* A classic OpenFin app manifest.
|
|
24
|
+
*/
|
|
25
|
+
Manifest = "manifest",
|
|
26
|
+
/**
|
|
27
|
+
* A view manifest.
|
|
28
|
+
*/
|
|
29
|
+
View = "view",
|
|
30
|
+
/**
|
|
31
|
+
* A manifest for an external application.
|
|
32
|
+
*/
|
|
33
|
+
External = "external"
|
|
34
|
+
}
|
|
35
|
+
export interface AppIntent {
|
|
36
|
+
name: string;
|
|
37
|
+
displayName: string;
|
|
38
|
+
contexts: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Detailed metadata describing an image.
|
|
42
|
+
*/
|
|
43
|
+
export interface Image {
|
|
44
|
+
src: string;
|
|
45
|
+
type?: string;
|
|
46
|
+
size?: string;
|
|
47
|
+
purpose?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Detailed metadata describing an application.
|
|
51
|
+
*/
|
|
52
|
+
export interface App {
|
|
53
|
+
/**
|
|
54
|
+
* Unique identifier for an application.
|
|
55
|
+
*/
|
|
56
|
+
appId: string;
|
|
57
|
+
/**
|
|
58
|
+
* A UI friendly title for the application.
|
|
59
|
+
*/
|
|
60
|
+
title: string;
|
|
61
|
+
/**
|
|
62
|
+
* URL to application manifest.
|
|
63
|
+
*/
|
|
64
|
+
manifest: string;
|
|
65
|
+
/**
|
|
66
|
+
* UI friendly description for an application.
|
|
67
|
+
*/
|
|
68
|
+
description?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Describes the type of manifest resolved by the `manifest` field.
|
|
71
|
+
* Launch mechanics are determined by the manifest type.
|
|
72
|
+
*/
|
|
73
|
+
manifestType: AppManifestType | string;
|
|
74
|
+
/**
|
|
75
|
+
* A list of icons that can be rendered in UI for this application.
|
|
76
|
+
*/
|
|
77
|
+
icons: Image[];
|
|
78
|
+
/**
|
|
79
|
+
* A list of optional images that highlight application functionality.
|
|
80
|
+
*/
|
|
81
|
+
images?: Image[];
|
|
82
|
+
intents?: AppIntent[];
|
|
83
|
+
tags?: string[];
|
|
84
|
+
version?: string;
|
|
85
|
+
publisher: string;
|
|
86
|
+
contactEmail?: string;
|
|
87
|
+
supportEmail?: string;
|
|
88
|
+
}
|
|
89
|
+
export declare enum StorefrontTemplate {
|
|
90
|
+
LandingPage = "landingPage",
|
|
91
|
+
AppGrid = "appGrid"
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Represents a link to be rendered inside Storefront.
|
|
95
|
+
*/
|
|
96
|
+
export interface StorefrontLink {
|
|
97
|
+
/**
|
|
98
|
+
* A UI friendly title to render the link as.
|
|
99
|
+
*/
|
|
100
|
+
title: string;
|
|
101
|
+
/**
|
|
102
|
+
* When the rendered `title` text is clicked, the user will be navigated to this URL.
|
|
103
|
+
*/
|
|
104
|
+
url: string;
|
|
105
|
+
}
|
|
106
|
+
export interface StorefrontFooter {
|
|
107
|
+
/**
|
|
108
|
+
* A logo to be displayed on the Storefront's footer.
|
|
109
|
+
*/
|
|
110
|
+
logo: Image;
|
|
111
|
+
/**
|
|
112
|
+
* A set of links to display on Storefront's footer.
|
|
113
|
+
*/
|
|
114
|
+
links: [StorefrontLink?, StorefrontLink?, StorefrontLink?];
|
|
115
|
+
text: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Render a navigation section on the left panel of Storefront.
|
|
119
|
+
*/
|
|
120
|
+
export interface StorefrontNavigationSection {
|
|
121
|
+
/**
|
|
122
|
+
* Unique identifier for the navigation section.
|
|
123
|
+
*/
|
|
124
|
+
id: string;
|
|
125
|
+
/**
|
|
126
|
+
* The UI friendly title of the navigation section.
|
|
127
|
+
*/
|
|
128
|
+
title: string;
|
|
129
|
+
/**
|
|
130
|
+
* Navigation items to render under this section.
|
|
131
|
+
* 1-5 Navigation Items are supported.
|
|
132
|
+
*/
|
|
133
|
+
items: [
|
|
134
|
+
StorefrontNavigationItem,
|
|
135
|
+
StorefrontNavigationItem?,
|
|
136
|
+
StorefrontNavigationItem?,
|
|
137
|
+
StorefrontNavigationItem?,
|
|
138
|
+
StorefrontNavigationItem?
|
|
139
|
+
];
|
|
140
|
+
}
|
|
141
|
+
export interface StorefrontLandingPage {
|
|
142
|
+
hero?: {
|
|
143
|
+
title: string;
|
|
144
|
+
description: string;
|
|
145
|
+
cta: StorefrontNavigationItem;
|
|
146
|
+
image: Image;
|
|
147
|
+
};
|
|
148
|
+
topRow: {
|
|
149
|
+
title: string;
|
|
150
|
+
items: [
|
|
151
|
+
StorefrontDetailedNavigationItem?,
|
|
152
|
+
StorefrontDetailedNavigationItem?,
|
|
153
|
+
StorefrontDetailedNavigationItem?,
|
|
154
|
+
StorefrontDetailedNavigationItem?
|
|
155
|
+
];
|
|
156
|
+
};
|
|
157
|
+
middleRow: {
|
|
158
|
+
title: string;
|
|
159
|
+
apps: [App?, App?, App?, App?, App?, App?];
|
|
160
|
+
};
|
|
161
|
+
bottomRow: {
|
|
162
|
+
title: string;
|
|
163
|
+
items: [
|
|
164
|
+
StorefrontDetailedNavigationItem?,
|
|
165
|
+
StorefrontDetailedNavigationItem?,
|
|
166
|
+
StorefrontDetailedNavigationItem?
|
|
167
|
+
];
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Render a grid of applications in Storefront.
|
|
172
|
+
*/
|
|
173
|
+
export interface StorefrontAppGrid {
|
|
174
|
+
/**
|
|
175
|
+
* The apps to render in the grid.
|
|
176
|
+
*/
|
|
177
|
+
apps: App[];
|
|
178
|
+
}
|
|
179
|
+
export interface StorefrontNavigationItemBase {
|
|
180
|
+
/**
|
|
181
|
+
* An ID for referencing the navigation item. Must be unique.
|
|
182
|
+
*/
|
|
183
|
+
id: string;
|
|
184
|
+
/**
|
|
185
|
+
* UI friendly name for the navigation item.
|
|
186
|
+
*/
|
|
187
|
+
title: string;
|
|
188
|
+
}
|
|
189
|
+
export interface StorefrontNavigationItemDetails {
|
|
190
|
+
description: string;
|
|
191
|
+
image: Image;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Template for rendering a navigation item that renders a app grid when clicked.
|
|
195
|
+
*/
|
|
196
|
+
export interface StorefrontNavigationItemAppGrid extends StorefrontNavigationItemBase {
|
|
197
|
+
templateId: StorefrontTemplate.AppGrid;
|
|
198
|
+
/**
|
|
199
|
+
* Render an app grid when navigation item is pressed.
|
|
200
|
+
*/
|
|
201
|
+
templateData: StorefrontAppGrid;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Template for rendering a navigation item that renders another landing page when clicked.
|
|
205
|
+
*/
|
|
206
|
+
export interface StorefrontNavigationItemLandingPage extends StorefrontNavigationItemBase {
|
|
207
|
+
templateId: StorefrontTemplate.LandingPage;
|
|
208
|
+
/**
|
|
209
|
+
* Render a landing page when navigation item is pressed.
|
|
210
|
+
*/
|
|
211
|
+
templateData: StorefrontLandingPage;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Render an item in the navigation bar of Storefront.
|
|
215
|
+
*/
|
|
216
|
+
export declare type StorefrontNavigationItem = StorefrontNavigationItemAppGrid | StorefrontNavigationItemLandingPage;
|
|
217
|
+
/**
|
|
218
|
+
* Render an item in the navigation bar of Storefront with a description and image.
|
|
219
|
+
*/
|
|
220
|
+
export declare type StorefrontDetailedNavigationItem = StorefrontNavigationItem & StorefrontNavigationItemDetails;
|
|
221
|
+
export interface StorefrontProviderInfo {
|
|
222
|
+
/**
|
|
223
|
+
* Unique identifier for the Storefront provider.
|
|
224
|
+
*/
|
|
225
|
+
id: string;
|
|
226
|
+
/**
|
|
227
|
+
* A UI friendly title for the platform Storefront.
|
|
228
|
+
* This will be used in the Storefront selection dropdown.
|
|
229
|
+
*/
|
|
230
|
+
title: string;
|
|
231
|
+
/**
|
|
232
|
+
* Icon for storefront provider.
|
|
233
|
+
* Visible next to title in storefront provider selector UI
|
|
234
|
+
*/
|
|
235
|
+
icon: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Describes a Storefront provided by a platform.
|
|
239
|
+
* A platform must provide an object that satisfies this interface in order to register with the Storefront.
|
|
240
|
+
*/
|
|
241
|
+
export interface StorefrontProvider extends StorefrontProviderInfo {
|
|
242
|
+
/**
|
|
243
|
+
* Get a list of apps to populate the platform's Storefront with.
|
|
244
|
+
*/
|
|
245
|
+
getApps(): Promise<App[]>;
|
|
246
|
+
/**
|
|
247
|
+
* Get the main landing page for the platform's Storefront.
|
|
248
|
+
*/
|
|
249
|
+
getLandingPage(): Promise<StorefrontLandingPage>;
|
|
250
|
+
/**
|
|
251
|
+
* Get the Storefront navigation sections for the left nav bar.
|
|
252
|
+
*/
|
|
253
|
+
getNavigation(): Promise<[StorefrontNavigationSection?, StorefrontNavigationSection?]>;
|
|
254
|
+
/**
|
|
255
|
+
* Get the footer for the platform's Storefront.
|
|
256
|
+
*/
|
|
257
|
+
getFooter(): Promise<StorefrontFooter>;
|
|
258
|
+
/**
|
|
259
|
+
* Launch an app provided by the platform's Storefront.
|
|
260
|
+
*/
|
|
261
|
+
launchApp(app: App): Promise<void>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Interface that contains functions for integrating with Storefront.
|
|
265
|
+
*/
|
|
266
|
+
export interface StorefrontAPI {
|
|
267
|
+
/**
|
|
268
|
+
* Registers a [[`StorefrontProvider`]]. Upon registering a provider,
|
|
269
|
+
* the title of your provider appears in the menu of the Storefront UI.
|
|
270
|
+
* When a user selects your Storefront, the methods on the provider
|
|
271
|
+
* object are called to populate the UI. Throws an error if a provider with
|
|
272
|
+
* the same `id` already exists.
|
|
273
|
+
* @param provider the implementation of a Storefront provider.
|
|
274
|
+
|
|
275
|
+
*/
|
|
276
|
+
register(provider: StorefrontProvider): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Deregister a provider.
|
|
279
|
+
* @param id the id of the provider.
|
|
280
|
+
*/
|
|
281
|
+
deregister(id: string): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Shows the Storefront window. Awaits for the latest [[`Storefront.register()`]]
|
|
284
|
+
* internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
|
|
285
|
+
* doesn't exist (i.e., because `register()` not called previously).
|
|
286
|
+
*/
|
|
287
|
+
show(): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Hides the Storefront window. Awaits for the latest [[`Storefront.register()`]]
|
|
290
|
+
* internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
|
|
291
|
+
* doesn't exist (i.e., because `register()` was not called previously).
|
|
292
|
+
*/
|
|
293
|
+
hide(): Promise<void>;
|
|
294
|
+
}
|
|
295
|
+
export declare type CLISearchListenerRequest = SearchListenerRequest;
|
|
296
|
+
/**
|
|
297
|
+
* Representation of a search request from a specific invocation of a {@link HomeProvider | HomeProvider's} `onUserInput` listener function.
|
|
298
|
+
*/
|
|
299
|
+
export interface HomeSearchListenerRequest extends CLISearchListenerRequest {
|
|
300
|
+
context: {
|
|
301
|
+
/**
|
|
302
|
+
* Denotes that this Home search request was triggered via
|
|
303
|
+
* the user selecting a suggestion from this provider.
|
|
304
|
+
*/
|
|
305
|
+
isSuggestion: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Denotes that this search request should return search results
|
|
308
|
+
* that represent content that a user has saved. (Workspaces, Pages)
|
|
309
|
+
*/
|
|
310
|
+
isSaved: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Denotes that this search request should return search results
|
|
313
|
+
* that represents content that is stored in the platform.
|
|
314
|
+
* This should exclude content that the user has saved.
|
|
315
|
+
* (Workspaces, Pages, Views, Apps)
|
|
316
|
+
*/
|
|
317
|
+
isStore: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Denotes that this search request should return search results
|
|
320
|
+
* that represent other Home search providers. If the user chooses to
|
|
321
|
+
* launch one of these apps, they should register a Home provider.
|
|
322
|
+
*/
|
|
323
|
+
isSearchEngines: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* any user-selected filters will be populated here
|
|
326
|
+
* e.g [{
|
|
327
|
+
* title: 'Currency Pairs',
|
|
328
|
+
* type: FilterOptionType.MultiSelect,
|
|
329
|
+
* options: [{ value: 'GBPUSD', isSelected: true}]
|
|
330
|
+
* }]
|
|
331
|
+
*/
|
|
332
|
+
selectedFilters?: CLIFilter[];
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
export declare type CLISearchListenerResponse = SearchListenerResponse;
|
|
336
|
+
/**
|
|
337
|
+
* Representation of a search response from a specific invocation of a {@link HomeProvider | HomeProvider's} `onUserInput` listener function.
|
|
338
|
+
* Can optionally be used to push search results to the Home UI.
|
|
339
|
+
*
|
|
340
|
+
* ```ts
|
|
341
|
+
* function onUserInput(req: HomeSearchListenerRequest, res: HomeSearchListenerResponse) {
|
|
342
|
+
* searchListenerResponse.open();
|
|
343
|
+
*
|
|
344
|
+
* const myLongRunningQuery = makeMyLongRunningQuery(searchListenerRequest.query);
|
|
345
|
+
* myLongRunningQuery.onNewResults(myNewResults => {
|
|
346
|
+
* searchListenerResponse.respond(myNewResults);
|
|
347
|
+
* });
|
|
348
|
+
*
|
|
349
|
+
* searchListenerRequest.onClose(() => {
|
|
350
|
+
* myLongRunningQuery.close();
|
|
351
|
+
* });
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
export declare type HomeSearchListenerResponse = Omit<CLISearchListenerResponse, 'respond'> & {
|
|
356
|
+
respond(results: HomeSearchResult[]): void;
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Enumerator for different types of actions that are built into the Home API.
|
|
360
|
+
*/
|
|
361
|
+
export declare enum CLIAction {
|
|
362
|
+
Suggestion = "suggestion"
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* An action that is built into Home.
|
|
366
|
+
*/
|
|
367
|
+
export interface CLIBuiltInAction<T extends CLIAction> extends Action {
|
|
368
|
+
name: T;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Built in action for suggesting another search to execute to the user.
|
|
372
|
+
*/
|
|
373
|
+
export interface CLISuggestion extends CLIBuiltInAction<CLIAction.Suggestion> {
|
|
374
|
+
/**
|
|
375
|
+
* The query to search for if this action is selected.
|
|
376
|
+
*/
|
|
377
|
+
query: string;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Union type that includes Home's built in search result actions.
|
|
381
|
+
*/
|
|
382
|
+
export declare type HomeAction = CLISuggestion | Action;
|
|
383
|
+
/**
|
|
384
|
+
* A search result that can be rendered by a Workspace component.
|
|
385
|
+
*/
|
|
386
|
+
export declare type CLISearchResult<A extends Action> = SearchResult<A>;
|
|
387
|
+
/**
|
|
388
|
+
* A list of template types that determine how a search result is rendered.
|
|
389
|
+
*/
|
|
390
|
+
export declare enum CLITemplate {
|
|
391
|
+
/**
|
|
392
|
+
* Contact Information Template
|
|
393
|
+
*/
|
|
394
|
+
Contact = "Contact",
|
|
395
|
+
/**
|
|
396
|
+
* Definition List Template
|
|
397
|
+
*/
|
|
398
|
+
List = "List",
|
|
399
|
+
/**
|
|
400
|
+
* Non-Template search result.
|
|
401
|
+
*/
|
|
402
|
+
Plain = "Plain",
|
|
403
|
+
/**
|
|
404
|
+
* Simple Text Template
|
|
405
|
+
*/
|
|
406
|
+
SimpleText = "SimpleText"
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* {@link SearchResult | Search result} template definition
|
|
410
|
+
*/
|
|
411
|
+
export interface CLISearchResultWithTemplate<T extends keyof typeof CLITemplate, C, A extends Action> extends CLISearchResult<A> {
|
|
412
|
+
template: T;
|
|
413
|
+
templateContent: C;
|
|
414
|
+
}
|
|
415
|
+
export declare type ListPairs = [string, string][];
|
|
416
|
+
/**
|
|
417
|
+
* Contact Data.
|
|
418
|
+
*/
|
|
419
|
+
export interface ContactInfo {
|
|
420
|
+
/**
|
|
421
|
+
* Name of the contact.
|
|
422
|
+
*/
|
|
423
|
+
name: string;
|
|
424
|
+
/**
|
|
425
|
+
* Title of the contact.
|
|
426
|
+
*/
|
|
427
|
+
title?: string;
|
|
428
|
+
/**
|
|
429
|
+
* URL for the contact's profile photo.
|
|
430
|
+
*/
|
|
431
|
+
photoUrl?: string;
|
|
432
|
+
/**
|
|
433
|
+
* A flag to indicate that the contact card should display the contact's initials as profile photo if the photo url is undefined.
|
|
434
|
+
*/
|
|
435
|
+
useInitials?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* An array of detail list objects that can be used for logical grouping of contact details.
|
|
438
|
+
*/
|
|
439
|
+
details: ListPairs[];
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Contact Info Search Result
|
|
443
|
+
*/
|
|
444
|
+
export interface CLISearchResultContact<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Contact, ContactInfo, A> {
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Definition List Search Result
|
|
448
|
+
*/
|
|
449
|
+
export interface CLISearchResultList<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.List, ListPairs, A> {
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Non-Template Search Result
|
|
453
|
+
*/
|
|
454
|
+
export interface CLISearchResultPlain<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Plain, undefined, A> {
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Simple Text Search Result
|
|
458
|
+
*/
|
|
459
|
+
export interface CLISearchResultSimpleText<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.SimpleText, string, A> {
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* A search result that can be rendered by Home UI.
|
|
463
|
+
*/
|
|
464
|
+
export declare type HomeSearchResult = CLISearchResultContact<HomeAction> | CLISearchResultSimpleText<HomeAction> | CLISearchResultList<HomeAction> | CLISearchResultPlain<HomeAction>;
|
|
465
|
+
export declare enum CLIFilterOptionType {
|
|
466
|
+
/**
|
|
467
|
+
* Display a multi-select drop down for the options
|
|
468
|
+
*/
|
|
469
|
+
MultiSelect = "MultiSelect"
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* An option object containing values to filter
|
|
473
|
+
*/
|
|
474
|
+
export interface CLIFilterOption {
|
|
475
|
+
value: string;
|
|
476
|
+
isSelected?: boolean;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* A search filter that will be rendered by a Workspace component.
|
|
480
|
+
*/
|
|
481
|
+
export interface CLIFilter {
|
|
482
|
+
id: string;
|
|
483
|
+
title: string;
|
|
484
|
+
type?: CLIFilterOptionType;
|
|
485
|
+
options: CLIFilterOption[] | CLIFilterOption;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* An object returned from a CLI provider's 'onUserInput' function containing search results.
|
|
489
|
+
*/
|
|
490
|
+
export interface CLISearchResponse {
|
|
491
|
+
/**
|
|
492
|
+
* The search results to render in the Workspace component.
|
|
493
|
+
*/
|
|
494
|
+
results: CLISearchResult<Action>[];
|
|
495
|
+
/**
|
|
496
|
+
* Additional custom context to pass back to the Workspace component.
|
|
497
|
+
*/
|
|
498
|
+
context?: any;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* An object resolved from 'onUserInput' function containing search results and optional filters.
|
|
502
|
+
*/
|
|
503
|
+
export interface HomeSearchResponse extends CLISearchResponse {
|
|
504
|
+
/**
|
|
505
|
+
* The search results to render in the Home UI.
|
|
506
|
+
*/
|
|
507
|
+
results: HomeSearchResult[];
|
|
508
|
+
/**
|
|
509
|
+
* Filters to render in the Home UI.
|
|
510
|
+
*/
|
|
511
|
+
context?: {
|
|
512
|
+
filters?: CLIFilter[];
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* A rendered search result that has been actioned by a user.
|
|
517
|
+
*/
|
|
518
|
+
export declare type CLIDispatchedSearchResult = DispatchedSearchResult;
|
|
519
|
+
/**
|
|
520
|
+
* A CLI provider responds to search requests from Workspace components.
|
|
521
|
+
* Upon receiving a search request, a CLI provider can return search results that can be rendered and interacted with
|
|
522
|
+
* by a user by the requesting Workspace component.
|
|
523
|
+
*/
|
|
524
|
+
export interface CLIProvider extends SearchProvider {
|
|
525
|
+
/**
|
|
526
|
+
* Function that is called when a search request is triggered due to user input.
|
|
527
|
+
* @param req describes search request.
|
|
528
|
+
* @param res can be used to stream search results back to the requesting Workspace component.
|
|
529
|
+
* @returns an object that contains the search results to render in the requesting Workspace component.
|
|
530
|
+
*/
|
|
531
|
+
onUserInput(req: CLISearchListenerRequest, res: CLISearchListenerResponse): Promise<CLISearchResponse>;
|
|
532
|
+
/**
|
|
533
|
+
* Callback that is invoked when ever a search result returned by this provider
|
|
534
|
+
* is interacted with from a Workspace component. (clicked, pressed enter, hotkey pressed, etc.)
|
|
535
|
+
* @param result the search result with the action that was selected by the user.
|
|
536
|
+
*/
|
|
537
|
+
onResultDispatch?(result: CLIDispatchedSearchResult): Promise<void>;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* A CLI provider responds to search requests from Home UI.
|
|
541
|
+
* Exposes search features that are specifically supported by Home.
|
|
542
|
+
*/
|
|
543
|
+
export interface HomeProvider extends CLIProvider {
|
|
544
|
+
onUserInput(req: HomeSearchListenerRequest, res: HomeSearchListenerResponse): Promise<HomeSearchResponse>;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Interface that contains functions for integrating with Home.
|
|
548
|
+
*/
|
|
549
|
+
export interface HomeAPI {
|
|
550
|
+
/**
|
|
551
|
+
* Register a provider that can return search results to Home.
|
|
552
|
+
*
|
|
553
|
+
* ```ts
|
|
554
|
+
* import { Home, CLIProvider } from "@openfin/workspace";
|
|
555
|
+
*
|
|
556
|
+
* import { fetchMySearchResults } from "./my-fetch-implementation";
|
|
557
|
+
*
|
|
558
|
+
* const myCLIProvider: CLIProvider = {
|
|
559
|
+
* name: "my-cli-provider",
|
|
560
|
+
* title: "My CLI Provider",
|
|
561
|
+
* icon: "https://google.com/favicon.ico",
|
|
562
|
+
* onUserInput: (req) => fetchMySearchResults(req.query)
|
|
563
|
+
* };
|
|
564
|
+
*
|
|
565
|
+
* Home.register(myCLIProvider);
|
|
566
|
+
* ```
|
|
567
|
+
*
|
|
568
|
+
* @param provider the provider implementation.
|
|
569
|
+
*/
|
|
570
|
+
register(provider: HomeProvider | CLIProvider): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* Deregister a provider.
|
|
573
|
+
* @param providerId the name of the provider.
|
|
574
|
+
*/
|
|
575
|
+
deregister(providerId: string): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Show the Home UI.
|
|
578
|
+
*/
|
|
579
|
+
show(): Promise<void>;
|
|
580
|
+
/**
|
|
581
|
+
* Hide the Home UI.
|
|
582
|
+
*/
|
|
583
|
+
hide(): Promise<void>;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Interface that contains functions that aid in recovering legacy features of Workspace.
|
|
587
|
+
*/
|
|
588
|
+
export interface LegacyAPI {
|
|
589
|
+
/**
|
|
590
|
+
* Get the pages that a user had saved in a legacy version of Workspace. (pre 5.0.0)
|
|
591
|
+
*/
|
|
592
|
+
getPages(): Promise<Page[]>;
|
|
593
|
+
/**
|
|
594
|
+
* Get the workspaces that a user had saved in a legacy version of Workspace. (pre 5.0.0)
|
|
595
|
+
*/
|
|
596
|
+
getWorkspaces(): Promise<Workspace[]>;
|
|
597
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LaunchAppRequest } from '../shapes';
|
|
2
|
+
/**
|
|
3
|
+
* Launch the app described by an App Directory entry.
|
|
4
|
+
* @param app the app directory entry.
|
|
5
|
+
* @param opts launch options.
|
|
6
|
+
*/
|
|
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>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
|
|
3
|
+
export declare const getBrowserModule: (identity: OpenFin.Identity) => {
|
|
4
|
+
identity: OpenFin.Identity;
|
|
5
|
+
openfinWindow: import("openfin-adapter").Window;
|
|
6
|
+
getPages: () => Promise<AttachedPage[]>;
|
|
7
|
+
getPage: (pageId: string) => Promise<AttachedPage>;
|
|
8
|
+
addPage: (page: PageWithUpdatableRuntimeAttribs) => Promise<void>;
|
|
9
|
+
removePage: (id: Page['pageId']) => Promise<void>;
|
|
10
|
+
setActivePage: (id: Page['pageId']) => Promise<void>;
|
|
11
|
+
updatePage: (req: any) => Promise<any>;
|
|
12
|
+
reorderPages: (req: any) => Promise<any>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import type { AttachedPage, Page } from '../../../../common/src/api/pages/shapes';
|
|
3
|
+
import type { BrowserCreateWindowRequest, BrowserWindowModule } from '../../shapes';
|
|
4
|
+
export declare const getBrowserApi: (identity: OpenFin.ApplicationIdentity) => {
|
|
5
|
+
wrapSync: (windowIdentity: OpenFin.Identity) => {
|
|
6
|
+
identity: OpenFin.Identity;
|
|
7
|
+
openfinWindow: import("openfin-adapter").Window;
|
|
8
|
+
getPages: () => Promise<AttachedPage[]>;
|
|
9
|
+
getPage: (pageId: string) => Promise<AttachedPage>;
|
|
10
|
+
addPage: (page: import("@common/api/pages/shapes").PageWithUpdatableRuntimeAttribs) => Promise<void>;
|
|
11
|
+
removePage: (id: string) => Promise<void>;
|
|
12
|
+
setActivePage: (id: string) => Promise<void>;
|
|
13
|
+
updatePage: (req: any) => Promise<any>;
|
|
14
|
+
reorderPages: (req: any) => Promise<any>;
|
|
15
|
+
};
|
|
16
|
+
createWindow: (options: BrowserCreateWindowRequest) => Promise<BrowserWindowModule>;
|
|
17
|
+
getAllAttachedPages: () => Promise<AttachedPage[]>;
|
|
18
|
+
getAllWindows: () => Promise<BrowserWindowModule[]>;
|
|
19
|
+
launchPage: (page: Page) => Promise<BrowserWindowModule>;
|
|
20
|
+
getUniquePageTitle: (title?: string) => Promise<any>;
|
|
21
|
+
getLastFocusedWindow: () => Promise<any>;
|
|
22
|
+
};
|