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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@openchatai/widget

v1.5.23

Published

```bash pnpm add @opencopilot/widget ```

Downloads

4,860

Readme

The one and only chat widget for open

How to Get Started

1. Install the Package

pnpm add @opencopilot/widget

2. Import the package

import { Widget, WidgetRoot } from "@opencopilot/widget/basic";

3. Use the Widget

<div>
  <WidgetRoot>
    <Widget />
  </WidgetRoot>
</div>

Widget Root is just the data layer for the widget. It is required to be present in the parent component of the widget. You can Pass options to the WidgetRoot component to customize the widget.

type WidgetOptions = {
  token: string;
  headers?: Record<string, string>;
  queryParams?: Record<string, string>;
  initialMessages: string;
  apiUrl: string;
  socketUrl: string;
  debug?: boolean;
  language?: LangType;
  user?: {
    name?: string;
    email?: string;
    phone?: string;
    customData?: Record<string, string>;
    avatarUrl?: string;
  };
  bot?: {
    name?: string;
    avatarUrl?: string;
  };
  components?: ComponentType[];
};

also you must import the css file too.

import "@opencopilot/widget/index.css";

also the styles are scoped to the widget only so the widget should have a container with data-chat-widget

import { Widget, WidgetRoot, WidgetPopover } from "@opencopilot/widget";
import "@opencopilot/widget/index.css";
<div data-chat-widget>
  <WidgetRoot>
    <Widget />
  </WidgetRoot>
</div>;

How about the WidgetPopover ?

It's a component that you can use to show the widget in a popover fixed to the bottom left corner

<div data-chat-widget>
  <WidgetPopover>
    <Widget />
  </WidgetPopover>
</div>

How can i Change the colors of the widget ?

these are the css variables that you can change to customize the widget you may add these variables to the parent container of the widget to override the default colors

const vars = `
[--primary:211_65%_59%]
[--foreground:0_0%_0%]
[--background:0_0%_100%]
[--secondary:0_0%_96%]
[--primary-foreground:217_72%_18%]
[--accent:0_0_22%]
`;

I don't want your ui ? can i use my own ?

Yes You can, every thing in this lib is exported so u can build your own ui on top of it Even the core hook of the widget is exported so you can use it to build your own ui