@openfin/core 29.72.13 → 29.72.15

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.
@@ -1,24 +1,278 @@
1
1
  import { Base } from '../../base';
2
2
  import Transport from '../../../transport/transport';
3
+ /**
4
+ * @typedef { object } AppIdentifier
5
+ * @summary Identifies an application, or instance of an application, and is used to target FDC3 API calls at specific applications.
6
+ * @property { string } appId The unique application identifier located within a specific application directory instance. An example of an appId might be 'app@sub.root'.
7
+ * @property { string } [instancedId] An optional instance identifier, indicating that this object represents a specific instance of the application described. The endpointId should be used as the instanceId. The most convenient way to get this would be to use the InteropBroker.getAllClientInfo API.
8
+ */
9
+ /**
10
+ * @typedef { Context | Channel } IntentResult
11
+ * @summary Describes results that an Intent handler may optionally return that should be communicated back to the app that raised the intent, via the IntentResolution.
12
+ */
13
+ /**
14
+ * @typedef { object } Icon
15
+ * @summary Metadata relating to a single icon image at a remote URL, used to represent an application in a user interface.
16
+ * @property { string } src The fully qualified url to the icon.
17
+ * @property { string } [size] The dimensions of the Icon formatted as <height>x<width>.
18
+ * @property { string } [type] The media type of the icon. If not provided the Desktop Agent may refer to the src file extension.
19
+ */
20
+ /**
21
+ * @typedef { object } Image
22
+ * @summary Metadata relating to a single image at a remote URL, used to represent screenshot images.
23
+ * @property { string } src The fully qualified url to the image.
24
+ * @property { string } [size] The dimensions of the image formatted as <height>x<width>.
25
+ * @property { string } [type] The media type of the image. If not provided the Desktop Agent may refer to the src file extension.
26
+ * @property { string } [label]
27
+ */
28
+ /**
29
+ * @typedef { object } AppMetadata
30
+ * @variation 2
31
+ * @summary Extends an AppIdentifier, describing an application or instance of an application, with additional descriptive metadata that is usually provided by an FDC3 App Directory that the desktop agent connects to.
32
+ * @property { string } appId The unique application identifier located within a specific application directory instance. An example of an appId might be 'app@sub.root'.
33
+ * @property { string } [instanceId] An optional instance identifier, indicating that this object represents a specific instance of the application described. The endpointId should be used as the instanceId. The most convenient way to get this would be to use the InteropBroker.getAllClientInfo API.
34
+ * @property { string } [name] The 'friendly' app name. This field was used with the `open` and `raiseIntent` calls in FDC3 <2.0, which now require an `AppIdentifier` with `appId` set. Note that for display purposes the `title` field should be used, if set, in preference to this field.
35
+ * @property { string } [version] The version of the application.
36
+ * @property { Record<string, any> } [instanceMetadata]
37
+ * @property { string } [title] A more user-friendly application title that can be used to render UI elements.
38
+ * @property { string } [tooltip] A tooltip for the application that can be used to render UI elements.
39
+ * @property { string } [description] A longer, multi-paragraph description for the application that could include mark-up.
40
+ * @property { Array<Icon> } [icons] A list of icon URLs for the application that can be used to render UI elements.
41
+ * @property { Array<Image> } [screenshots] Images representing the app in common usage scenarios that can be used to render UI elements.
42
+ * @property { string | null } [resultType] The type of result returned for any intent specified during resolution. May express a particular context type (e.g. "fdc3.instrument"), channel (e.g. "channel") or a channel that will receive a specified type (e.g. "channel<fdc3.instrument>").
43
+ */
44
+ /**
45
+ * @typedef { object } ContextMetadata
46
+ * @summary Metadata relating to a context or intent & context received through the addContextListener and addIntentListener functions. Currently identifies the app that originated the context or intent message.
47
+ * @property { AppIdentifier } source Identifier for the app instance that sent the context and/or intent.
48
+ */
49
+ /**
50
+ * @typedef { object } ImplementationMetadataOptionalFeatures
51
+ * @property { boolean } originatingAppMetadata Used to indicate whether the exposure of 'originating app metadata' for context and intent messages is supported by the Desktop Agent.
52
+ * @property { boolean } userChannelMembershipAPIs Used to indicate whether the optional `fdc3.joinUserChannel`, `fdc3.getCurrentChannel` and `fdc3.leaveCurrentChannel` are implemented by the Desktop Agent.
53
+ */
54
+ /**
55
+ * @typedef { object } ImplementationMetadata
56
+ * @variation 2
57
+ * @summary Metadata relating to the FDC3 DesktopAgent object and its provider, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number and the metadata of the calling application according to the desktop agent.
58
+ * @property { string } fdc3Version The FDC3 version
59
+ * @property { string } provider The provider's uuid prepended with 'openfin' (e.g. 'openfin-myUuid').
60
+ * @property { string } [providerVersion] The provider runtime version
61
+ * @property { ImplementationMetadataOptionalFeatures } optionalFeatures
62
+ * @property { AppMetadata } appMetadata The calling application instance's own metadata, according to the Desktop Agent (MUST include at least the `appId` and `instanceId`).
63
+ */
64
+ /**
65
+ * @callback ContextHandler
66
+ * @variation 2
67
+ * @param { Context } context
68
+ * @param { ContextMetadata } [contextMetadata]
69
+ * @returns { void }
70
+ */
71
+ /**
72
+ * @callback IntentHandler
73
+ * @variation 2
74
+ * @param { Context } context
75
+ * @param { ContextMetadata } [contextMetadata]
76
+ * @returns { Promise<IntentResult> | void }
77
+ */
78
+ /**
79
+ * @typedef { object } IntentMetadata
80
+ * @summary The interface used to describe an intent within the platform.
81
+ * @property { string } name The unique name of the intent that can be invoked by the raiseIntent call.
82
+ * @property { string } displayName A friendly display name for the intent that should be used to render UI elements.
83
+ */
84
+ /**
85
+ * @typedef { object } AppIntent
86
+ * @variation 2
87
+ * @summary An interface that represents the binding of an intent to apps, returned as part of intent discovery. For each intent, it references the applications that support that intent.
88
+ * @property { IntentMetadata } intent Details of the intent whose relationship to resolving applications is being described
89
+ * @property { Array<AppMetadata> } apps
90
+ */
91
+ /**
92
+ * @name getResult
93
+ * @function
94
+ * @returns { Promise<IntentResult> }
95
+ */
96
+ /**
97
+ * @typedef { object } IntentResolution
98
+ * @variation 2
99
+ * @summary Provides a standard format for data returned upon resolving an intent.
100
+ * @property { AppIdentifier } source Identifier for the app instance that was selected (or started) to resolve the intent.
101
+ * @property { string } Intent Intent name
102
+ * @property { string } [version] The version number of the Intents schema being used.
103
+ * @property { Function } getResult {@link getResult Function} that returns a promise that will resolve to either `Context` data returned by the application that resolves the raised intent or a `Channel` established and returned by the app resolving the intent.
104
+ */
105
+ /**
106
+ * @class
107
+ * @alias fdc3v2
108
+ * @version 2.0
109
+ * @hideconstructor
110
+ * @desc The FDC3 Client Library provides a set APIs to be used for FDC3 compliance,
111
+ * while using our Interop API under the hood. In order to use this set of APIs
112
+ * you will need to set up your own {@link InteropBroker InteropBroker} or use a Platform application, which does the setup for you. Refer to our documentation on
113
+ * our {@link https://developers.openfin.co/of-docs/docs/enable-context-sharing Interop API}.
114
+ *
115
+ * To enable the FDC3 APIs in a {@link Window Window} or {@link View View}, add the fdc3InteropApi
116
+ * property to its options:
117
+ *
118
+ * ```js
119
+ * {
120
+ * autoShow: false,
121
+ * saveWindowState: true,
122
+ * url: 'https://openfin.co',
123
+ * fdc3InteropApi: '2.0'
124
+ * }
125
+ * ```
126
+ *
127
+ * If using a {@link Platform Platform } application, you can set this property in defaultWindowOptions and defaultViewOptions.
128
+ *
129
+ * In order to ensure that the FDC3 Api is ready before use, you can use the 'fdc3Ready' event fired on the DOM Window object:
130
+ *
131
+ * ```js
132
+ * function fdc3Action() {
133
+ * // Make some fdc3 API calls here
134
+ * }
135
+ *
136
+ * if (window.fdc3) {
137
+ * fdc3Action();
138
+ * } else {
139
+ * window.addEventListener('fdc3Ready', fdc3Action);
140
+ * }
141
+ * ```
142
+ */
3
143
  export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
4
144
  private fdc3Module;
5
145
  constructor(wire: Transport);
6
- open(app: FDC3v2.AppIdentifier | FDC3.TargetApp, context?: OpenFin.Context): Promise<FDC3v2.AppIdentifier | void>;
146
+ /**
147
+ * Launches an app, specified via an AppIdentifier object.
148
+ * @param { AppIdentifier | TargetApp } app
149
+ * @param { Context } [context]
150
+ * @returns { Promise<AppIdentifier> }
151
+ * @tutorial fdc3.open
152
+ */
153
+ open(app: FDC3v2.AppIdentifier | FDC3.TargetApp, context?: OpenFin.Context): Promise<FDC3v2.AppIdentifier>;
154
+ /**
155
+ * Find all the available instances for a particular application.
156
+ * @param { AppIdentifier } app
157
+ * @returns { Promise<Array<AppIdentifier>> }
158
+ * @tutorial fdc3v2.findInstances
159
+ */
7
160
  findInstances(app: FDC3v2.AppIdentifier): Promise<Array<FDC3v2.AppIdentifier>>;
8
- getAppMetadata(app: FDC3v2.AppIdentifier): Promise<FDC3.AppMetadata>;
161
+ /**
162
+ * 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.
163
+ * @param { AppIdentifier } app
164
+ * @returns { Promise<AppMetadata(2)> }
165
+ * @tutorial fdc3v2.getAppMetadata
166
+ */
167
+ getAppMetadata(app: FDC3v2.AppIdentifier): Promise<FDC3v2.AppMetadata>;
168
+ /**
169
+ * Broadcasts a context for the channel of the current entity.
170
+ * @param { Context } context - New context to set.
171
+ * @returns { Promise<void> }
172
+ * @tutorial fdc3.broadcast
173
+ */
9
174
  broadcast(context: OpenFin.Context): Promise<void>;
10
- addContextListener(contextType: string | null, handler: OpenFin.ContextHandler): Promise<FDC3.Listener>;
11
- findIntent(intent: string, context?: OpenFin.Context, resultType?: string): Promise<FDC3.AppIntent>;
12
- findIntentsByContext(context: OpenFin.Context, resultType?: string): Promise<Array<FDC3.AppIntent>>;
13
- raiseIntent(intent: string, context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3.IntentResolution>;
14
- raiseIntentForContext(context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3.IntentResolution>;
175
+ /**
176
+ * 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.
177
+ * @param { string | null } contextType
178
+ * @param { ContextHandler(2) } handler
179
+ * @returns { Listener }
180
+ * @tutorial fdc3.addContextListener
181
+ */
182
+ addContextListener(contextType: string | null, handler: FDC3v2.ContextHandler): Promise<FDC3.Listener>;
183
+ /**
184
+ * Find out more information about a particular intent by passing its name, and optionally its context and resultType.
185
+ * @param { string } intent Name of the Intent
186
+ * @param { Context } [context] Context
187
+ * @param { string } [resultType] The type of result returned for any intent specified during resolution.
188
+ * @returns { Promise<AppIntent(2)> }
189
+ * @tutorial fdc3.findIntent
190
+ */
191
+ findIntent(intent: string, context?: OpenFin.Context, resultType?: string): Promise<FDC3v2.AppIntent>;
192
+ /**
193
+ * Find all the available intents for a particular context.
194
+ * @param { Context } context
195
+ * @param { string } [resultType] The type of result returned for any intent specified during resolution.
196
+ * @returns { Promise<Array<AppIntent(2)>> }
197
+ * @tutorial fdc3v2.findIntentsByContext
198
+ */
199
+ findIntentsByContext(context: OpenFin.Context, resultType?: string): Promise<Array<FDC3v2.AppIntent>>;
200
+ /**
201
+ * Raises a specific intent for resolution against apps registered with the desktop agent.
202
+ * @param { string } intent Name of the Intent
203
+ * @param { Context } context Context associated with the Intent
204
+ * @param { AppIdentifier | TargetApp } [app]
205
+ * @returns { Promise<IntentResolution(2)> }
206
+ * @tutorial fdc3.raiseIntent
207
+ */
208
+ raiseIntent(intent: string, context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3v2.IntentResolution>;
209
+ /**
210
+ * Finds and raises an intent against apps registered with the desktop agent based purely on the type of the context data.
211
+ * @param { Context } context Context associated with the Intent
212
+ * @param { AppIdentifier | TargetApp } [app]
213
+ * @returns { Promise<IntentResolution(2)> }
214
+ * @tutorial fdc3.raiseIntentForContext
215
+ */
216
+ raiseIntentForContext(context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp): Promise<FDC3v2.IntentResolution>;
217
+ /**
218
+ * Adds a listener for incoming intents.
219
+ * @param { string } intent Name of the Intent
220
+ * @param { IntentHandler(2) } handler A callback that handles a context event and may return a promise of a Context or Channel object to be returned to the application that raised the intent.
221
+ * @returns { Promise<Listener> }
222
+ * @tutorial fdc3.addIntentListener
223
+ */
15
224
  addIntentListener(intent: string, handler: FDC3v2.IntentHandler): Promise<FDC3.Listener>;
225
+ /**
226
+ * Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
227
+ * @param channelId
228
+ * @returns { Promise<Channel> }
229
+ * @tutorial fdc3.getOrCreateChannel
230
+ */
16
231
  getOrCreateChannel(channelId: string): Promise<FDC3.Channel>;
17
232
  createPrivateChannel(): Promise<FDC3v2.PrivateChannel | void>;
233
+ /**
234
+ * Retrieves a list of the User Channels available for the app to join.
235
+ * @returns { Promise<Channel[]>}
236
+ * @tutorial fdc3v2.getUserChannels
237
+ */
18
238
  getUserChannels(): Promise<Array<OpenFin.ContextGroupInfo>>;
239
+ /**
240
+ * Retrieves a list of the User Channels available for the app to join.
241
+ * @returns { Promise<Channel[]>}
242
+ * @deprecated Please use {@link fdc3.getUserChannels fdc3.getUserChannels} instead
243
+ * @tutorial fdc3.getSystemChannels
244
+ */
19
245
  getSystemChannels(): Promise<Array<OpenFin.ContextGroupInfo>>;
246
+ /**
247
+ * Join an app to a specified User channel.
248
+ * @param { string } channelId Channel name
249
+ * @returns { Promise<void> }
250
+ * @tutorial fdc3v2.joinUserChannel
251
+ */
20
252
  joinUserChannel(channelId: string): Promise<void>;
253
+ /**
254
+ * Join an app to a specified User channel.
255
+ * @param { string } channelId Channel name
256
+ * @deprecated Please use {@link fdc3.joinUserChannel fdc3.joinUserChannel} instead
257
+ * @returns { Promise<void> }
258
+ * @tutorial fdc3.joinChannel
259
+ */
260
+ joinChannel(channelId: string): Promise<void>;
261
+ /**
262
+ * Returns the Channel object for the current User channel membership
263
+ * @returns { Promise<FDC3.Channel | null> }
264
+ */
21
265
  getCurrentChannel(): Promise<FDC3.Channel | null>;
266
+ /**
267
+ * Removes the app from any User channel membership.
268
+ * @returns { Promise<void> }
269
+ * @tutorial fdc3.leaveCurrentChannel
270
+ */
22
271
  leaveCurrentChannel(): Promise<void>;
23
- getInfo(): Promise<FDC3.ImplementationMetadata>;
272
+ /**
273
+ * 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.
274
+ * @returns { Promise<ImplementationMetadata(2)> }
275
+ * @tutorial fdc3v2.getInfo
276
+ */
277
+ getInfo(): Promise<FDC3v2.ImplementationMetadata>;
24
278
  }