@openfin/workspace-platform 14.0.11 → 14.0.14

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.
@@ -2,9 +2,23 @@ import type { DockProvider } from './shapes/dock';
2
2
  import { DockProviderRegistration } from './shapes/dock';
3
3
  export * from './shapes/dock';
4
4
  /**
5
- * Registers a Dock provider
6
- * @returns promise - invokes action
5
+ * API function to register a Dock provider.
6
+ *
7
+ * @remarks A Workspace Platform must be initialized.
8
+ *
9
+ * @throws An error if the Workspace Platform is not initialized.
10
+ * @throws An error if a Dock provider for this Workspace Platform is already registered.
11
+ * @throws An error if the Dock provider configuration contains buttons with duplicate ids. If no ids are specified, the buttons will be assigned ids automatically.
12
+ *
13
+ * @param provider - The Dock provider to register.
14
+ *
15
+ * @returns A promise that resolves with a `DockProviderRegistration` object once the Dock provider is successfully registered. This contains the client API version, Workspace Version and a function to update the Dock provider configuration.
16
+ *
17
+ * @example Register a Dock provider with a single button.
18
+ *
7
19
  * ```ts
20
+ * import { Dock, type DockProvider } from '@openfin/workspace';
21
+ *
8
22
  * const provider: DockProvider = {
9
23
  * id: 'provider-id',
10
24
  * title: 'Sample Dock',
@@ -21,36 +35,58 @@ export * from './shapes/dock';
21
35
  * };
22
36
  *
23
37
  * await Dock.register(provider)
38
+ *
39
+ * await Dock.show()
24
40
  * ```
25
41
  */
26
42
  export declare const register: (provider: DockProvider) => Promise<DockProviderRegistration>;
27
43
  /**
28
- * API function to Deregister a Dock provider
44
+ * API function to deregister a Dock provider.
45
+ *
46
+ * @remarks A Workspace Platform must be initialized, and the Dock provider must be registered for this function to take effect.
47
+ *
48
+ * @throws an error if the provider is not registered.
29
49
  *
30
- * @returns a promise that resolves once the dock is deregistered
50
+ * @returns a promise that resolves once the Dock provider is successfully deregistered.
51
+ *
52
+ * @example Deregister a Dock provider.
31
53
  *
32
54
  * ```ts
55
+ * import { Dock } from '@openfin/workspace';
56
+ *
33
57
  * await Dock.deregister();
34
58
  * ```
35
59
  */
36
60
  export declare const deregister: () => Promise<void>;
37
61
  /**
38
- * API function to minimize Dock
62
+ * API function to show the Dock UI.
63
+ *
64
+ * @remarks A Workspace Platform must be initialized, and at least one Dock provider must be registered for this function to take effect.
39
65
  *
40
- * @returns a promise that resolves once the dock is minimized
66
+ * @returns a promise that resolves once the Dock UI is hidden
67
+ *
68
+ * @example Show a Dock provider.
41
69
  *
42
70
  * ```ts
43
- * await Dock.minimize();
71
+ * import { Dock } from '@openfin/workspace';
72
+ *
73
+ * await Dock.show();
44
74
  * ```
45
75
  */
46
76
  export declare const minimize: () => Promise<void>;
47
77
  /**
48
- * API function to show Dock
78
+ * API function to hide the Dock UI.
79
+ *
80
+ * @remarks A Workspace Platform must be initialized, and at least one Dock provider must be registered for this function to take effect.
81
+ *
82
+ * @returns a promise that resolves once the Dock UI is hidden
49
83
  *
50
- * @returns a promise that resolves once the dock is shown
84
+ * @example Hide a Dock provider.
51
85
  *
52
86
  * ```ts
53
- * await Dock.show();
87
+ * import { Dock } from '@openfin/workspace';
88
+ *
89
+ * await Dock.hide();
54
90
  * ```
55
91
  */
56
92
  export declare const show: () => Promise<void>;
@@ -2,20 +2,91 @@ import type { CLIProvider, HomeProvider } from './shapes/home';
2
2
  import { HomeRegistration } from './shapes/home';
3
3
  export * from './shapes/home';
4
4
  /**
5
- * Register a provider that can return search results to Home.
6
- * @param provider the Home provider implementation.
5
+ * API function to register a Home provider.
6
+ *
7
+ * @remarks A Workspace Platform must be initialized.
8
+ *
9
+ * @throws An error if the Workspace Platform is not initialized.
10
+ * @throws An error if a Home provider with the same `id` is already registered.
11
+ *
12
+ * @param provider - The Home provider to register.
13
+ *
14
+ * @returns A promise that resolves with a `HomeRegistration` object once the Dock provider is successfully registered. This contains the client API version, Workspace Version and a function to set the search query.
15
+ *
16
+ * @example **Register a Basic Home provider**
17
+ *
18
+ * ```ts
19
+ * import { Home, type HomeProvider } from '@openfin/workspace';
20
+ *
21
+ * const provider: HomeProvider = {
22
+ * title: "My Home Provider"
23
+ * inputPlaceholder: "Search with My Home Provider",
24
+ * icon: "https://www.openfin.co/favicon-32x32.png",
25
+ * listTitle: "My Home Provider Results",
26
+ * logoUrl: "https://www.openfin.co/favicon-32x32.png",
27
+ * id: "my-home-provider",
28
+ * onUserInput: (req, res) => {
29
+ * console.log(req.query);
30
+ * return { results: [], context: { filters: [] } }
31
+ * },
32
+ * dispatchFocusEvents: true,
33
+ * };
34
+ *
35
+ * await Home.register(provider)
36
+ *
37
+ * await Home.show()
38
+ * ```
7
39
  */
8
40
  export declare const register: (provider: HomeProvider | CLIProvider) => Promise<HomeRegistration>;
9
41
  /**
10
- * Deregister a provider.
42
+ * API function to deregister a Home provider.
43
+ *
44
+ * @remarks A Workspace Platform must be initialized, and the Home provider must be registered for this function to take effect.
45
+ *
46
+ * @throws an error if the provider is not registered.
47
+ *
11
48
  * @param providerId the Home provider ID.
49
+ *
50
+ * @returns a promise that resolves once the Home provider is successfully deregistered.
51
+ *
52
+ * @example Deregister a Home provider.
53
+ *
54
+ * ```ts
55
+ * import { Home } from '@openfin/workspace';
56
+ *
57
+ * await Home.deregister('my-home-provider');
58
+ * ```
12
59
  */
13
60
  export declare const deregister: (providerId: string) => Promise<void>;
14
61
  /**
15
- * Show the Home UI.
62
+ * API function to show the Home UI.
63
+ *
64
+ * @remarks A Workspace Platform must be initialized, and at least one Home provider must be registered for this function to take effect.
65
+ *
66
+ * @returns a promise that resolves once the Home UI is hidden
67
+ *
68
+ * @example Show a Home provider.
69
+ *
70
+ * ```ts
71
+ * import { Home } from '@openfin/workspace';
72
+ *
73
+ * await Home.show();
74
+ * ```
16
75
  */
17
76
  export declare function show(): Promise<void>;
18
77
  /**
19
- * Hide the Home UI.
78
+ * API function to hide the Home UI.
79
+ *
80
+ * @remarks A Workspace Platform must be initialized, and at least one Home provider must be registered for this function to take effect.
81
+ *
82
+ * @returns a promise that resolves once the Home UI is hidden
83
+ *
84
+ * @example Hide a Home provider.
85
+ *
86
+ * ```ts
87
+ * import { Home } from '@openfin/workspace';
88
+ *
89
+ * await Home.hide();
90
+ * ```
20
91
  */
21
92
  export declare function hide(): Promise<void>;
@@ -9,22 +9,22 @@ export * from './shapes/home';
9
9
  export * from './shapes/store';
10
10
  export * from './shapes/dock';
11
11
  /**
12
- Namespace for Storefront integrations.
13
- */
12
+ * Namespace for Storefront integrations.
13
+ */
14
14
  export { StorefrontAPI as Storefront };
15
15
  /**
16
- Namespace for Home integrations.
17
- */
16
+ * Namespace for Home integrations.
17
+ */
18
18
  export { HomeAPI as Home };
19
19
  /**
20
- Namespace for Dock integrations.
21
- */
20
+ * Namespace for Dock integrations.
21
+ */
22
22
  export { DockAPI as Dock };
23
23
  /**
24
- Namespace for Legacy integrations.
25
- */
24
+ * Namespace for Legacy integrations.
25
+ */
26
26
  export { LegacyAPI as Legacy };
27
27
  /**
28
- Namespace for Microflows integrations.
29
- */
28
+ * Namespace for Microflows integrations.
29
+ */
30
30
  export { IntegrationsAPI as Integrations };
@@ -1,3 +1,4 @@
1
- import * as workspacesApi from '../../common/src/api/workspaces';
2
- export declare const getPages: () => Promise<import("client-api-platform").Page[]>;
3
- export declare const getWorkspaces: () => Promise<workspacesApi.Workspace[]>;
1
+ /** @deprecated */
2
+ export declare const getPages: () => unknown;
3
+ /** @deprecated */
4
+ export declare const getWorkspaces: () => unknown;
@@ -1,14 +1,25 @@
1
1
  export type { Action, DispatchedAction, DispatchedSearchResult, SearchListenerRequest, SearchListenerResponse, SearchProviderInfo, SearchResult, ScoreOrder, SearchTag, SearchProvider, UserInputListener, ResultDispatchListener, SearchResponse } from '../../../search-api/src/index';
2
2
  export type { Workspace } from '../../../common/src/api/workspaces';
3
- export type { Page, PageLayout, PageLayoutDetails, PanelConfig, PanelConfigHorizontal, PanelConfigVertical, PanelPosition } from '../../../common/src/api/pages/shapes';
4
3
  export { SearchTagBackground, ActionTrigger } from '../../../search-api/src/shapes';
5
4
  export type { ProviderInfo } from './provider';
6
5
  export type { BaseCustomButtonConfig, BaseCustomDropdownConfig, BaseCustomDropdownItem, BaseCustomDropdownItems, CustomActionSpecifier, CustomButtonConfig, CustomDropdownConfig } from '../../../common/src/api/action';
7
6
  /**
8
- * return by component.register function
7
+ * Registration meta info
8
+ *
9
+ * Returned when a Workspace component is registered.
9
10
  */
10
11
  export interface RegistrationMetaInfo {
12
+ /**
13
+ * Client API version
14
+ *
15
+ * This is the version of the Workspace client API that is being used to register the component.
16
+ */
11
17
  clientAPIVersion: string;
18
+ /**
19
+ * Workspace version
20
+ *
21
+ * This is the version of Workspace that the Workspace component is running on.
22
+ * This could be used to determine if the component is running on a version of Workspace that supports a particular feature.
23
+ */
12
24
  workspaceVersion: string;
13
25
  }
14
- export type RegisterMetaInfoInternal = Pick<RegistrationMetaInfo, 'workspaceVersion'>;
@@ -1,41 +1,41 @@
1
- import { CustomButtonConfig, CustomDropdownConfig } from '../../../common/src/api/action';
2
- import { RegistrationMetaInfo } from '../../../client-api/src/shapes/common';
3
- import { ProviderInfo } from './provider';
1
+ import { type CustomButtonConfig, type CustomDropdownConfig } from '../../../common/src/api/action';
2
+ import { type RegistrationMetaInfo } from '../../../client-api/src/shapes/common';
3
+ import { type ProviderInfo } from './provider';
4
4
  /**
5
5
  * Allows you to hide buttons for different Workspace components in the Dock UI.
6
6
  * By default, all components are shown.
7
7
  *
8
8
  * @deprecated Use {@link WorkspaceButtonsConfig} instead. To migrate to the new configuration, any buttons that you wish to hide should be omitted from the `buttons` array.
9
9
  *
10
- * @example
10
+ * @example Hide all Workspace component buttons in the Dock UI.
11
11
  * ```ts
12
12
  * const workspaceComponentButtonOptions: WorkspaceComponentButtonOptions = {
13
- * hideHomeButton: true,
14
- * hideWorkspacesButton: true,
15
- * hideNotificationsButton: true,
16
- * hideStorefrontButton: true
13
+ * hideHomeButton: true,
14
+ * hideWorkspacesButton: true,
15
+ * hideNotificationsButton: true,
16
+ * hideStorefrontButton: true
17
17
  * }
18
18
  * ```
19
19
  */
20
20
  export interface WorkspaceComponentButtonOptions {
21
21
  /**
22
22
  * Set to true to hide the Workspaces button from the Dock UI.
23
- * Default value false.
23
+ * @default false.
24
24
  */
25
25
  hideWorkspacesButton?: boolean;
26
26
  /**
27
27
  * Set to true to hide the Home button from the Dock UI.
28
- * Default value false.
28
+ * @default false.
29
29
  */
30
30
  hideHomeButton?: boolean;
31
31
  /**
32
32
  * Set to true to hide the Notifications button from the Dock UI.
33
- * Default value false.
33
+ * @default false.
34
34
  */
35
35
  hideNotificationsButton?: boolean;
36
36
  /**
37
37
  * Set to true to hide the Storefront button from the Dock UI.
38
- * Default value false.
38
+ * @default false.
39
39
  */
40
40
  hideStorefrontButton?: boolean;
41
41
  }
@@ -71,28 +71,28 @@ export interface DockButtonConfig extends CustomButtonConfig {
71
71
  *
72
72
  * ```ts
73
73
  * const sampleDropdownButton1: DockDropdownConfig = {
74
- * type: DockButtonNames.DropdownButton,
75
- * tooltip: 'Sample Dropdown Button',
76
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
77
- * options: [
78
- * {
79
- * tooltip: 'Dropdown Button 1',
80
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
81
- * action: {
82
- * id: 'dropdownButton1',
83
- * customData: "dropdownButton1 clicked"
84
- * }
85
- * },
86
- * {
87
- * tooltip: 'Dropdown Button 2',
88
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
89
- * action: {
90
- * id: 'dropdownButton2',
91
- * customData: "dropdownButton2 clicked"
92
- * }
93
- * }
94
- * ]
95
- * }
74
+ * type: DockButtonNames.DropdownButton,
75
+ * tooltip: "Sample Dropdown Button",
76
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
77
+ * options: [
78
+ * {
79
+ * tooltip: "Dropdown Button 1",
80
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
81
+ * action: {
82
+ * id: "dropdownButton1",
83
+ * customData: "dropdownButton1 clicked",
84
+ * },
85
+ * },
86
+ * {
87
+ * tooltip: "Dropdown Button 2",
88
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
89
+ * action: {
90
+ * id: "dropdownButton2",
91
+ * customData: "dropdownButton2 clicked",
92
+ * },
93
+ * },
94
+ * ],
95
+ * };
96
96
  * ```
97
97
  */
98
98
  export interface DockDropdownConfig extends CustomDropdownConfig {
@@ -102,7 +102,10 @@ export interface DockDropdownConfig extends CustomDropdownConfig {
102
102
  * Dock button types
103
103
  */
104
104
  export type DockButton = {
105
- /** Optional button identifier, if not provided will be automatically generated by the provider */ id?: string;
105
+ /**
106
+ * Optional button identifier, if not provided will be automatically generated by the provider
107
+ */
108
+ id?: string;
106
109
  } & (DockButtonConfig | DockDropdownConfig);
107
110
  /**
108
111
  * The names of the buttons for the workspace components on the Dock.
@@ -113,11 +116,11 @@ export type WorkspaceButton = 'switchWorkspace' | 'home' | 'notifications' | 'st
113
116
  /**
114
117
  * Controls the visibility as well as the order of buttons for workspace components on the Dock.
115
118
  *
116
- * To hide a button, remove it from the array.
119
+ * To omit a button from the Dock UI, simply omit it from the array.
117
120
  *
118
- * The array should not contain duplicate values.
121
+ * The array must not contain duplicate values. Any duplicate values will be removed.
119
122
  *
120
- * @example - Hide the Home button and move the Notifications button to the first position.
123
+ * @example Hide the Home button and move the Notifications button to the first position.
121
124
  * ```ts
122
125
  * const workspaceButtonsConfig: WorkspaceButtonsConfig = [
123
126
  * 'notifications',
@@ -126,7 +129,7 @@ export type WorkspaceButton = 'switchWorkspace' | 'home' | 'notifications' | 'st
126
129
  * ];
127
130
  * ```
128
131
  *
129
- * @example - Hide all of the workspace buttons.
132
+ * @example Hide all of the workspace buttons.
130
133
  *
131
134
  * ```ts
132
135
  * const workspaceButtonsConfig: WorkspaceButtonsConfig = [];
@@ -141,7 +144,7 @@ export interface DockProviderConfig {
141
144
  * Controls the visibility of buttons for workspace components on the Dock.
142
145
  * All components are visible by default, but you can hide any of them.
143
146
  *
144
- * @default - All components are visible. (['switchWorkspace', 'home', 'notifications', 'store'])
147
+ * @default - All components are visible. `['switchWorkspace', 'home', 'notifications', 'store']`
145
148
  */
146
149
  workspaceComponents?: WorkspaceComponentButtonOptions | WorkspaceButtonsConfig;
147
150
  /**
@@ -172,54 +175,56 @@ export interface DockProviderConfigWithIdentity extends ProviderInfo, DockProvid
172
175
  *
173
176
  * Import required dependencies.
174
177
  * ```ts
175
- * import { Dock, DockProvider, DockButtonNames } from '@openfin/workspace';
176
178
  * import { CustomDropdownItemActionPayload, init } from "@openfin/workspace-platform";
179
+ * import { Dock, type DockProvider, DockButtonNames } from '@openfin/workspace';
177
180
  * ```
178
181
  *
179
182
  * Create provider object to pass to the static `register` function of the `Dock` type.
180
183
  *
181
184
  * ```ts
182
185
  * const provider: DockProvider = {
183
- * id: 'provider-id',
184
- * title: 'Sample Dock',
185
- * icon: 'https://www.openfin.co/favicon-32x32.png',
186
- * buttons: [
187
- * {
188
- * tooltip: 'Sample Button 1',
189
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
190
- * action: {
191
- * id: 'sampleButton1'
192
- * }
193
- * },
194
- * {
195
- * type: DockButtonNames.DropdownButton,
196
- * tooltip: 'Sample Dropdown Button',
197
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
198
- * options: [
186
+ * id: "provider-id",
187
+ * title: "Sample Dock",
188
+ * icon: "https://www.openfin.co/favicon-32x32.png",
189
+ * buttons: [
199
190
  * {
200
- * tooltip: 'Dropdown Button 1',
201
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
202
- * action: {
203
- * id: 'dropdownButton1',
204
- * customData: "dropdownButton1 clicked"
205
- * }
191
+ * tooltip: "Sample Button 1",
192
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
193
+ * action: {
194
+ * id: "sampleButton1",
195
+ * },
206
196
  * },
207
197
  * {
208
- * tooltip: 'Dropdown Button 2',
209
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
210
- * action: {
211
- * id: 'dropdownButton2',
212
- * customData: "dropdownButton2 clicked"
213
- * }
214
- * }
215
- * ]
216
- * }
217
- * ]
198
+ * type: DockButtonNames.DropdownButton,
199
+ * tooltip: "Sample Dropdown Button",
200
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
201
+ * options: [
202
+ * {
203
+ * tooltip: "Dropdown Button 1",
204
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
205
+ * action: {
206
+ * id: "dropdownButton1",
207
+ * customData: "dropdownButton1 clicked",
208
+ * },
209
+ * },
210
+ * {
211
+ * tooltip: "Dropdown Button 2",
212
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
213
+ * action: {
214
+ * id: "dropdownButton2",
215
+ * customData: "dropdownButton2 clicked",
216
+ * },
217
+ * },
218
+ * ],
219
+ * },
220
+ * ],
218
221
  * };
219
222
  * ```
220
223
  *
224
+ * When a Dock button is clicked, the `action` object is passed to the `customActions` function defined as defined in the Workspace Platform `init` function.
225
+ *
226
+ * Initialize your Workspace Platform with ``customActions`` to be invoked by dock dropdown.
221
227
  *
222
- * Initialize ``workspace`` with ``customActions`` to be invoked by dock dropdown.
223
228
  *```ts
224
229
  * await init({
225
230
  * browser: {},
@@ -235,10 +240,12 @@ export interface DockProviderConfigWithIdentity extends ProviderInfo, DockProvid
235
240
  *```
236
241
  *
237
242
  * Register Dock ``provider`` object.
243
+ *
238
244
  * ```ts
239
245
  * await Dock.register(provider);
240
246
  * ```
241
247
  * Show Dock.
248
+ *
242
249
  * ```ts
243
250
  * await Dock.show();
244
251
  * ```
@@ -263,16 +270,21 @@ export interface DockProviderRegistration extends RegistrationMetaInfo {
263
270
  * @param request The new Dock configuration.
264
271
  * @returns Promise that resolves when the update completes.
265
272
  *
266
- * @example
273
+ * @example Update the Dock configuration. This example requires that you have already registered a Dock provider.
274
+ *
267
275
  * ```ts
276
+ * import { Dock, type DockProviderConfig } from '@openfin/workspace';
277
+ *
268
278
  * const newConfig: DockProviderConfig = {
269
- * buttons: [{
270
- * tooltip: 'Sample Button 1',
271
- * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
272
- * action: {
273
- * id: 'sampleButton1'
274
- * }
275
- * }]
279
+ * buttons: [
280
+ * {
281
+ * tooltip: "Sample Button 1",
282
+ * iconUrl: "https://www.openfin.co/favicon-32x32.png",
283
+ * action: {
284
+ * id: "sampleButton1",
285
+ * },
286
+ * },
287
+ * ],
276
288
  * };
277
289
  *
278
290
  * await dockProviderRegistration.updateDockProviderConfig(newConfig);