@openfin/remote-adapter 44.100.19 → 44.100.21

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 +1134 -1155
  2. package/package.json +2 -2
@@ -870,7 +870,7 @@ var __importDefault$7 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
870
870
  var _InteropBroker_fdc3Info, _InteropBroker_contextGroups, _InteropBroker_providerPromise;
871
871
  Object.defineProperty(InteropBroker$1, "__esModule", { value: true });
872
872
  InteropBroker$1.InteropBroker = void 0;
873
- const base_1$n = base;
873
+ const base_1$p = base;
874
874
  const SessionContextGroupBroker_1 = __importDefault$7(SessionContextGroupBroker$1);
875
875
  const utils_1$7 = utils$3;
876
876
  const isEqual_1$2 = __importDefault$7(require$$3);
@@ -1039,7 +1039,7 @@ const defaultContextGroups = [
1039
1039
  * ---
1040
1040
  *
1041
1041
  */
1042
- class InteropBroker extends base_1$n.Base {
1042
+ class InteropBroker extends base_1$p.Base {
1043
1043
  /**
1044
1044
  * @internal
1045
1045
  */
@@ -2596,11 +2596,11 @@ const handleDeprecatedWarnings = (options) => {
2596
2596
  };
2597
2597
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
2598
2598
 
2599
- var hasRequiredFactory$2;
2599
+ var hasRequiredFactory$1;
2600
2600
 
2601
- function requireFactory$2 () {
2602
- if (hasRequiredFactory$2) return Factory$8;
2603
- hasRequiredFactory$2 = 1;
2601
+ function requireFactory$1 () {
2602
+ if (hasRequiredFactory$1) return Factory$8;
2603
+ hasRequiredFactory$1 = 1;
2604
2604
  Object.defineProperty(Factory$8, "__esModule", { value: true });
2605
2605
  Factory$8.ViewModule = void 0;
2606
2606
  const base_1 = base;
@@ -2759,8 +2759,8 @@ var main = {};
2759
2759
 
2760
2760
  Object.defineProperty(main, "__esModule", { value: true });
2761
2761
  main.WebContents = void 0;
2762
- const base_1$m = base;
2763
- class WebContents extends base_1$m.EmitterBase {
2762
+ const base_1$o = base;
2763
+ class WebContents extends base_1$o.EmitterBase {
2764
2764
  /**
2765
2765
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
2766
2766
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -3853,1154 +3853,1133 @@ var Factory$6 = {};
3853
3853
 
3854
3854
  var Instance$5 = {};
3855
3855
 
3856
- var hasRequiredInstance$2;
3857
-
3858
- function requireInstance$2 () {
3859
- if (hasRequiredInstance$2) return Instance$5;
3860
- hasRequiredInstance$2 = 1;
3861
- Object.defineProperty(Instance$5, "__esModule", { value: true });
3862
- Instance$5.Application = void 0;
3863
- /* eslint-disable import/prefer-default-export */
3864
- const base_1 = base;
3865
- const window_1 = requireWindow();
3866
- const view_1 = requireView();
3867
- /**
3868
- * An object representing an application. Allows the developer to create,
3869
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
3870
- */
3871
- class Application extends base_1.EmitterBase {
3872
- /**
3873
- * @internal
3874
- */
3875
- constructor(wire, identity) {
3876
- super(wire, 'application', identity.uuid);
3877
- this.identity = identity;
3878
- this.window = new window_1._Window(this.wire, {
3879
- uuid: this.identity.uuid,
3880
- name: this.identity.uuid
3881
- });
3882
- }
3883
- windowListFromIdentityList(identityList) {
3884
- const windowList = [];
3885
- identityList.forEach((identity) => {
3886
- windowList.push(new window_1._Window(this.wire, {
3887
- uuid: identity.uuid,
3888
- name: identity.name
3889
- }));
3890
- });
3891
- return windowList;
3892
- }
3893
- /**
3894
- * Determines if the application is currently running.
3895
- *
3896
- * @example
3897
- *
3898
- * ```js
3899
- * async function isAppRunning() {
3900
- * const app = await fin.Application.getCurrent();
3901
- * return await app.isRunning();
3902
- * }
3903
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
3904
- * ```
3905
- */
3906
- isRunning() {
3907
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
3908
- }
3909
- /**
3910
- * Closes the application and any child windows created by the application.
3911
- * Cleans the application from state so it is no longer found in getAllApplications.
3912
- * @param force Close will be prevented from closing when force is false and
3913
- * ‘close-requested’ has been subscribed to for application’s main window.
3914
- *
3915
- * @example
3916
- *
3917
- * ```js
3918
- * async function closeApp() {
3919
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
3920
- * const app = await fin.Application.wrap({uuid: 'app2'});
3921
- * await app.quit();
3922
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
3923
- *
3924
- * }
3925
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
3926
- * ```
3927
- */
3928
- async quit(force = false) {
3929
- try {
3930
- await this._close(force);
3931
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
3932
- }
3933
- catch (error) {
3934
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
3935
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
3936
- throw error;
3937
- }
3938
- }
3939
- }
3940
- async _close(force = false) {
3941
- try {
3942
- await this.wire.sendAction('close-application', { force, ...this.identity });
3943
- }
3944
- catch (error) {
3945
- if (!error.message.includes('Remote connection has closed')) {
3946
- throw error;
3947
- }
3948
- }
3949
- }
3950
- /**
3951
- * @deprecated use Application.quit instead
3952
- * Closes the application and any child windows created by the application.
3953
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
3954
- * @param callback - called if the method succeeds.
3955
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3956
- *
3957
- * @example
3958
- *
3959
- * ```js
3960
- * async function closeApp() {
3961
- * const app = await fin.Application.getCurrent();
3962
- * return await app.close();
3963
- * }
3964
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
3965
- * ```
3966
- */
3967
- close(force = false) {
3968
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
3969
- this.wire.sendAction('application-close', this.identity).catch((e) => {
3970
- // we do not want to expose this error, just continue if this analytics-only call fails
3971
- });
3972
- return this._close(force);
3973
- }
3974
- /**
3975
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
3976
- *
3977
- * @example
3978
- *
3979
- * ```js
3980
- * async function getChildWindows() {
3981
- * const app = await fin.Application.getCurrent();
3982
- * return await app.getChildWindows();
3983
- * }
3984
- *
3985
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
3986
- * ```
3987
- */
3988
- getChildWindows() {
3989
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
3990
- const identityList = [];
3991
- payload.data.forEach((winName) => {
3992
- identityList.push({ uuid: this.identity.uuid, name: winName });
3993
- });
3994
- return this.windowListFromIdentityList(identityList);
3995
- });
3996
- }
3997
- /**
3998
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
3999
- * if the application was not created from a manifest.
4000
- *
4001
- * @example
4002
- *
4003
- * ```js
4004
- * async function getManifest() {
4005
- * const app = await fin.Application.getCurrent();
4006
- * return await app.getManifest();
4007
- * }
4008
- *
4009
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
4010
- * ```
4011
- */
4012
- getManifest() {
4013
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
4014
- }
4015
- /**
4016
- * Retrieves UUID of the application that launches this application. Invokes the error callback
4017
- * if the application was created from a manifest.
4018
- *
4019
- * @example
4020
- *
4021
- * ```js
4022
- * async function getParentUuid() {
4023
- * const app = await fin.Application.start({
4024
- * uuid: 'app-1',
4025
- * name: 'myApp',
4026
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
4027
- * autoShow: true
4028
- * });
4029
- * return await app.getParentUuid();
4030
- * }
4031
- *
4032
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
4033
- * ```
4034
- */
4035
- getParentUuid() {
4036
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
4037
- }
4038
- /**
4039
- * Retrieves current application's shortcut configuration.
4040
- *
4041
- * @example
4042
- *
4043
- * ```js
4044
- * async function getShortcuts() {
4045
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
4046
- * return await app.getShortcuts();
4047
- * }
4048
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
4049
- * ```
4050
- */
4051
- getShortcuts() {
4052
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
4053
- }
4054
- /**
4055
- * Retrieves current application's views.
4056
- * @experimental
4057
- *
4058
- * @example
4059
- *
4060
- * ```js
4061
- * async function getViews() {
4062
- * const app = await fin.Application.getCurrent();
4063
- * return await app.getViews();
4064
- * }
4065
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
4066
- * ```
4067
- */
4068
- async getViews() {
4069
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
4070
- return payload.data.map((id) => new view_1.View(this.wire, id));
4071
- }
4072
- /**
4073
- * Returns the current zoom level of the application.
4074
- *
4075
- * @example
4076
- *
4077
- * ```js
4078
- * async function getZoomLevel() {
4079
- * const app = await fin.Application.getCurrent();
4080
- * return await app.getZoomLevel();
4081
- * }
4082
- *
4083
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
4084
- * ```
4085
- */
4086
- getZoomLevel() {
4087
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
4088
- }
4089
- /**
4090
- * Returns an instance of the main Window of the application
4091
- *
4092
- * @example
4093
- *
4094
- * ```js
4095
- * async function getWindow() {
4096
- * const app = await fin.Application.start({
4097
- * uuid: 'app-1',
4098
- * name: 'myApp',
4099
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
4100
- * autoShow: true
4101
- * });
4102
- * return await app.getWindow();
4103
- * }
4104
- *
4105
- * getWindow().then(win => {
4106
- * win.showAt(0, 400);
4107
- * win.flash();
4108
- * }).catch(err => console.log(err));
4109
- * ```
4110
- */
4111
- getWindow() {
4112
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
4113
- // we do not want to expose this error, just continue if this analytics-only call fails
4114
- });
4115
- return Promise.resolve(this.window);
4116
- }
4117
- /**
4118
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
4119
- * @param userName - username to be passed to the RVM.
4120
- * @param appName - app name to be passed to the RVM.
4121
- *
4122
- * @example
4123
- *
4124
- * ```js
4125
- * async function registerUser() {
4126
- * const app = await fin.Application.getCurrent();
4127
- * return await app.registerUser('user', 'myApp');
4128
- * }
4129
- *
4130
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
4131
- * ```
4132
- */
4133
- registerUser(userName, appName) {
4134
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
4135
- }
4136
- /**
4137
- * Removes the application’s icon from the tray.
4138
- *
4139
- * @example
4140
- *
4141
- * ```js
4142
- * async function removeTrayIcon() {
4143
- * const app = await fin.Application.getCurrent();
4144
- * return await app.removeTrayIcon();
4145
- * }
4146
- *
4147
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
4148
- * ```
4149
- */
4150
- removeTrayIcon() {
4151
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
4152
- }
4153
- /**
4154
- * Restarts the application.
4155
- *
4156
- * @example
4157
- *
4158
- * ```js
4159
- * async function restartApp() {
4160
- * const app = await fin.Application.getCurrent();
4161
- * return await app.restart();
4162
- * }
4163
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
4164
- * ```
4165
- */
4166
- restart() {
4167
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
4168
- }
4169
- /**
4170
- * DEPRECATED method to run the application.
4171
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
4172
- *
4173
- * @example
4174
- *
4175
- * ```js
4176
- * async function run() {
4177
- * const app = await fin.Application.create({
4178
- * name: 'myApp',
4179
- * uuid: 'app-1',
4180
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
4181
- * autoShow: true
4182
- * });
4183
- * await app.run();
4184
- * }
4185
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
4186
- * ```
4187
- *
4188
- * @ignore
4189
- */
4190
- run() {
4191
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
4192
- this.wire.sendAction('application-run', this.identity).catch((e) => {
4193
- // we do not want to expose this error, just continue if this analytics-only call fails
4194
- });
4195
- return this._run();
4196
- }
4197
- _run(opts = {}) {
4198
- return this.wire
4199
- .sendAction('run-application', {
4200
- manifestUrl: this._manifestUrl,
4201
- opts,
4202
- ...this.identity
4203
- })
4204
- .then(() => undefined);
4205
- }
4206
- /**
4207
- * Instructs the RVM to schedule one restart of the application.
4208
- *
4209
- * @example
4210
- *
4211
- * ```js
4212
- * async function scheduleRestart() {
4213
- * const app = await fin.Application.getCurrent();
4214
- * return await app.scheduleRestart();
4215
- * }
4216
- *
4217
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
4218
- * ```
4219
- */
4220
- scheduleRestart() {
4221
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
4222
- }
4223
- /**
4224
- * Sends a message to the RVM to upload the application's logs. On success,
4225
- * an object containing logId is returned.
4226
- *
4227
- * @example
4228
- *
4229
- * ```js
4230
- * async function sendLog() {
4231
- * const app = await fin.Application.getCurrent();
4232
- * return await app.sendApplicationLog();
4233
- * }
4234
- *
4235
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
4236
- * ```
4237
- */
4238
- async sendApplicationLog() {
4239
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
4240
- return payload.data;
4241
- }
4242
- /**
4243
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
4244
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
4245
- *
4246
- * Note: If the "name" property is omitted it defaults to "tasks".
4247
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
4248
- *
4249
- *
4250
- * @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).
4251
- *
4252
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
4253
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
4254
- *
4255
- * Note: If the "name" property is omitted it defaults to "tasks".
4256
- *
4257
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
4258
- * uuid or shortcut.name is changed.
4259
- *
4260
- * @example
4261
- *
4262
- * ```js
4263
- * const app = fin.Application.getCurrentSync();
4264
- * const appName = 'My App';
4265
- * const jumpListConfig = [ // array of JumpList categories
4266
- * {
4267
- * // has no name and no type so `type` is assumed to be "tasks"
4268
- * items: [ // array of JumpList items
4269
- * {
4270
- * type: 'task',
4271
- * title: `Launch ${appName}`,
4272
- * description: `Runs ${appName} with the default configuration`,
4273
- * deepLink: 'fins://path.to/app/manifest.json',
4274
- * iconPath: 'https://path.to/app/icon.ico',
4275
- * iconIndex: 0
4276
- * },
4277
- * { type: 'separator' },
4278
- * {
4279
- * type: 'task',
4280
- * title: `Restore ${appName}`,
4281
- * description: 'Restore to last configuration',
4282
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
4283
- * iconPath: 'https://path.to/app/icon.ico',
4284
- * iconIndex: 0
4285
- * },
4286
- * ]
4287
- * },
4288
- * {
4289
- * name: 'Tools',
4290
- * items: [ // array of JumpList items
4291
- * {
4292
- * type: 'task',
4293
- * title: 'Tool A',
4294
- * description: 'Runs Tool A',
4295
- * deepLink: 'fins://path.to/tool-a/manifest.json',
4296
- * iconPath: 'https://path.to/tool-a/icon.ico',
4297
- * iconIndex: 0
4298
- * },
4299
- * {
4300
- * type: 'task',
4301
- * title: 'Tool B',
4302
- * description: 'Runs Tool B',
4303
- * deepLink: 'fins://path.to/tool-b/manifest.json',
4304
- * iconPath: 'https://path.to/tool-b/icon.ico',
4305
- * iconIndex: 0
4306
- * }]
4307
- * }
4308
- * ];
4309
- *
4310
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
4311
- * ```
4312
- *
4313
- * To handle deeplink args:
4314
- * ```js
4315
- * function handleUseLastConfiguration() {
4316
- * // this handler is called when the app is being launched
4317
- * app.on('run-requested', event => {
4318
- * if(event.userAppConfigArgs['use-last-configuration']) {
4319
- * // your logic here
4320
- * }
4321
- * });
4322
- * // this handler is called when the app was already running when the launch was requested
4323
- * fin.desktop.main(function(args) {
4324
- * if(args && args['use-last-configuration']) {
4325
- * // your logic here
4326
- * }
4327
- * });
4328
- * }
4329
- * ```
4330
- */
4331
- async setJumpList(jumpListCategories) {
4332
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
4333
- }
4334
- /**
4335
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
4336
- * @param icon Image URL or base64 encoded string to be used as the icon
4337
- *
4338
- * @example
4339
- *
4340
- * ```js
4341
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4342
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
4343
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
4344
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
4345
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
4346
- *
4347
- * async function setTrayIcon(icon) {
4348
- * const app = await fin.Application.getCurrent();
4349
- * return await app.setTrayIcon(icon);
4350
- * }
4351
- *
4352
- * // use image url to set tray icon
4353
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4354
- *
4355
- * // use base64 encoded string to set tray icon
4356
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4357
- *
4358
- * // use a dataURL to set tray icon
4359
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4360
- * ```
4361
- */
4362
- setTrayIcon(icon) {
4363
- return this.wire
4364
- .sendAction('set-tray-icon', {
4365
- enabledIcon: icon,
4366
- ...this.identity
4367
- })
4368
- .then(() => undefined);
4369
- }
4370
- /**
4371
- * Set hover text for this application's system tray icon.
4372
- * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
4373
- * @param toolTip
4374
- *
4375
- * @example
4376
- *
4377
- * ```js
4378
- * const app = fin.Application.getCurrentSync();
4379
- * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4380
- *
4381
- * await app.setTrayIcon(iconUrl);
4382
- *
4383
- * await app.setTrayIconToolTip('My Application');
4384
- * ```
4385
- */
4386
- async setTrayIconToolTip(toolTip) {
4387
- await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
4388
- }
4389
- /**
4390
- * Sets new application's shortcut configuration. Windows only.
4391
- * @param config New application's shortcut configuration.
4392
- *
4393
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
4394
- * to be able to change shortcut states.
4395
- *
4396
- * @example
4397
- *
4398
- * ```js
4399
- * async function setShortcuts(config) {
4400
- * const app = await fin.Application.getCurrent();
4401
- * return app.setShortcuts(config);
4402
- * }
4403
- *
4404
- * setShortcuts({
4405
- * desktop: true,
4406
- * startMenu: false,
4407
- * systemStartup: true
4408
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
4409
- * ```
4410
- */
4411
- setShortcuts(config) {
4412
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
4413
- }
4414
- /**
4415
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
4416
- * @param queryString The new query string for this app's shortcuts.
4417
- *
4418
- * @example
4419
- *
4420
- * ```js
4421
- * const newQueryArgs = 'arg=true&arg2=false';
4422
- * const app = await fin.Application.getCurrent();
4423
- * try {
4424
- * await app.setShortcutQueryParams(newQueryArgs);
4425
- * } catch(err) {
4426
- * console.error(err)
4427
- * }
4428
- * ```
4429
- */
4430
- async setShortcutQueryParams(queryString) {
4431
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
4432
- }
4433
- /**
4434
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
4435
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
4436
- * @param level The zoom level
4437
- *
4438
- * @example
4439
- *
4440
- * ```js
4441
- * async function setZoomLevel(number) {
4442
- * const app = await fin.Application.getCurrent();
4443
- * return await app.setZoomLevel(number);
4444
- * }
4445
- *
4446
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
4447
- * ```
4448
- */
4449
- setZoomLevel(level) {
4450
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
4451
- }
4452
- /**
4453
- * Sets a username to correlate with App Log Management.
4454
- * @param username Username to correlate with App's Log.
4455
- *
4456
- * @example
4457
- *
4458
- * ```js
4459
- * async function setAppLogUser() {
4460
- * const app = await fin.Application.getCurrent();
4461
- * return await app.setAppLogUsername('username');
4462
- * }
4463
- *
4464
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
4465
- *
4466
- * ```
4467
- */
4468
- async setAppLogUsername(username) {
4469
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
4470
- }
4471
- /**
4472
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
4473
- * @remarks The only information currently returned is the position and dimensions.
4474
- *
4475
- * @example
4476
- *
4477
- * ```js
4478
- * async function getTrayIconInfo() {
4479
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
4480
- * return await app.getTrayIconInfo();
4481
- * }
4482
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
4483
- * ```
4484
- */
4485
- getTrayIconInfo() {
4486
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
4487
- }
4488
- /**
4489
- * Checks if the application has an associated tray icon.
4490
- *
4491
- * @example
4492
- *
4493
- * ```js
4494
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
4495
- * const hasTrayIcon = await app.hasTrayIcon();
4496
- * console.log(hasTrayIcon);
4497
- * ```
4498
- */
4499
- hasTrayIcon() {
4500
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
4501
- }
4502
- /**
4503
- * Closes the application by terminating its process.
4504
- *
4505
- * @example
4506
- *
4507
- * ```js
4508
- * async function terminateApp() {
4509
- * const app = await fin.Application.getCurrent();
4510
- * return await app.terminate();
4511
- * }
4512
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
4513
- * ```
4514
- */
4515
- terminate() {
4516
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
4517
- }
4518
- /**
4519
- * Waits for a hanging application. This method can be called in response to an application
4520
- * "not-responding" to allow the application to continue and to generate another "not-responding"
4521
- * message after a certain period of time.
4522
- *
4523
- * @ignore
4524
- */
4525
- wait() {
4526
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
4527
- }
4528
- /**
4529
- * Retrieves information about the application.
4530
- *
4531
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
4532
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
4533
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
4534
- *
4535
- * @example
4536
- *
4537
- * ```js
4538
- * async function getInfo() {
4539
- * const app = await fin.Application.getCurrent();
4540
- * return await app.getInfo();
4541
- * }
4542
- *
4543
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
4544
- * ```
4545
- */
4546
- getInfo() {
4547
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
4548
- }
4549
- /**
4550
- * Retrieves all process information for entities (windows and views) associated with an application.
4551
- *
4552
- * @example
4553
- * ```js
4554
- * const app = await fin.Application.getCurrent();
4555
- * const processInfo = await app.getProcessInfo();
4556
- * ```
4557
- * @experimental
4558
- */
4559
- async getProcessInfo() {
4560
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
4561
- return data;
4562
- }
4563
- /**
4564
- * Sets file auto download location. It's only allowed in the same application.
4565
- *
4566
- * Note: This method is restricted by default and must be enabled via
4567
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4568
- * @param downloadLocation file auto download location
4569
- *
4570
- * @throws if setting file auto download location on different applications.
4571
- * @example
4572
- *
4573
- * ```js
4574
- * const downloadLocation = 'C:\\dev\\temp';
4575
- * const app = await fin.Application.getCurrent();
4576
- * try {
4577
- * await app.setFileDownloadLocation(downloadLocation);
4578
- * console.log('File download location is set');
4579
- * } catch(err) {
4580
- * console.error(err)
4581
- * }
4582
- * ```
4583
- */
4584
- async setFileDownloadLocation(downloadLocation) {
4585
- const { name } = this.wire.me;
4586
- const entityIdentity = { uuid: this.identity.uuid, name };
4587
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
4588
- }
4589
- /**
4590
- * 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.
4591
- *
4592
- * Note: This method is restricted by default and must be enabled via
4593
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4594
- *
4595
- * @throws if getting file auto download location on different applications.
4596
- * @example
4597
- *
4598
- * ```js
4599
- * const app = await fin.Application.getCurrent();
4600
- * const fileDownloadDir = await app.getFileDownloadLocation();
4601
- * ```
4602
- */
4603
- async getFileDownloadLocation() {
4604
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
4605
- return data;
4606
- }
4607
- /**
4608
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
4609
- * @param options
4610
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
4611
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
4612
- * of all possible data shapes for the entire menu, and the click handler should process
4613
- * these with a "reducer" pattern.
4614
- * @throws if the application has no tray icon set
4615
- * @throws if the system tray is currently hidden
4616
- * @example
4617
- *
4618
- * ```js
4619
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
4620
- * const app = fin.Application.getCurrentSync();
4621
- *
4622
- * await app.setTrayIcon(iconUrl);
4623
- *
4624
- * const template = [
4625
- * {
4626
- * label: 'Menu Item 1',
4627
- * data: 'hello from item 1'
4628
- * },
4629
- * { type: 'separator' },
4630
- * {
4631
- * label: 'Menu Item 2',
4632
- * type: 'checkbox',
4633
- * checked: true,
4634
- * data: 'The user clicked the checkbox'
4635
- * },
4636
- * {
4637
- * label: 'see more',
4638
- * enabled: false,
4639
- * submenu: [
4640
- * { label: 'submenu 1', data: 'hello from submenu' }
4641
- * ]
4642
- * }
4643
- * ];
4644
- *
4645
- * app.addListener('tray-icon-clicked', (event) => {
4646
- * // right-click
4647
- * if (event.button === 2) {
4648
- * app.showTrayIconPopupMenu({ template }).then(r => {
4649
- * if (r.result === 'closed') {
4650
- * console.log('nothing happened');
4651
- * } else {
4652
- * console.log(r.data);
4653
- * }
4654
- * });
4655
- * }
4656
- * });
4657
- * ```
4658
- */
4659
- async showTrayIconPopupMenu(options) {
4660
- const { name } = this.wire.me;
4661
- const entityIdentity = { uuid: this.identity.uuid, name };
4662
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
4663
- return payload.data;
4664
- }
4665
- /**
4666
- * Closes the tray icon menu.
4667
- *
4668
- * @throws if the application has no tray icon set
4669
- * @example
4670
- *
4671
- * ```js
4672
- * const app = fin.Application.getCurrentSync();
4673
- *
4674
- * await app.closeTrayIconPopupMenu();
4675
- * ```
4676
- */
4677
- async closeTrayIconPopupMenu() {
4678
- const { name } = this.wire.me;
4679
- const entityIdentity = { uuid: this.identity.uuid, name };
4680
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
4681
- }
4682
- }
4683
- Instance$5.Application = Application;
4684
- return Instance$5;
3856
+ Object.defineProperty(Instance$5, "__esModule", { value: true });
3857
+ Instance$5.Application = void 0;
3858
+ /* eslint-disable import/prefer-default-export */
3859
+ const base_1$n = base;
3860
+ const window_1$1 = requireWindow();
3861
+ const view_1 = requireView();
3862
+ /**
3863
+ * An object representing an application. Allows the developer to create,
3864
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
3865
+ */
3866
+ class Application extends base_1$n.EmitterBase {
3867
+ /**
3868
+ * @internal
3869
+ */
3870
+ constructor(wire, identity) {
3871
+ super(wire, 'application', identity.uuid);
3872
+ this.identity = identity;
3873
+ this.window = new window_1$1._Window(this.wire, {
3874
+ uuid: this.identity.uuid,
3875
+ name: this.identity.uuid
3876
+ });
3877
+ }
3878
+ windowListFromIdentityList(identityList) {
3879
+ const windowList = [];
3880
+ identityList.forEach((identity) => {
3881
+ windowList.push(new window_1$1._Window(this.wire, {
3882
+ uuid: identity.uuid,
3883
+ name: identity.name
3884
+ }));
3885
+ });
3886
+ return windowList;
3887
+ }
3888
+ /**
3889
+ * Determines if the application is currently running.
3890
+ *
3891
+ * @example
3892
+ *
3893
+ * ```js
3894
+ * async function isAppRunning() {
3895
+ * const app = await fin.Application.getCurrent();
3896
+ * return await app.isRunning();
3897
+ * }
3898
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
3899
+ * ```
3900
+ */
3901
+ isRunning() {
3902
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
3903
+ }
3904
+ /**
3905
+ * Closes the application and any child windows created by the application.
3906
+ * Cleans the application from state so it is no longer found in getAllApplications.
3907
+ * @param force Close will be prevented from closing when force is false and
3908
+ * ‘close-requested’ has been subscribed to for application’s main window.
3909
+ *
3910
+ * @example
3911
+ *
3912
+ * ```js
3913
+ * async function closeApp() {
3914
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
3915
+ * const app = await fin.Application.wrap({uuid: 'app2'});
3916
+ * await app.quit();
3917
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
3918
+ *
3919
+ * }
3920
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
3921
+ * ```
3922
+ */
3923
+ async quit(force = false) {
3924
+ try {
3925
+ await this._close(force);
3926
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
3927
+ }
3928
+ catch (error) {
3929
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
3930
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
3931
+ throw error;
3932
+ }
3933
+ }
3934
+ }
3935
+ async _close(force = false) {
3936
+ try {
3937
+ await this.wire.sendAction('close-application', { force, ...this.identity });
3938
+ }
3939
+ catch (error) {
3940
+ if (!error.message.includes('Remote connection has closed')) {
3941
+ throw error;
3942
+ }
3943
+ }
3944
+ }
3945
+ /**
3946
+ * @deprecated use Application.quit instead
3947
+ * Closes the application and any child windows created by the application.
3948
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
3949
+ * @param callback - called if the method succeeds.
3950
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3951
+ *
3952
+ * @example
3953
+ *
3954
+ * ```js
3955
+ * async function closeApp() {
3956
+ * const app = await fin.Application.getCurrent();
3957
+ * return await app.close();
3958
+ * }
3959
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
3960
+ * ```
3961
+ */
3962
+ close(force = false) {
3963
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
3964
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
3965
+ // we do not want to expose this error, just continue if this analytics-only call fails
3966
+ });
3967
+ return this._close(force);
3968
+ }
3969
+ /**
3970
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
3971
+ *
3972
+ * @example
3973
+ *
3974
+ * ```js
3975
+ * async function getChildWindows() {
3976
+ * const app = await fin.Application.getCurrent();
3977
+ * return await app.getChildWindows();
3978
+ * }
3979
+ *
3980
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
3981
+ * ```
3982
+ */
3983
+ getChildWindows() {
3984
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
3985
+ const identityList = [];
3986
+ payload.data.forEach((winName) => {
3987
+ identityList.push({ uuid: this.identity.uuid, name: winName });
3988
+ });
3989
+ return this.windowListFromIdentityList(identityList);
3990
+ });
3991
+ }
3992
+ /**
3993
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
3994
+ * if the application was not created from a manifest.
3995
+ *
3996
+ * @example
3997
+ *
3998
+ * ```js
3999
+ * async function getManifest() {
4000
+ * const app = await fin.Application.getCurrent();
4001
+ * return await app.getManifest();
4002
+ * }
4003
+ *
4004
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
4005
+ * ```
4006
+ */
4007
+ getManifest() {
4008
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
4009
+ }
4010
+ /**
4011
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
4012
+ * if the application was created from a manifest.
4013
+ *
4014
+ * @example
4015
+ *
4016
+ * ```js
4017
+ * async function getParentUuid() {
4018
+ * const app = await fin.Application.start({
4019
+ * uuid: 'app-1',
4020
+ * name: 'myApp',
4021
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
4022
+ * autoShow: true
4023
+ * });
4024
+ * return await app.getParentUuid();
4025
+ * }
4026
+ *
4027
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
4028
+ * ```
4029
+ */
4030
+ getParentUuid() {
4031
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
4032
+ }
4033
+ /**
4034
+ * Retrieves current application's shortcut configuration.
4035
+ *
4036
+ * @example
4037
+ *
4038
+ * ```js
4039
+ * async function getShortcuts() {
4040
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
4041
+ * return await app.getShortcuts();
4042
+ * }
4043
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
4044
+ * ```
4045
+ */
4046
+ getShortcuts() {
4047
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
4048
+ }
4049
+ /**
4050
+ * Retrieves current application's views.
4051
+ * @experimental
4052
+ *
4053
+ * @example
4054
+ *
4055
+ * ```js
4056
+ * async function getViews() {
4057
+ * const app = await fin.Application.getCurrent();
4058
+ * return await app.getViews();
4059
+ * }
4060
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
4061
+ * ```
4062
+ */
4063
+ async getViews() {
4064
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
4065
+ return payload.data.map((id) => new view_1.View(this.wire, id));
4066
+ }
4067
+ /**
4068
+ * Returns the current zoom level of the application.
4069
+ *
4070
+ * @example
4071
+ *
4072
+ * ```js
4073
+ * async function getZoomLevel() {
4074
+ * const app = await fin.Application.getCurrent();
4075
+ * return await app.getZoomLevel();
4076
+ * }
4077
+ *
4078
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
4079
+ * ```
4080
+ */
4081
+ getZoomLevel() {
4082
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
4083
+ }
4084
+ /**
4085
+ * Returns an instance of the main Window of the application
4086
+ *
4087
+ * @example
4088
+ *
4089
+ * ```js
4090
+ * async function getWindow() {
4091
+ * const app = await fin.Application.start({
4092
+ * uuid: 'app-1',
4093
+ * name: 'myApp',
4094
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
4095
+ * autoShow: true
4096
+ * });
4097
+ * return await app.getWindow();
4098
+ * }
4099
+ *
4100
+ * getWindow().then(win => {
4101
+ * win.showAt(0, 400);
4102
+ * win.flash();
4103
+ * }).catch(err => console.log(err));
4104
+ * ```
4105
+ */
4106
+ getWindow() {
4107
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
4108
+ // we do not want to expose this error, just continue if this analytics-only call fails
4109
+ });
4110
+ return Promise.resolve(this.window);
4111
+ }
4112
+ /**
4113
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
4114
+ * @param userName - username to be passed to the RVM.
4115
+ * @param appName - app name to be passed to the RVM.
4116
+ *
4117
+ * @example
4118
+ *
4119
+ * ```js
4120
+ * async function registerUser() {
4121
+ * const app = await fin.Application.getCurrent();
4122
+ * return await app.registerUser('user', 'myApp');
4123
+ * }
4124
+ *
4125
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
4126
+ * ```
4127
+ */
4128
+ registerUser(userName, appName) {
4129
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
4130
+ }
4131
+ /**
4132
+ * Removes the application’s icon from the tray.
4133
+ *
4134
+ * @example
4135
+ *
4136
+ * ```js
4137
+ * async function removeTrayIcon() {
4138
+ * const app = await fin.Application.getCurrent();
4139
+ * return await app.removeTrayIcon();
4140
+ * }
4141
+ *
4142
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
4143
+ * ```
4144
+ */
4145
+ removeTrayIcon() {
4146
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
4147
+ }
4148
+ /**
4149
+ * Restarts the application.
4150
+ *
4151
+ * @example
4152
+ *
4153
+ * ```js
4154
+ * async function restartApp() {
4155
+ * const app = await fin.Application.getCurrent();
4156
+ * return await app.restart();
4157
+ * }
4158
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
4159
+ * ```
4160
+ */
4161
+ restart() {
4162
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
4163
+ }
4164
+ /**
4165
+ * DEPRECATED method to run the application.
4166
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
4167
+ *
4168
+ * @example
4169
+ *
4170
+ * ```js
4171
+ * async function run() {
4172
+ * const app = await fin.Application.create({
4173
+ * name: 'myApp',
4174
+ * uuid: 'app-1',
4175
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
4176
+ * autoShow: true
4177
+ * });
4178
+ * await app.run();
4179
+ * }
4180
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
4181
+ * ```
4182
+ *
4183
+ * @ignore
4184
+ */
4185
+ run() {
4186
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
4187
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
4188
+ // we do not want to expose this error, just continue if this analytics-only call fails
4189
+ });
4190
+ return this._run();
4191
+ }
4192
+ _run(opts = {}) {
4193
+ return this.wire
4194
+ .sendAction('run-application', {
4195
+ manifestUrl: this._manifestUrl,
4196
+ opts,
4197
+ ...this.identity
4198
+ })
4199
+ .then(() => undefined);
4200
+ }
4201
+ /**
4202
+ * Instructs the RVM to schedule one restart of the application.
4203
+ *
4204
+ * @example
4205
+ *
4206
+ * ```js
4207
+ * async function scheduleRestart() {
4208
+ * const app = await fin.Application.getCurrent();
4209
+ * return await app.scheduleRestart();
4210
+ * }
4211
+ *
4212
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
4213
+ * ```
4214
+ */
4215
+ scheduleRestart() {
4216
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
4217
+ }
4218
+ /**
4219
+ * Sends a message to the RVM to upload the application's logs. On success,
4220
+ * an object containing logId is returned.
4221
+ *
4222
+ * @example
4223
+ *
4224
+ * ```js
4225
+ * async function sendLog() {
4226
+ * const app = await fin.Application.getCurrent();
4227
+ * return await app.sendApplicationLog();
4228
+ * }
4229
+ *
4230
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
4231
+ * ```
4232
+ */
4233
+ async sendApplicationLog() {
4234
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
4235
+ return payload.data;
4236
+ }
4237
+ /**
4238
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
4239
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
4240
+ *
4241
+ * Note: If the "name" property is omitted it defaults to "tasks".
4242
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
4243
+ *
4244
+ *
4245
+ * @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).
4246
+ *
4247
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
4248
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
4249
+ *
4250
+ * Note: If the "name" property is omitted it defaults to "tasks".
4251
+ *
4252
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
4253
+ * uuid or shortcut.name is changed.
4254
+ *
4255
+ * @example
4256
+ *
4257
+ * ```js
4258
+ * const app = fin.Application.getCurrentSync();
4259
+ * const appName = 'My App';
4260
+ * const jumpListConfig = [ // array of JumpList categories
4261
+ * {
4262
+ * // has no name and no type so `type` is assumed to be "tasks"
4263
+ * items: [ // array of JumpList items
4264
+ * {
4265
+ * type: 'task',
4266
+ * title: `Launch ${appName}`,
4267
+ * description: `Runs ${appName} with the default configuration`,
4268
+ * deepLink: 'fins://path.to/app/manifest.json',
4269
+ * iconPath: 'https://path.to/app/icon.ico',
4270
+ * iconIndex: 0
4271
+ * },
4272
+ * { type: 'separator' },
4273
+ * {
4274
+ * type: 'task',
4275
+ * title: `Restore ${appName}`,
4276
+ * description: 'Restore to last configuration',
4277
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
4278
+ * iconPath: 'https://path.to/app/icon.ico',
4279
+ * iconIndex: 0
4280
+ * },
4281
+ * ]
4282
+ * },
4283
+ * {
4284
+ * name: 'Tools',
4285
+ * items: [ // array of JumpList items
4286
+ * {
4287
+ * type: 'task',
4288
+ * title: 'Tool A',
4289
+ * description: 'Runs Tool A',
4290
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
4291
+ * iconPath: 'https://path.to/tool-a/icon.ico',
4292
+ * iconIndex: 0
4293
+ * },
4294
+ * {
4295
+ * type: 'task',
4296
+ * title: 'Tool B',
4297
+ * description: 'Runs Tool B',
4298
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
4299
+ * iconPath: 'https://path.to/tool-b/icon.ico',
4300
+ * iconIndex: 0
4301
+ * }]
4302
+ * }
4303
+ * ];
4304
+ *
4305
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
4306
+ * ```
4307
+ *
4308
+ * To handle deeplink args:
4309
+ * ```js
4310
+ * function handleUseLastConfiguration() {
4311
+ * // this handler is called when the app is being launched
4312
+ * app.on('run-requested', event => {
4313
+ * if(event.userAppConfigArgs['use-last-configuration']) {
4314
+ * // your logic here
4315
+ * }
4316
+ * });
4317
+ * // this handler is called when the app was already running when the launch was requested
4318
+ * fin.desktop.main(function(args) {
4319
+ * if(args && args['use-last-configuration']) {
4320
+ * // your logic here
4321
+ * }
4322
+ * });
4323
+ * }
4324
+ * ```
4325
+ */
4326
+ async setJumpList(jumpListCategories) {
4327
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
4328
+ }
4329
+ /**
4330
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
4331
+ * @param icon Image URL or base64 encoded string to be used as the icon
4332
+ *
4333
+ * @example
4334
+ *
4335
+ * ```js
4336
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4337
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
4338
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
4339
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
4340
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
4341
+ *
4342
+ * async function setTrayIcon(icon) {
4343
+ * const app = await fin.Application.getCurrent();
4344
+ * return await app.setTrayIcon(icon);
4345
+ * }
4346
+ *
4347
+ * // use image url to set tray icon
4348
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4349
+ *
4350
+ * // use base64 encoded string to set tray icon
4351
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4352
+ *
4353
+ * // use a dataURL to set tray icon
4354
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
4355
+ * ```
4356
+ */
4357
+ setTrayIcon(icon) {
4358
+ return this.wire
4359
+ .sendAction('set-tray-icon', {
4360
+ enabledIcon: icon,
4361
+ ...this.identity
4362
+ })
4363
+ .then(() => undefined);
4364
+ }
4365
+ /**
4366
+ * Set hover text for this application's system tray icon.
4367
+ * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
4368
+ * @param toolTip
4369
+ *
4370
+ * @example
4371
+ *
4372
+ * ```js
4373
+ * const app = fin.Application.getCurrentSync();
4374
+ * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
4375
+ *
4376
+ * await app.setTrayIcon(iconUrl);
4377
+ *
4378
+ * await app.setTrayIconToolTip('My Application');
4379
+ * ```
4380
+ */
4381
+ async setTrayIconToolTip(toolTip) {
4382
+ await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
4383
+ }
4384
+ /**
4385
+ * Sets new application's shortcut configuration. Windows only.
4386
+ * @param config New application's shortcut configuration.
4387
+ *
4388
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
4389
+ * to be able to change shortcut states.
4390
+ *
4391
+ * @example
4392
+ *
4393
+ * ```js
4394
+ * async function setShortcuts(config) {
4395
+ * const app = await fin.Application.getCurrent();
4396
+ * return app.setShortcuts(config);
4397
+ * }
4398
+ *
4399
+ * setShortcuts({
4400
+ * desktop: true,
4401
+ * startMenu: false,
4402
+ * systemStartup: true
4403
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
4404
+ * ```
4405
+ */
4406
+ setShortcuts(config) {
4407
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
4408
+ }
4409
+ /**
4410
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
4411
+ * @param queryString The new query string for this app's shortcuts.
4412
+ *
4413
+ * @example
4414
+ *
4415
+ * ```js
4416
+ * const newQueryArgs = 'arg=true&arg2=false';
4417
+ * const app = await fin.Application.getCurrent();
4418
+ * try {
4419
+ * await app.setShortcutQueryParams(newQueryArgs);
4420
+ * } catch(err) {
4421
+ * console.error(err)
4422
+ * }
4423
+ * ```
4424
+ */
4425
+ async setShortcutQueryParams(queryString) {
4426
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
4427
+ }
4428
+ /**
4429
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
4430
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
4431
+ * @param level The zoom level
4432
+ *
4433
+ * @example
4434
+ *
4435
+ * ```js
4436
+ * async function setZoomLevel(number) {
4437
+ * const app = await fin.Application.getCurrent();
4438
+ * return await app.setZoomLevel(number);
4439
+ * }
4440
+ *
4441
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
4442
+ * ```
4443
+ */
4444
+ setZoomLevel(level) {
4445
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
4446
+ }
4447
+ /**
4448
+ * Sets a username to correlate with App Log Management.
4449
+ * @param username Username to correlate with App's Log.
4450
+ *
4451
+ * @example
4452
+ *
4453
+ * ```js
4454
+ * async function setAppLogUser() {
4455
+ * const app = await fin.Application.getCurrent();
4456
+ * return await app.setAppLogUsername('username');
4457
+ * }
4458
+ *
4459
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
4460
+ *
4461
+ * ```
4462
+ */
4463
+ async setAppLogUsername(username) {
4464
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
4465
+ }
4466
+ /**
4467
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
4468
+ * @remarks The only information currently returned is the position and dimensions.
4469
+ *
4470
+ * @example
4471
+ *
4472
+ * ```js
4473
+ * async function getTrayIconInfo() {
4474
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
4475
+ * return await app.getTrayIconInfo();
4476
+ * }
4477
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
4478
+ * ```
4479
+ */
4480
+ getTrayIconInfo() {
4481
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
4482
+ }
4483
+ /**
4484
+ * Checks if the application has an associated tray icon.
4485
+ *
4486
+ * @example
4487
+ *
4488
+ * ```js
4489
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
4490
+ * const hasTrayIcon = await app.hasTrayIcon();
4491
+ * console.log(hasTrayIcon);
4492
+ * ```
4493
+ */
4494
+ hasTrayIcon() {
4495
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
4496
+ }
4497
+ /**
4498
+ * Closes the application by terminating its process.
4499
+ *
4500
+ * @example
4501
+ *
4502
+ * ```js
4503
+ * async function terminateApp() {
4504
+ * const app = await fin.Application.getCurrent();
4505
+ * return await app.terminate();
4506
+ * }
4507
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
4508
+ * ```
4509
+ */
4510
+ terminate() {
4511
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
4512
+ }
4513
+ /**
4514
+ * Waits for a hanging application. This method can be called in response to an application
4515
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
4516
+ * message after a certain period of time.
4517
+ *
4518
+ * @ignore
4519
+ */
4520
+ wait() {
4521
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
4522
+ }
4523
+ /**
4524
+ * Retrieves information about the application.
4525
+ *
4526
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
4527
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
4528
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
4529
+ *
4530
+ * @example
4531
+ *
4532
+ * ```js
4533
+ * async function getInfo() {
4534
+ * const app = await fin.Application.getCurrent();
4535
+ * return await app.getInfo();
4536
+ * }
4537
+ *
4538
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
4539
+ * ```
4540
+ */
4541
+ getInfo() {
4542
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
4543
+ }
4544
+ /**
4545
+ * Retrieves all process information for entities (windows and views) associated with an application.
4546
+ *
4547
+ * @example
4548
+ * ```js
4549
+ * const app = await fin.Application.getCurrent();
4550
+ * const processInfo = await app.getProcessInfo();
4551
+ * ```
4552
+ * @experimental
4553
+ */
4554
+ async getProcessInfo() {
4555
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
4556
+ return data;
4557
+ }
4558
+ /**
4559
+ * Sets file auto download location. It's only allowed in the same application.
4560
+ *
4561
+ * Note: This method is restricted by default and must be enabled via
4562
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4563
+ * @param downloadLocation file auto download location
4564
+ *
4565
+ * @throws if setting file auto download location on different applications.
4566
+ * @example
4567
+ *
4568
+ * ```js
4569
+ * const downloadLocation = 'C:\\dev\\temp';
4570
+ * const app = await fin.Application.getCurrent();
4571
+ * try {
4572
+ * await app.setFileDownloadLocation(downloadLocation);
4573
+ * console.log('File download location is set');
4574
+ * } catch(err) {
4575
+ * console.error(err)
4576
+ * }
4577
+ * ```
4578
+ */
4579
+ async setFileDownloadLocation(downloadLocation) {
4580
+ const { name } = this.wire.me;
4581
+ const entityIdentity = { uuid: this.identity.uuid, name };
4582
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
4583
+ }
4584
+ /**
4585
+ * 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.
4586
+ *
4587
+ * Note: This method is restricted by default and must be enabled via
4588
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
4589
+ *
4590
+ * @throws if getting file auto download location on different applications.
4591
+ * @example
4592
+ *
4593
+ * ```js
4594
+ * const app = await fin.Application.getCurrent();
4595
+ * const fileDownloadDir = await app.getFileDownloadLocation();
4596
+ * ```
4597
+ */
4598
+ async getFileDownloadLocation() {
4599
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
4600
+ return data;
4601
+ }
4602
+ /**
4603
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
4604
+ * @param options
4605
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
4606
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
4607
+ * of all possible data shapes for the entire menu, and the click handler should process
4608
+ * these with a "reducer" pattern.
4609
+ * @throws if the application has no tray icon set
4610
+ * @throws if the system tray is currently hidden
4611
+ * @example
4612
+ *
4613
+ * ```js
4614
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
4615
+ * const app = fin.Application.getCurrentSync();
4616
+ *
4617
+ * await app.setTrayIcon(iconUrl);
4618
+ *
4619
+ * const template = [
4620
+ * {
4621
+ * label: 'Menu Item 1',
4622
+ * data: 'hello from item 1'
4623
+ * },
4624
+ * { type: 'separator' },
4625
+ * {
4626
+ * label: 'Menu Item 2',
4627
+ * type: 'checkbox',
4628
+ * checked: true,
4629
+ * data: 'The user clicked the checkbox'
4630
+ * },
4631
+ * {
4632
+ * label: 'see more',
4633
+ * enabled: false,
4634
+ * submenu: [
4635
+ * { label: 'submenu 1', data: 'hello from submenu' }
4636
+ * ]
4637
+ * }
4638
+ * ];
4639
+ *
4640
+ * app.addListener('tray-icon-clicked', (event) => {
4641
+ * // right-click
4642
+ * if (event.button === 2) {
4643
+ * app.showTrayIconPopupMenu({ template }).then(r => {
4644
+ * if (r.result === 'closed') {
4645
+ * console.log('nothing happened');
4646
+ * } else {
4647
+ * console.log(r.data);
4648
+ * }
4649
+ * });
4650
+ * }
4651
+ * });
4652
+ * ```
4653
+ */
4654
+ async showTrayIconPopupMenu(options) {
4655
+ const { name } = this.wire.me;
4656
+ const entityIdentity = { uuid: this.identity.uuid, name };
4657
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
4658
+ return payload.data;
4659
+ }
4660
+ /**
4661
+ * Closes the tray icon menu.
4662
+ *
4663
+ * @throws if the application has no tray icon set
4664
+ * @example
4665
+ *
4666
+ * ```js
4667
+ * const app = fin.Application.getCurrentSync();
4668
+ *
4669
+ * await app.closeTrayIconPopupMenu();
4670
+ * ```
4671
+ */
4672
+ async closeTrayIconPopupMenu() {
4673
+ const { name } = this.wire.me;
4674
+ const entityIdentity = { uuid: this.identity.uuid, name };
4675
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
4676
+ }
4677
+ }
4678
+ Instance$5.Application = Application;
4679
+
4680
+ Object.defineProperty(Factory$6, "__esModule", { value: true });
4681
+ Factory$6.ApplicationModule = void 0;
4682
+ const base_1$m = base;
4683
+ const validate_1$4 = validate;
4684
+ const Instance_1$5 = Instance$5;
4685
+ /**
4686
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4687
+ */
4688
+ class ApplicationModule extends base_1$m.Base {
4689
+ /**
4690
+ * Asynchronously returns an API handle for the given Application identity.
4691
+ *
4692
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4693
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4694
+ * for an Application throughout its entire lifecycle.
4695
+ *
4696
+ * @example
4697
+ *
4698
+ * ```js
4699
+ * fin.Application.wrap({ uuid: 'testapp' })
4700
+ * .then(app => app.isRunning())
4701
+ * .then(running => console.log('Application is running: ' + running))
4702
+ * .catch(err => console.log(err));
4703
+ * ```
4704
+ *
4705
+ */
4706
+ async wrap(identity) {
4707
+ this.wire.sendAction('wrap-application').catch((e) => {
4708
+ // we do not want to expose this error, just continue if this analytics-only call fails
4709
+ });
4710
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
4711
+ if (errorMsg) {
4712
+ throw new Error(errorMsg);
4713
+ }
4714
+ return new Instance_1$5.Application(this.wire, identity);
4715
+ }
4716
+ /**
4717
+ * Synchronously returns an API handle for the given Application identity.
4718
+ *
4719
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4720
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4721
+ * for an Aplication throughout its entire lifecycle.
4722
+ *
4723
+ * @example
4724
+ *
4725
+ * ```js
4726
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
4727
+ * await app.close();
4728
+ * ```
4729
+ *
4730
+ */
4731
+ wrapSync(identity) {
4732
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
4733
+ // we do not want to expose this error, just continue if this analytics-only call fails
4734
+ });
4735
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
4736
+ if (errorMsg) {
4737
+ throw new Error(errorMsg);
4738
+ }
4739
+ return new Instance_1$5.Application(this.wire, identity);
4740
+ }
4741
+ async _create(appOptions) {
4742
+ // set defaults:
4743
+ if (appOptions.waitForPageLoad === undefined) {
4744
+ appOptions.waitForPageLoad = false;
4745
+ }
4746
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
4747
+ appOptions.autoShow = true;
4748
+ }
4749
+ await this.wire.sendAction('create-application', appOptions);
4750
+ return this.wrap({ uuid: appOptions.uuid });
4751
+ }
4752
+ /**
4753
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
4754
+ *
4755
+ * @example
4756
+ *
4757
+ * ```js
4758
+ * async function createApp() {
4759
+ * const app = await fin.Application.create({
4760
+ * name: 'myApp',
4761
+ * uuid: 'app-3',
4762
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
4763
+ * autoShow: true
4764
+ * });
4765
+ * await app.run();
4766
+ * }
4767
+ *
4768
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
4769
+ * ```
4770
+ *
4771
+ * @ignore
4772
+ */
4773
+ create(appOptions) {
4774
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
4775
+ this.wire.sendAction('application-create').catch((e) => {
4776
+ // we do not want to expose this error, just continue if this analytics-only call fails
4777
+ });
4778
+ return this._create(appOptions);
4779
+ }
4780
+ /**
4781
+ * Creates and starts a new Application.
4782
+ *
4783
+ * @example
4784
+ *
4785
+ * ```js
4786
+ * async function start() {
4787
+ * return fin.Application.start({
4788
+ * name: 'app-1',
4789
+ * uuid: 'app-1',
4790
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
4791
+ * autoShow: true
4792
+ * });
4793
+ * }
4794
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
4795
+ * ```
4796
+ *
4797
+ */
4798
+ async start(appOptions) {
4799
+ this.wire.sendAction('start-application').catch((e) => {
4800
+ // we do not want to expose this error, just continue if this analytics-only call fails
4801
+ });
4802
+ const app = await this._create(appOptions);
4803
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
4804
+ return app;
4805
+ }
4806
+ /**
4807
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
4808
+ * Returns once the RVM is finished attempting to launch the applications.
4809
+ * @param opts - Parameters that the RVM will use.
4810
+ *
4811
+ * @example
4812
+ *
4813
+ * ```js
4814
+ *
4815
+ * const applicationInfoArray = [
4816
+ * {
4817
+ * "uuid": 'App-1',
4818
+ * "manifestUrl": 'http://localhost:5555/app1.json',
4819
+ * },
4820
+ * {
4821
+ * "uuid": 'App-2',
4822
+ * "manifestUrl": 'http://localhost:5555/app2.json',
4823
+ * },
4824
+ * {
4825
+ * "uuid": 'App-3',
4826
+ * "manifestUrl": 'http://localhost:5555/app3.json',
4827
+ * }
4828
+ * ]
4829
+ *
4830
+ * fin.Application.startManyManifests(applicationInfoArray)
4831
+ * .then(() => {
4832
+ * console.log('RVM has finished launching the application list.');
4833
+ * })
4834
+ * .catch((err) => {
4835
+ * console.log(err);
4836
+ * })
4837
+ * ```
4838
+ *
4839
+ * @experimental
4840
+ */
4841
+ async startManyManifests(applications, opts) {
4842
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
4843
+ }
4844
+ /**
4845
+ * Asynchronously returns an Application object that represents the current application
4846
+ *
4847
+ * @example
4848
+ *
4849
+ * ```js
4850
+ * async function isCurrentAppRunning () {
4851
+ * const app = await fin.Application.getCurrent();
4852
+ * return app.isRunning();
4853
+ * }
4854
+ *
4855
+ * isCurrentAppRunning().then(running => {
4856
+ * console.log(`Current app is running: ${running}`);
4857
+ * }).catch(err => {
4858
+ * console.error(err);
4859
+ * });
4860
+ *
4861
+ * ```
4862
+ */
4863
+ getCurrent() {
4864
+ this.wire.sendAction('get-current-application').catch((e) => {
4865
+ // we do not want to expose this error, just continue if this analytics-only call fails
4866
+ });
4867
+ return this.wrap({ uuid: this.wire.me.uuid });
4868
+ }
4869
+ /**
4870
+ * Synchronously returns an Application object that represents the current application
4871
+ *
4872
+ * @example
4873
+ *
4874
+ * ```js
4875
+ * async function isCurrentAppRunning () {
4876
+ * const app = fin.Application.getCurrentSync();
4877
+ * return app.isRunning();
4878
+ * }
4879
+ *
4880
+ * isCurrentAppRunning().then(running => {
4881
+ * console.log(`Current app is running: ${running}`);
4882
+ * }).catch(err => {
4883
+ * console.error(err);
4884
+ * });
4885
+ *
4886
+ * ```
4887
+ */
4888
+ getCurrentSync() {
4889
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
4890
+ // we do not want to expose this error, just continue if this analytics-only call fails
4891
+ });
4892
+ return this.wrapSync({ uuid: this.wire.me.uuid });
4893
+ }
4894
+ /**
4895
+ * Retrieves application's manifest and returns a running instance of the application.
4896
+ * @param manifestUrl - The URL of app's manifest.
4897
+ * @param opts - Parameters that the RVM will use.
4898
+ *
4899
+ * @example
4900
+ *
4901
+ * ```js
4902
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4903
+ *
4904
+ * // For a local manifest file:
4905
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4906
+ * ```
4907
+ */
4908
+ async startFromManifest(manifestUrl, opts) {
4909
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
4910
+ // we do not want to expose this error, just continue if this analytics-only call fails
4911
+ });
4912
+ const app = await this._createFromManifest(manifestUrl);
4913
+ // @ts-expect-error using private method without warning.
4914
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
4915
+ return app;
4916
+ }
4917
+ /**
4918
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
4919
+ * Retrieves application's manifest and returns a wrapped application.
4920
+ * @param manifestUrl - The URL of app's manifest.
4921
+ * @param callback - called if the method succeeds.
4922
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
4923
+ *
4924
+ * @example
4925
+ *
4926
+ * ```js
4927
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
4928
+ * ```
4929
+ * @ignore
4930
+ */
4931
+ createFromManifest(manifestUrl) {
4932
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
4933
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
4934
+ // we do not want to expose this error, just continue if this analytics-only call fails
4935
+ });
4936
+ return this._createFromManifest(manifestUrl);
4937
+ }
4938
+ _createFromManifest(manifestUrl) {
4939
+ return this.wire
4940
+ .sendAction('get-application-manifest', { manifestUrl })
4941
+ .then(({ payload }) => {
4942
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
4943
+ return this.wrap({ uuid });
4944
+ })
4945
+ .then((app) => {
4946
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
4947
+ return app;
4948
+ });
4949
+ }
4685
4950
  }
4951
+ Factory$6.ApplicationModule = ApplicationModule;
4686
4952
 
4687
- var hasRequiredFactory$1;
4688
-
4689
- function requireFactory$1 () {
4690
- if (hasRequiredFactory$1) return Factory$6;
4691
- hasRequiredFactory$1 = 1;
4692
- Object.defineProperty(Factory$6, "__esModule", { value: true });
4693
- Factory$6.ApplicationModule = void 0;
4694
- const base_1 = base;
4695
- const validate_1 = validate;
4696
- const Instance_1 = requireInstance$2();
4953
+ (function (exports) {
4954
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4955
+ if (k2 === undefined) k2 = k;
4956
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4957
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4958
+ desc = { enumerable: true, get: function() { return m[k]; } };
4959
+ }
4960
+ Object.defineProperty(o, k2, desc);
4961
+ }) : (function(o, m, k, k2) {
4962
+ if (k2 === undefined) k2 = k;
4963
+ o[k2] = m[k];
4964
+ }));
4965
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4966
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4967
+ };
4968
+ Object.defineProperty(exports, "__esModule", { value: true });
4697
4969
  /**
4698
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4970
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
4971
+ *
4972
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4973
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4974
+ *
4975
+ * 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),
4976
+ * both of these were documented on the same page.
4977
+ *
4978
+ * @packageDocumentation
4699
4979
  */
4700
- class ApplicationModule extends base_1.Base {
4701
- /**
4702
- * Asynchronously returns an API handle for the given Application identity.
4703
- *
4704
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4705
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4706
- * for an Application throughout its entire lifecycle.
4707
- *
4708
- * @example
4709
- *
4710
- * ```js
4711
- * fin.Application.wrap({ uuid: 'testapp' })
4712
- * .then(app => app.isRunning())
4713
- * .then(running => console.log('Application is running: ' + running))
4714
- * .catch(err => console.log(err));
4715
- * ```
4716
- *
4717
- */
4718
- async wrap(identity) {
4719
- this.wire.sendAction('wrap-application').catch((e) => {
4720
- // we do not want to expose this error, just continue if this analytics-only call fails
4721
- });
4722
- const errorMsg = (0, validate_1.validateIdentity)(identity);
4723
- if (errorMsg) {
4724
- throw new Error(errorMsg);
4725
- }
4726
- return new Instance_1.Application(this.wire, identity);
4727
- }
4728
- /**
4729
- * Synchronously returns an API handle for the given Application identity.
4730
- *
4731
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4732
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4733
- * for an Aplication throughout its entire lifecycle.
4734
- *
4735
- * @example
4736
- *
4737
- * ```js
4738
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
4739
- * await app.close();
4740
- * ```
4741
- *
4742
- */
4743
- wrapSync(identity) {
4744
- this.wire.sendAction('wrap-application-sync').catch((e) => {
4745
- // we do not want to expose this error, just continue if this analytics-only call fails
4746
- });
4747
- const errorMsg = (0, validate_1.validateIdentity)(identity);
4748
- if (errorMsg) {
4749
- throw new Error(errorMsg);
4750
- }
4751
- return new Instance_1.Application(this.wire, identity);
4752
- }
4753
- async _create(appOptions) {
4754
- // set defaults:
4755
- if (appOptions.waitForPageLoad === undefined) {
4756
- appOptions.waitForPageLoad = false;
4757
- }
4758
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
4759
- appOptions.autoShow = true;
4760
- }
4761
- await this.wire.sendAction('create-application', appOptions);
4762
- return this.wrap({ uuid: appOptions.uuid });
4763
- }
4764
- /**
4765
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
4766
- *
4767
- * @example
4768
- *
4769
- * ```js
4770
- * async function createApp() {
4771
- * const app = await fin.Application.create({
4772
- * name: 'myApp',
4773
- * uuid: 'app-3',
4774
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
4775
- * autoShow: true
4776
- * });
4777
- * await app.run();
4778
- * }
4779
- *
4780
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
4781
- * ```
4782
- *
4783
- * @ignore
4784
- */
4785
- create(appOptions) {
4786
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
4787
- this.wire.sendAction('application-create').catch((e) => {
4788
- // we do not want to expose this error, just continue if this analytics-only call fails
4789
- });
4790
- return this._create(appOptions);
4791
- }
4792
- /**
4793
- * Creates and starts a new Application.
4794
- *
4795
- * @example
4796
- *
4797
- * ```js
4798
- * async function start() {
4799
- * return fin.Application.start({
4800
- * name: 'app-1',
4801
- * uuid: 'app-1',
4802
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
4803
- * autoShow: true
4804
- * });
4805
- * }
4806
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
4807
- * ```
4808
- *
4809
- */
4810
- async start(appOptions) {
4811
- this.wire.sendAction('start-application').catch((e) => {
4812
- // we do not want to expose this error, just continue if this analytics-only call fails
4813
- });
4814
- const app = await this._create(appOptions);
4815
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
4816
- return app;
4817
- }
4818
- /**
4819
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
4820
- * Returns once the RVM is finished attempting to launch the applications.
4821
- * @param opts - Parameters that the RVM will use.
4822
- *
4823
- * @example
4824
- *
4825
- * ```js
4826
- *
4827
- * const applicationInfoArray = [
4828
- * {
4829
- * "uuid": 'App-1',
4830
- * "manifestUrl": 'http://localhost:5555/app1.json',
4831
- * },
4832
- * {
4833
- * "uuid": 'App-2',
4834
- * "manifestUrl": 'http://localhost:5555/app2.json',
4835
- * },
4836
- * {
4837
- * "uuid": 'App-3',
4838
- * "manifestUrl": 'http://localhost:5555/app3.json',
4839
- * }
4840
- * ]
4841
- *
4842
- * fin.Application.startManyManifests(applicationInfoArray)
4843
- * .then(() => {
4844
- * console.log('RVM has finished launching the application list.');
4845
- * })
4846
- * .catch((err) => {
4847
- * console.log(err);
4848
- * })
4849
- * ```
4850
- *
4851
- * @experimental
4852
- */
4853
- async startManyManifests(applications, opts) {
4854
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
4855
- }
4856
- /**
4857
- * Asynchronously returns an Application object that represents the current application
4858
- *
4859
- * @example
4860
- *
4861
- * ```js
4862
- * async function isCurrentAppRunning () {
4863
- * const app = await fin.Application.getCurrent();
4864
- * return app.isRunning();
4865
- * }
4866
- *
4867
- * isCurrentAppRunning().then(running => {
4868
- * console.log(`Current app is running: ${running}`);
4869
- * }).catch(err => {
4870
- * console.error(err);
4871
- * });
4872
- *
4873
- * ```
4874
- */
4875
- getCurrent() {
4876
- this.wire.sendAction('get-current-application').catch((e) => {
4877
- // we do not want to expose this error, just continue if this analytics-only call fails
4878
- });
4879
- return this.wrap({ uuid: this.wire.me.uuid });
4880
- }
4881
- /**
4882
- * Synchronously returns an Application object that represents the current application
4883
- *
4884
- * @example
4885
- *
4886
- * ```js
4887
- * async function isCurrentAppRunning () {
4888
- * const app = fin.Application.getCurrentSync();
4889
- * return app.isRunning();
4890
- * }
4891
- *
4892
- * isCurrentAppRunning().then(running => {
4893
- * console.log(`Current app is running: ${running}`);
4894
- * }).catch(err => {
4895
- * console.error(err);
4896
- * });
4897
- *
4898
- * ```
4899
- */
4900
- getCurrentSync() {
4901
- this.wire.sendAction('get-current-application-sync').catch((e) => {
4902
- // we do not want to expose this error, just continue if this analytics-only call fails
4903
- });
4904
- return this.wrapSync({ uuid: this.wire.me.uuid });
4905
- }
4906
- /**
4907
- * Retrieves application's manifest and returns a running instance of the application.
4908
- * @param manifestUrl - The URL of app's manifest.
4909
- * @param opts - Parameters that the RVM will use.
4910
- *
4911
- * @example
4912
- *
4913
- * ```js
4914
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4915
- *
4916
- * // For a local manifest file:
4917
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4918
- * ```
4919
- */
4920
- async startFromManifest(manifestUrl, opts) {
4921
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
4922
- // we do not want to expose this error, just continue if this analytics-only call fails
4923
- });
4924
- const app = await this._createFromManifest(manifestUrl);
4925
- // @ts-expect-error using private method without warning.
4926
- await app._run(opts); // eslint-disable-line no-underscore-dangle
4927
- return app;
4928
- }
4929
- /**
4930
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
4931
- * Retrieves application's manifest and returns a wrapped application.
4932
- * @param manifestUrl - The URL of app's manifest.
4933
- * @param callback - called if the method succeeds.
4934
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
4935
- *
4936
- * @example
4937
- *
4938
- * ```js
4939
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
4940
- * ```
4941
- * @ignore
4942
- */
4943
- createFromManifest(manifestUrl) {
4944
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
4945
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
4946
- // we do not want to expose this error, just continue if this analytics-only call fails
4947
- });
4948
- return this._createFromManifest(manifestUrl);
4949
- }
4950
- _createFromManifest(manifestUrl) {
4951
- return this.wire
4952
- .sendAction('get-application-manifest', { manifestUrl })
4953
- .then(({ payload }) => {
4954
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
4955
- return this.wrap({ uuid });
4956
- })
4957
- .then((app) => {
4958
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
4959
- return app;
4960
- });
4961
- }
4962
- }
4963
- Factory$6.ApplicationModule = ApplicationModule;
4964
- return Factory$6;
4965
- }
4966
-
4967
- var hasRequiredApplication;
4968
-
4969
- function requireApplication () {
4970
- if (hasRequiredApplication) return application;
4971
- hasRequiredApplication = 1;
4972
- (function (exports) {
4973
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4974
- if (k2 === undefined) k2 = k;
4975
- var desc = Object.getOwnPropertyDescriptor(m, k);
4976
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4977
- desc = { enumerable: true, get: function() { return m[k]; } };
4978
- }
4979
- Object.defineProperty(o, k2, desc);
4980
- }) : (function(o, m, k, k2) {
4981
- if (k2 === undefined) k2 = k;
4982
- o[k2] = m[k];
4983
- }));
4984
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4985
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4986
- };
4987
- Object.defineProperty(exports, "__esModule", { value: true });
4988
- /**
4989
- * Entry points for the OpenFin `Application` API (`fin.Application`).
4990
- *
4991
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4992
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4993
- *
4994
- * 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),
4995
- * both of these were documented on the same page.
4996
- *
4997
- * @packageDocumentation
4998
- */
4999
- __exportStar(requireFactory$1(), exports);
5000
- __exportStar(requireInstance$2(), exports);
5001
- } (application));
5002
- return application;
5003
- }
4980
+ __exportStar(Factory$6, exports);
4981
+ __exportStar(Instance$5, exports);
4982
+ } (application));
5004
4983
 
5005
4984
  var promisifySubscription$1 = {};
5006
4985
 
@@ -5044,7 +5023,7 @@ function requireInstance$1 () {
5044
5023
  /* eslint-disable @typescript-eslint/no-unused-vars */
5045
5024
  /* eslint-disable no-console */
5046
5025
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
5047
- const application_1 = requireApplication();
5026
+ const application_1 = application;
5048
5027
  const main_1 = main;
5049
5028
  const view_1 = requireView();
5050
5029
  const warnings_1 = warnings;
@@ -7105,7 +7084,7 @@ function requireView () {
7105
7084
  *
7106
7085
  * @packageDocumentation
7107
7086
  */
7108
- __exportStar(requireFactory$2(), exports);
7087
+ __exportStar(requireFactory$1(), exports);
7109
7088
  __exportStar(requireInstance(), exports);
7110
7089
  } (view));
7111
7090
  return view;
@@ -17755,7 +17734,7 @@ const events_1 = require$$0;
17755
17734
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17756
17735
  const index_1 = system;
17757
17736
  const index_2 = requireWindow();
17758
- const index_3 = requireApplication();
17737
+ const index_3 = application;
17759
17738
  const index_4 = interappbus;
17760
17739
  const index_5 = clipboard;
17761
17740
  const index_6 = externalApplication;