@atlaskit/analytics-next
Version:
React components, HOCs and hooks to assist with tracking user activity with React components
26 lines (25 loc) • 947 B
TypeScript
import React, { Component } from 'react';
import PropTypes from 'prop-types';
type AnalyticsDelegateProps = {
children: React.ReactNode;
delegateAnalyticsEvent?: (name: string, data: any, isPrivate: boolean) => void;
};
type AnalyticsDelegateContext = {
onAnalyticsEvent?: (name: string, data: any, isPrivate: boolean) => void;
};
/**
* Listens to public and private events and delegates to an analytics
* stack in a different React root.
*/
declare class AnalyticsDelegate extends Component<AnalyticsDelegateProps> {
static contextTypes: {
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
};
static childContextTypes: {
onAnalyticsEvent: PropTypes.Requireable<(...args: any[]) => any>;
};
getChildContext(): AnalyticsDelegateContext;
onAnalyticsEvent: (name: string, data: any, isPrivate: boolean) => void;
render(): React.ReactNode;
}
export default AnalyticsDelegate;