Render the Mercury card through ProviderItem::CardComponent

JA
5d ago
+915-128

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 jaysbeekay/sure#670 (Track B, step 7: the Mercury conversion, card). Stacked on B8b (jaysbeekay/sure#747) in fork stack #687.

Upstream draft PR: https://github.com/we-promise/sure/pull/5256 (same branch, same commit), in native stack we-promise/sure#5268 on refactor/provider-kit.

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.rb and seven mercury_card_*.html snapshots: 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.

LightDark
Afterafter-lightafter-dark

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 8 ReleaseNotesWorkflowTest errors (no node in the test image).
  • erb_lint, bin/rubocop on 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/index and by ProviderItemsController#complete_account_setup's Turbo stream, both with visible_accounts: (ProviderItemCardsTest checks 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.