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

@ethora/ai-chat-widget

v25.10.1

Published

1. npm create vite@latest 2. select name of project, select type (react/js) 3. cd project-name 4. npm i 5. npm i @ethora/chat-component 6. go to file src/App.tsx and replace it with this code

Downloads

24

Readme

@ethora/ai-chat-widget

A production-ready React chat widget with assistant mode, powered by XMPP. Embed it on any site as a script or use it as a React component. Built and maintained by Ethora.

Highlights

  • Conversational assistant mode with anonymous user bootstrapping
  • React component or zero-code script embed
  • Battle-tested XMPP transport, Redux state, and styled-components UI
  • Accessible UI, theming, and lightweight footprint

Installation

npm install @ethora/ai-chat-widget
# or
yarn add @ethora/ai-chat-widget

Quick start (React via npm)

import React from 'react';
import {
  AiAssistant,
  XmppProvider,
  createAnonymousXmppCredentials,
} from '@ethora/ai-chat-widget';
import '@ethora/ai-chat-widget/dist/ai-chat-widget.css';

export default function App() {
  const user = createAnonymousXmppCredentials();
  const botId = import.meta.env.VITE_ASSISTANT_BOT_ID as string; // e.g. "[email protected]"

  return (
    <XmppProvider>
      <AiAssistant
        botId={botId}
        botAvatar={'https://example.com/path/to/avatar.png'}
        botDisplayName={'My Custom Bot'}
      />
    </XmppProvider>
  );
}
  • botId is the assistant/bot JID, e.g. [email protected].
  • botAvatar sets the avatar URL displayed for the assistant.
  • botDisplayName sets the human-friendly assistant name.
  • createAnonymousXmppCredentials() is used internally by the assistant mode to bootstrap an ephemeral user.

Reference docs and examples: see the Ethora Chat Component on npm (readme).

Quick start (Script embed)

Use this when you want a drop-in widget without React. Ensure your server serves the built assets from dist.

<link rel="stylesheet" href="/dist/ai-chat-widget.css" />
<script
  id="chat-content-assistant"
  data-bot-id="YOUR_BOT_JID"
  data-bot-avatar="https://example.com/path/to/avatar.png"
  data-bot-display-name="My Custom Bot"
  src="/dist/ethora_assistant.js"
  defer
></script>

Notes:

  • The script auto-injects a <div id="chat-widget"> and mounts the assistant into a Shadow DOM for safe styling isolation.
  • You can dynamically change data-bot-id; relevant storage is cleared on change to avoid state leakage.
  • Supported data attributes: data-bot-id, data-bot-avatar, data-bot-display-name.

Configuration reference (essentials)

Below are commonly used options. The full config is typed by IConfig in src/types/types.ts.

interface IConfig {
  colors?: { primary?: string; secondary?: string };
  assistantButton?: {
    position?: { right?: number; bottom?: number };
    ariaLabel?: string;
  };
  assistantPopup?: {
    width?: number;
    height?: number;
    style?: React.CSSProperties;
    closeButtonAriaLabel?: string;
  };
  assistantOpenStateKey?: string;
  disableMedia?: boolean;
  disableInteractions?: boolean;
  disableRooms?: boolean;
  xmppSettings?: {
    devServer?: string;
    host?: string;
    conference?: string;
  };
  assistantMode?: { enabled: boolean; user: { jid: string; password: string } };
  botAvatar?: string;
  botDisplayName?: string;
}

Recommended assistant defaults:

  • disableMedia, disableInteractions, disableRooms: true for focused assistant UX.
  • Provide assistantOpenStateKey to persist open/closed state across reloads.

Public API

import {
  ChatComponent,
  XmppProvider,
  createAnonymousXmppCredentials,
} from '@ethora/ai-chat-widget';
  • Library entry points: maindist/main.js, types → dist/main.d.ts.

Storage and state

The widget uses localStorage keys to persist user session and UI state. When data-bot-id changes (embed mode), it clears relevant keys to prevent cross-bot contamination.

Keys (subject to change):

  • EthoraAssistantOpen / assistantChatOpen (open state)
  • Assistant user, messages, and timestamps
  • Redux persistence keys for settings and rooms

Scripts

npm run dev       # Start example app (Vite)
npm run build     # Type-check then build widget and example
npm run build:lib # Build library bundles and types
npm run preview   # Preview example build
npm run lint      # Lint
npm run lint:fix  # Auto-fix lint and format

Security considerations

  • Use TLS (wss://) for XMPP WebSocket transport.
  • In production, avoid long-lived anonymous credentials; provision user accounts or short-lived tokens.
  • Validate and sanitize any user-provided content rendered in custom integrations.
  • If embedding on third-party sites, ensure CSP and CORS policies are configured safely.

Performance notes

  • The widget mounts lazily and keeps a small DOM footprint.
  • Prefer assistant mode with interactions disabled to minimize network chatter.
  • Cache-bust and serve dist assets with HTTP compression (gzip/brotli) and long-lived cache headers.

Accessibility

  • Buttons and popups include ARIA labels; provide meaningful labels in config for your locale.
  • Colors should meet contrast guidelines; customize colors accordingly.

License

AGPL — see LICENSE.txt.

Support

For enterprise support, feature requests, or integration help, contact Ethora.