@gemx-dev/heatmap-react 3.5.71 → 3.5.73

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 (118) hide show
  1. package/dist/esm/components/Layout/HeatmapLayout.d.ts +2 -0
  2. package/dist/esm/components/Layout/HeatmapLayout.d.ts.map +1 -1
  3. package/dist/esm/components/Layout/HeatmapPreview.d.ts.map +1 -1
  4. package/dist/esm/components/Layout/Sidebar/ContentSidebar.d.ts.map +1 -1
  5. package/dist/esm/components/Layout/Toolbar/ContentToolbar.d.ts.map +1 -1
  6. package/dist/esm/components/Layout/TopBar/ContentTopBar.d.ts.map +1 -1
  7. package/dist/esm/components/Layout/VizByMode/ContentVizByMode.d.ts.map +1 -1
  8. package/dist/esm/components/VizDom/VizDomHeatmap.d.ts.map +1 -1
  9. package/dist/esm/components/VizDom/VizDomRenderer.d.ts.map +1 -1
  10. package/dist/esm/components/VizDom/VizLoading.d.ts.map +1 -1
  11. package/dist/esm/components/VizDom/VizLoadingCanvas.d.ts +2 -0
  12. package/dist/esm/components/VizDom/VizLoadingCanvas.d.ts.map +1 -0
  13. package/dist/esm/components/VizDom/WrapperVisual.d.ts.map +1 -1
  14. package/dist/esm/components/VizLive/VizLiveHeatmap.d.ts.map +1 -1
  15. package/dist/esm/components/VizScrollmap/AverageFoldLine.d.ts.map +1 -1
  16. package/dist/esm/hooks/index.d.ts +1 -1
  17. package/dist/esm/hooks/index.d.ts.map +1 -1
  18. package/dist/esm/hooks/register/useRegisterConfig.d.ts +4 -1
  19. package/dist/esm/hooks/register/useRegisterConfig.d.ts.map +1 -1
  20. package/dist/esm/hooks/register/useRegisterControl.d.ts.map +1 -1
  21. package/dist/esm/hooks/view-context/index.d.ts +8 -8
  22. package/dist/esm/hooks/view-context/index.d.ts.map +1 -1
  23. package/dist/esm/hooks/view-context/{useHeatmapAreaClick.d.ts → useHeatmapAreaClickContext.d.ts} +2 -2
  24. package/dist/esm/hooks/view-context/useHeatmapAreaClickContext.d.ts.map +1 -0
  25. package/dist/esm/hooks/view-context/{useHeatmapClick.d.ts → useHeatmapClickContext.d.ts} +5 -5
  26. package/dist/esm/hooks/view-context/useHeatmapClickContext.d.ts.map +1 -0
  27. package/dist/{umd/hooks/view-context/useHeatmapData.d.ts → esm/hooks/view-context/useHeatmapDataContext.d.ts} +5 -5
  28. package/dist/esm/hooks/view-context/useHeatmapDataContext.d.ts.map +1 -0
  29. package/dist/{umd/hooks/view-context/useHeatmapHover.d.ts → esm/hooks/view-context/useHeatmapHoverContext.d.ts} +2 -2
  30. package/dist/esm/hooks/view-context/useHeatmapHoverContext.d.ts.map +1 -0
  31. package/dist/{umd/hooks/view-context/useHeatmapScroll.d.ts → esm/hooks/view-context/useHeatmapScrollContext.d.ts} +2 -2
  32. package/dist/esm/hooks/view-context/useHeatmapScrollContext.d.ts.map +1 -0
  33. package/dist/{umd/hooks/view-context/useHeatmapSetting.d.ts → esm/hooks/view-context/useHeatmapSettingContext.d.ts} +8 -3
  34. package/dist/esm/hooks/view-context/useHeatmapSettingContext.d.ts.map +1 -0
  35. package/dist/{umd/hooks/view-context/useHeatmapViz.d.ts → esm/hooks/view-context/useHeatmapVizContext.d.ts} +2 -2
  36. package/dist/esm/hooks/view-context/useHeatmapVizContext.d.ts.map +1 -0
  37. package/dist/esm/hooks/view-context/useHeatmapVizRectContext.d.ts +23 -0
  38. package/dist/esm/hooks/view-context/useHeatmapVizRectContext.d.ts.map +1 -0
  39. package/dist/esm/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
  40. package/dist/esm/hooks/viz-render/useReplayRender.d.ts.map +1 -1
  41. package/dist/esm/hooks/viz-scroll/useScrollmapZones.d.ts.map +1 -1
  42. package/dist/esm/index.js +280 -229
  43. package/dist/esm/index.mjs +280 -229
  44. package/dist/esm/stores/data.d.ts.map +1 -1
  45. package/dist/esm/stores/setting.d.ts +4 -0
  46. package/dist/esm/stores/setting.d.ts.map +1 -1
  47. package/dist/esm/types/control.d.ts +6 -3
  48. package/dist/esm/types/control.d.ts.map +1 -1
  49. package/dist/esm/types/heatmap-info.d.ts +2 -0
  50. package/dist/esm/types/heatmap-info.d.ts.map +1 -1
  51. package/dist/umd/components/Layout/HeatmapLayout.d.ts +2 -0
  52. package/dist/umd/components/Layout/HeatmapLayout.d.ts.map +1 -1
  53. package/dist/umd/components/Layout/HeatmapPreview.d.ts.map +1 -1
  54. package/dist/umd/components/Layout/Sidebar/ContentSidebar.d.ts.map +1 -1
  55. package/dist/umd/components/Layout/Toolbar/ContentToolbar.d.ts.map +1 -1
  56. package/dist/umd/components/Layout/TopBar/ContentTopBar.d.ts.map +1 -1
  57. package/dist/umd/components/Layout/VizByMode/ContentVizByMode.d.ts.map +1 -1
  58. package/dist/umd/components/VizDom/VizDomHeatmap.d.ts.map +1 -1
  59. package/dist/umd/components/VizDom/VizDomRenderer.d.ts.map +1 -1
  60. package/dist/umd/components/VizDom/VizLoading.d.ts.map +1 -1
  61. package/dist/umd/components/VizDom/VizLoadingCanvas.d.ts +2 -0
  62. package/dist/umd/components/VizDom/VizLoadingCanvas.d.ts.map +1 -0
  63. package/dist/umd/components/VizDom/WrapperVisual.d.ts.map +1 -1
  64. package/dist/umd/components/VizLive/VizLiveHeatmap.d.ts.map +1 -1
  65. package/dist/umd/components/VizScrollmap/AverageFoldLine.d.ts.map +1 -1
  66. package/dist/umd/hooks/index.d.ts +1 -1
  67. package/dist/umd/hooks/index.d.ts.map +1 -1
  68. package/dist/umd/hooks/register/useRegisterConfig.d.ts +4 -1
  69. package/dist/umd/hooks/register/useRegisterConfig.d.ts.map +1 -1
  70. package/dist/umd/hooks/register/useRegisterControl.d.ts.map +1 -1
  71. package/dist/umd/hooks/view-context/index.d.ts +8 -8
  72. package/dist/umd/hooks/view-context/index.d.ts.map +1 -1
  73. package/dist/umd/hooks/view-context/{useHeatmapAreaClick.d.ts → useHeatmapAreaClickContext.d.ts} +2 -2
  74. package/dist/umd/hooks/view-context/useHeatmapAreaClickContext.d.ts.map +1 -0
  75. package/dist/umd/hooks/view-context/{useHeatmapClick.d.ts → useHeatmapClickContext.d.ts} +5 -5
  76. package/dist/umd/hooks/view-context/useHeatmapClickContext.d.ts.map +1 -0
  77. package/dist/{esm/hooks/view-context/useHeatmapData.d.ts → umd/hooks/view-context/useHeatmapDataContext.d.ts} +5 -5
  78. package/dist/umd/hooks/view-context/useHeatmapDataContext.d.ts.map +1 -0
  79. package/dist/{esm/hooks/view-context/useHeatmapHover.d.ts → umd/hooks/view-context/useHeatmapHoverContext.d.ts} +2 -2
  80. package/dist/umd/hooks/view-context/useHeatmapHoverContext.d.ts.map +1 -0
  81. package/dist/{esm/hooks/view-context/useHeatmapScroll.d.ts → umd/hooks/view-context/useHeatmapScrollContext.d.ts} +2 -2
  82. package/dist/umd/hooks/view-context/useHeatmapScrollContext.d.ts.map +1 -0
  83. package/dist/{esm/hooks/view-context/useHeatmapSetting.d.ts → umd/hooks/view-context/useHeatmapSettingContext.d.ts} +8 -3
  84. package/dist/umd/hooks/view-context/useHeatmapSettingContext.d.ts.map +1 -0
  85. package/dist/{esm/hooks/view-context/useHeatmapViz.d.ts → umd/hooks/view-context/useHeatmapVizContext.d.ts} +2 -2
  86. package/dist/umd/hooks/view-context/useHeatmapVizContext.d.ts.map +1 -0
  87. package/dist/umd/hooks/view-context/useHeatmapVizRectContext.d.ts +23 -0
  88. package/dist/umd/hooks/view-context/useHeatmapVizRectContext.d.ts.map +1 -0
  89. package/dist/umd/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
  90. package/dist/umd/hooks/viz-render/useReplayRender.d.ts.map +1 -1
  91. package/dist/umd/hooks/viz-scroll/useScrollmapZones.d.ts.map +1 -1
  92. package/dist/umd/index.js +2 -2
  93. package/dist/umd/stores/data.d.ts.map +1 -1
  94. package/dist/umd/stores/setting.d.ts +4 -0
  95. package/dist/umd/stores/setting.d.ts.map +1 -1
  96. package/dist/umd/types/control.d.ts +6 -3
  97. package/dist/umd/types/control.d.ts.map +1 -1
  98. package/dist/umd/types/heatmap-info.d.ts +2 -0
  99. package/dist/umd/types/heatmap-info.d.ts.map +1 -1
  100. package/package.json +1 -1
  101. package/dist/esm/hooks/view-context/useHeatmapAreaClick.d.ts.map +0 -1
  102. package/dist/esm/hooks/view-context/useHeatmapClick.d.ts.map +0 -1
  103. package/dist/esm/hooks/view-context/useHeatmapData.d.ts.map +0 -1
  104. package/dist/esm/hooks/view-context/useHeatmapHover.d.ts.map +0 -1
  105. package/dist/esm/hooks/view-context/useHeatmapScroll.d.ts.map +0 -1
  106. package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts.map +0 -1
  107. package/dist/esm/hooks/view-context/useHeatmapViz.d.ts.map +0 -1
  108. package/dist/esm/hooks/view-context/useHeatmapVizRect.d.ts +0 -60
  109. package/dist/esm/hooks/view-context/useHeatmapVizRect.d.ts.map +0 -1
  110. package/dist/umd/hooks/view-context/useHeatmapAreaClick.d.ts.map +0 -1
  111. package/dist/umd/hooks/view-context/useHeatmapClick.d.ts.map +0 -1
  112. package/dist/umd/hooks/view-context/useHeatmapData.d.ts.map +0 -1
  113. package/dist/umd/hooks/view-context/useHeatmapHover.d.ts.map +0 -1
  114. package/dist/umd/hooks/view-context/useHeatmapScroll.d.ts.map +0 -1
  115. package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts.map +0 -1
  116. package/dist/umd/hooks/view-context/useHeatmapViz.d.ts.map +0 -1
  117. package/dist/umd/hooks/view-context/useHeatmapVizRect.d.ts +0 -60
  118. package/dist/umd/hooks/view-context/useHeatmapVizRect.d.ts.map +0 -1
package/dist/esm/index.js CHANGED
@@ -86,7 +86,7 @@ const HEATMAP_CONFIG = {
86
86
  borderWidth: 1,
87
87
  borderWidthIframe: 2,
88
88
  borderColor: '#E3E3E3',
89
- heightToolbar: 60, // height of the toolbar
89
+ heightToolbar: 0, // height of the toolbar
90
90
  };
91
91
  const HEATMAP_STYLE = {
92
92
  viz: {
@@ -286,9 +286,9 @@ const useHeatmapControlStore = create()((set, get) => {
286
286
  controls: {
287
287
  Sidebar: undefined,
288
288
  SidebarActivator: undefined,
289
- Toolbar: null,
290
- MetricBar: null,
291
- VizLoading: null,
289
+ Toolbar: undefined,
290
+ MetricBar: undefined,
291
+ VizLoading: undefined,
292
292
  TopBar: undefined,
293
293
  ElementCallout: undefined,
294
294
  },
@@ -355,16 +355,18 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
355
355
  newScrollmap.set(viewId, scrollmap);
356
356
  return { scrollmap: newScrollmap };
357
357
  }),
358
- setDataInfoByKey: (key, value, viewId = DEFAULT_VIEW_ID) => set((prev) => {
359
- const currentHeatmapInfo = prev.dataInfo.get(viewId) || {};
360
- const newHeatmapInfo = {
361
- ...currentHeatmapInfo,
362
- [key]: value,
363
- };
364
- const newDataInfo = new Map(prev.dataInfo);
365
- newDataInfo.set(viewId, newHeatmapInfo);
366
- return { dataInfo: newDataInfo };
367
- }),
358
+ setDataInfoByKey: (key, value, viewId = DEFAULT_VIEW_ID) => {
359
+ return set((prev) => {
360
+ const currentHeatmapInfo = prev.dataInfo.get(viewId) || {};
361
+ const newHeatmapInfo = {
362
+ ...currentHeatmapInfo,
363
+ [key]: value,
364
+ };
365
+ const newDataInfo = new Map(prev.dataInfo);
366
+ newDataInfo.set(viewId, newHeatmapInfo);
367
+ return { dataInfo: newDataInfo };
368
+ });
369
+ },
368
370
  copyView: (fromViewId, toViewId) => set((prev) => {
369
371
  const newData = new Map(prev.data);
370
372
  const newClickmap = new Map(prev.clickmap);
@@ -416,6 +418,8 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
416
418
  const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
417
419
  return {
418
420
  isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
421
+ isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
422
+ isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
419
423
  rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
420
424
  deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
421
425
  clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
@@ -432,6 +436,16 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
432
436
  newDeviceType.set(viewId, deviceType);
433
437
  return { deviceType: newDeviceType };
434
438
  }),
439
+ setIsLoadingDom: (isLoadingDom, viewId = DEFAULT_VIEW_ID) => set((prev) => {
440
+ const newIsLoadingDom = new Map(prev.isLoadingDom);
441
+ newIsLoadingDom.set(viewId, isLoadingDom);
442
+ return { isLoadingDom: newIsLoadingDom };
443
+ }),
444
+ setIsLoadingCanvas: (isLoadingCanvas, viewId = DEFAULT_VIEW_ID) => set((prev) => {
445
+ const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
446
+ newIsLoadingCanvas.set(viewId, isLoadingCanvas);
447
+ return { isLoadingCanvas: newIsLoadingCanvas };
448
+ }),
435
449
  setRankedBy: (rankedBy, viewId = DEFAULT_VIEW_ID) => set((prev) => {
436
450
  const newRankedBy = new Map(prev.rankedBy);
437
451
  newRankedBy.set(viewId, rankedBy);
@@ -458,6 +472,8 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
458
472
  return { heatmapType: newHeatmapType };
459
473
  }),
460
474
  copyView: (fromViewId, toViewId) => set((prev) => {
475
+ const newIsLoadingDom = new Map(prev.isLoadingDom);
476
+ const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
461
477
  const newRankedBy = new Map(prev.rankedBy);
462
478
  const newDeviceType = new Map(prev.deviceType);
463
479
  const newClickType = new Map(prev.clickType);
@@ -470,8 +486,12 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
470
486
  newClickMode.set(toViewId, prev.clickMode.get(fromViewId));
471
487
  newScrollType.set(toViewId, prev.scrollType.get(fromViewId));
472
488
  newHeatmapType.set(toViewId, prev.heatmapType.get(fromViewId));
489
+ newIsLoadingDom.set(toViewId, prev.isLoadingDom.get(fromViewId) ?? false);
490
+ newIsLoadingCanvas.set(toViewId, prev.isLoadingCanvas.get(fromViewId) ?? false);
473
491
  return {
474
492
  rankedBy: newRankedBy,
493
+ isLoadingDom: newIsLoadingDom,
494
+ isLoadingCanvas: newIsLoadingCanvas,
475
495
  deviceType: newDeviceType,
476
496
  clickType: newClickType,
477
497
  clickMode: newClickMode,
@@ -481,12 +501,16 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
481
501
  }),
482
502
  clearView: (viewId) => set((prev) => {
483
503
  const newRankedBy = new Map(prev.rankedBy);
504
+ const newIsLoadingDom = new Map(prev.isLoadingDom);
505
+ const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
484
506
  const newDeviceType = new Map(prev.deviceType);
485
507
  const newClickType = new Map(prev.clickType);
486
508
  const newClickMode = new Map(prev.clickMode);
487
509
  const newScrollType = new Map(prev.scrollType);
488
510
  const newHeatmapType = new Map(prev.heatmapType);
489
511
  newRankedBy.delete(viewId);
512
+ newIsLoadingDom.delete(viewId);
513
+ newIsLoadingCanvas.delete(viewId);
490
514
  newDeviceType.delete(viewId);
491
515
  newClickType.delete(viewId);
492
516
  newClickMode.delete(viewId);
@@ -494,6 +518,8 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
494
518
  newHeatmapType.delete(viewId);
495
519
  return {
496
520
  rankedBy: newRankedBy,
521
+ isLoadingDom: newIsLoadingDom,
522
+ isLoadingCanvas: newIsLoadingCanvas,
497
523
  deviceType: newDeviceType,
498
524
  clickType: newClickType,
499
525
  clickMode: newClickMode,
@@ -503,6 +529,8 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
503
529
  }),
504
530
  resetAll: () => set({
505
531
  isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
532
+ isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
533
+ isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
506
534
  rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
507
535
  deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
508
536
  clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
@@ -1059,7 +1087,7 @@ const useHeatmapVizRectStore = create()(subscribeWithSelector((set) => {
1059
1087
  };
1060
1088
  }));
1061
1089
 
1062
- const useHeatmapAreaClick = createViewContextHook({
1090
+ const useHeatmapAreaClickContext = createViewContextHook({
1063
1091
  useStore: useHeatmapVizClickAreaStore,
1064
1092
  getState: (store, viewId) => ({
1065
1093
  selectedArea: store.selectedArea.get(viewId) ?? null,
@@ -1093,14 +1121,14 @@ const DEFAULT_STATE = { hideSidebar: false };
1093
1121
  * @example
1094
1122
  * ```tsx
1095
1123
  * // Get everything
1096
- * const { state, selectedElement, setSelectedElement } = useHeatmapClick();
1124
+ * const { state, selectedElement, setSelectedElement } = useHeatmapClickContext();
1097
1125
  *
1098
1126
  * // Get only what you need (no unnecessary re-renders)
1099
- * const setSelectedElement = useHeatmapClick(s => s.setSelectedElement);
1100
- * const selectedElement = useHeatmapClick(s => s.selectedElement);
1127
+ * const setSelectedElement = useHeatmapClickContext(s => s.setSelectedElement);
1128
+ * const selectedElement = useHeatmapClickContext(s => s.selectedElement);
1101
1129
  * ```
1102
1130
  */
1103
- const useHeatmapClick = createViewContextHook({
1131
+ const useHeatmapClickContext = createViewContextHook({
1104
1132
  useStore: useHeatmapVizClickStore,
1105
1133
  getState: (store, viewId) => ({
1106
1134
  state: store.state.get(viewId) ?? DEFAULT_STATE,
@@ -1120,17 +1148,17 @@ const useHeatmapClick = createViewContextHook({
1120
1148
  * @example
1121
1149
  * ```tsx
1122
1150
  * // Get everything
1123
- * const { data, clickmap, setData } = useHeatmapData();
1151
+ * const { data, clickmap, setData } = useHeatmapDataContext();
1124
1152
  *
1125
1153
  * // Get only what you need (no unnecessary re-renders)
1126
- * const data = useHeatmapData(s => s.data);
1127
- * const { setData, setClickmap } = useHeatmapData(s => ({
1154
+ * const data = useHeatmapDataContext(s => s.data);
1155
+ * const { setData, setClickmap } = useHeatmapDataContext(s => ({
1128
1156
  * setData: s.setData,
1129
1157
  * setClickmap: s.setClickmap,
1130
1158
  * }));
1131
1159
  * ```
1132
1160
  */
1133
- const useHeatmapData = createViewContextHook({
1161
+ const useHeatmapDataContext = createViewContextHook({
1134
1162
  useStore: useHeatmapDataStore,
1135
1163
  getState: (store, viewId) => ({
1136
1164
  data: store.data.get(viewId),
@@ -1151,7 +1179,7 @@ const useHeatmapData = createViewContextHook({
1151
1179
  }),
1152
1180
  });
1153
1181
 
1154
- const useHeatmapHover = createViewContextHook({
1182
+ const useHeatmapHoverContext = createViewContextHook({
1155
1183
  useStore: useHeatmapVizHoverStore,
1156
1184
  getState: (store, viewId) => ({
1157
1185
  hoveredElement: store.hoveredElement.get(viewId) ?? null,
@@ -1162,7 +1190,7 @@ const useHeatmapHover = createViewContextHook({
1162
1190
  }),
1163
1191
  });
1164
1192
 
1165
- const useHeatmapScroll = createViewContextHook({
1193
+ const useHeatmapScrollContext = createViewContextHook({
1166
1194
  useStore: useHeatmapVizScrollStore,
1167
1195
  getState: (store, viewId) => ({
1168
1196
  zones: store.zones.get(viewId) ?? [],
@@ -1176,12 +1204,14 @@ const useHeatmapScroll = createViewContextHook({
1176
1204
  }),
1177
1205
  });
1178
1206
 
1179
- const useHeatmapSetting = createViewContextHook({
1207
+ const useHeatmapSettingContext = createViewContextHook({
1180
1208
  useStore: useHeatmapSettingStore,
1181
1209
  getState: (store, viewId) => ({
1182
1210
  isRendering: !!store.isRendering.get(viewId),
1211
+ isLoadingDom: !!store.isLoadingDom.get(viewId),
1212
+ isLoadingCanvas: !!store.isLoadingCanvas.get(viewId),
1183
1213
  rankedBy: store.rankedBy.get(viewId),
1184
- deviceType: store.deviceType.get(viewId),
1214
+ deviceType: store.deviceType.get(viewId) ?? EDeviceType.Desktop,
1185
1215
  clickType: store.clickType.get(viewId),
1186
1216
  clickMode: store.clickMode.get(viewId),
1187
1217
  scrollType: store.scrollType.get(viewId),
@@ -1195,11 +1225,13 @@ const useHeatmapSetting = createViewContextHook({
1195
1225
  setScrollType: (scrollType) => store.setScrollType(scrollType, viewId),
1196
1226
  setHeatmapType: (heatmapType) => store.setHeatmapType(heatmapType, viewId),
1197
1227
  setIsRendering: (isRendering) => store.setIsRendering(isRendering, viewId),
1228
+ setIsLoadingDom: (isLoadingDom) => store.setIsLoadingDom(isLoadingDom, viewId),
1229
+ setIsLoadingCanvas: (isLoadingCanvas) => store.setIsLoadingCanvas(isLoadingCanvas, viewId),
1198
1230
  clearView: (viewId) => store.clearView(viewId),
1199
1231
  }),
1200
1232
  });
1201
1233
 
1202
- const useHeatmapViz = createViewContextHook({
1234
+ const useHeatmapVizContext = createViewContextHook({
1203
1235
  useStore: useHeatmapVizStore,
1204
1236
  getState: (store, viewId) => ({
1205
1237
  isRenderViz: store.isRenderViz.get(viewId) ?? false,
@@ -1219,26 +1251,7 @@ const useHeatmapViz = createViewContextHook({
1219
1251
  }),
1220
1252
  });
1221
1253
 
1222
- // ===========================
1223
- // Hook
1224
- // ===========================
1225
- /**
1226
- * Hook to access heatmap viz rect (dimensions & visualizer ref) state and actions
1227
- *
1228
- * @example
1229
- * ```tsx
1230
- * // Get everything
1231
- * const { iframeHeight, setIframeHeight, setVizRef } = useHeatmapVizRect();
1232
- *
1233
- * // Get only what you need (no unnecessary re-renders)
1234
- * const iframeHeight = useHeatmapVizRect(s => s.iframeHeight);
1235
- * const { setIframeHeight, setVizRef } = useHeatmapVizRect(s => ({
1236
- * setIframeHeight: s.setIframeHeight,
1237
- * setVizRef: s.setVizRef,
1238
- * }));
1239
- * ```
1240
- */
1241
- const useHeatmapVizRect = createViewContextHook({
1254
+ const useHeatmapVizRectContext = createViewContextHook({
1242
1255
  useStore: useHeatmapVizRectStore,
1243
1256
  getState: (store, viewId) => ({
1244
1257
  vizRef: store.vizRef.get(viewId) ?? null,
@@ -1332,7 +1345,7 @@ const useHeatmapCopyView = () => {
1332
1345
  };
1333
1346
 
1334
1347
  const useHeatmapWidthByDevice = () => {
1335
- const deviceType = useHeatmapSetting((state) => state.deviceType);
1348
+ const deviceType = useHeatmapSettingContext((state) => state.deviceType);
1336
1349
  const width = useMemo(() => calcWidthByDeviceType(deviceType), [deviceType]);
1337
1350
  return width;
1338
1351
  function calcWidthByDeviceType(deviceType) {
@@ -1349,19 +1362,26 @@ const useHeatmapWidthByDevice = () => {
1349
1362
  }
1350
1363
  };
1351
1364
 
1352
- const useRegisterConfig = () => {
1365
+ const useRegisterConfig = ({ isLoading, isLoadingCanvas, }) => {
1353
1366
  const mode = useHeatmapConfigStore((state) => state.mode);
1354
- const deviceType = useHeatmapSetting((state) => state.deviceType);
1367
+ const deviceType = useHeatmapSettingContext((state) => state.deviceType);
1355
1368
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
1356
- // const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
1357
- // const clickMode = useHeatmapConfigStore((state) => state.clickMode);
1358
- const setIsRendering = useHeatmapSetting((state) => state.setIsRendering);
1369
+ const setIsRendering = useHeatmapSettingContext((state) => state.setIsRendering);
1370
+ const setIsLoadingDom = useHeatmapSettingContext((state) => state.setIsLoadingDom);
1371
+ const setIsLoadingCanvas = useHeatmapSettingContext((state) => state.setIsLoadingCanvas);
1359
1372
  useEffect(() => {
1360
1373
  setIsRendering(true);
1361
1374
  setTimeout(() => {
1362
1375
  setIsRendering(false);
1363
- }, 1000);
1376
+ }, 100);
1364
1377
  }, [mode, deviceType, sidebarWidth]); // eslint-disable-line react-hooks/exhaustive-deps
1378
+ useEffect(() => {
1379
+ setIsRendering(!!isLoading);
1380
+ setIsLoadingDom(!!isLoading);
1381
+ }, [isLoading, setIsLoadingDom, setIsRendering]);
1382
+ useEffect(() => {
1383
+ setIsLoadingCanvas(!!isLoadingCanvas);
1384
+ }, [isLoadingCanvas, setIsLoadingCanvas]);
1365
1385
  };
1366
1386
 
1367
1387
  const useRegisterControl = (control) => {
@@ -1378,14 +1398,15 @@ const useRegisterControl = (control) => {
1378
1398
  registerControl('VizLoading', control.VizLoading);
1379
1399
  registerControl('ElementCallout', control.ElementCallout);
1380
1400
  registerControl('ScrollZoneTooltip', control.ScrollZoneTooltip);
1401
+ registerControl('EmptyState', control.EmptyState);
1381
1402
  isRegistered.current = true;
1382
1403
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
1383
1404
  };
1384
1405
 
1385
1406
  const useRegisterData = (data, dataInfo) => {
1386
- const setIsRendering = useHeatmapSetting((s) => s.setIsRendering);
1387
- const setData = useHeatmapData((s) => s.setData);
1388
- const setDataInfo = useHeatmapData((s) => s.setDataInfo);
1407
+ const setIsRendering = useHeatmapSettingContext((s) => s.setIsRendering);
1408
+ const setData = useHeatmapDataContext((s) => s.setData);
1409
+ const setDataInfo = useHeatmapDataContext((s) => s.setDataInfo);
1389
1410
  const isRegistered = useRef(false);
1390
1411
  useEffect(() => {
1391
1412
  if (isRegistered.current)
@@ -1402,9 +1423,9 @@ const useRegisterData = (data, dataInfo) => {
1402
1423
  };
1403
1424
 
1404
1425
  const useRegisterHeatmap = ({ clickmap, scrollmap, clickAreas }) => {
1405
- const setClickmap = useHeatmapData((s) => s.setClickmap);
1406
- const setScrollmap = useHeatmapData((s) => s.setScrollmap);
1407
- const setClickAreas = useHeatmapData((s) => s.setClickAreas);
1426
+ const setClickmap = useHeatmapDataContext((s) => s.setClickmap);
1427
+ const setScrollmap = useHeatmapDataContext((s) => s.setScrollmap);
1428
+ const setClickAreas = useHeatmapDataContext((s) => s.setClickAreas);
1408
1429
  const isRegistered = useRef(false);
1409
1430
  useEffect(() => {
1410
1431
  if (isRegistered.current)
@@ -4012,11 +4033,11 @@ function removeConflictingAreas(conflicts, removeArea) {
4012
4033
  });
4013
4034
  }
4014
4035
  function useAreaCreation(options = {}) {
4015
- const dataInfo = useHeatmapData((s) => s.dataInfo);
4016
- const areas = useHeatmapAreaClick((s) => s.areas);
4017
- const addArea = useHeatmapAreaClick((s) => s.addArea);
4018
- const removeArea = useHeatmapAreaClick((s) => s.removeArea);
4019
- const removeClickArea = useHeatmapData((s) => s.removeClickArea);
4036
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4037
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4038
+ const addArea = useHeatmapAreaClickContext((s) => s.addArea);
4039
+ const removeArea = useHeatmapAreaClickContext((s) => s.removeArea);
4040
+ const removeClickArea = useHeatmapDataContext((s) => s.removeClickArea);
4020
4041
  const { customShadowRoot, onAreaCreated } = options;
4021
4042
  const onAreaCreatedElement = useCallback((element) => {
4022
4043
  if (!dataInfo)
@@ -4055,7 +4076,7 @@ function useAreaCreation(options = {}) {
4055
4076
  }
4056
4077
 
4057
4078
  function useAreaEditMode({ iframeRef, onAreaCreatedElement, enabled = false, }) {
4058
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
4079
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
4059
4080
  const hoveredElementRef = useRef(null);
4060
4081
  const onAreaCreatedElementRef = useRef(onAreaCreatedElement);
4061
4082
  const [hoveredElement, setHoveredElement] = useState(null);
@@ -4125,8 +4146,8 @@ function useAreaEditMode({ iframeRef, onAreaCreatedElement, enabled = false, })
4125
4146
  }
4126
4147
 
4127
4148
  const useAreaFilterVisible = (props) => {
4128
- const areas = useHeatmapAreaClick((s) => s.areas);
4129
- const setAreas = useHeatmapAreaClick((s) => s.setAreas);
4149
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4150
+ const setAreas = useHeatmapAreaClickContext((s) => s.setAreas);
4130
4151
  const { iframeRef, enableOverlapResolution } = props;
4131
4152
  const iframeDocument = iframeRef.current?.contentDocument;
4132
4153
  const visibleAreas = useMemo(() => {
@@ -4145,11 +4166,11 @@ const useAreaFilterVisible = (props) => {
4145
4166
  };
4146
4167
 
4147
4168
  function useAreaHydration(options) {
4148
- const dataInfo = useHeatmapData((s) => s.dataInfo);
4149
- const clickAreas = useHeatmapData((s) => s.clickAreas);
4150
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4151
- const areas = useHeatmapAreaClick((s) => s.areas);
4152
- const setAreas = useHeatmapAreaClick((s) => s.setAreas);
4169
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4170
+ const clickAreas = useHeatmapDataContext((s) => s.clickAreas);
4171
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4172
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4173
+ const setAreas = useHeatmapAreaClickContext((s) => s.setAreas);
4153
4174
  const { shadowRoot, enabled = true } = options;
4154
4175
  const [isInitializing, setIsInitializing] = useState(false);
4155
4176
  const hydratePersistedAreas = useCallback(() => {
@@ -4189,9 +4210,9 @@ function useAreaHydration(options) {
4189
4210
  }
4190
4211
 
4191
4212
  function useAreaInteraction({ onAreaClick }) {
4192
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
4193
- const setHoveredArea = useHeatmapAreaClick((s) => s.setHoveredArea);
4194
- const setSelectedArea = useHeatmapAreaClick((s) => s.setSelectedArea);
4213
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
4214
+ const setHoveredArea = useHeatmapAreaClickContext((s) => s.setHoveredArea);
4215
+ const setSelectedArea = useHeatmapAreaClickContext((s) => s.setSelectedArea);
4195
4216
  const handleAreaMouseEnter = useCallback((area) => {
4196
4217
  if (isEditingMode)
4197
4218
  return;
@@ -4218,7 +4239,7 @@ function useAreaInteraction({ onAreaClick }) {
4218
4239
  }
4219
4240
 
4220
4241
  function useAreaPositionsUpdater(options) {
4221
- const areas = useHeatmapAreaClick((s) => s.areas);
4242
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4222
4243
  const { iframeRef, visualRef, enabled = true } = options;
4223
4244
  const iframeDocument = iframeRef.current?.contentDocument;
4224
4245
  const updateAreaPositions = useCallback(() => {
@@ -4266,8 +4287,8 @@ function useAreaPositionsUpdater(options) {
4266
4287
  }
4267
4288
 
4268
4289
  function useAreaRectSync(options) {
4269
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4270
- const areas = useHeatmapAreaClick((s) => s.areas);
4290
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4291
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4271
4292
  const { iframeDocument, shadowRoot, enabled = true } = options;
4272
4293
  useEffect(() => {
4273
4294
  if (!enabled || !iframeDocument || areas.length === 0) {
@@ -4348,11 +4369,11 @@ function useAreaRendererContainer(iframeDocument, customShadowRoot) {
4348
4369
  }
4349
4370
 
4350
4371
  const useAreaTopAutoDetect = (props) => {
4351
- const dataInfo = useHeatmapData((s) => s.dataInfo);
4352
- const clickAreas = useHeatmapData((s) => s.clickAreas);
4353
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4354
- const areas = useHeatmapAreaClick((s) => s.areas);
4355
- const addArea = useHeatmapAreaClick((s) => s.addArea);
4372
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4373
+ const clickAreas = useHeatmapDataContext((s) => s.clickAreas);
4374
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4375
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4376
+ const addArea = useHeatmapAreaClickContext((s) => s.addArea);
4356
4377
  const { autoCreateTopN, shadowRoot, disabled = false } = props;
4357
4378
  const [isInitializing, setIsInitializing] = useState(disabled);
4358
4379
  useEffect(() => {
@@ -4391,8 +4412,8 @@ const useAreaTopAutoDetect = (props) => {
4391
4412
  };
4392
4413
 
4393
4414
  const useAreaClickmap = () => {
4394
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4395
- const clickmap = useHeatmapData((s) => s.clickmap);
4415
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4416
+ const clickmap = useHeatmapDataContext((s) => s.clickmap);
4396
4417
  const start = useCallback(() => {
4397
4418
  if (!vizRef || !clickmap || clickmap.length === 0)
4398
4419
  return;
@@ -4407,9 +4428,9 @@ const useAreaClickmap = () => {
4407
4428
  };
4408
4429
 
4409
4430
  const useClickmap = () => {
4410
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4411
- const clickmap = useHeatmapData((s) => s.clickmap);
4412
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
4431
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4432
+ const clickmap = useHeatmapDataContext((s) => s.clickmap);
4433
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
4413
4434
  const start = useCallback(() => {
4414
4435
  if (!vizRef || !clickmap || clickmap.length === 0 || !isRenderViz)
4415
4436
  return;
@@ -4425,8 +4446,8 @@ const useClickmap = () => {
4425
4446
  };
4426
4447
 
4427
4448
  const useScrollmap = () => {
4428
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4429
- const scrollmap = useHeatmapData((s) => s.scrollmap);
4449
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4450
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
4430
4451
  const start = useCallback(() => {
4431
4452
  if (!vizRef || !scrollmap || scrollmap.length === 0)
4432
4453
  return;
@@ -4442,8 +4463,8 @@ const useScrollmap = () => {
4442
4463
  };
4443
4464
 
4444
4465
  const useHeatmapCanvas = () => {
4445
- const heatmapType = useHeatmapSetting((state) => state.heatmapType);
4446
- const clickMode = useHeatmapSetting((state) => state.clickMode);
4466
+ const heatmapType = useHeatmapSettingContext((state) => state.heatmapType);
4467
+ const clickMode = useHeatmapSettingContext((state) => state.clickMode);
4447
4468
  const { start: startClickmap } = useClickmap();
4448
4469
  const { start: startAreaClickmap } = useAreaClickmap();
4449
4470
  const { start: startScrollmap } = useScrollmap();
@@ -4496,11 +4517,11 @@ const scrollToElementIfNeeded = (visualRef, rect, scale, onScrollComplete) => {
4496
4517
  });
4497
4518
  };
4498
4519
  const useClickedElement = ({ visualRef, getRect }) => {
4499
- const selectedElement = useHeatmapClick((s) => s.selectedElement);
4500
- const shouldShowCallout = useHeatmapClick((s) => s.shouldShowCallout);
4501
- const setShouldShowCallout = useHeatmapClick((s) => s.setShouldShowCallout);
4502
- const widthScale = useHeatmapViz((s) => s.widthScale);
4503
- const dataInfo = useHeatmapData((s) => s.dataInfo);
4520
+ const selectedElement = useHeatmapClickContext((s) => s.selectedElement);
4521
+ const shouldShowCallout = useHeatmapClickContext((s) => s.shouldShowCallout);
4522
+ const setShouldShowCallout = useHeatmapClickContext((s) => s.setShouldShowCallout);
4523
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4524
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4504
4525
  const [clickedElement, setClickedElement] = useState(null);
4505
4526
  const [showMissingElement, setShowMissingElement] = useState(false);
4506
4527
  const reset = () => {
@@ -4544,10 +4565,10 @@ const useClickedElement = ({ visualRef, getRect }) => {
4544
4565
  };
4545
4566
 
4546
4567
  const useElementCalloutVisible = ({ visualRef, getRect, positionMode }) => {
4547
- const selectedElement = useHeatmapClick((s) => s.selectedElement);
4548
- const setShouldShowCallout = useHeatmapClick((s) => s.setShouldShowCallout);
4549
- const widthScale = useHeatmapViz((s) => s.widthScale);
4550
- const dataInfo = useHeatmapData((s) => s.dataInfo);
4568
+ const selectedElement = useHeatmapClickContext((s) => s.selectedElement);
4569
+ const setShouldShowCallout = useHeatmapClickContext((s) => s.setShouldShowCallout);
4570
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4571
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4551
4572
  useEffect(() => {
4552
4573
  const isAbsolute = positionMode === 'absolute';
4553
4574
  if (isAbsolute)
@@ -4580,8 +4601,8 @@ const useElementCalloutVisible = ({ visualRef, getRect, positionMode }) => {
4580
4601
  };
4581
4602
 
4582
4603
  const useHeatmapEffects = ({ isVisible }) => {
4583
- // const selectedElement = useHeatmapClick((s) => s.selectedElement);
4584
- // const setShouldShowCallout = useHeatmapClick((s) => s.setShouldShowCallout);
4604
+ // const selectedElement = useHeatmapClickContext((s) => s.selectedElement);
4605
+ // const setShouldShowCallout = useHeatmapClickContext((s) => s.setShouldShowCallout);
4585
4606
  const resetAll = () => {
4586
4607
  // setShouldShowCallout(false);
4587
4608
  };
@@ -4600,8 +4621,8 @@ const useHeatmapEffects = ({ isVisible }) => {
4600
4621
 
4601
4622
  const useHeatmapElementPosition = ({ iframeRef, wrapperRef, visualizer }) => {
4602
4623
  const heatmapWidth = useHeatmapWidthByDevice();
4603
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
4604
- const widthScale = useHeatmapViz((s) => s.widthScale);
4624
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
4625
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4605
4626
  const getRect = useCallback((element) => {
4606
4627
  const hash = element?.hash;
4607
4628
  if (!iframeRef.current?.contentDocument || !hash || !visualizer)
@@ -4729,11 +4750,11 @@ function getBoundingBox(element) {
4729
4750
  // }
4730
4751
 
4731
4752
  const useHoveredElement = ({ iframeRef, getRect }) => {
4732
- const setHoveredElement = useHeatmapHover((s) => s.setHoveredElement);
4733
- const isHoveredElement = useHeatmapHover((s) => s.isHoveredElement);
4734
- const setSelectedElement = useHeatmapClick((s) => s.setSelectedElement);
4735
- const widthScale = useHeatmapViz((s) => s.widthScale);
4736
- const dataInfo = useHeatmapData((s) => s.dataInfo);
4753
+ const setHoveredElement = useHeatmapHoverContext((s) => s.setHoveredElement);
4754
+ const isHoveredElement = useHeatmapHoverContext((s) => s.isHoveredElement);
4755
+ const setSelectedElement = useHeatmapClickContext((s) => s.setSelectedElement);
4756
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4757
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4737
4758
  const reset = useCallback(() => {
4738
4759
  setHoveredElement(null);
4739
4760
  }, [setHoveredElement]);
@@ -6289,10 +6310,10 @@ function enableNavigationBlocking() {
6289
6310
  }
6290
6311
 
6291
6312
  function useVizLiveRender() {
6292
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6293
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6294
- const wrapperWidth = useHeatmapVizRect((s) => s.wrapperWidth);
6295
- const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
6313
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6314
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
6315
+ const wrapperWidth = useHeatmapVizRectContext((s) => s.wrapperWidth);
6316
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6296
6317
  const contentWidth = useHeatmapWidthByDevice();
6297
6318
  const htmlContent = useHeatmapLiveStore((state) => state.htmlContent);
6298
6319
  const targetUrl = useHeatmapLiveStore((state) => state.targetUrl);
@@ -6388,11 +6409,11 @@ function initIframeHelper$1(iframe, rect, onSuccess) {
6388
6409
 
6389
6410
  const useHeatmapRender = () => {
6390
6411
  const viewId = useViewIdContext();
6391
- const data = useHeatmapData((s) => s.data);
6392
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
6393
- const setVizRef = useHeatmapVizRect((s) => s.setVizRef);
6394
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6395
- const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
6412
+ const data = useHeatmapDataContext((s) => s.data);
6413
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
6414
+ const setVizRef = useHeatmapVizRectContext((s) => s.setVizRef);
6415
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6416
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6396
6417
  const iframeRef = useRef(null);
6397
6418
  const renderHeatmap = useCallback(async (payloads) => {
6398
6419
  if (!payloads || payloads.length === 0)
@@ -6456,9 +6477,9 @@ function sortEvents(a, b) {
6456
6477
  }
6457
6478
 
6458
6479
  const useReplayRender = () => {
6459
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6460
- const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
6461
- const { data } = useHeatmapData();
6480
+ const data = useHeatmapDataContext((s) => s.data);
6481
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6482
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6462
6483
  const visualizerRef = useRef(null);
6463
6484
  const iframeRef = useRef(null);
6464
6485
  const eventsRef = useRef([]);
@@ -6630,10 +6651,10 @@ const useContentDimensions = ({ iframeRef }) => {
6630
6651
  };
6631
6652
 
6632
6653
  const useObserveIframeHeight = (props) => {
6633
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6634
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6635
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
6636
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6654
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6655
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6656
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
6657
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
6637
6658
  const { iframeRef } = props;
6638
6659
  const resizeObserverRef = useRef(null);
6639
6660
  const mutationObserverRef = useRef(null);
@@ -6760,14 +6781,14 @@ const useObserveIframeHeight = (props) => {
6760
6781
  };
6761
6782
 
6762
6783
  const useScaleCalculation = (props) => {
6763
- const widthScale = useHeatmapViz((s) => s.widthScale);
6764
- const zoomRatio = useHeatmapViz((s) => s.zoomRatio);
6765
- const isScaledToFit = useHeatmapViz((s) => s.isScaledToFit);
6766
- const minZoomRatio = useHeatmapViz((s) => s.minZoomRatio);
6767
- const maxZoomRatio = useHeatmapViz((s) => s.maxZoomRatio);
6768
- const setScale = useHeatmapViz((s) => s.setScale);
6769
- const setIsScaledToFit = useHeatmapViz((s) => s.setIsScaledToFit);
6770
- const setMinZoomRatio = useHeatmapViz((s) => s.setMinZoomRatio);
6784
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
6785
+ const zoomRatio = useHeatmapVizContext((s) => s.zoomRatio);
6786
+ const isScaledToFit = useHeatmapVizContext((s) => s.isScaledToFit);
6787
+ const minZoomRatio = useHeatmapVizContext((s) => s.minZoomRatio);
6788
+ const maxZoomRatio = useHeatmapVizContext((s) => s.maxZoomRatio);
6789
+ const setScale = useHeatmapVizContext((s) => s.setScale);
6790
+ const setIsScaledToFit = useHeatmapVizContext((s) => s.setIsScaledToFit);
6791
+ const setMinZoomRatio = useHeatmapVizContext((s) => s.setMinZoomRatio);
6771
6792
  const { containerWidth, containerHeight, contentWidth, contentHeight } = props;
6772
6793
  const calculateScaleResult = useCallback(() => {
6773
6794
  if (containerWidth > 0 && contentWidth > 0 && containerHeight > 0 && contentHeight > 0) {
@@ -6830,7 +6851,7 @@ const useScrollSync = ({ widthScale, iframeRef }) => {
6830
6851
  };
6831
6852
 
6832
6853
  const useHeatmapScale = (props) => {
6833
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6854
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6834
6855
  const { wrapperRef, iframeRef } = props;
6835
6856
  // 1. Observe container dimensions
6836
6857
  const { containerWidth, containerHeight } = useContainerDimensions({ wrapperRef });
@@ -6858,9 +6879,9 @@ const useHeatmapScale = (props) => {
6858
6879
  const useIframeHeight = (props) => {
6859
6880
  const { iframeRef } = props;
6860
6881
  const iframeWidth = useHeatmapWidthByDevice();
6861
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6862
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6863
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
6882
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
6883
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6884
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
6864
6885
  useIframeHeightProcessor({
6865
6886
  iframeRef: iframeRef,
6866
6887
  iframeWidth: iframeWidth,
@@ -6881,8 +6902,8 @@ const useIframeHeight = (props) => {
6881
6902
  };
6882
6903
 
6883
6904
  const useWrapperRefHeight = (props) => {
6884
- const setWrapperHeight = useHeatmapVizRect((s) => s.setWrapperHeight);
6885
- const setWrapperWidth = useHeatmapVizRect((s) => s.setWrapperWidth);
6905
+ const setWrapperHeight = useHeatmapVizRectContext((s) => s.setWrapperHeight);
6906
+ const setWrapperWidth = useHeatmapVizRectContext((s) => s.setWrapperWidth);
6886
6907
  const { isActive, wrapperRef } = props;
6887
6908
  const resizeObserverRef = useRef(null);
6888
6909
  const mutationObserverRef = useRef(null);
@@ -6954,7 +6975,7 @@ const useWrapperRefHeight = (props) => {
6954
6975
  };
6955
6976
 
6956
6977
  const useZonePositions = (_options) => {
6957
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6978
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6958
6979
  const getZonePosition = useCallback((zone) => {
6959
6980
  if (!iframeHeight) {
6960
6981
  return null;
@@ -6978,10 +6999,10 @@ const SCROLL_GRADIENT_COLORS = [
6978
6999
  ];
6979
7000
  const useScrollmapZones = (options) => {
6980
7001
  const { mode = 'basic', enabled = true, iframeRef, wrapperRef } = options;
7002
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
7003
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
6981
7004
  const [isReady, setIsReady] = useState(false);
6982
7005
  const [zones, setZones] = useState([]);
6983
- const { scrollmap } = useHeatmapData();
6984
- const { dataInfo } = useHeatmapData();
6985
7006
  const { getZonePosition } = useZonePositions();
6986
7007
  const scrollMapInfo = dataInfo?.scrollMapInfo;
6987
7008
  const maxUsers = useMemo(() => {
@@ -7128,25 +7149,24 @@ const BoxStack = forwardRef(({ children, ...props }, ref) => {
7128
7149
  BoxStack.displayName = 'BoxStack';
7129
7150
 
7130
7151
  const ContentMetricBar = () => {
7131
- const controls = useHeatmapControlStore((state) => state.controls);
7152
+ const CompMetricBar = useHeatmapControlStore((state) => state.controls.MetricBar);
7132
7153
  const borderBottom = `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`;
7133
7154
  return (jsx(BoxStack, { id: "gx-hm-content-metric-bar", flexDirection: "row", alignItems: "center", overflow: "auto", zIndex: 1, backgroundColor: "white", style: {
7134
7155
  borderBottom,
7135
- }, children: controls.MetricBar ?? null }));
7156
+ }, children: CompMetricBar && jsx(CompMetricBar, {}) }));
7136
7157
  };
7137
7158
  ContentMetricBar.displayName = 'ContentMetricBar';
7138
7159
 
7139
7160
  const ContentSidebar = () => {
7140
- const controls = useHeatmapControlStore((state) => state.controls);
7141
- const state = useHeatmapClick((s) => s.state);
7161
+ const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
7162
+ const state = useHeatmapClickContext((s) => s.state);
7142
7163
  const isHideSidebar = state.hideSidebar;
7143
7164
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
7144
7165
  const mode = useHeatmapConfigStore((state) => state.mode);
7145
- const SidebarComponent = controls.Sidebar ?? null;
7146
7166
  const isCompareMode = mode === 'compare';
7147
7167
  if (isCompareMode)
7148
7168
  return null;
7149
- if (!SidebarComponent)
7169
+ if (!CompSidebar)
7150
7170
  return null;
7151
7171
  return (jsx("div", { className: "gx-hm-sidebar", style: {
7152
7172
  height: '100%',
@@ -7163,7 +7183,7 @@ const ContentSidebar = () => {
7163
7183
  height: '100%',
7164
7184
  width: `calc(${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px)`,
7165
7185
  borderRight: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
7166
- }, children: jsx(SidebarComponent, {}) }) }));
7186
+ }, children: jsx(CompSidebar, {}) }) }));
7167
7187
  };
7168
7188
 
7169
7189
  const PopoverSidebar = () => {
@@ -7171,7 +7191,7 @@ const PopoverSidebar = () => {
7171
7191
  const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
7172
7192
  const CompSidebarActivator = useHeatmapControlStore((state) => state.controls.SidebarActivator);
7173
7193
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
7174
- const state = useHeatmapClick((s) => s.state);
7194
+ const state = useHeatmapClickContext((s) => s.state);
7175
7195
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
7176
7196
  const isCompareMode = mode === 'compare';
7177
7197
  const isHideSidebar = state.hideSidebar;
@@ -7199,15 +7219,10 @@ const PopoverSidebar = () => {
7199
7219
  };
7200
7220
 
7201
7221
  const ContentToolbar = () => {
7202
- const controls = useHeatmapControlStore((state) => state.controls);
7203
- return (jsx("div", { id: "gx-hm-content-toolbar", style: {
7204
- position: 'absolute',
7205
- bottom: 0,
7206
- left: '8px',
7207
- right: '24px',
7208
- padding: '8px',
7209
- paddingBlock: '16px',
7210
- }, children: controls.Toolbar ?? null }));
7222
+ const CompToolbar = useHeatmapControlStore((state) => state.controls.Toolbar);
7223
+ return (jsx(BoxStack, { id: "gx-hm-content-toolbar", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "48px", style: {
7224
+ borderTop: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
7225
+ }, children: CompToolbar && jsx(CompToolbar, {}) }));
7211
7226
  };
7212
7227
 
7213
7228
  const VizContainer = ({ children, isActive = false }) => {
@@ -7761,7 +7776,7 @@ const AreaEditHighlight = ({ element, shadowRoot, onClick }) => {
7761
7776
  AreaEditHighlight.displayName = 'AreaEditHighlight';
7762
7777
 
7763
7778
  const AreaEditHighlightPortal = ({ shadowContainer, iframeRef, customShadowRoot, onAreaCreated, }) => {
7764
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
7779
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
7765
7780
  const { onAreaCreatedElement } = useAreaCreation({ customShadowRoot, onAreaCreated });
7766
7781
  const { hoveredElement } = useAreaEditMode({ iframeRef, enabled: true, onAreaCreatedElement });
7767
7782
  if (!isEditingMode || !hoveredElement)
@@ -7876,7 +7891,7 @@ const AreaOverlay = memo(AreaOverlayComponent, (prevProps, nextProps) => {
7876
7891
  });
7877
7892
 
7878
7893
  const SelectedAreaOverlay = () => {
7879
- const selectedArea = useHeatmapAreaClick((s) => s.selectedArea);
7894
+ const selectedArea = useHeatmapAreaClickContext((s) => s.selectedArea);
7880
7895
  if (!selectedArea)
7881
7896
  return null;
7882
7897
  return (jsx(Fragment$1, { children: jsx("style", { children: `
@@ -7887,13 +7902,13 @@ const SelectedAreaOverlay = () => {
7887
7902
  };
7888
7903
 
7889
7904
  const AreasPortal = ({ shadowContainer, onAreaClick }) => {
7890
- const areas = useHeatmapAreaClick((s) => s.areas);
7905
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
7891
7906
  return createPortal(jsxs(Fragment$1, { children: [areas.map((area) => (jsx(AreaOverlay, { area: area, onAreaClick: onAreaClick }, area.id))), jsx(SelectedAreaOverlay, {})] }), shadowContainer);
7892
7907
  };
7893
7908
 
7894
7909
  const AutoScrollHandler = ({ visualRef }) => {
7895
- const widthScale = useHeatmapViz((s) => s.widthScale);
7896
- const selectedArea = useHeatmapAreaClick((s) => s.selectedArea);
7910
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7911
+ const selectedArea = useHeatmapAreaClickContext((s) => s.selectedArea);
7897
7912
  useEffect(() => {
7898
7913
  if (!selectedArea)
7899
7914
  return;
@@ -7907,7 +7922,7 @@ const AutoScrollHandler = ({ visualRef }) => {
7907
7922
  };
7908
7923
 
7909
7924
  const PortalAreaRenderer = ({ iframeRef, visualRef, shadowRoot, onAreaCreated, onAreaClick, }) => {
7910
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
7925
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
7911
7926
  const iframeDocument = iframeRef.current?.contentDocument || undefined;
7912
7927
  const { shadowContainer, isReady } = useAreaRendererContainer(iframeDocument, shadowRoot);
7913
7928
  useAreaRectSync({ iframeDocument, shadowRoot, enabled: isReady && isRenderViz });
@@ -7918,9 +7933,9 @@ const PortalAreaRenderer = ({ iframeRef, visualRef, shadowRoot, onAreaCreated, o
7918
7933
  };
7919
7934
 
7920
7935
  const VizAreaClick = ({ iframeRef, visualRef, shadowRoot, autoCreateTopN = 10, enableOverlapResolution = true, onAreaClick, }) => {
7921
- const clickAreas = useHeatmapData((s) => s.clickAreas);
7922
- const resetView = useHeatmapAreaClick((s) => s.resetView);
7923
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
7936
+ const clickAreas = useHeatmapDataContext((s) => s.clickAreas);
7937
+ const resetView = useHeatmapAreaClickContext((s) => s.resetView);
7938
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
7924
7939
  useAreaTopAutoDetect({ autoCreateTopN, shadowRoot, disabled: !!clickAreas?.length });
7925
7940
  useAreaFilterVisible({ iframeRef, enableOverlapResolution });
7926
7941
  useAreaHydration({ shadowRoot });
@@ -7936,7 +7951,7 @@ const VizAreaClick = ({ iframeRef, visualRef, shadowRoot, autoCreateTopN = 10, e
7936
7951
  VizAreaClick.displayName = 'VizAreaClick';
7937
7952
 
7938
7953
  const RankBadgeComponent = ({ index, hash, elementRect, widthScale, show = true, clickOnElement, }) => {
7939
- const clickedHash = useHeatmapClick((s) => s.selectedElement?.hash);
7954
+ const clickedHash = useHeatmapClickContext((s) => s.selectedElement?.hash);
7940
7955
  const isShow = !!show && clickedHash !== hash;
7941
7956
  if (!isShow || !ELM_CALLOUT_CONFIG.SHOW_RANK_BADGE)
7942
7957
  return null;
@@ -7948,8 +7963,8 @@ const RankBadge = memo(RankBadgeComponent);
7948
7963
 
7949
7964
  const NUMBER_OF_TOP_ELEMENTS = 10;
7950
7965
  const DefaultRankBadgesComponent = ({ getRect, hidden }) => {
7951
- const dataInfo = useHeatmapData((s) => s.dataInfo);
7952
- const widthScale = useHeatmapViz((s) => s.widthScale);
7966
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
7967
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7953
7968
  const elements = dataInfo?.sortedElements?.slice(0, NUMBER_OF_TOP_ELEMENTS) ?? [];
7954
7969
  if (hidden || elements.length === 0)
7955
7970
  return null;
@@ -7971,7 +7986,7 @@ const DEFAULT_POSITION = {
7971
7986
  };
7972
7987
  const ElementCallout = (props) => {
7973
7988
  const viewId = useViewIdContext();
7974
- const widthScale = useHeatmapViz((s) => s.widthScale);
7989
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7975
7990
  const CompElementCallout = useHeatmapControlStore((state) => state.controls.ElementCallout);
7976
7991
  const calloutRef = useRef(null);
7977
7992
  const element = props.element;
@@ -8003,7 +8018,7 @@ const ElementCallout = (props) => {
8003
8018
  }
8004
8019
  };
8005
8020
  const useAnchorPosition = (calloutRef, props) => {
8006
- const widthScale = useHeatmapViz((s) => s.widthScale);
8021
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8007
8022
  const { target, visualRef, alignment, element, positionMode } = props;
8008
8023
  const [position, setPosition] = useState(DEFAULT_POSITION);
8009
8024
  const isAbsolute = positionMode === 'absolute';
@@ -8058,7 +8073,7 @@ const useAnchorPosition = (calloutRef, props) => {
8058
8073
  };
8059
8074
 
8060
8075
  const ElementMissing = ({ show = true, visualRef }) => {
8061
- const widthScale = useHeatmapViz((s) => s.widthScale);
8076
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8062
8077
  const missingElementRef = useRef(null);
8063
8078
  const wrapperWidth = useHeatmapWidthByDevice();
8064
8079
  const [scrollPosition, setScrollPosition] = useState({ scrollTop: 0, scrollLeft: 0 });
@@ -8173,7 +8188,7 @@ const BackdropCanvas = ({ activeElement, viewportWidth, viewportHeight, borderWi
8173
8188
 
8174
8189
  const ElementCalloutOverlay = (props) => {
8175
8190
  const { element, containerRef } = props;
8176
- const widthScale = useHeatmapViz((s) => s.widthScale);
8191
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8177
8192
  const CompElementCallout = useHeatmapControlStore((state) => state.controls.ElementCallout);
8178
8193
  const calloutRef = useRef(null);
8179
8194
  const [position, setPosition] = useState({
@@ -8212,8 +8227,8 @@ ElementCalloutOverlay.displayName = 'ElementCalloutOverlay';
8212
8227
 
8213
8228
  const ElementOverlayComponent = (props) => {
8214
8229
  const { type, element, onClick, elementId, hideOutline } = props;
8215
- const widthScale = useHeatmapViz((s) => s.widthScale);
8216
- const viewportHeight = useHeatmapVizRect((s) => s.iframeHeight);
8230
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8231
+ const viewportHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8217
8232
  const viewportWidth = useHeatmapWidthByDevice();
8218
8233
  const overlayStyle = useMemo(() => {
8219
8234
  const isInvalid = !element || (element.width === 0 && element.height === 0);
@@ -8254,8 +8269,8 @@ const ElementCalloutClicked = memo(ElementCalloutClickedComponent);
8254
8269
 
8255
8270
  const HoveredElementOverlayComponent = ({ onClick }) => {
8256
8271
  const viewId = useViewIdContext();
8257
- const hoveredElement = useHeatmapHover((s) => s.hoveredElement);
8258
- const clickedElement = useHeatmapClick((s) => s.selectedElement);
8272
+ const hoveredElement = useHeatmapHoverContext((s) => s.hoveredElement);
8273
+ const clickedElement = useHeatmapClickContext((s) => s.selectedElement);
8259
8274
  const handleClick = (event) => {
8260
8275
  if (onClick) {
8261
8276
  onClick(event, hoveredElement?.hash ?? '');
@@ -8272,7 +8287,7 @@ const HoveredElementOverlay = memo(HoveredElementOverlayComponent);
8272
8287
  const IS_SHOW_CALLOUT = false;
8273
8288
  const ElementCalloutHoveredComponent = (props) => {
8274
8289
  const viewId = useViewIdContext();
8275
- useHeatmapHover((s) => s.hoveredElement);
8290
+ useHeatmapHoverContext((s) => s.hoveredElement);
8276
8291
  getHoveredElementId(viewId, props.isSecondary);
8277
8292
  const isShowCallout = IS_SHOW_CALLOUT ;
8278
8293
  return (jsxs(Fragment, { children: [jsx(HoveredElementOverlay, { onClick: props.onClick }), isShowCallout ] }));
@@ -8281,7 +8296,7 @@ const ElementCalloutHovered = memo(ElementCalloutHoveredComponent);
8281
8296
 
8282
8297
  const HeatmapElements = (props) => {
8283
8298
  const viewId = useViewIdContext();
8284
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8299
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8285
8300
  const elementCalloutRef = useRef(null);
8286
8301
  const { iframeDimensions, positionMode } = props;
8287
8302
  const { visualRef, iframeRef, wrapperRef, visualizer } = props;
@@ -8297,8 +8312,8 @@ const HeatmapElements = (props) => {
8297
8312
 
8298
8313
  const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8299
8314
  const contentWidth = useHeatmapWidthByDevice();
8300
- const dataInfo = useHeatmapData((s) => s.dataInfo);
8301
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
8315
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
8316
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
8302
8317
  const visualizer = {
8303
8318
  get: (hash) => {
8304
8319
  if (!vizRef)
@@ -8319,8 +8334,8 @@ const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8319
8334
  };
8320
8335
 
8321
8336
  const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8322
- const clickMode = useHeatmapSetting((state) => state.clickMode);
8323
- const heatmapType = useHeatmapSetting((state) => state.heatmapType);
8337
+ const clickMode = useHeatmapSettingContext((state) => state.clickMode);
8338
+ const heatmapType = useHeatmapSettingContext((state) => state.heatmapType);
8324
8339
  const isClickType = heatmapType === EHeatmapType.Click;
8325
8340
  if (!isClickType)
8326
8341
  return null;
@@ -8335,8 +8350,8 @@ const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8335
8350
  };
8336
8351
 
8337
8352
  const ScrollMapMinimap = ({ zones, maxUsers }) => {
8338
- const scrollType = useHeatmapSetting((s) => s.scrollType);
8339
- const showMinimap = useHeatmapScroll((s) => s.showMinimap);
8353
+ const scrollType = useHeatmapSettingContext((s) => s.scrollType);
8354
+ const showMinimap = useHeatmapScrollContext((s) => s.showMinimap);
8340
8355
  const isScrollType = [EScrollType.Attention].includes(scrollType ?? EScrollType.Depth);
8341
8356
  if (!showMinimap || !isScrollType)
8342
8357
  return null;
@@ -8396,7 +8411,7 @@ const ScrollZoneTooltip = ({ zone, position, currentScrollPercent, scrollmap, })
8396
8411
  };
8397
8412
 
8398
8413
  const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) => {
8399
- const { scrollmap } = useHeatmapData();
8414
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
8400
8415
  // const hoveredZone = useHeatmapVizScrollStore((state) => state.hoveredZone);
8401
8416
  // const setHoveredZone = useHeatmapVizScrollStore((state) => state.setHoveredZone);
8402
8417
  const { zones, isReady, maxUsers } = useScrollmapZones({
@@ -8411,8 +8426,8 @@ const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) =
8411
8426
  };
8412
8427
 
8413
8428
  const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
8414
- const widthScale = useHeatmapViz((s) => s.widthScale);
8415
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8429
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8430
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8416
8431
  const overlayRef = useRef(null);
8417
8432
  const [position, setPosition] = useState();
8418
8433
  const [currentScrollPercent, setCurrentScrollPercent] = useState(0);
@@ -8449,7 +8464,7 @@ const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
8449
8464
  };
8450
8465
 
8451
8466
  const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8452
- const { dataInfo } = useHeatmapData();
8467
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
8453
8468
  const { getZonePosition } = useZonePositions();
8454
8469
  const averageFold = dataInfo?.averageFold || 50;
8455
8470
  const position = getZonePosition({
@@ -8486,8 +8501,8 @@ const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8486
8501
  };
8487
8502
 
8488
8503
  const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8489
- const scrollType = useHeatmapSetting((s) => s.scrollType);
8490
- const { scrollmap } = useHeatmapData();
8504
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
8505
+ const scrollType = useHeatmapSettingContext((s) => s.scrollType);
8491
8506
  const { getZonePosition } = useZonePositions();
8492
8507
  if (!scrollmap || scrollmap.length === 0)
8493
8508
  return null;
@@ -8562,8 +8577,8 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8562
8577
 
8563
8578
  const SCROLL_TYPES = [EHeatmapType.Scroll];
8564
8579
  const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8565
- const heatmapType = useHeatmapSetting((s) => s.heatmapType);
8566
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8580
+ const heatmapType = useHeatmapSettingContext((s) => s.heatmapType);
8581
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8567
8582
  // useRenderCount('VizScrollMap');
8568
8583
  const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? EHeatmapType.Click);
8569
8584
  if (!iframeHeight || !isHeatmapScroll)
@@ -8579,12 +8594,29 @@ const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8579
8594
  }, children: [jsx(ScrollmapMarker, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(AverageFoldLine, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(ScrollMapOverlay, { wrapperRef: wrapperRef, iframeRef: iframeRef })] }));
8580
8595
  };
8581
8596
 
8597
+ const VizLoadingCanvas = () => {
8598
+ const isLoadingCanvas = useHeatmapSettingContext((state) => state.isLoadingCanvas);
8599
+ const CompLoading = useHeatmapControlStore((s) => s.controls.VizLoading);
8600
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8601
+ if (!isLoadingCanvas)
8602
+ return null;
8603
+ return (jsx("div", { className: "gx-hm-loading-canvas", style: {
8604
+ background: '#000000B2',
8605
+ }, children: jsx(BoxStack, { position: "absolute", height: wrapperHeight, flexDirection: "row", justifyContent: "center", alignItems: "center", style: {
8606
+ width: '100%',
8607
+ top: 0,
8608
+ left: 0,
8609
+ }, children: jsx("div", { style: { height: 'fit-content' }, children: CompLoading && jsx(CompLoading, { type: "transparent" }) }) }) }));
8610
+ };
8611
+
8582
8612
  const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHeight, onScroll, }) => {
8583
- const widthScale = useHeatmapViz((s) => s.widthScale);
8613
+ const isLoadingCanvas = useHeatmapSettingContext((state) => state.isLoadingCanvas);
8614
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8584
8615
  const contentWidth = useHeatmapWidthByDevice();
8585
8616
  const contentHeight = calcContentHeight();
8586
8617
  return (jsx("div", { ref: visualRef, className: "gx-hm-visual", onScroll: onScroll, style: {
8587
- overflow: 'hidden scroll',
8618
+ overflowX: 'hidden',
8619
+ overflowY: iframeHeight > 0 && !isLoadingCanvas ? 'scroll' : 'hidden',
8588
8620
  display: 'flex',
8589
8621
  position: 'relative',
8590
8622
  justifyContent: 'center',
@@ -8596,6 +8628,7 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8596
8628
  display: 'flex',
8597
8629
  justifyContent: 'center',
8598
8630
  alignItems: 'flex-start',
8631
+ position: 'relative',
8599
8632
  height: contentHeight,
8600
8633
  padding: HEATMAP_STYLE['wrapper']['padding'],
8601
8634
  paddingBottom: HEATMAP_STYLE['viz']['paddingBottom'],
@@ -8617,8 +8650,8 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8617
8650
  const VizDomRenderer = ({ mode = 'heatmap' }) => {
8618
8651
  const viewId = useViewIdContext();
8619
8652
  const contentWidth = useHeatmapWidthByDevice();
8620
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8621
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8653
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8654
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8622
8655
  const wrapperRef = useRef(null);
8623
8656
  const visualRef = useRef(null);
8624
8657
  const { iframeRef } = useHeatmapRenderByMode(mode);
@@ -8629,23 +8662,30 @@ const VizDomRenderer = ({ mode = 'heatmap' }) => {
8629
8662
  const scrollTop = e.currentTarget.scrollTop;
8630
8663
  handleScroll(scrollTop);
8631
8664
  };
8632
- 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 })] }));
8665
+ 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(VizLoadingCanvas, {}), jsx(VizScrollMap, { iframeRef: iframeRef, wrapperRef: visualRef })] }));
8633
8666
  };
8634
8667
 
8635
8668
  const VizLoading = () => {
8636
- return (jsxs("div", { className: "gx-hm-loading", children: [jsx("div", { className: "gx-hm-loading--spinner" }), jsx("p", { className: "gx-hm-loading--text", children: "Loading visualization..." })] }));
8669
+ const CompLoading = useHeatmapControlStore((s) => s.controls.VizLoading);
8670
+ return (jsx("div", { className: "gx-hm-loading", style: {
8671
+ // width: `calc(100% - ${contentWidth * widthScale}px)`,
8672
+ display: 'flex',
8673
+ justifyContent: 'center',
8674
+ alignItems: 'center',
8675
+ background: 'rgba(255, 255, 255, 0.75)',
8676
+ }, children: CompLoading && jsx(CompLoading, { type: "default" }) }));
8637
8677
  };
8638
8678
 
8639
8679
  const VizDomHeatmap = () => {
8640
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8641
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
8642
- const setVizRef = useHeatmapVizRect((s) => s.setVizRef);
8643
- const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
8644
- const setSelectedElement = useHeatmapClick((s) => s.setSelectedElement);
8645
- const setHoveredElement = useHeatmapHover((s) => s.setHoveredElement);
8646
- // const setSelectedArea = useHeatmapAreaClick((s) => s.setSelectedArea);
8647
- // const setHoveredArea = useHeatmapAreaClick((s) => s.setHoveredArea);
8648
- // const setAreas = useHeatmapAreaClick((s) => s.setAreas);
8680
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8681
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
8682
+ const setVizRef = useHeatmapVizRectContext((s) => s.setVizRef);
8683
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
8684
+ const setSelectedElement = useHeatmapClickContext((s) => s.setSelectedElement);
8685
+ const setHoveredElement = useHeatmapHoverContext((s) => s.setHoveredElement);
8686
+ // const setSelectedArea = useHeatmapAreaClickContext((s) => s.setSelectedArea);
8687
+ // const setHoveredArea = useHeatmapAreaClickContext((s) => s.setHoveredArea);
8688
+ // const setAreas = useHeatmapAreaClickContext((s) => s.setAreas);
8649
8689
  useRenderCount('VizDomHeatmap');
8650
8690
  const cleanUp = () => {
8651
8691
  setVizRef(null);
@@ -8666,8 +8706,8 @@ VizDomHeatmap.displayName = 'VizDomHeatmap';
8666
8706
 
8667
8707
  const VizLiveRenderer = () => {
8668
8708
  const contentWidth = useHeatmapWidthByDevice();
8669
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8670
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8709
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8710
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8671
8711
  const visualRef = useRef(null);
8672
8712
  const wrapperRef = useRef(null);
8673
8713
  const { iframeRef } = useVizLiveRender();
@@ -8680,25 +8720,28 @@ const VizLiveRenderer = () => {
8680
8720
  };
8681
8721
 
8682
8722
  const VizLiveHeatmap = () => {
8683
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8684
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8723
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8724
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8685
8725
  useHeatmapLiveStore((state) => state.reset);
8726
+ const CompVizLoading = useHeatmapControlStore((state) => state.controls.VizLoading);
8686
8727
  // TODO: Remove this after testing
8687
8728
  useEffect(() => {
8688
8729
  return () => {
8689
8730
  // reset();
8690
8731
  };
8691
8732
  }, []);
8692
- return (jsxs(VizContainer, { isActive: true, children: [jsx(VizLiveRenderer, {}), (!iframeHeight || !wrapperHeight) && jsx(VizLoading, {})] }));
8733
+ return (jsxs(VizContainer, { isActive: true, children: [jsx(VizLiveRenderer, {}), ((!iframeHeight || !wrapperHeight) && CompVizLoading && jsx(CompVizLoading, { type: "transparent" })) || null] }));
8693
8734
  };
8694
8735
  VizLiveHeatmap.displayName = 'VizLiveHeatmap';
8695
8736
 
8696
8737
  const ContentVizByMode = () => {
8697
8738
  const mode = useHeatmapConfigStore((state) => state.mode);
8698
- const controls = useHeatmapControlStore((state) => state.controls);
8699
- const isRendering = useHeatmapSetting((state) => state.isRendering);
8700
- if (isRendering)
8701
- return controls.VizLoading ?? null;
8739
+ const CompVizLoading = useHeatmapControlStore((state) => state.controls.VizLoading);
8740
+ const isRendering = useHeatmapSettingContext((state) => state.isRendering);
8741
+ const isLoadingDom = useHeatmapSettingContext((state) => state.isLoadingDom);
8742
+ if (isRendering || isLoadingDom) {
8743
+ return (CompVizLoading && jsx(CompVizLoading, { type: "default" })) || null;
8744
+ }
8702
8745
  switch (mode) {
8703
8746
  case 'live':
8704
8747
  return jsx(VizLiveHeatmap, {});
@@ -8711,22 +8754,30 @@ const ContentVizByMode = () => {
8711
8754
  ContentVizByMode.displayName = 'ContentVizByMode';
8712
8755
 
8713
8756
  const HeatmapPreview = () => {
8714
- return (jsxs(BoxStack, { id: "gx-hm-container", flexDirection: "row", overflow: "hidden", flex: "1", position: "relative", children: [jsx(ContentSidebar, {}), jsxs(BoxStack, { flexDirection: "column", flex: "1", children: [jsx(ContentMetricBar, {}), jsx(ContentVizByMode, {}), jsx(ContentToolbar, {})] })] }));
8757
+ return (jsxs(BoxStack, { id: "gx-hm-container", flexDirection: "row", overflow: "hidden", flex: "1", position: "relative", children: [jsx(ContentSidebar, {}), jsx(BoxStack, { flexDirection: "column", flex: "1", children: jsx(ContentRightPreview, {}) })] }));
8758
+ };
8759
+ const ContentRightPreview = () => {
8760
+ const data = useHeatmapDataContext((state) => state.data);
8761
+ const CompEmptyState = useHeatmapControlStore((state) => state.controls.EmptyState);
8762
+ const isLoadingDom = useHeatmapSettingContext((state) => state.isLoadingDom);
8763
+ if (!isLoadingDom && (!data || data.length === 0)) {
8764
+ return CompEmptyState ? jsx(CompEmptyState, {}) : 'EmptyState not found';
8765
+ }
8766
+ return (jsxs(Fragment, { children: [jsx(ContentMetricBar, {}), jsx(BoxStack, { flexDirection: "column", flex: "1", children: jsx(ContentVizByMode, {}) }), jsx(ContentToolbar, {})] }));
8715
8767
  };
8716
8768
 
8717
8769
  const ContentTopBar = () => {
8718
- const controls = useHeatmapControlStore((state) => state.controls);
8719
- const TopBar = controls.TopBar;
8770
+ const CompTopBar = useHeatmapControlStore((state) => state.controls.TopBar);
8720
8771
  return (jsx(BoxStack, { id: "gx-hm-content-header", flexDirection: "row", alignItems: "center", overflow: "auto", zIndex: 1, backgroundColor: "white", style: {
8721
8772
  borderBottom: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
8722
- }, children: TopBar && jsx(TopBar, {}) }));
8773
+ }, children: CompTopBar && jsx(CompTopBar, {}) }));
8723
8774
  };
8724
8775
 
8725
- const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, }) => {
8776
+ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, isLoading, isLoadingCanvas, }) => {
8726
8777
  useRegisterControl(controls);
8727
8778
  useRegisterData(data, dataInfo);
8728
8779
  useRegisterHeatmap({ clickmap, scrollmap, clickAreas });
8729
- useRegisterConfig();
8780
+ useRegisterConfig({ isLoading, isLoadingCanvas });
8730
8781
  // performanceLogger.configure({
8731
8782
  // enabled: true,
8732
8783
  // logToConsole: false,
@@ -8755,4 +8806,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
8755
8806
  }
8756
8807
  };
8757
8808
 
8758
- export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, EClickMode, EClickRankType, EClickType, EDeviceType, EHeatmapType, ELM_CALLOUT_CONFIG, EScrollType, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, createViewContextHook, 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 };
8809
+ export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, EClickMode, EClickRankType, EClickType, EDeviceType, EHeatmapType, ELM_CALLOUT_CONFIG, EScrollType, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, createViewContextHook, downloadPerformanceReport, getCompareViewId, getMetricsByViewId, getPerformanceReportJSON, getScrollGradientColor, performanceLogger, printPerformanceSummary, scrollToElementIfNeeded, sendPerformanceReport, serializeAreas, trackStoreAction, useAreaCreation, useAreaEditMode, useAreaFilterVisible, useAreaHydration, useAreaInteraction, useAreaPositionsUpdater, useAreaRectSync, useAreaRendererContainer, useAreaTopAutoDetect, useClickedElement, useDebounceCallback, useElementCalloutVisible, useHeatmapAreaClickContext, useHeatmapCanvas, useHeatmapClickContext, useHeatmapCompareStore, useHeatmapConfigStore, useHeatmapCopyView, useHeatmapDataContext, useHeatmapEffects, useHeatmapElementPosition, useHeatmapHoverContext, useHeatmapLiveStore, useHeatmapRenderByMode, useHeatmapScale, useHeatmapScrollContext, useHeatmapSettingContext, useHeatmapVizContext, useHeatmapVizRectContext, useHeatmapWidthByDevice, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };