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

@clickterm/widget

v2.2.1

Published

Browser SDK (TypeScript) that embeds Clickterm clickwrap agreements into host pages as a modal dialog or inline checkbox.

Readme

@clickterm/widget

Browser SDK (TypeScript) that embeds Clickterm clickwrap agreements into host pages, either as a modal dialog or an inline checkbox.

npm

Install

npm install @clickterm/widget

Or load it directly from a CDN (UMD build, exposes window.Clickterm):

<script src="https://unpkg.com/@clickterm/widget"></script>
<!-- or -->
<script src="https://cdn.jsdelivr.net/npm/@clickterm/widget"></script>

Quick start

Dialog (modal) — with a bundler

import { ClicktermClient, ClicktermDialog } from '@clickterm/widget';

ClicktermClient.initialize('YOUR_APP_ID');

const result = await ClicktermDialog.show(
  {
    endUserId: 'user_12345',
    clickwrapTemplateId: 'YOUR_TEMPLATE_ID',
  },
  {},
  {
    onSuccess: (signature) => console.log('signed:', signature),
    onAlreadyAccepted: () => console.log('already accepted'),
    onCancel: () => console.log('dismissed'),
    onError: (err) => console.error(err),
  },
);

Inline (checkbox in your own form) — via script tag

<div id="my-consent"></div>

<script src="https://unpkg.com/@clickterm/widget"></script>
<script>
  const { ClicktermClient, ClicktermDom } = window.Clickterm;

  ClicktermClient.initialize('YOUR_APP_ID');

  ClicktermDom.renderInline('my-consent', {
    endUserId: 'user_12345',
    clickwrapTemplateId: 'YOUR_TEMPLATE_ID',
  }).then((handle) => {
    document.getElementById('my-form').addEventListener('submit', async (e) => {
      e.preventDefault();
      const result = await handle.finalize();
      console.log(result.status, result.clicktermSignature);
    });
  });
</script>

See docs/inline-clickwrap.md for the full inline integration guide (styling, multiple clickwraps per page, template placeholders, edge cases).

Public API

All exports live on src/index.ts. Three static classes:

  • ClicktermClient.initialize(appId, baseUrl?) — configures the SDK. Must be called first.
  • ClicktermDialog.show(request, config?, listeners?) / showAcceptedContent(request, config?) — modal flow.
  • ClicktermDom.renderInline(containerId, request, options?) / finalizeAll(containerIds?) — inline checkbox flow.

TypeScript types for every request/response/option shape ship with the package.

Local development

npm install
npm run start

Then open http://127.0.0.1:3000/ for the dialog demo or http://127.0.0.1:3000/inline.html for the inline demo. The Vite config also exposes a /cors-proxy?url=... endpoint so the demos can hit the Clickterm API directly from localhost.

Note on hot reload. If rollup's watch doesn't pick up changes reliably, this workaround works: npx nodemon --watch src --ext ts --exec "npm run start". No project-side changes needed.

Scripts

  • npm run start — runs watch:dev (rollup) and vite in parallel. Dev bundle written to public/dist/index.js.
  • npm run build — production build. Emits UMD, ESM, CJS, and .d.ts bundles under dist/.
  • npm run build:dev — one-shot dev bundle into public/dist/index.js.
  • npm run watch:dev — rollup in watch mode without starting Vite.
  • npm run types — emit .d.ts files only.

Project layout

  • src/index.ts — public exports (ClicktermClient, ClicktermDialog, ClicktermDom).
  • src/widget.ts — orchestrates the clickwrap lifecycle (fetch template → render → submit agreement).
  • src/client.tsHttpService wrapping the Clickterm /public-client/v1/clickwrap endpoints.
  • src/ui/ — DOM rendering. Uses closed Shadow DOM for style isolation; CSS lives in assets/style.css and is imported as a string.
  • src/inline/ — inline-mode registry and handle implementations.
  • src/translations.ts — lazy load of dialog translations from app.clickterm.com/sdk/clickterm-widget-translations.json.

Release

  1. Bump version in package.json.
  2. Commit and push to main.
  3. Create a matching v* git tag (e.g. v2.3.0) and push it.

The publish.yml workflow runs on any v* tag: it builds and runs npm publish using the NPM_TOKEN repo secret.

License

MIT