@checkflow/sdk 1.0.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.
@@ -0,0 +1,112 @@
1
+ /**
2
+ * CheckFlow SDK Main Class
3
+ * Entry point for the CheckFlow feedback SDK
4
+ */
5
+ import { CheckFlowOptions, FeedbackData, CaptureOptions, CaptureResult, SubmitResult, UserInfo, ErrorInfo } from './types';
6
+ import { PrivacyMasker } from './privacy';
7
+ export declare class CheckFlow {
8
+ private static instance;
9
+ private apiKey;
10
+ private options;
11
+ private apiClient;
12
+ private contextCapture;
13
+ private errorCapture;
14
+ private sessionRecording;
15
+ private widget;
16
+ private privacyMasker;
17
+ private analyticsTracker;
18
+ private isInitialized;
19
+ constructor(apiKey: string, options?: CheckFlowOptions);
20
+ /**
21
+ * Initialize the SDK
22
+ */
23
+ init(): this;
24
+ /**
25
+ * Show the feedback widget
26
+ */
27
+ showWidget(): void;
28
+ /**
29
+ * Hide the feedback widget
30
+ */
31
+ hideWidget(): void;
32
+ /**
33
+ * Open the feedback form
34
+ */
35
+ open(): void;
36
+ /**
37
+ * Close the feedback form
38
+ */
39
+ close(): void;
40
+ /**
41
+ * Capture current page context
42
+ */
43
+ capture(options?: CaptureOptions): Promise<CaptureResult>;
44
+ /**
45
+ * Submit feedback
46
+ */
47
+ submitFeedback(feedback: FeedbackData): Promise<SubmitResult>;
48
+ /**
49
+ * Capture and report an error
50
+ */
51
+ captureException(error: Error, context?: Record<string, any>): void;
52
+ /**
53
+ * Set user information
54
+ */
55
+ setUser(user: UserInfo): void;
56
+ /**
57
+ * Clear user information
58
+ */
59
+ clearUser(): void;
60
+ /**
61
+ * Add custom metadata
62
+ */
63
+ setMetadata(metadata: Record<string, any>): void;
64
+ /**
65
+ * Get console logs
66
+ */
67
+ getConsoleLogs(): import("./types").ConsoleEntry[];
68
+ /**
69
+ * Get network logs
70
+ */
71
+ getNetworkLogs(): import("./types").NetworkEntry[];
72
+ /**
73
+ * Get captured errors
74
+ */
75
+ getErrors(): ErrorInfo[];
76
+ /**
77
+ * Configure privacy settings
78
+ */
79
+ configurePrivacy(config: {
80
+ enabled?: boolean;
81
+ autoMask?: {
82
+ emails?: boolean;
83
+ creditCards?: boolean;
84
+ phoneNumbers?: boolean;
85
+ passwords?: boolean;
86
+ };
87
+ excludeSelectors?: string[];
88
+ }): void;
89
+ /**
90
+ * Mask text using privacy rules
91
+ */
92
+ maskText(text: string): import("./privacy").MaskResult;
93
+ /**
94
+ * Get privacy masker instance
95
+ */
96
+ getPrivacyMasker(): PrivacyMasker;
97
+ /**
98
+ * Destroy the SDK instance
99
+ */
100
+ destroy(): void;
101
+ /**
102
+ * Get the singleton instance
103
+ */
104
+ static getInstance(): CheckFlow | null;
105
+ private handleWidgetSubmit;
106
+ private handleError;
107
+ private log;
108
+ }
109
+ /**
110
+ * Factory function for creating CheckFlow instance
111
+ */
112
+ export declare function createCheckFlow(apiKey: string, options?: CheckFlowOptions): CheckFlow;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Context Capture Module
3
+ * Handles screenshot capture, console logs, network logs, and performance metrics
4
+ */
5
+ import { CaptureOptions, CaptureResult, ConsoleEntry, NetworkEntry, PerformanceMetrics, PageContext } from './types';
6
+ declare function capturePerformance(): PerformanceMetrics;
7
+ declare function capturePageContext(): PageContext;
8
+ declare function captureScreenshot(options?: CaptureOptions): Promise<string | null>;
9
+ export declare class ContextCapture {
10
+ private consoleCapture;
11
+ private networkCapture;
12
+ private isCapturing;
13
+ constructor(options?: {
14
+ maxConsoleEntries?: number;
15
+ maxNetworkEntries?: number;
16
+ });
17
+ /**
18
+ * Start capturing console and network logs
19
+ */
20
+ startCapture(): void;
21
+ /**
22
+ * Stop capturing
23
+ */
24
+ stopCapture(): void;
25
+ /**
26
+ * Capture current page context with optional screenshot
27
+ */
28
+ capture(options?: CaptureOptions): Promise<CaptureResult>;
29
+ /**
30
+ * Get current console entries
31
+ */
32
+ getConsoleLogs(): ConsoleEntry[];
33
+ /**
34
+ * Get current network entries
35
+ */
36
+ getNetworkLogs(): NetworkEntry[];
37
+ /**
38
+ * Clear all captured data
39
+ */
40
+ clear(): void;
41
+ }
42
+ export { captureScreenshot, capturePageContext, capturePerformance };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Error Capture Module
3
+ * Automatic error capture and reporting
4
+ */
5
+ import { ErrorInfo } from './types';
6
+ export type ErrorHandler = (error: ErrorInfo) => void | Promise<void>;
7
+ export declare class ErrorCapture {
8
+ private handler?;
9
+ private isCapturing;
10
+ private capturedErrors;
11
+ private maxErrors;
12
+ private originalOnError?;
13
+ private originalOnUnhandledRejection?;
14
+ constructor(handler?: ErrorHandler);
15
+ /**
16
+ * Start capturing errors
17
+ */
18
+ start(): void;
19
+ /**
20
+ * Stop capturing errors
21
+ */
22
+ stop(): void;
23
+ /**
24
+ * Set error handler
25
+ */
26
+ setHandler(handler: ErrorHandler): void;
27
+ /**
28
+ * Manually capture an error
29
+ */
30
+ captureError(error: Partial<ErrorInfo>): void;
31
+ /**
32
+ * Capture an exception (try/catch style)
33
+ */
34
+ captureException(error: Error, context?: Record<string, any>): void;
35
+ /**
36
+ * Get captured errors
37
+ */
38
+ getErrors(): ErrorInfo[];
39
+ /**
40
+ * Clear captured errors
41
+ */
42
+ clear(): void;
43
+ }
44
+ /**
45
+ * React Error Boundary wrapper
46
+ * Usage:
47
+ * ```tsx
48
+ * import { withErrorBoundary } from '@checkflow/sdk';
49
+ *
50
+ * const App = withErrorBoundary(MyApp, {
51
+ * fallback: <ErrorFallback />,
52
+ * onError: (error, errorInfo) => console.log(error),
53
+ * });
54
+ * ```
55
+ */
56
+ export interface ErrorBoundaryOptions {
57
+ fallback?: React.ReactNode | ((error: Error, reset: () => void) => React.ReactNode);
58
+ onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
59
+ onReset?: () => void;
60
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * CheckFlow SDK
3
+ * User feedback collection with automatic context capture
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ export { CheckFlow, createCheckFlow } from './checkflow';
8
+ export { APIClient } from './api-client';
9
+ export { ContextCapture, captureScreenshot, capturePageContext, capturePerformance } from './context-capture';
10
+ export { ErrorCapture } from './error-capture';
11
+ export { FeedbackWidget } from './widget';
12
+ export { SessionRecording } from './session-recording';
13
+ export { AnnotationEditor, AnnotationToolbar, injectAnnotationStyles, removeAnnotationStyles, } from './annotation';
14
+ export { PrivacyMasker, PrivacyDetector, PATTERNS as PRIVACY_PATTERNS, DEFAULT_PRIVACY_CONFIG, } from './privacy';
15
+ export type { PrivacyConfig, AutoMaskConfig, CustomPattern, MaskResult, Detection as PrivacyDetection, DetectionType, DOMPrivacyResult, DOMDetection, } from './privacy';
16
+ export type { AnnotationToolType, Point, Bounds, AnnotationStyle, Annotation as AnnotationData, RectangleAnnotation, EllipseAnnotation, ArrowAnnotation, LineAnnotation, HighlightAnnotation, BlurAnnotation, TextAnnotation, FreehandAnnotation, AnnotationEditorConfig, } from './annotation';
17
+ export { DEFAULT_STYLE, HIGHLIGHT_STYLE, BLUR_STYLE, COLOR_PALETTE, STROKE_WIDTHS, } from './annotation';
18
+ export type { CheckFlowOptions, UserInfo, FeedbackData, FeedbackType, FeedbackPriority, Annotation, CaptureOptions, CaptureResult, ConsoleEntry, NetworkEntry, PerformanceMetrics, PageContext, ErrorInfo, SubmitResult, APIResponse, WidgetConfig, WidgetState, Translations, } from './types';
19
+ export { DEFAULT_TRANSLATIONS, TRANSLATIONS } from './types';
20
+ export { CheckFlowProvider, useCheckFlow, useFeedbackForm, CheckFlowErrorBoundary, withCheckFlow, withErrorBoundary, FeedbackButton, } from './react';
21
+ export declare const VERSION = "1.0.0";
22
+ import { CheckFlow } from './checkflow';
23
+ export default CheckFlow;