@openfin/core 40.82.20 → 40.82.22

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.
@@ -3657,11 +3657,6 @@ declare type ConstWindowOptions = {
3657
3657
  * @deprecated - use `icon` instead.
3658
3658
  */
3659
3659
  taskbarIcon: string;
3660
- /**
3661
- * Specify a taskbar group for the window.
3662
- * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
3663
- */
3664
- taskbarIconGroup: string;
3665
3660
  /**
3666
3661
  * @defaultValue "about:blank"
3667
3662
  *
@@ -7686,6 +7681,29 @@ declare class Layout extends Base {
7686
7681
  * ```
7687
7682
  */
7688
7683
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7684
+ /**
7685
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7686
+ *
7687
+ * @param viewOptions - The options for creating the view.
7688
+ * @param options - Optional parameters for adding the view.
7689
+ * @param options.location - The location where the view should be added.
7690
+ * @param options.targetView - The target view to which the new view should be added.
7691
+ * @returns A promise that resolves to an object containing the identity of the added view.
7692
+ */
7693
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7694
+ location?: OpenFin_2.CreateViewTarget['location'];
7695
+ targetView?: OpenFin_2.Identity;
7696
+ }): Promise<{
7697
+ identity: OpenFin_2.Identity;
7698
+ }>;
7699
+ /**
7700
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7701
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7702
+ *
7703
+ * @param viewIdentity - The identity of the view to close.
7704
+ * @returns A promise that resolves when the view is closed.
7705
+ */
7706
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7689
7707
  }
7690
7708
 
7691
7709
  /**
@@ -7698,7 +7716,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7698
7716
  /**
7699
7717
  * @interface
7700
7718
  */
7701
- declare type LayoutComponent = LayoutItemConfig & {
7719
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7702
7720
  /**
7703
7721
  * Only a component type will have this property and it should be set to view.
7704
7722
  */
@@ -7707,6 +7725,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7707
7725
  * Only a component type will have this property and it represents the view options of a given component.
7708
7726
  */
7709
7727
  componentState?: Partial<ViewCreationOptions>;
7728
+ type: 'component';
7710
7729
  };
7711
7730
 
7712
7731
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7790,10 +7809,7 @@ declare type LayoutIdentity = Identity_4 & {
7790
7809
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7791
7810
  type: 'layout-initialized';
7792
7811
  layoutIdentity: OpenFin_2.LayoutIdentity;
7793
- ofViews: {
7794
- identity: OpenFin_2.Identity;
7795
- entityType: 'view';
7796
- }[];
7812
+ ofViews: OpenFin_2.ViewCreationResult[];
7797
7813
  };
7798
7814
 
7799
7815
  /**
@@ -7901,7 +7917,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
7901
7917
  /**
7902
7918
  * @experimental
7903
7919
  */
7904
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
7920
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
7905
7921
  /**
7906
7922
  * @experimental
7907
7923
  */
@@ -8892,6 +8908,12 @@ declare type MutableWindowOptions = {
8892
8908
  * Shows the window's icon in the taskbar.
8893
8909
  */
8894
8910
  showTaskbarIcon: boolean;
8911
+ /**
8912
+ * Specify a taskbar group for the window.
8913
+ * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
8914
+ * @remarks It's only updatable when `enableJumpList` is set to false.
8915
+ */
8916
+ taskbarIconGroup: string;
8895
8917
  interop: InteropConfig;
8896
8918
  /* Excluded from this release type: _internalWorkspaceData */
8897
8919
  /* Excluded from this release type: workspacePlatform */
@@ -9148,6 +9170,9 @@ declare namespace OpenFin_2 {
9148
9170
  ViewOptions,
9149
9171
  ConstViewOptions,
9150
9172
  ViewState,
9173
+ ViewCreationSuccess,
9174
+ ViewCreationFailure,
9175
+ ViewCreationResult,
9151
9176
  Certificate,
9152
9177
  HostContextChangedPayload,
9153
9178
  ApplySnapshotOptions,
@@ -10951,6 +10976,45 @@ declare interface PlatformProvider {
10951
10976
  * @returns {Promise<void>}
10952
10977
  */
10953
10978
  handleRunRequested({ manifest, userAppConfigArgs }: RunRequestedEvent): Promise<void>;
10979
+ /**
10980
+ * @experimental
10981
+ *
10982
+ * This method is called to handle errors with view creation and initial navigation during layout creation.
10983
+ * Overriding this method enables catching the error and correcting behavior (ie navigating to an error page).
10984
+ * * To indicate that the error has been handled, view creation should be treated as successful return {identity: viewIdentity, success: true}.
10985
+ * * Not returning anything will cause the layout-initialized event to include the view as failed with the original error.
10986
+ * * Throwing an error will update the error on the event payload of layout-initialized to the thrown error.
10987
+ *
10988
+ * @param viewIdentity Identity of the view
10989
+ * @param error error thrown during a view creation
10990
+ * @returns {Promise<OpenFin.ViewCreationSuccess | void>}
10991
+ *
10992
+ * @example
10993
+ *
10994
+ * ```js
10995
+ * const overrideCallback = (PlatformProvider) => {
10996
+ * class Override extends PlatformProvider {
10997
+ * async handleFailedViewCreation(viewIdentity, error) {
10998
+ * const view = fin.View.wrapSync(viewId);
10999
+ * try {
11000
+ * // navigate to an error page
11001
+ * await view.navigate('http://localhost:3000/errorPage.html');
11002
+ * // resolve a success result after redirecting to a error page
11003
+ * return {identity: viewIdentity, success: true};
11004
+ * } catch(e) {
11005
+ * // layout-initialized event will include this view with the error
11006
+ * throw error;
11007
+ * }
11008
+ * }
11009
+ * }
11010
+ * return new Override();
11011
+ * }
11012
+ *
11013
+ * fin.Platform.init({ overrideCallback });
11014
+ *
11015
+ * ```
11016
+ */
11017
+ handleFailedViewCreation(viewIdentity: OpenFin_2.Identity, error: Error): Promise<OpenFin_2.ViewCreationSuccess | void>;
10954
11018
  }
10955
11019
 
10956
11020
  /**
@@ -15607,6 +15671,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
15607
15671
  options?: Partial<ViewOptions>;
15608
15672
  };
15609
15673
 
15674
+ /**
15675
+ * @interface
15676
+ */
15677
+ declare type ViewCreationFailure = {
15678
+ /**
15679
+ * The identity of the created view
15680
+ */
15681
+ identity: Identity_4;
15682
+ /**
15683
+ * Whether the view was created with errors
15684
+ */
15685
+ success: false;
15686
+ /**
15687
+ * Error thrown during view creation
15688
+ */
15689
+ error: Error;
15690
+ };
15691
+
15610
15692
  /**
15611
15693
  * The options object required by {@link View.ViewModule.create View.create}.
15612
15694
  *
@@ -15622,6 +15704,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
15622
15704
 
15623
15705
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
15624
15706
 
15707
+ /**
15708
+ * A view creation state
15709
+ */
15710
+ declare type ViewCreationResult = ViewCreationSuccess | ViewCreationFailure;
15711
+
15712
+ /**
15713
+ * @interface
15714
+ */
15715
+ declare type ViewCreationSuccess = {
15716
+ /**
15717
+ * The identity of the created view
15718
+ */
15719
+ identity: Identity_4;
15720
+ /**
15721
+ * Whether the view was created without errors
15722
+ */
15723
+ success: true;
15724
+ };
15725
+
15625
15726
  /**
15626
15727
  * Generated when a window has a view detached from it.
15627
15728
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
@@ -3657,11 +3657,6 @@ declare type ConstWindowOptions = {
3657
3657
  * @deprecated - use `icon` instead.
3658
3658
  */
3659
3659
  taskbarIcon: string;
3660
- /**
3661
- * Specify a taskbar group for the window.
3662
- * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
3663
- */
3664
- taskbarIconGroup: string;
3665
3660
  /**
3666
3661
  * @defaultValue "about:blank"
3667
3662
  *
@@ -7686,6 +7681,29 @@ declare class Layout extends Base {
7686
7681
  * ```
7687
7682
  */
7688
7683
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7684
+ /**
7685
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7686
+ *
7687
+ * @param viewOptions - The options for creating the view.
7688
+ * @param options - Optional parameters for adding the view.
7689
+ * @param options.location - The location where the view should be added.
7690
+ * @param options.targetView - The target view to which the new view should be added.
7691
+ * @returns A promise that resolves to an object containing the identity of the added view.
7692
+ */
7693
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7694
+ location?: OpenFin_2.CreateViewTarget['location'];
7695
+ targetView?: OpenFin_2.Identity;
7696
+ }): Promise<{
7697
+ identity: OpenFin_2.Identity;
7698
+ }>;
7699
+ /**
7700
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7701
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7702
+ *
7703
+ * @param viewIdentity - The identity of the view to close.
7704
+ * @returns A promise that resolves when the view is closed.
7705
+ */
7706
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7689
7707
  }
7690
7708
 
7691
7709
  /**
@@ -7698,7 +7716,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7698
7716
  /**
7699
7717
  * @interface
7700
7718
  */
7701
- declare type LayoutComponent = LayoutItemConfig & {
7719
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7702
7720
  /**
7703
7721
  * Only a component type will have this property and it should be set to view.
7704
7722
  */
@@ -7707,6 +7725,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7707
7725
  * Only a component type will have this property and it represents the view options of a given component.
7708
7726
  */
7709
7727
  componentState?: Partial<ViewCreationOptions>;
7728
+ type: 'component';
7710
7729
  };
7711
7730
 
7712
7731
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7790,10 +7809,7 @@ declare type LayoutIdentity = Identity_4 & {
7790
7809
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7791
7810
  type: 'layout-initialized';
7792
7811
  layoutIdentity: OpenFin_2.LayoutIdentity;
7793
- ofViews: {
7794
- identity: OpenFin_2.Identity;
7795
- entityType: 'view';
7796
- }[];
7812
+ ofViews: OpenFin_2.ViewCreationResult[];
7797
7813
  };
7798
7814
 
7799
7815
  /**
@@ -7901,7 +7917,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
7901
7917
  /**
7902
7918
  * @experimental
7903
7919
  */
7904
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
7920
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
7905
7921
  /**
7906
7922
  * @experimental
7907
7923
  */
@@ -8892,6 +8908,12 @@ declare type MutableWindowOptions = {
8892
8908
  * Shows the window's icon in the taskbar.
8893
8909
  */
8894
8910
  showTaskbarIcon: boolean;
8911
+ /**
8912
+ * Specify a taskbar group for the window.
8913
+ * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
8914
+ * @remarks It's only updatable when `enableJumpList` is set to false.
8915
+ */
8916
+ taskbarIconGroup: string;
8895
8917
  interop: InteropConfig;
8896
8918
  /* Excluded from this release type: _internalWorkspaceData */
8897
8919
  /* Excluded from this release type: workspacePlatform */
@@ -9148,6 +9170,9 @@ declare namespace OpenFin_2 {
9148
9170
  ViewOptions,
9149
9171
  ConstViewOptions,
9150
9172
  ViewState,
9173
+ ViewCreationSuccess,
9174
+ ViewCreationFailure,
9175
+ ViewCreationResult,
9151
9176
  Certificate,
9152
9177
  HostContextChangedPayload,
9153
9178
  ApplySnapshotOptions,
@@ -10951,6 +10976,45 @@ declare interface PlatformProvider {
10951
10976
  * @returns {Promise<void>}
10952
10977
  */
10953
10978
  handleRunRequested({ manifest, userAppConfigArgs }: RunRequestedEvent): Promise<void>;
10979
+ /**
10980
+ * @experimental
10981
+ *
10982
+ * This method is called to handle errors with view creation and initial navigation during layout creation.
10983
+ * Overriding this method enables catching the error and correcting behavior (ie navigating to an error page).
10984
+ * * To indicate that the error has been handled, view creation should be treated as successful return {identity: viewIdentity, success: true}.
10985
+ * * Not returning anything will cause the layout-initialized event to include the view as failed with the original error.
10986
+ * * Throwing an error will update the error on the event payload of layout-initialized to the thrown error.
10987
+ *
10988
+ * @param viewIdentity Identity of the view
10989
+ * @param error error thrown during a view creation
10990
+ * @returns {Promise<OpenFin.ViewCreationSuccess | void>}
10991
+ *
10992
+ * @example
10993
+ *
10994
+ * ```js
10995
+ * const overrideCallback = (PlatformProvider) => {
10996
+ * class Override extends PlatformProvider {
10997
+ * async handleFailedViewCreation(viewIdentity, error) {
10998
+ * const view = fin.View.wrapSync(viewId);
10999
+ * try {
11000
+ * // navigate to an error page
11001
+ * await view.navigate('http://localhost:3000/errorPage.html');
11002
+ * // resolve a success result after redirecting to a error page
11003
+ * return {identity: viewIdentity, success: true};
11004
+ * } catch(e) {
11005
+ * // layout-initialized event will include this view with the error
11006
+ * throw error;
11007
+ * }
11008
+ * }
11009
+ * }
11010
+ * return new Override();
11011
+ * }
11012
+ *
11013
+ * fin.Platform.init({ overrideCallback });
11014
+ *
11015
+ * ```
11016
+ */
11017
+ handleFailedViewCreation(viewIdentity: OpenFin_2.Identity, error: Error): Promise<OpenFin_2.ViewCreationSuccess | void>;
10954
11018
  }
10955
11019
 
10956
11020
  /**
@@ -15607,6 +15671,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
15607
15671
  options?: Partial<ViewOptions>;
15608
15672
  };
15609
15673
 
15674
+ /**
15675
+ * @interface
15676
+ */
15677
+ declare type ViewCreationFailure = {
15678
+ /**
15679
+ * The identity of the created view
15680
+ */
15681
+ identity: Identity_4;
15682
+ /**
15683
+ * Whether the view was created with errors
15684
+ */
15685
+ success: false;
15686
+ /**
15687
+ * Error thrown during view creation
15688
+ */
15689
+ error: Error;
15690
+ };
15691
+
15610
15692
  /**
15611
15693
  * The options object required by {@link View.ViewModule.create View.create}.
15612
15694
  *
@@ -15622,6 +15704,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
15622
15704
 
15623
15705
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
15624
15706
 
15707
+ /**
15708
+ * A view creation state
15709
+ */
15710
+ declare type ViewCreationResult = ViewCreationSuccess | ViewCreationFailure;
15711
+
15712
+ /**
15713
+ * @interface
15714
+ */
15715
+ declare type ViewCreationSuccess = {
15716
+ /**
15717
+ * The identity of the created view
15718
+ */
15719
+ identity: Identity_4;
15720
+ /**
15721
+ * Whether the view was created without errors
15722
+ */
15723
+ success: true;
15724
+ };
15725
+
15625
15726
  /**
15626
15727
  * Generated when a window has a view detached from it.
15627
15728
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
@@ -3657,11 +3657,6 @@ declare type ConstWindowOptions = {
3657
3657
  * @deprecated - use `icon` instead.
3658
3658
  */
3659
3659
  taskbarIcon: string;
3660
- /**
3661
- * Specify a taskbar group for the window.
3662
- * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
3663
- */
3664
- taskbarIconGroup: string;
3665
3660
  /**
3666
3661
  * @defaultValue "about:blank"
3667
3662
  *
@@ -7686,6 +7681,29 @@ declare class Layout extends Base {
7686
7681
  * ```
7687
7682
  */
7688
7683
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7684
+ /**
7685
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7686
+ *
7687
+ * @param viewOptions - The options for creating the view.
7688
+ * @param options - Optional parameters for adding the view.
7689
+ * @param options.location - The location where the view should be added.
7690
+ * @param options.targetView - The target view to which the new view should be added.
7691
+ * @returns A promise that resolves to an object containing the identity of the added view.
7692
+ */
7693
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7694
+ location?: OpenFin_2.CreateViewTarget['location'];
7695
+ targetView?: OpenFin_2.Identity;
7696
+ }): Promise<{
7697
+ identity: OpenFin_2.Identity;
7698
+ }>;
7699
+ /**
7700
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7701
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7702
+ *
7703
+ * @param viewIdentity - The identity of the view to close.
7704
+ * @returns A promise that resolves when the view is closed.
7705
+ */
7706
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7689
7707
  }
7690
7708
 
7691
7709
  /**
@@ -7698,7 +7716,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7698
7716
  /**
7699
7717
  * @interface
7700
7718
  */
7701
- declare type LayoutComponent = LayoutItemConfig & {
7719
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7702
7720
  /**
7703
7721
  * Only a component type will have this property and it should be set to view.
7704
7722
  */
@@ -7707,6 +7725,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7707
7725
  * Only a component type will have this property and it represents the view options of a given component.
7708
7726
  */
7709
7727
  componentState?: Partial<ViewCreationOptions>;
7728
+ type: 'component';
7710
7729
  };
7711
7730
 
7712
7731
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7790,10 +7809,7 @@ declare type LayoutIdentity = Identity_4 & {
7790
7809
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7791
7810
  type: 'layout-initialized';
7792
7811
  layoutIdentity: OpenFin_2.LayoutIdentity;
7793
- ofViews: {
7794
- identity: OpenFin_2.Identity;
7795
- entityType: 'view';
7796
- }[];
7812
+ ofViews: OpenFin_2.ViewCreationResult[];
7797
7813
  };
7798
7814
 
7799
7815
  /**
@@ -7901,7 +7917,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
7901
7917
  /**
7902
7918
  * @experimental
7903
7919
  */
7904
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
7920
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
7905
7921
  /**
7906
7922
  * @experimental
7907
7923
  */
@@ -8892,6 +8908,12 @@ declare type MutableWindowOptions = {
8892
8908
  * Shows the window's icon in the taskbar.
8893
8909
  */
8894
8910
  showTaskbarIcon: boolean;
8911
+ /**
8912
+ * Specify a taskbar group for the window.
8913
+ * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
8914
+ * @remarks It's only updatable when `enableJumpList` is set to false.
8915
+ */
8916
+ taskbarIconGroup: string;
8895
8917
  interop: InteropConfig;
8896
8918
  /* Excluded from this release type: _internalWorkspaceData */
8897
8919
  /* Excluded from this release type: workspacePlatform */
@@ -9148,6 +9170,9 @@ declare namespace OpenFin_2 {
9148
9170
  ViewOptions,
9149
9171
  ConstViewOptions,
9150
9172
  ViewState,
9173
+ ViewCreationSuccess,
9174
+ ViewCreationFailure,
9175
+ ViewCreationResult,
9151
9176
  Certificate,
9152
9177
  HostContextChangedPayload,
9153
9178
  ApplySnapshotOptions,
@@ -10951,6 +10976,45 @@ declare interface PlatformProvider {
10951
10976
  * @returns {Promise<void>}
10952
10977
  */
10953
10978
  handleRunRequested({ manifest, userAppConfigArgs }: RunRequestedEvent): Promise<void>;
10979
+ /**
10980
+ * @experimental
10981
+ *
10982
+ * This method is called to handle errors with view creation and initial navigation during layout creation.
10983
+ * Overriding this method enables catching the error and correcting behavior (ie navigating to an error page).
10984
+ * * To indicate that the error has been handled, view creation should be treated as successful return {identity: viewIdentity, success: true}.
10985
+ * * Not returning anything will cause the layout-initialized event to include the view as failed with the original error.
10986
+ * * Throwing an error will update the error on the event payload of layout-initialized to the thrown error.
10987
+ *
10988
+ * @param viewIdentity Identity of the view
10989
+ * @param error error thrown during a view creation
10990
+ * @returns {Promise<OpenFin.ViewCreationSuccess | void>}
10991
+ *
10992
+ * @example
10993
+ *
10994
+ * ```js
10995
+ * const overrideCallback = (PlatformProvider) => {
10996
+ * class Override extends PlatformProvider {
10997
+ * async handleFailedViewCreation(viewIdentity, error) {
10998
+ * const view = fin.View.wrapSync(viewId);
10999
+ * try {
11000
+ * // navigate to an error page
11001
+ * await view.navigate('http://localhost:3000/errorPage.html');
11002
+ * // resolve a success result after redirecting to a error page
11003
+ * return {identity: viewIdentity, success: true};
11004
+ * } catch(e) {
11005
+ * // layout-initialized event will include this view with the error
11006
+ * throw error;
11007
+ * }
11008
+ * }
11009
+ * }
11010
+ * return new Override();
11011
+ * }
11012
+ *
11013
+ * fin.Platform.init({ overrideCallback });
11014
+ *
11015
+ * ```
11016
+ */
11017
+ handleFailedViewCreation(viewIdentity: OpenFin_2.Identity, error: Error): Promise<OpenFin_2.ViewCreationSuccess | void>;
10954
11018
  }
10955
11019
 
10956
11020
  /**
@@ -15607,6 +15671,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
15607
15671
  options?: Partial<ViewOptions>;
15608
15672
  };
15609
15673
 
15674
+ /**
15675
+ * @interface
15676
+ */
15677
+ declare type ViewCreationFailure = {
15678
+ /**
15679
+ * The identity of the created view
15680
+ */
15681
+ identity: Identity_4;
15682
+ /**
15683
+ * Whether the view was created with errors
15684
+ */
15685
+ success: false;
15686
+ /**
15687
+ * Error thrown during view creation
15688
+ */
15689
+ error: Error;
15690
+ };
15691
+
15610
15692
  /**
15611
15693
  * The options object required by {@link View.ViewModule.create View.create}.
15612
15694
  *
@@ -15622,6 +15704,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
15622
15704
 
15623
15705
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
15624
15706
 
15707
+ /**
15708
+ * A view creation state
15709
+ */
15710
+ declare type ViewCreationResult = ViewCreationSuccess | ViewCreationFailure;
15711
+
15712
+ /**
15713
+ * @interface
15714
+ */
15715
+ declare type ViewCreationSuccess = {
15716
+ /**
15717
+ * The identity of the created view
15718
+ */
15719
+ identity: Identity_4;
15720
+ /**
15721
+ * Whether the view was created without errors
15722
+ */
15723
+ success: true;
15724
+ };
15725
+
15625
15726
  /**
15626
15727
  * Generated when a window has a view detached from it.
15627
15728
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
package/out/mock.d.ts CHANGED
@@ -3716,11 +3716,6 @@ declare type ConstWindowOptions = {
3716
3716
  * @deprecated - use `icon` instead.
3717
3717
  */
3718
3718
  taskbarIcon: string;
3719
- /**
3720
- * Specify a taskbar group for the window.
3721
- * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
3722
- */
3723
- taskbarIconGroup: string;
3724
3719
  /**
3725
3720
  * @defaultValue "about:blank"
3726
3721
  *
@@ -7812,6 +7807,29 @@ declare class Layout extends Base {
7812
7807
  * ```
7813
7808
  */
7814
7809
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7810
+ /**
7811
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7812
+ *
7813
+ * @param viewOptions - The options for creating the view.
7814
+ * @param options - Optional parameters for adding the view.
7815
+ * @param options.location - The location where the view should be added.
7816
+ * @param options.targetView - The target view to which the new view should be added.
7817
+ * @returns A promise that resolves to an object containing the identity of the added view.
7818
+ */
7819
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7820
+ location?: OpenFin_2.CreateViewTarget['location'];
7821
+ targetView?: OpenFin_2.Identity;
7822
+ }): Promise<{
7823
+ identity: OpenFin_2.Identity;
7824
+ }>;
7825
+ /**
7826
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7827
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7828
+ *
7829
+ * @param viewIdentity - The identity of the view to close.
7830
+ * @returns A promise that resolves when the view is closed.
7831
+ */
7832
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7815
7833
  }
7816
7834
 
7817
7835
  /**
@@ -7824,7 +7842,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7824
7842
  /**
7825
7843
  * @interface
7826
7844
  */
7827
- declare type LayoutComponent = LayoutItemConfig & {
7845
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7828
7846
  /**
7829
7847
  * Only a component type will have this property and it should be set to view.
7830
7848
  */
@@ -7833,6 +7851,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7833
7851
  * Only a component type will have this property and it represents the view options of a given component.
7834
7852
  */
7835
7853
  componentState?: Partial<ViewCreationOptions>;
7854
+ type: 'component';
7836
7855
  };
7837
7856
 
7838
7857
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7916,10 +7935,7 @@ declare type LayoutIdentity = Identity_4 & {
7916
7935
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7917
7936
  type: 'layout-initialized';
7918
7937
  layoutIdentity: OpenFin_2.LayoutIdentity;
7919
- ofViews: {
7920
- identity: OpenFin_2.Identity;
7921
- entityType: 'view';
7922
- }[];
7938
+ ofViews: OpenFin_2.ViewCreationResult[];
7923
7939
  };
7924
7940
 
7925
7941
  /**
@@ -8027,7 +8043,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
8027
8043
  /**
8028
8044
  * @experimental
8029
8045
  */
8030
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
8046
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
8031
8047
  /**
8032
8048
  * @experimental
8033
8049
  */
@@ -9192,6 +9208,12 @@ declare type MutableWindowOptions = {
9192
9208
  * Shows the window's icon in the taskbar.
9193
9209
  */
9194
9210
  showTaskbarIcon: boolean;
9211
+ /**
9212
+ * Specify a taskbar group for the window.
9213
+ * _If omitted, defaults to app's uuid (`fin.Application.getCurrentSync().identity.uuid`)._
9214
+ * @remarks It's only updatable when `enableJumpList` is set to false.
9215
+ */
9216
+ taskbarIconGroup: string;
9195
9217
  interop: InteropConfig;
9196
9218
  /**
9197
9219
  * @internal
@@ -9466,6 +9488,9 @@ declare namespace OpenFin_2 {
9466
9488
  ViewOptions,
9467
9489
  ConstViewOptions,
9468
9490
  ViewState,
9491
+ ViewCreationSuccess,
9492
+ ViewCreationFailure,
9493
+ ViewCreationResult,
9469
9494
  Certificate,
9470
9495
  HostContextChangedPayload,
9471
9496
  ApplySnapshotOptions,
@@ -11352,6 +11377,45 @@ declare interface PlatformProvider {
11352
11377
  * @returns {Promise<void>}
11353
11378
  */
11354
11379
  handleRunRequested({ manifest, userAppConfigArgs }: RunRequestedEvent): Promise<void>;
11380
+ /**
11381
+ * @experimental
11382
+ *
11383
+ * This method is called to handle errors with view creation and initial navigation during layout creation.
11384
+ * Overriding this method enables catching the error and correcting behavior (ie navigating to an error page).
11385
+ * * To indicate that the error has been handled, view creation should be treated as successful return {identity: viewIdentity, success: true}.
11386
+ * * Not returning anything will cause the layout-initialized event to include the view as failed with the original error.
11387
+ * * Throwing an error will update the error on the event payload of layout-initialized to the thrown error.
11388
+ *
11389
+ * @param viewIdentity Identity of the view
11390
+ * @param error error thrown during a view creation
11391
+ * @returns {Promise<OpenFin.ViewCreationSuccess | void>}
11392
+ *
11393
+ * @example
11394
+ *
11395
+ * ```js
11396
+ * const overrideCallback = (PlatformProvider) => {
11397
+ * class Override extends PlatformProvider {
11398
+ * async handleFailedViewCreation(viewIdentity, error) {
11399
+ * const view = fin.View.wrapSync(viewId);
11400
+ * try {
11401
+ * // navigate to an error page
11402
+ * await view.navigate('http://localhost:3000/errorPage.html');
11403
+ * // resolve a success result after redirecting to a error page
11404
+ * return {identity: viewIdentity, success: true};
11405
+ * } catch(e) {
11406
+ * // layout-initialized event will include this view with the error
11407
+ * throw error;
11408
+ * }
11409
+ * }
11410
+ * }
11411
+ * return new Override();
11412
+ * }
11413
+ *
11414
+ * fin.Platform.init({ overrideCallback });
11415
+ *
11416
+ * ```
11417
+ */
11418
+ handleFailedViewCreation(viewIdentity: OpenFin_2.Identity, error: Error): Promise<OpenFin_2.ViewCreationSuccess | void>;
11355
11419
  }
11356
11420
 
11357
11421
  /**
@@ -16058,6 +16122,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
16058
16122
  options?: Partial<ViewOptions>;
16059
16123
  };
16060
16124
 
16125
+ /**
16126
+ * @interface
16127
+ */
16128
+ declare type ViewCreationFailure = {
16129
+ /**
16130
+ * The identity of the created view
16131
+ */
16132
+ identity: Identity_4;
16133
+ /**
16134
+ * Whether the view was created with errors
16135
+ */
16136
+ success: false;
16137
+ /**
16138
+ * Error thrown during view creation
16139
+ */
16140
+ error: Error;
16141
+ };
16142
+
16061
16143
  /**
16062
16144
  * The options object required by {@link View.ViewModule.create View.create}.
16063
16145
  *
@@ -16073,6 +16155,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
16073
16155
 
16074
16156
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
16075
16157
 
16158
+ /**
16159
+ * A view creation state
16160
+ */
16161
+ declare type ViewCreationResult = ViewCreationSuccess | ViewCreationFailure;
16162
+
16163
+ /**
16164
+ * @interface
16165
+ */
16166
+ declare type ViewCreationSuccess = {
16167
+ /**
16168
+ * The identity of the created view
16169
+ */
16170
+ identity: Identity_4;
16171
+ /**
16172
+ * Whether the view was created without errors
16173
+ */
16174
+ success: true;
16175
+ };
16176
+
16076
16177
  /**
16077
16178
  * Generated when a window has a view detached from it.
16078
16179
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
package/out/mock.js CHANGED
@@ -11893,7 +11893,7 @@ var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
11893
11893
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11894
11894
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11895
11895
  };
11896
- var _Layout_layoutClient;
11896
+ var _Layout_instances, _Layout_layoutClient, _Layout_forwardLayoutAction;
11897
11897
  Object.defineProperty(Instance$1, "__esModule", { value: true });
11898
11898
  Instance$1.Layout = void 0;
11899
11899
  const lazy_1 = lazy;
@@ -12047,6 +12047,7 @@ class Layout extends base_1$5.Base {
12047
12047
  // eslint-disable-next-line no-shadow
12048
12048
  constructor(identity, wire) {
12049
12049
  super(wire);
12050
+ _Layout_instances.add(this);
12050
12051
  /**
12051
12052
  * @internal
12052
12053
  * Lazily constructed {@link LayoutEntitiesClient} bound to this platform's client and identity
@@ -12286,9 +12287,50 @@ class Layout extends base_1$5.Base {
12286
12287
  }
12287
12288
  return layout_entities_1.LayoutNode.getEntity(stack, client);
12288
12289
  }
12290
+ /**
12291
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
12292
+ *
12293
+ * @param viewOptions - The options for creating the view.
12294
+ * @param options - Optional parameters for adding the view.
12295
+ * @param options.location - The location where the view should be added.
12296
+ * @param options.targetView - The target view to which the new view should be added.
12297
+ * @returns A promise that resolves to an object containing the identity of the added view.
12298
+ */
12299
+ async addView(viewOptions, { location, targetView } = {}) {
12300
+ this.wire.sendAction('layout-add-view').catch((e) => {
12301
+ // don't expose
12302
+ });
12303
+ const { identity } = await __classPrivateFieldGet$4(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
12304
+ viewOptions,
12305
+ location,
12306
+ targetView
12307
+ });
12308
+ return { identity };
12309
+ }
12310
+ /**
12311
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
12312
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
12313
+ *
12314
+ * @param viewIdentity - The identity of the view to close.
12315
+ * @returns A promise that resolves when the view is closed.
12316
+ */
12317
+ async closeView(viewIdentity) {
12318
+ this.wire.sendAction('layout-close-view').catch((e) => {
12319
+ // don't expose
12320
+ });
12321
+ await __classPrivateFieldGet$4(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
12322
+ }
12289
12323
  }
12290
12324
  Instance$1.Layout = Layout;
12291
- _Layout_layoutClient = new WeakMap();
12325
+ _Layout_layoutClient = new WeakMap(), _Layout_instances = new WeakSet(), _Layout_forwardLayoutAction =
12326
+ /**
12327
+ * @internal
12328
+ * Use to type-guard actions sent to the layout via the provider.
12329
+ */
12330
+ async function _Layout_forwardLayoutAction(action, payload) {
12331
+ const client = await this.platform.getClient();
12332
+ return client.dispatch(action, { target: this.identity, opts: payload });
12333
+ };
12292
12334
 
12293
12335
  var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12294
12336
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "40.82.20",
3
+ "version": "40.82.22",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/mock.js",