import { EmailField } from '@components/common/form/EmailField.js'; import { Form, useFormContext } from '@components/common/form/Form.js'; import { InputField } from '@components/common/form/InputField.js'; import { PasswordField } from '@components/common/form/PasswordField.js'; import { Area } from '@components/common/index.js'; import { Button } from '@components/common/ui/Button.js'; import { useCustomerDispatch } from '@components/frontStore/customer/CustomerContext.js'; import { _ } from '@evershop/evershop/lib/locale/translate/_'; import { LockKeyhole, Mail, User } from 'lucide-react'; import React from 'react'; const SubmitButton: React.FC<{ formId: string }> = ({ formId }) => { const { formState: { isSubmitting } } = useFormContext(); return (
); }; export const CustomerRegistrationForm: React.FC<{ title?: string; subtitle?: string; className?: string; redirectUrl: string; onError?: (error: string) => void; }> = ({ title, subtitle, redirectUrl, onError, className }) => { const { register } = useCustomerDispatch(); return (
{title && (

{_(title)}

)} {subtitle && (

{_(subtitle)}

)}
{ try { await register( { full_name: data.full_name, email: data.email, password: data.password, ...data }, true, redirectUrl ); } catch (error) { onError?.(error.message); } }} submitBtn={false} > } name="full_name" label={_('Full Name')} placeholder={_('Full Name')} required validation={{ required: _('Full Name is required') }} /> ) }, sortOrder: 10 }, { component: { default: ( } name="email" label={_('Email')} placeholder={_('Email')} required validation={{ required: _('Email is required') }} /> ) }, sortOrder: 20 }, { component: { default: ( } name="password" label={_('Password')} placeholder={_('Password')} required showToggle validation={{ required: _('Password is required') }} /> ) }, sortOrder: 30 }, { component: { default: }, sortOrder: 40 } ]} />
); };