@openfin/remote-adapter 44.100.62 → 45.100.18

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.
Files changed (2) hide show
  1. package/out/remote-adapter.js +1509 -1346
  2. package/package.json +5 -5
@@ -20,13 +20,13 @@ var InteropBroker$1 = {};
20
20
 
21
21
  var base = {};
22
22
 
23
- var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
23
+ var __classPrivateFieldSet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
24
24
  if (kind === "m") throw new TypeError("Private method is not writable");
25
25
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
26
26
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
27
27
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
28
28
  };
29
- var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
29
+ var __classPrivateFieldGet$j = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
30
30
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
31
31
  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");
32
32
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -110,9 +110,9 @@ class EmitterBase extends Base {
110
110
  this.emit = (eventType, payload, ...args) => {
111
111
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
112
112
  };
113
- this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
113
+ this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
114
114
  this.getOrCreateEmitter = () => {
115
- return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
115
+ return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
116
116
  };
117
117
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
118
118
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
@@ -150,8 +150,8 @@ class EmitterBase extends Base {
150
150
  // This will only be reached if unsubscribe from event that does not exist but do not want to error here
151
151
  return Promise.resolve();
152
152
  };
153
- __classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
154
- __classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
153
+ __classPrivateFieldSet$i(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
154
+ __classPrivateFieldSet$i(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
155
155
  }
156
156
  /**
157
157
  * Adds a listener to the end of the listeners array for the specified event.
@@ -179,7 +179,7 @@ class EmitterBase extends Base {
179
179
  */
180
180
  async once(eventType, listener, options) {
181
181
  const deregister = () => this.deregisterEventListener(eventType);
182
- __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
182
+ __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
183
183
  await this.registerEventListener(eventType, options, (emitter) => {
184
184
  emitter.once(eventType, deregister);
185
185
  emitter.once(eventType, listener);
@@ -210,7 +210,7 @@ class EmitterBase extends Base {
210
210
  */
211
211
  async prependOnceListener(eventType, listener, options) {
212
212
  const deregister = () => this.deregisterEventListener(eventType);
213
- __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
213
+ __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
214
214
  await this.registerEventListener(eventType, options, (emitter) => {
215
215
  emitter.prependOnceListener(eventType, listener);
216
216
  emitter.once(eventType, deregister);
@@ -229,7 +229,7 @@ class EmitterBase extends Base {
229
229
  const emitter = await this.deregisterEventListener(eventType, options);
230
230
  if (emitter) {
231
231
  emitter.removeListener(eventType, listener);
232
- const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
232
+ const deregister = __classPrivateFieldGet$j(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
233
233
  if (deregister) {
234
234
  emitter.removeListener(eventType, deregister);
235
235
  }
@@ -275,7 +275,7 @@ class EmitterBase extends Base {
275
275
  deleteEmitterIfNothingRegistered(emitter) {
276
276
  // TODO: maybe emitterMap should clean up itself..
277
277
  if (emitter.eventNames().length === 0) {
278
- this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
278
+ this.wire.eventAggregator.delete(__classPrivateFieldGet$j(this, _EmitterBase_emitterAccessor, "f"));
279
279
  }
280
280
  }
281
281
  }
@@ -808,13 +808,13 @@ class AsyncRetryableLazy {
808
808
  }
809
809
  lazy.AsyncRetryableLazy = AsyncRetryableLazy;
810
810
 
811
- var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
811
+ var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
812
812
  if (kind === "m") throw new TypeError("Private method is not writable");
813
813
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
814
814
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
815
815
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
816
816
  };
817
- var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
817
+ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
818
818
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
819
819
  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");
820
820
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -825,7 +825,7 @@ var __importDefault$7 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
825
825
  var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
826
826
  Object.defineProperty(InteropBroker$1, "__esModule", { value: true });
827
827
  InteropBroker$1.InteropBroker = void 0;
828
- const base_1$n = base;
828
+ const base_1$p = base;
829
829
  const SessionContextGroupBroker_1 = __importDefault$7(SessionContextGroupBroker$1);
830
830
  const utils_1$7 = utils$3;
831
831
  const isEqual_1$2 = __importDefault$7(require$$3);
@@ -994,7 +994,7 @@ const defaultContextGroups = [
994
994
  * ---
995
995
  *
996
996
  */
997
- class InteropBroker extends base_1$n.Base {
997
+ class InteropBroker extends base_1$p.Base {
998
998
  /**
999
999
  * @internal
1000
1000
  */
@@ -1005,12 +1005,12 @@ class InteropBroker extends base_1$n.Base {
1005
1005
  _InteropBroker_contextGroups.set(this, void 0);
1006
1006
  _InteropBroker_providerPromise.set(this, void 0);
1007
1007
  this.getProvider = () => {
1008
- return __classPrivateFieldGet$h(this, _InteropBroker_providerPromise, "f").getValue();
1008
+ return __classPrivateFieldGet$i(this, _InteropBroker_providerPromise, "f").getValue();
1009
1009
  };
1010
1010
  this.interopClients = new Map();
1011
1011
  this.contextGroupsById = new Map();
1012
- __classPrivateFieldSet$g(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
1013
- __classPrivateFieldSet$g(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
1012
+ __classPrivateFieldSet$h(this, _InteropBroker_contextGroups, options.contextGroups ?? [...defaultContextGroups], "f");
1013
+ __classPrivateFieldSet$h(this, _InteropBroker_fdc3Info, options.fdc3Info, "f");
1014
1014
  if (options?.logging) {
1015
1015
  this.logging = options.logging;
1016
1016
  }
@@ -1018,7 +1018,7 @@ class InteropBroker extends base_1$n.Base {
1018
1018
  this.lastContextMap = new Map();
1019
1019
  this.sessionContextGroupMap = new Map();
1020
1020
  this.privateChannelProviderMap = new Map();
1021
- __classPrivateFieldSet$g(this, _InteropBroker_providerPromise, new lazy_1$3.Lazy(createProvider), "f");
1021
+ __classPrivateFieldSet$h(this, _InteropBroker_providerPromise, new lazy_1$3.Lazy(createProvider), "f");
1022
1022
  this.setContextGroupMap();
1023
1023
  this.setupChannelProvider();
1024
1024
  }
@@ -1190,8 +1190,8 @@ class InteropBroker extends base_1$n.Base {
1190
1190
  if (!this.getContextGroups().find((contextGroupInfo) => contextGroupInfo.id === contextGroupId)) {
1191
1191
  throw new Error(`Attempting to join a context group that does not exist: ${contextGroupId}. You may only join existing context groups.`);
1192
1192
  }
1193
- const oldContextGroupId = clientSubscriptionState.contextGroupId;
1194
- if (oldContextGroupId !== contextGroupId) {
1193
+ const previousContextGroupId = clientSubscriptionState.contextGroupId;
1194
+ if (previousContextGroupId !== contextGroupId) {
1195
1195
  clientSubscriptionState.contextGroupId = contextGroupId;
1196
1196
  await this.setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId);
1197
1197
  const contextGroupMap = this.contextGroupsById.get(contextGroupId);
@@ -1210,6 +1210,13 @@ class InteropBroker extends base_1$n.Base {
1210
1210
  }
1211
1211
  }
1212
1212
  }
1213
+ // All settled will suppress uncaught exceptions. We don't want to await this because it could
1214
+ // result in the operation hanging.
1215
+ Promise.allSettled(this.channel.publish('client-changed-context-group', {
1216
+ identity: clientIdentity,
1217
+ contextGroupId,
1218
+ previousContextGroupId: previousContextGroupId || null
1219
+ }));
1213
1220
  }
1214
1221
  }
1215
1222
  // Removes the target from its context group. Similar structure to joinContextGroup.
@@ -1269,10 +1276,18 @@ class InteropBroker extends base_1$n.Base {
1269
1276
  // don't expose, analytics-only call
1270
1277
  });
1271
1278
  const clientState = this.getClientState(clientIdentity);
1279
+ const previousContextGroupId = clientState?.contextGroupId;
1272
1280
  if (clientState) {
1273
1281
  clientState.contextGroupId = undefined;
1274
1282
  }
1275
1283
  await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
1284
+ // All settled will suppress uncaught exceptions. We don't want to await this because it could
1285
+ // result in the operation hanging.
1286
+ Promise.allSettled(this.channel.publish('client-changed-context-group', {
1287
+ identity: clientIdentity,
1288
+ contextGroupId: null,
1289
+ previousContextGroupId: previousContextGroupId || null
1290
+ }));
1276
1291
  }
1277
1292
  // Used by platform windows to know what client groups the provider has declared. Also used internally to access context groups. Overrideable so that the platform developer can modify it.
1278
1293
  /**
@@ -1286,7 +1301,7 @@ class InteropBroker extends base_1$n.Base {
1286
1301
  // don't expose, analytics-only call
1287
1302
  });
1288
1303
  // Create copy for immutability
1289
- return __classPrivateFieldGet$h(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
1304
+ return __classPrivateFieldGet$i(this, _InteropBroker_contextGroups, "f").map((contextGroup) => {
1290
1305
  return { ...contextGroup };
1291
1306
  });
1292
1307
  }
@@ -1697,7 +1712,7 @@ class InteropBroker extends base_1$n.Base {
1697
1712
  const { fdc3Version } = payload;
1698
1713
  return {
1699
1714
  fdc3Version,
1700
- ...__classPrivateFieldGet$h(this, _InteropBroker_fdc3Info, "f"),
1715
+ ...__classPrivateFieldGet$i(this, _InteropBroker_fdc3Info, "f"),
1701
1716
  optionalFeatures: {
1702
1717
  OriginatingAppMetadata: false,
1703
1718
  UserChannelMembershipAPIs: true
@@ -2551,11 +2566,11 @@ const handleDeprecatedWarnings = (options) => {
2551
2566
  };
2552
2567
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
2553
2568
 
2554
- var hasRequiredFactory$2;
2569
+ var hasRequiredFactory$1;
2555
2570
 
2556
- function requireFactory$2 () {
2557
- if (hasRequiredFactory$2) return Factory$8;
2558
- hasRequiredFactory$2 = 1;
2571
+ function requireFactory$1 () {
2572
+ if (hasRequiredFactory$1) return Factory$8;
2573
+ hasRequiredFactory$1 = 1;
2559
2574
  Object.defineProperty(Factory$8, "__esModule", { value: true });
2560
2575
  Factory$8.ViewModule = void 0;
2561
2576
  const base_1 = base;
@@ -2714,8 +2729,8 @@ var main = {};
2714
2729
 
2715
2730
  Object.defineProperty(main, "__esModule", { value: true });
2716
2731
  main.WebContents = void 0;
2717
- const base_1$m = base;
2718
- class WebContents extends base_1$m.EmitterBase {
2732
+ const base_1$o = base;
2733
+ class WebContents extends base_1$o.EmitterBase {
2719
2734
  /**
2720
2735
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
2721
2736
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -3808,1154 +3823,1133 @@ var Factory$6 = {};
3808
3823
 
3809
3824
  var Instance$5 = {};
3810
3825
 
3811
- var hasRequiredInstance$2;
3812
-
3813
- function requireInstance$2 () {
3814
- if (hasRequiredInstance$2) return Instance$5;
3815
- hasRequiredInstance$2 = 1;
3816
- Object.defineProperty(Instance$5, "__esModule", { value: true });
3817
- Instance$5.Application = void 0;
3818
- /* eslint-disable import/prefer-default-export */
3819
- const base_1 = base;
3820
- const window_1 = requireWindow();
3821
- const view_1 = requireView();
3822
- /**
3823
- * An object representing an application. Allows the developer to create,
3824
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
3825
- */
3826
- class Application extends base_1.EmitterBase {
3827
- /**
3828
- * @internal
3829
- */
3830
- constructor(wire, identity) {
3831
- super(wire, 'application', identity.uuid);
3832
- this.identity = identity;
3833
- this.window = new window_1._Window(this.wire, {
3834
- uuid: this.identity.uuid,
3835
- name: this.identity.uuid
3836
- });
3837
- }
3838
- windowListFromIdentityList(identityList) {
3839
- const windowList = [];
3840
- identityList.forEach((identity) => {
3841
- windowList.push(new window_1._Window(this.wire, {
3842
- uuid: identity.uuid,
3843
- name: identity.name
3844
- }));
3845
- });
3846
- return windowList;
3847
- }
3848
- /**
3849
- * Determines if the application is currently running.
3850
- *
3851
- * @example
3852
- *
3853
- * ```js
3854
- * async function isAppRunning() {
3855
- * const app = await fin.Application.getCurrent();
3856
- * return await app.isRunning();
3857
- * }
3858
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
3859
- * ```
3860
- */
3861
- isRunning() {
3862
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
3863
- }
3864
- /**
3865
- * Closes the application and any child windows created by the application.
3866
- * Cleans the application from state so it is no longer found in getAllApplications.
3867
- * @param force Close will be prevented from closing when force is false and
3868
- * ‘close-requested’ has been subscribed to for application’s main window.
3869
- *
3870
- * @example
3871
- *
3872
- * ```js
3873
- * async function closeApp() {
3874
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
3875
- * const app = await fin.Application.wrap({uuid: 'app2'});
3876
- * await app.quit();
3877
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
3878
- *
3879
- * }
3880
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
3881
- * ```
3882
- */
3883
- async quit(force = false) {
3884
- try {
3885
- await this._close(force);
3886
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
3887
- }
3888
- catch (error) {
3889
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
3890
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
3891
- throw error;
3892
- }
3893
- }
3894
- }
3895
- async _close(force = false) {
3896
- try {
3897
- await this.wire.sendAction('close-application', { force, ...this.identity });
3898
- }
3899
- catch (error) {
3900
- if (!error.message.includes('Remote connection has closed')) {
3901
- throw error;
3902
- }
3903
- }
3904
- }
3905
- /**
3906
- * @deprecated use Application.quit instead
3907
- * Closes the application and any child windows created by the application.
3908
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
3909
- * @param callback - called if the method succeeds.
3910
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3911
- *
3912
- * @example
3913
- *
3914
- * ```js
3915
- * async function closeApp() {
3916
- * const app = await fin.Application.getCurrent();
3917
- * return await app.close();
3918
- * }
3919
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
3920
- * ```
3921
- */
3922
- close(force = false) {
3923
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
3924
- this.wire.sendAction('application-close', this.identity).catch((e) => {
3925
- // we do not want to expose this error, just continue if this analytics-only call fails
3926
- });
3927
- return this._close(force);
3928
- }
3929
- /**
3930
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
3931
- *
3932
- * @example
3933
- *
3934
- * ```js
3935
- * async function getChildWindows() {
3936
- * const app = await fin.Application.getCurrent();
3937
- * return await app.getChildWindows();
3938
- * }
3939
- *
3940
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
3941
- * ```
3942
- */
3943
- getChildWindows() {
3944
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
3945
- const identityList = [];
3946
- payload.data.forEach((winName) => {
3947
- identityList.push({ uuid: this.identity.uuid, name: winName });
3948
- });
3949
- return this.windowListFromIdentityList(identityList);
3950
- });
3951
- }
3952
- /**
3953
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
3954
- * if the application was not created from a manifest.
3955
- *
3956
- * @example
3957
- *
3958
- * ```js
3959
- * async function getManifest() {
3960
- * const app = await fin.Application.getCurrent();
3961
- * return await app.getManifest();
3962
- * }
3963
- *
3964
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
3965
- * ```
3966
- */
3967
- getManifest() {
3968
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
3969
- }
3970
- /**
3971
- * Retrieves UUID of the application that launches this application. Invokes the error callback
3972
- * if the application was created from a manifest.
3973
- *
3974
- * @example
3975
- *
3976
- * ```js
3977
- * async function getParentUuid() {
3978
- * const app = await fin.Application.start({
3979
- * uuid: 'app-1',
3980
- * name: 'myApp',
3981
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
3982
- * autoShow: true
3983
- * });
3984
- * return await app.getParentUuid();
3985
- * }
3986
- *
3987
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
3988
- * ```
3989
- */
3990
- getParentUuid() {
3991
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
3992
- }
3993
- /**
3994
- * Retrieves current application's shortcut configuration.
3995
- *
3996
- * @example
3997
- *
3998
- * ```js
3999
- * async function getShortcuts() {
4000
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
4001
- * return await app.getShortcuts();
4002
- * }
4003
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
4004
- * ```
4005
- */
4006
- getShortcuts() {
4007
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
4008
- }
4009
- /**
4010
- * Retrieves current application's views.
4011
- * @experimental
4012
- *
4013
- * @example
4014
- *
4015
- * ```js
4016
- * async function getViews() {
4017
- * const app = await fin.Application.getCurrent();
4018
- * return await app.getViews();
4019
- * }
4020
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
4021
- * ```
4022
- */
4023
- async getViews() {
4024
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
4025
- return payload.data.map((id) => new view_1.View(this.wire, id));
4026
- }
4027
- /**
4028
- * Returns the current zoom level of the application.
4029
- *
4030
- * @example
4031
- *
4032
- * ```js
4033
- * async function getZoomLevel() {
4034
- * const app = await fin.Application.getCurrent();
4035
- * return await app.getZoomLevel();
4036
- * }
4037
- *
4038
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
4039
- * ```
4040
- */
4041
- getZoomLevel() {
4042
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
4043
- }
4044
- /**
4045
- * Returns an instance of the main Window of the application
4046
- *
4047
- * @example
4048
- *
4049
- * ```js
4050
- * async function getWindow() {
4051
- * const app = await fin.Application.start({
4052
- * uuid: 'app-1',
4053
- * name: 'myApp',
4054
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
4055
- * autoShow: true
4056
- * });
4057
- * return await app.getWindow();
4058
- * }
4059
- *
4060
- * getWindow().then(win => {
4061
- * win.showAt(0, 400);
4062
- * win.flash();
4063
- * }).catch(err => console.log(err));
4064
- * ```
4065
- */
4066
- getWindow() {
4067
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
4068
- // we do not want to expose this error, just continue if this analytics-only call fails
4069
- });
4070
- return Promise.resolve(this.window);
4071
- }
4072
- /**
4073
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
4074
- * @param userName - username to be passed to the RVM.
4075
- * @param appName - app name to be passed to the RVM.
4076
- *
4077
- * @example
4078
- *
4079
- * ```js
4080
- * async function registerUser() {
4081
- * const app = await fin.Application.getCurrent();
4082
- * return await app.registerUser('user', 'myApp');
4083
- * }
4084
- *
4085
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
4086
- * ```
4087
- */
4088
- registerUser(userName, appName) {
4089
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
4090
- }
4091
- /**
4092
- * Removes the application’s icon from the tray.
4093
- *
4094
- * @example
4095
- *
4096
- * ```js
4097
- * async function removeTrayIcon() {
4098
- * const app = await fin.Application.getCurrent();
4099
- * return await app.removeTrayIcon();
4100
- * }
4101
- *
4102
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
4103
- * ```
4104
- */
4105
- removeTrayIcon() {
4106
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
4107
- }
4108
- /**
4109
- * Restarts the application.
4110
- *
4111
- * @example
4112
- *
4113
- * ```js
4114
- * async function restartApp() {
4115
- * const app = await fin.Application.getCurrent();
4116
- * return await app.restart();
4117
- * }
4118
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
4119
- * ```
4120
- */
4121
- restart() {
4122
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
4123
- }
4124
- /**
4125
- * DEPRECATED method to run the application.
4126
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
4127
- *
4128
- * @example
4129
- *
4130
- * ```js
4131
- * async function run() {
4132
- * const app = await fin.Application.create({
4133
- * name: 'myApp',
4134
- * uuid: 'app-1',
4135
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
4136
- * autoShow: true
4137
- * });
4138
- * await app.run();
4139
- * }
4140
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
4141
- * ```
4142
- *
4143
- * @ignore
4144
- */
4145
- run() {
4146
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
4147
- this.wire.sendAction('application-run', this.identity).catch((e) => {
4148
- // we do not want to expose this error, just continue if this analytics-only call fails
4149
- });
4150
- return this._run();
4151
- }
4152
- _run(opts = {}) {
4153
- return this.wire
4154
- .sendAction('run-application', {
4155
- manifestUrl: this._manifestUrl,
4156
- opts,
4157
- ...this.identity
4158
- })
4159
- .then(() => undefined);
4160
- }
4161
- /**
4162
- * Instructs the RVM to schedule one restart of the application.
4163
- *
4164
- * @example
4165
- *
4166
- * ```js
4167
- * async function scheduleRestart() {
4168
- * const app = await fin.Application.getCurrent();
4169
- * return await app.scheduleRestart();
4170
- * }
4171
- *
4172
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
4173
- * ```
4174
- */
4175
- scheduleRestart() {
4176
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
4177
- }
4178
- /**
4179
- * Sends a message to the RVM to upload the application's logs. On success,
4180
- * an object containing logId is returned.
4181
- *
4182
- * @example
4183
- *
4184
- * ```js
4185
- * async function sendLog() {
4186
- * const app = await fin.Application.getCurrent();
4187
- * return await app.sendApplicationLog();
4188
- * }
4189
- *
4190
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
4191
- * ```
4192
- */
4193
- async sendApplicationLog() {
4194
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
4195
- return payload.data;
4196
- }
4197
- /**
4198
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
4199
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
4200
- *
4201
- * Note: If the "name" property is omitted it defaults to "tasks".
4202
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
4203
- *
4204
- *
4205
- * @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
4206
- *
4207
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
4208
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
4209
- *
4210
- * Note: If the "name" property is omitted it defaults to "tasks".
4211
- *
4212
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
4213
- * uuid or shortcut.name is changed.
4214
- *
4215
- * @example
4216
- *
4217
- * ```js
4218
- * const app = fin.Application.getCurrentSync();
4219
- * const appName = 'My App';
4220
- * const jumpListConfig = [ // array of JumpList categories
4221
- * {
4222
- * // has no name and no type so `type` is assumed to be "tasks"
4223
- * items: [ // array of JumpList items
4224
- * {
4225
- * type: 'task',
4226
- * title: `Launch ${appName}`,
4227
- * description: `Runs ${appName} with the default configuration`,
4228
- * deepLink: 'fins://path.to/app/manifest.json',
4229
- * iconPath: 'https://path.to/app/icon.ico',
4230
- * iconIndex: 0
4231
- * },
4232
- * { type: 'separator' },
4233
- * {
4234
- * type: 'task',
4235
- * title: `Restore ${appName}`,
4236
- * description: 'Restore to last configuration',
4237
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
4238
- * iconPath: 'https://path.to/app/icon.ico',
4239
- * iconIndex: 0
4240
- * },
4241
- * ]
4242
- * },
4243
- * {
4244
- * name: 'Tools',
4245
- * items: [ // array of JumpList items
4246
- * {
4247
- * type: 'task',
4248
- * title: 'Tool A',
4249
- * description: 'Runs Tool A',
4250
- * deepLink: 'fins://path.to/tool-a/manifest.json',
4251
- * iconPath: 'https://path.to/tool-a/icon.ico',
4252
- * iconIndex: 0
4253
- * },
4254
- * {
4255
- * type: 'task',
4256
- * title: 'Tool B',
4257
- * description: 'Runs Tool B',
4258
- * deepLink: 'fins://path.to/tool-b/manifest.json',
4259
- * iconPath: 'https://path.to/tool-b/icon.ico',
4260
- * iconIndex: 0
4261
- * }]
4262
- * }
4263
- * ];
4264
- *
4265
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
4266
- * ```
4267
- *
4268
- * To handle deeplink args:
4269
- * ```js
4270
- * function handleUseLastConfiguration() {
4271
- * // this handler is called when the app is being launched
4272
- * app.on('run-requested', event => {
4273
- * if(event.userAppConfigArgs['use-last-configuration']) {
4274
- * // your logic here
4275
- * }
4276
- * });
4277
- * // this handler is called when the app was already running when the launch was requested
4278
- * fin.desktop.main(function(args) {
4279
- * if(args && args['use-last-configuration']) {
4280
- * // your logic here
4281
- * }
4282
- * });
4283
- * }
4284
- * ```
4285
- */
4286
- async setJumpList(jumpListCategories) {
4287
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
4288
- }
4289
- /**
4290
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
4291
- * @param icon Image URL or base64 encoded string to be used as the icon
4292
- *
4293
- * @example
4294
- *
4295
- * ```js
4296
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4297
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
4298
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
4299
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
4300
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
4301
- *
4302
- * async function setTrayIcon(icon) {
4303
- * const app = await fin.Application.getCurrent();
4304
- * return await app.setTrayIcon(icon);
4305
- * }
4306
- *
4307
- * // use image url to set tray icon
4308
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4309
- *
4310
- * // use base64 encoded string to set tray icon
4311
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4312
- *
4313
- * // use a dataURL to set tray icon
4314
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4315
- * ```
4316
- */
4317
- setTrayIcon(icon) {
4318
- return this.wire
4319
- .sendAction('set-tray-icon', {
4320
- enabledIcon: icon,
4321
- ...this.identity
4322
- })
4323
- .then(() => undefined);
4324
- }
4325
- /**
4326
- * Set hover text for this application's system tray icon.
4327
- * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
4328
- * @param toolTip
4329
- *
4330
- * @example
4331
- *
4332
- * ```js
4333
- * const app = fin.Application.getCurrentSync();
4334
- * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4335
- *
4336
- * await app.setTrayIcon(iconUrl);
4337
- *
4338
- * await app.setTrayIconToolTip('My Application');
4339
- * ```
4340
- */
4341
- async setTrayIconToolTip(toolTip) {
4342
- await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
4343
- }
4344
- /**
4345
- * Sets new application's shortcut configuration. Windows only.
4346
- * @param config New application's shortcut configuration.
4347
- *
4348
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
4349
- * to be able to change shortcut states.
4350
- *
4351
- * @example
4352
- *
4353
- * ```js
4354
- * async function setShortcuts(config) {
4355
- * const app = await fin.Application.getCurrent();
4356
- * return app.setShortcuts(config);
4357
- * }
4358
- *
4359
- * setShortcuts({
4360
- * desktop: true,
4361
- * startMenu: false,
4362
- * systemStartup: true
4363
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
4364
- * ```
4365
- */
4366
- setShortcuts(config) {
4367
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
4368
- }
4369
- /**
4370
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
4371
- * @param queryString The new query string for this app's shortcuts.
4372
- *
4373
- * @example
4374
- *
4375
- * ```js
4376
- * const newQueryArgs = 'arg=true&arg2=false';
4377
- * const app = await fin.Application.getCurrent();
4378
- * try {
4379
- * await app.setShortcutQueryParams(newQueryArgs);
4380
- * } catch(err) {
4381
- * console.error(err)
4382
- * }
4383
- * ```
4384
- */
4385
- async setShortcutQueryParams(queryString) {
4386
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
4387
- }
4388
- /**
4389
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
4390
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
4391
- * @param level The zoom level
4392
- *
4393
- * @example
4394
- *
4395
- * ```js
4396
- * async function setZoomLevel(number) {
4397
- * const app = await fin.Application.getCurrent();
4398
- * return await app.setZoomLevel(number);
4399
- * }
4400
- *
4401
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
4402
- * ```
4403
- */
4404
- setZoomLevel(level) {
4405
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
4406
- }
4407
- /**
4408
- * Sets a username to correlate with App Log Management.
4409
- * @param username Username to correlate with App's Log.
4410
- *
4411
- * @example
4412
- *
4413
- * ```js
4414
- * async function setAppLogUser() {
4415
- * const app = await fin.Application.getCurrent();
4416
- * return await app.setAppLogUsername('username');
4417
- * }
4418
- *
4419
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
4420
- *
4421
- * ```
4422
- */
4423
- async setAppLogUsername(username) {
4424
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
4425
- }
4426
- /**
4427
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
4428
- * @remarks The only information currently returned is the position and dimensions.
4429
- *
4430
- * @example
4431
- *
4432
- * ```js
4433
- * async function getTrayIconInfo() {
4434
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
4435
- * return await app.getTrayIconInfo();
4436
- * }
4437
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
4438
- * ```
4439
- */
4440
- getTrayIconInfo() {
4441
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
4442
- }
4443
- /**
4444
- * Checks if the application has an associated tray icon.
4445
- *
4446
- * @example
4447
- *
4448
- * ```js
4449
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
4450
- * const hasTrayIcon = await app.hasTrayIcon();
4451
- * console.log(hasTrayIcon);
4452
- * ```
4453
- */
4454
- hasTrayIcon() {
4455
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
4456
- }
4457
- /**
4458
- * Closes the application by terminating its process.
4459
- *
4460
- * @example
4461
- *
4462
- * ```js
4463
- * async function terminateApp() {
4464
- * const app = await fin.Application.getCurrent();
4465
- * return await app.terminate();
4466
- * }
4467
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
4468
- * ```
4469
- */
4470
- terminate() {
4471
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
4472
- }
4473
- /**
4474
- * Waits for a hanging application. This method can be called in response to an application
4475
- * "not-responding" to allow the application to continue and to generate another "not-responding"
4476
- * message after a certain period of time.
4477
- *
4478
- * @ignore
4479
- */
4480
- wait() {
4481
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
4482
- }
4483
- /**
4484
- * Retrieves information about the application.
4485
- *
4486
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
4487
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
4488
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
4489
- *
4490
- * @example
4491
- *
4492
- * ```js
4493
- * async function getInfo() {
4494
- * const app = await fin.Application.getCurrent();
4495
- * return await app.getInfo();
4496
- * }
4497
- *
4498
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
4499
- * ```
4500
- */
4501
- getInfo() {
4502
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
4503
- }
4504
- /**
4505
- * Retrieves all process information for entities (windows and views) associated with an application.
4506
- *
4507
- * @example
4508
- * ```js
4509
- * const app = await fin.Application.getCurrent();
4510
- * const processInfo = await app.getProcessInfo();
4511
- * ```
4512
- * @experimental
4513
- */
4514
- async getProcessInfo() {
4515
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
4516
- return data;
4517
- }
4518
- /**
4519
- * Sets file auto download location. It's only allowed in the same application.
4520
- *
4521
- * Note: This method is restricted by default and must be enabled via
4522
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4523
- * @param downloadLocation file auto download location
4524
- *
4525
- * @throws if setting file auto download location on different applications.
4526
- * @example
4527
- *
4528
- * ```js
4529
- * const downloadLocation = 'C:\\dev\\temp';
4530
- * const app = await fin.Application.getCurrent();
4531
- * try {
4532
- * await app.setFileDownloadLocation(downloadLocation);
4533
- * console.log('File download location is set');
4534
- * } catch(err) {
4535
- * console.error(err)
4536
- * }
4537
- * ```
4538
- */
4539
- async setFileDownloadLocation(downloadLocation) {
4540
- const { name } = this.wire.me;
4541
- const entityIdentity = { uuid: this.identity.uuid, name };
4542
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
4543
- }
4544
- /**
4545
- * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
4546
- *
4547
- * Note: This method is restricted by default and must be enabled via
4548
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4549
- *
4550
- * @throws if getting file auto download location on different applications.
4551
- * @example
4552
- *
4553
- * ```js
4554
- * const app = await fin.Application.getCurrent();
4555
- * const fileDownloadDir = await app.getFileDownloadLocation();
4556
- * ```
4557
- */
4558
- async getFileDownloadLocation() {
4559
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
4560
- return data;
4561
- }
4562
- /**
4563
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
4564
- * @param options
4565
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
4566
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
4567
- * of all possible data shapes for the entire menu, and the click handler should process
4568
- * these with a "reducer" pattern.
4569
- * @throws if the application has no tray icon set
4570
- * @throws if the system tray is currently hidden
4571
- * @example
4572
- *
4573
- * ```js
4574
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
4575
- * const app = fin.Application.getCurrentSync();
4576
- *
4577
- * await app.setTrayIcon(iconUrl);
4578
- *
4579
- * const template = [
4580
- * {
4581
- * label: 'Menu Item 1',
4582
- * data: 'hello from item 1'
4583
- * },
4584
- * { type: 'separator' },
4585
- * {
4586
- * label: 'Menu Item 2',
4587
- * type: 'checkbox',
4588
- * checked: true,
4589
- * data: 'The user clicked the checkbox'
4590
- * },
4591
- * {
4592
- * label: 'see more',
4593
- * enabled: false,
4594
- * submenu: [
4595
- * { label: 'submenu 1', data: 'hello from submenu' }
4596
- * ]
4597
- * }
4598
- * ];
4599
- *
4600
- * app.addListener('tray-icon-clicked', (event) => {
4601
- * // right-click
4602
- * if (event.button === 2) {
4603
- * app.showTrayIconPopupMenu({ template }).then(r => {
4604
- * if (r.result === 'closed') {
4605
- * console.log('nothing happened');
4606
- * } else {
4607
- * console.log(r.data);
4608
- * }
4609
- * });
4610
- * }
4611
- * });
4612
- * ```
4613
- */
4614
- async showTrayIconPopupMenu(options) {
4615
- const { name } = this.wire.me;
4616
- const entityIdentity = { uuid: this.identity.uuid, name };
4617
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
4618
- return payload.data;
4619
- }
4620
- /**
4621
- * Closes the tray icon menu.
4622
- *
4623
- * @throws if the application has no tray icon set
4624
- * @example
4625
- *
4626
- * ```js
4627
- * const app = fin.Application.getCurrentSync();
4628
- *
4629
- * await app.closeTrayIconPopupMenu();
4630
- * ```
4631
- */
4632
- async closeTrayIconPopupMenu() {
4633
- const { name } = this.wire.me;
4634
- const entityIdentity = { uuid: this.identity.uuid, name };
4635
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
4636
- }
4637
- }
4638
- Instance$5.Application = Application;
4639
- return Instance$5;
3826
+ Object.defineProperty(Instance$5, "__esModule", { value: true });
3827
+ Instance$5.Application = void 0;
3828
+ /* eslint-disable import/prefer-default-export */
3829
+ const base_1$n = base;
3830
+ const window_1$1 = requireWindow();
3831
+ const view_1 = requireView();
3832
+ /**
3833
+ * An object representing an application. Allows the developer to create,
3834
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
3835
+ */
3836
+ class Application extends base_1$n.EmitterBase {
3837
+ /**
3838
+ * @internal
3839
+ */
3840
+ constructor(wire, identity) {
3841
+ super(wire, 'application', identity.uuid);
3842
+ this.identity = identity;
3843
+ this.window = new window_1$1._Window(this.wire, {
3844
+ uuid: this.identity.uuid,
3845
+ name: this.identity.uuid
3846
+ });
3847
+ }
3848
+ windowListFromIdentityList(identityList) {
3849
+ const windowList = [];
3850
+ identityList.forEach((identity) => {
3851
+ windowList.push(new window_1$1._Window(this.wire, {
3852
+ uuid: identity.uuid,
3853
+ name: identity.name
3854
+ }));
3855
+ });
3856
+ return windowList;
3857
+ }
3858
+ /**
3859
+ * Determines if the application is currently running.
3860
+ *
3861
+ * @example
3862
+ *
3863
+ * ```js
3864
+ * async function isAppRunning() {
3865
+ * const app = await fin.Application.getCurrent();
3866
+ * return await app.isRunning();
3867
+ * }
3868
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
3869
+ * ```
3870
+ */
3871
+ isRunning() {
3872
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
3873
+ }
3874
+ /**
3875
+ * Closes the application and any child windows created by the application.
3876
+ * Cleans the application from state so it is no longer found in getAllApplications.
3877
+ * @param force Close will be prevented from closing when force is false and
3878
+ * ‘close-requested’ has been subscribed to for application’s main window.
3879
+ *
3880
+ * @example
3881
+ *
3882
+ * ```js
3883
+ * async function closeApp() {
3884
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
3885
+ * const app = await fin.Application.wrap({uuid: 'app2'});
3886
+ * await app.quit();
3887
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
3888
+ *
3889
+ * }
3890
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
3891
+ * ```
3892
+ */
3893
+ async quit(force = false) {
3894
+ try {
3895
+ await this._close(force);
3896
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
3897
+ }
3898
+ catch (error) {
3899
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
3900
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
3901
+ throw error;
3902
+ }
3903
+ }
3904
+ }
3905
+ async _close(force = false) {
3906
+ try {
3907
+ await this.wire.sendAction('close-application', { force, ...this.identity });
3908
+ }
3909
+ catch (error) {
3910
+ if (!error.message.includes('Remote connection has closed')) {
3911
+ throw error;
3912
+ }
3913
+ }
3914
+ }
3915
+ /**
3916
+ * @deprecated use Application.quit instead
3917
+ * Closes the application and any child windows created by the application.
3918
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
3919
+ * @param callback - called if the method succeeds.
3920
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3921
+ *
3922
+ * @example
3923
+ *
3924
+ * ```js
3925
+ * async function closeApp() {
3926
+ * const app = await fin.Application.getCurrent();
3927
+ * return await app.close();
3928
+ * }
3929
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
3930
+ * ```
3931
+ */
3932
+ close(force = false) {
3933
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
3934
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
3935
+ // we do not want to expose this error, just continue if this analytics-only call fails
3936
+ });
3937
+ return this._close(force);
3938
+ }
3939
+ /**
3940
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
3941
+ *
3942
+ * @example
3943
+ *
3944
+ * ```js
3945
+ * async function getChildWindows() {
3946
+ * const app = await fin.Application.getCurrent();
3947
+ * return await app.getChildWindows();
3948
+ * }
3949
+ *
3950
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
3951
+ * ```
3952
+ */
3953
+ getChildWindows() {
3954
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
3955
+ const identityList = [];
3956
+ payload.data.forEach((winName) => {
3957
+ identityList.push({ uuid: this.identity.uuid, name: winName });
3958
+ });
3959
+ return this.windowListFromIdentityList(identityList);
3960
+ });
3961
+ }
3962
+ /**
3963
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
3964
+ * if the application was not created from a manifest.
3965
+ *
3966
+ * @example
3967
+ *
3968
+ * ```js
3969
+ * async function getManifest() {
3970
+ * const app = await fin.Application.getCurrent();
3971
+ * return await app.getManifest();
3972
+ * }
3973
+ *
3974
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
3975
+ * ```
3976
+ */
3977
+ getManifest() {
3978
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
3979
+ }
3980
+ /**
3981
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
3982
+ * if the application was created from a manifest.
3983
+ *
3984
+ * @example
3985
+ *
3986
+ * ```js
3987
+ * async function getParentUuid() {
3988
+ * const app = await fin.Application.start({
3989
+ * uuid: 'app-1',
3990
+ * name: 'myApp',
3991
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
3992
+ * autoShow: true
3993
+ * });
3994
+ * return await app.getParentUuid();
3995
+ * }
3996
+ *
3997
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
3998
+ * ```
3999
+ */
4000
+ getParentUuid() {
4001
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
4002
+ }
4003
+ /**
4004
+ * Retrieves current application's shortcut configuration.
4005
+ *
4006
+ * @example
4007
+ *
4008
+ * ```js
4009
+ * async function getShortcuts() {
4010
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
4011
+ * return await app.getShortcuts();
4012
+ * }
4013
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
4014
+ * ```
4015
+ */
4016
+ getShortcuts() {
4017
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
4018
+ }
4019
+ /**
4020
+ * Retrieves current application's views.
4021
+ * @experimental
4022
+ *
4023
+ * @example
4024
+ *
4025
+ * ```js
4026
+ * async function getViews() {
4027
+ * const app = await fin.Application.getCurrent();
4028
+ * return await app.getViews();
4029
+ * }
4030
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
4031
+ * ```
4032
+ */
4033
+ async getViews() {
4034
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
4035
+ return payload.data.map((id) => new view_1.View(this.wire, id));
4036
+ }
4037
+ /**
4038
+ * Returns the current zoom level of the application.
4039
+ *
4040
+ * @example
4041
+ *
4042
+ * ```js
4043
+ * async function getZoomLevel() {
4044
+ * const app = await fin.Application.getCurrent();
4045
+ * return await app.getZoomLevel();
4046
+ * }
4047
+ *
4048
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
4049
+ * ```
4050
+ */
4051
+ getZoomLevel() {
4052
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
4053
+ }
4054
+ /**
4055
+ * Returns an instance of the main Window of the application
4056
+ *
4057
+ * @example
4058
+ *
4059
+ * ```js
4060
+ * async function getWindow() {
4061
+ * const app = await fin.Application.start({
4062
+ * uuid: 'app-1',
4063
+ * name: 'myApp',
4064
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
4065
+ * autoShow: true
4066
+ * });
4067
+ * return await app.getWindow();
4068
+ * }
4069
+ *
4070
+ * getWindow().then(win => {
4071
+ * win.showAt(0, 400);
4072
+ * win.flash();
4073
+ * }).catch(err => console.log(err));
4074
+ * ```
4075
+ */
4076
+ getWindow() {
4077
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
4078
+ // we do not want to expose this error, just continue if this analytics-only call fails
4079
+ });
4080
+ return Promise.resolve(this.window);
4081
+ }
4082
+ /**
4083
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
4084
+ * @param userName - username to be passed to the RVM.
4085
+ * @param appName - app name to be passed to the RVM.
4086
+ *
4087
+ * @example
4088
+ *
4089
+ * ```js
4090
+ * async function registerUser() {
4091
+ * const app = await fin.Application.getCurrent();
4092
+ * return await app.registerUser('user', 'myApp');
4093
+ * }
4094
+ *
4095
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
4096
+ * ```
4097
+ */
4098
+ registerUser(userName, appName) {
4099
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
4100
+ }
4101
+ /**
4102
+ * Removes the application’s icon from the tray.
4103
+ *
4104
+ * @example
4105
+ *
4106
+ * ```js
4107
+ * async function removeTrayIcon() {
4108
+ * const app = await fin.Application.getCurrent();
4109
+ * return await app.removeTrayIcon();
4110
+ * }
4111
+ *
4112
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
4113
+ * ```
4114
+ */
4115
+ removeTrayIcon() {
4116
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
4117
+ }
4118
+ /**
4119
+ * Restarts the application.
4120
+ *
4121
+ * @example
4122
+ *
4123
+ * ```js
4124
+ * async function restartApp() {
4125
+ * const app = await fin.Application.getCurrent();
4126
+ * return await app.restart();
4127
+ * }
4128
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
4129
+ * ```
4130
+ */
4131
+ restart() {
4132
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
4133
+ }
4134
+ /**
4135
+ * DEPRECATED method to run the application.
4136
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
4137
+ *
4138
+ * @example
4139
+ *
4140
+ * ```js
4141
+ * async function run() {
4142
+ * const app = await fin.Application.create({
4143
+ * name: 'myApp',
4144
+ * uuid: 'app-1',
4145
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
4146
+ * autoShow: true
4147
+ * });
4148
+ * await app.run();
4149
+ * }
4150
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
4151
+ * ```
4152
+ *
4153
+ * @ignore
4154
+ */
4155
+ run() {
4156
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
4157
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
4158
+ // we do not want to expose this error, just continue if this analytics-only call fails
4159
+ });
4160
+ return this._run();
4161
+ }
4162
+ _run(opts = {}) {
4163
+ return this.wire
4164
+ .sendAction('run-application', {
4165
+ manifestUrl: this._manifestUrl,
4166
+ opts,
4167
+ ...this.identity
4168
+ })
4169
+ .then(() => undefined);
4170
+ }
4171
+ /**
4172
+ * Instructs the RVM to schedule one restart of the application.
4173
+ *
4174
+ * @example
4175
+ *
4176
+ * ```js
4177
+ * async function scheduleRestart() {
4178
+ * const app = await fin.Application.getCurrent();
4179
+ * return await app.scheduleRestart();
4180
+ * }
4181
+ *
4182
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
4183
+ * ```
4184
+ */
4185
+ scheduleRestart() {
4186
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
4187
+ }
4188
+ /**
4189
+ * Sends a message to the RVM to upload the application's logs. On success,
4190
+ * an object containing logId is returned.
4191
+ *
4192
+ * @example
4193
+ *
4194
+ * ```js
4195
+ * async function sendLog() {
4196
+ * const app = await fin.Application.getCurrent();
4197
+ * return await app.sendApplicationLog();
4198
+ * }
4199
+ *
4200
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
4201
+ * ```
4202
+ */
4203
+ async sendApplicationLog() {
4204
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
4205
+ return payload.data;
4206
+ }
4207
+ /**
4208
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
4209
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
4210
+ *
4211
+ * Note: If the "name" property is omitted it defaults to "tasks".
4212
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
4213
+ *
4214
+ *
4215
+ * @remarks If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
4216
+ *
4217
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
4218
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
4219
+ *
4220
+ * Note: If the "name" property is omitted it defaults to "tasks".
4221
+ *
4222
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
4223
+ * uuid or shortcut.name is changed.
4224
+ *
4225
+ * @example
4226
+ *
4227
+ * ```js
4228
+ * const app = fin.Application.getCurrentSync();
4229
+ * const appName = 'My App';
4230
+ * const jumpListConfig = [ // array of JumpList categories
4231
+ * {
4232
+ * // has no name and no type so `type` is assumed to be "tasks"
4233
+ * items: [ // array of JumpList items
4234
+ * {
4235
+ * type: 'task',
4236
+ * title: `Launch ${appName}`,
4237
+ * description: `Runs ${appName} with the default configuration`,
4238
+ * deepLink: 'fins://path.to/app/manifest.json',
4239
+ * iconPath: 'https://path.to/app/icon.ico',
4240
+ * iconIndex: 0
4241
+ * },
4242
+ * { type: 'separator' },
4243
+ * {
4244
+ * type: 'task',
4245
+ * title: `Restore ${appName}`,
4246
+ * description: 'Restore to last configuration',
4247
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
4248
+ * iconPath: 'https://path.to/app/icon.ico',
4249
+ * iconIndex: 0
4250
+ * },
4251
+ * ]
4252
+ * },
4253
+ * {
4254
+ * name: 'Tools',
4255
+ * items: [ // array of JumpList items
4256
+ * {
4257
+ * type: 'task',
4258
+ * title: 'Tool A',
4259
+ * description: 'Runs Tool A',
4260
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
4261
+ * iconPath: 'https://path.to/tool-a/icon.ico',
4262
+ * iconIndex: 0
4263
+ * },
4264
+ * {
4265
+ * type: 'task',
4266
+ * title: 'Tool B',
4267
+ * description: 'Runs Tool B',
4268
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
4269
+ * iconPath: 'https://path.to/tool-b/icon.ico',
4270
+ * iconIndex: 0
4271
+ * }]
4272
+ * }
4273
+ * ];
4274
+ *
4275
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
4276
+ * ```
4277
+ *
4278
+ * To handle deeplink args:
4279
+ * ```js
4280
+ * function handleUseLastConfiguration() {
4281
+ * // this handler is called when the app is being launched
4282
+ * app.on('run-requested', event => {
4283
+ * if(event.userAppConfigArgs['use-last-configuration']) {
4284
+ * // your logic here
4285
+ * }
4286
+ * });
4287
+ * // this handler is called when the app was already running when the launch was requested
4288
+ * fin.desktop.main(function(args) {
4289
+ * if(args && args['use-last-configuration']) {
4290
+ * // your logic here
4291
+ * }
4292
+ * });
4293
+ * }
4294
+ * ```
4295
+ */
4296
+ async setJumpList(jumpListCategories) {
4297
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
4298
+ }
4299
+ /**
4300
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
4301
+ * @param icon Image URL or base64 encoded string to be used as the icon
4302
+ *
4303
+ * @example
4304
+ *
4305
+ * ```js
4306
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4307
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
4308
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
4309
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
4310
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
4311
+ *
4312
+ * async function setTrayIcon(icon) {
4313
+ * const app = await fin.Application.getCurrent();
4314
+ * return await app.setTrayIcon(icon);
4315
+ * }
4316
+ *
4317
+ * // use image url to set tray icon
4318
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4319
+ *
4320
+ * // use base64 encoded string to set tray icon
4321
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4322
+ *
4323
+ * // use a dataURL to set tray icon
4324
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4325
+ * ```
4326
+ */
4327
+ setTrayIcon(icon) {
4328
+ return this.wire
4329
+ .sendAction('set-tray-icon', {
4330
+ enabledIcon: icon,
4331
+ ...this.identity
4332
+ })
4333
+ .then(() => undefined);
4334
+ }
4335
+ /**
4336
+ * Set hover text for this application's system tray icon.
4337
+ * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
4338
+ * @param toolTip
4339
+ *
4340
+ * @example
4341
+ *
4342
+ * ```js
4343
+ * const app = fin.Application.getCurrentSync();
4344
+ * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4345
+ *
4346
+ * await app.setTrayIcon(iconUrl);
4347
+ *
4348
+ * await app.setTrayIconToolTip('My Application');
4349
+ * ```
4350
+ */
4351
+ async setTrayIconToolTip(toolTip) {
4352
+ await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
4353
+ }
4354
+ /**
4355
+ * Sets new application's shortcut configuration. Windows only.
4356
+ * @param config New application's shortcut configuration.
4357
+ *
4358
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
4359
+ * to be able to change shortcut states.
4360
+ *
4361
+ * @example
4362
+ *
4363
+ * ```js
4364
+ * async function setShortcuts(config) {
4365
+ * const app = await fin.Application.getCurrent();
4366
+ * return app.setShortcuts(config);
4367
+ * }
4368
+ *
4369
+ * setShortcuts({
4370
+ * desktop: true,
4371
+ * startMenu: false,
4372
+ * systemStartup: true
4373
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
4374
+ * ```
4375
+ */
4376
+ setShortcuts(config) {
4377
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
4378
+ }
4379
+ /**
4380
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
4381
+ * @param queryString The new query string for this app's shortcuts.
4382
+ *
4383
+ * @example
4384
+ *
4385
+ * ```js
4386
+ * const newQueryArgs = 'arg=true&arg2=false';
4387
+ * const app = await fin.Application.getCurrent();
4388
+ * try {
4389
+ * await app.setShortcutQueryParams(newQueryArgs);
4390
+ * } catch(err) {
4391
+ * console.error(err)
4392
+ * }
4393
+ * ```
4394
+ */
4395
+ async setShortcutQueryParams(queryString) {
4396
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
4397
+ }
4398
+ /**
4399
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
4400
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
4401
+ * @param level The zoom level
4402
+ *
4403
+ * @example
4404
+ *
4405
+ * ```js
4406
+ * async function setZoomLevel(number) {
4407
+ * const app = await fin.Application.getCurrent();
4408
+ * return await app.setZoomLevel(number);
4409
+ * }
4410
+ *
4411
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
4412
+ * ```
4413
+ */
4414
+ setZoomLevel(level) {
4415
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
4416
+ }
4417
+ /**
4418
+ * Sets a username to correlate with App Log Management.
4419
+ * @param username Username to correlate with App's Log.
4420
+ *
4421
+ * @example
4422
+ *
4423
+ * ```js
4424
+ * async function setAppLogUser() {
4425
+ * const app = await fin.Application.getCurrent();
4426
+ * return await app.setAppLogUsername('username');
4427
+ * }
4428
+ *
4429
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
4430
+ *
4431
+ * ```
4432
+ */
4433
+ async setAppLogUsername(username) {
4434
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
4435
+ }
4436
+ /**
4437
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
4438
+ * @remarks The only information currently returned is the position and dimensions.
4439
+ *
4440
+ * @example
4441
+ *
4442
+ * ```js
4443
+ * async function getTrayIconInfo() {
4444
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
4445
+ * return await app.getTrayIconInfo();
4446
+ * }
4447
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
4448
+ * ```
4449
+ */
4450
+ getTrayIconInfo() {
4451
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
4452
+ }
4453
+ /**
4454
+ * Checks if the application has an associated tray icon.
4455
+ *
4456
+ * @example
4457
+ *
4458
+ * ```js
4459
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
4460
+ * const hasTrayIcon = await app.hasTrayIcon();
4461
+ * console.log(hasTrayIcon);
4462
+ * ```
4463
+ */
4464
+ hasTrayIcon() {
4465
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
4466
+ }
4467
+ /**
4468
+ * Closes the application by terminating its process.
4469
+ *
4470
+ * @example
4471
+ *
4472
+ * ```js
4473
+ * async function terminateApp() {
4474
+ * const app = await fin.Application.getCurrent();
4475
+ * return await app.terminate();
4476
+ * }
4477
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
4478
+ * ```
4479
+ */
4480
+ terminate() {
4481
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
4482
+ }
4483
+ /**
4484
+ * Waits for a hanging application. This method can be called in response to an application
4485
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
4486
+ * message after a certain period of time.
4487
+ *
4488
+ * @ignore
4489
+ */
4490
+ wait() {
4491
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
4492
+ }
4493
+ /**
4494
+ * Retrieves information about the application.
4495
+ *
4496
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
4497
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
4498
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
4499
+ *
4500
+ * @example
4501
+ *
4502
+ * ```js
4503
+ * async function getInfo() {
4504
+ * const app = await fin.Application.getCurrent();
4505
+ * return await app.getInfo();
4506
+ * }
4507
+ *
4508
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
4509
+ * ```
4510
+ */
4511
+ getInfo() {
4512
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
4513
+ }
4514
+ /**
4515
+ * Retrieves all process information for entities (windows and views) associated with an application.
4516
+ *
4517
+ * @example
4518
+ * ```js
4519
+ * const app = await fin.Application.getCurrent();
4520
+ * const processInfo = await app.getProcessInfo();
4521
+ * ```
4522
+ * @experimental
4523
+ */
4524
+ async getProcessInfo() {
4525
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
4526
+ return data;
4527
+ }
4528
+ /**
4529
+ * Sets file auto download location. It's only allowed in the same application.
4530
+ *
4531
+ * Note: This method is restricted by default and must be enabled via
4532
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4533
+ * @param downloadLocation file auto download location
4534
+ *
4535
+ * @throws if setting file auto download location on different applications.
4536
+ * @example
4537
+ *
4538
+ * ```js
4539
+ * const downloadLocation = 'C:\\dev\\temp';
4540
+ * const app = await fin.Application.getCurrent();
4541
+ * try {
4542
+ * await app.setFileDownloadLocation(downloadLocation);
4543
+ * console.log('File download location is set');
4544
+ * } catch(err) {
4545
+ * console.error(err)
4546
+ * }
4547
+ * ```
4548
+ */
4549
+ async setFileDownloadLocation(downloadLocation) {
4550
+ const { name } = this.wire.me;
4551
+ const entityIdentity = { uuid: this.identity.uuid, name };
4552
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
4553
+ }
4554
+ /**
4555
+ * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
4556
+ *
4557
+ * Note: This method is restricted by default and must be enabled via
4558
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4559
+ *
4560
+ * @throws if getting file auto download location on different applications.
4561
+ * @example
4562
+ *
4563
+ * ```js
4564
+ * const app = await fin.Application.getCurrent();
4565
+ * const fileDownloadDir = await app.getFileDownloadLocation();
4566
+ * ```
4567
+ */
4568
+ async getFileDownloadLocation() {
4569
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
4570
+ return data;
4571
+ }
4572
+ /**
4573
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
4574
+ * @param options
4575
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
4576
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
4577
+ * of all possible data shapes for the entire menu, and the click handler should process
4578
+ * these with a "reducer" pattern.
4579
+ * @throws if the application has no tray icon set
4580
+ * @throws if the system tray is currently hidden
4581
+ * @example
4582
+ *
4583
+ * ```js
4584
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
4585
+ * const app = fin.Application.getCurrentSync();
4586
+ *
4587
+ * await app.setTrayIcon(iconUrl);
4588
+ *
4589
+ * const template = [
4590
+ * {
4591
+ * label: 'Menu Item 1',
4592
+ * data: 'hello from item 1'
4593
+ * },
4594
+ * { type: 'separator' },
4595
+ * {
4596
+ * label: 'Menu Item 2',
4597
+ * type: 'checkbox',
4598
+ * checked: true,
4599
+ * data: 'The user clicked the checkbox'
4600
+ * },
4601
+ * {
4602
+ * label: 'see more',
4603
+ * enabled: false,
4604
+ * submenu: [
4605
+ * { label: 'submenu 1', data: 'hello from submenu' }
4606
+ * ]
4607
+ * }
4608
+ * ];
4609
+ *
4610
+ * app.addListener('tray-icon-clicked', (event) => {
4611
+ * // right-click
4612
+ * if (event.button === 2) {
4613
+ * app.showTrayIconPopupMenu({ template }).then(r => {
4614
+ * if (r.result === 'closed') {
4615
+ * console.log('nothing happened');
4616
+ * } else {
4617
+ * console.log(r.data);
4618
+ * }
4619
+ * });
4620
+ * }
4621
+ * });
4622
+ * ```
4623
+ */
4624
+ async showTrayIconPopupMenu(options) {
4625
+ const { name } = this.wire.me;
4626
+ const entityIdentity = { uuid: this.identity.uuid, name };
4627
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
4628
+ return payload.data;
4629
+ }
4630
+ /**
4631
+ * Closes the tray icon menu.
4632
+ *
4633
+ * @throws if the application has no tray icon set
4634
+ * @example
4635
+ *
4636
+ * ```js
4637
+ * const app = fin.Application.getCurrentSync();
4638
+ *
4639
+ * await app.closeTrayIconPopupMenu();
4640
+ * ```
4641
+ */
4642
+ async closeTrayIconPopupMenu() {
4643
+ const { name } = this.wire.me;
4644
+ const entityIdentity = { uuid: this.identity.uuid, name };
4645
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
4646
+ }
4640
4647
  }
4648
+ Instance$5.Application = Application;
4641
4649
 
4642
- var hasRequiredFactory$1;
4643
-
4644
- function requireFactory$1 () {
4645
- if (hasRequiredFactory$1) return Factory$6;
4646
- hasRequiredFactory$1 = 1;
4647
- Object.defineProperty(Factory$6, "__esModule", { value: true });
4648
- Factory$6.ApplicationModule = void 0;
4649
- const base_1 = base;
4650
- const validate_1 = validate;
4651
- const Instance_1 = requireInstance$2();
4652
- /**
4653
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4654
- */
4655
- class ApplicationModule extends base_1.Base {
4656
- /**
4657
- * Asynchronously returns an API handle for the given Application identity.
4658
- *
4659
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4660
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4661
- * for an Application throughout its entire lifecycle.
4662
- *
4663
- * @example
4664
- *
4665
- * ```js
4666
- * fin.Application.wrap({ uuid: 'testapp' })
4667
- * .then(app => app.isRunning())
4668
- * .then(running => console.log('Application is running: ' + running))
4669
- * .catch(err => console.log(err));
4670
- * ```
4671
- *
4672
- */
4673
- async wrap(identity) {
4674
- this.wire.sendAction('wrap-application').catch((e) => {
4675
- // we do not want to expose this error, just continue if this analytics-only call fails
4676
- });
4677
- const errorMsg = (0, validate_1.validateIdentity)(identity);
4678
- if (errorMsg) {
4679
- throw new Error(errorMsg);
4680
- }
4681
- return new Instance_1.Application(this.wire, identity);
4682
- }
4683
- /**
4684
- * Synchronously returns an API handle for the given Application identity.
4685
- *
4686
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4687
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4688
- * for an Aplication throughout its entire lifecycle.
4689
- *
4690
- * @example
4691
- *
4692
- * ```js
4693
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
4694
- * await app.close();
4695
- * ```
4696
- *
4697
- */
4698
- wrapSync(identity) {
4699
- this.wire.sendAction('wrap-application-sync').catch((e) => {
4700
- // we do not want to expose this error, just continue if this analytics-only call fails
4701
- });
4702
- const errorMsg = (0, validate_1.validateIdentity)(identity);
4703
- if (errorMsg) {
4704
- throw new Error(errorMsg);
4705
- }
4706
- return new Instance_1.Application(this.wire, identity);
4707
- }
4708
- async _create(appOptions) {
4709
- // set defaults:
4710
- if (appOptions.waitForPageLoad === undefined) {
4711
- appOptions.waitForPageLoad = false;
4712
- }
4713
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
4714
- appOptions.autoShow = true;
4715
- }
4716
- await this.wire.sendAction('create-application', appOptions);
4717
- return this.wrap({ uuid: appOptions.uuid });
4718
- }
4719
- /**
4720
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
4721
- *
4722
- * @example
4723
- *
4724
- * ```js
4725
- * async function createApp() {
4726
- * const app = await fin.Application.create({
4727
- * name: 'myApp',
4728
- * uuid: 'app-3',
4729
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
4730
- * autoShow: true
4731
- * });
4732
- * await app.run();
4733
- * }
4734
- *
4735
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
4736
- * ```
4737
- *
4738
- * @ignore
4739
- */
4740
- create(appOptions) {
4741
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
4742
- this.wire.sendAction('application-create').catch((e) => {
4743
- // we do not want to expose this error, just continue if this analytics-only call fails
4744
- });
4745
- return this._create(appOptions);
4746
- }
4747
- /**
4748
- * Creates and starts a new Application.
4749
- *
4750
- * @example
4751
- *
4752
- * ```js
4753
- * async function start() {
4754
- * return fin.Application.start({
4755
- * name: 'app-1',
4756
- * uuid: 'app-1',
4757
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
4758
- * autoShow: true
4759
- * });
4760
- * }
4761
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
4762
- * ```
4763
- *
4764
- */
4765
- async start(appOptions) {
4766
- this.wire.sendAction('start-application').catch((e) => {
4767
- // we do not want to expose this error, just continue if this analytics-only call fails
4768
- });
4769
- const app = await this._create(appOptions);
4770
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
4771
- return app;
4772
- }
4773
- /**
4774
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
4775
- * Returns once the RVM is finished attempting to launch the applications.
4776
- * @param opts - Parameters that the RVM will use.
4777
- *
4778
- * @example
4779
- *
4780
- * ```js
4781
- *
4782
- * const applicationInfoArray = [
4783
- * {
4784
- * "uuid": 'App-1',
4785
- * "manifestUrl": 'http://localhost:5555/app1.json',
4786
- * },
4787
- * {
4788
- * "uuid": 'App-2',
4789
- * "manifestUrl": 'http://localhost:5555/app2.json',
4790
- * },
4791
- * {
4792
- * "uuid": 'App-3',
4793
- * "manifestUrl": 'http://localhost:5555/app3.json',
4794
- * }
4795
- * ]
4796
- *
4797
- * fin.Application.startManyManifests(applicationInfoArray)
4798
- * .then(() => {
4799
- * console.log('RVM has finished launching the application list.');
4800
- * })
4801
- * .catch((err) => {
4802
- * console.log(err);
4803
- * })
4804
- * ```
4805
- *
4806
- * @experimental
4807
- */
4808
- async startManyManifests(applications, opts) {
4809
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
4810
- }
4811
- /**
4812
- * Asynchronously returns an Application object that represents the current application
4813
- *
4814
- * @example
4815
- *
4816
- * ```js
4817
- * async function isCurrentAppRunning () {
4818
- * const app = await fin.Application.getCurrent();
4819
- * return app.isRunning();
4820
- * }
4821
- *
4822
- * isCurrentAppRunning().then(running => {
4823
- * console.log(`Current app is running: ${running}`);
4824
- * }).catch(err => {
4825
- * console.error(err);
4826
- * });
4827
- *
4828
- * ```
4829
- */
4830
- getCurrent() {
4831
- this.wire.sendAction('get-current-application').catch((e) => {
4832
- // we do not want to expose this error, just continue if this analytics-only call fails
4833
- });
4834
- return this.wrap({ uuid: this.wire.me.uuid });
4835
- }
4836
- /**
4837
- * Synchronously returns an Application object that represents the current application
4838
- *
4839
- * @example
4840
- *
4841
- * ```js
4842
- * async function isCurrentAppRunning () {
4843
- * const app = fin.Application.getCurrentSync();
4844
- * return app.isRunning();
4845
- * }
4846
- *
4847
- * isCurrentAppRunning().then(running => {
4848
- * console.log(`Current app is running: ${running}`);
4849
- * }).catch(err => {
4850
- * console.error(err);
4851
- * });
4852
- *
4853
- * ```
4854
- */
4855
- getCurrentSync() {
4856
- this.wire.sendAction('get-current-application-sync').catch((e) => {
4857
- // we do not want to expose this error, just continue if this analytics-only call fails
4858
- });
4859
- return this.wrapSync({ uuid: this.wire.me.uuid });
4860
- }
4861
- /**
4862
- * Retrieves application's manifest and returns a running instance of the application.
4863
- * @param manifestUrl - The URL of app's manifest.
4864
- * @param opts - Parameters that the RVM will use.
4865
- *
4866
- * @example
4867
- *
4868
- * ```js
4869
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4870
- *
4871
- * // For a local manifest file:
4872
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4873
- * ```
4874
- */
4875
- async startFromManifest(manifestUrl, opts) {
4876
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
4877
- // we do not want to expose this error, just continue if this analytics-only call fails
4878
- });
4879
- const app = await this._createFromManifest(manifestUrl);
4880
- // @ts-expect-error using private method without warning.
4881
- await app._run(opts); // eslint-disable-line no-underscore-dangle
4882
- return app;
4883
- }
4884
- /**
4885
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
4886
- * Retrieves application's manifest and returns a wrapped application.
4887
- * @param manifestUrl - The URL of app's manifest.
4888
- * @param callback - called if the method succeeds.
4889
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
4890
- *
4891
- * @example
4892
- *
4893
- * ```js
4894
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
4895
- * ```
4896
- * @ignore
4897
- */
4898
- createFromManifest(manifestUrl) {
4899
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
4900
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
4901
- // we do not want to expose this error, just continue if this analytics-only call fails
4902
- });
4903
- return this._createFromManifest(manifestUrl);
4904
- }
4905
- _createFromManifest(manifestUrl) {
4906
- return this.wire
4907
- .sendAction('get-application-manifest', { manifestUrl })
4908
- .then(({ payload }) => {
4909
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
4910
- return this.wrap({ uuid });
4911
- })
4912
- .then((app) => {
4913
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
4914
- return app;
4915
- });
4916
- }
4917
- }
4918
- Factory$6.ApplicationModule = ApplicationModule;
4919
- return Factory$6;
4650
+ Object.defineProperty(Factory$6, "__esModule", { value: true });
4651
+ Factory$6.ApplicationModule = void 0;
4652
+ const base_1$m = base;
4653
+ const validate_1$4 = validate;
4654
+ const Instance_1$5 = Instance$5;
4655
+ /**
4656
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4657
+ */
4658
+ class ApplicationModule extends base_1$m.Base {
4659
+ /**
4660
+ * Asynchronously returns an API handle for the given Application identity.
4661
+ *
4662
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4663
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4664
+ * for an Application throughout its entire lifecycle.
4665
+ *
4666
+ * @example
4667
+ *
4668
+ * ```js
4669
+ * fin.Application.wrap({ uuid: 'testapp' })
4670
+ * .then(app => app.isRunning())
4671
+ * .then(running => console.log('Application is running: ' + running))
4672
+ * .catch(err => console.log(err));
4673
+ * ```
4674
+ *
4675
+ */
4676
+ async wrap(identity) {
4677
+ this.wire.sendAction('wrap-application').catch((e) => {
4678
+ // we do not want to expose this error, just continue if this analytics-only call fails
4679
+ });
4680
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
4681
+ if (errorMsg) {
4682
+ throw new Error(errorMsg);
4683
+ }
4684
+ return new Instance_1$5.Application(this.wire, identity);
4685
+ }
4686
+ /**
4687
+ * Synchronously returns an API handle for the given Application identity.
4688
+ *
4689
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4690
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4691
+ * for an Aplication throughout its entire lifecycle.
4692
+ *
4693
+ * @example
4694
+ *
4695
+ * ```js
4696
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
4697
+ * await app.close();
4698
+ * ```
4699
+ *
4700
+ */
4701
+ wrapSync(identity) {
4702
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
4703
+ // we do not want to expose this error, just continue if this analytics-only call fails
4704
+ });
4705
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
4706
+ if (errorMsg) {
4707
+ throw new Error(errorMsg);
4708
+ }
4709
+ return new Instance_1$5.Application(this.wire, identity);
4710
+ }
4711
+ async _create(appOptions) {
4712
+ // set defaults:
4713
+ if (appOptions.waitForPageLoad === undefined) {
4714
+ appOptions.waitForPageLoad = false;
4715
+ }
4716
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
4717
+ appOptions.autoShow = true;
4718
+ }
4719
+ await this.wire.sendAction('create-application', appOptions);
4720
+ return this.wrap({ uuid: appOptions.uuid });
4721
+ }
4722
+ /**
4723
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
4724
+ *
4725
+ * @example
4726
+ *
4727
+ * ```js
4728
+ * async function createApp() {
4729
+ * const app = await fin.Application.create({
4730
+ * name: 'myApp',
4731
+ * uuid: 'app-3',
4732
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
4733
+ * autoShow: true
4734
+ * });
4735
+ * await app.run();
4736
+ * }
4737
+ *
4738
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
4739
+ * ```
4740
+ *
4741
+ * @ignore
4742
+ */
4743
+ create(appOptions) {
4744
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
4745
+ this.wire.sendAction('application-create').catch((e) => {
4746
+ // we do not want to expose this error, just continue if this analytics-only call fails
4747
+ });
4748
+ return this._create(appOptions);
4749
+ }
4750
+ /**
4751
+ * Creates and starts a new Application.
4752
+ *
4753
+ * @example
4754
+ *
4755
+ * ```js
4756
+ * async function start() {
4757
+ * return fin.Application.start({
4758
+ * name: 'app-1',
4759
+ * uuid: 'app-1',
4760
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
4761
+ * autoShow: true
4762
+ * });
4763
+ * }
4764
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
4765
+ * ```
4766
+ *
4767
+ */
4768
+ async start(appOptions) {
4769
+ this.wire.sendAction('start-application').catch((e) => {
4770
+ // we do not want to expose this error, just continue if this analytics-only call fails
4771
+ });
4772
+ const app = await this._create(appOptions);
4773
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
4774
+ return app;
4775
+ }
4776
+ /**
4777
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
4778
+ * Returns once the RVM is finished attempting to launch the applications.
4779
+ * @param opts - Parameters that the RVM will use.
4780
+ *
4781
+ * @example
4782
+ *
4783
+ * ```js
4784
+ *
4785
+ * const applicationInfoArray = [
4786
+ * {
4787
+ * "uuid": 'App-1',
4788
+ * "manifestUrl": 'http://localhost:5555/app1.json',
4789
+ * },
4790
+ * {
4791
+ * "uuid": 'App-2',
4792
+ * "manifestUrl": 'http://localhost:5555/app2.json',
4793
+ * },
4794
+ * {
4795
+ * "uuid": 'App-3',
4796
+ * "manifestUrl": 'http://localhost:5555/app3.json',
4797
+ * }
4798
+ * ]
4799
+ *
4800
+ * fin.Application.startManyManifests(applicationInfoArray)
4801
+ * .then(() => {
4802
+ * console.log('RVM has finished launching the application list.');
4803
+ * })
4804
+ * .catch((err) => {
4805
+ * console.log(err);
4806
+ * })
4807
+ * ```
4808
+ *
4809
+ * @experimental
4810
+ */
4811
+ async startManyManifests(applications, opts) {
4812
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
4813
+ }
4814
+ /**
4815
+ * Asynchronously returns an Application object that represents the current application
4816
+ *
4817
+ * @example
4818
+ *
4819
+ * ```js
4820
+ * async function isCurrentAppRunning () {
4821
+ * const app = await fin.Application.getCurrent();
4822
+ * return app.isRunning();
4823
+ * }
4824
+ *
4825
+ * isCurrentAppRunning().then(running => {
4826
+ * console.log(`Current app is running: ${running}`);
4827
+ * }).catch(err => {
4828
+ * console.error(err);
4829
+ * });
4830
+ *
4831
+ * ```
4832
+ */
4833
+ getCurrent() {
4834
+ this.wire.sendAction('get-current-application').catch((e) => {
4835
+ // we do not want to expose this error, just continue if this analytics-only call fails
4836
+ });
4837
+ return this.wrap({ uuid: this.wire.me.uuid });
4838
+ }
4839
+ /**
4840
+ * Synchronously returns an Application object that represents the current application
4841
+ *
4842
+ * @example
4843
+ *
4844
+ * ```js
4845
+ * async function isCurrentAppRunning () {
4846
+ * const app = fin.Application.getCurrentSync();
4847
+ * return app.isRunning();
4848
+ * }
4849
+ *
4850
+ * isCurrentAppRunning().then(running => {
4851
+ * console.log(`Current app is running: ${running}`);
4852
+ * }).catch(err => {
4853
+ * console.error(err);
4854
+ * });
4855
+ *
4856
+ * ```
4857
+ */
4858
+ getCurrentSync() {
4859
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
4860
+ // we do not want to expose this error, just continue if this analytics-only call fails
4861
+ });
4862
+ return this.wrapSync({ uuid: this.wire.me.uuid });
4863
+ }
4864
+ /**
4865
+ * Retrieves application's manifest and returns a running instance of the application.
4866
+ * @param manifestUrl - The URL of app's manifest.
4867
+ * @param opts - Parameters that the RVM will use.
4868
+ *
4869
+ * @example
4870
+ *
4871
+ * ```js
4872
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4873
+ *
4874
+ * // For a local manifest file:
4875
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4876
+ * ```
4877
+ */
4878
+ async startFromManifest(manifestUrl, opts) {
4879
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
4880
+ // we do not want to expose this error, just continue if this analytics-only call fails
4881
+ });
4882
+ const app = await this._createFromManifest(manifestUrl);
4883
+ // @ts-expect-error using private method without warning.
4884
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
4885
+ return app;
4886
+ }
4887
+ /**
4888
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
4889
+ * Retrieves application's manifest and returns a wrapped application.
4890
+ * @param manifestUrl - The URL of app's manifest.
4891
+ * @param callback - called if the method succeeds.
4892
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
4893
+ *
4894
+ * @example
4895
+ *
4896
+ * ```js
4897
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
4898
+ * ```
4899
+ * @ignore
4900
+ */
4901
+ createFromManifest(manifestUrl) {
4902
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
4903
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
4904
+ // we do not want to expose this error, just continue if this analytics-only call fails
4905
+ });
4906
+ return this._createFromManifest(manifestUrl);
4907
+ }
4908
+ _createFromManifest(manifestUrl) {
4909
+ return this.wire
4910
+ .sendAction('get-application-manifest', { manifestUrl })
4911
+ .then(({ payload }) => {
4912
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
4913
+ return this.wrap({ uuid });
4914
+ })
4915
+ .then((app) => {
4916
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
4917
+ return app;
4918
+ });
4919
+ }
4920
4920
  }
4921
+ Factory$6.ApplicationModule = ApplicationModule;
4921
4922
 
4922
- var hasRequiredApplication;
4923
-
4924
- function requireApplication () {
4925
- if (hasRequiredApplication) return application;
4926
- hasRequiredApplication = 1;
4927
- (function (exports) {
4928
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4929
- if (k2 === undefined) k2 = k;
4930
- var desc = Object.getOwnPropertyDescriptor(m, k);
4931
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4932
- desc = { enumerable: true, get: function() { return m[k]; } };
4933
- }
4934
- Object.defineProperty(o, k2, desc);
4935
- }) : (function(o, m, k, k2) {
4936
- if (k2 === undefined) k2 = k;
4937
- o[k2] = m[k];
4938
- }));
4939
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4940
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4941
- };
4942
- Object.defineProperty(exports, "__esModule", { value: true });
4943
- /**
4944
- * Entry points for the OpenFin `Application` API (`fin.Application`).
4945
- *
4946
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4947
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4948
- *
4949
- * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
4950
- * both of these were documented on the same page.
4951
- *
4952
- * @packageDocumentation
4953
- */
4954
- __exportStar(requireFactory$1(), exports);
4955
- __exportStar(requireInstance$2(), exports);
4956
- } (application));
4957
- return application;
4958
- }
4923
+ (function (exports) {
4924
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4925
+ if (k2 === undefined) k2 = k;
4926
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4927
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4928
+ desc = { enumerable: true, get: function() { return m[k]; } };
4929
+ }
4930
+ Object.defineProperty(o, k2, desc);
4931
+ }) : (function(o, m, k, k2) {
4932
+ if (k2 === undefined) k2 = k;
4933
+ o[k2] = m[k];
4934
+ }));
4935
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4936
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4937
+ };
4938
+ Object.defineProperty(exports, "__esModule", { value: true });
4939
+ /**
4940
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
4941
+ *
4942
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4943
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4944
+ *
4945
+ * These are separate code entities, and are documented separately. In the [previous version of the API documentation](https://cdn.openfin.co/docs/javascript/32.114.76.10/index.html),
4946
+ * both of these were documented on the same page.
4947
+ *
4948
+ * @packageDocumentation
4949
+ */
4950
+ __exportStar(Factory$6, exports);
4951
+ __exportStar(Instance$5, exports);
4952
+ } (application));
4959
4953
 
4960
4954
  var promisifySubscription$1 = {};
4961
4955
 
@@ -4999,7 +4993,7 @@ function requireInstance$1 () {
4999
4993
  /* eslint-disable @typescript-eslint/no-unused-vars */
5000
4994
  /* eslint-disable no-console */
5001
4995
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
5002
- const application_1 = requireApplication();
4996
+ const application_1 = application;
5003
4997
  const main_1 = main;
5004
4998
  const view_1 = requireView();
5005
4999
  const warnings_1 = warnings;
@@ -7122,7 +7116,7 @@ function requireView () {
7122
7116
  *
7123
7117
  * @packageDocumentation
7124
7118
  */
7125
- __exportStar(requireFactory$2(), exports);
7119
+ __exportStar(requireFactory$1(), exports);
7126
7120
  __exportStar(requireInstance(), exports);
7127
7121
  } (view));
7128
7122
  return view;
@@ -7608,13 +7602,13 @@ function errorToPOJO(error) {
7608
7602
  }
7609
7603
  errors.errorToPOJO = errorToPOJO;
7610
7604
 
7611
- var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7605
+ var __classPrivateFieldSet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7612
7606
  if (kind === "m") throw new TypeError("Private method is not writable");
7613
7607
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7614
7608
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
7615
7609
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7616
7610
  };
7617
- var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7611
+ var __classPrivateFieldGet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7618
7612
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7619
7613
  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");
7620
7614
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -7642,19 +7636,19 @@ class Transport extends events_1$5.EventEmitter {
7642
7636
  // Typing as unknown to avoid circular dependency, should not be used directly.
7643
7637
  _Transport_fin.set(this, void 0);
7644
7638
  this.connectSync = () => {
7645
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7639
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7646
7640
  wire.connectSync();
7647
7641
  };
7648
7642
  // This function is only used in our tests.
7649
7643
  this.getPort = () => {
7650
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7644
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7651
7645
  return wire.getPort();
7652
7646
  };
7653
- __classPrivateFieldSet$f(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
7647
+ __classPrivateFieldSet$g(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
7654
7648
  this.environment = environment;
7655
- this.sendRaw = __classPrivateFieldGet$g(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$g(this, _Transport_wire, "f"));
7649
+ this.sendRaw = __classPrivateFieldGet$h(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet$h(this, _Transport_wire, "f"));
7656
7650
  this.registerMessageHandler(this.handleMessage.bind(this));
7657
- __classPrivateFieldGet$g(this, _Transport_wire, "f").on('disconnected', () => {
7651
+ __classPrivateFieldGet$h(this, _Transport_wire, "f").on('disconnected', () => {
7658
7652
  for (const [, { handleNack }] of this.wireListeners) {
7659
7653
  handleNack({ reason: 'Remote connection has closed' });
7660
7654
  }
@@ -7666,24 +7660,24 @@ class Transport extends events_1$5.EventEmitter {
7666
7660
  this.me = (0, me_1$1.getBaseMe)(entityType, uuid, name);
7667
7661
  }
7668
7662
  getFin() {
7669
- if (!__classPrivateFieldGet$g(this, _Transport_fin, "f")) {
7663
+ if (!__classPrivateFieldGet$h(this, _Transport_fin, "f")) {
7670
7664
  throw new Error('No Fin object registered for this transport');
7671
7665
  }
7672
- return __classPrivateFieldGet$g(this, _Transport_fin, "f");
7666
+ return __classPrivateFieldGet$h(this, _Transport_fin, "f");
7673
7667
  }
7674
7668
  registerFin(_fin) {
7675
- if (__classPrivateFieldGet$g(this, _Transport_fin, "f")) {
7669
+ if (__classPrivateFieldGet$h(this, _Transport_fin, "f")) {
7676
7670
  throw new Error('Fin object has already been registered for this transport');
7677
7671
  }
7678
- __classPrivateFieldSet$f(this, _Transport_fin, _fin, "f");
7672
+ __classPrivateFieldSet$g(this, _Transport_fin, _fin, "f");
7679
7673
  }
7680
7674
  shutdown() {
7681
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7675
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7682
7676
  return wire.shutdown();
7683
7677
  }
7684
7678
  async connect(config) {
7685
7679
  if ((0, wire_1.isConfigWithReceiver)(config)) {
7686
- await __classPrivateFieldGet$g(this, _Transport_wire, "f").connect(config.receiver);
7680
+ await __classPrivateFieldGet$h(this, _Transport_wire, "f").connect(config.receiver);
7687
7681
  return this.authorize(config);
7688
7682
  }
7689
7683
  if ((0, wire_1.isRemoteConfig)(config)) {
@@ -7699,13 +7693,13 @@ class Transport extends events_1$5.EventEmitter {
7699
7693
  return undefined;
7700
7694
  }
7701
7695
  async connectRemote(config) {
7702
- await __classPrivateFieldGet$g(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
7696
+ await __classPrivateFieldGet$h(this, _Transport_wire, "f").connect(new (this.environment.getWsConstructor())(config.address));
7703
7697
  return this.authorize(config);
7704
7698
  }
7705
7699
  async connectByPort(config) {
7706
7700
  const { address, uuid } = config;
7707
7701
  const reqAuthPayload = { ...config, type: 'file-token' };
7708
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7702
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7709
7703
  await wire.connect(new (this.environment.getWsConstructor())(config.address));
7710
7704
  const requestExtAuthRet = await this.sendAction('request-external-authorization', {
7711
7705
  uuid,
@@ -7741,7 +7735,7 @@ class Transport extends events_1$5.EventEmitter {
7741
7735
  payload,
7742
7736
  messageId
7743
7737
  };
7744
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7738
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7745
7739
  this.addWireListener(messageId, resolve, (payload) => this.nackHandler(payload, reject, callSites), uncorrelated);
7746
7740
  return wire.send(msg).catch(reject);
7747
7741
  });
@@ -7763,7 +7757,7 @@ class Transport extends events_1$5.EventEmitter {
7763
7757
  const resolver = (data) => {
7764
7758
  resolve(data.payload);
7765
7759
  };
7766
- const wire = __classPrivateFieldGet$g(this, _Transport_wire, "f");
7760
+ const wire = __classPrivateFieldGet$h(this, _Transport_wire, "f");
7767
7761
  return wire
7768
7762
  .send(origData)
7769
7763
  .then(() => this.addWireListener(id, resolver, (payload) => this.nackHandler(payload, reject), false))
@@ -8281,6 +8275,11 @@ class System extends base_1$h.EmitterBase {
8281
8275
  /**
8282
8276
  * Returns a unique identifier (UUID) provided by the machine.
8283
8277
  *
8278
+ * On Windows, the machine ID is the `MachineGuid` value located in the Windows Registry at:
8279
+ * `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography`.
8280
+ *
8281
+ * On macOS, the machine ID is the hardware UUID of the machine, obtained via native OS APIs.
8282
+ *
8284
8283
  * @example
8285
8284
  * ```js
8286
8285
  * fin.System.getMachineId().then(id => console.log(id)).catch(err => console.log(err));
@@ -10369,12 +10368,12 @@ class ChannelError extends Error {
10369
10368
  }
10370
10369
  channelError.ChannelError = ChannelError;
10371
10370
 
10372
- var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10371
+ var __classPrivateFieldGet$g = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10373
10372
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10374
10373
  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");
10375
10374
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10376
10375
  };
10377
- var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10376
+ var __classPrivateFieldSet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10378
10377
  if (kind === "m") throw new TypeError("Private method is not writable");
10379
10378
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10380
10379
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -10418,7 +10417,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
10418
10417
  static closeChannelByEndpointId(id) {
10419
10418
  const channel = channelClientsByEndpointId.get(id);
10420
10419
  if (channel) {
10421
- __classPrivateFieldGet$f(channel, _ChannelClient_close, "f").call(channel);
10420
+ __classPrivateFieldGet$g(channel, _ChannelClient_close, "f").call(channel);
10422
10421
  }
10423
10422
  }
10424
10423
  /**
@@ -10429,7 +10428,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
10429
10428
  for (const channelClient of channelClientsByEndpointId.values()) {
10430
10429
  if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
10431
10430
  channelClient.disconnectListener(eventPayload);
10432
- __classPrivateFieldGet$f(channelClient, _ChannelClient_close, "f").call(channelClient);
10431
+ __classPrivateFieldGet$g(channelClient, _ChannelClient_close, "f").call(channelClient);
10433
10432
  }
10434
10433
  }
10435
10434
  }
@@ -10444,12 +10443,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
10444
10443
  this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
10445
10444
  _ChannelClient_close.set(this, () => {
10446
10445
  channelClientsByEndpointId.delete(this.endpointId);
10447
- __classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").close();
10446
+ __classPrivateFieldGet$g(this, _ChannelClient_strategy, "f").close();
10448
10447
  });
10449
- __classPrivateFieldSet$e(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
10448
+ __classPrivateFieldSet$f(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
10450
10449
  this.disconnectListener = () => undefined;
10451
10450
  this.endpointId = routingInfo.endpointId;
10452
- __classPrivateFieldSet$e(this, _ChannelClient_strategy, strategy, "f");
10451
+ __classPrivateFieldSet$f(this, _ChannelClient_strategy, strategy, "f");
10453
10452
  channelClientsByEndpointId.set(this.endpointId, this);
10454
10453
  strategy.receive(this.processAction);
10455
10454
  }
@@ -10457,7 +10456,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
10457
10456
  * a read-only provider identity
10458
10457
  */
10459
10458
  get providerIdentity() {
10460
- const protectedObj = __classPrivateFieldGet$f(this, _ChannelClient_protectedObj, "f");
10459
+ const protectedObj = __classPrivateFieldGet$g(this, _ChannelClient_protectedObj, "f");
10461
10460
  return protectedObj.providerIdentity;
10462
10461
  }
10463
10462
  /**
@@ -10486,9 +10485,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
10486
10485
  * ```
10487
10486
  */
10488
10487
  async dispatch(action, payload) {
10489
- if (__classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
10488
+ if (__classPrivateFieldGet$g(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
10490
10489
  const callSites = transport_errors_1$1.RuntimeError.getCallSite();
10491
- return __classPrivateFieldGet$f(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
10490
+ return __classPrivateFieldGet$g(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
10492
10491
  throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
10493
10492
  });
10494
10493
  }
@@ -10540,10 +10539,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
10540
10539
  */
10541
10540
  async disconnect() {
10542
10541
  await this.sendDisconnectAction();
10543
- __classPrivateFieldGet$f(this, _ChannelClient_close, "f").call(this);
10542
+ __classPrivateFieldGet$g(this, _ChannelClient_close, "f").call(this);
10544
10543
  }
10545
10544
  async sendDisconnectAction() {
10546
- const protectedObj = __classPrivateFieldGet$f(this, _ChannelClient_protectedObj, "f");
10545
+ const protectedObj = __classPrivateFieldGet$g(this, _ChannelClient_protectedObj, "f");
10547
10546
  await protectedObj.close();
10548
10547
  }
10549
10548
  /**
@@ -10576,13 +10575,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
10576
10575
 
10577
10576
  var strategy$3 = {};
10578
10577
 
10579
- var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10578
+ var __classPrivateFieldSet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10580
10579
  if (kind === "m") throw new TypeError("Private method is not writable");
10581
10580
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10582
10581
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10583
10582
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10584
10583
  };
10585
- var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10584
+ var __classPrivateFieldGet$f = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10586
10585
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10587
10586
  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");
10588
10587
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10607,7 +10606,7 @@ class ClassicStrategy {
10607
10606
  // connection problems occur
10608
10607
  _ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
10609
10608
  this.send = async (endpointId, action, payload) => {
10610
- const to = __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10609
+ const to = __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10611
10610
  if (!to) {
10612
10611
  throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
10613
10612
  }
@@ -10619,13 +10618,13 @@ class ClassicStrategy {
10619
10618
  }
10620
10619
  delete cleanId.isLocalEndpointId;
10621
10620
  // grab the promise before awaiting it to save in our pending messages map
10622
- const p = __classPrivateFieldGet$e(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
10621
+ const p = __classPrivateFieldGet$f(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
10623
10622
  ...cleanId,
10624
10623
  providerIdentity: this.providerIdentity,
10625
10624
  action,
10626
10625
  payload
10627
10626
  });
10628
- __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
10627
+ __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
10629
10628
  const raw = await p
10630
10629
  .catch((error) => {
10631
10630
  if ('cause' in error) {
@@ -10635,16 +10634,16 @@ class ClassicStrategy {
10635
10634
  })
10636
10635
  .finally(() => {
10637
10636
  // clean up the pending promise
10638
- __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
10637
+ __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
10639
10638
  });
10640
10639
  return raw.payload.data.result;
10641
10640
  };
10642
10641
  this.close = async () => {
10643
10642
  this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
10644
- [...__classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
10645
- __classPrivateFieldSet$d(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
10643
+ [...__classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
10644
+ __classPrivateFieldSet$e(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
10646
10645
  };
10647
- __classPrivateFieldSet$d(this, _ClassicStrategy_wire, wire, "f");
10646
+ __classPrivateFieldSet$e(this, _ClassicStrategy_wire, wire, "f");
10648
10647
  }
10649
10648
  onEndpointDisconnect(endpointId, listener) {
10650
10649
  // Never fires for 'classic'.
@@ -10653,20 +10652,20 @@ class ClassicStrategy {
10653
10652
  this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
10654
10653
  }
10655
10654
  async closeEndpoint(endpointId) {
10656
- const id = __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10657
- __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
10658
- const pendingSet = __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
10655
+ const id = __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
10656
+ __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
10657
+ const pendingSet = __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
10659
10658
  pendingSet?.forEach((p) => {
10660
10659
  const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
10661
10660
  p.cancel(new Error(errorMsg));
10662
10661
  });
10663
10662
  }
10664
10663
  isEndpointConnected(endpointId) {
10665
- return __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
10664
+ return __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
10666
10665
  }
10667
10666
  addEndpoint(endpointId, payload) {
10668
- __classPrivateFieldGet$e(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
10669
- __classPrivateFieldGet$e(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
10667
+ __classPrivateFieldGet$f(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
10668
+ __classPrivateFieldGet$f(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
10670
10669
  }
10671
10670
  isValidEndpointPayload(payload) {
10672
10671
  return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
@@ -10682,12 +10681,12 @@ var strategy$2 = {};
10682
10681
 
10683
10682
  var endpoint = {};
10684
10683
 
10685
- var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10684
+ var __classPrivateFieldGet$e = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10686
10685
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10687
10686
  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");
10688
10687
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10689
10688
  };
10690
- var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10689
+ var __classPrivateFieldSet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10691
10690
  if (kind === "m") throw new TypeError("Private method is not writable");
10692
10691
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10693
10692
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -10722,8 +10721,8 @@ class RTCEndpoint {
10722
10721
  if (this.rtc.rtcClient.connectionState !== 'connected') {
10723
10722
  this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
10724
10723
  this.close();
10725
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
10726
- __classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f").call(this);
10724
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f")) {
10725
+ __classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f").call(this);
10727
10726
  }
10728
10727
  }
10729
10728
  };
@@ -10771,9 +10770,9 @@ class RTCEndpoint {
10771
10770
  data = new TextDecoder().decode(e.data);
10772
10771
  }
10773
10772
  const { messageId, action, payload } = JSON.parse(data);
10774
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f")) {
10773
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_processAction, "f")) {
10775
10774
  try {
10776
- const res = await __classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
10775
+ const res = await __classPrivateFieldGet$e(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
10777
10776
  this.rtc.channels.response.send(JSON.stringify({
10778
10777
  messageId,
10779
10778
  payload: res,
@@ -10807,25 +10806,25 @@ class RTCEndpoint {
10807
10806
  datachannel.onclose = (e) => {
10808
10807
  [...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
10809
10808
  this.close();
10810
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
10811
- __classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f").call(this);
10809
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f")) {
10810
+ __classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f").call(this);
10812
10811
  }
10813
10812
  };
10814
10813
  });
10815
10814
  }
10816
10815
  onDisconnect(listener) {
10817
- if (!__classPrivateFieldGet$d(this, _RTCEndpoint_disconnectListener, "f")) {
10818
- __classPrivateFieldSet$c(this, _RTCEndpoint_disconnectListener, listener, "f");
10816
+ if (!__classPrivateFieldGet$e(this, _RTCEndpoint_disconnectListener, "f")) {
10817
+ __classPrivateFieldSet$d(this, _RTCEndpoint_disconnectListener, listener, "f");
10819
10818
  }
10820
10819
  else {
10821
10820
  throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
10822
10821
  }
10823
10822
  }
10824
10823
  receive(listener) {
10825
- if (__classPrivateFieldGet$d(this, _RTCEndpoint_processAction, "f")) {
10824
+ if (__classPrivateFieldGet$e(this, _RTCEndpoint_processAction, "f")) {
10826
10825
  throw new Error('You have already set a listener for this RTC Endpoint.');
10827
10826
  }
10828
- __classPrivateFieldSet$c(this, _RTCEndpoint_processAction, listener, "f");
10827
+ __classPrivateFieldSet$d(this, _RTCEndpoint_processAction, listener, "f");
10829
10828
  }
10830
10829
  get connected() {
10831
10830
  return this.rtc.rtcClient.connectionState === 'connected';
@@ -10836,12 +10835,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
10836
10835
 
10837
10836
  var strategy$1 = {};
10838
10837
 
10839
- var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10838
+ var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10840
10839
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10841
10840
  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");
10842
10841
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
10843
10842
  };
10844
- var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10843
+ var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10845
10844
  if (kind === "m") throw new TypeError("Private method is not writable");
10846
10845
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10847
10846
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -10862,11 +10861,11 @@ class EndpointStrategy {
10862
10861
  return this.getEndpointById(endpointId).send(action, payload);
10863
10862
  };
10864
10863
  this.close = async () => {
10865
- if (__classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f")) {
10866
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
10867
- __classPrivateFieldSet$b(this, _EndpointStrategy_endpointMap, new Map(), "f");
10864
+ if (__classPrivateFieldGet$d(this, _EndpointStrategy_connected, "f")) {
10865
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
10866
+ __classPrivateFieldSet$c(this, _EndpointStrategy_endpointMap, new Map(), "f");
10868
10867
  }
10869
- __classPrivateFieldSet$b(this, _EndpointStrategy_connected, false, "f");
10868
+ __classPrivateFieldSet$c(this, _EndpointStrategy_connected, false, "f");
10870
10869
  };
10871
10870
  this.isValidEndpointPayload = validateEndpoint;
10872
10871
  }
@@ -10874,39 +10873,39 @@ class EndpointStrategy {
10874
10873
  this.getEndpointById(endpointId).onDisconnect(listener);
10875
10874
  }
10876
10875
  receive(listener) {
10877
- if (__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")) {
10876
+ if (__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f")) {
10878
10877
  throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
10879
10878
  }
10880
- __classPrivateFieldSet$b(this, _EndpointStrategy_processAction, listener, "f");
10879
+ __classPrivateFieldSet$c(this, _EndpointStrategy_processAction, listener, "f");
10881
10880
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10882
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")));
10881
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f")));
10883
10882
  }
10884
10883
  getEndpointById(endpointId) {
10885
- const endpoint = __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
10884
+ const endpoint = __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
10886
10885
  if (!endpoint) {
10887
10886
  throw new Error(`Client with endpoint id ${endpointId} is not connected`);
10888
10887
  }
10889
10888
  return endpoint;
10890
10889
  }
10891
10890
  get connected() {
10892
- return __classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f");
10891
+ return __classPrivateFieldGet$d(this, _EndpointStrategy_connected, "f");
10893
10892
  }
10894
10893
  isEndpointConnected(endpointId) {
10895
- return __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
10894
+ return __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
10896
10895
  }
10897
10896
  addEndpoint(endpointId, payload) {
10898
- if (!__classPrivateFieldGet$c(this, _EndpointStrategy_connected, "f")) {
10897
+ if (!__classPrivateFieldGet$d(this, _EndpointStrategy_connected, "f")) {
10899
10898
  console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
10900
10899
  return;
10901
10900
  }
10902
10901
  const clientStrat = new this.EndpointType(payload);
10903
- if (__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f")) {
10904
- clientStrat.receive(__classPrivateFieldGet$c(this, _EndpointStrategy_processAction, "f"));
10902
+ if (__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f")) {
10903
+ clientStrat.receive(__classPrivateFieldGet$d(this, _EndpointStrategy_processAction, "f"));
10905
10904
  }
10906
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
10905
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
10907
10906
  }
10908
10907
  async closeEndpoint(endpointId) {
10909
- __classPrivateFieldGet$c(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
10908
+ __classPrivateFieldGet$d(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
10910
10909
  }
10911
10910
  }
10912
10911
  strategy$1.EndpointStrategy = EndpointStrategy;
@@ -11088,12 +11087,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
11088
11087
  }
11089
11088
  runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
11090
11089
 
11091
- var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11090
+ var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11092
11091
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11093
11092
  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");
11094
11093
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11095
11094
  };
11096
- var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11095
+ var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11097
11096
  if (kind === "m") throw new TypeError("Private method is not writable");
11098
11097
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11099
11098
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -11137,19 +11136,19 @@ class ChannelProvider extends channel_1.ChannelBase {
11137
11136
  * a read-only array containing all the identities of connecting clients.
11138
11137
  */
11139
11138
  get connections() {
11140
- return [...__classPrivateFieldGet$b(this, _ChannelProvider_connections, "f")];
11139
+ return [...__classPrivateFieldGet$c(this, _ChannelProvider_connections, "f")];
11141
11140
  }
11142
11141
  static handleClientDisconnection(channel, payload) {
11143
11142
  if (payload?.endpointId) {
11144
11143
  const { uuid, name, endpointId, isLocalEndpointId } = payload;
11145
- __classPrivateFieldGet$b(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
11144
+ __classPrivateFieldGet$c(channel, _ChannelProvider_removeEndpoint, "f").call(channel, { uuid, name, endpointId, isLocalEndpointId });
11146
11145
  }
11147
11146
  else {
11148
11147
  // this is here to support older runtimes that did not have endpointId
11149
11148
  const multipleRemoves = channel.connections.filter((identity) => {
11150
11149
  return identity.uuid === payload.uuid && identity.name === payload.name;
11151
11150
  });
11152
- multipleRemoves.forEach(__classPrivateFieldGet$b(channel, _ChannelProvider_removeEndpoint, "f"));
11151
+ multipleRemoves.forEach(__classPrivateFieldGet$c(channel, _ChannelProvider_removeEndpoint, "f"));
11153
11152
  }
11154
11153
  channel.disconnectListener(payload);
11155
11154
  }
@@ -11166,8 +11165,8 @@ class ChannelProvider extends channel_1.ChannelBase {
11166
11165
  _ChannelProvider_strategy.set(this, void 0);
11167
11166
  _ChannelProvider_removeEndpoint.set(this, (identity) => {
11168
11167
  const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
11169
- __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
11170
- __classPrivateFieldSet$a(this, _ChannelProvider_connections, remainingConnections, "f");
11168
+ __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
11169
+ __classPrivateFieldSet$b(this, _ChannelProvider_connections, remainingConnections, "f");
11171
11170
  });
11172
11171
  // Must be bound.
11173
11172
  this.processAction = async (action, payload, senderIdentity) => {
@@ -11181,17 +11180,17 @@ class ChannelProvider extends channel_1.ChannelBase {
11181
11180
  return super.processAction(action, payload, senderIdentity);
11182
11181
  };
11183
11182
  _ChannelProvider_close.set(this, () => {
11184
- __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").close();
11183
+ __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").close();
11185
11184
  const remove = ChannelProvider.removalMap.get(this);
11186
11185
  if (remove) {
11187
11186
  remove();
11188
11187
  }
11189
11188
  });
11190
- __classPrivateFieldSet$a(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
11189
+ __classPrivateFieldSet$b(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
11191
11190
  this.connectListener = () => undefined;
11192
11191
  this.disconnectListener = () => undefined;
11193
- __classPrivateFieldSet$a(this, _ChannelProvider_connections, [], "f");
11194
- __classPrivateFieldSet$a(this, _ChannelProvider_strategy, strategy, "f");
11192
+ __classPrivateFieldSet$b(this, _ChannelProvider_connections, [], "f");
11193
+ __classPrivateFieldSet$b(this, _ChannelProvider_strategy, strategy, "f");
11195
11194
  strategy.receive(this.processAction);
11196
11195
  }
11197
11196
  /**
@@ -11222,16 +11221,16 @@ class ChannelProvider extends channel_1.ChannelBase {
11222
11221
  */
11223
11222
  dispatch(to, action, payload) {
11224
11223
  const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
11225
- if (endpointId && __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
11224
+ if (endpointId && __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
11226
11225
  const callSites = transport_errors_1.RuntimeError.getCallSite();
11227
- return __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
11226
+ return __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
11228
11227
  throw new channel_error_1.ChannelError(e, action, payload, callSites);
11229
11228
  });
11230
11229
  }
11231
11230
  return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
11232
11231
  }
11233
11232
  async processConnection(senderId, payload) {
11234
- __classPrivateFieldGet$b(this, _ChannelProvider_connections, "f").push(senderId);
11233
+ __classPrivateFieldGet$c(this, _ChannelProvider_connections, "f").push(senderId);
11235
11234
  return this.connectListener(senderId, payload);
11236
11235
  }
11237
11236
  /**
@@ -11254,7 +11253,7 @@ class ChannelProvider extends channel_1.ChannelBase {
11254
11253
  * ```
11255
11254
  */
11256
11255
  publish(action, payload) {
11257
- return this.connections.map((to) => __classPrivateFieldGet$b(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
11256
+ return this.connections.map((to) => __classPrivateFieldGet$c(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
11258
11257
  }
11259
11258
  /**
11260
11259
  * Register a listener that is called on every new client connection.
@@ -11328,11 +11327,11 @@ class ChannelProvider extends channel_1.ChannelBase {
11328
11327
  * ```
11329
11328
  */
11330
11329
  async destroy() {
11331
- const protectedObj = __classPrivateFieldGet$b(this, _ChannelProvider_protectedObj, "f");
11330
+ const protectedObj = __classPrivateFieldGet$c(this, _ChannelProvider_protectedObj, "f");
11332
11331
  protectedObj.providerIdentity;
11333
- __classPrivateFieldSet$a(this, _ChannelProvider_connections, [], "f");
11332
+ __classPrivateFieldSet$b(this, _ChannelProvider_connections, [], "f");
11334
11333
  await protectedObj.close();
11335
- __classPrivateFieldGet$b(this, _ChannelProvider_close, "f").call(this);
11334
+ __classPrivateFieldGet$c(this, _ChannelProvider_close, "f").call(this);
11336
11335
  }
11337
11336
  /**
11338
11337
  * Returns an array with info on every Client connected to the Provider
@@ -11402,7 +11401,7 @@ class ChannelProvider extends channel_1.ChannelBase {
11402
11401
  getEndpointIdForOpenFinId(clientIdentity, action) {
11403
11402
  const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
11404
11403
  if (matchingConnections.length >= 2) {
11405
- const protectedObj = __classPrivateFieldGet$b(this, _ChannelProvider_protectedObj, "f");
11404
+ const protectedObj = __classPrivateFieldGet$c(this, _ChannelProvider_protectedObj, "f");
11406
11405
  const { uuid, name } = clientIdentity;
11407
11406
  const providerUuid = protectedObj?.providerIdentity.uuid;
11408
11407
  const providerName = protectedObj?.providerIdentity.name;
@@ -11614,13 +11613,13 @@ class CombinedStrategy {
11614
11613
  }
11615
11614
  strategy.default = CombinedStrategy;
11616
11615
 
11617
- var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11616
+ var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11618
11617
  if (kind === "m") throw new TypeError("Private method is not writable");
11619
11618
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11620
11619
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11621
11620
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11622
11621
  };
11623
- var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11622
+ var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11624
11623
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11625
11624
  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");
11626
11625
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -11669,8 +11668,8 @@ class ConnectionManager extends base_1$e.Base {
11669
11668
  };
11670
11669
  this.providerMap = new Map();
11671
11670
  this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
11672
- __classPrivateFieldSet$9(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
11673
- __classPrivateFieldSet$9(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
11671
+ __classPrivateFieldSet$a(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
11672
+ __classPrivateFieldSet$a(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
11674
11673
  wire.registerMessageHandler(this.onmessage.bind(this));
11675
11674
  }
11676
11675
  createProvider(options, providerIdentity) {
@@ -11681,7 +11680,7 @@ class ConnectionManager extends base_1$e.Base {
11681
11680
  case 'rtc':
11682
11681
  return new strategy_2.RTCStrategy();
11683
11682
  case 'classic':
11684
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f"),
11683
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$b(this, _ConnectionManager_messageReceiver, "f"),
11685
11684
  // Providers do not have an endpointId, use channelId as endpointId in the strategy.
11686
11685
  providerIdentity.channelId, providerIdentity);
11687
11686
  default:
@@ -11717,7 +11716,7 @@ class ConnectionManager extends base_1$e.Base {
11717
11716
  const supportedProtocols = await Promise.all(protocols.map(async (type) => {
11718
11717
  switch (type) {
11719
11718
  case 'rtc': {
11720
- const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
11719
+ const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$b(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
11721
11720
  rtcPacket = { rtcClient, channels, channelsOpened };
11722
11721
  return {
11723
11722
  type: 'rtc',
@@ -11744,18 +11743,18 @@ class ConnectionManager extends base_1$e.Base {
11744
11743
  routingInfo.endpointId = this.wire.environment.getNextMessageId();
11745
11744
  // For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
11746
11745
  // clients that are in the same context as the newly-connected client.
11747
- __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
11746
+ __classPrivateFieldGet$b(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
11748
11747
  }
11749
11748
  const answer = routingInfo.answer ?? {
11750
11749
  supportedProtocols: [{ type: 'classic', version: 1 }]
11751
11750
  };
11752
11751
  const createStrategyFromAnswer = async (protocol) => {
11753
11752
  if (protocol.type === 'rtc' && rtcPacket) {
11754
- await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
11753
+ await __classPrivateFieldGet$b(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
11755
11754
  return new strategy_2.RTCStrategy();
11756
11755
  }
11757
11756
  if (protocol.type === 'classic') {
11758
- return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$a(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
11757
+ return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$b(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
11759
11758
  }
11760
11759
  return null;
11761
11760
  };
@@ -11823,7 +11822,7 @@ class ConnectionManager extends base_1$e.Base {
11823
11822
  clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
11824
11823
  const answer = await accumP;
11825
11824
  if (protocolToUse.type === 'rtc') {
11826
- const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$a(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
11825
+ const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$b(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
11827
11826
  answer.supportedProtocols.push({
11828
11827
  type: 'rtc',
11829
11828
  version: strategy_2.RTCInfo.version,
@@ -11871,13 +11870,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
11871
11870
  *
11872
11871
  * @packageDocumentation
11873
11872
  */
11874
- var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11873
+ var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
11875
11874
  if (kind === "m") throw new TypeError("Private method is not writable");
11876
11875
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11877
11876
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11878
11877
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11879
11878
  };
11880
- var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11879
+ var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11881
11880
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11882
11881
  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");
11883
11882
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -11934,11 +11933,11 @@ class Channel extends base_1$d.EmitterBase {
11934
11933
  client_1.ChannelClient.handleProviderDisconnect(eventPayload);
11935
11934
  }),
11936
11935
  this.on('connected', (...args) => {
11937
- __classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").emit('connected', ...args);
11936
+ __classPrivateFieldGet$a(this, _Channel_internalEmitter, "f").emit('connected', ...args);
11938
11937
  })
11939
11938
  ]).catch(() => new Error('error setting up channel connection listeners'));
11940
11939
  }));
11941
- __classPrivateFieldSet$8(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
11940
+ __classPrivateFieldSet$9(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
11942
11941
  }
11943
11942
  /**
11944
11943
  *
@@ -12013,7 +12012,7 @@ class Channel extends base_1$d.EmitterBase {
12013
12012
  resolve(true);
12014
12013
  }
12015
12014
  };
12016
- __classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
12015
+ __classPrivateFieldGet$a(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
12017
12016
  });
12018
12017
  try {
12019
12018
  if (retryInfo.count > 0) {
@@ -12045,7 +12044,7 @@ class Channel extends base_1$d.EmitterBase {
12045
12044
  finally {
12046
12045
  retryInfo.count += 1;
12047
12046
  // in case of other errors, remove our listener
12048
- __classPrivateFieldGet$9(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
12047
+ __classPrivateFieldGet$a(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
12049
12048
  }
12050
12049
  } while (shouldWait); // If we're waiting we retry the above loop
12051
12050
  // Should wait was false, no channel was found.
@@ -12104,12 +12103,12 @@ class Channel extends base_1$d.EmitterBase {
12104
12103
  async connect(channelName, options = {}) {
12105
12104
  // Make sure we don't connect before listeners are set up
12106
12105
  // This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
12107
- await __classPrivateFieldGet$9(this, _Channel_readyToConnect, "f").getValue();
12106
+ await __classPrivateFieldGet$a(this, _Channel_readyToConnect, "f").getValue();
12108
12107
  if (!channelName || typeof channelName !== 'string') {
12109
12108
  throw new Error('Please provide a channelName string to connect to a channel.');
12110
12109
  }
12111
12110
  const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
12112
- const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createClientOffer(opts);
12111
+ const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createClientOffer(opts);
12113
12112
  let connectionUrl;
12114
12113
  if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
12115
12114
  connectionUrl = (await this.fin.me.getInfo()).url;
@@ -12121,7 +12120,7 @@ class Channel extends base_1$d.EmitterBase {
12121
12120
  connectionUrl
12122
12121
  };
12123
12122
  const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
12124
- const strategy = await __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
12123
+ const strategy = await __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
12125
12124
  const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
12126
12125
  // It is the client's responsibility to handle endpoint disconnection to the provider.
12127
12126
  // If the endpoint dies, the client will force a disconnection through the core.
@@ -12190,7 +12189,7 @@ class Channel extends base_1$d.EmitterBase {
12190
12189
  throw new Error('Please provide a channelName to create a channel');
12191
12190
  }
12192
12191
  const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
12193
- const channel = __classPrivateFieldGet$9(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
12192
+ const channel = __classPrivateFieldGet$a(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
12194
12193
  // TODO: fix typing (internal)
12195
12194
  // @ts-expect-error
12196
12195
  this.on('client-disconnected', (eventPayload) => {
@@ -12756,13 +12755,13 @@ var Factory$3 = {};
12756
12755
 
12757
12756
  var Instance$2 = {};
12758
12757
 
12759
- var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12758
+ var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12760
12759
  if (kind === "m") throw new TypeError("Private method is not writable");
12761
12760
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
12762
12761
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
12763
12762
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12764
12763
  };
12765
- var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12764
+ var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12766
12765
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
12767
12766
  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");
12768
12767
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -12799,24 +12798,24 @@ class Platform extends base_1$9.EmitterBase {
12799
12798
  this.wire.sendAction('platform-get-client', this.identity).catch((e) => {
12800
12799
  // don't expose
12801
12800
  });
12802
- if (!Platform.clientMap.has(__classPrivateFieldGet$8(this, _Platform_channelName, "f"))) {
12803
- const clientPromise = __classPrivateFieldGet$8(this, _Platform_connectToProvider, "f").call(this);
12804
- Platform.clientMap.set(__classPrivateFieldGet$8(this, _Platform_channelName, "f"), clientPromise);
12801
+ if (!Platform.clientMap.has(__classPrivateFieldGet$9(this, _Platform_channelName, "f"))) {
12802
+ const clientPromise = __classPrivateFieldGet$9(this, _Platform_connectToProvider, "f").call(this);
12803
+ Platform.clientMap.set(__classPrivateFieldGet$9(this, _Platform_channelName, "f"), clientPromise);
12805
12804
  }
12806
12805
  // we set it above
12807
12806
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12808
- return Platform.clientMap.get(__classPrivateFieldGet$8(this, _Platform_channelName, "f"));
12807
+ return Platform.clientMap.get(__classPrivateFieldGet$9(this, _Platform_channelName, "f"));
12809
12808
  };
12810
12809
  _Platform_connectToProvider.set(this, async () => {
12811
12810
  try {
12812
- const client = await this._channel.connect(__classPrivateFieldGet$8(this, _Platform_channelName, "f"), { wait: false });
12811
+ const client = await this._channel.connect(__classPrivateFieldGet$9(this, _Platform_channelName, "f"), { wait: false });
12813
12812
  client.onDisconnection(() => {
12814
- Platform.clientMap.delete(__classPrivateFieldGet$8(this, _Platform_channelName, "f"));
12813
+ Platform.clientMap.delete(__classPrivateFieldGet$9(this, _Platform_channelName, "f"));
12815
12814
  });
12816
12815
  return client;
12817
12816
  }
12818
12817
  catch (e) {
12819
- Platform.clientMap.delete(__classPrivateFieldGet$8(this, _Platform_channelName, "f"));
12818
+ Platform.clientMap.delete(__classPrivateFieldGet$9(this, _Platform_channelName, "f"));
12820
12819
  throw new Error('The targeted Platform is not currently running. Listen for application-started event for the given Uuid.');
12821
12820
  }
12822
12821
  });
@@ -12829,7 +12828,7 @@ class Platform extends base_1$9.EmitterBase {
12829
12828
  if (errorMsg) {
12830
12829
  throw new Error(errorMsg);
12831
12830
  }
12832
- __classPrivateFieldSet$7(this, _Platform_channelName, channelName, "f");
12831
+ __classPrivateFieldSet$8(this, _Platform_channelName, channelName, "f");
12833
12832
  this._channel = this.fin.InterApplicationBus.Channel;
12834
12833
  this.identity = { uuid: identity.uuid };
12835
12834
  this.Layout = this.fin.Platform.Layout;
@@ -13885,13 +13884,13 @@ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async
13885
13884
  };
13886
13885
  channelApiRelay.createRelayedDispatch = createRelayedDispatch;
13887
13886
 
13888
- var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13887
+ var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13889
13888
  if (kind === "m") throw new TypeError("Private method is not writable");
13890
13889
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
13891
13890
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13892
13891
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13893
13892
  };
13894
- var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13893
+ var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
13895
13894
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13896
13895
  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");
13897
13896
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -13945,7 +13944,7 @@ class LayoutNode {
13945
13944
  * console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
13946
13945
  * ```
13947
13946
  */
13948
- this.isRoot = () => __classPrivateFieldGet$7(this, _LayoutNode_client, "f").isRoot(this.entityId);
13947
+ this.isRoot = () => __classPrivateFieldGet$8(this, _LayoutNode_client, "f").isRoot(this.entityId);
13949
13948
  /**
13950
13949
  * Checks if the TabStack or ColumnOrRow exists
13951
13950
  *
@@ -13965,7 +13964,7 @@ class LayoutNode {
13965
13964
  * console.log(`The entity exists: ${exists}`);
13966
13965
  * ```
13967
13966
  */
13968
- this.exists = () => __classPrivateFieldGet$7(this, _LayoutNode_client, "f").exists(this.entityId);
13967
+ this.exists = () => __classPrivateFieldGet$8(this, _LayoutNode_client, "f").exists(this.entityId);
13969
13968
  /**
13970
13969
  * Retrieves the parent of the TabStack or ColumnOrRow
13971
13970
  *
@@ -13986,11 +13985,11 @@ class LayoutNode {
13986
13985
  * ```
13987
13986
  */
13988
13987
  this.getParent = async () => {
13989
- const parent = await __classPrivateFieldGet$7(this, _LayoutNode_client, "f").getParent(this.entityId);
13988
+ const parent = await __classPrivateFieldGet$8(this, _LayoutNode_client, "f").getParent(this.entityId);
13990
13989
  if (!parent) {
13991
13990
  return undefined;
13992
13991
  }
13993
- return LayoutNode.getEntity(parent, __classPrivateFieldGet$7(this, _LayoutNode_client, "f"));
13992
+ return LayoutNode.getEntity(parent, __classPrivateFieldGet$8(this, _LayoutNode_client, "f"));
13994
13993
  };
13995
13994
  /**
13996
13995
  * Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
@@ -14041,8 +14040,8 @@ class LayoutNode {
14041
14040
  * @experimental
14042
14041
  */
14043
14042
  this.createAdjacentStack = async (views, options) => {
14044
- const entityId = await __classPrivateFieldGet$7(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
14045
- return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$7(this, _LayoutNode_client, "f"));
14043
+ const entityId = await __classPrivateFieldGet$8(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
14044
+ return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$8(this, _LayoutNode_client, "f"));
14046
14045
  };
14047
14046
  /**
14048
14047
  * Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
@@ -14070,16 +14069,16 @@ class LayoutNode {
14070
14069
  * @experimental
14071
14070
  */
14072
14071
  this.getAdjacentStacks = async (edge) => {
14073
- const adjacentStacks = await __classPrivateFieldGet$7(this, _LayoutNode_client, "f").getAdjacentStacks({
14072
+ const adjacentStacks = await __classPrivateFieldGet$8(this, _LayoutNode_client, "f").getAdjacentStacks({
14074
14073
  targetId: this.entityId,
14075
14074
  edge
14076
14075
  });
14077
14076
  return adjacentStacks.map((stack) => LayoutNode.getEntity({
14078
14077
  type: 'stack',
14079
14078
  entityId: stack.entityId
14080
- }, __classPrivateFieldGet$7(this, _LayoutNode_client, "f")));
14079
+ }, __classPrivateFieldGet$8(this, _LayoutNode_client, "f")));
14081
14080
  };
14082
- __classPrivateFieldSet$6(this, _LayoutNode_client, client, "f");
14081
+ __classPrivateFieldSet$7(this, _LayoutNode_client, client, "f");
14083
14082
  this.entityId = entityId;
14084
14083
  }
14085
14084
  }
@@ -14153,7 +14152,7 @@ class TabStack extends LayoutNode {
14153
14152
  * ```
14154
14153
  * @experimental
14155
14154
  */
14156
- this.getViews = () => __classPrivateFieldGet$7(this, _TabStack_client, "f").getStackViews(this.entityId);
14155
+ this.getViews = () => __classPrivateFieldGet$8(this, _TabStack_client, "f").getStackViews(this.entityId);
14157
14156
  /**
14158
14157
  * Adds or creates a view in this {@link TabStack}.
14159
14158
  *
@@ -14184,7 +14183,7 @@ class TabStack extends LayoutNode {
14184
14183
  * ```
14185
14184
  * @experimental
14186
14185
  */
14187
- this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$7(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
14186
+ this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$8(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
14188
14187
  /**
14189
14188
  * Removes a view from this {@link TabStack}.
14190
14189
  *
@@ -14214,7 +14213,7 @@ class TabStack extends LayoutNode {
14214
14213
  * ```
14215
14214
  */
14216
14215
  this.removeView = async (view) => {
14217
- await __classPrivateFieldGet$7(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
14216
+ await __classPrivateFieldGet$8(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
14218
14217
  };
14219
14218
  /**
14220
14219
  * Sets the active view of the {@link TabStack} without focusing it.
@@ -14238,9 +14237,9 @@ class TabStack extends LayoutNode {
14238
14237
  * @experimental
14239
14238
  */
14240
14239
  this.setActiveView = async (view) => {
14241
- await __classPrivateFieldGet$7(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
14240
+ await __classPrivateFieldGet$8(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
14242
14241
  };
14243
- __classPrivateFieldSet$6(this, _TabStack_client, client, "f");
14242
+ __classPrivateFieldSet$7(this, _TabStack_client, client, "f");
14244
14243
  }
14245
14244
  }
14246
14245
  layoutEntities.TabStack = TabStack;
@@ -14279,10 +14278,10 @@ class ColumnOrRow extends LayoutNode {
14279
14278
  * ```
14280
14279
  */
14281
14280
  this.getContent = async () => {
14282
- const contentItemEntities = await __classPrivateFieldGet$7(this, _ColumnOrRow_client, "f").getContent(this.entityId);
14283
- return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$7(this, _ColumnOrRow_client, "f")));
14281
+ const contentItemEntities = await __classPrivateFieldGet$8(this, _ColumnOrRow_client, "f").getContent(this.entityId);
14282
+ return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$8(this, _ColumnOrRow_client, "f")));
14284
14283
  };
14285
- __classPrivateFieldSet$6(this, _ColumnOrRow_client, client, "f");
14284
+ __classPrivateFieldSet$7(this, _ColumnOrRow_client, client, "f");
14286
14285
  this.type = type;
14287
14286
  }
14288
14287
  }
@@ -14297,7 +14296,7 @@ layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
14297
14296
  // TODO: eventually export this somehow
14298
14297
  layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
14299
14298
 
14300
- var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14299
+ var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14301
14300
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
14302
14301
  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");
14303
14302
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -14448,7 +14447,7 @@ class Layout extends base_1$8.Base {
14448
14447
  * @internal
14449
14448
  */
14450
14449
  static getClient(layout) {
14451
- return __classPrivateFieldGet$6(layout, _Layout_layoutClient, "f").getValue();
14450
+ return __classPrivateFieldGet$7(layout, _Layout_layoutClient, "f").getValue();
14452
14451
  }
14453
14452
  /**
14454
14453
  * @internal
@@ -14671,7 +14670,7 @@ class Layout extends base_1$8.Base {
14671
14670
  this.wire.sendAction('layout-get-root-item').catch(() => {
14672
14671
  // don't expose
14673
14672
  });
14674
- const client = await __classPrivateFieldGet$6(this, _Layout_layoutClient, "f").getValue();
14673
+ const client = await __classPrivateFieldGet$7(this, _Layout_layoutClient, "f").getValue();
14675
14674
  const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
14676
14675
  return layout_entities_1.LayoutNode.getEntity(root, client);
14677
14676
  }
@@ -14689,7 +14688,7 @@ class Layout extends base_1$8.Base {
14689
14688
  this.wire.sendAction('layout-get-stack-by-view').catch(() => {
14690
14689
  // don't expose
14691
14690
  });
14692
- const client = await __classPrivateFieldGet$6(this, _Layout_layoutClient, "f").getValue();
14691
+ const client = await __classPrivateFieldGet$7(this, _Layout_layoutClient, "f").getValue();
14693
14692
  const stack = await client.getStackByView(identity);
14694
14693
  if (!stack) {
14695
14694
  throw new Error(`No stack found for view: ${identity.uuid}/${identity.name}`);
@@ -14709,7 +14708,7 @@ class Layout extends base_1$8.Base {
14709
14708
  this.wire.sendAction('layout-add-view').catch((e) => {
14710
14709
  // don't expose
14711
14710
  });
14712
- const { identity } = await __classPrivateFieldGet$6(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
14711
+ const { identity } = await __classPrivateFieldGet$7(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-add-view', {
14713
14712
  viewOptions,
14714
14713
  location,
14715
14714
  targetView
@@ -14727,7 +14726,7 @@ class Layout extends base_1$8.Base {
14727
14726
  this.wire.sendAction('layout-close-view').catch((e) => {
14728
14727
  // don't expose
14729
14728
  });
14730
- await __classPrivateFieldGet$6(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
14729
+ await __classPrivateFieldGet$7(this, _Layout_instances, "m", _Layout_forwardLayoutAction).call(this, 'layout-close-view', { viewIdentity });
14731
14730
  }
14732
14731
  }
14733
14732
  Instance$1.Layout = Layout;
@@ -14741,12 +14740,12 @@ async function _Layout_forwardLayoutAction(action, payload) {
14741
14740
  return client.dispatch(action, { target: this.identity, opts: payload });
14742
14741
  };
14743
14742
 
14744
- var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14743
+ var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14745
14744
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
14746
14745
  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");
14747
14746
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14748
14747
  };
14749
- var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
14748
+ var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
14750
14749
  if (kind === "m") throw new TypeError("Private method is not writable");
14751
14750
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14752
14751
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -14812,23 +14811,23 @@ class LayoutModule extends base_1$7.Base {
14812
14811
  if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
14813
14812
  throw new Error('Layout.init can only be called from a Window context.');
14814
14813
  }
14815
- if (__classPrivateFieldGet$5(this, _LayoutModule_layoutInitializationAttempted, "f")) {
14814
+ if (__classPrivateFieldGet$6(this, _LayoutModule_layoutInitializationAttempted, "f")) {
14816
14815
  throw new Error('Layout.init was already called, please use Layout.create to add additional layouts.');
14817
14816
  }
14818
14817
  if (this.wire.environment.type === 'openfin') {
14819
14818
  // preload the client
14820
14819
  await this.fin.Platform.getCurrentSync().getClient();
14821
14820
  }
14822
- __classPrivateFieldSet$5(this, _LayoutModule_layoutInitializationAttempted, true, "f");
14821
+ __classPrivateFieldSet$6(this, _LayoutModule_layoutInitializationAttempted, true, "f");
14823
14822
  // TODO: rename to createLayoutManager
14824
- __classPrivateFieldSet$5(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
14825
- await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$5(this, _LayoutModule_layoutManager, "f"), options);
14823
+ __classPrivateFieldSet$6(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
14824
+ await this.wire.environment.applyLayoutSnapshot(this.fin, __classPrivateFieldGet$6(this, _LayoutModule_layoutManager, "f"), options);
14826
14825
  const meIdentity = { name: this.fin.me.name, uuid: this.fin.me.uuid };
14827
14826
  if (!options.layoutManagerOverride) {
14828
14827
  // CORE-1081 to be removed when we actually delete the `layoutManager` prop
14829
14828
  // in single-layout case, we return the undocumented layoutManager type
14830
14829
  const layoutIdentity = { layoutName: layout_constants_1.DEFAULT_LAYOUT_KEY, ...meIdentity };
14831
- return __classPrivateFieldGet$5(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity);
14830
+ return __classPrivateFieldGet$6(this, _LayoutModule_getLayoutManagerSpy, "f").call(this, layoutIdentity);
14832
14831
  }
14833
14832
  return this.wrapSync(meIdentity);
14834
14833
  };
@@ -14857,13 +14856,13 @@ class LayoutModule extends base_1$7.Base {
14857
14856
  * @returns
14858
14857
  */
14859
14858
  this.getCurrentLayoutManagerSync = () => {
14860
- return __classPrivateFieldGet$5(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
14859
+ return __classPrivateFieldGet$6(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.getCurrentLayoutManagerSync()`);
14861
14860
  };
14862
14861
  this.create = async (options) => {
14863
- return this.wire.environment.createLayout(__classPrivateFieldGet$5(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.create()`), options);
14862
+ return this.wire.environment.createLayout(__classPrivateFieldGet$6(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.create()`), options);
14864
14863
  };
14865
14864
  this.destroy = async (layoutIdentity) => {
14866
- return this.wire.environment.destroyLayout(__classPrivateFieldGet$5(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.destroy()`), layoutIdentity);
14865
+ return this.wire.environment.destroyLayout(__classPrivateFieldGet$6(this, _LayoutModule_instances, "m", _LayoutModule_getSafeLayoutManager).call(this, `fin.Platform.Layout.destroy()`), layoutIdentity);
14867
14866
  };
14868
14867
  }
14869
14868
  /**
@@ -15004,10 +15003,10 @@ class LayoutModule extends base_1$7.Base {
15004
15003
  }
15005
15004
  Factory$2.LayoutModule = LayoutModule;
15006
15005
  _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
15007
- if (!__classPrivateFieldGet$5(this, _LayoutModule_layoutManager, "f")) {
15006
+ if (!__classPrivateFieldGet$6(this, _LayoutModule_layoutManager, "f")) {
15008
15007
  throw new Error(`You must call init before using the API ${method}`);
15009
15008
  }
15010
- return __classPrivateFieldGet$5(this, _LayoutModule_layoutManager, "f");
15009
+ return __classPrivateFieldGet$6(this, _LayoutModule_layoutManager, "f");
15011
15010
  };
15012
15011
 
15013
15012
  (function (exports) {
@@ -15369,13 +15368,13 @@ var InteropClient$1 = {};
15369
15368
 
15370
15369
  var SessionContextGroupClient$1 = {};
15371
15370
 
15372
- var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15371
+ var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15373
15372
  if (kind === "m") throw new TypeError("Private method is not writable");
15374
15373
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15375
15374
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15376
15375
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15377
15376
  };
15378
- var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15377
+ var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15379
15378
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15380
15379
  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");
15381
15380
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -15389,7 +15388,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15389
15388
  super(wire);
15390
15389
  _SessionContextGroupClient_clientPromise.set(this, void 0);
15391
15390
  this.id = id;
15392
- __classPrivateFieldSet$4(this, _SessionContextGroupClient_clientPromise, client, "f");
15391
+ __classPrivateFieldSet$5(this, _SessionContextGroupClient_clientPromise, client, "f");
15393
15392
  }
15394
15393
  /**
15395
15394
  * Sets a context for the session context group.
@@ -15401,7 +15400,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15401
15400
  this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
15402
15401
  // don't expose, analytics-only call
15403
15402
  });
15404
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15403
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15405
15404
  return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
15406
15405
  sessionContextGroupId: this.id,
15407
15406
  context
@@ -15411,7 +15410,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15411
15410
  this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
15412
15411
  // don't expose, analytics-only call
15413
15412
  });
15414
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15413
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15415
15414
  return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
15416
15415
  sessionContextGroupId: this.id,
15417
15416
  type
@@ -15424,7 +15423,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15424
15423
  if (typeof contextHandler !== 'function') {
15425
15424
  throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
15426
15425
  }
15427
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15426
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15428
15427
  let handlerId;
15429
15428
  if (contextType) {
15430
15429
  handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1$6.generateId)()}`;
@@ -15437,7 +15436,7 @@ class SessionContextGroupClient extends base_1$5.Base {
15437
15436
  return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
15438
15437
  }
15439
15438
  async createUnsubscribeCb(handlerId) {
15440
- const client = await __classPrivateFieldGet$4(this, _SessionContextGroupClient_clientPromise, "f");
15439
+ const client = await __classPrivateFieldGet$5(this, _SessionContextGroupClient_clientPromise, "f");
15441
15440
  return async () => {
15442
15441
  client.remove(handlerId);
15443
15442
  await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
@@ -15455,6 +15454,139 @@ class SessionContextGroupClient extends base_1$5.Base {
15455
15454
  SessionContextGroupClient$1.default = SessionContextGroupClient;
15456
15455
  _SessionContextGroupClient_clientPromise = new WeakMap();
15457
15456
 
15457
+ var channelEvents = {};
15458
+
15459
+ var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15460
+ if (kind === "m") throw new TypeError("Private method is not writable");
15461
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15462
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15463
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
15464
+ };
15465
+ var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15466
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15467
+ 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");
15468
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15469
+ };
15470
+ var _a, _ChannelEvents_channelClient, _ChannelEvents_isChannelReady, _ChannelEvents_actionsByClient, _ChannelEvents_getActions, _ChannelEvents_createRegistration, _ChannelEvents_getRegistration, _ChannelEvents_getOrCreateRegistration;
15471
+ Object.defineProperty(channelEvents, "__esModule", { value: true });
15472
+ channelEvents.ChannelEvents = void 0;
15473
+ /**
15474
+ * Channel events creates a event like syntax out of a channel action, allowing multiple events to be triggered
15475
+ * from a single action (normally only one callback can be created per action).
15476
+ *
15477
+ * This Class essentially allows us to multiplex channel actions to multiple callbacks.
15478
+ */
15479
+ class ChannelEvents {
15480
+ constructor(channelClient) {
15481
+ // eslint-disable-next-line
15482
+ _ChannelEvents_channelClient.set(this, void 0);
15483
+ _ChannelEvents_isChannelReady.set(this, false);
15484
+ _ChannelEvents_getActions.set(this, async () => {
15485
+ const channelClient = await __classPrivateFieldGet$4(this, _ChannelEvents_channelClient, "f");
15486
+ let actions = __classPrivateFieldGet$4(ChannelEvents, _a, "f", _ChannelEvents_actionsByClient).get(channelClient);
15487
+ if (!actions) {
15488
+ actions = {};
15489
+ __classPrivateFieldGet$4(ChannelEvents, _a, "f", _ChannelEvents_actionsByClient).set(channelClient, actions);
15490
+ }
15491
+ return actions;
15492
+ });
15493
+ _ChannelEvents_createRegistration.set(this, (actionId) => {
15494
+ const callbacks = [];
15495
+ let registrationPromise;
15496
+ const onChannelAction = (data) => {
15497
+ callbacks.forEach((callback) => callback(data));
15498
+ };
15499
+ return {
15500
+ callbacks,
15501
+ dispose: async (callback) => {
15502
+ const index = callbacks.indexOf(callback);
15503
+ if (index >= 0) {
15504
+ callbacks.splice(index, 1);
15505
+ if (callbacks.length === 0) {
15506
+ const client = await __classPrivateFieldGet$4(this, _ChannelEvents_channelClient, "f");
15507
+ client.remove(actionId);
15508
+ }
15509
+ }
15510
+ },
15511
+ waitForRegistration: async () => {
15512
+ // Use lazy eval to only setup and register the channel on first attempt.
15513
+ if (!registrationPromise) {
15514
+ registrationPromise = (async () => {
15515
+ const client = await __classPrivateFieldGet$4(this, _ChannelEvents_channelClient, "f");
15516
+ await client.register(actionId, onChannelAction);
15517
+ })();
15518
+ }
15519
+ await registrationPromise;
15520
+ }
15521
+ };
15522
+ });
15523
+ _ChannelEvents_getRegistration.set(this, async (actionId) => {
15524
+ const actions = await __classPrivateFieldGet$4(this, _ChannelEvents_getActions, "f").call(this);
15525
+ return actions[actionId];
15526
+ });
15527
+ _ChannelEvents_getOrCreateRegistration.set(this, async (actionId) => {
15528
+ const actions = await __classPrivateFieldGet$4(this, _ChannelEvents_getActions, "f").call(this);
15529
+ const registration = await __classPrivateFieldGet$4(this, _ChannelEvents_getRegistration, "f").call(this, actionId);
15530
+ if (!registration) {
15531
+ actions[actionId] = __classPrivateFieldGet$4(this, _ChannelEvents_createRegistration, "f").call(this, actionId);
15532
+ }
15533
+ return actions[actionId];
15534
+ });
15535
+ /**
15536
+ * Add a listener for the given channel action.
15537
+ *
15538
+ * This will register a handler for the specified channel action if this is the first time we have requested one, or reuse an existing one if it exists.
15539
+ *
15540
+ * Note, only void channel actions are currently supported.
15541
+ *
15542
+ * @param action Action ID, must match the underlying channel action.
15543
+ * @param callback Callback to be called whenever the action is dispatched.
15544
+ */
15545
+ this.addListener = async (action, callback) => {
15546
+ const event = await __classPrivateFieldGet$4(this, _ChannelEvents_getOrCreateRegistration, "f").call(this, action);
15547
+ event.callbacks.push(callback);
15548
+ // This ensures we only resolve the subscription once the action is registered
15549
+ await event.waitForRegistration();
15550
+ };
15551
+ /**
15552
+ * Removes a callback associated with a given action if it exists.
15553
+ *
15554
+ * If this callback is the last one associated with the specified action, the underlying channel action registration is
15555
+ * also removed.
15556
+ * @param action Action ID to remove
15557
+ * @param callback Callback to remove.
15558
+ */
15559
+ this.removeListener = async (action, callback) => {
15560
+ if (!__classPrivateFieldGet$4(this, _ChannelEvents_isChannelReady, "f")) {
15561
+ return;
15562
+ }
15563
+ const registration = await __classPrivateFieldGet$4(this, _ChannelEvents_getRegistration, "f").call(this, action);
15564
+ if (registration) {
15565
+ const event = await __classPrivateFieldGet$4(this, _ChannelEvents_getOrCreateRegistration, "f").call(this, action);
15566
+ await event.dispose(callback);
15567
+ }
15568
+ };
15569
+ __classPrivateFieldSet$4(this, _ChannelEvents_channelClient, channelClient, "f");
15570
+ Promise.resolve(channelClient)
15571
+ .then(() => {
15572
+ __classPrivateFieldSet$4(this, _ChannelEvents_isChannelReady, true, "f");
15573
+ })
15574
+ .catch(() => {
15575
+ // eslint-disable-next-line
15576
+ console.warn('Channel Connection error occurred in channel client. Channel-events registrations will fail.');
15577
+ });
15578
+ }
15579
+ }
15580
+ channelEvents.ChannelEvents = ChannelEvents;
15581
+ _a = ChannelEvents, _ChannelEvents_channelClient = new WeakMap(), _ChannelEvents_isChannelReady = new WeakMap(), _ChannelEvents_getActions = new WeakMap(), _ChannelEvents_createRegistration = new WeakMap(), _ChannelEvents_getRegistration = new WeakMap(), _ChannelEvents_getOrCreateRegistration = new WeakMap();
15582
+ /**
15583
+ * Static map of actions by channel client. This ensures we can reuse the same event and keep track of all its callbacks.
15584
+ *
15585
+ * Weak map will also ensure that when a channel is GC'ed we also tear down the actions/callbacks associated
15586
+ * with it.
15587
+ */
15588
+ _ChannelEvents_actionsByClient = { value: new WeakMap() };
15589
+
15458
15590
  var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
15459
15591
  if (kind === "m") throw new TypeError("Private method is not writable");
15460
15592
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -15469,12 +15601,13 @@ var __classPrivateFieldGet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateF
15469
15601
  var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
15470
15602
  return (mod && mod.__esModule) ? mod : { "default": mod };
15471
15603
  };
15472
- var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory;
15604
+ var _InteropClient_clientPromise, _InteropClient_sessionContextGroups, _InteropClient_fdc3Factory, _InteropClient_channelEvents;
15473
15605
  Object.defineProperty(InteropClient$1, "__esModule", { value: true });
15474
15606
  InteropClient$1.InteropClient = void 0;
15475
15607
  const base_1$4 = base;
15476
15608
  const SessionContextGroupClient_1 = __importDefault$4(SessionContextGroupClient$1);
15477
15609
  const utils_1$5 = utils$3;
15610
+ const channel_events_1 = channelEvents;
15478
15611
  /**
15479
15612
  * The Interop Client API is broken up into two groups:
15480
15613
  *
@@ -15533,13 +15666,43 @@ class InteropClient extends base_1$4.Base {
15533
15666
  _InteropClient_clientPromise.set(this, void 0);
15534
15667
  _InteropClient_sessionContextGroups.set(this, void 0);
15535
15668
  _InteropClient_fdc3Factory.set(this, void 0);
15669
+ _InteropClient_channelEvents.set(this, void 0);
15670
+ /*
15671
+ Client APIs
15672
+ */
15673
+ /**
15674
+ * `addListener` allows the InteropClient to subscribe to events emitted by the connected InteropBroker.
15675
+ * @param type The event type to subscribe to.
15676
+ * @param listener Callback invoked whenever the event occurs.
15677
+ * @returns Promise resolving with void once the listener is registered.
15678
+ */
15679
+ this.addListener = async (type, listener) => {
15680
+ try {
15681
+ await __classPrivateFieldGet$3(this, _InteropClient_channelEvents, "f").addListener(type, listener);
15682
+ }
15683
+ catch (error) {
15684
+ throw new Error(`An unexpected error occurred when adding a listener to the event ${type}. \n${error.stack}.`);
15685
+ }
15686
+ };
15687
+ /**
15688
+ * `removeListener` removes a registered event listener.
15689
+ * @param type The event type to subscribe to.
15690
+ * @param listener Callback to be removed.
15691
+ * @returns Promise resolving with void even if no callback was found.
15692
+ */
15693
+ this.removeListener = async (type, listener) => {
15694
+ try {
15695
+ await __classPrivateFieldGet$3(this, _InteropClient_channelEvents, "f").removeListener(type, listener);
15696
+ }
15697
+ catch (error) {
15698
+ throw new Error(`An unexpected error occurred when removing a listener for the event ${type}. \n${error.stack}.`);
15699
+ }
15700
+ };
15536
15701
  __classPrivateFieldSet$3(this, _InteropClient_sessionContextGroups, new Map(), "f");
15537
15702
  __classPrivateFieldSet$3(this, _InteropClient_clientPromise, clientPromise, "f");
15538
15703
  __classPrivateFieldSet$3(this, _InteropClient_fdc3Factory, fdc3Factory, "f");
15704
+ __classPrivateFieldSet$3(this, _InteropClient_channelEvents, new channel_events_1.ChannelEvents(clientPromise), "f");
15539
15705
  }
15540
- /*
15541
- Client APIs
15542
- */
15543
15706
  /**
15544
15707
  * Sets a context for the context group of the current entity.
15545
15708
  *
@@ -16053,7 +16216,7 @@ class InteropClient extends base_1$4.Base {
16053
16216
  }
16054
16217
  }
16055
16218
  InteropClient$1.InteropClient = InteropClient;
16056
- _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap();
16219
+ _InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap(), _InteropClient_fdc3Factory = new WeakMap(), _InteropClient_channelEvents = new WeakMap();
16057
16220
 
16058
16221
  var fdc3ClientFactory = {};
16059
16222
 
@@ -17896,7 +18059,7 @@ const events_1 = require$$0;
17896
18059
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17897
18060
  const index_1 = system;
17898
18061
  const index_2 = requireWindow();
17899
- const index_3 = requireApplication();
18062
+ const index_3 = application;
17900
18063
  const index_4 = interappbus;
17901
18064
  const index_5 = clipboard;
17902
18065
  const index_6 = externalApplication;