feat(scripts): add consent manager provider using c15t#2643
feat(scripts): add consent manager provider using c15t#2643matthewvolk merged 1 commit intocanaryfrom
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
| }; | ||
|
|
||
| export const consentCookieServer = async () => { | ||
| const { cookies } = await import('next/headers'); |
There was a problem hiding this comment.
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.
I like it! Working on it now
There was a problem hiding this comment.
Should encoder.ts and decoder.ts be under consent-manager/cookies? 🍹
There was a problem hiding this comment.
Might be good enough to combine into a lib/consent-manager/serializer.ts file.
jorgemoya
left a comment
There was a problem hiding this comment.
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