reflet-sdk 0.1.5 → 0.3.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.
@@ -0,0 +1,130 @@
1
+ import { c as ElementSelection, u as FeedbackContext, w as RefletUser } from "./types-UKPPJGrA.js";
2
+ //#region src/feedback/types.d.ts
3
+ declare const FEEDBACK_WIDGET_CATEGORIES: readonly ["bug", "idea", "question"];
4
+ type FeedbackWidgetCategory = (typeof FEEDBACK_WIDGET_CATEGORIES)[number];
5
+ declare const ANNOTATION_TOOLS: readonly ["pen", "arrow", "rectangle", "highlight", "blur"];
6
+ type AnnotationTool = (typeof ANNOTATION_TOOLS)[number];
7
+ interface Point {
8
+ x: number;
9
+ y: number;
10
+ }
11
+ interface Annotation {
12
+ color: string;
13
+ end: Point;
14
+ id: string;
15
+ /** Freehand path, in image pixels. Only set for the pen tool. */
16
+ points?: Point[];
17
+ start: Point;
18
+ tool: AnnotationTool;
19
+ }
20
+ interface CapturedImage {
21
+ blob: Blob;
22
+ height: number;
23
+ mimeType: string;
24
+ /** Object URL owned by the caller — revoke it when the capture is dropped. */
25
+ objectUrl: string;
26
+ width: number;
27
+ }
28
+ interface FeedbackWidgetLabels {
29
+ annotateHint: string;
30
+ attachScreenshot: string;
31
+ back: string;
32
+ cancel: string;
33
+ categoryBug: string;
34
+ categoryIdea: string;
35
+ categoryQuestion: string;
36
+ clearAnnotations: string;
37
+ descriptionPlaceholder: string;
38
+ dismissForDays: string;
39
+ done: string;
40
+ emailLabel: string;
41
+ emailPlaceholder: string;
42
+ errorGeneric: string;
43
+ errorTitleRequired: string;
44
+ pickElement: string;
45
+ pickElementHint: string;
46
+ recapture: string;
47
+ removeScreenshot: string;
48
+ retakeHint: string;
49
+ submit: string;
50
+ successMessage: string;
51
+ successTitle: string;
52
+ title: string;
53
+ titlePlaceholder: string;
54
+ trigger: string;
55
+ undo: string;
56
+ }
57
+ interface RefletFeedbackProps {
58
+ /** API base URL override. Falls back to the RefletProvider value. */
59
+ baseUrl?: string;
60
+ /** Record console errors and warnings to attach to bug reports. */
61
+ captureConsole?: boolean;
62
+ /** Take a screenshot of the viewport as soon as the panel opens. */
63
+ captureOnOpen?: boolean;
64
+ categories?: FeedbackWidgetCategory[];
65
+ defaultCategory?: FeedbackWidgetCategory;
66
+ /** Let reporters hide the launcher for this many days. */
67
+ dismissForDays?: number;
68
+ /** Render nothing when false — lets an app gate the widget per user. */
69
+ enabled?: boolean;
70
+ /** Keyboard shortcut opening the panel. Set to null to disable. */
71
+ hotkey?: string | null;
72
+ labels?: Partial<FeedbackWidgetLabels>;
73
+ /** Extra fields merged into the reported context. */
74
+ metadata?: Record<string, string>;
75
+ /** Distance in px from the viewport edges. */
76
+ offset?: number;
77
+ onClose?: () => void;
78
+ onDismiss?: (result: {
79
+ until: number;
80
+ }) => void;
81
+ onOpen?: () => void;
82
+ onSubmit?: (result: {
83
+ feedbackId: string;
84
+ }) => void;
85
+ position?: "bottom-left" | "bottom-right" | "top-left" | "top-right";
86
+ primaryColor?: string;
87
+ publicKey?: string;
88
+ theme?: "auto" | "dark" | "light";
89
+ user?: RefletUser;
90
+ userToken?: string;
91
+ }
92
+ //#endregion
93
+ //#region src/feedback/core/capture.d.ts
94
+ interface CaptureOptions {
95
+ /** Capture this element instead of the visible viewport. */
96
+ element?: Element;
97
+ excludeSelectors?: string[];
98
+ maxWidth?: number;
99
+ }
100
+ /**
101
+ * Renders what the user is looking at right now.
102
+ *
103
+ * Runs off the DOM rather than `getDisplayMedia` on purpose: a screen-share
104
+ * permission prompt on every report would cost more reports than it captures.
105
+ * Returns null instead of throwing — a screenshot is never worth losing the
106
+ * written feedback.
107
+ */
108
+ declare function captureViewport(options?: CaptureOptions): Promise<CapturedImage | null>;
109
+ declare function releaseCapture(image: CapturedImage | null | undefined): void;
110
+ //#endregion
111
+ //#region src/feedback/core/element-selector.d.ts
112
+ /** Everything an agent needs to find the picked element back in the codebase. */
113
+ declare function buildElementSelection(element: Element): ElementSelection;
114
+ //#endregion
115
+ //#region src/feedback/core/page-context.d.ts
116
+ /** Everything about the page that a bug report needs and the DOM already knows. */
117
+ declare function collectPageContext(options?: {
118
+ sdkVersion?: string;
119
+ }): FeedbackContext;
120
+ //#endregion
121
+ //#region src/feedback/widget.d.ts
122
+ /**
123
+ * Floating feedback button with a screenshot, annotation and element picker
124
+ * flow. Mount it once, anywhere below `RefletProvider` or with its own
125
+ * `publicKey`.
126
+ */
127
+ declare function RefletFeedback(props: RefletFeedbackProps): import("react").JSX.Element | null;
128
+ //#endregion
129
+ export { type Annotation, type AnnotationTool, type CapturedImage, type FeedbackWidgetCategory, type FeedbackWidgetLabels, RefletFeedback, type RefletFeedbackProps, buildElementSelection, captureViewport, collectPageContext, releaseCapture };
130
+ //# sourceMappingURL=feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.d.ts","names":[],"sources":["../src/feedback/types.ts","../src/feedback/core/capture.ts","../src/feedback/core/element-selector.ts","../src/feedback/core/page-context.ts","../src/feedback/widget.tsx"],"mappings":";;cAKM;KAEM,iCACF;cAEJ;KAQM,yBAAyB;UAEpB;EACf;EACA;;UAGe;EACf;EACA,KAAK;EACL;;EAEA,SAAS;EACT,OAAO;EACP,MAAM;;UAGS;EACf,MAAM;EACN;EACA;;EAEA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAiCe;;EAEf;;EAEA;;EAEA;EACA,aAAa;EACb,kBAAkB;;EAElB;;EAEA;;EAEA;EACA,SAAS,QAAQ;;EAEjB,WAAW;;EAEX;EACA;EACA,aAAa;IAAU;;EACvB;EACA,YAAY;IAAU;;EACtB;EACA;EACA;EACA;EACA,OAAO;EACP;;;;UC7He;;EAEf,UAAU;EACV;EACA;;;;;;;;;;iBA6EoB,gBACpB,UAAS,iBACR,QAAQ;iBAqCK,eAAe,OAAO;;;;iBCoGtB,sBAAsB,SAAS,UAAU;;;;iBCxIzC,mBAAmB;EACjC;IACE;;;;;;;;iBCrEY,eAAe,OAAO,sCAAmB,IAAA"}