import ActionLink from '@/components/shared/ActionLink' import PasswordInput from '@/components/shared/PasswordInput' import Alert from '@/components/ui/Alert' import Button from '@/components/ui/Button' import { FormContainer, FormItem } from '@/components/ui/Form' import Input from '@/components/ui/Input' import { ROUTES_ENUM } from '@/constants/route.constant' import useAuth from '@/utils/hooks/useAuth' import useTimeOutMessage from '@/utils/hooks/useTimeOutMessage' import Captcha from '@/components/shared/Captcha' import { Field, Form, Formik } from 'formik' import { useState } from 'react' import * as Yup from 'yup' type SignUpFormSchema = { password: string email: string name: string surname: string captchaResponse: string } const validationSchema = Yup.object().shape({ email: Yup.string().email('Invalid email').required('Please enter your email'), password: Yup.string().required('Please enter your password'), confirmPassword: Yup.string().oneOf([Yup.ref('password')], 'Your passwords do not match'), name: Yup.string().required('Name is required'), surname: Yup.string().required('Surname is required'), }) const Register = () => { const disableSubmit = false const signInUrl = ROUTES_ENUM.account.login const { signUp } = useAuth() const [message, setMessage] = useState('') const [error, setError] = useTimeOutMessage(10000) const onSignUp = async ( values: SignUpFormSchema, setSubmitting: (isSubmitting: boolean) => void, ) => { setSubmitting(true) const result = await signUp(values) if (result?.status === 'failed') { setError(result.message) setMessage('') } else { setMessage('Success. Please confirm your account by clicking the link.') window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }) setError('') } setSubmitting(false) } return ( <>
And lets get started with your free trial