@interopio/desktop 6.13.0 → 6.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,3 +1,13 @@
1
+ 6.14.0
2
+ - feat: windows - add dragMove method
3
+ - feat: windows - add clearPlacement method
4
+ - feat: windows - configure method now accepts a new option - showInTaskbar
5
+ - feat: layouts - add onDefaultGlobalChanged event
6
+ - feat: layouts - onRenamed event now receives the old name as a second argument
7
+ - feat: layouts - add new options to the save method - ignoreContexts
8
+ - bugfix: appManager - fix hangs on initialization with appManager: "full" outside platform
9
+ 6.13.1
10
+ - fix: windows - group.onClosing throws an unhandledrejection error when the group is closed before the event is subscribed
1
11
  6.13.0
2
12
  - feat: windows - group.reload method added
3
13
  6.12.0
package/desktop.d.ts CHANGED
@@ -1651,6 +1651,8 @@ export declare namespace IOConnectDesktop {
1651
1651
  activityType?: string;
1652
1652
  /** If `true`, multiple instances of the app can be started. */
1653
1653
  allowMultiple?: boolean;
1654
+ /** Whether to register the iodesktop object in the global window context. */
1655
+ registerIoDesktop?: boolean;
1654
1656
  }
1655
1657
 
1656
1658
  /** @ignore */
@@ -2116,11 +2118,20 @@ export declare namespace IOConnectDesktop {
2116
2118
  */
2117
2119
  onChanged(callback: (layout: Layout) => void): UnsubscribeFunction;
2118
2120
 
2121
+ /**
2122
+ * Notifies when a new default Global Layout has been selected or when the current one has been cleared.
2123
+ * @param callback Callback function for handling the event. Receives as an argument an object with a `name` property
2124
+ * holding the name of the newly selected default Global Layout. If the default Global Layout has been cleared, the argument will be `undefined`.
2125
+ */
2126
+ onDefaultGlobalChanged(callback: (layout?: { name: string }) => void): UnsubscribeFunction;
2127
+
2119
2128
  /**
2120
2129
  * Notifies when a Layout is renamed.
2121
2130
  * @param callback Callback function for handling the event.
2131
+ * Receives as a first argument the `Layout` object describing the renamed Layout.
2132
+ * Receives as a second argument an object with a `name` property holding the previous Layout name.
2122
2133
  */
2123
- onRenamed(callback: (layout: Layout) => void): UnsubscribeFunction;
2134
+ onRenamed(callback: (layout: Layout, previous: { name: string }) => void): UnsubscribeFunction;
2124
2135
 
2125
2136
  /**
2126
2137
  * Notifies when a Layout is restored.
@@ -2403,6 +2414,14 @@ export declare namespace IOConnectDesktop {
2403
2414
  * @ignore
2404
2415
  */
2405
2416
  ignoreMyInstance?: boolean;
2417
+
2418
+ /**
2419
+ * If `true`, the context objects of individual io.Connect Windows and Workspaces participating in the Global Layout won't be saved when the Layout is saved.
2420
+ * You can still use the `context` property to provide context data to be saved for the Global Layout itself.
2421
+ * Valid only for Global Layouts.
2422
+ * *Available since io.Connect Desktop 9.9.*
2423
+ */
2424
+ ignoreContexts?: boolean;
2406
2425
  }
2407
2426
 
2408
2427
  /**
@@ -3865,6 +3884,24 @@ export declare namespace IOConnectDesktop {
3865
3884
  * @default "onDemand"
3866
3885
  */
3867
3886
  buttonsVisibility?: "off" | "onDemand" | "always" | "onFocus";
3887
+
3888
+ /**
3889
+ * If `true`, the window icon will appear in the taskbar.",
3890
+ * @since io.Connect Desktop 9.9
3891
+ */
3892
+ showInTaskbar?: boolean;
3893
+
3894
+ /**
3895
+ * Settings for searching in web apps.
3896
+ * @since io.Connect Desktop 9.9
3897
+ */
3898
+ search?: {
3899
+ /**
3900
+ * If `true`, will enable searching in web apps with `CTRL + F`.
3901
+ * @default true
3902
+ */
3903
+ enabled?: boolean;
3904
+ };
3868
3905
  }
3869
3906
 
3870
3907
  /**
@@ -4090,6 +4127,13 @@ export declare namespace IOConnectDesktop {
4090
4127
  */
4091
4128
  snapped: boolean;
4092
4129
 
4130
+ /**
4131
+ * If `true`, the last known bounds of the io.Connect Window will be saved unless the window has already been snapped.
4132
+ * This allows the window to be restored using these saved bounds when clearing the placement settings for the window via the `clearPlacement()` method.
4133
+ * @since io.Connect Desktop 9.9
4134
+ */
4135
+ saveBounds?: boolean;
4136
+
4093
4137
  /**
4094
4138
  * Vertical alignment for the placed window. If `horizontalAlignment` is set, then `verticalAlignment` will default to "stretch".
4095
4139
  */
@@ -4142,6 +4186,21 @@ export declare namespace IOConnectDesktop {
4142
4186
  display?: IOConnectDesktop.Displays.Display | "current";
4143
4187
  }
4144
4188
 
4189
+ /**
4190
+ * Settings for clearing the window placement.
4191
+ */
4192
+ export interface ClearPlacementSettings {
4193
+ /**
4194
+ * If `true`, the io.Connect Window will be restored to its last known bounds saved in the `place()` method if `saveBounds` has been set to `true`.
4195
+ */
4196
+ restoreBounds?: boolean;
4197
+
4198
+ /**
4199
+ * New bounds for the io.Connect Window. If this is provided, the `restoreBounds` property will be ignored.
4200
+ */
4201
+ newBounds?: Partial<Bounds>;
4202
+ }
4203
+
4145
4204
  /**
4146
4205
  * Modes for flashing the window icon in the taskbar:
4147
4206
  * - `"auto"` - the icon will flash only if the window isn't on focus and will stop flashing when the window is activated;
@@ -4661,7 +4720,24 @@ export declare namespace IOConnectDesktop {
4661
4720
  */
4662
4721
  value?: string;
4663
4722
  }
4664
-
4723
+ /**
4724
+ * Options for dragging a window.
4725
+ */
4726
+ export interface DragMoveOptions {
4727
+ /**
4728
+ * Location of the mouse cursor within the window at the time the dragging operation was initiated.
4729
+ */
4730
+ location?: {
4731
+ /**
4732
+ * Horizontal coordinate of the mouse cursor within the window in pixels. Relative to the left border of the io.Connect Window.
4733
+ */
4734
+ x: number;
4735
+ /**
4736
+ * Vertical coordinate of the mouse cursor within the window in pixels. Relative to the top border of the io.Connect Window.
4737
+ */
4738
+ y: number;
4739
+ }
4740
+ }
4665
4741
  /**
4666
4742
  * Describes a docked window.
4667
4743
  */
@@ -5491,6 +5567,16 @@ export declare namespace IOConnectDesktop {
5491
5567
  */
5492
5568
  snap(target: string | IOConnectWindow, options?: SnappingOptions | RelativeDirection, success?: (window: IOConnectWindow) => void, error?: (error: string) => void): Promise<IOConnectWindow>;
5493
5569
 
5570
+ /**
5571
+ * This method can be used to start dragging the window with the mouse when the left mouse button is pressed.
5572
+ * @param options Options for dragging the window. Use this argument to optionally provide the location of the mouse cursor within the window
5573
+ * at the time the dragging operation was initiated. The platform will use that location to place the window under the mouse cursor when the mouse is moving
5574
+ * (e.g., in case the mouse has already moved several pixels in any direction before the dragging operation has been initiated by the platform).
5575
+ * If the starting mouse location isn't specified, its current position will be used.
5576
+ * @since io.Connect Desktop 9.9
5577
+ */
5578
+ dragMove(options?: DragMoveOptions): Promise<void>;
5579
+
5494
5580
  /**
5495
5581
  * Shows a loader animation for the window or updates the loader properties (animation type, background or text).
5496
5582
  * @param options Settings for the loader animation.
@@ -5728,6 +5814,14 @@ export declare namespace IOConnectDesktop {
5728
5814
  */
5729
5815
  place(options: PlacementSettings): Promise<void>;
5730
5816
 
5817
+ /**
5818
+ * Clears the window placement settings.
5819
+ * This means that the window will no longer be automatically snapped to a specific position on the display in case of resolution, scaling, and monitor changes.
5820
+ * @param options Settings for clearing the window placement.
5821
+ * @since io.Connect Desktop 9.9
5822
+ */
5823
+ clearPlacement(options?: ClearPlacementSettings): Promise<void>;
5824
+
5731
5825
  /**
5732
5826
  * Makes the window navigate back to the previous web page.
5733
5827
  */
@@ -7646,6 +7740,11 @@ export declare namespace IOConnectDesktop {
7646
7740
  * If `true`, will enable showing a notification badge on the tray menu icon, in the "Notifications" section of the io.Connect launcher, and on the taskbar icon of the io.Connect launcher (or your shell app).
7647
7741
  */
7648
7742
  showNotificationBadge?: boolean;
7743
+
7744
+ /**
7745
+ * If `true`, the Notification Panel will be hidden automatically when it loses focus.
7746
+ */
7747
+ autoHidePanel?: boolean;
7649
7748
  }
7650
7749
 
7651
7750
  /**
@@ -11702,6 +11702,9 @@
11702
11702
  height: a.height
11703
11703
  };
11704
11704
  }
11705
+ static isRunningInIoCdContext() {
11706
+ return typeof window !== "undefined" && (window.glue42gd || window.iodesktop);
11707
+ }
11705
11708
  static isNode() {
11706
11709
  if (typeof Utils._isNode !== "undefined") {
11707
11710
  return Utils._isNode;
@@ -12689,24 +12692,23 @@
12689
12692
  .forEach((item) => entitlements.handleBranchesModified(item));
12690
12693
  if (!initiated) {
12691
12694
  initiated = true;
12692
- const hasMyAppInSnapShot = onApplicationAddedEventArgs.some((a) => a.Name === agm.instance.application);
12693
- const hasMyInstanceInSnapShot = onApplicationStartedEventArgs.some((i) => i.Id === agm.instance.instance);
12694
- if (hasMyAppInSnapShot) {
12695
- if (hasMyInstanceInSnapShot) {
12696
- resolveFunc(configuration);
12697
- }
12698
- else {
12699
- const un = applications.onInstanceStarted((i) => {
12700
- if (i.id === agm.instance.instance) {
12701
- un();
12702
- resolveFunc(configuration);
12703
- }
12704
- });
12705
- }
12706
- }
12707
- else {
12695
+ const myInstance = agm.instance;
12696
+ const hasMyAppInSnapShot = onApplicationAddedEventArgs.some((a) => a.Name === myInstance.application);
12697
+ const hasMyInstanceInSnapShot = onApplicationStartedEventArgs.some((i) => i.Id === myInstance.instance);
12698
+ if (!hasMyAppInSnapShot) {
12708
12699
  resolveFunc(configuration);
12700
+ return;
12701
+ }
12702
+ if (!hasMyInstanceInSnapShot && (Utils.isNode() || Utils.isRunningInIoCdContext())) {
12703
+ const un = applications.onInstanceStarted((i) => {
12704
+ if (i.id === myInstance.instance) {
12705
+ un();
12706
+ resolveFunc(configuration);
12707
+ }
12708
+ });
12709
+ return;
12709
12710
  }
12711
+ resolveFunc(configuration);
12710
12712
  }
12711
12713
  });
12712
12714
  subscription.onFailed((err) => rejectFunc(err));
@@ -13511,6 +13513,9 @@
13511
13513
  return executor.snap(resultWindow, target, direction);
13512
13514
  }, success, error);
13513
13515
  }
13516
+ function dragMove(dragMoveSettings) {
13517
+ return executor.dragMove(resultWindow, dragMoveSettings);
13518
+ }
13514
13519
  function attachTab(tab, opt, success, error) {
13515
13520
  return Utils.callbackifyPromise(() => {
13516
13521
  var _a;
@@ -13740,6 +13745,9 @@
13740
13745
  function place(placementSettings) {
13741
13746
  return executor.place(resultWindow, placementSettings);
13742
13747
  }
13748
+ function clearPlacement(clearPlacementSettings) {
13749
+ return executor.clearPlacement(resultWindow, clearPlacementSettings);
13750
+ }
13743
13751
  function refresh(ignoreCache) {
13744
13752
  return executor.refresh(resultWindow, ignoreCache);
13745
13753
  }
@@ -14493,6 +14501,7 @@
14493
14501
  center,
14494
14502
  close,
14495
14503
  snap,
14504
+ dragMove,
14496
14505
  showLoader,
14497
14506
  hideLoader,
14498
14507
  updateContext,
@@ -14523,6 +14532,7 @@
14523
14532
  print,
14524
14533
  printToPDF,
14525
14534
  place,
14535
+ clearPlacement,
14526
14536
  ungroup,
14527
14537
  refresh,
14528
14538
  goBack,
@@ -15006,6 +15016,9 @@
15006
15016
  await this.execute("snap", { windowId: w.id, options: args }, "CompositionChanged", `CompositionChanged-${targetWindow.id}`);
15007
15017
  return w;
15008
15018
  }
15019
+ dragMove(window, options) {
15020
+ return this.execute("dragMove", { windowId: window.id, options });
15021
+ }
15009
15022
  async attachTab(w, sourceWindow, options) {
15010
15023
  await this.execute("attachTab", {
15011
15024
  windowId: w.id,
@@ -15266,6 +15279,9 @@
15266
15279
  }
15267
15280
  return this.execute("place", { windowId: window.id, options: { ...copy } });
15268
15281
  }
15282
+ async clearPlacement(window, options) {
15283
+ return this.execute("clearPlacement", { windowId: window.id, options });
15284
+ }
15269
15285
  async refresh(resultWindow, ignoreCache) {
15270
15286
  await this.execute("refresh", { windowId: resultWindow.id, options: { ignoreCache } });
15271
15287
  return resultWindow;
@@ -15412,6 +15428,8 @@
15412
15428
  }
15413
15429
  nonWindowHandlersCore(targetId, type, isGroup, callback) {
15414
15430
  const id = `${targetId}-${type}`;
15431
+ const noOperationHandler = () => {
15432
+ };
15415
15433
  const unsub = () => {
15416
15434
  var _a;
15417
15435
  if (this.unsubCallbacks[id]) {
@@ -15430,13 +15448,13 @@
15430
15448
  this.executeGroup(type, {
15431
15449
  groupId: targetId,
15432
15450
  options
15433
- });
15451
+ }).catch(noOperationHandler);
15434
15452
  }
15435
15453
  else {
15436
15454
  this.execute(type, {
15437
15455
  windowId: targetId,
15438
15456
  options
15439
- });
15457
+ }).catch(noOperationHandler);
15440
15458
  }
15441
15459
  }
15442
15460
  };
@@ -15448,10 +15466,10 @@
15448
15466
  this.unsubCallbacks[id] = [callback];
15449
15467
  }
15450
15468
  if (isGroup) {
15451
- this.executeGroup(type, { groupId: targetId });
15469
+ this.executeGroup(type, { groupId: targetId }).catch(noOperationHandler);
15452
15470
  }
15453
15471
  else {
15454
- this.execute(type, { windowId: targetId });
15472
+ this.execute(type, { windowId: targetId }).catch(noOperationHandler);
15455
15473
  }
15456
15474
  return unsub;
15457
15475
  }
@@ -16926,7 +16944,8 @@
16926
16944
  }
16927
16945
  registerRequestMethods() {
16928
16946
  this.interop.register(SaveContextMethodName, (args) => {
16929
- const usersCbs = this.callbacks.execute("saveRequested", args);
16947
+ const { ignoreContexts, ...cbArgs } = args;
16948
+ const usersCbs = this.callbacks.execute("saveRequested", cbArgs);
16930
16949
  if ((usersCbs === null || usersCbs === void 0 ? void 0 : usersCbs.length) > 1) {
16931
16950
  this.logger.warn(`Multiple subscriptions for "glue.layouts.onSaveRequested" - only the first one will be used`);
16932
16951
  }
@@ -16942,7 +16961,7 @@
16942
16961
  if (this.isActivityOwner()) {
16943
16962
  result.activityContext = requestResult === null || requestResult === void 0 ? void 0 : requestResult.activityContext;
16944
16963
  }
16945
- return result;
16964
+ return ignoreContexts ? { windowContext: undefined, activityContext: undefined } : result;
16946
16965
  });
16947
16966
  }
16948
16967
  }
@@ -17148,6 +17167,9 @@
17148
17167
  if (typeof layout.setAsCurrent === "boolean") {
17149
17168
  layoutObject.options.setAsCurrent = layout.setAsCurrent;
17150
17169
  }
17170
+ if (typeof layout.ignoreContexts === "boolean") {
17171
+ layoutObject.options.ignoreContexts = layout.ignoreContexts;
17172
+ }
17151
17173
  }
17152
17174
  else {
17153
17175
  return reject(new Error(`layout type ${layout.type} is not supported`));
@@ -17399,6 +17421,16 @@
17399
17421
  onChanged(callback) {
17400
17422
  return this.callbacks.add("changed", callback);
17401
17423
  }
17424
+ onDefaultGlobalChanged(callback) {
17425
+ if (typeof callback !== "function") {
17426
+ throw new Error("callback must be a function");
17427
+ }
17428
+ this.getDefaultGlobal()
17429
+ .then((layout) => callback(layout ? { name: layout.name } : undefined))
17430
+ .catch(() => {
17431
+ });
17432
+ return this.callbacks.add("default-changed", callback);
17433
+ }
17402
17434
  onRestored(callback) {
17403
17435
  return this.callbacks.add("restored", callback);
17404
17436
  }
@@ -17584,6 +17616,8 @@
17584
17616
  this.changeLayouts(transform(data.OnLayoutChanged));
17585
17617
  this.renameLayouts(transform(data.OnLayoutRenamed));
17586
17618
  this.restoredLayout(transform(data.OnLayoutRestored));
17619
+ this.selectedDefaultLayout(transform(data.OnLayoutSelectedDefault), false);
17620
+ this.selectedDefaultLayout(transform(data.OnLayoutDeselectedDefault), true);
17587
17621
  this.callbacks.execute("streamEvent", data);
17588
17622
  });
17589
17623
  subs.onFailed((err) => {
@@ -17618,7 +17652,7 @@
17618
17652
  });
17619
17653
  setTimeout(() => {
17620
17654
  if (!done) {
17621
- reject("timed out");
17655
+ reject(new Error(`Timeout waiting for token ${token}`));
17622
17656
  }
17623
17657
  }, timeout);
17624
17658
  });
@@ -17684,7 +17718,7 @@
17684
17718
  throw Error(`received rename event for unknown layout with type ${renamedLayout.type} and name ${renamedLayout.oldName}`);
17685
17719
  }
17686
17720
  existingLayout.name = renamedLayout.newName;
17687
- this.callbacks.execute("renamed", existingLayout);
17721
+ this.callbacks.execute("renamed", existingLayout, { name: renamedLayout.oldName });
17688
17722
  });
17689
17723
  }
17690
17724
  compareLayouts(layout1, layout2) {
@@ -17705,6 +17739,17 @@
17705
17739
  this.callbacks.execute("restored", existingLayout);
17706
17740
  });
17707
17741
  }
17742
+ selectedDefaultLayout(selectedDefaultLayouts, deselected) {
17743
+ if (!selectedDefaultLayouts || selectedDefaultLayouts.length === 0) {
17744
+ return;
17745
+ }
17746
+ if (deselected) {
17747
+ this.callbacks.execute("default-changed", undefined);
17748
+ }
17749
+ else {
17750
+ this.callbacks.execute("default-changed", selectedDefaultLayouts[0]);
17751
+ }
17752
+ }
17708
17753
  }
17709
17754
 
17710
17755
  function LayoutsFactory (config) {
@@ -19181,7 +19226,7 @@
19181
19226
  };
19182
19227
  }
19183
19228
 
19184
- var version = "6.13.0";
19229
+ var version = "6.14.0";
19185
19230
 
19186
19231
  var prepareConfig = (options) => {
19187
19232
  function getLibConfig(value, defaultMode, trueMode) {