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

@onionshack/ocpb-chatbox-sdk-prod

v0.2.3

Published

A lightweight, embeddable chat widget powered by React 19, Vite, and Tailwind CSS. Easily integrate a floating chatbot into any website with Firebase backend support and WebSocket real-time messaging.

Downloads

41

Readme

OCPB Chatbot Widget SDK

A lightweight, embeddable chat widget powered by React 19, Vite, and Tailwind CSS. Easily integrate a floating chatbot into any website with Firebase backend support and WebSocket real-time messaging.

Features

  • 🎯 Floating Widget: Unobtrusive bottom-right positioning with expandable interface
  • 💬 Rich Messaging: Markdown support (GFM) for formatted bot and user messages
  • 🔄 Real-time: WebSocket integration for instant message delivery
  • 🎨 Customizable: Configure title, placeholder, suggestions, and styling
  • 📦 Multiple Integration Options: Use as React component or vanilla JavaScript
  • 🔥 Firebase Ready: Built-in Firebase authentication and storage support
  • Lightweight: Optimized bundle size with tree-shaking support

Table of Contents


Quick Start

Local Development

  1. Clone and install dependencies:

    npm install
  2. Start the development server:

    npm run dev
  3. Open your browser: Navigate to http://localhost:5173 to see the demo


Usage

Option 1: Vanilla JavaScript (HTML)

Perfect for integrating into existing websites, WordPress, static HTML pages, or any non-React application.

Step 1: Include the SDK

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Website</title>
</head>
<body>
    <!-- Your website content -->
    <h1>Welcome to my website</h1>

    <!-- Load the chat widget SDK -->
    <script src="https://cdn.example.com/chat-widget-sdk.umd.js"></script>

    <!-- Initialize the widget -->
    <script>
        ChatWidgetSDK.initChatWidget({
            firebaseConfig: {
                apiKey: "YOUR_API_KEY",
                authDomain: "YOUR_AUTH_DOMAIN",
                projectId: "YOUR_PROJECT_ID",
                storageBucket: "YOUR_STORAGE_BUCKET",
                messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
                appId: "YOUR_APP_ID"
            },
            title: 'Customer Support',
            placeholder: 'Type your message...',
            apiUrl: "https://your-api-endpoint.com"
        });
    </script>
</body>
</html>

Step 2: Programmatic Control (Optional)

// Initialize and store the widget instance
const widget = ChatWidgetSDK.initChatWidget({
    firebaseConfig: { /* ... */ },
    title: 'Help Center'
});

// Later, remove the widget if needed
widget.unmount();

Option 2: React Component

Ideal for React applications or Next.js projects.

Step 1: Install from GitHub Packages

First, configure npm to use GitHub Packages. Create or edit .npmrc in your project root:

@onionshack:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN

Note: Generate a GitHub Personal Access Token with read:packages scope at https://github.com/settings/tokens

Then install the package:

npm install @onionshack/ocpb-chatbox-sdk

Step 2: Import and Use in Your React App

import ChatWidget from '@onionshack/ocpb-chatbox-sdk';
import '@onionshack/ocpb-chatbox-sdk/dist/style.css'; // Import styles

export default function App() {
  return (
    <div>
      {/* Your app content */}
      <h1>My React App</h1>

      {/* Chat widget will appear as a floating button */}
      <ChatWidget
        title="Support Chat"
        placeholder="Ask us anything..."
        firebaseConfig={{
          apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
          authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
          projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
          storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
          messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
          appId: process.env.REACT_APP_FIREBASE_APP_ID
        }}
        apiUrl="https://your-api-endpoint.com"
      />
    </div>
  );
}

Configuration

Required Parameters

| Parameter | Type | Description | |-----------|------|-------------| | firebaseConfig | object | Firebase configuration object (required) | | firebaseConfig.apiKey | string | Firebase API key | | firebaseConfig.authDomain | string | Firebase auth domain | | firebaseConfig.projectId | string | Firebase project ID | | firebaseConfig.storageBucket | string | Firebase storage bucket | | firebaseConfig.messagingSenderId | string | Firebase messaging sender ID | | firebaseConfig.appId | string | Firebase app ID |

Optional Parameters

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | title | string | 'Chat' | Chat widget header title | | placeholder | string | 'Type your message…' | Input field placeholder text | | apiUrl | string | 'http://localhost:3000' | REST API and WebSocket endpoint for chat backend | | fullScreen | boolean | false | Enable full-screen mode (no floating button, always open) | | containerId | string | 'chat-widget-root' | DOM element ID to mount into (JS only) |

Configuration Examples

ChatWidgetSDK.initChatWidget({
    firebaseConfig: {
        apiKey: "AIza...",
        authDomain: "myapp.firebaseapp.com",
        projectId: "myapp",
        storageBucket: "myapp.appspot.com",
        messagingSenderId: "123456",
        appId: "1:123456:web:abc123"
    },
    title: 'Customer Support',
    placeholder: 'How can we help you?',
    apiUrl: 'https://api.myapp.com',
    containerId: 'custom-chat-container',
    fullScreen: true  // No floating button, always visible
});

Installation

For Contributors / Development

# Clone the repository
git clone https://github.com/onionshack/ocpb-chatbot-widget-next.git
cd ocpb-chatbot-widget-next

# Install dependencies
npm install

# Start development server
npm run dev