-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds generalized validator PhoneNumberValidator
#5999
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Deploy Preview for care-egov-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@rithviknishad this PR looks good, but the front-end validation needs an enhancement, so conditionally approving it -> Invalid input's post-submission getting rejected without error message |
@rithviknishad We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us 🥇. We always welcome your contribution 🙂, so feel free to contribute to anything anytime, and never lose that spirit of innovation 🙌. |
WHAT
🤖 Generated by Copilot at abbed90
Added a new feature to support different types of phone numbers in the application. Modified the
PhoneNumberFormField
component to accept atypes
prop and validate the input accordingly. Updated various components that use thePhoneNumberFormField
component to pass thetypes
prop. Refactored thePhoneNumberValidator
andSupportPhoneNumberValidator
functions to use dynamic regular expressions based on the phone number types.Proposed Changes
Allowed phone number types in each phone number fields
@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers
Merge Checklist
HOW
🤖 Generated by Copilot at abbed90
types
prop to thePhoneNumberFormField
component to specify the valid types of phone numbers that can be entered in the field (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)PhoneNumberValidator
andSupportPhoneNumberValidator
functions inFieldValidators.tsx
to use aPhoneNumberType
type and aPHONE_NUMBER_REGEX_MAP
object to dynamically generate regular expressions based on the types of phone numbers passed as arguments (link)validator
variable using theuseMemo
hook in thePhoneNumberFormField
component to use thePhoneNumberValidator
function with thetypes
prop as an argument (link)AnyValidator
function with thevalidator
variable in thePhoneNumberFormField
component to allow for more flexibility and specificity in validating phone numbers (link)setValue
function in thePhoneNumberFormField
component to replace all non-digit and non-plus characters in the phone number input with empty strings (link)labelSuffix
prop to theFormField
component in thePhoneNumberFormField
component to render icons and tooltips for different types of phone numbers using thePhoneNumberTypesHelp
component (link)phoneNumberTypeIcons
andPhoneNumberTypesHelp
constants to thePhoneNumberFormField
component to mapPhoneNumberType
values to icon names and render icons and tooltips using theCareIcon
andtooltip
components (link)PhoneNumberType
type and theCareIcon
component in thePhoneNumberFormField
component to define thetypes
prop and display icons for different types of phone numbers (link)fieldProps
function in theUserAdd
component to use theas any
type assertion to access thestate.form
andstate.errors
objects using thename
parameter as a key, to resolve a TypeScript error caused by thename
parameter being a union type of string literals (link)