import { Currency } from '../currency/types'; import 'reflect-metadata'; import { Countries, Country, CountryCode } from './types'; export * from './types'; /** * Class representing a collection of countries with their associated properties. * * @example * ```typescript * CountryRegistry.setCountry({ * code: 'US', * dialCode: '+1', * phoneNumberExample: '(123) 456-7890', * flag: 'πŸ‡ΊπŸ‡Έ' * }); * * const usCountry = CountryRegistry.getCountry('US'); * console.log(usCountry); // { code: 'US', dialCode: '+1', phoneNumberExample: '(123) 456-7890', flag: 'πŸ‡ΊπŸ‡Έ' } * ``` */ export declare class CountryRegistry { private static readonly registryMetaData; private static get registry(); private static set registry(value); /** * Checks if a given country object is valid. * * A country object is considered valid if it is an object and has a non-null string code. * * @param {Country} country The country object to check. * @returns {boolean} True if the country object is valid, false otherwise. * * @example * ```typescript * const country: Country = { * code: 'US', * dialCode: '+1', * phoneNumberExample: '(123) 456-7890', * flag: 'πŸ‡ΊπŸ‡Έ' * }; * console.log(CountryRegistry.isValid(country)); // true * ``` */ static isValid(country: unknown): country is Country; /** * Gets the phone number example for a given country code. * * @param {CountryCode} code The country code. * @returns {string} The phone number example for the given country code, or an empty string if the country code is not found. * * @example * ```typescript * console.log(CountryRegistry.getPhoneNumberExample('US')); // '(123) 456-7890' * ``` */ static getPhoneNumberExample(code: CountryCode): string; /** * Gets the flag for a given country code. * * @param {CountryCode} code The country code. * @returns {string} The flag for the given country code, or an empty string if the country code is not found. * * @example * ```typescript * console.log(CountryRegistry.getFlag('US')); // 'πŸ‡ΊπŸ‡Έ' * ``` */ static getFlag(code: CountryCode): string; /** * Gets the currency for a given country code. * * @param {CountryCode} code The country code. * @returns {Currency | undefined} The currency for the given country code, or undefined if the country code is not found. * * @example * ```typescript * console.log(CountryRegistry.getCurrency('US')); // { code: 'USD', symbol: '$' } * ``` */ static getCurrency(code: CountryCode): Currency | undefined; /** * Sets a country object in the internal record. * * The country object must be valid (i.e., it must be an object with a non-null string code). * * @param {Country} country The country object to set. * * @example * ```typescript * CountryRegistry.setCountry({ * code: 'US', * dialCode: '+1', * phoneNumberExample: '(123) 456-7890', * flag: 'πŸ‡ΊπŸ‡Έ' * }); * ``` */ static setCountry(country: Country): void; /** * Retrieves a country object by its country code. * * If the provided code is not a non-null string, it returns undefined. * * @param {CountryCode} code The country code to look up. * @returns {Country | undefined} The country object associated with the given code, or undefined if not found. * * @example * ```typescript * i18n.registerTranslations({ * fr : { * countries : { * US : {name : 'Etats Unis'} * }, * en : { * countries : {name:'United States'} * } * } * }) * const country = CountryRegistry.getCountry('US'); * console.log(country); // { code: 'US', dialCode: '+1', phoneNumberExample: '(123) 456-7890', flag: 'πŸ‡ΊπŸ‡Έ' } * ``` */ static getCountry(code: CountryCode): Country | undefined; /** * Retrieves all countries stored in the internal record. * * @returns {Countries} A record of all countries, where each key is a country code and each value is an Country object. * * @example * ```typescript * const allCountries = CountryRegistry.getCountries(); * console.log(allCountries); // { 'US': { code: 'US', ... }, ... } * ``` */ static getCountries(): Countries; /** * Sets multiple countries in the internal record. * * This method merges the provided countries with the existing ones in the internal record. * * If the provided countries object is not an object, it returns the current internal record of countries. * * @param {Partial} countries A partial record of countries to set. * @returns {void} * * @example * ```typescript * CountryRegistry.setCountries({ * 'US': { * code: 'US', * dialCode: '+1', * phoneNumberExample: '(123) 456-7890', * flag: 'πŸ‡ΊπŸ‡Έ' * }, * 'CA': { * code: 'CA', * dialCode: '+1', * phoneNumberExample: '(123) 456-7890', * flag: 'πŸ‡¨πŸ‡¦' * } * }); * ``` */ static setCountries(countries: Partial<{ [key in CountryCode]: Country; }>): void; }