Skip to content

migrate AccountType step to FormProvider #56464

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

Merged
merged 13 commits into from
Mar 20, 2025
Merged

Conversation

mkzie2
Copy link
Contributor

@mkzie2 mkzie2 commented Feb 6, 2025

Explanation of Change

migrate AccountType step to FormProvider

Fixed Issues

$ #55688
PROPOSAL: #55688 (comment)

Tests

Precondition: Enable newDotInternationalDepositBankAccount beta

  • Account type step
  1. Go to Account settings > Wallet
  2. Click Add bank account
  3. Select any country other than US
  4. Enter info and reach confirmation page
  5. Verify in account type step, the Confirm button shows at the bottom
  6. On confirmation page, Select the terms checkbox
  7. Click the account type selector row
  8. Verify in account type step, the Confirm button does NOT show at the bottom
  9. Change the account type
  10. Verify the terms checkbox remains selected
  • Test for ValuePicker
  1. Go FAB > Start chat > Room
  2. Click on the Workspace/Who can post/Visibility field
  3. Verify that a selector modal is displayed and the value is updated after we select a value
  4. Go FAB > Create expense > Per diem
  5. In the subRate step, click on the sub rate field
  6. Verify that a selector modal is displayed and the value is updated after we select a value

Offline tests

Same

QA Steps

Precondition: Enable newDotInternationalDepositBankAccount beta

  • Test for ValuePicker
  1. Go to Account settings > Wallet
  2. Click Add bank account
  3. Select any country other than US
  4. Enter info and reach confirmation page
  5. On confirmation page, Select the terms checkbox
  6. Click the account type selector row
  7. Change the account type and Confirm
  • Test for ValuePicker
  1. Go FAB > Start chat > Room
  2. Click on the Workspace/Who can post/Visibility field
  3. Verify that a selector modal is displayed and the value is updated after we select a value
  4. Go FAB > Create expense > Per diem
  5. In the subRate step, click on the sub rate field
  6. Verify that a selector modal is displayed and the value is updated after we select a value
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2025-02-18.at.17.31.02.mov
Android: mWeb Chrome
Screen.Recording.2025-02-18.at.17.26.00.mov
iOS: Native
Screen.Recording.2025-02-18.at.17.32.45.mov
iOS: mWeb Safari
Screen.Recording.2025-02-18.at.17.28.35.mov
MacOS: Chrome / Safari
Screen.Recording.2025-02-18.at.17.23.22.mov
Screen.Recording.2025-02-20.at.23.23.19.mov
Screen.Recording.2025-02-20.at.23.25.01.mov
MacOS: Desktop
Screen.Recording.2025-02-18.at.17.35.46.mov

@mkzie2 mkzie2 marked this pull request as ready for review February 6, 2025 14:04
@mkzie2 mkzie2 requested a review from a team as a code owner February 6, 2025 14:04
@melvin-bot melvin-bot bot requested review from dominictb and removed request for a team February 6, 2025 14:04
Copy link

melvin-bot bot commented Feb 6, 2025

@dominictb 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]

@dominictb
Copy link
Contributor

@mkzie2 Seems like we have an extra step here:

Screenshot 2025-02-10 at 04 08 21

Can you think of any way to eliminate it?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 10, 2025

@dominictb This is the same step like we did for the type business step in connect US bank account flow or some others that use FormProvider. cc @cead22 Can you check the comment above and verify if it's acceptable behavior.

@cead22
Copy link
Contributor

cead22 commented Feb 10, 2025

I'm not sure what you're asking, can you elaborate?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 11, 2025

I'm not sure what you're asking, can you elaborate?

@cead22

  1. Here is the current behavior on the Account type step, the selector is displayed
Screenshot 2025-02-11 at 15 56 25
  1. Here is the behavior of the account type step that I implemented in this PR. It includes a menu item, which we click to select the account type. This behavior is the same as that of other steps, like TypeBusiness in the US bank account flow.
Screen.Recording.2025-02-11.at.15.57.27.mov

Do you agree with the behavior in this PR (Option 2)?

@dominictb
Copy link
Contributor

@cead22 Can you confirm the final expectation?

@dominictb
Copy link
Contributor

@cead22 Friendly bump

@cead22
Copy link
Contributor

cead22 commented Feb 13, 2025

Hmmm, I've seen list pages where you select an option and still have to click the green button to "accept" it. But if you say we're doing what you showed on the video above in other places, specially if those places are part of this flow, then I think that's fine

@shubham1206agra
Copy link
Contributor

@joekaufmanexpensify I don't think extra step is allowed here. cc @Expensify/design to confirm this.

cc @dominictb

@shawnborton
Copy link
Contributor

Hmm I feel like we've gone back and forth on this one... I don't know that we ever settled on an official rule for every single flow, cc @Expensify/design for thoughts

The original thinking for having a green confirm button at the bottom of these flows was that if you were inside of a stepper flow (with multiple steps...) it might feel nicer to always show a green button at the bottom so you had consistency between pages. But I think we've also kinda walked back on that and we've found examples of where it feels a little cumbersome (like the onboarding modal) where we would prefer not to need the green confirm button on list selections.

However, if you access a list selection via a push row, we never use a green confirmation button. That's something we've been consistent with for a long time I think.

I'm not sure if that is helpful or not, but that's the backstory AFAIK.

@dannymcclain
Copy link
Contributor

I agree with everything Shawn said, but I'm not sure that gets us closer to a decision haha.

However, if you access a list selection via a push row, we never use a green confirmation button. That's something we've been consistent with for a long time I think.

This pattern does kinda seem to apply here though?

@shawnborton
Copy link
Contributor

Yeah it's basically here that we're at a crossroads:
CleanShot 2025-02-14 at 09 06 12@2x

I think as long as you have a way to go back and change your decision, I would be fine removing the green button at the bottom. And I believe at the end of this flow you would see a confirmation screen that allows you to change the decision, so maybe we'd be good there.

We don't have that kind of confirmation for the onboarding modal though... but at the same time, I think we've had discussions about wanting to remove the extra click?

Curious what the other designers think though!

@dannymcclain
Copy link
Contributor

Yeah good point. I think the ability to change your decision after the fact makes it fine to remove this green button.

@joekaufmanexpensify
Copy link
Contributor

joekaufmanexpensify commented Feb 14, 2025

Hmm, based on this, it seems like we might be trying to add an additional push row for the account type. So you'd land on the page to select account type and then have another push row that brings you to where you actually make a selection (if I am understanding correctly). That seems redundant to me, and I agree with @shubham1206agra that we should have you select the account type from the top-level page, rather than forcing you down another level of navigation to select it.

How it works now is below. We added the Next/Confirm buttons at the bottom to maintain consistency in the entire flow. That's also how we've approached other flows I've worked on recently like assigning cards. I do kinda like having each step in the flow be consistent, but also not opposed to removing the next button in situations where you are just making one selection from a list.

But not a fan of adding an extra push row, like was being proposed here.

2025-02-14_10-20-54.mp4

@dannymcclain
Copy link
Contributor

Ah great context Joe. I'm on board with everything you said. Definitely agree about removing the unnecessary nested push row, and in a flow like this where most screens need a bottom button, it makes sense to me to just keep the whole form/flow using that pattern. And then if we do go that route, on the confirm screen, if you tap back into it, I'd be fine with keeping that screen the same as during the flow (and not removing the bottom button). Does that all make sense? Alternatively, we could keep the green button during the initial flow, but if you revisit from the confirm screen we could remove the bottom button and treat it like all our other push-row-to-select-list screens, just not sure that's entirely necessary.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 14, 2025

Thank for all informations, I will give an update soon.

@shawnborton
Copy link
Contributor

Cool, yeah I can totally get on board with all of that too Joe & Danny. So it sounds like... just keep doing things the way we've been doing them 🤣

@mkzie2
Copy link
Contributor Author

mkzie2 commented Feb 16, 2025

@dominictb Updated to remove the extra step.

@dubielzyk-expensify
Copy link
Contributor

Just chiming in to say that I think having the button at the bottom for consistency is the way to go here as well 👍

@dominictb
Copy link
Contributor

dominictb commented Feb 18, 2025

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
Screen.Recording.2025-02-18.at.16.45.29.mov
Android: mWeb Chrome
Screen.Recording.2025-02-18.at.16.39.36.mov
iOS: Native
Screen.Recording.2025-03-21.at.01.21.38.mov
Screen.Recording.2025-03-21.at.01.21.10.mov
Screen.Recording.2025-03-21.at.01.22.45-compressed.mov
iOS: mWeb Safari
Screen.Recording.2025-02-18.at.16.33.26.mov
MacOS: Chrome / Safari

Original Bug:

Screen.Recording.2025-03-21.at.01.12.19.mov

Only show Confirm button if not open from confirmation page:

Screen.Recording.2025-03-21.at.01.11.21.mov
Screen.Recording.2025-03-21.at.01.10.38.mov

Test for other ValuePicker:

Screen.Recording.2025-03-21.at.01.15.05.mov
MacOS: Desktop
Screen.Recording.2025-02-18.at.16.48.44.mov

@dominictb
Copy link
Contributor

@mkzie2 Please update the screenshots with the latest change.

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 15, 2025

@shawnborton Here is the correct result, right

Screen.Recording.2025-03-15.at.20.04.41.mov

@shawnborton
Copy link
Contributor

That looks correct to me, from the confirmation screen. Just want to make sure the stepped flow does include the confirmation button at the bottom though, when you are first doing the steps sequentially?

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 17, 2025

That looks correct to me, from the confirmation screen. Just want to make sure the stepped flow does include the confirmation button at the bottom though, when you are first doing the steps sequentially?

@shawnborton Yes, I did it.

Screen.Recording.2025-03-17.at.15.13.38.mov

@shawnborton
Copy link
Contributor

Awesome, thanks for confirming!

@cead22
Copy link
Contributor

cead22 commented Mar 17, 2025

@dominictb can you please give this another review and update at least one of the videos in the reviewer checklist to make sure it's all working as intended? Thanks

Copy link
Contributor

@dominictb dominictb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@dominictb
Copy link
Contributor

Reviewed again and updated videos.

@mkzie2 Please update your testing steps to include the Confirm button behavior.

cead22
cead22 previously approved these changes Mar 20, 2025
@cead22 cead22 self-assigned this Mar 20, 2025
@cead22 cead22 requested a review from luacmartins March 20, 2025 19:03
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Let's just address @cead22's comment

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 20, 2025

@dominictb Updated.

@mkzie2 mkzie2 requested a review from a team as a code owner March 20, 2025 19:18
Copy link
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@mkzie2
Copy link
Contributor Author

mkzie2 commented Mar 20, 2025

Oh I don't know what went wrong. Let me check.

@melvin-bot melvin-bot bot requested a review from cead22 March 20, 2025 19:27
@cead22 cead22 removed the request for review from a team March 20, 2025 20:00
@cead22 cead22 merged commit a1362bf into Expensify:main Mar 20, 2025
17 checks passed
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Copy link
Contributor

🚀 Deployed to staging by https://github.com/cead22 in version: 9.1.17-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 success ✅
🍎🔄 iOS HybridApp 🍎🔄 success ✅

Copy link
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.1.17-1 🚀

platform result
🤖 android 🤖 true ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅
🤖🔄 android HybridApp 🤖🔄 failure ❌
🍎🔄 iOS HybridApp 🍎🔄 failure ❌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants