@atlaskit/analytics-next
Advanced tools
Comparing version 8.1.4 to 8.2.0
# @atlaskit/analytics-next | ||
## 8.2.0 | ||
### Minor Changes | ||
- [`0dbf0427287`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0dbf0427287) - [ux] Added new optional props to allow executing on catching error and rendering an error screen on error | ||
## 8.1.4 | ||
@@ -4,0 +10,0 @@ |
@@ -50,12 +50,7 @@ "use strict"; | ||
function BaseAnalyticsErrorBoundary() { | ||
function BaseAnalyticsErrorBoundary(props) { | ||
var _this; | ||
(0, _classCallCheck2.default)(this, BaseAnalyticsErrorBoundary); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this = _super.call(this, props); | ||
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fireAnalytics", function (analyticsErrorPayload) { | ||
@@ -74,2 +69,5 @@ var _this$props = _this.props, | ||
}); | ||
_this.state = { | ||
hasError: false | ||
}; | ||
return _this; | ||
@@ -81,2 +79,3 @@ } | ||
value: function componentDidCatch(error, info) { | ||
var onError = this.props.onError; | ||
var payload = { | ||
@@ -87,2 +86,6 @@ error: error, | ||
this.fireAnalytics(payload); | ||
onError && onError(error, info); | ||
this.setState({ | ||
hasError: true | ||
}); | ||
} | ||
@@ -94,3 +97,12 @@ }, { | ||
data = _this$props2.data, | ||
children = _this$props2.children; | ||
children = _this$props2.children, | ||
ErrorComponent = _this$props2.ErrorComponent; | ||
var hasError = this.state.hasError; | ||
if (hasError && ErrorComponent) { | ||
return /*#__PURE__*/_react.default.createElement(_LegacyAnalyticsContext.default, { | ||
data: data | ||
}, /*#__PURE__*/_react.default.createElement(ErrorComponent, null)); | ||
} | ||
return /*#__PURE__*/_react.default.createElement(_LegacyAnalyticsContext.default, { | ||
@@ -97,0 +109,0 @@ data: data |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "8.1.4", | ||
"version": "8.2.0", | ||
"sideEffects": false | ||
} |
@@ -7,4 +7,4 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
export class BaseAnalyticsErrorBoundary extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
constructor(props) { | ||
super(props); | ||
@@ -27,5 +27,12 @@ _defineProperty(this, "fireAnalytics", analyticsErrorPayload => { | ||
}); | ||
this.state = { | ||
hasError: false | ||
}; | ||
} | ||
componentDidCatch(error, info) { | ||
const { | ||
onError | ||
} = this.props; | ||
const payload = { | ||
@@ -36,2 +43,6 @@ error, | ||
this.fireAnalytics(payload); | ||
onError && onError(error, info); | ||
this.setState({ | ||
hasError: true | ||
}); | ||
} | ||
@@ -42,4 +53,15 @@ | ||
data, | ||
children | ||
children, | ||
ErrorComponent | ||
} = this.props; | ||
const { | ||
hasError | ||
} = this.state; | ||
if (hasError && ErrorComponent) { | ||
return /*#__PURE__*/React.createElement(AnalyticsContext, { | ||
data: data | ||
}, /*#__PURE__*/React.createElement(ErrorComponent, null)); | ||
} | ||
return /*#__PURE__*/React.createElement(AnalyticsContext, { | ||
@@ -46,0 +68,0 @@ data: data |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "8.1.4", | ||
"version": "8.2.0", | ||
"sideEffects": false | ||
} |
@@ -26,3 +26,3 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
function BaseAnalyticsErrorBoundary() { | ||
function BaseAnalyticsErrorBoundary(props) { | ||
var _this; | ||
@@ -32,8 +32,4 @@ | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call(this, props); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (analyticsErrorPayload) { | ||
@@ -53,2 +49,5 @@ var _this$props = _this.props, | ||
_this.state = { | ||
hasError: false | ||
}; | ||
return _this; | ||
@@ -60,2 +59,3 @@ } | ||
value: function componentDidCatch(error, info) { | ||
var onError = this.props.onError; | ||
var payload = { | ||
@@ -66,2 +66,6 @@ error: error, | ||
this.fireAnalytics(payload); | ||
onError && onError(error, info); | ||
this.setState({ | ||
hasError: true | ||
}); | ||
} | ||
@@ -73,3 +77,12 @@ }, { | ||
data = _this$props2.data, | ||
children = _this$props2.children; | ||
children = _this$props2.children, | ||
ErrorComponent = _this$props2.ErrorComponent; | ||
var hasError = this.state.hasError; | ||
if (hasError && ErrorComponent) { | ||
return /*#__PURE__*/React.createElement(AnalyticsContext, { | ||
data: data | ||
}, /*#__PURE__*/React.createElement(ErrorComponent, null)); | ||
} | ||
return /*#__PURE__*/React.createElement(AnalyticsContext, { | ||
@@ -76,0 +89,0 @@ data: data |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "8.1.4", | ||
"version": "8.2.0", | ||
"sideEffects": false | ||
} |
@@ -11,2 +11,4 @@ import React, { Component, ReactNode } from 'react'; | ||
data: {}; | ||
ErrorComponent?: React.ComponentType; | ||
onError?: (error: Error, info?: AnalyticsErrorBoundaryErrorInfo) => void; | ||
} | ||
@@ -18,3 +20,7 @@ declare type AnalyticsErrorBoundaryPayload = { | ||
}; | ||
export declare class BaseAnalyticsErrorBoundary extends Component<AnalyticsErrorBoundaryProps, {}> { | ||
declare type AnalyticsErrorBoundaryState = { | ||
hasError: boolean; | ||
}; | ||
export declare class BaseAnalyticsErrorBoundary extends Component<AnalyticsErrorBoundaryProps, AnalyticsErrorBoundaryState> { | ||
constructor(props: AnalyticsErrorBoundaryProps); | ||
fireAnalytics: (analyticsErrorPayload: AnalyticsErrorBoundaryPayload) => void; | ||
@@ -24,3 +30,3 @@ componentDidCatch(error: Error, info?: AnalyticsErrorBoundaryErrorInfo): void; | ||
} | ||
declare const AnalyticsErrorBoundary: React.ForwardRefExoticComponent<Pick<AnalyticsErrorBoundaryProps, "children" | "channel" | "data"> & React.RefAttributes<any>>; | ||
declare const AnalyticsErrorBoundary: React.ForwardRefExoticComponent<Pick<AnalyticsErrorBoundaryProps, "children" | "channel" | "data" | "ErrorComponent" | "onError"> & React.RefAttributes<any>>; | ||
export default AnalyticsErrorBoundary; |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "8.1.4", | ||
"version": "8.2.0", | ||
"description": "React components, HOCs and hooks to assist with tracking user activity with React components", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
224448
3908