one
Version:
One is a React framework for web, iOS, and Android apps.
1 lines • 7.68 kB
Source Map (JSON)
{"version":3,"file":"RootErrorBoundary.js","names":[],"sources":["esm/views/RootErrorBoundary.js"],"sourcesContent":["import React from \"react\";\nimport { checkSkewAndReload } from \"../skewProtection\";\nimport { handleSkewError, isChunkLoadError } from \"../utils/dynamicImport\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nclass RootErrorBoundary extends React.Component {\n state = {\n hasError: false,\n error: null,\n componentStack: null\n };\n static getDerivedStateFromError(error) {\n return { hasError: true, error };\n }\n componentDidCatch(error, info) {\n this.setState({ componentStack: info.componentStack || null });\n console.error(\n `[One] Root error boundary caught error:\n${printError(error)}\n${info.componentStack}`\n );\n if (process.env.NODE_ENV === \"production\" && process.env.ONE_SKEW_PROTECTION !== \"false\") {\n if (isChunkLoadError(error)) {\n handleSkewError();\n } else {\n checkSkewAndReload();\n }\n }\n if (typeof window !== \"undefined\") {\n window.dispatchEvent(\n new CustomEvent(\"one-error\", {\n detail: {\n error: {\n message: error.message,\n stack: error.stack,\n name: error.name\n },\n componentStack: info.componentStack,\n timestamp: Date.now(),\n type: \"render\"\n }\n })\n );\n }\n }\n handleRetry = () => {\n this.setState({ hasError: false, error: null, componentStack: null });\n };\n render() {\n if (!this.state.hasError) {\n return this.props.children;\n }\n const { error } = this.state;\n return /* @__PURE__ */ jsx(\n \"div\",\n {\n style: {\n minHeight: \"100vh\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"#0a0a0f\",\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif',\n color: \"#e8e8e8\",\n padding: 24\n },\n children: /* @__PURE__ */ jsxs(\"div\", { style: { maxWidth: 500, width: \"100%\", textAlign: \"center\" }, children: [\n /* @__PURE__ */ jsx(\n \"div\",\n {\n style: {\n width: 64,\n height: 64,\n backgroundColor: \"#ef4444\",\n borderRadius: \"50%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n margin: \"0 auto 24px\"\n },\n children: /* @__PURE__ */ jsxs(\n \"svg\",\n {\n width: \"32\",\n height: \"32\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"white\",\n strokeWidth: \"2\",\n children: [\n /* @__PURE__ */ jsx(\"circle\", { cx: \"12\", cy: \"12\", r: \"10\" }),\n /* @__PURE__ */ jsx(\"line\", { x1: \"12\", y1: \"8\", x2: \"12\", y2: \"12\" }),\n /* @__PURE__ */ jsx(\"line\", { x1: \"12\", y1: \"16\", x2: \"12.01\", y2: \"16\" })\n ]\n }\n )\n }\n ),\n /* @__PURE__ */ jsx(\"h1\", { style: { fontSize: 24, fontWeight: 600, marginBottom: 8 }, children: \"Something went wrong\" }),\n /* @__PURE__ */ jsx(\"p\", { style: { fontSize: 14, color: \"#888\", marginBottom: 24 }, children: error?.message || \"An unexpected error occurred\" }),\n /* @__PURE__ */ jsxs(\"div\", { style: { display: \"flex\", gap: 12, justifyContent: \"center\" }, children: [\n /* @__PURE__ */ jsx(\n \"button\",\n {\n onClick: this.handleRetry,\n style: {\n padding: \"12px 24px\",\n backgroundColor: \"#3b82f6\",\n color: \"white\",\n border: \"none\",\n borderRadius: 8,\n fontSize: 14,\n fontWeight: 500,\n cursor: \"pointer\"\n },\n children: \"Try Again\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"button\",\n {\n onClick: () => {\n window.location.href = \"/\";\n },\n style: {\n padding: \"12px 24px\",\n backgroundColor: \"transparent\",\n color: \"#888\",\n border: \"1px solid #3a3a5a\",\n borderRadius: 8,\n fontSize: 14,\n fontWeight: 500,\n cursor: \"pointer\"\n },\n children: \"Go Home\"\n }\n )\n ] }),\n process.env.NODE_ENV === \"development\" && /* @__PURE__ */ jsx(\"p\", { style: { fontSize: 11, color: \"#666\", marginTop: 24 }, children: \"Press Alt+E to view error details\" })\n ] })\n }\n );\n }\n}\nfunction printError(err) {\n return err instanceof Error ? `${err.message}\n${err.stack}` : String(err);\n}\nexport {\n RootErrorBoundary\n};\n//# sourceMappingURL=RootErrorBoundary.web.js.map\n"],"mappings":";;;;;;AAIA,IAAM,oBAAN,cAAgC,MAAM,UAAU;CAC9C,QAAQ;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,OAAO,yBAAyB,OAAO;EACrC,OAAO;GAAE,UAAU;GAAM;EAAM;CACjC;CACA,kBAAkB,OAAO,MAAM;EAC7B,KAAK,SAAS,EAAE,gBAAgB,KAAK,kBAAkB,KAAK,CAAC;EAC7D,QAAQ,MACN;EACJ,WAAW,KAAK,EAAE;EAClB,KAAK,gBACH;EACA,IAAI,QAAQ,IAAI,aAAa,gBAAgB,QAAQ,IAAI,wBAAwB,SAAS;GACxF,IAAI,iBAAiB,KAAK,GAAG;IAC3B,gBAAgB;GAClB,OAAO;IACL,mBAAmB;GACrB;EACF;EACA,IAAI,OAAO,WAAW,aAAa;GACjC,OAAO,cACL,IAAI,YAAY,aAAa,EAC3B,QAAQ;IACN,OAAO;KACL,SAAS,MAAM;KACf,OAAO,MAAM;KACb,MAAM,MAAM;IACd;IACA,gBAAgB,KAAK;IACrB,WAAW,KAAK,IAAI;IACpB,MAAM;GACR,EACF,CAAC,CACH;EACF;CACF;CACA,oBAAoB;EAClB,KAAK,SAAS;GAAE,UAAU;GAAO,OAAO;GAAM,gBAAgB;EAAK,CAAC;CACtE;CACA,SAAS;EACP,IAAI,CAAC,KAAK,MAAM,UAAU;GACxB,OAAO,KAAK,MAAM;EACpB;EACA,MAAM,EAAE,UAAU,KAAK;EACvB,OAAuB,oBACrB,OACA;GACE,OAAO;IACL,WAAW;IACX,SAAS;IACT,YAAY;IACZ,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;IACZ,OAAO;IACP,SAAS;GACX;GACA,UAA0B,qBAAK,OAAO;IAAE,OAAO;KAAE,UAAU;KAAK,OAAO;KAAQ,WAAW;IAAS;IAAG,UAAU;KAC9F,oBACd,OACA;MACE,OAAO;OACL,OAA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