wacrm/src/app/api/whatsapp
Arnas Donauskas 4e89b2b902
feat(flows): soft-GA — open to all users + Beta label
The Flows feature was previously gated on a per-account
`profiles.beta_features` opt-in: the sidebar entry was invisible
to non-beta accounts, every /api/flows route 404'd, the webhook
dispatcher was a no-op, and the agent-handoff pause was skipped.

This PR opens the surface to every authenticated user. A small
"Beta" chip in the sidebar nav + on the /flows page H1 keeps the
"young feature" signal without holding anyone out.

Removed:
- `src/lib/flows/feature-flag.ts` + its tests (-11 tests).
- The `requireFlowsBeta` / `requireFlowsBetaAndOwnership` helpers
  in the API routes — collapsed to plain `requireUser` / RLS
  ownership.
- The `isProfileFlowsEnabled` helper + branch in the webhook
  dispatcher — the runner takes the cheap "no_match" exit on
  accounts with no active flows (single indexed SELECT).
- The agent-handoff pause gate in /api/whatsapp/send — the UPDATE
  matches zero rows when no active run exists, also cheap.
- Client-side beta gates in the 3 flows pages (and the redundant
  `useAuth` + `profileLoading` plumbing they needed).
- The defensive message-bubble gate that would have rendered
  interactive replies as plain text for non-beta accounts.
- The `betaKey` field on the sidebar NavItem schema, replaced by a
  simpler boolean `beta` that purely drives the visual chip.

Kept:
- `profiles.beta_features` column. Generic mechanism for future
  beta gates; no current feature reads it. Comments in
  `src/types/index.ts` + `use-auth.tsx` updated to say so.
- The chip can be removed in a one-liner once the team's satisfied
  Flows has bedded in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 17:16:58 +03:00
..
broadcast security: rate-limit send and broadcast per user 2026-04-20 19:48:30 +03:00
config refactor: Meta API helpers use named params (prevents swapped-args bugs) 2026-04-16 21:52:25 +03:00
media/[mediaId] refactor: Meta API helpers use named params (prevents swapped-args bugs) 2026-04-16 21:52:25 +03:00
react feat(inbox): reactions, reply-to, and copy on chat messages 2026-05-19 16:17:26 +03:00
send feat(flows): soft-GA — open to all users + Beta label 2026-05-22 17:16:58 +03:00
templates/sync chore: rename product to "CRM Template for WhatsApp" 2026-05-06 11:52:11 +03:00
webhook feat(flows): soft-GA — open to all users + Beta label 2026-05-22 17:16:58 +03:00