@gemx-dev/heatmap-react 3.5.61 → 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/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/viz-elm/useHeatmapElementPosition.d.ts +2 -2
- package/dist/esm/hooks/viz-elm/useHeatmapElementPosition.d.ts.map +1 -1
- package/dist/esm/index.js +129 -27
- package/dist/esm/index.mjs +129 -27
- 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/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/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/viz-elm/useHeatmapElementPosition.d.ts +2 -2
- package/dist/umd/hooks/viz-elm/useHeatmapElementPosition.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/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,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"}
|
|
@@ -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"}
|
package/dist/esm/index.js
CHANGED
|
@@ -186,6 +186,15 @@ var IClickType;
|
|
|
186
186
|
IClickType["First"] = "first-clicks";
|
|
187
187
|
IClickType["Last"] = "last-clicks";
|
|
188
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 = {}));
|
|
189
198
|
var IClickMode;
|
|
190
199
|
(function (IClickMode) {
|
|
191
200
|
IClickMode["Default"] = "default";
|
|
@@ -259,6 +268,16 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
259
268
|
newScrollmap.set(viewId, scrollmap);
|
|
260
269
|
return { scrollmap: newScrollmap };
|
|
261
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
|
+
}),
|
|
262
281
|
copyView: (fromViewId, toViewId) => set((prev) => {
|
|
263
282
|
const newData = new Map(prev.data);
|
|
264
283
|
const newClickmap = new Map(prev.clickmap);
|
|
@@ -307,6 +326,60 @@ const useHeatmapDataStore = create()(subscribeWithSelector((set) => {
|
|
|
307
326
|
};
|
|
308
327
|
}));
|
|
309
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
|
+
|
|
310
383
|
const useHeatmapVizStore = create()(subscribeWithSelector((set) => {
|
|
311
384
|
return {
|
|
312
385
|
isRenderViz: new Map([[DEFAULT_VIEW_ID, false]]),
|
|
@@ -1043,9 +1116,6 @@ const useHeatmapClick = createViewContextHook({
|
|
|
1043
1116
|
}),
|
|
1044
1117
|
});
|
|
1045
1118
|
|
|
1046
|
-
// ===========================
|
|
1047
|
-
// Hook
|
|
1048
|
-
// ===========================
|
|
1049
1119
|
/**
|
|
1050
1120
|
* Hook to access heatmap data state and actions with optional selector
|
|
1051
1121
|
*
|
|
@@ -1075,6 +1145,7 @@ const useHeatmapData = createViewContextHook({
|
|
|
1075
1145
|
setData: (newData) => store.setData(newData, viewId),
|
|
1076
1146
|
setClickmap: (newClickmap) => store.setClickmap(newClickmap, viewId),
|
|
1077
1147
|
setClickAreas: (newClickAreas) => store.setClickAreas(newClickAreas, viewId),
|
|
1148
|
+
setDataInfoByKey: (key, value) => store.setDataInfoByKey(key, value, viewId),
|
|
1078
1149
|
setScrollmap: (newScrollmap) => store.setScrollmap(newScrollmap, viewId),
|
|
1079
1150
|
setDataInfo: (newDataInfo) => store.setDataInfo(newDataInfo, viewId),
|
|
1080
1151
|
removeClickArea: (areaId) => store.removeClickArea(areaId, viewId),
|
|
@@ -1139,6 +1210,37 @@ const useHeatmapScroll = createViewContextHook({
|
|
|
1139
1210
|
}),
|
|
1140
1211
|
});
|
|
1141
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
|
+
|
|
1142
1244
|
// ===========================
|
|
1143
1245
|
// Hook
|
|
1144
1246
|
// ===========================
|
|
@@ -1631,31 +1733,31 @@ function getElementSelector(element) {
|
|
|
1631
1733
|
* @param elementMapInfo - Map of hash to element click info
|
|
1632
1734
|
* @returns Total clicks for element + all descendants
|
|
1633
1735
|
*/
|
|
1634
|
-
function calculateTotalClicksWithChildren(element,
|
|
1736
|
+
function calculateTotalClicksWithChildren(element, clickMapMetrics) {
|
|
1635
1737
|
let totalClicks = 0;
|
|
1636
1738
|
// Get clicks for the element itself
|
|
1637
1739
|
const elementHash = getElementHash(element);
|
|
1638
1740
|
if (elementHash) {
|
|
1639
|
-
const elementInfo =
|
|
1640
|
-
totalClicks += elementInfo?.
|
|
1741
|
+
const elementInfo = clickMapMetrics[elementHash];
|
|
1742
|
+
totalClicks += elementInfo?.totalClicked.value ?? 0;
|
|
1641
1743
|
}
|
|
1642
1744
|
const children = element.querySelectorAll('*');
|
|
1643
1745
|
children.forEach((child) => {
|
|
1644
1746
|
const childHash = getElementHash(child);
|
|
1645
1747
|
if (childHash) {
|
|
1646
|
-
const childInfo =
|
|
1647
|
-
totalClicks += childInfo?.
|
|
1748
|
+
const childInfo = clickMapMetrics[childHash];
|
|
1749
|
+
totalClicks += childInfo?.totalClicked.value ?? 0;
|
|
1648
1750
|
}
|
|
1649
1751
|
});
|
|
1650
1752
|
return totalClicks;
|
|
1651
1753
|
}
|
|
1652
1754
|
function buildAreaNode(element, hash, heatmapInfo, shadowRoot, persistedData) {
|
|
1653
|
-
if (!heatmapInfo.
|
|
1755
|
+
if (!heatmapInfo.clickMapMetrics)
|
|
1654
1756
|
return;
|
|
1655
1757
|
const totalClicks = heatmapInfo.totalClicks || 0;
|
|
1656
|
-
const elementInfo = heatmapInfo.
|
|
1758
|
+
const elementInfo = heatmapInfo.clickMapMetrics[hash];
|
|
1657
1759
|
// Calculate total clicks including all child elements
|
|
1658
|
-
const elementClicks = calculateTotalClicksWithChildren(element, heatmapInfo.
|
|
1760
|
+
const elementClicks = calculateTotalClicksWithChildren(element, heatmapInfo.clickMapMetrics);
|
|
1659
1761
|
const clickDist = calculateClickDistribution(elementClicks, totalClicks);
|
|
1660
1762
|
const rect = getElementRect(element);
|
|
1661
1763
|
const color = getColorFromClickDist(clickDist);
|
|
@@ -1691,11 +1793,11 @@ function buildAreaNode(element, hash, heatmapInfo, shadowRoot, persistedData) {
|
|
|
1691
1793
|
};
|
|
1692
1794
|
return areaNode;
|
|
1693
1795
|
}
|
|
1694
|
-
function getTopElementsByClicks(
|
|
1695
|
-
const elements = Object.entries(
|
|
1796
|
+
function getTopElementsByClicks(clickMapMetrics, topN = 10) {
|
|
1797
|
+
const elements = Object.entries(clickMapMetrics)
|
|
1696
1798
|
.map(([hash, info]) => ({
|
|
1697
1799
|
hash,
|
|
1698
|
-
totalclicks: info.
|
|
1800
|
+
totalclicks: info.totalClicked.value ?? 0,
|
|
1699
1801
|
selector: info.selector || '',
|
|
1700
1802
|
}))
|
|
1701
1803
|
.sort((a, b) => b.totalclicks - a.totalclicks)
|
|
@@ -2233,11 +2335,11 @@ const getElementRank = (hash, elements) => {
|
|
|
2233
2335
|
const buildElementInfo = (hash, rect, heatmapInfo) => {
|
|
2234
2336
|
if (!rect || !heatmapInfo)
|
|
2235
2337
|
return null;
|
|
2236
|
-
const info = heatmapInfo.
|
|
2338
|
+
const info = heatmapInfo.clickMapMetrics?.[hash];
|
|
2237
2339
|
if (!info)
|
|
2238
2340
|
return null;
|
|
2239
2341
|
const rank = getElementRank(hash, heatmapInfo.sortedElements);
|
|
2240
|
-
const clicks = info.
|
|
2342
|
+
const clicks = info.totalClicked.value ?? 0;
|
|
2241
2343
|
const selector = info.selector ?? '';
|
|
2242
2344
|
const baseInfo = {
|
|
2243
2345
|
hash,
|
|
@@ -3870,7 +3972,7 @@ const clearCanvas = (canvas) => {
|
|
|
3870
3972
|
};
|
|
3871
3973
|
|
|
3872
3974
|
function validateAreaCreation(dataInfo, hash, areas) {
|
|
3873
|
-
if (!dataInfo?.
|
|
3975
|
+
if (!dataInfo?.clickMapMetrics || !dataInfo?.totalClicks) {
|
|
3874
3976
|
logger$4.warn('Cannot create area: missing heatmap data');
|
|
3875
3977
|
return false;
|
|
3876
3978
|
}
|
|
@@ -4263,7 +4365,7 @@ const useAreaTopAutoDetect = (props) => {
|
|
|
4263
4365
|
useEffect(() => {
|
|
4264
4366
|
if (isInitializing)
|
|
4265
4367
|
return;
|
|
4266
|
-
if (!dataInfo?.
|
|
4368
|
+
if (!dataInfo?.clickMapMetrics || !dataInfo?.totalClicks)
|
|
4267
4369
|
return;
|
|
4268
4370
|
if (!autoCreateTopN)
|
|
4269
4371
|
return;
|
|
@@ -4271,7 +4373,7 @@ const useAreaTopAutoDetect = (props) => {
|
|
|
4271
4373
|
return;
|
|
4272
4374
|
if (areas?.length)
|
|
4273
4375
|
return;
|
|
4274
|
-
const topElements = getTopElementsByClicks(dataInfo.
|
|
4376
|
+
const topElements = getTopElementsByClicks(dataInfo.clickMapMetrics, autoCreateTopN);
|
|
4275
4377
|
const newAreas = [];
|
|
4276
4378
|
topElements.forEach(({ hash }) => {
|
|
4277
4379
|
const element = findElementByHash({ hash, vizRef });
|
|
@@ -4416,11 +4518,11 @@ const useClickedElement = ({ visualRef, getRect }) => {
|
|
|
4416
4518
|
useEffect(() => {
|
|
4417
4519
|
const hash = selectedElement?.hash;
|
|
4418
4520
|
// if (hash === clickedElement?.hash) return;
|
|
4419
|
-
if (!selectedElement || !hash || !dataInfo?.
|
|
4521
|
+
if (!selectedElement || !hash || !dataInfo?.clickMapMetrics) {
|
|
4420
4522
|
reset();
|
|
4421
4523
|
return;
|
|
4422
4524
|
}
|
|
4423
|
-
const info = dataInfo.
|
|
4525
|
+
const info = dataInfo.clickMapMetrics[hash];
|
|
4424
4526
|
if (!info) {
|
|
4425
4527
|
setClickedElement(null);
|
|
4426
4528
|
return;
|
|
@@ -4461,7 +4563,7 @@ const useElementCalloutVisible = ({ visualRef, getRect, positionMode }) => {
|
|
|
4461
4563
|
if (!hash)
|
|
4462
4564
|
return;
|
|
4463
4565
|
const elementIsInViewportFn = () => {
|
|
4464
|
-
const elementInfo = dataInfo?.
|
|
4566
|
+
const elementInfo = dataInfo?.clickMapMetrics?.[hash];
|
|
4465
4567
|
if (!elementInfo)
|
|
4466
4568
|
return;
|
|
4467
4569
|
const rect = getRect({ hash, selector: elementInfo.selector });
|
|
@@ -4674,7 +4776,7 @@ const useHoveredElement = ({ iframeRef, getRect }) => {
|
|
|
4674
4776
|
reset();
|
|
4675
4777
|
return;
|
|
4676
4778
|
}
|
|
4677
|
-
const selector = dataInfo?.
|
|
4779
|
+
const selector = dataInfo?.clickMapMetrics?.[hash];
|
|
4678
4780
|
const rect = getRect({ hash, selector });
|
|
4679
4781
|
const elementInfo = buildElementInfo(hash, rect, dataInfo);
|
|
4680
4782
|
if (!elementInfo) {
|
|
@@ -4739,7 +4841,7 @@ const findTargetElement = (doc, x, y, heatmapInfo) => {
|
|
|
4739
4841
|
for (let i = 0; i < elementsAtPoint.length; i++) {
|
|
4740
4842
|
const element = elementsAtPoint[i];
|
|
4741
4843
|
const elementHash = getElementHash(element) ?? '';
|
|
4742
|
-
const isExistElmInfo = heatmapInfo.
|
|
4844
|
+
const isExistElmInfo = heatmapInfo.clickMapMetrics?.[elementHash];
|
|
4743
4845
|
if (elementHash && isExistElmInfo) {
|
|
4744
4846
|
const boundingBox = getBoundingBox(element);
|
|
4745
4847
|
if (boundingBox) {
|
|
@@ -4758,7 +4860,7 @@ const findTargetElement = (doc, x, y, heatmapInfo) => {
|
|
|
4758
4860
|
return targetElement;
|
|
4759
4861
|
};
|
|
4760
4862
|
const isIframeReady = (iframeRef, heatmapInfo) => {
|
|
4761
|
-
return !!(iframeRef.current?.contentDocument && heatmapInfo?.
|
|
4863
|
+
return !!(iframeRef.current?.contentDocument && heatmapInfo?.clickMapMetrics);
|
|
4762
4864
|
};
|
|
4763
4865
|
const isValidElement = (element, heatmapInfo) => {
|
|
4764
4866
|
if (!element)
|
|
@@ -4766,7 +4868,7 @@ const isValidElement = (element, heatmapInfo) => {
|
|
|
4766
4868
|
const hash = getElementHash(element);
|
|
4767
4869
|
if (!hash)
|
|
4768
4870
|
return false;
|
|
4769
|
-
return !!heatmapInfo?.
|
|
4871
|
+
return !!heatmapInfo?.clickMapMetrics?.[hash];
|
|
4770
4872
|
};
|
|
4771
4873
|
|
|
4772
4874
|
function useIframeHeightProcessor(options) {
|
|
@@ -8646,4 +8748,4 @@ const HeatmapLayout = ({ data, clickmap, clickAreas, scrollmap, controls, dataIn
|
|
|
8646
8748
|
}
|
|
8647
8749
|
};
|
|
8648
8750
|
|
|
8649
|
-
export { BACKDROP_CONFIG, DEFAULT_SIDEBAR_WIDTH, DEFAULT_VIEW_ID, DEFAULT_ZOOM_RATIO, 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 };
|