@openfin/core 30.73.23 → 30.73.24

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.
Files changed (77) hide show
  1. package/LICENSE.md +4 -0
  2. package/package.json +2 -2
  3. package/src/OpenFin.d.ts +1678 -188
  4. package/src/api/application/Factory.d.ts +1 -0
  5. package/src/api/application/Factory.js +1 -0
  6. package/src/api/application/Instance.d.ts +2 -1
  7. package/src/api/application/Instance.js +1 -0
  8. package/src/api/base.d.ts +16 -14
  9. package/src/api/base.js +2 -2
  10. package/src/api/clipboard/index.d.ts +1 -0
  11. package/src/api/clipboard/index.js +1 -0
  12. package/src/api/events/application.d.ts +65 -56
  13. package/src/api/events/base.d.ts +33 -15
  14. package/src/api/events/channel.d.ts +13 -8
  15. package/src/api/events/eventAggregator.js +1 -9
  16. package/src/api/events/externalApplication.d.ts +10 -5
  17. package/src/api/events/frame.d.ts +13 -7
  18. package/src/api/events/globalHotkey.d.ts +11 -12
  19. package/src/api/events/platform.d.ts +10 -16
  20. package/src/api/events/system.d.ts +41 -29
  21. package/src/api/events/typedEventEmitter.d.ts +15 -8
  22. package/src/api/events/view.d.ts +37 -54
  23. package/src/api/events/webcontents.d.ts +74 -28
  24. package/src/api/events/window.d.ts +147 -134
  25. package/src/api/external-application/Instance.d.ts +1 -1
  26. package/src/api/frame/Instance.d.ts +1 -1
  27. package/src/api/global-hotkey/index.d.ts +1 -3
  28. package/src/api/global-hotkey/index.js +6 -0
  29. package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
  30. package/src/api/interappbus/channel/channels-docs.js +7 -0
  31. package/src/api/interappbus/channel/client.d.ts +2 -1
  32. package/src/api/interappbus/channel/client.js +12 -5
  33. package/src/api/interappbus/channel/index.d.ts +2 -2
  34. package/src/api/interappbus/channel/index.js +7 -7
  35. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  36. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
  37. package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
  38. package/src/api/interop/Factory.d.ts +1 -2
  39. package/src/api/interop/Factory.js +20 -4
  40. package/src/api/interop/InteropBroker.d.ts +15 -47
  41. package/src/api/interop/InteropBroker.js +33 -47
  42. package/src/api/interop/InteropClient.d.ts +9 -8
  43. package/src/api/interop/InteropClient.js +9 -8
  44. package/src/api/interop/fdc3/fdc3-1.2.js +8 -8
  45. package/src/api/interop/fdc3/fdc3-2.0.d.ts +1 -1
  46. package/src/api/interop/fdc3/fdc3-2.0.js +15 -7
  47. package/src/api/interop/fdc3/fdc3.d.ts +3 -4
  48. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  49. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  50. package/src/api/interop/fdc3/versions.d.ts +1 -0
  51. package/src/api/interop/fdc3/versions.js +2 -0
  52. package/src/api/platform/Factory.d.ts +5 -0
  53. package/src/api/platform/Factory.js +9 -0
  54. package/src/api/platform/Instance.d.ts +7 -6
  55. package/src/api/platform/Instance.js +6 -3
  56. package/src/api/platform/layout/Factory.d.ts +4 -0
  57. package/src/api/platform/layout/Factory.js +4 -0
  58. package/src/api/platform/provider.d.ts +162 -0
  59. package/src/api/platform/provider.js +2 -0
  60. package/src/api/snapshot-source/Factory.d.ts +1 -0
  61. package/src/api/snapshot-source/Factory.js +1 -0
  62. package/src/api/system/index.d.ts +1 -2
  63. package/src/api/system/index.js +22 -6
  64. package/src/api/view/Instance.d.ts +8 -4
  65. package/src/api/view/Instance.js +7 -4
  66. package/src/api/webcontents/main.d.ts +19 -5
  67. package/src/api/webcontents/main.js +10 -0
  68. package/src/api/window/Instance.d.ts +21 -3
  69. package/src/api/window/Instance.js +22 -0
  70. package/src/namespaces.d.ts +21 -0
  71. package/src/namespaces.js +24 -0
  72. package/src/transport/transport-errors.d.ts +6 -1
  73. package/src/transport/transport-errors.js +1 -2
  74. package/src/transport/transport.d.ts +10 -7
  75. package/src/transport/transport.js +9 -1
  76. package/src/util/inaccessibleObject.d.ts +2 -0
  77. package/src/util/inaccessibleObject.js +49 -0
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.overrideCheck = exports.getDefaultViewFdc3VersionFromAppInfo = void 0;
4
+ const InteropBroker_1 = require("../InteropBroker");
5
+ function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
6
+ var _a, _b, _c, _d;
7
+ const setVersion = (_c = (_b = (_a = manifest.platform) === null || _a === void 0 ? void 0 : _a.defaultViewOptions) === null || _b === void 0 ? void 0 : _b.fdc3InteropApi) !== null && _c !== void 0 ? _c : (_d = initialOptions.defaultViewOptions) === null || _d === void 0 ? void 0 : _d.fdc3InteropApi;
8
+ return ['1.2', '2.0'].includes(setVersion !== null && setVersion !== void 0 ? setVersion : '') ? setVersion : undefined;
9
+ }
10
+ exports.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
11
+ // TODO: Unit test this
12
+ function overrideCheck(overriddenBroker, fdc3InteropApi) {
13
+ if (fdc3InteropApi && fdc3InteropApi === '2.0') {
14
+ const mustOverrideAPIs = [
15
+ 'fdc3HandleFindInstances',
16
+ 'handleInfoForIntent',
17
+ 'handleInfoForIntentsByContext',
18
+ 'fdc3HandleGetAppMetadata',
19
+ 'fdc3HandleGetInfo',
20
+ 'fdc3HandleOpen',
21
+ 'handleFiredIntent',
22
+ 'handleFiredIntentForContext'
23
+ ];
24
+ const notOverridden = mustOverrideAPIs.filter((api) => {
25
+ return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
26
+ });
27
+ if (notOverridden.length > 0) {
28
+ console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
29
+ }
30
+ }
31
+ }
32
+ exports.overrideCheck = overrideCheck;
@@ -0,0 +1 @@
1
+ export declare type Fdc3Version = '1.2' | '2.0';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,17 +4,20 @@ import { Channel } from '../interappbus/channel/index';
4
4
  import Transport from '../../transport/transport';
5
5
  import { LayoutModule } from './layout/index';
6
6
  /**
7
+ * @PORTED
7
8
  * InitPlatformOptions interface
8
9
  * @typedef { object } InitPlatformOptions
9
10
  * @property { OverrideCallback } [overrideCallback] a callback function that can be used to extend or replace default Provider behavior.
10
11
  */
11
12
  /**
13
+ * @PORTED
12
14
  * @typedef { same | different } ProcessAffinityStrategy
13
15
  * @summary Strategy to place views that share a domain into different process affinities or the same process affinity.
14
16
  * @property { string } same views in the same domain will have the same process affinity.
15
17
  * @property { string } different views in the same domain will have different process affinities.
16
18
  */
17
19
  /**
20
+ * @PORTED
18
21
  * @typedef { object } PlatformOptions
19
22
  * @summary The options object required by {@link Platform#start Platform.start}
20
23
  * Any {@link ApplicationOptions Application option} is also a valid platform option
@@ -25,6 +28,7 @@ import { LayoutModule } from './layout/index';
25
28
  * @property {ProcessAffinityStrategy} [viewProcessAffinityStrategy] 'same' | 'different'.
26
29
  */
27
30
  /**
31
+ * @PORTED
28
32
  * @typedef { object } DefaultWindowOptions
29
33
  * @summary Default window options apply to all platform windows.
30
34
  * Any {@link Window~options Window option} is also a valid Default Window option
@@ -36,6 +40,7 @@ import { LayoutModule } from './layout/index';
36
40
  * Windows with a specified url (Custom Windows) will not be affected by this option.
37
41
  */
38
42
  /**
43
+ * @DELETED
39
44
  * Snapshot interface
40
45
  * @typedef { object } Snapshot
41
46
  * @property { WindowOption[] } windows The array of window options objects
@@ -5,17 +5,20 @@ const base_1 = require("../base");
5
5
  const index_1 = require("./layout/index");
6
6
  const Instance_1 = require("./Instance");
7
7
  /**
8
+ * @PORTED
8
9
  * InitPlatformOptions interface
9
10
  * @typedef { object } InitPlatformOptions
10
11
  * @property { OverrideCallback } [overrideCallback] a callback function that can be used to extend or replace default Provider behavior.
11
12
  */
12
13
  /**
14
+ * @PORTED
13
15
  * @typedef { same | different } ProcessAffinityStrategy
14
16
  * @summary Strategy to place views that share a domain into different process affinities or the same process affinity.
15
17
  * @property { string } same views in the same domain will have the same process affinity.
16
18
  * @property { string } different views in the same domain will have different process affinities.
17
19
  */
18
20
  /**
21
+ * @PORTED
19
22
  * @typedef { object } PlatformOptions
20
23
  * @summary The options object required by {@link Platform#start Platform.start}
21
24
  * Any {@link ApplicationOptions Application option} is also a valid platform option
@@ -26,6 +29,7 @@ const Instance_1 = require("./Instance");
26
29
  * @property {ProcessAffinityStrategy} [viewProcessAffinityStrategy] 'same' | 'different'.
27
30
  */
28
31
  /**
32
+ * @PORTED
29
33
  * @typedef { object } DefaultWindowOptions
30
34
  * @summary Default window options apply to all platform windows.
31
35
  * Any {@link Window~options Window option} is also a valid Default Window option
@@ -37,6 +41,7 @@ const Instance_1 = require("./Instance");
37
41
  * Windows with a specified url (Custom Windows) will not be affected by this option.
38
42
  */
39
43
  /**
44
+ * @DELETED
40
45
  * Snapshot interface
41
46
  * @typedef { object } Snapshot
42
47
  * @property { WindowOption[] } windows The array of window options objects
@@ -145,6 +150,8 @@ class PlatformModule extends base_1.Base {
145
150
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
146
151
  // @ts-ignore using private variable.
147
152
  const app = await this.fin.Application._create({ ...platformOptions, isPlatformController: true });
153
+ // TODO: fix typing (internal)
154
+ // @ts-expect-error
148
155
  app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid })));
149
156
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
150
157
  // @ts-ignore using private variable.
@@ -174,6 +181,8 @@ class PlatformModule extends base_1.Base {
174
181
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
175
182
  // @ts-ignore using private variable.
176
183
  const app = await this.fin.Application._createFromManifest(manifestUrl);
184
+ // TODO: fix typing (internal)
185
+ // @ts-expect-error
177
186
  app.once('platform-api-ready', () => resolve(this.wrapSync({ uuid: app.identity.uuid })));
178
187
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
179
188
  // @ts-ignore using private method without warning.
@@ -4,14 +4,14 @@ import { EmitterBase } from '../base';
4
4
  import { Channel } from '../interappbus/channel/index';
5
5
  import ChannelClient from '../interappbus/channel/client';
6
6
  import { LayoutModule } from './layout';
7
- declare type PlatformEvents = OpenFin.PlatformEvents;
8
7
  /** Manages the life cycle of windows and views in the application.
9
8
  *
10
- * Enables taking snapshots of itself and applying them to restore a previous configuration
9
+ * Enables taking snapshots of itself and applyi
10
+ * ng them to restore a previous configuration
11
11
  * as well as listen to <a href="tutorial-Platform.EventEmitter.html">platform events</a>.
12
12
  * @namespace
13
13
  */
14
- export declare class Platform extends EmitterBase<PlatformEvents> {
14
+ export declare class Platform extends EmitterBase<OpenFin.PlatformEvent> {
15
15
  #private;
16
16
  Layout: LayoutModule;
17
17
  private _channel;
@@ -66,14 +66,16 @@ export declare class Platform extends EmitterBase<PlatformEvents> {
66
66
  */
67
67
  getSnapshot(): Promise<OpenFin.Snapshot>;
68
68
  /**
69
+ * **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
70
+ *
69
71
  * Returns a snapshot of a single view's options in its current state.
70
72
  *
71
73
  * Can be used to restore a view to a previous state.
72
74
  *
73
- * NOTE: this method is meant for advanced usage only, it is not recommended to manage the state of individual views.
74
- *
75
75
  * @param { Identity } viewIdentity View identity
76
76
  * @returns { Promise<ViewState> }
77
+ * @internal
78
+ * @experimental
77
79
  * @tutorial Platform.getViewSnapshot
78
80
  */
79
81
  getViewSnapshot(viewIdentity: OpenFin.Identity): Promise<OpenFin.ViewState>;
@@ -145,4 +147,3 @@ export declare class Platform extends EmitterBase<PlatformEvents> {
145
147
  skipBeforeUnload: boolean;
146
148
  }): Promise<void>;
147
149
  }
148
- export {};
@@ -13,7 +13,8 @@ const validate_1 = require("../../util/validate");
13
13
  const clientMap = new Map();
14
14
  /** Manages the life cycle of windows and views in the application.
15
15
  *
16
- * Enables taking snapshots of itself and applying them to restore a previous configuration
16
+ * Enables taking snapshots of itself and applyi
17
+ * ng them to restore a previous configuration
17
18
  * as well as listen to <a href="tutorial-Platform.EventEmitter.html">platform events</a>.
18
19
  * @namespace
19
20
  */
@@ -174,14 +175,16 @@ class Platform extends base_1.EmitterBase {
174
175
  return client.dispatch('get-snapshot');
175
176
  }
176
177
  /**
178
+ * **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
179
+ *
177
180
  * Returns a snapshot of a single view's options in its current state.
178
181
  *
179
182
  * Can be used to restore a view to a previous state.
180
183
  *
181
- * NOTE: this method is meant for advanced usage only, it is not recommended to manage the state of individual views.
182
- *
183
184
  * @param { Identity } viewIdentity View identity
184
185
  * @returns { Promise<ViewState> }
186
+ * @internal
187
+ * @experimental
185
188
  * @tutorial Platform.getViewSnapshot
186
189
  */
187
190
  async getViewSnapshot(viewIdentity) {
@@ -3,12 +3,14 @@ import { Layout } from './Instance';
3
3
  import { Base } from '../../base';
4
4
  declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
5
5
  /**
6
+ * @PORTED
6
7
  * InitLayoutOptions interface
7
8
  * @typedef { object } InitLayoutOptions
8
9
  * @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
9
10
  * then an element with id `layout-container` is used. We recommend using a div element.
10
11
  */
11
12
  /**
13
+ * @PORTED
12
14
  * PresetLayoutOptions interface
13
15
  * @typedef { object } PresetLayoutOptions
14
16
  * @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
@@ -23,6 +25,7 @@ declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
23
25
  * @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
24
26
  */
25
27
  /**
28
+ * @PORTED
26
29
  * LayoutItem Interface
27
30
  * @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
28
31
  * to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
@@ -34,6 +37,7 @@ declare type InitLayoutOptions = OpenFin.InitLayoutOptions;
34
37
  * options of a given component.
35
38
  */
36
39
  /**
40
+ * @PORTED
37
41
  * LayoutSettings Interface
38
42
  * @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
39
43
  * @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
@@ -20,12 +20,14 @@ const base_1 = require("../../base");
20
20
  const splitter_controller_1 = require("./controllers/splitter-controller");
21
21
  const view_overlay_1 = require("./utils/view-overlay");
22
22
  /**
23
+ * @PORTED
23
24
  * InitLayoutOptions interface
24
25
  * @typedef { object } InitLayoutOptions
25
26
  * @property { string } [containerId] The id attribute of the container where the window's Layout should be initialized. If not provided
26
27
  * then an element with id `layout-container` is used. We recommend using a div element.
27
28
  */
28
29
  /**
30
+ * @PORTED
29
31
  * PresetLayoutOptions interface
30
32
  * @typedef { object } PresetLayoutOptions
31
33
  * @property { LayoutPresetTypes } presetType Which preset layout arrangement to use.
@@ -40,6 +42,7 @@ const view_overlay_1 = require("./utils/view-overlay");
40
42
  * @property { LayoutSettings } settings Configuration for certain Layout behaviors. See the LayoutSettings interface.
41
43
  */
42
44
  /**
45
+ * @PORTED
43
46
  * LayoutItem Interface
44
47
  * @typedef { object } LayoutItem Represents the arrangement of Views within a Platform window's Layout. We do not recommend trying
45
48
  * to build Layouts or LayoutItems by hand and instead use calls such as {@link Platform#getSnapshot getSnapshot} or our
@@ -51,6 +54,7 @@ const view_overlay_1 = require("./utils/view-overlay");
51
54
  * options of a given component.
52
55
  */
53
56
  /**
57
+ * @PORTED
54
58
  * LayoutSettings Interface
55
59
  * @typedef { object } LayoutSettings Represents a potential ways to customize behavior of your Layout
56
60
  * @property { boolean } [constrainDragToHeaders=false] Limits the area to which tabs can be dragged.
@@ -0,0 +1,162 @@
1
+ import { WindowOptionsChangedEvent } from '../events/window';
2
+ import * as OpenFin from '../../OpenFin';
3
+ /**
4
+ * This class handles Platform actions. It does not need to be used directly by developers.
5
+ * However, its methods can be overriden by passing an `overrideCallback` to {@link Platform#init Platform.init}
6
+ * in order to implement custom Platform behavior. (See {@tutorial Platform.init})
7
+ *
8
+ * For an overview of Provider customization, see
9
+ * {@link https://developers.openfin.co/docs/platform-customization#section-customizing-platform-behavior}.
10
+ */
11
+ export interface PlatformProvider {
12
+ /**
13
+ * Handles requests to create a window in the current platform.
14
+ * @param { WindowOption } payload Window options for the window to be created.
15
+ * @param { Identity } [identity] If {@link Platform#createWindow Platform.createWindow} was called, the identity of the caller will be here.
16
+ * If `createWindow` was called as part of applying a snapshot or creating a view without a target window, `identity` will be undefined.
17
+ */
18
+ createWindow(options: OpenFin.PlatformWindowCreationOptions, identity?: OpenFin.Identity): Promise<OpenFin.Window>;
19
+ /**
20
+ * Gets the current state of windows and their views and returns a snapshot object containing that info.
21
+ * @param { undefined } payload Undefined unless you've defined a custom `getSnapshot` protocol.
22
+ * @param { Identity } identity Identity of the entity that called {@link Platform#getSnapshot Platform.getSnapshot}.
23
+ * @return { Promise<Snapshot> } Snapshot of current platform state.
24
+ */
25
+ getSnapshot(payload: undefined, identity: OpenFin.Identity): Promise<OpenFin.Snapshot>;
26
+ /**
27
+ * **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
28
+ * Gets the current state of a single view and returns an object with the options needed to restore that view as part of a snapshot.
29
+ * @param { Identity } payload Identity of the view.
30
+ * @return { Promise<ViewState> }
31
+ * @internal
32
+ * @experimental
33
+ */
34
+ getViewSnapshot(payload: {
35
+ viewIdentity: OpenFin.Identity;
36
+ }): Promise<OpenFin.ViewState>;
37
+ /**
38
+ * Called when a snapshot is being applied and some windows in that snapshot would be fully or partially off-screen.
39
+ * Returns an array of windows with modified positions, such that any off-screen windows are positioned in the top left
40
+ * corner of the main monitor.
41
+ * @param { Snapshot } snapshot The snapshot to be applied.
42
+ * @param { WindowOptions[] } outOfBoundsWindows An array of WindowOptions for any windows that would be off-screen.
43
+ * @return { Promise<WindowOptions[]> } An array of WindowOptions with their position modified to fit on screen.
44
+ */
45
+ positionOutOfBoundsWindows(snapshot: OpenFin.Snapshot, outOfBoundsWindows: OpenFin.WindowCreationOptions[]): Promise<OpenFin.WindowCreationOptions[]>;
46
+ /**
47
+ * Handles requests to apply a snapshot to the current Platform.
48
+ * @param { ApplySnapshotPayload } payload Payload containing the snapshot to be applied, as well as any options.
49
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#applySnapshot Platform.applySnapshot}.
50
+ * Undefined if called internally (e.g. when opening the initial snapshot).
51
+ * @return { Promise<void> }
52
+ */
53
+ applySnapshot(payload: OpenFin.ApplySnapshotPayload, identity?: OpenFin.Identity): Promise<void>;
54
+ /**
55
+ * Closes the current Platform and all child windows and views.
56
+ * @param { undefined } payload Undefined unless you have implemented a custom quite protocol.
57
+ * @param { Identity } identity Identity of the entity that called {@link Platform#quit Platform.quit}.
58
+ * @return { Promise<void> }
59
+ */
60
+ quit(payload: undefined, identity: OpenFin.Identity): Promise<void>;
61
+ /**
62
+ * Closes a view
63
+ * @param { CloseViewPayload } payload Specifies the `target` view to be closed.
64
+ * @param { Identity } identity Identity of the entity that called {@link Platform#closeView Platform.closeView}.
65
+ */
66
+ closeView(payload: OpenFin.CloseViewPayload, identity?: OpenFin.Identity): Promise<any>;
67
+ /**
68
+ * Creates a new view and attaches it to a specified target window.
69
+ * @param { CreateViewPayload } payload Creation options for the new view.
70
+ * @param { Identity } identity Identity of the entity that called {@link Platform#createView Platform.createView}.
71
+ * @return { Promise<void> }
72
+ */
73
+ createView(payload: OpenFin.CreateViewPayload, identity: OpenFin.Identity): Promise<OpenFin.View>;
74
+ /** Handles requests to fetch manifests in the current platform.
75
+ * @param { FetchManifestPayload } payload Payload containing the manifestUrl to be fetched.
76
+ * @param { Identity } callerIdentity If {@link Platform#fetchManifest Platform.fetchManifest}
77
+ * was called, the identity of the caller will be here.
78
+ * If `fetchManifest` was called internally, `callerIdentity` will be the provider's identity.
79
+ */
80
+ fetchManifest(payload: OpenFin.FetchManifestPayload, callerIdentity: OpenFin.Identity): Promise<any>;
81
+ /**
82
+ * Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed.
83
+ * @param { ReplaceLayoutPayload } payload Contains the `target` window and an `opts` object with a `layout` property to apply.
84
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#replaceLayout Platform.replaceLayout}.
85
+ * Undefined if `replaceLayout` is called internally (e.g. while applying a snapshot).
86
+ * @return { Promise<void> }
87
+ */
88
+ replaceLayout(payload: OpenFin.ReplaceLayoutPayload, identity?: OpenFin.Identity): Promise<void>;
89
+ replaceView(payload: OpenFin.ReplaceViewPayload, identity?: OpenFin.Identity): Promise<void>;
90
+ launchIntoPlatform(payload: OpenFin.LaunchIntoPlatformPayload): Promise<void>;
91
+ /**
92
+ * Handles requests to set a window's context. `target` may be a window or a view.
93
+ * If it is a window, that window's `customContext` will be updated.
94
+ * If it is a view, the `customContext` of that view's current host window will be updated.
95
+ * @param { SetWindowContextPayload } payload Object containing the requested `context` update,
96
+ * the `target`'s identity, and the target's `entityType`.
97
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#setWindowContext Platform.setWindowContext}.
98
+ * Undefined if `setWindowContext` is called internally (e.g. while applying a snapshot).
99
+ * @return { Promise<any> } The new context.
100
+ */
101
+ setWindowContext(payload: OpenFin.SetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
102
+ /**
103
+ * Handles requests to get a window's context. `target` may be a window or a view.
104
+ * If it is a window, that window's `customContext` will be returned.
105
+ * If it is a view, the `customContext` of that view's current host window will be returned.
106
+ * @param { GetWindowContextPayload } payload Object containing the requested `context` update,
107
+ * the `target`'s identity, and the target's `entityType`.
108
+ * @param { Identity } [identity] Identity of the entity that called {@link Platform#getWindowContext Platform.getWindowContext}.
109
+ * Undefined when `getWindowContext` is called internally
110
+ * (e.g. when getting a window's context for the purpose of raising a "host-context-changed" event on a reparented view).
111
+ * @return { Promise<any> } The new context.
112
+ */
113
+ getWindowContext(payload: OpenFin.GetWindowContextPayload, identity?: OpenFin.Identity): Promise<any>;
114
+ /**
115
+ * Called when a window's `customContext` is updated. Responsible for raising the `host-context-updated` event on that window's child views.
116
+ * @param { WindowOptionsChangedEvent<'window', 'options-changed'> } payload The event payload for the window whose context has changed.
117
+ * The new context will be contained as `payload.diff.customContext.newVal`.
118
+ * @return { Promise<HostContextChangedPayload> } The event that it raised.
119
+ */
120
+ onWindowContextUpdated(payload: WindowOptionsChangedEvent): Promise<OpenFin.HostContextChangedPayload | undefined>;
121
+ /**
122
+ * Closes a Window.
123
+ * By default it will fire any before unload handler set by a View in the Window.
124
+ * This can be disabled by setting skipBeforeUnload in the options object of the payload.
125
+ * This method is called by {@link Platform#closeWindow Platform.closeWindow}.
126
+ * @param {CloseWindowPayload} payload Object that contains the Window Identity and related options.
127
+ * @param {Identity} callerIdentity
128
+ * @returns {Promise<void>}
129
+ */
130
+ closeWindow(payload: OpenFin.CloseWindowPayload, callerIdentity: OpenFin.Identity): Promise<void>;
131
+ /**
132
+ * Gets all the Views attached to a Window that should close along with it. This is meant to be overridable
133
+ * in the case where you want to return other Views that may not be attached to the Window that is closing.
134
+ * @param winId Identity of the Window that is closing
135
+ * @returns { Promise<View> }
136
+ */
137
+ getViewsForWindowClose(windowId: OpenFin.Identity): Promise<OpenFin.View[]>;
138
+ /**
139
+ * It takes in an array of Views and returns an object specifying which of them are trying to prevent an unload and which are not.
140
+ * @param {View[]} views Array of Views
141
+ * @returns { Promise<ViewStatuses> }
142
+ */
143
+ checkViewsForPreventUnload(views: OpenFin.View[]): Promise<OpenFin.ViewStatuses>;
144
+ /**
145
+ * Handle the decision of whether a Window or specific View should close when trying to prevent an unload. This is meant to be overridden.
146
+ * Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
147
+ * Normally you would use this method to show a dialog indicating that there are Views that are trying to prevent an unload.
148
+ * By default it will always return all Views passed into it as meaning to close.
149
+ * @param {ViewsPreventingUnloadPayload} payload
150
+ * @tutorial PlatformProvider.getUserDecisionForBeforeUnload
151
+ * @returns {Promise<BeforeUnloadUserDecision>}
152
+ */
153
+ getUserDecisionForBeforeUnload(payload: OpenFin.ViewsPreventingUnloadPayload): Promise<OpenFin.BeforeUnloadUserDecision>;
154
+ /**
155
+ * Handles the closing of a Window and/or its Views. Called in {@link PlatformProvider#closeWindow PlatformProvider.closeWindow}.
156
+ * The return of {@link PlatformProvider#getUserDecisionForBeforeUnload PlatformProvider.getUserDecisionForBeforeUnload} is passed into this method.
157
+ * @param {Identity} winId Identity of the Window
158
+ * @param {BeforeUnloadUserDecision} userDecision Decision object
159
+ * @returns {Promise<void>}
160
+ */
161
+ handleViewsAndWindowClose(windowId: OpenFin.Identity, userDecision: OpenFin.BeforeUnloadUserDecision): Promise<void>;
162
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,7 @@ import type * as OpenFin from '../../OpenFin';
2
2
  import { Base } from '../base';
3
3
  import { SnapshotSource } from './Instance';
4
4
  /**
5
+ * @REMOVED
5
6
  * @typedef { object } SnapshotProvider
6
7
  * @property {getSnapshot} [getSnapshot]
7
8
  * @property {applySnapshot} [applySnapshot]
@@ -4,6 +4,7 @@ const base_1 = require("../base");
4
4
  const Instance_1 = require("./Instance");
5
5
  const utils_1 = require("./utils");
6
6
  /**
7
+ * @REMOVED
7
8
  * @typedef { object } SnapshotProvider
8
9
  * @property {getSnapshot} [getSnapshot]
9
10
  * @property {applySnapshot} [applySnapshot]
@@ -4,7 +4,6 @@ import Transport from '../../transport/transport';
4
4
  declare type Identity = OpenFin.Identity;
5
5
  declare type ProxyInfo = OpenFin.ProxyInfo;
6
6
  declare type ProxyConfig = OpenFin.ProxyConfig;
7
- declare type SystemEvents = OpenFin.SystemEvents;
8
7
  declare type InstalledApps = OpenFin.InstalledApps;
9
8
  declare type LogInfo = OpenFin.LogInfo;
10
9
  declare type LogLevel = OpenFin.LogLevel;
@@ -21,7 +20,7 @@ declare type PrinterInfo = OpenFin.PrinterInfo;
21
20
  * clearing the cache and exiting the runtime as well as listen to <a href="tutorial-System.EventEmitter.html">system events</a>.
22
21
  * @namespace
23
22
  */
24
- export default class System extends EmitterBase<SystemEvents> {
23
+ export default class System extends EmitterBase<OpenFin.SystemEvent> {
25
24
  constructor(wire: Transport);
26
25
  private sendExternalProcessRequest;
27
26
  /**
@@ -531,19 +531,27 @@ class System extends base_1.EmitterBase {
531
531
  progressListener(p);
532
532
  };
533
533
  const cleanListeners = () => {
534
+ // TODO: fix internal types
535
+ // @ts-expect-error
534
536
  this.removeListener(dlProgressKey, dlProgress);
535
537
  };
536
- const dlError = (r, err) => {
537
- const error = err || r;
538
+ const dlError = (payload) => {
538
539
  cleanListeners();
539
- reject(new transport_errors_1.RuntimeError(error));
540
+ const { reason, err: error } = payload;
541
+ reject(new transport_errors_1.RuntimeError({ reason, error }));
540
542
  };
541
543
  const dlComplete = () => {
542
544
  cleanListeners();
543
545
  resolve();
544
546
  };
547
+ // TODO: fix internal types
548
+ // @ts-expect-error
545
549
  this.on(dlProgressKey, dlProgress);
550
+ // TODO: fix internal types
551
+ // @ts-expect-error
546
552
  this.once(dlErrorKey, dlError);
553
+ // TODO: fix internal types
554
+ // @ts-expect-error
547
555
  this.once(dlCompleteKey, dlComplete);
548
556
  const downloadOptions = Object.assign(appAsset, { downloadId });
549
557
  this.wire.sendAction('download-asset', downloadOptions).catch((err) => {
@@ -578,19 +586,27 @@ class System extends base_1.EmitterBase {
578
586
  progressListener(p);
579
587
  };
580
588
  const cleanListeners = () => {
589
+ // TODO: fix internal types
590
+ // @ts-expect-error
581
591
  this.removeListener(dlProgressKey, dlProgress);
582
592
  };
583
- const dlError = (r, err) => {
584
- const error = err || r;
593
+ const dlError = (payload) => {
585
594
  cleanListeners();
586
- reject(new transport_errors_1.RuntimeError(error));
595
+ const { reason, err: error } = payload;
596
+ reject(new transport_errors_1.RuntimeError({ reason, error }));
587
597
  };
588
598
  const dlComplete = () => {
589
599
  cleanListeners();
590
600
  resolve();
591
601
  };
602
+ // TODO: fix internal types
603
+ // @ts-expect-error
592
604
  this.on(dlProgressKey, dlProgress);
605
+ // TODO: fix internal types
606
+ // @ts-expect-error
593
607
  this.once(dlErrorKey, dlError);
608
+ // TODO: fix internal types
609
+ // @ts-expect-error
594
610
  this.once(dlCompleteKey, dlComplete);
595
611
  const downloadOptions = Object.assign(options, { downloadId });
596
612
  this.wire.sendAction('download-runtime', downloadOptions).catch((err) => {
@@ -2,9 +2,10 @@ import type * as OpenFin from '../../OpenFin';
2
2
  import { WebContents } from '../webcontents/main';
3
3
  import Transport from '../../transport/transport';
4
4
  import { Layout } from '../platform/layout';
5
- declare type ViewEvents = OpenFin.ViewEvents;
5
+ import { ViewEvent } from '../events/view';
6
6
  declare type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
7
7
  /**
8
+ * @PORTED
8
9
  * @typedef {object} View~options
9
10
  * @summary View creation options.
10
11
  * @desc This is the options object required by {@link View.create View.create}.
@@ -170,7 +171,7 @@ declare type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
170
171
  * @alias View
171
172
  * @hideconstructor
172
173
  */
173
- export declare class View extends WebContents<ViewEvents> {
174
+ export declare class View extends WebContents<ViewEvent> {
174
175
  identity: OpenFin.Identity;
175
176
  constructor(wire: Transport, identity: OpenFin.Identity);
176
177
  /**
@@ -453,12 +454,15 @@ export declare class View extends WebContents<ViewEvents> {
453
454
  */
454
455
  triggerBeforeUnload: () => Promise<boolean>;
455
456
  /**
457
+ * **NOTE**: Internal use only.
456
458
  * Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
457
- * @param { string } elementId - id of the HTML element to attach the view to.
459
+ *
460
+ * @param {HTMLElement} element - HTML element to attach the view to.
458
461
  * @return {Function} - Cleanup function that will disconnect the element resize observer.
462
+ * @internal
459
463
  * @experimental
460
464
  * @tutorial View.bindToElement
461
465
  */
462
- bindToElement: (elementId: string) => Promise<() => void>;
466
+ bindToElement: (element: HTMLElement) => Promise<() => void>;
463
467
  }
464
468
  export {};
@@ -8,6 +8,7 @@ const main_1 = require("../webcontents/main");
8
8
  const window_1 = require("../window");
9
9
  const bounds_observer_1 = require("../platform/layout/utils/bounds-observer");
10
10
  /**
11
+ * @PORTED
11
12
  * @typedef {object} View~options
12
13
  * @summary View creation options.
13
14
  * @desc This is the options object required by {@link View.create View.create}.
@@ -457,16 +458,18 @@ class View extends main_1.WebContents {
457
458
  return message.payload.data;
458
459
  };
459
460
  /**
461
+ * **NOTE**: Internal use only.
460
462
  * Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
461
- * @param { string } elementId - id of the HTML element to attach the view to.
463
+ *
464
+ * @param {HTMLElement} element - HTML element to attach the view to.
462
465
  * @return {Function} - Cleanup function that will disconnect the element resize observer.
466
+ * @internal
463
467
  * @experimental
464
468
  * @tutorial View.bindToElement
465
469
  */
466
- this.bindToElement = async (elementId) => {
467
- const element = document.getElementById(elementId);
470
+ this.bindToElement = async (element) => {
468
471
  if (!element) {
469
- throw new Error(`Element matching id: ${elementId} not found.`);
472
+ throw new Error('Element not found.');
470
473
  }
471
474
  const onChange = async (bounds) => this.setBounds(bounds);
472
475
  return (0, bounds_observer_1.observeBounds)(element, onChange);
@@ -1,14 +1,29 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import { EmitterBase } from '../base';
3
3
  import Transport from '../../transport/transport';
4
- import { WebContentsEventMapping } from '../events/webcontents';
5
- declare type ImageFormat = 'bmp' | 'jpg' | 'png';
4
+ import { BaseEvent } from '../events/base';
5
+ /**
6
+ * Configuration for page capture.
7
+ */
6
8
  export interface CapturePageOptions {
9
+ /**
10
+ * The area of the window to be captured.
11
+ */
7
12
  area?: OpenFin.Rectangle;
8
- format?: ImageFormat;
13
+ /**
14
+ * @defaultValue 'png'
15
+ *
16
+ * The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
17
+ */
18
+ format?: 'bmp' | 'jpg' | 'png';
19
+ /**
20
+ * @defaultValue 100
21
+ *
22
+ * Quality of JPEG image. Between 0 - 100.
23
+ */
9
24
  quality?: number;
10
25
  }
11
- export declare class WebContents<T extends WebContentsEventMapping> extends EmitterBase<T> {
26
+ export declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
12
27
  entityType: string;
13
28
  constructor(wire: Transport, identity: OpenFin.Identity, entityType: string);
14
29
  capturePage(options?: CapturePageOptions): Promise<string>;
@@ -35,4 +50,3 @@ export declare class WebContents<T extends WebContentsEventMapping> extends Emit
35
50
  inspectServiceWorker(): Promise<void>;
36
51
  showPopupWindow(options: OpenFin.PopupOptions): Promise<OpenFin.PopupResult>;
37
52
  }
38
- export {};