import { ProjectUIDL } from '@teleporthq/teleport-types';
/**
* The address-key keeper: the first script of every page's `
` (the first
* global asset), ahead of the owner's scripts and custom head code. A link
* that IS a credential — whoever holds it acts as its owner — must leave the
* address before any other script of the page can read it: an analytics or ads
* tag the owner added reads `location.href`, and the address travels on in a
* Referer. Two links carry one:
*
* - A customer's booking link carries the booking's manage key: in its query
* (`/booking/BK-…?key=…` or `/booking?ref=BK-…&key=…`) on every link
* already emailed, in its fragment (`/booking/BK-…#key=…`) on the address the
* payment provider sends the customer back to (teleport-gui
* `buildManageUrlScript`; a fragment never reaches a server or a Referer).
* On a page whose address names a booking reference (`BK-` and at least six
* letters or digits, in `ref` or as the last path segment) and a `key`, the
* keeper keeps the key in the tab's sessionStorage under
* `tq-booking-key:` — so a customer who returns in another tab or
* browser still reaches the booking. The booking page's step that reads the
* link takes it from there (teleport-gui's `EXTRACT_MANAGE_LINK_SCRIPT`).
* - A password-reset link carries its token: in its fragment (`#token=`) on
* every link sent now, in its query (`?token=`) on links already sent. On
* the reset page (the path the reset email links to, under a locale prefix
* too) the keeper keeps it under `RESET_TOKEN_STORAGE_KEY`; the reset page's
* steps read it from there (teleport-gui `READ_RESET_TOKEN_SCRIPT`).
* - A newsletter link carries its token: in its fragment (`#t=`) on every
* link sent now, in its query (`?t=`) on links already sent; the token
* carries the subscriber's address. On the newsletter's confirm and unsubscribe pages
* (the paths the emails link to, under a locale prefix too) the keeper keeps
* it under `NEWSLETTER_TOKEN_STORAGE_KEY`; the pages' steps read it from
* there (teleport-gui `readNewsletterTokenScript`).
*
* In every case the address is replaced with the same one without the key
* (`history.replaceState`). Where storage refuses the write (a locked-down
* browser), the address is left as it was and the page reads the key from it
* as before.
*
* Each rule ships only to a site whose workflows read what it keeps (they name
* its storage key): a site exported by an editor that still reads the key from
* the address keeps working exactly as it did.
*/
/** The sessionStorage key prefix the editor's booking scripts read (mirrored in teleport-gui). */
export declare const BOOKING_KEY_STORAGE_PREFIX = "tq-booking-key:";
/** The sessionStorage key the newsletter pages read a link's token from (mirrored in teleport-gui). */
export declare const NEWSLETTER_TOKEN_STORAGE_KEY = "tq-newsletter-token";
export interface AddressKeyKeeperRules {
/** Keep a booking link's manage key (`key`). */
bookingKeys?: boolean;
/** Keep a reset link's token (`token`) on these pages. */
resetPagePaths?: string[];
/** Keep a newsletter link's token (`t`) on these pages. */
newsletterPagePaths?: string[];
}
/** Authored as source text with no backslash: it is emitted verbatim. */
export declare const generateAddressKeyKeeperSource: (rules: AddressKeyKeeperRules) => string;
/** A site with Bookings whose booking pages read the key the keeper keeps. */
export declare const shouldKeepBookingKeysOutOfTheAddress: (uidl: ProjectUIDL) => boolean;
/**
* The newsletter pages the keeper watches: the confirm and unsubscribe pages
* the emails link to, on a site whose workflows read the token it keeps (they
* name NEWSLETTER_TOKEN_STORAGE_KEY) — a site exported before reads `?t=` as
* it did.
*/
export declare const newsletterTokenKeeperPagePaths: (uidl: ProjectUIDL) => string[];
/**
* Makes the keeper of the project's rules the first global asset: the first
* script of ``. Idempotent; a project neither rule applies to is left
* as it was.
*/
export declare const injectAddressKeyKeeper: (uidl: ProjectUIDL) => void;
//# sourceMappingURL=address-key-keeper.d.ts.map