@openfin/node-adapter 41.103.3 → 41.103.10

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.
@@ -44,35 +44,6 @@ var system = {};
44
44
 
45
45
  var base = {};
46
46
 
47
- var promises = {};
48
-
49
- Object.defineProperty(promises, "__esModule", { value: true });
50
- promises.promiseMapSerial = promises.serial = promiseMap_1 = promises.promiseMap = promisify_1 = promises.promisify = void 0;
51
- function promisify(func) {
52
- return (...args) => new Promise((resolve, reject) => {
53
- func(...args, (err, val) => (err ? reject(err) : resolve(val)));
54
- });
55
- }
56
- var promisify_1 = promises.promisify = promisify;
57
- async function promiseMap(arr, asyncF) {
58
- return Promise.all(arr.map(asyncF));
59
- }
60
- var promiseMap_1 = promises.promiseMap = promiseMap;
61
- async function serial(arr) {
62
- const ret = [];
63
- for (const func of arr) {
64
- // eslint-disable-next-line no-await-in-loop
65
- const next = await func();
66
- ret.push(next);
67
- }
68
- return ret;
69
- }
70
- promises.serial = serial;
71
- async function promiseMapSerial(arr, func) {
72
- return serial(arr.map((value, index, array) => () => func(value, index, array)));
73
- }
74
- promises.promiseMapSerial = promiseMapSerial;
75
-
76
47
  var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
77
48
  if (kind === "m") throw new TypeError("Private method is not writable");
78
49
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -87,7 +58,6 @@ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateF
87
58
  var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
88
59
  Object.defineProperty(base, "__esModule", { value: true });
89
60
  base.Reply = base.EmitterBase = base.Base = void 0;
90
- const promises_1 = promises;
91
61
  class Base {
92
62
  /**
93
63
  * @internal
@@ -165,27 +135,8 @@ class EmitterBase extends Base {
165
135
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
166
136
  };
167
137
  this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
168
- /**
169
- * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
170
- * `once` subscription.
171
- *
172
- * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
173
- * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
174
- * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
175
- */
176
- this.cleanUpRemovedListener = (eventType, listener) => {
177
- const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
178
- if (deregister) {
179
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
180
- emitter.removeListener(eventType, deregister);
181
- }
182
- };
183
138
  this.getOrCreateEmitter = () => {
184
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
185
- if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
186
- emitter.on('removeListener', this.cleanUpRemovedListener);
187
- }
188
- return emitter;
139
+ return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
189
140
  };
190
141
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
191
142
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
@@ -225,7 +176,6 @@ class EmitterBase extends Base {
225
176
  };
226
177
  __classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
227
178
  __classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
228
- this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
229
179
  }
230
180
  /**
231
181
  * Adds a listener to the end of the listeners array for the specified event.
@@ -303,6 +253,10 @@ class EmitterBase extends Base {
303
253
  const emitter = await this.deregisterEventListener(eventType, options);
304
254
  if (emitter) {
305
255
  emitter.removeListener(eventType, listener);
256
+ const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
257
+ if (deregister) {
258
+ emitter.removeListener(eventType, deregister);
259
+ }
306
260
  this.deleteEmitterIfNothingRegistered(emitter);
307
261
  }
308
262
  return this;
@@ -338,12 +292,13 @@ class EmitterBase extends Base {
338
292
  }
339
293
  else if (this.hasEmitter()) {
340
294
  const events = this.getOrCreateEmitter().eventNames();
341
- await (0, promises_1.promiseMap)(events, removeByEvent);
295
+ await Promise.all(events.map(removeByEvent));
342
296
  }
343
297
  return this;
344
298
  }
345
299
  deleteEmitterIfNothingRegistered(emitter) {
346
- if (emitter.eventNames().every((type) => type === 'removeListener')) {
300
+ // TODO: maybe emitterMap should clean up itself..
301
+ if (emitter.eventNames().length === 0) {
347
302
  this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
348
303
  }
349
304
  }
@@ -652,9 +607,7 @@ function requireFactory$2 () {
652
607
  * @experimental
653
608
  */
654
609
  async wrap(identity) {
655
- this.wire.sendAction('view-wrap').catch((e) => {
656
- // we do not want to expose this error, just continue if this analytics-only call fails
657
- });
610
+ this.wire.recordAnalytic('view-wrap');
658
611
  const errorMsg = (0, validate_1.validateIdentity)(identity);
659
612
  if (errorMsg) {
660
613
  throw new Error(errorMsg);
@@ -676,9 +629,7 @@ function requireFactory$2 () {
676
629
  * @experimental
677
630
  */
678
631
  wrapSync(identity) {
679
- this.wire.sendAction('view-wrap-sync').catch((e) => {
680
- // we do not want to expose this error, just continue if this analytics-only call fails
681
- });
632
+ this.wire.recordAnalytic('view-wrap-sync');
682
633
  const errorMsg = (0, validate_1.validateIdentity)(identity);
683
634
  if (errorMsg) {
684
635
  throw new Error(errorMsg);
@@ -698,9 +649,7 @@ function requireFactory$2 () {
698
649
  * @experimental
699
650
  */
700
651
  getCurrent() {
701
- this.wire.sendAction('view-get-current').catch((e) => {
702
- // we do not want to expose this error, just continue if this analytics-only call fails
703
- });
652
+ this.wire.recordAnalytic('view-get-current');
704
653
  if (!this.wire.me.isView) {
705
654
  throw new Error('You are not in a View context');
706
655
  }
@@ -719,9 +668,7 @@ function requireFactory$2 () {
719
668
  * @experimental
720
669
  */
721
670
  getCurrentSync() {
722
- this.wire.sendAction('view-get-current-sync').catch((e) => {
723
- // we do not want to expose this error, just continue if this analytics-only call fails
724
- });
671
+ this.wire.recordAnalytic('view-get-current-sync');
725
672
  if (!this.wire.me.isView) {
726
673
  throw new Error('You are not in a View context');
727
674
  }
@@ -1789,9 +1736,7 @@ class WebContents extends base_1$m.EmitterBase {
1789
1736
  * {@link OpenFin.WebContentsEvents event namespace}.
1790
1737
  */
1791
1738
  async showPopupWindow(options) {
1792
- this.wire.sendAction(`${this.entityType}-show-popup-window`, this.identity).catch(() => {
1793
- // we do not want to expose this error, just continue if this analytics-only call fails
1794
- });
1739
+ this.wire.recordAnalytic(`${this.entityType}-show-popup-window`);
1795
1740
  if (options?.onPopupReady) {
1796
1741
  const readyListener = async ({ popupName }) => {
1797
1742
  try {
@@ -2217,9 +2162,7 @@ function requireInstance$2 () {
2217
2162
  * @experimental
2218
2163
  */
2219
2164
  this.getParentLayout = async () => {
2220
- this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
2221
- // don't expose
2222
- });
2165
+ this.wire.recordAnalytic('view-get-parent-layout');
2223
2166
  return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
2224
2167
  };
2225
2168
  /**
@@ -2332,9 +2275,7 @@ function requireInstance$2 () {
2332
2275
  * ```
2333
2276
  */
2334
2277
  this.getCurrentStack = async () => {
2335
- this.wire.sendAction('view-get-current-stack').catch(() => {
2336
- // don't expose
2337
- });
2278
+ this.wire.recordAnalytic('view-get-current-stack');
2338
2279
  try {
2339
2280
  const layout = await this.getParentLayout();
2340
2281
  return layout.getStackByViewIdentity(this.identity);
@@ -2580,9 +2521,7 @@ function requireInstance$1 () {
2580
2521
  */
2581
2522
  close(force = false) {
2582
2523
  console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2583
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2584
- // we do not want to expose this error, just continue if this analytics-only call fails
2585
- });
2524
+ this.wire.recordAnalytic('application-close');
2586
2525
  return this._close(force);
2587
2526
  }
2588
2527
  /**
@@ -2723,9 +2662,7 @@ function requireInstance$1 () {
2723
2662
  * ```
2724
2663
  */
2725
2664
  getWindow() {
2726
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2727
- // we do not want to expose this error, just continue if this analytics-only call fails
2728
- });
2665
+ this.wire.recordAnalytic('application-get-window');
2729
2666
  return Promise.resolve(this.window);
2730
2667
  }
2731
2668
  /**
@@ -2803,9 +2740,7 @@ function requireInstance$1 () {
2803
2740
  */
2804
2741
  run() {
2805
2742
  console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2806
- this.wire.sendAction('application-run', this.identity).catch((e) => {
2807
- // we do not want to expose this error, just continue if this analytics-only call fails
2808
- });
2743
+ this.wire.recordAnalytic('application-run');
2809
2744
  return this._run();
2810
2745
  }
2811
2746
  _run(opts = {}) {
@@ -3330,9 +3265,7 @@ function requireFactory$1 () {
3330
3265
  *
3331
3266
  */
3332
3267
  async wrap(identity) {
3333
- this.wire.sendAction('wrap-application').catch((e) => {
3334
- // we do not want to expose this error, just continue if this analytics-only call fails
3335
- });
3268
+ this.wire.recordAnalytic('wrap-application');
3336
3269
  const errorMsg = (0, validate_1.validateIdentity)(identity);
3337
3270
  if (errorMsg) {
3338
3271
  throw new Error(errorMsg);
@@ -3355,9 +3288,7 @@ function requireFactory$1 () {
3355
3288
  *
3356
3289
  */
3357
3290
  wrapSync(identity) {
3358
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3359
- // we do not want to expose this error, just continue if this analytics-only call fails
3360
- });
3291
+ this.wire.recordAnalytic('wrap-application-sync');
3361
3292
  const errorMsg = (0, validate_1.validateIdentity)(identity);
3362
3293
  if (errorMsg) {
3363
3294
  throw new Error(errorMsg);
@@ -3398,9 +3329,7 @@ function requireFactory$1 () {
3398
3329
  */
3399
3330
  create(appOptions) {
3400
3331
  console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3401
- this.wire.sendAction('application-create').catch((e) => {
3402
- // we do not want to expose this error, just continue if this analytics-only call fails
3403
- });
3332
+ this.wire.recordAnalytic('application-create');
3404
3333
  return this._create(appOptions);
3405
3334
  }
3406
3335
  /**
@@ -3422,9 +3351,7 @@ function requireFactory$1 () {
3422
3351
  *
3423
3352
  */
3424
3353
  async start(appOptions) {
3425
- this.wire.sendAction('start-application').catch((e) => {
3426
- // we do not want to expose this error, just continue if this analytics-only call fails
3427
- });
3354
+ this.wire.recordAnalytic('start-application');
3428
3355
  const app = await this._create(appOptions);
3429
3356
  await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3430
3357
  return app;
@@ -3487,9 +3414,7 @@ function requireFactory$1 () {
3487
3414
  * ```
3488
3415
  */
3489
3416
  getCurrent() {
3490
- this.wire.sendAction('get-current-application').catch((e) => {
3491
- // we do not want to expose this error, just continue if this analytics-only call fails
3492
- });
3417
+ this.wire.recordAnalytic('get-current-application');
3493
3418
  return this.wrap({ uuid: this.wire.me.uuid });
3494
3419
  }
3495
3420
  /**
@@ -3512,9 +3437,7 @@ function requireFactory$1 () {
3512
3437
  * ```
3513
3438
  */
3514
3439
  getCurrentSync() {
3515
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3516
- // we do not want to expose this error, just continue if this analytics-only call fails
3517
- });
3440
+ this.wire.recordAnalytic('get-current-application-sync');
3518
3441
  return this.wrapSync({ uuid: this.wire.me.uuid });
3519
3442
  }
3520
3443
  /**
@@ -3532,9 +3455,7 @@ function requireFactory$1 () {
3532
3455
  * ```
3533
3456
  */
3534
3457
  async startFromManifest(manifestUrl, opts) {
3535
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3536
- // we do not want to expose this error, just continue if this analytics-only call fails
3537
- });
3458
+ this.wire.recordAnalytic('application-start-from-manifest');
3538
3459
  const app = await this._createFromManifest(manifestUrl);
3539
3460
  // @ts-expect-error using private method without warning.
3540
3461
  await app._run(opts); // eslint-disable-line no-underscore-dangle
@@ -3556,9 +3477,7 @@ function requireFactory$1 () {
3556
3477
  */
3557
3478
  createFromManifest(manifestUrl) {
3558
3479
  console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3559
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3560
- // we do not want to expose this error, just continue if this analytics-only call fails
3561
- });
3480
+ this.wire.recordAnalytic('application-create-from-manifest');
3562
3481
  return this._createFromManifest(manifestUrl);
3563
3482
  }
3564
3483
  _createFromManifest(manifestUrl) {
@@ -3679,9 +3598,7 @@ function requireInstance () {
3679
3598
  super(wire, identity, 'window');
3680
3599
  }
3681
3600
  async createWindow(options) {
3682
- this.wire.sendAction('window-create-window', this.identity).catch((e) => {
3683
- // we do not want to expose this error, just continue if this analytics-only call fails
3684
- });
3601
+ this.wire.recordAnalytic('window-create-window');
3685
3602
  const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
3686
3603
  const responseSubscription = await (0, promisifySubscription_1.promisifySubscription)(this, CONSTRUCTOR_CB_TOPIC);
3687
3604
  // set defaults:
@@ -4155,9 +4072,7 @@ function requireInstance () {
4155
4072
  * @experimental
4156
4073
  */
4157
4074
  async getLayout(layoutIdentity) {
4158
- this.wire.sendAction('window-get-layout', this.identity).catch((e) => {
4159
- // don't expose
4160
- });
4075
+ this.wire.recordAnalytic('window-get-layout');
4161
4076
  const opts = await this.getOptions();
4162
4077
  if (!opts.layout && !opts.layoutSnapshot) {
4163
4078
  throw new Error('Window does not have a Layout');
@@ -4206,9 +4121,7 @@ function requireInstance () {
4206
4121
  * ```
4207
4122
  */
4208
4123
  getParentApplication() {
4209
- this.wire.sendAction('window-get-parent-application', this.identity).catch((e) => {
4210
- // we do not want to expose this error, just continue if this analytics-only call fails
4211
- });
4124
+ this.wire.recordAnalytic('window-get-parent-application');
4212
4125
  return Promise.resolve(new application_1.Application(this.wire, this.identity));
4213
4126
  }
4214
4127
  /**
@@ -4231,9 +4144,7 @@ function requireInstance () {
4231
4144
  * ```
4232
4145
  */
4233
4146
  getParentWindow() {
4234
- this.wire.sendAction('window-get-parent-window', this.identity).catch((e) => {
4235
- // we do not want to expose this error, just continue if this analytics-only call fails
4236
- });
4147
+ this.wire.recordAnalytic('window-get-parent-window');
4237
4148
  return Promise.resolve(new application_1.Application(this.wire, this.identity)).then((app) => app.getWindow());
4238
4149
  }
4239
4150
  /**
@@ -4337,9 +4248,7 @@ function requireInstance () {
4337
4248
  * ```
4338
4249
  */
4339
4250
  getWebWindow() {
4340
- this.wire.sendAction('window-get-web-window', this.identity).catch((e) => {
4341
- // we do not want to expose this error, just continue if this analytics-only call fails
4342
- });
4251
+ this.wire.recordAnalytic('window-get-web-window');
4343
4252
  return this.wire.environment.getWebWindow(this.identity);
4344
4253
  }
4345
4254
  /**
@@ -4353,9 +4262,7 @@ function requireInstance () {
4353
4262
  * ```
4354
4263
  */
4355
4264
  isMainWindow() {
4356
- this.wire.sendAction('window-is-main-window', this.identity).catch((e) => {
4357
- // we do not want to expose this error, just continue if this analytics-only call fails
4358
- });
4265
+ this.wire.recordAnalytic('window-is-main-window');
4359
4266
  return this.me.uuid === this.me.name;
4360
4267
  }
4361
4268
  /**
@@ -4738,6 +4645,9 @@ function requireInstance () {
4738
4645
  * ```
4739
4646
  */
4740
4647
  updateOptions(options) {
4648
+ if ('frame' in options) {
4649
+ console.warn(`Deprecation Warning: Starting with version 45 it will not be possible to change the frame value after window has been created.`);
4650
+ }
4741
4651
  return this.wire.sendAction('update-window-options', { options, ...this.identity }).then(() => undefined);
4742
4652
  }
4743
4653
  /**
@@ -4874,9 +4784,7 @@ function requireInstance () {
4874
4784
  * ```
4875
4785
  */
4876
4786
  async dispatchPopupResult(data) {
4877
- this.wire.sendAction('window-dispatch-popup-result', this.identity).catch((e) => {
4878
- // we do not want to expose this error, just continue if this analytics-only call fails
4879
- });
4787
+ this.wire.recordAnalytic('window-dispatch-popup-result');
4880
4788
  await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
4881
4789
  }
4882
4790
  /**
@@ -4976,9 +4884,7 @@ function requireFactory () {
4976
4884
  * ```
4977
4885
  */
4978
4886
  async wrap(identity) {
4979
- this.wire.sendAction('window-wrap').catch((e) => {
4980
- // we do not want to expose this error, just continue if this analytics-only call fails
4981
- });
4887
+ this.wire.recordAnalytic('window-wrap');
4982
4888
  const errorMsg = (0, validate_1.validateIdentity)(identity);
4983
4889
  if (errorMsg) {
4984
4890
  throw new Error(errorMsg);
@@ -5008,9 +4914,7 @@ function requireFactory () {
5008
4914
  * ```
5009
4915
  */
5010
4916
  wrapSync(identity) {
5011
- this.wire.sendAction('window-wrap-sync').catch((e) => {
5012
- // we do not want to expose this error, just continue if this analytics-only call fails
5013
- });
4917
+ this.wire.recordAnalytic('window-wrap-sync');
5014
4918
  const errorMsg = (0, validate_1.validateIdentity)(identity);
5015
4919
  if (errorMsg) {
5016
4920
  throw new Error(errorMsg);
@@ -5039,9 +4943,7 @@ function requireFactory () {
5039
4943
  * ```
5040
4944
  */
5041
4945
  create(options) {
5042
- this.wire.sendAction('create-window').catch((e) => {
5043
- // we do not want to expose this error, just continue if this analytics-only call fails
5044
- });
4946
+ this.wire.recordAnalytic('create-window');
5045
4947
  const win = new Instance_1._Window(this.wire, { uuid: this.me.uuid, name: options.name });
5046
4948
  return win.createWindow(options);
5047
4949
  }
@@ -5057,9 +4959,7 @@ function requireFactory () {
5057
4959
  * ```
5058
4960
  */
5059
4961
  getCurrent() {
5060
- this.wire.sendAction('get-current-window').catch((e) => {
5061
- // we do not want to expose this error, just continue if this analytics-only call fails
5062
- });
4962
+ this.wire.recordAnalytic('get-current-window');
5063
4963
  if (!this.wire.me.isWindow) {
5064
4964
  throw new Error('You are not in a Window context');
5065
4965
  }
@@ -5078,9 +4978,7 @@ function requireFactory () {
5078
4978
  * ```
5079
4979
  */
5080
4980
  getCurrentSync() {
5081
- this.wire.sendAction('get-current-window-sync').catch((e) => {
5082
- // we do not want to expose this error, just continue if this analytics-only call fails
5083
- });
4981
+ this.wire.recordAnalytic('get-current-window-sync');
5084
4982
  if (!this.wire.me.isWindow) {
5085
4983
  throw new Error('You are not in a Window context');
5086
4984
  }
@@ -5226,13 +5124,15 @@ class System extends base_1$l.EmitterBase {
5226
5124
  * * cookies: browser [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
5227
5125
  * * localStorage: browser data that can be used across sessions ([local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage))
5228
5126
  * * appcache: html5 [application cache](https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache)
5127
+ * * windowState: clears data written for windows using `saveWindowState`; after clearing, previously saved bounds and state will not be restored until new state is written
5229
5128
  * @example
5230
5129
  * ```js
5231
5130
  * const clearCacheOptions = {
5232
5131
  * appcache: true,
5233
5132
  * cache: true,
5234
5133
  * cookies: true,
5235
- * localStorage: true
5134
+ * localStorage: true,
5135
+ * windowState: true
5236
5136
  * };
5237
5137
  * fin.System.clearCache(clearCacheOptions).then(() => console.log('Cache cleared')).catch(err => console.log(err));
5238
5138
  * ```
@@ -6634,9 +6534,7 @@ class System extends base_1$l.EmitterBase {
6634
6534
  * @experimental
6635
6535
  */
6636
6536
  async registerShutdownHandler(handler) {
6637
- this.wire.sendAction('system-register-shutdown-handler').catch((e) => {
6638
- // don't expose, analytics-only call
6639
- });
6537
+ this.wire.recordAnalytic('system-register-shutdown-handler');
6640
6538
  const SystemShutdownEventName = 'system-shutdown';
6641
6539
  const SystemShutdownHandledEventName = 'system-shutdown-handled';
6642
6540
  const { uuid, name } = this.wire.me;
@@ -8252,9 +8150,8 @@ class ChannelProvider extends channel_1.ChannelBase {
8252
8150
  return [...__classPrivateFieldGet$d(this, _ChannelProvider_connections, "f")];
8253
8151
  }
8254
8152
  static handleClientDisconnection(channel, payload) {
8255
- if (payload?.endpointId) {
8256
- const { uuid, name, endpointId, isLocalEndpointId } = payload;
8257
- __classPrivateFieldGet$d(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
8153
+ if (payload.endpointId) {
8154
+ __classPrivateFieldGet$d(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { endpointId: payload.endpointId });
8258
8155
  }
8259
8156
  else {
8260
8157
  // this is here to support older runtimes that did not have endpointId
@@ -8424,7 +8321,9 @@ class ChannelProvider extends channel_1.ChannelBase {
8424
8321
  * ```
8425
8322
  */
8426
8323
  onDisconnection(listener) {
8427
- this.disconnectListener = listener;
8324
+ this.disconnectListener = (identity) => {
8325
+ listener(identity);
8326
+ };
8428
8327
  }
8429
8328
  /**
8430
8329
  * Destroy the channel, raises `disconnected` events on all connected channel clients.
@@ -8441,7 +8340,6 @@ class ChannelProvider extends channel_1.ChannelBase {
8441
8340
  */
8442
8341
  async destroy() {
8443
8342
  const protectedObj = __classPrivateFieldGet$d(this, _ChannelProvider_protectedObj, "f");
8444
- protectedObj.providerIdentity;
8445
8343
  __classPrivateFieldSet$c(this, _ChannelProvider_connections, [], "f");
8446
8344
  await protectedObj.close();
8447
8345
  __classPrivateFieldGet$d(this, _ChannelProvider_close, "f").call(this);
@@ -8748,7 +8646,7 @@ const base_1$i = base;
8748
8646
  const strategy_1 = strategy$3;
8749
8647
  const strategy_2 = strategy$2;
8750
8648
  const ice_manager_1 = iceManager;
8751
- const provider_1$1 = provider;
8649
+ const provider_1 = provider;
8752
8650
  const message_receiver_1 = messageReceiver$1;
8753
8651
  const protocol_manager_1 = protocolManager;
8754
8652
  const strategy_3 = __importDefault$6(strategy);
@@ -8770,6 +8668,13 @@ class ConnectionManager extends base_1$i.Base {
8770
8668
  _ConnectionManager_messageReceiver.set(this, void 0);
8771
8669
  _ConnectionManager_rtcConnectionManager.set(this, void 0);
8772
8670
  this.removeChannelFromProviderMap = (channelId) => {
8671
+ const providerEntry = this.providerMap.get(channelId);
8672
+ if (providerEntry) {
8673
+ const { channelName } = providerEntry.providerIdentity;
8674
+ if (this.providerChannelIdByName.get(channelName) === channelId) {
8675
+ this.providerChannelIdByName.delete(channelName);
8676
+ }
8677
+ }
8773
8678
  this.providerMap.delete(channelId);
8774
8679
  };
8775
8680
  this.onmessage = (msg) => {
@@ -8780,6 +8685,7 @@ class ConnectionManager extends base_1$i.Base {
8780
8685
  return false;
8781
8686
  };
8782
8687
  this.providerMap = new Map();
8688
+ this.providerChannelIdByName = new Map();
8783
8689
  this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
8784
8690
  __classPrivateFieldSet$b(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
8785
8691
  __classPrivateFieldSet$b(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
@@ -8813,14 +8719,16 @@ class ConnectionManager extends base_1$i.Base {
8813
8719
  // Should be impossible.
8814
8720
  throw new Error('failed to combine strategies');
8815
8721
  }
8816
- const channel = new provider_1$1.ChannelProvider(providerIdentity, () => provider_1$1.ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
8722
+ const channel = new provider_1.ChannelProvider(providerIdentity, () => provider_1.ChannelProvider.wireClose(this.wire, providerIdentity.channelName), strategy);
8817
8723
  const key = providerIdentity.channelId;
8818
8724
  this.providerMap.set(key, {
8725
+ providerIdentity,
8819
8726
  provider: channel,
8820
8727
  strategy,
8821
8728
  supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
8822
8729
  });
8823
- provider_1$1.ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
8730
+ this.providerChannelIdByName.set(providerIdentity.channelName, key);
8731
+ provider_1.ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
8824
8732
  return channel;
8825
8733
  }
8826
8734
  async createClientOffer(options) {
@@ -8894,6 +8802,16 @@ class ConnectionManager extends base_1$i.Base {
8894
8802
  strategy.addEndpoint(routingInfo.channelId, endpointPayload);
8895
8803
  return strategy;
8896
8804
  }
8805
+ handleClientDisconnection(eventPayload) {
8806
+ const channelId = eventPayload.channelId ?? this.providerChannelIdByName.get(eventPayload.channelName ?? '');
8807
+ if (!channelId) {
8808
+ return;
8809
+ }
8810
+ const providerEntry = this.providerMap.get(channelId);
8811
+ if (providerEntry) {
8812
+ provider_1.ChannelProvider.handleClientDisconnection(providerEntry.provider, eventPayload);
8813
+ }
8814
+ }
8897
8815
  async processChannelConnection(msg) {
8898
8816
  const { clientIdentity, providerIdentity, ackToSender, payload, offer: clientOffer } = msg.payload;
8899
8817
  if (!clientIdentity.endpointId) {
@@ -8913,7 +8831,7 @@ class ConnectionManager extends base_1$i.Base {
8913
8831
  }
8914
8832
  const { provider, strategy, supportedProtocols } = bus;
8915
8833
  try {
8916
- if (!(provider instanceof provider_1$1.ChannelProvider)) {
8834
+ if (!(provider instanceof provider_1.ChannelProvider)) {
8917
8835
  throw Error('Cannot connect to a channel client');
8918
8836
  }
8919
8837
  const offer = clientOffer ?? {
@@ -8994,7 +8912,7 @@ var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateF
8994
8912
  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");
8995
8913
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8996
8914
  };
8997
- var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnect;
8915
+ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyForProvider, _Channel_readyToConnect;
8998
8916
  Object.defineProperty(channel$1, "__esModule", { value: true });
8999
8917
  channel$1.Channel = void 0;
9000
8918
  /* eslint-disable no-console */
@@ -9003,7 +8921,6 @@ const lazy_1$2 = lazy;
9003
8921
  const base_1$h = base;
9004
8922
  const client_1 = client;
9005
8923
  const connection_manager_1 = connectionManager;
9006
- const provider_1 = provider;
9007
8924
  function retryDelay(count) {
9008
8925
  const interval = 500; // base delay
9009
8926
  const steps = 10; // How many retries to do before incrementing the delay
@@ -9039,9 +8956,19 @@ class Channel extends base_1$h.EmitterBase {
9039
8956
  super(wire, 'channel');
9040
8957
  _Channel_connectionManager.set(this, void 0);
9041
8958
  _Channel_internalEmitter.set(this, new events_1$5.EventEmitter());
8959
+ // Provider-side disconnect routing setup. This must exist before first create()
8960
+ // so provider onDisconnection callbacks are wired even if connect() is never called.
8961
+ _Channel_readyForProvider.set(this, new lazy_1$2.AsyncRetryableLazy(async () => {
8962
+ // TODO: fix typing (internal)
8963
+ // @ts-expect-error
8964
+ await this.on('client-disconnected', (eventPayload) => {
8965
+ __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").handleClientDisconnection(eventPayload);
8966
+ });
8967
+ }));
9042
8968
  // OpenFin API has not been injected at construction time, *must* wait for API to be ready.
9043
8969
  _Channel_readyToConnect.set(this, new lazy_1$2.AsyncRetryableLazy(async () => {
9044
8970
  await Promise.all([
8971
+ __classPrivateFieldGet$b(this, _Channel_readyForProvider, "f").getValue(),
9045
8972
  this.on('disconnected', (eventPayload) => {
9046
8973
  client_1.ChannelClient.handleProviderDisconnect(eventPayload);
9047
8974
  }),
@@ -9298,23 +9225,16 @@ class Channel extends base_1$h.EmitterBase {
9298
9225
  * ```
9299
9226
  */
9300
9227
  async create(channelName, options) {
9228
+ await __classPrivateFieldGet$b(this, _Channel_readyForProvider, "f").getValue();
9301
9229
  if (!channelName) {
9302
9230
  throw new Error('Please provide a channelName to create a channel');
9303
9231
  }
9304
9232
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
9305
- const channel = __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9306
- // TODO: fix typing (internal)
9307
- // @ts-expect-error
9308
- this.on('client-disconnected', (eventPayload) => {
9309
- if (eventPayload.channelName === channelName) {
9310
- provider_1.ChannelProvider.handleClientDisconnection(channel, eventPayload);
9311
- }
9312
- });
9313
- return channel;
9233
+ return __classPrivateFieldGet$b(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
9314
9234
  }
9315
9235
  }
9316
9236
  channel$1.Channel = Channel;
9317
- _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyToConnect = new WeakMap();
9237
+ _Channel_connectionManager = new WeakMap(), _Channel_internalEmitter = new WeakMap(), _Channel_readyForProvider = new WeakMap(), _Channel_readyToConnect = new WeakMap();
9318
9238
 
9319
9239
  Object.defineProperty(interappbus, "__esModule", { value: true });
9320
9240
  interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
@@ -9340,6 +9260,16 @@ class InterApplicationBus extends base_1$g.Base {
9340
9260
  */
9341
9261
  constructor(wire) {
9342
9262
  super(wire);
9263
+ /**
9264
+ * Event types for the InterApplicationBus.
9265
+ *
9266
+ * @remarks The `subscriber-added` and `subscriber-removed` events are disabled by default.
9267
+ * To re-enable them, launch the runtime with the `--emit-legacy-iab-events` flag.
9268
+ * These events will be removed in a future version. Use {@link Channel} for connection
9269
+ * lifecycle management instead.
9270
+ *
9271
+ * @deprecated Use {@link Channel} `onConnection` / `onDisconnection` instead.
9272
+ */
9343
9273
  this.events = {
9344
9274
  subscriberAdded: 'subscriber-added',
9345
9275
  subscriberRemoved: 'subscriber-removed'
@@ -9826,9 +9756,7 @@ class ExternalApplicationModule extends base_1$d.Base {
9826
9756
  * ```
9827
9757
  */
9828
9758
  wrap(uuid) {
9829
- this.wire.sendAction('external-application-wrap').catch((e) => {
9830
- // we do not want to expose this error, just continue if this analytics-only call fails
9831
- });
9759
+ this.wire.recordAnalytic('external-application-wrap');
9832
9760
  return Promise.resolve(new Instance_1$4.ExternalApplication(this.wire, { uuid }));
9833
9761
  }
9834
9762
  /**
@@ -9845,9 +9773,7 @@ class ExternalApplicationModule extends base_1$d.Base {
9845
9773
  * ```
9846
9774
  */
9847
9775
  wrapSync(uuid) {
9848
- this.wire.sendAction('external-application-wrap-sync').catch((e) => {
9849
- // we do not want to expose this error, just continue if this analytics-only call fails
9850
- });
9776
+ this.wire.recordAnalytic('external-application-wrap-sync');
9851
9777
  return new Instance_1$4.ExternalApplication(this.wire, { uuid });
9852
9778
  }
9853
9779
  }
@@ -9982,9 +9908,7 @@ class _FrameModule extends base_1$b.Base {
9982
9908
  * ```
9983
9909
  */
9984
9910
  async wrap(identity) {
9985
- this.wire.sendAction('frame-wrap').catch((e) => {
9986
- // we do not want to expose this error, just continue if this analytics-only call fails
9987
- });
9911
+ this.wire.recordAnalytic('frame-wrap');
9988
9912
  const errorMsg = (0, validate_1$2.validateIdentity)(identity);
9989
9913
  if (errorMsg) {
9990
9914
  throw new Error(errorMsg);
@@ -10006,9 +9930,7 @@ class _FrameModule extends base_1$b.Base {
10006
9930
  * ```
10007
9931
  */
10008
9932
  wrapSync(identity) {
10009
- this.wire.sendAction('frame-wrap-sync').catch((e) => {
10010
- // we do not want to expose this error, just continue if this analytics-only call fails
10011
- });
9933
+ this.wire.recordAnalytic('frame-wrap-sync');
10012
9934
  const errorMsg = (0, validate_1$2.validateIdentity)(identity);
10013
9935
  if (errorMsg) {
10014
9936
  throw new Error(errorMsg);
@@ -10026,9 +9948,7 @@ class _FrameModule extends base_1$b.Base {
10026
9948
  * ```
10027
9949
  */
10028
9950
  getCurrent() {
10029
- this.wire.sendAction('frame-get-current').catch((e) => {
10030
- // we do not want to expose this error, just continue if this analytics-only call fails
10031
- });
9951
+ this.wire.recordAnalytic('frame-get-current');
10032
9952
  return Promise.resolve(new Instance_1$3._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity()));
10033
9953
  }
10034
9954
  /**
@@ -10042,9 +9962,7 @@ class _FrameModule extends base_1$b.Base {
10042
9962
  * ```
10043
9963
  */
10044
9964
  getCurrentSync() {
10045
- this.wire.sendAction('frame-get-current-sync').catch((e) => {
10046
- // we do not want to expose this error, just continue if this analytics-only call fails
10047
- });
9965
+ this.wire.recordAnalytic('frame-get-current-sync');
10048
9966
  return new Instance_1$3._Frame(this.wire, this.wire.environment.getCurrentEntityIdentity());
10049
9967
  }
10050
9968
  }
@@ -12274,9 +12192,7 @@ class LayoutModule extends base_1$7.Base {
12274
12192
  * ```
12275
12193
  */
12276
12194
  this.init = async (options = {}) => {
12277
- this.wire.sendAction('layout-init').catch((e) => {
12278
- // don't expose
12279
- });
12195
+ this.wire.recordAnalytic('layout-init');
12280
12196
  if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
12281
12197
  throw new Error('Layout.init can only be called from a Window context.');
12282
12198
  }
@@ -12354,9 +12270,7 @@ class LayoutModule extends base_1$7.Base {
12354
12270
  * ```
12355
12271
  */
12356
12272
  async wrap(identity) {
12357
- this.wire.sendAction('layout-wrap').catch((e) => {
12358
- // don't expose
12359
- });
12273
+ this.wire.recordAnalytic('layout-wrap');
12360
12274
  return new Instance_1$2.Layout(identity, this.wire);
12361
12275
  }
12362
12276
  /**
@@ -12379,9 +12293,7 @@ class LayoutModule extends base_1$7.Base {
12379
12293
  * ```
12380
12294
  */
12381
12295
  wrapSync(identity) {
12382
- this.wire.sendAction('layout-wrap-sync').catch((e) => {
12383
- // don't expose
12384
- });
12296
+ this.wire.recordAnalytic('layout-wrap-sync');
12385
12297
  return new Instance_1$2.Layout(identity, this.wire);
12386
12298
  }
12387
12299
  /**
@@ -12395,9 +12307,7 @@ class LayoutModule extends base_1$7.Base {
12395
12307
  * ```
12396
12308
  */
12397
12309
  async getCurrent() {
12398
- this.wire.sendAction('layout-get-current').catch((e) => {
12399
- // don't expose
12400
- });
12310
+ this.wire.recordAnalytic('layout-get-current');
12401
12311
  if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
12402
12312
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
12403
12313
  }
@@ -12418,9 +12328,7 @@ class LayoutModule extends base_1$7.Base {
12418
12328
  * ```
12419
12329
  */
12420
12330
  getCurrentSync() {
12421
- this.wire.sendAction('layout-get-current-sync').catch((e) => {
12422
- // don't expose
12423
- });
12331
+ this.wire.recordAnalytic('layout-get-current-sync');
12424
12332
  if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
12425
12333
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
12426
12334
  }
@@ -12438,9 +12346,7 @@ class LayoutModule extends base_1$7.Base {
12438
12346
  * ```
12439
12347
  */
12440
12348
  async getLayoutByViewIdentity(viewIdentity) {
12441
- this.wire.sendAction('layout-get-by-view-identity').catch(() => {
12442
- // don't expose
12443
- });
12349
+ this.wire.recordAnalytic('layout-get-by-view-identity');
12444
12350
  const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
12445
12351
  let layoutWindowIdentity = winIdentity;
12446
12352
  // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
@@ -12602,9 +12508,7 @@ class PlatformModule extends base_1$6.Base {
12602
12508
  * ```
12603
12509
  */
12604
12510
  async wrap(identity) {
12605
- this.wire.sendAction('platform-wrap').catch((e) => {
12606
- // don't expose
12607
- });
12511
+ this.wire.recordAnalytic('platform-wrap');
12608
12512
  return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
12609
12513
  }
12610
12514
  /**
@@ -12619,9 +12523,7 @@ class PlatformModule extends base_1$6.Base {
12619
12523
  * ```
12620
12524
  */
12621
12525
  wrapSync(identity) {
12622
- this.wire.sendAction('platform-wrap-sync').catch((e) => {
12623
- // don't expose
12624
- });
12526
+ this.wire.recordAnalytic('platform-wrap-sync');
12625
12527
  return new Instance_1$1.Platform(this.wire, { uuid: identity.uuid });
12626
12528
  }
12627
12529
  /**
@@ -12635,9 +12537,7 @@ class PlatformModule extends base_1$6.Base {
12635
12537
  * ```
12636
12538
  */
12637
12539
  async getCurrent() {
12638
- this.wire.sendAction('platform-get-current').catch((e) => {
12639
- // don't expose
12640
- });
12540
+ this.wire.recordAnalytic('platform-get-current');
12641
12541
  return this.wrap({ uuid: this.wire.me.uuid });
12642
12542
  }
12643
12543
  /**
@@ -12651,9 +12551,7 @@ class PlatformModule extends base_1$6.Base {
12651
12551
  * ```
12652
12552
  */
12653
12553
  getCurrentSync() {
12654
- this.wire.sendAction('platform-get-current-sync').catch((e) => {
12655
- // don't expose
12656
- });
12554
+ this.wire.recordAnalytic('platform-get-current-sync');
12657
12555
  return this.wrapSync({ uuid: this.wire.me.uuid });
12658
12556
  }
12659
12557
  /**
@@ -12681,9 +12579,7 @@ class PlatformModule extends base_1$6.Base {
12681
12579
  * ```
12682
12580
  */
12683
12581
  start(platformOptions) {
12684
- this.wire.sendAction('platform-start').catch((e) => {
12685
- // don't expose
12686
- });
12582
+ this.wire.recordAnalytic('platform-start');
12687
12583
  // eslint-disable-next-line no-async-promise-executor
12688
12584
  return new Promise(async (resolve, reject) => {
12689
12585
  try {
@@ -12725,9 +12621,7 @@ class PlatformModule extends base_1$6.Base {
12725
12621
  * ```
12726
12622
  */
12727
12623
  startFromManifest(manifestUrl, opts) {
12728
- this.wire.sendAction('platform-start-from-manifest').catch((e) => {
12729
- // don't expose
12730
- });
12624
+ this.wire.recordAnalytic('platform-start-from-manifest');
12731
12625
  // eslint-disable-next-line no-async-promise-executor
12732
12626
  return new Promise(async (resolve, reject) => {
12733
12627
  try {
@@ -15769,7 +15663,6 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
15769
15663
  // Generate an ID to make a session context group with. We will pass that ID to the Broker.
15770
15664
  // The broker will then setContext on that session context group later with our Intent Result,
15771
15665
  const guid = (0, utils_1.generateId)(); // TODO make this undefined in web
15772
- let isPromiseSettled = false;
15773
15666
  // Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
15774
15667
  const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
15775
15668
  const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
@@ -15785,21 +15678,11 @@ fdc3Channels2_0.createV2Channel = createV2Channel;
15785
15678
  reject(new Error('getResult is not supported in this environment'));
15786
15679
  });
15787
15680
  });
15788
- getResultPromise
15789
- .then(() => {
15790
- isPromiseSettled = true;
15791
- })
15792
- .catch(() => {
15793
- isPromiseSettled = true;
15794
- });
15795
15681
  // Set up the getResult call.
15796
15682
  const getResult = async () => {
15797
- // All this mumbo jumbo is needed to make sure that getResult resolves correctly and conforms to the FDC3 spec.
15798
- if (!isPromiseSettled) {
15799
- return undefined;
15800
- }
15801
15683
  let intentResult = await getResultPromise;
15802
- if (isPromiseSettled && !intentResult) {
15684
+ // void / no payload, or web path where subscribe resolves undefined (see getResultPromise above)
15685
+ if (intentResult == null) {
15803
15686
  return undefined;
15804
15687
  }
15805
15688
  if (typeof intentResult !== 'object') {
@@ -15890,9 +15773,7 @@ class FDC3ModuleBase {
15890
15773
  * @static
15891
15774
  */
15892
15775
  async broadcast(context) {
15893
- this.wire.sendAction('fdc3-broadcast').catch((e) => {
15894
- // we do not want to expose this error, just continue if this analytics-only call fails
15895
- });
15776
+ this.wire.recordAnalytic('fdc3-broadcast');
15896
15777
  return this.client.setContext(context);
15897
15778
  }
15898
15779
  /**
@@ -15903,9 +15784,7 @@ class FDC3ModuleBase {
15903
15784
  * @tutorial fdc3.open
15904
15785
  */
15905
15786
  async _open(app, context) {
15906
- this.wire.sendAction('fdc3-open').catch((e) => {
15907
- // we do not want to expose this error, just continue if this analytics-only call fails
15908
- });
15787
+ this.wire.recordAnalytic('fdc3-open');
15909
15788
  try {
15910
15789
  return await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
15911
15790
  }
@@ -15929,9 +15808,7 @@ class FDC3ModuleBase {
15929
15808
  * @tutorial fdc3.getOrCreateChannel
15930
15809
  */
15931
15810
  async getOrCreateChannel(channelId, fdc3Factory) {
15932
- this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
15933
- // we do not want to expose this error, just continue if this analytics-only call fails
15934
- });
15811
+ this.wire.recordAnalytic('fdc3-get-or-create-channel');
15935
15812
  const hasChannelIdBeenUsed = await InteropClient_1$2.InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
15936
15813
  channelId
15937
15814
  });
@@ -15959,9 +15836,7 @@ class FDC3ModuleBase {
15959
15836
  * @static
15960
15837
  */
15961
15838
  async getSystemChannels() {
15962
- this.wire.sendAction('fdc3-get-system-channels').catch((e) => {
15963
- // we do not want to expose this error, just continue if this analytics-only call fails
15964
- });
15839
+ this.wire.recordAnalytic('fdc3-get-system-channels');
15965
15840
  return this._getChannels();
15966
15841
  }
15967
15842
  /**
@@ -15976,9 +15851,7 @@ class FDC3ModuleBase {
15976
15851
  * @static
15977
15852
  */
15978
15853
  async joinChannel(channelId) {
15979
- this.wire.sendAction('fdc3-join-channel').catch((e) => {
15980
- // we do not want to expose this error, just continue if this analytics-only call fails
15981
- });
15854
+ this.wire.recordAnalytic('fdc3-join-channel');
15982
15855
  try {
15983
15856
  return await this.client.joinContextGroup(channelId);
15984
15857
  }
@@ -16001,9 +15874,7 @@ class FDC3ModuleBase {
16001
15874
  * @tutorial fdc3.getCurrentChannel
16002
15875
  */
16003
15876
  async getCurrentChannel() {
16004
- this.wire.sendAction('fdc3-get-current-channel').catch((e) => {
16005
- // we do not want to expose this error, just continue if this analytics-only call fails
16006
- });
15877
+ this.wire.recordAnalytic('fdc3-get-current-channel');
16007
15878
  const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
16008
15879
  if (!currentContextGroupInfo) {
16009
15880
  return null;
@@ -16018,9 +15889,7 @@ class FDC3ModuleBase {
16018
15889
  * @static
16019
15890
  */
16020
15891
  async leaveCurrentChannel() {
16021
- this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
16022
- // we do not want to expose this error, just continue if this analytics-only call fails
16023
- });
15892
+ this.wire.recordAnalytic('fdc3-leave-current-channel');
16024
15893
  return this.client.removeFromContextGroup();
16025
15894
  }
16026
15895
  // utils
@@ -16146,9 +16015,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16146
16015
  */
16147
16016
  // @ts-expect-error TODO [CORE-1524]
16148
16017
  addContextListener(contextType, handler) {
16149
- this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
16150
- // we do not want to expose this error, just continue if this analytics-only call fails
16151
- });
16018
+ this.wire.recordAnalytic('fdc3-add-context-listener');
16152
16019
  let listener;
16153
16020
  if (typeof contextType === 'function') {
16154
16021
  console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
@@ -16171,9 +16038,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16171
16038
  * @static
16172
16039
  */
16173
16040
  addIntentListener(intent, handler) {
16174
- this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
16175
- // we do not want to expose this error, just continue if this analytics-only call fails
16176
- });
16041
+ this.wire.recordAnalytic('fdc3-add-intent-listener');
16177
16042
  const contextHandler = (raisedIntent) => {
16178
16043
  const { context, metadata: intentMetadata } = raisedIntent;
16179
16044
  const { metadata } = context;
@@ -16201,9 +16066,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16201
16066
  * @static
16202
16067
  */
16203
16068
  async raiseIntent(intent, context, app) {
16204
- this.wire.sendAction('fdc3-raise-intent').catch((e) => {
16205
- // we do not want to expose this error, just continue if this analytics-only call fails
16206
- });
16069
+ this.wire.recordAnalytic('fdc3-raise-intent');
16207
16070
  const intentObj = app
16208
16071
  ? { name: intent, context, metadata: { target: app } }
16209
16072
  : { name: intent, context };
@@ -16223,9 +16086,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16223
16086
  * @tutorial fdc3.findIntent
16224
16087
  */
16225
16088
  async findIntent(intent, context) {
16226
- this.wire.sendAction('fdc3-find-intent').catch((e) => {
16227
- // we do not want to expose this error, just continue if this analytics-only call fails
16228
- });
16089
+ this.wire.recordAnalytic('fdc3-find-intent');
16229
16090
  try {
16230
16091
  return await this.client.getInfoForIntent({ name: intent, context });
16231
16092
  }
@@ -16241,9 +16102,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16241
16102
  * @tutorial fdc3.findIntentsByContext
16242
16103
  */
16243
16104
  async findIntentsByContext(context) {
16244
- this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
16245
- // we do not want to expose this error, just continue if this analytics-only call fails
16246
- });
16105
+ this.wire.recordAnalytic('fdc3-find-intents-by-context');
16247
16106
  try {
16248
16107
  return await this.client.getInfoForIntentsByContext(context);
16249
16108
  }
@@ -16260,9 +16119,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16260
16119
  * @tutorial fdc3.raiseIntentForContext
16261
16120
  */
16262
16121
  async raiseIntentForContext(context, app) {
16263
- this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
16264
- // we do not want to expose this error, just continue if this analytics-only call fails
16265
- });
16122
+ this.wire.recordAnalytic('fdc3-raise-intent-for-context');
16266
16123
  try {
16267
16124
  return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
16268
16125
  }
@@ -16286,9 +16143,7 @@ class Fdc3Module extends fdc3_common_1$1.FDC3ModuleBase {
16286
16143
  * @tutorial fdc3.getInfo
16287
16144
  */
16288
16145
  getInfo() {
16289
- this.wire.sendAction('fdc3-get-info').catch((e) => {
16290
- // we do not want to expose this error, just continue if this analytics-only call fails
16291
- });
16146
+ this.wire.recordAnalytic('fdc3-get-info');
16292
16147
  const version = this.wire.environment.getAdapterVersionSync();
16293
16148
  return {
16294
16149
  providerVersion: version,
@@ -16366,9 +16221,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16366
16221
  * @tutorial fdc3v2.findInstances
16367
16222
  */
16368
16223
  async findInstances(app) {
16369
- this.wire.sendAction('fdc3-find-instances').catch((e) => {
16370
- // we do not want to expose this error, just continue if this analytics-only call fails
16371
- });
16224
+ this.wire.recordAnalytic('fdc3-find-instances');
16372
16225
  try {
16373
16226
  return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
16374
16227
  }
@@ -16384,9 +16237,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16384
16237
  * @tutorial fdc3v2.getAppMetadata
16385
16238
  */
16386
16239
  async getAppMetadata(app) {
16387
- this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
16388
- // we do not want to expose this error, just continue if this analytics-only call fails
16389
- });
16240
+ this.wire.recordAnalytic('fdc3-get-app-metadata');
16390
16241
  try {
16391
16242
  return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
16392
16243
  }
@@ -16404,9 +16255,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16404
16255
  */
16405
16256
  // @ts-expect-error TODO [CORE-1524]
16406
16257
  async addContextListener(contextType, handler) {
16407
- this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
16408
- // we do not want to expose this error, just continue if this analytics-only call fails
16409
- });
16258
+ this.wire.recordAnalytic('fdc3-add-context-listener');
16410
16259
  // The FDC3 ContextHandler only expects the context and optional ContextMetadata, so we wrap the handler
16411
16260
  // here so it only gets passed these parameters
16412
16261
  const getWrappedHandler = (handlerToWrap) => {
@@ -16435,9 +16284,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16435
16284
  * @tutorial fdc3.findIntent
16436
16285
  */
16437
16286
  async findIntent(intent, context, resultType) {
16438
- this.wire.sendAction('fdc3-find-intent').catch((e) => {
16439
- // we do not want to expose this error, just continue if this analytics-only call fails
16440
- });
16287
+ this.wire.recordAnalytic('fdc3-find-intent');
16441
16288
  try {
16442
16289
  return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
16443
16290
  }
@@ -16454,9 +16301,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16454
16301
  * @tutorial fdc3v2.findIntentsByContext
16455
16302
  */
16456
16303
  async findIntentsByContext(context, resultType) {
16457
- this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
16458
- // we do not want to expose this error, just continue if this analytics-only call fails
16459
- });
16304
+ this.wire.recordAnalytic('fdc3-find-intents-by-context');
16460
16305
  const payload = resultType ? { context, metadata: { resultType } } : context;
16461
16306
  try {
16462
16307
  return await InteropClient_1$1.InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
@@ -16475,9 +16320,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16475
16320
  * @tutorial fdc3v2.raiseIntent
16476
16321
  */
16477
16322
  async raiseIntent(intent, context, app) {
16478
- this.wire.sendAction('fdc3-raise-intent').catch((e) => {
16479
- // we do not want to expose this error, just continue if this analytics-only call fails
16480
- });
16323
+ this.wire.recordAnalytic('fdc3-raise-intent');
16481
16324
  try {
16482
16325
  if (typeof app === 'string') {
16483
16326
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
@@ -16498,9 +16341,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16498
16341
  */
16499
16342
  async raiseIntentForContext(context, app) {
16500
16343
  // TODO: We have to do the same thing we do for raiseIntent here as well.
16501
- this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
16502
- // we do not want to expose this error, just continue if this analytics-only call fails
16503
- });
16344
+ this.wire.recordAnalytic('fdc3-raise-intent-for-context');
16504
16345
  try {
16505
16346
  if (typeof app === 'string') {
16506
16347
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
@@ -16520,9 +16361,7 @@ class Fdc3Module2 extends fdc3_common_1.FDC3ModuleBase {
16520
16361
  * @tutorial fdc3.addIntentListener
16521
16362
  */
16522
16363
  async addIntentListener(intent, handler) {
16523
- this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
16524
- // we do not want to expose this error, just continue if this analytics-only call fails
16525
- });
16364
+ this.wire.recordAnalytic('fdc3-add-intent-listener');
16526
16365
  if (typeof intent !== 'string') {
16527
16366
  throw new Error('First argument must be an Intent name');
16528
16367
  }
@@ -16699,9 +16538,7 @@ class InteropModule extends base_1$2.Base {
16699
16538
  * ```
16700
16539
  */
16701
16540
  async init(name, override = defaultOverride) {
16702
- this.wire.sendAction('interop-init').catch(() => {
16703
- // don't expose, analytics-only call
16704
- });
16541
+ this.wire.recordAnalytic('interop-init');
16705
16542
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
16706
16543
  const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
16707
16544
  const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
@@ -16750,9 +16587,7 @@ class InteropModule extends base_1$2.Base {
16750
16587
  * ```
16751
16588
  */
16752
16589
  connectSync(name, interopConfig) {
16753
- this.wire.sendAction('interop-connect-sync').catch(() => {
16754
- // don't expose, analytics-only call
16755
- });
16590
+ this.wire.recordAnalytic('interop-connect-sync');
16756
16591
  return new InteropClient_1.InteropClient(this.wire, this.wire.environment.whenReady().then(() => {
16757
16592
  return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
16758
16593
  payload: interopConfig
@@ -16921,9 +16756,7 @@ class SnapshotSource extends base_1$1.Base {
16921
16756
  * ```
16922
16757
  */
16923
16758
  async ready() {
16924
- this.wire.sendAction('snapshot-source-ready').catch((e) => {
16925
- // don't expose, analytics-only call
16926
- });
16759
+ this.wire.recordAnalytic('snapshot-source-ready');
16927
16760
  // eslint-disable-next-line no-async-promise-executor
16928
16761
  try {
16929
16762
  // If getClient was already called before this, do we have a timing issue where the channel might have been created but we missed the event but this still fails?
@@ -16939,9 +16772,7 @@ class SnapshotSource extends base_1$1.Base {
16939
16772
  *
16940
16773
  */
16941
16774
  async getSnapshot() {
16942
- this.wire.sendAction('snapshot-source-get-snapshot').catch((e) => {
16943
- // don't expose, analytics-only call
16944
- });
16775
+ this.wire.recordAnalytic('snapshot-source-get-snapshot');
16945
16776
  const client = await __classPrivateFieldGet$1(this, _SnapshotSource_getClient, "f").call(this);
16946
16777
  const response = (await client.dispatch('get-snapshot'));
16947
16778
  return (await response).snapshot;
@@ -16951,9 +16782,7 @@ class SnapshotSource extends base_1$1.Base {
16951
16782
  *
16952
16783
  */
16953
16784
  async applySnapshot(snapshot) {
16954
- this.wire.sendAction('snapshot-source-apply-snapshot').catch((e) => {
16955
- // don't expose, analytics-only call
16956
- });
16785
+ this.wire.recordAnalytic('snapshot-source-apply-snapshot');
16957
16786
  const client = await __classPrivateFieldGet$1(this, _SnapshotSource_getClient, "f").call(this);
16958
16787
  return client.dispatch('apply-snapshot', { snapshot });
16959
16788
  }
@@ -16994,9 +16823,7 @@ class SnapshotSourceModule extends base_1.Base {
16994
16823
  *
16995
16824
  */
16996
16825
  async init(provider) {
16997
- this.wire.sendAction('snapshot-source-init').catch((e) => {
16998
- // don't expose, analytics-only call
16999
- });
16826
+ this.wire.recordAnalytic('snapshot-source-init');
17000
16827
  if (typeof provider !== 'object' ||
17001
16828
  typeof provider.getSnapshot !== 'function' ||
17002
16829
  typeof provider.applySnapshot !== 'function') {
@@ -17020,9 +16847,7 @@ class SnapshotSourceModule extends base_1.Base {
17020
16847
  * ```
17021
16848
  */
17022
16849
  wrapSync(identity) {
17023
- this.wire.sendAction('snapshot-source-wrap-sync').catch((e) => {
17024
- // don't expose, analytics-only call
17025
- });
16850
+ this.wire.recordAnalytic('snapshot-source-wrap-sync');
17026
16851
  return new Instance_1.SnapshotSource(this.wire, identity);
17027
16852
  }
17028
16853
  /**
@@ -17036,9 +16861,7 @@ class SnapshotSourceModule extends base_1.Base {
17036
16861
  * ```
17037
16862
  */
17038
16863
  async wrap(identity) {
17039
- this.wire.sendAction('snapshot-source-wrap').catch((e) => {
17040
- // don't expose, analytics-only call
17041
- });
16864
+ this.wire.recordAnalytic('snapshot-source-wrap');
17042
16865
  return this.wrapSync(identity);
17043
16866
  }
17044
16867
  }
@@ -17172,6 +16995,17 @@ Object.defineProperty(environment$1, "__esModule", { value: true });
17172
16995
  var notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = void 0;
17173
16996
  notImplementedEnvErrorMsg = environment$1.notImplementedEnvErrorMsg = 'Not implemented in this environment';
17174
16997
 
16998
+ var promises = {};
16999
+
17000
+ Object.defineProperty(promises, "__esModule", { value: true });
17001
+ var promisify_1 = promises.promisify = void 0;
17002
+ function promisify(func) {
17003
+ return (...args) => new Promise((resolve, reject) => {
17004
+ func(...args, (err, val) => (err ? reject(err) : resolve(val)));
17005
+ });
17006
+ }
17007
+ promisify_1 = promises.promisify = promisify;
17008
+
17175
17009
  const getProxyVar = () => {
17176
17010
  return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
17177
17011
  };
@@ -17291,7 +17125,7 @@ async function rmDir(dirPath, removeSelf = true) {
17291
17125
  return;
17292
17126
  }
17293
17127
  if (files.length > 0) {
17294
- await promiseMap_1(files, async (f) => {
17128
+ await Promise.all(files.map(async (f) => {
17295
17129
  const filePath = `${dirPath}/${f}`;
17296
17130
  const file = await lstat(filePath);
17297
17131
  if (file.isFile() || file.isSymbolicLink()) {
@@ -17300,7 +17134,7 @@ async function rmDir(dirPath, removeSelf = true) {
17300
17134
  else {
17301
17135
  await rmDir(filePath, true);
17302
17136
  }
17303
- });
17137
+ }));
17304
17138
  }
17305
17139
  if (removeSelf) {
17306
17140
  await rmdir(dirPath);
@@ -17882,7 +17716,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
17882
17716
  };
17883
17717
  }
17884
17718
  getAdapterVersionSync() {
17885
- return "41.103.3";
17719
+ return "41.103.10";
17886
17720
  }
17887
17721
  observeBounds(element, onChange) {
17888
17722
  throw new Error('Method not implemented.');
@@ -18016,7 +17850,7 @@ var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFie
18016
17850
  var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
18017
17851
  return (mod && mod.__esModule) ? mod : { "default": mod };
18018
17852
  };
18019
- var _Transport_wire, _Transport_fin;
17853
+ var _Transport_instances, _Transport_wire, _Transport_analyticsEnabled, _Transport_analyticsBuffer, _Transport_analyticsFlushTimeout, _Transport_fin, _Transport_flushAnalytics;
18020
17854
  Object.defineProperty(transport, "__esModule", { value: true });
18021
17855
  var Transport_1 = transport.Transport = void 0;
18022
17856
  const events_1$1 = require$$0;
@@ -18028,11 +17862,15 @@ const errors_1 = errors;
18028
17862
  class Transport extends events_1$1.EventEmitter {
18029
17863
  constructor(factory, environment, config) {
18030
17864
  super();
17865
+ _Transport_instances.add(this);
18031
17866
  this.wireListeners = new Map();
18032
17867
  this.topicRefMap = new Map();
18033
17868
  this.eventAggregator = new eventAggregator_1.default();
18034
17869
  this.messageHandlers = [this.eventAggregator.dispatchEvent];
18035
17870
  _Transport_wire.set(this, void 0);
17871
+ _Transport_analyticsEnabled.set(this, true);
17872
+ _Transport_analyticsBuffer.set(this, new Map());
17873
+ _Transport_analyticsFlushTimeout.set(this, void 0);
18036
17874
  // Typing as unknown to avoid circular dependency, should not be used directly.
18037
17875
  _Transport_fin.set(this, void 0);
18038
17876
  this.connectSync = () => {
@@ -18046,6 +17884,7 @@ class Transport extends events_1$1.EventEmitter {
18046
17884
  };
18047
17885
  __classPrivateFieldSet(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
18048
17886
  this.environment = environment;
17887
+ __classPrivateFieldSet(this, _Transport_analyticsEnabled, config.apiDiagnostics !== false, "f");
18049
17888
  this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
18050
17889
  this.registerMessageHandler(this.handleMessage.bind(this));
18051
17890
  __classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
@@ -18053,6 +17892,9 @@ class Transport extends events_1$1.EventEmitter {
18053
17892
  handleNack({ reason: 'Remote connection has closed' });
18054
17893
  }
18055
17894
  this.wireListeners.clear();
17895
+ clearTimeout(__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f"));
17896
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
17897
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
18056
17898
  this.emit('disconnected');
18057
17899
  });
18058
17900
  const { uuid, name } = config;
@@ -18071,6 +17913,18 @@ class Transport extends events_1$1.EventEmitter {
18071
17913
  }
18072
17914
  __classPrivateFieldSet(this, _Transport_fin, _fin, "f");
18073
17915
  }
17916
+ recordAnalytic(action) {
17917
+ if (!__classPrivateFieldGet(this, _Transport_analyticsEnabled, "f"))
17918
+ return;
17919
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").set(action, (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").get(action) ?? 0) + 1);
17920
+ if (__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f") === undefined) {
17921
+ const timeout = setTimeout(() => __classPrivateFieldGet(this, _Transport_instances, "m", _Transport_flushAnalytics).call(this), 30000);
17922
+ if (typeof timeout === 'object' && timeout !== null) {
17923
+ timeout.unref?.();
17924
+ }
17925
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, timeout, "f");
17926
+ }
17927
+ }
18074
17928
  shutdown() {
18075
17929
  const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
18076
17930
  return wire.shutdown();
@@ -18234,7 +18088,16 @@ class Transport extends events_1$1.EventEmitter {
18234
18088
  }
18235
18089
  }
18236
18090
  Transport_1 = transport.Transport = Transport;
18237
- _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
18091
+ _Transport_wire = new WeakMap(), _Transport_analyticsEnabled = new WeakMap(), _Transport_analyticsBuffer = new WeakMap(), _Transport_analyticsFlushTimeout = new WeakMap(), _Transport_fin = new WeakMap(), _Transport_instances = new WeakSet(), _Transport_flushAnalytics = function _Transport_flushAnalytics() {
18092
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
18093
+ if (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").size === 0)
18094
+ return;
18095
+ const counts = Object.fromEntries(__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f"));
18096
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
18097
+ this.sendAction('send-analytics-batch', { counts }).catch(() => {
18098
+ // analytics flush failure is non-fatal, counts are already cleared
18099
+ });
18100
+ };
18238
18101
 
18239
18102
  var websocket = {};
18240
18103
 
@@ -18355,7 +18218,8 @@ async function connect(config) {
18355
18218
  const normalized = await validateConfig(config);
18356
18219
  const wire = new Transport_1((onmessage) => new _default(onmessage), environment, {
18357
18220
  ...normalized,
18358
- name: normalized.name ?? normalized.uuid
18221
+ name: normalized.name ?? normalized.uuid,
18222
+ apiDiagnostics: config.apiDiagnostics
18359
18223
  });
18360
18224
  await wire.connect(normalized);
18361
18225
  // Casting instead of expect-error to avoid skipLibCheck errors.