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 🙏

© 2025 – Pkg Stats / Ryan Hefner

krosai-voice-react-widget

v1.0.6

Published

React-based embeddable voice widget for KrosAI

Readme

KrosAI Voice Widget

A modern, embeddable voice widget for websites and web applications. This widget provides voice interaction with KrosAI agents along with text chat capabilities.

KrosAI Voice Widget

Features

  • Voice and text chat with KrosAI agents
  • Customizable appearance and positioning
  • Multiple language support
  • LiveKit integration for high-quality audio streaming
  • Auto-collapse on scroll for better UX
  • Dark and light theme support

Installation

npm install krosai-voice-react-widget --save

Usage

Basic React Integration

import React from 'react';
import KrosAIWidget from 'krosai-voice-react-widget';

function App() {
  return (
    <div>
      <h1>My App</h1>
      <KrosAIWidget 
        agentId="your-agent-id"
        apiKey="your-api-key"
        position="bottom-right"
        primaryColor="#FFD600"
      />
    </div>
  );
}

export default App;

Web Component (HTML)

Include the script:

<script src="node_modules/krosai-voice-react-widget/dist/krosai-widget.js"></script>

Add the widget to your page:

<krosai-widget 
  agent-id="your-agent-id"
  api-key="your-api-key"
  position="bottom-right"
  language="ZA"
></krosai-widget>

Configuration Options

| Property | Type | Default | Description | |-------------------|-----------|-----------------|-----------------------------------------------------------| | agentId | string | - | KrosAI agent ID (required) | | apiKey | string | - | API key for authentication (required) | | position | string | 'bottom-right' | Widget position ('bottom-right', 'bottom-left', 'top-right', 'top-left') | | primaryColor | string | '#FFD600' | Primary brand color | | backgroundColor | string | '#000000' | Background color | | languageCode | string | 'ZA' | Language code ('ZA', 'US', 'GB', 'FR', etc.) | | theme | string | 'dark' | Widget theme ('dark' or 'light') | | apiEndpoint | string | - | Custom API endpoint URL | | debug | boolean | false | Enable debug mode |

Browser Support

The widget supports all modern browsers:

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

TypeScript Support

The package includes TypeScript type definitions. You can use it in your TypeScript projects without any additional setup:

import React from 'react';
import KrosAIWidget from 'krosai-voice-react-widget';

const App: React.FC = () => {
  return (
    <div>
      <h1>My TypeScript App</h1>
      <KrosAIWidget 
        agentId="your-agent-id"
        apiKey="your-api-key"
        position="bottom-right"
        theme="dark"
      />
    </div>
  );
};

export default App;

If you're still seeing TypeScript errors, you can add this to your project:

// In a declaration file (e.g., types.d.ts)
declare module 'krosai-voice-react-widget';

Integration Examples

Vue.js

// In your Vue component
<template>
  <div>
    <h1>My Vue App</h1>
    <div ref="widgetContainer"></div>
  </div>
</template>

<script>
import 'krosai-voice-react-widget/dist/krosai-widget.js';

export default {
  mounted() {
    const widget = document.createElement('krosai-widget');
    widget.setAttribute('agent-id', 'your-agent-id');
    widget.setAttribute('api-key', 'your-api-key');
    widget.setAttribute('position', 'bottom-right');
    this.$refs.widgetContainer.appendChild(widget);
  }
}
</script>

Angular

// In your Angular component
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import 'krosai-voice-react-widget/dist/krosai-widget.js';

@Component({
  selector: 'app-root',
  template: `
    <div>
      <h1>My Angular App</h1>
      <div #widgetContainer></div>
    </div>
  `
})
export class AppComponent implements OnInit {
  @ViewChild('widgetContainer', { static: true }) widgetContainer: ElementRef;

  ngOnInit() {
    const widget = document.createElement('krosai-widget');
    widget.setAttribute('agent-id', 'your-agent-id');
    widget.setAttribute('api-key', 'your-api-key');
    widget.setAttribute('position', 'bottom-right');
    this.widgetContainer.nativeElement.appendChild(widget);
  }
}

Flutter WebView

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class KrosAIWidgetPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('KrosAI Widget')),
      body: WebView(
        javascriptMode: JavascriptMode.unrestricted,
        onWebViewCreated: (WebViewController controller) {
          controller.loadUrl('about:blank');
          _loadWidget(controller);
        },
      ),
    );
  }

  void _loadWidget(WebViewController controller) {
    final String widgetHtml = '''
      <!DOCTYPE html>
      <html>
      <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="https://unpkg.com/[email protected]/dist/krosai-widget.js"></script>
      </head>
      <body>
        <krosai-widget 
          agent-id="your-agent-id"
          api-key="your-api-key"
          position="bottom-right">
        </krosai-widget>
      </body>
      </html>
    ''';
    controller.loadUrl(Uri.dataFromString(
      widgetHtml,
      mimeType: 'text/html',
      encoding: Encoding.getByName('utf-8'),
    ).toString());
  }
}

Development

To run the test environment:

npm run test-widget

License

ISC © KrosAI