@checkflow/sdk 1.0.2 → 1.0.3
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.esm.js +53 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2708,6 +2708,10 @@ class SessionRecording {
|
|
|
2708
2708
|
start() {
|
|
2709
2709
|
if (this.isRecording || !this.config.enabled)
|
|
2710
2710
|
return;
|
|
2711
|
+
console.log(' [SessionRecording] Starting session recording...', {
|
|
2712
|
+
sessionId: this.sessionId,
|
|
2713
|
+
config: this.config
|
|
2714
|
+
});
|
|
2711
2715
|
this.isRecording = true;
|
|
2712
2716
|
this.startTime = Date.now();
|
|
2713
2717
|
this.events = [];
|
|
@@ -2716,20 +2720,25 @@ class SessionRecording {
|
|
|
2716
2720
|
// Setup event listeners
|
|
2717
2721
|
if (this.config.recordMouse) {
|
|
2718
2722
|
this.setupMouseTracking();
|
|
2723
|
+
console.log(' [SessionRecording] Mouse tracking enabled');
|
|
2719
2724
|
}
|
|
2720
2725
|
if (this.config.recordScroll) {
|
|
2721
2726
|
this.setupScrollTracking();
|
|
2727
|
+
console.log(' [SessionRecording] Scroll tracking enabled');
|
|
2722
2728
|
}
|
|
2723
2729
|
if (this.config.recordInput) {
|
|
2724
2730
|
this.setupInputTracking();
|
|
2731
|
+
console.log(' [SessionRecording] Input tracking enabled');
|
|
2725
2732
|
}
|
|
2726
2733
|
if (this.config.recordMutations) {
|
|
2727
2734
|
this.setupMutationObserver();
|
|
2735
|
+
console.log(' [SessionRecording] Mutation observer enabled');
|
|
2728
2736
|
}
|
|
2729
2737
|
// Track navigation
|
|
2730
2738
|
this.setupNavigationTracking();
|
|
2731
2739
|
// Track resize
|
|
2732
2740
|
this.setupResizeTracking();
|
|
2741
|
+
console.log(' [SessionRecording] Session recording started successfully');
|
|
2733
2742
|
// Auto-stop after max duration
|
|
2734
2743
|
setTimeout(() => {
|
|
2735
2744
|
if (this.isRecording) {
|
|
@@ -2785,13 +2794,29 @@ class SessionRecording {
|
|
|
2785
2794
|
* Get recording data for submission
|
|
2786
2795
|
*/
|
|
2787
2796
|
getRecordingData() {
|
|
2788
|
-
|
|
2797
|
+
console.log('🎥 [SessionRecording] getRecordingData called:', {
|
|
2798
|
+
eventCount: this.events.length,
|
|
2799
|
+
sessionId: this.sessionId,
|
|
2800
|
+
duration: this.getDuration(),
|
|
2801
|
+
isRecording: this.isRecording,
|
|
2802
|
+
startTime: this.startTime
|
|
2803
|
+
});
|
|
2804
|
+
if (this.events.length === 0) {
|
|
2805
|
+
console.warn('🎥 [SessionRecording] No events to return');
|
|
2789
2806
|
return null;
|
|
2790
|
-
|
|
2807
|
+
}
|
|
2808
|
+
const data = {
|
|
2791
2809
|
events: [...this.events],
|
|
2792
2810
|
sessionId: this.sessionId,
|
|
2793
2811
|
duration: this.getDuration(),
|
|
2794
2812
|
};
|
|
2813
|
+
console.log('🎥 [SessionRecording] Returning recording data:', {
|
|
2814
|
+
eventCount: data.events.length,
|
|
2815
|
+
duration: data.duration,
|
|
2816
|
+
firstEventType: data.events[0]?.type,
|
|
2817
|
+
lastEventType: data.events[data.events.length - 1]?.type
|
|
2818
|
+
});
|
|
2819
|
+
return data;
|
|
2795
2820
|
}
|
|
2796
2821
|
addEvent(type, data) {
|
|
2797
2822
|
// Sample rate filtering
|
|
@@ -3628,29 +3653,51 @@ class AnalyticsTracker {
|
|
|
3628
3653
|
async saveSessionRecording() {
|
|
3629
3654
|
// Get session recording from global CheckFlow instance if available
|
|
3630
3655
|
try {
|
|
3656
|
+
console.log('🎬 [AnalyticsTracker] Starting saveSessionRecording for session:', this.sessionId);
|
|
3631
3657
|
const checkflowInstance = window.checkflow;
|
|
3658
|
+
console.log('🎬 [AnalyticsTracker] CheckFlow instance found:', !!checkflowInstance);
|
|
3659
|
+
console.log('🎬 [AnalyticsTracker] SessionRecording instance found:', !!checkflowInstance?.sessionRecording);
|
|
3632
3660
|
if (!checkflowInstance || !checkflowInstance.sessionRecording) {
|
|
3661
|
+
console.warn('🎬 [AnalyticsTracker] No session recording available - instance missing');
|
|
3633
3662
|
this.log('No session recording available');
|
|
3634
3663
|
return;
|
|
3635
3664
|
}
|
|
3636
3665
|
const recordingData = checkflowInstance.sessionRecording.getRecordingData();
|
|
3666
|
+
console.log('🎬 [AnalyticsTracker] Recording data retrieved:', {
|
|
3667
|
+
hasData: !!recordingData,
|
|
3668
|
+
eventCount: recordingData?.events?.length || 0,
|
|
3669
|
+
duration: recordingData?.duration || 0,
|
|
3670
|
+
sessionId: recordingData?.sessionId
|
|
3671
|
+
});
|
|
3637
3672
|
if (!recordingData || recordingData.events.length === 0) {
|
|
3673
|
+
console.warn('🎬 [AnalyticsTracker] No recording events to save - events array empty');
|
|
3638
3674
|
this.log('No recording events to save');
|
|
3639
3675
|
return;
|
|
3640
3676
|
}
|
|
3641
3677
|
// Save recording to analytics backend
|
|
3642
|
-
|
|
3678
|
+
console.log('🎬 [AnalyticsTracker] Saving recording to backend...', {
|
|
3679
|
+
sessionId: this.sessionId,
|
|
3680
|
+
eventCount: recordingData.events.length,
|
|
3681
|
+
durationMs: recordingData.duration * 1000
|
|
3682
|
+
});
|
|
3683
|
+
const result = await this.apiClient.saveSessionRecording({
|
|
3643
3684
|
events: recordingData.events,
|
|
3644
3685
|
sessionId: this.sessionId,
|
|
3645
3686
|
durationMs: recordingData.duration * 1000
|
|
3646
3687
|
});
|
|
3688
|
+
console.log('🎬 [AnalyticsTracker] Session recording saved successfully:', result);
|
|
3647
3689
|
this.log('Session recording saved:', {
|
|
3648
3690
|
eventCount: recordingData.events.length,
|
|
3649
3691
|
duration: recordingData.duration
|
|
3650
3692
|
});
|
|
3651
3693
|
}
|
|
3652
3694
|
catch (error) {
|
|
3653
|
-
console.error('Failed to save session recording:', error);
|
|
3695
|
+
console.error('🎬 [AnalyticsTracker] Failed to save session recording:', error);
|
|
3696
|
+
console.error('🎬 [AnalyticsTracker] Error details:', {
|
|
3697
|
+
message: error instanceof Error ? error.message : String(error),
|
|
3698
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
3699
|
+
sessionId: this.sessionId
|
|
3700
|
+
});
|
|
3654
3701
|
}
|
|
3655
3702
|
}
|
|
3656
3703
|
// ==================== Private Methods - Session Management ====================
|
|
@@ -4075,6 +4122,8 @@ class CheckFlow {
|
|
|
4075
4122
|
}
|
|
4076
4123
|
// Store as singleton
|
|
4077
4124
|
CheckFlow.instance = this;
|
|
4125
|
+
// Expose globally for analytics tracker access
|
|
4126
|
+
window.checkflow = this;
|
|
4078
4127
|
}
|
|
4079
4128
|
/**
|
|
4080
4129
|
* Initialize the SDK
|