import Widgets from "./widgets/Widgets"; import EmbedWidget from "./widgets/EmbedWidget"; import PopupWidget from "./widgets/PopupWidget"; import CtaWidget from "./widgets/CtaWidget"; import WidgetApi from "./api/WidgetApi"; import EventsApi from "./api/EventsApi"; import { ConfigOptions, WidgetConfig, WidgetResult } from "./types"; export * from "./types"; export * from "./docs"; export { Widgets, EmbedWidget, PopupWidget, CtaWidget, WidgetApi }; /** * A static instance of the {@link WidgetApi} created when you call {@link #init init}. * * Read the {@link WidgetApi} docs. * * @returns WidgetApi static instance */ export declare function api(): WidgetApi | null; /** * A static instance of the {@link Widgets} created when you call {@link #init init}. * * Read the {@link Widgets} docs. * * @returns static instance */ export declare function widgets(): Widgets | null; /** * A static instance of the {@link EventsApi} created when you call {@link #init init}. * * Read the {@link EventsApi} docs. * * @returns EventsApi static instance */ export declare function events(): EventsApi | null; /** * Entry-point for high level API to render a widget using the instance of {@link Widgets} created when you call {@link #init init}. */ export declare function widget(widgetConfig: WidgetConfig): Promise | undefined; /** * Extracts widget configuration from `_saasquatchExtra` UTM parameter. Initialises `squatch` and renders the widget as a {@link PopupWidget} via static instanct of {@link Widgets}. */ export declare function _auto(configIn: ConfigOptions): Promise | undefined; /** * Initializes the static `squatch` global. This sets up: * * - `squatch.api()` a static instance of the {@link WidgetApi} * - `squatch.widgets()` a static instance of {@link Widgets} * - `squatch.events()` a static instance of {@link EventsApi} * * @param config Configuration details * * @example * squatch.init({tenantAlias:'test_basbtabstq51v'}); */ export declare function init(configIn: ConfigOptions): void; /** * Squatch.js can't start safely making operations until it's "ready". This * function detects that state. * * @param fn A callback once Squatch.js is ready. * * @example * squatch.ready(function() { * console.log("ready!"); * squatch.api().upsertUser(); * }); */ export declare function ready(fn: () => any): void; /** * Autofills a referral code into an element when someone has been referred. * Uses {@link WidgetApi.squatchReferralCookie} behind the scenes. * * @param {string} selector Element class/id * @returns {void} */ export declare function autofill(selector: string): void; /** * Overrides the default function that submits the user email. If you have * Security enabled, the email needs to be signed before it's submitted. * * @param {function} fn Callback function for the 'submit_email' event. * @returns {void} * * @example * squatch.submitEmail(function(target, widget, email) { * // Sign email and generate jwt token * var jwt = 'token'; * widget.reload(email, jwt); * }); */ export declare function submitEmail(fn: (target: any, widget: any, email: any) => any): void; /** * Manually set the _saasquatch cookie as a 1st party cookie if available as a URL parameter on the current page. * This runs automatically immediately when squatch-js is loaded, except when window.SaaSquatchDoNotAutoDrop is true. * Use this function manually if you have a single page application or custom routing that causes the `_saasquatch` URL parameter to not be set when Squatch.js loads. * It is safe to run this function multiple times. If the `_saasquatch` URL parameter is invalid or missing it will not clear the 1st party cookie. * * @returns {void} * * @example * squatch.pushCookie(); */ export declare function pushCookie(): void; declare global { interface Window { SaaSquatchDoNotAutoDrop?: boolean; } }