@atlaskit/analytics-next 8.3.2 → 8.3.4

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 (51) hide show
  1. package/AnalyticsContext/package.json +8 -1
  2. package/AnalyticsErrorBoundary/package.json +8 -1
  3. package/AnalyticsEvent/package.json +8 -1
  4. package/AnalyticsListener/package.json +8 -1
  5. package/CHANGELOG.md +12 -0
  6. package/UIAnalyticsEvent/package.json +8 -1
  7. package/createAndFireEvents/package.json +8 -1
  8. package/dist/cjs/components/AnalyticsContext/index.js +3 -1
  9. package/dist/cjs/components/AnalyticsListener/index.js +3 -1
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/components/AnalyticsContext/index.js +3 -1
  12. package/dist/es2019/components/AnalyticsListener/index.js +3 -1
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/components/AnalyticsContext/index.js +3 -1
  15. package/dist/esm/components/AnalyticsListener/index.js +3 -1
  16. package/dist/esm/version.json +1 -1
  17. package/dist/types-ts4.0/components/AnalyticsContext/LegacyAnalyticsContext.d.ts +29 -0
  18. package/dist/types-ts4.0/components/AnalyticsContext/ModernAnalyticsContext.d.ts +3 -0
  19. package/dist/types-ts4.0/components/AnalyticsContext/index.d.ts +3 -0
  20. package/dist/types-ts4.0/components/AnalyticsContext/types.d.ts +9 -0
  21. package/dist/types-ts4.0/components/AnalyticsErrorBoundary.d.ts +29 -0
  22. package/dist/types-ts4.0/components/AnalyticsListener/LegacyAnalyticsListener.d.ts +33 -0
  23. package/dist/types-ts4.0/components/AnalyticsListener/ModernAnalyticsListener.d.ts +3 -0
  24. package/dist/types-ts4.0/components/AnalyticsListener/index.d.ts +3 -0
  25. package/dist/types-ts4.0/components/AnalyticsListener/types.d.ts +12 -0
  26. package/dist/types-ts4.0/events/AnalyticsEvent.d.ts +15 -0
  27. package/dist/types-ts4.0/events/UIAnalyticsEvent.d.ts +20 -0
  28. package/dist/types-ts4.0/hocs/withAnalyticsContext.d.ts +6 -0
  29. package/dist/types-ts4.0/hocs/withAnalyticsEvents.d.ts +12 -0
  30. package/dist/types-ts4.0/hooks/useAnalyticsContext.d.ts +2 -0
  31. package/dist/types-ts4.0/hooks/useAnalyticsEvents.d.ts +5 -0
  32. package/dist/types-ts4.0/hooks/useCallbackWithAnalytics.d.ts +2 -0
  33. package/dist/types-ts4.0/hooks/usePatchedProps.d.ts +5 -0
  34. package/dist/types-ts4.0/hooks/usePlatformLeafEventHandler.d.ts +12 -0
  35. package/dist/types-ts4.0/hooks/usePlatformLeafSyntheticEventHandler.d.ts +11 -0
  36. package/dist/types-ts4.0/hooks/useTrackedRef.d.ts +2 -0
  37. package/dist/types-ts4.0/index.d.ts +25 -0
  38. package/dist/types-ts4.0/performance/examples.d.ts +5 -0
  39. package/dist/types-ts4.0/test-utils/useRenderCounter.d.ts +1 -0
  40. package/dist/types-ts4.0/types.d.ts +6 -0
  41. package/dist/types-ts4.0/utils/cleanProps.d.ts +3 -0
  42. package/dist/types-ts4.0/utils/createAndFireEvent.d.ts +4 -0
  43. package/package.json +11 -4
  44. package/report.api.md +4 -2
  45. package/types/package.json +8 -1
  46. package/useAnalyticsEvents/package.json +8 -1
  47. package/useCallbackWithAnalytics/package.json +8 -1
  48. package/usePatchedProps/package.json +8 -1
  49. package/usePlatformLeafEventHandler/package.json +8 -1
  50. package/withAnalyticsContext/package.json +8 -1
  51. package/withAnalyticsEvents/package.json +8 -1
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/components/AnalyticsContext/index.js",
5
5
  "module:es2019": "../dist/es2019/components/AnalyticsContext/index.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/components/AnalyticsContext/index.d.ts"
7
+ "types": "../dist/types/components/AnalyticsContext/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/components/AnalyticsContext/index.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/components/AnalyticsErrorBoundary.js",
5
5
  "module:es2019": "../dist/es2019/components/AnalyticsErrorBoundary.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/components/AnalyticsErrorBoundary.d.ts"
7
+ "types": "../dist/types/components/AnalyticsErrorBoundary.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/components/AnalyticsErrorBoundary.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/events/AnalyticsEvent.js",
5
5
  "module:es2019": "../dist/es2019/events/AnalyticsEvent.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/events/AnalyticsEvent.d.ts"
7
+ "types": "../dist/types/events/AnalyticsEvent.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/events/AnalyticsEvent.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/components/AnalyticsListener/index.js",
5
5
  "module:es2019": "../dist/es2019/components/AnalyticsListener/index.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/components/AnalyticsListener/index.d.ts"
7
+ "types": "../dist/types/components/AnalyticsListener/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/components/AnalyticsListener/index.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/analytics-next
2
2
 
3
+ ## 8.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2cbb787f8b3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2cbb787f8b3) - AFO-711 Analytics-next: nullable check for context
8
+
9
+ ## 8.3.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
14
+
3
15
  ## 8.3.2
4
16
 
5
17
  ### Patch Changes
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/events/UIAnalyticsEvent.js",
5
5
  "module:es2019": "../dist/es2019/events/UIAnalyticsEvent.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/events/UIAnalyticsEvent.d.ts"
7
+ "types": "../dist/types/events/UIAnalyticsEvent.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/events/UIAnalyticsEvent.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/utils/createAndFireEvent.js",
5
5
  "module:es2019": "../dist/es2019/utils/createAndFireEvent.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/utils/createAndFireEvent.d.ts"
7
+ "types": "../dist/types/utils/createAndFireEvent.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/utils/createAndFireEvent.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -11,9 +11,11 @@ var _LegacyAnalyticsContext = _interopRequireDefault(require("./LegacyAnalyticsC
11
11
 
12
12
  var _ModernAnalyticsContext = _interopRequireDefault(require("./ModernAnalyticsContext"));
13
13
 
14
+ var _process, _process$env;
15
+
14
16
  var ExportedAnalyticsContext;
15
17
 
16
- if (typeof process !== 'undefined' && process.env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
18
+ if ((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
17
19
  ExportedAnalyticsContext = _ModernAnalyticsContext.default;
18
20
  } else {
19
21
  ExportedAnalyticsContext = _LegacyAnalyticsContext.default;
@@ -11,9 +11,11 @@ var _LegacyAnalyticsListener = _interopRequireDefault(require("./LegacyAnalytics
11
11
 
12
12
  var _ModernAnalyticsListener = _interopRequireDefault(require("./ModernAnalyticsListener"));
13
13
 
14
+ var _process, _process$env;
15
+
14
16
  var ExportedAnalyticsListener;
15
17
 
16
- if (typeof process !== 'undefined' && process.env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
18
+ if ((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
17
19
  ExportedAnalyticsListener = _ModernAnalyticsListener.default;
18
20
  } else {
19
21
  ExportedAnalyticsListener = _LegacyAnalyticsListener.default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "8.3.2",
3
+ "version": "8.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,10 @@
1
+ var _process, _process$env;
2
+
1
3
  import LegacyAnalyticsContext from './LegacyAnalyticsContext';
2
4
  import ModernAnalyticsContext from './ModernAnalyticsContext';
3
5
  let ExportedAnalyticsContext;
4
6
 
5
- if (typeof process !== 'undefined' && process.env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
7
+ if ((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
6
8
  ExportedAnalyticsContext = ModernAnalyticsContext;
7
9
  } else {
8
10
  ExportedAnalyticsContext = LegacyAnalyticsContext;
@@ -1,8 +1,10 @@
1
+ var _process, _process$env;
2
+
1
3
  import LegacyAnalyticsListener from './LegacyAnalyticsListener';
2
4
  import ModernAnalyticsListener from './ModernAnalyticsListener';
3
5
  let ExportedAnalyticsListener;
4
6
 
5
- if (typeof process !== 'undefined' && process.env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
7
+ if ((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
6
8
  ExportedAnalyticsListener = ModernAnalyticsListener;
7
9
  } else {
8
10
  ExportedAnalyticsListener = LegacyAnalyticsListener;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "8.3.2",
3
+ "version": "8.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,10 @@
1
+ var _process, _process$env;
2
+
1
3
  import LegacyAnalyticsContext from './LegacyAnalyticsContext';
2
4
  import ModernAnalyticsContext from './ModernAnalyticsContext';
3
5
  var ExportedAnalyticsContext;
4
6
 
5
- if (typeof process !== 'undefined' && process.env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
7
+ if ((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
6
8
  ExportedAnalyticsContext = ModernAnalyticsContext;
7
9
  } else {
8
10
  ExportedAnalyticsContext = LegacyAnalyticsContext;
@@ -1,8 +1,10 @@
1
+ var _process, _process$env;
2
+
1
3
  import LegacyAnalyticsListener from './LegacyAnalyticsListener';
2
4
  import ModernAnalyticsListener from './ModernAnalyticsListener';
3
5
  var ExportedAnalyticsListener;
4
6
 
5
- if (typeof process !== 'undefined' && process.env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
7
+ if ((_process = process) !== null && _process !== void 0 && (_process$env = _process.env) !== null && _process$env !== void 0 && _process$env['ANALYTICS_NEXT_MODERN_CONTEXT']) {
6
8
  ExportedAnalyticsListener = ModernAnalyticsListener;
7
9
  } else {
8
10
  ExportedAnalyticsListener = LegacyAnalyticsListener;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/analytics-next",
3
- "version": "8.3.2",
3
+ "version": "8.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -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 declare 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,29 @@
1
+ import React, { Component, ReactNode } from 'react';
2
+ import { WithAnalyticsEventsProps } from '../hocs/withAnalyticsEvents';
3
+ declare type AnalyticsErrorBoundaryErrorInfo = {
4
+ componentStack: string;
5
+ };
6
+ export interface AnalyticsErrorBoundaryProps extends WithAnalyticsEventsProps {
7
+ /** React component to be wrapped */
8
+ children: ReactNode;
9
+ channel: string;
10
+ data: {};
11
+ ErrorComponent?: React.ComponentType;
12
+ onError?: (error: Error, info?: AnalyticsErrorBoundaryErrorInfo) => void;
13
+ }
14
+ declare type AnalyticsErrorBoundaryPayload = {
15
+ error: Error | string;
16
+ info?: AnalyticsErrorBoundaryErrorInfo;
17
+ [key: string]: any;
18
+ };
19
+ declare type AnalyticsErrorBoundaryState = {
20
+ hasError: boolean;
21
+ };
22
+ export declare class BaseAnalyticsErrorBoundary extends Component<AnalyticsErrorBoundaryProps, AnalyticsErrorBoundaryState> {
23
+ constructor(props: AnalyticsErrorBoundaryProps);
24
+ fireAnalytics: (analyticsErrorPayload: AnalyticsErrorBoundaryPayload) => void;
25
+ componentDidCatch(error: Error, info?: AnalyticsErrorBoundaryErrorInfo): void;
26
+ render(): JSX.Element;
27
+ }
28
+ declare const AnalyticsErrorBoundary: React.ForwardRefExoticComponent<Omit<AnalyticsErrorBoundaryProps, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
29
+ export default AnalyticsErrorBoundary;
@@ -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
+ declare 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 declare 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 declare type AnalyticsEventPayload = Record<string, any>;
2
+ declare type AnalyticsEventCallback = (payload: AnalyticsEventPayload) => AnalyticsEventPayload;
3
+ declare type AnalyticsEventUpdater = AnalyticsEventPayload | AnalyticsEventCallback;
4
+ export declare 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
+ 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 & {
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 | undefined) => 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 declare type UseAnalyticsEventsHook = {
3
+ createAnalyticsEvent: CreateUIAnalyticsEvent;
4
+ };
5
+ export declare function useAnalyticsEvents(): UseAnalyticsEventsHook;
@@ -0,0 +1,2 @@
1
+ export declare 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 declare 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 declare 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 declare 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 declare 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 declare 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 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>;
@@ -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 | undefined) => (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": "8.3.2",
3
+ "version": "8.3.4",
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,13 @@
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.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.ts",
17
24
  "atlassian": {
@@ -51,14 +58,14 @@
51
58
  "@atlaskit/button": "^16.3.0",
52
59
  "@atlaskit/docs": "*",
53
60
  "@atlaskit/ssr": "*",
54
- "@atlaskit/textfield": "^5.0.0",
61
+ "@atlaskit/textfield": "^5.3.0",
55
62
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
56
- "@testing-library/react": "^8.0.1",
63
+ "@testing-library/react": "^12.1.5",
57
64
  "enzyme": "^3.10.0",
58
65
  "react-dom": "^16.8.0",
59
66
  "redux": "^3.7.2",
60
67
  "storybook-addon-performance": "^0.16.0",
61
- "typescript": "4.3.5"
68
+ "typescript": "4.5.5"
62
69
  },
63
70
  "techstack": {
64
71
  "@atlassian/frontend": {
package/report.api.md CHANGED
@@ -1,6 +1,8 @@
1
- ## API Report File for "@atlaskit/analytics-next"
1
+ ## API Report File for "@atlaskit/analytics-next".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
4
6
 
5
7
  ```ts
6
8
  /// <reference types="react" />
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts"
7
+ "types": "../dist/types/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hooks/useAnalyticsEvents.js",
5
5
  "module:es2019": "../dist/es2019/hooks/useAnalyticsEvents.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hooks/useAnalyticsEvents.d.ts"
7
+ "types": "../dist/types/hooks/useAnalyticsEvents.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hooks/useAnalyticsEvents.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hooks/useCallbackWithAnalytics.js",
5
5
  "module:es2019": "../dist/es2019/hooks/useCallbackWithAnalytics.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hooks/useCallbackWithAnalytics.d.ts"
7
+ "types": "../dist/types/hooks/useCallbackWithAnalytics.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hooks/useCallbackWithAnalytics.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hooks/usePatchedProps.js",
5
5
  "module:es2019": "../dist/es2019/hooks/usePatchedProps.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hooks/usePatchedProps.d.ts"
7
+ "types": "../dist/types/hooks/usePatchedProps.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hooks/usePatchedProps.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hooks/usePlatformLeafEventHandler.js",
5
5
  "module:es2019": "../dist/es2019/hooks/usePlatformLeafEventHandler.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hooks/usePlatformLeafEventHandler.d.ts"
7
+ "types": "../dist/types/hooks/usePlatformLeafEventHandler.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hooks/usePlatformLeafEventHandler.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hocs/withAnalyticsContext.js",
5
5
  "module:es2019": "../dist/es2019/hocs/withAnalyticsContext.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hocs/withAnalyticsContext.d.ts"
7
+ "types": "../dist/types/hocs/withAnalyticsContext.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hocs/withAnalyticsContext.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hocs/withAnalyticsEvents.js",
5
5
  "module:es2019": "../dist/es2019/hocs/withAnalyticsEvents.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hocs/withAnalyticsEvents.d.ts"
7
+ "types": "../dist/types/hocs/withAnalyticsEvents.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hocs/withAnalyticsEvents.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }