@gemx-dev/heatmap-react 3.5.70 → 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 (120) 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/VizElement/ElementCallout.d.ts.map +1 -1
  15. package/dist/esm/components/VizLive/VizLiveHeatmap.d.ts.map +1 -1
  16. package/dist/esm/components/VizScrollmap/AverageFoldLine.d.ts.map +1 -1
  17. package/dist/esm/hooks/index.d.ts +1 -1
  18. package/dist/esm/hooks/index.d.ts.map +1 -1
  19. package/dist/esm/hooks/register/useRegisterConfig.d.ts +4 -1
  20. package/dist/esm/hooks/register/useRegisterConfig.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/esm/hooks/view-context/useHeatmapSettingContext.d.ts +35 -0
  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 +328 -287
  43. package/dist/esm/index.mjs +328 -287
  44. package/dist/esm/stores/setting.d.ts +17 -13
  45. package/dist/esm/stores/setting.d.ts.map +1 -1
  46. package/dist/esm/types/control.d.ts +5 -3
  47. package/dist/esm/types/control.d.ts.map +1 -1
  48. package/dist/esm/types/heatmap-info.d.ts +2 -0
  49. package/dist/esm/types/heatmap-info.d.ts.map +1 -1
  50. package/dist/esm/types/heatmap.d.ts +7 -7
  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/VizElement/ElementCallout.d.ts.map +1 -1
  65. package/dist/umd/components/VizLive/VizLiveHeatmap.d.ts.map +1 -1
  66. package/dist/umd/components/VizScrollmap/AverageFoldLine.d.ts.map +1 -1
  67. package/dist/umd/hooks/index.d.ts +1 -1
  68. package/dist/umd/hooks/index.d.ts.map +1 -1
  69. package/dist/umd/hooks/register/useRegisterConfig.d.ts +4 -1
  70. package/dist/umd/hooks/register/useRegisterConfig.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/umd/hooks/view-context/useHeatmapSettingContext.d.ts +35 -0
  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/setting.d.ts +17 -13
  94. package/dist/umd/stores/setting.d.ts.map +1 -1
  95. package/dist/umd/types/control.d.ts +5 -3
  96. package/dist/umd/types/control.d.ts.map +1 -1
  97. package/dist/umd/types/heatmap-info.d.ts +2 -0
  98. package/dist/umd/types/heatmap-info.d.ts.map +1 -1
  99. package/dist/umd/types/heatmap.d.ts +7 -7
  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 +0 -30
  107. package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts.map +0 -1
  108. package/dist/esm/hooks/view-context/useHeatmapViz.d.ts.map +0 -1
  109. package/dist/esm/hooks/view-context/useHeatmapVizRect.d.ts +0 -60
  110. package/dist/esm/hooks/view-context/useHeatmapVizRect.d.ts.map +0 -1
  111. package/dist/umd/hooks/view-context/useHeatmapAreaClick.d.ts.map +0 -1
  112. package/dist/umd/hooks/view-context/useHeatmapClick.d.ts.map +0 -1
  113. package/dist/umd/hooks/view-context/useHeatmapData.d.ts.map +0 -1
  114. package/dist/umd/hooks/view-context/useHeatmapHover.d.ts.map +0 -1
  115. package/dist/umd/hooks/view-context/useHeatmapScroll.d.ts.map +0 -1
  116. package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts +0 -30
  117. package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts.map +0 -1
  118. package/dist/umd/hooks/view-context/useHeatmapViz.d.ts.map +0 -1
  119. package/dist/umd/hooks/view-context/useHeatmapVizRect.d.ts +0 -60
  120. package/dist/umd/hooks/view-context/useHeatmapVizRect.d.ts.map +0 -1
@@ -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: {
@@ -149,53 +149,53 @@ function useDebounceCallback(callback, delay) {
149
149
  }, [delay]);
150
150
  }
151
151
 
152
- var IDeviceType;
153
- (function (IDeviceType) {
154
- IDeviceType["Desktop"] = "DESKTOP";
155
- IDeviceType["Mobile"] = "MOBILE";
156
- IDeviceType["Tablet"] = "TABLET";
157
- })(IDeviceType || (IDeviceType = {}));
158
- var IHeatmapType;
159
- (function (IHeatmapType) {
160
- IHeatmapType["Click"] = "click";
161
- IHeatmapType["Scroll"] = "scroll";
162
- })(IHeatmapType || (IHeatmapType = {}));
163
- var IClickType;
164
- (function (IClickType) {
152
+ var EDeviceType;
153
+ (function (EDeviceType) {
154
+ EDeviceType["Desktop"] = "DESKTOP";
155
+ EDeviceType["Mobile"] = "MOBILE";
156
+ EDeviceType["Tablet"] = "TABLET";
157
+ })(EDeviceType || (EDeviceType = {}));
158
+ var EHeatmapType;
159
+ (function (EHeatmapType) {
160
+ EHeatmapType["Click"] = "click";
161
+ EHeatmapType["Scroll"] = "scroll";
162
+ })(EHeatmapType || (EHeatmapType = {}));
163
+ var EClickType;
164
+ (function (EClickType) {
165
165
  /** Return all clicks (default) */
166
- IClickType["All"] = "ALL";
166
+ EClickType["All"] = "ALL";
167
167
  /** Rapid clicks in a small area, indicating user frustration */
168
- IClickType["Rage"] = "RAGE";
168
+ EClickType["Rage"] = "RAGE";
169
169
  /** Clicks with no effect (no navigation, no state change) */
170
- IClickType["Dead"] = "DEAD";
170
+ EClickType["Dead"] = "DEAD";
171
171
  /** Clicks followed by JavaScript errors */
172
- IClickType["Error"] = "ERROR";
172
+ EClickType["Error"] = "ERROR";
173
173
  /** The first click of the session */
174
- IClickType["First"] = "FIRST";
174
+ EClickType["First"] = "FIRST";
175
175
  /** The last click of the session */
176
- IClickType["Last"] = "LAST";
176
+ EClickType["Last"] = "LAST";
177
177
  /** Normal click with no special behavior (fallback type) */
178
- IClickType["Standard"] = "STANDARD";
179
- })(IClickType || (IClickType = {}));
180
- var IClickRankType;
181
- (function (IClickRankType) {
182
- IClickRankType["MostClicks"] = "most-clicks";
183
- IClickRankType["Revenue"] = "revenue";
184
- IClickRankType["ConversionRate"] = "conversion-rate";
185
- IClickRankType["RevenuePerClick"] = "revenue-per-click";
186
- IClickRankType["RevenuePerSession"] = "revenue-per-session";
187
- })(IClickRankType || (IClickRankType = {}));
188
- var IClickMode;
189
- (function (IClickMode) {
190
- IClickMode["Default"] = "default";
191
- IClickMode["Area"] = "click-area";
192
- })(IClickMode || (IClickMode = {}));
193
- var IScrollType;
194
- (function (IScrollType) {
195
- IScrollType["Depth"] = "scroll-depth";
196
- IScrollType["Attention"] = "attention-scroll";
197
- IScrollType["Revenue"] = "revenue-scroll";
198
- })(IScrollType || (IScrollType = {}));
178
+ EClickType["Standard"] = "STANDARD";
179
+ })(EClickType || (EClickType = {}));
180
+ var EClickRankType;
181
+ (function (EClickRankType) {
182
+ EClickRankType["MostClicks"] = "most-clicks";
183
+ EClickRankType["Revenue"] = "revenue";
184
+ EClickRankType["ConversionRate"] = "conversion-rate";
185
+ EClickRankType["RevenuePerClick"] = "revenue-per-click";
186
+ EClickRankType["RevenuePerSession"] = "revenue-per-session";
187
+ })(EClickRankType || (EClickRankType = {}));
188
+ var EClickMode;
189
+ (function (EClickMode) {
190
+ EClickMode["Default"] = "default";
191
+ EClickMode["Area"] = "click-area";
192
+ })(EClickMode || (EClickMode = {}));
193
+ var EScrollType;
194
+ (function (EScrollType) {
195
+ EScrollType["Depth"] = "scroll-depth";
196
+ EScrollType["Attention"] = "attention-scroll";
197
+ EScrollType["Revenue"] = "revenue-scroll";
198
+ })(EScrollType || (EScrollType = {}));
199
199
 
200
200
  const ViewIdContext = createContext(undefined);
201
201
  const useViewIdContext = () => {
@@ -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
  },
@@ -307,7 +307,7 @@ const useHeatmapConfigStore = create()((set) => {
307
307
  return {
308
308
  mode: 'single',
309
309
  sidebarWidth: DEFAULT_SIDEBAR_WIDTH,
310
- clickMode: IClickMode.Default,
310
+ clickMode: EClickMode.Default,
311
311
  isRendering: true,
312
312
  setMode: (mode) => set({ mode }),
313
313
  resetMode: () => set({ mode: 'single' }),
@@ -416,12 +416,14 @@ 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
- rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
420
- deviceType: new Map([[DEFAULT_VIEW_ID, IDeviceType.Desktop]]),
421
- clickType: new Map([[DEFAULT_VIEW_ID, IClickType.All]]),
422
- clickMode: new Map([[DEFAULT_VIEW_ID, IClickMode.Default]]),
423
- scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
424
- heatmapType: new Map([[DEFAULT_VIEW_ID, IHeatmapType.Click]]),
419
+ isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
420
+ isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
421
+ rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
422
+ deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
423
+ clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
424
+ clickMode: new Map([[DEFAULT_VIEW_ID, EClickMode.Default]]),
425
+ scrollType: new Map([[DEFAULT_VIEW_ID, EScrollType.Depth]]),
426
+ heatmapType: new Map([[DEFAULT_VIEW_ID, EHeatmapType.Click]]),
425
427
  setIsRendering: (isRendering, viewId = DEFAULT_VIEW_ID) => set((prev) => {
426
428
  const newIsRendering = new Map(prev.isRendering);
427
429
  newIsRendering.set(viewId, isRendering);
@@ -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,12 +527,14 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
503
527
  }),
504
528
  resetAll: () => set({
505
529
  isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
506
- rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
507
- deviceType: new Map([[DEFAULT_VIEW_ID, IDeviceType.Desktop]]),
508
- clickType: new Map([[DEFAULT_VIEW_ID, IClickType.All]]),
509
- clickMode: new Map([[DEFAULT_VIEW_ID, IClickMode.Default]]),
510
- scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
511
- heatmapType: new Map([[DEFAULT_VIEW_ID, IHeatmapType.Click]]),
530
+ isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
531
+ isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
532
+ rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
533
+ deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
534
+ clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
535
+ clickMode: new Map([[DEFAULT_VIEW_ID, EClickMode.Default]]),
536
+ scrollType: new Map([[DEFAULT_VIEW_ID, EScrollType.Depth]]),
537
+ heatmapType: new Map([[DEFAULT_VIEW_ID, EHeatmapType.Click]]),
512
538
  }),
513
539
  };
514
540
  }));
@@ -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,36 +1343,43 @@ 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) {
1339
1350
  if (!deviceType)
1340
1351
  return 1440;
1341
1352
  switch (deviceType) {
1342
- case IDeviceType.Desktop:
1353
+ case EDeviceType.Desktop:
1343
1354
  return 1440;
1344
- case IDeviceType.Tablet:
1355
+ case EDeviceType.Tablet:
1345
1356
  return 768;
1346
- case IDeviceType.Mobile:
1357
+ case EDeviceType.Mobile:
1347
1358
  return 375;
1348
1359
  }
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,22 +4460,22 @@ 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();
4450
4468
  useEffect(() => {
4451
4469
  switch (heatmapType) {
4452
- case IHeatmapType.Click:
4453
- if (clickMode === IClickMode.Default) {
4470
+ case EHeatmapType.Click:
4471
+ if (clickMode === EClickMode.Default) {
4454
4472
  startClickmap();
4455
4473
  }
4456
4474
  else {
4457
4475
  startAreaClickmap();
4458
4476
  }
4459
4477
  break;
4460
- case IHeatmapType.Scroll:
4478
+ case EHeatmapType.Scroll:
4461
4479
  startScrollmap();
4462
4480
  break;
4463
4481
  }
@@ -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,8 +6474,9 @@ function sortEvents(a, b) {
6456
6474
  }
6457
6475
 
6458
6476
  const useReplayRender = () => {
6459
- const setWidth = useHeatmapConfigStore((state) => state.setWidth);
6460
- const { data } = useHeatmapData();
6477
+ const data = useHeatmapDataContext((s) => s.data);
6478
+ const setIsRenderViz = useHeatmapVizContext((s) => s.setIsRenderViz);
6479
+ const setIframeHeight = useHeatmapVizRectContext((s) => s.setIframeHeight);
6461
6480
  const visualizerRef = useRef(null);
6462
6481
  const iframeRef = useRef(null);
6463
6482
  const eventsRef = useRef([]);
@@ -6474,15 +6493,16 @@ const useReplayRender = () => {
6474
6493
  const mobile = isMobileDevice(userAgent);
6475
6494
  visualizer.setup(iframe.contentWindow, {
6476
6495
  version: envelope.version,
6477
- onresize: (width) => {
6478
- setWidth(width);
6496
+ onresize: (height) => {
6497
+ height && setIframeHeight(height);
6498
+ setIsRenderViz(true);
6479
6499
  },
6480
6500
  mobile,
6481
6501
  vNext: true,
6482
6502
  locale: 'en-us',
6483
6503
  });
6484
6504
  return visualizer;
6485
- }, [setWidth]);
6505
+ }, []);
6486
6506
  // Animation loop for replay
6487
6507
  const replayLoop = useCallback(() => {
6488
6508
  if (!isPlayingRef.current)
@@ -6628,10 +6648,10 @@ const useContentDimensions = ({ iframeRef }) => {
6628
6648
  };
6629
6649
 
6630
6650
  const useObserveIframeHeight = (props) => {
6631
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6632
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6633
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
6634
- 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);
6635
6655
  const { iframeRef } = props;
6636
6656
  const resizeObserverRef = useRef(null);
6637
6657
  const mutationObserverRef = useRef(null);
@@ -6758,14 +6778,14 @@ const useObserveIframeHeight = (props) => {
6758
6778
  };
6759
6779
 
6760
6780
  const useScaleCalculation = (props) => {
6761
- const widthScale = useHeatmapViz((s) => s.widthScale);
6762
- const zoomRatio = useHeatmapViz((s) => s.zoomRatio);
6763
- const isScaledToFit = useHeatmapViz((s) => s.isScaledToFit);
6764
- const minZoomRatio = useHeatmapViz((s) => s.minZoomRatio);
6765
- const maxZoomRatio = useHeatmapViz((s) => s.maxZoomRatio);
6766
- const setScale = useHeatmapViz((s) => s.setScale);
6767
- const setIsScaledToFit = useHeatmapViz((s) => s.setIsScaledToFit);
6768
- 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);
6769
6789
  const { containerWidth, containerHeight, contentWidth, contentHeight } = props;
6770
6790
  const calculateScaleResult = useCallback(() => {
6771
6791
  if (containerWidth > 0 && contentWidth > 0 && containerHeight > 0 && contentHeight > 0) {
@@ -6828,7 +6848,7 @@ const useScrollSync = ({ widthScale, iframeRef }) => {
6828
6848
  };
6829
6849
 
6830
6850
  const useHeatmapScale = (props) => {
6831
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6851
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6832
6852
  const { wrapperRef, iframeRef } = props;
6833
6853
  // 1. Observe container dimensions
6834
6854
  const { containerWidth, containerHeight } = useContainerDimensions({ wrapperRef });
@@ -6856,9 +6876,9 @@ const useHeatmapScale = (props) => {
6856
6876
  const useIframeHeight = (props) => {
6857
6877
  const { iframeRef } = props;
6858
6878
  const iframeWidth = useHeatmapWidthByDevice();
6859
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
6860
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
6861
- 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);
6862
6882
  useIframeHeightProcessor({
6863
6883
  iframeRef: iframeRef,
6864
6884
  iframeWidth: iframeWidth,
@@ -6879,8 +6899,8 @@ const useIframeHeight = (props) => {
6879
6899
  };
6880
6900
 
6881
6901
  const useWrapperRefHeight = (props) => {
6882
- const setWrapperHeight = useHeatmapVizRect((s) => s.setWrapperHeight);
6883
- const setWrapperWidth = useHeatmapVizRect((s) => s.setWrapperWidth);
6902
+ const setWrapperHeight = useHeatmapVizRectContext((s) => s.setWrapperHeight);
6903
+ const setWrapperWidth = useHeatmapVizRectContext((s) => s.setWrapperWidth);
6884
6904
  const { isActive, wrapperRef } = props;
6885
6905
  const resizeObserverRef = useRef(null);
6886
6906
  const mutationObserverRef = useRef(null);
@@ -6952,7 +6972,7 @@ const useWrapperRefHeight = (props) => {
6952
6972
  };
6953
6973
 
6954
6974
  const useZonePositions = (_options) => {
6955
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
6975
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
6956
6976
  const getZonePosition = useCallback((zone) => {
6957
6977
  if (!iframeHeight) {
6958
6978
  return null;
@@ -6976,10 +6996,10 @@ const SCROLL_GRADIENT_COLORS = [
6976
6996
  ];
6977
6997
  const useScrollmapZones = (options) => {
6978
6998
  const { mode = 'basic', enabled = true, iframeRef, wrapperRef } = options;
6999
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
7000
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
6979
7001
  const [isReady, setIsReady] = useState(false);
6980
7002
  const [zones, setZones] = useState([]);
6981
- const { scrollmap } = useHeatmapData();
6982
- const { dataInfo } = useHeatmapData();
6983
7003
  const { getZonePosition } = useZonePositions();
6984
7004
  const scrollMapInfo = dataInfo?.scrollMapInfo;
6985
7005
  const maxUsers = useMemo(() => {
@@ -7126,25 +7146,24 @@ const BoxStack = forwardRef(({ children, ...props }, ref) => {
7126
7146
  BoxStack.displayName = 'BoxStack';
7127
7147
 
7128
7148
  const ContentMetricBar = () => {
7129
- const controls = useHeatmapControlStore((state) => state.controls);
7149
+ const CompMetricBar = useHeatmapControlStore((state) => state.controls.MetricBar);
7130
7150
  const borderBottom = `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`;
7131
7151
  return (jsx(BoxStack, { id: "gx-hm-content-metric-bar", flexDirection: "row", alignItems: "center", overflow: "auto", zIndex: 1, backgroundColor: "white", style: {
7132
7152
  borderBottom,
7133
- }, children: controls.MetricBar ?? null }));
7153
+ }, children: CompMetricBar && jsx(CompMetricBar, {}) }));
7134
7154
  };
7135
7155
  ContentMetricBar.displayName = 'ContentMetricBar';
7136
7156
 
7137
7157
  const ContentSidebar = () => {
7138
- const controls = useHeatmapControlStore((state) => state.controls);
7139
- const state = useHeatmapClick((s) => s.state);
7158
+ const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
7159
+ const state = useHeatmapClickContext((s) => s.state);
7140
7160
  const isHideSidebar = state.hideSidebar;
7141
7161
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
7142
7162
  const mode = useHeatmapConfigStore((state) => state.mode);
7143
- const SidebarComponent = controls.Sidebar ?? null;
7144
7163
  const isCompareMode = mode === 'compare';
7145
7164
  if (isCompareMode)
7146
7165
  return null;
7147
- if (!SidebarComponent)
7166
+ if (!CompSidebar)
7148
7167
  return null;
7149
7168
  return (jsx("div", { className: "gx-hm-sidebar", style: {
7150
7169
  height: '100%',
@@ -7161,7 +7180,7 @@ const ContentSidebar = () => {
7161
7180
  height: '100%',
7162
7181
  width: `calc(${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px)`,
7163
7182
  borderRight: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
7164
- }, children: jsx(SidebarComponent, {}) }) }));
7183
+ }, children: jsx(CompSidebar, {}) }) }));
7165
7184
  };
7166
7185
 
7167
7186
  const PopoverSidebar = () => {
@@ -7169,7 +7188,7 @@ const PopoverSidebar = () => {
7169
7188
  const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
7170
7189
  const CompSidebarActivator = useHeatmapControlStore((state) => state.controls.SidebarActivator);
7171
7190
  const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
7172
- const state = useHeatmapClick((s) => s.state);
7191
+ const state = useHeatmapClickContext((s) => s.state);
7173
7192
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
7174
7193
  const isCompareMode = mode === 'compare';
7175
7194
  const isHideSidebar = state.hideSidebar;
@@ -7197,15 +7216,10 @@ const PopoverSidebar = () => {
7197
7216
  };
7198
7217
 
7199
7218
  const ContentToolbar = () => {
7200
- const controls = useHeatmapControlStore((state) => state.controls);
7201
- return (jsx("div", { id: "gx-hm-content-toolbar", style: {
7202
- position: 'absolute',
7203
- bottom: 0,
7204
- left: '8px',
7205
- right: '24px',
7206
- padding: '8px',
7207
- paddingBlock: '16px',
7208
- }, 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, {}) }));
7209
7223
  };
7210
7224
 
7211
7225
  const VizContainer = ({ children, isActive = false }) => {
@@ -7759,7 +7773,7 @@ const AreaEditHighlight = ({ element, shadowRoot, onClick }) => {
7759
7773
  AreaEditHighlight.displayName = 'AreaEditHighlight';
7760
7774
 
7761
7775
  const AreaEditHighlightPortal = ({ shadowContainer, iframeRef, customShadowRoot, onAreaCreated, }) => {
7762
- const isEditingMode = useHeatmapAreaClick((s) => s.isEditingMode);
7776
+ const isEditingMode = useHeatmapAreaClickContext((s) => s.isEditingMode);
7763
7777
  const { onAreaCreatedElement } = useAreaCreation({ customShadowRoot, onAreaCreated });
7764
7778
  const { hoveredElement } = useAreaEditMode({ iframeRef, enabled: true, onAreaCreatedElement });
7765
7779
  if (!isEditingMode || !hoveredElement)
@@ -7874,7 +7888,7 @@ const AreaOverlay = memo(AreaOverlayComponent, (prevProps, nextProps) => {
7874
7888
  });
7875
7889
 
7876
7890
  const SelectedAreaOverlay = () => {
7877
- const selectedArea = useHeatmapAreaClick((s) => s.selectedArea);
7891
+ const selectedArea = useHeatmapAreaClickContext((s) => s.selectedArea);
7878
7892
  if (!selectedArea)
7879
7893
  return null;
7880
7894
  return (jsx(Fragment$1, { children: jsx("style", { children: `
@@ -7885,13 +7899,13 @@ const SelectedAreaOverlay = () => {
7885
7899
  };
7886
7900
 
7887
7901
  const AreasPortal = ({ shadowContainer, onAreaClick }) => {
7888
- const areas = useHeatmapAreaClick((s) => s.areas);
7902
+ const areas = useHeatmapAreaClickContext((s) => s.areas);
7889
7903
  return createPortal(jsxs(Fragment$1, { children: [areas.map((area) => (jsx(AreaOverlay, { area: area, onAreaClick: onAreaClick }, area.id))), jsx(SelectedAreaOverlay, {})] }), shadowContainer);
7890
7904
  };
7891
7905
 
7892
7906
  const AutoScrollHandler = ({ visualRef }) => {
7893
- const widthScale = useHeatmapViz((s) => s.widthScale);
7894
- const selectedArea = useHeatmapAreaClick((s) => s.selectedArea);
7907
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7908
+ const selectedArea = useHeatmapAreaClickContext((s) => s.selectedArea);
7895
7909
  useEffect(() => {
7896
7910
  if (!selectedArea)
7897
7911
  return;
@@ -7905,7 +7919,7 @@ const AutoScrollHandler = ({ visualRef }) => {
7905
7919
  };
7906
7920
 
7907
7921
  const PortalAreaRenderer = ({ iframeRef, visualRef, shadowRoot, onAreaCreated, onAreaClick, }) => {
7908
- const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
7922
+ const isRenderViz = useHeatmapVizContext((s) => s.isRenderViz);
7909
7923
  const iframeDocument = iframeRef.current?.contentDocument || undefined;
7910
7924
  const { shadowContainer, isReady } = useAreaRendererContainer(iframeDocument, shadowRoot);
7911
7925
  useAreaRectSync({ iframeDocument, shadowRoot, enabled: isReady && isRenderViz });
@@ -7916,9 +7930,9 @@ const PortalAreaRenderer = ({ iframeRef, visualRef, shadowRoot, onAreaCreated, o
7916
7930
  };
7917
7931
 
7918
7932
  const VizAreaClick = ({ iframeRef, visualRef, shadowRoot, autoCreateTopN = 10, enableOverlapResolution = true, onAreaClick, }) => {
7919
- const clickAreas = useHeatmapData((s) => s.clickAreas);
7920
- const resetView = useHeatmapAreaClick((s) => s.resetView);
7921
- 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);
7922
7936
  useAreaTopAutoDetect({ autoCreateTopN, shadowRoot, disabled: !!clickAreas?.length });
7923
7937
  useAreaFilterVisible({ iframeRef, enableOverlapResolution });
7924
7938
  useAreaHydration({ shadowRoot });
@@ -7934,7 +7948,7 @@ const VizAreaClick = ({ iframeRef, visualRef, shadowRoot, autoCreateTopN = 10, e
7934
7948
  VizAreaClick.displayName = 'VizAreaClick';
7935
7949
 
7936
7950
  const RankBadgeComponent = ({ index, hash, elementRect, widthScale, show = true, clickOnElement, }) => {
7937
- const clickedHash = useHeatmapClick((s) => s.selectedElement?.hash);
7951
+ const clickedHash = useHeatmapClickContext((s) => s.selectedElement?.hash);
7938
7952
  const isShow = !!show && clickedHash !== hash;
7939
7953
  if (!isShow || !ELM_CALLOUT_CONFIG.SHOW_RANK_BADGE)
7940
7954
  return null;
@@ -7946,8 +7960,8 @@ const RankBadge = memo(RankBadgeComponent);
7946
7960
 
7947
7961
  const NUMBER_OF_TOP_ELEMENTS = 10;
7948
7962
  const DefaultRankBadgesComponent = ({ getRect, hidden }) => {
7949
- const dataInfo = useHeatmapData((s) => s.dataInfo);
7950
- const widthScale = useHeatmapViz((s) => s.widthScale);
7963
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
7964
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7951
7965
  const elements = dataInfo?.sortedElements?.slice(0, NUMBER_OF_TOP_ELEMENTS) ?? [];
7952
7966
  if (hidden || elements.length === 0)
7953
7967
  return null;
@@ -7969,7 +7983,7 @@ const DEFAULT_POSITION = {
7969
7983
  };
7970
7984
  const ElementCallout = (props) => {
7971
7985
  const viewId = useViewIdContext();
7972
- const widthScale = useHeatmapViz((s) => s.widthScale);
7986
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
7973
7987
  const CompElementCallout = useHeatmapControlStore((state) => state.controls.ElementCallout);
7974
7988
  const calloutRef = useRef(null);
7975
7989
  const element = props.element;
@@ -8001,7 +8015,7 @@ const ElementCallout = (props) => {
8001
8015
  }
8002
8016
  };
8003
8017
  const useAnchorPosition = (calloutRef, props) => {
8004
- const widthScale = useHeatmapViz((s) => s.widthScale);
8018
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8005
8019
  const { target, visualRef, alignment, element, positionMode } = props;
8006
8020
  const [position, setPosition] = useState(DEFAULT_POSITION);
8007
8021
  const isAbsolute = positionMode === 'absolute';
@@ -8056,7 +8070,7 @@ const useAnchorPosition = (calloutRef, props) => {
8056
8070
  };
8057
8071
 
8058
8072
  const ElementMissing = ({ show = true, visualRef }) => {
8059
- const widthScale = useHeatmapViz((s) => s.widthScale);
8073
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8060
8074
  const missingElementRef = useRef(null);
8061
8075
  const wrapperWidth = useHeatmapWidthByDevice();
8062
8076
  const [scrollPosition, setScrollPosition] = useState({ scrollTop: 0, scrollLeft: 0 });
@@ -8171,7 +8185,7 @@ const BackdropCanvas = ({ activeElement, viewportWidth, viewportHeight, borderWi
8171
8185
 
8172
8186
  const ElementCalloutOverlay = (props) => {
8173
8187
  const { element, containerRef } = props;
8174
- const widthScale = useHeatmapViz((s) => s.widthScale);
8188
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8175
8189
  const CompElementCallout = useHeatmapControlStore((state) => state.controls.ElementCallout);
8176
8190
  const calloutRef = useRef(null);
8177
8191
  const [position, setPosition] = useState({
@@ -8210,8 +8224,8 @@ ElementCalloutOverlay.displayName = 'ElementCalloutOverlay';
8210
8224
 
8211
8225
  const ElementOverlayComponent = (props) => {
8212
8226
  const { type, element, onClick, elementId, hideOutline } = props;
8213
- const widthScale = useHeatmapViz((s) => s.widthScale);
8214
- const viewportHeight = useHeatmapVizRect((s) => s.iframeHeight);
8227
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8228
+ const viewportHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8215
8229
  const viewportWidth = useHeatmapWidthByDevice();
8216
8230
  const overlayStyle = useMemo(() => {
8217
8231
  const isInvalid = !element || (element.width === 0 && element.height === 0);
@@ -8252,8 +8266,8 @@ const ElementCalloutClicked = memo(ElementCalloutClickedComponent);
8252
8266
 
8253
8267
  const HoveredElementOverlayComponent = ({ onClick }) => {
8254
8268
  const viewId = useViewIdContext();
8255
- const hoveredElement = useHeatmapHover((s) => s.hoveredElement);
8256
- const clickedElement = useHeatmapClick((s) => s.selectedElement);
8269
+ const hoveredElement = useHeatmapHoverContext((s) => s.hoveredElement);
8270
+ const clickedElement = useHeatmapClickContext((s) => s.selectedElement);
8257
8271
  const handleClick = (event) => {
8258
8272
  if (onClick) {
8259
8273
  onClick(event, hoveredElement?.hash ?? '');
@@ -8270,7 +8284,7 @@ const HoveredElementOverlay = memo(HoveredElementOverlayComponent);
8270
8284
  const IS_SHOW_CALLOUT = false;
8271
8285
  const ElementCalloutHoveredComponent = (props) => {
8272
8286
  const viewId = useViewIdContext();
8273
- useHeatmapHover((s) => s.hoveredElement);
8287
+ useHeatmapHoverContext((s) => s.hoveredElement);
8274
8288
  getHoveredElementId(viewId, props.isSecondary);
8275
8289
  const isShowCallout = IS_SHOW_CALLOUT ;
8276
8290
  return (jsxs(Fragment, { children: [jsx(HoveredElementOverlay, { onClick: props.onClick }), isShowCallout ] }));
@@ -8279,7 +8293,7 @@ const ElementCalloutHovered = memo(ElementCalloutHoveredComponent);
8279
8293
 
8280
8294
  const HeatmapElements = (props) => {
8281
8295
  const viewId = useViewIdContext();
8282
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8296
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8283
8297
  const elementCalloutRef = useRef(null);
8284
8298
  const { iframeDimensions, positionMode } = props;
8285
8299
  const { visualRef, iframeRef, wrapperRef, visualizer } = props;
@@ -8295,8 +8309,8 @@ const HeatmapElements = (props) => {
8295
8309
 
8296
8310
  const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8297
8311
  const contentWidth = useHeatmapWidthByDevice();
8298
- const dataInfo = useHeatmapData((s) => s.dataInfo);
8299
- const vizRef = useHeatmapVizRect((s) => s.vizRef);
8312
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
8313
+ const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
8300
8314
  const visualizer = {
8301
8315
  get: (hash) => {
8302
8316
  if (!vizRef)
@@ -8317,15 +8331,15 @@ const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
8317
8331
  };
8318
8332
 
8319
8333
  const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8320
- const clickMode = useHeatmapSetting((state) => state.clickMode);
8321
- const heatmapType = useHeatmapSetting((state) => state.heatmapType);
8322
- const isClickType = heatmapType === IHeatmapType.Click;
8334
+ const clickMode = useHeatmapSettingContext((state) => state.clickMode);
8335
+ const heatmapType = useHeatmapSettingContext((state) => state.heatmapType);
8336
+ const isClickType = heatmapType === EHeatmapType.Click;
8323
8337
  if (!isClickType)
8324
8338
  return null;
8325
8339
  switch (clickMode) {
8326
- case IClickMode.Default:
8340
+ case EClickMode.Default:
8327
8341
  return jsx(VizElements, { iframeRef: iframeRef, visualRef: visualRef, wrapperRef: wrapperRef });
8328
- case IClickMode.Area:
8342
+ case EClickMode.Area:
8329
8343
  return (jsx(VizAreaClick, { iframeRef: iframeRef, visualRef: visualRef, autoCreateTopN: 10, onAreaClick: (_area) => {
8330
8344
  // console.log('area clicked', area);
8331
8345
  } }));
@@ -8333,9 +8347,9 @@ const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
8333
8347
  };
8334
8348
 
8335
8349
  const ScrollMapMinimap = ({ zones, maxUsers }) => {
8336
- const scrollType = useHeatmapSetting((s) => s.scrollType);
8337
- const showMinimap = useHeatmapScroll((s) => s.showMinimap);
8338
- const isScrollType = [IScrollType.Attention].includes(scrollType ?? IScrollType.Depth);
8350
+ const scrollType = useHeatmapSettingContext((s) => s.scrollType);
8351
+ const showMinimap = useHeatmapScrollContext((s) => s.showMinimap);
8352
+ const isScrollType = [EScrollType.Attention].includes(scrollType ?? EScrollType.Depth);
8339
8353
  if (!showMinimap || !isScrollType)
8340
8354
  return null;
8341
8355
  return (jsx("div", { style: {
@@ -8394,7 +8408,7 @@ const ScrollZoneTooltip = ({ zone, position, currentScrollPercent, scrollmap, })
8394
8408
  };
8395
8409
 
8396
8410
  const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) => {
8397
- const { scrollmap } = useHeatmapData();
8411
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
8398
8412
  // const hoveredZone = useHeatmapVizScrollStore((state) => state.hoveredZone);
8399
8413
  // const setHoveredZone = useHeatmapVizScrollStore((state) => state.setHoveredZone);
8400
8414
  const { zones, isReady, maxUsers } = useScrollmapZones({
@@ -8409,8 +8423,8 @@ const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) =
8409
8423
  };
8410
8424
 
8411
8425
  const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
8412
- const widthScale = useHeatmapViz((s) => s.widthScale);
8413
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8426
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8427
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8414
8428
  const overlayRef = useRef(null);
8415
8429
  const [position, setPosition] = useState();
8416
8430
  const [currentScrollPercent, setCurrentScrollPercent] = useState(0);
@@ -8447,7 +8461,7 @@ const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
8447
8461
  };
8448
8462
 
8449
8463
  const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8450
- const { dataInfo } = useHeatmapData();
8464
+ const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
8451
8465
  const { getZonePosition } = useZonePositions();
8452
8466
  const averageFold = dataInfo?.averageFold || 50;
8453
8467
  const position = getZonePosition({
@@ -8484,8 +8498,8 @@ const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
8484
8498
  };
8485
8499
 
8486
8500
  const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8487
- const scrollType = useHeatmapSetting((s) => s.scrollType);
8488
- const { scrollmap } = useHeatmapData();
8501
+ const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
8502
+ const scrollType = useHeatmapSettingContext((s) => s.scrollType);
8489
8503
  const { getZonePosition } = useZonePositions();
8490
8504
  if (!scrollmap || scrollmap.length === 0)
8491
8505
  return null;
@@ -8506,7 +8520,7 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8506
8520
  { percent: 25, label: '25%', color: '#EF4444' },
8507
8521
  { percent: 5, label: '5%', color: '#8B5CF6' },
8508
8522
  ];
8509
- const isScrollDepth = scrollType === IScrollType.Depth;
8523
+ const isScrollDepth = scrollType === EScrollType.Depth;
8510
8524
  if (!isScrollDepth)
8511
8525
  return null;
8512
8526
  return (jsx(Fragment, { children: boundaries.map((boundary) => {
@@ -8558,12 +8572,12 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
8558
8572
  }) }));
8559
8573
  };
8560
8574
 
8561
- const SCROLL_TYPES = [IHeatmapType.Scroll];
8575
+ const SCROLL_TYPES = [EHeatmapType.Scroll];
8562
8576
  const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8563
- const heatmapType = useHeatmapSetting((s) => s.heatmapType);
8564
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8577
+ const heatmapType = useHeatmapSettingContext((s) => s.heatmapType);
8578
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8565
8579
  // useRenderCount('VizScrollMap');
8566
- const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? IHeatmapType.Click);
8580
+ const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? EHeatmapType.Click);
8567
8581
  if (!iframeHeight || !isHeatmapScroll)
8568
8582
  return null;
8569
8583
  return (jsxs("div", { style: {
@@ -8577,12 +8591,29 @@ const VizScrollMap = ({ iframeRef, wrapperRef }) => {
8577
8591
  }, children: [jsx(ScrollmapMarker, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(AverageFoldLine, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(ScrollMapOverlay, { wrapperRef: wrapperRef, iframeRef: iframeRef })] }));
8578
8592
  };
8579
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
+
8580
8609
  const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHeight, onScroll, }) => {
8581
- const widthScale = useHeatmapViz((s) => s.widthScale);
8610
+ const isLoadingCanvas = useHeatmapSettingContext((state) => state.isLoadingCanvas);
8611
+ const widthScale = useHeatmapVizContext((s) => s.widthScale);
8582
8612
  const contentWidth = useHeatmapWidthByDevice();
8583
8613
  const contentHeight = calcContentHeight();
8584
8614
  return (jsx("div", { ref: visualRef, className: "gx-hm-visual", onScroll: onScroll, style: {
8585
- overflow: 'hidden scroll',
8615
+ overflowX: 'hidden',
8616
+ overflowY: iframeHeight > 0 && !isLoadingCanvas ? 'scroll' : 'hidden',
8586
8617
  display: 'flex',
8587
8618
  position: 'relative',
8588
8619
  justifyContent: 'center',
@@ -8594,6 +8625,7 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8594
8625
  display: 'flex',
8595
8626
  justifyContent: 'center',
8596
8627
  alignItems: 'flex-start',
8628
+ position: 'relative',
8597
8629
  height: contentHeight,
8598
8630
  padding: HEATMAP_STYLE['wrapper']['padding'],
8599
8631
  paddingBottom: HEATMAP_STYLE['viz']['paddingBottom'],
@@ -8615,8 +8647,8 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
8615
8647
  const VizDomRenderer = ({ mode = 'heatmap' }) => {
8616
8648
  const viewId = useViewIdContext();
8617
8649
  const contentWidth = useHeatmapWidthByDevice();
8618
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8619
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8650
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8651
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8620
8652
  const wrapperRef = useRef(null);
8621
8653
  const visualRef = useRef(null);
8622
8654
  const { iframeRef } = useHeatmapRenderByMode(mode);
@@ -8627,23 +8659,30 @@ const VizDomRenderer = ({ mode = 'heatmap' }) => {
8627
8659
  const scrollTop = e.currentTarget.scrollTop;
8628
8660
  handleScroll(scrollTop);
8629
8661
  };
8630
- 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 })] }));
8631
8663
  };
8632
8664
 
8633
8665
  const VizLoading = () => {
8634
- 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" }) }));
8635
8674
  };
8636
8675
 
8637
8676
  const VizDomHeatmap = () => {
8638
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8639
- const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
8640
- const setVizRef = useHeatmapVizRect((s) => s.setVizRef);
8641
- const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
8642
- const setSelectedElement = useHeatmapClick((s) => s.setSelectedElement);
8643
- const setHoveredElement = useHeatmapHover((s) => s.setHoveredElement);
8644
- // const setSelectedArea = useHeatmapAreaClick((s) => s.setSelectedArea);
8645
- // const setHoveredArea = useHeatmapAreaClick((s) => s.setHoveredArea);
8646
- // 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);
8647
8686
  useRenderCount('VizDomHeatmap');
8648
8687
  const cleanUp = () => {
8649
8688
  setVizRef(null);
@@ -8664,8 +8703,8 @@ VizDomHeatmap.displayName = 'VizDomHeatmap';
8664
8703
 
8665
8704
  const VizLiveRenderer = () => {
8666
8705
  const contentWidth = useHeatmapWidthByDevice();
8667
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8668
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8706
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8707
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8669
8708
  const visualRef = useRef(null);
8670
8709
  const wrapperRef = useRef(null);
8671
8710
  const { iframeRef } = useVizLiveRender();
@@ -8678,25 +8717,28 @@ const VizLiveRenderer = () => {
8678
8717
  };
8679
8718
 
8680
8719
  const VizLiveHeatmap = () => {
8681
- const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
8682
- const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
8720
+ const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
8721
+ const wrapperHeight = useHeatmapVizRectContext((s) => s.wrapperHeight);
8683
8722
  useHeatmapLiveStore((state) => state.reset);
8723
+ const CompVizLoading = useHeatmapControlStore((state) => state.controls.VizLoading);
8684
8724
  // TODO: Remove this after testing
8685
8725
  useEffect(() => {
8686
8726
  return () => {
8687
8727
  // reset();
8688
8728
  };
8689
8729
  }, []);
8690
- 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] }));
8691
8731
  };
8692
8732
  VizLiveHeatmap.displayName = 'VizLiveHeatmap';
8693
8733
 
8694
8734
  const ContentVizByMode = () => {
8695
8735
  const mode = useHeatmapConfigStore((state) => state.mode);
8696
- const controls = useHeatmapControlStore((state) => state.controls);
8697
- const isRendering = useHeatmapSetting((state) => state.isRendering);
8698
- if (isRendering)
8699
- 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
+ }
8700
8742
  switch (mode) {
8701
8743
  case 'live':
8702
8744
  return jsx(VizLiveHeatmap, {});
@@ -8709,22 +8751,21 @@ const ContentVizByMode = () => {
8709
8751
  ContentVizByMode.displayName = 'ContentVizByMode';
8710
8752
 
8711
8753
  const HeatmapPreview = () => {
8712
- 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, {})] })] }));
8713
8755
  };
8714
8756
 
8715
8757
  const ContentTopBar = () => {
8716
- const controls = useHeatmapControlStore((state) => state.controls);
8717
- const TopBar = controls.TopBar;
8758
+ const CompTopBar = useHeatmapControlStore((state) => state.controls.TopBar);
8718
8759
  return (jsx(BoxStack, { id: "gx-hm-content-header", flexDirection: "row", alignItems: "center", overflow: "auto", zIndex: 1, backgroundColor: "white", style: {
8719
8760
  borderBottom: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
8720
- }, children: TopBar && jsx(TopBar, {}) }));
8761
+ }, children: CompTopBar && jsx(CompTopBar, {}) }));
8721
8762
  };
8722
8763
 
8723
- const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, }) => {
8764
+ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, isLoading, isLoadingCanvas, }) => {
8724
8765
  useRegisterControl(controls);
8725
8766
  useRegisterData(data, dataInfo);
8726
8767
  useRegisterHeatmap({ clickmap, scrollmap, clickAreas });
8727
- useRegisterConfig();
8768
+ useRegisterConfig({ isLoading, isLoadingCanvas });
8728
8769
  // performanceLogger.configure({
8729
8770
  // enabled: true,
8730
8771
  // logToConsole: false,
@@ -8753,4 +8794,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
8753
8794
  }
8754
8795
  };
8755
8796
 
8756
- export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, ELM_CALLOUT_CONFIG, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, IClickMode, IClickRankType, IClickType, IDeviceType, IHeatmapType, IScrollType, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, 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 };