@openfin/core 37.81.17 → 38.81.9

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/mock.js +1118 -1139
  2. package/package.json +1 -1
package/out/mock.js CHANGED
@@ -682,11 +682,11 @@ const handleDeprecatedWarnings = (options) => {
682
682
  };
683
683
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
684
684
 
685
- var hasRequiredFactory$3;
685
+ var hasRequiredFactory$2;
686
686
 
687
- function requireFactory$3 () {
688
- if (hasRequiredFactory$3) return Factory$6;
689
- hasRequiredFactory$3 = 1;
687
+ function requireFactory$2 () {
688
+ if (hasRequiredFactory$2) return Factory$6;
689
+ hasRequiredFactory$2 = 1;
690
690
  Object.defineProperty(Factory$6, "__esModule", { value: true });
691
691
  Factory$6.ViewModule = void 0;
692
692
  const base_1 = base;
@@ -1563,8 +1563,8 @@ var main = {};
1563
1563
 
1564
1564
  Object.defineProperty(main, "__esModule", { value: true });
1565
1565
  main.WebContents = void 0;
1566
- const base_1$j = base;
1567
- class WebContents extends base_1$j.EmitterBase {
1566
+ const base_1$l = base;
1567
+ class WebContents extends base_1$l.EmitterBase {
1568
1568
  /**
1569
1569
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
1570
1570
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -2630,11 +2630,11 @@ class WebContents extends base_1$j.EmitterBase {
2630
2630
  }
2631
2631
  main.WebContents = WebContents;
2632
2632
 
2633
- var hasRequiredInstance$2;
2633
+ var hasRequiredInstance$1;
2634
2634
 
2635
- function requireInstance$2 () {
2636
- if (hasRequiredInstance$2) return Instance$5;
2637
- hasRequiredInstance$2 = 1;
2635
+ function requireInstance$1 () {
2636
+ if (hasRequiredInstance$1) return Instance$5;
2637
+ hasRequiredInstance$1 = 1;
2638
2638
  var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2639
2639
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2640
2640
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
@@ -3229,1141 +3229,1120 @@ function requireView () {
3229
3229
  *
3230
3230
  * @packageDocumentation
3231
3231
  */
3232
- __exportStar(requireFactory$3(), exports);
3233
- __exportStar(requireInstance$2(), exports);
3232
+ __exportStar(requireFactory$2(), exports);
3233
+ __exportStar(requireInstance$1(), exports);
3234
3234
  } (view));
3235
3235
  return view;
3236
3236
  }
3237
3237
 
3238
- var hasRequiredInstance$1;
3239
-
3240
- function requireInstance$1 () {
3241
- if (hasRequiredInstance$1) return Instance$6;
3242
- hasRequiredInstance$1 = 1;
3243
- Object.defineProperty(Instance$6, "__esModule", { value: true });
3244
- Instance$6.Application = void 0;
3245
- /* eslint-disable import/prefer-default-export */
3246
- const base_1 = base;
3247
- const window_1 = requireWindow();
3248
- const view_1 = requireView();
3249
- /**
3250
- * An object representing an application. Allows the developer to create,
3251
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
3252
- */
3253
- class Application extends base_1.EmitterBase {
3254
- /**
3255
- * @internal
3256
- */
3257
- constructor(wire, identity) {
3258
- super(wire, 'application', identity.uuid);
3259
- this.identity = identity;
3260
- this.window = new window_1._Window(this.wire, {
3261
- uuid: this.identity.uuid,
3262
- name: this.identity.uuid
3263
- });
3264
- }
3265
- windowListFromIdentityList(identityList) {
3266
- const windowList = [];
3267
- identityList.forEach((identity) => {
3268
- windowList.push(new window_1._Window(this.wire, {
3269
- uuid: identity.uuid,
3270
- name: identity.name
3271
- }));
3272
- });
3273
- return windowList;
3274
- }
3275
- /**
3276
- * Determines if the application is currently running.
3277
- *
3278
- * @example
3279
- *
3280
- * ```js
3281
- * async function isAppRunning() {
3282
- * const app = await fin.Application.getCurrent();
3283
- * return await app.isRunning();
3284
- * }
3285
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
3286
- * ```
3287
- */
3288
- isRunning() {
3289
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
3290
- }
3291
- /**
3292
- * Closes the application and any child windows created by the application.
3293
- * Cleans the application from state so it is no longer found in getAllApplications.
3294
- * @param force Close will be prevented from closing when force is false and
3295
- * ‘close-requested’ has been subscribed to for application’s main window.
3296
- *
3297
- * @example
3298
- *
3299
- * ```js
3300
- * async function closeApp() {
3301
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
3302
- * const app = await fin.Application.wrap({uuid: 'app2'});
3303
- * await app.quit();
3304
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
3305
- *
3306
- * }
3307
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
3308
- * ```
3309
- */
3310
- async quit(force = false) {
3311
- try {
3312
- await this._close(force);
3313
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
3314
- }
3315
- catch (error) {
3316
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
3317
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
3318
- throw error;
3319
- }
3320
- }
3321
- }
3322
- async _close(force = false) {
3323
- try {
3324
- await this.wire.sendAction('close-application', { force, ...this.identity });
3325
- }
3326
- catch (error) {
3327
- if (!error.message.includes('Remote connection has closed')) {
3328
- throw error;
3329
- }
3330
- }
3331
- }
3332
- /**
3333
- * @deprecated use Application.quit instead
3334
- * Closes the application and any child windows created by the application.
3335
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
3336
- * @param callback - called if the method succeeds.
3337
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3338
- *
3339
- * @example
3340
- *
3341
- * ```js
3342
- * async function closeApp() {
3343
- * const app = await fin.Application.getCurrent();
3344
- * return await app.close();
3345
- * }
3346
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
3347
- * ```
3348
- */
3349
- close(force = false) {
3350
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
3351
- this.wire.sendAction('application-close', this.identity).catch((e) => {
3352
- // we do not want to expose this error, just continue if this analytics-only call fails
3353
- });
3354
- return this._close(force);
3355
- }
3356
- /**
3357
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
3358
- *
3359
- * @example
3360
- *
3361
- * ```js
3362
- * async function getChildWindows() {
3363
- * const app = await fin.Application.getCurrent();
3364
- * return await app.getChildWindows();
3365
- * }
3366
- *
3367
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
3368
- * ```
3369
- */
3370
- getChildWindows() {
3371
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
3372
- const identityList = [];
3373
- payload.data.forEach((winName) => {
3374
- identityList.push({ uuid: this.identity.uuid, name: winName });
3375
- });
3376
- return this.windowListFromIdentityList(identityList);
3377
- });
3378
- }
3379
- /**
3380
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
3381
- * if the application was not created from a manifest.
3382
- *
3383
- * @example
3384
- *
3385
- * ```js
3386
- * async function getManifest() {
3387
- * const app = await fin.Application.getCurrent();
3388
- * return await app.getManifest();
3389
- * }
3390
- *
3391
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
3392
- * ```
3393
- */
3394
- getManifest() {
3395
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
3396
- }
3397
- /**
3398
- * Retrieves UUID of the application that launches this application. Invokes the error callback
3399
- * if the application was created from a manifest.
3400
- *
3401
- * @example
3402
- *
3403
- * ```js
3404
- * async function getParentUuid() {
3405
- * const app = await fin.Application.start({
3406
- * uuid: 'app-1',
3407
- * name: 'myApp',
3408
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
3409
- * autoShow: true
3410
- * });
3411
- * return await app.getParentUuid();
3412
- * }
3413
- *
3414
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
3415
- * ```
3416
- */
3417
- getParentUuid() {
3418
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
3419
- }
3420
- /**
3421
- * Retrieves current application's shortcut configuration.
3422
- *
3423
- * @example
3424
- *
3425
- * ```js
3426
- * async function getShortcuts() {
3427
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3428
- * return await app.getShortcuts();
3429
- * }
3430
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
3431
- * ```
3432
- */
3433
- getShortcuts() {
3434
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
3435
- }
3436
- /**
3437
- * Retrieves current application's views.
3438
- * @experimental
3439
- *
3440
- * @example
3441
- *
3442
- * ```js
3443
- * async function getViews() {
3444
- * const app = await fin.Application.getCurrent();
3445
- * return await app.getViews();
3446
- * }
3447
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
3448
- * ```
3449
- */
3450
- async getViews() {
3451
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
3452
- return payload.data.map((id) => new view_1.View(this.wire, id));
3453
- }
3454
- /**
3455
- * Returns the current zoom level of the application.
3456
- *
3457
- * @example
3458
- *
3459
- * ```js
3460
- * async function getZoomLevel() {
3461
- * const app = await fin.Application.getCurrent();
3462
- * return await app.getZoomLevel();
3463
- * }
3464
- *
3465
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
3466
- * ```
3467
- */
3468
- getZoomLevel() {
3469
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
3470
- }
3471
- /**
3472
- * Returns an instance of the main Window of the application
3473
- *
3474
- * @example
3475
- *
3476
- * ```js
3477
- * async function getWindow() {
3478
- * const app = await fin.Application.start({
3479
- * uuid: 'app-1',
3480
- * name: 'myApp',
3481
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
3482
- * autoShow: true
3483
- * });
3484
- * return await app.getWindow();
3485
- * }
3486
- *
3487
- * getWindow().then(win => {
3488
- * win.showAt(0, 400);
3489
- * win.flash();
3490
- * }).catch(err => console.log(err));
3491
- * ```
3492
- */
3493
- getWindow() {
3494
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
3495
- // we do not want to expose this error, just continue if this analytics-only call fails
3496
- });
3497
- return Promise.resolve(this.window);
3498
- }
3499
- /**
3500
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
3501
- * @param userName - username to be passed to the RVM.
3502
- * @param appName - app name to be passed to the RVM.
3503
- *
3504
- * @example
3505
- *
3506
- * ```js
3507
- * async function registerUser() {
3508
- * const app = await fin.Application.getCurrent();
3509
- * return await app.registerUser('user', 'myApp');
3510
- * }
3511
- *
3512
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
3513
- * ```
3514
- */
3515
- registerUser(userName, appName) {
3516
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
3517
- }
3518
- /**
3519
- * Removes the application’s icon from the tray.
3520
- *
3521
- * @example
3522
- *
3523
- * ```js
3524
- * async function removeTrayIcon() {
3525
- * const app = await fin.Application.getCurrent();
3526
- * return await app.removeTrayIcon();
3527
- * }
3528
- *
3529
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
3530
- * ```
3531
- */
3532
- removeTrayIcon() {
3533
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
3534
- }
3535
- /**
3536
- * Restarts the application.
3537
- *
3538
- * @example
3539
- *
3540
- * ```js
3541
- * async function restartApp() {
3542
- * const app = await fin.Application.getCurrent();
3543
- * return await app.restart();
3544
- * }
3545
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
3546
- * ```
3547
- */
3548
- restart() {
3549
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
3550
- }
3551
- /**
3552
- * DEPRECATED method to run the application.
3553
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
3554
- *
3555
- * @example
3556
- *
3557
- * ```js
3558
- * async function run() {
3559
- * const app = await fin.Application.create({
3560
- * name: 'myApp',
3561
- * uuid: 'app-1',
3562
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
3563
- * autoShow: true
3564
- * });
3565
- * await app.run();
3566
- * }
3567
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
3568
- * ```
3569
- *
3570
- * @ignore
3571
- */
3572
- run() {
3573
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
3574
- this.wire.sendAction('application-run', this.identity).catch((e) => {
3575
- // we do not want to expose this error, just continue if this analytics-only call fails
3576
- });
3577
- return this._run();
3578
- }
3579
- _run(opts = {}) {
3580
- return this.wire
3581
- .sendAction('run-application', {
3582
- manifestUrl: this._manifestUrl,
3583
- opts,
3584
- ...this.identity
3585
- })
3586
- .then(() => undefined);
3587
- }
3588
- /**
3589
- * Instructs the RVM to schedule one restart of the application.
3590
- *
3591
- * @example
3592
- *
3593
- * ```js
3594
- * async function scheduleRestart() {
3595
- * const app = await fin.Application.getCurrent();
3596
- * return await app.scheduleRestart();
3597
- * }
3598
- *
3599
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
3600
- * ```
3601
- */
3602
- scheduleRestart() {
3603
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
3604
- }
3605
- /**
3606
- * Sends a message to the RVM to upload the application's logs. On success,
3607
- * an object containing logId is returned.
3608
- *
3609
- * @example
3610
- *
3611
- * ```js
3612
- * async function sendLog() {
3613
- * const app = await fin.Application.getCurrent();
3614
- * return await app.sendApplicationLog();
3615
- * }
3616
- *
3617
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
3618
- * ```
3619
- */
3620
- async sendApplicationLog() {
3621
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
3622
- return payload.data;
3623
- }
3624
- /**
3625
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
3626
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
3627
- *
3628
- * Note: If the "name" property is omitted it defaults to "tasks".
3629
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
3630
- *
3631
- *
3632
- * @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).
3633
- *
3634
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
3635
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
3636
- *
3637
- * Note: If the "name" property is omitted it defaults to "tasks".
3638
- *
3639
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
3640
- * uuid or shortcut.name is changed.
3641
- *
3642
- * @example
3643
- *
3644
- * ```js
3645
- * const app = fin.Application.getCurrentSync();
3646
- * const appName = 'My App';
3647
- * const jumpListConfig = [ // array of JumpList categories
3648
- * {
3649
- * // has no name and no type so `type` is assumed to be "tasks"
3650
- * items: [ // array of JumpList items
3651
- * {
3652
- * type: 'task',
3653
- * title: `Launch ${appName}`,
3654
- * description: `Runs ${appName} with the default configuration`,
3655
- * deepLink: 'fins://path.to/app/manifest.json',
3656
- * iconPath: 'https://path.to/app/icon.ico',
3657
- * iconIndex: 0
3658
- * },
3659
- * { type: 'separator' },
3660
- * {
3661
- * type: 'task',
3662
- * title: `Restore ${appName}`,
3663
- * description: 'Restore to last configuration',
3664
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
3665
- * iconPath: 'https://path.to/app/icon.ico',
3666
- * iconIndex: 0
3667
- * },
3668
- * ]
3669
- * },
3670
- * {
3671
- * name: 'Tools',
3672
- * items: [ // array of JumpList items
3673
- * {
3674
- * type: 'task',
3675
- * title: 'Tool A',
3676
- * description: 'Runs Tool A',
3677
- * deepLink: 'fins://path.to/tool-a/manifest.json',
3678
- * iconPath: 'https://path.to/tool-a/icon.ico',
3679
- * iconIndex: 0
3680
- * },
3681
- * {
3682
- * type: 'task',
3683
- * title: 'Tool B',
3684
- * description: 'Runs Tool B',
3685
- * deepLink: 'fins://path.to/tool-b/manifest.json',
3686
- * iconPath: 'https://path.to/tool-b/icon.ico',
3687
- * iconIndex: 0
3688
- * }]
3689
- * }
3690
- * ];
3691
- *
3692
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
3693
- * ```
3694
- *
3695
- * To handle deeplink args:
3696
- * ```js
3697
- * function handleUseLastConfiguration() {
3698
- * // this handler is called when the app is being launched
3699
- * app.on('run-requested', event => {
3700
- * if(event.userAppConfigArgs['use-last-configuration']) {
3701
- * // your logic here
3702
- * }
3703
- * });
3704
- * // this handler is called when the app was already running when the launch was requested
3705
- * fin.desktop.main(function(args) {
3706
- * if(args && args['use-last-configuration']) {
3707
- * // your logic here
3708
- * }
3709
- * });
3710
- * }
3711
- * ```
3712
- */
3713
- async setJumpList(jumpListCategories) {
3714
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
3715
- }
3716
- /**
3717
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
3718
- * @param icon Image URL or base64 encoded string to be used as the icon
3719
- *
3720
- * @example
3721
- *
3722
- * ```js
3723
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3724
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
3725
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
3726
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
3727
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
3728
- *
3729
- * async function setTrayIcon(icon) {
3730
- * const app = await fin.Application.getCurrent();
3731
- * return await app.setTrayIcon(icon);
3732
- * }
3733
- *
3734
- * // use image url to set tray icon
3735
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3736
- *
3737
- * // use base64 encoded string to set tray icon
3738
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3739
- *
3740
- * // use a dataURL to set tray icon
3741
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3742
- * ```
3743
- */
3744
- setTrayIcon(icon) {
3745
- return this.wire
3746
- .sendAction('set-tray-icon', {
3747
- enabledIcon: icon,
3748
- ...this.identity
3749
- })
3750
- .then(() => undefined);
3751
- }
3752
- /**
3753
- * Sets new application's shortcut configuration. Windows only.
3754
- * @param config New application's shortcut configuration.
3755
- *
3756
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3757
- * to be able to change shortcut states.
3758
- *
3759
- * @example
3760
- *
3761
- * ```js
3762
- * async function setShortcuts(config) {
3763
- * const app = await fin.Application.getCurrent();
3764
- * return app.setShortcuts(config);
3765
- * }
3766
- *
3767
- * setShortcuts({
3768
- * desktop: true,
3769
- * startMenu: false,
3770
- * systemStartup: true
3771
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3772
- * ```
3773
- */
3774
- setShortcuts(config) {
3775
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3776
- }
3777
- /**
3778
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3779
- * @param queryString The new query string for this app's shortcuts.
3780
- *
3781
- * @example
3782
- *
3783
- * ```js
3784
- * const newQueryArgs = 'arg=true&arg2=false';
3785
- * const app = await fin.Application.getCurrent();
3786
- * try {
3787
- * await app.setShortcutQueryParams(newQueryArgs);
3788
- * } catch(err) {
3789
- * console.error(err)
3790
- * }
3791
- * ```
3792
- */
3793
- async setShortcutQueryParams(queryString) {
3794
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3795
- }
3796
- /**
3797
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3798
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
3799
- * @param level The zoom level
3800
- *
3801
- * @example
3802
- *
3803
- * ```js
3804
- * async function setZoomLevel(number) {
3805
- * const app = await fin.Application.getCurrent();
3806
- * return await app.setZoomLevel(number);
3807
- * }
3808
- *
3809
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3810
- * ```
3811
- */
3812
- setZoomLevel(level) {
3813
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3814
- }
3815
- /**
3816
- * Sets a username to correlate with App Log Management.
3817
- * @param username Username to correlate with App's Log.
3818
- *
3819
- * @example
3820
- *
3821
- * ```js
3822
- * async function setAppLogUser() {
3823
- * const app = await fin.Application.getCurrent();
3824
- * return await app.setAppLogUsername('username');
3825
- * }
3826
- *
3827
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3828
- *
3829
- * ```
3830
- */
3831
- async setAppLogUsername(username) {
3832
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3833
- }
3834
- /**
3835
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3836
- * @remarks The only information currently returned is the position and dimensions.
3837
- *
3838
- * @example
3839
- *
3840
- * ```js
3841
- * async function getTrayIconInfo() {
3842
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3843
- * return await app.getTrayIconInfo();
3844
- * }
3845
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3846
- * ```
3847
- */
3848
- getTrayIconInfo() {
3849
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3850
- }
3851
- /**
3852
- * Checks if the application has an associated tray icon.
3853
- *
3854
- * @example
3855
- *
3856
- * ```js
3857
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3858
- * const hasTrayIcon = await app.hasTrayIcon();
3859
- * console.log(hasTrayIcon);
3860
- * ```
3861
- */
3862
- hasTrayIcon() {
3863
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3864
- }
3865
- /**
3866
- * Closes the application by terminating its process.
3867
- *
3868
- * @example
3869
- *
3870
- * ```js
3871
- * async function terminateApp() {
3872
- * const app = await fin.Application.getCurrent();
3873
- * return await app.terminate();
3874
- * }
3875
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3876
- * ```
3877
- */
3878
- terminate() {
3879
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3880
- }
3881
- /**
3882
- * Waits for a hanging application. This method can be called in response to an application
3883
- * "not-responding" to allow the application to continue and to generate another "not-responding"
3884
- * message after a certain period of time.
3885
- *
3886
- * @ignore
3887
- */
3888
- wait() {
3889
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3890
- }
3891
- /**
3892
- * Retrieves information about the application.
3893
- *
3894
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3895
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3896
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3897
- *
3898
- * @example
3899
- *
3900
- * ```js
3901
- * async function getInfo() {
3902
- * const app = await fin.Application.getCurrent();
3903
- * return await app.getInfo();
3904
- * }
3905
- *
3906
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3907
- * ```
3908
- */
3909
- getInfo() {
3910
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3911
- }
3912
- /**
3913
- * Retrieves all process information for entities (windows and views) associated with an application.
3914
- *
3915
- * @example
3916
- * ```js
3917
- * const app = await fin.Application.getCurrent();
3918
- * const processInfo = await app.getProcessInfo();
3919
- * ```
3920
- * @experimental
3921
- */
3922
- async getProcessInfo() {
3923
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3924
- return data;
3925
- }
3926
- /**
3927
- * Sets file auto download location. It's only allowed in the same application.
3928
- *
3929
- * Note: This method is restricted by default and must be enabled via
3930
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3931
- * @param downloadLocation file auto download location
3932
- *
3933
- * @throws if setting file auto download location on different applications.
3934
- * @example
3935
- *
3936
- * ```js
3937
- * const downloadLocation = 'C:\\dev\\temp';
3938
- * const app = await fin.Application.getCurrent();
3939
- * try {
3940
- * await app.setFileDownloadLocation(downloadLocation);
3941
- * console.log('File download location is set');
3942
- * } catch(err) {
3943
- * console.error(err)
3944
- * }
3945
- * ```
3946
- */
3947
- async setFileDownloadLocation(downloadLocation) {
3948
- const { name } = this.wire.me;
3949
- const entityIdentity = { uuid: this.identity.uuid, name };
3950
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3951
- }
3952
- /**
3953
- * 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.
3954
- *
3955
- * Note: This method is restricted by default and must be enabled via
3956
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3957
- *
3958
- * @throws if getting file auto download location on different applications.
3959
- * @example
3960
- *
3961
- * ```js
3962
- * const app = await fin.Application.getCurrent();
3963
- * const fileDownloadDir = await app.getFileDownloadLocation();
3964
- * ```
3965
- */
3966
- async getFileDownloadLocation() {
3967
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3968
- return data;
3969
- }
3970
- /**
3971
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3972
- * @param options
3973
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3974
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3975
- * of all possible data shapes for the entire menu, and the click handler should process
3976
- * these with a "reducer" pattern.
3977
- * @throws if the application has no tray icon set
3978
- * @throws if the system tray is currently hidden
3979
- * @example
3980
- *
3981
- * ```js
3982
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3983
- * const app = fin.Application.getCurrentSync();
3984
- *
3985
- * await app.setTrayIcon(iconUrl);
3986
- *
3987
- * const template = [
3988
- * {
3989
- * label: 'Menu Item 1',
3990
- * data: 'hello from item 1'
3991
- * },
3992
- * { type: 'separator' },
3993
- * {
3994
- * label: 'Menu Item 2',
3995
- * type: 'checkbox',
3996
- * checked: true,
3997
- * data: 'The user clicked the checkbox'
3998
- * },
3999
- * {
4000
- * label: 'see more',
4001
- * enabled: false,
4002
- * submenu: [
4003
- * { label: 'submenu 1', data: 'hello from submenu' }
4004
- * ]
4005
- * }
4006
- * ];
4007
- *
4008
- * app.addListener('tray-icon-clicked', (event) => {
4009
- * // right-click
4010
- * if (event.button === 2) {
4011
- * app.showTrayIconPopupMenu({ template }).then(r => {
4012
- * if (r.result === 'closed') {
4013
- * console.log('nothing happened');
4014
- * } else {
4015
- * console.log(r.data);
4016
- * }
4017
- * });
4018
- * }
4019
- * });
4020
- * ```
4021
- */
4022
- async showTrayIconPopupMenu(options) {
4023
- const { name } = this.wire.me;
4024
- const entityIdentity = { uuid: this.identity.uuid, name };
4025
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
4026
- return payload.data;
4027
- }
4028
- /**
4029
- * CLoses the tray icon menu.
4030
- *
4031
- * @throws if the application has no tray icon set
4032
- * @example
4033
- *
4034
- * ```js
4035
- * const app = fin.Application.getCurrentSync();
4036
- *
4037
- * await app.closeTrayIconPopupMenu();
4038
- * ```
4039
- */
4040
- async closeTrayIconPopupMenu() {
4041
- const { name } = this.wire.me;
4042
- const entityIdentity = { uuid: this.identity.uuid, name };
4043
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
4044
- }
4045
- }
4046
- Instance$6.Application = Application;
4047
- return Instance$6;
3238
+ Object.defineProperty(Instance$6, "__esModule", { value: true });
3239
+ Instance$6.Application = void 0;
3240
+ /* eslint-disable import/prefer-default-export */
3241
+ const base_1$k = base;
3242
+ const window_1$1 = requireWindow();
3243
+ const view_1 = requireView();
3244
+ /**
3245
+ * An object representing an application. Allows the developer to create,
3246
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
3247
+ */
3248
+ class Application extends base_1$k.EmitterBase {
3249
+ /**
3250
+ * @internal
3251
+ */
3252
+ constructor(wire, identity) {
3253
+ super(wire, 'application', identity.uuid);
3254
+ this.identity = identity;
3255
+ this.window = new window_1$1._Window(this.wire, {
3256
+ uuid: this.identity.uuid,
3257
+ name: this.identity.uuid
3258
+ });
3259
+ }
3260
+ windowListFromIdentityList(identityList) {
3261
+ const windowList = [];
3262
+ identityList.forEach((identity) => {
3263
+ windowList.push(new window_1$1._Window(this.wire, {
3264
+ uuid: identity.uuid,
3265
+ name: identity.name
3266
+ }));
3267
+ });
3268
+ return windowList;
3269
+ }
3270
+ /**
3271
+ * Determines if the application is currently running.
3272
+ *
3273
+ * @example
3274
+ *
3275
+ * ```js
3276
+ * async function isAppRunning() {
3277
+ * const app = await fin.Application.getCurrent();
3278
+ * return await app.isRunning();
3279
+ * }
3280
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
3281
+ * ```
3282
+ */
3283
+ isRunning() {
3284
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
3285
+ }
3286
+ /**
3287
+ * Closes the application and any child windows created by the application.
3288
+ * Cleans the application from state so it is no longer found in getAllApplications.
3289
+ * @param force Close will be prevented from closing when force is false and
3290
+ * ‘close-requested’ has been subscribed to for application’s main window.
3291
+ *
3292
+ * @example
3293
+ *
3294
+ * ```js
3295
+ * async function closeApp() {
3296
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
3297
+ * const app = await fin.Application.wrap({uuid: 'app2'});
3298
+ * await app.quit();
3299
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
3300
+ *
3301
+ * }
3302
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
3303
+ * ```
3304
+ */
3305
+ async quit(force = false) {
3306
+ try {
3307
+ await this._close(force);
3308
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
3309
+ }
3310
+ catch (error) {
3311
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
3312
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
3313
+ throw error;
3314
+ }
3315
+ }
3316
+ }
3317
+ async _close(force = false) {
3318
+ try {
3319
+ await this.wire.sendAction('close-application', { force, ...this.identity });
3320
+ }
3321
+ catch (error) {
3322
+ if (!error.message.includes('Remote connection has closed')) {
3323
+ throw error;
3324
+ }
3325
+ }
3326
+ }
3327
+ /**
3328
+ * @deprecated use Application.quit instead
3329
+ * Closes the application and any child windows created by the application.
3330
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
3331
+ * @param callback - called if the method succeeds.
3332
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3333
+ *
3334
+ * @example
3335
+ *
3336
+ * ```js
3337
+ * async function closeApp() {
3338
+ * const app = await fin.Application.getCurrent();
3339
+ * return await app.close();
3340
+ * }
3341
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
3342
+ * ```
3343
+ */
3344
+ close(force = false) {
3345
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
3346
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
3347
+ // we do not want to expose this error, just continue if this analytics-only call fails
3348
+ });
3349
+ return this._close(force);
3350
+ }
3351
+ /**
3352
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
3353
+ *
3354
+ * @example
3355
+ *
3356
+ * ```js
3357
+ * async function getChildWindows() {
3358
+ * const app = await fin.Application.getCurrent();
3359
+ * return await app.getChildWindows();
3360
+ * }
3361
+ *
3362
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
3363
+ * ```
3364
+ */
3365
+ getChildWindows() {
3366
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
3367
+ const identityList = [];
3368
+ payload.data.forEach((winName) => {
3369
+ identityList.push({ uuid: this.identity.uuid, name: winName });
3370
+ });
3371
+ return this.windowListFromIdentityList(identityList);
3372
+ });
3373
+ }
3374
+ /**
3375
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
3376
+ * if the application was not created from a manifest.
3377
+ *
3378
+ * @example
3379
+ *
3380
+ * ```js
3381
+ * async function getManifest() {
3382
+ * const app = await fin.Application.getCurrent();
3383
+ * return await app.getManifest();
3384
+ * }
3385
+ *
3386
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
3387
+ * ```
3388
+ */
3389
+ getManifest() {
3390
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
3391
+ }
3392
+ /**
3393
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
3394
+ * if the application was created from a manifest.
3395
+ *
3396
+ * @example
3397
+ *
3398
+ * ```js
3399
+ * async function getParentUuid() {
3400
+ * const app = await fin.Application.start({
3401
+ * uuid: 'app-1',
3402
+ * name: 'myApp',
3403
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
3404
+ * autoShow: true
3405
+ * });
3406
+ * return await app.getParentUuid();
3407
+ * }
3408
+ *
3409
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
3410
+ * ```
3411
+ */
3412
+ getParentUuid() {
3413
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
3414
+ }
3415
+ /**
3416
+ * Retrieves current application's shortcut configuration.
3417
+ *
3418
+ * @example
3419
+ *
3420
+ * ```js
3421
+ * async function getShortcuts() {
3422
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3423
+ * return await app.getShortcuts();
3424
+ * }
3425
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
3426
+ * ```
3427
+ */
3428
+ getShortcuts() {
3429
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
3430
+ }
3431
+ /**
3432
+ * Retrieves current application's views.
3433
+ * @experimental
3434
+ *
3435
+ * @example
3436
+ *
3437
+ * ```js
3438
+ * async function getViews() {
3439
+ * const app = await fin.Application.getCurrent();
3440
+ * return await app.getViews();
3441
+ * }
3442
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
3443
+ * ```
3444
+ */
3445
+ async getViews() {
3446
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
3447
+ return payload.data.map((id) => new view_1.View(this.wire, id));
3448
+ }
3449
+ /**
3450
+ * Returns the current zoom level of the application.
3451
+ *
3452
+ * @example
3453
+ *
3454
+ * ```js
3455
+ * async function getZoomLevel() {
3456
+ * const app = await fin.Application.getCurrent();
3457
+ * return await app.getZoomLevel();
3458
+ * }
3459
+ *
3460
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
3461
+ * ```
3462
+ */
3463
+ getZoomLevel() {
3464
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
3465
+ }
3466
+ /**
3467
+ * Returns an instance of the main Window of the application
3468
+ *
3469
+ * @example
3470
+ *
3471
+ * ```js
3472
+ * async function getWindow() {
3473
+ * const app = await fin.Application.start({
3474
+ * uuid: 'app-1',
3475
+ * name: 'myApp',
3476
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
3477
+ * autoShow: true
3478
+ * });
3479
+ * return await app.getWindow();
3480
+ * }
3481
+ *
3482
+ * getWindow().then(win => {
3483
+ * win.showAt(0, 400);
3484
+ * win.flash();
3485
+ * }).catch(err => console.log(err));
3486
+ * ```
3487
+ */
3488
+ getWindow() {
3489
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
3490
+ // we do not want to expose this error, just continue if this analytics-only call fails
3491
+ });
3492
+ return Promise.resolve(this.window);
3493
+ }
3494
+ /**
3495
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
3496
+ * @param userName - username to be passed to the RVM.
3497
+ * @param appName - app name to be passed to the RVM.
3498
+ *
3499
+ * @example
3500
+ *
3501
+ * ```js
3502
+ * async function registerUser() {
3503
+ * const app = await fin.Application.getCurrent();
3504
+ * return await app.registerUser('user', 'myApp');
3505
+ * }
3506
+ *
3507
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
3508
+ * ```
3509
+ */
3510
+ registerUser(userName, appName) {
3511
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
3512
+ }
3513
+ /**
3514
+ * Removes the application’s icon from the tray.
3515
+ *
3516
+ * @example
3517
+ *
3518
+ * ```js
3519
+ * async function removeTrayIcon() {
3520
+ * const app = await fin.Application.getCurrent();
3521
+ * return await app.removeTrayIcon();
3522
+ * }
3523
+ *
3524
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
3525
+ * ```
3526
+ */
3527
+ removeTrayIcon() {
3528
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
3529
+ }
3530
+ /**
3531
+ * Restarts the application.
3532
+ *
3533
+ * @example
3534
+ *
3535
+ * ```js
3536
+ * async function restartApp() {
3537
+ * const app = await fin.Application.getCurrent();
3538
+ * return await app.restart();
3539
+ * }
3540
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
3541
+ * ```
3542
+ */
3543
+ restart() {
3544
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
3545
+ }
3546
+ /**
3547
+ * DEPRECATED method to run the application.
3548
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
3549
+ *
3550
+ * @example
3551
+ *
3552
+ * ```js
3553
+ * async function run() {
3554
+ * const app = await fin.Application.create({
3555
+ * name: 'myApp',
3556
+ * uuid: 'app-1',
3557
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
3558
+ * autoShow: true
3559
+ * });
3560
+ * await app.run();
3561
+ * }
3562
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
3563
+ * ```
3564
+ *
3565
+ * @ignore
3566
+ */
3567
+ run() {
3568
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
3569
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
3570
+ // we do not want to expose this error, just continue if this analytics-only call fails
3571
+ });
3572
+ return this._run();
3573
+ }
3574
+ _run(opts = {}) {
3575
+ return this.wire
3576
+ .sendAction('run-application', {
3577
+ manifestUrl: this._manifestUrl,
3578
+ opts,
3579
+ ...this.identity
3580
+ })
3581
+ .then(() => undefined);
3582
+ }
3583
+ /**
3584
+ * Instructs the RVM to schedule one restart of the application.
3585
+ *
3586
+ * @example
3587
+ *
3588
+ * ```js
3589
+ * async function scheduleRestart() {
3590
+ * const app = await fin.Application.getCurrent();
3591
+ * return await app.scheduleRestart();
3592
+ * }
3593
+ *
3594
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
3595
+ * ```
3596
+ */
3597
+ scheduleRestart() {
3598
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
3599
+ }
3600
+ /**
3601
+ * Sends a message to the RVM to upload the application's logs. On success,
3602
+ * an object containing logId is returned.
3603
+ *
3604
+ * @example
3605
+ *
3606
+ * ```js
3607
+ * async function sendLog() {
3608
+ * const app = await fin.Application.getCurrent();
3609
+ * return await app.sendApplicationLog();
3610
+ * }
3611
+ *
3612
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
3613
+ * ```
3614
+ */
3615
+ async sendApplicationLog() {
3616
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
3617
+ return payload.data;
3618
+ }
3619
+ /**
3620
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
3621
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
3622
+ *
3623
+ * Note: If the "name" property is omitted it defaults to "tasks".
3624
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
3625
+ *
3626
+ *
3627
+ * @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).
3628
+ *
3629
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
3630
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
3631
+ *
3632
+ * Note: If the "name" property is omitted it defaults to "tasks".
3633
+ *
3634
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
3635
+ * uuid or shortcut.name is changed.
3636
+ *
3637
+ * @example
3638
+ *
3639
+ * ```js
3640
+ * const app = fin.Application.getCurrentSync();
3641
+ * const appName = 'My App';
3642
+ * const jumpListConfig = [ // array of JumpList categories
3643
+ * {
3644
+ * // has no name and no type so `type` is assumed to be "tasks"
3645
+ * items: [ // array of JumpList items
3646
+ * {
3647
+ * type: 'task',
3648
+ * title: `Launch ${appName}`,
3649
+ * description: `Runs ${appName} with the default configuration`,
3650
+ * deepLink: 'fins://path.to/app/manifest.json',
3651
+ * iconPath: 'https://path.to/app/icon.ico',
3652
+ * iconIndex: 0
3653
+ * },
3654
+ * { type: 'separator' },
3655
+ * {
3656
+ * type: 'task',
3657
+ * title: `Restore ${appName}`,
3658
+ * description: 'Restore to last configuration',
3659
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
3660
+ * iconPath: 'https://path.to/app/icon.ico',
3661
+ * iconIndex: 0
3662
+ * },
3663
+ * ]
3664
+ * },
3665
+ * {
3666
+ * name: 'Tools',
3667
+ * items: [ // array of JumpList items
3668
+ * {
3669
+ * type: 'task',
3670
+ * title: 'Tool A',
3671
+ * description: 'Runs Tool A',
3672
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
3673
+ * iconPath: 'https://path.to/tool-a/icon.ico',
3674
+ * iconIndex: 0
3675
+ * },
3676
+ * {
3677
+ * type: 'task',
3678
+ * title: 'Tool B',
3679
+ * description: 'Runs Tool B',
3680
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
3681
+ * iconPath: 'https://path.to/tool-b/icon.ico',
3682
+ * iconIndex: 0
3683
+ * }]
3684
+ * }
3685
+ * ];
3686
+ *
3687
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
3688
+ * ```
3689
+ *
3690
+ * To handle deeplink args:
3691
+ * ```js
3692
+ * function handleUseLastConfiguration() {
3693
+ * // this handler is called when the app is being launched
3694
+ * app.on('run-requested', event => {
3695
+ * if(event.userAppConfigArgs['use-last-configuration']) {
3696
+ * // your logic here
3697
+ * }
3698
+ * });
3699
+ * // this handler is called when the app was already running when the launch was requested
3700
+ * fin.desktop.main(function(args) {
3701
+ * if(args && args['use-last-configuration']) {
3702
+ * // your logic here
3703
+ * }
3704
+ * });
3705
+ * }
3706
+ * ```
3707
+ */
3708
+ async setJumpList(jumpListCategories) {
3709
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
3710
+ }
3711
+ /**
3712
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
3713
+ * @param icon Image URL or base64 encoded string to be used as the icon
3714
+ *
3715
+ * @example
3716
+ *
3717
+ * ```js
3718
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3719
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
3720
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
3721
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
3722
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
3723
+ *
3724
+ * async function setTrayIcon(icon) {
3725
+ * const app = await fin.Application.getCurrent();
3726
+ * return await app.setTrayIcon(icon);
3727
+ * }
3728
+ *
3729
+ * // use image url to set tray icon
3730
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3731
+ *
3732
+ * // use base64 encoded string to set tray icon
3733
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3734
+ *
3735
+ * // use a dataURL to set tray icon
3736
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3737
+ * ```
3738
+ */
3739
+ setTrayIcon(icon) {
3740
+ return this.wire
3741
+ .sendAction('set-tray-icon', {
3742
+ enabledIcon: icon,
3743
+ ...this.identity
3744
+ })
3745
+ .then(() => undefined);
3746
+ }
3747
+ /**
3748
+ * Sets new application's shortcut configuration. Windows only.
3749
+ * @param config New application's shortcut configuration.
3750
+ *
3751
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3752
+ * to be able to change shortcut states.
3753
+ *
3754
+ * @example
3755
+ *
3756
+ * ```js
3757
+ * async function setShortcuts(config) {
3758
+ * const app = await fin.Application.getCurrent();
3759
+ * return app.setShortcuts(config);
3760
+ * }
3761
+ *
3762
+ * setShortcuts({
3763
+ * desktop: true,
3764
+ * startMenu: false,
3765
+ * systemStartup: true
3766
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3767
+ * ```
3768
+ */
3769
+ setShortcuts(config) {
3770
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3771
+ }
3772
+ /**
3773
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3774
+ * @param queryString The new query string for this app's shortcuts.
3775
+ *
3776
+ * @example
3777
+ *
3778
+ * ```js
3779
+ * const newQueryArgs = 'arg=true&arg2=false';
3780
+ * const app = await fin.Application.getCurrent();
3781
+ * try {
3782
+ * await app.setShortcutQueryParams(newQueryArgs);
3783
+ * } catch(err) {
3784
+ * console.error(err)
3785
+ * }
3786
+ * ```
3787
+ */
3788
+ async setShortcutQueryParams(queryString) {
3789
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3790
+ }
3791
+ /**
3792
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3793
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
3794
+ * @param level The zoom level
3795
+ *
3796
+ * @example
3797
+ *
3798
+ * ```js
3799
+ * async function setZoomLevel(number) {
3800
+ * const app = await fin.Application.getCurrent();
3801
+ * return await app.setZoomLevel(number);
3802
+ * }
3803
+ *
3804
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3805
+ * ```
3806
+ */
3807
+ setZoomLevel(level) {
3808
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3809
+ }
3810
+ /**
3811
+ * Sets a username to correlate with App Log Management.
3812
+ * @param username Username to correlate with App's Log.
3813
+ *
3814
+ * @example
3815
+ *
3816
+ * ```js
3817
+ * async function setAppLogUser() {
3818
+ * const app = await fin.Application.getCurrent();
3819
+ * return await app.setAppLogUsername('username');
3820
+ * }
3821
+ *
3822
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3823
+ *
3824
+ * ```
3825
+ */
3826
+ async setAppLogUsername(username) {
3827
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3828
+ }
3829
+ /**
3830
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3831
+ * @remarks The only information currently returned is the position and dimensions.
3832
+ *
3833
+ * @example
3834
+ *
3835
+ * ```js
3836
+ * async function getTrayIconInfo() {
3837
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3838
+ * return await app.getTrayIconInfo();
3839
+ * }
3840
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3841
+ * ```
3842
+ */
3843
+ getTrayIconInfo() {
3844
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3845
+ }
3846
+ /**
3847
+ * Checks if the application has an associated tray icon.
3848
+ *
3849
+ * @example
3850
+ *
3851
+ * ```js
3852
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3853
+ * const hasTrayIcon = await app.hasTrayIcon();
3854
+ * console.log(hasTrayIcon);
3855
+ * ```
3856
+ */
3857
+ hasTrayIcon() {
3858
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3859
+ }
3860
+ /**
3861
+ * Closes the application by terminating its process.
3862
+ *
3863
+ * @example
3864
+ *
3865
+ * ```js
3866
+ * async function terminateApp() {
3867
+ * const app = await fin.Application.getCurrent();
3868
+ * return await app.terminate();
3869
+ * }
3870
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3871
+ * ```
3872
+ */
3873
+ terminate() {
3874
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3875
+ }
3876
+ /**
3877
+ * Waits for a hanging application. This method can be called in response to an application
3878
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
3879
+ * message after a certain period of time.
3880
+ *
3881
+ * @ignore
3882
+ */
3883
+ wait() {
3884
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3885
+ }
3886
+ /**
3887
+ * Retrieves information about the application.
3888
+ *
3889
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3890
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3891
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3892
+ *
3893
+ * @example
3894
+ *
3895
+ * ```js
3896
+ * async function getInfo() {
3897
+ * const app = await fin.Application.getCurrent();
3898
+ * return await app.getInfo();
3899
+ * }
3900
+ *
3901
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3902
+ * ```
3903
+ */
3904
+ getInfo() {
3905
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3906
+ }
3907
+ /**
3908
+ * Retrieves all process information for entities (windows and views) associated with an application.
3909
+ *
3910
+ * @example
3911
+ * ```js
3912
+ * const app = await fin.Application.getCurrent();
3913
+ * const processInfo = await app.getProcessInfo();
3914
+ * ```
3915
+ * @experimental
3916
+ */
3917
+ async getProcessInfo() {
3918
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3919
+ return data;
3920
+ }
3921
+ /**
3922
+ * Sets file auto download location. It's only allowed in the same application.
3923
+ *
3924
+ * Note: This method is restricted by default and must be enabled via
3925
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3926
+ * @param downloadLocation file auto download location
3927
+ *
3928
+ * @throws if setting file auto download location on different applications.
3929
+ * @example
3930
+ *
3931
+ * ```js
3932
+ * const downloadLocation = 'C:\\dev\\temp';
3933
+ * const app = await fin.Application.getCurrent();
3934
+ * try {
3935
+ * await app.setFileDownloadLocation(downloadLocation);
3936
+ * console.log('File download location is set');
3937
+ * } catch(err) {
3938
+ * console.error(err)
3939
+ * }
3940
+ * ```
3941
+ */
3942
+ async setFileDownloadLocation(downloadLocation) {
3943
+ const { name } = this.wire.me;
3944
+ const entityIdentity = { uuid: this.identity.uuid, name };
3945
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3946
+ }
3947
+ /**
3948
+ * 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.
3949
+ *
3950
+ * Note: This method is restricted by default and must be enabled via
3951
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3952
+ *
3953
+ * @throws if getting file auto download location on different applications.
3954
+ * @example
3955
+ *
3956
+ * ```js
3957
+ * const app = await fin.Application.getCurrent();
3958
+ * const fileDownloadDir = await app.getFileDownloadLocation();
3959
+ * ```
3960
+ */
3961
+ async getFileDownloadLocation() {
3962
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3963
+ return data;
3964
+ }
3965
+ /**
3966
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3967
+ * @param options
3968
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3969
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3970
+ * of all possible data shapes for the entire menu, and the click handler should process
3971
+ * these with a "reducer" pattern.
3972
+ * @throws if the application has no tray icon set
3973
+ * @throws if the system tray is currently hidden
3974
+ * @example
3975
+ *
3976
+ * ```js
3977
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3978
+ * const app = fin.Application.getCurrentSync();
3979
+ *
3980
+ * await app.setTrayIcon(iconUrl);
3981
+ *
3982
+ * const template = [
3983
+ * {
3984
+ * label: 'Menu Item 1',
3985
+ * data: 'hello from item 1'
3986
+ * },
3987
+ * { type: 'separator' },
3988
+ * {
3989
+ * label: 'Menu Item 2',
3990
+ * type: 'checkbox',
3991
+ * checked: true,
3992
+ * data: 'The user clicked the checkbox'
3993
+ * },
3994
+ * {
3995
+ * label: 'see more',
3996
+ * enabled: false,
3997
+ * submenu: [
3998
+ * { label: 'submenu 1', data: 'hello from submenu' }
3999
+ * ]
4000
+ * }
4001
+ * ];
4002
+ *
4003
+ * app.addListener('tray-icon-clicked', (event) => {
4004
+ * // right-click
4005
+ * if (event.button === 2) {
4006
+ * app.showTrayIconPopupMenu({ template }).then(r => {
4007
+ * if (r.result === 'closed') {
4008
+ * console.log('nothing happened');
4009
+ * } else {
4010
+ * console.log(r.data);
4011
+ * }
4012
+ * });
4013
+ * }
4014
+ * });
4015
+ * ```
4016
+ */
4017
+ async showTrayIconPopupMenu(options) {
4018
+ const { name } = this.wire.me;
4019
+ const entityIdentity = { uuid: this.identity.uuid, name };
4020
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
4021
+ return payload.data;
4022
+ }
4023
+ /**
4024
+ * CLoses the tray icon menu.
4025
+ *
4026
+ * @throws if the application has no tray icon set
4027
+ * @example
4028
+ *
4029
+ * ```js
4030
+ * const app = fin.Application.getCurrentSync();
4031
+ *
4032
+ * await app.closeTrayIconPopupMenu();
4033
+ * ```
4034
+ */
4035
+ async closeTrayIconPopupMenu() {
4036
+ const { name } = this.wire.me;
4037
+ const entityIdentity = { uuid: this.identity.uuid, name };
4038
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
4039
+ }
4040
+ }
4041
+ Instance$6.Application = Application;
4042
+
4043
+ Object.defineProperty(Factory$7, "__esModule", { value: true });
4044
+ Factory$7.ApplicationModule = void 0;
4045
+ const base_1$j = base;
4046
+ const validate_1$4 = validate;
4047
+ const Instance_1$5 = Instance$6;
4048
+ /**
4049
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4050
+ */
4051
+ class ApplicationModule extends base_1$j.Base {
4052
+ /**
4053
+ * Asynchronously returns an API handle for the given Application identity.
4054
+ *
4055
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4056
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4057
+ * for an Application throughout its entire lifecycle.
4058
+ *
4059
+ * @example
4060
+ *
4061
+ * ```js
4062
+ * fin.Application.wrap({ uuid: 'testapp' })
4063
+ * .then(app => app.isRunning())
4064
+ * .then(running => console.log('Application is running: ' + running))
4065
+ * .catch(err => console.log(err));
4066
+ * ```
4067
+ *
4068
+ */
4069
+ async wrap(identity) {
4070
+ this.wire.sendAction('wrap-application').catch((e) => {
4071
+ // we do not want to expose this error, just continue if this analytics-only call fails
4072
+ });
4073
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
4074
+ if (errorMsg) {
4075
+ throw new Error(errorMsg);
4076
+ }
4077
+ return new Instance_1$5.Application(this.wire, identity);
4078
+ }
4079
+ /**
4080
+ * Synchronously returns an API handle for the given Application identity.
4081
+ *
4082
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4083
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4084
+ * for an Aplication throughout its entire lifecycle.
4085
+ *
4086
+ * @example
4087
+ *
4088
+ * ```js
4089
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
4090
+ * await app.close();
4091
+ * ```
4092
+ *
4093
+ */
4094
+ wrapSync(identity) {
4095
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
4096
+ // we do not want to expose this error, just continue if this analytics-only call fails
4097
+ });
4098
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
4099
+ if (errorMsg) {
4100
+ throw new Error(errorMsg);
4101
+ }
4102
+ return new Instance_1$5.Application(this.wire, identity);
4103
+ }
4104
+ async _create(appOptions) {
4105
+ // set defaults:
4106
+ if (appOptions.waitForPageLoad === undefined) {
4107
+ appOptions.waitForPageLoad = false;
4108
+ }
4109
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
4110
+ appOptions.autoShow = true;
4111
+ }
4112
+ await this.wire.sendAction('create-application', appOptions);
4113
+ return this.wrap({ uuid: appOptions.uuid });
4114
+ }
4115
+ /**
4116
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
4117
+ *
4118
+ * @example
4119
+ *
4120
+ * ```js
4121
+ * async function createApp() {
4122
+ * const app = await fin.Application.create({
4123
+ * name: 'myApp',
4124
+ * uuid: 'app-3',
4125
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
4126
+ * autoShow: true
4127
+ * });
4128
+ * await app.run();
4129
+ * }
4130
+ *
4131
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
4132
+ * ```
4133
+ *
4134
+ * @ignore
4135
+ */
4136
+ create(appOptions) {
4137
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
4138
+ this.wire.sendAction('application-create').catch((e) => {
4139
+ // we do not want to expose this error, just continue if this analytics-only call fails
4140
+ });
4141
+ return this._create(appOptions);
4142
+ }
4143
+ /**
4144
+ * Creates and starts a new Application.
4145
+ *
4146
+ * @example
4147
+ *
4148
+ * ```js
4149
+ * async function start() {
4150
+ * return fin.Application.start({
4151
+ * name: 'app-1',
4152
+ * uuid: 'app-1',
4153
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
4154
+ * autoShow: true
4155
+ * });
4156
+ * }
4157
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
4158
+ * ```
4159
+ *
4160
+ */
4161
+ async start(appOptions) {
4162
+ this.wire.sendAction('start-application').catch((e) => {
4163
+ // we do not want to expose this error, just continue if this analytics-only call fails
4164
+ });
4165
+ const app = await this._create(appOptions);
4166
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
4167
+ return app;
4168
+ }
4169
+ /**
4170
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
4171
+ * Returns once the RVM is finished attempting to launch the applications.
4172
+ * @param opts - Parameters that the RVM will use.
4173
+ *
4174
+ * @example
4175
+ *
4176
+ * ```js
4177
+ *
4178
+ * const applicationInfoArray = [
4179
+ * {
4180
+ * "uuid": 'App-1',
4181
+ * "manifestUrl": 'http://localhost:5555/app1.json',
4182
+ * },
4183
+ * {
4184
+ * "uuid": 'App-2',
4185
+ * "manifestUrl": 'http://localhost:5555/app2.json',
4186
+ * },
4187
+ * {
4188
+ * "uuid": 'App-3',
4189
+ * "manifestUrl": 'http://localhost:5555/app3.json',
4190
+ * }
4191
+ * ]
4192
+ *
4193
+ * fin.Application.startManyManifests(applicationInfoArray)
4194
+ * .then(() => {
4195
+ * console.log('RVM has finished launching the application list.');
4196
+ * })
4197
+ * .catch((err) => {
4198
+ * console.log(err);
4199
+ * })
4200
+ * ```
4201
+ *
4202
+ * @experimental
4203
+ */
4204
+ async startManyManifests(applications, opts) {
4205
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
4206
+ }
4207
+ /**
4208
+ * Asynchronously returns an Application object that represents the current application
4209
+ *
4210
+ * @example
4211
+ *
4212
+ * ```js
4213
+ * async function isCurrentAppRunning () {
4214
+ * const app = await fin.Application.getCurrent();
4215
+ * return app.isRunning();
4216
+ * }
4217
+ *
4218
+ * isCurrentAppRunning().then(running => {
4219
+ * console.log(`Current app is running: ${running}`);
4220
+ * }).catch(err => {
4221
+ * console.error(err);
4222
+ * });
4223
+ *
4224
+ * ```
4225
+ */
4226
+ getCurrent() {
4227
+ this.wire.sendAction('get-current-application').catch((e) => {
4228
+ // we do not want to expose this error, just continue if this analytics-only call fails
4229
+ });
4230
+ return this.wrap({ uuid: this.wire.me.uuid });
4231
+ }
4232
+ /**
4233
+ * Synchronously returns an Application object that represents the current application
4234
+ *
4235
+ * @example
4236
+ *
4237
+ * ```js
4238
+ * async function isCurrentAppRunning () {
4239
+ * const app = fin.Application.getCurrentSync();
4240
+ * return app.isRunning();
4241
+ * }
4242
+ *
4243
+ * isCurrentAppRunning().then(running => {
4244
+ * console.log(`Current app is running: ${running}`);
4245
+ * }).catch(err => {
4246
+ * console.error(err);
4247
+ * });
4248
+ *
4249
+ * ```
4250
+ */
4251
+ getCurrentSync() {
4252
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
4253
+ // we do not want to expose this error, just continue if this analytics-only call fails
4254
+ });
4255
+ return this.wrapSync({ uuid: this.wire.me.uuid });
4256
+ }
4257
+ /**
4258
+ * Retrieves application's manifest and returns a running instance of the application.
4259
+ * @param manifestUrl - The URL of app's manifest.
4260
+ * @param opts - Parameters that the RVM will use.
4261
+ *
4262
+ * @example
4263
+ *
4264
+ * ```js
4265
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4266
+ *
4267
+ * // For a local manifest file:
4268
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4269
+ * ```
4270
+ */
4271
+ async startFromManifest(manifestUrl, opts) {
4272
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
4273
+ // we do not want to expose this error, just continue if this analytics-only call fails
4274
+ });
4275
+ const app = await this._createFromManifest(manifestUrl);
4276
+ // @ts-expect-error using private method without warning.
4277
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
4278
+ return app;
4279
+ }
4280
+ /**
4281
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
4282
+ * Retrieves application's manifest and returns a wrapped application.
4283
+ * @param manifestUrl - The URL of app's manifest.
4284
+ * @param callback - called if the method succeeds.
4285
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
4286
+ *
4287
+ * @example
4288
+ *
4289
+ * ```js
4290
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
4291
+ * ```
4292
+ * @ignore
4293
+ */
4294
+ createFromManifest(manifestUrl) {
4295
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
4296
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
4297
+ // we do not want to expose this error, just continue if this analytics-only call fails
4298
+ });
4299
+ return this._createFromManifest(manifestUrl);
4300
+ }
4301
+ _createFromManifest(manifestUrl) {
4302
+ return this.wire
4303
+ .sendAction('get-application-manifest', { manifestUrl })
4304
+ .then(({ payload }) => {
4305
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
4306
+ return this.wrap({ uuid });
4307
+ })
4308
+ .then((app) => {
4309
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
4310
+ return app;
4311
+ });
4312
+ }
4048
4313
  }
4314
+ Factory$7.ApplicationModule = ApplicationModule;
4049
4315
 
4050
- var hasRequiredFactory$2;
4051
-
4052
- function requireFactory$2 () {
4053
- if (hasRequiredFactory$2) return Factory$7;
4054
- hasRequiredFactory$2 = 1;
4055
- Object.defineProperty(Factory$7, "__esModule", { value: true });
4056
- Factory$7.ApplicationModule = void 0;
4057
- const base_1 = base;
4058
- const validate_1 = validate;
4059
- const Instance_1 = requireInstance$1();
4316
+ (function (exports) {
4317
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4318
+ if (k2 === undefined) k2 = k;
4319
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4320
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4321
+ desc = { enumerable: true, get: function() { return m[k]; } };
4322
+ }
4323
+ Object.defineProperty(o, k2, desc);
4324
+ }) : (function(o, m, k, k2) {
4325
+ if (k2 === undefined) k2 = k;
4326
+ o[k2] = m[k];
4327
+ }));
4328
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4329
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4330
+ };
4331
+ Object.defineProperty(exports, "__esModule", { value: true });
4060
4332
  /**
4061
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
4333
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
4334
+ *
4335
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4336
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4337
+ *
4338
+ * 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),
4339
+ * both of these were documented on the same page.
4340
+ *
4341
+ * @packageDocumentation
4062
4342
  */
4063
- class ApplicationModule extends base_1.Base {
4064
- /**
4065
- * Asynchronously returns an API handle for the given Application identity.
4066
- *
4067
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4068
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4069
- * for an Application throughout its entire lifecycle.
4070
- *
4071
- * @example
4072
- *
4073
- * ```js
4074
- * fin.Application.wrap({ uuid: 'testapp' })
4075
- * .then(app => app.isRunning())
4076
- * .then(running => console.log('Application is running: ' + running))
4077
- * .catch(err => console.log(err));
4078
- * ```
4079
- *
4080
- */
4081
- async wrap(identity) {
4082
- this.wire.sendAction('wrap-application').catch((e) => {
4083
- // we do not want to expose this error, just continue if this analytics-only call fails
4084
- });
4085
- const errorMsg = (0, validate_1.validateIdentity)(identity);
4086
- if (errorMsg) {
4087
- throw new Error(errorMsg);
4088
- }
4089
- return new Instance_1.Application(this.wire, identity);
4090
- }
4091
- /**
4092
- * Synchronously returns an API handle for the given Application identity.
4093
- *
4094
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
4095
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
4096
- * for an Aplication throughout its entire lifecycle.
4097
- *
4098
- * @example
4099
- *
4100
- * ```js
4101
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
4102
- * await app.close();
4103
- * ```
4104
- *
4105
- */
4106
- wrapSync(identity) {
4107
- this.wire.sendAction('wrap-application-sync').catch((e) => {
4108
- // we do not want to expose this error, just continue if this analytics-only call fails
4109
- });
4110
- const errorMsg = (0, validate_1.validateIdentity)(identity);
4111
- if (errorMsg) {
4112
- throw new Error(errorMsg);
4113
- }
4114
- return new Instance_1.Application(this.wire, identity);
4115
- }
4116
- async _create(appOptions) {
4117
- // set defaults:
4118
- if (appOptions.waitForPageLoad === undefined) {
4119
- appOptions.waitForPageLoad = false;
4120
- }
4121
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
4122
- appOptions.autoShow = true;
4123
- }
4124
- await this.wire.sendAction('create-application', appOptions);
4125
- return this.wrap({ uuid: appOptions.uuid });
4126
- }
4127
- /**
4128
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
4129
- *
4130
- * @example
4131
- *
4132
- * ```js
4133
- * async function createApp() {
4134
- * const app = await fin.Application.create({
4135
- * name: 'myApp',
4136
- * uuid: 'app-3',
4137
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
4138
- * autoShow: true
4139
- * });
4140
- * await app.run();
4141
- * }
4142
- *
4143
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
4144
- * ```
4145
- *
4146
- * @ignore
4147
- */
4148
- create(appOptions) {
4149
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
4150
- this.wire.sendAction('application-create').catch((e) => {
4151
- // we do not want to expose this error, just continue if this analytics-only call fails
4152
- });
4153
- return this._create(appOptions);
4154
- }
4155
- /**
4156
- * Creates and starts a new Application.
4157
- *
4158
- * @example
4159
- *
4160
- * ```js
4161
- * async function start() {
4162
- * return fin.Application.start({
4163
- * name: 'app-1',
4164
- * uuid: 'app-1',
4165
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
4166
- * autoShow: true
4167
- * });
4168
- * }
4169
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
4170
- * ```
4171
- *
4172
- */
4173
- async start(appOptions) {
4174
- this.wire.sendAction('start-application').catch((e) => {
4175
- // we do not want to expose this error, just continue if this analytics-only call fails
4176
- });
4177
- const app = await this._create(appOptions);
4178
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
4179
- return app;
4180
- }
4181
- /**
4182
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
4183
- * Returns once the RVM is finished attempting to launch the applications.
4184
- * @param opts - Parameters that the RVM will use.
4185
- *
4186
- * @example
4187
- *
4188
- * ```js
4189
- *
4190
- * const applicationInfoArray = [
4191
- * {
4192
- * "uuid": 'App-1',
4193
- * "manifestUrl": 'http://localhost:5555/app1.json',
4194
- * },
4195
- * {
4196
- * "uuid": 'App-2',
4197
- * "manifestUrl": 'http://localhost:5555/app2.json',
4198
- * },
4199
- * {
4200
- * "uuid": 'App-3',
4201
- * "manifestUrl": 'http://localhost:5555/app3.json',
4202
- * }
4203
- * ]
4204
- *
4205
- * fin.Application.startManyManifests(applicationInfoArray)
4206
- * .then(() => {
4207
- * console.log('RVM has finished launching the application list.');
4208
- * })
4209
- * .catch((err) => {
4210
- * console.log(err);
4211
- * })
4212
- * ```
4213
- *
4214
- * @experimental
4215
- */
4216
- async startManyManifests(applications, opts) {
4217
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
4218
- }
4219
- /**
4220
- * Asynchronously returns an Application object that represents the current application
4221
- *
4222
- * @example
4223
- *
4224
- * ```js
4225
- * async function isCurrentAppRunning () {
4226
- * const app = await fin.Application.getCurrent();
4227
- * return app.isRunning();
4228
- * }
4229
- *
4230
- * isCurrentAppRunning().then(running => {
4231
- * console.log(`Current app is running: ${running}`);
4232
- * }).catch(err => {
4233
- * console.error(err);
4234
- * });
4235
- *
4236
- * ```
4237
- */
4238
- getCurrent() {
4239
- this.wire.sendAction('get-current-application').catch((e) => {
4240
- // we do not want to expose this error, just continue if this analytics-only call fails
4241
- });
4242
- return this.wrap({ uuid: this.wire.me.uuid });
4243
- }
4244
- /**
4245
- * Synchronously returns an Application object that represents the current application
4246
- *
4247
- * @example
4248
- *
4249
- * ```js
4250
- * async function isCurrentAppRunning () {
4251
- * const app = fin.Application.getCurrentSync();
4252
- * return app.isRunning();
4253
- * }
4254
- *
4255
- * isCurrentAppRunning().then(running => {
4256
- * console.log(`Current app is running: ${running}`);
4257
- * }).catch(err => {
4258
- * console.error(err);
4259
- * });
4260
- *
4261
- * ```
4262
- */
4263
- getCurrentSync() {
4264
- this.wire.sendAction('get-current-application-sync').catch((e) => {
4265
- // we do not want to expose this error, just continue if this analytics-only call fails
4266
- });
4267
- return this.wrapSync({ uuid: this.wire.me.uuid });
4268
- }
4269
- /**
4270
- * Retrieves application's manifest and returns a running instance of the application.
4271
- * @param manifestUrl - The URL of app's manifest.
4272
- * @param opts - Parameters that the RVM will use.
4273
- *
4274
- * @example
4275
- *
4276
- * ```js
4277
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4278
- *
4279
- * // For a local manifest file:
4280
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
4281
- * ```
4282
- */
4283
- async startFromManifest(manifestUrl, opts) {
4284
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
4285
- // we do not want to expose this error, just continue if this analytics-only call fails
4286
- });
4287
- const app = await this._createFromManifest(manifestUrl);
4288
- // @ts-expect-error using private method without warning.
4289
- await app._run(opts); // eslint-disable-line no-underscore-dangle
4290
- return app;
4291
- }
4292
- /**
4293
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
4294
- * Retrieves application's manifest and returns a wrapped application.
4295
- * @param manifestUrl - The URL of app's manifest.
4296
- * @param callback - called if the method succeeds.
4297
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
4298
- *
4299
- * @example
4300
- *
4301
- * ```js
4302
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
4303
- * ```
4304
- * @ignore
4305
- */
4306
- createFromManifest(manifestUrl) {
4307
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
4308
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
4309
- // we do not want to expose this error, just continue if this analytics-only call fails
4310
- });
4311
- return this._createFromManifest(manifestUrl);
4312
- }
4313
- _createFromManifest(manifestUrl) {
4314
- return this.wire
4315
- .sendAction('get-application-manifest', { manifestUrl })
4316
- .then(({ payload }) => {
4317
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
4318
- return this.wrap({ uuid });
4319
- })
4320
- .then((app) => {
4321
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
4322
- return app;
4323
- });
4324
- }
4325
- }
4326
- Factory$7.ApplicationModule = ApplicationModule;
4327
- return Factory$7;
4328
- }
4329
-
4330
- var hasRequiredApplication;
4331
-
4332
- function requireApplication () {
4333
- if (hasRequiredApplication) return application;
4334
- hasRequiredApplication = 1;
4335
- (function (exports) {
4336
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4337
- if (k2 === undefined) k2 = k;
4338
- var desc = Object.getOwnPropertyDescriptor(m, k);
4339
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4340
- desc = { enumerable: true, get: function() { return m[k]; } };
4341
- }
4342
- Object.defineProperty(o, k2, desc);
4343
- }) : (function(o, m, k, k2) {
4344
- if (k2 === undefined) k2 = k;
4345
- o[k2] = m[k];
4346
- }));
4347
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4348
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4349
- };
4350
- Object.defineProperty(exports, "__esModule", { value: true });
4351
- /**
4352
- * Entry points for the OpenFin `Application` API (`fin.Application`).
4353
- *
4354
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
4355
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
4356
- *
4357
- * 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),
4358
- * both of these were documented on the same page.
4359
- *
4360
- * @packageDocumentation
4361
- */
4362
- __exportStar(requireFactory$2(), exports);
4363
- __exportStar(requireInstance$1(), exports);
4364
- } (application));
4365
- return application;
4366
- }
4343
+ __exportStar(Factory$7, exports);
4344
+ __exportStar(Instance$6, exports);
4345
+ } (application));
4367
4346
 
4368
4347
  var promisifySubscription$1 = {};
4369
4348
 
@@ -4407,7 +4386,7 @@ function requireInstance () {
4407
4386
  /* eslint-disable @typescript-eslint/no-unused-vars */
4408
4387
  /* eslint-disable no-console */
4409
4388
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
4410
- const application_1 = requireApplication();
4389
+ const application_1 = application;
4411
4390
  const main_1 = main;
4412
4391
  const view_1 = requireView();
4413
4392
  const warnings_1 = warnings;
@@ -16837,7 +16816,7 @@ const events_1$3 = require$$0;
16837
16816
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
16838
16817
  const index_1 = system;
16839
16818
  const index_2 = requireWindow();
16840
- const index_3 = requireApplication();
16819
+ const index_3 = application;
16841
16820
  const index_4 = interappbus;
16842
16821
  const index_5 = clipboard;
16843
16822
  const index_6 = externalApplication;