@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
23 lines (22 loc) • 990 B
TypeScript
import { CountryCode } from 'libphonenumber-js/min';
export type PhoneNumberCountryCode = CountryCode;
export type PhoneNumberCountry = {
callingCode: string;
code: PhoneNumberCountryCode;
flag: string;
label: string;
};
export type PhoneNumberValue = {
country: PhoneNumberCountryCode;
display: string;
e164?: string;
isValid: boolean;
};
export type PhoneNumberAdapter = {
format: (value: string, country: PhoneNumberCountryCode) => string;
getCountry: (value: string) => PhoneNumberCountryCode | undefined;
normalize: (value: string, country: PhoneNumberCountryCode) => string | undefined;
};
export declare const defaultPhoneNumberAdapter: PhoneNumberAdapter;
export declare function createPhoneNumberValue(value: string, country: PhoneNumberCountryCode, adapter?: PhoneNumberAdapter): PhoneNumberValue;
export declare function getPhoneNumberCountries(locale?: string, countryCodes?: readonly PhoneNumberCountryCode[]): PhoneNumberCountry[];