@openfin/workspace-platform 12.6.3 → 12.6.5

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.
@@ -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,11 +226,6 @@ export interface StorefrontNavigationItemAppGrid extends StorefrontNavigationIte
225
226
  */
226
227
  templateData: StorefrontAppGrid;
227
228
  }
228
- export interface UpdateButtonConfigRequest {
229
- appId: string;
230
- primaryButton: StoreButtonConfig;
231
- secondaryButtons: StoreButtonConfig[];
232
- }
233
229
  /**
234
230
  * Response from store registration which includes metadata and a function to update app cards buttons.
235
231
  */
@@ -486,3 +482,99 @@ export interface StorefrontProvider extends StorefrontProviderInfo {
486
482
  */
487
483
  launchApp(app: App): Promise<void>;
488
484
  }
485
+ /**
486
+ * Interface that contains functions for integrating with Storefront.
487
+ */
488
+ export interface StorefrontAPI {
489
+ /**
490
+ * Registers a [[`StorefrontProvider`]]. Upon registering a provider,
491
+ * the title of your provider appears in the menu of the Storefront UI.
492
+ * When a user selects your Storefront, the methods on the provider
493
+ * object are called to populate the UI. Throws an error if a provider with
494
+ * the same `id` already exists.
495
+ *
496
+ * ```ts
497
+ * import { Storefront, StorefrontProvider } from "@openfin/workspace";
498
+ *
499
+ * //Declare a provider
500
+ * const myStorefrontProvider: StorefrontProvider = {
501
+ * id: "my-storefront-id"
502
+ * title: "My StorefrontProvider"
503
+ * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
504
+ * getApps: () => {...},
505
+ * getNavigation: () => {...},
506
+ * getLandingPage: () => {...},
507
+ * getFooter: () => {...},
508
+ * launchApp: () => {...}
509
+ * };
510
+ *
511
+ * const registerProvider = async () => {
512
+ * await Storefront.register(myStorefrontProvider);
513
+ * }
514
+ * ```
515
+ * @param provider the implementation of a Storefront provider.
516
+
517
+ */
518
+ register(provider: StorefrontProvider): Promise<RegistrationMetaInfo>;
519
+ /**
520
+ * Deregister a [[StorefrontProvider]].
521
+ *
522
+ * ```ts
523
+ * import { Storefront, StorefrontProvider } from "@openfin/workspace";
524
+ *
525
+ * //Instantiate a StorefrontProvider
526
+ * const myStorefrontProvider: StorefrontProvider = {
527
+ * id: "my-storefront-id"
528
+ * title: "My StoreFrontProvider"
529
+ * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
530
+ * getApps: () => {...},
531
+ * getNavigation: () => {...},
532
+ * getLandingPage: () => {...},
533
+ * getFooter: () => {...},
534
+ * launchApp: () => {...}
535
+ * };
536
+ *
537
+ * const register = async () => {
538
+ * await Storefront.register(myStorefrontProvider);
539
+ * }
540
+ *
541
+ * //Do work with myStorefrontProvider
542
+ *
543
+ * const deregister = async () => {
544
+ * await Storefront.deregister("my-storefront-id");
545
+ * }
546
+ * ```
547
+ * @param id the id of the provider.
548
+ */
549
+ deregister(id: string): Promise<void>;
550
+ /**
551
+ * Shows the Storefront window. Awaits for the latest [[`Storefront.register()`]]
552
+ * internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
553
+ * doesn't exist (i.e., because `register()` not called previously).
554
+ *
555
+ * ```ts
556
+ * import { Storefront } from "@openfin/workspace";
557
+ *
558
+ * const show = async () => {
559
+ * await Storefront.show();
560
+ * //Do thing after show
561
+ * }
562
+ * ```
563
+ */
564
+ show(): Promise<void>;
565
+ /**
566
+ * Hides the Storefront window. Awaits for the latest [[`Storefront.register()`]]
567
+ * internally, so you don't have to. Throws an error if a [[StorefrontProvider]]
568
+ * doesn't exist (i.e., because `register()` was not called previously).
569
+ *
570
+ * ```ts
571
+ * import { Storefront } from "@openfin/workspace";
572
+ *
573
+ * const hide = async () => {
574
+ * await Storefront.hidef();
575
+ * //Do thing after show
576
+ * }
577
+ * ```
578
+ */
579
+ hide(): Promise<void>;
580
+ }
@@ -1,81 +1,25 @@
1
1
  import type { StorefrontProvider, StoreRegistration } from './shapes/store';
2
2
  export * from './shapes/store';
3
+ import { StoreButtonConfig } from './shapes/store';
3
4
  /**
4
- * Registers a {@link StorefrontProvider}.
5
- *
6
- * Throws an error if a provider with the same `id` already exists.
7
- *
8
- * @param provider the implementation of a Storefront provider.
9
- *
10
- * @example
11
- * ```ts
12
- * import { Storefront, StorefrontProvider } from "@openfin/workspace";
13
- *
14
- * const myStorefrontProvider: StorefrontProvider = {
15
- * id: "my-storefront-id"
16
- * title: "My StorefrontProvider"
17
- * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
18
- * getApps: () => {...},
19
- * getNavigation: () => {...},
20
- * getLandingPage: () => {...},
21
- * getFooter: () => {...},
22
- * launchApp: () => {...}
23
- * };
24
- *
25
- * await Storefront.register(myStorefrontProvider);
26
- *
27
- * ```
5
+ * Registers a Storefront provider
28
6
  */
29
7
  export declare const register: (provider: StorefrontProvider) => Promise<StoreRegistration>;
8
+ export interface UpdateButtonConfigRequest {
9
+ appId: string;
10
+ primaryButton: StoreButtonConfig;
11
+ secondaryButtons: StoreButtonConfig[];
12
+ }
30
13
  /**
31
- * API function to deregister a Storefront provider.
32
- *
33
- * @param id the id of the provider to deregister.
34
- * @returns promise - resolves once the provider is deregistered.
35
- *
36
- * @example
37
- * ```ts
38
- * import { Storefront, StorefrontProvider } from "@openfin/workspace";
39
- *
40
- * const myStorefrontProvider: StorefrontProvider = {
41
- * id: "my-storefront-id"
42
- * title: "My StoreFrontProvider"
43
- * icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
44
- * getApps: () => {...},
45
- * getNavigation: () => {...},
46
- * getLandingPage: () => {...},
47
- * getFooter: () => {...},
48
- * launchApp: () => {...}
49
- * };
50
- *
51
- * await Storefront.register(myStorefrontProvider);
52
- *
53
- * await Storefront.deregister("my-storefront-id");
54
- *
55
- * ```
14
+ * Deregister a Storefront provider
56
15
  */
57
16
  export declare const deregister: (providerId: string) => Promise<void>;
58
17
  /**
59
- * API function to hide the Storefront window.
18
+ * API function to hide Storefront
60
19
  * @returns promise - invokes hide action
61
- *
62
- * @example
63
- * ```ts
64
- * import { Storefront } from "@openfin/workspace";
65
- *
66
- * await Storefront.hide();
67
- * ```
68
20
  */
69
21
  export declare const hide: () => Promise<void>;
70
22
  /**
71
- * API function to show the Storefront window.
72
- * @returns promise - invokes show action
73
- *
74
- * @example
75
- * ```ts
76
- * import { Storefront } from "@openfin/workspace";
77
- *
78
- * await Storefront.show();
79
- * ```
23
+ * Shows Storefront window if enabled & registered
80
24
  */
81
25
  export declare const show: () => Promise<void>;