@openfin/core 30.73.22 → 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 (115) 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 +2 -1
  5. package/src/api/application/Factory.js +1 -0
  6. package/src/api/application/Instance.d.ts +3 -2
  7. package/src/api/application/Instance.js +1 -0
  8. package/src/api/base.d.ts +19 -16
  9. package/src/api/base.js +2 -2
  10. package/src/api/clipboard/index.d.ts +2 -1
  11. package/src/api/clipboard/index.js +1 -0
  12. package/src/api/events/application.d.ts +66 -57
  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 -11
  19. package/src/api/events/platform.d.ts +10 -16
  20. package/src/api/events/system.d.ts +42 -30
  21. package/src/api/events/typedEventEmitter.d.ts +15 -8
  22. package/src/api/events/view.d.ts +38 -55
  23. package/src/api/events/webcontents.d.ts +75 -29
  24. package/src/api/events/window.d.ts +148 -135
  25. package/src/api/external-application/Factory.d.ts +1 -1
  26. package/src/api/external-application/Instance.d.ts +2 -2
  27. package/src/api/fin.d.ts +3 -2
  28. package/src/api/frame/Factory.d.ts +1 -1
  29. package/src/api/frame/Instance.d.ts +2 -2
  30. package/src/api/global-hotkey/index.d.ts +2 -4
  31. package/src/api/global-hotkey/index.js +6 -0
  32. package/src/api/interappbus/channel/channel.d.ts +6 -5
  33. package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
  34. package/src/api/interappbus/channel/channels-docs.js +7 -0
  35. package/src/api/interappbus/channel/client.d.ts +4 -3
  36. package/src/api/interappbus/channel/client.js +12 -5
  37. package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
  38. package/src/api/interappbus/channel/index.d.ts +6 -5
  39. package/src/api/interappbus/channel/index.js +7 -7
  40. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -2
  41. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  42. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -2
  43. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
  44. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -2
  45. package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
  46. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -2
  47. package/src/api/interappbus/channel/provider.d.ts +3 -3
  48. package/src/api/interop/Factory.d.ts +2 -3
  49. package/src/api/interop/Factory.js +20 -4
  50. package/src/api/interop/InteropBroker.d.ts +18 -49
  51. package/src/api/interop/InteropBroker.js +33 -47
  52. package/src/api/interop/InteropClient.d.ts +10 -9
  53. package/src/api/interop/InteropClient.js +9 -8
  54. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  55. package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
  56. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -1
  57. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  58. package/src/api/interop/fdc3/fdc3-1.2.d.ts +1 -1
  59. package/src/api/interop/fdc3/fdc3-1.2.js +8 -8
  60. package/src/api/interop/fdc3/fdc3-2.0.d.ts +3 -3
  61. package/src/api/interop/fdc3/fdc3-2.0.js +15 -7
  62. package/src/api/interop/fdc3/fdc3.d.ts +3 -4
  63. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  64. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  65. package/src/api/interop/fdc3/utils.d.ts +3 -3
  66. package/src/api/interop/fdc3/versions.d.ts +1 -0
  67. package/src/api/interop/fdc3/versions.js +2 -0
  68. package/src/api/interop/utils.d.ts +1 -1
  69. package/src/api/me.d.ts +3 -2
  70. package/src/api/platform/Factory.d.ts +6 -1
  71. package/src/api/platform/Factory.js +9 -0
  72. package/src/api/platform/Instance.d.ts +8 -7
  73. package/src/api/platform/Instance.js +6 -3
  74. package/src/api/platform/common-utils.d.ts +2 -2
  75. package/src/api/platform/layout/Factory.d.ts +7 -2
  76. package/src/api/platform/layout/Factory.js +4 -0
  77. package/src/api/platform/layout/Instance.d.ts +5 -4
  78. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -1
  79. package/src/api/platform/layout/shapes.d.ts +3 -2
  80. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
  81. package/src/api/platform/provider.d.ts +162 -0
  82. package/src/api/platform/provider.js +2 -0
  83. package/src/api/snapshot-source/Factory.d.ts +2 -1
  84. package/src/api/snapshot-source/Factory.js +1 -0
  85. package/src/api/snapshot-source/Instance.d.ts +1 -1
  86. package/src/api/snapshot-source/utils.d.ts +1 -1
  87. package/src/api/system/index.d.ts +2 -3
  88. package/src/api/system/index.js +22 -6
  89. package/src/api/view/Factory.d.ts +1 -1
  90. package/src/api/view/Instance.d.ts +9 -5
  91. package/src/api/view/Instance.js +7 -4
  92. package/src/api/webcontents/main.d.ts +20 -6
  93. package/src/api/webcontents/main.js +10 -0
  94. package/src/api/window/Factory.d.ts +1 -1
  95. package/src/api/window/Instance.d.ts +22 -4
  96. package/src/api/window/Instance.js +22 -0
  97. package/src/browser.d.ts +1 -1
  98. package/src/environment/browser.d.ts +3 -2
  99. package/src/environment/environment.d.ts +3 -2
  100. package/src/environment/node-env.d.ts +3 -2
  101. package/src/environment/openfin-env.d.ts +3 -2
  102. package/src/fdc3.d.ts +1 -1
  103. package/src/mock.d.ts +1 -1
  104. package/src/mock.js +0 -1
  105. package/src/namespaces.d.ts +21 -0
  106. package/src/namespaces.js +24 -0
  107. package/src/shapes/WebOptions.d.ts +1 -1
  108. package/src/shapes/WindowOptions.d.ts +1 -1
  109. package/src/shapes/protocol.d.ts +1 -1
  110. package/src/transport/transport-errors.d.ts +6 -1
  111. package/src/transport/transport-errors.js +1 -2
  112. package/src/transport/transport.d.ts +12 -9
  113. package/src/transport/transport.js +9 -1
  114. package/src/util/inaccessibleObject.d.ts +2 -0
  115. package/src/util/inaccessibleObject.js +49 -0
@@ -17,12 +17,14 @@ const base_1 = require("../base");
17
17
  const SessionContextGroupClient_1 = require("./SessionContextGroupClient");
18
18
  const utils_1 = require("./utils");
19
19
  /**
20
+ * @PORTED
20
21
  * @typedef { object } Intent
21
22
  * @summary The combination of an action and a context that is passed to an application for resolution.
22
23
  * @property { string } name Name of the intent.
23
24
  * @property { Context } context Data associated with the intent
24
25
  */
25
26
  /**
27
+ * @REMOVED
26
28
  * @typedef { object } Subscription
27
29
  * @summary Object returned when subscribing a handler.
28
30
  * @property { function } unsubscribe Function to unsubscribe the handler.
@@ -36,6 +38,7 @@ const utils_1 = require("./utils");
36
38
  * @summary Subscription function for registerIntentHandler
37
39
  */
38
40
  /**
41
+ * @PORTED
39
42
  * @typedef { object } ClientIdentity
40
43
  * @summary The Identity for a Channel Client. Includes endpointId to differentiate between different connections for an entity.
41
44
  * @property {string} uuid GUID of an application.
@@ -43,12 +46,14 @@ const utils_1 = require("./utils");
43
46
  * @property {string} endpointId Unique differentiator for different Channel connections for an entity.
44
47
  */
45
48
  /**
49
+ * @PORTED
46
50
  * @typedef { object } ContextGroupInfo
47
51
  * @summary Information for a Context Group. Contains metadata for displaying the group properly.
48
52
  * @property {string} id Name of the context group
49
53
  * @property {DisplayMetadata} displayMetadata Metadata for the Context Group. Contains the group's human-readable name, color, and an image, as defined by the Interop Broker.
50
54
  */
51
55
  /**
56
+ * @PORTED
52
57
  * @typedef { object } DisplayMetadata
53
58
  * @summary The display data for a Context Group.
54
59
  * @property {string} name A user-readable name for this context group, e.g: `"Red"`
@@ -56,6 +61,7 @@ const utils_1 = require("./utils");
56
61
  * @property {string} [glyph] A URL of an image that can be used to display this context group
57
62
  */
58
63
  /**
64
+ * @PORTED
59
65
  * @typedef { object } Context
60
66
  * @summary Data passed between entities and applications.
61
67
  * @property {object} [id] An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
@@ -63,6 +69,7 @@ const utils_1 = require("./utils");
63
69
  * @property {string} type Conserved type for the context (e.g. `instrument` or `country`)
64
70
  */
65
71
  /**
72
+ * @REMOVED
66
73
  * @typedef { object } ContextForIntent
67
74
  * @summary Data passed between entities and applications, including an optional metadata.
68
75
  * @property {object} [id] An object containing string key-value pairs for the bulk of the data for the context. Differs between context types.
@@ -71,6 +78,7 @@ const utils_1 = require("./utils");
71
78
  * @property {any} [metadata]
72
79
  */
73
80
  /**
81
+ * @REMOVED
74
82
  * @typedef { object } SessionContextGroup
75
83
  * @summary An instance of a SessionContextGroup
76
84
  * @property {string} id The SessionContextGroup's id.
@@ -98,7 +106,7 @@ const utils_1 = require("./utils");
98
106
  * @return {Promise<void>}
99
107
  */
100
108
  /**
101
- * {@link https://developers.openfin.co/of-docs/docs/enable-color-linking **THE INTEROP API IS EXPERIMENTAL. IF YOU WOULD LIKE TO USE IT, PLEASE USE OUR DEFAULT IMPLEMENTATION IN BROWSER**}
109
+ * {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
102
110
  *
103
111
  * The Interop Client API is broken up into two groups:
104
112
  *
@@ -305,7 +313,6 @@ class InteropClient extends base_1.Base {
305
313
  * @param { Intent } intent - The combination of an action and a context that is passed to an application for resolution.
306
314
  * @return { Promise<unknown>}
307
315
  * @tutorial interop.fireIntent
308
- * @experimental
309
316
  */
310
317
  async fireIntent(intent) {
311
318
  this.wire.sendAction('interop-client-fire-intent').catch((e) => {
@@ -320,7 +327,6 @@ class InteropClient extends base_1.Base {
320
327
  * @param { string } intentName - The name of an intent.
321
328
  * @return { Promise<Subscription> }
322
329
  * @tutorial interop.registerIntentHandler
323
- * @experimental
324
330
  */
325
331
  async registerIntentHandler(handler, intentName, options) {
326
332
  this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
@@ -348,7 +354,6 @@ class InteropClient extends base_1.Base {
348
354
  * @param { string } [contextType]
349
355
  * @return { Promise<Context> }
350
356
  * @tutorial interop.getCurrentContext
351
- * @experimental
352
357
  */
353
358
  async getCurrentContext(contextType) {
354
359
  this.wire.sendAction('interop-client-get-current-context').catch((e) => {
@@ -362,7 +367,6 @@ class InteropClient extends base_1.Base {
362
367
  * @param { InfoForIntentOptions } options
363
368
  * @return { Promise<unknown> }
364
369
  * @tutorial interop.getInfoForIntent
365
- * @experimental
366
370
  */
367
371
  async getInfoForIntent(options) {
368
372
  this.wire.sendAction('interop-client-get-info-for-intent').catch((e) => {
@@ -376,7 +380,6 @@ class InteropClient extends base_1.Base {
376
380
  * @param { Context } context
377
381
  * @return { Promise<unknown> }
378
382
  * @tutorial interop.getInfoForIntentsByContext
379
- * @experimental
380
383
  */
381
384
  async getInfoForIntentsByContext(context) {
382
385
  this.wire.sendAction('interop-client-get-info-for-intents-by-context').catch((e) => {
@@ -391,7 +394,6 @@ class InteropClient extends base_1.Base {
391
394
  * @param { ContextForIntent } context
392
395
  * @return { Promise<unknown> }
393
396
  * @tutorial interop.fireIntentForContext
394
- * @experimental
395
397
  */
396
398
  async fireIntentForContext(context) {
397
399
  this.wire.sendAction('interop-client-fire-intent-for-context').catch((e) => {
@@ -407,7 +409,6 @@ class InteropClient extends base_1.Base {
407
409
  * @param { string } sessionContextGroupId - Id of the context group.
408
410
  * @return { Promise<SessionContextGroup>}
409
411
  * @tutorial interop.joinSessionContextGroup
410
- * @experimental
411
412
  */
412
413
  async joinSessionContextGroup(sessionContextGroupId) {
413
414
  try {
@@ -1,4 +1,4 @@
1
- import * as OpenFin from '../../OpenFin';
1
+ import type * as OpenFin from '../../OpenFin';
2
2
  import type { ChannelProvider } from '../interappbus/channel/provider';
3
3
  export default class SessionContextGroupBroker {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import * as OpenFin from '../../OpenFin';
1
+ import type * as OpenFin from '../../OpenFin';
2
2
  import Transport from '../../transport/transport';
3
3
  import { Base } from '../base';
4
4
  export default class SessionContextGroupClient extends Base {
@@ -1,4 +1,4 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import type { Listener, Context, ContextHandler } from './shapes/fdc3v2';
3
3
  declare type HandlerId = string;
4
4
  export declare class PrivateChannelClient {
@@ -1,4 +1,4 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import { ChannelProvider } from '../../interappbus/channel/provider';
3
3
  declare type HandlerId = string;
4
4
  export declare class PrivateChannelProvider {
@@ -1,4 +1,4 @@
1
- import * as FDC3v1 from './shapes/fdc3v1';
1
+ import type * as FDC3v1 from './shapes/fdc3v1';
2
2
  import { Base } from '../../base';
3
3
  /**
4
4
  * @typedef { object } Listener
@@ -130,7 +130,7 @@ class Fdc3Module extends base_1.Base {
130
130
  this.wire.sendAction('fdc3-broadcast').catch((e) => {
131
131
  // we do not want to expose this error, just continue if this analytics-only call fails
132
132
  });
133
- this.fin.me.interop.setContext(context);
133
+ return this.fin.me.interop.setContext(context);
134
134
  }
135
135
  /**
136
136
  * Returns the Interop-Broker-defined context groups available for an entity to join.
@@ -165,7 +165,7 @@ class Fdc3Module extends base_1.Base {
165
165
  // we do not want to expose this error, just continue if this analytics-only call fails
166
166
  });
167
167
  try {
168
- await this.fin.me.interop.joinContextGroup(channelId);
168
+ return await this.fin.me.interop.joinContextGroup(channelId);
169
169
  }
170
170
  catch (error) {
171
171
  if (error.message === utils_2.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
@@ -187,7 +187,7 @@ class Fdc3Module extends base_1.Base {
187
187
  this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
188
188
  // we do not want to expose this error, just continue if this analytics-only call fails
189
189
  });
190
- this.fin.me.interop.removeFromContextGroup();
190
+ return this.fin.me.interop.removeFromContextGroup();
191
191
  }
192
192
  /**
193
193
  * Adds a listener for incoming Intents.
@@ -232,7 +232,7 @@ class Fdc3Module extends base_1.Base {
232
232
  return await this.fin.me.interop.fireIntent(intentObj);
233
233
  }
234
234
  catch (error) {
235
- const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
235
+ const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
236
236
  throw new Error(errorToThrow);
237
237
  }
238
238
  }
@@ -266,7 +266,7 @@ class Fdc3Module extends base_1.Base {
266
266
  return await this.fin.me.interop.getInfoForIntent({ name: intent, context });
267
267
  }
268
268
  catch (error) {
269
- const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error;
269
+ const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
270
270
  throw new Error(errorToThrow);
271
271
  }
272
272
  }
@@ -284,7 +284,7 @@ class Fdc3Module extends base_1.Base {
284
284
  return await this.fin.me.interop.getInfoForIntentsByContext(context);
285
285
  }
286
286
  catch (error) {
287
- const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
287
+ const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
288
288
  throw new Error(errorToThrow);
289
289
  }
290
290
  }
@@ -303,7 +303,7 @@ class Fdc3Module extends base_1.Base {
303
303
  return await this.fin.me.interop.fireIntentForContext({ ...context, metadata: { target: app } });
304
304
  }
305
305
  catch (error) {
306
- const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error;
306
+ const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error.message;
307
307
  throw new Error(errorToThrow);
308
308
  }
309
309
  }
@@ -354,7 +354,7 @@ class Fdc3Module extends base_1.Base {
354
354
  return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3Open', { app, context });
355
355
  }
356
356
  catch (error) {
357
- const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error;
357
+ const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error.message;
358
358
  throw new Error(errorToThrow);
359
359
  }
360
360
  }
@@ -1,5 +1,5 @@
1
- import * as FDC3v1 from './shapes/fdc3v1';
2
- import * as FDC3v2 from './shapes/fdc3v2';
1
+ import type * as FDC3v1 from './shapes/fdc3v1';
2
+ import type * as FDC3v2 from './shapes/fdc3v2';
3
3
  import { Base } from '../../base';
4
4
  import Transport from '../../../transport/transport';
5
5
  /**
@@ -283,7 +283,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
283
283
  * Returns the Channel object for the current User channel membership
284
284
  * @returns { Promise<FDC3.Channel | null> }
285
285
  */
286
- getCurrentChannel(): Promise<FDC3v1.Channel | null>;
286
+ getCurrentChannel(): Promise<FDC3v2.Channel | null>;
287
287
  /**
288
288
  * Removes the app from any User channel membership.
289
289
  * @returns { Promise<void> }
@@ -191,7 +191,7 @@ class Fdc3Module2 extends base_1.Base {
191
191
  return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3FindInstances', app);
192
192
  }
193
193
  catch (error) {
194
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error;
194
+ const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error.message;
195
195
  throw new Error(errorToThrow);
196
196
  }
197
197
  }
@@ -209,7 +209,7 @@ class Fdc3Module2 extends base_1.Base {
209
209
  return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3GetAppMetadata', app);
210
210
  }
211
211
  catch (error) {
212
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error;
212
+ const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error.message;
213
213
  throw new Error(errorToThrow);
214
214
  }
215
215
  }
@@ -268,7 +268,7 @@ class Fdc3Module2 extends base_1.Base {
268
268
  return await this.fin.me.interop.getInfoForIntent({ name: intent, context, metadata: { resultType } });
269
269
  }
270
270
  catch (error) {
271
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error;
271
+ const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
272
272
  throw new Error(errorToThrow);
273
273
  }
274
274
  }
@@ -288,7 +288,7 @@ class Fdc3Module2 extends base_1.Base {
288
288
  return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2FindIntentsByContext', payload);
289
289
  }
290
290
  catch (error) {
291
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
291
+ const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
292
292
  throw new Error(errorToThrow);
293
293
  }
294
294
  }
@@ -308,7 +308,7 @@ class Fdc3Module2 extends base_1.Base {
308
308
  return (0, utils_2.getIntentResolution)(this.fin.me.interop, context, app, intent);
309
309
  }
310
310
  catch (error) {
311
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
311
+ const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
312
312
  throw new Error(errorToThrow);
313
313
  }
314
314
  }
@@ -328,7 +328,7 @@ class Fdc3Module2 extends base_1.Base {
328
328
  return (0, utils_2.getIntentResolution)(this.fin.me.interop, context, app);
329
329
  }
330
330
  catch (error) {
331
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
331
+ const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
332
332
  throw new Error(errorToThrow);
333
333
  }
334
334
  }
@@ -443,7 +443,15 @@ class Fdc3Module2 extends base_1.Base {
443
443
  * @returns { Promise<FDC3.Channel | null> }
444
444
  */
445
445
  async getCurrentChannel() {
446
- return this.fdc3Module.getCurrentChannel();
446
+ const currentChannel = await this.fdc3Module.getCurrentChannel();
447
+ if (!currentChannel) {
448
+ return null;
449
+ }
450
+ return {
451
+ ...currentChannel,
452
+ type: 'user',
453
+ broadcast: this.broadcast.bind(this)
454
+ };
447
455
  }
448
456
  /**
449
457
  * Removes the app from any User channel membership.
@@ -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;
@@ -1,6 +1,6 @@
1
- import { TargetApp } from './shapes/fdc3v1';
2
- import { AppIdentifier, IntentResolution, Channel, PrivateChannel, Context } from './shapes/fdc3v2';
3
- import * as OpenFin from '../../../OpenFin';
1
+ import type { TargetApp } from './shapes/fdc3v1';
2
+ import type { AppIdentifier, IntentResolution, Channel, PrivateChannel, Context } from './shapes/fdc3v2';
3
+ import type * as OpenFin from '../../../OpenFin';
4
4
  import { PrivateChannelClient } from './PrivateChannelClient';
5
5
  interface UnsupportedChannelApis {
6
6
  addContextListener(): Error;
@@ -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 });
@@ -1,4 +1,4 @@
1
- import * as OpenFin from '../../OpenFin';
1
+ import type * as OpenFin from '../../OpenFin';
2
2
  export declare const generateId: () => string;
3
3
  export declare const wrapInTryCatch: <T>(f: (...args: any[]) => T, prefix?: string) => (...args: any[]) => T;
4
4
  export declare const wrapContextHandler: (handler: OpenFin.ContextHandler, handlerId: string) => (context: OpenFin.Context) => Promise<void>;
package/src/api/me.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import * as OpenFin from '../OpenFin';
1
+ import type * as OpenFin from '../OpenFin';
2
2
  import type Transport from '../transport/transport';
3
3
  import type { InteropClient } from './interop';
4
4
  export declare const environmentUnsupportedMessage = "You are not running in OpenFin.";
5
- import EntityType = OpenFin.EntityType;
5
+ declare type EntityType = OpenFin.EntityType;
6
6
  export declare type EntityTypeHelpers<T extends EntityType> = T extends 'view' ? {
7
7
  isView: true;
8
8
  isWindow: false;
@@ -37,3 +37,4 @@ export declare type Me<MeType extends EntityType> = OpenFin.EntityInfo & (MeType
37
37
  isOpenFin: boolean;
38
38
  };
39
39
  export declare function getMe<MeType extends EntityType>(wire: Transport<MeType>): Me<MeType>;
40
+ export {};
@@ -1,20 +1,23 @@
1
- import * as OpenFin from '../../OpenFin';
1
+ import type * as OpenFin from '../../OpenFin';
2
2
  import { Base } from '../base';
3
3
  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.
@@ -1,17 +1,17 @@
1
- import * as OpenFin from '../../OpenFin';
1
+ import type * as OpenFin from '../../OpenFin';
2
2
  import { View } from '../view';
3
3
  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) {
@@ -1,5 +1,5 @@
1
- import * as OpenFin from '../../OpenFin';
2
- import LayoutPresetType = OpenFin.LayoutPresetType;
1
+ import type * as OpenFin from '../../OpenFin';
2
+ declare type LayoutPresetType = OpenFin.LayoutPresetType;
3
3
  export declare function isValidPresetType(type: LayoutPresetType): type is LayoutPresetType;
4
4
  declare const _default: {
5
5
  isValidPresetType: typeof isValidPresetType;
@@ -1,14 +1,16 @@
1
- import * as OpenFin from '../../../OpenFin';
1
+ import type * as OpenFin from '../../../OpenFin';
2
2
  import { Layout } from './Instance';
3
3
  import { Base } from '../../base';
4
- import InitLayoutOptions = OpenFin.InitLayoutOptions;
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 @@ import 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 @@ import 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.
@@ -107,3 +111,4 @@ export declare class LayoutModule extends Base {
107
111
  */
108
112
  init: (options?: InitLayoutOptions) => Promise<OpenFin.Layout>;
109
113
  }
114
+ export {};