import { default as Widgets } from './widgets/Widgets'; import { default as EmbedWidget } from './widgets/EmbedWidget'; import { default as PopupWidget } from './widgets/PopupWidget'; import { default as WidgetApi } from './api/WidgetApi'; import { default as EventsApi } from './api/EventsApi'; import { ConfigOptions, WidgetConfig, WidgetResult } from './types'; import { DeclarativeEmbedWidget, DeclarativePopupWidget } from './widgets/declarative/DeclarativeWidgets'; export * from './types'; export * from './docs'; export { Widgets, EmbedWidget, PopupWidget, DeclarativeEmbedWidget, DeclarativePopupWidget, WidgetApi, }; /** * A static instance of the {@link WidgetApi} created when you call {@link #init init}. * * Read the {@link WidgetApi} docs. * * @returns WidgetApi static instance * @example * squatch.api().render({ ... }) * squatch.api().upsertUser({ ... }) * squatch.api().squatchReferralCookie() */ 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 * @example * squatch.widgets().render({ widgetType: "w/widget-type" }) * squatch.widgets().upsertUser({ user: { ... }, widgetType: "w/widget-type" }) * squatch.widgets().autofill(".referral-code") */ 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 * * @example * squatch.events().track({ ... }) */ 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}. * * Read the {@link Widgets.render} docs. * * @example * squatch.widget().then(res => { * const widget = res.widget * }).catch(e => console.error("Did not render widget:", e)) */ 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}. * * Called by default on startup via the loader script. * @private */ export declare function _auto(): 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} * * @example * squatch.autofill("input.referral-code") * squatch.autofill("input#referral-code") */ export declare function autofill(selector: string): 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; } }