@checkflow/sdk 1.1.1 → 1.1.2

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 (46) hide show
  1. package/README.md +63 -219
  2. package/dist/chunk-CD33QAA6.mjs +131 -0
  3. package/dist/chunk-CQ56DMFR.mjs +83 -0
  4. package/dist/highlighter-D_wZWHlS.d.mts +71 -0
  5. package/dist/highlighter-D_wZWHlS.d.ts +71 -0
  6. package/dist/highlighter-W4XDALRE.mjs +8 -0
  7. package/dist/index.d.mts +41 -0
  8. package/dist/index.d.ts +38 -20
  9. package/dist/index.js +607 -17221
  10. package/dist/index.mjs +411 -0
  11. package/dist/react.d.mts +28 -0
  12. package/dist/react.d.ts +28 -0
  13. package/dist/react.js +743 -0
  14. package/dist/react.mjs +51 -0
  15. package/dist/screenshot-CUMBPE2T.mjs +12 -0
  16. package/dist/vue.d.mts +26 -0
  17. package/dist/vue.d.ts +26 -0
  18. package/dist/vue.js +744 -0
  19. package/dist/vue.mjs +53 -0
  20. package/package.json +38 -53
  21. package/dist/analytics-tracker.d.ts +0 -112
  22. package/dist/annotation/editor.d.ts +0 -72
  23. package/dist/annotation/index.d.ts +0 -9
  24. package/dist/annotation/styles.d.ts +0 -6
  25. package/dist/annotation/toolbar.d.ts +0 -32
  26. package/dist/annotation/types.d.ts +0 -85
  27. package/dist/api-client.d.ts +0 -76
  28. package/dist/checkflow.css +0 -1
  29. package/dist/checkflow.d.ts +0 -112
  30. package/dist/context-capture.d.ts +0 -42
  31. package/dist/error-capture.d.ts +0 -60
  32. package/dist/index.esm.js +0 -17210
  33. package/dist/index.esm.js.map +0 -1
  34. package/dist/index.js.map +0 -1
  35. package/dist/optimized-recorder.d.ts +0 -94
  36. package/dist/privacy/detector.d.ts +0 -56
  37. package/dist/privacy/index.d.ts +0 -8
  38. package/dist/privacy/masker.d.ts +0 -43
  39. package/dist/privacy/types.d.ts +0 -54
  40. package/dist/react/index.d.ts +0 -77
  41. package/dist/session-recording-rrweb.d.ts +0 -100
  42. package/dist/session-recording.d.ts +0 -74
  43. package/dist/types.d.ts +0 -299
  44. package/dist/vue/index.d.ts +0 -55
  45. package/dist/widget/Widget.d.ts +0 -98
  46. package/dist/widget/index.d.ts +0 -2
@@ -1,94 +0,0 @@
1
- /**
2
- * Optimized Session Recorder - Inspired by Mixpanel/LogRocket
3
- *
4
- * Features from refactorisation.md:
5
- * - Adaptive sampling (10-100ms based on activity)
6
- * - Event batching (50 events per batch)
7
- * - Compression before sending
8
- * - Circular buffer for performance
9
- * - Intelligent event filtering
10
- */
11
- import type { eventWithTime } from '@rrweb/types';
12
- export interface OptimizedRecorderConfig {
13
- samplingRate: number;
14
- eventBatchSize: number;
15
- maxSessionLength: number;
16
- quality: 'low' | 'medium' | 'high';
17
- compression: boolean;
18
- adaptiveSampling: boolean;
19
- onBatchReady?: (batch: EventBatch) => void;
20
- onError?: (error: Error) => void;
21
- }
22
- export interface EventBatch {
23
- sessionId: string;
24
- events: eventWithTime[];
25
- chunkIndex: number;
26
- compressed?: boolean;
27
- compressedData?: string;
28
- timestamp: number;
29
- }
30
- export declare class OptimizedRecorder {
31
- private config;
32
- private eventBuffer;
33
- private bufferIndex;
34
- private sessionId;
35
- private stopRecording?;
36
- private batchTimer?;
37
- private activityMetrics;
38
- private startTime;
39
- private chunkIndex;
40
- private isRecording;
41
- constructor(sessionId: string, config?: Partial<OptimizedRecorderConfig>);
42
- /**
43
- * Start recording with optimized settings
44
- */
45
- start(): void;
46
- /**
47
- * Stop recording and flush remaining events
48
- */
49
- stop(): void;
50
- /**
51
- * Handle incoming event from rrweb
52
- */
53
- private handleEvent;
54
- /**
55
- * Flush current batch of events
56
- */
57
- private flushBatch;
58
- /**
59
- * Start periodic batch flushing
60
- */
61
- private startBatchTimer;
62
- /**
63
- * Update activity metrics based on event
64
- */
65
- private updateActivityMetrics;
66
- /**
67
- * Calculate activity level (0-1)
68
- */
69
- private calculateActivityLevel;
70
- /**
71
- * Adjust sampling rate based on activity
72
- */
73
- private adjustSamplingRate;
74
- /**
75
- * Get sampling configuration based on quality
76
- */
77
- private getSamplingConfig;
78
- /**
79
- * Get slimDOM options based on quality
80
- */
81
- private getSlimDOMOptions;
82
- /**
83
- * Get current recording stats
84
- */
85
- getStats(): {
86
- isRecording: boolean;
87
- sessionId: string;
88
- duration: number;
89
- bufferedEvents: number;
90
- chunksSent: number;
91
- activityLevel: number;
92
- currentSamplingRate: number;
93
- };
94
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * CheckFlow Privacy Detector
3
- * Regex patterns for detecting PII (Personally Identifiable Information)
4
- */
5
- import { Detection, CustomPattern } from './types';
6
- export declare const PATTERNS: Record<string, RegExp>;
7
- export declare class PrivacyDetector {
8
- private customPatterns;
9
- constructor(customPatterns?: CustomPattern[]);
10
- /**
11
- * Add a custom pattern
12
- */
13
- addPattern(pattern: CustomPattern): void;
14
- /**
15
- * Detect all PII in a text string
16
- */
17
- detectAll(text: string, options?: {
18
- emails?: boolean;
19
- creditCards?: boolean;
20
- phoneNumbers?: boolean;
21
- ssn?: boolean;
22
- ipAddresses?: boolean;
23
- }): Detection[];
24
- /**
25
- * Detect email addresses
26
- */
27
- detectEmails(text: string): Detection[];
28
- /**
29
- * Detect credit card numbers
30
- */
31
- detectCreditCards(text: string): Detection[];
32
- /**
33
- * Detect phone numbers
34
- */
35
- detectPhoneNumbers(text: string): Detection[];
36
- /**
37
- * Detect Social Security Numbers
38
- */
39
- detectSSN(text: string): Detection[];
40
- /**
41
- * Detect IP addresses
42
- */
43
- detectIPAddresses(text: string): Detection[];
44
- /**
45
- * Detect custom pattern
46
- */
47
- detectCustom(text: string, pattern: CustomPattern): Detection[];
48
- /**
49
- * Find all matches of a pattern in text
50
- */
51
- private findMatches;
52
- /**
53
- * Remove overlapping detections (keep the longer one)
54
- */
55
- private removeOverlaps;
56
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * CheckFlow Privacy Module
3
- * Automatic PII detection and masking for screenshots
4
- */
5
- export { PrivacyMasker } from './masker';
6
- export { PrivacyDetector, PATTERNS } from './detector';
7
- export type { PrivacyConfig, AutoMaskConfig, CustomPattern, MaskResult, Detection, DetectionType, DOMPrivacyResult, DOMDetection, } from './types';
8
- export { DEFAULT_PRIVACY_CONFIG, SENSITIVE_INPUT_TYPES, SENSITIVE_AUTOCOMPLETE_VALUES, } from './types';
@@ -1,43 +0,0 @@
1
- /**
2
- * CheckFlow Privacy Masker
3
- * Applies masking to detected PII in text and DOM elements
4
- */
5
- import { PrivacyConfig, MaskResult, DOMPrivacyResult } from './types';
6
- export declare class PrivacyMasker {
7
- private config;
8
- private detector;
9
- constructor(config?: Partial<PrivacyConfig>);
10
- /**
11
- * Update configuration
12
- */
13
- configure(config: Partial<PrivacyConfig>): void;
14
- /**
15
- * Mask PII in a text string
16
- */
17
- maskText(text: string): MaskResult;
18
- /**
19
- * Generate mask value for a detected PII
20
- */
21
- private getMaskValue;
22
- /**
23
- * Process DOM elements for privacy masking
24
- * Returns a cloned document with masked content
25
- */
26
- processDOM(doc: Document): DOMPrivacyResult;
27
- /**
28
- * Check if element should be excluded from masking
29
- */
30
- private isExcluded;
31
- /**
32
- * Check if input is a sensitive type
33
- */
34
- private isSensitiveInput;
35
- /**
36
- * Generate CSS selector for element
37
- */
38
- private getSelector;
39
- /**
40
- * Get current configuration
41
- */
42
- getConfig(): PrivacyConfig;
43
- }
@@ -1,54 +0,0 @@
1
- /**
2
- * CheckFlow Privacy Module Types
3
- * Configuration and types for automatic PII masking
4
- */
5
- export interface PrivacyConfig {
6
- enabled: boolean;
7
- autoMask: AutoMaskConfig;
8
- excludeSelectors: string[];
9
- includeSelectors: string[];
10
- maskChar: string;
11
- maskLength: 'preserve' | 'fixed';
12
- fixedMaskLength: number;
13
- }
14
- export interface AutoMaskConfig {
15
- emails: boolean;
16
- creditCards: boolean;
17
- phoneNumbers: boolean;
18
- passwords: boolean;
19
- socialSecurity: boolean;
20
- ipAddresses: boolean;
21
- customPatterns: CustomPattern[];
22
- }
23
- export interface CustomPattern {
24
- name: string;
25
- pattern: RegExp;
26
- replacement?: string;
27
- }
28
- export interface MaskResult {
29
- original: string;
30
- masked: string;
31
- detections: Detection[];
32
- }
33
- export interface Detection {
34
- type: DetectionType;
35
- value: string;
36
- masked: string;
37
- startIndex: number;
38
- endIndex: number;
39
- }
40
- export type DetectionType = 'email' | 'credit_card' | 'phone' | 'password' | 'ssn' | 'ip_address' | 'custom';
41
- export interface DOMPrivacyResult {
42
- elementsProcessed: number;
43
- elementsMasked: number;
44
- detections: DOMDetection[];
45
- }
46
- export interface DOMDetection {
47
- selector: string;
48
- type: DetectionType;
49
- originalText: string;
50
- maskedText: string;
51
- }
52
- export declare const DEFAULT_PRIVACY_CONFIG: PrivacyConfig;
53
- export declare const SENSITIVE_INPUT_TYPES: string[];
54
- export declare const SENSITIVE_AUTOCOMPLETE_VALUES: string[];
@@ -1,77 +0,0 @@
1
- /**
2
- * CheckFlow React Integration
3
- * Provides React hooks, components, and error boundary
4
- */
5
- import React, { ReactNode, Component, ErrorInfo as ReactErrorInfo } from 'react';
6
- import { CheckFlow } from '../checkflow';
7
- import { CheckFlowOptions, FeedbackData, CaptureResult, SubmitResult, UserInfo, FeedbackType, FeedbackPriority } from '../types';
8
- interface CheckFlowContextValue {
9
- checkflow: CheckFlow | null;
10
- isReady: boolean;
11
- capture: () => Promise<CaptureResult | null>;
12
- submitFeedback: (feedback: FeedbackData) => Promise<SubmitResult>;
13
- openWidget: () => void;
14
- closeWidget: () => void;
15
- setUser: (user: UserInfo) => void;
16
- clearUser: () => void;
17
- }
18
- interface CheckFlowProviderProps {
19
- apiKey: string;
20
- options?: Omit<CheckFlowOptions, 'apiKey'>;
21
- children: ReactNode;
22
- }
23
- export declare function CheckFlowProvider({ apiKey, options, children }: CheckFlowProviderProps): import("react/jsx-runtime").JSX.Element;
24
- export declare function useCheckFlow(): CheckFlowContextValue;
25
- interface UseFeedbackFormOptions {
26
- onSuccess?: (result: SubmitResult) => void;
27
- onError?: (error: Error) => void;
28
- defaultType?: FeedbackType;
29
- defaultPriority?: FeedbackPriority;
30
- }
31
- interface FeedbackFormState {
32
- title: string;
33
- description: string;
34
- type: FeedbackType;
35
- priority: FeedbackPriority;
36
- includeScreenshot: boolean;
37
- includeConsoleLogs: boolean;
38
- includeNetworkLogs: boolean;
39
- }
40
- export declare function useFeedbackForm(options?: UseFeedbackFormOptions): {
41
- formState: FeedbackFormState;
42
- updateField: <K extends keyof FeedbackFormState>(field: K, value: FeedbackFormState[K]) => void;
43
- screenshot: string | null;
44
- captureScreenshot: () => Promise<CaptureResult | null>;
45
- submit: () => Promise<SubmitResult | null>;
46
- reset: () => void;
47
- isSubmitting: boolean;
48
- error: string | null;
49
- };
50
- interface ErrorBoundaryProps {
51
- children: ReactNode;
52
- fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
53
- onError?: (error: Error, errorInfo: ReactErrorInfo) => void;
54
- reportToCheckFlow?: boolean;
55
- }
56
- interface ErrorBoundaryState {
57
- hasError: boolean;
58
- error: Error | null;
59
- }
60
- export declare class CheckFlowErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
61
- constructor(props: ErrorBoundaryProps);
62
- static getDerivedStateFromError(error: Error): ErrorBoundaryState;
63
- componentDidCatch(error: Error, errorInfo: ReactErrorInfo): void;
64
- reset: () => void;
65
- render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
66
- }
67
- export declare function withCheckFlow<P extends object>(WrappedComponent: React.ComponentType<P & {
68
- checkflow: CheckFlowContextValue;
69
- }>): (props: P) => import("react/jsx-runtime").JSX.Element;
70
- export declare function withErrorBoundary<P extends object>(WrappedComponent: React.ComponentType<P>, errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>): (props: P) => import("react/jsx-runtime").JSX.Element;
71
- interface FeedbackButtonProps {
72
- children?: ReactNode;
73
- className?: string;
74
- style?: React.CSSProperties;
75
- }
76
- export declare function FeedbackButton({ children, className, style }: FeedbackButtonProps): import("react/jsx-runtime").JSX.Element;
77
- export type { CheckFlowOptions, FeedbackData, CaptureResult, SubmitResult, UserInfo, FeedbackType, FeedbackPriority, };
@@ -1,100 +0,0 @@
1
- /**
2
- * Session Recording Module with RRWeb Integration
3
- * Records user interactions exactly like Mixpanel does
4
- */
5
- import type { eventWithTime } from '@rrweb/types';
6
- export interface SessionRecordingConfig {
7
- enabled: boolean;
8
- maskAllInputs: boolean;
9
- maskInputOptions: {
10
- color: string;
11
- textClass: string;
12
- colorClass: string;
13
- };
14
- maskInputFn?: (text: string, element?: HTMLElement) => string;
15
- maskTextFn?: (text: string, element?: HTMLElement) => string;
16
- blockClass?: string;
17
- blockSelector?: string;
18
- ignoreClass?: string;
19
- maskTextClass?: string;
20
- maskTextSelector?: string;
21
- maskAllText?: boolean;
22
- slimDOMOptions?: {
23
- script?: boolean;
24
- comment?: boolean;
25
- headFavicon?: boolean;
26
- headWhitespace?: boolean;
27
- headMetaDescKeywords?: boolean;
28
- headMetaSocial?: boolean;
29
- headMetaRobots?: boolean;
30
- headMetaHttpEquiv?: boolean;
31
- headMetaAuthorship?: boolean;
32
- headMetaVerification?: boolean;
33
- };
34
- recordCanvas?: boolean;
35
- collectFonts?: boolean;
36
- plugins?: any[];
37
- sampling?: {
38
- mousemove?: boolean | number;
39
- mouseInteraction?: boolean | number;
40
- scroll?: boolean | number;
41
- media?: number;
42
- input?: 'all' | 'last';
43
- };
44
- }
45
- export declare class SessionRecordingRRWeb {
46
- private config;
47
- private events;
48
- private sessionId;
49
- private startTime;
50
- private isRecording;
51
- private stopFn;
52
- private recordingOptions;
53
- constructor(config?: Partial<SessionRecordingConfig>);
54
- private generateSessionId;
55
- private setupRecordingOptions;
56
- /**
57
- * Start recording using RRWeb
58
- */
59
- start(): void;
60
- /**
61
- * Stop recording
62
- */
63
- stop(): void;
64
- /**
65
- * Get session ID
66
- */
67
- getSessionId(): string;
68
- /**
69
- * Get recorded events (RRWeb format)
70
- */
71
- getEvents(): eventWithTime[];
72
- /**
73
- * Get recording duration in milliseconds
74
- */
75
- getDurationMs(): number;
76
- /**
77
- * Get recording duration in seconds
78
- */
79
- getDuration(): number;
80
- /**
81
- * Clear events (for chunked uploads)
82
- */
83
- clearEvents(): void;
84
- /**
85
- * Get events since last clear (for incremental uploads)
86
- */
87
- getEventsSinceLast(count?: number): eventWithTime[];
88
- /**
89
- * Get recording data for submission (compatible with backend)
90
- */
91
- getRecordingData(): {
92
- events: eventWithTime[];
93
- sessionId: string;
94
- duration: number;
95
- } | null;
96
- /**
97
- * Check if currently recording
98
- */
99
- isCurrentlyRecording(): boolean;
100
- }
@@ -1,74 +0,0 @@
1
- /**
2
- * Session Recording Module
3
- * Captures user interactions for replay
4
- */
5
- export interface RecordingEvent {
6
- type: 'mouse' | 'scroll' | 'input' | 'mutation' | 'navigation' | 'resize';
7
- timestamp: number;
8
- data: any;
9
- }
10
- export interface SessionRecordingConfig {
11
- enabled: boolean;
12
- recordMouse: boolean;
13
- recordScroll: boolean;
14
- recordInput: boolean;
15
- recordMutations: boolean;
16
- maskInputs: boolean;
17
- maskSelectors: string[];
18
- maxDurationSeconds: number;
19
- sampleRate: number;
20
- }
21
- export declare class SessionRecording {
22
- private config;
23
- private events;
24
- private sessionId;
25
- private startTime;
26
- private isRecording;
27
- private mutationObserver;
28
- private listeners;
29
- constructor(config?: Partial<SessionRecordingConfig>);
30
- private generateSessionId;
31
- /**
32
- * Start recording the session
33
- */
34
- start(): void;
35
- /**
36
- * Stop recording
37
- */
38
- stop(): void;
39
- /**
40
- * Get session ID
41
- */
42
- getSessionId(): string;
43
- /**
44
- * Get recorded events
45
- */
46
- getEvents(): RecordingEvent[];
47
- /**
48
- * Get recording duration in seconds
49
- */
50
- getDuration(): number;
51
- /**
52
- * Clear events (for chunked uploads)
53
- */
54
- clearEvents(): void;
55
- /**
56
- * Get recording data for submission
57
- */
58
- getRecordingData(): {
59
- events: RecordingEvent[];
60
- sessionId: string;
61
- duration: number;
62
- } | null;
63
- private addEvent;
64
- private recordSnapshot;
65
- private setupMouseTracking;
66
- private setupScrollTracking;
67
- private setupInputTracking;
68
- private setupMutationObserver;
69
- private setupNavigationTracking;
70
- private setupResizeTracking;
71
- private getElementSelector;
72
- private isSensitiveElement;
73
- private sanitizeHTML;
74
- }