import React, { ReactNode } from "react"; import type { HumanBehaviorTracker } from "humanbehavior-js"; /** * The React surface, with the recorder held at arm's length. * * Everything here used to import the bundled tracker directly, which meant any * app importing the provider also shipped rrweb and the whole recorder in its * own build - and could only get SDK fixes by reinstalling. The logic is * unchanged; it now receives whatever provides `init`, so the same provider can * be bound to the bundled recorder (`humanbehavior-js/react`) or to the * auto-updating loader (`humanbehavior-js/react/auto`). * * The tracker type is imported for types only, so it is erased at build time and * never pulls the recorder into a bundle. */ /** Anything that can produce a tracker: the bundled class, or the CDN loader stub. */ export interface TrackerHost { init(apiKey: string, options: Record): any; } export interface FactoryLogger { error: (...args: any[]) => void; warn: (...args: any[]) => void; debug: (...args: any[]) => void; } export interface IdentifyUserArgs { userProperties: Record; identityToken?: string; } export interface HumanBehaviorInterface { addEvent: (event: any) => void; identifyUser: (args: IdentifyUserArgs) => Promise; start: () => void; stop: () => void; logout: () => void; viewLogs: () => void; setUnredactedFields: (fields: string[]) => void; hasUnredactedFields: () => boolean; getUnredactedFields: () => string[]; trackPageView: () => void; } export interface HumanBehaviorProviderProps { apiKey?: string; client?: HumanBehaviorTracker; children: ReactNode; options?: { ingestionUrl?: string; logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug'; redactFields?: string[]; redactionStrategy?: { mode: 'privacy-first' | 'visibility-first'; unredactFields?: string[]; redactFields?: string[]; }; enableAutomaticTracking?: boolean; suppressConsoleErrors?: boolean; recordCanvas?: boolean; enableAutomaticProperties?: boolean; propertyDenylist?: string[]; automaticTrackingOptions?: { trackButtons?: boolean; trackLinks?: boolean; trackForms?: boolean; includeText?: boolean; includeClasses?: boolean; }; maxQueueSize?: number; enableConsoleTracking?: boolean; enableNetworkTracking?: boolean; enableErrorTracking?: boolean; enableWebVitals?: boolean; enableTracing?: boolean; release?: string; environment?: string; commitSha?: string; dist?: string; captureRequestBodies?: boolean; /** Auto-updating installs only: serve the loader from your own origin. */ cdnUrl?: string; /** Auto-updating installs only: pin an exact recorder build. */ version?: string; }; } export interface ErrorBoundaryProps { children: ReactNode; fallback?: ReactNode; client?: HumanBehaviorTracker; onError?: (error: Error, componentStack: string | null) => void; } export interface ErrorBoundaryState { hasError: boolean; } export declare function createHumanBehaviorReact(host: TrackerHost, log: FactoryLogger): { HumanBehaviorContext: React.Context; HumanBehaviorProvider: ({ apiKey, client, children, options }: HumanBehaviorProviderProps) => import("react/jsx-runtime").JSX.Element; useHumanBehavior: () => HumanBehaviorInterface | HumanBehaviorTracker; useRedaction: () => { setUnredactedFields: (fields: string[]) => void; hasUnredactedFields: () => boolean; getUnredactedFields: () => string[]; }; useUserTracking: () => { identifyUser: ({ userProperties, identityToken }: IdentifyUserArgs) => Promise<{ success: boolean; error?: undefined; } | { success: boolean; error: unknown; }>; }; HumanBehaviorErrorBoundary: React.ComponentClass; }; export declare function captureNextError(error: unknown, options?: { client?: HumanBehaviorTracker; componentStack?: string; }): void; //# sourceMappingURL=factory.d.ts.map