From 27cb7300b380161411420199e9c063792707e32c Mon Sep 17 00:00:00 2001 From: Beast Date: Tue, 1 Sep 2026 13:24:12 +0800 Subject: [PATCH 1/5] feat: remove cookie consent banner --- website/src/components/ui/CookieConsent.astro | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/website/src/components/ui/CookieConsent.astro b/website/src/components/ui/CookieConsent.astro index a2557ef..fb07347 100644 --- a/website/src/components/ui/CookieConsent.astro +++ b/website/src/components/ui/CookieConsent.astro @@ -96,15 +96,15 @@ const t = await createTranslator(locale); } checkExistingConsent() { - const consent = this.getConsent(); - const isPrint = - new URLSearchParams(window.location.search).get("print") === "true"; - - if (consent === null && !isPrint) { - this.showBanner(); - } else if (consent === true) { - this.loadAnalytics(); - } + // const consent = this.getConsent(); + // const isPrint = + // new URLSearchParams(window.location.search).get("print") === "true"; + + // if (consent === null && !isPrint) { + // this.showBanner(); + // } else if (consent === true) { + this.loadAnalytics(); + // } } showBanner() { From 09a3f067bb0546ac0db2909f581a01d930f52b2c Mon Sep 17 00:00:00 2001 From: Beast Date: Tue, 1 Sep 2026 15:05:25 +0800 Subject: [PATCH 2/5] feat: update contact section location --- .../{about => community}/ContactSection.astro | 48 ++++++++--------- website/src/constants/footer-navigations.ts | 3 +- website/src/constants/site-navigations.ts | 1 - website/src/i18n/de-DE.json | 16 +++--- website/src/i18n/en-US.json | 16 +++--- website/src/i18n/es-ES.json | 16 +++--- website/src/i18n/hi-IN.json | 16 +++--- website/src/i18n/id-ID.json | 16 +++--- website/src/i18n/ja-JP.json | 16 +++--- website/src/i18n/ko-KR.json | 16 +++--- website/src/i18n/ru-RU.json | 16 +++--- website/src/i18n/zh-CN.json | 16 +++--- website/src/pages/[lang]/about.astro | 54 ------------------- website/src/pages/[lang]/community.astro | 2 + website/src/pages/[lang]/privacy-policy.astro | 6 ++- website/src/pages/[lang]/team/index.astro | 10 ---- website/src/pages/about.astro | 46 ---------------- website/src/pages/community.astro | 2 + website/src/pages/privacy-policy.astro | 11 +++- website/src/pages/team/index.astro | 3 -- 20 files changed, 115 insertions(+), 215 deletions(-) rename website/src/components/features/{about => community}/ContactSection.astro (63%) delete mode 100644 website/src/pages/[lang]/about.astro delete mode 100644 website/src/pages/[lang]/team/index.astro delete mode 100644 website/src/pages/about.astro delete mode 100644 website/src/pages/team/index.astro diff --git a/website/src/components/features/about/ContactSection.astro b/website/src/components/features/community/ContactSection.astro similarity index 63% rename from website/src/components/features/about/ContactSection.astro rename to website/src/components/features/community/ContactSection.astro index bd8681b..80b5180 100644 --- a/website/src/components/features/about/ContactSection.astro +++ b/website/src/components/features/community/ContactSection.astro @@ -3,37 +3,40 @@ import { createTranslator, getLocaleFromUrl } from "@/utils/i18n"; const locale = getLocaleFromUrl(Astro.url.pathname); const t = await createTranslator(locale); + +const email = t("community.contact.email"); +const subject = encodeURIComponent(t("community.contact.subject")); ---
-
-
- - {t("about.contact.eyebrow")} +
+
+ + {t("community.contact.eyebrow")} -

- {t("about.contact.heading")} +

+ {t("community.contact.heading")}

-

- {t("about.contact.body")} +

+ {t("community.contact.body")}

- {t("about.contact.email")} + {email} - {t("about.contact.cta")} + {t("community.contact.cta")}
@@ -41,15 +44,14 @@ const t = await createTranslator(locale); - - diff --git a/website/src/i18n/de-DE.json b/website/src/i18n/de-DE.json index 19a2615..55e240a 100644 --- a/website/src/i18n/de-DE.json +++ b/website/src/i18n/de-DE.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "Cookie-Einwilligung", - "notice": "Diese Website verwendet Cookies, um die Interessen ihrer Leser besser zu verstehen und darauf einzugehen. Erfahren Sie mehr in der", - "link": "Datenschutzrichtlinie und den Nutzungsbedingungen", - "accept": "Akzeptieren", - "decline": "Ablehnen" - }, "whitepaper": { "meta": { "title": "Quantus-Whitepaper | Quantensicherheit", diff --git a/website/src/i18n/en-US.json b/website/src/i18n/en-US.json index b523e77..e0a5e74 100644 --- a/website/src/i18n/en-US.json +++ b/website/src/i18n/en-US.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "Cookie Consent", - "notice": "This website uses cookies to understand the interests of its readers better and cater to them. Find out more in the", - "link": "privacy policy and terms of service", - "accept": "Accept", - "decline": "Decline" - }, "whitepaper": { "meta": { "title": "Quantus Whitepaper | Quantum Security", diff --git a/website/src/i18n/es-ES.json b/website/src/i18n/es-ES.json index 1f71c42..64a4781 100644 --- a/website/src/i18n/es-ES.json +++ b/website/src/i18n/es-ES.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "Consentimiento de Cookies", - "notice": "Este sitio web utiliza cookies para entender mejor los intereses de sus lectores y atenderlos. Obtenga más información en la", - "link": "política de privacidad y términos de servicio", - "accept": "Aceptar", - "decline": "Rechazar" - }, "whitepaper": { "meta": { "title": "Whitepaper Quantus | Seguridad Cuántica", diff --git a/website/src/i18n/hi-IN.json b/website/src/i18n/hi-IN.json index de8e343..075a805 100644 --- a/website/src/i18n/hi-IN.json +++ b/website/src/i18n/hi-IN.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "कुकी सहमति", - "notice": "यह वेबसाइट अपने पाठकों के हितों को बेहतर ढंग से समझने और उन्हें पूरा करने के लिए कुकीज़ का उपयोग करती है। इसके बारे में अधिक जानें", - "link": "गोपनीयता नीति और सेवा की शर्तें", - "accept": "स्वीकार करें", - "decline": "अस्वीकार करें" - }, "whitepaper": { "meta": { "title": "Quantus श्वेतपत्र | क्वांटम सुरक्षा", diff --git a/website/src/i18n/id-ID.json b/website/src/i18n/id-ID.json index 48fae80..d10b5d2 100644 --- a/website/src/i18n/id-ID.json +++ b/website/src/i18n/id-ID.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "Persetujuan Cookie", - "notice": "Situs web ini menggunakan cookie untuk lebih memahami minat pembacanya dan melayani mereka. Cari tahu lebih lanjut di", - "link": "kebijakan privasi dan ketentuan layanan", - "accept": "Terima", - "decline": "Tolak" - }, "whitepaper": { "meta": { "title": "Whitepaper Quantus | Keamanan Kuantum", diff --git a/website/src/i18n/ja-JP.json b/website/src/i18n/ja-JP.json index 868e18b..fcebe29 100644 --- a/website/src/i18n/ja-JP.json +++ b/website/src/i18n/ja-JP.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "クッキーへの同意", - "notice": "当ウェブサイトでは、読者の皆様の関心をより深く理解し、それに応えるためにクッキーを使用しています。詳細は以下をご覧ください:", - "link": "プライバシーポリシーおよび利用規約", - "accept": "同意する", - "decline": "拒否する" - }, "whitepaper": { "meta": { "title": "Quantusホワイトペーパー | 量子セキュリティ", diff --git a/website/src/i18n/ko-KR.json b/website/src/i18n/ko-KR.json index 494d412..2f77d97 100644 --- a/website/src/i18n/ko-KR.json +++ b/website/src/i18n/ko-KR.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "쿠키 동의", - "notice": "당사 웹사이트는 독자의 관심사를 더 잘 이해하고 이에 부응하기 위해 쿠키를 사용합니다. 자세한 내용은 다음을 확인하세요.", - "link": "개인정보 처리방침 및 서비스 약관", - "accept": "수락", - "decline": "거부" - }, "whitepaper": { "meta": { "title": "Quantus 백서 | 양자 보안의 기술적 토대", diff --git a/website/src/i18n/ru-RU.json b/website/src/i18n/ru-RU.json index 6225b23..442ce66 100644 --- a/website/src/i18n/ru-RU.json +++ b/website/src/i18n/ru-RU.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "Согласие на использование cookies", - "notice": "Этот сайт использует cookies, чтобы лучше понимать интересы читателей и соответствовать им. Узнайте больше в", - "link": "политике конфиденциальности и условиях использования", - "accept": "Принять", - "decline": "Отклонить" - }, "whitepaper": { "meta": { "title": "Whitepaper Quantus | Квантовая безопасность", diff --git a/website/src/i18n/zh-CN.json b/website/src/i18n/zh-CN.json index 22b1a3e..efa1cfa 100644 --- a/website/src/i18n/zh-CN.json +++ b/website/src/i18n/zh-CN.json @@ -1012,13 +1012,6 @@ "senoti": "Senoti" } }, - "cookie": { - "title": "Cookie 同意", - "notice": "本网站使用 Cookie 以更好地了解读者的兴趣并提供相应服务。了解更多信息请参阅", - "link": "隐私政策和服务条款", - "accept": "接受", - "decline": "拒绝" - }, "whitepaper": { "meta": { "title": "Quantus 白皮书 | 量子安全的技术基础", diff --git a/website/src/scripts/shared/analytics.test.ts b/website/src/scripts/shared/analytics.test.ts new file mode 100644 index 0000000..77f17fb --- /dev/null +++ b/website/src/scripts/shared/analytics.test.ts @@ -0,0 +1,70 @@ +import { describe, expect, mock, test } from "bun:test"; +import { trackEvent } from "./analytics"; + +type GtagMock = ReturnType; + +function installBrowser(consent: string | null): GtagMock { + const gtag = mock(() => {}); + const store = new Map(); + if (consent !== null) { + store.set("cookie-consent", consent); + } + + const localStorageMock = { + getItem: (key: string) => store.get(key) ?? null, + setItem: (key: string, value: string) => { + store.set(key, value); + }, + removeItem: (key: string) => { + store.delete(key); + }, + }; + + Object.assign(globalThis, { + window: { + gtag, + location: { pathname: "/" }, + localStorage: localStorageMock, + }, + document: { documentElement: { lang: "en-US" } }, + localStorage: localStorageMock, + }); + + return gtag; +} + +describe("trackEvent", () => { + test("sends the event when cookie-consent has never been set", () => { + const gtag = installBrowser(null); + + trackEvent("generate_lead", { method: "newsletter" }); + + expect(gtag).toHaveBeenCalledTimes(1); + expect(gtag.mock.calls[0]).toEqual([ + "event", + "generate_lead", + { + language_code: "en-US", + page_type: "home", + method: "newsletter", + }, + ]); + }); + + test("sends the event when cookie-consent was previously declined", () => { + const gtag = installBrowser("false"); + + trackEvent("download", { file: "wallet" }); + + expect(gtag).toHaveBeenCalledTimes(1); + }); + + test("does not send when gtag is missing", () => { + const gtag = installBrowser(null); + delete (window as { gtag?: GtagMock }).gtag; + + trackEvent("generate_lead"); + + expect(gtag).not.toHaveBeenCalled(); + }); +}); diff --git a/website/src/scripts/shared/analytics.ts b/website/src/scripts/shared/analytics.ts index 51feafd..9031a29 100644 --- a/website/src/scripts/shared/analytics.ts +++ b/website/src/scripts/shared/analytics.ts @@ -5,8 +5,6 @@ declare global { } } -const CONSENT_KEY = "cookie-consent"; - export type AnalyticsParams = Record; type PageType = @@ -22,21 +20,9 @@ type PageType = let delegationInitialized = false; -function hasAnalyticsConsent(): boolean { - try { - const stored = localStorage.getItem(CONSENT_KEY); - return stored ? JSON.parse(stored) === true : false; - } catch { - return false; - } -} - function stripLocalePrefix(pathname: string): string { const segments = pathname.split("/").filter(Boolean); - if ( - segments.length > 0 && - /^[a-z]{2}-[A-Z]{2}$/.test(segments[0]) - ) { + if (segments.length > 0 && /^[a-z]{2}-[A-Z]{2}$/.test(segments[0])) { return "/" + segments.slice(1).join("/"); } return pathname === "" ? "/" : pathname; @@ -50,7 +36,10 @@ export function getPageType(pathname = window.location.pathname): PageType { if (path.startsWith("/about")) return "about"; if (path.startsWith("/community")) return "community"; if (path.startsWith("/whitepaper")) return "whitepaper"; - if (path.startsWith("/quantum-risk-checker") || path.startsWith("/risk-checker")) + if ( + path.startsWith("/quantum-risk-checker") || + path.startsWith("/risk-checker") + ) return "risk_checker"; if (path.startsWith("/blog") || path.startsWith("/blogs")) return "blog"; if (path.startsWith("/technology")) return "technology"; @@ -61,7 +50,10 @@ export function storeFromHref(href: string): "ios" | "android" | undefined { try { const url = new URL(href, window.location.origin); if (url.hostname.includes("apple.com")) return "ios"; - if (url.hostname.includes("play.google.com") || url.hostname.includes("google.com")) + if ( + url.hostname.includes("play.google.com") || + url.hostname.includes("google.com") + ) return "android"; } catch { // ignore invalid URLs @@ -70,14 +62,11 @@ export function storeFromHref(href: string): "ios" | "android" | undefined { } /** - * Fire a GA4 event when the visitor has accepted analytics cookies and gtag is loaded. + * Fire a GA4 event when gtag is loaded. * Automatically attaches language_code and page_type. */ -export function trackEvent( - name: string, - params: AnalyticsParams = {}, -): void { - if (!hasAnalyticsConsent() || typeof window.gtag !== "function") { +export function trackEvent(name: string, params: AnalyticsParams = {}): void { + if (typeof window.gtag !== "function") { return; }