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

@bbearai/react

v0.5.2

Published

BugBear React components for web apps

Readme

@bbearai/react

React components for integrating BugBear QA into your web application.

Installation

npm install @bbearai/react

Quick Start

1. Wrap your app with BugBearProvider

import { BugBearProvider, BugBearPanel } from '@bbearai/react';

function App() {
  return (
    <BugBearProvider
      config={{
        projectId: 'your-project-id', // Get this from BugBear dashboard
        getCurrentUser: async () => {
          // Return your logged-in user's info
          const user = await yourAuthMethod();
          if (!user) return null;
          return {
            id: user.id,
            email: user.email, // Must match email in BugBear testers list
            name: user.name,   // Optional, shown on reports
          };
        },
      }}
    >
      <YourApp />
      <BugBearPanel />
    </BugBearProvider>
  );
}

2. Add testers in BugBear dashboard

The widget only appears for users whose email is registered as a tester in your BugBear project.

Configuration Options

<BugBearProvider
  config={{
    // Required
    projectId: 'your-project-id',
    getCurrentUser: async () => ({ id: user.id, email: user.email }),

    // Optional — rich context for bug reports
    getAppContext: () => ({
      currentRoute: window.location.pathname,
      userRole: currentUser?.role,       // 'owner', 'manager', 'guest', etc.
      propertyId: currentProperty?.id,   // App-specific context
      custom: { theme: 'dark' },         // Any additional data
    }),

    // Optional — callbacks
    onNavigate: (route) => router.push(route),  // Deep linking from test cases
    onReportSubmitted: (report) => { ... },      // After report submission

    // Optional — self-hosted
    supabaseUrl: '...',
    supabaseAnonKey: '...',
  }}
  enabled={isAuthReady} // Delay init until auth is ready (default: true)
>

Why use getAppContext?

When a tester reports a bug, BugBear attaches the app context to the report. This tells the developer fixing the bug:

  • Which route the bug is on (auto-captured, but getAppContext is more accurate)
  • What role the user has (critical for role-dependent bugs)
  • App-specific state like selected property, active filters, etc.

Without getAppContext, BugBear still captures the route automatically via window.location.pathname.

Automatic Context Capture

BugBearProvider automatically captures debugging context with zero configuration:

| Data | Details | |------|---------| | Console logs | Last 50 console.log/warn/error/info calls | | Network requests | Last 20 fetch() calls with method, URL, status, duration | | Failed response bodies | First 500 chars of 4xx/5xx response bodies | | Navigation history | Last 20 route changes (auto-tracked via pushState/popstate) | | Performance | Page load time, memory usage | | Environment | Language, timezone, online status |

This data is attached to every bug report and available to the MCP server's get_report_context tool for AI-assisted debugging.

Components

BugBearProvider

Wraps your app and provides BugBear context to child components. Automatically starts context capture.

BugBearPanel

The floating widget UI. Renders a button that opens the bug report panel.

<BugBearPanel
  position="bottom-right" // 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
/>

The bug report form includes:

  • Report type (Bug, Feedback, Idea)
  • Severity selector (for bugs)
  • Description
  • "Where did it happen?" — lets the tester specify the affected route if different from current page
  • Screenshot attachments

BugBearErrorBoundary

Automatically captures React errors and offers to report them.

import { BugBearErrorBoundary } from '@bbearai/react';

<BugBearErrorBoundary>
  <YourComponent />
</BugBearErrorBoundary>

Hooks

useBugBear

Access BugBear state and methods from any component.

import { useBugBear } from '@bbearai/react';

function MyComponent() {
  const {
    client,           // BugBear client instance
    isTester,         // Is current user a tester?
    isQAEnabled,      // Is QA mode enabled for this project?
    shouldShowWidget, // Should the widget be visible?
    testerInfo,       // Current tester's info
    assignments,      // Test cases assigned to this tester
    issueCounts,      // { open, done, reopened } issue counts
    refreshIssueCounts, // Refresh issue counts
    isLoading,        // Loading state
  } = useBugBear();

  // Submit a report programmatically
  const handleReport = async () => {
    await client?.submitReport({
      type: 'bug',
      description: 'Something went wrong',
      severity: 'high',
      appContext: client.getAppContext(),
    });
  };
}

Widget Screens

The widget includes screens for bug reporting, test execution, messaging, and issue tracking:

| Screen | Purpose | |--------|---------| | Home | Smart hero + action grid + issue tracking cards (Open, Done, Reopened) | | Test List | Assignments with filter tabs (All, To Do, Done, Re Opened) | | Test Detail | Step-by-step test execution | | Report | Bug/feedback submission | | Issue List | Issues filtered by category with severity indicators | | Issue Detail | Full issue details with verification proof and original bug context | | Message List | Thread list with unread badges | | Thread Detail | Chat thread with reply | | Compose Message | New message thread | | Profile | Tester info and stats |

How It Works

  1. User logs in to your app
  2. BugBear checks if the user's email is in the testers list
  3. Context capture starts — console logs, network requests, and navigation are recorded
  4. Widget appears only for registered testers when QA mode is enabled
  5. Testers submit bug reports with automatic debugging context attached
  6. Testers track issues — Open, Done (with verification proof), and Reopened cards on home screen
  7. Reports appear in your BugBear dashboard with full context for developers

Example: Next.js App Router

// app/providers.tsx
'use client';

import { BugBearProvider, BugBearPanel } from '@bbearai/react';
import { useAuth } from './auth'; // Your auth hook

export function Providers({ children }) {
  const { user, isLoaded } = useAuth();

  return (
    <BugBearProvider
      config={{
        projectId: process.env.NEXT_PUBLIC_BUGBEAR_PROJECT_ID!,
        getCurrentUser: async () => {
          if (!user) return null;
          return { id: user.id, email: user.email, name: user.name };
        },
        getAppContext: () => ({
          currentRoute: window.location.pathname,
          userRole: user?.role,
        }),
      }}
      enabled={isLoaded} // Wait for auth before initializing
    >
      {children}
      <BugBearPanel />
    </BugBearProvider>
  );
}

// next.config.ts — required for Next.js
const config = {
  transpilePackages: ['@bbearai/core', '@bbearai/react'],
};

Support

  • GitHub: https://github.com/Bear-Eddy/bugbear