segmentio / consent-manager

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

closeBehavior enum not exported properly #266

Closed joelpierre closed 2 years ago

joelpierre commented 2 years ago

Screenshot 2022-09-12 at 23 44 29

Can't use the enum that is apparently exported 😅 and when I try to pass the prop it fails

Screenshot 2022-09-12 at 23 46 49

edsonjab commented 2 years ago

Hi @joelpierre the correct path for CloseBehavior is @segment/consent-manager/container

you can check out storybook here

mattkoch-bb commented 2 years ago

Hi @joelpierre the correct path for CloseBehavior is @segment/consent-manager/container

you can check out storybook here

Hi @edsonjab ! If I try to import this enum, I get the following...

image
joelpierre commented 2 years ago

Yep same @mattkoch-bb, it isn't exported from that location @edsonjab . I think the issue is when you build for production the type definitions are in a completely different location so TS gets a bit confused, typically they would be exported from the "same" path just the build/dist folder instead.

mattkoch-bb commented 2 years ago

@joelpierre How'd you get around it? :-D

joelpierre commented 2 years ago

@joelpierre How'd you get around it? :-D

The dreaded "..." as any

mattkoch-bb commented 2 years ago

"..." as any

In your import statement somewhere, @joelpierre ?

joelpierre commented 2 years ago
const closeBehavior = 'accept' as any;
...
closeBehavior={closeBehavior}
...