Files
cfw-autumn/vite/src/components/forms/attach-v2/attachFormSchema.ts
2026-02-06 11:37:39 -08:00

20 lines
575 B
TypeScript

import {
FreeTrialDuration,
type PlanTiming,
type ProductItem,
} from "@autumn/shared";
import { z } from "zod/v4";
export const AttachFormSchema = z.object({
productId: z.string(),
prepaidOptions: z.record(z.string(), z.number().nonnegative()),
items: z.custom<ProductItem[]>().nullable(),
version: z.number().positive().optional(),
trialLength: z.number().positive().nullable(),
trialDuration: z.enum(FreeTrialDuration),
trialEnabled: z.boolean(),
planSchedule: z.custom<PlanTiming>().nullable(),
});
export type AttachForm = z.infer<typeof AttachFormSchema>;