Skip to content

Replace individual private detail edit pages with unified form + magic code#87928

Merged
rafecolton merged 42 commits into
mainfrom
jasper-securePrivatePersonalDetails
May 15, 2026
Merged

Replace individual private detail edit pages with unified form + magic code#87928
rafecolton merged 42 commits into
mainfrom
jasper-securePrivatePersonalDetails

Conversation

@jasperhuangg

@jasperhuangg jasperhuangg commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Replaces the four individual edit pages for private personal details (legal name, DOB, phone, address) with a single unified form that requires magic code verification when any field changes. This prevents session hijackers from silently modifying sensitive personal information.

New pages:

  • PrivatePersonalDetailsPage - Unified form showing all private detail fields, pre-populated from Onyx. Validates that previously-set fields aren't emptied. On submit, detects changes and navigates to magic code confirmation.
  • PrivatePersonalDetailsConfirmMagicCodePage - Uses ValidateCodeActionContent to collect a magic code, then calls updatePrivatePersonalDetails() to submit all changes in a single API call.

API changes:

  • New UPDATE_PRIVATE_PERSONAL_DETAILS write command with optimistic/success/failure data
  • New updatePrivatePersonalDetails() action in PersonalDetails.ts

Navigation changes:

  • ProfilePage updated so all four private detail rows navigate to the unified form
  • New routes, screens, linking config, and RHP relations registered

Depends on Auth PR and Web-Expensify PR.

Fixed Issues

part of https://github.com/Expensify/Expensify/issues/623849
PROPOSAL:

Tests

  1. Go to Settings > Profile
  2. Tap any of: Legal Name, Date of Birth, Phone Number, Address
  3. Verify you're taken to the new unified Private Personal Details form
  4. Verify all fields are pre-populated with your current data
  5. Without changing anything, tap Save — verify no magic code is required
  6. Change one or more fields, tap Save
  7. Verify you're navigated to the magic code page
  8. Enter a valid magic code
  9. Verify details are updated and you're navigated back
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline
  2. Navigate to the unified Private Personal Details form
  3. Verify the form loads with cached data from Onyx
  4. Make a change and submit
  5. Verify the optimistic update shows immediately
  6. Go back online and verify the update syncs

QA Steps

Same as Tests section above.

  • 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
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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.
  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • 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)
  • I verified that component 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)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each 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

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Made with Cursor

Adds the API plumbing for the new unified personal details update:
- UPDATE_PRIVATE_PERSONAL_DETAILS write command
- UpdatePrivatePersonalDetailsParams type (all personal detail fields +
  validateCode)
- updatePrivatePersonalDetails() action with optimistic/success/failure
  data that sets isLoading on PRIVATE_PERSONAL_DETAILS

Part of Expensify/Expensify#623849.

Made-with: Cursor
Registers two new screens in the Settings RHP:
- PRIVATE_PERSONAL_DETAILS: unified edit form for all private fields
- PRIVATE_PERSONAL_DETAILS_CONFIRM_MAGIC_CODE: magic code verification

Adds routes, screen constants, navigation param types, linking config,
and Settings-to-RHP relations.

Part of Expensify/Expensify#623849.

Made-with: Cursor
PrivatePersonalDetailsPage: single form with all private fields (legal
name, DOB, phone, address). Pre-populates from PRIVATE_PERSONAL_DETAILS,
validates that previously-set fields cannot be emptied, and navigates to
magic code confirmation when any field changes.

PrivatePersonalDetailsConfirmMagicCodePage: uses ValidateCodeActionContent
to collect a magic code, then calls updatePrivatePersonalDetails() to
submit all changes in a single validate-code-protected API call.

Part of Expensify/Expensify#623849.

Made-with: Cursor
All four private detail rows (legal name, DOB, phone, address) now
navigate to the unified PrivatePersonalDetailsPage instead of individual
edit pages. The individual pages are kept for backward compatibility with
deep links.

Part of Expensify/Expensify#623849.

Made-with: Cursor
@jasperhuangg jasperhuangg requested review from a team as code owners April 14, 2026 20:03
@melvin-bot melvin-bot Bot requested review from DylanDylann and removed request for a team April 14, 2026 20:03
@melvin-bot

melvin-bot Bot commented Apr 14, 2026

Copy link
Copy Markdown

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

@melvin-bot melvin-bot Bot requested review from trjExpensify and removed request for a team April 14, 2026 20:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a14d480bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/pages/settings/Profile/PersonalDetails/PrivatePersonalDetailsPage.tsx Outdated
@codecov

codecov Bot commented Apr 14, 2026

Copy link
Copy Markdown

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.

Files with missing lines Coverage Δ
src/SCREENS.ts 100.00% <ø> (ø)
src/libs/API/types.ts 100.00% <ø> (ø)
...igation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 76.92% <ø> (ø)
src/ROUTES.ts 17.63% <0.00%> (-0.02%) ⬇️
...gation/AppNavigator/ModalStackNavigators/index.tsx 6.78% <0.00%> (-0.02%) ⬇️
src/pages/settings/Profile/ProfilePage.tsx 94.94% <71.42%> (+5.52%) ⬆️
src/libs/PersonalDetailsUtils.ts 77.77% <0.00%> (-6.56%) ⬇️
src/libs/actions/PersonalDetails.ts 50.00% <0.00%> (-7.61%) ⬇️
...ils/PrivatePersonalDetailsConfirmMagicCodePage.tsx 0.00% <0.00%> (ø)
... and 1 more
... and 10 files with indirect coverage changes

Convert SETTINGS_PRIVATE_PERSONAL_DETAILS from a plain string to
an object with getRoute(fieldToFocus?) so callers can specify
which field to auto-focus when the form opens. Update the
linking config and navigation types accordingly.

Made-with: Cursor
Each private detail row in ProfilePage now passes its
corresponding INPUT_ID so the form auto-focuses the tapped
field: legal name, DOB, phone number, or address.

Made-with: Cursor
Read the fieldToFocus query param and set autoFocus on the
matching InputWrapper. For the DatePicker (DOB), autoFocus
triggers the calendar modal to open immediately.

Made-with: Cursor
After the private personal details update succeeds (isLoading
transitions from true to false with no errors), navigate back
to the Profile settings page instead of the intermediate form.

Made-with: Cursor
When the user edits fields but navigates away without submitting,
the draft values were persisted via shouldSaveDraft. Now we call
clearDraftValues on unmount so the form always resets to the
current saved values when reopened.

Made-with: Cursor
@jasperhuangg jasperhuangg marked this pull request as draft April 14, 2026 23:42
Check both privatePersonalDetails.errors and
validateCodeAction.errorFields before navigating back to
Profile. Invalid magic code errors are stored on the
validateCodeAction key, not privatePersonalDetails.

Made-with: Cursor
The server sets validate code errors on
PRIVATE_PERSONAL_DETAILS.errorFields.personalDetails via
Onyx::handleException, but the component was reading from
.errors which is never populated. Use getLatestErrorField to
read from the correct path so errors are displayed and the
success navigation doesn't fire on failure.

Made-with: Cursor
@jasperhuangg jasperhuangg changed the title Replace individual private detail edit pages with unified form + magic code [HOLD Web-Expensify#52112] Replace individual private detail edit pages with unified form + magic code Apr 15, 2026
@jasperhuangg

Copy link
Copy Markdown
Contributor Author

@MelvinBot pull main on this PR

…ersonalDetails

Co-authored-by: Jasper Huang <jasperhuangg@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor

Merged main into this branch. ✅

- Add 'Basic details' and 'Address' section headers with sectionTitle style
- Replace Country text input with CountrySelector picker component
- Add basicDetails translation key to all language files

Made-with: Cursor
@rafecolton

Copy link
Copy Markdown
Member

Pretty sure that's the standard inline flow that that Jasper is now using. If you open up the new personal details form and zoom out so it all fits on one screen, the button is pinned to the bottom like that:

Screenshot 2026-05-11 at 9 23 24 PM

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Can you make the height smaller. I just wanna see how it'll look on mobile. It should be fixed to the bottom there

@dannymcclain

Copy link
Copy Markdown
Contributor

Was just checking the Address form in private details and Add payment card form in subscription, and they both work the way this is currently implemented.

  • If the screen is long enough to create space between the form and the button, the button sticks to the footer
  • If the screen is too short, the button does not stick to the viewport bottom and instead just sits at the bottom of the form (beyond the scroll)
CleanShot.2026-05-12.at.07.57.04.mp4

Let's just stick with what we do elsewhere 👍

@shawnborton

Copy link
Copy Markdown
Contributor

Makes sense to me 👍

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Sure, I'm up for that.

The reason why I wanted it sticky was because all the other forms are forms where you have to fill the entire thing so it makes sense to have it at the end as you have to ensure it's all correct.

For this new for, you might just wanna set the name or dob or edit them so having the save button visible made most sense to me. But happy to go with the consistency even though the forms works slightly different. Not a big deal.

@rafecolton

Copy link
Copy Markdown
Member

@jasperhuangg I tried restarting the performance tests a couple times but they keep failing. I don't think it's related. Can you please try merging main?

@jasperhuangg

Copy link
Copy Markdown
Contributor Author

@MelvinBot pull main on this PR

…ersonalDetails

Co-authored-by: Jasper Huang <jasperhuangg@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor

Merged main into this branch. No conflicts.

@rafecolton rafecolton changed the title [HOLD Web-Expensify#52112] Replace individual private detail edit pages with unified form + magic code Replace individual private detail edit pages with unified form + magic code May 15, 2026
@rafecolton

Copy link
Copy Markdown
Member

Web PR is in prod now, this is good to merge

@rafecolton rafecolton merged commit b984e6b into main May 15, 2026
36 of 37 checks passed
@rafecolton rafecolton deleted the jasper-securePrivatePersonalDetails branch May 15, 2026 02:16
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @rafecolton has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
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.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/rafecolton in version: 9.3.74-7 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

Yes, help site changes are required. PR #87928 replaces the individual private detail edit pages with a unified form + magic code verification, which changes the documented user flow.

Draft PR created: #90803

Articles updated:

  • Account-Settings.md — Updated "Personal Information" and "Display or Legal Name" sections to describe the unified form and magic code step
  • Update-Your-Expensify-Card-Mailing-Address.md — Updated legal name and phone number update steps to include the magic code confirmation step

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/Beamanator in version: 9.3.74-7 🚀

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

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #90834 was identified to be related to this PR.

@Julesssss

Copy link
Copy Markdown
Contributor

Reverted due to regression: #90834

@IuliiaHerets

Copy link
Copy Markdown

Hi @jasperhuangg. Apps don't ask for a magic code when editing a field as step 7 asks.
Do we need to use a beta account to see a new UI?

cc @rafecolton @chuckdries @mjasikowski

26-ios.mp4

@chuckdries

Copy link
Copy Markdown
Contributor

@IuliiaHerets this PR was reverted, so the functionality described is not present in the app at this time

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.