@interopio/desktop 6.0.2 → 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.
- package/changelog.md +18 -12
- package/desktop.d.ts +104 -5
- package/dist/desktop.browser.js +183 -38
- package/dist/desktop.browser.js.map +1 -1
- package/dist/desktop.browser.min.js +1 -1
- package/dist/desktop.browser.min.js.map +1 -1
- package/dist/desktop.es.js +183 -38
- package/dist/desktop.es.js.map +1 -1
- package/dist/desktop.umd.js +183 -38
- package/dist/desktop.umd.js.map +1 -1
- package/dist/desktop.umd.min.js +1 -1
- package/dist/desktop.umd.min.js.map +1 -1
- package/package.json +2 -3
package/dist/desktop.browser.js
CHANGED
|
@@ -14135,10 +14135,12 @@
|
|
|
14135
14135
|
}
|
|
14136
14136
|
waitFor(id) {
|
|
14137
14137
|
return new Promise((resolve, reject) => {
|
|
14138
|
-
let
|
|
14138
|
+
let unReady;
|
|
14139
|
+
let unRemoved;
|
|
14139
14140
|
const timeout = setTimeout(() => {
|
|
14140
|
-
|
|
14141
|
-
|
|
14141
|
+
unReady();
|
|
14142
|
+
unRemoved();
|
|
14143
|
+
reject(`Window with id "${id}" was not ready within ${this.waitForTimeoutInMilliseconds} milliseconds.`);
|
|
14142
14144
|
}, this.waitForTimeoutInMilliseconds);
|
|
14143
14145
|
const win = this._windows[id];
|
|
14144
14146
|
if (win) {
|
|
@@ -14146,14 +14148,25 @@
|
|
|
14146
14148
|
resolve(win);
|
|
14147
14149
|
}
|
|
14148
14150
|
else {
|
|
14149
|
-
|
|
14151
|
+
const cleanup = () => {
|
|
14152
|
+
clearTimeout(timeout);
|
|
14153
|
+
unReady();
|
|
14154
|
+
unRemoved();
|
|
14155
|
+
};
|
|
14156
|
+
unReady = this.onReadyWindow((w) => {
|
|
14150
14157
|
if (w.API.id !== id) {
|
|
14151
14158
|
return;
|
|
14152
14159
|
}
|
|
14153
|
-
|
|
14154
|
-
un();
|
|
14160
|
+
cleanup();
|
|
14155
14161
|
resolve(w);
|
|
14156
14162
|
});
|
|
14163
|
+
unRemoved = this.onRemoved((w) => {
|
|
14164
|
+
if (w.API.id !== id) {
|
|
14165
|
+
return;
|
|
14166
|
+
}
|
|
14167
|
+
cleanup();
|
|
14168
|
+
reject(`Window with id "${id}" was removed before it became ready.`);
|
|
14169
|
+
});
|
|
14157
14170
|
}
|
|
14158
14171
|
});
|
|
14159
14172
|
}
|
|
@@ -14367,6 +14380,8 @@
|
|
|
14367
14380
|
let _groupId = options.groupId;
|
|
14368
14381
|
let _isGroupHeaderVisible = options.isGroupHeaderVisible;
|
|
14369
14382
|
let _isTabHeaderVisible = options.isTabHeaderVisible;
|
|
14383
|
+
let _isGroupHibernated = options.isGroupHibernated;
|
|
14384
|
+
let _isGroupVisible = options.isGroupVisible;
|
|
14370
14385
|
let _isTabSelected = (_c = options.isTabSelected) !== null && _c !== void 0 ? _c : false;
|
|
14371
14386
|
let _settings = options.settings;
|
|
14372
14387
|
const _applicationName = options.applicationName;
|
|
@@ -14849,6 +14864,12 @@
|
|
|
14849
14864
|
function getConfiguration() {
|
|
14850
14865
|
return executor.getWindowConfiguration(resultWindow);
|
|
14851
14866
|
}
|
|
14867
|
+
function getDockingPlacement() {
|
|
14868
|
+
return executor.getDockingPlacement(resultWindow);
|
|
14869
|
+
}
|
|
14870
|
+
function dock(opts) {
|
|
14871
|
+
return executor.dock(resultWindow, opts);
|
|
14872
|
+
}
|
|
14852
14873
|
function onTitleChanged(callback) {
|
|
14853
14874
|
if (!isFunction(callback)) {
|
|
14854
14875
|
throw new Error("callback should be a function");
|
|
@@ -15015,6 +15036,9 @@
|
|
|
15015
15036
|
function onNeighboursChanged(callback) {
|
|
15016
15037
|
return onEventCore("neighbours-changed", callback);
|
|
15017
15038
|
}
|
|
15039
|
+
function onDockingChanged(callback) {
|
|
15040
|
+
return onEventCore("docking-changed", callback);
|
|
15041
|
+
}
|
|
15018
15042
|
function onEventCore(key, callback, replayArguments) {
|
|
15019
15043
|
if (!isFunction(callback)) {
|
|
15020
15044
|
throw new Error("callback must be a function");
|
|
@@ -15050,6 +15074,8 @@
|
|
|
15050
15074
|
_groupId = updated.groupId;
|
|
15051
15075
|
_isGroupHeaderVisible = updated.isGroupHeaderVisible;
|
|
15052
15076
|
_isTabHeaderVisible = updated.isTabHeaderVisible;
|
|
15077
|
+
_isGroupHibernated = updated.isGroupHibernated;
|
|
15078
|
+
_isGroupVisible = updated.isGroupVisible;
|
|
15053
15079
|
_isTabSelected = updated.isTabSelected;
|
|
15054
15080
|
_settings = updated.settings;
|
|
15055
15081
|
_isVisible = updated.isVisible;
|
|
@@ -15263,6 +15289,13 @@
|
|
|
15263
15289
|
_registry.execute("placementSettingsChanged", resultWindow);
|
|
15264
15290
|
});
|
|
15265
15291
|
}
|
|
15292
|
+
function handleDockingChanged(data) {
|
|
15293
|
+
_registry.execute("docking-changed", resultWindow, {
|
|
15294
|
+
docked: data.docked,
|
|
15295
|
+
position: data.position,
|
|
15296
|
+
claimScreenArea: data.claimScreenArea
|
|
15297
|
+
});
|
|
15298
|
+
}
|
|
15266
15299
|
function handleGroupChanged(newGroup, oldGroup) {
|
|
15267
15300
|
_group = newGroup;
|
|
15268
15301
|
_groupId = newGroup === null || newGroup === void 0 ? void 0 : newGroup.id;
|
|
@@ -15568,6 +15601,8 @@
|
|
|
15568
15601
|
download,
|
|
15569
15602
|
configure,
|
|
15570
15603
|
getConfiguration,
|
|
15604
|
+
getDockingPlacement,
|
|
15605
|
+
dock,
|
|
15571
15606
|
getChannel: async () => {
|
|
15572
15607
|
var _a;
|
|
15573
15608
|
const wins = await getChannels().getWindowsWithChannels({ windowIds: [_id] });
|
|
@@ -15605,6 +15640,7 @@
|
|
|
15605
15640
|
onZoomFactorChanged,
|
|
15606
15641
|
onPlacementSettingsChanged,
|
|
15607
15642
|
onNeighboursChanged,
|
|
15643
|
+
onDockingChanged,
|
|
15608
15644
|
onNavigating,
|
|
15609
15645
|
get tabs() {
|
|
15610
15646
|
return getAllTabs();
|
|
@@ -15694,11 +15730,21 @@
|
|
|
15694
15730
|
handleWindowDetached,
|
|
15695
15731
|
handleZoomFactorChanged,
|
|
15696
15732
|
handleIsStickyChanged,
|
|
15697
|
-
handlePlacementSettingsChanged
|
|
15733
|
+
handlePlacementSettingsChanged,
|
|
15734
|
+
handleDockingChanged
|
|
15735
|
+
};
|
|
15736
|
+
const groupArgs = {
|
|
15737
|
+
get isGroupHibernated() {
|
|
15738
|
+
return _isGroupHibernated;
|
|
15739
|
+
},
|
|
15740
|
+
get isGroupVisible() {
|
|
15741
|
+
return _isGroupVisible;
|
|
15742
|
+
},
|
|
15698
15743
|
};
|
|
15699
15744
|
return {
|
|
15700
15745
|
API: resultWindow,
|
|
15701
|
-
Events: events
|
|
15746
|
+
Events: events,
|
|
15747
|
+
GroupCreationArgs: groupArgs
|
|
15702
15748
|
};
|
|
15703
15749
|
};
|
|
15704
15750
|
|
|
@@ -16192,6 +16238,9 @@
|
|
|
16192
16238
|
async setModalState(windowId, isModal) {
|
|
16193
16239
|
return this.execute("setModalState", { windowId, options: { isModal } });
|
|
16194
16240
|
}
|
|
16241
|
+
async autoArrange(displayId) {
|
|
16242
|
+
return this.execute("autoArrange", { options: { displayId } });
|
|
16243
|
+
}
|
|
16195
16244
|
async handleFlydownBoundsRequested(targetId, data) {
|
|
16196
16245
|
const cancelCallback = () => data.cancel = true;
|
|
16197
16246
|
const callbackData = {
|
|
@@ -16396,6 +16445,12 @@
|
|
|
16396
16445
|
async goForward(resultWindow) {
|
|
16397
16446
|
await this.execute("goForward", { windowId: resultWindow.id });
|
|
16398
16447
|
}
|
|
16448
|
+
async getDockingPlacement(window) {
|
|
16449
|
+
return this.execute("getDockingPlacement", { windowId: window.id });
|
|
16450
|
+
}
|
|
16451
|
+
dock(window, options) {
|
|
16452
|
+
return this.execute("dock", { windowId: window.id, options });
|
|
16453
|
+
}
|
|
16399
16454
|
nonWindowHandlers(callback, winId, type) {
|
|
16400
16455
|
const id = `${winId}-${type}`;
|
|
16401
16456
|
const unsub = () => {
|
|
@@ -16703,6 +16758,9 @@
|
|
|
16703
16758
|
onWindowLostFocus(callback) {
|
|
16704
16759
|
return this._registry.add("lost-focus", callback);
|
|
16705
16760
|
}
|
|
16761
|
+
onWindowsAutoArrangeChanged(callback) {
|
|
16762
|
+
return this._registry.add("windows-auto-arranged-changed", callback);
|
|
16763
|
+
}
|
|
16706
16764
|
respondToEvent(args) {
|
|
16707
16765
|
if (args.type === "ShowFlydownBoundsRequested") {
|
|
16708
16766
|
return this.executor.handleFlydownBoundsRequested(args.data.windowId, args.data);
|
|
@@ -16721,6 +16779,7 @@
|
|
|
16721
16779
|
const existingWindow = windowStore.get(w.id);
|
|
16722
16780
|
if (existingWindow) {
|
|
16723
16781
|
existingWindow.Events.handleUpdate(this.mapToWindowConstructorOptions(w));
|
|
16782
|
+
existingWindow.GroupCreationArgs = this.mapToGroupCreationArgs(w);
|
|
16724
16783
|
}
|
|
16725
16784
|
else {
|
|
16726
16785
|
const win = this.createWindow(w.id, w);
|
|
@@ -16754,6 +16813,12 @@
|
|
|
16754
16813
|
this._registry.execute("window-event", windowInfo);
|
|
16755
16814
|
return;
|
|
16756
16815
|
}
|
|
16816
|
+
if (windowInfo.type === "OnWindowsAutoArrangeChanged") {
|
|
16817
|
+
const info = windowInfo;
|
|
16818
|
+
this._registry.execute("windows-auto-arranged-changed", info.data);
|
|
16819
|
+
this._registry.execute("window-event", windowInfo);
|
|
16820
|
+
return;
|
|
16821
|
+
}
|
|
16757
16822
|
const windowObjectAndEvents = windowStore.get((windowInfo).windowId);
|
|
16758
16823
|
if (!windowObjectAndEvents) {
|
|
16759
16824
|
this._logger.error(`received update for unknown window. Stream:', ${JSON.stringify(windowInfo, null, 4)}`);
|
|
@@ -16860,16 +16925,27 @@
|
|
|
16860
16925
|
if (windowInfo.type === "PlacementSettingsChanged") {
|
|
16861
16926
|
theWindowEvents.handlePlacementSettingsChanged(windowInfo.data);
|
|
16862
16927
|
}
|
|
16928
|
+
if (windowInfo.type === "DockingChanged") {
|
|
16929
|
+
theWindowEvents.handleDockingChanged(windowInfo.data);
|
|
16930
|
+
}
|
|
16863
16931
|
this._registry.execute("window-event", extendedStreamEvent);
|
|
16864
16932
|
}
|
|
16865
16933
|
createWindow(windowId, options) {
|
|
16866
16934
|
const windowObjAndEvents = windowFactory(windowId, this.mapToWindowConstructorOptions(options), executor, this._logger, this._appManagerGetter, this._displayAPIGetter, this._channelsAPIGetter, this._agm);
|
|
16935
|
+
windowObjAndEvents.GroupCreationArgs = this.mapToGroupCreationArgs(options);
|
|
16867
16936
|
windowStore.add(windowObjAndEvents);
|
|
16868
16937
|
return windowObjAndEvents;
|
|
16869
16938
|
}
|
|
16870
16939
|
async focusChanged(theWindowEvents, theWindow, focus) {
|
|
16871
16940
|
theWindowEvents.handleFocusChanged(focus);
|
|
16872
|
-
|
|
16941
|
+
try {
|
|
16942
|
+
if (!this._configuration.windowAvailableOnURLChanged) {
|
|
16943
|
+
await windowStore.waitFor(theWindow.id);
|
|
16944
|
+
}
|
|
16945
|
+
}
|
|
16946
|
+
catch (error) {
|
|
16947
|
+
return;
|
|
16948
|
+
}
|
|
16873
16949
|
if (focus) {
|
|
16874
16950
|
this._registry.execute("got-focus", theWindow);
|
|
16875
16951
|
}
|
|
@@ -16910,6 +16986,12 @@
|
|
|
16910
16986
|
applicationName: args.applicationName
|
|
16911
16987
|
};
|
|
16912
16988
|
}
|
|
16989
|
+
mapToGroupCreationArgs(args) {
|
|
16990
|
+
return {
|
|
16991
|
+
isGroupHibernated: args.isGroupHibernated,
|
|
16992
|
+
isGroupVisible: args.isGroupVisible
|
|
16993
|
+
};
|
|
16994
|
+
}
|
|
16913
16995
|
getExtendedStreamEvent(streamEvent) {
|
|
16914
16996
|
try {
|
|
16915
16997
|
if (!streamEvent.windowId) {
|
|
@@ -16962,13 +17044,16 @@
|
|
|
16962
17044
|
var groupFactory = (id, executor) => {
|
|
16963
17045
|
const _registry = lib$1();
|
|
16964
17046
|
const _windowsId = [];
|
|
16965
|
-
let _isHibernatedFlag
|
|
16966
|
-
let _isVisible
|
|
17047
|
+
let _isHibernatedFlag;
|
|
17048
|
+
let _isVisible;
|
|
16967
17049
|
async function addWindow(winId) {
|
|
17050
|
+
var _a, _b, _c, _d;
|
|
16968
17051
|
if (_windowsId.indexOf(winId) === -1) {
|
|
16969
17052
|
_windowsId.push(winId);
|
|
16970
17053
|
const win = windowStore.get(winId);
|
|
16971
17054
|
win.Events.handleGroupChanged(groupObject, undefined);
|
|
17055
|
+
_isHibernatedFlag = (_b = (_a = win.GroupCreationArgs.isGroupHibernated) !== null && _a !== void 0 ? _a : _isHibernatedFlag) !== null && _b !== void 0 ? _b : false;
|
|
17056
|
+
_isVisible = (_d = (_c = win.GroupCreationArgs.isGroupVisible) !== null && _c !== void 0 ? _c : _isVisible) !== null && _d !== void 0 ? _d : true;
|
|
16972
17057
|
await executor.finished;
|
|
16973
17058
|
_registry.execute("window-added", groupObject, win.API);
|
|
16974
17059
|
}
|
|
@@ -17042,7 +17127,7 @@
|
|
|
17042
17127
|
const _isGroupHeaderVisible = windowWithHiddenHeader === undefined;
|
|
17043
17128
|
return _isGroupHeaderVisible;
|
|
17044
17129
|
}
|
|
17045
|
-
function
|
|
17130
|
+
function isHibernated() {
|
|
17046
17131
|
return _isHibernatedFlag;
|
|
17047
17132
|
}
|
|
17048
17133
|
function onHeaderVisibilityChanged(callback) {
|
|
@@ -17073,7 +17158,7 @@
|
|
|
17073
17158
|
return _getGroupHeaderVisibility();
|
|
17074
17159
|
},
|
|
17075
17160
|
get isHibernated() {
|
|
17076
|
-
return
|
|
17161
|
+
return isHibernated();
|
|
17077
17162
|
},
|
|
17078
17163
|
get isVisible() {
|
|
17079
17164
|
return _isVisible;
|
|
@@ -17519,6 +17604,9 @@
|
|
|
17519
17604
|
const winId = win ? win.id : "";
|
|
17520
17605
|
return executor.configure(winId, options);
|
|
17521
17606
|
}
|
|
17607
|
+
function autoArrange(displayId) {
|
|
17608
|
+
return executor.autoArrange(displayId);
|
|
17609
|
+
}
|
|
17522
17610
|
function windowAdded(callback) {
|
|
17523
17611
|
return _registry.add("window-added", callback);
|
|
17524
17612
|
}
|
|
@@ -17605,6 +17693,9 @@
|
|
|
17605
17693
|
}
|
|
17606
17694
|
};
|
|
17607
17695
|
}
|
|
17696
|
+
function onArrangementChanged(callback) {
|
|
17697
|
+
return environment.onWindowsAutoArrangeChanged(callback);
|
|
17698
|
+
}
|
|
17608
17699
|
function onEvent(callback) {
|
|
17609
17700
|
let unsubFunc;
|
|
17610
17701
|
let unsubscribed = false;
|
|
@@ -17649,6 +17740,7 @@
|
|
|
17649
17740
|
onTabAttached: tabAttached,
|
|
17650
17741
|
onTabDetached: tabDetached,
|
|
17651
17742
|
onWindowFrameColorChanged,
|
|
17743
|
+
onArrangementChanged,
|
|
17652
17744
|
get groups() {
|
|
17653
17745
|
return groups.groupsAPI;
|
|
17654
17746
|
},
|
|
@@ -17657,7 +17749,8 @@
|
|
|
17657
17749
|
onEvent,
|
|
17658
17750
|
createFlydown,
|
|
17659
17751
|
showPopup,
|
|
17660
|
-
configure
|
|
17752
|
+
configure,
|
|
17753
|
+
autoArrange
|
|
17661
17754
|
};
|
|
17662
17755
|
};
|
|
17663
17756
|
|
|
@@ -17858,6 +17951,9 @@
|
|
|
17858
17951
|
if (Array.isArray(layout.instances)) {
|
|
17859
17952
|
layoutObject.options.instances = layout.instances;
|
|
17860
17953
|
}
|
|
17954
|
+
if (typeof layout.setAsCurrent === "boolean") {
|
|
17955
|
+
layoutObject.options.setAsCurrent = layout.setAsCurrent;
|
|
17956
|
+
}
|
|
17861
17957
|
}
|
|
17862
17958
|
else {
|
|
17863
17959
|
return reject(new Error(`layout type ${layout.type} is not supported`));
|
|
@@ -19018,7 +19114,7 @@
|
|
|
19018
19114
|
};
|
|
19019
19115
|
}
|
|
19020
19116
|
|
|
19021
|
-
var version = "6.0
|
|
19117
|
+
var version = "6.1.0";
|
|
19022
19118
|
|
|
19023
19119
|
var prepareConfig = (options) => {
|
|
19024
19120
|
function getLibConfig(value, defaultMode, trueMode) {
|
|
@@ -19152,7 +19248,6 @@
|
|
|
19152
19248
|
class Notifications {
|
|
19153
19249
|
constructor(interop, logger) {
|
|
19154
19250
|
this.interop = interop;
|
|
19155
|
-
this.logger = logger;
|
|
19156
19251
|
this.NotificationsSubscribeStream = "T42.GNS.Subscribe.Notifications";
|
|
19157
19252
|
this.NotificationsCounterStream = "T42.Notifications.Counter";
|
|
19158
19253
|
this.RaiseNotificationMethodName = "T42.GNS.Publish.RaiseNotification";
|
|
@@ -19167,6 +19262,7 @@
|
|
|
19167
19262
|
this.subscribedCounterStream = false;
|
|
19168
19263
|
this.subscriptionsCountForNotifications = 0;
|
|
19169
19264
|
this.subscriptionsCountForCounter = 0;
|
|
19265
|
+
this.logger = logger.subLogger("notifications");
|
|
19170
19266
|
this._panel = new PanelAPI(interop, this.onStreamEventCore.bind(this));
|
|
19171
19267
|
this.subscribeInternalEvents();
|
|
19172
19268
|
}
|
|
@@ -19177,7 +19273,7 @@
|
|
|
19177
19273
|
return this._panel.toAPI();
|
|
19178
19274
|
}
|
|
19179
19275
|
async raise(options) {
|
|
19180
|
-
var _a, _b, _c;
|
|
19276
|
+
var _a, _b, _c, _d;
|
|
19181
19277
|
this.validate(options);
|
|
19182
19278
|
if (!this.methodsRegistered) {
|
|
19183
19279
|
const bunchOfPromises = [];
|
|
@@ -19190,9 +19286,11 @@
|
|
|
19190
19286
|
const id = String(this.nextId++);
|
|
19191
19287
|
const type = (_a = options.type) !== null && _a !== void 0 ? _a : "Notification";
|
|
19192
19288
|
const notification = {
|
|
19289
|
+
id: options.id,
|
|
19290
|
+
state: (_b = options.state) !== null && _b !== void 0 ? _b : "Active",
|
|
19193
19291
|
title: options.title,
|
|
19194
19292
|
type,
|
|
19195
|
-
severity: (
|
|
19293
|
+
severity: (_c = options.severity) !== null && _c !== void 0 ? _c : "None",
|
|
19196
19294
|
description: options.body,
|
|
19197
19295
|
glueRoutingDetailMethodName: `${this.methodNameRoot}_${STARTING_INDEX}`,
|
|
19198
19296
|
actions: [],
|
|
@@ -19209,7 +19307,7 @@
|
|
|
19209
19307
|
this.notifications[id] = g42notification;
|
|
19210
19308
|
try {
|
|
19211
19309
|
const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification });
|
|
19212
|
-
g42notification.id = (
|
|
19310
|
+
g42notification.id = (_d = invocationResult.returned) === null || _d === void 0 ? void 0 : _d.id;
|
|
19213
19311
|
}
|
|
19214
19312
|
catch (err) {
|
|
19215
19313
|
const errorMessage = err.message;
|
|
@@ -19228,7 +19326,7 @@
|
|
|
19228
19326
|
return result.returned;
|
|
19229
19327
|
}
|
|
19230
19328
|
async configure(options) {
|
|
19231
|
-
var _a, _b, _c, _d;
|
|
19329
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19232
19330
|
if (!options || Array.isArray(options)) {
|
|
19233
19331
|
throw new Error("Invalid options - should be an object.");
|
|
19234
19332
|
}
|
|
@@ -19253,6 +19351,15 @@
|
|
|
19253
19351
|
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)) {
|
|
19254
19352
|
throw new Error("Expected type of sourceFilter.blocked - array.");
|
|
19255
19353
|
}
|
|
19354
|
+
if (options.toasts && typeof options.toasts !== "object") {
|
|
19355
|
+
throw new Error("Expected type of (options.toasts - object.");
|
|
19356
|
+
}
|
|
19357
|
+
if (((_e = options.toasts) === null || _e === void 0 ? void 0 : _e.mode) && typeof options.toasts.mode !== "string") {
|
|
19358
|
+
throw new Error("Expected type of (options.toasts.mode - string.");
|
|
19359
|
+
}
|
|
19360
|
+
if (((_f = options.toasts) === null || _f === void 0 ? void 0 : _f.stackBy) && typeof options.toasts.stackBy !== "string") {
|
|
19361
|
+
throw new Error("Expected type of (options.toasts.stackBy - string.");
|
|
19362
|
+
}
|
|
19256
19363
|
const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
|
|
19257
19364
|
return result.returned;
|
|
19258
19365
|
}
|
|
@@ -19264,6 +19371,17 @@
|
|
|
19264
19371
|
const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "list" });
|
|
19265
19372
|
return interopResult.returned.notifications;
|
|
19266
19373
|
}
|
|
19374
|
+
async updateData(id, data) {
|
|
19375
|
+
const replacer = (key, value) => typeof value === "undefined" ? null : value;
|
|
19376
|
+
const attribute = {
|
|
19377
|
+
key: "data",
|
|
19378
|
+
value: {
|
|
19379
|
+
stringValue: JSON.stringify(data, replacer)
|
|
19380
|
+
}
|
|
19381
|
+
};
|
|
19382
|
+
const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "create-or-update-attribute", data: { id, attribute } });
|
|
19383
|
+
return interopResult.returned;
|
|
19384
|
+
}
|
|
19267
19385
|
onRaised(callback) {
|
|
19268
19386
|
return this.onStreamEventCore("on-notification-raised", callback);
|
|
19269
19387
|
}
|
|
@@ -19295,6 +19413,17 @@
|
|
|
19295
19413
|
this.closeStreamCounterSubscriptionIfNoNeeded();
|
|
19296
19414
|
};
|
|
19297
19415
|
}
|
|
19416
|
+
onDataChanged(callback) {
|
|
19417
|
+
if (typeof callback !== "function") {
|
|
19418
|
+
throw new Error("Please provide the callback as a function!");
|
|
19419
|
+
}
|
|
19420
|
+
this.subscribe();
|
|
19421
|
+
const un = this.registry.add("on-notification-data-changed", callback);
|
|
19422
|
+
return () => {
|
|
19423
|
+
un();
|
|
19424
|
+
this.closeStreamSubscriptionIfNoNeeded();
|
|
19425
|
+
};
|
|
19426
|
+
}
|
|
19298
19427
|
async clearAll() {
|
|
19299
19428
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" });
|
|
19300
19429
|
}
|
|
@@ -19323,17 +19452,7 @@
|
|
|
19323
19452
|
if (!state) {
|
|
19324
19453
|
throw new Error("The 'state' argument cannot be null or undefined");
|
|
19325
19454
|
}
|
|
19326
|
-
|
|
19327
|
-
throw new Error("The 'state' argument must be a string");
|
|
19328
|
-
}
|
|
19329
|
-
const validStates = [
|
|
19330
|
-
"Active",
|
|
19331
|
-
"Acknowledged",
|
|
19332
|
-
"Stale"
|
|
19333
|
-
];
|
|
19334
|
-
if (!validStates.includes(state)) {
|
|
19335
|
-
throw new Error(`The state argument: ${state} is not valid!`);
|
|
19336
|
-
}
|
|
19455
|
+
this.validateState(state);
|
|
19337
19456
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } });
|
|
19338
19457
|
}
|
|
19339
19458
|
toAPI() {
|
|
@@ -19351,11 +19470,13 @@
|
|
|
19351
19470
|
onClosed: this.onClosed.bind(this),
|
|
19352
19471
|
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
19353
19472
|
onCounterChanged: this.onCounterChanged.bind(this),
|
|
19473
|
+
onDataChanged: this.onDataChanged.bind(this),
|
|
19354
19474
|
clearAll: this.clearAll.bind(this),
|
|
19355
19475
|
clearOld: this.clearOld.bind(this),
|
|
19356
19476
|
clear: this.clear.bind(this),
|
|
19357
19477
|
click: this.click.bind(this),
|
|
19358
|
-
setState: this.setState.bind(this)
|
|
19478
|
+
setState: this.setState.bind(this),
|
|
19479
|
+
updateData: this.updateData.bind(this),
|
|
19359
19480
|
};
|
|
19360
19481
|
}
|
|
19361
19482
|
onStreamEventCore(key, callback) {
|
|
@@ -19441,6 +19562,22 @@
|
|
|
19441
19562
|
if (options.toastExpiry && typeof options.toastExpiry !== "number") {
|
|
19442
19563
|
throw new Error("invalid options - toastExpiry should be a number");
|
|
19443
19564
|
}
|
|
19565
|
+
if (options.state) {
|
|
19566
|
+
this.validateState(options.state);
|
|
19567
|
+
}
|
|
19568
|
+
}
|
|
19569
|
+
validateState(state) {
|
|
19570
|
+
if (typeof (state) !== "string") {
|
|
19571
|
+
throw new Error("The 'state' argument must be a string");
|
|
19572
|
+
}
|
|
19573
|
+
const validStates = [
|
|
19574
|
+
"Active",
|
|
19575
|
+
"Acknowledged",
|
|
19576
|
+
"Stale"
|
|
19577
|
+
];
|
|
19578
|
+
if (!validStates.includes(state)) {
|
|
19579
|
+
throw new Error(`The state argument: ${state} is not valid!`);
|
|
19580
|
+
}
|
|
19444
19581
|
}
|
|
19445
19582
|
subscribe() {
|
|
19446
19583
|
this.subscriptionsCountForNotifications++;
|
|
@@ -19552,7 +19689,7 @@
|
|
|
19552
19689
|
if (notification.state === "Closed") {
|
|
19553
19690
|
this.registry.execute("on-notification-closed", { id: notification.id });
|
|
19554
19691
|
}
|
|
19555
|
-
else
|
|
19692
|
+
else {
|
|
19556
19693
|
this.registry.execute("on-notification-raised", notification);
|
|
19557
19694
|
}
|
|
19558
19695
|
}
|
|
@@ -19560,14 +19697,22 @@
|
|
|
19560
19697
|
handleDeltas(message) {
|
|
19561
19698
|
const deltas = message.deltas;
|
|
19562
19699
|
deltas.forEach((info) => {
|
|
19700
|
+
var _a;
|
|
19563
19701
|
const id = info.id;
|
|
19564
|
-
const delta = info.delta;
|
|
19702
|
+
const delta = (_a = info.delta) !== null && _a !== void 0 ? _a : {};
|
|
19565
19703
|
if (delta.state === "Closed") {
|
|
19566
|
-
this.registry.execute("on-notification-closed", { id });
|
|
19704
|
+
this.registry.execute("on-notification-closed", { id, ...delta });
|
|
19567
19705
|
}
|
|
19568
|
-
else {
|
|
19706
|
+
else if (delta.state) {
|
|
19569
19707
|
this.registry.execute("on-state-changed", { id }, delta.state);
|
|
19570
19708
|
}
|
|
19709
|
+
else if (delta.attributes) {
|
|
19710
|
+
const attributes = delta.attributes;
|
|
19711
|
+
const dataAttribute = attributes.find((a) => a.key === "data");
|
|
19712
|
+
if (dataAttribute) {
|
|
19713
|
+
this.registry.execute("on-notification-data-changed", { id }, JSON.parse(dataAttribute.value.stringValue));
|
|
19714
|
+
}
|
|
19715
|
+
}
|
|
19571
19716
|
});
|
|
19572
19717
|
}
|
|
19573
19718
|
handleOnClosed(id) {
|
|
@@ -20054,9 +20199,9 @@
|
|
|
20054
20199
|
intentFlag = rest;
|
|
20055
20200
|
}
|
|
20056
20201
|
try {
|
|
20057
|
-
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
20202
|
+
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args, caller) => {
|
|
20058
20203
|
if (this.myIntents.has(intentName)) {
|
|
20059
|
-
return handler(args);
|
|
20204
|
+
return handler(args, caller);
|
|
20060
20205
|
}
|
|
20061
20206
|
});
|
|
20062
20207
|
}
|