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

@cohostvip/payment-element

v0.3.25

Published

Framework-agnostic embedder for the Cohost hosted payment element (iframe + postMessage). Use it directly in plain HTML / Webflow, or as the shared core behind the React <CohostPaymentFrame>.

Readme

@cohostvip/payment-element

npm version License: MIT

Framework-agnostic embedder for the Cohost hosted payment element. It drops an <iframe> to https://cohost.vip/pay/elements?cart=… into your page, wires the cohost-pay postMessage protocol, auto-resizes to the field, and hands you a submit() you call from your own Pay button.

The card field lives on cohost's origin — tokenization and the charge happen server-side there. Card data never touches your DOM, and cohost places the order. You never see a token or a place-order URL.

This is the zero-dependency core shared by the React <CohostPaymentFrame>. Use this package directly for plain HTML, Webflow, or any non-React site; use @cohostvip/cohost-react if you're in React.

Two entry points:

  • mountPaymentElement — just the card field, to embed inside your own cart UI.
  • mountCheckout — the whole hosted cart (tickets + coupon + customer + payment) in one iframe. Simplest possible integration: nothing but the iframe touches your page — no API token, no cart API. Ideal for WordPress / Webflow.

Install

npm i @cohostvip/payment-element
import { mountPaymentElement } from '@cohostvip/payment-element';

const pay = mountPaymentElement('#card', {
  cartId: 'cart_123',                       // from the cohost commerce API / SDK
  onChange: (s) => { payBtn.disabled = !s.complete; },
  onSuccess: ({ reference }) => { location.href = `/thanks?ref=${reference}`; },
  onError: ({ message }) => showError(message),
});

payBtn.addEventListener('click', () => pay.submit());
// later: pay.destroy();

Embed the whole cart — mountCheckout

Drop the entire cohost-hosted checkout (tickets → coupon → customer → payment → confirmation) into your page. Pass an event's checkoutUrl directly, or build it from a cartId. The frame auto-resizes and reports order-complete so you can confirm or redirect.

import { mountCheckout } from '@cohostvip/payment-element';

const checkout = mountCheckout('#checkout', {
  url: event.checkoutUrl,                      // e.g. https://cohost.vip/checkout/cart_123
  // or: cartId: 'cart_123'  (→ https://cohost.vip/checkout/cart_123)
  onComplete: ({ reference }) => { location.href = `/thanks?ref=${reference}`; },
});
// later: checkout.destroy();

Requires the cohost-hosted checkout page to be frame-allowed for your domain and to emit the cohost-checkout messages (ready / resize / order-complete / error / close). The host side here is ready; the hosted page emitting them is a cohost-side requirement.

Plain HTML / Webflow (no bundler)

Load the IIFE build from a CDN; it exposes the global CohostPaymentElement:

<div id="card"></div>
<button id="pay" disabled>Pay</button>

<script src="https://unpkg.com/@cohostvip/payment-element"></script>
<script>
  const payBtn = document.getElementById('pay');
  const pay = CohostPaymentElement.mountPaymentElement('#card', {
    cartId: 'cart_123',
    onChange: (s) => { payBtn.disabled = !s.complete; },
    onSuccess: ({ reference }) => { location.href = '/thanks?ref=' + reference; },
  });
  payBtn.addEventListener('click', () => pay.submit());
</script>

Options

| Option | Default | Notes | |---|---|---| | cartId | — | Required. The cohost cart-session id to pay for. | | baseUrl | https://cohost.vip | Payment origin. Use https://dev.cohost.vip for local dev (or set COHOST_PAYMENT_URL). | | autoStyle | true | Read the enveloping element + a sample form input and theme the field to match. | | theme | — | Explicit overrides (accent, bg, text, font, radius, …). Wins over auto-detected keys. | | detectFrom | target | Element to sample styling from under autoStyle. | | height | 72 | Fallback px height before the field reports its own. | | free | false | Pass true when the cart total is 0. No field is rendered; onFree fires — place the order directly. | | redirectOnSuccess | — | Navigate here after a successful charge. |

Callbacks

onReady, onChange(state), onProcessing, onSuccess({ provider, reference, raw }), onError({ message, code, … }), onUnavailable({ code, message }), onFree().

Handle

interface PaymentElementHandle {
  submit(): void;   // tokenize + charge the entered card
  destroy(): void;  // remove the iframe + detach the listener
  readonly iframe: HTMLIFrameElement | null;
}

License

MIT