@next-core/runtime 1.20.4 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createRoot.js +4 -6
- package/dist/cjs/createRoot.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/bindTemplateProxy.js +1 -1
- package/dist/cjs/internal/CustomTemplates/bindTemplateProxy.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +175 -69
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +89 -13
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/Router.js +116 -77
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/data/DataStore.js +53 -7
- package/dist/cjs/internal/data/DataStore.js.map +1 -1
- package/dist/cjs/internal/matchRoutes.js +9 -5
- package/dist/cjs/internal/matchRoutes.js.map +1 -1
- package/dist/cjs/internal/matchStoryboard.js +8 -3
- package/dist/cjs/internal/matchStoryboard.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +11 -18
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/createRoot.js +5 -7
- package/dist/esm/createRoot.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/bindTemplateProxy.js +1 -1
- package/dist/esm/internal/CustomTemplates/bindTemplateProxy.js.map +1 -1
- package/dist/esm/internal/Renderer.js +183 -78
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +96 -13
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/Router.js +155 -103
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/data/DataStore.js +51 -6
- package/dist/esm/internal/data/DataStore.js.map +1 -1
- package/dist/esm/internal/matchRoutes.js +8 -5
- package/dist/esm/internal/matchRoutes.js.map +1 -1
- package/dist/esm/internal/matchStoryboard.js +7 -3
- package/dist/esm/internal/matchStoryboard.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +13 -20
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/Renderer.d.ts +12 -4
- package/dist/types/internal/RendererContext.d.ts +31 -5
- package/dist/types/internal/data/DataStore.d.ts +13 -4
- package/dist/types/internal/matchRoutes.d.ts +6 -0
- package/dist/types/internal/matchStoryboard.d.ts +1 -0
- package/package.json +2 -2
|
@@ -7,11 +7,10 @@ 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 _classPrivateFieldGet7 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
11
11
|
var _classPrivateMethodGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateMethodGet"));
|
|
12
12
|
var _classPrivateFieldSet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldSet"));
|
|
13
13
|
var _history2 = require("history");
|
|
14
|
-
var _loader = require("@next-core/loader");
|
|
15
14
|
var _http = require("@next-core/http");
|
|
16
15
|
var _lodash = require("lodash");
|
|
17
16
|
var _history3 = require("../history.js");
|
|
@@ -124,27 +123,29 @@ class Router {
|
|
|
124
123
|
}));
|
|
125
124
|
}
|
|
126
125
|
getRenderId() {
|
|
127
|
-
return (0,
|
|
126
|
+
return (0, _classPrivateFieldGet7.default)(this, _renderId);
|
|
128
127
|
}
|
|
129
128
|
getRuntimeContext() {
|
|
130
|
-
return (0,
|
|
129
|
+
return (0, _classPrivateFieldGet7.default)(this, _runtimeContext);
|
|
131
130
|
}
|
|
132
131
|
getRecentApps() {
|
|
133
132
|
return {
|
|
134
|
-
currentApp: (0,
|
|
135
|
-
previousApp: (0,
|
|
133
|
+
currentApp: (0, _classPrivateFieldGet7.default)(this, _currentApp),
|
|
134
|
+
previousApp: (0, _classPrivateFieldGet7.default)(this, _previousApp)
|
|
136
135
|
};
|
|
137
136
|
}
|
|
138
137
|
getNavConfig() {
|
|
139
|
-
return (0,
|
|
138
|
+
return (0, _classPrivateFieldGet7.default)(this, _navConfig);
|
|
140
139
|
}
|
|
141
140
|
bootstrap() {
|
|
142
141
|
(0, _abortController.initAbortController)();
|
|
143
142
|
const history = (0, _history3.getHistory)();
|
|
144
143
|
(0, _classPrivateFieldSet2.default)(this, _prevLocation, history.location);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
let renderId = 0;
|
|
145
|
+
history.listen(async (location, action) => {
|
|
146
|
+
var _classPrivateFieldGet2, _location$state, _classPrivateFieldGet4;
|
|
147
|
+
const currentRenderId = ++renderId;
|
|
148
|
+
let ignoreRendering;
|
|
148
149
|
const omittedLocationProps = {
|
|
149
150
|
hash: undefined,
|
|
150
151
|
state: undefined
|
|
@@ -157,13 +158,13 @@ class Router {
|
|
|
157
158
|
// such as goBack or goForward,
|
|
158
159
|
action === "POP" && (
|
|
159
160
|
// and the previous location was triggered by hash link,
|
|
160
|
-
(0,
|
|
161
|
+
(0, _classPrivateFieldGet7.default)(this, _prevLocation).key === undefined ||
|
|
161
162
|
// or the previous location specified notify false.
|
|
162
|
-
((_classPrivateFieldGet2 = (0,
|
|
163
|
+
((_classPrivateFieldGet2 = (0, _classPrivateFieldGet7.default)(this, _prevLocation).state) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.notify) === false)) {
|
|
163
164
|
omittedLocationProps.key = undefined;
|
|
164
165
|
}
|
|
165
166
|
if ((0, _history2.locationsAreEqual)({
|
|
166
|
-
...(0,
|
|
167
|
+
...(0, _classPrivateFieldGet7.default)(this, _prevLocation),
|
|
167
168
|
...omittedLocationProps
|
|
168
169
|
}, {
|
|
169
170
|
...location,
|
|
@@ -173,15 +174,24 @@ class Router {
|
|
|
173
174
|
// Ignore rendering if notify is `false`.
|
|
174
175
|
ignoreRendering = true;
|
|
175
176
|
}
|
|
177
|
+
if (!ignoreRendering) {
|
|
178
|
+
var _classPrivateFieldGet3;
|
|
179
|
+
ignoreRendering = await ((_classPrivateFieldGet3 = (0, _classPrivateFieldGet7.default)(this, _rendererContext)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.didPerformIncrementalRender(location));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Ignore stale renders
|
|
183
|
+
if (renderId !== currentRenderId) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
176
186
|
if (ignoreRendering) {
|
|
177
187
|
(0, _classPrivateFieldSet2.default)(this, _prevLocation, location);
|
|
178
188
|
return;
|
|
179
189
|
}
|
|
180
190
|
(0, _abortController.abortPendingRequest)();
|
|
181
191
|
(0, _classPrivateFieldSet2.default)(this, _prevLocation, location);
|
|
182
|
-
(
|
|
192
|
+
(_classPrivateFieldGet4 = (0, _classPrivateFieldGet7.default)(this, _rendererContext)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.dispatchPageLeave();
|
|
183
193
|
if (action === "POP") {
|
|
184
|
-
const storyboard = (0, _matchStoryboard.matchStoryboard)((0,
|
|
194
|
+
const storyboard = (0, _matchStoryboard.matchStoryboard)((0, _classPrivateFieldGet7.default)(this, _storyboards), location.pathname);
|
|
185
195
|
// When a browser action of goBack or goForward is performing,
|
|
186
196
|
// force reload when the target page is a page of an outside app.
|
|
187
197
|
if ((0, _matchStoryboard.isOutsideApp)(storyboard)) {
|
|
@@ -189,7 +199,7 @@ class Router {
|
|
|
189
199
|
return;
|
|
190
200
|
}
|
|
191
201
|
}
|
|
192
|
-
if ((0,
|
|
202
|
+
if ((0, _classPrivateFieldGet7.default)(this, _rendering)) {
|
|
193
203
|
(0, _classPrivateFieldSet2.default)(this, _nextLocation, location);
|
|
194
204
|
} else {
|
|
195
205
|
// devtoolsHookEmit("locationChange");
|
|
@@ -201,10 +211,10 @@ class Router {
|
|
|
201
211
|
}
|
|
202
212
|
exports.Router = Router;
|
|
203
213
|
function _getBlockMessageBeforePageLave2(detail) {
|
|
204
|
-
var
|
|
214
|
+
var _classPrivateFieldGet5;
|
|
205
215
|
const history = (0, _history3.getHistory)();
|
|
206
216
|
const previousMessage = history.getBlockMessage();
|
|
207
|
-
(
|
|
217
|
+
(_classPrivateFieldGet5 = (0, _classPrivateFieldGet7.default)(this, _rendererContext)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.dispatchBeforePageLeave(detail);
|
|
208
218
|
const message = history.getBlockMessage();
|
|
209
219
|
if (!previousMessage && message) {
|
|
210
220
|
// Auto unblock only if new block was introduced by `onBeforePageLeave`.
|
|
@@ -214,7 +224,7 @@ function _getBlockMessageBeforePageLave2(detail) {
|
|
|
214
224
|
}
|
|
215
225
|
function _safeRedirect2(to, state, from) {
|
|
216
226
|
var _this$redirectCount, _this$redirectCount2;
|
|
217
|
-
if (((0, _classPrivateFieldSet2.default)(this, _redirectCount, (_this$redirectCount = (0,
|
|
227
|
+
if (((0, _classPrivateFieldSet2.default)(this, _redirectCount, (_this$redirectCount = (0, _classPrivateFieldGet7.default)(this, _redirectCount), _this$redirectCount2 = _this$redirectCount++, _this$redirectCount)), _this$redirectCount2) > 10) {
|
|
218
228
|
const message = `Infinite redirect detected: from "${from.pathname}${from.search}${from.hash}" to "${to}"`;
|
|
219
229
|
// istanbul ignore else: error cannot be caught in test
|
|
220
230
|
if (process.env.NODE_ENV === "test") {
|
|
@@ -233,23 +243,24 @@ async function _queuedRender2(location) {
|
|
|
233
243
|
await (0, _classPrivateMethodGet2.default)(this, _render, _render2).call(this, location);
|
|
234
244
|
} finally {
|
|
235
245
|
(0, _classPrivateFieldSet2.default)(this, _rendering, false);
|
|
236
|
-
if ((0,
|
|
237
|
-
const nextLocation = (0,
|
|
246
|
+
if ((0, _classPrivateFieldGet7.default)(this, _nextLocation)) {
|
|
247
|
+
const nextLocation = (0, _classPrivateFieldGet7.default)(this, _nextLocation);
|
|
238
248
|
(0, _classPrivateFieldSet2.default)(this, _nextLocation, undefined);
|
|
239
249
|
await (0, _classPrivateMethodGet2.default)(this, _queuedRender, _queuedRender2).call(this, nextLocation);
|
|
240
250
|
}
|
|
241
251
|
}
|
|
242
252
|
}
|
|
243
253
|
async function _render2(location) {
|
|
244
|
-
var _hooks$flowApi,
|
|
254
|
+
var _hooks$flowApi, _classPrivateFieldGet6;
|
|
245
255
|
(0, _classPrivateFieldSet2.default)(this, _renderId, (0, _lodash.uniqueId)("render-id-1"));
|
|
246
256
|
(0, _markAsComputed.resetAllComputedMarks)();
|
|
247
257
|
(0, _resolveData.clearResolveCache)();
|
|
248
258
|
_Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$flowApi = _Runtime.hooks.flowApi) === null || _hooks$flowApi === void 0 ? void 0 : _hooks$flowApi.clearCollectWidgetContract();
|
|
249
259
|
const history = (0, _history3.getHistory)();
|
|
250
260
|
history.unblock();
|
|
251
|
-
const
|
|
252
|
-
const
|
|
261
|
+
const renderStartTime = performance.now();
|
|
262
|
+
const storyboard = (0, _matchStoryboard.matchStoryboard)((0, _classPrivateFieldGet7.default)(this, _storyboards), location.pathname);
|
|
263
|
+
const previousApp = (_classPrivateFieldGet6 = (0, _classPrivateFieldGet7.default)(this, _runtimeContext)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.app;
|
|
253
264
|
if (storyboard !== null && storyboard !== void 0 && storyboard.app) {
|
|
254
265
|
await (0, _fulfilStoryboard.fulfilStoryboard)(storyboard);
|
|
255
266
|
}
|
|
@@ -262,9 +273,9 @@ async function _render2(location) {
|
|
|
262
273
|
|
|
263
274
|
// Set `Router::#currentApp` before calling `getFeatureFlags()`
|
|
264
275
|
const flags = (0, _Runtime.getRuntime)().getFeatureFlags();
|
|
265
|
-
const prevRendererContext = (0,
|
|
276
|
+
const prevRendererContext = (0, _classPrivateFieldGet7.default)(this, _rendererContext);
|
|
266
277
|
const redirectTo = (to, state) => {
|
|
267
|
-
(0,
|
|
278
|
+
(0, _classPrivateFieldGet7.default)(this, _rendererContextTrashCan).add(prevRendererContext);
|
|
268
279
|
(0, _classPrivateMethodGet2.default)(this, _safeRedirect, _safeRedirect2).call(this, to, state, location);
|
|
269
280
|
};
|
|
270
281
|
const redirectToLogin = () => {
|
|
@@ -286,14 +297,14 @@ async function _render2(location) {
|
|
|
286
297
|
(0, _mount.unmountTree)(portal);
|
|
287
298
|
|
|
288
299
|
// Note: redirects can lead to multiple trash renderer contexts.
|
|
289
|
-
(0,
|
|
290
|
-
for (const item of (0,
|
|
300
|
+
(0, _classPrivateFieldGet7.default)(this, _rendererContextTrashCan).add(prevRendererContext);
|
|
301
|
+
for (const item of (0, _classPrivateFieldGet7.default)(this, _rendererContextTrashCan)) {
|
|
291
302
|
if (item) {
|
|
292
303
|
item.dispatchOnUnmount();
|
|
293
304
|
item.dispose();
|
|
294
305
|
}
|
|
295
306
|
}
|
|
296
|
-
(0,
|
|
307
|
+
(0, _classPrivateFieldGet7.default)(this, _rendererContextTrashCan).clear();
|
|
297
308
|
_Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$messageDispatc = _Runtime.hooks.messageDispatcher) === null || _hooks$messageDispatc === void 0 ? void 0 : _hooks$messageDispatc.reset();
|
|
298
309
|
if (appChanged) {
|
|
299
310
|
(0, _classPrivateFieldSet2.default)(this, _previousApp, previousApp);
|
|
@@ -310,7 +321,53 @@ async function _render2(location) {
|
|
|
310
321
|
if (currentApp) {
|
|
311
322
|
var _hooks$checkInstalled, _hooks$auth, _hooks$checkPermissio, _storyboard$meta, _hooks$flowApi2, _storyboard$meta2;
|
|
312
323
|
_Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$checkInstalled = _Runtime.hooks.checkInstalledApps) === null || _hooks$checkInstalled === void 0 ? void 0 : _hooks$checkInstalled.preCheckInstalledApps(storyboard, appId => !!(0, _Runtime._internalApiGetAppInBootstrapData)(appId));
|
|
313
|
-
const
|
|
324
|
+
const routeHelper = {
|
|
325
|
+
bailout: output => {
|
|
326
|
+
if (output.unauthenticated) {
|
|
327
|
+
redirectToLogin();
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
if (output.redirect) {
|
|
331
|
+
redirectTo(output.redirect.path, output.redirect.state);
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
// Reset redirect count if no redirect is set.
|
|
335
|
+
(0, _classPrivateFieldSet2.default)(this, _redirectCount, 0);
|
|
336
|
+
},
|
|
337
|
+
mergeMenus: async menuRequests => {
|
|
338
|
+
const menuConfs = await Promise.all(menuRequests);
|
|
339
|
+
(0, _classPrivateFieldSet2.default)(this, _navConfig, mergeMenuConfs(menuConfs));
|
|
340
|
+
},
|
|
341
|
+
catch: (error, returnNode) => {
|
|
342
|
+
if ((0, _handleHttpError.isUnauthenticatedError)(error) && !window.NO_AUTH_GUARD) {
|
|
343
|
+
redirectToLogin();
|
|
344
|
+
return;
|
|
345
|
+
} else if (error instanceof _http.HttpAbortError) {
|
|
346
|
+
(0, _classPrivateFieldGet7.default)(this, _rendererContextTrashCan).add(prevRendererContext);
|
|
347
|
+
return;
|
|
348
|
+
} else {
|
|
349
|
+
return {
|
|
350
|
+
failed: true,
|
|
351
|
+
output: {
|
|
352
|
+
node: {
|
|
353
|
+
tag: _enums.RenderTag.BRICK,
|
|
354
|
+
type: "div",
|
|
355
|
+
properties: {
|
|
356
|
+
textContent: (0, _handleHttpError.httpErrorToString)(error)
|
|
357
|
+
},
|
|
358
|
+
runtimeContext: null,
|
|
359
|
+
return: returnNode
|
|
360
|
+
},
|
|
361
|
+
blockingList: [],
|
|
362
|
+
menuRequests: []
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const rendererContext = (0, _classPrivateFieldSet2.default)(this, _rendererContext, new _RendererContext.RendererContext("page", {
|
|
369
|
+
routeHelper
|
|
370
|
+
}));
|
|
314
371
|
const runtimeContext = (0, _classPrivateFieldSet2.default)(this, _runtimeContext, {
|
|
315
372
|
app: currentApp,
|
|
316
373
|
location,
|
|
@@ -336,47 +393,25 @@ async function _render2(location) {
|
|
|
336
393
|
let output;
|
|
337
394
|
let stores = [];
|
|
338
395
|
try {
|
|
339
|
-
output = await (0, _Renderer.renderRoutes)(renderRoot, (0, _insertPreviewRoutes.insertPreviewRoutes)(storyboard.routes), runtimeContext, rendererContext);
|
|
340
|
-
if (output
|
|
341
|
-
redirectToLogin();
|
|
396
|
+
output = await (0, _Renderer.renderRoutes)(renderRoot, (0, _insertPreviewRoutes.insertPreviewRoutes)(storyboard.routes), runtimeContext, rendererContext, []);
|
|
397
|
+
if (routeHelper.bailout(output)) {
|
|
342
398
|
return;
|
|
343
399
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
// Reset redirect count if no redirect is set.
|
|
349
|
-
(0, _classPrivateFieldSet2.default)(this, _redirectCount, 0);
|
|
350
|
-
(0, _loader.flushStableLoadBricks)();
|
|
351
|
-
stores = [runtimeContext.ctxStore, ...runtimeContext.tplStateStoreMap.values(), ...runtimeContext.formStateStoreMap.values()];
|
|
352
|
-
await Promise.all([...output.blockingList, ...stores.map(store => store.waitForAll()), ...runtimeContext.pendingPermissionsPreCheck]);
|
|
353
|
-
const menuConfs = await Promise.all(output.menuRequests);
|
|
354
|
-
(0, _classPrivateFieldSet2.default)(this, _navConfig, mergeMenuConfs(menuConfs));
|
|
400
|
+
stores = (0, _Renderer.getDataStores)(runtimeContext);
|
|
401
|
+
await (0, _Renderer.postAsyncRender)(output, runtimeContext, stores);
|
|
402
|
+
await routeHelper.mergeMenus(output.menuRequests);
|
|
403
|
+
rendererContext.setInitialMenuRequests(output.menuRequests);
|
|
355
404
|
} catch (error) {
|
|
356
405
|
// eslint-disable-next-line no-console
|
|
357
406
|
console.error("Router failed:", error);
|
|
358
|
-
|
|
359
|
-
|
|
407
|
+
const result = routeHelper.catch(error, renderRoot);
|
|
408
|
+
if (!result) {
|
|
360
409
|
return;
|
|
361
|
-
} else if (error instanceof _http.HttpAbortError) {
|
|
362
|
-
(0, _classPrivateFieldGet6.default)(this, _rendererContextTrashCan).add(prevRendererContext);
|
|
363
|
-
return;
|
|
364
|
-
} else {
|
|
365
|
-
failed = true;
|
|
366
|
-
output = {
|
|
367
|
-
node: {
|
|
368
|
-
tag: _enums.RenderTag.BRICK,
|
|
369
|
-
type: "div",
|
|
370
|
-
properties: {
|
|
371
|
-
textContent: (0, _handleHttpError.httpErrorToString)(error)
|
|
372
|
-
},
|
|
373
|
-
runtimeContext: null,
|
|
374
|
-
return: renderRoot
|
|
375
|
-
},
|
|
376
|
-
blockingList: [],
|
|
377
|
-
menuRequests: []
|
|
378
|
-
};
|
|
379
410
|
}
|
|
411
|
+
({
|
|
412
|
+
failed,
|
|
413
|
+
output
|
|
414
|
+
} = result);
|
|
380
415
|
}
|
|
381
416
|
renderRoot.child = output.node;
|
|
382
417
|
cleanUpPreviousRender();
|
|
@@ -393,16 +428,22 @@ async function _render2(location) {
|
|
|
393
428
|
// See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md
|
|
394
429
|
window.scrollTo(0, 0);
|
|
395
430
|
if (!failed) {
|
|
396
|
-
for (const store of stores) {
|
|
397
|
-
store.handleAsyncAfterMount();
|
|
398
|
-
}
|
|
399
431
|
rendererContext.dispatchPageLoad();
|
|
400
432
|
rendererContext.dispatchAnchorLoad();
|
|
401
433
|
rendererContext.dispatchOnMount();
|
|
402
434
|
rendererContext.initializeScrollIntoView();
|
|
403
435
|
rendererContext.initializeMediaChange();
|
|
404
436
|
rendererContext.initializeMessageDispatcher();
|
|
437
|
+
for (const store of stores) {
|
|
438
|
+
store.mountAsyncData();
|
|
439
|
+
}
|
|
405
440
|
}
|
|
441
|
+
const renderTime = performance.now() - renderStartTime;
|
|
442
|
+
window.dispatchEvent(new CustomEvent("route.render", {
|
|
443
|
+
detail: {
|
|
444
|
+
renderTime
|
|
445
|
+
}
|
|
446
|
+
}));
|
|
406
447
|
return;
|
|
407
448
|
}
|
|
408
449
|
} else if (!window.NO_AUTH_GUARD && _Runtime.hooks !== null && _Runtime.hooks !== void 0 && _Runtime.hooks.auth && !_Runtime.hooks.auth.isLoggedIn()) {
|
|
@@ -435,16 +476,14 @@ function mergeMenuConfs(menuConfs) {
|
|
|
435
476
|
breadcrumb: []
|
|
436
477
|
};
|
|
437
478
|
for (const menuConf of menuConfs) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
if (breadcrumb) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
navConfig.breadcrumb.push(...breadcrumb.items);
|
|
447
|
-
}
|
|
479
|
+
const {
|
|
480
|
+
breadcrumb
|
|
481
|
+
} = menuConf;
|
|
482
|
+
if (breadcrumb) {
|
|
483
|
+
if (breadcrumb.overwrite) {
|
|
484
|
+
navConfig.breadcrumb = breadcrumb.items;
|
|
485
|
+
} else {
|
|
486
|
+
navConfig.breadcrumb.push(...breadcrumb.items);
|
|
448
487
|
}
|
|
449
488
|
}
|
|
450
489
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","names":["_history2","require","_loader","_http","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_getBlockMessageBeforePageLave","WeakSet","_safeRedirect","_queuedRender","_render","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","writable","value","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_classPrivateMethodGet2","_getBlockMessageBeforePageLave2","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet6","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","listen","_classPrivateFieldGet2","_location$state","_classPrivateFieldGet3","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","_queuedRender2","catch","handleHttpError","exports","detail","_classPrivateFieldGet4","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect2","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render2","nextLocation","_hooks$flowApi","_classPrivateFieldGet5","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","app","fulfilStoryboard","appChanged","id","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","add","redirectToLogin","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","appId","_internalApiGetAppInBootstrapData","rendererContext","RendererContext","runtimeContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","failed","output","stores","renderRoutes","insertPreviewRoutes","routes","unauthenticated","redirect","path","flushStableLoadBricks","values","Promise","all","blockingList","map","store","waitForAll","menuConfs","menuRequests","mergeMenuConfs","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","node","BRICK","type","properties","textContent","httpErrorToString","return","child","route","dispatchBeforePageLoad","applyTheme","applyMode","mountTree","scrollTo","handleAsyncAfterMount","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport { RenderOutput, renderRoutes } 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 } 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 { RenderBrick, RenderRoot, RuntimeContext } 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 { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.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 history.listen((location, action) => {\n let ignoreRendering = false;\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 if (ignoreRendering) {\n this.#prevLocation = location;\n return;\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 this.#renderId = uniqueId(\"render-id-1\");\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n const currentApp = (this.#currentApp = storyboard?.app);\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 // 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 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 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 rendererContext = (this.#rendererContext = new RendererContext(\n \"page\"\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 output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext\n );\n if (output.unauthenticated) {\n redirectToLogin();\n return;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n\n flushStableLoadBricks();\n\n stores = [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n\n await Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n\n const menuConfs = await Promise.all(output.menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\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 failed = true;\n output = {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n runtimeContext: null!,\n return: renderRoot,\n },\n blockingList: [],\n menuRequests: [],\n };\n }\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 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 for (const store of stores) {\n store.handleAsyncAfterMount();\n }\n\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n }\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 }\n}\n\nfunction mergeMenuConfs(menuConfs: (StaticMenuConf | undefined)[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n if (menuConf) {\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 }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,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;AAEA,IAAAe,eAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAhB,OAAA;AAKA,IAAAiB,gBAAA,GAAAjB,OAAA;AACA,IAAAkB,wBAAA,GAAAlB,OAAA;AACA,IAAAmB,iBAAA,GAAAnB,OAAA;AACA,IAAAoB,MAAA,GAAApB,OAAA;AACA,IAAAqB,oBAAA,GAAArB,OAAA;AAA+D,IAAAsB,YAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,aAAA,oBAAAF,OAAA;AAAA,IAAAG,aAAA,oBAAAH,OAAA;AAAA,IAAAI,eAAA,oBAAAJ,OAAA;AAAA,IAAAK,gBAAA,oBAAAL,OAAA;AAAA,IAAAM,wBAAA,oBAAAN,OAAA;AAAA,IAAAO,cAAA,oBAAAP,OAAA;AAAA,IAAAQ,SAAA,oBAAAR,OAAA;AAAA,IAAAS,WAAA,oBAAAT,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AAC;EACZ,IAAAC,uBAAS,EAAC,CAAC;EAEX,MAAMX,IAAiB,GAAG;IACxB/E,GAAG,EAAEC,gBAAS,CAAC+E,KAAK;IACpBC,IAAI,EAAE,KAAK;IACXC,UAAU,EAAE;MACVC,WAAW,EAAE;IACf,CAAC;IACDnD,cAAc,EAAE,IAAK;IACrBqD,MAAM,EAAEtF;EACV,CAAC;EACDA,UAAU,CAACuF,KAAK,GAAGP,IAAI;EAEvB,IAAAY,gBAAS,EAAC5F,UAAU,CAAC;;EAErB;EACAxF,MAAM,CAACqL,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AACvB;AAGF,SAASjB,cAAcA,CAACF,SAAyC,EAAE;EACjE,MAAM4B,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAI9B,SAAS,EAAE;IAChC,IAAI8B,QAAQ,EAAE;MACZ,MAAM;QAAED;MAAW,CAAC,GAAGC,QAAQ;MAC/B,IAAID,UAAU,EAAE;QACd,IAAIA,UAAU,CAACE,SAAS,EAAE;UACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;QACzC,CAAC,MAAM;UACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;QAChD;MACF;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
|
|
1
|
+
{"version":3,"file":"Router.js","names":["_history2","require","_http","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_getBlockMessageBeforePageLave","WeakSet","_safeRedirect","_queuedRender","_render","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","writable","value","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_classPrivateMethodGet2","_getBlockMessageBeforePageLave2","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet7","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","renderId","listen","_classPrivateFieldGet2","_location$state","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","_queuedRender2","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect2","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render2","nextLocation","_hooks$flowApi","_classPrivateFieldGet6","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","renderStartTime","performance","now","app","fulfilStoryboard","appChanged","id","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","add","redirectToLogin","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","appId","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","failed","node","BRICK","type","properties","textContent","httpErrorToString","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","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","applyTheme","applyMode","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","renderTime","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 { 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 { RenderBrick, RenderRoot, RuntimeContext } 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 { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.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) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(location);\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 this.#renderId = uniqueId(\"render-id-1\");\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n const renderStartTime = performance.now();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n const currentApp = (this.#currentApp = storyboard?.app);\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 // 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 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 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 },\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 return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n menuRequests: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper }\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 output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n []\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n await routeHelper.mergeMenus(output.menuRequests);\n rendererContext.setInitialMenuRequests(output.menuRequests);\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 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\n const renderTime = performance.now() - renderStartTime;\n window.dispatchEvent(\n new CustomEvent(\"route.render\", {\n detail: {\n renderTime,\n },\n })\n );\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 }\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,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAMA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAOA,IAAAY,QAAA,GAAAZ,OAAA;AAKA,IAAAa,YAAA,GAAAb,OAAA;AAEA,IAAAc,eAAA,GAAAd,OAAA;AACA,IAAAe,gBAAA,GAAAf,OAAA;AAKA,IAAAgB,gBAAA,GA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