/** * Copyright (c) 2025 * * Full-height support for the Liveboard and app embeds. * @summary Full height */ import { BaseViewConfig, EmbedEvent, FullHeightViewConfig, HostEvent, MessageCallback, QueryParams } from './types'; /** * The slice of an embed's view config the full-height controller reads. */ export type FullHeightControllerViewConfig = FullHeightViewConfig & Pick; /** * The subset of the embed the full-height controller drives. Keeping this * narrow lets the controller stay independent of the embed class hierarchy. */ export interface FullHeightEmbedHost { /** * Returns the embedded iframe. The iframe only exists once the embed has * rendered, so this is a callback rather than a value. */ getIframe: () => HTMLIFrameElement; /** * Sets the height of the embed container. */ setFrameHeight: (height: number | string) => void; /** * Registers an SDK-owned handler for an embed event. */ on: (eventType: EmbedEvent, callback: MessageCallback) => void; /** * Sends a host event to the embedded ThoughtSpot app. */ trigger: (hostEvent: HostEvent, data: unknown) => void; } /** * Owns every piece of full-height behavior for an embed: the height * negotiation with the ThoughtSpot app, the query parameters that switch the * feature on, and the viewport listeners that drive lazy loading. * * The controller is inert unless `fullHeight` is enabled, so embeds can create * one unconditionally. */ export declare class FullHeightController { private readonly host; private scrollContainers; private resizeObserver; private config; constructor(viewConfig: FullHeightControllerViewConfig, host: FullHeightEmbedHost); /** * The view config the controller runs on: the host app's own config with * the lazy-loading defaults filled in. Read-only, so the only way to change * it is through the setter, which re-resolves the defaults. */ get viewConfig(): Readonly; /** * Replaces the view config the controller runs on and re-resolves the * lazy-loading defaults against it. The config the caller passes is never * written to; the controller keeps a copy of its own. */ set viewConfig(viewConfig: Readonly); /** * The view config with the lazy-loading settings the embed falls back to * when the host app has not chosen its own. * * Pure by design: it returns a new config rather than writing to the one it * is given, so the host app's object is left untouched. * @param viewConfig The embed's view config * @returns A copy with the defaults filled in, host app choices preserved */ private static withLazyLoadingDefaults; /** * Whether the host app asked for a full-height embed. */ private get isEnabled(); /** * Whether visualizations should load as they scroll into view, which * requires the SDK to report the visible region of the embed. */ private get isLazyLoadEnabled(); /** * The floor for the frame height. `defaultHeight` is the deprecated * spelling of `minimumHeight` and is still honored for compatibility. */ get minimumHeight(): number; /** * Registers the embed event handlers the feature depends on. Called from * the constructor, so the handlers are in place before `render`. */ private registerEventHandlers; /** * Adds the full-height query parameters to the embed URL params. * @param params The query parameters being built by the embed */ addQueryParams(params: QueryParams): void; /** * Attaches the viewport listeners that keep lazy loading in sync. Call this * once the embed has rendered and the iframe exists. */ onRender(): void; /** * Detaches every listener and observer owned by the controller. */ destroy(): void; /** * Sets the frame height to the height reported by the ThoughtSpot app, * never going below the configured minimum. */ private handleEmbedHeight; /** * Answers the app's request for the center of the visible embed region. */ private handleEmbedIframeCenter; /** * Answers the app's request for the currently visible embed coordinates. */ private handleRequestVisibleCoordinates; /** * Resets the frame height when the app navigates away from a Liveboard, * since only Liveboard routes report a height of their own. */ private handleRouteChange; /** * Pushes the visible embed region to the app so it can decide which * visualizations to load. */ private sendVisibleCoordinates; private getVisibleCoordinates; private registerLazyLoadListeners; /** * Tracks the ancestors that can scroll or clip the embed, so the visible * region stays correct when the embed lives inside its own scroll * container rather than the page. */ private observeScrollableContainers; private unregisterLazyLoadListeners; } //# sourceMappingURL=full-height.d.ts.map