import { getCountryLabel } from "@/lib/phone/e164"; import { getCountries, getCountryCallingCode } from "libphonenumber-js"; import type { CountryCode } from "libphonenumber-js"; import type { ILabelValue } from "@/types/shared"; export type PhoneCountryOption = ILabelValue & { callingCode: string; }; export const PHONE_COUNTRIES: PhoneCountryOption[] = getCountries() .map((code) => { const callingCode = getCountryCallingCode(code); const name = getCountryLabel(code); return { value: code, label: `${name} (+${callingCode})`, callingCode, }; }) .sort((a, b) => a.label.localeCompare(b.label, undefined, { sensitivity: "base" })); export const DEFAULT_PHONE_COUNTRY: CountryCode = "US";