@openfin/core 45.100.79 → 45.100.83

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.
@@ -2885,7 +2885,7 @@ declare class ChannelProvider extends ChannelBase {
2885
2885
  * a read-only array containing all the identities of connecting clients.
2886
2886
  */
2887
2887
  get connections(): OpenFin_2.ClientConnectionPayload[];
2888
- static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
2888
+ static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
2889
2889
  static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
2890
2890
  /* Excluded from this release type: __constructor */
2891
2891
  /**
@@ -3281,6 +3281,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
3281
3281
  */
3282
3282
  declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
3283
3283
 
3284
+ declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
3285
+ endpointId?: string;
3286
+ };
3287
+
3284
3288
  /**
3285
3289
  * Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
3286
3290
  * @interface
@@ -4160,6 +4164,17 @@ declare type ContentCreationBehavior = 'window' | 'view' | 'block' | 'browser';
4160
4164
  */
4161
4165
  declare type ContentCreationBehaviorNames = ContentCreationBehavior;
4162
4166
 
4167
+ /**
4168
+ * Normalized disposition of a content creation request.
4169
+ * - `default` - The default browser behavior (replace/reuse current tab).
4170
+ * - `foreground-tab` - Loaded in a new foreground tab.
4171
+ * - `background-tab` - Loaded in a new background tab.
4172
+ * - `new-window` - Loaded in a new browser window.
4173
+ * - `popup` - Loaded in a popup window.
4174
+ * - `other` - Any other or unrecognized disposition.
4175
+ */
4176
+ declare type ContentCreationDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4177
+
4163
4178
  /**
4164
4179
  * Configures how new content (e,g, from `window.open` or a link) is opened.
4165
4180
  *
@@ -4222,7 +4237,7 @@ declare type ContentCreationRulesEvent = NamedEvent & {
4222
4237
  * - `popup` - The content is loaded in a popup window. This is the result of passing popup features to `window.open()`.
4223
4238
  * - `other` - The content is loaded in some other way.
4224
4239
  */
4225
- disposition: 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4240
+ disposition: OpenFin_2.ContentCreationDisposition;
4226
4241
  };
4227
4242
 
4228
4243
  /**
@@ -5621,13 +5636,23 @@ declare type ExtensionTabCreatedEvent = BaseEvent_5 & {
5621
5636
  type: 'extension-tab-created';
5622
5637
  /** Identity of the auto-created view backing the new tab. */
5623
5638
  viewIdentity: OpenFin_2.Identity;
5639
+ /**
5640
+ * Identity of the view that was active when the extension triggered tab creation.
5641
+ * Undefined if no tab was active (e.g. the first tab in a newly-opened window).
5642
+ */
5643
+ activeTabIdentity?: OpenFin_2.Identity;
5624
5644
  /** Initial URL the extension requested. */
5625
5645
  url: string;
5626
5646
  /**
5627
- * Raw Chromium disposition (`newForegroundTab`, `newBackgroundTab`,
5628
- * `newPopup`, `newWindow`, etc.). Informational in v1.
5647
+ * Normalized disposition of the tab creation request, aligned with `child-view-created`.
5648
+ * - `foreground-tab` new tab opened in the foreground
5649
+ * - `background-tab` — new tab opened in the background
5650
+ * - `popup` — new popup window
5651
+ * - `new-window` — new browser window
5652
+ * - `default` — replace/reuse current tab (`currentTab`, `singletonTab`)
5653
+ * - `other` — any other or unrecognized Chromium disposition
5629
5654
  */
5630
- disposition: string;
5655
+ disposition: OpenFin_2.ContentCreationDisposition;
5631
5656
  };
5632
5657
 
5633
5658
  /**
@@ -9353,6 +9378,9 @@ declare type Manifest = {
9353
9378
  progressBarFillColor?: number;
9354
9379
  textColor?: number;
9355
9380
  };
9381
+ experimentalExtensionPolicyBlockedHosts?: {
9382
+ hosts: string[];
9383
+ };
9356
9384
  licenseKey: string;
9357
9385
  offlineAccess?: boolean;
9358
9386
  platform?: PlatformOptions;
@@ -10646,6 +10674,7 @@ declare namespace OpenFin_2 {
10646
10674
  IntentMetadata,
10647
10675
  IntentHandler,
10648
10676
  ContentCreationBehavior,
10677
+ ContentCreationDisposition,
10649
10678
  ContentCreationBehaviorNames,
10650
10679
  MatchPattern,
10651
10680
  BaseContentCreationRule,
@@ -2885,7 +2885,7 @@ declare class ChannelProvider extends ChannelBase {
2885
2885
  * a read-only array containing all the identities of connecting clients.
2886
2886
  */
2887
2887
  get connections(): OpenFin_2.ClientConnectionPayload[];
2888
- static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
2888
+ static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
2889
2889
  static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
2890
2890
  /* Excluded from this release type: __constructor */
2891
2891
  /**
@@ -3281,6 +3281,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
3281
3281
  */
3282
3282
  declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
3283
3283
 
3284
+ declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
3285
+ endpointId?: string;
3286
+ };
3287
+
3284
3288
  /**
3285
3289
  * Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
3286
3290
  * @interface
@@ -4160,6 +4164,17 @@ declare type ContentCreationBehavior = 'window' | 'view' | 'block' | 'browser';
4160
4164
  */
4161
4165
  declare type ContentCreationBehaviorNames = ContentCreationBehavior;
4162
4166
 
4167
+ /**
4168
+ * Normalized disposition of a content creation request.
4169
+ * - `default` - The default browser behavior (replace/reuse current tab).
4170
+ * - `foreground-tab` - Loaded in a new foreground tab.
4171
+ * - `background-tab` - Loaded in a new background tab.
4172
+ * - `new-window` - Loaded in a new browser window.
4173
+ * - `popup` - Loaded in a popup window.
4174
+ * - `other` - Any other or unrecognized disposition.
4175
+ */
4176
+ declare type ContentCreationDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4177
+
4163
4178
  /**
4164
4179
  * Configures how new content (e,g, from `window.open` or a link) is opened.
4165
4180
  *
@@ -4222,7 +4237,7 @@ declare type ContentCreationRulesEvent = NamedEvent & {
4222
4237
  * - `popup` - The content is loaded in a popup window. This is the result of passing popup features to `window.open()`.
4223
4238
  * - `other` - The content is loaded in some other way.
4224
4239
  */
4225
- disposition: 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4240
+ disposition: OpenFin_2.ContentCreationDisposition;
4226
4241
  };
4227
4242
 
4228
4243
  /**
@@ -5621,13 +5636,23 @@ declare type ExtensionTabCreatedEvent = BaseEvent_5 & {
5621
5636
  type: 'extension-tab-created';
5622
5637
  /** Identity of the auto-created view backing the new tab. */
5623
5638
  viewIdentity: OpenFin_2.Identity;
5639
+ /**
5640
+ * Identity of the view that was active when the extension triggered tab creation.
5641
+ * Undefined if no tab was active (e.g. the first tab in a newly-opened window).
5642
+ */
5643
+ activeTabIdentity?: OpenFin_2.Identity;
5624
5644
  /** Initial URL the extension requested. */
5625
5645
  url: string;
5626
5646
  /**
5627
- * Raw Chromium disposition (`newForegroundTab`, `newBackgroundTab`,
5628
- * `newPopup`, `newWindow`, etc.). Informational in v1.
5647
+ * Normalized disposition of the tab creation request, aligned with `child-view-created`.
5648
+ * - `foreground-tab` new tab opened in the foreground
5649
+ * - `background-tab` — new tab opened in the background
5650
+ * - `popup` — new popup window
5651
+ * - `new-window` — new browser window
5652
+ * - `default` — replace/reuse current tab (`currentTab`, `singletonTab`)
5653
+ * - `other` — any other or unrecognized Chromium disposition
5629
5654
  */
5630
- disposition: string;
5655
+ disposition: OpenFin_2.ContentCreationDisposition;
5631
5656
  };
5632
5657
 
5633
5658
  /**
@@ -9353,6 +9378,9 @@ declare type Manifest = {
9353
9378
  progressBarFillColor?: number;
9354
9379
  textColor?: number;
9355
9380
  };
9381
+ experimentalExtensionPolicyBlockedHosts?: {
9382
+ hosts: string[];
9383
+ };
9356
9384
  licenseKey: string;
9357
9385
  offlineAccess?: boolean;
9358
9386
  platform?: PlatformOptions;
@@ -10646,6 +10674,7 @@ declare namespace OpenFin_2 {
10646
10674
  IntentMetadata,
10647
10675
  IntentHandler,
10648
10676
  ContentCreationBehavior,
10677
+ ContentCreationDisposition,
10649
10678
  ContentCreationBehaviorNames,
10650
10679
  MatchPattern,
10651
10680
  BaseContentCreationRule,
@@ -2885,7 +2885,7 @@ declare class ChannelProvider extends ChannelBase {
2885
2885
  * a read-only array containing all the identities of connecting clients.
2886
2886
  */
2887
2887
  get connections(): OpenFin_2.ClientConnectionPayload[];
2888
- static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
2888
+ static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
2889
2889
  static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
2890
2890
  /* Excluded from this release type: __constructor */
2891
2891
  /**
@@ -3281,6 +3281,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
3281
3281
  */
3282
3282
  declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
3283
3283
 
3284
+ declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
3285
+ endpointId?: string;
3286
+ };
3287
+
3284
3288
  /**
3285
3289
  * Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
3286
3290
  * @interface
@@ -4160,6 +4164,17 @@ declare type ContentCreationBehavior = 'window' | 'view' | 'block' | 'browser';
4160
4164
  */
4161
4165
  declare type ContentCreationBehaviorNames = ContentCreationBehavior;
4162
4166
 
4167
+ /**
4168
+ * Normalized disposition of a content creation request.
4169
+ * - `default` - The default browser behavior (replace/reuse current tab).
4170
+ * - `foreground-tab` - Loaded in a new foreground tab.
4171
+ * - `background-tab` - Loaded in a new background tab.
4172
+ * - `new-window` - Loaded in a new browser window.
4173
+ * - `popup` - Loaded in a popup window.
4174
+ * - `other` - Any other or unrecognized disposition.
4175
+ */
4176
+ declare type ContentCreationDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4177
+
4163
4178
  /**
4164
4179
  * Configures how new content (e,g, from `window.open` or a link) is opened.
4165
4180
  *
@@ -4222,7 +4237,7 @@ declare type ContentCreationRulesEvent = NamedEvent & {
4222
4237
  * - `popup` - The content is loaded in a popup window. This is the result of passing popup features to `window.open()`.
4223
4238
  * - `other` - The content is loaded in some other way.
4224
4239
  */
4225
- disposition: 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4240
+ disposition: OpenFin_2.ContentCreationDisposition;
4226
4241
  };
4227
4242
 
4228
4243
  /**
@@ -5621,13 +5636,23 @@ declare type ExtensionTabCreatedEvent = BaseEvent_5 & {
5621
5636
  type: 'extension-tab-created';
5622
5637
  /** Identity of the auto-created view backing the new tab. */
5623
5638
  viewIdentity: OpenFin_2.Identity;
5639
+ /**
5640
+ * Identity of the view that was active when the extension triggered tab creation.
5641
+ * Undefined if no tab was active (e.g. the first tab in a newly-opened window).
5642
+ */
5643
+ activeTabIdentity?: OpenFin_2.Identity;
5624
5644
  /** Initial URL the extension requested. */
5625
5645
  url: string;
5626
5646
  /**
5627
- * Raw Chromium disposition (`newForegroundTab`, `newBackgroundTab`,
5628
- * `newPopup`, `newWindow`, etc.). Informational in v1.
5647
+ * Normalized disposition of the tab creation request, aligned with `child-view-created`.
5648
+ * - `foreground-tab` new tab opened in the foreground
5649
+ * - `background-tab` — new tab opened in the background
5650
+ * - `popup` — new popup window
5651
+ * - `new-window` — new browser window
5652
+ * - `default` — replace/reuse current tab (`currentTab`, `singletonTab`)
5653
+ * - `other` — any other or unrecognized Chromium disposition
5629
5654
  */
5630
- disposition: string;
5655
+ disposition: OpenFin_2.ContentCreationDisposition;
5631
5656
  };
5632
5657
 
5633
5658
  /**
@@ -9353,6 +9378,9 @@ declare type Manifest = {
9353
9378
  progressBarFillColor?: number;
9354
9379
  textColor?: number;
9355
9380
  };
9381
+ experimentalExtensionPolicyBlockedHosts?: {
9382
+ hosts: string[];
9383
+ };
9356
9384
  licenseKey: string;
9357
9385
  offlineAccess?: boolean;
9358
9386
  platform?: PlatformOptions;
@@ -10646,6 +10674,7 @@ declare namespace OpenFin_2 {
10646
10674
  IntentMetadata,
10647
10675
  IntentHandler,
10648
10676
  ContentCreationBehavior,
10677
+ ContentCreationDisposition,
10649
10678
  ContentCreationBehaviorNames,
10650
10679
  MatchPattern,
10651
10680
  BaseContentCreationRule,
package/out/stub.d.ts CHANGED
@@ -2938,7 +2938,7 @@ declare class ChannelProvider extends ChannelBase {
2938
2938
  * a read-only array containing all the identities of connecting clients.
2939
2939
  */
2940
2940
  get connections(): OpenFin_2.ClientConnectionPayload[];
2941
- static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
2941
+ static handleClientDisconnection(channel: ChannelProvider, payload: ClientDisconnectionPayload): void;
2942
2942
  static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
2943
2943
  /**
2944
2944
  * @internal
@@ -3337,6 +3337,10 @@ declare type ClientChangedContextGroup = InteropClientEvent<'client-changed-cont
3337
3337
  */
3338
3338
  declare type ClientConnectionPayload = ClientIdentity & ClientInfo;
3339
3339
 
3340
+ declare type ClientDisconnectionPayload = OpenFin_2.Identity & {
3341
+ endpointId?: string;
3342
+ };
3343
+
3340
3344
  /**
3341
3345
  * Identity of a channel client. Includes endpointId to differentiate between different connections for an entity.
3342
3346
  * @interface
@@ -4219,6 +4223,17 @@ declare type ContentCreationBehavior = 'window' | 'view' | 'block' | 'browser';
4219
4223
  */
4220
4224
  declare type ContentCreationBehaviorNames = ContentCreationBehavior;
4221
4225
 
4226
+ /**
4227
+ * Normalized disposition of a content creation request.
4228
+ * - `default` - The default browser behavior (replace/reuse current tab).
4229
+ * - `foreground-tab` - Loaded in a new foreground tab.
4230
+ * - `background-tab` - Loaded in a new background tab.
4231
+ * - `new-window` - Loaded in a new browser window.
4232
+ * - `popup` - Loaded in a popup window.
4233
+ * - `other` - Any other or unrecognized disposition.
4234
+ */
4235
+ declare type ContentCreationDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4236
+
4222
4237
  /**
4223
4238
  * Configures how new content (e,g, from `window.open` or a link) is opened.
4224
4239
  *
@@ -4281,7 +4296,7 @@ declare type ContentCreationRulesEvent = NamedEvent & {
4281
4296
  * - `popup` - The content is loaded in a popup window. This is the result of passing popup features to `window.open()`.
4282
4297
  * - `other` - The content is loaded in some other way.
4283
4298
  */
4284
- disposition: 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'popup' | 'other';
4299
+ disposition: OpenFin_2.ContentCreationDisposition;
4285
4300
  };
4286
4301
 
4287
4302
  /**
@@ -5703,13 +5718,23 @@ declare type ExtensionTabCreatedEvent = BaseEvent_5 & {
5703
5718
  type: 'extension-tab-created';
5704
5719
  /** Identity of the auto-created view backing the new tab. */
5705
5720
  viewIdentity: OpenFin_2.Identity;
5721
+ /**
5722
+ * Identity of the view that was active when the extension triggered tab creation.
5723
+ * Undefined if no tab was active (e.g. the first tab in a newly-opened window).
5724
+ */
5725
+ activeTabIdentity?: OpenFin_2.Identity;
5706
5726
  /** Initial URL the extension requested. */
5707
5727
  url: string;
5708
5728
  /**
5709
- * Raw Chromium disposition (`newForegroundTab`, `newBackgroundTab`,
5710
- * `newPopup`, `newWindow`, etc.). Informational in v1.
5729
+ * Normalized disposition of the tab creation request, aligned with `child-view-created`.
5730
+ * - `foreground-tab` new tab opened in the foreground
5731
+ * - `background-tab` — new tab opened in the background
5732
+ * - `popup` — new popup window
5733
+ * - `new-window` — new browser window
5734
+ * - `default` — replace/reuse current tab (`currentTab`, `singletonTab`)
5735
+ * - `other` — any other or unrecognized Chromium disposition
5711
5736
  */
5712
- disposition: string;
5737
+ disposition: OpenFin_2.ContentCreationDisposition;
5713
5738
  };
5714
5739
 
5715
5740
  /**
@@ -9662,6 +9687,9 @@ declare type Manifest = {
9662
9687
  progressBarFillColor?: number;
9663
9688
  textColor?: number;
9664
9689
  };
9690
+ experimentalExtensionPolicyBlockedHosts?: {
9691
+ hosts: string[];
9692
+ };
9665
9693
  licenseKey: string;
9666
9694
  offlineAccess?: boolean;
9667
9695
  platform?: PlatformOptions;
@@ -10980,6 +11008,7 @@ declare namespace OpenFin_2 {
10980
11008
  IntentMetadata,
10981
11009
  IntentHandler,
10982
11010
  ContentCreationBehavior,
11011
+ ContentCreationDisposition,
10983
11012
  ContentCreationBehaviorNames,
10984
11013
  MatchPattern,
10985
11014
  BaseContentCreationRule,
package/out/stub.js CHANGED
@@ -8314,9 +8314,8 @@ class ChannelProvider extends ChannelBase {
8314
8314
  return [...__classPrivateFieldGet$g(this, _ChannelProvider_connections, "f")];
8315
8315
  }
8316
8316
  static handleClientDisconnection(channel, payload) {
8317
- if (payload?.endpointId) {
8318
- const { uuid, name, endpointId, isLocalEndpointId } = payload;
8319
- __classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
8317
+ if (payload.endpointId) {
8318
+ __classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
8320
8319
  }
8321
8320
  else {
8322
8321
  // this is here to support older runtimes that did not have endpointId
@@ -8486,7 +8485,9 @@ class ChannelProvider extends ChannelBase {
8486
8485
  * ```
8487
8486
  */
8488
8487
  onDisconnection(listener) {
8489
- this.disconnectListener = listener;
8488
+ this.disconnectListener = (identity) => {
8489
+ listener(identity);
8490
+ };
8490
8491
  }
8491
8492
  /**
8492
8493
  * Destroy the channel, raises `disconnected` events on all connected channel clients.
@@ -8503,7 +8504,6 @@ class ChannelProvider extends ChannelBase {
8503
8504
  */
8504
8505
  async destroy() {
8505
8506
  const protectedObj = __classPrivateFieldGet$g(this, _ChannelProvider_protectedObj, "f");
8506
- protectedObj.providerIdentity;
8507
8507
  __classPrivateFieldSet$f(this, _ChannelProvider_connections, [], "f");
8508
8508
  await protectedObj.close();
8509
8509
  __classPrivateFieldGet$g(this, _ChannelProvider_close, "f").call(this);
@@ -8800,6 +8800,13 @@ class ConnectionManager extends Base {
8800
8800
  _ConnectionManager_messageReceiver.set(this, void 0);
8801
8801
  _ConnectionManager_rtcConnectionManager.set(this, void 0);
8802
8802
  this.removeChannelFromProviderMap = (channelId) => {
8803
+ const providerEntry = this.providerMap.get(channelId);
8804
+ if (providerEntry) {
8805
+ const { channelName } = providerEntry.providerIdentity;
8806
+ if (this.providerChannelIdByName.get(channelName) === channelId) {
8807
+ this.providerChannelIdByName.delete(channelName);
8808
+ }
8809
+ }
8803
8810
  this.providerMap.delete(channelId);
8804
8811
  };
8805
8812
  this.onmessage = (msg) => {
@@ -8810,6 +8817,7 @@ class ConnectionManager extends Base {
8810
8817
  return false;
8811
8818
  };
8812
8819
  this.providerMap = new Map();
8820
+ this.providerChannelIdByName = new Map();
8813
8821
  this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
8814
8822
  __classPrivateFieldSet$e(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
8815
8823
  __classPrivateFieldSet$e(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
@@ -8846,10 +8854,12 @@ class ConnectionManager extends Base {
8846
8854
  const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
8847
8855
  const key = providerIdentity.channelId;
8848
8856
  this.providerMap.set(key, {
8857
+ providerIdentity,
8849
8858
  provider: channel,
8850
8859
  strategy,
8851
8860
  supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
8852
8861
  });
8862
+ this.providerChannelIdByName.set(providerIdentity.channelName, key);
8853
8863
  ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
8854
8864
  return channel;
8855
8865
  }
@@ -8924,6 +8934,16 @@ class ConnectionManager extends Base {
8924
8934
  strategy.addEndpoint(routingInfo.channelId, endpointPayload);
8925
8935
  return strategy;
8926
8936
  }
8937
+ handleClientDisconnection(eventPayload) {
8938
+ const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
8939
+ if (!channelId) {
8940
+ return;
8941
+ }
8942
+ const providerEntry = this.providerMap.get(channelId);
8943
+ if (providerEntry) {
8944
+ ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
8945
+ }
8946
+ }
8927
8947
  async processChannelConnection(msg) {
8928
8948
  const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
8929
8949
  if (!clientIdentity.endpointId) {
@@ -9023,7 +9043,7 @@ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) |
9023
9043
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9024
9044
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9025
9045
  };
9026
- var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
9046
+ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
9027
9047
  function retryDelay(count) {
9028
9048
  const interval = 500; // base delay
9029
9049
  const steps = 10; // How many retries to do before incrementing the delay
@@ -9059,9 +9079,19 @@ class Channel extends EmitterBase {
9059
9079
  super(wire, 'channel');
9060
9080
  _Channel_connectionManager.set(this, void 0);
9061
9081
  _Channel_internalEmitter.set(this, new events.EventEmitter());
9082
+ // Provider-side disconnect routing setup. This must exist before first create()
9083
+ // so provider onDisconnection callbacks are wired even if connect() is never called.
9084
+ _Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
9085
+ // TODO: fix typing (internal)
9086
+ // @ts-expect-error
9087
+ await this.on('client-disconnected', (eventPayload) => {
9088
+ __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
9089
+ });
9090
+ }));
9062
9091
  // OpenFin API has not been injected at construction time, *must* wait for API to be ready.
9063
9092
  _Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
9064
9093
  await Promise.all([
9094
+ __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue(),
9065
9095
  this.on('disconnected', (eventPayload) => {
9066
9096
  ChannelClient.handleProviderDisconnect(eventPayload);
9067
9097
  }),
@@ -9318,22 +9348,15 @@ class Channel extends EmitterBase {
9318
9348
  * ```
9319
9349
  */
9320
9350
  async create(channelName, options) {
9351
+ await __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue();
9321
9352
  if (!channelName) {
9322
9353
  throw new Error('Please provide a channelName to create a channel');
9323
9354
  }
9324
9355
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
9325
- const channel = __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9326
- // TODO: fix typing (internal)
9327
- // @ts-expect-error
9328
- this.on('client-disconnected', (eventPayload) => {
9329
- if (eventPayload.channelName === channelName) {
9330
- ChannelProvider.handleClientDisconnection(channel, eventPayload);
9331
- }
9332
- });
9333
- return channel;
9356
+ return __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9334
9357
  }
9335
9358
  }
9336
- _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
9359
+ _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
9337
9360
 
9338
9361
  /**
9339
9362
  * Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
package/out/stub.mjs CHANGED
@@ -8310,9 +8310,8 @@ class ChannelProvider extends ChannelBase {
8310
8310
  return [...__classPrivateFieldGet$g(this, _ChannelProvider_connections, "f")];
8311
8311
  }
8312
8312
  static handleClientDisconnection(channel, payload) {
8313
- if (payload?.endpointId) {
8314
- const { uuid, name, endpointId, isLocalEndpointId } = payload;
8315
- __classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
8313
+ if (payload.endpointId) {
8314
+ __classPrivateFieldGet$g(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
8316
8315
  }
8317
8316
  else {
8318
8317
  // this is here to support older runtimes that did not have endpointId
@@ -8482,7 +8481,9 @@ class ChannelProvider extends ChannelBase {
8482
8481
  * ```
8483
8482
  */
8484
8483
  onDisconnection(listener) {
8485
- this.disconnectListener = listener;
8484
+ this.disconnectListener = (identity) => {
8485
+ listener(identity);
8486
+ };
8486
8487
  }
8487
8488
  /**
8488
8489
  * Destroy the channel, raises `disconnected` events on all connected channel clients.
@@ -8499,7 +8500,6 @@ class ChannelProvider extends ChannelBase {
8499
8500
  */
8500
8501
  async destroy() {
8501
8502
  const protectedObj = __classPrivateFieldGet$g(this, _ChannelProvider_protectedObj, "f");
8502
- protectedObj.providerIdentity;
8503
8503
  __classPrivateFieldSet$f(this, _ChannelProvider_connections, [], "f");
8504
8504
  await protectedObj.close();
8505
8505
  __classPrivateFieldGet$g(this, _ChannelProvider_close, "f").call(this);
@@ -8796,6 +8796,13 @@ class ConnectionManager extends Base {
8796
8796
  _ConnectionManager_messageReceiver.set(this, void 0);
8797
8797
  _ConnectionManager_rtcConnectionManager.set(this, void 0);
8798
8798
  this.removeChannelFromProviderMap = (channelId) => {
8799
+ const providerEntry = this.providerMap.get(channelId);
8800
+ if (providerEntry) {
8801
+ const { channelName } = providerEntry.providerIdentity;
8802
+ if (this.providerChannelIdByName.get(channelName) === channelId) {
8803
+ this.providerChannelIdByName.delete(channelName);
8804
+ }
8805
+ }
8799
8806
  this.providerMap.delete(channelId);
8800
8807
  };
8801
8808
  this.onmessage = (msg) => {
@@ -8806,6 +8813,7 @@ class ConnectionManager extends Base {
8806
8813
  return false;
8807
8814
  };
8808
8815
  this.providerMap = new Map();
8816
+ this.providerChannelIdByName = new Map();
8809
8817
  this.protocolManager = new ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
8810
8818
  __classPrivateFieldSet$e(this, _ConnectionManager_messageReceiver, new MessageReceiver(wire), "f");
8811
8819
  __classPrivateFieldSet$e(this, _ConnectionManager_rtcConnectionManager, new RTCICEManager(wire), "f");
@@ -8842,10 +8850,12 @@ class ConnectionManager extends Base {
8842
8850
  const channel = new ChannelProvider(providerIdentity, () => ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
8843
8851
  const key = providerIdentity.channelId;
8844
8852
  this.providerMap.set(key, {
8853
+ providerIdentity,
8845
8854
  provider: channel,
8846
8855
  strategy,
8847
8856
  supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
8848
8857
  });
8858
+ this.providerChannelIdByName.set(providerIdentity.channelName, key);
8849
8859
  ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
8850
8860
  return channel;
8851
8861
  }
@@ -8920,6 +8930,16 @@ class ConnectionManager extends Base {
8920
8930
  strategy.addEndpoint(routingInfo.channelId, endpointPayload);
8921
8931
  return strategy;
8922
8932
  }
8933
+ handleClientDisconnection(eventPayload) {
8934
+ const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
8935
+ if (!channelId) {
8936
+ return;
8937
+ }
8938
+ const providerEntry = this.providerMap.get(channelId);
8939
+ if (providerEntry) {
8940
+ ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
8941
+ }
8942
+ }
8923
8943
  async processChannelConnection(msg) {
8924
8944
  const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
8925
8945
  if (!clientIdentity.endpointId) {
@@ -9019,7 +9039,7 @@ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) |
9019
9039
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9020
9040
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9021
9041
  };
9022
- var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
9042
+ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
9023
9043
  function retryDelay(count) {
9024
9044
  const interval = 500; // base delay
9025
9045
  const steps = 10; // How many retries to do before incrementing the delay
@@ -9055,9 +9075,19 @@ class Channel extends EmitterBase {
9055
9075
  super(wire, 'channel');
9056
9076
  _Channel_connectionManager.set(this, void 0);
9057
9077
  _Channel_internalEmitter.set(this, new EventEmitter());
9078
+ // Provider-side disconnect routing setup. This must exist before first create()
9079
+ // so provider onDisconnection callbacks are wired even if connect() is never called.
9080
+ _Channel_readyForProvider.set(this, new AsyncRetryableLazy(async () => {
9081
+ // TODO: fix typing (internal)
9082
+ // @ts-expect-error
9083
+ await this.on('client-disconnected', (eventPayload) => {
9084
+ __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
9085
+ });
9086
+ }));
9058
9087
  // OpenFin API has not been injected at construction time, *must* wait for API to be ready.
9059
9088
  _Channel_readyToConnect.set(this, new AsyncRetryableLazy(async () => {
9060
9089
  await Promise.all([
9090
+ __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue(),
9061
9091
  this.on('disconnected', (eventPayload) => {
9062
9092
  ChannelClient.handleProviderDisconnect(eventPayload);
9063
9093
  }),
@@ -9314,22 +9344,15 @@ class Channel extends EmitterBase {
9314
9344
  * ```
9315
9345
  */
9316
9346
  async create(channelName, options) {
9347
+ await __classPrivateFieldGet$e(this, _Channel_readyForProvider, "f").getValue();
9317
9348
  if (!channelName) {
9318
9349
  throw new Error('Please provide a channelName to create a channel');
9319
9350
  }
9320
9351
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
9321
- const channel = __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9322
- // TODO: fix typing (internal)
9323
- // @ts-expect-error
9324
- this.on('client-disconnected', (eventPayload) => {
9325
- if (eventPayload.channelName === channelName) {
9326
- ChannelProvider.handleClientDisconnection(channel, eventPayload);
9327
- }
9328
- });
9329
- return channel;
9352
+ return __classPrivateFieldGet$e(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9330
9353
  }
9331
9354
  }
9332
- _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
9355
+ _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
9333
9356
 
9334
9357
  /**
9335
9358
  * Entry point for the OpenFin `InterApplicationBus` API (`fin.InterApplicationBus`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "45.100.79",
3
+ "version": "45.100.83",
4
4
  "description": "The core renderer entry point of OpenFin",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "out/stub.js",