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

business-chat-widget

v1.0.4

Published

Embeddable AI chat widget for React. Runs entirely in the frontend and talks to your own API.

Readme

business-chat-widget

Embeddable AI chat widget for React. It renders a floating launcher button that opens a chat panel — or an always-open panel embedded in your page with mode="inline" — and talks to your own API: the browser never calls the AI provider directly and never holds an API key. Bring any backend that implements a small request contract.

  • No UI/CSS framework dependencies; hand-written CSS (every class prefixed bc- to avoid collisions).
  • React 18+ as a peer dependency (not bundled).
  • Localized English/Spanish defaults, fully overridable through props.
  • Theming through --bc-* CSS variables.

Install

npm install business-chat-widget

react and react-dom (18+) are peer dependencies.

Usage

import { BusinessChat } from 'business-chat-widget';
import 'business-chat-widget/styles.css';

<BusinessChat
  apiEndpoint="https://your-api.example.com/chat"
  language="en"
  businessInfo={{
    name: 'Acme Studio',
    description: 'We build websites and AI tools for small businesses',
    services: ['Landing pages', 'Online stores'],
    tone: 'casual', // | 'formal'
    contactMethods: [
      {
        type: 'whatsapp',
        value: '+1 555 0100',
        href: 'https://wa.me/15550100',
        useFor: ['quote', 'general'],
        primary: true,
      },
    ],
  }}
  systemPrompt="Answer in English unless the visitor asks otherwise"
  greeting="Hi! Ask me about our services."
  theme={{ primaryColor: '#2563eb' }}
/>;

Spanish defaults are available with the same component:

<BusinessChat
  apiEndpoint="https://your-api.example.com/chat"
  language="es"
  businessInfo={{
    name: 'Estudio Acme',
    description: 'Hacemos páginas web y herramientas de IA para pequeñas empresas',
    services: ['Landing pages', 'Tiendas en línea'],
    tone: 'casual',
    contactMethods: [
      {
        type: 'whatsapp',
        value: '+52 81 1234 5678',
        href: 'https://wa.me/528112345678',
        useFor: ['quote', 'general'],
        primary: true,
      },
    ],
  }}
  systemPrompt="Responde en español a menos que el visitante pida otro idioma"
  greeting="¡Hola! Pregúntame sobre nuestros servicios."
/>;

API contract

The widget builds systemPrompt from businessInfo, the selected language, and your optional extra business context, then calls apiEndpoint:

POST { messages, systemPrompt } -> { reply }

messages is the conversation so far ({ role, content }[]) and reply is the assistant's complete response (no streaming in v1). Treat browser-supplied systemPrompt as lower-priority business context; non-negotiable safety or capability rules should be enforced on the server. Keep your AI provider key on the server side; it must never reach the browser.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | apiEndpoint | string | - | API URL (required) | | businessInfo | BusinessInfo | - | Business name, description, services, tone, and contact methods (required) | | conversationKey | string \| number | - | Change this value to reset in-memory messages for a new business, language, or context | | language | 'en' \| 'es' | 'en' | Localized defaults for UI labels and generated prompt text | | systemPrompt | string | - | Extra business context appended with lower priority than server-side safety rules | | title | string | Assistant / Asistente | Header title and launcher label | | placeholder | string | Write your message... / Escribe tu mensaje... | Input placeholder | | greeting | string | - | Optional welcome message shown while the chat is empty | | sendLabel | string | Send / Enviar | Accessible label for the send button | | disclaimer | string | localized default | Short AI notice shown near the input | | showDisclaimer | boolean | true | Set to false to hide the AI notice | | errorMessage | string | localized default | Text shown when the request fails | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | Corner where the launcher and chat window are anchored (floating mode only) | | mode | 'floating' \| 'inline' | 'floating' | 'floating' shows a corner launcher; 'inline' embeds the always-open panel in the page flow | | theme | Theme | - | Colors and sizing (see below) |

Explicit text props always override the language defaults.

businessInfo.contactMethods lets the prompt recommend the right contact channel for appointment, quote, reservation, support, or general contact requests without claiming the business has confirmed an external action. Supported method types are whatsapp, phone, email, url, address, and custom; supported use cases are appointment, quote, reservation, support, and general.

By default, the chat footer shows a short localized notice that AI can make mistakes and important information should be verified. Override it with disclaimer or hide it with showDisclaimer={false}.

When the host app swaps the active business or language without unmounting the widget, pass a stable conversationKey. Changing it starts a fresh in-memory conversation and ignores any late response from the previous context.

Inline (embedded) mode

mode="inline" renders the chat panel directly in the page flow instead of a floating corner widget: no launcher, no close button, always open, and it never steals focus on page load. The panel fills the width of its container; its height defaults to 540px and can be changed with theme.inlineHeight (or the --bc-inline-height CSS variable on any ancestor).

<div style={{ maxWidth: 420 }}>
  <BusinessChat
    mode="inline"
    apiEndpoint="https://your-api.example.com/chat"
    businessInfo={{ name: 'Acme Studio', description: 'We build websites' }}
    theme={{ inlineHeight: '600px' }}
  />
</div>

Mobile on-screen keyboard

In floating mode the widget tracks window.visualViewport while open, so when the on-screen keyboard appears (including iOS Safari, which never resizes the layout viewport) the chat window shrinks to the visible area and the input stays in view. No host-page changes or viewport meta additions are needed.

Theming

The theme prop maps to CSS variables. You can also override them directly in CSS:

| Variable | Prop | Default | |----------|------|---------| | --bc-primary | primaryColor | #6366f1 | | --bc-bg | backgroundColor | #ffffff | | --bc-text | textColor | #1f2937 | | --bc-radius | borderRadius | 16px | | --bc-font | fontFamily | system-ui | | --bc-z | zIndex | 9999 | | --bc-inline-height | inlineHeight | 540px (inline mode only) |

All widget classes use the bc- prefix to avoid collisions with host-site CSS.

License

UNLICENSED — all rights reserved.