@eddydesk/react

中文文档
0.13.9发布于 2026/09/27MITTypeScriptESM + CJS近 30 天下载 4626

EddyDesk React components for web apps

原始使用文档
文档目录17 节
  1. Installation
  2. Quick Start
  3. 1. Wrap your app with EddyDeskProvider
  4. 2. Add testers in EddyDesk dashboard
  5. Configuration Options
  6. Why use getAppContext ?
  7. Automatic Context Capture
  8. Components
  9. EddyDeskProvider
  10. EddyDeskPanel
  11. EddyDeskErrorBoundary
  12. Hooks
  13. useEddyDesk
  14. Widget Screens
  15. How It Works
  16. Example: Next.js App Router
  17. Support

@eddydesk/react

React components for integrating EddyDesk QA into your web application.

Installation

npm install @eddydesk/react

Quick Start

1. Wrap your app with EddyDeskProvider

import { EddyDeskProvider, EddyDeskPanel } from '@eddydesk/react';

function App() {
  return (
    <EddyDeskProvider
      config={{
        projectId: 'your-project-id', // Get this from EddyDesk 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 EddyDesk testers list
            name: user.name,   // Optional, shown on reports
          };
        },
      }}
    >
      <YourApp />
      <EddyDeskPanel />
    </EddyDeskProvider>
  );
}

2. Add testers in EddyDesk dashboard

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

Configuration Options

<EddyDeskProvider
  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, EddyDesk 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, EddyDesk still captures the route automatically via window.location.pathname.

Automatic Context Capture

EddyDeskProvider automatically captures debugging context with zero configuration:

DataDetails
Console logsLast 50 console.log/warn/error/info calls
Network requestsLast 20 fetch() calls with method, URL, status, duration
Failed response bodiesFirst 500 chars of 4xx/5xx response bodies
Navigation historyLast 20 route changes (auto-tracked via pushState/popstate)
PerformancePage load time, memory usage
EnvironmentLanguage, 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

EddyDeskProvider

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

EddyDeskPanel

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

<EddyDeskPanel
  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

EddyDeskErrorBoundary

Automatically captures React errors and offers to report them.

import { EddyDeskErrorBoundary } from '@eddydesk/react';

<EddyDeskErrorBoundary>
  <YourComponent />
</EddyDeskErrorBoundary>

Hooks

useEddyDesk

Access EddyDesk state and methods from any component.

import { useEddyDesk } from '@eddydesk/react';

function MyComponent() {
  const {
    client,           // EddyDesk 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
  } = useEddyDesk();

  // 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:

ScreenPurpose
HomeSmart hero + action grid + issue tracking cards (Open, Done, Reopened)
Test ListAssignments with filter tabs (All, To Do, Done, Re Opened)
Test DetailStep-by-step test execution
ReportBug/feedback submission
Issue ListIssues filtered by category with severity indicators
Issue DetailFull issue details with verification proof and original bug context
Message ListThread list with unread badges
Thread DetailChat thread with reply
Compose MessageNew message thread
ProfileTester info and stats

How It Works

  1. User logs in to your app
  2. EddyDesk 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 EddyDesk dashboard with full context for developers

Example: Next.js App Router

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

import { EddyDeskProvider, EddyDeskPanel } from '@eddydesk/react';
import { useAuth } from './auth'; // Your auth hook

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

  return (
    <EddyDeskProvider
      config={{
        projectId: process.env.NEXT_PUBLIC_EDDYDESK_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}
      <EddyDeskPanel />
    </EddyDeskProvider>
  );
}

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

Support

版本与发布记录

@eddydesk/react 共发布 16 个版本,首次发布于 2026/05/01;过去 12 个月发布了 16 个版本。

版本发布日期距今
0.13.9latest2026/09/271 个月前
0.13.82026/09/261 个月前
0.13.72026/09/171 个月前
0.13.62026/09/161 个月前
0.13.52026/09/161 个月前
0.13.42026/09/141 个月前

关于 @eddydesk/react 的常见问题

@eddydesk/react 是什么?

EddyDesk React components for web apps

如何安装 @eddydesk/react?

在项目目录运行 npm install @eddydesk/react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)、react-dom(^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@eddydesk/react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eddydesk/react 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eddydesk/react 可以商用吗?

@eddydesk/react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eddydesk/react 的下载量有多少?

根据 npm 官方下载统计,@eddydesk/react 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,626 次,日均约 154 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eddydesk/react 还在维护吗?

最新版本 0.13.9 发布于 2026/09/27(1 个月前);至今共发布 16 个版本,其中过去 12 个月发布了 16 个;首次发布于 2026/05/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。