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

@ownichat/react

v0.1.0

Published

React components and hooks for the owni.chat AI chat widget.

Readme

@ownichat/react

React components and hooks for the owni.chat AI chat widget.

npm bundle types license

npm install @ownichat/react

| | | | --- | --- | | 🫧 One provider | Drop in <OwniChatProvider> and the widget is live | | 🎛️ Full control | useOwniChat() to open, close and prefill from your own UI | | 📥 Events | useOwniEvent('lead', …) to pipe captured leads into analytics | | 🖼️ Inline mode | <OwniChatInline> for a dedicated support page |

SSR-safe, StrictMode-safe, no runtime dependencies. React 18 and 19.

Using Next.js? Install @ownichat/next instead — it wraps this package with a server component and server-side helpers.

Quick start

Wrap your app once with your public project key (pk_…, from the owni.chat dashboard):

import { OwniChatProvider } from '@ownichat/react';

export function App() {
  return (
    <OwniChatProvider projectKey="pk_your_key">
      <Routes />
    </OwniChatProvider>
  );
}

That's the whole installation — the provider loads the widget script and the floating bubble appears. Appearance, position and welcome message come from your dashboard settings, not from props.

Controlling the widget

import { useOwniChat } from '@ownichat/react';

export function HelpButton() {
  const chat = useOwniChat();

  return (
    <button onClick={chat.open} aria-expanded={chat.isOpen}>
      Chat with us
    </button>
  );
}

useOwniChat() returns:

| | | | --- | --- | | open() / close() / toggle() | Show or hide the panel | | isOpen | Live open state — updates when the visitor opens it too | | sendMessage(text) | Opens the widget and sends a message as the visitor | | setVisitor({ name, email, phone }) | Pre-fills who the visitor is, e.g. for a logged-in user | | ready | true once the widget has mounted |

Calls made before the script finishes loading are queued and replayed, so you never need to guard on ready.

Reacting to events

import { useOwniEvent } from '@ownichat/react';

export function LeadTracking() {
  useOwniEvent('lead', (fields) => {
    analytics.track('chat_lead_captured', fields);
  });

  return null;
}

Events: ready, open, close, message ({ role, text }), lead (the submitted form values, fired at the same moment owni.chat sends its lead_captured webhook).

The handler is read from a ref, so passing an inline arrow function does not resubscribe on every render.

Inline chat panel

Render the chat inside your layout instead of floating in a corner — useful for a dedicated support page:

import { OwniChatInline } from '@ownichat/react';

export function SupportPage() {
  return <OwniChatInline height={600} className="rounded-xl border" />;
}

Inline embeds are always open and fill their container. Several can coexist on one page, and alongside the floating widget.

Identifying logged-in users

const chat = useOwniChat();

useEffect(() => {
  if (user) {
    chat.setVisitor({ name: user.name, email: user.email });
  }
}, [chat, user]);

Self-hosted instances

<OwniChatProvider projectKey="pk_…" scriptUrl="https://chat.example.com/widget/embed.js" />

Loading the widget yourself

Set autoLoad={false} when you want to decide where the script tag goes (for example in a Next.js layout), and keep the provider only for the hooks:

<OwniChatProvider projectKey="pk_…" autoLoad={false}>
  <App />
</OwniChatProvider>

Notes

  • SSR-safe: nothing touches window during render.
  • The script is injected at most once per project key, so StrictMode's double effect and hot reloads do not create a second widget.
  • The project key is public by design — it identifies a project, it does not authorize anything. Server credentials belong in @ownichat/sdk.
  • The widget picks its language from navigator.language and the page's <html lang>.

Related packages

| Package | For | | --- | --- | | @ownichat/sdk | Server-side API: catalog sync, knowledge sources, webhook verification | | @ownichat/next | Next.js server component and server helpers |

Not on React? owni.chat also ships official plugins for WordPress/WooCommerce, Shopify and OpenCart — see owni.chat/integrations.

License

MIT © owni.chat