@devskin/browser-sdk 1.0.16 → 1.0.18

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":"heatmap.d.ts","sourceRoot":"","sources":["../../src/collectors/heatmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkCzC,qBAAa,gBAAgB;IASzB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IATnB,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,aAAa,CAA+C;IACpE,OAAO,CAAC,iBAAiB,CAAO;gBAGtB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS;IAG9B,KAAK,IAAI,IAAI;IAoCb,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,WAAW;IA8CnB,OAAO,CAAC,gBAAgB;IA2CxB,OAAO,CAAC,kBAAkB;IAkC1B,OAAO,CAAC,KAAK;IA0Bb,OAAO,CAAC,kBAAkB;CAc3B"}
1
+ {"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/collectors/heatmap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkCzC,qBAAa,gBAAgB;IASzB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IATnB,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,aAAa,CAA+C;IACpE,OAAO,CAAC,iBAAiB,CAAO;gBAGtB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS;IAG9B,KAAK,IAAI,IAAI;IAoCb,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,WAAW;IA8CnB,OAAO,CAAC,gBAAgB;IA2CxB,OAAO,CAAC,kBAAkB;IAkC1B,OAAO,CAAC,KAAK;IAmCb,OAAO,CAAC,kBAAkB;CAc3B"}
@@ -1036,24 +1036,24 @@ class HeatmapCollector {
1036
1036
  });
1037
1037
  }
1038
1038
  flush() {
1039
+ // Send clicks individually (backend expects one click event per item)
1039
1040
  if (this.clickData.length > 0) {
1040
- this.transport.sendHeatmapData({
1041
- type: 'clicks',
1042
- data: this.clickData,
1041
+ this.clickData.forEach(click => {
1042
+ this.transport.sendHeatmapData(Object.assign({ type: 'click' }, click));
1043
1043
  });
1044
1044
  this.clickData = [];
1045
1045
  }
1046
+ // Send scroll data individually
1046
1047
  if (this.scrollData.length > 0) {
1047
- this.transport.sendHeatmapData({
1048
- type: 'scroll',
1049
- data: this.scrollData,
1048
+ this.scrollData.forEach(scroll => {
1049
+ this.transport.sendHeatmapData(Object.assign({ type: 'scroll' }, scroll));
1050
1050
  });
1051
1051
  this.scrollData = [];
1052
1052
  }
1053
+ // Send mouse moves individually
1053
1054
  if (this.mouseMoveData.length > 0) {
1054
- this.transport.sendHeatmapData({
1055
- type: 'mousemove',
1056
- data: this.mouseMoveData,
1055
+ this.mouseMoveData.forEach(move => {
1056
+ this.transport.sendHeatmapData(Object.assign({ type: 'mousemove' }, move));
1057
1057
  });
1058
1058
  this.mouseMoveData = [];
1059
1059
  }
@@ -5954,12 +5954,17 @@ class DevSkinSDK {
5954
5954
  * Initialize the DevSkin SDK
5955
5955
  */
5956
5956
  init(config) {
5957
- var _a, _b;
5957
+ var _a, _b, _c, _d;
5958
5958
  if (this.initialized) {
5959
5959
  console.warn('[DevSkin] SDK already initialized');
5960
5960
  return;
5961
5961
  }
5962
- this.config = Object.assign({ debug: false, captureWebVitals: true, captureNetworkRequests: true, captureErrors: true, captureUserAgent: true, captureLocation: true, captureDevice: true }, config);
5962
+ this.config = Object.assign({ debug: false, captureWebVitals: true, captureNetworkRequests: true, captureErrors: true, captureUserAgent: true, captureLocation: true, captureDevice: true, heatmapOptions: {
5963
+ enabled: true,
5964
+ trackClicks: true,
5965
+ trackScroll: true,
5966
+ trackMouseMovement: false, // Disabled by default to avoid too much data
5967
+ } }, config);
5963
5968
  if (this.config.debug) {
5964
5969
  console.log('[DevSkin] Initializing SDK with config:', this.config);
5965
5970
  }
@@ -5986,12 +5991,20 @@ class DevSkinSDK {
5986
5991
  this.networkCollector.start();
5987
5992
  }
5988
5993
  // Initialize heatmap collector
5989
- if ((_a = this.config.heatmapOptions) === null || _a === void 0 ? void 0 : _a.enabled) {
5994
+ // Auto-enable heatmap if session recording is enabled
5995
+ 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);
5996
+ if (heatmapEnabled) {
5997
+ // Merge default heatmap config with user config
5998
+ const heatmapConfig = Object.assign({ enabled: true, trackClicks: true, trackScroll: true, trackMouseMovement: false }, this.config.heatmapOptions);
5999
+ this.config.heatmapOptions = heatmapConfig;
5990
6000
  this.heatmapCollector = new HeatmapCollector(this.config, this.transport);
5991
6001
  this.heatmapCollector.start();
6002
+ if (this.config.debug) {
6003
+ console.log('[DevSkin] Heatmap collection enabled', ((_c = this.config.sessionRecording) === null || _c === void 0 ? void 0 : _c.enabled) ? '(auto-enabled with session recording)' : '');
6004
+ }
5992
6005
  }
5993
6006
  // Initialize session recording with rrweb
5994
- if ((_b = this.config.sessionRecording) === null || _b === void 0 ? void 0 : _b.enabled) {
6007
+ if ((_d = this.config.sessionRecording) === null || _d === void 0 ? void 0 : _d.enabled) {
5995
6008
  // Use RRWebRecorder for complete DOM recording
5996
6009
  this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
5997
6010
  enabled: true,