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

@whitebeardnl/messaging-loader

v0.1.2

Published

Programmatic (npm) distribution of the WhiteBeard on-site messaging embed loader — same runtime as the classic <script data-*> embed, usable via import/init() in any bundler.

Readme

@whitebeardnl/messaging-loader

npm distribution of the WhiteBeard on-site messaging embed loader — banners, modals, inline article prompts, and registration walls, managed from the CMS with no frontend deployments required. This is the same runtime shipped as the classic <script data-*> embed; use whichever integration fits your stack.

Install

npm install @whitebeardnl/messaging-loader

Quick start

import { init } from '@whitebeardnl/messaging-loader';

init({
  siteId: 1,
  apiBase: 'https://messaging.domain.com/',
  assetBase: 'https://api.domain.com/',
});

init(config) returns a Promise that resolves with the raw API payload, or null if the request failed or config was invalid (e.g. missing siteId) — in both cases a wb:loader:error event is dispatched on window with details.

Config options

| Field | Maps to data-* attribute | Description | | ---------------- | --------------------------- | -------------------------------------------------------------------------- | | siteId | data-site-id | Publication ID for the site, as configured in the CMS. Required. | | apiBase | data-api-base | Base URL of the Messaging API. | | assetBase | data-asset-base | Base URL for CMS API. | | endpoint | data-endpoint | Messaging embed endpoint path. Defaults to /messaging/embed. | | zoneSelector | data-zone-selector | CSS selector used to specify the attribute to look for when finding zones. Defaults to [data-wb-zone-key]. | | inlineSelector | data-inline-selector | CSS selector used to inject inline article messages into the page content. | | context | data-context | Extra targeting context, forwarded to the API. Accepts a plain object here (no JSON stringifying needed). |

Avoiding a paywall-teaser flash

If your page uses the .article-paywall convention (see the full docs), call detachArticlePaywallMarker() synchronously before init() to remove the teaser from the DOM immediately, avoiding a flash of it before messages resolve:

import { init, detachArticlePaywallMarker } from '@whitebeardnl/messaging-loader';

detachArticlePaywallMarker();
init({ siteId: 1, apiBase: '...', assetBase: '...' });

This is optional — init() does not call it automatically, since doing so on every call (rather than once per page) could re-hide a paywall marker a message has already claimed.

Events

The loader dispatches the same wb:message:*, wb:loader:error, and wb:message:conversion* events on window regardless of distribution — see messaging_tool_frontend.mdx in the main repo for the full event contracts, zone/inline targeting behavior, and template-specific integrations (e.g. the registration wall).

Prefer a plain <script> tag instead?

The classic script-tag integration still exists and is the right choice for sites that don't run a JS bundler:

<script
  data-api-base="https://messaging.domain.com/"
  data-asset-base="https://api.domain.com/"
  data-site-id="1"
  type="text/javascript"
  src="https://api.domain.com/js/messaging_loader.js"
  async="true"
></script>

See messaging_tool_frontend.mdx for the complete reference.

License

ISC