segmentio / consent-manager

Drop-in consent management plugin for analytics.js
https://segmentio.github.io/consent-manager/
MIT License
341 stars 144 forks source link

The consent manager preferences dialog didn't open onClick #279

Closed henky-wu-qatalog closed 1 year ago

henky-wu-qatalog commented 2 years ago

We get the following error whenopenConsentManager() is called in a onClick function. The preference dialog didn't open, and an error occurs as follows: Screenshot 2022-10-12 at 11 29 42

and we are getting this build warnings in NextJS:

../../node_modules/@segment/consent-manager/esm/consent-manager/dialog.js 
Attempted import error: 'nanoid' does not contain a default export (imported as 'nanoid').

Screenshot 2022-10-12 at 11 18 55


we're using:

edsonjab commented 2 years ago

HI @henky-wu-qatalog thank you for your report, we start looking into this.

edsonjab commented 2 years ago

Hi @henky-wu-qatalog I created this repo with an example how configure consent-manager with nextJs. I created a PR to fix the issue with the lodash library

henky-wu-qatalog commented 2 years ago

Thanks for the quick turnaround, @edsonjab. I just briefly check the example here but I can only see a nextjs boilerplate project. Would you mind take a look on this?

edsonjab commented 2 years ago

Hi @henky-wu-qatalog sorry, I forgot push my last changes, now is updated

corydhmiller commented 1 year ago

@edsonjab I cloned your repo but still getting this issue that others have reported.

image

Importing the banner dynamically with next/dynamic loads the component, but the banner never shows and openConsentManager does nothing.

I've been struggling with Next.js and consent-manager for the last few days, it doesn't really seem like they want to play nice. Are there any working examples of solutions with up-to-date Next and consent-manager versions?

edsonjab commented 1 year ago

This issue is fixed on this PR. We will release a new version soon.