# Campaign menu map

`../CampaignMenuController.php` composes the traits in `Concerns/`. Existing
routes and callers still use `CampaignMenuController`; public action names and
private helper visibility are preserved. Read only the relevant trait and the
helpers it calls, rather than loading every file.

| File in `Concerns/` | Responsibility / methods |
| --- | --- |
| `RendersCampaignPages.php` | `show` selects campaign views and data; `termsAndConditions` reads the terms document |
| `DefinesCampaignPages.php` | `pages`: channel/menu titles and steps |
| `ExportsCampaignLists.php` | `exportCampaigns`: campaign list as .xlsx (`App\Support\XlsxWriter`) or a print page for PDF |
| `HandlesWabaTemplatePages.php` | `listCampaignTemplates`, `storeCampaignTemplate`, `showCampaignTemplate`, `showCampaignTemplateFromApi` |
| `BuildsWabaTemplates.php` | Template payload, buttons, language/header mapping, account IDs and uploaded file value |
| `LoadsWabaTemplates.php` | `resolveWaTemplates`, `wabaTemplateRowsFromApi`, template select/detail mapping and fallback definitions |
| `LoadsCampaignLists.php` | `campaignRowsFromApi`, list extraction, row mapping and fallback row |
| `LoadsCampaignReports.php` | API reports, report detail mapping, nested JSON decoding and field lookup |
| `ResolvesCampaignAccess.php` | Unit pricing, access/gateway token lookup and gateway refresh callback |

## Payment UI

All campaign forms use main balance. Do not use membership lookup to display
zero prices or select bonus balance. QRIS modals, payment polling, membership
purchase controls, and the RCS package checkbox are removed. Preserve invoice
options, consent, confirmation, and the shared balance review. See
`MainBalancePagesTest` for page coverage.

## Related code and checks

- `routes/web.php`: controller routes; `resources/views/campaign-*`: rendered views.
- `app/Services/MyadsApi/AGENTS.md`: upstream API client feature map.
- `app/Http/Controllers/APIGW/AGENTS.md`: campaign submission and JSON endpoints.
- Relevant regression tests in `tests/Feature/`: `CampaignReportContentTest`,
  `CampaignSmsReportTest`, `BroadcastTest`, `SmsSubmissionFeedbackTest`,
  `CampaignPaymentProtectionTest`, and `MediaCampaignTest`.
- These tests are related checks, not complete coverage of all template actions.
  Run `php artisan test --compact` for changes spanning these concerns.

Keep template selection, API response fallbacks, session keys, view data and
route signatures stable during structural cleanup. Traits share private helpers
through the composed controller. Keep imports explicit in each trait namespace.
