@everframe/react

中文文档
1.6.7发布于 2026/10/29MITTypeScriptES Module近 30 天下载 2298

React SDK for Everframe — AI-ready in-app bug reporting with screenshots, annotation, session replay, breadcrumbs, and crash capture.

原始使用文档
文档目录10 节
  1. Install
  2. Quickstart
  3. Reporting caught exceptions
  4. Errors no boundary catches
  5. Triggers
  6. Samsung and LG TVs
  7. Strict-CSP environments
  8. Marking sensitive content (PRIV-02)
  9. Bundling notes
  10. Example

@everframe/react

React (web) SDK for Everframe — AI-ready bug reporting embedded in your app.

MIT · React 18 || 19 · ESM-only · Node 20+

Install

pnpm add @everframe/react
# or
npm install @everframe/react

Optional but recommended: install the displayName preservation plugin so component names survive minification:

# Babel users (Webpack / CRA / Next.js with Babel config)
pnpm add -D @everframe/babel-plugin-displayname

# SWC users (Next.js default since 12+)
pnpm add -D @everframe/swc-plugin-displayname

Quickstart

Wrap your app once. The Provider mounts the floating bubble, registers the hotkey, and owns the reporter modal lifecycle.

// app/layout.tsx (Next.js app router)
import { EverframeProvider } from '@everframe/react';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <body>
        <EverframeProvider config={{ sdkKey: 'evf_live_xxxxxxxxxxxxxxxx' }}>
          {children}
        </EverframeProvider>
      </body>
    </html>
  );
}

Open the reporter programmatically from anywhere:

'use client';
import { useEverframe } from '@everframe/react';

export function HelpButton() {
  const { open } = useEverframe();
  return <button onClick={open}>Report a bug</button>;
}

Reporting caught exceptions

Use useEverframe().captureException(error) inside components, or the top-level export in a catch block or an error boundary:

import { captureException } from '@everframe/react';

try {
  await saveCart();
} catch (error) {
  captureException(error);
}

Reports are marked handled and nonfatal and use existing redaction, user context, breadcrumbs, and outbox delivery. The call returns void, does not open UI, and does not acknowledge server receipt. The top-level export is a no-op without a mounted provider. kill(), disabled, and crashReporting.disabled also suppress capture.

Configure appVersion and appBuild on the provider to identify the release and deployed build. The build is stored as context.app.build on errors and user-filed reports; automatic source-map processing is not available yet.

The same error object is captured once per SDK instance across hook, top-level, and automatic handlers. The first accepted capture determines classification. Explicit and automatic capture each allow one report per fingerprint and ten per SDK instance, independently. Transport retries retain the report ID.

Errors no boundary catches

When a component throws while rendering, in an effect or in a lifecycle method and no error boundary inside EverframeProvider catches it, React unmounts the whole tree. The provider reports that error as a fatal crash (source: 'crash', fatal: true, mechanism onerror), with React's component stack after the message (This error is located at:). No error boundary is needed. The report is saved to the outbox before it is sent, so a failed send goes out on the next page load.

The provider then hands the same error on unchanged: an error boundary of yours around the provider still catches it, and otherwise React reports it to the page, where the SDK recognises it and does not report it again. Errors that a boundary inside the provider catches are not reported automatically; call captureException from that boundary's componentDidCatch, with React's component stack so the error page says which components it happened in: captureException(error, { componentStack: info.componentStack }). A React 18 development build reports a failed render or effect to window.onerror before any boundary sees it, so in development such an error can arrive as a non-fatal error, instead of or as well as the fatal report.

tests/render-error-browser.mjs checks this in Chromium against real React roots, production and development builds:

node tests/render-error-browser.mjs /tmp/render-error-proof
node tests/render-error-browser.mjs /tmp/render-error-proof-18 --react-root <dir with react@18 installed>

Triggers

By default the SDK installs:

  • The app's dashboard-configured hotkey, defaulting to Cmd/Ctrl+Shift+B (Mod+Shift+B). The dashboard value is authoritative; there is no SDK-side override.

Mod resolves to Cmd on macOS and Ctrl elsewhere.

A visible trigger (bubble, menu item, etc.) is the host app's responsibility — call useEverframe().open() from your own button to bring up the reporter.

To report crashes and errors without letting users file reports, set reporter: { disabled: true } in the provider config. That session has no hotkey, no replies button or inbox, and open() rejects with EverframeReporterDisabledError. Session replay uses the app's crash-only sampling rate (0 by default) and network bodies stay off. See crash-only sessions.

Samsung and LG TVs

On a Samsung Tizen or LG webOS TV, the provider sets up device linking and the remote capture gesture the same way @everframe/web does. Pass debugBuild: true for debug builds and quickCapture: { disabled: true } to turn it off. See Quick capture on Samsung and LG TVs.

Strict-CSP environments

If your app sets a strict CSP (script-src 'self' 'nonce-...'), thread the nonce into the SDK so screenshot capture's dynamically-injected styles are accepted:

// Next.js: read the nonce from headers() in your layout
import { headers } from 'next/headers';

export default async function RootLayout({ children }: { children: React.ReactNode }) {
  const nonce = (await headers()).get('x-nonce') ?? '';
  return (
    <EverframeProvider config={{ sdkKey: 'evf_live_xxxxxxxxxxxxxxxx', cspNonce: nonce }}>
      {children}
    </EverframeProvider>
  );
}

Marking sensitive content (PRIV-02)

Three equivalent surfaces — pick whichever fits your codebase:

import { Sensitive, useEverframe } from '@everframe/react';
import { useEffect, useRef } from 'react';

// 1. Component wrapper
<Sensitive><CreditCardNumber /></Sensitive>

// 2. data-attribute (works on any DOM element)
<div data-everframe-sensitive>{value}</div>

// 3. Ref hook
function MyField({ value }: { value: string }) {
  const ref = useRef<HTMLDivElement>(null);
  const { markSensitive } = useEverframe();
  useEffect(() => {
    if (ref.current) markSensitive(ref);
  }, [markSensitive]);
  return <div ref={ref}>{value}</div>;
}

All three resolve to the same internal sensitive-rect registry; pixels under those rects are blanked at capture time before the screenshot bytes leave the device.

Bundling notes

The SDK is ESM-only. Some Next.js + monorepo setups need to transpile workspace packages:

// next.config.ts
transpilePackages: ['@everframe/react', '@everframe/sdk-core', '@everframe/protocol'],

The always-loaded entry measures ~136 KB gzip (pnpm size-limit, budget 240 KB). The heavy capture and annotation dependencies — rrweb, react-konva, and modern-screenshot — are lazy-imported and are not in that number; they load only when the reporter is actually opened.

Example

See examples/react-web/ for a Next.js dogfood project covering both the strict-CSP fixture and the standard SSR fixture.

版本与发布记录

@everframe/react 共发布 15 个版本,首次发布于 2026/09/25;过去 12 个月发布了 15 个版本。

版本发布日期距今
1.6.7latest2026/10/2916 天前
1.6.62026/10/2816 天前
1.6.52026/10/2717 天前
1.6.32026/10/2717 天前
1.6.22026/10/2717 天前
1.6.12026/10/2420 天前

关于 @everframe/react 的常见问题

@everframe/react 是什么?

React SDK for Everframe — AI-ready in-app bug reporting with screenshots, annotation, session replay, breadcrumbs, and crash capture.

如何安装 @everframe/react?

在项目目录运行 npm install @everframe/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 需要手动安装。

@everframe/react 支持 TypeScript 吗?

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

@everframe/react 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@everframe/react 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@everframe/react 可以商用吗?

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

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

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

@everframe/react 还在维护吗?

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