@atlaskit/analytics-next
Version:
React components, HOCs and hooks to assist with tracking user activity with React components
307 lines (250 loc) • 7.98 kB
Markdown
<!-- API Report Version: 2.3 -->
## API Report File for "@atlaskit/analytics-next"
> Do not edit this file. This report is auto-generated using
> [API Extractor](https://api-extractor.com/).
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
### Table of contents
- [Main Entry Types](#main-entry-types)
- [Peer Dependencies](#peer-dependencies)
### Main Entry Types
<!--SECTION START: Main Entry Types-->
```ts
/// <reference types="react" />
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
import { AnalyticsReactContextInterface } from '@atlaskit/analytics-next-stable-react-context';
import { Component } from 'react';
import { default as React_2 } from 'react';
import { ReactNode } from 'react';
// @public (undocumented)
export let AnalyticsContext: AnalyticsContextFunction;
// @public (undocumented)
type AnalyticsContextFunction = (
props: {
children: React.ReactNode;
data: Object;
},
context?: AnalyticsReactContextInterface,
) => JSX.Element;
// @public @deprecated (undocumented)
export class AnalyticsErrorBoundary extends Component<
AnalyticsErrorBoundaryProps,
AnalyticsErrorBoundaryState
> {
constructor(props: AnalyticsErrorBoundaryProps);
// (undocumented)
componentDidCatch(error: Error, info?: AnalyticsErrorBoundaryErrorInfo): void;
// (undocumented)
render(): JSX.Element | null;
}
// @public (undocumented)
type AnalyticsErrorBoundaryErrorInfo = {
componentStack: string;
};
// @public (undocumented)
export interface AnalyticsErrorBoundaryProps {
// (undocumented)
channel: string;
children: ReactNode;
// (undocumented)
data: {};
// (undocumented)
ErrorComponent?: React_2.ComponentType;
// (undocumented)
onError?: (error: Error, info?: AnalyticsErrorBoundaryErrorInfo) => void;
}
// @public (undocumented)
type AnalyticsErrorBoundaryState = {
hasError: boolean;
};
// @public (undocumented)
export class AnalyticsEvent {
constructor(props: AnalyticsEventProps);
// (undocumented)
clone: () => AnalyticsEvent | null;
// (undocumented)
_isAnalyticsEvent: boolean;
// (undocumented)
payload: AnalyticsEventPayload;
// (undocumented)
update(updater: AnalyticsEventUpdater): this;
}
// @public (undocumented)
type AnalyticsEventCallback = (payload: AnalyticsEventPayload) => AnalyticsEventPayload;
// @public (undocumented)
type AnalyticsEventCreator = (
create: CreateUIAnalyticsEvent,
props: Record<string, any>,
) => UIAnalyticsEvent | undefined;
// @public (undocumented)
export type AnalyticsEventPayload = Record<string, any>;
// @public (undocumented)
export type AnalyticsEventProps = {
payload: AnalyticsEventPayload;
};
// @public (undocumented)
type AnalyticsEventUpdater = AnalyticsEventCallback | AnalyticsEventPayload;
// @public (undocumented)
export let AnalyticsListener: AnalyticsListenerFunction;
// @public (undocumented)
type AnalyticsListenerFunction = (
props: {
children?: React.ReactNode;
channel?: string;
onEvent: (event: UIAnalyticsEvent, channel?: string) => void;
},
context?: AnalyticsReactContextInterface,
) => JSX.Element;
export { AnalyticsReactContext };
export { AnalyticsReactContextInterface };
// @public (undocumented)
type ChannelIdentifier = string;
// @public (undocumented)
export function cleanProps(props: Record<string, any>): {
[x: string]: any;
};
// @public (undocumented)
type Context = Record<string, any>[];
// @public (undocumented)
export const createAndFireEvent: (
channel?: string,
) => (
payload: AnalyticsEventPayload,
) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => UIAnalyticsEvent;
// @public (undocumented)
type CreateEventMap = Record<string, CreateEventMapValue>;
// @public (undocumented)
type CreateEventMapValue = AnalyticsEventCreator | AnalyticsEventPayload;
// @public (undocumented)
export type CreateUIAnalyticsEvent = (payload: AnalyticsEventPayload) => UIAnalyticsEvent;
// @public (undocumented)
export const isAnalyticsEvent: (obj: any) => boolean;
// @public (undocumented)
export const isUIAnalyticsEvent: (obj: any) => boolean;
// @public (undocumented)
export class UIAnalyticsEvent extends AnalyticsEvent {
constructor(props: UIAnalyticsEventProps);
// (undocumented)
clone: () => UIAnalyticsEvent | null;
// (undocumented)
context: Context;
// (undocumented)
fire: (channel?: string) => void;
// (undocumented)
handlers: UIAnalyticsEventHandler[];
// (undocumented)
hasFired: boolean;
// (undocumented)
_isUIAnalyticsEvent: boolean;
// (undocumented)
update(
updater: ((payload: AnalyticsEventPayload) => AnalyticsEventPayload) | Record<string, any>,
): this;
}
// @public (undocumented)
export type UIAnalyticsEventHandler = (
event: UIAnalyticsEvent,
channel?: ChannelIdentifier,
) => void;
// @public (undocumented)
export type UIAnalyticsEventProps = AnalyticsEventProps & {
context?: Context;
handlers?: UIAnalyticsEventHandler[];
};
// @public (undocumented)
export function useAnalyticsEvents(): UseAnalyticsEventsHook;
// @public (undocumented)
export type UseAnalyticsEventsHook = {
createAnalyticsEvent: CreateUIAnalyticsEvent;
};
// @public (undocumented)
export const useCallbackWithAnalytics: UseCallbackWithAnalyticsHook;
// @public (undocumented)
export type UseCallbackWithAnalyticsHook = (
method: (...args: any[]) => void,
payload: ((...args: any[]) => void) | Record<string, any>,
channel?: string,
) => (...args: any[]) => void;
// @public (undocumented)
export function usePlatformLeafEventHandler<T>({
fn,
action,
componentName,
actionSubject,
packageName,
packageVersion,
analyticsData,
}: UsePlatformLeafEventHandlerHookArgs<T>): (value: T) => void;
// @public (undocumented)
export type UsePlatformLeafEventHandlerHook<T> = (value: T) => void;
// @public (undocumented)
export type UsePlatformLeafEventHandlerHookArgs<T> = {
fn: (value: T, analyticsEvent: UIAnalyticsEvent) => void;
action: string;
componentName: string;
actionSubject?: string;
packageName: string;
packageVersion: string;
analyticsData?: Record<string, any>;
};
// @public (undocumented)
export function usePlatformLeafSyntheticEventHandler({
fn,
action,
componentName,
packageName,
packageVersion,
analyticsData,
}: UsePlatformLeafSyntheticEventHandlerHookArgs): () => void;
// @public (undocumented)
export type UsePlatformLeafSyntheticEventHandlerHook = () => void;
// @public (undocumented)
export type UsePlatformLeafSyntheticEventHandlerHookArgs = {
fn: (analyticsEvent: UIAnalyticsEvent) => void;
action: string;
componentName: string;
packageName: string;
packageVersion: string;
analyticsData?: Record<string, any>;
};
// @public (undocumented)
export const withAnalyticsContext: (
defaultData?: any,
) => <Props, Component>(
WrappedComponent: React_2.JSXElementConstructor<Props> & Component,
) => React_2.ForwardRefExoticComponent<
React_2.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props & WithContextProps>> &
React_2.RefAttributes<any>
>;
// @public (undocumented)
export const withAnalyticsEvents: (
createEventMap?: CreateEventMap,
) => <Props extends WithAnalyticsEventsProps, Component>(
WrappedComponent: React_2.JSXElementConstructor<Props> & Component,
) => React_2.ForwardRefExoticComponent<
React_2.PropsWithoutRef<
JSX.LibraryManagedAttributes<Component, Omit<Props, keyof WithAnalyticsEventsProps>>
> &
React_2.RefAttributes<any>
>;
// @public (undocumented)
export interface WithAnalyticsEventsProps {
createAnalyticsEvent?: CreateUIAnalyticsEvent;
// (undocumented)
ref?: React_2.Ref<any>;
}
// @public (undocumented)
export interface WithContextProps {
// (undocumented)
analyticsContext?: Record<string, any>;
}
// (No @packageDocumentation comment for this package)
```
<!--SECTION END: Main Entry Types-->
### Peer Dependencies
<!--SECTION START: Peer Dependencies-->
```json
{
"react": "^16.8.0"
}
```
<!--SECTION END: Peer Dependencies-->