Merged in fix/BOOK-127-translate-validation-text (pull request #2800)
fix(BOOK-127): translate terms required message * fix(BOOK-127): translate terms required message Approved-by: Erik Tiekstra
This commit is contained in:
@@ -8,6 +8,7 @@ import Link from "@scandic-hotels/design-system/Link"
|
|||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import useLang from "../../../../hooks/useLang"
|
import useLang from "../../../../hooks/useLang"
|
||||||
|
import { paymentError } from "../schema"
|
||||||
|
|
||||||
import styles from "../payment.module.css"
|
import styles from "../payment.module.css"
|
||||||
|
|
||||||
@@ -89,7 +90,17 @@ export default function TermsAndConditions({
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
</Caption>
|
</Caption>
|
||||||
<Checkbox name="termsAndConditions">
|
<Checkbox
|
||||||
|
name="termsAndConditions"
|
||||||
|
registerOptions={{
|
||||||
|
required: true,
|
||||||
|
}}
|
||||||
|
errorCodeMessages={{
|
||||||
|
[paymentError.TERMS_REQUIRED]: intl.formatMessage({
|
||||||
|
defaultMessage: "You must accept the terms and conditions",
|
||||||
|
}),
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Typography variant="Body/Paragraph/mdBold">
|
<Typography variant="Body/Paragraph/mdBold">
|
||||||
<span>
|
<span>
|
||||||
{intl.formatMessage({
|
{intl.formatMessage({
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
|
export enum paymentError {
|
||||||
|
TERMS_REQUIRED = "TERMS_REQUIRED",
|
||||||
|
}
|
||||||
|
|
||||||
export const paymentSchema = z.object({
|
export const paymentSchema = z.object({
|
||||||
paymentMethod: z.string().nullish(),
|
paymentMethod: z.string().nullish(),
|
||||||
smsConfirmation: z.boolean(),
|
smsConfirmation: z.boolean(),
|
||||||
termsAndConditions: z.boolean().refine((value) => value === true, {
|
termsAndConditions: z
|
||||||
message: "You must accept the terms and conditions",
|
.boolean()
|
||||||
}),
|
.refine((value) => value === true, paymentError.TERMS_REQUIRED),
|
||||||
guarantee: z.boolean(),
|
guarantee: z.boolean(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user