gotcha-feedback 1.1.4 → 1.1.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.mts +68 -7
- package/dist/index.d.ts +68 -7
- package/dist/index.js +20 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -5
- package/dist/index.mjs.map +1 -1
- package/dist/screenshot-CTLYS27H.mjs +2 -0
- package/dist/screenshot-CTLYS27H.mjs.map +1 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -34,6 +34,25 @@ interface GotchaStyles {
|
|
|
34
34
|
backdrop?: React.CSSProperties;
|
|
35
35
|
spinner?: React.CSSProperties;
|
|
36
36
|
}
|
|
37
|
+
interface SubmissionContext {
|
|
38
|
+
url?: string;
|
|
39
|
+
userAgent?: string;
|
|
40
|
+
viewport?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
language?: string;
|
|
45
|
+
timezone?: string;
|
|
46
|
+
screenResolution?: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
};
|
|
50
|
+
recentErrors?: Array<{
|
|
51
|
+
message: string;
|
|
52
|
+
source?: string;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
37
56
|
interface SubmitResponsePayload {
|
|
38
57
|
elementId: string;
|
|
39
58
|
mode: ResponseMode;
|
|
@@ -44,15 +63,13 @@ interface SubmitResponsePayload {
|
|
|
44
63
|
pollOptions?: string[];
|
|
45
64
|
pollSelected?: string[];
|
|
46
65
|
isBug?: boolean;
|
|
66
|
+
screenshot?: string;
|
|
47
67
|
user?: GotchaUser;
|
|
48
|
-
context?:
|
|
49
|
-
url?: string;
|
|
50
|
-
userAgent?: string;
|
|
51
|
-
};
|
|
68
|
+
context?: SubmissionContext;
|
|
52
69
|
}
|
|
53
70
|
interface GotchaResponse {
|
|
54
71
|
id: string;
|
|
55
|
-
status: 'created' | 'duplicate' | 'updated';
|
|
72
|
+
status: 'created' | 'duplicate' | 'updated' | 'queued';
|
|
56
73
|
createdAt: string;
|
|
57
74
|
results?: PollResults;
|
|
58
75
|
}
|
|
@@ -89,6 +106,8 @@ interface ScoreData {
|
|
|
89
106
|
npsScore: number | null;
|
|
90
107
|
}
|
|
91
108
|
|
|
109
|
+
declare function getQueueLength(): number;
|
|
110
|
+
|
|
92
111
|
interface GotchaThemeColors {
|
|
93
112
|
primary: string;
|
|
94
113
|
primaryHover: string;
|
|
@@ -277,8 +296,32 @@ interface GotchaProps {
|
|
|
277
296
|
enableBugFlag?: boolean;
|
|
278
297
|
/** Custom label for the bug flag toggle (default: "Report an issue") */
|
|
279
298
|
bugFlagLabel?: string;
|
|
299
|
+
/** Enable screenshot capture when bug flag is toggled (requires html2canvas peer dep, falls back to native API) */
|
|
300
|
+
enableScreenshot?: boolean;
|
|
280
301
|
/** When true and user has already responded, show submitted state and allow review/edit instead of new submission */
|
|
281
302
|
onePerUser?: boolean;
|
|
303
|
+
/** When onePerUser is true, allow a new submission after this many days. Has no effect without onePerUser. */
|
|
304
|
+
cooldownDays?: number;
|
|
305
|
+
/** After submission, hide the widget for this many days (client-side, localStorage).
|
|
306
|
+
* Independent of cooldownDays — the widget stays hidden for the full duration even if cooldown expires sooner. */
|
|
307
|
+
hideAfterSubmitDays?: number;
|
|
308
|
+
/** Delay showing widget by N seconds after page load */
|
|
309
|
+
showAfterSeconds?: number;
|
|
310
|
+
/** Show widget after user scrolls past this percentage (0-100) */
|
|
311
|
+
showAfterScrollPercent?: number;
|
|
312
|
+
/** Show widget after user has visited N times (uses localStorage) */
|
|
313
|
+
showAfterVisits?: number;
|
|
314
|
+
/** Show a follow-up question after low rating or negative vote */
|
|
315
|
+
followUp?: {
|
|
316
|
+
/** Rating threshold (inclusive) — e.g., 2 means ratings 1-2 trigger follow-up */
|
|
317
|
+
ratingThreshold?: number;
|
|
318
|
+
/** Also trigger on negative vote */
|
|
319
|
+
onNegativeVote?: boolean;
|
|
320
|
+
/** The prompt text shown */
|
|
321
|
+
promptText: string;
|
|
322
|
+
/** Placeholder for the follow-up textarea */
|
|
323
|
+
placeholder?: string;
|
|
324
|
+
};
|
|
282
325
|
/** Enable entrance animations on the button and modal (default: true) */
|
|
283
326
|
animated?: boolean;
|
|
284
327
|
/** Called after successful submission */
|
|
@@ -290,7 +333,7 @@ interface GotchaProps {
|
|
|
290
333
|
/** Called on error */
|
|
291
334
|
onError?: (error: GotchaError) => void;
|
|
292
335
|
}
|
|
293
|
-
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, onePerUser, animated, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
336
|
+
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, enableScreenshot, onePerUser, cooldownDays, hideAfterSubmitDays, showAfterSeconds, showAfterScrollPercent, showAfterVisits, followUp, animated, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
294
337
|
|
|
295
338
|
type ScoreVariant = 'stars' | 'number' | 'compact' | 'votes';
|
|
296
339
|
interface GotchaScoreProps {
|
|
@@ -325,6 +368,8 @@ declare function useGotcha(): {
|
|
|
325
368
|
ticketId: string;
|
|
326
369
|
status: string;
|
|
327
370
|
}>;
|
|
371
|
+
flushQueue(): Promise<void>;
|
|
372
|
+
getQueueLength: typeof getQueueLength;
|
|
328
373
|
getBaseUrl(): string;
|
|
329
374
|
};
|
|
330
375
|
/** Whether Gotcha is globally disabled */
|
|
@@ -335,6 +380,22 @@ declare function useGotcha(): {
|
|
|
335
380
|
debug: boolean;
|
|
336
381
|
/** Submit feedback programmatically */
|
|
337
382
|
submitFeedback: (payload: Omit<SubmitResponsePayload, "context">) => Promise<GotchaResponse>;
|
|
383
|
+
/** Open a specific Gotcha modal by elementId */
|
|
384
|
+
openModal: (elementId: string) => void;
|
|
385
|
+
/** Close the currently open modal */
|
|
386
|
+
closeModal: () => void;
|
|
387
|
+
/** The currently open modal's elementId, or null */
|
|
388
|
+
activeModalId: string | null;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Hook to programmatically open/close a specific Gotcha widget.
|
|
393
|
+
* The corresponding <Gotcha elementId="..."> must be mounted for the modal to render.
|
|
394
|
+
*/
|
|
395
|
+
declare function useGotchaTrigger(elementId: string): {
|
|
396
|
+
open: () => void;
|
|
397
|
+
close: () => void;
|
|
398
|
+
isOpen: boolean;
|
|
338
399
|
};
|
|
339
400
|
|
|
340
|
-
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaThemeConfig, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type Theme, type TouchBehavior, type VoteType, createTheme, useGotcha };
|
|
401
|
+
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaThemeConfig, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type SubmissionContext, type Theme, type TouchBehavior, type VoteType, createTheme, useGotcha, useGotchaTrigger };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,25 @@ interface GotchaStyles {
|
|
|
34
34
|
backdrop?: React.CSSProperties;
|
|
35
35
|
spinner?: React.CSSProperties;
|
|
36
36
|
}
|
|
37
|
+
interface SubmissionContext {
|
|
38
|
+
url?: string;
|
|
39
|
+
userAgent?: string;
|
|
40
|
+
viewport?: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
language?: string;
|
|
45
|
+
timezone?: string;
|
|
46
|
+
screenResolution?: {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
};
|
|
50
|
+
recentErrors?: Array<{
|
|
51
|
+
message: string;
|
|
52
|
+
source?: string;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
37
56
|
interface SubmitResponsePayload {
|
|
38
57
|
elementId: string;
|
|
39
58
|
mode: ResponseMode;
|
|
@@ -44,15 +63,13 @@ interface SubmitResponsePayload {
|
|
|
44
63
|
pollOptions?: string[];
|
|
45
64
|
pollSelected?: string[];
|
|
46
65
|
isBug?: boolean;
|
|
66
|
+
screenshot?: string;
|
|
47
67
|
user?: GotchaUser;
|
|
48
|
-
context?:
|
|
49
|
-
url?: string;
|
|
50
|
-
userAgent?: string;
|
|
51
|
-
};
|
|
68
|
+
context?: SubmissionContext;
|
|
52
69
|
}
|
|
53
70
|
interface GotchaResponse {
|
|
54
71
|
id: string;
|
|
55
|
-
status: 'created' | 'duplicate' | 'updated';
|
|
72
|
+
status: 'created' | 'duplicate' | 'updated' | 'queued';
|
|
56
73
|
createdAt: string;
|
|
57
74
|
results?: PollResults;
|
|
58
75
|
}
|
|
@@ -89,6 +106,8 @@ interface ScoreData {
|
|
|
89
106
|
npsScore: number | null;
|
|
90
107
|
}
|
|
91
108
|
|
|
109
|
+
declare function getQueueLength(): number;
|
|
110
|
+
|
|
92
111
|
interface GotchaThemeColors {
|
|
93
112
|
primary: string;
|
|
94
113
|
primaryHover: string;
|
|
@@ -277,8 +296,32 @@ interface GotchaProps {
|
|
|
277
296
|
enableBugFlag?: boolean;
|
|
278
297
|
/** Custom label for the bug flag toggle (default: "Report an issue") */
|
|
279
298
|
bugFlagLabel?: string;
|
|
299
|
+
/** Enable screenshot capture when bug flag is toggled (requires html2canvas peer dep, falls back to native API) */
|
|
300
|
+
enableScreenshot?: boolean;
|
|
280
301
|
/** When true and user has already responded, show submitted state and allow review/edit instead of new submission */
|
|
281
302
|
onePerUser?: boolean;
|
|
303
|
+
/** When onePerUser is true, allow a new submission after this many days. Has no effect without onePerUser. */
|
|
304
|
+
cooldownDays?: number;
|
|
305
|
+
/** After submission, hide the widget for this many days (client-side, localStorage).
|
|
306
|
+
* Independent of cooldownDays — the widget stays hidden for the full duration even if cooldown expires sooner. */
|
|
307
|
+
hideAfterSubmitDays?: number;
|
|
308
|
+
/** Delay showing widget by N seconds after page load */
|
|
309
|
+
showAfterSeconds?: number;
|
|
310
|
+
/** Show widget after user scrolls past this percentage (0-100) */
|
|
311
|
+
showAfterScrollPercent?: number;
|
|
312
|
+
/** Show widget after user has visited N times (uses localStorage) */
|
|
313
|
+
showAfterVisits?: number;
|
|
314
|
+
/** Show a follow-up question after low rating or negative vote */
|
|
315
|
+
followUp?: {
|
|
316
|
+
/** Rating threshold (inclusive) — e.g., 2 means ratings 1-2 trigger follow-up */
|
|
317
|
+
ratingThreshold?: number;
|
|
318
|
+
/** Also trigger on negative vote */
|
|
319
|
+
onNegativeVote?: boolean;
|
|
320
|
+
/** The prompt text shown */
|
|
321
|
+
promptText: string;
|
|
322
|
+
/** Placeholder for the follow-up textarea */
|
|
323
|
+
placeholder?: string;
|
|
324
|
+
};
|
|
282
325
|
/** Enable entrance animations on the button and modal (default: true) */
|
|
283
326
|
animated?: boolean;
|
|
284
327
|
/** Called after successful submission */
|
|
@@ -290,7 +333,7 @@ interface GotchaProps {
|
|
|
290
333
|
/** Called on error */
|
|
291
334
|
onError?: (error: GotchaError) => void;
|
|
292
335
|
}
|
|
293
|
-
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, onePerUser, animated, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
336
|
+
declare function Gotcha({ elementId, user, mode, showText, showRating, voteLabels, options, allowMultiple, npsQuestion, npsFollowUp, npsFollowUpPlaceholder, npsLowLabel, npsHighLabel, enableBugFlag, bugFlagLabel, enableScreenshot, onePerUser, cooldownDays, hideAfterSubmitDays, showAfterSeconds, showAfterScrollPercent, showAfterVisits, followUp, animated, position, size, theme, customStyles, visible, showOnHover, touchBehavior, promptText, placeholder, submitText, thankYouMessage, onSubmit, onOpen, onClose, onError, }: GotchaProps): react_jsx_runtime.JSX.Element | null;
|
|
294
337
|
|
|
295
338
|
type ScoreVariant = 'stars' | 'number' | 'compact' | 'votes';
|
|
296
339
|
interface GotchaScoreProps {
|
|
@@ -325,6 +368,8 @@ declare function useGotcha(): {
|
|
|
325
368
|
ticketId: string;
|
|
326
369
|
status: string;
|
|
327
370
|
}>;
|
|
371
|
+
flushQueue(): Promise<void>;
|
|
372
|
+
getQueueLength: typeof getQueueLength;
|
|
328
373
|
getBaseUrl(): string;
|
|
329
374
|
};
|
|
330
375
|
/** Whether Gotcha is globally disabled */
|
|
@@ -335,6 +380,22 @@ declare function useGotcha(): {
|
|
|
335
380
|
debug: boolean;
|
|
336
381
|
/** Submit feedback programmatically */
|
|
337
382
|
submitFeedback: (payload: Omit<SubmitResponsePayload, "context">) => Promise<GotchaResponse>;
|
|
383
|
+
/** Open a specific Gotcha modal by elementId */
|
|
384
|
+
openModal: (elementId: string) => void;
|
|
385
|
+
/** Close the currently open modal */
|
|
386
|
+
closeModal: () => void;
|
|
387
|
+
/** The currently open modal's elementId, or null */
|
|
388
|
+
activeModalId: string | null;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Hook to programmatically open/close a specific Gotcha widget.
|
|
393
|
+
* The corresponding <Gotcha elementId="..."> must be mounted for the modal to render.
|
|
394
|
+
*/
|
|
395
|
+
declare function useGotchaTrigger(elementId: string): {
|
|
396
|
+
open: () => void;
|
|
397
|
+
close: () => void;
|
|
398
|
+
isOpen: boolean;
|
|
338
399
|
};
|
|
339
400
|
|
|
340
|
-
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaThemeConfig, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type Theme, type TouchBehavior, type VoteType, createTheme, useGotcha };
|
|
401
|
+
export { Gotcha, type GotchaError, type GotchaProps, GotchaProvider, type GotchaProviderProps, type GotchaResponse, GotchaScore, type GotchaScoreProps, type GotchaStyles, type GotchaThemeConfig, type GotchaUser, type Position, type ResponseMode, type ScoreData, type Size, type SubmissionContext, type Theme, type TouchBehavior, type VoteType, createTheme, useGotcha, useGotchaTrigger };
|