@gemx-dev/heatmap-react 3.5.60 → 3.5.62
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/VizElement/DefaultRankBadges.d.ts +2 -2
- package/dist/esm/components/VizElement/DefaultRankBadges.d.ts.map +1 -1
- package/dist/esm/components/VizElement/ElementCalloutOverlay.d.ts.map +1 -1
- package/dist/esm/configs/index.d.ts +1 -0
- package/dist/esm/configs/index.d.ts.map +1 -1
- package/dist/esm/configs/zoom.d.ts +6 -0
- package/dist/esm/configs/zoom.d.ts.map +1 -0
- package/dist/esm/helpers/viz-area-click/area-builder.d.ts +2 -2
- package/dist/esm/helpers/viz-area-click/area-builder.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/index.d.ts +1 -0
- package/dist/esm/hooks/view-context/index.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapData.d.ts +3 -31
- package/dist/esm/hooks/view-context/useHeatmapData.d.ts.map +1 -1
- package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts +38 -0
- package/dist/esm/hooks/view-context/useHeatmapSetting.d.ts.map +1 -0
- package/dist/esm/hooks/view-context/useHeatmapViz.d.ts +2 -0
- package/dist/esm/hooks/view-context/useHeatmapViz.d.ts.map +1 -1
- package/dist/esm/hooks/viz-elm/useHeatmapElementPosition.d.ts +2 -2
- package/dist/esm/hooks/viz-elm/useHeatmapElementPosition.d.ts.map +1 -1
- package/dist/esm/hooks/viz-scale/useScaleCalculation.d.ts.map +1 -1
- package/dist/esm/index.js +151 -36
- package/dist/esm/index.mjs +151 -36
- package/dist/esm/stores/data.d.ts +1 -0
- package/dist/esm/stores/data.d.ts.map +1 -1
- package/dist/esm/stores/index.d.ts +1 -0
- package/dist/esm/stores/index.d.ts.map +1 -1
- package/dist/esm/stores/setting.d.ts +22 -0
- package/dist/esm/stores/setting.d.ts.map +1 -0
- package/dist/esm/stores/viz.d.ts +2 -0
- package/dist/esm/stores/viz.d.ts.map +1 -1
- package/dist/esm/types/heatmap-info.d.ts +22 -3
- package/dist/esm/types/heatmap-info.d.ts.map +1 -1
- package/dist/esm/types/heatmap.d.ts +8 -0
- package/dist/esm/types/heatmap.d.ts.map +1 -1
- package/dist/esm/types/viz-elm.d.ts +2 -2
- package/dist/esm/types/viz-elm.d.ts.map +1 -1
- package/dist/umd/components/VizElement/DefaultRankBadges.d.ts +2 -2
- package/dist/umd/components/VizElement/DefaultRankBadges.d.ts.map +1 -1
- package/dist/umd/components/VizElement/ElementCalloutOverlay.d.ts.map +1 -1
- package/dist/umd/configs/index.d.ts +1 -0
- package/dist/umd/configs/index.d.ts.map +1 -1
- package/dist/umd/configs/zoom.d.ts +6 -0
- package/dist/umd/configs/zoom.d.ts.map +1 -0
- package/dist/umd/helpers/viz-area-click/area-builder.d.ts +2 -2
- package/dist/umd/helpers/viz-area-click/area-builder.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/index.d.ts +1 -0
- package/dist/umd/hooks/view-context/index.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapData.d.ts +3 -31
- package/dist/umd/hooks/view-context/useHeatmapData.d.ts.map +1 -1
- package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts +38 -0
- package/dist/umd/hooks/view-context/useHeatmapSetting.d.ts.map +1 -0
- package/dist/umd/hooks/view-context/useHeatmapViz.d.ts +2 -0
- package/dist/umd/hooks/view-context/useHeatmapViz.d.ts.map +1 -1
- package/dist/umd/hooks/viz-elm/useHeatmapElementPosition.d.ts +2 -2
- package/dist/umd/hooks/viz-elm/useHeatmapElementPosition.d.ts.map +1 -1
- package/dist/umd/hooks/viz-scale/useScaleCalculation.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/stores/data.d.ts +1 -0
- package/dist/umd/stores/data.d.ts.map +1 -1
- package/dist/umd/stores/index.d.ts +1 -0
- package/dist/umd/stores/index.d.ts.map +1 -1
- package/dist/umd/stores/setting.d.ts +22 -0
- package/dist/umd/stores/setting.d.ts.map +1 -0
- package/dist/umd/stores/viz.d.ts +2 -0
- package/dist/umd/stores/viz.d.ts.map +1 -1
- package/dist/umd/types/heatmap-info.d.ts +22 -3
- package/dist/umd/types/heatmap-info.d.ts.map +1 -1
- package/dist/umd/types/heatmap.d.ts +8 -0
- package/dist/umd/types/heatmap.d.ts.map +1 -1
- package/dist/umd/types/viz-elm.d.ts +2 -2
- package/dist/umd/types/viz-elm.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ElementRect,
|
|
1
|
+
import type { ElementRect, IClickmapSorted } from '../../types';
|
|
2
2
|
interface Props {
|
|
3
|
-
getRect: (el?:
|
|
3
|
+
getRect: (el?: IClickmapSorted) => ElementRect | null;
|
|
4
4
|
hidden?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare const DefaultRankBadges: import("react").NamedExoticComponent<Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultRankBadges.d.ts","sourceRoot":"","sources":["../../../src/components/VizElement/DefaultRankBadges.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"DefaultRankBadges.d.ts","sourceRoot":"","sources":["../../../src/components/VizElement/DefaultRankBadges.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAOhE,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,eAAe,KAAK,WAAW,GAAG,IAAI,CAAC;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA+BD,eAAO,MAAM,iBAAiB,6CAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementCalloutOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/VizElement/ElementCalloutOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ElementCalloutOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/VizElement/ElementCalloutOverlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQ5D,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA2C/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configs/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configs/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../src/configs/zoom.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IAreaNode, IClickMapMetric, IHeatmapInfo, IPersistedAreaData } from '../../types';
|
|
2
2
|
export declare function buildAreaNode(element: HTMLElement, hash: string, heatmapInfo: IHeatmapInfo, shadowRoot?: HTMLElement, persistedData?: IPersistedAreaData): IAreaNode | undefined;
|
|
3
|
-
export declare function getTopElementsByClicks(
|
|
3
|
+
export declare function getTopElementsByClicks(clickMapMetrics: IClickMapMetric, topN?: number): Array<{
|
|
4
4
|
hash: string;
|
|
5
5
|
totalclicks: number;
|
|
6
6
|
selector: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area-builder.d.ts","sourceRoot":"","sources":["../../../src/helpers/viz-area-click/area-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"area-builder.d.ts","sourceRoot":"","sources":["../../../src/helpers/viz-area-click/area-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,SAAS,EAAa,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAkD3H,wBAAgB,aAAa,CAC3B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,YAAY,EACzB,UAAU,CAAC,EAAE,WAAW,EACxB,aAAa,CAAC,EAAE,kBAAkB,GACjC,SAAS,GAAG,SAAS,CAmDvB;AAED,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,EAChC,IAAI,GAAE,MAAW,GAChB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAWhE"}
|
|
@@ -3,6 +3,7 @@ export * from './useHeatmapClick';
|
|
|
3
3
|
export * from './useHeatmapData';
|
|
4
4
|
export * from './useHeatmapHover';
|
|
5
5
|
export * from './useHeatmapScroll';
|
|
6
|
+
export * from './useHeatmapSetting';
|
|
6
7
|
export * from './useHeatmapViz';
|
|
7
8
|
export * from './useHeatmapVizRect';
|
|
8
9
|
export * from './useHeatmapCopyView';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,sBAAsB,CAAC"}
|
|
@@ -12,10 +12,10 @@ interface IHeatmapDataActions {
|
|
|
12
12
|
setClickAreas: (newClickAreas: IPersistedAreaData[]) => void;
|
|
13
13
|
setScrollmap: (newScrollmap: ScrollMapPoint[]) => void;
|
|
14
14
|
setDataInfo: (newDataInfo: IHeatmapInfo) => void;
|
|
15
|
+
setDataInfoByKey: <K extends keyof IHeatmapInfo>(key: K, value: IHeatmapInfo[K]) => void;
|
|
15
16
|
removeClickArea: (areaId: string) => void;
|
|
16
17
|
clearView: (viewId: string) => void;
|
|
17
18
|
}
|
|
18
|
-
export type IHeatmapDataResult = IHeatmapDataState & IHeatmapDataActions;
|
|
19
19
|
/**
|
|
20
20
|
* Hook to access heatmap data state and actions with optional selector
|
|
21
21
|
*
|
|
@@ -33,40 +33,12 @@ export type IHeatmapDataResult = IHeatmapDataState & IHeatmapDataActions;
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export declare const useHeatmapData: {
|
|
36
|
-
<T>(selector: (state: {
|
|
37
|
-
data: import("@gemx-dev/clarity-decode/types/data").DecodedPayload[] | undefined;
|
|
38
|
-
clickmap: ClickMapPoint[] | undefined;
|
|
39
|
-
clickAreas: IPersistedAreaData[] | undefined;
|
|
40
|
-
scrollmap: ScrollMapPoint[] | undefined;
|
|
41
|
-
dataInfo: IHeatmapInfo | undefined;
|
|
42
|
-
} & {
|
|
43
|
-
setData: (newData: DecodedPayload[]) => void;
|
|
44
|
-
setClickmap: (newClickmap: ClickMapPoint[]) => void;
|
|
45
|
-
setClickAreas: (newClickAreas: IPersistedAreaData[]) => void;
|
|
46
|
-
setScrollmap: (newScrollmap: ScrollMapPoint[]) => void;
|
|
47
|
-
setDataInfo: (newDataInfo: IHeatmapInfo) => void;
|
|
48
|
-
removeClickArea: (areaId: string) => void;
|
|
49
|
-
clearView: (viewId: string) => void;
|
|
50
|
-
}) => T, props?: {
|
|
36
|
+
<T>(selector: (state: IHeatmapDataState & IHeatmapDataActions) => T, props?: {
|
|
51
37
|
viewId?: string;
|
|
52
38
|
} | undefined): T;
|
|
53
39
|
(props?: {
|
|
54
40
|
viewId?: string;
|
|
55
|
-
} | undefined):
|
|
56
|
-
data: import("@gemx-dev/clarity-decode/types/data").DecodedPayload[] | undefined;
|
|
57
|
-
clickmap: ClickMapPoint[] | undefined;
|
|
58
|
-
clickAreas: IPersistedAreaData[] | undefined;
|
|
59
|
-
scrollmap: ScrollMapPoint[] | undefined;
|
|
60
|
-
dataInfo: IHeatmapInfo | undefined;
|
|
61
|
-
} & {
|
|
62
|
-
setData: (newData: DecodedPayload[]) => void;
|
|
63
|
-
setClickmap: (newClickmap: ClickMapPoint[]) => void;
|
|
64
|
-
setClickAreas: (newClickAreas: IPersistedAreaData[]) => void;
|
|
65
|
-
setScrollmap: (newScrollmap: ScrollMapPoint[]) => void;
|
|
66
|
-
setDataInfo: (newDataInfo: IHeatmapInfo) => void;
|
|
67
|
-
removeClickArea: (areaId: string) => void;
|
|
68
|
-
clearView: (viewId: string) => void;
|
|
69
|
-
};
|
|
41
|
+
} | undefined): IHeatmapDataState & IHeatmapDataActions;
|
|
70
42
|
};
|
|
71
43
|
export {};
|
|
72
44
|
//# sourceMappingURL=useHeatmapData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeatmapData.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/useHeatmapData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"useHeatmapData.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/useHeatmapData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMnH,UAAU,iBAAiB;IACzB,IAAI,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IACtC,UAAU,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAC;IAC7C,SAAS,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACxC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;CACpC;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC7C,WAAW,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACpD,aAAa,EAAE,CAAC,aAAa,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IAC7D,YAAY,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IACvD,WAAW,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IACjD,gBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACzF,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc;;;;;;;CAqBzB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IClickType, IClickRankType, IScrollType } from '../../types';
|
|
2
|
+
interface IHeatmapSettingState {
|
|
3
|
+
rankedBy: IClickRankType | undefined;
|
|
4
|
+
clickType: IClickType | undefined;
|
|
5
|
+
scrollType: IScrollType | undefined;
|
|
6
|
+
}
|
|
7
|
+
interface IHeatmapSettingActions {
|
|
8
|
+
setRankedBy: (rankedBy: IClickRankType) => void;
|
|
9
|
+
setClickType: (clickType: IClickType) => void;
|
|
10
|
+
setScrollType: (scrollType: IScrollType) => void;
|
|
11
|
+
clearView: (viewId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook to access heatmap setting state and actions with optional selector
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Get everything
|
|
19
|
+
* const { rankedBy, clickType, setRankedBy } = useHeatmapSetting();
|
|
20
|
+
*
|
|
21
|
+
* // Get only what you need (no unnecessary re-renders)
|
|
22
|
+
* const rankedBy = useHeatmapSetting(s => s.rankedBy);
|
|
23
|
+
* const { setRankedBy, setClickType } = useHeatmapSetting(s => ({
|
|
24
|
+
* setRankedBy: s.setRankedBy,
|
|
25
|
+
* setClickType: s.setClickType,
|
|
26
|
+
* }));
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const useHeatmapSetting: {
|
|
30
|
+
<T>(selector: (state: IHeatmapSettingState & IHeatmapSettingActions) => T, props?: {
|
|
31
|
+
viewId?: string;
|
|
32
|
+
} | undefined): T;
|
|
33
|
+
(props?: {
|
|
34
|
+
viewId?: string;
|
|
35
|
+
} | undefined): IHeatmapSettingState & IHeatmapSettingActions;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=useHeatmapSetting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeatmapSetting.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/useHeatmapSetting.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI3E,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,UAAU,sBAAsB;IAC9B,WAAW,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,YAAY,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9C,aAAa,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB;;;;;;;CAe5B,CAAC"}
|
|
@@ -2,6 +2,7 @@ interface IHeatmapVizState {
|
|
|
2
2
|
isRenderViz: boolean;
|
|
3
3
|
zoomRatio: number;
|
|
4
4
|
minZoomRatio: number;
|
|
5
|
+
maxZoomRatio: number;
|
|
5
6
|
widthScale: number;
|
|
6
7
|
isScaledToFit: boolean;
|
|
7
8
|
}
|
|
@@ -9,6 +10,7 @@ interface IHeatmapVizActions {
|
|
|
9
10
|
setIsRenderViz: (value: boolean) => void;
|
|
10
11
|
setZoomRatio: (value: number) => void;
|
|
11
12
|
setMinZoomRatio: (value: number) => void;
|
|
13
|
+
setMaxZoomRatio: (value: number) => void;
|
|
12
14
|
setScale: (value: number) => void;
|
|
13
15
|
setIsScaledToFit: (value: boolean) => void;
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeatmapViz.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/useHeatmapViz.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHeatmapViz.d.ts","sourceRoot":"","sources":["../../../src/hooks/view-context/useHeatmapViz.ts"],"names":[],"mappings":"AAUA,UAAU,gBAAgB;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,kBAAkB;IAC1B,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAMtE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa;;;;;;;CAoBxB,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ElementRect,
|
|
1
|
+
import type { ElementRect, IClickmapSorted, WebVisualizer } from '../../types';
|
|
2
2
|
interface Params {
|
|
3
3
|
iframeRef: React.RefObject<HTMLIFrameElement>;
|
|
4
4
|
wrapperRef: React.RefObject<HTMLElement>;
|
|
5
5
|
visualizer?: WebVisualizer;
|
|
6
6
|
}
|
|
7
7
|
export declare const useHeatmapElementPosition: ({ iframeRef, wrapperRef, visualizer }: Params) => {
|
|
8
|
-
getRect: (element?:
|
|
8
|
+
getRect: (element?: IClickmapSorted) => ElementRect | null;
|
|
9
9
|
};
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=useHeatmapElementPosition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeatmapElementPosition.d.ts","sourceRoot":"","sources":["../../../src/hooks/viz-elm/useHeatmapElementPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"useHeatmapElementPosition.d.ts","sourceRoot":"","sources":["../../../src/hooks/viz-elm/useHeatmapElementPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO/E,UAAU,MAAM;IACd,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC9C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED,eAAO,MAAM,yBAAyB,GAAI,uCAAuC,MAAM;wBAMxE,eAAe,KAAG,WAAW,GAAG,IAAI;CA2ClD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScaleCalculation.d.ts","sourceRoot":"","sources":["../../../src/hooks/viz-scale/useScaleCalculation.ts"],"names":[],"mappings":"AAIA,UAAU,yBAAyB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,0BAA0B;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"useScaleCalculation.d.ts","sourceRoot":"","sources":["../../../src/hooks/viz-scale/useScaleCalculation.ts"],"names":[],"mappings":"AAIA,UAAU,yBAAyB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,0BAA0B;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,yBAAyB,KAAG,0BA2DtE,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -113,6 +113,12 @@ const Z_INDEX = {
|
|
|
113
113
|
SIDEBAR_POPOVER: 4001,
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
const DEFAULT_ZOOM_RATIO = {
|
|
117
|
+
DEFAULT: 100,
|
|
118
|
+
MIN: 10,
|
|
119
|
+
MAX: 100,
|
|
120
|
+
};
|
|
121
|
+
|
|
116
122
|
/**
|
|
117
123
|
* Creates a debounced version of a callback that delays invoking until after
|
|
118
124
|
* wait milliseconds have elapsed since the last time it was invoked.
|
|
@@ -180,6 +186,15 @@ var IClickType;
|
|
|
180
186
|
IClickType["First"] = "first-clicks";
|
|
181
187
|
IClickType["Last"] = "last-clicks";
|
|
182
188
|
})(IClickType || (IClickType = {}));
|
|
189
|
+
var IClickRankType;
|
|
190
|
+
(function (IClickRankType) {
|
|
191
|
+
IClickRankType["MostClicks"] = "most-clicks";
|
|
192
|
+
IClickRankType["Revenue"] = "revenue";
|
|
193
|
+
IClickRankType["AttributionRate"] = "attribution-rate";
|
|
194
|
+
IClickRankType["ConversionRate"] = "conversion-rate";
|
|
195
|
+
IClickRankType["RevenuePerClick"] = "revenue-per-click";
|
|
196
|
+
IClickRankType["RevenuePerSession"] = "revenue-per-session";
|
|
197
|
+
})(IClickRankType || (IClickRankType = {}));
|
|
183
198
|
var IClickMode;
|
|
184
199
|
(function (IClickMode) {
|
|
185
200
|
IClickMode["Default"] = "default";
|
|
@@ -253,6 +268,16 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
253
268
|
newScrollmap.set(viewId, scrollmap);
|
|
254
269
|
return { scrollmap: newScrollmap };
|
|
255
270
|
}),
|
|
271
|
+
setDataInfoByKey: (key, value, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
272
|
+
const currentHeatmapInfo = prev.dataInfo.get(viewId) || {};
|
|
273
|
+
const newHeatmapInfo = {
|
|
274
|
+
...currentHeatmapInfo,
|
|
275
|
+
[key]: value,
|
|
276
|
+
};
|
|
277
|
+
const newDataInfo = new Map(prev.dataInfo);
|
|
278
|
+
newDataInfo.set(viewId, newHeatmapInfo);
|
|
279
|
+
return { dataInfo: newDataInfo };
|
|
280
|
+
}),
|
|
256
281
|
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
257
282
|
const newData = new Map(prev.data);
|
|
258
283
|
const newClickmap = new Map(prev.clickmap);
|
|
@@ -301,11 +326,66 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
301
326
|
};
|
|
302
327
|
}));
|
|
303
328
|
|
|
329
|
+
const useHeatmapSettingStore = create()(subscribeWithSelector((set) => {
|
|
330
|
+
return {
|
|
331
|
+
rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
|
|
332
|
+
clickType: new Map([[DEFAULT_VIEW_ID, IClickType.Total]]),
|
|
333
|
+
scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
|
|
334
|
+
setRankedBy: (rankedBy, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
335
|
+
const newRankedBy = new Map(prev.rankedBy);
|
|
336
|
+
newRankedBy.set(viewId, rankedBy);
|
|
337
|
+
return { rankedBy: newRankedBy };
|
|
338
|
+
}),
|
|
339
|
+
setClickType: (clickType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
340
|
+
const newClickType = new Map(prev.clickType);
|
|
341
|
+
newClickType.set(viewId, clickType);
|
|
342
|
+
return { clickType: newClickType };
|
|
343
|
+
}),
|
|
344
|
+
setScrollType: (scrollType, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
345
|
+
const newScrollType = new Map(prev.scrollType);
|
|
346
|
+
newScrollType.set(viewId, scrollType);
|
|
347
|
+
return { scrollType: newScrollType };
|
|
348
|
+
}),
|
|
349
|
+
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
350
|
+
const newRankedBy = new Map(prev.rankedBy);
|
|
351
|
+
const newClickType = new Map(prev.clickType);
|
|
352
|
+
const newScrollType = new Map(prev.scrollType);
|
|
353
|
+
newRankedBy.set(toViewId, prev.rankedBy.get(fromViewId));
|
|
354
|
+
newClickType.set(toViewId, prev.clickType.get(fromViewId));
|
|
355
|
+
newScrollType.set(toViewId, prev.scrollType.get(fromViewId));
|
|
356
|
+
return {
|
|
357
|
+
rankedBy: newRankedBy,
|
|
358
|
+
clickType: newClickType,
|
|
359
|
+
scrollType: newScrollType,
|
|
360
|
+
};
|
|
361
|
+
}),
|
|
362
|
+
clearView: (viewId) => set((prev) => {
|
|
363
|
+
const newRankedBy = new Map(prev.rankedBy);
|
|
364
|
+
const newClickType = new Map(prev.clickType);
|
|
365
|
+
const newScrollType = new Map(prev.scrollType);
|
|
366
|
+
newRankedBy.delete(viewId);
|
|
367
|
+
newClickType.delete(viewId);
|
|
368
|
+
newScrollType.delete(viewId);
|
|
369
|
+
return {
|
|
370
|
+
rankedBy: newRankedBy,
|
|
371
|
+
clickType: newClickType,
|
|
372
|
+
scrollType: newScrollType,
|
|
373
|
+
};
|
|
374
|
+
}),
|
|
375
|
+
resetAll: () => set({
|
|
376
|
+
rankedBy: new Map([[DEFAULT_VIEW_ID, IClickRankType.MostClicks]]),
|
|
377
|
+
clickType: new Map([[DEFAULT_VIEW_ID, IClickType.Total]]),
|
|
378
|
+
scrollType: new Map([[DEFAULT_VIEW_ID, IScrollType.Depth]]),
|
|
379
|
+
}),
|
|
380
|
+
};
|
|
381
|
+
}));
|
|
382
|
+
|
|
304
383
|
const useHeatmapVizStore = create()(subscribeWithSelector((set) => {
|
|
305
384
|
return {
|
|
306
385
|
isRenderViz: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
307
|
-
zoomRatio: new Map([[DEFAULT_VIEW_ID,
|
|
308
|
-
minZoomRatio: new Map([[DEFAULT_VIEW_ID,
|
|
386
|
+
zoomRatio: new Map([[DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO.DEFAULT]]),
|
|
387
|
+
minZoomRatio: new Map([[DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO.MIN]]),
|
|
388
|
+
maxZoomRatio: new Map([[DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO.MAX]]),
|
|
309
389
|
scale: new Map([[DEFAULT_VIEW_ID, 1]]),
|
|
310
390
|
isScaledToFit: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
311
391
|
setIsRenderViz: (isRenderViz, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
@@ -323,6 +403,11 @@ const useHeatmapVizStore = create()(subscribeWithSelector((set) => {
|
|
|
323
403
|
newMinZoomRatio.set(viewId, minZoomRatio);
|
|
324
404
|
return { minZoomRatio: newMinZoomRatio };
|
|
325
405
|
}),
|
|
406
|
+
setMaxZoomRatio: (maxZoomRatio, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
407
|
+
const newMaxZoomRatio = new Map(prev.maxZoomRatio);
|
|
408
|
+
newMaxZoomRatio.set(viewId, maxZoomRatio);
|
|
409
|
+
return { maxZoomRatio: newMaxZoomRatio };
|
|
410
|
+
}),
|
|
326
411
|
setScale: (scale, viewId = DEFAULT_VIEW_ID) => set((prev) => {
|
|
327
412
|
const newScale = new Map(prev.scale);
|
|
328
413
|
newScale.set(viewId, scale);
|
|
@@ -1031,9 +1116,6 @@ const useHeatmapClick = createViewContextHook({
|
|
|
1031
1116
|
}),
|
|
1032
1117
|
});
|
|
1033
1118
|
|
|
1034
|
-
// ===========================
|
|
1035
|
-
// Hook
|
|
1036
|
-
// ===========================
|
|
1037
1119
|
/**
|
|
1038
1120
|
* Hook to access heatmap data state and actions with optional selector
|
|
1039
1121
|
*
|
|
@@ -1063,6 +1145,7 @@ const useHeatmapData = createViewContextHook({
|
|
|
1063
1145
|
setData: (newData) => store.setData(newData, viewId),
|
|
1064
1146
|
setClickmap: (newClickmap) => store.setClickmap(newClickmap, viewId),
|
|
1065
1147
|
setClickAreas: (newClickAreas) => store.setClickAreas(newClickAreas, viewId),
|
|
1148
|
+
setDataInfoByKey: (key, value) => store.setDataInfoByKey(key, value, viewId),
|
|
1066
1149
|
setScrollmap: (newScrollmap) => store.setScrollmap(newScrollmap, viewId),
|
|
1067
1150
|
setDataInfo: (newDataInfo) => store.setDataInfo(newDataInfo, viewId),
|
|
1068
1151
|
removeClickArea: (areaId) => store.removeClickArea(areaId, viewId),
|
|
@@ -1127,6 +1210,37 @@ const useHeatmapScroll = createViewContextHook({
|
|
|
1127
1210
|
}),
|
|
1128
1211
|
});
|
|
1129
1212
|
|
|
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
|
+
const useHeatmapSetting = createViewContextHook({
|
|
1230
|
+
useStore: useHeatmapSettingStore,
|
|
1231
|
+
getState: (store, viewId) => ({
|
|
1232
|
+
rankedBy: store.rankedBy.get(viewId),
|
|
1233
|
+
clickType: store.clickType.get(viewId),
|
|
1234
|
+
scrollType: store.scrollType.get(viewId),
|
|
1235
|
+
}),
|
|
1236
|
+
getActions: (store, viewId) => ({
|
|
1237
|
+
setRankedBy: (rankedBy) => store.setRankedBy(rankedBy, viewId),
|
|
1238
|
+
setClickType: (clickType) => store.setClickType(clickType, viewId),
|
|
1239
|
+
setScrollType: (scrollType) => store.setScrollType(scrollType, viewId),
|
|
1240
|
+
clearView: (viewId) => store.clearView(viewId),
|
|
1241
|
+
}),
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1130
1244
|
// ===========================
|
|
1131
1245
|
// Hook
|
|
1132
1246
|
// ===========================
|
|
@@ -1150,8 +1264,9 @@ const useHeatmapViz = createViewContextHook({
|
|
|
1150
1264
|
useStore: useHeatmapVizStore,
|
|
1151
1265
|
getState: (store, viewId) => ({
|
|
1152
1266
|
isRenderViz: store.isRenderViz.get(viewId) ?? false,
|
|
1153
|
-
zoomRatio: store.zoomRatio.get(viewId) ??
|
|
1154
|
-
minZoomRatio: store.minZoomRatio.get(viewId) ??
|
|
1267
|
+
zoomRatio: store.zoomRatio.get(viewId) ?? DEFAULT_ZOOM_RATIO.DEFAULT,
|
|
1268
|
+
minZoomRatio: store.minZoomRatio.get(viewId) ?? DEFAULT_ZOOM_RATIO.MIN,
|
|
1269
|
+
maxZoomRatio: store.maxZoomRatio.get(viewId) ?? DEFAULT_ZOOM_RATIO.MAX,
|
|
1155
1270
|
widthScale: store.scale.get(viewId) ?? 1,
|
|
1156
1271
|
isScaledToFit: store.isScaledToFit.get(viewId) ?? false,
|
|
1157
1272
|
}),
|
|
@@ -1159,6 +1274,7 @@ const useHeatmapViz = createViewContextHook({
|
|
|
1159
1274
|
setIsRenderViz: (value) => store.setIsRenderViz(value, viewId),
|
|
1160
1275
|
setZoomRatio: (value) => store.setZoomRatio(value, viewId),
|
|
1161
1276
|
setMinZoomRatio: (value) => store.setMinZoomRatio(value, viewId),
|
|
1277
|
+
setMaxZoomRatio: (value) => store.setMaxZoomRatio(value, viewId),
|
|
1162
1278
|
setScale: (value) => store.setScale(value, viewId),
|
|
1163
1279
|
setIsScaledToFit: (value) => store.setIsScaledToFit(value, viewId),
|
|
1164
1280
|
}),
|
|
@@ -1617,31 +1733,31 @@ function getElementSelector(element) {
|
|
|
1617
1733
|
* @param elementMapInfo - Map of hash to element click info
|
|
1618
1734
|
* @returns Total clicks for element + all descendants
|
|
1619
1735
|
*/
|
|
1620
|
-
function calculateTotalClicksWithChildren(element,
|
|
1736
|
+
function calculateTotalClicksWithChildren(element, clickMapMetrics) {
|
|
1621
1737
|
let totalClicks = 0;
|
|
1622
1738
|
// Get clicks for the element itself
|
|
1623
1739
|
const elementHash = getElementHash(element);
|
|
1624
1740
|
if (elementHash) {
|
|
1625
|
-
const elementInfo =
|
|
1626
|
-
totalClicks += elementInfo?.
|
|
1741
|
+
const elementInfo = clickMapMetrics[elementHash];
|
|
1742
|
+
totalClicks += elementInfo?.totalClicked.value ?? 0;
|
|
1627
1743
|
}
|
|
1628
1744
|
const children = element.querySelectorAll('*');
|
|
1629
1745
|
children.forEach((child) => {
|
|
1630
1746
|
const childHash = getElementHash(child);
|
|
1631
1747
|
if (childHash) {
|
|
1632
|
-
const childInfo =
|
|
1633
|
-
totalClicks += childInfo?.
|
|
1748
|
+
const childInfo = clickMapMetrics[childHash];
|
|
1749
|
+
totalClicks += childInfo?.totalClicked.value ?? 0;
|
|
1634
1750
|
}
|
|
1635
1751
|
});
|
|
1636
1752
|
return totalClicks;
|
|
1637
1753
|
}
|
|
1638
1754
|
function buildAreaNode(element, hash, heatmapInfo, shadowRoot, persistedData) {
|
|
1639
|
-
if (!heatmapInfo.
|
|
1755
|
+
if (!heatmapInfo.clickMapMetrics)
|
|
1640
1756
|
return;
|
|
1641
1757
|
const totalClicks = heatmapInfo.totalClicks || 0;
|
|
1642
|
-
const elementInfo = heatmapInfo.
|
|
1758
|
+
const elementInfo = heatmapInfo.clickMapMetrics[hash];
|
|
1643
1759
|
// Calculate total clicks including all child elements
|
|
1644
|
-
const elementClicks = calculateTotalClicksWithChildren(element, heatmapInfo.
|
|
1760
|
+
const elementClicks = calculateTotalClicksWithChildren(element, heatmapInfo.clickMapMetrics);
|
|
1645
1761
|
const clickDist = calculateClickDistribution(elementClicks, totalClicks);
|
|
1646
1762
|
const rect = getElementRect(element);
|
|
1647
1763
|
const color = getColorFromClickDist(clickDist);
|
|
@@ -1677,11 +1793,11 @@ function buildAreaNode(element, hash, heatmapInfo, shadowRoot, persistedData) {
|
|
|
1677
1793
|
};
|
|
1678
1794
|
return areaNode;
|
|
1679
1795
|
}
|
|
1680
|
-
function getTopElementsByClicks(
|
|
1681
|
-
const elements = Object.entries(
|
|
1796
|
+
function getTopElementsByClicks(clickMapMetrics, topN = 10) {
|
|
1797
|
+
const elements = Object.entries(clickMapMetrics)
|
|
1682
1798
|
.map(([hash, info]) => ({
|
|
1683
1799
|
hash,
|
|
1684
|
-
totalclicks: info.
|
|
1800
|
+
totalclicks: info.totalClicked.value ?? 0,
|
|
1685
1801
|
selector: info.selector || '',
|
|
1686
1802
|
}))
|
|
1687
1803
|
.sort((a, b) => b.totalclicks - a.totalclicks)
|
|
@@ -2219,11 +2335,11 @@ const getElementRank = (hash, elements) => {
|
|
|
2219
2335
|
const buildElementInfo = (hash, rect, heatmapInfo) => {
|
|
2220
2336
|
if (!rect || !heatmapInfo)
|
|
2221
2337
|
return null;
|
|
2222
|
-
const info = heatmapInfo.
|
|
2338
|
+
const info = heatmapInfo.clickMapMetrics?.[hash];
|
|
2223
2339
|
if (!info)
|
|
2224
2340
|
return null;
|
|
2225
2341
|
const rank = getElementRank(hash, heatmapInfo.sortedElements);
|
|
2226
|
-
const clicks = info.
|
|
2342
|
+
const clicks = info.totalClicked.value ?? 0;
|
|
2227
2343
|
const selector = info.selector ?? '';
|
|
2228
2344
|
const baseInfo = {
|
|
2229
2345
|
hash,
|
|
@@ -3856,7 +3972,7 @@ const clearCanvas = (canvas) => {
|
|
|
3856
3972
|
};
|
|
3857
3973
|
|
|
3858
3974
|
function validateAreaCreation(dataInfo, hash, areas) {
|
|
3859
|
-
if (!dataInfo?.
|
|
3975
|
+
if (!dataInfo?.clickMapMetrics || !dataInfo?.totalClicks) {
|
|
3860
3976
|
logger$4.warn('Cannot create area: missing heatmap data');
|
|
3861
3977
|
return false;
|
|
3862
3978
|
}
|
|
@@ -4249,7 +4365,7 @@ const useAreaTopAutoDetect = (props) => {
|
|
|
4249
4365
|
useEffect(() => {
|
|
4250
4366
|
if (isInitializing)
|
|
4251
4367
|
return;
|
|
4252
|
-
if (!dataInfo?.
|
|
4368
|
+
if (!dataInfo?.clickMapMetrics || !dataInfo?.totalClicks)
|
|
4253
4369
|
return;
|
|
4254
4370
|
if (!autoCreateTopN)
|
|
4255
4371
|
return;
|
|
@@ -4257,7 +4373,7 @@ const useAreaTopAutoDetect = (props) => {
|
|
|
4257
4373
|
return;
|
|
4258
4374
|
if (areas?.length)
|
|
4259
4375
|
return;
|
|
4260
|
-
const topElements = getTopElementsByClicks(dataInfo.
|
|
4376
|
+
const topElements = getTopElementsByClicks(dataInfo.clickMapMetrics, autoCreateTopN);
|
|
4261
4377
|
const newAreas = [];
|
|
4262
4378
|
topElements.forEach(({ hash }) => {
|
|
4263
4379
|
const element = findElementByHash({ hash, vizRef });
|
|
@@ -4402,11 +4518,11 @@ const useClickedElement = ({ visualRef, getRect }) => {
|
|
|
4402
4518
|
useEffect(() => {
|
|
4403
4519
|
const hash = selectedElement?.hash;
|
|
4404
4520
|
// if (hash === clickedElement?.hash) return;
|
|
4405
|
-
if (!selectedElement || !hash || !dataInfo?.
|
|
4521
|
+
if (!selectedElement || !hash || !dataInfo?.clickMapMetrics) {
|
|
4406
4522
|
reset();
|
|
4407
4523
|
return;
|
|
4408
4524
|
}
|
|
4409
|
-
const info = dataInfo.
|
|
4525
|
+
const info = dataInfo.clickMapMetrics[hash];
|
|
4410
4526
|
if (!info) {
|
|
4411
4527
|
setClickedElement(null);
|
|
4412
4528
|
return;
|
|
@@ -4447,7 +4563,7 @@ const useElementCalloutVisible = ({ visualRef, getRect, positionMode }) => {
|
|
|
4447
4563
|
if (!hash)
|
|
4448
4564
|
return;
|
|
4449
4565
|
const elementIsInViewportFn = () => {
|
|
4450
|
-
const elementInfo = dataInfo?.
|
|
4566
|
+
const elementInfo = dataInfo?.clickMapMetrics?.[hash];
|
|
4451
4567
|
if (!elementInfo)
|
|
4452
4568
|
return;
|
|
4453
4569
|
const rect = getRect({ hash, selector: elementInfo.selector });
|
|
@@ -4660,7 +4776,7 @@ const useHoveredElement = ({ iframeRef, getRect }) => {
|
|
|
4660
4776
|
reset();
|
|
4661
4777
|
return;
|
|
4662
4778
|
}
|
|
4663
|
-
const selector = dataInfo?.
|
|
4779
|
+
const selector = dataInfo?.clickMapMetrics?.[hash];
|
|
4664
4780
|
const rect = getRect({ hash, selector });
|
|
4665
4781
|
const elementInfo = buildElementInfo(hash, rect, dataInfo);
|
|
4666
4782
|
if (!elementInfo) {
|
|
@@ -4725,7 +4841,7 @@ const findTargetElement = (doc, x, y, heatmapInfo) => {
|
|
|
4725
4841
|
for (let i = 0; i < elementsAtPoint.length; i++) {
|
|
4726
4842
|
const element = elementsAtPoint[i];
|
|
4727
4843
|
const elementHash = getElementHash(element) ?? '';
|
|
4728
|
-
const isExistElmInfo = heatmapInfo.
|
|
4844
|
+
const isExistElmInfo = heatmapInfo.clickMapMetrics?.[elementHash];
|
|
4729
4845
|
if (elementHash && isExistElmInfo) {
|
|
4730
4846
|
const boundingBox = getBoundingBox(element);
|
|
4731
4847
|
if (boundingBox) {
|
|
@@ -4744,7 +4860,7 @@ const findTargetElement = (doc, x, y, heatmapInfo) => {
|
|
|
4744
4860
|
return targetElement;
|
|
4745
4861
|
};
|
|
4746
4862
|
const isIframeReady = (iframeRef, heatmapInfo) => {
|
|
4747
|
-
return !!(iframeRef.current?.contentDocument && heatmapInfo?.
|
|
4863
|
+
return !!(iframeRef.current?.contentDocument && heatmapInfo?.clickMapMetrics);
|
|
4748
4864
|
};
|
|
4749
4865
|
const isValidElement = (element, heatmapInfo) => {
|
|
4750
4866
|
if (!element)
|
|
@@ -4752,7 +4868,7 @@ const isValidElement = (element, heatmapInfo) => {
|
|
|
4752
4868
|
const hash = getElementHash(element);
|
|
4753
4869
|
if (!hash)
|
|
4754
4870
|
return false;
|
|
4755
|
-
return !!heatmapInfo?.
|
|
4871
|
+
return !!heatmapInfo?.clickMapMetrics?.[hash];
|
|
4756
4872
|
};
|
|
4757
4873
|
|
|
4758
4874
|
function useIframeHeightProcessor(options) {
|
|
@@ -6644,13 +6760,12 @@ const useObserveIframeHeight = (props) => {
|
|
|
6644
6760
|
return {};
|
|
6645
6761
|
};
|
|
6646
6762
|
|
|
6647
|
-
// Max zoom ratio constant: 100% = fit to width
|
|
6648
|
-
const MAX_ZOOM_RATIO = 200;
|
|
6649
6763
|
const useScaleCalculation = (props) => {
|
|
6650
6764
|
const widthScale = useHeatmapViz((s) => s.widthScale);
|
|
6651
6765
|
const zoomRatio = useHeatmapViz((s) => s.zoomRatio);
|
|
6652
6766
|
const isScaledToFit = useHeatmapViz((s) => s.isScaledToFit);
|
|
6653
6767
|
const minZoomRatio = useHeatmapViz((s) => s.minZoomRatio);
|
|
6768
|
+
const maxZoomRatio = useHeatmapViz((s) => s.maxZoomRatio);
|
|
6654
6769
|
const setScale = useHeatmapViz((s) => s.setScale);
|
|
6655
6770
|
const setIsScaledToFit = useHeatmapViz((s) => s.setIsScaledToFit);
|
|
6656
6771
|
const setMinZoomRatio = useHeatmapViz((s) => s.setMinZoomRatio);
|
|
@@ -6672,9 +6787,9 @@ const useScaleCalculation = (props) => {
|
|
|
6672
6787
|
const calculatedMinZoomRatio = (availableHeight / (contentHeight * widthScale)) * 100;
|
|
6673
6788
|
// Limit minZoomRatio: cannot exceed MAX_ZOOM_RATIO (100%)
|
|
6674
6789
|
// and should have a reasonable minimum (e.g., 1%)
|
|
6675
|
-
const finalMinZoomRatio = Math.max(1, Math.min(calculatedMinZoomRatio,
|
|
6790
|
+
const finalMinZoomRatio = Math.max(1, Math.min(calculatedMinZoomRatio, maxZoomRatio));
|
|
6676
6791
|
// 4. Apply zoom ratio (clamp between min and max)
|
|
6677
|
-
const clampedZoomRatio = Math.max(finalMinZoomRatio, Math.min(zoomRatio,
|
|
6792
|
+
const clampedZoomRatio = Math.max(finalMinZoomRatio, Math.min(zoomRatio, maxZoomRatio));
|
|
6678
6793
|
const zoomMultiplier = clampedZoomRatio / 100;
|
|
6679
6794
|
// 5. Calculate finalScale
|
|
6680
6795
|
// finalScale = widthScale * zoomMultiplier
|
|
@@ -6688,7 +6803,7 @@ const useScaleCalculation = (props) => {
|
|
|
6688
6803
|
setIsScaledToFit(isCurrentlyFitted);
|
|
6689
6804
|
setMinZoomRatio(finalMinZoomRatio);
|
|
6690
6805
|
}
|
|
6691
|
-
}, [containerWidth, containerHeight, contentWidth, contentHeight, zoomRatio]);
|
|
6806
|
+
}, [containerWidth, containerHeight, contentWidth, contentHeight, zoomRatio, maxZoomRatio]);
|
|
6692
6807
|
useEffect(() => {
|
|
6693
6808
|
calculateScaleResult();
|
|
6694
6809
|
}, [calculateScaleResult]);
|
|
@@ -8633,4 +8748,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
|
|
|
8633
8748
|
}
|
|
8634
8749
|
};
|
|
8635
8750
|
|
|
8636
|
-
export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, ELM_CALLOUT_CONFIG, GraphView, HEATMAP_CONFIG, HEATMAP_IFRAME, HEATMAP_STYLE, HeatmapLayout, IClickMode, 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, useHeatmapViz, useHeatmapVizRect, useHoveredElement, useIframeHeight, useIframeHeightProcessor, useMeasureFunction, useRegisterConfig, useRegisterControl, useRegisterData, useRegisterHeatmap, useRenderCount, useScrollmapZones, useTrackHookCall, useViewIdContext, useVizLiveRender, useWhyDidYouUpdate, useWrapperRefHeight, useZonePositions, withPerformanceTracking };
|
|
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 };
|