npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@veroao/react

v1.0.0

Published

Vero-AO SDK for React — faturação certificada AGT em aplicações React

Readme

@veroao/react

SDK React para o Vero - integra pesquisa de clientes e emissão de factura directamente no teu checkout, usando uma chave segura para o browser.

Instalação

npm install @veroao/react

react e react-dom (>=18) são peer dependencies - usa as que já tens no projecto.

Chave publicável - segura para o browser

Este SDK foi desenhado para correr no cliente (browser), por isso usa uma chave publicável (vero_live_pk_... / vero_test_pk_...), diferente da chave secreta usada no @veroao/node. Cria-a no dashboard, em Chaves de API, escolhendo o tipo "Publicável".

Mesmo que alguém veja esta chave no código-fonte da página, o servidor só a aceita nos endpoints de widget (pesquisar clientes, emitir factura) - nunca dá acesso à tua conta completa.

Quick start

import { VeroAOProvider, useVeroAO } from '@veroao/react'

function App() {
  return (
    <VeroAOProvider config={{ apiKey: 'vero_live_pk_...' }}>
      <CheckoutButton />
    </VeroAOProvider>
  )
}

function CheckoutButton() {
  const { client } = useVeroAO()

  const handleCreateInvoice = async () => {
    const { data: customers } = await client.listCustomers(orgId, { search: 'Maria' })

    const invoice = await client.createInvoice(orgId, {
      customerId: customers[0].id,
      documentType: 'FR',
      items: [{ description: 'Plano Pro', quantity: 1, unitPrice: 500000, taxRate: 14 }],
    })

    window.open(invoice.pdfUrl!, '_blank') // link público, sem autenticação
  }

  return <button onClick={handleCreateInvoice}>Emitir factura</button>
}

Configuração do Provider

<VeroAOProvider config={{
  apiKey: 'vero_live_pk_...',
  baseUrl: 'https://api.custom.ao/v1', // opcional - útil para testes locais
  environment: 'live',                  // opcional, default 'test'
}}>
  {children}
</VeroAOProvider>

useVeroAO()

Devolve { client, isLoading, error }. client expõe:

  • client.listCustomers(orgId, { search?, limit? }){ data: Customer[] }
  • client.createInvoice(orgId, { customerId, items, documentType?, notes?, idempotencyKey? })Invoice

Tratamento de erros

try {
  await client.createInvoice(orgId, input)
} catch (err) {
  const apiErr = err as { error: string; message?: string }
  if (apiErr.error === 'customer_not_found') {
    // cliente não encontrado nesta organização
  }
}

Preços em kwanzas

Os valores monetários usam kwanzas × 100: unitPrice: 500000 equivale a 5 000,00 AOA.

Preciso de mais do que isto - criar produtos, listar facturas, notas de crédito...

Este SDK só sabe fazer as duas coisas acima, de propósito: a chave publicável que usa é restrita pelo servidor a essas rotas, para ser segura no browser. Não existe forma de "desbloquear" mais operações com uma chave publicável - nem gerir produtos, nem listar facturas existentes, nem emitir notas de crédito/débito, nem apagar clientes.

Se precisas de qualquer uma dessas operações a partir de uma aplicação React, o padrão correcto é:

React (browser)  →  o TEU backend  →  Vero (com @veroao/node + chave secreta)

Ou seja, cria uma rota de API tua (Next.js API route, Express, etc.) que use @veroao/node com a chave secreta, e chama essa rota a partir do React - nunca a API do Vero directamente para essas operações.

// app/api/products/route.ts (exemplo Next.js)
import { createVeroClient } from '@veroao/node'

const vero = createVeroClient() // VERO_API_KEY - chave secreta, só no servidor

export async function POST(req: Request) {
  const body = await req.json()
  const product = await vero.products.create(ORG_ID, body)
  return Response.json(product)
}

O backend não precisa de ser Node - é só o exemplo mais directo. Se for PHP, Python, Ruby, etc., chama a API REST directamente com o cliente HTTP dessa linguagem; tens as mesmas operações disponíveis. Exemplos em cURL, Python e PHP em vero.ao/docs.