@atlaskit/analytics-next
Advanced tools
Comparing version 5.3.1 to 5.4.0
# @atlaskit/analytics-next | ||
## 5.4.0 | ||
### Minor Changes | ||
- [minor][e1f8aaf33b](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e1f8aaf33b): | ||
- Adding entry point for `AnalyticsErrorBoundary` package | ||
``` | ||
// How to use | ||
// Import via entry point | ||
import AnalyticsListener from '@atlaskit/analytics-next/AnalyticsListener'; | ||
import AnalyticsErrorBoundary from '@atlaskit/analytics-next/AnalyticsErrorBoundary'; | ||
// Wrapping your component with the component | ||
class ButtonWithAnalyticsErrorBoundary etends React.Component { | ||
handleEvent = (analyticsEvent) => { | ||
const { payload, context } = analyticsEvent; | ||
console.log('Received event:', analyticsEvent, { payload, context }); | ||
}; | ||
render() { | ||
return ( | ||
<AnalyticsListener channel="atlaskit" onEvent={this.handleEvent}> | ||
<AnalyticsErrorBoundary | ||
channel="atlaskit" | ||
data={{ | ||
componentName: 'button', | ||
packageName: '@atlaskit/button', | ||
componentVersion: '999.9.9', | ||
}} | ||
> | ||
<Button>Click me</Button> | ||
</AnalyticsErrorBoundary> | ||
</AnalyticsListener> | ||
) | ||
} | ||
} | ||
``` | ||
Notes on new API: | ||
- Plug-and-play component. As soon and it's wrapping a component it's fully integrated. | ||
- It has Analytics context and events integrated already. Keep in mind it requires `AnalyticsListener` as a top level component to work properly, otherwise it won't trigger analytics events. | ||
## 5.3.1 | ||
@@ -4,0 +50,0 @@ |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.3.1", | ||
"version": "5.4.0", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.3.1", | ||
"version": "5.4.0", | ||
"sideEffects": false | ||
} |
@@ -12,2 +12,3 @@ // @flow | ||
* [AnalyticsListener](#AnalyticsListener) | ||
* [AnalyticsErrorBoundary](#AnalyticsErrorBoundary) | ||
* [AnalyticsContext](#AnalyticsContext) | ||
@@ -70,3 +71,3 @@ * [withAnalyticsContext](#withAnalyticsContext) | ||
A HOC which provides the wrapped component with a method for creating \`UIAnalyticsEvent\`s, via \`props.createAnalyticsEvent\`. | ||
See the section on [creating your own events](/packages/core/analytics-next/docs/concepts#creating-your-own-events) | ||
See the section on [creating your own events](/packages/core/analytics-next/docs/concepts#creating-your-own-events) | ||
in the Concepts page for a thorough explanation of how to use this component. | ||
@@ -119,2 +120,58 @@ | ||
<a name="AnalyticsErrorBoundary"></a> | ||
### AnalyticsErrorBoundary | ||
| ||
${code`import { AnalyticsErrorBoundary } from '@atlaskit/analytics-next';`} | ||
Wrap part of your tree in \`AnalyticsErrorBoundary\` to provide error boundary track to any events created beneath it. | ||
When a component is created verifies all of the components above it in the tree and any error will be catched and tracked automatically. | ||
It's up to the developer pass this information when you're adding the component. | ||
Usage: | ||
${code` | ||
import { | ||
AnalyticsListener, | ||
AnalyticsErrorBoundary | ||
} from '@atlaskit/analytics-next'; | ||
// Wrapping your component with the component | ||
class ButtonWithAnalyticsErrorBoundary etends React.Component { | ||
handleEvent = (analyticsEvent) => { | ||
const { payload, context } = analyticsEvent; | ||
console.log('Received event:', analyticsEvent, { payload, context }); | ||
}; | ||
render() { | ||
return ( | ||
<AnalyticsListener channel="atlaskit" onEvent={this.handleEvent}> | ||
<AnalyticsErrorBoundary | ||
channel="atlaskit" | ||
data={{ | ||
componentName: 'button', | ||
packageName: '@atlaskit/button', | ||
componentVersion: '999.9.9', | ||
}} | ||
> | ||
<Button>Click me</Button> | ||
</AnalyticsErrorBoundary> | ||
</AnalyticsListener> | ||
) | ||
} | ||
} | ||
`} | ||
${( | ||
<Props | ||
heading="AnalyticsErrorBoundary Props" | ||
props={require('!!extract-react-types-loader!../src/AnalyticsErrorBoundary')} | ||
/> | ||
)} | ||
<a name="AnalyticsContext"></a> | ||
@@ -121,0 +178,0 @@ ### AnalyticsContext |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.3.1", | ||
"version": "5.4.0", | ||
"description": "The 🆕 Atlaskit component analytics framework", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.3.1", | ||
"version": "5.4.0", | ||
"sideEffects": false | ||
} |
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
198846
2859