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

@selcom/selcom-js

v1.0.0

Published

Browser drop-in for Selcom Payments — load js.selcom.com.na/v1/selcom.js and call Selcom(pk).mount(container, { sessionId }) to render the embeddable checkout.

Readme

@selcom/selcom-js

Browser drop-in for the Selcom Payments embedded checkout, with the same ergonomics as Stripe.js. One <script> tag, one Selcom(pk).mount(...) call, and you have a fully PCI-scoped checkout iframe in your page.

Install

From the CDN (recommended)

<script src="https://js.selcom.com.na/v1/selcom.js" async></script>
<script>
  document.addEventListener('DOMContentLoaded', async () => {
    const session = await fetch('/api/create-selcom-session', { method: 'POST' })
      .then((r) => r.json());

    const selcom = window.Selcom('pk_test_…');
    selcom.mount('#selcom-checkout', {
      sessionId: session.sessionId,
      appearance: { theme: 'light', primaryColor: '#FF6B00' },
      onSuccess(event) {
        window.location.href = `/orders/${event.reference}/thanks`;
      },
      onError(event) {
        console.warn('Selcom error', event);
      },
    });
  });
</script>
<div id="selcom-checkout"></div>

The CDN URL is versioned:

| URL | What it pins | |------------------------------------------------|---------------------------------------| | https://js.selcom.com.na/v1/selcom.js | Latest 1.x (auto-patches) | | https://js.selcom.com.na/v1.0.0/selcom.js | Exact 1.0.0 | | https://js.selcom.com.na/canary/selcom.js | Pre-release (do not use in prod) |

From npm

npm install @selcom/selcom-js
# or
pnpm add @selcom/selcom-js
import Selcom from '@selcom/selcom-js';

const selcom = Selcom(import.meta.env.VITE_SELCOM_PK!);
selcom.mount('#checkout', {
  sessionId,
  onSuccess: (e) => router.push(`/orders/${e.reference}`),
});

Why a CDN drop-in?

  • PCI scope contained to Selcom. The card form lives in our iframe, not your DOM, so you stay out of PCI-DSS SAQ-D scope and into SAQ-A.
  • Fast first paint. ~6 kB gzipped, deterministic, cached at edge.
  • Always patchable by us. Browser quirks, 3DS protocol changes, and fraud heuristics can ship without a redeploy on your side.

API reference

Selcom(publishableKey, options?) → SelcomInstance

Creates a configured client. The publishable key (pk_test_* / pk_live_*) is safe to ship in client code.

options.iframeOrigin lets you override the hosted checkout origin (useful for self-hosted previews).

instance.mount(container, options)

Renders the checkout iframe into a container element (CSS selector or HTMLElement) and returns a handle:

interface SelcomMountedInstance {
  unmount(): void;                       // tear down the iframe
  element(): HTMLIFrameElement | null;   // get the underlying iframe
}

Mount options:

interface MountOptions {
  sessionId: string;
  appearance?: {
    theme?: 'light' | 'dark' | 'auto';
    primaryColor?: string;
    borderRadius?: 'none' | 'small' | 'medium' | 'large';
    locale?: string;
  };
  returnUrl?: string;
  onReady?: () => void;
  onSuccess?: (event: SelcomSuccessEvent) => void;
  onError?: (event: SelcomErrorEvent) => void;
  onClose?: () => void;
  onEvent?: (event: SelcomEvent) => void;
}

Build & release

pnpm install
pnpm --filter @selcom/selcom-js build
ls packages/selcom-js/dist
# selcom.js        — IIFE (browser global)
# selcom.esm.js    — ESM
# selcom.cjs.js    — CommonJS
# *.d.ts           — TypeScript declarations

CDN deployment is described in scripts/deploy-cdn.md.

Versioning

Follows semver. Major versions get their own CDN path so existing integrations never break on a routine deploy. The v1 alias always points at the latest 1.x patch.