Merged in fix/STAY-73-opt-in-email (pull request #3028)
Fix/STAY-73 opt in email * fix: let user opt-in for modification email when adding ancillaries * fix: add toast when successfully removing an ancillary Approved-by: Erik Tiekstra Approved-by: Elin Svedin
This commit is contained in:
@@ -7,6 +7,11 @@ const quantitySchemaWithoutRefine = z.object({
|
||||
quantityWithCard: z.number().nullable(),
|
||||
})
|
||||
|
||||
export const ancillaryError = {
|
||||
TERMS_NOT_ACCEPTED: "TERMS_NOT_ACCEPTED",
|
||||
MIN_QUANTITY_NOT_REACHED: "MIN_QUANTITY_NOT_REACHED",
|
||||
} as const
|
||||
|
||||
export const quantitySchema = z
|
||||
.object({})
|
||||
.merge(quantitySchemaWithoutRefine)
|
||||
@@ -14,7 +19,7 @@ export const quantitySchema = z
|
||||
(data) =>
|
||||
(data.quantityWithPoints ?? 0) > 0 || (data.quantityWithCard ?? 0) > 0,
|
||||
{
|
||||
message: "You must select at least one quantity",
|
||||
message: ancillaryError.MIN_QUANTITY_NOT_REACHED,
|
||||
path: ["quantityWithCard"],
|
||||
}
|
||||
)
|
||||
@@ -23,7 +28,10 @@ export const ancillaryFormSchema = z
|
||||
.object({
|
||||
deliveryTime: z.string(),
|
||||
optionalText: z.string(),
|
||||
termsAndConditions: z.boolean(),
|
||||
termsAndConditions: z
|
||||
.boolean()
|
||||
.refine((value) => value === true, ancillaryError.TERMS_NOT_ACCEPTED),
|
||||
optInEmail: z.boolean(),
|
||||
paymentMethod: nullableStringValidator,
|
||||
})
|
||||
.merge(quantitySchemaWithoutRefine)
|
||||
@@ -31,7 +39,7 @@ export const ancillaryFormSchema = z
|
||||
(data) =>
|
||||
(data.quantityWithPoints ?? 0) > 0 || (data.quantityWithCard ?? 0) > 0,
|
||||
{
|
||||
message: "You must select at least one quantity",
|
||||
message: ancillaryError.MIN_QUANTITY_NOT_REACHED,
|
||||
path: ["quantityWithCard"],
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user