Skip to content

Conversation

@matthewvolk
Copy link
Contributor

What/Why?

Adds a new consent manager provider using the @c15t/nextjs package to handle cookie consent management with support for multiple consent categories and cookie-based persistence.

The consent manager includes:

  • A React provider component that wraps the C15T consent manager
  • Custom endpoint handlers for showing consent banners, setting consent preferences, and verifying consent status via cookies

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:

  • New dependency: The @c15t/nextjs package has been added to core/package.json. Run pnpm install to install it.
  • New files added:
    • core/lib/consent-manager/handlers.ts - Contains the consent management logic and API handlers
    • core/lib/consent-manager/index.ts - Exports the provider component
    • core/lib/consent-manager/provider.tsx - The main React provider component
  • No breaking changes: This is a purely additive change that doesn't modify existing functionality. The consent manager operates independently and can be integrated gradually.

@matthewvolk matthewvolk requested a review from a team as a code owner October 21, 2025 22:22
@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2025

🦋 Changeset detected

Latest commit: 8495237

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Minor

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

@vercel
Copy link

vercel bot commented Oct 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
catalyst-b2b Ready Ready Preview Comment Oct 28, 2025 8:37pm
catalyst-canary Ready Ready Preview Comment Oct 28, 2025 8:37pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Oct 28, 2025 8:37pm

};

export const consentCookieServer = async () => {
const { cookies } = await import('next/headers');
Copy link
Contributor

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.ts
  • lib/consent-manager/encoder.ts
  • lib/consent-manager/decoder.ts
  • lib/consent-manager/cookies/client.ts
  • lib/consent-manager/cookies/server.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ✅

Copy link
Contributor

@jorgemoya jorgemoya Oct 28, 2025

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? 🍹

Copy link
Contributor

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.

Copy link
Contributor

@jorgemoya jorgemoya left a 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.

@matthewvolk matthewvolk added this pull request to the merge queue Oct 28, 2025
Merged via the queue into canary with commit 391e20d Oct 28, 2025
11 checks passed
@matthewvolk matthewvolk deleted the feat/consent-manager-provider branch October 28, 2025 21:03
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

Successfully merging this pull request may close these issues.

4 participants