@openfin/core 44.100.30 → 44.100.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/out/stub.js +1137 -1158
  2. package/package.json +1 -1
package/out/stub.js CHANGED
@@ -819,11 +819,11 @@ const handleDeprecatedWarnings = (options) => {
819
819
  };
820
820
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
821
821
 
822
- var hasRequiredFactory$2;
822
+ var hasRequiredFactory$1;
823
823
 
824
- function requireFactory$2 () {
825
- if (hasRequiredFactory$2) return Factory$6;
826
- hasRequiredFactory$2 = 1;
824
+ function requireFactory$1 () {
825
+ if (hasRequiredFactory$1) return Factory$6;
826
+ hasRequiredFactory$1 = 1;
827
827
  Object.defineProperty(Factory$6, "__esModule", { value: true });
828
828
  Factory$6.ViewModule = void 0;
829
829
  const base_1 = base;
@@ -1038,8 +1038,8 @@ var main = {};
1038
1038
 
1039
1039
  Object.defineProperty(main, "__esModule", { value: true });
1040
1040
  main.WebContents = void 0;
1041
- const base_1$n = base;
1042
- class WebContents extends base_1$n.EmitterBase {
1041
+ const base_1$p = base;
1042
+ class WebContents extends base_1$p.EmitterBase {
1043
1043
  /**
1044
1044
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
1045
1045
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -2120,11 +2120,11 @@ class WebContents extends base_1$n.EmitterBase {
2120
2120
  }
2121
2121
  main.WebContents = WebContents;
2122
2122
 
2123
- var hasRequiredInstance$2;
2123
+ var hasRequiredInstance$1;
2124
2124
 
2125
- function requireInstance$2 () {
2126
- if (hasRequiredInstance$2) return Instance$5;
2127
- hasRequiredInstance$2 = 1;
2125
+ function requireInstance$1 () {
2126
+ if (hasRequiredInstance$1) return Instance$5;
2127
+ hasRequiredInstance$1 = 1;
2128
2128
  var _View_providerChannelClient;
2129
2129
  Object.defineProperty(Instance$5, "__esModule", { value: true });
2130
2130
  Instance$5.View = void 0;
@@ -2704,1160 +2704,1139 @@ function requireView () {
2704
2704
  *
2705
2705
  * @packageDocumentation
2706
2706
  */
2707
- __exportStar(requireFactory$2(), exports);
2708
- __exportStar(requireInstance$2(), exports);
2707
+ __exportStar(requireFactory$1(), exports);
2708
+ __exportStar(requireInstance$1(), exports);
2709
2709
  } (view));
2710
2710
  return view;
2711
2711
  }
2712
2712
 
2713
- var hasRequiredInstance$1;
2714
-
2715
- function requireInstance$1 () {
2716
- if (hasRequiredInstance$1) return Instance$6;
2717
- hasRequiredInstance$1 = 1;
2718
- Object.defineProperty(Instance$6, "__esModule", { value: true });
2719
- Instance$6.Application = void 0;
2720
- /* eslint-disable import/prefer-default-export */
2721
- const base_1 = base;
2722
- const window_1 = requireWindow();
2723
- const view_1 = requireView();
2724
- /**
2725
- * An object representing an application. Allows the developer to create,
2726
- * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2727
- */
2728
- class Application extends base_1.EmitterBase {
2729
- /**
2730
- * @internal
2731
- */
2732
- constructor(wire, identity) {
2733
- super(wire, 'application', identity.uuid);
2734
- this.identity = identity;
2735
- this.window = new window_1._Window(this.wire, {
2736
- uuid: this.identity.uuid,
2737
- name: this.identity.uuid
2738
- });
2739
- }
2740
- windowListFromIdentityList(identityList) {
2741
- const windowList = [];
2742
- identityList.forEach((identity) => {
2743
- windowList.push(new window_1._Window(this.wire, {
2744
- uuid: identity.uuid,
2745
- name: identity.name
2746
- }));
2747
- });
2748
- return windowList;
2749
- }
2750
- /**
2751
- * Determines if the application is currently running.
2752
- *
2753
- * @example
2754
- *
2755
- * ```js
2756
- * async function isAppRunning() {
2757
- * const app = await fin.Application.getCurrent();
2758
- * return await app.isRunning();
2759
- * }
2760
- * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2761
- * ```
2762
- */
2763
- isRunning() {
2764
- return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2765
- }
2766
- /**
2767
- * Closes the application and any child windows created by the application.
2768
- * Cleans the application from state so it is no longer found in getAllApplications.
2769
- * @param force Close will be prevented from closing when force is false and
2770
- * ‘close-requested’ has been subscribed to for application’s main window.
2771
- *
2772
- * @example
2773
- *
2774
- * ```js
2775
- * async function closeApp() {
2776
- * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2777
- * const app = await fin.Application.wrap({uuid: 'app2'});
2778
- * await app.quit();
2779
- * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2780
- *
2781
- * }
2782
- * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2783
- * ```
2784
- */
2785
- async quit(force = false) {
2786
- try {
2787
- await this._close(force);
2788
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
2789
- }
2790
- catch (error) {
2791
- const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2792
- if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2793
- throw error;
2794
- }
2795
- }
2796
- }
2797
- async _close(force = false) {
2798
- try {
2799
- await this.wire.sendAction('close-application', { force, ...this.identity });
2800
- }
2801
- catch (error) {
2802
- if (!error.message.includes('Remote connection has closed')) {
2803
- throw error;
2804
- }
2805
- }
2806
- }
2807
- /**
2808
- * @deprecated use Application.quit instead
2809
- * Closes the application and any child windows created by the application.
2810
- * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2811
- * @param callback - called if the method succeeds.
2812
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2813
- *
2814
- * @example
2815
- *
2816
- * ```js
2817
- * async function closeApp() {
2818
- * const app = await fin.Application.getCurrent();
2819
- * return await app.close();
2820
- * }
2821
- * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2822
- * ```
2823
- */
2824
- close(force = false) {
2825
- console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2826
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2827
- // we do not want to expose this error, just continue if this analytics-only call fails
2828
- });
2829
- return this._close(force);
2830
- }
2831
- /**
2832
- * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2833
- *
2834
- * @example
2835
- *
2836
- * ```js
2837
- * async function getChildWindows() {
2838
- * const app = await fin.Application.getCurrent();
2839
- * return await app.getChildWindows();
2840
- * }
2841
- *
2842
- * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2843
- * ```
2844
- */
2845
- getChildWindows() {
2846
- return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2847
- const identityList = [];
2848
- payload.data.forEach((winName) => {
2849
- identityList.push({ uuid: this.identity.uuid, name: winName });
2850
- });
2851
- return this.windowListFromIdentityList(identityList);
2852
- });
2853
- }
2854
- /**
2855
- * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2856
- * if the application was not created from a manifest.
2857
- *
2858
- * @example
2859
- *
2860
- * ```js
2861
- * async function getManifest() {
2862
- * const app = await fin.Application.getCurrent();
2863
- * return await app.getManifest();
2864
- * }
2865
- *
2866
- * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2867
- * ```
2868
- */
2869
- getManifest() {
2870
- return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2871
- }
2872
- /**
2873
- * Retrieves UUID of the application that launches this application. Invokes the error callback
2874
- * if the application was created from a manifest.
2875
- *
2876
- * @example
2877
- *
2878
- * ```js
2879
- * async function getParentUuid() {
2880
- * const app = await fin.Application.start({
2881
- * uuid: 'app-1',
2882
- * name: 'myApp',
2883
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2884
- * autoShow: true
2885
- * });
2886
- * return await app.getParentUuid();
2887
- * }
2888
- *
2889
- * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2890
- * ```
2891
- */
2892
- getParentUuid() {
2893
- return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2894
- }
2895
- /**
2896
- * Retrieves current application's shortcut configuration.
2897
- *
2898
- * @example
2899
- *
2900
- * ```js
2901
- * async function getShortcuts() {
2902
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
2903
- * return await app.getShortcuts();
2904
- * }
2905
- * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2906
- * ```
2907
- */
2908
- getShortcuts() {
2909
- return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2910
- }
2911
- /**
2912
- * Retrieves current application's views.
2913
- * @experimental
2914
- *
2915
- * @example
2916
- *
2917
- * ```js
2918
- * async function getViews() {
2919
- * const app = await fin.Application.getCurrent();
2920
- * return await app.getViews();
2921
- * }
2922
- * getViews().then(views => console.log(views)).catch(err => console.log(err));
2923
- * ```
2924
- */
2925
- async getViews() {
2926
- const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2927
- return payload.data.map((id) => new view_1.View(this.wire, id));
2928
- }
2929
- /**
2930
- * Returns the current zoom level of the application.
2931
- *
2932
- * @example
2933
- *
2934
- * ```js
2935
- * async function getZoomLevel() {
2936
- * const app = await fin.Application.getCurrent();
2937
- * return await app.getZoomLevel();
2938
- * }
2939
- *
2940
- * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2941
- * ```
2942
- */
2943
- getZoomLevel() {
2944
- return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2945
- }
2946
- /**
2947
- * Returns an instance of the main Window of the application
2948
- *
2949
- * @example
2950
- *
2951
- * ```js
2952
- * async function getWindow() {
2953
- * const app = await fin.Application.start({
2954
- * uuid: 'app-1',
2955
- * name: 'myApp',
2956
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2957
- * autoShow: true
2958
- * });
2959
- * return await app.getWindow();
2960
- * }
2961
- *
2962
- * getWindow().then(win => {
2963
- * win.showAt(0, 400);
2964
- * win.flash();
2965
- * }).catch(err => console.log(err));
2966
- * ```
2967
- */
2968
- getWindow() {
2969
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2970
- // we do not want to expose this error, just continue if this analytics-only call fails
2971
- });
2972
- return Promise.resolve(this.window);
2973
- }
2974
- /**
2975
- * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2976
- * @param userName - username to be passed to the RVM.
2977
- * @param appName - app name to be passed to the RVM.
2978
- *
2979
- * @example
2980
- *
2981
- * ```js
2982
- * async function registerUser() {
2983
- * const app = await fin.Application.getCurrent();
2984
- * return await app.registerUser('user', 'myApp');
2985
- * }
2986
- *
2987
- * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2988
- * ```
2989
- */
2990
- registerUser(userName, appName) {
2991
- return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2992
- }
2993
- /**
2994
- * Removes the application’s icon from the tray.
2995
- *
2996
- * @example
2997
- *
2998
- * ```js
2999
- * async function removeTrayIcon() {
3000
- * const app = await fin.Application.getCurrent();
3001
- * return await app.removeTrayIcon();
3002
- * }
3003
- *
3004
- * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
3005
- * ```
3006
- */
3007
- removeTrayIcon() {
3008
- return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
3009
- }
3010
- /**
3011
- * Restarts the application.
3012
- *
3013
- * @example
3014
- *
3015
- * ```js
3016
- * async function restartApp() {
3017
- * const app = await fin.Application.getCurrent();
3018
- * return await app.restart();
3019
- * }
3020
- * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
3021
- * ```
3022
- */
3023
- restart() {
3024
- return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
3025
- }
3026
- /**
3027
- * DEPRECATED method to run the application.
3028
- * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
3029
- *
3030
- * @example
3031
- *
3032
- * ```js
3033
- * async function run() {
3034
- * const app = await fin.Application.create({
3035
- * name: 'myApp',
3036
- * uuid: 'app-1',
3037
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
3038
- * autoShow: true
3039
- * });
3040
- * await app.run();
3041
- * }
3042
- * run().then(() => console.log('Application is running')).catch(err => console.log(err));
3043
- * ```
3044
- *
3045
- * @ignore
3046
- */
3047
- run() {
3048
- console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
3049
- this.wire.sendAction('application-run', this.identity).catch((e) => {
3050
- // we do not want to expose this error, just continue if this analytics-only call fails
3051
- });
3052
- return this._run();
3053
- }
3054
- _run(opts = {}) {
3055
- return this.wire
3056
- .sendAction('run-application', {
3057
- manifestUrl: this._manifestUrl,
3058
- opts,
3059
- ...this.identity
3060
- })
3061
- .then(() => undefined);
3062
- }
3063
- /**
3064
- * Instructs the RVM to schedule one restart of the application.
3065
- *
3066
- * @example
3067
- *
3068
- * ```js
3069
- * async function scheduleRestart() {
3070
- * const app = await fin.Application.getCurrent();
3071
- * return await app.scheduleRestart();
3072
- * }
3073
- *
3074
- * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
3075
- * ```
3076
- */
3077
- scheduleRestart() {
3078
- return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
3079
- }
3080
- /**
3081
- * Sends a message to the RVM to upload the application's logs. On success,
3082
- * an object containing logId is returned.
3083
- *
3084
- * @example
3085
- *
3086
- * ```js
3087
- * async function sendLog() {
3088
- * const app = await fin.Application.getCurrent();
3089
- * return await app.sendApplicationLog();
3090
- * }
3091
- *
3092
- * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
3093
- * ```
3094
- */
3095
- async sendApplicationLog() {
3096
- const { payload } = await this.wire.sendAction('send-application-log', this.identity);
3097
- return payload.data;
3098
- }
3099
- /**
3100
- * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
3101
- * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
3102
- *
3103
- * Note: If the "name" property is omitted it defaults to "tasks".
3104
- * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
3105
- *
3106
- *
3107
- * @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).
3108
- *
3109
- * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
3110
- * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
3111
- *
3112
- * Note: If the "name" property is omitted it defaults to "tasks".
3113
- *
3114
- * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
3115
- * uuid or shortcut.name is changed.
3116
- *
3117
- * @example
3118
- *
3119
- * ```js
3120
- * const app = fin.Application.getCurrentSync();
3121
- * const appName = 'My App';
3122
- * const jumpListConfig = [ // array of JumpList categories
3123
- * {
3124
- * // has no name and no type so `type` is assumed to be "tasks"
3125
- * items: [ // array of JumpList items
3126
- * {
3127
- * type: 'task',
3128
- * title: `Launch ${appName}`,
3129
- * description: `Runs ${appName} with the default configuration`,
3130
- * deepLink: 'fins://path.to/app/manifest.json',
3131
- * iconPath: 'https://path.to/app/icon.ico',
3132
- * iconIndex: 0
3133
- * },
3134
- * { type: 'separator' },
3135
- * {
3136
- * type: 'task',
3137
- * title: `Restore ${appName}`,
3138
- * description: 'Restore to last configuration',
3139
- * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
3140
- * iconPath: 'https://path.to/app/icon.ico',
3141
- * iconIndex: 0
3142
- * },
3143
- * ]
3144
- * },
3145
- * {
3146
- * name: 'Tools',
3147
- * items: [ // array of JumpList items
3148
- * {
3149
- * type: 'task',
3150
- * title: 'Tool A',
3151
- * description: 'Runs Tool A',
3152
- * deepLink: 'fins://path.to/tool-a/manifest.json',
3153
- * iconPath: 'https://path.to/tool-a/icon.ico',
3154
- * iconIndex: 0
3155
- * },
3156
- * {
3157
- * type: 'task',
3158
- * title: 'Tool B',
3159
- * description: 'Runs Tool B',
3160
- * deepLink: 'fins://path.to/tool-b/manifest.json',
3161
- * iconPath: 'https://path.to/tool-b/icon.ico',
3162
- * iconIndex: 0
3163
- * }]
3164
- * }
3165
- * ];
3166
- *
3167
- * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
3168
- * ```
3169
- *
3170
- * To handle deeplink args:
3171
- * ```js
3172
- * function handleUseLastConfiguration() {
3173
- * // this handler is called when the app is being launched
3174
- * app.on('run-requested', event => {
3175
- * if(event.userAppConfigArgs['use-last-configuration']) {
3176
- * // your logic here
3177
- * }
3178
- * });
3179
- * // this handler is called when the app was already running when the launch was requested
3180
- * fin.desktop.main(function(args) {
3181
- * if(args && args['use-last-configuration']) {
3182
- * // your logic here
3183
- * }
3184
- * });
3185
- * }
3186
- * ```
3187
- */
3188
- async setJumpList(jumpListCategories) {
3189
- await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
3190
- }
3191
- /**
3192
- * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
3193
- * @param icon Image URL or base64 encoded string to be used as the icon
3194
- *
3195
- * @example
3196
- *
3197
- * ```js
3198
- * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3199
- * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
3200
- * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
3201
- * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
3202
- * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
3203
- *
3204
- * async function setTrayIcon(icon) {
3205
- * const app = await fin.Application.getCurrent();
3206
- * return await app.setTrayIcon(icon);
3207
- * }
3208
- *
3209
- * // use image url to set tray icon
3210
- * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3211
- *
3212
- * // use base64 encoded string to set tray icon
3213
- * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3214
- *
3215
- * // use a dataURL to set tray icon
3216
- * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3217
- * ```
3218
- */
3219
- setTrayIcon(icon) {
3220
- return this.wire
3221
- .sendAction('set-tray-icon', {
3222
- enabledIcon: icon,
3223
- ...this.identity
3224
- })
3225
- .then(() => undefined);
3226
- }
3227
- /**
3228
- * Set hover text for this application's system tray icon.
3229
- * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
3230
- * @param toolTip
3231
- *
3232
- * @example
3233
- *
3234
- * ```js
3235
- * const app = fin.Application.getCurrentSync();
3236
- * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3237
- *
3238
- * await app.setTrayIcon(iconUrl);
3239
- *
3240
- * await app.setTrayIconToolTip('My Application');
3241
- * ```
3242
- */
3243
- async setTrayIconToolTip(toolTip) {
3244
- await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
3245
- }
3246
- /**
3247
- * Sets new application's shortcut configuration. Windows only.
3248
- * @param config New application's shortcut configuration.
3249
- *
3250
- * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3251
- * to be able to change shortcut states.
3252
- *
3253
- * @example
3254
- *
3255
- * ```js
3256
- * async function setShortcuts(config) {
3257
- * const app = await fin.Application.getCurrent();
3258
- * return app.setShortcuts(config);
3259
- * }
3260
- *
3261
- * setShortcuts({
3262
- * desktop: true,
3263
- * startMenu: false,
3264
- * systemStartup: true
3265
- * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3266
- * ```
3267
- */
3268
- setShortcuts(config) {
3269
- return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3270
- }
3271
- /**
3272
- * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3273
- * @param queryString The new query string for this app's shortcuts.
3274
- *
3275
- * @example
3276
- *
3277
- * ```js
3278
- * const newQueryArgs = 'arg=true&arg2=false';
3279
- * const app = await fin.Application.getCurrent();
3280
- * try {
3281
- * await app.setShortcutQueryParams(newQueryArgs);
3282
- * } catch(err) {
3283
- * console.error(err)
3284
- * }
3285
- * ```
3286
- */
3287
- async setShortcutQueryParams(queryString) {
3288
- await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3289
- }
3290
- /**
3291
- * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3292
- * larger or smaller to default limits of 300% and 50% of original size, respectively.
3293
- * @param level The zoom level
3294
- *
3295
- * @example
3296
- *
3297
- * ```js
3298
- * async function setZoomLevel(number) {
3299
- * const app = await fin.Application.getCurrent();
3300
- * return await app.setZoomLevel(number);
3301
- * }
3302
- *
3303
- * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3304
- * ```
3305
- */
3306
- setZoomLevel(level) {
3307
- return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3308
- }
3309
- /**
3310
- * Sets a username to correlate with App Log Management.
3311
- * @param username Username to correlate with App's Log.
3312
- *
3313
- * @example
3314
- *
3315
- * ```js
3316
- * async function setAppLogUser() {
3317
- * const app = await fin.Application.getCurrent();
3318
- * return await app.setAppLogUsername('username');
3319
- * }
3320
- *
3321
- * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3322
- *
3323
- * ```
3324
- */
3325
- async setAppLogUsername(username) {
3326
- await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3327
- }
3328
- /**
3329
- * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3330
- * @remarks The only information currently returned is the position and dimensions.
3331
- *
3332
- * @example
3333
- *
3334
- * ```js
3335
- * async function getTrayIconInfo() {
3336
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3337
- * return await app.getTrayIconInfo();
3338
- * }
3339
- * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3340
- * ```
3341
- */
3342
- getTrayIconInfo() {
3343
- return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3344
- }
3345
- /**
3346
- * Checks if the application has an associated tray icon.
3347
- *
3348
- * @example
3349
- *
3350
- * ```js
3351
- * const app = await fin.Application.wrap({ uuid: 'testapp' });
3352
- * const hasTrayIcon = await app.hasTrayIcon();
3353
- * console.log(hasTrayIcon);
3354
- * ```
3355
- */
3356
- hasTrayIcon() {
3357
- return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3358
- }
3359
- /**
3360
- * Closes the application by terminating its process.
3361
- *
3362
- * @example
3363
- *
3364
- * ```js
3365
- * async function terminateApp() {
3366
- * const app = await fin.Application.getCurrent();
3367
- * return await app.terminate();
3368
- * }
3369
- * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3370
- * ```
3371
- */
3372
- terminate() {
3373
- return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3374
- }
3375
- /**
3376
- * Waits for a hanging application. This method can be called in response to an application
3377
- * "not-responding" to allow the application to continue and to generate another "not-responding"
3378
- * message after a certain period of time.
3379
- *
3380
- * @ignore
3381
- */
3382
- wait() {
3383
- return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3384
- }
3385
- /**
3386
- * Retrieves information about the application.
3387
- *
3388
- * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3389
- * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3390
- * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3391
- *
3392
- * @example
3393
- *
3394
- * ```js
3395
- * async function getInfo() {
3396
- * const app = await fin.Application.getCurrent();
3397
- * return await app.getInfo();
3398
- * }
3399
- *
3400
- * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3401
- * ```
3402
- */
3403
- getInfo() {
3404
- return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3405
- }
3406
- /**
3407
- * Retrieves all process information for entities (windows and views) associated with an application.
3408
- *
3409
- * @example
3410
- * ```js
3411
- * const app = await fin.Application.getCurrent();
3412
- * const processInfo = await app.getProcessInfo();
3413
- * ```
3414
- * @experimental
3415
- */
3416
- async getProcessInfo() {
3417
- const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3418
- return data;
3419
- }
3420
- /**
3421
- * Sets file auto download location. It's only allowed in the same application.
3422
- *
3423
- * Note: This method is restricted by default and must be enabled via
3424
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3425
- * @param downloadLocation file auto download location
3426
- *
3427
- * @throws if setting file auto download location on different applications.
3428
- * @example
3429
- *
3430
- * ```js
3431
- * const downloadLocation = 'C:\\dev\\temp';
3432
- * const app = await fin.Application.getCurrent();
3433
- * try {
3434
- * await app.setFileDownloadLocation(downloadLocation);
3435
- * console.log('File download location is set');
3436
- * } catch(err) {
3437
- * console.error(err)
3438
- * }
3439
- * ```
3440
- */
3441
- async setFileDownloadLocation(downloadLocation) {
3442
- const { name } = this.wire.me;
3443
- const entityIdentity = { uuid: this.identity.uuid, name };
3444
- await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3445
- }
3446
- /**
3447
- * 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.
3448
- *
3449
- * Note: This method is restricted by default and must be enabled via
3450
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3451
- *
3452
- * @throws if getting file auto download location on different applications.
3453
- * @example
3454
- *
3455
- * ```js
3456
- * const app = await fin.Application.getCurrent();
3457
- * const fileDownloadDir = await app.getFileDownloadLocation();
3458
- * ```
3459
- */
3460
- async getFileDownloadLocation() {
3461
- const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3462
- return data;
3463
- }
3464
- /**
3465
- * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3466
- * @param options
3467
- * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3468
- * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3469
- * of all possible data shapes for the entire menu, and the click handler should process
3470
- * these with a "reducer" pattern.
3471
- * @throws if the application has no tray icon set
3472
- * @throws if the system tray is currently hidden
3473
- * @example
3474
- *
3475
- * ```js
3476
- * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3477
- * const app = fin.Application.getCurrentSync();
3478
- *
3479
- * await app.setTrayIcon(iconUrl);
3480
- *
3481
- * const template = [
3482
- * {
3483
- * label: 'Menu Item 1',
3484
- * data: 'hello from item 1'
3485
- * },
3486
- * { type: 'separator' },
3487
- * {
3488
- * label: 'Menu Item 2',
3489
- * type: 'checkbox',
3490
- * checked: true,
3491
- * data: 'The user clicked the checkbox'
3492
- * },
3493
- * {
3494
- * label: 'see more',
3495
- * enabled: false,
3496
- * submenu: [
3497
- * { label: 'submenu 1', data: 'hello from submenu' }
3498
- * ]
3499
- * }
3500
- * ];
3501
- *
3502
- * app.addListener('tray-icon-clicked', (event) => {
3503
- * // right-click
3504
- * if (event.button === 2) {
3505
- * app.showTrayIconPopupMenu({ template }).then(r => {
3506
- * if (r.result === 'closed') {
3507
- * console.log('nothing happened');
3508
- * } else {
3509
- * console.log(r.data);
3510
- * }
3511
- * });
3512
- * }
3513
- * });
3514
- * ```
3515
- */
3516
- async showTrayIconPopupMenu(options) {
3517
- const { name } = this.wire.me;
3518
- const entityIdentity = { uuid: this.identity.uuid, name };
3519
- const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3520
- return payload.data;
3521
- }
3522
- /**
3523
- * Closes the tray icon menu.
3524
- *
3525
- * @throws if the application has no tray icon set
3526
- * @example
3527
- *
3528
- * ```js
3529
- * const app = fin.Application.getCurrentSync();
3530
- *
3531
- * await app.closeTrayIconPopupMenu();
3532
- * ```
3533
- */
3534
- async closeTrayIconPopupMenu() {
3535
- const { name } = this.wire.me;
3536
- const entityIdentity = { uuid: this.identity.uuid, name };
3537
- await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3538
- }
3539
- }
3540
- Instance$6.Application = Application;
3541
- return Instance$6;
2713
+ Object.defineProperty(Instance$6, "__esModule", { value: true });
2714
+ Instance$6.Application = void 0;
2715
+ /* eslint-disable import/prefer-default-export */
2716
+ const base_1$o = base;
2717
+ const window_1$1 = requireWindow();
2718
+ const view_1 = requireView();
2719
+ /**
2720
+ * An object representing an application. Allows the developer to create,
2721
+ * execute, show/close an application as well as listen to {@link OpenFin.ApplicationEvents application events}.
2722
+ */
2723
+ class Application extends base_1$o.EmitterBase {
2724
+ /**
2725
+ * @internal
2726
+ */
2727
+ constructor(wire, identity) {
2728
+ super(wire, 'application', identity.uuid);
2729
+ this.identity = identity;
2730
+ this.window = new window_1$1._Window(this.wire, {
2731
+ uuid: this.identity.uuid,
2732
+ name: this.identity.uuid
2733
+ });
2734
+ }
2735
+ windowListFromIdentityList(identityList) {
2736
+ const windowList = [];
2737
+ identityList.forEach((identity) => {
2738
+ windowList.push(new window_1$1._Window(this.wire, {
2739
+ uuid: identity.uuid,
2740
+ name: identity.name
2741
+ }));
2742
+ });
2743
+ return windowList;
2744
+ }
2745
+ /**
2746
+ * Determines if the application is currently running.
2747
+ *
2748
+ * @example
2749
+ *
2750
+ * ```js
2751
+ * async function isAppRunning() {
2752
+ * const app = await fin.Application.getCurrent();
2753
+ * return await app.isRunning();
2754
+ * }
2755
+ * isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
2756
+ * ```
2757
+ */
2758
+ isRunning() {
2759
+ return this.wire.sendAction('is-application-running', this.identity).then(({ payload }) => payload.data);
2760
+ }
2761
+ /**
2762
+ * Closes the application and any child windows created by the application.
2763
+ * Cleans the application from state so it is no longer found in getAllApplications.
2764
+ * @param force Close will be prevented from closing when force is false and
2765
+ * ‘close-requested’ has been subscribed to for application’s main window.
2766
+ *
2767
+ * @example
2768
+ *
2769
+ * ```js
2770
+ * async function closeApp() {
2771
+ * const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
2772
+ * const app = await fin.Application.wrap({uuid: 'app2'});
2773
+ * await app.quit();
2774
+ * const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]
2775
+ *
2776
+ * }
2777
+ * closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
2778
+ * ```
2779
+ */
2780
+ async quit(force = false) {
2781
+ try {
2782
+ await this._close(force);
2783
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
2784
+ }
2785
+ catch (error) {
2786
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
2787
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
2788
+ throw error;
2789
+ }
2790
+ }
2791
+ }
2792
+ async _close(force = false) {
2793
+ try {
2794
+ await this.wire.sendAction('close-application', { force, ...this.identity });
2795
+ }
2796
+ catch (error) {
2797
+ if (!error.message.includes('Remote connection has closed')) {
2798
+ throw error;
2799
+ }
2800
+ }
2801
+ }
2802
+ /**
2803
+ * @deprecated use Application.quit instead
2804
+ * Closes the application and any child windows created by the application.
2805
+ * @param force - Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.
2806
+ * @param callback - called if the method succeeds.
2807
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
2808
+ *
2809
+ * @example
2810
+ *
2811
+ * ```js
2812
+ * async function closeApp() {
2813
+ * const app = await fin.Application.getCurrent();
2814
+ * return await app.close();
2815
+ * }
2816
+ * closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
2817
+ * ```
2818
+ */
2819
+ close(force = false) {
2820
+ console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2821
+ this.wire.sendAction('application-close', this.identity).catch((e) => {
2822
+ // we do not want to expose this error, just continue if this analytics-only call fails
2823
+ });
2824
+ return this._close(force);
2825
+ }
2826
+ /**
2827
+ * Retrieves an array of wrapped fin.Windows for each of the application’s child windows.
2828
+ *
2829
+ * @example
2830
+ *
2831
+ * ```js
2832
+ * async function getChildWindows() {
2833
+ * const app = await fin.Application.getCurrent();
2834
+ * return await app.getChildWindows();
2835
+ * }
2836
+ *
2837
+ * getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
2838
+ * ```
2839
+ */
2840
+ getChildWindows() {
2841
+ return this.wire.sendAction('get-child-windows', this.identity).then(({ payload }) => {
2842
+ const identityList = [];
2843
+ payload.data.forEach((winName) => {
2844
+ identityList.push({ uuid: this.identity.uuid, name: winName });
2845
+ });
2846
+ return this.windowListFromIdentityList(identityList);
2847
+ });
2848
+ }
2849
+ /**
2850
+ * Retrieves the JSON manifest that was used to create the application. Invokes the error callback
2851
+ * if the application was not created from a manifest.
2852
+ *
2853
+ * @example
2854
+ *
2855
+ * ```js
2856
+ * async function getManifest() {
2857
+ * const app = await fin.Application.getCurrent();
2858
+ * return await app.getManifest();
2859
+ * }
2860
+ *
2861
+ * getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
2862
+ * ```
2863
+ */
2864
+ getManifest() {
2865
+ return this.wire.sendAction('get-application-manifest', this.identity).then(({ payload }) => payload.data);
2866
+ }
2867
+ /**
2868
+ * Retrieves UUID of the application that launches this application. Invokes the error callback
2869
+ * if the application was created from a manifest.
2870
+ *
2871
+ * @example
2872
+ *
2873
+ * ```js
2874
+ * async function getParentUuid() {
2875
+ * const app = await fin.Application.start({
2876
+ * uuid: 'app-1',
2877
+ * name: 'myApp',
2878
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
2879
+ * autoShow: true
2880
+ * });
2881
+ * return await app.getParentUuid();
2882
+ * }
2883
+ *
2884
+ * getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
2885
+ * ```
2886
+ */
2887
+ getParentUuid() {
2888
+ return this.wire.sendAction('get-parent-application', this.identity).then(({ payload }) => payload.data);
2889
+ }
2890
+ /**
2891
+ * Retrieves current application's shortcut configuration.
2892
+ *
2893
+ * @example
2894
+ *
2895
+ * ```js
2896
+ * async function getShortcuts() {
2897
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
2898
+ * return await app.getShortcuts();
2899
+ * }
2900
+ * getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
2901
+ * ```
2902
+ */
2903
+ getShortcuts() {
2904
+ return this.wire.sendAction('get-shortcuts', this.identity).then(({ payload }) => payload.data);
2905
+ }
2906
+ /**
2907
+ * Retrieves current application's views.
2908
+ * @experimental
2909
+ *
2910
+ * @example
2911
+ *
2912
+ * ```js
2913
+ * async function getViews() {
2914
+ * const app = await fin.Application.getCurrent();
2915
+ * return await app.getViews();
2916
+ * }
2917
+ * getViews().then(views => console.log(views)).catch(err => console.log(err));
2918
+ * ```
2919
+ */
2920
+ async getViews() {
2921
+ const { payload } = await this.wire.sendAction('application-get-views', this.identity);
2922
+ return payload.data.map((id) => new view_1.View(this.wire, id));
2923
+ }
2924
+ /**
2925
+ * Returns the current zoom level of the application.
2926
+ *
2927
+ * @example
2928
+ *
2929
+ * ```js
2930
+ * async function getZoomLevel() {
2931
+ * const app = await fin.Application.getCurrent();
2932
+ * return await app.getZoomLevel();
2933
+ * }
2934
+ *
2935
+ * getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
2936
+ * ```
2937
+ */
2938
+ getZoomLevel() {
2939
+ return this.wire.sendAction('get-application-zoom-level', this.identity).then(({ payload }) => payload.data);
2940
+ }
2941
+ /**
2942
+ * Returns an instance of the main Window of the application
2943
+ *
2944
+ * @example
2945
+ *
2946
+ * ```js
2947
+ * async function getWindow() {
2948
+ * const app = await fin.Application.start({
2949
+ * uuid: 'app-1',
2950
+ * name: 'myApp',
2951
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
2952
+ * autoShow: true
2953
+ * });
2954
+ * return await app.getWindow();
2955
+ * }
2956
+ *
2957
+ * getWindow().then(win => {
2958
+ * win.showAt(0, 400);
2959
+ * win.flash();
2960
+ * }).catch(err => console.log(err));
2961
+ * ```
2962
+ */
2963
+ getWindow() {
2964
+ this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2965
+ // we do not want to expose this error, just continue if this analytics-only call fails
2966
+ });
2967
+ return Promise.resolve(this.window);
2968
+ }
2969
+ /**
2970
+ * Manually registers a user with the licensing service. The only data sent by this call is userName and appName.
2971
+ * @param userName - username to be passed to the RVM.
2972
+ * @param appName - app name to be passed to the RVM.
2973
+ *
2974
+ * @example
2975
+ *
2976
+ * ```js
2977
+ * async function registerUser() {
2978
+ * const app = await fin.Application.getCurrent();
2979
+ * return await app.registerUser('user', 'myApp');
2980
+ * }
2981
+ *
2982
+ * registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
2983
+ * ```
2984
+ */
2985
+ registerUser(userName, appName) {
2986
+ return this.wire.sendAction('register-user', { userName, appName, ...this.identity }).then(() => undefined);
2987
+ }
2988
+ /**
2989
+ * Removes the application’s icon from the tray.
2990
+ *
2991
+ * @example
2992
+ *
2993
+ * ```js
2994
+ * async function removeTrayIcon() {
2995
+ * const app = await fin.Application.getCurrent();
2996
+ * return await app.removeTrayIcon();
2997
+ * }
2998
+ *
2999
+ * removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
3000
+ * ```
3001
+ */
3002
+ removeTrayIcon() {
3003
+ return this.wire.sendAction('remove-tray-icon', this.identity).then(() => undefined);
3004
+ }
3005
+ /**
3006
+ * Restarts the application.
3007
+ *
3008
+ * @example
3009
+ *
3010
+ * ```js
3011
+ * async function restartApp() {
3012
+ * const app = await fin.Application.getCurrent();
3013
+ * return await app.restart();
3014
+ * }
3015
+ * restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
3016
+ * ```
3017
+ */
3018
+ restart() {
3019
+ return this.wire.sendAction('restart-application', this.identity).then(() => undefined);
3020
+ }
3021
+ /**
3022
+ * DEPRECATED method to run the application.
3023
+ * Needed when starting application via {@link Application.create}, but NOT needed when starting via {@link Application.start}.
3024
+ *
3025
+ * @example
3026
+ *
3027
+ * ```js
3028
+ * async function run() {
3029
+ * const app = await fin.Application.create({
3030
+ * name: 'myApp',
3031
+ * uuid: 'app-1',
3032
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.run.html',
3033
+ * autoShow: true
3034
+ * });
3035
+ * await app.run();
3036
+ * }
3037
+ * run().then(() => console.log('Application is running')).catch(err => console.log(err));
3038
+ * ```
3039
+ *
3040
+ * @ignore
3041
+ */
3042
+ run() {
3043
+ console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
3044
+ this.wire.sendAction('application-run', this.identity).catch((e) => {
3045
+ // we do not want to expose this error, just continue if this analytics-only call fails
3046
+ });
3047
+ return this._run();
3048
+ }
3049
+ _run(opts = {}) {
3050
+ return this.wire
3051
+ .sendAction('run-application', {
3052
+ manifestUrl: this._manifestUrl,
3053
+ opts,
3054
+ ...this.identity
3055
+ })
3056
+ .then(() => undefined);
3057
+ }
3058
+ /**
3059
+ * Instructs the RVM to schedule one restart of the application.
3060
+ *
3061
+ * @example
3062
+ *
3063
+ * ```js
3064
+ * async function scheduleRestart() {
3065
+ * const app = await fin.Application.getCurrent();
3066
+ * return await app.scheduleRestart();
3067
+ * }
3068
+ *
3069
+ * scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
3070
+ * ```
3071
+ */
3072
+ scheduleRestart() {
3073
+ return this.wire.sendAction('relaunch-on-close', this.identity).then(() => undefined);
3074
+ }
3075
+ /**
3076
+ * Sends a message to the RVM to upload the application's logs. On success,
3077
+ * an object containing logId is returned.
3078
+ *
3079
+ * @example
3080
+ *
3081
+ * ```js
3082
+ * async function sendLog() {
3083
+ * const app = await fin.Application.getCurrent();
3084
+ * return await app.sendApplicationLog();
3085
+ * }
3086
+ *
3087
+ * sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
3088
+ * ```
3089
+ */
3090
+ async sendApplicationLog() {
3091
+ const { payload } = await this.wire.sendAction('send-application-log', this.identity);
3092
+ return payload.data;
3093
+ }
3094
+ /**
3095
+ * Sets or removes a custom JumpList for the application. Only applicable in Windows OS.
3096
+ * If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).
3097
+ *
3098
+ * Note: If the "name" property is omitted it defaults to "tasks".
3099
+ * @param jumpListCategories An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.
3100
+ *
3101
+ *
3102
+ * @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).
3103
+ *
3104
+ * The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's
3105
+ * **` shortcut.name `** and uses **` shortcut.company `** as a fallback. Clicking that item will launch the app from its current manifest.
3106
+ *
3107
+ * Note: If the "name" property is omitted it defaults to "tasks".
3108
+ *
3109
+ * Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the
3110
+ * uuid or shortcut.name is changed.
3111
+ *
3112
+ * @example
3113
+ *
3114
+ * ```js
3115
+ * const app = fin.Application.getCurrentSync();
3116
+ * const appName = 'My App';
3117
+ * const jumpListConfig = [ // array of JumpList categories
3118
+ * {
3119
+ * // has no name and no type so `type` is assumed to be "tasks"
3120
+ * items: [ // array of JumpList items
3121
+ * {
3122
+ * type: 'task',
3123
+ * title: `Launch ${appName}`,
3124
+ * description: `Runs ${appName} with the default configuration`,
3125
+ * deepLink: 'fins://path.to/app/manifest.json',
3126
+ * iconPath: 'https://path.to/app/icon.ico',
3127
+ * iconIndex: 0
3128
+ * },
3129
+ * { type: 'separator' },
3130
+ * {
3131
+ * type: 'task',
3132
+ * title: `Restore ${appName}`,
3133
+ * description: 'Restore to last configuration',
3134
+ * deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
3135
+ * iconPath: 'https://path.to/app/icon.ico',
3136
+ * iconIndex: 0
3137
+ * },
3138
+ * ]
3139
+ * },
3140
+ * {
3141
+ * name: 'Tools',
3142
+ * items: [ // array of JumpList items
3143
+ * {
3144
+ * type: 'task',
3145
+ * title: 'Tool A',
3146
+ * description: 'Runs Tool A',
3147
+ * deepLink: 'fins://path.to/tool-a/manifest.json',
3148
+ * iconPath: 'https://path.to/tool-a/icon.ico',
3149
+ * iconIndex: 0
3150
+ * },
3151
+ * {
3152
+ * type: 'task',
3153
+ * title: 'Tool B',
3154
+ * description: 'Runs Tool B',
3155
+ * deepLink: 'fins://path.to/tool-b/manifest.json',
3156
+ * iconPath: 'https://path.to/tool-b/icon.ico',
3157
+ * iconIndex: 0
3158
+ * }]
3159
+ * }
3160
+ * ];
3161
+ *
3162
+ * app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));
3163
+ * ```
3164
+ *
3165
+ * To handle deeplink args:
3166
+ * ```js
3167
+ * function handleUseLastConfiguration() {
3168
+ * // this handler is called when the app is being launched
3169
+ * app.on('run-requested', event => {
3170
+ * if(event.userAppConfigArgs['use-last-configuration']) {
3171
+ * // your logic here
3172
+ * }
3173
+ * });
3174
+ * // this handler is called when the app was already running when the launch was requested
3175
+ * fin.desktop.main(function(args) {
3176
+ * if(args && args['use-last-configuration']) {
3177
+ * // your logic here
3178
+ * }
3179
+ * });
3180
+ * }
3181
+ * ```
3182
+ */
3183
+ async setJumpList(jumpListCategories) {
3184
+ await this.wire.sendAction('set-jump-list', { config: jumpListCategories, ...this.identity });
3185
+ }
3186
+ /**
3187
+ * Adds a customizable icon in the system tray. To listen for a click on the icon use the `tray-icon-clicked` event.
3188
+ * @param icon Image URL or base64 encoded string to be used as the icon
3189
+ *
3190
+ * @example
3191
+ *
3192
+ * ```js
3193
+ * const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3194
+ * const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
3195
+ * ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
3196
+ * const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
3197
+ * xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
3198
+ *
3199
+ * async function setTrayIcon(icon) {
3200
+ * const app = await fin.Application.getCurrent();
3201
+ * return await app.setTrayIcon(icon);
3202
+ * }
3203
+ *
3204
+ * // use image url to set tray icon
3205
+ * setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3206
+ *
3207
+ * // use base64 encoded string to set tray icon
3208
+ * setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3209
+ *
3210
+ * // use a dataURL to set tray icon
3211
+ * setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
3212
+ * ```
3213
+ */
3214
+ setTrayIcon(icon) {
3215
+ return this.wire
3216
+ .sendAction('set-tray-icon', {
3217
+ enabledIcon: icon,
3218
+ ...this.identity
3219
+ })
3220
+ .then(() => undefined);
3221
+ }
3222
+ /**
3223
+ * Set hover text for this application's system tray icon.
3224
+ * Note: Application must first set a tray icon with {@link Application.setTrayIcon}.
3225
+ * @param toolTip
3226
+ *
3227
+ * @example
3228
+ *
3229
+ * ```js
3230
+ * const app = fin.Application.getCurrentSync();
3231
+ * const iconUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
3232
+ *
3233
+ * await app.setTrayIcon(iconUrl);
3234
+ *
3235
+ * await app.setTrayIconToolTip('My Application');
3236
+ * ```
3237
+ */
3238
+ async setTrayIconToolTip(toolTip) {
3239
+ await this.wire.sendAction('set-tray-icon-tooltip', { ...this.identity, toolTip });
3240
+ }
3241
+ /**
3242
+ * Sets new application's shortcut configuration. Windows only.
3243
+ * @param config New application's shortcut configuration.
3244
+ *
3245
+ * @remarks Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest
3246
+ * to be able to change shortcut states.
3247
+ *
3248
+ * @example
3249
+ *
3250
+ * ```js
3251
+ * async function setShortcuts(config) {
3252
+ * const app = await fin.Application.getCurrent();
3253
+ * return app.setShortcuts(config);
3254
+ * }
3255
+ *
3256
+ * setShortcuts({
3257
+ * desktop: true,
3258
+ * startMenu: false,
3259
+ * systemStartup: true
3260
+ * }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
3261
+ * ```
3262
+ */
3263
+ setShortcuts(config) {
3264
+ return this.wire.sendAction('set-shortcuts', { data: config, ...this.identity }).then(() => undefined);
3265
+ }
3266
+ /**
3267
+ * Sets the query string in all shortcuts for this app. Requires RVM 5.5+.
3268
+ * @param queryString The new query string for this app's shortcuts.
3269
+ *
3270
+ * @example
3271
+ *
3272
+ * ```js
3273
+ * const newQueryArgs = 'arg=true&arg2=false';
3274
+ * const app = await fin.Application.getCurrent();
3275
+ * try {
3276
+ * await app.setShortcutQueryParams(newQueryArgs);
3277
+ * } catch(err) {
3278
+ * console.error(err)
3279
+ * }
3280
+ * ```
3281
+ */
3282
+ async setShortcutQueryParams(queryString) {
3283
+ await this.wire.sendAction('set-shortcut-query-args', { data: queryString, ...this.identity });
3284
+ }
3285
+ /**
3286
+ * Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20%
3287
+ * larger or smaller to default limits of 300% and 50% of original size, respectively.
3288
+ * @param level The zoom level
3289
+ *
3290
+ * @example
3291
+ *
3292
+ * ```js
3293
+ * async function setZoomLevel(number) {
3294
+ * const app = await fin.Application.getCurrent();
3295
+ * return await app.setZoomLevel(number);
3296
+ * }
3297
+ *
3298
+ * setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
3299
+ * ```
3300
+ */
3301
+ setZoomLevel(level) {
3302
+ return this.wire.sendAction('set-application-zoom-level', { level, ...this.identity }).then(() => undefined);
3303
+ }
3304
+ /**
3305
+ * Sets a username to correlate with App Log Management.
3306
+ * @param username Username to correlate with App's Log.
3307
+ *
3308
+ * @example
3309
+ *
3310
+ * ```js
3311
+ * async function setAppLogUser() {
3312
+ * const app = await fin.Application.getCurrent();
3313
+ * return await app.setAppLogUsername('username');
3314
+ * }
3315
+ *
3316
+ * setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
3317
+ *
3318
+ * ```
3319
+ */
3320
+ async setAppLogUsername(username) {
3321
+ await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
3322
+ }
3323
+ /**
3324
+ * Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
3325
+ * @remarks The only information currently returned is the position and dimensions.
3326
+ *
3327
+ * @example
3328
+ *
3329
+ * ```js
3330
+ * async function getTrayIconInfo() {
3331
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3332
+ * return await app.getTrayIconInfo();
3333
+ * }
3334
+ * getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
3335
+ * ```
3336
+ */
3337
+ getTrayIconInfo() {
3338
+ return this.wire.sendAction('get-tray-icon-info', this.identity).then(({ payload }) => payload.data);
3339
+ }
3340
+ /**
3341
+ * Checks if the application has an associated tray icon.
3342
+ *
3343
+ * @example
3344
+ *
3345
+ * ```js
3346
+ * const app = await fin.Application.wrap({ uuid: 'testapp' });
3347
+ * const hasTrayIcon = await app.hasTrayIcon();
3348
+ * console.log(hasTrayIcon);
3349
+ * ```
3350
+ */
3351
+ hasTrayIcon() {
3352
+ return this.wire.sendAction('has-tray-icon', this.identity).then(({ payload }) => payload.data);
3353
+ }
3354
+ /**
3355
+ * Closes the application by terminating its process.
3356
+ *
3357
+ * @example
3358
+ *
3359
+ * ```js
3360
+ * async function terminateApp() {
3361
+ * const app = await fin.Application.getCurrent();
3362
+ * return await app.terminate();
3363
+ * }
3364
+ * terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));
3365
+ * ```
3366
+ */
3367
+ terminate() {
3368
+ return this.wire.sendAction('terminate-application', this.identity).then(() => undefined);
3369
+ }
3370
+ /**
3371
+ * Waits for a hanging application. This method can be called in response to an application
3372
+ * "not-responding" to allow the application to continue and to generate another "not-responding"
3373
+ * message after a certain period of time.
3374
+ *
3375
+ * @ignore
3376
+ */
3377
+ wait() {
3378
+ return this.wire.sendAction('wait-for-hung-application', this.identity).then(() => undefined);
3379
+ }
3380
+ /**
3381
+ * Retrieves information about the application.
3382
+ *
3383
+ * @remarks If the application was not launched from a manifest, the call will return the closest parent application `manifest`
3384
+ * and `manifestUrl`. `initialOptions` shows the parameters used when launched programmatically, or the `startup_app` options
3385
+ * if launched from manifest. The `parentUuid` will be the uuid of the immediate parent (if applicable).
3386
+ *
3387
+ * @example
3388
+ *
3389
+ * ```js
3390
+ * async function getInfo() {
3391
+ * const app = await fin.Application.getCurrent();
3392
+ * return await app.getInfo();
3393
+ * }
3394
+ *
3395
+ * getInfo().then(info => console.log(info)).catch(err => console.log(err));
3396
+ * ```
3397
+ */
3398
+ getInfo() {
3399
+ return this.wire.sendAction('get-info', this.identity).then(({ payload }) => payload.data);
3400
+ }
3401
+ /**
3402
+ * Retrieves all process information for entities (windows and views) associated with an application.
3403
+ *
3404
+ * @example
3405
+ * ```js
3406
+ * const app = await fin.Application.getCurrent();
3407
+ * const processInfo = await app.getProcessInfo();
3408
+ * ```
3409
+ * @experimental
3410
+ */
3411
+ async getProcessInfo() {
3412
+ const { payload: { data } } = await this.wire.sendAction('application-get-process-info', this.identity);
3413
+ return data;
3414
+ }
3415
+ /**
3416
+ * Sets file auto download location. It's only allowed in the same application.
3417
+ *
3418
+ * Note: This method is restricted by default and must be enabled via
3419
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3420
+ * @param downloadLocation file auto download location
3421
+ *
3422
+ * @throws if setting file auto download location on different applications.
3423
+ * @example
3424
+ *
3425
+ * ```js
3426
+ * const downloadLocation = 'C:\\dev\\temp';
3427
+ * const app = await fin.Application.getCurrent();
3428
+ * try {
3429
+ * await app.setFileDownloadLocation(downloadLocation);
3430
+ * console.log('File download location is set');
3431
+ * } catch(err) {
3432
+ * console.error(err)
3433
+ * }
3434
+ * ```
3435
+ */
3436
+ async setFileDownloadLocation(downloadLocation) {
3437
+ const { name } = this.wire.me;
3438
+ const entityIdentity = { uuid: this.identity.uuid, name };
3439
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
3440
+ }
3441
+ /**
3442
+ * 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.
3443
+ *
3444
+ * Note: This method is restricted by default and must be enabled via
3445
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
3446
+ *
3447
+ * @throws if getting file auto download location on different applications.
3448
+ * @example
3449
+ *
3450
+ * ```js
3451
+ * const app = await fin.Application.getCurrent();
3452
+ * const fileDownloadDir = await app.getFileDownloadLocation();
3453
+ * ```
3454
+ */
3455
+ async getFileDownloadLocation() {
3456
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
3457
+ return data;
3458
+ }
3459
+ /**
3460
+ * Shows a menu on the tray icon. Use with tray-icon-clicked event.
3461
+ * @param options
3462
+ * @typeParam Data User-defined shape for data returned upon menu item click. Should be a
3463
+ * [union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types)
3464
+ * of all possible data shapes for the entire menu, and the click handler should process
3465
+ * these with a "reducer" pattern.
3466
+ * @throws if the application has no tray icon set
3467
+ * @throws if the system tray is currently hidden
3468
+ * @example
3469
+ *
3470
+ * ```js
3471
+ * const iconUrl = 'http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png';
3472
+ * const app = fin.Application.getCurrentSync();
3473
+ *
3474
+ * await app.setTrayIcon(iconUrl);
3475
+ *
3476
+ * const template = [
3477
+ * {
3478
+ * label: 'Menu Item 1',
3479
+ * data: 'hello from item 1'
3480
+ * },
3481
+ * { type: 'separator' },
3482
+ * {
3483
+ * label: 'Menu Item 2',
3484
+ * type: 'checkbox',
3485
+ * checked: true,
3486
+ * data: 'The user clicked the checkbox'
3487
+ * },
3488
+ * {
3489
+ * label: 'see more',
3490
+ * enabled: false,
3491
+ * submenu: [
3492
+ * { label: 'submenu 1', data: 'hello from submenu' }
3493
+ * ]
3494
+ * }
3495
+ * ];
3496
+ *
3497
+ * app.addListener('tray-icon-clicked', (event) => {
3498
+ * // right-click
3499
+ * if (event.button === 2) {
3500
+ * app.showTrayIconPopupMenu({ template }).then(r => {
3501
+ * if (r.result === 'closed') {
3502
+ * console.log('nothing happened');
3503
+ * } else {
3504
+ * console.log(r.data);
3505
+ * }
3506
+ * });
3507
+ * }
3508
+ * });
3509
+ * ```
3510
+ */
3511
+ async showTrayIconPopupMenu(options) {
3512
+ const { name } = this.wire.me;
3513
+ const entityIdentity = { uuid: this.identity.uuid, name };
3514
+ const { payload } = await this.wire.sendAction('show-tray-icon-popup-menu', { ...entityIdentity, options });
3515
+ return payload.data;
3516
+ }
3517
+ /**
3518
+ * Closes the tray icon menu.
3519
+ *
3520
+ * @throws if the application has no tray icon set
3521
+ * @example
3522
+ *
3523
+ * ```js
3524
+ * const app = fin.Application.getCurrentSync();
3525
+ *
3526
+ * await app.closeTrayIconPopupMenu();
3527
+ * ```
3528
+ */
3529
+ async closeTrayIconPopupMenu() {
3530
+ const { name } = this.wire.me;
3531
+ const entityIdentity = { uuid: this.identity.uuid, name };
3532
+ await this.wire.sendAction('close-tray-icon-popup-menu', { ...entityIdentity });
3533
+ }
3534
+ }
3535
+ Instance$6.Application = Application;
3536
+
3537
+ Object.defineProperty(Factory$7, "__esModule", { value: true });
3538
+ Factory$7.ApplicationModule = void 0;
3539
+ const base_1$n = base;
3540
+ const validate_1$4 = validate;
3541
+ const Instance_1$5 = Instance$6;
3542
+ /**
3543
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3544
+ */
3545
+ class ApplicationModule extends base_1$n.Base {
3546
+ /**
3547
+ * Asynchronously returns an API handle for the given Application identity.
3548
+ *
3549
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3550
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3551
+ * for an Application throughout its entire lifecycle.
3552
+ *
3553
+ * @example
3554
+ *
3555
+ * ```js
3556
+ * fin.Application.wrap({ uuid: 'testapp' })
3557
+ * .then(app => app.isRunning())
3558
+ * .then(running => console.log('Application is running: ' + running))
3559
+ * .catch(err => console.log(err));
3560
+ * ```
3561
+ *
3562
+ */
3563
+ async wrap(identity) {
3564
+ this.wire.sendAction('wrap-application').catch((e) => {
3565
+ // we do not want to expose this error, just continue if this analytics-only call fails
3566
+ });
3567
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3568
+ if (errorMsg) {
3569
+ throw new Error(errorMsg);
3570
+ }
3571
+ return new Instance_1$5.Application(this.wire, identity);
3572
+ }
3573
+ /**
3574
+ * Synchronously returns an API handle for the given Application identity.
3575
+ *
3576
+ * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3577
+ * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3578
+ * for an Aplication throughout its entire lifecycle.
3579
+ *
3580
+ * @example
3581
+ *
3582
+ * ```js
3583
+ * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3584
+ * await app.close();
3585
+ * ```
3586
+ *
3587
+ */
3588
+ wrapSync(identity) {
3589
+ this.wire.sendAction('wrap-application-sync').catch((e) => {
3590
+ // we do not want to expose this error, just continue if this analytics-only call fails
3591
+ });
3592
+ const errorMsg = (0, validate_1$4.validateIdentity)(identity);
3593
+ if (errorMsg) {
3594
+ throw new Error(errorMsg);
3595
+ }
3596
+ return new Instance_1$5.Application(this.wire, identity);
3597
+ }
3598
+ async _create(appOptions) {
3599
+ // set defaults:
3600
+ if (appOptions.waitForPageLoad === undefined) {
3601
+ appOptions.waitForPageLoad = false;
3602
+ }
3603
+ if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3604
+ appOptions.autoShow = true;
3605
+ }
3606
+ await this.wire.sendAction('create-application', appOptions);
3607
+ return this.wrap({ uuid: appOptions.uuid });
3608
+ }
3609
+ /**
3610
+ * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3611
+ *
3612
+ * @example
3613
+ *
3614
+ * ```js
3615
+ * async function createApp() {
3616
+ * const app = await fin.Application.create({
3617
+ * name: 'myApp',
3618
+ * uuid: 'app-3',
3619
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3620
+ * autoShow: true
3621
+ * });
3622
+ * await app.run();
3623
+ * }
3624
+ *
3625
+ * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3626
+ * ```
3627
+ *
3628
+ * @ignore
3629
+ */
3630
+ create(appOptions) {
3631
+ console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3632
+ this.wire.sendAction('application-create').catch((e) => {
3633
+ // we do not want to expose this error, just continue if this analytics-only call fails
3634
+ });
3635
+ return this._create(appOptions);
3636
+ }
3637
+ /**
3638
+ * Creates and starts a new Application.
3639
+ *
3640
+ * @example
3641
+ *
3642
+ * ```js
3643
+ * async function start() {
3644
+ * return fin.Application.start({
3645
+ * name: 'app-1',
3646
+ * uuid: 'app-1',
3647
+ * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3648
+ * autoShow: true
3649
+ * });
3650
+ * }
3651
+ * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3652
+ * ```
3653
+ *
3654
+ */
3655
+ async start(appOptions) {
3656
+ this.wire.sendAction('start-application').catch((e) => {
3657
+ // we do not want to expose this error, just continue if this analytics-only call fails
3658
+ });
3659
+ const app = await this._create(appOptions);
3660
+ await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3661
+ return app;
3662
+ }
3663
+ /**
3664
+ * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3665
+ * Returns once the RVM is finished attempting to launch the applications.
3666
+ * @param opts - Parameters that the RVM will use.
3667
+ *
3668
+ * @example
3669
+ *
3670
+ * ```js
3671
+ *
3672
+ * const applicationInfoArray = [
3673
+ * {
3674
+ * "uuid": 'App-1',
3675
+ * "manifestUrl": 'http://localhost:5555/app1.json',
3676
+ * },
3677
+ * {
3678
+ * "uuid": 'App-2',
3679
+ * "manifestUrl": 'http://localhost:5555/app2.json',
3680
+ * },
3681
+ * {
3682
+ * "uuid": 'App-3',
3683
+ * "manifestUrl": 'http://localhost:5555/app3.json',
3684
+ * }
3685
+ * ]
3686
+ *
3687
+ * fin.Application.startManyManifests(applicationInfoArray)
3688
+ * .then(() => {
3689
+ * console.log('RVM has finished launching the application list.');
3690
+ * })
3691
+ * .catch((err) => {
3692
+ * console.log(err);
3693
+ * })
3694
+ * ```
3695
+ *
3696
+ * @experimental
3697
+ */
3698
+ async startManyManifests(applications, opts) {
3699
+ return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3700
+ }
3701
+ /**
3702
+ * Asynchronously returns an Application object that represents the current application
3703
+ *
3704
+ * @example
3705
+ *
3706
+ * ```js
3707
+ * async function isCurrentAppRunning () {
3708
+ * const app = await fin.Application.getCurrent();
3709
+ * return app.isRunning();
3710
+ * }
3711
+ *
3712
+ * isCurrentAppRunning().then(running => {
3713
+ * console.log(`Current app is running: ${running}`);
3714
+ * }).catch(err => {
3715
+ * console.error(err);
3716
+ * });
3717
+ *
3718
+ * ```
3719
+ */
3720
+ getCurrent() {
3721
+ this.wire.sendAction('get-current-application').catch((e) => {
3722
+ // we do not want to expose this error, just continue if this analytics-only call fails
3723
+ });
3724
+ return this.wrap({ uuid: this.wire.me.uuid });
3725
+ }
3726
+ /**
3727
+ * Synchronously returns an Application object that represents the current application
3728
+ *
3729
+ * @example
3730
+ *
3731
+ * ```js
3732
+ * async function isCurrentAppRunning () {
3733
+ * const app = fin.Application.getCurrentSync();
3734
+ * return app.isRunning();
3735
+ * }
3736
+ *
3737
+ * isCurrentAppRunning().then(running => {
3738
+ * console.log(`Current app is running: ${running}`);
3739
+ * }).catch(err => {
3740
+ * console.error(err);
3741
+ * });
3742
+ *
3743
+ * ```
3744
+ */
3745
+ getCurrentSync() {
3746
+ this.wire.sendAction('get-current-application-sync').catch((e) => {
3747
+ // we do not want to expose this error, just continue if this analytics-only call fails
3748
+ });
3749
+ return this.wrapSync({ uuid: this.wire.me.uuid });
3750
+ }
3751
+ /**
3752
+ * Retrieves application's manifest and returns a running instance of the application.
3753
+ * @param manifestUrl - The URL of app's manifest.
3754
+ * @param opts - Parameters that the RVM will use.
3755
+ *
3756
+ * @example
3757
+ *
3758
+ * ```js
3759
+ * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3760
+ *
3761
+ * // For a local manifest file:
3762
+ * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3763
+ * ```
3764
+ */
3765
+ async startFromManifest(manifestUrl, opts) {
3766
+ this.wire.sendAction('application-start-from-manifest').catch((e) => {
3767
+ // we do not want to expose this error, just continue if this analytics-only call fails
3768
+ });
3769
+ const app = await this._createFromManifest(manifestUrl);
3770
+ // @ts-expect-error using private method without warning.
3771
+ await app._run(opts); // eslint-disable-line no-underscore-dangle
3772
+ return app;
3773
+ }
3774
+ /**
3775
+ * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3776
+ * Retrieves application's manifest and returns a wrapped application.
3777
+ * @param manifestUrl - The URL of app's manifest.
3778
+ * @param callback - called if the method succeeds.
3779
+ * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3780
+ *
3781
+ * @example
3782
+ *
3783
+ * ```js
3784
+ * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3785
+ * ```
3786
+ * @ignore
3787
+ */
3788
+ createFromManifest(manifestUrl) {
3789
+ console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3790
+ this.wire.sendAction('application-create-from-manifest').catch((e) => {
3791
+ // we do not want to expose this error, just continue if this analytics-only call fails
3792
+ });
3793
+ return this._createFromManifest(manifestUrl);
3794
+ }
3795
+ _createFromManifest(manifestUrl) {
3796
+ return this.wire
3797
+ .sendAction('get-application-manifest', { manifestUrl })
3798
+ .then(({ payload }) => {
3799
+ const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3800
+ return this.wrap({ uuid });
3801
+ })
3802
+ .then((app) => {
3803
+ app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3804
+ return app;
3805
+ });
3806
+ }
3542
3807
  }
3808
+ Factory$7.ApplicationModule = ApplicationModule;
3543
3809
 
3544
- var hasRequiredFactory$1;
3545
-
3546
- function requireFactory$1 () {
3547
- if (hasRequiredFactory$1) return Factory$7;
3548
- hasRequiredFactory$1 = 1;
3549
- Object.defineProperty(Factory$7, "__esModule", { value: true });
3550
- Factory$7.ApplicationModule = void 0;
3551
- const base_1 = base;
3552
- const validate_1 = validate;
3553
- const Instance_1 = requireInstance$1();
3810
+ (function (exports) {
3811
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3812
+ if (k2 === undefined) k2 = k;
3813
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3814
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3815
+ desc = { enumerable: true, get: function() { return m[k]; } };
3816
+ }
3817
+ Object.defineProperty(o, k2, desc);
3818
+ }) : (function(o, m, k, k2) {
3819
+ if (k2 === undefined) k2 = k;
3820
+ o[k2] = m[k];
3821
+ }));
3822
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3823
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3824
+ };
3825
+ Object.defineProperty(exports, "__esModule", { value: true });
3554
3826
  /**
3555
- * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3827
+ * Entry points for the OpenFin `Application` API (`fin.Application`).
3828
+ *
3829
+ * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3830
+ * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3831
+ *
3832
+ * 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),
3833
+ * both of these were documented on the same page.
3834
+ *
3835
+ * @packageDocumentation
3556
3836
  */
3557
- class ApplicationModule extends base_1.Base {
3558
- /**
3559
- * Asynchronously returns an API handle for the given Application identity.
3560
- *
3561
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3562
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3563
- * for an Application throughout its entire lifecycle.
3564
- *
3565
- * @example
3566
- *
3567
- * ```js
3568
- * fin.Application.wrap({ uuid: 'testapp' })
3569
- * .then(app => app.isRunning())
3570
- * .then(running => console.log('Application is running: ' + running))
3571
- * .catch(err => console.log(err));
3572
- * ```
3573
- *
3574
- */
3575
- async wrap(identity) {
3576
- this.wire.sendAction('wrap-application').catch((e) => {
3577
- // we do not want to expose this error, just continue if this analytics-only call fails
3578
- });
3579
- const errorMsg = (0, validate_1.validateIdentity)(identity);
3580
- if (errorMsg) {
3581
- throw new Error(errorMsg);
3582
- }
3583
- return new Instance_1.Application(this.wire, identity);
3584
- }
3585
- /**
3586
- * Synchronously returns an API handle for the given Application identity.
3587
- *
3588
- * @remarks Wrapping an Application identity that does not yet exist will *not* throw an error, and instead
3589
- * returns a stub object that cannot yet perform rendering tasks. This can be useful for plumbing eventing
3590
- * for an Aplication throughout its entire lifecycle.
3591
- *
3592
- * @example
3593
- *
3594
- * ```js
3595
- * const app = fin.Application.wrapSync({ uuid: 'testapp' });
3596
- * await app.close();
3597
- * ```
3598
- *
3599
- */
3600
- wrapSync(identity) {
3601
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3602
- // we do not want to expose this error, just continue if this analytics-only call fails
3603
- });
3604
- const errorMsg = (0, validate_1.validateIdentity)(identity);
3605
- if (errorMsg) {
3606
- throw new Error(errorMsg);
3607
- }
3608
- return new Instance_1.Application(this.wire, identity);
3609
- }
3610
- async _create(appOptions) {
3611
- // set defaults:
3612
- if (appOptions.waitForPageLoad === undefined) {
3613
- appOptions.waitForPageLoad = false;
3614
- }
3615
- if (appOptions.autoShow === undefined && appOptions.isPlatformController === undefined) {
3616
- appOptions.autoShow = true;
3617
- }
3618
- await this.wire.sendAction('create-application', appOptions);
3619
- return this.wrap({ uuid: appOptions.uuid });
3620
- }
3621
- /**
3622
- * DEPRECATED method to create a new Application. Use {@link Application.ApplicationModule.start Application.start} instead.
3623
- *
3624
- * @example
3625
- *
3626
- * ```js
3627
- * async function createApp() {
3628
- * const app = await fin.Application.create({
3629
- * name: 'myApp',
3630
- * uuid: 'app-3',
3631
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.create.html',
3632
- * autoShow: true
3633
- * });
3634
- * await app.run();
3635
- * }
3636
- *
3637
- * createApp().then(() => console.log('Application is created')).catch(err => console.log(err));
3638
- * ```
3639
- *
3640
- * @ignore
3641
- */
3642
- create(appOptions) {
3643
- console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3644
- this.wire.sendAction('application-create').catch((e) => {
3645
- // we do not want to expose this error, just continue if this analytics-only call fails
3646
- });
3647
- return this._create(appOptions);
3648
- }
3649
- /**
3650
- * Creates and starts a new Application.
3651
- *
3652
- * @example
3653
- *
3654
- * ```js
3655
- * async function start() {
3656
- * return fin.Application.start({
3657
- * name: 'app-1',
3658
- * uuid: 'app-1',
3659
- * url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.start.html',
3660
- * autoShow: true
3661
- * });
3662
- * }
3663
- * start().then(() => console.log('Application is running')).catch(err => console.log(err));
3664
- * ```
3665
- *
3666
- */
3667
- async start(appOptions) {
3668
- this.wire.sendAction('start-application').catch((e) => {
3669
- // we do not want to expose this error, just continue if this analytics-only call fails
3670
- });
3671
- const app = await this._create(appOptions);
3672
- await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3673
- return app;
3674
- }
3675
- /**
3676
- * Asynchronously starts a batch of applications given an array of application identifiers and manifestUrls.
3677
- * Returns once the RVM is finished attempting to launch the applications.
3678
- * @param opts - Parameters that the RVM will use.
3679
- *
3680
- * @example
3681
- *
3682
- * ```js
3683
- *
3684
- * const applicationInfoArray = [
3685
- * {
3686
- * "uuid": 'App-1',
3687
- * "manifestUrl": 'http://localhost:5555/app1.json',
3688
- * },
3689
- * {
3690
- * "uuid": 'App-2',
3691
- * "manifestUrl": 'http://localhost:5555/app2.json',
3692
- * },
3693
- * {
3694
- * "uuid": 'App-3',
3695
- * "manifestUrl": 'http://localhost:5555/app3.json',
3696
- * }
3697
- * ]
3698
- *
3699
- * fin.Application.startManyManifests(applicationInfoArray)
3700
- * .then(() => {
3701
- * console.log('RVM has finished launching the application list.');
3702
- * })
3703
- * .catch((err) => {
3704
- * console.log(err);
3705
- * })
3706
- * ```
3707
- *
3708
- * @experimental
3709
- */
3710
- async startManyManifests(applications, opts) {
3711
- return this.wire.sendAction('run-applications', { applications, opts }).then(() => undefined);
3712
- }
3713
- /**
3714
- * Asynchronously returns an Application object that represents the current application
3715
- *
3716
- * @example
3717
- *
3718
- * ```js
3719
- * async function isCurrentAppRunning () {
3720
- * const app = await fin.Application.getCurrent();
3721
- * return app.isRunning();
3722
- * }
3723
- *
3724
- * isCurrentAppRunning().then(running => {
3725
- * console.log(`Current app is running: ${running}`);
3726
- * }).catch(err => {
3727
- * console.error(err);
3728
- * });
3729
- *
3730
- * ```
3731
- */
3732
- getCurrent() {
3733
- this.wire.sendAction('get-current-application').catch((e) => {
3734
- // we do not want to expose this error, just continue if this analytics-only call fails
3735
- });
3736
- return this.wrap({ uuid: this.wire.me.uuid });
3737
- }
3738
- /**
3739
- * Synchronously returns an Application object that represents the current application
3740
- *
3741
- * @example
3742
- *
3743
- * ```js
3744
- * async function isCurrentAppRunning () {
3745
- * const app = fin.Application.getCurrentSync();
3746
- * return app.isRunning();
3747
- * }
3748
- *
3749
- * isCurrentAppRunning().then(running => {
3750
- * console.log(`Current app is running: ${running}`);
3751
- * }).catch(err => {
3752
- * console.error(err);
3753
- * });
3754
- *
3755
- * ```
3756
- */
3757
- getCurrentSync() {
3758
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3759
- // we do not want to expose this error, just continue if this analytics-only call fails
3760
- });
3761
- return this.wrapSync({ uuid: this.wire.me.uuid });
3762
- }
3763
- /**
3764
- * Retrieves application's manifest and returns a running instance of the application.
3765
- * @param manifestUrl - The URL of app's manifest.
3766
- * @param opts - Parameters that the RVM will use.
3767
- *
3768
- * @example
3769
- *
3770
- * ```js
3771
- * fin.Application.startFromManifest('http://localhost:5555/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3772
- *
3773
- * // For a local manifest file:
3774
- * fin.Application.startFromManifest('file:///C:/somefolder/app.json').then(app => console.log('App is running')).catch(err => console.log(err));
3775
- * ```
3776
- */
3777
- async startFromManifest(manifestUrl, opts) {
3778
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3779
- // we do not want to expose this error, just continue if this analytics-only call fails
3780
- });
3781
- const app = await this._createFromManifest(manifestUrl);
3782
- // @ts-expect-error using private method without warning.
3783
- await app._run(opts); // eslint-disable-line no-underscore-dangle
3784
- return app;
3785
- }
3786
- /**
3787
- * @deprecated Use {@link Application.ApplicationModule.startFromManifest Application.startFromManifest} instead.
3788
- * Retrieves application's manifest and returns a wrapped application.
3789
- * @param manifestUrl - The URL of app's manifest.
3790
- * @param callback - called if the method succeeds.
3791
- * @param errorCallback - called if the method fails. The reason for failure is passed as an argument.
3792
- *
3793
- * @example
3794
- *
3795
- * ```js
3796
- * fin.Application.createFromManifest('http://localhost:5555/app.json').then(app => console.log(app)).catch(err => console.log(err));
3797
- * ```
3798
- * @ignore
3799
- */
3800
- createFromManifest(manifestUrl) {
3801
- console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3802
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3803
- // we do not want to expose this error, just continue if this analytics-only call fails
3804
- });
3805
- return this._createFromManifest(manifestUrl);
3806
- }
3807
- _createFromManifest(manifestUrl) {
3808
- return this.wire
3809
- .sendAction('get-application-manifest', { manifestUrl })
3810
- .then(({ payload }) => {
3811
- const uuid = payload.data.platform ? payload.data.platform.uuid : payload.data.startup_app.uuid;
3812
- return this.wrap({ uuid });
3813
- })
3814
- .then((app) => {
3815
- app._manifestUrl = manifestUrl; // eslint-disable-line no-underscore-dangle
3816
- return app;
3817
- });
3818
- }
3819
- }
3820
- Factory$7.ApplicationModule = ApplicationModule;
3821
- return Factory$7;
3822
- }
3823
-
3824
- var hasRequiredApplication;
3825
-
3826
- function requireApplication () {
3827
- if (hasRequiredApplication) return application;
3828
- hasRequiredApplication = 1;
3829
- (function (exports) {
3830
- var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3831
- if (k2 === undefined) k2 = k;
3832
- var desc = Object.getOwnPropertyDescriptor(m, k);
3833
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3834
- desc = { enumerable: true, get: function() { return m[k]; } };
3835
- }
3836
- Object.defineProperty(o, k2, desc);
3837
- }) : (function(o, m, k, k2) {
3838
- if (k2 === undefined) k2 = k;
3839
- o[k2] = m[k];
3840
- }));
3841
- var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3842
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3843
- };
3844
- Object.defineProperty(exports, "__esModule", { value: true });
3845
- /**
3846
- * Entry points for the OpenFin `Application` API (`fin.Application`).
3847
- *
3848
- * * {@link ApplicationModule} contains static members of the `Application` API, accessible through `fin.Application`.
3849
- * * {@link Application} describes an instance of an OpenFin Application, e.g. as returned by `fin.Application.getCurrent`.
3850
- *
3851
- * 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),
3852
- * both of these were documented on the same page.
3853
- *
3854
- * @packageDocumentation
3855
- */
3856
- __exportStar(requireFactory$1(), exports);
3857
- __exportStar(requireInstance$1(), exports);
3858
- } (application));
3859
- return application;
3860
- }
3837
+ __exportStar(Factory$7, exports);
3838
+ __exportStar(Instance$6, exports);
3839
+ } (application));
3861
3840
 
3862
3841
  var promisifySubscription$1 = {};
3863
3842
 
@@ -3901,7 +3880,7 @@ function requireInstance () {
3901
3880
  /* eslint-disable @typescript-eslint/no-unused-vars */
3902
3881
  /* eslint-disable no-console */
3903
3882
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3904
- const application_1 = requireApplication();
3883
+ const application_1 = application;
3905
3884
  const main_1 = main;
3906
3885
  const view_1 = requireView();
3907
3886
  const warnings_1 = warnings;
@@ -17498,7 +17477,7 @@ const events_1$3 = require$$0;
17498
17477
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17499
17478
  const index_1 = system;
17500
17479
  const index_2 = requireWindow();
17501
- const index_3 = requireApplication();
17480
+ const index_3 = application;
17502
17481
  const index_4 = interappbus;
17503
17482
  const index_5 = clipboard;
17504
17483
  const index_6 = externalApplication;