@zaplier/sdk 1.7.4 โ 1.7.5
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.cjs +58 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +58 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/sdk.js +58 -21
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.min.js +1 -1
- package/dist/src/modules/auto-tracker.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/sdk.js
CHANGED
|
@@ -19576,27 +19576,52 @@
|
|
|
19576
19576
|
if (this.config.trackScrolls) {
|
|
19577
19577
|
const scrollHandler = this.createEnhancedScrollHandler();
|
|
19578
19578
|
this.delegationHandlers.set('scroll', scrollHandler);
|
|
19579
|
-
//
|
|
19580
|
-
|
|
19579
|
+
// MAJOR FIX: Use window instead of document for scroll events
|
|
19580
|
+
// Document doesn't reliably receive scroll events in all browsers
|
|
19581
|
+
const scrollTarget = window;
|
|
19582
|
+
const scrollOptions = {
|
|
19583
|
+
passive: false, // Changed from passive: true to ensure handler executes
|
|
19584
|
+
capture: false
|
|
19585
|
+
};
|
|
19586
|
+
scrollTarget.addEventListener('scroll', scrollHandler, scrollOptions);
|
|
19587
|
+
// Also add to document as backup (some scenarios need both)
|
|
19588
|
+
document.addEventListener('scroll', scrollHandler, scrollOptions);
|
|
19581
19589
|
if (this.config.debug) {
|
|
19582
|
-
console.log("[๐ AutoTracker] โ
Scroll delegation handler added to document");
|
|
19590
|
+
console.log("[๐ AutoTracker] โ
Scroll delegation handler added to BOTH window AND document");
|
|
19583
19591
|
console.log("[๐ AutoTracker] ๐ Event listener details:", {
|
|
19584
|
-
|
|
19592
|
+
primaryTarget: 'window',
|
|
19593
|
+
backupTarget: 'document',
|
|
19585
19594
|
eventType: 'scroll',
|
|
19586
19595
|
handlerType: typeof scrollHandler,
|
|
19587
|
-
options:
|
|
19596
|
+
options: scrollOptions,
|
|
19588
19597
|
handlerStored: this.delegationHandlers.has('scroll')
|
|
19589
19598
|
});
|
|
19590
|
-
//
|
|
19599
|
+
// Enhanced test function with real scroll simulation
|
|
19591
19600
|
const testHandler = () => {
|
|
19592
19601
|
console.log("[๐ AutoTracker] ๐งช MANUAL SCROLL TEST - Handler should trigger");
|
|
19593
19602
|
scrollHandler(new Event('scroll'));
|
|
19594
19603
|
};
|
|
19595
|
-
|
|
19604
|
+
const testRealScroll = () => {
|
|
19605
|
+
console.log("[๐ AutoTracker] ๐งช TESTING REAL SCROLL EVENT");
|
|
19606
|
+
window.scrollBy(0, 1); // Trigger real scroll
|
|
19607
|
+
setTimeout(() => {
|
|
19608
|
+
window.scrollBy(0, -1); // Scroll back
|
|
19609
|
+
}, 100);
|
|
19610
|
+
};
|
|
19611
|
+
// Expose test functions globally for manual testing
|
|
19596
19612
|
if (typeof window !== 'undefined') {
|
|
19597
19613
|
window.testScrollHandler = testHandler;
|
|
19598
|
-
|
|
19614
|
+
window.testRealScroll = testRealScroll;
|
|
19615
|
+
console.log("[๐ AutoTracker] ๐งช Manual tests available:");
|
|
19616
|
+
console.log("[๐ AutoTracker] ๐งช - window.testScrollHandler() (direct handler test)");
|
|
19617
|
+
console.log("[๐ AutoTracker] ๐งช - window.testRealScroll() (real scroll test)");
|
|
19599
19618
|
}
|
|
19619
|
+
// Add debug listener to verify scroll events are firing
|
|
19620
|
+
const debugScrollListener = () => {
|
|
19621
|
+
console.log("[๐ AutoTracker] ๐ DEBUG: Real scroll event detected!");
|
|
19622
|
+
};
|
|
19623
|
+
window.addEventListener('scroll', debugScrollListener, { once: true });
|
|
19624
|
+
console.log("[๐ AutoTracker] ๐ Debug scroll listener added (will fire once on next scroll)");
|
|
19600
19625
|
// Immediate test of element detection
|
|
19601
19626
|
setTimeout(() => {
|
|
19602
19627
|
const scrollElements = this.getCachedScrollElements();
|
|
@@ -19613,16 +19638,11 @@
|
|
|
19613
19638
|
});
|
|
19614
19639
|
});
|
|
19615
19640
|
}
|
|
19616
|
-
//
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
setTimeout(() => {
|
|
19622
|
-
console.log("[๐ AutoTracker] ๐งช Manual trigger test executed");
|
|
19623
|
-
}, 500);
|
|
19624
|
-
}
|
|
19625
|
-
}
|
|
19641
|
+
// Test auto-scroll detection
|
|
19642
|
+
setTimeout(() => {
|
|
19643
|
+
console.log("[๐ AutoTracker] ๐งช Auto-testing scroll detection in 1 second...");
|
|
19644
|
+
testRealScroll();
|
|
19645
|
+
}, 1000);
|
|
19626
19646
|
}, 100);
|
|
19627
19647
|
}
|
|
19628
19648
|
}
|
|
@@ -20036,11 +20056,25 @@
|
|
|
20036
20056
|
*/
|
|
20037
20057
|
stop() {
|
|
20038
20058
|
if (this.config.debug) {
|
|
20039
|
-
console.log('[AutoTracker] Stopping auto tracking and cleaning up...');
|
|
20059
|
+
console.log('[๐ AutoTracker] Stopping enhanced auto tracking and cleaning up...');
|
|
20040
20060
|
}
|
|
20041
|
-
// Remove delegation handlers
|
|
20061
|
+
// Remove delegation handlers from correct targets
|
|
20042
20062
|
this.delegationHandlers.forEach((handler, eventType) => {
|
|
20043
|
-
|
|
20063
|
+
if (eventType === 'click') {
|
|
20064
|
+
const delegationTarget = this.getOptimalDelegationTarget();
|
|
20065
|
+
delegationTarget.removeEventListener('click', handler);
|
|
20066
|
+
}
|
|
20067
|
+
else if (eventType === 'scroll') {
|
|
20068
|
+
// Remove from both window and document (as we added to both)
|
|
20069
|
+
window.removeEventListener('scroll', handler);
|
|
20070
|
+
document.removeEventListener('scroll', handler);
|
|
20071
|
+
if (this.config.debug) {
|
|
20072
|
+
console.log('[๐ AutoTracker] Removed scroll listeners from window and document');
|
|
20073
|
+
}
|
|
20074
|
+
}
|
|
20075
|
+
else {
|
|
20076
|
+
document.removeEventListener(eventType, handler);
|
|
20077
|
+
}
|
|
20044
20078
|
});
|
|
20045
20079
|
this.delegationHandlers.clear();
|
|
20046
20080
|
// Disconnect observers
|
|
@@ -20055,6 +20089,9 @@
|
|
|
20055
20089
|
// Clear caches
|
|
20056
20090
|
this.observedElements.clear();
|
|
20057
20091
|
this.isInitialized = false;
|
|
20092
|
+
if (this.config.debug) {
|
|
20093
|
+
console.log('[๐ AutoTracker] Enhanced cleanup completed');
|
|
20094
|
+
}
|
|
20058
20095
|
}
|
|
20059
20096
|
/**
|
|
20060
20097
|
* Legacy method - now handled by intelligent mutation observer
|