@devskin/browser-sdk 1.0.22 → 1.0.24

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.
@@ -8929,14 +8929,30 @@ class ScreenshotCollector {
8929
8929
  if (this.config.debug) {
8930
8930
  console.log('[DevSkin] Capturing page screenshot...');
8931
8931
  }
8932
- const canvas = yield html2canvas(document.body, {
8932
+ // Scroll to top before capturing
8933
+ const originalScrollY = window.scrollY;
8934
+ window.scrollTo(0, 0);
8935
+ // Wait for scroll to complete
8936
+ yield new Promise(resolve => setTimeout(resolve, 100));
8937
+ // Get full page dimensions
8938
+ const fullWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth);
8939
+ const fullHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
8940
+ const canvas = yield html2canvas(document.documentElement, {
8933
8941
  allowTaint: true,
8934
8942
  useCORS: true,
8935
8943
  logging: false,
8936
8944
  scale: 0.5, // Reduce size
8937
- width: window.innerWidth,
8938
- height: Math.min(document.documentElement.scrollHeight, 3000), // Max 3000px height
8945
+ width: fullWidth,
8946
+ height: fullHeight,
8947
+ windowWidth: fullWidth,
8948
+ windowHeight: fullHeight,
8949
+ scrollY: 0,
8950
+ scrollX: 0,
8951
+ x: 0,
8952
+ y: 0,
8939
8953
  });
8954
+ // Restore scroll position
8955
+ window.scrollTo(0, originalScrollY);
8940
8956
  // Convert to base64 JPEG (smaller than PNG)
8941
8957
  const screenshot = canvas.toDataURL('image/jpeg', 0.6);
8942
8958
  // Send to backend