@next-core/runtime 1.54.5 → 1.54.7
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/dist/cjs/internal/Router.js +103 -93
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/bindListeners.js +24 -22
- package/dist/cjs/internal/bindListeners.js.map +1 -1
- package/dist/esm/internal/Router.js +88 -77
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/bindListeners.js +25 -23
- package/dist/esm/internal/bindListeners.js.map +1 -1
- package/package.json +6 -6
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.Router = void 0;
|
|
8
8
|
var _classPrivateMethodInitSpec2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateMethodInitSpec"));
|
|
9
9
|
var _classPrivateFieldInitSpec2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldInitSpec"));
|
|
10
|
-
var
|
|
10
|
+
var _classPrivateFieldGet6 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet2"));
|
|
11
11
|
var _assertClassBrand2 = _interopRequireDefault(require("@babel/runtime/helpers/assertClassBrand"));
|
|
12
12
|
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet2"));
|
|
13
13
|
var _history2 = require("history");
|
|
@@ -40,8 +40,7 @@ var _setWatermark = require("../setWatermark.js");
|
|
|
40
40
|
var _routeMatchedMap = require("./routeMatchedMap.js");
|
|
41
41
|
var _storyboards = /*#__PURE__*/new WeakMap();
|
|
42
42
|
var _rendering = /*#__PURE__*/new WeakMap();
|
|
43
|
-
var
|
|
44
|
-
var _nextLocation = /*#__PURE__*/new WeakMap();
|
|
43
|
+
var _nextRender = /*#__PURE__*/new WeakMap();
|
|
45
44
|
var _runtimeContext = /*#__PURE__*/new WeakMap();
|
|
46
45
|
var _rendererContext = /*#__PURE__*/new WeakMap();
|
|
47
46
|
var _rendererContextTrashCan = /*#__PURE__*/new WeakMap();
|
|
@@ -56,8 +55,7 @@ class Router {
|
|
|
56
55
|
(0, _classPrivateMethodInitSpec2.default)(this, _Router_brand);
|
|
57
56
|
(0, _classPrivateFieldInitSpec2.default)(this, _storyboards, void 0);
|
|
58
57
|
(0, _classPrivateFieldInitSpec2.default)(this, _rendering, false);
|
|
59
|
-
(0, _classPrivateFieldInitSpec2.default)(this,
|
|
60
|
-
(0, _classPrivateFieldInitSpec2.default)(this, _nextLocation, void 0);
|
|
58
|
+
(0, _classPrivateFieldInitSpec2.default)(this, _nextRender, void 0);
|
|
61
59
|
(0, _classPrivateFieldInitSpec2.default)(this, _runtimeContext, void 0);
|
|
62
60
|
(0, _classPrivateFieldInitSpec2.default)(this, _rendererContext, void 0);
|
|
63
61
|
(0, _classPrivateFieldInitSpec2.default)(this, _rendererContextTrashCan, new Set());
|
|
@@ -88,98 +86,52 @@ class Router {
|
|
|
88
86
|
}));
|
|
89
87
|
}
|
|
90
88
|
getRenderId() {
|
|
91
|
-
return (0,
|
|
89
|
+
return (0, _classPrivateFieldGet6.default)(_renderId, this);
|
|
92
90
|
}
|
|
93
91
|
getRuntimeContext() {
|
|
94
|
-
return (0,
|
|
92
|
+
return (0, _classPrivateFieldGet6.default)(_runtimeContext, this);
|
|
95
93
|
}
|
|
96
94
|
getRecentApps() {
|
|
97
95
|
return {
|
|
98
|
-
currentApp: (0,
|
|
99
|
-
previousApp: (0,
|
|
96
|
+
currentApp: (0, _classPrivateFieldGet6.default)(_currentApp, this),
|
|
97
|
+
previousApp: (0, _classPrivateFieldGet6.default)(_previousApp, this)
|
|
100
98
|
};
|
|
101
99
|
}
|
|
102
100
|
getNavConfig() {
|
|
103
|
-
return (0,
|
|
101
|
+
return (0, _classPrivateFieldGet6.default)(_navConfig, this);
|
|
104
102
|
}
|
|
105
103
|
bootstrap() {
|
|
106
104
|
(0, _abortController.initAbortController)();
|
|
107
105
|
const history = (0, _history3.getHistory)();
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// Omit the "key" when checking whether locations are equal in certain situations.
|
|
119
|
-
if (
|
|
120
|
-
// When current location is triggered by browser action of hash link.
|
|
121
|
-
location.key === undefined ||
|
|
122
|
-
// When current location is triggered by browser action of non-push-or-replace,
|
|
123
|
-
// such as goBack or goForward,
|
|
124
|
-
action === "POP" && (
|
|
125
|
-
// and the previous location was triggered by hash link,
|
|
126
|
-
(0, _classPrivateFieldGet7.default)(_prevLocation, this).key === undefined ||
|
|
127
|
-
// or the previous location specified notify false.
|
|
128
|
-
((_classPrivateFieldGet2 = (0, _classPrivateFieldGet7.default)(_prevLocation, this).state) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.notify) === false)) {
|
|
129
|
-
omittedLocationProps.key = undefined;
|
|
130
|
-
}
|
|
131
|
-
if ((0, _history2.locationsAreEqual)({
|
|
132
|
-
...(0, _classPrivateFieldGet7.default)(_prevLocation, this),
|
|
133
|
-
...omittedLocationProps
|
|
134
|
-
}, {
|
|
135
|
-
...location,
|
|
136
|
-
...omittedLocationProps
|
|
137
|
-
}) || action !== "POP" && ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.notify) === false) {
|
|
138
|
-
// Ignore rendering if location not changed except hash, state and optional key.
|
|
139
|
-
// Ignore rendering if notify is `false`.
|
|
140
|
-
ignoreRendering = true;
|
|
141
|
-
}
|
|
142
|
-
if (!ignoreRendering && !((_location$state2 = location.state) !== null && _location$state2 !== void 0 && _location$state2.noIncremental)) {
|
|
143
|
-
var _classPrivateFieldGet3;
|
|
144
|
-
ignoreRendering = await ((_classPrivateFieldGet3 = (0, _classPrivateFieldGet7.default)(_rendererContext, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.didPerformIncrementalRender(location, (0, _classPrivateFieldGet7.default)(_prevLocation, this)));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Ignore stale renders
|
|
148
|
-
if (renderId !== currentRenderId) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
if (ignoreRendering) {
|
|
152
|
-
(0, _classPrivateFieldSet2.default)(_prevLocation, this, location);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
(0, _abortController.abortPendingRequest)();
|
|
156
|
-
(0, _classPrivateFieldSet2.default)(_prevLocation, this, location);
|
|
157
|
-
(_classPrivateFieldGet4 = (0, _classPrivateFieldGet7.default)(_rendererContext, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.dispatchPageLeave();
|
|
158
|
-
if (action === "POP") {
|
|
159
|
-
const storyboard = (0, _matchStoryboard.matchStoryboard)((0, _classPrivateFieldGet7.default)(_storyboards, this), location.pathname);
|
|
160
|
-
// When a browser action of goBack or goForward is performing,
|
|
161
|
-
// force reload when the target page is a page of an outside app.
|
|
162
|
-
if ((0, _matchStoryboard.isOutsideApp)(storyboard)) {
|
|
163
|
-
window.location.reload();
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if ((0, _classPrivateFieldGet7.default)(_rendering, this)) {
|
|
168
|
-
(0, _classPrivateFieldSet2.default)(_nextLocation, this, location);
|
|
106
|
+
let nextPrevLocation = history.location;
|
|
107
|
+
history.listen((location, action) => {
|
|
108
|
+
const prevLocation = nextPrevLocation;
|
|
109
|
+
nextPrevLocation = location;
|
|
110
|
+
if ((0, _classPrivateFieldGet6.default)(_rendering, this)) {
|
|
111
|
+
(0, _classPrivateFieldSet2.default)(_nextRender, this, {
|
|
112
|
+
location,
|
|
113
|
+
prevLocation,
|
|
114
|
+
action
|
|
115
|
+
});
|
|
169
116
|
} else {
|
|
170
|
-
(0,
|
|
171
|
-
|
|
117
|
+
(0, _assertClassBrand2.default)(_Router_brand, this, _queuedRender).call(this, {
|
|
118
|
+
location,
|
|
119
|
+
prevLocation,
|
|
120
|
+
action
|
|
121
|
+
}).catch(_handleHttpError.handleHttpError);
|
|
172
122
|
}
|
|
173
123
|
});
|
|
174
|
-
return (0, _assertClassBrand2.default)(_Router_brand, this, _queuedRender).call(this,
|
|
124
|
+
return (0, _assertClassBrand2.default)(_Router_brand, this, _queuedRender).call(this, {
|
|
125
|
+
location: history.location
|
|
126
|
+
});
|
|
175
127
|
}
|
|
176
128
|
}
|
|
177
129
|
exports.Router = Router;
|
|
178
130
|
function _getBlockMessageBeforePageLave(detail) {
|
|
179
|
-
var
|
|
131
|
+
var _classPrivateFieldGet2;
|
|
180
132
|
const history = (0, _history3.getHistory)();
|
|
181
133
|
const previousMessage = history.getBlockMessage();
|
|
182
|
-
(
|
|
134
|
+
(_classPrivateFieldGet2 = (0, _classPrivateFieldGet6.default)(_rendererContext, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.dispatchBeforePageLeave(detail);
|
|
183
135
|
const message = history.getBlockMessage();
|
|
184
136
|
if (!previousMessage && message) {
|
|
185
137
|
// Auto unblock only if new block was introduced by `onBeforePageLeave`.
|
|
@@ -189,7 +141,7 @@ function _getBlockMessageBeforePageLave(detail) {
|
|
|
189
141
|
}
|
|
190
142
|
function _safeRedirect(to, state, from) {
|
|
191
143
|
var _this$redirectCount, _this$redirectCount2;
|
|
192
|
-
if (((0, _classPrivateFieldSet2.default)(_redirectCount, this, (_this$redirectCount = (0,
|
|
144
|
+
if (((0, _classPrivateFieldSet2.default)(_redirectCount, this, (_this$redirectCount = (0, _classPrivateFieldGet6.default)(_redirectCount, this), _this$redirectCount2 = _this$redirectCount++, _this$redirectCount)), _this$redirectCount2) > 10) {
|
|
193
145
|
const message = `Infinite redirect detected: from "${from.pathname}${from.search}${from.hash}" to "${to}"`;
|
|
194
146
|
// istanbul ignore else: error cannot be caught in test
|
|
195
147
|
if (process.env.NODE_ENV === "test") {
|
|
@@ -202,21 +154,79 @@ function _safeRedirect(to, state, from) {
|
|
|
202
154
|
}
|
|
203
155
|
(0, _history3.getHistory)().replace(to, state);
|
|
204
156
|
}
|
|
205
|
-
async function _queuedRender(
|
|
157
|
+
async function _queuedRender(next) {
|
|
206
158
|
(0, _classPrivateFieldSet2.default)(_rendering, this, true);
|
|
207
159
|
try {
|
|
208
|
-
await (0, _assertClassBrand2.default)(_Router_brand, this,
|
|
160
|
+
await (0, _assertClassBrand2.default)(_Router_brand, this, _preRender).call(this, next);
|
|
209
161
|
} finally {
|
|
210
162
|
(0, _classPrivateFieldSet2.default)(_rendering, this, false);
|
|
211
|
-
if ((0,
|
|
212
|
-
const
|
|
213
|
-
(0, _classPrivateFieldSet2.default)(
|
|
214
|
-
await (0, _assertClassBrand2.default)(_Router_brand, this, _queuedRender).call(this,
|
|
163
|
+
if ((0, _classPrivateFieldGet6.default)(_nextRender, this)) {
|
|
164
|
+
const nextRender = (0, _classPrivateFieldGet6.default)(_nextRender, this);
|
|
165
|
+
(0, _classPrivateFieldSet2.default)(_nextRender, this, undefined);
|
|
166
|
+
await (0, _assertClassBrand2.default)(_Router_brand, this, _queuedRender).call(this, nextRender);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function _preRender({
|
|
171
|
+
location,
|
|
172
|
+
prevLocation,
|
|
173
|
+
action
|
|
174
|
+
}) {
|
|
175
|
+
if (prevLocation) {
|
|
176
|
+
var _prevLocation$state, _location$state, _location$state2, _classPrivateFieldGet4;
|
|
177
|
+
let ignoreRendering;
|
|
178
|
+
const omittedLocationProps = {
|
|
179
|
+
hash: undefined,
|
|
180
|
+
state: undefined
|
|
181
|
+
};
|
|
182
|
+
// Omit the "key" when checking whether locations are equal in certain situations.
|
|
183
|
+
if (
|
|
184
|
+
// When current location is triggered by browser action of hash link.
|
|
185
|
+
location.key === undefined ||
|
|
186
|
+
// When current location is triggered by browser action of non-push-or-replace,
|
|
187
|
+
// such as goBack or goForward,
|
|
188
|
+
action === "POP" && (
|
|
189
|
+
// and the previous location was triggered by hash link,
|
|
190
|
+
prevLocation.key === undefined ||
|
|
191
|
+
// or the previous location specified notify false.
|
|
192
|
+
((_prevLocation$state = prevLocation.state) === null || _prevLocation$state === void 0 ? void 0 : _prevLocation$state.notify) === false)) {
|
|
193
|
+
omittedLocationProps.key = undefined;
|
|
194
|
+
}
|
|
195
|
+
if ((0, _history2.locationsAreEqual)({
|
|
196
|
+
...prevLocation,
|
|
197
|
+
...omittedLocationProps
|
|
198
|
+
}, {
|
|
199
|
+
...location,
|
|
200
|
+
...omittedLocationProps
|
|
201
|
+
}) || action !== "POP" && ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.notify) === false) {
|
|
202
|
+
// Ignore rendering if location not changed except hash, state and optional key.
|
|
203
|
+
// Ignore rendering if notify is `false`.
|
|
204
|
+
ignoreRendering = true;
|
|
205
|
+
}
|
|
206
|
+
if (!ignoreRendering && !((_location$state2 = location.state) !== null && _location$state2 !== void 0 && _location$state2.noIncremental)) {
|
|
207
|
+
var _classPrivateFieldGet3;
|
|
208
|
+
ignoreRendering = await ((_classPrivateFieldGet3 = (0, _classPrivateFieldGet6.default)(_rendererContext, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.didPerformIncrementalRender(location, prevLocation));
|
|
209
|
+
}
|
|
210
|
+
if (ignoreRendering) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
(0, _abortController.abortPendingRequest)();
|
|
214
|
+
(_classPrivateFieldGet4 = (0, _classPrivateFieldGet6.default)(_rendererContext, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.dispatchPageLeave();
|
|
215
|
+
if (action === "POP") {
|
|
216
|
+
const storyboard = (0, _matchStoryboard.matchStoryboard)((0, _classPrivateFieldGet6.default)(_storyboards, this), location.pathname);
|
|
217
|
+
// When a browser action of goBack or goForward is performing,
|
|
218
|
+
// force reload when the target page is a page of an outside app.
|
|
219
|
+
if ((0, _matchStoryboard.isOutsideApp)(storyboard)) {
|
|
220
|
+
window.location.reload();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
215
223
|
}
|
|
224
|
+
(0, _devtools.devtoolsHookEmit)("locationChange");
|
|
216
225
|
}
|
|
226
|
+
return (0, _assertClassBrand2.default)(_Router_brand, this, _render).call(this, location);
|
|
217
227
|
}
|
|
218
228
|
async function _render(location) {
|
|
219
|
-
var _hooks$flowApi, _hooks$pageView,
|
|
229
|
+
var _hooks$flowApi, _hooks$pageView, _classPrivateFieldGet5, _storyboard$app;
|
|
220
230
|
const renderId = (0, _classPrivateFieldSet2.default)(_renderId, this, (0, _lodash.uniqueId)("render-id-"));
|
|
221
231
|
(0, _markAsComputed.resetAllComputedMarks)();
|
|
222
232
|
(0, _resolveData.clearResolveCache)();
|
|
@@ -226,8 +236,8 @@ async function _render(location) {
|
|
|
226
236
|
|
|
227
237
|
// const renderStartTime = performance.now();
|
|
228
238
|
const finishPageView = _Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$pageView = _Runtime.hooks.pageView) === null || _hooks$pageView === void 0 ? void 0 : _hooks$pageView.create();
|
|
229
|
-
const storyboard = (0, _matchStoryboard.matchStoryboard)((0,
|
|
230
|
-
const previousApp = (
|
|
239
|
+
const storyboard = (0, _matchStoryboard.matchStoryboard)((0, _classPrivateFieldGet6.default)(_storyboards, this), location.pathname);
|
|
240
|
+
const previousApp = (_classPrivateFieldGet5 = (0, _classPrivateFieldGet6.default)(_runtimeContext, this)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.app;
|
|
231
241
|
const currentAppId = storyboard === null || storyboard === void 0 || (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id;
|
|
232
242
|
// dynamically change the value of the APP variable, if it's union app
|
|
233
243
|
if (window.BOOTSTRAP_UNION_FILE && currentAppId && currentAppId !== (previousApp === null || previousApp === void 0 ? void 0 : previousApp.id)) {
|
|
@@ -253,12 +263,12 @@ async function _render(location) {
|
|
|
253
263
|
|
|
254
264
|
// Set `Router::#currentApp` before calling `getFeatureFlags()`
|
|
255
265
|
const flags = (0, _Runtime.getRuntime)().getFeatureFlags();
|
|
256
|
-
const prevRendererContext = (0,
|
|
266
|
+
const prevRendererContext = (0, _classPrivateFieldGet6.default)(_rendererContext, this);
|
|
257
267
|
const redirectTo = (to, state) => {
|
|
258
268
|
finishPageView === null || finishPageView === void 0 || finishPageView({
|
|
259
269
|
status: "redirected"
|
|
260
270
|
});
|
|
261
|
-
(0,
|
|
271
|
+
(0, _classPrivateFieldGet6.default)(_rendererContextTrashCan, this).add(prevRendererContext);
|
|
262
272
|
(0, _assertClassBrand2.default)(_Router_brand, this, _safeRedirect).call(this, to, state, location);
|
|
263
273
|
};
|
|
264
274
|
const redirectToLogin = () => {
|
|
@@ -281,14 +291,14 @@ async function _render(location) {
|
|
|
281
291
|
(0, _mount.unmountTree)(portal);
|
|
282
292
|
|
|
283
293
|
// Note: redirects can lead to multiple trash renderer contexts.
|
|
284
|
-
(0,
|
|
285
|
-
for (const item of (0,
|
|
294
|
+
(0, _classPrivateFieldGet6.default)(_rendererContextTrashCan, this).add(prevRendererContext);
|
|
295
|
+
for (const item of (0, _classPrivateFieldGet6.default)(_rendererContextTrashCan, this)) {
|
|
286
296
|
if (item) {
|
|
287
297
|
item.dispatchOnUnmount();
|
|
288
298
|
item.dispose();
|
|
289
299
|
}
|
|
290
300
|
}
|
|
291
|
-
(0,
|
|
301
|
+
(0, _classPrivateFieldGet6.default)(_rendererContextTrashCan, this).clear();
|
|
292
302
|
_Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$messageDispatc = _Runtime.hooks.messageDispatcher) === null || _hooks$messageDispatc === void 0 || _hooks$messageDispatc.reset();
|
|
293
303
|
if (appChanged) {
|
|
294
304
|
(0, _classPrivateFieldSet2.default)(_previousApp, this, previousApp);
|
|
@@ -322,7 +332,7 @@ async function _render(location) {
|
|
|
322
332
|
const menuConfs = await Promise.all(menuRequests);
|
|
323
333
|
(0, _classPrivateFieldSet2.default)(_navConfig, this, mergeMenuConfs(menuConfs));
|
|
324
334
|
window.dispatchEvent(new CustomEvent("navConfig.change", {
|
|
325
|
-
detail: (0,
|
|
335
|
+
detail: (0, _classPrivateFieldGet6.default)(_navConfig, this)
|
|
326
336
|
}));
|
|
327
337
|
},
|
|
328
338
|
catch: (error, returnNode) => {
|
|
@@ -330,7 +340,7 @@ async function _render(location) {
|
|
|
330
340
|
redirectToLogin();
|
|
331
341
|
return;
|
|
332
342
|
} else if (error instanceof _http.HttpAbortError) {
|
|
333
|
-
(0,
|
|
343
|
+
(0, _classPrivateFieldGet6.default)(_rendererContextTrashCan, this).add(prevRendererContext);
|
|
334
344
|
return;
|
|
335
345
|
} else {
|
|
336
346
|
const noAuthGuardLoginPath = (0, _Runtime.getRuntime)().getMiscSettings().noAuthGuardLoginPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","names":["_history2","require","_http","_cook","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_setLoginStateCookie","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_setUIVersion","_setAppVariable","_setWatermark","_routeMatchedMap","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_assertClassBrand2","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet7","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","renderId","listen","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","devtoolsHookEmit","_queuedRender","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render","nextLocation","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","setAppVariable","appId","version","currentVersion","fulfilStoryboard","setWatermark","appChanged","clearExpressionASTCache","clearFunctionASTCache","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","setLoginStateCookie","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","dataset","errorBoundary","style","color","runtimeContext","return","blockingList","rendererContext","RendererContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","stores","clearMatchedRoutes","rootMenuRequestNode","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","child","menuRequestNode","setInitialMenuRequestNode","getMenuRequests","result","route","dispatchBeforePageLoad","applyTheme","applyMode","setUIVersion","uiVersion","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport {\n clearExpressionASTCache,\n clearFunctionASTCache,\n} from \"@next-core/cook\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderRoot,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { setLoginStateCookie } from \"../setLoginStateCookie.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { setUIVersion } from \"../setUIVersion.js\";\nimport { setAppVariable } from \"../setAppVariable.js\";\nimport { setWatermark } from \"../setWatermark.js\";\nimport { clearMatchedRoutes } from \"./routeMatchedMap.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering && !location.state?.noIncremental) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(\n location,\n this.#prevLocation\n );\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n const renderId = (this.#renderId = uniqueId(\"render-id-\"));\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n const currentAppId = storyboard?.app?.id;\n // dynamically change the value of the APP variable, if it's union app\n if (\n window.BOOTSTRAP_UNION_FILE &&\n currentAppId &&\n currentAppId !== previousApp?.id\n ) {\n setAppVariable({\n appId: currentAppId,\n version: storyboard.app.currentVersion!,\n });\n }\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n\n const currentApp = (this.#currentApp = storyboard?.app);\n\n setWatermark();\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n clearExpressionASTCache();\n if (appChanged) {\n clearFunctionASTCache();\n }\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n setLoginStateCookie(location);\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n window.dispatchEvent(\n new CustomEvent(\"navConfig.change\", { detail: this.#navConfig })\n );\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper, renderId }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n clearMatchedRoutes();\n const rootMenuRequestNode: MenuRequestNode = {};\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n [],\n rootMenuRequestNode\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n rootMenuRequestNode.child = output.menuRequestNode;\n rendererContext.setInitialMenuRequestNode(rootMenuRequestNode);\n await routeHelper.mergeMenus(rendererContext.getMenuRequests());\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n setUIVersion(currentApp?.uiVersion);\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAMA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAOA,IAAAa,QAAA,GAAAb,OAAA;AAKA,IAAAc,YAAA,GAAAd,OAAA;AAOA,IAAAe,eAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAhB,OAAA;AAKA,IAAAiB,gBAAA,GAAAjB,OAAA;AACA,IAAAkB,oBAAA,GAAAlB,OAAA;AACA,IAAAmB,wBAAA,GAAAnB,OAAA;AACA,IAAAoB,iBAAA,GAAApB,OAAA;AACA,IAAAqB,MAAA,GAAArB,OAAA;AACA,IAAAsB,o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eAAdA,cAAc,CAAG;IAAEqB,MAAM,EAAE;EAAY,CAAC,CAAC;EACzC,IAAAzD,0BAAgB,EAAC,UAAU,CAAC;AAC9B;AAGF,SAAS0G,cAAcA,CAACH,SAA2B,EAAE;EACnD,MAAMiF,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAInF,SAAS,EAAE;IAChC,MAAM;MAAEkF;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Router.js","names":["_history2","require","_http","_cook","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_setLoginStateCookie","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_setUIVersion","_setAppVariable","_setWatermark","_routeMatchedMap","_storyboards","WeakMap","_rendering","_nextRender","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_assertClassBrand2","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet6","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","nextPrevLocation","listen","prevLocation","_queuedRender","catch","handleHttpError","exports","detail","_classPrivateFieldGet2","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","state","from","_this$redirectCount","_this$redirectCount2","pathname","search","hash","process","env","NODE_ENV","console","error","Error","replace","next","_preRender","nextRender","undefined","_prevLocation$state","_location$state","_location$state2","_classPrivateFieldGet4","ignoreRendering","omittedLocationProps","key","notify","locationsAreEqual","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","isOutsideApp","reload","devtoolsHookEmit","_render","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet5","_storyboard$app","renderId","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","setAppVariable","appId","version","currentVersion","fulfilStoryboard","setWatermark","appChanged","clearExpressionASTCache","clearFunctionASTCache","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","setLoginStateCookie","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","dataset","errorBoundary","style","color","runtimeContext","return","blockingList","rendererContext","RendererContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","stores","clearMatchedRoutes","rootMenuRequestNode","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","child","menuRequestNode","setInitialMenuRequestNode","getMenuRequests","result","route","dispatchBeforePageLoad","applyTheme","applyMode","setUIVersion","uiVersion","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport {\n clearExpressionASTCache,\n clearFunctionASTCache,\n} from \"@next-core/cook\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderRoot,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { setLoginStateCookie } from \"../setLoginStateCookie.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { setUIVersion } from \"../setUIVersion.js\";\nimport { setAppVariable } from \"../setAppVariable.js\";\nimport { setWatermark } from \"../setWatermark.js\";\nimport { clearMatchedRoutes } from \"./routeMatchedMap.js\";\n\ntype RenderTask = InitialRenderTask | SubsequentRenderTask;\n\ninterface InitialRenderTask {\n location: NextLocation;\n prevLocation?: undefined;\n action?: undefined;\n}\n\ninterface SubsequentRenderTask {\n location: NextLocation;\n prevLocation: NextLocation;\n action: Action;\n}\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #nextRender?: RenderTask;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n let nextPrevLocation = history.location;\n history.listen((location, action) => {\n const prevLocation = nextPrevLocation;\n nextPrevLocation = location;\n if (this.#rendering) {\n this.#nextRender = { location, prevLocation, action };\n } else {\n this.#queuedRender({\n location,\n prevLocation,\n action,\n }).catch(handleHttpError);\n }\n });\n return this.#queuedRender({ location: history.location });\n }\n\n async #queuedRender(next: RenderTask) {\n this.#rendering = true;\n try {\n await this.#preRender(next);\n } finally {\n this.#rendering = false;\n if (this.#nextRender) {\n const nextRender = this.#nextRender;\n this.#nextRender = undefined;\n await this.#queuedRender(nextRender);\n }\n }\n }\n\n async #preRender({ location, prevLocation, action }: RenderTask) {\n if (prevLocation) {\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (prevLocation.key === undefined ||\n // or the previous location specified notify false.\n prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering && !location.state?.noIncremental) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(\n location,\n prevLocation\n );\n }\n\n if (ignoreRendering) {\n return;\n }\n\n abortPendingRequest();\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n devtoolsHookEmit(\"locationChange\");\n }\n\n return this.#render(location);\n }\n\n async #render(location: NextLocation): Promise<void> {\n const renderId = (this.#renderId = uniqueId(\"render-id-\"));\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n const currentAppId = storyboard?.app?.id;\n // dynamically change the value of the APP variable, if it's union app\n if (\n window.BOOTSTRAP_UNION_FILE &&\n currentAppId &&\n currentAppId !== previousApp?.id\n ) {\n setAppVariable({\n appId: currentAppId,\n version: storyboard.app.currentVersion!,\n });\n }\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n\n const currentApp = (this.#currentApp = storyboard?.app);\n\n setWatermark();\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n clearExpressionASTCache();\n if (appChanged) {\n clearFunctionASTCache();\n }\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n setLoginStateCookie(location);\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n window.dispatchEvent(\n new CustomEvent(\"navConfig.change\", { detail: this.#navConfig })\n );\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper, renderId }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n clearMatchedRoutes();\n const rootMenuRequestNode: MenuRequestNode = {};\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n [],\n rootMenuRequestNode\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n rootMenuRequestNode.child = output.menuRequestNode;\n rendererContext.setInitialMenuRequestNode(rootMenuRequestNode);\n await routeHelper.mergeMenus(rendererContext.getMenuRequests());\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n setUIVersion(currentApp?.uiVersion);\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAMA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAOA,IAAAa,QAAA,GAAAb,OAAA;AAKA,IAAAc,YAAA,GAAAd,OAAA;AAOA,IAAAe,eAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAhB,OAAA;AAKA,IAAAiB,gBAAA,GAAAjB,OAAA;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AC9B;AAGF,SAASmF,cAAcA,CAACH,SAA2B,EAAE;EACnD,MAAMiF,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAInF,SAAS,EAAE;IAChC,MAAM;MAAEkF;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB","ignoreList":[]}
|
|
@@ -116,7 +116,10 @@ function listenerFactory(handlers, runtimeContext, runtimeBrick) {
|
|
|
116
116
|
// case "alias.replace":
|
|
117
117
|
|
|
118
118
|
case "window.open":
|
|
119
|
-
|
|
119
|
+
handleWindowOpenAction(event, handler.args, runtimeContext);
|
|
120
|
+
break;
|
|
121
|
+
case "window.postMessage":
|
|
122
|
+
handleWindowPostMessageAction(event, handler.args, runtimeContext);
|
|
120
123
|
break;
|
|
121
124
|
case "location.reload":
|
|
122
125
|
case "location.assign":
|
|
@@ -211,15 +214,9 @@ function listenerFactory(handlers, runtimeContext, runtimeBrick) {
|
|
|
211
214
|
}
|
|
212
215
|
};
|
|
213
216
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const method = handler.method !== "saveAs" ? "resolve" : "saveAs";
|
|
218
|
-
brickCallback(event, providerBrick, handler, method, runtimeContext, runtimeBrick);
|
|
219
|
-
} catch (error) {
|
|
220
|
-
// eslint-disable-next-line no-console
|
|
221
|
-
console.error((0, _handleHttpError.httpErrorToString)(error));
|
|
222
|
-
}
|
|
217
|
+
function handleUseProviderAction(event, handler, runtimeContext, runtimeBrick) {
|
|
218
|
+
const method = handler.method !== "saveAs" ? "resolve" : "saveAs";
|
|
219
|
+
brickCallback(event, handler.useProvider, handler, method, runtimeContext, runtimeBrick);
|
|
223
220
|
}
|
|
224
221
|
function handleCustomAction(event, handler, runtimeContext, runtimeBrick) {
|
|
225
222
|
let targets = [];
|
|
@@ -285,23 +282,20 @@ function handleCustomAction(event, handler, runtimeContext, runtimeBrick) {
|
|
|
285
282
|
});
|
|
286
283
|
}
|
|
287
284
|
}
|
|
288
|
-
async function brickCallback(event,
|
|
289
|
-
|
|
290
|
-
// eslint-disable-next-line no-console
|
|
291
|
-
console.error("target has no method:", {
|
|
292
|
-
target,
|
|
293
|
-
method: method
|
|
294
|
-
});
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
285
|
+
async function brickCallback(event, targetOrProvider, handler, method, runtimeContext, runtimeBrick, options) {
|
|
286
|
+
const isProvider = isUseProviderHandler(handler);
|
|
297
287
|
const task = async () => {
|
|
298
288
|
var _hooks$flowApi;
|
|
289
|
+
const realTarget = isProvider ? await (0, _getProviderBrick.getProviderBrick)(targetOrProvider) : targetOrProvider;
|
|
290
|
+
if (typeof realTarget[method] !== "function") {
|
|
291
|
+
throw new Error(`target <${realTarget.tagName.toLowerCase()}> has no method: ${method}`);
|
|
292
|
+
}
|
|
299
293
|
let computedArgs = argsFactory(handler.args, runtimeContext, event, options);
|
|
300
294
|
if (isUseProviderHandler(handler) && _Runtime.hooks !== null && _Runtime.hooks !== void 0 && (_hooks$flowApi = _Runtime.hooks.flowApi) !== null && _hooks$flowApi !== void 0 && _hooks$flowApi.isFlowApiProvider(handler.useProvider)) {
|
|
301
295
|
var _handler$sse;
|
|
302
296
|
computedArgs = await _Runtime.hooks.flowApi.getArgsOfFlowApi(handler.useProvider, computedArgs, method, (_handler$sse = handler.sse) === null || _handler$sse === void 0 ? void 0 : _handler$sse.stream);
|
|
303
297
|
}
|
|
304
|
-
return
|
|
298
|
+
return realTarget[method](...computedArgs);
|
|
305
299
|
};
|
|
306
300
|
if (!handler.callback) {
|
|
307
301
|
task();
|
|
@@ -314,7 +308,7 @@ async function brickCallback(event, target, handler, method, runtimeContext, run
|
|
|
314
308
|
error: callbackFactory("error"),
|
|
315
309
|
finally: callbackFactory("finally")
|
|
316
310
|
};
|
|
317
|
-
if (
|
|
311
|
+
if (isProvider) {
|
|
318
312
|
var _handler$sse2, _handler$poll;
|
|
319
313
|
const pollRuntimeContext = {
|
|
320
314
|
...runtimeContext,
|
|
@@ -382,10 +376,18 @@ function handleHistoryAction(event, method, args, callback, runtimeContext) {
|
|
|
382
376
|
}
|
|
383
377
|
(0, _history.getHistory)()[overrideMethod](...computedArgs);
|
|
384
378
|
}
|
|
385
|
-
function
|
|
379
|
+
function handleWindowOpenAction(event, args, runtimeContext) {
|
|
386
380
|
const [url, target, features] = argsFactory(args, runtimeContext, event);
|
|
387
381
|
window.open(url, target || "_self", features);
|
|
388
382
|
}
|
|
383
|
+
function handleWindowPostMessageAction(event, args, runtimeContext) {
|
|
384
|
+
const computedArgs = argsFactory(args, runtimeContext, event);
|
|
385
|
+
if (computedArgs.length === 1) {
|
|
386
|
+
// Add default target origin
|
|
387
|
+
computedArgs.push(location.origin);
|
|
388
|
+
}
|
|
389
|
+
window.postMessage(...computedArgs);
|
|
390
|
+
}
|
|
389
391
|
function batchUpdate(args, batch, method, store, runtimeContext, event) {
|
|
390
392
|
if (batch) {
|
|
391
393
|
store.updateValues(args, method, arg => {
|