-
Couldn't load subscription status.
- Fork 324
feat(scripts): add consent manager provider using c15t #2643
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
Conversation
🦋 Changeset detectedLatest commit: 8495237 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cf9a3fb to
141de77
Compare
141de77 to
a0a834b
Compare
a0a834b to
842a388
Compare
core/lib/consent-manager/cookies.ts
Outdated
| }; | ||
|
|
||
| export const consentCookieServer = async () => { | ||
| const { cookies } = await import('next/headers'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might import the whole next/headers export and probably won't be tree shaked. Maybe we need to change the file structure a bit. What do you think about this?
lib/consent-manager/schema.tslib/consent-manager/encoder.tslib/consent-manager/decoder.tslib/consent-manager/cookies/client.tslib/consent-manager/cookies/server.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! Working on it now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should encoder.ts and decoder.ts be under consent-manager/cookies? 🍹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good enough to combine into a lib/consent-manager/serializer.ts file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, only need to look into @chanceaclark callout.
842a388 to
8495237
Compare
What/Why?
Adds a new consent manager provider using the
@c15t/nextjspackage to handle cookie consent management with support for multiple consent categories and cookie-based persistence.The consent manager includes:
Note
Future PR's will include UI components for the cookie banner, dialog, and consent customization widget.
Testing
This implementation uses a "custom" mode with predefined consent categories, allowing for flexible consent management without requiring external API calls. In order to test, you'll need to first wrap the RootLayout in the provider, then import the unstyled
<CookieBanner />and<ConsentManagerDialog />components from@c15t/nextjs.Migration
For developers pulling in these changes:
@c15t/nextjspackage has been added tocore/package.json. Runpnpm installto install it.core/lib/consent-manager/handlers.ts- Contains the consent management logic and API handlerscore/lib/consent-manager/index.ts- Exports the provider componentcore/lib/consent-manager/provider.tsx- The main React provider component