novo-elements 9.2.0-next.4 → 9.2.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/esm2020/utils/app-bridge/AppBridge.mjs +180 -183
- package/esm2020/utils/app-bridge/index.mjs +1 -2
- package/fesm2015/novo-elements-utils.mjs +143 -184
- package/fesm2015/novo-elements-utils.mjs.map +1 -1
- package/fesm2020/novo-elements-utils.mjs +142 -182
- package/fesm2020/novo-elements-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/app-bridge/AppBridge.d.ts +37 -30
- package/utils/app-bridge/index.d.ts +0 -1
- package/esm2020/utils/app-bridge/interfaces.mjs +0 -38
- package/utils/app-bridge/interfaces.d.ts +0 -58
|
@@ -40,7 +40,6 @@ const MESSAGE_TYPES = {
|
|
|
40
40
|
REQUEST_DATA: 'requestData',
|
|
41
41
|
CALLBACK: 'callback',
|
|
42
42
|
};
|
|
43
|
-
|
|
44
43
|
class AppBridgeService {
|
|
45
44
|
create(name) {
|
|
46
45
|
return new AppBridge(name);
|
|
@@ -56,16 +55,15 @@ class DevAppBridgeService {
|
|
|
56
55
|
}
|
|
57
56
|
class AppBridge {
|
|
58
57
|
// Type?
|
|
59
|
-
constructor(traceName = 'AppBridge'
|
|
58
|
+
constructor(traceName = 'AppBridge') {
|
|
60
59
|
this.id = `${Date.now()}`;
|
|
61
60
|
this._registeredFrames = [];
|
|
62
61
|
this._handlers = {};
|
|
63
62
|
this._tracing = false;
|
|
64
63
|
this._eventListeners = {};
|
|
65
64
|
this.traceName = traceName;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.postRobot.CONFIG.LOG_LEVEL = 'error';
|
|
65
|
+
if (postRobot) {
|
|
66
|
+
postRobot.CONFIG.LOG_LEVEL = 'error';
|
|
69
67
|
try {
|
|
70
68
|
this._setupHandlers();
|
|
71
69
|
}
|
|
@@ -86,152 +84,122 @@ class AppBridge {
|
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
_setupHandlers() {
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const windowName = await this.register(event.data);
|
|
87
|
+
// Register
|
|
88
|
+
postRobot.on(MESSAGE_TYPES.REGISTER, (event) => {
|
|
89
|
+
this._trace(MESSAGE_TYPES.REGISTER, event);
|
|
90
|
+
this._registeredFrames.push(event);
|
|
91
|
+
return this.register(event.data).then((windowName) => {
|
|
95
92
|
return { windowName };
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return this.refresh(event.data).then((success) => {
|
|
125
|
-
return { success };
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
// PIN
|
|
129
|
-
[MESSAGE_TYPES.PIN]: (event) => {
|
|
130
|
-
return this.pin(event.data).then((success) => {
|
|
131
|
-
return { success };
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
// PING
|
|
135
|
-
[MESSAGE_TYPES.PING]: (event) => {
|
|
136
|
-
return this.httpGET('ping', undefined, event.data.origin).then((result) => {
|
|
137
|
-
return { data: result.data, error: result.error };
|
|
138
|
-
});
|
|
139
|
-
},
|
|
140
|
-
// REQUEST_DATA
|
|
141
|
-
[MESSAGE_TYPES.REQUEST_DATA]: (event) => {
|
|
142
|
-
return this.requestData(event.data).then((result) => {
|
|
143
|
-
return { data: result.data, error: result.error };
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
// CALLBACKS
|
|
147
|
-
[MESSAGE_TYPES.CALLBACK]: (event) => {
|
|
148
|
-
return this.callback(event.data).then((success) => {
|
|
149
|
-
return { success };
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
// HTTP-GET
|
|
153
|
-
[MESSAGE_TYPES.HTTP_GET]: (event) => {
|
|
154
|
-
return this.httpGET(event.data.relativeURL, undefined, event.data.origin).then((result) => {
|
|
155
|
-
return { data: result.data, error: result.error };
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
// HTTP-POST
|
|
159
|
-
[MESSAGE_TYPES.HTTP_POST]: (event) => {
|
|
160
|
-
return this.httpPOST(event.data.relativeURL, event.data.data, undefined, event.data.origin).then((result) => {
|
|
161
|
-
return { data: result.data, error: result.error };
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
// HTTP-PUT
|
|
165
|
-
[MESSAGE_TYPES.HTTP_PUT]: (event) => {
|
|
166
|
-
return this.httpPUT(event.data.relativeURL, event.data.data, undefined, event.data.origin).then((result) => {
|
|
167
|
-
return { data: result.data, error: result.error };
|
|
168
|
-
});
|
|
169
|
-
},
|
|
170
|
-
// HTTP-DELETE
|
|
171
|
-
[MESSAGE_TYPES.HTTP_DELETE]: (event) => {
|
|
172
|
-
return this.httpDELETE(event.data.relativeURL, undefined, event.data.origin).then((result) => {
|
|
173
|
-
return { data: result.data, error: result.error };
|
|
174
|
-
});
|
|
175
|
-
},
|
|
176
|
-
// Custom Events
|
|
177
|
-
[MESSAGE_TYPES.CUSTOM_EVENT]: async (event) => {
|
|
178
|
-
if (this._eventListeners[event.data.event]) {
|
|
179
|
-
this._eventListeners[event.data.event].forEach((listener) => {
|
|
180
|
-
listener(event.data.data);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
if (this._registeredFrames.length > 0) {
|
|
184
|
-
this._registeredFrames.forEach((frame) => {
|
|
185
|
-
// TODO: Should this make sure it doesn't echo the custom event back to the author?
|
|
186
|
-
this.postRobot.send(frame.source, MESSAGE_TYPES.CUSTOM_EVENT, event.data);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
// Update
|
|
96
|
+
postRobot.on(MESSAGE_TYPES.UPDATE, (event) => {
|
|
97
|
+
this._trace(MESSAGE_TYPES.UPDATE, event);
|
|
98
|
+
return this.update(event.data).then((success) => {
|
|
99
|
+
return { success };
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
// Open
|
|
103
|
+
postRobot.on(MESSAGE_TYPES.OPEN, (event) => {
|
|
104
|
+
this._trace(MESSAGE_TYPES.OPEN, event);
|
|
105
|
+
return this.open(event.data).then((success) => {
|
|
106
|
+
return { success };
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
postRobot.on(MESSAGE_TYPES.OPEN_LIST, (event) => {
|
|
110
|
+
this._trace(MESSAGE_TYPES.OPEN_LIST, event);
|
|
111
|
+
return this.openList(event.data).then((success) => {
|
|
112
|
+
return { success };
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
// Close
|
|
116
|
+
postRobot.on(MESSAGE_TYPES.CLOSE, (event) => {
|
|
117
|
+
this._trace(MESSAGE_TYPES.CLOSE, event);
|
|
118
|
+
const index = this._registeredFrames.findIndex((frame) => frame.data.id === event.data.id);
|
|
119
|
+
if (index !== -1) {
|
|
120
|
+
this._registeredFrames.splice(index, 1);
|
|
189
121
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.postRobot.on(msgType, event => {
|
|
193
|
-
this._trace(msgType, event);
|
|
194
|
-
const origin = Array.isArray(event.data.origin) ? event.data.origin : [];
|
|
195
|
-
if (event.origin !== this.windowOrigin()) {
|
|
196
|
-
origin.unshift(event.origin);
|
|
197
|
-
}
|
|
198
|
-
else if (origin.indexOf(event.data.originTraceName) === -1) {
|
|
199
|
-
origin.unshift(event.data.originTraceName);
|
|
200
|
-
}
|
|
201
|
-
event.data.origin = origin;
|
|
202
|
-
event.data.source = event.source;
|
|
203
|
-
return defaultMsgHandlers[msgType](event);
|
|
122
|
+
return this.close(event.data).then((success) => {
|
|
123
|
+
return { success };
|
|
204
124
|
});
|
|
205
125
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
let returnPromise;
|
|
212
|
-
if (this._handlers[handler]) {
|
|
213
|
-
// Should be directly returning a promise. However, as a fallback, provide callback arguments
|
|
214
|
-
let callbackSuccess, callbackFail;
|
|
215
|
-
returnPromise = new Promise((s, f) => {
|
|
216
|
-
callbackSuccess = s;
|
|
217
|
-
callbackFail = f;
|
|
126
|
+
// Refresh
|
|
127
|
+
postRobot.on(MESSAGE_TYPES.REFRESH, (event) => {
|
|
128
|
+
this._trace(MESSAGE_TYPES.REFRESH, event);
|
|
129
|
+
return this.refresh(event.data).then((success) => {
|
|
130
|
+
return { success };
|
|
218
131
|
});
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
132
|
+
});
|
|
133
|
+
// PIN
|
|
134
|
+
postRobot.on(MESSAGE_TYPES.PIN, (event) => {
|
|
135
|
+
this._trace(MESSAGE_TYPES.PIN, event);
|
|
136
|
+
return this.pin(event.data).then((success) => {
|
|
137
|
+
return { success };
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
// PING
|
|
141
|
+
postRobot.on(MESSAGE_TYPES.PING, (event) => {
|
|
142
|
+
this._trace(MESSAGE_TYPES.PING, event);
|
|
143
|
+
return this.httpGET('ping').then((result) => {
|
|
144
|
+
return { data: result.data, error: result.error };
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
// REQUEST_DATA
|
|
148
|
+
postRobot.on(MESSAGE_TYPES.REQUEST_DATA, (event) => {
|
|
149
|
+
this._trace(MESSAGE_TYPES.REQUEST_DATA, event);
|
|
150
|
+
return this.requestData(event.data).then((result) => {
|
|
151
|
+
return { data: result.data, error: result.error };
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
// CALLBACKS
|
|
155
|
+
postRobot.on(MESSAGE_TYPES.CALLBACK, (event) => {
|
|
156
|
+
this._trace(MESSAGE_TYPES.CALLBACK, event);
|
|
157
|
+
return this.callback(event.data).then((success) => {
|
|
158
|
+
return { success };
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
// HTTP-GET
|
|
162
|
+
postRobot.on(MESSAGE_TYPES.HTTP_GET, (event) => {
|
|
163
|
+
this._trace(MESSAGE_TYPES.HTTP_GET, event);
|
|
164
|
+
return this.httpGET(event.data.relativeURL).then((result) => {
|
|
165
|
+
return { data: result.data, error: result.error };
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
// HTTP-POST
|
|
169
|
+
postRobot.on(MESSAGE_TYPES.HTTP_POST, (event) => {
|
|
170
|
+
this._trace(MESSAGE_TYPES.HTTP_POST, event);
|
|
171
|
+
return this.httpPOST(event.data.relativeURL, event.data.data).then((result) => {
|
|
172
|
+
return { data: result.data, error: result.error };
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
// HTTP-PUT
|
|
176
|
+
postRobot.on(MESSAGE_TYPES.HTTP_PUT, (event) => {
|
|
177
|
+
this._trace(MESSAGE_TYPES.HTTP_PUT, event);
|
|
178
|
+
return this.httpPUT(event.data.relativeURL, event.data.data).then((result) => {
|
|
179
|
+
return { data: result.data, error: result.error };
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
// HTTP-DELETE
|
|
183
|
+
postRobot.on(MESSAGE_TYPES.HTTP_DELETE, (event) => {
|
|
184
|
+
this._trace(MESSAGE_TYPES.HTTP_DELETE, event);
|
|
185
|
+
return this.httpDELETE(event.data.relativeURL).then((result) => {
|
|
186
|
+
return { data: result.data, error: result.error };
|
|
226
187
|
});
|
|
227
|
-
|
|
228
|
-
|
|
188
|
+
});
|
|
189
|
+
// Custom Events
|
|
190
|
+
postRobot.on(MESSAGE_TYPES.CUSTOM_EVENT, (event) => {
|
|
191
|
+
this._trace(MESSAGE_TYPES.CUSTOM_EVENT, event);
|
|
192
|
+
if (this._eventListeners[event.data.event]) {
|
|
193
|
+
this._eventListeners[event.data.event].forEach((listener) => {
|
|
194
|
+
listener(event.data.data);
|
|
195
|
+
});
|
|
229
196
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
197
|
+
if (this._registeredFrames.length > 0) {
|
|
198
|
+
this._registeredFrames.forEach((frame) => {
|
|
199
|
+
postRobot.send(frame.source, MESSAGE_TYPES.CUSTOM_EVENT, event.data);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
235
203
|
}
|
|
236
204
|
/**
|
|
237
205
|
* Fires or responds to an open event
|
|
@@ -251,7 +219,7 @@ class AppBridge {
|
|
|
251
219
|
}
|
|
252
220
|
else {
|
|
253
221
|
Object.assign(packet, { id: this.id, windowName: this.windowName });
|
|
254
|
-
|
|
222
|
+
postRobot
|
|
255
223
|
.sendToParent(MESSAGE_TYPES.OPEN, packet)
|
|
256
224
|
.then((event) => {
|
|
257
225
|
this._trace(`${MESSAGE_TYPES.OPEN} (callback)`, event);
|
|
@@ -287,7 +255,7 @@ class AppBridge {
|
|
|
287
255
|
else {
|
|
288
256
|
const openListPacket = {};
|
|
289
257
|
Object.assign(openListPacket, { type: 'List', entityType: packet.type, keywords: packet.keywords, criteria: packet.criteria });
|
|
290
|
-
|
|
258
|
+
postRobot
|
|
291
259
|
.sendToParent(MESSAGE_TYPES.OPEN_LIST, packet)
|
|
292
260
|
.then((event) => {
|
|
293
261
|
this._trace(`${MESSAGE_TYPES.OPEN_LIST} (callback)`, event);
|
|
@@ -322,7 +290,7 @@ class AppBridge {
|
|
|
322
290
|
}
|
|
323
291
|
else {
|
|
324
292
|
Object.assign(packet, { id: this.id, windowName: this.windowName });
|
|
325
|
-
|
|
293
|
+
postRobot
|
|
326
294
|
.sendToParent(MESSAGE_TYPES.UPDATE, packet)
|
|
327
295
|
.then((event) => {
|
|
328
296
|
this._trace(`${MESSAGE_TYPES.UPDATE} (callback)`, event);
|
|
@@ -359,7 +327,7 @@ class AppBridge {
|
|
|
359
327
|
console.info('[AppBridge] - close(packet) is deprecated! Please just use close()!'); // tslint:disable-line
|
|
360
328
|
}
|
|
361
329
|
const realPacket = { id: this.id, windowName: this.windowName };
|
|
362
|
-
|
|
330
|
+
postRobot
|
|
363
331
|
.sendToParent(MESSAGE_TYPES.CLOSE, realPacket)
|
|
364
332
|
.then((event) => {
|
|
365
333
|
this._trace(`${MESSAGE_TYPES.CLOSE} (callback)`, event);
|
|
@@ -396,7 +364,7 @@ class AppBridge {
|
|
|
396
364
|
console.info('[AppBridge] - refresh(packet) is deprecated! Please just use refresh()!'); // tslint:disable-line
|
|
397
365
|
}
|
|
398
366
|
const realPacket = { id: this.id, windowName: this.windowName };
|
|
399
|
-
|
|
367
|
+
postRobot
|
|
400
368
|
.sendToParent(MESSAGE_TYPES.REFRESH, realPacket)
|
|
401
369
|
.then((event) => {
|
|
402
370
|
this._trace(`${MESSAGE_TYPES.REFRESH} (callback)`, event);
|
|
@@ -421,7 +389,7 @@ class AppBridge {
|
|
|
421
389
|
});
|
|
422
390
|
}
|
|
423
391
|
else {
|
|
424
|
-
|
|
392
|
+
postRobot
|
|
425
393
|
.sendToParent(MESSAGE_TYPES.PING, {})
|
|
426
394
|
.then((event) => {
|
|
427
395
|
resolve({ data: event.data.data, error: event.data.error });
|
|
@@ -452,7 +420,7 @@ class AppBridge {
|
|
|
452
420
|
console.info('[AppBridge] - pin(packet) is deprecated! Please just use pin()!'); // tslint:disable-line
|
|
453
421
|
}
|
|
454
422
|
const realPacket = { id: this.id, windowName: this.windowName };
|
|
455
|
-
|
|
423
|
+
postRobot
|
|
456
424
|
.sendToParent(MESSAGE_TYPES.PIN, realPacket)
|
|
457
425
|
.then((event) => {
|
|
458
426
|
this._trace(`${MESSAGE_TYPES.PIN} (callback)`, event);
|
|
@@ -487,7 +455,7 @@ class AppBridge {
|
|
|
487
455
|
}
|
|
488
456
|
else {
|
|
489
457
|
Object.assign(packet, { id: this.id, windowName: this.windowName });
|
|
490
|
-
|
|
458
|
+
postRobot
|
|
491
459
|
.sendToParent(MESSAGE_TYPES.REQUEST_DATA, packet)
|
|
492
460
|
.then((event) => {
|
|
493
461
|
this._trace(`${MESSAGE_TYPES.REQUEST_DATA} (callback)`, event);
|
|
@@ -522,7 +490,7 @@ class AppBridge {
|
|
|
522
490
|
}
|
|
523
491
|
else {
|
|
524
492
|
Object.assign(packet, { id: this.id, windowName: this.windowName });
|
|
525
|
-
|
|
493
|
+
postRobot
|
|
526
494
|
.sendToParent(MESSAGE_TYPES.CALLBACK, packet)
|
|
527
495
|
.then((event) => {
|
|
528
496
|
this._trace(`${MESSAGE_TYPES.CALLBACK} (callback)`, event);
|
|
@@ -557,7 +525,7 @@ class AppBridge {
|
|
|
557
525
|
}
|
|
558
526
|
else {
|
|
559
527
|
Object.assign(packet, { id: this.id });
|
|
560
|
-
|
|
528
|
+
postRobot
|
|
561
529
|
.sendToParent(MESSAGE_TYPES.REGISTER, packet)
|
|
562
530
|
.then((event) => {
|
|
563
531
|
this._trace(`${MESSAGE_TYPES.REGISTER} (callback)`, event);
|
|
@@ -579,19 +547,17 @@ class AppBridge {
|
|
|
579
547
|
/**
|
|
580
548
|
* Fires or responds to an HTTP_GET event
|
|
581
549
|
* @param packet any - packet of data to send with the event
|
|
582
|
-
* @param timeout - how long to attempt the request before reporting an error
|
|
583
|
-
* @param originStack - the domain of the previous frame(s) the request originated from
|
|
584
550
|
*/
|
|
585
|
-
httpGET(relativeURL, timeout = 10000
|
|
551
|
+
httpGET(relativeURL, timeout = 10000) {
|
|
586
552
|
return new Promise((resolve, reject) => {
|
|
587
553
|
if (this._handlers[AppBridgeHandler.HTTP]) {
|
|
588
|
-
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.GET, relativeURL
|
|
554
|
+
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.GET, relativeURL }, (data, error) => {
|
|
589
555
|
resolve({ data, error });
|
|
590
556
|
});
|
|
591
557
|
}
|
|
592
558
|
else {
|
|
593
|
-
|
|
594
|
-
.sendToParent(MESSAGE_TYPES.HTTP_GET, { relativeURL
|
|
559
|
+
postRobot
|
|
560
|
+
.sendToParent(MESSAGE_TYPES.HTTP_GET, { relativeURL }, { timeout })
|
|
595
561
|
.then((event) => {
|
|
596
562
|
resolve({ data: event.data.data, error: event.data.error });
|
|
597
563
|
})
|
|
@@ -604,19 +570,17 @@ class AppBridge {
|
|
|
604
570
|
/**
|
|
605
571
|
* Fires or responds to an HTTP_POST event
|
|
606
572
|
* @param packet any - packet of data to send with the event
|
|
607
|
-
* @param timeout - how long to attempt the request before reporting an error
|
|
608
|
-
* @param originStack - the domain of the previous frame(s) the request originated from
|
|
609
573
|
*/
|
|
610
|
-
httpPOST(relativeURL, postData, timeout = 10000
|
|
574
|
+
httpPOST(relativeURL, postData, timeout = 10000) {
|
|
611
575
|
return new Promise((resolve, reject) => {
|
|
612
576
|
if (this._handlers[AppBridgeHandler.HTTP]) {
|
|
613
|
-
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.POST, relativeURL, data: postData
|
|
577
|
+
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.POST, relativeURL, data: postData }, (data, error) => {
|
|
614
578
|
resolve({ data, error });
|
|
615
579
|
});
|
|
616
580
|
}
|
|
617
581
|
else {
|
|
618
|
-
|
|
619
|
-
.sendToParent(MESSAGE_TYPES.HTTP_POST, { relativeURL, data: postData
|
|
582
|
+
postRobot
|
|
583
|
+
.sendToParent(MESSAGE_TYPES.HTTP_POST, { relativeURL, data: postData }, { timeout })
|
|
620
584
|
.then((event) => {
|
|
621
585
|
resolve({ data: event.data.data, error: event.data.error });
|
|
622
586
|
})
|
|
@@ -629,19 +593,17 @@ class AppBridge {
|
|
|
629
593
|
/**
|
|
630
594
|
* Fires or responds to an HTTP_PUT event
|
|
631
595
|
* @param packet any - packet of data to send with the event
|
|
632
|
-
* @param timeout - how long to attempt the request before reporting an error
|
|
633
|
-
* @param originStack - the domain of the previous frame(s) the request originated from
|
|
634
596
|
*/
|
|
635
|
-
httpPUT(relativeURL, putData, timeout = 10000
|
|
597
|
+
httpPUT(relativeURL, putData, timeout = 10000) {
|
|
636
598
|
return new Promise((resolve, reject) => {
|
|
637
599
|
if (this._handlers[AppBridgeHandler.HTTP]) {
|
|
638
|
-
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.PUT, relativeURL, data: putData
|
|
600
|
+
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.PUT, relativeURL, data: putData }, (data, error) => {
|
|
639
601
|
resolve({ data, error });
|
|
640
602
|
});
|
|
641
603
|
}
|
|
642
604
|
else {
|
|
643
|
-
|
|
644
|
-
.sendToParent(MESSAGE_TYPES.HTTP_PUT, { relativeURL, data: putData
|
|
605
|
+
postRobot
|
|
606
|
+
.sendToParent(MESSAGE_TYPES.HTTP_PUT, { relativeURL, data: putData }, { timeout })
|
|
645
607
|
.then((event) => {
|
|
646
608
|
resolve({ data: event.data.data, error: event.data.error });
|
|
647
609
|
})
|
|
@@ -654,19 +616,17 @@ class AppBridge {
|
|
|
654
616
|
/**
|
|
655
617
|
* Fires or responds to an HTTP_DELETE event
|
|
656
618
|
* @param packet any - packet of data to send with the event
|
|
657
|
-
* @param timeout - how long to attempt the request before reporting an error
|
|
658
|
-
* @param originStack - the domain of the previous frame(s) the request originated from
|
|
659
619
|
*/
|
|
660
|
-
httpDELETE(relativeURL, timeout = 10000
|
|
620
|
+
httpDELETE(relativeURL, timeout = 10000) {
|
|
661
621
|
return new Promise((resolve, reject) => {
|
|
662
622
|
if (this._handlers[AppBridgeHandler.HTTP]) {
|
|
663
|
-
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.DELETE, relativeURL
|
|
623
|
+
this._handlers[AppBridgeHandler.HTTP]({ verb: HTTP_VERBS.DELETE, relativeURL }, (data, error) => {
|
|
664
624
|
resolve({ data, error });
|
|
665
625
|
});
|
|
666
626
|
}
|
|
667
627
|
else {
|
|
668
|
-
|
|
669
|
-
.sendToParent(MESSAGE_TYPES.HTTP_DELETE, { relativeURL
|
|
628
|
+
postRobot
|
|
629
|
+
.sendToParent(MESSAGE_TYPES.HTTP_DELETE, { relativeURL }, { timeout })
|
|
670
630
|
.then((event) => {
|
|
671
631
|
resolve({ data: event.data.data, error: event.data.error });
|
|
672
632
|
})
|
|
@@ -683,7 +643,7 @@ class AppBridge {
|
|
|
683
643
|
*/
|
|
684
644
|
fireEvent(event, data) {
|
|
685
645
|
return new Promise((resolve, reject) => {
|
|
686
|
-
|
|
646
|
+
postRobot
|
|
687
647
|
.sendToParent(MESSAGE_TYPES.CUSTOM_EVENT, { event, data })
|
|
688
648
|
.then((e) => {
|
|
689
649
|
resolve(e);
|
|
@@ -701,7 +661,7 @@ class AppBridge {
|
|
|
701
661
|
fireEventToChildren(event, data) {
|
|
702
662
|
if (this._registeredFrames.length > 0) {
|
|
703
663
|
this._registeredFrames.forEach((frame) => {
|
|
704
|
-
|
|
664
|
+
postRobot.send(frame.source, MESSAGE_TYPES.CUSTOM_EVENT, {
|
|
705
665
|
event,
|
|
706
666
|
eventType: event,
|
|
707
667
|
data,
|
|
@@ -719,7 +679,7 @@ class AppBridge {
|
|
|
719
679
|
if (source instanceof HTMLIFrameElement) {
|
|
720
680
|
source = source.contentWindow;
|
|
721
681
|
}
|
|
722
|
-
|
|
682
|
+
postRobot.send(source, MESSAGE_TYPES.CUSTOM_EVENT, { event, data });
|
|
723
683
|
}
|
|
724
684
|
/**
|
|
725
685
|
* Adds an event listener to a custom event
|
|
@@ -20120,5 +20080,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
20120
20080
|
* Generated bundle index. Do not edit.
|
|
20121
20081
|
*/
|
|
20122
20082
|
|
|
20123
|
-
export { AppBridge, AppBridgeHandler, AppBridgeService, BooleanInput, COUNTRIES, CalendarEventResponse, Can, Color, DateRange, DateUtil, Deferred, DevAppBridge, DevAppBridgeService,
|
|
20083
|
+
export { AppBridge, AppBridgeHandler, AppBridgeService, BooleanInput, COUNTRIES, CalendarEventResponse, Can, Color, DateRange, DateUtil, Deferred, DevAppBridge, DevAppBridgeService, Helpers, KeyCodes, OutsideClick, binarySearch, can, convertTokens, findByCountryCode, findByCountryId, findByCountryName, formatZonedTime, getCountries, getDayView, getDayViewHourGrid, getMonthView, getStateObjects, getStates, getWeekView, getWeekViewEventOffset, getWeekViewHeader, isAlphaNumeric, legacyParse, notify };
|
|
20124
20084
|
//# sourceMappingURL=novo-elements-utils.mjs.map
|