@openfin/fdc3-api 36.79.15 → 36.79.18

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/README.md CHANGED
@@ -4,6 +4,8 @@ OpenFin FDC3 Client Library.
4
4
 
5
5
  ## How to use
6
6
 
7
+ This package takes a reference to `fin` and uses the interop client found on `fin.me.interop` to instantiate an object matching the fdc3 spec.
8
+
7
9
  ```typescript
8
10
  import { fdc3FromFin } from '@openfin/fdc3-api';
9
11
 
@@ -11,3 +13,13 @@ const fdc3 = await fdc3FromFin(window.fin);
11
13
 
12
14
  window.fdc3 = fdc3;
13
15
  ```
16
+
17
+ To specify a version of fdc3 you may pass the `fdc3Version` option. Supported options are '1.2' and '2.0'. Default is '2.0'.
18
+
19
+ ```typescript
20
+ import { fdc3FromFin } from '@openfin/fdc3-api';
21
+
22
+ const fdc3 = await fdc3FromFin(window.fin, { fdc3Version: '1.2'});
23
+
24
+ window.fdc3 = fdc3;
25
+ ```
@@ -88,12 +88,21 @@ declare type Api = {
88
88
  iframe?: {
89
89
  /**
90
90
  * Inject OpenFin API into cross-origin iframes
91
+ *
92
+ * @defaultValue false
91
93
  */
92
94
  crossOriginInjection?: boolean;
93
95
  /**
94
96
  * Inject OpenFin API into same-origin iframes
97
+ *
98
+ * @defaultValue true
95
99
  */
96
100
  sameOriginInjection?: boolean;
101
+ /**
102
+ * @deprecated Shared names should not be used; support is provided purely for back-compat reasons.
103
+ *
104
+ * When `true`, iframes will have the same name as their parent WebContents.
105
+ */
97
106
  enableDeprecatedSharedName?: boolean;
98
107
  };
99
108
  /**
@@ -1668,9 +1677,9 @@ declare class Base {
1668
1677
  * on the context in which the devtools panel was opened.
1669
1678
  */
1670
1679
  get me(): Identity;
1671
- protected isNodeEnvironment: () => boolean;
1672
- protected isOpenFinEnvironment: () => boolean;
1673
- protected isBrowserEnvironment: () => boolean;
1680
+ /* Excluded from this release type: isNodeEnvironment */
1681
+ /* Excluded from this release type: isOpenFinEnvironment */
1682
+ /* Excluded from this release type: isBrowserEnvironment */
1674
1683
  }
1675
1684
 
1676
1685
  /**
@@ -5202,8 +5211,14 @@ declare interface Environment {
5202
5211
  getRtcPeer(): RTCPeerConnection;
5203
5212
  getWsConstructor(): typeof WebSocket;
5204
5213
  whenReady(): Promise<void>;
5214
+ getInteropInfo(fin: OpenFin.Fin<OpenFin.EntityType>): Promise<InternalInteropBrokerOptions & {
5215
+ fdc3Version?: Fdc3Version;
5216
+ }>;
5217
+ readonly type: EnvironmentType;
5205
5218
  }
5206
5219
 
5220
+ declare type EnvironmentType = 'node' | 'openfin' | 'other';
5221
+
5207
5222
  declare type ErrorMiddleware = OpenFin.ErrorMiddleware;
5208
5223
 
5209
5224
  declare type ErrorMiddleware_2 = (topic: string, error: Error, id: ProviderIdentity_7 | ClientIdentity) => unknown;
@@ -5607,7 +5622,9 @@ declare namespace FDC3 {
5607
5622
  }
5608
5623
  }
5609
5624
 
5610
- export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, version?: Fdc3Version): Promise<Fdc3Module | Fdc3Module2>;
5625
+ export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, { fdc3Version }?: {
5626
+ fdc3Version?: Fdc3Version;
5627
+ }): Promise<Fdc3Module | Fdc3Module2>;
5611
5628
 
5612
5629
  /**
5613
5630
  * @version 1.2
@@ -7320,6 +7337,15 @@ declare class InterApplicationBus extends Base {
7320
7337
 
7321
7338
  declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
7322
7339
 
7340
+ declare type InternalFDC3Info = {
7341
+ providerVersion: string;
7342
+ provider: string;
7343
+ };
7344
+
7345
+ declare type InternalInteropBrokerOptions = OpenFin.InteropBrokerOptions & {
7346
+ fdc3Info: InternalFDC3Info;
7347
+ };
7348
+
7323
7349
  /**
7324
7350
  * Define whether to enable interop action logging.
7325
7351
  *
@@ -7448,6 +7474,7 @@ declare type InteropActionLoggingOption = {
7448
7474
  *
7449
7475
  */
7450
7476
  declare class InteropBroker extends Base {
7477
+ #private;
7451
7478
  private getProvider;
7452
7479
  private interopClients;
7453
7480
  private contextGroupsById;
@@ -88,12 +88,21 @@ declare type Api = {
88
88
  iframe?: {
89
89
  /**
90
90
  * Inject OpenFin API into cross-origin iframes
91
+ *
92
+ * @defaultValue false
91
93
  */
92
94
  crossOriginInjection?: boolean;
93
95
  /**
94
96
  * Inject OpenFin API into same-origin iframes
97
+ *
98
+ * @defaultValue true
95
99
  */
96
100
  sameOriginInjection?: boolean;
101
+ /**
102
+ * @deprecated Shared names should not be used; support is provided purely for back-compat reasons.
103
+ *
104
+ * When `true`, iframes will have the same name as their parent WebContents.
105
+ */
97
106
  enableDeprecatedSharedName?: boolean;
98
107
  };
99
108
  /**
@@ -1668,9 +1677,9 @@ declare class Base {
1668
1677
  * on the context in which the devtools panel was opened.
1669
1678
  */
1670
1679
  get me(): Identity;
1671
- protected isNodeEnvironment: () => boolean;
1672
- protected isOpenFinEnvironment: () => boolean;
1673
- protected isBrowserEnvironment: () => boolean;
1680
+ /* Excluded from this release type: isNodeEnvironment */
1681
+ /* Excluded from this release type: isOpenFinEnvironment */
1682
+ /* Excluded from this release type: isBrowserEnvironment */
1674
1683
  }
1675
1684
 
1676
1685
  /**
@@ -5202,8 +5211,14 @@ declare interface Environment {
5202
5211
  getRtcPeer(): RTCPeerConnection;
5203
5212
  getWsConstructor(): typeof WebSocket;
5204
5213
  whenReady(): Promise<void>;
5214
+ getInteropInfo(fin: OpenFin.Fin<OpenFin.EntityType>): Promise<InternalInteropBrokerOptions & {
5215
+ fdc3Version?: Fdc3Version;
5216
+ }>;
5217
+ readonly type: EnvironmentType;
5205
5218
  }
5206
5219
 
5220
+ declare type EnvironmentType = 'node' | 'openfin' | 'other';
5221
+
5207
5222
  declare type ErrorMiddleware = OpenFin.ErrorMiddleware;
5208
5223
 
5209
5224
  declare type ErrorMiddleware_2 = (topic: string, error: Error, id: ProviderIdentity_7 | ClientIdentity) => unknown;
@@ -5607,7 +5622,9 @@ declare namespace FDC3 {
5607
5622
  }
5608
5623
  }
5609
5624
 
5610
- export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, version?: Fdc3Version): Promise<Fdc3Module | Fdc3Module2>;
5625
+ export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, { fdc3Version }?: {
5626
+ fdc3Version?: Fdc3Version;
5627
+ }): Promise<Fdc3Module | Fdc3Module2>;
5611
5628
 
5612
5629
  /**
5613
5630
  * @version 1.2
@@ -7320,6 +7337,15 @@ declare class InterApplicationBus extends Base {
7320
7337
 
7321
7338
  declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
7322
7339
 
7340
+ declare type InternalFDC3Info = {
7341
+ providerVersion: string;
7342
+ provider: string;
7343
+ };
7344
+
7345
+ declare type InternalInteropBrokerOptions = OpenFin.InteropBrokerOptions & {
7346
+ fdc3Info: InternalFDC3Info;
7347
+ };
7348
+
7323
7349
  /**
7324
7350
  * Define whether to enable interop action logging.
7325
7351
  *
@@ -7448,6 +7474,7 @@ declare type InteropActionLoggingOption = {
7448
7474
  *
7449
7475
  */
7450
7476
  declare class InteropBroker extends Base {
7477
+ #private;
7451
7478
  private getProvider;
7452
7479
  private interopClients;
7453
7480
  private contextGroupsById;
@@ -88,12 +88,21 @@ declare type Api = {
88
88
  iframe?: {
89
89
  /**
90
90
  * Inject OpenFin API into cross-origin iframes
91
+ *
92
+ * @defaultValue false
91
93
  */
92
94
  crossOriginInjection?: boolean;
93
95
  /**
94
96
  * Inject OpenFin API into same-origin iframes
97
+ *
98
+ * @defaultValue true
95
99
  */
96
100
  sameOriginInjection?: boolean;
101
+ /**
102
+ * @deprecated Shared names should not be used; support is provided purely for back-compat reasons.
103
+ *
104
+ * When `true`, iframes will have the same name as their parent WebContents.
105
+ */
97
106
  enableDeprecatedSharedName?: boolean;
98
107
  };
99
108
  /**
@@ -1668,9 +1677,9 @@ declare class Base {
1668
1677
  * on the context in which the devtools panel was opened.
1669
1678
  */
1670
1679
  get me(): Identity;
1671
- protected isNodeEnvironment: () => boolean;
1672
- protected isOpenFinEnvironment: () => boolean;
1673
- protected isBrowserEnvironment: () => boolean;
1680
+ /* Excluded from this release type: isNodeEnvironment */
1681
+ /* Excluded from this release type: isOpenFinEnvironment */
1682
+ /* Excluded from this release type: isBrowserEnvironment */
1674
1683
  }
1675
1684
 
1676
1685
  /**
@@ -5202,8 +5211,14 @@ declare interface Environment {
5202
5211
  getRtcPeer(): RTCPeerConnection;
5203
5212
  getWsConstructor(): typeof WebSocket;
5204
5213
  whenReady(): Promise<void>;
5214
+ getInteropInfo(fin: OpenFin.Fin<OpenFin.EntityType>): Promise<InternalInteropBrokerOptions & {
5215
+ fdc3Version?: Fdc3Version;
5216
+ }>;
5217
+ readonly type: EnvironmentType;
5205
5218
  }
5206
5219
 
5220
+ declare type EnvironmentType = 'node' | 'openfin' | 'other';
5221
+
5207
5222
  declare type ErrorMiddleware = OpenFin.ErrorMiddleware;
5208
5223
 
5209
5224
  declare type ErrorMiddleware_2 = (topic: string, error: Error, id: ProviderIdentity_7 | ClientIdentity) => unknown;
@@ -5607,7 +5622,9 @@ declare namespace FDC3 {
5607
5622
  }
5608
5623
  }
5609
5624
 
5610
- export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, version?: Fdc3Version): Promise<Fdc3Module | Fdc3Module2>;
5625
+ export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, { fdc3Version }?: {
5626
+ fdc3Version?: Fdc3Version;
5627
+ }): Promise<Fdc3Module | Fdc3Module2>;
5611
5628
 
5612
5629
  /**
5613
5630
  * @version 1.2
@@ -7320,6 +7337,15 @@ declare class InterApplicationBus extends Base {
7320
7337
 
7321
7338
  declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
7322
7339
 
7340
+ declare type InternalFDC3Info = {
7341
+ providerVersion: string;
7342
+ provider: string;
7343
+ };
7344
+
7345
+ declare type InternalInteropBrokerOptions = OpenFin.InteropBrokerOptions & {
7346
+ fdc3Info: InternalFDC3Info;
7347
+ };
7348
+
7323
7349
  /**
7324
7350
  * Define whether to enable interop action logging.
7325
7351
  *
@@ -7448,6 +7474,7 @@ declare type InteropActionLoggingOption = {
7448
7474
  *
7449
7475
  */
7450
7476
  declare class InteropBroker extends Base {
7477
+ #private;
7451
7478
  private getProvider;
7452
7479
  private interopClients;
7453
7480
  private contextGroupsById;
package/out/fdc3-api.d.ts CHANGED
@@ -88,12 +88,21 @@ declare type Api = {
88
88
  iframe?: {
89
89
  /**
90
90
  * Inject OpenFin API into cross-origin iframes
91
+ *
92
+ * @defaultValue false
91
93
  */
92
94
  crossOriginInjection?: boolean;
93
95
  /**
94
96
  * Inject OpenFin API into same-origin iframes
97
+ *
98
+ * @defaultValue true
95
99
  */
96
100
  sameOriginInjection?: boolean;
101
+ /**
102
+ * @deprecated Shared names should not be used; support is provided purely for back-compat reasons.
103
+ *
104
+ * When `true`, iframes will have the same name as their parent WebContents.
105
+ */
97
106
  enableDeprecatedSharedName?: boolean;
98
107
  };
99
108
  /**
@@ -1688,8 +1697,20 @@ declare class Base {
1688
1697
  * on the context in which the devtools panel was opened.
1689
1698
  */
1690
1699
  get me(): Identity;
1700
+ /**
1701
+ * @internal
1702
+ * @deprecated
1703
+ */
1691
1704
  protected isNodeEnvironment: () => boolean;
1705
+ /**
1706
+ * @internal
1707
+ * @deprecated
1708
+ */
1692
1709
  protected isOpenFinEnvironment: () => boolean;
1710
+ /**
1711
+ * @internal
1712
+ * @deprecated
1713
+ */
1693
1714
  protected isBrowserEnvironment: () => boolean;
1694
1715
  }
1695
1716
 
@@ -5250,8 +5271,14 @@ declare interface Environment {
5250
5271
  getRtcPeer(): RTCPeerConnection;
5251
5272
  getWsConstructor(): typeof WebSocket;
5252
5273
  whenReady(): Promise<void>;
5274
+ getInteropInfo(fin: OpenFin.Fin<OpenFin.EntityType>): Promise<InternalInteropBrokerOptions & {
5275
+ fdc3Version?: Fdc3Version;
5276
+ }>;
5277
+ readonly type: EnvironmentType;
5253
5278
  }
5254
5279
 
5280
+ declare type EnvironmentType = 'node' | 'openfin' | 'other';
5281
+
5255
5282
  declare type ErrorMiddleware = OpenFin.ErrorMiddleware;
5256
5283
 
5257
5284
  declare type ErrorMiddleware_2 = (topic: string, error: Error, id: ProviderIdentity_7 | ClientIdentity) => unknown;
@@ -5676,7 +5703,9 @@ declare namespace FDC3 {
5676
5703
  }
5677
5704
  }
5678
5705
 
5679
- export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, version?: Fdc3Version): Promise<Fdc3Module | Fdc3Module2>;
5706
+ export declare function fdc3FromFin(fin: OpenFin.Fin<OpenFin.EntityType>, { fdc3Version }?: {
5707
+ fdc3Version?: Fdc3Version;
5708
+ }): Promise<Fdc3Module | Fdc3Module2>;
5680
5709
 
5681
5710
  /**
5682
5711
  * @version 1.2
@@ -7410,6 +7439,15 @@ declare class InterAppPayload {
7410
7439
 
7411
7440
  declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
7412
7441
 
7442
+ declare type InternalFDC3Info = {
7443
+ providerVersion: string;
7444
+ provider: string;
7445
+ };
7446
+
7447
+ declare type InternalInteropBrokerOptions = OpenFin.InteropBrokerOptions & {
7448
+ fdc3Info: InternalFDC3Info;
7449
+ };
7450
+
7413
7451
  /**
7414
7452
  * Define whether to enable interop action logging.
7415
7453
  *
@@ -7538,6 +7576,7 @@ declare type InteropActionLoggingOption = {
7538
7576
  *
7539
7577
  */
7540
7578
  declare class InteropBroker extends Base {
7579
+ #private;
7541
7580
  private getProvider;
7542
7581
  private interopClients;
7543
7582
  private contextGroupsById;
@@ -7549,7 +7588,7 @@ declare class InteropBroker extends Base {
7549
7588
  /**
7550
7589
  * @internal
7551
7590
  */
7552
- constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
7591
+ constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options: InternalInteropBrokerOptions);
7553
7592
  static createClosedConstructor(...args: ConstructorParameters<typeof InteropBroker>): {
7554
7593
  new (): InteropBroker;
7555
7594
  };
package/out/fdc3-api.js CHANGED
@@ -57,14 +57,26 @@ class Base {
57
57
  * @internal
58
58
  */
59
59
  constructor(wire) {
60
+ /**
61
+ * @internal
62
+ * @deprecated
63
+ */
60
64
  this.isNodeEnvironment = () => {
61
- return this.wire.environment.constructor.name === 'NodeEnvironment';
65
+ return this.wire.environment.type === 'node';
62
66
  };
67
+ /**
68
+ * @internal
69
+ * @deprecated
70
+ */
63
71
  this.isOpenFinEnvironment = () => {
64
- return this.wire.environment.constructor.name === 'OpenFinEnvironment';
72
+ return this.wire.environment.type === 'openfin';
65
73
  };
74
+ /**
75
+ * @internal
76
+ * @deprecated
77
+ */
66
78
  this.isBrowserEnvironment = () => {
67
- return this.wire.environment.constructor.name === 'BrowserEnvironment';
79
+ return this.wire.environment.type === 'other';
68
80
  };
69
81
  this.wire = wire;
70
82
  }
@@ -622,12 +634,12 @@ PrivateChannelClient$1.PrivateChannelClient = PrivateChannelClient;
622
634
  const getIntentResolution = async (interopModule, context, app, intent) => {
623
635
  // Generate an ID to make a session context group with. We will pass that ID to the Broker.
624
636
  // The broker will then setContext on that session context group later with our Intent Result,
625
- const guid = (0, utils_1.generateId)();
637
+ const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
626
638
  // Promise we'll use in getResult
627
- const getResultPromise = new Promise((resolve) => {
639
+ const getResultPromise = new Promise((resolve, reject) => {
628
640
  fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
629
641
  resolve(intentResult);
630
- });
642
+ }).catch(() => reject(new Error('getResult is not supported in this environment')));
631
643
  });
632
644
  // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
633
645
  const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
@@ -1526,7 +1538,7 @@ class Fdc3Module extends base_1$1.Base {
1526
1538
  const { metadata } = context;
1527
1539
  const intentResolutionResultId = intentMetadata?.intentResolutionResultId || metadata?.intentResolutionResultId;
1528
1540
  if (intentResolutionResultId) {
1529
- this.fin.InterApplicationBus.publish(intentResolutionResultId, null);
1541
+ this.fin.InterApplicationBus.publish(intentResolutionResultId, null).catch(() => null);
1530
1542
  }
1531
1543
  handler(raisedIntent.context);
1532
1544
  };
@@ -2017,7 +2029,7 @@ class Fdc3Module2 extends base_1.Base {
2017
2029
  intentResultToSend = { error: true };
2018
2030
  }
2019
2031
  if (intentResolutionResultId) {
2020
- this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResultToSend);
2032
+ this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResultToSend).catch(() => null);
2021
2033
  }
2022
2034
  if (intentResult instanceof Error) {
2023
2035
  throw new Error(intentResult.message);
@@ -2152,9 +2164,9 @@ exports.Fdc3Module2 = fdc32_0.Fdc3Module2 = Fdc3Module2;
2152
2164
  exports.getFdc3 = getFdc3;
2153
2165
  } (fdc3));
2154
2166
 
2155
- async function fdc3FromFin(fin, version) {
2167
+ async function fdc3FromFin(fin, { fdc3Version } = { fdc3Version: '2.0' }) {
2156
2168
  // @ts-expect-error
2157
- return fdc3.getFdc3(fin.wire, version);
2169
+ return fdc3.getFdc3(fin.wire, fdc3Version);
2158
2170
  }
2159
2171
 
2160
2172
  exports.fdc3FromFin = fdc3FromFin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/fdc3-api",
3
- "version": "36.79.15",
3
+ "version": "36.79.18",
4
4
  "description": "OpenFin fdc3 module utilities and types.",
5
5
  "license": "SEE LICENSE IN LICENSE.MD",
6
6
  "private": false,