55 Commits

Author SHA1 Message Date
0c801c3b19 Add comprehensive error handling for API device attachment
- Add explicit 429 rate limit handling with RATE_LIMITED error code
- Add 6 new test cases for edge scenarios:
  - 403 Forbidden handling
  - 429 Rate Limit handling
  - JSON parse error handling
  - WellNuo API failure when fetching beneficiary
  - Timeout error detection
  - MAC address uppercase normalization verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-31 18:29:26 -08:00
3f0fe56e02 Add protected route middleware and auth store for web app
- Implement Next.js middleware for route protection
- Create Zustand auth store for web (similar to mobile)
- Add comprehensive tests for middleware and auth store
- Protect authenticated routes (/dashboard, /profile)
- Redirect unauthenticated users to /login
- Redirect authenticated users from auth routes to /dashboard
- Handle session expiration with 401 callback
- Set access token cookie for middleware
- All tests passing (105 tests total)
2026-01-31 17:49:21 -08:00
d289dd79a1 Add comprehensive sensor health monitoring system
Implemented a full sensor health monitoring system for WP sensors that
tracks connectivity, WiFi signal strength, communication quality, and
overall device health.

Features:
- Health status calculation (excellent/good/fair/poor/critical)
- WiFi signal quality monitoring (RSSI-based)
- Communication statistics tracking (success rate, response times)
- BLE connection metrics (RSSI, attempt/failure counts)
- Time-based status (online/warning/offline based on last seen)
- Health data caching and retrieval

Components:
- Added SensorHealthMetrics types with detailed health indicators
- Implemented getSensorHealth() and getAllSensorHealth() in BLEManager
- Created SensorHealthCard UI component for health visualization
- Added API endpoints for health history and reporting
- Automatic communication stats tracking on every BLE command

Testing:
- 12 new tests for health monitoring functionality
- All 89 BLE tests passing
- No linting errors

This enables proactive monitoring of sensor health to identify
connectivity issues, poor WiFi signal, or failing devices before they
impact user experience.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-31 16:15:32 -08:00
30df915433 Add comprehensive API error handling for sensor attachment
Improved error handling in the attachDeviceToBeneficiary method with:

- Structured ApiResponse return type with detailed error codes
- User-friendly error messages for different failure scenarios:
  - DEPLOYMENT_NOT_FOUND: Beneficiary has no deployment configured
  - UNAUTHORIZED: Missing or expired authentication credentials
  - NOT_FOUND: Sensor or deployment not found (404)
  - SERVER_ERROR: Legacy API server error (500)
  - SERVICE_UNAVAILABLE: Service temporarily unavailable (503+)
  - LEGACY_API_ERROR: Error from Legacy API response body
  - NETWORK_ERROR: Network connectivity issues
  - EXCEPTION: Unexpected errors

- Enhanced error messages in setup-wifi.tsx to display API error details
- Fixed navigator.onLine check to work in test environment
- Added comprehensive test suite with 11 test cases covering all error scenarios

All tests passing (11/11).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-31 16:08:08 -08:00
0cc82b24b0 Add deployment_id lookup mechanism
Implement getDeploymentForBeneficiary() method to resolve beneficiary → deployment_id mapping. This extracts the deployment lookup logic into a reusable, testable method.

Changes:
- Add getDeploymentForBeneficiary() in services/api.ts
  - Fetches beneficiary from WellNuo API
  - Returns deployment_id with proper error handling
  - Returns ApiResponse<number> with typed errors
- Refactor attachDeviceToBeneficiary() to use new method
  - Reduces code duplication
  - Improves separation of concerns
- Add comprehensive test suite
  - Tests successful deployment lookup
  - Tests authentication errors
  - Tests missing deployment scenarios
  - Tests network error handling
  - Tests edge cases (string IDs, 0 values, empty strings)

Benefits:
- Deployment lookup now reusable across codebase
- Better error handling with specific error codes
- Easier to test and maintain
- Follows DRY principle

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-31 16:00:11 -08:00
8af7a11cd9 Fix WiFi credentials cache implementation in SecureStore
- Fix saveWiFiPassword to use encrypted passwords map instead of decrypted
- Fix getWiFiPassword to decrypt from encrypted storage
- Fix test expectations for migration and encryption functions
- Remove unused error variables to fix linting warnings
- All 27 tests now passing with proper encryption/decryption flow

The WiFi credentials cache feature was already implemented but had bugs
where encrypted and decrypted password maps were being mixed. This commit
ensures proper encryption is maintained throughout the storage lifecycle.
2026-01-31 15:55:24 -08:00
d499d9d62a Fix remaining PRD tasks: constants, AbortController, BLE cleanup, displayName fallback
- Add ONLINE_THRESHOLD_MS constant for magic number (30 min threshold)
- Add AbortController to cancel requests when screen loses focus
- Register BLE cleanup callback for logout in BLEContext
- Add 'Unknown User' fallback for displayName in all locations
- Add null safety guard in handleBeneficiaryPress
2026-01-29 16:54:57 -08:00
48ceaeda35 Fix avatar caching issues
- Add bustImageCache() at API layer to ensure avatars always have cache-busting timestamps
- Remove redundant bustImageCache() calls from UI components (already handled at API level)
- Add key prop to Image components using avatar URL to force re-render on avatar change
- Add expo-image-manipulator mock to jest.setup.js

This ensures that when users upload new avatars, React Native's Image component
displays the updated image immediately instead of showing cached old versions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 12:51:37 -08:00
70f9a91be1 Remove console.log statements from codebase
Removed all console.log, console.error, console.warn, console.info, and console.debug statements from the main source code to clean up production output.

Changes:
- Removed 400+ console statements from TypeScript/TSX files
- Cleaned BLE services (BLEManager.ts, MockBLEManager.ts)
- Cleaned API services, contexts, hooks, and components
- Cleaned WiFi setup and sensor management screens
- Preserved console statements in test files (*.test.ts, __tests__/)
- TypeScript compilation verified successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 12:44:16 -08:00
a1264631c0 Add encryption key cleanup on logout
- Clear master encryption key when user logs out
- Ensures WiFi passwords cannot be decrypted after logout
- Improves security by removing cryptographic material
- Complements existing WiFi password clearing on logout

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 12:28:56 -08:00
69c999729f Fix BLE connections not disconnecting on logout
Implemented proper BLE cleanup mechanism on user logout:

**Root Cause:**
- BLE cleanup callback was being set but reference could become stale
- No explicit cleanup call in profile logout handler
- Callback stability issues due to re-renders

**Changes:**
1. app/_layout.tsx:
   - Use useRef pattern to maintain stable callback reference
   - Set callback once with ref that always points to current cleanupBLE
   - Cleanup callback on unmount to prevent memory leaks

2. app/(tabs)/profile/index.tsx:
   - Add explicit cleanupBLE() call in logout handler
   - Import useBLE hook to access cleanup function
   - Ensure cleanup happens before logout completes

3. services/api.ts:
   - Update setOnLogoutBLECleanupCallback signature to accept null
   - Allows proper cleanup of callback on unmount

4. jest.setup.js:
   - Add AsyncStorage mock to prevent test failures

5. Tests:
   - Add comprehensive BLE cleanup tests
   - Test callback pattern and stability
   - Test logout flow with BLE cleanup
   - Test error handling during cleanup

**Result:**
BLE connections now properly disconnect when user logs out,
preventing stale connections and potential resource leaks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 12:19:46 -08:00
1dd7eb8289 Remove hardcoded credentials and use environment variables
- Remove hardcoded database credentials from all scripts
- Remove hardcoded Legacy API tokens from backend scripts
- Remove hardcoded MQTT credentials from mqtt-test.js
- Update backend/.env.example with DB_HOST, DB_USER, DB_PASSWORD, DB_NAME
- Update backend/.env.example with LEGACY_API_TOKEN and MQTT credentials
- Add dotenv config to all scripts requiring credentials
- Create comprehensive documentation:
  - scripts/README.md - Root scripts usage
  - backend/scripts/README.md - Backend scripts documentation
  - MQTT_TESTING.md - MQTT testing guide
  - SECURITY_CREDENTIALS_CLEANUP.md - Security changes summary

All scripts now read credentials from backend/.env instead of hardcoded values.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 12:13:32 -08:00
bbc45ddb5f Implement secure WiFi password storage using SecureStore
- Create wifiPasswordStore service for encrypted password storage
- Replace AsyncStorage with SecureStore for WiFi credentials
- Add automatic migration from AsyncStorage to SecureStore
- Integrate WiFi password cleanup into logout process
- Add comprehensive test suite for password storage operations
- Update setup-wifi screen to use secure storage

Security improvements:
- WiFi passwords now stored encrypted via expo-secure-store
- Passwords automatically cleared on user logout
- Seamless migration for existing users

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 11:13:37 -08:00
2b2bd88726 Add BLE cleanup on user logout
Implement comprehensive BLE cleanup functionality that properly
disconnects all devices and releases resources when user logs out.

Changes:
- Add cleanup() method to BLEManager and MockBLEManager
- Update IBLEManager interface to include cleanup
- Add cleanupBLE() to BLEContext to disconnect all devices
- Implement callback mechanism in api.ts for BLE cleanup on logout
- Wire up BLE cleanup in app layout to trigger on logout
- Add unit tests for BLE cleanup functionality

This ensures no BLE connections remain active after logout,
preventing resource leaks and potential connection issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-29 10:57:43 -08:00
869f5d1305 Replace legacy credentials (anandk → robster) and move to environment variables
Changes:
- Updated backend/src/services/mqtt.js to use LEGACY_API_USERNAME and LEGACY_API_PASSWORD from .env
- Updated services/api.ts with new robster credentials
- Added Legacy API and MQTT credentials to backend/.env.example
- MQTT service now falls back to LEGACY_API_* env vars if MQTT_* not set

This ensures all services use consistent, up-to-date credentials from environment configuration.
2026-01-29 10:49:37 -08:00
994e2faadb Fix deployment error handling, build info display, Android UI improvements
- Add build number/timestamp display on login screen
- Improve error message when beneficiary has no deployment (user-friendly text instead of crash)
- Fix verify-otp screen layout for Android (smaller spacing, icon sizes)
- Add KeyboardAvoidingView to setup-wifi screen
- Save WiFi passwords per SSID (auto-fill on reconnect)
- Suppress BLE "operation cancelled" noise in logs
- Add build-info generation script (npm run build-info)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-27 21:49:02 -08:00
7149d25ba4 Add BLE fix for saved WiFi credentials + build version indicator
BLE Fix:
- Check if sensor is already connected to target WiFi before sending credentials
- Handle W|fail when sensor uses saved credentials instead of new password
- Return success if sensor is connected to target network even after W|fail

Build Version Indicator:
- Add visible version badge on Dashboard screen (v2.1.0 • 2026-01-27 17:05)
- Green text on dark background in bottom-right corner
- Helps verify which build is running on device

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-27 16:55:02 -08:00
Sergei
5483c8244c feat(api): add getNotificationHistory method for alert history
- Add NotificationHistoryItem, NotificationHistoryResponse types
- Add notification type enums (NotificationType, NotificationChannel, NotificationStatus)
- Implement getNotificationHistory() in api.ts with filtering support
  - Supports limit, offset, type, status query params
  - Returns paginated history with total count

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-26 18:41:36 -08:00
Sergei
d453126c89 feat: Room location picker + robster credentials
- Backend: Update Legacy API credentials to robster/rob2
- Frontend: ROOM_LOCATIONS with icons and legacyCode mapping
- Device Settings: Modal picker for room selection
- api.ts: Bidirectional conversion (code ↔ name)
- Various UI/UX improvements across screens

PRD-DEPLOYMENT.md completed (Score: 9/10)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 15:22:40 -08:00
Sergei
2aff43af34 fix(api): Convert location IDs to Legacy API numeric codes
- Add legacyCode to ROOM_LOCATIONS constants (102-200)
- Add getLocationLegacyCode() to convert ID -> code when saving
- Add getLocationIdFromCode() to convert code -> ID when loading
- updateDeviceMetadata now sends numeric codes to Legacy API
- getDevicesForBeneficiary now converts codes back to string IDs

Legacy API expects numeric location codes (e.g., 102 for Bedroom),
but frontend uses string IDs (e.g., 'bedroom'). This fix ensures
proper bidirectional conversion.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 14:17:46 -08:00
Sergei
197a269d10 feat(api): Add ROOM_LOCATIONS constants for sensor placement
Added room locations array with id, label, and icon for each room type:
- Bedroom, Living Room, Kitchen, Bathroom, Hallway
- Entrance, Garage, Basement, Office, Other

Also exported RoomLocationId type for type-safe location selection.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-24 14:14:41 -08:00
Sergei
9e77a8e059 feat(api): Add originalName field to beneficiary responses
- Add originalName to Beneficiary type in types/index.ts
- Update getAllBeneficiaries to map displayName, originalName, customName from API
- Update getWellNuoBeneficiary to include originalName in response mapping
- Use server-provided displayName instead of computing client-side

Now GET /me/beneficiaries/:id returns:
- displayName: customName || name (for UI display)
- originalName: original name from beneficiaries table
- customName: user's custom name for this beneficiary

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-22 13:02:12 -08:00
Sergei
9f0baea3fd feat(beneficiaries): Use displayName in detail page header
- Add displayName field to Beneficiary type (computed: customName || name)
- Populate displayName in getAllBeneficiaries and getWellNuoBeneficiary API calls
- Update detail page header to use beneficiary.displayName
- Update MockDashboard to use displayName

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-22 12:54:50 -08:00
Sergei
4bdfa69dbe feat(api): Add custom_name field to user_access table
Allow users to set custom display names for their beneficiaries
(e.g., "Mom", "Dad" instead of the real name). The custom_name
is stored per-user in user_access, so different caregivers can
have different names for the same beneficiary.

Changes:
- Migration 009: Add custom_name column to user_access
- API: Return customName in GET /me/beneficiaries endpoints
- API: New PATCH /me/beneficiaries/:id/custom-name endpoint
- Types: Add customName to Beneficiary interface
- api.ts: Add updateBeneficiaryCustomName method

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-22 12:34:38 -08:00
Sergei
102a562f9d Fix sensors list API: add missing auth headers and credentials method
- Add baseUrl and legacyApiUrl as class properties in ApiService
- Add getLegacyCredentials() method for device operations
- Add Authorization header to getDevicesForBeneficiary()
- Add Authorization header to attachDeviceToBeneficiary()

These changes fix the sensors list functionality allowing users
to view sensors for any beneficiary.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-19 23:04:45 -08:00
Sergei
8a633a0f6b Add attachDeviceToDeployment method to api.ts
Implements API method to link WP sensors to a beneficiary's deployment
via the Legacy API set_deployment endpoint. Uses proper authentication
through getLegacyWebViewCredentials() and follows existing API patterns.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-19 23:01:47 -08:00
Sergei
c46af1ea1d Add updateDeviceMetadata method to api.ts
Add method to update device location and description via Legacy API
device_form endpoint. Uses getLegacyWebViewCredentials for auth.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-19 22:35:10 -08:00
Sergei
3aee73a731 Add WP sensor status system with BLE scanning
Implemented three-tier sensor status (online/warning/offline) with visual indicators and BLE scanning for nearby devices.

Features:
- WPSensor type with status field (online/warning/offline)
- Automatic status calculation based on lastSeen time:
  • Online: < 5 minutes (fresh data)
  • Warning: 5 min - 1 hour (potential issue)
  • Offline: > 1 hour (definitely problem)
- Dual sensor display: Connected (API) + Available Nearby (BLE)
- BLE scanning button for discovering nearby WP sensors
- Action Sheet for offline sensors with Reconnect/Remove options
- Updated summary card: Total/Online/Warning/Offline counts
- Visual status indicators: colored dots and labels
- Graceful error handling for API unavailability

Files changed:
- types/index.ts: Added WPSensor interface with status and source fields
- services/api.ts: Updated getDevicesForBeneficiary with status calculation
- equipment.tsx: Complete UI overhaul with BLE scanning and two-tier sensor list

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-14 19:03:06 -08:00
Sergei
5e0b38748b Update Stripe integration, API services, and purchase screens
- Update purchase screens (auth and beneficiary)
- Update Stripe configuration and setup scripts
- Update api.ts services
- Update espProvisioning and sherpaTTS services
- Update verify-otp flow
- Package updates
2026-01-12 21:44:57 -08:00
Sergei
7105bb72f7 Stable Light version - App Store submission
WellNuo Lite architecture:
- Simplified navigation flow with NavigationController
- Profile editing with API sync (/auth/profile endpoint)
- OTP verification improvements
- ESP WiFi provisioning setup (espProvisioning.ts)
- E2E testing infrastructure (Playwright)
- Speech recognition hooks (web/native)
- Backend auth enhancements

This is the stable version submitted to App Store.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-12 20:28:18 -08:00
Sergei
966d8e2aba Various improvements and fixes
- Added ImageLightbox component for avatar viewing
- Updated beneficiary detail page with lightbox support
- Profile page improvements
- Bug page cleanup
- API and context updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-10 08:25:39 -08:00
Sergei
657737e5a4 Add status badges for beneficiaries list
- Monitoring badge: equipment active + subscription active
- Get kit badge: user hasn't ordered equipment yet
- Equipment status badges: ordered, shipped, delivered
- No subscription warning when equipment works but no sub
- Stripe subscription caching in backend (hourly sync)
- BeneficiaryMenu with edit/share/archive/delete actions
2026-01-09 19:49:07 -08:00
Sergei
e74d1a4b26 Show user role under beneficiary name
- Added role field to Beneficiary type
- Display role (Custodian/Guardian/Caretaker) in small gray text under name
- Role comes from user_access table via API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 19:08:12 -08:00
Sergei
28323507f8 Remove redirect from subscription page
Redirects should only happen on the main beneficiary page (index.tsx).
Other pages (subscription, equipment, share) just show their content
without redirecting - user navigated there intentionally via menu.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 18:50:13 -08:00
Sergei
2e72398818 Fix dropdown menu - make full row clickable
- BeneficiaryMenu: dropdownItem now has width: 100%
- Increased minWidth to 180 and added overflow: hidden
- Users can now tap anywhere on the menu row, not just the text

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-09 18:41:35 -08:00
Sergei
973e9b7ebe Fix Developer Mode WebView authentication
- Add legacy dashboard API methods (eluxnetworks.net)
- Implement JWT token validation before using cached credentials
- Clear invalid tokens (non-JWT strings like "0") and force re-login
- Use correct credentials (anandk/anandk_8)
- Add 30-minute token refresh interval when WebView is active
- Fix avatar upload using expo-file-system instead of FileReader
- Handle address field as both string and object
2026-01-09 17:06:35 -08:00
Sergei
24e7f057e7 Stable version: Reusable BeneficiaryMenu, subscription fixes
- Created reusable BeneficiaryMenu component with Modal backdrop
- Menu closes on outside tap (proper Modal + Pressable implementation)
- Removed debug panel from subscription and beneficiary detail pages
- Fixed subscription creation and equipment status handling
- Backend improvements for Stripe integration
2026-01-09 13:22:56 -08:00
Sergei
06802c237b Improve subscription flow, Stripe integration & auth context
- Refactor subscription page with simplified UI flow
- Update Stripe routes and config for price handling
- Improve AuthContext with better profile management
- Fix equipment status and beneficiary screens
- Update voice screen and profile pages
- Simplify purchase flow
2026-01-08 21:35:24 -08:00
Sergei
fe4ff1a932 Simplify DB schema (name/address single fields) + subscription flow
Database:
- Simplified beneficiary schema: single `name` field instead of first_name/last_name
- Single `address` field instead of 5 separate address columns
- Added migration 008_update_notification_settings.sql

Backend:
- Updated all beneficiaries routes for new schema
- Fixed admin routes for simplified fields
- Updated notification settings routes
- Improved stripe and webhook handlers

Frontend:
- Updated all forms to use single name/address fields
- Added new equipment-status and purchase screens
- Added BeneficiaryDetailController service
- Added subscription service
- Improved navigation and auth flow
- Various UI improvements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-08 10:35:15 -08:00
Sergei
1d93311b12 Fix API endpoints to match backend routes
- GET /me/profile → GET /auth/me
- PATCH /me/profile → PATCH /auth/profile

These endpoints now correctly match the backend implementation
in backend/src/routes/auth.js
2026-01-04 12:53:12 -08:00
Sergei
d0c4930d38 Update API, invitations, beneficiaries and UI components
- Enhanced invitations system with role management
- Updated beneficiaries routes and screens
- Improved activate, purchase and profile flows
- Added Maestro E2E tests
- Added web invite acceptance page
- Database migration for roles update
2026-01-03 13:02:10 -08:00
Sergei
f6a2d5e687 Replace Alert with Toast for invite code copy, rename Share to Access 2026-01-01 13:41:34 -08:00
Sergei
b869e9e3ab Update subscription, equipment screens and auth flow 2025-12-30 21:14:24 -08:00
Sergei
f73fbf4eca Fix auth flow, types stability, and stuck loading state. Streamline login process. 2025-12-27 16:05:45 -08:00
Sergei
c80fd4ab4b Add Stripe checkout, OTP auth improvements, navigation updates
- Add purchase screen with real Stripe Checkout integration
- Add kit activation screen with dev mode notice
- Remove mock OTP mode - only serter2069@gmail.com bypasses OTP
- Fix OTP retry - show error without redirecting to email screen
- Update tab navigation: Dashboard, Chat, Profile (hide Voice)
- Update Brevo sender email to daterabbit.com domain

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-24 13:44:10 -08:00
Sergei
0b0b46ab3e Refactor auth to Email + OTP flow with dev bypass
- Convert login from username/password to email input
- Add OTP verification screen with auto-login for dev email
- Add dev email bypass (serter2069@gmail.com) using legacy anandk credentials
- Add saveEmail/getStoredEmail methods to API service
- Add email field to User type
- Clean up logout to also clear stored email

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-24 10:09:10 -08:00
Sergei
ec63a2c1e2 Add admin panel, optimized API, OTP auth, migrations
Admin Panel (Next.js):
- Dashboard with stats
- Users list with relationships (watches/watched_by)
- User detail pages
- Deployments list and detail pages
- Devices, Orders, Subscriptions pages
- OTP-based admin authentication

Backend Optimizations:
- Fixed N+1 query problem in admin APIs
- Added pagination support
- Added .range() and count support to Supabase wrapper
- Optimized batch queries with lookup maps

Database:
- Added migrations for schema evolution
- New tables: push_tokens, notification_settings
- Updated access model

iOS Build Scripts:
- build-ios.sh, clear-apple-cache.sh
- EAS configuration updates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-20 11:05:39 -08:00
Sergei
ddfe5c7bd6 Add OTP-based email authentication flow
- Replace username/password login with email OTP flow
- Add verify-otp screen with 6-digit code input
- Add complete-profile screen for new users
- Update AuthContext with refreshAuth() method
- Add new API methods: requestOTP, verifyOTP, getMe, updateProfile
- Backend: wellnuo.smartlaunchhub.com

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-19 16:53:17 -08:00
Sergei
19d24e7b00 Rename patient to beneficiary throughout the app
- Replace all 'patient' terminology with 'beneficiary'
- Add Voice AI screen (voice.tsx) with voice_ask API integration
- Optimize getAllBeneficiaries() to use single deployments_list API call
- Rename PatientDashboardData to BeneficiaryDashboardData
- Update UI components: BeneficiaryCard, beneficiary picker modal
- Update all error messages and comments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-19 12:57:48 -08:00
Sergei
8590202d53 Sync latest changes
- Updated login screen
- Updated chat screen
- Updated AuthContext
- Updated API service
- Updated packages
- Updated discussion docs and scheme

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-12 17:14:45 -08:00