Developers
Start building
Themes/Theme SDK/Modules/consent/Defaults

Defaults

The defaults of @poltura/theme-sdk/consent.

On this page
import { … } from '@poltura/theme-sdk/consent';

The complete cookie consent: the banner until the shopper chooses and the preferences panel while it is open.

Consent(props: ConsentProps): ReactElement | null

The storefront draws it on every page. A theme replaces it with the default export of src/layout/consent.tsx; the stored choice and what it lets the trackers do stay the platform's.

Props: ConsentProps

// src/layout/consent.tsx
import { ConsentBanner, ConsentPreferences, useConsent } from '@poltura/theme-sdk/consent';

export default function ThemeConsent() {
  const consent = useConsent();
  if (consent.decided && !consent.preferencesOpen) return null;
  return consent.preferencesOpen ? <ConsentPreferences /> : <ConsentBanner className='theme-consent' />;
}

See also: ConsentBanner, ConsentPreferences, useConsent

Last updated