* fix: add phone mask overrides for Argentina and Finland to prevent digit truncation Co-Authored-By: susan <susan@cal.com> * refactor: extract CUSTOM_PHONE_MASKS to shared module to avoid duplication Address review feedback from cubic-dev-ai: extract CUSTOM_PHONE_MASKS into a shared phone-masks.ts module so both PhoneInput.tsx and the test file import from the same source of truth instead of duplicating the masks. Also fix non-null assertion lint warning in the test file. Original PR by devin-ai-integration[bot]. Co-Authored-By: bot_apk <apk@cognition.ai> * fix: move custom message to expect() for toBeGreaterThanOrEqual type compatibility toBeGreaterThanOrEqual only accepts 1 argument. Move the custom error message to the expect() call instead. Co-Authored-By: bot_apk <apk@cognition.ai> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: susan <susan@cal.com> Co-authored-by: bot_apk <apk@cognition.ai> Co-authored-by: Eunjae Lee <hey@eunjae.dev> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
21 lines
865 B
TypeScript
21 lines
865 B
TypeScript
/**
|
|
* Custom phone masks to override outdated masks in react-phone-input-2.
|
|
* The library's built-in masks can lag behind countries' numbering plan changes,
|
|
* causing valid phone numbers to be truncated (users can't type enough digits).
|
|
*
|
|
* Each dot (.) represents a digit placeholder. When a country updates its
|
|
* numbering plan to use longer numbers, add an override here.
|
|
*/
|
|
export const CUSTOM_PHONE_MASKS = {
|
|
/** Ivory Coast: migrated from 8 to 10 digits in 2021 */
|
|
ci: ".. .. .. .. ..",
|
|
/** Benin: migrated from 8 to 10 digits in 2025 */
|
|
bj: ".. .. .. .. ..",
|
|
/** Austria: variable-length numbers up to 13 digits */
|
|
at: "... ..........",
|
|
/** Argentina: mobile numbers require 11 national digits (9 + area code + subscriber) */
|
|
ar: "(..) .........",
|
|
/** Finland: some mobile numbers use 10 national digits */
|
|
fi: ".. ... .. ...",
|
|
};
|