import { ProjectPluginStructure } from '@teleporthq/teleport-types'; /** * Simple A/B tests (Growth 2.0, spec item 26). * * An experiment is two SIBLING elements in a page: variant A (the original) * and variant B (its copy, edited by the owner), both carrying * `data-tq-exp=""` and `data-tq-exp-variant="a"|"b"`. The editor derives * the experiment list from those attributes — nothing else is stored — and * so does this generator. * * Both variants are rendered; a tiny inline script in `` picks the * visitor's arm BEFORE the body is parsed and hides the other one with a * style rule, so there is no flash of two heroes. The rule also hides that * element's descendants: a component instance is a `display: contents` * wrapper, and `display: none` on the wrapper alone is not enough in every * browser. The arm is kept in * `localStorage` (`tq_exp:`), so a returning visitor sees the same page; * with cookie consent it is derived from the analytics visitor id, so the * assignment also survives a cleared key. Only localStorage, no cookies, no * cross-site identifier (spec §12). * * The script publishes `window.__tpExp = { : 'a'|'b' }` for every * experiment in the project, each assigned on its own. The tracker stamps * `exp` only for tests whose element the visitor has seen (and keeps that * arm on later pages, so a checkout still counts for the hero that led * there). Analytics → Experiments reads one result per id. */ export declare const EXPERIMENT_ATTR = "data-tq-exp"; export declare const EXPERIMENT_VARIANT_ATTR = "data-tq-exp-variant"; export declare const EXPERIMENT_STORAGE_PREFIX = "tq_exp:"; /** Every experiment id a page or component of the project declares, sorted, unique. */ export declare function collectExperimentIds(uidl: ProjectPluginStructure['uidl']): string[]; /** * The assignment script. Kept small (well under 1 KB) and dependency-free: * it runs in `` of every page, before any bundle. `E` is the list of * experiment ids baked in at generation. * * Arm choice: the stored arm; else, with consent and a visitor id, the parity * of a 32-bit FNV-1a hash of `|` (stable per visitor and per * experiment — the same person is not always "a"); else a coin flip. Either * way the arm is stored and reused. */ export declare function buildExperimentAssignmentScript(ids: string[]): string; /** The `