Accept US territory phone numbers in wallet phone validation#82695
Accept US territory phone numbers in wallet phone validation#82695AndrewGable merged 5 commits intomainfrom
Conversation
The isValidUSPhone function previously required region code to be exactly 'US', which rejected valid phone numbers from US territories that share the +1 country code but have their own ISO region codes (e.g., PR for Puerto Rico, GU for Guam). This caused users in Puerto Rico to see "Please enter a complete phone number" errors when trying to add their phone for bank account verification. Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
…n Split.ts The isLastTransactionInReport block referenced bare optimisticData, successData, and failureData variables which don't exist in the updateSplitTransactions scope. Changed to onyxData.optimisticData?, onyxData.successData?, and onyxData.failureData? to match the existing pattern in this function. Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@MelvinBot upate Also update tests to remove the bits in parenthesis in the test description, eg, |
- Add AS (American Samoa) and MP (Northern Mariana Islands) to CONST.COUNTRY in src/CONST/index.ts - Update validUSRegionCodes to use CONST.COUNTRY.AS and CONST.COUNTRY.MP instead of string literals - Remove parenthesized area codes from test descriptions Co-authored-by: Carlos Alvarez <cead22@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
The array's element type was inferred as a narrow union of string literals from CONST.COUNTRY, causing Array.includes() to reject the generic string from parsedPhoneNumber.regionCode. Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
|
@MelvinBot please mark this PR ready for review |
|
@Krishna2323 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done — PR has been marked as ready for review. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-02-20.at.12.15.42.AM.movAndroid: mWeb ChromeScreen.Recording.2026-02-20.at.12.16.54.AM.moviOS: HybridAppScreen.Recording.2026-02-20.at.12.18.59.AM.moviOS: mWeb SafariScreen.Recording.2026-02-20.at.12.20.09.AM.movMacOS: Chrome / SafariScreen.Recording.2026-02-20.at.12.09.46.AM.mov |
|
@Krishna2323 sorry for the ping, I'll take care of the C+ review for it. |
eh2077
left a comment
There was a problem hiding this comment.
Looks good and works well!
|
🚧 @AndrewGable has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/AndrewGable in version: 9.3.24-1 🚀
|
|
@cead22 @AndrewGable @Krishna2323 @heyjennahay this PR is failing with #83090 |
|
Please disregard the previous comment. The testers got a bit mixed up with the steps. I've already sorted this out and closed the issue. |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.3.24-3 🚀
|
Explanation of Change
This change updates
isValidUSPhoneto accept region codes for US territories (PR,GU,VI,AS,MP) in addition toUS.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/599685
PROPOSAL: https://github.com/Expensify/Expensify/issues/599685#issuecomment-3900380030
Tests
Unit tests are added to verify the fix works for all US territory area codes and that non-US countries (e.g., Canada, UK) are still correctly rejected.
Manual:
+17873464732)+12018675309)+14165551234)Offline tests
N/A — phone number validation is a client-side synchronous check that does not depend on network state.
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — no UI changes, validation logic only
Android: mWeb Chrome
N/A — no UI changes, validation logic only
iOS: Native
N/A — no UI changes, validation logic only
iOS: mWeb Safari
N/A — no UI changes, validation logic only
MacOS: Chrome / Safari
N/A — no UI changes, validation logic only