@next-core/runtime 1.24.0 → 1.24.2

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.
@@ -90,7 +90,8 @@ function handleHttpError(error) {
90
90
  title: _i18n.i18n.t(`${_i18n2.NS}:${_i18n2.K.REQUEST_FAILED}`),
91
91
  content: message,
92
92
  contentStyle: {
93
- whiteSpace: "pre-wrap"
93
+ whiteSpace: "pre-wrap",
94
+ wordBreak: "break-word"
94
95
  }
95
96
  }).then(() => {
96
97
  lastErrorMessage = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"handleHttpError.js","names":["_http","require","_i18n","_Runtime","_history","_i18n2","_Dialog","_setLoginStateCookie","httpErrorToString","error","Event","target","HTMLScriptElement","src","HttpFetchError","i18n","t","NS","K","NETWORK_ERROR","HttpResponseError","responseJson","msg","toString","isUnauthenticatedError","response","status","code","unauthenticatedConfirming","lastErrorMessage","handleHttpError","HttpAbortError","window","NO_AUTH_GUARD","Dialog","show","type","content","LOGIN_TIMEOUT_MESSAGE","then","redirectToLogin","console","message","title","REQUEST_FAILED","contentStyle","whiteSpace","undefined","ssoEnabled","getRuntime","getFeatureFlags","history","getHistory","setLoginStateCookie","location","push","from","state"],"sources":["../../src/handleHttpError.ts"],"sourcesContent":["import {\n HttpAbortError,\n HttpFetchError,\n HttpResponseError,\n} from \"@next-core/http\";\nimport { i18n } from \"@next-core/i18n\";\nimport { getRuntime } from \"./internal/Runtime.js\";\nimport { getHistory } from \"./history.js\";\nimport { K, NS } from \"./internal/i18n.js\";\nimport { Dialog } from \"./Dialog.js\";\nimport { setLoginStateCookie } from \"./setLoginStateCookie.js\";\n\n/**\n * 将 http 请求错误转换为可读的字符串。\n *\n * @remarks\n *\n * 将依次尝试读取返回的 JSON 格式数据的字符串类型的 `error` 和 `msg` 字段,如果没有找到则返回 `error.toString()` 的结果。\n *\n * @param error - 错误对象。\n *\n * @returns 转换为字符串的错误信息。\n */\nexport function httpErrorToString(error: unknown): string {\n if (error instanceof Event && error.target instanceof HTMLScriptElement) {\n return error.target.src;\n }\n if (error instanceof HttpFetchError) {\n return i18n.t(`${NS}:${K.NETWORK_ERROR}`);\n }\n if (error instanceof HttpResponseError) {\n if (error.responseJson) {\n if (typeof error.responseJson.error === \"string\") {\n return error.responseJson.error;\n } else if (typeof error.responseJson.msg === \"string\") {\n return error.responseJson.msg;\n }\n }\n }\n if (error == null) {\n return \"Unknown error\";\n }\n return error.toString();\n}\n\nexport function isUnauthenticatedError(error: unknown): boolean {\n return (\n error instanceof HttpResponseError &&\n error.response.status === 401 &&\n !!error.responseJson &&\n error.responseJson.code === 100003\n );\n}\n\nlet unauthenticatedConfirming = false;\n\nlet lastErrorMessage: string | undefined;\n\n/**\n * 处理 http 请求错误(使用 AntDesign 模态框弹出错误信息)。\n *\n * @param error - 错误对象。\n */\nexport function handleHttpError(error: unknown) {\n // Do nothing if aborted http requests\n if (error instanceof HttpAbortError) {\n return;\n }\n\n // Redirect to login page if not logged in.\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n if (unauthenticatedConfirming) {\n return;\n }\n unauthenticatedConfirming = true;\n Dialog.show({\n type: \"confirm\",\n content: i18n.t(`${NS}:${K.LOGIN_TIMEOUT_MESSAGE}`),\n }).then(\n () => {\n redirectToLogin();\n unauthenticatedConfirming = false;\n },\n () => {\n unauthenticatedConfirming = false;\n }\n );\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(error);\n\n const message = httpErrorToString(error);\n if (message !== lastErrorMessage) {\n lastErrorMessage = message;\n Dialog.show({\n type: \"error\",\n title: i18n.t(`${NS}:${K.REQUEST_FAILED}`),\n content: message,\n contentStyle: {\n whiteSpace: \"pre-wrap\",\n },\n }).then(() => {\n lastErrorMessage = undefined;\n });\n }\n return;\n}\n\nfunction redirectToLogin() {\n const ssoEnabled = getRuntime().getFeatureFlags()[\"sso-enabled\"];\n const history = getHistory();\n setLoginStateCookie(history.location);\n history.push(ssoEnabled ? \"/sso-auth/login\" : \"/auth/login\", {\n from: {\n ...history.location,\n state: undefined,\n },\n });\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,iBAAiBA,CAACC,KAAc,EAAU;EACxD,IAAIA,KAAK,YAAYC,KAAK,IAAID,KAAK,CAACE,MAAM,YAAYC,iBAAiB,EAAE;IACvE,OAAOH,KAAK,CAACE,MAAM,CAACE,GAAG;EACzB;EACA,IAAIJ,KAAK,YAAYK,oBAAc,EAAE;IACnC,OAAOC,UAAI,CAACC,CAAC,CAAE,GAAEC,SAAG,IAAGC,QAAC,CAACC,aAAc,EAAC,CAAC;EAC3C;EACA,IAAIV,KAAK,YAAYW,uBAAiB,EAAE;IACtC,IAAIX,KAAK,CAACY,YAAY,EAAE;MACtB,IAAI,OAAOZ,KAAK,CAACY,YAAY,CAACZ,KAAK,KAAK,QAAQ,EAAE;QAChD,OAAOA,KAAK,CAACY,YAAY,CAACZ,KAAK;MACjC,CAAC,MAAM,IAAI,OAAOA,KAAK,CAACY,YAAY,CAACC,GAAG,KAAK,QAAQ,EAAE;QACrD,OAAOb,KAAK,CAACY,YAAY,CAACC,GAAG;MAC/B;IACF;EACF;EACA,IAAIb,KAAK,IAAI,IAAI,EAAE;IACjB,OAAO,eAAe;EACxB;EACA,OAAOA,KAAK,CAACc,QAAQ,CAAC,CAAC;AACzB;AAEO,SAASC,sBAAsBA,CAACf,KAAc,EAAW;EAC9D,OACEA,KAAK,YAAYW,uBAAiB,IAClCX,KAAK,CAACgB,QAAQ,CAACC,MAAM,KAAK,GAAG,IAC7B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EACA;AACF;AAEA,SAASP,eAAeA,CAAA,EAAG;EACzB,MAAMQ,UAAU,GAAG,IAAAC,mBAAU,EAAC,CAAC,CAACC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC;EAChE,MAAMC,OAAO,GAAG,IAAAC,mBAAU,EAAC,CAAC;EAC5B,IAAAC,wCAAmB,EAACF,OAAO,CAACG,QAAQ,CAAC;EACrCH,OAAO,CAACI,IAAI,CAACP,UAAU,GAAG,iBAAiB,GAAG,aAAa,EAAE;IAC3DQ,IAAI,EAAE;MACJ,GAAGL,OAAO,CAACG,QAAQ;MACnBG,KAAK,EAAEV;IACT;EACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"handleHttpError.js","names":["_http","require","_i18n","_Runtime","_history","_i18n2","_Dialog","_setLoginStateCookie","httpErrorToString","error","Event","target","HTMLScriptElement","src","HttpFetchError","i18n","t","NS","K","NETWORK_ERROR","HttpResponseError","responseJson","msg","toString","isUnauthenticatedError","response","status","code","unauthenticatedConfirming","lastErrorMessage","handleHttpError","HttpAbortError","window","NO_AUTH_GUARD","Dialog","show","type","content","LOGIN_TIMEOUT_MESSAGE","then","redirectToLogin","console","message","title","REQUEST_FAILED","contentStyle","whiteSpace","wordBreak","undefined","ssoEnabled","getRuntime","getFeatureFlags","history","getHistory","setLoginStateCookie","location","push","from","state"],"sources":["../../src/handleHttpError.ts"],"sourcesContent":["import {\n HttpAbortError,\n HttpFetchError,\n HttpResponseError,\n} from \"@next-core/http\";\nimport { i18n } from \"@next-core/i18n\";\nimport { getRuntime } from \"./internal/Runtime.js\";\nimport { getHistory } from \"./history.js\";\nimport { K, NS } from \"./internal/i18n.js\";\nimport { Dialog } from \"./Dialog.js\";\nimport { setLoginStateCookie } from \"./setLoginStateCookie.js\";\n\n/**\n * 将 http 请求错误转换为可读的字符串。\n *\n * @remarks\n *\n * 将依次尝试读取返回的 JSON 格式数据的字符串类型的 `error` 和 `msg` 字段,如果没有找到则返回 `error.toString()` 的结果。\n *\n * @param error - 错误对象。\n *\n * @returns 转换为字符串的错误信息。\n */\nexport function httpErrorToString(error: unknown): string {\n if (error instanceof Event && error.target instanceof HTMLScriptElement) {\n return error.target.src;\n }\n if (error instanceof HttpFetchError) {\n return i18n.t(`${NS}:${K.NETWORK_ERROR}`);\n }\n if (error instanceof HttpResponseError) {\n if (error.responseJson) {\n if (typeof error.responseJson.error === \"string\") {\n return error.responseJson.error;\n } else if (typeof error.responseJson.msg === \"string\") {\n return error.responseJson.msg;\n }\n }\n }\n if (error == null) {\n return \"Unknown error\";\n }\n return error.toString();\n}\n\nexport function isUnauthenticatedError(error: unknown): boolean {\n return (\n error instanceof HttpResponseError &&\n error.response.status === 401 &&\n !!error.responseJson &&\n error.responseJson.code === 100003\n );\n}\n\nlet unauthenticatedConfirming = false;\n\nlet lastErrorMessage: string | undefined;\n\n/**\n * 处理 http 请求错误(使用 AntDesign 模态框弹出错误信息)。\n *\n * @param error - 错误对象。\n */\nexport function handleHttpError(error: unknown) {\n // Do nothing if aborted http requests\n if (error instanceof HttpAbortError) {\n return;\n }\n\n // Redirect to login page if not logged in.\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n if (unauthenticatedConfirming) {\n return;\n }\n unauthenticatedConfirming = true;\n Dialog.show({\n type: \"confirm\",\n content: i18n.t(`${NS}:${K.LOGIN_TIMEOUT_MESSAGE}`),\n }).then(\n () => {\n redirectToLogin();\n unauthenticatedConfirming = false;\n },\n () => {\n unauthenticatedConfirming = false;\n }\n );\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(error);\n\n const message = httpErrorToString(error);\n if (message !== lastErrorMessage) {\n lastErrorMessage = message;\n Dialog.show({\n type: \"error\",\n title: i18n.t(`${NS}:${K.REQUEST_FAILED}`),\n content: message,\n contentStyle: {\n whiteSpace: \"pre-wrap\",\n wordBreak: \"break-word\",\n },\n }).then(() => {\n lastErrorMessage = undefined;\n });\n }\n return;\n}\n\nfunction redirectToLogin() {\n const ssoEnabled = getRuntime().getFeatureFlags()[\"sso-enabled\"];\n const history = getHistory();\n setLoginStateCookie(history.location);\n history.push(ssoEnabled ? \"/sso-auth/login\" : \"/auth/login\", {\n from: {\n ...history.location,\n state: undefined,\n },\n });\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,iBAAiBA,CAACC,KAAc,EAAU;EACxD,IAAIA,KAAK,YAAYC,KAAK,IAAID,KAAK,CAACE,MAAM,YAAYC,iBAAiB,EAAE;IACvE,OAAOH,KAAK,CAACE,MAAM,CAACE,GAAG;EACzB;EACA,IAAIJ,KAAK,YAAYK,oBAAc,EAAE;IACnC,OAAOC,UAAI,CAACC,CAAC,CAAE,GAAEC,SAAG,IAAGC,QAAC,CAACC,aAAc,EAAC,CAAC;EAC3C;EACA,IAAIV,KAAK,YAAYW,uBAAiB,EAAE;IACtC,IAAIX,KAAK,CAACY,YAAY,EAAE;MACtB,IAAI,OAAOZ,KAAK,CAACY,YAAY,CAACZ,KAAK,KAAK,QAAQ,EAAE;QAChD,OAAOA,KAAK,CAACY,YAAY,CAACZ,KAAK;MACjC,CAAC,MAAM,IAAI,OAAOA,KAAK,CAACY,YAAY,CAACC,GAAG,KAAK,QAAQ,EAAE;QACrD,OAAOb,KAAK,CAACY,YAAY,CAACC,GAAG;MAC/B;IACF;EACF;EACA,IAAIb,KAAK,IAAI,IAAI,EAAE;IACjB,OAAO,eAAe;EACxB;EACA,OAAOA,KAAK,CAACc,QAAQ,CAAC,CAAC;AACzB;AAEO,SAASC,sBAAsBA,CAACf,KAAc,EAAW;EAC9D,OACEA,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AAE;MACb;IACF,CAAC,CAAC,CAACR,IAAI,CAAC,MAAM;MACZV,gBAAgB,GAAGmB,SAAS;IAC9B,CAAC,CAAC;EACJ;EACA;AACF;AAEA,SAASR,eAAeA,CAAA,EAAG;EACzB,MAAMS,UAAU,GAAG,IAAAC,mBAAU,EAAC,CAAC,CAACC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC;EAChE,MAAMC,OAAO,GAAG,IAAAC,mBAAU,EAAC,CAAC;EAC5B,IAAAC,wCAAmB,EAACF,OAAO,CAACG,QAAQ,CAAC;EACrCH,OAAO,CAACI,IAAI,CAACP,UAAU,GAAG,iBAAiB,GAAG,aAAa,EAAE;IAC3DQ,IAAI,EAAE;MACJ,GAAGL,OAAO,CAACG,QAAQ;MACnBG,KAAK,EAAEV;IACT;EACF,CAAC,CAAC;AACJ"}
@@ -330,7 +330,6 @@ async function _render2(location) {
330
330
  if (currentApp) {
331
331
  var _hooks$checkInstalled, _hooks$auth, _hooks$checkPermissio, _storyboard$meta, _hooks$flowApi2, _storyboard$meta2;
332
332
  _Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$checkInstalled = _Runtime.hooks.checkInstalledApps) === null || _hooks$checkInstalled === void 0 || _hooks$checkInstalled.preCheckInstalledApps(storyboard, appId => !!(0, _Runtime._internalApiGetAppInBootstrapData)(appId));
333
- (0, _setUIClassName.setUIClassName)(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
334
333
  const routeHelper = {
335
334
  bailout: output => {
336
335
  if (output.unauthenticated) {
@@ -440,6 +439,7 @@ async function _render2(location) {
440
439
  (0, _themeAndMode.applyTheme)();
441
440
  (0, _themeAndMode.applyMode)();
442
441
  window.DISABLE_REACT_FLUSH_SYNC = false;
442
+ (0, _setUIClassName.setUIClassName)(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
443
443
  (0, _mount.mountTree)(renderRoot);
444
444
  setTimeout(() => {
445
445
  window.DISABLE_REACT_FLUSH_SYNC = true;
@@ -1 +1 @@
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","_setLoginStateCookie","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_setUIClassName","_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","devtoolsHookEmit","_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","_hooks$pageView","_classPrivateFieldGet6","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","fulfilStoryboard","appChanged","id","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","setLoginStateCookie","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","appId","_internalApiGetAppInBootstrapData","setUIClassName","uiVersion","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","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","DISABLE_REACT_FLUSH_SYNC","mountTree","setTimeout","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 { setUIClassName } from \"../setUIClassName.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 const finishPageView = hooks?.pageView?.create();\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 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 setUIClassName(currentApp?.uiVersion);\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 }\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 window.DISABLE_REACT_FLUSH_SYNC = false;\n mountTree(renderRoot);\n setTimeout(() => {\n window.DISABLE_REACT_FLUSH_SYNC = true;\n });\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,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,GAAAhB,OAAA;AACA,IAAAiB,oBAAA,GAAAjB,OAAA;AACA,IAAAkB,wBAAA,GAAAlB,OAAA;AACA,IAAAmB,iBAAA,GAAAnB,OAAA;AACA,IAAAoB,MAAA,GAAApB,OAAA;AACA,IAAAqB,oBAAA,GAAArB,OAAA;AACA,IAAAsB,SAAA,GAAAtB,OAAA;AACA,IA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EAACpG,UAAU,CAAC;;EAErB;EACAnG,MAAM,CAACyM,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;EACrB1H,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAG;IAAEY,MAAM,EAAE;EAAY,CAAC,CAAC;EACzC,IAAA/C,0BAAgB,EAAC,UAAU,CAAC;AAC9B;AAGF,SAASmG,cAAcA,CAACH,SAA2B,EAAE;EACnD,MAAMyE,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAI3E,SAAS,EAAE;IAChC,MAAM;MAAE0E;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
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","_setLoginStateCookie","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_setUIClassName","_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","devtoolsHookEmit","_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","_hooks$pageView","_classPrivateFieldGet6","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","fulfilStoryboard","appChanged","id","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","setLoginStateCookie","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","appId","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","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","DISABLE_REACT_FLUSH_SYNC","setUIClassName","uiVersion","mountTree","setTimeout","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 { setUIClassName } from \"../setUIClassName.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 const finishPageView = hooks?.pageView?.create();\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 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 }\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 window.DISABLE_REACT_FLUSH_SYNC = false;\n setUIClassName(currentApp?.uiVersion);\n mountTree(renderRoot);\n setTimeout(() => {\n window.DISABLE_REACT_FLUSH_SYNC = true;\n });\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n devtoolsHookEmit(\"rendered\");\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n devtoolsHookEmit(\"rendered\");\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OA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,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
@@ -84,7 +84,8 @@ export function handleHttpError(error) {
84
84
  title: i18n.t("".concat(NS, ":").concat(K.REQUEST_FAILED)),
85
85
  content: message,
86
86
  contentStyle: {
87
- whiteSpace: "pre-wrap"
87
+ whiteSpace: "pre-wrap",
88
+ wordBreak: "break-word"
88
89
  }
89
90
  }).then(() => {
90
91
  lastErrorMessage = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"handleHttpError.js","names":["HttpAbortError","HttpFetchError","HttpResponseError","i18n","getRuntime","getHistory","K","NS","Dialog","setLoginStateCookie","httpErrorToString","error","Event","target","HTMLScriptElement","src","t","concat","NETWORK_ERROR","responseJson","msg","toString","isUnauthenticatedError","response","status","code","unauthenticatedConfirming","lastErrorMessage","handleHttpError","window","NO_AUTH_GUARD","show","type","content","LOGIN_TIMEOUT_MESSAGE","then","redirectToLogin","console","message","title","REQUEST_FAILED","contentStyle","whiteSpace","undefined","ssoEnabled","getFeatureFlags","history","location","push","from","_objectSpread","state"],"sources":["../../src/handleHttpError.ts"],"sourcesContent":["import {\n HttpAbortError,\n HttpFetchError,\n HttpResponseError,\n} from \"@next-core/http\";\nimport { i18n } from \"@next-core/i18n\";\nimport { getRuntime } from \"./internal/Runtime.js\";\nimport { getHistory } from \"./history.js\";\nimport { K, NS } from \"./internal/i18n.js\";\nimport { Dialog } from \"./Dialog.js\";\nimport { setLoginStateCookie } from \"./setLoginStateCookie.js\";\n\n/**\n * 将 http 请求错误转换为可读的字符串。\n *\n * @remarks\n *\n * 将依次尝试读取返回的 JSON 格式数据的字符串类型的 `error` 和 `msg` 字段,如果没有找到则返回 `error.toString()` 的结果。\n *\n * @param error - 错误对象。\n *\n * @returns 转换为字符串的错误信息。\n */\nexport function httpErrorToString(error: unknown): string {\n if (error instanceof Event && error.target instanceof HTMLScriptElement) {\n return error.target.src;\n }\n if (error instanceof HttpFetchError) {\n return i18n.t(`${NS}:${K.NETWORK_ERROR}`);\n }\n if (error instanceof HttpResponseError) {\n if (error.responseJson) {\n if (typeof error.responseJson.error === \"string\") {\n return error.responseJson.error;\n } else if (typeof error.responseJson.msg === \"string\") {\n return error.responseJson.msg;\n }\n }\n }\n if (error == null) {\n return \"Unknown error\";\n }\n return error.toString();\n}\n\nexport function isUnauthenticatedError(error: unknown): boolean {\n return (\n error instanceof HttpResponseError &&\n error.response.status === 401 &&\n !!error.responseJson &&\n error.responseJson.code === 100003\n );\n}\n\nlet unauthenticatedConfirming = false;\n\nlet lastErrorMessage: string | undefined;\n\n/**\n * 处理 http 请求错误(使用 AntDesign 模态框弹出错误信息)。\n *\n * @param error - 错误对象。\n */\nexport function handleHttpError(error: unknown) {\n // Do nothing if aborted http requests\n if (error instanceof HttpAbortError) {\n return;\n }\n\n // Redirect to login page if not logged in.\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n if (unauthenticatedConfirming) {\n return;\n }\n unauthenticatedConfirming = true;\n Dialog.show({\n type: \"confirm\",\n content: i18n.t(`${NS}:${K.LOGIN_TIMEOUT_MESSAGE}`),\n }).then(\n () => {\n redirectToLogin();\n unauthenticatedConfirming = false;\n },\n () => {\n unauthenticatedConfirming = false;\n }\n );\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(error);\n\n const message = httpErrorToString(error);\n if (message !== lastErrorMessage) {\n lastErrorMessage = message;\n Dialog.show({\n type: \"error\",\n title: i18n.t(`${NS}:${K.REQUEST_FAILED}`),\n content: message,\n contentStyle: {\n whiteSpace: \"pre-wrap\",\n },\n }).then(() => {\n lastErrorMessage = undefined;\n });\n }\n return;\n}\n\nfunction redirectToLogin() {\n const ssoEnabled = getRuntime().getFeatureFlags()[\"sso-enabled\"];\n const history = getHistory();\n setLoginStateCookie(history.location);\n history.push(ssoEnabled ? \"/sso-auth/login\" : \"/auth/login\", {\n from: {\n ...history.location,\n state: undefined,\n },\n });\n}\n"],"mappings":";AAAA,SACEA,cAAc,EACdC,cAAc,EACdC,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B,CAAC,CAAC;EACJ;EACA;AACF;AAEA,SAASP,eAAeA,CAAA,EAAG;EACzB,IAAMQ,UAAU,GAAGxC,UAAU,CAAC,CAAC,CAACyC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC;EAChE,IAAMC,OAAO,GAAGzC,UAAU,CAAC,CAAC;EAC5BI,mBAAmB,CAACqC,OAAO,CAACC,QAAQ,CAAC;EACrCD,OAAO,CAACE,IAAI,CAACJ,UAAU,GAAG,iBAAiB,GAAG,aAAa,EAAE;IAC3DK,IAAI,EAAAC,aAAA,CAAAA,aAAA,KACCJ,OAAO,CAACC,QAAQ;MACnBI,KAAK,EAAER;IAAS;EAEpB,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"handleHttpError.js","names":["HttpAbortError","HttpFetchError","HttpResponseError","i18n","getRuntime","getHistory","K","NS","Dialog","setLoginStateCookie","httpErrorToString","error","Event","target","HTMLScriptElement","src","t","concat","NETWORK_ERROR","responseJson","msg","toString","isUnauthenticatedError","response","status","code","unauthenticatedConfirming","lastErrorMessage","handleHttpError","window","NO_AUTH_GUARD","show","type","content","LOGIN_TIMEOUT_MESSAGE","then","redirectToLogin","console","message","title","REQUEST_FAILED","contentStyle","whiteSpace","wordBreak","undefined","ssoEnabled","getFeatureFlags","history","location","push","from","_objectSpread","state"],"sources":["../../src/handleHttpError.ts"],"sourcesContent":["import {\n HttpAbortError,\n HttpFetchError,\n HttpResponseError,\n} from \"@next-core/http\";\nimport { i18n } from \"@next-core/i18n\";\nimport { getRuntime } from \"./internal/Runtime.js\";\nimport { getHistory } from \"./history.js\";\nimport { K, NS } from \"./internal/i18n.js\";\nimport { Dialog } from \"./Dialog.js\";\nimport { setLoginStateCookie } from \"./setLoginStateCookie.js\";\n\n/**\n * 将 http 请求错误转换为可读的字符串。\n *\n * @remarks\n *\n * 将依次尝试读取返回的 JSON 格式数据的字符串类型的 `error` 和 `msg` 字段,如果没有找到则返回 `error.toString()` 的结果。\n *\n * @param error - 错误对象。\n *\n * @returns 转换为字符串的错误信息。\n */\nexport function httpErrorToString(error: unknown): string {\n if (error instanceof Event && error.target instanceof HTMLScriptElement) {\n return error.target.src;\n }\n if (error instanceof HttpFetchError) {\n return i18n.t(`${NS}:${K.NETWORK_ERROR}`);\n }\n if (error instanceof HttpResponseError) {\n if (error.responseJson) {\n if (typeof error.responseJson.error === \"string\") {\n return error.responseJson.error;\n } else if (typeof error.responseJson.msg === \"string\") {\n return error.responseJson.msg;\n }\n }\n }\n if (error == null) {\n return \"Unknown error\";\n }\n return error.toString();\n}\n\nexport function isUnauthenticatedError(error: unknown): boolean {\n return (\n error instanceof HttpResponseError &&\n error.response.status === 401 &&\n !!error.responseJson &&\n error.responseJson.code === 100003\n );\n}\n\nlet unauthenticatedConfirming = false;\n\nlet lastErrorMessage: string | undefined;\n\n/**\n * 处理 http 请求错误(使用 AntDesign 模态框弹出错误信息)。\n *\n * @param error - 错误对象。\n */\nexport function handleHttpError(error: unknown) {\n // Do nothing if aborted http requests\n if (error instanceof HttpAbortError) {\n return;\n }\n\n // Redirect to login page if not logged in.\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n if (unauthenticatedConfirming) {\n return;\n }\n unauthenticatedConfirming = true;\n Dialog.show({\n type: \"confirm\",\n content: i18n.t(`${NS}:${K.LOGIN_TIMEOUT_MESSAGE}`),\n }).then(\n () => {\n redirectToLogin();\n unauthenticatedConfirming = false;\n },\n () => {\n unauthenticatedConfirming = false;\n }\n );\n return;\n }\n\n // eslint-disable-next-line no-console\n console.error(error);\n\n const message = httpErrorToString(error);\n if (message !== lastErrorMessage) {\n lastErrorMessage = message;\n Dialog.show({\n type: \"error\",\n title: i18n.t(`${NS}:${K.REQUEST_FAILED}`),\n content: message,\n contentStyle: {\n whiteSpace: \"pre-wrap\",\n wordBreak: \"break-word\",\n },\n }).then(() => {\n lastErrorMessage = undefined;\n });\n }\n return;\n}\n\nfunction redirectToLogin() {\n const ssoEnabled = getRuntime().getFeatureFlags()[\"sso-enabled\"];\n const history = getHistory();\n setLoginStateCookie(history.location);\n history.push(ssoEnabled ? \"/sso-auth/login\" : \"/auth/login\", {\n from: {\n ...history.location,\n state: undefined,\n },\n });\n}\n"],"mappings":";AAAA,SACEA,cAAc,EACdC,cAAc,EACdC,iBAAiB,QACZ,iBAAiB;AACxB,SAASC,IAAI,QAAQ,iBAAiB;AACtC,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,CAAC,EAAEC,EAAE,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,mBAAmB,QAAQ,0BAA0B;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,KAAc,EAAU;EACxD,IAAIA,KAAK,YAAYC,KAAK,IAAID,KAAK,CAACE,MAAM,YAAYC,iBAAiB,EAAE;IACvE,OAAOH,KAAK,CAACE,MAAM,CAACE,GAAG;EACzB;EACA,IAAIJ,KAAK,YAAYV,cAAc,EAAE;IACnC,OAAOE,IAAI,CAACa,CAAC,IAAAC,MAAA,CAAIV,EAAE,OAAAU,MAAA,CAAIX,CAAC,CAACY,aAAa,CAAE,CAAC;EAC3C;EACA,IAAIP,KAAK,YAAYT,iBAAiB,EAAE;IACtC,IAAIS,KAAK,CAACQ,YAAY,EAAE;MACtB,IAAI,OAAOR,KAAK,CAACQ,YAAY,CAACR,KAAK,KAAK,QAAQ,EAAE;QAChD,OAAOA,KAAK,CAACQ,YAAY,CAACR,KAAK;MACjC,CAAC,MAAM,IAAI,OAAOA,KAAK,CAACQ,YAAY,CAACC,GAAG,KAAK,QAAQ,EAAE;QACrD,OAAOT,KAAK,CAACQ,YAAY,CAACC,GAAG;MAC/B;IACF;EACF;EACA,IAAIT,KAAK,IAAI,IAAI,EAAE;IACjB,OAAO,eAAe;EACxB;EACA,OAAOA,KAAK,CAACU,QAAQ,CAAC,CAAC;AACzB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AACkC,cAAc,CAAE,CAAC;MAC1CP,OAAO,EAAEK,OAAO;MAChBG,YAAY,EAAE;QACZC,UAAU,EAAE,UAAU;QACtBC,SAAS,EAAE;MACb;IACF,CAAC,CAAC,CAACR,IAAI,CAAC,MAAM;MACZR,gBAAgB,GAAGiB,SAAS;IAC9B,CAAC,CAAC;EACJ;EACA;AACF;AAEA,SAASR,eAAeA,CAAA,EAAG;EACzB,IAAMS,UAAU,GAAGzC,UAAU,CAAC,CAAC,CAAC0C,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC;EAChE,IAAMC,OAAO,GAAG1C,UAAU,CAAC,CAAC;EAC5BI,mBAAmB,CAACsC,OAAO,CAACC,QAAQ,CAAC;EACrCD,OAAO,CAACE,IAAI,CAACJ,UAAU,GAAG,iBAAiB,GAAG,aAAa,EAAE;IAC3DK,IAAI,EAAAC,aAAA,CAAAA,aAAA,KACCJ,OAAO,CAACC,QAAQ;MACnBI,KAAK,EAAER;IAAS;EAEpB,CAAC,CAAC;AACJ"}
@@ -337,7 +337,6 @@ function _render3() {
337
337
  if (currentApp) {
338
338
  var _hooks$checkInstalled, _hooks$auth, _hooks$checkPermissio, _storyboard$meta, _hooks$flowApi2, _storyboard$meta2;
339
339
  hooks === null || hooks === void 0 || (_hooks$checkInstalled = hooks.checkInstalledApps) === null || _hooks$checkInstalled === void 0 || _hooks$checkInstalled.preCheckInstalledApps(storyboard, appId => !!_internalApiGetAppInBootstrapData(appId));
340
- setUIClassName(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
341
340
  var routeHelper = {
342
341
  bailout: output => {
343
342
  if (output.unauthenticated) {
@@ -450,6 +449,7 @@ function _render3() {
450
449
  applyTheme();
451
450
  applyMode();
452
451
  window.DISABLE_REACT_FLUSH_SYNC = false;
452
+ setUIClassName(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
453
453
  mountTree(renderRoot);
454
454
  setTimeout(() => {
455
455
  window.DISABLE_REACT_FLUSH_SYNC = true;
@@ -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","setUIClassName","_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","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","_objectSpread","_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","_this2","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","appChanged","id","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","appId","uiVersion","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","DISABLE_REACT_FLUSH_SYNC","setTimeout","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 { setUIClassName } from \"../setUIClassName.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 const finishPageView = hooks?.pageView?.create();\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 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 setUIClassName(currentApp?.uiVersion);\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 }\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 window.DISABLE_REACT_FLUSH_SYNC = false;\n mountTree(renderRoot);\n setTimeout(() => {\n window.DISABLE_REACT_FLUSH_SYNC = true;\n });\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,EACPC,QAAQ,QACH,oBAAoB;AAC3B,SACEC,iCAAiC,EACjCC,UAAU,EACVC,KAAK,QACA,cAAc;AACrB,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SACEC,eAAe,EACfC,iBAAiB,EACjBC,sBAAsB,QACjB,uBAAuB;AAC9B,SAASC,mBAAmB,EAAEC,mBAAmB,QAAQ,sBAAsB;AAC/E,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,SAAS,QAAQ,YAA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C,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","setUIClassName","_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","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","_objectSpread","_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","_this2","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","appChanged","id","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","appId","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","DISABLE_REACT_FLUSH_SYNC","uiVersion","setTimeout","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 { setUIClassName } from \"../setUIClassName.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 const finishPageView = hooks?.pageView?.create();\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 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 }\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 window.DISABLE_REACT_FLUSH_SYNC = false;\n setUIClassName(currentApp?.uiVersion);\n mountTree(renderRoot);\n setTimeout(() => {\n window.DISABLE_REACT_FLUSH_SYNC = true;\n });\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,EACPC,QAAQ,QACH,oBAAoB;AAC3B,SACEC,iCAAiC,EACjCC,UAAU,EACVC,KAAK,QACA,cAAc;AACrB,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SACEC,eAAe,EACfC,iBAAiB,EACjBC,sBAAsB,QACjB,uBAAuB;AAC9B,SAASC,mBAAmB,EAAEC,mBAAmB,QAA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Q,IAAI9D,SAAS,EAAE;IAChC,IAAM;MAAE6D;IAAW,CAAC,GAAGC,QAAQ;IAC/B,IAAID,UAAU,EAAE;MACd,IAAIA,UAAU,CAACE,SAAS,EAAE;QACxBH,SAAS,CAACC,UAAU,GAAGA,UAAU,CAACG,KAAK;MACzC,CAAC,MAAM;QACLJ,SAAS,CAACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/runtime",
3
- "version": "1.24.0",
3
+ "version": "1.24.2",
4
4
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/runtime",
5
5
  "license": "GPL-3.0",
6
6
  "repository": {
@@ -65,5 +65,5 @@
65
65
  "@next-core/build-next-libs": "^1.0.8",
66
66
  "@next-core/test-next": "^1.0.11"
67
67
  },
68
- "gitHead": "0cf0083bfde5b06e3aa4a8ef6af809de6eb9450a"
68
+ "gitHead": "0d88ad2099a63ef9b296285f65541eddc5b37485"
69
69
  }