Closed zeitvertrieb closed 2 years ago
Hi @zeitvertrieb !
Sorry for the inconvenience. The documentation already includes features of the upcoming release. Takes a bit longer than anticipated. Will notify you, once this function is available.
Hello @ppuritscher! I was wondering if you have an idea to when this issue will be fixed?
Hi @learsson !
Will release next version in the upcoming week.
Workaround. The Cookie Consent Banner listens to an event to reveal itself.
triggerCookieConsentBanner
is just a convenience function.
<button
onClick={() => { document.dispatchEvent(new Event("cookie_consent_details_show")) }}
onKeyPress={() => { document.dispatchEvent(new Event("cookie_consent_details_show")) }}
type="button"
>
Here
</button>
// Or create convenience function on your own
// TypeScript
export function triggerCookieConsentBanner(options?: {
showDetails: boolean;
}): void {
if (options?.showDetails) {
document.dispatchEvent(new Event("cookie_consent_details_show"));
} else {
document.dispatchEvent(new Event("cookie_consent_show"));
}
}
Thank you for the update, @ppuritscher! Ok, seems straight forward. I must be honest, I did just find this project and it seems like the best CC library out there and I have yet to study the implementation. I will start with a custom method and look for your update later
Glad to hear that. Always open for feedback :)
Hi @zeitvertrieb and @learsson!
I just released v3.0.0
. triggerCookieConsentBanner
is now available.
See: https://github.com/porscheofficial/cookie-consent-banner/tree/main/packages/cookie-consent-banner-react#-real-world-example-with-tag-manager-and-custom-error-tracking
Please reopen this issue or create a new one if the issue still persists.
Node/npm version(s): 8.3.1
Package(s) version(s):
Browser(s) version(s): lastest Chrome
Description of the issue/feature: Getting an TS error: Module '"@porscheofficial/cookie-consent-banner-react"' has no exported member 'triggerCookieConsentBanner'.
Some example to reproduce the issue: based on demo code
Use cases: