diff --git a/src/app/[lang]/identification/form.tsx b/src/app/[lang]/identification/form.tsx index 58a37818..7b2b3340 100644 --- a/src/app/[lang]/identification/form.tsx +++ b/src/app/[lang]/identification/form.tsx @@ -45,7 +45,7 @@ export function Form() { watch, } = useForm({ reValidateMode: 'onSubmit', - resolver: zodResolver(createCedulaSchema({ intl })), + resolver: zodResolver(createCedulaSchema(intl)), }); const cedulaFormValue = watch('cedula', ''); diff --git a/src/app/[lang]/liveness/form.tsx b/src/app/[lang]/liveness/form.tsx index 2def8b5a..f20be221 100644 --- a/src/app/[lang]/liveness/form.tsx +++ b/src/app/[lang]/liveness/form.tsx @@ -45,7 +45,7 @@ export function Form({ cedula }: Props) { register, formState: { errors }, } = useForm({ - resolver: zodResolver(createTermsSchema({ intl })), + resolver: zodResolver(createTermsSchema(intl)), }); const onSubmit = handleSubmit(() => setOpen(true)); diff --git a/src/app/[lang]/register/form.tsx b/src/app/[lang]/register/form.tsx index 114cfe61..0653d217 100644 --- a/src/app/[lang]/register/form.tsx +++ b/src/app/[lang]/register/form.tsx @@ -87,7 +87,7 @@ export function Form({ cedula }: Props) { watch, } = useForm({ mode: 'onChange', - resolver: zodResolver(createRegisterSchema({ intl }, cedula)), + resolver: zodResolver(createRegisterSchema(intl, cedula)), }); const password = watch('password'); diff --git a/src/app/[lang]/verification/form.tsx b/src/app/[lang]/verification/form.tsx index 4cba2db3..1c7301be 100644 --- a/src/app/[lang]/verification/form.tsx +++ b/src/app/[lang]/verification/form.tsx @@ -36,7 +36,7 @@ export function Form({ flow, returnTo, code }: Props) { const { handleSubmit, setValue } = useForm({ reValidateMode: 'onSubmit', - resolver: zodResolver(createVerificationSchema({ intl })), + resolver: zodResolver(createVerificationSchema(intl)), }); const [loading, setLoading] = useState(false); diff --git a/src/common/validation-schemas/cedula.schema.ts b/src/common/validation-schemas/cedula.schema.ts index 03e2ca7d..a8200ec2 100644 --- a/src/common/validation-schemas/cedula.schema.ts +++ b/src/common/validation-schemas/cedula.schema.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; import { Context } from '@/app/[lang]/provider'; -export const createCedulaSchema = ({ intl: { validations } }: Context) => +export const createCedulaSchema = ({ validations }: Context['intl']) => z.object({ cedula: z .string() diff --git a/src/common/validation-schemas/register.schema.ts b/src/common/validation-schemas/register.schema.ts index 0a95ce68..bf74c694 100644 --- a/src/common/validation-schemas/register.schema.ts +++ b/src/common/validation-schemas/register.schema.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; import { Context } from '@/app/[lang]/provider'; export const createRegisterSchema = ( - { intl: { validations } }: Context, + { validations }: Context['intl'], cedula: string, ) => z diff --git a/src/common/validation-schemas/report.schema.ts b/src/common/validation-schemas/report.schema.ts index 6350bed1..15741664 100644 --- a/src/common/validation-schemas/report.schema.ts +++ b/src/common/validation-schemas/report.schema.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; import { Context } from '@/app/[lang]/provider'; -export const createReportSchema = ({ intl: { validations } }: Context) => +export const createReportSchema = ({ validations }: Context['intl']) => z.object({ email: z.string().email(validations.email.invalid), name: z.string().optional(), diff --git a/src/common/validation-schemas/terms.schema.ts b/src/common/validation-schemas/terms.schema.ts index fde1a2fb..9e82fc89 100644 --- a/src/common/validation-schemas/terms.schema.ts +++ b/src/common/validation-schemas/terms.schema.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; import { Context } from '@/app/[lang]/provider'; -export const createTermsSchema = ({ intl }: Context) => +export const createTermsSchema = (intl: Context['intl']) => z.object({ accepted: z.literal(true, { required_error: intl.terms.check, diff --git a/src/common/validation-schemas/verification.schema.ts b/src/common/validation-schemas/verification.schema.ts index a246a872..b941600d 100644 --- a/src/common/validation-schemas/verification.schema.ts +++ b/src/common/validation-schemas/verification.schema.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; import { Context } from '@/app/[lang]/provider'; -export const createVerificationSchema = ({ intl: { validations } }: Context) => +export const createVerificationSchema = ({ validations }: Context['intl']) => z.object({ code: z.string().min(6, validations.code.min).max(6, validations.code.max), }); diff --git a/src/components/LivenessQuickStart/index.tsx b/src/components/LivenessQuickStart/index.tsx index 964b9d98..70170749 100644 --- a/src/components/LivenessQuickStart/index.tsx +++ b/src/components/LivenessQuickStart/index.tsx @@ -29,7 +29,7 @@ export function LivenessQuickStart({ cedula }: Props) { const { intl } = useLanguage(); - const displayText = useLocalizedText({ intl }); + const displayText = useLocalizedText(intl); const fetchCreateLiveness: () => Promise = async () => { await fetch(`/api/biometric`, { method: 'POST' }) diff --git a/src/components/LivenessQuickStart/localizedText.ts b/src/components/LivenessQuickStart/localizedText.ts index dfcb7d29..7251a855 100644 --- a/src/components/LivenessQuickStart/localizedText.ts +++ b/src/components/LivenessQuickStart/localizedText.ts @@ -9,10 +9,8 @@ import type { } from '@aws-amplify/ui-react-liveness/dist/types/components/FaceLivenessDetector/displayText'; export const useLocalizedText = ({ - intl: { - liveness: { hints, camera, instructions, stream, error }, - }, -}: Context) => + liveness: { hints, camera, instructions, stream, error }, +}: Context['intl']) => ({ ...({ hintMoveFaceFrontOfCameraText: hints.moveFaceFrontOfCamera, diff --git a/src/components/UserFeedbackModal/index.tsx b/src/components/UserFeedbackModal/index.tsx index 4824ab2d..398c9fca 100644 --- a/src/components/UserFeedbackModal/index.tsx +++ b/src/components/UserFeedbackModal/index.tsx @@ -27,7 +27,7 @@ export default function UserFeedbackModal({ open, onClose }: Props) { register, reset, } = useForm({ - resolver: zodResolver(createReportSchema({ intl })), + resolver: zodResolver(createReportSchema(intl)), }); const sendFeedback = handleSubmit(({ email, comments, name = '' }) => {