@openfin/core 39.83.4 → 39.83.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.
@@ -7682,6 +7682,29 @@ declare class Layout extends Base {
7682
7682
  * ```
7683
7683
  */
7684
7684
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7685
+ /**
7686
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7687
+ *
7688
+ * @param viewOptions - The options for creating the view.
7689
+ * @param options - Optional parameters for adding the view.
7690
+ * @param options.location - The location where the view should be added.
7691
+ * @param options.targetView - The target view to which the new view should be added.
7692
+ * @returns A promise that resolves to an object containing the identity of the added view.
7693
+ */
7694
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7695
+ location?: OpenFin_2.CreateViewTarget['location'];
7696
+ targetView?: OpenFin_2.Identity;
7697
+ }): Promise<{
7698
+ identity: OpenFin_2.Identity;
7699
+ }>;
7700
+ /**
7701
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7702
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7703
+ *
7704
+ * @param viewIdentity - The identity of the view to close.
7705
+ * @returns A promise that resolves when the view is closed.
7706
+ */
7707
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7685
7708
  }
7686
7709
 
7687
7710
  /**
@@ -7694,7 +7717,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7694
7717
  /**
7695
7718
  * @interface
7696
7719
  */
7697
- declare type LayoutComponent = LayoutItemConfig & {
7720
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7698
7721
  /**
7699
7722
  * Only a component type will have this property and it should be set to view.
7700
7723
  */
@@ -7703,6 +7726,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7703
7726
  * Only a component type will have this property and it represents the view options of a given component.
7704
7727
  */
7705
7728
  componentState?: Partial<ViewCreationOptions>;
7729
+ type: 'component';
7706
7730
  };
7707
7731
 
7708
7732
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7786,10 +7810,7 @@ declare type LayoutIdentity = Identity_4 & {
7786
7810
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7787
7811
  type: 'layout-initialized';
7788
7812
  layoutIdentity: OpenFin_2.LayoutIdentity;
7789
- ofViews: {
7790
- identity: OpenFin_2.Identity;
7791
- entityType: 'view';
7792
- }[];
7813
+ ofViews: OpenFin_2.ViewCreationResult[];
7793
7814
  };
7794
7815
 
7795
7816
  /**
@@ -7897,7 +7918,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
7897
7918
  /**
7898
7919
  * @experimental
7899
7920
  */
7900
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
7921
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
7901
7922
  /**
7902
7923
  * @experimental
7903
7924
  */
@@ -9150,6 +9171,9 @@ declare namespace OpenFin_2 {
9150
9171
  ViewOptions,
9151
9172
  ConstViewOptions,
9152
9173
  ViewState,
9174
+ ViewCreationSuccess,
9175
+ ViewCreationFailure,
9176
+ ViewCreationResult,
9153
9177
  Certificate,
9154
9178
  HostContextChangedPayload,
9155
9179
  ApplySnapshotOptions,
@@ -10952,6 +10976,45 @@ declare interface PlatformProvider {
10952
10976
  * @returns {Promise<void>}
10953
10977
  */
10954
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>;
10955
11018
  }
10956
11019
 
10957
11020
  /**
@@ -15608,6 +15671,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
15608
15671
  options?: Partial<ViewOptions>;
15609
15672
  };
15610
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
+
15611
15692
  /**
15612
15693
  * The options object required by {@link View.ViewModule.create View.create}.
15613
15694
  *
@@ -15623,6 +15704,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
15623
15704
 
15624
15705
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
15625
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
+
15626
15726
  /**
15627
15727
  * Generated when a window has a view detached from it.
15628
15728
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
@@ -7682,6 +7682,29 @@ declare class Layout extends Base {
7682
7682
  * ```
7683
7683
  */
7684
7684
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7685
+ /**
7686
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7687
+ *
7688
+ * @param viewOptions - The options for creating the view.
7689
+ * @param options - Optional parameters for adding the view.
7690
+ * @param options.location - The location where the view should be added.
7691
+ * @param options.targetView - The target view to which the new view should be added.
7692
+ * @returns A promise that resolves to an object containing the identity of the added view.
7693
+ */
7694
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7695
+ location?: OpenFin_2.CreateViewTarget['location'];
7696
+ targetView?: OpenFin_2.Identity;
7697
+ }): Promise<{
7698
+ identity: OpenFin_2.Identity;
7699
+ }>;
7700
+ /**
7701
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7702
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7703
+ *
7704
+ * @param viewIdentity - The identity of the view to close.
7705
+ * @returns A promise that resolves when the view is closed.
7706
+ */
7707
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7685
7708
  }
7686
7709
 
7687
7710
  /**
@@ -7694,7 +7717,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7694
7717
  /**
7695
7718
  * @interface
7696
7719
  */
7697
- declare type LayoutComponent = LayoutItemConfig & {
7720
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7698
7721
  /**
7699
7722
  * Only a component type will have this property and it should be set to view.
7700
7723
  */
@@ -7703,6 +7726,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7703
7726
  * Only a component type will have this property and it represents the view options of a given component.
7704
7727
  */
7705
7728
  componentState?: Partial<ViewCreationOptions>;
7729
+ type: 'component';
7706
7730
  };
7707
7731
 
7708
7732
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7786,10 +7810,7 @@ declare type LayoutIdentity = Identity_4 & {
7786
7810
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7787
7811
  type: 'layout-initialized';
7788
7812
  layoutIdentity: OpenFin_2.LayoutIdentity;
7789
- ofViews: {
7790
- identity: OpenFin_2.Identity;
7791
- entityType: 'view';
7792
- }[];
7813
+ ofViews: OpenFin_2.ViewCreationResult[];
7793
7814
  };
7794
7815
 
7795
7816
  /**
@@ -7897,7 +7918,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
7897
7918
  /**
7898
7919
  * @experimental
7899
7920
  */
7900
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
7921
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
7901
7922
  /**
7902
7923
  * @experimental
7903
7924
  */
@@ -9150,6 +9171,9 @@ declare namespace OpenFin_2 {
9150
9171
  ViewOptions,
9151
9172
  ConstViewOptions,
9152
9173
  ViewState,
9174
+ ViewCreationSuccess,
9175
+ ViewCreationFailure,
9176
+ ViewCreationResult,
9153
9177
  Certificate,
9154
9178
  HostContextChangedPayload,
9155
9179
  ApplySnapshotOptions,
@@ -10952,6 +10976,45 @@ declare interface PlatformProvider {
10952
10976
  * @returns {Promise<void>}
10953
10977
  */
10954
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>;
10955
11018
  }
10956
11019
 
10957
11020
  /**
@@ -15608,6 +15671,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
15608
15671
  options?: Partial<ViewOptions>;
15609
15672
  };
15610
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
+
15611
15692
  /**
15612
15693
  * The options object required by {@link View.ViewModule.create View.create}.
15613
15694
  *
@@ -15623,6 +15704,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
15623
15704
 
15624
15705
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
15625
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
+
15626
15726
  /**
15627
15727
  * Generated when a window has a view detached from it.
15628
15728
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
@@ -7682,6 +7682,29 @@ declare class Layout extends Base {
7682
7682
  * ```
7683
7683
  */
7684
7684
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7685
+ /**
7686
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7687
+ *
7688
+ * @param viewOptions - The options for creating the view.
7689
+ * @param options - Optional parameters for adding the view.
7690
+ * @param options.location - The location where the view should be added.
7691
+ * @param options.targetView - The target view to which the new view should be added.
7692
+ * @returns A promise that resolves to an object containing the identity of the added view.
7693
+ */
7694
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7695
+ location?: OpenFin_2.CreateViewTarget['location'];
7696
+ targetView?: OpenFin_2.Identity;
7697
+ }): Promise<{
7698
+ identity: OpenFin_2.Identity;
7699
+ }>;
7700
+ /**
7701
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7702
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7703
+ *
7704
+ * @param viewIdentity - The identity of the view to close.
7705
+ * @returns A promise that resolves when the view is closed.
7706
+ */
7707
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7685
7708
  }
7686
7709
 
7687
7710
  /**
@@ -7694,7 +7717,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7694
7717
  /**
7695
7718
  * @interface
7696
7719
  */
7697
- declare type LayoutComponent = LayoutItemConfig & {
7720
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7698
7721
  /**
7699
7722
  * Only a component type will have this property and it should be set to view.
7700
7723
  */
@@ -7703,6 +7726,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7703
7726
  * Only a component type will have this property and it represents the view options of a given component.
7704
7727
  */
7705
7728
  componentState?: Partial<ViewCreationOptions>;
7729
+ type: 'component';
7706
7730
  };
7707
7731
 
7708
7732
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7786,10 +7810,7 @@ declare type LayoutIdentity = Identity_4 & {
7786
7810
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7787
7811
  type: 'layout-initialized';
7788
7812
  layoutIdentity: OpenFin_2.LayoutIdentity;
7789
- ofViews: {
7790
- identity: OpenFin_2.Identity;
7791
- entityType: 'view';
7792
- }[];
7813
+ ofViews: OpenFin_2.ViewCreationResult[];
7793
7814
  };
7794
7815
 
7795
7816
  /**
@@ -7897,7 +7918,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
7897
7918
  /**
7898
7919
  * @experimental
7899
7920
  */
7900
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
7921
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
7901
7922
  /**
7902
7923
  * @experimental
7903
7924
  */
@@ -9150,6 +9171,9 @@ declare namespace OpenFin_2 {
9150
9171
  ViewOptions,
9151
9172
  ConstViewOptions,
9152
9173
  ViewState,
9174
+ ViewCreationSuccess,
9175
+ ViewCreationFailure,
9176
+ ViewCreationResult,
9153
9177
  Certificate,
9154
9178
  HostContextChangedPayload,
9155
9179
  ApplySnapshotOptions,
@@ -10952,6 +10976,45 @@ declare interface PlatformProvider {
10952
10976
  * @returns {Promise<void>}
10953
10977
  */
10954
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>;
10955
11018
  }
10956
11019
 
10957
11020
  /**
@@ -15608,6 +15671,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
15608
15671
  options?: Partial<ViewOptions>;
15609
15672
  };
15610
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
+
15611
15692
  /**
15612
15693
  * The options object required by {@link View.ViewModule.create View.create}.
15613
15694
  *
@@ -15623,6 +15704,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
15623
15704
 
15624
15705
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
15625
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
+
15626
15726
  /**
15627
15727
  * Generated when a window has a view detached from it.
15628
15728
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
package/out/mock.d.ts CHANGED
@@ -7808,6 +7808,29 @@ declare class Layout extends Base {
7808
7808
  * ```
7809
7809
  */
7810
7810
  applyPreset: (options: PresetLayoutOptions) => Promise<void>;
7811
+ /**
7812
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
7813
+ *
7814
+ * @param viewOptions - The options for creating the view.
7815
+ * @param options - Optional parameters for adding the view.
7816
+ * @param options.location - The location where the view should be added.
7817
+ * @param options.targetView - The target view to which the new view should be added.
7818
+ * @returns A promise that resolves to an object containing the identity of the added view.
7819
+ */
7820
+ addView(viewOptions: OpenFin_2.PlatformViewCreationOptions, { location, targetView }?: {
7821
+ location?: OpenFin_2.CreateViewTarget['location'];
7822
+ targetView?: OpenFin_2.Identity;
7823
+ }): Promise<{
7824
+ identity: OpenFin_2.Identity;
7825
+ }>;
7826
+ /**
7827
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
7828
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
7829
+ *
7830
+ * @param viewIdentity - The identity of the view to close.
7831
+ * @returns A promise that resolves when the view is closed.
7832
+ */
7833
+ closeView(viewIdentity: OpenFin_2.Identity): Promise<void>;
7811
7834
  }
7812
7835
 
7813
7836
  /**
@@ -7820,7 +7843,7 @@ declare type LayoutColumn = LayoutItemConfig & {
7820
7843
  /**
7821
7844
  * @interface
7822
7845
  */
7823
- declare type LayoutComponent = LayoutItemConfig & {
7846
+ declare type LayoutComponent = Omit<LayoutItemConfig, 'content' | 'type'> & {
7824
7847
  /**
7825
7848
  * Only a component type will have this property and it should be set to view.
7826
7849
  */
@@ -7829,6 +7852,7 @@ declare type LayoutComponent = LayoutItemConfig & {
7829
7852
  * Only a component type will have this property and it represents the view options of a given component.
7830
7853
  */
7831
7854
  componentState?: Partial<ViewCreationOptions>;
7855
+ type: 'component';
7832
7856
  };
7833
7857
 
7834
7858
  declare type LayoutContent = Array<LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent>;
@@ -7912,10 +7936,7 @@ declare type LayoutIdentity = Identity_4 & {
7912
7936
  declare type LayoutInitializedEvent = BaseEvent_5 & {
7913
7937
  type: 'layout-initialized';
7914
7938
  layoutIdentity: OpenFin_2.LayoutIdentity;
7915
- ofViews: {
7916
- identity: OpenFin_2.Identity;
7917
- entityType: 'view';
7918
- }[];
7939
+ ofViews: OpenFin_2.ViewCreationResult[];
7919
7940
  };
7920
7941
 
7921
7942
  /**
@@ -8023,7 +8044,7 @@ declare interface LayoutManager<T extends LayoutSnapshot> {
8023
8044
  /**
8024
8045
  * @experimental
8025
8046
  */
8026
- getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity;
8047
+ getLayoutIdentityForView(viewIdentity: Identity_4): LayoutIdentity | undefined;
8027
8048
  /**
8028
8049
  * @experimental
8029
8050
  */
@@ -9468,6 +9489,9 @@ declare namespace OpenFin_2 {
9468
9489
  ViewOptions,
9469
9490
  ConstViewOptions,
9470
9491
  ViewState,
9492
+ ViewCreationSuccess,
9493
+ ViewCreationFailure,
9494
+ ViewCreationResult,
9471
9495
  Certificate,
9472
9496
  HostContextChangedPayload,
9473
9497
  ApplySnapshotOptions,
@@ -11348,6 +11372,45 @@ declare interface PlatformProvider {
11348
11372
  * @returns {Promise<void>}
11349
11373
  */
11350
11374
  handleRunRequested({ manifest, userAppConfigArgs }: RunRequestedEvent): Promise<void>;
11375
+ /**
11376
+ * @experimental
11377
+ *
11378
+ * This method is called to handle errors with view creation and initial navigation during layout creation.
11379
+ * Overriding this method enables catching the error and correcting behavior (ie navigating to an error page).
11380
+ * * To indicate that the error has been handled, view creation should be treated as successful return {identity: viewIdentity, success: true}.
11381
+ * * Not returning anything will cause the layout-initialized event to include the view as failed with the original error.
11382
+ * * Throwing an error will update the error on the event payload of layout-initialized to the thrown error.
11383
+ *
11384
+ * @param viewIdentity Identity of the view
11385
+ * @param error error thrown during a view creation
11386
+ * @returns {Promise<OpenFin.ViewCreationSuccess | void>}
11387
+ *
11388
+ * @example
11389
+ *
11390
+ * ```js
11391
+ * const overrideCallback = (PlatformProvider) => {
11392
+ * class Override extends PlatformProvider {
11393
+ * async handleFailedViewCreation(viewIdentity, error) {
11394
+ * const view = fin.View.wrapSync(viewId);
11395
+ * try {
11396
+ * // navigate to an error page
11397
+ * await view.navigate('http://localhost:3000/errorPage.html');
11398
+ * // resolve a success result after redirecting to a error page
11399
+ * return {identity: viewIdentity, success: true};
11400
+ * } catch(e) {
11401
+ * // layout-initialized event will include this view with the error
11402
+ * throw error;
11403
+ * }
11404
+ * }
11405
+ * }
11406
+ * return new Override();
11407
+ * }
11408
+ *
11409
+ * fin.Platform.init({ overrideCallback });
11410
+ *
11411
+ * ```
11412
+ */
11413
+ handleFailedViewCreation(viewIdentity: OpenFin_2.Identity, error: Error): Promise<OpenFin_2.ViewCreationSuccess | void>;
11351
11414
  }
11352
11415
 
11353
11416
  /**
@@ -16054,6 +16117,24 @@ declare type ViewContentCreationRule = BaseContentCreationRule & {
16054
16117
  options?: Partial<ViewOptions>;
16055
16118
  };
16056
16119
 
16120
+ /**
16121
+ * @interface
16122
+ */
16123
+ declare type ViewCreationFailure = {
16124
+ /**
16125
+ * The identity of the created view
16126
+ */
16127
+ identity: Identity_4;
16128
+ /**
16129
+ * Whether the view was created with errors
16130
+ */
16131
+ success: false;
16132
+ /**
16133
+ * Error thrown during view creation
16134
+ */
16135
+ error: Error;
16136
+ };
16137
+
16057
16138
  /**
16058
16139
  * The options object required by {@link View.ViewModule.create View.create}.
16059
16140
  *
@@ -16069,6 +16150,25 @@ declare type ViewCreationOptions = Partial<ViewOptions> & {
16069
16150
 
16070
16151
  declare type ViewCreationOrReference = OpenFin_2.Identity | OpenFin_2.PlatformViewCreationOptions;
16071
16152
 
16153
+ /**
16154
+ * A view creation state
16155
+ */
16156
+ declare type ViewCreationResult = ViewCreationSuccess | ViewCreationFailure;
16157
+
16158
+ /**
16159
+ * @interface
16160
+ */
16161
+ declare type ViewCreationSuccess = {
16162
+ /**
16163
+ * The identity of the created view
16164
+ */
16165
+ identity: Identity_4;
16166
+ /**
16167
+ * Whether the view was created without errors
16168
+ */
16169
+ success: true;
16170
+ };
16171
+
16072
16172
  /**
16073
16173
  * Generated when a window has a view detached from it.
16074
16174
  * @remarks Will fire when a view is destroyed in which case `target` will be null.
package/out/mock.js CHANGED
@@ -11735,7 +11735,7 @@ var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateF
11735
11735
  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");
11736
11736
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11737
11737
  };
11738
- var _Layout_layoutClient;
11738
+ var _Layout_instances, _Layout_layoutClient, _Layout_forwardLayoutAction;
11739
11739
  Object.defineProperty(Instance$1, "__esModule", { value: true });
11740
11740
  Instance$1.Layout = void 0;
11741
11741
  const lazy_1 = lazy;
@@ -11889,6 +11889,7 @@ class Layout extends base_1$5.Base {
11889
11889
  // eslint-disable-next-line no-shadow
11890
11890
  constructor(identity, wire) {
11891
11891
  super(wire);
11892
+ _Layout_instances.add(this);
11892
11893
  /**
11893
11894
  * @internal
11894
11895
  * Lazily constructed {@link LayoutEntitiesClient} bound to this platform's client and identity
@@ -12128,9 +12129,50 @@ class Layout extends base_1$5.Base {
12128
12129
  }
12129
12130
  return layout_entities_1.LayoutNode.getEntity(stack, client);
12130
12131
  }
12132
+ /**
12133
+ * Adds a view to the platform layout. Behaves like @link{Platform#createView} with the current layout as the target.
12134
+ *
12135
+ * @param viewOptions - The options for creating the view.
12136
+ * @param options - Optional parameters for adding the view.
12137
+ * @param options.location - The location where the view should be added.
12138
+ * @param options.targetView - The target view to which the new view should be added.
12139
+ * @returns A promise that resolves to an object containing the identity of the added view.
12140
+ */
12141
+ async addView(viewOptions, { location, targetView } = {}) {
12142
+ this.wire.sendAction('layout-add-view').catch((e) => {
12143
+ // don't expose
12144
+ });
12145
+ const { identity } = await __classPrivateFieldGet$4(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
12146
+ viewOptions,
12147
+ location,
12148
+ targetView
12149
+ });
12150
+ return { identity };
12151
+ }
12152
+ /**
12153
+ * Closes a view by its identity. Throws an error if the view does not belong to the current layout.
12154
+ * Behaves like @link{Platform#closeView} but only closes the view if it belongs the current layout.
12155
+ *
12156
+ * @param viewIdentity - The identity of the view to close.
12157
+ * @returns A promise that resolves when the view is closed.
12158
+ */
12159
+ async closeView(viewIdentity) {
12160
+ this.wire.sendAction('layout-close-view').catch((e) => {
12161
+ // don't expose
12162
+ });
12163
+ await __classPrivateFieldGet$4(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
12164
+ }
12131
12165
  }
12132
12166
  Instance$1.Layout = Layout;
12133
- _Layout_layoutClient = new WeakMap();
12167
+ _Layout_layoutClient = new WeakMap(), _Layout_instances = new WeakSet(), _Layout_forwardLayoutAction =
12168
+ /**
12169
+ * @internal
12170
+ * Use to type-guard actions sent to the layout via the provider.
12171
+ */
12172
+ async function _Layout_forwardLayoutAction(action, payload) {
12173
+ const client = await this.platform.getClient();
12174
+ return client.dispatch(action, { target: this.identity, opts: payload });
12175
+ };
12134
12176
 
12135
12177
  var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12136
12178
  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": "39.83.4",
3
+ "version": "39.83.5",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/mock.js",