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

@frillco/script

v0.1.3

Published

Type-safe SDK for embedding Frill widgets, surveys and announcements.

Readme

@frillco/script

Type-safe SDK for embedding Frill widgets, surveys and boosted announcements.

Full documentation: developers.frill.co

Install

npm install @frillco/script

Usage

Start by loading your container — it creates the widgets, surveys and boosted announcements you've configured in your Frill dashboard, and is the recommended entry point for most apps.

frill is the typed callable (a drop-in for window.Frill). Calling it loads the Frill script on first use, so calling frill('container', …) up front also loads Frill eagerly.

import { frill } from '@frillco/script';

// Load your container (optionally identifying the current user)
await frill('container', {
  key: 'YOUR_CONTAINER_KEY',
  user: { name: 'Mikey Hill', email: '[email protected]' },
});

// Open a specific widget on demand
const widget = await frill('widget', { key: 'YOUR_WIDGET_KEY' });
widget.open();

Loading eagerly

To start loading the Frill script before you make your first call, use loadFrill (similar to loadStripe). Pass domain: 'frill.eu' for EU data residency.

import { loadFrill } from '@frillco/script';

loadFrill(); // begins loading immediately
// loadFrill({ domain: 'frill.eu' });

Identifying users

// Guest user
await frill('identify', {
  name: 'Mikey Hill',
  email: '[email protected]',
  attributes: { mrr: 100 },
});

// SSO (JWT from your server)
await frill('identify', { ssoToken: 'SSO_JWT' });

// Log out
await frill('unidentify');

Controlling a widget

const widget = await frill('widget', { key: 'YOUR_WIDGET_KEY' });

widget.open();
widget.viewSection('roadmap');
widget.events.on('badgeCount', ({ count }) => console.log(`${count} unread`));

Surveys

const survey = await frill('survey', { key: 'YOUR_SURVEY_KEY', force: true });
survey.open();

React / Next.js

Render <FrillScript /> once (e.g. in your root layout) to load the container before hydration.

import Script from 'next/script';
import { FrillScript } from '@frillco/script/react';

// app/layout.tsx
<FrillScript
  as={Script}
  strategy="beforeInteractive"
  container={{
    key: 'YOUR_CONTAINER_KEY',
    user: { name: 'Mikey Hill', email: '[email protected]' },
  }}
/>;

Content-Security-Policy (nonce)

Running a strict CSP? Pass a nonce. It's applied to the <FrillScript> tag, the container script it injects, and every script/style tag the SDK injects thereafter — so Frill loads without 'unsafe-inline'.

<FrillScript nonce={nonce} container={{ key: 'YOUR_CONTAINER_KEY' }} />

loadFrill({ nonce }) does the same for the imperative API.

Hooks

useWidget returns the widget instance (or null until it's ready), re-rendering when it loads — so effects can reliably subscribe via widget.events.

import { useWidget } from '@frillco/script/react';

function FeedbackButton() {
  const widget = useWidget({ key: 'YOUR_WIDGET_KEY' });

  React.useEffect(() => {
    if (!widget) return;

    const unsubscribe = widget.events.on('badgeCount', ({ count }) => {
      console.log(`${count} unread`);
    });

    return () => {
      unsubscribe();
    };
  }, [widget]);

  return <button onClick={() => widget?.open()}>Feedback</button>;
}

useSurvey and useContainer mirror useWidget (for containers, prefer <FrillScript container={…} /> when you can). useFrill() returns the frill callable for imperative use in event handlers.

Embedding a widget

Render a widget inline (into a <div>, not a modal launcher):

import { FrillWidgetEmbed } from '@frillco/script/react';

<FrillWidgetEmbed widgetKey="YOUR_WIDGET_KEY" style={{ width: 340, height: 460 }} />;