diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx index 8c793e3426..0f9eb6110f 100644 --- a/apps/web/components/booking/pages/BookingPage.tsx +++ b/apps/web/components/booking/pages/BookingPage.tsx @@ -11,6 +11,7 @@ import { import { zodResolver } from "@hookform/resolvers/zod"; import { EventTypeCustomInputType } from "@prisma/client"; import { useContracts } from "contexts/contractsContext"; +import { isValidPhoneNumber } from "libphonenumber-js"; import { useSession } from "next-auth/react"; import dynamic from "next/dynamic"; import Head from "next/head"; @@ -278,6 +279,10 @@ const BookingPage = ({ .object({ name: z.string().min(1), email: z.string().email(), + phone: z + .string() + .refine((val) => isValidPhoneNumber(val)) + .optional(), }) .passthrough(); @@ -656,6 +661,12 @@ const BookingPage = ({ disabled={disableInput} /> + {bookingForm.formState.errors.phone && ( +
{t("invalid_number")}
+Invalid input
+{t("invalid_number")}
)} diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 8b4a529f14..46fbd44772 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -919,11 +919,12 @@ "specific_issue": "Have a specific issue", "browse_our_docs": "browse our docs", "broken_video_action": "We could not add the <1>{{location}}1> meeting link to your scheduled event. Contact your invitees or update your calendar event to add the details. You can either <3> change your location on the event type 3> or try <5>removing and adding the app again.5>", - "broken_calendar_action": "We could not update your <1>{{calendar}}1>. <2> Please check your calendar settings or remove and add your calendar again 2>", + "broken_calendar_action": "We could not update your <1>{{calendar}}1>. <2> Please check your calendar settings or remove and add your calendar again 2>", "attendee_name": "Attendee's name", "broken_integration": "Broken integration", "problem_adding_video_link": "There was a problem adding a video link", "problem_updating_calendar": "There was a problem updating your calendar", "new_seat_subject": "New Attendee {{name}} on {{eventType}} at {{date}}", - "new_seat_title": "Someone has added themselves to an event" + "new_seat_title": "Someone has added themselves to an event", + "invalid_number": "Invalid phone number" }