@openfin/workspace-platform 45.0.14 → 45.1.1

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.
@@ -1,3 +1,4 @@
1
+ import { PlatformError } from '../../../common/src/errors';
1
2
  import { ProviderType } from '../../../common/src/api/provider';
2
3
  /**
3
4
  * Error thrown when attempting to use a provider that is not registered.
@@ -7,7 +8,7 @@ import { ProviderType } from '../../../common/src/api/provider';
7
8
  * // Error: Dock Provider. Dock Provider with id my-dock-id is not currently registered.
8
9
  * ```
9
10
  */
10
- export declare class ProviderNotRegisteredError extends Error {
11
+ export declare class ProviderNotRegisteredError extends PlatformError {
11
12
  constructor(providerType: ProviderType, id?: string);
12
13
  }
13
14
  /**
@@ -19,7 +20,7 @@ export declare class ProviderNotRegisteredError extends Error {
19
20
  * // Error: Home Provider. Home Provider with id my-home-id is already registered.
20
21
  * ```
21
22
  */
22
- export declare class ProviderAlreadyRegisteredError extends Error {
23
+ export declare class ProviderAlreadyRegisteredError extends PlatformError {
23
24
  constructor(providerType: ProviderType, id?: string);
24
25
  }
25
26
  /**
@@ -31,7 +32,7 @@ export declare class ProviderAlreadyRegisteredError extends Error {
31
32
  * // Error: Failed to get Storefront Provider. Storefront Provider with id unknown-id is not currently registered.
32
33
  * ```
33
34
  */
34
- export declare class FailedToGetProviderError extends Error {
35
+ export declare class FailedToGetProviderError extends PlatformError {
35
36
  constructor(providerType: ProviderType, id?: string);
36
37
  }
37
38
  /**
@@ -7,7 +7,7 @@ import type { LaunchAppRequest, SearchSitesRequest, SearchSitesResponse, Site }
7
7
  * @param app the app directory entry.
8
8
  * @param opts launch options.
9
9
  */
10
- export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.Identity | OpenFin.Application | OpenFin.View | OpenFin.Platform>;
10
+ export declare function launchApp({ app, target }: LaunchAppRequest): Promise<void | OpenFin.Identity | OpenFin.View | OpenFin.Platform | OpenFin.Application>;
11
11
  export declare const enterpriseAppDirectoryChannelClient: () => Promise<OpenFin.ChannelClient>;
12
12
  export declare function getResults(payload: {
13
13
  req: SearchSitesRequest;
@@ -0,0 +1,2 @@
1
+ export declare const registerViewTabNewTabShortcutUsageTracking: () => void;
2
+ export declare const unregisterViewTabNewTabShortcutUsageTracking: () => void;
@@ -342,6 +342,14 @@ export declare enum ViewTabMenuOptionType {
342
342
  * Prints a screenshot of the browser window.
343
343
  */
344
344
  PrintScreen = "PrintScreen",
345
+ /**
346
+ * Translate the selected view's content to the detected target language.
347
+ */
348
+ TranslatePage = "TranslatePage",
349
+ /**
350
+ * Revert translated content back to the original language.
351
+ */
352
+ RevertTranslation = "RevertTranslation",
345
353
  /**
346
354
  * Custom context menu option defined by API client.
347
355
  */
@@ -307,7 +307,7 @@ export declare const constructThemePaletteSheet: (themes: GeneratedPalettes, leg
307
307
  dark: string;
308
308
  }) => string;
309
309
  export declare const getComputedPlatformTheme: (platformIdentity: OpenFin.Identity) => Promise<{
310
- theme: CustomThemes | GeneratedPalettes;
310
+ theme: GeneratedPalettes | CustomThemes;
311
311
  defaultScheme: ColorSchemeOptionType;
312
312
  themePaletteSheet: string;
313
313
  }>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * AppError — base class for all application errors.
3
+ *
4
+ * Use a subclass (NetworkError, PlatformError, etc.) — never instantiate AppError directly
5
+ * in production code. The class identity (`error.name`) is the category; `context` carries
6
+ * the specifics; `cause` chains the underlying error.
7
+ *
8
+ * `instanceof` is the supported way to branch on error type. `toJSON()` is what the
9
+ * existing logger's safeStringify uses to produce structured output, so logging an
10
+ * AppError preserves the full chain automatically.
11
+ */
12
+ export interface ErrorContext {
13
+ [key: string]: unknown;
14
+ }
15
+ export interface SerializedError {
16
+ name: string;
17
+ message: string;
18
+ context: ErrorContext;
19
+ stack?: string;
20
+ cause?: SerializedError;
21
+ timestamp: string;
22
+ }
23
+ export interface AppErrorOptions {
24
+ cause?: unknown;
25
+ context?: ErrorContext;
26
+ }
27
+ export declare class AppError extends Error {
28
+ readonly context: ErrorContext;
29
+ readonly timestamp: Date;
30
+ constructor(message: string, options?: AppErrorOptions);
31
+ serialize(): SerializedError;
32
+ /**
33
+ * Called automatically by JSON.stringify so `safeStringify({ error })` in the logger
34
+ * produces the full structured form without any logger changes.
35
+ */
36
+ toJSON(): SerializedError;
37
+ }
@@ -0,0 +1,23 @@
1
+ import { AppError, AppErrorOptions } from './AppError';
2
+ /** Put `{ url, status, method, timeoutMs }` in context as relevant. */
3
+ export declare class NetworkError extends AppError {
4
+ }
5
+ /** Put `{ field, received, expected }` in context. */
6
+ export declare class ValidationError extends AppError {
7
+ }
8
+ /** Put `{ status, scope, userId }` in context as available. */
9
+ export declare class AuthError extends AppError {
10
+ }
11
+ /** OpenFin / runtime / channel / provider failures. Put `{ providerId, channelName, identity }` in context. */
12
+ export declare class PlatformError extends AppError {
13
+ }
14
+ /** Read/write failures against persistent storage. Put `{ key, operation }` in context. */
15
+ export declare class StorageError extends AppError {
16
+ }
17
+ /** Bad or missing configuration discovered at runtime. Put `{ configKey, env }` in context. */
18
+ export declare class ConfigError extends AppError {
19
+ }
20
+ /** Catch-all. Prefer creating via `toAppError(unknown)` rather than directly. */
21
+ export declare class UnknownError extends AppError {
22
+ }
23
+ export type { AppErrorOptions };
@@ -0,0 +1,6 @@
1
+ export { AppError } from './AppError';
2
+ export type { AppErrorOptions, ErrorContext, SerializedError } from './AppError';
3
+ export { NetworkError, ValidationError, AuthError, PlatformError, StorageError, ConfigError, UnknownError } from './errors';
4
+ export { toAppError } from './toAppError';
5
+ export { ok, err, isOk, isErr, unwrap, mapResult } from './result';
6
+ export type { Ok, Err, Result } from './result';
@@ -0,0 +1,23 @@
1
+ import { AppError } from './AppError';
2
+ /**
3
+ * Result<T, E> — opt-in alternative to throwing for operations whose callers
4
+ * genuinely need to branch on success vs failure (e.g., a save that has a clear
5
+ * fallback path). Don't blanket-replace throws — invariant violations and
6
+ * programmer errors should still throw.
7
+ */
8
+ export type Ok<T> = {
9
+ readonly ok: true;
10
+ readonly value: T;
11
+ };
12
+ export type Err<E extends AppError = AppError> = {
13
+ readonly ok: false;
14
+ readonly error: E;
15
+ };
16
+ export type Result<T, E extends AppError = AppError> = Ok<T> | Err<E>;
17
+ export declare const ok: <T>(value: T) => Ok<T>;
18
+ export declare const err: <E extends AppError>(error: E) => Err<E>;
19
+ export declare const isOk: <T, E extends AppError>(r: Result<T, E>) => r is Ok<T>;
20
+ export declare const isErr: <T, E extends AppError>(r: Result<T, E>) => r is Err<E>;
21
+ /** Throw on Err, return value on Ok. Use sparingly — defeats the type-level branch. */
22
+ export declare const unwrap: <T, E extends AppError>(r: Result<T, E>) => T;
23
+ export declare const mapResult: <T, U, E extends AppError>(r: Result<T, E>, fn: (value: T) => U) => Result<U, E>;
@@ -0,0 +1,14 @@
1
+ import { AppError } from './AppError';
2
+ /**
3
+ * Narrow `unknown` (the type of a catch variable when `useUnknownInCatchVariables` is on)
4
+ * to an AppError. Pass through existing AppErrors unchanged; wrap raw Errors and other
5
+ * values in UnknownError, preserving the original via `cause`.
6
+ *
7
+ * @example
8
+ * try {
9
+ * await doThing();
10
+ * } catch (e) {
11
+ * throw toAppError(e);
12
+ * }
13
+ */
14
+ export declare const toAppError: (caught: unknown, fallbackMessage?: string) => AppError;
@@ -1,4 +1,41 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { ViewTabContextMenuTemplate } from '../../../client-api-platform/src/shapes';
3
3
  export declare const getChannelsMenuOptions: (channelsForViews: string[], colorGroups: OpenFin.ContextGroupInfo[]) => Promise<ViewTabContextMenuTemplate[]>;
4
- export declare const ENTERPRISE_COLOR_CHANNELS: Map<string, OpenFin.ContextGroupInfo['displayMetadata']>;
4
+ export declare const ENTERPRISE_COLOR_CHANNELS: {
5
+ readonly blue: {
6
+ readonly name: "Blue";
7
+ readonly color: "#0091EB";
8
+ };
9
+ readonly indigo: {
10
+ readonly name: "Indigo";
11
+ readonly color: "#6450FF";
12
+ };
13
+ readonly pink: {
14
+ readonly name: "Pink";
15
+ readonly color: "#E878CF";
16
+ };
17
+ readonly teal: {
18
+ readonly name: "Teal";
19
+ readonly color: "#24D1D1";
20
+ };
21
+ readonly green: {
22
+ readonly name: "Green";
23
+ readonly color: "#00AF78";
24
+ };
25
+ readonly orange: {
26
+ readonly name: "Orange";
27
+ readonly color: "#FF7D37";
28
+ };
29
+ readonly red: {
30
+ readonly name: "Red";
31
+ readonly color: "#F94144";
32
+ };
33
+ readonly yellow: {
34
+ readonly name: "Yellow";
35
+ readonly color: "#F9C74F";
36
+ };
37
+ readonly gray: {
38
+ readonly name: "Gray";
39
+ readonly color: "#828788";
40
+ };
41
+ };
@@ -27,4 +27,5 @@ export declare const getBoundsBasedOnAnchorBehavior: (bounds: OpenFin.Bounds, an
27
27
  height: number;
28
28
  width: number;
29
29
  };
30
+ export declare const getTranslateItems: (viewIdentities: OpenFin.Identity[]) => Promise<ViewTabContextMenuTemplate[]>;
30
31
  export declare const getPrintOption: () => Promise<ViewTabContextMenuTemplate | PageTabContextMenuItemTemplate>;
@@ -16,6 +16,11 @@ export declare enum ComponentName {
16
16
  Platform = "Platform",
17
17
  Theming = "Theming",
18
18
  Microflow = "Microflow",
19
+ SuppressWorkspaceSwitched = "SuppressWorkspaceSwitched",
20
+ SuppressWorkspaceSaved = "SuppressWorkspaceSaved",
21
+ AllowDuplicatePageTitles = "AllowDuplicatePageTitles",
22
+ PagePinning = "PagePinning",
23
+ ViewTabNewTabShortcut = "ViewTabNewTabShortcut",
19
24
  SupertabHideShowTabs = "PRODM-318: Supertab Hide/Show Tab Headers"
20
25
  }
21
26
  export declare const registerBrowserUsage: (status: RegisterUsageStatus) => void;
@@ -26,6 +31,11 @@ export declare const registerNotificationUsage: (status: RegisterUsageStatus) =>
26
31
  export declare const registerPlatformUsage: (status: RegisterUsageStatus) => void;
27
32
  export declare const registerThemingUsage: (status: RegisterUsageStatus) => void;
28
33
  export declare const registerMicroflowUsage: (microflowName: string, status: RegisterUsageStatus) => void;
34
+ export declare const registerSuppressWorkspaceSwitchedUsage: (status: RegisterUsageStatus) => void;
35
+ export declare const registerSuppressWorkspaceSavedUsage: (status: RegisterUsageStatus) => void;
36
+ export declare const registerAllowDuplicatePageTitlesUsage: (status: RegisterUsageStatus) => void;
37
+ export declare const registerPagePinningUsage: (status: RegisterUsageStatus) => void;
38
+ export declare const registerViewTabNewTabShortcutUsage: (status: RegisterUsageStatus) => void;
29
39
  export declare const registerSupertabHideShowTabsUsage: () => void;
30
40
  export type AnalyticsSource = 'Browser' | 'Dock' | 'Home' | 'Notification' | 'Store' | 'Platform' | 'Theming' | 'Interop';
31
41
  /**
@@ -21,14 +21,6 @@
21
21
  "issuer": "common/src/utils/color-linking.ts"
22
22
  }
23
23
  ],
24
- "lodash.clonedeep": [
25
- {
26
- "type": "explicit",
27
- "version": "4.5.0",
28
- "packageName": "common/package.json",
29
- "issuer": "common/src/utils/layout.ts"
30
- }
31
- ],
32
24
  "react-i18next": [
33
25
  {
34
26
  "type": "explicit",
@@ -70,5 +62,13 @@
70
62
  "packageName": "common/package.json",
71
63
  "issuer": "common/src/utils/create-and-migrate-ibd-store.ts"
72
64
  }
65
+ ],
66
+ "lodash.clonedeep": [
67
+ {
68
+ "type": "explicit",
69
+ "version": "4.5.0",
70
+ "packageName": "common/package.json",
71
+ "issuer": "common/src/utils/layout.ts"
72
+ }
73
73
  ]
74
74
  }