@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
@@ -0,0 +1,77 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ import type { LayoutExtended } from '../../utils/layout';
3
+ export interface PageLayoutDetails {
4
+ /** The id of the machine that created the page. */
5
+ machineId: string;
6
+ /** The name of the machine that created the page. */
7
+ machineName?: string;
8
+ }
9
+ export declare type PageLayout = LayoutExtended & {
10
+ layoutDetails?: PageLayoutDetails;
11
+ };
12
+ export interface Page {
13
+ /** A UI friendly title for the page. */
14
+ title: string;
15
+ /** The unique ID of the page. */
16
+ pageId: string;
17
+ /** An optional UI friendly description of the page. */
18
+ description?: string;
19
+ /** A optional UI friendly tooltip for the page. */
20
+ tooltip?: string;
21
+ /** True if the page is read only. In this state, the page is locked and cannot be unlocked. */
22
+ isReadOnly?: boolean;
23
+ /** The layout of the page. */
24
+ layout: PageLayout;
25
+ }
26
+ declare type AttachedPageMetadata = {
27
+ /** The window the page is currently attached to. */
28
+ parentIdentity?: OpenFin.Identity;
29
+ /** True if the page is the currently active page for its parent window. */
30
+ isActive?: boolean;
31
+ /** True if the page has unsaved changes. */
32
+ hasUnsavedChanges?: boolean;
33
+ };
34
+ export declare type AttachedPage = Page & AttachedPageMetadata;
35
+ export declare type PageWithUpdatableRuntimeAttribs = Page & Pick<AttachedPage, 'hasUnsavedChanges'>;
36
+ export interface DetachPagesFromWindowPayload {
37
+ /** The OF window identity to detach the pages from. */
38
+ identity: OpenFin.Identity;
39
+ /** The ids of the pages to detach. */
40
+ pageIds: string[];
41
+ }
42
+ export interface SetActivePageForWindowPayload {
43
+ /** The OF window identity to set the active page of. */
44
+ identity: OpenFin.Identity;
45
+ /**
46
+ * The id of the page to set as active.
47
+ * The page must be attached to the target window.
48
+ */
49
+ pageId: string;
50
+ }
51
+ export interface ReorderPagesForWindowPayload {
52
+ /** The OF window identity the pages to change the order of. */
53
+ identity: OpenFin.Identity;
54
+ /** The ordered ids of the attached pages. */
55
+ pageIds: string[];
56
+ }
57
+ export interface UpdatePageForWindowPayload {
58
+ /** The OF window identity the pages to change the order of. */
59
+ identity: OpenFin.Identity;
60
+ /** The id of the attached page to update. */
61
+ pageId: string;
62
+ /** The partial updated state of the page. */
63
+ page: Partial<PageWithUpdatableRuntimeAttribs>;
64
+ }
65
+ export interface AttachPagesToWindowPayload {
66
+ /** The OF window identity to attach the pages to. */
67
+ identity: OpenFin.Identity;
68
+ /** The pages to attach. */
69
+ pages: PageWithUpdatableRuntimeAttribs[];
70
+ }
71
+ export interface GetSavedPageMetadataPayload {
72
+ /** The OF window identity to attach the pages to. */
73
+ identity: OpenFin.Identity;
74
+ /** The id of the page to get the save state of. */
75
+ pageId: string;
76
+ }
77
+ export {};
@@ -0,0 +1,63 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ /** The name of the channel for the centralized workspace protocol. */
3
+ export declare const channelName = "__of_workspace_protocol__";
4
+ /**
5
+ * All of the remote procedures that can be called in the
6
+ * Workspace Provider's address space.
7
+ *
8
+ * When adding a new channel action make sure to register a
9
+ * handler for the remote procedure in the Workspace Provider.
10
+ * All of the registered channel action handlers can be found here:
11
+ * @see link: [Provider Protocol Handlers](https://github.com/openfin/workspace/provider/src/api/protocol.ts)
12
+ */
13
+ export declare enum ChannelAction {
14
+ RegisterStorefrontProvider = "register-storefront-provider",
15
+ DeregisterStorefrontProvider = "deregister-storefront-provider",
16
+ GetStorefrontProviders = "get-storefront-providers",
17
+ HideStorefront = "hide-storefront",
18
+ GetStorefrontProviderApps = "get-storefront-provider-apps",
19
+ GetStorefrontProviderLandingPage = "get-storefront-provider-landing-page",
20
+ GetStorefrontProviderFooter = "get-storefront-provider-footer",
21
+ GetStorefrontProviderNavigation = "get-storefront-provider-navigation",
22
+ LaunchStorefrontProviderApp = "launch-storefront-provider-app",
23
+ ShowStorefront = "show-storefront",
24
+ CreateStorefrontWindow = "create-storefront-window",
25
+ ShowHome = "show-home",
26
+ HideHome = "hide-home",
27
+ AssignHomeSearchContext = "assign-home-search-context",
28
+ GetLegacyPages = "get-legacy-pages",
29
+ GetLegacyWorkspaces = "get-legacy-workspaces"
30
+ }
31
+ export interface ChannelClient extends OpenFin.ChannelClient {
32
+ dispatch: (action: ChannelAction, payload: any) => Promise<any>;
33
+ }
34
+ /**
35
+ * Get a channel client for the centralized Workspace protocol.
36
+ *
37
+ * The channel client is automatically connected to the Workspace Provider,
38
+ * in which acts as a centralized location for executing Workspace API logic.
39
+ *
40
+ * The channel client can execute remote procedures on the provider via its `dispatch` function.
41
+ * A call to the `dispatch` function will block until the channel action has concluded execution
42
+ * in the Workspace Provider's address space.
43
+ * For a list of supported procedures, see the `ChannelAction` enum.
44
+ *
45
+ * @returns the channel client for the centralized workspace protocol.
46
+ */
47
+ export declare const getChannelClient: () => Promise<ChannelClient>;
48
+ /**
49
+ * Returns true if the current application was launched via a library (such as the Client APIs).
50
+ * Otherwise, returns false.
51
+ */
52
+ export declare const isLaunchedViaLib: () => Promise<boolean>;
53
+ /**
54
+ * Launches the Workspace Provider.
55
+ * If the Workspace Provider is already running, does nothing.
56
+ */
57
+ export declare const launchProvider: () => Promise<void>;
58
+ /**
59
+ * Launches the Workspace provider if it is not running.
60
+ * Then gets a Channel Client that is connected to the Workspace Provider.
61
+ * @returns the Channel Client that is connected to the Workspace Provider.
62
+ */
63
+ export declare const getChannelClientAndLaunchProvider: () => Promise<ChannelClient>;
@@ -0,0 +1,17 @@
1
+ import { searchTopic as homeSearchTopic } from '@common/api/home';
2
+ import type { CLISearchResultWithTemplate } from '@client/shapes';
3
+ import type { Action as BaseAction, SearchProviderInfo, SearchProviderResponse, SearchTopicClient } from '@search/shapes';
4
+ export interface Action extends BaseAction {
5
+ isHidden: boolean;
6
+ dispatch: () => any;
7
+ }
8
+ export interface SearchItem {
9
+ providerInfo: SearchProviderInfo;
10
+ result: CLISearchResultWithTemplate<any, any, Action>;
11
+ actions: Action[];
12
+ key: string;
13
+ }
14
+ export declare type Topic = typeof homeSearchTopic;
15
+ export declare function waitForSearchRegistration(): Promise<void>;
16
+ export declare function getTopic(topic: Topic): Promise<SearchTopicClient>;
17
+ export declare function mapSearchResponsesToItems(topic: Topic, responses: SearchProviderResponse[]): SearchItem[];
@@ -0,0 +1,72 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ import { App, StorefrontFooter, StorefrontLandingPage, StorefrontNavigationItemAppGrid, StorefrontNavigationSection, StorefrontProviderInfo } from '@client/shapes';
3
+ export interface StorefrontProviderInfoWithIdentity extends StorefrontProviderInfo {
4
+ platformIdentity: OpenFin.Identity;
5
+ }
6
+ export interface LaunchStorefrontAppRequest {
7
+ app: App;
8
+ platformIdentity?: OpenFin.Identity;
9
+ }
10
+ export interface StorefrontProviderIdentity {
11
+ /**
12
+ * The ID of the Storefront Provider.
13
+ */
14
+ id: string;
15
+ /**
16
+ * The platform identity that registered the Storefront Provider.
17
+ */
18
+ platformIdentity: OpenFin.Identity;
19
+ }
20
+ export interface LaunchStorefrontProviderAppRequest extends StorefrontProviderIdentity {
21
+ app: App;
22
+ }
23
+ /**
24
+ * Launch a Storefront app.
25
+ * @param platformIdentity the identity of the platform that provided the app.
26
+ */
27
+ export declare const launchStorefrontApp: (req: LaunchStorefrontProviderAppRequest) => Promise<void>;
28
+ /**
29
+ * Get a list of applications for Storefront.
30
+ * @param platformIdentity the identity of the platform to get the apps from.
31
+ * @returns the list of Storefront apps for the platform.
32
+ */
33
+ export declare const getStorefrontApps: (identity: StorefrontProviderIdentity) => Promise<App[]>;
34
+ /**
35
+ * Get a list of all providers that have registered with the Storefront API.
36
+ */
37
+ export declare const getStorefrontProviders: () => Promise<StorefrontProviderInfoWithIdentity[]>;
38
+ export declare const showStorefront: () => Promise<any>;
39
+ /**
40
+ * Get the platform's landing page for Storefront.
41
+ * @param platformIdentity the identity of the platform to get the landing page of.
42
+ * @returns the platform's landing page.
43
+ */
44
+ export declare const getStorefrontLandingPage: (identity: StorefrontProviderIdentity) => Promise<StorefrontLandingPage | undefined>;
45
+ /**
46
+ * Get the platform's footer for Storefront.
47
+ * @param platformIdentity the identity of the platform to get the footer of.
48
+ * @returns the platform's footer.
49
+ */
50
+ export declare const getStorefrontFooter: (identity: StorefrontProviderIdentity) => Promise<StorefrontFooter>;
51
+ /**
52
+ * Get the platform's navigation for Storefront.
53
+ * @param platformIdentity the identity of the platform to get the navigation of.
54
+ * @returns the platform's navigation.
55
+ */
56
+ export declare const getStorefrontNavigation: (identity: StorefrontProviderIdentity) => Promise<[StorefrontNavigationSection?, StorefrontNavigationSection?]>;
57
+ /**
58
+ * A helper method that gets a Storefront navigation item by ID.
59
+ * @param navigationItemId the id of the Storefront navigation item.
60
+ * @param platformIdentity the platform identity.
61
+ * @returns the navigation item with the ID.
62
+ */
63
+ export declare const getStorefrontNavigationItemAppGrid: (navigationItemId: string, identity: StorefrontProviderIdentity) => Promise<StorefrontNavigationItemAppGrid | undefined>;
64
+ /**
65
+ * A function to dispatch hiding the Storefront of current OF identity
66
+ * @returns action to hide Storefront
67
+ */
68
+ export declare const hideStorefront: () => Promise<void>;
69
+ /**
70
+ * Create the Storefront main window.
71
+ */
72
+ export declare function createStorefrontWindow(): Promise<any>;
@@ -0,0 +1,7 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ export interface Workspace {
3
+ workspaceId: string;
4
+ title: string;
5
+ snapshot: OpenFin.Snapshot;
6
+ }
7
+ export declare const getLegacyWorkspaces: () => Promise<Workspace[]>;
@@ -0,0 +1,38 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ export declare enum ApplicationUUID {
3
+ /**
4
+ * The UUID of workspace.
5
+ * Home is a part of this application.
6
+ */
7
+ Workspace = "openfin-browser"
8
+ }
9
+ export interface ApplicationEvent {
10
+ viewIdentity?: OpenFin.Identity;
11
+ name?: string;
12
+ uuid?: string;
13
+ }
14
+ export declare type ApplicationListener = (ev: ApplicationEvent) => void;
15
+ export declare enum ApplicationEventType {
16
+ RunRequested = "run-requested",
17
+ WindowOptionsChanged = "window-options-changed",
18
+ WindowClosed = "window-closed",
19
+ WindowCreated = "window-created"
20
+ }
21
+ export declare enum LaunchModeType {
22
+ FinProtocol = "fin-protocol"
23
+ }
24
+ export declare type ApplicationInfoExtended = OpenFin.ApplicationInfo & {
25
+ initialOptions: OpenFin.ApplicationInfo['initialOptions'] & {
26
+ userAppConfigArgs: any;
27
+ };
28
+ };
29
+ export declare const currentOFAppIdentity: {
30
+ uuid: string;
31
+ name: string;
32
+ };
33
+ export declare const workspaceOFAppIdentity: {
34
+ name: ApplicationUUID;
35
+ uuid: ApplicationUUID;
36
+ };
37
+ export declare const getCurrentOFApplication: () => import("openfin-adapter").Application;
38
+ export declare const getWorkspaceOFApplication: () => import("openfin-adapter").Application;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Make a function that connects to a channel.
3
+ * If already connected to the channel, will return the channel connection.
4
+ * If disconnected from the channel, will automatically reconnect.
5
+ * @param channelName the name of the channel to connect to.
6
+ * @returns the function to connect to the channel.
7
+ */
8
+ export default function makeGetChannelClient(channelName: string): () => Promise<import("openfin-adapter").ChannelClient>;
@@ -0,0 +1,30 @@
1
+ export declare enum Env {
2
+ Local = "local",
3
+ Dev = "dev",
4
+ Staging = "staging",
5
+ Prod = "prod"
6
+ }
7
+ export declare const isFin: boolean;
8
+ export declare const isJest: boolean;
9
+ export declare const isWindowDefined: boolean;
10
+ export declare const isDocumentDefined: boolean;
11
+ export declare const isWindowDefinedWithIndexDB: boolean;
12
+ export declare const finUUID: string;
13
+ export declare const finName: string;
14
+ export declare const finEntityType: "" | import("openfin-adapter/src/shapes/EntityType").EntityType;
15
+ export declare const env: Env;
16
+ export declare const isEnvLocal: boolean;
17
+ export declare const isEnvDev: boolean;
18
+ export declare const isEnvStaging: boolean;
19
+ export declare const isEnvProd: boolean;
20
+ export declare const isLibrary: boolean;
21
+ export declare const workspaceProviderFinsLink: string;
22
+ export declare const workspaceProviderFallbackUrl: string;
23
+ export declare const workspaceAppsUrl: string;
24
+ export declare const workspaceStorefrontFooterUrl: string;
25
+ export declare const workspaceStorefrontLandingPageUrl: string;
26
+ export declare const workspaceStorefrontNavigationUrl: string;
27
+ export declare const workspaceShareUrl: string;
28
+ export declare const workspaceCdnUrl: string;
29
+ export declare const workspaceCdnEnvUrl: string;
30
+ export declare const workspaceRuntimeVersion: string;
@@ -0,0 +1,52 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ export declare type LayoutComponentStateExtended = OpenFin.LayoutComponent['componentState'] & {
3
+ name: string;
4
+ uuid: string;
5
+ };
6
+ export declare type LayoutComponentExtended = Omit<OpenFin.LayoutComponent, 'componentState'> & {
7
+ componentState: LayoutComponentStateExtended;
8
+ };
9
+ export declare type LayoutStack = {
10
+ type: 'stack';
11
+ content: OpenFin.LayoutContent;
12
+ };
13
+ export declare type LayoutContentItemExtended = OpenFin.LayoutRow | OpenFin.LayoutColumn | LayoutComponentExtended | LayoutStack;
14
+ export declare type LayoutContentExtended = LayoutContentItemExtended[];
15
+ export declare type LayoutSettingsExtended = OpenFin.LayoutOptions['settings'] & {
16
+ reorderEnabled?: boolean;
17
+ };
18
+ export declare type LayoutExtended = {
19
+ settings?: LayoutSettingsExtended;
20
+ content: LayoutContentExtended;
21
+ };
22
+ export declare enum LayoutDOMEventType {
23
+ TabCreated = "tab-created",
24
+ ContainerCreated = "container-created",
25
+ ContainerResized = "container-resized"
26
+ }
27
+ export interface LayoutDOMEvent {
28
+ type: LayoutDOMEventType;
29
+ detail: {
30
+ containerSelector: string;
31
+ tabSelector: string;
32
+ };
33
+ isInitialized: boolean;
34
+ }
35
+ export declare type LayoutDOMEventListener = (ev: LayoutDOMEvent) => void;
36
+ /**
37
+ * Deep clones a layout and removes view names.
38
+ * @param layout The Layout to be cloned
39
+ * @returns A copy of the layout with names removed
40
+ */
41
+ export declare const cloneLayoutAndRemoveNames: (layout: any) => any;
42
+ export declare const mapContentComponentState: (content: OpenFin.LayoutContent | LayoutContentExtended) => LayoutComponentStateExtended[];
43
+ export declare const getLayoutWithSingleView: (title: string, url: string) => Promise<any>;
44
+ export declare const isLayoutTabActive: (tabSelector: string) => boolean;
45
+ export declare const containerId = "layout_container";
46
+ export declare const getViewComponents: () => LayoutContentExtended;
47
+ export declare const removeLayoutView: (name: string) => Promise<void>;
48
+ export declare const addLayoutEventListener: (event: LayoutDOMEventType, listener: LayoutDOMEventListener) => void;
49
+ /**
50
+ * Initialize the layout for the current OF window.
51
+ */
52
+ export declare const initLayout: () => Promise<void>;
@@ -0,0 +1,8 @@
1
+ declare enum LocalStorageKey {
2
+ LastLaunchedWorkspaceId = "activeWorkspaceId",
3
+ LastFocusedBrowserWindow = "lastFocusedBrowserWindow",
4
+ MachineName = "machineName",
5
+ NewTabPageLayout = "NewTabPageLayout",
6
+ NewTabPageSort = "NewTabPageSort"
7
+ }
8
+ export default LocalStorageKey;
@@ -0,0 +1,26 @@
1
+ import { LogLocal } from './shapes';
2
+ /**
3
+ * Responsible of capturing log information locally and centrally alongside the logs of other windows/views.
4
+ *
5
+ * **Warning: if you don't specify a name then it will still log out your messages but it becomes harder to distinguish where the log entry came from**
6
+ *
7
+ * Basic usage example:
8
+ *
9
+ * ```ts
10
+ * import logger from '../utils/logger';
11
+ * const log = logger("My Component");
12
+ *
13
+ * log.info("Initialised.");
14
+ * ```
15
+ * More information can be found [here](https://github.com/openfin/browser/blob/main/docs/Logging.md)
16
+ * @param name Specify a name for this logger that will be the prefix of all log messages.
17
+ * @param logLocal Specify an object to say what loglevel should be logged to the local window console e.g. { info: true }.
18
+ */
19
+ export default function logger(name?: string, logLocal?: LogLocal): {
20
+ trace: (message: string, ...args: any[]) => void;
21
+ debug: (message: string, ...args: any[]) => void;
22
+ info: (message: string, ...args: any[]) => void;
23
+ warn: (message: string, ...args: any[]) => void;
24
+ error: (message: string, error?: any, ...args: any[]) => void;
25
+ fatal: (message: string, error?: any, ...args: any[]) => void;
26
+ };
@@ -0,0 +1,35 @@
1
+ import { LogEntry, LogOptions } from './shapes';
2
+ declare class LogInterface {
3
+ private worker;
4
+ private name;
5
+ private requestResponseHandler;
6
+ private errorListeners;
7
+ constructor();
8
+ getLogs(fromId?: number): Promise<LogEntry[]>;
9
+ trace(message: string, sourceName?: string, args?: any[]): void;
10
+ debug(message: string, sourceName?: string, args?: any[]): void;
11
+ info(message: string, sourceName?: string, args?: any[]): void;
12
+ warn(message: string, sourceName?: string, args?: any[]): void;
13
+ error(message: string, error?: any, sourceName?: string, args?: any[]): void;
14
+ fatal(message: string, error?: any, sourceName?: string, args?: any[]): void;
15
+ configure(options: LogOptions): void;
16
+ onLogError(listener: (error: Error) => void): void;
17
+ removeListener(listener: (...args: unknown[]) => void): void;
18
+ private log;
19
+ private listener;
20
+ }
21
+ /**
22
+ * Responsible for managing the way logging behaves and retrieving logs. Additionally exposes logging functions but logger should be used for logging.
23
+ *
24
+ * Basic usage example:
25
+ *
26
+ * ```ts
27
+ * import logManager from '../utils/log-manager';
28
+ *
29
+ * const logs = await logManager.getLogs();
30
+ *
31
+ * ```
32
+ * More information can be found [here](https://github.com/openfin/browser/blob/main/docs/Logging.md)
33
+ */
34
+ declare let instance: LogInterface | undefined;
35
+ export default instance;
@@ -0,0 +1,27 @@
1
+ export declare type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
2
+ export interface LogOptions {
3
+ instanceId?: string;
4
+ auditLimit?: number;
5
+ auditLevel?: LogLevel;
6
+ logLevel?: LogLevel;
7
+ }
8
+ export declare type LogLocal = {
9
+ [key in LogLevel]?: boolean;
10
+ };
11
+ export interface LogEntry {
12
+ id?: number;
13
+ level: LogLevel;
14
+ name: string;
15
+ source?: string;
16
+ message: string;
17
+ error?: string;
18
+ ts?: number;
19
+ data?: any[];
20
+ }
21
+ export interface GetLogOptions {
22
+ from?: number;
23
+ responseId: number;
24
+ }
25
+ export declare const LogColors: {
26
+ [key in LogLevel]: string;
27
+ };
@@ -0,0 +1,33 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ export declare type SnapshotDetailsExtended = OpenFin.Snapshot['snapshotDetails'] & {
3
+ machineId: string;
4
+ machineName?: string;
5
+ };
6
+ export declare type SnapshotExtended = {
7
+ snapshotDetails: SnapshotDetailsExtended;
8
+ windows: OpenFin.WindowOptions[];
9
+ };
10
+ export declare type ApplySnapshotOptionsExtended = OpenFin.ApplySnapshotOptions & {
11
+ attachToExistingWindow: boolean;
12
+ };
13
+ /**
14
+ * Set a friendly name of the current machine.
15
+ * @param name the friendly name.
16
+ */
17
+ export declare function setMachineName(name: string): void;
18
+ /**
19
+ * Get the machine's friendly name.
20
+ * @returns the machine's friendly name.
21
+ */
22
+ export declare function getMachineName(): string;
23
+ /**
24
+ * Get the current machine ID.
25
+ * @returns the machine ID.
26
+ */
27
+ export declare function getMachineId(): Promise<string>;
28
+ /**
29
+ * Get a snapshot with extra snapshot details.
30
+ * @param snapshot the snapshot to extend.
31
+ * @returns the snapshot with more snapshot details.
32
+ */
33
+ export declare function getSnapshotExtended(snapshot?: OpenFin.Snapshot): Promise<SnapshotExtended>;
@@ -0,0 +1,2 @@
1
+ declare const injectAPI: (namespace: string, api: any) => void;
2
+ export default injectAPI;
@@ -0,0 +1,146 @@
1
+ /// <reference types="openfin-adapter/fin" />
2
+ import type { Fin } from 'openfin-adapter';
3
+ import type { _Window } from 'openfin-adapter/src/api/window';
4
+ import { ApplicationUUID } from './application';
5
+ export declare type WindowFin = Fin<'window'>;
6
+ export declare enum WindowName {
7
+ Home = "openfin-home",
8
+ Dock = "openfin-dock",
9
+ Storefront = "openfin-storefront",
10
+ HomeInternal = "openfin-home-internal",
11
+ BrowserMenu = "openfin-browser-menu",
12
+ BrowserIndicator = "openfin-browser-indicator",
13
+ BrowserWindow = "internal-generated-window"
14
+ }
15
+ export declare enum WindowEvent {
16
+ Shown = "shown",
17
+ BoundsChanged = "bounds-changed",
18
+ LayoutReady = "layout-ready",
19
+ EndUserBoundsChanging = "end-user-bounds-changing",
20
+ Blurred = "blurred",
21
+ CloseRequested = "close-requested",
22
+ Focused = "focused",
23
+ ShowRequested = "show-requested",
24
+ ViewCrashed = "view-crashed",
25
+ ViewAttached = "view-attached",
26
+ ViewDetached = "view-detached",
27
+ ViewPageTitleUpdated = "view-page-title-updated",
28
+ ViewDestroyed = "view-destroyed"
29
+ }
30
+ export interface WindowIdentity {
31
+ uuid: ApplicationUUID | string;
32
+ name: WindowName | string;
33
+ }
34
+ interface Point {
35
+ left: number;
36
+ top: number;
37
+ }
38
+ interface Size {
39
+ height: number;
40
+ width: number;
41
+ }
42
+ /**
43
+ * Gets the center point of a window given its bounds
44
+ * @param bounds OpenFin bounds - left, top, height, width
45
+ * @returns coords representing the center - left, top
46
+ */
47
+ export declare const getCenterFromBounds: (bounds: OpenFin.WindowBounds) => Point;
48
+ /**
49
+ * Gets the top and left coords of a window given its size and center point
50
+ * @param center point representing the desired center coords
51
+ * @param size height and width of the window
52
+ * @returns coords representing the left, top of window given the center point
53
+ */
54
+ export declare const getBoundsFromCenter: (center: Point, size: Size) => Point;
55
+ /**
56
+ * Get a wrapped OpenFin window.
57
+ *
58
+ * This method can only be used in an OF env.
59
+ * If used outside of OF, such as in a pre-rendering context, will throw a clear and traceable error.
60
+ *
61
+ * @param identity the window identity.
62
+ * @returns the wrapped OpenFin window identity.
63
+ */
64
+ export declare function getOFWindow(identity: WindowIdentity): _Window;
65
+ /**
66
+ * The OpenFin identity for the current window.
67
+ */
68
+ export declare const currentOFIdentity: WindowIdentity;
69
+ /**
70
+ * Get the current OpenFin window.
71
+ */
72
+ export declare function getCurrentOFWindow(): _Window;
73
+ /**
74
+ * The OpenFin identity for Home.
75
+ */
76
+ export declare const homeOFIdentity: WindowIdentity;
77
+ export declare const dockOFIdentity: WindowIdentity;
78
+ export declare const StorefrontOFIdentity: WindowIdentity;
79
+ export declare const providerOFIdentity: WindowIdentity;
80
+ /**
81
+ * Get the Home OpenFin window.
82
+ */
83
+ export declare function getHomeOFWindow(): _Window;
84
+ export declare function getDockOFWindow(): _Window;
85
+ /**
86
+ * Helper for max and restoring a window.
87
+ * @param identity the identity of the window to maximize or restore.
88
+ */
89
+ export declare function maxOrRestore(identity: WindowIdentity): Promise<void>;
90
+ /**
91
+ * Helper for showing a window.
92
+ * This method ensures the window is shown, brought to front and focused.
93
+ * @param identity the identity of the window to show.
94
+ */
95
+ export declare function showAndFocus(identity: WindowIdentity): Promise<void>;
96
+ /**
97
+ * Helper for hiding a window.
98
+ * This method ensures the window is hidden and blurred.
99
+ * @param identity the identity of the window to hide.
100
+ */
101
+ export declare function hideAndBlur(identity: WindowIdentity): Promise<void>;
102
+ /**
103
+ * Helper for showing / hiding a window.
104
+ * This method calls showAndFocus / hideAndBlur
105
+ * @param identity the identity of the window to hide.
106
+ */
107
+ export declare function toggleVisibility(identity: WindowIdentity): Promise<void>;
108
+ export declare const toggleDock: () => Promise<void>;
109
+ export declare const showAndFocusDock: () => Promise<void>;
110
+ export declare function isAnimatingSize(): boolean;
111
+ /**
112
+ * Resizes a window to width and height saved in the store
113
+ * if they differ from current window size.
114
+ */
115
+ export declare function restoreWindowSize(): Promise<void>;
116
+ export declare function animateSize(width: number, height: number): Promise<void>;
117
+ /**
118
+ * Returns true if the window name is that of a browser window.
119
+ * @param name the window name.
120
+ * @returns true if the name is that of a browser window's.
121
+ */
122
+ export declare const isBrowserWindow: (name: string) => boolean;
123
+ /**
124
+ * Force document body size. Called when resizing or on scaling changes.
125
+ */
126
+ export declare function forceBodySize(): void;
127
+ /**
128
+ * Gets all currently open browser windows.
129
+ */
130
+ export declare function getBrowserWindows(): Promise<_Window[]>;
131
+ /**
132
+ * Closes all currently open Browser windows.
133
+ */
134
+ export declare function closeBrowserWindows(): Promise<void>;
135
+ /**
136
+ * Returns true if the OpenFin window for the provided identity is running.
137
+ * */
138
+ export declare const isWindowRunning: (identity: WindowIdentity) => Promise<boolean>;
139
+ /**
140
+ * Check if Storefront window is running.
141
+ * @returns true if the Storefront window is running.
142
+ */
143
+ export declare const isStorefrontWindowRunning: () => Promise<boolean>;
144
+ export declare const isHomeWindowRunning: () => Promise<boolean>;
145
+ export declare const showAndFocusStorefront: () => Promise<void>;
146
+ export {};
package/index.d.ts CHANGED
@@ -1,6 +1 @@
1
- import * as StorefrontAPI from './storefront';
2
- export * from './common';
3
- /**
4
- * Namespace for Storefront integrations.
5
- */
6
- export declare const Storefront: typeof StorefrontAPI;
1
+ export * from './client-api/src';