@xyo-network/react-error 2.64.0-rc.6 → 2.64.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.cjs +106 -0
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.cjs.map +1 -0
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.cts +21 -0
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -0
- package/dist/browser/components/ErrorBoundary/index.cjs +108 -0
- package/dist/browser/components/ErrorBoundary/index.cjs.map +1 -0
- package/dist/browser/components/ErrorBoundary/index.d.cts +2 -0
- package/dist/browser/components/ErrorBoundary/index.d.cts.map +1 -0
- package/dist/browser/components/ErrorRender/ErrorAlert.cjs +39 -0
- package/dist/{node/components/ErrorRender/ErrorAlert.mjs.map → browser/components/ErrorRender/ErrorAlert.cjs.map} +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.cts +10 -0
- package/dist/browser/components/ErrorRender/ErrorAlert.d.cts.map +1 -0
- package/dist/browser/components/ErrorRender/Props.cjs +19 -0
- package/dist/browser/components/ErrorRender/Props.cjs.map +1 -0
- package/dist/browser/components/ErrorRender/Props.d.cts +12 -0
- package/dist/browser/components/ErrorRender/Props.d.cts.map +1 -0
- package/dist/browser/components/ErrorRender/Render.cjs +70 -0
- package/dist/browser/components/ErrorRender/Render.cjs.map +1 -0
- package/dist/browser/components/ErrorRender/Render.d.cts +4 -0
- package/dist/browser/components/ErrorRender/Render.d.cts.map +1 -0
- package/dist/browser/components/ErrorRender/index.cjs +71 -0
- package/dist/browser/components/ErrorRender/index.cjs.map +1 -0
- package/dist/browser/components/ErrorRender/index.d.cts +4 -0
- package/dist/browser/components/ErrorRender/index.d.cts.map +1 -0
- package/dist/browser/components/index.cjs +110 -0
- package/dist/browser/components/index.cjs.map +1 -0
- package/dist/browser/components/index.d.cts +3 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/contexts/ErrorReporter/Context.cjs +28 -0
- package/dist/{node/contexts/ErrorReporter/Context.mjs.map → browser/contexts/ErrorReporter/Context.cjs.map} +1 -1
- package/dist/browser/contexts/ErrorReporter/Context.d.cts +4 -0
- package/dist/browser/contexts/ErrorReporter/Context.d.cts.map +1 -0
- package/dist/browser/contexts/ErrorReporter/Provider.cjs +43 -0
- package/dist/browser/contexts/ErrorReporter/Provider.cjs.map +1 -0
- package/dist/browser/contexts/ErrorReporter/Provider.d.cts +9 -0
- package/dist/browser/contexts/ErrorReporter/Provider.d.cts.map +1 -0
- package/dist/browser/contexts/ErrorReporter/State.cjs +19 -0
- package/dist/browser/contexts/ErrorReporter/State.cjs.map +1 -0
- package/dist/browser/contexts/ErrorReporter/State.d.cts +5 -0
- package/dist/browser/contexts/ErrorReporter/State.d.cts.map +1 -0
- package/dist/browser/contexts/ErrorReporter/index.cjs +56 -0
- package/dist/browser/contexts/ErrorReporter/index.cjs.map +1 -0
- package/dist/browser/contexts/ErrorReporter/index.d.cts +4 -0
- package/dist/browser/contexts/ErrorReporter/index.d.cts.map +1 -0
- package/dist/browser/contexts/ErrorReporter/useRollbar.cjs +40 -0
- package/dist/browser/contexts/ErrorReporter/useRollbar.cjs.map +1 -0
- package/dist/browser/contexts/ErrorReporter/useRollbar.d.cts +3 -0
- package/dist/browser/contexts/ErrorReporter/useRollbar.d.cts.map +1 -0
- package/dist/browser/contexts/index.cjs +56 -0
- package/dist/browser/contexts/index.cjs.map +1 -0
- package/dist/browser/contexts/index.d.cts +2 -0
- package/dist/browser/contexts/index.d.cts.map +1 -0
- package/dist/browser/index.cjs +141 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +3 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/docs.json +25215 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.cjs +110 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.cjs.map +1 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.cts +21 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.js +55 -33
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.js.map +1 -1
- package/dist/node/components/ErrorBoundary/index.cjs +112 -0
- package/dist/node/components/ErrorBoundary/index.cjs.map +1 -0
- package/dist/node/components/ErrorBoundary/index.d.cts +2 -0
- package/dist/node/components/ErrorBoundary/index.d.cts.map +1 -0
- package/dist/node/components/ErrorBoundary/index.js +82 -20
- package/dist/node/components/ErrorBoundary/index.js.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.cjs +43 -0
- package/dist/node/components/ErrorRender/ErrorAlert.cjs.map +1 -0
- package/dist/node/components/ErrorRender/ErrorAlert.d.cts +10 -0
- package/dist/node/components/ErrorRender/ErrorAlert.d.cts.map +1 -0
- package/dist/node/components/ErrorRender/ErrorAlert.js +14 -37
- package/dist/node/components/ErrorRender/ErrorAlert.js.map +1 -1
- package/dist/node/components/ErrorRender/Props.cjs +19 -0
- package/dist/node/components/ErrorRender/Props.cjs.map +1 -0
- package/dist/node/components/ErrorRender/Props.d.cts +12 -0
- package/dist/node/components/ErrorRender/Props.d.cts.map +1 -0
- package/dist/node/components/ErrorRender/Props.js +0 -16
- package/dist/node/components/ErrorRender/Props.js.map +1 -1
- package/dist/node/components/ErrorRender/Render.cjs +74 -0
- package/dist/node/components/ErrorRender/Render.cjs.map +1 -0
- package/dist/node/components/ErrorRender/Render.d.cts +4 -0
- package/dist/node/components/ErrorRender/Render.d.cts.map +1 -0
- package/dist/node/components/ErrorRender/Render.js +28 -35
- package/dist/node/components/ErrorRender/Render.js.map +1 -1
- package/dist/node/components/ErrorRender/index.cjs +76 -0
- package/dist/node/components/ErrorRender/index.cjs.map +1 -0
- package/dist/node/components/ErrorRender/index.d.cts +4 -0
- package/dist/node/components/ErrorRender/index.d.cts.map +1 -0
- package/dist/node/components/ErrorRender/index.js +45 -24
- package/dist/node/components/ErrorRender/index.js.map +1 -1
- package/dist/node/components/index.cjs +116 -0
- package/dist/node/components/index.cjs.map +1 -0
- package/dist/node/components/index.d.cts +3 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/components/index.js +84 -22
- package/dist/node/components/index.js.map +1 -1
- package/dist/node/contexts/ErrorReporter/Context.cjs +32 -0
- package/dist/node/contexts/ErrorReporter/Context.cjs.map +1 -0
- package/dist/node/contexts/ErrorReporter/Context.d.cts +4 -0
- package/dist/node/contexts/ErrorReporter/Context.d.cts.map +1 -0
- package/dist/node/contexts/ErrorReporter/Context.js +5 -28
- package/dist/node/contexts/ErrorReporter/Context.js.map +1 -1
- package/dist/node/contexts/ErrorReporter/Provider.cjs +47 -0
- package/dist/node/contexts/ErrorReporter/Provider.cjs.map +1 -0
- package/dist/node/contexts/ErrorReporter/Provider.d.cts +9 -0
- package/dist/node/contexts/ErrorReporter/Provider.d.cts.map +1 -0
- package/dist/node/contexts/ErrorReporter/Provider.js +15 -33
- package/dist/node/contexts/ErrorReporter/Provider.js.map +1 -1
- package/dist/node/contexts/ErrorReporter/State.cjs +19 -0
- package/dist/node/contexts/ErrorReporter/State.cjs.map +1 -0
- package/dist/node/contexts/ErrorReporter/State.d.cts +5 -0
- package/dist/node/contexts/ErrorReporter/State.d.cts.map +1 -0
- package/dist/node/contexts/ErrorReporter/State.js +0 -16
- package/dist/node/contexts/ErrorReporter/State.js.map +1 -1
- package/dist/node/contexts/ErrorReporter/index.cjs +61 -0
- package/dist/node/contexts/ErrorReporter/index.cjs.map +1 -0
- package/dist/node/contexts/ErrorReporter/index.d.cts +4 -0
- package/dist/node/contexts/ErrorReporter/index.d.cts.map +1 -0
- package/dist/node/contexts/ErrorReporter/index.js +30 -24
- package/dist/node/contexts/ErrorReporter/index.js.map +1 -1
- package/dist/node/contexts/ErrorReporter/useRollbar.cjs +44 -0
- package/dist/node/contexts/ErrorReporter/useRollbar.cjs.map +1 -0
- package/dist/node/contexts/ErrorReporter/useRollbar.d.cts +3 -0
- package/dist/node/contexts/ErrorReporter/useRollbar.d.cts.map +1 -0
- package/dist/node/contexts/ErrorReporter/useRollbar.js +12 -30
- package/dist/node/contexts/ErrorReporter/useRollbar.js.map +1 -1
- package/dist/node/contexts/index.cjs +61 -0
- package/dist/node/contexts/index.cjs.map +1 -0
- package/dist/node/contexts/index.d.cts +2 -0
- package/dist/node/contexts/index.d.cts.map +1 -0
- package/dist/node/contexts/index.js +30 -20
- package/dist/node/contexts/index.js.map +1 -1
- package/dist/node/index.cjs +149 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +3 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +115 -22
- package/dist/node/index.js.map +1 -1
- package/package.json +17 -17
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.stories.js +0 -26
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.stories.js.map +0 -1
- package/dist/browser/contexts/ErrorReporter/Provider.stories.js +0 -35
- package/dist/browser/contexts/ErrorReporter/Provider.stories.js.map +0 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.mjs +0 -39
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.mjs.map +0 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.stories.js +0 -51
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.stories.js.map +0 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.stories.mjs +0 -26
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.stories.mjs.map +0 -1
- package/dist/node/components/ErrorBoundary/index.mjs +0 -2
- package/dist/node/components/ErrorBoundary/index.mjs.map +0 -1
- package/dist/node/components/ErrorRender/ErrorAlert.mjs +0 -17
- package/dist/node/components/ErrorRender/Props.mjs +0 -1
- package/dist/node/components/ErrorRender/Props.mjs.map +0 -1
- package/dist/node/components/ErrorRender/Render.mjs +0 -32
- package/dist/node/components/ErrorRender/Render.mjs.map +0 -1
- package/dist/node/components/ErrorRender/index.mjs +0 -4
- package/dist/node/components/ErrorRender/index.mjs.map +0 -1
- package/dist/node/components/index.mjs +0 -3
- package/dist/node/components/index.mjs.map +0 -1
- package/dist/node/contexts/ErrorReporter/Context.mjs +0 -6
- package/dist/node/contexts/ErrorReporter/Provider.mjs +0 -16
- package/dist/node/contexts/ErrorReporter/Provider.mjs.map +0 -1
- package/dist/node/contexts/ErrorReporter/Provider.stories.js +0 -69
- package/dist/node/contexts/ErrorReporter/Provider.stories.js.map +0 -1
- package/dist/node/contexts/ErrorReporter/Provider.stories.mjs +0 -35
- package/dist/node/contexts/ErrorReporter/Provider.stories.mjs.map +0 -1
- package/dist/node/contexts/ErrorReporter/State.mjs +0 -1
- package/dist/node/contexts/ErrorReporter/State.mjs.map +0 -1
- package/dist/node/contexts/ErrorReporter/index.mjs +0 -4
- package/dist/node/contexts/ErrorReporter/index.mjs.map +0 -1
- package/dist/node/contexts/ErrorReporter/useRollbar.mjs +0 -13
- package/dist/node/contexts/ErrorReporter/useRollbar.mjs.map +0 -1
- package/dist/node/contexts/index.mjs +0 -2
- package/dist/node/contexts/index.mjs.map +0 -1
- package/dist/node/index.mjs +0 -3
- package/dist/node/index.mjs.map +0 -1
@@ -1,41 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var ErrorAlert_exports = {};
|
20
|
-
__export(ErrorAlert_exports, {
|
21
|
-
ErrorAlert: () => ErrorAlert
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(ErrorAlert_exports);
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
25
|
-
var import_icons_material = require("@mui/icons-material");
|
26
|
-
var import_material = require("@mui/material");
|
27
|
-
var import_react_button = require("@xylabs/react-button");
|
28
|
-
const ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
|
29
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Alert, { severity: "error", ...props, children: [
|
30
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children: "Whoops! Something went wrong" }),
|
31
|
-
errorContext ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
|
32
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
33
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: error?.message }),
|
34
|
-
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExitToApp, { fontSize: "small" }) }) : null
|
1
|
+
// src/components/ErrorRender/ErrorAlert.tsx
|
2
|
+
import { ExitToApp as ExitIcon } from "@mui/icons-material";
|
3
|
+
import { Alert, AlertTitle, Typography } from "@mui/material";
|
4
|
+
import { ButtonEx } from "@xylabs/react-button";
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
6
|
+
var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
|
7
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...props, children: [
|
8
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
|
9
|
+
errorContext ? /* @__PURE__ */ jsx(Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
|
10
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
11
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: error == null ? void 0 : error.message }),
|
12
|
+
onCancel ? /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ jsx(ExitIcon, { fontSize: "small" }) }) : null
|
35
13
|
] });
|
36
14
|
};
|
37
|
-
|
38
|
-
0 && (module.exports = {
|
15
|
+
export {
|
39
16
|
ErrorAlert
|
40
|
-
}
|
17
|
+
};
|
41
18
|
//# sourceMappingURL=ErrorAlert.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"sourcesContent":["import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {errorContext ? (\n <Typography variant=\"caption\" my={0.5} lineHeight=\"1\" display=\"block\">\n {errorContext}\n </Typography>\n ) : null}\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n {onCancel ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n ) : null}\n </Alert>\n )\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"sourcesContent":["import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {errorContext ? (\n <Typography variant=\"caption\" my={0.5} lineHeight=\"1\" display=\"block\">\n {errorContext}\n </Typography>\n ) : null}\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n {onCancel ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n ) : null}\n </Alert>\n )\n}\n"],"mappings":";AAAA,SAAS,aAAa,gBAAgB;AACtC,SAAS,OAAmB,YAAY,kBAAkB;AAC1D,SAAS,gBAAgB;AAWrB,SACE,KADF;AAFG,IAAM,aAAwC,CAAC,EAAE,UAAU,OAAO,cAAc,GAAG,MAAM,MAAM;AACpG,SACE,qBAAC,SAAM,UAAS,SAAS,GAAG,OAC1B;AAAA,wBAAC,cAAW,0CAA4B;AAAA,IACvC,eACC,oBAAC,cAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,KAAI,SAAQ,SAC3D,wBACH,IACE;AAAA,IACJ,oBAAC,cAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,QAAO,oBAEzD;AAAA,IACA,oBAAC,cAAW,SAAQ,WAAW,yCAAO,SAAQ;AAAA,IAC7C,WACC,oBAAC,YAAS,SAAQ,YAAW,MAAK,SAAQ,SAAS,UAAU,UAAS,YAAW,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GACzG,8BAAC,YAAS,UAAS,SAAQ,GAC7B,IACE;AAAA,KACN;AAEJ;","names":[]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
for (let key of __getOwnPropNames(from))
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
+
}
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
|
16
|
+
// src/components/ErrorRender/Props.ts
|
17
|
+
var Props_exports = {};
|
18
|
+
module.exports = __toCommonJS(Props_exports);
|
19
|
+
//# sourceMappingURL=Props.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ErrorRender/Props.ts"],"sourcesContent":["import { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { ModuleError } from '@xyo-network/payload-model'\nimport { ReactNode } from 'react'\n\nexport interface ErrorRenderProps extends FlexBoxProps {\n customError?: ReactNode\n error?: ModuleError | Error\n errorContext?: string\n noErrorDisplay?: boolean\n noReAuth?: boolean\n onCancel?: () => void\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
2
|
+
import { ModuleError } from '@xyo-network/payload-model';
|
3
|
+
import { ReactNode } from 'react';
|
4
|
+
export interface ErrorRenderProps extends FlexBoxProps {
|
5
|
+
customError?: ReactNode;
|
6
|
+
error?: ModuleError | Error;
|
7
|
+
errorContext?: string;
|
8
|
+
noErrorDisplay?: boolean;
|
9
|
+
noReAuth?: boolean;
|
10
|
+
onCancel?: () => void;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=Props.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Props.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CACtB"}
|
@@ -1,17 +1 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
-
for (let key of __getOwnPropNames(from))
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
-
}
|
12
|
-
return to;
|
13
|
-
};
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
-
var Props_exports = {};
|
16
|
-
module.exports = __toCommonJS(Props_exports);
|
17
1
|
//# sourceMappingURL=Props.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/components/ErrorRender/Render.tsx
|
21
|
+
var Render_exports = {};
|
22
|
+
__export(Render_exports, {
|
23
|
+
ErrorRender: () => ErrorRender
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(Render_exports);
|
26
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
27
|
+
var import_react = require("react");
|
28
|
+
var import_react_router_dom = require("react-router-dom");
|
29
|
+
|
30
|
+
// src/components/ErrorRender/ErrorAlert.tsx
|
31
|
+
var import_icons_material = require("@mui/icons-material");
|
32
|
+
var import_material = require("@mui/material");
|
33
|
+
var import_react_button = require("@xylabs/react-button");
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
35
|
+
var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Alert, { severity: "error", ...props, children: [
|
37
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children: "Whoops! Something went wrong" }),
|
38
|
+
errorContext ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: error == null ? void 0 : error.message }),
|
41
|
+
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExitToApp, { fontSize: "small" }) }) : null
|
42
|
+
] });
|
43
|
+
};
|
44
|
+
|
45
|
+
// src/components/ErrorRender/Render.tsx
|
46
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
47
|
+
var ErrorRender = ({
|
48
|
+
onCancel,
|
49
|
+
error,
|
50
|
+
noErrorDisplay = false,
|
51
|
+
customError = null,
|
52
|
+
children,
|
53
|
+
errorContext,
|
54
|
+
...props
|
55
|
+
}) => {
|
56
|
+
const location = (0, import_react_router_dom.useLocation)();
|
57
|
+
(0, import_react.useEffect)(() => {
|
58
|
+
location.state = {
|
59
|
+
from: {
|
60
|
+
pathname: window.location.pathname
|
61
|
+
}
|
62
|
+
};
|
63
|
+
}, [location]);
|
64
|
+
if (error) {
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorAlert, { error, errorContext, onCancel }) }) });
|
66
|
+
} else {
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
|
68
|
+
}
|
69
|
+
};
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
71
|
+
0 && (module.exports = {
|
72
|
+
ErrorRender
|
73
|
+
});
|
74
|
+
//# sourceMappingURL=Render.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ErrorRender/Render.tsx","../../../../src/components/ErrorRender/ErrorAlert.tsx"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { ErrorAlert } from './ErrorAlert'\nimport { ErrorRenderProps } from './Props'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n ...props\n}) => {\n const location = useLocation()\n useEffect(() => {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }, [location])\n\n if (error) {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ? (\n customError\n ) : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} />\n </FlexCol>\n )}\n </FlexCol>\n )\n } else {\n return <>{children}</> ?? null\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {errorContext ? (\n <Typography variant=\"caption\" my={0.5} lineHeight=\"1\" display=\"block\">\n {errorContext}\n </Typography>\n ) : null}\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n {onCancel ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n ) : null}\n </Alert>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAwB;AACxB,mBAA0B;AAC1B,8BAA4B;;;ACF5B,4BAAsC;AACtC,sBAA0D;AAC1D,0BAAyB;AAWrB;AAFG,IAAM,aAAwC,CAAC,EAAE,UAAU,OAAO,cAAc,GAAG,MAAM,MAAM;AACpG,SACE,6CAAC,yBAAM,UAAS,SAAS,GAAG,OAC1B;AAAA,gDAAC,8BAAW,0CAA4B;AAAA,IACvC,eACC,4CAAC,8BAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,KAAI,SAAQ,SAC3D,wBACH,IACE;AAAA,IACJ,4CAAC,8BAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,QAAO,oBAEzD;AAAA,IACA,4CAAC,8BAAW,SAAQ,WAAW,yCAAO,SAAQ;AAAA,IAC7C,WACC,4CAAC,gCAAS,SAAQ,YAAW,MAAK,SAAQ,SAAS,UAAU,UAAS,YAAW,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GACzG,sDAAC,sBAAAA,WAAA,EAAS,UAAS,SAAQ,GAC7B,IACE;AAAA,KACN;AAEJ;;;ADEY,IAAAC,sBAAA;AA1BL,IAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,eAAW,qCAAY;AAC7B,8BAAU,MAAM;AAEd,aAAS,QAAQ;AAAA,MACf,MAAM;AAAA,QACJ,UAAU,OAAO,SAAS;AAAA,MAC5B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,MAAI,OAAO;AACT,WACE,6CAAC,gCAAQ,YAAW,WAAW,GAAG,OAC/B,2BACC,cAEA,6CAAC,gCAAQ,YAAW,UAAU,GAAG,OAC/B,uDAAC,cAAW,OAAc,cAA4B,UAAoB,GAC5E,GAEJ;AAAA,EAEJ,OAAO;AACL,WAAO,6EAAG,UAAS,KAAO;AAAA,EAC5B;AACF;","names":["ExitIcon","import_jsx_runtime"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkClD,CAAA"}
|
@@ -1,32 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
// src/components/ErrorRender/Render.tsx
|
2
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
3
|
+
import { useEffect } from "react";
|
4
|
+
import { useLocation } from "react-router-dom";
|
5
|
+
|
6
|
+
// src/components/ErrorRender/ErrorAlert.tsx
|
7
|
+
import { ExitToApp as ExitIcon } from "@mui/icons-material";
|
8
|
+
import { Alert, AlertTitle, Typography } from "@mui/material";
|
9
|
+
import { ButtonEx } from "@xylabs/react-button";
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
11
|
+
var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
|
12
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...props, children: [
|
13
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
|
14
|
+
errorContext ? /* @__PURE__ */ jsx(Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
|
15
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
16
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: error == null ? void 0 : error.message }),
|
17
|
+
onCancel ? /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ jsx(ExitIcon, { fontSize: "small" }) }) : null
|
18
|
+
] });
|
9
19
|
};
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var Render_exports = {};
|
20
|
-
__export(Render_exports, {
|
21
|
-
ErrorRender: () => ErrorRender
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(Render_exports);
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
25
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
26
|
-
var import_react = require("react");
|
27
|
-
var import_react_router_dom = require("react-router-dom");
|
28
|
-
var import_ErrorAlert = require("./ErrorAlert");
|
29
|
-
const ErrorRender = ({
|
20
|
+
|
21
|
+
// src/components/ErrorRender/Render.tsx
|
22
|
+
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
23
|
+
var ErrorRender = ({
|
30
24
|
onCancel,
|
31
25
|
error,
|
32
26
|
noErrorDisplay = false,
|
@@ -35,8 +29,8 @@ const ErrorRender = ({
|
|
35
29
|
errorContext,
|
36
30
|
...props
|
37
31
|
}) => {
|
38
|
-
const location =
|
39
|
-
|
32
|
+
const location = useLocation();
|
33
|
+
useEffect(() => {
|
40
34
|
location.state = {
|
41
35
|
from: {
|
42
36
|
pathname: window.location.pathname
|
@@ -44,13 +38,12 @@ const ErrorRender = ({
|
|
44
38
|
};
|
45
39
|
}, [location]);
|
46
40
|
if (error) {
|
47
|
-
return /* @__PURE__ */ (
|
41
|
+
return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel }) }) });
|
48
42
|
} else {
|
49
|
-
return /* @__PURE__ */ (
|
43
|
+
return /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
|
50
44
|
}
|
51
45
|
};
|
52
|
-
|
53
|
-
0 && (module.exports = {
|
46
|
+
export {
|
54
47
|
ErrorRender
|
55
|
-
}
|
48
|
+
};
|
56
49
|
//# sourceMappingURL=Render.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ErrorRender/Render.tsx"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { ErrorAlert } from './ErrorAlert'\nimport { ErrorRenderProps } from './Props'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n ...props\n}) => {\n const location = useLocation()\n useEffect(() => {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }, [location])\n\n if (error) {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ? (\n customError\n ) : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} />\n </FlexCol>\n )}\n </FlexCol>\n )\n } else {\n return <>{children}</> ?? null\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../src/components/ErrorRender/Render.tsx","../../../../src/components/ErrorRender/ErrorAlert.tsx"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { ErrorAlert } from './ErrorAlert'\nimport { ErrorRenderProps } from './Props'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n ...props\n}) => {\n const location = useLocation()\n useEffect(() => {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }, [location])\n\n if (error) {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ? (\n customError\n ) : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} />\n </FlexCol>\n )}\n </FlexCol>\n )\n } else {\n return <>{children}</> ?? null\n }\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {errorContext ? (\n <Typography variant=\"caption\" my={0.5} lineHeight=\"1\" display=\"block\">\n {errorContext}\n </Typography>\n ) : null}\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n {onCancel ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n ) : null}\n </Alert>\n )\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;;;ACF5B,SAAS,aAAa,gBAAgB;AACtC,SAAS,OAAmB,YAAY,kBAAkB;AAC1D,SAAS,gBAAgB;AAWrB,SACE,KADF;AAFG,IAAM,aAAwC,CAAC,EAAE,UAAU,OAAO,cAAc,GAAG,MAAM,MAAM;AACpG,SACE,qBAAC,SAAM,UAAS,SAAS,GAAG,OAC1B;AAAA,wBAAC,cAAW,0CAA4B;AAAA,IACvC,eACC,oBAAC,cAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,KAAI,SAAQ,SAC3D,wBACH,IACE;AAAA,IACJ,oBAAC,cAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,QAAO,oBAEzD;AAAA,IACA,oBAAC,cAAW,SAAQ,WAAW,yCAAO,SAAQ;AAAA,IAC7C,WACC,oBAAC,YAAS,SAAQ,YAAW,MAAK,SAAQ,SAAS,UAAU,UAAS,YAAW,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GACzG,8BAAC,YAAS,UAAS,SAAQ,GAC7B,IACE;AAAA,KACN;AAEJ;;;ADEY,SAMD,UANC,OAAAA,YAAA;AA1BL,IAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,WAAW,YAAY;AAC7B,YAAU,MAAM;AAEd,aAAS,QAAQ;AAAA,MACf,MAAM;AAAA,QACJ,UAAU,OAAO,SAAS;AAAA,MAC5B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,MAAI,OAAO;AACT,WACE,gBAAAA,KAAC,WAAQ,YAAW,WAAW,GAAG,OAC/B,2BACC,cAEA,gBAAAA,KAAC,WAAQ,YAAW,UAAU,GAAG,OAC/B,0BAAAA,KAAC,cAAW,OAAc,cAA4B,UAAoB,GAC5E,GAEJ;AAAA,EAEJ,OAAO;AACL,WAAO,gBAAAA,KAAA,YAAG,UAAS,KAAO;AAAA,EAC5B;AACF;","names":["jsx"]}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/components/ErrorRender/index.ts
|
21
|
+
var ErrorRender_exports = {};
|
22
|
+
__export(ErrorRender_exports, {
|
23
|
+
ErrorAlert: () => ErrorAlert,
|
24
|
+
ErrorRender: () => ErrorRender
|
25
|
+
});
|
26
|
+
module.exports = __toCommonJS(ErrorRender_exports);
|
27
|
+
|
28
|
+
// src/components/ErrorRender/ErrorAlert.tsx
|
29
|
+
var import_icons_material = require("@mui/icons-material");
|
30
|
+
var import_material = require("@mui/material");
|
31
|
+
var import_react_button = require("@xylabs/react-button");
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
33
|
+
var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
|
34
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Alert, { severity: "error", ...props, children: [
|
35
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children: "Whoops! Something went wrong" }),
|
36
|
+
errorContext ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
|
37
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: error == null ? void 0 : error.message }),
|
39
|
+
onCancel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExitToApp, { fontSize: "small" }) }) : null
|
40
|
+
] });
|
41
|
+
};
|
42
|
+
|
43
|
+
// src/components/ErrorRender/Render.tsx
|
44
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
45
|
+
var import_react = require("react");
|
46
|
+
var import_react_router_dom = require("react-router-dom");
|
47
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
48
|
+
var ErrorRender = ({
|
49
|
+
onCancel,
|
50
|
+
error,
|
51
|
+
noErrorDisplay = false,
|
52
|
+
customError = null,
|
53
|
+
children,
|
54
|
+
errorContext,
|
55
|
+
...props
|
56
|
+
}) => {
|
57
|
+
const location = (0, import_react_router_dom.useLocation)();
|
58
|
+
(0, import_react.useEffect)(() => {
|
59
|
+
location.state = {
|
60
|
+
from: {
|
61
|
+
pathname: window.location.pathname
|
62
|
+
}
|
63
|
+
};
|
64
|
+
}, [location]);
|
65
|
+
if (error) {
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorAlert, { error, errorContext, onCancel }) }) });
|
67
|
+
} else {
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
|
69
|
+
}
|
70
|
+
};
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
72
|
+
0 && (module.exports = {
|
73
|
+
ErrorAlert,
|
74
|
+
ErrorRender
|
75
|
+
});
|
76
|
+
//# sourceMappingURL=index.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ErrorRender/index.ts","../../../../src/components/ErrorRender/ErrorAlert.tsx","../../../../src/components/ErrorRender/Render.tsx"],"sourcesContent":["export * from './ErrorAlert'\nexport * from './Props'\nexport * from './Render'\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {errorContext ? (\n <Typography variant=\"caption\" my={0.5} lineHeight=\"1\" display=\"block\">\n {errorContext}\n </Typography>\n ) : null}\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n {onCancel ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n ) : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { ErrorAlert } from './ErrorAlert'\nimport { ErrorRenderProps } from './Props'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n ...props\n}) => {\n const location = useLocation()\n useEffect(() => {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }, [location])\n\n if (error) {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ? (\n customError\n ) : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} />\n </FlexCol>\n )}\n </FlexCol>\n )\n } else {\n return <>{children}</> ?? null\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,4BAAsC;AACtC,sBAA0D;AAC1D,0BAAyB;AAWrB;AAFG,IAAM,aAAwC,CAAC,EAAE,UAAU,OAAO,cAAc,GAAG,MAAM,MAAM;AACpG,SACE,6CAAC,yBAAM,UAAS,SAAS,GAAG,OAC1B;AAAA,gDAAC,8BAAW,0CAA4B;AAAA,IACvC,eACC,4CAAC,8BAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,KAAI,SAAQ,SAC3D,wBACH,IACE;AAAA,IACJ,4CAAC,8BAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,QAAO,oBAEzD;AAAA,IACA,4CAAC,8BAAW,SAAQ,WAAW,yCAAO,SAAQ;AAAA,IAC7C,WACC,4CAAC,gCAAS,SAAQ,YAAW,MAAK,SAAQ,SAAS,UAAU,UAAS,YAAW,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GACzG,sDAAC,sBAAAA,WAAA,EAAS,UAAS,SAAQ,GAC7B,IACE;AAAA,KACN;AAEJ;;;AC/BA,2BAAwB;AACxB,mBAA0B;AAC1B,8BAA4B;AA+BhB,IAAAC,sBAAA;AA1BL,IAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,eAAW,qCAAY;AAC7B,8BAAU,MAAM;AAEd,aAAS,QAAQ;AAAA,MACf,MAAM;AAAA,QACJ,UAAU,OAAO,SAAS;AAAA,MAC5B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,MAAI,OAAO;AACT,WACE,6CAAC,gCAAQ,YAAW,WAAW,GAAG,OAC/B,2BACC,cAEA,6CAAC,gCAAQ,YAAW,UAAU,GAAG,OAC/B,uDAAC,cAAW,OAAc,cAA4B,UAAoB,GAC5E,GAEJ;AAAA,EAEJ,OAAO;AACL,WAAO,6EAAG,UAAS,KAAO;AAAA,EAC5B;AACF;","names":["ExitIcon","import_jsx_runtime"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA"}
|
@@ -1,27 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
// src/components/ErrorRender/ErrorAlert.tsx
|
2
|
+
import { ExitToApp as ExitIcon } from "@mui/icons-material";
|
3
|
+
import { Alert, AlertTitle, Typography } from "@mui/material";
|
4
|
+
import { ButtonEx } from "@xylabs/react-button";
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
6
|
+
var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
|
7
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...props, children: [
|
8
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
|
9
|
+
errorContext ? /* @__PURE__ */ jsx(Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
|
10
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
|
11
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: error == null ? void 0 : error.message }),
|
12
|
+
onCancel ? /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ jsx(ExitIcon, { fontSize: "small" }) }) : null
|
13
|
+
] });
|
14
|
+
};
|
15
|
+
|
16
|
+
// src/components/ErrorRender/Render.tsx
|
17
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
18
|
+
import { useEffect } from "react";
|
19
|
+
import { useLocation } from "react-router-dom";
|
20
|
+
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
21
|
+
var ErrorRender = ({
|
22
|
+
onCancel,
|
23
|
+
error,
|
24
|
+
noErrorDisplay = false,
|
25
|
+
customError = null,
|
26
|
+
children,
|
27
|
+
errorContext,
|
28
|
+
...props
|
29
|
+
}) => {
|
30
|
+
const location = useLocation();
|
31
|
+
useEffect(() => {
|
32
|
+
location.state = {
|
33
|
+
from: {
|
34
|
+
pathname: window.location.pathname
|
35
|
+
}
|
36
|
+
};
|
37
|
+
}, [location]);
|
38
|
+
if (error) {
|
39
|
+
return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel }) }) });
|
40
|
+
} else {
|
41
|
+
return /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
|
11
42
|
}
|
12
|
-
return to;
|
13
43
|
};
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
__reExport(ErrorRender_exports, require("./ErrorAlert"), module.exports);
|
19
|
-
__reExport(ErrorRender_exports, require("./Props"), module.exports);
|
20
|
-
__reExport(ErrorRender_exports, require("./Render"), module.exports);
|
21
|
-
// Annotate the CommonJS export names for ESM import in node:
|
22
|
-
0 && (module.exports = {
|
23
|
-
...require("./ErrorAlert"),
|
24
|
-
...require("./Props"),
|
25
|
-
...require("./Render")
|
26
|
-
});
|
44
|
+
export {
|
45
|
+
ErrorAlert,
|
46
|
+
ErrorRender
|
47
|
+
};
|
27
48
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ErrorRender/
|
1
|
+
{"version":3,"sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx","../../../../src/components/ErrorRender/Render.tsx"],"sourcesContent":["import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport { Alert, AlertProps, AlertTitle, Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleError } from '@xyo-network/payload-model'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error\n errorContext?: string\n onCancel?: () => void\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, ...props }) => {\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>Whoops! Something went wrong</AlertTitle>\n {errorContext ? (\n <Typography variant=\"caption\" my={0.5} lineHeight=\"1\" display=\"block\">\n {errorContext}\n </Typography>\n ) : null}\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{error?.message}</Typography>\n {onCancel ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n ) : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport { useEffect } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { ErrorAlert } from './ErrorAlert'\nimport { ErrorRenderProps } from './Props'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n ...props\n}) => {\n const location = useLocation()\n useEffect(() => {\n // ensure we end up at the same place we are now after logging in\n location.state = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }, [location])\n\n if (error) {\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ? (\n customError\n ) : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} />\n </FlexCol>\n )}\n </FlexCol>\n )\n } else {\n return <>{children}</> ?? null\n }\n}\n"],"mappings":";AAAA,SAAS,aAAa,gBAAgB;AACtC,SAAS,OAAmB,YAAY,kBAAkB;AAC1D,SAAS,gBAAgB;AAWrB,SACE,KADF;AAFG,IAAM,aAAwC,CAAC,EAAE,UAAU,OAAO,cAAc,GAAG,MAAM,MAAM;AACpG,SACE,qBAAC,SAAM,UAAS,SAAS,GAAG,OAC1B;AAAA,wBAAC,cAAW,0CAA4B;AAAA,IACvC,eACC,oBAAC,cAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,KAAI,SAAQ,SAC3D,wBACH,IACE;AAAA,IACJ,oBAAC,cAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,QAAO,oBAEzD;AAAA,IACA,oBAAC,cAAW,SAAQ,WAAW,yCAAO,SAAQ;AAAA,IAC7C,WACC,oBAAC,YAAS,SAAQ,YAAW,MAAK,SAAQ,SAAS,UAAU,UAAS,YAAW,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GACzG,8BAAC,YAAS,UAAS,SAAQ,GAC7B,IACE;AAAA,KACN;AAEJ;;;AC/BA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AA+BhB,SAMD,UANC,OAAAA,YAAA;AA1BL,IAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,WAAW,YAAY;AAC7B,YAAU,MAAM;AAEd,aAAS,QAAQ;AAAA,MACf,MAAM;AAAA,QACJ,UAAU,OAAO,SAAS;AAAA,MAC5B;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,MAAI,OAAO;AACT,WACE,gBAAAA,KAAC,WAAQ,YAAW,WAAW,GAAG,OAC/B,2BACC,cAEA,gBAAAA,KAAC,WAAQ,YAAW,UAAU,GAAG,OAC/B,0BAAAA,KAAC,cAAW,OAAc,cAA4B,UAAoB,GAC5E,GAEJ;AAAA,EAEJ,OAAO;AACL,WAAO,gBAAAA,KAAA,YAAG,UAAS,KAAO;AAAA,EAC5B;AACF;","names":["jsx"]}
|