@openfin/core 45.100.51 → 45.100.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/stub.js CHANGED
@@ -714,9 +714,7 @@ class ViewModule extends Base {
714
714
  * @experimental
715
715
  */
716
716
  async wrap(identity) {
717
- this.wire.sendAction('view-wrap').catch((e) => {
718
- // we do not want to expose this error, just continue if this analytics-only call fails
719
- });
717
+ this.wire.recordAnalytic('view-wrap');
720
718
  const errorMsg = validateIdentity(identity);
721
719
  if (errorMsg) {
722
720
  throw new Error(errorMsg);
@@ -738,9 +736,7 @@ class ViewModule extends Base {
738
736
  * @experimental
739
737
  */
740
738
  wrapSync(identity) {
741
- this.wire.sendAction('view-wrap-sync').catch((e) => {
742
- // we do not want to expose this error, just continue if this analytics-only call fails
743
- });
739
+ this.wire.recordAnalytic('view-wrap-sync');
744
740
  const errorMsg = validateIdentity(identity);
745
741
  if (errorMsg) {
746
742
  throw new Error(errorMsg);
@@ -760,9 +756,7 @@ class ViewModule extends Base {
760
756
  * @experimental
761
757
  */
762
758
  getCurrent() {
763
- this.wire.sendAction('view-get-current').catch((e) => {
764
- // we do not want to expose this error, just continue if this analytics-only call fails
765
- });
759
+ this.wire.recordAnalytic('view-get-current');
766
760
  if (!this.wire.me.isView) {
767
761
  throw new Error('You are not in a View context');
768
762
  }
@@ -781,9 +775,7 @@ class ViewModule extends Base {
781
775
  * @experimental
782
776
  */
783
777
  getCurrentSync() {
784
- this.wire.sendAction('view-get-current-sync').catch((e) => {
785
- // we do not want to expose this error, just continue if this analytics-only call fails
786
- });
778
+ this.wire.recordAnalytic('view-get-current-sync');
787
779
  if (!this.wire.me.isView) {
788
780
  throw new Error('You are not in a View context');
789
781
  }
@@ -1835,9 +1827,7 @@ class WebContents extends EmitterBase {
1835
1827
  * {@link OpenFin.WebContentsEvents event namespace}.
1836
1828
  */
1837
1829
  async showPopupWindow(options) {
1838
- this.wire.sendAction(`${this.entityType}-show-popup-window`, this.identity).catch(() => {
1839
- // we do not want to expose this error, just continue if this analytics-only call fails
1840
- });
1830
+ this.wire.recordAnalytic(`${this.entityType}-show-popup-window`);
1841
1831
  if (options?.onPopupReady) {
1842
1832
  const readyListener = async ({ popupName }) => {
1843
1833
  try {
@@ -2251,9 +2241,7 @@ class View extends WebContents {
2251
2241
  * @experimental
2252
2242
  */
2253
2243
  this.getParentLayout = async () => {
2254
- this.wire.sendAction('view-get-parent-layout').catch(() => {
2255
- // don't expose
2256
- });
2244
+ this.wire.recordAnalytic('view-get-parent-layout');
2257
2245
  return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
2258
2246
  };
2259
2247
  /**
@@ -2366,9 +2354,7 @@ class View extends WebContents {
2366
2354
  * ```
2367
2355
  */
2368
2356
  this.getCurrentStack = async () => {
2369
- this.wire.sendAction('view-get-current-stack').catch(() => {
2370
- // don't expose
2371
- });
2357
+ this.wire.recordAnalytic('view-get-current-stack');
2372
2358
  try {
2373
2359
  const layout = await this.getParentLayout();
2374
2360
  return layout.getStackByViewIdentity(this.identity);
@@ -2563,9 +2549,7 @@ class Application extends EmitterBase {
2563
2549
  */
2564
2550
  close(force = false) {
2565
2551
  console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2566
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2567
- // we do not want to expose this error, just continue if this analytics-only call fails
2568
- });
2552
+ this.wire.recordAnalytic('application-close');
2569
2553
  return this._close(force);
2570
2554
  }
2571
2555
  /**
@@ -2706,9 +2690,7 @@ class Application extends EmitterBase {
2706
2690
  * ```
2707
2691
  */
2708
2692
  getWindow() {
2709
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2710
- // we do not want to expose this error, just continue if this analytics-only call fails
2711
- });
2693
+ this.wire.recordAnalytic('application-get-window');
2712
2694
  return Promise.resolve(this.window);
2713
2695
  }
2714
2696
  /**
@@ -2786,9 +2768,7 @@ class Application extends EmitterBase {
2786
2768
  */
2787
2769
  run() {
2788
2770
  console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2789
- this.wire.sendAction('application-run', this.identity).catch((e) => {
2790
- // we do not want to expose this error, just continue if this analytics-only call fails
2791
- });
2771
+ this.wire.recordAnalytic('application-run');
2792
2772
  return this._run();
2793
2773
  }
2794
2774
  _run(opts = {}) {
@@ -3300,9 +3280,7 @@ class ApplicationModule extends Base {
3300
3280
  *
3301
3281
  */
3302
3282
  async wrap(identity) {
3303
- this.wire.sendAction('wrap-application').catch((e) => {
3304
- // we do not want to expose this error, just continue if this analytics-only call fails
3305
- });
3283
+ this.wire.recordAnalytic('wrap-application');
3306
3284
  const errorMsg = validateIdentity(identity);
3307
3285
  if (errorMsg) {
3308
3286
  throw new Error(errorMsg);
@@ -3325,9 +3303,7 @@ class ApplicationModule extends Base {
3325
3303
  *
3326
3304
  */
3327
3305
  wrapSync(identity) {
3328
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3329
- // we do not want to expose this error, just continue if this analytics-only call fails
3330
- });
3306
+ this.wire.recordAnalytic('wrap-application-sync');
3331
3307
  const errorMsg = validateIdentity(identity);
3332
3308
  if (errorMsg) {
3333
3309
  throw new Error(errorMsg);
@@ -3368,9 +3344,7 @@ class ApplicationModule extends Base {
3368
3344
  */
3369
3345
  create(appOptions) {
3370
3346
  console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3371
- this.wire.sendAction('application-create').catch((e) => {
3372
- // we do not want to expose this error, just continue if this analytics-only call fails
3373
- });
3347
+ this.wire.recordAnalytic('application-create');
3374
3348
  return this._create(appOptions);
3375
3349
  }
3376
3350
  /**
@@ -3392,9 +3366,7 @@ class ApplicationModule extends Base {
3392
3366
  *
3393
3367
  */
3394
3368
  async start(appOptions) {
3395
- this.wire.sendAction('start-application').catch((e) => {
3396
- // we do not want to expose this error, just continue if this analytics-only call fails
3397
- });
3369
+ this.wire.recordAnalytic('start-application');
3398
3370
  const app = await this._create(appOptions);
3399
3371
  await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3400
3372
  return app;
@@ -3457,9 +3429,7 @@ class ApplicationModule extends Base {
3457
3429
  * ```
3458
3430
  */
3459
3431
  getCurrent() {
3460
- this.wire.sendAction('get-current-application').catch((e) => {
3461
- // we do not want to expose this error, just continue if this analytics-only call fails
3462
- });
3432
+ this.wire.recordAnalytic('get-current-application');
3463
3433
  return this.wrap({ uuid: this.wire.me.uuid });
3464
3434
  }
3465
3435
  /**
@@ -3482,9 +3452,7 @@ class ApplicationModule extends Base {
3482
3452
  * ```
3483
3453
  */
3484
3454
  getCurrentSync() {
3485
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3486
- // we do not want to expose this error, just continue if this analytics-only call fails
3487
- });
3455
+ this.wire.recordAnalytic('get-current-application-sync');
3488
3456
  return this.wrapSync({ uuid: this.wire.me.uuid });
3489
3457
  }
3490
3458
  /**
@@ -3502,9 +3470,7 @@ class ApplicationModule extends Base {
3502
3470
  * ```
3503
3471
  */
3504
3472
  async startFromManifest(manifestUrl, opts) {
3505
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3506
- // we do not want to expose this error, just continue if this analytics-only call fails
3507
- });
3473
+ this.wire.recordAnalytic('application-start-from-manifest');
3508
3474
  const app = await this._createFromManifest(manifestUrl);
3509
3475
  // @ts-expect-error using private method without warning.
3510
3476
  await app._run(opts); // eslint-disable-line no-underscore-dangle
@@ -3526,9 +3492,7 @@ class ApplicationModule extends Base {
3526
3492
  */
3527
3493
  createFromManifest(manifestUrl) {
3528
3494
  console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3529
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3530
- // we do not want to expose this error, just continue if this analytics-only call fails
3531
- });
3495
+ this.wire.recordAnalytic('application-create-from-manifest');
3532
3496
  return this._createFromManifest(manifestUrl);
3533
3497
  }
3534
3498
  _createFromManifest(manifestUrl) {
@@ -3591,9 +3555,7 @@ class _Window extends WebContents {
3591
3555
  super(wire, identity, 'window');
3592
3556
  }
3593
3557
  async createWindow(options) {
3594
- this.wire.sendAction('window-create-window').catch((e) => {
3595
- // we do not want to expose this error, just continue if this analytics-only call fails
3596
- });
3558
+ this.wire.recordAnalytic('window-create-window');
3597
3559
  const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
3598
3560
  const responseSubscription = await promisifySubscription(this, CONSTRUCTOR_CB_TOPIC);
3599
3561
  // set defaults:
@@ -4067,9 +4029,7 @@ class _Window extends WebContents {
4067
4029
  * @experimental
4068
4030
  */
4069
4031
  async getLayout(layoutIdentity) {
4070
- this.wire.sendAction('window-get-layout').catch((e) => {
4071
- // don't expose
4072
- });
4032
+ this.wire.recordAnalytic('window-get-layout');
4073
4033
  const opts = await this.getOptions();
4074
4034
  if (!opts.layout && !opts.layoutSnapshot) {
4075
4035
  throw new Error('Window does not have a Layout');
@@ -4118,9 +4078,7 @@ class _Window extends WebContents {
4118
4078
  * ```
4119
4079
  */
4120
4080
  getParentApplication() {
4121
- this.wire.sendAction('window-get-parent-application').catch((e) => {
4122
- // we do not want to expose this error, just continue if this analytics-only call fails
4123
- });
4081
+ this.wire.recordAnalytic('window-get-parent-application');
4124
4082
  return Promise.resolve(new Application(this.wire, this.identity));
4125
4083
  }
4126
4084
  /**
@@ -4143,9 +4101,7 @@ class _Window extends WebContents {
4143
4101
  * ```
4144
4102
  */
4145
4103
  getParentWindow() {
4146
- this.wire.sendAction('window-get-parent-window').catch((e) => {
4147
- // we do not want to expose this error, just continue if this analytics-only call fails
4148
- });
4104
+ this.wire.recordAnalytic('window-get-parent-window');
4149
4105
  return Promise.resolve(new Application(this.wire, this.identity)).then((app) => app.getWindow());
4150
4106
  }
4151
4107
  /**
@@ -4249,9 +4205,7 @@ class _Window extends WebContents {
4249
4205
  * ```
4250
4206
  */
4251
4207
  getWebWindow() {
4252
- this.wire.sendAction('window-get-web-window').catch((e) => {
4253
- // we do not want to expose this error, just continue if this analytics-only call fails
4254
- });
4208
+ this.wire.recordAnalytic('window-get-web-window');
4255
4209
  return this.wire.environment.getWebWindow(this.identity);
4256
4210
  }
4257
4211
  /**
@@ -4265,9 +4219,7 @@ class _Window extends WebContents {
4265
4219
  * ```
4266
4220
  */
4267
4221
  isMainWindow() {
4268
- this.wire.sendAction('window-is-main-window').catch((e) => {
4269
- // we do not want to expose this error, just continue if this analytics-only call fails
4270
- });
4222
+ this.wire.recordAnalytic('window-is-main-window');
4271
4223
  return this.me.uuid === this.me.name;
4272
4224
  }
4273
4225
  /**
@@ -4789,9 +4741,7 @@ class _Window extends WebContents {
4789
4741
  * ```
4790
4742
  */
4791
4743
  async dispatchPopupResult(data) {
4792
- this.wire.sendAction('window-dispatch-popup-result').catch((e) => {
4793
- // we do not want to expose this error, just continue if this analytics-only call fails
4794
- });
4744
+ this.wire.recordAnalytic('window-dispatch-popup-result');
4795
4745
  await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
4796
4746
  }
4797
4747
  /**
@@ -4940,9 +4890,7 @@ class _WindowModule extends Base {
4940
4890
  * ```
4941
4891
  */
4942
4892
  async wrap(identity) {
4943
- this.wire.sendAction('window-wrap').catch((e) => {
4944
- // we do not want to expose this error, just continue if this analytics-only call fails
4945
- });
4893
+ this.wire.recordAnalytic('window-wrap');
4946
4894
  const errorMsg = validateIdentity(identity);
4947
4895
  if (errorMsg) {
4948
4896
  throw new Error(errorMsg);
@@ -4972,9 +4920,7 @@ class _WindowModule extends Base {
4972
4920
  * ```
4973
4921
  */
4974
4922
  wrapSync(identity) {
4975
- this.wire.sendAction('window-wrap-sync').catch((e) => {
4976
- // we do not want to expose this error, just continue if this analytics-only call fails
4977
- });
4923
+ this.wire.recordAnalytic('window-wrap-sync');
4978
4924
  const errorMsg = validateIdentity(identity);
4979
4925
  if (errorMsg) {
4980
4926
  throw new Error(errorMsg);
@@ -5003,9 +4949,7 @@ class _WindowModule extends Base {
5003
4949
  * ```
5004
4950
  */
5005
4951
  create(options) {
5006
- this.wire.sendAction('create-window').catch((e) => {
5007
- // we do not want to expose this error, just continue if this analytics-only call fails
5008
- });
4952
+ this.wire.recordAnalytic('create-window');
5009
4953
  const win = new _Window(this.wire, { uuid: this.me.uuid, name: options.name });
5010
4954
  return win.createWindow(options);
5011
4955
  }
@@ -5021,9 +4965,7 @@ class _WindowModule extends Base {
5021
4965
  * ```
5022
4966
  */
5023
4967
  getCurrent() {
5024
- this.wire.sendAction('get-current-window').catch((e) => {
5025
- // we do not want to expose this error, just continue if this analytics-only call fails
5026
- });
4968
+ this.wire.recordAnalytic('get-current-window');
5027
4969
  if (!this.wire.me.isWindow) {
5028
4970
  throw new Error('You are not in a Window context');
5029
4971
  }
@@ -5042,9 +4984,7 @@ class _WindowModule extends Base {
5042
4984
  * ```
5043
4985
  */
5044
4986
  getCurrentSync() {
5045
- this.wire.sendAction('get-current-window-sync').catch((e) => {
5046
- // we do not want to expose this error, just continue if this analytics-only call fails
5047
- });
4987
+ this.wire.recordAnalytic('get-current-window-sync');
5048
4988
  if (!this.wire.me.isWindow) {
5049
4989
  throw new Error('You are not in a Window context');
5050
4990
  }
@@ -5053,6 +4993,47 @@ class _WindowModule extends Base {
5053
4993
  }
5054
4994
  }
5055
4995
 
4996
+ /**
4997
+ * Chromium content tracing APIs exposed under `fin.System.ContentTracing`.
4998
+ */
4999
+ class SystemContentTracing extends Base {
5000
+ /**
5001
+ * Gets the currently known tracing category groups.
5002
+ */
5003
+ async getCategories() {
5004
+ const { payload } = await this.wire.sendAction('content-tracing-get-categories');
5005
+ return payload.data;
5006
+ }
5007
+ /**
5008
+ * Starts content tracing across runtime processes.
5009
+ *
5010
+ * Only one content tracing session may be active across the runtime at a time.
5011
+ * This method rejects if another identity already owns the active session.
5012
+ */
5013
+ async startRecording(options) {
5014
+ await this.wire.sendAction('content-tracing-start-recording', { options });
5015
+ }
5016
+ /**
5017
+ * Stops the active content tracing session and writes the trace to the runtime-managed cache folder.
5018
+ *
5019
+ * The calling identity must match the identity that started the active tracing session.
5020
+ * This method rejects if tracing is not active or is owned by another identity.
5021
+ */
5022
+ async stopRecording() {
5023
+ const { payload } = await this.wire.sendAction('content-tracing-stop-recording');
5024
+ return payload.data;
5025
+ }
5026
+ /**
5027
+ * Returns the current maximum trace buffer usage across processes.
5028
+ *
5029
+ * This method is not supported on macOS and rejects on that platform.
5030
+ */
5031
+ async getTraceBufferUsage() {
5032
+ const { payload } = await this.wire.sendAction('content-tracing-get-trace-buffer-usage');
5033
+ return payload.data;
5034
+ }
5035
+ }
5036
+
5056
5037
  /**
5057
5038
  * Entry point for the OpenFin `System` API (`fin.System`).
5058
5039
  *
@@ -5072,6 +5053,7 @@ class System extends EmitterBase {
5072
5053
  */
5073
5054
  constructor(wire) {
5074
5055
  super(wire, 'system');
5056
+ this.ContentTracing = new SystemContentTracing(wire);
5075
5057
  }
5076
5058
  sendExternalProcessRequest(action, options) {
5077
5059
  return new Promise((resolve, reject) => {
@@ -6597,9 +6579,7 @@ class System extends EmitterBase {
6597
6579
  * @experimental
6598
6580
  */
6599
6581
  async registerShutdownHandler(handler) {
6600
- this.wire.sendAction('system-register-shutdown-handler').catch((e) => {
6601
- // don't expose, analytics-only call
6602
- });
6582
+ this.wire.recordAnalytic('system-register-shutdown-handler');
6603
6583
  const SystemShutdownEventName = 'system-shutdown';
6604
6584
  const SystemShutdownHandledEventName = 'system-shutdown-handled';
6605
6585
  const { uuid, name } = this.wire.me;
@@ -9293,6 +9273,16 @@ class InterApplicationBus extends Base {
9293
9273
  */
9294
9274
  constructor(wire) {
9295
9275
  super(wire);
9276
+ /**
9277
+ * Event types for the InterApplicationBus.
9278
+ *
9279
+ * @remarks The `subscriber-added` and `subscriber-removed` events are disabled by default.
9280
+ * To re-enable them, launch the runtime with the `--emit-legacy-iab-events` flag.
9281
+ * These events will be removed in a future version. Use {@link Channel} for connection
9282
+ * lifecycle management instead.
9283
+ *
9284
+ * @deprecated Use {@link Channel} `onConnection` / `onDisconnection` instead.
9285
+ */
9296
9286
  this.events = {
9297
9287
  subscriberAdded: 'subscriber-added',
9298
9288
  subscriberRemoved: 'subscriber-removed'
@@ -9715,9 +9705,7 @@ class ExternalApplicationModule extends Base {
9715
9705
  * ```
9716
9706
  */
9717
9707
  wrap(uuid) {
9718
- this.wire.sendAction('external-application-wrap').catch((e) => {
9719
- // we do not want to expose this error, just continue if this analytics-only call fails
9720
- });
9708
+ this.wire.recordAnalytic('external-application-wrap');
9721
9709
  return Promise.resolve(new ExternalApplication(this.wire, { uuid }));
9722
9710
  }
9723
9711
  /**
@@ -9734,9 +9722,7 @@ class ExternalApplicationModule extends Base {
9734
9722
  * ```
9735
9723
  */
9736
9724
  wrapSync(uuid) {
9737
- this.wire.sendAction('external-application-wrap-sync').catch((e) => {
9738
- // we do not want to expose this error, just continue if this analytics-only call fails
9739
- });
9725
+ this.wire.recordAnalytic('external-application-wrap-sync');
9740
9726
  return new ExternalApplication(this.wire, { uuid });
9741
9727
  }
9742
9728
  }
@@ -9824,9 +9810,7 @@ class _FrameModule extends Base {
9824
9810
  * ```
9825
9811
  */
9826
9812
  async wrap(identity) {
9827
- this.wire.sendAction('frame-wrap').catch((e) => {
9828
- // we do not want to expose this error, just continue if this analytics-only call fails
9829
- });
9813
+ this.wire.recordAnalytic('frame-wrap');
9830
9814
  const errorMsg = validateIdentity(identity);
9831
9815
  if (errorMsg) {
9832
9816
  throw new Error(errorMsg);
@@ -9848,9 +9832,7 @@ class _FrameModule extends Base {
9848
9832
  * ```
9849
9833
  */
9850
9834
  wrapSync(identity) {
9851
- this.wire.sendAction('frame-wrap-sync').catch((e) => {
9852
- // we do not want to expose this error, just continue if this analytics-only call fails
9853
- });
9835
+ this.wire.recordAnalytic('frame-wrap-sync');
9854
9836
  const errorMsg = validateIdentity(identity);
9855
9837
  if (errorMsg) {
9856
9838
  throw new Error(errorMsg);
@@ -9868,9 +9850,7 @@ class _FrameModule extends Base {
9868
9850
  * ```
9869
9851
  */
9870
9852
  getCurrent() {
9871
- this.wire.sendAction('frame-get-current').catch((e) => {
9872
- // we do not want to expose this error, just continue if this analytics-only call fails
9873
- });
9853
+ this.wire.recordAnalytic('frame-get-current');
9874
9854
  return Promise.resolve(new _Frame(this.wire, this.wire.environment.getCurrentEntityIdentity()));
9875
9855
  }
9876
9856
  /**
@@ -9884,9 +9864,7 @@ class _FrameModule extends Base {
9884
9864
  * ```
9885
9865
  */
9886
9866
  getCurrentSync() {
9887
- this.wire.sendAction('frame-get-current-sync').catch((e) => {
9888
- // we do not want to expose this error, just continue if this analytics-only call fails
9889
- });
9867
+ this.wire.recordAnalytic('frame-get-current-sync');
9890
9868
  return new _Frame(this.wire, this.wire.environment.getCurrentEntityIdentity());
9891
9869
  }
9892
9870
  }
@@ -11842,9 +11820,7 @@ class LayoutModule extends Base {
11842
11820
  * ```
11843
11821
  */
11844
11822
  this.init = async (options = {}) => {
11845
- this.wire.sendAction('layout-init').catch((e) => {
11846
- // don't expose
11847
- });
11823
+ this.wire.recordAnalytic('layout-init');
11848
11824
  if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
11849
11825
  throw new Error('Layout.init can only be called from a Window context.');
11850
11826
  }
@@ -11922,9 +11898,7 @@ class LayoutModule extends Base {
11922
11898
  * ```
11923
11899
  */
11924
11900
  async wrap(identity) {
11925
- this.wire.sendAction('layout-wrap').catch((e) => {
11926
- // don't expose
11927
- });
11901
+ this.wire.recordAnalytic('layout-wrap');
11928
11902
  return new Layout(identity, this.wire);
11929
11903
  }
11930
11904
  /**
@@ -11947,9 +11921,7 @@ class LayoutModule extends Base {
11947
11921
  * ```
11948
11922
  */
11949
11923
  wrapSync(identity) {
11950
- this.wire.sendAction('layout-wrap-sync').catch((e) => {
11951
- // don't expose
11952
- });
11924
+ this.wire.recordAnalytic('layout-wrap-sync');
11953
11925
  return new Layout(identity, this.wire);
11954
11926
  }
11955
11927
  /**
@@ -11963,9 +11935,7 @@ class LayoutModule extends Base {
11963
11935
  * ```
11964
11936
  */
11965
11937
  async getCurrent() {
11966
- this.wire.sendAction('layout-get-current').catch((e) => {
11967
- // don't expose
11968
- });
11938
+ this.wire.recordAnalytic('layout-get-current');
11969
11939
  if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
11970
11940
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
11971
11941
  }
@@ -11986,9 +11956,7 @@ class LayoutModule extends Base {
11986
11956
  * ```
11987
11957
  */
11988
11958
  getCurrentSync() {
11989
- this.wire.sendAction('layout-get-current-sync').catch((e) => {
11990
- // don't expose
11991
- });
11959
+ this.wire.recordAnalytic('layout-get-current-sync');
11992
11960
  if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
11993
11961
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
11994
11962
  }
@@ -12006,9 +11974,7 @@ class LayoutModule extends Base {
12006
11974
  * ```
12007
11975
  */
12008
11976
  async getLayoutByViewIdentity(viewIdentity) {
12009
- this.wire.sendAction('layout-get-by-view-identity').catch(() => {
12010
- // don't expose
12011
- });
11977
+ this.wire.recordAnalytic('layout-get-by-view-identity');
12012
11978
  const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
12013
11979
  let layoutWindowIdentity = winIdentity;
12014
11980
  // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
@@ -12132,9 +12098,7 @@ class PlatformModule extends Base {
12132
12098
  * ```
12133
12099
  */
12134
12100
  async wrap(identity) {
12135
- this.wire.sendAction('platform-wrap').catch((e) => {
12136
- // don't expose
12137
- });
12101
+ this.wire.recordAnalytic('platform-wrap');
12138
12102
  return new Platform(this.wire, { uuid: identity.uuid });
12139
12103
  }
12140
12104
  /**
@@ -12149,9 +12113,7 @@ class PlatformModule extends Base {
12149
12113
  * ```
12150
12114
  */
12151
12115
  wrapSync(identity) {
12152
- this.wire.sendAction('platform-wrap-sync').catch((e) => {
12153
- // don't expose
12154
- });
12116
+ this.wire.recordAnalytic('platform-wrap-sync');
12155
12117
  return new Platform(this.wire, { uuid: identity.uuid });
12156
12118
  }
12157
12119
  /**
@@ -12165,9 +12127,7 @@ class PlatformModule extends Base {
12165
12127
  * ```
12166
12128
  */
12167
12129
  async getCurrent() {
12168
- this.wire.sendAction('platform-get-current').catch((e) => {
12169
- // don't expose
12170
- });
12130
+ this.wire.recordAnalytic('platform-get-current');
12171
12131
  return this.wrap({ uuid: this.wire.me.uuid });
12172
12132
  }
12173
12133
  /**
@@ -12181,9 +12141,7 @@ class PlatformModule extends Base {
12181
12141
  * ```
12182
12142
  */
12183
12143
  getCurrentSync() {
12184
- this.wire.sendAction('platform-get-current-sync').catch((e) => {
12185
- // don't expose
12186
- });
12144
+ this.wire.recordAnalytic('platform-get-current-sync');
12187
12145
  return this.wrapSync({ uuid: this.wire.me.uuid });
12188
12146
  }
12189
12147
  /**
@@ -12211,9 +12169,7 @@ class PlatformModule extends Base {
12211
12169
  * ```
12212
12170
  */
12213
12171
  start(platformOptions) {
12214
- this.wire.sendAction('platform-start').catch((e) => {
12215
- // don't expose
12216
- });
12172
+ this.wire.recordAnalytic('platform-start');
12217
12173
  // eslint-disable-next-line no-async-promise-executor
12218
12174
  return new Promise(async (resolve, reject) => {
12219
12175
  try {
@@ -12255,9 +12211,7 @@ class PlatformModule extends Base {
12255
12211
  * ```
12256
12212
  */
12257
12213
  startFromManifest(manifestUrl, opts) {
12258
- this.wire.sendAction('platform-start-from-manifest').catch((e) => {
12259
- // don't expose
12260
- });
12214
+ this.wire.recordAnalytic('platform-start-from-manifest');
12261
12215
  // eslint-disable-next-line no-async-promise-executor
12262
12216
  return new Promise(async (resolve, reject) => {
12263
12217
  try {
@@ -15383,9 +15337,7 @@ class FDC3ModuleBase {
15383
15337
  * @static
15384
15338
  */
15385
15339
  async broadcast(context) {
15386
- this.wire.sendAction('fdc3-broadcast').catch((e) => {
15387
- // we do not want to expose this error, just continue if this analytics-only call fails
15388
- });
15340
+ this.wire.recordAnalytic('fdc3-broadcast');
15389
15341
  return this.client.setContext(context);
15390
15342
  }
15391
15343
  /**
@@ -15396,9 +15348,7 @@ class FDC3ModuleBase {
15396
15348
  * @tutorial fdc3.open
15397
15349
  */
15398
15350
  async _open(app, context) {
15399
- this.wire.sendAction('fdc3-open').catch((e) => {
15400
- // we do not want to expose this error, just continue if this analytics-only call fails
15401
- });
15351
+ this.wire.recordAnalytic('fdc3-open');
15402
15352
  try {
15403
15353
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
15404
15354
  }
@@ -15422,9 +15372,7 @@ class FDC3ModuleBase {
15422
15372
  * @tutorial fdc3.getOrCreateChannel
15423
15373
  */
15424
15374
  async getOrCreateChannel(channelId, fdc3Factory) {
15425
- this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
15426
- // we do not want to expose this error, just continue if this analytics-only call fails
15427
- });
15375
+ this.wire.recordAnalytic('fdc3-get-or-create-channel');
15428
15376
  const hasChannelIdBeenUsed = await InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
15429
15377
  channelId
15430
15378
  });
@@ -15452,9 +15400,7 @@ class FDC3ModuleBase {
15452
15400
  * @static
15453
15401
  */
15454
15402
  async getSystemChannels() {
15455
- this.wire.sendAction('fdc3-get-system-channels').catch((e) => {
15456
- // we do not want to expose this error, just continue if this analytics-only call fails
15457
- });
15403
+ this.wire.recordAnalytic('fdc3-get-system-channels');
15458
15404
  return this._getChannels();
15459
15405
  }
15460
15406
  /**
@@ -15469,9 +15415,7 @@ class FDC3ModuleBase {
15469
15415
  * @static
15470
15416
  */
15471
15417
  async joinChannel(channelId) {
15472
- this.wire.sendAction('fdc3-join-channel').catch((e) => {
15473
- // we do not want to expose this error, just continue if this analytics-only call fails
15474
- });
15418
+ this.wire.recordAnalytic('fdc3-join-channel');
15475
15419
  try {
15476
15420
  return await this.client.joinContextGroup(channelId);
15477
15421
  }
@@ -15494,9 +15438,7 @@ class FDC3ModuleBase {
15494
15438
  * @tutorial fdc3.getCurrentChannel
15495
15439
  */
15496
15440
  async getCurrentChannel() {
15497
- this.wire.sendAction('fdc3-get-current-channel').catch((e) => {
15498
- // we do not want to expose this error, just continue if this analytics-only call fails
15499
- });
15441
+ this.wire.recordAnalytic('fdc3-get-current-channel');
15500
15442
  const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
15501
15443
  if (!currentContextGroupInfo) {
15502
15444
  return null;
@@ -15511,9 +15453,7 @@ class FDC3ModuleBase {
15511
15453
  * @static
15512
15454
  */
15513
15455
  async leaveCurrentChannel() {
15514
- this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
15515
- // we do not want to expose this error, just continue if this analytics-only call fails
15516
- });
15456
+ this.wire.recordAnalytic('fdc3-leave-current-channel');
15517
15457
  return this.client.removeFromContextGroup();
15518
15458
  }
15519
15459
  // utils
@@ -15633,9 +15573,7 @@ class Fdc3Module extends FDC3ModuleBase {
15633
15573
  */
15634
15574
  // @ts-expect-error TODO [CORE-1524]
15635
15575
  addContextListener(contextType, handler) {
15636
- this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
15637
- // we do not want to expose this error, just continue if this analytics-only call fails
15638
- });
15576
+ this.wire.recordAnalytic('fdc3-add-context-listener');
15639
15577
  let listener;
15640
15578
  if (typeof contextType === 'function') {
15641
15579
  console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
@@ -15658,9 +15596,7 @@ class Fdc3Module extends FDC3ModuleBase {
15658
15596
  * @static
15659
15597
  */
15660
15598
  addIntentListener(intent, handler) {
15661
- this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
15662
- // we do not want to expose this error, just continue if this analytics-only call fails
15663
- });
15599
+ this.wire.recordAnalytic('fdc3-add-intent-listener');
15664
15600
  const contextHandler = (raisedIntent) => {
15665
15601
  const { context, metadata: intentMetadata } = raisedIntent;
15666
15602
  const { metadata } = context;
@@ -15688,9 +15624,7 @@ class Fdc3Module extends FDC3ModuleBase {
15688
15624
  * @static
15689
15625
  */
15690
15626
  async raiseIntent(intent, context, app) {
15691
- this.wire.sendAction('fdc3-raise-intent').catch((e) => {
15692
- // we do not want to expose this error, just continue if this analytics-only call fails
15693
- });
15627
+ this.wire.recordAnalytic('fdc3-raise-intent');
15694
15628
  const intentObj = app
15695
15629
  ? { name: intent, context, metadata: { target: app } }
15696
15630
  : { name: intent, context };
@@ -15710,9 +15644,7 @@ class Fdc3Module extends FDC3ModuleBase {
15710
15644
  * @tutorial fdc3.findIntent
15711
15645
  */
15712
15646
  async findIntent(intent, context) {
15713
- this.wire.sendAction('fdc3-find-intent').catch((e) => {
15714
- // we do not want to expose this error, just continue if this analytics-only call fails
15715
- });
15647
+ this.wire.recordAnalytic('fdc3-find-intent');
15716
15648
  try {
15717
15649
  return await this.client.getInfoForIntent({ name: intent, context });
15718
15650
  }
@@ -15728,9 +15660,7 @@ class Fdc3Module extends FDC3ModuleBase {
15728
15660
  * @tutorial fdc3.findIntentsByContext
15729
15661
  */
15730
15662
  async findIntentsByContext(context) {
15731
- this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
15732
- // we do not want to expose this error, just continue if this analytics-only call fails
15733
- });
15663
+ this.wire.recordAnalytic('fdc3-find-intents-by-context');
15734
15664
  try {
15735
15665
  return await this.client.getInfoForIntentsByContext(context);
15736
15666
  }
@@ -15747,9 +15677,7 @@ class Fdc3Module extends FDC3ModuleBase {
15747
15677
  * @tutorial fdc3.raiseIntentForContext
15748
15678
  */
15749
15679
  async raiseIntentForContext(context, app) {
15750
- this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
15751
- // we do not want to expose this error, just continue if this analytics-only call fails
15752
- });
15680
+ this.wire.recordAnalytic('fdc3-raise-intent-for-context');
15753
15681
  try {
15754
15682
  return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
15755
15683
  }
@@ -15773,9 +15701,7 @@ class Fdc3Module extends FDC3ModuleBase {
15773
15701
  * @tutorial fdc3.getInfo
15774
15702
  */
15775
15703
  getInfo() {
15776
- this.wire.sendAction('fdc3-get-info').catch((e) => {
15777
- // we do not want to expose this error, just continue if this analytics-only call fails
15778
- });
15704
+ this.wire.recordAnalytic('fdc3-get-info');
15779
15705
  const version = this.wire.environment.getAdapterVersionSync();
15780
15706
  return {
15781
15707
  providerVersion: version,
@@ -15842,9 +15768,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15842
15768
  * @tutorial fdc3v2.findInstances
15843
15769
  */
15844
15770
  async findInstances(app) {
15845
- this.wire.sendAction('fdc3-find-instances').catch((e) => {
15846
- // we do not want to expose this error, just continue if this analytics-only call fails
15847
- });
15771
+ this.wire.recordAnalytic('fdc3-find-instances');
15848
15772
  try {
15849
15773
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
15850
15774
  }
@@ -15860,9 +15784,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15860
15784
  * @tutorial fdc3v2.getAppMetadata
15861
15785
  */
15862
15786
  async getAppMetadata(app) {
15863
- this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
15864
- // we do not want to expose this error, just continue if this analytics-only call fails
15865
- });
15787
+ this.wire.recordAnalytic('fdc3-get-app-metadata');
15866
15788
  try {
15867
15789
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
15868
15790
  }
@@ -15880,9 +15802,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15880
15802
  */
15881
15803
  // @ts-expect-error TODO [CORE-1524]
15882
15804
  async addContextListener(contextType, handler) {
15883
- this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
15884
- // we do not want to expose this error, just continue if this analytics-only call fails
15885
- });
15805
+ this.wire.recordAnalytic('fdc3-add-context-listener');
15886
15806
  // The FDC3 ContextHandler only expects the context and optional ContextMetadata, so we wrap the handler
15887
15807
  // here so it only gets passed these parameters
15888
15808
  const getWrappedHandler = (handlerToWrap) => {
@@ -15911,9 +15831,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15911
15831
  * @tutorial fdc3.findIntent
15912
15832
  */
15913
15833
  async findIntent(intent, context, resultType) {
15914
- this.wire.sendAction('fdc3-find-intent').catch((e) => {
15915
- // we do not want to expose this error, just continue if this analytics-only call fails
15916
- });
15834
+ this.wire.recordAnalytic('fdc3-find-intent');
15917
15835
  try {
15918
15836
  return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
15919
15837
  }
@@ -15930,9 +15848,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15930
15848
  * @tutorial fdc3v2.findIntentsByContext
15931
15849
  */
15932
15850
  async findIntentsByContext(context, resultType) {
15933
- this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
15934
- // we do not want to expose this error, just continue if this analytics-only call fails
15935
- });
15851
+ this.wire.recordAnalytic('fdc3-find-intents-by-context');
15936
15852
  const payload = resultType ? { context, metadata: { resultType } } : context;
15937
15853
  try {
15938
15854
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
@@ -15951,9 +15867,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15951
15867
  * @tutorial fdc3v2.raiseIntent
15952
15868
  */
15953
15869
  async raiseIntent(intent, context, app) {
15954
- this.wire.sendAction('fdc3-raise-intent').catch((e) => {
15955
- // we do not want to expose this error, just continue if this analytics-only call fails
15956
- });
15870
+ this.wire.recordAnalytic('fdc3-raise-intent');
15957
15871
  try {
15958
15872
  if (typeof app === 'string') {
15959
15873
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
@@ -15974,9 +15888,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15974
15888
  */
15975
15889
  async raiseIntentForContext(context, app) {
15976
15890
  // TODO: We have to do the same thing we do for raiseIntent here as well.
15977
- this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
15978
- // we do not want to expose this error, just continue if this analytics-only call fails
15979
- });
15891
+ this.wire.recordAnalytic('fdc3-raise-intent-for-context');
15980
15892
  try {
15981
15893
  if (typeof app === 'string') {
15982
15894
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
@@ -15996,9 +15908,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15996
15908
  * @tutorial fdc3.addIntentListener
15997
15909
  */
15998
15910
  async addIntentListener(intent, handler) {
15999
- this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
16000
- // we do not want to expose this error, just continue if this analytics-only call fails
16001
- });
15911
+ this.wire.recordAnalytic('fdc3-add-intent-listener');
16002
15912
  if (typeof intent !== 'string') {
16003
15913
  throw new Error('First argument must be an Intent name');
16004
15914
  }
@@ -16156,9 +16066,7 @@ class InteropModule extends Base {
16156
16066
  * ```
16157
16067
  */
16158
16068
  async init(name, override = defaultOverride) {
16159
- this.wire.sendAction('interop-init').catch(() => {
16160
- // don't expose, analytics-only call
16161
- });
16069
+ this.wire.recordAnalytic('interop-init');
16162
16070
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
16163
16071
  const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
16164
16072
  const objectThatThrows = createUnusableObject(BrokerParamAccessError);
@@ -16207,9 +16115,7 @@ class InteropModule extends Base {
16207
16115
  * ```
16208
16116
  */
16209
16117
  connectSync(name, interopConfig) {
16210
- this.wire.sendAction('interop-connect-sync').catch(() => {
16211
- // don't expose, analytics-only call
16212
- });
16118
+ this.wire.recordAnalytic('interop-connect-sync');
16213
16119
  return new InteropClient(this.wire, this.wire.environment.whenReady().then(() => {
16214
16120
  return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
16215
16121
  payload: interopConfig
@@ -16332,9 +16238,7 @@ class SnapshotSource extends Base {
16332
16238
  * ```
16333
16239
  */
16334
16240
  async ready() {
16335
- this.wire.sendAction('snapshot-source-ready').catch((e) => {
16336
- // don't expose, analytics-only call
16337
- });
16241
+ this.wire.recordAnalytic('snapshot-source-ready');
16338
16242
  // eslint-disable-next-line no-async-promise-executor
16339
16243
  try {
16340
16244
  // 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?
@@ -16350,9 +16254,7 @@ class SnapshotSource extends Base {
16350
16254
  *
16351
16255
  */
16352
16256
  async getSnapshot() {
16353
- this.wire.sendAction('snapshot-source-get-snapshot').catch((e) => {
16354
- // don't expose, analytics-only call
16355
- });
16257
+ this.wire.recordAnalytic('snapshot-source-get-snapshot');
16356
16258
  const client = await __classPrivateFieldGet$2(this, _SnapshotSource_getClient, "f").call(this);
16357
16259
  const response = (await client.dispatch('get-snapshot'));
16358
16260
  return (await response).snapshot;
@@ -16362,9 +16264,7 @@ class SnapshotSource extends Base {
16362
16264
  *
16363
16265
  */
16364
16266
  async applySnapshot(snapshot) {
16365
- this.wire.sendAction('snapshot-source-apply-snapshot').catch((e) => {
16366
- // don't expose, analytics-only call
16367
- });
16267
+ this.wire.recordAnalytic('snapshot-source-apply-snapshot');
16368
16268
  const client = await __classPrivateFieldGet$2(this, _SnapshotSource_getClient, "f").call(this);
16369
16269
  return client.dispatch('apply-snapshot', { snapshot });
16370
16270
  }
@@ -16399,9 +16299,7 @@ class SnapshotSourceModule extends Base {
16399
16299
  *
16400
16300
  */
16401
16301
  async init(provider) {
16402
- this.wire.sendAction('snapshot-source-init').catch((e) => {
16403
- // don't expose, analytics-only call
16404
- });
16302
+ this.wire.recordAnalytic('snapshot-source-init');
16405
16303
  if (typeof provider !== 'object' ||
16406
16304
  typeof provider.getSnapshot !== 'function' ||
16407
16305
  typeof provider.applySnapshot !== 'function') {
@@ -16425,9 +16323,7 @@ class SnapshotSourceModule extends Base {
16425
16323
  * ```
16426
16324
  */
16427
16325
  wrapSync(identity) {
16428
- this.wire.sendAction('snapshot-source-wrap-sync').catch((e) => {
16429
- // don't expose, analytics-only call
16430
- });
16326
+ this.wire.recordAnalytic('snapshot-source-wrap-sync');
16431
16327
  return new SnapshotSource(this.wire, identity);
16432
16328
  }
16433
16329
  /**
@@ -16441,9 +16337,7 @@ class SnapshotSourceModule extends Base {
16441
16337
  * ```
16442
16338
  */
16443
16339
  async wrap(identity) {
16444
- this.wire.sendAction('snapshot-source-wrap').catch((e) => {
16445
- // don't expose, analytics-only call
16446
- });
16340
+ this.wire.recordAnalytic('snapshot-source-wrap');
16447
16341
  return this.wrapSync(identity);
16448
16342
  }
16449
16343
  }
@@ -16727,15 +16621,19 @@ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) ||
16727
16621
  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");
16728
16622
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
16729
16623
  };
16730
- var _Transport_wire, _Transport_fin;
16624
+ var _Transport_instances, _Transport_wire, _Transport_analyticsEnabled, _Transport_analyticsBuffer, _Transport_analyticsFlushTimeout, _Transport_fin, _Transport_flushAnalytics;
16731
16625
  class Transport extends events.EventEmitter {
16732
16626
  constructor(factory, environment, config) {
16733
16627
  super();
16628
+ _Transport_instances.add(this);
16734
16629
  this.wireListeners = new Map();
16735
16630
  this.topicRefMap = new Map();
16736
16631
  this.eventAggregator = new EventAggregator();
16737
16632
  this.messageHandlers = [this.eventAggregator.dispatchEvent];
16738
16633
  _Transport_wire.set(this, void 0);
16634
+ _Transport_analyticsEnabled.set(this, true);
16635
+ _Transport_analyticsBuffer.set(this, new Map());
16636
+ _Transport_analyticsFlushTimeout.set(this, void 0);
16739
16637
  // Typing as unknown to avoid circular dependency, should not be used directly.
16740
16638
  _Transport_fin.set(this, void 0);
16741
16639
  this.connectSync = () => {
@@ -16749,6 +16647,7 @@ class Transport extends events.EventEmitter {
16749
16647
  };
16750
16648
  __classPrivateFieldSet(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
16751
16649
  this.environment = environment;
16650
+ __classPrivateFieldSet(this, _Transport_analyticsEnabled, config.apiDiagnostics !== false, "f");
16752
16651
  this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
16753
16652
  this.registerMessageHandler(this.handleMessage.bind(this));
16754
16653
  __classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
@@ -16756,6 +16655,9 @@ class Transport extends events.EventEmitter {
16756
16655
  handleNack({ reason: 'Remote connection has closed' });
16757
16656
  }
16758
16657
  this.wireListeners.clear();
16658
+ clearTimeout(__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f"));
16659
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
16660
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
16759
16661
  this.emit('disconnected');
16760
16662
  });
16761
16663
  const { uuid, name } = config;
@@ -16774,6 +16676,18 @@ class Transport extends events.EventEmitter {
16774
16676
  }
16775
16677
  __classPrivateFieldSet(this, _Transport_fin, _fin, "f");
16776
16678
  }
16679
+ recordAnalytic(action) {
16680
+ if (!__classPrivateFieldGet(this, _Transport_analyticsEnabled, "f"))
16681
+ return;
16682
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").set(action, (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").get(action) ?? 0) + 1);
16683
+ if (__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f") === undefined) {
16684
+ const timeout = setTimeout(() => __classPrivateFieldGet(this, _Transport_instances, "m", _Transport_flushAnalytics).call(this), 30000);
16685
+ if (typeof timeout === 'object' && timeout !== null) {
16686
+ timeout.unref?.();
16687
+ }
16688
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, timeout, "f");
16689
+ }
16690
+ }
16777
16691
  shutdown() {
16778
16692
  const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
16779
16693
  return wire.shutdown();
@@ -16936,7 +16850,16 @@ class Transport extends events.EventEmitter {
16936
16850
  return true;
16937
16851
  }
16938
16852
  }
16939
- _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
16853
+ _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() {
16854
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
16855
+ if (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").size === 0)
16856
+ return;
16857
+ const counts = Object.fromEntries(__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f"));
16858
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
16859
+ this.sendAction('send-analytics-batch', { counts }).catch(() => {
16860
+ // analytics flush failure is non-fatal, counts are already cleared
16861
+ });
16862
+ };
16940
16863
 
16941
16864
  class StubEnvironment {
16942
16865
  constructor() {