@openfin/remote-adapter 36.78.13 → 36.79.1

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.
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var backchannel = require('./backchannel-e240e597.js');
3
+ var require$$0 = require('events');
4
4
  var bridge = require('./bridge-ef11968f.js');
5
5
  var require$$3 = require('lodash');
6
6
  var crypto = require('crypto');
7
+ var backchannel = require('./backchannel.js');
7
8
  var constants = require('./constants.js');
8
9
 
9
10
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -209,7 +210,7 @@ var emitterMap = {};
209
210
 
210
211
  Object.defineProperty(emitterMap, "__esModule", { value: true });
211
212
  emitterMap.EmitterMap = void 0;
212
- const events_1$6 = backchannel.eventsExports;
213
+ const events_1$6 = require$$0;
213
214
  class EmitterMap {
214
215
  constructor() {
215
216
  this.storage = new Map();
@@ -589,11 +590,11 @@ const handleDeprecatedWarnings = (options) => {
589
590
  };
590
591
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
591
592
 
592
- var hasRequiredFactory$3;
593
+ var hasRequiredFactory$2;
593
594
 
594
- function requireFactory$3 () {
595
- if (hasRequiredFactory$3) return Factory$8;
596
- hasRequiredFactory$3 = 1;
595
+ function requireFactory$2 () {
596
+ if (hasRequiredFactory$2) return Factory$8;
597
+ hasRequiredFactory$2 = 1;
597
598
  Object.defineProperty(Factory$8, "__esModule", { value: true });
598
599
  Factory$8.ViewModule = void 0;
599
600
  const base_1 = base;
@@ -956,7 +957,7 @@ channelsExposer.ChannelsExposer = ChannelsExposer;
956
957
  };
957
958
  Object.defineProperty(exports, "__esModule", { value: true });
958
959
  __exportStar(channelsConsumer, exports);
959
- __exportStar(channelsExposer, exports);
960
+ __exportStar(channelsExposer, exports);
960
961
  } (openfinChannels));
961
962
 
962
963
  (function (exports) {
@@ -975,7 +976,7 @@ channelsExposer.ChannelsExposer = ChannelsExposer;
975
976
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
976
977
  };
977
978
  Object.defineProperty(exports, "__esModule", { value: true });
978
- __exportStar(openfinChannels, exports);
979
+ __exportStar(openfinChannels, exports);
979
980
  } (strategies));
980
981
 
981
982
  (function (exports) {
@@ -997,7 +998,7 @@ channelsExposer.ChannelsExposer = ChannelsExposer;
997
998
  __exportStar(apiConsumer, exports);
998
999
  __exportStar(apiExposer, exports);
999
1000
  __exportStar(strategies, exports);
1000
- __exportStar(decorators, exports);
1001
+ __exportStar(decorators, exports);
1001
1002
  } (apiExposer$1));
1002
1003
 
1003
1004
  var channelApiRelay = {};
@@ -1462,8 +1463,8 @@ var main = {};
1462
1463
 
1463
1464
  Object.defineProperty(main, "__esModule", { value: true });
1464
1465
  main.WebContents = void 0;
1465
- const base_1$k = base;
1466
- class WebContents extends base_1$k.EmitterBase {
1466
+ const base_1$m = base;
1467
+ class WebContents extends base_1$m.EmitterBase {
1467
1468
  /**
1468
1469
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
1469
1470
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -2541,1127 +2542,1106 @@ var Factory$6 = {};
2541
2542
 
2542
2543
  var Instance$5 = {};
2543
2544
 
2544
- var hasRequiredInstance$2;
2545
-
2546
- function requireInstance$2 () {
2547
- if (hasRequiredInstance$2) return Instance$5;
2548
- hasRequiredInstance$2 = 1;
2549
- Object.defineProperty(Instance$5, "__esModule", { value: true });
2550
- Instance$5.Application = void 0;
2551
- /* eslint-disable import/prefer-default-export */
2552
- const base_1 = base;
2553
- const window_1 = requireWindow();
2554
- const view_1 = requireView();
2555
- /**
2556
- * An object representing an application. Allows the developer to create,
2557
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2558
- */
2559
- class Application extends base_1.EmitterBase {
2560
- /**
2561
- * @internal
2562
- */
2563
- constructor(wire, identity) {
2564
- super(wire, 'application', identity.uuid);
2565
- this.identity = identity;
2566
- this.window = new window_1._Window(this.wire, {
2567
- uuid: this.identity.uuid,
2568
- name: this.identity.uuid
2569
- });
2570
- }
2571
- windowListFromIdentityList(identityList) {
2572
- const windowList = [];
2573
- identityList.forEach((identity) => {
2574
- windowList.push(new window_1._Window(this.wire, {
2575
- uuid: identity.uuid,
2576
- name: identity.name
2577
- }));
2578
- });
2579
- return windowList;
2580
- }
2581
- /**
2582
- * Determines if the application is currently running.
2583
- *
2584
- * @example
2585
- *
2586
- * ```js
2587
- * async function isAppRunning() {
2588
- * const app = await fin.Application.getCurrent();
2589
- * return await app.isRunning();
2590
- * }
2591
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2592
- * ```
2593
- */
2594
- isRunning() {
2595
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2596
- }
2597
- /**
2598
- * Closes the application and any child windows created by the application.
2599
- * Cleans the application from state so it is no longer found in getAllApplications.
2600
- * @param force Close will be prevented from closing when force is false and
2601
- * ‘close-requested’ has been subscribed to for application’s main window.
2602
- *
2603
- * @example
2604
- *
2605
- * ```js
2606
- * async function closeApp() {
2607
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2608
- * const app = await fin.Application.wrap({uuid: 'app2'});
2609
- * await app.quit();
2610
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2611
- *
2612
- * }
2613
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2614
- * ```
2615
- */
2616
- async quit(force = false) {
2617
- try {
2618
- await this._close(force);
2619
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
2620
- }
2621
- catch (error) {
2622
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2623
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2624
- throw error;
2625
- }
2626
- }
2627
- }
2628
- async _close(force = false) {
2629
- try {
2630
- await this.wire.sendAction('close-application', { force, ...this.identity });
2631
- }
2632
- catch (error) {
2633
- if (!error.message.includes('Remote connection has closed')) {
2634
- throw error;
2635
- }
2636
- }
2637
- }
2638
- /**
2639
- * @deprecated use Application.quit instead
2640
- * Closes the application and any child windows created by the application.
2641
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2642
- * @param callback - called if the method succeeds.
2643
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2644
- *
2645
- * @example
2646
- *
2647
- * ```js
2648
- * async function closeApp() {
2649
- * const app = await fin.Application.getCurrent();
2650
- * return await app.close();
2651
- * }
2652
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2653
- * ```
2654
- */
2655
- close(force = false) {
2656
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2657
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2658
- // we do not want to expose this error, just continue if this analytics-only call fails
2659
- });
2660
- return this._close(force);
2661
- }
2662
- /**
2663
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2664
- *
2665
- * @example
2666
- *
2667
- * ```js
2668
- * async function getChildWindows() {
2669
- * const app = await fin.Application.getCurrent();
2670
- * return await app.getChildWindows();
2671
- * }
2672
- *
2673
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2674
- * ```
2675
- */
2676
- getChildWindows() {
2677
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2678
- const identityList = [];
2679
- payload.data.forEach((winName) => {
2680
- identityList.push({ uuid: this.identity.uuid, name: winName });
2681
- });
2682
- return this.windowListFromIdentityList(identityList);
2683
- });
2684
- }
2685
- /**
2686
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2687
- * if the application was not created from a manifest.
2688
- *
2689
- * @example
2690
- *
2691
- * ```js
2692
- * async function getManifest() {
2693
- * const app = await fin.Application.getCurrent();
2694
- * return await app.getManifest();
2695
- * }
2696
- *
2697
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2698
- * ```
2699
- */
2700
- getManifest() {
2701
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2702
- }
2703
- /**
2704
- * Retrieves UUID of the application that launches this application. Invokes the error callback
2705
- * if the application was created from a manifest.
2706
- *
2707
- * @example
2708
- *
2709
- * ```js
2710
- * async function getParentUuid() {
2711
- * const app = await fin.Application.start({
2712
- * uuid: 'app-1',
2713
- * name: 'myApp',
2714
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2715
- * autoShow: true
2716
- * });
2717
- * return await app.getParentUuid();
2718
- * }
2719
- *
2720
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2721
- * ```
2722
- */
2723
- getParentUuid() {
2724
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2725
- }
2726
- /**
2727
- * Retrieves current application's shortcut configuration.
2728
- *
2729
- * @example
2730
- *
2731
- * ```js
2732
- * async function getShortcuts() {
2733
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
2734
- * return await app.getShortcuts();
2735
- * }
2736
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2737
- * ```
2738
- */
2739
- getShortcuts() {
2740
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2741
- }
2742
- /**
2743
- * Retrieves current application's views.
2744
- * @experimental
2745
- *
2746
- * @example
2747
- *
2748
- * ```js
2749
- * async function getViews() {
2750
- * const app = await fin.Application.getCurrent();
2751
- * return await app.getViews();
2752
- * }
2753
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
2754
- * ```
2755
- */
2756
- async getViews() {
2757
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2758
- return payload.data.map((id) => new view_1.View(this.wire, id));
2759
- }
2760
- /**
2761
- * Returns the current zoom level of the application.
2762
- *
2763
- * @example
2764
- *
2765
- * ```js
2766
- * async function getZoomLevel() {
2767
- * const app = await fin.Application.getCurrent();
2768
- * return await app.getZoomLevel();
2769
- * }
2770
- *
2771
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2772
- * ```
2773
- */
2774
- getZoomLevel() {
2775
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2776
- }
2777
- /**
2778
- * Returns an instance of the main Window of the application
2779
- *
2780
- * @example
2781
- *
2782
- * ```js
2783
- * async function getWindow() {
2784
- * const app = await fin.Application.start({
2785
- * uuid: 'app-1',
2786
- * name: 'myApp',
2787
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2788
- * autoShow: true
2789
- * });
2790
- * return await app.getWindow();
2791
- * }
2792
- *
2793
- * getWindow().then(win => {
2794
- * win.showAt(0, 400);
2795
- * win.flash();
2796
- * }).catch(err => console.log(err));
2797
- * ```
2798
- */
2799
- getWindow() {
2800
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2801
- // we do not want to expose this error, just continue if this analytics-only call fails
2802
- });
2803
- return Promise.resolve(this.window);
2804
- }
2805
- /**
2806
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2807
- * @param userName - username to be passed to the RVM.
2808
- * @param appName - app name to be passed to the RVM.
2809
- *
2810
- * @example
2811
- *
2812
- * ```js
2813
- * async function registerUser() {
2814
- * const app = await fin.Application.getCurrent();
2815
- * return await app.registerUser('user', 'myApp');
2816
- * }
2817
- *
2818
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2819
- * ```
2820
- */
2821
- registerUser(userName, appName) {
2822
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2823
- }
2824
- /**
2825
- * Removes the application’s icon from the tray.
2826
- *
2827
- * @example
2828
- *
2829
- * ```js
2830
- * async function removeTrayIcon() {
2831
- * const app = await fin.Application.getCurrent();
2832
- * return await app.removeTrayIcon();
2833
- * }
2834
- *
2835
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
2836
- * ```
2837
- */
2838
- removeTrayIcon() {
2839
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
2840
- }
2841
- /**
2842
- * Restarts the application.
2843
- *
2844
- * @example
2845
- *
2846
- * ```js
2847
- * async function restartApp() {
2848
- * const app = await fin.Application.getCurrent();
2849
- * return await app.restart();
2850
- * }
2851
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
2852
- * ```
2853
- */
2854
- restart() {
2855
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
2856
- }
2857
- /**
2858
- * DEPRECATED method to run the application.
2859
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
2860
- *
2861
- * @example
2862
- *
2863
- * ```js
2864
- * async function run() {
2865
- * const app = await fin.Application.create({
2866
- * name: 'myApp',
2867
- * uuid: 'app-1',
2868
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
2869
- * autoShow: true
2870
- * });
2871
- * await app.run();
2872
- * }
2873
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
2874
- * ```
2875
- *
2876
- * @ignore
2877
- */
2878
- run() {
2879
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2880
- this.wire.sendAction('application-run', this.identity).catch((e) => {
2881
- // we do not want to expose this error, just continue if this analytics-only call fails
2882
- });
2883
- return this._run();
2884
- }
2885
- _run(opts = {}) {
2886
- return this.wire
2887
- .sendAction('run-application', {
2888
- manifestUrl: this._manifestUrl,
2889
- opts,
2890
- ...this.identity
2891
- })
2892
- .then(() => undefined);
2893
- }
2894
- /**
2895
- * Instructs the RVM to schedule one restart of the application.
2896
- *
2897
- * @example
2898
- *
2899
- * ```js
2900
- * async function scheduleRestart() {
2901
- * const app = await fin.Application.getCurrent();
2902
- * return await app.scheduleRestart();
2903
- * }
2904
- *
2905
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
2906
- * ```
2907
- */
2908
- scheduleRestart() {
2909
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
2910
- }
2911
- /**
2912
- * Sends a message to the RVM to upload the application's logs. On success,
2913
- * an object containing logId is returned.
2914
- *
2915
- * @example
2916
- *
2917
- * ```js
2918
- * async function sendLog() {
2919
- * const app = await fin.Application.getCurrent();
2920
- * return await app.sendApplicationLog();
2921
- * }
2922
- *
2923
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
2924
- * ```
2925
- */
2926
- async sendApplicationLog() {
2927
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
2928
- return payload.data;
2929
- }
2930
- /**
2931
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
2932
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2933
- *
2934
- * Note: If the "name" property is omitted it defaults to "tasks".
2935
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
2936
- *
2937
- *
2938
- * @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).
2939
- *
2940
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
2941
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
2942
- *
2943
- * Note: If the "name" property is omitted it defaults to "tasks".
2944
- *
2945
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
2946
- * uuid or shortcut.name is changed.
2947
- *
2948
- * @example
2949
- *
2950
- * ```js
2951
- * const app = fin.Application.getCurrentSync();
2952
- * const appName = 'My App';
2953
- * const jumpListConfig = [ // array of JumpList categories
2954
- * {
2955
- * // has no name and no type so `type` is assumed to be "tasks"
2956
- * items: [ // array of JumpList items
2957
- * {
2958
- * type: 'task',
2959
- * title: `Launch ${appName}`,
2960
- * description: `Runs ${appName} with the default configuration`,
2961
- * deepLink: 'fins://path.to/app/manifest.json',
2962
- * iconPath: 'https://path.to/app/icon.ico',
2963
- * iconIndex: 0
2964
- * },
2965
- * { type: 'separator' },
2966
- * {
2967
- * type: 'task',
2968
- * title: `Restore ${appName}`,
2969
- * description: 'Restore to last configuration',
2970
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
2971
- * iconPath: 'https://path.to/app/icon.ico',
2972
- * iconIndex: 0
2973
- * },
2974
- * ]
2975
- * },
2976
- * {
2977
- * name: 'Tools',
2978
- * items: [ // array of JumpList items
2979
- * {
2980
- * type: 'task',
2981
- * title: 'Tool A',
2982
- * description: 'Runs Tool A',
2983
- * deepLink: 'fins://path.to/tool-a/manifest.json',
2984
- * iconPath: 'https://path.to/tool-a/icon.ico',
2985
- * iconIndex: 0
2986
- * },
2987
- * {
2988
- * type: 'task',
2989
- * title: 'Tool B',
2990
- * description: 'Runs Tool B',
2991
- * deepLink: 'fins://path.to/tool-b/manifest.json',
2992
- * iconPath: 'https://path.to/tool-b/icon.ico',
2993
- * iconIndex: 0
2994
- * }]
2995
- * }
2996
- * ];
2997
- *
2998
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
2999
- * ```
3000
- *
3001
- * To handle deeplink args:
3002
- * ```js
3003
- * function handleUseLastConfiguration() {
3004
- * // this handler is called when the app is being launched
3005
- * app.on('run-requested', event => {
3006
- * if(event.userAppConfigArgs['use-last-configuration']) {
3007
- * // your logic here
3008
- * }
3009
- * });
3010
- * // this handler is called when the app was already running when the launch was requested
3011
- * fin.desktop.main(function(args) {
3012
- * if(args && args['use-last-configuration']) {
3013
- * // your logic here
3014
- * }
3015
- * });
3016
- * }
3017
- * ```
3018
- */
3019
- async setJumpList(jumpListCategories) {
3020
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
3021
- }
3022
- /**
3023
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
3024
- * @param icon Image URL or base64 encoded string to be used as the icon
3025
- *
3026
- * @example
3027
- *
3028
- * ```js
3029
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3030
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
3031
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
3032
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
3033
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
3034
- *
3035
- * async function setTrayIcon(icon) {
3036
- * const app = await fin.Application.getCurrent();
3037
- * return await app.setTrayIcon(icon);
3038
- * }
3039
- *
3040
- * // use image url to set tray icon
3041
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3042
- *
3043
- * // use base64 encoded string to set tray icon
3044
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3045
- *
3046
- * // use a dataURL to set tray icon
3047
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3048
- * ```
3049
- */
3050
- setTrayIcon(icon) {
3051
- return this.wire
3052
- .sendAction('set-tray-icon', {
3053
- enabledIcon: icon,
3054
- ...this.identity
3055
- })
3056
- .then(() => undefined);
3057
- }
3058
- /**
3059
- * Sets new application's shortcut configuration. Windows only.
3060
- * @param config New application's shortcut configuration.
3061
- *
3062
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3063
- * to be able to change shortcut states.
3064
- *
3065
- * @example
3066
- *
3067
- * ```js
3068
- * async function setShortcuts(config) {
3069
- * const app = await fin.Application.getCurrent();
3070
- * return app.setShortcuts(config);
3071
- * }
3072
- *
3073
- * setShortcuts({
3074
- * desktop: true,
3075
- * startMenu: false,
3076
- * systemStartup: true
3077
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3078
- * ```
3079
- */
3080
- setShortcuts(config) {
3081
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3082
- }
3083
- /**
3084
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3085
- * @param queryString The new query string for this app's shortcuts.
3086
- *
3087
- * @example
3088
- *
3089
- * ```js
3090
- * const newQueryArgs = 'arg=true&arg2=false';
3091
- * const app = await fin.Application.getCurrent();
3092
- * try {
3093
- * await app.setShortcutQueryParams(newQueryArgs);
3094
- * } catch(err) {
3095
- * console.error(err)
3096
- * }
3097
- * ```
3098
- */
3099
- async setShortcutQueryParams(queryString) {
3100
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3101
- }
3102
- /**
3103
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3104
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
3105
- * @param level The zoom level
3106
- *
3107
- * @example
3108
- *
3109
- * ```js
3110
- * async function setZoomLevel(number) {
3111
- * const app = await fin.Application.getCurrent();
3112
- * return await app.setZoomLevel(number);
3113
- * }
3114
- *
3115
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3116
- * ```
3117
- */
3118
- setZoomLevel(level) {
3119
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3120
- }
3121
- /**
3122
- * Sets a username to correlate with App Log Management.
3123
- * @param username Username to correlate with App's Log.
3124
- *
3125
- * @example
3126
- *
3127
- * ```js
3128
- * async function setAppLogUser() {
3129
- * const app = await fin.Application.getCurrent();
3130
- * return await app.setAppLogUsername('username');
3131
- * }
3132
- *
3133
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3134
- *
3135
- * ```
3136
- */
3137
- async setAppLogUsername(username) {
3138
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3139
- }
3140
- /**
3141
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3142
- * @remarks The only information currently returned is the position and dimensions.
3143
- *
3144
- * @example
3145
- *
3146
- * ```js
3147
- * async function getTrayIconInfo() {
3148
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3149
- * return await app.getTrayIconInfo();
3150
- * }
3151
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3152
- * ```
3153
- */
3154
- getTrayIconInfo() {
3155
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3156
- }
3157
- /**
3158
- * Checks if the application has an associated tray icon.
3159
- *
3160
- * @example
3161
- *
3162
- * ```js
3163
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3164
- * const hasTrayIcon = await app.hasTrayIcon();
3165
- * console.log(hasTrayIcon);
3166
- * ```
3167
- */
3168
- hasTrayIcon() {
3169
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3170
- }
3171
- /**
3172
- * Closes the application by terminating its process.
3173
- *
3174
- * @example
3175
- *
3176
- * ```js
3177
- * async function terminateApp() {
3178
- * const app = await fin.Application.getCurrent();
3179
- * return await app.terminate();
3180
- * }
3181
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3182
- * ```
3183
- */
3184
- terminate() {
3185
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3186
- }
3187
- /**
3188
- * Waits for a hanging application. This method can be called in response to an application
3189
- * "not-responding" to allow the application to continue and to generate another "not-responding"
3190
- * message after a certain period of time.
3191
- *
3192
- * @ignore
3193
- */
3194
- wait() {
3195
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3196
- }
3197
- /**
3198
- * Retrieves information about the application.
3199
- *
3200
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3201
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3202
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3203
- *
3204
- * @example
3205
- *
3206
- * ```js
3207
- * async function getInfo() {
3208
- * const app = await fin.Application.getCurrent();
3209
- * return await app.getInfo();
3210
- * }
3211
- *
3212
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3213
- * ```
3214
- */
3215
- getInfo() {
3216
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3217
- }
3218
- /**
3219
- * Retrieves all process information for entities (windows and views) associated with an application.
3220
- *
3221
- * @example
3222
- * ```js
3223
- * const app = await fin.Application.getCurrent();
3224
- * const processInfo = await app.getProcessInfo();
3225
- * ```
3226
- * @experimental
3227
- */
3228
- async getProcessInfo() {
3229
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3230
- return data;
3231
- }
3232
- /**
3233
- * Sets file auto download location. It's only allowed in the same application.
3234
- *
3235
- * Note: This method is restricted by default and must be enabled via
3236
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3237
- * @param downloadLocation file auto download location
3238
- *
3239
- * @throws if setting file auto download location on different applications.
3240
- * @example
3241
- *
3242
- * ```js
3243
- * const downloadLocation = 'C:\\dev\\temp';
3244
- * const app = await fin.Application.getCurrent();
3245
- * try {
3246
- * await app.setFileDownloadLocation(downloadLocation);
3247
- * console.log('File download location is set');
3248
- * } catch(err) {
3249
- * console.error(err)
3250
- * }
3251
- * ```
3252
- */
3253
- async setFileDownloadLocation(downloadLocation) {
3254
- const { name } = this.wire.me;
3255
- const entityIdentity = { uuid: this.identity.uuid, name };
3256
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3257
- }
3258
- /**
3259
- * 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.
3260
- *
3261
- * Note: This method is restricted by default and must be enabled via
3262
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3263
- *
3264
- * @throws if getting file auto download location on different applications.
3265
- * @example
3266
- *
3267
- * ```js
3268
- * const app = await fin.Application.getCurrent();
3269
- * const fileDownloadDir = await app.getFileDownloadLocation();
3270
- * ```
3271
- */
3272
- async getFileDownloadLocation() {
3273
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3274
- return data;
3275
- }
3276
- /**
3277
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3278
- * @param options
3279
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3280
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3281
- * of all possible data shapes for the entire menu, and the click handler should process
3282
- * these with a "reducer" pattern.
3283
- * @throws if the application has no tray icon set
3284
- * @throws if the system tray is currently hidden
3285
- * @example
3286
- *
3287
- * ```js
3288
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3289
- * const app = fin.Application.getCurrentSync();
3290
- *
3291
- * await app.setTrayIcon(iconUrl);
3292
- *
3293
- * const template = [
3294
- * {
3295
- * label: 'Menu Item 1',
3296
- * data: 'hello from item 1'
3297
- * },
3298
- * { type: 'separator' },
3299
- * {
3300
- * label: 'Menu Item 2',
3301
- * type: 'checkbox',
3302
- * checked: true,
3303
- * data: 'The user clicked the checkbox'
3304
- * },
3305
- * {
3306
- * label: 'see more',
3307
- * enabled: false,
3308
- * submenu: [
3309
- * { label: 'submenu 1', data: 'hello from submenu' }
3310
- * ]
3311
- * }
3312
- * ];
3313
- *
3314
- * app.addListener('tray-icon-clicked', (event) => {
3315
- * // right-click
3316
- * if (event.button === 2) {
3317
- * app.showTrayIconPopupMenu({ template }).then(r => {
3318
- * if (r.result === 'closed') {
3319
- * console.log('nothing happened');
3320
- * } else {
3321
- * console.log(r.data);
3322
- * }
3323
- * });
3324
- * }
3325
- * });
3326
- * ```
3327
- */
3328
- async showTrayIconPopupMenu(options) {
3329
- const { name } = this.wire.me;
3330
- const entityIdentity = { uuid: this.identity.uuid, name };
3331
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3332
- return payload.data;
3333
- }
3334
- /**
3335
- * CLoses the tray icon menu.
3336
- *
3337
- * @throws if the application has no tray icon set
3338
- * @example
3339
- *
3340
- * ```js
3341
- * const app = fin.Application.getCurrentSync();
3342
- *
3343
- * await app.closeTrayIconPopupMenu();
3344
- * ```
3345
- */
3346
- async closeTrayIconPopupMenu() {
3347
- const { name } = this.wire.me;
3348
- const entityIdentity = { uuid: this.identity.uuid, name };
3349
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3350
- }
3351
- }
3352
- Instance$5.Application = Application;
3353
- return Instance$5;
2545
+ Object.defineProperty(Instance$5, "__esModule", { value: true });
2546
+ Instance$5.Application = void 0;
2547
+ /* eslint-disable import/prefer-default-export */
2548
+ const base_1$l = base;
2549
+ const window_1$1 = requireWindow();
2550
+ const view_1 = requireView();
2551
+ /**
2552
+ * An object representing an application. Allows the developer to create,
2553
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2554
+ */
2555
+ class Application extends base_1$l.EmitterBase {
2556
+ /**
2557
+ * @internal
2558
+ */
2559
+ constructor(wire, identity) {
2560
+ super(wire, 'application', identity.uuid);
2561
+ this.identity = identity;
2562
+ this.window = new window_1$1._Window(this.wire, {
2563
+ uuid: this.identity.uuid,
2564
+ name: this.identity.uuid
2565
+ });
2566
+ }
2567
+ windowListFromIdentityList(identityList) {
2568
+ const windowList = [];
2569
+ identityList.forEach((identity) => {
2570
+ windowList.push(new window_1$1._Window(this.wire, {
2571
+ uuid: identity.uuid,
2572
+ name: identity.name
2573
+ }));
2574
+ });
2575
+ return windowList;
2576
+ }
2577
+ /**
2578
+ * Determines if the application is currently running.
2579
+ *
2580
+ * @example
2581
+ *
2582
+ * ```js
2583
+ * async function isAppRunning() {
2584
+ * const app = await fin.Application.getCurrent();
2585
+ * return await app.isRunning();
2586
+ * }
2587
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2588
+ * ```
2589
+ */
2590
+ isRunning() {
2591
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2592
+ }
2593
+ /**
2594
+ * Closes the application and any child windows created by the application.
2595
+ * Cleans the application from state so it is no longer found in getAllApplications.
2596
+ * @param force Close will be prevented from closing when force is false and
2597
+ * ‘close-requested’ has been subscribed to for application’s main window.
2598
+ *
2599
+ * @example
2600
+ *
2601
+ * ```js
2602
+ * async function closeApp() {
2603
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2604
+ * const app = await fin.Application.wrap({uuid: 'app2'});
2605
+ * await app.quit();
2606
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2607
+ *
2608
+ * }
2609
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2610
+ * ```
2611
+ */
2612
+ async quit(force = false) {
2613
+ try {
2614
+ await this._close(force);
2615
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
2616
+ }
2617
+ catch (error) {
2618
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2619
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2620
+ throw error;
2621
+ }
2622
+ }
2623
+ }
2624
+ async _close(force = false) {
2625
+ try {
2626
+ await this.wire.sendAction('close-application', { force, ...this.identity });
2627
+ }
2628
+ catch (error) {
2629
+ if (!error.message.includes('Remote connection has closed')) {
2630
+ throw error;
2631
+ }
2632
+ }
2633
+ }
2634
+ /**
2635
+ * @deprecated use Application.quit instead
2636
+ * Closes the application and any child windows created by the application.
2637
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2638
+ * @param callback - called if the method succeeds.
2639
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2640
+ *
2641
+ * @example
2642
+ *
2643
+ * ```js
2644
+ * async function closeApp() {
2645
+ * const app = await fin.Application.getCurrent();
2646
+ * return await app.close();
2647
+ * }
2648
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2649
+ * ```
2650
+ */
2651
+ close(force = false) {
2652
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2653
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
2654
+ // we do not want to expose this error, just continue if this analytics-only call fails
2655
+ });
2656
+ return this._close(force);
2657
+ }
2658
+ /**
2659
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2660
+ *
2661
+ * @example
2662
+ *
2663
+ * ```js
2664
+ * async function getChildWindows() {
2665
+ * const app = await fin.Application.getCurrent();
2666
+ * return await app.getChildWindows();
2667
+ * }
2668
+ *
2669
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2670
+ * ```
2671
+ */
2672
+ getChildWindows() {
2673
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2674
+ const identityList = [];
2675
+ payload.data.forEach((winName) => {
2676
+ identityList.push({ uuid: this.identity.uuid, name: winName });
2677
+ });
2678
+ return this.windowListFromIdentityList(identityList);
2679
+ });
2680
+ }
2681
+ /**
2682
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2683
+ * if the application was not created from a manifest.
2684
+ *
2685
+ * @example
2686
+ *
2687
+ * ```js
2688
+ * async function getManifest() {
2689
+ * const app = await fin.Application.getCurrent();
2690
+ * return await app.getManifest();
2691
+ * }
2692
+ *
2693
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2694
+ * ```
2695
+ */
2696
+ getManifest() {
2697
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2698
+ }
2699
+ /**
2700
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
2701
+ * if the application was created from a manifest.
2702
+ *
2703
+ * @example
2704
+ *
2705
+ * ```js
2706
+ * async function getParentUuid() {
2707
+ * const app = await fin.Application.start({
2708
+ * uuid: 'app-1',
2709
+ * name: 'myApp',
2710
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2711
+ * autoShow: true
2712
+ * });
2713
+ * return await app.getParentUuid();
2714
+ * }
2715
+ *
2716
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2717
+ * ```
2718
+ */
2719
+ getParentUuid() {
2720
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2721
+ }
2722
+ /**
2723
+ * Retrieves current application's shortcut configuration.
2724
+ *
2725
+ * @example
2726
+ *
2727
+ * ```js
2728
+ * async function getShortcuts() {
2729
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
2730
+ * return await app.getShortcuts();
2731
+ * }
2732
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2733
+ * ```
2734
+ */
2735
+ getShortcuts() {
2736
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2737
+ }
2738
+ /**
2739
+ * Retrieves current application's views.
2740
+ * @experimental
2741
+ *
2742
+ * @example
2743
+ *
2744
+ * ```js
2745
+ * async function getViews() {
2746
+ * const app = await fin.Application.getCurrent();
2747
+ * return await app.getViews();
2748
+ * }
2749
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
2750
+ * ```
2751
+ */
2752
+ async getViews() {
2753
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2754
+ return payload.data.map((id) => new view_1.View(this.wire, id));
2755
+ }
2756
+ /**
2757
+ * Returns the current zoom level of the application.
2758
+ *
2759
+ * @example
2760
+ *
2761
+ * ```js
2762
+ * async function getZoomLevel() {
2763
+ * const app = await fin.Application.getCurrent();
2764
+ * return await app.getZoomLevel();
2765
+ * }
2766
+ *
2767
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2768
+ * ```
2769
+ */
2770
+ getZoomLevel() {
2771
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2772
+ }
2773
+ /**
2774
+ * Returns an instance of the main Window of the application
2775
+ *
2776
+ * @example
2777
+ *
2778
+ * ```js
2779
+ * async function getWindow() {
2780
+ * const app = await fin.Application.start({
2781
+ * uuid: 'app-1',
2782
+ * name: 'myApp',
2783
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2784
+ * autoShow: true
2785
+ * });
2786
+ * return await app.getWindow();
2787
+ * }
2788
+ *
2789
+ * getWindow().then(win => {
2790
+ * win.showAt(0, 400);
2791
+ * win.flash();
2792
+ * }).catch(err => console.log(err));
2793
+ * ```
2794
+ */
2795
+ getWindow() {
2796
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2797
+ // we do not want to expose this error, just continue if this analytics-only call fails
2798
+ });
2799
+ return Promise.resolve(this.window);
2800
+ }
2801
+ /**
2802
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2803
+ * @param userName - username to be passed to the RVM.
2804
+ * @param appName - app name to be passed to the RVM.
2805
+ *
2806
+ * @example
2807
+ *
2808
+ * ```js
2809
+ * async function registerUser() {
2810
+ * const app = await fin.Application.getCurrent();
2811
+ * return await app.registerUser('user', 'myApp');
2812
+ * }
2813
+ *
2814
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2815
+ * ```
2816
+ */
2817
+ registerUser(userName, appName) {
2818
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2819
+ }
2820
+ /**
2821
+ * Removes the application’s icon from the tray.
2822
+ *
2823
+ * @example
2824
+ *
2825
+ * ```js
2826
+ * async function removeTrayIcon() {
2827
+ * const app = await fin.Application.getCurrent();
2828
+ * return await app.removeTrayIcon();
2829
+ * }
2830
+ *
2831
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
2832
+ * ```
2833
+ */
2834
+ removeTrayIcon() {
2835
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
2836
+ }
2837
+ /**
2838
+ * Restarts the application.
2839
+ *
2840
+ * @example
2841
+ *
2842
+ * ```js
2843
+ * async function restartApp() {
2844
+ * const app = await fin.Application.getCurrent();
2845
+ * return await app.restart();
2846
+ * }
2847
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
2848
+ * ```
2849
+ */
2850
+ restart() {
2851
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
2852
+ }
2853
+ /**
2854
+ * DEPRECATED method to run the application.
2855
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
2856
+ *
2857
+ * @example
2858
+ *
2859
+ * ```js
2860
+ * async function run() {
2861
+ * const app = await fin.Application.create({
2862
+ * name: 'myApp',
2863
+ * uuid: 'app-1',
2864
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
2865
+ * autoShow: true
2866
+ * });
2867
+ * await app.run();
2868
+ * }
2869
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
2870
+ * ```
2871
+ *
2872
+ * @ignore
2873
+ */
2874
+ run() {
2875
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2876
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
2877
+ // we do not want to expose this error, just continue if this analytics-only call fails
2878
+ });
2879
+ return this._run();
2880
+ }
2881
+ _run(opts = {}) {
2882
+ return this.wire
2883
+ .sendAction('run-application', {
2884
+ manifestUrl: this._manifestUrl,
2885
+ opts,
2886
+ ...this.identity
2887
+ })
2888
+ .then(() => undefined);
2889
+ }
2890
+ /**
2891
+ * Instructs the RVM to schedule one restart of the application.
2892
+ *
2893
+ * @example
2894
+ *
2895
+ * ```js
2896
+ * async function scheduleRestart() {
2897
+ * const app = await fin.Application.getCurrent();
2898
+ * return await app.scheduleRestart();
2899
+ * }
2900
+ *
2901
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
2902
+ * ```
2903
+ */
2904
+ scheduleRestart() {
2905
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
2906
+ }
2907
+ /**
2908
+ * Sends a message to the RVM to upload the application's logs. On success,
2909
+ * an object containing logId is returned.
2910
+ *
2911
+ * @example
2912
+ *
2913
+ * ```js
2914
+ * async function sendLog() {
2915
+ * const app = await fin.Application.getCurrent();
2916
+ * return await app.sendApplicationLog();
2917
+ * }
2918
+ *
2919
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
2920
+ * ```
2921
+ */
2922
+ async sendApplicationLog() {
2923
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
2924
+ return payload.data;
2925
+ }
2926
+ /**
2927
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
2928
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
2929
+ *
2930
+ * Note: If the "name" property is omitted it defaults to "tasks".
2931
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
2932
+ *
2933
+ *
2934
+ * @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).
2935
+ *
2936
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
2937
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
2938
+ *
2939
+ * Note: If the "name" property is omitted it defaults to "tasks".
2940
+ *
2941
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
2942
+ * uuid or shortcut.name is changed.
2943
+ *
2944
+ * @example
2945
+ *
2946
+ * ```js
2947
+ * const app = fin.Application.getCurrentSync();
2948
+ * const appName = 'My App';
2949
+ * const jumpListConfig = [ // array of JumpList categories
2950
+ * {
2951
+ * // has no name and no type so `type` is assumed to be "tasks"
2952
+ * items: [ // array of JumpList items
2953
+ * {
2954
+ * type: 'task',
2955
+ * title: `Launch ${appName}`,
2956
+ * description: `Runs ${appName} with the default configuration`,
2957
+ * deepLink: 'fins://path.to/app/manifest.json',
2958
+ * iconPath: 'https://path.to/app/icon.ico',
2959
+ * iconIndex: 0
2960
+ * },
2961
+ * { type: 'separator' },
2962
+ * {
2963
+ * type: 'task',
2964
+ * title: `Restore ${appName}`,
2965
+ * description: 'Restore to last configuration',
2966
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
2967
+ * iconPath: 'https://path.to/app/icon.ico',
2968
+ * iconIndex: 0
2969
+ * },
2970
+ * ]
2971
+ * },
2972
+ * {
2973
+ * name: 'Tools',
2974
+ * items: [ // array of JumpList items
2975
+ * {
2976
+ * type: 'task',
2977
+ * title: 'Tool A',
2978
+ * description: 'Runs Tool A',
2979
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
2980
+ * iconPath: 'https://path.to/tool-a/icon.ico',
2981
+ * iconIndex: 0
2982
+ * },
2983
+ * {
2984
+ * type: 'task',
2985
+ * title: 'Tool B',
2986
+ * description: 'Runs Tool B',
2987
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
2988
+ * iconPath: 'https://path.to/tool-b/icon.ico',
2989
+ * iconIndex: 0
2990
+ * }]
2991
+ * }
2992
+ * ];
2993
+ *
2994
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
2995
+ * ```
2996
+ *
2997
+ * To handle deeplink args:
2998
+ * ```js
2999
+ * function handleUseLastConfiguration() {
3000
+ * // this handler is called when the app is being launched
3001
+ * app.on('run-requested', event => {
3002
+ * if(event.userAppConfigArgs['use-last-configuration']) {
3003
+ * // your logic here
3004
+ * }
3005
+ * });
3006
+ * // this handler is called when the app was already running when the launch was requested
3007
+ * fin.desktop.main(function(args) {
3008
+ * if(args && args['use-last-configuration']) {
3009
+ * // your logic here
3010
+ * }
3011
+ * });
3012
+ * }
3013
+ * ```
3014
+ */
3015
+ async setJumpList(jumpListCategories) {
3016
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
3017
+ }
3018
+ /**
3019
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
3020
+ * @param icon Image URL or base64 encoded string to be used as the icon
3021
+ *
3022
+ * @example
3023
+ *
3024
+ * ```js
3025
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3026
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
3027
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
3028
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
3029
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
3030
+ *
3031
+ * async function setTrayIcon(icon) {
3032
+ * const app = await fin.Application.getCurrent();
3033
+ * return await app.setTrayIcon(icon);
3034
+ * }
3035
+ *
3036
+ * // use image url to set tray icon
3037
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3038
+ *
3039
+ * // use base64 encoded string to set tray icon
3040
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3041
+ *
3042
+ * // use a dataURL to set tray icon
3043
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3044
+ * ```
3045
+ */
3046
+ setTrayIcon(icon) {
3047
+ return this.wire
3048
+ .sendAction('set-tray-icon', {
3049
+ enabledIcon: icon,
3050
+ ...this.identity
3051
+ })
3052
+ .then(() => undefined);
3053
+ }
3054
+ /**
3055
+ * Sets new application's shortcut configuration. Windows only.
3056
+ * @param config New application's shortcut configuration.
3057
+ *
3058
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3059
+ * to be able to change shortcut states.
3060
+ *
3061
+ * @example
3062
+ *
3063
+ * ```js
3064
+ * async function setShortcuts(config) {
3065
+ * const app = await fin.Application.getCurrent();
3066
+ * return app.setShortcuts(config);
3067
+ * }
3068
+ *
3069
+ * setShortcuts({
3070
+ * desktop: true,
3071
+ * startMenu: false,
3072
+ * systemStartup: true
3073
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3074
+ * ```
3075
+ */
3076
+ setShortcuts(config) {
3077
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3078
+ }
3079
+ /**
3080
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3081
+ * @param queryString The new query string for this app's shortcuts.
3082
+ *
3083
+ * @example
3084
+ *
3085
+ * ```js
3086
+ * const newQueryArgs = 'arg=true&arg2=false';
3087
+ * const app = await fin.Application.getCurrent();
3088
+ * try {
3089
+ * await app.setShortcutQueryParams(newQueryArgs);
3090
+ * } catch(err) {
3091
+ * console.error(err)
3092
+ * }
3093
+ * ```
3094
+ */
3095
+ async setShortcutQueryParams(queryString) {
3096
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3097
+ }
3098
+ /**
3099
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3100
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
3101
+ * @param level The zoom level
3102
+ *
3103
+ * @example
3104
+ *
3105
+ * ```js
3106
+ * async function setZoomLevel(number) {
3107
+ * const app = await fin.Application.getCurrent();
3108
+ * return await app.setZoomLevel(number);
3109
+ * }
3110
+ *
3111
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3112
+ * ```
3113
+ */
3114
+ setZoomLevel(level) {
3115
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3116
+ }
3117
+ /**
3118
+ * Sets a username to correlate with App Log Management.
3119
+ * @param username Username to correlate with App's Log.
3120
+ *
3121
+ * @example
3122
+ *
3123
+ * ```js
3124
+ * async function setAppLogUser() {
3125
+ * const app = await fin.Application.getCurrent();
3126
+ * return await app.setAppLogUsername('username');
3127
+ * }
3128
+ *
3129
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3130
+ *
3131
+ * ```
3132
+ */
3133
+ async setAppLogUsername(username) {
3134
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3135
+ }
3136
+ /**
3137
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3138
+ * @remarks The only information currently returned is the position and dimensions.
3139
+ *
3140
+ * @example
3141
+ *
3142
+ * ```js
3143
+ * async function getTrayIconInfo() {
3144
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3145
+ * return await app.getTrayIconInfo();
3146
+ * }
3147
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3148
+ * ```
3149
+ */
3150
+ getTrayIconInfo() {
3151
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3152
+ }
3153
+ /**
3154
+ * Checks if the application has an associated tray icon.
3155
+ *
3156
+ * @example
3157
+ *
3158
+ * ```js
3159
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3160
+ * const hasTrayIcon = await app.hasTrayIcon();
3161
+ * console.log(hasTrayIcon);
3162
+ * ```
3163
+ */
3164
+ hasTrayIcon() {
3165
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3166
+ }
3167
+ /**
3168
+ * Closes the application by terminating its process.
3169
+ *
3170
+ * @example
3171
+ *
3172
+ * ```js
3173
+ * async function terminateApp() {
3174
+ * const app = await fin.Application.getCurrent();
3175
+ * return await app.terminate();
3176
+ * }
3177
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3178
+ * ```
3179
+ */
3180
+ terminate() {
3181
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3182
+ }
3183
+ /**
3184
+ * Waits for a hanging application. This method can be called in response to an application
3185
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
3186
+ * message after a certain period of time.
3187
+ *
3188
+ * @ignore
3189
+ */
3190
+ wait() {
3191
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3192
+ }
3193
+ /**
3194
+ * Retrieves information about the application.
3195
+ *
3196
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3197
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3198
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3199
+ *
3200
+ * @example
3201
+ *
3202
+ * ```js
3203
+ * async function getInfo() {
3204
+ * const app = await fin.Application.getCurrent();
3205
+ * return await app.getInfo();
3206
+ * }
3207
+ *
3208
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3209
+ * ```
3210
+ */
3211
+ getInfo() {
3212
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3213
+ }
3214
+ /**
3215
+ * Retrieves all process information for entities (windows and views) associated with an application.
3216
+ *
3217
+ * @example
3218
+ * ```js
3219
+ * const app = await fin.Application.getCurrent();
3220
+ * const processInfo = await app.getProcessInfo();
3221
+ * ```
3222
+ * @experimental
3223
+ */
3224
+ async getProcessInfo() {
3225
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3226
+ return data;
3227
+ }
3228
+ /**
3229
+ * Sets file auto download location. It's only allowed in the same application.
3230
+ *
3231
+ * Note: This method is restricted by default and must be enabled via
3232
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3233
+ * @param downloadLocation file auto download location
3234
+ *
3235
+ * @throws if setting file auto download location on different applications.
3236
+ * @example
3237
+ *
3238
+ * ```js
3239
+ * const downloadLocation = 'C:\\dev\\temp';
3240
+ * const app = await fin.Application.getCurrent();
3241
+ * try {
3242
+ * await app.setFileDownloadLocation(downloadLocation);
3243
+ * console.log('File download location is set');
3244
+ * } catch(err) {
3245
+ * console.error(err)
3246
+ * }
3247
+ * ```
3248
+ */
3249
+ async setFileDownloadLocation(downloadLocation) {
3250
+ const { name } = this.wire.me;
3251
+ const entityIdentity = { uuid: this.identity.uuid, name };
3252
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3253
+ }
3254
+ /**
3255
+ * 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.
3256
+ *
3257
+ * Note: This method is restricted by default and must be enabled via
3258
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3259
+ *
3260
+ * @throws if getting file auto download location on different applications.
3261
+ * @example
3262
+ *
3263
+ * ```js
3264
+ * const app = await fin.Application.getCurrent();
3265
+ * const fileDownloadDir = await app.getFileDownloadLocation();
3266
+ * ```
3267
+ */
3268
+ async getFileDownloadLocation() {
3269
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3270
+ return data;
3271
+ }
3272
+ /**
3273
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3274
+ * @param options
3275
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3276
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3277
+ * of all possible data shapes for the entire menu, and the click handler should process
3278
+ * these with a "reducer" pattern.
3279
+ * @throws if the application has no tray icon set
3280
+ * @throws if the system tray is currently hidden
3281
+ * @example
3282
+ *
3283
+ * ```js
3284
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3285
+ * const app = fin.Application.getCurrentSync();
3286
+ *
3287
+ * await app.setTrayIcon(iconUrl);
3288
+ *
3289
+ * const template = [
3290
+ * {
3291
+ * label: 'Menu Item 1',
3292
+ * data: 'hello from item 1'
3293
+ * },
3294
+ * { type: 'separator' },
3295
+ * {
3296
+ * label: 'Menu Item 2',
3297
+ * type: 'checkbox',
3298
+ * checked: true,
3299
+ * data: 'The user clicked the checkbox'
3300
+ * },
3301
+ * {
3302
+ * label: 'see more',
3303
+ * enabled: false,
3304
+ * submenu: [
3305
+ * { label: 'submenu 1', data: 'hello from submenu' }
3306
+ * ]
3307
+ * }
3308
+ * ];
3309
+ *
3310
+ * app.addListener('tray-icon-clicked', (event) => {
3311
+ * // right-click
3312
+ * if (event.button === 2) {
3313
+ * app.showTrayIconPopupMenu({ template }).then(r => {
3314
+ * if (r.result === 'closed') {
3315
+ * console.log('nothing happened');
3316
+ * } else {
3317
+ * console.log(r.data);
3318
+ * }
3319
+ * });
3320
+ * }
3321
+ * });
3322
+ * ```
3323
+ */
3324
+ async showTrayIconPopupMenu(options) {
3325
+ const { name } = this.wire.me;
3326
+ const entityIdentity = { uuid: this.identity.uuid, name };
3327
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3328
+ return payload.data;
3329
+ }
3330
+ /**
3331
+ * CLoses the tray icon menu.
3332
+ *
3333
+ * @throws if the application has no tray icon set
3334
+ * @example
3335
+ *
3336
+ * ```js
3337
+ * const app = fin.Application.getCurrentSync();
3338
+ *
3339
+ * await app.closeTrayIconPopupMenu();
3340
+ * ```
3341
+ */
3342
+ async closeTrayIconPopupMenu() {
3343
+ const { name } = this.wire.me;
3344
+ const entityIdentity = { uuid: this.identity.uuid, name };
3345
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3346
+ }
3347
+ }
3348
+ Instance$5.Application = Application;
3349
+
3350
+ Object.defineProperty(Factory$6, "__esModule", { value: true });
3351
+ Factory$6.ApplicationModule = void 0;
3352
+ const base_1$k = base;
3353
+ const validate_1$4 = validate;
3354
+ const Instance_1$5 = Instance$5;
3355
+ /**
3356
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3357
+ */
3358
+ class ApplicationModule extends base_1$k.Base {
3359
+ /**
3360
+ * Asynchronously returns an Application object that represents an existing application.
3361
+ *
3362
+ * @example
3363
+ *
3364
+ * ```js
3365
+ * fin.Application.wrap({ uuid: 'testapp' })
3366
+ * .then(app => app.isRunning())
3367
+ * .then(running => console.log('Application is running: ' + running))
3368
+ * .catch(err => console.log(err));
3369
+ * ```
3370
+ *
3371
+ */
3372
+ async wrap(identity) {
3373
+ this.wire.sendAction('wrap-application').catch((e) => {
3374
+ // we do not want to expose this error, just continue if this analytics-only call fails
3375
+ });
3376
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3377
+ if (errorMsg) {
3378
+ throw new Error(errorMsg);
3379
+ }
3380
+ return new Instance_1$5.Application(this.wire, identity);
3381
+ }
3382
+ /**
3383
+ * Synchronously returns an Application object that represents an existing application.
3384
+ *
3385
+ * @example
3386
+ *
3387
+ * ```js
3388
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3389
+ * await app.close();
3390
+ * ```
3391
+ *
3392
+ */
3393
+ wrapSync(identity) {
3394
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
3395
+ // we do not want to expose this error, just continue if this analytics-only call fails
3396
+ });
3397
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3398
+ if (errorMsg) {
3399
+ throw new Error(errorMsg);
3400
+ }
3401
+ return new Instance_1$5.Application(this.wire, identity);
3402
+ }
3403
+ async _create(appOptions) {
3404
+ // set defaults:
3405
+ if (appOptions.waitForPageLoad === undefined) {
3406
+ appOptions.waitForPageLoad = false;
3407
+ }
3408
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3409
+ appOptions.autoShow = true;
3410
+ }
3411
+ await this.wire.sendAction('create-application', appOptions);
3412
+ return this.wrap({ uuid: appOptions.uuid });
3413
+ }
3414
+ /**
3415
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3416
+ *
3417
+ * @example
3418
+ *
3419
+ * ```js
3420
+ * async function createApp() {
3421
+ * const app = await fin.Application.create({
3422
+ * name: 'myApp',
3423
+ * uuid: 'app-3',
3424
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3425
+ * autoShow: true
3426
+ * });
3427
+ * await app.run();
3428
+ * }
3429
+ *
3430
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3431
+ * ```
3432
+ *
3433
+ * @ignore
3434
+ */
3435
+ create(appOptions) {
3436
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3437
+ this.wire.sendAction('application-create').catch((e) => {
3438
+ // we do not want to expose this error, just continue if this analytics-only call fails
3439
+ });
3440
+ return this._create(appOptions);
3441
+ }
3442
+ /**
3443
+ * Creates and starts a new Application.
3444
+ *
3445
+ * @example
3446
+ *
3447
+ * ```js
3448
+ * async function start() {
3449
+ * return fin.Application.start({
3450
+ * name: 'app-1',
3451
+ * uuid: 'app-1',
3452
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3453
+ * autoShow: true
3454
+ * });
3455
+ * }
3456
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3457
+ * ```
3458
+ *
3459
+ */
3460
+ async start(appOptions) {
3461
+ this.wire.sendAction('start-application').catch((e) => {
3462
+ // we do not want to expose this error, just continue if this analytics-only call fails
3463
+ });
3464
+ const app = await this._create(appOptions);
3465
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3466
+ return app;
3467
+ }
3468
+ /**
3469
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3470
+ * Returns once the RVM is finished attempting to launch the applications.
3471
+ * @param opts - Parameters that the RVM will use.
3472
+ *
3473
+ * @example
3474
+ *
3475
+ * ```js
3476
+ *
3477
+ * const applicationInfoArray = [
3478
+ * {
3479
+ * "uuid": 'App-1',
3480
+ * "manifestUrl": 'http://localhost:5555/app1.json',
3481
+ * },
3482
+ * {
3483
+ * "uuid": 'App-2',
3484
+ * "manifestUrl": 'http://localhost:5555/app2.json',
3485
+ * },
3486
+ * {
3487
+ * "uuid": 'App-3',
3488
+ * "manifestUrl": 'http://localhost:5555/app3.json',
3489
+ * }
3490
+ * ]
3491
+ *
3492
+ * fin.Application.startManyManifests(applicationInfoArray)
3493
+ * .then(() => {
3494
+ * console.log('RVM has finished launching the application list.');
3495
+ * })
3496
+ * .catch((err) => {
3497
+ * console.log(err);
3498
+ * })
3499
+ * ```
3500
+ *
3501
+ * @experimental
3502
+ */
3503
+ async startManyManifests(applications, opts) {
3504
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3505
+ }
3506
+ /**
3507
+ * Asynchronously returns an Application object that represents the current application
3508
+ *
3509
+ * @example
3510
+ *
3511
+ * ```js
3512
+ * async function isCurrentAppRunning () {
3513
+ * const app = await fin.Application.getCurrent();
3514
+ * return app.isRunning();
3515
+ * }
3516
+ *
3517
+ * isCurrentAppRunning().then(running => {
3518
+ * console.log(`Current app is running: ${running}`);
3519
+ * }).catch(err => {
3520
+ * console.error(err);
3521
+ * });
3522
+ *
3523
+ * ```
3524
+ */
3525
+ getCurrent() {
3526
+ this.wire.sendAction('get-current-application').catch((e) => {
3527
+ // we do not want to expose this error, just continue if this analytics-only call fails
3528
+ });
3529
+ return this.wrap({ uuid: this.wire.me.uuid });
3530
+ }
3531
+ /**
3532
+ * Synchronously returns an Application object that represents the current application
3533
+ *
3534
+ * @example
3535
+ *
3536
+ * ```js
3537
+ * async function isCurrentAppRunning () {
3538
+ * const app = fin.Application.getCurrentSync();
3539
+ * return app.isRunning();
3540
+ * }
3541
+ *
3542
+ * isCurrentAppRunning().then(running => {
3543
+ * console.log(`Current app is running: ${running}`);
3544
+ * }).catch(err => {
3545
+ * console.error(err);
3546
+ * });
3547
+ *
3548
+ * ```
3549
+ */
3550
+ getCurrentSync() {
3551
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
3552
+ // we do not want to expose this error, just continue if this analytics-only call fails
3553
+ });
3554
+ return this.wrapSync({ uuid: this.wire.me.uuid });
3555
+ }
3556
+ /**
3557
+ * Retrieves application's manifest and returns a running instance of the application.
3558
+ * @param manifestUrl - The URL of app's manifest.
3559
+ * @param opts - Parameters that the RVM will use.
3560
+ *
3561
+ * @example
3562
+ *
3563
+ * ```js
3564
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3565
+ *
3566
+ * // For a local manifest file:
3567
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3568
+ * ```
3569
+ */
3570
+ async startFromManifest(manifestUrl, opts) {
3571
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
3572
+ // we do not want to expose this error, just continue if this analytics-only call fails
3573
+ });
3574
+ const app = await this._createFromManifest(manifestUrl);
3575
+ // @ts-expect-error using private method without warning.
3576
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
3577
+ return app;
3578
+ }
3579
+ /**
3580
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3581
+ * Retrieves application's manifest and returns a wrapped application.
3582
+ * @param manifestUrl - The URL of app's manifest.
3583
+ * @param callback - called if the method succeeds.
3584
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3585
+ *
3586
+ * @example
3587
+ *
3588
+ * ```js
3589
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3590
+ * ```
3591
+ * @ignore
3592
+ */
3593
+ createFromManifest(manifestUrl) {
3594
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3595
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
3596
+ // we do not want to expose this error, just continue if this analytics-only call fails
3597
+ });
3598
+ return this._createFromManifest(manifestUrl);
3599
+ }
3600
+ _createFromManifest(manifestUrl) {
3601
+ return this.wire
3602
+ .sendAction('get-application-manifest', { manifestUrl })
3603
+ .then(({ payload }) => {
3604
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3605
+ return this.wrap({ uuid });
3606
+ })
3607
+ .then((app) => {
3608
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3609
+ return app;
3610
+ });
3611
+ }
3354
3612
  }
3613
+ Factory$6.ApplicationModule = ApplicationModule;
3355
3614
 
3356
- var hasRequiredFactory$2;
3357
-
3358
- function requireFactory$2 () {
3359
- if (hasRequiredFactory$2) return Factory$6;
3360
- hasRequiredFactory$2 = 1;
3361
- Object.defineProperty(Factory$6, "__esModule", { value: true });
3362
- Factory$6.ApplicationModule = void 0;
3363
- const base_1 = base;
3364
- const validate_1 = validate;
3365
- const Instance_1 = requireInstance$2();
3615
+ (function (exports) {
3616
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3617
+ if (k2 === undefined) k2 = k;
3618
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3619
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3620
+ desc = { enumerable: true, get: function() { return m[k]; } };
3621
+ }
3622
+ Object.defineProperty(o, k2, desc);
3623
+ }) : (function(o, m, k, k2) {
3624
+ if (k2 === undefined) k2 = k;
3625
+ o[k2] = m[k];
3626
+ }));
3627
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3628
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3629
+ };
3630
+ Object.defineProperty(exports, "__esModule", { value: true });
3366
3631
  /**
3367
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3632
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
3633
+ *
3634
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3635
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3636
+ *
3637
+ * 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),
3638
+ * both of these were documented on the same page.
3639
+ *
3640
+ * @packageDocumentation
3368
3641
  */
3369
- class ApplicationModule extends base_1.Base {
3370
- /**
3371
- * Asynchronously returns an Application object that represents an existing application.
3372
- *
3373
- * @example
3374
- *
3375
- * ```js
3376
- * fin.Application.wrap({ uuid: 'testapp' })
3377
- * .then(app => app.isRunning())
3378
- * .then(running => console.log('Application is running: ' + running))
3379
- * .catch(err => console.log(err));
3380
- * ```
3381
- *
3382
- */
3383
- async wrap(identity) {
3384
- this.wire.sendAction('wrap-application').catch((e) => {
3385
- // we do not want to expose this error, just continue if this analytics-only call fails
3386
- });
3387
- const errorMsg = (0, validate_1.validateIdentity)(identity);
3388
- if (errorMsg) {
3389
- throw new Error(errorMsg);
3390
- }
3391
- return new Instance_1.Application(this.wire, identity);
3392
- }
3393
- /**
3394
- * Synchronously returns an Application object that represents an existing application.
3395
- *
3396
- * @example
3397
- *
3398
- * ```js
3399
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3400
- * await app.close();
3401
- * ```
3402
- *
3403
- */
3404
- wrapSync(identity) {
3405
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3406
- // we do not want to expose this error, just continue if this analytics-only call fails
3407
- });
3408
- const errorMsg = (0, validate_1.validateIdentity)(identity);
3409
- if (errorMsg) {
3410
- throw new Error(errorMsg);
3411
- }
3412
- return new Instance_1.Application(this.wire, identity);
3413
- }
3414
- async _create(appOptions) {
3415
- // set defaults:
3416
- if (appOptions.waitForPageLoad === undefined) {
3417
- appOptions.waitForPageLoad = false;
3418
- }
3419
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3420
- appOptions.autoShow = true;
3421
- }
3422
- await this.wire.sendAction('create-application', appOptions);
3423
- return this.wrap({ uuid: appOptions.uuid });
3424
- }
3425
- /**
3426
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3427
- *
3428
- * @example
3429
- *
3430
- * ```js
3431
- * async function createApp() {
3432
- * const app = await fin.Application.create({
3433
- * name: 'myApp',
3434
- * uuid: 'app-3',
3435
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3436
- * autoShow: true
3437
- * });
3438
- * await app.run();
3439
- * }
3440
- *
3441
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3442
- * ```
3443
- *
3444
- * @ignore
3445
- */
3446
- create(appOptions) {
3447
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3448
- this.wire.sendAction('application-create').catch((e) => {
3449
- // we do not want to expose this error, just continue if this analytics-only call fails
3450
- });
3451
- return this._create(appOptions);
3452
- }
3453
- /**
3454
- * Creates and starts a new Application.
3455
- *
3456
- * @example
3457
- *
3458
- * ```js
3459
- * async function start() {
3460
- * return fin.Application.start({
3461
- * name: 'app-1',
3462
- * uuid: 'app-1',
3463
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3464
- * autoShow: true
3465
- * });
3466
- * }
3467
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3468
- * ```
3469
- *
3470
- */
3471
- async start(appOptions) {
3472
- this.wire.sendAction('start-application').catch((e) => {
3473
- // we do not want to expose this error, just continue if this analytics-only call fails
3474
- });
3475
- const app = await this._create(appOptions);
3476
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3477
- return app;
3478
- }
3479
- /**
3480
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3481
- * Returns once the RVM is finished attempting to launch the applications.
3482
- * @param opts - Parameters that the RVM will use.
3483
- *
3484
- * @example
3485
- *
3486
- * ```js
3487
- *
3488
- * const applicationInfoArray = [
3489
- * {
3490
- * "uuid": 'App-1',
3491
- * "manifestUrl": 'http://localhost:5555/app1.json',
3492
- * },
3493
- * {
3494
- * "uuid": 'App-2',
3495
- * "manifestUrl": 'http://localhost:5555/app2.json',
3496
- * },
3497
- * {
3498
- * "uuid": 'App-3',
3499
- * "manifestUrl": 'http://localhost:5555/app3.json',
3500
- * }
3501
- * ]
3502
- *
3503
- * fin.Application.startManyManifests(applicationInfoArray)
3504
- * .then(() => {
3505
- * console.log('RVM has finished launching the application list.');
3506
- * })
3507
- * .catch((err) => {
3508
- * console.log(err);
3509
- * })
3510
- * ```
3511
- *
3512
- * @experimental
3513
- */
3514
- async startManyManifests(applications, opts) {
3515
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3516
- }
3517
- /**
3518
- * Asynchronously returns an Application object that represents the current application
3519
- *
3520
- * @example
3521
- *
3522
- * ```js
3523
- * async function isCurrentAppRunning () {
3524
- * const app = await fin.Application.getCurrent();
3525
- * return app.isRunning();
3526
- * }
3527
- *
3528
- * isCurrentAppRunning().then(running => {
3529
- * console.log(`Current app is running: ${running}`);
3530
- * }).catch(err => {
3531
- * console.error(err);
3532
- * });
3533
- *
3534
- * ```
3535
- */
3536
- getCurrent() {
3537
- this.wire.sendAction('get-current-application').catch((e) => {
3538
- // we do not want to expose this error, just continue if this analytics-only call fails
3539
- });
3540
- return this.wrap({ uuid: this.wire.me.uuid });
3541
- }
3542
- /**
3543
- * Synchronously returns an Application object that represents the current application
3544
- *
3545
- * @example
3546
- *
3547
- * ```js
3548
- * async function isCurrentAppRunning () {
3549
- * const app = fin.Application.getCurrentSync();
3550
- * return app.isRunning();
3551
- * }
3552
- *
3553
- * isCurrentAppRunning().then(running => {
3554
- * console.log(`Current app is running: ${running}`);
3555
- * }).catch(err => {
3556
- * console.error(err);
3557
- * });
3558
- *
3559
- * ```
3560
- */
3561
- getCurrentSync() {
3562
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3563
- // we do not want to expose this error, just continue if this analytics-only call fails
3564
- });
3565
- return this.wrapSync({ uuid: this.wire.me.uuid });
3566
- }
3567
- /**
3568
- * Retrieves application's manifest and returns a running instance of the application.
3569
- * @param manifestUrl - The URL of app's manifest.
3570
- * @param opts - Parameters that the RVM will use.
3571
- *
3572
- * @example
3573
- *
3574
- * ```js
3575
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3576
- *
3577
- * // For a local manifest file:
3578
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3579
- * ```
3580
- */
3581
- async startFromManifest(manifestUrl, opts) {
3582
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3583
- // we do not want to expose this error, just continue if this analytics-only call fails
3584
- });
3585
- const app = await this._createFromManifest(manifestUrl);
3586
- // @ts-expect-error using private method without warning.
3587
- await app._run(opts); // eslint-disable-line no-underscore-dangle
3588
- return app;
3589
- }
3590
- /**
3591
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3592
- * Retrieves application's manifest and returns a wrapped application.
3593
- * @param manifestUrl - The URL of app's manifest.
3594
- * @param callback - called if the method succeeds.
3595
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3596
- *
3597
- * @example
3598
- *
3599
- * ```js
3600
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3601
- * ```
3602
- * @ignore
3603
- */
3604
- createFromManifest(manifestUrl) {
3605
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3606
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3607
- // we do not want to expose this error, just continue if this analytics-only call fails
3608
- });
3609
- return this._createFromManifest(manifestUrl);
3610
- }
3611
- _createFromManifest(manifestUrl) {
3612
- return this.wire
3613
- .sendAction('get-application-manifest', { manifestUrl })
3614
- .then(({ payload }) => {
3615
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3616
- return this.wrap({ uuid });
3617
- })
3618
- .then((app) => {
3619
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3620
- return app;
3621
- });
3622
- }
3623
- }
3624
- Factory$6.ApplicationModule = ApplicationModule;
3625
- return Factory$6;
3626
- }
3627
-
3628
- var hasRequiredApplication;
3629
-
3630
- function requireApplication () {
3631
- if (hasRequiredApplication) return application;
3632
- hasRequiredApplication = 1;
3633
- (function (exports) {
3634
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3635
- if (k2 === undefined) k2 = k;
3636
- var desc = Object.getOwnPropertyDescriptor(m, k);
3637
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3638
- desc = { enumerable: true, get: function() { return m[k]; } };
3639
- }
3640
- Object.defineProperty(o, k2, desc);
3641
- }) : (function(o, m, k, k2) {
3642
- if (k2 === undefined) k2 = k;
3643
- o[k2] = m[k];
3644
- }));
3645
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3646
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3647
- };
3648
- Object.defineProperty(exports, "__esModule", { value: true });
3649
- /**
3650
- * Entry points for the OpenFin `Application` API (`fin.Application`).
3651
- *
3652
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3653
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3654
- *
3655
- * 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),
3656
- * both of these were documented on the same page.
3657
- *
3658
- * @packageDocumentation
3659
- */
3660
- __exportStar(requireFactory$2(), exports);
3661
- __exportStar(requireInstance$2(), exports);
3642
+ __exportStar(Factory$6, exports);
3643
+ __exportStar(Instance$5, exports);
3662
3644
  } (application));
3663
- return application;
3664
- }
3665
3645
 
3666
3646
  var hasRequiredInstance$1;
3667
3647
 
@@ -3674,7 +3654,7 @@ function requireInstance$1 () {
3674
3654
  /* eslint-disable @typescript-eslint/no-unused-vars */
3675
3655
  /* eslint-disable no-console */
3676
3656
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3677
- const application_1 = requireApplication();
3657
+ const application_1 = application;
3678
3658
  const main_1 = main;
3679
3659
  const view_1 = requireView();
3680
3660
  const warnings_1 = warnings;
@@ -4807,7 +4787,7 @@ function requireInstance$1 () {
4807
4787
  * })
4808
4788
  * ```
4809
4789
  *
4810
- * Overriding the built in context menu (ote that this can be done per element or document wide):
4790
+ * Overriding the built in context menu (note: that this can be done per element or document wide):
4811
4791
  * ```js
4812
4792
  * document.addEventListener('contextmenu', e => {
4813
4793
  * e.preventDefault();
@@ -5122,8 +5102,8 @@ function requireWindow () {
5122
5102
  * @packageDocumentation
5123
5103
  */
5124
5104
  __exportStar(requireFactory$1(), exports);
5125
- __exportStar(requireInstance$1(), exports);
5126
- } (window$1));
5105
+ __exportStar(requireInstance$1(), exports);
5106
+ } (window$1));
5127
5107
  return window$1;
5128
5108
  }
5129
5109
 
@@ -5726,9 +5706,9 @@ function requireView () {
5726
5706
  *
5727
5707
  * @packageDocumentation
5728
5708
  */
5729
- __exportStar(requireFactory$3(), exports);
5730
- __exportStar(requireInstance(), exports);
5731
- } (view));
5709
+ __exportStar(requireFactory$2(), exports);
5710
+ __exportStar(requireInstance(), exports);
5711
+ } (view));
5732
5712
  return view;
5733
5713
  }
5734
5714
 
@@ -5920,7 +5900,7 @@ Factory$5._FrameModule = _FrameModule;
5920
5900
  };
5921
5901
  Object.defineProperty(exports, "__esModule", { value: true });
5922
5902
  __exportStar(Factory$5, exports);
5923
- __exportStar(Instance$4, exports);
5903
+ __exportStar(Instance$4, exports);
5924
5904
  } (frame));
5925
5905
 
5926
5906
  var externalApplication = {};
@@ -6046,7 +6026,7 @@ Factory$4.ExternalApplicationModule = ExternalApplicationModule;
6046
6026
  * @packageDocumentation
6047
6027
  */
6048
6028
  __exportStar(Factory$4, exports);
6049
- __exportStar(Instance$3, exports);
6029
+ __exportStar(Instance$3, exports);
6050
6030
  } (externalApplication));
6051
6031
 
6052
6032
  (function (exports) {
@@ -6182,7 +6162,7 @@ Factory$4.ExternalApplicationModule = ExternalApplicationModule;
6182
6162
  };
6183
6163
  }
6184
6164
  }
6185
- exports.getMe = getMe;
6165
+ exports.getMe = getMe;
6186
6166
  } (me));
6187
6167
 
6188
6168
  var errors = {};
@@ -6214,7 +6194,7 @@ var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateF
6214
6194
  var _Transport_wire, _Transport_fin;
6215
6195
  Object.defineProperty(transport, "__esModule", { value: true });
6216
6196
  var Transport_1 = transport.Transport = void 0;
6217
- const events_1$5 = backchannel.eventsExports;
6197
+ const events_1$5 = require$$0;
6218
6198
  const wire_1 = wire;
6219
6199
  const transport_errors_1$2 = transportErrors;
6220
6200
  const eventAggregator_1 = eventAggregator;
@@ -6431,7 +6411,7 @@ _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
6431
6411
  var websocket = {};
6432
6412
 
6433
6413
  Object.defineProperty(websocket, "__esModule", { value: true });
6434
- const events_1$4 = backchannel.eventsExports;
6414
+ const events_1$4 = require$$0;
6435
6415
  const transport_errors_1$1 = transportErrors;
6436
6416
  const messageReceiver_1 = bridge.messageReceiver;
6437
6417
  /* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
@@ -6508,7 +6488,7 @@ system.System = void 0;
6508
6488
  const base_1$f = base;
6509
6489
  const transport_errors_1 = transportErrors;
6510
6490
  const window_1 = requireWindow();
6511
- const events_1$3 = backchannel.eventsExports;
6491
+ const events_1$3 = require$$0;
6512
6492
  /**
6513
6493
  * An object representing the core of OpenFin Runtime. Allows the developer
6514
6494
  * to perform system-level actions, such as accessing logs, viewing processes,
@@ -10209,7 +10189,7 @@ var _Channel_connectionManager, _Channel_internalEmitter, _Channel_readyToConnec
10209
10189
  Object.defineProperty(channel$1, "__esModule", { value: true });
10210
10190
  channel$1.Channel = void 0;
10211
10191
  /* eslint-disable no-console */
10212
- const events_1$2 = backchannel.eventsExports;
10192
+ const events_1$2 = require$$0;
10213
10193
  const lazy_1$1 = lazy;
10214
10194
  const base_1$b = base;
10215
10195
  const client_1 = client;
@@ -10536,7 +10516,7 @@ interappbus.InterAppPayload = interappbus.InterApplicationBus = void 0;
10536
10516
  *
10537
10517
  * @packageDocumentation
10538
10518
  */
10539
- const events_1$1 = backchannel.eventsExports;
10519
+ const events_1$1 = require$$0;
10540
10520
  const base_1$a = base;
10541
10521
  const ref_counter_1 = refCounter;
10542
10522
  const index_1$2 = channel$1;
@@ -12325,7 +12305,7 @@ var __classPrivateFieldSet$3 = (commonjsGlobal && commonjsGlobal.__classPrivateF
12325
12305
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
12326
12306
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12327
12307
  };
12328
- var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_getBackCompatLayoutManager, _LayoutModule_getSafeLayoutManager;
12308
+ var _LayoutModule_instances, _LayoutModule_layoutInitializationAttempted, _LayoutModule_layoutManager, _LayoutModule_waitForBackCompatLayoutManager, _LayoutModule_getSafeLayoutManager;
12329
12309
  Object.defineProperty(Factory$2, "__esModule", { value: true });
12330
12310
  Factory$2.LayoutModule = void 0;
12331
12311
  const base_1$5 = base;
@@ -12389,12 +12369,17 @@ class LayoutModule extends base_1$5.Base {
12389
12369
  }
12390
12370
  __classPrivateFieldSet$3(this, _LayoutModule_layoutInitializationAttempted, true, "f");
12391
12371
  __classPrivateFieldSet$3(this, _LayoutModule_layoutManager, await this.wire.environment.initLayoutManager(this.fin, this.wire, options), "f");
12372
+ // in single-layout case, we return the undocumented layoutManager type (deprecate with CORE-1081)
12373
+ let backCompatLayoutPromise;
12374
+ if (!options.layoutManagerOverride) {
12375
+ backCompatLayoutPromise = __classPrivateFieldGet$3(this, _LayoutModule_waitForBackCompatLayoutManager, "f").call(this, this.fin);
12376
+ }
12392
12377
  // apply the initial snapshot which in turn will call fin.Platform.Layout.create()
12393
12378
  const platformClient = await this.fin.Platform.getCurrentSync().getClient();
12394
12379
  const snapshot = await platformClient.dispatch('get-initial-layout-snapshot');
12395
12380
  await __classPrivateFieldGet$3(this, _LayoutModule_layoutManager, "f").applyLayoutSnapshot(snapshot);
12396
- if (!options.layoutManagerOverride) {
12397
- return __classPrivateFieldGet$3(this, _LayoutModule_getBackCompatLayoutManager, "f").call(this, this.fin);
12381
+ if (backCompatLayoutPromise) {
12382
+ return backCompatLayoutPromise;
12398
12383
  }
12399
12384
  // warn user if they do not call create() in the next 30 seconds
12400
12385
  setTimeout(() => {
@@ -12405,7 +12390,8 @@ class LayoutModule extends base_1$5.Base {
12405
12390
  }, 30000);
12406
12391
  return this.wrapSync(this.fin.me.identity);
12407
12392
  };
12408
- _LayoutModule_getBackCompatLayoutManager.set(this, async (fin) => {
12393
+ // deprecate with CORE-1081
12394
+ _LayoutModule_waitForBackCompatLayoutManager.set(this, async (fin) => {
12409
12395
  let layoutManager;
12410
12396
  let resolve;
12411
12397
  const layoutResolved = new Promise((r) => {
@@ -12530,7 +12516,7 @@ class LayoutModule extends base_1$5.Base {
12530
12516
  }
12531
12517
  }
12532
12518
  Factory$2.LayoutModule = LayoutModule;
12533
- _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getBackCompatLayoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
12519
+ _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_waitForBackCompatLayoutManager = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
12534
12520
  if (!__classPrivateFieldGet$3(this, _LayoutModule_layoutManager, "f")) {
12535
12521
  throw new Error(`You must call init before using the API ${method}`);
12536
12522
  }
@@ -12566,7 +12552,7 @@ _LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layou
12566
12552
  };
12567
12553
  Object.defineProperty(exports, "__esModule", { value: true });
12568
12554
  __exportStar(Factory$2, exports);
12569
- __exportStar(Instance$1, exports);
12555
+ __exportStar(Instance$1, exports);
12570
12556
  } (layout));
12571
12557
 
12572
12558
  Object.defineProperty(Factory$3, "__esModule", { value: true });
@@ -12831,7 +12817,7 @@ Factory$3.PlatformModule = PlatformModule;
12831
12817
  * @packageDocumentation
12832
12818
  */
12833
12819
  __exportStar(Factory$3, exports);
12834
- __exportStar(Instance$2, exports);
12820
+ __exportStar(Instance$2, exports);
12835
12821
  } (platform));
12836
12822
 
12837
12823
  var interop = {};
@@ -13069,7 +13055,7 @@ var utils$1 = {};
13069
13055
  }
13070
13056
  };
13071
13057
  };
13072
- exports.wrapIntentHandler = wrapIntentHandler;
13058
+ exports.wrapIntentHandler = wrapIntentHandler;
13073
13059
  } (utils$1));
13074
13060
 
13075
13061
  var PrivateChannelProvider = {};
@@ -15320,29 +15306,33 @@ function requireOverrideCheck () {
15320
15306
  if (hasRequiredOverrideCheck) return overrideCheck;
15321
15307
  hasRequiredOverrideCheck = 1;
15322
15308
  Object.defineProperty(overrideCheck, "__esModule", { value: true });
15323
- overrideCheck.overrideCheck = overrideCheck.getDefaultViewFdc3VersionFromAppInfo = void 0;
15309
+ overrideCheck.overrideCheck = overrideCheck.checkFDC32Overrides = overrideCheck.getDefaultViewFdc3VersionFromAppInfo = void 0;
15324
15310
  const InteropBroker_1 = requireInteropBroker();
15325
15311
  function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
15326
15312
  const setVersion = manifest.platform?.defaultViewOptions?.fdc3InteropApi ?? initialOptions.defaultViewOptions?.fdc3InteropApi;
15327
15313
  return ['1.2', '2.0'].includes(setVersion ?? '') ? setVersion : undefined;
15328
15314
  }
15329
15315
  overrideCheck.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
15330
- // TODO: Unit test this
15316
+ function checkFDC32Overrides(overriddenBroker) {
15317
+ // These are the APIs that must be overridden for FDC3 2.0 compliance
15318
+ const mustOverrideAPIs = [
15319
+ 'fdc3HandleFindInstances',
15320
+ 'handleInfoForIntent',
15321
+ 'handleInfoForIntentsByContext',
15322
+ 'fdc3HandleGetAppMetadata',
15323
+ 'fdc3HandleGetInfo',
15324
+ 'fdc3HandleOpen',
15325
+ 'handleFiredIntent',
15326
+ 'handleFiredIntentForContext'
15327
+ ];
15328
+ return mustOverrideAPIs.filter((api) => {
15329
+ return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
15330
+ });
15331
+ }
15332
+ overrideCheck.checkFDC32Overrides = checkFDC32Overrides;
15331
15333
  function overrideCheck$1(overriddenBroker, fdc3InteropApi) {
15332
15334
  if (fdc3InteropApi && fdc3InteropApi === '2.0') {
15333
- const mustOverrideAPIs = [
15334
- 'fdc3HandleFindInstances',
15335
- 'handleInfoForIntent',
15336
- 'handleInfoForIntentsByContext',
15337
- 'fdc3HandleGetAppMetadata',
15338
- 'fdc3HandleGetInfo',
15339
- 'fdc3HandleOpen',
15340
- 'handleFiredIntent',
15341
- 'handleFiredIntentForContext'
15342
- ];
15343
- const notOverridden = mustOverrideAPIs.filter((api) => {
15344
- return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
15345
- });
15335
+ const notOverridden = checkFDC32Overrides(overriddenBroker);
15346
15336
  if (notOverridden.length > 0) {
15347
15337
  console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
15348
15338
  }
@@ -15487,8 +15477,8 @@ function requireInterop () {
15487
15477
  Object.defineProperty(exports, "__esModule", { value: true });
15488
15478
  __exportStar(requireFactory(), exports);
15489
15479
  __exportStar(InteropClient$1, exports);
15490
- __exportStar(requireInteropBroker(), exports);
15491
- } (interop));
15480
+ __exportStar(requireInteropBroker(), exports);
15481
+ } (interop));
15492
15482
  return interop;
15493
15483
  }
15494
15484
 
@@ -15773,16 +15763,16 @@ Factory.SnapshotSourceModule = SnapshotSourceModule;
15773
15763
  };
15774
15764
  Object.defineProperty(exports, "__esModule", { value: true });
15775
15765
  __exportStar(Factory, exports);
15776
- __exportStar(Instance, exports);
15766
+ __exportStar(Instance, exports);
15777
15767
  } (snapshotSource));
15778
15768
 
15779
15769
  Object.defineProperty(fin, "__esModule", { value: true });
15780
15770
  var Fin_1 = fin.Fin = void 0;
15781
- const events_1 = backchannel.eventsExports;
15771
+ const events_1 = require$$0;
15782
15772
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
15783
15773
  const index_1 = system;
15784
15774
  const index_2 = requireWindow();
15785
- const index_3 = requireApplication();
15775
+ const index_3 = application;
15786
15776
  const index_4 = interappbus;
15787
15777
  const index_5 = clipboard;
15788
15778
  const index_6 = externalApplication;