cryptique-sdk 1.2.13 → 1.2.15

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.
package/lib/cjs/index.js CHANGED
@@ -6781,8 +6781,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6781
6781
  if (clickCount >= 3) {
6782
6782
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6783
6783
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6784
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6785
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6784
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6785
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6786
6786
  EventsManager.trackAutoEvent('rage_click', {
6787
6787
  click_coordinates: { x: event.clientX, y: event.clientY },
6788
6788
  page_x: event.pageX,
@@ -6812,8 +6812,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6812
6812
  const clickElement = element;
6813
6813
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6814
6814
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6815
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6816
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6815
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6816
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6817
6817
 
6818
6818
  // Mark this click as potentially dead
6819
6819
  const clickId = `${now}_${Math.random().toString(36).substr(2, 9)}`;
@@ -6868,8 +6868,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6868
6868
  // Track regular click with enhanced data (viewport + page-relative for heatmaps)
6869
6869
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6870
6870
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6871
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6872
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6871
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6872
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6873
6873
  EventsManager.trackAutoEvent('element_click', {
6874
6874
  click_coordinates: { x: event.clientX, y: event.clientY },
6875
6875
  page_x: event.pageX,
@@ -6907,8 +6907,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6907
6907
  if (scrollDepth > maxScrollDepth) {
6908
6908
  maxScrollDepth = scrollDepth;
6909
6909
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6910
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6911
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6910
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6911
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6912
6912
  EventsManager.trackAutoEvent('page_scroll', {
6913
6913
  scroll_depth: scrollDepth,
6914
6914
  max_scroll_reached: maxScrollDepth,
@@ -6935,8 +6935,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6935
6935
  if (form.tagName === 'FORM') {
6936
6936
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6937
6937
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6938
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6939
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6938
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6939
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6940
6940
  const rect = form.getBoundingClientRect();
6941
6941
  const pageX = rect.left + scrollX;
6942
6942
  const pageY = rect.top + scrollY;
@@ -7926,6 +7926,50 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
7926
7926
  initializeSDK();
7927
7927
  }
7928
7928
 
7929
+ // ============================================================================
7930
+ // HEATMAP IFRAME BRIDGE
7931
+ // When the SDK-instrumented page is embedded inside the Cryptique heatmap
7932
+ // viewer iframe, report the full document height to the parent so the canvas
7933
+ // overlay can be sized correctly (cross-origin pages cannot be read directly).
7934
+ // ============================================================================
7935
+ if (window.self !== window.top) {
7936
+ const _sendHeatmapDimensions = () => {
7937
+ try {
7938
+ // Cap at 25 000 px — browser scroll-animation libraries can report 16 777 216 (2^24).
7939
+ const h = Math.min(
7940
+ Math.max(
7941
+ document.body ? document.body.scrollHeight : 0,
7942
+ document.documentElement ? document.documentElement.scrollHeight : 0
7943
+ ),
7944
+ 25000
7945
+ );
7946
+ if (h > 0) {
7947
+ window.parent.postMessage({ type: 'cryptique_heatmap_dimensions', document_height: h }, '*');
7948
+ }
7949
+ } catch (_) {}
7950
+ };
7951
+
7952
+ // Send once the DOM is fully painted (immediate — most accurate final height).
7953
+ if (document.readyState === 'complete') {
7954
+ _sendHeatmapDimensions();
7955
+ } else {
7956
+ window.addEventListener('load', _sendHeatmapDimensions);
7957
+ }
7958
+
7959
+ // Re-send whenever the page grows (lazy-loaded content, SPAs, accordions, etc.).
7960
+ // Debounced to 1 s so rapid DOM mutations during React hydration don't trigger
7961
+ // dozens of postMessages and repeated canvas re-renders.
7962
+ try {
7963
+ let _heatmapROTimer;
7964
+ const _debouncedSend = () => {
7965
+ clearTimeout(_heatmapROTimer);
7966
+ _heatmapROTimer = setTimeout(_sendHeatmapDimensions, 1000);
7967
+ };
7968
+ const _heatmapRO = new ResizeObserver(_debouncedSend);
7969
+ _heatmapRO.observe(document.documentElement);
7970
+ } catch (_) {}
7971
+ }
7972
+
7929
7973
  // ============================================================================
7930
7974
  // END OF SECTION 15
7931
7975
  // ============================================================================
package/lib/esm/index.js CHANGED
@@ -6779,8 +6779,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6779
6779
  if (clickCount >= 3) {
6780
6780
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6781
6781
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6782
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6783
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6782
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6783
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6784
6784
  EventsManager.trackAutoEvent('rage_click', {
6785
6785
  click_coordinates: { x: event.clientX, y: event.clientY },
6786
6786
  page_x: event.pageX,
@@ -6810,8 +6810,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6810
6810
  const clickElement = element;
6811
6811
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6812
6812
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6813
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6814
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6813
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6814
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6815
6815
 
6816
6816
  // Mark this click as potentially dead
6817
6817
  const clickId = `${now}_${Math.random().toString(36).substr(2, 9)}`;
@@ -6866,8 +6866,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6866
6866
  // Track regular click with enhanced data (viewport + page-relative for heatmaps)
6867
6867
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6868
6868
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6869
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6870
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6869
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6870
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6871
6871
  EventsManager.trackAutoEvent('element_click', {
6872
6872
  click_coordinates: { x: event.clientX, y: event.clientY },
6873
6873
  page_x: event.pageX,
@@ -6905,8 +6905,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6905
6905
  if (scrollDepth > maxScrollDepth) {
6906
6906
  maxScrollDepth = scrollDepth;
6907
6907
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6908
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6909
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6908
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6909
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6910
6910
  EventsManager.trackAutoEvent('page_scroll', {
6911
6911
  scroll_depth: scrollDepth,
6912
6912
  max_scroll_reached: maxScrollDepth,
@@ -6933,8 +6933,8 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
6933
6933
  if (form.tagName === 'FORM') {
6934
6934
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6935
6935
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6936
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6937
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6936
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6937
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6938
6938
  const rect = form.getBoundingClientRect();
6939
6939
  const pageX = rect.left + scrollX;
6940
6940
  const pageY = rect.top + scrollY;
@@ -7924,6 +7924,50 @@ if (window.Cryptique && window.Cryptique.initialized) ; else {
7924
7924
  initializeSDK();
7925
7925
  }
7926
7926
 
7927
+ // ============================================================================
7928
+ // HEATMAP IFRAME BRIDGE
7929
+ // When the SDK-instrumented page is embedded inside the Cryptique heatmap
7930
+ // viewer iframe, report the full document height to the parent so the canvas
7931
+ // overlay can be sized correctly (cross-origin pages cannot be read directly).
7932
+ // ============================================================================
7933
+ if (window.self !== window.top) {
7934
+ const _sendHeatmapDimensions = () => {
7935
+ try {
7936
+ // Cap at 25 000 px — browser scroll-animation libraries can report 16 777 216 (2^24).
7937
+ const h = Math.min(
7938
+ Math.max(
7939
+ document.body ? document.body.scrollHeight : 0,
7940
+ document.documentElement ? document.documentElement.scrollHeight : 0
7941
+ ),
7942
+ 25000
7943
+ );
7944
+ if (h > 0) {
7945
+ window.parent.postMessage({ type: 'cryptique_heatmap_dimensions', document_height: h }, '*');
7946
+ }
7947
+ } catch (_) {}
7948
+ };
7949
+
7950
+ // Send once the DOM is fully painted (immediate — most accurate final height).
7951
+ if (document.readyState === 'complete') {
7952
+ _sendHeatmapDimensions();
7953
+ } else {
7954
+ window.addEventListener('load', _sendHeatmapDimensions);
7955
+ }
7956
+
7957
+ // Re-send whenever the page grows (lazy-loaded content, SPAs, accordions, etc.).
7958
+ // Debounced to 1 s so rapid DOM mutations during React hydration don't trigger
7959
+ // dozens of postMessages and repeated canvas re-renders.
7960
+ try {
7961
+ let _heatmapROTimer;
7962
+ const _debouncedSend = () => {
7963
+ clearTimeout(_heatmapROTimer);
7964
+ _heatmapROTimer = setTimeout(_sendHeatmapDimensions, 1000);
7965
+ };
7966
+ const _heatmapRO = new ResizeObserver(_debouncedSend);
7967
+ _heatmapRO.observe(document.documentElement);
7968
+ } catch (_) {}
7969
+ }
7970
+
7927
7971
  // ============================================================================
7928
7972
  // END OF SECTION 15
7929
7973
  // ============================================================================
package/lib/umd/index.js CHANGED
@@ -6785,8 +6785,8 @@
6785
6785
  if (clickCount >= 3) {
6786
6786
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6787
6787
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6788
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6789
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6788
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6789
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6790
6790
  EventsManager.trackAutoEvent('rage_click', {
6791
6791
  click_coordinates: { x: event.clientX, y: event.clientY },
6792
6792
  page_x: event.pageX,
@@ -6816,8 +6816,8 @@
6816
6816
  const clickElement = element;
6817
6817
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6818
6818
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6819
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6820
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6819
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6820
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6821
6821
 
6822
6822
  // Mark this click as potentially dead
6823
6823
  const clickId = `${now}_${Math.random().toString(36).substr(2, 9)}`;
@@ -6872,8 +6872,8 @@
6872
6872
  // Track regular click with enhanced data (viewport + page-relative for heatmaps)
6873
6873
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6874
6874
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6875
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6876
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6875
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6876
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6877
6877
  EventsManager.trackAutoEvent('element_click', {
6878
6878
  click_coordinates: { x: event.clientX, y: event.clientY },
6879
6879
  page_x: event.pageX,
@@ -6911,8 +6911,8 @@
6911
6911
  if (scrollDepth > maxScrollDepth) {
6912
6912
  maxScrollDepth = scrollDepth;
6913
6913
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6914
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6915
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6914
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6915
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6916
6916
  EventsManager.trackAutoEvent('page_scroll', {
6917
6917
  scroll_depth: scrollDepth,
6918
6918
  max_scroll_reached: maxScrollDepth,
@@ -6939,8 +6939,8 @@
6939
6939
  if (form.tagName === 'FORM') {
6940
6940
  const scrollX = window.scrollX != null ? window.scrollX : window.pageXOffset;
6941
6941
  const scrollY = window.scrollY != null ? window.scrollY : window.pageYOffset;
6942
- const docHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
6943
- const docWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
6942
+ const docHeight = Math.min(Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), 25000);
6943
+ const docWidth = Math.min(Math.max(document.body.scrollWidth, document.documentElement.scrollWidth), 25000);
6944
6944
  const rect = form.getBoundingClientRect();
6945
6945
  const pageX = rect.left + scrollX;
6946
6946
  const pageY = rect.top + scrollY;
@@ -7930,6 +7930,50 @@
7930
7930
  initializeSDK();
7931
7931
  }
7932
7932
 
7933
+ // ============================================================================
7934
+ // HEATMAP IFRAME BRIDGE
7935
+ // When the SDK-instrumented page is embedded inside the Cryptique heatmap
7936
+ // viewer iframe, report the full document height to the parent so the canvas
7937
+ // overlay can be sized correctly (cross-origin pages cannot be read directly).
7938
+ // ============================================================================
7939
+ if (window.self !== window.top) {
7940
+ const _sendHeatmapDimensions = () => {
7941
+ try {
7942
+ // Cap at 25 000 px — browser scroll-animation libraries can report 16 777 216 (2^24).
7943
+ const h = Math.min(
7944
+ Math.max(
7945
+ document.body ? document.body.scrollHeight : 0,
7946
+ document.documentElement ? document.documentElement.scrollHeight : 0
7947
+ ),
7948
+ 25000
7949
+ );
7950
+ if (h > 0) {
7951
+ window.parent.postMessage({ type: 'cryptique_heatmap_dimensions', document_height: h }, '*');
7952
+ }
7953
+ } catch (_) {}
7954
+ };
7955
+
7956
+ // Send once the DOM is fully painted (immediate — most accurate final height).
7957
+ if (document.readyState === 'complete') {
7958
+ _sendHeatmapDimensions();
7959
+ } else {
7960
+ window.addEventListener('load', _sendHeatmapDimensions);
7961
+ }
7962
+
7963
+ // Re-send whenever the page grows (lazy-loaded content, SPAs, accordions, etc.).
7964
+ // Debounced to 1 s so rapid DOM mutations during React hydration don't trigger
7965
+ // dozens of postMessages and repeated canvas re-renders.
7966
+ try {
7967
+ let _heatmapROTimer;
7968
+ const _debouncedSend = () => {
7969
+ clearTimeout(_heatmapROTimer);
7970
+ _heatmapROTimer = setTimeout(_sendHeatmapDimensions, 1000);
7971
+ };
7972
+ const _heatmapRO = new ResizeObserver(_debouncedSend);
7973
+ _heatmapRO.observe(document.documentElement);
7974
+ } catch (_) {}
7975
+ }
7976
+
7933
7977
  // ============================================================================
7934
7978
  // END OF SECTION 15
7935
7979
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cryptique-sdk",
3
- "version": "1.2.13",
3
+ "version": "1.2.15",
4
4
  "type": "module",
5
5
  "description": "Cryptique Analytics SDK - Comprehensive web analytics and user tracking for modern web applications",
6
6
  "main": "lib/cjs/index.js",