@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/index.esm.js
CHANGED
|
@@ -19570,27 +19570,52 @@ class AutoTracker {
|
|
|
19570
19570
|
if (this.config.trackScrolls) {
|
|
19571
19571
|
const scrollHandler = this.createEnhancedScrollHandler();
|
|
19572
19572
|
this.delegationHandlers.set('scroll', scrollHandler);
|
|
19573
|
-
//
|
|
19574
|
-
|
|
19573
|
+
// MAJOR FIX: Use window instead of document for scroll events
|
|
19574
|
+
// Document doesn't reliably receive scroll events in all browsers
|
|
19575
|
+
const scrollTarget = window;
|
|
19576
|
+
const scrollOptions = {
|
|
19577
|
+
passive: false, // Changed from passive: true to ensure handler executes
|
|
19578
|
+
capture: false
|
|
19579
|
+
};
|
|
19580
|
+
scrollTarget.addEventListener('scroll', scrollHandler, scrollOptions);
|
|
19581
|
+
// Also add to document as backup (some scenarios need both)
|
|
19582
|
+
document.addEventListener('scroll', scrollHandler, scrollOptions);
|
|
19575
19583
|
if (this.config.debug) {
|
|
19576
|
-
console.log("[๐ AutoTracker] โ
Scroll delegation handler added to document");
|
|
19584
|
+
console.log("[๐ AutoTracker] โ
Scroll delegation handler added to BOTH window AND document");
|
|
19577
19585
|
console.log("[๐ AutoTracker] ๐ Event listener details:", {
|
|
19578
|
-
|
|
19586
|
+
primaryTarget: 'window',
|
|
19587
|
+
backupTarget: 'document',
|
|
19579
19588
|
eventType: 'scroll',
|
|
19580
19589
|
handlerType: typeof scrollHandler,
|
|
19581
|
-
options:
|
|
19590
|
+
options: scrollOptions,
|
|
19582
19591
|
handlerStored: this.delegationHandlers.has('scroll')
|
|
19583
19592
|
});
|
|
19584
|
-
//
|
|
19593
|
+
// Enhanced test function with real scroll simulation
|
|
19585
19594
|
const testHandler = () => {
|
|
19586
19595
|
console.log("[๐ AutoTracker] ๐งช MANUAL SCROLL TEST - Handler should trigger");
|
|
19587
19596
|
scrollHandler(new Event('scroll'));
|
|
19588
19597
|
};
|
|
19589
|
-
|
|
19598
|
+
const testRealScroll = () => {
|
|
19599
|
+
console.log("[๐ AutoTracker] ๐งช TESTING REAL SCROLL EVENT");
|
|
19600
|
+
window.scrollBy(0, 1); // Trigger real scroll
|
|
19601
|
+
setTimeout(() => {
|
|
19602
|
+
window.scrollBy(0, -1); // Scroll back
|
|
19603
|
+
}, 100);
|
|
19604
|
+
};
|
|
19605
|
+
// Expose test functions globally for manual testing
|
|
19590
19606
|
if (typeof window !== 'undefined') {
|
|
19591
19607
|
window.testScrollHandler = testHandler;
|
|
19592
|
-
|
|
19608
|
+
window.testRealScroll = testRealScroll;
|
|
19609
|
+
console.log("[๐ AutoTracker] ๐งช Manual tests available:");
|
|
19610
|
+
console.log("[๐ AutoTracker] ๐งช - window.testScrollHandler() (direct handler test)");
|
|
19611
|
+
console.log("[๐ AutoTracker] ๐งช - window.testRealScroll() (real scroll test)");
|
|
19593
19612
|
}
|
|
19613
|
+
// Add debug listener to verify scroll events are firing
|
|
19614
|
+
const debugScrollListener = () => {
|
|
19615
|
+
console.log("[๐ AutoTracker] ๐ DEBUG: Real scroll event detected!");
|
|
19616
|
+
};
|
|
19617
|
+
window.addEventListener('scroll', debugScrollListener, { once: true });
|
|
19618
|
+
console.log("[๐ AutoTracker] ๐ Debug scroll listener added (will fire once on next scroll)");
|
|
19594
19619
|
// Immediate test of element detection
|
|
19595
19620
|
setTimeout(() => {
|
|
19596
19621
|
const scrollElements = this.getCachedScrollElements();
|
|
@@ -19607,16 +19632,11 @@ class AutoTracker {
|
|
|
19607
19632
|
});
|
|
19608
19633
|
});
|
|
19609
19634
|
}
|
|
19610
|
-
//
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
setTimeout(() => {
|
|
19616
|
-
console.log("[๐ AutoTracker] ๐งช Manual trigger test executed");
|
|
19617
|
-
}, 500);
|
|
19618
|
-
}
|
|
19619
|
-
}
|
|
19635
|
+
// Test auto-scroll detection
|
|
19636
|
+
setTimeout(() => {
|
|
19637
|
+
console.log("[๐ AutoTracker] ๐งช Auto-testing scroll detection in 1 second...");
|
|
19638
|
+
testRealScroll();
|
|
19639
|
+
}, 1000);
|
|
19620
19640
|
}, 100);
|
|
19621
19641
|
}
|
|
19622
19642
|
}
|
|
@@ -20030,11 +20050,25 @@ class AutoTracker {
|
|
|
20030
20050
|
*/
|
|
20031
20051
|
stop() {
|
|
20032
20052
|
if (this.config.debug) {
|
|
20033
|
-
console.log('[AutoTracker] Stopping auto tracking and cleaning up...');
|
|
20053
|
+
console.log('[๐ AutoTracker] Stopping enhanced auto tracking and cleaning up...');
|
|
20034
20054
|
}
|
|
20035
|
-
// Remove delegation handlers
|
|
20055
|
+
// Remove delegation handlers from correct targets
|
|
20036
20056
|
this.delegationHandlers.forEach((handler, eventType) => {
|
|
20037
|
-
|
|
20057
|
+
if (eventType === 'click') {
|
|
20058
|
+
const delegationTarget = this.getOptimalDelegationTarget();
|
|
20059
|
+
delegationTarget.removeEventListener('click', handler);
|
|
20060
|
+
}
|
|
20061
|
+
else if (eventType === 'scroll') {
|
|
20062
|
+
// Remove from both window and document (as we added to both)
|
|
20063
|
+
window.removeEventListener('scroll', handler);
|
|
20064
|
+
document.removeEventListener('scroll', handler);
|
|
20065
|
+
if (this.config.debug) {
|
|
20066
|
+
console.log('[๐ AutoTracker] Removed scroll listeners from window and document');
|
|
20067
|
+
}
|
|
20068
|
+
}
|
|
20069
|
+
else {
|
|
20070
|
+
document.removeEventListener(eventType, handler);
|
|
20071
|
+
}
|
|
20038
20072
|
});
|
|
20039
20073
|
this.delegationHandlers.clear();
|
|
20040
20074
|
// Disconnect observers
|
|
@@ -20049,6 +20083,9 @@ class AutoTracker {
|
|
|
20049
20083
|
// Clear caches
|
|
20050
20084
|
this.observedElements.clear();
|
|
20051
20085
|
this.isInitialized = false;
|
|
20086
|
+
if (this.config.debug) {
|
|
20087
|
+
console.log('[๐ AutoTracker] Enhanced cleanup completed');
|
|
20088
|
+
}
|
|
20052
20089
|
}
|
|
20053
20090
|
/**
|
|
20054
20091
|
* Legacy method - now handled by intelligent mutation observer
|