@openfin/node-adapter 42.100.5 → 42.100.7

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