@openfin/workspace-platform 6.2.2 → 6.3.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/client-api/src/shapes/common.d.ts +5 -0
- package/client-api/src/shapes/home.d.ts +415 -0
- package/client-api/src/shapes/index.d.ts +7 -0
- package/client-api/src/shapes/store.d.ts +467 -0
- package/client-api/src/{templates.d.ts → shapes/templates.d.ts} +0 -0
- package/client-api-platform/src/api/app-directory.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/client-api/src/shapes.d.ts +0 -883
|
@@ -1,883 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Use relative paths here rather than aliases which mess
|
|
3
|
-
* up the packaged typing files. When writing code examples,
|
|
4
|
-
* for documentation, please use async/await syntax over .then()!
|
|
5
|
-
*/
|
|
6
|
-
import type { Page } from '../../common/src/api/pages/shapes';
|
|
7
|
-
import type { Workspace } from '../../common/src/api/workspaces';
|
|
8
|
-
import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src/index';
|
|
9
|
-
import { CustomTemplate, ListPairs } from './templates';
|
|
10
|
-
export * from './templates';
|
|
11
|
-
export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src/index';
|
|
12
|
-
export type { Workspace } from '../../common/src/api/workspaces';
|
|
13
|
-
export type { LayoutExtended, LayoutContentExtended, LayoutSettingsExtended, LayoutContentItemExtended, LayoutComponentExtended, LayoutComponentStateExtended, LayoutStack } from '../../common/src/utils/layout';
|
|
14
|
-
export type { Page, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
|
|
15
|
-
export { SearchTagBackground } from '../../search-api/src/shapes';
|
|
16
|
-
/**
|
|
17
|
-
* Describes the type of the app directory entry `manifest` attributes.
|
|
18
|
-
* Launch mechanics are determined by the manifest type.
|
|
19
|
-
*/
|
|
20
|
-
export declare enum AppManifestType {
|
|
21
|
-
/**
|
|
22
|
-
* A snapshot manifest.
|
|
23
|
-
*/
|
|
24
|
-
Snapshot = "snapshot",
|
|
25
|
-
/**
|
|
26
|
-
* A classic OpenFin app manifest.
|
|
27
|
-
*/
|
|
28
|
-
Manifest = "manifest",
|
|
29
|
-
/**
|
|
30
|
-
* A view manifest.
|
|
31
|
-
*/
|
|
32
|
-
View = "view",
|
|
33
|
-
/**
|
|
34
|
-
* A manifest for an external application.
|
|
35
|
-
*/
|
|
36
|
-
External = "external"
|
|
37
|
-
}
|
|
38
|
-
export interface AppIntent {
|
|
39
|
-
name: string;
|
|
40
|
-
displayName: string;
|
|
41
|
-
contexts: string[];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Detailed metadata describing an image.
|
|
45
|
-
*/
|
|
46
|
-
export interface Image {
|
|
47
|
-
src: string;
|
|
48
|
-
type?: string;
|
|
49
|
-
size?: string;
|
|
50
|
-
purpose?: string;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Detailed metadata describing an application.
|
|
54
|
-
*/
|
|
55
|
-
export interface App {
|
|
56
|
-
/**
|
|
57
|
-
* Unique identifier for an application.
|
|
58
|
-
*/
|
|
59
|
-
appId: string;
|
|
60
|
-
/**
|
|
61
|
-
* A UI friendly title for the application.
|
|
62
|
-
*/
|
|
63
|
-
title: string;
|
|
64
|
-
/**
|
|
65
|
-
* URL to application manifest.
|
|
66
|
-
*/
|
|
67
|
-
manifest: string;
|
|
68
|
-
/**
|
|
69
|
-
* UI friendly description for an application.
|
|
70
|
-
*/
|
|
71
|
-
description?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Describes the type of manifest resolved by the `manifest` field.
|
|
74
|
-
* Launch mechanics are determined by the manifest type.
|
|
75
|
-
*/
|
|
76
|
-
manifestType: AppManifestType | string;
|
|
77
|
-
/**
|
|
78
|
-
* A list of icons that can be rendered in UI for this application.
|
|
79
|
-
*/
|
|
80
|
-
icons: Image[];
|
|
81
|
-
/**
|
|
82
|
-
* A list of optional images that highlight application functionality.
|
|
83
|
-
*/
|
|
84
|
-
images?: Image[];
|
|
85
|
-
intents?: AppIntent[];
|
|
86
|
-
tags?: string[];
|
|
87
|
-
version?: string;
|
|
88
|
-
publisher: string;
|
|
89
|
-
contactEmail?: string;
|
|
90
|
-
supportEmail?: string;
|
|
91
|
-
}
|
|
92
|
-
export declare enum StorefrontTemplate {
|
|
93
|
-
LandingPage = "landingPage",
|
|
94
|
-
AppGrid = "appGrid"
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Represents a link to be rendered inside Storefront.
|
|
98
|
-
*/
|
|
99
|
-
export interface StorefrontLink {
|
|
100
|
-
/**
|
|
101
|
-
* A UI friendly title to render the link as.
|
|
102
|
-
*/
|
|
103
|
-
title: string;
|
|
104
|
-
/**
|
|
105
|
-
* When the rendered `title` text is clicked, the user will be navigated to this URL.
|
|
106
|
-
*/
|
|
107
|
-
url: string;
|
|
108
|
-
}
|
|
109
|
-
export interface StorefrontFooter {
|
|
110
|
-
/**
|
|
111
|
-
* A logo to be displayed on the Storefront's footer.
|
|
112
|
-
*/
|
|
113
|
-
logo: Image;
|
|
114
|
-
/**
|
|
115
|
-
* A set of links to display on Storefront's footer.
|
|
116
|
-
*/
|
|
117
|
-
links: [StorefrontLink?, StorefrontLink?, StorefrontLink?];
|
|
118
|
-
text: string;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Render a navigation section on the left panel of Storefront.
|
|
122
|
-
*/
|
|
123
|
-
export interface StorefrontNavigationSection {
|
|
124
|
-
/**
|
|
125
|
-
* Unique identifier for the navigation section.
|
|
126
|
-
*/
|
|
127
|
-
id: string;
|
|
128
|
-
/**
|
|
129
|
-
* The UI friendly title of the navigation section.
|
|
130
|
-
*/
|
|
131
|
-
title: string;
|
|
132
|
-
/**
|
|
133
|
-
* Navigation items to render under this section.
|
|
134
|
-
* 1-5 Navigation Items are supported.
|
|
135
|
-
*/
|
|
136
|
-
items: [
|
|
137
|
-
StorefrontNavigationItem,
|
|
138
|
-
StorefrontNavigationItem?,
|
|
139
|
-
StorefrontNavigationItem?,
|
|
140
|
-
StorefrontNavigationItem?,
|
|
141
|
-
StorefrontNavigationItem?
|
|
142
|
-
];
|
|
143
|
-
}
|
|
144
|
-
export interface StorefrontLandingPage {
|
|
145
|
-
hero?: {
|
|
146
|
-
title: string;
|
|
147
|
-
description: string;
|
|
148
|
-
cta: StorefrontNavigationItem;
|
|
149
|
-
image: Image;
|
|
150
|
-
};
|
|
151
|
-
topRow: {
|
|
152
|
-
title: string;
|
|
153
|
-
items: [
|
|
154
|
-
StorefrontDetailedNavigationItem?,
|
|
155
|
-
StorefrontDetailedNavigationItem?,
|
|
156
|
-
StorefrontDetailedNavigationItem?,
|
|
157
|
-
StorefrontDetailedNavigationItem?
|
|
158
|
-
];
|
|
159
|
-
};
|
|
160
|
-
middleRow: {
|
|
161
|
-
title: string;
|
|
162
|
-
apps: [App?, App?, App?, App?, App?, App?];
|
|
163
|
-
};
|
|
164
|
-
bottomRow: {
|
|
165
|
-
title: string;
|
|
166
|
-
items: [
|
|
167
|
-
StorefrontDetailedNavigationItem?,
|
|
168
|
-
StorefrontDetailedNavigationItem?,
|
|
169
|
-
StorefrontDetailedNavigationItem?
|
|
170
|
-
];
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Render a grid of applications in Storefront.
|
|
175
|
-
*/
|
|
176
|
-
export interface StorefrontAppGrid {
|
|
177
|
-
/**
|
|
178
|
-
* The apps to render in the grid.
|
|
179
|
-
*/
|
|
180
|
-
apps: App[];
|
|
181
|
-
}
|
|
182
|
-
export interface StorefrontNavigationItemBase {
|
|
183
|
-
/**
|
|
184
|
-
* An ID for referencing the navigation item. Must be unique.
|
|
185
|
-
*/
|
|
186
|
-
id: string;
|
|
187
|
-
/**
|
|
188
|
-
* UI friendly name for the navigation item.
|
|
189
|
-
*/
|
|
190
|
-
title: string;
|
|
191
|
-
}
|
|
192
|
-
export interface StorefrontNavigationItemDetails {
|
|
193
|
-
description: string;
|
|
194
|
-
image: Image;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Template for rendering a navigation item that renders a app grid when clicked.
|
|
198
|
-
*/
|
|
199
|
-
export interface StorefrontNavigationItemAppGrid extends StorefrontNavigationItemBase {
|
|
200
|
-
templateId: StorefrontTemplate.AppGrid;
|
|
201
|
-
/**
|
|
202
|
-
* Render an app grid when navigation item is pressed.
|
|
203
|
-
*/
|
|
204
|
-
templateData: StorefrontAppGrid;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Template for rendering a navigation item that renders another landing page when clicked.
|
|
208
|
-
*/
|
|
209
|
-
export interface StorefrontNavigationItemLandingPage extends StorefrontNavigationItemBase {
|
|
210
|
-
templateId: StorefrontTemplate.LandingPage;
|
|
211
|
-
/**
|
|
212
|
-
* Render a landing page when navigation item is pressed.
|
|
213
|
-
*/
|
|
214
|
-
templateData: StorefrontLandingPage;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Render an item in the navigation bar of Storefront.
|
|
218
|
-
*/
|
|
219
|
-
export declare type StorefrontNavigationItem = StorefrontNavigationItemAppGrid | StorefrontNavigationItemLandingPage;
|
|
220
|
-
/**
|
|
221
|
-
* Render an item in the navigation bar of Storefront with a description and image.
|
|
222
|
-
*/
|
|
223
|
-
export declare type StorefrontDetailedNavigationItem = StorefrontNavigationItem & StorefrontNavigationItemDetails;
|
|
224
|
-
export interface StorefrontProviderInfo {
|
|
225
|
-
/**
|
|
226
|
-
* Unique identifier for the Storefront provider.
|
|
227
|
-
*/
|
|
228
|
-
id: string;
|
|
229
|
-
/**
|
|
230
|
-
* A UI friendly title for the platform Storefront.
|
|
231
|
-
* This will be used in the Storefront selection dropdown.
|
|
232
|
-
*/
|
|
233
|
-
title: string;
|
|
234
|
-
/**
|
|
235
|
-
* Icon for storefront provider.
|
|
236
|
-
* Visible next to title in storefront provider selector UI
|
|
237
|
-
*/
|
|
238
|
-
icon: string;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Describes a Storefront provided by a platform.
|
|
242
|
-
* A platform must provide an object that satisfies this interface in order to register with the Storefront.
|
|
243
|
-
*/
|
|
244
|
-
export interface StorefrontProvider extends StorefrontProviderInfo {
|
|
245
|
-
/**
|
|
246
|
-
* Get a list of apps to populate the platform's Storefront with.
|
|
247
|
-
*
|
|
248
|
-
* ```ts
|
|
249
|
-
*
|
|
250
|
-
* const app : App = {
|
|
251
|
-
* appId: 'uid'
|
|
252
|
-
* title: 'My App'
|
|
253
|
-
* manifest: `https://openfin-iex.experolabs.com/openfin/manifests/cash-flow.json`,
|
|
254
|
-
* icons: [
|
|
255
|
-
* {
|
|
256
|
-
* src: '/icon.png'
|
|
257
|
-
* }
|
|
258
|
-
* ],
|
|
259
|
-
* contactEmail: contact@email.com,
|
|
260
|
-
* supportEmail: support@email.com,
|
|
261
|
-
* publisher: 'My Publisher',
|
|
262
|
-
* tags: [],
|
|
263
|
-
* images: [],
|
|
264
|
-
* intents: []
|
|
265
|
-
* }
|
|
266
|
-
*
|
|
267
|
-
* const getApps = async (): Promise<App[]> => {
|
|
268
|
-
* return [app];
|
|
269
|
-
* }
|
|
270
|
-
* ```
|
|
271
|
-
*/
|
|
272
|
-
getApps(): Promise<App[]>;
|
|
273
|
-
/**
|
|
274
|
-
* Get the main landing page for the platform's Storefront.
|
|
275
|
-
*
|
|
276
|
-
* ```ts
|
|
277
|
-
*
|
|
278
|
-
* const landingPage : StorefrontLandingPage = {
|
|
279
|
-
* hero: {
|
|
280
|
-
* title: 'My Landing Page',
|
|
281
|
-
* description: 'description',
|
|
282
|
-
* cta: navigationItems[0],
|
|
283
|
-
* image: {
|
|
284
|
-
* src: './images/image.png'
|
|
285
|
-
* }
|
|
286
|
-
* },
|
|
287
|
-
* topRow: {
|
|
288
|
-
* title: 'Top Row Title',
|
|
289
|
-
* items: //array of StorefrontNavigationItem
|
|
290
|
-
* },
|
|
291
|
-
* middleRow: {
|
|
292
|
-
* title: 'Middle Row Title',
|
|
293
|
-
* apps: //array of apps
|
|
294
|
-
* },
|
|
295
|
-
* bottomRow: {
|
|
296
|
-
* title: 'Bottom Row Title',
|
|
297
|
-
* items: //array of StorefrontNavigationItem
|
|
298
|
-
* }
|
|
299
|
-
* }
|
|
300
|
-
*
|
|
301
|
-
* const getLandingPage = async (): Promise<StorefrontLandingPage> => {
|
|
302
|
-
* return landingPage;
|
|
303
|
-
* }
|
|
304
|
-
*```
|
|
305
|
-
*/
|
|
306
|
-
getLandingPage(): Promise<StorefrontLandingPage>;
|
|
307
|
-
/**
|
|
308
|
-
* Get the Storefront navigation sections for the left nav bar.
|
|
309
|
-
* ```ts
|
|
310
|
-
* const navigationSections: [StorefrontNavigationSection, StorefrontNavigationSection] = [
|
|
311
|
-
* {
|
|
312
|
-
* id: 'first id',
|
|
313
|
-
* title: 'title',
|
|
314
|
-
* items: //array of navigation items
|
|
315
|
-
* },
|
|
316
|
-
* {
|
|
317
|
-
* id: 'second id'
|
|
318
|
-
* title: 'title',
|
|
319
|
-
* items: //array of navigation items
|
|
320
|
-
* }
|
|
321
|
-
* ]
|
|
322
|
-
*
|
|
323
|
-
* const getNavigation = async (): Promise<[StorefrontNavigationSection, StorefrontNavigationSection]> => {
|
|
324
|
-
* return navigationSections;
|
|
325
|
-
* }
|
|
326
|
-
*```
|
|
327
|
-
*/
|
|
328
|
-
getNavigation(): Promise<[StorefrontNavigationSection?, StorefrontNavigationSection?]>;
|
|
329
|
-
/**
|
|
330
|
-
* Get the footer for the platform's Storefront.
|
|
331
|
-
*
|
|
332
|
-
* ```ts
|
|
333
|
-
* const footer: StorefrontFooter = {
|
|
334
|
-
* logo: { src: './images/image', size: '32' },
|
|
335
|
-
* text: 'footer text',
|
|
336
|
-
* links: [
|
|
337
|
-
* { title:'title', url: 'https://openfin.co' },
|
|
338
|
-
* { title: 'title', url: 'https://openfin.co'}
|
|
339
|
-
* ]
|
|
340
|
-
* }
|
|
341
|
-
*
|
|
342
|
-
* const getFooter = async (): Promise<StorefrontFooter> => {
|
|
343
|
-
* return footer;
|
|
344
|
-
* }
|
|
345
|
-
* ```
|
|
346
|
-
*/
|
|
347
|
-
getFooter(): Promise<StorefrontFooter>;
|
|
348
|
-
/**
|
|
349
|
-
* Launch an app provided by the platform's Storefront.
|
|
350
|
-
*
|
|
351
|
-
* ```ts
|
|
352
|
-
* import { getStorefrontProvider } from "./my-provider";
|
|
353
|
-
*
|
|
354
|
-
* //Grab your provider
|
|
355
|
-
* const myStoreFrontProvider: StorefrontProvider = getStorefrontProvider();
|
|
356
|
-
*
|
|
357
|
-
* const app : App = {
|
|
358
|
-
* appId: 'uid'
|
|
359
|
-
* title: 'My App'
|
|
360
|
-
* manifest: `https://openfin-iex.experolabs.com/openfin/manifests/cash-flow.json`,
|
|
361
|
-
* icons: [
|
|
362
|
-
* {
|
|
363
|
-
* src: './image.png'
|
|
364
|
-
* }
|
|
365
|
-
* ],
|
|
366
|
-
* contactEmail: contact@email.com,
|
|
367
|
-
* supportEmail: support@email.com,
|
|
368
|
-
* publisher: 'My Publisher',
|
|
369
|
-
* tags: [],
|
|
370
|
-
* images: [],
|
|
371
|
-
* intents: []
|
|
372
|
-
* }
|
|
373
|
-
*
|
|
374
|
-
* const launch = async () => {
|
|
375
|
-
* await myStorefrontProvider.launchApp(app);
|
|
376
|
-
* }
|
|
377
|
-
* ```
|
|
378
|
-
* @param app the app to launch.
|
|
379
|
-
*/
|
|
380
|
-
launchApp(app: App): Promise<void>;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Interface that contains functions for integrating with Storefront.
|
|
384
|
-
*/
|
|
385
|
-
export interface StorefrontAPI {
|
|
386
|
-
/**
|
|
387
|
-
* Registers a [[`StorefrontProvider`]]. Upon registering a provider,
|
|
388
|
-
* the title of your provider appears in the menu of the Storefront UI.
|
|
389
|
-
* When a user selects your Storefront, the methods on the provider
|
|
390
|
-
* object are called to populate the UI. Throws an error if a provider with
|
|
391
|
-
* the same `id` already exists.
|
|
392
|
-
*
|
|
393
|
-
* ```ts
|
|
394
|
-
* import { Storefront, StorefrontProvider } from "@openfin/workspace";
|
|
395
|
-
*
|
|
396
|
-
* //Declare a provider
|
|
397
|
-
* const myStorefrontProvider: StorefrontProvider = {
|
|
398
|
-
* id: "my-storefront-id"
|
|
399
|
-
* title: "My StorefrontProvider"
|
|
400
|
-
* icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
401
|
-
* getApps: () => {...},
|
|
402
|
-
* getNavigation: () => {...},
|
|
403
|
-
* getLandingPage: () => {...},
|
|
404
|
-
* getFooter: () => {...},
|
|
405
|
-
* launchApp: () => {...}
|
|
406
|
-
* };
|
|
407
|
-
*
|
|
408
|
-
* const registerProvider = async () => {
|
|
409
|
-
* await Storefront.register(myStorefrontProvider);
|
|
410
|
-
* }
|
|
411
|
-
* ```
|
|
412
|
-
* @param provider the implementation of a Storefront provider.
|
|
413
|
-
|
|
414
|
-
*/
|
|
415
|
-
register(provider: StorefrontProvider): Promise<void>;
|
|
416
|
-
/**
|
|
417
|
-
* Deregister a provider.
|
|
418
|
-
*
|
|
419
|
-
* ```ts
|
|
420
|
-
* import { Storefront, StorefrontProvider } from "@openfin/workspace";
|
|
421
|
-
*
|
|
422
|
-
* //Instantiate a StorefrontProvider
|
|
423
|
-
* const myStorefrontProvider: StorefrontProvider = {
|
|
424
|
-
* id: "my-storefront-id"
|
|
425
|
-
* title: "My StoreFrontProvider"
|
|
426
|
-
* icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
427
|
-
* getApps: () => {...},
|
|
428
|
-
* getNavigation: () => {...},
|
|
429
|
-
* getLandingPage: () => {...},
|
|
430
|
-
* getFooter: () => {...},
|
|
431
|
-
* launchApp: () => {...}
|
|
432
|
-
* };
|
|
433
|
-
*
|
|
434
|
-
* const register = async () => {
|
|
435
|
-
* await Storefront.register(myStorefrontProvider);
|
|
436
|
-
* }
|
|
437
|
-
*
|
|
438
|
-
* //Do work with myStorefrontProvider
|
|
439
|
-
*
|
|
440
|
-
* const deregister = async () => {
|
|
441
|
-
* await Storefront.deregister("my-storefront-id");
|
|
442
|
-
* }
|
|
443
|
-
* ```
|
|
444
|
-
* @param id the id of the provider.
|
|
445
|
-
*/
|
|
446
|
-
deregister(id: string): Promise<void>;
|
|
447
|
-
/**
|
|
448
|
-
* Shows the Storefront window. Awaits for the latest [[`Storefront.register()`]]
|
|
449
|
-
* internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
|
|
450
|
-
* doesn't exist (i.e., because `register()` not called previously).
|
|
451
|
-
*
|
|
452
|
-
* ```ts
|
|
453
|
-
* import { Storefront } from "@openfin/workspace";
|
|
454
|
-
*
|
|
455
|
-
* const show = async () => {
|
|
456
|
-
* await Storefront.show();
|
|
457
|
-
* //Do thing after show
|
|
458
|
-
* }
|
|
459
|
-
* ```
|
|
460
|
-
*/
|
|
461
|
-
show(): Promise<void>;
|
|
462
|
-
/**
|
|
463
|
-
* Hides the Storefront window. Awaits for the latest [[`Storefront.register()`]]
|
|
464
|
-
* internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
|
|
465
|
-
* doesn't exist (i.e., because `register()` was not called previously).
|
|
466
|
-
*
|
|
467
|
-
* ```ts
|
|
468
|
-
* import { Storefront } from "@openfin/workspace";
|
|
469
|
-
*
|
|
470
|
-
* const hide = async () => {
|
|
471
|
-
* await Storefront.hidef();
|
|
472
|
-
* //Do thing after show
|
|
473
|
-
* }
|
|
474
|
-
* ```
|
|
475
|
-
*/
|
|
476
|
-
hide(): Promise<void>;
|
|
477
|
-
}
|
|
478
|
-
export declare type CLISearchListenerRequest = SearchListenerRequest;
|
|
479
|
-
/**
|
|
480
|
-
* Representation of a search request from a specific invocation of a {@link HomeProvider | HomeProvider's} `onUserInput` listener function.
|
|
481
|
-
*/
|
|
482
|
-
export interface HomeSearchListenerRequest extends CLISearchListenerRequest {
|
|
483
|
-
context: {
|
|
484
|
-
/**
|
|
485
|
-
* Denotes that this Home search request was triggered via
|
|
486
|
-
* the user selecting a suggestion from this provider.
|
|
487
|
-
*/
|
|
488
|
-
isSuggestion: boolean;
|
|
489
|
-
/**
|
|
490
|
-
* Denotes that this search request should return search results
|
|
491
|
-
* that represent content that a user has saved. (Workspaces, Pages)
|
|
492
|
-
*/
|
|
493
|
-
isSaved: boolean;
|
|
494
|
-
/**
|
|
495
|
-
* Denotes that this search request should return search results
|
|
496
|
-
* that represents content that is stored in the platform.
|
|
497
|
-
* This should exclude content that the user has saved.
|
|
498
|
-
* (Workspaces, Pages, Views, Apps)
|
|
499
|
-
*/
|
|
500
|
-
isStore: boolean;
|
|
501
|
-
/**
|
|
502
|
-
* Denotes that this search request should return search results
|
|
503
|
-
* that represent other Home search providers. If the user chooses to
|
|
504
|
-
* launch one of these apps, they should register a Home provider.
|
|
505
|
-
*/
|
|
506
|
-
isSearchEngines: boolean;
|
|
507
|
-
/**
|
|
508
|
-
* any user-selected filters will be populated here
|
|
509
|
-
* e.g [{
|
|
510
|
-
* title: 'Currency Pairs',
|
|
511
|
-
* type: FilterOptionType.MultiSelect,
|
|
512
|
-
* options: [{ value: 'GBPUSD', isSelected: true}]
|
|
513
|
-
* }]
|
|
514
|
-
*/
|
|
515
|
-
selectedFilters?: CLIFilter[];
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
export declare type CLISearchListenerResponse = SearchListenerResponse;
|
|
519
|
-
/**
|
|
520
|
-
* Representation of a search response from a specific invocation of a {@link HomeProvider | HomeProvider's} `onUserInput` listener function.
|
|
521
|
-
* Can optionally be used to push search results to the Home UI.
|
|
522
|
-
*
|
|
523
|
-
* ```ts
|
|
524
|
-
* function onUserInput(req: HomeSearchListenerRequest, res: HomeSearchListenerResponse) {
|
|
525
|
-
* searchListenerResponse.open();
|
|
526
|
-
*
|
|
527
|
-
* const myLongRunningQuery = makeMyLongRunningQuery(searchListenerRequest.query);
|
|
528
|
-
* myLongRunningQuery.onNewResults(myNewResults => {
|
|
529
|
-
* searchListenerResponse.respond(myNewResults);
|
|
530
|
-
* });
|
|
531
|
-
*
|
|
532
|
-
* searchListenerRequest.onClose(() => {
|
|
533
|
-
* myLongRunningQuery.close();
|
|
534
|
-
* });
|
|
535
|
-
* }
|
|
536
|
-
* ```
|
|
537
|
-
*/
|
|
538
|
-
export declare type HomeSearchListenerResponse = Omit<CLISearchListenerResponse, 'respond'> & {
|
|
539
|
-
respond(results: HomeSearchResult[]): void;
|
|
540
|
-
};
|
|
541
|
-
/**
|
|
542
|
-
* Enumerator for different types of actions that are built into the Home API.
|
|
543
|
-
*/
|
|
544
|
-
export declare enum CLIAction {
|
|
545
|
-
Suggestion = "suggestion"
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* An action that is built into Home.
|
|
549
|
-
*/
|
|
550
|
-
export interface CLIBuiltInAction<T extends CLIAction> extends Action {
|
|
551
|
-
name: T;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Built in action for suggesting another search to execute to the user.
|
|
555
|
-
*/
|
|
556
|
-
export interface CLISuggestion extends CLIBuiltInAction<CLIAction.Suggestion> {
|
|
557
|
-
/**
|
|
558
|
-
* The query to search for if this action is selected.
|
|
559
|
-
*/
|
|
560
|
-
query: string;
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* Union type that includes Home's built in search result actions.
|
|
564
|
-
*/
|
|
565
|
-
export declare type HomeAction = CLISuggestion | Action;
|
|
566
|
-
/**
|
|
567
|
-
* A search result that can be rendered by a Workspace component.
|
|
568
|
-
*/
|
|
569
|
-
export declare type CLISearchResult<A extends Action> = SearchResult<A>;
|
|
570
|
-
/**
|
|
571
|
-
* A list of template types that determine how a search result is rendered.
|
|
572
|
-
*/
|
|
573
|
-
export declare enum CLITemplate {
|
|
574
|
-
/**
|
|
575
|
-
* Contact Information Template
|
|
576
|
-
*/
|
|
577
|
-
Contact = "Contact",
|
|
578
|
-
/**
|
|
579
|
-
* Custom Template
|
|
580
|
-
*/
|
|
581
|
-
Custom = "Custom",
|
|
582
|
-
/**
|
|
583
|
-
* Definition List Template
|
|
584
|
-
*/
|
|
585
|
-
List = "List",
|
|
586
|
-
/**
|
|
587
|
-
* Non-Template search result.
|
|
588
|
-
*/
|
|
589
|
-
Plain = "Plain",
|
|
590
|
-
/**
|
|
591
|
-
* Simple Text Template
|
|
592
|
-
*/
|
|
593
|
-
SimpleText = "SimpleText"
|
|
594
|
-
}
|
|
595
|
-
/**
|
|
596
|
-
* {@link SearchResult | Search result} template definition
|
|
597
|
-
*/
|
|
598
|
-
export interface CLISearchResultWithTemplate<T extends keyof typeof CLITemplate, C, A extends Action> extends CLISearchResult<A> {
|
|
599
|
-
template: T;
|
|
600
|
-
templateContent: C;
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Contact Data.
|
|
604
|
-
*/
|
|
605
|
-
export interface ContactInfo {
|
|
606
|
-
/**
|
|
607
|
-
* Name of the contact.
|
|
608
|
-
*/
|
|
609
|
-
name: string;
|
|
610
|
-
/**
|
|
611
|
-
* Title of the contact.
|
|
612
|
-
*/
|
|
613
|
-
title?: string;
|
|
614
|
-
/**
|
|
615
|
-
* URL for the contact's profile photo.
|
|
616
|
-
*/
|
|
617
|
-
photoUrl?: string;
|
|
618
|
-
/**
|
|
619
|
-
* A flag to indicate that the contact card should display the contact's initials as profile photo if the photo url is undefined.
|
|
620
|
-
*/
|
|
621
|
-
useInitials?: boolean;
|
|
622
|
-
/**
|
|
623
|
-
* An array of detail list objects that can be used for logical grouping of contact details.
|
|
624
|
-
*/
|
|
625
|
-
details: ListPairs[];
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Contact Info Search Result
|
|
629
|
-
*/
|
|
630
|
-
export interface CLISearchResultContact<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Contact, ContactInfo, A> {
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* A Search Result that renders custom templates.
|
|
634
|
-
*/
|
|
635
|
-
export interface CLISearchResultCustom<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Custom, CustomTemplate, A> {
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Definition List Search Result
|
|
639
|
-
*/
|
|
640
|
-
export interface CLISearchResultList<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.List, ListPairs, A> {
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Non-Template Search Result
|
|
644
|
-
*/
|
|
645
|
-
export interface CLISearchResultPlain<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.Plain, undefined, A> {
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Simple Text Search Result
|
|
649
|
-
*/
|
|
650
|
-
export interface CLISearchResultSimpleText<A extends Action = Action> extends CLISearchResultWithTemplate<CLITemplate.SimpleText, string, A> {
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* A search result that can be rendered by Home UI.
|
|
654
|
-
*/
|
|
655
|
-
export declare type HomeSearchResult = CLISearchResultContact<HomeAction> | CLISearchResultSimpleText<HomeAction> | CLISearchResultList<HomeAction> | CLISearchResultPlain<HomeAction> | CLISearchResultCustom<HomeAction>;
|
|
656
|
-
export declare enum CLIFilterOptionType {
|
|
657
|
-
/**
|
|
658
|
-
* Display a multi-select drop down for the options
|
|
659
|
-
*/
|
|
660
|
-
MultiSelect = "MultiSelect"
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* An option object containing values to filter
|
|
664
|
-
*/
|
|
665
|
-
export interface CLIFilterOption {
|
|
666
|
-
value: string;
|
|
667
|
-
isSelected?: boolean;
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* A search filter that will be rendered by a Workspace component.
|
|
671
|
-
*/
|
|
672
|
-
export interface CLIFilter {
|
|
673
|
-
id: string;
|
|
674
|
-
title: string;
|
|
675
|
-
type?: CLIFilterOptionType;
|
|
676
|
-
options: CLIFilterOption[] | CLIFilterOption;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* An object returned from a CLI provider's 'onUserInput' function containing search results.
|
|
680
|
-
*/
|
|
681
|
-
export interface CLISearchResponse {
|
|
682
|
-
/**
|
|
683
|
-
* The search results to render in the Workspace component.
|
|
684
|
-
*/
|
|
685
|
-
results: CLISearchResult<Action>[];
|
|
686
|
-
/**
|
|
687
|
-
* Additional custom context to pass back to the Workspace component.
|
|
688
|
-
*/
|
|
689
|
-
context?: any;
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* An object resolved from 'onUserInput' function containing search results and optional filters.
|
|
693
|
-
*/
|
|
694
|
-
export interface HomeSearchResponse extends CLISearchResponse {
|
|
695
|
-
/**
|
|
696
|
-
* The search results to render in the Home UI.
|
|
697
|
-
*/
|
|
698
|
-
results: HomeSearchResult[];
|
|
699
|
-
/**
|
|
700
|
-
* Filters to render in the Home UI.
|
|
701
|
-
*/
|
|
702
|
-
context?: {
|
|
703
|
-
filters?: CLIFilter[];
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* A rendered search result that has been actioned by a user.
|
|
708
|
-
*/
|
|
709
|
-
export declare type CLIDispatchedSearchResult = DispatchedSearchResult;
|
|
710
|
-
/**
|
|
711
|
-
* A CLI provider responds to search requests from Workspace components.
|
|
712
|
-
* Upon receiving a search request, a CLI provider can return search results that can be rendered and interacted with
|
|
713
|
-
* by a user by the requesting Workspace component.
|
|
714
|
-
*/
|
|
715
|
-
export interface CLIProvider extends SearchProvider {
|
|
716
|
-
/**
|
|
717
|
-
* Function that is called when a search request is triggered due to user input.
|
|
718
|
-
*
|
|
719
|
-
* ```ts
|
|
720
|
-
*
|
|
721
|
-
* import { getAllData, getResultsByQuery } from './get-all-data';
|
|
722
|
-
*
|
|
723
|
-
* const onUserInput = async({ query }): Promise<CLISearchResponse> => {
|
|
724
|
-
* if (!query) {
|
|
725
|
-
* return getAllData();
|
|
726
|
-
* }
|
|
727
|
-
*
|
|
728
|
-
* // Provide an implmentation to fetch query-filtered search results
|
|
729
|
-
* return getResultsByQuery(query);
|
|
730
|
-
* }
|
|
731
|
-
* ```
|
|
732
|
-
* @param req describes search request.
|
|
733
|
-
* @param res can be used to stream search results back to the requesting Workspace component.
|
|
734
|
-
* @returns an object that contains the search results to render in the requesting Workspace component.
|
|
735
|
-
*/
|
|
736
|
-
onUserInput(req: CLISearchListenerRequest, res: CLISearchListenerResponse): Promise<CLISearchResponse>;
|
|
737
|
-
/**
|
|
738
|
-
* Callback that is invoked when ever a search result returned by this provider
|
|
739
|
-
* is interacted with from a Workspace component. (clicked, pressed enter, hotkey pressed, etc.)
|
|
740
|
-
*
|
|
741
|
-
*
|
|
742
|
-
* ```ts
|
|
743
|
-
* import { getAvailableCommands } from './my-commands';
|
|
744
|
-
*
|
|
745
|
-
* const onResultDispatch = async(result: CLIDispatchedSearchResult): Promise<void> => {
|
|
746
|
-
* try {
|
|
747
|
-
* //Grab the command corresponding to the result
|
|
748
|
-
* const availableCommands = await getAvailableCommands();
|
|
749
|
-
* const commandToExecute = availableCommands.find((command) => command.key === result.key);
|
|
750
|
-
*
|
|
751
|
-
* if (commantToExecute != undefined) {
|
|
752
|
-
* await commandToExecute.action();
|
|
753
|
-
* }
|
|
754
|
-
* } catch (err) {
|
|
755
|
-
* //Handle the error
|
|
756
|
-
* log.error('Error trying to action show command %s', err, result.key);
|
|
757
|
-
* }
|
|
758
|
-
* }
|
|
759
|
-
*```
|
|
760
|
-
* @param result the search result with the action that was selected by the user.
|
|
761
|
-
*/
|
|
762
|
-
onResultDispatch?(result: CLIDispatchedSearchResult): Promise<void>;
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* A CLI provider responds to search requests from Home UI.
|
|
766
|
-
* Exposes search features that are specifically supported by Home.
|
|
767
|
-
*/
|
|
768
|
-
export interface HomeProvider extends CLIProvider {
|
|
769
|
-
onUserInput(req: HomeSearchListenerRequest, res: HomeSearchListenerResponse): Promise<HomeSearchResponse>;
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
* Interface that contains functions for integrating with Home.
|
|
773
|
-
*/
|
|
774
|
-
export interface HomeAPI {
|
|
775
|
-
/**
|
|
776
|
-
* Register a provider that can return search results to Home.
|
|
777
|
-
*
|
|
778
|
-
* ```ts
|
|
779
|
-
* import { Home, CLIProvider } from "@openfin/workspace";
|
|
780
|
-
*
|
|
781
|
-
* import { fetchMySearchResults } from "./my-fetch-implementation";
|
|
782
|
-
*
|
|
783
|
-
* const myCLIProvider: CLIProvider = {
|
|
784
|
-
* name: "my-cli-provider",
|
|
785
|
-
* title: "My CLI Provider",
|
|
786
|
-
* icon: "https://google.com/favicon.ico",
|
|
787
|
-
* onUserInput: (req) => fetchMySearchResults(req.query)
|
|
788
|
-
* };
|
|
789
|
-
*
|
|
790
|
-
* const register = async () => {
|
|
791
|
-
* await Home.register(myCLIProvider);
|
|
792
|
-
* }
|
|
793
|
-
* ```
|
|
794
|
-
*
|
|
795
|
-
* @param provider the provider implementation.
|
|
796
|
-
*/
|
|
797
|
-
register(provider: HomeProvider | CLIProvider): Promise<void>;
|
|
798
|
-
/**
|
|
799
|
-
* Deregister a provider.
|
|
800
|
-
*
|
|
801
|
-
* ```ts
|
|
802
|
-
* import { Home , CLIProvider } from "@openfin/workspace";
|
|
803
|
-
*
|
|
804
|
-
* import { fetchMySearchResults } from "./my-fetch-implementation";
|
|
805
|
-
*
|
|
806
|
-
* const myCLIProvider: CLIProvider = {
|
|
807
|
-
* name: "my-cli-provider",
|
|
808
|
-
* title: "My CLI Provider",
|
|
809
|
-
* icon: "https://google.com/favicon.ico",
|
|
810
|
-
* onUserInput: (req) => fetchMySearchResults(req.query)
|
|
811
|
-
* };
|
|
812
|
-
*
|
|
813
|
-
* // Register and do some work with the provider
|
|
814
|
-
*
|
|
815
|
-
* const deregister = async () => {
|
|
816
|
-
* await Home.deregister("my-cli-provider");
|
|
817
|
-
* }
|
|
818
|
-
* ```
|
|
819
|
-
* @param providerId the name of the provider.
|
|
820
|
-
*/
|
|
821
|
-
deregister(providerId: string): Promise<void>;
|
|
822
|
-
/**
|
|
823
|
-
* Show the Home UI.
|
|
824
|
-
*
|
|
825
|
-
* ```ts
|
|
826
|
-
* import { Home } from './home'
|
|
827
|
-
*
|
|
828
|
-
* const show = async () => {
|
|
829
|
-
* await Home.show();
|
|
830
|
-
* // Do thing after show
|
|
831
|
-
* }
|
|
832
|
-
* ```
|
|
833
|
-
*/
|
|
834
|
-
show(): Promise<void>;
|
|
835
|
-
/**
|
|
836
|
-
* Hide the Home UI.
|
|
837
|
-
*
|
|
838
|
-
* ```ts
|
|
839
|
-
* import { Home } from './home'
|
|
840
|
-
*
|
|
841
|
-
* const hide = async () => {
|
|
842
|
-
* await Home.hide();
|
|
843
|
-
* // Do thing after hide
|
|
844
|
-
* }
|
|
845
|
-
* ```
|
|
846
|
-
*/
|
|
847
|
-
hide(): Promise<void>;
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Interface that contains functions that aid in recovering legacy features of Workspace.
|
|
851
|
-
*/
|
|
852
|
-
export interface LegacyAPI {
|
|
853
|
-
/**
|
|
854
|
-
* Get the pages that a user had saved in a legacy version of Workspace. (pre 5.0.0)
|
|
855
|
-
*
|
|
856
|
-
* ```ts
|
|
857
|
-
* import { Legacy } from "@openfin/workspace";
|
|
858
|
-
*
|
|
859
|
-
* async logPages() {
|
|
860
|
-
* const pages = await Legacy.getPages();
|
|
861
|
-
* console.log(pages);
|
|
862
|
-
* }
|
|
863
|
-
*
|
|
864
|
-
* logPages();
|
|
865
|
-
* ```
|
|
866
|
-
*/
|
|
867
|
-
getPages(): Promise<Page[]>;
|
|
868
|
-
/**
|
|
869
|
-
* Get the workspaces that a user had saved in a legacy version of Workspace. (pre 5.0.0)
|
|
870
|
-
*
|
|
871
|
-
* ```ts
|
|
872
|
-
* import { Legacy } from "@openfin/workspace";
|
|
873
|
-
*
|
|
874
|
-
* async logWorkspaces() {
|
|
875
|
-
* const workspaces = await Legacy.getWorkspaces();
|
|
876
|
-
* console.log(workspaces);
|
|
877
|
-
* }
|
|
878
|
-
*
|
|
879
|
-
* logWorkspaces();
|
|
880
|
-
* ```
|
|
881
|
-
*/
|
|
882
|
-
getWorkspaces(): Promise<Workspace[]>;
|
|
883
|
-
}
|