@honeybadger-io/react 4.8.1 → 4.9.0
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/dist/HoneybadgerErrorBoundary.d.ts +5 -0
- package/dist/honeybadger-react.cjs.js +20 -9
- package/dist/honeybadger-react.cjs.js.map +1 -1
- package/dist/honeybadger-react.esm.js +18 -7
- package/dist/honeybadger-react.esm.js.map +1 -1
- package/dist/honeybadger-react.js +21 -9
- package/dist/honeybadger-react.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +4 -3
|
@@ -4,6 +4,7 @@ import { DefaultErrorComponentProps } from './DefaultErrorComponent';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
interface HoneybadgerErrorBoundaryProps {
|
|
6
6
|
honeybadger: typeof Honeybadger;
|
|
7
|
+
showUserFeedbackFormOnError?: boolean;
|
|
7
8
|
ErrorComponent?: ReactNode;
|
|
8
9
|
}
|
|
9
10
|
interface HoneybadgerErrorBoundaryState extends DefaultErrorComponentProps {
|
|
@@ -12,9 +13,13 @@ interface HoneybadgerErrorBoundaryState extends DefaultErrorComponentProps {
|
|
|
12
13
|
export default class HoneybadgerErrorBoundary extends Component<HoneybadgerErrorBoundaryProps, HoneybadgerErrorBoundaryState> {
|
|
13
14
|
static propTypes: {
|
|
14
15
|
honeybadger: PropTypes.Validator<object>;
|
|
16
|
+
showUserFeedbackFormOnError: PropTypes.Requireable<boolean>;
|
|
15
17
|
children: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
16
18
|
ErrorComponent: PropTypes.Requireable<NonNullable<PropTypes.ReactElementLike | ((...args: any[]) => any) | null | undefined>>;
|
|
17
19
|
};
|
|
20
|
+
static defaultProps: {
|
|
21
|
+
showUserFeedbackFormOnError: boolean;
|
|
22
|
+
};
|
|
18
23
|
constructor(props: HoneybadgerErrorBoundaryProps);
|
|
19
24
|
static getDerivedStateFromError(error: Error): HoneybadgerErrorBoundaryState;
|
|
20
25
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var honeybadger = require('@honeybadger-io/js/dist/browser/honeybadger');
|
|
7
6
|
var React = require('react');
|
|
8
7
|
var PropTypes = require('prop-types');
|
|
9
8
|
|
|
10
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
10
|
|
|
12
|
-
var
|
|
11
|
+
var honeybadger__default = /*#__PURE__*/_interopDefaultLegacy(honeybadger);
|
|
13
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
13
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
15
14
|
|
|
16
15
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
17
16
|
class DefaultErrorComponent extends React.Component {
|
|
18
17
|
render() {
|
|
19
|
-
return (
|
|
18
|
+
return (React__default["default"].createElement("div", { className: 'error' },
|
|
19
|
+
React__default["default"].createElement("div", null, "An Error Occurred"),
|
|
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) : '')));
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
DefaultErrorComponent.propTypes = {
|
|
@@ -32,6 +34,11 @@ class HoneybadgerErrorBoundary extends React.Component {
|
|
|
32
34
|
info: null,
|
|
33
35
|
errorOccurred: false
|
|
34
36
|
};
|
|
37
|
+
this.props.honeybadger.afterNotify((error, _notice) => {
|
|
38
|
+
if (!error && this.props.showUserFeedbackFormOnError) {
|
|
39
|
+
this.props.honeybadger.showUserFeedbackForm();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
35
42
|
}
|
|
36
43
|
static getDerivedStateFromError(error) {
|
|
37
44
|
return { error: error, errorOccurred: true, info: null };
|
|
@@ -43,23 +50,27 @@ class HoneybadgerErrorBoundary extends React.Component {
|
|
|
43
50
|
getErrorComponent() {
|
|
44
51
|
return this.props.ErrorComponent
|
|
45
52
|
? React__default["default"].createElement(this.props.ErrorComponent, this.state)
|
|
46
|
-
:
|
|
53
|
+
: React__default["default"].createElement(DefaultErrorComponent, { ...this.state });
|
|
47
54
|
}
|
|
48
55
|
render() {
|
|
49
|
-
return (
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, this.state.errorOccurred
|
|
57
|
+
? this.getErrorComponent()
|
|
58
|
+
: this.props.children));
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
HoneybadgerErrorBoundary.propTypes = {
|
|
55
62
|
honeybadger: PropTypes__default["default"].object.isRequired,
|
|
63
|
+
showUserFeedbackFormOnError: PropTypes__default["default"].bool,
|
|
56
64
|
children: PropTypes__default["default"].element,
|
|
57
65
|
ErrorComponent: PropTypes__default["default"].oneOfType([PropTypes__default["default"].element, PropTypes__default["default"].func])
|
|
58
66
|
};
|
|
67
|
+
HoneybadgerErrorBoundary.defaultProps = {
|
|
68
|
+
showUserFeedbackFormOnError: false
|
|
69
|
+
};
|
|
59
70
|
|
|
60
71
|
Object.defineProperty(exports, 'Honeybadger', {
|
|
61
72
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
73
|
+
get: function () { return honeybadger__default["default"]; }
|
|
63
74
|
});
|
|
64
75
|
exports.HoneybadgerErrorBoundary = HoneybadgerErrorBoundary;
|
|
65
76
|
//# sourceMappingURL=honeybadger-react.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-react.cjs.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"honeybadger-react.cjs.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport default class DefaultErrorComponent extends Component {\n render() {\n return (React.createElement(\"div\", { className: 'error' },\n React.createElement(\"div\", null, \"An Error Occurred\"),\n React.createElement(\"div\", null, JSON.stringify(this.props.error, null, 2)),\n React.createElement(\"div\", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));\n }\n}\nDefaultErrorComponent.propTypes = {\n error: PropTypes.object,\n info: PropTypes.object\n};\n//# sourceMappingURL=DefaultErrorComponent.js.map","import React, { Component } from 'react';\nimport DefaultErrorComponent from './DefaultErrorComponent';\nimport PropTypes from 'prop-types';\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 this.props.honeybadger.afterNotify((error, _notice) => {\n if (!error && this.props.showUserFeedbackFormOnError) {\n this.props.honeybadger.showUserFeedbackForm();\n }\n });\n }\n static getDerivedStateFromError(error) {\n return { error: error, errorOccurred: true, info: null };\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ errorOccurred: true, error: 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.propTypes = {\n honeybadger: PropTypes.object.isRequired,\n showUserFeedbackFormOnError: PropTypes.bool,\n children: PropTypes.element,\n ErrorComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func])\n};\nHoneybadgerErrorBoundary.defaultProps = {\n showUserFeedbackFormOnError: false\n};\n//# sourceMappingURL=HoneybadgerErrorBoundary.js.map"],"names":["Component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BAAS,CAAC,IAAI;AAC/C,IAAI,QAAQ,EAAEA,6BAAS,CAAC,OAAO;AAC/B,IAAI,cAAc,EAAEA,6BAAS,CAAC,SAAS,CAAC,CAACA,6BAAS,CAAC,OAAO,EAAEA,6BAAS,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC,CAAC;AACF,wBAAwB,CAAC,YAAY,GAAG;AACxC,IAAI,2BAA2B,EAAE,KAAK;AACtC,CAAC;;;;;;;;"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
export { default as Honeybadger } from '@honeybadger-io/js';
|
|
2
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
1
|
+
export { default as Honeybadger } from '@honeybadger-io/js/dist/browser/honeybadger';
|
|
3
2
|
import React, { Component } from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
|
|
6
5
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
7
6
|
class DefaultErrorComponent extends Component {
|
|
8
7
|
render() {
|
|
9
|
-
return (
|
|
8
|
+
return (React.createElement("div", { className: 'error' },
|
|
9
|
+
React.createElement("div", null, "An Error Occurred"),
|
|
10
|
+
React.createElement("div", null, JSON.stringify(this.props.error, null, 2)),
|
|
11
|
+
React.createElement("div", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
DefaultErrorComponent.propTypes = {
|
|
@@ -22,6 +24,11 @@ class HoneybadgerErrorBoundary extends Component {
|
|
|
22
24
|
info: null,
|
|
23
25
|
errorOccurred: false
|
|
24
26
|
};
|
|
27
|
+
this.props.honeybadger.afterNotify((error, _notice) => {
|
|
28
|
+
if (!error && this.props.showUserFeedbackFormOnError) {
|
|
29
|
+
this.props.honeybadger.showUserFeedbackForm();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
25
32
|
}
|
|
26
33
|
static getDerivedStateFromError(error) {
|
|
27
34
|
return { error: error, errorOccurred: true, info: null };
|
|
@@ -33,19 +40,23 @@ class HoneybadgerErrorBoundary extends Component {
|
|
|
33
40
|
getErrorComponent() {
|
|
34
41
|
return this.props.ErrorComponent
|
|
35
42
|
? React.createElement(this.props.ErrorComponent, this.state)
|
|
36
|
-
:
|
|
43
|
+
: React.createElement(DefaultErrorComponent, { ...this.state });
|
|
37
44
|
}
|
|
38
45
|
render() {
|
|
39
|
-
return (
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
return (React.createElement(React.Fragment, null, this.state.errorOccurred
|
|
47
|
+
? this.getErrorComponent()
|
|
48
|
+
: this.props.children));
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
HoneybadgerErrorBoundary.propTypes = {
|
|
45
52
|
honeybadger: PropTypes.object.isRequired,
|
|
53
|
+
showUserFeedbackFormOnError: PropTypes.bool,
|
|
46
54
|
children: PropTypes.element,
|
|
47
55
|
ErrorComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
48
56
|
};
|
|
57
|
+
HoneybadgerErrorBoundary.defaultProps = {
|
|
58
|
+
showUserFeedbackFormOnError: false
|
|
59
|
+
};
|
|
49
60
|
|
|
50
61
|
export { HoneybadgerErrorBoundary };
|
|
51
62
|
//# sourceMappingURL=honeybadger-react.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-react.esm.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"honeybadger-react.esm.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport default class DefaultErrorComponent extends Component {\n render() {\n return (React.createElement(\"div\", { className: 'error' },\n React.createElement(\"div\", null, \"An Error Occurred\"),\n React.createElement(\"div\", null, JSON.stringify(this.props.error, null, 2)),\n React.createElement(\"div\", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));\n }\n}\nDefaultErrorComponent.propTypes = {\n error: PropTypes.object,\n info: PropTypes.object\n};\n//# sourceMappingURL=DefaultErrorComponent.js.map","import React, { Component } from 'react';\nimport DefaultErrorComponent from './DefaultErrorComponent';\nimport PropTypes from 'prop-types';\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 this.props.honeybadger.afterNotify((error, _notice) => {\n if (!error && this.props.showUserFeedbackFormOnError) {\n this.props.honeybadger.showUserFeedbackForm();\n }\n });\n }\n static getDerivedStateFromError(error) {\n return { error: error, errorOccurred: true, info: null };\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ errorOccurred: true, error: 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.propTypes = {\n honeybadger: PropTypes.object.isRequired,\n showUserFeedbackFormOnError: PropTypes.bool,\n children: PropTypes.element,\n ErrorComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func])\n};\nHoneybadgerErrorBoundary.defaultProps = {\n showUserFeedbackFormOnError: false\n};\n//# sourceMappingURL=HoneybadgerErrorBoundary.js.map"],"names":[],"mappings":";;;;AAEA;AACe,MAAM,qBAAqB,SAAS,SAAS,CAAC;AAC7D,IAAI,MAAM,GAAG;AACb,QAAQ,QAAQ,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;AACjE,YAAY,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,mBAAmB,CAAC;AACjE,YAAY,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAA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var HoneybadgerReact = (function (exports, honeybadger, React, PropTypes) {
|
|
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
|
-
var
|
|
6
|
+
var honeybadger__default = /*#__PURE__*/_interopDefaultLegacy(honeybadger);
|
|
7
7
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
8
8
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11
11
|
class DefaultErrorComponent extends React.Component {
|
|
12
12
|
render() {
|
|
13
|
-
return (
|
|
13
|
+
return (React__default["default"].createElement("div", { className: 'error' },
|
|
14
|
+
React__default["default"].createElement("div", null, "An Error Occurred"),
|
|
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) : '')));
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
DefaultErrorComponent.propTypes = {
|
|
@@ -26,6 +29,11 @@ var HoneybadgerReact = (function (exports, js, jsxRuntime, React, PropTypes) {
|
|
|
26
29
|
info: null,
|
|
27
30
|
errorOccurred: false
|
|
28
31
|
};
|
|
32
|
+
this.props.honeybadger.afterNotify((error, _notice) => {
|
|
33
|
+
if (!error && this.props.showUserFeedbackFormOnError) {
|
|
34
|
+
this.props.honeybadger.showUserFeedbackForm();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
29
37
|
}
|
|
30
38
|
static getDerivedStateFromError(error) {
|
|
31
39
|
return { error: error, errorOccurred: true, info: null };
|
|
@@ -37,23 +45,27 @@ var HoneybadgerReact = (function (exports, js, jsxRuntime, React, PropTypes) {
|
|
|
37
45
|
getErrorComponent() {
|
|
38
46
|
return this.props.ErrorComponent
|
|
39
47
|
? React__default["default"].createElement(this.props.ErrorComponent, this.state)
|
|
40
|
-
:
|
|
48
|
+
: React__default["default"].createElement(DefaultErrorComponent, { ...this.state });
|
|
41
49
|
}
|
|
42
50
|
render() {
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, this.state.errorOccurred
|
|
52
|
+
? this.getErrorComponent()
|
|
53
|
+
: this.props.children));
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
HoneybadgerErrorBoundary.propTypes = {
|
|
49
57
|
honeybadger: PropTypes__default["default"].object.isRequired,
|
|
58
|
+
showUserFeedbackFormOnError: PropTypes__default["default"].bool,
|
|
50
59
|
children: PropTypes__default["default"].element,
|
|
51
60
|
ErrorComponent: PropTypes__default["default"].oneOfType([PropTypes__default["default"].element, PropTypes__default["default"].func])
|
|
52
61
|
};
|
|
62
|
+
HoneybadgerErrorBoundary.defaultProps = {
|
|
63
|
+
showUserFeedbackFormOnError: false
|
|
64
|
+
};
|
|
53
65
|
|
|
54
66
|
Object.defineProperty(exports, 'Honeybadger', {
|
|
55
67
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
68
|
+
get: function () { return honeybadger__default["default"]; }
|
|
57
69
|
});
|
|
58
70
|
exports.HoneybadgerErrorBoundary = HoneybadgerErrorBoundary;
|
|
59
71
|
|
|
@@ -61,5 +73,5 @@ var HoneybadgerReact = (function (exports, js, jsxRuntime, React, PropTypes) {
|
|
|
61
73
|
|
|
62
74
|
return exports;
|
|
63
75
|
|
|
64
|
-
})({},
|
|
76
|
+
})({}, honeybadger, React, PropTypes);
|
|
65
77
|
//# sourceMappingURL=honeybadger-react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-react.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"honeybadger-react.js","sources":["../../build/DefaultErrorComponent.js","../../build/HoneybadgerErrorBoundary.js"],"sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport default class DefaultErrorComponent extends Component {\n render() {\n return (React.createElement(\"div\", { className: 'error' },\n React.createElement(\"div\", null, \"An Error Occurred\"),\n React.createElement(\"div\", null, JSON.stringify(this.props.error, null, 2)),\n React.createElement(\"div\", null, this.props.info ? JSON.stringify(this.props.info, null, 2) : '')));\n }\n}\nDefaultErrorComponent.propTypes = {\n error: PropTypes.object,\n info: PropTypes.object\n};\n//# sourceMappingURL=DefaultErrorComponent.js.map","import React, { Component } from 'react';\nimport DefaultErrorComponent from './DefaultErrorComponent';\nimport PropTypes from 'prop-types';\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 this.props.honeybadger.afterNotify((error, _notice) => {\n if (!error && this.props.showUserFeedbackFormOnError) {\n this.props.honeybadger.showUserFeedbackForm();\n }\n });\n }\n static getDerivedStateFromError(error) {\n return { error: error, errorOccurred: true, info: null };\n }\n componentDidCatch(error, errorInfo) {\n this.setState({ errorOccurred: true, error: 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.propTypes = {\n honeybadger: PropTypes.object.isRequired,\n showUserFeedbackFormOnError: PropTypes.bool,\n children: PropTypes.element,\n ErrorComponent: PropTypes.oneOfType([PropTypes.element, PropTypes.func])\n};\nHoneybadgerErrorBoundary.defaultProps = {\n showUserFeedbackFormOnError: false\n};\n//# sourceMappingURL=HoneybadgerErrorBoundary.js.map"],"names":["Component","React","PropTypes"],"mappings":";;;;;;;;;IAEA;IACe,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6BAAS,CAAC,OAAO;IAC/B,IAAI,cAAc,EAAEA,6BAAS,CAAC,SAAS,CAAC,CAACA,6BAAS,CAAC,OAAO,EAAEA,6BAAS,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC,CAAC;IACF,wBAAwB,CAAC,YAAY,GAAG;IACxC,IAAI,2BAA2B,EAAE,KAAK;IACtC,CAAC;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "React.js integration for honeybadger",
|
|
5
5
|
"author": "Jason Truesdell <jason@yuzuten.com> (https://github.com/JasonTrue)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@honeybadger-io/js": "^4.
|
|
36
|
+
"@honeybadger-io/js": "^4.9.0",
|
|
37
37
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
38
38
|
"@types/jest": "^29.0.0",
|
|
39
39
|
"@types/react": "^17.0.44",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"cross-env": "^7.0.0",
|
|
43
43
|
"gh-pages": "^4.0.0",
|
|
44
44
|
"husky": "^8.0.0",
|
|
45
|
+
"jest-fetch-mock": "^3.0.3",
|
|
45
46
|
"react": "^18.1.0",
|
|
46
47
|
"react-scripts": "^5.0.1",
|
|
47
48
|
"react-test-renderer": "^18.1.0",
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"files": [
|
|
54
55
|
"dist"
|
|
55
56
|
],
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "050715097e0299d2ff9bdb3a91cc2d13e1fdc78d"
|
|
57
58
|
}
|