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