From 747cf72f361e2741103129f24d4c4959fd76220d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Ta=C3=AFeb?= Date: Mon, 13 Jan 2025 18:27:45 +0100 Subject: [PATCH 1/2] fix: remove hubspot cookie when logging out --- src/app/(auth)/logout/page.tsx | 2 ++ src/components/hubspot/track-hubspot.tsx | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/(auth)/logout/page.tsx b/src/app/(auth)/logout/page.tsx index 4fb0f4c5..3cac39d5 100644 --- a/src/app/(auth)/logout/page.tsx +++ b/src/app/(auth)/logout/page.tsx @@ -2,12 +2,14 @@ import { signOut, useSession } from "next-auth/react"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import { removeHubspotCookies } from "@/src/components/hubspot/track-hubspot"; export default function Logout() { const router = useRouter(); const session = useSession(); useEffect(() => { if (session.data) { + removeHubspotCookies(); const callbackUrl = `/logout/agentconnect?id_token_hint=${session.data?.id_token}`; signOut({ redirect: false, callbackUrl }).then((signOutResponse) => router.push(signOutResponse.url)); } diff --git a/src/components/hubspot/track-hubspot.tsx b/src/components/hubspot/track-hubspot.tsx index 9776ea72..9e0ad70d 100644 --- a/src/components/hubspot/track-hubspot.tsx +++ b/src/components/hubspot/track-hubspot.tsx @@ -12,15 +12,19 @@ export const trackUserWithEmail = (path: string, email?: string | null) => { } }; +export const removeHubspotCookies = () => { + const hubspotCookies = ["__hssc", "__hssrc", "__hs_do_not_track", "__hstc", "hubspotutk", "messagesUtk"]; + hubspotCookies.forEach((cookieName) => { + document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;`; + }); +}; + export const declineHubspotCookie = () => { if (!enableHubspotTracking) { console.debug("declineHubspotCookie"); return; } - const hubspotCookies = ["__hssc", "__hssrc", "__hs_do_not_track", "__hstc", "hubspotutk", "messagesUtk"]; - hubspotCookies.forEach((cookieName) => { - document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;`; - }); + removeHubspotCookies(); window?._hsq?.push(["doNotTrack"]); window?._hsp?.push(["revokeCookieConsent"]); }; From e87060c8617e3ab155201c7b95369e64ab03f3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Ta=C3=AFeb?= Date: Tue, 14 Jan 2025 10:09:18 +0100 Subject: [PATCH 2/2] chore: deduplicate form ids --- .../partage/partage-member-modification-role-modale.tsx | 2 +- src/forms/contact/contact-form.tsx | 2 +- src/forms/estimation/EstimationInfoForm.tsx | 2 +- .../estimation/estimation-materiau-form-simple-field.tsx | 5 ++++- src/forms/projet/ProjetInfoForm.tsx | 2 +- src/forms/user/UserInfoForm.tsx | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/partage/partage-member-modification-role-modale.tsx b/src/components/partage/partage-member-modification-role-modale.tsx index 52d7412e..58d36340 100644 --- a/src/components/partage/partage-member-modification-role-modale.tsx +++ b/src/components/partage/partage-member-modification-role-modale.tsx @@ -75,7 +75,7 @@ export const PartageMemberModificationRoleModale = () => { {currentUserModification ? ( <>

Modifier les informations {"d'un membre"}

-
+ { !form.watch("objetMessage") || !form.watch("email"); return ( - + diff --git a/src/forms/estimation/EstimationInfoForm.tsx b/src/forms/estimation/EstimationInfoForm.tsx index db60d3da..5a543d0f 100644 --- a/src/forms/estimation/EstimationInfoForm.tsx +++ b/src/forms/estimation/EstimationInfoForm.tsx @@ -59,7 +59,7 @@ export const EstimationInfoForm = ({ projet }: { projet: ProjetWithRelations; es const { error } = form.getFieldState("ficheSolutionIds"); return ( - + - onSubmit(data))}> + onSubmit(data))} + > { return ( <> - + +