"use client"; import { zodResolver } from "@hookform/resolvers/zod"; import type { ControllerRenderProps, UseFormReturn } from "react-hook-form"; import { Controller, useForm } from "react-hook-form"; import z from "zod"; import { Price, PriceValue } from "@/components/shadcnblocks/price"; import { AspectRatio } from "@/components/ui/aspect-ratio"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Field, FieldLabel } from "@/components/ui/field"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { cn } from "@/lib/utils"; const STOCK_STATUS = { IN_STOCK: "IN_STOCK", OUT_OF_STOCK: "OUT_OF_STOCK", } as const; type StockStatusCode = keyof typeof STOCK_STATUS; type FieldName = keyof FormType; type FormType = z.infer; type Image = { src: string; alt: string; }; type Option = { id: string; label: string; color: string; value: string; image: Image; }; interface ProductFormProps { colorHinges?: { name: FieldName; options: Omit[]; }; form: UseFormReturn; } interface RadioGroupProps { options?: Omit[]; field: ControllerRenderProps; } type ColorOptionProps = Omit; interface ProductPrice { regular: number; sale?: number; currency: string; } interface Product { collection: { label: string; link: string; }; name: string; variantId: string; link: string; image: Image; price: ProductPrice; variants: { name: FieldName; options: Array