@gemx-dev/heatmap-react 3.5.71 → 3.5.72

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 (114) 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/view-context/index.d.ts +8 -8
  21. package/dist/esm/hooks/view-context/index.d.ts.map +1 -1
  22. package/dist/esm/hooks/view-context/{useHeatmapAreaClick.d.ts → useHeatmapAreaClickContext.d.ts} +2 -2
  23. package/dist/esm/hooks/view-context/useHeatmapAreaClickContext.d.ts.map +1 -0
  24. package/dist/esm/hooks/view-context/{useHeatmapClick.d.ts → useHeatmapClickContext.d.ts} +5 -5
  25. package/dist/esm/hooks/view-context/useHeatmapClickContext.d.ts.map +1 -0
  26. package/dist/{umd/hooks/view-context/useHeatmapData.d.ts → esm/hooks/view-context/useHeatmapDataContext.d.ts} +5 -5
  27. package/dist/esm/hooks/view-context/useHeatmapDataContext.d.ts.map +1 -0
  28. package/dist/{umd/hooks/view-context/useHeatmapHover.d.ts → esm/hooks/view-context/useHeatmapHoverContext.d.ts} +2 -2
  29. package/dist/esm/hooks/view-context/useHeatmapHoverContext.d.ts.map +1 -0
  30. package/dist/{umd/hooks/view-context/useHeatmapScroll.d.ts → esm/hooks/view-context/useHeatmapScrollContext.d.ts} +2 -2
  31. package/dist/esm/hooks/view-context/useHeatmapScrollContext.d.ts.map +1 -0
  32. package/dist/{umd/hooks/view-context/useHeatmapSetting.d.ts → esm/hooks/view-context/useHeatmapSettingContext.d.ts} +8 -3
  33. package/dist/esm/hooks/view-context/useHeatmapSettingContext.d.ts.map +1 -0
  34. package/dist/{umd/hooks/view-context/useHeatmapViz.d.ts → esm/hooks/view-context/useHeatmapVizContext.d.ts} +2 -2
  35. package/dist/esm/hooks/view-context/useHeatmapVizContext.d.ts.map +1 -0
  36. package/dist/esm/hooks/view-context/useHeatmapVizRectContext.d.ts +23 -0
  37. package/dist/esm/hooks/view-context/useHeatmapVizRectContext.d.ts.map +1 -0
  38. package/dist/esm/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
  39. package/dist/esm/hooks/viz-render/useReplayRender.d.ts.map +1 -1
  40. package/dist/esm/hooks/viz-scroll/useScrollmapZones.d.ts.map +1 -1
  41. package/dist/esm/index.js +258 -219
  42. package/dist/esm/index.mjs +258 -219
  43. package/dist/esm/stores/setting.d.ts +4 -0
  44. package/dist/esm/stores/setting.d.ts.map +1 -1
  45. package/dist/esm/types/control.d.ts +5 -3
  46. package/dist/esm/types/control.d.ts.map +1 -1
  47. package/dist/esm/types/heatmap-info.d.ts +2 -0
  48. package/dist/esm/types/heatmap-info.d.ts.map +1 -1
  49. package/dist/umd/components/Layout/HeatmapLayout.d.ts +2 -0
  50. package/dist/umd/components/Layout/HeatmapLayout.d.ts.map +1 -1
  51. package/dist/umd/components/Layout/HeatmapPreview.d.ts.map +1 -1
  52. package/dist/umd/components/Layout/Sidebar/ContentSidebar.d.ts.map +1 -1
  53. package/dist/umd/components/Layout/Toolbar/ContentToolbar.d.ts.map +1 -1
  54. package/dist/umd/components/Layout/TopBar/ContentTopBar.d.ts.map +1 -1
  55. package/dist/umd/components/Layout/VizByMode/ContentVizByMode.d.ts.map +1 -1
  56. package/dist/umd/components/VizDom/VizDomHeatmap.d.ts.map +1 -1
  57. package/dist/umd/components/VizDom/VizDomRenderer.d.ts.map +1 -1
  58. package/dist/umd/components/VizDom/VizLoading.d.ts.map +1 -1
  59. package/dist/umd/components/VizDom/VizLoadingCanvas.d.ts +2 -0
  60. package/dist/umd/components/VizDom/VizLoadingCanvas.d.ts.map +1 -0
  61. package/dist/umd/components/VizDom/WrapperVisual.d.ts.map +1 -1
  62. package/dist/umd/components/VizLive/VizLiveHeatmap.d.ts.map +1 -1
  63. package/dist/umd/components/VizScrollmap/AverageFoldLine.d.ts.map +1 -1
  64. package/dist/umd/hooks/index.d.ts +1 -1
  65. package/dist/umd/hooks/index.d.ts.map +1 -1
  66. package/dist/umd/hooks/register/useRegisterConfig.d.ts +4 -1
  67. package/dist/umd/hooks/register/useRegisterConfig.d.ts.map +1 -1
  68. package/dist/umd/hooks/view-context/index.d.ts +8 -8
  69. package/dist/umd/hooks/view-context/index.d.ts.map +1 -1
  70. package/dist/umd/hooks/view-context/{useHeatmapAreaClick.d.ts → useHeatmapAreaClickContext.d.ts} +2 -2
  71. package/dist/umd/hooks/view-context/useHeatmapAreaClickContext.d.ts.map +1 -0
  72. package/dist/umd/hooks/view-context/{useHeatmapClick.d.ts → useHeatmapClickContext.d.ts} +5 -5
  73. package/dist/umd/hooks/view-context/useHeatmapClickContext.d.ts.map +1 -0
  74. package/dist/{esm/hooks/view-context/useHeatmapData.d.ts → umd/hooks/view-context/useHeatmapDataContext.d.ts} +5 -5
  75. package/dist/umd/hooks/view-context/useHeatmapDataContext.d.ts.map +1 -0
  76. package/dist/{esm/hooks/view-context/useHeatmapHover.d.ts → umd/hooks/view-context/useHeatmapHoverContext.d.ts} +2 -2
  77. package/dist/umd/hooks/view-context/useHeatmapHoverContext.d.ts.map +1 -0
  78. package/dist/{esm/hooks/view-context/useHeatmapScroll.d.ts → umd/hooks/view-context/useHeatmapScrollContext.d.ts} +2 -2
  79. package/dist/umd/hooks/view-context/useHeatmapScrollContext.d.ts.map +1 -0
  80. package/dist/{esm/hooks/view-context/useHeatmapSetting.d.ts → umd/hooks/view-context/useHeatmapSettingContext.d.ts} +8 -3
  81. package/dist/umd/hooks/view-context/useHeatmapSettingContext.d.ts.map +1 -0
  82. package/dist/{esm/hooks/view-context/useHeatmapViz.d.ts → umd/hooks/view-context/useHeatmapVizContext.d.ts} +2 -2
  83. package/dist/umd/hooks/view-context/useHeatmapVizContext.d.ts.map +1 -0
  84. package/dist/umd/hooks/view-context/useHeatmapVizRectContext.d.ts +23 -0
  85. package/dist/umd/hooks/view-context/useHeatmapVizRectContext.d.ts.map +1 -0
  86. package/dist/umd/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
  87. package/dist/umd/hooks/viz-render/useReplayRender.d.ts.map +1 -1
  88. package/dist/umd/hooks/viz-scroll/useScrollmapZones.d.ts.map +1 -1
  89. package/dist/umd/index.js +2 -2
  90. package/dist/umd/stores/setting.d.ts +4 -0
  91. package/dist/umd/stores/setting.d.ts.map +1 -1
  92. package/dist/umd/types/control.d.ts +5 -3
  93. package/dist/umd/types/control.d.ts.map +1 -1
  94. package/dist/umd/types/heatmap-info.d.ts +2 -0
  95. package/dist/umd/types/heatmap-info.d.ts.map +1 -1
  96. package/package.json +1 -1
  97. package/dist/esm/hooks/view-context/useHeatmapAreaClick.d.ts.map +0 -1
  98. package/dist/esm/hooks/view-context/useHeatmapClick.d.ts.map +0 -1
  99. package/dist/esm/hooks/view-context/useHeatmapData.d.ts.map +0 -1
  100. package/dist/esm/hooks/view-context/useHeatmapHover.d.ts.map +0 -1
  101. package/dist/esm/hooks/view-context/useHeatmapScroll.d.ts.map +0 -1
  102. package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts.map +0 -1
  103. package/dist/esm/hooks/view-context/useHeatmapViz.d.ts.map +0 -1
  104. package/dist/esm/hooks/view-context/useHeatmapVizRect.d.ts +0 -60
  105. package/dist/esm/hooks/view-context/useHeatmapVizRect.d.ts.map +0 -1
  106. package/dist/umd/hooks/view-context/useHeatmapAreaClick.d.ts.map +0 -1
  107. package/dist/umd/hooks/view-context/useHeatmapClick.d.ts.map +0 -1
  108. package/dist/umd/hooks/view-context/useHeatmapData.d.ts.map +0 -1
  109. package/dist/umd/hooks/view-context/useHeatmapHover.d.ts.map +0 -1
  110. package/dist/umd/hooks/view-context/useHeatmapScroll.d.ts.map +0 -1
  111. package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts.map +0 -1
  112. package/dist/umd/hooks/view-context/useHeatmapViz.d.ts.map +0 -1
  113. package/dist/umd/hooks/view-context/useHeatmapVizRect.d.ts +0 -60
  114. 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
  },
@@ -416,6 +416,8 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
416
416
  const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
417
417
  return {
418
418
  isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
419
+ isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
420
+ isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
419
421
  rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
420
422
  deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
421
423
  clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
@@ -432,6 +434,16 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
432
434
  newDeviceType.set(viewId, deviceType);
433
435
  return { deviceType: newDeviceType };
434
436
  }),
437
+ setIsLoadingDom: (isLoadingDom, viewId = DEFAULT_VIEW_ID) => set((prev) => {
438
+ const newIsLoadingDom = new Map(prev.isLoadingDom);
439
+ newIsLoadingDom.set(viewId, isLoadingDom);
440
+ return { isLoadingDom: newIsLoadingDom };
441
+ }),
442
+ setIsLoadingCanvas: (isLoadingCanvas, viewId = DEFAULT_VIEW_ID) => set((prev) => {
443
+ const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
444
+ newIsLoadingCanvas.set(viewId, isLoadingCanvas);
445
+ return { isLoadingCanvas: newIsLoadingCanvas };
446
+ }),
435
447
  setRankedBy: (rankedBy, viewId = DEFAULT_VIEW_ID) => set((prev) => {
436
448
  const newRankedBy = new Map(prev.rankedBy);
437
449
  newRankedBy.set(viewId, rankedBy);
@@ -458,6 +470,8 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
458
470
  return { heatmapType: newHeatmapType };
459
471
  }),
460
472
  copyView: (fromViewId, toViewId) => set((prev) => {
473
+ const newIsLoadingDom = new Map(prev.isLoadingDom);
474
+ const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
461
475
  const newRankedBy = new Map(prev.rankedBy);
462
476
  const newDeviceType = new Map(prev.deviceType);
463
477
  const newClickType = new Map(prev.clickType);
@@ -470,8 +484,12 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
470
484
  newClickMode.set(toViewId, prev.clickMode.get(fromViewId));
471
485
  newScrollType.set(toViewId, prev.scrollType.get(fromViewId));
472
486
  newHeatmapType.set(toViewId, prev.heatmapType.get(fromViewId));
487
+ newIsLoadingDom.set(toViewId, prev.isLoadingDom.get(fromViewId) ?? false);
488
+ newIsLoadingCanvas.set(toViewId, prev.isLoadingCanvas.get(fromViewId) ?? false);
473
489
  return {
474
490
  rankedBy: newRankedBy,
491
+ isLoadingDom: newIsLoadingDom,
492
+ isLoadingCanvas: newIsLoadingCanvas,
475
493
  deviceType: newDeviceType,
476
494
  clickType: newClickType,
477
495
  clickMode: newClickMode,
@@ -481,12 +499,16 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
481
499
  }),
482
500
  clearView: (viewId) => set((prev) => {
483
501
  const newRankedBy = new Map(prev.rankedBy);
502
+ const newIsLoadingDom = new Map(prev.isLoadingDom);
503
+ const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
484
504
  const newDeviceType = new Map(prev.deviceType);
485
505
  const newClickType = new Map(prev.clickType);
486
506
  const newClickMode = new Map(prev.clickMode);
487
507
  const newScrollType = new Map(prev.scrollType);
488
508
  const newHeatmapType = new Map(prev.heatmapType);
489
509
  newRankedBy.delete(viewId);
510
+ newIsLoadingDom.delete(viewId);
511
+ newIsLoadingCanvas.delete(viewId);
490
512
  newDeviceType.delete(viewId);
491
513
  newClickType.delete(viewId);
492
514
  newClickMode.delete(viewId);
@@ -494,6 +516,8 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
494
516
  newHeatmapType.delete(viewId);
495
517
  return {
496
518
  rankedBy: newRankedBy,
519
+ isLoadingDom: newIsLoadingDom,
520
+ isLoadingCanvas: newIsLoadingCanvas,
497
521
  deviceType: newDeviceType,
498
522
  clickType: newClickType,
499
523
  clickMode: newClickMode,
@@ -503,6 +527,8 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
503
527
  }),
504
528
  resetAll: () => set({
505
529
  isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
530
+ isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
531
+ isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
506
532
  rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
507
533
  deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
508
534
  clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
@@ -1059,7 +1085,7 @@ const useHeatmapVizRectStore = create()(subscribeWithSelector((set) => {
1059
1085
  };
1060
1086
  }));
1061
1087
 
1062
- const useHeatmapAreaClick = createViewContextHook({
1088
+ const useHeatmapAreaClickContext = createViewContextHook({
1063
1089
  useStore: useHeatmapVizClickAreaStore,
1064
1090
  getState: (store, viewId) => ({
1065
1091
  selectedArea: store.selectedArea.get(viewId) ?? null,
@@ -1093,14 +1119,14 @@ const DEFAULT_STATE = { hideSidebar: false };
1093
1119
  * @example
1094
1120
  * ```tsx
1095
1121
  * // Get everything
1096
- * const { state, selectedElement, setSelectedElement } = useHeatmapClick();
1122
+ * const { state, selectedElement, setSelectedElement } = useHeatmapClickContext();
1097
1123
  *
1098
1124
  * // Get only what you need (no unnecessary re-renders)
1099
- * const setSelectedElement = useHeatmapClick(s => s.setSelectedElement);
1100
- * const selectedElement = useHeatmapClick(s => s.selectedElement);
1125
+ * const setSelectedElement = useHeatmapClickContext(s => s.setSelectedElement);
1126
+ * const selectedElement = useHeatmapClickContext(s => s.selectedElement);
1101
1127
  * ```
1102
1128
  */
1103
- const useHeatmapClick = createViewContextHook({
1129
+ const useHeatmapClickContext = createViewContextHook({
1104
1130
  useStore: useHeatmapVizClickStore,
1105
1131
  getState: (store, viewId) => ({
1106
1132
  state: store.state.get(viewId) ?? DEFAULT_STATE,
@@ -1120,17 +1146,17 @@ const useHeatmapClick = createViewContextHook({
1120
1146
  * @example
1121
1147
  * ```tsx
1122
1148
  * // Get everything
1123
- * const { data, clickmap, setData } = useHeatmapData();
1149
+ * const { data, clickmap, setData } = useHeatmapDataContext();
1124
1150
  *
1125
1151
  * // Get only what you need (no unnecessary re-renders)
1126
- * const data = useHeatmapData(s => s.data);
1127
- * const { setData, setClickmap } = useHeatmapData(s => ({
1152
+ * const data = useHeatmapDataContext(s => s.data);
1153
+ * const { setData, setClickmap } = useHeatmapDataContext(s => ({
1128
1154
  * setData: s.setData,
1129
1155
  * setClickmap: s.setClickmap,
1130
1156
  * }));
1131
1157
  * ```
1132
1158
  */
1133
- const useHeatmapData = createViewContextHook({
1159
+ const useHeatmapDataContext = createViewContextHook({
1134
1160
  useStore: useHeatmapDataStore,
1135
1161
  getState: (store, viewId) => ({
1136
1162
  data: store.data.get(viewId),
@@ -1151,7 +1177,7 @@ const useHeatmapData = createViewContextHook({
1151
1177
  }),
1152
1178
  });
1153
1179
 
1154
- const useHeatmapHover = createViewContextHook({
1180
+ const useHeatmapHoverContext = createViewContextHook({
1155
1181
  useStore: useHeatmapVizHoverStore,
1156
1182
  getState: (store, viewId) => ({
1157
1183
  hoveredElement: store.hoveredElement.get(viewId) ?? null,
@@ -1162,7 +1188,7 @@ const useHeatmapHover = createViewContextHook({
1162
1188
  }),
1163
1189
  });
1164
1190
 
1165
- const useHeatmapScroll = createViewContextHook({
1191
+ const useHeatmapScrollContext = createViewContextHook({
1166
1192
  useStore: useHeatmapVizScrollStore,
1167
1193
  getState: (store, viewId) => ({
1168
1194
  zones: store.zones.get(viewId) ?? [],
@@ -1176,12 +1202,14 @@ const useHeatmapScroll = createViewContextHook({
1176
1202
  }),
1177
1203
  });
1178
1204
 
1179
- const useHeatmapSetting = createViewContextHook({
1205
+ const useHeatmapSettingContext = createViewContextHook({
1180
1206
  useStore: useHeatmapSettingStore,
1181
1207
  getState: (store, viewId) => ({
1182
1208
  isRendering: !!store.isRendering.get(viewId),
1209
+ isLoadingDom: !!store.isLoadingDom.get(viewId),
1210
+ isLoadingCanvas: !!store.isLoadingCanvas.get(viewId),
1183
1211
  rankedBy: store.rankedBy.get(viewId),
1184
- deviceType: store.deviceType.get(viewId),
1212
+ deviceType: store.deviceType.get(viewId) ?? EDeviceType.Desktop,
1185
1213
  clickType: store.clickType.get(viewId),
1186
1214
  clickMode: store.clickMode.get(viewId),
1187
1215
  scrollType: store.scrollType.get(viewId),
@@ -1195,11 +1223,13 @@ const useHeatmapSetting = createViewContextHook({
1195
1223
  setScrollType: (scrollType) => store.setScrollType(scrollType, viewId),
1196
1224
  setHeatmapType: (heatmapType) => store.setHeatmapType(heatmapType, viewId),
1197
1225
  setIsRendering: (isRendering) => store.setIsRendering(isRendering, viewId),
1226
+ setIsLoadingDom: (isLoadingDom) => store.setIsLoadingDom(isLoadingDom, viewId),
1227
+ setIsLoadingCanvas: (isLoadingCanvas) => store.setIsLoadingCanvas(isLoadingCanvas, viewId),
1198
1228
  clearView: (viewId) => store.clearView(viewId),
1199
1229
  }),
1200
1230
  });
1201
1231
 
1202
- const useHeatmapViz = createViewContextHook({
1232
+ const useHeatmapVizContext = createViewContextHook({
1203
1233
  useStore: useHeatmapVizStore,
1204
1234
  getState: (store, viewId) => ({
1205
1235
  isRenderViz: store.isRenderViz.get(viewId) ?? false,
@@ -1219,26 +1249,7 @@ const useHeatmapViz = createViewContextHook({
1219
1249
  }),
1220
1250
  });
1221
1251
 
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({
1252
+ const useHeatmapVizRectContext = createViewContextHook({
1242
1253
  useStore: useHeatmapVizRectStore,
1243
1254
  getState: (store, viewId) => ({
1244
1255
  vizRef: store.vizRef.get(viewId) ?? null,
@@ -1332,7 +1343,7 @@ const useHeatmapCopyView = () => {
1332
1343
  };
1333
1344
 
1334
1345
  const useHeatmapWidthByDevice = () => {
1335
- const deviceType = useHeatmapSetting((state) => state.deviceType);
1346
+ const deviceType = useHeatmapSettingContext((state) => state.deviceType);
1336
1347
  const width = useMemo(() => calcWidthByDeviceType(deviceType), [deviceType]);
1337
1348
  return width;
1338
1349
  function calcWidthByDeviceType(deviceType) {
@@ -1349,19 +1360,26 @@ const useHeatmapWidthByDevice = () => {
1349
1360
  }
1350
1361
  };
1351
1362
 
1352
- const useRegisterConfig = () => {
1363
+ const useRegisterConfig = ({ isLoading, isLoadingCanvas, }) => {
1353
1364
  const mode = useHeatmapConfigStore((state) => state.mode);
1354
- const deviceType = useHeatmapSetting((state) => state.deviceType);
1365
+ const deviceType = useHeatmapSettingContext((state) => state.deviceType);
1355
1366
  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);
1367
+ const setIsRendering = useHeatmapSettingContext((state) => state.setIsRendering);
1368
+ const setIsLoadingDom = useHeatmapSettingContext((state) => state.setIsLoadingDom);
1369
+ const setIsLoadingCanvas = useHeatmapSettingContext((state) => state.setIsLoadingCanvas);
1359
1370
  useEffect(() => {
1360
1371
  setIsRendering(true);
1361
1372
  setTimeout(() => {
1362
1373
  setIsRendering(false);
1363
- }, 1000);
1374
+ }, 100);
1364
1375
  }, [mode, deviceType, sidebarWidth]); // eslint-disable-line react-hooks/exhaustive-deps
1376
+ useEffect(() => {
1377
+ setIsRendering(!!isLoading);
1378
+ setIsLoadingDom(!!isLoading);
1379
+ }, [isLoading, setIsLoadingDom, setIsRendering]);
1380
+ useEffect(() => {
1381
+ setIsLoadingCanvas(!!isLoadingCanvas);
1382
+ }, [isLoadingCanvas, setIsLoadingCanvas]);
1365
1383
  };
1366
1384
 
1367
1385
  const useRegisterControl = (control) => {
@@ -1383,9 +1401,9 @@ const useRegisterControl = (control) => {
1383
1401
  };
1384
1402
 
1385
1403
  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);
1404
+ const setIsRendering = useHeatmapSettingContext((s) => s.setIsRendering);
1405
+ const setData = useHeatmapDataContext((s) => s.setData);
1406
+ const setDataInfo = useHeatmapDataContext((s) => s.setDataInfo);
1389
1407
  const isRegistered = useRef(false);
1390
1408
  useEffect(() => {
1391
1409
  if (isRegistered.current)
@@ -1402,9 +1420,9 @@ const useRegisterData = (data, dataInfo) => {
1402
1420
  };
1403
1421
 
1404
1422
  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);
1423
+ const setClickmap = useHeatmapDataContext((s) => s.setClickmap);
1424
+ const setScrollmap = useHeatmapDataContext((s) => s.setScrollmap);
1425
+ const setClickAreas = useHeatmapDataContext((s) => s.setClickAreas);
1408
1426
  const isRegistered = useRef(false);
1409
1427
  useEffect(() => {
1410
1428
  if (isRegistered.current)
@@ -4012,11 +4030,11 @@ function removeConflictingAreas(conflicts, removeArea) {
4012
4030
  });
4013
4031
  }
4014
4032
  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);
4033
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4034
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4035
+ const addArea = useHeatmapAreaClickContext((s) => s.addArea);
4036
+ const removeArea = useHeatmapAreaClickContext((s) => s.removeArea);
4037
+ const removeClickArea = useHeatmapDataContext((s) => s.removeClickArea);
4020
4038
  const { customShadowRoot, onAreaCreated } = options;
4021
4039
  const onAreaCreatedElement = useCallback((element) => {
4022
4040
  if (!dataInfo)
@@ -4055,7 +4073,7 @@ function useAreaCreation(options = {}) {
4055
4073
  }
4056
4074
 
4057
4075
  function useAreaEditMode({ iframeRef, onAreaCreatedElement, enabled = false, }) {
4058
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
4076
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
4059
4077
  const hoveredElementRef = useRef(null);
4060
4078
  const onAreaCreatedElementRef = useRef(onAreaCreatedElement);
4061
4079
  const [hoveredElement, setHoveredElement] = useState(null);
@@ -4125,8 +4143,8 @@ function useAreaEditMode({ iframeRef, onAreaCreatedElement, enabled = false, })
4125
4143
  }
4126
4144
 
4127
4145
  const useAreaFilterVisible = (props) => {
4128
- const areas = useHeatmapAreaClick((s) => s.areas);
4129
- const setAreas = useHeatmapAreaClick((s) => s.setAreas);
4146
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4147
+ const setAreas = useHeatmapAreaClickContext((s) => s.setAreas);
4130
4148
  const { iframeRef, enableOverlapResolution } = props;
4131
4149
  const iframeDocument = iframeRef.current?.contentDocument;
4132
4150
  const visibleAreas = useMemo(() => {
@@ -4145,11 +4163,11 @@ const useAreaFilterVisible = (props) => {
4145
4163
  };
4146
4164
 
4147
4165
  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);
4166
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4167
+ const clickAreas = useHeatmapDataContext((s) => s.clickAreas);
4168
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4169
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4170
+ const setAreas = useHeatmapAreaClickContext((s) => s.setAreas);
4153
4171
  const { shadowRoot, enabled = true } = options;
4154
4172
  const [isInitializing, setIsInitializing] = useState(false);
4155
4173
  const hydratePersistedAreas = useCallback(() => {
@@ -4189,9 +4207,9 @@ function useAreaHydration(options) {
4189
4207
  }
4190
4208
 
4191
4209
  function useAreaInteraction({ onAreaClick }) {
4192
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
4193
- const setHoveredArea = useHeatmapAreaClick((s) => s.setHoveredArea);
4194
- const setSelectedArea = useHeatmapAreaClick((s) => s.setSelectedArea);
4210
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
4211
+ const setHoveredArea = useHeatmapAreaClickContext((s) => s.setHoveredArea);
4212
+ const setSelectedArea = useHeatmapAreaClickContext((s) => s.setSelectedArea);
4195
4213
  const handleAreaMouseEnter = useCallback((area) => {
4196
4214
  if (isEditingMode)
4197
4215
  return;
@@ -4218,7 +4236,7 @@ function useAreaInteraction({ onAreaClick }) {
4218
4236
  }
4219
4237
 
4220
4238
  function useAreaPositionsUpdater(options) {
4221
- const areas = useHeatmapAreaClick((s) => s.areas);
4239
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4222
4240
  const { iframeRef, visualRef, enabled = true } = options;
4223
4241
  const iframeDocument = iframeRef.current?.contentDocument;
4224
4242
  const updateAreaPositions = useCallback(() => {
@@ -4266,8 +4284,8 @@ function useAreaPositionsUpdater(options) {
4266
4284
  }
4267
4285
 
4268
4286
  function useAreaRectSync(options) {
4269
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4270
- const areas = useHeatmapAreaClick((s) => s.areas);
4287
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4288
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4271
4289
  const { iframeDocument, shadowRoot, enabled = true } = options;
4272
4290
  useEffect(() => {
4273
4291
  if (!enabled || !iframeDocument || areas.length === 0) {
@@ -4348,11 +4366,11 @@ function useAreaRendererContainer(iframeDocument, customShadowRoot) {
4348
4366
  }
4349
4367
 
4350
4368
  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);
4369
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4370
+ const clickAreas = useHeatmapDataContext((s) => s.clickAreas);
4371
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4372
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
4373
+ const addArea = useHeatmapAreaClickContext((s) => s.addArea);
4356
4374
  const { autoCreateTopN, shadowRoot, disabled = false } = props;
4357
4375
  const [isInitializing, setIsInitializing] = useState(disabled);
4358
4376
  useEffect(() => {
@@ -4391,8 +4409,8 @@ const useAreaTopAutoDetect = (props) => {
4391
4409
  };
4392
4410
 
4393
4411
  const useAreaClickmap = () => {
4394
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4395
- const clickmap = useHeatmapData((s) => s.clickmap);
4412
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4413
+ const clickmap = useHeatmapDataContext((s) => s.clickmap);
4396
4414
  const start = useCallback(() => {
4397
4415
  if (!vizRef || !clickmap || clickmap.length === 0)
4398
4416
  return;
@@ -4407,9 +4425,9 @@ const useAreaClickmap = () => {
4407
4425
  };
4408
4426
 
4409
4427
  const useClickmap = () => {
4410
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4411
- const clickmap = useHeatmapData((s) => s.clickmap);
4412
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
4428
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4429
+ const clickmap = useHeatmapDataContext((s) => s.clickmap);
4430
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
4413
4431
  const start = useCallback(() => {
4414
4432
  if (!vizRef || !clickmap || clickmap.length === 0 || !isRenderViz)
4415
4433
  return;
@@ -4425,8 +4443,8 @@ const useClickmap = () => {
4425
4443
  };
4426
4444
 
4427
4445
  const useScrollmap = () => {
4428
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
4429
- const scrollmap = useHeatmapData((s) => s.scrollmap);
4446
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
4447
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
4430
4448
  const start = useCallback(() => {
4431
4449
  if (!vizRef || !scrollmap || scrollmap.length === 0)
4432
4450
  return;
@@ -4442,8 +4460,8 @@ const useScrollmap = () => {
4442
4460
  };
4443
4461
 
4444
4462
  const useHeatmapCanvas = () => {
4445
- const heatmapType = useHeatmapSetting((state) => state.heatmapType);
4446
- const clickMode = useHeatmapSetting((state) => state.clickMode);
4463
+ const heatmapType = useHeatmapSettingContext((state) => state.heatmapType);
4464
+ const clickMode = useHeatmapSettingContext((state) => state.clickMode);
4447
4465
  const { start: startClickmap } = useClickmap();
4448
4466
  const { start: startAreaClickmap } = useAreaClickmap();
4449
4467
  const { start: startScrollmap } = useScrollmap();
@@ -4496,11 +4514,11 @@ const scrollToElementIfNeeded = (visualRef, rect, scale, onScrollComplete) => {
4496
4514
  });
4497
4515
  };
4498
4516
  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);
4517
+ const selectedElement = useHeatmapClickContext((s) => s.selectedElement);
4518
+ const shouldShowCallout = useHeatmapClickContext((s) => s.shouldShowCallout);
4519
+ const setShouldShowCallout = useHeatmapClickContext((s) => s.setShouldShowCallout);
4520
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4521
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4504
4522
  const [clickedElement, setClickedElement] = useState(null);
4505
4523
  const [showMissingElement, setShowMissingElement] = useState(false);
4506
4524
  const reset = () => {
@@ -4544,10 +4562,10 @@ const useClickedElement = ({ visualRef, getRect }) => {
4544
4562
  };
4545
4563
 
4546
4564
  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);
4565
+ const selectedElement = useHeatmapClickContext((s) => s.selectedElement);
4566
+ const setShouldShowCallout = useHeatmapClickContext((s) => s.setShouldShowCallout);
4567
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4568
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4551
4569
  useEffect(() => {
4552
4570
  const isAbsolute = positionMode === 'absolute';
4553
4571
  if (isAbsolute)
@@ -4580,8 +4598,8 @@ const useElementCalloutVisible = ({ visualRef, getRect, positionMode }) => {
4580
4598
  };
4581
4599
 
4582
4600
  const useHeatmapEffects = ({ isVisible }) => {
4583
- // const selectedElement = useHeatmapClick((s) => s.selectedElement);
4584
- // const setShouldShowCallout = useHeatmapClick((s) => s.setShouldShowCallout);
4601
+ // const selectedElement = useHeatmapClickContext((s) => s.selectedElement);
4602
+ // const setShouldShowCallout = useHeatmapClickContext((s) => s.setShouldShowCallout);
4585
4603
  const resetAll = () => {
4586
4604
  // setShouldShowCallout(false);
4587
4605
  };
@@ -4600,8 +4618,8 @@ const useHeatmapEffects = ({ isVisible }) => {
4600
4618
 
4601
4619
  const useHeatmapElementPosition = ({ iframeRef, wrapperRef, visualizer }) => {
4602
4620
  const heatmapWidth = useHeatmapWidthByDevice();
4603
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
4604
- const widthScale = useHeatmapViz((s) => s.widthScale);
4621
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
4622
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4605
4623
  const getRect = useCallback((element) => {
4606
4624
  const hash = element?.hash;
4607
4625
  if (!iframeRef.current?.contentDocument || !hash || !visualizer)
@@ -4729,11 +4747,11 @@ function getBoundingBox(element) {
4729
4747
  // }
4730
4748
 
4731
4749
  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);
4750
+ const setHoveredElement = useHeatmapHoverContext((s) => s.setHoveredElement);
4751
+ const isHoveredElement = useHeatmapHoverContext((s) => s.isHoveredElement);
4752
+ const setSelectedElement = useHeatmapClickContext((s) => s.setSelectedElement);
4753
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
4754
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
4737
4755
  const reset = useCallback(() => {
4738
4756
  setHoveredElement(null);
4739
4757
  }, [setHoveredElement]);
@@ -6289,10 +6307,10 @@ function enableNavigationBlocking() {
6289
6307
  }
6290
6308
 
6291
6309
  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);
6310
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6311
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
6312
+ const wrapperWidth = useHeatmapVizRectContext((s) => s.wrapperWidth);
6313
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6296
6314
  const contentWidth = useHeatmapWidthByDevice();
6297
6315
  const htmlContent = useHeatmapLiveStore((state) => state.htmlContent);
6298
6316
  const targetUrl = useHeatmapLiveStore((state) => state.targetUrl);
@@ -6388,11 +6406,11 @@ function initIframeHelper$1(iframe, rect, onSuccess) {
6388
6406
 
6389
6407
  const useHeatmapRender = () => {
6390
6408
  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);
6409
+ const data = useHeatmapDataContext((s) => s.data);
6410
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
6411
+ const setVizRef = useHeatmapVizRectContext((s) => s.setVizRef);
6412
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6413
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6396
6414
  const iframeRef = useRef(null);
6397
6415
  const renderHeatmap = useCallback(async (payloads) => {
6398
6416
  if (!payloads || payloads.length === 0)
@@ -6456,9 +6474,9 @@ function sortEvents(a, b) {
6456
6474
  }
6457
6475
 
6458
6476
  const useReplayRender = () => {
6459
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6460
- const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
6461
- const { data } = useHeatmapData();
6477
+ const data = useHeatmapDataContext((s) => s.data);
6478
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6479
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6462
6480
  const visualizerRef = useRef(null);
6463
6481
  const iframeRef = useRef(null);
6464
6482
  const eventsRef = useRef([]);
@@ -6630,10 +6648,10 @@ const useContentDimensions = ({ iframeRef }) => {
6630
6648
  };
6631
6649
 
6632
6650
  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);
6651
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6652
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6653
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
6654
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
6637
6655
  const { iframeRef } = props;
6638
6656
  const resizeObserverRef = useRef(null);
6639
6657
  const mutationObserverRef = useRef(null);
@@ -6760,14 +6778,14 @@ const useObserveIframeHeight = (props) => {
6760
6778
  };
6761
6779
 
6762
6780
  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);
6781
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
6782
+ const zoomRatio = useHeatmapVizContext((s) => s.zoomRatio);
6783
+ const isScaledToFit = useHeatmapVizContext((s) => s.isScaledToFit);
6784
+ const minZoomRatio = useHeatmapVizContext((s) => s.minZoomRatio);
6785
+ const maxZoomRatio = useHeatmapVizContext((s) => s.maxZoomRatio);
6786
+ const setScale = useHeatmapVizContext((s) => s.setScale);
6787
+ const setIsScaledToFit = useHeatmapVizContext((s) => s.setIsScaledToFit);
6788
+ const setMinZoomRatio = useHeatmapVizContext((s) => s.setMinZoomRatio);
6771
6789
  const { containerWidth, containerHeight, contentWidth, contentHeight } = props;
6772
6790
  const calculateScaleResult = useCallback(() => {
6773
6791
  if (containerWidth > 0 && contentWidth > 0 && containerHeight > 0 && contentHeight > 0) {
@@ -6830,7 +6848,7 @@ const useScrollSync = ({ widthScale, iframeRef }) => {
6830
6848
  };
6831
6849
 
6832
6850
  const useHeatmapScale = (props) => {
6833
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6851
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6834
6852
  const { wrapperRef, iframeRef } = props;
6835
6853
  // 1. Observe container dimensions
6836
6854
  const { containerWidth, containerHeight } = useContainerDimensions({ wrapperRef });
@@ -6858,9 +6876,9 @@ const useHeatmapScale = (props) => {
6858
6876
  const useIframeHeight = (props) => {
6859
6877
  const { iframeRef } = props;
6860
6878
  const iframeWidth = useHeatmapWidthByDevice();
6861
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6862
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6863
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
6879
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
6880
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6881
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
6864
6882
  useIframeHeightProcessor({
6865
6883
  iframeRef: iframeRef,
6866
6884
  iframeWidth: iframeWidth,
@@ -6881,8 +6899,8 @@ const useIframeHeight = (props) => {
6881
6899
  };
6882
6900
 
6883
6901
  const useWrapperRefHeight = (props) => {
6884
- const setWrapperHeight = useHeatmapVizRect((s) => s.setWrapperHeight);
6885
- const setWrapperWidth = useHeatmapVizRect((s) => s.setWrapperWidth);
6902
+ const setWrapperHeight = useHeatmapVizRectContext((s) => s.setWrapperHeight);
6903
+ const setWrapperWidth = useHeatmapVizRectContext((s) => s.setWrapperWidth);
6886
6904
  const { isActive, wrapperRef } = props;
6887
6905
  const resizeObserverRef = useRef(null);
6888
6906
  const mutationObserverRef = useRef(null);
@@ -6954,7 +6972,7 @@ const useWrapperRefHeight = (props) => {
6954
6972
  };
6955
6973
 
6956
6974
  const useZonePositions = (_options) => {
6957
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6975
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6958
6976
  const getZonePosition = useCallback((zone) => {
6959
6977
  if (!iframeHeight) {
6960
6978
  return null;
@@ -6978,10 +6996,10 @@ const SCROLL_GRADIENT_COLORS = [
6978
6996
  ];
6979
6997
  const useScrollmapZones = (options) => {
6980
6998
  const { mode = 'basic', enabled = true, iframeRef, wrapperRef } = options;
6999
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
7000
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
6981
7001
  const [isReady, setIsReady] = useState(false);
6982
7002
  const [zones, setZones] = useState([]);
6983
- const { scrollmap } = useHeatmapData();
6984
- const { dataInfo } = useHeatmapData();
6985
7003
  const { getZonePosition } = useZonePositions();
6986
7004
  const scrollMapInfo = dataInfo?.scrollMapInfo;
6987
7005
  const maxUsers = useMemo(() => {
@@ -7128,25 +7146,24 @@ const BoxStack = forwardRef(({ children, ...props }, ref) => {
7128
7146
  BoxStack.displayName = 'BoxStack';
7129
7147
 
7130
7148
  const ContentMetricBar = () => {
7131
- const controls = useHeatmapControlStore((state) => state.controls);
7149
+ const CompMetricBar = useHeatmapControlStore((state) => state.controls.MetricBar);
7132
7150
  const borderBottom = `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`;
7133
7151
  return (jsx(BoxStack, { id: "gx-hm-content-metric-bar", flexDirection: "row", alignItems: "center", overflow: "auto", zIndex: 1, backgroundColor: "white", style: {
7134
7152
  borderBottom,
7135
- }, children: controls.MetricBar ?? null }));
7153
+ }, children: CompMetricBar && jsx(CompMetricBar, {}) }));
7136
7154
  };
7137
7155
  ContentMetricBar.displayName = 'ContentMetricBar';
7138
7156
 
7139
7157
  const ContentSidebar = () => {
7140
- const controls = useHeatmapControlStore((state) => state.controls);
7141
- const state = useHeatmapClick((s) => s.state);
7158
+ const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
7159
+ const state = useHeatmapClickContext((s) => s.state);
7142
7160
  const isHideSidebar = state.hideSidebar;
7143
7161
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
7144
7162
  const mode = useHeatmapConfigStore((state) => state.mode);
7145
- const SidebarComponent = controls.Sidebar ?? null;
7146
7163
  const isCompareMode = mode === 'compare';
7147
7164
  if (isCompareMode)
7148
7165
  return null;
7149
- if (!SidebarComponent)
7166
+ if (!CompSidebar)
7150
7167
  return null;
7151
7168
  return (jsx("div", { className: "gx-hm-sidebar", style: {
7152
7169
  height: '100%',
@@ -7163,7 +7180,7 @@ const ContentSidebar = () => {
7163
7180
  height: '100%',
7164
7181
  width: `calc(${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px)`,
7165
7182
  borderRight: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
7166
- }, children: jsx(SidebarComponent, {}) }) }));
7183
+ }, children: jsx(CompSidebar, {}) }) }));
7167
7184
  };
7168
7185
 
7169
7186
  const PopoverSidebar = () => {
@@ -7171,7 +7188,7 @@ const PopoverSidebar = () => {
7171
7188
  const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
7172
7189
  const CompSidebarActivator = useHeatmapControlStore((state) => state.controls.SidebarActivator);
7173
7190
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
7174
- const state = useHeatmapClick((s) => s.state);
7191
+ const state = useHeatmapClickContext((s) => s.state);
7175
7192
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
7176
7193
  const isCompareMode = mode === 'compare';
7177
7194
  const isHideSidebar = state.hideSidebar;
@@ -7199,15 +7216,10 @@ const PopoverSidebar = () => {
7199
7216
  };
7200
7217
 
7201
7218
  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 }));
7219
+ const CompToolbar = useHeatmapControlStore((state) => state.controls.Toolbar);
7220
+ return (jsx(BoxStack, { id: "gx-hm-content-toolbar", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "48px", style: {
7221
+ borderTop: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
7222
+ }, children: CompToolbar && jsx(CompToolbar, {}) }));
7211
7223
  };
7212
7224
 
7213
7225
  const VizContainer = ({ children, isActive = false }) => {
@@ -7761,7 +7773,7 @@ const AreaEditHighlight = ({ element, shadowRoot, onClick }) => {
7761
7773
  AreaEditHighlight.displayName = 'AreaEditHighlight';
7762
7774
 
7763
7775
  const AreaEditHighlightPortal = ({ shadowContainer, iframeRef, customShadowRoot, onAreaCreated, }) => {
7764
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
7776
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
7765
7777
  const { onAreaCreatedElement } = useAreaCreation({ customShadowRoot, onAreaCreated });
7766
7778
  const { hoveredElement } = useAreaEditMode({ iframeRef, enabled: true, onAreaCreatedElement });
7767
7779
  if (!isEditingMode || !hoveredElement)
@@ -7876,7 +7888,7 @@ const AreaOverlay = memo(AreaOverlayComponent, (prevProps, nextProps) => {
7876
7888
  });
7877
7889
 
7878
7890
  const SelectedAreaOverlay = () => {
7879
- const selectedArea = useHeatmapAreaClick((s) => s.selectedArea);
7891
+ const selectedArea = useHeatmapAreaClickContext((s) => s.selectedArea);
7880
7892
  if (!selectedArea)
7881
7893
  return null;
7882
7894
  return (jsx(Fragment$1, { children: jsx("style", { children: `
@@ -7887,13 +7899,13 @@ const SelectedAreaOverlay = () => {
7887
7899
  };
7888
7900
 
7889
7901
  const AreasPortal = ({ shadowContainer, onAreaClick }) => {
7890
- const areas = useHeatmapAreaClick((s) => s.areas);
7902
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
7891
7903
  return createPortal(jsxs(Fragment$1, { children: [areas.map((area) => (jsx(AreaOverlay, { area: area, onAreaClick: onAreaClick }, area.id))), jsx(SelectedAreaOverlay, {})] }), shadowContainer);
7892
7904
  };
7893
7905
 
7894
7906
  const AutoScrollHandler = ({ visualRef }) => {
7895
- const widthScale = useHeatmapViz((s) => s.widthScale);
7896
- const selectedArea = useHeatmapAreaClick((s) => s.selectedArea);
7907
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7908
+ const selectedArea = useHeatmapAreaClickContext((s) => s.selectedArea);
7897
7909
  useEffect(() => {
7898
7910
  if (!selectedArea)
7899
7911
  return;
@@ -7907,7 +7919,7 @@ const AutoScrollHandler = ({ visualRef }) => {
7907
7919
  };
7908
7920
 
7909
7921
  const PortalAreaRenderer = ({ iframeRef, visualRef, shadowRoot, onAreaCreated, onAreaClick, }) => {
7910
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
7922
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
7911
7923
  const iframeDocument = iframeRef.current?.contentDocument || undefined;
7912
7924
  const { shadowContainer, isReady } = useAreaRendererContainer(iframeDocument, shadowRoot);
7913
7925
  useAreaRectSync({ iframeDocument, shadowRoot, enabled: isReady && isRenderViz });
@@ -7918,9 +7930,9 @@ const PortalAreaRenderer = ({ iframeRef, visualRef, shadowRoot, onAreaCreated, o
7918
7930
  };
7919
7931
 
7920
7932
  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);
7933
+ const clickAreas = useHeatmapDataContext((s) => s.clickAreas);
7934
+ const resetView = useHeatmapAreaClickContext((s) => s.resetView);
7935
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
7924
7936
  useAreaTopAutoDetect({ autoCreateTopN, shadowRoot, disabled: !!clickAreas?.length });
7925
7937
  useAreaFilterVisible({ iframeRef, enableOverlapResolution });
7926
7938
  useAreaHydration({ shadowRoot });
@@ -7936,7 +7948,7 @@ const VizAreaClick = ({ iframeRef, visualRef, shadowRoot, autoCreateTopN = 10, e
7936
7948
  VizAreaClick.displayName = 'VizAreaClick';
7937
7949
 
7938
7950
  const RankBadgeComponent = ({ index, hash, elementRect, widthScale, show = true, clickOnElement, }) => {
7939
- const clickedHash = useHeatmapClick((s) => s.selectedElement?.hash);
7951
+ const clickedHash = useHeatmapClickContext((s) => s.selectedElement?.hash);
7940
7952
  const isShow = !!show && clickedHash !== hash;
7941
7953
  if (!isShow || !ELM_CALLOUT_CONFIG.SHOW_RANK_BADGE)
7942
7954
  return null;
@@ -7948,8 +7960,8 @@ const RankBadge = memo(RankBadgeComponent);
7948
7960
 
7949
7961
  const NUMBER_OF_TOP_ELEMENTS = 10;
7950
7962
  const DefaultRankBadgesComponent = ({ getRect, hidden }) => {
7951
- const dataInfo = useHeatmapData((s) => s.dataInfo);
7952
- const widthScale = useHeatmapViz((s) => s.widthScale);
7963
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
7964
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7953
7965
  const elements = dataInfo?.sortedElements?.slice(0, NUMBER_OF_TOP_ELEMENTS) ?? [];
7954
7966
  if (hidden || elements.length === 0)
7955
7967
  return null;
@@ -7971,7 +7983,7 @@ const DEFAULT_POSITION = {
7971
7983
  };
7972
7984
  const ElementCallout = (props) => {
7973
7985
  const viewId = useViewIdContext();
7974
- const widthScale = useHeatmapViz((s) => s.widthScale);
7986
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7975
7987
  const CompElementCallout = useHeatmapControlStore((state) => state.controls.ElementCallout);
7976
7988
  const calloutRef = useRef(null);
7977
7989
  const element = props.element;
@@ -8003,7 +8015,7 @@ const ElementCallout = (props) => {
8003
8015
  }
8004
8016
  };
8005
8017
  const useAnchorPosition = (calloutRef, props) => {
8006
- const widthScale = useHeatmapViz((s) => s.widthScale);
8018
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8007
8019
  const { target, visualRef, alignment, element, positionMode } = props;
8008
8020
  const [position, setPosition] = useState(DEFAULT_POSITION);
8009
8021
  const isAbsolute = positionMode === 'absolute';
@@ -8058,7 +8070,7 @@ const useAnchorPosition = (calloutRef, props) => {
8058
8070
  };
8059
8071
 
8060
8072
  const ElementMissing = ({ show = true, visualRef }) => {
8061
- const widthScale = useHeatmapViz((s) => s.widthScale);
8073
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8062
8074
  const missingElementRef = useRef(null);
8063
8075
  const wrapperWidth = useHeatmapWidthByDevice();
8064
8076
  const [scrollPosition, setScrollPosition] = useState({ scrollTop: 0, scrollLeft: 0 });
@@ -8173,7 +8185,7 @@ const BackdropCanvas = ({ activeElement, viewportWidth, viewportHeight, borderWi
8173
8185
 
8174
8186
  const ElementCalloutOverlay = (props) => {
8175
8187
  const { element, containerRef } = props;
8176
- const widthScale = useHeatmapViz((s) => s.widthScale);
8188
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8177
8189
  const CompElementCallout = useHeatmapControlStore((state) => state.controls.ElementCallout);
8178
8190
  const calloutRef = useRef(null);
8179
8191
  const [position, setPosition] = useState({
@@ -8212,8 +8224,8 @@ ElementCalloutOverlay.displayName = 'ElementCalloutOverlay';
8212
8224
 
8213
8225
  const ElementOverlayComponent = (props) => {
8214
8226
  const { type, element, onClick, elementId, hideOutline } = props;
8215
- const widthScale = useHeatmapViz((s) => s.widthScale);
8216
- const viewportHeight = useHeatmapVizRect((s) => s.iframeHeight);
8227
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8228
+ const viewportHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8217
8229
  const viewportWidth = useHeatmapWidthByDevice();
8218
8230
  const overlayStyle = useMemo(() => {
8219
8231
  const isInvalid = !element || (element.width === 0 && element.height === 0);
@@ -8254,8 +8266,8 @@ const ElementCalloutClicked = memo(ElementCalloutClickedComponent);
8254
8266
 
8255
8267
  const HoveredElementOverlayComponent = ({ onClick }) => {
8256
8268
  const viewId = useViewIdContext();
8257
- const hoveredElement = useHeatmapHover((s) => s.hoveredElement);
8258
- const clickedElement = useHeatmapClick((s) => s.selectedElement);
8269
+ const hoveredElement = useHeatmapHoverContext((s) => s.hoveredElement);
8270
+ const clickedElement = useHeatmapClickContext((s) => s.selectedElement);
8259
8271
  const handleClick = (event) => {
8260
8272
  if (onClick) {
8261
8273
  onClick(event, hoveredElement?.hash ?? '');
@@ -8272,7 +8284,7 @@ const HoveredElementOverlay = memo(HoveredElementOverlayComponent);
8272
8284
  const IS_SHOW_CALLOUT = false;
8273
8285
  const ElementCalloutHoveredComponent = (props) => {
8274
8286
  const viewId = useViewIdContext();
8275
- useHeatmapHover((s) => s.hoveredElement);
8287
+ useHeatmapHoverContext((s) => s.hoveredElement);
8276
8288
  getHoveredElementId(viewId, props.isSecondary);
8277
8289
  const isShowCallout = IS_SHOW_CALLOUT ;
8278
8290
  return (jsxs(Fragment, { children: [jsx(HoveredElementOverlay, { onClick: props.onClick }), isShowCallout ] }));
@@ -8281,7 +8293,7 @@ const ElementCalloutHovered = memo(ElementCalloutHoveredComponent);
8281
8293
 
8282
8294
  const HeatmapElements = (props) => {
8283
8295
  const viewId = useViewIdContext();
8284
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8296
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8285
8297
  const elementCalloutRef = useRef(null);
8286
8298
  const { iframeDimensions, positionMode } = props;
8287
8299
  const { visualRef, iframeRef, wrapperRef, visualizer } = props;
@@ -8297,8 +8309,8 @@ const HeatmapElements = (props) => {
8297
8309
 
8298
8310
  const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8299
8311
  const contentWidth = useHeatmapWidthByDevice();
8300
- const dataInfo = useHeatmapData((s) => s.dataInfo);
8301
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
8312
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
8313
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
8302
8314
  const visualizer = {
8303
8315
  get: (hash) => {
8304
8316
  if (!vizRef)
@@ -8319,8 +8331,8 @@ const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8319
8331
  };
8320
8332
 
8321
8333
  const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8322
- const clickMode = useHeatmapSetting((state) => state.clickMode);
8323
- const heatmapType = useHeatmapSetting((state) => state.heatmapType);
8334
+ const clickMode = useHeatmapSettingContext((state) => state.clickMode);
8335
+ const heatmapType = useHeatmapSettingContext((state) => state.heatmapType);
8324
8336
  const isClickType = heatmapType === EHeatmapType.Click;
8325
8337
  if (!isClickType)
8326
8338
  return null;
@@ -8335,8 +8347,8 @@ const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8335
8347
  };
8336
8348
 
8337
8349
  const ScrollMapMinimap = ({ zones, maxUsers }) => {
8338
- const scrollType = useHeatmapSetting((s) => s.scrollType);
8339
- const showMinimap = useHeatmapScroll((s) => s.showMinimap);
8350
+ const scrollType = useHeatmapSettingContext((s) => s.scrollType);
8351
+ const showMinimap = useHeatmapScrollContext((s) => s.showMinimap);
8340
8352
  const isScrollType = [EScrollType.Attention].includes(scrollType ?? EScrollType.Depth);
8341
8353
  if (!showMinimap || !isScrollType)
8342
8354
  return null;
@@ -8396,7 +8408,7 @@ const ScrollZoneTooltip = ({ zone, position, currentScrollPercent, scrollmap, })
8396
8408
  };
8397
8409
 
8398
8410
  const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) => {
8399
- const { scrollmap } = useHeatmapData();
8411
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
8400
8412
  // const hoveredZone = useHeatmapVizScrollStore((state) => state.hoveredZone);
8401
8413
  // const setHoveredZone = useHeatmapVizScrollStore((state) => state.setHoveredZone);
8402
8414
  const { zones, isReady, maxUsers } = useScrollmapZones({
@@ -8411,8 +8423,8 @@ const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) =
8411
8423
  };
8412
8424
 
8413
8425
  const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
8414
- const widthScale = useHeatmapViz((s) => s.widthScale);
8415
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8426
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8427
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8416
8428
  const overlayRef = useRef(null);
8417
8429
  const [position, setPosition] = useState();
8418
8430
  const [currentScrollPercent, setCurrentScrollPercent] = useState(0);
@@ -8449,7 +8461,7 @@ const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
8449
8461
  };
8450
8462
 
8451
8463
  const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8452
- const { dataInfo } = useHeatmapData();
8464
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
8453
8465
  const { getZonePosition } = useZonePositions();
8454
8466
  const averageFold = dataInfo?.averageFold || 50;
8455
8467
  const position = getZonePosition({
@@ -8486,8 +8498,8 @@ const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8486
8498
  };
8487
8499
 
8488
8500
  const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8489
- const scrollType = useHeatmapSetting((s) => s.scrollType);
8490
- const { scrollmap } = useHeatmapData();
8501
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
8502
+ const scrollType = useHeatmapSettingContext((s) => s.scrollType);
8491
8503
  const { getZonePosition } = useZonePositions();
8492
8504
  if (!scrollmap || scrollmap.length === 0)
8493
8505
  return null;
@@ -8562,8 +8574,8 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8562
8574
 
8563
8575
  const SCROLL_TYPES = [EHeatmapType.Scroll];
8564
8576
  const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8565
- const heatmapType = useHeatmapSetting((s) => s.heatmapType);
8566
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8577
+ const heatmapType = useHeatmapSettingContext((s) => s.heatmapType);
8578
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8567
8579
  // useRenderCount('VizScrollMap');
8568
8580
  const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? EHeatmapType.Click);
8569
8581
  if (!iframeHeight || !isHeatmapScroll)
@@ -8579,12 +8591,29 @@ const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8579
8591
  }, children: [jsx(ScrollmapMarker, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(AverageFoldLine, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(ScrollMapOverlay, { wrapperRef: wrapperRef, iframeRef: iframeRef })] }));
8580
8592
  };
8581
8593
 
8594
+ const VizLoadingCanvas = () => {
8595
+ const isLoadingCanvas = useHeatmapSettingContext((state) => state.isLoadingCanvas);
8596
+ const CompLoading = useHeatmapControlStore((s) => s.controls.VizLoading);
8597
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8598
+ if (!isLoadingCanvas)
8599
+ return null;
8600
+ return (jsx("div", { className: "gx-hm-loading", style: {
8601
+ background: '#000000B2',
8602
+ }, children: jsx(BoxStack, { position: "absolute", height: wrapperHeight, flexDirection: "row", justifyContent: "center", alignItems: "center", style: {
8603
+ width: '100%',
8604
+ top: 0,
8605
+ left: 0,
8606
+ }, children: jsx("div", { style: { height: 'fit-content' }, children: CompLoading && jsx(CompLoading, { type: "transparent" }) }) }) }));
8607
+ };
8608
+
8582
8609
  const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHeight, onScroll, }) => {
8583
- const widthScale = useHeatmapViz((s) => s.widthScale);
8610
+ const isLoadingCanvas = useHeatmapSettingContext((state) => state.isLoadingCanvas);
8611
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8584
8612
  const contentWidth = useHeatmapWidthByDevice();
8585
8613
  const contentHeight = calcContentHeight();
8586
8614
  return (jsx("div", { ref: visualRef, className: "gx-hm-visual", onScroll: onScroll, style: {
8587
- overflow: 'hidden scroll',
8615
+ overflowX: 'hidden',
8616
+ overflowY: iframeHeight > 0 && !isLoadingCanvas ? 'scroll' : 'hidden',
8588
8617
  display: 'flex',
8589
8618
  position: 'relative',
8590
8619
  justifyContent: 'center',
@@ -8596,6 +8625,7 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8596
8625
  display: 'flex',
8597
8626
  justifyContent: 'center',
8598
8627
  alignItems: 'flex-start',
8628
+ position: 'relative',
8599
8629
  height: contentHeight,
8600
8630
  padding: HEATMAP_STYLE['wrapper']['padding'],
8601
8631
  paddingBottom: HEATMAP_STYLE['viz']['paddingBottom'],
@@ -8617,8 +8647,8 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8617
8647
  const VizDomRenderer = ({ mode = 'heatmap' }) => {
8618
8648
  const viewId = useViewIdContext();
8619
8649
  const contentWidth = useHeatmapWidthByDevice();
8620
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8621
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8650
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8651
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8622
8652
  const wrapperRef = useRef(null);
8623
8653
  const visualRef = useRef(null);
8624
8654
  const { iframeRef } = useHeatmapRenderByMode(mode);
@@ -8629,23 +8659,30 @@ const VizDomRenderer = ({ mode = 'heatmap' }) => {
8629
8659
  const scrollTop = e.currentTarget.scrollTop;
8630
8660
  handleScroll(scrollTop);
8631
8661
  };
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 })] }));
8662
+ 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
8663
  };
8634
8664
 
8635
8665
  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..." })] }));
8666
+ const CompLoading = useHeatmapControlStore((s) => s.controls.VizLoading);
8667
+ return (jsx("div", { className: "gx-hm-loading", style: {
8668
+ // width: `calc(100% - ${contentWidth * widthScale}px)`,
8669
+ display: 'flex',
8670
+ justifyContent: 'center',
8671
+ alignItems: 'center',
8672
+ background: 'rgba(255, 255, 255, 0.75)',
8673
+ }, children: CompLoading && jsx(CompLoading, { type: "default" }) }));
8637
8674
  };
8638
8675
 
8639
8676
  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);
8677
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8678
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
8679
+ const setVizRef = useHeatmapVizRectContext((s) => s.setVizRef);
8680
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
8681
+ const setSelectedElement = useHeatmapClickContext((s) => s.setSelectedElement);
8682
+ const setHoveredElement = useHeatmapHoverContext((s) => s.setHoveredElement);
8683
+ // const setSelectedArea = useHeatmapAreaClickContext((s) => s.setSelectedArea);
8684
+ // const setHoveredArea = useHeatmapAreaClickContext((s) => s.setHoveredArea);
8685
+ // const setAreas = useHeatmapAreaClickContext((s) => s.setAreas);
8649
8686
  useRenderCount('VizDomHeatmap');
8650
8687
  const cleanUp = () => {
8651
8688
  setVizRef(null);
@@ -8666,8 +8703,8 @@ VizDomHeatmap.displayName = 'VizDomHeatmap';
8666
8703
 
8667
8704
  const VizLiveRenderer = () => {
8668
8705
  const contentWidth = useHeatmapWidthByDevice();
8669
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8670
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8706
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8707
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8671
8708
  const visualRef = useRef(null);
8672
8709
  const wrapperRef = useRef(null);
8673
8710
  const { iframeRef } = useVizLiveRender();
@@ -8680,25 +8717,28 @@ const VizLiveRenderer = () => {
8680
8717
  };
8681
8718
 
8682
8719
  const VizLiveHeatmap = () => {
8683
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8684
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8720
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8721
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8685
8722
  useHeatmapLiveStore((state) => state.reset);
8723
+ const CompVizLoading = useHeatmapControlStore((state) => state.controls.VizLoading);
8686
8724
  // TODO: Remove this after testing
8687
8725
  useEffect(() => {
8688
8726
  return () => {
8689
8727
  // reset();
8690
8728
  };
8691
8729
  }, []);
8692
- return (jsxs(VizContainer, { isActive: true, children: [jsx(VizLiveRenderer, {}), (!iframeHeight || !wrapperHeight) && jsx(VizLoading, {})] }));
8730
+ return (jsxs(VizContainer, { isActive: true, children: [jsx(VizLiveRenderer, {}), ((!iframeHeight || !wrapperHeight) && CompVizLoading && jsx(CompVizLoading, { type: "transparent" })) || null] }));
8693
8731
  };
8694
8732
  VizLiveHeatmap.displayName = 'VizLiveHeatmap';
8695
8733
 
8696
8734
  const ContentVizByMode = () => {
8697
8735
  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;
8736
+ const CompVizLoading = useHeatmapControlStore((state) => state.controls.VizLoading);
8737
+ const isRendering = useHeatmapSettingContext((state) => state.isRendering);
8738
+ const isLoadingDom = useHeatmapSettingContext((state) => state.isLoadingDom);
8739
+ if (isRendering || isLoadingDom) {
8740
+ return (CompVizLoading && jsx(CompVizLoading, { type: "default" })) || null;
8741
+ }
8702
8742
  switch (mode) {
8703
8743
  case 'live':
8704
8744
  return jsx(VizLiveHeatmap, {});
@@ -8711,22 +8751,21 @@ const ContentVizByMode = () => {
8711
8751
  ContentVizByMode.displayName = 'ContentVizByMode';
8712
8752
 
8713
8753
  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, {})] })] }));
8754
+ 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(BoxStack, { flexDirection: "column", flex: "1", children: jsx(ContentVizByMode, {}) }), jsx(ContentToolbar, {})] })] }));
8715
8755
  };
8716
8756
 
8717
8757
  const ContentTopBar = () => {
8718
- const controls = useHeatmapControlStore((state) => state.controls);
8719
- const TopBar = controls.TopBar;
8758
+ const CompTopBar = useHeatmapControlStore((state) => state.controls.TopBar);
8720
8759
  return (jsx(BoxStack, { id: "gx-hm-content-header", flexDirection: "row", alignItems: "center", overflow: "auto", zIndex: 1, backgroundColor: "white", style: {
8721
8760
  borderBottom: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
8722
- }, children: TopBar && jsx(TopBar, {}) }));
8761
+ }, children: CompTopBar && jsx(CompTopBar, {}) }));
8723
8762
  };
8724
8763
 
8725
- const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, }) => {
8764
+ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, isLoading, isLoadingCanvas, }) => {
8726
8765
  useRegisterControl(controls);
8727
8766
  useRegisterData(data, dataInfo);
8728
8767
  useRegisterHeatmap({ clickmap, scrollmap, clickAreas });
8729
- useRegisterConfig();
8768
+ useRegisterConfig({ isLoading, isLoadingCanvas });
8730
8769
  // performanceLogger.configure({
8731
8770
  // enabled: true,
8732
8771
  // logToConsole: false,
@@ -8755,4 +8794,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
8755
8794
  }
8756
8795
  };
8757
8796
 
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 };
8797
+ 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 };