Render the Mercury card through ProviderItem::CardComponent
Summary
Provider kit Track B, B8c: Mercury's connection card renders ProviderItem::CardComponent, as Brex's and Lunch Flow's do (B4a, B7c). A pure move: the card's HTML is unchanged, proven against snapshots recorded from the old partial.
Part of #5003 (Track B, step 7: the Mercury conversion, card).
Stacked on #5255. Fork pre-flight: jaysbeekay/sure#748 (same branch, same commit; its CI, Gatekeeper review and screenshot history live there).
What changed
app/views/mercury_items/_mercury_item.html.erb: 6 lines (from 129), rendering the component with the accounts page's@mercury_sync_stats_map. Mercury passes no count maps; the component then asks the connection, as the partial did.test/components/provider_item/mercury_card_component_test.rband sevenmercury_card_*.htmlsnapshots: Brex's seven card cases (admin; admin with a linked account; member with accounts; member shown one of two; member with none; scheduled for deletion; sync error), each asserting the partial and the component both render the snapshot.
Screenshots
Rendering unchanged: this PR moves the Mercury card onto a shared component, and the snapshot tests show the HTML matches the partial's. After only, at this PR's head: /accounts, the Mercury connection from the test fixtures (mercury_items(:one)) with one linked account, "Everyday (linked)", added for the shot.
| Light | Dark | |
|---|---|---|
| After | ![]() | ![]() |
Demo data
No demo data needed.
Migration notes
No migration.
Verification
- Snapshots recorded first: the seven snapshots were written from the old partial (
PROVIDER_ITEM_SNAPSHOTS=write, partial cases only) before the partial changed. The component matched them then, and both match after. - Existing tests unedited: the accounts controller, views and Mercury controller tests pass.
- Mutation, caught: the card handed every account instead of the viewer's visible ones ("member shown one of two").
bin/rails test(full, at the B7c commit): 16,491 runs, 0 failures; the same 8ReleaseNotesWorkflowTesterrors (nonodein the test image).erb_lint,bin/rubocopon changed files: no offenses.bin/brakeman: no warnings.- Size: non-test +5 / -128.
- Checked against upstream AGENTS.md (blob 1a5dbebd, 2026-11-17): no deviations.
Blast radius
- The partial is rendered by
accounts/indexand byProviderItemsController#complete_account_setup's Turbo stream, both withvisible_accounts:(ProviderItemCardsTestchecks every render site). - The sync-stats map: the accounts page builds it for every Mercury connection it lists, so the component's fallback to the connection's latest sync, used when an item is missing from the map, isn't reached there.
Summary by cubic
Renders the Mercury connection card through ProviderItem::CardComponent, matching Brex and Lunch Flow, without changing the rendered HTML.
- The 129-line partial is now a 6-line component render that passes
@mercury_sync_stats_map; the component falls back to the connection's latest sync when the map is absent. - Seven snapshots recorded from the old partial prove the partial and the component render identical HTML across admin, member, deletion, sync-error, and setup states.
- The three snapshots showing the setup prompt were re-recorded after the shared card switched that prompt to
DS::EmptyState; those diffs are prompt-only.

