@openfin/workspace 1.8.0 → 4.0.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 (62) hide show
  1. package/README.md +121 -4
  2. package/client-api/src/common.d.ts +6 -0
  3. package/{index.test.d.ts → client-api/src/common.test.d.ts} +0 -0
  4. package/client-api/src/home.d.ts +19 -0
  5. package/{umd.d.ts → client-api/src/home.test.d.ts} +0 -0
  6. package/client-api/src/index.d.ts +11 -0
  7. package/client-api/src/index.test.d.ts +1 -0
  8. package/{logger.d.ts → client-api/src/logger.d.ts} +0 -0
  9. package/client-api/src/shapes.d.ts +573 -0
  10. package/client-api/src/storefront.d.ts +18 -0
  11. package/client-api/src/storefront.test.d.ts +1 -0
  12. package/client-api/src/umd.d.ts +1 -0
  13. package/common/src/api/home.d.ts +27 -0
  14. package/common/src/api/protocol.d.ts +88 -0
  15. package/common/src/api/search.d.ts +7 -0
  16. package/common/src/api/shapes.d.ts +20 -0
  17. package/common/src/api/storefront.d.ts +70 -0
  18. package/common/src/utils/application.d.ts +41 -0
  19. package/common/src/utils/channels.d.ts +8 -0
  20. package/common/src/utils/env.d.ts +27 -0
  21. package/common/src/utils/logger/index.d.ts +26 -0
  22. package/common/src/utils/logger/manager.d.ts +35 -0
  23. package/common/src/utils/logger/shapes.d.ts +27 -0
  24. package/common/src/utils/window.d.ts +145 -0
  25. package/index.d.ts +2 -6
  26. package/index.js +1 -1
  27. package/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/search-api/src/client/index.d.ts +6 -0
  30. package/search-api/src/client/internal.d.ts +38 -0
  31. package/search-api/src/client/remote/channel-client-factory.d.ts +2 -0
  32. package/search-api/src/client/remote/channel-client.d.ts +9 -0
  33. package/search-api/src/client/remote/data.d.ts +16 -0
  34. package/search-api/src/client/remote/disconnect.d.ts +7 -0
  35. package/search-api/src/client/remote/dispatch.d.ts +9 -0
  36. package/search-api/src/client/remote/requests.d.ts +5 -0
  37. package/search-api/src/client/remote/search-close.d.ts +14 -0
  38. package/search-api/src/common.d.ts +104 -0
  39. package/search-api/src/errors.d.ts +5 -0
  40. package/search-api/src/fin/index.d.ts +6 -0
  41. package/search-api/src/fin/shapes.d.ts +23 -0
  42. package/search-api/src/index.d.ts +7 -0
  43. package/search-api/src/internal-shapes.d.ts +134 -0
  44. package/search-api/src/logger.d.ts +1 -0
  45. package/search-api/src/provider/index.d.ts +8 -0
  46. package/search-api/src/provider/internal.d.ts +33 -0
  47. package/search-api/src/provider/remote/channel-factory.d.ts +6 -0
  48. package/search-api/src/provider/remote/channel.d.ts +23 -0
  49. package/search-api/src/provider/remote/connection.d.ts +20 -0
  50. package/search-api/src/provider/remote/data.d.ts +23 -0
  51. package/search-api/src/provider/remote/deregistration.d.ts +5 -0
  52. package/search-api/src/provider/remote/disconnect.d.ts +1 -0
  53. package/search-api/src/provider/remote/disconnection.d.ts +9 -0
  54. package/search-api/src/provider/remote/dispatch.d.ts +7 -0
  55. package/search-api/src/provider/remote/info.d.ts +5 -0
  56. package/search-api/src/provider/remote/registration.d.ts +23 -0
  57. package/search-api/src/provider/remote/search-close.d.ts +14 -0
  58. package/search-api/src/provider/remote/search.d.ts +8 -0
  59. package/search-api/src/shapes.d.ts +541 -0
  60. package/common.d.ts +0 -6
  61. package/content-store.d.ts +0 -14
  62. package/shapes.d.ts +0 -272
package/README.md CHANGED
@@ -1,7 +1,124 @@
1
- # Client API
1
+ # Workspace Client API
2
2
 
3
- The Client API is a framework allowing custom integrations on top of workspace.
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
- TBD
8
+ **This API is [experimental](https://developers.openfin.co/of-docs/docs/experimental-apis).**
9
+
10
+ ## Installation
11
+
12
+ Run `npm i -E @openfin/workspace`.
13
+
14
+ ## Storefront API documentation
15
+
16
+ - [Overview](https://developers.openfin.co/of-docs/doc/)
17
+ - [API Reference](https://cdn.openfin.co/workspace/api/docs/interfaces/StorefrontAPI.html)
18
+
19
+ ## Code examples
20
+
21
+ ### Vanilla JS
22
+
23
+ ```typescript
24
+ import { Storefront, launchApp } from '@openfin/workspace';
25
+ import { fetchMyApps, fetchMyLandingPage, fetchMyNavigation, fetchMyFooter } from './my-storefront-provider';
26
+
27
+ Storefront.register({
28
+ id: 'my-storefront',
29
+ title: 'My Storefront',
30
+ getApps: fetchMyApps,
31
+ getLandingPage: fetchMyLandingPage,
32
+ getNavigation: fetchMyNavigation,
33
+ getFooter: fetchMyFooter,
34
+ launchApp: launchApp // OpenFin's default implementation of launchApp, you can also define your own
35
+ });
36
+
37
+ document.getElementById('show-btn').addEventListener('click', () => {
38
+ Storefront.show();
39
+ });
40
+
41
+ document.getElementById('hide-btn').addEventListener('click', () => {
42
+ Storefront.hide();
43
+ });
44
+ ```
45
+
46
+ ### React
47
+
48
+ ```typescript
49
+ import { Storefront, launchApp } from '@openfin/workspace';
50
+ import { fetchMyApps, fetchMyLandingPage, fetchMyNavigation, fetchMyFooter } from './my-storefront-provider';
51
+ import React, { useEffect } from 'react';
52
+
53
+ const App = () => {
54
+ useEffect(() => {
55
+ Storefront.register({
56
+ id: 'my-storefront',
57
+ title: 'My Storefront',
58
+ getApps: fetchMyApps,
59
+ getLandingPage: fetchMyLandingPage,
60
+ getNavigation: fetchMyNavigation,
61
+ getFooter: fetchMyFooter,
62
+ launchApp: launchApp // OpenFin's default implementation of launchApp, you can also define your own
63
+ });
64
+ }, []);
65
+
66
+ return (
67
+ <>
68
+ <button onClick={Storefront.show}>Show Store</button>
69
+ <button onClick={Storefront.hide}>Hide Store</button>
70
+ </>
71
+ );
72
+ };
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,6 @@
1
+ import type { App } from './shapes';
2
+ /**
3
+ * Default Workspace implementation for launching an application.
4
+ * @param app the application to launch.
5
+ */
6
+ export declare const launchApp: (app: App) => Promise<void>;
@@ -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>;
File without changes
@@ -0,0 +1,11 @@
1
+ import type { HomeAPI as HomeAPIType, StorefrontAPI as StorefrontAPIType } from './shapes';
2
+ export * from './shapes';
3
+ export * from './common';
4
+ /**
5
+ Namespace for Storefront integrations.
6
+ */
7
+ export declare const Storefront: StorefrontAPIType;
8
+ /**
9
+ Namespace for Home integrations.
10
+ */
11
+ export declare const Home: HomeAPIType;
@@ -0,0 +1 @@
1
+ export {};
File without changes