'use client'; import { Avatar, Input, Select, SelectItem } from '@nextui-org/react'; import clsx from 'clsx'; import { getCountries } from 'lib/utils'; import { Billing } from 'lib/woocomerce/models/billing'; import { Shipping } from 'lib/woocomerce/models/shipping'; import { useCheckout } from './checkout-provider'; const optionalFields = ['company', 'address_2']; export default function ShippingForm({ className, title, onChangeInput, error }: { className?: string; title?: string; onChangeInput?: (e: React.ChangeEvent) => void; error?: Shipping | Billing | undefined; }) { const countries = getCountries(); const { checkout } = useCheckout(); const onChange = (e: React.ChangeEvent) => { onChangeInput?.(e); }; const getLabel = (key: string) => key.charAt(0).toUpperCase() + key.slice(1).replace('_', ' '); return (
{title &&

{title}

} {Object.entries(checkout?.shipping || {}) .filter(([key]) => key !== 'country' && key !== 'state') .map(([key, value], index) => (
))}
); }