@openfin/core 42.100.10 → 42.100.12

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