@openfin/core 29.73.5 → 29.73.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "29.73.5",
3
+ "version": "29.73.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
package/src/OpenFin.d.ts CHANGED
@@ -680,9 +680,12 @@ export declare type PlatformProvider = {
680
680
  */
681
681
  getSnapshot(payload: undefined, identity: Identity): Promise<Snapshot>;
682
682
  /**
683
+ * **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
683
684
  * 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.
684
685
  * @param { Identity } payload Identity of the view.
685
686
  * @return { Promise<ViewState> }
687
+ * @internal
688
+ * @experimental
686
689
  */
687
690
  getViewSnapshot(payload: {
688
691
  viewIdentity: Identity;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const base_1 = require("../base");
4
4
  const InteropBroker_1 = require("./InteropBroker");
5
5
  const InteropClient_1 = require("./InteropClient");
6
+ const overrideCheck_1 = require("./fdc3/overrideCheck");
6
7
  const defaultOverride = (Class, ...args) => new Class(...args);
7
8
  /**
8
9
  * @typedef { object } InteropConfig
@@ -38,7 +39,9 @@ class InteropModule extends base_1.Base {
38
39
  }
39
40
  return provider;
40
41
  };
41
- return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration);
42
+ const broker = await override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration);
43
+ (0, overrideCheck_1.overrideCheck)(broker, (0, overrideCheck_1.getDefaultViewFdc3VersionFromAppInfo)(options));
44
+ return broker;
42
45
  }
43
46
  /**
44
47
  * Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
@@ -415,7 +415,7 @@ export declare class InteropBroker extends Base {
415
415
  * FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
416
416
  * an AppIdentifier.
417
417
  * @return { Promise<Array<ClientInfo>> }
418
- * @tutorial interop.getAllClientInfo()
418
+ * @tutorial interop.getAllClientInfo
419
419
  */
420
420
  getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
421
421
  decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
@@ -198,6 +198,7 @@ let contextGroups = [
198
198
  */
199
199
  class InteropBroker extends base_1.Base {
200
200
  constructor(wire, getProvider, options) {
201
+ // Tip from Pierre and Michael from the overrideCheck work: Don't use bound methods for overrideable InteropBroker functions.
201
202
  super(wire);
202
203
  this.getProvider = getProvider;
203
204
  this.interopClients = new Map();
@@ -746,7 +747,7 @@ class InteropBroker extends base_1.Base {
746
747
  * FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
747
748
  * an AppIdentifier.
748
749
  * @return { Promise<Array<ClientInfo>> }
749
- * @tutorial interop.getAllClientInfo()
750
+ * @tutorial interop.getAllClientInfo
750
751
  */
751
752
  async getAllClientInfo() {
752
753
  const provider = await this.getProvider();
@@ -1,13 +1,12 @@
1
1
  import Fdc3Module from './fdc3-1.2';
2
2
  import Fdc3Module2 from './fdc3-2.0';
3
3
  import type Transport from '../../../transport/transport';
4
+ import { Fdc3Version } from './versions';
4
5
  declare global {
5
6
  interface Window {
6
7
  fdc3: Fdc3Module | Fdc3Module2;
7
8
  }
8
9
  }
9
- declare type Fdc3Versions = '1.2' | '2.0';
10
- export declare const versionMap: Record<Fdc3Versions, typeof Fdc3Module | typeof Fdc3Module2>;
10
+ export declare const versionMap: Record<Fdc3Version, typeof Fdc3Module | typeof Fdc3Module2>;
11
11
  export declare function registerFdc3Shim(version: string, transport: Transport): void;
12
- export declare function getFdc3(transport: Transport, version?: Fdc3Versions): Fdc3Module | Fdc3Module2;
13
- export {};
12
+ export declare function getFdc3(transport: Transport, version?: Fdc3Version): Fdc3Module | Fdc3Module2;
@@ -0,0 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
2
+ import { Fdc3Version } from './versions';
3
+ export declare function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }: Awaited<ReturnType<OpenFin.Application['getInfo']>>): Fdc3Version | undefined;
4
+ export declare function overrideCheck(overriddenBroker: OpenFin.InteropBroker, fdc3InteropApi?: Fdc3Version): void;
@@ -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 });
@@ -65,14 +65,16 @@ export declare class Platform extends EmitterBase<PlatformEvents> {
65
65
  */
66
66
  getSnapshot(): Promise<OpenFin.Snapshot>;
67
67
  /**
68
+ * **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
69
+ *
68
70
  * Returns a snapshot of a single view's options in its current state.
69
71
  *
70
72
  * Can be used to restore a view to a previous state.
71
73
  *
72
- * NOTE: this method is meant for advanced usage only, it is not recommended to manage the state of individual views.
73
- *
74
74
  * @param { Identity } viewIdentity View identity
75
75
  * @returns { Promise<ViewState> }
76
+ * @internal
77
+ * @experimental
76
78
  * @tutorial Platform.getViewSnapshot
77
79
  */
78
80
  getViewSnapshot(viewIdentity: OpenFin.Identity): Promise<OpenFin.ViewState>;
@@ -174,14 +174,16 @@ class Platform extends base_1.EmitterBase {
174
174
  return client.dispatch('get-snapshot');
175
175
  }
176
176
  /**
177
+ * **NOTE**: Internal use only. It is not recommended to manage the state of individual views.
178
+ *
177
179
  * Returns a snapshot of a single view's options in its current state.
178
180
  *
179
181
  * Can be used to restore a view to a previous state.
180
182
  *
181
- * NOTE: this method is meant for advanced usage only, it is not recommended to manage the state of individual views.
182
- *
183
183
  * @param { Identity } viewIdentity View identity
184
184
  * @returns { Promise<ViewState> }
185
+ * @internal
186
+ * @experimental
185
187
  * @tutorial Platform.getViewSnapshot
186
188
  */
187
189
  async getViewSnapshot(viewIdentity) {
@@ -452,9 +452,12 @@ export declare class View extends WebContents<ViewEvents> {
452
452
  */
453
453
  triggerBeforeUnload: () => Promise<boolean>;
454
454
  /**
455
+ * **NOTE**: Internal use only.
455
456
  * Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
457
+ *
456
458
  * @param { string } elementId - id of the HTML element to attach the view to.
457
459
  * @return {Function} - Cleanup function that will disconnect the element resize observer.
460
+ * @internal
458
461
  * @experimental
459
462
  * @tutorial View.bindToElement
460
463
  */
@@ -457,9 +457,12 @@ class View extends main_1.WebContents {
457
457
  return message.payload.data;
458
458
  };
459
459
  /**
460
+ * **NOTE**: Internal use only.
460
461
  * Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
462
+ *
461
463
  * @param { string } elementId - id of the HTML element to attach the view to.
462
464
  * @return {Function} - Cleanup function that will disconnect the element resize observer.
465
+ * @internal
463
466
  * @experimental
464
467
  * @tutorial View.bindToElement
465
468
  */