diff --git a/frontend/src/components/domain/auth/RegisterForm.tsx b/frontend/src/components/domain/auth/RegisterForm.tsx
index 679ea4b3..74ba20f9 100644
--- a/frontend/src/components/domain/auth/RegisterForm.tsx
+++ b/frontend/src/components/domain/auth/RegisterForm.tsx
@@ -3,6 +3,7 @@ import { Button, Input, Card } from '../../ui';
import { useAuth } from '../../../hooks/api/useAuth';
import { UserRegistration } from '../../../types/auth.types';
import { useToast } from '../../../hooks/ui/useToast';
+import { isMockRegistration } from '../../../config/mock.config';
interface RegisterFormProps {
onSuccess?: () => void;
@@ -36,7 +37,7 @@ export const RegisterForm: React.FC = ({
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const { register, isLoading, error } = useAuth();
- const { showToast } = useToast();
+ const { success: showSuccessToast, error: showErrorToast } = useToast();
const validateForm = (): boolean => {
const newErrors: Partial = {};
@@ -75,6 +76,35 @@ export const RegisterForm: React.FC = ({
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
+ console.log('Form submitted, mock mode:', isMockRegistration());
+
+ // FORCED MOCK MODE FOR TESTING - Always bypass for now
+ const FORCE_MOCK = true;
+ if (FORCE_MOCK || isMockRegistration()) {
+ console.log('Mock registration triggered, showing toast and calling onSuccess');
+ // Show immediate success notification
+ try {
+ showSuccessToast('¡Bienvenido! Tu cuenta ha sido creada correctamente.', {
+ title: 'Cuenta creada exitosamente'
+ });
+ console.log('Toast shown, calling onSuccess callback');
+ } catch (error) {
+ console.error('Error showing toast:', error);
+ // Fallback: show browser alert if toast fails
+ alert('¡Cuenta creada exitosamente! Redirigiendo al onboarding...');
+ }
+
+ // Call success immediately (removing delay for easier testing)
+ try {
+ onSuccess?.();
+ console.log('onSuccess called');
+ } catch (error) {
+ console.error('Error calling onSuccess:', error);
+ // Fallback: direct redirect if callback fails
+ window.location.href = '/app/onboarding/setup';
+ }
+ return;
+ }
if (!validateForm()) {
return;
@@ -92,24 +122,18 @@ export const RegisterForm: React.FC = ({
const success = await register(registrationData);
if (success) {
- showToast({
- type: 'success',
- title: 'Cuenta creada exitosamente',
- message: '¡Bienvenido! Tu cuenta ha sido creada correctamente.'
+ showSuccessToast('¡Bienvenido! Tu cuenta ha sido creada correctamente.', {
+ title: 'Cuenta creada exitosamente'
});
onSuccess?.();
} else {
- showToast({
- type: 'error',
- title: 'Error al crear la cuenta',
- message: error || 'No se pudo crear la cuenta. Verifica que el email no esté en uso.'
+ showErrorToast(error || 'No se pudo crear la cuenta. Verifica que el email no esté en uso.', {
+ title: 'Error al crear la cuenta'
});
}
} catch (err) {
- showToast({
- type: 'error',
- title: 'Error de conexión',
- message: 'No se pudo conectar con el servidor. Verifica tu conexión a internet.'
+ showErrorToast('No se pudo conectar con el servidor. Verifica tu conexión a internet.', {
+ title: 'Error de conexión'
});
}
};
@@ -270,6 +294,10 @@ export const RegisterForm: React.FC = ({
loadingText="Creando cuenta..."
disabled={isLoading}
className="w-full"
+ onClick={(e) => {
+ console.log('Button clicked!');
+ // Let form submit handle it naturally
+ }}
>
Crear Cuenta
diff --git a/frontend/src/config/mock.config.ts b/frontend/src/config/mock.config.ts
new file mode 100644
index 00000000..95810efb
--- /dev/null
+++ b/frontend/src/config/mock.config.ts
@@ -0,0 +1,37 @@
+/**
+ * Mock configuration for testing the complete onboarding flow
+ * Set MOCK_MODE to false for production
+ */
+
+export const MOCK_CONFIG = {
+ // Global mock mode toggle
+ MOCK_MODE: true,
+
+ // Component-specific toggles
+ MOCK_REGISTRATION: true,
+ MOCK_AUTHENTICATION: true,
+ MOCK_ONBOARDING_FLOW: true,
+
+ // Mock user data
+ MOCK_USER: {
+ full_name: 'María García López',
+ email: 'maria.garcia@elbuenpan.com',
+ role: 'admin',
+ tenant_name: 'Panadería Artesanal El Buen Pan'
+ },
+
+ // Mock bakery data
+ MOCK_BAKERY: {
+ name: 'Panadería Artesanal El Buen Pan',
+ type: 'artisan',
+ location: 'Av. Principal 123, Centro Histórico',
+ phone: '+1 234 567 8900',
+ email: 'info@elbuenpan.com'
+ }
+};
+
+// Helper function to check if mock mode is enabled
+export const isMockMode = () => MOCK_CONFIG.MOCK_MODE;
+export const isMockRegistration = () => MOCK_CONFIG.MOCK_MODE && MOCK_CONFIG.MOCK_REGISTRATION;
+export const isMockAuthentication = () => MOCK_CONFIG.MOCK_MODE && MOCK_CONFIG.MOCK_AUTHENTICATION;
+export const isMockOnboardingFlow = () => MOCK_CONFIG.MOCK_MODE && MOCK_CONFIG.MOCK_ONBOARDING_FLOW;
\ No newline at end of file
diff --git a/frontend/src/pages/app/onboarding/analysis/OnboardingAnalysisPage.tsx b/frontend/src/pages/app/onboarding/analysis/OnboardingAnalysisPage.tsx
index 83b383cb..fe865b30 100644
--- a/frontend/src/pages/app/onboarding/analysis/OnboardingAnalysisPage.tsx
+++ b/frontend/src/pages/app/onboarding/analysis/OnboardingAnalysisPage.tsx
@@ -428,6 +428,22 @@ const OnboardingAnalysisPage: React.FC = () => {
))}
+
+ {/* Navigation */}
+
+
+
+
+
);
};
diff --git a/frontend/src/pages/app/onboarding/review/OnboardingReviewPage.tsx b/frontend/src/pages/app/onboarding/review/OnboardingReviewPage.tsx
index 44a715da..907ca35e 100644
--- a/frontend/src/pages/app/onboarding/review/OnboardingReviewPage.tsx
+++ b/frontend/src/pages/app/onboarding/review/OnboardingReviewPage.tsx
@@ -560,7 +560,13 @@ const OnboardingReviewPage: React.FC = () => {
y el sistema está preparado para comenzar a operar.