@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.
- package/changelog.md +18 -9
- package/desktop.d.ts +104 -5
- package/dist/desktop.browser.js +193 -43
- 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 +193 -43
- package/dist/desktop.es.js.map +1 -1
- package/dist/desktop.umd.js +193 -43
- package/dist/desktop.umd.js.7z +0 -0
- 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 +4 -5
package/dist/desktop.umd.js
CHANGED
|
@@ -3619,7 +3619,7 @@
|
|
|
3619
3619
|
}
|
|
3620
3620
|
};
|
|
3621
3621
|
|
|
3622
|
-
var version$2 = "6.0
|
|
3622
|
+
var version$2 = "6.1.0";
|
|
3623
3623
|
|
|
3624
3624
|
function prepareConfig$1 (configuration, ext, glue42gd) {
|
|
3625
3625
|
var _a, _b, _c, _d;
|
|
@@ -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
|
|
|
@@ -15733,10 +15779,12 @@
|
|
|
15733
15779
|
get finished() {
|
|
15734
15780
|
return this._finished;
|
|
15735
15781
|
}
|
|
15736
|
-
|
|
15782
|
+
get configuration() {
|
|
15783
|
+
return this._configuration;
|
|
15784
|
+
}
|
|
15785
|
+
init(agm, instance) {
|
|
15737
15786
|
this.agm = agm;
|
|
15738
15787
|
this.agmTarget = instance;
|
|
15739
|
-
this._configuration = config;
|
|
15740
15788
|
this._registry.add("event", (data) => {
|
|
15741
15789
|
if (data.type === "Closed") {
|
|
15742
15790
|
const keys = Object.keys(this.unsubCallbacks);
|
|
@@ -15749,6 +15797,9 @@
|
|
|
15749
15797
|
}
|
|
15750
15798
|
});
|
|
15751
15799
|
}
|
|
15800
|
+
setConfiguration(config) {
|
|
15801
|
+
this._configuration = config;
|
|
15802
|
+
}
|
|
15752
15803
|
handleEvent(data) {
|
|
15753
15804
|
this._registry.execute("event", data);
|
|
15754
15805
|
}
|
|
@@ -15764,7 +15815,7 @@
|
|
|
15764
15815
|
}
|
|
15765
15816
|
const id = result.returned.id;
|
|
15766
15817
|
const win = await windowStore.waitFor(id);
|
|
15767
|
-
if (!this.
|
|
15818
|
+
if (!this.configuration || this.configuration.windowAvailableOnURLChanged) {
|
|
15768
15819
|
setTimeout(() => {
|
|
15769
15820
|
if (win.API.windowType === "electron") {
|
|
15770
15821
|
win.Events.handleUrlChanged(win.API.url);
|
|
@@ -16187,6 +16238,9 @@
|
|
|
16187
16238
|
async setModalState(windowId, isModal) {
|
|
16188
16239
|
return this.execute("setModalState", { windowId, options: { isModal } });
|
|
16189
16240
|
}
|
|
16241
|
+
async autoArrange(displayId) {
|
|
16242
|
+
return this.execute("autoArrange", { options: { displayId } });
|
|
16243
|
+
}
|
|
16190
16244
|
async handleFlydownBoundsRequested(targetId, data) {
|
|
16191
16245
|
const cancelCallback = () => data.cancel = true;
|
|
16192
16246
|
const callbackData = {
|
|
@@ -16391,6 +16445,12 @@
|
|
|
16391
16445
|
async goForward(resultWindow) {
|
|
16392
16446
|
await this.execute("goForward", { windowId: resultWindow.id });
|
|
16393
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
|
+
}
|
|
16394
16454
|
nonWindowHandlers(callback, winId, type) {
|
|
16395
16455
|
const id = `${winId}-${type}`;
|
|
16396
16456
|
const unsub = () => {
|
|
@@ -16618,11 +16678,11 @@
|
|
|
16618
16678
|
onData: (streamData) => {
|
|
16619
16679
|
if (streamData.data.type === "Configuration") {
|
|
16620
16680
|
this._configuration = streamData.data;
|
|
16681
|
+
executor.setConfiguration(this._configuration);
|
|
16621
16682
|
return;
|
|
16622
16683
|
}
|
|
16623
16684
|
this.updateWindow(streamData.data, resolve);
|
|
16624
16685
|
executor.handleEvent(streamData.data);
|
|
16625
|
-
executor.init(this._agm, this._agmInstance, this._configuration);
|
|
16626
16686
|
},
|
|
16627
16687
|
onConnected: (instance) => {
|
|
16628
16688
|
this._agmInstance = instance;
|
|
@@ -16698,6 +16758,9 @@
|
|
|
16698
16758
|
onWindowLostFocus(callback) {
|
|
16699
16759
|
return this._registry.add("lost-focus", callback);
|
|
16700
16760
|
}
|
|
16761
|
+
onWindowsAutoArrangeChanged(callback) {
|
|
16762
|
+
return this._registry.add("windows-auto-arranged-changed", callback);
|
|
16763
|
+
}
|
|
16701
16764
|
respondToEvent(args) {
|
|
16702
16765
|
if (args.type === "ShowFlydownBoundsRequested") {
|
|
16703
16766
|
return this.executor.handleFlydownBoundsRequested(args.data.windowId, args.data);
|
|
@@ -16716,6 +16779,7 @@
|
|
|
16716
16779
|
const existingWindow = windowStore.get(w.id);
|
|
16717
16780
|
if (existingWindow) {
|
|
16718
16781
|
existingWindow.Events.handleUpdate(this.mapToWindowConstructorOptions(w));
|
|
16782
|
+
existingWindow.GroupCreationArgs = this.mapToGroupCreationArgs(w);
|
|
16719
16783
|
}
|
|
16720
16784
|
else {
|
|
16721
16785
|
const win = this.createWindow(w.id, w);
|
|
@@ -16749,6 +16813,12 @@
|
|
|
16749
16813
|
this._registry.execute("window-event", windowInfo);
|
|
16750
16814
|
return;
|
|
16751
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
|
+
}
|
|
16752
16822
|
const windowObjectAndEvents = windowStore.get((windowInfo).windowId);
|
|
16753
16823
|
if (!windowObjectAndEvents) {
|
|
16754
16824
|
this._logger.error(`received update for unknown window. Stream:', ${JSON.stringify(windowInfo, null, 4)}`);
|
|
@@ -16855,16 +16925,27 @@
|
|
|
16855
16925
|
if (windowInfo.type === "PlacementSettingsChanged") {
|
|
16856
16926
|
theWindowEvents.handlePlacementSettingsChanged(windowInfo.data);
|
|
16857
16927
|
}
|
|
16928
|
+
if (windowInfo.type === "DockingChanged") {
|
|
16929
|
+
theWindowEvents.handleDockingChanged(windowInfo.data);
|
|
16930
|
+
}
|
|
16858
16931
|
this._registry.execute("window-event", extendedStreamEvent);
|
|
16859
16932
|
}
|
|
16860
16933
|
createWindow(windowId, options) {
|
|
16861
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);
|
|
16862
16936
|
windowStore.add(windowObjAndEvents);
|
|
16863
16937
|
return windowObjAndEvents;
|
|
16864
16938
|
}
|
|
16865
16939
|
async focusChanged(theWindowEvents, theWindow, focus) {
|
|
16866
16940
|
theWindowEvents.handleFocusChanged(focus);
|
|
16867
|
-
|
|
16941
|
+
try {
|
|
16942
|
+
if (!this._configuration.windowAvailableOnURLChanged) {
|
|
16943
|
+
await windowStore.waitFor(theWindow.id);
|
|
16944
|
+
}
|
|
16945
|
+
}
|
|
16946
|
+
catch (error) {
|
|
16947
|
+
return;
|
|
16948
|
+
}
|
|
16868
16949
|
if (focus) {
|
|
16869
16950
|
this._registry.execute("got-focus", theWindow);
|
|
16870
16951
|
}
|
|
@@ -16905,6 +16986,12 @@
|
|
|
16905
16986
|
applicationName: args.applicationName
|
|
16906
16987
|
};
|
|
16907
16988
|
}
|
|
16989
|
+
mapToGroupCreationArgs(args) {
|
|
16990
|
+
return {
|
|
16991
|
+
isGroupHibernated: args.isGroupHibernated,
|
|
16992
|
+
isGroupVisible: args.isGroupVisible
|
|
16993
|
+
};
|
|
16994
|
+
}
|
|
16908
16995
|
getExtendedStreamEvent(streamEvent) {
|
|
16909
16996
|
try {
|
|
16910
16997
|
if (!streamEvent.windowId) {
|
|
@@ -16957,13 +17044,16 @@
|
|
|
16957
17044
|
var groupFactory = (id, executor) => {
|
|
16958
17045
|
const _registry = lib$1();
|
|
16959
17046
|
const _windowsId = [];
|
|
16960
|
-
let _isHibernatedFlag
|
|
16961
|
-
let _isVisible
|
|
17047
|
+
let _isHibernatedFlag;
|
|
17048
|
+
let _isVisible;
|
|
16962
17049
|
async function addWindow(winId) {
|
|
17050
|
+
var _a, _b, _c, _d;
|
|
16963
17051
|
if (_windowsId.indexOf(winId) === -1) {
|
|
16964
17052
|
_windowsId.push(winId);
|
|
16965
17053
|
const win = windowStore.get(winId);
|
|
16966
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;
|
|
16967
17057
|
await executor.finished;
|
|
16968
17058
|
_registry.execute("window-added", groupObject, win.API);
|
|
16969
17059
|
}
|
|
@@ -17037,7 +17127,7 @@
|
|
|
17037
17127
|
const _isGroupHeaderVisible = windowWithHiddenHeader === undefined;
|
|
17038
17128
|
return _isGroupHeaderVisible;
|
|
17039
17129
|
}
|
|
17040
|
-
function
|
|
17130
|
+
function isHibernated() {
|
|
17041
17131
|
return _isHibernatedFlag;
|
|
17042
17132
|
}
|
|
17043
17133
|
function onHeaderVisibilityChanged(callback) {
|
|
@@ -17068,7 +17158,7 @@
|
|
|
17068
17158
|
return _getGroupHeaderVisibility();
|
|
17069
17159
|
},
|
|
17070
17160
|
get isHibernated() {
|
|
17071
|
-
return
|
|
17161
|
+
return isHibernated();
|
|
17072
17162
|
},
|
|
17073
17163
|
get isVisible() {
|
|
17074
17164
|
return _isVisible;
|
|
@@ -17514,6 +17604,9 @@
|
|
|
17514
17604
|
const winId = win ? win.id : "";
|
|
17515
17605
|
return executor.configure(winId, options);
|
|
17516
17606
|
}
|
|
17607
|
+
function autoArrange(displayId) {
|
|
17608
|
+
return executor.autoArrange(displayId);
|
|
17609
|
+
}
|
|
17517
17610
|
function windowAdded(callback) {
|
|
17518
17611
|
return _registry.add("window-added", callback);
|
|
17519
17612
|
}
|
|
@@ -17600,6 +17693,9 @@
|
|
|
17600
17693
|
}
|
|
17601
17694
|
};
|
|
17602
17695
|
}
|
|
17696
|
+
function onArrangementChanged(callback) {
|
|
17697
|
+
return environment.onWindowsAutoArrangeChanged(callback);
|
|
17698
|
+
}
|
|
17603
17699
|
function onEvent(callback) {
|
|
17604
17700
|
let unsubFunc;
|
|
17605
17701
|
let unsubscribed = false;
|
|
@@ -17644,6 +17740,7 @@
|
|
|
17644
17740
|
onTabAttached: tabAttached,
|
|
17645
17741
|
onTabDetached: tabDetached,
|
|
17646
17742
|
onWindowFrameColorChanged,
|
|
17743
|
+
onArrangementChanged,
|
|
17647
17744
|
get groups() {
|
|
17648
17745
|
return groups.groupsAPI;
|
|
17649
17746
|
},
|
|
@@ -17652,7 +17749,8 @@
|
|
|
17652
17749
|
onEvent,
|
|
17653
17750
|
createFlydown,
|
|
17654
17751
|
showPopup,
|
|
17655
|
-
configure
|
|
17752
|
+
configure,
|
|
17753
|
+
autoArrange
|
|
17656
17754
|
};
|
|
17657
17755
|
};
|
|
17658
17756
|
|
|
@@ -17853,6 +17951,9 @@
|
|
|
17853
17951
|
if (Array.isArray(layout.instances)) {
|
|
17854
17952
|
layoutObject.options.instances = layout.instances;
|
|
17855
17953
|
}
|
|
17954
|
+
if (typeof layout.setAsCurrent === "boolean") {
|
|
17955
|
+
layoutObject.options.setAsCurrent = layout.setAsCurrent;
|
|
17956
|
+
}
|
|
17856
17957
|
}
|
|
17857
17958
|
else {
|
|
17858
17959
|
return reject(new Error(`layout type ${layout.type} is not supported`));
|
|
@@ -19013,7 +19114,7 @@
|
|
|
19013
19114
|
};
|
|
19014
19115
|
}
|
|
19015
19116
|
|
|
19016
|
-
var version = "6.0
|
|
19117
|
+
var version = "6.1.0";
|
|
19017
19118
|
|
|
19018
19119
|
var prepareConfig = (options) => {
|
|
19019
19120
|
function getLibConfig(value, defaultMode, trueMode) {
|
|
@@ -19147,7 +19248,6 @@
|
|
|
19147
19248
|
class Notifications {
|
|
19148
19249
|
constructor(interop, logger) {
|
|
19149
19250
|
this.interop = interop;
|
|
19150
|
-
this.logger = logger;
|
|
19151
19251
|
this.NotificationsSubscribeStream = "T42.GNS.Subscribe.Notifications";
|
|
19152
19252
|
this.NotificationsCounterStream = "T42.Notifications.Counter";
|
|
19153
19253
|
this.RaiseNotificationMethodName = "T42.GNS.Publish.RaiseNotification";
|
|
@@ -19162,6 +19262,7 @@
|
|
|
19162
19262
|
this.subscribedCounterStream = false;
|
|
19163
19263
|
this.subscriptionsCountForNotifications = 0;
|
|
19164
19264
|
this.subscriptionsCountForCounter = 0;
|
|
19265
|
+
this.logger = logger.subLogger("notifications");
|
|
19165
19266
|
this._panel = new PanelAPI(interop, this.onStreamEventCore.bind(this));
|
|
19166
19267
|
this.subscribeInternalEvents();
|
|
19167
19268
|
}
|
|
@@ -19172,7 +19273,7 @@
|
|
|
19172
19273
|
return this._panel.toAPI();
|
|
19173
19274
|
}
|
|
19174
19275
|
async raise(options) {
|
|
19175
|
-
var _a, _b, _c;
|
|
19276
|
+
var _a, _b, _c, _d;
|
|
19176
19277
|
this.validate(options);
|
|
19177
19278
|
if (!this.methodsRegistered) {
|
|
19178
19279
|
const bunchOfPromises = [];
|
|
@@ -19185,9 +19286,11 @@
|
|
|
19185
19286
|
const id = String(this.nextId++);
|
|
19186
19287
|
const type = (_a = options.type) !== null && _a !== void 0 ? _a : "Notification";
|
|
19187
19288
|
const notification = {
|
|
19289
|
+
id: options.id,
|
|
19290
|
+
state: (_b = options.state) !== null && _b !== void 0 ? _b : "Active",
|
|
19188
19291
|
title: options.title,
|
|
19189
19292
|
type,
|
|
19190
|
-
severity: (
|
|
19293
|
+
severity: (_c = options.severity) !== null && _c !== void 0 ? _c : "None",
|
|
19191
19294
|
description: options.body,
|
|
19192
19295
|
glueRoutingDetailMethodName: `${this.methodNameRoot}_${STARTING_INDEX}`,
|
|
19193
19296
|
actions: [],
|
|
@@ -19204,7 +19307,7 @@
|
|
|
19204
19307
|
this.notifications[id] = g42notification;
|
|
19205
19308
|
try {
|
|
19206
19309
|
const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification });
|
|
19207
|
-
g42notification.id = (
|
|
19310
|
+
g42notification.id = (_d = invocationResult.returned) === null || _d === void 0 ? void 0 : _d.id;
|
|
19208
19311
|
}
|
|
19209
19312
|
catch (err) {
|
|
19210
19313
|
const errorMessage = err.message;
|
|
@@ -19223,7 +19326,7 @@
|
|
|
19223
19326
|
return result.returned;
|
|
19224
19327
|
}
|
|
19225
19328
|
async configure(options) {
|
|
19226
|
-
var _a, _b, _c, _d;
|
|
19329
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19227
19330
|
if (!options || Array.isArray(options)) {
|
|
19228
19331
|
throw new Error("Invalid options - should be an object.");
|
|
19229
19332
|
}
|
|
@@ -19248,6 +19351,15 @@
|
|
|
19248
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)) {
|
|
19249
19352
|
throw new Error("Expected type of sourceFilter.blocked - array.");
|
|
19250
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
|
+
}
|
|
19251
19363
|
const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
|
|
19252
19364
|
return result.returned;
|
|
19253
19365
|
}
|
|
@@ -19259,6 +19371,17 @@
|
|
|
19259
19371
|
const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "list" });
|
|
19260
19372
|
return interopResult.returned.notifications;
|
|
19261
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
|
+
}
|
|
19262
19385
|
onRaised(callback) {
|
|
19263
19386
|
return this.onStreamEventCore("on-notification-raised", callback);
|
|
19264
19387
|
}
|
|
@@ -19290,6 +19413,17 @@
|
|
|
19290
19413
|
this.closeStreamCounterSubscriptionIfNoNeeded();
|
|
19291
19414
|
};
|
|
19292
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
|
+
}
|
|
19293
19427
|
async clearAll() {
|
|
19294
19428
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" });
|
|
19295
19429
|
}
|
|
@@ -19318,17 +19452,7 @@
|
|
|
19318
19452
|
if (!state) {
|
|
19319
19453
|
throw new Error("The 'state' argument cannot be null or undefined");
|
|
19320
19454
|
}
|
|
19321
|
-
|
|
19322
|
-
throw new Error("The 'state' argument must be a string");
|
|
19323
|
-
}
|
|
19324
|
-
const validStates = [
|
|
19325
|
-
"Active",
|
|
19326
|
-
"Acknowledged",
|
|
19327
|
-
"Stale"
|
|
19328
|
-
];
|
|
19329
|
-
if (!validStates.includes(state)) {
|
|
19330
|
-
throw new Error(`The state argument: ${state} is not valid!`);
|
|
19331
|
-
}
|
|
19455
|
+
this.validateState(state);
|
|
19332
19456
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } });
|
|
19333
19457
|
}
|
|
19334
19458
|
toAPI() {
|
|
@@ -19346,11 +19470,13 @@
|
|
|
19346
19470
|
onClosed: this.onClosed.bind(this),
|
|
19347
19471
|
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
19348
19472
|
onCounterChanged: this.onCounterChanged.bind(this),
|
|
19473
|
+
onDataChanged: this.onDataChanged.bind(this),
|
|
19349
19474
|
clearAll: this.clearAll.bind(this),
|
|
19350
19475
|
clearOld: this.clearOld.bind(this),
|
|
19351
19476
|
clear: this.clear.bind(this),
|
|
19352
19477
|
click: this.click.bind(this),
|
|
19353
|
-
setState: this.setState.bind(this)
|
|
19478
|
+
setState: this.setState.bind(this),
|
|
19479
|
+
updateData: this.updateData.bind(this),
|
|
19354
19480
|
};
|
|
19355
19481
|
}
|
|
19356
19482
|
onStreamEventCore(key, callback) {
|
|
@@ -19436,6 +19562,22 @@
|
|
|
19436
19562
|
if (options.toastExpiry && typeof options.toastExpiry !== "number") {
|
|
19437
19563
|
throw new Error("invalid options - toastExpiry should be a number");
|
|
19438
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
|
+
}
|
|
19439
19581
|
}
|
|
19440
19582
|
subscribe() {
|
|
19441
19583
|
this.subscriptionsCountForNotifications++;
|
|
@@ -19547,7 +19689,7 @@
|
|
|
19547
19689
|
if (notification.state === "Closed") {
|
|
19548
19690
|
this.registry.execute("on-notification-closed", { id: notification.id });
|
|
19549
19691
|
}
|
|
19550
|
-
else
|
|
19692
|
+
else {
|
|
19551
19693
|
this.registry.execute("on-notification-raised", notification);
|
|
19552
19694
|
}
|
|
19553
19695
|
}
|
|
@@ -19555,14 +19697,22 @@
|
|
|
19555
19697
|
handleDeltas(message) {
|
|
19556
19698
|
const deltas = message.deltas;
|
|
19557
19699
|
deltas.forEach((info) => {
|
|
19700
|
+
var _a;
|
|
19558
19701
|
const id = info.id;
|
|
19559
|
-
const delta = info.delta;
|
|
19702
|
+
const delta = (_a = info.delta) !== null && _a !== void 0 ? _a : {};
|
|
19560
19703
|
if (delta.state === "Closed") {
|
|
19561
|
-
this.registry.execute("on-notification-closed", { id });
|
|
19704
|
+
this.registry.execute("on-notification-closed", { id, ...delta });
|
|
19562
19705
|
}
|
|
19563
|
-
else {
|
|
19706
|
+
else if (delta.state) {
|
|
19564
19707
|
this.registry.execute("on-state-changed", { id }, delta.state);
|
|
19565
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
|
+
}
|
|
19566
19716
|
});
|
|
19567
19717
|
}
|
|
19568
19718
|
handleOnClosed(id) {
|
|
@@ -20049,9 +20199,9 @@
|
|
|
20049
20199
|
intentFlag = rest;
|
|
20050
20200
|
}
|
|
20051
20201
|
try {
|
|
20052
|
-
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
20202
|
+
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args, caller) => {
|
|
20053
20203
|
if (this.myIntents.has(intentName)) {
|
|
20054
|
-
return handler(args);
|
|
20204
|
+
return handler(args, caller);
|
|
20055
20205
|
}
|
|
20056
20206
|
});
|
|
20057
20207
|
}
|
|
Binary file
|