export * from "./type-guards"; export * from "./safewrap"; export * from "./endpoint-url"; export * from "./event-emitter"; export * from "./transport-health"; export { getLogger, resolveLogLevel, setLevelFromConfig, type LogLevel, type Logger, } from "./logger"; /** * Generate a short, URL-safe random ID (nanoid-compatible). * Uses crypto.getRandomValues for entropy — same approach as nanoid. * Default size 16 gives ~91 bits of entropy (55^16). */ export declare function generateId(size?: number): string; /** * Generate a RFC 4122 v4 UUID. Used by the chat module to mint message ids * client-side so the optimistic temp row and the persisted server row share * a single identity (no key churn, no remount). Uses `crypto.randomUUID` * where available and falls back to `crypto.getRandomValues` on older * browsers. */ export declare function generateUuidV4(): string; /** * Validate user agent string */ export declare function isValidUserAgent(userAgent: string): boolean; /** * Maximum serialized event payload size, in bytes (1 MB). * * The transport layer gzips bodies before sending and the ingestion API * applies its own server-side limits, so this cap exists only to defeat * runaway client-side bugs (infinite property growth, accidental DOM dumps). * * Previously 10 KB, which silently dropped legitimate `$autocapture` events * on real apps where 15–25 ancestor elements with framework class soup put * the JSON above 10 KB before any user-defined properties were added. * * Aligned with PostHog's analogous client cap (1 MB). */ export declare const MAX_PAYLOAD_BYTES = 1048576; /** * Validate payload string. Used to defend against pathological / runaway * payloads only; routine "this event got too big" cases (deep DOM chains) * must NOT be silently dropped here. See {@link MAX_PAYLOAD_BYTES}. */ export declare function isValidPayload(payloadStr: string): boolean; /** * Check if current environment is a test environment */ export declare function isTestEnvironment(): boolean; /** * Iterate over an array or object */ export declare function each(obj: T[] | Record | null | undefined, iterator: (value: T, key: string | number) => void, thisArg?: any): void; /** * Use this instead of element.addEventListener to avoid eslint errors * This properly implements the default options for passive event listeners */ export declare function addEventListener(element: Window | Document | Element | undefined, event: string, callback: EventListener, options?: AddEventListenerOptions): void; /** * Extend object with properties from another object */ export declare function extend>(target: T, source: Record | null | undefined): T; /** * Extend array with additional items * Mutates the base array and returns it (matches PostHog's behavior) */ export declare function extendArray(base: T[], ...additional: T[][]): T[]; /** * Strip properties with empty values (null, undefined, empty string) */ export declare function stripEmptyProperties>(obj: T): Partial; /** * Strip leading dollar sign from string */ export declare function stripLeadingDollar(str: string): string;