@openfin/workspace 11.0.6 → 12.1.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.
@@ -5,6 +5,21 @@ export * from './shapes/dock';
5
5
  * Registers a Dock provider
6
6
  * @returns promise - invokes action
7
7
  * ```ts
8
+ * const provider: DockProvider = {
9
+ * id: 'provider-id',
10
+ * title: 'Sample Dock',
11
+ * icon: 'https://www.openfin.co/favicon-32x32.png',
12
+ * buttons: [
13
+ * {
14
+ * tooltip: 'Sample Button 1',
15
+ * iconUrl: 'https://www.openfin.co/favicon-32x32.png',
16
+ * action: {
17
+ * id: 'sampleButton1'
18
+ * }
19
+ * }
20
+ * ]
21
+ * };
22
+ *
8
23
  * await Dock.register(provider)
9
24
  * ```
10
25
  */
@@ -39,7 +39,7 @@ export interface WorkspaceComponentButtonOptions {
39
39
  * A dropdown button presents a list of options the user can choose from.
40
40
  * An action button initiates a single task or action only.
41
41
  */
42
- export declare enum DockButtonNames {
42
+ export declare const enum DockButtonNames {
43
43
  ActionButton = "ActionButton",
44
44
  DropdownButton = "DropdownButton"
45
45
  }
@@ -315,6 +315,35 @@ export interface CLIProvider extends SearchProvider {
315
315
  /**
316
316
  * A CLI provider responds to search requests from Home UI.
317
317
  * Exposes search features that are specifically supported by Home.
318
+ *
319
+ * <h3>Sample HomeProvider definition.</h3>
320
+ *
321
+ * Import required dependencies.
322
+ * ```ts
323
+ * import { Home, HomeProvider } from '@openfin/workspace';
324
+ * ```
325
+ *
326
+ * Create provider object to configure `Home`.
327
+ *
328
+ * ```ts
329
+ * const provider: HomeProvider = {
330
+ * id: 'provider-id',
331
+ * title: 'Sample Home',
332
+ * icon: 'https://www.openfin.co/favicon-32x32.png',
333
+ * description: 'A short description of the Search Provider.',
334
+ * onResultDispatch: () => { } // Handle Result Dispatch
335
+ * onUserInput: () => { } // Handle User Input
336
+ * };
337
+ * ```
338
+ *
339
+ * Register home ``provider`` object.
340
+ * ```ts
341
+ * await Home.register(provider);
342
+ * ```
343
+ * Show Home.
344
+ * ```ts
345
+ * await Home.show();
346
+ * ```
318
347
  */
319
348
  export interface HomeProvider extends CLIProvider {
320
349
  onUserInput(req: HomeSearchListenerRequest, res: HomeSearchListenerResponse): Promise<HomeSearchResponse>;
@@ -328,7 +357,7 @@ export interface SearchQueryWithProviderID {
328
357
  query: string;
329
358
  }
330
359
  /**
331
- * Reponse from home registration which includes metadata and a function to inject search string into home search
360
+ * Response from home registration which includes metadata and a function to inject search string into home search
332
361
  */
333
362
  export interface HomeRegistration extends RegistrationMetaInfo {
334
363
  /**
@@ -3,10 +3,10 @@
3
3
  */
4
4
  import type { NotificationPlatform as NotificationsPlatformInternal } from 'openfin-notifications';
5
5
  /**
6
- * Platform object to pass to `registerPlatform` function.
6
+ * Platform object to pass to `register` function.
7
7
  *
8
8
  * ```ts
9
- * import { registerPlatform, NotificationsPlatform } from '@openfin/workspace/notifications';
9
+ * import { register, NotificationsPlatform } from '@openfin/workspace/notifications';
10
10
  *
11
11
  * const platform: NotificationsPlatform = {
12
12
  * id: 'my-notifications-platform',
@@ -14,7 +14,7 @@ import type { NotificationPlatform as NotificationsPlatformInternal } from 'open
14
14
  * icon: 'https://link.to/my-notifications-platform.ico'
15
15
  * }
16
16
  *
17
- * await registerPlatform(platform);
17
+ * await register(platform);
18
18
  * ```
19
19
  */
20
20
  export declare type NotificationsPlatform = Omit<NotificationsPlatformInternal, 'theme'>;
@@ -3,6 +3,7 @@
3
3
  * up the packaged typing files. When writing code examples,
4
4
  * for documentation, please use async/await syntax over .then()!
5
5
  */
6
+ import { UpdateButtonConfigRequest } from '../../../client-api/src/store';
6
7
  import { CustomButtonConfig, RegistrationMetaInfo } from './common';
7
8
  import { ProviderInfo } from './provider';
8
9
  /**
@@ -225,6 +226,31 @@ export interface StorefrontNavigationItemAppGrid extends StorefrontNavigationIte
225
226
  */
226
227
  templateData: StorefrontAppGrid;
227
228
  }
229
+ /**
230
+ * Response from store registration which includes metadata and a function to update app cards buttons.
231
+ */
232
+ export interface StoreRegistration extends RegistrationMetaInfo {
233
+ /**
234
+ * Function to updates app card button config.
235
+ * @example Updating primary button title and disabled flag.
236
+ * @param request object that contains primary button and secondary buttons configs that will be
237
+ * used to update button configuration returned by provider for an app.
238
+ *
239
+ * ```ts
240
+ * registration = await Store.register(provider);
241
+ * registration.updateAppCardButtons({
242
+ * appId: request.payload.appId,
243
+ * primaryButton: {
244
+ * ...request.payload.sourcePrimaryButton,
245
+ * title: "Primary button is now disabled",
246
+ * disabled: true
247
+ * },
248
+ * secondaryButtons: request.payload.sourceSecondaryButtons
249
+ * });
250
+ * ```
251
+ */
252
+ updateAppCardButtons: (request: UpdateButtonConfigRequest) => Promise<void>;
253
+ }
228
254
  /**
229
255
  * Template for rendering a navigation item that renders another landing page when clicked.
230
256
  */
@@ -248,6 +274,33 @@ export interface StorefrontProviderInfo extends ProviderInfo {
248
274
  /**
249
275
  * Describes a Storefront provided by a platform.
250
276
  * A platform must provide an object that satisfies this interface in order to register with the Storefront.
277
+ *
278
+ * <h3>Sample StorefrontProvider definition.</h3>
279
+ *
280
+ * Import required dependencies.
281
+ * ```ts
282
+ * import { Storefront, StorefrontProvider } from '@openfin/workspace';
283
+ * ```
284
+ *
285
+ * Create provider object to configure `Storefront`.
286
+ *
287
+ * ```ts
288
+ * const provider: StorefrontProvider = {
289
+ * id: 'provider-id',
290
+ * title: 'Sample Storefront',
291
+ * icon: 'https://www.openfin.co/favicon-32x32.png',
292
+ * getApps: () => { }, // Get apps to populate the platform's storefront
293
+ * getNavigation: () => {...}, // Get navigation selections for the left nav bar
294
+ * getLandingPage: () => {...}, // Get main landing page for platform's storefront
295
+ * getFooter: () => {...}, // Get footer for the platform's storefront
296
+ * launchApp: () => {...}, // Launch an app provided by the platform's storefront
297
+ * };
298
+ * ```
299
+ *
300
+ * Register storefront ``provider`` object.
301
+ * ```ts
302
+ * await Storefront.register(provider);
303
+ * ```
251
304
  */
252
305
  export interface StorefrontProvider extends StorefrontProviderInfo {
253
306
  /**
@@ -314,6 +367,7 @@ export interface StorefrontProvider extends StorefrontProviderInfo {
314
367
  getLandingPage(): Promise<StorefrontLandingPage>;
315
368
  /**
316
369
  * Get the Storefront navigation sections for the left nav bar.
370
+ *
317
371
  * ```ts
318
372
  * const navigationSections: [StorefrontNavigationSection, StorefrontNavigationSection] = [
319
373
  * {
@@ -426,7 +480,7 @@ export interface StorefrontAPI {
426
480
  */
427
481
  register(provider: StorefrontProvider): Promise<RegistrationMetaInfo>;
428
482
  /**
429
- * Deregister a provider.
483
+ * Deregister a [[StorefrontProvider]].
430
484
  *
431
485
  * ```ts
432
486
  * import { Storefront, StorefrontProvider } from "@openfin/workspace";
@@ -1,10 +1,15 @@
1
- import type { StorefrontProvider } from './shapes/store';
1
+ import type { StorefrontProvider, StoreRegistration } from './shapes/store';
2
2
  export * from './shapes/store';
3
- import type { RegistrationMetaInfo } from '../../client-api/src/shapes';
3
+ import { StoreButtonConfig } from './shapes/store';
4
4
  /**
5
5
  * Registers a Storefront provider
6
6
  */
7
- export declare const register: (provider: StorefrontProvider) => Promise<RegistrationMetaInfo>;
7
+ export declare const register: (provider: StorefrontProvider) => Promise<StoreRegistration>;
8
+ export interface UpdateButtonConfigRequest {
9
+ appId: string;
10
+ primaryButton: StoreButtonConfig;
11
+ secondaryButtons: StoreButtonConfig[];
12
+ }
8
13
  /**
9
14
  * Deregister a Storefront provider
10
15
  */
@@ -1,4 +1,47 @@
1
1
  import type OpenFin from '@openfin/core';
2
2
  import { WorkspacePlatformModule } from '../shapes';
3
+ /**
4
+ * Synchronously returns a Platform object that represents an existing platform.
5
+ *
6
+ * ```ts
7
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
8
+ *
9
+ * // declare platform identity
10
+ * const myPlatformIdentity: OpenFin.ApplicationIdentity = {
11
+ * uuid: 'testPlatform',
12
+ * name: 'Test Platform'
13
+ * };
14
+ *
15
+ * // get the platform representing myPlatformIdentity
16
+ * const platform = WorkspacePlatform.wrapSync(myPlatformIdentity);
17
+ *
18
+ * // do something with platform. e.g. create a window
19
+ * platform.createWindow({
20
+ * layout: {
21
+ * content: [
22
+ * {
23
+ * type: 'component',
24
+ * componentName: 'Example View',
25
+ * componentState: {
26
+ * name: 'example_view_1'
27
+ * url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html'
28
+ * }
29
+ * }
30
+ * ]
31
+ * }
32
+ * });
33
+ * ```
34
+ */
3
35
  export declare const wrapSync: (identity: OpenFin.ApplicationIdentity) => WorkspacePlatformModule;
36
+ /**
37
+ * Synchronously returns a Platform object that represents the current platform.
38
+ *
39
+ * ```ts
40
+ * import * as WorkspacePlatform from '@openfin/workspace-platform';
41
+ * // get current Workspace Platform
42
+ * const workspacePlatform = WorkspacePlatform.getCurrentSync();
43
+ * // do something with workspacePlatform. e.g. get snapshot of browser window with pages
44
+ * const snapshot = await workspacePlatform.getSnapshot();
45
+ * ```
46
+ */
4
47
  export declare const getCurrentSync: () => WorkspacePlatformModule;
@@ -1,3 +1,3 @@
1
1
  import { CustomActionsMap, InvokeCustomActionRequest } from '..';
2
2
  export declare const initCustomActions: (actions: CustomActionsMap) => void;
3
- export declare const makeInvokeCustomActionInternal: ({ actionId, payload }: InvokeCustomActionRequest) => Promise<any>;
3
+ export declare const invokeCustomActionInternal: ({ actionId, payload }: InvokeCustomActionRequest) => Promise<any>;
@@ -13,7 +13,7 @@ import type { WorkspacePlatformInitConfig } from '../shapes';
13
13
  * brandSecondary: '#1FF58A',
14
14
  * backgroundPrimary: '#F8E71C', // hex, rgb/rgba, hsl/hsla only - no string colors: 'red'
15
15
  * }
16
- * }
16
+ * }];
17
17
  *
18
18
  * const overrideCallback: WorkspacePlatform.WorkspacePlatformOverrideCallback = async (
19
19
  * WorkspacePlatformProvider
@@ -4,7 +4,7 @@ import type { AnalyticsEvent } from '../../common/src/utils/usage-register';
4
4
  import { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
5
5
  import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
6
6
  import type { CustomThemes } from '../../common/src/api/theming';
7
- import type { App } from '../../client-api/src/shapes';
7
+ import type { App, StoreButtonConfig } from '../../client-api/src/shapes';
8
8
  export { AppManifestType } from '../../client-api/src/shapes';
9
9
  export type { App, AppIntent, Image } from '../../client-api/src/shapes';
10
10
  export type { CustomActionSpecifier, CustomButtonConfig } from '../../common/src/api/action';
@@ -73,7 +73,7 @@ export declare enum GlobalContextMenuOptionType {
73
73
  /**
74
74
  * Types of color scheme.
75
75
  */
76
- export declare enum ColorSchemeOptionType {
76
+ export declare const enum ColorSchemeOptionType {
77
77
  Light = "light",
78
78
  Dark = "dark",
79
79
  System = "system"
@@ -298,9 +298,9 @@ export interface StoreCustomButtonActionPayload extends Omit<CustomButtonActionP
298
298
  * Invoking application id.
299
299
  */
300
300
  appId: string;
301
- /**
302
- * callerType - StoreCustomButton type.
303
- */
301
+ sourceButtonConfig: StoreButtonConfig;
302
+ secondaryButtons: StoreButtonConfig[];
303
+ primaryButton: StoreButtonConfig;
304
304
  callerType: CustomActionCallerType.StoreCustomButton;
305
305
  storeFrontProviderId: string;
306
306
  }
@@ -1145,6 +1145,7 @@ export interface WorkspacePlatformModule extends OpenFin.Platform {
1145
1145
  _requestQuitPlatformDialog(req: ShowQuitPlatformDialogRequest): Promise<void>;
1146
1146
  /**
1147
1147
  * Launch an application.
1148
+ *
1148
1149
  * ```ts
1149
1150
  * import * as WorkspacePlatform from '@openfin/workspace-platform';
1150
1151
  *
@@ -1450,6 +1451,11 @@ export interface WorkspacePlatformInitConfig {
1450
1451
  *
1451
1452
  * // add a custom menu item in View Tab Context Menu
1452
1453
  * openViewTabContextMenu = async (payload: OpenViewTabContextMenuPayload, callerIdentity) => {
1454
+ * const viewsInfo = await Promise.all(payload.selectedViews.map(async (v) => fin.View.wrapSync(v).getInfo()));
1455
+ *
1456
+ * const enableBack = viewsInfo.every((viewInfo) => viewInfo.canNavigateBack === true);
1457
+ * const enableForward = viewsInfo.every((viewInfo) => viewInfo.canNavigateForward === true);
1458
+ *
1453
1459
  * return super.openViewTabContextMenu({
1454
1460
  * ...payload,
1455
1461
  * template: [
@@ -1464,68 +1470,51 @@ export interface WorkspacePlatformInitConfig {
1464
1470
  * }
1465
1471
  * }
1466
1472
  * },
1467
- * ...payload.template
1468
- * ]
1469
- * }, callerIdentity);
1470
- * };
1471
- *
1472
- * // add a custom menu item (forward/back) in View Tab Context Menu
1473
- * openViewTabContextMenu = async (payload: OpenViewTabContextMenuPayload, callerIdentity) => {
1474
- * const viewsInfo = await Promise.all(payload.selectedViews.map(async (v) => fin.View.wrapSync(v).getInfo()));
1475
- *
1476
- * const enableBack = viewsInfo.every((viewInfo) => viewInfo.canNavigateBack === true);
1477
- * const enableForward = viewsInfo.every((viewInfo) => viewInfo.canNavigateForward === true);
1478
- *
1479
- *
1480
- * return super.openViewTabContextMenu({
1481
- * ...payload,
1482
- * template: [
1483
- * {
1473
+ * {
1484
1474
  * type: 'normal',
1485
1475
  * label: 'Back',
1486
1476
  * data: {
1487
1477
  * type: ViewTabMenuOptionType.Back
1488
1478
  * },
1489
1479
  * enabled: enableBack
1490
- * },
1491
- * {
1480
+ * },
1481
+ * {
1492
1482
  * type: 'normal',
1493
1483
  * label: 'Forward',
1494
1484
  * data: {
1495
1485
  * type: ViewTabMenuOptionType.Forward
1496
1486
  * },
1497
1487
  * enabled: enableForward
1498
- * },
1499
- * ...payload.template
1488
+ * },
1489
+ * ...payload.template
1500
1490
  * ]
1501
1491
  * }, callerIdentity);
1502
1492
  * };
1503
1493
  *
1504
1494
  * // add a custom menu item in Save Context Menu
1505
- * openSaveButtonContextMenu = (req: WorkspacePlatform.OpenSaveButtonContextMenuPayload, callerIdentity: OpenFin.Identity) => {
1506
- * return super.openSaveButtonContextMenu(
1507
- * {
1508
- * ...req,
1509
- * template: [
1510
- * ...req.template,
1511
- * {
1512
- * label: 'Save custom option',
1513
- * data: {
1514
- * type: SaveButtonContextMenuOptionType.Custom,
1515
- * action: {
1516
- * id: 'sample-custom-action-name',
1517
- * customData: {
1518
- * someProp: 'Save Button task'
1519
- * }
1520
- * }
1521
- * }
1522
- * }
1523
- * ]
1524
- * },
1525
- * callerIdentity
1526
- * );
1527
- * }
1528
- * }
1495
+ * openSaveButtonContextMenu = (req: WorkspacePlatform.OpenSaveButtonContextMenuPayload, callerIdentity: OpenFin.Identity) => {
1496
+ * return super.openSaveButtonContextMenu(
1497
+ * {
1498
+ * ...req,
1499
+ * template: [
1500
+ * ...req.template,
1501
+ * {
1502
+ * label: 'Save custom option',
1503
+ * data: {
1504
+ * type: SaveButtonContextMenuOptionType.Custom,
1505
+ * action: {
1506
+ * id: 'sample-custom-action-name',
1507
+ * customData: {
1508
+ * someProp: 'Save Button task'
1509
+ * }
1510
+ * }
1511
+ * }
1512
+ * }
1513
+ * ]
1514
+ * },
1515
+ * callerIdentity
1516
+ * );
1517
+ * }
1529
1518
  * }
1530
1519
  * return new Override();
1531
1520
  * };
@@ -1553,7 +1542,7 @@ export declare type WorkspacePlatformOverrideCallback = OpenFin.OverrideCallback
1553
1542
  * @deprecated
1554
1543
  */
1555
1544
  export declare type BrowserOverrideCallback = WorkspacePlatformOverrideCallback;
1556
- /**`
1545
+ /**
1557
1546
  * Configuration for initializing a Browser.
1558
1547
  */
1559
1548
  export interface BrowserInitConfig {
@@ -22,12 +22,12 @@ export declare enum WorkspaceChannelAction {
22
22
  GetStorefrontProviderFooter = "get-storefront-provider-footer",
23
23
  GetStorefrontProviderNavigation = "get-storefront-provider-navigation",
24
24
  LaunchStorefrontProviderApp = "launch-storefront-provider-app",
25
+ UpdateAppCardButtonConfig = "update-app-card-button-config",
25
26
  ShowHome = "show-home",
26
27
  HideHome = "hide-home",
27
28
  AssignHomeSearchContext = "assign-home-search-context",
28
29
  SetSearchQuery = "set-search-query",
29
30
  OpenHomeAndSetSearchQuery = "open-home-and-set-search-query",
30
- SetStoreButtonState = "set-store-button-state",
31
31
  GetLegacyPages = "get-legacy-pages",
32
32
  GetLegacyWorkspaces = "get-legacy-workspaces",
33
33
  GetComputedPlatformTheme = "get-computed-platform-theme",
@@ -16,6 +16,5 @@ export interface SearchItem {
16
16
  requestReload?: () => any;
17
17
  }
18
18
  export declare type Topic = typeof homeSearchTopic;
19
- export declare function waitForSearchRegistration(): Promise<void>;
20
19
  export declare function getTopic(topic: Topic): Promise<SearchTopicClient>;
21
20
  export declare function mapSearchResponsesToItems(topic: Topic, responses: SearchProviderResponse[]): SearchItem[];
@@ -4,7 +4,8 @@ export declare enum ApplicationUUID {
4
4
  * The UUID of workspace.
5
5
  * Home is a part of this application.
6
6
  */
7
- Workspace = "openfin-browser"
7
+ Workspace = "openfin-workspace",
8
+ OldWorkspace = "openfin-browser"
8
9
  }
9
10
  export interface ApplicationEvent {
10
11
  viewIdentity?: OpenFin.Identity;
@@ -12,12 +13,6 @@ export interface ApplicationEvent {
12
13
  uuid?: string;
13
14
  }
14
15
  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
16
  export declare enum LaunchModeType {
22
17
  FinProtocol = "fin-protocol"
23
18
  }
@@ -10,26 +10,6 @@ export declare enum WindowName {
10
10
  BrowserWindow = "internal-generated-window",
11
11
  ClassicWindow = "internal-generated-classic-window"
12
12
  }
13
- export declare enum WindowEvent {
14
- Shown = "shown",
15
- BoundsChanged = "bounds-changed",
16
- LayoutReady = "layout-ready",
17
- EndUserBoundsChanging = "end-user-bounds-changing",
18
- Blurred = "blurred",
19
- Closed = "closed",
20
- CloseRequested = "close-requested",
21
- Focused = "focused",
22
- ShowRequested = "show-requested",
23
- ViewCrashed = "view-crashed",
24
- ViewAttached = "view-attached",
25
- ViewDetached = "view-detached",
26
- ViewPageTitleUpdated = "view-page-title-updated",
27
- ViewDestroyed = "view-destroyed",
28
- OptionsChanged = "options-changed"
29
- }
30
- export declare enum WebWindowEvent {
31
- BeforeUnload = "beforeunload"
32
- }
33
13
  export interface WindowIdentity {
34
14
  uuid: ApplicationUUID | string;
35
15
  name: WindowName | string;