/** * Brazilian phone-number helpers. * * WhatsApp Cloud API delivers E.164 digits (no `+`), but Meta occasionally * omits the "9" that BR mobile numbers require (11 → 13 total digits with * country code). The same user can arrive as `5548996967308` on one turn and * `554896967308` on the next; without normalization you get duplicate leads * and broken lookups. * * The rule (BR mobile canonical form): 55 + DDD(2) + 9 + local(8) = 13 digits. * If a 12-digit input has a local prefix starting with 6/7/8/9, treat it as a * mobile missing its "9" and inject one; otherwise leave alone. * * `normalizeBrazilianPhone` also handles messier inputs (with formatting, with * or without country code) — anything unrecognizable passes through as digits. */ /** Strip every non-digit character. */ export declare function digits(input: string | null | undefined): string; /** * Normalize any BR phone shape to canonical E.164 digits (no `+`). * * Accepts: "+55 (11) 98888-7777", "11988887777", "551188887777" (legacy 8-digit * mobile), "5511988887777". Returns `""` on empty input. Non-BR shapes pass * through as digits so consumers don't lose data. */ export declare function normalizeBrazilianPhone(input: string | null | undefined): string; /** Strip the country code — best-effort helper for display without `+55`. */ export declare function localizeBrazilianPhone(input: string | null | undefined): string; /** * All plausible variants of a BR phone as a caller might have stored it — * for LOOKUPS against a store where historical rows might use different * formats. Complements `normalizeBrazilianPhone` (write-side): use this * on the read side when you can't be sure which shape the DB has. * * phoneLookupCandidates('11988887777') * // → ['11988887777', '5511988887777'] * * phoneLookupCandidates('554896967308') * // → ['554896967308', '96967308', '5548996967308'] * * Try each returned candidate against your table in order — the first hit * is the row. Idiomatic use: * * for (const candidate of phoneLookupCandidates(input)) { * const row = await db.select().from(users).where(eq(users.phone, candidate)).limit(1); * if (row[0]) return row[0]; * } */ export declare function phoneLookupCandidates(input: string | null | undefined): string[]; /** * Human-friendly display: `+55 11 98765-4321` (mobile) or `+55 11 3333-4444` * (fixed line). Falls back to `+` for unknown shapes. */ export declare function formatBrazilianPhone(input: string | null | undefined): string; //# sourceMappingURL=phone_br.d.ts.map