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

@multichat-adslogin/chat-widget

v0.3.0

Published

Embeddable React chat widget for the Nuvemchat / MultiChat Live Chat API. Single component, drag-and-drop attachments, realtime via Laravel Reverb, dynamic initial chat options.

Readme

@multichat-adslogin/chat-widget

Embeddable React chat widget for the MultiChat / Nuvemchat Live Chat API. One component, drag-and-drop attachments, realtime via Laravel Reverb, configurable initial chat options, and a built-in emoji picker.

npm install @multichat-adslogin/chat-widget lucide-react

react, react-dom, and lucide-react are peer dependencies — install them in the host app.


Quick start

import { ChatWidget } from '@multichat-adslogin/chat-widget';
import '@multichat-adslogin/chat-widget/styles.css';

export default function App() {
  const [open, setOpen] = useState(false);
  return (
    <ChatWidget
      appId="550e8400-e29b-41d4-a716-446655440000"
      isOpen={open}
      onOpen={() => setOpen(true)}
      onClose={() => setOpen(false)}
      user={{ name: 'Budi', email: '[email protected]' }}
    />
  );
}

Only appId is required. The widget pulls everything else — template, brand color, accept message, realtime credentials — from GET /widget-api/config/{appId} at boot.

Props

| Prop | Type | Required | Notes | | --------------------- | --------------------------------------------- | :------: | ----- | | appId | string | ✓ | Connection identifier from the MultiChat dashboard. | | isOpen | boolean | | Controlled open state. | | onOpen / onClose | () => void | | Open/close callbacks. | | user | { name?, email?, meta? } | | Forwarded as identify data when the session is created. | | theme | Theme | | Color overrides for the ProxyBR template (dark). The Global template has its own light palette. | | template | 'proxybr' \| 'global' | | Initial template hint. Backend template_type always wins once config loads. | | initialChatOptions | Array<{ id, label, color?, message? }> | | Quick-reply chips shown until the visitor sends their first message. | | debug | boolean | | Enables verbose lifecycle logging in the console. |

initialChatOptions example

<ChatWidget
  appId="..."
  initialChatOptions={[
    { id: 'pricing', label: '💰 Tanya harga', color: '#22c55e' },
    { id: 'demo',    label: '🎥 Minta demo',   color: '#06b6d4',
      message: 'Halo, saya ingin minta demo produk.' },
  ]}
/>

Each click POSTs option.message || option.label to the API as a normal visitor message. The chips disappear after the visitor sends anything.


Features

  • Single component — drop in, no provider setup, no manual wiring.
  • Dual templatesproxybr (dark, themable) and global (light, fixed palette). Backend picks via template_type.
  • REST + RealtimeGET /config, POST /session, POST /messages, GET /messages, GET /session (status), POST /seen, plus WebSocket subscription to widget-session.{token} for agent replies and conversation status changes.
  • Attachments — drag-and-drop OR file picker. Pre-uploads via POST /uploads, shows preview with caption input, renders inline in bubbles (image/audio/video/document with download).
  • Initial chat options — dynamic chips configured via props, each click sends a message.
  • Emoji picker — built-in, ~250 emojis across 6 categories, inserts at cursor.
  • Conversation status — detects pending → active → resolved transitions via WS event; resolved state replaces input with "Start new conversation" CTA.
  • Unread badge — driven by unread_count from GET /session, auto-incremented on agent WS push, cleared on widget open via POST /seen.
  • Not-ready placeholder — invalid app_id, loading, or transient errors all show a neutral "Connecting…" placeholder instead of breaking.
  • Self-contained CSS — Tailwind utilities scoped to .cw-root, host page styles untouched. No preflight reset bleeding into the embedding site.
  • ~19 KB gzipped — minimal Pusher-protocol WebSocket client inline (no laravel-echo / pusher-js dependency).

Backend configuration

The widget API base URL is baked in at build time (defaults to a hardcoded URL in src/core/config.js). Override via VITE_WIDGET_BASE_URL when building from source:

VITE_WIDGET_BASE_URL=https://your-backend.example.com npm run build

See API.md in this repo for the full backend contract.


Programmatic API via ref

import { useRef } from 'react';
import { ChatWidget } from '@multichat-adslogin/chat-widget';

// The conversation object exposes:
//   .messages, .conversationStatus, .unreadCount, .currentAgent
//   .sendMessage(text, { attachmentUrl? })
//   .uploadAttachment(file) → { url, message_type, ... }
//   .markSeen()
//   .refreshStatus()
//   .reset() — clear session_token + bootstrap a new conversation

A future release will expose this via an imperative ref. For now, the widget owns the conversation hook internally.


License

MIT © MultiChat