@gemx-dev/heatmap-react 3.5.61 → 3.5.63

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.
Files changed (108) hide show
  1. package/dist/esm/components/Layout/Sidebar/PopoverSidebar.d.ts.map +1 -1
  2. package/dist/esm/components/VizDom/VizDomRenderer.d.ts.map +1 -1
  3. package/dist/esm/components/VizDom/WrapperVisual.d.ts.map +1 -1
  4. package/dist/esm/components/VizElement/DefaultRankBadges.d.ts +2 -2
  5. package/dist/esm/components/VizElement/DefaultRankBadges.d.ts.map +1 -1
  6. package/dist/esm/components/VizElement/ElementCalloutOverlay.d.ts.map +1 -1
  7. package/dist/esm/components/VizElement/ElementMissing.d.ts.map +1 -1
  8. package/dist/esm/components/VizElement/ElementOverlay.d.ts.map +1 -1
  9. package/dist/esm/components/VizElement/VizElements.d.ts.map +1 -1
  10. package/dist/esm/components/VizLive/VizLiveRenderer.d.ts.map +1 -1
  11. package/dist/esm/components/VizScrollmap/ScrollMapMinimap.d.ts.map +1 -1
  12. package/dist/esm/components/VizScrollmap/ScrollmapMarker.d.ts.map +1 -1
  13. package/dist/esm/components/VizScrollmap/VizScrollMap.d.ts.map +1 -1
  14. package/dist/esm/helpers/viz-area-click/area-builder.d.ts +2 -2
  15. package/dist/esm/helpers/viz-area-click/area-builder.d.ts.map +1 -1
  16. package/dist/esm/hooks/common/index.d.ts +1 -0
  17. package/dist/esm/hooks/common/index.d.ts.map +1 -1
  18. package/dist/esm/hooks/common/useHeatmapWidthByDevice.d.ts +2 -0
  19. package/dist/esm/hooks/common/useHeatmapWidthByDevice.d.ts.map +1 -0
  20. package/dist/esm/hooks/register/useRegisterConfig.d.ts.map +1 -1
  21. package/dist/esm/hooks/view-context/index.d.ts +1 -0
  22. package/dist/esm/hooks/view-context/index.d.ts.map +1 -1
  23. package/dist/esm/hooks/view-context/useHeatmapData.d.ts +3 -31
  24. package/dist/esm/hooks/view-context/useHeatmapData.d.ts.map +1 -1
  25. package/dist/esm/hooks/view-context/useHeatmapHover.d.ts +3 -27
  26. package/dist/esm/hooks/view-context/useHeatmapHover.d.ts.map +1 -1
  27. package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts +28 -0
  28. package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts.map +1 -0
  29. package/dist/esm/hooks/view-context/useHeatmapViz.d.ts +0 -17
  30. package/dist/esm/hooks/view-context/useHeatmapViz.d.ts.map +1 -1
  31. package/dist/esm/hooks/viz-elm/useHeatmapElementPosition.d.ts +2 -2
  32. package/dist/esm/hooks/viz-elm/useHeatmapElementPosition.d.ts.map +1 -1
  33. package/dist/esm/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
  34. package/dist/esm/hooks/viz-live/useVizLiveRender.d.ts.map +1 -1
  35. package/dist/esm/hooks/viz-render/useHeatmapRender.d.ts.map +1 -1
  36. package/dist/esm/hooks/viz-scale/useHeatmapScale.d.ts.map +1 -1
  37. package/dist/esm/index.js +270 -153
  38. package/dist/esm/index.mjs +270 -153
  39. package/dist/esm/stores/config.d.ts +0 -11
  40. package/dist/esm/stores/config.d.ts.map +1 -1
  41. package/dist/esm/stores/data.d.ts +1 -0
  42. package/dist/esm/stores/data.d.ts.map +1 -1
  43. package/dist/esm/stores/index.d.ts +1 -0
  44. package/dist/esm/stores/index.d.ts.map +1 -1
  45. package/dist/esm/stores/setting.d.ts +28 -0
  46. package/dist/esm/stores/setting.d.ts.map +1 -0
  47. package/dist/esm/stores/viz-hover.d.ts +1 -0
  48. package/dist/esm/stores/viz-hover.d.ts.map +1 -1
  49. package/dist/esm/types/heatmap-info.d.ts +22 -3
  50. package/dist/esm/types/heatmap-info.d.ts.map +1 -1
  51. package/dist/esm/types/heatmap.d.ts +13 -1
  52. package/dist/esm/types/heatmap.d.ts.map +1 -1
  53. package/dist/esm/types/viz-elm.d.ts +2 -2
  54. package/dist/esm/types/viz-elm.d.ts.map +1 -1
  55. package/dist/umd/components/Layout/Sidebar/PopoverSidebar.d.ts.map +1 -1
  56. package/dist/umd/components/VizDom/VizDomRenderer.d.ts.map +1 -1
  57. package/dist/umd/components/VizDom/WrapperVisual.d.ts.map +1 -1
  58. package/dist/umd/components/VizElement/DefaultRankBadges.d.ts +2 -2
  59. package/dist/umd/components/VizElement/DefaultRankBadges.d.ts.map +1 -1
  60. package/dist/umd/components/VizElement/ElementCalloutOverlay.d.ts.map +1 -1
  61. package/dist/umd/components/VizElement/ElementMissing.d.ts.map +1 -1
  62. package/dist/umd/components/VizElement/ElementOverlay.d.ts.map +1 -1
  63. package/dist/umd/components/VizElement/VizElements.d.ts.map +1 -1
  64. package/dist/umd/components/VizLive/VizLiveRenderer.d.ts.map +1 -1
  65. package/dist/umd/components/VizScrollmap/ScrollMapMinimap.d.ts.map +1 -1
  66. package/dist/umd/components/VizScrollmap/ScrollmapMarker.d.ts.map +1 -1
  67. package/dist/umd/components/VizScrollmap/VizScrollMap.d.ts.map +1 -1
  68. package/dist/umd/helpers/viz-area-click/area-builder.d.ts +2 -2
  69. package/dist/umd/helpers/viz-area-click/area-builder.d.ts.map +1 -1
  70. package/dist/umd/hooks/common/index.d.ts +1 -0
  71. package/dist/umd/hooks/common/index.d.ts.map +1 -1
  72. package/dist/umd/hooks/common/useHeatmapWidthByDevice.d.ts +2 -0
  73. package/dist/umd/hooks/common/useHeatmapWidthByDevice.d.ts.map +1 -0
  74. package/dist/umd/hooks/register/useRegisterConfig.d.ts.map +1 -1
  75. package/dist/umd/hooks/view-context/index.d.ts +1 -0
  76. package/dist/umd/hooks/view-context/index.d.ts.map +1 -1
  77. package/dist/umd/hooks/view-context/useHeatmapData.d.ts +3 -31
  78. package/dist/umd/hooks/view-context/useHeatmapData.d.ts.map +1 -1
  79. package/dist/umd/hooks/view-context/useHeatmapHover.d.ts +3 -27
  80. package/dist/umd/hooks/view-context/useHeatmapHover.d.ts.map +1 -1
  81. package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts +28 -0
  82. package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts.map +1 -0
  83. package/dist/umd/hooks/view-context/useHeatmapViz.d.ts +0 -17
  84. package/dist/umd/hooks/view-context/useHeatmapViz.d.ts.map +1 -1
  85. package/dist/umd/hooks/viz-elm/useHeatmapElementPosition.d.ts +2 -2
  86. package/dist/umd/hooks/viz-elm/useHeatmapElementPosition.d.ts.map +1 -1
  87. package/dist/umd/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
  88. package/dist/umd/hooks/viz-live/useVizLiveRender.d.ts.map +1 -1
  89. package/dist/umd/hooks/viz-render/useHeatmapRender.d.ts.map +1 -1
  90. package/dist/umd/hooks/viz-scale/useHeatmapScale.d.ts.map +1 -1
  91. package/dist/umd/index.js +2 -2
  92. package/dist/umd/stores/config.d.ts +0 -11
  93. package/dist/umd/stores/config.d.ts.map +1 -1
  94. package/dist/umd/stores/data.d.ts +1 -0
  95. package/dist/umd/stores/data.d.ts.map +1 -1
  96. package/dist/umd/stores/index.d.ts +1 -0
  97. package/dist/umd/stores/index.d.ts.map +1 -1
  98. package/dist/umd/stores/setting.d.ts +28 -0
  99. package/dist/umd/stores/setting.d.ts.map +1 -0
  100. package/dist/umd/stores/viz-hover.d.ts +1 -0
  101. package/dist/umd/stores/viz-hover.d.ts.map +1 -1
  102. package/dist/umd/types/heatmap-info.d.ts +22 -3
  103. package/dist/umd/types/heatmap-info.d.ts.map +1 -1
  104. package/dist/umd/types/heatmap.d.ts +13 -1
  105. package/dist/umd/types/heatmap.d.ts.map +1 -1
  106. package/dist/umd/types/viz-elm.d.ts +2 -2
  107. package/dist/umd/types/viz-elm.d.ts.map +1 -1
  108. package/package.json +4 -4
package/dist/esm/index.js CHANGED
@@ -149,32 +149,15 @@ function useDebounceCallback(callback, delay) {
149
149
  }, [delay]);
150
150
  }
151
151
 
152
- const useHeatmapControlStore = create()((set, get) => {
153
- return {
154
- controls: {
155
- Sidebar: undefined,
156
- SidebarActivator: undefined,
157
- Toolbar: null,
158
- MetricBar: null,
159
- VizLoading: null,
160
- TopBar: undefined,
161
- ElementCallout: undefined,
162
- },
163
- registerControl: (key, control) => {
164
- set({
165
- controls: {
166
- ...get().controls,
167
- [key]: control,
168
- },
169
- });
170
- },
171
- };
172
- });
173
-
152
+ var IDeviceType;
153
+ (function (IDeviceType) {
154
+ IDeviceType["Desktop"] = "desktop";
155
+ IDeviceType["Mobile"] = "mobile";
156
+ IDeviceType["Tablet"] = "tablet";
157
+ })(IDeviceType || (IDeviceType = {}));
174
158
  var IHeatmapType;
175
159
  (function (IHeatmapType) {
176
160
  IHeatmapType["Click"] = "click";
177
- IHeatmapType["ClickArea"] = "click-area";
178
161
  IHeatmapType["Scroll"] = "scroll";
179
162
  })(IHeatmapType || (IHeatmapType = {}));
180
163
  var IClickType;
@@ -186,6 +169,15 @@ var IClickType;
186
169
  IClickType["First"] = "first-clicks";
187
170
  IClickType["Last"] = "last-clicks";
188
171
  })(IClickType || (IClickType = {}));
172
+ var IClickRankType;
173
+ (function (IClickRankType) {
174
+ IClickRankType["MostClicks"] = "most-clicks";
175
+ IClickRankType["Revenue"] = "revenue";
176
+ IClickRankType["AttributionRate"] = "attribution-rate";
177
+ IClickRankType["ConversionRate"] = "conversion-rate";
178
+ IClickRankType["RevenuePerClick"] = "revenue-per-click";
179
+ IClickRankType["RevenuePerSession"] = "revenue-per-session";
180
+ })(IClickRankType || (IClickRankType = {}));
189
181
  var IClickMode;
190
182
  (function (IClickMode) {
191
183
  IClickMode["Default"] = "default";
@@ -198,24 +190,37 @@ var IScrollType;
198
190
  IScrollType["Revenue"] = "revenue-scroll";
199
191
  })(IScrollType || (IScrollType = {}));
200
192
 
193
+ const useHeatmapControlStore = create()((set, get) => {
194
+ return {
195
+ controls: {
196
+ Sidebar: undefined,
197
+ SidebarActivator: undefined,
198
+ Toolbar: null,
199
+ MetricBar: null,
200
+ VizLoading: null,
201
+ TopBar: undefined,
202
+ ElementCallout: undefined,
203
+ },
204
+ registerControl: (key, control) => {
205
+ set({
206
+ controls: {
207
+ ...get().controls,
208
+ [key]: control,
209
+ },
210
+ });
211
+ },
212
+ };
213
+ });
214
+
201
215
  const useHeatmapConfigStore = create()((set) => {
202
216
  return {
203
217
  mode: 'single',
204
- width: 1440,
205
218
  sidebarWidth: DEFAULT_SIDEBAR_WIDTH,
206
- heatmapType: IHeatmapType.Click,
207
- clickType: IClickType.Total,
208
219
  clickMode: IClickMode.Default,
209
- scrollType: IScrollType.Depth,
210
220
  isRendering: true,
211
221
  setMode: (mode) => set({ mode }),
212
222
  resetMode: () => set({ mode: 'single' }),
213
- setWidth: (width) => set({ width }),
214
223
  setSidebarWidth: (sidebarWidth) => set({ sidebarWidth }),
215
- setHeatmapType: (heatmapType) => set({ heatmapType }),
216
- setClickType: (clickType) => set({ clickType }),
217
- setClickMode: (clickMode) => set({ clickMode }),
218
- setScrollType: (scrollType) => set({ scrollType }),
219
224
  setIsRendering: (isRendering) => set({ isRendering }),
220
225
  };
221
226
  });
@@ -259,6 +264,16 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
259
264
  newScrollmap.set(viewId, scrollmap);
260
265
  return { scrollmap: newScrollmap };
261
266
  }),
267
+ setDataInfoByKey: (key, value, viewId = DEFAULT_VIEW_ID) => set((prev) => {
268
+ const currentHeatmapInfo = prev.dataInfo.get(viewId) || {};
269
+ const newHeatmapInfo = {
270
+ ...currentHeatmapInfo,
271
+ [key]: value,
272
+ };
273
+ const newDataInfo = new Map(prev.dataInfo);
274
+ newDataInfo.set(viewId, newHeatmapInfo);
275
+ return { dataInfo: newDataInfo };
276
+ }),
262
277
  copyView: (fromViewId, toViewId) => set((prev) => {
263
278
  const newData = new Map(prev.data);
264
279
  const newClickmap = new Map(prev.clickmap);
@@ -307,6 +322,99 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
307
322
  };
308
323
  }));
309
324
 
325
+ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
326
+ return {
327
+ rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
328
+ deviceType: new Map([[DEFAULT_VIEW_ID, IDeviceType.Desktop]]),
329
+ clickType: new Map([[DEFAULT_VIEW_ID, IClickType.Total]]),
330
+ clickMode: new Map([[DEFAULT_VIEW_ID, IClickMode.Default]]),
331
+ scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
332
+ heatmapType: new Map([[DEFAULT_VIEW_ID, IHeatmapType.Click]]),
333
+ setDeviceType: (deviceType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
334
+ const newDeviceType = new Map(prev.deviceType);
335
+ newDeviceType.set(viewId, deviceType);
336
+ return { deviceType: newDeviceType };
337
+ }),
338
+ setRankedBy: (rankedBy, viewId = DEFAULT_VIEW_ID) => set((prev) => {
339
+ const newRankedBy = new Map(prev.rankedBy);
340
+ newRankedBy.set(viewId, rankedBy);
341
+ return { rankedBy: newRankedBy };
342
+ }),
343
+ setClickType: (clickType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
344
+ const newClickType = new Map(prev.clickType);
345
+ newClickType.set(viewId, clickType);
346
+ return { clickType: newClickType };
347
+ }),
348
+ setClickMode: (clickMode, viewId = DEFAULT_VIEW_ID) => set((prev) => {
349
+ const newClickMode = new Map(prev.clickMode);
350
+ newClickMode.set(viewId, clickMode);
351
+ return { clickMode: newClickMode };
352
+ }),
353
+ setScrollType: (scrollType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
354
+ const newScrollType = new Map(prev.scrollType);
355
+ newScrollType.set(viewId, scrollType);
356
+ return { scrollType: newScrollType };
357
+ }),
358
+ setHeatmapType: (heatmapType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
359
+ const newHeatmapType = new Map(prev.heatmapType);
360
+ newHeatmapType.set(viewId, heatmapType);
361
+ return { heatmapType: newHeatmapType };
362
+ }),
363
+ copyView: (fromViewId, toViewId) => set((prev) => {
364
+ const newRankedBy = new Map(prev.rankedBy);
365
+ const newDeviceType = new Map(prev.deviceType);
366
+ const newClickType = new Map(prev.clickType);
367
+ const newClickMode = new Map(prev.clickMode);
368
+ const newScrollType = new Map(prev.scrollType);
369
+ const newHeatmapType = new Map(prev.heatmapType);
370
+ newRankedBy.set(toViewId, prev.rankedBy.get(fromViewId));
371
+ newDeviceType.set(toViewId, prev.deviceType.get(fromViewId));
372
+ newClickType.set(toViewId, prev.clickType.get(fromViewId));
373
+ newClickMode.set(toViewId, prev.clickMode.get(fromViewId));
374
+ newScrollType.set(toViewId, prev.scrollType.get(fromViewId));
375
+ newHeatmapType.set(toViewId, prev.heatmapType.get(fromViewId));
376
+ return {
377
+ rankedBy: newRankedBy,
378
+ deviceType: newDeviceType,
379
+ clickType: newClickType,
380
+ clickMode: newClickMode,
381
+ scrollType: newScrollType,
382
+ heatmapType: newHeatmapType,
383
+ };
384
+ }),
385
+ clearView: (viewId) => set((prev) => {
386
+ const newRankedBy = new Map(prev.rankedBy);
387
+ const newDeviceType = new Map(prev.deviceType);
388
+ const newClickType = new Map(prev.clickType);
389
+ const newClickMode = new Map(prev.clickMode);
390
+ const newScrollType = new Map(prev.scrollType);
391
+ const newHeatmapType = new Map(prev.heatmapType);
392
+ newRankedBy.delete(viewId);
393
+ newDeviceType.delete(viewId);
394
+ newClickType.delete(viewId);
395
+ newClickMode.delete(viewId);
396
+ newScrollType.delete(viewId);
397
+ newHeatmapType.delete(viewId);
398
+ return {
399
+ rankedBy: newRankedBy,
400
+ deviceType: newDeviceType,
401
+ clickType: newClickType,
402
+ clickMode: newClickMode,
403
+ scrollType: newScrollType,
404
+ heatmapType: newHeatmapType,
405
+ };
406
+ }),
407
+ resetAll: () => set({
408
+ rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
409
+ deviceType: new Map([[DEFAULT_VIEW_ID, IDeviceType.Desktop]]),
410
+ clickType: new Map([[DEFAULT_VIEW_ID, IClickType.Total]]),
411
+ clickMode: new Map([[DEFAULT_VIEW_ID, IClickMode.Default]]),
412
+ scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
413
+ heatmapType: new Map([[DEFAULT_VIEW_ID, IHeatmapType.Click]]),
414
+ }),
415
+ };
416
+ }));
417
+
310
418
  const useHeatmapVizStore = create()(subscribeWithSelector((set) => {
311
419
  return {
312
420
  isRenderViz: new Map([[DEFAULT_VIEW_ID, false]]),
@@ -578,7 +686,7 @@ const useHeatmapClickStore = create()(subscribeWithSelector((set) => {
578
686
  };
579
687
  }));
580
688
 
581
- const useHeatmapHoverStore = create()(subscribeWithSelector((set) => {
689
+ const useHeatmapHoverStore = create()(subscribeWithSelector((set, get) => {
582
690
  return {
583
691
  hoveredElement: new Map([[DEFAULT_VIEW_ID, null]]),
584
692
  setHoveredElement: (hoveredElement, viewId = DEFAULT_VIEW_ID) => set((prev) => {
@@ -586,6 +694,7 @@ const useHeatmapHoverStore = create()(subscribeWithSelector((set) => {
586
694
  newHoveredElement.set(viewId, hoveredElement);
587
695
  return { hoveredElement: newHoveredElement };
588
696
  }),
697
+ isHoveredElement: (hash, viewId = DEFAULT_VIEW_ID) => get().hoveredElement.get(viewId)?.hash === hash,
589
698
  copyView: (fromViewId, toViewId) => set((prev) => {
590
699
  const newHoveredElement = new Map(prev.hoveredElement);
591
700
  newHoveredElement.set(toViewId, prev.hoveredElement.get(fromViewId) ?? null);
@@ -852,39 +961,6 @@ const useHeatmapVizRectStore = create()(subscribeWithSelector((set) => {
852
961
  };
853
962
  }));
854
963
 
855
- const useRegisterConfig = () => {
856
- const mode = useHeatmapConfigStore((state) => state.mode);
857
- const width = useHeatmapConfigStore((state) => state.width);
858
- const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
859
- // const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
860
- // const clickMode = useHeatmapConfigStore((state) => state.clickMode);
861
- const setIsRendering = useHeatmapConfigStore((state) => state.setIsRendering);
862
- useEffect(() => {
863
- setIsRendering(true);
864
- setTimeout(() => {
865
- setIsRendering(false);
866
- }, 1000);
867
- }, [mode, width, sidebarWidth]); // eslint-disable-line react-hooks/exhaustive-deps
868
- };
869
-
870
- const useRegisterControl = (control) => {
871
- const registerControl = useHeatmapControlStore((state) => state.registerControl);
872
- const isRegistered = useRef(false);
873
- useEffect(() => {
874
- if (isRegistered.current)
875
- return;
876
- registerControl('Sidebar', control.Sidebar);
877
- registerControl('SidebarActivator', control.SidebarActivator);
878
- registerControl('TopBar', control.TopBar);
879
- registerControl('Toolbar', control.Toolbar);
880
- registerControl('MetricBar', control.MetricBar);
881
- registerControl('VizLoading', control.VizLoading);
882
- registerControl('ElementCallout', control.ElementCallout);
883
- registerControl('ScrollZoneTooltip', control.ScrollZoneTooltip);
884
- isRegistered.current = true;
885
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
886
- };
887
-
888
964
  const ViewIdContext = createContext(undefined);
889
965
  const useViewIdContext = () => {
890
966
  const viewId = useContext(ViewIdContext);
@@ -1043,9 +1119,6 @@ const useHeatmapClick = createViewContextHook({
1043
1119
  }),
1044
1120
  });
1045
1121
 
1046
- // ===========================
1047
- // Hook
1048
- // ===========================
1049
1122
  /**
1050
1123
  * Hook to access heatmap data state and actions with optional selector
1051
1124
  *
@@ -1075,6 +1148,7 @@ const useHeatmapData = createViewContextHook({
1075
1148
  setData: (newData) => store.setData(newData, viewId),
1076
1149
  setClickmap: (newClickmap) => store.setClickmap(newClickmap, viewId),
1077
1150
  setClickAreas: (newClickAreas) => store.setClickAreas(newClickAreas, viewId),
1151
+ setDataInfoByKey: (key, value) => store.setDataInfoByKey(key, value, viewId),
1078
1152
  setScrollmap: (newScrollmap) => store.setScrollmap(newScrollmap, viewId),
1079
1153
  setDataInfo: (newDataInfo) => store.setDataInfo(newDataInfo, viewId),
1080
1154
  removeClickArea: (areaId) => store.removeClickArea(areaId, viewId),
@@ -1082,23 +1156,6 @@ const useHeatmapData = createViewContextHook({
1082
1156
  }),
1083
1157
  });
1084
1158
 
1085
- // ===========================
1086
- // Hook
1087
- // ===========================
1088
- /**
1089
- * Hook to access heatmap hover state and actions with optional selector
1090
- * Separated from useHeatmapClick to prevent unnecessary re-renders
1091
- *
1092
- * @example
1093
- * ```tsx
1094
- * // Get everything
1095
- * const { hoveredElement, setHoveredElement } = useHeatmapHover();
1096
- *
1097
- * // Get only what you need (no unnecessary re-renders)
1098
- * const hoveredElement = useHeatmapHover(s => s.hoveredElement);
1099
- * const setHoveredElement = useHeatmapHover(s => s.setHoveredElement);
1100
- * ```
1101
- */
1102
1159
  const useHeatmapHover = createViewContextHook({
1103
1160
  useStore: useHeatmapHoverStore,
1104
1161
  getState: (store, viewId) => ({
@@ -1106,6 +1163,7 @@ const useHeatmapHover = createViewContextHook({
1106
1163
  }),
1107
1164
  getActions: (store, viewId) => ({
1108
1165
  setHoveredElement: (el) => store.setHoveredElement(el, viewId),
1166
+ isHoveredElement: (hash) => store.isHoveredElement(hash, viewId),
1109
1167
  }),
1110
1168
  });
1111
1169
 
@@ -1139,25 +1197,27 @@ const useHeatmapScroll = createViewContextHook({
1139
1197
  }),
1140
1198
  });
1141
1199
 
1142
- // ===========================
1143
- // Hook
1144
- // ===========================
1145
- /**
1146
- * Hook to access heatmap viz state and actions (zoom, scale, render state)
1147
- *
1148
- * @example
1149
- * ```tsx
1150
- * // Get everything
1151
- * const { zoomRatio, setZoomRatio, isRenderViz } = useHeatmapViz();
1152
- *
1153
- * // Get only what you need (no unnecessary re-renders)
1154
- * const zoomRatio = useHeatmapViz(s => s.zoomRatio);
1155
- * const { setZoomRatio, setScale } = useHeatmapViz(s => ({
1156
- * setZoomRatio: s.setZoomRatio,
1157
- * setScale: s.setScale,
1158
- * }));
1159
- * ```
1160
- */
1200
+ const useHeatmapSetting = createViewContextHook({
1201
+ useStore: useHeatmapSettingStore,
1202
+ getState: (store, viewId) => ({
1203
+ rankedBy: store.rankedBy.get(viewId),
1204
+ deviceType: store.deviceType.get(viewId),
1205
+ clickType: store.clickType.get(viewId),
1206
+ clickMode: store.clickMode.get(viewId),
1207
+ scrollType: store.scrollType.get(viewId),
1208
+ heatmapType: store.heatmapType.get(viewId),
1209
+ }),
1210
+ getActions: (store, viewId) => ({
1211
+ setRankedBy: (rankedBy) => store.setRankedBy(rankedBy, viewId),
1212
+ setDeviceType: (deviceType) => store.setDeviceType(deviceType, viewId),
1213
+ setClickType: (clickType) => store.setClickType(clickType, viewId),
1214
+ setClickMode: (clickMode) => store.setClickMode(clickMode, viewId),
1215
+ setScrollType: (scrollType) => store.setScrollType(scrollType, viewId),
1216
+ setHeatmapType: (heatmapType) => store.setHeatmapType(heatmapType, viewId),
1217
+ clearView: (viewId) => store.clearView(viewId),
1218
+ }),
1219
+ });
1220
+
1161
1221
  const useHeatmapViz = createViewContextHook({
1162
1222
  useStore: useHeatmapVizStore,
1163
1223
  getState: (store, viewId) => ({
@@ -1284,6 +1344,57 @@ const useHeatmapCopyView = () => {
1284
1344
  };
1285
1345
  };
1286
1346
 
1347
+ const useHeatmapWidthByDevice = () => {
1348
+ const deviceType = useHeatmapSetting((state) => state.deviceType);
1349
+ const width = useMemo(() => calcWidthByDeviceType(deviceType), [deviceType]);
1350
+ return width;
1351
+ function calcWidthByDeviceType(deviceType) {
1352
+ if (!deviceType)
1353
+ return 1440;
1354
+ switch (deviceType) {
1355
+ case IDeviceType.Desktop:
1356
+ return 1440;
1357
+ case IDeviceType.Tablet:
1358
+ return 768;
1359
+ case IDeviceType.Mobile:
1360
+ return 375;
1361
+ }
1362
+ }
1363
+ };
1364
+
1365
+ const useRegisterConfig = () => {
1366
+ const mode = useHeatmapConfigStore((state) => state.mode);
1367
+ const deviceType = useHeatmapSetting((state) => state.deviceType);
1368
+ const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
1369
+ // const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
1370
+ // const clickMode = useHeatmapConfigStore((state) => state.clickMode);
1371
+ const setIsRendering = useHeatmapConfigStore((state) => state.setIsRendering);
1372
+ useEffect(() => {
1373
+ setIsRendering(true);
1374
+ setTimeout(() => {
1375
+ setIsRendering(false);
1376
+ }, 1000);
1377
+ }, [mode, deviceType, sidebarWidth]); // eslint-disable-line react-hooks/exhaustive-deps
1378
+ };
1379
+
1380
+ const useRegisterControl = (control) => {
1381
+ const registerControl = useHeatmapControlStore((state) => state.registerControl);
1382
+ const isRegistered = useRef(false);
1383
+ useEffect(() => {
1384
+ if (isRegistered.current)
1385
+ return;
1386
+ registerControl('Sidebar', control.Sidebar);
1387
+ registerControl('SidebarActivator', control.SidebarActivator);
1388
+ registerControl('TopBar', control.TopBar);
1389
+ registerControl('Toolbar', control.Toolbar);
1390
+ registerControl('MetricBar', control.MetricBar);
1391
+ registerControl('VizLoading', control.VizLoading);
1392
+ registerControl('ElementCallout', control.ElementCallout);
1393
+ registerControl('ScrollZoneTooltip', control.ScrollZoneTooltip);
1394
+ isRegistered.current = true;
1395
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
1396
+ };
1397
+
1287
1398
  const useRegisterData = (data, dataInfo) => {
1288
1399
  const setIsRendering = useHeatmapConfigStore((state) => state.setIsRendering);
1289
1400
  const setData = useHeatmapData((s) => s.setData);
@@ -1631,31 +1742,31 @@ function getElementSelector(element) {
1631
1742
  * @param elementMapInfo - Map of hash to element click info
1632
1743
  * @returns Total clicks for element + all descendants
1633
1744
  */
1634
- function calculateTotalClicksWithChildren(element, elementMapInfo) {
1745
+ function calculateTotalClicksWithChildren(element, clickMapMetrics) {
1635
1746
  let totalClicks = 0;
1636
1747
  // Get clicks for the element itself
1637
1748
  const elementHash = getElementHash(element);
1638
1749
  if (elementHash) {
1639
- const elementInfo = elementMapInfo[elementHash];
1640
- totalClicks += elementInfo?.totalclicks || 0;
1750
+ const elementInfo = clickMapMetrics[elementHash];
1751
+ totalClicks += elementInfo?.totalClicked.value ?? 0;
1641
1752
  }
1642
1753
  const children = element.querySelectorAll('*');
1643
1754
  children.forEach((child) => {
1644
1755
  const childHash = getElementHash(child);
1645
1756
  if (childHash) {
1646
- const childInfo = elementMapInfo[childHash];
1647
- totalClicks += childInfo?.totalclicks || 0;
1757
+ const childInfo = clickMapMetrics[childHash];
1758
+ totalClicks += childInfo?.totalClicked.value ?? 0;
1648
1759
  }
1649
1760
  });
1650
1761
  return totalClicks;
1651
1762
  }
1652
1763
  function buildAreaNode(element, hash, heatmapInfo, shadowRoot, persistedData) {
1653
- if (!heatmapInfo.elementMapInfo)
1764
+ if (!heatmapInfo.clickMapMetrics)
1654
1765
  return;
1655
1766
  const totalClicks = heatmapInfo.totalClicks || 0;
1656
- const elementInfo = heatmapInfo.elementMapInfo[hash];
1767
+ const elementInfo = heatmapInfo.clickMapMetrics[hash];
1657
1768
  // Calculate total clicks including all child elements
1658
- const elementClicks = calculateTotalClicksWithChildren(element, heatmapInfo.elementMapInfo);
1769
+ const elementClicks = calculateTotalClicksWithChildren(element, heatmapInfo.clickMapMetrics);
1659
1770
  const clickDist = calculateClickDistribution(elementClicks, totalClicks);
1660
1771
  const rect = getElementRect(element);
1661
1772
  const color = getColorFromClickDist(clickDist);
@@ -1691,11 +1802,11 @@ function buildAreaNode(element, hash, heatmapInfo, shadowRoot, persistedData) {
1691
1802
  };
1692
1803
  return areaNode;
1693
1804
  }
1694
- function getTopElementsByClicks(elementMapInfo, topN = 10) {
1695
- const elements = Object.entries(elementMapInfo)
1805
+ function getTopElementsByClicks(clickMapMetrics, topN = 10) {
1806
+ const elements = Object.entries(clickMapMetrics)
1696
1807
  .map(([hash, info]) => ({
1697
1808
  hash,
1698
- totalclicks: info.totalclicks,
1809
+ totalclicks: info.totalClicked.value ?? 0,
1699
1810
  selector: info.selector || '',
1700
1811
  }))
1701
1812
  .sort((a, b) => b.totalclicks - a.totalclicks)
@@ -2233,11 +2344,11 @@ const getElementRank = (hash, elements) => {
2233
2344
  const buildElementInfo = (hash, rect, heatmapInfo) => {
2234
2345
  if (!rect || !heatmapInfo)
2235
2346
  return null;
2236
- const info = heatmapInfo.elementMapInfo?.[hash];
2347
+ const info = heatmapInfo.clickMapMetrics?.[hash];
2237
2348
  if (!info)
2238
2349
  return null;
2239
2350
  const rank = getElementRank(hash, heatmapInfo.sortedElements);
2240
- const clicks = info.totalclicks ?? 0;
2351
+ const clicks = info.totalClicked.value ?? 0;
2241
2352
  const selector = info.selector ?? '';
2242
2353
  const baseInfo = {
2243
2354
  hash,
@@ -3870,7 +3981,7 @@ const clearCanvas = (canvas) => {
3870
3981
  };
3871
3982
 
3872
3983
  function validateAreaCreation(dataInfo, hash, areas) {
3873
- if (!dataInfo?.elementMapInfo || !dataInfo?.totalClicks) {
3984
+ if (!dataInfo?.clickMapMetrics || !dataInfo?.totalClicks) {
3874
3985
  logger$4.warn('Cannot create area: missing heatmap data');
3875
3986
  return false;
3876
3987
  }
@@ -4263,7 +4374,7 @@ const useAreaTopAutoDetect = (props) => {
4263
4374
  useEffect(() => {
4264
4375
  if (isInitializing)
4265
4376
  return;
4266
- if (!dataInfo?.elementMapInfo || !dataInfo?.totalClicks)
4377
+ if (!dataInfo?.clickMapMetrics || !dataInfo?.totalClicks)
4267
4378
  return;
4268
4379
  if (!autoCreateTopN)
4269
4380
  return;
@@ -4271,7 +4382,7 @@ const useAreaTopAutoDetect = (props) => {
4271
4382
  return;
4272
4383
  if (areas?.length)
4273
4384
  return;
4274
- const topElements = getTopElementsByClicks(dataInfo.elementMapInfo, autoCreateTopN);
4385
+ const topElements = getTopElementsByClicks(dataInfo.clickMapMetrics, autoCreateTopN);
4275
4386
  const newAreas = [];
4276
4387
  topElements.forEach(({ hash }) => {
4277
4388
  const element = findElementByHash({ hash, vizRef });
@@ -4347,8 +4458,8 @@ const useScrollmap = () => {
4347
4458
  };
4348
4459
 
4349
4460
  const useHeatmapCanvas = () => {
4350
- const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
4351
- const clickMode = useHeatmapConfigStore((state) => state.clickMode);
4461
+ const heatmapType = useHeatmapSetting((state) => state.heatmapType);
4462
+ const clickMode = useHeatmapSetting((state) => state.clickMode);
4352
4463
  const { start: startClickmap } = useClickmap();
4353
4464
  const { start: startAreaClickmap } = useAreaClickmap();
4354
4465
  const { start: startScrollmap } = useScrollmap();
@@ -4416,11 +4527,11 @@ const useClickedElement = ({ visualRef, getRect }) => {
4416
4527
  useEffect(() => {
4417
4528
  const hash = selectedElement?.hash;
4418
4529
  // if (hash === clickedElement?.hash) return;
4419
- if (!selectedElement || !hash || !dataInfo?.elementMapInfo) {
4530
+ if (!selectedElement || !hash || !dataInfo?.clickMapMetrics) {
4420
4531
  reset();
4421
4532
  return;
4422
4533
  }
4423
- const info = dataInfo.elementMapInfo[hash];
4534
+ const info = dataInfo.clickMapMetrics[hash];
4424
4535
  if (!info) {
4425
4536
  setClickedElement(null);
4426
4537
  return;
@@ -4461,7 +4572,7 @@ const useElementCalloutVisible = ({ visualRef, getRect, positionMode }) => {
4461
4572
  if (!hash)
4462
4573
  return;
4463
4574
  const elementIsInViewportFn = () => {
4464
- const elementInfo = dataInfo?.elementMapInfo?.[hash];
4575
+ const elementInfo = dataInfo?.clickMapMetrics?.[hash];
4465
4576
  if (!elementInfo)
4466
4577
  return;
4467
4578
  const rect = getRect({ hash, selector: elementInfo.selector });
@@ -4504,7 +4615,7 @@ const useHeatmapEffects = ({ isVisible }) => {
4504
4615
  };
4505
4616
 
4506
4617
  const useHeatmapElementPosition = ({ iframeRef, wrapperRef, visualizer }) => {
4507
- const heatmapWidth = useHeatmapConfigStore((state) => state.width);
4618
+ const heatmapWidth = useHeatmapWidthByDevice();
4508
4619
  const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
4509
4620
  const widthScale = useHeatmapViz((s) => s.widthScale);
4510
4621
  const getRect = useCallback((element) => {
@@ -4635,6 +4746,7 @@ function getBoundingBox(element) {
4635
4746
 
4636
4747
  const useHoveredElement = ({ iframeRef, getRect }) => {
4637
4748
  const setHoveredElement = useHeatmapHover((s) => s.setHoveredElement);
4749
+ const isHoveredElement = useHeatmapHover((s) => s.isHoveredElement);
4638
4750
  const setSelectedElement = useHeatmapClick((s) => s.setSelectedElement);
4639
4751
  const widthScale = useHeatmapViz((s) => s.widthScale);
4640
4752
  const dataInfo = useHeatmapData((s) => s.dataInfo);
@@ -4674,7 +4786,9 @@ const useHoveredElement = ({ iframeRef, getRect }) => {
4674
4786
  reset();
4675
4787
  return;
4676
4788
  }
4677
- const selector = dataInfo?.elementMapInfo?.[hash];
4789
+ if (isHoveredElement(hash))
4790
+ return;
4791
+ const selector = dataInfo?.clickMapMetrics?.[hash];
4678
4792
  const rect = getRect({ hash, selector });
4679
4793
  const elementInfo = buildElementInfo(hash, rect, dataInfo);
4680
4794
  if (!elementInfo) {
@@ -4683,7 +4797,7 @@ const useHoveredElement = ({ iframeRef, getRect }) => {
4683
4797
  }
4684
4798
  const mousePosition = getElementMousePosition(event, widthScale);
4685
4799
  setHoveredElement({ ...elementInfo, mousePosition });
4686
- }, [dataInfo, getRect, reset, widthScale, getHashFromEvent, setHoveredElement]);
4800
+ }, [dataInfo, getRect, reset, widthScale, getHashFromEvent, setHoveredElement, isHoveredElement]);
4687
4801
  const handleMouseMove = useMemo(() => throttleRAF(onHandleMouseMove), [onHandleMouseMove]);
4688
4802
  const handleClick = useCallback((event, hash) => {
4689
4803
  if (!hash)
@@ -4739,7 +4853,7 @@ const findTargetElement = (doc, x, y, heatmapInfo) => {
4739
4853
  for (let i = 0; i < elementsAtPoint.length; i++) {
4740
4854
  const element = elementsAtPoint[i];
4741
4855
  const elementHash = getElementHash(element) ?? '';
4742
- const isExistElmInfo = heatmapInfo.elementMapInfo?.[elementHash];
4856
+ const isExistElmInfo = heatmapInfo.clickMapMetrics?.[elementHash];
4743
4857
  if (elementHash && isExistElmInfo) {
4744
4858
  const boundingBox = getBoundingBox(element);
4745
4859
  if (boundingBox) {
@@ -4758,7 +4872,7 @@ const findTargetElement = (doc, x, y, heatmapInfo) => {
4758
4872
  return targetElement;
4759
4873
  };
4760
4874
  const isIframeReady = (iframeRef, heatmapInfo) => {
4761
- return !!(iframeRef.current?.contentDocument && heatmapInfo?.elementMapInfo);
4875
+ return !!(iframeRef.current?.contentDocument && heatmapInfo?.clickMapMetrics);
4762
4876
  };
4763
4877
  const isValidElement = (element, heatmapInfo) => {
4764
4878
  if (!element)
@@ -4766,7 +4880,7 @@ const isValidElement = (element, heatmapInfo) => {
4766
4880
  const hash = getElementHash(element);
4767
4881
  if (!hash)
4768
4882
  return false;
4769
- return !!heatmapInfo?.elementMapInfo?.[hash];
4883
+ return !!heatmapInfo?.clickMapMetrics?.[hash];
4770
4884
  };
4771
4885
 
4772
4886
  function useIframeHeightProcessor(options) {
@@ -6195,7 +6309,7 @@ function useVizLiveRender() {
6195
6309
  const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6196
6310
  const wrapperWidth = useHeatmapVizRect((s) => s.wrapperWidth);
6197
6311
  const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
6198
- const contentWidth = useHeatmapConfigStore((state) => state.width);
6312
+ const contentWidth = useHeatmapWidthByDevice();
6199
6313
  const htmlContent = useHeatmapLiveStore((state) => state.htmlContent);
6200
6314
  const targetUrl = useHeatmapLiveStore((state) => state.targetUrl);
6201
6315
  const renderMode = useHeatmapLiveStore((state) => state.renderMode);
@@ -6289,6 +6403,7 @@ function initIframeHelper$1(iframe, rect, onSuccess) {
6289
6403
  }
6290
6404
 
6291
6405
  const useHeatmapRender = () => {
6406
+ const viewId = useViewIdContext();
6292
6407
  const data = useHeatmapData((s) => s.data);
6293
6408
  const vizRef = useHeatmapVizRect((s) => s.vizRef);
6294
6409
  const setVizRef = useHeatmapVizRect((s) => s.setVizRef);
@@ -6307,7 +6422,7 @@ const useHeatmapRender = () => {
6307
6422
  const iframe = iframeRef.current;
6308
6423
  if (!iframe?.contentWindow)
6309
6424
  return;
6310
- await visualizer.html(payloads, iframe.contentWindow, true);
6425
+ await visualizer.html(payloads, iframe.contentWindow, viewId);
6311
6426
  initIframeHelper(iframe, payloads, (height) => {
6312
6427
  height && setIframeHeight(height);
6313
6428
  setIsRenderViz(true);
@@ -6517,7 +6632,7 @@ const useContainerDimensions = (props) => {
6517
6632
  };
6518
6633
 
6519
6634
  const useContentDimensions = ({ iframeRef }) => {
6520
- const contentWidth = useHeatmapConfigStore((state) => state.width);
6635
+ const contentWidth = useHeatmapWidthByDevice();
6521
6636
  useEffect(() => {
6522
6637
  if (!contentWidth)
6523
6638
  return;
@@ -6756,7 +6871,7 @@ const useHeatmapScale = (props) => {
6756
6871
  };
6757
6872
  const useIframeHeight = (props) => {
6758
6873
  const { iframeRef } = props;
6759
- const iframeWidth = useHeatmapConfigStore((state) => state.width);
6874
+ const iframeWidth = useHeatmapWidthByDevice();
6760
6875
  const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6761
6876
  const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6762
6877
  const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
@@ -7086,14 +7201,15 @@ const PopoverSidebar = () => {
7086
7201
  return null;
7087
7202
  if (!CompSidebar || !CompSidebarActivator)
7088
7203
  return null;
7089
- return (jsxs("div", { children: [!isPopoverOpen && (jsx("div", { style: { ...stylePopover, width: 'auto', height: 'auto' }, children: jsx(CompSidebarActivator, { onClick: () => setIsPopoverOpen(true) }) })), isPopoverOpen && (jsx(Fragment, { children: jsx("div", { className: "gx-hm-sidebar-popover", style: {
7204
+ return (jsxs("div", { children: [!isPopoverOpen && (jsx("div", { style: { ...stylePopover, width: 'auto', height: 'auto' }, children: jsx(CompSidebarActivator, { onClick: () => setIsPopoverOpen(true) }) })), jsx(Fragment, { children: jsx("div", { className: "gx-hm-sidebar-popover", style: {
7090
7205
  ...stylePopover,
7091
7206
  backgroundColor: '#fff',
7092
7207
  borderRight: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
7093
7208
  borderRadius: '8px',
7094
7209
  boxShadow: '4px 0 12px rgba(0, 0, 0, 0.15)',
7095
7210
  overflow: 'auto',
7096
- }, children: jsx(CompSidebar, { closeAction: { onClick: () => setIsPopoverOpen(false) } }) }) }))] }));
7211
+ display: isPopoverOpen ? 'block' : 'none',
7212
+ }, children: jsx(CompSidebar, { closeAction: { onClick: () => setIsPopoverOpen(false) } }) }) })] }));
7097
7213
  };
7098
7214
 
7099
7215
  const ContentToolbar = () => {
@@ -7955,7 +8071,7 @@ const useAnchorPosition = (calloutRef, props) => {
7955
8071
  const ElementMissing = ({ show = true, visualRef }) => {
7956
8072
  const widthScale = useHeatmapViz((s) => s.widthScale);
7957
8073
  const missingElementRef = useRef(null);
7958
- const wrapperWidth = useHeatmapConfigStore((s) => s.width);
8074
+ const wrapperWidth = useHeatmapWidthByDevice();
7959
8075
  const [scrollPosition, setScrollPosition] = useState({ scrollTop: 0, scrollLeft: 0 });
7960
8076
  useEffect(() => {
7961
8077
  const container = visualRef.current;
@@ -8106,7 +8222,7 @@ const ElementOverlayComponent = (props) => {
8106
8222
  const { type, element, onClick, elementId, hideOutline } = props;
8107
8223
  const widthScale = useHeatmapViz((s) => s.widthScale);
8108
8224
  const viewportHeight = useHeatmapVizRect((s) => s.iframeHeight);
8109
- const viewportWidth = useHeatmapConfigStore((s) => s.width);
8225
+ const viewportWidth = useHeatmapWidthByDevice();
8110
8226
  const overlayStyle = useMemo(() => {
8111
8227
  const isInvalid = !element || (element.width === 0 && element.height === 0);
8112
8228
  if (isInvalid)
@@ -8188,7 +8304,7 @@ const HeatmapElements = (props) => {
8188
8304
  };
8189
8305
 
8190
8306
  const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8191
- const contentWidth = useHeatmapConfigStore((state) => state.width);
8307
+ const contentWidth = useHeatmapWidthByDevice();
8192
8308
  const dataInfo = useHeatmapData((s) => s.dataInfo);
8193
8309
  const vizRef = useHeatmapVizRect((s) => s.vizRef);
8194
8310
  const visualizer = {
@@ -8211,8 +8327,8 @@ const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8211
8327
  };
8212
8328
 
8213
8329
  const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8214
- const clickMode = useHeatmapConfigStore((state) => state.clickMode);
8215
- const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
8330
+ const clickMode = useHeatmapSetting((state) => state.clickMode);
8331
+ const heatmapType = useHeatmapSetting((state) => state.heatmapType);
8216
8332
  const isClickType = heatmapType === IHeatmapType.Click;
8217
8333
  if (!isClickType)
8218
8334
  return null;
@@ -8227,9 +8343,9 @@ const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8227
8343
  };
8228
8344
 
8229
8345
  const ScrollMapMinimap = ({ zones, maxUsers }) => {
8230
- const scrollType = useHeatmapConfigStore((state) => state.scrollType);
8346
+ const scrollType = useHeatmapSetting((s) => s.scrollType);
8231
8347
  const showMinimap = useHeatmapScroll((s) => s.showMinimap);
8232
- const isScrollType = [IScrollType.Attention].includes(scrollType);
8348
+ const isScrollType = [IScrollType.Attention].includes(scrollType ?? IScrollType.Depth);
8233
8349
  if (!showMinimap || !isScrollType)
8234
8350
  return null;
8235
8351
  return (jsx("div", { style: {
@@ -8378,7 +8494,7 @@ const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8378
8494
  };
8379
8495
 
8380
8496
  const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8381
- const scrollType = useHeatmapConfigStore((state) => state.scrollType);
8497
+ const scrollType = useHeatmapSetting((s) => s.scrollType);
8382
8498
  const { scrollmap } = useHeatmapData();
8383
8499
  const { getZonePosition } = useZonePositions();
8384
8500
  if (!scrollmap || scrollmap.length === 0)
@@ -8454,10 +8570,10 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8454
8570
 
8455
8571
  const SCROLL_TYPES = [IHeatmapType.Scroll];
8456
8572
  const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8457
- const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
8573
+ const heatmapType = useHeatmapSetting((s) => s.heatmapType);
8458
8574
  const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8459
8575
  // useRenderCount('VizScrollMap');
8460
- const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType);
8576
+ const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? IHeatmapType.Click);
8461
8577
  if (!iframeHeight || !isHeatmapScroll)
8462
8578
  return null;
8463
8579
  return (jsxs("div", { style: {
@@ -8472,8 +8588,8 @@ const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8472
8588
  };
8473
8589
 
8474
8590
  const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHeight, onScroll, }) => {
8475
- const contentWidth = useHeatmapConfigStore((state) => state.width);
8476
8591
  const widthScale = useHeatmapViz((s) => s.widthScale);
8592
+ const contentWidth = useHeatmapWidthByDevice();
8477
8593
  const contentHeight = calcContentHeight();
8478
8594
  return (jsx("div", { ref: visualRef, className: "gx-hm-visual", onScroll: onScroll, style: {
8479
8595
  overflow: 'hidden scroll',
@@ -8507,7 +8623,8 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8507
8623
  };
8508
8624
 
8509
8625
  const VizDomRenderer = ({ mode = 'heatmap' }) => {
8510
- const contentWidth = useHeatmapConfigStore((state) => state.width || 0);
8626
+ const viewId = useViewIdContext();
8627
+ const contentWidth = useHeatmapWidthByDevice();
8511
8628
  const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8512
8629
  const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8513
8630
  const wrapperRef = useRef(null);
@@ -8520,7 +8637,7 @@ const VizDomRenderer = ({ mode = 'heatmap' }) => {
8520
8637
  const scrollTop = e.currentTarget.scrollTop;
8521
8638
  handleScroll(scrollTop);
8522
8639
  };
8523
- return (jsxs(WrapperVisual, { visualRef: visualRef, wrapperRef: wrapperRef, scaledHeight: scaledHeight, onScroll: onScroll, iframeHeight: iframeHeight, children: [jsx(VizClickmap, { iframeRef: iframeRef, visualRef: visualRef, wrapperRef: wrapperRef }), jsx("iframe", { ...HEATMAP_IFRAME, ref: iframeRef, width: contentWidth, height: wrapperHeight }), jsx(VizScrollMap, { iframeRef: iframeRef, wrapperRef: visualRef })] }));
8640
+ return (jsxs(WrapperVisual, { visualRef: visualRef, wrapperRef: wrapperRef, scaledHeight: scaledHeight, onScroll: onScroll, iframeHeight: iframeHeight, children: [jsx(VizClickmap, { iframeRef: iframeRef, visualRef: visualRef, wrapperRef: wrapperRef }), jsx("iframe", { ...HEATMAP_IFRAME, id: `clarity-iframe-${viewId}`, ref: iframeRef, width: contentWidth, height: wrapperHeight }), jsx(VizScrollMap, { iframeRef: iframeRef, wrapperRef: visualRef })] }));
8524
8641
  };
8525
8642
 
8526
8643
  const VizLoading = () => {
@@ -8556,7 +8673,7 @@ const VizDomHeatmap = () => {
8556
8673
  VizDomHeatmap.displayName = 'VizDomHeatmap';
8557
8674
 
8558
8675
  const VizLiveRenderer = () => {
8559
- const contentWidth = useHeatmapConfigStore((state) => state.width);
8676
+ const contentWidth = useHeatmapWidthByDevice();
8560
8677
  const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8561
8678
  const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8562
8679
  const visualRef = useRef(null);
@@ -8646,4 +8763,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
8646
8763
  }
8647
8764
  };
8648
8765
 
8649
- export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, ELM_CALLOUT_CONFIG, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, IClickMode, IClickType, IHeatmapType, IScrollType, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, downloadPerformanceReport, getCompareViewId, getMetricsByViewId, getPerformanceReportJSON, getScrollGradientColor, performanceLogger, printPerformanceSummary, scrollToElementIfNeeded, sendPerformanceReport, serializeAreas, trackStoreAction, useAreaCreation, useAreaEditMode, useAreaFilterVisible, useAreaHydration, useAreaInteraction, useAreaPositionsUpdater, useAreaRectSync, useAreaRendererContainer, useAreaTopAutoDetect, useClickedElement, useDebounceCallback, useElementCalloutVisible, useHeatmapAreaClick, useHeatmapCanvas, useHeatmapClick, useHeatmapCompareStore, useHeatmapConfigStore, useHeatmapCopyView, useHeatmapData, useHeatmapEffects, useHeatmapElementPosition, useHeatmapHover, useHeatmapLiveStore, useHeatmapRenderByMode, useHeatmapScale, useHeatmapScroll, useHeatmapViz, useHeatmapVizRect, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };
8766
+ export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, ELM_CALLOUT_CONFIG, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, IClickMode, IClickRankType, IClickType, IDeviceType, IHeatmapType, IScrollType, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, downloadPerformanceReport, getCompareViewId, getMetricsByViewId, getPerformanceReportJSON, getScrollGradientColor, performanceLogger, printPerformanceSummary, scrollToElementIfNeeded, sendPerformanceReport, serializeAreas, trackStoreAction, useAreaCreation, useAreaEditMode, useAreaFilterVisible, useAreaHydration, useAreaInteraction, useAreaPositionsUpdater, useAreaRectSync, useAreaRendererContainer, useAreaTopAutoDetect, useClickedElement, useDebounceCallback, useElementCalloutVisible, useHeatmapAreaClick, useHeatmapCanvas, useHeatmapClick, useHeatmapCompareStore, useHeatmapConfigStore, useHeatmapCopyView, useHeatmapData, useHeatmapEffects, useHeatmapElementPosition, useHeatmapHover, useHeatmapLiveStore, useHeatmapRenderByMode, useHeatmapScale, useHeatmapScroll, useHeatmapSetting, useHeatmapViz, useHeatmapVizRect, useHeatmapWidthByDevice, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };