@openfin/core 29.73.11 → 29.73.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/OpenFin.d.ts CHANGED
@@ -134,6 +134,7 @@ declare namespace OpenFin {
134
134
  | 'alwaysOnTop'
135
135
  | 'api'
136
136
  | 'aspectRatio'
137
+ | 'autoplayPolicy'
137
138
  | 'autoShow'
138
139
  | 'backgroundColor'
139
140
  | 'contentNavigation'
@@ -273,10 +274,16 @@ declare namespace OpenFin {
273
274
 
274
275
  export type WindowState = 'maximized' | 'minimized' | 'normal';
275
276
 
277
+ export type AutoplayPolicyOptions =
278
+ | 'no-user-gesture-required'
279
+ | 'user-gesture-required'
280
+ | 'document-user-activation-required';
281
+
276
282
  export type ConstWindowOptions = {
277
283
  accelerator: Partial<Accelerator>;
278
284
  api: Api;
279
285
  applicationIcon: string;
286
+ autoplayPolicy: AutoplayPolicyOptions;
280
287
  autoShow: boolean;
281
288
  backgroundColor: string;
282
289
  contentCreation: ContentCreationOptions;
@@ -528,6 +535,7 @@ declare namespace OpenFin {
528
535
  fdc3InteropApi?: string;
529
536
  enableBeforeUnload: boolean;
530
537
  accelerator?: Partial<OpenFin.Accelerator>;
538
+ autoplayPolicy: AutoplayPolicyOptions;
531
539
  };
532
540
 
533
541
  export type ViewState = ViewCreationOptions & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "29.73.11",
3
+ "version": "29.73.13",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
@@ -11,12 +11,13 @@ export default class ChannelClient extends ChannelBase {
11
11
  private disconnectListener;
12
12
  private endpointId;
13
13
  static closeChannelByEndpointId(id: string): void;
14
- static handleProviderDisconnect(channel: ChannelClient, eventPayload: ProviderIdentity): void;
14
+ static handleProviderDisconnect(eventPayload: ProviderIdentity): void;
15
15
  constructor(routingInfo: RoutingInfo, wire: Transport, strategy: AnyStrategy);
16
16
  protected processAction: (action: string, payload: any, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity) => Promise<any>;
17
17
  get providerIdentity(): ProviderIdentity;
18
18
  dispatch(action: string, payload?: any): Promise<any>;
19
19
  onDisconnection(listener: DisconnectionListener): void;
20
20
  disconnect(): Promise<void>;
21
+ sendDisconnectAction(): Promise<void>;
21
22
  }
22
23
  export {};
@@ -38,10 +38,14 @@ class ChannelClient extends channel_1.ChannelBase {
38
38
  __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
39
39
  }
40
40
  }
41
- // closes the channel and invokes the disconnect listener if an event payload is passed.
42
- static handleProviderDisconnect(channel, eventPayload) {
43
- channel.disconnectListener(eventPayload);
44
- __classPrivateFieldGet(channel, _ChannelClient_close, "f").call(channel);
41
+ // closes the corresponding channel and invokes the disconnect listener if an event payload is passed.
42
+ static handleProviderDisconnect(eventPayload) {
43
+ for (const channelClient of channelClientsByEndpointId.values()) {
44
+ if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
45
+ channelClient.disconnectListener(eventPayload);
46
+ __classPrivateFieldGet(channelClient, _ChannelClient_close, "f").call(channelClient);
47
+ }
48
+ }
45
49
  }
46
50
  get providerIdentity() {
47
51
  const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
@@ -67,6 +71,10 @@ class ChannelClient extends channel_1.ChannelBase {
67
71
  };
68
72
  }
69
73
  async disconnect() {
74
+ await this.sendDisconnectAction();
75
+ __classPrivateFieldGet(this, _ChannelClient_close, "f").call(this);
76
+ }
77
+ async sendDisconnectAction() {
70
78
  const protectedObj = __classPrivateFieldGet(this, _ChannelClient_protectedObj, "f");
71
79
  const { channelName, uuid, name } = protectedObj.providerIdentity;
72
80
  await protectedObj.wire.sendAction('disconnect-from-channel', {
@@ -75,7 +83,6 @@ class ChannelClient extends channel_1.ChannelBase {
75
83
  name,
76
84
  endpointId: this.endpointId
77
85
  });
78
- __classPrivateFieldGet(this, _ChannelClient_close, "f").call(this);
79
86
  }
80
87
  }
81
88
  exports.default = ChannelClient;
@@ -25,6 +25,9 @@ class Channel extends base_1.EmitterBase {
25
25
  super(wire, 'channel');
26
26
  _Channel_connectionManager.set(this, void 0);
27
27
  __classPrivateFieldSet(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
28
+ this.on('disconnected', (eventPayload) => {
29
+ client_1.default.handleProviderDisconnect(eventPayload);
30
+ }).catch((e) => console.error('Error setting up a disconnected listener:', e));
28
31
  }
29
32
  async getAllChannels() {
30
33
  return this.wire.sendAction('get-all-channels').then(({ payload }) => payload.data);
@@ -82,18 +85,13 @@ class Channel extends base_1.EmitterBase {
82
85
  // The provider does not care about endpoint disconnection.
83
86
  strategy.onEndpointDisconnect(routingInfo.channelId, async () => {
84
87
  try {
85
- await channel.disconnect();
88
+ await channel.sendDisconnectAction();
86
89
  }
87
90
  catch (error) {
88
91
  console.warn(`Something went wrong during disconnect for client with uuid: ${routingInfo.uuid} / name: ${routingInfo.name} / endpointId: ${routingInfo.endpointId}.`);
89
92
  }
90
93
  finally {
91
- client_1.default.handleProviderDisconnect(channel, routingInfo);
92
- }
93
- });
94
- this.on('disconnected', (eventPayload) => {
95
- if (eventPayload.channelName === channelName) {
96
- client_1.default.handleProviderDisconnect(channel, eventPayload);
94
+ client_1.default.handleProviderDisconnect(routingInfo);
97
95
  }
98
96
  });
99
97
  return channel;
@@ -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(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
  }
@@ -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(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(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(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.
@@ -455,11 +455,11 @@ export declare class View extends WebContents<ViewEvents> {
455
455
  * **NOTE**: Internal use only.
456
456
  * Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
457
457
  *
458
- * @param { string } elementId - id of the HTML element to attach the view to.
458
+ * @param {HTMLElement} element - HTML element to attach the view to.
459
459
  * @return {Function} - Cleanup function that will disconnect the element resize observer.
460
460
  * @internal
461
461
  * @experimental
462
462
  * @tutorial View.bindToElement
463
463
  */
464
- bindToElement: (elementId: string) => Promise<() => void>;
464
+ bindToElement: (element: HTMLElement) => Promise<() => void>;
465
465
  }
@@ -460,16 +460,15 @@ class View extends main_1.WebContents {
460
460
  * **NOTE**: Internal use only.
461
461
  * Attaches this view to an HTML element in the current context. The view will resize responsively when the element bounds change.
462
462
  *
463
- * @param { string } elementId - id of the HTML element to attach the view to.
463
+ * @param {HTMLElement} element - HTML element to attach the view to.
464
464
  * @return {Function} - Cleanup function that will disconnect the element resize observer.
465
465
  * @internal
466
466
  * @experimental
467
467
  * @tutorial View.bindToElement
468
468
  */
469
- this.bindToElement = async (elementId) => {
470
- const element = document.getElementById(elementId);
469
+ this.bindToElement = async (element) => {
471
470
  if (!element) {
472
- throw new Error(`Element matching id: ${elementId} not found.`);
471
+ throw new Error('Element not found.');
473
472
  }
474
473
  const onChange = async (bounds) => this.setBounds(bounds);
475
474
  return (0, bounds_observer_1.observeBounds)(element, onChange);