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

@hith/web-chat

v1.0.13

Published

Embeddable chat widget for TMS

Readme

TMS Chat Widget

The embeddable chat widget for the TMS (Ticket Management System) that allows websites to integrate real-time chat functionality.

Development Setup

Building the Widget

# Install dependencies
npm install

# Build the widget (creates dist/chat-widget.js)
npm run build

Testing Locally

  1. Build the widget:

    npm run build
  2. Start your TMS backend (in another terminal):

    cd ../../backend
    go run cmd/api/main.go
  3. Serve the test page:

    npm run serve
    # Or manually: python3 -m http.server 3001
  4. Open in browser: http://localhost:3001/test.html

Integration

Basic Integration

Add this script to any website where you want the chat widget to appear:

<!-- TMS Chat Widget -->
<script>
  (function() {
    window.TMSChatConfig = {
      widgetId: 'your-widget-id-here',
      domain: 'your-domain.com',
      apiUrl: 'https://your-tms-api.com/v1' // Optional, defaults to localhost:8080/v1
    };
    var script = document.createElement('script');
    script.src = 'https://your-cdn.com/chat-widget.js';
    script.async = true;
    document.head.appendChild(script);
  })();
</script>

Configuration Options

The TMSChatConfig object supports the following options:

  • widgetId (required): The unique identifier for your chat widget
  • domain (required): Your verified domain name
  • apiUrl (optional): The TMS API base URL (defaults to http://localhost:8080/v1)

Widget Features

  • Customizable appearance: Colors, position, and messages
  • Auto-open functionality: Automatically open after a delay
  • Real-time messaging: WebSocket-based real-time communication
  • File uploads: Support for file sharing (if enabled)
  • Agent avatars: Display agent profile pictures
  • Typing indicators: Show when agents are typing
  • Offline messaging: Handle offline scenarios
  • Mobile responsive: Works on all device sizes

API Endpoints Used

The widget communicates with these TMS API endpoints:

  • GET /v1/public/chat/widgets/domain/{domain} - Get widget configuration
  • POST /v1/public/chat/widgets/{widgetId}/sessions - Start a chat session
  • GET /v1/public/chat/sessions/{sessionToken} - Get session details
  • GET /v1/public/chat/sessions/{sessionToken}/messages - Get chat messages
  • POST /v1/public/chat/sessions/{sessionToken}/messages - Send a message
  • WebSocket: /v1/public/chat/sessions/{sessionToken}/ws - Real-time updates

Development Notes

  • Built with TypeScript and Vite
  • Uses UMD format for maximum compatibility
  • No external dependencies (except for event emitter)
  • Automatically initializes when TMSChatConfig is present
  • Can also be manually initialized: new window.TMSChatWidget(config)

Files Structure

src/
├── index.ts       # Entry point and auto-initialization
├── widget.ts      # Main widget class and UI logic
├── api.ts         # API communication layer
├── events.ts      # Event emitter for internal communication
└── types.ts       # TypeScript type definitions