"use client"; import { zodResolver } from "@hookform/resolvers/zod"; import { Heart } from "lucide-react"; import { useMemo } from "react"; import type { ControllerRenderProps } from "react-hook-form"; import { Controller, useForm } from "react-hook-form"; import z from "zod"; import { Price } from "@/components/shadcnblocks/price"; import { Button } from "@/components/ui/button"; import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/ui/carousel"; import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "@/components/ui/dialog"; import { FieldLegend, FieldSet } from "@/components/ui/field"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; const STOCK_STATUS = { IN_STOCK: "IN_STOCK", OUT_OF_STOCK: "OUT_OF_STOCK", } as const; type StockStatusCode = keyof typeof STOCK_STATUS; type FormType = z.infer; type FieldName = keyof FormType; type Image = { src: string; alt: string; }; interface ProductPrice { regular: number; sale?: number; currency: string; } type Option = { id: string; value: string; label: string; thumbnail?: string; stockStatusCode?: StockStatusCode; }; interface Hinges { label: string; id: string; min?: number; max?: number; name: FieldName; options?: Option[]; } type Product = { images: Image[]; name: string; description: string; link: string; price: ProductPrice; hinges: Record; variant: { color: string; size: string; }; }; interface ProductImagesProps { images: Image[]; } interface ProductFormProps { hinges: Record; selected?: FormType; } interface RadioGroupProps { options?: Array