Files
agency/.pnpm-store/v3/files/4a/edf4ebf27822b103f54ef371c8210b483a364fd3f431209f96a9ffdc4594d67afa4afb2a1c48b50470e411d25662e6506a9000e36db1fb3a413732cd08ef0e
hanzo-agent 5af6960b87 run project
Run: sess_f37640604ae254cb4d11dc6217f7b721
2026-09-30 00:04:56 +00:00

45 lines
2.2 KiB
Plaintext

import { Component, type ErrorInfo, type ReactNode } from 'react';
import { Analytics } from './core';
import type { AnalyticsConfig } from './types';
declare const Ctx: import("react").Context<Analytics | null>;
export interface AnalyticsProviderProps {
/** Provide a pre-built client, or a config to build one. */
client?: Analytics;
config?: AnalyticsConfig;
/** Fire a pageview for the initial load (default true). */
autoPageview?: boolean;
children: ReactNode;
}
export declare function AnalyticsProvider(props: AnalyticsProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<Analytics | null>>;
/** useAnalytics returns the client. Outside a provider it returns a no-op-safe
* null-guarded proxy so calls never throw during SSR/tests. */
export declare function useAnalytics(): Analytics;
/** usePageview fires a pageview on every route CHANGE (not the initial mount —
* the provider's autoPageview covers that, so pages are counted exactly once). */
export declare function usePageview(path: string | null | undefined): void;
export interface ErrorBoundaryProps {
children: ReactNode;
/** Rendered when a child throws. A function receives the error + a reset. */
fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
/** Explicit client; defaults to the one from AnalyticsProvider. */
client?: Analytics;
}
interface ErrorBoundaryState {
error: Error | null;
}
/** ErrorBoundary reports React render errors to the client as error events —
* React swallows these before window.onerror sees them, so a boundary is the
* ONLY way to capture them. This is the React half of the @sentry replacement.
* Pair it with AnalyticsProvider (it reads the client from context), or pass an
* explicit `client`. */
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
static contextType: import("react").Context<Analytics | null>;
context: React.ContextType<typeof Ctx>;
state: ErrorBoundaryState;
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
componentDidCatch(error: Error, info: ErrorInfo): void;
private reset;
render(): ReactNode;
}
export {};
//# sourceMappingURL=react.d.ts.map