Bläddra i källkod

chore(auth): remove Facebook Pixel integration reliquat (#65)

* chore(auth): remove Facebook Pixel integration and related code to simplify signup process
refactor(auth): update onSuccess handler in useSignUp to remove unused response data

* chore(layout.tsx): remove unused imports and clean up commented code to enhance readability and maintainability

* fix(signin/page.tsx): remove tracking consent logic and related imports to simplify the sign-in page
Mat B. 1 månad sedan
förälder
incheckning
cb06be75cd

+ 1 - 15
app/[locale]/auth/(auth-layout)/signin/page.tsx

@@ -1,19 +1,5 @@
-import { cookies } from "next/headers";
-
-import { isEU } from "@/shared/lib/location/location";
-import { Cookies } from "@/shared/constants/cookies";
-import { ConsentBanner } from "@/features/consent-banner/ui/consent-banner";
 import { CredentialsLoginForm } from "@/features/auth/signin/ui/CredentialsLoginForm";
 
 export default async function AuthSignInPage() {
-  const cookiesStore = await cookies();
-  const isEuropeanUnion = await isEU();
-  const showTrackingConsent = isEuropeanUnion && !cookiesStore.has(Cookies.TrackingConsent);
-
-  return (
-    <>
-      <CredentialsLoginForm />
-      {showTrackingConsent && <ConsentBanner />}
-    </>
-  );
+  return <CredentialsLoginForm />;
 }

+ 1 - 14
app/[locale]/layout.tsx

@@ -1,11 +1,9 @@
-import Image from "next/image";
 import { Inter, Permanent_Marker } from "next/font/google";
 import { GeistSans } from "geist/font/sans";
 import { GeistMono } from "geist/font/mono";
 
 import { cn } from "@/shared/lib/utils";
 import { getServerUrl } from "@/shared/lib/server-url";
-import { FB_PIXEL_ID } from "@/shared/lib/facebook/fb-pixel";
 import { SiteConfig } from "@/shared/config/site-config";
 import { WorkoutSessionsSynchronizer } from "@/features/workout-session/ui/workout-sessions-synchronizer";
 import { ThemeSynchronizer } from "@/features/theme/ui/ThemeSynchronizer";
@@ -124,7 +122,7 @@ export default async function RootLayout({ params, children }: RootLayoutProps)
           <meta content="yes" name="mobile-web-app-capable" />
           <meta content="#FF5722" name="msapplication-TileColor" />
           <meta content="/android-chrome-192x192.png" name="msapplication-TileImage" />
-          
+
           {/* PWA Manifest */}
           <link href="/manifest.json" rel="manifest" />
 
@@ -137,17 +135,6 @@ export default async function RootLayout({ params, children }: RootLayoutProps)
 
           {/* Theme color for PWA */}
           <meta content="#FF5722" name="theme-color" />
-
-          {/* TODO: maybe add some ads ? */}
-          <noscript>
-            <Image
-              alt="Facebook Pixel"
-              height="1"
-              src={`https://www.facebook.com/tr?id=${FB_PIXEL_ID}&ev=PageView&noscript=1`}
-              style={{ display: "none" }}
-              width="1"
-            />
-          </noscript>
         </head>
 
         <body

+ 1 - 7
src/features/auth/signup/model/useSignUp.ts

@@ -4,8 +4,6 @@ import { useRouter } from "next/navigation";
 import { useMutation } from "@tanstack/react-query";
 
 import { useI18n } from "locales/client";
-import { event } from "@/shared/lib/facebook/fb-pixel";
-import { LogEvents } from "@/shared/lib/analytics/events";
 import { paths } from "@/shared/constants/paths";
 import { SignUpSchema } from "@/features/auth/signup/schema/signup.schema";
 import { signUpAction } from "@/features/auth/signup/model/signup.action";
@@ -30,12 +28,8 @@ export const useSignUp = () => {
       return result;
     },
 
-    onSuccess: (res) => {
+    onSuccess: () => {
       router.push(`/${paths.verifyEmail}?signin=true`);
-
-      event(LogEvents.Registered.facebookNativeName, {
-        email: res?.data?.user.email || "",
-      });
     },
 
     onError: (error: unknown) => {

+ 0 - 15
src/shared/lib/facebook/FacebookPixelTest.tsx

@@ -1,15 +0,0 @@
-"use client";
-
-import { event } from "./fb-pixel";
-
-export const FacebookPixelTest = () => {
-  const handleClick = () => {
-    event("test");
-  };
-
-  return (
-    <button className="h w-full bg-gray-600" onClick={handleClick}>
-      test
-    </button>
-  );
-};

+ 0 - 27
src/shared/lib/facebook/fb-pixel.ts

@@ -1,27 +0,0 @@
-// import { getCookieConsent } from "./cookieConsent";
-
-import { env } from "@/env";
-
-export const FB_PIXEL_ID = env.NEXT_PUBLIC_FACEBOOK_PIXEL_ID;
-// disable ts error for window
-
-export const pageview = () => {
-  // Vérifier le consentement avant d'envoyer des événements
-  //   if (getCookieConsent() === false) return;
-
-  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-  // @ts-ignore
-  window.fbq("track", "PageView");
-};
-
-// https://developers.facebook.com/docs/facebook-pixel/advanced/
-// eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
-export const event = (name: string, options = {}) => {
-  // Vérifier le consentement avant d'envoyer des événements
-  //   if (getCookieConsent() === false) return;
-
-  //eslint-disable-next-line @typescript-eslint/ban-ts-comment
-  // @ts-ignore
-  window.fbq("track", name, options);
-};