@honeybadger-io/react 6.1.26 → 6.1.28
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.
- package/README.md +7 -9
- package/dist/DefaultErrorComponent.d.ts +4 -13
- package/dist/HoneybadgerErrorBoundary.d.ts +4 -21
- package/dist/honeybadger-react.cjs.js +13 -26
- package/dist/honeybadger-react.cjs.js.map +1 -1
- package/dist/honeybadger-react.esm.js +13 -25
- package/dist/honeybadger-react.esm.js.map +1 -1
- package/dist/honeybadger-react.js +15 -27
- package/dist/honeybadger-react.js.map +1 -1
- package/dist/index.test.d.ts +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +16 -17
package/README.md
CHANGED
|
@@ -40,23 +40,21 @@ your own build environment may be just different enough to require some
|
|
|
40
40
|
adjustments. If you find that our artifacts don't quite meet your needs,
|
|
41
41
|
please [file an issue on GitHub](https://github.com/honeybadger-io/honeybadger-react/issues).
|
|
42
42
|
|
|
43
|
-
## Example
|
|
43
|
+
## Example apps
|
|
44
44
|
|
|
45
|
-
There
|
|
46
|
-
folder. If you want to contribute a patch to honeybadger-react, it can be useful to have
|
|
47
|
-
the demo
|
|
45
|
+
There are minimal implementations of a honeybadger-react integration in the ./examples
|
|
46
|
+
folder. If you want to contribute a patch to @honeybadger-io/react, it can be useful to have
|
|
47
|
+
the demo apps running.
|
|
48
48
|
|
|
49
|
-
To run
|
|
49
|
+
To run the example app using React v19, issue these commands from your shell:
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
cd
|
|
52
|
+
cd examples/react-19
|
|
53
53
|
npm install
|
|
54
54
|
REACT_APP_HONEYBADGER_API_KEY=b425b636 npm run start
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
This will
|
|
58
|
-
|
|
59
|
-
For a detailed explanation on how hot reloading works, check out the [documentation](https://webpack.js.org/concepts/hot-module-replacement/).
|
|
57
|
+
This will start the demo app with hot reload enabled.
|
|
60
58
|
|
|
61
59
|
## Development
|
|
62
60
|
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
info: React.ErrorInfo | null;
|
|
6
|
-
}
|
|
7
|
-
export default class DefaultErrorComponent extends Component<DefaultErrorComponentProps, {}> {
|
|
8
|
-
static propTypes: {
|
|
9
|
-
error: PropTypes.Requireable<object>;
|
|
10
|
-
info: PropTypes.Requireable<object>;
|
|
11
|
-
};
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DefaultErrorComponentProps } from './types';
|
|
3
|
+
declare function DefaultErrorComponent({ error, info }: DefaultErrorComponentProps): React.JSX.Element;
|
|
4
|
+
export default DefaultErrorComponent;
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import React, { Component
|
|
2
|
-
import
|
|
3
|
-
import { DefaultErrorComponentProps } from './DefaultErrorComponent';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
interface HoneybadgerErrorBoundaryProps {
|
|
6
|
-
honeybadger: typeof Honeybadger;
|
|
7
|
-
showUserFeedbackFormOnError?: boolean;
|
|
8
|
-
ErrorComponent?: ReactNode | ComponentType | ElementType;
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
interface HoneybadgerErrorBoundaryState extends DefaultErrorComponentProps {
|
|
12
|
-
errorOccurred: boolean;
|
|
13
|
-
}
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { HoneybadgerErrorBoundaryProps, HoneybadgerErrorBoundaryState } from './types';
|
|
14
3
|
export default class HoneybadgerErrorBoundary extends Component<HoneybadgerErrorBoundaryProps, HoneybadgerErrorBoundaryState> {
|
|
15
|
-
static propTypes: {
|
|
16
|
-
honeybadger: PropTypes.Validator<object>;
|
|
17
|
-
showUserFeedbackFormOnError: PropTypes.Requireable<boolean>;
|
|
18
|
-
children: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
19
|
-
ErrorComponent: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
|
|
20
|
-
};
|
|
21
4
|
static defaultProps: {
|
|
22
5
|
showUserFeedbackFormOnError: boolean;
|
|
23
6
|
};
|
|
24
7
|
constructor(props: HoneybadgerErrorBoundaryProps);
|
|
25
8
|
static getDerivedStateFromError(error: Error): HoneybadgerErrorBoundaryState;
|
|
9
|
+
componentDidMount(): void;
|
|
26
10
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
27
11
|
private getErrorComponent;
|
|
28
|
-
render(): JSX.Element;
|
|
12
|
+
render(): React.JSX.Element;
|
|
29
13
|
}
|
|
30
|
-
export {};
|
|
@@ -4,27 +4,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var Honeybadger = require('@honeybadger-io/js');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var PropTypes = require('prop-types');
|
|
8
7
|
|
|
9
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
9
|
|
|
11
10
|
var Honeybadger__default = /*#__PURE__*/_interopDefaultLegacy(Honeybadger);
|
|
12
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
React__default["default"].createElement("div", null, JSON.stringify(this.props.error, null, 2)),
|
|
21
|
-
React__default["default"].createElement("div", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));
|
|
22
|
-
}
|
|
13
|
+
function DefaultErrorComponent({ error, info }) {
|
|
14
|
+
return (React__default["default"].createElement("div", { className: 'error' },
|
|
15
|
+
React__default["default"].createElement("div", null, "An Error Occurred"),
|
|
16
|
+
React__default["default"].createElement("div", null, error ? error.toString() : ''),
|
|
17
|
+
React__default["default"].createElement("div", null, info ? JSON.stringify(info, null, 2) : '')));
|
|
23
18
|
}
|
|
24
|
-
DefaultErrorComponent.propTypes = {
|
|
25
|
-
error: PropTypes__default["default"].object,
|
|
26
|
-
info: PropTypes__default["default"].object
|
|
27
|
-
};
|
|
28
19
|
|
|
29
20
|
class HoneybadgerErrorBoundary extends React.Component {
|
|
30
21
|
constructor(props) {
|
|
@@ -34,22 +25,24 @@ class HoneybadgerErrorBoundary extends React.Component {
|
|
|
34
25
|
info: null,
|
|
35
26
|
errorOccurred: false
|
|
36
27
|
};
|
|
28
|
+
}
|
|
29
|
+
static getDerivedStateFromError(error) {
|
|
30
|
+
return { error: error, errorOccurred: true, info: null };
|
|
31
|
+
}
|
|
32
|
+
componentDidMount() {
|
|
37
33
|
this.props.honeybadger.afterNotify((error, _notice) => {
|
|
38
34
|
if (!error && this.props.showUserFeedbackFormOnError) {
|
|
39
35
|
this.props.honeybadger.showUserFeedbackForm();
|
|
40
36
|
}
|
|
41
37
|
});
|
|
42
38
|
}
|
|
43
|
-
static getDerivedStateFromError(error) {
|
|
44
|
-
return { error: error, errorOccurred: true, info: null };
|
|
45
|
-
}
|
|
46
39
|
componentDidCatch(error, errorInfo) {
|
|
47
|
-
this.setState({
|
|
40
|
+
this.setState({ error, info: errorInfo });
|
|
48
41
|
this.props.honeybadger.notify(error, { context: errorInfo });
|
|
49
42
|
}
|
|
50
43
|
getErrorComponent() {
|
|
51
44
|
return this.props.ErrorComponent
|
|
52
|
-
? React__default["default"].createElement(this.props.ErrorComponent, this.state)
|
|
45
|
+
? React__default["default"].createElement(this.props.ErrorComponent, { ...this.state })
|
|
53
46
|
: React__default["default"].createElement(DefaultErrorComponent, { ...this.state });
|
|
54
47
|
}
|
|
55
48
|
render() {
|
|
@@ -58,12 +51,6 @@ class HoneybadgerErrorBoundary extends React.Component {
|
|
|
58
51
|
: this.props.children));
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
|
-
HoneybadgerErrorBoundary.propTypes = {
|
|
62
|
-
honeybadger: PropTypes__default["default"].object.isRequired,
|
|
63
|
-
showUserFeedbackFormOnError: PropTypes__default["default"].bool,
|
|
64
|
-
children: PropTypes__default["default"].element,
|
|
65
|
-
ErrorComponent: PropTypes__default["default"].oneOfType([PropTypes__default["default"].element, PropTypes__default["default"].func])
|
|
66
|
-
};
|
|
67
54
|
HoneybadgerErrorBoundary.defaultProps = {
|
|
68
55
|
showUserFeedbackFormOnError: false
|
|
69
56
|
};
|
|
@@ -71,7 +58,7 @@ HoneybadgerErrorBoundary.defaultProps = {
|
|
|
71
58
|
const NOTIFIER = {
|
|
72
59
|
name: '@honeybadger-io/react',
|
|
73
60
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/react',
|
|
74
|
-
version: '6.1.
|
|
61
|
+
version: '6.1.28'
|
|
75
62
|
};
|
|
76
63
|
Honeybadger__default["default"].setNotifier(NOTIFIER);
|
|
77
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-react.cjs.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js","../../build/index.js"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"honeybadger-react.cjs.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js","../../build/index.js"],"sourcesContent":["import React from 'react';\nfunction DefaultErrorComponent({ error, info }) {\n return (React.createElement(\"div\", { className: 'error' },\n React.createElement(\"div\", null, \"An Error Occurred\"),\n React.createElement(\"div\", null, error ? error.toString() : ''),\n React.createElement(\"div\", null, info ? JSON.stringify(info, null, 2) : '')));\n}\nexport default DefaultErrorComponent;\n//# sourceMappingURL=DefaultErrorComponent.js.map","import React, { Component } from 'react';\nimport DefaultErrorComponent from './DefaultErrorComponent';\nexport default class HoneybadgerErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.state = {\n error: null,\n info: null,\n errorOccurred: false\n };\n }\n static getDerivedStateFromError(error) {\n return { error: error, errorOccurred: true, info: null };\n }\n componentDidMount() {\n this.props.honeybadger.afterNotify((error, _notice) => {\n if (!error && this.props.showUserFeedbackFormOnError) {\n this.props.honeybadger.showUserFeedbackForm();\n }\n });\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ error, info: errorInfo });\n this.props.honeybadger.notify(error, { context: errorInfo });\n }\n getErrorComponent() {\n return this.props.ErrorComponent\n ? React.createElement(this.props.ErrorComponent, { ...this.state })\n : React.createElement(DefaultErrorComponent, { ...this.state });\n }\n render() {\n return (React.createElement(React.Fragment, null, this.state.errorOccurred\n ? this.getErrorComponent()\n : this.props.children));\n }\n}\nHoneybadgerErrorBoundary.defaultProps = {\n showUserFeedbackFormOnError: false\n};\n//# sourceMappingURL=HoneybadgerErrorBoundary.js.map","import Honeybadger from '@honeybadger-io/js';\nimport HoneybadgerErrorBoundary from './HoneybadgerErrorBoundary';\nconst NOTIFIER = {\n name: '@honeybadger-io/react',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/react',\n version: '__VERSION__'\n};\nHoneybadger.setNotifier(NOTIFIER);\nexport { Honeybadger, HoneybadgerErrorBoundary };\n//# sourceMappingURL=index.js.map"],"names":["React","Component","Honeybadger"],"mappings":";;;;;;;;;;;;AACA,SAAS,qBAAqB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;AAChD,IAAI,QAAQA,yBAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;AAC7D,QAAQA,yBAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,mBAAmB,CAAC;AAC7D,QAAQA,yBAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC;AACvE,QAAQA,yBAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS,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AAc,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AAC/E,cAAcA,yBAAK,CAAC,aAAa,CAAC,qBAAqB,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;AAC5E,KAAK;AACL,IAAI,MAAM,GAAG;AACb,QAAQ,QAAQA,yBAAK,CAAC,aAAa,CAACA,yBAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;AAClF,cAAc,IAAI,CAAC,iBAAiB,EAAE;AACtC,cAAc,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;AACpC,KAAK;AACL,CAAC;AACD,wBAAwB,CAAC,YAAY,GAAG;AACxC,IAAI,2BAA2B,EAAE,KAAK;AACtC,CAAC;;ACpCD,MAAM,QAAQ,GAAG;AACjB,IAAI,IAAI,EAAE,uBAAuB;AACjC,IAAI,GAAG,EAAE,6EAA6E;AACtF,IAAI,OAAO,EAAE,QAAY;AACzB,CAAC,CAAA;AACDE,+BAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;;;;;;;"}
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import Honeybadger from '@honeybadger-io/js';
|
|
2
2
|
export { default as Honeybadger } from '@honeybadger-io/js';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
React.createElement("div", null, JSON.stringify(this.props.error, null, 2)),
|
|
12
|
-
React.createElement("div", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));
|
|
13
|
-
}
|
|
5
|
+
function DefaultErrorComponent({ error, info }) {
|
|
6
|
+
return (React.createElement("div", { className: 'error' },
|
|
7
|
+
React.createElement("div", null, "An Error Occurred"),
|
|
8
|
+
React.createElement("div", null, error ? error.toString() : ''),
|
|
9
|
+
React.createElement("div", null, info ? JSON.stringify(info, null, 2) : '')));
|
|
14
10
|
}
|
|
15
|
-
DefaultErrorComponent.propTypes = {
|
|
16
|
-
error: PropTypes.object,
|
|
17
|
-
info: PropTypes.object
|
|
18
|
-
};
|
|
19
11
|
|
|
20
12
|
class HoneybadgerErrorBoundary extends Component {
|
|
21
13
|
constructor(props) {
|
|
@@ -25,22 +17,24 @@ class HoneybadgerErrorBoundary extends Component {
|
|
|
25
17
|
info: null,
|
|
26
18
|
errorOccurred: false
|
|
27
19
|
};
|
|
20
|
+
}
|
|
21
|
+
static getDerivedStateFromError(error) {
|
|
22
|
+
return { error: error, errorOccurred: true, info: null };
|
|
23
|
+
}
|
|
24
|
+
componentDidMount() {
|
|
28
25
|
this.props.honeybadger.afterNotify((error, _notice) => {
|
|
29
26
|
if (!error && this.props.showUserFeedbackFormOnError) {
|
|
30
27
|
this.props.honeybadger.showUserFeedbackForm();
|
|
31
28
|
}
|
|
32
29
|
});
|
|
33
30
|
}
|
|
34
|
-
static getDerivedStateFromError(error) {
|
|
35
|
-
return { error: error, errorOccurred: true, info: null };
|
|
36
|
-
}
|
|
37
31
|
componentDidCatch(error, errorInfo) {
|
|
38
|
-
this.setState({
|
|
32
|
+
this.setState({ error, info: errorInfo });
|
|
39
33
|
this.props.honeybadger.notify(error, { context: errorInfo });
|
|
40
34
|
}
|
|
41
35
|
getErrorComponent() {
|
|
42
36
|
return this.props.ErrorComponent
|
|
43
|
-
? React.createElement(this.props.ErrorComponent, this.state)
|
|
37
|
+
? React.createElement(this.props.ErrorComponent, { ...this.state })
|
|
44
38
|
: React.createElement(DefaultErrorComponent, { ...this.state });
|
|
45
39
|
}
|
|
46
40
|
render() {
|
|
@@ -49,12 +43,6 @@ class HoneybadgerErrorBoundary extends Component {
|
|
|
49
43
|
: this.props.children));
|
|
50
44
|
}
|
|
51
45
|
}
|
|
52
|
-
HoneybadgerErrorBoundary.propTypes = {
|
|
53
|
-
honeybadger: PropTypes.object.isRequired,
|
|
54
|
-
showUserFeedbackFormOnError: PropTypes.bool,
|
|
55
|
-
children: PropTypes.element,
|
|
56
|
-
ErrorComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
57
|
-
};
|
|
58
46
|
HoneybadgerErrorBoundary.defaultProps = {
|
|
59
47
|
showUserFeedbackFormOnError: false
|
|
60
48
|
};
|
|
@@ -62,7 +50,7 @@ HoneybadgerErrorBoundary.defaultProps = {
|
|
|
62
50
|
const NOTIFIER = {
|
|
63
51
|
name: '@honeybadger-io/react',
|
|
64
52
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/react',
|
|
65
|
-
version: '6.1.
|
|
53
|
+
version: '6.1.28'
|
|
66
54
|
};
|
|
67
55
|
Honeybadger.setNotifier(NOTIFIER);
|
|
68
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-react.esm.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js","../../build/index.js"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"honeybadger-react.esm.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js","../../build/index.js"],"sourcesContent":["import React from 'react';\nfunction DefaultErrorComponent({ error, info }) {\n return (React.createElement(\"div\", { className: 'error' },\n React.createElement(\"div\", null, \"An Error Occurred\"),\n React.createElement(\"div\", null, error ? error.toString() : ''),\n React.createElement(\"div\", null, info ? JSON.stringify(info, null, 2) : '')));\n}\nexport default DefaultErrorComponent;\n//# sourceMappingURL=DefaultErrorComponent.js.map","import React, { Component } from 'react';\nimport DefaultErrorComponent from './DefaultErrorComponent';\nexport default class HoneybadgerErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.state = {\n error: null,\n info: null,\n errorOccurred: false\n };\n }\n static getDerivedStateFromError(error) {\n return { error: error, errorOccurred: true, info: null };\n }\n componentDidMount() {\n this.props.honeybadger.afterNotify((error, _notice) => {\n if (!error && this.props.showUserFeedbackFormOnError) {\n this.props.honeybadger.showUserFeedbackForm();\n }\n });\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ error, info: errorInfo });\n this.props.honeybadger.notify(error, { context: errorInfo });\n }\n getErrorComponent() {\n return this.props.ErrorComponent\n ? React.createElement(this.props.ErrorComponent, { ...this.state })\n : React.createElement(DefaultErrorComponent, { ...this.state });\n }\n render() {\n return (React.createElement(React.Fragment, null, this.state.errorOccurred\n ? this.getErrorComponent()\n : this.props.children));\n }\n}\nHoneybadgerErrorBoundary.defaultProps = {\n showUserFeedbackFormOnError: false\n};\n//# sourceMappingURL=HoneybadgerErrorBoundary.js.map","import Honeybadger from '@honeybadger-io/js';\nimport HoneybadgerErrorBoundary from './HoneybadgerErrorBoundary';\nconst NOTIFIER = {\n name: '@honeybadger-io/react',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/react',\n version: '__VERSION__'\n};\nHoneybadger.setNotifier(NOTIFIER);\nexport { Honeybadger, HoneybadgerErrorBoundary };\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;AACA,SAAS,qBAAqB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;AAChD,IAAI,QAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;AAC7D,QAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,mBAAmB,CAAC;AAC7D,QAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC;AACvE,QAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE;AACtF;;ACJe,MAAM,wBAAwB,SAAS,SAAS,CAAC;AAChE,IAAI,WAAW,CAAC,KAAK,EAAE;AACvB,Q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K;AACL,IAAI,MAAM,GAAG;AACb,QAAQ,QAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;AAClF,cAAc,IAAI,CAAC,iBAAiB,EAAE;AACtC,cAAc,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;AACpC,KAAK;AACL,CAAC;AACD,wBAAwB,CAAC,YAAY,GAAG;AACxC,IAAI,2BAA2B,EAAE,KAAK;AACtC,CAAC;;ACpCD,MAAM,QAAQ,GAAG;AACjB,IAAI,IAAI,EAAE,uBAAuB;AACjC,IAAI,GAAG,EAAE,6EAA6E;AACtF,IAAI,OAAO,EAAE,QAAY;AACzB,CAAC,CAAA;AACD,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;;;"}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
var HoneybadgerReact = (function (exports, Honeybadger, React
|
|
1
|
+
var HoneybadgerReact = (function (exports, Honeybadger, React) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
5
5
|
|
|
6
6
|
var Honeybadger__default = /*#__PURE__*/_interopDefaultLegacy(Honeybadger);
|
|
7
7
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
8
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
React__default["default"].createElement("div", null, JSON.stringify(this.props.error, null, 2)),
|
|
16
|
-
React__default["default"].createElement("div", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));
|
|
17
|
-
}
|
|
9
|
+
function DefaultErrorComponent({ error, info }) {
|
|
10
|
+
return (React__default["default"].createElement("div", { className: 'error' },
|
|
11
|
+
React__default["default"].createElement("div", null, "An Error Occurred"),
|
|
12
|
+
React__default["default"].createElement("div", null, error ? error.toString() : ''),
|
|
13
|
+
React__default["default"].createElement("div", null, info ? JSON.stringify(info, null, 2) : '')));
|
|
18
14
|
}
|
|
19
|
-
DefaultErrorComponent.propTypes = {
|
|
20
|
-
error: PropTypes__default["default"].object,
|
|
21
|
-
info: PropTypes__default["default"].object
|
|
22
|
-
};
|
|
23
15
|
|
|
24
16
|
class HoneybadgerErrorBoundary extends React.Component {
|
|
25
17
|
constructor(props) {
|
|
@@ -29,22 +21,24 @@ var HoneybadgerReact = (function (exports, Honeybadger, React, PropTypes) {
|
|
|
29
21
|
info: null,
|
|
30
22
|
errorOccurred: false
|
|
31
23
|
};
|
|
24
|
+
}
|
|
25
|
+
static getDerivedStateFromError(error) {
|
|
26
|
+
return { error: error, errorOccurred: true, info: null };
|
|
27
|
+
}
|
|
28
|
+
componentDidMount() {
|
|
32
29
|
this.props.honeybadger.afterNotify((error, _notice) => {
|
|
33
30
|
if (!error && this.props.showUserFeedbackFormOnError) {
|
|
34
31
|
this.props.honeybadger.showUserFeedbackForm();
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
|
-
static getDerivedStateFromError(error) {
|
|
39
|
-
return { error: error, errorOccurred: true, info: null };
|
|
40
|
-
}
|
|
41
35
|
componentDidCatch(error, errorInfo) {
|
|
42
|
-
this.setState({
|
|
36
|
+
this.setState({ error, info: errorInfo });
|
|
43
37
|
this.props.honeybadger.notify(error, { context: errorInfo });
|
|
44
38
|
}
|
|
45
39
|
getErrorComponent() {
|
|
46
40
|
return this.props.ErrorComponent
|
|
47
|
-
? React__default["default"].createElement(this.props.ErrorComponent, this.state)
|
|
41
|
+
? React__default["default"].createElement(this.props.ErrorComponent, { ...this.state })
|
|
48
42
|
: React__default["default"].createElement(DefaultErrorComponent, { ...this.state });
|
|
49
43
|
}
|
|
50
44
|
render() {
|
|
@@ -53,12 +47,6 @@ var HoneybadgerReact = (function (exports, Honeybadger, React, PropTypes) {
|
|
|
53
47
|
: this.props.children));
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
|
-
HoneybadgerErrorBoundary.propTypes = {
|
|
57
|
-
honeybadger: PropTypes__default["default"].object.isRequired,
|
|
58
|
-
showUserFeedbackFormOnError: PropTypes__default["default"].bool,
|
|
59
|
-
children: PropTypes__default["default"].element,
|
|
60
|
-
ErrorComponent: PropTypes__default["default"].oneOfType([PropTypes__default["default"].element, PropTypes__default["default"].func])
|
|
61
|
-
};
|
|
62
50
|
HoneybadgerErrorBoundary.defaultProps = {
|
|
63
51
|
showUserFeedbackFormOnError: false
|
|
64
52
|
};
|
|
@@ -66,7 +54,7 @@ var HoneybadgerReact = (function (exports, Honeybadger, React, PropTypes) {
|
|
|
66
54
|
const NOTIFIER = {
|
|
67
55
|
name: '@honeybadger-io/react',
|
|
68
56
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/react',
|
|
69
|
-
version: '6.1.
|
|
57
|
+
version: '6.1.28'
|
|
70
58
|
};
|
|
71
59
|
Honeybadger__default["default"].setNotifier(NOTIFIER);
|
|
72
60
|
|
|
@@ -80,5 +68,5 @@ var HoneybadgerReact = (function (exports, Honeybadger, React, PropTypes) {
|
|
|
80
68
|
|
|
81
69
|
return exports;
|
|
82
70
|
|
|
83
|
-
})({}, Honeybadger, React
|
|
71
|
+
})({}, Honeybadger, React);
|
|
84
72
|
//# sourceMappingURL=honeybadger-react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-react.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js","../../build/index.js"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"honeybadger-react.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js","../../build/index.js"],"sourcesContent":["import React from 'react';\nfunction DefaultErrorComponent({ error, info }) {\n return (React.createElement(\"div\", { className: 'error' },\n React.createElement(\"div\", null, \"An Error Occurred\"),\n React.createElement(\"div\", null, error ? error.toString() : ''),\n React.createElement(\"div\", null, info ? JSON.stringify(info, null, 2) : '')));\n}\nexport default DefaultErrorComponent;\n//# sourceMappingURL=DefaultErrorComponent.js.map","import React, { Component } from 'react';\nimport DefaultErrorComponent from './DefaultErrorComponent';\nexport default class HoneybadgerErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.state = {\n error: null,\n info: null,\n errorOccurred: false\n };\n }\n static getDerivedStateFromError(error) {\n return { error: error, errorOccurred: true, info: null };\n }\n componentDidMount() {\n this.props.honeybadger.afterNotify((error, _notice) => {\n if (!error && this.props.showUserFeedbackFormOnError) {\n this.props.honeybadger.showUserFeedbackForm();\n }\n });\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ error, info: errorInfo });\n this.props.honeybadger.notify(error, { context: errorInfo });\n }\n getErrorComponent() {\n return this.props.ErrorComponent\n ? React.createElement(this.props.ErrorComponent, { ...this.state })\n : React.createElement(DefaultErrorComponent, { ...this.state });\n }\n render() {\n return (React.createElement(React.Fragment, null, this.state.errorOccurred\n ? this.getErrorComponent()\n : this.props.children));\n }\n}\nHoneybadgerErrorBoundary.defaultProps = {\n showUserFeedbackFormOnError: false\n};\n//# sourceMappingURL=HoneybadgerErrorBoundary.js.map","import Honeybadger from '@honeybadger-io/js';\nimport HoneybadgerErrorBoundary from './HoneybadgerErrorBoundary';\nconst NOTIFIER = {\n name: '@honeybadger-io/react',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/react',\n version: '__VERSION__'\n};\nHoneybadger.setNotifier(NOTIFIER);\nexport { Honeybadger, HoneybadgerErrorBoundary };\n//# sourceMappingURL=index.js.map"],"names":["React","Component","Honeybadger"],"mappings":";;;;;;;;IACA,SAAS,qBAAqB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAChD,IAAI,QAAQA,yBAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;IAC7D,QAAQA,yB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,CAAC;IAClD,QAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IACrE,KAAK;IACL,IAAI,iBAAiB,GAAG;IACxB,QAAQ,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc;IACxC,cAAcD,yBAAK,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC/E,cAAcA,yBAAK,CAAC,aAAa,CAAC,qBAAqB,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5E,KAAK;IACL,IAAI,MAAM,GAAG;IACb,QAAQ,QAAQA,yBAAK,CAAC,aAAa,CAACA,yBAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;IAClF,cAAc,IAAI,CAAC,iBAAiB,EAAE;IACtC,cAAc,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;IACpC,KAAK;IACL,CAAC;IACD,wBAAwB,CAAC,YAAY,GAAG;IACxC,IAAI,2BAA2B,EAAE,KAAK;IACtC,CAAC;;ICpCD,MAAM,QAAQ,GAAG;IACjB,IAAI,IAAI,EAAE,uBAAuB;IACjC,IAAI,GAAG,EAAE,6EAA6E;IACtF,IAAI,OAAO,EAAE,QAAY;IACzB,CAAC,CAAA;AACDE,mCAAW,CAAC,WAAW,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;"}
|
package/dist/index.test.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentType, ElementType, ErrorInfo, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import Honeybadger from '@honeybadger-io/js';
|
|
3
|
+
export type DefaultErrorComponentProps = {
|
|
4
|
+
error: Error | null;
|
|
5
|
+
info: ErrorInfo | null;
|
|
6
|
+
};
|
|
7
|
+
export type HoneybadgerErrorBoundaryProps = PropsWithChildren<{
|
|
8
|
+
honeybadger: typeof Honeybadger;
|
|
9
|
+
showUserFeedbackFormOnError?: boolean;
|
|
10
|
+
ErrorComponent?: ReactNode | ComponentType | ElementType;
|
|
11
|
+
}>;
|
|
12
|
+
export type HoneybadgerErrorBoundaryState = {
|
|
13
|
+
errorOccurred: boolean;
|
|
14
|
+
} & DefaultErrorComponentProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/react",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.28",
|
|
4
4
|
"description": "React.js integration for honeybadger",
|
|
5
5
|
"author": "Jason Truesdell <jason@yuzuten.com> (https://github.com/JasonTrue)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,36 +15,35 @@
|
|
|
15
15
|
"unpkg": "dist/honeybadger-react.js",
|
|
16
16
|
"jsnext:main": "dist/honeybadger-react.esm.js",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test": "
|
|
19
|
-
"test:watch": "
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"test:watch": "jest --watchAll",
|
|
20
20
|
"build": "tsc --build tsconfig.json && rollup -c && tsc --build tsconfig.types.json",
|
|
21
21
|
"start": "rollup -c -w",
|
|
22
|
-
"predeploy": "cd example && npm install && npm run build"
|
|
23
|
-
"deploy": "gh-pages -d example/build"
|
|
22
|
+
"predeploy": "cd example && npm install && npm run build"
|
|
24
23
|
},
|
|
25
24
|
"peerDependencies": {
|
|
26
25
|
"@honeybadger-io/js": "^6.2.0",
|
|
27
|
-
"
|
|
28
|
-
"react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
29
|
-
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
26
|
+
"react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
27
|
+
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
30
28
|
},
|
|
31
29
|
"devDependencies": {
|
|
32
|
-
"@honeybadger-io/js": "^6.11.0",
|
|
33
30
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
34
31
|
"@rollup/plugin-replace": "^5.0.2",
|
|
32
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
33
|
+
"@testing-library/react": "^16.1.0",
|
|
35
34
|
"@types/jest": "^29.0.0",
|
|
36
|
-
"@types/react": "^
|
|
37
|
-
"@types/react-
|
|
35
|
+
"@types/react": "^19.0.0",
|
|
36
|
+
"@types/react-dom": "^19.0.2",
|
|
38
37
|
"@types/sinon": "^10.0.11",
|
|
39
|
-
"cross-env": "^7.0.0",
|
|
40
|
-
"gh-pages": "^4.0.0",
|
|
41
38
|
"husky": "^8.0.0",
|
|
39
|
+
"jest": "^29.7.0",
|
|
40
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
42
41
|
"jest-fetch-mock": "^3.0.3",
|
|
43
|
-
"react": "^
|
|
44
|
-
"react-
|
|
45
|
-
"react-test-renderer": "18.1.0",
|
|
42
|
+
"react": "^19.1.0",
|
|
43
|
+
"react-dom": "^19.2.7",
|
|
46
44
|
"rollup": "^2.70.2",
|
|
47
45
|
"sinon": "^14.0.0",
|
|
46
|
+
"ts-jest": "^29.3.1",
|
|
48
47
|
"typescript": "^4.6.3"
|
|
49
48
|
},
|
|
50
49
|
"files": [
|
|
@@ -53,5 +52,5 @@
|
|
|
53
52
|
"engines": {
|
|
54
53
|
"node": ">=14"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "cb57a92ecea594d74b31e7700768c661e8eb401d"
|
|
57
56
|
}
|