@crikket-io/capture 0.1.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.
Files changed (72) hide show
  1. package/README.md +203 -0
  2. package/dist/browser.d.ts +6 -0
  3. package/dist/browser.js +1 -0
  4. package/dist/capture-screenshot-b3snwyge.js +1 -0
  5. package/dist/capture.css +907 -0
  6. package/dist/capture.global.js +10 -0
  7. package/dist/constants.d.ts +7 -0
  8. package/dist/debugger/debugger-collector.d.ts +15 -0
  9. package/dist/debugger/lazy-debugger-collector.d.ts +12 -0
  10. package/dist/debugger-collector-f0etqtvj.js +2 -0
  11. package/dist/eager.d.ts +18 -0
  12. package/dist/global.d.ts +6 -0
  13. package/dist/index-0avnsp70.js +2 -0
  14. package/dist/index-331vjad4.js +2 -0
  15. package/dist/index-97c5xshv.js +2 -0
  16. package/dist/index-ehy0ec5e.js +2 -0
  17. package/dist/index-nd41xgv7.js +2 -0
  18. package/dist/index-shtqtrh3.js +2 -0
  19. package/dist/index.d.ts +18 -0
  20. package/dist/index.js +2 -0
  21. package/dist/launcher.css +42 -0
  22. package/dist/media/capture-screenshot.d.ts +1 -0
  23. package/dist/media/display-capture.d.ts +6 -0
  24. package/dist/media/lazy-capture-media.d.ts +3 -0
  25. package/dist/media/start-display-recording.d.ts +2 -0
  26. package/dist/plugin.d.ts +5 -0
  27. package/dist/plugin.js +1 -0
  28. package/dist/react.d.ts +2 -0
  29. package/dist/react.js +1 -0
  30. package/dist/review-form-section-frr1x0zk.js +1 -0
  31. package/dist/runtime/capture-runtime.d.ts +36 -0
  32. package/dist/runtime/lazy-capture-runtime.d.ts +33 -0
  33. package/dist/runtime/submit-captured-report.d.ts +8 -0
  34. package/dist/start-display-recording-cve3f1me.js +1 -0
  35. package/dist/submit-captured-report-behdzdha.js +1 -0
  36. package/dist/transport/default-submit-transport.d.ts +2 -0
  37. package/dist/transport/turnstile.d.ts +20 -0
  38. package/dist/types.d.ts +165 -0
  39. package/dist/ui/capture-widget/capture-widget-root.d.ts +6 -0
  40. package/dist/ui/capture-widget/capture-widget-shell.d.ts +8 -0
  41. package/dist/ui/capture-widget/capture-widget-view.d.ts +7 -0
  42. package/dist/ui/capture-widget/components/capture-launcher-button.d.ts +5 -0
  43. package/dist/ui/capture-widget/components/icons.d.ts +8 -0
  44. package/dist/ui/capture-widget/components/media-preview.d.ts +6 -0
  45. package/dist/ui/capture-widget/components/primitives/badge.d.ts +5 -0
  46. package/dist/ui/capture-widget/components/primitives/button.d.ts +7 -0
  47. package/dist/ui/capture-widget/components/primitives/card.d.ts +11 -0
  48. package/dist/ui/capture-widget/components/primitives/cn.d.ts +1 -0
  49. package/dist/ui/capture-widget/components/primitives/field.d.ts +4 -0
  50. package/dist/ui/capture-widget/components/primitives/input.d.ts +1 -0
  51. package/dist/ui/capture-widget/components/primitives/label.d.ts +1 -0
  52. package/dist/ui/capture-widget/components/primitives/textarea.d.ts +1 -0
  53. package/dist/ui/capture-widget/components/screenshot-annotation-editor.d.ts +7 -0
  54. package/dist/ui/capture-widget/components/summary-stat.d.ts +4 -0
  55. package/dist/ui/capture-widget/hooks/use-capture-ui-handlers.d.ts +12 -0
  56. package/dist/ui/capture-widget/hooks/use-recording-clock.d.ts +4 -0
  57. package/dist/ui/capture-widget/hooks/use-review-form.d.ts +14 -0
  58. package/dist/ui/capture-widget/sections/chooser-section.d.ts +5 -0
  59. package/dist/ui/capture-widget/sections/recording-dock.d.ts +6 -0
  60. package/dist/ui/capture-widget/sections/review-form-section.d.ts +11 -0
  61. package/dist/ui/capture-widget/sections/success-section.d.ts +5 -0
  62. package/dist/ui/capture-widget/utils/get-view-description.d.ts +2 -0
  63. package/dist/ui/capture-widget/utils/review-form-schema.d.ts +22 -0
  64. package/dist/ui/capture-widget/utils/screenshot-annotations.d.ts +45 -0
  65. package/dist/ui/mount-capture-launcher.d.ts +11 -0
  66. package/dist/ui/mount-capture-ui.d.ts +2 -0
  67. package/dist/ui/store/capture-ui-store.d.ts +2 -0
  68. package/dist/ui/types.d.ts +63 -0
  69. package/dist/utils.d.ts +16 -0
  70. package/package.json +85 -0
  71. package/react.d.ts +2 -0
  72. package/react.js +1 -0
@@ -0,0 +1,165 @@
1
+ import type * as eagerCapture from "./eager.js";
2
+ export type CaptureType = "video" | "screenshot";
3
+ export type CapturePriority = "none" | "low" | "medium" | "high" | "critical";
4
+ export type CaptureReportVisibility = "public" | "private";
5
+ export type DebuggerActionType = "click" | "input" | "change" | "submit" | "keydown" | "navigation";
6
+ export interface DebuggerActionEvent {
7
+ kind: "action";
8
+ timestamp: number;
9
+ actionType: DebuggerActionType | string;
10
+ target?: string;
11
+ metadata?: Record<string, unknown>;
12
+ }
13
+ export interface DebuggerConsoleEvent {
14
+ kind: "console";
15
+ timestamp: number;
16
+ level: "log" | "info" | "warn" | "error" | "debug";
17
+ message: string;
18
+ metadata?: Record<string, unknown>;
19
+ }
20
+ export interface DebuggerNetworkEvent {
21
+ kind: "network";
22
+ timestamp: number;
23
+ method: string;
24
+ url: string;
25
+ status?: number;
26
+ duration?: number;
27
+ requestHeaders?: Record<string, string>;
28
+ responseHeaders?: Record<string, string>;
29
+ requestBody?: string;
30
+ responseBody?: string;
31
+ }
32
+ export type DebuggerEvent = DebuggerActionEvent | DebuggerConsoleEvent | DebuggerNetworkEvent;
33
+ export interface BugReportDebuggerPayload {
34
+ actions: Array<{
35
+ type: string;
36
+ target?: string;
37
+ timestamp: string;
38
+ offset: number | null;
39
+ metadata?: Record<string, unknown>;
40
+ }>;
41
+ logs: Array<{
42
+ level: "log" | "info" | "warn" | "error" | "debug";
43
+ message: string;
44
+ timestamp: string;
45
+ offset: number | null;
46
+ metadata?: Record<string, unknown>;
47
+ }>;
48
+ networkRequests: Array<{
49
+ method: string;
50
+ url: string;
51
+ status?: number;
52
+ duration?: number;
53
+ requestHeaders?: Record<string, string>;
54
+ responseHeaders?: Record<string, string>;
55
+ requestBody?: string;
56
+ responseBody?: string;
57
+ timestamp: string;
58
+ offset: number | null;
59
+ }>;
60
+ }
61
+ export interface CaptureInitOptions {
62
+ key: string;
63
+ host?: string;
64
+ autoMount?: boolean;
65
+ mountTarget?: HTMLElement;
66
+ submitPath?: string;
67
+ zIndex?: number;
68
+ submitTransport?: CaptureSubmitTransport;
69
+ }
70
+ export interface CaptureRuntimeConfig {
71
+ key: string;
72
+ host: string;
73
+ submitPath: string;
74
+ zIndex: number;
75
+ }
76
+ export interface CaptureDebuggerSummary {
77
+ actions: number;
78
+ logs: number;
79
+ networkRequests: number;
80
+ }
81
+ export interface CaptureSubmissionDraft {
82
+ title: string;
83
+ description: string;
84
+ priority: CapturePriority;
85
+ visibility?: CaptureReportVisibility;
86
+ }
87
+ export interface CaptureSubmitRequest {
88
+ config: CaptureRuntimeConfig;
89
+ report: {
90
+ captureType: CaptureType;
91
+ title: string;
92
+ description: string;
93
+ priority: CapturePriority;
94
+ visibility: CaptureReportVisibility;
95
+ pageUrl: string;
96
+ pageTitle: string;
97
+ durationMs: number | null;
98
+ deviceInfo?: {
99
+ browser?: string;
100
+ os?: string;
101
+ viewport?: string;
102
+ };
103
+ debuggerPayload?: BugReportDebuggerPayload;
104
+ debuggerSummary: CaptureDebuggerSummary;
105
+ media: Blob;
106
+ };
107
+ }
108
+ export interface CaptureSubmitResult {
109
+ shareUrl?: string;
110
+ reportId?: string;
111
+ raw?: unknown;
112
+ }
113
+ export type CaptureSubmitTransport = (request: CaptureSubmitRequest) => Promise<CaptureSubmitResult>;
114
+ export interface CapturedMedia {
115
+ blob: Blob;
116
+ captureType: CaptureType;
117
+ durationMs: number | null;
118
+ objectUrl: string;
119
+ }
120
+ export interface ReviewSnapshot {
121
+ debuggerPayload?: BugReportDebuggerPayload;
122
+ warnings: string[];
123
+ debuggerSummary: CaptureDebuggerSummary;
124
+ }
125
+ export interface BridgePayload {
126
+ source: string;
127
+ event?: unknown;
128
+ events?: unknown[];
129
+ }
130
+ export interface RecordingController {
131
+ startedAt: number;
132
+ finished: Promise<{
133
+ blob: Blob;
134
+ durationMs: number;
135
+ }>;
136
+ stop: () => Promise<{
137
+ blob: Blob;
138
+ durationMs: number;
139
+ }>;
140
+ abort: () => void;
141
+ }
142
+ export interface DebuggerSession {
143
+ sessionId: string;
144
+ captureType: CaptureType;
145
+ startedAt: number;
146
+ recordingStartedAt: number | null;
147
+ events: DebuggerEvent[];
148
+ }
149
+ export interface CaptureRuntimeController {
150
+ open: () => void;
151
+ close: () => void;
152
+ destroy: () => void;
153
+ mount: (target?: HTMLElement) => void;
154
+ unmount: () => void;
155
+ startRecording: () => Promise<{
156
+ startedAt: number;
157
+ }>;
158
+ stopRecording: () => Promise<Blob | null>;
159
+ takeScreenshot: () => Promise<Blob | null>;
160
+ submit: (draft: CaptureSubmissionDraft) => Promise<CaptureSubmitResult>;
161
+ reset: () => void;
162
+ isInitialized: () => boolean;
163
+ getConfig: () => CaptureRuntimeConfig | null;
164
+ }
165
+ export type CaptureGlobalApi = typeof eagerCapture;
@@ -0,0 +1,6 @@
1
+ import type { CaptureUiCallbacks, CaptureUiStore } from "../types.js";
2
+ export declare function CaptureWidgetRoot(props: {
3
+ callbacks: CaptureUiCallbacks;
4
+ store: CaptureUiStore;
5
+ zIndex: number;
6
+ }): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { CaptureUiHandlers, CaptureUiState } from "../types.js";
2
+ export declare function CaptureWidgetShell(props: {
3
+ zIndex: number;
4
+ state: CaptureUiState;
5
+ handlers: CaptureUiHandlers;
6
+ isSubmitPending: boolean;
7
+ recordingTime: string;
8
+ }): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { CaptureUiHandlers, CaptureUiState } from "../types.js";
2
+ export declare function CaptureWidgetView(props: {
3
+ handlers: CaptureUiHandlers;
4
+ isBusy: boolean;
5
+ isSubmitPending: boolean;
6
+ state: CaptureUiState;
7
+ }): React.JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ export declare function CaptureLauncherButton(props: {
2
+ disabled: boolean;
3
+ onClick: () => void;
4
+ zIndex: number;
5
+ }): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ export declare function DrawIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
2
+ export declare function HighlightIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
3
+ export declare function RectangleIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
4
+ export declare function UndoIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
5
+ export declare function ResetIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
6
+ export declare function CopyIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
7
+ export declare function CheckIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
8
+ export declare function ExternalLinkIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare function MediaPreview(props: {
2
+ media: {
3
+ captureType: "video" | "screenshot";
4
+ objectUrl: string;
5
+ } | null;
6
+ }): React.JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ export declare function Badge(props: {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ variant?: "default" | "secondary";
5
+ }): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ type ButtonVariant = "primary" | "outline" | "secondary";
2
+ type ButtonSize = "default" | "icon" | "sm";
3
+ export declare function Button(props: React.ButtonHTMLAttributes<HTMLButtonElement> & {
4
+ size?: ButtonSize;
5
+ variant?: ButtonVariant;
6
+ }): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare function Card(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
2
+ export declare function CardHeader(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
3
+ export declare function CardContent(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
4
+ export declare function CardTitle(props: {
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ }): React.JSX.Element;
8
+ export declare function CardDescription(props: {
9
+ children: React.ReactNode;
10
+ className?: string;
11
+ }): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function cn(...values: Array<string | false | null | undefined>): string;
@@ -0,0 +1,4 @@
1
+ export declare function Field(props: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
2
+ export declare function FieldError(props: {
3
+ errors: unknown[];
4
+ }): React.JSX.Element | null;
@@ -0,0 +1 @@
1
+ export declare function Input(props: React.InputHTMLAttributes<HTMLInputElement>): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function Label(props: React.LabelHTMLAttributes<HTMLLabelElement>): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function Textarea(props: React.TextareaHTMLAttributes<HTMLTextAreaElement>): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { type ScreenshotAnnotation } from "../utils/screenshot-annotations.js";
2
+ export declare function ScreenshotAnnotationEditor(props: {
3
+ annotations: ScreenshotAnnotation[];
4
+ disabled: boolean;
5
+ onChange: (annotations: ScreenshotAnnotation[]) => void;
6
+ src: string;
7
+ }): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare function SummaryStat(props: {
2
+ label: string;
3
+ value: number;
4
+ }): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { CaptureUiCallbacks, CaptureUiHandlers, CaptureUiStore } from "../../types.js";
2
+ interface UseCaptureUiHandlersInput {
3
+ callbacks: CaptureUiCallbacks;
4
+ shareUrl: string;
5
+ store: CaptureUiStore;
6
+ }
7
+ interface UseCaptureUiHandlersResult {
8
+ handlers: CaptureUiHandlers;
9
+ isSubmitPending: boolean;
10
+ }
11
+ export declare function useCaptureUiHandlers(input: UseCaptureUiHandlersInput): UseCaptureUiHandlersResult;
12
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function useRecordingClock(input: {
2
+ recordingDockOpen: boolean;
3
+ recordingStartedAt: number | null;
4
+ }): string;
@@ -0,0 +1,14 @@
1
+ import type { CaptureSubmissionDraft } from "../../../types.js";
2
+ import type { ReviewDraftErrors } from "../utils/review-form-schema.js";
3
+ type ReviewDraftField = keyof CaptureSubmissionDraft;
4
+ export declare function useReviewForm(input: {
5
+ initialDraft: CaptureSubmissionDraft;
6
+ onSubmit: (draft: CaptureSubmissionDraft) => Promise<void> | void;
7
+ }): {
8
+ draft: CaptureSubmissionDraft;
9
+ visibleErrors: ReviewDraftErrors;
10
+ setFieldValue: <TField extends ReviewDraftField>(field: TField, value: CaptureSubmissionDraft[TField]) => void;
11
+ touchField: (field: ReviewDraftField) => void;
12
+ handleSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
13
+ };
14
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function ChooserSection(props: {
2
+ busy: boolean;
3
+ onStartVideo: () => void;
4
+ onTakeScreenshot: () => void;
5
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare function RecordingDock(props: {
2
+ busy: boolean;
3
+ onStopRecording: () => void;
4
+ recordingTime: string;
5
+ zIndex: number;
6
+ }): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { CaptureSubmissionDraft } from "../../../types.js";
2
+ import type { CaptureReviewSubmitOptions, CaptureUiState } from "../../types.js";
3
+ interface ReviewFormSectionProps {
4
+ formKey: string;
5
+ isSubmitting: boolean;
6
+ state: CaptureUiState;
7
+ onCancel: () => void;
8
+ onSubmit: (draft: CaptureSubmissionDraft, options?: CaptureReviewSubmitOptions) => Promise<void>;
9
+ }
10
+ export declare function ReviewFormSection({ formKey, isSubmitting, state, onCancel, onSubmit, }: ReviewFormSectionProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { CaptureUiHandlers, CaptureUiState } from "../../types.js";
2
+ export declare function SuccessSection(props: {
3
+ state: CaptureUiState;
4
+ handlers: CaptureUiHandlers;
5
+ }): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { CaptureUiState } from "../../types.js";
2
+ export declare function getViewDescription(view: CaptureUiState["view"]): string;
@@ -0,0 +1,22 @@
1
+ import { type Priority } from "@crikket/shared/constants/priorities";
2
+ import type { CaptureSubmissionDraft } from "../../../types.js";
3
+ export type ReviewDraftErrors = Partial<Record<keyof CaptureSubmissionDraft, string>>;
4
+ export declare const capturePriorityOptions: readonly [{
5
+ readonly label: "Critical";
6
+ readonly value: "critical";
7
+ }, {
8
+ readonly label: "High";
9
+ readonly value: "high";
10
+ }, {
11
+ readonly label: "Medium";
12
+ readonly value: "medium";
13
+ }, {
14
+ readonly label: "Low";
15
+ readonly value: "low";
16
+ }, {
17
+ readonly label: "None";
18
+ readonly value: "none";
19
+ }];
20
+ export declare function validateReviewDraft(value: CaptureSubmissionDraft): ReviewDraftErrors | undefined;
21
+ export declare function trimReviewDraftForSubmission(draft: CaptureSubmissionDraft): CaptureSubmissionDraft;
22
+ export type CapturePriority = Priority;
@@ -0,0 +1,45 @@
1
+ export interface ScreenshotAnnotationPoint {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export declare const screenshotAnnotationColorOptions: readonly [{
6
+ readonly label: "Orange";
7
+ readonly value: "#F97316";
8
+ }, {
9
+ readonly label: "Red";
10
+ readonly value: "#EF4444";
11
+ }, {
12
+ readonly label: "Blue";
13
+ readonly value: "#3B82F6";
14
+ }, {
15
+ readonly label: "Green";
16
+ readonly value: "#22C55E";
17
+ }];
18
+ export type ScreenshotAnnotationColor = (typeof screenshotAnnotationColorOptions)[number]["value"];
19
+ export interface ScreenshotStrokeAnnotation {
20
+ kind: "stroke";
21
+ tool: "draw" | "highlight";
22
+ points: ScreenshotAnnotationPoint[];
23
+ color: ScreenshotAnnotationColor;
24
+ }
25
+ export interface ScreenshotRectangleAnnotation {
26
+ kind: "rectangle";
27
+ x: number;
28
+ y: number;
29
+ width: number;
30
+ height: number;
31
+ color: ScreenshotAnnotationColor;
32
+ }
33
+ export type ScreenshotAnnotation = ScreenshotStrokeAnnotation | ScreenshotRectangleAnnotation;
34
+ export declare function createAnnotatedScreenshotBlob(input: {
35
+ annotations: ScreenshotAnnotation[];
36
+ imageUrl: string;
37
+ }): Promise<Blob | null>;
38
+ export declare function drawScreenshotAnnotations(input: {
39
+ annotations: ScreenshotAnnotation[];
40
+ context: CanvasRenderingContext2D;
41
+ height: number;
42
+ image: CanvasImageSource;
43
+ width: number;
44
+ }): void;
45
+ export declare function clampAnnotationPoint(point: ScreenshotAnnotationPoint): ScreenshotAnnotationPoint;
@@ -0,0 +1,11 @@
1
+ interface MountedCaptureLauncher {
2
+ setLoading: (loading: boolean) => void;
3
+ unmount: () => void;
4
+ }
5
+ interface MountCaptureLauncherOptions {
6
+ zIndex: number;
7
+ onOpen: () => void;
8
+ onPrefetch: () => void;
9
+ }
10
+ export declare function mountCaptureLauncher(target: HTMLElement, options: MountCaptureLauncherOptions): MountedCaptureLauncher;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { CaptureUiCallbacks, MountedCaptureUi } from "./types.js";
2
+ export declare function mountCaptureUi(target: HTMLElement, zIndex: number, callbacks: CaptureUiCallbacks): MountedCaptureUi;
@@ -0,0 +1,2 @@
1
+ import type { CaptureUiStore } from "../types.js";
2
+ export declare function createCaptureUiStore(): CaptureUiStore;
@@ -0,0 +1,63 @@
1
+ import type { CaptureDebuggerSummary, CapturedMedia, CaptureSubmissionDraft } from "../types.js";
2
+ export interface CaptureReviewSubmitOptions {
3
+ screenshotBlobOverride?: Blob;
4
+ }
5
+ export interface CaptureUiState {
6
+ view: "chooser" | "recording" | "review" | "success";
7
+ overlayOpen: boolean;
8
+ recordingDockOpen: boolean;
9
+ busy: boolean;
10
+ errorMessage: string | null;
11
+ recordingStartedAt: number | null;
12
+ warnings: string[];
13
+ summary: CaptureDebuggerSummary;
14
+ media: CapturedMedia | null;
15
+ shareUrl: string;
16
+ copyLabel: string;
17
+ reviewDraft: CaptureSubmissionDraft;
18
+ reviewFormKey: string;
19
+ }
20
+ export interface CaptureUiHandlers {
21
+ onLauncherClick: () => void;
22
+ onClose: () => void;
23
+ onStartVideo: () => void;
24
+ onTakeScreenshot: () => void;
25
+ onStopRecording: () => void;
26
+ onSubmit: (draft: CaptureSubmissionDraft, options?: CaptureReviewSubmitOptions) => Promise<void>;
27
+ onCancel: () => void;
28
+ onRetry: () => void;
29
+ onCopyLink: () => void;
30
+ onOpenLink: () => void;
31
+ }
32
+ export interface CaptureUiCallbacks {
33
+ onClose: () => void;
34
+ onStartVideo: () => Promise<{
35
+ startedAt: number;
36
+ }>;
37
+ onTakeScreenshot: () => Promise<void>;
38
+ onStopRecording: () => Promise<void>;
39
+ onSubmit: (draft: CaptureSubmissionDraft, options?: CaptureReviewSubmitOptions) => Promise<void>;
40
+ onReset: () => void;
41
+ }
42
+ export interface CaptureUiStore {
43
+ getSnapshot: () => CaptureUiState;
44
+ subscribe: (listener: () => void) => () => void;
45
+ patchState: (patch: Partial<CaptureUiState>) => void;
46
+ openChooser: () => void;
47
+ close: () => void;
48
+ showRecording: (startedAt: number) => void;
49
+ showReview: (input: {
50
+ media: CapturedMedia;
51
+ warnings: string[];
52
+ summary: CaptureDebuggerSummary;
53
+ }) => void;
54
+ showSuccess: (shareUrl?: string) => void;
55
+ showError: (message: string) => void;
56
+ setTitleIfEmpty: (value: string) => void;
57
+ destroy: () => void;
58
+ }
59
+ export interface MountedCaptureUi {
60
+ setHidden: (hidden: boolean) => void;
61
+ store: CaptureUiStore;
62
+ unmount: () => void;
63
+ }
@@ -0,0 +1,16 @@
1
+ import type { BridgePayload } from "./types.js";
2
+ export declare function normalizeKey(value: string): string;
3
+ export declare function normalizeHost(value?: string): string;
4
+ export declare function normalizeSubmitPath(value?: string): string;
5
+ export declare function normalizeZIndex(value?: number): number;
6
+ export declare function isBridgePayload(value: unknown): value is BridgePayload;
7
+ export declare function createSessionId(): string;
8
+ export declare function toUserError(error: unknown): string;
9
+ export declare function getPageUrl(): string;
10
+ export declare function getPageTitle(): string;
11
+ export declare function getDeviceInfo(): {
12
+ browser?: string;
13
+ os?: string;
14
+ viewport?: string;
15
+ };
16
+ export declare function formatDuration(durationMs: number): string;
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@crikket-io/capture",
3
+ "version": "0.1.0",
4
+ "description": "Embeddable browser capture SDK for collecting bug reports from websites.",
5
+ "license": "AGPL-3.0-only",
6
+ "homepage": "https://crikket.io/docs",
7
+ "bugs": {
8
+ "url": "https://github.com/redpangilinan/crikket/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/redpangilinan/crikket.git",
13
+ "directory": "sdks/capture"
14
+ },
15
+ "keywords": [
16
+ "bug-reporting",
17
+ "capture-sdk",
18
+ "debugging",
19
+ "feedback-widget",
20
+ "react",
21
+ "screen-recording",
22
+ "screenshot"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.js",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "./browser": {
38
+ "types": "./dist/browser.d.ts",
39
+ "import": "./dist/browser.js",
40
+ "default": "./dist/browser.js"
41
+ },
42
+ "./react": {
43
+ "types": "./react.d.ts",
44
+ "import": "./react.js",
45
+ "default": "./react.js"
46
+ }
47
+ },
48
+ "sideEffects": [
49
+ "./dist/browser.js",
50
+ "./dist/capture.css",
51
+ "./dist/launcher.css"
52
+ ],
53
+ "files": [
54
+ "dist",
55
+ "react.d.ts",
56
+ "react.js",
57
+ "README.md"
58
+ ],
59
+ "scripts": {
60
+ "build": "bun run ./scripts/build.ts",
61
+ "prepack": "bun run build",
62
+ "dev": "bun run ./scripts/build.ts --watch",
63
+ "check-types": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.scripts.json",
64
+ "test": "bun test test"
65
+ },
66
+ "peerDependencies": {
67
+ "react": ">=18",
68
+ "react-dom": ">=18"
69
+ },
70
+ "dependencies": {
71
+ "@crikket/capture-core": "workspace:*",
72
+ "@crikket/shared": "workspace:*"
73
+ },
74
+ "devDependencies": {
75
+ "@tailwindcss/postcss": "catalog:",
76
+ "@crikket/config": "workspace:*",
77
+ "@types/react": "catalog:",
78
+ "@types/react-dom": "catalog:",
79
+ "postcss": "catalog:",
80
+ "react": "catalog:",
81
+ "react-dom": "catalog:",
82
+ "tailwindcss": "catalog:",
83
+ "typescript": "catalog:"
84
+ }
85
+ }
package/react.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export type { CapturePluginProps } from "./dist/react.js"
2
+ export { CapturePlugin } from "./dist/react.js"
package/react.js ADDED
@@ -0,0 +1 @@
1
+ export { CapturePlugin } from "./dist/react.js"