@next-core/runtime 1.23.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/CustomProcessors.js +1 -2
  2. package/dist/cjs/CustomProcessors.js.map +1 -1
  3. package/dist/cjs/CustomTemplates.js +1 -2
  4. package/dist/cjs/CustomTemplates.js.map +1 -1
  5. package/dist/cjs/Dialog.js +1 -2
  6. package/dist/cjs/Dialog.js.map +1 -1
  7. package/dist/cjs/Notification.js +1 -2
  8. package/dist/cjs/Notification.js.map +1 -1
  9. package/dist/cjs/handleHttpError.js +2 -0
  10. package/dist/cjs/handleHttpError.js.map +1 -1
  11. package/dist/cjs/history.js +1 -2
  12. package/dist/cjs/history.js.map +1 -1
  13. package/dist/cjs/internal/CustomTemplates/constants.js +4 -8
  14. package/dist/cjs/internal/CustomTemplates/constants.js.map +1 -1
  15. package/dist/cjs/internal/FormRenderer/constants.js +2 -4
  16. package/dist/cjs/internal/FormRenderer/constants.js.map +1 -1
  17. package/dist/cjs/internal/Router.js +5 -7
  18. package/dist/cjs/internal/Router.js.map +1 -1
  19. package/dist/cjs/internal/Runtime.js +3 -6
  20. package/dist/cjs/internal/Runtime.js.map +1 -1
  21. package/dist/cjs/internal/compute/WidgetFunctions.js +2 -4
  22. package/dist/cjs/internal/compute/WidgetFunctions.js.map +1 -1
  23. package/dist/cjs/internal/compute/WidgetI18n.js +1 -2
  24. package/dist/cjs/internal/compute/WidgetI18n.js.map +1 -1
  25. package/dist/cjs/internal/compute/checkIf.js +1 -2
  26. package/dist/cjs/internal/compute/checkIf.js.map +1 -1
  27. package/dist/cjs/internal/compute/getNextStateOfUseBrick.js +1 -2
  28. package/dist/cjs/internal/compute/getNextStateOfUseBrick.js.map +1 -1
  29. package/dist/cjs/internal/devtools.js +3 -6
  30. package/dist/cjs/internal/devtools.js.map +1 -1
  31. package/dist/cjs/internal/enums.js +1 -2
  32. package/dist/cjs/internal/enums.js.map +1 -1
  33. package/dist/cjs/internal/i18n.js +3 -6
  34. package/dist/cjs/internal/i18n.js.map +1 -1
  35. package/dist/cjs/internal/injected.js +1 -2
  36. package/dist/cjs/internal/injected.js.map +1 -1
  37. package/dist/cjs/internal/mediaQuery.js +3 -6
  38. package/dist/cjs/internal/mediaQuery.js.map +1 -1
  39. package/dist/cjs/internal/secret_internals.js +1 -2
  40. package/dist/cjs/internal/secret_internals.js.map +1 -1
  41. package/dist/cjs/internal/test_only.js +1 -2
  42. package/dist/cjs/internal/test_only.js.map +1 -1
  43. package/dist/cjs/setLoginStateCookie.js +20 -0
  44. package/dist/cjs/setLoginStateCookie.js.map +1 -0
  45. package/dist/cjs/setUIClassName.js +22 -0
  46. package/dist/cjs/setUIClassName.js.map +1 -0
  47. package/dist/esm/handleHttpError.js +2 -0
  48. package/dist/esm/handleHttpError.js.map +1 -1
  49. package/dist/esm/internal/Router.js +5 -7
  50. package/dist/esm/internal/Router.js.map +1 -1
  51. package/dist/esm/internal/Runtime.js.map +1 -1
  52. package/dist/esm/setLoginStateCookie.js +14 -0
  53. package/dist/esm/setLoginStateCookie.js.map +1 -0
  54. package/dist/esm/setUIClassName.js +17 -0
  55. package/dist/esm/setUIClassName.js.map +1 -0
  56. package/dist/types/internal/Runtime.d.ts +0 -1
  57. package/dist/types/setLoginStateCookie.d.ts +2 -0
  58. package/dist/types/setUIClassName.d.ts +1 -0
  59. package/dist/types/tsdoc-metadata.json +1 -1
  60. package/package.json +13 -13
  61. package/dist/cjs/UIPatch.js +0 -22
  62. package/dist/cjs/UIPatch.js.map +0 -1
  63. package/dist/esm/UIPatch.js +0 -24
  64. package/dist/esm/UIPatch.js.map +0 -1
  65. package/dist/types/UIPatch.d.ts +0 -4
@@ -39,6 +39,5 @@ function getCustomProcessorsV2() {
39
39
  }
40
40
 
41
41
  // istanbul ignore next
42
- const customProcessors = getCustomProcessorsV2() || new CustomProcessorRegistry();
43
- exports.customProcessors = customProcessors;
42
+ const customProcessors = exports.customProcessors = getCustomProcessorsV2() || new CustomProcessorRegistry();
44
43
  //# sourceMappingURL=CustomProcessors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomProcessors.js","names":["_getV2RuntimeFromDll","require","CustomProcessorRegistry","registry","Map","define","processorFullName","processorFunc","namespace","processorName","split","pkg","get","set","has","Error","getCustomProcessorsV2","v2Kit","getV2RuntimeFromDll","Object","freeze","getRuntime","registerCustomProcessor","customProcessors","exports"],"sources":["../../src/CustomProcessors.ts"],"sourcesContent":["import { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nclass CustomProcessorRegistry {\n readonly #registry = new Map<string, Map<string, Function>>();\n\n define(processorFullName: string, processorFunc: Function) {\n // `namespace` should be the camelCase of the package name.\n const [namespace, processorName] = processorFullName.split(\".\");\n let pkg = this.#registry.get(namespace);\n if (!pkg) {\n pkg = new Map();\n this.#registry.set(namespace, pkg);\n }\n if (pkg.has(processorName)) {\n // eslint-disable-next-line no-console\n throw new Error(\n `Custom processor of \"${processorFullName}\" already registered`\n );\n }\n pkg.set(processorName, processorFunc);\n }\n\n get(namespace: string) {\n return this.#registry.get(namespace);\n }\n}\n\n// istanbul ignore next\nfunction getCustomProcessorsV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(processorFullName: string, processorFunc: Function) {\n return v2Kit\n .getRuntime()\n .registerCustomProcessor(processorFullName, processorFunc);\n },\n }) as CustomProcessorRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customProcessors =\n getCustomProcessorsV2() || new CustomProcessorRegistry();\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAEA,MAAMC,uBAAuB,CAAC;EACnB,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAAgC,CAAC;EAE7DC,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;IACzD;IACA,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGH,iBAAiB,CAACI,KAAK,CAAC,GAAG,CAAC;IAC/D,IAAIC,GAAG,GAAG,IAAI,CAAC,CAACR,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;IACvC,IAAI,CAACG,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIP,GAAG,CAAC,CAAC;MACf,IAAI,CAAC,CAACD,QAAQ,CAACU,GAAG,CAACL,SAAS,EAAEG,GAAG,CAAC;IACpC;IACA,IAAIA,GAAG,CAACG,GAAG,CAACL,aAAa,CAAC,EAAE;MAC1B;MACA,MAAM,IAAIM,KAAK,CACZ,wBAAuBT,iBAAkB,sBAC5C,CAAC;IACH;IACAK,GAAG,CAACE,GAAG,CAACJ,aAAa,EAAEF,aAAa,CAAC;EACvC;EAEAK,GAAGA,CAACJ,SAAiB,EAAE;IACrB,OAAO,IAAI,CAAC,CAACL,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;EACtC;AACF;;AAEA;AACA,SAASQ,qBAAqBA,CAAA,EAAG;EAC/B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAOE,MAAM,CAACC,MAAM,CAAC;MACnBf,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;QACzD,OAAOU,KAAK,CACTI,UAAU,CAAC,CAAC,CACZC,uBAAuB,CAAChB,iBAAiB,EAAEC,aAAa,CAAC;MAC9D;IACF,CAAC,CAAC;EACJ;AACF;;AAEA;AACO,MAAMgB,gBAAgB,GAC3BP,qBAAqB,CAAC,CAAC,IAAI,IAAId,uBAAuB,CAAC,CAAC;AAACsB,OAAA,CAAAD,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"file":"CustomProcessors.js","names":["_getV2RuntimeFromDll","require","CustomProcessorRegistry","registry","Map","define","processorFullName","processorFunc","namespace","processorName","split","pkg","get","set","has","Error","getCustomProcessorsV2","v2Kit","getV2RuntimeFromDll","Object","freeze","getRuntime","registerCustomProcessor","customProcessors","exports"],"sources":["../../src/CustomProcessors.ts"],"sourcesContent":["import { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nclass CustomProcessorRegistry {\n readonly #registry = new Map<string, Map<string, Function>>();\n\n define(processorFullName: string, processorFunc: Function) {\n // `namespace` should be the camelCase of the package name.\n const [namespace, processorName] = processorFullName.split(\".\");\n let pkg = this.#registry.get(namespace);\n if (!pkg) {\n pkg = new Map();\n this.#registry.set(namespace, pkg);\n }\n if (pkg.has(processorName)) {\n // eslint-disable-next-line no-console\n throw new Error(\n `Custom processor of \"${processorFullName}\" already registered`\n );\n }\n pkg.set(processorName, processorFunc);\n }\n\n get(namespace: string) {\n return this.#registry.get(namespace);\n }\n}\n\n// istanbul ignore next\nfunction getCustomProcessorsV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(processorFullName: string, processorFunc: Function) {\n return v2Kit\n .getRuntime()\n .registerCustomProcessor(processorFullName, processorFunc);\n },\n }) as CustomProcessorRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customProcessors =\n getCustomProcessorsV2() || new CustomProcessorRegistry();\n"],"mappings":";;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AAEA,MAAMC,uBAAuB,CAAC;EACnB,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAAgC,CAAC;EAE7DC,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;IACzD;IACA,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGH,iBAAiB,CAACI,KAAK,CAAC,GAAG,CAAC;IAC/D,IAAIC,GAAG,GAAG,IAAI,CAAC,CAACR,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;IACvC,IAAI,CAACG,GAAG,EAAE;MACRA,GAAG,GAAG,IAAIP,GAAG,CAAC,CAAC;MACf,IAAI,CAAC,CAACD,QAAQ,CAACU,GAAG,CAACL,SAAS,EAAEG,GAAG,CAAC;IACpC;IACA,IAAIA,GAAG,CAACG,GAAG,CAACL,aAAa,CAAC,EAAE;MAC1B;MACA,MAAM,IAAIM,KAAK,CACZ,wBAAuBT,iBAAkB,sBAC5C,CAAC;IACH;IACAK,GAAG,CAACE,GAAG,CAACJ,aAAa,EAAEF,aAAa,CAAC;EACvC;EAEAK,GAAGA,CAACJ,SAAiB,EAAE;IACrB,OAAO,IAAI,CAAC,CAACL,QAAQ,CAACS,GAAG,CAACJ,SAAS,CAAC;EACtC;AACF;;AAEA;AACA,SAASQ,qBAAqBA,CAAA,EAAG;EAC/B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAOE,MAAM,CAACC,MAAM,CAAC;MACnBf,MAAMA,CAACC,iBAAyB,EAAEC,aAAuB,EAAE;QACzD,OAAOU,KAAK,CACTI,UAAU,CAAC,CAAC,CACZC,uBAAuB,CAAChB,iBAAiB,EAAEC,aAAa,CAAC;MAC9D;IACF,CAAC,CAAC;EACJ;AACF;;AAEA;AACO,MAAMgB,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAC3BP,qBAAqB,CAAC,CAAC,IAAI,IAAId,uBAAuB,CAAC,CAAC"}
@@ -197,6 +197,5 @@ function getCustomTemplatesV2() {
197
197
  }
198
198
 
199
199
  // istanbul ignore next
200
- const customTemplates = getCustomTemplatesV2() || new CustomTemplateRegistry();
201
- exports.customTemplates = customTemplates;
200
+ const customTemplates = exports.customTemplates = getCustomTemplatesV2() || new CustomTemplateRegistry();
202
201
  //# sourceMappingURL=CustomTemplates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTemplates.js","names":["_lodash","require","_isStrictMode","_getV2RuntimeFromDll","allowedNativeProps","Set","CustomTemplateRegistry","registry","Map","define","tagName","constructor","_constructor$proxy$pr","_constructor$proxy","_compatibleConstructo","_compatibleConstructo2","registered","has","console","warn","customElements","get","strict","isStrictMode","proxyProperties","proxy","properties","validProxyProps","legacyTplVariables","key","value","Object","entries","asVariable","warnAboutStrictMode","push","mergeProperty","refTransform","error","ref","compatibleConstructor","fromEntries","state","map","item","expose","concat","tpl","name","set","exposedStates","getExposedStates","proxyMethods","methods","props","entry","nativeProps","filter","prop","HTMLElement","prototype","length","Error","p","join","TplElement","$$typeof","_dev_only_definedProperties","_dev_only_definedMethods","$$getElementByRef","_this$$$tplStateStore","$$tplStateStore","hostBrick","tplHostMetadata","internalBricksByRef","element","connectedCallback","shadowRoot","attachShadow","mode","fragment","document","createDocumentFragment","style","createElement","textContent","slot","appendChild","disconnectedCallback","propName","some","defineProperty","getValue","_this$$$tplStateStore2","updateValue","enumerable","from","to","_to$refProperty","refProperty","_this$$$getElementByR","call","_to$refProperty2","args","_to$refMethod","refMethod","_state$filter$map","uniq","getCustomTemplatesV2","v2Kit","getV2RuntimeFromDll","freeze","getRuntime","registerCustomTemplate","customTemplates","exports"],"sources":["../../src/CustomTemplates.ts"],"sourcesContent":["import type {\n ContextConf,\n CustomTemplate,\n CustomTemplateConstructor,\n CustomTemplateProxyBasicProperty,\n} from \"@next-core/types\";\nimport { uniq } from \"lodash\";\nimport type { RuntimeBrickElement } from \"./internal/interfaces.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"./isStrictMode.js\";\nimport { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\n// Note: `prefix` is a native prop on Element, but it's only used in XML documents.\nconst allowedNativeProps = new Set([\"prefix\"]);\n\ninterface LegacyTplPropProxy extends CustomTemplateProxyBasicProperty {\n asVariable?: boolean;\n mergeProperty?: unknown;\n refTransform?: unknown;\n}\n\nclass CustomTemplateRegistry {\n readonly #registry = new Map<string, CustomTemplate>();\n\n define(tagName: string, constructor: CustomTemplateConstructor): void {\n let registered = this.#registry.has(tagName);\n if (registered) {\n // When open launchpad, the storyboard will be updated.\n // However, we can't *undefine* a custom element.\n // Just ignore re-registering custom templates.\n // eslint-disable-next-line no-console\n console.warn(`Custom template of \"${tagName}\" already registered.`);\n } else {\n registered = !!customElements.get(tagName);\n if (registered) {\n // eslint-disable-next-line no-console\n console.warn(\n `Custom template of \"${tagName}\" already defined by customElements.`\n );\n }\n }\n\n // Transform legacy `proxy.properties[].asVariable` as states.\n const strict = isStrictMode();\n const proxyProperties = (constructor.proxy?.properties ?? {}) as {\n [name: string]: LegacyTplPropProxy;\n };\n const validProxyProps: [string, CustomTemplateProxyBasicProperty][] = [];\n const legacyTplVariables: string[] = [];\n for (const [key, value] of Object.entries(proxyProperties)) {\n if (value.asVariable) {\n warnAboutStrictMode(strict, \"Template `asVariable`\", tagName, key);\n // istanbul ignore next\n if (!strict) {\n // For existed TPL usage, treat it as a STATE.\n legacyTplVariables.push(key);\n }\n } else if (value.mergeProperty || value.refTransform) {\n // eslint-disable-next-line no-console\n console.error(\n \"Template `mergeProperty` and `refTransform` are dropped in v3:\",\n tagName,\n key\n );\n } else if (value.ref) {\n validProxyProps.push([key, value]);\n }\n // Else: documentation only, for exposed states.\n }\n\n const compatibleConstructor = {\n ...constructor,\n proxy: {\n ...constructor.proxy,\n properties: Object.fromEntries(validProxyProps),\n },\n state: (constructor.state\n ? strict\n ? constructor.state\n : constructor.state.map((item) => ({\n // Make `expose` defaults to true in non-strict mode.\n expose: true,\n ...item,\n }))\n : []\n ).concat(legacyTplVariables.map((tpl) => ({ name: tpl, expose: true }))),\n };\n\n // Now we allow re-register custom template\n this.#registry.set(tagName, {\n ...compatibleConstructor,\n name: tagName,\n });\n\n const exposedStates = getExposedStates(compatibleConstructor.state);\n const proxyMethods = Object.entries(\n compatibleConstructor.proxy?.methods ?? {}\n );\n\n const props = exposedStates.concat(\n validProxyProps.map((entry) => entry[0])\n );\n const methods = proxyMethods.map((entry) => entry[0]);\n\n const nativeProps = props\n .concat(methods)\n .filter(\n (prop) => prop in HTMLElement.prototype && !allowedNativeProps.has(prop)\n );\n if (nativeProps.length > 0) {\n warnAboutStrictMode(\n strict,\n \"Using native HTMLElement properties as template properties or methods\",\n tagName,\n ...nativeProps\n );\n // istanbul ignore next\n if (strict) {\n throw new Error(\n `In custom template \"${tagName}\", ${nativeProps\n .map((p) => `\"${p}\"`)\n .join(\n \", \"\n )} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`\n );\n }\n }\n\n if (registered) {\n return;\n }\n\n class TplElement extends HTMLElement {\n get $$typeof() {\n return \"custom-template\" as const;\n }\n\n static get _dev_only_definedProperties(): string[] {\n return props;\n }\n\n static get _dev_only_definedMethods(): string[] {\n return methods;\n }\n\n $$getElementByRef(this: RuntimeBrickElement, ref: string) {\n return this.$$tplStateStore?.hostBrick?.tplHostMetadata?.internalBricksByRef.get(\n ref\n )?.element;\n }\n\n connectedCallback() {\n let shadowRoot = this.shadowRoot;\n if (!shadowRoot) {\n shadowRoot = this.attachShadow({ mode: \"open\" });\n }\n const fragment = document.createDocumentFragment();\n const style = document.createElement(\"style\");\n style.textContent = \":host{display:block}:host([hidden]){display:none}\";\n const slot = document.createElement(\"slot\");\n fragment.appendChild(style);\n fragment.appendChild(slot);\n shadowRoot.appendChild(fragment);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) {\n this.shadowRoot.textContent = \"\";\n }\n }\n }\n\n for (const propName of exposedStates) {\n if (validProxyProps.some((entry) => entry[0] === propName)) {\n // eslint-disable-next-line no-console\n console.error(\n `Cannot define an exposed state that is also a proxy property: \"${propName}\" in ${tagName}`\n );\n continue;\n }\n Object.defineProperty(TplElement.prototype, propName, {\n get(this: RuntimeBrickElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.$$tplStateStore!.getValue(propName);\n },\n set(this: RuntimeBrickElement, value: unknown) {\n // 在 mount 过程中,先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,\n // 避免初始化的一次 state update 操作及其 onChange 事件。\n this.$$tplStateStore?.updateValue(propName, value, \"replace\");\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of validProxyProps) {\n Object.defineProperty(TplElement.prototype, from, {\n get(this: TplElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n unknown\n >;\n return element[to.refProperty ?? from];\n },\n set(this: TplElement, value: unknown) {\n // 同上 exposedState.set\n const element = this.$$getElementByRef?.(to.ref) as unknown as Record<\n string,\n unknown\n >;\n if (element) {\n element[to.refProperty ?? from] = value;\n }\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of proxyMethods) {\n Object.defineProperty(TplElement.prototype, from, {\n value(this: TplElement, ...args: unknown[]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n Function\n >;\n element[to.refMethod ?? from](...args);\n },\n enumerable: true,\n });\n }\n\n customElements.define(tagName, TplElement);\n }\n\n get(tagName: string) {\n return this.#registry.get(tagName);\n }\n}\n\nfunction getExposedStates(state: ContextConf[] | undefined): string[] {\n // Allow duplicated state names which maybe mutually exclusive.\n return uniq(\n state?.filter((item) => item.expose).map((item) => item.name) ?? []\n );\n}\n\n// istanbul ignore next\nfunction getCustomTemplatesV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(tagName: string, constructor: CustomTemplateConstructor) {\n return v2Kit.getRuntime().registerCustomTemplate(tagName, constructor);\n },\n }) as CustomTemplateRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customTemplates =\n getCustomTemplatesV2() || new CustomTemplateRegistry();\n"],"mappings":";;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,kBAAkB,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AAQ9C,MAAMC,sBAAsB,CAAC;EAClB,CAACC,QAAQ,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAEtDC,MAAMA,CAACC,OAAe,EAAEC,WAAsC,EAAQ;IAAA,IAAAC,qBAAA,EAAAC,kBAAA,EAAAC,qBA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,SAAS,cAAAD,aAAA,cAAAA,aAAA,GAAIR,IAAI,CAAC,CAAC,GAAGO,IAAI,CAAC;QACxC,CAAC;QACDR,UAAU,EAAE;MACd,CAAC,CAAC;IACJ;IAEA3E,cAAc,CAACX,MAAM,CAACC,OAAO,EAAEuD,UAAU,CAAC;EAC5C;EAEA5C,GAAGA,CAACX,OAAe,EAAE;IACnB,OAAO,IAAI,CAAC,CAACH,QAAQ,CAACc,GAAG,CAACX,OAAO,CAAC;EACpC;AACF;AAEA,SAASyC,gBAAgBA,CAACT,KAAgC,EAAY;EAAA,IAAAgE,iBAAA;EACpE;EACA,OAAO,IAAAC,YAAI,GAAAD,iBAAA,GACThE,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEe,MAAM,CAAEb,IAAI,IAAKA,IAAI,CAACC,MAAM,CAAC,CAACF,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACI,IAAI,CAAC,cAAA0D,iBAAA,cAAAA,iBAAA,GAAI,EACnE,CAAC;AACH;;AAEA;AACA,SAASE,oBAAoBA,CAAA,EAAG;EAC9B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAO9E,MAAM,CAACgF,MAAM,CAAC;MACnBtG,MAAMA,CAACC,OAAe,EAAEC,WAAsC,EAAE;QAC9D,OAAOkG,KAAK,CAACG,UAAU,CAAC,CAAC,CAACC,sBAAsB,CAACvG,OAAO,EAAEC,WAAW,CAAC;MACxE;IACF,CAAC,CAAC;EACJ;AACF;;AAEA;AACO,MAAMuG,eAAe,GAC1BN,oBAAoB,CAAC,CAAC,IAAI,IAAItG,sBAAsB,CAAC,CAAC;AAAC6G,OAAA,CAAAD,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"file":"CustomTemplates.js","names":["_lodash","require","_isStrictMode","_getV2RuntimeFromDll","allowedNativeProps","Set","CustomTemplateRegistry","registry","Map","define","tagName","constructor","_constructor$proxy$pr","_constructor$proxy","_compatibleConstructo","_compatibleConstructo2","registered","has","console","warn","customElements","get","strict","isStrictMode","proxyProperties","proxy","properties","validProxyProps","legacyTplVariables","key","value","Object","entries","asVariable","warnAboutStrictMode","push","mergeProperty","refTransform","error","ref","compatibleConstructor","fromEntries","state","map","item","expose","concat","tpl","name","set","exposedStates","getExposedStates","proxyMethods","methods","props","entry","nativeProps","filter","prop","HTMLElement","prototype","length","Error","p","join","TplElement","$$typeof","_dev_only_definedProperties","_dev_only_definedMethods","$$getElementByRef","_this$$$tplStateStore","$$tplStateStore","hostBrick","tplHostMetadata","internalBricksByRef","element","connectedCallback","shadowRoot","attachShadow","mode","fragment","document","createDocumentFragment","style","createElement","textContent","slot","appendChild","disconnectedCallback","propName","some","defineProperty","getValue","_this$$$tplStateStore2","updateValue","enumerable","from","to","_to$refProperty","refProperty","_this$$$getElementByR","call","_to$refProperty2","args","_to$refMethod","refMethod","_state$filter$map","uniq","getCustomTemplatesV2","v2Kit","getV2RuntimeFromDll","freeze","getRuntime","registerCustomTemplate","customTemplates","exports"],"sources":["../../src/CustomTemplates.ts"],"sourcesContent":["import type {\n ContextConf,\n CustomTemplate,\n CustomTemplateConstructor,\n CustomTemplateProxyBasicProperty,\n} from \"@next-core/types\";\nimport { uniq } from \"lodash\";\nimport type { RuntimeBrickElement } from \"./internal/interfaces.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"./isStrictMode.js\";\nimport { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\n// Note: `prefix` is a native prop on Element, but it's only used in XML documents.\nconst allowedNativeProps = new Set([\"prefix\"]);\n\ninterface LegacyTplPropProxy extends CustomTemplateProxyBasicProperty {\n asVariable?: boolean;\n mergeProperty?: unknown;\n refTransform?: unknown;\n}\n\nclass CustomTemplateRegistry {\n readonly #registry = new Map<string, CustomTemplate>();\n\n define(tagName: string, constructor: CustomTemplateConstructor): void {\n let registered = this.#registry.has(tagName);\n if (registered) {\n // When open launchpad, the storyboard will be updated.\n // However, we can't *undefine* a custom element.\n // Just ignore re-registering custom templates.\n // eslint-disable-next-line no-console\n console.warn(`Custom template of \"${tagName}\" already registered.`);\n } else {\n registered = !!customElements.get(tagName);\n if (registered) {\n // eslint-disable-next-line no-console\n console.warn(\n `Custom template of \"${tagName}\" already defined by customElements.`\n );\n }\n }\n\n // Transform legacy `proxy.properties[].asVariable` as states.\n const strict = isStrictMode();\n const proxyProperties = (constructor.proxy?.properties ?? {}) as {\n [name: string]: LegacyTplPropProxy;\n };\n const validProxyProps: [string, CustomTemplateProxyBasicProperty][] = [];\n const legacyTplVariables: string[] = [];\n for (const [key, value] of Object.entries(proxyProperties)) {\n if (value.asVariable) {\n warnAboutStrictMode(strict, \"Template `asVariable`\", tagName, key);\n // istanbul ignore next\n if (!strict) {\n // For existed TPL usage, treat it as a STATE.\n legacyTplVariables.push(key);\n }\n } else if (value.mergeProperty || value.refTransform) {\n // eslint-disable-next-line no-console\n console.error(\n \"Template `mergeProperty` and `refTransform` are dropped in v3:\",\n tagName,\n key\n );\n } else if (value.ref) {\n validProxyProps.push([key, value]);\n }\n // Else: documentation only, for exposed states.\n }\n\n const compatibleConstructor = {\n ...constructor,\n proxy: {\n ...constructor.proxy,\n properties: Object.fromEntries(validProxyProps),\n },\n state: (constructor.state\n ? strict\n ? constructor.state\n : constructor.state.map((item) => ({\n // Make `expose` defaults to true in non-strict mode.\n expose: true,\n ...item,\n }))\n : []\n ).concat(legacyTplVariables.map((tpl) => ({ name: tpl, expose: true }))),\n };\n\n // Now we allow re-register custom template\n this.#registry.set(tagName, {\n ...compatibleConstructor,\n name: tagName,\n });\n\n const exposedStates = getExposedStates(compatibleConstructor.state);\n const proxyMethods = Object.entries(\n compatibleConstructor.proxy?.methods ?? {}\n );\n\n const props = exposedStates.concat(\n validProxyProps.map((entry) => entry[0])\n );\n const methods = proxyMethods.map((entry) => entry[0]);\n\n const nativeProps = props\n .concat(methods)\n .filter(\n (prop) => prop in HTMLElement.prototype && !allowedNativeProps.has(prop)\n );\n if (nativeProps.length > 0) {\n warnAboutStrictMode(\n strict,\n \"Using native HTMLElement properties as template properties or methods\",\n tagName,\n ...nativeProps\n );\n // istanbul ignore next\n if (strict) {\n throw new Error(\n `In custom template \"${tagName}\", ${nativeProps\n .map((p) => `\"${p}\"`)\n .join(\n \", \"\n )} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`\n );\n }\n }\n\n if (registered) {\n return;\n }\n\n class TplElement extends HTMLElement {\n get $$typeof() {\n return \"custom-template\" as const;\n }\n\n static get _dev_only_definedProperties(): string[] {\n return props;\n }\n\n static get _dev_only_definedMethods(): string[] {\n return methods;\n }\n\n $$getElementByRef(this: RuntimeBrickElement, ref: string) {\n return this.$$tplStateStore?.hostBrick?.tplHostMetadata?.internalBricksByRef.get(\n ref\n )?.element;\n }\n\n connectedCallback() {\n let shadowRoot = this.shadowRoot;\n if (!shadowRoot) {\n shadowRoot = this.attachShadow({ mode: \"open\" });\n }\n const fragment = document.createDocumentFragment();\n const style = document.createElement(\"style\");\n style.textContent = \":host{display:block}:host([hidden]){display:none}\";\n const slot = document.createElement(\"slot\");\n fragment.appendChild(style);\n fragment.appendChild(slot);\n shadowRoot.appendChild(fragment);\n }\n\n disconnectedCallback() {\n if (this.shadowRoot) {\n this.shadowRoot.textContent = \"\";\n }\n }\n }\n\n for (const propName of exposedStates) {\n if (validProxyProps.some((entry) => entry[0] === propName)) {\n // eslint-disable-next-line no-console\n console.error(\n `Cannot define an exposed state that is also a proxy property: \"${propName}\" in ${tagName}`\n );\n continue;\n }\n Object.defineProperty(TplElement.prototype, propName, {\n get(this: RuntimeBrickElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.$$tplStateStore!.getValue(propName);\n },\n set(this: RuntimeBrickElement, value: unknown) {\n // 在 mount 过程中,先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,\n // 避免初始化的一次 state update 操作及其 onChange 事件。\n this.$$tplStateStore?.updateValue(propName, value, \"replace\");\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of validProxyProps) {\n Object.defineProperty(TplElement.prototype, from, {\n get(this: TplElement) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n unknown\n >;\n return element[to.refProperty ?? from];\n },\n set(this: TplElement, value: unknown) {\n // 同上 exposedState.set\n const element = this.$$getElementByRef?.(to.ref) as unknown as Record<\n string,\n unknown\n >;\n if (element) {\n element[to.refProperty ?? from] = value;\n }\n },\n enumerable: true,\n });\n }\n\n for (const [from, to] of proxyMethods) {\n Object.defineProperty(TplElement.prototype, from, {\n value(this: TplElement, ...args: unknown[]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const element = this.$$getElementByRef!(to.ref) as unknown as Record<\n string,\n Function\n >;\n element[to.refMethod ?? from](...args);\n },\n enumerable: true,\n });\n }\n\n customElements.define(tagName, TplElement);\n }\n\n get(tagName: string) {\n return this.#registry.get(tagName);\n }\n}\n\nfunction getExposedStates(state: ContextConf[] | undefined): string[] {\n // Allow duplicated state names which maybe mutually exclusive.\n return uniq(\n state?.filter((item) => item.expose).map((item) => item.name) ?? []\n );\n}\n\n// istanbul ignore next\nfunction getCustomTemplatesV2() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return Object.freeze({\n define(tagName: string, constructor: CustomTemplateConstructor) {\n return v2Kit.getRuntime().registerCustomTemplate(tagName, constructor);\n },\n }) as CustomTemplateRegistry;\n }\n}\n\n// istanbul ignore next\nexport const customTemplates =\n getCustomTemplatesV2() || new CustomTemplateRegistry();\n"],"mappings":";;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,kBAAkB,GAAG,IAAIC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AAQ9C,MAAMC,sBAAsB,CAAC;EAClB,CAACC,QAAQ,GAAG,IAAIC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  console.error("Load dialog service failed:", error);
37
37
  });
38
38
  }
39
- const Dialog = Object.freeze({
39
+ const Dialog = exports.Dialog = Object.freeze({
40
40
  show
41
41
  });
42
- exports.Dialog = Dialog;
43
42
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":["brick","show","options","resolve","type","confirm","content","Promise","setTimeout","reject","alert","loadDialogService","tagName","loader","then","document","createElement","error","console","Dialog","Object","freeze","exports"],"sources":["../../src/Dialog.ts"],"sourcesContent":["let brick: {\n resolve(options: DialogOptions): Promise<void>;\n};\n\nfunction show(options: DialogOptions): Promise<void> {\n if (brick) {\n return brick.resolve(options);\n } else {\n if (options.type === \"confirm\") {\n if (confirm(options.content)) {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1)\n );\n } else {\n return new Promise((resolve, reject) =>\n setTimeout(() => {\n reject();\n }, 1)\n );\n }\n } else {\n alert(options.content);\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000)\n );\n }\n }\n}\n\nexport function loadDialogService(\n tagName: string,\n loader: (bricks: string[]) => Promise<void>\n) {\n loader([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load dialog service failed:\", error);\n }\n );\n}\n\nexport interface DialogOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\" | \"confirm\";\n title?: string | null;\n content: string;\n contentStyle?: object;\n}\n\nexport const Dialog = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAIA,KAEH;AAED,SAASC,IAAIA,CAACC,OAAsB,EAAiB;EACnD,IAAIF,KAAK,EAAE;IACT,OAAOA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EAC/B,CAAC,MAAM;IACL,IAAIA,OAAO,CAACE,IAAI,KAAK,SAAS,EAAE;MAC9B,IAAIC,OAAO,CAACH,OAAO,CAACI,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;UACfL,OAAO,CAAC,CAAC;QACX,CAAC,EAAE,CAAC,CACN,CAAC;MACH,CAAC,MAAM;QACL,OAAO,IAAII,OAAO,CAAC,CAACJ,OAAO,EAAEM,MAAM,KACjCD,UAAU,CAAC,MAAM;UACfC,MAAM,CAAC,CAAC;QACV,CAAC,EAAE,CAAC,CACN,CAAC;MACH;IACF,CAAC,MAAM;MACLC,KAAK,CAACR,OAAO,CAACI,OAAO,CAAC;MACtB,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;QACfL,OAAO,CAAC,CAAC;MACX,CAAC,EAAE,IAAI,CACT,CAAC;IACH;EACF;AACF;AAEO,SAASQ,iBAAiBA,CAC/BC,OAAe,EACfC,MAA2C,EAC3C;EACAA,MAAM,CAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpB,MAAM;IACJd,KAAK,GAAGe,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;EACrD,CACF,CAAC;AACH;AASO,MAAME,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;EAClCpB;AACF,CAAC,CAAC;AAACqB,OAAA,CAAAH,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"file":"Dialog.js","names":["brick","show","options","resolve","type","confirm","content","Promise","setTimeout","reject","alert","loadDialogService","tagName","loader","then","document","createElement","error","console","Dialog","exports","Object","freeze"],"sources":["../../src/Dialog.ts"],"sourcesContent":["let brick: {\n resolve(options: DialogOptions): Promise<void>;\n};\n\nfunction show(options: DialogOptions): Promise<void> {\n if (brick) {\n return brick.resolve(options);\n } else {\n if (options.type === \"confirm\") {\n if (confirm(options.content)) {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1)\n );\n } else {\n return new Promise((resolve, reject) =>\n setTimeout(() => {\n reject();\n }, 1)\n );\n }\n } else {\n alert(options.content);\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000)\n );\n }\n }\n}\n\nexport function loadDialogService(\n tagName: string,\n loader: (bricks: string[]) => Promise<void>\n) {\n loader([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load dialog service failed:\", error);\n }\n );\n}\n\nexport interface DialogOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\" | \"confirm\";\n title?: string | null;\n content: string;\n contentStyle?: object;\n}\n\nexport const Dialog = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAIA,KAEH;AAED,SAASC,IAAIA,CAACC,OAAsB,EAAiB;EACnD,IAAIF,KAAK,EAAE;IACT,OAAOA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EAC/B,CAAC,MAAM;IACL,IAAIA,OAAO,CAACE,IAAI,KAAK,SAAS,EAAE;MAC9B,IAAIC,OAAO,CAACH,OAAO,CAACI,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;UACfL,OAAO,CAAC,CAAC;QACX,CAAC,EAAE,CAAC,CACN,CAAC;MACH,CAAC,MAAM;QACL,OAAO,IAAII,OAAO,CAAC,CAACJ,OAAO,EAAEM,MAAM,KACjCD,UAAU,CAAC,MAAM;UACfC,MAAM,CAAC,CAAC;QACV,CAAC,EAAE,CAAC,CACN,CAAC;MACH;IACF,CAAC,MAAM;MACLC,KAAK,CAACR,OAAO,CAACI,OAAO,CAAC;MACtB,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;QACfL,OAAO,CAAC,CAAC;MACX,CAAC,EAAE,IAAI,CACT,CAAC;IACH;EACF;AACF;AAEO,SAASQ,iBAAiBA,CAC/BC,OAAe,EACfC,MAA2C,EAC3C;EACAA,MAAM,CAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpB,MAAM;IACJd,KAAK,GAAGe,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;EACrD,CACF,CAAC;AACH;AASO,MAAME,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAGE,MAAM,CAACC,MAAM,CAAC;EAClCrB;AACF,CAAC,CAAC"}
@@ -21,8 +21,7 @@ function loadNotificationService(tagName, loader) {
21
21
  console.error("Load notification service failed:", error);
22
22
  });
23
23
  }
24
- const Notification = Object.freeze({
24
+ const Notification = exports.Notification = Object.freeze({
25
25
  show
26
26
  });
27
- exports.Notification = Notification;
28
27
  //# sourceMappingURL=Notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","names":["brick","show","options","resolve","alert","message","loadNotificationService","tagName","loader","then","document","createElement","error","console","Notification","Object","freeze","exports"],"sources":["../../src/Notification.ts"],"sourcesContent":["let brick: {\n resolve(options: NotificationOptions): void;\n};\n\nfunction show(options: NotificationOptions) {\n if (brick) {\n brick.resolve(options);\n } else {\n alert(options.message);\n }\n}\n\nexport function loadNotificationService(\n tagName: string,\n loader: (bricks: string[]) => Promise<void>\n) {\n loader([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load notification service failed:\", error);\n }\n );\n}\n\nexport interface NotificationOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\";\n message: string;\n}\n\nexport const Notification = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAIA,KAEH;AAED,SAASC,IAAIA,CAACC,OAA4B,EAAE;EAC1C,IAAIF,KAAK,EAAE;IACTA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EACxB,CAAC,MAAM;IACLE,KAAK,CAACF,OAAO,CAACG,OAAO,CAAC;EACxB;AACF;AAEO,SAASC,uBAAuBA,CACrCC,OAAe,EACfC,MAA2C,EAC3C;EACAA,MAAM,CAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpB,MAAM;IACJT,KAAK,GAAGU,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;EAC3D,CACF,CAAC;AACH;AAOO,MAAME,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC;EACxCf;AACF,CAAC,CAAC;AAACgB,OAAA,CAAAH,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"file":"Notification.js","names":["brick","show","options","resolve","alert","message","loadNotificationService","tagName","loader","then","document","createElement","error","console","Notification","exports","Object","freeze"],"sources":["../../src/Notification.ts"],"sourcesContent":["let brick: {\n resolve(options: NotificationOptions): void;\n};\n\nfunction show(options: NotificationOptions) {\n if (brick) {\n brick.resolve(options);\n } else {\n alert(options.message);\n }\n}\n\nexport function loadNotificationService(\n tagName: string,\n loader: (bricks: string[]) => Promise<void>\n) {\n loader([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load notification service failed:\", error);\n }\n );\n}\n\nexport interface NotificationOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\";\n message: string;\n}\n\nexport const Notification = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAIA,KAEH;AAED,SAASC,IAAIA,CAACC,OAA4B,EAAE;EAC1C,IAAIF,KAAK,EAAE;IACTA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EACxB,CAAC,MAAM;IACLE,KAAK,CAACF,OAAO,CAACG,OAAO,CAAC;EACxB;AACF;AAEO,SAASC,uBAAuBA,CACrCC,OAAe,EACfC,MAA2C,EAC3C;EACAA,MAAM,CAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpB,MAAM;IACJT,KAAK,GAAGU,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;EAC3D,CACF,CAAC;AACH;AAOO,MAAME,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAGE,MAAM,CAACC,MAAM,CAAC;EACxChB;AACF,CAAC,CAAC"}
@@ -12,6 +12,7 @@ var _Runtime = require("./internal/Runtime.js");
12
12
  var _history = require("./history.js");
13
13
  var _i18n2 = require("./internal/i18n.js");
14
14
  var _Dialog = require("./Dialog.js");
15
+ var _setLoginStateCookie = require("./setLoginStateCookie.js");
15
16
  /**
16
17
  * 将 http 请求错误转换为可读的字符串。
17
18
  *
@@ -100,6 +101,7 @@ function handleHttpError(error) {
100
101
  function redirectToLogin() {
101
102
  const ssoEnabled = (0, _Runtime.getRuntime)().getFeatureFlags()["sso-enabled"];
102
103
  const history = (0, _history.getHistory)();
104
+ (0, _setLoginStateCookie.setLoginStateCookie)(history.location);
103
105
  history.push(ssoEnabled ? "/sso-auth/login" : "/auth/login", {
104
106
  from: {
105
107
  ...history.location,
@@ -1 +1 @@
1
- {"version":3,"file":"handleHttpError.js","names":["_http","require","_i18n","_Runtime","_history","_i18n2","_Dialog","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","push","from","location","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\";\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 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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,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,GA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OAAO;IAC1BR,cAAM,CAACC,IAAI,CAAC;MACVC,IAAI,EAAE,OAAO;MACbO,KAAK,EAAE5B,UAAI,CAACC,CAAC,CAAE,GAAEC,SAAG,IAAGC,QAAC,CAAC0B,cAAe,EAAC,CAAC;MAC1CP,OAAO,EAAEK,OAAO;MAChBG,YAAY,EAAE;QACZC,UAAU,EAAE;MACd;IACF,CAAC,CAAC,CAACP,IAAI,CAAC,MAAM;MACZV,gBAAgB,GAAGkB,SAAS;IAC9B,CAAC,CAAC;EACJ;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;EAC5BD,OAAO,CAACE,IAAI,CAACL,UAAU,GAAG,iBAAiB,GAAG,aAAa,EAAE;IAC3DM,IAAI,EAAE;MACJ,GAAGH,OAAO,CAACI,QAAQ;MACnBC,KAAK,EAAET;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","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,GAA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AAO;IAC1BR,cAAM,CAACC,IAAI,CAAC;MACVC,IAAI,EAAE,OAAO;MACbO,KAAK,EAAE5B,UAAI,CAACC,CAAC,CAAE,GAAEC,SAAG,IAAGC,QAAC,CAAC0B,cAAe,EAAC,CAAC;MAC1CP,OAAO,EAAEK,OAAO;MAChBG,YAAY,EAAE;QACZC,UAAU,EAAE;MACd;IACF,CAAC,CAAC,CAACP,IAAI,CAAC,MAAM;MACZV,gBAAgB,GAAGkB,SAAS;IAC9B,CAAC,CAAC;EACJ;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"}
@@ -35,6 +35,5 @@ function getHistoryV2Factory() {
35
35
  return v2Kit.getHistory;
36
36
  }
37
37
  }
38
- const getHistory = getHistoryV2Factory() || getHistoryV3;
39
- exports.getHistory = getHistory;
38
+ const getHistory = exports.getHistory = getHistoryV2Factory() || getHistoryV3;
40
39
  //# sourceMappingURL=history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","names":["_history","require","_getBasePath","_historyExtended","_getV2RuntimeFromDll","history","createHistory","browserHistory","createBrowserHistory","basename","getBasePath","replace","getUserConfirmation","Object","assign","historyExtended","getHistoryV3","getHistoryV2Factory","v2Kit","getV2RuntimeFromDll","getHistory","exports"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\nimport { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nfunction getHistoryV3(): NextHistory {\n return history;\n}\n\n/**\n * When using v3 bricks in v2 container, return history from v2 container.\n */\nfunction getHistoryV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return v2Kit.getHistory;\n }\n}\n\nexport const getHistory = getHistoryV2Factory() || getHistoryV3;\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAMA,IAAAG,oBAAA,GAAAH,OAAA;AAIA,IAAII,OAAoB;AAEjB,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,MAAME,cAAc,GAAG,IAAAC,6BAAoB,EAAmB;MAC5DC,QAAQ,EAAE,IAAAC,wBAAW,EAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CC,mBAAmB,EAAnBA;IACF,CAAC,CAAC;IACFC,MAAM,CAACC,MAAM,CAACP,cAAc,EAAE,IAAAQ,gCAAe,EAACR,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEA,SAASW,YAAYA,CAAA,EAAgB;EACnC,OAAOX,OAAO;AAChB;;AAEA;AACA;AACA;AACA,SAASY,mBAAmBA,CAAA,EAAG;EAC7B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAOA,KAAK,CAACE,UAAU;EACzB;AACF;AAEO,MAAMA,UAAU,GAAGH,mBAAmB,CAAC,CAAC,IAAID,YAAY;AAACK,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"file":"history.js","names":["_history","require","_getBasePath","_historyExtended","_getV2RuntimeFromDll","history","createHistory","browserHistory","createBrowserHistory","basename","getBasePath","replace","getUserConfirmation","Object","assign","historyExtended","getHistoryV3","getHistoryV2Factory","v2Kit","getV2RuntimeFromDll","getHistory","exports"],"sources":["../../src/history.ts"],"sourcesContent":["import { History, Location, createBrowserHistory } from \"history\";\nimport { getBasePath } from \"./getBasePath.js\";\nimport {\n type ExtendedHistory,\n getUserConfirmation,\n historyExtended,\n NextHistoryState,\n} from \"./internal/historyExtended.js\";\nimport { getV2RuntimeFromDll } from \"./getV2RuntimeFromDll.js\";\n\nexport type NextHistory = History<NextHistoryState> & ExtendedHistory;\n\nlet history: NextHistory;\n\nexport function createHistory(): NextHistory {\n if (!history) {\n // https://github.com/remix-run/history/issues/810\n const browserHistory = createBrowserHistory<NextHistoryState>({\n basename: getBasePath().replace(/\\/$/, \"\"),\n getUserConfirmation,\n });\n Object.assign(browserHistory, historyExtended(browserHistory));\n history = browserHistory as NextHistory;\n }\n return history;\n}\n\nfunction getHistoryV3(): NextHistory {\n return history;\n}\n\n/**\n * When using v3 bricks in v2 container, return history from v2 container.\n */\nfunction getHistoryV2Factory() {\n const v2Kit = getV2RuntimeFromDll();\n if (v2Kit) {\n return v2Kit.getHistory;\n }\n}\n\nexport const getHistory = getHistoryV2Factory() || getHistoryV3;\n\nexport type NextLocation = Location<NextHistoryState>;\n\nexport type { NextHistoryState };\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAMA,IAAAG,oBAAA,GAAAH,OAAA;AAIA,IAAII,OAAoB;AAEjB,SAASC,aAAaA,CAAA,EAAgB;EAC3C,IAAI,CAACD,OAAO,EAAE;IACZ;IACA,MAAME,cAAc,GAAG,IAAAC,6BAAoB,EAAmB;MAC5DC,QAAQ,EAAE,IAAAC,wBAAW,EAAC,CAAC,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;MAC1CC,mBAAmB,EAAnBA;IACF,CAAC,CAAC;IACFC,MAAM,CAACC,MAAM,CAACP,cAAc,EAAE,IAAAQ,gCAAe,EAACR,cAAc,CAAC,CAAC;IAC9DF,OAAO,GAAGE,cAA6B;EACzC;EACA,OAAOF,OAAO;AAChB;AAEA,SAASW,YAAYA,CAAA,EAAgB;EACnC,OAAOX,OAAO;AAChB;;AAEA;AACA;AACA;AACA,SAASY,mBAAmBA,CAAA,EAAG;EAC7B,MAAMC,KAAK,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACnC,IAAID,KAAK,EAAE;IACT,OAAOA,KAAK,CAACE,UAAU;EACzB;AACF;AAEO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAGH,mBAAmB,CAAC,CAAC,IAAID,YAAY"}
@@ -4,12 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.symbolForTplStateStoreId = exports.symbolForTPlExternalForEachItem = exports.symbolForTPlExternalForEachIndex = exports.symbolForAsyncComputedPropsFromHost = void 0;
7
- const symbolForAsyncComputedPropsFromHost = Symbol.for("tpl.asyncComputedPropsFromHost");
8
- exports.symbolForAsyncComputedPropsFromHost = symbolForAsyncComputedPropsFromHost;
9
- const symbolForTplStateStoreId = Symbol.for("tpl.stateStoreId");
10
- exports.symbolForTplStateStoreId = symbolForTplStateStoreId;
11
- const symbolForTPlExternalForEachItem = Symbol.for("tpl.externalForEachItem");
12
- exports.symbolForTPlExternalForEachItem = symbolForTPlExternalForEachItem;
13
- const symbolForTPlExternalForEachIndex = Symbol.for("tpl.externalForEachIndex");
14
- exports.symbolForTPlExternalForEachIndex = symbolForTPlExternalForEachIndex;
7
+ const symbolForAsyncComputedPropsFromHost = exports.symbolForAsyncComputedPropsFromHost = Symbol.for("tpl.asyncComputedPropsFromHost");
8
+ const symbolForTplStateStoreId = exports.symbolForTplStateStoreId = Symbol.for("tpl.stateStoreId");
9
+ const symbolForTPlExternalForEachItem = exports.symbolForTPlExternalForEachItem = Symbol.for("tpl.externalForEachItem");
10
+ const symbolForTPlExternalForEachIndex = exports.symbolForTPlExternalForEachIndex = Symbol.for("tpl.externalForEachIndex");
15
11
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["symbolForAsyncComputedPropsFromHost","Symbol","for","exports","symbolForTplStateStoreId","symbolForTPlExternalForEachItem","symbolForTPlExternalForEachIndex"],"sources":["../../../../src/internal/CustomTemplates/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\nimport type { AsyncPropertyEntry } from \"../interfaces.js\";\n\nexport const symbolForAsyncComputedPropsFromHost = Symbol.for(\n \"tpl.asyncComputedPropsFromHost\"\n);\nexport const symbolForTplStateStoreId = Symbol.for(\"tpl.stateStoreId\");\nexport const symbolForTPlExternalForEachItem = Symbol.for(\n \"tpl.externalForEachItem\"\n);\nexport const symbolForTPlExternalForEachIndex = Symbol.for(\n \"tpl.externalForEachIndex\"\n);\n\nexport type RuntimeBrickConfWithTplSymbols = BrickConf &\n RuntimeBrickConfOfTplSymbols;\n\nexport interface RuntimeBrickConfOfTplSymbols {\n [symbolForAsyncComputedPropsFromHost]?: AsyncPropertyEntry[];\n [symbolForTplStateStoreId]?: string;\n [symbolForTPlExternalForEachItem]?: unknown;\n [symbolForTPlExternalForEachIndex]?: number;\n}\n"],"mappings":";;;;;;AAGO,MAAMA,mCAAmC,GAAGC,MAAM,CAACC,GAAG,CAC3D,gCACF,CAAC;AAACC,OAAA,CAAAH,mCAAA,GAAAA,mCAAA;AACK,MAAMI,wBAAwB,GAAGH,MAAM,CAACC,GAAG,CAAC,kBAAkB,CAAC;AAACC,OAAA,CAAAC,wBAAA,GAAAA,wBAAA;AAChE,MAAMC,+BAA+B,GAAGJ,MAAM,CAACC,GAAG,CACvD,yBACF,CAAC;AAACC,OAAA,CAAAE,+BAAA,GAAAA,+BAAA;AACK,MAAMC,gCAAgC,GAAGL,MAAM,CAACC,GAAG,CACxD,0BACF,CAAC;AAACC,OAAA,CAAAG,gCAAA,GAAAA,gCAAA"}
1
+ {"version":3,"file":"constants.js","names":["symbolForAsyncComputedPropsFromHost","exports","Symbol","for","symbolForTplStateStoreId","symbolForTPlExternalForEachItem","symbolForTPlExternalForEachIndex"],"sources":["../../../../src/internal/CustomTemplates/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\nimport type { AsyncPropertyEntry } from \"../interfaces.js\";\n\nexport const symbolForAsyncComputedPropsFromHost = Symbol.for(\n \"tpl.asyncComputedPropsFromHost\"\n);\nexport const symbolForTplStateStoreId = Symbol.for(\"tpl.stateStoreId\");\nexport const symbolForTPlExternalForEachItem = Symbol.for(\n \"tpl.externalForEachItem\"\n);\nexport const symbolForTPlExternalForEachIndex = Symbol.for(\n \"tpl.externalForEachIndex\"\n);\n\nexport type RuntimeBrickConfWithTplSymbols = BrickConf &\n RuntimeBrickConfOfTplSymbols;\n\nexport interface RuntimeBrickConfOfTplSymbols {\n [symbolForAsyncComputedPropsFromHost]?: AsyncPropertyEntry[];\n [symbolForTplStateStoreId]?: string;\n [symbolForTPlExternalForEachItem]?: unknown;\n [symbolForTPlExternalForEachIndex]?: number;\n}\n"],"mappings":";;;;;;AAGO,MAAMA,mCAAmC,GAAAC,OAAA,CAAAD,mCAAA,GAAGE,MAAM,CAACC,GAAG,CAC3D,gCACF,CAAC;AACM,MAAMC,wBAAwB,GAAAH,OAAA,CAAAG,wBAAA,GAAGF,MAAM,CAACC,GAAG,CAAC,kBAAkB,CAAC;AAC/D,MAAME,+BAA+B,GAAAJ,OAAA,CAAAI,+BAAA,GAAGH,MAAM,CAACC,GAAG,CACvD,yBACF,CAAC;AACM,MAAMG,gCAAgC,GAAAL,OAAA,CAAAK,gCAAA,GAAGJ,MAAM,CAACC,GAAG,CACxD,0BACF,CAAC"}
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.symbolForFormStateStoreId = exports.FORM_RENDERER = void 0;
7
- const FORM_RENDERER = "form-renderer.form-renderer";
8
- exports.FORM_RENDERER = FORM_RENDERER;
9
- const symbolForFormStateStoreId = Symbol.for("form.stateStoreId");
10
- exports.symbolForFormStateStoreId = symbolForFormStateStoreId;
7
+ const FORM_RENDERER = exports.FORM_RENDERER = "form-renderer.form-renderer";
8
+ const symbolForFormStateStoreId = exports.symbolForFormStateStoreId = Symbol.for("form.stateStoreId");
11
9
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["FORM_RENDERER","exports","symbolForFormStateStoreId","Symbol","for"],"sources":["../../../../src/internal/FormRenderer/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\n\nexport const FORM_RENDERER = \"form-renderer.form-renderer\";\nexport const symbolForFormStateStoreId = Symbol.for(\"form.stateStoreId\");\n\nexport type RuntimeBrickConfWithFormSymbols = BrickConf &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface RuntimeBrickConfOfFormSymbols {\n [symbolForFormStateStoreId]?: string;\n}\n"],"mappings":";;;;;;AAEO,MAAMA,aAAa,GAAG,6BAA6B;AAACC,OAAA,CAAAD,aAAA,GAAAA,aAAA;AACpD,MAAME,yBAAyB,GAAGC,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAACH,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"file":"constants.js","names":["FORM_RENDERER","exports","symbolForFormStateStoreId","Symbol","for"],"sources":["../../../../src/internal/FormRenderer/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\n\nexport const FORM_RENDERER = \"form-renderer.form-renderer\";\nexport const symbolForFormStateStoreId = Symbol.for(\"form.stateStoreId\");\n\nexport type RuntimeBrickConfWithFormSymbols = BrickConf &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface RuntimeBrickConfOfFormSymbols {\n [symbolForFormStateStoreId]?: string;\n}\n"],"mappings":";;;;;;AAEO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,6BAA6B;AACnD,MAAME,yBAAyB,GAAAD,OAAA,CAAAC,yBAAA,GAAGC,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC"}
@@ -27,12 +27,13 @@ var _getPageInfo = require("../getPageInfo.js");
27
27
  var _markAsComputed = require("./compute/markAsComputed.js");
28
28
  var _handleHttpError = require("../handleHttpError.js");
29
29
  var _abortController = require("./abortController.js");
30
+ var _setLoginStateCookie = require("../setLoginStateCookie.js");
30
31
  var _registerCustomTemplates = require("./registerCustomTemplates.js");
31
32
  var _fulfilStoryboard = require("./fulfilStoryboard.js");
32
33
  var _enums = require("./enums.js");
33
34
  var _insertPreviewRoutes = require("./insertPreviewRoutes.js");
34
35
  var _devtools = require("./devtools.js");
35
- var _UIPatch = require("../UIPatch.js");
36
+ var _setUIClassName = require("../setUIClassName.js");
36
37
  var _storyboards = /*#__PURE__*/new WeakMap();
37
38
  var _rendering = /*#__PURE__*/new WeakMap();
38
39
  var _prevLocation = /*#__PURE__*/new WeakMap();
@@ -287,6 +288,7 @@ async function _render2(location) {
287
288
  };
288
289
  const redirectToLogin = () => {
289
290
  const to = flags["sso-enabled"] ? "/sso-auth/login" : "/auth/login";
291
+ (0, _setLoginStateCookie.setLoginStateCookie)(location);
290
292
  redirectTo(to, {
291
293
  from: location
292
294
  });
@@ -326,12 +328,9 @@ async function _render2(location) {
326
328
  (0, _themeAndMode.setTheme)(currentApp && ((0, _themeAndMode.getLocalAppsTheme)()[currentApp.id] || currentApp.theme) || "light");
327
329
  (0, _themeAndMode.setMode)("default");
328
330
  if (currentApp) {
329
- var _hooks$checkInstalled, _currentApp$uiVersion, _hooks$auth, _hooks$checkPermissio, _storyboard$meta, _hooks$flowApi2, _storyboard$meta2;
331
+ var _hooks$checkInstalled, _hooks$auth, _hooks$checkPermissio, _storyboard$meta, _hooks$flowApi2, _storyboard$meta2;
330
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));
331
- const {
332
- uiPatch: allowUIPatch
333
- } = (0, _Runtime.getRuntime)().getPreseBricks();
334
- const uiPatch = (0, _UIPatch.loadUIPatch)((_currentApp$uiVersion = currentApp.uiVersion) !== null && _currentApp$uiVersion !== void 0 ? _currentApp$uiVersion : "8.0", allowUIPatch);
333
+ (0, _setUIClassName.setUIClassName)(currentApp === null || currentApp === void 0 ? void 0 : currentApp.uiVersion);
335
334
  const routeHelper = {
336
335
  bailout: output => {
337
336
  if (output.unauthenticated) {
@@ -415,7 +414,6 @@ async function _render2(location) {
415
414
  if (routeHelper.bailout(output)) {
416
415
  return;
417
416
  }
418
- output.blockingList.push(uiPatch);
419
417
  stores = (0, _Renderer.getDataStores)(runtimeContext);
420
418
  await (0, _Renderer.postAsyncRender)(output, runtimeContext, stores);
421
419
  await routeHelper.mergeMenus(output.menuRequests);
@@ -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","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_devtools","_UIPatch","_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","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","_currentApp$uiVersion","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","appId","_internalApiGetAppInBootstrapData","uiPatch","allowUIPatch","getPreseBricks","loadUIPatch","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","push","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"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type { RenderBrick, RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\nimport { devtoolsHookEmit } from \"./devtools.js\";\nimport { loadUIPatch } from \"../UIPatch.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 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 { uiPatch: allowUIPatch } = getRuntime().getPreseBricks();\n\n const uiPatch = loadUIPatch(currentApp.uiVersion ?? \"8.0\", allowUIPatch);\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 output.blockingList.push(uiPatch);\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,wBAAA,GAAAjB,OAAA;AACA,IAAAkB,iBAAA,GAAAlB,OAAA;AACA,IAAAmB,MAAA,GAAAnB,OAAA;AACA,IAAAoB,oBAAA,GAAApB,OAAA;AACA,IAAAqB,SAAA,GAAArB,OAAA;AACA,IAAAsB,QAAA,GAAAtB,OAAA;AAA4C,IAAAuB,YAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,aAAA,oBAAAF,OAAA;AAAA,IAAAG,aAAA,oBAAAH,OAAA;AAAA,IAAAI,eAAA,oBAAAJ,OAAA;AAAA,IAAAK,gBAAA,oBAA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;EAErB;EACAlG,MAAM,CAAC6M,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;EACrB9H,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAG;IAAEY,MAAM,EAAE;EAAY,CAAC,CAAC;EACzC,IAAA/C,0BAAgB,EAAC,UAAU,CAAC;AAC9B;AAGF,SAASsG,cAAcA,CAACH,SAA2B,EAAE;EACnD,MAAM0E,SAAS,GAAG;IAChBC,UAAU,EAAE;EACd,CAAC;EACD,KAAK,MAAMC,QAAQ,IAAI5E,SAAS,EAAE;IAChC,MAAM;MAAE2E;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,CAAC1B,IAAI,CAAC,GAAG0B,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","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,IAAA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CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
@@ -34,8 +34,7 @@ let runtime;
34
34
  // Allow inject bootstrap data in a runtime other than Brick Next.
35
35
  let bootstrapData;
36
36
  let router;
37
- let hooks;
38
- exports.hooks = hooks;
37
+ let hooks = exports.hooks = void 0;
39
38
  function createRuntime(options) {
40
39
  if (runtime) {
41
40
  throw new Error("Cannot create multiple runtimes");
@@ -85,8 +84,7 @@ function getRuntimeV2Factory() {
85
84
  }
86
85
 
87
86
  // istanbul ignore next
88
- const getRuntime = getRuntimeV2Factory() || getRuntimeV3;
89
- exports.getRuntime = getRuntime;
87
+ const getRuntime = exports.getRuntime = getRuntimeV2Factory() || getRuntimeV3;
90
88
  class Runtime {
91
89
  #initialized = false;
92
90
  #bootstrapped = false;
@@ -242,10 +240,9 @@ function _internalApiGetAppInBootstrapData(appId) {
242
240
  var _internalApiGetStoryb;
243
241
  return (_internalApiGetStoryb = _internalApiGetStoryboardInBootstrapData(appId)) === null || _internalApiGetStoryb === void 0 ? void 0 : _internalApiGetStoryb.app;
244
242
  }
245
- let _test_only_setBootstrapData;
243
+ let _test_only_setBootstrapData = exports._test_only_setBootstrapData = void 0;
246
244
 
247
245
  // istanbul ignore next
248
- exports._test_only_setBootstrapData = _test_only_setBootstrapData;
249
246
  if (process.env.NODE_ENV === "test") {
250
247
  exports._test_only_setBootstrapData = _test_only_setBootstrapData = data => {
251
248
  bootstrapData = data;