@microsoft/applicationinsights-react-js 19.3.7-nightly.2507-04 → 19.3.7-nightly.2507-06

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 (30) hide show
  1. package/browser/applicationinsights-react-js.js +3863 -0
  2. package/browser/applicationinsights-react-js.js.map +1 -0
  3. package/browser/applicationinsights-react-js.min.js +6 -0
  4. package/browser/applicationinsights-react-js.min.js.map +1 -0
  5. package/dist/applicationinsights-react-js.api.json +1982 -0
  6. package/dist/applicationinsights-react-js.api.md +129 -0
  7. package/dist/applicationinsights-react-js.d.ts +137 -0
  8. package/dist/applicationinsights-react-js.js +3863 -0
  9. package/dist/applicationinsights-react-js.js.map +1 -0
  10. package/dist/applicationinsights-react-js.min.js +6 -0
  11. package/dist/applicationinsights-react-js.min.js.map +1 -0
  12. package/dist/applicationinsights-react-js.rollup.d.ts +142 -0
  13. package/dist-esm/AppInsightsContext.js +4 -0
  14. package/dist-esm/AppInsightsContext.js.map +1 -1
  15. package/dist-esm/AppInsightsErrorBoundary.js +7 -3
  16. package/dist-esm/AppInsightsErrorBoundary.js.map +1 -1
  17. package/dist-esm/Interfaces/IReactExtensionConfig.js +6 -2
  18. package/dist-esm/Interfaces/IReactExtensionConfig.js.map +1 -1
  19. package/dist-esm/ReactPlugin.js +19 -40
  20. package/dist-esm/ReactPlugin.js.map +1 -1
  21. package/dist-esm/applicationinsights-react-js.js +6 -2
  22. package/dist-esm/applicationinsights-react-js.js.map +1 -1
  23. package/dist-esm/useTrackEvent.js +4 -0
  24. package/dist-esm/useTrackEvent.js.map +1 -1
  25. package/dist-esm/useTrackMetric.js +5 -1
  26. package/dist-esm/useTrackMetric.js.map +1 -1
  27. package/dist-esm/withAITracking.js +7 -3
  28. package/dist-esm/withAITracking.js.map +1 -1
  29. package/package.json +1 -1
  30. package/types/tsdoc-metadata.json +11 -0
@@ -0,0 +1,129 @@
1
+ ## API Report File for "@microsoft/applicationinsights-react-js"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
8
+ import { Context } from 'react';
9
+ import { Dispatch } from 'react';
10
+ import { History as History_2 } from 'history';
11
+ import { IAppInsights } from '@microsoft/applicationinsights-common';
12
+ import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
13
+ import { IConfig } from '@microsoft/applicationinsights-common';
14
+ import { IConfiguration } from '@microsoft/applicationinsights-core-js';
15
+ import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
16
+ import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
17
+ import { IEventTelemetry } from '@microsoft/applicationinsights-common';
18
+ import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
19
+ import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
20
+ import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
21
+ import { IPlugin } from '@microsoft/applicationinsights-core-js';
22
+ import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
23
+ import { ITelemetryContext } from '@microsoft/applicationinsights-common';
24
+ import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
25
+ import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
26
+ import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
27
+ import * as React_2 from 'react';
28
+ import { default as React_3 } from 'react';
29
+ import { SetStateAction } from 'react';
30
+
31
+ // @public
32
+ export abstract class AITrackedComponentBase<P> extends React_2.Component<P> {
33
+ constructor(props: P, reactPlugin: ReactPlugin, componentName: string);
34
+ // (undocumented)
35
+ componentDidMount(): void;
36
+ // (undocumented)
37
+ protected _componentName: string;
38
+ // (undocumented)
39
+ componentWillUnmount(): void;
40
+ // (undocumented)
41
+ protected _firstActiveTimestamp: number;
42
+ // (undocumented)
43
+ protected _idleCount: number;
44
+ // (undocumented)
45
+ protected _idleStartTimestamp: number;
46
+ // (undocumented)
47
+ protected _idleTimeout: number;
48
+ // (undocumented)
49
+ protected _intervalId?: any;
50
+ // (undocumented)
51
+ protected _lastActiveTimestamp: number;
52
+ // (undocumented)
53
+ protected _mountTimestamp: number;
54
+ // (undocumented)
55
+ protected _reactPlugin: ReactPlugin;
56
+ // (undocumented)
57
+ protected _totalIdleTime: number;
58
+ // (undocumented)
59
+ protected trackActivity: (e: React_2.SyntheticEvent<any>) => void;
60
+ }
61
+
62
+ // Warning: (ae-forgotten-export) The symbol "AppInsightsReactContext" needs to be exported by the entry point applicationinsights-react-js.d.ts
63
+ //
64
+ // @public (undocumented)
65
+ export const AppInsightsContext: AppInsightsReactContext;
66
+
67
+ // Warning: (ae-forgotten-export) The symbol "IAppInsightsErrorBoundaryProps" needs to be exported by the entry point applicationinsights-react-js.d.ts
68
+ // Warning: (ae-forgotten-export) The symbol "IAppInsightsErrorBoundaryState" needs to be exported by the entry point applicationinsights-react-js.d.ts
69
+ //
70
+ // @public (undocumented)
71
+ export class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
72
+ // (undocumented)
73
+ componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void;
74
+ // (undocumented)
75
+ render(): React_3.ReactElement<unknown, string | React_3.JSXElementConstructor<any>>;
76
+ // (undocumented)
77
+ state: {
78
+ hasError: boolean;
79
+ };
80
+ }
81
+
82
+ // @public
83
+ export interface IReactExtensionConfig {
84
+ readonly history?: History_2;
85
+ }
86
+
87
+ // @public (undocumented)
88
+ export class ReactPlugin extends BaseTelemetryPlugin {
89
+ constructor();
90
+ // (undocumented)
91
+ readonly context: ITelemetryContext;
92
+ getAppInsights(): IAppInsights;
93
+ getCookieMgr(): ICookieMgr;
94
+ // (undocumented)
95
+ identifier: string;
96
+ // (undocumented)
97
+ initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
98
+ // (undocumented)
99
+ priority: number;
100
+ processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
101
+ // (undocumented)
102
+ trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
103
+ // (undocumented)
104
+ trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void;
105
+ // (undocumented)
106
+ trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void;
107
+ // (undocumented)
108
+ trackPageView(pageView: IPageViewTelemetry): void;
109
+ // (undocumented)
110
+ trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void;
111
+ }
112
+
113
+ // @public (undocumented)
114
+ export const useAppInsightsContext: () => ReactPlugin;
115
+
116
+ // Warning: (ae-forgotten-export) The symbol "AIReactCustomEvent" needs to be exported by the entry point applicationinsights-react-js.d.ts
117
+ //
118
+ // @public (undocumented)
119
+ export function useTrackEvent<T>(reactPlugin: ReactPlugin, eventName: string, eventData: T, skipFirstRun?: boolean): AIReactCustomEvent<T>;
120
+
121
+ // @public (undocumented)
122
+ export const useTrackMetric: (reactPlugin: ReactPlugin, componentName: string, customProperties?: ICustomProperties) => () => void;
123
+
124
+ // @public
125
+ export function withAITracking<P>(reactPlugin: ReactPlugin, Component: React_2.ComponentType<P>, componentName?: string, className?: string): React_2.ComponentClass<P>;
126
+
127
+ // (No @packageDocumentation comment for this package)
128
+
129
+ ```
@@ -0,0 +1,137 @@
1
+ /*
2
+ * Microsoft Application Insights react plugin, 19.3.7-nightly.2507-06
3
+ * Copyright (c) Microsoft and contributors. All rights reserved.
4
+ *
5
+ * Microsoft Application Insights Team
6
+ * https://github.com/microsoft/applicationinsights-react-js#readme
7
+ */
8
+
9
+ declare namespace ApplicationInsights {
10
+ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
11
+ import { Context } from 'react';
12
+ import { Dispatch } from 'react';
13
+ import { History as History_2 } from 'history';
14
+ import { IAppInsights } from '@microsoft/applicationinsights-common';
15
+ import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
16
+ import { IConfig } from '@microsoft/applicationinsights-common';
17
+ import { IConfiguration } from '@microsoft/applicationinsights-core-js';
18
+ import { ICookieMgr } from '@microsoft/applicationinsights-core-js';
19
+ import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
20
+ import { IEventTelemetry } from '@microsoft/applicationinsights-common';
21
+ import { IExceptionTelemetry } from '@microsoft/applicationinsights-common';
22
+ import { IMetricTelemetry } from '@microsoft/applicationinsights-common';
23
+ import { IPageViewTelemetry } from '@microsoft/applicationinsights-common';
24
+ import { IPlugin } from '@microsoft/applicationinsights-core-js';
25
+ import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
26
+ import { ITelemetryContext } from '@microsoft/applicationinsights-common';
27
+ import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
28
+ import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
29
+ import { ITraceTelemetry } from '@microsoft/applicationinsights-common';
30
+ import * as React_2 from 'react';
31
+ import { default as React_3 } from 'react';
32
+ import { SetStateAction } from 'react';
33
+
34
+ type AIReactCustomEvent<T> = Dispatch<SetStateAction<T>>;
35
+
36
+ /**
37
+ * Higher-order component base class to hook Application Insights tracking
38
+ * in a React component's lifecycle.
39
+ */
40
+ abstract class AITrackedComponentBase<P> extends React_2.Component<P> {
41
+ protected _mountTimestamp: number;
42
+ protected _firstActiveTimestamp: number;
43
+ protected _idleStartTimestamp: number;
44
+ protected _lastActiveTimestamp: number;
45
+ protected _totalIdleTime: number;
46
+ protected _idleCount: number;
47
+ protected _idleTimeout: number;
48
+ protected _intervalId?: any;
49
+ protected _componentName: string;
50
+ protected _reactPlugin: ReactPlugin;
51
+ constructor(props: P, reactPlugin: ReactPlugin, componentName: string);
52
+ componentDidMount(): void;
53
+ componentWillUnmount(): void;
54
+ protected trackActivity: (e: React_2.SyntheticEvent<any>) => void;
55
+ private getEngagementTimeSeconds;
56
+ }
57
+
58
+ const AppInsightsContext: AppInsightsReactContext;
59
+
60
+ class AppInsightsErrorBoundary extends React_3.Component<IAppInsightsErrorBoundaryProps, IAppInsightsErrorBoundaryState> {
61
+ state: {
62
+ hasError: boolean;
63
+ };
64
+ componentDidCatch(error: Error, errorInfo: React_3.ErrorInfo): void;
65
+ render(): React_3.ReactElement<unknown, string | React_3.JSXElementConstructor<any>>;
66
+ }
67
+
68
+ type AppInsightsReactContext = Context<ReactPlugin>;
69
+
70
+ interface IAppInsightsErrorBoundaryProps {
71
+ appInsights: ReactPlugin;
72
+ onError: React_3.ComponentType<any>;
73
+ children: React_3.ReactElement;
74
+ }
75
+
76
+ interface IAppInsightsErrorBoundaryState {
77
+ hasError: boolean;
78
+ }
79
+
80
+ /**
81
+ * Settings to initialize a ReactAI instance.
82
+ */
83
+ interface IReactExtensionConfig {
84
+ /**
85
+ * React router history for enabling Application Insights PageView tracking.
86
+ *
87
+ * @type {History}
88
+ * @memberof IReactAISettings
89
+ */
90
+ readonly history?: History_2;
91
+ }
92
+
93
+ class ReactPlugin extends BaseTelemetryPlugin {
94
+ priority: number;
95
+ identifier: string;
96
+ readonly context: ITelemetryContext;
97
+ constructor();
98
+ initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
99
+ /**
100
+ * Get the current cookie manager for this instance
101
+ */
102
+ getCookieMgr(): ICookieMgr;
103
+ /**
104
+ * Get application insights instance.
105
+ */
106
+ getAppInsights(): IAppInsights;
107
+ /**
108
+ * Add Part A fields to the event
109
+ * @param event The event that needs to be processed
110
+ */
111
+ processTelemetry(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
112
+ trackMetric(metric: IMetricTelemetry, customProperties: ICustomProperties): void;
113
+ trackPageView(pageView: IPageViewTelemetry): void;
114
+ trackEvent(event: IEventTelemetry, customProperties?: ICustomProperties): void;
115
+ trackException(exception: IExceptionTelemetry, customProperties?: ICustomProperties): void;
116
+ trackTrace(trace: ITraceTelemetry, customProperties?: ICustomProperties): void;
117
+ }
118
+
119
+ const useAppInsightsContext: () => ReactPlugin;
120
+
121
+ function useTrackEvent<T>(reactPlugin: ReactPlugin, eventName: string, eventData: T, skipFirstRun?: boolean): AIReactCustomEvent<T>;
122
+
123
+ const useTrackMetric: (reactPlugin: ReactPlugin, componentName: string, customProperties?: ICustomProperties) => () => void;
124
+
125
+ /**
126
+ * Higher-order component function to hook Application Insights tracking
127
+ * in a React component's lifecycle.
128
+ *
129
+ * @param reactPlugin ReactPlugin instance
130
+ * @param Component the React component to be instrumented
131
+ * @param componentName (optional) component name
132
+ * @param className (optional) className of the HOC div
133
+ */
134
+ function withAITracking<P>(reactPlugin: ReactPlugin, Component: React_2.ComponentType<P>, componentName?: string, className?: string): React_2.ComponentClass<P>;
135
+
136
+
137
+ }