@interopio/desktop 6.0.1 → 6.1.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.
@@ -3613,7 +3613,7 @@ var ContextMessageReplaySpec = {
3613
3613
  }
3614
3614
  };
3615
3615
 
3616
- var version$2 = "6.0.2";
3616
+ var version$2 = "6.1.0";
3617
3617
 
3618
3618
  function prepareConfig$1 (configuration, ext, glue42gd) {
3619
3619
  var _a, _b, _c, _d;
@@ -14129,10 +14129,12 @@ class WindowStore {
14129
14129
  }
14130
14130
  waitFor(id) {
14131
14131
  return new Promise((resolve, reject) => {
14132
- let un;
14132
+ let unReady;
14133
+ let unRemoved;
14133
14134
  const timeout = setTimeout(() => {
14134
- un();
14135
- reject("waitFor timed out.");
14135
+ unReady();
14136
+ unRemoved();
14137
+ reject(`Window with id "${id}" was not ready within ${this.waitForTimeoutInMilliseconds} milliseconds.`);
14136
14138
  }, this.waitForTimeoutInMilliseconds);
14137
14139
  const win = this._windows[id];
14138
14140
  if (win) {
@@ -14140,14 +14142,25 @@ class WindowStore {
14140
14142
  resolve(win);
14141
14143
  }
14142
14144
  else {
14143
- un = this.onReadyWindow((w) => {
14145
+ const cleanup = () => {
14146
+ clearTimeout(timeout);
14147
+ unReady();
14148
+ unRemoved();
14149
+ };
14150
+ unReady = this.onReadyWindow((w) => {
14144
14151
  if (w.API.id !== id) {
14145
14152
  return;
14146
14153
  }
14147
- clearTimeout(timeout);
14148
- un();
14154
+ cleanup();
14149
14155
  resolve(w);
14150
14156
  });
14157
+ unRemoved = this.onRemoved((w) => {
14158
+ if (w.API.id !== id) {
14159
+ return;
14160
+ }
14161
+ cleanup();
14162
+ reject(`Window with id "${id}" was removed before it became ready.`);
14163
+ });
14151
14164
  }
14152
14165
  });
14153
14166
  }
@@ -14361,6 +14374,8 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
14361
14374
  let _groupId = options.groupId;
14362
14375
  let _isGroupHeaderVisible = options.isGroupHeaderVisible;
14363
14376
  let _isTabHeaderVisible = options.isTabHeaderVisible;
14377
+ let _isGroupHibernated = options.isGroupHibernated;
14378
+ let _isGroupVisible = options.isGroupVisible;
14364
14379
  let _isTabSelected = (_c = options.isTabSelected) !== null && _c !== void 0 ? _c : false;
14365
14380
  let _settings = options.settings;
14366
14381
  const _applicationName = options.applicationName;
@@ -14843,6 +14858,12 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
14843
14858
  function getConfiguration() {
14844
14859
  return executor.getWindowConfiguration(resultWindow);
14845
14860
  }
14861
+ function getDockingPlacement() {
14862
+ return executor.getDockingPlacement(resultWindow);
14863
+ }
14864
+ function dock(opts) {
14865
+ return executor.dock(resultWindow, opts);
14866
+ }
14846
14867
  function onTitleChanged(callback) {
14847
14868
  if (!isFunction(callback)) {
14848
14869
  throw new Error("callback should be a function");
@@ -15009,6 +15030,9 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15009
15030
  function onNeighboursChanged(callback) {
15010
15031
  return onEventCore("neighbours-changed", callback);
15011
15032
  }
15033
+ function onDockingChanged(callback) {
15034
+ return onEventCore("docking-changed", callback);
15035
+ }
15012
15036
  function onEventCore(key, callback, replayArguments) {
15013
15037
  if (!isFunction(callback)) {
15014
15038
  throw new Error("callback must be a function");
@@ -15044,6 +15068,8 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15044
15068
  _groupId = updated.groupId;
15045
15069
  _isGroupHeaderVisible = updated.isGroupHeaderVisible;
15046
15070
  _isTabHeaderVisible = updated.isTabHeaderVisible;
15071
+ _isGroupHibernated = updated.isGroupHibernated;
15072
+ _isGroupVisible = updated.isGroupVisible;
15047
15073
  _isTabSelected = updated.isTabSelected;
15048
15074
  _settings = updated.settings;
15049
15075
  _isVisible = updated.isVisible;
@@ -15257,6 +15283,13 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15257
15283
  _registry.execute("placementSettingsChanged", resultWindow);
15258
15284
  });
15259
15285
  }
15286
+ function handleDockingChanged(data) {
15287
+ _registry.execute("docking-changed", resultWindow, {
15288
+ docked: data.docked,
15289
+ position: data.position,
15290
+ claimScreenArea: data.claimScreenArea
15291
+ });
15292
+ }
15260
15293
  function handleGroupChanged(newGroup, oldGroup) {
15261
15294
  _group = newGroup;
15262
15295
  _groupId = newGroup === null || newGroup === void 0 ? void 0 : newGroup.id;
@@ -15562,6 +15595,8 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15562
15595
  download,
15563
15596
  configure,
15564
15597
  getConfiguration,
15598
+ getDockingPlacement,
15599
+ dock,
15565
15600
  getChannel: async () => {
15566
15601
  var _a;
15567
15602
  const wins = await getChannels().getWindowsWithChannels({ windowIds: [_id] });
@@ -15599,6 +15634,7 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15599
15634
  onZoomFactorChanged,
15600
15635
  onPlacementSettingsChanged,
15601
15636
  onNeighboursChanged,
15637
+ onDockingChanged,
15602
15638
  onNavigating,
15603
15639
  get tabs() {
15604
15640
  return getAllTabs();
@@ -15688,11 +15724,21 @@ var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPI
15688
15724
  handleWindowDetached,
15689
15725
  handleZoomFactorChanged,
15690
15726
  handleIsStickyChanged,
15691
- handlePlacementSettingsChanged
15727
+ handlePlacementSettingsChanged,
15728
+ handleDockingChanged
15729
+ };
15730
+ const groupArgs = {
15731
+ get isGroupHibernated() {
15732
+ return _isGroupHibernated;
15733
+ },
15734
+ get isGroupVisible() {
15735
+ return _isGroupVisible;
15736
+ },
15692
15737
  };
15693
15738
  return {
15694
15739
  API: resultWindow,
15695
- Events: events
15740
+ Events: events,
15741
+ GroupCreationArgs: groupArgs
15696
15742
  };
15697
15743
  };
15698
15744
 
@@ -15727,10 +15773,12 @@ class GDExecutor {
15727
15773
  get finished() {
15728
15774
  return this._finished;
15729
15775
  }
15730
- init(agm, instance, config) {
15776
+ get configuration() {
15777
+ return this._configuration;
15778
+ }
15779
+ init(agm, instance) {
15731
15780
  this.agm = agm;
15732
15781
  this.agmTarget = instance;
15733
- this._configuration = config;
15734
15782
  this._registry.add("event", (data) => {
15735
15783
  if (data.type === "Closed") {
15736
15784
  const keys = Object.keys(this.unsubCallbacks);
@@ -15743,6 +15791,9 @@ class GDExecutor {
15743
15791
  }
15744
15792
  });
15745
15793
  }
15794
+ setConfiguration(config) {
15795
+ this._configuration = config;
15796
+ }
15746
15797
  handleEvent(data) {
15747
15798
  this._registry.execute("event", data);
15748
15799
  }
@@ -15758,7 +15809,7 @@ class GDExecutor {
15758
15809
  }
15759
15810
  const id = result.returned.id;
15760
15811
  const win = await windowStore.waitFor(id);
15761
- if (!this._configuration || this._configuration.windowAvailableOnURLChanged) {
15812
+ if (!this.configuration || this.configuration.windowAvailableOnURLChanged) {
15762
15813
  setTimeout(() => {
15763
15814
  if (win.API.windowType === "electron") {
15764
15815
  win.Events.handleUrlChanged(win.API.url);
@@ -16181,6 +16232,9 @@ class GDExecutor {
16181
16232
  async setModalState(windowId, isModal) {
16182
16233
  return this.execute("setModalState", { windowId, options: { isModal } });
16183
16234
  }
16235
+ async autoArrange(displayId) {
16236
+ return this.execute("autoArrange", { options: { displayId } });
16237
+ }
16184
16238
  async handleFlydownBoundsRequested(targetId, data) {
16185
16239
  const cancelCallback = () => data.cancel = true;
16186
16240
  const callbackData = {
@@ -16385,6 +16439,12 @@ class GDExecutor {
16385
16439
  async goForward(resultWindow) {
16386
16440
  await this.execute("goForward", { windowId: resultWindow.id });
16387
16441
  }
16442
+ async getDockingPlacement(window) {
16443
+ return this.execute("getDockingPlacement", { windowId: window.id });
16444
+ }
16445
+ dock(window, options) {
16446
+ return this.execute("dock", { windowId: window.id, options });
16447
+ }
16388
16448
  nonWindowHandlers(callback, winId, type) {
16389
16449
  const id = `${winId}-${type}`;
16390
16450
  const unsub = () => {
@@ -16612,11 +16672,11 @@ class GDEnvironment {
16612
16672
  onData: (streamData) => {
16613
16673
  if (streamData.data.type === "Configuration") {
16614
16674
  this._configuration = streamData.data;
16675
+ executor.setConfiguration(this._configuration);
16615
16676
  return;
16616
16677
  }
16617
16678
  this.updateWindow(streamData.data, resolve);
16618
16679
  executor.handleEvent(streamData.data);
16619
- executor.init(this._agm, this._agmInstance, this._configuration);
16620
16680
  },
16621
16681
  onConnected: (instance) => {
16622
16682
  this._agmInstance = instance;
@@ -16692,6 +16752,9 @@ class GDEnvironment {
16692
16752
  onWindowLostFocus(callback) {
16693
16753
  return this._registry.add("lost-focus", callback);
16694
16754
  }
16755
+ onWindowsAutoArrangeChanged(callback) {
16756
+ return this._registry.add("windows-auto-arranged-changed", callback);
16757
+ }
16695
16758
  respondToEvent(args) {
16696
16759
  if (args.type === "ShowFlydownBoundsRequested") {
16697
16760
  return this.executor.handleFlydownBoundsRequested(args.data.windowId, args.data);
@@ -16710,6 +16773,7 @@ class GDEnvironment {
16710
16773
  const existingWindow = windowStore.get(w.id);
16711
16774
  if (existingWindow) {
16712
16775
  existingWindow.Events.handleUpdate(this.mapToWindowConstructorOptions(w));
16776
+ existingWindow.GroupCreationArgs = this.mapToGroupCreationArgs(w);
16713
16777
  }
16714
16778
  else {
16715
16779
  const win = this.createWindow(w.id, w);
@@ -16743,6 +16807,12 @@ class GDEnvironment {
16743
16807
  this._registry.execute("window-event", windowInfo);
16744
16808
  return;
16745
16809
  }
16810
+ if (windowInfo.type === "OnWindowsAutoArrangeChanged") {
16811
+ const info = windowInfo;
16812
+ this._registry.execute("windows-auto-arranged-changed", info.data);
16813
+ this._registry.execute("window-event", windowInfo);
16814
+ return;
16815
+ }
16746
16816
  const windowObjectAndEvents = windowStore.get((windowInfo).windowId);
16747
16817
  if (!windowObjectAndEvents) {
16748
16818
  this._logger.error(`received update for unknown window. Stream:', ${JSON.stringify(windowInfo, null, 4)}`);
@@ -16849,16 +16919,27 @@ class GDEnvironment {
16849
16919
  if (windowInfo.type === "PlacementSettingsChanged") {
16850
16920
  theWindowEvents.handlePlacementSettingsChanged(windowInfo.data);
16851
16921
  }
16922
+ if (windowInfo.type === "DockingChanged") {
16923
+ theWindowEvents.handleDockingChanged(windowInfo.data);
16924
+ }
16852
16925
  this._registry.execute("window-event", extendedStreamEvent);
16853
16926
  }
16854
16927
  createWindow(windowId, options) {
16855
16928
  const windowObjAndEvents = windowFactory(windowId, this.mapToWindowConstructorOptions(options), executor, this._logger, this._appManagerGetter, this._displayAPIGetter, this._channelsAPIGetter, this._agm);
16929
+ windowObjAndEvents.GroupCreationArgs = this.mapToGroupCreationArgs(options);
16856
16930
  windowStore.add(windowObjAndEvents);
16857
16931
  return windowObjAndEvents;
16858
16932
  }
16859
16933
  async focusChanged(theWindowEvents, theWindow, focus) {
16860
16934
  theWindowEvents.handleFocusChanged(focus);
16861
- await windowStore.waitFor(theWindow.id);
16935
+ try {
16936
+ if (!this._configuration.windowAvailableOnURLChanged) {
16937
+ await windowStore.waitFor(theWindow.id);
16938
+ }
16939
+ }
16940
+ catch (error) {
16941
+ return;
16942
+ }
16862
16943
  if (focus) {
16863
16944
  this._registry.execute("got-focus", theWindow);
16864
16945
  }
@@ -16899,6 +16980,12 @@ class GDEnvironment {
16899
16980
  applicationName: args.applicationName
16900
16981
  };
16901
16982
  }
16983
+ mapToGroupCreationArgs(args) {
16984
+ return {
16985
+ isGroupHibernated: args.isGroupHibernated,
16986
+ isGroupVisible: args.isGroupVisible
16987
+ };
16988
+ }
16902
16989
  getExtendedStreamEvent(streamEvent) {
16903
16990
  try {
16904
16991
  if (!streamEvent.windowId) {
@@ -16951,13 +17038,16 @@ var envDetector = (agm, logger, appManagerGetter, displayAPIGetter, channelsAPIG
16951
17038
  var groupFactory = (id, executor) => {
16952
17039
  const _registry = lib$1();
16953
17040
  const _windowsId = [];
16954
- let _isHibernatedFlag = false;
16955
- let _isVisible = true;
17041
+ let _isHibernatedFlag;
17042
+ let _isVisible;
16956
17043
  async function addWindow(winId) {
17044
+ var _a, _b, _c, _d;
16957
17045
  if (_windowsId.indexOf(winId) === -1) {
16958
17046
  _windowsId.push(winId);
16959
17047
  const win = windowStore.get(winId);
16960
17048
  win.Events.handleGroupChanged(groupObject, undefined);
17049
+ _isHibernatedFlag = (_b = (_a = win.GroupCreationArgs.isGroupHibernated) !== null && _a !== void 0 ? _a : _isHibernatedFlag) !== null && _b !== void 0 ? _b : false;
17050
+ _isVisible = (_d = (_c = win.GroupCreationArgs.isGroupVisible) !== null && _c !== void 0 ? _c : _isVisible) !== null && _d !== void 0 ? _d : true;
16961
17051
  await executor.finished;
16962
17052
  _registry.execute("window-added", groupObject, win.API);
16963
17053
  }
@@ -17031,7 +17121,7 @@ var groupFactory = (id, executor) => {
17031
17121
  const _isGroupHeaderVisible = windowWithHiddenHeader === undefined;
17032
17122
  return _isGroupHeaderVisible;
17033
17123
  }
17034
- function _isHibernated() {
17124
+ function isHibernated() {
17035
17125
  return _isHibernatedFlag;
17036
17126
  }
17037
17127
  function onHeaderVisibilityChanged(callback) {
@@ -17062,7 +17152,7 @@ var groupFactory = (id, executor) => {
17062
17152
  return _getGroupHeaderVisibility();
17063
17153
  },
17064
17154
  get isHibernated() {
17065
- return _isHibernated();
17155
+ return isHibernated();
17066
17156
  },
17067
17157
  get isVisible() {
17068
17158
  return _isVisible;
@@ -17508,6 +17598,9 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
17508
17598
  const winId = win ? win.id : "";
17509
17599
  return executor.configure(winId, options);
17510
17600
  }
17601
+ function autoArrange(displayId) {
17602
+ return executor.autoArrange(displayId);
17603
+ }
17511
17604
  function windowAdded(callback) {
17512
17605
  return _registry.add("window-added", callback);
17513
17606
  }
@@ -17594,6 +17687,9 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
17594
17687
  }
17595
17688
  };
17596
17689
  }
17690
+ function onArrangementChanged(callback) {
17691
+ return environment.onWindowsAutoArrangeChanged(callback);
17692
+ }
17597
17693
  function onEvent(callback) {
17598
17694
  let unsubFunc;
17599
17695
  let unsubscribed = false;
@@ -17638,6 +17734,7 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
17638
17734
  onTabAttached: tabAttached,
17639
17735
  onTabDetached: tabDetached,
17640
17736
  onWindowFrameColorChanged,
17737
+ onArrangementChanged,
17641
17738
  get groups() {
17642
17739
  return groups.groupsAPI;
17643
17740
  },
@@ -17646,7 +17743,8 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
17646
17743
  onEvent,
17647
17744
  createFlydown,
17648
17745
  showPopup,
17649
- configure
17746
+ configure,
17747
+ autoArrange
17650
17748
  };
17651
17749
  };
17652
17750
 
@@ -17847,6 +17945,9 @@ class LayoutsAPIImpl {
17847
17945
  if (Array.isArray(layout.instances)) {
17848
17946
  layoutObject.options.instances = layout.instances;
17849
17947
  }
17948
+ if (typeof layout.setAsCurrent === "boolean") {
17949
+ layoutObject.options.setAsCurrent = layout.setAsCurrent;
17950
+ }
17850
17951
  }
17851
17952
  else {
17852
17953
  return reject(new Error(`layout type ${layout.type} is not supported`));
@@ -19007,7 +19108,7 @@ function factory$3(agm) {
19007
19108
  };
19008
19109
  }
19009
19110
 
19010
- var version = "6.0.1";
19111
+ var version = "6.1.0";
19011
19112
 
19012
19113
  var prepareConfig = (options) => {
19013
19114
  function getLibConfig(value, defaultMode, trueMode) {
@@ -19141,7 +19242,6 @@ const STARTING_INDEX = 0;
19141
19242
  class Notifications {
19142
19243
  constructor(interop, logger) {
19143
19244
  this.interop = interop;
19144
- this.logger = logger;
19145
19245
  this.NotificationsSubscribeStream = "T42.GNS.Subscribe.Notifications";
19146
19246
  this.NotificationsCounterStream = "T42.Notifications.Counter";
19147
19247
  this.RaiseNotificationMethodName = "T42.GNS.Publish.RaiseNotification";
@@ -19156,6 +19256,7 @@ class Notifications {
19156
19256
  this.subscribedCounterStream = false;
19157
19257
  this.subscriptionsCountForNotifications = 0;
19158
19258
  this.subscriptionsCountForCounter = 0;
19259
+ this.logger = logger.subLogger("notifications");
19159
19260
  this._panel = new PanelAPI(interop, this.onStreamEventCore.bind(this));
19160
19261
  this.subscribeInternalEvents();
19161
19262
  }
@@ -19166,7 +19267,7 @@ class Notifications {
19166
19267
  return this._panel.toAPI();
19167
19268
  }
19168
19269
  async raise(options) {
19169
- var _a, _b, _c;
19270
+ var _a, _b, _c, _d;
19170
19271
  this.validate(options);
19171
19272
  if (!this.methodsRegistered) {
19172
19273
  const bunchOfPromises = [];
@@ -19179,9 +19280,11 @@ class Notifications {
19179
19280
  const id = String(this.nextId++);
19180
19281
  const type = (_a = options.type) !== null && _a !== void 0 ? _a : "Notification";
19181
19282
  const notification = {
19283
+ id: options.id,
19284
+ state: (_b = options.state) !== null && _b !== void 0 ? _b : "Active",
19182
19285
  title: options.title,
19183
19286
  type,
19184
- severity: (_b = options.severity) !== null && _b !== void 0 ? _b : "None",
19287
+ severity: (_c = options.severity) !== null && _c !== void 0 ? _c : "None",
19185
19288
  description: options.body,
19186
19289
  glueRoutingDetailMethodName: `${this.methodNameRoot}_${STARTING_INDEX}`,
19187
19290
  actions: [],
@@ -19198,7 +19301,7 @@ class Notifications {
19198
19301
  this.notifications[id] = g42notification;
19199
19302
  try {
19200
19303
  const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification });
19201
- g42notification.id = (_c = invocationResult.returned) === null || _c === void 0 ? void 0 : _c.id;
19304
+ g42notification.id = (_d = invocationResult.returned) === null || _d === void 0 ? void 0 : _d.id;
19202
19305
  }
19203
19306
  catch (err) {
19204
19307
  const errorMessage = err.message;
@@ -19217,7 +19320,7 @@ class Notifications {
19217
19320
  return result.returned;
19218
19321
  }
19219
19322
  async configure(options) {
19220
- var _a, _b, _c, _d;
19323
+ var _a, _b, _c, _d, _e, _f;
19221
19324
  if (!options || Array.isArray(options)) {
19222
19325
  throw new Error("Invalid options - should be an object.");
19223
19326
  }
@@ -19242,6 +19345,15 @@ class Notifications {
19242
19345
  if (((_c = options.sourceFilter) === null || _c === void 0 ? void 0 : _c.blocked) && !Array.isArray((_d = options.sourceFilter) === null || _d === void 0 ? void 0 : _d.blocked)) {
19243
19346
  throw new Error("Expected type of sourceFilter.blocked - array.");
19244
19347
  }
19348
+ if (options.toasts && typeof options.toasts !== "object") {
19349
+ throw new Error("Expected type of (options.toasts - object.");
19350
+ }
19351
+ if (((_e = options.toasts) === null || _e === void 0 ? void 0 : _e.mode) && typeof options.toasts.mode !== "string") {
19352
+ throw new Error("Expected type of (options.toasts.mode - string.");
19353
+ }
19354
+ if (((_f = options.toasts) === null || _f === void 0 ? void 0 : _f.stackBy) && typeof options.toasts.stackBy !== "string") {
19355
+ throw new Error("Expected type of (options.toasts.stackBy - string.");
19356
+ }
19245
19357
  const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
19246
19358
  return result.returned;
19247
19359
  }
@@ -19253,6 +19365,17 @@ class Notifications {
19253
19365
  const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "list" });
19254
19366
  return interopResult.returned.notifications;
19255
19367
  }
19368
+ async updateData(id, data) {
19369
+ const replacer = (key, value) => typeof value === "undefined" ? null : value;
19370
+ const attribute = {
19371
+ key: "data",
19372
+ value: {
19373
+ stringValue: JSON.stringify(data, replacer)
19374
+ }
19375
+ };
19376
+ const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "create-or-update-attribute", data: { id, attribute } });
19377
+ return interopResult.returned;
19378
+ }
19256
19379
  onRaised(callback) {
19257
19380
  return this.onStreamEventCore("on-notification-raised", callback);
19258
19381
  }
@@ -19284,6 +19407,17 @@ class Notifications {
19284
19407
  this.closeStreamCounterSubscriptionIfNoNeeded();
19285
19408
  };
19286
19409
  }
19410
+ onDataChanged(callback) {
19411
+ if (typeof callback !== "function") {
19412
+ throw new Error("Please provide the callback as a function!");
19413
+ }
19414
+ this.subscribe();
19415
+ const un = this.registry.add("on-notification-data-changed", callback);
19416
+ return () => {
19417
+ un();
19418
+ this.closeStreamSubscriptionIfNoNeeded();
19419
+ };
19420
+ }
19287
19421
  async clearAll() {
19288
19422
  await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" });
19289
19423
  }
@@ -19312,17 +19446,7 @@ class Notifications {
19312
19446
  if (!state) {
19313
19447
  throw new Error("The 'state' argument cannot be null or undefined");
19314
19448
  }
19315
- if (typeof (state) !== "string") {
19316
- throw new Error("The 'state' argument must be a string");
19317
- }
19318
- const validStates = [
19319
- "Active",
19320
- "Acknowledged",
19321
- "Stale"
19322
- ];
19323
- if (!validStates.includes(state)) {
19324
- throw new Error(`The state argument: ${state} is not valid!`);
19325
- }
19449
+ this.validateState(state);
19326
19450
  await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } });
19327
19451
  }
19328
19452
  toAPI() {
@@ -19340,11 +19464,13 @@ class Notifications {
19340
19464
  onClosed: this.onClosed.bind(this),
19341
19465
  onConfigurationChanged: this.onConfigurationChanged.bind(this),
19342
19466
  onCounterChanged: this.onCounterChanged.bind(this),
19467
+ onDataChanged: this.onDataChanged.bind(this),
19343
19468
  clearAll: this.clearAll.bind(this),
19344
19469
  clearOld: this.clearOld.bind(this),
19345
19470
  clear: this.clear.bind(this),
19346
19471
  click: this.click.bind(this),
19347
- setState: this.setState.bind(this)
19472
+ setState: this.setState.bind(this),
19473
+ updateData: this.updateData.bind(this),
19348
19474
  };
19349
19475
  }
19350
19476
  onStreamEventCore(key, callback) {
@@ -19430,6 +19556,22 @@ class Notifications {
19430
19556
  if (options.toastExpiry && typeof options.toastExpiry !== "number") {
19431
19557
  throw new Error("invalid options - toastExpiry should be a number");
19432
19558
  }
19559
+ if (options.state) {
19560
+ this.validateState(options.state);
19561
+ }
19562
+ }
19563
+ validateState(state) {
19564
+ if (typeof (state) !== "string") {
19565
+ throw new Error("The 'state' argument must be a string");
19566
+ }
19567
+ const validStates = [
19568
+ "Active",
19569
+ "Acknowledged",
19570
+ "Stale"
19571
+ ];
19572
+ if (!validStates.includes(state)) {
19573
+ throw new Error(`The state argument: ${state} is not valid!`);
19574
+ }
19433
19575
  }
19434
19576
  subscribe() {
19435
19577
  this.subscriptionsCountForNotifications++;
@@ -19541,7 +19683,7 @@ class Notifications {
19541
19683
  if (notification.state === "Closed") {
19542
19684
  this.registry.execute("on-notification-closed", { id: notification.id });
19543
19685
  }
19544
- else if (notification.state === "Active") {
19686
+ else {
19545
19687
  this.registry.execute("on-notification-raised", notification);
19546
19688
  }
19547
19689
  }
@@ -19549,14 +19691,22 @@ class Notifications {
19549
19691
  handleDeltas(message) {
19550
19692
  const deltas = message.deltas;
19551
19693
  deltas.forEach((info) => {
19694
+ var _a;
19552
19695
  const id = info.id;
19553
- const delta = info.delta;
19696
+ const delta = (_a = info.delta) !== null && _a !== void 0 ? _a : {};
19554
19697
  if (delta.state === "Closed") {
19555
- this.registry.execute("on-notification-closed", { id });
19698
+ this.registry.execute("on-notification-closed", { id, ...delta });
19556
19699
  }
19557
- else {
19700
+ else if (delta.state) {
19558
19701
  this.registry.execute("on-state-changed", { id }, delta.state);
19559
19702
  }
19703
+ else if (delta.attributes) {
19704
+ const attributes = delta.attributes;
19705
+ const dataAttribute = attributes.find((a) => a.key === "data");
19706
+ if (dataAttribute) {
19707
+ this.registry.execute("on-notification-data-changed", { id }, JSON.parse(dataAttribute.value.stringValue));
19708
+ }
19709
+ }
19560
19710
  });
19561
19711
  }
19562
19712
  handleOnClosed(id) {
@@ -20043,9 +20193,9 @@ class Intents {
20043
20193
  intentFlag = rest;
20044
20194
  }
20045
20195
  try {
20046
- await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
20196
+ await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args, caller) => {
20047
20197
  if (this.myIntents.has(intentName)) {
20048
- return handler(args);
20198
+ return handler(args, caller);
20049
20199
  }
20050
20200
  });
20051
20201
  }