add cookie consert
This commit is contained in:
7
superpage/package-lock.json
generated
7
superpage/package-lock.json
generated
@@ -27,6 +27,7 @@
|
|||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-hook-form": "^7.56.0",
|
"react-hook-form": "^7.56.0",
|
||||||
"tailwindcss": "^4.0.13",
|
"tailwindcss": "^4.0.13",
|
||||||
|
"vanilla-cookieconsent": "^3.1.0",
|
||||||
"zod": "^3.24.3"
|
"zod": "^3.24.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -7781,6 +7782,12 @@
|
|||||||
"browserslist": ">= 4.21.0"
|
"browserslist": ">= 4.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/vanilla-cookieconsent": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vanilla-cookieconsent/-/vanilla-cookieconsent-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-/McNRtm/3IXzb9dhqMIcbquoU45SzbN2VB+To4jxEPqMmp7uVniP6BhGLjU8MC7ZCDsNQVOp27fhQTM/ruIXAA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/vfile": {
|
"node_modules/vfile": {
|
||||||
"version": "6.0.3",
|
"version": "6.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-hook-form": "^7.56.0",
|
"react-hook-form": "^7.56.0",
|
||||||
"tailwindcss": "^4.0.13",
|
"tailwindcss": "^4.0.13",
|
||||||
|
"vanilla-cookieconsent": "^3.1.0",
|
||||||
"zod": "^3.24.3"
|
"zod": "^3.24.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
102
superpage/src/CookieConsentConfig.ts
Normal file
102
superpage/src/CookieConsentConfig.ts
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
import type { CookieConsentConfig } from "vanilla-cookieconsent";
|
||||||
|
|
||||||
|
export const config: CookieConsentConfig = {
|
||||||
|
guiOptions: {
|
||||||
|
consentModal: {
|
||||||
|
layout: "box inline",
|
||||||
|
position: "bottom left",
|
||||||
|
},
|
||||||
|
preferencesModal: {
|
||||||
|
layout: "box",
|
||||||
|
position: "right",
|
||||||
|
equalWeightButtons: true,
|
||||||
|
flipButtons: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
categories: {
|
||||||
|
necessary: {
|
||||||
|
readOnly: true,
|
||||||
|
},
|
||||||
|
functionality: {},
|
||||||
|
analytics: {
|
||||||
|
services: {
|
||||||
|
ga4: {
|
||||||
|
label:
|
||||||
|
'<a href="https://marketingplatform.google.com/about/analytics/terms/us/" target="_blank">Google Analytics 4 (dummy)</a>',
|
||||||
|
onAccept: () => {
|
||||||
|
console.log("ga4 accepted");
|
||||||
|
// TODO: load ga4
|
||||||
|
},
|
||||||
|
onReject: () => {
|
||||||
|
console.log("ga4 rejected");
|
||||||
|
},
|
||||||
|
cookies: [
|
||||||
|
{
|
||||||
|
name: /^_ga/,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
another: {
|
||||||
|
label: "Another one (dummy)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
language: {
|
||||||
|
default: "en",
|
||||||
|
autoDetect: "browser",
|
||||||
|
translations: {
|
||||||
|
en: {
|
||||||
|
consentModal: {
|
||||||
|
title: "Hello traveller, it's cookie time!",
|
||||||
|
description:
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.",
|
||||||
|
acceptAllBtn: "Accept all",
|
||||||
|
acceptNecessaryBtn: "Reject all",
|
||||||
|
showPreferencesBtn: "Manage preferences",
|
||||||
|
footer:
|
||||||
|
'<a href="#link">Privacy Policy</a>\n<a href="#link">Terms and conditions</a>',
|
||||||
|
},
|
||||||
|
preferencesModal: {
|
||||||
|
title: "Consent Preferences Center",
|
||||||
|
acceptAllBtn: "Accept all",
|
||||||
|
acceptNecessaryBtn: "Reject all",
|
||||||
|
savePreferencesBtn: "Save preferences",
|
||||||
|
closeIconLabel: "Close modal",
|
||||||
|
serviceCounterLabel: "Service|Services",
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
title: "Cookie Usage",
|
||||||
|
description:
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title:
|
||||||
|
'Strictly Necessary Cookies <span class="pm__badge">Always Enabled</span>',
|
||||||
|
description:
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
||||||
|
linkedCategory: "necessary",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Functionality Cookies",
|
||||||
|
description:
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
||||||
|
linkedCategory: "functionality",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Analytics Cookies",
|
||||||
|
description:
|
||||||
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
|
||||||
|
linkedCategory: "analytics",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "More information",
|
||||||
|
description:
|
||||||
|
'For any query in relation to my policy on cookies and your choices, please <a class="cc__link" href="#yourdomain.com">contact me</a>.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
18
superpage/src/components/CookieConsent.astro
Normal file
18
superpage/src/components/CookieConsent.astro
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
import "vanilla-cookieconsent/dist/cookieconsent.css";
|
||||||
|
---
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-cc="show-preferencesModal"
|
||||||
|
class="underline hover:no-underline"
|
||||||
|
>
|
||||||
|
Gerenciar cookies
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { run } from "vanilla-cookieconsent";
|
||||||
|
import { config } from "~/CookieConsentConfig";
|
||||||
|
|
||||||
|
run(config);
|
||||||
|
</script>
|
||||||
@@ -2,12 +2,6 @@
|
|||||||
import "~/styles/app.css";
|
import "~/styles/app.css";
|
||||||
import Header from "./_components/Header.astro";
|
import Header from "./_components/Header.astro";
|
||||||
import Footer from "./_components/Footer.astro";
|
import Footer from "./_components/Footer.astro";
|
||||||
|
|
||||||
const buildTime = new Date().toLocaleString("pt-BR", {
|
|
||||||
timeZone: "America/Sao_Paulo",
|
|
||||||
dateStyle: "short",
|
|
||||||
timeStyle: "medium",
|
|
||||||
});
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
@@ -26,6 +20,7 @@ const buildTime = new Date().toLocaleString("pt-BR", {
|
|||||||
|
|
||||||
<script
|
<script
|
||||||
is:inline
|
is:inline
|
||||||
|
data-category="analytics"
|
||||||
type="text/partytown"
|
type="text/partytown"
|
||||||
src="https://www.googletagmanager.com/gtag/js?id=G-GSTQ17E9DJ"
|
src="https://www.googletagmanager.com/gtag/js?id=G-GSTQ17E9DJ"
|
||||||
></script>
|
></script>
|
||||||
@@ -37,6 +32,13 @@ const buildTime = new Date().toLocaleString("pt-BR", {
|
|||||||
}
|
}
|
||||||
gtag("js", new Date());
|
gtag("js", new Date());
|
||||||
|
|
||||||
|
gtag("consent", "default", {
|
||||||
|
ad_storage: "denied",
|
||||||
|
ad_user_data: "denied",
|
||||||
|
ad_personalization: "denied",
|
||||||
|
analytics_storage: "denied",
|
||||||
|
});
|
||||||
|
|
||||||
gtag("config", "G-GSTQ17E9DJ");
|
gtag("config", "G-GSTQ17E9DJ");
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,15 +1,25 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from "astro-icon/components";
|
import { Icon } from "astro-icon/components";
|
||||||
import Container from "~/components/Container.astro";
|
import Container from "~/components/Container.astro";
|
||||||
|
import CookieConsent from "~/components/CookieConsent.astro";
|
||||||
|
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
---
|
---
|
||||||
|
|
||||||
<footer class="py-2.5 lg:py-6 text-white/70">
|
<footer class="py-2.5 lg:py-6 text-white/70">
|
||||||
<Container class="flex max-lg:flex-col gap-2.5 justify-between">
|
<Container class="flex max-lg:flex-col gap-2.5 justify-between">
|
||||||
<div>
|
<div class="lg:flex gap-2.5">
|
||||||
© {year} EDUSEG® Todos os direitos reservados. CNPJ15.608.435/0001-90
|
<p>
|
||||||
|
© {year} EDUSEG® Todos os direitos reservados. CNPJ15.608.435/0001-90
|
||||||
|
</p>
|
||||||
|
<span>—</span>
|
||||||
|
<CookieConsent />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- <button type="button" data-cc="show-preferencesModal"
|
||||||
|
>
|
||||||
|
Show preferences modal</button
|
||||||
|
> -->
|
||||||
<a
|
<a
|
||||||
href="#top"
|
href="#top"
|
||||||
class="underline hover:no-underline flex items-center gap-1 max-lg:self-center max-lg:mb-6"
|
class="underline hover:no-underline flex items-center gap-1 max-lg:self-center max-lg:mb-6"
|
||||||
|
|||||||
Reference in New Issue
Block a user