@c15t/nextjs 2.0.0-rc.7 → 2.0.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/iab/styles.css +12 -1
- package/dist/iab/styles.tw3.css +14 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +10 -1
- package/dist/styles.tw3.css +13 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist-types/headless.d.ts +1 -1
- package/dist-types/index.d.ts +2 -2
- package/dist-types/libs/browser-initial-data.d.ts +2 -2
- package/dist-types/libs/initial-data.d.ts +1 -1
- package/dist-types/types.d.ts +3 -3
- package/dist-types/version.d.ts +1 -1
- package/docs/building-headless-components.md +40 -22
- package/docs/callbacks.md +76 -9
- package/docs/components/consent-banner.md +83 -9
- package/docs/components/consent-dialog.md +12 -2
- package/docs/components/consent-manager-provider.md +3 -1
- package/docs/components/consent-widget.md +61 -8
- package/docs/concepts/client-modes.md +16 -4
- package/docs/concepts/initialization-flow.md +9 -2
- package/docs/concepts/policy-packs.md +2 -2
- package/docs/hooks/use-consent-manager/overview.md +17 -3
- package/docs/hooks/use-ssr-status.md +1 -1
- package/docs/hooks/use-translations.md +1 -0
- package/docs/iab/consent-banner.md +2 -5
- package/docs/iab/consent-dialog.md +3 -6
- package/docs/iab/overview.md +11 -5
- package/docs/integrations/building-integrations.md +405 -0
- package/docs/integrations/databuddy.md +22 -5
- package/docs/integrations/google-tag-manager.md +2 -2
- package/docs/integrations/google-tag.md +2 -29
- package/docs/integrations/linkedin-insights.md +1 -1
- package/docs/integrations/meta-pixel.md +1 -1
- package/docs/integrations/microsoft-uet.md +1 -1
- package/docs/integrations/overview.md +18 -2
- package/docs/integrations/posthog.md +39 -17
- package/docs/integrations/tiktok-pixel.md +1 -1
- package/docs/integrations/x-pixel.md +1 -1
- package/docs/optimization.md +68 -9
- package/docs/policy-packs.md +7 -7
- package/docs/quickstart.md +11 -5
- package/docs/script-loader.md +22 -1
- package/docs/server-side.md +1 -1
- package/docs/styling/tailwind.md +23 -17
- package/iab/styles.css +1 -0
- package/package.json +10 -8
- package/readme.json +4 -0
- package/src/iab/styles.css +6 -4
- package/src/iab/styles.tw3.css +8 -4
- package/src/styles.css +3 -3
- package/src/styles.tw3.css +7 -4
- package/styles.css +1 -0
|
@@ -64,20 +64,14 @@ Widget copy should be changed through `ConsentManagerProvider.options.i18n` so t
|
|
|
64
64
|
|
|
65
65
|
## Advanced: Compound Components
|
|
66
66
|
|
|
67
|
-
Use compound components only when you need to rearrange the widget's existing primitives:
|
|
67
|
+
Use compound components only when you need to rearrange the widget's existing primitives while keeping policy-aware action grouping:
|
|
68
68
|
|
|
69
69
|
```tsx
|
|
70
70
|
<ConsentWidget.Root>
|
|
71
71
|
<ConsentWidget.Accordion type="multiple">
|
|
72
72
|
<ConsentWidget.AccordionItems />
|
|
73
73
|
</ConsentWidget.Accordion>
|
|
74
|
-
<ConsentWidget.
|
|
75
|
-
<ConsentWidget.FooterSubGroup>
|
|
76
|
-
<ConsentWidget.RejectButton />
|
|
77
|
-
<ConsentWidget.AcceptAllButton />
|
|
78
|
-
</ConsentWidget.FooterSubGroup>
|
|
79
|
-
<ConsentWidget.SaveButton />
|
|
80
|
-
</ConsentWidget.Footer>
|
|
74
|
+
<ConsentWidget.PolicyActions />
|
|
81
75
|
</ConsentWidget.Root>
|
|
82
76
|
```
|
|
83
77
|
|
|
@@ -89,12 +83,71 @@ Use compound components only when you need to rearrange the widget's existing pr
|
|
|
89
83
|
* `ConsentWidget.AccordionContent` — Collapsible content area
|
|
90
84
|
* `ConsentWidget.AccordionArrow` — Expand/collapse indicator
|
|
91
85
|
* `ConsentWidget.Switch` — Category toggle switch
|
|
86
|
+
* `ConsentWidget.PolicyActions` — Renders grouped policy-aware actions
|
|
92
87
|
* `ConsentWidget.Footer` — Footer container
|
|
93
88
|
* `ConsentWidget.FooterSubGroup` — Groups related buttons
|
|
94
89
|
* `ConsentWidget.AcceptAllButton` — Accepts all consent
|
|
95
90
|
* `ConsentWidget.RejectButton` — Rejects all consent
|
|
96
91
|
* `ConsentWidget.SaveButton` — Saves custom selections
|
|
97
92
|
|
|
93
|
+
## Using `renderAction` with c15t Defaults
|
|
94
|
+
|
|
95
|
+
`ConsentWidget.PolicyActions` renders stock c15t buttons and translations by default.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<ConsentWidget.PolicyActions />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`renderAction` is optional. Return the stock button compounds when you want custom mapping while preserving built-in c15t behavior and copy:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<ConsentWidget.PolicyActions
|
|
105
|
+
renderAction={(action, props) => {
|
|
106
|
+
const { key, ...buttonProps } = props
|
|
107
|
+
|
|
108
|
+
switch (action) {
|
|
109
|
+
case 'accept':
|
|
110
|
+
return <ConsentWidget.AcceptAllButton key={key} {...buttonProps} />
|
|
111
|
+
case 'reject':
|
|
112
|
+
return <ConsentWidget.RejectButton key={key} {...buttonProps} />
|
|
113
|
+
case 'customize':
|
|
114
|
+
return <ConsentWidget.SaveButton key={key} {...buttonProps} />
|
|
115
|
+
}
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Use `useTranslations()` only when you are replacing the button markup entirely:
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import { ConsentWidget, useTranslations } from '@c15t/react';
|
|
124
|
+
|
|
125
|
+
export function CustomWidgetActions() {
|
|
126
|
+
const { common } = useTranslations();
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<ConsentWidget.PolicyActions
|
|
130
|
+
renderAction={(action, props) => (
|
|
131
|
+
<button
|
|
132
|
+
key={props.key}
|
|
133
|
+
type="button"
|
|
134
|
+
className={props.isPrimary ? 'btn-primary' : 'btn-secondary'}
|
|
135
|
+
style={props.style}
|
|
136
|
+
>
|
|
137
|
+
{action === 'accept'
|
|
138
|
+
? common.acceptAll
|
|
139
|
+
: action === 'reject'
|
|
140
|
+
? common.rejectAll
|
|
141
|
+
: common.save}
|
|
142
|
+
</button>
|
|
143
|
+
)}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For a fixed footer layout, render `ConsentWidget.Footer` and `ConsentWidget.FooterSubGroup` manually instead of using `ConsentWidget.PolicyActions`.
|
|
150
|
+
|
|
98
151
|
If the stock widget structure is already correct, stay with tokens and slots instead of rebuilding the layout.
|
|
99
152
|
|
|
100
153
|
## Props
|
|
@@ -4,12 +4,12 @@ description: Choose how c15t connects to its backend - full hosted integration,
|
|
|
4
4
|
---
|
|
5
5
|
c15t supports three client modes that determine how consent data is stored and synchronized. Choose the mode that matches your infrastructure:
|
|
6
6
|
|
|
7
|
-
* **Hosted mode** -
|
|
8
|
-
* **Offline mode** -
|
|
7
|
+
* **Hosted mode** - Recommended for production. Backend-backed consent with geolocation, centralized policy resolution, audit history, and offline fallback.
|
|
8
|
+
* **Offline mode** - Browser-only storage with no network requests. Best for local development, demos, static deployments, or controlled fallback scenarios.
|
|
9
9
|
* **Custom mode** - Bring your own backend with custom endpoint handlers
|
|
10
10
|
|
|
11
11
|
> ℹ️ **Info:**
|
|
12
|
-
>
|
|
12
|
+
> If you need durable consent records, server-side enforcement, or automatic jurisdiction detection, use hosted mode. Offline mode cannot provide those guarantees because consent lives only in the browser.
|
|
13
13
|
|
|
14
14
|
<span id="c15t-mode" />
|
|
15
15
|
|
|
@@ -30,6 +30,13 @@ The default mode. Connects to a c15t backend for full consent lifecycle manageme
|
|
|
30
30
|
|
|
31
31
|
* `backendURL` (required) - API endpoint path
|
|
32
32
|
|
|
33
|
+
**Why it is the default for production:**
|
|
34
|
+
|
|
35
|
+
* The backend stays the source of truth for policy, translations, and jurisdiction logic
|
|
36
|
+
* Consent decisions can be stored beyond the current browser session for audit and support workflows
|
|
37
|
+
* Server-side systems can preload consent-aware behavior instead of waiting for client-only storage
|
|
38
|
+
* If the backend is temporarily unavailable, c15t can fall back locally and re-sync later
|
|
39
|
+
|
|
33
40
|
**Best for:** Production apps that need geolocation-based jurisdiction detection, consent record storage, and compliance audit trails.
|
|
34
41
|
|
|
35
42
|
```tsx
|
|
@@ -78,10 +85,12 @@ If consent is not stored at all (for example, storage is blocked or frequently c
|
|
|
78
85
|
|
|
79
86
|
* No automatic geolocation or jurisdiction detection
|
|
80
87
|
* No consent audit trail
|
|
88
|
+
* No centralized policy or translation updates without shipping frontend changes
|
|
81
89
|
* No cross-device sync
|
|
90
|
+
* No server-side visibility before client initialization
|
|
82
91
|
* Works without any backend infrastructure
|
|
83
92
|
|
|
84
|
-
**Best for:**
|
|
93
|
+
**Best for:** Local development, Storybook/static demos, resilience fallback, or simpler sites that explicitly accept browser-only consent storage.
|
|
85
94
|
|
|
86
95
|
```tsx
|
|
87
96
|
import { type ReactNode } from 'react';
|
|
@@ -156,7 +165,10 @@ export function ConsentManager({ children }: { children: ReactNode }) {
|
|
|
156
165
|
|Feature|Hosted|Offline|Custom|
|
|
157
166
|
|--|--|--|--|
|
|
158
167
|
|Geolocation|Automatic|Manual via overrides|Your implementation|
|
|
168
|
+
|Policy source of truth|Backend-managed|Bundled into the frontend|Your implementation|
|
|
159
169
|
|Consent sync|API|Local only|Your implementation|
|
|
170
|
+
|Audit trail|Backend records|Not available|Your implementation|
|
|
171
|
+
|Server-side consent awareness|Supported|Not available|Your implementation|
|
|
160
172
|
|SSR data|Supported|Not available|Your implementation|
|
|
161
173
|
|Analytics|Built-in|Not available|Your implementation|
|
|
162
174
|
|Infrastructure|c15t backend|None|Your backend|
|
|
@@ -88,7 +88,7 @@ If the resolved model is `none` or `opt-out` (and `ui.mode` is `none`), consents
|
|
|
88
88
|
|
|
89
89
|
## Debugging the Lifecycle
|
|
90
90
|
|
|
91
|
-
Use the DevTools panel and callbacks to inspect each step of the initialization flow
|
|
91
|
+
Use the DevTools panel and callbacks to inspect each step of the initialization flow. `onConsentSet` is the broad lifecycle signal; `onConsentChanged` and `subscribeToConsentChanges()` are the change-only signals for explicit post-init saves.
|
|
92
92
|
|
|
93
93
|
|Step|DevTools Panel|Callback|What to check|
|
|
94
94
|
|--|--|--|--|
|
|
@@ -98,6 +98,7 @@ Use the DevTools panel and callbacks to inspect each step of the initialization
|
|
|
98
98
|
|Banner visibility|Consents|—|`activeUI` in store state; does policy `ui.mode` require it?|
|
|
99
99
|
|Re-prompting|Policy|—|Fingerprint mismatch between stored and resolved policy?|
|
|
100
100
|
|Consent save|Consents + Events|`onConsentSet`|`preferences` object in callback payload|
|
|
101
|
+
|Change-only integrations|Events|`onConsentChanged` or `subscribeToConsentChanges()`|`allowedCategories`, `deniedCategories`, and previous values only when a real save changed preferences|
|
|
101
102
|
|Script loading|Scripts|`onConsentSet`|Script IDs and their load/blocked status|
|
|
102
103
|
|Reload on revocation|Events|`onBeforeConsentRevocationReload`|Fires before reload; check localStorage for `c15t:pending-consent-sync`|
|
|
103
104
|
|Deferred sync|Events|`onError` (if sync fails)|After reload, check Events panel for successful API call|
|
|
@@ -120,7 +121,13 @@ export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
|
120
121
|
console.log('Init complete:', { jurisdiction, location });
|
|
121
122
|
},
|
|
122
123
|
onConsentSet: ({ preferences }) => {
|
|
123
|
-
console.log('
|
|
124
|
+
console.log('Broad consent lifecycle event:', preferences);
|
|
125
|
+
},
|
|
126
|
+
onConsentChanged: ({ allowedCategories, deniedCategories }) => {
|
|
127
|
+
console.log('Explicit consent change:', {
|
|
128
|
+
allowedCategories,
|
|
129
|
+
deniedCategories,
|
|
130
|
+
});
|
|
124
131
|
},
|
|
125
132
|
onBeforeConsentRevocationReload: ({ preferences }) => {
|
|
126
133
|
console.log('Reloading due to revocation:', preferences);
|
|
@@ -10,9 +10,9 @@ There are three ways to configure policy packs:
|
|
|
10
10
|
|
|
11
11
|
1. **consent.io (recommended)** — use [consent.io](https://consent.io) as your hosted backend. Configure packs visually in the dashboard or via API — no code changes required. Works with any frontend, including static sites.
|
|
12
12
|
2. **Self-hosted backend** — define packs in code via `policyPacks` and resolve them from real request geo data. Full control over policy logic and storage.
|
|
13
|
-
3. **Offline fallback** — pass the same policy shapes to the frontend via `offlinePolicy.policyPacks`.
|
|
13
|
+
3. **Offline fallback** — pass the same policy shapes to the frontend via `offlinePolicy.policyPacks`. Use this mainly for local development, demos, deterministic testing, or resilience when the backend is temporarily unreachable. If you omit `offlinePolicy.policyPacks`, c15t falls back to a synthetic worldwide opt-in banner instead of no-banner mode.
|
|
14
14
|
|
|
15
|
-
In both hosted and self-hosted modes, the **backend is always the source of truth**. Offline packs never override a live backend decision.
|
|
15
|
+
In both hosted and self-hosted modes, the **backend is always the source of truth**. Offline packs are a preview or fallback layer and never override a live backend decision.
|
|
16
16
|
|
|
17
17
|
## Quickstart
|
|
18
18
|
|
|
@@ -27,7 +27,7 @@ function MyComponent() {
|
|
|
27
27
|
|
|
28
28
|
|Property|Type|Description|Default|Required|
|
|
29
29
|
|:--|:--|:--|:--|:--:|
|
|
30
|
-
|branding|"c15t" \|"consent" \|"none"|Whether to show the branding
|
|
30
|
+
|branding|"c15t" \|"inth" \|"consent" \|"none"|Whether to show the branding. "consent" is a deprecated alias for "inth".|-|✅ Required|
|
|
31
31
|
|consents|ConsentState|Current consent states for all consent types|-|✅ Required|
|
|
32
32
|
|selectedConsents|ConsentState|Selected consents (Not Saved) - use saveConsents to save|-|✅ Required|
|
|
33
33
|
|consentInfo|ConsentInfo \|null|Information about when and how consent was given|-|✅ Required|
|
|
@@ -53,7 +53,7 @@ function MyComponent() {
|
|
|
53
53
|
|iab|IABManager \|null|IAB TCF 2.3 state and actions (null when not configured or not in IAB mode).|-|✅ Required|
|
|
54
54
|
|reloadOnConsentRevoked|boolean|Whether to reload the page when consent is revoked.|-|✅ Required|
|
|
55
55
|
|ssrDataUsed|boolean|Whether SSR data was successfully used for initialization.|-|✅ Required|
|
|
56
|
-
|ssrSkippedReason|
|
|
56
|
+
|ssrSkippedReason|SSRSkippedReason|Reason SSR data was skipped, if applicable.|-|✅ Required|
|
|
57
57
|
|
|
58
58
|
#### `consents` ConsentState
|
|
59
59
|
|
|
@@ -87,7 +87,7 @@ Information about when and how consent was given
|
|
|
87
87
|
|:--|:--|:--|:--|:--:|
|
|
88
88
|
|time|number|The epoch timestamp of when the consent was recorded|-|✅ Required|
|
|
89
89
|
|subjectId|string \|undefined|The client-generated subject ID in sub\_xxx format|-|Optional|
|
|
90
|
-
|id|string \|undefined
|
|
90
|
+
|id|string \|undefined|Configuration for the legal links @remarks Legal links can display across different parts of the consent manager such as the consent banner & dialog.|-|Optional|
|
|
91
91
|
|externalId|string \|undefined|The external user ID linked to this subject|-|Optional|
|
|
92
92
|
|materialPolicyFingerprint|string \|undefined|Material fingerprint of the active policy when this consent was accepted.|-|Optional|
|
|
93
93
|
|identityProvider|string \|undefined|The identity provider that provided the external ID|-|Optional|
|
|
@@ -196,6 +196,7 @@ IAB TCF 2.3 state and actions (null when not configured or not in IAB mode).
|
|
|
196
196
|
|setActiveUI|(ui: ActiveUI, options?: \{ force?: boolean \|undefined; } \|undefined) => void|Sets the active consent UI component.|-|✅ Required|
|
|
197
197
|
|setConsentCategories|(types: AllConsentNames\[]) => void|Updates the active GDPR consent types.|-|✅ Required|
|
|
198
198
|
|setCallback|Object \|undefined|Sets a callback for a specific consent event.|-|✅ Required|
|
|
199
|
+
|subscribeToConsentChanges|Object|Subscribes to change-only consent saves.|-|✅ Required|
|
|
199
200
|
|setLocationInfo|Object \|null|Updates the user's location information.|-|✅ Required|
|
|
200
201
|
|initConsentManager|Object \|undefined \|null|Initializes the consent manager by fetching jurisdiction, location, translations, and branding information.|-|✅ Required|
|
|
201
202
|
|getDisplayedConsents|ConsentType|Retrieves the list of consent types that should be displayed|-|✅ Required|
|
|
@@ -245,6 +246,19 @@ Identifies the user by setting the external ID.
|
|
|
245
246
|
|id|string|Usually your own internal ID for the user from your auth provider|-|✅ Required|
|
|
246
247
|
|identityProvider|string \|undefined|The identity provider of the user. Usually the name of the identity provider e.g. 'clerk', 'auth0', 'custom', etc.|-|Optional|
|
|
247
248
|
|
|
249
|
+
#### `subscribeToConsentChanges`
|
|
250
|
+
|
|
251
|
+
Subscribes to change-only consent saves.
|
|
252
|
+
|
|
253
|
+
|Property|Type|Description|Default|Required|
|
|
254
|
+
|:--|:--|:--|:--|:--:|
|
|
255
|
+
|preferences|ConsentState|-|-|✅ Required|
|
|
256
|
+
|previousPreferences|ConsentState|-|-|✅ Required|
|
|
257
|
+
|allowedCategories|AllConsentNames|-|-|✅ Required|
|
|
258
|
+
|deniedCategories|AllConsentNames|-|-|✅ Required|
|
|
259
|
+
|previousAllowedCategories|AllConsentNames|-|-|✅ Required|
|
|
260
|
+
|previousDeniedCategories|AllConsentNames|-|-|✅ Required|
|
|
261
|
+
|
|
248
262
|
#### `setLocationInfo`
|
|
249
263
|
|
|
250
264
|
Updates the user's location information.
|
|
@@ -25,7 +25,7 @@ function DebugSSR() {
|
|
|
25
25
|
|Property|Type|Description|Default|Required|
|
|
26
26
|
|:--|:--|:--|:--|:--:|
|
|
27
27
|
|ssrDataUsed|boolean|Whether SSR data was used for initialization. \`true\` if SSR data was provided and successfully consumed, \`false\` otherwise.|-|✅ Required|
|
|
28
|
-
|ssrSkippedReason|"no\_data" \|"fetch\_failed" \|null|Reason SSR data was skipped, or \`null\` if used successfully.|-|✅ Required|
|
|
28
|
+
|ssrSkippedReason|"no\_data" \|"fetch\_failed" \|"context\_mismatch" \|null|Reason SSR data was skipped, or \`null\` if used successfully.|-|✅ Required|
|
|
29
29
|
|
|
30
30
|
> ℹ️ **Info:**
|
|
31
31
|
> Must be used within a ConsentManagerProvider. Throws if used outside the provider context.
|
|
@@ -46,6 +46,7 @@ The returned `Translations` object has these sections:
|
|
|
46
46
|
|customize|string \|undefined|-|-|✅ Required|
|
|
47
47
|
|save|string \|undefined|-|-|✅ Required|
|
|
48
48
|
|close|string \|undefined|-|-|✅ Required|
|
|
49
|
+
|securedBy|string \|undefined|-|-|✅ Required|
|
|
49
50
|
|
|
50
51
|
#### `cookieBanner` CookieBannerTranslations
|
|
51
52
|
|
|
@@ -19,11 +19,8 @@ Use this component instead of `ConsentBanner` when you need IAB TCF compliance f
|
|
|
19
19
|
|
|
20
20
|
```tsx
|
|
21
21
|
import { type ReactNode } from 'react';
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
IABConsentBanner,
|
|
25
|
-
IABConsentDialog,
|
|
26
|
-
} from '@c15t/nextjs';
|
|
22
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
23
|
+
import { IABConsentBanner, IABConsentDialog } from '@c15t/react/iab';
|
|
27
24
|
|
|
28
25
|
export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
29
26
|
return (
|
|
@@ -13,11 +13,8 @@ Pair it with `IABConsentBanner` inside the provider:
|
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
import { type ReactNode } from 'react';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
IABConsentBanner,
|
|
19
|
-
IABConsentDialog,
|
|
20
|
-
} from '@c15t/nextjs';
|
|
16
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
17
|
+
import { IABConsentBanner, IABConsentDialog } from '@c15t/react/iab';
|
|
21
18
|
|
|
22
19
|
export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
23
20
|
return (
|
|
@@ -76,7 +73,7 @@ By default, the dialog follows `activeUI === 'dialog'` from the consent store. U
|
|
|
76
73
|
|
|
77
74
|
```tsx
|
|
78
75
|
import { useState } from 'react';
|
|
79
|
-
import { IABConsentDialog } from '@c15t/
|
|
76
|
+
import { IABConsentDialog } from '@c15t/react/iab';
|
|
80
77
|
|
|
81
78
|
function SettingsPage() {
|
|
82
79
|
const [open, setOpen] = useState(false);
|
package/docs/iab/overview.md
CHANGED
|
@@ -32,15 +32,21 @@ c15t provides a complete IAB TCF 2.3 CMP (Consent Management Platform) implement
|
|
|
32
32
|
4. **TC String generation** — Consent choices are encoded into the standard TC String format.
|
|
33
33
|
5. **`__tcfapi` stub** — The standard CMP API is exposed on `window` so vendor scripts can query consent.
|
|
34
34
|
|
|
35
|
+
If you use the prebuilt styled IAB UI, add your framework's `iab/styles.css` entrypoint alongside the base c15t stylesheet. IAB CSS is published separately so apps that do not render IAB surfaces do not ship those component rules.
|
|
36
|
+
|
|
35
37
|
## Quick Setup
|
|
36
38
|
|
|
39
|
+
If you use the prebuilt styled IAB UI, import the IAB stylesheet alongside the base stylesheet in your global CSS entrypoint:
|
|
40
|
+
|
|
41
|
+
```css title="src/app/globals.css"
|
|
42
|
+
@import "@c15t/nextjs/styles.css";
|
|
43
|
+
@import "@c15t/nextjs/iab/styles.css";
|
|
44
|
+
```
|
|
45
|
+
|
|
37
46
|
```tsx
|
|
38
47
|
import { type ReactNode } from 'react';
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
IABConsentBanner,
|
|
42
|
-
IABConsentDialog,
|
|
43
|
-
} from '@c15t/nextjs';
|
|
48
|
+
import { ConsentManagerProvider } from '@c15t/nextjs';
|
|
49
|
+
import { IABConsentBanner, IABConsentDialog } from '@c15t/react/iab';
|
|
44
50
|
|
|
45
51
|
export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
46
52
|
return (
|