@devskin/browser-sdk 1.0.38 → 1.0.40

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.
@@ -3,13 +3,15 @@ import { Transport } from '../transport';
3
3
  export declare class HeatmapCollector {
4
4
  private config;
5
5
  private transport;
6
+ private anonymousId;
7
+ private sessionId;
6
8
  private clickData;
7
9
  private scrollData;
8
10
  private mouseMoveData;
9
11
  private maxScrollDepth;
10
12
  private flushInterval;
11
13
  private mouseMoveSampling;
12
- constructor(config: DevSkinConfig, transport: Transport);
14
+ constructor(config: DevSkinConfig, transport: Transport, anonymousId: string, sessionId: string);
13
15
  start(): void;
14
16
  stop(): void;
15
17
  private trackClicks;
@@ -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;IAmCb,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;IACjB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,SAAS;IAXnB,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,EACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM;IAG3B,KAAK,IAAI,IAAI;IAoCb,IAAI,IAAI,IAAI;IAQZ,OAAO,CAAC,WAAW;IA8CnB,OAAO,CAAC,gBAAgB;IA2CxB,OAAO,CAAC,kBAAkB;IAkC1B,OAAO,CAAC,KAAK;IAyCb,OAAO,CAAC,kBAAkB;CAc3B"}
@@ -861,9 +861,11 @@ class NetworkCollector {
861
861
  }
862
862
 
863
863
  class HeatmapCollector {
864
- constructor(config, transport) {
864
+ constructor(config, transport, anonymousId, sessionId) {
865
865
  this.config = config;
866
866
  this.transport = transport;
867
+ this.anonymousId = anonymousId;
868
+ this.sessionId = sessionId;
867
869
  this.clickData = [];
868
870
  this.scrollData = [];
869
871
  this.mouseMoveData = [];
@@ -928,7 +930,7 @@ class HeatmapCollector {
928
930
  element: this.getElementSelector(target),
929
931
  elementId: target.id || undefined,
930
932
  elementClass: target.className || undefined,
931
- pageUrl: window.location.pathname,
933
+ pageUrl: window.location.href,
932
934
  timestamp: new Date().toISOString(),
933
935
  viewportWidth: window.innerWidth,
934
936
  viewportHeight: window.innerHeight,
@@ -956,7 +958,7 @@ class HeatmapCollector {
956
958
  maxDepth: this.maxScrollDepth,
957
959
  pageHeight: documentHeight,
958
960
  viewportHeight: windowHeight,
959
- pageUrl: window.location.pathname,
961
+ pageUrl: window.location.href,
960
962
  timestamp: new Date().toISOString(),
961
963
  };
962
964
  this.scrollData.push(scrollData);
@@ -993,7 +995,7 @@ class HeatmapCollector {
993
995
  const mouseMoveData = {
994
996
  x: event.clientX + window.scrollX,
995
997
  y: event.clientY + window.scrollY,
996
- pageUrl: window.location.pathname,
998
+ pageUrl: window.location.href,
997
999
  timestamp: new Date().toISOString(),
998
1000
  };
999
1001
  this.mouseMoveData.push(mouseMoveData);
@@ -1007,21 +1009,21 @@ class HeatmapCollector {
1007
1009
  // Send clicks individually (backend expects one click event per item)
1008
1010
  if (this.clickData.length > 0) {
1009
1011
  this.clickData.forEach(click => {
1010
- this.transport.sendHeatmapData(Object.assign({ type: 'click' }, click));
1012
+ this.transport.sendHeatmapData(Object.assign({ type: 'click', anonymousId: this.anonymousId, sessionId: this.sessionId }, click));
1011
1013
  });
1012
1014
  this.clickData = [];
1013
1015
  }
1014
1016
  // Send scroll data individually
1015
1017
  if (this.scrollData.length > 0) {
1016
1018
  this.scrollData.forEach(scroll => {
1017
- this.transport.sendHeatmapData(Object.assign({ type: 'scroll' }, scroll));
1019
+ this.transport.sendHeatmapData(Object.assign({ type: 'scroll', anonymousId: this.anonymousId, sessionId: this.sessionId }, scroll));
1018
1020
  });
1019
1021
  this.scrollData = [];
1020
1022
  }
1021
1023
  // Send mouse moves individually
1022
1024
  if (this.mouseMoveData.length > 0) {
1023
1025
  this.mouseMoveData.forEach(move => {
1024
- this.transport.sendHeatmapData(Object.assign({ type: 'mousemove' }, move));
1026
+ this.transport.sendHeatmapData(Object.assign({ type: 'mousemove', anonymousId: this.anonymousId, sessionId: this.sessionId }, move));
1025
1027
  });
1026
1028
  this.mouseMoveData = [];
1027
1029
  }
@@ -13935,12 +13937,11 @@ class DevSkinSDK {
13935
13937
  // Merge default heatmap config with user config
13936
13938
  const heatmapConfig = Object.assign({ enabled: true, trackClicks: true, trackScroll: true, trackMouseMovement: true, mouseMoveSampling: 0.1 }, this.config.heatmapOptions);
13937
13939
  this.config.heatmapOptions = heatmapConfig;
13938
- this.heatmapCollector = new HeatmapCollector(this.config, this.transport);
13940
+ this.heatmapCollector = new HeatmapCollector(this.config, this.transport, this.anonymousId, this.sessionId);
13939
13941
  this.heatmapCollector.start();
13940
13942
  // Initialize screenshot collector and capture page
13941
13943
  this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
13942
- // Send only the pathname (not full URL) for consistent hashing
13943
- this.screenshotCollector.captureAndSend(this.sessionId, window.location.pathname);
13944
+ this.screenshotCollector.captureAndSend(this.sessionId, window.location.href);
13944
13945
  if (this.config.debug) {
13945
13946
  console.log('[DevSkin] Heatmap collection enabled (always on)');
13946
13947
  }
@@ -14011,7 +14012,7 @@ class DevSkinSDK {
14011
14012
  userId: this.userId || undefined,
14012
14013
  anonymousId: this.anonymousId || undefined,
14013
14014
  properties: Object.assign(Object.assign({}, properties), this.getContextData()),
14014
- pageUrl: window.location.pathname,
14015
+ pageUrl: window.location.href,
14015
14016
  pageTitle: document.title,
14016
14017
  };
14017
14018
  (_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendEvent(eventData);