import { getCountries, getCountryCallingCode, } from 'libphonenumber-js/min'; import { CountryDialCode } from '../models/country-dial-code.model'; const countryNames = new Intl.DisplayNames(['en'], { type: 'region' }); /** * Country names and calling codes are derived from libphonenumber-js metadata * and the runtime's ISO region names rather than maintained as a local list. */ export const COUNTRY_DIAL_CODES: CountryDialCode[] = getCountries() .map((code) => ({ code, name: countryNames.of(code) ?? code, dialCode: `+${getCountryCallingCode(code)}`, })) .sort((first, second) => first.name.localeCompare(second.name));