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.
preferencesrequiredbooleanWhether functional cookies, such as live chat recognition and content caching, are allowed.
analyticsrequiredbooleanWhether analytics and performance cookies are allowed.
marketingrequiredbooleanWhether marketing and advertising cookies are allowed.
ConsentLink
A link the banner offers, such as the cookie policy.
labelrequiredstringThe link text in the page language.
hrefrequiredstringWhere the link goes, already localised.
ConsentCookieTableTexts
A cookie table's headings.
namerequiredstringThe cookie name column.
providerrequiredstringThe column naming who sets the cookie.
purposerequiredstringThe column saying what the cookie is for.
expiryrequiredstringThe 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.
titlerequiredstringThe banner heading.
descriptionrequiredstringThe banner text under the heading.
acceptAllrequiredstringThe button that allows every category.
rejectAllrequiredstringThe button that allows only the necessary cookies.
openPreferencesrequiredstringThe link that opens the preferences, or an empty string when the merchant hides it.
preferencesTitlerequiredstringThe preferences panel heading.
preferencesIntroTitlerequiredstringThe heading of the panel's opening paragraph.
preferencesIntrorequiredstringThe panel's opening paragraph.
saverequiredstringThe button that saves the toggles as they stand.
closerequiredstringThe accessible label of the panel's close button.
cookieTablerequiredConsentCookieTableTextsThe column headings of each category's cookie table.
policyLinkrequiredConsentLinkThe cookie policy link.
imprintLinkrequiredConsentLinkThe 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).
backgroundrequiredstringThe banner background.
textrequiredstringThe heading and text colour.
buttonBackgroundrequiredstringThe accept button's background.
buttonTextrequiredstringThe accept button's text.
secondaryButtonBackgroundrequiredstringThe other buttons' background.
secondaryButtonTextrequiredstringThe other buttons' text.
ConsentAppearance
The banner's settings.
How the merchant set it up in the theme's cookie settings.
layoutrequiredConsentLayoutThe banner's shape.
positionrequiredConsentPositionWhere the banner sits.
equalButtonsrequiredbooleanWhether both choice buttons carry the same weight.
flipButtonsrequiredbooleanWhether the choice buttons swap places.
showPreferencesrequiredbooleanWhether the banner offers the preferences panel.
colorsrequiredConsentColorsThe colours in light mode.
darkColorsrequiredConsentColorsThe colours in dark mode.
ConsentCookie
A cookie the store may set, listed under its category in the preferences panel.
namerequiredstringThe cookie's name or name pattern, such as `_ga, _ga_*`.
providerrequiredstringWho sets the cookie.
purposerequiredstringWhat the cookie is for, in the page language.
expiryrequiredstringHow long the cookie lasts, in the page language.
ConsentCategoryInfo
A category as listed.
The preferences panel lists it this way.
idrequiredConsentCategoryThe category.
labelrequiredstringIts heading in the page language.
descriptionrequiredstringWhat it covers, in the page language.
requiredrequiredbooleanWhether 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.
enabledrequiredbooleanWhether the store asks for consent at all; false when the merchant turned the banner off or no cookie in use needs it.
decidedrequiredbooleanWhether 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() => voidAllows every category and stores the choice.
rejectAllrequired() => voidAllows only the necessary cookies and stores the choice.
saverequired(choice: ConsentChoice) => voidStores a choice per category.
preferencesOpenrequiredbooleanWhether the preferences panel is open.
openPreferencesrequired() => voidOpens the preferences panel.
closePreferencesrequired() => voidCloses the preferences panel without changing the choice.
textsrequiredConsentTextsEvery text the banner and the panel show.
appearancerequiredConsentAppearanceHow 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.
classNamestringClasses 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.
classNamestringClasses added to the panel.
classesPartial<Record<ConsentPreferencesClassKey, string>>Classes added to the panel's inner elements.
ConsentToggleProps
Props of ConsentToggle.
categoryrequiredConsentCategoryThe category the switch allows or refuses.
classNamestringClasses added to the switch.