@gemx-dev/heatmap-react 3.5.78 → 3.5.80
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/HeatmapLayout.d.ts +1 -0
- package/dist/esm/components/Layout/HeatmapLayout.d.ts.map +1 -1
- package/dist/esm/components/Layout/Sidebar/ContentSidebar.d.ts.map +1 -1
- package/dist/esm/components/Layout/Sidebar/PopoverSidebar.d.ts.map +1 -1
- package/dist/esm/components/VizDom/VizDomRenderer.d.ts.map +1 -1
- package/dist/esm/components/VizScrollmap/AverageFold.d.ts +8 -0
- package/dist/esm/components/VizScrollmap/AverageFold.d.ts.map +1 -0
- package/dist/esm/components/VizScrollmap/HoverZones.d.ts +1 -1
- package/dist/esm/components/VizScrollmap/HoverZones.d.ts.map +1 -1
- package/dist/esm/components/VizScrollmap/MarkerLine.d.ts +12 -0
- package/dist/esm/components/VizScrollmap/MarkerLine.d.ts.map +1 -0
- package/dist/esm/components/VizScrollmap/Minimap.d.ts +8 -0
- package/dist/esm/components/VizScrollmap/Minimap.d.ts.map +1 -0
- package/dist/esm/components/VizScrollmap/ScrollMarkers.d.ts +9 -0
- package/dist/esm/components/VizScrollmap/ScrollMarkers.d.ts.map +1 -0
- package/dist/esm/components/VizScrollmap/ScrollOverlay.d.ts +8 -0
- package/dist/esm/components/VizScrollmap/ScrollOverlay.d.ts.map +1 -0
- package/dist/esm/components/VizScrollmap/VizScrollMap.d.ts +4 -2
- package/dist/esm/components/VizScrollmap/VizScrollMap.d.ts.map +1 -1
- package/dist/esm/components/VizScrollmap/index.d.ts +1 -1
- package/dist/esm/components/VizScrollmap/index.d.ts.map +1 -1
- package/dist/esm/hooks/register/useRegisterHeatmap.d.ts +2 -1
- package/dist/esm/hooks/register/useRegisterHeatmap.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapClickContext.d.ts +0 -13
- package/dist/esm/hooks/view-context/useHeatmapClickContext.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapDataContext.d.ts +2 -0
- package/dist/esm/hooks/view-context/useHeatmapDataContext.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapScrollContext.d.ts +2 -0
- package/dist/esm/hooks/view-context/useHeatmapScrollContext.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapSettingContext.d.ts +2 -0
- package/dist/esm/hooks/view-context/useHeatmapSettingContext.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapVizRectContext.d.ts +3 -3
- package/dist/esm/hooks/view-context/useHeatmapVizRectContext.d.ts.map +1 -1
- package/dist/esm/hooks/viz-canvas/useAttentionMap.d.ts +9 -0
- package/dist/esm/hooks/viz-canvas/useAttentionMap.d.ts.map +1 -0
- package/dist/esm/hooks/viz-canvas/useHeatmapCanvas.d.ts.map +1 -1
- package/dist/esm/hooks/viz-canvas/useScrollmap.d.ts.map +1 -1
- package/dist/esm/hooks/viz-render/useHeatmapRender.d.ts.map +1 -1
- package/dist/esm/hooks/viz-scroll/index.d.ts +1 -0
- package/dist/esm/hooks/viz-scroll/index.d.ts.map +1 -1
- package/dist/esm/hooks/viz-scroll/useHeatmapScroll.d.ts +7 -0
- package/dist/esm/hooks/viz-scroll/useHeatmapScroll.d.ts.map +1 -0
- package/dist/esm/hooks/viz-scroll/useScrollmapZones.d.ts +1 -1
- package/dist/esm/hooks/viz-scroll/useScrollmapZones.d.ts.map +1 -1
- package/dist/esm/hooks/viz-scroll/useZonePositions.d.ts +1 -1
- package/dist/esm/hooks/viz-scroll/useZonePositions.d.ts.map +1 -1
- package/dist/esm/index.js +422 -143
- package/dist/esm/index.mjs +422 -143
- package/dist/esm/libs/AttentionMapRenderer.d.ts +32 -0
- package/dist/esm/libs/AttentionMapRenderer.d.ts.map +1 -0
- package/dist/esm/libs/ClickHeatmapRenderer.d.ts +30 -0
- package/dist/esm/libs/ClickHeatmapRenderer.d.ts.map +1 -0
- package/dist/esm/libs/GXVisualizer.d.ts +24 -0
- package/dist/esm/libs/GXVisualizer.d.ts.map +1 -0
- package/dist/esm/libs/ScrollHeatmapRenderer.d.ts +17 -0
- package/dist/esm/libs/ScrollHeatmapRenderer.d.ts.map +1 -0
- package/dist/esm/libs/index.d.ts +4 -0
- package/dist/esm/libs/index.d.ts.map +1 -0
- package/dist/esm/libs/types.d.ts +10 -0
- package/dist/esm/libs/types.d.ts.map +1 -0
- package/dist/esm/stores/data.d.ts +2 -0
- package/dist/esm/stores/data.d.ts.map +1 -1
- package/dist/esm/stores/mode-single.d.ts +3 -3
- package/dist/esm/stores/mode-single.d.ts.map +1 -1
- package/dist/esm/stores/setting.d.ts +2 -0
- package/dist/esm/stores/setting.d.ts.map +1 -1
- package/dist/esm/stores/viz-click.d.ts +1 -0
- package/dist/esm/stores/viz-click.d.ts.map +1 -1
- package/dist/esm/stores/viz-scroll.d.ts +2 -0
- package/dist/esm/stores/viz-scroll.d.ts.map +1 -1
- package/dist/esm/types/heatmap-ref.d.ts +6 -0
- package/dist/esm/types/heatmap-ref.d.ts.map +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/umd/components/Layout/HeatmapLayout.d.ts +1 -0
- package/dist/umd/components/Layout/HeatmapLayout.d.ts.map +1 -1
- package/dist/umd/components/Layout/Sidebar/ContentSidebar.d.ts.map +1 -1
- package/dist/umd/components/Layout/Sidebar/PopoverSidebar.d.ts.map +1 -1
- package/dist/umd/components/VizDom/VizDomRenderer.d.ts.map +1 -1
- package/dist/umd/components/VizScrollmap/AverageFold.d.ts +8 -0
- package/dist/umd/components/VizScrollmap/AverageFold.d.ts.map +1 -0
- package/dist/umd/components/VizScrollmap/HoverZones.d.ts +1 -1
- package/dist/umd/components/VizScrollmap/HoverZones.d.ts.map +1 -1
- package/dist/umd/components/VizScrollmap/MarkerLine.d.ts +12 -0
- package/dist/umd/components/VizScrollmap/MarkerLine.d.ts.map +1 -0
- package/dist/umd/components/VizScrollmap/Minimap.d.ts +8 -0
- package/dist/umd/components/VizScrollmap/Minimap.d.ts.map +1 -0
- package/dist/umd/components/VizScrollmap/ScrollMarkers.d.ts +9 -0
- package/dist/umd/components/VizScrollmap/ScrollMarkers.d.ts.map +1 -0
- package/dist/umd/components/VizScrollmap/ScrollOverlay.d.ts +8 -0
- package/dist/umd/components/VizScrollmap/ScrollOverlay.d.ts.map +1 -0
- package/dist/umd/components/VizScrollmap/VizScrollMap.d.ts +4 -2
- package/dist/umd/components/VizScrollmap/VizScrollMap.d.ts.map +1 -1
- package/dist/umd/components/VizScrollmap/index.d.ts +1 -1
- package/dist/umd/components/VizScrollmap/index.d.ts.map +1 -1
- package/dist/umd/hooks/register/useRegisterHeatmap.d.ts +2 -1
- package/dist/umd/hooks/register/useRegisterHeatmap.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapClickContext.d.ts +0 -13
- package/dist/umd/hooks/view-context/useHeatmapClickContext.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapDataContext.d.ts +2 -0
- package/dist/umd/hooks/view-context/useHeatmapDataContext.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapScrollContext.d.ts +2 -0
- package/dist/umd/hooks/view-context/useHeatmapScrollContext.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapSettingContext.d.ts +2 -0
- package/dist/umd/hooks/view-context/useHeatmapSettingContext.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapVizRectContext.d.ts +3 -3
- package/dist/umd/hooks/view-context/useHeatmapVizRectContext.d.ts.map +1 -1
- package/dist/umd/hooks/viz-canvas/useAttentionMap.d.ts +9 -0
- package/dist/umd/hooks/viz-canvas/useAttentionMap.d.ts.map +1 -0
- package/dist/umd/hooks/viz-canvas/useHeatmapCanvas.d.ts.map +1 -1
- package/dist/umd/hooks/viz-canvas/useScrollmap.d.ts.map +1 -1
- package/dist/umd/hooks/viz-render/useHeatmapRender.d.ts.map +1 -1
- package/dist/umd/hooks/viz-scroll/index.d.ts +1 -0
- package/dist/umd/hooks/viz-scroll/index.d.ts.map +1 -1
- package/dist/umd/hooks/viz-scroll/useHeatmapScroll.d.ts +7 -0
- package/dist/umd/hooks/viz-scroll/useHeatmapScroll.d.ts.map +1 -0
- package/dist/umd/hooks/viz-scroll/useScrollmapZones.d.ts +1 -1
- package/dist/umd/hooks/viz-scroll/useScrollmapZones.d.ts.map +1 -1
- package/dist/umd/hooks/viz-scroll/useZonePositions.d.ts +1 -1
- package/dist/umd/hooks/viz-scroll/useZonePositions.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/libs/AttentionMapRenderer.d.ts +32 -0
- package/dist/umd/libs/AttentionMapRenderer.d.ts.map +1 -0
- package/dist/umd/libs/ClickHeatmapRenderer.d.ts +30 -0
- package/dist/umd/libs/ClickHeatmapRenderer.d.ts.map +1 -0
- package/dist/umd/libs/GXVisualizer.d.ts +24 -0
- package/dist/umd/libs/GXVisualizer.d.ts.map +1 -0
- package/dist/umd/libs/ScrollHeatmapRenderer.d.ts +17 -0
- package/dist/umd/libs/ScrollHeatmapRenderer.d.ts.map +1 -0
- package/dist/umd/libs/index.d.ts +4 -0
- package/dist/umd/libs/index.d.ts.map +1 -0
- package/dist/umd/libs/types.d.ts +10 -0
- package/dist/umd/libs/types.d.ts.map +1 -0
- package/dist/umd/stores/data.d.ts +2 -0
- package/dist/umd/stores/data.d.ts.map +1 -1
- package/dist/umd/stores/mode-single.d.ts +3 -3
- package/dist/umd/stores/mode-single.d.ts.map +1 -1
- package/dist/umd/stores/setting.d.ts +2 -0
- package/dist/umd/stores/setting.d.ts.map +1 -1
- package/dist/umd/stores/viz-click.d.ts +1 -0
- package/dist/umd/stores/viz-click.d.ts.map +1 -1
- package/dist/umd/stores/viz-scroll.d.ts +2 -0
- package/dist/umd/stores/viz-scroll.d.ts.map +1 -1
- package/dist/umd/types/heatmap-ref.d.ts +6 -0
- package/dist/umd/types/heatmap-ref.d.ts.map +1 -0
- package/dist/umd/types/index.d.ts +1 -0
- package/dist/umd/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/esm/components/VizScrollmap/AverageFoldLine.d.ts +0 -8
- package/dist/esm/components/VizScrollmap/AverageFoldLine.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmap/ScrollMapMinimap.d.ts +0 -8
- package/dist/esm/components/VizScrollmap/ScrollMapMinimap.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmap/ScrollMapOverlay.d.ts +0 -7
- package/dist/esm/components/VizScrollmap/ScrollMapOverlay.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmap/ScrollmapMarker.d.ts +0 -7
- package/dist/esm/components/VizScrollmap/ScrollmapMarker.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmapV2/ScrollmapOverlayV2.d.ts +0 -4
- package/dist/esm/components/VizScrollmapV2/ScrollmapOverlayV2.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmapV2/index.d.ts +0 -2
- package/dist/esm/components/VizScrollmapV2/index.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmapV2/scrollmap.types.d.ts +0 -18
- package/dist/esm/components/VizScrollmapV2/scrollmap.types.d.ts.map +0 -1
- package/dist/esm/components/VizScrollmapV2/useScrollmapOverlay.d.ts +0 -16
- package/dist/esm/components/VizScrollmapV2/useScrollmapOverlay.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmap/AverageFoldLine.d.ts +0 -8
- package/dist/umd/components/VizScrollmap/AverageFoldLine.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmap/ScrollMapMinimap.d.ts +0 -8
- package/dist/umd/components/VizScrollmap/ScrollMapMinimap.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmap/ScrollMapOverlay.d.ts +0 -7
- package/dist/umd/components/VizScrollmap/ScrollMapOverlay.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmap/ScrollmapMarker.d.ts +0 -7
- package/dist/umd/components/VizScrollmap/ScrollmapMarker.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmapV2/ScrollmapOverlayV2.d.ts +0 -4
- package/dist/umd/components/VizScrollmapV2/ScrollmapOverlayV2.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmapV2/index.d.ts +0 -2
- package/dist/umd/components/VizScrollmapV2/index.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmapV2/scrollmap.types.d.ts +0 -18
- package/dist/umd/components/VizScrollmapV2/scrollmap.types.d.ts.map +0 -1
- package/dist/umd/components/VizScrollmapV2/useScrollmapOverlay.d.ts +0 -16
- package/dist/umd/components/VizScrollmapV2/useScrollmapOverlay.d.ts.map +0 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -106,7 +106,7 @@ const getCompareViewId = (viewId) => {
|
|
|
106
106
|
return `compare-${viewId}`;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
const Z_INDEX = {
|
|
109
|
+
const Z_INDEX$1 = {
|
|
110
110
|
ELEMENTS: 1000,
|
|
111
111
|
CALLOUT: 2000,
|
|
112
112
|
MINIMAP: 3000,
|
|
@@ -324,6 +324,7 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
324
324
|
clickAreas: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
325
325
|
dataInfo: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
326
326
|
scrollmap: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
327
|
+
attentionMap: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
327
328
|
setClickAreas: (clickAreas, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
328
329
|
const newClickAreas = new Map(prev.clickAreas);
|
|
329
330
|
newClickAreas.set(viewId, clickAreas);
|
|
@@ -336,6 +337,11 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
336
337
|
newClickAreas.set(viewId, filtered);
|
|
337
338
|
return { clickAreas: newClickAreas };
|
|
338
339
|
}),
|
|
340
|
+
setAttentionMap: (attentionMap, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
341
|
+
const newAttentionMap = new Map(prev.attentionMap);
|
|
342
|
+
newAttentionMap.set(viewId, attentionMap);
|
|
343
|
+
return { attentionMap: newAttentionMap };
|
|
344
|
+
}),
|
|
339
345
|
setDataInfo: (dataInfo, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
340
346
|
const newDataInfo = new Map(prev.dataInfo);
|
|
341
347
|
newDataInfo.set(viewId, dataInfo);
|
|
@@ -372,17 +378,20 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
372
378
|
const newClickAreas = new Map(prev.clickAreas);
|
|
373
379
|
const newDataInfo = new Map(prev.dataInfo);
|
|
374
380
|
const newScrollmap = new Map(prev.scrollmap);
|
|
381
|
+
const newAttentionMap = new Map(prev.attentionMap);
|
|
375
382
|
newData.set(toViewId, prev.data.get(fromViewId));
|
|
376
383
|
newClickmap.set(toViewId, prev.clickmap.get(fromViewId));
|
|
377
384
|
newClickAreas.set(toViewId, prev.clickAreas.get(fromViewId));
|
|
378
385
|
newDataInfo.set(toViewId, prev.dataInfo.get(fromViewId));
|
|
379
386
|
newScrollmap.set(toViewId, prev.scrollmap.get(fromViewId));
|
|
387
|
+
newAttentionMap.set(toViewId, prev.attentionMap.get(fromViewId));
|
|
380
388
|
return {
|
|
381
389
|
data: newData,
|
|
382
390
|
clickmap: newClickmap,
|
|
383
391
|
clickAreas: newClickAreas,
|
|
384
392
|
dataInfo: newDataInfo,
|
|
385
393
|
scrollmap: newScrollmap,
|
|
394
|
+
attentionMap: newAttentionMap,
|
|
386
395
|
};
|
|
387
396
|
}),
|
|
388
397
|
clearView: (viewId) => set((prev) => {
|
|
@@ -391,17 +400,20 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
391
400
|
const newClickAreas = new Map(prev.clickAreas);
|
|
392
401
|
const newDataInfo = new Map(prev.dataInfo);
|
|
393
402
|
const newScrollmap = new Map(prev.scrollmap);
|
|
403
|
+
const newAttentionMap = new Map(prev.attentionMap);
|
|
394
404
|
newData.delete(viewId);
|
|
395
405
|
newClickmap.delete(viewId);
|
|
396
406
|
newClickAreas.delete(viewId);
|
|
397
407
|
newDataInfo.delete(viewId);
|
|
398
408
|
newScrollmap.delete(viewId);
|
|
409
|
+
newAttentionMap.delete(viewId);
|
|
399
410
|
return {
|
|
400
411
|
data: newData,
|
|
401
412
|
clickmap: newClickmap,
|
|
402
413
|
clickAreas: newClickAreas,
|
|
403
414
|
dataInfo: newDataInfo,
|
|
404
415
|
scrollmap: newScrollmap,
|
|
416
|
+
attentionMap: newAttentionMap,
|
|
405
417
|
};
|
|
406
418
|
}),
|
|
407
419
|
resetAll: () => set({
|
|
@@ -410,6 +422,7 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
410
422
|
clickAreas: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
411
423
|
dataInfo: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
412
424
|
scrollmap: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
425
|
+
attentionMap: new Map([[DEFAULT_VIEW_ID, undefined]]),
|
|
413
426
|
}),
|
|
414
427
|
};
|
|
415
428
|
}));
|
|
@@ -419,6 +432,7 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
419
432
|
isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
420
433
|
isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
421
434
|
isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
435
|
+
isShowSidebar: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
422
436
|
rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
|
|
423
437
|
deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
|
|
424
438
|
clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
|
|
@@ -445,6 +459,11 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
445
459
|
newIsLoadingCanvas.set(viewId, isLoadingCanvas);
|
|
446
460
|
return { isLoadingCanvas: newIsLoadingCanvas };
|
|
447
461
|
}),
|
|
462
|
+
setIsShowSidebar: (isShowSidebar, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
463
|
+
const newIsShowSidebar = new Map(prev.isShowSidebar);
|
|
464
|
+
newIsShowSidebar.set(viewId, isShowSidebar);
|
|
465
|
+
return { isShowSidebar: newIsShowSidebar };
|
|
466
|
+
}),
|
|
448
467
|
setRankedBy: (rankedBy, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
449
468
|
const newRankedBy = new Map(prev.rankedBy);
|
|
450
469
|
newRankedBy.set(viewId, rankedBy);
|
|
@@ -473,12 +492,14 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
473
492
|
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
474
493
|
const newIsLoadingDom = new Map(prev.isLoadingDom);
|
|
475
494
|
const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
|
|
495
|
+
const newIsShowSidebar = new Map(prev.isShowSidebar);
|
|
476
496
|
const newRankedBy = new Map(prev.rankedBy);
|
|
477
497
|
const newDeviceType = new Map(prev.deviceType);
|
|
478
498
|
const newClickType = new Map(prev.clickType);
|
|
479
499
|
const newClickMode = new Map(prev.clickMode);
|
|
480
500
|
const newScrollType = new Map(prev.scrollType);
|
|
481
501
|
const newHeatmapType = new Map(prev.heatmapType);
|
|
502
|
+
newIsShowSidebar.set(toViewId, prev.isShowSidebar.get(fromViewId) ?? false);
|
|
482
503
|
newRankedBy.set(toViewId, prev.rankedBy.get(fromViewId));
|
|
483
504
|
newDeviceType.set(toViewId, prev.deviceType.get(fromViewId));
|
|
484
505
|
newClickType.set(toViewId, prev.clickType.get(fromViewId));
|
|
@@ -488,6 +509,7 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
488
509
|
newIsLoadingDom.set(toViewId, prev.isLoadingDom.get(fromViewId) ?? false);
|
|
489
510
|
newIsLoadingCanvas.set(toViewId, prev.isLoadingCanvas.get(fromViewId) ?? false);
|
|
490
511
|
return {
|
|
512
|
+
isShowSidebar: newIsShowSidebar,
|
|
491
513
|
rankedBy: newRankedBy,
|
|
492
514
|
isLoadingDom: newIsLoadingDom,
|
|
493
515
|
isLoadingCanvas: newIsLoadingCanvas,
|
|
@@ -499,6 +521,7 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
499
521
|
};
|
|
500
522
|
}),
|
|
501
523
|
clearView: (viewId) => set((prev) => {
|
|
524
|
+
const newIsShowSidebar = new Map(prev.isShowSidebar);
|
|
502
525
|
const newRankedBy = new Map(prev.rankedBy);
|
|
503
526
|
const newIsLoadingDom = new Map(prev.isLoadingDom);
|
|
504
527
|
const newIsLoadingCanvas = new Map(prev.isLoadingCanvas);
|
|
@@ -507,6 +530,7 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
507
530
|
const newClickMode = new Map(prev.clickMode);
|
|
508
531
|
const newScrollType = new Map(prev.scrollType);
|
|
509
532
|
const newHeatmapType = new Map(prev.heatmapType);
|
|
533
|
+
newIsShowSidebar.delete(viewId);
|
|
510
534
|
newRankedBy.delete(viewId);
|
|
511
535
|
newIsLoadingDom.delete(viewId);
|
|
512
536
|
newIsLoadingCanvas.delete(viewId);
|
|
@@ -516,6 +540,7 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
516
540
|
newScrollType.delete(viewId);
|
|
517
541
|
newHeatmapType.delete(viewId);
|
|
518
542
|
return {
|
|
543
|
+
isShowSidebar: newIsShowSidebar,
|
|
519
544
|
rankedBy: newRankedBy,
|
|
520
545
|
isLoadingDom: newIsLoadingDom,
|
|
521
546
|
isLoadingCanvas: newIsLoadingCanvas,
|
|
@@ -530,6 +555,7 @@ const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
|
530
555
|
isRendering: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
531
556
|
isLoadingDom: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
532
557
|
isLoadingCanvas: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
558
|
+
isShowSidebar: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
533
559
|
rankedBy: new Map([[DEFAULT_VIEW_ID, EClickRankType.MostClicks]]),
|
|
534
560
|
deviceType: new Map([[DEFAULT_VIEW_ID, EDeviceType.Desktop]]),
|
|
535
561
|
clickType: new Map([[DEFAULT_VIEW_ID, EClickType.All]]),
|
|
@@ -765,6 +791,16 @@ const useHeatmapVizClickStore = create()(subscribeWithSelector((set) => {
|
|
|
765
791
|
newState.set(viewId, state);
|
|
766
792
|
return { state: newState };
|
|
767
793
|
}),
|
|
794
|
+
setStateByKey: (key, value, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
795
|
+
const currentState = prev.state.get(viewId) ?? DEFAULT_STATE$1;
|
|
796
|
+
const newState = {
|
|
797
|
+
...currentState,
|
|
798
|
+
[key]: value,
|
|
799
|
+
};
|
|
800
|
+
const newStateMap = new Map(prev.state);
|
|
801
|
+
newStateMap.set(viewId, newState);
|
|
802
|
+
return { state: newStateMap };
|
|
803
|
+
}),
|
|
768
804
|
setSelectedElement: (selectedElement, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
769
805
|
const newSelectedElement = new Map(prev.selectedElement);
|
|
770
806
|
// Normalize selectedElement to ISelectedElement | null
|
|
@@ -841,6 +877,7 @@ const useHeatmapVizScrollStore = create()(subscribeWithSelector((set) => {
|
|
|
841
877
|
zones: new Map([[DEFAULT_VIEW_ID, []]]),
|
|
842
878
|
hoveredZone: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
843
879
|
showMinimap: new Map([[DEFAULT_VIEW_ID, true]]),
|
|
880
|
+
selectedScrollY: new Map([[DEFAULT_VIEW_ID, null]]),
|
|
844
881
|
setZones: (zones, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
845
882
|
const newZones = new Map(prev.zones);
|
|
846
883
|
newZones.set(viewId, zones);
|
|
@@ -856,6 +893,11 @@ const useHeatmapVizScrollStore = create()(subscribeWithSelector((set) => {
|
|
|
856
893
|
newShowMinimap.set(viewId, showMinimap);
|
|
857
894
|
return { showMinimap: newShowMinimap };
|
|
858
895
|
}),
|
|
896
|
+
setSelectedScrollY: (selectedScrollY, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
897
|
+
const newSelectedScrollY = new Map(prev.selectedScrollY);
|
|
898
|
+
newSelectedScrollY.set(viewId, selectedScrollY);
|
|
899
|
+
return { selectedScrollY: newSelectedScrollY };
|
|
900
|
+
}),
|
|
859
901
|
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
860
902
|
const newZones = new Map(prev.zones);
|
|
861
903
|
const newHoveredZone = new Map(prev.hoveredZone);
|
|
@@ -1107,26 +1149,7 @@ const useHeatmapAreaClickContext = createViewContextHook({
|
|
|
1107
1149
|
}),
|
|
1108
1150
|
});
|
|
1109
1151
|
|
|
1110
|
-
// ===========================
|
|
1111
|
-
// Constants
|
|
1112
|
-
// ===========================
|
|
1113
1152
|
const DEFAULT_STATE = { hideSidebar: false };
|
|
1114
|
-
// ===========================
|
|
1115
|
-
// Hook
|
|
1116
|
-
// ===========================
|
|
1117
|
-
/**
|
|
1118
|
-
* Hook to access heatmap click state and actions with optional selector
|
|
1119
|
-
*
|
|
1120
|
-
* @example
|
|
1121
|
-
* ```tsx
|
|
1122
|
-
* // Get everything
|
|
1123
|
-
* const { state, selectedElement, setSelectedElement } = useHeatmapClickContext();
|
|
1124
|
-
*
|
|
1125
|
-
* // Get only what you need (no unnecessary re-renders)
|
|
1126
|
-
* const setSelectedElement = useHeatmapClickContext(s => s.setSelectedElement);
|
|
1127
|
-
* const selectedElement = useHeatmapClickContext(s => s.selectedElement);
|
|
1128
|
-
* ```
|
|
1129
|
-
*/
|
|
1130
1153
|
const useHeatmapClickContext = createViewContextHook({
|
|
1131
1154
|
useStore: useHeatmapVizClickStore,
|
|
1132
1155
|
getState: (store, viewId) => ({
|
|
@@ -1164,6 +1187,7 @@ const useHeatmapDataContext = createViewContextHook({
|
|
|
1164
1187
|
clickmap: store.clickmap.get(viewId),
|
|
1165
1188
|
clickAreas: store.clickAreas.get(viewId),
|
|
1166
1189
|
scrollmap: store.scrollmap.get(viewId),
|
|
1190
|
+
attentionMap: store.attentionMap.get(viewId),
|
|
1167
1191
|
dataInfo: store.dataInfo.get(viewId),
|
|
1168
1192
|
}),
|
|
1169
1193
|
getActions: (store, viewId) => ({
|
|
@@ -1172,6 +1196,7 @@ const useHeatmapDataContext = createViewContextHook({
|
|
|
1172
1196
|
setClickAreas: (newClickAreas) => store.setClickAreas(newClickAreas, viewId),
|
|
1173
1197
|
setDataInfoByKey: (key, value) => store.setDataInfoByKey(key, value, viewId),
|
|
1174
1198
|
setScrollmap: (newScrollmap) => store.setScrollmap(newScrollmap, viewId),
|
|
1199
|
+
setAttentionMap: (newAttentionMap) => store.setAttentionMap(newAttentionMap, viewId),
|
|
1175
1200
|
setDataInfo: (newDataInfo) => store.setDataInfo(newDataInfo, viewId),
|
|
1176
1201
|
removeClickArea: (areaId) => store.removeClickArea(areaId, viewId),
|
|
1177
1202
|
clearView: (viewId) => store.clearView(viewId),
|
|
@@ -1195,11 +1220,13 @@ const useHeatmapScrollContext = createViewContextHook({
|
|
|
1195
1220
|
zones: store.zones.get(viewId) ?? [],
|
|
1196
1221
|
hoveredZone: store.hoveredZone.get(viewId) ?? null,
|
|
1197
1222
|
showMinimap: store.showMinimap.get(viewId) ?? true,
|
|
1223
|
+
selectedScrollY: store.selectedScrollY.get(viewId) ?? 0,
|
|
1198
1224
|
}),
|
|
1199
1225
|
getActions: (store, viewId) => ({
|
|
1200
1226
|
setZones: (zones) => store.setZones(zones, viewId),
|
|
1201
1227
|
setHoveredZone: (zone) => store.setHoveredZone(zone, viewId),
|
|
1202
1228
|
setShowMinimap: (value) => store.setShowMinimap(value, viewId),
|
|
1229
|
+
setSelectedScrollY: (value) => store.setSelectedScrollY(value, viewId),
|
|
1203
1230
|
}),
|
|
1204
1231
|
});
|
|
1205
1232
|
|
|
@@ -1209,6 +1236,7 @@ const useHeatmapSettingContext = createViewContextHook({
|
|
|
1209
1236
|
isRendering: !!store.isRendering.get(viewId),
|
|
1210
1237
|
isLoadingDom: !!store.isLoadingDom.get(viewId),
|
|
1211
1238
|
isLoadingCanvas: !!store.isLoadingCanvas.get(viewId),
|
|
1239
|
+
isShowSidebar: !!store.isShowSidebar.get(viewId),
|
|
1212
1240
|
rankedBy: store.rankedBy.get(viewId),
|
|
1213
1241
|
deviceType: store.deviceType.get(viewId) ?? EDeviceType.Desktop,
|
|
1214
1242
|
clickType: store.clickType.get(viewId),
|
|
@@ -1217,6 +1245,7 @@ const useHeatmapSettingContext = createViewContextHook({
|
|
|
1217
1245
|
heatmapType: store.heatmapType.get(viewId),
|
|
1218
1246
|
}),
|
|
1219
1247
|
getActions: (store, viewId) => ({
|
|
1248
|
+
setIsShowSidebar: (isShowSidebar) => store.setIsShowSidebar(isShowSidebar, viewId),
|
|
1220
1249
|
setRankedBy: (rankedBy) => store.setRankedBy(rankedBy, viewId),
|
|
1221
1250
|
setDeviceType: (deviceType) => store.setDeviceType(deviceType, viewId),
|
|
1222
1251
|
setClickType: (clickType) => store.setClickType(clickType, viewId),
|
|
@@ -1421,10 +1450,11 @@ const useRegisterData = (data, dataInfo) => {
|
|
|
1421
1450
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
1422
1451
|
};
|
|
1423
1452
|
|
|
1424
|
-
const useRegisterHeatmap = ({ clickmap, scrollmap, clickAreas }) => {
|
|
1453
|
+
const useRegisterHeatmap = ({ clickmap, scrollmap, clickAreas, attentionMap }) => {
|
|
1425
1454
|
const setClickmap = useHeatmapDataContext((s) => s.setClickmap);
|
|
1426
1455
|
const setScrollmap = useHeatmapDataContext((s) => s.setScrollmap);
|
|
1427
1456
|
const setClickAreas = useHeatmapDataContext((s) => s.setClickAreas);
|
|
1457
|
+
const setAttentionMap = useHeatmapDataContext((s) => s.setAttentionMap);
|
|
1428
1458
|
const isRegistered = useRef(false);
|
|
1429
1459
|
useEffect(() => {
|
|
1430
1460
|
if (isRegistered.current)
|
|
@@ -1438,6 +1468,9 @@ const useRegisterHeatmap = ({ clickmap, scrollmap, clickAreas }) => {
|
|
|
1438
1468
|
if (scrollmap) {
|
|
1439
1469
|
setScrollmap(scrollmap);
|
|
1440
1470
|
}
|
|
1471
|
+
if (attentionMap) {
|
|
1472
|
+
setAttentionMap(attentionMap);
|
|
1473
|
+
}
|
|
1441
1474
|
isRegistered.current = true;
|
|
1442
1475
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
1443
1476
|
};
|
|
@@ -2379,7 +2412,7 @@ const getStyleFromCandidate = (candidate, widthScale) => {
|
|
|
2379
2412
|
return {
|
|
2380
2413
|
top,
|
|
2381
2414
|
left,
|
|
2382
|
-
zIndex: Z_INDEX.CALLOUT,
|
|
2415
|
+
zIndex: Z_INDEX$1.CALLOUT,
|
|
2383
2416
|
transform: `scale(${1 / widthScale})`, // TODO: remove this when we have a better way to handle the scale
|
|
2384
2417
|
transformOrigin: `${xTransformAlign} ${yTransformAlign}`,
|
|
2385
2418
|
};
|
|
@@ -4446,27 +4479,43 @@ const useClickmap = () => {
|
|
|
4446
4479
|
|
|
4447
4480
|
const useScrollmap = () => {
|
|
4448
4481
|
const vizRef = useHeatmapVizRectContext((s) => s.vizRef);
|
|
4482
|
+
const scrollType = useHeatmapSettingContext((s) => s.scrollType);
|
|
4449
4483
|
const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
|
|
4484
|
+
const attentionMap = useHeatmapDataContext((s) => s.attentionMap);
|
|
4485
|
+
const dataMap = useMemo(() => {
|
|
4486
|
+
switch (scrollType) {
|
|
4487
|
+
case EScrollType.Depth:
|
|
4488
|
+
return scrollmap;
|
|
4489
|
+
case EScrollType.Attention:
|
|
4490
|
+
return attentionMap;
|
|
4491
|
+
case EScrollType.Revenue:
|
|
4492
|
+
return [];
|
|
4493
|
+
default:
|
|
4494
|
+
return scrollmap;
|
|
4495
|
+
}
|
|
4496
|
+
}, [scrollmap, attentionMap, scrollType]);
|
|
4450
4497
|
const start = useCallback(() => {
|
|
4451
|
-
if (!vizRef || !
|
|
4498
|
+
if (!vizRef || !dataMap || dataMap.length === 0)
|
|
4452
4499
|
return;
|
|
4453
4500
|
try {
|
|
4454
4501
|
vizRef?.clearmap?.();
|
|
4455
|
-
vizRef?.scrollmap?.(
|
|
4502
|
+
vizRef?.scrollmap?.(dataMap);
|
|
4456
4503
|
}
|
|
4457
4504
|
catch (error) {
|
|
4458
4505
|
logger$4.error(`🚀 🐥 ~ useScrollmap ~ error:`, error);
|
|
4459
4506
|
}
|
|
4460
|
-
}, [vizRef,
|
|
4507
|
+
}, [vizRef, dataMap]);
|
|
4461
4508
|
return { start };
|
|
4462
4509
|
};
|
|
4463
4510
|
|
|
4464
4511
|
const useHeatmapCanvas = () => {
|
|
4465
4512
|
const heatmapType = useHeatmapSettingContext((state) => state.heatmapType);
|
|
4466
4513
|
const clickMode = useHeatmapSettingContext((state) => state.clickMode);
|
|
4514
|
+
const scrollType = useHeatmapSettingContext((state) => state.scrollType);
|
|
4467
4515
|
const { start: startClickmap } = useClickmap();
|
|
4468
4516
|
const { start: startAreaClickmap } = useAreaClickmap();
|
|
4469
4517
|
const { start: startScrollmap } = useScrollmap();
|
|
4518
|
+
// const { start: startAttentionMap } = useAttentionMap();
|
|
4470
4519
|
useEffect(() => {
|
|
4471
4520
|
switch (heatmapType) {
|
|
4472
4521
|
case EHeatmapType.Click:
|
|
@@ -4481,7 +4530,7 @@ const useHeatmapCanvas = () => {
|
|
|
4481
4530
|
startScrollmap();
|
|
4482
4531
|
break;
|
|
4483
4532
|
}
|
|
4484
|
-
}, [heatmapType, clickMode, startClickmap, startAreaClickmap, startScrollmap]);
|
|
4533
|
+
}, [heatmapType, clickMode, startClickmap, startAreaClickmap, startScrollmap, scrollType]);
|
|
4485
4534
|
};
|
|
4486
4535
|
|
|
4487
4536
|
const scrollToElementIfNeeded = (visualRef, rect, scale, onScrollComplete) => {
|
|
@@ -6406,6 +6455,260 @@ function initIframeHelper$1(iframe, rect, onSuccess) {
|
|
|
6406
6455
|
enableNavigationBlocking();
|
|
6407
6456
|
}
|
|
6408
6457
|
|
|
6458
|
+
const CANVAS_ID = 'clarity-heatmap-canvas';
|
|
6459
|
+
const ATTENTION_HUES = [240, 210, 180, 150, 120, 90, 60, 30, 0];
|
|
6460
|
+
const CANVAS_MAX_HEIGHT = 65535;
|
|
6461
|
+
const Z_INDEX = 2147483647;
|
|
6462
|
+
const DEFAULT_IFRAME_ID = 'clarity-snapshot-heatmap-iframe';
|
|
6463
|
+
const SECONDARY_IFRAME_ID = 'clarity-snapshot-heatmap-iframe-secondary';
|
|
6464
|
+
const DEFAULT_VISUAL_DIV_ID = 'heatmapVisual';
|
|
6465
|
+
const SECONDARY_VISUAL_DIV_ID = 'heatmapVisual_sec';
|
|
6466
|
+
class AttentionMapRenderer {
|
|
6467
|
+
attentionData = null;
|
|
6468
|
+
attentionMapData = null;
|
|
6469
|
+
observer = null;
|
|
6470
|
+
visualizer = null;
|
|
6471
|
+
avgFold = 0;
|
|
6472
|
+
heatmapIframeId = DEFAULT_IFRAME_ID;
|
|
6473
|
+
heatmapVisualDivId = DEFAULT_VISUAL_DIV_ID;
|
|
6474
|
+
state;
|
|
6475
|
+
constructor(state) {
|
|
6476
|
+
this.state = state;
|
|
6477
|
+
}
|
|
6478
|
+
reset = () => {
|
|
6479
|
+
this.attentionData = null;
|
|
6480
|
+
this.attentionMapData = null;
|
|
6481
|
+
this.avgFold = 0;
|
|
6482
|
+
this.observer?.disconnect();
|
|
6483
|
+
this.observer = null;
|
|
6484
|
+
if (this.state?.window) {
|
|
6485
|
+
this.state.window.removeEventListener('resize', this.reRender, true);
|
|
6486
|
+
}
|
|
6487
|
+
};
|
|
6488
|
+
clear = () => {
|
|
6489
|
+
if (!this.state?.window)
|
|
6490
|
+
return;
|
|
6491
|
+
const win = this.state.window;
|
|
6492
|
+
const doc = win.document;
|
|
6493
|
+
const de = doc.documentElement;
|
|
6494
|
+
const canvas = doc.getElementById(CANVAS_ID);
|
|
6495
|
+
if (canvas) {
|
|
6496
|
+
canvas.width = de.clientWidth;
|
|
6497
|
+
canvas.height = de.clientHeight;
|
|
6498
|
+
canvas.style.left = `${win.pageXOffset}px`;
|
|
6499
|
+
canvas.style.top = `${win.pageYOffset}px`;
|
|
6500
|
+
canvas.getContext('2d')?.clearRect(0, 0, canvas.width, canvas.height);
|
|
6501
|
+
}
|
|
6502
|
+
this.reset();
|
|
6503
|
+
};
|
|
6504
|
+
attention = (attentionData, avgFold, visualizer, isSecondary = false) => {
|
|
6505
|
+
this.attentionData = attentionData ?? this.attentionData;
|
|
6506
|
+
this.visualizer = visualizer ?? this.visualizer;
|
|
6507
|
+
this.avgFold = avgFold ?? this.avgFold;
|
|
6508
|
+
if (isSecondary) {
|
|
6509
|
+
this.heatmapIframeId = SECONDARY_IFRAME_ID;
|
|
6510
|
+
this.heatmapVisualDivId = SECONDARY_VISUAL_DIV_ID;
|
|
6511
|
+
}
|
|
6512
|
+
return this.renderAttentionmap();
|
|
6513
|
+
};
|
|
6514
|
+
reRender = () => {
|
|
6515
|
+
const doc = this.state?.window?.document;
|
|
6516
|
+
if (!doc)
|
|
6517
|
+
return;
|
|
6518
|
+
const canvas = this.overlay();
|
|
6519
|
+
if (!canvas)
|
|
6520
|
+
return;
|
|
6521
|
+
const ctx = canvas.getContext('2d');
|
|
6522
|
+
const body = doc.body;
|
|
6523
|
+
const de = doc.documentElement;
|
|
6524
|
+
const contentHeight = Math.max(body.scrollHeight, body.offsetHeight, de.clientHeight, de.scrollHeight, de.offsetHeight);
|
|
6525
|
+
canvas.height = Math.min(contentHeight, CANVAS_MAX_HEIGHT);
|
|
6526
|
+
canvas.style.top = '0px';
|
|
6527
|
+
if (canvas.width <= 0 || canvas.height <= 0 || !this.attentionMapData)
|
|
6528
|
+
return;
|
|
6529
|
+
const gradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
|
|
6530
|
+
for (let i = 0; i < 100; i++) {
|
|
6531
|
+
gradient.addColorStop(i / 100, `hsla(${ATTENTION_HUES[this.attentionMapData[i].colorIndex]}, 100%, 50%, 0.6)`);
|
|
6532
|
+
}
|
|
6533
|
+
ctx.fillStyle = gradient;
|
|
6534
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
6535
|
+
};
|
|
6536
|
+
renderAttentionmap = () => {
|
|
6537
|
+
const doc = this.state?.window?.document;
|
|
6538
|
+
if (!doc)
|
|
6539
|
+
return null;
|
|
6540
|
+
const canvas = this.overlay();
|
|
6541
|
+
if (!canvas)
|
|
6542
|
+
return null;
|
|
6543
|
+
const ctx = canvas.getContext('2d');
|
|
6544
|
+
const body = doc.body;
|
|
6545
|
+
const de = doc.documentElement;
|
|
6546
|
+
const contentHeight = Math.max(body.scrollHeight, body.offsetHeight, de.clientHeight, de.scrollHeight, de.offsetHeight);
|
|
6547
|
+
canvas.height = Math.min(contentHeight, CANVAS_MAX_HEIGHT);
|
|
6548
|
+
canvas.style.top = '0px';
|
|
6549
|
+
let iframeEl = document.getElementById(this.heatmapIframeId);
|
|
6550
|
+
if (!iframeEl) {
|
|
6551
|
+
iframeEl = document.getElementById('clarity-snapshot-iframe');
|
|
6552
|
+
}
|
|
6553
|
+
const visualDiv = document.getElementById(this.heatmapVisualDivId);
|
|
6554
|
+
const visualWidth = visualDiv?.clientWidth ?? 0;
|
|
6555
|
+
const visualHeight = visualDiv?.clientHeight ?? 0;
|
|
6556
|
+
const maxCumulativeTime = this.buildAggregatedData(doc, contentHeight, iframeEl);
|
|
6557
|
+
const colorStops = new Array(100);
|
|
6558
|
+
if (canvas.width > 0 && canvas.height > 0 && this.attentionMapData) {
|
|
6559
|
+
const gradient = ctx.createLinearGradient(0, 0, 0, canvas.height);
|
|
6560
|
+
for (const point of this.attentionMapData) {
|
|
6561
|
+
const timePercent = Math.floor((100 * point.cumulativeTime) / maxCumulativeTime);
|
|
6562
|
+
const colorIndex = timePercent <= 5 ? 0 : Math.min(Math.ceil(timePercent / 10), 8);
|
|
6563
|
+
if (point.scrollPos / 100 <= 1) {
|
|
6564
|
+
point.colorIndex = colorIndex;
|
|
6565
|
+
colorStops[point.scrollPos] = colorIndex;
|
|
6566
|
+
}
|
|
6567
|
+
}
|
|
6568
|
+
// Smooth the top portion based on the fold/viewport ratio
|
|
6569
|
+
const foldPixels = visualWidth >= visualHeight ? 0.15 * visualHeight : 0.2 * visualHeight;
|
|
6570
|
+
const smoothUntil = Math.min(Math.ceil((foldPixels / canvas.height) * 100), 98);
|
|
6571
|
+
for (let i = 0; i < smoothUntil; i++) {
|
|
6572
|
+
colorStops[i] = colorStops[smoothUntil + 1];
|
|
6573
|
+
this.attentionMapData[i].colorIndex = colorStops[smoothUntil + 1];
|
|
6574
|
+
this.attentionMapData[i].cumulativeTime = this.attentionMapData[smoothUntil + 1].cumulativeTime;
|
|
6575
|
+
}
|
|
6576
|
+
// Smooth isolated single-step outliers
|
|
6577
|
+
for (let i = 0; i < 100; i++) {
|
|
6578
|
+
let colorIndex = colorStops[i];
|
|
6579
|
+
if (i > 0 && i < 99) {
|
|
6580
|
+
const prev = colorStops[i - 1];
|
|
6581
|
+
if (prev === colorStops[i + 1] && colorIndex !== prev && Math.abs(colorIndex - prev) === 1) {
|
|
6582
|
+
colorIndex = prev;
|
|
6583
|
+
this.attentionMapData[i].colorIndex = colorIndex;
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
gradient.addColorStop(i / 100, `hsla(${ATTENTION_HUES[colorIndex]}, 100%, 50%, 0.6)`);
|
|
6587
|
+
}
|
|
6588
|
+
ctx.fillStyle = gradient;
|
|
6589
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
6590
|
+
}
|
|
6591
|
+
return this.attentionMapData;
|
|
6592
|
+
};
|
|
6593
|
+
buildAggregatedData = (doc, contentHeight, iframeEl) => {
|
|
6594
|
+
const elementCache = new Map();
|
|
6595
|
+
this.attentionMapData = Array.from({ length: 100 }, (_, i) => ({
|
|
6596
|
+
scrollPos: i,
|
|
6597
|
+
cumulativeTime: 0,
|
|
6598
|
+
colorIndex: 0,
|
|
6599
|
+
}));
|
|
6600
|
+
let maxTime = 0;
|
|
6601
|
+
const htmlEl = iframeEl?.contentDocument?.getElementsByTagName('HTML')?.[0] ??
|
|
6602
|
+
iframeEl?.ownerDocument?.getElementsByTagName('HTML')?.[0];
|
|
6603
|
+
const scrollTop = htmlEl?.scrollTop ?? 0;
|
|
6604
|
+
const foldPercent = ((this.avgFold ?? 0) / contentHeight) * 100;
|
|
6605
|
+
for (const dataPoint of this.attentionData ?? []) {
|
|
6606
|
+
const { startElementHash, endElementHash, timeSpent } = dataPoint;
|
|
6607
|
+
if (!startElementHash || !endElementHash)
|
|
6608
|
+
continue;
|
|
6609
|
+
let startY = elementCache.get(startElementHash);
|
|
6610
|
+
let endY = elementCache.get(endElementHash);
|
|
6611
|
+
if (startY === undefined) {
|
|
6612
|
+
const el = this.visualizer?.get(startElementHash) ??
|
|
6613
|
+
doc.querySelector(`[data-clarity-hashbeta='${startElementHash}']`);
|
|
6614
|
+
startY = Math.max(scrollTop + (el?.getBoundingClientRect().y ?? 0), 10);
|
|
6615
|
+
elementCache.set(startElementHash, startY);
|
|
6616
|
+
}
|
|
6617
|
+
if (endY === undefined) {
|
|
6618
|
+
const el = this.visualizer?.get(endElementHash) ??
|
|
6619
|
+
doc.querySelector(`[data-clarity-hashbeta='${endElementHash}']`);
|
|
6620
|
+
const rect = el?.getBoundingClientRect();
|
|
6621
|
+
endY = Math.min(scrollTop + (rect?.y ?? 0) + (rect?.height ?? 0), contentHeight);
|
|
6622
|
+
elementCache.set(endElementHash, endY);
|
|
6623
|
+
}
|
|
6624
|
+
if (startY && endY && endY >= startY) {
|
|
6625
|
+
const startPercent = Math.max(Math.floor((100 * startY) / contentHeight), 0);
|
|
6626
|
+
const endPercent = Math.min(Math.floor((100 * endY) / contentHeight), 99);
|
|
6627
|
+
if (foldPercent === 0 || endPercent - startPercent <= 2 * foldPercent) {
|
|
6628
|
+
for (let i = startPercent; i < endPercent; i++) {
|
|
6629
|
+
this.attentionMapData[i].cumulativeTime += timeSpent;
|
|
6630
|
+
maxTime = Math.max(maxTime, this.attentionMapData[i].cumulativeTime);
|
|
6631
|
+
}
|
|
6632
|
+
}
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
return maxTime;
|
|
6636
|
+
};
|
|
6637
|
+
overlay = () => {
|
|
6638
|
+
if (!this.state?.window)
|
|
6639
|
+
return null;
|
|
6640
|
+
const win = this.state.window;
|
|
6641
|
+
const doc = win.document;
|
|
6642
|
+
const de = doc.documentElement;
|
|
6643
|
+
let canvas = doc.getElementById(CANVAS_ID + '-single');
|
|
6644
|
+
if (!canvas) {
|
|
6645
|
+
canvas = doc.createElement('CANVAS');
|
|
6646
|
+
canvas.id = CANVAS_ID + '-single';
|
|
6647
|
+
canvas.width = 0;
|
|
6648
|
+
canvas.height = 0;
|
|
6649
|
+
canvas.style.position = 'absolute';
|
|
6650
|
+
canvas.style.zIndex = `${Z_INDEX}`;
|
|
6651
|
+
canvas.style.display = 'block';
|
|
6652
|
+
de.appendChild(canvas);
|
|
6653
|
+
win.addEventListener('resize', this.reRender, true);
|
|
6654
|
+
this.observer = typeof window.ResizeObserver !== 'undefined' ? new ResizeObserver(this.reRender) : null;
|
|
6655
|
+
this.observer?.observe(doc.body);
|
|
6656
|
+
}
|
|
6657
|
+
canvas.width = de.clientWidth;
|
|
6658
|
+
canvas.height = de.clientHeight;
|
|
6659
|
+
canvas.style.left = `${win.pageXOffset}px`;
|
|
6660
|
+
canvas.style.top = `${win.pageYOffset}px`;
|
|
6661
|
+
canvas.getContext('2d')?.clearRect(0, 0, canvas.width, canvas.height);
|
|
6662
|
+
return canvas;
|
|
6663
|
+
};
|
|
6664
|
+
}
|
|
6665
|
+
|
|
6666
|
+
class GXVisualizer extends Visualizer {
|
|
6667
|
+
attentionMap;
|
|
6668
|
+
originalHtml;
|
|
6669
|
+
originalClearmap;
|
|
6670
|
+
originalSetup;
|
|
6671
|
+
constructor() {
|
|
6672
|
+
super();
|
|
6673
|
+
this.attentionMap = new AttentionMapRenderer(null);
|
|
6674
|
+
// Save references to base implementations before overriding
|
|
6675
|
+
this.originalHtml = this.html;
|
|
6676
|
+
this.originalClearmap = this.clearmap;
|
|
6677
|
+
this.originalSetup = this.setup;
|
|
6678
|
+
this.html = this.htmlOverride;
|
|
6679
|
+
this.clearmap = this.clearmapOverride;
|
|
6680
|
+
this.setup = this.setupOverride;
|
|
6681
|
+
}
|
|
6682
|
+
htmlOverride = async (decoded, target, portalCanvasId, hash, useproxy, logerror, shortCircuitStrategy) => {
|
|
6683
|
+
await this.originalHtml(decoded, target, portalCanvasId, hash, useproxy, logerror, shortCircuitStrategy);
|
|
6684
|
+
return this;
|
|
6685
|
+
};
|
|
6686
|
+
setupOverride = async (target, options) => {
|
|
6687
|
+
// Clear existing custom renderers before re-initializing (null-safe)
|
|
6688
|
+
this.attentionMap?.clear();
|
|
6689
|
+
// Initialize base Visualizer (sets this.state, this.heatmap, this.layout, etc.)
|
|
6690
|
+
await this.originalSetup(target, options);
|
|
6691
|
+
// Re-create custom renderers with the newly initialized PlaybackState
|
|
6692
|
+
const state = this.state;
|
|
6693
|
+
this.attentionMap = new AttentionMapRenderer(state);
|
|
6694
|
+
return this;
|
|
6695
|
+
};
|
|
6696
|
+
clearmapOverride = () => {
|
|
6697
|
+
this.originalClearmap();
|
|
6698
|
+
this.attentionMap?.clear();
|
|
6699
|
+
};
|
|
6700
|
+
/**
|
|
6701
|
+
* Render attention/engagement map.
|
|
6702
|
+
* @param attentionData - Array of attention data points with start/end element hashes and time spent
|
|
6703
|
+
* @param avgFold - Average fold pixel position (used to scale top portion)
|
|
6704
|
+
* @param isSecondary - Whether to use secondary comparison iframe IDs
|
|
6705
|
+
*/
|
|
6706
|
+
attention = (attentionData, avgFold, isSecondary = false) => {
|
|
6707
|
+
this.clearmapOverride();
|
|
6708
|
+
this.attentionMap.attention(attentionData, avgFold, this, isSecondary);
|
|
6709
|
+
};
|
|
6710
|
+
}
|
|
6711
|
+
|
|
6409
6712
|
const useHeatmapRender = () => {
|
|
6410
6713
|
const viewId = useViewIdContext();
|
|
6411
6714
|
const data = useHeatmapDataContext((s) => s.data);
|
|
@@ -6417,11 +6720,9 @@ const useHeatmapRender = () => {
|
|
|
6417
6720
|
const renderHeatmap = useCallback(async (payloads) => {
|
|
6418
6721
|
if (!payloads || payloads.length === 0)
|
|
6419
6722
|
return;
|
|
6420
|
-
|
|
6421
|
-
if (!
|
|
6422
|
-
visualizer = new Visualizer();
|
|
6723
|
+
const visualizer = vizRef ?? new GXVisualizer();
|
|
6724
|
+
if (!vizRef)
|
|
6423
6725
|
setVizRef(visualizer);
|
|
6424
|
-
}
|
|
6425
6726
|
setIsRenderViz(false);
|
|
6426
6727
|
const iframe = iframeRef.current;
|
|
6427
6728
|
if (!iframe?.contentWindow)
|
|
@@ -6973,6 +7274,29 @@ const useWrapperRefHeight = (props) => {
|
|
|
6973
7274
|
return {};
|
|
6974
7275
|
};
|
|
6975
7276
|
|
|
7277
|
+
const useHeatmapScroll = ({ visualRef }) => {
|
|
7278
|
+
const selectedScrollY = useHeatmapScrollContext((s) => s.selectedScrollY);
|
|
7279
|
+
const widthScale = useHeatmapVizContext((s) => s.widthScale);
|
|
7280
|
+
const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
|
|
7281
|
+
useEffect(() => {
|
|
7282
|
+
if (!selectedScrollY || !iframeHeight || !visualRef.current)
|
|
7283
|
+
return;
|
|
7284
|
+
const container = visualRef.current;
|
|
7285
|
+
// const visualRect = container.getBoundingClientRect();
|
|
7286
|
+
// const viewportHeight = visualRect.height;
|
|
7287
|
+
// selectedScrollY is a percentage (0-100) → convert to content pixels → scale to visual position
|
|
7288
|
+
const contentPixelY = (selectedScrollY / 100) * iframeHeight;
|
|
7289
|
+
const topScaled = contentPixelY * widthScale;
|
|
7290
|
+
// Skip if already visible in the current viewport
|
|
7291
|
+
// const currentScrollTop = container.scrollTop;
|
|
7292
|
+
// const isVisible = topScaled >= currentScrollTop && topScaled <= currentScrollTop + viewportHeight;
|
|
7293
|
+
// if (isVisible) return;
|
|
7294
|
+
// Center the target position vertically in the viewport
|
|
7295
|
+
const targetScrollTop = Math.max(0, topScaled);
|
|
7296
|
+
container.scrollTo({ top: targetScrollTop, behavior: 'smooth' });
|
|
7297
|
+
}, [selectedScrollY, widthScale, iframeHeight]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
7298
|
+
};
|
|
7299
|
+
|
|
6976
7300
|
const useZonePositions = (_options) => {
|
|
6977
7301
|
const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
|
|
6978
7302
|
const getZonePosition = useCallback((zone) => {
|
|
@@ -7158,8 +7482,6 @@ ContentMetricBar.displayName = 'ContentMetricBar';
|
|
|
7158
7482
|
|
|
7159
7483
|
const ContentSidebar = () => {
|
|
7160
7484
|
const CompSidebar = useHeatmapControlStore((state) => state.controls.Sidebar);
|
|
7161
|
-
const state = useHeatmapClickContext((s) => s.state);
|
|
7162
|
-
const isHideSidebar = state.hideSidebar;
|
|
7163
7485
|
const sidebarWidth = useHeatmapConfigStore((state) => state.sidebarWidth);
|
|
7164
7486
|
const mode = useHeatmapConfigStore((state) => state.mode);
|
|
7165
7487
|
const isCompareMode = mode === 'compare';
|
|
@@ -7171,13 +7493,7 @@ const ContentSidebar = () => {
|
|
|
7171
7493
|
height: '100%',
|
|
7172
7494
|
display: 'flex',
|
|
7173
7495
|
zIndex: 1,
|
|
7174
|
-
|
|
7175
|
-
? {
|
|
7176
|
-
width: '0',
|
|
7177
|
-
transform: 'translateX(-100%)',
|
|
7178
|
-
visibility: 'hidden',
|
|
7179
|
-
}
|
|
7180
|
-
: { width: `${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px` }),
|
|
7496
|
+
width: `${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px`,
|
|
7181
7497
|
}, children: jsx("div", { className: "gx-hm-sidebar-wrapper", style: {
|
|
7182
7498
|
height: '100%',
|
|
7183
7499
|
width: `calc(${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px)`,
|
|
@@ -7186,35 +7502,30 @@ const ContentSidebar = () => {
|
|
|
7186
7502
|
};
|
|
7187
7503
|
|
|
7188
7504
|
const PopoverSidebar = () => {
|
|
7189
|
-
const mode = useHeatmapConfigStore((
|
|
7190
|
-
const CompSidebar = useHeatmapControlStore((
|
|
7191
|
-
const
|
|
7192
|
-
const
|
|
7193
|
-
const state = useHeatmapClickContext((s) => s.state);
|
|
7194
|
-
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
7505
|
+
const mode = useHeatmapConfigStore((s) => s.mode);
|
|
7506
|
+
const CompSidebar = useHeatmapControlStore((s) => s.controls.Sidebar);
|
|
7507
|
+
const sidebarWidth = useHeatmapConfigStore((s) => s.sidebarWidth);
|
|
7508
|
+
const isShowSidebar = useHeatmapSettingContext((s) => s.isShowSidebar);
|
|
7195
7509
|
const isCompareMode = mode === 'compare';
|
|
7196
|
-
const isHideSidebar = state.hideSidebar;
|
|
7197
7510
|
const stylePopover = {
|
|
7198
7511
|
position: 'absolute',
|
|
7199
7512
|
top: '24px',
|
|
7200
7513
|
left: '24px',
|
|
7201
|
-
zIndex: Z_INDEX.SIDEBAR_POPOVER,
|
|
7514
|
+
zIndex: Z_INDEX$1.SIDEBAR_POPOVER,
|
|
7202
7515
|
height: `calc(100% - ${HEATMAP_CONFIG.heightToolbar}px - ${HEATMAP_CONFIG.padding}px - 24px)`,
|
|
7203
7516
|
width: `calc(${sidebarWidth}px + ${HEATMAP_CONFIG.borderWidth}px)`,
|
|
7204
7517
|
};
|
|
7205
|
-
if (
|
|
7518
|
+
if (!isCompareMode || !CompSidebar)
|
|
7206
7519
|
return null;
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
display: isPopoverOpen ? 'block' : 'none',
|
|
7217
|
-
}, children: jsx(CompSidebar, { closeAction: { onClick: () => setIsPopoverOpen(false) } }) }) })] }));
|
|
7520
|
+
return (jsx("div", { className: "gx-hm-sidebar-popover", style: {
|
|
7521
|
+
...stylePopover,
|
|
7522
|
+
backgroundColor: '#fff',
|
|
7523
|
+
borderRight: `${HEATMAP_CONFIG.borderWidth}px solid ${HEATMAP_CONFIG.borderColor}`,
|
|
7524
|
+
borderRadius: '8px',
|
|
7525
|
+
boxShadow: '4px 0 12px rgba(0, 0, 0, 0.15)',
|
|
7526
|
+
overflow: 'auto',
|
|
7527
|
+
display: isShowSidebar ? 'block' : 'none',
|
|
7528
|
+
}, children: jsx(CompSidebar, {}) }));
|
|
7218
7529
|
};
|
|
7219
7530
|
|
|
7220
7531
|
const ContentToolbar = () => {
|
|
@@ -8349,11 +8660,12 @@ const VizClickmap = ({ iframeRef, visualRef, wrapperRef }) => {
|
|
|
8349
8660
|
}
|
|
8350
8661
|
};
|
|
8351
8662
|
|
|
8352
|
-
const
|
|
8663
|
+
const IS_ENABLE_MINIMAP = false;
|
|
8664
|
+
const Minimap = ({ zones, maxUsers }) => {
|
|
8353
8665
|
const scrollType = useHeatmapSettingContext((s) => s.scrollType);
|
|
8354
8666
|
const showMinimap = useHeatmapScrollContext((s) => s.showMinimap);
|
|
8355
8667
|
const isScrollType = [EScrollType.Attention].includes(scrollType ?? EScrollType.Depth);
|
|
8356
|
-
if (!showMinimap || !isScrollType)
|
|
8668
|
+
if (!showMinimap || !isScrollType || !IS_ENABLE_MINIMAP)
|
|
8357
8669
|
return null;
|
|
8358
8670
|
return (jsx("div", { style: {
|
|
8359
8671
|
position: 'fixed',
|
|
@@ -8422,10 +8734,10 @@ const HoverZones = ({ iframeRef, wrapperRef, position, currentScrollPercent }) =
|
|
|
8422
8734
|
return null;
|
|
8423
8735
|
if (!position)
|
|
8424
8736
|
return null;
|
|
8425
|
-
return (jsxs(Fragment, { children: [jsx(ScrollZoneTooltip, { position: position, currentScrollPercent: currentScrollPercent, scrollmap: scrollmap || [] }), jsx(
|
|
8737
|
+
return (jsxs(Fragment, { children: [jsx(ScrollZoneTooltip, { position: position, currentScrollPercent: currentScrollPercent, scrollmap: scrollmap || [] }), jsx(Minimap, { zones: zones, maxUsers: maxUsers })] }));
|
|
8426
8738
|
};
|
|
8427
8739
|
|
|
8428
|
-
const
|
|
8740
|
+
const ScrollOverlay = ({ wrapperRef, iframeRef }) => {
|
|
8429
8741
|
const widthScale = useHeatmapVizContext((s) => s.widthScale);
|
|
8430
8742
|
const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
|
|
8431
8743
|
const overlayRef = useRef(null);
|
|
@@ -8463,71 +8775,74 @@ const ScrollMapOverlay = ({ wrapperRef, iframeRef }) => {
|
|
|
8463
8775
|
}, children: jsx(HoverZones, { position: position, currentScrollPercent: currentScrollPercent, iframeRef: iframeRef, wrapperRef: wrapperRef }) }));
|
|
8464
8776
|
};
|
|
8465
8777
|
|
|
8466
|
-
const
|
|
8467
|
-
const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
|
|
8468
|
-
const { getZonePosition } = useZonePositions();
|
|
8469
|
-
const averageFold = dataInfo?.averageFold || 50;
|
|
8470
|
-
const position = getZonePosition({
|
|
8471
|
-
startY: averageFold,
|
|
8472
|
-
endY: averageFold,
|
|
8473
|
-
});
|
|
8474
|
-
if (!position)
|
|
8475
|
-
return null;
|
|
8778
|
+
const MarkerLine = ({ top, label, bgColor = 'white', lineColor = '#303030', labelColor = '#303030', variant = 'dashed', zIndex = 1, }) => {
|
|
8476
8779
|
return (jsx("div", { style: {
|
|
8477
8780
|
position: 'absolute',
|
|
8478
|
-
top: `${
|
|
8781
|
+
top: `${top}px`,
|
|
8479
8782
|
left: 0,
|
|
8480
8783
|
width: '100%',
|
|
8481
|
-
height: '
|
|
8482
|
-
|
|
8784
|
+
height: '0px',
|
|
8785
|
+
borderBottom: `2px ${variant} ${lineColor}`,
|
|
8786
|
+
// height: isSolid ? '2px' : '0px',
|
|
8787
|
+
// boxShadow: isSolid ? `0 0 4px ${lineColor}40` : undefined,
|
|
8483
8788
|
pointerEvents: 'none',
|
|
8484
|
-
zIndex
|
|
8485
|
-
boxShadow: '0 0 4px rgba(0,120,212,0.5)',
|
|
8789
|
+
zIndex,
|
|
8486
8790
|
display: 'flex',
|
|
8487
8791
|
alignItems: 'center',
|
|
8488
|
-
}, children:
|
|
8792
|
+
}, children: jsx("div", { style: {
|
|
8489
8793
|
position: 'absolute',
|
|
8490
|
-
padding: '8px',
|
|
8491
|
-
backgroundColor:
|
|
8492
|
-
color:
|
|
8493
|
-
fontSize: '
|
|
8494
|
-
fontWeight:
|
|
8794
|
+
padding: '6px 8px',
|
|
8795
|
+
backgroundColor: bgColor,
|
|
8796
|
+
color: labelColor,
|
|
8797
|
+
fontSize: '14px',
|
|
8798
|
+
fontWeight: 500,
|
|
8495
8799
|
borderRadius: '4px',
|
|
8496
8800
|
whiteSpace: 'nowrap',
|
|
8497
|
-
left: '
|
|
8498
|
-
minWidth: '
|
|
8801
|
+
left: '16px',
|
|
8802
|
+
minWidth: '100px',
|
|
8499
8803
|
textAlign: 'center',
|
|
8500
|
-
}, children:
|
|
8804
|
+
}, children: label }) }));
|
|
8501
8805
|
};
|
|
8502
8806
|
|
|
8503
|
-
const
|
|
8807
|
+
const AverageFold = ({ iframeRef, wrapperRef }) => {
|
|
8808
|
+
const dataInfo = useHeatmapDataContext((s) => s.dataInfo);
|
|
8809
|
+
const { getZonePosition } = useZonePositions();
|
|
8810
|
+
const averageFold = dataInfo?.averageFold || 50;
|
|
8811
|
+
const position = getZonePosition({
|
|
8812
|
+
startY: averageFold,
|
|
8813
|
+
endY: averageFold,
|
|
8814
|
+
});
|
|
8815
|
+
if (!position)
|
|
8816
|
+
return null;
|
|
8817
|
+
return jsx(MarkerLine, { top: position.top, label: `Average fold`, zIndex: 2 });
|
|
8818
|
+
};
|
|
8819
|
+
|
|
8820
|
+
const ScrollMarkers = ({ iframeRef, wrapperRef, visualRef }) => {
|
|
8504
8821
|
const scrollmap = useHeatmapDataContext((s) => s.scrollmap);
|
|
8505
8822
|
const scrollType = useHeatmapSettingContext((s) => s.scrollType);
|
|
8506
8823
|
const { getZonePosition } = useZonePositions();
|
|
8824
|
+
useHeatmapScroll({ visualRef });
|
|
8507
8825
|
if (!scrollmap || scrollmap.length === 0)
|
|
8508
8826
|
return null;
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
}
|
|
8518
|
-
return scrollmap[scrollmap.length - 1]?.scrollReachY || null;
|
|
8827
|
+
// Matches Clarity's addInfoMarkers logic:
|
|
8828
|
+
// find the closest percUsers entry, then validate it's within ±MARKER_RANGE
|
|
8829
|
+
const MARKER_RANGE = 2;
|
|
8830
|
+
const findScrollReachY = (targetPercent) => {
|
|
8831
|
+
const closest = scrollmap.reduce((prev, curr) => Math.abs(curr.percUsers - targetPercent) < Math.abs(prev.percUsers - targetPercent) ? curr : prev);
|
|
8832
|
+
if (Math.abs(closest.percUsers - targetPercent) > MARKER_RANGE)
|
|
8833
|
+
return null;
|
|
8834
|
+
return closest.scrollReachY;
|
|
8519
8835
|
};
|
|
8520
8836
|
const boundaries = [
|
|
8521
8837
|
{ percent: 75, label: '75%', color: '#10B981' },
|
|
8522
8838
|
{ percent: 50, label: '50%', color: '#F59E0B' },
|
|
8523
8839
|
{ percent: 25, label: '25%', color: '#EF4444' },
|
|
8524
|
-
{ percent: 5, label: '5%', color: '#8B5CF6' },
|
|
8525
8840
|
];
|
|
8526
8841
|
const isScrollDepth = scrollType === EScrollType.Depth;
|
|
8527
8842
|
if (!isScrollDepth)
|
|
8528
8843
|
return null;
|
|
8529
8844
|
return (jsx(Fragment, { children: boundaries.map((boundary) => {
|
|
8530
|
-
const scrollY =
|
|
8845
|
+
const scrollY = findScrollReachY(boundary.percent);
|
|
8531
8846
|
if (scrollY === null)
|
|
8532
8847
|
return null;
|
|
8533
8848
|
const position = getZonePosition({
|
|
@@ -8536,50 +8851,14 @@ const ScrollmapMarker = ({ iframeRef, wrapperRef }) => {
|
|
|
8536
8851
|
});
|
|
8537
8852
|
if (!position)
|
|
8538
8853
|
return null;
|
|
8539
|
-
return
|
|
8540
|
-
position: 'absolute',
|
|
8541
|
-
top: `${position.top}px`,
|
|
8542
|
-
left: 0,
|
|
8543
|
-
transformOrigin: 'left center',
|
|
8544
|
-
width: '100%',
|
|
8545
|
-
height: '0px',
|
|
8546
|
-
// borderBottom: `2px dashed #323130`,
|
|
8547
|
-
borderBottom: `2px solid ${boundary.color}`,
|
|
8548
|
-
// background: 'repeating-linear-gradient(90deg, #323130, transparent 2px 3px)',
|
|
8549
|
-
zIndex: 1,
|
|
8550
|
-
display: 'flex',
|
|
8551
|
-
alignItems: 'center',
|
|
8552
|
-
}, children: jsx("div", { style: {
|
|
8553
|
-
position: 'absolute',
|
|
8554
|
-
padding: '8px',
|
|
8555
|
-
backgroundColor: boundary.color,
|
|
8556
|
-
color: 'white',
|
|
8557
|
-
fontSize: '16px',
|
|
8558
|
-
fontWeight: 600,
|
|
8559
|
-
borderRadius: '4px',
|
|
8560
|
-
whiteSpace: 'nowrap',
|
|
8561
|
-
left: '12px',
|
|
8562
|
-
minWidth: '120px',
|
|
8563
|
-
textAlign: 'center',
|
|
8564
|
-
// textAlign: 'center',
|
|
8565
|
-
// padding: '8px',
|
|
8566
|
-
// paddingInline: '8px',
|
|
8567
|
-
// fontSize: '16px',
|
|
8568
|
-
// background: '#fff',
|
|
8569
|
-
// width: 'auto',
|
|
8570
|
-
// borderRadius: '4px',
|
|
8571
|
-
// position: 'absolute',
|
|
8572
|
-
// left: '12px',
|
|
8573
|
-
// minWidth: '120px',
|
|
8574
|
-
}, children: boundary.label }) }, boundary.label));
|
|
8854
|
+
return jsx(MarkerLine, { top: position.top, label: boundary.label }, boundary.label);
|
|
8575
8855
|
}) }));
|
|
8576
8856
|
};
|
|
8577
8857
|
|
|
8578
8858
|
const SCROLL_TYPES = [EHeatmapType.Scroll];
|
|
8579
|
-
const VizScrollMap = ({ iframeRef, wrapperRef }) => {
|
|
8859
|
+
const VizScrollMap = ({ iframeRef, wrapperRef, visualRef }) => {
|
|
8580
8860
|
const heatmapType = useHeatmapSettingContext((s) => s.heatmapType);
|
|
8581
8861
|
const iframeHeight = useHeatmapVizRectContext((s) => s.iframeHeight);
|
|
8582
|
-
// useRenderCount('VizScrollMap');
|
|
8583
8862
|
const isHeatmapScroll = SCROLL_TYPES.includes(heatmapType ?? EHeatmapType.Click);
|
|
8584
8863
|
if (!iframeHeight || !isHeatmapScroll)
|
|
8585
8864
|
return null;
|
|
@@ -8591,7 +8870,7 @@ const VizScrollMap = ({ iframeRef, wrapperRef }) => {
|
|
|
8591
8870
|
height: '100%',
|
|
8592
8871
|
transform: 'translateZ(0)',
|
|
8593
8872
|
zIndex: 2,
|
|
8594
|
-
}, children: [jsx(
|
|
8873
|
+
}, children: [jsx(ScrollMarkers, { iframeRef: iframeRef, wrapperRef: wrapperRef, visualRef: visualRef }), jsx(AverageFold, { iframeRef: iframeRef, wrapperRef: wrapperRef }), jsx(ScrollOverlay, { iframeRef: iframeRef, wrapperRef: wrapperRef })] }));
|
|
8595
8874
|
};
|
|
8596
8875
|
|
|
8597
8876
|
const VizLoadingCanvas = () => {
|
|
@@ -8662,7 +8941,7 @@ const VizDomRenderer = ({ mode = 'heatmap' }) => {
|
|
|
8662
8941
|
const scrollTop = e.currentTarget.scrollTop;
|
|
8663
8942
|
handleScroll(scrollTop);
|
|
8664
8943
|
};
|
|
8665
|
-
return (jsxs(WrapperVisual, { visualRef: visualRef, wrapperRef: wrapperRef, scaledHeight: scaledHeight, onScroll: onScroll, iframeHeight: iframeHeight, children: [jsx(VizClickmap, { iframeRef: iframeRef, visualRef: visualRef, wrapperRef: wrapperRef }), jsx("iframe", { ...HEATMAP_IFRAME, id: `clarity-iframe-${viewId}`, ref: iframeRef, width: contentWidth, height: wrapperHeight }), jsx(VizLoadingCanvas, {}), jsx(VizScrollMap, { iframeRef: iframeRef, wrapperRef:
|
|
8944
|
+
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, { visualRef: visualRef, iframeRef: iframeRef, wrapperRef: wrapperRef })] }));
|
|
8666
8945
|
};
|
|
8667
8946
|
|
|
8668
8947
|
const VizLoading = () => {
|
|
@@ -8773,10 +9052,10 @@ const ContentTopBar = () => {
|
|
|
8773
9052
|
}, children: CompTopBar && jsx(CompTopBar, {}) }));
|
|
8774
9053
|
};
|
|
8775
9054
|
|
|
8776
|
-
const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataInfo, isLoading, isLoadingCanvas, }) => {
|
|
9055
|
+
const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, attentionMap, controls, dataInfo, isLoading, isLoadingCanvas, }) => {
|
|
8777
9056
|
useRegisterControl(controls);
|
|
8778
9057
|
useRegisterData(data, dataInfo);
|
|
8779
|
-
useRegisterHeatmap({ clickmap, scrollmap, clickAreas });
|
|
9058
|
+
useRegisterHeatmap({ clickmap, scrollmap, clickAreas, attentionMap });
|
|
8780
9059
|
useRegisterConfig({ isLoading, isLoadingCanvas });
|
|
8781
9060
|
// performanceLogger.configure({
|
|
8782
9061
|
// enabled: true,
|
|
@@ -8807,4 +9086,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
|
|
|
8807
9086
|
}
|
|
8808
9087
|
};
|
|
8809
9088
|
|
|
8810
|
-
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 };
|
|
9089
|
+
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$1 as 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, useHeatmapScroll, useHeatmapScrollContext, useHeatmapSettingContext, useHeatmapVizContext, useHeatmapVizRectContext, useHeatmapWidthByDevice, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };
|