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

@mupag/widget

v0.1.1

Published

Browser widget SDK for embedding MuPag checkout in merchant sites.

Readme

@mupag/widget

Browser SDK para abrir o checkout MuPag em modal via iframe, sem redirect obrigatório.

Distribuição

@mupag/[email protected] está publicado no npm e pode ser usado pelo npm, unpkg ou jsDelivr. O domínio CDN próprio da MuPag ainda está pendente e não é anunciado como disponível.

npm install @mupag/widget

Alternativa via unpkg:

<script src="https://unpkg.com/@mupag/[email protected]/dist/widget.global.js" defer></script>

Alternativa via jsDelivr:

<script src="https://cdn.jsdelivr.net/npm/@mupag/[email protected]/dist/widget.global.js" defer></script>

O bundle expõe apenas window.MuPagWidget com { MuPag, init, version }.

Uso via atributos de dados

<button
  data-mupag-widget
  data-environment="test"
  data-publishable-key="pk_test_..."
  data-item-name="Plano Pro"
  data-unit-amount-cents="10990"
  data-quantity="1"
  data-success-url="https://sua-loja.example/pagamento/sucesso"
  data-cancel-url="https://sua-loja.example/carrinho"
>
  Comprar agora
</button>

NPM

npm install @mupag/widget
import { MuPag } from "@mupag/widget";

const mupag = new MuPag({
  environment: "test",
  publishableKey: "pk_test_...",
});

await mupag.openCheckout({
  items: [{ name: "Plano Pro", quantity: 1, unit_amount_cents: 10_990 }],
  success_url: "https://sua-loja.example/pagamento/sucesso",
  cancel_url: "https://sua-loja.example/carrinho",
  customer_data: { email: "[email protected]" },
  onSuccess: (charge) => console.log("Paid", charge),
  onClose: () => console.log("Closed"),
});

Segurança e compatibilidade

  • A chave publishable precisa do escopo checkout_sessions.create.
  • environment é obrigatório e a chave deve corresponder a test (pk_test_) ou prd (pk_prd_).
  • Nunca use uma chave secreta no navegador.
  • O widget cria uma Idempotency-Key criptograficamente segura para cada nova sessão; informe idempotencyKey para reutilizar a mesma operação em uma tentativa controlada.
  • Sem eval, top-level await ou dependências runtime externas.
  • Baseline ES2018.
  • Modal isolado com Shadow DOM e iframe com sandbox.
  • postMessage aceita eventos apenas da origem e da janela do iframe ativo.
  • A URL de checkout retornada precisa usar a origem configurada e o caminho /c/{session_id}.
  • Para domínio próprio de checkout, configure checkoutBaseUrl explicitamente com a origem HTTPS.
  • Em telas menores que 640px o modal vira fullscreen.
  • Se o iframe não carregar, o SDK faz fallback para redirect.