@openfin/workspace 3.0.0 → 4.4.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.
Files changed (66) hide show
  1. package/README.md +66 -19
  2. package/client-api/src/home.d.ts +19 -0
  3. package/{index.test.d.ts → client-api/src/home.test.d.ts} +0 -0
  4. package/client-api/src/index.d.ts +14 -0
  5. package/{umd.d.ts → client-api/src/index.test.d.ts} +0 -0
  6. package/client-api/src/legacy.d.ts +3 -0
  7. package/{logger.d.ts → client-api/src/logger.d.ts} +0 -0
  8. package/client-api/src/shapes.d.ts +596 -0
  9. package/{storefront.d.ts → client-api/src/storefront.d.ts} +4 -0
  10. package/client-api/src/storefront.test.d.ts +1 -0
  11. package/client-api/src/umd.d.ts +1 -0
  12. package/common/src/api/home.d.ts +19 -0
  13. package/common/src/api/pages/index.d.ts +16 -0
  14. package/common/src/api/pages/shapes.d.ts +77 -0
  15. package/common/src/api/protocol.d.ts +63 -0
  16. package/common/src/api/search.d.ts +17 -0
  17. package/common/src/api/storefront.d.ts +72 -0
  18. package/common/src/api/workspaces/index.d.ts +7 -0
  19. package/common/src/utils/application.d.ts +38 -0
  20. package/common/src/utils/channels.d.ts +8 -0
  21. package/common/src/utils/env.d.ts +30 -0
  22. package/common/src/utils/layout.d.ts +52 -0
  23. package/common/src/utils/local-storage-key.d.ts +8 -0
  24. package/common/src/utils/logger/index.d.ts +26 -0
  25. package/common/src/utils/logger/manager.d.ts +35 -0
  26. package/common/src/utils/logger/shapes.d.ts +27 -0
  27. package/common/src/utils/snapshot.d.ts +33 -0
  28. package/common/src/utils/umd.d.ts +2 -0
  29. package/common/src/utils/window.d.ts +146 -0
  30. package/index.d.ts +1 -6
  31. package/index.js +1 -1
  32. package/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/search-api/src/client/index.d.ts +6 -0
  35. package/search-api/src/client/internal.d.ts +38 -0
  36. package/search-api/src/client/remote/channel-client-factory.d.ts +2 -0
  37. package/search-api/src/client/remote/channel-client.d.ts +9 -0
  38. package/search-api/src/client/remote/data.d.ts +16 -0
  39. package/search-api/src/client/remote/disconnect.d.ts +7 -0
  40. package/search-api/src/client/remote/dispatch.d.ts +9 -0
  41. package/search-api/src/client/remote/requests.d.ts +5 -0
  42. package/search-api/src/client/remote/search-close.d.ts +14 -0
  43. package/search-api/src/common.d.ts +104 -0
  44. package/search-api/src/errors.d.ts +5 -0
  45. package/search-api/src/fin/index.d.ts +6 -0
  46. package/search-api/src/fin/shapes.d.ts +23 -0
  47. package/search-api/src/index.d.ts +7 -0
  48. package/search-api/src/internal-shapes.d.ts +134 -0
  49. package/search-api/src/logger.d.ts +1 -0
  50. package/search-api/src/provider/index.d.ts +8 -0
  51. package/search-api/src/provider/internal.d.ts +33 -0
  52. package/search-api/src/provider/remote/channel-factory.d.ts +6 -0
  53. package/search-api/src/provider/remote/channel.d.ts +23 -0
  54. package/search-api/src/provider/remote/connection.d.ts +20 -0
  55. package/search-api/src/provider/remote/data.d.ts +23 -0
  56. package/search-api/src/provider/remote/deregistration.d.ts +5 -0
  57. package/search-api/src/provider/remote/disconnect.d.ts +1 -0
  58. package/search-api/src/provider/remote/disconnection.d.ts +9 -0
  59. package/search-api/src/provider/remote/dispatch.d.ts +7 -0
  60. package/search-api/src/provider/remote/info.d.ts +5 -0
  61. package/search-api/src/provider/remote/registration.d.ts +23 -0
  62. package/search-api/src/provider/remote/search-close.d.ts +14 -0
  63. package/search-api/src/provider/remote/search.d.ts +8 -0
  64. package/search-api/src/shapes.d.ts +541 -0
  65. package/common.d.ts +0 -6
  66. package/shapes.d.ts +0 -273
package/README.md CHANGED
@@ -1,28 +1,24 @@
1
- # Client API
1
+ # Workspace Client API
2
2
 
3
- The Client API is a framework allowing custom integrations on top of workspace. Could be used in **any** and **only** OpenFin app.
3
+ The Workspace Client APIs enable custom integrations with OpenFin Workspace. They can
4
+ be used in _any_ and _only_ OpenFin apps.
4
5
 
5
- ## Getting started
6
+ The Storefront API is the first Client API created.
6
7
 
7
- Run `npm i -E @openfin/workspace`. See the APIs and examples below.
8
+ **This API is [experimental](https://developers.openfin.co/of-docs/docs/experimental-apis).**
8
9
 
9
- ## Store API
10
+ ## Installation
10
11
 
11
- API Reference: https://cdn.openfin.co/workspace/api/docs/interfaces/StorefrontAPI.html
12
+ Run `npm i -E @openfin/workspace`.
12
13
 
13
- ### `register(provider: StorefrontProvider): Promise<void>`
14
+ ## Storefront API documentation
14
15
 
15
- Registers a Storefront provider. Upon registering a provider, the title of your provider will appear in the drop down of the Storefront UI. When a user selects your Storefront, the methods on the provider object will be called to populate the UI. Throws an error if provider with `provider.id` already exists. See [reference](https://cdn.openfin.co/workspace/api/docs/interfaces/StorefrontProvider.html) for definition of `StorefrontProvider` interface.
16
+ - [Overview](https://developers.openfin.co/of-docs/doc/)
17
+ - [API Reference](https://cdn.openfin.co/workspace/api/docs/interfaces/StorefrontAPI.html)
16
18
 
17
- ### `show(): Promise<void>`
19
+ ## Code examples
18
20
 
19
- Shows store window. Awaits for latest `Storefront.register()` internally so you don't have to. If store provider doesn't exist (`register` was not called before) then an error is thrown.
20
-
21
- ### `hide(): Promise<void>`
22
-
23
- Hides store window. Awaits for latest `Storefront.register()` internally so you don't have to. If store provider doesn't exist (`register` was not called before) then an error is thrown.
24
-
25
- ### Vanilla JS Example
21
+ ### Vanilla JS
26
22
 
27
23
  ```typescript
28
24
  import { Storefront, launchApp } from '@openfin/workspace';
@@ -35,7 +31,7 @@ Storefront.register({
35
31
  getLandingPage: fetchMyLandingPage,
36
32
  getNavigation: fetchMyNavigation,
37
33
  getFooter: fetchMyFooter,
38
- launchApp: launchApp // OpenFins default implementation of launchApp, you can also define your own
34
+ launchApp: launchApp // OpenFin's default implementation of launchApp, you can also define your own
39
35
  });
40
36
 
41
37
  document.getElementById('show-btn').addEventListener('click', () => {
@@ -47,7 +43,7 @@ document.getElementById('hide-btn').addEventListener('click', () => {
47
43
  });
48
44
  ```
49
45
 
50
- ### React Example
46
+ ### React
51
47
 
52
48
  ```typescript
53
49
  import { Storefront, launchApp } from '@openfin/workspace';
@@ -63,7 +59,7 @@ const App = () => {
63
59
  getLandingPage: fetchMyLandingPage,
64
60
  getNavigation: fetchMyNavigation,
65
61
  getFooter: fetchMyFooter,
66
- launchApp: launchApp // OpenFins default implementation of launchApp, you can also define your own
62
+ launchApp: launchApp // OpenFin's default implementation of launchApp, you can also define your own
67
63
  });
68
64
  }, []);
69
65
 
@@ -75,3 +71,54 @@ const App = () => {
75
71
  );
76
72
  };
77
73
  ```
74
+
75
+ ## Home API
76
+
77
+ API Reference: https://cdn.openfin.co/workspace/api/docs/interfaces/HomeAPI.html
78
+
79
+ ### `register(provider: HomeProvider): Promise<void>`
80
+
81
+ Registers a Home provider. Upon registering a provider, the search results from your provider will be rendered inside Home. See API reference for details which view each topic maps too. Throws an error if provider with `provider.id` already exists. See [reference](https://cdn.openfin.co/workspace/api/docs/interfaces/HomeProvider.html) for definition of `HomeProvider` interface.
82
+
83
+ ### Vanilla JS Example
84
+
85
+ ```typescript
86
+ import { Home, HomeActionName, HomeSearchTemplate } from '@openfin/workspace';
87
+ import { fetchMyLongRunningQueryResults, executeMyAction } from './my-provider';
88
+
89
+ const onUserInput = ({ query, context }) => {
90
+ // If the current search was triggered from the user selecting a suggestion, execute a expensive query.
91
+ if (context.isSuggestion) {
92
+ return { results: fetchMyLongRunningQueryResults() };
93
+ }
94
+
95
+ // Otherwise, return a cheap suggestion.
96
+ // You can use the `Suggestion` action that is built into the Home UI.
97
+ return {
98
+ results: [
99
+ {
100
+ key: '0',
101
+ template: HomeSearchTemplate.Plain,
102
+ title: `Search my home provider for ${query}`,
103
+ actions: [{ name: HomeActionName.Suggestion, query }]
104
+ }
105
+ ]
106
+ };
107
+ };
108
+
109
+ /**
110
+ * Optional method for executing actions that are specific to your Home provider.
111
+ */
112
+ const onResultDispatch = (res) => {
113
+ if (res.action === 'execute-my-action') {
114
+ return executeMyAction(res.data);
115
+ }
116
+ };
117
+
118
+ Home.register({
119
+ id: 'my-home-provider',
120
+ title: 'My Home Provider',
121
+ onUserInput,
122
+ onResultDispatch
123
+ });
124
+ ```
@@ -0,0 +1,19 @@
1
+ import type { CLIProvider, HomeProvider } from './shapes';
2
+ /**
3
+ * Register a provider that can return search results to Home.
4
+ * @param provider the Home provider implementation.
5
+ */
6
+ export declare const register: (provider: HomeProvider | CLIProvider) => Promise<void>;
7
+ /**
8
+ * Deregister a provider.
9
+ * @param provider the Home provider implementation.
10
+ */
11
+ export declare const deregister: (providerId: string) => Promise<void>;
12
+ /**
13
+ * Show the Home UI.
14
+ */
15
+ export declare function show(): Promise<any>;
16
+ /**
17
+ * Hide the Home UI.
18
+ */
19
+ export declare function hide(): Promise<any>;
@@ -0,0 +1,14 @@
1
+ import type { HomeAPI as HomeAPIType, LegacyAPI as LegacyAPIType, StorefrontAPI as StorefrontAPIType } from './shapes';
2
+ export * from './shapes';
3
+ /**
4
+ Namespace for Storefront integrations.
5
+ */
6
+ export declare const Storefront: StorefrontAPIType;
7
+ /**
8
+ Namespace for Home integrations.
9
+ */
10
+ export declare const Home: HomeAPIType;
11
+ /**
12
+ Namespace for Legacy integrations.
13
+ */
14
+ export declare const Legacy: LegacyAPIType;
File without changes
@@ -0,0 +1,3 @@
1
+ import * as workspacesApi from '@common/api/workspaces';
2
+ export declare const getPages: () => Promise<import("@common/api/pages/shapes").Page[]>;
3
+ export declare const getWorkspaces: () => Promise<workspacesApi.Workspace[]>;
File without changes