@xyo-network/react-error 2.64.9 → 2.65.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/package.json +7 -7
  2. package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.cjs +0 -106
  3. package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.cjs.map +0 -1
  4. package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.js +0 -85
  5. package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.js.map +0 -1
  6. package/dist/browser/components/ErrorBoundary/index.cjs +0 -108
  7. package/dist/browser/components/ErrorBoundary/index.cjs.map +0 -1
  8. package/dist/browser/components/ErrorBoundary/index.js +0 -85
  9. package/dist/browser/components/ErrorBoundary/index.js.map +0 -1
  10. package/dist/browser/components/ErrorRender/ErrorAlert.cjs +0 -39
  11. package/dist/browser/components/ErrorRender/ErrorAlert.cjs.map +0 -1
  12. package/dist/browser/components/ErrorRender/ErrorAlert.js +0 -18
  13. package/dist/browser/components/ErrorRender/ErrorAlert.js.map +0 -1
  14. package/dist/browser/components/ErrorRender/Props.cjs +0 -19
  15. package/dist/browser/components/ErrorRender/Props.cjs.map +0 -1
  16. package/dist/browser/components/ErrorRender/Props.js +0 -1
  17. package/dist/browser/components/ErrorRender/Props.js.map +0 -1
  18. package/dist/browser/components/ErrorRender/Render.cjs +0 -70
  19. package/dist/browser/components/ErrorRender/Render.cjs.map +0 -1
  20. package/dist/browser/components/ErrorRender/Render.js +0 -49
  21. package/dist/browser/components/ErrorRender/Render.js.map +0 -1
  22. package/dist/browser/components/ErrorRender/index.cjs +0 -71
  23. package/dist/browser/components/ErrorRender/index.cjs.map +0 -1
  24. package/dist/browser/components/ErrorRender/index.js +0 -48
  25. package/dist/browser/components/ErrorRender/index.js.map +0 -1
  26. package/dist/browser/components/index.cjs +0 -110
  27. package/dist/browser/components/index.cjs.map +0 -1
  28. package/dist/browser/components/index.js +0 -87
  29. package/dist/browser/components/index.js.map +0 -1
  30. package/dist/browser/contexts/ErrorReporter/Context.cjs +0 -28
  31. package/dist/browser/contexts/ErrorReporter/Context.cjs.map +0 -1
  32. package/dist/browser/contexts/ErrorReporter/Context.js +0 -7
  33. package/dist/browser/contexts/ErrorReporter/Context.js.map +0 -1
  34. package/dist/browser/contexts/ErrorReporter/Provider.cjs +0 -43
  35. package/dist/browser/contexts/ErrorReporter/Provider.cjs.map +0 -1
  36. package/dist/browser/contexts/ErrorReporter/Provider.js +0 -22
  37. package/dist/browser/contexts/ErrorReporter/Provider.js.map +0 -1
  38. package/dist/browser/contexts/ErrorReporter/State.cjs +0 -19
  39. package/dist/browser/contexts/ErrorReporter/State.cjs.map +0 -1
  40. package/dist/browser/contexts/ErrorReporter/State.js +0 -1
  41. package/dist/browser/contexts/ErrorReporter/State.js.map +0 -1
  42. package/dist/browser/contexts/ErrorReporter/index.cjs +0 -56
  43. package/dist/browser/contexts/ErrorReporter/index.cjs.map +0 -1
  44. package/dist/browser/contexts/ErrorReporter/index.js +0 -33
  45. package/dist/browser/contexts/ErrorReporter/index.js.map +0 -1
  46. package/dist/browser/contexts/ErrorReporter/useRollbar.cjs +0 -40
  47. package/dist/browser/contexts/ErrorReporter/useRollbar.cjs.map +0 -1
  48. package/dist/browser/contexts/ErrorReporter/useRollbar.js +0 -19
  49. package/dist/browser/contexts/ErrorReporter/useRollbar.js.map +0 -1
  50. package/dist/browser/contexts/index.cjs +0 -56
  51. package/dist/browser/contexts/index.cjs.map +0 -1
  52. package/dist/browser/contexts/index.js +0 -33
  53. package/dist/browser/contexts/index.js.map +0 -1
  54. package/dist/docs.json +0 -25215
  55. package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.cjs +0 -110
  56. package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.cjs.map +0 -1
  57. package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.js +0 -85
  58. package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.js.map +0 -1
  59. package/dist/node/components/ErrorBoundary/index.cjs +0 -112
  60. package/dist/node/components/ErrorBoundary/index.cjs.map +0 -1
  61. package/dist/node/components/ErrorBoundary/index.js +0 -85
  62. package/dist/node/components/ErrorBoundary/index.js.map +0 -1
  63. package/dist/node/components/ErrorRender/ErrorAlert.cjs +0 -43
  64. package/dist/node/components/ErrorRender/ErrorAlert.cjs.map +0 -1
  65. package/dist/node/components/ErrorRender/ErrorAlert.js +0 -18
  66. package/dist/node/components/ErrorRender/ErrorAlert.js.map +0 -1
  67. package/dist/node/components/ErrorRender/Props.cjs +0 -19
  68. package/dist/node/components/ErrorRender/Props.cjs.map +0 -1
  69. package/dist/node/components/ErrorRender/Props.js +0 -1
  70. package/dist/node/components/ErrorRender/Props.js.map +0 -1
  71. package/dist/node/components/ErrorRender/Render.cjs +0 -74
  72. package/dist/node/components/ErrorRender/Render.cjs.map +0 -1
  73. package/dist/node/components/ErrorRender/Render.js +0 -49
  74. package/dist/node/components/ErrorRender/Render.js.map +0 -1
  75. package/dist/node/components/ErrorRender/index.cjs +0 -76
  76. package/dist/node/components/ErrorRender/index.cjs.map +0 -1
  77. package/dist/node/components/ErrorRender/index.js +0 -48
  78. package/dist/node/components/ErrorRender/index.js.map +0 -1
  79. package/dist/node/components/index.cjs +0 -116
  80. package/dist/node/components/index.cjs.map +0 -1
  81. package/dist/node/components/index.js +0 -87
  82. package/dist/node/components/index.js.map +0 -1
  83. package/dist/node/contexts/ErrorReporter/Context.cjs +0 -32
  84. package/dist/node/contexts/ErrorReporter/Context.cjs.map +0 -1
  85. package/dist/node/contexts/ErrorReporter/Context.js +0 -7
  86. package/dist/node/contexts/ErrorReporter/Context.js.map +0 -1
  87. package/dist/node/contexts/ErrorReporter/Provider.cjs +0 -47
  88. package/dist/node/contexts/ErrorReporter/Provider.cjs.map +0 -1
  89. package/dist/node/contexts/ErrorReporter/Provider.js +0 -22
  90. package/dist/node/contexts/ErrorReporter/Provider.js.map +0 -1
  91. package/dist/node/contexts/ErrorReporter/State.cjs +0 -19
  92. package/dist/node/contexts/ErrorReporter/State.cjs.map +0 -1
  93. package/dist/node/contexts/ErrorReporter/State.js +0 -1
  94. package/dist/node/contexts/ErrorReporter/State.js.map +0 -1
  95. package/dist/node/contexts/ErrorReporter/index.cjs +0 -61
  96. package/dist/node/contexts/ErrorReporter/index.cjs.map +0 -1
  97. package/dist/node/contexts/ErrorReporter/index.js +0 -33
  98. package/dist/node/contexts/ErrorReporter/index.js.map +0 -1
  99. package/dist/node/contexts/ErrorReporter/useRollbar.cjs +0 -44
  100. package/dist/node/contexts/ErrorReporter/useRollbar.cjs.map +0 -1
  101. package/dist/node/contexts/ErrorReporter/useRollbar.js +0 -19
  102. package/dist/node/contexts/ErrorReporter/useRollbar.js.map +0 -1
  103. package/dist/node/contexts/index.cjs +0 -61
  104. package/dist/node/contexts/index.cjs.map +0 -1
  105. package/dist/node/contexts/index.js +0 -33
  106. package/dist/node/contexts/index.js.map +0 -1
@@ -1,70 +0,0 @@
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?.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
- //# sourceMappingURL=Render.cjs.map
@@ -1 +0,0 @@
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,iBAAO,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"]}
@@ -1,49 +0,0 @@
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?.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
- ] });
19
- };
20
-
21
- // src/components/ErrorRender/Render.tsx
22
- import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
23
- var ErrorRender = ({
24
- onCancel,
25
- error,
26
- noErrorDisplay = false,
27
- customError = null,
28
- children,
29
- errorContext,
30
- ...props
31
- }) => {
32
- const location = useLocation();
33
- useEffect(() => {
34
- location.state = {
35
- from: {
36
- pathname: window.location.pathname
37
- }
38
- };
39
- }, [location]);
40
- if (error) {
41
- return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel }) }) });
42
- } else {
43
- return /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
44
- }
45
- };
46
- export {
47
- ErrorRender
48
- };
49
- //# sourceMappingURL=Render.js.map
@@ -1 +0,0 @@
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,iBAAO,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"]}
@@ -1,71 +0,0 @@
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?.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
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
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,iBAAO,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"]}
@@ -1,48 +0,0 @@
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?.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;
42
- }
43
- };
44
- export {
45
- ErrorAlert,
46
- ErrorRender
47
- };
48
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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,iBAAO,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"]}
@@ -1,110 +0,0 @@
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/index.ts
21
- var components_exports = {};
22
- __export(components_exports, {
23
- ErrorAlert: () => ErrorAlert,
24
- ErrorRender: () => ErrorRender,
25
- ThrownErrorBoundary: () => ThrownErrorBoundary
26
- });
27
- module.exports = __toCommonJS(components_exports);
28
-
29
- // src/components/ErrorBoundary/ThrownErrorBoundary.tsx
30
- var import_payload_model = require("@xyo-network/payload-model");
31
- var import_react2 = require("react");
32
-
33
- // src/components/ErrorRender/ErrorAlert.tsx
34
- var import_icons_material = require("@mui/icons-material");
35
- var import_material = require("@mui/material");
36
- var import_react_button = require("@xylabs/react-button");
37
- var import_jsx_runtime = require("react/jsx-runtime");
38
- var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
39
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Alert, { severity: "error", ...props, children: [
40
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AlertTitle, { children: "Whoops! Something went wrong" }),
41
- errorContext ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
42
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
43
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "caption", children: error?.message }),
44
- 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
45
- ] });
46
- };
47
-
48
- // src/components/ErrorRender/Render.tsx
49
- var import_react_flexbox = require("@xylabs/react-flexbox");
50
- var import_react = require("react");
51
- var import_react_router_dom = require("react-router-dom");
52
- var import_jsx_runtime2 = require("react/jsx-runtime");
53
- var ErrorRender = ({
54
- onCancel,
55
- error,
56
- noErrorDisplay = false,
57
- customError = null,
58
- children,
59
- errorContext,
60
- ...props
61
- }) => {
62
- const location = (0, import_react_router_dom.useLocation)();
63
- (0, import_react.useEffect)(() => {
64
- location.state = {
65
- from: {
66
- pathname: window.location.pathname
67
- }
68
- };
69
- }, [location]);
70
- if (error) {
71
- 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 }) }) });
72
- } else {
73
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children }) ?? null;
74
- }
75
- };
76
-
77
- // src/components/ErrorBoundary/ThrownErrorBoundary.tsx
78
- var import_jsx_runtime3 = require("react/jsx-runtime");
79
- var ThrownErrorBoundary = class _ThrownErrorBoundary extends import_react2.Component {
80
- state = {
81
- xyoError: void 0
82
- };
83
- static getDerivedStateFromError(error) {
84
- return { hasError: true, xyoError: _ThrownErrorBoundary.normalizeError(error) };
85
- }
86
- static normalizeError(error) {
87
- return error.schema === import_payload_model.ModuleErrorSchema ? error : { message: error.message, schema: import_payload_model.ModuleErrorSchema, sources: [] };
88
- }
89
- componentDidCatch(error, errorInfo) {
90
- const { rethrow, rollbar } = this.props;
91
- const { xyoError } = this.state;
92
- rollbar?.error(error);
93
- console.error("Error:", xyoError, errorInfo);
94
- if (rethrow) {
95
- throw error;
96
- }
97
- }
98
- render() {
99
- const { xyoError } = this.state;
100
- const { children, boundaryName, errorComponent } = this.props;
101
- if (xyoError) {
102
- if (errorComponent) {
103
- return errorComponent(xyoError);
104
- }
105
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary` });
106
- }
107
- return children;
108
- }
109
- };
110
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/index.ts","../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../../src/components/ErrorRender/ErrorAlert.tsx","../../../src/components/ErrorRender/Render.tsx"],"sourcesContent":["export * from './ErrorBoundary'\nexport * from './ErrorRender'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n public override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n public static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ? error : { message: error.message, schema: ModuleErrorSchema, sources: [] }\n ) as ModuleError\n }\n\n public override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n public override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} />\n }\n\n return children\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","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;AAAA;;;ACAA,2BAA+C;AAC/C,IAAAA,gBAAgD;;;ACDhD,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,iBAAO,SAAQ;AAAA,IAC7C,WACC,4CAAC,gCAAS,SAAQ,YAAW,MAAK,SAAQ,SAAS,UAAU,UAAS,YAAW,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GACzG,sDAAC,sBAAAC,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;;;AFWa,IAAAC,sBAAA;AAlCN,IAAM,sBAAN,MAAM,6BAA4B,wBAA8D;AAAA,EACrF,QAAkC;AAAA,IAChD,UAAU;AAAA,EACZ;AAAA,EAEA,OAAO,yBAAyB,OAAc;AAC5C,WAAO,EAAE,UAAU,MAAM,UAAU,qBAAoB,eAAe,KAAK,EAAE;AAAA,EAC/E;AAAA,EAEA,OAAc,eAAe,OAAyC;AACpE,WACG,MAAsB,WAAW,yCAAoB,QAAQ,EAAE,SAAS,MAAM,SAAS,QAAQ,wCAAmB,SAAS,CAAC,EAAE;AAAA,EAEnI;AAAA,EAEgB,kBAAkB,OAAc,WAAsB;AACpE,UAAM,EAAE,SAAS,QAAQ,IAAI,KAAK;AAClC,UAAM,EAAE,SAAS,IAAI,KAAK;AAE1B,aAAS,MAAM,KAAK;AAEpB,YAAQ,MAAM,UAAU,UAAU,SAAS;AAC3C,QAAI,SAAS;AACX,YAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEgB,SAAS;AACvB,UAAM,EAAE,SAAS,IAAI,KAAK;AAC1B,UAAM,EAAE,UAAU,cAAc,eAAe,IAAI,KAAK;AACxD,QAAI,UAAU;AACZ,UAAI,gBAAgB;AAClB,eAAO,eAAe,QAAQ;AAAA,MAChC;AACA,aAAO,6CAAC,eAAY,OAAO,UAAU,cAAc,GAAG,YAAY,aAAa;AAAA,IACjF;AAEA,WAAO;AAAA,EACT;AACF;","names":["import_react","ExitIcon","import_jsx_runtime","import_jsx_runtime"]}
@@ -1,87 +0,0 @@
1
- // src/components/ErrorBoundary/ThrownErrorBoundary.tsx
2
- import { ModuleErrorSchema } from "@xyo-network/payload-model";
3
- import { Component } from "react";
4
-
5
- // src/components/ErrorRender/ErrorAlert.tsx
6
- import { ExitToApp as ExitIcon } from "@mui/icons-material";
7
- import { Alert, AlertTitle, Typography } from "@mui/material";
8
- import { ButtonEx } from "@xylabs/react-button";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var ErrorAlert = ({ onCancel, error, errorContext, ...props }) => {
11
- return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...props, children: [
12
- /* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
13
- errorContext ? /* @__PURE__ */ jsx(Typography, { variant: "caption", my: 0.5, lineHeight: "1", display: "block", children: errorContext }) : null,
14
- /* @__PURE__ */ jsx(Typography, { variant: "caption", mr: 0.5, fontWeight: "bold", children: "Error:" }),
15
- /* @__PURE__ */ jsx(Typography, { variant: "caption", children: error?.message }),
16
- onCancel ? /* @__PURE__ */ jsx(ButtonEx, { variant: "outlined", size: "small", onClick: onCancel, position: "absolute", style: { right: 8, top: 8 }, children: /* @__PURE__ */ jsx(ExitIcon, { fontSize: "small" }) }) : null
17
- ] });
18
- };
19
-
20
- // src/components/ErrorRender/Render.tsx
21
- import { FlexCol } from "@xylabs/react-flexbox";
22
- import { useEffect } from "react";
23
- import { useLocation } from "react-router-dom";
24
- import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
25
- var ErrorRender = ({
26
- onCancel,
27
- error,
28
- noErrorDisplay = false,
29
- customError = null,
30
- children,
31
- errorContext,
32
- ...props
33
- }) => {
34
- const location = useLocation();
35
- useEffect(() => {
36
- location.state = {
37
- from: {
38
- pathname: window.location.pathname
39
- }
40
- };
41
- }, [location]);
42
- if (error) {
43
- return /* @__PURE__ */ jsx2(FlexCol, { alignItems: "stretch", ...props, children: noErrorDisplay ? customError : /* @__PURE__ */ jsx2(FlexCol, { alignItems: "center", ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error, errorContext, onCancel }) }) });
44
- } else {
45
- return /* @__PURE__ */ jsx2(Fragment, { children }) ?? null;
46
- }
47
- };
48
-
49
- // src/components/ErrorBoundary/ThrownErrorBoundary.tsx
50
- import { jsx as jsx3 } from "react/jsx-runtime";
51
- var ThrownErrorBoundary = class _ThrownErrorBoundary extends Component {
52
- state = {
53
- xyoError: void 0
54
- };
55
- static getDerivedStateFromError(error) {
56
- return { hasError: true, xyoError: _ThrownErrorBoundary.normalizeError(error) };
57
- }
58
- static normalizeError(error) {
59
- return error.schema === ModuleErrorSchema ? error : { message: error.message, schema: ModuleErrorSchema, sources: [] };
60
- }
61
- componentDidCatch(error, errorInfo) {
62
- const { rethrow, rollbar } = this.props;
63
- const { xyoError } = this.state;
64
- rollbar?.error(error);
65
- console.error("Error:", xyoError, errorInfo);
66
- if (rethrow) {
67
- throw error;
68
- }
69
- }
70
- render() {
71
- const { xyoError } = this.state;
72
- const { children, boundaryName, errorComponent } = this.props;
73
- if (xyoError) {
74
- if (errorComponent) {
75
- return errorComponent(xyoError);
76
- }
77
- return /* @__PURE__ */ jsx3(ErrorRender, { error: xyoError, errorContext: `${boundaryName} Boundary` });
78
- }
79
- return children;
80
- }
81
- };
82
- export {
83
- ErrorAlert,
84
- ErrorRender,
85
- ThrownErrorBoundary
86
- };
87
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../../src/components/ErrorRender/ErrorAlert.tsx","../../../src/components/ErrorRender/Render.tsx"],"sourcesContent":["import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n public override state: ThrownErrorBoundaryState = {\n xyoError: undefined,\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, xyoError: ThrownErrorBoundary.normalizeError(error) } as ThrownErrorBoundaryState\n }\n\n public static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ? error : { message: error.message, schema: ModuleErrorSchema, sources: [] }\n ) as ModuleError\n }\n\n public override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n const { rethrow, rollbar } = this.props\n const { xyoError } = this.state\n\n rollbar?.error(error)\n\n console.error('Error:', xyoError, errorInfo)\n if (rethrow) {\n throw error\n }\n }\n\n public override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} />\n }\n\n return children\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","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,SAAsB,yBAAyB;AAC/C,SAAS,iBAAuC;;;ACDhD,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,iBAAO,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;;;AFWa,gBAAAC,YAAA;AAlCN,IAAM,sBAAN,MAAM,6BAA4B,UAA8D;AAAA,EACrF,QAAkC;AAAA,IAChD,UAAU;AAAA,EACZ;AAAA,EAEA,OAAO,yBAAyB,OAAc;AAC5C,WAAO,EAAE,UAAU,MAAM,UAAU,qBAAoB,eAAe,KAAK,EAAE;AAAA,EAC/E;AAAA,EAEA,OAAc,eAAe,OAAyC;AACpE,WACG,MAAsB,WAAW,oBAAoB,QAAQ,EAAE,SAAS,MAAM,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE;AAAA,EAEnI;AAAA,EAEgB,kBAAkB,OAAc,WAAsB;AACpE,UAAM,EAAE,SAAS,QAAQ,IAAI,KAAK;AAClC,UAAM,EAAE,SAAS,IAAI,KAAK;AAE1B,aAAS,MAAM,KAAK;AAEpB,YAAQ,MAAM,UAAU,UAAU,SAAS;AAC3C,QAAI,SAAS;AACX,YAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEgB,SAAS;AACvB,UAAM,EAAE,SAAS,IAAI,KAAK;AAC1B,UAAM,EAAE,UAAU,cAAc,eAAe,IAAI,KAAK;AACxD,QAAI,UAAU;AACZ,UAAI,gBAAgB;AAClB,eAAO,eAAe,QAAQ;AAAA,MAChC;AACA,aAAO,gBAAAA,KAAC,eAAY,OAAO,UAAU,cAAc,GAAG,YAAY,aAAa;AAAA,IACjF;AAEA,WAAO;AAAA,EACT;AACF;","names":["jsx","jsx"]}
@@ -1,28 +0,0 @@
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/contexts/ErrorReporter/Context.ts
21
- var Context_exports = {};
22
- __export(Context_exports, {
23
- ErrorReporterContext: () => ErrorReporterContext
24
- });
25
- module.exports = __toCommonJS(Context_exports);
26
- var import_react = require("react");
27
- var ErrorReporterContext = (0, import_react.createContext)({});
28
- //# sourceMappingURL=Context.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/contexts/ErrorReporter/Context.ts"],"sourcesContent":["import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAIvB,IAAM,2BAAuB,4BAAyC,CAAC,CAAC;","names":[]}
@@ -1,7 +0,0 @@
1
- // src/contexts/ErrorReporter/Context.ts
2
- import { createContext } from "react";
3
- var ErrorReporterContext = createContext({});
4
- export {
5
- ErrorReporterContext
6
- };
7
- //# sourceMappingURL=Context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/contexts/ErrorReporter/Context.ts"],"sourcesContent":["import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n"],"mappings":";AAAA,SAAS,qBAAqB;AAIvB,IAAM,uBAAuB,cAAyC,CAAC,CAAC;","names":[]}
@@ -1,43 +0,0 @@
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/contexts/ErrorReporter/Provider.tsx
21
- var Provider_exports = {};
22
- __export(Provider_exports, {
23
- ErrorReporterProvider: () => ErrorReporterProvider
24
- });
25
- module.exports = __toCommonJS(Provider_exports);
26
- var import_react2 = require("react");
27
-
28
- // src/contexts/ErrorReporter/Context.ts
29
- var import_react = require("react");
30
- var ErrorReporterContext = (0, import_react.createContext)({});
31
-
32
- // src/contexts/ErrorReporter/Provider.tsx
33
- var import_jsx_runtime = require("react/jsx-runtime");
34
- var ErrorReporterProvider = ({ children, rollbar }) => {
35
- const [rollbarInstance, setRollBarInstance] = (0, import_react2.useState)();
36
- (0, import_react2.useEffect)(() => {
37
- if (rollbarInstance) {
38
- setRollBarInstance(rollbarInstance);
39
- }
40
- }, [rollbar, rollbarInstance]);
41
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorReporterContext.Provider, { value: { rollbar }, children });
42
- };
43
- //# sourceMappingURL=Provider.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/contexts/ErrorReporter/Provider.tsx","../../../../src/contexts/ErrorReporter/Context.ts"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context'\n\nexport interface ErrorReporterProviderProps {\n rollbar: Rollbar\n}\n\nconst ErrorReporterProvider: React.FC<WithChildren<ErrorReporterProviderProps>> = ({ children, rollbar }) => {\n const [rollbarInstance, setRollBarInstance] = useState<Rollbar>()\n\n useEffect(() => {\n if (rollbarInstance) {\n setRollBarInstance(rollbarInstance)\n }\n }, [rollbar, rollbarInstance])\n\n return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>\n}\n\nexport { ErrorReporterProvider }\n","import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAAoC;;;ACDpC,mBAA8B;AAIvB,IAAM,2BAAuB,4BAAyC,CAAC,CAAC;;;ADetE;AATT,IAAM,wBAA4E,CAAC,EAAE,UAAU,QAAQ,MAAM;AAC3G,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,wBAAkB;AAEhE,+BAAU,MAAM;AACd,QAAI,iBAAiB;AACnB,yBAAmB,eAAe;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,SAAS,eAAe,CAAC;AAE7B,SAAO,4CAAC,qBAAqB,UAArB,EAA8B,OAAO,EAAE,QAAQ,GAAI,UAAS;AACtE;","names":["import_react"]}
@@ -1,22 +0,0 @@
1
- // src/contexts/ErrorReporter/Provider.tsx
2
- import { useEffect, useState } from "react";
3
-
4
- // src/contexts/ErrorReporter/Context.ts
5
- import { createContext } from "react";
6
- var ErrorReporterContext = createContext({});
7
-
8
- // src/contexts/ErrorReporter/Provider.tsx
9
- import { jsx } from "react/jsx-runtime";
10
- var ErrorReporterProvider = ({ children, rollbar }) => {
11
- const [rollbarInstance, setRollBarInstance] = useState();
12
- useEffect(() => {
13
- if (rollbarInstance) {
14
- setRollBarInstance(rollbarInstance);
15
- }
16
- }, [rollbar, rollbarInstance]);
17
- return /* @__PURE__ */ jsx(ErrorReporterContext.Provider, { value: { rollbar }, children });
18
- };
19
- export {
20
- ErrorReporterProvider
21
- };
22
- //# sourceMappingURL=Provider.js.map