@xyo-network/react-error 2.81.9 → 2.82.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.cts +3 -2
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -1
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.mts +3 -2
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.mts.map +1 -1
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.ts +3 -2
- package/dist/browser/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -1
- package/dist/browser/components/ErrorBoundary/index.d.cts +1 -1
- package/dist/browser/components/ErrorBoundary/index.d.cts.map +1 -1
- package/dist/browser/components/ErrorBoundary/index.d.mts +1 -1
- package/dist/browser/components/ErrorBoundary/index.d.mts.map +1 -1
- package/dist/browser/components/ErrorBoundary/index.d.ts +1 -1
- package/dist/browser/components/ErrorBoundary/index.d.ts.map +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.cts +2 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.cts.map +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.mts +2 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.mts.map +1 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.ts +2 -1
- package/dist/browser/components/ErrorRender/ErrorAlert.d.ts.map +1 -1
- package/dist/browser/components/ErrorRender/Render.d.cts +2 -1
- package/dist/browser/components/ErrorRender/Render.d.cts.map +1 -1
- package/dist/browser/components/ErrorRender/Render.d.mts +2 -1
- package/dist/browser/components/ErrorRender/Render.d.mts.map +1 -1
- package/dist/browser/components/ErrorRender/Render.d.ts +2 -1
- package/dist/browser/components/ErrorRender/Render.d.ts.map +1 -1
- package/dist/browser/components/ErrorRender/index.d.cts +3 -3
- package/dist/browser/components/ErrorRender/index.d.cts.map +1 -1
- package/dist/browser/components/ErrorRender/index.d.mts +3 -3
- package/dist/browser/components/ErrorRender/index.d.mts.map +1 -1
- package/dist/browser/components/ErrorRender/index.d.ts +3 -3
- package/dist/browser/components/ErrorRender/index.d.ts.map +1 -1
- package/dist/browser/components/index.d.cts +2 -2
- package/dist/browser/components/index.d.mts +2 -2
- package/dist/browser/components/index.d.ts +2 -2
- package/dist/browser/contexts/ErrorReporter/Context.d.cts +1 -1
- package/dist/browser/contexts/ErrorReporter/Context.d.mts +1 -1
- package/dist/browser/contexts/ErrorReporter/Context.d.ts +1 -1
- package/dist/browser/contexts/ErrorReporter/Provider.d.cts +1 -0
- package/dist/browser/contexts/ErrorReporter/Provider.d.cts.map +1 -1
- package/dist/browser/contexts/ErrorReporter/Provider.d.mts +1 -0
- package/dist/browser/contexts/ErrorReporter/Provider.d.mts.map +1 -1
- package/dist/browser/contexts/ErrorReporter/Provider.d.ts +1 -0
- package/dist/browser/contexts/ErrorReporter/Provider.d.ts.map +1 -1
- package/dist/browser/contexts/ErrorReporter/index.d.cts +3 -3
- package/dist/browser/contexts/ErrorReporter/index.d.cts.map +1 -1
- package/dist/browser/contexts/ErrorReporter/index.d.mts +3 -3
- package/dist/browser/contexts/ErrorReporter/index.d.mts.map +1 -1
- package/dist/browser/contexts/ErrorReporter/index.d.ts +3 -3
- package/dist/browser/contexts/ErrorReporter/index.d.ts.map +1 -1
- package/dist/browser/contexts/ErrorReporter/useRollbar.d.cts +1 -1
- package/dist/browser/contexts/ErrorReporter/useRollbar.d.mts +1 -1
- package/dist/browser/contexts/ErrorReporter/useRollbar.d.ts +1 -1
- package/dist/browser/contexts/index.d.cts +1 -1
- package/dist/browser/contexts/index.d.mts +1 -1
- package/dist/browser/contexts/index.d.ts +1 -1
- package/dist/browser/index.cjs +102 -52
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +2 -2
- package/dist/browser/index.d.mts +2 -2
- package/dist/browser/index.d.ts +2 -2
- package/dist/browser/index.mjs +163 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.cts +3 -2
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.mts +3 -2
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.mts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.ts +3 -2
- package/dist/neutral/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/index.d.cts +1 -1
- package/dist/neutral/components/ErrorBoundary/index.d.cts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/index.d.mts +1 -1
- package/dist/neutral/components/ErrorBoundary/index.d.mts.map +1 -1
- package/dist/neutral/components/ErrorBoundary/index.d.ts +1 -1
- package/dist/neutral/components/ErrorBoundary/index.d.ts.map +1 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.cts +2 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.cts.map +1 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.mts +2 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.mts.map +1 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.ts +2 -1
- package/dist/neutral/components/ErrorRender/ErrorAlert.d.ts.map +1 -1
- package/dist/neutral/components/ErrorRender/Render.d.cts +2 -1
- package/dist/neutral/components/ErrorRender/Render.d.cts.map +1 -1
- package/dist/neutral/components/ErrorRender/Render.d.mts +2 -1
- package/dist/neutral/components/ErrorRender/Render.d.mts.map +1 -1
- package/dist/neutral/components/ErrorRender/Render.d.ts +2 -1
- package/dist/neutral/components/ErrorRender/Render.d.ts.map +1 -1
- package/dist/neutral/components/ErrorRender/index.d.cts +3 -3
- package/dist/neutral/components/ErrorRender/index.d.cts.map +1 -1
- package/dist/neutral/components/ErrorRender/index.d.mts +3 -3
- package/dist/neutral/components/ErrorRender/index.d.mts.map +1 -1
- package/dist/neutral/components/ErrorRender/index.d.ts +3 -3
- package/dist/neutral/components/ErrorRender/index.d.ts.map +1 -1
- package/dist/neutral/components/index.d.cts +2 -2
- package/dist/neutral/components/index.d.mts +2 -2
- package/dist/neutral/components/index.d.ts +2 -2
- package/dist/neutral/contexts/ErrorReporter/Context.d.cts +1 -1
- package/dist/neutral/contexts/ErrorReporter/Context.d.mts +1 -1
- package/dist/neutral/contexts/ErrorReporter/Context.d.ts +1 -1
- package/dist/neutral/contexts/ErrorReporter/Provider.d.cts +1 -0
- package/dist/neutral/contexts/ErrorReporter/Provider.d.cts.map +1 -1
- package/dist/neutral/contexts/ErrorReporter/Provider.d.mts +1 -0
- package/dist/neutral/contexts/ErrorReporter/Provider.d.mts.map +1 -1
- package/dist/neutral/contexts/ErrorReporter/Provider.d.ts +1 -0
- package/dist/neutral/contexts/ErrorReporter/Provider.d.ts.map +1 -1
- package/dist/neutral/contexts/ErrorReporter/index.d.cts +3 -3
- package/dist/neutral/contexts/ErrorReporter/index.d.cts.map +1 -1
- package/dist/neutral/contexts/ErrorReporter/index.d.mts +3 -3
- package/dist/neutral/contexts/ErrorReporter/index.d.mts.map +1 -1
- package/dist/neutral/contexts/ErrorReporter/index.d.ts +3 -3
- package/dist/neutral/contexts/ErrorReporter/index.d.ts.map +1 -1
- package/dist/neutral/contexts/ErrorReporter/useRollbar.d.cts +1 -1
- package/dist/neutral/contexts/ErrorReporter/useRollbar.d.mts +1 -1
- package/dist/neutral/contexts/ErrorReporter/useRollbar.d.ts +1 -1
- package/dist/neutral/contexts/index.d.cts +1 -1
- package/dist/neutral/contexts/index.d.mts +1 -1
- package/dist/neutral/contexts/index.d.ts +1 -1
- package/dist/neutral/index.cjs +102 -52
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +2 -2
- package/dist/neutral/index.d.mts +2 -2
- package/dist/neutral/index.d.ts +2 -2
- package/dist/neutral/index.mjs +163 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.cts +3 -2
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.cts.map +1 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.mts +3 -2
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.mts.map +1 -1
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.ts +3 -2
- package/dist/node/components/ErrorBoundary/ThrownErrorBoundary.d.ts.map +1 -1
- package/dist/node/components/ErrorBoundary/index.d.cts +1 -1
- package/dist/node/components/ErrorBoundary/index.d.cts.map +1 -1
- package/dist/node/components/ErrorBoundary/index.d.mts +1 -1
- package/dist/node/components/ErrorBoundary/index.d.mts.map +1 -1
- package/dist/node/components/ErrorBoundary/index.d.ts +1 -1
- package/dist/node/components/ErrorBoundary/index.d.ts.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.cts +2 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.cts.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.mts +2 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.mts.map +1 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.ts +2 -1
- package/dist/node/components/ErrorRender/ErrorAlert.d.ts.map +1 -1
- package/dist/node/components/ErrorRender/Render.d.cts +2 -1
- package/dist/node/components/ErrorRender/Render.d.cts.map +1 -1
- package/dist/node/components/ErrorRender/Render.d.mts +2 -1
- package/dist/node/components/ErrorRender/Render.d.mts.map +1 -1
- package/dist/node/components/ErrorRender/Render.d.ts +2 -1
- package/dist/node/components/ErrorRender/Render.d.ts.map +1 -1
- package/dist/node/components/ErrorRender/index.d.cts +3 -3
- package/dist/node/components/ErrorRender/index.d.cts.map +1 -1
- package/dist/node/components/ErrorRender/index.d.mts +3 -3
- package/dist/node/components/ErrorRender/index.d.mts.map +1 -1
- package/dist/node/components/ErrorRender/index.d.ts +3 -3
- package/dist/node/components/ErrorRender/index.d.ts.map +1 -1
- package/dist/node/components/index.d.cts +2 -2
- package/dist/node/components/index.d.mts +2 -2
- package/dist/node/components/index.d.ts +2 -2
- package/dist/node/contexts/ErrorReporter/Context.d.cts +1 -1
- package/dist/node/contexts/ErrorReporter/Context.d.mts +1 -1
- package/dist/node/contexts/ErrorReporter/Context.d.ts +1 -1
- package/dist/node/contexts/ErrorReporter/Provider.d.cts +1 -0
- package/dist/node/contexts/ErrorReporter/Provider.d.cts.map +1 -1
- package/dist/node/contexts/ErrorReporter/Provider.d.mts +1 -0
- package/dist/node/contexts/ErrorReporter/Provider.d.mts.map +1 -1
- package/dist/node/contexts/ErrorReporter/Provider.d.ts +1 -0
- package/dist/node/contexts/ErrorReporter/Provider.d.ts.map +1 -1
- package/dist/node/contexts/ErrorReporter/index.d.cts +3 -3
- package/dist/node/contexts/ErrorReporter/index.d.cts.map +1 -1
- package/dist/node/contexts/ErrorReporter/index.d.mts +3 -3
- package/dist/node/contexts/ErrorReporter/index.d.mts.map +1 -1
- package/dist/node/contexts/ErrorReporter/index.d.ts +3 -3
- package/dist/node/contexts/ErrorReporter/index.d.ts.map +1 -1
- package/dist/node/contexts/ErrorReporter/useRollbar.d.cts +1 -1
- package/dist/node/contexts/ErrorReporter/useRollbar.d.mts +1 -1
- package/dist/node/contexts/ErrorReporter/useRollbar.d.ts +1 -1
- package/dist/node/contexts/index.d.cts +1 -1
- package/dist/node/contexts/index.d.mts +1 -1
- package/dist/node/contexts/index.d.ts +1 -1
- package/dist/node/index.cjs +101 -52
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.mts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.mjs +162 -0
- package/dist/node/index.mjs.map +1 -0
- package/package.json +13 -13
- package/src/components/ErrorBoundary/ThrownErrorBoundary.stories.tsx +8 -4
- package/src/components/ErrorBoundary/ThrownErrorBoundary.tsx +8 -7
- package/src/components/ErrorBoundary/index.ts +1 -1
- package/src/components/ErrorRender/ErrorAlert.stories.tsx +41 -0
- package/src/components/ErrorRender/ErrorAlert.tsx +35 -24
- package/src/components/ErrorRender/Render.tsx +15 -12
- package/src/components/ErrorRender/index.ts +3 -3
- package/src/components/index.ts +2 -2
- package/src/contexts/ErrorReporter/Context.ts +1 -1
- package/src/contexts/ErrorReporter/Provider.stories.tsx +11 -4
- package/src/contexts/ErrorReporter/Provider.tsx +3 -2
- package/src/contexts/ErrorReporter/index.ts +3 -3
- package/src/contexts/ErrorReporter/useRollbar.tsx +1 -1
- package/src/contexts/index.ts +1 -1
- package/src/index.ts +2 -2
- package/dist/browser/index.js +0 -121
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/index.js +0 -121
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/index.js +0 -121
- package/dist/node/index.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;
|
1
|
+
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqChD,CAAA"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { AlertProps } from '@mui/material';
|
2
2
|
import { ModuleError } from '@xyo-network/payload-model';
|
3
|
+
import React from 'react';
|
3
4
|
export interface ErrorAlertProps extends AlertProps {
|
4
|
-
error?: ModuleError | Error;
|
5
|
+
error?: ModuleError | Error | string;
|
5
6
|
errorContext?: string;
|
6
7
|
onCancel?: () => void;
|
7
8
|
scope?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;
|
1
|
+
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqChD,CAAA"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { AlertProps } from '@mui/material';
|
2
2
|
import { ModuleError } from '@xyo-network/payload-model';
|
3
|
+
import React from 'react';
|
3
4
|
export interface ErrorAlertProps extends AlertProps {
|
4
|
-
error?: ModuleError | Error;
|
5
|
+
error?: ModuleError | Error | string;
|
5
6
|
errorContext?: string;
|
6
7
|
onCancel?: () => void;
|
7
8
|
scope?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;
|
1
|
+
{"version":3,"file":"ErrorAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/ErrorAlert.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAA0B,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,MAAM,CAAA;IAEpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqChD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAoClD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAoClD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Render.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/Render.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAoClD,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './ErrorAlert.
|
2
|
-
export * from './Props.
|
3
|
-
export * from './Render.
|
1
|
+
export * from './ErrorAlert.tsx';
|
2
|
+
export * from './Props.ts';
|
3
|
+
export * from './Render.tsx';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
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"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './ErrorAlert.
|
2
|
-
export * from './Props.
|
3
|
-
export * from './Render.
|
1
|
+
export * from './ErrorAlert.tsx';
|
2
|
+
export * from './Props.ts';
|
3
|
+
export * from './Render.tsx';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
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"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './ErrorAlert.
|
2
|
-
export * from './Props.
|
3
|
-
export * from './Render.
|
1
|
+
export * from './ErrorAlert.tsx';
|
2
|
+
export * from './Props.ts';
|
3
|
+
export * from './Render.tsx';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ErrorRender/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
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"}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './ErrorBoundary/index.
|
2
|
-
export * from './ErrorRender/index.
|
1
|
+
export * from './ErrorBoundary/index.ts';
|
2
|
+
export * from './ErrorRender/index.ts';
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './ErrorBoundary/index.
|
2
|
-
export * from './ErrorRender/index.
|
1
|
+
export * from './ErrorBoundary/index.ts';
|
2
|
+
export * from './ErrorRender/index.ts';
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './ErrorBoundary/index.
|
2
|
-
export * from './ErrorRender/index.
|
1
|
+
export * from './ErrorBoundary/index.ts';
|
2
|
+
export * from './ErrorRender/index.ts';
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAW7E,CAAA;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAW7E,CAAA;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,OAAO,MAAM,SAAS,CAAA;AAI7B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAW7E,CAAA;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './Provider.
|
2
|
-
export * from './State.
|
3
|
-
export * from './useRollbar.
|
1
|
+
export * from './Provider.tsx';
|
2
|
+
export * from './State.ts';
|
3
|
+
export * from './useRollbar.tsx';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
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,kBAAkB,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './Provider.
|
2
|
-
export * from './State.
|
3
|
-
export * from './useRollbar.
|
1
|
+
export * from './Provider.tsx';
|
2
|
+
export * from './State.ts';
|
3
|
+
export * from './useRollbar.tsx';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
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,kBAAkB,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export * from './Provider.
|
2
|
-
export * from './State.
|
3
|
-
export * from './useRollbar.
|
1
|
+
export * from './Provider.tsx';
|
2
|
+
export * from './State.ts';
|
3
|
+
export * from './useRollbar.tsx';
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/ErrorReporter/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
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,kBAAkB,CAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './ErrorReporter/index.
|
1
|
+
export * from './ErrorReporter/index.ts';
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './ErrorReporter/index.
|
1
|
+
export * from './ErrorReporter/index.ts';
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './ErrorReporter/index.
|
1
|
+
export * from './ErrorReporter/index.ts';
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.cjs
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
6
9
|
var __export = (target, all) => {
|
7
10
|
for (var name in all)
|
8
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
@@ -15,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
15
18
|
}
|
16
19
|
return to;
|
17
20
|
};
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
27
|
+
mod
|
28
|
+
));
|
18
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
30
|
|
20
31
|
// src/index.ts
|
@@ -30,44 +41,50 @@ module.exports = __toCommonJS(src_exports);
|
|
30
41
|
|
31
42
|
// src/components/ErrorBoundary/ThrownErrorBoundary.tsx
|
32
43
|
var import_payload_model = require("@xyo-network/payload-model");
|
33
|
-
var
|
44
|
+
var import_react3 = __toESM(require("react"), 1);
|
34
45
|
|
35
46
|
// src/components/ErrorRender/ErrorAlert.tsx
|
36
47
|
var import_icons_material = require("@mui/icons-material");
|
37
48
|
var import_material = require("@mui/material");
|
38
49
|
var import_react_button = require("@xylabs/react-button");
|
39
|
-
var
|
40
|
-
var ErrorAlert = ({ onCancel, error, errorContext, scope, ...props }) => {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
var import_react = __toESM(require("react"), 1);
|
51
|
+
var ErrorAlert = /* @__PURE__ */ __name(({ title = "Whoops! Something went wrong", onCancel, error = "An unknown error occurred", errorContext, scope, ...props }) => {
|
52
|
+
const finalScope = scope ?? errorContext;
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement(import_material.Alert, {
|
54
|
+
severity: "error",
|
55
|
+
...props
|
56
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_material.AlertTitle, null, title), finalScope ? /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_material.Typography, {
|
57
|
+
variant: "caption",
|
58
|
+
mr: 0.5,
|
59
|
+
fontWeight: "bold"
|
60
|
+
}, "Scope:"), /* @__PURE__ */ import_react.default.createElement(import_material.Typography, {
|
61
|
+
variant: "caption"
|
62
|
+
}, finalScope)) : null, /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_material.Typography, {
|
63
|
+
variant: "caption",
|
64
|
+
mr: 0.5,
|
65
|
+
fontWeight: "bold"
|
66
|
+
}, "Error:"), /* @__PURE__ */ import_react.default.createElement(import_material.Typography, {
|
67
|
+
variant: "caption"
|
68
|
+
}, typeof error === "string" ? error : error?.message)), onCancel ? /* @__PURE__ */ import_react.default.createElement(import_react_button.ButtonEx, {
|
69
|
+
variant: "outlined",
|
70
|
+
size: "small",
|
71
|
+
onClick: onCancel,
|
72
|
+
position: "absolute",
|
73
|
+
style: {
|
74
|
+
right: 8,
|
75
|
+
top: 8
|
76
|
+
}
|
77
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_icons_material.ExitToApp, {
|
78
|
+
fontSize: "small"
|
79
|
+
})) : null);
|
80
|
+
}, "ErrorAlert");
|
53
81
|
|
54
82
|
// src/components/ErrorRender/Render.tsx
|
55
83
|
var import_react_flexbox = require("@xylabs/react-flexbox");
|
56
|
-
var
|
57
|
-
var
|
58
|
-
var ErrorRender = ({
|
59
|
-
onCancel,
|
60
|
-
error,
|
61
|
-
noErrorDisplay = false,
|
62
|
-
customError = null,
|
63
|
-
children,
|
64
|
-
errorContext,
|
65
|
-
scope,
|
66
|
-
useLocation,
|
67
|
-
...props
|
68
|
-
}) => {
|
84
|
+
var import_react2 = __toESM(require("react"), 1);
|
85
|
+
var ErrorRender = /* @__PURE__ */ __name(({ onCancel, error, noErrorDisplay = false, customError = null, children, errorContext, scope, useLocation, ...props }) => {
|
69
86
|
const location = useLocation?.();
|
70
|
-
(0,
|
87
|
+
(0, import_react2.useEffect)(() => {
|
71
88
|
if (location) {
|
72
89
|
location.state = {
|
73
90
|
from: {
|
@@ -75,21 +92,43 @@ var ErrorRender = ({
|
|
75
92
|
}
|
76
93
|
};
|
77
94
|
}
|
78
|
-
}, [
|
79
|
-
|
80
|
-
|
95
|
+
}, [
|
96
|
+
location
|
97
|
+
]);
|
98
|
+
return error ? /* @__PURE__ */ import_react2.default.createElement(import_react_flexbox.FlexCol, {
|
99
|
+
alignItems: "stretch",
|
100
|
+
...props
|
101
|
+
}, noErrorDisplay ? customError : /* @__PURE__ */ import_react2.default.createElement(import_react_flexbox.FlexCol, {
|
102
|
+
alignItems: "center",
|
103
|
+
...props
|
104
|
+
}, /* @__PURE__ */ import_react2.default.createElement(ErrorAlert, {
|
105
|
+
error,
|
106
|
+
errorContext,
|
107
|
+
onCancel,
|
108
|
+
scope
|
109
|
+
}))) : /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, children) ?? null;
|
110
|
+
}, "ErrorRender");
|
81
111
|
|
82
112
|
// src/components/ErrorBoundary/ThrownErrorBoundary.tsx
|
83
|
-
var
|
84
|
-
|
113
|
+
var ThrownErrorBoundary = class _ThrownErrorBoundary extends import_react3.Component {
|
114
|
+
static {
|
115
|
+
__name(this, "ThrownErrorBoundary");
|
116
|
+
}
|
85
117
|
state = {
|
86
118
|
xyoError: void 0
|
87
119
|
};
|
88
120
|
static getDerivedStateFromError(error) {
|
89
|
-
return {
|
121
|
+
return {
|
122
|
+
hasError: true,
|
123
|
+
xyoError: _ThrownErrorBoundary.normalizeError(error)
|
124
|
+
};
|
90
125
|
}
|
91
126
|
static normalizeError(error) {
|
92
|
-
return error.schema === import_payload_model.ModuleErrorSchema ? error : {
|
127
|
+
return error.schema === import_payload_model.ModuleErrorSchema ? error : {
|
128
|
+
message: error.message,
|
129
|
+
schema: import_payload_model.ModuleErrorSchema,
|
130
|
+
sources: []
|
131
|
+
};
|
93
132
|
}
|
94
133
|
componentDidCatch(error, errorInfo) {
|
95
134
|
const { rethrow, rollbar } = this.props;
|
@@ -102,43 +141,54 @@ var ThrownErrorBoundary = class _ThrownErrorBoundary extends import_react2.Compo
|
|
102
141
|
}
|
103
142
|
render() {
|
104
143
|
const { xyoError } = this.state;
|
105
|
-
const { children, boundaryName, errorComponent, scope } = this.props;
|
144
|
+
const { children, boundaryName, errorComponent, scope, title } = this.props;
|
106
145
|
if (xyoError) {
|
107
146
|
if (errorComponent) {
|
108
147
|
return errorComponent(xyoError);
|
109
148
|
}
|
110
|
-
return /* @__PURE__ */
|
149
|
+
return /* @__PURE__ */ import_react3.default.createElement(ErrorRender, {
|
150
|
+
error: xyoError,
|
151
|
+
errorContext: `${boundaryName} Boundary`,
|
152
|
+
scope,
|
153
|
+
title
|
154
|
+
});
|
111
155
|
}
|
112
156
|
return children;
|
113
157
|
}
|
114
158
|
};
|
115
159
|
|
116
160
|
// src/contexts/ErrorReporter/Provider.tsx
|
117
|
-
var
|
161
|
+
var import_react5 = __toESM(require("react"), 1);
|
118
162
|
|
119
163
|
// src/contexts/ErrorReporter/Context.ts
|
120
|
-
var
|
121
|
-
var ErrorReporterContext = (0,
|
164
|
+
var import_react4 = require("react");
|
165
|
+
var ErrorReporterContext = (0, import_react4.createContext)({});
|
122
166
|
|
123
167
|
// src/contexts/ErrorReporter/Provider.tsx
|
124
|
-
var
|
125
|
-
|
126
|
-
|
127
|
-
(0, import_react4.useEffect)(() => {
|
168
|
+
var ErrorReporterProvider = /* @__PURE__ */ __name(({ children, rollbar }) => {
|
169
|
+
const [rollbarInstance, setRollBarInstance] = (0, import_react5.useState)();
|
170
|
+
(0, import_react5.useEffect)(() => {
|
128
171
|
if (rollbarInstance) {
|
129
172
|
setRollBarInstance(rollbarInstance);
|
130
173
|
}
|
131
|
-
}, [
|
132
|
-
|
133
|
-
|
174
|
+
}, [
|
175
|
+
rollbar,
|
176
|
+
rollbarInstance
|
177
|
+
]);
|
178
|
+
return /* @__PURE__ */ import_react5.default.createElement(ErrorReporterContext.Provider, {
|
179
|
+
value: {
|
180
|
+
rollbar
|
181
|
+
}
|
182
|
+
}, children);
|
183
|
+
}, "ErrorReporterProvider");
|
134
184
|
|
135
185
|
// src/contexts/ErrorReporter/useRollbar.tsx
|
136
|
-
var
|
137
|
-
var useRollbar = () => {
|
138
|
-
const context = (0,
|
186
|
+
var import_react6 = require("react");
|
187
|
+
var useRollbar = /* @__PURE__ */ __name(() => {
|
188
|
+
const context = (0, import_react6.useContext)(ErrorReporterContext);
|
139
189
|
if (context === void 0) {
|
140
190
|
console.warn("useRollbar must be used within a ErrorReporterContext");
|
141
191
|
}
|
142
192
|
return context ?? {};
|
143
|
-
};
|
193
|
+
}, "useRollbar");
|
144
194
|
//# sourceMappingURL=index.cjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../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/useRollbar.tsx"],"sourcesContent":["export * from './components/index.js'\nexport * from './contexts/index.js'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.js'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n scope?: string\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n 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 static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema ?\n error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n 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 override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent, scope } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} scope={scope} />\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 scope?: string\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({ onCancel, error, errorContext, scope, ...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 {scope ?\n <>\n <Typography variant=\"caption\" mr={0.5} fontWeight=\"bold\">\n Scope:\n </Typography>\n <Typography variant=\"caption\">{scope}</Typography>\n </>\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'\n\nimport { ErrorAlert } from './ErrorAlert.js'\nimport { ErrorRenderProps } from './Props.js'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}) => {\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 = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }\n }, [location])\n\n return error ?\n <FlexCol alignItems=\"stretch\" {...props}>\n {noErrorDisplay ?\n customError\n : <FlexCol alignItems=\"center\" {...props}>\n <ErrorAlert error={error} errorContext={errorContext} onCancel={onCancel} scope={scope} />\n </FlexCol>\n }\n </FlexCol>\n : (<>{children}</> ?? null)\n}\n","import { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.js'\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.js'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { useContext } from 'react'\n\nimport { ErrorReporterContext } from './Context.js'\n\nconst useRollbar = () => {\n const context = useContext(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useRollbar must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n\nexport { useRollbar }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAA+C;AAC/C,IAAAA,gBAAgD;;;ACDhD,4BAAsC;AACtC,sBAA0D;AAC1D,0BAAyB;AAanB;AAHC,IAAM,aAAwC,CAAC,EAAE,UAAU,OAAO,cAAc,OAAO,GAAG,MAAM,MAAM;AAC3G,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,IACA;AAAA,IACD,QACC,4EACE;AAAA,kDAAC,8BAAW,SAAQ,WAAU,IAAI,KAAK,YAAW,QAAO,oBAEzD;AAAA,MACA,4CAAC,8BAAW,SAAQ,WAAW,iBAAM;AAAA,OACvC,IACA;AAAA,IACF,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,EAA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C,QAAI,SAAS;AACX,YAAM;AAAA,IACR;AAAA,EACF;AAAA,EAES,SAAS;AAChB,UAAM,EAAE,SAAS,IAAI,KAAK;AAC1B,UAAM,EAAE,UAAU,cAAc,gBAAgB,MAAM,IAAI,KAAK;AAC/D,QAAI,UAAU;AACZ,UAAI,gBAAgB;AAClB,eAAO,eAAe,QAAQ;AAAA,MAChC;AACA,aAAO,6CAAC,eAAY,OAAO,UAAU,cAAc,GAAG,YAAY,aAAa,OAAc;AAAA,IAC/F;AAEA,WAAO;AAAA,EACT;AACF;;;AG1DA,IAAAC,gBAAoC;;;ACDpC,IAAAC,gBAA8B;AAIvB,IAAM,2BAAuB,6BAAyC,CAAC,CAAC;;;ADetE,IAAAC,sBAAA;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,6CAAC,qBAAqB,UAArB,EAA8B,OAAO,EAAE,QAAQ,GAAI,UAAS;AACtE;;;AEpBA,IAAAC,gBAA2B;AAI3B,IAAM,aAAa,MAAM;AACvB,QAAM,cAAU,0BAAW,oBAAoB;AAC/C,MAAI,YAAY,QAAW;AACzB,YAAQ,KAAK,uDAAuD;AAAA,EACtE;AAEA,SAAO,WAAW,CAAC;AACrB;","names":["import_react","ExitIcon","import_jsx_runtime","import_jsx_runtime","import_react","import_react","import_jsx_runtime","import_react"]}
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../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/useRollbar.tsx"],"sourcesContent":["export * from './components/index.ts'\nexport * from './contexts/index.ts'\n","import { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport React, { Component, ErrorInfo, ReactNode } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorRender } from '../ErrorRender/index.ts'\n\nexport interface ThrownErrorBoundaryProps {\n boundaryName?: string\n children: ReactNode\n errorComponent?: (e: ModuleError, boundaryName?: string) => ReactNode\n rethrow?: boolean\n rollbar?: Rollbar\n scope?: string\n title?: string\n}\n\nexport interface ThrownErrorBoundaryState {\n xyoError?: ModuleError\n}\n\nexport class ThrownErrorBoundary extends Component<ThrownErrorBoundaryProps, ThrownErrorBoundaryState> {\n 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 static normalizeError(error: Error | ModuleError): ModuleError {\n return (\n (error as ModuleError).schema === ModuleErrorSchema\n ? error\n : { message: error.message, schema: ModuleErrorSchema, sources: [] }) as ModuleError\n }\n\n 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 override render() {\n const { xyoError } = this.state\n const { children, boundaryName, errorComponent, scope, title } = this.props\n if (xyoError) {\n if (errorComponent) {\n return errorComponent(xyoError)\n }\n return <ErrorRender error={xyoError} errorContext={`${boundaryName} Boundary`} scope={scope} title={title} />\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'\nimport React from 'react'\n\nexport interface ErrorAlertProps extends AlertProps {\n error?: ModuleError | Error | string\n /** @deprecated use scope instead */\n errorContext?: string\n onCancel?: () => void\n scope?: string\n}\n\nexport const ErrorAlert: React.FC<ErrorAlertProps> = ({\n title = 'Whoops! Something went wrong',\n onCancel,\n error = 'An unknown error occurred',\n errorContext,\n scope,\n ...props\n}) => {\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?.message}</Typography>\n </div>\n {onCancel\n ? (\n <ButtonEx variant=\"outlined\" size=\"small\" onClick={onCancel} position=\"absolute\" style={{ right: 8, top: 8 }}>\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 { ErrorRenderProps } from './Props.ts'\n\nexport const ErrorRender: React.FC<ErrorRenderProps> = ({\n onCancel,\n error,\n noErrorDisplay = false,\n customError = null,\n children,\n errorContext,\n scope,\n useLocation,\n ...props\n}) => {\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 = {\n from: {\n pathname: window.location.pathname,\n },\n }\n }\n }, [location])\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}</> ?? null)\n}\n","import { WithChildren } from '@xylabs/react-shared'\nimport React, { useEffect, useState } from 'react'\nimport Rollbar from 'rollbar'\n\nimport { ErrorReporterContext } from './Context.ts'\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 // eslint-disable-next-line @eslint-react/no-unstable-context-value\n return <ErrorReporterContext.Provider value={{ rollbar }}>{children}</ErrorReporterContext.Provider>\n}\n\nexport { ErrorReporterProvider }\n","import { createContext } from 'react'\n\nimport { ErrorReporterContextState } from './State.ts'\n\nexport const ErrorReporterContext = createContext<ErrorReporterContextState>({})\n","import { useContext } from 'react'\n\nimport { ErrorReporterContext } from './Context.ts'\n\nconst useRollbar = () => {\n const context = useContext(ErrorReporterContext)\n if (context === undefined) {\n console.warn('useRollbar must be used within a ErrorReporterContext')\n }\n\n return context ?? {}\n}\n\nexport { useRollbar }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;ACAA,2BAA+C;AAC/C,IAAAA,gBAAuD;;;ACDvD,4BAAsC;AACtC,sBAA0D;AAC1D,0BAAyB;AAEzB,mBAAkB;AAUX,IAAMC,aAAwC,wBAAC,EACpDC,QAAQ,gCACRC,UACAC,QAAQ,6BACRC,cACAC,OACA,GAAGC,MAAAA,MACJ;AACC,QAAMC,aAAaF,SAASD;AAC5B,SACE,6BAAAI,QAAA,cAACC,uBAAAA;IAAMC,UAAS;IAAS,GAAGJ;KAC1B,6BAAAE,QAAA,cAACG,4BAAAA,MAAYV,KAAAA,GACZM,aAEK,6BAAAC,QAAA,cAACI,OAAAA,MACC,6BAAAJ,QAAA,cAACK,4BAAAA;IAAWC,SAAQ;IAAUC,IAAI;IAAKC,YAAW;KAAO,QAAA,GAGzD,6BAAAR,QAAA,cAACK,4BAAAA;IAAWC,SAAQ;KAAWP,UAAAA,CAAAA,IAGnC,MACJ,6BAAAC,QAAA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AWC,oBAAAA;AAC3B,MAAIF,YAAYG,QAAW;AACzBC,YAAQC,KAAK,uDAAA;EACf;AAEA,SAAOL,WAAW,CAAC;AACrB,GAPmB;","names":["import_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","import_react","ErrorRender","onCancel","error","noErrorDisplay","customError","children","errorContext","scope","useLocation","props","location","useEffect","state","from","pathname","window","React","FlexCol","alignItems","ErrorAlert","ThrownErrorBoundary","Component","state","xyoError","undefined","getDerivedStateFromError","error","hasError","normalizeError","schema","ModuleErrorSchema","message","sources","componentDidCatch","errorInfo","rethrow","rollbar","props","console","render","children","boundaryName","errorComponent","scope","title","React","ErrorRender","errorContext","import_react","import_react","ErrorReporterContext","createContext","ErrorReporterProvider","children","rollbar","rollbarInstance","setRollBarInstance","useState","useEffect","React","ErrorReporterContext","Provider","value","import_react","useRollbar","context","useContext","ErrorReporterContext","undefined","console","warn"]}
|
package/dist/neutral/index.d.cts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './components/index.
|
2
|
-
export * from './contexts/index.
|
1
|
+
export * from './components/index.ts';
|
2
|
+
export * from './contexts/index.ts';
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.mts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './components/index.
|
2
|
-
export * from './contexts/index.
|
1
|
+
export * from './components/index.ts';
|
2
|
+
export * from './contexts/index.ts';
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from './components/index.
|
2
|
-
export * from './contexts/index.
|
1
|
+
export * from './components/index.ts';
|
2
|
+
export * from './contexts/index.ts';
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|