feat: Complete onboarding system with No Website functionality

- Add No Website button to Step 2 with business description form
- Implement onboarding cache service for browser-side data storage
- Add business info database models and API endpoints
- Update API key manager to save keys to .env file immediately
- Add database migration scripts for business info table
- Create reset onboarding script for fresh starts
- Implement hybrid data storage (API keys to backend, other data to cache)
- Add comprehensive business info CRUD operations
- Include database table creation and migration tools
This commit is contained in:
Om-Singh1808
2025-09-04 11:03:35 +05:30
committed by DikshaDisciplines
parent dca2318235
commit d86336dcf1

View File

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Box, Button, TextField, Typography, Card, CardContent, CircularProgress, Alert } from '@mui/material';
import { ArrowBack as ArrowBackIcon, Save as SaveIcon, CheckCircle as CheckCircleIcon } from '@mui/icons-material';
import { businessInfoApi, BusinessInfo } from '../../api/businessInfo';
import { onboardingCache } from '../../services/onboardingCache';
interface BusinessDescriptionStepProps {
onBack: () => void;
@@ -19,6 +20,17 @@ const BusinessDescriptionStep: React.FC<BusinessDescriptionStepProps> = ({ onBac
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState<string | null>(null);
useEffect(() => {
console.log('🔄 BusinessDescriptionStep mounted. Loading cached data...');
const cachedData = onboardingCache.getStepData(2)?.businessInfo;
if (cachedData) {
setFormData(cachedData);
console.log('✅ Loaded cached business info:', cachedData);
} else {
console.log(' No cached business info found.');
}
}, []);
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
const { name, value } = e.target;
setFormData(prev => ({ ...prev, [name]: value }));
@@ -39,6 +51,10 @@ const BusinessDescriptionStep: React.FC<BusinessDescriptionStepProps> = ({ onBac
console.log('✅ Business info saved to DB:', response);
setSuccess('Business information saved successfully!');
// Also save to cache for consistency with other steps
onboardingCache.saveStepData(2, { businessInfo: response, hasWebsite: false });
console.log('✅ Business info saved to cache.');
setTimeout(() => {
onContinue();
}, 1500); // Give user time to see success message