@openfin/node-adapter 41.100.73 → 41.100.79

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