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

copilot-chat-widget

v0.1.38

Published

Embeddable Copilot chat widget that can be loaded via NPM or a script tag.

Downloads

3,676

Readme

Copilot Chat Widget

Embeddable chat widget that can be added via NPM or a script tag.

Installation

npm install copilot-chat-widget
# or
yarn add copilot-chat-widget

Usage (NPM import)

import { loadCopilotChatWidget } from "copilot-chat-widget";

loadCopilotChatWidget({
  token: "YOUR_WIDGET_TOKEN",
  // optional: baseUrl if backend is on a different origin
  // baseUrl: "https://your-backend-domain"
});

loadCopilotChatWidget injects the standalone script (chat-widget.min.js) and bootstraps the widget using the provided token.

React/Next.js example

import { useEffect } from "react";
import { loadCopilotChatWidget } from "copilot-chat-widget";

export default function Page() {
  useEffect(() => {
    loadCopilotChatWidget({
      token: process.env.NEXT_PUBLIC_CHAT_WIDGET_TOKEN,
      baseUrl: process.env.NEXT_PUBLIC_WIDGET_BASE_URL // optional override if backend is another origin
    });
  }, []);

  return <main>Your page content</main>;
}

Usage (script tag)

<script
  src="https://cdn.example.com/chat-widget.min.js"
  data-token="YOUR_WIDGET_TOKEN"
  data-base-url="https://your-backend-domain"  <!-- optional if backend is another origin -->
></script>
  • data-token: required.
  • data-base-url: optional override; if omitted, the widget uses the build-time default WIDGET_BASE_URL, then falls back to the script/page origin.
  • data-autoload="false": if you want to insert the script but call window.CopilotChat.init() manually.

Configuration

  • token (string, required): widget token.
  • baseUrl (string): backend host serving /api/chat-widget/config. Needed when the embedding page is on a different origin. If omitted, the widget uses WIDGET_BASE_URL (injected at build) then falls back to the script/page origin.
  • autoload (boolean): set false to defer bootstrap and call window.CopilotChat.load() yourself.

Runtime controls (after script loads):

window.CopilotChat.open();   // open widget
window.CopilotChat.close();  // close widget
window.CopilotChat.load();   // initialize if autoload=false