/** * Helper functions * @author [Vivek Sudarsan] * @version 0.1.0 */ declare type BrowserTarget = 'es2020' | 'legacy'; /** * Add a third party script to the page and wait * for it to finish loading */ export declare const loadScript: (scriptBody: any) => Promise; /** * Get the users IP address * @returns string */ export declare const getIpAddress: () => Promise; /** * Get all of the url parameters * @returns object */ export declare const getUrlParams: () => string; /** * Get document referrer if it exists * @returns string */ export declare const getReferrer: () => string; /** * Detect url changes and trigger callback */ export declare const detectUrlChange: (callback: any) => void; /** * Hash a string with a salt and return the hash * as a Base64 encoded string * @param value * @returns */ export declare const hashWithSalt: (value: string) => Promise; /** * Determine if the browser supports ES2020 features * @returns 'legacy' | 'es2020' */ export declare const detectBrowser: (agent: string) => BrowserTarget; export declare const checkCookie: (cookieName: string) => Promise; /** * Add mesh visitor id to any form field that has mesh-visitor-id * field name (these are hidden fields typically) * @returns */ export declare const addMeshVisitorIdToForms: () => void; /** * Set up event handler for form tracking * across all marketing forms */ export declare const initFormHandlingOnBody: (callback: any) => void; /** * Debounce a function * @param func * @param wait * @returns */ export declare const debounce: (func: any, wait: number) => any[]; /** * Send a message to all embedded frames * @param message */ export declare const postMessageToAllFrames: (message: any) => void; /** * Handle messages from parent to embedded frames * @param event * @returns */ export declare const handleFrameMessage: (event: any) => void; /** * Hide any embedded frames that we need to mutate * @returns */ export declare const hideFramesToMutate: () => null | undefined; /** * Get the percentage of the page that has been scrolled * @returns */ export declare const getScrollPercentage: () => number; /** * Write a log message to the console * and add it to the window object * @param message */ export declare const avinaLog: (message: string) => void; /** * Get the browser name, version, and platform * to include in debug payload * @returns */ export declare const getBrowserDetails: () => { browserName: string; version: string; platform: string; }; export declare const tryParseJSON: (jsonString: string) => any; /** * Inject a script into a document's */ export declare const injectScript: (scriptContent: string) => void; /** * Poll an `async` function for its `result` until `done` or timeout * @param func - an `async` function that returns `{ done: boolean, result?: any }` * @param intervalMs - a polling interval, in milliseconds * @param timeoutMs - the total timeout duration, in milliseconds * @returns the `result` from `func` when `done`, or `null` on timeout */ export declare const poll: (func: () => Promise<{ done: boolean; result?: T | undefined; }>, intervalMs: number, timeoutMs: number) => Promise<{ success: boolean; result?: T | undefined; elapsedMs: number; attempts: number; }>; export {};