import type { PostalAddress } from './types.js'; export type AddressKind = 'shipping' | 'billing'; export type AddressFieldName = 'name' | 'line1' | 'line2' | 'city' | 'region' | 'postalCode' | 'country'; /** Where one address field goes on the page the model is looking at. */ export interface AddressFieldTarget { readonly kind: AddressKind; readonly field: AddressFieldName; /** Opaque to this module: a snapshot ref, resolved by the driver. */ readonly target: string; } /** * The daemon's read path to the stored addresses. * * A port for the same reason `CardMaterialStore` is one: the checkout flow must * be drivable end to end without a config tree, and the assertion that the * order carries the STORED value needs a store a test can control. */ export interface AddressStore { read(kind: AddressKind): Promise; } export interface AddressCheck { readonly ok: boolean; readonly missing: readonly AddressFieldName[]; readonly reason: string | null; } /** One field's stored value. `line2` is the only one allowed to be empty. */ export declare function addressFieldValue(address: PostalAddress, field: AddressFieldName): string; /** * Whether a stored address is complete enough to put on an order. * * Names every missing field rather than the first, so one refusal tells the * owner everything they have to go and set. */ export declare function checkAddress(address: PostalAddress | null, kind: AddressKind): AddressCheck; export interface AddressFillDeps { readonly store: AddressStore; readonly fill: (target: string, value: string) => Promise; } export interface AddressFillResult { readonly ok: boolean; readonly filled: number; readonly failedField: string | null; readonly reason: string | null; } /** * Put the stored addresses on the page. * * Every kind the targets mention is read and checked BEFORE anything is typed, * so a checkout wanting both addresses with only one stored refuses without * having half-filled the form. */ export declare function fillAddresses(targets: readonly AddressFieldTarget[], deps: AddressFillDeps): Promise; /** * The destination, for the message the owner is being asked to veto. * * The owner should be able to see WHERE it is going in the notice, not only * what it costs, a correct total to the wrong address is still a wrong * order, and this is the last point at which they can catch it. * * Rendered from the STORED value and sanitized like every other notice field. * The address is the owner's own text, so it goes through the owner-field sanitize * which keeps underscores, but it is still neutralised rather than trusted: * a guarantee that holds only while every call site threads provenance * correctly is not a guarantee. */ export declare function renderDestination(address: PostalAddress | null): string | null; //# sourceMappingURL=address.d.ts.map