@gemx-dev/heatmap-react 3.5.62 → 3.5.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/Layout/Sidebar/PopoverSidebar.d.ts.map +1 -1
- package/dist/esm/components/Layout/VizByMode/ContentVizByMode.d.ts.map +1 -1
- package/dist/esm/components/VizDom/VizDomRenderer.d.ts.map +1 -1
- package/dist/esm/components/VizDom/WrapperVisual.d.ts.map +1 -1
- package/dist/esm/components/VizElement/ElementMissing.d.ts.map +1 -1
- package/dist/esm/components/VizElement/ElementOverlay.d.ts.map +1 -1
- package/dist/esm/components/VizElement/VizElements.d.ts.map +1 -1
- package/dist/esm/components/VizLive/VizLiveRenderer.d.ts.map +1 -1
- package/dist/esm/components/VizScrollmap/ScrollMapMinimap.d.ts.map +1 -1
- package/dist/esm/components/VizScrollmap/ScrollmapMarker.d.ts.map +1 -1
- package/dist/esm/components/VizScrollmap/VizScrollMap.d.ts.map +1 -1
- package/dist/esm/helpers/viewport/element.d.ts.map +1 -1
- package/dist/esm/hooks/common/index.d.ts +1 -0
- package/dist/esm/hooks/common/index.d.ts.map +1 -1
- package/dist/esm/hooks/common/useHeatmapWidthByDevice.d.ts +2 -0
- package/dist/esm/hooks/common/useHeatmapWidthByDevice.d.ts.map +1 -0
- package/dist/esm/hooks/register/useRegisterConfig.d.ts.map +1 -1
- package/dist/esm/hooks/register/useRegisterData.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapAreaClick.d.ts +2 -49
- package/dist/esm/hooks/view-context/useHeatmapAreaClick.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapCopyView.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapData.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapHover.d.ts +3 -27
- package/dist/esm/hooks/view-context/useHeatmapHover.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapScroll.d.ts +2 -32
- package/dist/esm/hooks/view-context/useHeatmapScroll.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts +9 -17
- package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapViz.d.ts +0 -17
- package/dist/esm/hooks/view-context/useHeatmapViz.d.ts.map +1 -1
- package/dist/esm/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
- package/dist/esm/hooks/viz-live/useVizLiveRender.d.ts.map +1 -1
- package/dist/esm/hooks/viz-render/useHeatmapRender.d.ts.map +1 -1
- package/dist/esm/hooks/viz-scale/useHeatmapScale.d.ts.map +1 -1
- package/dist/esm/index.js +208 -216
- package/dist/esm/index.mjs +208 -216
- package/dist/esm/stores/config.d.ts +0 -11
- package/dist/esm/stores/config.d.ts.map +1 -1
- package/dist/esm/stores/index.d.ts +1 -1
- package/dist/esm/stores/index.d.ts.map +1 -1
- package/dist/esm/stores/setting.d.ts +9 -1
- package/dist/esm/stores/setting.d.ts.map +1 -1
- package/dist/esm/stores/viz-area-click.d.ts +1 -1
- package/dist/esm/stores/viz-area-click.d.ts.map +1 -1
- package/dist/esm/stores/viz-click.d.ts +3 -3
- package/dist/esm/stores/viz-click.d.ts.map +1 -1
- package/dist/esm/stores/viz-hover.d.ts +2 -1
- package/dist/esm/stores/viz-hover.d.ts.map +1 -1
- package/dist/esm/stores/{viz-scrollmap.d.ts → viz-scroll.d.ts} +7 -7
- package/dist/esm/stores/viz-scroll.d.ts.map +1 -0
- package/dist/esm/types/heatmap.d.ts +5 -1
- package/dist/esm/types/heatmap.d.ts.map +1 -1
- package/dist/umd/components/Layout/Sidebar/PopoverSidebar.d.ts.map +1 -1
- package/dist/umd/components/Layout/VizByMode/ContentVizByMode.d.ts.map +1 -1
- package/dist/umd/components/VizDom/VizDomRenderer.d.ts.map +1 -1
- package/dist/umd/components/VizDom/WrapperVisual.d.ts.map +1 -1
- package/dist/umd/components/VizElement/ElementMissing.d.ts.map +1 -1
- package/dist/umd/components/VizElement/ElementOverlay.d.ts.map +1 -1
- package/dist/umd/components/VizElement/VizElements.d.ts.map +1 -1
- package/dist/umd/components/VizLive/VizLiveRenderer.d.ts.map +1 -1
- package/dist/umd/components/VizScrollmap/ScrollMapMinimap.d.ts.map +1 -1
- package/dist/umd/components/VizScrollmap/ScrollmapMarker.d.ts.map +1 -1
- package/dist/umd/components/VizScrollmap/VizScrollMap.d.ts.map +1 -1
- package/dist/umd/helpers/viewport/element.d.ts.map +1 -1
- package/dist/umd/hooks/common/index.d.ts +1 -0
- package/dist/umd/hooks/common/index.d.ts.map +1 -1
- package/dist/umd/hooks/common/useHeatmapWidthByDevice.d.ts +2 -0
- package/dist/umd/hooks/common/useHeatmapWidthByDevice.d.ts.map +1 -0
- package/dist/umd/hooks/register/useRegisterConfig.d.ts.map +1 -1
- package/dist/umd/hooks/register/useRegisterData.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapAreaClick.d.ts +2 -49
- package/dist/umd/hooks/view-context/useHeatmapAreaClick.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapCopyView.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapData.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapHover.d.ts +3 -27
- package/dist/umd/hooks/view-context/useHeatmapHover.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapScroll.d.ts +2 -32
- package/dist/umd/hooks/view-context/useHeatmapScroll.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts +9 -17
- package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapViz.d.ts +0 -17
- package/dist/umd/hooks/view-context/useHeatmapViz.d.ts.map +1 -1
- package/dist/umd/hooks/viz-elm/useHoveredElement.d.ts.map +1 -1
- package/dist/umd/hooks/viz-live/useVizLiveRender.d.ts.map +1 -1
- package/dist/umd/hooks/viz-render/useHeatmapRender.d.ts.map +1 -1
- package/dist/umd/hooks/viz-scale/useHeatmapScale.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/stores/config.d.ts +0 -11
- package/dist/umd/stores/config.d.ts.map +1 -1
- package/dist/umd/stores/index.d.ts +1 -1
- package/dist/umd/stores/index.d.ts.map +1 -1
- package/dist/umd/stores/setting.d.ts +9 -1
- package/dist/umd/stores/setting.d.ts.map +1 -1
- package/dist/umd/stores/viz-area-click.d.ts +1 -1
- package/dist/umd/stores/viz-area-click.d.ts.map +1 -1
- package/dist/umd/stores/viz-click.d.ts +3 -3
- package/dist/umd/stores/viz-click.d.ts.map +1 -1
- package/dist/umd/stores/viz-hover.d.ts +2 -1
- package/dist/umd/stores/viz-hover.d.ts.map +1 -1
- package/dist/umd/stores/{viz-scrollmap.d.ts → viz-scroll.d.ts} +7 -7
- package/dist/umd/stores/viz-scroll.d.ts.map +1 -0
- package/dist/umd/types/heatmap.d.ts +5 -1
- package/dist/umd/types/heatmap.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/esm/stores/viz-scrollmap.d.ts.map +0 -1
- package/dist/umd/stores/viz-scrollmap.d.ts.map +0 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -149,32 +149,15 @@ function useDebounceCallback(callback, delay) {
|
|
|
149
149
|
}, [delay]);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
MetricBar: null,
|
|
159
|
-
VizLoading: null,
|
|
160
|
-
TopBar: undefined,
|
|
161
|
-
ElementCallout: undefined,
|
|
162
|
-
},
|
|
163
|
-
registerControl: (key, control) => {
|
|
164
|
-
set({
|
|
165
|
-
controls: {
|
|
166
|
-
...get().controls,
|
|
167
|
-
[key]: control,
|
|
168
|
-
},
|
|
169
|
-
});
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
|
|
152
|
+
var IDeviceType;
|
|
153
|
+
(function (IDeviceType) {
|
|
154
|
+
IDeviceType["Desktop"] = "desktop";
|
|
155
|
+
IDeviceType["Mobile"] = "mobile";
|
|
156
|
+
IDeviceType["Tablet"] = "tablet";
|
|
157
|
+
})(IDeviceType || (IDeviceType = {}));
|
|
174
158
|
var IHeatmapType;
|
|
175
159
|
(function (IHeatmapType) {
|
|
176
160
|
IHeatmapType["Click"] = "click";
|
|
177
|
-
IHeatmapType["ClickArea"] = "click-area";
|
|
178
161
|
IHeatmapType["Scroll"] = "scroll";
|
|
179
162
|
})(IHeatmapType || (IHeatmapType = {}));
|
|
180
163
|
var IClickType;
|
|
@@ -207,24 +190,37 @@ var IScrollType;
|
|
|
207
190
|
IScrollType["Revenue"] = "revenue-scroll";
|
|
208
191
|
})(IScrollType || (IScrollType = {}));
|
|
209
192
|
|
|
193
|
+
const useHeatmapControlStore = create()((set, get) => {
|
|
194
|
+
return {
|
|
195
|
+
controls: {
|
|
196
|
+
Sidebar: undefined,
|
|
197
|
+
SidebarActivator: undefined,
|
|
198
|
+
Toolbar: null,
|
|
199
|
+
MetricBar: null,
|
|
200
|
+
VizLoading: null,
|
|
201
|
+
TopBar: undefined,
|
|
202
|
+
ElementCallout: undefined,
|
|
203
|
+
},
|
|
204
|
+
registerControl: (key, control) => {
|
|
205
|
+
set({
|
|
206
|
+
controls: {
|
|
207
|
+
...get().controls,
|
|
208
|
+
[key]: control,
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
|
|
210
215
|
const useHeatmapConfigStore = create()((set) => {
|
|
211
216
|
return {
|
|
212
217
|
mode: 'single',
|
|
213
|
-
width: 1440,
|
|
214
218
|
sidebarWidth: DEFAULT_SIDEBAR_WIDTH,
|
|
215
|
-
heatmapType: IHeatmapType.Click,
|
|
216
|
-
clickType: IClickType.Total,
|
|
217
219
|
clickMode: IClickMode.Default,
|
|
218
|
-
scrollType: IScrollType.Depth,
|
|
219
220
|
isRendering: true,
|
|
220
221
|
setMode: (mode) => set({ mode }),
|
|
221
222
|
resetMode: () => set({ mode: 'single' }),
|
|
222
|
-
setWidth: (width) => set({ width }),
|
|
223
223
|
setSidebarWidth: (sidebarWidth) => set({ sidebarWidth }),
|
|
224
|
-
setHeatmapType: (heatmapType) => set({ heatmapType }),
|
|
225
|
-
setClickType: (clickType) => set({ clickType }),
|
|
226
|
-
setClickMode: (clickMode) => set({ clickMode }),
|
|
227
|
-
setScrollType: (scrollType) => set({ scrollType }),
|
|
228
224
|
setIsRendering: (isRendering) => set({ isRendering }),
|
|
229
225
|
};
|
|
230
226
|
});
|
|
@@ -328,9 +324,23 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
328
324
|
|
|
329
325
|
const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
330
326
|
return {
|
|
327
|
+
isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
331
328
|
rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
|
|
329
|
+
deviceType: new Map([[DEFAULT_VIEW_ID, IDeviceType.Desktop]]),
|
|
332
330
|
clickType: new Map([[DEFAULT_VIEW_ID, IClickType.Total]]),
|
|
331
|
+
clickMode: new Map([[DEFAULT_VIEW_ID, IClickMode.Default]]),
|
|
333
332
|
scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
|
|
333
|
+
heatmapType: new Map([[DEFAULT_VIEW_ID, IHeatmapType.Click]]),
|
|
334
|
+
setIsRendering: (isRendering, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
335
|
+
const newIsRendering = new Map(prev.isRendering);
|
|
336
|
+
newIsRendering.set(viewId, isRendering);
|
|
337
|
+
return { isRendering: newIsRendering };
|
|
338
|
+
}),
|
|
339
|
+
setDeviceType: (deviceType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
340
|
+
const newDeviceType = new Map(prev.deviceType);
|
|
341
|
+
newDeviceType.set(viewId, deviceType);
|
|
342
|
+
return { deviceType: newDeviceType };
|
|
343
|
+
}),
|
|
334
344
|
setRankedBy: (rankedBy, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
335
345
|
const newRankedBy = new Map(prev.rankedBy);
|
|
336
346
|
newRankedBy.set(viewId, rankedBy);
|
|
@@ -341,41 +351,73 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
341
351
|
newClickType.set(viewId, clickType);
|
|
342
352
|
return { clickType: newClickType };
|
|
343
353
|
}),
|
|
354
|
+
setClickMode: (clickMode, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
355
|
+
const newClickMode = new Map(prev.clickMode);
|
|
356
|
+
newClickMode.set(viewId, clickMode);
|
|
357
|
+
return { clickMode: newClickMode };
|
|
358
|
+
}),
|
|
344
359
|
setScrollType: (scrollType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
345
360
|
const newScrollType = new Map(prev.scrollType);
|
|
346
361
|
newScrollType.set(viewId, scrollType);
|
|
347
362
|
return { scrollType: newScrollType };
|
|
348
363
|
}),
|
|
364
|
+
setHeatmapType: (heatmapType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
365
|
+
const newHeatmapType = new Map(prev.heatmapType);
|
|
366
|
+
newHeatmapType.set(viewId, heatmapType);
|
|
367
|
+
return { heatmapType: newHeatmapType };
|
|
368
|
+
}),
|
|
349
369
|
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
350
370
|
const newRankedBy = new Map(prev.rankedBy);
|
|
371
|
+
const newDeviceType = new Map(prev.deviceType);
|
|
351
372
|
const newClickType = new Map(prev.clickType);
|
|
373
|
+
const newClickMode = new Map(prev.clickMode);
|
|
352
374
|
const newScrollType = new Map(prev.scrollType);
|
|
375
|
+
const newHeatmapType = new Map(prev.heatmapType);
|
|
353
376
|
newRankedBy.set(toViewId, prev.rankedBy.get(fromViewId));
|
|
377
|
+
newDeviceType.set(toViewId, prev.deviceType.get(fromViewId));
|
|
354
378
|
newClickType.set(toViewId, prev.clickType.get(fromViewId));
|
|
379
|
+
newClickMode.set(toViewId, prev.clickMode.get(fromViewId));
|
|
355
380
|
newScrollType.set(toViewId, prev.scrollType.get(fromViewId));
|
|
381
|
+
newHeatmapType.set(toViewId, prev.heatmapType.get(fromViewId));
|
|
356
382
|
return {
|
|
357
383
|
rankedBy: newRankedBy,
|
|
384
|
+
deviceType: newDeviceType,
|
|
358
385
|
clickType: newClickType,
|
|
386
|
+
clickMode: newClickMode,
|
|
359
387
|
scrollType: newScrollType,
|
|
388
|
+
heatmapType: newHeatmapType,
|
|
360
389
|
};
|
|
361
390
|
}),
|
|
362
391
|
clearView: (viewId) => set((prev) => {
|
|
363
392
|
const newRankedBy = new Map(prev.rankedBy);
|
|
393
|
+
const newDeviceType = new Map(prev.deviceType);
|
|
364
394
|
const newClickType = new Map(prev.clickType);
|
|
395
|
+
const newClickMode = new Map(prev.clickMode);
|
|
365
396
|
const newScrollType = new Map(prev.scrollType);
|
|
397
|
+
const newHeatmapType = new Map(prev.heatmapType);
|
|
366
398
|
newRankedBy.delete(viewId);
|
|
399
|
+
newDeviceType.delete(viewId);
|
|
367
400
|
newClickType.delete(viewId);
|
|
401
|
+
newClickMode.delete(viewId);
|
|
368
402
|
newScrollType.delete(viewId);
|
|
403
|
+
newHeatmapType.delete(viewId);
|
|
369
404
|
return {
|
|
370
405
|
rankedBy: newRankedBy,
|
|
406
|
+
deviceType: newDeviceType,
|
|
371
407
|
clickType: newClickType,
|
|
408
|
+
clickMode: newClickMode,
|
|
372
409
|
scrollType: newScrollType,
|
|
410
|
+
heatmapType: newHeatmapType,
|
|
373
411
|
};
|
|
374
412
|
}),
|
|
375
413
|
resetAll: () => set({
|
|
414
|
+
isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
376
415
|
rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
|
|
416
|
+
deviceType: new Map([[DEFAULT_VIEW_ID, IDeviceType.Desktop]]),
|
|
377
417
|
clickType: new Map([[DEFAULT_VIEW_ID, IClickType.Total]]),
|
|
418
|
+
clickMode: new Map([[DEFAULT_VIEW_ID, IClickMode.Default]]),
|
|
378
419
|
scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
|
|
420
|
+
heatmapType: new Map([[DEFAULT_VIEW_ID, IHeatmapType.Click]]),
|
|
379
421
|
}),
|
|
380
422
|
};
|
|
381
423
|
}));
|
|
@@ -466,7 +508,7 @@ const useHeatmapVizStore = create()(subscribeWithSelector((set) => {
|
|
|
466
508
|
};
|
|
467
509
|
}));
|
|
468
510
|
|
|
469
|
-
const
|
|
511
|
+
const useHeatmapVizClickAreaStore = create()(subscribeWithSelector((set) => ({
|
|
470
512
|
selectedArea: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
471
513
|
hoveredArea: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
472
514
|
areas: new Map([[DEFAULT_VIEW_ID, []]]),
|
|
@@ -595,7 +637,7 @@ const useHeatmapAreaClickStore = create()(subscribeWithSelector((set) => ({
|
|
|
595
637
|
const DEFAULT_STATE$1 = {
|
|
596
638
|
hideSidebar: false,
|
|
597
639
|
};
|
|
598
|
-
const
|
|
640
|
+
const useHeatmapVizClickStore = create()(subscribeWithSelector((set) => {
|
|
599
641
|
return {
|
|
600
642
|
state: new Map([[DEFAULT_VIEW_ID, DEFAULT_STATE$1]]),
|
|
601
643
|
selectedElement: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
@@ -651,7 +693,7 @@ const useHeatmapClickStore = create()(subscribeWithSelector((set) => {
|
|
|
651
693
|
};
|
|
652
694
|
}));
|
|
653
695
|
|
|
654
|
-
const
|
|
696
|
+
const useHeatmapVizHoverStore = create()(subscribeWithSelector((set, get) => {
|
|
655
697
|
return {
|
|
656
698
|
hoveredElement: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
657
699
|
setHoveredElement: (hoveredElement, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
@@ -659,6 +701,7 @@ const useHeatmapHoverStore = create()(subscribeWithSelector((set) => {
|
|
|
659
701
|
newHoveredElement.set(viewId, hoveredElement);
|
|
660
702
|
return { hoveredElement: newHoveredElement };
|
|
661
703
|
}),
|
|
704
|
+
isHoveredElement: (hash, viewId = DEFAULT_VIEW_ID) => get().hoveredElement.get(viewId)?.hash === hash,
|
|
662
705
|
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
663
706
|
const newHoveredElement = new Map(prev.hoveredElement);
|
|
664
707
|
newHoveredElement.set(toViewId, prev.hoveredElement.get(fromViewId) ?? null);
|
|
@@ -675,7 +718,7 @@ const useHeatmapHoverStore = create()(subscribeWithSelector((set) => {
|
|
|
675
718
|
};
|
|
676
719
|
}));
|
|
677
720
|
|
|
678
|
-
const
|
|
721
|
+
const useHeatmapVizScrollStore = create()(subscribeWithSelector((set) => {
|
|
679
722
|
return {
|
|
680
723
|
zones: new Map([[DEFAULT_VIEW_ID, []]]),
|
|
681
724
|
hoveredZone: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
@@ -925,39 +968,6 @@ const useHeatmapVizRectStore = create()(subscribeWithSelector((set) => {
|
|
|
925
968
|
};
|
|
926
969
|
}));
|
|
927
970
|
|
|
928
|
-
const useRegisterConfig = () => {
|
|
929
|
-
const mode = useHeatmapConfigStore((state) => state.mode);
|
|
930
|
-
const width = useHeatmapConfigStore((state) => state.width);
|
|
931
|
-
const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
|
|
932
|
-
// const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
|
|
933
|
-
// const clickMode = useHeatmapConfigStore((state) => state.clickMode);
|
|
934
|
-
const setIsRendering = useHeatmapConfigStore((state) => state.setIsRendering);
|
|
935
|
-
useEffect(() => {
|
|
936
|
-
setIsRendering(true);
|
|
937
|
-
setTimeout(() => {
|
|
938
|
-
setIsRendering(false);
|
|
939
|
-
}, 1000);
|
|
940
|
-
}, [mode, width, sidebarWidth]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
const useRegisterControl = (control) => {
|
|
944
|
-
const registerControl = useHeatmapControlStore((state) => state.registerControl);
|
|
945
|
-
const isRegistered = useRef(false);
|
|
946
|
-
useEffect(() => {
|
|
947
|
-
if (isRegistered.current)
|
|
948
|
-
return;
|
|
949
|
-
registerControl('Sidebar', control.Sidebar);
|
|
950
|
-
registerControl('SidebarActivator', control.SidebarActivator);
|
|
951
|
-
registerControl('TopBar', control.TopBar);
|
|
952
|
-
registerControl('Toolbar', control.Toolbar);
|
|
953
|
-
registerControl('MetricBar', control.MetricBar);
|
|
954
|
-
registerControl('VizLoading', control.VizLoading);
|
|
955
|
-
registerControl('ElementCallout', control.ElementCallout);
|
|
956
|
-
registerControl('ScrollZoneTooltip', control.ScrollZoneTooltip);
|
|
957
|
-
isRegistered.current = true;
|
|
958
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
959
|
-
};
|
|
960
|
-
|
|
961
971
|
const ViewIdContext = createContext(undefined);
|
|
962
972
|
const useViewIdContext = () => {
|
|
963
973
|
const viewId = useContext(ViewIdContext);
|
|
@@ -1042,27 +1052,8 @@ function extractActionRefs(useStore) {
|
|
|
1042
1052
|
return refs;
|
|
1043
1053
|
}
|
|
1044
1054
|
|
|
1045
|
-
// ===========================
|
|
1046
|
-
// Hook
|
|
1047
|
-
// ===========================
|
|
1048
|
-
/**
|
|
1049
|
-
* Hook to access heatmap area click state and actions with optional selector
|
|
1050
|
-
*
|
|
1051
|
-
* @example
|
|
1052
|
-
* ```tsx
|
|
1053
|
-
* // Get everything
|
|
1054
|
-
* const { areas, selectedArea, addArea } = useHeatmapAreaClick();
|
|
1055
|
-
*
|
|
1056
|
-
* // Get only what you need (no unnecessary re-renders)
|
|
1057
|
-
* const addArea = useHeatmapAreaClick(s => s.addArea);
|
|
1058
|
-
* const { addArea, removeArea } = useHeatmapAreaClick(s => ({
|
|
1059
|
-
* addArea: s.addArea,
|
|
1060
|
-
* removeArea: s.removeArea,
|
|
1061
|
-
* }));
|
|
1062
|
-
* ```
|
|
1063
|
-
*/
|
|
1064
1055
|
const useHeatmapAreaClick = createViewContextHook({
|
|
1065
|
-
useStore:
|
|
1056
|
+
useStore: useHeatmapVizClickAreaStore,
|
|
1066
1057
|
getState: (store, viewId) => ({
|
|
1067
1058
|
selectedArea: store.selectedArea.get(viewId) ?? null,
|
|
1068
1059
|
hoveredArea: store.hoveredArea.get(viewId) ?? null,
|
|
@@ -1103,7 +1094,7 @@ const DEFAULT_STATE = { hideSidebar: false };
|
|
|
1103
1094
|
* ```
|
|
1104
1095
|
*/
|
|
1105
1096
|
const useHeatmapClick = createViewContextHook({
|
|
1106
|
-
useStore:
|
|
1097
|
+
useStore: useHeatmapVizClickStore,
|
|
1107
1098
|
getState: (store, viewId) => ({
|
|
1108
1099
|
state: store.state.get(viewId) ?? DEFAULT_STATE,
|
|
1109
1100
|
selectedElement: store.selectedElement.get(viewId) ?? null,
|
|
@@ -1153,51 +1144,19 @@ const useHeatmapData = createViewContextHook({
|
|
|
1153
1144
|
}),
|
|
1154
1145
|
});
|
|
1155
1146
|
|
|
1156
|
-
// ===========================
|
|
1157
|
-
// Hook
|
|
1158
|
-
// ===========================
|
|
1159
|
-
/**
|
|
1160
|
-
* Hook to access heatmap hover state and actions with optional selector
|
|
1161
|
-
* Separated from useHeatmapClick to prevent unnecessary re-renders
|
|
1162
|
-
*
|
|
1163
|
-
* @example
|
|
1164
|
-
* ```tsx
|
|
1165
|
-
* // Get everything
|
|
1166
|
-
* const { hoveredElement, setHoveredElement } = useHeatmapHover();
|
|
1167
|
-
*
|
|
1168
|
-
* // Get only what you need (no unnecessary re-renders)
|
|
1169
|
-
* const hoveredElement = useHeatmapHover(s => s.hoveredElement);
|
|
1170
|
-
* const setHoveredElement = useHeatmapHover(s => s.setHoveredElement);
|
|
1171
|
-
* ```
|
|
1172
|
-
*/
|
|
1173
1147
|
const useHeatmapHover = createViewContextHook({
|
|
1174
|
-
useStore:
|
|
1148
|
+
useStore: useHeatmapVizHoverStore,
|
|
1175
1149
|
getState: (store, viewId) => ({
|
|
1176
1150
|
hoveredElement: store.hoveredElement.get(viewId) ?? null,
|
|
1177
1151
|
}),
|
|
1178
1152
|
getActions: (store, viewId) => ({
|
|
1179
1153
|
setHoveredElement: (el) => store.setHoveredElement(el, viewId),
|
|
1154
|
+
isHoveredElement: (hash) => store.isHoveredElement(hash, viewId),
|
|
1180
1155
|
}),
|
|
1181
1156
|
});
|
|
1182
1157
|
|
|
1183
|
-
// ===========================
|
|
1184
|
-
// Hook
|
|
1185
|
-
// ===========================
|
|
1186
|
-
/**
|
|
1187
|
-
* Hook to access heatmap scroll state and actions with optional selector
|
|
1188
|
-
*
|
|
1189
|
-
* @example
|
|
1190
|
-
* ```tsx
|
|
1191
|
-
* // Get everything
|
|
1192
|
-
* const { zones, hoveredZone, setZones } = useHeatmapScroll();
|
|
1193
|
-
*
|
|
1194
|
-
* // Get only what you need (no unnecessary re-renders)
|
|
1195
|
-
* const setZones = useHeatmapScroll(s => s.setZones);
|
|
1196
|
-
* const zones = useHeatmapScroll(s => s.zones);
|
|
1197
|
-
* ```
|
|
1198
|
-
*/
|
|
1199
1158
|
const useHeatmapScroll = createViewContextHook({
|
|
1200
|
-
useStore:
|
|
1159
|
+
useStore: useHeatmapVizScrollStore,
|
|
1201
1160
|
getState: (store, viewId) => ({
|
|
1202
1161
|
zones: store.zones.get(viewId) ?? [],
|
|
1203
1162
|
hoveredZone: store.hoveredZone.get(viewId) ?? null,
|
|
@@ -1210,56 +1169,29 @@ const useHeatmapScroll = createViewContextHook({
|
|
|
1210
1169
|
}),
|
|
1211
1170
|
});
|
|
1212
1171
|
|
|
1213
|
-
/**
|
|
1214
|
-
* Hook to access heatmap setting state and actions with optional selector
|
|
1215
|
-
*
|
|
1216
|
-
* @example
|
|
1217
|
-
* ```tsx
|
|
1218
|
-
* // Get everything
|
|
1219
|
-
* const { rankedBy, clickType, setRankedBy } = useHeatmapSetting();
|
|
1220
|
-
*
|
|
1221
|
-
* // Get only what you need (no unnecessary re-renders)
|
|
1222
|
-
* const rankedBy = useHeatmapSetting(s => s.rankedBy);
|
|
1223
|
-
* const { setRankedBy, setClickType } = useHeatmapSetting(s => ({
|
|
1224
|
-
* setRankedBy: s.setRankedBy,
|
|
1225
|
-
* setClickType: s.setClickType,
|
|
1226
|
-
* }));
|
|
1227
|
-
* ```
|
|
1228
|
-
*/
|
|
1229
1172
|
const useHeatmapSetting = createViewContextHook({
|
|
1230
1173
|
useStore: useHeatmapSettingStore,
|
|
1231
1174
|
getState: (store, viewId) => ({
|
|
1175
|
+
isRendering: !!store.isRendering.get(viewId),
|
|
1232
1176
|
rankedBy: store.rankedBy.get(viewId),
|
|
1177
|
+
deviceType: store.deviceType.get(viewId),
|
|
1233
1178
|
clickType: store.clickType.get(viewId),
|
|
1179
|
+
clickMode: store.clickMode.get(viewId),
|
|
1234
1180
|
scrollType: store.scrollType.get(viewId),
|
|
1181
|
+
heatmapType: store.heatmapType.get(viewId),
|
|
1235
1182
|
}),
|
|
1236
1183
|
getActions: (store, viewId) => ({
|
|
1237
1184
|
setRankedBy: (rankedBy) => store.setRankedBy(rankedBy, viewId),
|
|
1185
|
+
setDeviceType: (deviceType) => store.setDeviceType(deviceType, viewId),
|
|
1238
1186
|
setClickType: (clickType) => store.setClickType(clickType, viewId),
|
|
1187
|
+
setClickMode: (clickMode) => store.setClickMode(clickMode, viewId),
|
|
1239
1188
|
setScrollType: (scrollType) => store.setScrollType(scrollType, viewId),
|
|
1189
|
+
setHeatmapType: (heatmapType) => store.setHeatmapType(heatmapType, viewId),
|
|
1190
|
+
setIsRendering: (isRendering) => store.setIsRendering(isRendering, viewId),
|
|
1240
1191
|
clearView: (viewId) => store.clearView(viewId),
|
|
1241
1192
|
}),
|
|
1242
1193
|
});
|
|
1243
1194
|
|
|
1244
|
-
// ===========================
|
|
1245
|
-
// Hook
|
|
1246
|
-
// ===========================
|
|
1247
|
-
/**
|
|
1248
|
-
* Hook to access heatmap viz state and actions (zoom, scale, render state)
|
|
1249
|
-
*
|
|
1250
|
-
* @example
|
|
1251
|
-
* ```tsx
|
|
1252
|
-
* // Get everything
|
|
1253
|
-
* const { zoomRatio, setZoomRatio, isRenderViz } = useHeatmapViz();
|
|
1254
|
-
*
|
|
1255
|
-
* // Get only what you need (no unnecessary re-renders)
|
|
1256
|
-
* const zoomRatio = useHeatmapViz(s => s.zoomRatio);
|
|
1257
|
-
* const { setZoomRatio, setScale } = useHeatmapViz(s => ({
|
|
1258
|
-
* setZoomRatio: s.setZoomRatio,
|
|
1259
|
-
* setScale: s.setScale,
|
|
1260
|
-
* }));
|
|
1261
|
-
* ```
|
|
1262
|
-
*/
|
|
1263
1195
|
const useHeatmapViz = createViewContextHook({
|
|
1264
1196
|
useStore: useHeatmapVizStore,
|
|
1265
1197
|
getState: (store, viewId) => ({
|
|
@@ -1320,34 +1252,38 @@ const useHeatmapVizRect = createViewContextHook({
|
|
|
1320
1252
|
*/
|
|
1321
1253
|
const useHeatmapCopyView = () => {
|
|
1322
1254
|
const copyDataView = useHeatmapDataStore((state) => state.copyView);
|
|
1255
|
+
const copySettingView = useHeatmapSettingStore((state) => state.copyView);
|
|
1323
1256
|
const copyVizView = useHeatmapVizStore((state) => state.copyView);
|
|
1324
1257
|
const copyVizRectView = useHeatmapVizRectStore((state) => state.copyView);
|
|
1325
|
-
const
|
|
1326
|
-
const
|
|
1327
|
-
const
|
|
1328
|
-
const
|
|
1258
|
+
const copyVizClickView = useHeatmapVizClickStore((state) => state.copyView);
|
|
1259
|
+
const copyVizHoverView = useHeatmapVizHoverStore((state) => state.copyView);
|
|
1260
|
+
const copyVizAreaClickView = useHeatmapVizClickAreaStore((state) => state.copyView);
|
|
1261
|
+
const copyVizScrollView = useHeatmapVizScrollStore((state) => state.copyView);
|
|
1329
1262
|
const clearDataView = useHeatmapDataStore((state) => state.clearView);
|
|
1263
|
+
const clearSettingView = useHeatmapSettingStore((state) => state.clearView);
|
|
1330
1264
|
const clearVizView = useHeatmapVizStore((state) => state.clearView);
|
|
1331
1265
|
const clearVizRectView = useHeatmapVizRectStore((state) => state.clearView);
|
|
1332
|
-
const
|
|
1333
|
-
const
|
|
1334
|
-
const
|
|
1335
|
-
const
|
|
1266
|
+
const clearVizClickView = useHeatmapVizClickStore((state) => state.clearView);
|
|
1267
|
+
const clearVizHoverView = useHeatmapVizHoverStore((state) => state.clearView);
|
|
1268
|
+
const clearVizScrollView = useHeatmapVizScrollStore((state) => state.clearView);
|
|
1269
|
+
const clearVizAreaClickView = useHeatmapVizClickAreaStore((state) => state.clearView);
|
|
1336
1270
|
const resetDataAll = useHeatmapDataStore((state) => state.resetAll);
|
|
1271
|
+
const resetSettingAll = useHeatmapSettingStore((state) => state.resetAll);
|
|
1337
1272
|
const resetVizAll = useHeatmapVizStore((state) => state.resetAll);
|
|
1338
1273
|
const resetVizRectAll = useHeatmapVizRectStore((state) => state.resetAll);
|
|
1339
|
-
const
|
|
1340
|
-
const
|
|
1341
|
-
const
|
|
1342
|
-
const
|
|
1274
|
+
const resetVizClickAll = useHeatmapVizClickStore((state) => state.resetAll);
|
|
1275
|
+
const resetVizHoverAll = useHeatmapVizHoverStore((state) => state.resetAll);
|
|
1276
|
+
const resetVizScrollViewAll = useHeatmapVizScrollStore((state) => state.resetAll);
|
|
1277
|
+
const resetVizClickAreaAll = useHeatmapVizClickAreaStore((state) => state.resetAll);
|
|
1343
1278
|
const copyView = (fromViewId, toViewId) => {
|
|
1344
1279
|
copyDataView(fromViewId, toViewId);
|
|
1280
|
+
copySettingView(fromViewId, toViewId);
|
|
1345
1281
|
copyVizView(fromViewId, toViewId);
|
|
1346
1282
|
copyVizRectView(fromViewId, toViewId);
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1283
|
+
copyVizClickView(fromViewId, toViewId);
|
|
1284
|
+
copyVizHoverView(fromViewId, toViewId);
|
|
1285
|
+
copyVizScrollView(fromViewId, toViewId);
|
|
1286
|
+
copyVizAreaClickView(fromViewId, toViewId);
|
|
1351
1287
|
};
|
|
1352
1288
|
const copyViewToMultiple = (fromViewId, toViewIds) => {
|
|
1353
1289
|
toViewIds.forEach((toViewId) => {
|
|
@@ -1356,12 +1292,13 @@ const useHeatmapCopyView = () => {
|
|
|
1356
1292
|
};
|
|
1357
1293
|
const clearView = (viewId) => {
|
|
1358
1294
|
clearDataView(viewId);
|
|
1295
|
+
clearSettingView(viewId);
|
|
1359
1296
|
clearVizView(viewId);
|
|
1360
1297
|
clearVizRectView(viewId);
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1298
|
+
clearVizClickView(viewId);
|
|
1299
|
+
clearVizHoverView(viewId);
|
|
1300
|
+
clearVizScrollView(viewId);
|
|
1301
|
+
clearVizAreaClickView(viewId);
|
|
1365
1302
|
};
|
|
1366
1303
|
const clearMultipleViews = (viewIds) => {
|
|
1367
1304
|
viewIds.forEach((viewId) => {
|
|
@@ -1370,12 +1307,13 @@ const useHeatmapCopyView = () => {
|
|
|
1370
1307
|
};
|
|
1371
1308
|
const resetAll = () => {
|
|
1372
1309
|
resetDataAll();
|
|
1310
|
+
resetSettingAll();
|
|
1373
1311
|
resetVizAll();
|
|
1374
1312
|
resetVizRectAll();
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1313
|
+
resetVizClickAll();
|
|
1314
|
+
resetVizHoverAll();
|
|
1315
|
+
resetVizScrollViewAll();
|
|
1316
|
+
resetVizClickAreaAll();
|
|
1379
1317
|
};
|
|
1380
1318
|
return {
|
|
1381
1319
|
copyView,
|
|
@@ -1386,8 +1324,59 @@ const useHeatmapCopyView = () => {
|
|
|
1386
1324
|
};
|
|
1387
1325
|
};
|
|
1388
1326
|
|
|
1327
|
+
const useHeatmapWidthByDevice = () => {
|
|
1328
|
+
const deviceType = useHeatmapSetting((state) => state.deviceType);
|
|
1329
|
+
const width = useMemo(() => calcWidthByDeviceType(deviceType), [deviceType]);
|
|
1330
|
+
return width;
|
|
1331
|
+
function calcWidthByDeviceType(deviceType) {
|
|
1332
|
+
if (!deviceType)
|
|
1333
|
+
return 1440;
|
|
1334
|
+
switch (deviceType) {
|
|
1335
|
+
case IDeviceType.Desktop:
|
|
1336
|
+
return 1440;
|
|
1337
|
+
case IDeviceType.Tablet:
|
|
1338
|
+
return 768;
|
|
1339
|
+
case IDeviceType.Mobile:
|
|
1340
|
+
return 375;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
const useRegisterConfig = () => {
|
|
1346
|
+
const mode = useHeatmapConfigStore((state) => state.mode);
|
|
1347
|
+
const deviceType = useHeatmapSetting((state) => state.deviceType);
|
|
1348
|
+
const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
|
|
1349
|
+
// const heatmapType = useHeatmapConfigStore((state) => state.heatmapType);
|
|
1350
|
+
// const clickMode = useHeatmapConfigStore((state) => state.clickMode);
|
|
1351
|
+
const setIsRendering = useHeatmapSetting((state) => state.setIsRendering);
|
|
1352
|
+
useEffect(() => {
|
|
1353
|
+
setIsRendering(true);
|
|
1354
|
+
setTimeout(() => {
|
|
1355
|
+
setIsRendering(false);
|
|
1356
|
+
}, 1000);
|
|
1357
|
+
}, [mode, deviceType, sidebarWidth]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
const useRegisterControl = (control) => {
|
|
1361
|
+
const registerControl = useHeatmapControlStore((state) => state.registerControl);
|
|
1362
|
+
const isRegistered = useRef(false);
|
|
1363
|
+
useEffect(() => {
|
|
1364
|
+
if (isRegistered.current)
|
|
1365
|
+
return;
|
|
1366
|
+
registerControl('Sidebar', control.Sidebar);
|
|
1367
|
+
registerControl('SidebarActivator', control.SidebarActivator);
|
|
1368
|
+
registerControl('TopBar', control.TopBar);
|
|
1369
|
+
registerControl('Toolbar', control.Toolbar);
|
|
1370
|
+
registerControl('MetricBar', control.MetricBar);
|
|
1371
|
+
registerControl('VizLoading', control.VizLoading);
|
|
1372
|
+
registerControl('ElementCallout', control.ElementCallout);
|
|
1373
|
+
registerControl('ScrollZoneTooltip', control.ScrollZoneTooltip);
|
|
1374
|
+
isRegistered.current = true;
|
|
1375
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1389
1378
|
const useRegisterData = (data, dataInfo) => {
|
|
1390
|
-
const setIsRendering =
|
|
1379
|
+
const setIsRendering = useHeatmapSetting((s) => s.setIsRendering);
|
|
1391
1380
|
const setData = useHeatmapData((s) => s.setData);
|
|
1392
1381
|
const setDataInfo = useHeatmapData((s) => s.setDataInfo);
|
|
1393
1382
|
const isRegistered = useRef(false);
|
|
@@ -1480,12 +1469,9 @@ function isElementRectInViewport(elementRect, visualRect, scale) {
|
|
|
1480
1469
|
return false;
|
|
1481
1470
|
// Element position relative to the document (or container's content)
|
|
1482
1471
|
const elementTop = elementRect.top * scale;
|
|
1483
|
-
console.log(`🚀 🐥 ~ isElementRectInViewport ~ scale:`, scale);
|
|
1484
|
-
console.log(`🚀 🐥 ~ isElementRectInViewport ~ elementRect.top:`, elementRect.top);
|
|
1485
1472
|
const elementBottom = (elementRect.top + elementRect.height) * scale;
|
|
1486
1473
|
// Current scroll position
|
|
1487
1474
|
const scrollTop = (visualRect?.scrollTop || 0) - 8;
|
|
1488
|
-
console.log(`🚀 🐥 ~ isElementRectInViewport ~ visualRect?.scrollTop:`, visualRect?.scrollTop);
|
|
1489
1475
|
const viewportHeight = visualRect.height;
|
|
1490
1476
|
// Visible viewport range in the scrollable content
|
|
1491
1477
|
const viewportTop = scrollTop;
|
|
@@ -4449,8 +4435,8 @@ const useScrollmap = () => {
|
|
|
4449
4435
|
};
|
|
4450
4436
|
|
|
4451
4437
|
const useHeatmapCanvas = () => {
|
|
4452
|
-
const heatmapType =
|
|
4453
|
-
const clickMode =
|
|
4438
|
+
const heatmapType = useHeatmapSetting((state) => state.heatmapType);
|
|
4439
|
+
const clickMode = useHeatmapSetting((state) => state.clickMode);
|
|
4454
4440
|
const { start: startClickmap } = useClickmap();
|
|
4455
4441
|
const { start: startAreaClickmap } = useAreaClickmap();
|
|
4456
4442
|
const { start: startScrollmap } = useScrollmap();
|
|
@@ -4606,7 +4592,7 @@ const useHeatmapEffects = ({ isVisible }) => {
|
|
|
4606
4592
|
};
|
|
4607
4593
|
|
|
4608
4594
|
const useHeatmapElementPosition = ({ iframeRef, wrapperRef, visualizer }) => {
|
|
4609
|
-
const heatmapWidth =
|
|
4595
|
+
const heatmapWidth = useHeatmapWidthByDevice();
|
|
4610
4596
|
const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
|
|
4611
4597
|
const widthScale = useHeatmapViz((s) => s.widthScale);
|
|
4612
4598
|
const getRect = useCallback((element) => {
|
|
@@ -4737,6 +4723,7 @@ function getBoundingBox(element) {
|
|
|
4737
4723
|
|
|
4738
4724
|
const useHoveredElement = ({ iframeRef, getRect }) => {
|
|
4739
4725
|
const setHoveredElement = useHeatmapHover((s) => s.setHoveredElement);
|
|
4726
|
+
const isHoveredElement = useHeatmapHover((s) => s.isHoveredElement);
|
|
4740
4727
|
const setSelectedElement = useHeatmapClick((s) => s.setSelectedElement);
|
|
4741
4728
|
const widthScale = useHeatmapViz((s) => s.widthScale);
|
|
4742
4729
|
const dataInfo = useHeatmapData((s) => s.dataInfo);
|
|
@@ -4776,6 +4763,8 @@ const useHoveredElement = ({ iframeRef, getRect }) => {
|
|
|
4776
4763
|
reset();
|
|
4777
4764
|
return;
|
|
4778
4765
|
}
|
|
4766
|
+
if (isHoveredElement(hash))
|
|
4767
|
+
return;
|
|
4779
4768
|
const selector = dataInfo?.clickMapMetrics?.[hash];
|
|
4780
4769
|
const rect = getRect({ hash, selector });
|
|
4781
4770
|
const elementInfo = buildElementInfo(hash, rect, dataInfo);
|
|
@@ -4785,7 +4774,7 @@ const useHoveredElement = ({ iframeRef, getRect }) => {
|
|
|
4785
4774
|
}
|
|
4786
4775
|
const mousePosition = getElementMousePosition(event, widthScale);
|
|
4787
4776
|
setHoveredElement({ ...elementInfo, mousePosition });
|
|
4788
|
-
}, [dataInfo, getRect, reset, widthScale, getHashFromEvent, setHoveredElement]);
|
|
4777
|
+
}, [dataInfo, getRect, reset, widthScale, getHashFromEvent, setHoveredElement, isHoveredElement]);
|
|
4789
4778
|
const handleMouseMove = useMemo(() => throttleRAF(onHandleMouseMove), [onHandleMouseMove]);
|
|
4790
4779
|
const handleClick = useCallback((event, hash) => {
|
|
4791
4780
|
if (!hash)
|
|
@@ -6297,7 +6286,7 @@ function useVizLiveRender() {
|
|
|
6297
6286
|
const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
|
|
6298
6287
|
const wrapperWidth = useHeatmapVizRect((s) => s.wrapperWidth);
|
|
6299
6288
|
const setIsRenderViz = useHeatmapViz((s) => s.setIsRenderViz);
|
|
6300
|
-
const contentWidth =
|
|
6289
|
+
const contentWidth = useHeatmapWidthByDevice();
|
|
6301
6290
|
const htmlContent = useHeatmapLiveStore((state) => state.htmlContent);
|
|
6302
6291
|
const targetUrl = useHeatmapLiveStore((state) => state.targetUrl);
|
|
6303
6292
|
const renderMode = useHeatmapLiveStore((state) => state.renderMode);
|
|
@@ -6391,6 +6380,7 @@ function initIframeHelper$1(iframe, rect, onSuccess) {
|
|
|
6391
6380
|
}
|
|
6392
6381
|
|
|
6393
6382
|
const useHeatmapRender = () => {
|
|
6383
|
+
const viewId = useViewIdContext();
|
|
6394
6384
|
const data = useHeatmapData((s) => s.data);
|
|
6395
6385
|
const vizRef = useHeatmapVizRect((s) => s.vizRef);
|
|
6396
6386
|
const setVizRef = useHeatmapVizRect((s) => s.setVizRef);
|
|
@@ -6409,7 +6399,7 @@ const useHeatmapRender = () => {
|
|
|
6409
6399
|
const iframe = iframeRef.current;
|
|
6410
6400
|
if (!iframe?.contentWindow)
|
|
6411
6401
|
return;
|
|
6412
|
-
await visualizer.html(payloads, iframe.contentWindow,
|
|
6402
|
+
await visualizer.html(payloads, iframe.contentWindow, viewId);
|
|
6413
6403
|
initIframeHelper(iframe, payloads, (height) => {
|
|
6414
6404
|
height && setIframeHeight(height);
|
|
6415
6405
|
setIsRenderViz(true);
|
|
@@ -6619,7 +6609,7 @@ const useContainerDimensions = (props) => {
|
|
|
6619
6609
|
};
|
|
6620
6610
|
|
|
6621
6611
|
const useContentDimensions = ({ iframeRef }) => {
|
|
6622
|
-
const contentWidth =
|
|
6612
|
+
const contentWidth = useHeatmapWidthByDevice();
|
|
6623
6613
|
useEffect(() => {
|
|
6624
6614
|
if (!contentWidth)
|
|
6625
6615
|
return;
|
|
@@ -6858,7 +6848,7 @@ const useHeatmapScale = (props) => {
|
|
|
6858
6848
|
};
|
|
6859
6849
|
const useIframeHeight = (props) => {
|
|
6860
6850
|
const { iframeRef } = props;
|
|
6861
|
-
const iframeWidth =
|
|
6851
|
+
const iframeWidth = useHeatmapWidthByDevice();
|
|
6862
6852
|
const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
|
|
6863
6853
|
const setIframeHeight = useHeatmapVizRect((s) => s.setIframeHeight);
|
|
6864
6854
|
const isRenderViz = useHeatmapViz((s) => s.isRenderViz);
|
|
@@ -7188,14 +7178,15 @@ const PopoverSidebar = () => {
|
|
|
7188
7178
|
return null;
|
|
7189
7179
|
if (!CompSidebar || !CompSidebarActivator)
|
|
7190
7180
|
return null;
|
|
7191
|
-
return (jsxs("div", { children: [!isPopoverOpen && (jsx("div", { style: { ...stylePopover, width: 'auto', height: 'auto' }, children: jsx(CompSidebarActivator, { onClick: () => setIsPopoverOpen(true) }) })),
|
|
7181
|
+
return (jsxs("div", { children: [!isPopoverOpen && (jsx("div", { style: { ...stylePopover, width: 'auto', height: 'auto' }, children: jsx(CompSidebarActivator, { onClick: () => setIsPopoverOpen(true) }) })), jsx(Fragment, { children: jsx("div", { className: "gx-hm-sidebar-popover", style: {
|
|
7192
7182
|
...stylePopover,
|
|
7193
7183
|
backgroundColor: '#fff',
|
|
7194
7184
|
borderRight: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
|
|
7195
7185
|
borderRadius: '8px',
|
|
7196
7186
|
boxShadow: '4px 0 12px rgba(0, 0, 0, 0.15)',
|
|
7197
7187
|
overflow: 'auto',
|
|
7198
|
-
|
|
7188
|
+
display: isPopoverOpen ? 'block' : 'none',
|
|
7189
|
+
}, children: jsx(CompSidebar, { closeAction: { onClick: () => setIsPopoverOpen(false) } }) }) })] }));
|
|
7199
7190
|
};
|
|
7200
7191
|
|
|
7201
7192
|
const ContentToolbar = () => {
|
|
@@ -8057,7 +8048,7 @@ const useAnchorPosition = (calloutRef, props) => {
|
|
|
8057
8048
|
const ElementMissing = ({ show = true, visualRef }) => {
|
|
8058
8049
|
const widthScale = useHeatmapViz((s) => s.widthScale);
|
|
8059
8050
|
const missingElementRef = useRef(null);
|
|
8060
|
-
const wrapperWidth =
|
|
8051
|
+
const wrapperWidth = useHeatmapWidthByDevice();
|
|
8061
8052
|
const [scrollPosition, setScrollPosition] = useState({ scrollTop: 0, scrollLeft: 0 });
|
|
8062
8053
|
useEffect(() => {
|
|
8063
8054
|
const container = visualRef.current;
|
|
@@ -8208,7 +8199,7 @@ const ElementOverlayComponent = (props) => {
|
|
|
8208
8199
|
const { type, element, onClick, elementId, hideOutline } = props;
|
|
8209
8200
|
const widthScale = useHeatmapViz((s) => s.widthScale);
|
|
8210
8201
|
const viewportHeight = useHeatmapVizRect((s) => s.iframeHeight);
|
|
8211
|
-
const viewportWidth =
|
|
8202
|
+
const viewportWidth = useHeatmapWidthByDevice();
|
|
8212
8203
|
const overlayStyle = useMemo(() => {
|
|
8213
8204
|
const isInvalid = !element || (element.width === 0 && element.height === 0);
|
|
8214
8205
|
if (isInvalid)
|
|
@@ -8290,7 +8281,7 @@ const HeatmapElements = (props) => {
|
|
|
8290
8281
|
};
|
|
8291
8282
|
|
|
8292
8283
|
const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
|
|
8293
|
-
const contentWidth =
|
|
8284
|
+
const contentWidth = useHeatmapWidthByDevice();
|
|
8294
8285
|
const dataInfo = useHeatmapData((s) => s.dataInfo);
|
|
8295
8286
|
const vizRef = useHeatmapVizRect((s) => s.vizRef);
|
|
8296
8287
|
const visualizer = {
|
|
@@ -8313,8 +8304,8 @@ const VizElements = ({ iframeRef, visualRef, wrapperRef }) => {
|
|
|
8313
8304
|
};
|
|
8314
8305
|
|
|
8315
8306
|
const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
|
|
8316
|
-
const clickMode =
|
|
8317
|
-
const heatmapType =
|
|
8307
|
+
const clickMode = useHeatmapSetting((state) => state.clickMode);
|
|
8308
|
+
const heatmapType = useHeatmapSetting((state) => state.heatmapType);
|
|
8318
8309
|
const isClickType = heatmapType === IHeatmapType.Click;
|
|
8319
8310
|
if (!isClickType)
|
|
8320
8311
|
return null;
|
|
@@ -8329,9 +8320,9 @@ const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
|
|
|
8329
8320
|
};
|
|
8330
8321
|
|
|
8331
8322
|
const ScrollMapMinimap = ({ zones, maxUsers }) => {
|
|
8332
|
-
const scrollType =
|
|
8323
|
+
const scrollType = useHeatmapSetting((s) => s.scrollType);
|
|
8333
8324
|
const showMinimap = useHeatmapScroll((s) => s.showMinimap);
|
|
8334
|
-
const isScrollType = [IScrollType.Attention].includes(scrollType);
|
|
8325
|
+
const isScrollType = [IScrollType.Attention].includes(scrollType ?? IScrollType.Depth);
|
|
8335
8326
|
if (!showMinimap || !isScrollType)
|
|
8336
8327
|
return null;
|
|
8337
8328
|
return (jsx("div", { style: {
|
|
@@ -8391,8 +8382,8 @@ const ScrollZoneTooltip = ({ zone, position, currentScrollPercent, scrollmap, })
|
|
|
8391
8382
|
|
|
8392
8383
|
const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) => {
|
|
8393
8384
|
const { scrollmap } = useHeatmapData();
|
|
8394
|
-
// const hoveredZone =
|
|
8395
|
-
// const setHoveredZone =
|
|
8385
|
+
// const hoveredZone = useHeatmapVizScrollStore((state) => state.hoveredZone);
|
|
8386
|
+
// const setHoveredZone = useHeatmapVizScrollStore((state) => state.setHoveredZone);
|
|
8396
8387
|
const { zones, isReady, maxUsers } = useScrollmapZones({
|
|
8397
8388
|
iframeRef,
|
|
8398
8389
|
wrapperRef,
|
|
@@ -8480,7 +8471,7 @@ const AverageFoldLine = ({ iframeRef, wrapperRef }) => {
|
|
|
8480
8471
|
};
|
|
8481
8472
|
|
|
8482
8473
|
const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
|
|
8483
|
-
const scrollType =
|
|
8474
|
+
const scrollType = useHeatmapSetting((s) => s.scrollType);
|
|
8484
8475
|
const { scrollmap } = useHeatmapData();
|
|
8485
8476
|
const { getZonePosition } = useZonePositions();
|
|
8486
8477
|
if (!scrollmap || scrollmap.length === 0)
|
|
@@ -8556,10 +8547,10 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
|
|
|
8556
8547
|
|
|
8557
8548
|
const SCROLL_TYPES = [IHeatmapType.Scroll];
|
|
8558
8549
|
const VizScrollMap = ({ iframeRef, wrapperRef }) => {
|
|
8559
|
-
const heatmapType =
|
|
8550
|
+
const heatmapType = useHeatmapSetting((s) => s.heatmapType);
|
|
8560
8551
|
const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
|
|
8561
8552
|
// useRenderCount('VizScrollMap');
|
|
8562
|
-
const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType);
|
|
8553
|
+
const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? IHeatmapType.Click);
|
|
8563
8554
|
if (!iframeHeight || !isHeatmapScroll)
|
|
8564
8555
|
return null;
|
|
8565
8556
|
return (jsxs("div", { style: {
|
|
@@ -8574,8 +8565,8 @@ const VizScrollMap = ({ iframeRef, wrapperRef }) => {
|
|
|
8574
8565
|
};
|
|
8575
8566
|
|
|
8576
8567
|
const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHeight, onScroll, }) => {
|
|
8577
|
-
const contentWidth = useHeatmapConfigStore((state) => state.width);
|
|
8578
8568
|
const widthScale = useHeatmapViz((s) => s.widthScale);
|
|
8569
|
+
const contentWidth = useHeatmapWidthByDevice();
|
|
8579
8570
|
const contentHeight = calcContentHeight();
|
|
8580
8571
|
return (jsx("div", { ref: visualRef, className: "gx-hm-visual", onScroll: onScroll, style: {
|
|
8581
8572
|
overflow: 'hidden scroll',
|
|
@@ -8609,7 +8600,8 @@ const WrapperVisual = ({ children, visualRef, wrapperRef, scaledHeight, iframeHe
|
|
|
8609
8600
|
};
|
|
8610
8601
|
|
|
8611
8602
|
const VizDomRenderer = ({ mode = 'heatmap' }) => {
|
|
8612
|
-
const
|
|
8603
|
+
const viewId = useViewIdContext();
|
|
8604
|
+
const contentWidth = useHeatmapWidthByDevice();
|
|
8613
8605
|
const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
|
|
8614
8606
|
const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
|
|
8615
8607
|
const wrapperRef = useRef(null);
|
|
@@ -8622,7 +8614,7 @@ const VizDomRenderer = ({ mode = 'heatmap' }) => {
|
|
|
8622
8614
|
const scrollTop = e.currentTarget.scrollTop;
|
|
8623
8615
|
handleScroll(scrollTop);
|
|
8624
8616
|
};
|
|
8625
|
-
return (jsxs(WrapperVisual, { visualRef: visualRef, wrapperRef: wrapperRef, scaledHeight: scaledHeight, onScroll: onScroll, iframeHeight: iframeHeight, children: [jsx(VizClickmap, { iframeRef: iframeRef, visualRef: visualRef, wrapperRef: wrapperRef }), jsx("iframe", { ...HEATMAP_IFRAME, ref: iframeRef, width: contentWidth, height: wrapperHeight }), jsx(VizScrollMap, { iframeRef: iframeRef, wrapperRef: visualRef })] }));
|
|
8617
|
+
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 })] }));
|
|
8626
8618
|
};
|
|
8627
8619
|
|
|
8628
8620
|
const VizLoading = () => {
|
|
@@ -8658,7 +8650,7 @@ const VizDomHeatmap = () => {
|
|
|
8658
8650
|
VizDomHeatmap.displayName = 'VizDomHeatmap';
|
|
8659
8651
|
|
|
8660
8652
|
const VizLiveRenderer = () => {
|
|
8661
|
-
const contentWidth =
|
|
8653
|
+
const contentWidth = useHeatmapWidthByDevice();
|
|
8662
8654
|
const iframeHeight = useHeatmapVizRect((s) => s.iframeHeight);
|
|
8663
8655
|
const wrapperHeight = useHeatmapVizRect((s) => s.wrapperHeight);
|
|
8664
8656
|
const visualRef = useRef(null);
|
|
@@ -8688,8 +8680,8 @@ VizLiveHeatmap.displayName = 'VizLiveHeatmap';
|
|
|
8688
8680
|
|
|
8689
8681
|
const ContentVizByMode = () => {
|
|
8690
8682
|
const mode = useHeatmapConfigStore((state) => state.mode);
|
|
8691
|
-
const isRendering = useHeatmapConfigStore((state) => state.isRendering);
|
|
8692
8683
|
const controls = useHeatmapControlStore((state) => state.controls);
|
|
8684
|
+
const isRendering = useHeatmapSetting((state) => state.isRendering);
|
|
8693
8685
|
if (isRendering)
|
|
8694
8686
|
return controls.VizLoading ?? null;
|
|
8695
8687
|
switch (mode) {
|
|
@@ -8748,4 +8740,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
|
|
|
8748
8740
|
}
|
|
8749
8741
|
};
|
|
8750
8742
|
|
|
8751
|
-
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, IHeatmapType, IScrollType, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, downloadPerformanceReport, getCompareViewId, getMetricsByViewId, getPerformanceReportJSON, getScrollGradientColor, performanceLogger, printPerformanceSummary, scrollToElementIfNeeded, sendPerformanceReport, serializeAreas, trackStoreAction, useAreaCreation, useAreaEditMode, useAreaFilterVisible, useAreaHydration, useAreaInteraction, useAreaPositionsUpdater, useAreaRectSync, useAreaRendererContainer, useAreaTopAutoDetect, useClickedElement, useDebounceCallback, useElementCalloutVisible, useHeatmapAreaClick, useHeatmapCanvas, useHeatmapClick, useHeatmapCompareStore, useHeatmapConfigStore, useHeatmapCopyView, useHeatmapData, useHeatmapEffects, useHeatmapElementPosition, useHeatmapHover, useHeatmapLiveStore, useHeatmapRenderByMode, useHeatmapScale, useHeatmapScroll, useHeatmapSetting, useHeatmapViz, useHeatmapVizRect, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };
|
|
8743
|
+
export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, ELM_CALLOUT_CONFIG, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, IClickMode, IClickRankType, IClickType, IDeviceType, IHeatmapType, IScrollType, ViewIdContext, Z_INDEX, compareViewPerformance, convertViewportToIframeCoords, createStorePerformanceTracker, downloadPerformanceReport, getCompareViewId, getMetricsByViewId, getPerformanceReportJSON, getScrollGradientColor, performanceLogger, printPerformanceSummary, scrollToElementIfNeeded, sendPerformanceReport, serializeAreas, trackStoreAction, useAreaCreation, useAreaEditMode, useAreaFilterVisible, useAreaHydration, useAreaInteraction, useAreaPositionsUpdater, useAreaRectSync, useAreaRendererContainer, useAreaTopAutoDetect, useClickedElement, useDebounceCallback, useElementCalloutVisible, useHeatmapAreaClick, useHeatmapCanvas, useHeatmapClick, useHeatmapCompareStore, useHeatmapConfigStore, useHeatmapCopyView, useHeatmapData, useHeatmapEffects, useHeatmapElementPosition, useHeatmapHover, useHeatmapLiveStore, useHeatmapRenderByMode, useHeatmapScale, useHeatmapScroll, useHeatmapSetting, useHeatmapViz, useHeatmapVizRect, useHeatmapWidthByDevice, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };
|