Skip to content

Commit

Permalink
Merge branch 'main' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
rtaieb committed Jan 14, 2025
2 parents 1cc5c8f + fff519f commit 2a73395
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 83 deletions.
79 changes: 8 additions & 71 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/app/(auth)/logout/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
12 changes: 8 additions & 4 deletions src/components/hubspot/track-hubspot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const PartageMemberModificationRoleModale = () => {
{currentUserModification ? (
<>
<h2 className="mb-8 text-[22px] leading-7 text-pfmv-navy">Modifier les informations {"d'un membre"}</h2>
<form id="user-partage-modification" onSubmit={form.handleSubmit(onSubmit)}>
<form id="user-partage-modification-form" onSubmit={form.handleSubmit(onSubmit)}>
<Input
label=""
disabled
Expand Down
2 changes: 1 addition & 1 deletion src/forms/contact/contact-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const ContactForm = () => {
!form.watch("objetMessage") ||
!form.watch("email");
return (
<form id="user-info" onSubmit={form.handleSubmit(onSubmit)}>
<form id="contact-form" onSubmit={form.handleSubmit(onSubmit)}>
<InputFormField control={form.control} path="prenom" label="Votre prénom" asterisk={true} />
<InputFormField control={form.control} path="nom" label="Votre nom" asterisk={true} />
<InputFormField control={form.control} path="email" label="Votre adresse email" asterisk={true} />
Expand Down
2 changes: 1 addition & 1 deletion src/forms/estimation/EstimationInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const EstimationInfoForm = ({ projet }: { projet: ProjetWithRelations; es
const { error } = form.getFieldState("ficheSolutionIds");

return (
<form id="create-estimation" onSubmit={form.handleSubmit(onSubmit)}>
<form id="create-estimation-form" onSubmit={form.handleSubmit(onSubmit)}>
<FicheSolutionSmallCardContainer
title=""
subtitle="Choisissez les solutions à estimer pour votre simulation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export default function EstimationMateriauSimpleFieldForm({

return (
<>
<form id={`estimation-fiche-solution-${ficheSolution.id}`} onSubmit={form.handleSubmit((data) => onSubmit(data))}>
<form
id={`estimation-fiche-solution-${ficheSolution.id}-form`}
onSubmit={form.handleSubmit((data) => onSubmit(data))}
>
<EstimationMateriauFieldUnique ficheSolutionAttributes={ficheSolution.attributes}>
<InputFormField
label={getUniteCoutFromCode(ficheSolution.attributes.cout_unite).estimationLabel}
Expand Down
6 changes: 3 additions & 3 deletions src/forms/projet/ProjetInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const ProjetInfoForm = ({ projet, readOnly }: ProjetInfoFormProps) => {
defaultValues: {
adresse: mapDBProjetToProjetAddress(projet),
collectivite: mapDBCollectiviteToCollectiviteAddress(projet?.collectivite) ?? undefined,
isPublic: projet?.is_public ?? false,
isPublic: projet?.is_public ?? true,
},
});

Expand All @@ -47,7 +47,7 @@ export const ProjetInfoForm = ({ projet, readOnly }: ProjetInfoFormProps) => {
adresse: mapDBProjetToProjetAddress(projet),
dateEcheance: monthDateToString(projet?.date_echeance),
collectivite: mapDBCollectiviteToCollectiviteAddress(projet?.collectivite) ?? undefined,
isPublic: projet?.is_public ?? false,
isPublic: projet?.is_public ?? true,
});
}, [form, projet]);

Expand All @@ -71,7 +71,7 @@ export const ProjetInfoForm = ({ projet, readOnly }: ProjetInfoFormProps) => {

return (
<>
<form id="user-info" onSubmit={form.handleSubmit(onSubmit)}>
<form id="projet-info-form" onSubmit={form.handleSubmit(onSubmit)}>
<InputFormField control={form.control} path="nom" label="Nom du projet" asterisk={true} disabled={disabled} />
<SelectFormField
control={form.control}
Expand Down
2 changes: 1 addition & 1 deletion src/forms/user/UserInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const UserInfoForm = ({
const watchCanalAcquisition = form.watch("canalAcquisition");

return (
<form id="user-info" onSubmit={form.handleSubmit(onSubmit)}>
<form id="user-info-form" onSubmit={form.handleSubmit(onSubmit)}>
<InputFormField control={form.control} path="nom" label="Nom" asterisk={true} />
<InputFormField control={form.control} path="prenom" label="Prénom" asterisk={true} />
<InputFormField control={form.control} path="email" label="Email" asterisk={true} disabled={!!user.email} />
Expand Down

0 comments on commit 2a73395

Please sign in to comment.