import type { AddressSettings, AddressSurface, ResolvedAddressField, ResolvedAddressSchema } from './types.js'; export declare const ADDRESS_SETTINGS_DEFAULTS: AddressSettings; type SettingsInput = Partial>; /** * Turns raw stored values into a complete `AddressSettings`. Absent values * take the code default silently; unknown or malformed values fall back to * the default with one `console.warn` per bad value. */ export declare function normalizeAddressSettings(input: SettingsInput): AddressSettings; /** Shallow copy of a field, with its own `pattern` object. */ export declare function cloneAddressField(field: ResolvedAddressField): ResolvedAddressField; /** Copy of a schema that shares nothing mutable with the original. */ export declare function cloneAddressSchema(schema: ResolvedAddressSchema): ResolvedAddressSchema; /** Fields grouped by row, groups in order of first appearance. */ export declare function groupFieldsByRow(fields: ResolvedAddressField[]): ResolvedAddressField[][]; /** Flattens row groups back to a field list, numbering rows densely 0..n. */ export declare function flattenFieldRows(groups: ResolvedAddressField[][]): ResolvedAddressField[]; /** * Applies the merchant settings to a derived schema and returns a new one. * * - `nameFormat: 'split'` replaces `recipient` by `given_name` and * `family_name` on the same row (family first when the record says so). * - `telephone` / `organization`: `hidden` removes the field; `required` and * `optional` set its flag. Organization is only touched when the record * shows `%O`. * - `addressLine2: 'hidden'` removes lines 2 and 3; `addressLine3: 'enabled'` * adds line 3 after line 2 (not when line 2 is hidden). * - `required.: 'required'` tightens only; nothing is ever loosened. * - Rows are renumbered densely after removals; `country` stays row 0. */ export declare function applyAddressSettings(schema: ResolvedAddressSchema, settings: AddressSettings): ResolvedAddressSchema; /** * The country a form opens on: `'none'` → `''` (the DEFAULT record), * `'store'` → the store's country (or `''` when unknown), a code → that code. */ export declare function resolveDefaultCountry(settings: AddressSettings, storeCountry?: string): string; /** * The countries a scope offers (§ 3.13 "intent wins"): `ALL` → every country; * `SELL_TO` → the merchant's list, or every country for `'all'`; `SHIPPING` → * that list ∩ the zone countries, or the list alone when no zone data is known. */ export declare function resolveSellToCountries(settings: AddressSettings, scope: 'ALL' | 'SELL_TO' | 'SHIPPING', allCountries: string[], zoneCountries?: string[]): string[]; /** * Whether an address of `country` may be saved on `surface`: account and * billing use the sell-to list; shipping uses the list ∩ the zone countries * when zone data is known. */ export declare function isCountryAllowed(country: string, settings: AddressSettings, surface: AddressSurface, zoneCountries?: string[]): boolean; export {};