@qaiddev/thumbs-embed 1.0.4 → 1.0.6

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.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Capture a screenshot of the current page using html2canvas
3
+ * Returns a base64-encoded WebP data URL, or null on failure
4
+ */
5
+ export declare function captureDomScreenshot(options?: DomScreenshotOptions): Promise<string | null>;
6
+
7
+ /**
8
+ * Intercept fetch() and XMLHttpRequest to capture network errors (4xx/5xx)
9
+ */
10
+ export declare function captureNetworkErrors(): NetworkCapture;
11
+
1
12
  /**
2
13
  * Console message captured during the session
3
14
  */
@@ -7,6 +18,24 @@ export declare interface ConsoleError {
7
18
  level: "error" | "warn" | "log";
8
19
  }
9
20
 
21
+ /**
22
+ * Create a video recorder that captures the screen
23
+ */
24
+ export declare function createVideoRecorder(options?: VideoRecorderOptions): VideoRecorder;
25
+
26
+ /**
27
+ * DOM-based screenshot capture using html2canvas
28
+ * No browser permission dialog required - reconstructs the page from the DOM
29
+ */
30
+ export declare interface DomScreenshotOptions {
31
+ /** Quality of WebP compression (0-1). Default: 0.8 */
32
+ quality?: number;
33
+ /** Max width of the screenshot. Default: 1280 */
34
+ maxWidth?: number;
35
+ /** Max height of the screenshot. Default: 800 */
36
+ maxHeight?: number;
37
+ }
38
+
10
39
  /**
11
40
  * Element bounds for server-side screenshot fallback
12
41
  */
@@ -80,12 +109,25 @@ export declare interface FeedbackConfig {
80
109
  fontSize?: number;
81
110
  /** Enable screenshot capture with feedback. Default: false */
82
111
  captureScreenshot?: boolean;
112
+ /** Enable video recording button. Default: false */
113
+ captureVideo?: boolean;
114
+ /** Video recording options */
115
+ videoOptions?: {
116
+ /** Max recording duration in seconds. Default: 15 */
117
+ maxDuration?: number;
118
+ };
119
+ /** Custom SVG string for record button icon */
120
+ recordIcon?: string;
83
121
  /** When true, buttons are hidden until hovered. Default: false */
84
122
  incognito?: boolean;
85
123
  /** Custom SVG string for positive feedback button icon */
86
124
  positiveIcon?: string;
87
125
  /** Custom SVG string for negative feedback button icon */
88
126
  negativeIcon?: string;
127
+ /** When true, hide thumbs up/down buttons (only show video button if enabled). Default: false */
128
+ hideThumbs?: boolean;
129
+ /** Screenshot capture method. "dom" uses html2canvas (no permission), "permission" uses Screen Capture API. Default: "permission" */
130
+ screenshotMethod?: "dom" | "permission";
89
131
  /** Screenshot options */
90
132
  screenshotOptions?: {
91
133
  /** Quality of WebP compression (0-1). Default: 1.0 */
@@ -121,7 +163,13 @@ export declare class FeedbackEmbed {
121
163
  private isMobile;
122
164
  private visitorId;
123
165
  private consoleCapture;
124
- private allowedFeatures;
166
+ private videoRecorder;
167
+ private networkCapture;
168
+ private recordedBlob;
169
+ private recordingIndicator;
170
+ private videoPreview;
171
+ private isRecording;
172
+ private isSendingVideo;
125
173
  private container;
126
174
  private isUserProvidedContainer;
127
175
  private overlayContainer;
@@ -138,7 +186,6 @@ export declare class FeedbackEmbed {
138
186
  private boundResize;
139
187
  constructor(config: FeedbackConfig);
140
188
  private init;
141
- private fetchAllowedFeatures;
142
189
  private checkMobile;
143
190
  private handleResize;
144
191
  private createEmbed;
@@ -164,6 +211,18 @@ export declare class FeedbackEmbed {
164
211
  private setupModalInteractions;
165
212
  private submitMessage;
166
213
  private closeModal;
214
+ private startRecording;
215
+ private stopRecording;
216
+ private showRecordingIndicator;
217
+ private updateRecordingTimer;
218
+ private formatTime;
219
+ private removeRecordingIndicator;
220
+ private showRecordingPreview;
221
+ private cancelRecordingPreview;
222
+ private removeVideoPreview;
223
+ private submitVideoFeedback;
224
+ private cleanupRecording;
225
+ private setButtonsDisabled;
167
226
  /**
168
227
  * Destroy the embed and clean up all resources
169
228
  */
@@ -211,6 +270,40 @@ export declare interface FeedbackResponse {
211
270
  id: number;
212
271
  }
213
272
 
273
+ /**
274
+ * Detect the best supported MIME type for recording
275
+ */
276
+ export declare function getSupportedMimeType(): string;
277
+
278
+ /**
279
+ * Check if DOM screenshot capture is supported
280
+ * Requires canvas and basic DOM APIs
281
+ */
282
+ export declare function isDomScreenshotSupported(): boolean;
283
+
284
+ /**
285
+ * Check if video recording is supported in this browser
286
+ */
287
+ export declare function isVideoRecordingSupported(): boolean;
288
+
289
+ export declare interface NetworkCapture {
290
+ errors: NetworkError[];
291
+ restore: () => void;
292
+ }
293
+
294
+ /**
295
+ * Network error captured during the session
296
+ */
297
+ export declare interface NetworkError {
298
+ url: string;
299
+ method: string;
300
+ status: number;
301
+ statusText: string;
302
+ requestBody?: string;
303
+ responseBody?: string;
304
+ timestamp: number;
305
+ }
306
+
214
307
  /**
215
308
  * Fully resolved configuration with all defaults applied
216
309
  * Used internally by the embed after processing user config
@@ -248,6 +341,7 @@ export declare interface ResolvedFeedbackConfig {
248
341
  fontFamily: string;
249
342
  fontSize: number;
250
343
  captureScreenshot: boolean;
344
+ screenshotMethod: "dom" | "permission";
251
345
  screenshotOptions: {
252
346
  quality: number;
253
347
  maxWidth: number;
@@ -256,6 +350,12 @@ export declare interface ResolvedFeedbackConfig {
256
350
  incognito: boolean;
257
351
  positiveIcon: string;
258
352
  negativeIcon: string;
353
+ hideThumbs: boolean;
354
+ captureVideo: boolean;
355
+ videoOptions: {
356
+ maxDuration: number;
357
+ };
358
+ recordIcon: string;
259
359
  }
260
360
 
261
361
  /**
@@ -271,4 +371,36 @@ export declare interface SelectedBounds {
271
371
  visible: boolean;
272
372
  }
273
373
 
374
+ export declare interface VideoRecorder {
375
+ /** Start recording. Requests getDisplayMedia if not already started. */
376
+ start(): Promise<void>;
377
+ /** Stop recording and return the video blob. */
378
+ stop(): Promise<Blob>;
379
+ /** Register a callback for each second tick (receives seconds elapsed). */
380
+ onTick(callback: (elapsed: number) => void): void;
381
+ /** Register a callback for when recording stops (e.g., browser stop button, max duration). */
382
+ onStop(callback: (blob: Blob | null) => void): void;
383
+ /** Clean up all resources. */
384
+ destroy(): void;
385
+ }
386
+
387
+ /**
388
+ * Video capture utilities
389
+ * Uses getDisplayMedia + MediaRecorder for screen recording
390
+ */
391
+ export declare interface VideoRecorderOptions {
392
+ /** Max recording duration in seconds. Default: 15 */
393
+ maxDuration?: number;
394
+ /** Video bitrate in bps. Default: 800000 (800kbps) */
395
+ videoBitsPerSecond?: number;
396
+ }
397
+
274
398
  export { }
399
+
400
+
401
+ declare global {
402
+ interface Window {
403
+ html2canvas?: (element: HTMLElement, options?: Record<string, unknown>) => Promise<HTMLCanvasElement>;
404
+ }
405
+ }
406
+