Skip to content

Commit 4fae9da

Browse files
committed
Remove debugging
1 parent 77a0952 commit 4fae9da

File tree

3 files changed

+7
-39
lines changed

3 files changed

+7
-39
lines changed

docs/.vuepress/lib/consent.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,15 @@ async function hasConsentForCategory(categorySlug: string): Promise<boolean> {
1818
if (typeof window === "undefined") return false;
1919
const ui = window.UC_UI;
2020

21-
// Debug log
22-
console.log(`[Consent] Checking category: ${categorySlug}`, {
23-
uiExists: !!ui,
24-
isInitialized: ui?.isInitialized?.()
25-
});
26-
2721
if (!ui?.getServicesBaseInfo) {
28-
console.log("[Consent] UC_UI.getServicesBaseInfo not available");
2922
return false;
3023
}
3124

3225
try {
3326
const services = await ui.getServicesBaseInfo();
34-
console.log(`[Consent] Services found: ${services?.length}`, services);
3527

3628
if (!Array.isArray(services)) return false;
3729

38-
const match = services.find((s) => s.categorySlug.toLowerCase() === categorySlug.toLowerCase());
39-
console.log(`[Consent] Category match for ${categorySlug}:`, match);
40-
4130
return services.some(
4231
(s) => s.categorySlug.toLowerCase() === categorySlug.toLowerCase() && s.consent?.status === true
4332
);

docs/.vuepress/lib/usePosthog.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,36 +49,25 @@ function setupConsentListeners(): void {
4949
listenersRegistered = true;
5050

5151
const applyConsent = async () => {
52-
console.log("[PostHog] applyConsent called via event");
5352
if (await hasFunctionalConsent()) {
54-
console.log("[PostHog] Consent granted, resuming");
5553
resumeTracking();
5654
} else {
57-
console.log("[PostHog] Consent denied, stopping");
5855
stopTracking();
5956
}
6057
};
6158

62-
window.addEventListener("UC_CONSENT", (e) => {
63-
console.log("[PostHog] UC_CONSENT event received", e);
64-
applyConsent();
65-
});
66-
window.addEventListener("UC_UI_INITIALIZED", (e) => {
67-
console.log("[PostHog] UC_UI_INITIALIZED event received", e);
59+
window.addEventListener("UC_CONSENT", () => {
6860
applyConsent();
6961
});
7062

71-
// Check if CMP is already initialized (in case we missed the event)
72-
if (window.UC_UI?.isInitialized?.()) {
73-
console.log("[PostHog] CMP already initialized, applying consent");
63+
window.addEventListener("UC_UI_INITIALIZED", () => {
7464
applyConsent();
75-
}
65+
});
7666
}
7767

7868
export function usePostHog() {
7969
if (typeof window !== "undefined") {
8070
setupConsentListeners();
81-
// Check initial consent status
8271
hasFunctionalConsent().then((consented) => {
8372
if (consented) {
8473
initializePostHog();

docs/.vuepress/lib/useReoDev.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function stopReoDev(): void {
6767

6868
async function initializeReoDev(): Promise<void> {
6969
if (typeof window === "undefined") return;
70-
if (!hasMarketingConsent()) return;
70+
if (!await hasMarketingConsent()) return;
7171
if (isInitialized || reoInstance || reoPromise || typeof window.Reo !== 'undefined') return;
7272

7373
try {
@@ -84,13 +84,10 @@ async function initializeReoDev(): Promise<void> {
8484
}
8585

8686
function applyConsentState(): void {
87-
console.log("[ReoDev] applyConsentState called");
8887
hasMarketingConsent().then((consented) => {
8988
if (consented) {
90-
console.log("[ReoDev] Consent granted, initializing");
9189
void initializeReoDev();
9290
} else {
93-
console.log("[ReoDev] Consent denied, stopping");
9491
stopReoDev();
9592
}
9693
});
@@ -101,20 +98,13 @@ function setupConsentListeners(): void {
10198
if (listenersRegistered) return;
10299
listenersRegistered = true;
103100

104-
window.addEventListener("UC_CONSENT", (e) => {
105-
console.log("[ReoDev] UC_CONSENT event", e);
106-
applyConsentState();
107-
});
108-
window.addEventListener("UC_UI_INITIALIZED", (e) => {
109-
console.log("[ReoDev] UC_UI_INITIALIZED event", e);
101+
window.addEventListener("UC_CONSENT", () => {
110102
applyConsentState();
111103
});
112104

113-
// Check if CMP is already initialized (in case we missed the event)
114-
if (window.UC_UI?.isInitialized?.()) {
115-
console.log("[ReoDev] CMP already initialized, applying state");
105+
window.addEventListener("UC_UI_INITIALIZED", () => {
116106
applyConsentState();
117-
}
107+
});
118108
}
119109

120110
export function useReoDev() {

0 commit comments

Comments
 (0)