whisper-money/resources/js/components/onboarding
Víctor Falcón 10442c1e32
feat(onboarding): auto-enable AI for connected banks, ask the rest (#618)
## Why

During onboarding we prompt for AI suggestions only because it's a
**paid feature** — enabling it forces the user to pick a plan at the end
of onboarding. A user who has **already connected a bank** is committed
to a paid plan regardless, so the prompt gives them nothing new. For
them we should just turn AI on.

## What

- **Connected bank → activate AI directly.** The consent prompt is
skipped and consent is recorded automatically (reuses the existing
`/ai/consent` endpoint, so the categorization backfill still runs).
`setBusy` batches with the state update so the consent screen never
flashes.
- **No bank → unchanged opt-in.** Free users still explicitly accept.
The notice is reworded to make the paid framing clear: *"AI suggestions
are a paid feature. Enable them and you'll choose a plan at the end of
the onboarding."* (translated in `es.json`).
- No backend change needed:
`RuleSuggestionController::requiresUpgrade()` already treats
bank-connected users as not needing an upgrade, and
`SubscriptionController` already gates the free plan on `!hasBank &&
!hasConsent`.

## Tests

Browser tests in `OnboardingFlowTest`:
- Connected bank → consent prompt skipped and `hasActiveAiConsent()`
becomes true.
- No bank → prompt (with the paid notice) shown; consent recorded only
after accepting.
- `/subscribe` forces a plan (no "Continue for free") when a bank is
connected or AI consent is active.

Vitest specs for `StepAiSuggestions` updated (new prop + reworded
notice) plus a new case asserting bank-connected users auto-activate.

All green: 5/5 browser tests (24 assertions), 6/6 vitest.
2026-07-01 07:26:52 +00:00
..
ai-suggestion-card.tsx feat(ai): suggest automation rules during onboarding (#523) 2026-06-13 22:51:15 +02:00
step-account-types.tsx refactor(real-estate): remove Pennant gating (#308) 2026-04-20 13:31:49 +01:00
step-ai-suggestions-upgrade.test.tsx feat(onboarding): auto-enable AI for connected banks, ask the rest (#618) 2026-07-01 07:26:52 +00:00
step-ai-suggestions.test.tsx feat(onboarding): auto-enable AI for connected banks, ask the rest (#618) 2026-07-01 07:26:52 +00:00
step-ai-suggestions.tsx feat(onboarding): auto-enable AI for connected banks, ask the rest (#618) 2026-07-01 07:26:52 +00:00
step-button.tsx User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
step-categorize-transactions.tsx feat(onboarding): clarify the "categorize at least 5" goal in the categorizer (#616) 2026-07-01 08:34:51 +02:00
step-category-types.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
step-complete.tsx feat(subscription): allow free plan for open banking users without connected banks (#188) 2026-03-03 22:28:50 +00:00
step-create-account.tsx refactor(js): extract shared getCsrfToken util (#475) 2026-06-03 17:26:09 +02:00
step-customize-categories.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
step-header.tsx User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
step-import-balances.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00
step-import-transactions.tsx Fix transaction importer account preselect (#396) 2026-05-14 12:38:44 +02:00
step-smart-rules.tsx feat: (Onboarding) add categorization intro screen with benefit cards (#201) 2026-03-05 11:47:12 +01:00
step-syncing.tsx fix(browser-test): reload transactions in syncing step and fix Skip button selector (#203) 2026-03-05 11:29:06 +00:00
step-welcome.tsx feat: Spanish localization (#74) 2026-02-08 11:58:08 +01:00