Fix preference panel close returning to banner when consent exists

When a visitor with existing consent opened the preference panel via
the floating settings button and closed it, the state was always set
to "banner" instead of "hidden". Now check hasConsent so closing the
panel returns to the floating button when preferences are already saved.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-21 17:22:47 +04:00
parent 9ec6922fde
commit 55d81e21eb

View File

@@ -122,7 +122,7 @@ export class ProboThemedBanner extends HTMLElement {
});
this.shadow.querySelector("[data-action=back]")?.addEventListener("click", () => {
root.setState("banner");
root.setState(root.client.hasConsent ? "hidden" : "banner");
});
this.shadow.addEventListener("click", (e: Event) => {