diff --git a/components/HotelReservation/EnterDetails/Details/schema.ts b/components/HotelReservation/EnterDetails/Details/schema.ts index c17883890..8a8f92b07 100644 --- a/components/HotelReservation/EnterDetails/Details/schema.ts +++ b/components/HotelReservation/EnterDetails/Details/schema.ts @@ -2,11 +2,25 @@ import { z } from "zod" import { phoneValidator } from "@/utils/phoneValidator" +const stringMatcher = /^[\p{L}\s\-\.]+$/u + +const isValidString = (key: string) => stringMatcher.test(key) + export const baseDetailsSchema = z.object({ - countryCode: z.string(), - email: z.string().email(), - firstName: z.string(), - lastName: z.string(), + countryCode: z.string().min(1, { message: "Country is required" }), + email: z.string().email({ message: "Email address is required" }), + firstName: z + .string() + .min(1, { message: "First name is required" }) + .refine(isValidString, { + message: "First name can't contain any special charachters", + }), + lastName: z + .string() + .min(1, { message: "Last name is required" }) + .refine(isValidString, { + message: "Last name can't contain any special charachters", + }), phoneNumber: phoneValidator(), }) diff --git a/i18n/dictionaries/da.json b/i18n/dictionaries/da.json index 7f2f2c2e1..ab489fcc6 100644 --- a/i18n/dictionaries/da.json +++ b/i18n/dictionaries/da.json @@ -95,6 +95,7 @@ "Could not find requested resource": "Kunne ikke finde den anmodede ressource", "Country": "Land", "Country code": "Landekode", + "Country is required": "Land er påkrævet", "Creative spaces for meetings": "Kreative rum til møder", "Credit card": "Kreditkort", "Credit card deleted successfully": "Kreditkort blev slettet", @@ -124,6 +125,7 @@ "Edit profile": "Rediger profil", "Email": "E-mail", "Email address": "E-mailadresse", + "Email address is required": "Email address is required", "Enjoy relaxed restaurant experiences": "Enjoy relaxed restaurant experiences", "Enter destination or hotel": "Indtast destination eller hotel", "Enter your details": "Indtast dine oplysninger", @@ -141,6 +143,8 @@ "Find booking": "Find booking", "Find hotels": "Find hotel", "First name": "Fornavn", + "First name can't contain any special charachters": "Fornavn kan ikke indeholde specielle tegn", + "First name is required": "Fornavn er påkrævet", "Flexibility": "Fleksibilitet", "Follow us": "Følg os", "Food options": "Madvalg", @@ -190,6 +194,8 @@ "King bed": "Kingsize-seng", "Language": "Sprog", "Last name": "Efternavn", + "Last name can't contain any special charachters": "Efternavn kan ikke indeholde specielle tegn", + "Last name is required": "Efternavn er påkrævet", "Latest searches": "Seneste søgninger", "Left": "tilbage", "Level": "Niveau", diff --git a/i18n/dictionaries/de.json b/i18n/dictionaries/de.json index cc302974d..8003f98cb 100644 --- a/i18n/dictionaries/de.json +++ b/i18n/dictionaries/de.json @@ -95,6 +95,7 @@ "Could not find requested resource": "Die angeforderte Ressource konnte nicht gefunden werden.", "Country": "Land", "Country code": "Landesvorwahl", + "Country is required": "Land ist erforderlich", "Creative spaces for meetings": "Kreative Räume für Meetings", "Credit card": "Kreditkarte", "Credit card deleted successfully": "Kreditkarte erfolgreich gelöscht", @@ -124,6 +125,7 @@ "Edit profile": "Profil bearbeiten", "Email": "Email", "Email address": "E-Mail-Adresse", + "Email address is required": "E-Mail-Adresse ist erforderlich", "Enjoy relaxed restaurant experiences": "Enjoy relaxed restaurant experiences", "Enter destination or hotel": "Reiseziel oder Hotel eingeben", "Enter your details": "Geben Sie Ihre Daten ein", @@ -141,6 +143,8 @@ "Find booking": "Buchung finden", "Find hotels": "Hotels finden", "First name": "Vorname", + "First name can't contain any special charachters": "Der Vorname darf keine Sonderzeichen enthalten", + "First name is required": "Vorname ist erforderlich", "Flexibility": "Flexibilität", "Follow us": "Folgen Sie uns", "Food options": "Speisen & Getränke", @@ -190,6 +194,8 @@ "King bed": "Kingsize-Bett", "Language": "Sprache", "Last name": "Nachname", + "Last name can't contain any special charachters": "Der Nachname darf keine Sonderzeichen enthalten", + "Last name is required": "Nachname ist erforderlich", "Latest searches": "Letzte Suchanfragen", "Left": "übrig", "Level": "Level", diff --git a/i18n/dictionaries/en.json b/i18n/dictionaries/en.json index ec64caa3a..a03910e8e 100644 --- a/i18n/dictionaries/en.json +++ b/i18n/dictionaries/en.json @@ -103,6 +103,7 @@ "Could not find requested resource": "Could not find requested resource", "Country": "Country", "Country code": "Country code", + "Country is required": "Country is required", "Creative spaces for meetings": "Creative spaces for meetings", "Credit card": "Credit card", "Credit card deleted successfully": "Credit card deleted successfully", @@ -134,6 +135,7 @@ "Edit profile": "Edit profile", "Email": "Email", "Email address": "Email address", + "Email address is required": "Email address is required", "Enjoy relaxed restaurant experiences": "Enjoy relaxed restaurant experiences", "Enter destination or hotel": "Enter destination or hotel", "Enter your details": "Enter your details", @@ -151,6 +153,8 @@ "Find booking": "Find booking", "Find hotels": "Find hotels", "First name": "First name", + "First name can't contain any special charachters": "First name can't contain any special charachters", + "First name is required": "First name is required", "Flexibility": "Flexibility", "Follow us": "Follow us", "Food options": "Food options", @@ -206,6 +210,8 @@ "King bed": "King bed", "Language": "Language", "Last name": "Last name", + "Last name can't contain any special charachters": "Last name can't contain any special charachters", + "Last name is required": "Last name is required", "Latest searches": "Latest searches", "Latitude": "Latitude {lat}", "Left": "left", diff --git a/i18n/dictionaries/fi.json b/i18n/dictionaries/fi.json index 79d7ecfb2..69f7fdc41 100644 --- a/i18n/dictionaries/fi.json +++ b/i18n/dictionaries/fi.json @@ -95,6 +95,7 @@ "Could not find requested resource": "Pyydettyä resurssia ei löytynyt", "Country": "Maa", "Country code": "Maatunnus", + "Country is required": "Maa vaaditaan", "Creative spaces for meetings": "Luovia tiloja kokouksille", "Credit card": "Luottokortti", "Credit card deleted successfully": "Luottokortti poistettu onnistuneesti", @@ -124,6 +125,7 @@ "Edit profile": "Muokkaa profiilia", "Email": "Sähköposti", "Email address": "Sähköpostiosoite", + "Email address is required": "Sähköpostiosoite vaaditaan", "Enjoy relaxed restaurant experiences": "Enjoy relaxed restaurant experiences", "Enter destination or hotel": "Anna kohde tai hotelli", "Enter your details": "Anna tietosi", @@ -141,6 +143,8 @@ "Find booking": "Etsi varaus", "Find hotels": "Etsi hotelleja", "First name": "Etunimi", + "First name can't contain any special charachters": "Etunimi ei voi sisältää erikoismerkkejä", + "First name is required": "Etunimi vaaditaan", "Flexibility": "Joustavuus", "Follow us": "Seuraa meitä", "Food options": "Ruokavalio", @@ -190,6 +194,8 @@ "King bed": "King-vuode", "Language": "Kieli", "Last name": "Sukunimi", + "Last name can't contain any special charachters": "Sukunimi ei voi sisältää erikoismerkkejä", + "Last name is required": "Sukunimi vaaditaan", "Latest searches": "Viimeisimmät haut", "Left": "jäljellä", "Level": "Level", diff --git a/i18n/dictionaries/no.json b/i18n/dictionaries/no.json index fa8b3e79a..5f8855417 100644 --- a/i18n/dictionaries/no.json +++ b/i18n/dictionaries/no.json @@ -95,6 +95,7 @@ "Could not find requested resource": "Kunne ikke finne den forespurte ressursen", "Country": "Land", "Country code": "Landskode", + "Country is required": "Land kreves", "Creative spaces for meetings": "Kreative rom for møter", "Credit card deleted successfully": "Kredittkort slettet", "Currency Code": "NOK", @@ -123,6 +124,7 @@ "Edit profile": "Rediger profil", "Email": "E-post", "Email address": "E-postadresse", + "Email address is required": "E-postadresse kreves", "Enjoy relaxed restaurant experiences": "Enjoy relaxed restaurant experiences", "Enter destination or hotel": "Skriv inn destinasjon eller hotell", "Enter your details": "Skriv inn detaljene dine", @@ -140,6 +142,8 @@ "Find booking": "Finn booking", "Find hotels": "Finn hotell", "First name": "Fornavn", + "First name can't contain any special charachters": "Fornavn kan ikke inneholde spesielle tegn", + "First name is required": "Fornavn kreves", "Flexibility": "Fleksibilitet", "Follow us": "Følg oss", "Food options": "Matvalg", @@ -188,6 +192,8 @@ "King bed": "King-size-seng", "Language": "Språk", "Last name": "Etternavn", + "Last name can't contain any special charachters": "Etternavn kan ikke inneholde spesielle tegn", + "Last name is required": "Etternavn kreves", "Latest searches": "Siste søk", "Left": "igjen", "Level": "Nivå", diff --git a/i18n/dictionaries/sv.json b/i18n/dictionaries/sv.json index ea2e8e6b5..fd945aa99 100644 --- a/i18n/dictionaries/sv.json +++ b/i18n/dictionaries/sv.json @@ -95,6 +95,7 @@ "Could not find requested resource": "Det gick inte att hitta den begärda resursen", "Country": "Land", "Country code": "Landskod", + "Country is required": "Land är obligatoriskt", "Creative spaces for meetings": "Kreativa utrymmen för möten", "Credit card deleted successfully": "Kreditkort har tagits bort", "Currency Code": "SEK", @@ -123,6 +124,7 @@ "Edit profile": "Redigera profil", "Email": "E-post", "Email address": "E-postadress", + "Email address is required": "E-postadress är obligatorisk", "Enjoy relaxed restaurant experiences": "Enjoy relaxed restaurant experiences", "Enter destination or hotel": "Ange destination eller hotell", "Enter your details": "Ange dina uppgifter", @@ -140,6 +142,8 @@ "Find booking": "Hitta bokning", "Find hotels": "Hitta hotell", "First name": "Förnamn", + "First name can't contain any special charachters": "Förnamn får inte innehålla några specialtecken", + "First name is required": "Förnamn är obligatoriskt", "Flexibility": "Flexibilitet", "Follow us": "Följ oss", "Food options": "Matval", @@ -189,6 +193,8 @@ "King bed": "King size-säng", "Language": "Språk", "Last name": "Efternamn", + "Last name can't contain any special charachters": "Efternamn får inte innehålla några specialtecken", + "Last name is required": "Efternamn är obligatoriskt", "Latest searches": "Senaste sökningarna", "Left": "kvar", "Level": "Nivå",