whisper-money/resources/js/lib
Víctor Falcón c433088806
User Onboarding Flow (#23)
## Summary

Implements a complete user onboarding flow that guides new users through
setting up their account after registration.

## Features

- **Step-by-step wizard UI** with progress indicator and smooth
animations
- **E2E Encryption setup** with password strength indicator and
explanation of how encryption works
- **Account creation** supporting all account types (checking, savings,
credit card, investment, pension)
- **Category customization** with explanation of category types
(expenses, income, transfer)
- **Smart rules explanation** covering why there is no AI
auto-categorization (privacy & E2EE)
- **Transaction/balance import** based on account type
- **Sync integration** to ensure data consistency with backend

## Flow Diagram

```mermaid
flowchart TD
    A[User Registration] --> B[Welcome]

    B --> E[Encryption Explained]
    
    E --> C{Has encryption key?}

    C -->|No|F[Encryption Setup]
    C -->|Yes|G{Has Existing Accounts?}
    G -->|Yes| H[Show Existing Accounts]
    G -->|No| I[Create First Account]
    
    H --> J[Continue]
    I --> K{Account Type?}
    
    K -->|Checking/Savings/Credit Card| L[Import Transactions]
    K -->|Investment/Pension| M[Import Balances]
    
    J --> N[Category Types Explanation]
    L --> N
    M --> N
    
    N --> O[Customize Categories]
    O --> P[Smart Rules Explanation]
    P --> Q[More Accounts?]
    
    Q -->|Add More| I
    Q -->|Finish| R[Complete]
    
    R --> S[Redirect to Dashboard]
    S --> T{Subscribed?}
    T -->|No| U[Subscribe Page]
    T -->|Yes| V[Dashboard]
```

## Technical Changes

### Backend
- Added `onboarded_at` field to users table with migration
- Created `EnsureOnboardingComplete` middleware for redirect logic
- Created `OnboardingController` with index and complete actions
- Custom `RegisterResponse` to redirect new users to onboarding
- Updated `AccountController::store` to return JSON for fetch requests

### Frontend
- `OnboardingLayout` - fullscreen layout with step progress
- `useOnboardingState` hook - manages step navigation and state
- 12 step components for each onboarding screen
- Backend sync after account creation and imports

### Tests
- Feature tests for onboarding middleware
- Updated existing tests to use `onboarded()` factory state
2025-12-12 13:06:08 +01:00
..
balance-import-config-storage.ts fix: add SSR guards to localStorage/sessionStorage access 2025-12-08 18:19:20 +01:00
constants.ts Fix CI: Update bun.lock and fix linting errors 2025-12-01 15:16:06 +01:00
crypto.ts Add some toast notifications 2025-11-11 11:39:28 +00:00
db-migration-helper.ts Add some toast notifications 2025-11-11 11:39:28 +00:00
debug.ts fix: make useIsMobile hook and utility functions SSR-safe 2025-12-08 17:33:54 +01:00
dexie-db.ts Y3:0 2025-11-26 12:01:49 +01:00
file-parser.ts Fix CI: Update bun.lock and fix linting errors 2025-12-01 15:16:06 +01:00
import-config-storage.ts fix: add SSR guards to localStorage/sessionStorage access 2025-12-08 18:19:20 +01:00
key-storage.ts fix: make encryption key storage SSR-safe to prevent 502 errors 2025-12-08 17:13:45 +01:00
rule-builder-utils.ts Smart rules: Change operator to `OR` by default (#7) 2025-12-03 10:16:29 +01:00
rule-engine.ts Accounts: new pages to list, and see account details (#13) 2025-12-05 14:33:18 +01:00
sync-manager.ts Add pending operations dialog and improve sync status UI (#16) 2025-12-06 21:54:11 +01:00
track-event.ts fix: make useIsMobile hook and utility functions SSR-safe 2025-12-08 17:33:54 +01:00
user-session-storage.ts User Onboarding Flow (#23) 2025-12-12 13:06:08 +01:00
utils.ts Prevent duplicate notes when re-evaluating automation rules 2025-12-04 16:42:54 +01:00