Skip to content

feat(scripts): integrate consent manager with control panel privacy setting#2658

Closed
matthewvolk wants to merge 2 commits intocanaryfrom
feat/consent-manager-cp-settings
Closed

feat(scripts): integrate consent manager with control panel privacy setting#2658
matthewvolk wants to merge 2 commits intocanaryfrom
feat/consent-manager-cp-settings

Conversation

@matthewvolk
Copy link
Copy Markdown
Contributor

Warning

Depends on #2651

What/Why?

This PR integrates cookie consent management with the storefront's Control Panel settings, ensuring that Catalyst's consent behavior matches Stencil's Cornerstone implementation 1:1. Includes:

  1. Control Panel Integration: The consent manager now respects the site.settings.privacy.cookieConsentEnabled setting from the storefront channel configuration documented here: https://support.bigcommerce.com/s/article/Security-and-Privacy-Settings
  2. Simplified Component Architecture: Consolidated consent management into a single ConsentManager component that wraps the provider, dialog, and banner, aligning more closely with @c15t/nextjs official documentation: https://c15t.com/docs/frameworks/next/quickstart
  3. Stencil-Compatible Script Loading: Script category loading now follows Stencil's logic exactly:
    • Cookie consent disabled: ALL script categories are loaded regardless of consent state
    • Cookie consent enabled, no user consent yet: Only "Essential", "Targeting", and "Unknown" script categories are loaded
    • Cookie consent enabled, user has consented: Scripts from consented categories are loaded, plus "Unknown" scripts (loaded whenever at least one category is consented to)

Testing

Demo:

stencil-parity-consent-manager.mp4

Migration

Deleted file: core/lib/consent-manager/provider.tsx

  • This file has been removed and its functionality moved to core/components/consent-manager/index.tsx

Component usage changes in core/app/[locale]/layout.tsx:

  • Before:

    import { ConsentManagerProvider } from '~/lib/consent-manager';
    import { ConsentManagerDialog } from '~/components/consent-manager/consent-manager-dialog';
    import { CookieBanner } from '~/components/consent-manager/cookie-banner';
    
    <ConsentManagerProvider>
      <ConsentManagerDialog />
      <CookieBanner />
      {children}
    </ConsentManagerProvider>
  • After:

    import { ConsentManager } from '~/components/consent-manager';
    
    const cookieConsentEnabled = rootData.data.site.settings?.privacy?.cookieConsentEnabled;
    
    <ConsentManager cookieConsentEnabled={cookieConsentEnabled}>
      {children}
    </ConsentManager>

GraphQL query changes:

  • The RootLayoutMetadataQuery now includes privacy.cookieConsentEnabled field
  • If you've customized this query, ensure you add the privacy settings

Handler signature changes:

  • showConsentBanner() in core/lib/consent-manager/handlers.ts now accepts an optional cookieConsentEnabled parameter

@matthewvolk matthewvolk requested a review from a team October 29, 2025 20:13
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 29, 2025

🦋 Changeset detected

Latest commit: 7385c80

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
Copy Markdown

vercel Bot commented Oct 29, 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 29, 2025 8:20pm
catalyst-canary Ready Ready Preview Comment Oct 29, 2025 8:20pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Oct 29, 2025 8:20pm

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.

1 participant