@openfin/core 29.73.4 → 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.
Files changed (35) hide show
  1. package/OpenFin.d.ts +48 -0
  2. package/package.json +1 -1
  3. package/src/OpenFin.d.ts +1455 -0
  4. package/src/OpenFin.js +4 -0
  5. package/src/api/events/system.d.ts +18 -3
  6. package/src/api/events/typedEventEmitter.d.ts +13 -0
  7. package/src/api/events/typedEventEmitter.js +2 -0
  8. package/src/api/interop/Factory.js +4 -1
  9. package/src/api/interop/InteropBroker.d.ts +7 -5
  10. package/src/api/interop/InteropBroker.js +2 -1
  11. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +8 -7
  12. package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
  13. package/src/api/interop/fdc3/fdc3-2.0.d.ts +23 -21
  14. package/src/api/interop/fdc3/fdc3-2.0.js +9 -9
  15. package/src/api/interop/fdc3/fdc3.d.ts +12 -0
  16. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  17. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  18. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +53 -0
  19. package/src/api/interop/fdc3/shapes/fdc3v1.js +4 -0
  20. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +74 -0
  21. package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
  22. package/src/api/interop/fdc3/utils.d.ts +7 -5
  23. package/src/api/interop/fdc3/utils.js +2 -2
  24. package/src/api/interop/fdc3/versions.d.ts +1 -0
  25. package/src/api/interop/fdc3/versions.js +2 -0
  26. package/src/api/platform/Instance.d.ts +14 -0
  27. package/src/api/platform/Instance.js +17 -0
  28. package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
  29. package/src/api/platform/layout/utils/bounds-observer.js +2 -2
  30. package/src/api/system/index.d.ts +0 -469
  31. package/src/api/system/index.js +51 -471
  32. package/src/api/view/Instance.d.ts +11 -0
  33. package/src/api/view/Instance.js +19 -0
  34. package/src/fdc3.d.ts +3 -0
  35. package/src/shapes/protocol.d.ts +3 -1
package/src/OpenFin.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const snapshot_source_1 = require("./api/snapshot-source");
4
+ const window_1 = require("./api/window");
@@ -10,13 +10,28 @@ export declare type MonitorEvent<Topic, Type> = OpenFin.MonitorInfo & BaseEvent<
10
10
  export interface SessionChangedEvent<Topic, Type> extends BaseEvent<Topic, Type> {
11
11
  reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown';
12
12
  }
13
- export interface SystemEventMapping<Topic = string, Type = string> extends BaseEventMap {
13
+ export declare type SystemEventMapping<Topic = string, Type = string> = BaseEventMap & {
14
14
  'application-created': ApplicationEvent<Topic, Type>;
15
15
  'desktop-icon-clicked': ApplicationEvent<Topic, Type>;
16
16
  'idle-state-changed': IdleEvent<Topic, Type>;
17
17
  'monitor-info-changed': MonitorEvent<Topic, Type>;
18
18
  'session-changed': SessionChangedEvent<Topic, Type>;
19
- }
19
+ };
20
+ export declare type WithId<T extends AppVersionEventNames> = `${T}.${string}`;
21
+ export declare type WithoutId<T extends string> = T extends WithId<infer U> ? U : never;
22
+ declare type AppVersionEventNames = OpenFin.AppVersionEvents['type'];
23
+ declare type IdEventNames = WithId<AppVersionEventNames>;
24
+ export declare type AppVersionTypeFromIdEvent<T extends IdEventNames> = Extract<OpenFin.AppVersionEvents, {
25
+ type: WithoutId<T>;
26
+ }>;
27
+ export declare type AppVersionEventsWithId = {
28
+ [key in IdEventNames]: Omit<AppVersionTypeFromIdEvent<key>, 'type'> & {
29
+ type: key;
30
+ topic: 'system';
31
+ appVersionId: string;
32
+ };
33
+ };
20
34
  export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & PropagatedViewEvents<'system'> & {
21
35
  [Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type];
22
- };
36
+ } & AppVersionEventsWithId;
37
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare type Listener<T extends {
2
+ type: string;
3
+ }> = (payload: T) => void;
4
+ export interface TypedEventEmitter<Events extends {
5
+ type: string;
6
+ }> {
7
+ on<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
8
+ once<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
9
+ addListener<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
10
+ removeListener<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
11
+ removeAllListeners<Event extends Events>(event?: Event['type']): this;
12
+ emit<Event extends Events>(event: Event['type'], payload: Event): boolean;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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.
@@ -1,3 +1,5 @@
1
+ import { TargetApp } from './fdc3/shapes/fdc3v1';
2
+ import { AppIdentifier } from './fdc3/shapes/fdc3v2';
1
3
  import { Base } from '../base';
2
4
  import type Transport from '../../transport/transport';
3
5
  import Identity = OpenFin.Identity;
@@ -356,23 +358,23 @@ export declare class InteropBroker extends Base {
356
358
  * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
357
359
  */
358
360
  fdc3HandleOpen({ app, context }: {
359
- app: FDC3.TargetApp | FDC3v2.AppIdentifier;
361
+ app: TargetApp | AppIdentifier;
360
362
  context: OpenFin.Context;
361
- }, clientIdentity: OpenFin.ClientIdentity): Promise<void | FDC3v2.AppIdentifier>;
363
+ }, clientIdentity: OpenFin.ClientIdentity): Promise<void | AppIdentifier>;
362
364
  /**
363
365
  * Responsible for resolving the fdc3.findInstances call.
364
366
  * Must be overridden
365
367
  * @param { AppIdentifier(2) } app AppIdentifier that was passed to fdc3.findInstances
366
368
  * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
367
369
  */
368
- fdc3HandleFindInstances(app: FDC3v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
370
+ fdc3HandleFindInstances(app: AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
369
371
  /**
370
372
  * Responsible for resolving the fdc3.getAppMetadata call.
371
373
  * Must be overridden
372
374
  * @param { AppIdentifier(2) } app AppIdentifier that was passed to fdc3.getAppMetadata
373
375
  * @param { ClientIdentity } clientIdentity Identity of the Client making the request.
374
376
  */
375
- fdc3HandleGetAppMetadata(app: FDC3v2.AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
377
+ fdc3HandleGetAppMetadata(app: AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
376
378
  /**
377
379
  * This function is called by the Interop Broker whenever a Context handler would fire.
378
380
  * For FDC3 2.0 you would need to override this function and add the contextMetadata as
@@ -413,7 +415,7 @@ export declare class InteropBroker extends Base {
413
415
  * FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
414
416
  * an AppIdentifier.
415
417
  * @return { Promise<Array<ClientInfo>> }
416
- * @tutorial interop.getAllClientInfo()
418
+ * @tutorial interop.getAllClientInfo
417
419
  */
418
420
  getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
419
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,17 +1,18 @@
1
+ import type { Listener, Context, ContextHandler } from './shapes/fdc3v2';
1
2
  declare type HandlerId = string;
2
3
  export declare class PrivateChannelClient {
3
4
  id: string;
4
5
  client: OpenFin.ChannelClient;
5
- listeners: Map<HandlerId, FDC3v2.Listener>;
6
+ listeners: Map<HandlerId, Listener>;
6
7
  constructor(client: OpenFin.ChannelClient, id: string);
7
- broadcast(context: OpenFin.Context): Promise<void>;
8
- getCurrentContext(contextType?: string): Promise<OpenFin.Context | null>;
9
- addContextListener(contextType: string | null, handler: OpenFin.ContextHandler): Promise<FDC3v2.Listener>;
8
+ broadcast(context: Context): Promise<void>;
9
+ getCurrentContext(contextType?: string): Promise<Context | null>;
10
+ addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
10
11
  private createNonStandardUnsubscribeCb;
11
12
  private createContextUnsubscribeCb;
12
- onAddContextListener(handler: (contextType?: string) => void): FDC3v2.Listener;
13
- onDisconnect(handler: () => void): FDC3v2.Listener;
14
- onUnsubscribe(handler: (contextType?: string) => void): FDC3v2.Listener;
13
+ onAddContextListener(handler: (contextType?: string) => void): Listener;
14
+ onDisconnect(handler: () => void): Listener;
15
+ onUnsubscribe(handler: (contextType?: string) => void): Listener;
15
16
  disconnect(): Promise<void>;
16
17
  }
17
18
  export {};
@@ -1,3 +1,4 @@
1
+ import * as FDC3v1 from './shapes/fdc3v1';
1
2
  import { Base } from '../../base';
2
3
  /**
3
4
  * @typedef { object } Listener
@@ -88,7 +89,7 @@ import { Base } from '../../base';
88
89
  * }
89
90
  * ```
90
91
  */
91
- export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
92
+ export default class Fdc3Module extends Base implements FDC3v1.DesktopAgent {
92
93
  /**
93
94
  * Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
94
95
  * @param { string | null } contextType - The type of context you wish to handle.
@@ -97,7 +98,7 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
97
98
  * @tutorial fdc3.addContextListener
98
99
  * @static
99
100
  */
100
- addContextListener(contextType: string | null, handler: OpenFin.ContextHandler): FDC3.Listener & Promise<FDC3.Listener>;
101
+ addContextListener(contextType: string | null, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
101
102
  /**
102
103
  * Broadcasts a context for the channel of the current entity.
103
104
  * @param { Context } context - New context to set.
@@ -105,14 +106,14 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
105
106
  * @tutorial fdc3.broadcast
106
107
  * @static
107
108
  */
108
- broadcast(context: OpenFin.Context): Promise<void>;
109
+ broadcast(context: FDC3v1.Context): Promise<void>;
109
110
  /**
110
111
  * Returns the Interop-Broker-defined context groups available for an entity to join.
111
112
  * @returns { Promise<Channel[]>}
112
113
  * @tutorial fdc3.getSystemChannels
113
114
  * @static
114
115
  */
115
- getSystemChannels(): Promise<OpenFin.ContextGroupInfo[]>;
116
+ getSystemChannels(): Promise<FDC3v1.SystemChannel[]>;
116
117
  /**
117
118
  * Join all Interop Clients at the given identity to context group `contextGroupId`.
118
119
  * If no target is specified, it adds the sender to the context group.
@@ -141,7 +142,7 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
141
142
  * @tutorial fdc3.addIntentListener
142
143
  * @static
143
144
  */
144
- addIntentListener(intent: string, handler: OpenFin.ContextHandler): FDC3.Listener & Promise<FDC3.Listener>;
145
+ addIntentListener(intent: string, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
145
146
  /**
146
147
  * Raises a specific intent.
147
148
  * @param { string } intent Name of the Intent.
@@ -151,13 +152,13 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
151
152
  * @tutorial fdc3.raiseIntent
152
153
  * @static
153
154
  */
154
- raiseIntent(intent: string, context: OpenFin.Context, app?: FDC3.TargetApp): Promise<FDC3.IntentResolution>;
155
+ raiseIntent(intent: string, context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
155
156
  /**
156
157
  * Returns the Channel that the entity is subscribed to. Returns null if not joined to a channel.
157
158
  * @returns { Channel | null }
158
159
  * @tutorial fdc3.getCurrentChannel
159
160
  */
160
- getCurrentChannel(): Promise<FDC3.Channel | null>;
161
+ getCurrentChannel(): Promise<FDC3v1.Channel | null>;
161
162
  /**
162
163
  * Find out more information about a particular intent by passing its name, and optionally its context.
163
164
  * @param { string } intent Name of the Intent
@@ -165,14 +166,14 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
165
166
  * @return { Promise<AppIntent> }
166
167
  * @tutorial fdc3.findIntent
167
168
  */
168
- findIntent(intent: string, context?: OpenFin.Context): Promise<FDC3.AppIntent>;
169
+ findIntent(intent: string, context?: FDC3v1.Context): Promise<FDC3v1.AppIntent>;
169
170
  /**
170
171
  * Find all the available intents for a particular context.
171
172
  * @param { Context } context
172
173
  * @return { Promise<Array<AppIntent>> }
173
174
  * @tutorial fdc3.findIntentsByContext
174
175
  */
175
- findIntentsByContext(context: OpenFin.Context): Promise<Array<FDC3.AppIntent>>;
176
+ findIntentsByContext(context: FDC3v1.Context): Promise<Array<FDC3v1.AppIntent>>;
176
177
  /**
177
178
  * Finds and raises an intent against a target app based purely on context data.
178
179
  * @param { Context } context
@@ -180,20 +181,20 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
180
181
  * @return { Promise<IntentResolution> }
181
182
  * @tutorial fdc3.raiseIntentForContext
182
183
  */
183
- raiseIntentForContext(context: OpenFin.Context, app?: FDC3.TargetApp): Promise<FDC3.IntentResolution>;
184
+ raiseIntentForContext(context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
184
185
  /**
185
186
  * Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
186
187
  * @param channelId
187
188
  * @returns { Promise<Channel> }
188
189
  * @tutorial fdc3.getOrCreateChannel
189
190
  */
190
- getOrCreateChannel(channelId: string): Promise<FDC3.Channel>;
191
+ getOrCreateChannel(channelId: string): Promise<FDC3v1.Channel>;
191
192
  /**
192
193
  * Returns metadata relating to the FDC3 object and its provider, including the supported version of the FDC3 specification and the name of the provider of the implementation.
193
194
  * @return { Promise<ImplementationMetadata> }
194
195
  * @tutorial fdc3.getInfo
195
196
  */
196
- getInfo(): FDC3.ImplementationMetadata;
197
+ getInfo(): FDC3v1.ImplementationMetadata;
197
198
  /**
198
199
  * Launches an app with target information, which can either be a string or an AppMetadata object.
199
200
  * @param { TargetApp } app
@@ -201,7 +202,7 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
201
202
  * @return { Promise<void> }
202
203
  * @tutorial fdc3.open
203
204
  */
204
- open(app: FDC3.TargetApp, context?: OpenFin.Context): Promise<void>;
205
+ open(app: FDC3v1.TargetApp, context?: FDC3v1.Context): Promise<void>;
205
206
  private getCurrentContextGroupInfo;
206
207
  private buildChannelObject;
207
208
  }
@@ -1,3 +1,5 @@
1
+ import * as FDC3v1 from './shapes/fdc3v1';
2
+ import * as FDC3v2 from './shapes/fdc3v2';
1
3
  import { Base } from '../../base';
2
4
  import Transport from '../../../transport/transport';
3
5
  /**
@@ -164,19 +166,19 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
164
166
  * @returns { Promise<AppIdentifier> }
165
167
  * @tutorial fdc3.open
166
168
  */
167
- open(app: FDC3v2.AppIdentifier | FDC3.TargetApp, context?: OpenFin.Context): Promise<FDC3v2.AppIdentifier>;
169
+ open(app: FDC3v2.AppIdentifier | FDC3v1.TargetApp, context?: FDC3v2.Context): Promise<FDC3v2.AppIdentifier>;
168
170
  /**
169
171
  * Find all the available instances for a particular application.
170
172
  * @param { AppIdentifier } app
171
173
  * @returns { Promise<Array<AppIdentifier>> }
172
- * @tutorial fdc3v2.findInstances
174
+ * @tutorial findInstances
173
175
  */
174
176
  findInstances(app: FDC3v2.AppIdentifier): Promise<Array<FDC3v2.AppIdentifier>>;
175
177
  /**
176
178
  * Retrieves the AppMetadata for an AppIdentifier, which provides additional metadata (such as icons, a title and description) from the App Directory record for the application, that may be used for display purposes.
177
179
  * @param { AppIdentifier } app
178
180
  * @returns { Promise<AppMetadata(2)> }
179
- * @tutorial fdc3v2.getAppMetadata
181
+ * @tutorial getAppMetadata
180
182
  */
181
183
  getAppMetadata(app: FDC3v2.AppIdentifier): Promise<FDC3v2.AppMetadata>;
182
184
  /**
@@ -185,7 +187,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
185
187
  * @returns { Promise<void> }
186
188
  * @tutorial fdc3.broadcast
187
189
  */
188
- broadcast(context: OpenFin.Context): Promise<void>;
190
+ broadcast(context: FDC3v2.Context): Promise<void>;
189
191
  /**
190
192
  * Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
191
193
  * @param { string | null } contextType
@@ -193,7 +195,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
193
195
  * @returns { Listener }
194
196
  * @tutorial fdc3.addContextListener
195
197
  */
196
- addContextListener(contextType: string | null, handler: FDC3v2.ContextHandler): Promise<FDC3.Listener>;
198
+ addContextListener(contextType: string | null, handler: FDC3v2.ContextHandler): Promise<FDC3v2.Listener>;
197
199
  /**
198
200
  * Find out more information about a particular intent by passing its name, and optionally its context and resultType.
199
201
  * @param { string } intent Name of the Intent
@@ -202,32 +204,32 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
202
204
  * @returns { Promise<AppIntent(2)> }
203
205
  * @tutorial fdc3.findIntent
204
206
  */
205
- findIntent(intent: string, context?: OpenFin.Context, resultType?: string): Promise<FDC3v2.AppIntent>;
207
+ findIntent(intent: string, context?: FDC3v2.Context, resultType?: string): Promise<FDC3v2.AppIntent>;
206
208
  /**
207
209
  * Find all the available intents for a particular context.
208
210
  * @param { Context } context
209
211
  * @param { string } [resultType] The type of result returned for any intent specified during resolution.
210
212
  * @returns { Promise<Array<AppIntent(2)>> }
211
- * @tutorial fdc3v2.findIntentsByContext
213
+ * @tutorial findIntentsByContext
212
214
  */
213
- findIntentsByContext(context: OpenFin.Context, resultType?: string): Promise<Array<FDC3v2.AppIntent>>;
215
+ findIntentsByContext(context: FDC3v2.Context, resultType?: string): Promise<Array<FDC3v2.AppIntent>>;
214
216
  /**
215
217
  * Raises a specific intent for resolution against apps registered with the desktop agent.
216
218
  * @param { string } intent Name of the Intent
217
219
  * @param { Context } context Context associated with the Intent
218
220
  * @param { AppIdentifier | TargetApp } [app]
219
221
  * @returns { Promise<IntentResolution(2)> }
220
- * @tutorial fdc3v2.raiseIntent
222
+ * @tutorial raiseIntent
221
223
  */
222
- raiseIntent(intent: string, context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3v2.IntentResolution>;
224
+ raiseIntent(intent: string, context: FDC3v2.Context, app?: FDC3v2.AppIdentifier | FDC3v1.TargetApp): Promise<FDC3v2.IntentResolution>;
223
225
  /**
224
226
  * Finds and raises an intent against apps registered with the desktop agent based purely on the type of the context data.
225
227
  * @param { Context } context Context associated with the Intent
226
228
  * @param { AppIdentifier | TargetApp } [app]
227
229
  * @returns { Promise<IntentResolution(2)> }
228
- * @tutorial fdc3v2.raiseIntentForContext
230
+ * @tutorial raiseIntentForContext
229
231
  */
230
- raiseIntentForContext(context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3v2.IntentResolution>;
232
+ raiseIntentForContext(context: FDC3v2.Context, app?: FDC3v2.AppIdentifier | FDC3v1.TargetApp): Promise<FDC3v2.IntentResolution>;
231
233
  /**
232
234
  * Adds a listener for incoming intents.
233
235
  * @param { string } intent Name of the Intent
@@ -235,38 +237,38 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
235
237
  * @returns { Promise<Listener> }
236
238
  * @tutorial fdc3.addIntentListener
237
239
  */
238
- addIntentListener(intent: string, handler: FDC3v2.IntentHandler): Promise<FDC3.Listener>;
240
+ addIntentListener(intent: string, handler: FDC3v2.IntentHandler): Promise<FDC3v1.Listener>;
239
241
  /**
240
242
  * Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
241
243
  * @param channelId
242
244
  * @returns { Promise<Channel> }
243
245
  * @tutorial fdc3.getOrCreateChannel
244
246
  */
245
- getOrCreateChannel(channelId: string): Promise<FDC3.Channel>;
247
+ getOrCreateChannel(channelId: string): Promise<FDC3v1.Channel>;
246
248
  /**
247
249
  * Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
248
250
  * @returns { Promise<PrivateChannel> }
249
- * @tutorial fdc3v2.createPrivateChannel
251
+ * @tutorial createPrivateChannel
250
252
  */
251
253
  createPrivateChannel(): Promise<FDC3v2.PrivateChannel>;
252
254
  /**
253
255
  * Retrieves a list of the User Channels available for the app to join.
254
256
  * @returns { Promise<Channel[]>}
255
- * @tutorial fdc3v2.getUserChannels
257
+ * @tutorial getUserChannels
256
258
  */
257
- getUserChannels(): Promise<Array<OpenFin.ContextGroupInfo>>;
259
+ getUserChannels(): Promise<Array<FDC3v1.SystemChannel>>;
258
260
  /**
259
261
  * Retrieves a list of the User Channels available for the app to join.
260
262
  * @returns { Promise<Channel[]>}
261
263
  * @deprecated Please use {@link fdc3.getUserChannels fdc3.getUserChannels} instead
262
264
  * @tutorial fdc3.getSystemChannels
263
265
  */
264
- getSystemChannels(): Promise<Array<OpenFin.ContextGroupInfo>>;
266
+ getSystemChannels(): Promise<Array<FDC3v1.SystemChannel>>;
265
267
  /**
266
268
  * Join an app to a specified User channel.
267
269
  * @param { string } channelId Channel name
268
270
  * @returns { Promise<void> }
269
- * @tutorial fdc3v2.joinUserChannel
271
+ * @tutorial joinUserChannel
270
272
  */
271
273
  joinUserChannel(channelId: string): Promise<void>;
272
274
  /**
@@ -281,7 +283,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
281
283
  * Returns the Channel object for the current User channel membership
282
284
  * @returns { Promise<FDC3.Channel | null> }
283
285
  */
284
- getCurrentChannel(): Promise<FDC3.Channel | null>;
286
+ getCurrentChannel(): Promise<FDC3v1.Channel | null>;
285
287
  /**
286
288
  * Removes the app from any User channel membership.
287
289
  * @returns { Promise<void> }
@@ -292,7 +294,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
292
294
  * Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
293
295
  * fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
294
296
  * @returns { Promise<ImplementationMetadata(2)> }
295
- * @tutorial fdc3v2.getInfo
297
+ * @tutorial getInfo
296
298
  */
297
299
  getInfo(): Promise<FDC3v2.ImplementationMetadata>;
298
300
  }
@@ -181,7 +181,7 @@ class Fdc3Module2 extends base_1.Base {
181
181
  * Find all the available instances for a particular application.
182
182
  * @param { AppIdentifier } app
183
183
  * @returns { Promise<Array<AppIdentifier>> }
184
- * @tutorial fdc3v2.findInstances
184
+ * @tutorial findInstances
185
185
  */
186
186
  async findInstances(app) {
187
187
  this.wire.sendAction('fdc3-find-instances').catch((e) => {
@@ -199,7 +199,7 @@ class Fdc3Module2 extends base_1.Base {
199
199
  * Retrieves the AppMetadata for an AppIdentifier, which provides additional metadata (such as icons, a title and description) from the App Directory record for the application, that may be used for display purposes.
200
200
  * @param { AppIdentifier } app
201
201
  * @returns { Promise<AppMetadata(2)> }
202
- * @tutorial fdc3v2.getAppMetadata
202
+ * @tutorial getAppMetadata
203
203
  */
204
204
  async getAppMetadata(app) {
205
205
  this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
@@ -277,7 +277,7 @@ class Fdc3Module2 extends base_1.Base {
277
277
  * @param { Context } context
278
278
  * @param { string } [resultType] The type of result returned for any intent specified during resolution.
279
279
  * @returns { Promise<Array<AppIntent(2)>> }
280
- * @tutorial fdc3v2.findIntentsByContext
280
+ * @tutorial findIntentsByContext
281
281
  */
282
282
  async findIntentsByContext(context, resultType) {
283
283
  this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
@@ -298,7 +298,7 @@ class Fdc3Module2 extends base_1.Base {
298
298
  * @param { Context } context Context associated with the Intent
299
299
  * @param { AppIdentifier | TargetApp } [app]
300
300
  * @returns { Promise<IntentResolution(2)> }
301
- * @tutorial fdc3v2.raiseIntent
301
+ * @tutorial raiseIntent
302
302
  */
303
303
  async raiseIntent(intent, context, app) {
304
304
  this.wire.sendAction('fdc3-raise-intent').catch((e) => {
@@ -317,7 +317,7 @@ class Fdc3Module2 extends base_1.Base {
317
317
  * @param { Context } context Context associated with the Intent
318
318
  * @param { AppIdentifier | TargetApp } [app]
319
319
  * @returns { Promise<IntentResolution(2)> }
320
- * @tutorial fdc3v2.raiseIntentForContext
320
+ * @tutorial raiseIntentForContext
321
321
  */
322
322
  async raiseIntentForContext(context, app) {
323
323
  // TODO: We have to do the same thing we do for raiseIntent here as well.
@@ -385,7 +385,7 @@ class Fdc3Module2 extends base_1.Base {
385
385
  /**
386
386
  * Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
387
387
  * @returns { Promise<PrivateChannel> }
388
- * @tutorial fdc3v2.createPrivateChannel
388
+ * @tutorial createPrivateChannel
389
389
  */
390
390
  async createPrivateChannel() {
391
391
  const channelId = (0, utils_1.generateId)();
@@ -398,7 +398,7 @@ class Fdc3Module2 extends base_1.Base {
398
398
  /**
399
399
  * Retrieves a list of the User Channels available for the app to join.
400
400
  * @returns { Promise<Channel[]>}
401
- * @tutorial fdc3v2.getUserChannels
401
+ * @tutorial getUserChannels
402
402
  */
403
403
  async getUserChannels() {
404
404
  const channels = await this.fin.me.interop.getContextGroups();
@@ -422,7 +422,7 @@ class Fdc3Module2 extends base_1.Base {
422
422
  * Join an app to a specified User channel.
423
423
  * @param { string } channelId Channel name
424
424
  * @returns { Promise<void> }
425
- * @tutorial fdc3v2.joinUserChannel
425
+ * @tutorial joinUserChannel
426
426
  */
427
427
  async joinUserChannel(channelId) {
428
428
  return this.fdc3Module.joinChannel(channelId);
@@ -457,7 +457,7 @@ class Fdc3Module2 extends base_1.Base {
457
457
  * Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
458
458
  * fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
459
459
  * @returns { Promise<ImplementationMetadata(2)> }
460
- * @tutorial fdc3v2.getInfo
460
+ * @tutorial getInfo
461
461
  */
462
462
  async getInfo() {
463
463
  return InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
@@ -0,0 +1,12 @@
1
+ import Fdc3Module from './fdc3-1.2';
2
+ import Fdc3Module2 from './fdc3-2.0';
3
+ import type Transport from '../../../transport/transport';
4
+ import { Fdc3Version } from './versions';
5
+ declare global {
6
+ interface Window {
7
+ fdc3: Fdc3Module | Fdc3Module2;
8
+ }
9
+ }
10
+ export declare const versionMap: Record<Fdc3Version, typeof Fdc3Module | typeof Fdc3Module2>;
11
+ export declare function registerFdc3Shim(version: string, transport: Transport): void;
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,53 @@
1
+ import type { DisplayMetadata } from 'fdc3v1/src/api/DisplayMetadata';
2
+ import type { Listener } from 'fdc3v1/src/api/Listener';
3
+ import type { AppMetadata } from 'fdc3v1/src/api/AppMetadata';
4
+ import type { AppIntent } from 'fdc3v1/src/api/AppIntent';
5
+ import type { ImplementationMetadata } from 'fdc3v1/src/api/ImplementationMetadata';
6
+ export type { DisplayMetadata } from 'fdc3v1/src/api/DisplayMetadata';
7
+ export type { Listener } from 'fdc3v1/src/api/Listener';
8
+ export type { AppMetadata } from 'fdc3v1/src/api/AppMetadata';
9
+ export type { AppIntent } from 'fdc3v1/src/api/AppIntent';
10
+ export type { ImplementationMetadata } from 'fdc3v1/src/api/ImplementationMetadata';
11
+ export declare type ContextHandler = (context: Context) => void;
12
+ export declare type TargetApp = string | AppMetadata;
13
+ export interface Context {
14
+ id?: {
15
+ [key: string]: string;
16
+ };
17
+ name?: string;
18
+ type: string;
19
+ }
20
+ export interface IntentResolution {
21
+ source: TargetApp;
22
+ data?: object;
23
+ version: string;
24
+ }
25
+ export interface Channel {
26
+ id: string;
27
+ type: string;
28
+ displayMetadata?: DisplayMetadata;
29
+ broadcast(context: Context): void;
30
+ getCurrentContext(contextType?: string): Promise<Context | null>;
31
+ addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
32
+ }
33
+ export declare type SystemChannel = Omit<Channel, 'addContextListener' | 'broadcast' | 'getCurrentContext'> & {
34
+ addContextListener(): Error;
35
+ broadcast(): Error;
36
+ getCurrentContext(): Error;
37
+ };
38
+ export interface DesktopAgent {
39
+ open(app: TargetApp, context?: Context): Promise<void>;
40
+ findIntent(intent: string, context?: Context): Promise<AppIntent>;
41
+ findIntentsByContext(context: Context): Promise<Array<AppIntent>>;
42
+ broadcast(context: Context): void;
43
+ raiseIntent(intent: string, context: Context, app?: TargetApp): Promise<IntentResolution>;
44
+ raiseIntentForContext(context: Context, app?: TargetApp): Promise<IntentResolution>;
45
+ addIntentListener(intent: string, handler: ContextHandler): Listener;
46
+ joinChannel(channelId: string): Promise<void>;
47
+ leaveCurrentChannel(): Promise<void>;
48
+ getInfo(): ImplementationMetadata;
49
+ addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
50
+ getOrCreateChannel(channelId: string): Promise<Channel>;
51
+ getSystemChannels(): Promise<SystemChannel[]>;
52
+ getCurrentChannel(): Promise<Channel | null>;
53
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /* eslint-disable import/no-extraneous-dependencies */
3
+ /* eslint-disable no-restricted-imports */
4
+ Object.defineProperty(exports, "__esModule", { value: true });