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

@supportai.it/chat-widget

v2.0.5

Published

Chat widget web component for supportAI.it

Readme

Universal Chat Widget

A universal chat widget that supports vanilla JavaScript/HTML, React TypeScript, and Vue TypeScript. Each framework has its own independent package to avoid unnecessary dependencies.

Installation

Using CDN (Vanilla JS/HTML):

<script src="https://cdn.jsdelivr.net/npm/@supportai.it/chat-widget"></script>

Using npm

For Vanilla JS/HTML projects:

# No additional dependency

For React TypeScript projects:

npm install @supportai.it/chat-widget

For Vue TypeScript projects:

npm install @supportai.it/chat-widget

Usage

Vanilla JavaScript/HTML

<chat-widget
  chat-id="your-chat-id"
  api-key="your-api-key"
></chat-widget>

<script type="module" src="https://cdn.jsdelivr.net/npm/@supportai.it/chat-widget"></script>

React TypeScript

import { ChatWidget, useChatContext } from '@supportai.it/chat-widget/react';

function App() {
  const { updateContext } = useChatContext();

  const handleUpdateContext = () => {
    updateContext({
      user: { id: '123', name: 'John Doe' }
    });
  };

  return (
    <div>
      <ChatWidget
        chatId="your-chat-id"
        apiKey="your-api-key"
      />
      <button onClick={handleUpdateContext}>Update Context</button>
    </div>
  );
}

Vue TypeScript

<script setup lang="ts">
import { ChatWidget, useChatContext } from '@supportai.it/chat-widget/vue';

const { updateContext } = useChatContext();

const handleUpdateContext = () => {
  updateContext({
    user: { id: '123', name: 'John Doe' }
  });
};
</script>

<template>
  <div>
    <ChatWidget
      chat-id="your-chat-id"
      api-key="your-api-key"
      button-color="#ff0000"
      button-size="56px"
    />
    <button @click="handleUpdateContext">Update Context</button>
  </div>
</template>

Updating Context Dynamically (Vanilla JS)

window.dispatchEvent(new CustomEvent("chat-widget/updateContext", {
  detail: {
    user: { id: '123', name: 'John Doe' }
  },
}));

Closing the Widget Programmatically

The widget listens for postMessage events from the iframe to close itself. The origin is verified to match the widget's base-url for security.

// From inside the chat iframe
window.parent.postMessage({ namespace: "chat-widget/close" }, "*");

Props/Attributes

  • chat-id: The ID of the chat to be opened.
  • api-key: The API key for authentication.
  • button-color: Custom button color (Default: #582975)
  • button-hover-color: Custom hover color (Default: #7b2ba6)
  • button-size: Button size (Default: 64px)
  • message-bubble: Display a message bubble on top of the open button (when the chat is closed). Set to false to disable.
  • chat-align: Chat alignment "left" or "right". (Default: right)
  • chat-width: Chat width (Default: 400px)
  • chat-height: Chat height (Default: 600px)
  • base-url: Base URL for the chat service
  • svg-icon: Custom SVG icon for the chat button

React/Vue Props

For React use camelCase versions of the attributes

Framework-Specific Features

React

  • useChatContext() hook for easy context updates
  • TypeScript support with proper prop types
  • React ref forwarding support

Vue

  • useChatContext() composable for easy context updates
  • TypeScript support with proper prop types
  • Vue template ref support

Package Structure

This package provides three independent entry points:

  • Default (@supportai.it/chat-widget): Vanilla JS/HTML web component
  • React (@supportai.it/chat-widget/react): React TypeScript wrapper
  • Vue (@supportai.it/chat-widget/vue): Vue TypeScript wrapper

Each entry point only includes dependencies relevant to that framework, ensuring minimal bundle size.