Skip to content

Frontend: Private Domain Onboarding Check #54186

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 73 commits into from
Apr 16, 2025

Conversation

allgandalf
Copy link
Contributor

@allgandalf allgandalf commented Dec 16, 2024

Explanation of Change

Check whether public domain and SMS sign-ups have a work email in the New Expensify onboarding flow. If they’re new accounts, we'll merge them, and if the work email is tied to an existing account, we’ll redirect them to OldDot.

Fixed Issues

$ #54075
PROPOSAL: N/A

Tests

Same as QA

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Test Scenarios

1. Add Private Domain When Account Doesn’t Already Exist (Scenario A)

  • Login:

    • Login to Expensify using a public domain email address (e.g. Gmail).
  • Onboarding Modal:

    • Verify the modal appears with the screen asking: “What’s your work email?”
    • Verify the input field is auto-focused on web and desktop but not on mobile platforms.
    • Verify you can type into the input field.
  • Entering Email:

    • Type a public domain email address into the input field.
    • Verify the modal displays an error message stating: “Please enter a valid work email from a private domain.”
  • Adding Work Email:

    • Enter a valid private domain email address that is not connected to an existing account.
    • Click "Add work email".
    • Verify that the onboarding process continues.
  • Post-Onboarding Verification:

    • Navigate to Settings > Profile > Contact Method.
    • Verify that both the private domain and the public domain email addresses are listed as contact methods.
    • Verify that the private domain email is set as the primary contact method (it should be the email displayed under the username in the top left corner of the settings screen).

2. Add Private Domain When Account Already Exist (Scenario B)

  • Initial Account Setup:

    • Create an Expensify account using a private domain email address (e.g. [email protected]), validate it, then log out.
    • Create a new account using a public domain email address (e.g. Gmail).
  • Onboarding Modal:

    • Verify the onboarding modal appears with the screen asking: “What’s your work email?”
    • Verify the input field is auto-focused on web and desktop but not on mobile platforms.
    • Verify you can type into the input field.
  • Linking Existing Private Domain:

    • Enter the private domain email address that was used to create the initial account.
    • Click "Add work email".
    • Verify that the screen transitions to a validate code screen.
    • Verify that you receive an email with the validation code.
    • Enter the validation code and click "verify".
    • Verify that the onboarding process continues, with the next screen displaying: “What do you want to do today?”
  • Post-Onboarding Verification:

    • Navigate to Settings > Profile > Contact Method.
    • Verify that both the private domain and the public domain email addresses are listed as contact methods.
    • Verify that the private domain email is set as the primary contact method (it should be the email displayed under the username in the top left corner of the settings screen).

3. Don’t Ask for Work Email if Domain Is Private

  • Account Creation:

    • Create an Expensify account using a private domain email address.
  • Verification:

    • Verify that the onboarding modal does not display a screen asking: “What’s your work email?”
  • 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
Android: mWeb Chrome
iOS: Native
Screen.Recording.2025-04-09.at.1.22.02.PM.mov
iOS: mWeb Safari
Screen.Recording.2025-04-09.at.1.23.55.PM.mov
Screen.Recording.2025-04-09.at.1.29.22.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2025-04-09.at.12.41.21.PM.mov
MacOS: Desktop

@allgandalf allgandalf changed the title Frontend: Private Domain Onboarding Check [HOLD Pending BE API] Frontend: Private Domain Onboarding Check Dec 27, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@allgandalf allgandalf changed the title [HOLD Pending BE API] Frontend: Private Domain Onboarding Check Frontend: Private Domain Onboarding Check Jan 14, 2025
@ikevin127
Copy link
Contributor

@blimpich 🟢 Issue was fixed, latest testing looks good 👍

Screen.Recording.2025-04-14.at.20.57.52.mov

⚠️ However this other issue (end of comment) is still present and should be addressed before merging the PR.

@allgandalf
Copy link
Contributor Author

@allgandalf While testing this I found another, what looks like a FE issue:

Steps: Follow the 2. Add Private Domain When Account Already Exist (Scenario B) steps, but instead of adding the magic code to validate, go back and press on the Add work email button once again and notice how nothing happens flow-wise except for button loading state and AddWorkEmail being called.

@ikevin127 , this is a BE issue, for the second time the BE returns empty object for onyx data:

{"jsonCode":200,"requestID":"93095480dd724483-SJC","onyxData":[]}
Screen.Recording.2025-04-15.at.11.49.02.AM.mov

We need to know the shouldValidate value each time so that we navigate to the correct page.

@blimpich the request id for the first request was : 9309544efd23ff7b-BOM

And for the second request was: 93095480dd724483-SJC

I honestly think what kevin found is a edge case and can be dealt in a follow up BE PR without blocking this one. the core flow works here, what do you guys think ?

@allgandalf
Copy link
Contributor Author

@blimpich with the latest backend update, the previous issue was resolved, onboarding is completed successfully , the looks good to be merged !

@blimpich
Copy link
Contributor

blimpich commented Apr 15, 2025

Yeah I agree. The main flows work here. This is a huge PR, lets deal with other edge case issues / bugs as follow up. I think this is ready to merge 👍. @allgandalf can you fix the latest merge conflict and then I'll approve and merge?

@blimpich
Copy link
Contributor

It was a trivially simple merge conflict to resolve so I just resolved it myself. Once this goes green lets merge!

@blimpich
Copy link
Contributor

Ugh, linting changed as a result of merging in the latest main. Will let @allgandalf handle that.

blimpich
blimpich previously approved these changes Apr 15, 2025
@allgandalf
Copy link
Contributor Author

@blimpich extremely sorry but i cannot access laptop till tomorrow, i checked slack and perhaps this rule was newly added https://expensify.enterprise.slack.com/archives/C01GTK53T8Q/p1744735887734139, i think merging this as is wont break main as this affects changed file only, so i guess we can still merge this without breaking main, else i will take a look at it tomorrow

@blimpich
Copy link
Contributor

All good @allgandalf! One more day won't hurt us 🙂. We could probably merge but lets just wait till you can update the code to meet the new linter requirements and get a full green build.

@allgandalf
Copy link
Contributor Author

allgandalf commented Apr 16, 2025

hmm, since there is no clear instructions on how to resolve this till now, I went through the PR which introduced the rule and it mentioned that most of the calls would be set to true:

Following the same appoarch here, since it was also done at other places:

https://github.com/search?q=repo%3AExpensify%2FApp%20canBeMissing&type=code in ReimbursementAccountPage and MoneyRequestView

Update: Okay made some more sense to me now, this should work!

Copy link
Contributor

@blimpich blimpich left a comment

Choose a reason for hiding this comment

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

WOOOOOOHHOOOO LETS MERGE!!!! 🎉

@blimpich blimpich merged commit e0f7cc0 into Expensify:main Apr 16, 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/blimpich in version: 9.1.29-0 🚀

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

Copy link
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.1.29-10 🚀

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

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.

4 participants