diff --git a/react/components/ProductContext/Pix.tsx b/react/components/ProductContext/Pix.tsx index dd63cfa..7a70488 100644 --- a/react/components/ProductContext/Pix.tsx +++ b/react/components/ProductContext/Pix.tsx @@ -1,12 +1,14 @@ import React from 'react'; import { useProduct } from 'vtex.product-context'; -const Pix = () => { - +type price = { + discountRate:number +} +const Pix = ({ discountRate}:price) => { const { product } = useProduct() let pixprice = product?.priceRange.sellingPrice.lowPrice - let desconto = 10 + let desconto = discountRate >= 0 ? discountRate : 10; let finalprice = pixprice - (pixprice/desconto) let RoundedNumber = Number(Math.round(finalprice * 100) / 100); const formattedNumber = RoundedNumber.toLocaleString('pt-BR', { @@ -25,5 +27,17 @@ const Pix = () => { ) } - +Pix.schema = { + title:"Pix-Price", + description:"quantos % o pagamento via pix irá proporcionar", + type:"object", + properties:{ + discountRate:{ + title: "Pix-Price", + description:"quantos % o pagamento via pix irá proporcionar", + type:"number", + default:10 + } + } +} export default Pix