/** * Vanilla controller for the LSG Download Library. The same class drives the AEM * markup (booted from the theme clientlib by bootLsgDownloadLibrary) and the * Storybook component (created in a useEffect). * * - Language picker: a button + listbox popup under the download button; picking a * language swaps the download URL. * - Gating: when the library has a form overlay, the first download opens the * holding the VTBA form instead. The download only starts once the form * runtime reports a HubSpot success ("vtba-form:success"). The unlock is then kept * in sessionStorage per form page, so later downloads gated by the same form go * straight through for the rest of the session. * - Tracking: every download pushes `lsg_download` to the GTM dataLayer and * dispatches a bubbling `lsg-download:download` event. Nothing is re-submitted to * HubSpot. */ export declare const LSG_DOWNLOAD_EVENT = "lsg-download:download"; export declare const LSG_DOWNLOAD_UNLOCK_KEY_PREFIX = "lsg-download-unlocked:"; export type LsgDownloadUnlockedBy = "none" | "session" | "form"; export interface LsgDownloadTrackingDetail { title: string; /** Absolute URL of the file (selected language). */ url: string; type: string; language: string; action: string; external: boolean; gated: boolean; formPath: string; /** "none" = not gated, "session" = unlocked earlier this session, "form" = just submitted. */ unlockedBy: LsgDownloadUnlockedBy; libraryId: string; } export interface LsgDownloadLibraryControllerOptions { /** Defaults to window.sessionStorage (null when unavailable). */ storage?: Pick | null; /** Defaults to window.dataLayer (created if missing). */ dataLayer?: { push: (entry: object) => unknown; }; /** Defaults to window.open. Stories can stub it to simulate a popup blocker. */ openWindow?: (url: string) => Window | null; } /** Forgets the unlock for one form page (Storybook "reset", QA). */ export declare function resetLsgDownloadUnlock(formPath: string, storage?: Pick | null): void; export declare class LsgDownloadLibraryController { private readonly root; private readonly options; private readonly dialog; private pending; private completed; private openPicker; private pointerDownOnBackdrop; /** Where the success panel lives in the markup, so it can be put back after a swap. */ private readonly successHome; constructor(root: HTMLElement, options?: LsgDownloadLibraryControllerOptions); init(): void; destroy(): void; isGated(): boolean; isUnlocked(): boolean; unlock(): void; /** Keyed by form page path: libraries gated by the same form share one unlock. */ private unlockKey; private storage; /** Once unlocked, the download links no longer open a dialog. */ private stripGateAria; private onClick; private onTrigger; private onKeyDown; private onDocumentPointerDown; private onDialogPointerDown; private onDialogClose; private onFormSuccess; openGate(item: HTMLElement, trigger: HTMLAnchorElement): void; closeGate(): void; /** * Form ⇄ success. The overlay page's container is the visible modal, so on success * the panel takes the
's place inside the VTBA form root: the container's * background, padding and title stay. Showing the form puts the panel back. */ private setRegions; private focusFirstField; private focusSuccessHeading; /** * Hidden inputs carrying the requested document to HubSpot, only for the * properties the policy names (data-lsg-download-hs-*). The form runtime collects * every named input at submit time. */ private syncHiddenFields; private startDownload; private setLinkBehaviour; selectVariant(item: HTMLElement, option: HTMLElement): void; private pickerOptions; private showPicker; private closePicker; private setActiveOption; private snapshot; private track; private dataLayer; }