@adyen/kyc-components
Version:
`adyen-kyc-components` provides the required pieces to build an onboarding flow based on a legal entity. To onboard and verify users, you need to create a user interface (UI) to collect user data. To speed up building your integration, Adyen offers onboar
47 lines (45 loc) • 1.79 kB
TypeScript
import type { CountryCode } from '../core/models/country-code';
import type { CustomTranslations, TranslationItem, TranslationKey, Translations } from './types';
/**
* Matches a string with one of the locales
* @example
* matchLocale('en-GB');
* // 'en-US'
*/
export declare const matchLocale: (locale: string, supportedLocales: string[]) => string | null;
/**
* Returns a locale with the proper format
*
* @example
* formatLocale('En_us');
* // 'en-US'
*/
export declare function formatLocale(localeParam: string): string | null;
/**
* Checks the locale format.
* Also checks if it's on the locales array.
* If it is not, tries to match it with one.
*/
export declare function parseLocale(locale: string, supportedLocales?: string[]): string | null;
/**
* Formats the locales inside the customTranslations object against the supportedLocales
*/
export declare const formatCustomTranslations: (supportedLocales: string[], customTranslations?: CustomTranslations) => CustomTranslations;
export declare const replaceTranslationValues: (translation: string, values?: Record<string, string | number>) => string;
export interface GetTranslationOptions {
localizeFor?: CountryCode;
values?: Record<string, string | number>;
}
/**
* Returns a translation string by key
*/
export declare const getTranslationByKey: (translations: Translations, key: TranslationKey, options?: GetTranslationOptions) => TranslationItem | null;
export declare const getTranslationKeysByPrefix: (translations: Translations, keyPrefix: string) => TranslationKey[];
/**
* Returns a LanguageCode from locale
* @param locale - The locale the user wants to use
*
* @example for getLanguageCode('en-US')
* // returns 'en'
*/
export declare const getLanguageCode: (locale: string) => string;