import { type PhoneNumber } from 'libphonenumber-js'; /** * Parse phone number to E.164 format. * This method will add a leading `+` sign if the phone number does not start with it. */ export declare const parseE164Number: (phone: string) => string; /** * Parse phone number to number string. * This method will strip the: * - leading `+` sign of the country code if any, * - the leading `0` of the phone number if any, * - non-digit characters if any. * * @params phone - The phone number to parse. * @params throwError - If true, throw an error if the phone number is invalid. Otherwise, return the original phone number. * * @example * +1 (650) 253-0000 -> 16502530000 * * @example * +61 0412 345 678 -> 61412345678 */ export declare const parsePhoneNumber: (phone: string, throwError?: true) => string; /** * Parse phone number to readable international format. * E.g. 16502530000 -> +1 650 253 0000 */ export declare const formatToInternationalPhoneNumber: (phone: string) => string; export declare class PhoneNumberParser { #private; private readonly phone; static parse(phone: string): PhoneNumber; constructor(phone: string); get raw(): string; get isValid(): boolean; get countryCode(): import("libphonenumber-js").CountryCallingCode | undefined; /** * Local number without country code. */ get nationalNumber(): import("libphonenumber-js").NationalNumber | undefined; /** * Formatted international number. With * - leading `+` sign stripped, * - leading `0` of the phone number stripped, * - non-digit characters stripped. * * @remarks * Logto use this format to store phone number in the database. * * @example * +1 (650) 253-0000 -> 16502530000 */ get internationalNumber(): string | undefined; /** * Formatted international number with leading `0` of the phone number. * * @example * 61 412 345 678 -> 610412345678 * * @remarks * In some countries, local phone numbers are often entered with a leading '0'. * However, in the international format that includes the country code, this leading '0' should be removed. * * The previous implementation did not handle this correctly, causing the combination of country code + 0 + local number * to be treated as different from country code + local number in the Logto system. * * Both formats should be considered the same phone number. * * We use this format to find the legacy phone number in the database incase the user registered the phone number with leading `0`. */ get internationalNumberWithLeadingZero(): string | undefined; }