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

@conversea/widget

v1.2.0

Published

Embeddable AI chatbot widget for websites with React and Next.js components

Readme

Conversea Widget Integration Guide

Package Overview

The @conversea/widget is a lightweight, framework-agnostic npm package that provides an embeddable AI chat widget for websites. Companies can integrate this widget using their API key to provide AI-powered customer support based on their products, services, and FAQs.

Installation

npm install @conversea/widget
# or
yarn add @conversea/widget
# or
pnpm add @conversea/widget

Quick Start

1. Basic Integration (ES Modules)

import ConverseaWidget from '@conversea/widget';

// Initialize the widget
const widget = ConverseaWidget.init({
  apiKey: 'tc_your_company_api_key',
  position: 'bottom-right',
  themeColor: '#3B82F6',
  welcomeMessage: 'Hello! How can I help you today?',
  placeholder: 'Type your message...',
  autoOpen: false
});

2. CommonJS Integration

const ConverseaWidget = require('@conversea/widget');

const widget = ConverseaWidget.init({
  apiKey: 'tc_your_company_api_key',
  // ... other options
});

3. Browser Integration (UMD)

<!DOCTYPE html>
<html>
<head>
    <title>My Website</title>
</head>
<body>
    <!-- Your website content -->
    
    <!-- Include the widget -->
    <script src="https://unpkg.com/@conversea/widget@latest/dist/index.umd.js"></script>
    <script>
        ConverseaWidget.init({
            apiKey: 'tc_your_company_api_key',
            position: 'bottom-right',
            themeColor: '#3B82F6',
            welcomeMessage: 'Hello! How can I help you today?'
        });
    </script>
</body>
</html>

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | Required | Your company's API key (starts with 'tc_') | | position | string | 'bottom-right' | Widget position: 'bottom-right', 'bottom-left', 'top-right', 'top-left' | | themeColor | string | '#3B82F6' | Primary theme color for the widget | | welcomeMessage | string | 'Hello! How can I help you today?' | Initial message shown to users | | placeholder | string | 'Type your message...' | Input field placeholder text | | height | string | '500px' | Chat window height | | width | string | '350px' | Chat window width | | autoOpen | boolean | false | Whether to auto-open the chat window | | showCloseButton | boolean | true | Show close button in chat header | | enableSounds | boolean | false | Enable notification sounds |

API Methods

ConverseaWidget.init(config)

Initializes and returns a new chat widget instance.

const widget = ConverseaWidget.init({
  apiKey: 'tc_your_api_key',
  position: 'bottom-right'
});

ConverseaWidget.destroy()

Removes the widget from the page and cleans up resources.

ConverseaWidget.destroy();

ConverseaWidget.getInstance()

Returns the current widget instance or null if no widget is active.

const currentWidget = ConverseaWidget.getInstance();
if (currentWidget) {
  console.log('Widget is active');
}

Instance Methods

const widget = ConverseaWidget.init(config);

// Update configuration
widget.updateConfig({
  themeColor: '#FF6B6B',
  welcomeMessage: 'Hi there! How can I assist you?'
});

// Get current state
const state = widget.getState();
console.log(state.isOpen, state.messages);

// Manually destroy
widget.destroy();

Advanced Usage

Dynamic Configuration

// Initialize with basic config
let widget = ConverseaWidget.init({
  apiKey: 'tc_your_api_key'
});

// Update based on user preference
function updateTheme(color) {
  widget.updateConfig({
    themeColor: color
  });
}

// Update welcome message based on time
const hour = new Date().getHours();
const welcomeMessage = hour < 12 
  ? 'Good morning! How can I help?' 
  : 'Good afternoon! How can I assist you?';

widget.updateConfig({ welcomeMessage });

Conditional Loading

// Only load widget for specific pages
if (window.location.pathname.includes('/support')) {
  ConverseaWidget.init({
    apiKey: 'tc_your_api_key',
    autoOpen: true,
    welcomeMessage: 'Welcome to our support center!'
  });
}

React Integration

import { useEffect, useRef } from 'react';
import ConverseaWidget from '@conversea/widget';

function App() {
  const widgetRef = useRef(null);

  useEffect(() => {
    // Initialize widget
    widgetRef.current = ConverseaWidget.init({
      apiKey: process.env.REACT_APP_CONVERSEA_API_KEY,
      position: 'bottom-right',
      themeColor: '#3B82F6'
    });

    // Cleanup on unmount
    return () => {
      if (widgetRef.current) {
        widgetRef.current.destroy();
      }
    };
  }, []);

  return (
    <div className="App">
      {/* Your app content */}
    </div>
  );
}

Vue.js Integration

<template>
  <div id="app">
    <!-- Your app content -->
  </div>
</template>

<script>
import ConverseaWidget from '@conversea/widget';

export default {
  name: 'App',
  mounted() {
    this.widget = ConverseaWidget.init({
      apiKey: process.env.VUE_APP_CONVERSEA_API_KEY,
      position: 'bottom-right',
      themeColor: '#3B82F6'
    });
  },
  beforeDestroy() {
    if (this.widget) {
      this.widget.destroy();
    }
  }
};
</script>

Getting Your API Key

  1. Sign up at Conversea Admin Portal
  2. Complete your company profile
  3. Navigate to Settings > API Keys
  4. Generate a new API key
  5. Copy the key (starts with 'tc_') and use it in your widget configuration

Customization

Custom Styling

The widget automatically injects minimal CSS. You can override styles:

/* Customize chat bubble */
#conversea-widget .chat-bubble {
  background-color: #your-color !important;
  width: 70px !important;
  height: 70px !important;
}

/* Customize chat window */
#conversea-widget .chat-window {
  border-radius: 20px !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
}

Multiple Widgets

// Not recommended, but possible
const supportWidget = ConverseaWidget.init({
  apiKey: 'tc_support_key',
  position: 'bottom-right'
});

// Destroy first widget before creating second
supportWidget.destroy();

const salesWidget = ConverseaWidget.init({
  apiKey: 'tc_sales_key',
  position: 'bottom-left'
});

TypeScript Support

The package includes full TypeScript declarations:

import ConverseaWidget, { ChatWidgetConfig, ChatWidget } from '@conversea/widget';

const config: ChatWidgetConfig = {
  apiKey: 'tc_your_api_key',
  position: 'bottom-right',
  themeColor: '#3B82F6'
};

const widget: ChatWidget = ConverseaWidget.init(config);

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+
  • Mobile browsers (iOS Safari, Chrome Mobile)

Performance

  • Bundle Size: ~11KB gzipped
  • Runtime: Zero external dependencies
  • Memory: < 2MB typical usage
  • Load Time: < 100ms initialization

Troubleshooting

Common Issues

  1. Widget not appearing

    • Check if API key is valid
    • Ensure key starts with 'tc_'
    • Check browser console for errors
  2. API key validation failed

    • Verify API key is active in admin portal
    • Check network connectivity
    • Ensure correct API endpoint
  3. Styling conflicts

    • Widget uses CSS isolation
    • Check for z-index conflicts
    • Use !important for overrides

Debug Mode

// Enable debug logging
window.CONVERSEA_DEBUG = true;

ConverseaWidget.init({
  apiKey: 'tc_your_api_key'
});

Examples

See the /examples directory for complete integration examples:

  • Vanilla HTML/JS
  • React application
  • Vue.js application
  • WordPress plugin
  • Shopify integration

Support

For technical support:

License

MIT License - see LICENSE file for details.