@devskin/browser-sdk 1.0.23 → 1.0.25

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.
@@ -8935,21 +8935,30 @@
8935
8935
  if (this.config.debug) {
8936
8936
  console.log('[DevSkin] Capturing page screenshot...');
8937
8937
  }
8938
+ // Scroll to top before capturing
8939
+ const originalScrollY = window.scrollY;
8940
+ window.scrollTo(0, 0);
8941
+ // Wait for scroll to complete
8942
+ yield new Promise(resolve => setTimeout(resolve, 100));
8938
8943
  // Get full page dimensions
8939
8944
  const fullWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth);
8940
8945
  const fullHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);
8941
- const canvas = yield html2canvas(document.body, {
8946
+ const canvas = yield html2canvas(document.documentElement, {
8942
8947
  allowTaint: true,
8943
8948
  useCORS: true,
8944
8949
  logging: false,
8945
8950
  scale: 0.5, // Reduce size
8946
8951
  width: fullWidth,
8947
- height: fullHeight, // Capture ENTIRE page
8952
+ height: fullHeight,
8948
8953
  windowWidth: fullWidth,
8949
8954
  windowHeight: fullHeight,
8955
+ scrollY: 0,
8956
+ scrollX: 0,
8950
8957
  x: 0,
8951
8958
  y: 0,
8952
8959
  });
8960
+ // Restore scroll position
8961
+ window.scrollTo(0, originalScrollY);
8953
8962
  // Convert to base64 JPEG (smaller than PNG)
8954
8963
  const screenshot = canvas.toDataURL('image/jpeg', 0.6);
8955
8964
  // Send to backend
@@ -13864,7 +13873,7 @@
13864
13873
  * Initialize the DevSkin SDK
13865
13874
  */
13866
13875
  init(config) {
13867
- var _a, _b, _c, _d;
13876
+ var _a;
13868
13877
  if (this.initialized) {
13869
13878
  console.warn('[DevSkin] SDK already initialized');
13870
13879
  return;
@@ -13900,24 +13909,20 @@
13900
13909
  this.networkCollector = new NetworkCollector(this.config, this.transport);
13901
13910
  this.networkCollector.start();
13902
13911
  }
13903
- // Initialize heatmap collector
13904
- // Auto-enable heatmap if session recording is enabled
13905
- const heatmapEnabled = ((_a = this.config.heatmapOptions) === null || _a === void 0 ? void 0 : _a.enabled) || ((_b = this.config.sessionRecording) === null || _b === void 0 ? void 0 : _b.enabled);
13906
- if (heatmapEnabled) {
13907
- // Merge default heatmap config with user config
13908
- const heatmapConfig = Object.assign({ enabled: true, trackClicks: true, trackScroll: true, trackMouseMovement: true, mouseMoveSampling: 0.05 }, this.config.heatmapOptions);
13909
- this.config.heatmapOptions = heatmapConfig;
13910
- this.heatmapCollector = new HeatmapCollector(this.config, this.transport);
13911
- this.heatmapCollector.start();
13912
- // Initialize screenshot collector and capture page
13913
- this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
13914
- this.screenshotCollector.captureAndSend(this.sessionId, window.location.href);
13915
- if (this.config.debug) {
13916
- console.log('[DevSkin] Heatmap collection enabled', ((_c = this.config.sessionRecording) === null || _c === void 0 ? void 0 : _c.enabled) ? '(auto-enabled with session recording)' : '');
13917
- }
13912
+ // Initialize heatmap collector - SEMPRE habilitado
13913
+ // Merge default heatmap config with user config
13914
+ const heatmapConfig = Object.assign({ enabled: true, trackClicks: true, trackScroll: true, trackMouseMovement: true, mouseMoveSampling: 0.1 }, this.config.heatmapOptions);
13915
+ this.config.heatmapOptions = heatmapConfig;
13916
+ this.heatmapCollector = new HeatmapCollector(this.config, this.transport);
13917
+ this.heatmapCollector.start();
13918
+ // Initialize screenshot collector and capture page
13919
+ this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
13920
+ this.screenshotCollector.captureAndSend(this.sessionId, window.location.href);
13921
+ if (this.config.debug) {
13922
+ console.log('[DevSkin] Heatmap collection enabled (always on)');
13918
13923
  }
13919
13924
  // Initialize session recording with rrweb
13920
- if ((_d = this.config.sessionRecording) === null || _d === void 0 ? void 0 : _d.enabled) {
13925
+ if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
13921
13926
  // Use RRWebRecorder for complete DOM recording
13922
13927
  this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
13923
13928
  enabled: true,