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