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