@openfin/workspace-platform 5.3.0 → 5.6.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 +31 -4
- package/client-api/src/shapes.d.ts +283 -6
- package/client-api-platform/src/api/app-directory.d.ts +2 -2
- package/client-api-platform/src/api/browser/browser-module.d.ts +4 -2
- package/client-api-platform/src/api/browser/index.d.ts +5 -4
- package/client-api-platform/src/api/context-menu/browser-logo-handler.d.ts +10 -0
- package/client-api-platform/src/api/context-menu/index.d.ts +6 -0
- package/client-api-platform/src/api/pages/helper.d.ts +1 -1
- package/client-api-platform/src/api/pages/index.d.ts +6 -6
- package/client-api-platform/src/api/protocol.d.ts +8 -5
- package/client-api-platform/src/api/storage.d.ts +1 -1
- package/client-api-platform/src/api/theming.d.ts +5 -0
- package/client-api-platform/src/api/workspace-module.d.ts +2 -2
- package/client-api-platform/src/index.d.ts +36 -1
- package/client-api-platform/src/init/custom-actions.d.ts +3 -0
- package/client-api-platform/src/init/override-callback.d.ts +3 -2
- package/client-api-platform/src/init/theming.d.ts +9 -0
- package/client-api-platform/src/init/utils.d.ts +8 -2
- package/client-api-platform/src/shapes.d.ts +667 -20
- package/common/src/api/browser-protocol.d.ts +14 -0
- package/common/src/api/pages/attached.d.ts +0 -1
- package/common/src/api/pages/idb.d.ts +2 -2
- package/common/src/api/pages/index.d.ts +7 -1
- package/common/src/api/pages/legacy.d.ts +2 -2
- package/common/src/api/pages/shapes.d.ts +9 -0
- package/common/src/api/protocol.d.ts +2 -1
- package/common/src/api/theming.d.ts +62 -0
- package/common/src/utils/context-menu.d.ts +12 -0
- package/common/src/utils/defer-auto-show.d.ts +18 -0
- package/common/src/utils/env.d.ts +6 -7
- package/common/src/utils/global-context-menu.d.ts +2 -0
- package/common/src/utils/landing-page.d.ts +11 -0
- package/common/src/utils/layout.d.ts +2 -1
- package/common/src/utils/merge-deep.d.ts +6 -0
- package/common/src/utils/strings.d.ts +0 -2
- package/common/src/utils/theming.d.ts +57 -0
- package/common/src/utils/window.d.ts +5 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/search-api/src/client/internal.d.ts +1 -1
- package/search-api/src/shapes.d.ts +45 -2
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
|
```
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Use relative paths here rather than aliases which mess
|
|
3
|
-
* up the packaged typing files
|
|
3
|
+
* up the packaged typing files. When writing code examples,
|
|
4
|
+
* for documentation, please use async/await syntax over .then()!
|
|
4
5
|
*/
|
|
5
6
|
import type { Page } from '../../common/src/api/pages/shapes';
|
|
6
7
|
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';
|
|
8
|
+
import type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProvider, SearchResult } from '../../search-api/src/index';
|
|
9
|
+
export type { Action, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../search-api/src/index';
|
|
9
10
|
export type { Workspace } from '../../common/src/api/workspaces';
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
11
|
+
export type { LayoutExtended, LayoutContentExtended, LayoutSettingsExtended, LayoutContentItemExtended, LayoutComponentExtended, LayoutComponentStateExtended, LayoutStack } from '../../common/src/utils/layout';
|
|
12
|
+
export type { Page, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
|
|
13
|
+
export { SearchTagBackground } from '../../search-api/src/shapes';
|
|
12
14
|
/**
|
|
13
15
|
* Describes the type of the app directory entry `manifest` attributes.
|
|
14
16
|
* Launch mechanics are determined by the manifest type.
|
|
@@ -240,22 +242,138 @@ export interface StorefrontProviderInfo {
|
|
|
240
242
|
export interface StorefrontProvider extends StorefrontProviderInfo {
|
|
241
243
|
/**
|
|
242
244
|
* Get a list of apps to populate the platform's Storefront with.
|
|
245
|
+
*
|
|
246
|
+
* ```ts
|
|
247
|
+
*
|
|
248
|
+
* const app : App = {
|
|
249
|
+
* appId: 'uid'
|
|
250
|
+
* title: 'My App'
|
|
251
|
+
* manifest: `https://openfin-iex.experolabs.com/openfin/manifests/cash-flow.json`,
|
|
252
|
+
* icons: [
|
|
253
|
+
* {
|
|
254
|
+
* src: '/icon.png'
|
|
255
|
+
* }
|
|
256
|
+
* ],
|
|
257
|
+
* contactEmail: contact@email.com,
|
|
258
|
+
* supportEmail: support@email.com,
|
|
259
|
+
* publisher: 'My Publisher',
|
|
260
|
+
* tags: [],
|
|
261
|
+
* images: [],
|
|
262
|
+
* intents: []
|
|
263
|
+
* }
|
|
264
|
+
*
|
|
265
|
+
* const getApps = async (): Promise<App[]> => {
|
|
266
|
+
* return [app];
|
|
267
|
+
* }
|
|
268
|
+
* ```
|
|
243
269
|
*/
|
|
244
270
|
getApps(): Promise<App[]>;
|
|
245
271
|
/**
|
|
246
272
|
* Get the main landing page for the platform's Storefront.
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
*
|
|
276
|
+
* const landingPage : StorefrontLandingPage = {
|
|
277
|
+
* hero: {
|
|
278
|
+
* title: 'My Landing Page',
|
|
279
|
+
* description: 'description',
|
|
280
|
+
* cta: navigationItems[0],
|
|
281
|
+
* image: {
|
|
282
|
+
* src: './images/image.png'
|
|
283
|
+
* }
|
|
284
|
+
* },
|
|
285
|
+
* topRow: {
|
|
286
|
+
* title: 'Top Row Title',
|
|
287
|
+
* items: //array of StorefrontNavigationItem
|
|
288
|
+
* },
|
|
289
|
+
* middleRow: {
|
|
290
|
+
* title: 'Middle Row Title',
|
|
291
|
+
* apps: //array of apps
|
|
292
|
+
* },
|
|
293
|
+
* bottomRow: {
|
|
294
|
+
* title: 'Bottom Row Title',
|
|
295
|
+
* items: //array of StorefrontNavigationItem
|
|
296
|
+
* }
|
|
297
|
+
* }
|
|
298
|
+
*
|
|
299
|
+
* const getLandingPage = async (): Promise<StorefrontLandingPage> => {
|
|
300
|
+
* return landingPage;
|
|
301
|
+
* }
|
|
302
|
+
*```
|
|
247
303
|
*/
|
|
248
304
|
getLandingPage(): Promise<StorefrontLandingPage>;
|
|
249
305
|
/**
|
|
250
306
|
* Get the Storefront navigation sections for the left nav bar.
|
|
307
|
+
* ```ts
|
|
308
|
+
* const navigationSections: [StorefrontNavigationSection, StorefrontNavigationSection] = [
|
|
309
|
+
* {
|
|
310
|
+
* id: 'first id',
|
|
311
|
+
* title: 'title',
|
|
312
|
+
* items: //array of navigation items
|
|
313
|
+
* },
|
|
314
|
+
* {
|
|
315
|
+
* id: 'second id'
|
|
316
|
+
* title: 'title',
|
|
317
|
+
* items: //array of navigation items
|
|
318
|
+
* }
|
|
319
|
+
* ]
|
|
320
|
+
*
|
|
321
|
+
* const getNavigation = async (): Promise<[StorefrontNavigationSection, StorefrontNavigationSection]> => {
|
|
322
|
+
* return navigationSections;
|
|
323
|
+
* }
|
|
324
|
+
*```
|
|
251
325
|
*/
|
|
252
326
|
getNavigation(): Promise<[StorefrontNavigationSection?, StorefrontNavigationSection?]>;
|
|
253
327
|
/**
|
|
254
328
|
* Get the footer for the platform's Storefront.
|
|
329
|
+
*
|
|
330
|
+
* ```ts
|
|
331
|
+
* const footer: StorefrontFooter = {
|
|
332
|
+
* logo: { src: './images/image', size: '32' },
|
|
333
|
+
* text: 'footer text',
|
|
334
|
+
* links: [
|
|
335
|
+
* { title:'title', url: 'https://openfin.co' },
|
|
336
|
+
* { title: 'title', url: 'https://openfin.co'}
|
|
337
|
+
* ]
|
|
338
|
+
* }
|
|
339
|
+
*
|
|
340
|
+
* const getFooter = async (): Promise<StorefrontFooter> => {
|
|
341
|
+
* return footer;
|
|
342
|
+
* }
|
|
343
|
+
* ```
|
|
255
344
|
*/
|
|
256
345
|
getFooter(): Promise<StorefrontFooter>;
|
|
257
346
|
/**
|
|
258
347
|
* Launch an app provided by the platform's Storefront.
|
|
348
|
+
*
|
|
349
|
+
* ```ts
|
|
350
|
+
* import { getStorefrontProvider } from "./my-provider";
|
|
351
|
+
*
|
|
352
|
+
* //Grab your provider
|
|
353
|
+
* const myStoreFrontProvider: StorefrontProvider = getStorefrontProvider();
|
|
354
|
+
*
|
|
355
|
+
* const app : App = {
|
|
356
|
+
* appId: 'uid'
|
|
357
|
+
* title: 'My App'
|
|
358
|
+
* manifest: `https://openfin-iex.experolabs.com/openfin/manifests/cash-flow.json`,
|
|
359
|
+
* icons: [
|
|
360
|
+
* {
|
|
361
|
+
* src: './image.png'
|
|
362
|
+
* }
|
|
363
|
+
* ],
|
|
364
|
+
* contactEmail: contact@email.com,
|
|
365
|
+
* supportEmail: support@email.com,
|
|
366
|
+
* publisher: 'My Publisher',
|
|
367
|
+
* tags: [],
|
|
368
|
+
* images: [],
|
|
369
|
+
* intents: []
|
|
370
|
+
* }
|
|
371
|
+
*
|
|
372
|
+
* const launch = async () => {
|
|
373
|
+
* await myStorefrontProvider.launchApp(app);
|
|
374
|
+
* }
|
|
375
|
+
* ```
|
|
376
|
+
* @param app the app to launch.
|
|
259
377
|
*/
|
|
260
378
|
launchApp(app: App): Promise<void>;
|
|
261
379
|
}
|
|
@@ -269,12 +387,58 @@ export interface StorefrontAPI {
|
|
|
269
387
|
* When a user selects your Storefront, the methods on the provider
|
|
270
388
|
* object are called to populate the UI. Throws an error if a provider with
|
|
271
389
|
* the same `id` already exists.
|
|
390
|
+
*
|
|
391
|
+
* ```ts
|
|
392
|
+
* import { Storefront, StorefrontProvider } from "@openfin/workspace";
|
|
393
|
+
*
|
|
394
|
+
* //Declare a provider
|
|
395
|
+
* const myStorefrontProvider: StorefrontProvider = {
|
|
396
|
+
* id: "my-storefront-id"
|
|
397
|
+
* title: "My StorefrontProvider"
|
|
398
|
+
* icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
399
|
+
* getApps: () => {...},
|
|
400
|
+
* getNavigation: () => {...},
|
|
401
|
+
* getLandingPage: () => {...},
|
|
402
|
+
* getFooter: () => {...},
|
|
403
|
+
* launchApp: () => {...}
|
|
404
|
+
* };
|
|
405
|
+
*
|
|
406
|
+
* const registerProvider = async () => {
|
|
407
|
+
* await Storefront.register(myStorefrontProvider);
|
|
408
|
+
* }
|
|
409
|
+
* ```
|
|
272
410
|
* @param provider the implementation of a Storefront provider.
|
|
273
411
|
|
|
274
412
|
*/
|
|
275
413
|
register(provider: StorefrontProvider): Promise<void>;
|
|
276
414
|
/**
|
|
277
415
|
* Deregister a provider.
|
|
416
|
+
*
|
|
417
|
+
* ```ts
|
|
418
|
+
* import { Storefront, StorefrontProvider } from "@openfin/workspace";
|
|
419
|
+
*
|
|
420
|
+
* //Instantiate a StorefrontProvider
|
|
421
|
+
* const myStorefrontProvider: StorefrontProvider = {
|
|
422
|
+
* id: "my-storefront-id"
|
|
423
|
+
* title: "My StoreFrontProvider"
|
|
424
|
+
* icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
425
|
+
* getApps: () => {...},
|
|
426
|
+
* getNavigation: () => {...},
|
|
427
|
+
* getLandingPage: () => {...},
|
|
428
|
+
* getFooter: () => {...},
|
|
429
|
+
* launchApp: () => {...}
|
|
430
|
+
* };
|
|
431
|
+
*
|
|
432
|
+
* const register = async () => {
|
|
433
|
+
* await Storefront.register(myStorefrontProvider);
|
|
434
|
+
* }
|
|
435
|
+
*
|
|
436
|
+
* //Do work with myStorefrontProvider
|
|
437
|
+
*
|
|
438
|
+
* const deregister = async () => {
|
|
439
|
+
* await Storefront.deregister("my-storefront-id");
|
|
440
|
+
* }
|
|
441
|
+
* ```
|
|
278
442
|
* @param id the id of the provider.
|
|
279
443
|
*/
|
|
280
444
|
deregister(id: string): Promise<void>;
|
|
@@ -282,12 +446,30 @@ export interface StorefrontAPI {
|
|
|
282
446
|
* Shows the Storefront window. Awaits for the latest [[`Storefront.register()`]]
|
|
283
447
|
* internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
|
|
284
448
|
* doesn't exist (i.e., because `register()` not called previously).
|
|
449
|
+
*
|
|
450
|
+
* ```ts
|
|
451
|
+
* import { Storefront } from "@openfin/workspace";
|
|
452
|
+
*
|
|
453
|
+
* const show = async () => {
|
|
454
|
+
* await Storefront.show();
|
|
455
|
+
* //Do thing after show
|
|
456
|
+
* }
|
|
457
|
+
* ```
|
|
285
458
|
*/
|
|
286
459
|
show(): Promise<void>;
|
|
287
460
|
/**
|
|
288
461
|
* Hides the Storefront window. Awaits for the latest [[`Storefront.register()`]]
|
|
289
462
|
* internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
|
|
290
463
|
* doesn't exist (i.e., because `register()` was not called previously).
|
|
464
|
+
*
|
|
465
|
+
* ```ts
|
|
466
|
+
* import { Storefront } from "@openfin/workspace";
|
|
467
|
+
*
|
|
468
|
+
* const hide = async () => {
|
|
469
|
+
* await Storefront.hidef();
|
|
470
|
+
* //Do thing after show
|
|
471
|
+
* }
|
|
472
|
+
* ```
|
|
291
473
|
*/
|
|
292
474
|
hide(): Promise<void>;
|
|
293
475
|
}
|
|
@@ -523,6 +705,20 @@ export declare type CLIDispatchedSearchResult = DispatchedSearchResult;
|
|
|
523
705
|
export interface CLIProvider extends SearchProvider {
|
|
524
706
|
/**
|
|
525
707
|
* Function that is called when a search request is triggered due to user input.
|
|
708
|
+
*
|
|
709
|
+
* ```ts
|
|
710
|
+
*
|
|
711
|
+
* import { getAllData, getResultsByQuery } from './get-all-data';
|
|
712
|
+
*
|
|
713
|
+
* const onUserInput = async({ query }): Promise<CLISearchResponse> => {
|
|
714
|
+
* if (!query) {
|
|
715
|
+
* return getAllData();
|
|
716
|
+
* }
|
|
717
|
+
*
|
|
718
|
+
* // Provide an implmentation to fetch query-filtered search results
|
|
719
|
+
* return getResultsByQuery(query);
|
|
720
|
+
* }
|
|
721
|
+
* ```
|
|
526
722
|
* @param req describes search request.
|
|
527
723
|
* @param res can be used to stream search results back to the requesting Workspace component.
|
|
528
724
|
* @returns an object that contains the search results to render in the requesting Workspace component.
|
|
@@ -531,6 +727,26 @@ export interface CLIProvider extends SearchProvider {
|
|
|
531
727
|
/**
|
|
532
728
|
* Callback that is invoked when ever a search result returned by this provider
|
|
533
729
|
* is interacted with from a Workspace component. (clicked, pressed enter, hotkey pressed, etc.)
|
|
730
|
+
*
|
|
731
|
+
*
|
|
732
|
+
* ```ts
|
|
733
|
+
* import { getAvailableCommands } from './my-commands';
|
|
734
|
+
*
|
|
735
|
+
* const onResultDispatch = async(result: CLIDispatchedSearchResult): Promise<void> => {
|
|
736
|
+
* try {
|
|
737
|
+
* //Grab the command corresponding to the result
|
|
738
|
+
* const availableCommands = await getAvailableCommands();
|
|
739
|
+
* const commandToExecute = availableCommands.find((command) => command.key === result.key);
|
|
740
|
+
*
|
|
741
|
+
* if (commantToExecute != undefined) {
|
|
742
|
+
* await commandToExecute.action();
|
|
743
|
+
* }
|
|
744
|
+
* } catch (err) {
|
|
745
|
+
* //Handle the error
|
|
746
|
+
* log.error('Error trying to action show command %s', err, result.key);
|
|
747
|
+
* }
|
|
748
|
+
* }
|
|
749
|
+
*```
|
|
534
750
|
* @param result the search result with the action that was selected by the user.
|
|
535
751
|
*/
|
|
536
752
|
onResultDispatch?(result: CLIDispatchedSearchResult): Promise<void>;
|
|
@@ -561,7 +777,9 @@ export interface HomeAPI {
|
|
|
561
777
|
* onUserInput: (req) => fetchMySearchResults(req.query)
|
|
562
778
|
* };
|
|
563
779
|
*
|
|
564
|
-
*
|
|
780
|
+
* const register = async () => {
|
|
781
|
+
* await Home.register(myCLIProvider);
|
|
782
|
+
* }
|
|
565
783
|
* ```
|
|
566
784
|
*
|
|
567
785
|
* @param provider the provider implementation.
|
|
@@ -569,15 +787,52 @@ export interface HomeAPI {
|
|
|
569
787
|
register(provider: HomeProvider | CLIProvider): Promise<void>;
|
|
570
788
|
/**
|
|
571
789
|
* Deregister a provider.
|
|
790
|
+
*
|
|
791
|
+
* ```ts
|
|
792
|
+
* import { Home , CLIProvider } from "@openfin/workspace";
|
|
793
|
+
*
|
|
794
|
+
* import { fetchMySearchResults } from "./my-fetch-implementation";
|
|
795
|
+
*
|
|
796
|
+
* const myCLIProvider: CLIProvider = {
|
|
797
|
+
* name: "my-cli-provider",
|
|
798
|
+
* title: "My CLI Provider",
|
|
799
|
+
* icon: "https://google.com/favicon.ico",
|
|
800
|
+
* onUserInput: (req) => fetchMySearchResults(req.query)
|
|
801
|
+
* };
|
|
802
|
+
*
|
|
803
|
+
* // Register and do some work with the provider
|
|
804
|
+
*
|
|
805
|
+
* const deregister = async () => {
|
|
806
|
+
* await Home.deregister("my-cli-provider");
|
|
807
|
+
* }
|
|
808
|
+
* ```
|
|
572
809
|
* @param providerId the name of the provider.
|
|
573
810
|
*/
|
|
574
811
|
deregister(providerId: string): Promise<void>;
|
|
575
812
|
/**
|
|
576
813
|
* Show the Home UI.
|
|
814
|
+
*
|
|
815
|
+
* ```ts
|
|
816
|
+
* import { Home } from './home'
|
|
817
|
+
*
|
|
818
|
+
* const show = async () => {
|
|
819
|
+
* await Home.show();
|
|
820
|
+
* // Do thing after show
|
|
821
|
+
* }
|
|
822
|
+
* ```
|
|
577
823
|
*/
|
|
578
824
|
show(): Promise<void>;
|
|
579
825
|
/**
|
|
580
826
|
* Hide the Home UI.
|
|
827
|
+
*
|
|
828
|
+
* ```ts
|
|
829
|
+
* import { Home } from './home'
|
|
830
|
+
*
|
|
831
|
+
* const hide = async () => {
|
|
832
|
+
* await Home.hide();
|
|
833
|
+
* // Do thing after hide
|
|
834
|
+
* }
|
|
835
|
+
* ```
|
|
581
836
|
*/
|
|
582
837
|
hide(): Promise<void>;
|
|
583
838
|
}
|
|
@@ -587,10 +842,32 @@ export interface HomeAPI {
|
|
|
587
842
|
export interface LegacyAPI {
|
|
588
843
|
/**
|
|
589
844
|
* Get the pages that a user had saved in a legacy version of Workspace. (pre 5.0.0)
|
|
845
|
+
*
|
|
846
|
+
* ```ts
|
|
847
|
+
* import { Legacy } from "@openfin/workspace";
|
|
848
|
+
*
|
|
849
|
+
* async logPages() {
|
|
850
|
+
* const pages = await Legacy.getPages();
|
|
851
|
+
* console.log(pages);
|
|
852
|
+
* }
|
|
853
|
+
*
|
|
854
|
+
* logPages();
|
|
855
|
+
* ```
|
|
590
856
|
*/
|
|
591
857
|
getPages(): Promise<Page[]>;
|
|
592
858
|
/**
|
|
593
859
|
* Get the workspaces that a user had saved in a legacy version of Workspace. (pre 5.0.0)
|
|
860
|
+
*
|
|
861
|
+
* ```ts
|
|
862
|
+
* import { Legacy } from "@openfin/workspace";
|
|
863
|
+
*
|
|
864
|
+
* async logWorkspaces() {
|
|
865
|
+
* const workspaces = await Legacy.getWorkspaces();
|
|
866
|
+
* console.log(workspaces);
|
|
867
|
+
* }
|
|
868
|
+
*
|
|
869
|
+
* logWorkspaces();
|
|
870
|
+
* ```
|
|
594
871
|
*/
|
|
595
872
|
getWorkspaces(): Promise<Workspace[]>;
|
|
596
873
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
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 }:
|
|
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,13 +1,15 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
|
-
import type { AttachedPage, Page } from '
|
|
2
|
+
import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../../../common/src/api/pages/shapes';
|
|
3
|
+
import { OpenGlobalContextMenuRequest } from '../../../../client-api-platform/src/shapes';
|
|
3
4
|
export declare const getBrowserModule: (identity: OpenFin.Identity) => {
|
|
4
5
|
identity: OpenFin.Identity;
|
|
5
6
|
openfinWindow: import("openfin-adapter").Window;
|
|
6
7
|
getPages: () => Promise<AttachedPage[]>;
|
|
7
8
|
getPage: (pageId: string) => Promise<AttachedPage>;
|
|
8
|
-
addPage: (page:
|
|
9
|
+
addPage: (page: PageWithUpdatableRuntimeAttribs) => Promise<void>;
|
|
9
10
|
removePage: (id: Page['pageId']) => Promise<void>;
|
|
10
11
|
setActivePage: (id: Page['pageId']) => Promise<void>;
|
|
11
12
|
updatePage: (req: any) => Promise<any>;
|
|
12
13
|
reorderPages: (req: any) => Promise<any>;
|
|
14
|
+
_openGlobalContextMenu: (req: OpenGlobalContextMenuRequest) => Promise<any>;
|
|
13
15
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
|
-
import type { AttachedPage, Page } from '
|
|
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.
|
|
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:
|
|
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
|
+
_openGlobalContextMenu: (req: import("../../shapes").OpenGlobalContextMenuRequest) => Promise<any>;
|
|
15
16
|
};
|
|
16
17
|
createWindow: (options: BrowserCreateWindowRequest) => Promise<BrowserWindowModule>;
|
|
17
|
-
|
|
18
|
+
getAllAttachedPages: () => Promise<AttachedPage[]>;
|
|
18
19
|
getAllWindows: () => Promise<BrowserWindowModule[]>;
|
|
19
20
|
launchPage: (page: Page) => Promise<BrowserWindowModule>;
|
|
20
21
|
getUniquePageTitle: (title?: string) => Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
2
|
+
export declare enum MenuData {
|
|
3
|
+
NewWindow = "NEW_WINDOW",
|
|
4
|
+
NewPage = "NEW_PAGE",
|
|
5
|
+
CloseWindow = "CLOSE_WINDOW",
|
|
6
|
+
OpenStorefront = "OPEN_STOREFRONT",
|
|
7
|
+
Quit = "QUIT"
|
|
8
|
+
}
|
|
9
|
+
declare const handler: (winIdentity: NamedIdentity, data: MenuData) => Promise<void>;
|
|
10
|
+
export default handler;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NamedIdentity } from 'openfin-adapter/src/identity';
|
|
2
|
+
import { OpenGlobalContextMenuPayload, OpenGlobalContextMenuRequest } from '../../../../client-api-platform/src/shapes';
|
|
3
|
+
export declare function openGlobalContextMenuInternal(payload: OpenGlobalContextMenuRequest & {
|
|
4
|
+
identity: NamedIdentity;
|
|
5
|
+
}, callerIdentity: any): Promise<void>;
|
|
6
|
+
export declare const openGlobalContextMenu: (payload: OpenGlobalContextMenuPayload, callerIdentity: any) => Promise<void>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
|
-
import type { AttachPagesToWindowPayload } from '
|
|
3
|
-
import type { CreateSavedPageRequest, Page, UpdateSavedPageRequest } from '
|
|
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
|
|
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
|
|
17
|
-
export declare const getPagesForWindow: (identity: OpenFin.Identity) => Promise<import("@
|
|
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("@
|
|
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
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* a Workspace Platform's address space.
|
|
5
5
|
*
|
|
6
6
|
* When adding a new channel action make sure to add a function that's name matches
|
|
7
|
-
* the value of the enum for the remote procedure in the Workspace Platform overrides.
|
|
7
|
+
* the value of the enum for the remote procedure in the Workspace Platform overrides and the override-callback.
|
|
8
8
|
* All of the registered channel action handlers can be found here in the platform's overrides:
|
|
9
9
|
* @see link: [Provider Protocol Handlers](https://github.com/openfin/workspace/client-api-platform/src/init/override-callback.ts)
|
|
10
10
|
*/
|
|
@@ -25,14 +25,17 @@ export declare enum ChannelAction {
|
|
|
25
25
|
AttachPagesToWindow = "attachPagesToWindow",
|
|
26
26
|
DetachPagesFromWindow = "detachPagesFromWindow",
|
|
27
27
|
ReorderPagesForWindow = "reorderPagesForWindow",
|
|
28
|
-
|
|
29
|
-
|
|
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",
|
|
37
|
+
OpenGlobalContextMenuInternal = "openGlobalContextMenuInternal",
|
|
38
|
+
InvokeCustomActionInternal = "invokeCustomActionInternal"
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Get a channel client for a specific Workspace platform.
|
|
@@ -44,4 +47,4 @@ export declare enum ChannelAction {
|
|
|
44
47
|
*
|
|
45
48
|
* @returns the channel client for the Workspace platform.
|
|
46
49
|
*/
|
|
47
|
-
export declare const getChannelClient: (identity: OpenFin.
|
|
50
|
+
export declare const getChannelClient: (identity: OpenFin.ApplicationIdentity) => Promise<import("openfin-adapter").ChannelClient>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Page } from '
|
|
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>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="openfin-adapter/fin" />
|
|
2
|
-
import
|
|
3
|
-
export declare const getWorkspacePlatformModule: (identity: OpenFin.
|
|
2
|
+
import { WorkspacePlatformModule } from '../shapes';
|
|
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
|
+
* // Required color options
|
|
14
|
+
* brandPrimary: '#F51F63',
|
|
15
|
+
* brandSecondary: '#1FF58A',
|
|
16
|
+
* backgroundPrimary: '#F8E71C', // hex, rgb/rgba, hsl/hsla only - no string colors: 'red'
|
|
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.
|
|
40
|
+
export declare const wrapSync: (identity: OpenFin.ApplicationIdentity) => WorkspacePlatformModule;
|
|
6
41
|
export declare const getCurrentSync: () => WorkspacePlatformModule;
|