feat: make sure correct data is sent to tracking
This commit is contained in:
committed by
Simon.Emanuelsson
parent
1a28bcdc4c
commit
e082bf2e50
@@ -4,7 +4,6 @@ import { BookingStatusEnum, ChildBedTypeEnum } from "@/constants/booking"
|
||||
|
||||
import { calculateRefId } from "@/utils/refId"
|
||||
import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator"
|
||||
import { nullableIntValidator } from "@/utils/zod/numberValidator"
|
||||
import {
|
||||
nullableStringEmailValidator,
|
||||
nullableStringValidator,
|
||||
@@ -97,30 +96,30 @@ const childBedPreferencesSchema = z.object({
|
||||
code: z.string().nullable().default(""),
|
||||
})
|
||||
|
||||
const priceSchema = z.object({
|
||||
currency: z.nativeEnum(CurrencyEnum).default(CurrencyEnum.Unknown),
|
||||
totalPrice: z.number().nullish(),
|
||||
totalUnit: z.number().int().nullish(),
|
||||
unit: z.number().int().nullish(),
|
||||
unitPrice: z.number(),
|
||||
})
|
||||
|
||||
export const packageSchema = z
|
||||
.object({
|
||||
type: z.string().nullish(),
|
||||
description: nullableStringValidator,
|
||||
code: nullableStringValidator,
|
||||
price: z.object({
|
||||
unit: z.number().int().nullish(),
|
||||
unitPrice: z.number(),
|
||||
totalPrice: z.number().nullish(),
|
||||
totalUnit: z.number().int().nullish(),
|
||||
currency: z.nativeEnum(CurrencyEnum).default(CurrencyEnum.Unknown),
|
||||
points: nullableIntValidator,
|
||||
}),
|
||||
comment: z.string().nullish(),
|
||||
description: nullableStringValidator,
|
||||
price: priceSchema,
|
||||
type: z.string().nullish(),
|
||||
})
|
||||
.transform((packageData) => ({
|
||||
type: packageData.type,
|
||||
description: packageData.description,
|
||||
comment: packageData.comment,
|
||||
code: packageData.code,
|
||||
comment: packageData.comment,
|
||||
currency: packageData.price.currency,
|
||||
points: packageData.price.points ?? null,
|
||||
description: packageData.description,
|
||||
totalPrice: packageData.price.totalPrice ?? 0,
|
||||
totalUnit: packageData.price.totalUnit ?? 0,
|
||||
type: packageData.type,
|
||||
unit: packageData.price.unit ?? 0,
|
||||
unitPrice: packageData.price.unitPrice,
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user