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

@futurebase/chat

v0.1.5

Published

Embeddable chat widget for FutureBase — React and Next.js integrations

Readme

@futurebase/chat

Embeddable chat widget for FutureBase. Drop-in React and Next.js components that add AI-powered customer support chat to your website.

Installation

npm install @futurebase/chat

Peer Dependencies

React 18+ is required. Next.js 14+ is required for the Next.js integration.

# React only
npm install react react-dom

# Next.js
npm install react react-dom next

Quick Start

React

import { ChatProvider, ChatBubble } from "@futurebase/chat/react";

function App() {
  return (
    <ChatProvider wid="your-website-id">
      <ChatBubble />
    </ChatProvider>
  );
}

Next.js (App Router)

The Next.js entry point provides a ChatBubble that uses usePathname() for reliable route-change detection:

import { ChatProvider } from "@futurebase/chat/nextjs";
import { ChatBubble } from "@futurebase/chat/nextjs";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        <ChatProvider wid="your-website-id">
          {children}
          <ChatBubble />
        </ChatProvider>
      </body>
    </html>
  );
}

Components

ChatProvider

Required wrapper that provides the chat context to all child components. Handles the status check and open/close state.

<ChatProvider
  wid="your-website-id"
  embedUrl="https://embed.futurebase.io"
  ignorePaths={["/admin/*", "/login"]}
>
  {children}
</ChatProvider>

| Prop | Type | Required | Description | |------|------|----------|-------------| | wid | string | Yes | Your website ID | | children | ReactNode | Yes | Child components | | embedUrl | string | No | Custom embed app URL | | serverUrl | string | No | Custom API server URL | | externalUserId | string | No | External user ID to associate with conversations | | ignorePaths | string[] | No | Pathname patterns to hide the bubble on (supports trailing * wildcards) |

ChatBubble (React)

Import from @futurebase/chat/react.

A floating chat button that opens an embedded chat iframe when clicked. Tracks the current page URL via the Navigation API and popstate events.

<ChatBubble
  position="bottom-right"
  theme="dark"
  defaultTab="chat"
/>

| Prop | Type | Default | Description | |------|------|---------|-------------| | position | ChatBubblePosition | "bottom-right" | Screen position of the bubble | | theme | "light" \| "dark" | "light" | Light or dark mode for the chat embed | | icon | ReactNode | — | Custom icon for the bubble button | | defaultTab | "home" \| "chat" \| "help" | — | Default tab when chat opens | | autoStartConversation | boolean | — | Auto-start a conversation on mount |

ChatBubble (Next.js)

Import from @futurebase/chat/nextjs.

Same as the React version, but uses usePathname() from next/navigation for reliable route tracking in the App Router. Accepts the same props as the React ChatBubble (without currentPath).

Hooks

useChat()

Access the chat context from any component inside ChatProvider.

import { useChat } from "@futurebase/chat/react";
// or
import { useChat } from "@futurebase/chat/nextjs";

function CustomChatButton() {
  const { isOpen, open, close, toggle, isEnabled, isLoading } = useChat();

  if (isLoading || !isEnabled) return null;

  return <button onClick={toggle}>{isOpen ? "Close" : "Chat"}</button>;
}

Returns ChatContextValue:

| Property | Type | Description | |----------|------|-------------| | wid | string | Website ID | | isOpen | boolean | Whether the chat is currently open | | open | () => void | Open the chat | | close | () => void | Close the chat | | toggle | () => void | Toggle the chat | | isEnabled | boolean | Whether the widget is enabled (status check passed) | | isLoading | boolean | Whether the status check is still loading | | status | ChatStatusResponse \| null | Full status response from the server |

Types

All types are exported from the root entry point:

import type {
  ChatBubblePosition,
  ChatBubbleProps,
  ChatConfig,
  ChatContextValue,
  ChatStatusResponse,
  ChatTheme,
  FloatingMessage,
} from "@futurebase/chat";

ChatTheme

type ChatTheme = "light" | "dark";

ChatBubblePosition

type ChatBubblePosition = "bottom-right" | "bottom-left";

ChatConfig

type ChatConfig = {
  wid: string;
  embedUrl?: string;
  serverUrl?: string;
  externalUserId?: string;
  ignorePaths?: string[];
};

ChatStatusResponse

type ChatStatusResponse = {
  status: "ok" | "ai-credits-exceeded" | "not-ok";
  enabled: boolean;
  brandingRemoved?: boolean;
  chatBubbleColor?: string;
  chatBubbleIcon?: string;
  chatBubblePosition?: "left" | "right";
  floatingMessages?: FloatingMessage[];
};

FloatingMessage

type FloatingMessage = {
  id: string;
  content: string;
  order: number;
  dismissable: boolean;
  displayDurationMs: number;
  triggerDelayMs: number;
};

Features

  • Floating messages — configure timed popup messages that appear near the chat bubble to engage users
  • Ignore paths — hide the chat widget on specific pages using pathname patterns with wildcard support
  • Dark mode — pass theme="dark" to ChatBubble to switch the embed to dark mode
  • Responsive — adapts to mobile screens automatically
  • Keyboard accessible — escape to close, proper ARIA labels

License

MIT