import { PopupDirection, PopupModal } from '../schema/index.ts'; /** * The renderer's own words. * * Almost everything a visitor reads is authored: labels, copy, the submit * button, the success and error screens. What's left is the handful of things * the renderer says on its own behalf — the validation complaints, the button * mid-submit, a select's empty row, and the buttons that walk a step form. They * can't be authored because they only exist in states the author never edits. * * The builder passes its translations in for the strings only the canvas ever * shows (see `cardHandleLabels`, `inlineHint`). That can't work here: these * appear in the live popup on a storefront, where there is no builder, and the * renderer is shipped as its own bundle with no dictionary in it. So the words * live here instead, keyed by the form's `language`. * * That used to be `direction`: the builder labelled `ltr` "English" and `rtl` * "Hebrew", and a typographic setting doubled as the language picker. The two * are separate fields now — see `PopupLanguage` — and {@link languageOf} reads a * pre-split form's direction as the language it was standing in for, so nothing * saved before the change comes out half in English. * * Adding a language means a value in `PopupLanguage`, a direction to go with it, * and a column here. */ export interface RendererStrings { /** A required field was left empty. */ missingRequired: string; /** An email was filled in but isn't shaped like one. */ invalidEmail: string; /** A phone number was filled in but isn't shaped like one. */ invalidTel: string; /** * A number was filled in outside its `min`/`max`. Takes the bounds because * "out of range" without saying the range leaves a visitor guessing; either * end may be absent, so all three phrasings are needed. */ outOfRange: (min: number | undefined, max: number | undefined) => string; /** The submit failed and the author set no `onError` of their own. */ submitFailed: string; /** The submit button while its request is in flight. */ submitting: string; /** A select's empty first row, when the author set no placeholder. */ chooseOne: string; /** The step form's forward button, when the author set no `nextLabel`. */ next: string; /** The step form's back button, when the author set no `backLabel`. */ back: string; /** The dismiss button in the card's corner. Screen readers only. */ close: string; /** * The success screen of a form that redirects: what the visitor reads for the * moment between a successful submit and the next page painting. It says the * form worked and something is coming — never how long it will take, which * nothing here can know (see the note on `RedirectingView`). */ redirecting: string; /** Same moment, but the destination opened in a new tab and this one stays put. */ openedNewTab: string; /** The default wording of the launcher button, when the author set none. */ openForm: string; /** The copy button on a coupon. */ copy: string; /** The copy button once it has been pressed. */ copied: string; } /** The words for a form, in the language it was authored in. */ export declare function stringsFor(popup: Pick): RendererStrings; /** * The words for a direction, reading `rtl` as Hebrew the way that field used to * mean it. Nothing in here calls it any more — {@link stringsFor} covers every * caller that has a form — but it stays exported for hosts that hold a direction * and no form. */ export declare function dictionary(direction?: PopupDirection): RendererStrings;