Developers
Start building
Themes/Theme SDK/Modules/consent/Types: ConsentCategory to ConsentToggleProps

Types: ConsentCategory to ConsentToggleProps

The types of @poltura/theme-sdk/consent, ConsentCategory to ConsentToggleProps.

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

ConsentCategory

A cookie category.

type ConsentCategory = 'necessary' | 'preferences' | 'analytics' | 'marketing'

The shopper can allow or refuse it; necessary is always allowed.

ConsentChoice

A choice per category.

It covers every category the shopper can refuse.

preferencesrequiredboolean

Whether functional cookies, such as live chat recognition and content caching, are allowed.

analyticsrequiredboolean

Whether analytics and performance cookies are allowed.

marketingrequiredboolean

Whether marketing and advertising cookies are allowed.

A link the banner offers, such as the cookie policy.

labelrequiredstring

The link text in the page language.

hrefrequiredstring

Where the link goes, already localised.

ConsentCookieTableTexts

A cookie table's headings.

namerequiredstring

The cookie name column.

providerrequiredstring

The column naming who sets the cookie.

purposerequiredstring

The column saying what the cookie is for.

expiryrequiredstring

The column saying how long the cookie lasts.

ConsentTexts

The banner and panel texts.

Each is the merchant's wording where set, the store language's otherwise.

titlerequiredstring

The banner heading.

descriptionrequiredstring

The banner text under the heading.

acceptAllrequiredstring

The button that allows every category.

rejectAllrequiredstring

The button that allows only the necessary cookies.

openPreferencesrequiredstring

The link that opens the preferences, or an empty string when the merchant hides it.

preferencesTitlerequiredstring

The preferences panel heading.

preferencesIntroTitlerequiredstring

The heading of the panel's opening paragraph.

preferencesIntrorequiredstring

The panel's opening paragraph.

saverequiredstring

The button that saves the toggles as they stand.

closerequiredstring

The accessible label of the panel's close button.

cookieTablerequiredConsentCookieTableTexts

The column headings of each category's cookie table.

policyLinkrequiredConsentLink

The cookie policy link.

imprintLinkrequiredConsentLink

The imprint link.

ConsentLayout

The banner's shape.

type ConsentLayout = 'cloud' | 'box' | 'bar'

A floating cloud, a compact box or a full-width bar.

ConsentPosition

Where the banner sits.

type ConsentPosition = 'bottomCenter' | 'bottomLeft' | 'bottomRight' | 'topCenter' | 'topLeft' | 'topRight' | 'middleCenter'

A bar uses only the top or bottom half of it.

ConsentColors

The banner's colours.

Each is a CSS colour or a design token reference such as var(--card).

backgroundrequiredstring

The banner background.

textrequiredstring

The heading and text colour.

buttonBackgroundrequiredstring

The accept button's background.

buttonTextrequiredstring

The accept button's text.

secondaryButtonBackgroundrequiredstring

The other buttons' background.

secondaryButtonTextrequiredstring

The other buttons' text.

ConsentAppearance

The banner's settings.

How the merchant set it up in the theme's cookie settings.

layoutrequiredConsentLayout

The banner's shape.

positionrequiredConsentPosition

Where the banner sits.

equalButtonsrequiredboolean

Whether both choice buttons carry the same weight.

flipButtonsrequiredboolean

Whether the choice buttons swap places.

showPreferencesrequiredboolean

Whether the banner offers the preferences panel.

colorsrequiredConsentColors

The colours in light mode.

darkColorsrequiredConsentColors

The colours in dark mode.

ConsentCookie

A cookie the store may set, listed under its category in the preferences panel.

namerequiredstring

The cookie's name or name pattern, such as `_ga, _ga_*`.

providerrequiredstring

Who sets the cookie.

purposerequiredstring

What the cookie is for, in the page language.

expiryrequiredstring

How long the cookie lasts, in the page language.

ConsentCategoryInfo

A category as listed.

The preferences panel lists it this way.

idrequiredConsentCategory

The category.

labelrequiredstring

Its heading in the page language.

descriptionrequiredstring

What it covers, in the page language.

requiredrequiredboolean

Whether the shopper cannot refuse it; true only for `necessary`.

cookiesrequiredreadonly ConsentCookie[]

The cookies it covers.

ConsentState

The shopper's consent, the banner's wording and look, and the actions that record a choice.

enabledrequiredboolean

Whether the store asks for consent at all; false when the merchant turned the banner off or no cookie in use needs it.

decidedrequiredboolean

Whether the shopper has made a choice that is still stored.

grantedrequiredReadonly<Record<ConsentCategory, boolean>>

What is allowed now, per category; `necessary` is always true.

acceptAllrequired() => void

Allows every category and stores the choice.

rejectAllrequired() => void

Allows only the necessary cookies and stores the choice.

saverequired(choice: ConsentChoice) => void

Stores a choice per category.

preferencesOpenrequiredboolean

Whether the preferences panel is open.

openPreferencesrequired() => void

Opens the preferences panel.

closePreferencesrequired() => void

Closes the preferences panel without changing the choice.

textsrequiredConsentTexts

Every text the banner and the panel show.

appearancerequiredConsentAppearance

How the merchant set the banner up.

categoriesrequiredreadonly ConsentCategoryInfo[]

The categories in the order the panel lists them, `necessary` first.

ConsentBannerClassKey

The banner's stylable parts.

type ConsentBannerClassKey = 'body' | 'texts' | 'title' | 'description' | 'buttons' | 'acceptAll' | 'rejectAll' | 'footer' | 'links'

The parts of ConsentBanner a theme can add classes to.

ConsentBannerProps

Props of ConsentBanner.

classNamestring

Classes added to the banner.

classesPartial<Record<ConsentBannerClassKey, string>>

Classes added to the banner's inner elements.

ConsentPreferencesClassKey

The panel's stylable parts.

type ConsentPreferencesClassKey = 'overlay' | 'header' | 'title' | 'close' | 'body' | 'intro' | 'category' | 'categoryTitle' | 'categoryDescription' | 'table' | 'footer' | 'acceptAll' | 'rejectAll' | 'save'

The parts of ConsentPreferences a theme can add classes to.

ConsentPreferencesProps

Props of ConsentPreferences.

classNamestring

Classes added to the panel.

classesPartial<Record<ConsentPreferencesClassKey, string>>

Classes added to the panel's inner elements.

ConsentToggleProps

Props of ConsentToggle.

categoryrequiredConsentCategory

The category the switch allows or refuses.

classNamestring

Classes added to the switch.

Last updated