@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.
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/collectors/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,QAAQ,CAAS;gBAGf,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS;IAG9B;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA4CxE"}
1
+ {"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/collectors/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,QAAQ,CAAS;gBAGf,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS;IAG9B;;OAEG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA+ExE"}
@@ -8933,14 +8933,30 @@ class ScreenshotCollector {
8933
8933
  if (this.config.debug) {
8934
8934
  console.log('[DevSkin] Capturing page screenshot...');
8935
8935
  }
8936
- const canvas = yield html2canvas(document.body, {
8936
+ // Scroll to top before capturing
8937
+ const originalScrollY = window.scrollY;
8938
+ window.scrollTo(0, 0);
8939
+ // Wait for scroll to complete
8940
+ yield new Promise(resolve => setTimeout(resolve, 100));
8941
+ // Get full page dimensions
8942
+ const fullWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth);
8943
+ const fullHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
8944
+ const canvas = yield html2canvas(document.documentElement, {
8937
8945
  allowTaint: true,
8938
8946
  useCORS: true,
8939
8947
  logging: false,
8940
8948
  scale: 0.5, // Reduce size
8941
- width: window.innerWidth,
8942
- height: Math.min(document.documentElement.scrollHeight, 3000), // Max 3000px height
8949
+ width: fullWidth,
8950
+ height: fullHeight,
8951
+ windowWidth: fullWidth,
8952
+ windowHeight: fullHeight,
8953
+ scrollY: 0,
8954
+ scrollX: 0,
8955
+ x: 0,
8956
+ y: 0,
8943
8957
  });
8958
+ // Restore scroll position
8959
+ window.scrollTo(0, originalScrollY);
8944
8960
  // Convert to base64 JPEG (smaller than PNG)
8945
8961
  const screenshot = canvas.toDataURL('image/jpeg', 0.6);
8946
8962
  // Send to backend