UNPKG

@critters/next

Version:

Secure bug reporting library for Next.js applications

49 lines (48 loc) 2.34 kB
export * from "./types"; export { BugTrackerConfig } from "./config"; export { Critters } from "./reporter"; export { generateSignature, formatError, safeStringify, sanitizeData, isBrowser, isServer, getBrowserInfo, getTimestamp, debugLog, } from "./utils"; export { startConsoleCapture, stopConsoleCapture, startNetworkCapture, stopNetworkCapture, startUserInteractionCapture, startAllCollectors, stopAllCollectors, clearCapturedData, getConsoleLogs, getNetworkRequests, getUserInteractions, getBrowserData, } from "./collectors"; export { ErrorBoundary, withErrorBoundary, useErrorReporting, } from "./components"; export { withErrorReporting, withPageErrorReporting, withAppErrorReporting, } from "./middleware"; import { BugTrackerConfigOptions, ReportResult } from "./types"; /** * Initialize the bug tracker with configuration * @param config - Configuration options for the bug tracker * @description * This function initializes the bug tracker with the provided configuration. * It sets up the global error handlers and starts data collectors in browser environments. * * @example * ```typescript * // Import the startCritters function * import { startCritters } from '@critters/next'; * * // Initialize at the entry point of your application * startCritters({ * apiKey: process.env.NEXT_PUBLIC_BUG_TRACKER_API_KEY!, * // Optional additional configuration * environment: process.env.NODE_ENV, * debug: process.env.NODE_ENV !== "production", * }); * ``` */ export declare function startCritters(config: BugTrackerConfigOptions): void; /** * @deprecated Use startCritters() instead. This function will be removed in a future version. */ export declare function initBugTracker(config: BugTrackerConfigOptions): void; /** * Report a bug to the configured endpoint * @deprecated Use catch() instead */ export declare function reportBug(error: Error | unknown, metadata?: Record<string, any>): Promise<ReportResult>; /** * Catch and report an error to the configured endpoint * @deprecated Use capture() instead */ export declare function catch_(error: Error | unknown, metadata?: Record<string, any>): Promise<ReportResult>; /** * Catch and report an error to the configured endpoint */ export declare function capture(error: Error | unknown, metadata?: Record<string, any>): Promise<ReportResult>;