elseware-ui 2.40.0 → 2.40.2
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/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +31 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -29584,7 +29584,7 @@ var CookieBanner = ({
|
|
|
29584
29584
|
] })
|
|
29585
29585
|
}
|
|
29586
29586
|
),
|
|
29587
|
-
/* @__PURE__ */ jsx(
|
|
29587
|
+
preferencesOpen ? /* @__PURE__ */ jsx(
|
|
29588
29588
|
CookiePreferencesModal_default,
|
|
29589
29589
|
{
|
|
29590
29590
|
open: preferencesOpen,
|
|
@@ -29595,7 +29595,7 @@ var CookieBanner = ({
|
|
|
29595
29595
|
save: labels?.save
|
|
29596
29596
|
}
|
|
29597
29597
|
}
|
|
29598
|
-
)
|
|
29598
|
+
) : null
|
|
29599
29599
|
] });
|
|
29600
29600
|
};
|
|
29601
29601
|
var usePageTracking = ({
|
|
@@ -29604,17 +29604,29 @@ var usePageTracking = ({
|
|
|
29604
29604
|
title,
|
|
29605
29605
|
fullUrl,
|
|
29606
29606
|
metadata,
|
|
29607
|
-
enabled = true
|
|
29607
|
+
enabled = true,
|
|
29608
|
+
trackPageLeave = false,
|
|
29609
|
+
dedupe = true
|
|
29608
29610
|
}) => {
|
|
29609
29611
|
const { track } = useAnalytics();
|
|
29612
|
+
const trackRef = useRef(track);
|
|
29610
29613
|
const enteredAtRef = useRef(Date.now());
|
|
29611
29614
|
const previousPathRef = useRef(null);
|
|
29615
|
+
const trackedPathsRef = useRef(/* @__PURE__ */ new Set());
|
|
29616
|
+
useEffect(() => {
|
|
29617
|
+
trackRef.current = track;
|
|
29618
|
+
}, [track]);
|
|
29619
|
+
const metadataKey = useMemo(() => JSON.stringify(metadata ?? {}), [metadata]);
|
|
29612
29620
|
useEffect(() => {
|
|
29613
29621
|
if (!enabled) return;
|
|
29614
29622
|
const nextPath = `${path2}${search3}`;
|
|
29615
|
-
if (
|
|
29623
|
+
if (!nextPath) return;
|
|
29624
|
+
if (dedupe && trackedPathsRef.current.has(nextPath)) {
|
|
29625
|
+
return;
|
|
29626
|
+
}
|
|
29627
|
+
if (trackPageLeave && previousPathRef.current) {
|
|
29616
29628
|
const durationMs = Date.now() - enteredAtRef.current;
|
|
29617
|
-
|
|
29629
|
+
trackRef.current("page_leave", {
|
|
29618
29630
|
path: previousPathRef.current,
|
|
29619
29631
|
durationMs,
|
|
29620
29632
|
metadata
|
|
@@ -29622,21 +29634,32 @@ var usePageTracking = ({
|
|
|
29622
29634
|
}
|
|
29623
29635
|
enteredAtRef.current = Date.now();
|
|
29624
29636
|
previousPathRef.current = nextPath;
|
|
29625
|
-
|
|
29637
|
+
trackedPathsRef.current.add(nextPath);
|
|
29638
|
+
trackRef.current("page_view", {
|
|
29626
29639
|
path: nextPath,
|
|
29627
29640
|
title,
|
|
29628
29641
|
fullUrl,
|
|
29629
29642
|
metadata
|
|
29630
29643
|
});
|
|
29631
29644
|
return () => {
|
|
29645
|
+
if (!trackPageLeave) return;
|
|
29632
29646
|
const durationMs = Date.now() - enteredAtRef.current;
|
|
29633
|
-
|
|
29647
|
+
trackRef.current("page_leave", {
|
|
29634
29648
|
path: nextPath,
|
|
29635
29649
|
durationMs,
|
|
29636
29650
|
metadata
|
|
29637
29651
|
});
|
|
29638
29652
|
};
|
|
29639
|
-
}, [
|
|
29653
|
+
}, [
|
|
29654
|
+
dedupe,
|
|
29655
|
+
enabled,
|
|
29656
|
+
fullUrl,
|
|
29657
|
+
metadataKey,
|
|
29658
|
+
path2,
|
|
29659
|
+
search3,
|
|
29660
|
+
title,
|
|
29661
|
+
trackPageLeave
|
|
29662
|
+
]);
|
|
29640
29663
|
};
|
|
29641
29664
|
var useSessionTracking = ({
|
|
29642
29665
|
enabled = true,
|