/* * Microsoft Application Insights react plugin, 19.4.0 * Copyright (c) Microsoft and contributors. All rights reserved. * * Microsoft Application Insights Team * https://github.com/microsoft/applicationinsights-react-js#readme */ declare namespace ApplicationInsights { import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js'; import { Context } from 'react'; import { Dispatch } from 'react'; import { History as History_2 } from 'history'; import { IAppInsights } from '@microsoft/applicationinsights-core-js'; import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js'; import { IConfiguration } from '@microsoft/applicationinsights-core-js'; import { ICookieMgr } from '@microsoft/applicationinsights-core-js'; import { ICustomProperties } from '@microsoft/applicationinsights-core-js'; import { IEventTelemetry } from '@microsoft/applicationinsights-core-js'; import { IExceptionTelemetry } from '@microsoft/applicationinsights-core-js'; import { IMetricTelemetry } from '@microsoft/applicationinsights-core-js'; import { IPageViewTelemetry } from '@microsoft/applicationinsights-core-js'; import { IPlugin } from '@microsoft/applicationinsights-core-js'; import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js'; import { ITelemetryContext } from '@microsoft/applicationinsights-core-js'; import { ITelemetryItem } from '@microsoft/applicationinsights-core-js'; import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js'; import { ITraceTelemetry } from '@microsoft/applicationinsights-core-js'; import * as React_2 from 'react'; import { default as React_3 } from 'react'; import { SetStateAction } from 'react'; type AIReactCustomEvent = Dispatch>; /** * Higher-order component base class to hook Application Insights tracking * in a React component's lifecycle. */ abstract class AITrackedComponentBase

extends React_2.Component

{ protected _mountTimestamp: number; protected _firstActiveTimestamp: number; protected _idleStartTimestamp: number; protected _lastActiveTimestamp: number; protected _totalIdleTime: number; protected _idleCount: number; protected _idleTimeout: number; protected _intervalId?: any; protected _componentName: string; protected _reactPlugin: ReactPlugin; constructor(props: P, reactPlugin: ReactPlugin, componentName: string); componentDidMount(): void; componentWillUnmount(): void; protected trackActivity: (e: React_2.SyntheticEvent) => void; private getEngagementTimeSeconds; } const AppInsightsContext: AppInsightsReactContext; class AppInsightsErrorBoundary extends React_3.Component { state: IAppInsightsErrorBoundaryState; componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void; render(): React_3.ReactNode; } type AppInsightsReactContext = Context; interface IAppInsightsErrorBoundaryProps { appInsights: ReactPlugin; onError: React_3.ComponentType; children: React_3.ReactNode; } interface IAppInsightsErrorBoundaryState { hasError: boolean; error: Error | null; errorInfo: React_3.ErrorInfo | null; } /** * Settings to initialize a ReactAI instance. */ interface IReactExtensionConfig { /** * React router history for enabling Application Insights PageView tracking. * * @type {History} * @memberof IReactAISettings */ readonly history?: History_2; } class ReactPlugin extends BaseTelemetryPlugin { priority: number; identifier: string; readonly context: ITelemetryContext; constructor(); initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void; /** * Get the current cookie manager for this instance */ getCookieMgr(): ICookieMgr; /** * Get application insights instance. */ getAppInsights(): IAppInsights; /** * Add Part A fields to the event * @param env The event that needs to be processed */ processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void; trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void; trackPageView(pageView: IPageViewTelemetry): void; trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void; trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void; trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void; } const useAppInsightsContext: () => ReactPlugin; function useTrackEvent(reactPlugin: ReactPlugin, eventName: string, eventData: T, skipFirstRun?: boolean): AIReactCustomEvent; const useTrackMetric: (reactPlugin: ReactPlugin, componentName: string, customProperties?: ICustomProperties) => () => void; /** * Higher-order component function to hook Application Insights tracking * in a React component's lifecycle. * * @param reactPlugin - ReactPlugin instance * @param Component - the React component to be instrumented * @param componentName - (optional) component name * @param className - (optional) className of the HOC div */ function withAITracking

(reactPlugin: ReactPlugin, Component: React_2.ComponentType

, componentName?: string, className?: string): React_2.ComponentClass

; }