Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgfr committed Oct 17, 2024
1 parent 93a9027 commit f15a2fc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/code-du-travail-frontend/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function middleware(request) {
process.env.NEXT_PUBLIC_APP_ENV !== "production" && "'unsafe-eval'"
};
frame-src 'self' https://mon-entreprise.urssaf.fr https://matomo.fabrique.social.gouv.fr *.dailymotion.com;
connect-src 'self' https://geo.api.gouv.fr https://sentry.fabrique.social.gouv.fr https://matomo.fabrique.social.gouv.fr https://www3.doubleclick.net https://marketingplatform.google.com/about/enterprise/;
connect-src 'self' https://geo.api.gouv.fr https://sentry.fabrique.social.gouv.fr https://matomo.fabrique.social.gouv.fr;
worker-src 'self' blob:;
`;
// Replace newline characters and spaces
Expand Down
1 change: 0 additions & 1 deletion packages/code-du-travail-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@socialgouv/matomo-next": "^1.6.1",
"@socialgouv/modeles-social": "workspace:^",
"@socialgouv/reference-article": "^1.0.1",
"adblock-detect-react": "^1.3.1",
"cors": "^2.8.5",
"date-fns": "^2.22.1",
"debounce-promise": "^3.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { FeedbackDefault } from "./FeedbackDefault";
import { FeedbackContent, FeedbackDataSent } from "./FeedbackContent";
import { FeedbackAnswered } from "./FeedbackAnswered";
import { useFeedbackEvents } from "./tracking";
import { useDetectAdBlock } from "adblock-detect-react";
import { FeedbackAdblock } from "./FeedbackAdblock";
import { useDetectAdBlock } from "./useDetectAdBlock";

export const Feedback = () => {
const adBlockDetected = useDetectAdBlock();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useEffect, useState } from "react";
import { PIWIK_URL } from "../../../config";

export const useDetectAdBlock = () => {
const [adBlockDetected, setAdBlockDetected] = useState(false);

useEffect(() => {
fetch(PIWIK_URL, {
method: "HEAD",
mode: "no-cors",
cache: "no-store",
})
.then(({ redirected }) => {
if (redirected) setAdBlockDetected(true);
})
.catch(() => {
setAdBlockDetected(true);
});
}, []);

return adBlockDetected;
};
11 changes: 0 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,6 @@ __metadata:
"@types/debounce-promise": ^3.1.4
"@types/jest": ^29.5.12
"@types/xml2js": ^0.4.14
adblock-detect-react: ^1.3.1
cors: ^2.8.5
cypress: ^13.13.2
cypress-html-validate: ^6.1.0
Expand Down Expand Up @@ -9082,16 +9081,6 @@ __metadata:
languageName: node
linkType: hard

"adblock-detect-react@npm:^1.3.1":
version: 1.3.1
resolution: "adblock-detect-react@npm:1.3.1"
peerDependencies:
react: ">=16.8.0"
react-dom: ">=16.8.0"
checksum: cbedb878fa4e0b52a47325875fba171199b75a1ec8c13bcb81dbf0f02b1df895d55ce3b66fb6c111cdebc0ed341d247404e0bd799028d846c8c3631c3b3f0bf4
languageName: node
linkType: hard

"add-stream@npm:^1.0.0":
version: 1.0.0
resolution: "add-stream@npm:1.0.0"
Expand Down

0 comments on commit f15a2fc

Please sign in to comment.