ErHaWeb / klaro_consent_manager

TYPO3 integration of Klaro! Consent Management. Klaro! is a powerful tool that protects the privacy and data of your visitors and helps you run a GDPR compliant website.
Other
1 stars 0 forks source link

Not working when the page is cached #9

Closed weisgerberm closed 3 months ago

weisgerberm commented 3 months ago

Hi, cool extension :) I'm not sure if I'm doing something wrong, but currently it only shows me the consent banner when a subpage is called for the first time.

Reproducible: I call up the start page and see the cookie banner Press F5 There is no longer a cookie banner on the start page I open any other subpage and the cookie banner is there again

Is there perhaps a way to open the window via JS so that I can test whether something is just hidden in the background?

Usage: @import 'EXT:klaro_consent_manager/Configuration/TypoScript/Default/setup.typoscript' @import 'EXT:klaro_consent_manager/Configuration/TypoScript/setup.typoscript'

My Config: [ { "uid": 1, "pid": 3635, "tstamp": 1717764583, "crdate": 1717682976, "deleted": 0, "hidden": 0, "title": "Cookies", "testing": 0, "config_variable_name": "", "append_show_button": 0, "append_reset_button": 0, "element_i_d": "", "additional_class": "", "storage_method": "cookie", "storage_name": "", "cookie_domain": "", "cookie_path": "", "html_texts": 1, "embedded": 0, "group_by_purpose": 1, "cookie_expires_after_days": 365, "default": 1, "must_consent": 0, "accept_all": 1, "hide_decline_all": 0, "hide_learn_more": 0, "hide_toggle_all": 0, "notice_as_modal": 0, "disable_powered_by": 0, "purpose_order": "performance,marketing,advertising,functional", "no_auto_load": 0, "color_scheme": "light", "alignment": "bottom-wide", "callback": "", "fluidtemplate_rootpath": "", "locallang_path": "", "services": "2,3,1,4,5,6" } ]

ErHaWeb commented 3 months ago

Thanks for the report.

I have now been able to reproduce the problem in a fresh TYPO3 v12 instance.

Can you confirm that in the error case only the JavaScript with the inline configuration (var klaroConfig = ...) is loaded in the frontend, but not the klaro-no-translations-no-css.js script?

This is because the TypoScript settings of the extension could not be determined due to a bug.

The behaviour seems to be related to the use of Extbase classes outside the plugin context, as is currently done via the TypoScriptUtility::getSettings. An indication for this assumption is ticket https://forge.typo3.org/issues/99957 .

In the next release, I will rewrite the TypoScriptUtility class to completely dispense with Extbase classes in order to correct possible cache problems.

weisgerberm commented 3 months ago

Thanks for your fast reply.

Yes, I can confirm that klaro-no-translations-no-css.js is not loading on the cached page. Would it be a workaround if I load this file manually until you have created the next release?

ErHaWeb commented 3 months ago

This affects all areas that rely on TypoScriptUtility. This includes the loading of CSS based on plugin.tx_klaroconsentmanager.settings.css, the loading of JavaScript based on plugin.tx_klaroconsentmanager.settings.javascript and the loading of fluid paths in the context of fluid-rendered labels. If you do not use the latter, it should be sufficient to include the following resources manually.

EXT:klaro_consent_manager/Resources/Public/Css/klaro.min.css
EXT:klaro_consent_manager/Resources/Public/Css/klaro-custom.min.css
EXT:klaro_consent_manager/Resources/Public/JavaScript/klaro-no-translations-no-css.js

But I've just taken care of the matter. If all goes well, I will publish a new release today 😉 .

ErHaWeb commented 3 months ago

The new version 1.8.3 with the fix has been released

weisgerberm commented 3 months ago

Works great, thanks for the quick fix