-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dsfr): ajout d'un detecteur d'adblock pour éviter qu'un usager p…
…artage un message dans le vide (#6226) * fix: bug * fix(adblock): utilisation de l'url de matomo au lieu de celle d'un provider de pub pour éviter de modifier les CSP (#6227)
- Loading branch information
Showing
3 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
packages/code-du-travail-frontend/src/modules/layout/feedback/AdBlockDetector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { PIWIK_URL } from "../../../config"; | ||
|
||
export const detectAdBlockCall = async (): Promise<boolean> => { | ||
return fetch(PIWIK_URL, { | ||
method: "HEAD", | ||
mode: "no-cors", | ||
cache: "no-store", | ||
}) | ||
.then(({ redirected }) => { | ||
return redirected; | ||
}) | ||
.catch(() => { | ||
return true; | ||
}); | ||
}; |
15 changes: 15 additions & 0 deletions
15
packages/code-du-travail-frontend/src/modules/layout/feedback/FeedbackAdblock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { fr } from "@codegouvfr/react-dsfr"; | ||
|
||
export const FeedbackAdblock = () => { | ||
return ( | ||
<> | ||
<h2 className={fr.cx("fr-h5")}> | ||
Nous n'avons pas pu envoyer votre réponse | ||
</h2> | ||
<p> | ||
Pour soumettre votre avis, merci de désactiver temporairement votre | ||
bloqueur de publicité et recharger la page. | ||
</p> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters