Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript issue on consent object of CoreExtraContext type #1060

Closed
philibea opened this issue Apr 2, 2024 · 1 comment
Closed

Typescript issue on consent object of CoreExtraContext type #1060

philibea opened this issue Apr 2, 2024 · 1 comment

Comments

@philibea
Copy link

philibea commented Apr 2, 2024

As we start adding the consent management on our configuration actually there is no consent type on CoreExtraContext https://github.com/segmentio/analytics-next/blob/master/packages/core/src/events/interfaces.ts#L50

i wonder if it was normal as i find how to configure the consent middleware on a javascript project: https://github.com/segmentio/consent-manager/blob/f9d5166679b3c928b394b8ad50d517fdf43654b1/src/consent-manager-builder/analytics.ts#L20 and with a typescript project you will have type error on any.

Maybe there is better way do to that but this clearly missing of documentation on the website.

Do we need to use this wrapper https://github.com/segmentio/analytics-next/blob/master/packages/consent/consent-tools/README.md

@silesky
Copy link
Contributor

silesky commented Apr 3, 2024

Thanks for taking out an issue @philibea,

Documentation is still a WIP, but I think the reasoning is these special consent objects are meant to be constructed by our libraries -- we haven't been encouraging people to use them directly, so documenting them has not been front of mind.

Regardless, CoreExtraContext has a very loose index signature, which means you won't get any TypeScript errors -- for better or for worse.

Segment Consent Manager is confusingly, not actually related to our consent manager library in this repo. They actually using different APIs (you can see the middleware that consent-tools uses and it creates a totally different object than in the segment consent manager repo). Segment Consent Manager is a simple GUI consent manager that uses hardcoded categories per integration, whereas the consent management solution in this repo is meant to be a flexible solution that works with OneTrust, TrustArc, or even a home-rolled consent manager. The app consent dashboard only works with this library.

If you can utilize this library instead, I would probably do it -- as this is the future of consent at Segment.

@silesky silesky closed this as completed Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants