From af9cce3b559c1ad1856cdd1dfa3bea06a88d7be0 Mon Sep 17 00:00:00 2001 From: Eric Richardson Date: Thu, 6 Jun 2024 10:01:12 -0400 Subject: [PATCH] make hcaptcha token optional when disabled --- libs/cdd-types/src/lib/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/cdd-types/src/lib/utils.ts b/libs/cdd-types/src/lib/utils.ts index 2227f81..06f1048 100644 --- a/libs/cdd-types/src/lib/utils.ts +++ b/libs/cdd-types/src/lib/utils.ts @@ -28,4 +28,7 @@ export const addressZ = extendApi( } ); -export const hCaptcha = z.string().nonempty("hCaptcha validation token is required"); \ No newline at end of file +export const hCaptcha = + process.env['HCAPTCHA_IS_ENABLED'] === 'true' + ? z.string().nonempty('hCaptcha validation token is required') + : z.optional(z.string());