@bugport.dev/widget 0.1.1
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/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/index.cjs +7295 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +576 -0
- package/dist/index.d.ts +576 -0
- package/dist/index.js +7211 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
/** Intent the author attaches to a piece of feedback. */
|
|
4
|
+
type AnnotationIntent = "fix" | "change" | "question" | "approve";
|
|
5
|
+
/** How severe / blocking a piece of feedback is. */
|
|
6
|
+
type AnnotationSeverity = "blocking" | "important" | "suggestion";
|
|
7
|
+
/** Lifecycle position of an annotation. */
|
|
8
|
+
type AnnotationStatus = "pending" | "acknowledged" | "resolved" | "dismissed";
|
|
9
|
+
/**
|
|
10
|
+
* Axis-aligned rectangle expressed in CSS pixels. Reused for bounding boxes,
|
|
11
|
+
* placement geometry, and the original/current rects of a rearrange action.
|
|
12
|
+
*/
|
|
13
|
+
type Rect = {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Structured payload carried by `kind: "placement"` annotations, describing a
|
|
21
|
+
* component the author wants dropped onto the page.
|
|
22
|
+
*/
|
|
23
|
+
type PlacementDetails = {
|
|
24
|
+
componentType: string;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
scrollY: number;
|
|
28
|
+
text?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Structured payload carried by `kind: "rearrange"` annotations, capturing
|
|
32
|
+
* where an existing element started and where it was moved to.
|
|
33
|
+
*/
|
|
34
|
+
type RearrangeDetails = {
|
|
35
|
+
selector: string;
|
|
36
|
+
label: string;
|
|
37
|
+
tagName: string;
|
|
38
|
+
originalRect: Rect;
|
|
39
|
+
currentRect: Rect;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The central feedback shape. Exactly seven fields are required — `id`, `x`,
|
|
43
|
+
* `y`, `comment`, `element`, `elementPath`, and `timestamp`. Everything else is
|
|
44
|
+
* optional and may be populated as the annotation gains DOM/React context, is
|
|
45
|
+
* specialised by `kind`, or is synced to the server.
|
|
46
|
+
*/
|
|
47
|
+
type Annotation = {
|
|
48
|
+
id: string;
|
|
49
|
+
/** Horizontal position as a percentage of the viewport width. */
|
|
50
|
+
x: number;
|
|
51
|
+
/**
|
|
52
|
+
* Vertical position in pixels — measured from the top of the document
|
|
53
|
+
* (absolute), or from the top of the viewport when `isFixed` is set.
|
|
54
|
+
*/
|
|
55
|
+
y: number;
|
|
56
|
+
comment: string;
|
|
57
|
+
element: string;
|
|
58
|
+
elementPath: string;
|
|
59
|
+
timestamp: number;
|
|
60
|
+
selectedText?: string;
|
|
61
|
+
boundingBox?: Rect;
|
|
62
|
+
nearbyText?: string;
|
|
63
|
+
cssClasses?: string;
|
|
64
|
+
nearbyElements?: string;
|
|
65
|
+
computedStyles?: string;
|
|
66
|
+
fullPath?: string;
|
|
67
|
+
accessibility?: string;
|
|
68
|
+
/** True when the annotation was produced by a drag selection. */
|
|
69
|
+
isMultiSelect?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* True when the target element uses fixed/sticky positioning, in which case
|
|
72
|
+
* the marker is pinned to the viewport rather than the document.
|
|
73
|
+
*/
|
|
74
|
+
isFixed?: boolean;
|
|
75
|
+
/** React component hierarchy string, e.g. "<App> <Dashboard> <Button>". */
|
|
76
|
+
reactComponents?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Source path derived from React's `_debugSource` (dev mode only),
|
|
79
|
+
* e.g. "src/Button.tsx:42".
|
|
80
|
+
*/
|
|
81
|
+
sourceFile?: string;
|
|
82
|
+
/** Index of a linked drawing stroke, when one exists. */
|
|
83
|
+
drawingIndex?: number;
|
|
84
|
+
/** Per-element boxes used to highlight a multi-select on hover. */
|
|
85
|
+
elementBoundingBoxes?: Rect[];
|
|
86
|
+
/** Annotation flavour. Consumers treat an absent value as "feedback". */
|
|
87
|
+
kind?: "feedback" | "placement" | "rearrange";
|
|
88
|
+
/** Present for placement-kind annotations. */
|
|
89
|
+
placement?: PlacementDetails;
|
|
90
|
+
/** Present for rearrange-kind annotations. */
|
|
91
|
+
rearrange?: RearrangeDetails;
|
|
92
|
+
sessionId?: string;
|
|
93
|
+
url?: string;
|
|
94
|
+
intent?: AnnotationIntent;
|
|
95
|
+
severity?: AnnotationSeverity;
|
|
96
|
+
status?: AnnotationStatus;
|
|
97
|
+
createdAt?: string;
|
|
98
|
+
updatedAt?: string;
|
|
99
|
+
resolvedAt?: string;
|
|
100
|
+
resolvedBy?: "human" | "agent";
|
|
101
|
+
authorId?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Local-only bookkeeping: the Session ID this annotation has been synced to.
|
|
104
|
+
* Never transmitted to the server. The leading underscore is part of the
|
|
105
|
+
* contract.
|
|
106
|
+
*/
|
|
107
|
+
_syncedTo?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/** Console levels the collector can wrap. */
|
|
111
|
+
type BugPortConsoleLevel = "log" | "info" | "warn" | "error" | "debug";
|
|
112
|
+
/** A captured `console.*` call. */
|
|
113
|
+
type BugPortConsoleEvent = {
|
|
114
|
+
id: string;
|
|
115
|
+
type: "console";
|
|
116
|
+
level: BugPortConsoleLevel;
|
|
117
|
+
/** ISO 8601 timestamp. */
|
|
118
|
+
timestamp: string;
|
|
119
|
+
/** Safely-serialised arguments (circular-safe, size-capped). */
|
|
120
|
+
args: unknown[];
|
|
121
|
+
/** Human-readable, redacted single-line message derived from `args`. */
|
|
122
|
+
message: string;
|
|
123
|
+
};
|
|
124
|
+
/** A captured `window.onerror` or `unhandledrejection`. */
|
|
125
|
+
type BugPortRuntimeErrorEvent = {
|
|
126
|
+
id: string;
|
|
127
|
+
type: "runtime_error" | "unhandled_rejection";
|
|
128
|
+
/** ISO 8601 timestamp. */
|
|
129
|
+
timestamp: string;
|
|
130
|
+
message: string;
|
|
131
|
+
stack?: string;
|
|
132
|
+
source?: string;
|
|
133
|
+
line?: number;
|
|
134
|
+
column?: number;
|
|
135
|
+
};
|
|
136
|
+
/** A captured `fetch` or `XMLHttpRequest`. */
|
|
137
|
+
type BugPortNetworkEvent = {
|
|
138
|
+
id: string;
|
|
139
|
+
type: "network";
|
|
140
|
+
transport: "fetch" | "xhr";
|
|
141
|
+
/** ISO 8601 timestamp of when the request started. */
|
|
142
|
+
timestamp: string;
|
|
143
|
+
method: string;
|
|
144
|
+
url: string;
|
|
145
|
+
status?: number;
|
|
146
|
+
statusText?: string;
|
|
147
|
+
durationMs?: number;
|
|
148
|
+
requestHeaders?: Record<string, string>;
|
|
149
|
+
responseHeaders?: Record<string, string>;
|
|
150
|
+
requestBodyPreview?: string;
|
|
151
|
+
responseBodyPreview?: string;
|
|
152
|
+
responseBodyTruncated?: boolean;
|
|
153
|
+
error?: string;
|
|
154
|
+
};
|
|
155
|
+
/** Discriminated union of every diagnostic event the collector can emit. */
|
|
156
|
+
type BugPortDiagnosticEvent = BugPortConsoleEvent | BugPortRuntimeErrorEvent | BugPortNetworkEvent;
|
|
157
|
+
/**
|
|
158
|
+
* App-owner configuration for diagnostics capture. Every field is optional;
|
|
159
|
+
* sensible privacy-preserving defaults are applied by `normalizeDiagnosticsConfig`.
|
|
160
|
+
*/
|
|
161
|
+
type BugPortDiagnosticsConfig = {
|
|
162
|
+
/** Master switch. When false (the default), nothing is instrumented. */
|
|
163
|
+
enabled?: boolean;
|
|
164
|
+
console?: boolean;
|
|
165
|
+
runtimeErrors?: boolean;
|
|
166
|
+
/** Convenience switch enabling both fetch + xhr when their flags are unset. */
|
|
167
|
+
network?: boolean;
|
|
168
|
+
fetch?: boolean;
|
|
169
|
+
xhr?: boolean;
|
|
170
|
+
requestBodies?: boolean;
|
|
171
|
+
responseBodies?: boolean;
|
|
172
|
+
/** Show end-user toggles in the report form (default true when enabled). */
|
|
173
|
+
userControlled?: boolean;
|
|
174
|
+
defaultAttachConsole?: boolean;
|
|
175
|
+
defaultAttachNetwork?: boolean;
|
|
176
|
+
defaultAttachRuntimeErrors?: boolean;
|
|
177
|
+
maxEvents?: number;
|
|
178
|
+
maxConsoleEvents?: number;
|
|
179
|
+
maxNetworkEvents?: number;
|
|
180
|
+
maxRuntimeErrorEvents?: number;
|
|
181
|
+
maxBodySizeBytes?: number;
|
|
182
|
+
allowedUrls?: Array<string | RegExp>;
|
|
183
|
+
deniedUrls?: Array<string | RegExp>;
|
|
184
|
+
/** Extra header names (case-insensitive) to redact, merged with defaults. */
|
|
185
|
+
redactHeaders?: string[];
|
|
186
|
+
/** Extra value patterns to redact from strings, merged with defaults. */
|
|
187
|
+
redactPatterns?: RegExp[];
|
|
188
|
+
/**
|
|
189
|
+
* Final per-event hook. Return a (possibly mutated) event to keep it, or
|
|
190
|
+
* `null` to drop it entirely. Runs after redaction, before storage.
|
|
191
|
+
*/
|
|
192
|
+
beforeSendDiagnostic?: (event: BugPortDiagnosticEvent) => BugPortDiagnosticEvent | null;
|
|
193
|
+
};
|
|
194
|
+
/** Fully-resolved config with all defaults applied. */
|
|
195
|
+
type ResolvedDiagnosticsConfig = {
|
|
196
|
+
enabled: boolean;
|
|
197
|
+
console: boolean;
|
|
198
|
+
runtimeErrors: boolean;
|
|
199
|
+
fetch: boolean;
|
|
200
|
+
xhr: boolean;
|
|
201
|
+
requestBodies: boolean;
|
|
202
|
+
responseBodies: boolean;
|
|
203
|
+
userControlled: boolean;
|
|
204
|
+
defaultAttachConsole: boolean;
|
|
205
|
+
defaultAttachNetwork: boolean;
|
|
206
|
+
defaultAttachRuntimeErrors: boolean;
|
|
207
|
+
maxConsoleEvents: number;
|
|
208
|
+
maxNetworkEvents: number;
|
|
209
|
+
maxRuntimeErrorEvents: number;
|
|
210
|
+
maxBodySizeBytes: number;
|
|
211
|
+
allowedUrls: Array<string | RegExp>;
|
|
212
|
+
deniedUrls: Array<string | RegExp>;
|
|
213
|
+
redactHeaders: string[];
|
|
214
|
+
redactPatterns: RegExp[];
|
|
215
|
+
beforeSendDiagnostic?: (event: BugPortDiagnosticEvent) => BugPortDiagnosticEvent | null;
|
|
216
|
+
};
|
|
217
|
+
/** What the user has consented to attach for a given submission. */
|
|
218
|
+
type DiagnosticsConsent = {
|
|
219
|
+
console: boolean;
|
|
220
|
+
network: boolean;
|
|
221
|
+
runtimeErrors: boolean;
|
|
222
|
+
};
|
|
223
|
+
/** Diagnostics block carried on the widget submission payload. */
|
|
224
|
+
type BugPortDiagnosticsPayload = {
|
|
225
|
+
console?: BugPortConsoleEvent[];
|
|
226
|
+
runtimeErrors?: BugPortRuntimeErrorEvent[];
|
|
227
|
+
network?: BugPortNetworkEvent[];
|
|
228
|
+
/** ISO 8601 timestamp of when the snapshot was taken. */
|
|
229
|
+
capturedAt: string;
|
|
230
|
+
userConsent: DiagnosticsConsent;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
declare class DiagnosticsCollector {
|
|
234
|
+
private readonly config;
|
|
235
|
+
private readonly redactor;
|
|
236
|
+
private readonly consoleBuffer;
|
|
237
|
+
private readonly runtimeBuffer;
|
|
238
|
+
private readonly networkBuffer;
|
|
239
|
+
private installed;
|
|
240
|
+
private originalConsole;
|
|
241
|
+
private originalFetch;
|
|
242
|
+
private originalXhrOpen;
|
|
243
|
+
private originalXhrSend;
|
|
244
|
+
private originalXhrSetHeader;
|
|
245
|
+
private errorHandler;
|
|
246
|
+
private rejectionHandler;
|
|
247
|
+
private readonly xhrState;
|
|
248
|
+
constructor(config: ResolvedDiagnosticsConfig);
|
|
249
|
+
/** Install configured instrumentation. Safe to call once; no-ops on SSR. */
|
|
250
|
+
install(): void;
|
|
251
|
+
/** Restore every patched global. Idempotent. */
|
|
252
|
+
uninstall(): void;
|
|
253
|
+
/** Push an event through the optional `beforeSendDiagnostic` hook + buffer. */
|
|
254
|
+
private emit;
|
|
255
|
+
private installConsole;
|
|
256
|
+
private captureConsole;
|
|
257
|
+
private installRuntimeErrors;
|
|
258
|
+
private shouldCaptureUrl;
|
|
259
|
+
/** Cap + flag a textual body to the configured byte budget. */
|
|
260
|
+
private capBody;
|
|
261
|
+
/** Extract a safe, redacted request body preview from a fetch/xhr body. */
|
|
262
|
+
private previewRequestBody;
|
|
263
|
+
private installFetch;
|
|
264
|
+
private captureFetchResponse;
|
|
265
|
+
private installXhr;
|
|
266
|
+
private attachXhrListeners;
|
|
267
|
+
getConsoleEvents(): BugPortConsoleEvent[];
|
|
268
|
+
getRuntimeErrorEvents(): BugPortRuntimeErrorEvent[];
|
|
269
|
+
getNetworkEvents(): BugPortNetworkEvent[];
|
|
270
|
+
clear(): void;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** Scripted annotation used by demo mode. */
|
|
274
|
+
type DemoAnnotation = {
|
|
275
|
+
selector: string;
|
|
276
|
+
comment: string;
|
|
277
|
+
selectedText?: string;
|
|
278
|
+
};
|
|
279
|
+
/** Captured screenshot attached to a submission. */
|
|
280
|
+
type BugportSubmissionScreenshot = {
|
|
281
|
+
dataUrl: string;
|
|
282
|
+
mimeType: string;
|
|
283
|
+
width: number;
|
|
284
|
+
height: number;
|
|
285
|
+
capturedAt: number;
|
|
286
|
+
};
|
|
287
|
+
/** Payload handed to onSubmitPayload. */
|
|
288
|
+
type BugportSubmissionPayload = {
|
|
289
|
+
title?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
output: string;
|
|
292
|
+
annotations: Annotation[];
|
|
293
|
+
screenshot?: BugportSubmissionScreenshot;
|
|
294
|
+
/**
|
|
295
|
+
* Optional in-page diagnostics, present only when the app owner enabled
|
|
296
|
+
* capture and the user consented to attach at least one source.
|
|
297
|
+
*/
|
|
298
|
+
diagnostics?: BugPortDiagnosticsPayload;
|
|
299
|
+
};
|
|
300
|
+
/** Full prop surface of the feedback toolbar. */
|
|
301
|
+
type PageFeedbackToolbarCSSProps = {
|
|
302
|
+
demoAnnotations?: DemoAnnotation[];
|
|
303
|
+
demoDelay?: number;
|
|
304
|
+
enableDemoMode?: boolean;
|
|
305
|
+
onAnnotationAdd?: (annotation: Annotation) => void;
|
|
306
|
+
onAnnotationDelete?: (annotation: Annotation) => void;
|
|
307
|
+
onAnnotationUpdate?: (annotation: Annotation) => void;
|
|
308
|
+
onAnnotationsClear?: (annotations: Annotation[]) => void;
|
|
309
|
+
onCopy?: (markdown: string) => void;
|
|
310
|
+
onSubmit?: (output: string, annotations: Annotation[]) => void | boolean | Promise<void | boolean>;
|
|
311
|
+
onSubmitPayload?: (payload: BugportSubmissionPayload) => void | boolean | Promise<void | boolean>;
|
|
312
|
+
projectKey?: string;
|
|
313
|
+
publicKey?: string;
|
|
314
|
+
copyToClipboard?: boolean;
|
|
315
|
+
className?: string;
|
|
316
|
+
/** Resolved diagnostics config (controls which user toggles are shown). */
|
|
317
|
+
diagnosticsConfig?: ResolvedDiagnosticsConfig;
|
|
318
|
+
/** Live diagnostics collector to snapshot from at submit time. */
|
|
319
|
+
diagnosticsCollector?: DiagnosticsCollector | null;
|
|
320
|
+
};
|
|
321
|
+
/** Public alias for {@link PageFeedbackToolbarCSSProps}. */
|
|
322
|
+
type BugportWidgetProps = PageFeedbackToolbarCSSProps;
|
|
323
|
+
/**
|
|
324
|
+
* Main feedback toolbar. Renders via a portal into document.body and returns
|
|
325
|
+
* null until mounted, or whenever the toolbar has been permanently hidden.
|
|
326
|
+
*/
|
|
327
|
+
declare function PageFeedbackToolbarCSS(props?: PageFeedbackToolbarCSSProps): React.ReactPortal | null;
|
|
328
|
+
|
|
329
|
+
type WidgetReporter = {
|
|
330
|
+
id?: string;
|
|
331
|
+
email?: string;
|
|
332
|
+
name?: string;
|
|
333
|
+
};
|
|
334
|
+
type BugPortSubmissionResult = {
|
|
335
|
+
bugId: string;
|
|
336
|
+
dashboardUrl: string;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/** Public prop contract for the CSS annotation popup. */
|
|
340
|
+
interface AnnotationPopupCSSProps {
|
|
341
|
+
/** Element name to display in header */
|
|
342
|
+
element: string;
|
|
343
|
+
/** Optional timestamp display (e.g., "@ 1.23s" for animation feedback) */
|
|
344
|
+
timestamp?: string;
|
|
345
|
+
/** Optional selected/highlighted text */
|
|
346
|
+
selectedText?: string;
|
|
347
|
+
/** Placeholder text for the textarea */
|
|
348
|
+
placeholder?: string;
|
|
349
|
+
/** Initial value for textarea (for edit mode) */
|
|
350
|
+
initialValue?: string;
|
|
351
|
+
/** Label for submit button (default: "Add") */
|
|
352
|
+
submitLabel?: string;
|
|
353
|
+
/** Called when annotation is submitted with text */
|
|
354
|
+
onSubmit: (text: string) => void;
|
|
355
|
+
/** Called when popup is cancelled/dismissed */
|
|
356
|
+
onCancel: () => void;
|
|
357
|
+
/** Called when delete button is clicked (only shown if provided) */
|
|
358
|
+
onDelete?: () => void;
|
|
359
|
+
/** Position styles (left, top) */
|
|
360
|
+
style?: React.CSSProperties;
|
|
361
|
+
/** Custom color for submit button and textarea focus (hex) */
|
|
362
|
+
accentColor?: string;
|
|
363
|
+
/** External exit state (parent controls exit animation) */
|
|
364
|
+
isExiting?: boolean;
|
|
365
|
+
/** Light mode styling */
|
|
366
|
+
lightMode?: boolean;
|
|
367
|
+
/** Computed styles for the selected element */
|
|
368
|
+
computedStyles?: Record<string, string>;
|
|
369
|
+
}
|
|
370
|
+
/** Imperative surface that parents can drive through a ref. */
|
|
371
|
+
interface AnnotationPopupCSSHandle {
|
|
372
|
+
/** Shake the popup (e.g., when user clicks outside) */
|
|
373
|
+
shake: () => void;
|
|
374
|
+
}
|
|
375
|
+
declare const AnnotationPopupCSS: react.ForwardRefExoticComponent<AnnotationPopupCSSProps & react.RefAttributes<AnnotationPopupCSSHandle>>;
|
|
376
|
+
|
|
377
|
+
declare const IconClose: ({ size }: {
|
|
378
|
+
size?: number;
|
|
379
|
+
}) => react.JSX.Element;
|
|
380
|
+
declare const IconPlus: ({ size }: {
|
|
381
|
+
size?: number;
|
|
382
|
+
}) => react.JSX.Element;
|
|
383
|
+
declare const IconCheck: ({ size }: {
|
|
384
|
+
size?: number;
|
|
385
|
+
}) => react.JSX.Element;
|
|
386
|
+
declare const IconCheckSmall: ({ size }: {
|
|
387
|
+
size?: number;
|
|
388
|
+
}) => react.JSX.Element;
|
|
389
|
+
declare const IconListSparkle: ({ size, style, }: {
|
|
390
|
+
size?: number;
|
|
391
|
+
style?: React.CSSProperties;
|
|
392
|
+
}) => react.JSX.Element;
|
|
393
|
+
declare const IconBugPortGlyph: ({ size, }: {
|
|
394
|
+
size?: number;
|
|
395
|
+
}) => react.JSX.Element;
|
|
396
|
+
declare const IconHelp: ({ size, ...props }: {
|
|
397
|
+
size?: number;
|
|
398
|
+
} & React.SVGProps<SVGSVGElement>) => react.JSX.Element;
|
|
399
|
+
declare const IconCheckSmallAnimated: ({ size }: {
|
|
400
|
+
size?: number;
|
|
401
|
+
}) => react.JSX.Element;
|
|
402
|
+
declare const IconCopyAlt: ({ size }: {
|
|
403
|
+
size?: number;
|
|
404
|
+
}) => react.JSX.Element;
|
|
405
|
+
declare const IconCamera: ({ size }: {
|
|
406
|
+
size?: number;
|
|
407
|
+
}) => react.JSX.Element;
|
|
408
|
+
declare const IconCopyAnimated: ({ size, copied, tint, }: {
|
|
409
|
+
size?: number;
|
|
410
|
+
copied?: boolean;
|
|
411
|
+
tint?: string;
|
|
412
|
+
}) => react.JSX.Element;
|
|
413
|
+
declare const IconSendArrow: ({ size, state, }: {
|
|
414
|
+
size?: number;
|
|
415
|
+
state?: "idle" | "sending" | "sent" | "failed";
|
|
416
|
+
}) => react.JSX.Element;
|
|
417
|
+
declare const IconSendAnimated: ({ size, sent, }: {
|
|
418
|
+
size?: number;
|
|
419
|
+
sent?: boolean;
|
|
420
|
+
}) => react.JSX.Element;
|
|
421
|
+
declare const IconEye: ({ size }: {
|
|
422
|
+
size?: number;
|
|
423
|
+
}) => react.JSX.Element;
|
|
424
|
+
declare const IconEyeAlt: ({ size }: {
|
|
425
|
+
size?: number;
|
|
426
|
+
}) => react.JSX.Element;
|
|
427
|
+
declare const IconEyeClosed: ({ size }: {
|
|
428
|
+
size?: number;
|
|
429
|
+
}) => react.JSX.Element;
|
|
430
|
+
declare const IconEyeAnimated: ({ size, isOpen, }: {
|
|
431
|
+
size?: number;
|
|
432
|
+
isOpen?: boolean;
|
|
433
|
+
}) => react.JSX.Element;
|
|
434
|
+
declare const IconPausePlayAnimated: ({ size, isPaused, }: {
|
|
435
|
+
size?: number;
|
|
436
|
+
isPaused?: boolean;
|
|
437
|
+
}) => react.JSX.Element;
|
|
438
|
+
declare const IconEyeMinus: ({ size }: {
|
|
439
|
+
size?: number;
|
|
440
|
+
}) => react.JSX.Element;
|
|
441
|
+
declare const IconGear: ({ size }: {
|
|
442
|
+
size?: number;
|
|
443
|
+
}) => react.JSX.Element;
|
|
444
|
+
declare const IconPauseAlt: ({ size }: {
|
|
445
|
+
size?: number;
|
|
446
|
+
}) => react.JSX.Element;
|
|
447
|
+
declare const IconPause: ({ size }: {
|
|
448
|
+
size?: number;
|
|
449
|
+
}) => react.JSX.Element;
|
|
450
|
+
declare const IconPlayAlt: ({ size }: {
|
|
451
|
+
size?: number;
|
|
452
|
+
}) => react.JSX.Element;
|
|
453
|
+
declare const IconTrashAlt: ({ size }: {
|
|
454
|
+
size?: number;
|
|
455
|
+
}) => react.JSX.Element;
|
|
456
|
+
declare const IconChatEllipsis: ({ size, style, }: {
|
|
457
|
+
size?: number;
|
|
458
|
+
style?: React.CSSProperties;
|
|
459
|
+
}) => react.JSX.Element;
|
|
460
|
+
declare const IconCheckmark: ({ size }: {
|
|
461
|
+
size?: number;
|
|
462
|
+
}) => react.JSX.Element;
|
|
463
|
+
declare const IconCheckmarkLarge: ({ size }: {
|
|
464
|
+
size?: number;
|
|
465
|
+
}) => react.JSX.Element;
|
|
466
|
+
declare const IconCheckmarkCircle: ({ size }: {
|
|
467
|
+
size?: number;
|
|
468
|
+
}) => react.JSX.Element;
|
|
469
|
+
declare const IconXmark: ({ size }: {
|
|
470
|
+
size?: number;
|
|
471
|
+
}) => react.JSX.Element;
|
|
472
|
+
declare const IconXmarkLarge: ({ size }: {
|
|
473
|
+
size?: number;
|
|
474
|
+
}) => react.JSX.Element;
|
|
475
|
+
declare const IconSun: ({ size }: {
|
|
476
|
+
size?: number;
|
|
477
|
+
}) => react.JSX.Element;
|
|
478
|
+
declare const IconMoon: ({ size }: {
|
|
479
|
+
size?: number;
|
|
480
|
+
}) => react.JSX.Element;
|
|
481
|
+
declare const IconEdit: ({ size }: {
|
|
482
|
+
size?: number;
|
|
483
|
+
}) => react.JSX.Element;
|
|
484
|
+
declare const IconTrash: ({ size }: {
|
|
485
|
+
size?: number;
|
|
486
|
+
}) => react.JSX.Element;
|
|
487
|
+
declare const IconChevronLeft: ({ size }: {
|
|
488
|
+
size?: number;
|
|
489
|
+
}) => react.JSX.Element;
|
|
490
|
+
declare const IconChevronRight: ({ size }: {
|
|
491
|
+
size?: number;
|
|
492
|
+
}) => react.JSX.Element;
|
|
493
|
+
declare const IconLayout: ({ size }: {
|
|
494
|
+
size?: number;
|
|
495
|
+
}) => react.JSX.Element;
|
|
496
|
+
|
|
497
|
+
declare function closestCrossingShadow(element: Element, selector: string): Element | null;
|
|
498
|
+
declare function isInShadowDOM(element: Element): boolean;
|
|
499
|
+
declare function getShadowHost(element: Element): Element | null;
|
|
500
|
+
declare function getElementPath(target: HTMLElement, maxDepth?: number): string;
|
|
501
|
+
declare function identifyElement(target: HTMLElement): {
|
|
502
|
+
name: string;
|
|
503
|
+
path: string;
|
|
504
|
+
};
|
|
505
|
+
declare function getNearbyText(element: HTMLElement): string;
|
|
506
|
+
declare function identifyAnimationElement(target: HTMLElement): string;
|
|
507
|
+
declare function getElementClasses(target: HTMLElement): string;
|
|
508
|
+
|
|
509
|
+
declare function getStorageKey(pathname: string): string;
|
|
510
|
+
declare function loadAnnotations<T = Annotation>(pathname: string): T[];
|
|
511
|
+
declare function saveAnnotations<T = Annotation>(pathname: string, annotations: T[]): void;
|
|
512
|
+
|
|
513
|
+
declare function normalizeDiagnosticsConfig(config: BugPortDiagnosticsConfig | undefined): ResolvedDiagnosticsConfig;
|
|
514
|
+
|
|
515
|
+
/** Header names always stripped (case-insensitive). */
|
|
516
|
+
declare const DEFAULT_REDACT_HEADERS: string[];
|
|
517
|
+
/** Value patterns redacted from free-form strings (URLs, bodies, messages). */
|
|
518
|
+
declare const DEFAULT_REDACT_PATTERNS: RegExp[];
|
|
519
|
+
/** Apply value-pattern redaction to a free-form string. */
|
|
520
|
+
declare function redactString(value: string, patterns?: RegExp[]): string;
|
|
521
|
+
/** Redact sensitive entries from a header map. */
|
|
522
|
+
declare function redactHeaders(headers: Record<string, string>, extraHeaderNames?: string[], patterns?: RegExp[]): Record<string, string>;
|
|
523
|
+
/** Redact sensitive query parameters from a URL, preserving its structure. */
|
|
524
|
+
declare function redactUrl(url: string, extraHeaderNames?: string[], patterns?: RegExp[]): string;
|
|
525
|
+
/**
|
|
526
|
+
* Redact a request/response body preview. JSON bodies have sensitive keys
|
|
527
|
+
* stripped; everything else is treated as free text. Never throws.
|
|
528
|
+
*/
|
|
529
|
+
declare function redactBody(body: string, extraHeaderNames?: string[], patterns?: RegExp[]): string;
|
|
530
|
+
/** Build a redactor bound to the resolved header/pattern config. */
|
|
531
|
+
declare function createRedactor(extraHeaderNames: string[], extraPatterns: RegExp[]): {
|
|
532
|
+
headerNames: string[];
|
|
533
|
+
patterns: RegExp[];
|
|
534
|
+
string: (value: string) => string;
|
|
535
|
+
headers: (headers: Record<string, string>) => Record<string, string>;
|
|
536
|
+
url: (url: string) => string;
|
|
537
|
+
body: (body: string) => string;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Snapshot the collector buffers into a submission payload, including only the
|
|
542
|
+
* sources the user has consented to. Returns `undefined` when nothing is to be
|
|
543
|
+
* attached, keeping the submission byte-for-byte identical to a pre-diagnostics
|
|
544
|
+
* report.
|
|
545
|
+
*/
|
|
546
|
+
declare function buildDiagnosticsPayload(collector: DiagnosticsCollector | null | undefined, consent: DiagnosticsConsent): BugPortDiagnosticsPayload | undefined;
|
|
547
|
+
|
|
548
|
+
type BugPortWidgetProps = Omit<PageFeedbackToolbarCSSProps, "onSubmitPayload" | "diagnosticsConfig" | "diagnosticsCollector"> & {
|
|
549
|
+
projectKey?: string;
|
|
550
|
+
publicKey?: string;
|
|
551
|
+
environment?: string;
|
|
552
|
+
apiBaseUrl?: string;
|
|
553
|
+
user?: WidgetReporter;
|
|
554
|
+
/** Optional in-page diagnostics capture configuration. */
|
|
555
|
+
diagnostics?: BugPortDiagnosticsConfig;
|
|
556
|
+
onSubmitted?: (result: BugPortSubmissionResult) => void;
|
|
557
|
+
onError?: (error: Error) => void;
|
|
558
|
+
onSubmitPayload?: (payload: BugportSubmissionPayload) => void | boolean | Promise<void | boolean>;
|
|
559
|
+
};
|
|
560
|
+
declare function BugPortWidget({ projectKey, publicKey, environment, apiBaseUrl, user, diagnostics, onSubmitted, onError, onSubmitPayload, ...props }: BugPortWidgetProps): react.JSX.Element;
|
|
561
|
+
declare const BugportWidget: typeof BugPortWidget;
|
|
562
|
+
type BugPortWidgetHandle = {
|
|
563
|
+
destroy: () => void;
|
|
564
|
+
};
|
|
565
|
+
declare function initBugPortWidget(props: BugPortWidgetProps & {
|
|
566
|
+
target?: HTMLElement;
|
|
567
|
+
}): BugPortWidgetHandle;
|
|
568
|
+
declare global {
|
|
569
|
+
interface Window {
|
|
570
|
+
BugPort?: {
|
|
571
|
+
init: typeof initBugPortWidget;
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export { type Annotation, AnnotationPopupCSS, type AnnotationPopupCSSHandle, type AnnotationPopupCSSProps, type BugPortConsoleEvent, type BugPortConsoleLevel, type BugPortDiagnosticEvent, type BugPortDiagnosticsConfig, type BugPortDiagnosticsPayload, type BugPortNetworkEvent, type BugPortRuntimeErrorEvent, type BugPortSubmissionResult, BugPortWidget, type BugPortWidgetHandle, type BugPortWidgetProps, type BugportSubmissionPayload, type BugportSubmissionScreenshot, BugportWidget, type BugportWidgetProps, DEFAULT_REDACT_HEADERS, DEFAULT_REDACT_PATTERNS, type DemoAnnotation, DiagnosticsCollector, type DiagnosticsConsent, IconBugPortGlyph, IconCamera, IconChatEllipsis, IconCheck, IconCheckSmall, IconCheckSmallAnimated, IconCheckmark, IconCheckmarkCircle, IconCheckmarkLarge, IconChevronLeft, IconChevronRight, IconClose, IconCopyAlt, IconCopyAnimated, IconEdit, IconEye, IconEyeAlt, IconEyeAnimated, IconEyeClosed, IconEyeMinus, IconGear, IconHelp, IconLayout, IconListSparkle, IconMoon, IconPause, IconPauseAlt, IconPausePlayAnimated, IconPlayAlt, IconPlus, IconSendAnimated, IconSendArrow, IconSun, IconTrash, IconTrashAlt, IconXmark, IconXmarkLarge, PageFeedbackToolbarCSS, type PageFeedbackToolbarCSSProps, type ResolvedDiagnosticsConfig, type WidgetReporter, buildDiagnosticsPayload, closestCrossingShadow, createRedactor, getElementClasses, getElementPath, getNearbyText, getShadowHost, getStorageKey, identifyAnimationElement, identifyElement, initBugPortWidget, isInShadowDOM, loadAnnotations, normalizeDiagnosticsConfig, redactBody, redactHeaders, redactString, redactUrl, saveAnnotations };
|