@xyo-network/react-error 4.4.10 → 5.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/browser/index.mjs +3 -3
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/types/components/ErrorBoundary/ThrownErrorBoundary.d.ts +5 -0
  4. package/dist/types/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -0
  5. package/dist/types/components/ErrorBoundary/ThrownErrorBoundaryBase.d.ts +21 -0
  6. package/dist/types/components/ErrorBoundary/ThrownErrorBoundaryBase.d.ts.map +1 -0
  7. package/dist/types/components/ErrorBoundary/index.d.ts +2 -0
  8. package/dist/types/components/ErrorBoundary/index.d.ts.map +1 -0
  9. package/dist/types/components/ErrorBoundary.d.ts +23 -0
  10. package/dist/types/components/ErrorBoundary.d.ts.map +1 -0
  11. package/dist/types/components/ErrorRender/ErrorAlert.d.ts +10 -0
  12. package/dist/types/components/ErrorRender/ErrorAlert.d.ts.map +1 -0
  13. package/dist/types/components/ErrorRender/Props.d.ts +15 -0
  14. package/dist/types/components/ErrorRender/Props.d.ts.map +1 -0
  15. package/dist/types/components/ErrorRender/Render.d.ts +3 -0
  16. package/dist/types/components/ErrorRender/Render.d.ts.map +1 -0
  17. package/dist/types/components/ErrorRender/index.d.ts +4 -0
  18. package/dist/types/components/ErrorRender/index.d.ts.map +1 -0
  19. package/dist/types/components/index.d.ts +4 -0
  20. package/dist/types/components/index.d.ts.map +1 -0
  21. package/dist/types/contexts/ErrorReporter/Context.d.ts +4 -0
  22. package/dist/types/contexts/ErrorReporter/Context.d.ts.map +1 -0
  23. package/dist/types/contexts/ErrorReporter/Provider.d.ts +10 -0
  24. package/dist/types/contexts/ErrorReporter/Provider.d.ts.map +1 -0
  25. package/dist/types/contexts/ErrorReporter/State.d.ts +6 -0
  26. package/dist/types/contexts/ErrorReporter/State.d.ts.map +1 -0
  27. package/dist/types/contexts/ErrorReporter/index.d.ts +4 -0
  28. package/dist/types/contexts/ErrorReporter/index.d.ts.map +1 -0
  29. package/dist/types/contexts/ErrorReporter/useErrorReporter.d.ts +3 -0
  30. package/dist/types/contexts/ErrorReporter/useErrorReporter.d.ts.map +1 -0
  31. package/dist/types/contexts/index.d.ts +2 -0
  32. package/dist/types/contexts/index.d.ts.map +1 -0
  33. package/dist/types/index.d.ts +3 -0
  34. package/dist/types/index.d.ts.map +1 -0
  35. package/package.json +23 -21
  36. package/src/contexts/ErrorReporter/Provider.tsx +1 -1
  37. package/src/contexts/ErrorReporter/useErrorReporter.tsx +2 -2
  38. package/dist/browser/index.d.ts +0 -63
@@ -141,7 +141,7 @@ var ErrorReporterProvider = /* @__PURE__ */ __name(({ children, rollbar: rollbar
141
141
  if (!rollbar) {
142
142
  throw new Error("ErrorReporterProvider unable to find a Rollbar instance either passed as prop or from Provider");
143
143
  }
144
- return /* @__PURE__ */ React5.createElement(ErrorReporterContext.Provider, {
144
+ return /* @__PURE__ */ React5.createElement(ErrorReporterContext, {
145
145
  value: {
146
146
  rollbar
147
147
  }
@@ -149,9 +149,9 @@ var ErrorReporterProvider = /* @__PURE__ */ __name(({ children, rollbar: rollbar
149
149
  }, "ErrorReporterProvider");
150
150
 
151
151
  // src/contexts/ErrorReporter/useErrorReporter.tsx
152
- import { useContext } from "react";
152
+ import { use } from "react";
153
153
  var useErrorReporter = /* @__PURE__ */ __name(() => {
154
- const context = useContext(ErrorReporterContext);
154
+ const context = use(ErrorReporterContext);
155
155
  if (context === void 0) {
156
156
  console.warn("useErrorReporter must be used within a ErrorReporterContext");
157
157
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/ErrorBoundary.tsx","../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useErrorReporter.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { ErrorInfo, ReactNode } from 'react'\nimport React, { Component } from 'react'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport interface ErrorBoundaryProps {\n children: ReactNode\n // fallback as a static ReactNode value\n fallback?: ReactNode\n // fallback element that can receive the error as a prop\n fallbackWithError?: (error: Error) => ReactNode\n scope?: string\n}\n\n/** @deprecated use from @xylabs/react-error instead */\nexport interface ErrorBoundaryState {\n error?: Error\n}\n\n/** @deprecated use from @xylabs/react-error instead */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props)\n this.state = { error: undefined }\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error(`${error}: ${errorInfo}`)\n }\n\n override render() {\n if (this.state.error) {\n if (this.props.fallbackWithError) {\n return this.props.fallbackWithError(this.state.error)\n }\n return (\n this.props.fallback ?? (\n <FlexCol>\n <Typography variant=\"h1\">Something went wrong.</Typography>\n {this.props.scope && (\n <Typography variant=\"h2\">\n [\n {this.props.scope}\n ]\n </Typography>\n )}\n <Typography variant=\"body1\">\n [\n {this.state.error?.message}\n ]\n </Typography>\n </FlexCol>\n )\n )\n }\n\n return this.props.children\n }\n}\n","import type { ThrownErrorBoundaryProps } from '@xylabs/react-error'\nimport { ThrownErrorBoundary as ThrownErrorBoundaryBase } from '@xylabs/react-error'\nimport type { ModuleError } from '@xyo-network/payload-model'\nimport type { FC } from 'react'\nimport React from 'react'\n\nexport const ThrownErrorBoundary: FC<ThrownErrorBoundaryProps<ModuleError>> = (props) => {\n return <ThrownErrorBoundaryBase<ModuleError> {...props} />\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport type { AlertProps } from '@mui/material'\nimport {\n Alert, AlertTitle, Typography,\n} from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport React from 'react'\n\nexport interface ErrorAlertProps<T = void> extends AlertProps {\n error?: T | Error | string\n /** @deprecated use scope instead */\n errorContext?: string\n onCancel?: () => void\n scope?: string\n}\n\nexport function ErrorAlert<T = void>({\n title = 'Whoops! Something went wrong',\n onCancel,\n error = 'An unknown error occurred',\n errorContext,\n scope,\n ...props\n}: ErrorAlertProps<T>): JSX.Element {\n const finalScope = scope ?? errorContext\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>{title}</AlertTitle>\n {finalScope\n ? (\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Scope:\n </Typography>\n <Typography variant=\"caption\">{finalScope}</Typography>\n </div>\n )\n : null}\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{typeof error === 'string' ? error : (error as Error)?.message}</Typography>\n </div>\n {onCancel\n ? (\n <ButtonEx\n variant=\"outlined\"\n size=\"small\"\n onClick={onCancel}\n position=\"absolute\"\n style={{ right: 8, top: 8 }}\n >\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n )\n : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport React, { useEffect } from 'react'\n\nimport { ErrorAlert } from './ErrorAlert.tsx'\nimport type { ErrorRenderProps } from './Props.ts'\n\nexport function ErrorRender<T = void>({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}: ErrorRenderProps<T>): JSX.Element {\n const location = useLocation?.()\n useEffect(() => {\n if (location) {\n // ensure we end up at the same place we are now after logging in\n location.state = { from: { pathname: globalThis.location.pathname } }\n }\n }, [location])\n\n useEffect(() => {\n if (error) {\n globalThis.rollbar?.error(error)\n }\n }, [error])\n\n return error\n ? (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay\n ? customError\n : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} scope={scope} />\n </FlexCol>\n )}\n </FlexCol>\n )\n : <>{children}</>\n}\n","import { useRollbar } from '@rollbar/react'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\nimport type Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.ts'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport interface ErrorReporterProviderProps {\n rollbar: Rollbar\n}\n/** @deprecated use from @xylabs/react-error instead */\nexport const ErrorReporterProvider: React.FC<PropsWithChildren<ErrorReporterProviderProps>> = ({ children, rollbar: rollbarProp }) => {\n let rollbarFromHook: Rollbar | undefined\n // safely call the hook\n try {\n rollbarFromHook = useRollbar()\n } catch {}\n\n const rollbar = rollbarProp ?? rollbarFromHook\n\n if (!rollbar) {\n throw new Error('ErrorReporterProvider unable to find a Rollbar instance either passed as prop or from Provider')\n }\n\n // eslint-disable-next-line @eslint-react/no-unstable-context-value\n return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>\n}\n","import { createContext } from 'react'\n\nimport type { ErrorReporterContextState } from './State.ts'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { useContext } from 'react'\n\nimport { ErrorReporterContext } from './Context.ts'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport const useErrorReporter = () => {\n const context = useContext(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useErrorReporter must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n"],"mappings":";;;;AAAA,SAASA,kBAAkB;AAC3B,SAASC,eAAe;AAExB,OAAOC,SAASC,iBAAiB;AAkB1B,IAAMC,gBAAN,cAA4BC,UAAAA;EArBnC,OAqBmCA;;;EACjCC,YAAYC,OAA2B;AACrC,UAAMA,KAAAA;AACN,SAAKC,QAAQ;MAAEC,OAAOC;IAAU;EAClC;EAEA,OAAOC,yBAAyBF,OAAc;AAC5C,WAAO;MAAEA;IAAM;EAC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NhB,SAASqB,kBAAkB;AAE3B,OAAOC,YAAW;;;ACFlB,SAASC,qBAAqB;AAKvB,IAAMC,uBAAuBD,cAAyC,CAAC,CAAA;;;ADOvE,IAAME,wBAAiF,wBAAC,EAAEC,UAAUC,SAASC,YAAW,MAAE;AAC/H,MAAIC;AAEJ,MAAI;AACFA,sBAAkBC,WAAAA;EACpB,QAAQ;EAAC;AAET,QAAMH,UAAUC,eAAeC;AAE/B,MAAI,CAACF,SAAS;AACZ,UAAM,IAAII,MAAM,gGAAA;EAClB;AAGA,SAAO,gBAAAC,OAAA,cAACC,qBAAqBC,UAAQ;IAACC,OAAO;MAAER;IAAQ;KAAID,QAAAA;AAC7D,GAf8F;;;AEZ9F,SAASU,kBAAkB;AAKpB,IAAMC,mBAAmB,6BAAA;AAC9B,QAAMC,UAAUC,WAAWC,oBAAAA;AAC3B,MAAIF,YAAYG,QAAW;AACzBC,YAAQC,KAAK,6DAAA;EACf;AAEA,SAAOL,WAAW,CAAC;AACrB,GAPgC;","names":["Typography","FlexCol","React","Component","ErrorBoundary","Component","constructor","props","state","error","undefined","getDerivedStateFromError","componentDidCatch","errorInfo","console","render","fallbackWithError","fallback","FlexCol","Typography","variant","scope","message","children","ThrownErrorBoundary","ThrownErrorBoundaryBase","React","ThrownErrorBoundary","props","React","ThrownErrorBoundaryBase","ExitToApp","ExitIcon","Alert","AlertTitle","Typography","ButtonEx","React","ErrorAlert","title","onCancel","error","errorContext","scope","props","finalScope","React","Alert","severity","AlertTitle","div","Typography","variant","mr","fontWeight","message","ButtonEx","size","onClick","position","style","right","top","ExitIcon","fontSize","FlexCol","React","useEffect","ErrorRender","onCancel","error","noErrorDisplay","customError","children","errorContext","scope","useLocation","props","location","useEffect","state","from","pathname","globalThis","rollbar","React","FlexCol","alignItems","ErrorAlert","useRollbar","React","createContext","ErrorReporterContext","ErrorReporterProvider","children","rollbar","rollbarProp","rollbarFromHook","useRollbar","Error","React","ErrorReporterContext","Provider","value","useContext","useErrorReporter","context","useContext","ErrorReporterContext","undefined","console","warn"]}
1
+ {"version":3,"sources":["../../src/components/ErrorBoundary.tsx","../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx","../../src/components/ErrorRender/ErrorAlert.tsx","../../src/components/ErrorRender/Render.tsx","../../src/contexts/ErrorReporter/Provider.tsx","../../src/contexts/ErrorReporter/Context.ts","../../src/contexts/ErrorReporter/useErrorReporter.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport type { ErrorInfo, ReactNode } from 'react'\nimport React, { Component } from 'react'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport interface ErrorBoundaryProps {\n children: ReactNode\n // fallback as a static ReactNode value\n fallback?: ReactNode\n // fallback element that can receive the error as a prop\n fallbackWithError?: (error: Error) => ReactNode\n scope?: string\n}\n\n/** @deprecated use from @xylabs/react-error instead */\nexport interface ErrorBoundaryState {\n error?: Error\n}\n\n/** @deprecated use from @xylabs/react-error instead */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps) {\n super(props)\n this.state = { error: undefined }\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n\n override componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error(`${error}: ${errorInfo}`)\n }\n\n override render() {\n if (this.state.error) {\n if (this.props.fallbackWithError) {\n return this.props.fallbackWithError(this.state.error)\n }\n return (\n this.props.fallback ?? (\n <FlexCol>\n <Typography variant=\"h1\">Something went wrong.</Typography>\n {this.props.scope && (\n <Typography variant=\"h2\">\n [\n {this.props.scope}\n ]\n </Typography>\n )}\n <Typography variant=\"body1\">\n [\n {this.state.error?.message}\n ]\n </Typography>\n </FlexCol>\n )\n )\n }\n\n return this.props.children\n }\n}\n","import type { ThrownErrorBoundaryProps } from '@xylabs/react-error'\nimport { ThrownErrorBoundary as ThrownErrorBoundaryBase } from '@xylabs/react-error'\nimport type { ModuleError } from '@xyo-network/payload-model'\nimport type { FC } from 'react'\nimport React from 'react'\n\nexport const ThrownErrorBoundary: FC<ThrownErrorBoundaryProps<ModuleError>> = (props) => {\n return <ThrownErrorBoundaryBase<ModuleError> {...props} />\n}\n","import { ExitToApp as ExitIcon } from '@mui/icons-material'\nimport type { AlertProps } from '@mui/material'\nimport {\n Alert, AlertTitle, Typography,\n} from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport React from 'react'\n\nexport interface ErrorAlertProps<T = void> extends AlertProps {\n error?: T | Error | string\n /** @deprecated use scope instead */\n errorContext?: string\n onCancel?: () => void\n scope?: string\n}\n\nexport function ErrorAlert<T = void>({\n title = 'Whoops! Something went wrong',\n onCancel,\n error = 'An unknown error occurred',\n errorContext,\n scope,\n ...props\n}: ErrorAlertProps<T>): JSX.Element {\n const finalScope = scope ?? errorContext\n return (\n <Alert severity=\"error\" {...props}>\n <AlertTitle>{title}</AlertTitle>\n {finalScope\n ? (\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Scope:\n </Typography>\n <Typography variant=\"caption\">{finalScope}</Typography>\n </div>\n )\n : null}\n <div>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Error:\n </Typography>\n <Typography variant=\"caption\">{typeof error === 'string' ? error : (error as Error)?.message}</Typography>\n </div>\n {onCancel\n ? (\n <ButtonEx\n variant=\"outlined\"\n size=\"small\"\n onClick={onCancel}\n position=\"absolute\"\n style={{ right: 8, top: 8 }}\n >\n <ExitIcon fontSize=\"small\" />\n </ButtonEx>\n )\n : null}\n </Alert>\n )\n}\n","import { FlexCol } from '@xylabs/react-flexbox'\nimport React, { useEffect } from 'react'\n\nimport { ErrorAlert } from './ErrorAlert.tsx'\nimport type { ErrorRenderProps } from './Props.ts'\n\nexport function ErrorRender<T = void>({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}: ErrorRenderProps<T>): JSX.Element {\n const location = useLocation?.()\n useEffect(() => {\n if (location) {\n // ensure we end up at the same place we are now after logging in\n location.state = { from: { pathname: globalThis.location.pathname } }\n }\n }, [location])\n\n useEffect(() => {\n if (error) {\n globalThis.rollbar?.error(error)\n }\n }, [error])\n\n return error\n ? (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay\n ? customError\n : (\n <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} scope={scope} />\n </FlexCol>\n )}\n </FlexCol>\n )\n : <>{children}</>\n}\n","import { useRollbar } from '@rollbar/react'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\nimport type Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.ts'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport interface ErrorReporterProviderProps {\n rollbar: Rollbar\n}\n/** @deprecated use from @xylabs/react-error instead */\nexport const ErrorReporterProvider: React.FC<PropsWithChildren<ErrorReporterProviderProps>> = ({ children, rollbar: rollbarProp }) => {\n let rollbarFromHook: Rollbar | undefined\n // safely call the hook\n try {\n rollbarFromHook = useRollbar()\n } catch {}\n\n const rollbar = rollbarProp ?? rollbarFromHook\n\n if (!rollbar) {\n throw new Error('ErrorReporterProvider unable to find a Rollbar instance either passed as prop or from Provider')\n }\n\n // eslint-disable-next-line @eslint-react/no-unstable-context-value\n return <ErrorReporterContext value={{ rollbar }}>{children}</ErrorReporterContext>\n}\n","import { createContext } from 'react'\n\nimport type { ErrorReporterContextState } from './State.ts'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { use } from 'react'\n\nimport { ErrorReporterContext } from './Context.ts'\n\n/** @deprecated use from @xylabs/react-error instead */\nexport const useErrorReporter = () => {\n const context = use(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useErrorReporter must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n"],"mappings":";;;;AAAA,SAASA,kBAAkB;AAC3B,SAASC,eAAe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AAW,GAAGV;KAC/BN,iBACGC,cAEE,gBAAAa,OAAA,cAACC,UAAAA;IAAQC,YAAW;IAAU,GAAGV;KAC/B,gBAAAQ,OAAA,cAACG,YAAAA;IAAWlB;IAAcI;IAA4BL;IAAoBM;SAKtF,gBAAAU,OAAA,cAAAA,OAAA,UAAA,MAAGZ,QAAAA;AACT;AAtCgBL;;;ACNhB,SAASqB,kBAAkB;AAE3B,OAAOC,YAAW;;;ACFlB,SAASC,qBAAqB;AAKvB,IAAMC,uBAAuBD,cAAyC,CAAC,CAAA;;;ADOvE,IAAME,wBAAiF,wBAAC,EAAEC,UAAUC,SAASC,YAAW,MAAE;AAC/H,MAAIC;AAEJ,MAAI;AACFA,sBAAkBC,WAAAA;EACpB,QAAQ;EAAC;AAET,QAAMH,UAAUC,eAAeC;AAE/B,MAAI,CAACF,SAAS;AACZ,UAAM,IAAII,MAAM,gGAAA;EAClB;AAGA,SAAO,gBAAAC,OAAA,cAACC,sBAAAA;IAAqBC,OAAO;MAAEP;IAAQ;KAAID,QAAAA;AACpD,GAf8F;;;AEZ9F,SAASS,WAAW;AAKb,IAAMC,mBAAmB,6BAAA;AAC9B,QAAMC,UAAUC,IAAIC,oBAAAA;AACpB,MAAIF,YAAYG,QAAW;AACzBC,YAAQC,KAAK,6DAAA;EACf;AAEA,SAAOL,WAAW,CAAC;AACrB,GAPgC;","names":["Typography","FlexCol","React","Component","ErrorBoundary","Component","constructor","props","state","error","undefined","getDerivedStateFromError","componentDidCatch","errorInfo","console","render","fallbackWithError","fallback","FlexCol","Typography","variant","scope","message","children","ThrownErrorBoundary","ThrownErrorBoundaryBase","React","ThrownErrorBoundary","props","React","ThrownErrorBoundaryBase","ExitToApp","ExitIcon","Alert","AlertTitle","Typography","ButtonEx","React","ErrorAlert","title","onCancel","error","errorContext","scope","props","finalScope","React","Alert","severity","AlertTitle","div","Typography","variant","mr","fontWeight","message","ButtonEx","size","onClick","position","style","right","top","ExitIcon","fontSize","FlexCol","React","useEffect","ErrorRender","onCancel","error","noErrorDisplay","customError","children","errorContext","scope","useLocation","props","location","useEffect","state","from","pathname","globalThis","rollbar","React","FlexCol","alignItems","ErrorAlert","useRollbar","React","createContext","ErrorReporterContext","ErrorReporterProvider","children","rollbar","rollbarProp","rollbarFromHook","useRollbar","Error","React","ErrorReporterContext","value","use","useErrorReporter","context","use","ErrorReporterContext","undefined","console","warn"]}
@@ -0,0 +1,5 @@
1
+ import type { ThrownErrorBoundaryProps } from '@xylabs/react-error';
2
+ import type { ModuleError } from '@xyo-network/payload-model';
3
+ import type { FC } from 'react';
4
+ export declare const ThrownErrorBoundary: FC<ThrownErrorBoundaryProps<ModuleError>>;
5
+ //# sourceMappingURL=ThrownErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThrownErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAG/B,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAEzE,CAAA"}
@@ -0,0 +1,21 @@
1
+ import type { ReactNode } from 'react';
2
+ import type Rollbar from 'rollbar';
3
+ /** @deprecated use from @xylabs/react-error instead */
4
+ export type ErrorEx<T = void> = T extends void ? Error : T | Error;
5
+ /** @deprecated use from @xylabs/react-error instead */
6
+ export interface ThrownErrorBoundaryProps<T = void> {
7
+ boundaryName?: string;
8
+ children: ReactNode;
9
+ errorComponent?: (e: ErrorEx<T>, boundaryName?: string) => ReactNode;
10
+ rethrow?: boolean;
11
+ rollbar?: Rollbar;
12
+ scope?: string;
13
+ title?: string;
14
+ }
15
+ /** @deprecated use from @xylabs/react-error instead */
16
+ export interface ThrownErrorBoundaryState<T = void> {
17
+ errorEx?: ErrorEx<T>;
18
+ }
19
+ /** @deprecated use from @xylabs/react-error instead */
20
+ export declare function ThrownErrorBoundaryBase<T = void>({ rollbar, ...props }: ThrownErrorBoundaryProps<T>): JSX.Element;
21
+ //# sourceMappingURL=ThrownErrorBoundaryBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThrownErrorBoundaryBase.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/ThrownErrorBoundaryBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAKlC,uDAAuD;AACvD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,CAAA;AAElE,uDAAuD;AACvD,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,IAAI;IAChD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAA;IACpE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,uDAAuD;AACvD,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,IAAI;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;CACrB;AA0CD,uDAAuD;AACvD,wBAAgB,uBAAuB,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAQjH"}
@@ -0,0 +1,2 @@
1
+ export * from './ThrownErrorBoundary.tsx';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorBoundary/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,23 @@
1
+ import type { ErrorInfo, ReactNode } from 'react';
2
+ import React, { Component } from 'react';
3
+ /** @deprecated use from @xylabs/react-error instead */
4
+ export interface ErrorBoundaryProps {
5
+ children: ReactNode;
6
+ fallback?: ReactNode;
7
+ fallbackWithError?: (error: Error) => ReactNode;
8
+ scope?: string;
9
+ }
10
+ /** @deprecated use from @xylabs/react-error instead */
11
+ export interface ErrorBoundaryState {
12
+ error?: Error;
13
+ }
14
+ /** @deprecated use from @xylabs/react-error instead */
15
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
16
+ constructor(props: ErrorBoundaryProps);
17
+ static getDerivedStateFromError(error: Error): {
18
+ error: Error;
19
+ };
20
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
21
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
22
+ }
23
+ //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAExC,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAA;IAEnB,QAAQ,CAAC,EAAE,SAAS,CAAA;IAEpB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAA;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,uDAAuD;AACvD,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;gBACtE,KAAK,EAAE,kBAAkB;IAKrC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;IAInC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAIpD,MAAM;CA4BhB"}
@@ -0,0 +1,10 @@
1
+ import type { AlertProps } from '@mui/material';
2
+ export interface ErrorAlertProps<T = void> extends AlertProps {
3
+ error?: T | Error | string;
4
+ /** @deprecated use scope instead */
5
+ errorContext?: string;
6
+ onCancel?: () => void;
7
+ scope?: string;
8
+ }
9
+ export declare function ErrorAlert<T = void>({ title, onCancel, error, errorContext, scope, ...props }: ErrorAlertProps<T>): JSX.Element;
10
+ //# sourceMappingURL=ErrorAlert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO/C,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,UAAU;IAC3D,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,MAAM,CAAA;IAC1B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,UAAU,CAAC,CAAC,GAAG,IAAI,EAAE,EACnC,KAAsC,EACtC,QAAQ,EACR,KAAmC,EACnC,YAAY,EACZ,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAoClC"}
@@ -0,0 +1,15 @@
1
+ import type { FlexBoxProps } from '@xylabs/react-flexbox';
2
+ import type { ReactNode } from 'react';
3
+ import type { Location } from 'react-router-dom';
4
+ export type ErrorEx<T = void> = T extends void ? Error : T | Error;
5
+ export interface ErrorRenderProps<T = void> extends FlexBoxProps {
6
+ customError?: ReactNode;
7
+ error?: ErrorEx<T>;
8
+ errorContext?: string;
9
+ noErrorDisplay?: boolean;
10
+ noReAuth?: boolean;
11
+ onCancel?: () => void;
12
+ scope?: string;
13
+ useLocation?: () => Location;
14
+ }
15
+ //# 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,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEhD,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,CAAA;AAElE,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,YAAY;IAC9D,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAA;CAC7B"}
@@ -0,0 +1,3 @@
1
+ import type { ErrorRenderProps } from './Props.ts';
2
+ export declare function ErrorRender<T = void>({ onCancel, error, noErrorDisplay, customError, children, errorContext, scope, useLocation, ...props }: ErrorRenderProps<T>): JSX.Element;
3
+ //# sourceMappingURL=Render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,wBAAgB,WAAW,CAAC,CAAC,GAAG,IAAI,EAAE,EACpC,QAAQ,EACR,KAAK,EACL,cAAsB,EACtB,WAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CA4BnC"}
@@ -0,0 +1,4 @@
1
+ export * from './ErrorAlert.tsx';
2
+ export * from './Props.ts';
3
+ export * from './Render.tsx';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './ErrorBoundary.tsx';
2
+ export * from './ErrorBoundary/index.ts';
3
+ export * from './ErrorRender/index.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ErrorReporterContextState } from './State.ts';
2
+ /** @deprecated use from @xylabs/react-error instead */
3
+ export declare const ErrorReporterContext: import("react").Context<ErrorReporterContextState>;
4
+ //# sourceMappingURL=Context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,oDAA+C,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import React from 'react';
3
+ import type Rollbar from 'rollbar';
4
+ /** @deprecated use from @xylabs/react-error instead */
5
+ export interface ErrorReporterProviderProps {
6
+ rollbar: Rollbar;
7
+ }
8
+ /** @deprecated use from @xylabs/react-error instead */
9
+ export declare const ErrorReporterProvider: React.FC<PropsWithChildren<ErrorReporterProviderProps>>;
10
+ //# sourceMappingURL=Provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAIlC,uDAAuD;AACvD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAA;CACjB;AACD,uDAAuD;AACvD,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAezF,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type Rollbar from 'rollbar';
2
+ /** @deprecated use from @xylabs/react-error instead */
3
+ export interface ErrorReporterContextState {
4
+ rollbar?: Rollbar;
5
+ }
6
+ //# sourceMappingURL=State.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/State.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAElC,uDAAuD;AACvD,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB"}
@@ -0,0 +1,4 @@
1
+ export * from './Provider.tsx';
2
+ export * from './State.ts';
3
+ export * from './useErrorReporter.tsx';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** @deprecated use from @xylabs/react-error instead */
2
+ export declare const useErrorReporter: () => import("./State.ts").ErrorReporterContextState;
3
+ //# sourceMappingURL=useErrorReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useErrorReporter.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/useErrorReporter.tsx"],"names":[],"mappings":"AAIA,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,sDAO5B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './ErrorReporter/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './components/index.ts';
2
+ export * from './contexts/index.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-error",
3
- "version": "4.4.10",
3
+ "version": "5.0.0-rc.1",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -28,10 +28,10 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "browser": {
31
- "types": "./dist/browser/index.d.ts",
31
+ "types": "./dist/types/index.d.ts",
32
32
  "default": "./dist/browser/index.mjs"
33
33
  },
34
- "types": "./dist/browser/index.d.ts",
34
+ "types": "./dist/types/index.d.ts",
35
35
  "default": "./dist/browser/index.mjs"
36
36
  },
37
37
  "./package.json": "./package.json"
@@ -44,32 +44,33 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@rollbar/react": "^0.12.1",
47
- "@xylabs/react-button": "^5.3.23",
48
- "@xylabs/react-error": "^5.3.23",
49
- "@xylabs/react-flexbox": "^5.3.23",
50
- "@xyo-network/payload-model": "^3.9.17",
47
+ "@xylabs/react-button": "^6.0.0-rc.2",
48
+ "@xylabs/react-error": "^6.0.0-rc.2",
49
+ "@xylabs/react-flexbox": "^6.0.0-rc.2",
50
+ "@xyo-network/payload-model": "^3.9.35",
51
51
  "prop-types": "^15.8.1",
52
- "react-router-dom": "^7.2.0"
52
+ "react-router-dom": "^7.3.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@mui/icons-material": "^6.4.6",
56
- "@mui/material": "^6.4.6",
57
- "@mui/styles": "^6.4.6",
58
- "@storybook/react": "^8.6.2",
59
- "@xylabs/ts-scripts-yarn3": "^5.0.25",
60
- "@xylabs/tsconfig-react": "^5.0.25",
61
- "react": "^18.3.1",
62
- "react-dom": "^18.3.1",
55
+ "@mui/icons-material": "^6.4.7",
56
+ "@mui/material": "^6.4.7",
57
+ "@mui/styles": "^6.4.7",
58
+ "@storybook/react": "^8.6.4",
59
+ "@types/react": "^19.0.10",
60
+ "@xylabs/ts-scripts-yarn3": "^6.0.3",
61
+ "@xylabs/tsconfig-react": "^6.0.3",
62
+ "react": "^19.0.0",
63
+ "react-dom": "^19.0.0",
63
64
  "rollbar": "^2.26.4",
64
- "storybook": "^8.6.2",
65
- "typescript": "^5.7.3"
65
+ "storybook": "^8.6.4",
66
+ "typescript": "^5.8.2"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "@mui/icons-material": "^6",
69
70
  "@mui/material": "^6",
70
71
  "@mui/styles": "^6",
71
- "react": "^18",
72
- "react-dom": "^18",
72
+ "react": "^19",
73
+ "react-dom": "^19",
73
74
  "rollbar": "^2"
74
75
  },
75
76
  "peerDependenciesMeta": {
@@ -80,5 +81,6 @@
80
81
  "publishConfig": {
81
82
  "access": "public"
82
83
  },
83
- "docs": "dist/docs.json"
84
+ "docs": "dist/docs.json",
85
+ "stableVersion": "4.4.11"
84
86
  }
@@ -24,5 +24,5 @@ export const ErrorReporterProvider: React.FC<PropsWithChildren<ErrorReporterProv
24
24
  }
25
25
 
26
26
  // eslint-disable-next-line @eslint-react/no-unstable-context-value
27
- return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>
27
+ return <ErrorReporterContext value={{ rollbar }}>{children}</ErrorReporterContext>
28
28
  }
@@ -1,10 +1,10 @@
1
- import { useContext } from 'react'
1
+ import { use } from 'react'
2
2
 
3
3
  import { ErrorReporterContext } from './Context.ts'
4
4
 
5
5
  /** @deprecated use from @xylabs/react-error instead */
6
6
  export const useErrorReporter = () => {
7
- const context = useContext(ErrorReporterContext)
7
+ const context = use(ErrorReporterContext)
8
8
  if (context === undefined) {
9
9
  console.warn('useErrorReporter must be used within a ErrorReporterContext')
10
10
  }
@@ -1,63 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React, { ReactNode, Component, ErrorInfo, FC, PropsWithChildren } from 'react';
3
- import { ThrownErrorBoundaryProps } from '@xylabs/react-error';
4
- import { ModuleError } from '@xyo-network/payload-model';
5
- import { AlertProps } from '@mui/material';
6
- import { FlexBoxProps } from '@xylabs/react-flexbox';
7
- import { Location } from 'react-router-dom';
8
- import Rollbar from 'rollbar';
9
-
10
- interface ErrorBoundaryProps {
11
- children: ReactNode;
12
- fallback?: ReactNode;
13
- fallbackWithError?: (error: Error) => ReactNode;
14
- scope?: string;
15
- }
16
- interface ErrorBoundaryState {
17
- error?: Error;
18
- }
19
- declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
20
- constructor(props: ErrorBoundaryProps);
21
- static getDerivedStateFromError(error: Error): {
22
- error: Error;
23
- };
24
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
25
- render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
26
- }
27
-
28
- declare const ThrownErrorBoundary: FC<ThrownErrorBoundaryProps<ModuleError>>;
29
-
30
- interface ErrorAlertProps<T = void> extends AlertProps {
31
- error?: T | Error | string;
32
- errorContext?: string;
33
- onCancel?: () => void;
34
- scope?: string;
35
- }
36
- declare function ErrorAlert<T = void>({ title, onCancel, error, errorContext, scope, ...props }: ErrorAlertProps<T>): JSX.Element;
37
-
38
- type ErrorEx<T = void> = T extends void ? Error : T | Error;
39
- interface ErrorRenderProps<T = void> extends FlexBoxProps {
40
- customError?: ReactNode;
41
- error?: ErrorEx<T>;
42
- errorContext?: string;
43
- noErrorDisplay?: boolean;
44
- noReAuth?: boolean;
45
- onCancel?: () => void;
46
- scope?: string;
47
- useLocation?: () => Location;
48
- }
49
-
50
- declare function ErrorRender<T = void>({ onCancel, error, noErrorDisplay, customError, children, errorContext, scope, useLocation, ...props }: ErrorRenderProps<T>): JSX.Element;
51
-
52
- interface ErrorReporterProviderProps {
53
- rollbar: Rollbar;
54
- }
55
- declare const ErrorReporterProvider: React.FC<PropsWithChildren<ErrorReporterProviderProps>>;
56
-
57
- interface ErrorReporterContextState {
58
- rollbar?: Rollbar;
59
- }
60
-
61
- declare const useErrorReporter: () => ErrorReporterContextState;
62
-
63
- export { ErrorAlert, type ErrorAlertProps, ErrorBoundary, type ErrorBoundaryProps, type ErrorBoundaryState, type ErrorEx, ErrorRender, type ErrorRenderProps, type ErrorReporterContextState, ErrorReporterProvider, type ErrorReporterProviderProps, ThrownErrorBoundary, useErrorReporter };