Skip to content

Hide non-applicable Profile sections for agent accounts #90247

@puneetlath

Description

@puneetlath

Part of the Custom workflow agents project

Main issue: https://github.com/Expensify/Expensify/issues/614622
Doc section: https://expensify.enterprise.slack.com/docs/T03SC9DTT/F0AKV1FPD41?focus_section_id=temp:C:PDZf756705845f1464c9cffffcb8

Feature Description

When the owner co-pilots into an agent account, several Profile sub-sections do not make sense for a bot account and should be hidden or made read-only.

Scope:

  1. Add a shared helper that identifies agent accounts by their email pattern, since this check is reused across the R2 work:
    • isAgentEmail(email) — returns true when email matches /^agent_\d+@expensify\.ai$/.
    • useIsAgentAccount() — returns isAgentEmail(session?.email).
    • Add both to src/libs/SessionUtils.ts.
  2. In src/pages/settings/Profile/ProfilePage.tsx, when isAgentAccount is true:
    • Render the contact method inside the Profile card as a plain MenuItemWithTopDescription with no onPress and no shouldShowRightIcon (read-only label).
    • Hide the standalone Contact methods menu item that navigates to the full contact-methods management page.
    • Exclude the entire Private section (legal name, DOB, phone, address).

Out of scope: The new AI Prompt card itself is covered by #90244.

Manual Test Steps

Can be tested with an agent account created via the Release 1 flow.

  1. As the agent owner, copilot into the agent account.
  2. Go to Account > Profile.
  3. Verify the contact method is shown in the Profile card as a read-only label (no chevron, not tappable).
  4. Verify the standalone Contact methods menu item is not present.
  5. Verify the Private section (legal name, DOB, phone, address) is not rendered.
  6. Return to the owner account and confirm that Account > Profile still shows the contact methods item, the Private section, and a tappable contact method (i.e. the gating only applies to agent accounts).

Automated Tests

  • Unit tests for isAgentEmail covering matching, non-matching, and empty/undefined inputs.
  • A ProfilePage test that asserts the contact-methods menu item and Private section render for a non-agent account and do not render for an agent account.
Issue OwnerCurrent Issue Owner: @NicolasBonet

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions