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

@xenarch/react

v1.0.0

Published

React component for Xenarch pay links — drop-in <XenarchCheckout/> with redirect / modal / inline modes.

Readme

@xenarch/react

React component for Xenarch pay links — drop in a <XenarchCheckout/> and you're done.

Install

npm install @xenarch/react

Peer deps: react >= 18, react-dom >= 18.

For drop-on-any-page (no React) use cases, see @xenarch/embed — it's vanilla JS, zero deps.

Usage

Redirect mode (default — safest)

import { XenarchCheckout } from "@xenarch/react";

<XenarchCheckout linkId="abc123def456">
  Pay 0.99 USDC
</XenarchCheckout>

Renders an <a> styled like a button. Click → navigates to pay.xenarch.com/l/<id>?return_url=<current page>. After payment, the customer is sent back to your page with ?xenarch_paid=1&link_id=...&tx_hash=... query params.

Modal mode

<XenarchCheckout
  linkId="abc123def456"
  mode="modal"
  onPaid={({ linkId, txHash }) => {
    console.log("paid", linkId, txHash);
    // show your thank-you UI
  }}
  onClose={() => console.log("modal dismissed")}
>
  Pay 0.99 USDC
</XenarchCheckout>

Renders a <button>. Click → opens a modal overlay containing an iframe of the hosted checkout. The modal auto-closes on payment confirmation; onPaid fires with {linkId, txHash}. Backdrop click, X button, and Esc all dismiss.

Inline mode

<XenarchCheckout
  linkId="abc123def456"
  mode="inline"
  inlineHeight="720px"
  onPaid={({ linkId, txHash }) => { /* … */ }}
/>

Renders the checkout iframe directly in place, no button wrapper. You set the height; the SDK does not auto-resize the iframe in v1.

Props

| Prop | Type | Default | Description | |---|---|---|---| | linkId | string | required | The pay-link ID (the part after pay.xenarch.com/l/). | | mode | "redirect" \| "modal" \| "inline" | "redirect" | Which surface. | | returnUrl | string | window.location.href | After-pay URL for redirect mode. Modal/inline ignore. | | onPaid | (event) => void | — | Fires on PAID / CONFIRMED. Modal closes automatically. | | onTerminal | (event) => void | — | Fires on UNDERPAID / OVERPAID / EXPIRED / REVOKED. | | onClose | () => void | — | Modal only — fires when user dismisses without paying. | | inlineHeight | string | number | "min(900px, 80vh)" | Inline only — iframe height. | | className, style | — | — | Pass-through to the rendered element. | | children | ReactNode | "Pay" | Button label (redirect/modal). Inline ignores. |

Event payload

type XenarchEvent = {
  type:
    | "xenarch:paid"
    | "xenarch:underpaid"
    | "xenarch:overpaid"
    | "xenarch:expired"
    | "xenarch:revoked"
    | "xenarch:close";
  linkId: string;
  txHash?: string;  // present on `xenarch:paid` after on-chain confirmation
};

Security

  • The component only acts on postMessage events whose event.origin === "https://pay.xenarch.com". Messages from other origins are silently ignored.
  • The linkId on incoming messages must match the prop on the rendered component, so a different iframe on the same page firing events can't trigger callbacks on this one.
  • txHash is only surfaced when it matches /^0x[0-9a-fA-F]{64}$/. The hash is for UX only — for crediting customers or fulfilling orders, verify against your dashboard or a webhook, not the postMessage payload.
  • The iframe loads with no permission grants. Add an allow= attribute via the style/className escape hatch only if you actually need camera/clipboard.

Lower-level escape hatches

If the component doesn't fit your shape, the building blocks are exported:

import {
  buildHostedUrl,           // (linkId, {returnUrl?, embed?}) => string
  attachXenarchListener,    // (linkId, {onPaid, onTerminal, onClose}) => unsubscribe
  isValidLinkId,            // (string) => boolean
  HOSTED_ORIGIN,            // "https://pay.xenarch.com"
} from "@xenarch/react";

Build output

  • dist/index.js — ESM bundle. React is external (peer dep — your bundler dedupes).
  • dist/index.cjs — CJS bundle. Same external React.
  • dist/index.d.ts — TypeScript declarations.

License

MIT