@atlaskit/analytics-next
Advanced tools
Comparing version 5.0.2 to 5.1.0
# @atlaskit/analytics-next | ||
## 5.1.0 | ||
### Minor Changes | ||
- [minor][d0db01b410](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d0db01b410): | ||
TypeScript users of withAnalyticsEvents and withAnalyticsContext are now required to provide props as a generic type. This is so that TypeScript can correctly calculate the props and defaultProps of the returned component. | ||
Before: | ||
```typescript | ||
withAnalyticsEvents()(Button) as ComponentClass<Props>; | ||
``` | ||
After: | ||
```typescript | ||
withAnalyticsEvents<Props>()(Button); | ||
``` | ||
## 5.0.2 | ||
@@ -4,0 +24,0 @@ |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"sideEffects": false | ||
} |
// For version "3.0.0" | ||
import * as React from 'react'; | ||
import { PropsInjector, SumPropsInjector } from '@atlaskit/type-helpers'; | ||
import { SumPropsInjector } from '@atlaskit/type-helpers'; | ||
@@ -115,2 +115,6 @@ /* | ||
type AnalyticsHOC<Props, AppliedProps> = ( | ||
Component: React.ComponentType<Props>, | ||
) => React.ComponentType<Props & AppliedProps>; | ||
/* | ||
@@ -123,9 +127,9 @@ withAnalyticsContext.js | ||
export type WithAnalyticsContextFunction = PropsInjector< | ||
WithAnalyticsContextProps | ||
>; | ||
export type WithAnalyticsContextFunction< | ||
OwnProps extends object | ||
> = AnalyticsHOC<OwnProps, WithAnalyticsContextProps>; | ||
export function withAnalyticsContext( | ||
export function withAnalyticsContext<OwnProps>( | ||
defaultData?: any, | ||
): WithAnalyticsContextFunction; | ||
): WithAnalyticsContextFunction<OwnProps>; | ||
@@ -139,11 +143,11 @@ /* | ||
interface AnalyticsEventCreator<TOwnProps> { | ||
interface AnalyticsEventCreator<OwnProps> { | ||
( | ||
create: CreateUIAnalyticsEventSignature, | ||
props: TOwnProps, | ||
props: OwnProps, | ||
): UIAnalyticsEventInterface; | ||
} | ||
export interface EventMap<TOwnProps> { | ||
[k: string]: AnalyticsEventPayload | AnalyticsEventCreator<TOwnProps>; | ||
export interface EventMap<OwnProps> { | ||
[k: string]: AnalyticsEventPayload | AnalyticsEventCreator<OwnProps>; | ||
} | ||
@@ -155,11 +159,14 @@ | ||
export type WithAnalyticsEventFunction = PropsInjector<WithAnalyticsEventProps>; | ||
export type WithAnalyticsEventFunction<OwnProps extends object> = AnalyticsHOC< | ||
OwnProps, | ||
WithAnalyticsEventProps | ||
>; | ||
export function withAnalyticsEvents<TOwnProps>( | ||
createEventMap?: EventMap<TOwnProps>, | ||
): WithAnalyticsEventFunction; | ||
export function withAnalyticsEvents<OwnProps>( | ||
createEventMap?: EventMap<OwnProps>, | ||
): WithAnalyticsEventFunction<OwnProps>; | ||
// Just in case your props are of Sum type, and not a Record. | ||
export function withAnalyticsForSumTypeProps<TOwnProps>( | ||
createEventMap?: EventMap<TOwnProps>, | ||
export function withAnalyticsForSumTypeProps<OwnProps>( | ||
createEventMap?: EventMap<OwnProps>, | ||
): SumPropsInjector<WithAnalyticsEventProps>; | ||
@@ -166,0 +173,0 @@ |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"description": "The 🆕 Atlaskit component analytics framework", | ||
@@ -31,7 +31,7 @@ "license": "Apache-2.0", | ||
"@atlaskit/build-utils": "^2.0.0", | ||
"@atlaskit/button": "^13.0.0", | ||
"@atlaskit/button": "^13.0.13", | ||
"@atlaskit/docs": "^8.1.1", | ||
"@atlaskit/field-text": "^9.0.2", | ||
"@atlaskit/ssr": "^0.1.0", | ||
"@atlaskit/type-helpers": "^4.0.0", | ||
"@atlaskit/type-helpers": "^4.1.3", | ||
"enzyme": "^3.7.0", | ||
@@ -38,0 +38,0 @@ "react-dom": "^16.8.0", |
{ | ||
"name": "@atlaskit/analytics-next", | ||
"version": "5.0.2", | ||
"version": "5.1.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
109346
1635