diff --git a/site/source/components/Feedback/index.tsx b/site/source/components/Feedback/index.tsx index 01f10d984..37c38de97 100644 --- a/site/source/components/Feedback/index.tsx +++ b/site/source/components/Feedback/index.tsx @@ -14,7 +14,7 @@ import { H4 } from '@/design-system/typography/heading' import { StyledLink } from '@/design-system/typography/link' import { Body } from '@/design-system/typography/paragraphs' import { useOnClickOutside } from '@/hooks/useClickOutside' -import { CurrentSimulatorDataContext } from '@/pages/Simulateurs/metadata' +import { useSitePaths } from '@/sitePaths' import * as safeLocalStorage from '../../storage/safeLocalStorage' import { JeDonneMonAvis } from '../JeDonneMonAvis' @@ -44,6 +44,8 @@ const getShouldAskFeedback = (url: string) => { ) } +const IFRAME_SIMULATEUR_EMBAUCHE_PATH = '/iframes/simulateur-embauche' + const FeedbackButton = ({ isEmbedded }: { isEmbedded?: boolean }) => { const [isFormOpen, setIsFormOpen] = useState(false) const [isShowingThankMessage, setIsShowingThankMessage] = useState(false) @@ -53,7 +55,12 @@ const FeedbackButton = ({ isEmbedded }: { isEmbedded?: boolean }) => { const url = useLocation().pathname const tag = useContext(TrackingContext) const containerRef = useRef(null) - const currentSimulatorData = useContext(CurrentSimulatorDataContext) + + const { absoluteSitePaths } = useSitePaths() + const currentPath = useLocation().pathname + const isSimulateurSalaire = + currentPath.includes(absoluteSitePaths.simulateurs.salariƩ) || + currentPath.includes(IFRAME_SIMULATEUR_EMBAUCHE_PATH) const { shouldShowRater, customTitle } = useFeedback() @@ -146,8 +153,8 @@ const FeedbackButton = ({ isEmbedded }: { isEmbedded?: boolean }) => { )} - {currentSimulatorData?.pathId === 'simulateurs.salariƩ' ? ( - + {isSimulateurSalaire ? ( + ) : (