@adaptabletools/adaptable-plugin-interopio 19.2.4 → 20.0.0-canary.1
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/package.json +2 -2
- package/src/index.js +15 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-plugin-interopio",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0-canary.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "http://www.adaptabletools.com/",
|
|
6
6
|
"author": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@interopio/desktop": "^6.1.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@adaptabletools/adaptable": "
|
|
16
|
+
"@adaptabletools/adaptable": "20.0.0-canary.1"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"module": "src/index.js"
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { AdaptablePlugin, } from '@adaptabletools/adaptable/types';
|
|
2
|
+
import { version, name } from '../package.json';
|
|
3
|
+
import { version as coreVersion } from '@adaptabletools/adaptable/package.json';
|
|
2
4
|
import { InteropioPluginApiImpl } from './InteropioPluginApiImpl';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
6
|
+
if (version !== coreVersion) {
|
|
7
|
+
console.warn(`
|
|
8
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
9
|
+
!!!!!!! "@adaptabletools/adaptable-plugin-interopio${suffix}" (v @${version}) and "@adaptabletools/adaptable${suffix}" (v @${coreVersion}) have different versions - they should have the exact same version.
|
|
10
|
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
11
|
+
`);
|
|
12
|
+
}
|
|
10
13
|
const defaultOptions = {
|
|
11
14
|
showAdaptableAlertsAsNotifications: true,
|
|
12
15
|
applicationName: 'Adaptable',
|
|
@@ -15,7 +18,7 @@ class InteropioPlugin extends AdaptablePlugin {
|
|
|
15
18
|
constructor(options, interopApi) {
|
|
16
19
|
super(options);
|
|
17
20
|
this.pluginId = 'interop';
|
|
18
|
-
this.options =
|
|
21
|
+
this.options = { ...defaultOptions, ...options };
|
|
19
22
|
this.interopApi = interopApi;
|
|
20
23
|
}
|
|
21
24
|
onAdaptableReady(adaptable) {
|
|
@@ -37,7 +40,6 @@ class InteropioPlugin extends AdaptablePlugin {
|
|
|
37
40
|
* -- using this information the action map is populated
|
|
38
41
|
*/
|
|
39
42
|
async integrateAdaptableAlerts() {
|
|
40
|
-
var _a;
|
|
41
43
|
if (!this.options.showAdaptableAlertsAsNotifications) {
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
@@ -52,10 +54,8 @@ class InteropioPlugin extends AdaptablePlugin {
|
|
|
52
54
|
const { alert, button } = memoAction;
|
|
53
55
|
const context = {
|
|
54
56
|
alert: alert,
|
|
55
|
-
adaptableApi: this.adaptable.api,
|
|
56
|
-
userName: this.adaptable.adaptableOptions.userName,
|
|
57
|
-
adaptableId: this.adaptable.adaptableOptions.adaptableId,
|
|
58
57
|
formData: {},
|
|
58
|
+
...this.adaptable.api.internalApi.buildBaseContext(),
|
|
59
59
|
};
|
|
60
60
|
this.adaptable.api.alertApi.internalApi.executeAlertButton(button, context);
|
|
61
61
|
// we need to delete all actions for the given alert
|
|
@@ -68,14 +68,13 @@ class InteropioPlugin extends AdaptablePlugin {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
await this.interopApi.interop.register(ADAPTABLE_INTEROP_NOTIFICATION_HANDLER, adaptableInteropNotificationHandler);
|
|
71
|
-
|
|
72
|
-
var _a;
|
|
71
|
+
this.adaptable?.api.eventApi.on('AlertFired', (alertInfo) => {
|
|
73
72
|
const adaptableAlert = alertInfo.alert;
|
|
74
73
|
const { header, message } = adaptableAlert;
|
|
75
74
|
const adaptableActions = [];
|
|
76
75
|
if (adaptableAlert.alertDefinition.AlertForm &&
|
|
77
76
|
typeof adaptableAlert.alertDefinition.AlertForm !== 'string' &&
|
|
78
|
-
Array.isArray(
|
|
77
|
+
Array.isArray(adaptableAlert.alertDefinition.AlertForm?.Buttons)) {
|
|
79
78
|
adaptableAlert.alertDefinition.AlertForm.Buttons.forEach(async (button, index) => {
|
|
80
79
|
const buttonId = `${button.Label}.${Date.now()}`;
|
|
81
80
|
const action = `adaptable-action-button-${button.Label}-${index}-${Date.now()}`;
|
|
@@ -83,7 +82,7 @@ class InteropioPlugin extends AdaptablePlugin {
|
|
|
83
82
|
title: button.Label,
|
|
84
83
|
action,
|
|
85
84
|
};
|
|
86
|
-
if (button.
|
|
85
|
+
if (button.Command) {
|
|
87
86
|
notificationAction.interop = {
|
|
88
87
|
method: ADAPTABLE_INTEROP_NOTIFICATION_HANDLER,
|
|
89
88
|
arguments: {
|