fix: restore portfolio loader and safe consent revocation
This commit is contained in:
1 parent
bff3e4d735
commit
a4e5e5c048
4 files changed
+315
-13
No files matched your search
@@ -98,6 +98,7 @@ const buttonClassName =
|
||||
function GoogleAnalyticsConsent() {
|
||||
const [consent, setConsent] = useState<AnalyticsConsent | null>();
|
||||
const [preferencesOpen, setPreferencesOpen] = useState(false);
|
||||
const [revokeError, setRevokeError] = useState<string | null>(null);
|
||||
const configuredRef = useRef(false);
|
||||
const preferencesButtonRef = useRef<HTMLButtonElement>(null);
|
||||
|
||||
@@ -150,7 +151,13 @@ function GoogleAnalyticsConsent() {
|
||||
}
|
||||
|
||||
function revokeAnalytics() {
|
||||
persistConsent("denied");
|
||||
if (!persistConsent("denied")) {
|
||||
setRevokeError(
|
||||
"Não foi possível salvar a revogação. Tente novamente para concluir.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
setRevokeError(null);
|
||||
window[GA_DISABLE_KEY] = true;
|
||||
window.gtag?.("consent", "update", deniedConsent);
|
||||
expireAnalyticsCookies();
|
||||
@@ -250,6 +257,15 @@ function GoogleAnalyticsConsent() {
|
||||
Analytics está {consent === "granted" ? "ativo" : "desativado"}.
|
||||
Dados de publicidade permanecem negados.
|
||||
</p>
|
||||
{revokeError && (
|
||||
<p
|
||||
role="alert"
|
||||
aria-label="Falha ao salvar a revogação"
|
||||
className="mt-sp-3 text-[13px] leading-6 text-[var(--slash)]"
|
||||
>
|
||||
{revokeError}
|
||||
</p>
|
||||
)}
|
||||
<div className="mt-sp-4 flex flex-wrap gap-sp-2">
|
||||
{consent === "granted" ? (
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user