UNPKG

react-cookie-consent_teset2

Version:

React components to integrate TrustArc Cookie Consent Manager into React and Next.js apps

147 lines (146 loc) 5.09 kB
import { TrustArcVersion } from "../enum/trustarc-version.enum.js"; export interface TrustArcOptions { /** * The ID of the container where the consent banner will be injected. * Versions supported: Pro and Advanced. * Defaults to "consent_blackbar" or "consent-banner" (for "pro" version). */ cookiePreferencesContainer?: string; /** * Whether the "Cookie Preferences" link should be displayed as a button. * Versions supported: Advanced. * @default false */ showCookiePreferencesAsButton?: boolean; /** * ID of the container where the IRM link will be injected. * Versions supported: Advanced. * @default "" */ irmContainer?: string; /** * The JavaScript type used for the TrustArc script. * Common values: "nj" (default) * Versions supported: Advanced. * @default "nj" */ js?: string; /** * The type of notice to display. * Common values: "bb" (banner), "ib" (inline), "fs" (full screen) * Versions supported: Advanced. * @default "bb" */ noticeType?: string; /** * Overrides TrustArc's dynamic IP detection for country-based settings. * Must be a two-letter ISO country code (e.g., "us", "de", "fr"). Only valid for Advanced version. * For Pro please inform an IP address from the location you want to simulate. * Versions supported: Pro and Advanced. * @default "" */ countryCodeorIP?: string; /** * The state code to pre-configure state-specific consent behavior. * Example: "ca" (California), "ny" (New York). Only valid for Advanced version. * Versions supported: Advanced. * @default "" */ state?: string; /** * Overrides browser language detection. * Must be a two-letter ISO language code (e.g., "en", "fr", "de"). * CCM Advanced accepts localized language codes (e.g., "en-us", "fr-ca"). * Versions supported: Pro and Advanced. * @default "" */ language?: string; /** * Controls if cookies should be dropped at the parent level. * Example: true or false * Versions supported: Pro and Advanced. * @default false */ pcookie?: boolean; /** * Forces specific behavior for the consent manager. * Acceptable values: "expressed" or "implied" * Versions supported: Advanced. * @default "" */ behavior?: string; /** * Overrides the default privacy policy link in the Consent Manager. * Must be a properly encoded URL and should be the last parameter in the script URL. * Versions supported: Pro and Advanced. * @default "" */ privacyPolicyLink?: string; /** * Specifies the version of the TrustArc Consent Manager. * - "pro": Uses the TrustArc Pro version with a specific script URL. * - "advanced": Uses the standard script with more customization options. * @default TrustArcVersion.advanced */ ccmVersion?: TrustArcVersion; /** * Loads a specific page in the Consent Manager as the first screen. * - "1": Loads the slider page first (omits disclosure page). * - "2": Loads the Advanced Settings window first. * - "Imp#-Exp#": Controls implied (Imp#) and expressed (Exp#) consent behavior. * - "0" = Disclosure page, "1" = Slider/basic settings, "2" = Advanced settings. * Versions supported: Advanced. * @default "" */ pn?: "1" | "2" | string; /** * Allows closing the Consent Manager by clicking outside the frame. * Versions supported: Advanced. * @default false */ onclose?: boolean; /** * To use radio buttons instead of slider bars for the consent banner. * Versions supported: Advanced. * @default false */ ostype?: boolean; /** * Time in milliseconds before the banner fades. * If the user does not choose a consent action, the banner reappears on page refresh. * Versions supported: Advanced. * @default 0 */ fade?: number; /** * Number of pixels the user must scroll before the banner collapses and sets consent to "accept". * Versions supported: Advanced. * @default 0 */ px?: number; /** * Encoded URL for the cookie policy. * This will display as a button in the consent banner linking to the specified URL. * Versions supported: Pro and Advanced. * @default "" */ cookiePolicyLink?: string; /** * Use this parameter to override the privacy policy link in the CM. * This URL must be encoded and MUST BE placed as the last parameter in the CM script. * Versions supported: Pro and Advanced. * @default "" */ privacypolicylink?: string; /** * Determines whether the TrustArc script should be loaded asynchronously. * Versions supported: Pro and Advanced. * @default true */ loadScriptAsync?: boolean; /** * Enables debug logging in the console for troubleshooting. * @default false */ debug?: boolean; }