@openfin/workspace-platform 13.1.5 → 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.
Files changed (59) hide show
  1. package/client-api/src/dock.d.ts +46 -10
  2. package/client-api/src/home.d.ts +76 -5
  3. package/client-api/src/index.d.ts +10 -10
  4. package/client-api/src/internal/home/handlers/data.d.ts +3 -0
  5. package/client-api/src/internal/home/handlers/disconnect.d.ts +1 -0
  6. package/client-api/src/internal/home/handlers/index.d.ts +6 -0
  7. package/client-api/src/internal/home/handlers/result-dispatch.d.ts +3 -0
  8. package/client-api/src/internal/home/handlers/search-close.d.ts +5 -0
  9. package/client-api/src/internal/home/index.d.ts +4 -0
  10. package/client-api/src/internal/home/requests.d.ts +5 -0
  11. package/client-api/src/internal/providers.d.ts +63 -0
  12. package/client-api/src/internal/storefront/handlers.d.ts +9 -0
  13. package/client-api/src/internal/storefront/index.d.ts +4 -0
  14. package/client-api/src/{internal.d.ts → internal/try-dispatch.d.ts} +1 -1
  15. package/client-api/src/legacy.d.ts +4 -3
  16. package/client-api/src/shapes/common.d.ts +14 -3
  17. package/client-api/src/shapes/dock.d.ts +97 -85
  18. package/client-api/src/shapes/home.d.ts +49 -138
  19. package/client-api/src/shapes/store.d.ts +31 -14
  20. package/client-api/src/shapes/templates.d.ts +11 -11
  21. package/client-api/src/store.d.ts +31 -15
  22. package/client-api-platform/src/init/browser-defaults.test.d.ts +1 -1
  23. package/client-api-platform/src/init/page-defaults.test.d.ts +1 -1
  24. package/client-api-platform/src/init/panels.test.d.ts +1 -1
  25. package/client-api-platform/src/init/utils.d.ts +2 -2
  26. package/client-api-platform/src/init/utils.test.d.ts +1 -1
  27. package/client-api-platform/src/shapes.d.ts +46 -39
  28. package/common/src/api/action.d.ts +1 -1
  29. package/common/src/api/home.d.ts +25 -0
  30. package/common/src/api/pages/shapes.d.ts +6 -6
  31. package/common/src/api/protocol/browser.d.ts +1 -1
  32. package/common/src/api/protocol/shapes/search.d.ts +96 -0
  33. package/common/src/api/protocol/shapes/workspace.d.ts +13 -13
  34. package/common/src/api/protocol/workspace-platform.d.ts +1 -1
  35. package/common/src/api/protocol/workspace.d.ts +2 -0
  36. package/common/src/api/provider.d.ts +24 -9
  37. package/common/src/api/search/aggregate-search-results.d.ts +10 -0
  38. package/common/src/api/search/common.d.ts +15 -0
  39. package/common/src/api/shapes/home.d.ts +186 -0
  40. package/common/src/api/theming.d.ts +18 -6
  41. package/common/src/test/crypto-mocks.d.ts +1 -0
  42. package/common/src/utils/a11y/search.a11y.d.ts +10 -10
  43. package/common/src/utils/application.d.ts +2 -2
  44. package/common/src/utils/context-menu.d.ts +1 -1
  45. package/common/src/utils/layout.d.ts +3 -3
  46. package/common/src/utils/menu-window-provider.d.ts +2 -2
  47. package/common/src/utils/route.d.ts +0 -1
  48. package/common/src/utils/snapshot.d.ts +3 -3
  49. package/common/src/utils/types.d.ts +7 -7
  50. package/common/src/utils/usage-register.d.ts +2 -2
  51. package/index.js +124 -19
  52. package/index.js.map +1 -1
  53. package/package.json +3 -3
  54. package/search-api/src/fin/shapes.d.ts +2 -2
  55. package/search-api/src/internal-shapes.d.ts +2 -0
  56. package/search-api/src/provider/remote/deregistration.d.ts +2 -1
  57. package/search-api/src/provider/remote/registration.d.ts +1 -1
  58. package/search-api/src/shapes.d.ts +16 -21
  59. package/common/src/api/search.d.ts +0 -18
@@ -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 };
@@ -0,0 +1,3 @@
1
+ import { HomeClientApiDataRequest, HomeInternalDataResponse, HomeInternalErrorResponse, InternalDataResponse } from '../../../../../common/src/api/shapes/home';
2
+ export declare function pushDataResponse(res: InternalDataResponse): Promise<void>;
3
+ export declare function handleDataRequest(req: HomeClientApiDataRequest): Promise<HomeInternalDataResponse | HomeInternalErrorResponse>;
@@ -0,0 +1 @@
1
+ export declare function handleChannelDisconnection(): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { SearchAPIClientChannelClient } from '../../../../../common/src/api/protocol/shapes/search';
2
+ type HomeWorkspaceAPIClientChannelClient = SearchAPIClientChannelClient & {
3
+ homeChannelActionsRegistered?: boolean;
4
+ };
5
+ export declare function registerHomeChannelClientActions(channel: HomeWorkspaceAPIClientChannelClient): void;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ import type OpenFin from '@openfin/core';
2
+ import type { HomeClientApiDispatchRequest } from '../../../../../common/src/api/shapes/home';
3
+ export declare function handleResultDispatch(req: HomeClientApiDispatchRequest, identity: OpenFin.Identity): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { HomeClientApiSearchCloseRequest } from '../../../../../common/src/api/shapes/home';
2
+ /**
3
+ * Listens for search requests that have been closed.
4
+ */
5
+ export declare function handleSearchRequestClose(req: HomeClientApiSearchCloseRequest): void;
@@ -0,0 +1,4 @@
1
+ import { ProvidersMap } from '../../../../client-api/src/internal/providers';
2
+ import { CLIProvider, HomeProvider, RegisterMetaInfoInternal } from '../..';
3
+ export declare const HomeProviders: ProvidersMap<CLIProvider | HomeProvider>;
4
+ export declare const registerHomeProviderInternal: (provider: HomeProvider | CLIProvider) => Promise<RegisterMetaInfoInternal>;
@@ -0,0 +1,5 @@
1
+ import type { InternalSearchListenerRequest } from '../../../../common/src/api/shapes/home';
2
+ /**
3
+ * Map of search requests.
4
+ */
5
+ export declare const searchRequests: Map<string, InternalSearchListenerRequest>;
@@ -0,0 +1,63 @@
1
+ import { ProviderType } from '../../../common/src/api/provider';
2
+ export declare class ProviderNotRegisteredError extends Error {
3
+ constructor(providerType: ProviderType, id?: string);
4
+ }
5
+ export declare class ProviderAlreadyRegisteredError extends Error {
6
+ constructor(providerType: ProviderType, id?: string);
7
+ }
8
+ export declare class FailedToGetProviderError extends Error {
9
+ constructor(providerType: ProviderType, id?: string);
10
+ }
11
+ /**
12
+ * Utility class for managing providers.
13
+ */
14
+ export declare class ProvidersMap<T extends {
15
+ id: string;
16
+ }> {
17
+ private readonly providersMap;
18
+ private readonly providerType;
19
+ constructor(providerType: ProviderType);
20
+ /**
21
+ * Asserts that a provider is not already registered.
22
+ * @param provider The provider to check.
23
+ * @throws ProviderAlreadyRegisteredError if the provider already exists.
24
+ */
25
+ assertNotAlreadyRegistered(id: string): void;
26
+ /**
27
+ * Asserts that a provider is registered.
28
+ * @param provider The provider to check.
29
+ * @throws ProviderAlreadyRegisteredError if the provider already exists.
30
+ */
31
+ assertRegistered(id: string): void;
32
+ /**
33
+ * Gets a provider by id.
34
+ * @param id The id of the provider to get.
35
+ * @returns The provider if it exists, otherwise undefined.
36
+ */
37
+ getProvider(id: string): T | undefined;
38
+ /**
39
+ * Checks if a provider exists.
40
+ * @param id The id of the provider to check.
41
+ * @returns True if the provider exists, otherwise false.
42
+ */
43
+ hasProvider(id: string): boolean;
44
+ /**
45
+ * Sets a provider.
46
+ * @param provider The provider to set.
47
+ */
48
+ setProvider(provider: T): void;
49
+ /**
50
+ * Deletes a provider.
51
+ * @param id The id of the provider to delete.
52
+ */
53
+ deleteProvider(id: string): void;
54
+ /**
55
+ * Gets a provider by id or throws an error if it does not exist.
56
+ * @param id The id of the provider to get.
57
+ * @returns The provider if it exists.
58
+ * @throws An error if the provider does not exist.
59
+ * @see {@link ProviderNotRegisteredError}
60
+ */
61
+ getProviderOrFail(id: string): T;
62
+ clearProviders(): void;
63
+ }
@@ -0,0 +1,9 @@
1
+ import { WorkspaceAPIClientChannelClient } from '../../../../common/src/api/protocol/workspace';
2
+ type StorefrontWorkspaceAPIClientChannelClient = WorkspaceAPIClientChannelClient & {
3
+ storefrontChannelActionsRegistered?: boolean;
4
+ };
5
+ /**
6
+ * Registers a channel action for each function in the Storefront provider.
7
+ */
8
+ export declare const registerStorefrontChannelClientActions: (channel: StorefrontWorkspaceAPIClientChannelClient) => void;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ProvidersMap } from '../../../../client-api/src/internal/providers';
2
+ import { RegisterMetaInfoInternal, StorefrontProvider } from '../../../../client-api/src/shapes';
3
+ export declare const StorefrontProviders: ProvidersMap<StorefrontProvider>;
4
+ export declare const registerStorefrontProviderInternal: (provider: StorefrontProvider) => Promise<RegisterMetaInfoInternal>;
@@ -1,4 +1,4 @@
1
- import { WorkspaceChannelAction } from '../../common/src/api/protocol/shapes/workspace';
1
+ import { WorkspaceChannelAction } from '../../../common/src/api/protocol/shapes/workspace';
2
2
  export interface ChannelDispatch {
3
3
  action: WorkspaceChannelAction;
4
4
  payload?: any;
@@ -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 declare type RegisterMetaInfoInternal = Pick<RegistrationMetaInfo, 'workspaceVersion'>;