@openfin/node-adapter 43.100.102 → 43.100.104

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.
@@ -531,11 +531,11 @@ const handleDeprecatedWarnings = (options) => {
531
531
  };
532
532
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
533
533
 
534
- var hasRequiredFactory$2;
534
+ var hasRequiredFactory$1;
535
535
 
536
- function requireFactory$2 () {
537
- if (hasRequiredFactory$2) return Factory$6;
538
- hasRequiredFactory$2 = 1;
536
+ function requireFactory$1 () {
537
+ if (hasRequiredFactory$1) return Factory$6;
538
+ hasRequiredFactory$1 = 1;
539
539
  Object.defineProperty(Factory$6, "__esModule", { value: true });
540
540
  Factory$6.ViewModule = void 0;
541
541
  const base_1 = base;
@@ -750,8 +750,8 @@ var main = {};
750
750
 
751
751
  Object.defineProperty(main, "__esModule", { value: true });
752
752
  main.WebContents = void 0;
753
- const base_1$n = base;
754
- class WebContents extends base_1$n.EmitterBase {
753
+ const base_1$p = base;
754
+ class WebContents extends base_1$p.EmitterBase {
755
755
  /**
756
756
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
757
757
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -1832,11 +1832,11 @@ class WebContents extends base_1$n.EmitterBase {
1832
1832
  }
1833
1833
  main.WebContents = WebContents;
1834
1834
 
1835
- var hasRequiredInstance$2;
1835
+ var hasRequiredInstance$1;
1836
1836
 
1837
- function requireInstance$2 () {
1838
- if (hasRequiredInstance$2) return Instance$5;
1839
- hasRequiredInstance$2 = 1;
1837
+ function requireInstance$1 () {
1838
+ if (hasRequiredInstance$1) return Instance$5;
1839
+ hasRequiredInstance$1 = 1;
1840
1840
  var _View_providerChannelClient;
1841
1841
  Object.defineProperty(Instance$5, "__esModule", { value: true });
1842
1842
  Instance$5.View = void 0;
@@ -2416,1160 +2416,1139 @@ function requireView () {
2416
2416
  *
2417
2417
  * @packageDocumentation
2418
2418
  */
2419
- __exportStar(requireFactory$2(), exports);
2420
- __exportStar(requireInstance$2(), exports);
2419
+ __exportStar(requireFactory$1(), exports);
2420
+ __exportStar(requireInstance$1(), exports);
2421
2421
  } (view));
2422
2422
  return view;
2423
2423
  }
2424
2424
 
2425
- var hasRequiredInstance$1;
2426
-
2427
- function requireInstance$1 () {
2428
- if (hasRequiredInstance$1) return Instance$6;
2429
- hasRequiredInstance$1 = 1;
2430
- Object.defineProperty(Instance$6, "__esModule", { value: true });
2431
- Instance$6.Application = void 0;
2432
- /* eslint-disable import/prefer-default-export */
2433
- const base_1 = base;
2434
- const window_1 = requireWindow();
2435
- const view_1 = requireView();
2436
- /**
2437
- * An object representing an application. Allows the developer to create,
2438
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2439
- */
2440
- class Application extends base_1.EmitterBase {
2441
- /**
2442
- * @internal
2443
- */
2444
- constructor(wire, identity) {
2445
- super(wire, 'application', identity.uuid);
2446
- this.identity = identity;
2447
- this.window = new window_1._Window(this.wire, {
2448
- uuid: this.identity.uuid,
2449
- name: this.identity.uuid
2450
- });
2451
- }
2452
- windowListFromIdentityList(identityList) {
2453
- const windowList = [];
2454
- identityList.forEach((identity) => {
2455
- windowList.push(new window_1._Window(this.wire, {
2456
- uuid: identity.uuid,
2457
- name: identity.name
2458
- }));
2459
- });
2460
- return windowList;
2461
- }
2462
- /**
2463
- * Determines if the application is currently running.
2464
- *
2465
- * @example
2466
- *
2467
- * ```js
2468
- * async function isAppRunning() {
2469
- * const app = await fin.Application.getCurrent();
2470
- * return await app.isRunning();
2471
- * }
2472
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2473
- * ```
2474
- */
2475
- isRunning() {
2476
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2477
- }
2478
- /**
2479
- * Closes the application and any child windows created by the application.
2480
- * Cleans the application from state so it is no longer found in getAllApplications.
2481
- * @param force Close will be prevented from closing when force is false and
2482
- * ‘close-requested’ has been subscribed to for application’s main window.
2483
- *
2484
- * @example
2485
- *
2486
- * ```js
2487
- * async function closeApp() {
2488
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2489
- * const app = await fin.Application.wrap({uuid: 'app2'});
2490
- * await app.quit();
2491
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2492
- *
2493
- * }
2494
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2495
- * ```
2496
- */
2497
- async quit(force = false) {
2498
- try {
2499
- await this._close(force);
2500
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
2501
- }
2502
- catch (error) {
2503
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2504
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2505
- throw error;
2506
- }
2507
- }
2508
- }
2509
- async _close(force = false) {
2510
- try {
2511
- await this.wire.sendAction('close-application', { force, ...this.identity });
2512
- }
2513
- catch (error) {
2514
- if (!error.message.includes('Remote connection has closed')) {
2515
- throw error;
2516
- }
2517
- }
2518
- }
2519
- /**
2520
- * @deprecated use Application.quit instead
2521
- * Closes the application and any child windows created by the application.
2522
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2523
- * @param callback - called if the method succeeds.
2524
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2525
- *
2526
- * @example
2527
- *
2528
- * ```js
2529
- * async function closeApp() {
2530
- * const app = await fin.Application.getCurrent();
2531
- * return await app.close();
2532
- * }
2533
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2534
- * ```
2535
- */
2536
- close(force = false) {
2537
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2538
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2539
- // we do not want to expose this error, just continue if this analytics-only call fails
2540
- });
2541
- return this._close(force);
2542
- }
2543
- /**
2544
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2545
- *
2546
- * @example
2547
- *
2548
- * ```js
2549
- * async function getChildWindows() {
2550
- * const app = await fin.Application.getCurrent();
2551
- * return await app.getChildWindows();
2552
- * }
2553
- *
2554
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2555
- * ```
2556
- */
2557
- getChildWindows() {
2558
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2559
- const identityList = [];
2560
- payload.data.forEach((winName) => {
2561
- identityList.push({ uuid: this.identity.uuid, name: winName });
2562
- });
2563
- return this.windowListFromIdentityList(identityList);
2564
- });
2565
- }
2566
- /**
2567
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2568
- * if the application was not created from a manifest.
2569
- *
2570
- * @example
2571
- *
2572
- * ```js
2573
- * async function getManifest() {
2574
- * const app = await fin.Application.getCurrent();
2575
- * return await app.getManifest();
2576
- * }
2577
- *
2578
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2579
- * ```
2580
- */
2581
- getManifest() {
2582
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2583
- }
2584
- /**
2585
- * Retrieves UUID of the application that launches this application. Invokes the error callback
2586
- * if the application was created from a manifest.
2587
- *
2588
- * @example
2589
- *
2590
- * ```js
2591
- * async function getParentUuid() {
2592
- * const app = await fin.Application.start({
2593
- * uuid: 'app-1',
2594
- * name: 'myApp',
2595
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2596
- * autoShow: true
2597
- * });
2598
- * return await app.getParentUuid();
2599
- * }
2600
- *
2601
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2602
- * ```
2603
- */
2604
- getParentUuid() {
2605
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2606
- }
2607
- /**
2608
- * Retrieves current application's shortcut configuration.
2609
- *
2610
- * @example
2611
- *
2612
- * ```js
2613
- * async function getShortcuts() {
2614
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
2615
- * return await app.getShortcuts();
2616
- * }
2617
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2618
- * ```
2619
- */
2620
- getShortcuts() {
2621
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2622
- }
2623
- /**
2624
- * Retrieves current application's views.
2625
- * @experimental
2626
- *
2627
- * @example
2628
- *
2629
- * ```js
2630
- * async function getViews() {
2631
- * const app = await fin.Application.getCurrent();
2632
- * return await app.getViews();
2633
- * }
2634
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
2635
- * ```
2636
- */
2637
- async getViews() {
2638
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2639
- return payload.data.map((id) => new view_1.View(this.wire, id));
2640
- }
2641
- /**
2642
- * Returns the current zoom level of the application.
2643
- *
2644
- * @example
2645
- *
2646
- * ```js
2647
- * async function getZoomLevel() {
2648
- * const app = await fin.Application.getCurrent();
2649
- * return await app.getZoomLevel();
2650
- * }
2651
- *
2652
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2653
- * ```
2654
- */
2655
- getZoomLevel() {
2656
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2657
- }
2658
- /**
2659
- * Returns an instance of the main Window of the application
2660
- *
2661
- * @example
2662
- *
2663
- * ```js
2664
- * async function getWindow() {
2665
- * const app = await fin.Application.start({
2666
- * uuid: 'app-1',
2667
- * name: 'myApp',
2668
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2669
- * autoShow: true
2670
- * });
2671
- * return await app.getWindow();
2672
- * }
2673
- *
2674
- * getWindow().then(win => {
2675
- * win.showAt(0, 400);
2676
- * win.flash();
2677
- * }).catch(err => console.log(err));
2678
- * ```
2679
- */
2680
- getWindow() {
2681
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2682
- // we do not want to expose this error, just continue if this analytics-only call fails
2683
- });
2684
- return Promise.resolve(this.window);
2685
- }
2686
- /**
2687
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2688
- * @param userName - username to be passed to the RVM.
2689
- * @param appName - app name to be passed to the RVM.
2690
- *
2691
- * @example
2692
- *
2693
- * ```js
2694
- * async function registerUser() {
2695
- * const app = await fin.Application.getCurrent();
2696
- * return await app.registerUser('user', 'myApp');
2697
- * }
2698
- *
2699
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2700
- * ```
2701
- */
2702
- registerUser(userName, appName) {
2703
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2704
- }
2705
- /**
2706
- * Removes the application’s icon from the tray.
2707
- *
2708
- * @example
2709
- *
2710
- * ```js
2711
- * async function removeTrayIcon() {
2712
- * const app = await fin.Application.getCurrent();
2713
- * return await app.removeTrayIcon();
2714
- * }
2715
- *
2716
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
2717
- * ```
2718
- */
2719
- removeTrayIcon() {
2720
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
2721
- }
2722
- /**
2723
- * Restarts the application.
2724
- *
2725
- * @example
2726
- *
2727
- * ```js
2728
- * async function restartApp() {
2729
- * const app = await fin.Application.getCurrent();
2730
- * return await app.restart();
2731
- * }
2732
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
2733
- * ```
2734
- */
2735
- restart() {
2736
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
2737
- }
2738
- /**
2739
- * DEPRECATED method to run the application.
2740
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
2741
- *
2742
- * @example
2743
- *
2744
- * ```js
2745
- * async function run() {
2746
- * const app = await fin.Application.create({
2747
- * name: 'myApp',
2748
- * uuid: 'app-1',
2749
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
2750
- * autoShow: true
2751
- * });
2752
- * await app.run();
2753
- * }
2754
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
2755
- * ```
2756
- *
2757
- * @ignore
2758
- */
2759
- run() {
2760
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2761
- this.wire.sendAction('application-run', this.identity).catch((e) => {
2762
- // we do not want to expose this error, just continue if this analytics-only call fails
2763
- });
2764
- return this._run();
2765
- }
2766
- _run(opts = {}) {
2767
- return this.wire
2768
- .sendAction('run-application', {
2769
- manifestUrl: this._manifestUrl,
2770
- opts,
2771
- ...this.identity
2772
- })
2773
- .then(() => undefined);
2774
- }
2775
- /**
2776
- * Instructs the RVM to schedule one restart of the application.
2777
- *
2778
- * @example
2779
- *
2780
- * ```js
2781
- * async function scheduleRestart() {
2782
- * const app = await fin.Application.getCurrent();
2783
- * return await app.scheduleRestart();
2784
- * }
2785
- *
2786
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
2787
- * ```
2788
- */
2789
- scheduleRestart() {
2790
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
2791
- }
2792
- /**
2793
- * Sends a message to the RVM to upload the application's logs. On success,
2794
- * an object containing logId is returned.
2795
- *
2796
- * @example
2797
- *
2798
- * ```js
2799
- * async function sendLog() {
2800
- * const app = await fin.Application.getCurrent();
2801
- * return await app.sendApplicationLog();
2802
- * }
2803
- *
2804
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
2805
- * ```
2806
- */
2807
- async sendApplicationLog() {
2808
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
2809
- return payload.data;
2810
- }
2811
- /**
2812
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
2813
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2814
- *
2815
- * Note: If the "name" property is omitted it defaults to "tasks".
2816
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
2817
- *
2818
- *
2819
- * @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).
2820
- *
2821
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
2822
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
2823
- *
2824
- * Note: If the "name" property is omitted it defaults to "tasks".
2825
- *
2826
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
2827
- * uuid or shortcut.name is changed.
2828
- *
2829
- * @example
2830
- *
2831
- * ```js
2832
- * const app = fin.Application.getCurrentSync();
2833
- * const appName = 'My App';
2834
- * const jumpListConfig = [ // array of JumpList categories
2835
- * {
2836
- * // has no name and no type so `type` is assumed to be "tasks"
2837
- * items: [ // array of JumpList items
2838
- * {
2839
- * type: 'task',
2840
- * title: `Launch ${appName}`,
2841
- * description: `Runs ${appName} with the default configuration`,
2842
- * deepLink: 'fins://path.to/app/manifest.json',
2843
- * iconPath: 'https://path.to/app/icon.ico',
2844
- * iconIndex: 0
2845
- * },
2846
- * { type: 'separator' },
2847
- * {
2848
- * type: 'task',
2849
- * title: `Restore ${appName}`,
2850
- * description: 'Restore to last configuration',
2851
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
2852
- * iconPath: 'https://path.to/app/icon.ico',
2853
- * iconIndex: 0
2854
- * },
2855
- * ]
2856
- * },
2857
- * {
2858
- * name: 'Tools',
2859
- * items: [ // array of JumpList items
2860
- * {
2861
- * type: 'task',
2862
- * title: 'Tool A',
2863
- * description: 'Runs Tool A',
2864
- * deepLink: 'fins://path.to/tool-a/manifest.json',
2865
- * iconPath: 'https://path.to/tool-a/icon.ico',
2866
- * iconIndex: 0
2867
- * },
2868
- * {
2869
- * type: 'task',
2870
- * title: 'Tool B',
2871
- * description: 'Runs Tool B',
2872
- * deepLink: 'fins://path.to/tool-b/manifest.json',
2873
- * iconPath: 'https://path.to/tool-b/icon.ico',
2874
- * iconIndex: 0
2875
- * }]
2876
- * }
2877
- * ];
2878
- *
2879
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
2880
- * ```
2881
- *
2882
- * To handle deeplink args:
2883
- * ```js
2884
- * function handleUseLastConfiguration() {
2885
- * // this handler is called when the app is being launched
2886
- * app.on('run-requested', event => {
2887
- * if(event.userAppConfigArgs['use-last-configuration']) {
2888
- * // your logic here
2889
- * }
2890
- * });
2891
- * // this handler is called when the app was already running when the launch was requested
2892
- * fin.desktop.main(function(args) {
2893
- * if(args && args['use-last-configuration']) {
2894
- * // your logic here
2895
- * }
2896
- * });
2897
- * }
2898
- * ```
2899
- */
2900
- async setJumpList(jumpListCategories) {
2901
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
2902
- }
2903
- /**
2904
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
2905
- * @param icon Image URL or base64 encoded string to be used as the icon
2906
- *
2907
- * @example
2908
- *
2909
- * ```js
2910
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2911
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
2912
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
2913
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
2914
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
2915
- *
2916
- * async function setTrayIcon(icon) {
2917
- * const app = await fin.Application.getCurrent();
2918
- * return await app.setTrayIcon(icon);
2919
- * }
2920
- *
2921
- * // use image url to set tray icon
2922
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2923
- *
2924
- * // use base64 encoded string to set tray icon
2925
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2926
- *
2927
- * // use a dataURL to set tray icon
2928
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2929
- * ```
2930
- */
2931
- setTrayIcon(icon) {
2932
- return this.wire
2933
- .sendAction('set-tray-icon', {
2934
- enabledIcon: icon,
2935
- ...this.identity
2936
- })
2937
- .then(() => undefined);
2938
- }
2939
- /**
2940
- * Set hover text for this application's system tray icon.
2941
- * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
2942
- * @param toolTip
2943
- *
2944
- * @example
2945
- *
2946
- * ```js
2947
- * const app = fin.Application.getCurrentSync();
2948
- * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2949
- *
2950
- * await app.setTrayIcon(iconUrl);
2951
- *
2952
- * await app.setTrayIconToolTip('My Application');
2953
- * ```
2954
- */
2955
- async setTrayIconToolTip(toolTip) {
2956
- await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
2957
- }
2958
- /**
2959
- * Sets new application's shortcut configuration. Windows only.
2960
- * @param config New application's shortcut configuration.
2961
- *
2962
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
2963
- * to be able to change shortcut states.
2964
- *
2965
- * @example
2966
- *
2967
- * ```js
2968
- * async function setShortcuts(config) {
2969
- * const app = await fin.Application.getCurrent();
2970
- * return app.setShortcuts(config);
2971
- * }
2972
- *
2973
- * setShortcuts({
2974
- * desktop: true,
2975
- * startMenu: false,
2976
- * systemStartup: true
2977
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
2978
- * ```
2979
- */
2980
- setShortcuts(config) {
2981
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
2982
- }
2983
- /**
2984
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
2985
- * @param queryString The new query string for this app's shortcuts.
2986
- *
2987
- * @example
2988
- *
2989
- * ```js
2990
- * const newQueryArgs = 'arg=true&arg2=false';
2991
- * const app = await fin.Application.getCurrent();
2992
- * try {
2993
- * await app.setShortcutQueryParams(newQueryArgs);
2994
- * } catch(err) {
2995
- * console.error(err)
2996
- * }
2997
- * ```
2998
- */
2999
- async setShortcutQueryParams(queryString) {
3000
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3001
- }
3002
- /**
3003
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3004
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
3005
- * @param level The zoom level
3006
- *
3007
- * @example
3008
- *
3009
- * ```js
3010
- * async function setZoomLevel(number) {
3011
- * const app = await fin.Application.getCurrent();
3012
- * return await app.setZoomLevel(number);
3013
- * }
3014
- *
3015
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3016
- * ```
3017
- */
3018
- setZoomLevel(level) {
3019
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3020
- }
3021
- /**
3022
- * Sets a username to correlate with App Log Management.
3023
- * @param username Username to correlate with App's Log.
3024
- *
3025
- * @example
3026
- *
3027
- * ```js
3028
- * async function setAppLogUser() {
3029
- * const app = await fin.Application.getCurrent();
3030
- * return await app.setAppLogUsername('username');
3031
- * }
3032
- *
3033
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3034
- *
3035
- * ```
3036
- */
3037
- async setAppLogUsername(username) {
3038
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3039
- }
3040
- /**
3041
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3042
- * @remarks The only information currently returned is the position and dimensions.
3043
- *
3044
- * @example
3045
- *
3046
- * ```js
3047
- * async function getTrayIconInfo() {
3048
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3049
- * return await app.getTrayIconInfo();
3050
- * }
3051
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3052
- * ```
3053
- */
3054
- getTrayIconInfo() {
3055
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3056
- }
3057
- /**
3058
- * Checks if the application has an associated tray icon.
3059
- *
3060
- * @example
3061
- *
3062
- * ```js
3063
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3064
- * const hasTrayIcon = await app.hasTrayIcon();
3065
- * console.log(hasTrayIcon);
3066
- * ```
3067
- */
3068
- hasTrayIcon() {
3069
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3070
- }
3071
- /**
3072
- * Closes the application by terminating its process.
3073
- *
3074
- * @example
3075
- *
3076
- * ```js
3077
- * async function terminateApp() {
3078
- * const app = await fin.Application.getCurrent();
3079
- * return await app.terminate();
3080
- * }
3081
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3082
- * ```
3083
- */
3084
- terminate() {
3085
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3086
- }
3087
- /**
3088
- * Waits for a hanging application. This method can be called in response to an application
3089
- * "not-responding" to allow the application to continue and to generate another "not-responding"
3090
- * message after a certain period of time.
3091
- *
3092
- * @ignore
3093
- */
3094
- wait() {
3095
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3096
- }
3097
- /**
3098
- * Retrieves information about the application.
3099
- *
3100
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3101
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3102
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3103
- *
3104
- * @example
3105
- *
3106
- * ```js
3107
- * async function getInfo() {
3108
- * const app = await fin.Application.getCurrent();
3109
- * return await app.getInfo();
3110
- * }
3111
- *
3112
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3113
- * ```
3114
- */
3115
- getInfo() {
3116
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3117
- }
3118
- /**
3119
- * Retrieves all process information for entities (windows and views) associated with an application.
3120
- *
3121
- * @example
3122
- * ```js
3123
- * const app = await fin.Application.getCurrent();
3124
- * const processInfo = await app.getProcessInfo();
3125
- * ```
3126
- * @experimental
3127
- */
3128
- async getProcessInfo() {
3129
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3130
- return data;
3131
- }
3132
- /**
3133
- * Sets file auto download location. It's only allowed in the same application.
3134
- *
3135
- * Note: This method is restricted by default and must be enabled via
3136
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3137
- * @param downloadLocation file auto download location
3138
- *
3139
- * @throws if setting file auto download location on different applications.
3140
- * @example
3141
- *
3142
- * ```js
3143
- * const downloadLocation = 'C:\\dev\\temp';
3144
- * const app = await fin.Application.getCurrent();
3145
- * try {
3146
- * await app.setFileDownloadLocation(downloadLocation);
3147
- * console.log('File download location is set');
3148
- * } catch(err) {
3149
- * console.error(err)
3150
- * }
3151
- * ```
3152
- */
3153
- async setFileDownloadLocation(downloadLocation) {
3154
- const { name } = this.wire.me;
3155
- const entityIdentity = { uuid: this.identity.uuid, name };
3156
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3157
- }
3158
- /**
3159
- * 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.
3160
- *
3161
- * Note: This method is restricted by default and must be enabled via
3162
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3163
- *
3164
- * @throws if getting file auto download location on different applications.
3165
- * @example
3166
- *
3167
- * ```js
3168
- * const app = await fin.Application.getCurrent();
3169
- * const fileDownloadDir = await app.getFileDownloadLocation();
3170
- * ```
3171
- */
3172
- async getFileDownloadLocation() {
3173
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3174
- return data;
3175
- }
3176
- /**
3177
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3178
- * @param options
3179
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3180
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3181
- * of all possible data shapes for the entire menu, and the click handler should process
3182
- * these with a "reducer" pattern.
3183
- * @throws if the application has no tray icon set
3184
- * @throws if the system tray is currently hidden
3185
- * @example
3186
- *
3187
- * ```js
3188
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3189
- * const app = fin.Application.getCurrentSync();
3190
- *
3191
- * await app.setTrayIcon(iconUrl);
3192
- *
3193
- * const template = [
3194
- * {
3195
- * label: 'Menu Item 1',
3196
- * data: 'hello from item 1'
3197
- * },
3198
- * { type: 'separator' },
3199
- * {
3200
- * label: 'Menu Item 2',
3201
- * type: 'checkbox',
3202
- * checked: true,
3203
- * data: 'The user clicked the checkbox'
3204
- * },
3205
- * {
3206
- * label: 'see more',
3207
- * enabled: false,
3208
- * submenu: [
3209
- * { label: 'submenu 1', data: 'hello from submenu' }
3210
- * ]
3211
- * }
3212
- * ];
3213
- *
3214
- * app.addListener('tray-icon-clicked', (event) => {
3215
- * // right-click
3216
- * if (event.button === 2) {
3217
- * app.showTrayIconPopupMenu({ template }).then(r => {
3218
- * if (r.result === 'closed') {
3219
- * console.log('nothing happened');
3220
- * } else {
3221
- * console.log(r.data);
3222
- * }
3223
- * });
3224
- * }
3225
- * });
3226
- * ```
3227
- */
3228
- async showTrayIconPopupMenu(options) {
3229
- const { name } = this.wire.me;
3230
- const entityIdentity = { uuid: this.identity.uuid, name };
3231
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3232
- return payload.data;
3233
- }
3234
- /**
3235
- * Closes the tray icon menu.
3236
- *
3237
- * @throws if the application has no tray icon set
3238
- * @example
3239
- *
3240
- * ```js
3241
- * const app = fin.Application.getCurrentSync();
3242
- *
3243
- * await app.closeTrayIconPopupMenu();
3244
- * ```
3245
- */
3246
- async closeTrayIconPopupMenu() {
3247
- const { name } = this.wire.me;
3248
- const entityIdentity = { uuid: this.identity.uuid, name };
3249
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3250
- }
3251
- }
3252
- Instance$6.Application = Application;
3253
- return Instance$6;
2425
+ Object.defineProperty(Instance$6, "__esModule", { value: true });
2426
+ Instance$6.Application = void 0;
2427
+ /* eslint-disable import/prefer-default-export */
2428
+ const base_1$o = base;
2429
+ const window_1$1 = requireWindow();
2430
+ const view_1 = requireView();
2431
+ /**
2432
+ * An object representing an application. Allows the developer to create,
2433
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2434
+ */
2435
+ class Application extends base_1$o.EmitterBase {
2436
+ /**
2437
+ * @internal
2438
+ */
2439
+ constructor(wire, identity) {
2440
+ super(wire, 'application', identity.uuid);
2441
+ this.identity = identity;
2442
+ this.window = new window_1$1._Window(this.wire, {
2443
+ uuid: this.identity.uuid,
2444
+ name: this.identity.uuid
2445
+ });
2446
+ }
2447
+ windowListFromIdentityList(identityList) {
2448
+ const windowList = [];
2449
+ identityList.forEach((identity) => {
2450
+ windowList.push(new window_1$1._Window(this.wire, {
2451
+ uuid: identity.uuid,
2452
+ name: identity.name
2453
+ }));
2454
+ });
2455
+ return windowList;
2456
+ }
2457
+ /**
2458
+ * Determines if the application is currently running.
2459
+ *
2460
+ * @example
2461
+ *
2462
+ * ```js
2463
+ * async function isAppRunning() {
2464
+ * const app = await fin.Application.getCurrent();
2465
+ * return await app.isRunning();
2466
+ * }
2467
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2468
+ * ```
2469
+ */
2470
+ isRunning() {
2471
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2472
+ }
2473
+ /**
2474
+ * Closes the application and any child windows created by the application.
2475
+ * Cleans the application from state so it is no longer found in getAllApplications.
2476
+ * @param force Close will be prevented from closing when force is false and
2477
+ * ‘close-requested’ has been subscribed to for application’s main window.
2478
+ *
2479
+ * @example
2480
+ *
2481
+ * ```js
2482
+ * async function closeApp() {
2483
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2484
+ * const app = await fin.Application.wrap({uuid: 'app2'});
2485
+ * await app.quit();
2486
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2487
+ *
2488
+ * }
2489
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2490
+ * ```
2491
+ */
2492
+ async quit(force = false) {
2493
+ try {
2494
+ await this._close(force);
2495
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
2496
+ }
2497
+ catch (error) {
2498
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2499
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2500
+ throw error;
2501
+ }
2502
+ }
2503
+ }
2504
+ async _close(force = false) {
2505
+ try {
2506
+ await this.wire.sendAction('close-application', { force, ...this.identity });
2507
+ }
2508
+ catch (error) {
2509
+ if (!error.message.includes('Remote connection has closed')) {
2510
+ throw error;
2511
+ }
2512
+ }
2513
+ }
2514
+ /**
2515
+ * @deprecated use Application.quit instead
2516
+ * Closes the application and any child windows created by the application.
2517
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2518
+ * @param callback - called if the method succeeds.
2519
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2520
+ *
2521
+ * @example
2522
+ *
2523
+ * ```js
2524
+ * async function closeApp() {
2525
+ * const app = await fin.Application.getCurrent();
2526
+ * return await app.close();
2527
+ * }
2528
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2529
+ * ```
2530
+ */
2531
+ close(force = false) {
2532
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2533
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
2534
+ // we do not want to expose this error, just continue if this analytics-only call fails
2535
+ });
2536
+ return this._close(force);
2537
+ }
2538
+ /**
2539
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2540
+ *
2541
+ * @example
2542
+ *
2543
+ * ```js
2544
+ * async function getChildWindows() {
2545
+ * const app = await fin.Application.getCurrent();
2546
+ * return await app.getChildWindows();
2547
+ * }
2548
+ *
2549
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2550
+ * ```
2551
+ */
2552
+ getChildWindows() {
2553
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2554
+ const identityList = [];
2555
+ payload.data.forEach((winName) => {
2556
+ identityList.push({ uuid: this.identity.uuid, name: winName });
2557
+ });
2558
+ return this.windowListFromIdentityList(identityList);
2559
+ });
2560
+ }
2561
+ /**
2562
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2563
+ * if the application was not created from a manifest.
2564
+ *
2565
+ * @example
2566
+ *
2567
+ * ```js
2568
+ * async function getManifest() {
2569
+ * const app = await fin.Application.getCurrent();
2570
+ * return await app.getManifest();
2571
+ * }
2572
+ *
2573
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2574
+ * ```
2575
+ */
2576
+ getManifest() {
2577
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2578
+ }
2579
+ /**
2580
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
2581
+ * if the application was created from a manifest.
2582
+ *
2583
+ * @example
2584
+ *
2585
+ * ```js
2586
+ * async function getParentUuid() {
2587
+ * const app = await fin.Application.start({
2588
+ * uuid: 'app-1',
2589
+ * name: 'myApp',
2590
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2591
+ * autoShow: true
2592
+ * });
2593
+ * return await app.getParentUuid();
2594
+ * }
2595
+ *
2596
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2597
+ * ```
2598
+ */
2599
+ getParentUuid() {
2600
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2601
+ }
2602
+ /**
2603
+ * Retrieves current application's shortcut configuration.
2604
+ *
2605
+ * @example
2606
+ *
2607
+ * ```js
2608
+ * async function getShortcuts() {
2609
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
2610
+ * return await app.getShortcuts();
2611
+ * }
2612
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2613
+ * ```
2614
+ */
2615
+ getShortcuts() {
2616
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2617
+ }
2618
+ /**
2619
+ * Retrieves current application's views.
2620
+ * @experimental
2621
+ *
2622
+ * @example
2623
+ *
2624
+ * ```js
2625
+ * async function getViews() {
2626
+ * const app = await fin.Application.getCurrent();
2627
+ * return await app.getViews();
2628
+ * }
2629
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
2630
+ * ```
2631
+ */
2632
+ async getViews() {
2633
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2634
+ return payload.data.map((id) => new view_1.View(this.wire, id));
2635
+ }
2636
+ /**
2637
+ * Returns the current zoom level of the application.
2638
+ *
2639
+ * @example
2640
+ *
2641
+ * ```js
2642
+ * async function getZoomLevel() {
2643
+ * const app = await fin.Application.getCurrent();
2644
+ * return await app.getZoomLevel();
2645
+ * }
2646
+ *
2647
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2648
+ * ```
2649
+ */
2650
+ getZoomLevel() {
2651
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2652
+ }
2653
+ /**
2654
+ * Returns an instance of the main Window of the application
2655
+ *
2656
+ * @example
2657
+ *
2658
+ * ```js
2659
+ * async function getWindow() {
2660
+ * const app = await fin.Application.start({
2661
+ * uuid: 'app-1',
2662
+ * name: 'myApp',
2663
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2664
+ * autoShow: true
2665
+ * });
2666
+ * return await app.getWindow();
2667
+ * }
2668
+ *
2669
+ * getWindow().then(win => {
2670
+ * win.showAt(0, 400);
2671
+ * win.flash();
2672
+ * }).catch(err => console.log(err));
2673
+ * ```
2674
+ */
2675
+ getWindow() {
2676
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2677
+ // we do not want to expose this error, just continue if this analytics-only call fails
2678
+ });
2679
+ return Promise.resolve(this.window);
2680
+ }
2681
+ /**
2682
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2683
+ * @param userName - username to be passed to the RVM.
2684
+ * @param appName - app name to be passed to the RVM.
2685
+ *
2686
+ * @example
2687
+ *
2688
+ * ```js
2689
+ * async function registerUser() {
2690
+ * const app = await fin.Application.getCurrent();
2691
+ * return await app.registerUser('user', 'myApp');
2692
+ * }
2693
+ *
2694
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2695
+ * ```
2696
+ */
2697
+ registerUser(userName, appName) {
2698
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2699
+ }
2700
+ /**
2701
+ * Removes the application’s icon from the tray.
2702
+ *
2703
+ * @example
2704
+ *
2705
+ * ```js
2706
+ * async function removeTrayIcon() {
2707
+ * const app = await fin.Application.getCurrent();
2708
+ * return await app.removeTrayIcon();
2709
+ * }
2710
+ *
2711
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
2712
+ * ```
2713
+ */
2714
+ removeTrayIcon() {
2715
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
2716
+ }
2717
+ /**
2718
+ * Restarts the application.
2719
+ *
2720
+ * @example
2721
+ *
2722
+ * ```js
2723
+ * async function restartApp() {
2724
+ * const app = await fin.Application.getCurrent();
2725
+ * return await app.restart();
2726
+ * }
2727
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
2728
+ * ```
2729
+ */
2730
+ restart() {
2731
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
2732
+ }
2733
+ /**
2734
+ * DEPRECATED method to run the application.
2735
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
2736
+ *
2737
+ * @example
2738
+ *
2739
+ * ```js
2740
+ * async function run() {
2741
+ * const app = await fin.Application.create({
2742
+ * name: 'myApp',
2743
+ * uuid: 'app-1',
2744
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
2745
+ * autoShow: true
2746
+ * });
2747
+ * await app.run();
2748
+ * }
2749
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
2750
+ * ```
2751
+ *
2752
+ * @ignore
2753
+ */
2754
+ run() {
2755
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2756
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
2757
+ // we do not want to expose this error, just continue if this analytics-only call fails
2758
+ });
2759
+ return this._run();
2760
+ }
2761
+ _run(opts = {}) {
2762
+ return this.wire
2763
+ .sendAction('run-application', {
2764
+ manifestUrl: this._manifestUrl,
2765
+ opts,
2766
+ ...this.identity
2767
+ })
2768
+ .then(() => undefined);
2769
+ }
2770
+ /**
2771
+ * Instructs the RVM to schedule one restart of the application.
2772
+ *
2773
+ * @example
2774
+ *
2775
+ * ```js
2776
+ * async function scheduleRestart() {
2777
+ * const app = await fin.Application.getCurrent();
2778
+ * return await app.scheduleRestart();
2779
+ * }
2780
+ *
2781
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
2782
+ * ```
2783
+ */
2784
+ scheduleRestart() {
2785
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
2786
+ }
2787
+ /**
2788
+ * Sends a message to the RVM to upload the application's logs. On success,
2789
+ * an object containing logId is returned.
2790
+ *
2791
+ * @example
2792
+ *
2793
+ * ```js
2794
+ * async function sendLog() {
2795
+ * const app = await fin.Application.getCurrent();
2796
+ * return await app.sendApplicationLog();
2797
+ * }
2798
+ *
2799
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
2800
+ * ```
2801
+ */
2802
+ async sendApplicationLog() {
2803
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
2804
+ return payload.data;
2805
+ }
2806
+ /**
2807
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
2808
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2809
+ *
2810
+ * Note: If the "name" property is omitted it defaults to "tasks".
2811
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
2812
+ *
2813
+ *
2814
+ * @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).
2815
+ *
2816
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
2817
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
2818
+ *
2819
+ * Note: If the "name" property is omitted it defaults to "tasks".
2820
+ *
2821
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
2822
+ * uuid or shortcut.name is changed.
2823
+ *
2824
+ * @example
2825
+ *
2826
+ * ```js
2827
+ * const app = fin.Application.getCurrentSync();
2828
+ * const appName = 'My App';
2829
+ * const jumpListConfig = [ // array of JumpList categories
2830
+ * {
2831
+ * // has no name and no type so `type` is assumed to be "tasks"
2832
+ * items: [ // array of JumpList items
2833
+ * {
2834
+ * type: 'task',
2835
+ * title: `Launch ${appName}`,
2836
+ * description: `Runs ${appName} with the default configuration`,
2837
+ * deepLink: 'fins://path.to/app/manifest.json',
2838
+ * iconPath: 'https://path.to/app/icon.ico',
2839
+ * iconIndex: 0
2840
+ * },
2841
+ * { type: 'separator' },
2842
+ * {
2843
+ * type: 'task',
2844
+ * title: `Restore ${appName}`,
2845
+ * description: 'Restore to last configuration',
2846
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
2847
+ * iconPath: 'https://path.to/app/icon.ico',
2848
+ * iconIndex: 0
2849
+ * },
2850
+ * ]
2851
+ * },
2852
+ * {
2853
+ * name: 'Tools',
2854
+ * items: [ // array of JumpList items
2855
+ * {
2856
+ * type: 'task',
2857
+ * title: 'Tool A',
2858
+ * description: 'Runs Tool A',
2859
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
2860
+ * iconPath: 'https://path.to/tool-a/icon.ico',
2861
+ * iconIndex: 0
2862
+ * },
2863
+ * {
2864
+ * type: 'task',
2865
+ * title: 'Tool B',
2866
+ * description: 'Runs Tool B',
2867
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
2868
+ * iconPath: 'https://path.to/tool-b/icon.ico',
2869
+ * iconIndex: 0
2870
+ * }]
2871
+ * }
2872
+ * ];
2873
+ *
2874
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
2875
+ * ```
2876
+ *
2877
+ * To handle deeplink args:
2878
+ * ```js
2879
+ * function handleUseLastConfiguration() {
2880
+ * // this handler is called when the app is being launched
2881
+ * app.on('run-requested', event => {
2882
+ * if(event.userAppConfigArgs['use-last-configuration']) {
2883
+ * // your logic here
2884
+ * }
2885
+ * });
2886
+ * // this handler is called when the app was already running when the launch was requested
2887
+ * fin.desktop.main(function(args) {
2888
+ * if(args && args['use-last-configuration']) {
2889
+ * // your logic here
2890
+ * }
2891
+ * });
2892
+ * }
2893
+ * ```
2894
+ */
2895
+ async setJumpList(jumpListCategories) {
2896
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
2897
+ }
2898
+ /**
2899
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
2900
+ * @param icon Image URL or base64 encoded string to be used as the icon
2901
+ *
2902
+ * @example
2903
+ *
2904
+ * ```js
2905
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2906
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
2907
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
2908
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
2909
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
2910
+ *
2911
+ * async function setTrayIcon(icon) {
2912
+ * const app = await fin.Application.getCurrent();
2913
+ * return await app.setTrayIcon(icon);
2914
+ * }
2915
+ *
2916
+ * // use image url to set tray icon
2917
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2918
+ *
2919
+ * // use base64 encoded string to set tray icon
2920
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2921
+ *
2922
+ * // use a dataURL to set tray icon
2923
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
2924
+ * ```
2925
+ */
2926
+ setTrayIcon(icon) {
2927
+ return this.wire
2928
+ .sendAction('set-tray-icon', {
2929
+ enabledIcon: icon,
2930
+ ...this.identity
2931
+ })
2932
+ .then(() => undefined);
2933
+ }
2934
+ /**
2935
+ * Set hover text for this application's system tray icon.
2936
+ * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
2937
+ * @param toolTip
2938
+ *
2939
+ * @example
2940
+ *
2941
+ * ```js
2942
+ * const app = fin.Application.getCurrentSync();
2943
+ * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
2944
+ *
2945
+ * await app.setTrayIcon(iconUrl);
2946
+ *
2947
+ * await app.setTrayIconToolTip('My Application');
2948
+ * ```
2949
+ */
2950
+ async setTrayIconToolTip(toolTip) {
2951
+ await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
2952
+ }
2953
+ /**
2954
+ * Sets new application's shortcut configuration. Windows only.
2955
+ * @param config New application's shortcut configuration.
2956
+ *
2957
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
2958
+ * to be able to change shortcut states.
2959
+ *
2960
+ * @example
2961
+ *
2962
+ * ```js
2963
+ * async function setShortcuts(config) {
2964
+ * const app = await fin.Application.getCurrent();
2965
+ * return app.setShortcuts(config);
2966
+ * }
2967
+ *
2968
+ * setShortcuts({
2969
+ * desktop: true,
2970
+ * startMenu: false,
2971
+ * systemStartup: true
2972
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
2973
+ * ```
2974
+ */
2975
+ setShortcuts(config) {
2976
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
2977
+ }
2978
+ /**
2979
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
2980
+ * @param queryString The new query string for this app's shortcuts.
2981
+ *
2982
+ * @example
2983
+ *
2984
+ * ```js
2985
+ * const newQueryArgs = 'arg=true&arg2=false';
2986
+ * const app = await fin.Application.getCurrent();
2987
+ * try {
2988
+ * await app.setShortcutQueryParams(newQueryArgs);
2989
+ * } catch(err) {
2990
+ * console.error(err)
2991
+ * }
2992
+ * ```
2993
+ */
2994
+ async setShortcutQueryParams(queryString) {
2995
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
2996
+ }
2997
+ /**
2998
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
2999
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
3000
+ * @param level The zoom level
3001
+ *
3002
+ * @example
3003
+ *
3004
+ * ```js
3005
+ * async function setZoomLevel(number) {
3006
+ * const app = await fin.Application.getCurrent();
3007
+ * return await app.setZoomLevel(number);
3008
+ * }
3009
+ *
3010
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3011
+ * ```
3012
+ */
3013
+ setZoomLevel(level) {
3014
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3015
+ }
3016
+ /**
3017
+ * Sets a username to correlate with App Log Management.
3018
+ * @param username Username to correlate with App's Log.
3019
+ *
3020
+ * @example
3021
+ *
3022
+ * ```js
3023
+ * async function setAppLogUser() {
3024
+ * const app = await fin.Application.getCurrent();
3025
+ * return await app.setAppLogUsername('username');
3026
+ * }
3027
+ *
3028
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3029
+ *
3030
+ * ```
3031
+ */
3032
+ async setAppLogUsername(username) {
3033
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3034
+ }
3035
+ /**
3036
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3037
+ * @remarks The only information currently returned is the position and dimensions.
3038
+ *
3039
+ * @example
3040
+ *
3041
+ * ```js
3042
+ * async function getTrayIconInfo() {
3043
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3044
+ * return await app.getTrayIconInfo();
3045
+ * }
3046
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3047
+ * ```
3048
+ */
3049
+ getTrayIconInfo() {
3050
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3051
+ }
3052
+ /**
3053
+ * Checks if the application has an associated tray icon.
3054
+ *
3055
+ * @example
3056
+ *
3057
+ * ```js
3058
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3059
+ * const hasTrayIcon = await app.hasTrayIcon();
3060
+ * console.log(hasTrayIcon);
3061
+ * ```
3062
+ */
3063
+ hasTrayIcon() {
3064
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3065
+ }
3066
+ /**
3067
+ * Closes the application by terminating its process.
3068
+ *
3069
+ * @example
3070
+ *
3071
+ * ```js
3072
+ * async function terminateApp() {
3073
+ * const app = await fin.Application.getCurrent();
3074
+ * return await app.terminate();
3075
+ * }
3076
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3077
+ * ```
3078
+ */
3079
+ terminate() {
3080
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3081
+ }
3082
+ /**
3083
+ * Waits for a hanging application. This method can be called in response to an application
3084
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
3085
+ * message after a certain period of time.
3086
+ *
3087
+ * @ignore
3088
+ */
3089
+ wait() {
3090
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3091
+ }
3092
+ /**
3093
+ * Retrieves information about the application.
3094
+ *
3095
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3096
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3097
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3098
+ *
3099
+ * @example
3100
+ *
3101
+ * ```js
3102
+ * async function getInfo() {
3103
+ * const app = await fin.Application.getCurrent();
3104
+ * return await app.getInfo();
3105
+ * }
3106
+ *
3107
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3108
+ * ```
3109
+ */
3110
+ getInfo() {
3111
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3112
+ }
3113
+ /**
3114
+ * Retrieves all process information for entities (windows and views) associated with an application.
3115
+ *
3116
+ * @example
3117
+ * ```js
3118
+ * const app = await fin.Application.getCurrent();
3119
+ * const processInfo = await app.getProcessInfo();
3120
+ * ```
3121
+ * @experimental
3122
+ */
3123
+ async getProcessInfo() {
3124
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3125
+ return data;
3126
+ }
3127
+ /**
3128
+ * Sets file auto download location. It's only allowed in the same application.
3129
+ *
3130
+ * Note: This method is restricted by default and must be enabled via
3131
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3132
+ * @param downloadLocation file auto download location
3133
+ *
3134
+ * @throws if setting file auto download location on different applications.
3135
+ * @example
3136
+ *
3137
+ * ```js
3138
+ * const downloadLocation = 'C:\\dev\\temp';
3139
+ * const app = await fin.Application.getCurrent();
3140
+ * try {
3141
+ * await app.setFileDownloadLocation(downloadLocation);
3142
+ * console.log('File download location is set');
3143
+ * } catch(err) {
3144
+ * console.error(err)
3145
+ * }
3146
+ * ```
3147
+ */
3148
+ async setFileDownloadLocation(downloadLocation) {
3149
+ const { name } = this.wire.me;
3150
+ const entityIdentity = { uuid: this.identity.uuid, name };
3151
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3152
+ }
3153
+ /**
3154
+ * 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.
3155
+ *
3156
+ * Note: This method is restricted by default and must be enabled via
3157
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3158
+ *
3159
+ * @throws if getting file auto download location on different applications.
3160
+ * @example
3161
+ *
3162
+ * ```js
3163
+ * const app = await fin.Application.getCurrent();
3164
+ * const fileDownloadDir = await app.getFileDownloadLocation();
3165
+ * ```
3166
+ */
3167
+ async getFileDownloadLocation() {
3168
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3169
+ return data;
3170
+ }
3171
+ /**
3172
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3173
+ * @param options
3174
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3175
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3176
+ * of all possible data shapes for the entire menu, and the click handler should process
3177
+ * these with a "reducer" pattern.
3178
+ * @throws if the application has no tray icon set
3179
+ * @throws if the system tray is currently hidden
3180
+ * @example
3181
+ *
3182
+ * ```js
3183
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3184
+ * const app = fin.Application.getCurrentSync();
3185
+ *
3186
+ * await app.setTrayIcon(iconUrl);
3187
+ *
3188
+ * const template = [
3189
+ * {
3190
+ * label: 'Menu Item 1',
3191
+ * data: 'hello from item 1'
3192
+ * },
3193
+ * { type: 'separator' },
3194
+ * {
3195
+ * label: 'Menu Item 2',
3196
+ * type: 'checkbox',
3197
+ * checked: true,
3198
+ * data: 'The user clicked the checkbox'
3199
+ * },
3200
+ * {
3201
+ * label: 'see more',
3202
+ * enabled: false,
3203
+ * submenu: [
3204
+ * { label: 'submenu 1', data: 'hello from submenu' }
3205
+ * ]
3206
+ * }
3207
+ * ];
3208
+ *
3209
+ * app.addListener('tray-icon-clicked', (event) => {
3210
+ * // right-click
3211
+ * if (event.button === 2) {
3212
+ * app.showTrayIconPopupMenu({ template }).then(r => {
3213
+ * if (r.result === 'closed') {
3214
+ * console.log('nothing happened');
3215
+ * } else {
3216
+ * console.log(r.data);
3217
+ * }
3218
+ * });
3219
+ * }
3220
+ * });
3221
+ * ```
3222
+ */
3223
+ async showTrayIconPopupMenu(options) {
3224
+ const { name } = this.wire.me;
3225
+ const entityIdentity = { uuid: this.identity.uuid, name };
3226
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3227
+ return payload.data;
3228
+ }
3229
+ /**
3230
+ * Closes the tray icon menu.
3231
+ *
3232
+ * @throws if the application has no tray icon set
3233
+ * @example
3234
+ *
3235
+ * ```js
3236
+ * const app = fin.Application.getCurrentSync();
3237
+ *
3238
+ * await app.closeTrayIconPopupMenu();
3239
+ * ```
3240
+ */
3241
+ async closeTrayIconPopupMenu() {
3242
+ const { name } = this.wire.me;
3243
+ const entityIdentity = { uuid: this.identity.uuid, name };
3244
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3245
+ }
3246
+ }
3247
+ Instance$6.Application = Application;
3248
+
3249
+ Object.defineProperty(Factory$7, "__esModule", { value: true });
3250
+ Factory$7.ApplicationModule = void 0;
3251
+ const base_1$n = base;
3252
+ const validate_1$4 = validate;
3253
+ const Instance_1$5 = Instance$6;
3254
+ /**
3255
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3256
+ */
3257
+ class ApplicationModule extends base_1$n.Base {
3258
+ /**
3259
+ * Asynchronously returns an API handle for the given Application identity.
3260
+ *
3261
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3262
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3263
+ * for an Application throughout its entire lifecycle.
3264
+ *
3265
+ * @example
3266
+ *
3267
+ * ```js
3268
+ * fin.Application.wrap({ uuid: 'testapp' })
3269
+ * .then(app => app.isRunning())
3270
+ * .then(running => console.log('Application is running: ' + running))
3271
+ * .catch(err => console.log(err));
3272
+ * ```
3273
+ *
3274
+ */
3275
+ async wrap(identity) {
3276
+ this.wire.sendAction('wrap-application').catch((e) => {
3277
+ // we do not want to expose this error, just continue if this analytics-only call fails
3278
+ });
3279
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3280
+ if (errorMsg) {
3281
+ throw new Error(errorMsg);
3282
+ }
3283
+ return new Instance_1$5.Application(this.wire, identity);
3284
+ }
3285
+ /**
3286
+ * Synchronously returns an API handle for the given Application identity.
3287
+ *
3288
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3289
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3290
+ * for an Aplication throughout its entire lifecycle.
3291
+ *
3292
+ * @example
3293
+ *
3294
+ * ```js
3295
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3296
+ * await app.close();
3297
+ * ```
3298
+ *
3299
+ */
3300
+ wrapSync(identity) {
3301
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
3302
+ // we do not want to expose this error, just continue if this analytics-only call fails
3303
+ });
3304
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3305
+ if (errorMsg) {
3306
+ throw new Error(errorMsg);
3307
+ }
3308
+ return new Instance_1$5.Application(this.wire, identity);
3309
+ }
3310
+ async _create(appOptions) {
3311
+ // set defaults:
3312
+ if (appOptions.waitForPageLoad === undefined) {
3313
+ appOptions.waitForPageLoad = false;
3314
+ }
3315
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3316
+ appOptions.autoShow = true;
3317
+ }
3318
+ await this.wire.sendAction('create-application', appOptions);
3319
+ return this.wrap({ uuid: appOptions.uuid });
3320
+ }
3321
+ /**
3322
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3323
+ *
3324
+ * @example
3325
+ *
3326
+ * ```js
3327
+ * async function createApp() {
3328
+ * const app = await fin.Application.create({
3329
+ * name: 'myApp',
3330
+ * uuid: 'app-3',
3331
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3332
+ * autoShow: true
3333
+ * });
3334
+ * await app.run();
3335
+ * }
3336
+ *
3337
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3338
+ * ```
3339
+ *
3340
+ * @ignore
3341
+ */
3342
+ create(appOptions) {
3343
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3344
+ this.wire.sendAction('application-create').catch((e) => {
3345
+ // we do not want to expose this error, just continue if this analytics-only call fails
3346
+ });
3347
+ return this._create(appOptions);
3348
+ }
3349
+ /**
3350
+ * Creates and starts a new Application.
3351
+ *
3352
+ * @example
3353
+ *
3354
+ * ```js
3355
+ * async function start() {
3356
+ * return fin.Application.start({
3357
+ * name: 'app-1',
3358
+ * uuid: 'app-1',
3359
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3360
+ * autoShow: true
3361
+ * });
3362
+ * }
3363
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3364
+ * ```
3365
+ *
3366
+ */
3367
+ async start(appOptions) {
3368
+ this.wire.sendAction('start-application').catch((e) => {
3369
+ // we do not want to expose this error, just continue if this analytics-only call fails
3370
+ });
3371
+ const app = await this._create(appOptions);
3372
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3373
+ return app;
3374
+ }
3375
+ /**
3376
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3377
+ * Returns once the RVM is finished attempting to launch the applications.
3378
+ * @param opts - Parameters that the RVM will use.
3379
+ *
3380
+ * @example
3381
+ *
3382
+ * ```js
3383
+ *
3384
+ * const applicationInfoArray = [
3385
+ * {
3386
+ * "uuid": 'App-1',
3387
+ * "manifestUrl": 'http://localhost:5555/app1.json',
3388
+ * },
3389
+ * {
3390
+ * "uuid": 'App-2',
3391
+ * "manifestUrl": 'http://localhost:5555/app2.json',
3392
+ * },
3393
+ * {
3394
+ * "uuid": 'App-3',
3395
+ * "manifestUrl": 'http://localhost:5555/app3.json',
3396
+ * }
3397
+ * ]
3398
+ *
3399
+ * fin.Application.startManyManifests(applicationInfoArray)
3400
+ * .then(() => {
3401
+ * console.log('RVM has finished launching the application list.');
3402
+ * })
3403
+ * .catch((err) => {
3404
+ * console.log(err);
3405
+ * })
3406
+ * ```
3407
+ *
3408
+ * @experimental
3409
+ */
3410
+ async startManyManifests(applications, opts) {
3411
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3412
+ }
3413
+ /**
3414
+ * Asynchronously returns an Application object that represents the current application
3415
+ *
3416
+ * @example
3417
+ *
3418
+ * ```js
3419
+ * async function isCurrentAppRunning () {
3420
+ * const app = await fin.Application.getCurrent();
3421
+ * return app.isRunning();
3422
+ * }
3423
+ *
3424
+ * isCurrentAppRunning().then(running => {
3425
+ * console.log(`Current app is running: ${running}`);
3426
+ * }).catch(err => {
3427
+ * console.error(err);
3428
+ * });
3429
+ *
3430
+ * ```
3431
+ */
3432
+ getCurrent() {
3433
+ this.wire.sendAction('get-current-application').catch((e) => {
3434
+ // we do not want to expose this error, just continue if this analytics-only call fails
3435
+ });
3436
+ return this.wrap({ uuid: this.wire.me.uuid });
3437
+ }
3438
+ /**
3439
+ * Synchronously returns an Application object that represents the current application
3440
+ *
3441
+ * @example
3442
+ *
3443
+ * ```js
3444
+ * async function isCurrentAppRunning () {
3445
+ * const app = fin.Application.getCurrentSync();
3446
+ * return app.isRunning();
3447
+ * }
3448
+ *
3449
+ * isCurrentAppRunning().then(running => {
3450
+ * console.log(`Current app is running: ${running}`);
3451
+ * }).catch(err => {
3452
+ * console.error(err);
3453
+ * });
3454
+ *
3455
+ * ```
3456
+ */
3457
+ getCurrentSync() {
3458
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
3459
+ // we do not want to expose this error, just continue if this analytics-only call fails
3460
+ });
3461
+ return this.wrapSync({ uuid: this.wire.me.uuid });
3462
+ }
3463
+ /**
3464
+ * Retrieves application's manifest and returns a running instance of the application.
3465
+ * @param manifestUrl - The URL of app's manifest.
3466
+ * @param opts - Parameters that the RVM will use.
3467
+ *
3468
+ * @example
3469
+ *
3470
+ * ```js
3471
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3472
+ *
3473
+ * // For a local manifest file:
3474
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3475
+ * ```
3476
+ */
3477
+ async startFromManifest(manifestUrl, opts) {
3478
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
3479
+ // we do not want to expose this error, just continue if this analytics-only call fails
3480
+ });
3481
+ const app = await this._createFromManifest(manifestUrl);
3482
+ // @ts-expect-error using private method without warning.
3483
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
3484
+ return app;
3485
+ }
3486
+ /**
3487
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3488
+ * Retrieves application's manifest and returns a wrapped application.
3489
+ * @param manifestUrl - The URL of app's manifest.
3490
+ * @param callback - called if the method succeeds.
3491
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3492
+ *
3493
+ * @example
3494
+ *
3495
+ * ```js
3496
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3497
+ * ```
3498
+ * @ignore
3499
+ */
3500
+ createFromManifest(manifestUrl) {
3501
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3502
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
3503
+ // we do not want to expose this error, just continue if this analytics-only call fails
3504
+ });
3505
+ return this._createFromManifest(manifestUrl);
3506
+ }
3507
+ _createFromManifest(manifestUrl) {
3508
+ return this.wire
3509
+ .sendAction('get-application-manifest', { manifestUrl })
3510
+ .then(({ payload }) => {
3511
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3512
+ return this.wrap({ uuid });
3513
+ })
3514
+ .then((app) => {
3515
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3516
+ return app;
3517
+ });
3518
+ }
3254
3519
  }
3520
+ Factory$7.ApplicationModule = ApplicationModule;
3255
3521
 
3256
- var hasRequiredFactory$1;
3257
-
3258
- function requireFactory$1 () {
3259
- if (hasRequiredFactory$1) return Factory$7;
3260
- hasRequiredFactory$1 = 1;
3261
- Object.defineProperty(Factory$7, "__esModule", { value: true });
3262
- Factory$7.ApplicationModule = void 0;
3263
- const base_1 = base;
3264
- const validate_1 = validate;
3265
- const Instance_1 = requireInstance$1();
3522
+ (function (exports) {
3523
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3524
+ if (k2 === undefined) k2 = k;
3525
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3526
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3527
+ desc = { enumerable: true, get: function() { return m[k]; } };
3528
+ }
3529
+ Object.defineProperty(o, k2, desc);
3530
+ }) : (function(o, m, k, k2) {
3531
+ if (k2 === undefined) k2 = k;
3532
+ o[k2] = m[k];
3533
+ }));
3534
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3535
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3536
+ };
3537
+ Object.defineProperty(exports, "__esModule", { value: true });
3266
3538
  /**
3267
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3539
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
3540
+ *
3541
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3542
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3543
+ *
3544
+ * 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),
3545
+ * both of these were documented on the same page.
3546
+ *
3547
+ * @packageDocumentation
3268
3548
  */
3269
- class ApplicationModule extends base_1.Base {
3270
- /**
3271
- * Asynchronously returns an API handle for the given Application identity.
3272
- *
3273
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3274
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3275
- * for an Application throughout its entire lifecycle.
3276
- *
3277
- * @example
3278
- *
3279
- * ```js
3280
- * fin.Application.wrap({ uuid: 'testapp' })
3281
- * .then(app => app.isRunning())
3282
- * .then(running => console.log('Application is running: ' + running))
3283
- * .catch(err => console.log(err));
3284
- * ```
3285
- *
3286
- */
3287
- async wrap(identity) {
3288
- this.wire.sendAction('wrap-application').catch((e) => {
3289
- // we do not want to expose this error, just continue if this analytics-only call fails
3290
- });
3291
- const errorMsg = (0, validate_1.validateIdentity)(identity);
3292
- if (errorMsg) {
3293
- throw new Error(errorMsg);
3294
- }
3295
- return new Instance_1.Application(this.wire, identity);
3296
- }
3297
- /**
3298
- * Synchronously returns an API handle for the given Application identity.
3299
- *
3300
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3301
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3302
- * for an Aplication throughout its entire lifecycle.
3303
- *
3304
- * @example
3305
- *
3306
- * ```js
3307
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3308
- * await app.close();
3309
- * ```
3310
- *
3311
- */
3312
- wrapSync(identity) {
3313
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3314
- // we do not want to expose this error, just continue if this analytics-only call fails
3315
- });
3316
- const errorMsg = (0, validate_1.validateIdentity)(identity);
3317
- if (errorMsg) {
3318
- throw new Error(errorMsg);
3319
- }
3320
- return new Instance_1.Application(this.wire, identity);
3321
- }
3322
- async _create(appOptions) {
3323
- // set defaults:
3324
- if (appOptions.waitForPageLoad === undefined) {
3325
- appOptions.waitForPageLoad = false;
3326
- }
3327
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3328
- appOptions.autoShow = true;
3329
- }
3330
- await this.wire.sendAction('create-application', appOptions);
3331
- return this.wrap({ uuid: appOptions.uuid });
3332
- }
3333
- /**
3334
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3335
- *
3336
- * @example
3337
- *
3338
- * ```js
3339
- * async function createApp() {
3340
- * const app = await fin.Application.create({
3341
- * name: 'myApp',
3342
- * uuid: 'app-3',
3343
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3344
- * autoShow: true
3345
- * });
3346
- * await app.run();
3347
- * }
3348
- *
3349
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3350
- * ```
3351
- *
3352
- * @ignore
3353
- */
3354
- create(appOptions) {
3355
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3356
- this.wire.sendAction('application-create').catch((e) => {
3357
- // we do not want to expose this error, just continue if this analytics-only call fails
3358
- });
3359
- return this._create(appOptions);
3360
- }
3361
- /**
3362
- * Creates and starts a new Application.
3363
- *
3364
- * @example
3365
- *
3366
- * ```js
3367
- * async function start() {
3368
- * return fin.Application.start({
3369
- * name: 'app-1',
3370
- * uuid: 'app-1',
3371
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3372
- * autoShow: true
3373
- * });
3374
- * }
3375
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3376
- * ```
3377
- *
3378
- */
3379
- async start(appOptions) {
3380
- this.wire.sendAction('start-application').catch((e) => {
3381
- // we do not want to expose this error, just continue if this analytics-only call fails
3382
- });
3383
- const app = await this._create(appOptions);
3384
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3385
- return app;
3386
- }
3387
- /**
3388
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3389
- * Returns once the RVM is finished attempting to launch the applications.
3390
- * @param opts - Parameters that the RVM will use.
3391
- *
3392
- * @example
3393
- *
3394
- * ```js
3395
- *
3396
- * const applicationInfoArray = [
3397
- * {
3398
- * "uuid": 'App-1',
3399
- * "manifestUrl": 'http://localhost:5555/app1.json',
3400
- * },
3401
- * {
3402
- * "uuid": 'App-2',
3403
- * "manifestUrl": 'http://localhost:5555/app2.json',
3404
- * },
3405
- * {
3406
- * "uuid": 'App-3',
3407
- * "manifestUrl": 'http://localhost:5555/app3.json',
3408
- * }
3409
- * ]
3410
- *
3411
- * fin.Application.startManyManifests(applicationInfoArray)
3412
- * .then(() => {
3413
- * console.log('RVM has finished launching the application list.');
3414
- * })
3415
- * .catch((err) => {
3416
- * console.log(err);
3417
- * })
3418
- * ```
3419
- *
3420
- * @experimental
3421
- */
3422
- async startManyManifests(applications, opts) {
3423
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3424
- }
3425
- /**
3426
- * Asynchronously returns an Application object that represents the current application
3427
- *
3428
- * @example
3429
- *
3430
- * ```js
3431
- * async function isCurrentAppRunning () {
3432
- * const app = await fin.Application.getCurrent();
3433
- * return app.isRunning();
3434
- * }
3435
- *
3436
- * isCurrentAppRunning().then(running => {
3437
- * console.log(`Current app is running: ${running}`);
3438
- * }).catch(err => {
3439
- * console.error(err);
3440
- * });
3441
- *
3442
- * ```
3443
- */
3444
- getCurrent() {
3445
- this.wire.sendAction('get-current-application').catch((e) => {
3446
- // we do not want to expose this error, just continue if this analytics-only call fails
3447
- });
3448
- return this.wrap({ uuid: this.wire.me.uuid });
3449
- }
3450
- /**
3451
- * Synchronously returns an Application object that represents the current application
3452
- *
3453
- * @example
3454
- *
3455
- * ```js
3456
- * async function isCurrentAppRunning () {
3457
- * const app = fin.Application.getCurrentSync();
3458
- * return app.isRunning();
3459
- * }
3460
- *
3461
- * isCurrentAppRunning().then(running => {
3462
- * console.log(`Current app is running: ${running}`);
3463
- * }).catch(err => {
3464
- * console.error(err);
3465
- * });
3466
- *
3467
- * ```
3468
- */
3469
- getCurrentSync() {
3470
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3471
- // we do not want to expose this error, just continue if this analytics-only call fails
3472
- });
3473
- return this.wrapSync({ uuid: this.wire.me.uuid });
3474
- }
3475
- /**
3476
- * Retrieves application's manifest and returns a running instance of the application.
3477
- * @param manifestUrl - The URL of app's manifest.
3478
- * @param opts - Parameters that the RVM will use.
3479
- *
3480
- * @example
3481
- *
3482
- * ```js
3483
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3484
- *
3485
- * // For a local manifest file:
3486
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3487
- * ```
3488
- */
3489
- async startFromManifest(manifestUrl, opts) {
3490
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3491
- // we do not want to expose this error, just continue if this analytics-only call fails
3492
- });
3493
- const app = await this._createFromManifest(manifestUrl);
3494
- // @ts-expect-error using private method without warning.
3495
- await app._run(opts); // eslint-disable-line no-underscore-dangle
3496
- return app;
3497
- }
3498
- /**
3499
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3500
- * Retrieves application's manifest and returns a wrapped application.
3501
- * @param manifestUrl - The URL of app's manifest.
3502
- * @param callback - called if the method succeeds.
3503
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3504
- *
3505
- * @example
3506
- *
3507
- * ```js
3508
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3509
- * ```
3510
- * @ignore
3511
- */
3512
- createFromManifest(manifestUrl) {
3513
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3514
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3515
- // we do not want to expose this error, just continue if this analytics-only call fails
3516
- });
3517
- return this._createFromManifest(manifestUrl);
3518
- }
3519
- _createFromManifest(manifestUrl) {
3520
- return this.wire
3521
- .sendAction('get-application-manifest', { manifestUrl })
3522
- .then(({ payload }) => {
3523
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3524
- return this.wrap({ uuid });
3525
- })
3526
- .then((app) => {
3527
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3528
- return app;
3529
- });
3530
- }
3531
- }
3532
- Factory$7.ApplicationModule = ApplicationModule;
3533
- return Factory$7;
3534
- }
3535
-
3536
- var hasRequiredApplication;
3537
-
3538
- function requireApplication () {
3539
- if (hasRequiredApplication) return application;
3540
- hasRequiredApplication = 1;
3541
- (function (exports) {
3542
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3543
- if (k2 === undefined) k2 = k;
3544
- var desc = Object.getOwnPropertyDescriptor(m, k);
3545
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3546
- desc = { enumerable: true, get: function() { return m[k]; } };
3547
- }
3548
- Object.defineProperty(o, k2, desc);
3549
- }) : (function(o, m, k, k2) {
3550
- if (k2 === undefined) k2 = k;
3551
- o[k2] = m[k];
3552
- }));
3553
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3554
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3555
- };
3556
- Object.defineProperty(exports, "__esModule", { value: true });
3557
- /**
3558
- * Entry points for the OpenFin `Application` API (`fin.Application`).
3559
- *
3560
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3561
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3562
- *
3563
- * 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),
3564
- * both of these were documented on the same page.
3565
- *
3566
- * @packageDocumentation
3567
- */
3568
- __exportStar(requireFactory$1(), exports);
3569
- __exportStar(requireInstance$1(), exports);
3570
- } (application));
3571
- return application;
3572
- }
3549
+ __exportStar(Factory$7, exports);
3550
+ __exportStar(Instance$6, exports);
3551
+ } (application));
3573
3552
 
3574
3553
  var promisifySubscription$1 = {};
3575
3554
 
@@ -3613,7 +3592,7 @@ function requireInstance () {
3613
3592
  /* eslint-disable @typescript-eslint/no-unused-vars */
3614
3593
  /* eslint-disable no-console */
3615
3594
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3616
- const application_1 = requireApplication();
3595
+ const application_1 = application;
3617
3596
  const main_1 = main;
3618
3597
  const view_1 = requireView();
3619
3598
  const warnings_1 = warnings;
@@ -17210,7 +17189,7 @@ const events_1$3 = require$$0;
17210
17189
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17211
17190
  const index_1 = system;
17212
17191
  const index_2 = requireWindow();
17213
- const index_3 = requireApplication();
17192
+ const index_3 = application;
17214
17193
  const index_4 = interappbus;
17215
17194
  const index_5 = clipboard;
17216
17195
  const index_6 = externalApplication;
@@ -18024,7 +18003,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
18024
18003
  };
18025
18004
  }
18026
18005
  getAdapterVersionSync() {
18027
- return "43.100.102";
18006
+ return "43.100.104";
18028
18007
  }
18029
18008
  observeBounds(element, onChange) {
18030
18009
  throw new Error('Method not implemented.');