glitchgrab 1.23.1 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -454,6 +454,37 @@ import { GlitchgrabErrorBoundary } from "glitchgrab";
454
454
  | `onError` | `(error: Error) => void` | - | Called on unhandled errors |
455
455
  | `onReportSent` | `(result: ReportResult) => void` | - | Called after a report is sent |
456
456
  | `fallback` | `ReactNode` | - | Error boundary fallback UI |
457
+ | `ignoreErrors` | `(string \| RegExp)[]` | - | Skip auto-capture for errors whose message matches (substring for `string`, `.test()` for `RegExp`) |
458
+
459
+ ### Ignoring known-noisy errors
460
+
461
+ Some errors that reach `window.onerror` aren't app bugs — browser extension bridges (Grammarly, password managers, etc.) can throw errors that look like they come from your page. If you keep seeing the same non-actionable signature auto-filed as a report, suppress it:
462
+
463
+ ```tsx
464
+ <GlitchgrabProvider
465
+ token={process.env.NEXT_PUBLIC_GLITCHGRAB_TOKEN!}
466
+ ignoreErrors={[/Object Not Found Matching Id.*MethodName:update/]}
467
+ >
468
+ {children}
469
+ </GlitchgrabProvider>
470
+ ```
471
+
472
+ ## Do I need a Content-Security-Policy allowance?
473
+
474
+ If your app sets a CSP header (e.g. via `proxy.ts` / `middleware.ts` in Next.js), allow Glitchgrab's API host so `fetch` calls from the SDK aren't blocked:
475
+
476
+ ```ts
477
+ // proxy.ts / middleware.ts
478
+ response.headers.set(
479
+ "Content-Security-Policy",
480
+ "connect-src 'self' https://glitchgrab.dev; ..." // plus your existing directives
481
+ );
482
+ ```
483
+
484
+ - `connect-src https://glitchgrab.dev` — required for `sendReport`, `enhanceText`, `transcribeAudio`, and the report-fetching hooks/REST calls. All SDK requests go to this single host by default.
485
+ - If you pass a custom `baseUrl` prop, allow that host instead (self-hosted or proxied deployments).
486
+ - Screenshot capture (`html2canvas-pro`) runs entirely client-side against `document.body` — no network request, no extra `img-src`/`connect-src` needed for it.
487
+ - No `script-src`, `style-src`, or `frame-src` allowances are required — the SDK doesn't load remote scripts, styles, or iframes.
457
488
 
458
489
  ## How does auto-capture work?
459
490
 
package/dist/index.d.mts CHANGED
@@ -12,6 +12,12 @@ interface GlitchgrabConfig {
12
12
  breadcrumbs?: boolean;
13
13
  /** Max breadcrumbs to keep (default: 50) */
14
14
  maxBreadcrumbs?: number;
15
+ /**
16
+ * Skip auto-capture for errors matching any of these patterns (checked against the
17
+ * error message). String = substring match, RegExp = `.test()`. Use for known-noisy
18
+ * signatures that aren't app bugs — e.g. browser extension bridge errors.
19
+ */
20
+ ignoreErrors?: (string | RegExp)[];
15
21
  }
16
22
  type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
17
23
  type ReportSeverity = "low" | "medium" | "high";
@@ -91,6 +97,12 @@ interface GlitchgrabProviderProps {
91
97
  types?: ReportType[];
92
98
  /** Show severity picker for BUG type (default: true) */
93
99
  showSeverity?: boolean;
100
+ /**
101
+ * Skip auto-capture for errors matching any of these patterns (checked against the
102
+ * error message). String = substring match, RegExp = `.test()`. Use for known-noisy
103
+ * signatures that aren't app bugs — e.g. browser extension bridge errors.
104
+ */
105
+ ignoreErrors?: (string | RegExp)[];
94
106
  }
95
107
  interface ReportButtonProps {
96
108
  position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
package/dist/index.d.ts CHANGED
@@ -12,6 +12,12 @@ interface GlitchgrabConfig {
12
12
  breadcrumbs?: boolean;
13
13
  /** Max breadcrumbs to keep (default: 50) */
14
14
  maxBreadcrumbs?: number;
15
+ /**
16
+ * Skip auto-capture for errors matching any of these patterns (checked against the
17
+ * error message). String = substring match, RegExp = `.test()`. Use for known-noisy
18
+ * signatures that aren't app bugs — e.g. browser extension bridge errors.
19
+ */
20
+ ignoreErrors?: (string | RegExp)[];
15
21
  }
16
22
  type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
17
23
  type ReportSeverity = "low" | "medium" | "high";
@@ -91,6 +97,12 @@ interface GlitchgrabProviderProps {
91
97
  types?: ReportType[];
92
98
  /** Show severity picker for BUG type (default: true) */
93
99
  showSeverity?: boolean;
100
+ /**
101
+ * Skip auto-capture for errors matching any of these patterns (checked against the
102
+ * error message). String = substring match, RegExp = `.test()`. Use for known-noisy
103
+ * signatures that aren't app bugs — e.g. browser extension bridge errors.
104
+ */
105
+ ignoreErrors?: (string | RegExp)[];
94
106
  }
95
107
  interface ReportButtonProps {
96
108
  position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";