Skip to content

Commit 406cc7b

Browse files
authored
feat: do not display NPS on empty itineraries (#898)
1 parent 927360a commit 406cc7b

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/components/nps/NPS.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ const getTimeout = (
3838
// L'utilisateur n'a pas encore engagé avec l'outil, timeout en fonction de l'outil
3939
const tabs = params.get('tabs')
4040
if (tabs === 'itineraire') {
41-
return 15000
41+
return null
4242
} else if (tabs === 'distance') {
4343
return 45000
4444
}
4545

4646
if (pathname.includes('itineraire')) {
47-
return 15000
47+
return null
4848
}
4949

5050
return 45000
@@ -165,10 +165,12 @@ const NPS = ({ tracking }: { tracking: string }) => {
165165
}
166166

167167
const timeout = getTimeout(window.location.pathname, searchParams, { km, start, end })
168-
timeoutRef.current = setTimeout(() => {
169-
localStorage.setItem(NPS_SEEN_STORAGE_KEY, Date.now().toString())
170-
setDisplay(true)
171-
}, timeout)
168+
if (timeout !== null) {
169+
timeoutRef.current = setTimeout(() => {
170+
localStorage.setItem(NPS_SEEN_STORAGE_KEY, Date.now().toString())
171+
setDisplay(true)
172+
}, timeout)
173+
}
172174

173175
return () => {
174176
if (timeoutRef.current) {

0 commit comments

Comments
 (0)