fullcart
Version:
Add stripe checkout to any website
19 lines (15 loc) • 508 B
text/typescript
import { z } from 'astro/zod'
import { errorMap } from 'zod-validation-error'
import { configSchema } from './configSchema'
import { customerSchema } from './customerSchema'
import { productSchema } from './productSchema'
z.setErrorMap(errorMap as any)
export const cartSchema = configSchema.omit({ products: true }).extend({
lines: customerSchema.shape.lines.element
.extend({
product: productSchema,
})
.array(),
total: z.number(),
})
export type Cart = z.infer<typeof cartSchema>