App icon indicating copy to clipboard operation
App copied to clipboard

[$175] Expensify Card - Show cardholder email below card name on admin card details

Open MelvinBot opened this issue 2 weeks ago • 30 comments

Feature request

Show card admins the cardholder’s email address on the New Expensify Expensify Card details page, directly below Card name (the card nickname).

Current behavior

Admins can see the card nickname and the cardholder’s name, but there is no dedicated email field. A cardholder with a display name cannot be identified by email from this page.

Expected behavior

Add a read-only Cardholder email field immediately below Card name, visible regardless of whether the cardholder has a display name. Preserve the existing nickname and name display.

Technical assessment

Frontend-only; no backend change is required for this feature.

Use the cardholder’s existing login, not the display name or the viewing admin’s email. Handle loading or unavailable personal details gracefully; verify direct navigation as well as navigation from the card list.

Acceptance criteria

  • Admins see the cardholder’s email immediately below the nickname, both with and without a cardholder display name.
  • The field is read-only and works for physical and virtual Expensify Cards.
  • Long email addresses remain readable on narrow layouts.
  • Missing/loading personal details do not display an incorrect identity or cause a crash.
  • Include focused rendering coverage for the new field.

Slack thread: https://expensify.slack.com/archives/C03U7DCU4/p1794464270018709

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @grgia

MelvinBot avatar Nov 13 '26 22:11 MelvinBot

Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (External)

melvin-bot[bot] avatar Nov 13 '26 22:11 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022121369801529655549

melvin-bot[bot] avatar Nov 13 '26 22:11 melvin-bot[bot]

Proposal

What is the root cause of that problem?

DynamicWorkspaceExpensifyCardDetailsPage.tsx already resolves the cardholder with const [cardholder] = usePersonalDetail(card?.accountID), but only uses it for displayName (card image text) and cardholder?.timezone (limit hint). The field list under the card image is the OfflineWithFeedback + MenuItemField for Card name (value={card?.nameValuePairs?.cardTitle}) followed directly by the MenuItemField for the card number (maskCard(card?.lastFourPAN)), around lines 391-402 as the issue links. cardholder.login is never rendered, so nothing identifies the cardholder by email.

What changes do you think we should make in order to solve the problem?

  1. Between the card-name OfflineWithFeedback block and the card-number MenuItemField, add a read-only field, shown only when cardholder?.login is non-empty:
{!!cardholder?.login && (
    <MenuItemField
        name={translate('workspace.card.issueNewCard.cardholderEmail')}
        value={cardholder.login}
        numberOfLinesValue={0}
        isValueSelectable
    />
)}
  1. Add the cardholderEmail key ("Cardholder email") to en.ts, then to the other locale files and the translation type.
  2. No onPress, so the row is not interactive. numberOfLinesValue={0} lets a long address wrap on narrow layouts instead of truncating (MenuItemFieldRow defaults to 1 line). The !!login guard matters because MenuItemFieldRow renders an empty value as a name-only placeholder row, which would look like a broken field while personal details load or are missing. It also never falls back to displayName or the admin's currentUserLogin.
  3. Test: add tests/ui/WorkspaceExpensifyCardDetailsPageTest.tsx. Seed Onyx with a card plus a personal detail with login. Assert the email shows once with and once without displayName, for isVirtual true and false, and is absent (no placeholder row) when the personal detail is missing. Assert the email node comes after Card name and before the card number.

What alternative solutions did you explore? (Optional)

No other proposals are in the thread yet. I considered reading the email from the Card.ts CSV-export path, but the page already has the personal detail, so a new fetch would be redundant. I also considered always rendering the row with an empty value, but that draws a stray name-only placeholder.

Stephen3453 avatar Nov 13 '26 22:11 Stephen3453

Proposal

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:150, the component resolves the cardholder personal detail via:

const [cardholder] = usePersonalDetail(card?.accountID);

However, cardholder is currently only utilized for displayName (rendered on the visual card graphic via temporaryGetDisplayNameOrDefault) and cardholder?.timezone for the limit hint.

In the fields list under the card graphic (lines 391–402), the OfflineWithFeedback + MenuItemField for Card name (name={translate('workspace.card.issueNewCard.cardName')}) is followed immediately by the MenuItemField for the card number (maskCard(card?.lastFourPAN)). There is no MenuItemField rendering cardholder?.login, so the cardholder's email address is omitted from the page.

What changes do you think we should make in order to solve the problem?

  1. Add Cardholder email MenuItemField in DynamicWorkspaceExpensifyCardDetailsPage.tsx: Between the Card name OfflineWithFeedback block and the card number MenuItemField (around line 399), add a read-only MenuItemField rendered conditionally when cardholder?.login is present:

    {!!cardholder?.login && (
        <MenuItemField
            sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.DETAILS_CARDHOLDER_EMAIL}
            name={translate('workspace.card.issueNewCard.cardholderEmail')}
            value={cardholder.login}
            numberOfLinesValue={0}
            isValueSelectable
        />
    )}
    
    • numberOfLinesValue={0} ensures long email addresses wrap properly on narrow mobile layouts rather than truncating.
    • isValueSelectable={true} allows admins to select and copy the email address.
    • Omitting onPress keeps the field read-only and non-interactive.
    • Guarding with !!cardholder?.login prevents rendering an empty placeholder row while personal details are loading or if absent.
  2. Add translation key in src/languages/en.ts and src/languages/es.ts: Under workspace.card.issueNewCard (matching cardName):

    cardholderEmail: 'Cardholder email',
    

    In Spanish (es.ts):

    cardholderEmail: 'Correo electrónico del titular de la tarjeta',
    
  3. Add Sentry label in src/CONST/SENTRY_LABEL.ts: In SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD:

    DETAILS_CARDHOLDER_EMAIL: 'WorkspaceExpensifyCard-DetailsCardholderEmail',
    
  4. Automated Testing: Add unit test coverage in tests/ui/WorkspaceExpensifyCardDetailsPageTest.tsx validating:

    • The cardholder email is rendered immediately below the Card name and above the card number.
    • The email field renders correctly both when the cardholder has a display name and when they do not.
    • The field handles both virtual and physical cards.
    • When personal details are loading or missing, no placeholder row is rendered.

What alternative solutions did you explore? (Optional)

We explored rendering the email unconditionally with a fallback placeholder string; however, MenuItemFieldContent renders a missing value as a prominent name-only placeholder row, which would look broken during loading states. Guarding with !!cardholder?.login provides a much cleaner user experience.

Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

kevinjosh10 avatar Nov 14 '26 00:11 kevinjosh10

Proposal

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:

const [cardholder] = usePersonalDetail(card?.accountID);

The component resolves the cardholder's personal details, but only uses cardholder for displaying displayName on the visual card preview and cardholder?.timezone for the limit hint.

In the fields list rendered below the card graphic (lines 391–402), the MenuItemField for Card name (value={card?.nameValuePairs?.cardTitle}) is followed immediately by the MenuItemField for the masked card number (maskCard(card?.lastFourPAN)). There is no field rendering cardholder?.login, so workspace admins cannot view or copy the cardholder's email address from the card details view.

What changes do you think we should make in order to solve the problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:

  1. Between the Card name OfflineWithFeedback container and the card number MenuItemField (around line 399), add a read-only MenuItemField displaying the cardholder's email:
{!!cardholder?.login && (
    <MenuItemField
        sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.DETAILS_CARDHOLDER_EMAIL}
        name={translate('workspace.card.issueNewCard.cardholderEmail')}
        value={cardholder.login}
        numberOfLinesValue={0}
        isValueSelectable
    />
)}
  • numberOfLinesValue={0} ensures long email addresses wrap properly without truncation across mobile screen sizes.
  • isValueSelectable enables admins to select and copy the email text.
  • Guarding with !!cardholder?.login prevents displaying an empty placeholder row while personal details are loading or if absent.
  • Omitting onPress keeps the field cleanly read-only.
  1. In src/languages/en.ts and src/languages/es.ts, add the translation key cardholderEmail:

    • en.ts under workspace.card.issueNewCard: cardholderEmail: 'Cardholder email'
    • es.ts under workspace.card.issueNewCard: cardholderEmail: 'Correo electrónico del titular'
  2. In src/CONST/SENTRY_LABEL.ts, register DETAILS_CARDHOLDER_EMAIL: 'WorkspaceExpensifyCard-DetailsCardholderEmail' under SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.

  3. Add UI unit test coverage in tests/ui/WorkspaceExpensifyCardDetailsPageTest.tsx asserting that:

    • The cardholder email is rendered directly below the Card name and above the card number.
    • The field renders properly both when the cardholder has a custom display name and when they do not.
    • When personal details are loading or absent, no empty placeholder row is rendered.

What alternative solutions did you explore? (Optional)

Rendering the field unconditionally with a fallback string was considered, but rendering an empty row or placeholder during loading creates visual flash. Guarding with !!cardholder?.login cleanly preserves the layout until details are loaded.

jpereyra243-byte avatar Nov 14 '26 01:11 jpereyra243-byte

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the New Expensify Expensify Card details page, workspace card admins see the card nickname (Card name) and the cardholder's display name on the card graphic, but there is no dedicated Cardholder email field. When a cardholder has a custom display name set, admins cannot identify or copy the cardholder's email address from this page. We need a read-only Cardholder email field immediately below Card name (above the masked card number) that works across physical/virtual cards, narrow layouts, card-list navigation, and direct deep-link navigation.

What is the root cause of that problem?

  1. Missing MenuItemField for cardholder?.login in DynamicWorkspaceExpensifyCardDetailsPage.tsx:
    • src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:150-158 already resolves const [cardholder] = usePersonalDetail(card?.accountID); (from ONYXKEYS.PERSONAL_DETAILS_LIST), matching how admin card CSV export resolves cardholder email in src/libs/actions/Card.ts:1992-1995 (personalDetailsList?.[String(accountID)]?.login ?? '').
    • However, cardholder is only used to compute displayName on workspaceCardImage (line 294) and cardholder?.timezone?.selected (line 433). Between the Card name OfflineWithFeedback block (lines 391-398) and the masked card-number MenuItemField (lines 399-402), cardholder?.login is never rendered.
  2. Direct navigation cold-load gap for read-only/auditor viewers (lines 175-190):
    • When navigating from the card list, WorkspaceExpensifyCardPage.tsx:46-55 calls openPolicyExpensifyCardsPage(policyID, defaultFundID) unconditionally for anyone passing AccessOrNotFoundWrapper, hydrating both WORKSPACE_CARDS_LIST and cardholders' PERSONAL_DETAILS_LIST.
    • On direct navigation to DynamicWorkspaceExpensifyCardDetailsPage.tsx:175-190, the useEffect gates openPolicyExpensifyCardsPage behind if (!canWriteExpensifyCard) { return; }. For read-only workspace admins/auditors who have access to the page (canWriteExpensifyCard === false), direct navigation skips openPolicyExpensifyCardsPage, leaving workspaceCards and the cardholder's PERSONAL_DETAILS_LIST entry unhydrated if not already cached.

What changes do you think we should make in order to solve the problem?

  1. Render the read-only Cardholder email MenuItemField in src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:

    • Derive const cardholderEmail = cardholder?.login?.trim(); exclusively from cardholder?.login (never falling back to displayName or currentUserLogin).
    • Immediately below the Card name OfflineWithFeedback block (line 398) and above the card-number MenuItemField (line 399), render:
      {!!cardholderEmail && (
          <MenuItemField
              name={translate('workspace.card.issueNewCard.cardholderEmail')}
              value={cardholderEmail}
              numberOfLinesValue={0}
              isValueSelectable
              testID="cardholder-email-menu-item"
          />
      )}
      
    • Why each prop matters in MenuItemField.tsx:55-134:
      • Guarding with !!cardholderEmail prevents MenuItemFieldContent (lines 58-66) from rendering <MenuItemFieldNamePlaceholder> (a broken-looking single-line placeholder row) while PERSONAL_DETAILS_LIST is loading or unavailable.
      • Omitting onPress keeps isInteractive = false and omits <MenuItemChevron />, matching the adjacent read-only card-number MenuItemField at lines 399-402 (which likewise omits sentryLabel, as SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD is only attached to interactive onPress controls).
      • numberOfLinesValue={0} overrides the default 1-line truncation in BaseMenuItemPrimaryText so long email addresses wrap cleanly on narrow layouts.
      • isValueSelectable enables native text selection on web (MenuItemRoot.tsx:92) and sets accessibilityLabel="Cardholder email, <email>" (MenuItemField.tsx:118).
    • In the direct-navigation useEffect (lines 175-190), remove the if (!canWriteExpensifyCard) { return; } early return on the read-only openPolicyExpensifyCardsPage(policyID, defaultFundID) call (aligning with WorkspaceExpensifyCardPage.tsx:46-55) so direct deep links hydrate WORKSPACE_CARDS_LIST and PERSONAL_DETAILS_LIST consistently with card-list navigation.
  2. Add workspace.card.issueNewCard.cardholderEmail across en.ts and all 10 typed locale files:

    • Every locale module in src/languages/ satisfies TranslationDeepObject<typeof en> (src/languages/types.ts:36-42, 74), so adding a key only to en.ts/es.ts fails tsc. Add cardholderEmail next to cardName under workspace.card.issueNewCard in en.ts ('Cardholder email') and all 10 other locale files (de.ts, el.ts, es.ts, fr.ts, it.ts, ja.ts, nl.ts, pl.ts, pt-BR.ts, zh-hans.ts).
  3. Add focused UI tests in tests/ui/WorkspaceExpensifyCardDetailsPageTest.tsx:

    • Render DynamicWorkspaceExpensifyCardDetailsPage via both SCREENS.WORKSPACE.DYNAMIC_EXPENSIFY_CARD_DETAILS and SCREENS.EXPENSIFY_CARD.DYNAMIC_EXPENSIFY_CARD_DETAILS (direct navigation and pre-seeded card-list state) and assert:
      • Cardholder email renders with cardholder.login both when cardholder.displayName is set and when displayName is absent, while preserving Card name and the card graphic's displayName.
      • Works identically for virtual (isVirtual: true) and physical (isVirtual: false) cards, appearing immediately after Card name and before Virtual/Physical card number.
      • Long email addresses pass numberOfLines={0} without truncation.
      • When PERSONAL_DETAILS_LIST is loading or missing for card.accountID, no placeholder row, displayName, or currentUserLogin is rendered, and once Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, ...) resolves, the field appears without crashing.

What alternative solutions did you explore? (Optional)

  • Adding a trailing <MenuItem.Copy value={cardholderEmail} /> action (as in WorkspaceMemberDetailsPage.tsx:527-532): Considered, but keeping a plain read-only MenuItemField with isValueSelectable matches the adjacent read-only card-number MenuItemField on DynamicWorkspaceExpensifyCardDetailsPage and avoids introducing an unrequested action icon.

cocvn157 avatar Nov 14 '26 02:11 cocvn157

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the New Expensify Expensify Card details page (DynamicWorkspaceExpensifyCardDetailsPage), workspace admins can see the card nickname (Card name) and the cardholder's display name on the card preview image, but there is no dedicated field showing the cardholder's email address (login). When a cardholder has a custom display name, admins cannot identify their email from this page.

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:150, the page already resolves the cardholder's personal details via const [cardholder] = usePersonalDetail(card?.accountID); (the same PERSONAL_DETAILS_LIST login field used by admin card CSV export in src/libs/actions/Card.ts:1992-1995). However, cardholder is only used to compute displayName on the card preview graphic and cardholder?.timezone?.selected for the limit hint. Between the Card name MenuItemField (lines 391–398) and the card number MenuItemField (lines 399–402), cardholder?.login is never rendered.

Additionally, on direct deep-link navigation to the card details page by a read-only viewer (canWriteExpensifyCard === false), the useEffect at lines 175–190 skips openPolicyExpensifyCardsPage(policyID, defaultFundID) because of if (!canWriteExpensifyCard) { return; }, whereas WorkspaceExpensifyCardPage.tsx calls openPolicyExpensifyCardsPage without that guard to hydrate WORKSPACE_CARDS_LIST and cardholder PERSONAL_DETAILS_LIST.

What changes do you think we should make in order to solve the problem?

  1. Render the read-only Cardholder email MenuItemField immediately below Card name in src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:
    • Format cardholder?.login with formatPhoneNumber(cardholder.login) (matching how login/email fields are formatted across workspace member pages) and guard rendering on !!cardholder?.login so loading or missing personal details never show an empty placeholder row or fall back to displayName / currentUserLogin:
      {!!cardholder?.login && (
          <MenuItemField
              sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.DETAILS_CARDHOLDER_EMAIL}
              name={translate('workspace.expensifyCard.cardholderEmail')}
              value={formatPhoneNumber(cardholder.login)}
              numberOfLinesValue={0}
              isValueSelectable
          />
      )}
      
    • Omitting onPress keeps the field read-only, numberOfLinesValue={0} prevents long email addresses from truncating on narrow screens, and isValueSelectable lets admins copy the email address.
  2. Ensure direct deep-link navigation hydrates cardholder personal details (src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:175-190):
    • Remove the if (!canWriteExpensifyCard) { return; } early return in the openPolicyExpensifyCardsPage(policyID, defaultFundID) effect (matching WorkspaceExpensifyCardPage.tsx:46-55) so direct navigation always hydrates the card and cardholder personal details.
  3. Add translations and Sentry label (src/languages/en.ts, src/languages/es.ts, src/CONST/SENTRY_LABEL.ts):
    • Add cardholderEmail: 'Cardholder email' (and translations) under workspace.expensifyCard.
    • Add DETAILS_CARDHOLDER_EMAIL: 'WorkspaceExpensifyCard-DetailsCardholderEmail' under SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.
  4. Add UI tests (tests/ui/WorkspaceExpensifyCardDetailsPageTest.tsx):
    • Verify that cardholder.login renders immediately below Card name and above the card number for both physical and virtual cards, with and without a custom display name, and is omitted cleanly while personal details are loading or absent.

What alternative solutions did you explore? (Optional)

  • Rendering MenuItemField unconditionally when cardholder?.login is empty: Rejected because MenuItemField renders a label-only row when value is empty, causing a blank row while personal details are still loading.

RS-ITACHI avatar Nov 14 '26 15:11 RS-ITACHI

📣 @RS-ITACHI! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Nov 14 '26 15:11 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~014898525b9c53fc32

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the New Expensify Expensify Card details page (DynamicWorkspaceExpensifyCardDetailsPage), workspace card admins see the card nickname (Card name) and cardholder's display name, but there is no dedicated read-only field displaying the cardholder's email address. A cardholder cannot be directly identified by email from this page.

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:391-402, the layout renders the card title (card?.nameValuePairs?.cardTitle) followed immediately by the masked card number (maskCard(card?.lastFourPAN)). Although line 150 resolves the cardholder's personal details (const [cardholder] = usePersonalDetail(card?.accountID)), cardholder?.login is never rendered on the screen.

What changes do you think we should make in order to solve the problem?

  1. Add translation key in src/languages/en.ts and src/languages/es.ts: In workspace.card.issueNewCard:

    • en.ts: cardholderEmail: 'Cardholder email'
    • es.ts: cardholderEmail: 'Correo electrónico del titular'
  2. Render read-only Cardholder email MenuItemField in DynamicWorkspaceExpensifyCardDetailsPage.tsx: Directly below the Card name OfflineWithFeedback wrapper (after line 398) and above the card number field, add:

    <MenuItemField
        name={translate('workspace.card.issueNewCard.cardholderEmail')}
        value={cardholder?.login ?? ''}
        interactive={false}
        shouldShowRightIcon={false}
        numberOfLinesTitle={1}
    />
    
    • Uses cardholder?.login (consistent with admin CSV export in Card.ts:1992-1995).
    • Read-only (interactive={false}, shouldShowRightIcon={false}).
    • Gracefully handles loading/missing states (?? '').
    • Preserves responsive wrapping on narrow mobile screens.
  3. Automated tests:

    • In tests/unit/DynamicWorkspaceExpensifyCardDetailsPageTest.tsx:
      • Test that the Cardholder email field renders with the correct value (cardholder.login) below Card name.
      • Test that when cardholder is undefined (loading or absent), the field gracefully displays an empty string without throwing errors.
      • Test that the field is present for both physical and virtual Expensify cards.

What alternative solutions did you explore? (Optional)

  • Displaying email inside the Card name subtitle: Rejected because the issue specification explicitly requests a dedicated read-only field immediately below Card name.
  • Reading login from policy.employeeList: Rejected because usePersonalDetail(card?.accountID) is already subscribed and cached in memory at line 150.

RajGahoi avatar Nov 14 '26 17:11 RajGahoi

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 14 '26 17:11 melvin-bot[bot]

@eh2077 any thoughts on the proposals so far?

rafecolton avatar Nov 14 '26 22:11 rafecolton

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the New Expensify Expensify Card details page (DynamicWorkspaceExpensifyCardDetailsPage), workspace admins can see the card nickname (Card name) and the cardholder's display name on the card preview image, but there is no dedicated field showing the cardholder's email address (login). When a cardholder has a custom display name, admins cannot identify their email from this page.

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:150, the page already resolves the cardholder's personal details via const [cardholder] = usePersonalDetail(card?.accountID); (the same PERSONAL_DETAILS_LIST login field used by admin card CSV export in src/libs/actions/Card.ts:1992-1995). However, cardholder is only used to compute displayName on the card preview graphic and cardholder?.timezone?.selected for the limit hint. Between the Card name MenuItemField (lines 391–398) and the card number MenuItemField (lines 399–402), cardholder?.login is never rendered.

Additionally, on direct deep-link navigation to the card details page by a read-only viewer (canWriteExpensifyCard === false), the useEffect at lines 175–190 skips openPolicyExpensifyCardsPage(policyID, defaultFundID) because of if (!canWriteExpensifyCard) { return; }, whereas WorkspaceExpensifyCardPage.tsx calls openPolicyExpensifyCardsPage without that guard to hydrate WORKSPACE_CARDS_LIST and cardholder PERSONAL_DETAILS_LIST.

What changes do you think we should make in order to solve the problem?

  1. Render the read-only Cardholder email MenuItemField immediately below Card name in src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:
    • Format cardholder?.login with formatPhoneNumber(cardholder.login) (matching how login/email fields are formatted across workspace member pages) and guard rendering on !!cardholder?.login so loading or missing personal details never show an empty placeholder row or fall back to displayName / currentUserLogin:
      {!!cardholder?.login && (
          <MenuItemField
              sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.DETAILS_CARDHOLDER_EMAIL}
              name={translate('workspace.expensifyCard.cardholderEmail')}
              value={formatPhoneNumber(cardholder.login)}
              numberOfLinesValue={0}
              isValueSelectable
          />
      )}
      
    • Omitting onPress keeps the field read-only, numberOfLinesValue={0} prevents long email addresses from truncating on narrow screens, and isValueSelectable lets admins copy the email address.
  2. Ensure direct deep-link navigation hydrates cardholder personal details (src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:175-190):
    • Remove the if (!canWriteExpensifyCard) { return; } early return in the openPolicyExpensifyCardsPage(policyID, defaultFundID) effect (matching WorkspaceExpensifyCardPage.tsx:46-55) so direct navigation always hydrates the card and cardholder personal details.
  3. Add translations and Sentry label (src/languages/en.ts, src/languages/es.ts, src/CONST/SENTRY_LABEL.ts):
    • Add cardholderEmail: 'Cardholder email' (and translations) under workspace.expensifyCard.
    • Add DETAILS_CARDHOLDER_EMAIL: 'WorkspaceExpensifyCard-DetailsCardholderEmail' under SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.
  4. Add UI tests (tests/ui/WorkspaceExpensifyCardDetailsPageTest.tsx):
    • Verify that cardholder.login renders immediately below Card name and above the card number for both physical and virtual cards, with and without a custom display name, and is omitted cleanly while personal details are loading or absent.

What alternative solutions did you explore? (Optional)

  • Rendering MenuItemField unconditionally when cardholder?.login is empty: Rejected because MenuItemField renders a label-only row when value is empty, causing a blank row while personal details are still loading.

U-ITACHII avatar Nov 15 '26 10:11 U-ITACHII

Proposal

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the New Expensify Expensify Card details page (DynamicWorkspaceExpensifyCardDetailsPage), workspace admins can see the card nickname (Card name) and the cardholder's display name rendered on the card graphic, but there is no dedicated field displaying the cardholder's email address (login). When a cardholder has a custom display name, admins cannot identify their email address from this page.

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx:154, the page already subscribes to and resolves the cardholder's personal details via:

const [cardholder] = usePersonalDetail(card?.accountID);

However, cardholder is currently only utilized to compute displayName for the card image graphic (lines 158–162) and cardholder?.timezone?.selected for limit hints (line 438).

In the form section directly below the action buttons (lines 396–406), the Card name MenuItemField is immediately followed by the card number MenuItemField (maskCard(card?.lastFourPAN)). The cardholder's email/login (cardholder?.login, identical to what is exported by getOwnerEmailForCard in src/libs/actions/Card.ts:1992-1995) is never rendered.

What changes do you think we should make in order to solve the problem?

  1. Render the read-only Cardholder email row in src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx: Immediately after the Card name OfflineWithFeedback block and before the card number MenuItemField, add:

    {!!cardholder?.login && (
        <MenuItemField
            name={translate('workspace.card.issueNewCard.cardholderEmail')}
            value={formatPhoneNumber(cardholder.login)}
            numberOfLinesValue={0}
        >
            <MenuItem.Copy value={cardholder.login} />
        </MenuItemField>
    )}
    

    Why this design:

    • Read-only by design: Omitting onPress ensures no chevron is rendered and the row remains strictly non-interactive/read-only.
    • No truncation on narrow layouts: Passing numberOfLinesValue={0} allows long email addresses to wrap without ellipsis or truncation on small screens, fulfilling the acceptance criterion.
    • Formatting support: Using formatPhoneNumber(cardholder.login) (already in scope via useLocalize()) cleanly preserves email addresses as-is while properly formatting phone numbers for SMS-based users.
    • Copy affordance: Providing <MenuItem.Copy value={cardholder.login} /> as children gives desktop hover and mobile long-press copy functionality, matching the exact pattern established in WorkspaceMemberDetailsPage.tsx:396-401.
    • Safe hydration & loading handling: Guarding with {!!cardholder?.login && ...} ensures that when navigating directly via deep link while PERSONAL_DETAILS_LIST is being fetched via openCardDetailsPage, no empty placeholder row or fallback identity is rendered, and no error is thrown.
  2. Add translations in src/languages/en.ts and src/languages/es.ts: Add cardholderEmail under workspace.card.issueNewCard (matching where the neighboring cardName translation is located):

    • src/languages/en.ts:
      cardholderEmail: 'Cardholder email',
      
    • src/languages/es.ts:
      cardholderEmail: 'Correo del titular de la tarjeta',
      

What alternative solutions did you explore? (Optional)

  • Unconditionally rendering <MenuItemField value={cardholder?.login} /> without the !!cardholder?.login guard: Rejected because MenuItemField renders MenuItemFieldNamePlaceholder when value is undefined, which displays an awkward label-only placeholder row while personal details are loading over the network.
  • Reading login from policy.employeeList: Rejected because usePersonalDetail(card?.accountID) is already subscribed and cached in Onyx on this page.

Test Plan

  1. Log in as an admin on a workspace with Expensify Cards.
  2. Navigate to Workspace Settings > Expensify Card.
  3. Select an active card (both a virtual card and a physical card):
    • Verify that Cardholder email is displayed directly below Card name and above the card number.
    • Verify the value displays the cardholder's login email (or formatted phone number).
    • Verify the row has no chevron and cannot be pressed.
    • On desktop, hover over the row and verify the copy icon appears. On touch devices, verify long-press copies the email.
  4. Test with a cardholder who has a custom display name set:
    • Verify the card graphic displays their display name, while the Cardholder email field still displays their email address.
  5. Test with a long email address on narrow mobile screens (e.g. iPhone SE / narrow responsive view):
    • Verify the email wraps cleanly across multiple lines without truncating.
  6. Test direct deep-link navigation by refreshing the page directly at /workspaces/:policyID/cards/expensify-card/:cardID:
    • Verify that the page loads cleanly without errors or identity flickering.

Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c

ayolyn avatar Nov 15 '26 22:11 ayolyn

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 15 '26 22:11 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the New Expensify Card details page (DynamicWorkspaceExpensifyCardDetailsPage), workspace admins can see the card name (nickname) and the cardholder's display name, but there is no dedicated read-only field displaying the cardholder's email address. When a cardholder has a custom display name set, their email address is not visible anywhere on this page.

What is the root cause of that problem?

In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx (lines 391–402), the page renders the cardTitle (Card name) and the masked PAN (Card number), but omits a dedicated MenuItemField for the cardholder's login/email between them:

<OfflineWithFeedback pendingAction={card?.nameValuePairs?.pendingFields?.cardTitle}>
    <MenuItemField
        sentryLabel={CONST.SENTRY_LABEL.WORKSPACE.EXPENSIFY_CARD.DETAILS_CARD_NAME}
        name={translate('workspace.card.issueNewCard.cardName')}
        onPress={canWriteExpensifyCard ? () => Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.EXPENSIFY_CARD_NAME.path)) : undefined}
        value={card?.nameValuePairs?.cardTitle}
    />
</OfflineWithFeedback>
<MenuItemField
    name={translate(isVirtual ? 'cardPage.virtualCardNumber' : 'cardPage.physicalCardNumber')}
    value={maskCard(card?.lastFourPAN)}
/>

The page already subscribes to the cardholder's personal details via const [cardholder] = usePersonalDetail(card?.accountID); (line 148), so the data (cardholder?.login) is already present and cached in Onyx, but it was not wired into the UI.

What changes do you think we should make in order to solve the problem?

  1. In src/pages/workspace/expensifyCard/DynamicWorkspaceExpensifyCardDetailsPage.tsx, insert a read-only MenuItemField for the Cardholder email immediately following the cardTitle OfflineWithFeedback block and before the card number:
{!!cardholder?.login && (
    <MenuItemField
        name={translate('workspace.card.issueNewCard.cardholderEmail')}
        value={formatPhoneNumber(cardholder.login)}
        interactive={false}
        numberOfLinesTitle={0}
    />
)}

Note: Using formatPhoneNumber(cardholder.login) gracefully formats phone number logins if the cardholder registered via SMS, while leaving standard email addresses unchanged. Guarding with {!!cardholder?.login && ...} prevents rendering an empty placeholder while personal details are being fetched on direct deep links.

  1. Add the translation key cardholderEmail in:
  • src/languages/en.ts under workspace.card.issueNewCard:
    cardholderEmail: 'Cardholder email',
    
  • src/languages/es.ts under workspace.card.issueNewCard:
    cardholderEmail: 'Correo del titular de la tarjeta',
    

What alternative solutions did you explore? (Optional)

  • Rendering without !!cardholder?.login guard: Rejected because MenuItemField renders a blank placeholder label when value is undefined, causing UI layout shift while Onyx loads the profile data.
  • Reading from policy.employeeList: Rejected because usePersonalDetail(card?.accountID) is already cached and actively listened to on this page.

Test Plan

  1. Log into New Expensify as an admin on a workspace with Expensify Cards.
  2. Navigate to Workspace Settings > Expensify Card.
  3. Click on any card (verify both virtual and physical cards).
  4. Verify that Cardholder email is rendered directly below Card name and above the card number.
  5. Verify the field is read-only (no chevron, not clickable).
  6. Verify with a user who has a custom display name: the card graphic shows their display name, while the field cleanly shows their email address.
  7. Verify long email addresses wrap properly on narrow/mobile viewports.
  8. Refresh the browser on the card details URL (/workspaces/:policyID/cards/expensify-card/:cardID) to verify direct deep-link loading without flickering.

Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f014c585a22b772d

marhabynova avatar Nov 16 '26 12:11 marhabynova

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

melvin-bot[bot] avatar Nov 16 '26 12:11 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01f014c585a22b772d

marhabynova avatar Nov 16 '26 12:11 marhabynova

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Nov 16 '26 12:11 melvin-bot[bot]

@MelvinBot Can you post a proposal for this issue?

eh2077 avatar Nov 16 '26 12:11 eh2077

Proposal

What is the root cause of that problem?

The details page already subscribes to the selected cardholder’s personal details, but never renders their login. The Card name row is followed immediately by the card-number row.

Code evidence

What changes do you think we should make in order to solve the problem?

  1. Insert a Cardholder email MenuItemField immediately after the Card name feedback wrapper and before the card-number field.

    • Use only cardholder.login, never the display name or viewing admin’s email.
    • Omit onPress so the field has no navigation or chevron.
    • Set numberOfLinesValue={0} to allow wrapping and isValueSelectable for copying on web.
    • Hide the row while the login is unavailable; the existing subscription will render it when details arrive.
    • Preserve the existing nickname and cardholder-name display.
  2. Add a dedicated Cardholder email translation key and corresponding translations in all typed locales.

  3. Add focused rendering coverage for:

    • Physical and virtual cards, with and without a display name.
    • Correct email identity and placement between nickname and card number.
    • Missing/loading details, followed by an Onyx update that supplies the email.
    • Read-only behavior and unlimited value lines.
  4. Verify on web that long emails remain readable at narrow widths, and that navigation from the card list and direct URL loading both populate the correct identity.

Implementation scope and validation notes

MenuItemField:108–130 supports value selection and only renders a chevron when onPress exists. A noninteractive row needs no new Sentry label.

Translation typing:36–42 requires corresponding keys across locale objects; updating English and Spanish alone is insufficient.

Keep the existing permission and fetching logic unchanged. The page already requests card details independently of the write-permission guard:168–190. Cold-navigation response contents and narrow-layout rendering have not been runtime-verified; there is no established evidence that this feature requires removing that guard.

What alternative solutions did you explore? (Optional)

  • Reusing Cardholder as the label does not meet the requested Cardholder email wording.
  • Adding another fetch is unnecessary for rendering already-subscribed data.
  • Changing permission guards would broaden the scope without a demonstrated hydration defect.

Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106905) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 16 '26 12:11 MelvinBot