@folklore/tracking
Advanced tools
Comparing version 0.0.26 to 0.0.27
@@ -208,2 +208,3 @@ 'use strict'; | ||
thumbnail = null, | ||
disabled = false, | ||
progressSteps = [0.1, 0.25, 0.5, 0.75, 0.9, 1.0], | ||
@@ -239,3 +240,3 @@ onProgress = null | ||
React.useEffect(() => { | ||
if (playing) { | ||
if (playing && !disabled) { | ||
tracking.trackVideo('play', getVideoMetadata({ | ||
@@ -245,5 +246,5 @@ currentTime | ||
} | ||
}, [playing]); | ||
}, [playing, disabled]); | ||
React.useEffect(() => { | ||
if (paused) { | ||
if (paused && !disabled) { | ||
tracking.trackVideo('pause', getVideoMetadata({ | ||
@@ -253,5 +254,5 @@ currentTime | ||
} | ||
}, [paused]); | ||
}, [paused, disabled]); | ||
React.useEffect(() => { | ||
if (ended) { | ||
if (ended && !disabled) { | ||
tracking.trackVideo('end', getVideoMetadata({ | ||
@@ -261,5 +262,5 @@ currentTime | ||
} | ||
}, [ended]); | ||
}, [ended, disabled]); | ||
React.useEffect(() => { | ||
if (currentTime === null || currentTime <= 0 || duration === null || duration <= 0 || progressSteps === null || progressSteps.length === 0) { | ||
if (currentTime === null || currentTime <= 0 || duration === null || duration <= 0 || progressSteps === null || progressSteps.length === 0 || disabled) { | ||
return; | ||
@@ -296,3 +297,3 @@ } | ||
} | ||
}, [currentTime, progressTrackedRef.current, id, onProgress]); | ||
}, [currentTime, progressTrackedRef.current, id, onProgress, disabled]); | ||
} | ||
@@ -299,0 +300,0 @@ |
@@ -204,2 +204,3 @@ import { v4 } from 'uuid'; | ||
thumbnail = null, | ||
disabled = false, | ||
progressSteps = [0.1, 0.25, 0.5, 0.75, 0.9, 1.0], | ||
@@ -235,3 +236,3 @@ onProgress = null | ||
useEffect(() => { | ||
if (playing) { | ||
if (playing && !disabled) { | ||
tracking.trackVideo('play', getVideoMetadata({ | ||
@@ -241,5 +242,5 @@ currentTime | ||
} | ||
}, [playing]); | ||
}, [playing, disabled]); | ||
useEffect(() => { | ||
if (paused) { | ||
if (paused && !disabled) { | ||
tracking.trackVideo('pause', getVideoMetadata({ | ||
@@ -249,5 +250,5 @@ currentTime | ||
} | ||
}, [paused]); | ||
}, [paused, disabled]); | ||
useEffect(() => { | ||
if (ended) { | ||
if (ended && !disabled) { | ||
tracking.trackVideo('end', getVideoMetadata({ | ||
@@ -257,5 +258,5 @@ currentTime | ||
} | ||
}, [ended]); | ||
}, [ended, disabled]); | ||
useEffect(() => { | ||
if (currentTime === null || currentTime <= 0 || duration === null || duration <= 0 || progressSteps === null || progressSteps.length === 0) { | ||
if (currentTime === null || currentTime <= 0 || duration === null || duration <= 0 || progressSteps === null || progressSteps.length === 0 || disabled) { | ||
return; | ||
@@ -292,5 +293,5 @@ } | ||
} | ||
}, [currentTime, progressTrackedRef.current, id, onProgress]); | ||
}, [currentTime, progressTrackedRef.current, id, onProgress, disabled]); | ||
} | ||
export { Tracking, TrackingContainer, TrackingContext, Tracking as default, useTracking, useVideoTracking, withTracking }; |
{ | ||
"name": "@folklore/tracking", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "Tracking utilities", | ||
@@ -54,3 +54,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "c13ef70b8126b3182b3e3365f34f9231fa9b1535" | ||
"gitHead": "c5d9aae3c1f05816f88201d46acd507f601652a8" | ||
} |
18160
576