import type { EntryCta } from '@funkit/connect-core'; /** Where the one-time code is sent, which decides keyboard and copy. */ export type ContactKind = 'PHONE' | 'EMAIL'; export interface SessionContactField { /** The transition's own input name — the key the answer is sent back under. */ name: string; kind: ContactKind; /** The server's pattern for the value, when it declares one. */ regex?: string; } /** * Every value the session-opening transition asks the user for, in the order * it declares them. * * All of them: a step that wants a number *and* an address verifies each on a * round of its own, and collecting only the first opens a session the server * cannot finish. The name is the body key, so gating on a known name is how * the client stops sending a field the server asked for. */ export declare function sessionContactFields(entry: EntryCta): readonly SessionContactField[]; export declare function isUnfamiliarContactName(name: string): boolean; /** * Nothing opens the session until every field it declares is answered. * `region` is the buyer's country, so a number typed the way they dial it at * home counts once it can be read as one. */ export declare function areContactsComplete(fields: readonly SessionContactField[], values: Readonly>, region?: string): boolean; /** * A number has to be one the world's numbering plans actually contain — the * right length for its country and a leading digit its country hands out — * since `/fiat/*` refuses anything else on any route and the code it sends * would otherwise go nowhere. A pattern the step declares narrows that further; * it never widens it. */ export declare function isCompleteContact(field: SessionContactField, value: string, region?: string): boolean; /** * The value as the step sends it: a number in E.164, however it was typed, and * an address trimmed. What could not be read as a number goes as typed, so the * server's own refusal names it rather than a silently altered value. */ export declare function normalizeContact(field: SessionContactField, value: string, region?: string): string; /** * Deliberately loose — a stricter pattern rejects addresses that are perfectly * valid. */ export declare function looksLikeEmail(value: string): boolean; //# sourceMappingURL=sessionContact.d.ts.map