"use client"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { CTA_TYPE_OPTIONS, parseProductContext, serializeProductContext, type CtaType, type ProductContextFields, } from "@/lib/types/product-context"; interface ProductContextFormProps { value: string; onChange: (serialized: string) => void; compact?: boolean; /** 產品層級表單:隱藏品牌欄位(品牌由上層品牌卡管理) */ productOnly?: boolean; } export function ProductContextForm({ value, onChange, compact = false, productOnly = false, }: ProductContextFormProps) { const fields = parseProductContext(value); function update(patch: Partial) { onChange(serializeProductContext({ ...fields, ...patch })); } return (
{!productOnly ? (
update({ brand: e.target.value })} placeholder="例:kahu" />
update({ product: e.target.value })} placeholder="例:寵物洗毛精" />
) : (
update({ product: e.target.value })} placeholder="例:溫和洗毛精" />
)}