import { PlazbotProvider, Chat } from 'plazbot/react'
const ProductCard = ({ action }) => {
const data = action.result as {
name: string
price: number
image: string
stock: boolean
}
if (!data) return null
return (
<div style={{
border: '1px solid #e5e7eb',
borderRadius: 6,
padding: 12,
display: 'flex',
gap: 12,
alignItems: 'center',
}}>
{data.image && (
<img src={data.image} alt={data.name}
style={{ width: 56, height: 56, borderRadius: 4, objectFit: 'cover' }} />
)}
<div>
<p style={{ fontWeight: 600 }}>{data.name}</p>
<p style={{ color: '#6b7280', fontSize: 13 }}>
${data.price.toFixed(2)} {data.stock ? '- En stock' : '- Agotado'}
</p>
</div>
</div>
)
}
<PlazbotProvider sdk={sdk} agentId="ag_xxxx">
<Chat
customCardRenderers={{
buscar_producto: ProductCard,
}}
/>
</PlazbotProvider>