glitchgrab 1.11.0 → 1.13.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/dist/index.d.mts CHANGED
@@ -14,6 +14,7 @@ interface GlitchgrabConfig {
14
14
  maxBreadcrumbs?: number;
15
15
  }
16
16
  type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
17
+ type ReportSeverity = "low" | "medium" | "high";
17
18
  interface ReportPayload {
18
19
  token: string;
19
20
  source: "SDK_AUTO" | "SDK_USER_REPORT";
@@ -86,13 +87,15 @@ interface GlitchgrabProviderProps {
86
87
  maxBreadcrumbs?: number;
87
88
  children: ReactNode;
88
89
  fallback?: ReactNode;
90
+ /** Which report types to show in the dialog (default: all four) */
91
+ types?: ReportType[];
92
+ /** Show severity picker for BUG type (default: true) */
93
+ showSeverity?: boolean;
89
94
  }
90
95
  interface ReportButtonProps {
91
96
  position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
92
97
  label?: string;
93
98
  className?: string;
94
- /** Allow reporting feature requests, questions, not just bugs */
95
- types?: ReportType[];
96
99
  }
97
100
  interface UseGlitchgrabReturn {
98
101
  /** Report a bug programmatically */
@@ -104,6 +107,7 @@ interface UseGlitchgrabReturn {
104
107
  /** Open the ReportButton modal programmatically (captures screenshot + shows dialog) */
105
108
  openReportDialog: (options?: {
106
109
  description?: string;
110
+ type?: ReportType;
107
111
  }) => void;
108
112
  /** The token being used */
109
113
  token: string;
@@ -131,8 +135,29 @@ interface UseGlitchgrabReturn {
131
135
  declare function useGlitchgrab(): UseGlitchgrabReturn;
132
136
  declare function GlitchgrabProvider(props: GlitchgrabProviderProps): react_jsx_runtime.JSX.Element;
133
137
 
138
+ /**
139
+ * Optional trigger button for opening the report dialog.
140
+ *
141
+ * The dialog itself lives inside `GlitchgrabProvider` — you don't need this component
142
+ * unless you want a visible trigger button. You can also open the dialog programmatically
143
+ * via `useGlitchgrab().openReportDialog()`.
144
+ *
145
+ * @example
146
+ * ```tsx
147
+ * // Use the default floating button
148
+ * <ReportButton />
149
+ *
150
+ * // Use your own trigger
151
+ * <ReportButton>
152
+ * {({ onClick }) => <button onClick={onClick}>Report</button>}
153
+ * </ReportButton>
154
+ *
155
+ * // Or skip ReportButton entirely and use the hook
156
+ * const { openReportDialog } = useGlitchgrab();
157
+ * <button onClick={() => openReportDialog()}>Report</button>
158
+ * ```
159
+ */
134
160
  declare function ReportButton({ position, label, className, children, }: ReportButtonProps & {
135
- /** Render prop — receives { onClick, capturing } so you can use your own trigger button */
136
161
  children?: (props: {
137
162
  onClick: () => void;
138
163
  capturing: boolean;
@@ -168,6 +193,8 @@ interface GlitchgrabReport {
168
193
  reporterPhone: string | null;
169
194
  pageUrl: string | null;
170
195
  createdAt: string;
196
+ /** Number of comments on the linked GitHub issue (0 if no issue) */
197
+ commentCount: number;
171
198
  issue: {
172
199
  githubNumber: number;
173
200
  githubUrl: string;
@@ -261,4 +288,4 @@ declare function captureContext(visitedPages: string[]): CapturedContext;
261
288
  */
262
289
  declare function sendReport(payload: ReportPayload, baseUrl?: string): Promise<ReportResult | null>;
263
290
 
264
- export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
291
+ 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, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ interface GlitchgrabConfig {
14
14
  maxBreadcrumbs?: number;
15
15
  }
16
16
  type ReportType = "BUG" | "FEATURE_REQUEST" | "QUESTION" | "OTHER";
17
+ type ReportSeverity = "low" | "medium" | "high";
17
18
  interface ReportPayload {
18
19
  token: string;
19
20
  source: "SDK_AUTO" | "SDK_USER_REPORT";
@@ -86,13 +87,15 @@ interface GlitchgrabProviderProps {
86
87
  maxBreadcrumbs?: number;
87
88
  children: ReactNode;
88
89
  fallback?: ReactNode;
90
+ /** Which report types to show in the dialog (default: all four) */
91
+ types?: ReportType[];
92
+ /** Show severity picker for BUG type (default: true) */
93
+ showSeverity?: boolean;
89
94
  }
90
95
  interface ReportButtonProps {
91
96
  position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
92
97
  label?: string;
93
98
  className?: string;
94
- /** Allow reporting feature requests, questions, not just bugs */
95
- types?: ReportType[];
96
99
  }
97
100
  interface UseGlitchgrabReturn {
98
101
  /** Report a bug programmatically */
@@ -104,6 +107,7 @@ interface UseGlitchgrabReturn {
104
107
  /** Open the ReportButton modal programmatically (captures screenshot + shows dialog) */
105
108
  openReportDialog: (options?: {
106
109
  description?: string;
110
+ type?: ReportType;
107
111
  }) => void;
108
112
  /** The token being used */
109
113
  token: string;
@@ -131,8 +135,29 @@ interface UseGlitchgrabReturn {
131
135
  declare function useGlitchgrab(): UseGlitchgrabReturn;
132
136
  declare function GlitchgrabProvider(props: GlitchgrabProviderProps): react_jsx_runtime.JSX.Element;
133
137
 
138
+ /**
139
+ * Optional trigger button for opening the report dialog.
140
+ *
141
+ * The dialog itself lives inside `GlitchgrabProvider` — you don't need this component
142
+ * unless you want a visible trigger button. You can also open the dialog programmatically
143
+ * via `useGlitchgrab().openReportDialog()`.
144
+ *
145
+ * @example
146
+ * ```tsx
147
+ * // Use the default floating button
148
+ * <ReportButton />
149
+ *
150
+ * // Use your own trigger
151
+ * <ReportButton>
152
+ * {({ onClick }) => <button onClick={onClick}>Report</button>}
153
+ * </ReportButton>
154
+ *
155
+ * // Or skip ReportButton entirely and use the hook
156
+ * const { openReportDialog } = useGlitchgrab();
157
+ * <button onClick={() => openReportDialog()}>Report</button>
158
+ * ```
159
+ */
134
160
  declare function ReportButton({ position, label, className, children, }: ReportButtonProps & {
135
- /** Render prop — receives { onClick, capturing } so you can use your own trigger button */
136
161
  children?: (props: {
137
162
  onClick: () => void;
138
163
  capturing: boolean;
@@ -168,6 +193,8 @@ interface GlitchgrabReport {
168
193
  reporterPhone: string | null;
169
194
  pageUrl: string | null;
170
195
  createdAt: string;
196
+ /** Number of comments on the linked GitHub issue (0 if no issue) */
197
+ commentCount: number;
171
198
  issue: {
172
199
  githubNumber: number;
173
200
  githubUrl: string;
@@ -261,4 +288,4 @@ declare function captureContext(visitedPages: string[]): CapturedContext;
261
288
  */
262
289
  declare function sendReport(payload: ReportPayload, baseUrl?: string): Promise<ReportResult | null>;
263
290
 
264
- export { type Breadcrumb, type BreadcrumbType, type CapturedContext, type DeviceInfo, type GlitchgrabConfig, GlitchgrabErrorBoundary, GlitchgrabProvider, type GlitchgrabProviderProps, type GlitchgrabSession, ReportButton, type ReportButtonProps, type ReportPayload, type ReportResult, type ReportType, type UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, clearBreadcrumbs, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };
291
+ 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, fetchGlitchgrabReports, getBreadcrumbs, initBreadcrumbs, sanitizeUrl, sendReport, useGlitchgrab, useGlitchgrabActions, useGlitchgrabReports };