glitchgrab 1.26.0 → 1.28.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
@@ -158,6 +158,19 @@ Once `GlitchgrabProvider` is mounted, these shortcuts work globally:
158
158
 
159
159
  No configuration needed — shortcuts are active as long as the provider is in the tree.
160
160
 
161
+ ### Showing the shortcut in your own UI
162
+
163
+ The report dialog shows the shortcut on its first step. To advertise it elsewhere — a support menu, a sidebar hint — read `shortcutLabel` instead of hardcoding the string. It resolves to `⌘⇧G` on Mac and `Ctrl+Shift+G` everywhere else, and stays in sync with the handler:
164
+
165
+ ```tsx
166
+ function SupportHint() {
167
+ const { shortcutLabel } = useGlitchgrab();
168
+ return <p>Found a bug? Press {shortcutLabel} anywhere to report it.</p>;
169
+ }
170
+ ```
171
+
172
+ It is SSR-safe: it renders `Ctrl+Shift+G` on the server and corrects to the platform label after mount.
173
+
161
174
  ## How do I fetch reports by user?
162
175
 
163
176
  ### React hook (recommended)
package/dist/index.d.mts CHANGED
@@ -19,7 +19,7 @@ interface GlitchgrabConfig {
19
19
  */
20
20
  ignoreErrors?: (string | RegExp)[];
21
21
  }
22
- type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
22
+ type ReportType = "BUG" | "FEATURE_REQUEST" | "UI_IMPROVEMENT" | "PERFORMANCE" | "SECURITY" | "QUESTION" | "OTHER";
23
23
  type ReportSeverity = "low" | "medium" | "high";
24
24
  interface ReportPayload {
25
25
  token: string;
@@ -93,7 +93,7 @@ interface GlitchgrabProviderProps {
93
93
  maxBreadcrumbs?: number;
94
94
  children: ReactNode;
95
95
  fallback?: ReactNode;
96
- /** Which report types to show in the dialog (default: all four) */
96
+ /** Which report types to show in the dialog (default: all) */
97
97
  types?: ReportType[];
98
98
  /** Show severity picker for BUG type (default: true) */
99
99
  showSeverity?: boolean;
@@ -127,6 +127,12 @@ interface UseGlitchgrabReturn {
127
127
  * Returns the polished text, or the original text on any failure (never throws).
128
128
  */
129
129
  enhanceText: (text: string, screenshot?: string | null) => Promise<string>;
130
+ /**
131
+ * OS-aware label for the shortcut that opens the report dialog —
132
+ * `⌘⇧G` on Mac, `Ctrl+Shift+G` elsewhere. Render this instead of
133
+ * hardcoding the shortcut, so the hint stays in sync with the handler.
134
+ */
135
+ shortcutLabel: string;
130
136
  /** The token being used */
131
137
  token: string;
132
138
  /** The base URL of the Glitchgrab API */
@@ -298,6 +304,24 @@ declare function addBreadcrumb(type: BreadcrumbType, message: string, data?: Rec
298
304
  declare function getBreadcrumbs(): Breadcrumb[];
299
305
  declare function clearBreadcrumbs(): void;
300
306
 
307
+ /**
308
+ * The global keyboard shortcut that opens the Glitchgrab report dialog.
309
+ * Single source of truth — the provider's keydown handler and every label
310
+ * rendered anywhere (SDK dialog, host app UI) derive from this.
311
+ */
312
+ /** Server-safe label. Used during SSR and as the non-Mac label. */
313
+ declare const GLITCHGRAB_SHORTCUT = "Ctrl+Shift+G";
314
+ /** Mac label, using the platform's modifier glyphs. */
315
+ declare const GLITCHGRAB_SHORTCUT_MAC = "\u2318\u21E7G";
316
+ /**
317
+ * OS-aware label for the report-dialog shortcut — `⌘⇧G` on Mac,
318
+ * `Ctrl+Shift+G` elsewhere. Returns the non-Mac label on the server, so
319
+ * render it client-side (or after mount) to avoid a hydration mismatch.
320
+ */
321
+ declare function getShortcutLabel(): string;
322
+ /** True when the keyboard event matches the report-dialog shortcut. */
323
+ declare function matchesShortcut(e: KeyboardEvent): boolean;
324
+
301
325
  declare function sanitizeUrl(url: string): string;
302
326
  declare function captureDeviceInfo(): DeviceInfo | null;
303
327
  declare function captureContext(visitedPages: string[]): CapturedContext;
@@ -329,4 +353,4 @@ declare function computeSignature(params: {
329
353
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
330
354
  declare function clearDedupCache(): void;
331
355
 
332
- export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
356
+ export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabReports, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ interface GlitchgrabConfig {
19
19
  */
20
20
  ignoreErrors?: (string | RegExp)[];
21
21
  }
22
- type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
22
+ type ReportType = "BUG" | "FEATURE_REQUEST" | "UI_IMPROVEMENT" | "PERFORMANCE" | "SECURITY" | "QUESTION" | "OTHER";
23
23
  type ReportSeverity = "low" | "medium" | "high";
24
24
  interface ReportPayload {
25
25
  token: string;
@@ -93,7 +93,7 @@ interface GlitchgrabProviderProps {
93
93
  maxBreadcrumbs?: number;
94
94
  children: ReactNode;
95
95
  fallback?: ReactNode;
96
- /** Which report types to show in the dialog (default: all four) */
96
+ /** Which report types to show in the dialog (default: all) */
97
97
  types?: ReportType[];
98
98
  /** Show severity picker for BUG type (default: true) */
99
99
  showSeverity?: boolean;
@@ -127,6 +127,12 @@ interface UseGlitchgrabReturn {
127
127
  * Returns the polished text, or the original text on any failure (never throws).
128
128
  */
129
129
  enhanceText: (text: string, screenshot?: string | null) => Promise<string>;
130
+ /**
131
+ * OS-aware label for the shortcut that opens the report dialog —
132
+ * `⌘⇧G` on Mac, `Ctrl+Shift+G` elsewhere. Render this instead of
133
+ * hardcoding the shortcut, so the hint stays in sync with the handler.
134
+ */
135
+ shortcutLabel: string;
130
136
  /** The token being used */
131
137
  token: string;
132
138
  /** The base URL of the Glitchgrab API */
@@ -298,6 +304,24 @@ declare function addBreadcrumb(type: BreadcrumbType, message: string, data?: Rec
298
304
  declare function getBreadcrumbs(): Breadcrumb[];
299
305
  declare function clearBreadcrumbs(): void;
300
306
 
307
+ /**
308
+ * The global keyboard shortcut that opens the Glitchgrab report dialog.
309
+ * Single source of truth — the provider's keydown handler and every label
310
+ * rendered anywhere (SDK dialog, host app UI) derive from this.
311
+ */
312
+ /** Server-safe label. Used during SSR and as the non-Mac label. */
313
+ declare const GLITCHGRAB_SHORTCUT = "Ctrl+Shift+G";
314
+ /** Mac label, using the platform's modifier glyphs. */
315
+ declare const GLITCHGRAB_SHORTCUT_MAC = "\u2318\u21E7G";
316
+ /**
317
+ * OS-aware label for the report-dialog shortcut — `⌘⇧G` on Mac,
318
+ * `Ctrl+Shift+G` elsewhere. Returns the non-Mac label on the server, so
319
+ * render it client-side (or after mount) to avoid a hydration mismatch.
320
+ */
321
+ declare function getShortcutLabel(): string;
322
+ /** True when the keyboard event matches the report-dialog shortcut. */
323
+ declare function matchesShortcut(e: KeyboardEvent): boolean;
324
+
301
325
  declare function sanitizeUrl(url: string): string;
302
326
  declare function captureDeviceInfo(): DeviceInfo | null;
303
327
  declare function captureContext(visitedPages: string[]): CapturedContext;
@@ -329,4 +353,4 @@ declare function computeSignature(params: {
329
353
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
330
354
  declare function clearDedupCache(): void;
331
355
 
332
- export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
356
+ export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportSeverity, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabReports, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, sanitizeUrl, sendReport, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };