Reports: pause paths, set cost and blacklist zones from breakdown rows

Merged
RI
1mo ago
+274-7

Binom-style row actions in Reports → Breakdown (write access only). Uses existing APIs, no backend or schema change.

  • Group by Path: Pause path / Resume path (PATCH /api/programs/:id/paths/:pathId enabled). Paused paths show a paused badge; rotation skips them, stats stay.
  • Group by Sub 1–10, country, external ID: Set cost: inline total, sent as POST /api/campaigns/:id/costs with filter_dim/filter_value and the report's date range (Unix ms; "All time" = 0 → now). Report reloads with the new cost / profit / ROI.
  • Group by Sub 1–10, external ID: Blacklist: adds the zone to the campaign blacklist (POST /api/automation/blacklist); already-listed rows show "Blacklisted".
  • Compact .btn-sm / .input-sm for table rows. Docs: "From a report row" under Traffic sources → Cost updates. MCP already has these tools (update_path, cost update, blacklist).
  • Test: paused path gets no traffic; cost update with Unix ms range lands on the grouped-by-country row.

Not included: pausing a single offer/lander inside a path (no per-item status in schema yet).

Path pause

path

Set cost (editing)

edit

After save: zone_3 cost $8.00, zone_2 blacklisted

saved

Screenshots use local seed data.

bun run typecheck ✓ · bun run test 117 ✓

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds Binom-style row actions to Reports → Breakdown (write access only), using existing APIs with no backend changes.

  • Group by path to pause or resume paths; paused paths get no new traffic, keep their stats, and show a paused badge.
  • Group by Sub 1–10, country, or external ID to Set cost with an inline total; "All time" sends 0 → now as Unix ms, and the report reloads with the new cost, profit, and ROI.
  • Group by Sub 1–10 or external ID to Blacklist zones; already-listed rows show "Blacklisted".
  • Adds compact .btn-sm/.input-sm styles and a "From a report row" docs section under Traffic sources → Cost updates.
  • Includes an integration test covering a paused path and a row cost update with a Unix ms range.

Summary by CodeRabbit

  • New Features

    • Added actions to report breakdowns for updating costs, blacklisting zones, and pausing or resuming paths. Successful changes refresh the report, and paused paths are marked in the table.
    • Added guidance explaining how these actions affect campaigns and traffic.
  • Improvements

    • Added compact styling for buttons and inputs used in report actions.
  • Tests

    • Added coverage for paused-path traffic routing and cost reporting by country.