@next-core/runtime 1.31.1 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _classPrivateMethodInitSpec from "@babel/runtime/helpers/classPrivateMethodInitSpec";
4
4
  import _classPrivateFieldInitSpec from "@babel/runtime/helpers/classPrivateFieldInitSpec";
5
- import _classPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
6
- import _classPrivateMethodGet from "@babel/runtime/helpers/classPrivateMethodGet";
7
- import _classPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
6
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
7
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
8
8
  import { locationsAreEqual } from "history";
9
9
  import { HttpAbortError } from "@next-core/http";
10
10
  import { uniqueId } from "lodash";
@@ -30,6 +30,7 @@ import { insertPreviewRoutes } from "./insertPreviewRoutes.js";
30
30
  import { devtoolsHookEmit } from "./devtools.js";
31
31
  import { setUIVersion } from "../setUIVersion.js";
32
32
  import { setAppVariable } from "../setAppVariable.js";
33
+ import { setWatermark } from "../setWatermark.js";
33
34
  var _storyboards = /*#__PURE__*/new WeakMap();
34
35
  var _rendering = /*#__PURE__*/new WeakMap();
35
36
  var _prevLocation = /*#__PURE__*/new WeakMap();
@@ -42,68 +43,26 @@ var _renderId = /*#__PURE__*/new WeakMap();
42
43
  var _currentApp = /*#__PURE__*/new WeakMap();
43
44
  var _previousApp = /*#__PURE__*/new WeakMap();
44
45
  var _navConfig = /*#__PURE__*/new WeakMap();
45
- var _getBlockMessageBeforePageLave = /*#__PURE__*/new WeakSet();
46
- var _safeRedirect = /*#__PURE__*/new WeakSet();
47
- var _queuedRender = /*#__PURE__*/new WeakSet();
48
- var _render = /*#__PURE__*/new WeakSet();
46
+ var _Router_brand = /*#__PURE__*/new WeakSet();
49
47
  export class Router {
50
48
  constructor(storyboards) {
51
- _classPrivateMethodInitSpec(this, _render);
52
- _classPrivateMethodInitSpec(this, _queuedRender);
53
- _classPrivateMethodInitSpec(this, _safeRedirect);
54
- _classPrivateMethodInitSpec(this, _getBlockMessageBeforePageLave);
55
- _classPrivateFieldInitSpec(this, _storyboards, {
56
- writable: true,
57
- value: void 0
58
- });
59
- _classPrivateFieldInitSpec(this, _rendering, {
60
- writable: true,
61
- value: false
62
- });
63
- _classPrivateFieldInitSpec(this, _prevLocation, {
64
- writable: true,
65
- value: void 0
66
- });
67
- _classPrivateFieldInitSpec(this, _nextLocation, {
68
- writable: true,
69
- value: void 0
70
- });
71
- _classPrivateFieldInitSpec(this, _runtimeContext, {
72
- writable: true,
73
- value: void 0
74
- });
75
- _classPrivateFieldInitSpec(this, _rendererContext, {
76
- writable: true,
77
- value: void 0
78
- });
79
- _classPrivateFieldInitSpec(this, _rendererContextTrashCan, {
80
- writable: true,
81
- value: new Set()
82
- });
83
- _classPrivateFieldInitSpec(this, _redirectCount, {
84
- writable: true,
85
- value: 0
86
- });
87
- _classPrivateFieldInitSpec(this, _renderId, {
88
- writable: true,
89
- value: void 0
90
- });
91
- _classPrivateFieldInitSpec(this, _currentApp, {
92
- writable: true,
93
- value: void 0
94
- });
95
- _classPrivateFieldInitSpec(this, _previousApp, {
96
- writable: true,
97
- value: void 0
98
- });
99
- _classPrivateFieldInitSpec(this, _navConfig, {
100
- writable: true,
101
- value: void 0
102
- });
103
- _classPrivateFieldSet(this, _storyboards, storyboards);
49
+ _classPrivateMethodInitSpec(this, _Router_brand);
50
+ _classPrivateFieldInitSpec(this, _storyboards, void 0);
51
+ _classPrivateFieldInitSpec(this, _rendering, false);
52
+ _classPrivateFieldInitSpec(this, _prevLocation, void 0);
53
+ _classPrivateFieldInitSpec(this, _nextLocation, void 0);
54
+ _classPrivateFieldInitSpec(this, _runtimeContext, void 0);
55
+ _classPrivateFieldInitSpec(this, _rendererContext, void 0);
56
+ _classPrivateFieldInitSpec(this, _rendererContextTrashCan, new Set());
57
+ _classPrivateFieldInitSpec(this, _redirectCount, 0);
58
+ _classPrivateFieldInitSpec(this, _renderId, void 0);
59
+ _classPrivateFieldInitSpec(this, _currentApp, void 0);
60
+ _classPrivateFieldInitSpec(this, _previousApp, void 0);
61
+ _classPrivateFieldInitSpec(this, _navConfig, void 0);
62
+ _classPrivateFieldSet(_storyboards, this, storyboards);
104
63
  var _history = getHistory();
105
64
  window.addEventListener("beforeunload", event => {
106
- var message = _classPrivateMethodGet(this, _getBlockMessageBeforePageLave, _getBlockMessageBeforePageLave2).call(this, {});
65
+ var message = _assertClassBrand(_Router_brand, this, _getBlockMessageBeforePageLave).call(this, {});
107
66
  // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload
108
67
  if (message) {
109
68
  // Cancel the event
@@ -116,31 +75,31 @@ export class Router {
116
75
  delete event.returnValue;
117
76
  }
118
77
  });
119
- _history.block((location, action) => _classPrivateMethodGet(this, _getBlockMessageBeforePageLave, _getBlockMessageBeforePageLave2).call(this, {
78
+ _history.block((location, action) => _assertClassBrand(_Router_brand, this, _getBlockMessageBeforePageLave).call(this, {
120
79
  location,
121
80
  action
122
81
  }));
123
82
  }
124
83
  getRenderId() {
125
- return _classPrivateFieldGet(this, _renderId);
84
+ return _classPrivateFieldGet(_renderId, this);
126
85
  }
127
86
  getRuntimeContext() {
128
- return _classPrivateFieldGet(this, _runtimeContext);
87
+ return _classPrivateFieldGet(_runtimeContext, this);
129
88
  }
130
89
  getRecentApps() {
131
90
  return {
132
- currentApp: _classPrivateFieldGet(this, _currentApp),
133
- previousApp: _classPrivateFieldGet(this, _previousApp)
91
+ currentApp: _classPrivateFieldGet(_currentApp, this),
92
+ previousApp: _classPrivateFieldGet(_previousApp, this)
134
93
  };
135
94
  }
136
95
  getNavConfig() {
137
- return _classPrivateFieldGet(this, _navConfig);
96
+ return _classPrivateFieldGet(_navConfig, this);
138
97
  }
139
98
  bootstrap() {
140
99
  var _this = this;
141
100
  initAbortController();
142
101
  var history = getHistory();
143
- _classPrivateFieldSet(this, _prevLocation, history.location);
102
+ _classPrivateFieldSet(_prevLocation, this, history.location);
144
103
  var renderId = 0;
145
104
  history.listen( /*#__PURE__*/function () {
146
105
  var _ref = _asyncToGenerator(function* (location, action) {
@@ -159,19 +118,19 @@ export class Router {
159
118
  // such as goBack or goForward,
160
119
  action === "POP" && (
161
120
  // and the previous location was triggered by hash link,
162
- _classPrivateFieldGet(_this, _prevLocation).key === undefined ||
121
+ _classPrivateFieldGet(_prevLocation, _this).key === undefined ||
163
122
  // or the previous location specified notify false.
164
- ((_classPrivateFieldGet2 = _classPrivateFieldGet(_this, _prevLocation).state) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.notify) === false)) {
123
+ ((_classPrivateFieldGet2 = _classPrivateFieldGet(_prevLocation, _this).state) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.notify) === false)) {
165
124
  omittedLocationProps.key = undefined;
166
125
  }
167
- if (locationsAreEqual(_objectSpread(_objectSpread({}, _classPrivateFieldGet(_this, _prevLocation)), omittedLocationProps), _objectSpread(_objectSpread({}, location), omittedLocationProps)) || action !== "POP" && ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.notify) === false) {
126
+ if (locationsAreEqual(_objectSpread(_objectSpread({}, _classPrivateFieldGet(_prevLocation, _this)), omittedLocationProps), _objectSpread(_objectSpread({}, location), omittedLocationProps)) || action !== "POP" && ((_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.notify) === false) {
168
127
  // Ignore rendering if location not changed except hash, state and optional key.
169
128
  // Ignore rendering if notify is `false`.
170
129
  ignoreRendering = true;
171
130
  }
172
131
  if (!ignoreRendering && !((_location$state2 = location.state) !== null && _location$state2 !== void 0 && _location$state2.noIncremental)) {
173
132
  var _classPrivateFieldGet3;
174
- ignoreRendering = yield (_classPrivateFieldGet3 = _classPrivateFieldGet(_this, _rendererContext)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.didPerformIncrementalRender(location, _classPrivateFieldGet(_this, _prevLocation));
133
+ ignoreRendering = yield (_classPrivateFieldGet3 = _classPrivateFieldGet(_rendererContext, _this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.didPerformIncrementalRender(location, _classPrivateFieldGet(_prevLocation, _this));
175
134
  }
176
135
 
177
136
  // Ignore stale renders
@@ -179,14 +138,14 @@ export class Router {
179
138
  return;
180
139
  }
181
140
  if (ignoreRendering) {
182
- _classPrivateFieldSet(_this, _prevLocation, location);
141
+ _classPrivateFieldSet(_prevLocation, _this, location);
183
142
  return;
184
143
  }
185
144
  abortPendingRequest();
186
- _classPrivateFieldSet(_this, _prevLocation, location);
187
- (_classPrivateFieldGet4 = _classPrivateFieldGet(_this, _rendererContext)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.dispatchPageLeave();
145
+ _classPrivateFieldSet(_prevLocation, _this, location);
146
+ (_classPrivateFieldGet4 = _classPrivateFieldGet(_rendererContext, _this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.dispatchPageLeave();
188
147
  if (action === "POP") {
189
- var storyboard = matchStoryboard(_classPrivateFieldGet(_this, _storyboards), location.pathname);
148
+ var storyboard = matchStoryboard(_classPrivateFieldGet(_storyboards, _this), location.pathname);
190
149
  // When a browser action of goBack or goForward is performing,
191
150
  // force reload when the target page is a page of an outside app.
192
151
  if (isOutsideApp(storyboard)) {
@@ -194,25 +153,25 @@ export class Router {
194
153
  return;
195
154
  }
196
155
  }
197
- if (_classPrivateFieldGet(_this, _rendering)) {
198
- _classPrivateFieldSet(_this, _nextLocation, location);
156
+ if (_classPrivateFieldGet(_rendering, _this)) {
157
+ _classPrivateFieldSet(_nextLocation, _this, location);
199
158
  } else {
200
159
  devtoolsHookEmit("locationChange");
201
- _classPrivateMethodGet(_this, _queuedRender, _queuedRender2).call(_this, location).catch(handleHttpError);
160
+ _assertClassBrand(_Router_brand, _this, _queuedRender).call(_this, location).catch(handleHttpError);
202
161
  }
203
162
  });
204
163
  return function (_x, _x2) {
205
164
  return _ref.apply(this, arguments);
206
165
  };
207
166
  }());
208
- return _classPrivateMethodGet(this, _queuedRender, _queuedRender2).call(this, history.location);
167
+ return _assertClassBrand(_Router_brand, this, _queuedRender).call(this, history.location);
209
168
  }
210
169
  }
211
- function _getBlockMessageBeforePageLave2(detail) {
170
+ function _getBlockMessageBeforePageLave(detail) {
212
171
  var _classPrivateFieldGet5;
213
172
  var history = getHistory();
214
173
  var previousMessage = history.getBlockMessage();
215
- (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _rendererContext)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.dispatchBeforePageLeave(detail);
174
+ (_classPrivateFieldGet5 = _classPrivateFieldGet(_rendererContext, this)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.dispatchBeforePageLeave(detail);
216
175
  var message = history.getBlockMessage();
217
176
  if (!previousMessage && message) {
218
177
  // Auto unblock only if new block was introduced by `onBeforePageLeave`.
@@ -220,9 +179,9 @@ function _getBlockMessageBeforePageLave2(detail) {
220
179
  }
221
180
  return message;
222
181
  }
223
- function _safeRedirect2(to, state, from) {
182
+ function _safeRedirect(to, state, from) {
224
183
  var _this$redirectCount, _this$redirectCount2;
225
- if ((_classPrivateFieldSet(this, _redirectCount, (_this$redirectCount = _classPrivateFieldGet(this, _redirectCount), _this$redirectCount2 = _this$redirectCount++, _this$redirectCount)), _this$redirectCount2) > 10) {
184
+ if ((_classPrivateFieldSet(_redirectCount, this, (_this$redirectCount = _classPrivateFieldGet(_redirectCount, this), _this$redirectCount2 = _this$redirectCount++, _this$redirectCount)), _this$redirectCount2) > 10) {
226
185
  var message = "Infinite redirect detected: from \"".concat(from.pathname).concat(from.search).concat(from.hash, "\" to \"").concat(to, "\"");
227
186
  // istanbul ignore else: error cannot be caught in test
228
187
  if (process.env.NODE_ENV === "test") {
@@ -235,36 +194,36 @@ function _safeRedirect2(to, state, from) {
235
194
  }
236
195
  getHistory().replace(to, state);
237
196
  }
238
- function _queuedRender2(_x3) {
239
- return _queuedRender3.apply(this, arguments);
197
+ function _queuedRender(_x3) {
198
+ return _queuedRender2.apply(this, arguments);
240
199
  }
241
- function _queuedRender3() {
242
- _queuedRender3 = _asyncToGenerator(function* (location) {
243
- _classPrivateFieldSet(this, _rendering, true);
200
+ function _queuedRender2() {
201
+ _queuedRender2 = _asyncToGenerator(function* (location) {
202
+ _classPrivateFieldSet(_rendering, this, true);
244
203
  try {
245
- yield _classPrivateMethodGet(this, _render, _render2).call(this, location);
204
+ yield _assertClassBrand(_Router_brand, this, _render).call(this, location);
246
205
  } finally {
247
- _classPrivateFieldSet(this, _rendering, false);
248
- if (_classPrivateFieldGet(this, _nextLocation)) {
249
- var nextLocation = _classPrivateFieldGet(this, _nextLocation);
250
- _classPrivateFieldSet(this, _nextLocation, undefined);
251
- yield _classPrivateMethodGet(this, _queuedRender, _queuedRender2).call(this, nextLocation);
206
+ _classPrivateFieldSet(_rendering, this, false);
207
+ if (_classPrivateFieldGet(_nextLocation, this)) {
208
+ var nextLocation = _classPrivateFieldGet(_nextLocation, this);
209
+ _classPrivateFieldSet(_nextLocation, this, undefined);
210
+ yield _assertClassBrand(_Router_brand, this, _queuedRender).call(this, nextLocation);
252
211
  }
253
212
  }
254
213
  });
255
- return _queuedRender3.apply(this, arguments);
214
+ return _queuedRender2.apply(this, arguments);
256
215
  }
257
- function _render2(_x4) {
258
- return _render3.apply(this, arguments);
216
+ function _render(_x4) {
217
+ return _render2.apply(this, arguments);
259
218
  }
260
- function _render3() {
261
- _render3 = _asyncToGenerator(function* (location) {
219
+ function _render2() {
220
+ _render2 = _asyncToGenerator(function* (location) {
262
221
  var _hooks$flowApi,
263
222
  _hooks$pageView,
264
223
  _classPrivateFieldGet6,
265
224
  _storyboard$app,
266
225
  _this2 = this;
267
- var renderId = _classPrivateFieldSet(this, _renderId, uniqueId("render-id-"));
226
+ var renderId = _classPrivateFieldSet(_renderId, this, uniqueId("render-id-"));
268
227
  resetAllComputedMarks();
269
228
  clearResolveCache();
270
229
  hooks === null || hooks === void 0 || (_hooks$flowApi = hooks.flowApi) === null || _hooks$flowApi === void 0 || _hooks$flowApi.clearCollectWidgetContract();
@@ -273,8 +232,8 @@ function _render3() {
273
232
 
274
233
  // const renderStartTime = performance.now();
275
234
  var finishPageView = hooks === null || hooks === void 0 || (_hooks$pageView = hooks.pageView) === null || _hooks$pageView === void 0 ? void 0 : _hooks$pageView.create();
276
- var storyboard = matchStoryboard(_classPrivateFieldGet(this, _storyboards), location.pathname);
277
- var previousApp = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _runtimeContext)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.app;
235
+ var storyboard = matchStoryboard(_classPrivateFieldGet(_storyboards, this), location.pathname);
236
+ var previousApp = (_classPrivateFieldGet6 = _classPrivateFieldGet(_runtimeContext, this)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.app;
278
237
  var currentAppId = storyboard === null || storyboard === void 0 || (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id;
279
238
  // dynamically change the value of the APP variable, if it's union app
280
239
  if (window.BOOTSTRAP_UNION_FILE && currentAppId && currentAppId !== (previousApp === null || previousApp === void 0 ? void 0 : previousApp.id)) {
@@ -283,10 +242,11 @@ function _render3() {
283
242
  version: storyboard.app.currentVersion
284
243
  });
285
244
  }
245
+ setWatermark();
286
246
  if (storyboard !== null && storyboard !== void 0 && storyboard.app) {
287
247
  yield fulfilStoryboard(storyboard);
288
248
  }
289
- var currentApp = _classPrivateFieldSet(this, _currentApp, storyboard === null || storyboard === void 0 ? void 0 : storyboard.app);
249
+ var currentApp = _classPrivateFieldSet(_currentApp, this, storyboard === null || storyboard === void 0 ? void 0 : storyboard.app);
290
250
 
291
251
  // Storyboard maybe re-assigned, e.g. when open launchpad.
292
252
  var appChanged = previousApp && currentApp ? previousApp.id !== currentApp.id : previousApp !== currentApp;
@@ -295,13 +255,13 @@ function _render3() {
295
255
 
296
256
  // Set `Router::#currentApp` before calling `getFeatureFlags()`
297
257
  var flags = getRuntime().getFeatureFlags();
298
- var prevRendererContext = _classPrivateFieldGet(this, _rendererContext);
258
+ var prevRendererContext = _classPrivateFieldGet(_rendererContext, this);
299
259
  var redirectTo = (to, state) => {
300
260
  finishPageView === null || finishPageView === void 0 || finishPageView({
301
261
  status: "redirected"
302
262
  });
303
- _classPrivateFieldGet(this, _rendererContextTrashCan).add(prevRendererContext);
304
- _classPrivateMethodGet(this, _safeRedirect, _safeRedirect2).call(this, to, state, location);
263
+ _classPrivateFieldGet(_rendererContextTrashCan, this).add(prevRendererContext);
264
+ _assertClassBrand(_Router_brand, this, _safeRedirect).call(this, to, state, location);
305
265
  };
306
266
  var redirectToLogin = () => {
307
267
  var to = flags["sso-enabled"] ? "/sso-auth/login" : "/auth/login";
@@ -323,17 +283,17 @@ function _render3() {
323
283
  unmountTree(portal);
324
284
 
325
285
  // Note: redirects can lead to multiple trash renderer contexts.
326
- _classPrivateFieldGet(this, _rendererContextTrashCan).add(prevRendererContext);
327
- for (var item of _classPrivateFieldGet(this, _rendererContextTrashCan)) {
286
+ _classPrivateFieldGet(_rendererContextTrashCan, this).add(prevRendererContext);
287
+ for (var item of _classPrivateFieldGet(_rendererContextTrashCan, this)) {
328
288
  if (item) {
329
289
  item.dispatchOnUnmount();
330
290
  item.dispose();
331
291
  }
332
292
  }
333
- _classPrivateFieldGet(this, _rendererContextTrashCan).clear();
293
+ _classPrivateFieldGet(_rendererContextTrashCan, this).clear();
334
294
  hooks === null || hooks === void 0 || (_hooks$messageDispatc = hooks.messageDispatcher) === null || _hooks$messageDispatc === void 0 || _hooks$messageDispatc.reset();
335
295
  if (appChanged) {
336
- _classPrivateFieldSet(this, _previousApp, previousApp);
296
+ _classPrivateFieldSet(_previousApp, this, previousApp);
337
297
  window.dispatchEvent(new CustomEvent("app.change", {
338
298
  detail: {
339
299
  previousApp,
@@ -358,12 +318,12 @@ function _render3() {
358
318
  return true;
359
319
  }
360
320
  // Reset redirect count if no redirect is set.
361
- _classPrivateFieldSet(this, _redirectCount, 0);
321
+ _classPrivateFieldSet(_redirectCount, this, 0);
362
322
  },
363
323
  mergeMenus: function () {
364
324
  var _ref2 = _asyncToGenerator(function* (menuRequests) {
365
325
  var menuConfs = yield Promise.all(menuRequests);
366
- _classPrivateFieldSet(_this2, _navConfig, mergeMenuConfs(menuConfs));
326
+ _classPrivateFieldSet(_navConfig, _this2, mergeMenuConfs(menuConfs));
367
327
  });
368
328
  return function mergeMenus(_x5) {
369
329
  return _ref2.apply(this, arguments);
@@ -374,7 +334,7 @@ function _render3() {
374
334
  redirectToLogin();
375
335
  return;
376
336
  } else if (error instanceof HttpAbortError) {
377
- _classPrivateFieldGet(this, _rendererContextTrashCan).add(prevRendererContext);
337
+ _classPrivateFieldGet(_rendererContextTrashCan, this).add(prevRendererContext);
378
338
  return;
379
339
  } else {
380
340
  var noAuthGuardLoginPath = getRuntime().getMiscSettings().noAuthGuardLoginPath;
@@ -403,11 +363,11 @@ function _render3() {
403
363
  }
404
364
  }
405
365
  };
406
- var rendererContext = _classPrivateFieldSet(this, _rendererContext, new RendererContext("page", {
366
+ var rendererContext = _classPrivateFieldSet(_rendererContext, this, new RendererContext("page", {
407
367
  routeHelper,
408
368
  renderId
409
369
  }));
410
- var runtimeContext = _classPrivateFieldSet(this, _runtimeContext, {
370
+ var runtimeContext = _classPrivateFieldSet(_runtimeContext, this, {
411
371
  app: currentApp,
412
372
  location,
413
373
  query: new URLSearchParams(location.search),
@@ -422,7 +382,7 @@ function _render3() {
422
382
  tplStateStoreMap: new Map(),
423
383
  formStateStoreMap: new Map()
424
384
  });
425
- _classPrivateFieldSet(this, _navConfig, undefined);
385
+ _classPrivateFieldSet(_navConfig, this, undefined);
426
386
  registerCustomTemplates(storyboard);
427
387
  registerStoryboardFunctions((_storyboard$meta = storyboard.meta) === null || _storyboard$meta === void 0 ? void 0 : _storyboard$meta.functions, currentApp);
428
388
  hooks === null || hooks === void 0 || (_hooks$flowApi2 = hooks.flowApi) === null || _hooks$flowApi2 === void 0 || _hooks$flowApi2.collectContract((_storyboard$meta2 = storyboard.meta) === null || _storyboard$meta2 === void 0 ? void 0 : _storyboard$meta2.contracts);
@@ -517,7 +477,7 @@ function _render3() {
517
477
  });
518
478
  devtoolsHookEmit("rendered");
519
479
  });
520
- return _render3.apply(this, arguments);
480
+ return _render2.apply(this, arguments);
521
481
  }
522
482
  function mergeMenuConfs(menuConfs) {
523
483
  var navConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Router.js","names":["locationsAreEqual","HttpAbortError","uniqueId","getHistory","getDataStores","postAsyncRender","renderRoutes","DataStore","clearResolveCache","mountTree","unmountTree","isOutsideApp","matchStoryboard","registerStoryboardFunctions","RendererContext","applyMode","applyTheme","getLocalAppsTheme","setMode","setTheme","_internalApiGetAppInBootstrapData","getRuntime","hooks","getPageInfo","resetAllComputedMarks","handleHttpError","httpErrorToString","isUnauthenticatedError","abortPendingRequest","initAbortController","setLoginStateCookie","registerCustomTemplates","fulfilStoryboard","RenderTag","insertPreviewRoutes","devtoolsHookEmit","setUIVersion","setAppVariable","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_getBlockMessageBeforePageLave","WeakSet","_safeRedirect","_queuedRender","_render","Router","constructor","storyboards","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","writable","value","Set","_classPrivateFieldSet","history","window","addEventListener","event","message","_classPrivateMethodGet","_getBlockMessageBeforePageLave2","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","_this","renderId","listen","_ref","_asyncToGenerator","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","_objectSpread","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","dispatchPageLeave","storyboard","pathname","reload","_queuedRender2","catch","_x","_x2","apply","arguments","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect2","to","from","_this$redirectCount","_this$redirectCount2","concat","search","process","env","NODE_ENV","console","error","Error","replace","_x3","_queuedRender3","_render2","nextLocation","_x4","_render3","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","_this2","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","appId","version","currentVersion","appChanged","flags","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","main","document","querySelector","portal","renderRoot","tag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","theme","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","_ref2","menuRequests","menuConfs","Promise","all","mergeMenuConfs","_x5","returnNode","NO_AUTH_GUARD","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","runtimeContext","return","blockingList","rendererContext","query","URLSearchParams","sys","auth","getAuth","settings","brand","getBrandSettings","ctxStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","meta","functions","collectContract","contracts","stores","routes","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","uiVersion","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 { 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 { 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\";\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 // 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 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 },\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 },\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, 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 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 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,SAAiBA,iBAAiB,QAAQ,SAAS;AAOnD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,QAAQ,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AAIA,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"}
1
+ {"version":3,"file":"Router.js","names":["locationsAreEqual","HttpAbortError","uniqueId","getHistory","getDataStores","postAsyncRender","renderRoutes","DataStore","clearResolveCache","mountTree","unmountTree","isOutsideApp","matchStoryboard","registerStoryboardFunctions","RendererContext","applyMode","applyTheme","getLocalAppsTheme","setMode","setTheme","_internalApiGetAppInBootstrapData","getRuntime","hooks","getPageInfo","resetAllComputedMarks","handleHttpError","httpErrorToString","isUnauthenticatedError","abortPendingRequest","initAbortController","setLoginStateCookie","registerCustomTemplates","fulfilStoryboard","RenderTag","insertPreviewRoutes","devtoolsHookEmit","setUIVersion","setAppVariable","setWatermark","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_Router_brand","WeakSet","Router","constructor","storyboards","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","Set","_classPrivateFieldSet","history","window","addEventListener","event","message","_assertClassBrand","_getBlockMessageBeforePageLave","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","_this","renderId","listen","_ref","_asyncToGenerator","_classPrivateFieldGet2","_location$state","_location$state2","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","_objectSpread","noIncremental","_classPrivateFieldGet3","didPerformIncrementalRender","dispatchPageLeave","storyboard","pathname","reload","_queuedRender","catch","_x","_x2","apply","arguments","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect","to","from","_this$redirectCount","_this$redirectCount2","concat","search","process","env","NODE_ENV","console","error","Error","replace","_x3","_queuedRender2","_render","nextLocation","_x4","_render2","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","_storyboard$app","_this2","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","currentAppId","id","BOOTSTRAP_UNION_FILE","appId","version","currentVersion","appChanged","flags","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","main","document","querySelector","portal","renderRoot","tag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","theme","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","_ref2","menuRequests","menuConfs","Promise","all","mergeMenuConfs","_x5","returnNode","NO_AUTH_GUARD","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","runtimeContext","return","blockingList","rendererContext","query","URLSearchParams","sys","auth","getAuth","settings","brand","getBrandSettings","ctxStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","meta","functions","collectContract","contracts","stores","routes","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","uiVersion","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 { 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 { 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\";\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 setWatermark();\n\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\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 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 },\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 },\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, 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 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 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,SAAiBA,iBAAiB,QAAQ,SAAS;AAOnD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,QAAQ,QAAQ,QAAQ;AACjC,SAAyCC,UAAU,QAAQ,eAAe;AAC1E,SAEEC,aAAa,EACbC,eAAe,EACfC,YAAY,QACP,eAAe;AACtB,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,YAAY,EAAEC,eAAe,QAAQ,sBAAsB;AACpE,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,eAAe,QAAqB,sBAAsB;AACnE,SACEC,SAAS,EACTC,UAAU,EACVC,iBAAiB,EACjBC,OAAO,E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