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

mirza-ai-chatbox

v1.0.5

Published

A standalone JavaScript AI chat widget

Readme

Mirza Chat Box

A standalone JavaScript chat widget that can be easily integrated into any website with a simple script tag.

Features

  1. Socket Connection

    • Real-time communication with WebSocket
    • Automatic reconnection
    • Event-based messaging
  2. Authentication System

    • Login/signup functionality
    • Token validation and storage
    • Authentication state management
  3. Support Mode Management

    • Human support request/cancel functionality
    • Support mode state management
    • Persistence in localStorage
  4. Message Rating System

    • Message rating UI and functionality
    • Optimistic updates and server responses
  5. Typing Indicator

    • Real-time typing status
    • Socket events for typing status
  6. Error Handling

    • Comprehensive error handling
    • User-friendly error messages
  7. UI Improvements

    • Message rendering with proper formatting
    • Support for system messages
    • Styling and animations
  8. Localization Support

    • Support for RTL languages
    • Proper text direction
  9. Debug Mode

    • Optional debug information
    • Developer tools
  10. Performance Optimization

    • Efficient message rendering
    • Optimized DOM updates

Integration with jsDelivr CDN

You can easily integrate Mirza Chat Box into your website using jsDelivr CDN:

<!-- Add this to your HTML file -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mirza-chat-box.js"></script>
<script>
  // Initialize the chat widget
  window.addEventListener('DOMContentLoaded', function() {
    MirzaChat.init({
      apiUrl: 'https://your-api-url.com',
      websiteId: 'your-website-id',
      primaryColor: '#0066FF',
      companyName: 'Your Company Name'
    });
  });
</script>

Using Data Attributes

You can also configure the chat widget using data attributes on the script tag:

<script 
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mirza-chat-box.js"
  data-api-url="https://your-api-url.com"
  data-website-id="your-website-id"
  data-primary-color="#0066FF"
  data-company-name="Your Company Name"
  data-position="bottom-right"
  data-initial-message="Hello! How can I help you today?"
></script>

Using Global Configuration Variable

Another option is to set a global configuration variable before loading the script:

<script>
  window.MIRZA_CHAT_CONFIG = {
    apiUrl: 'https://your-api-url.com',
    websiteId: 'your-website-id',
    primaryColor: '#0066FF',
    companyName: 'Your Company Name'
  };
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mirza-chat-box.js"></script>

Usage

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mirza-chat-box.js"></script>
<script>
  const chatBox = new MirzaChatBox({
    apiUrl: 'https://api.example.com',
    websiteId: 'your-website-id',
    primaryColor: '#0066FF',
    companyName: 'پشتیبان میرزا'
  });
  
  chatBox.init();
</script>

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiUrl | string | - | API endpoint for the chat service | | websiteId | string | - | Unique identifier for your website | | primaryColor | string | '#0066FF' | Primary color for the chat widget | | secondaryColor | string | '#E8F1FF' | Secondary color for the chat widget | | companyName | string | 'پشتیبان میرزا' | Company name displayed in the chat header | | position | string | 'bottom-right' | Position of the chat widget ('bottom-right' or 'bottom-left') | | initialMessage | string | 'سلام 😊 من میرزا چت هستم. چطور میتونم کمکتون کنم؟ 🤖' | Initial message shown when chat is opened |

API Methods

Once initialized, you can control the chat widget programmatically:

// Open the chat widget
MirzaChat.openChat();

// Close the chat widget
MirzaChat.closeChat();

// Update configuration dynamically
MirzaChat.updateConfig({
  primaryColor: '#FF0000',
  companyName: 'New Company Name'
});

Development

# Install dependencies
npm install

# Build for production
npm run build

# Development with hot reload
npm run dev

License

MIT