-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[CP Staging] add validate code modal #48628
Conversation
Thanks. Gonna pull this branch and test a few things locally. |
@marcaaron One of you needs to 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] |
@getusha I also replaced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking to test this also on the adhoc build
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
@marcaaron @hungvu193 I have tested this, and it works 🎉 not add recording because, duh, but the validation seems to pass for any validation code now. Is that expected for now? @marcaaron |
It's the same for Adding new contact method 🤔 we will always navigate back to contact method list after entering magic code, but not sure we should also do it here. |
Yep, to clarify, that's expected. We will switch it on in https://github.com/Expensify/Web-Secure/pull/2740 and be able to QA this properly before shipping the change. Then we can force users to upgrade to the next version around the same time as deploying Web-Secure. Since @getusha hasn't reviewed yet I'll go ahead and do the checklist on this one. |
I think we still need copy to be confirmed as well? Mentioned it here. I'll add a label to get some help with that. |
Reviewer Checklist
Screenshots/Videos |
@hungvu193 can you please make the changes requested by @mountiny? Thanks! |
And also the copy changes requested here. |
Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com>
Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com>
…93/App into feat/validate-code-modal
Sure. I've just addressed all the comments. |
Requested a translation on slack: |
Let's CP this one? |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
add validate code modal (cherry picked from commit aaa60b9) (CP triggered by mountiny)
validatePendingAction={pendingContactAction?.pendingFields?.actionVerified} | ||
validateError={validateLoginError} | ||
handleSubmitForm={addNewContactMethod} | ||
clearError={() => User.clearContactMethodErrors(contactMethod, 'validateLogin')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @hungvu193, If I register with a phone number, when I add a new contact method, this clearContactMethodErrors
will add a new record into the loginList
. Is this behavior intentional? (because the value of account.primaryLogin
is the phone number at that point.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait. I think I misunderstood the question. I'll need my laptop to take a look 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, What I'm confused about is: the new contact I actually wanted to add is 2471314+21@gmail.com
, but it seems that clearContactMethodErrors
unexpectedly added a record with +13393011884
to the loginList
. 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap that's pretty weird. I think it shouldn't add a new contact method into loginList but let me grab my laptop and see what I find.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to signup with phone number but I can't receive the magic code :( . Can you check the verbose to see where does that contact method come from? (Probably Pusher event).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test.mp4
App/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx
Lines 131 to 137 in b7c0055
useEffect(() => { | |
if (!validateError) { | |
return; | |
} | |
clearError(); | |
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps | |
}, [clearError, validateError]); |
App/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx
Lines 150 to 152 in b7c0055
validateError={validateLoginError} | |
handleSubmitForm={addNewContactMethod} | |
clearError={() => User.clearContactMethodErrors(contactMethod, 'validateLogin')} |
validateLoginError
is empty object, so when BaseValidateCodeForm
is mounted, clearError
(i.e., clearContactMethodErrors
) is automatically called. And because the value of contactMethod
(i.e., account.primaryLogin
) is +13393011884
, clearContactMethodErrors
adds that phone number to the loginList
instead of using the existing +13393011884@expensify.sms
key.
BTW, I don't have a phone number either, just generated some randomly with this url, and no magic code is required when signing up with a new phone number. 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So I think we should check _isEmpty(validateError)
instead of using !validateError
. We will fix it in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid that's not enough, clearError
is also called when the modal is closed.
Lines 285 to 288 in 8d645bf
/** | |
* Clears any possible stored errors for a specific field on a contact method | |
*/ | |
function clearContactMethodErrors(contactMethod: string, fieldName: string) { |
Perhaps we need to ensure that the
contactMethod
string contains the SMS domain.account.primaryLogin
is just a phone number +13393011884
, while the correct key in loginList
is +13393011884@expensify.sms
.We have a function
addSMSDomainIfPhoneNumber
that might help, which can add the SMS domain to the phone number. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your advice 💯 . I'll keep that in mind.
This issue was missed while implementing the feature. Issue: Copilot - Clicking outside magic code RHP does not dismiss the RHP entirely Steps to reprodue:
|
We recently need a reusable component to verify the magic code, this PR introduces
ValidateCodeActionModal
which is a modal that includes a magic code input that can be reused between flows.Details
Fixed Issues
$ #48541
PROPOSAL: N/A
Tests
For Card reveal details:
Prerequisite: Your account has an Expensify physical card setup
Reveal details
button.For adding new contact method:
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop