@atlaskit/analytics-next 9.1.1 → 9.1.3

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.
Files changed (59) hide show
  1. package/AnalyticsContext/package.json +2 -2
  2. package/AnalyticsErrorBoundary/package.json +2 -2
  3. package/AnalyticsEvent/package.json +2 -2
  4. package/AnalyticsListener/package.json +2 -2
  5. package/CHANGELOG.md +12 -0
  6. package/UIAnalyticsEvent/package.json +2 -2
  7. package/createAndFireEvents/package.json +2 -2
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/version.json +1 -1
  10. package/dist/esm/version.json +1 -1
  11. package/dist/types/components/AnalyticsContext/types.d.ts +1 -1
  12. package/dist/types/components/AnalyticsErrorBoundary.d.ts +2 -2
  13. package/dist/types/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +1 -1
  14. package/dist/types/components/AnalyticsListener/types.d.ts +1 -1
  15. package/dist/types/events/AnalyticsEvent.d.ts +4 -4
  16. package/dist/types/events/UIAnalyticsEvent.d.ts +5 -5
  17. package/dist/types/hooks/useAnalyticsEvents.d.ts +1 -1
  18. package/dist/types/hooks/useCallbackWithAnalytics.d.ts +1 -1
  19. package/dist/types/hooks/usePatchedProps.d.ts +1 -1
  20. package/dist/types/hooks/usePlatformLeafEventHandler.d.ts +2 -2
  21. package/dist/types/hooks/usePlatformLeafSyntheticEventHandler.d.ts +2 -2
  22. package/dist/types/types.d.ts +4 -4
  23. package/dist/types/utils/createAndFireEvent.d.ts +1 -1
  24. package/dist/types-ts4.5/components/AnalyticsContext/LegacyAnalyticsContext.d.ts +29 -0
  25. package/dist/types-ts4.5/components/AnalyticsContext/ModernAnalyticsContext.d.ts +3 -0
  26. package/dist/types-ts4.5/components/AnalyticsContext/index.d.ts +3 -0
  27. package/dist/types-ts4.5/components/AnalyticsContext/types.d.ts +9 -0
  28. package/dist/types-ts4.5/components/AnalyticsErrorBoundary.d.ts +24 -0
  29. package/dist/types-ts4.5/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +33 -0
  30. package/dist/types-ts4.5/components/AnalyticsListener/ModernAnalyticsListener.d.ts +3 -0
  31. package/dist/types-ts4.5/components/AnalyticsListener/index.d.ts +3 -0
  32. package/dist/types-ts4.5/components/AnalyticsListener/types.d.ts +12 -0
  33. package/dist/types-ts4.5/events/AnalyticsEvent.d.ts +15 -0
  34. package/dist/types-ts4.5/events/UIAnalyticsEvent.d.ts +20 -0
  35. package/dist/types-ts4.5/hocs/withAnalyticsContext.d.ts +6 -0
  36. package/dist/types-ts4.5/hocs/withAnalyticsEvents.d.ts +12 -0
  37. package/dist/types-ts4.5/hooks/useAnalyticsContext.d.ts +2 -0
  38. package/dist/types-ts4.5/hooks/useAnalyticsEvents.d.ts +5 -0
  39. package/dist/types-ts4.5/hooks/useCallbackWithAnalytics.d.ts +2 -0
  40. package/dist/types-ts4.5/hooks/usePatchedProps.d.ts +5 -0
  41. package/dist/types-ts4.5/hooks/usePlatformLeafEventHandler.d.ts +12 -0
  42. package/dist/types-ts4.5/hooks/usePlatformLeafSyntheticEventHandler.d.ts +11 -0
  43. package/dist/types-ts4.5/hooks/useTrackedRef.d.ts +2 -0
  44. package/dist/types-ts4.5/index.d.ts +25 -0
  45. package/dist/types-ts4.5/performance/examples.d.ts +5 -0
  46. package/dist/types-ts4.5/test-utils/useRenderCounter.d.ts +1 -0
  47. package/dist/types-ts4.5/types.d.ts +6 -0
  48. package/dist/types-ts4.5/utils/cleanProps.d.ts +3 -0
  49. package/dist/types-ts4.5/utils/createAndFireEvent.d.ts +4 -0
  50. package/package.json +10 -2
  51. package/report.api.md +2 -2
  52. package/tmp/api-report-tmp.d.ts +2 -2
  53. package/types/package.json +2 -2
  54. package/useAnalyticsEvents/package.json +2 -2
  55. package/useCallbackWithAnalytics/package.json +2 -2
  56. package/usePatchedProps/package.json +2 -2
  57. package/usePlatformLeafEventHandler/package.json +2 -2
  58. package/withAnalyticsContext/package.json +2 -2
  59. package/withAnalyticsEvents/package.json +2 -2
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/components/AnalyticsContext/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/components/AnalyticsContext/index.d.ts"
11
+ "../dist/types-ts4.5/components/AnalyticsContext/index.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/components/AnalyticsErrorBoundary.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/components/AnalyticsErrorBoundary.d.ts"
11
+ "../dist/types-ts4.5/components/AnalyticsErrorBoundary.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/events/AnalyticsEvent.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/events/AnalyticsEvent.d.ts"
11
+ "../dist/types-ts4.5/events/AnalyticsEvent.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/components/AnalyticsListener/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/components/AnalyticsListener/index.d.ts"
11
+ "../dist/types-ts4.5/components/AnalyticsListener/index.d.ts"
12
12
  ]
13
13
  }
14
14
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/analytics-next
2
2
 
3
+ ## 9.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
8
+
9
+ ## 9.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
14
+
3
15
  ## 9.1.1
4
16
 
5
17
  ### Patch Changes
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/events/UIAnalyticsEvent.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/events/UIAnalyticsEvent.d.ts"
11
+ "../dist/types-ts4.5/events/UIAnalyticsEvent.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/utils/createAndFireEvent.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/utils/createAndFireEvent.d.ts"
11
+ "../dist/types-ts4.5/utils/createAndFireEvent.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
3
- export declare type AnalyticsContextFunction = (props: {
3
+ export type AnalyticsContextFunction = (props: {
4
4
  /** Children! */
5
5
  children: React.ReactNode;
6
6
  /** Arbitrary data. Any events created below this component in the tree will
@@ -1,5 +1,5 @@
1
1
  import React, { Component, ReactNode } from 'react';
2
- declare type AnalyticsErrorBoundaryErrorInfo = {
2
+ type AnalyticsErrorBoundaryErrorInfo = {
3
3
  componentStack: string;
4
4
  };
5
5
  export interface AnalyticsErrorBoundaryProps {
@@ -10,7 +10,7 @@ export interface AnalyticsErrorBoundaryProps {
10
10
  ErrorComponent?: React.ComponentType;
11
11
  onError?: (error: Error, info?: AnalyticsErrorBoundaryErrorInfo) => void;
12
12
  }
13
- declare type AnalyticsErrorBoundaryState = {
13
+ type AnalyticsErrorBoundaryState = {
14
14
  hasError: boolean;
15
15
  };
16
16
  /**
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
4
4
  import UIAnalyticsEvent from '../../events/UIAnalyticsEvent';
5
- declare type Props = {
5
+ type Props = {
6
6
  /** Children! */
7
7
  children?: React.ReactNode;
8
8
  /** The channel to listen for events on. */
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
3
3
  import UIAnalyticsEvent from '../../events/UIAnalyticsEvent';
4
- export declare type AnalyticsListenerFunction = (props: {
4
+ export type AnalyticsListenerFunction = (props: {
5
5
  /** Children! */
6
6
  children?: React.ReactNode;
7
7
  /** The channel to listen for events on. */
@@ -1,7 +1,7 @@
1
- export declare type AnalyticsEventPayload = Record<string, any>;
2
- declare type AnalyticsEventCallback = (payload: AnalyticsEventPayload) => AnalyticsEventPayload;
3
- declare type AnalyticsEventUpdater = AnalyticsEventPayload | AnalyticsEventCallback;
4
- export declare type AnalyticsEventProps = {
1
+ export type AnalyticsEventPayload = Record<string, any>;
2
+ type AnalyticsEventCallback = (payload: AnalyticsEventPayload) => AnalyticsEventPayload;
3
+ type AnalyticsEventUpdater = AnalyticsEventPayload | AnalyticsEventCallback;
4
+ export type AnalyticsEventProps = {
5
5
  payload: AnalyticsEventPayload;
6
6
  };
7
7
  export declare const isAnalyticsEvent: (obj: any) => boolean;
@@ -1,8 +1,8 @@
1
1
  import AnalyticsEvent, { AnalyticsEventPayload, AnalyticsEventProps } from './AnalyticsEvent';
2
- declare type ChannelIdentifier = string;
3
- declare type Context = Record<string, any>[];
4
- export declare type UIAnalyticsEventHandler = (event: UIAnalyticsEvent, channel?: ChannelIdentifier) => void;
5
- export declare type UIAnalyticsEventProps = AnalyticsEventProps & {
2
+ type ChannelIdentifier = string;
3
+ type Context = Record<string, any>[];
4
+ export type UIAnalyticsEventHandler = (event: UIAnalyticsEvent, channel?: ChannelIdentifier) => void;
5
+ export type UIAnalyticsEventProps = AnalyticsEventProps & {
6
6
  context?: Context;
7
7
  handlers?: UIAnalyticsEventHandler[];
8
8
  };
@@ -14,7 +14,7 @@ export default class UIAnalyticsEvent extends AnalyticsEvent {
14
14
  _isUIAnalyticsEvent: boolean;
15
15
  constructor(props: UIAnalyticsEventProps);
16
16
  clone: () => UIAnalyticsEvent | null;
17
- fire: (channel?: string | undefined) => void;
17
+ fire: (channel?: string) => void;
18
18
  update(updater: Record<string, any> | ((payload: AnalyticsEventPayload) => AnalyticsEventPayload)): this;
19
19
  }
20
20
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CreateUIAnalyticsEvent } from '../types';
2
- export declare type UseAnalyticsEventsHook = {
2
+ export type UseAnalyticsEventsHook = {
3
3
  createAnalyticsEvent: CreateUIAnalyticsEvent;
4
4
  };
5
5
  export declare function useAnalyticsEvents(): UseAnalyticsEventsHook;
@@ -1,2 +1,2 @@
1
- export declare type UseCallbackWithAnalyticsHook = (method: (...args: any[]) => void, payload: Record<string, any> | ((...args: any[]) => void), channel?: string) => (...args: any[]) => void;
1
+ export type UseCallbackWithAnalyticsHook = (method: (...args: any[]) => void, payload: Record<string, any> | ((...args: any[]) => void), channel?: string) => (...args: any[]) => void;
2
2
  export declare const useCallbackWithAnalytics: UseCallbackWithAnalyticsHook;
@@ -1,5 +1,5 @@
1
1
  import { CreateEventMap } from '../types';
2
- export declare type PatchedPropsHook = {
2
+ export type PatchedPropsHook = {
3
3
  patchedEventProps: CreateEventMap;
4
4
  };
5
5
  export declare function usePatchedProps<Props extends Record<string, any>>(createEventMap: CreateEventMap | undefined, wrappedComponentProps: Props): PatchedPropsHook;
@@ -1,5 +1,5 @@
1
1
  import UIAnalyticsEvent from '../events/UIAnalyticsEvent';
2
- export declare type UsePlatformLeafEventHandlerHookArgs<T> = {
2
+ export type UsePlatformLeafEventHandlerHookArgs<T> = {
3
3
  fn: (value: T, analyticsEvent: UIAnalyticsEvent) => void;
4
4
  action: string;
5
5
  componentName: string;
@@ -8,5 +8,5 @@ export declare type UsePlatformLeafEventHandlerHookArgs<T> = {
8
8
  packageVersion: string;
9
9
  analyticsData?: Record<string, any>;
10
10
  };
11
- export declare type UsePlatformLeafEventHandlerHook<T> = (value: T) => void;
11
+ export type UsePlatformLeafEventHandlerHook<T> = (value: T) => void;
12
12
  export declare function usePlatformLeafEventHandler<T>({ fn, action, componentName, actionSubject, packageName, packageVersion, analyticsData, }: UsePlatformLeafEventHandlerHookArgs<T>): (value: T) => void;
@@ -1,5 +1,5 @@
1
1
  import UIAnalyticsEvent from '../events/UIAnalyticsEvent';
2
- export declare type UsePlatformLeafSyntheticEventHandlerHookArgs = {
2
+ export type UsePlatformLeafSyntheticEventHandlerHookArgs = {
3
3
  fn: (analyticsEvent: UIAnalyticsEvent) => void;
4
4
  action: string;
5
5
  componentName: string;
@@ -7,5 +7,5 @@ export declare type UsePlatformLeafSyntheticEventHandlerHookArgs = {
7
7
  packageVersion: string;
8
8
  analyticsData?: Record<string, any>;
9
9
  };
10
- export declare type UsePlatformLeafSyntheticEventHandlerHook = () => void;
10
+ export type UsePlatformLeafSyntheticEventHandlerHook = () => void;
11
11
  export declare function usePlatformLeafSyntheticEventHandler({ fn, action, componentName, packageName, packageVersion, analyticsData, }: UsePlatformLeafSyntheticEventHandlerHookArgs): () => void;
@@ -1,6 +1,6 @@
1
1
  import { AnalyticsEventPayload } from './events/AnalyticsEvent';
2
2
  import UIAnalyticsEvent from './events/UIAnalyticsEvent';
3
- export declare type CreateUIAnalyticsEvent = (payload: AnalyticsEventPayload) => UIAnalyticsEvent;
4
- export declare type AnalyticsEventCreator = (create: CreateUIAnalyticsEvent, props: Record<string, any>) => UIAnalyticsEvent | undefined;
5
- export declare type CreateEventMapValue = AnalyticsEventPayload | AnalyticsEventCreator;
6
- export declare type CreateEventMap = Record<string, CreateEventMapValue>;
3
+ export type CreateUIAnalyticsEvent = (payload: AnalyticsEventPayload) => UIAnalyticsEvent;
4
+ export type AnalyticsEventCreator = (create: CreateUIAnalyticsEvent, props: Record<string, any>) => UIAnalyticsEvent | undefined;
5
+ export type CreateEventMapValue = AnalyticsEventPayload | AnalyticsEventCreator;
6
+ export type CreateEventMap = Record<string, CreateEventMapValue>;
@@ -1,4 +1,4 @@
1
1
  import { AnalyticsEventPayload } from '../events/AnalyticsEvent';
2
2
  import { CreateUIAnalyticsEvent } from '../types';
3
- declare const _default: (channel?: string | undefined) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("..").UIAnalyticsEvent;
3
+ declare const _default: (channel?: string) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("..").UIAnalyticsEvent;
4
4
  export default _default;
@@ -0,0 +1,29 @@
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
4
+ interface Props {
5
+ /** Children! */
6
+ children: React.ReactNode;
7
+ /** Arbitrary data. Any events created below this component in the tree will
8
+ * have this added as an item in their context array. */
9
+ data: Object;
10
+ }
11
+ declare class AnalyticsContext extends Component<Props, AnalyticsReactContextInterface> {
12
+ static contextTypes: {
13
+ getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
14
+ getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
15
+ };
16
+ static childContextTypes: {
17
+ getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
18
+ getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
19
+ };
20
+ contextValue: AnalyticsReactContextInterface;
21
+ constructor(props: Props);
22
+ getChildContext: () => {
23
+ getAtlaskitAnalyticsContext: () => any[];
24
+ };
25
+ getAnalyticsContext: () => any[];
26
+ getAnalyticsEventHandlers: () => any;
27
+ render(): JSX.Element;
28
+ }
29
+ export default AnalyticsContext;
@@ -0,0 +1,3 @@
1
+ import { AnalyticsContextFunction } from './types';
2
+ declare const AnalyticsContext: AnalyticsContextFunction;
3
+ export default AnalyticsContext;
@@ -0,0 +1,3 @@
1
+ import { AnalyticsContextFunction } from './types';
2
+ declare let ExportedAnalyticsContext: AnalyticsContextFunction;
3
+ export default ExportedAnalyticsContext;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
3
+ export type AnalyticsContextFunction = (props: {
4
+ /** Children! */
5
+ children: React.ReactNode;
6
+ /** Arbitrary data. Any events created below this component in the tree will
7
+ * have this added as an item in their context array. */
8
+ data: Object;
9
+ }, context?: AnalyticsReactContextInterface) => JSX.Element;
@@ -0,0 +1,24 @@
1
+ import React, { Component, ReactNode } from 'react';
2
+ type AnalyticsErrorBoundaryErrorInfo = {
3
+ componentStack: string;
4
+ };
5
+ export interface AnalyticsErrorBoundaryProps {
6
+ /** React component to be wrapped */
7
+ children: ReactNode;
8
+ channel: string;
9
+ data: {};
10
+ ErrorComponent?: React.ComponentType;
11
+ onError?: (error: Error, info?: AnalyticsErrorBoundaryErrorInfo) => void;
12
+ }
13
+ type AnalyticsErrorBoundaryState = {
14
+ hasError: boolean;
15
+ };
16
+ /**
17
+ * @deprecated
18
+ */
19
+ export default class AnalyticsErrorBoundary extends Component<AnalyticsErrorBoundaryProps, AnalyticsErrorBoundaryState> {
20
+ constructor(props: AnalyticsErrorBoundaryProps);
21
+ componentDidCatch(error: Error, info?: AnalyticsErrorBoundaryErrorInfo): void;
22
+ render(): JSX.Element | null;
23
+ }
24
+ export {};
@@ -0,0 +1,33 @@
1
+ import React, { Component } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
4
+ import UIAnalyticsEvent from '../../events/UIAnalyticsEvent';
5
+ type Props = {
6
+ /** Children! */
7
+ children?: React.ReactNode;
8
+ /** The channel to listen for events on. */
9
+ channel?: string;
10
+ /** A function which will be called when an event is fired on this Listener's
11
+ * channel. It is passed the event and the channel as arguments. */
12
+ onEvent: (event: UIAnalyticsEvent, channel?: string) => void;
13
+ };
14
+ declare class AnalyticsListener extends Component<Props> {
15
+ static contextTypes: {
16
+ getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
17
+ getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
18
+ };
19
+ static childContextTypes: {
20
+ getAtlaskitAnalyticsEventHandlers: PropTypes.Requireable<(...args: any[]) => any>;
21
+ getAtlaskitAnalyticsContext: PropTypes.Requireable<(...args: any[]) => any>;
22
+ };
23
+ contextValue: AnalyticsReactContextInterface;
24
+ constructor(props: Props);
25
+ getChildContext: () => {
26
+ getAtlaskitAnalyticsEventHandlers: () => any[];
27
+ getAtlaskitAnalyticsContext: () => any;
28
+ };
29
+ getAnalyticsEventHandlers: () => any[];
30
+ getAtlaskitAnalyticsContext: () => any;
31
+ render(): JSX.Element;
32
+ }
33
+ export default AnalyticsListener;
@@ -0,0 +1,3 @@
1
+ import { AnalyticsListenerFunction } from './types';
2
+ declare const AnalyticsListener: AnalyticsListenerFunction;
3
+ export default AnalyticsListener;
@@ -0,0 +1,3 @@
1
+ import { AnalyticsListenerFunction } from './types';
2
+ declare let ExportedAnalyticsListener: AnalyticsListenerFunction;
3
+ export default ExportedAnalyticsListener;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
3
+ import UIAnalyticsEvent from '../../events/UIAnalyticsEvent';
4
+ export type AnalyticsListenerFunction = (props: {
5
+ /** Children! */
6
+ children?: React.ReactNode;
7
+ /** The channel to listen for events on. */
8
+ channel?: string;
9
+ /** A function which will be called when an event is fired on this Listener's
10
+ * channel. It is passed the event and the channel as arguments. */
11
+ onEvent: (event: UIAnalyticsEvent, channel?: string) => void;
12
+ }, context?: AnalyticsReactContextInterface) => JSX.Element;
@@ -0,0 +1,15 @@
1
+ export type AnalyticsEventPayload = Record<string, any>;
2
+ type AnalyticsEventCallback = (payload: AnalyticsEventPayload) => AnalyticsEventPayload;
3
+ type AnalyticsEventUpdater = AnalyticsEventPayload | AnalyticsEventCallback;
4
+ export type AnalyticsEventProps = {
5
+ payload: AnalyticsEventPayload;
6
+ };
7
+ export declare const isAnalyticsEvent: (obj: any) => boolean;
8
+ export default class AnalyticsEvent {
9
+ payload: AnalyticsEventPayload;
10
+ _isAnalyticsEvent: boolean;
11
+ constructor(props: AnalyticsEventProps);
12
+ clone: () => AnalyticsEvent | null;
13
+ update(updater: AnalyticsEventUpdater): this;
14
+ }
15
+ export {};
@@ -0,0 +1,20 @@
1
+ import AnalyticsEvent, { AnalyticsEventPayload, AnalyticsEventProps } from './AnalyticsEvent';
2
+ type ChannelIdentifier = string;
3
+ type Context = Record<string, any>[];
4
+ export type UIAnalyticsEventHandler = (event: UIAnalyticsEvent, channel?: ChannelIdentifier) => void;
5
+ export type UIAnalyticsEventProps = AnalyticsEventProps & {
6
+ context?: Context;
7
+ handlers?: UIAnalyticsEventHandler[];
8
+ };
9
+ export declare const isUIAnalyticsEvent: (obj: any) => boolean;
10
+ export default class UIAnalyticsEvent extends AnalyticsEvent {
11
+ context: Context;
12
+ handlers: UIAnalyticsEventHandler[];
13
+ hasFired: boolean;
14
+ _isUIAnalyticsEvent: boolean;
15
+ constructor(props: UIAnalyticsEventProps);
16
+ clone: () => UIAnalyticsEvent | null;
17
+ fire: (channel?: string) => void;
18
+ update(updater: Record<string, any> | ((payload: AnalyticsEventPayload) => AnalyticsEventPayload)): this;
19
+ }
20
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface WithContextProps {
3
+ analyticsContext?: Record<string, any>;
4
+ }
5
+ declare const withAnalyticsContext: (defaultData?: any) => <Props, Component>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props & WithContextProps>> & React.RefAttributes<any>>;
6
+ export default withAnalyticsContext;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { CreateEventMap, CreateUIAnalyticsEvent } from '../types';
3
+ export interface WithAnalyticsEventsProps {
4
+ /**
5
+ * You should not be accessing this prop under any circumstances.
6
+ * It is provided by `@atlaskit/analytics-next` and integrated in the component
7
+ */
8
+ createAnalyticsEvent?: CreateUIAnalyticsEvent;
9
+ ref?: React.Ref<any>;
10
+ }
11
+ declare const withAnalyticsEvents: (createEventMap?: CreateEventMap) => <Props extends WithAnalyticsEventsProps, Component>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Omit<Props, keyof WithAnalyticsEventsProps>>> & React.RefAttributes<any>>;
12
+ export default withAnalyticsEvents;
@@ -0,0 +1,2 @@
1
+ import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
2
+ export declare const useAnalyticsContext: () => AnalyticsReactContextInterface;
@@ -0,0 +1,5 @@
1
+ import { CreateUIAnalyticsEvent } from '../types';
2
+ export type UseAnalyticsEventsHook = {
3
+ createAnalyticsEvent: CreateUIAnalyticsEvent;
4
+ };
5
+ export declare function useAnalyticsEvents(): UseAnalyticsEventsHook;
@@ -0,0 +1,2 @@
1
+ export type UseCallbackWithAnalyticsHook = (method: (...args: any[]) => void, payload: Record<string, any> | ((...args: any[]) => void), channel?: string) => (...args: any[]) => void;
2
+ export declare const useCallbackWithAnalytics: UseCallbackWithAnalyticsHook;
@@ -0,0 +1,5 @@
1
+ import { CreateEventMap } from '../types';
2
+ export type PatchedPropsHook = {
3
+ patchedEventProps: CreateEventMap;
4
+ };
5
+ export declare function usePatchedProps<Props extends Record<string, any>>(createEventMap: CreateEventMap | undefined, wrappedComponentProps: Props): PatchedPropsHook;
@@ -0,0 +1,12 @@
1
+ import UIAnalyticsEvent from '../events/UIAnalyticsEvent';
2
+ export type UsePlatformLeafEventHandlerHookArgs<T> = {
3
+ fn: (value: T, analyticsEvent: UIAnalyticsEvent) => void;
4
+ action: string;
5
+ componentName: string;
6
+ actionSubject?: string;
7
+ packageName: string;
8
+ packageVersion: string;
9
+ analyticsData?: Record<string, any>;
10
+ };
11
+ export type UsePlatformLeafEventHandlerHook<T> = (value: T) => void;
12
+ export declare function usePlatformLeafEventHandler<T>({ fn, action, componentName, actionSubject, packageName, packageVersion, analyticsData, }: UsePlatformLeafEventHandlerHookArgs<T>): (value: T) => void;
@@ -0,0 +1,11 @@
1
+ import UIAnalyticsEvent from '../events/UIAnalyticsEvent';
2
+ export type UsePlatformLeafSyntheticEventHandlerHookArgs = {
3
+ fn: (analyticsEvent: UIAnalyticsEvent) => void;
4
+ action: string;
5
+ componentName: string;
6
+ packageName: string;
7
+ packageVersion: string;
8
+ analyticsData?: Record<string, any>;
9
+ };
10
+ export type UsePlatformLeafSyntheticEventHandlerHook = () => void;
11
+ export declare function usePlatformLeafSyntheticEventHandler({ fn, action, componentName, packageName, packageVersion, analyticsData, }: UsePlatformLeafSyntheticEventHandlerHookArgs): () => void;
@@ -0,0 +1,2 @@
1
+ import { MutableRefObject } from 'react';
2
+ export declare const useTrackedRef: <T>(value: T) => MutableRefObject<T>;
@@ -0,0 +1,25 @@
1
+ export type { CreateUIAnalyticsEvent } from './types';
2
+ export { default as AnalyticsEvent, isAnalyticsEvent, } from './events/AnalyticsEvent';
3
+ export type { AnalyticsEventPayload, AnalyticsEventProps, } from './events/AnalyticsEvent';
4
+ export { default as UIAnalyticsEvent, isUIAnalyticsEvent, } from './events/UIAnalyticsEvent';
5
+ export type { UIAnalyticsEventProps, UIAnalyticsEventHandler, } from './events/UIAnalyticsEvent';
6
+ export { default as AnalyticsListener } from './components/AnalyticsListener/index';
7
+ export { default as AnalyticsContext } from './components/AnalyticsContext/index';
8
+ export { default as withAnalyticsContext } from './hocs/withAnalyticsContext';
9
+ export type { WithContextProps } from './hocs/withAnalyticsContext';
10
+ export { default as AnalyticsErrorBoundary } from './components/AnalyticsErrorBoundary';
11
+ export type { AnalyticsErrorBoundaryProps } from './components/AnalyticsErrorBoundary';
12
+ export { default as withAnalyticsEvents } from './hocs/withAnalyticsEvents';
13
+ export type { WithAnalyticsEventsProps } from './hocs/withAnalyticsEvents';
14
+ export { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
15
+ export type { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
16
+ export { useAnalyticsEvents } from './hooks/useAnalyticsEvents';
17
+ export type { UseAnalyticsEventsHook } from './hooks/useAnalyticsEvents';
18
+ export { useCallbackWithAnalytics } from './hooks/useCallbackWithAnalytics';
19
+ export type { UseCallbackWithAnalyticsHook } from './hooks/useCallbackWithAnalytics';
20
+ export { usePlatformLeafEventHandler } from './hooks/usePlatformLeafEventHandler';
21
+ export type { UsePlatformLeafEventHandlerHookArgs, UsePlatformLeafEventHandlerHook, } from './hooks/usePlatformLeafEventHandler';
22
+ export { usePlatformLeafSyntheticEventHandler } from './hooks/usePlatformLeafSyntheticEventHandler';
23
+ export type { UsePlatformLeafSyntheticEventHandlerHookArgs, UsePlatformLeafSyntheticEventHandlerHook, } from './hooks/usePlatformLeafSyntheticEventHandler';
24
+ export { default as createAndFireEvent } from './utils/createAndFireEvent';
25
+ export { default as cleanProps } from './utils/cleanProps';
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const UsePlatformLeafEventHandlerHookTest: () => JSX.Element;
3
+ export declare const UseAnalyticsEventHookTest: () => JSX.Element;
4
+ export declare const UseCallbackWithAnalyticsHookTest: () => JSX.Element;
5
+ export declare const HOCSTest: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const useRenderCounter: () => number;
@@ -0,0 +1,6 @@
1
+ import { AnalyticsEventPayload } from './events/AnalyticsEvent';
2
+ import UIAnalyticsEvent from './events/UIAnalyticsEvent';
3
+ export type CreateUIAnalyticsEvent = (payload: AnalyticsEventPayload) => UIAnalyticsEvent;
4
+ export type AnalyticsEventCreator = (create: CreateUIAnalyticsEvent, props: Record<string, any>) => UIAnalyticsEvent | undefined;
5
+ export type CreateEventMapValue = AnalyticsEventPayload | AnalyticsEventCreator;
6
+ export type CreateEventMap = Record<string, CreateEventMapValue>;
@@ -0,0 +1,3 @@
1
+ export default function cleanProps(props: Record<string, any>): {
2
+ [x: string]: any;
3
+ };
@@ -0,0 +1,4 @@
1
+ import { AnalyticsEventPayload } from '../events/AnalyticsEvent';
2
+ import { CreateUIAnalyticsEvent } from '../types';
3
+ declare const _default: (channel?: string) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("..").UIAnalyticsEvent;
4
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "9.1.1",
3
+ "version": "9.1.3",
4
4
  "description": "React components, HOCs and hooks to assist with tracking user activity with React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,14 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.5 <4.9": {
17
+ "*": [
18
+ "dist/types-ts4.5/*",
19
+ "dist/types-ts4.5/index.d.ts"
20
+ ]
21
+ }
22
+ },
15
23
  "sideEffects": false,
16
24
  "atlaskit:src": "src/index.ts",
17
25
  "atlassian": {
@@ -62,7 +70,7 @@
62
70
  "react-dom": "^16.8.0",
63
71
  "redux": "^3.7.2",
64
72
  "storybook-addon-performance": "^0.16.0",
65
- "typescript": "4.5.5"
73
+ "typescript": "~4.9.5"
66
74
  },
67
75
  "techstack": {
68
76
  "@atlassian/frontend": {
package/report.api.md CHANGED
@@ -135,7 +135,7 @@ type Context = Record<string, any>[];
135
135
 
136
136
  // @public (undocumented)
137
137
  export const createAndFireEvent: (
138
- channel?: string | undefined,
138
+ channel?: string,
139
139
  ) => (
140
140
  payload: AnalyticsEventPayload,
141
141
  ) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent;
@@ -165,7 +165,7 @@ export class UIAnalyticsEvent extends AnalyticsEvent {
165
165
  // (undocumented)
166
166
  context: Context;
167
167
  // (undocumented)
168
- fire: (channel?: string | undefined) => void;
168
+ fire: (channel?: string) => void;
169
169
  // (undocumented)
170
170
  handlers: UIAnalyticsEventHandler[];
171
171
  // (undocumented)
@@ -109,7 +109,7 @@ export function cleanProps(props: Record<string, any>): {
109
109
  type Context = Record<string, any>[];
110
110
 
111
111
  // @public (undocumented)
112
- export const createAndFireEvent: (channel?: string | undefined) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent;
112
+ export const createAndFireEvent: (channel?: string) => (payload: AnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent;
113
113
 
114
114
  // @public (undocumented)
115
115
  type CreateEventMap = Record<string, CreateEventMapValue>;
@@ -134,7 +134,7 @@ export class UIAnalyticsEvent extends AnalyticsEvent {
134
134
  // (undocumented)
135
135
  context: Context;
136
136
  // (undocumented)
137
- fire: (channel?: string | undefined) => void;
137
+ fire: (channel?: string) => void;
138
138
  // (undocumented)
139
139
  handlers: UIAnalyticsEventHandler[];
140
140
  // (undocumented)
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/types.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/types.d.ts"
11
+ "../dist/types-ts4.5/types.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/hooks/useAnalyticsEvents.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/hooks/useAnalyticsEvents.d.ts"
11
+ "../dist/types-ts4.5/hooks/useAnalyticsEvents.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/hooks/useCallbackWithAnalytics.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/hooks/useCallbackWithAnalytics.d.ts"
11
+ "../dist/types-ts4.5/hooks/useCallbackWithAnalytics.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/hooks/usePatchedProps.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/hooks/usePatchedProps.d.ts"
11
+ "../dist/types-ts4.5/hooks/usePatchedProps.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/hooks/usePlatformLeafEventHandler.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/hooks/usePlatformLeafEventHandler.d.ts"
11
+ "../dist/types-ts4.5/hooks/usePlatformLeafEventHandler.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/hocs/withAnalyticsContext.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/hocs/withAnalyticsContext.d.ts"
11
+ "../dist/types-ts4.5/hocs/withAnalyticsContext.d.ts"
12
12
  ]
13
13
  }
14
14
  }
@@ -6,9 +6,9 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/hocs/withAnalyticsEvents.d.ts",
8
8
  "typesVersions": {
9
- ">=4.0 <4.5": {
9
+ ">=4.5 <4.9": {
10
10
  "*": [
11
- "../dist/types-ts4.0/hocs/withAnalyticsEvents.d.ts"
11
+ "../dist/types-ts4.5/hocs/withAnalyticsEvents.d.ts"
12
12
  ]
13
13
  }
14
14
  }