@openfin/core 44.100.24 → 44.100.26

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.
package/out/stub.js CHANGED
@@ -332,35 +332,6 @@ var system = {};
332
332
 
333
333
  var base = {};
334
334
 
335
- var promises = {};
336
-
337
- Object.defineProperty(promises, "__esModule", { value: true });
338
- promises.promiseMapSerial = promises.serial = promises.promiseMap = promises.promisify = void 0;
339
- function promisify(func) {
340
- return (...args) => new Promise((resolve, reject) => {
341
- func(...args, (err, val) => (err ? reject(err) : resolve(val)));
342
- });
343
- }
344
- promises.promisify = promisify;
345
- async function promiseMap(arr, asyncF) {
346
- return Promise.all(arr.map(asyncF));
347
- }
348
- promises.promiseMap = promiseMap;
349
- async function serial(arr) {
350
- const ret = [];
351
- for (const func of arr) {
352
- // eslint-disable-next-line no-await-in-loop
353
- const next = await func();
354
- ret.push(next);
355
- }
356
- return ret;
357
- }
358
- promises.serial = serial;
359
- async function promiseMapSerial(arr, func) {
360
- return serial(arr.map((value, index, array) => () => func(value, index, array)));
361
- }
362
- promises.promiseMapSerial = promiseMapSerial;
363
-
364
335
  var __classPrivateFieldSet$h = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
365
336
  if (kind === "m") throw new TypeError("Private method is not writable");
366
337
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -375,7 +346,6 @@ var __classPrivateFieldGet$i = (commonjsGlobal && commonjsGlobal.__classPrivateF
375
346
  var _EmitterBase_emitterAccessor, _EmitterBase_deregisterOnceListeners;
376
347
  Object.defineProperty(base, "__esModule", { value: true });
377
348
  base.Reply = base.EmitterBase = base.Base = void 0;
378
- const promises_1 = promises;
379
349
  class Base {
380
350
  /**
381
351
  * @internal
@@ -453,27 +423,8 @@ class EmitterBase extends Base {
453
423
  return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
454
424
  };
455
425
  this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
456
- /**
457
- * Cleans up after removal of a listener, e.g. deleting any lingering deregistration handlers for a
458
- * `once` subscription.
459
- *
460
- * @remarks Implementing this as a `removeListener` handler ensures that direct removal of a listener
461
- * on the base emitter will not leak additional core handlers. We could do this in the forwarding method,
462
- * which would involve less "magic," but would be more-vulnerable to accidental re-introduction of a leak.
463
- */
464
- this.cleanUpRemovedListener = (eventType, listener) => {
465
- const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
466
- if (deregister) {
467
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
468
- emitter.removeListener(eventType, deregister);
469
- }
470
- };
471
426
  this.getOrCreateEmitter = () => {
472
- const emitter = this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
473
- if (!emitter.listeners('removeListener').includes(this.cleanUpRemovedListener)) {
474
- emitter.on('removeListener', this.cleanUpRemovedListener);
475
- }
476
- return emitter;
427
+ return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
477
428
  };
478
429
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
479
430
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
@@ -513,7 +464,6 @@ class EmitterBase extends Base {
513
464
  };
514
465
  __classPrivateFieldSet$h(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
515
466
  __classPrivateFieldSet$h(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
516
- this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
517
467
  }
518
468
  /**
519
469
  * Adds a listener to the end of the listeners array for the specified event.
@@ -591,6 +541,10 @@ class EmitterBase extends Base {
591
541
  const emitter = await this.deregisterEventListener(eventType, options);
592
542
  if (emitter) {
593
543
  emitter.removeListener(eventType, listener);
544
+ const deregister = __classPrivateFieldGet$i(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
545
+ if (deregister) {
546
+ emitter.removeListener(eventType, deregister);
547
+ }
594
548
  this.deleteEmitterIfNothingRegistered(emitter);
595
549
  }
596
550
  return this;
@@ -626,12 +580,13 @@ class EmitterBase extends Base {
626
580
  }
627
581
  else if (this.hasEmitter()) {
628
582
  const events = this.getOrCreateEmitter().eventNames();
629
- await (0, promises_1.promiseMap)(events, removeByEvent);
583
+ await Promise.all(events.map(removeByEvent));
630
584
  }
631
585
  return this;
632
586
  }
633
587
  deleteEmitterIfNothingRegistered(emitter) {
634
- if (emitter.eventNames().every((type) => type === 'removeListener')) {
588
+ // TODO: maybe emitterMap should clean up itself..
589
+ if (emitter.eventNames().length === 0) {
635
590
  this.wire.eventAggregator.delete(__classPrivateFieldGet$i(this, _EmitterBase_emitterAccessor, "f"));
636
591
  }
637
592
  }
@@ -864,11 +819,11 @@ const handleDeprecatedWarnings = (options) => {
864
819
  };
865
820
  warnings.handleDeprecatedWarnings = handleDeprecatedWarnings;
866
821
 
867
- var hasRequiredFactory$1;
822
+ var hasRequiredFactory$2;
868
823
 
869
- function requireFactory$1 () {
870
- if (hasRequiredFactory$1) return Factory$6;
871
- hasRequiredFactory$1 = 1;
824
+ function requireFactory$2 () {
825
+ if (hasRequiredFactory$2) return Factory$6;
826
+ hasRequiredFactory$2 = 1;
872
827
  Object.defineProperty(Factory$6, "__esModule", { value: true });
873
828
  Factory$6.ViewModule = void 0;
874
829
  const base_1 = base;
@@ -1083,8 +1038,8 @@ var main = {};
1083
1038
 
1084
1039
  Object.defineProperty(main, "__esModule", { value: true });
1085
1040
  main.WebContents = void 0;
1086
- const base_1$p = base;
1087
- class WebContents extends base_1$p.EmitterBase {
1041
+ const base_1$n = base;
1042
+ class WebContents extends base_1$n.EmitterBase {
1088
1043
  /**
1089
1044
  * @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
1090
1045
  * @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
@@ -2165,11 +2120,11 @@ class WebContents extends base_1$p.EmitterBase {
2165
2120
  }
2166
2121
  main.WebContents = WebContents;
2167
2122
 
2168
- var hasRequiredInstance$1;
2123
+ var hasRequiredInstance$2;
2169
2124
 
2170
- function requireInstance$1 () {
2171
- if (hasRequiredInstance$1) return Instance$5;
2172
- hasRequiredInstance$1 = 1;
2125
+ function requireInstance$2 () {
2126
+ if (hasRequiredInstance$2) return Instance$5;
2127
+ hasRequiredInstance$2 = 1;
2173
2128
  var _View_providerChannelClient;
2174
2129
  Object.defineProperty(Instance$5, "__esModule", { value: true });
2175
2130
  Instance$5.View = void 0;
@@ -2749,1139 +2704,1160 @@ function requireView () {
2749
2704
  *
2750
2705
  * @packageDocumentation
2751
2706
  */
2752
- __exportStar(requireFactory$1(), exports);
2753
- __exportStar(requireInstance$1(), exports);
2707
+ __exportStar(requireFactory$2(), exports);
2708
+ __exportStar(requireInstance$2(), exports);
2754
2709
  } (view));
2755
2710
  return view;
2756
2711
  }
2757
2712
 
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$o = 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$o.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;
2713
+ var hasRequiredInstance$1;
3581
2714
 
3582
- Object.defineProperty(Factory$7, "__esModule", { value: true });
3583
- Factory$7.ApplicationModule = void 0;
3584
- const base_1$n = 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$n.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
- }
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;
3852
3542
  }
3853
- Factory$7.ApplicationModule = ApplicationModule;
3854
3543
 
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 });
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();
3871
3554
  /**
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
3555
+ * Static namespace for OpenFin API methods that interact with the {@link Application} class, available under `fin.Application`.
3881
3556
  */
3882
- __exportStar(Factory$7, exports);
3883
- __exportStar(Instance$6, exports);
3884
- } (application));
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
+ }
3885
3861
 
3886
3862
  var promisifySubscription$1 = {};
3887
3863
 
@@ -3925,7 +3901,7 @@ function requireInstance () {
3925
3901
  /* eslint-disable @typescript-eslint/no-unused-vars */
3926
3902
  /* eslint-disable no-console */
3927
3903
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
3928
- const application_1 = application;
3904
+ const application_1 = requireApplication();
3929
3905
  const main_1 = main;
3930
3906
  const view_1 = requireView();
3931
3907
  const warnings_1 = warnings;
@@ -17522,7 +17498,7 @@ const events_1$3 = require$$0;
17522
17498
  // Import from the file rather than the directory in case someone consuming types is using module resolution other than "node"
17523
17499
  const index_1 = system;
17524
17500
  const index_2 = requireWindow();
17525
- const index_3 = application;
17501
+ const index_3 = requireApplication();
17526
17502
  const index_4 = interappbus;
17527
17503
  const index_5 = clipboard;
17528
17504
  const index_6 = externalApplication;