interface MbuzzOptions { apiKey: string; enabled?: boolean; debug?: boolean; timeout?: number; skipPaths?: string[]; skipExtensions?: string[]; } declare const setApiUrlForTesting: (apiUrl: string) => void; interface Identifier { email?: string; user_id?: string; [key: string]: string | undefined; } interface TrackOptions { visitorId?: string; userId?: string; eventType: string; properties?: Record; ip?: string; userAgent?: string; identifier?: Identifier; } interface TrackResult { success: true; eventId?: string; eventType: string; visitorId?: string; } interface ConversionOptions$1 { eventId?: string; visitorId?: string; userId?: string; conversionType: string; revenue?: number; currency?: string; isAcquisition?: boolean; inheritAcquisition?: boolean; properties?: Record; ip?: string; userAgent?: string; /** * @deprecated Pass the email or external ID as `userId` instead. * The backend `/conversions` endpoint has never permitted this field and * the events endpoint treats `identifier.email` exactly as `user_id`. * Will be removed in a future major release. */ identifier?: Identifier; } interface ConversionResult { success: true; conversionId?: string; attribution?: Record; } interface IdentifyOptions$1 { userId: string | number; visitorId?: string; traits?: Record; } declare const init: (options: MbuzzOptions) => void; declare const visitorId: () => string | undefined; declare const userId: () => string | undefined; declare const middleware: () => (req: Request, res: Response, next: NextFunction) => void; declare const event: (eventType: string, properties?: Record) => Promise; interface ConversionOptions { eventId?: string; visitorId?: string; userId?: string; revenue?: number; currency?: string; isAcquisition?: boolean; inheritAcquisition?: boolean; properties?: Record; identifier?: Identifier; } declare const conversion: (conversionType: string, options?: ConversionOptions) => Promise; interface IdentifyOptions { visitorId?: string; traits?: Record; } declare const identify: (userIdValue: string | number, options?: IdentifyOptions) => Promise; interface RequestContextOptions { visitorId: string; ip: string; userAgent: string; userId?: string; url?: string; referrer?: string; } /** * Request context that holds visitor ID, request metadata, and fingerprint info. * Used to automatically enrich events with URL, referrer, ip, and user_agent. * NOTE: Session resolution is now handled server-side (v0.7.0+) */ declare class RequestContext { readonly visitorId: string; readonly ip: string; readonly userAgent: string; userId?: string; readonly url?: string; readonly referrer?: string; constructor(options: RequestContextOptions); /** * Enrich custom properties with url and referrer from context. * Custom properties override context properties. */ enrichProperties(custom: Record): Record; } /** * Run a callback with the given request context. * Context is automatically available via getContext() within the callback. */ declare function withContext(context: RequestContext, callback: () => T | Promise): Promise; /** * Get the current request context. * Returns undefined if called outside of withContext. */ declare function getContext(): RequestContext | undefined; /** * Clear the current context. * Useful for testing or manual cleanup. */ declare function clearContext(): void; declare const VISITOR_COOKIE = "_mbuzz_vid"; declare const SESSION_ENDPOINT_PATH = "/_mbuzz/session"; /** * Generate a random 64-character hex string for use as visitor/session ID. * Uses cryptographically secure random bytes. */ declare function generateId(): string; export { type ConversionOptions$1 as ConversionOptions, type ConversionResult, type Identifier, type IdentifyOptions$1 as IdentifyOptions, type MbuzzOptions, RequestContext, type RequestContextOptions, SESSION_ENDPOINT_PATH, type TrackOptions, type TrackResult, VISITOR_COOKIE, clearContext, conversion, event, generateId, getContext, identify, init, middleware, setApiUrlForTesting, userId, visitorId, withContext };