1
0
mirror of https://github.com/XFox111/my-website.git synced 2026-04-22 07:28:01 +03:00

fix: CLARITY_ID and CLARITY_CONSENT variables are baked in on build time

This commit is contained in:
2024-08-21 12:12:29 +00:00
parent a217d0a96a
commit 4d1662b6ee
6 changed files with 31 additions and 19 deletions
-2
View File
@@ -17,8 +17,6 @@ export const dismissCookies = (): void =>
setCookie("CC", "", 1209600); // 14 days
};
export const requireExcplicitConsent: boolean = process.env.NEXT_PUBLIC_CLARITY_CONSENT === "1";
export const getCookieChoice = (): "accepted" | "rejected" | "acknowledged" | "none" =>
{
switch (getCookie("CC"))
+16 -1
View File
@@ -1,10 +1,25 @@
import { unstable_noStore } from "next/cache";
import { headers } from "next/headers";
/**
* Check if Clarity is enabled
* @returns true if Clarity is enabled
*/
export const analyticsEnabled = (): boolean => !!process.env.CLARITY_ID;
export const analyticsEnabled = (): boolean =>
{
unstable_noStore();
return !!process.env.CLARITY_ID;
};
/**
* Check if Clarity requires explicit consent
* @returns true if Clarity requires explicit consent
*/
export const requireExcplicitConsent = (): boolean =>
{
unstable_noStore();
return process.env.CLARITY_CONSENT === "1";
};
/**
* Check if Clarity is enabled and the browser didn't send a DNT signal