@ixon-cdk/iframe-adapter 1.2.1 → 1.3.0-next.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/index.js +154 -0
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -14,6 +14,18 @@ const EVENTS = {
|
|
|
14
14
|
ResourceDataClientRender: `${EVENT_NS}rdc:render`,
|
|
15
15
|
ResourceDataClientRenderResult: `${EVENT_NS}rdc:renderresult`,
|
|
16
16
|
|
|
17
|
+
// ActionBottomSheet
|
|
18
|
+
OpenActionBottomSheet: `${EVENT_NS}openactionbottomsheet`,
|
|
19
|
+
OpenActionBottomSheetResult: `${EVENT_NS}openactionbottomsheetresult`,
|
|
20
|
+
|
|
21
|
+
// Dialogs
|
|
22
|
+
OpenAlertDialog: `${EVENT_NS}openalertdialog`,
|
|
23
|
+
OpenAlertDialogResult: `${EVENT_NS}openalertdialogresult`,
|
|
24
|
+
OpenConfirmDialog: `${EVENT_NS}openconfirmdialog`,
|
|
25
|
+
OpenConfirmDialogResult: `${EVENT_NS}openconfirmdialogresult`,
|
|
26
|
+
OpenFormDialog: `${EVENT_NS}openformdialog`,
|
|
27
|
+
OpenFormDialogResult: `${EVENT_NS}openformdialogresult`,
|
|
28
|
+
|
|
17
29
|
// VPN
|
|
18
30
|
ShowVpnStatusDetails: `${EVENT_NS}showvpnstatusdetails`,
|
|
19
31
|
ToggleVpn: `${EVENT_NS}togglevpn`,
|
|
@@ -80,6 +92,10 @@ class ComponentContext {
|
|
|
80
92
|
throw new NotImplementedError();
|
|
81
93
|
}
|
|
82
94
|
|
|
95
|
+
createObjectStorageClient() {
|
|
96
|
+
throw new NotImplementedError();
|
|
97
|
+
}
|
|
98
|
+
|
|
83
99
|
createResourceDataClient() {
|
|
84
100
|
const clientId = crypto.randomUUID();
|
|
85
101
|
window.parent.postMessage(
|
|
@@ -132,6 +148,102 @@ class ComponentContext {
|
|
|
132
148
|
);
|
|
133
149
|
}
|
|
134
150
|
|
|
151
|
+
openActionBottomSheet(options) {
|
|
152
|
+
return new Promise(resolve => {
|
|
153
|
+
window.addEventListener(
|
|
154
|
+
'message',
|
|
155
|
+
_actionBottomSheetResultHandler,
|
|
156
|
+
false,
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
window.parent.postMessage(
|
|
160
|
+
{ type: EVENTS.OpenActionBottomSheet, payload: { options } },
|
|
161
|
+
'*',
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
function _actionBottomSheetResultHandler(event) {
|
|
165
|
+
if (event.source !== window.parent) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (event.data.type === EVENTS.OpenActionBottomSheetResult) {
|
|
170
|
+
window.removeEventListener(
|
|
171
|
+
'message',
|
|
172
|
+
_actionBottomSheetResultHandler,
|
|
173
|
+
false,
|
|
174
|
+
);
|
|
175
|
+
resolve(event.data.payload.result);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
openAlertDialog(options) {
|
|
182
|
+
return new Promise(resolve => {
|
|
183
|
+
window.addEventListener('message', _dialogResultHandler, false);
|
|
184
|
+
|
|
185
|
+
window.parent.postMessage(
|
|
186
|
+
{ type: EVENTS.OpenAlertDialog, payload: { options } },
|
|
187
|
+
'*',
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
function _dialogResultHandler(event) {
|
|
191
|
+
if (event.source !== window.parent) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (event.data.type === EVENTS.OpenAlertDialogResult) {
|
|
196
|
+
window.removeEventListener('message', _dialogResultHandler, false);
|
|
197
|
+
resolve(event.data.payload.result);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
openConfirmDialog(options) {
|
|
204
|
+
return new Promise(resolve => {
|
|
205
|
+
window.addEventListener('message', _dialogResultHandler, false);
|
|
206
|
+
|
|
207
|
+
window.parent.postMessage(
|
|
208
|
+
{ type: EVENTS.OpenConfirmDialog, payload: { options } },
|
|
209
|
+
'*',
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
function _dialogResultHandler(event) {
|
|
213
|
+
if (event.source !== window.parent) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (event.data.type === EVENTS.OpenConfirmDialogResult) {
|
|
218
|
+
window.removeEventListener('message', _dialogResultHandler, false);
|
|
219
|
+
resolve(event.data.payload.result);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
openFormDialog(options) {
|
|
226
|
+
return new Promise(resolve => {
|
|
227
|
+
window.addEventListener('message', _dialogResultHandler, false);
|
|
228
|
+
|
|
229
|
+
window.parent.postMessage(
|
|
230
|
+
{ type: EVENTS.OpenFormDialog, payload: { options } },
|
|
231
|
+
'*',
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
function _dialogResultHandler(event) {
|
|
235
|
+
if (event.source !== window.parent) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (event.data.type === EVENTS.OpenFormDialogResult) {
|
|
240
|
+
window.removeEventListener('message', _dialogResultHandler, false);
|
|
241
|
+
resolve(event.data.payload.result);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
135
247
|
saveAsFile() {
|
|
136
248
|
throw new NotImplementedError();
|
|
137
249
|
}
|
|
@@ -425,6 +537,48 @@ export function connect({ iframe, context }) {
|
|
|
425
537
|
break;
|
|
426
538
|
}
|
|
427
539
|
|
|
540
|
+
/**
|
|
541
|
+
* ActionBottomSheet
|
|
542
|
+
*/
|
|
543
|
+
case EVENTS.OpenActionBottomSheet:
|
|
544
|
+
context
|
|
545
|
+
.openActionBottomSheet(event.data.payload.options)
|
|
546
|
+
.then(result => {
|
|
547
|
+
iframe.contentWindow.postMessage(
|
|
548
|
+
{ type: EVENTS.OpenActionBottomSheetResult, payload: { result } },
|
|
549
|
+
'*',
|
|
550
|
+
);
|
|
551
|
+
});
|
|
552
|
+
break;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Dialogs
|
|
556
|
+
*/
|
|
557
|
+
case EVENTS.OpenAlertDialog:
|
|
558
|
+
context.openAlertDialog(event.data.payload.options).then(result => {
|
|
559
|
+
iframe.contentWindow.postMessage(
|
|
560
|
+
{ type: EVENTS.OpenAlertDialogResult, payload: { result } },
|
|
561
|
+
'*',
|
|
562
|
+
);
|
|
563
|
+
});
|
|
564
|
+
break;
|
|
565
|
+
case EVENTS.OpenConfirmDialog:
|
|
566
|
+
context.openConfirmDialog(event.data.payload.options).then(result => {
|
|
567
|
+
iframe.contentWindow.postMessage(
|
|
568
|
+
{ type: EVENTS.OpenConfirmDialogResult, payload: { result } },
|
|
569
|
+
'*',
|
|
570
|
+
);
|
|
571
|
+
});
|
|
572
|
+
break;
|
|
573
|
+
case EVENTS.OpenFormDialog:
|
|
574
|
+
context.openFormDialog(event.data.payload.options).then(result => {
|
|
575
|
+
iframe.contentWindow.postMessage(
|
|
576
|
+
{ type: EVENTS.OpenFormDialogResult, payload: { result } },
|
|
577
|
+
'*',
|
|
578
|
+
);
|
|
579
|
+
});
|
|
580
|
+
break;
|
|
581
|
+
|
|
428
582
|
/**
|
|
429
583
|
* VPN
|
|
430
584
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixon-cdk/iframe-adapter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-next.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@ixon-cdk/types": "^1.
|
|
13
|
+
"@ixon-cdk/types": "^1.3.0-next.1"
|
|
14
14
|
}
|
|
15
15
|
}
|