@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.es.js
CHANGED
|
@@ -14129,10 +14129,12 @@ class WindowStore {
|
|
|
14129
14129
|
}
|
|
14130
14130
|
waitFor(id) {
|
|
14131
14131
|
return new Promise((resolve, reject) => {
|
|
14132
|
-
let
|
|
14132
|
+
let unReady;
|
|
14133
|
+
let unRemoved;
|
|
14133
14134
|
const timeout = setTimeout(() => {
|
|
14134
|
-
|
|
14135
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -16186,6 +16232,9 @@ class GDExecutor {
|
|
|
16186
16232
|
async setModalState(windowId, isModal) {
|
|
16187
16233
|
return this.execute("setModalState", { windowId, options: { isModal } });
|
|
16188
16234
|
}
|
|
16235
|
+
async autoArrange(displayId) {
|
|
16236
|
+
return this.execute("autoArrange", { options: { displayId } });
|
|
16237
|
+
}
|
|
16189
16238
|
async handleFlydownBoundsRequested(targetId, data) {
|
|
16190
16239
|
const cancelCallback = () => data.cancel = true;
|
|
16191
16240
|
const callbackData = {
|
|
@@ -16390,6 +16439,12 @@ class GDExecutor {
|
|
|
16390
16439
|
async goForward(resultWindow) {
|
|
16391
16440
|
await this.execute("goForward", { windowId: resultWindow.id });
|
|
16392
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
|
+
}
|
|
16393
16448
|
nonWindowHandlers(callback, winId, type) {
|
|
16394
16449
|
const id = `${winId}-${type}`;
|
|
16395
16450
|
const unsub = () => {
|
|
@@ -16697,6 +16752,9 @@ class GDEnvironment {
|
|
|
16697
16752
|
onWindowLostFocus(callback) {
|
|
16698
16753
|
return this._registry.add("lost-focus", callback);
|
|
16699
16754
|
}
|
|
16755
|
+
onWindowsAutoArrangeChanged(callback) {
|
|
16756
|
+
return this._registry.add("windows-auto-arranged-changed", callback);
|
|
16757
|
+
}
|
|
16700
16758
|
respondToEvent(args) {
|
|
16701
16759
|
if (args.type === "ShowFlydownBoundsRequested") {
|
|
16702
16760
|
return this.executor.handleFlydownBoundsRequested(args.data.windowId, args.data);
|
|
@@ -16715,6 +16773,7 @@ class GDEnvironment {
|
|
|
16715
16773
|
const existingWindow = windowStore.get(w.id);
|
|
16716
16774
|
if (existingWindow) {
|
|
16717
16775
|
existingWindow.Events.handleUpdate(this.mapToWindowConstructorOptions(w));
|
|
16776
|
+
existingWindow.GroupCreationArgs = this.mapToGroupCreationArgs(w);
|
|
16718
16777
|
}
|
|
16719
16778
|
else {
|
|
16720
16779
|
const win = this.createWindow(w.id, w);
|
|
@@ -16748,6 +16807,12 @@ class GDEnvironment {
|
|
|
16748
16807
|
this._registry.execute("window-event", windowInfo);
|
|
16749
16808
|
return;
|
|
16750
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
|
+
}
|
|
16751
16816
|
const windowObjectAndEvents = windowStore.get((windowInfo).windowId);
|
|
16752
16817
|
if (!windowObjectAndEvents) {
|
|
16753
16818
|
this._logger.error(`received update for unknown window. Stream:', ${JSON.stringify(windowInfo, null, 4)}`);
|
|
@@ -16854,16 +16919,27 @@ class GDEnvironment {
|
|
|
16854
16919
|
if (windowInfo.type === "PlacementSettingsChanged") {
|
|
16855
16920
|
theWindowEvents.handlePlacementSettingsChanged(windowInfo.data);
|
|
16856
16921
|
}
|
|
16922
|
+
if (windowInfo.type === "DockingChanged") {
|
|
16923
|
+
theWindowEvents.handleDockingChanged(windowInfo.data);
|
|
16924
|
+
}
|
|
16857
16925
|
this._registry.execute("window-event", extendedStreamEvent);
|
|
16858
16926
|
}
|
|
16859
16927
|
createWindow(windowId, options) {
|
|
16860
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);
|
|
16861
16930
|
windowStore.add(windowObjAndEvents);
|
|
16862
16931
|
return windowObjAndEvents;
|
|
16863
16932
|
}
|
|
16864
16933
|
async focusChanged(theWindowEvents, theWindow, focus) {
|
|
16865
16934
|
theWindowEvents.handleFocusChanged(focus);
|
|
16866
|
-
|
|
16935
|
+
try {
|
|
16936
|
+
if (!this._configuration.windowAvailableOnURLChanged) {
|
|
16937
|
+
await windowStore.waitFor(theWindow.id);
|
|
16938
|
+
}
|
|
16939
|
+
}
|
|
16940
|
+
catch (error) {
|
|
16941
|
+
return;
|
|
16942
|
+
}
|
|
16867
16943
|
if (focus) {
|
|
16868
16944
|
this._registry.execute("got-focus", theWindow);
|
|
16869
16945
|
}
|
|
@@ -16904,6 +16980,12 @@ class GDEnvironment {
|
|
|
16904
16980
|
applicationName: args.applicationName
|
|
16905
16981
|
};
|
|
16906
16982
|
}
|
|
16983
|
+
mapToGroupCreationArgs(args) {
|
|
16984
|
+
return {
|
|
16985
|
+
isGroupHibernated: args.isGroupHibernated,
|
|
16986
|
+
isGroupVisible: args.isGroupVisible
|
|
16987
|
+
};
|
|
16988
|
+
}
|
|
16907
16989
|
getExtendedStreamEvent(streamEvent) {
|
|
16908
16990
|
try {
|
|
16909
16991
|
if (!streamEvent.windowId) {
|
|
@@ -16956,13 +17038,16 @@ var envDetector = (agm, logger, appManagerGetter, displayAPIGetter, channelsAPIG
|
|
|
16956
17038
|
var groupFactory = (id, executor) => {
|
|
16957
17039
|
const _registry = lib$1();
|
|
16958
17040
|
const _windowsId = [];
|
|
16959
|
-
let _isHibernatedFlag
|
|
16960
|
-
let _isVisible
|
|
17041
|
+
let _isHibernatedFlag;
|
|
17042
|
+
let _isVisible;
|
|
16961
17043
|
async function addWindow(winId) {
|
|
17044
|
+
var _a, _b, _c, _d;
|
|
16962
17045
|
if (_windowsId.indexOf(winId) === -1) {
|
|
16963
17046
|
_windowsId.push(winId);
|
|
16964
17047
|
const win = windowStore.get(winId);
|
|
16965
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;
|
|
16966
17051
|
await executor.finished;
|
|
16967
17052
|
_registry.execute("window-added", groupObject, win.API);
|
|
16968
17053
|
}
|
|
@@ -17036,7 +17121,7 @@ var groupFactory = (id, executor) => {
|
|
|
17036
17121
|
const _isGroupHeaderVisible = windowWithHiddenHeader === undefined;
|
|
17037
17122
|
return _isGroupHeaderVisible;
|
|
17038
17123
|
}
|
|
17039
|
-
function
|
|
17124
|
+
function isHibernated() {
|
|
17040
17125
|
return _isHibernatedFlag;
|
|
17041
17126
|
}
|
|
17042
17127
|
function onHeaderVisibilityChanged(callback) {
|
|
@@ -17067,7 +17152,7 @@ var groupFactory = (id, executor) => {
|
|
|
17067
17152
|
return _getGroupHeaderVisibility();
|
|
17068
17153
|
},
|
|
17069
17154
|
get isHibernated() {
|
|
17070
|
-
return
|
|
17155
|
+
return isHibernated();
|
|
17071
17156
|
},
|
|
17072
17157
|
get isVisible() {
|
|
17073
17158
|
return _isVisible;
|
|
@@ -17513,6 +17598,9 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
|
|
|
17513
17598
|
const winId = win ? win.id : "";
|
|
17514
17599
|
return executor.configure(winId, options);
|
|
17515
17600
|
}
|
|
17601
|
+
function autoArrange(displayId) {
|
|
17602
|
+
return executor.autoArrange(displayId);
|
|
17603
|
+
}
|
|
17516
17604
|
function windowAdded(callback) {
|
|
17517
17605
|
return _registry.add("window-added", callback);
|
|
17518
17606
|
}
|
|
@@ -17599,6 +17687,9 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
|
|
|
17599
17687
|
}
|
|
17600
17688
|
};
|
|
17601
17689
|
}
|
|
17690
|
+
function onArrangementChanged(callback) {
|
|
17691
|
+
return environment.onWindowsAutoArrangeChanged(callback);
|
|
17692
|
+
}
|
|
17602
17693
|
function onEvent(callback) {
|
|
17603
17694
|
let unsubFunc;
|
|
17604
17695
|
let unsubscribed = false;
|
|
@@ -17643,6 +17734,7 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
|
|
|
17643
17734
|
onTabAttached: tabAttached,
|
|
17644
17735
|
onTabDetached: tabDetached,
|
|
17645
17736
|
onWindowFrameColorChanged,
|
|
17737
|
+
onArrangementChanged,
|
|
17646
17738
|
get groups() {
|
|
17647
17739
|
return groups.groupsAPI;
|
|
17648
17740
|
},
|
|
@@ -17651,7 +17743,8 @@ var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsG
|
|
|
17651
17743
|
onEvent,
|
|
17652
17744
|
createFlydown,
|
|
17653
17745
|
showPopup,
|
|
17654
|
-
configure
|
|
17746
|
+
configure,
|
|
17747
|
+
autoArrange
|
|
17655
17748
|
};
|
|
17656
17749
|
};
|
|
17657
17750
|
|
|
@@ -17852,6 +17945,9 @@ class LayoutsAPIImpl {
|
|
|
17852
17945
|
if (Array.isArray(layout.instances)) {
|
|
17853
17946
|
layoutObject.options.instances = layout.instances;
|
|
17854
17947
|
}
|
|
17948
|
+
if (typeof layout.setAsCurrent === "boolean") {
|
|
17949
|
+
layoutObject.options.setAsCurrent = layout.setAsCurrent;
|
|
17950
|
+
}
|
|
17855
17951
|
}
|
|
17856
17952
|
else {
|
|
17857
17953
|
return reject(new Error(`layout type ${layout.type} is not supported`));
|
|
@@ -19012,7 +19108,7 @@ function factory$3(agm) {
|
|
|
19012
19108
|
};
|
|
19013
19109
|
}
|
|
19014
19110
|
|
|
19015
|
-
var version = "6.0
|
|
19111
|
+
var version = "6.1.0";
|
|
19016
19112
|
|
|
19017
19113
|
var prepareConfig = (options) => {
|
|
19018
19114
|
function getLibConfig(value, defaultMode, trueMode) {
|
|
@@ -19146,7 +19242,6 @@ const STARTING_INDEX = 0;
|
|
|
19146
19242
|
class Notifications {
|
|
19147
19243
|
constructor(interop, logger) {
|
|
19148
19244
|
this.interop = interop;
|
|
19149
|
-
this.logger = logger;
|
|
19150
19245
|
this.NotificationsSubscribeStream = "T42.GNS.Subscribe.Notifications";
|
|
19151
19246
|
this.NotificationsCounterStream = "T42.Notifications.Counter";
|
|
19152
19247
|
this.RaiseNotificationMethodName = "T42.GNS.Publish.RaiseNotification";
|
|
@@ -19161,6 +19256,7 @@ class Notifications {
|
|
|
19161
19256
|
this.subscribedCounterStream = false;
|
|
19162
19257
|
this.subscriptionsCountForNotifications = 0;
|
|
19163
19258
|
this.subscriptionsCountForCounter = 0;
|
|
19259
|
+
this.logger = logger.subLogger("notifications");
|
|
19164
19260
|
this._panel = new PanelAPI(interop, this.onStreamEventCore.bind(this));
|
|
19165
19261
|
this.subscribeInternalEvents();
|
|
19166
19262
|
}
|
|
@@ -19171,7 +19267,7 @@ class Notifications {
|
|
|
19171
19267
|
return this._panel.toAPI();
|
|
19172
19268
|
}
|
|
19173
19269
|
async raise(options) {
|
|
19174
|
-
var _a, _b, _c;
|
|
19270
|
+
var _a, _b, _c, _d;
|
|
19175
19271
|
this.validate(options);
|
|
19176
19272
|
if (!this.methodsRegistered) {
|
|
19177
19273
|
const bunchOfPromises = [];
|
|
@@ -19184,9 +19280,11 @@ class Notifications {
|
|
|
19184
19280
|
const id = String(this.nextId++);
|
|
19185
19281
|
const type = (_a = options.type) !== null && _a !== void 0 ? _a : "Notification";
|
|
19186
19282
|
const notification = {
|
|
19283
|
+
id: options.id,
|
|
19284
|
+
state: (_b = options.state) !== null && _b !== void 0 ? _b : "Active",
|
|
19187
19285
|
title: options.title,
|
|
19188
19286
|
type,
|
|
19189
|
-
severity: (
|
|
19287
|
+
severity: (_c = options.severity) !== null && _c !== void 0 ? _c : "None",
|
|
19190
19288
|
description: options.body,
|
|
19191
19289
|
glueRoutingDetailMethodName: `${this.methodNameRoot}_${STARTING_INDEX}`,
|
|
19192
19290
|
actions: [],
|
|
@@ -19203,7 +19301,7 @@ class Notifications {
|
|
|
19203
19301
|
this.notifications[id] = g42notification;
|
|
19204
19302
|
try {
|
|
19205
19303
|
const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification });
|
|
19206
|
-
g42notification.id = (
|
|
19304
|
+
g42notification.id = (_d = invocationResult.returned) === null || _d === void 0 ? void 0 : _d.id;
|
|
19207
19305
|
}
|
|
19208
19306
|
catch (err) {
|
|
19209
19307
|
const errorMessage = err.message;
|
|
@@ -19222,7 +19320,7 @@ class Notifications {
|
|
|
19222
19320
|
return result.returned;
|
|
19223
19321
|
}
|
|
19224
19322
|
async configure(options) {
|
|
19225
|
-
var _a, _b, _c, _d;
|
|
19323
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19226
19324
|
if (!options || Array.isArray(options)) {
|
|
19227
19325
|
throw new Error("Invalid options - should be an object.");
|
|
19228
19326
|
}
|
|
@@ -19247,6 +19345,15 @@ class Notifications {
|
|
|
19247
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)) {
|
|
19248
19346
|
throw new Error("Expected type of sourceFilter.blocked - array.");
|
|
19249
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
|
+
}
|
|
19250
19357
|
const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
|
|
19251
19358
|
return result.returned;
|
|
19252
19359
|
}
|
|
@@ -19258,6 +19365,17 @@ class Notifications {
|
|
|
19258
19365
|
const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "list" });
|
|
19259
19366
|
return interopResult.returned.notifications;
|
|
19260
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
|
+
}
|
|
19261
19379
|
onRaised(callback) {
|
|
19262
19380
|
return this.onStreamEventCore("on-notification-raised", callback);
|
|
19263
19381
|
}
|
|
@@ -19289,6 +19407,17 @@ class Notifications {
|
|
|
19289
19407
|
this.closeStreamCounterSubscriptionIfNoNeeded();
|
|
19290
19408
|
};
|
|
19291
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
|
+
}
|
|
19292
19421
|
async clearAll() {
|
|
19293
19422
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" });
|
|
19294
19423
|
}
|
|
@@ -19317,17 +19446,7 @@ class Notifications {
|
|
|
19317
19446
|
if (!state) {
|
|
19318
19447
|
throw new Error("The 'state' argument cannot be null or undefined");
|
|
19319
19448
|
}
|
|
19320
|
-
|
|
19321
|
-
throw new Error("The 'state' argument must be a string");
|
|
19322
|
-
}
|
|
19323
|
-
const validStates = [
|
|
19324
|
-
"Active",
|
|
19325
|
-
"Acknowledged",
|
|
19326
|
-
"Stale"
|
|
19327
|
-
];
|
|
19328
|
-
if (!validStates.includes(state)) {
|
|
19329
|
-
throw new Error(`The state argument: ${state} is not valid!`);
|
|
19330
|
-
}
|
|
19449
|
+
this.validateState(state);
|
|
19331
19450
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } });
|
|
19332
19451
|
}
|
|
19333
19452
|
toAPI() {
|
|
@@ -19345,11 +19464,13 @@ class Notifications {
|
|
|
19345
19464
|
onClosed: this.onClosed.bind(this),
|
|
19346
19465
|
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
19347
19466
|
onCounterChanged: this.onCounterChanged.bind(this),
|
|
19467
|
+
onDataChanged: this.onDataChanged.bind(this),
|
|
19348
19468
|
clearAll: this.clearAll.bind(this),
|
|
19349
19469
|
clearOld: this.clearOld.bind(this),
|
|
19350
19470
|
clear: this.clear.bind(this),
|
|
19351
19471
|
click: this.click.bind(this),
|
|
19352
|
-
setState: this.setState.bind(this)
|
|
19472
|
+
setState: this.setState.bind(this),
|
|
19473
|
+
updateData: this.updateData.bind(this),
|
|
19353
19474
|
};
|
|
19354
19475
|
}
|
|
19355
19476
|
onStreamEventCore(key, callback) {
|
|
@@ -19435,6 +19556,22 @@ class Notifications {
|
|
|
19435
19556
|
if (options.toastExpiry && typeof options.toastExpiry !== "number") {
|
|
19436
19557
|
throw new Error("invalid options - toastExpiry should be a number");
|
|
19437
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
|
+
}
|
|
19438
19575
|
}
|
|
19439
19576
|
subscribe() {
|
|
19440
19577
|
this.subscriptionsCountForNotifications++;
|
|
@@ -19546,7 +19683,7 @@ class Notifications {
|
|
|
19546
19683
|
if (notification.state === "Closed") {
|
|
19547
19684
|
this.registry.execute("on-notification-closed", { id: notification.id });
|
|
19548
19685
|
}
|
|
19549
|
-
else
|
|
19686
|
+
else {
|
|
19550
19687
|
this.registry.execute("on-notification-raised", notification);
|
|
19551
19688
|
}
|
|
19552
19689
|
}
|
|
@@ -19554,14 +19691,22 @@ class Notifications {
|
|
|
19554
19691
|
handleDeltas(message) {
|
|
19555
19692
|
const deltas = message.deltas;
|
|
19556
19693
|
deltas.forEach((info) => {
|
|
19694
|
+
var _a;
|
|
19557
19695
|
const id = info.id;
|
|
19558
|
-
const delta = info.delta;
|
|
19696
|
+
const delta = (_a = info.delta) !== null && _a !== void 0 ? _a : {};
|
|
19559
19697
|
if (delta.state === "Closed") {
|
|
19560
|
-
this.registry.execute("on-notification-closed", { id });
|
|
19698
|
+
this.registry.execute("on-notification-closed", { id, ...delta });
|
|
19561
19699
|
}
|
|
19562
|
-
else {
|
|
19700
|
+
else if (delta.state) {
|
|
19563
19701
|
this.registry.execute("on-state-changed", { id }, delta.state);
|
|
19564
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
|
+
}
|
|
19565
19710
|
});
|
|
19566
19711
|
}
|
|
19567
19712
|
handleOnClosed(id) {
|
|
@@ -20048,9 +20193,9 @@ class Intents {
|
|
|
20048
20193
|
intentFlag = rest;
|
|
20049
20194
|
}
|
|
20050
20195
|
try {
|
|
20051
|
-
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
20196
|
+
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args, caller) => {
|
|
20052
20197
|
if (this.myIntents.has(intentName)) {
|
|
20053
|
-
return handler(args);
|
|
20198
|
+
return handler(args, caller);
|
|
20054
20199
|
}
|
|
20055
20200
|
});
|
|
20056
20201
|
}
|