@openfin/remote-adapter 41.100.52 → 41.100.54

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