@c15t/react 3.0.0-alpha.0 → 3.0.0-alpha.2
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/AGENTS.md +4 -1
- package/dist/aggregate-components.js +1 -1
- package/dist/component-hooks/use-manager.js +1 -1
- package/dist/components/consent-gate/atoms.js +1 -0
- package/dist/components/consent-gate/consent-gate.js +2 -0
- package/dist/components/consent-gate/index.js +2 -0
- package/dist/components/preferences/atoms/accordion.js +1 -1
- package/dist/components/preferences/atoms/vendor-list.js +1 -0
- package/dist/components/preferences/index.js +1 -1
- package/dist/consent-gate.js +2 -0
- package/dist/draft.js +1 -1
- package/dist/external-iab-context.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/iab/styles.tw3.css +4 -110
- package/dist/index.js +1 -1
- package/dist/provider.js +1 -1
- package/dist/styles.tw3.css +10 -113
- package/dist/utils/deferred-module.js +2 -0
- package/dist/version.js +1 -1
- package/dist-types/aggregate-components.d.ts +2 -2
- package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +1 -1
- package/dist-types/component-hooks/use-manager.d.ts +6 -1
- package/dist-types/components/consent-gate/atoms.d.ts +11 -0
- package/dist-types/components/consent-gate/consent-gate.d.ts +2 -0
- package/dist-types/components/consent-gate/index.d.ts +41 -0
- package/dist-types/components/{frame → consent-gate}/types.d.ts +7 -7
- package/dist-types/components/consent-preferences-link/consent-preferences-link.d.ts +1 -1
- package/dist-types/components/consent-preferences-link/index.d.ts +1 -1
- package/dist-types/components/iab-panel/atoms/purpose-item.d.ts +1 -1
- package/dist-types/components/iab-panel/atoms/stack-item.d.ts +1 -1
- package/dist-types/components/iab-panel/atoms/vendor-list.d.ts +1 -1
- package/dist-types/components/iab-panel/iab-panel.d.ts +1 -1
- package/dist-types/components/iab-panel/index.d.ts +24 -24
- package/dist-types/components/iab-prompt/index.d.ts +17 -17
- package/dist-types/components/panel/atoms/card.d.ts +4 -4
- package/dist-types/components/panel/atoms/overlay.d.ts +1 -1
- package/dist-types/components/panel/index.d.ts +7 -7
- package/dist-types/components/panel/panel.d.ts +2 -2
- package/dist-types/components/panel-link/index.d.ts +1 -1
- package/dist-types/components/panel-trigger/atoms/button.d.ts +1 -1
- package/dist-types/components/panel-trigger/atoms/icon.d.ts +1 -1
- package/dist-types/components/panel-trigger/atoms/root.d.ts +2 -2
- package/dist-types/components/panel-trigger/atoms/toolbar.d.ts +2 -2
- package/dist-types/components/panel-trigger/index.d.ts +4 -4
- package/dist-types/components/panel-trigger/panel-trigger-toolbar.d.ts +1 -1
- package/dist-types/components/panel-trigger/panel-trigger.d.ts +9 -9
- package/dist-types/components/panel-trigger/types.d.ts +1 -1
- package/dist-types/components/preferences/atoms/accordion.d.ts +6 -4
- package/dist-types/components/preferences/atoms/button.d.ts +1 -1
- package/dist-types/components/preferences/atoms/footer.d.ts +1 -1
- package/dist-types/components/preferences/atoms/root.d.ts +1 -1
- package/dist-types/components/preferences/atoms/vendor-list.d.ts +23 -0
- package/dist-types/components/preferences/index.d.ts +13 -11
- package/dist-types/components/preferences/policy-actions.d.ts +2 -2
- package/dist-types/components/preferences/preferences.d.ts +1 -1
- package/dist-types/components/preferences/types.d.ts +1 -1
- package/dist-types/components/prompt/components.d.ts +3 -3
- package/dist-types/components/prompt/index.d.ts +11 -11
- package/dist-types/components/prompt/policy-actions.d.ts +2 -2
- package/dist-types/components/prompt/prompt.d.ts +1 -1
- package/dist-types/components/shared/policy-actions.d.ts +2 -2
- package/dist-types/components/shared/primitives/box.d.ts +1 -1
- package/dist-types/components/shared/primitives/button.d.ts +2 -2
- package/dist-types/components/shared/primitives/button.types.d.ts +1 -1
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +2 -2
- package/dist-types/components/shared/ui/accordion/index.d.ts +2 -2
- package/dist-types/components/shared/ui/animated-collapse/index.d.ts +2 -2
- package/dist-types/components/shared/ui/branding.d.ts +1 -1
- package/dist-types/components/shared/ui/button/button.d.ts +1 -1
- package/dist-types/components/shared/ui/button/index.d.ts +2 -2
- package/dist-types/components/shared/ui/collapsible/index.d.ts +1 -1
- package/dist-types/components/shared/ui/dialog/index.d.ts +1 -1
- package/dist-types/components/shared/ui/preference-item/index.d.ts +1 -1
- package/dist-types/components/shared/ui/switch/index.d.ts +2 -2
- package/dist-types/components/shared/ui/switch/switch.d.ts +1 -1
- package/dist-types/components/shared/ui/tabs/index.d.ts +1 -1
- package/dist-types/consent-gate.d.ts +1 -0
- package/dist-types/context/index.d.ts +3 -3
- package/dist-types/context/theme-context.d.ts +1 -1
- package/dist-types/draft.d.ts +53 -1
- package/dist-types/headless.d.ts +7 -7
- package/dist-types/hooks/use-headless-iab-consent-ui.d.ts +1 -1
- package/dist-types/hooks/use-iab-manager.d.ts +1 -1
- package/dist-types/hooks/use-theme.d.ts +1 -1
- package/dist-types/hooks.d.ts +28 -1
- package/dist-types/iab.d.ts +5 -5
- package/dist-types/index.d.ts +25 -25
- package/dist-types/module-hooks.d.ts +4 -4
- package/dist-types/panel-link.d.ts +1 -1
- package/dist-types/panel-trigger.d.ts +1 -1
- package/dist-types/panel.d.ts +1 -1
- package/dist-types/preferences.d.ts +1 -1
- package/dist-types/primitives/accordion.d.ts +1 -1
- package/dist-types/primitives/button.d.ts +1 -1
- package/dist-types/primitives/collapsible.d.ts +1 -1
- package/dist-types/primitives/dialog.d.ts +1 -1
- package/dist-types/primitives/preference-item.d.ts +1 -1
- package/dist-types/primitives/switch.d.ts +1 -1
- package/dist-types/primitives/tabs.d.ts +1 -1
- package/dist-types/primitives.d.ts +7 -7
- package/dist-types/prompt.d.ts +1 -1
- package/dist-types/provider.d.ts +27 -5
- package/dist-types/server/fetch-ssr-data.d.ts +1 -1
- package/dist-types/server/index.d.ts +5 -5
- package/dist-types/theme-provider.d.ts +2 -2
- package/dist-types/types/index.d.ts +3 -3
- package/dist-types/types/manager.d.ts +1 -1
- package/dist-types/types/theme/index.d.ts +1 -1
- package/dist-types/ui-config-context.d.ts +1 -1
- package/dist-types/utils/deferred-module.d.ts +11 -0
- package/dist-types/utils/index.d.ts +4 -4
- package/dist-types/utils/merge-slot-props.d.ts +2 -2
- package/dist-types/utils/merge-styles.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +1 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +4 -1
- package/docs/frameworks/react/components/consent-dialog.md +1 -1
- package/docs/frameworks/react/components/{frame.md → consent-gate.md} +27 -27
- package/docs/frameworks/react/components/consent-manager-provider.md +14 -1
- package/docs/frameworks/react/components/consent-widget.md +39 -6
- package/docs/frameworks/react/concepts/consent-categories.md +31 -2
- package/docs/frameworks/react/script-loader.md +8 -0
- package/docs/frameworks/react/styling/overview.md +10 -0
- package/docs/guides/deployment-modes.md +12 -0
- package/docs/integrations/building-integrations.md +5 -0
- package/docs/integrations/clear-on-revocation.md +167 -0
- package/docs/integrations/cloudflare-zaraz.md +399 -0
- package/docs/integrations/google-maps.md +20 -20
- package/docs/integrations/granular-consent.md +208 -0
- package/docs/integrations/overview.md +5 -4
- package/docs/integrations/youtube.md +26 -21
- package/docs/upgrade-v3.md +47 -0
- package/package.json +26 -16
- package/dist/components/frame/atoms.js +0 -1
- package/dist/components/frame/frame.js +0 -2
- package/dist/components/frame/index.js +0 -2
- package/dist/frame.js +0 -2
- package/dist-types/components/frame/atoms.d.ts +0 -11
- package/dist-types/components/frame/frame.d.ts +0 -2
- package/dist-types/components/frame/index.d.ts +0 -24
- package/dist-types/frame.d.ts +0 -1
- package/readme.json +0 -48
- package/src/iab/styles.css +0 -11
- package/src/styles.css +0 -10
- /package/dist/components/{frame → consent-gate}/types.js +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Granular consent
|
|
3
|
+
description: Let visitors grant a category and still turn one vendor off,
|
|
4
|
+
without adopting IAB TCF.
|
|
5
|
+
group: integrations
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Granular consent is choice below the category level: a visitor grants
|
|
9
|
+
marketing and still turns Meta off. The unit of that choice is a vendor, so
|
|
10
|
+
the API names them `vendors`, `vendor` and `data-vendor`, and the hooks
|
|
11
|
+
`useVendorAllowed` and `useVendorDraft`. Everything else stays as it is:
|
|
12
|
+
categories, policies, and the preference center gain vendor rows rather than
|
|
13
|
+
a second consent model.
|
|
14
|
+
|
|
15
|
+
## Declare vendors
|
|
16
|
+
|
|
17
|
+
Add `vendors` to your runtime options. Each vendor sits inside a category
|
|
18
|
+
condition and needs a name and a privacy policy URL so the preference surface
|
|
19
|
+
can list it. The React provider takes the same option once its preference
|
|
20
|
+
center renders vendor rows; scripts, rules and iframes are gated the same way
|
|
21
|
+
whichever place declares it:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { hosted, type Vendor } from 'c15t';
|
|
25
|
+
import { createConsentRuntime } from 'c15t/runtime';
|
|
26
|
+
|
|
27
|
+
const vendors = [
|
|
28
|
+
{
|
|
29
|
+
id: 'meta-pixel',
|
|
30
|
+
name: 'Meta Pixel',
|
|
31
|
+
category: 'marketing',
|
|
32
|
+
privacyPolicyUrl: 'https://www.facebook.com/privacy/policy/',
|
|
33
|
+
description: 'Ad conversion measurement and audiences.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'google-analytics',
|
|
37
|
+
name: 'Google Analytics',
|
|
38
|
+
category: 'measurement',
|
|
39
|
+
privacyPolicyUrl: 'https://policies.google.com/privacy',
|
|
40
|
+
},
|
|
41
|
+
] satisfies Vendor[];
|
|
42
|
+
|
|
43
|
+
const runtime = createConsentRuntime({
|
|
44
|
+
mode: hosted({ url: '/api/c15t' }),
|
|
45
|
+
vendors,
|
|
46
|
+
scripts: [
|
|
47
|
+
{
|
|
48
|
+
id: 'meta-pixel',
|
|
49
|
+
category: 'marketing',
|
|
50
|
+
vendor: 'meta-pixel',
|
|
51
|
+
src: 'https://connect.facebook.net/en_US/fbevents.js',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Start in the browser after mount. The endpoint must serve your c15t backend.
|
|
57
|
+
runtime.start();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `id` is a lowercase slug of up to 64 characters. Reuse it as the `vendor`
|
|
61
|
+
field on scripts and network rules and as the `data-vendor` attribute on
|
|
62
|
+
iframes. Integrations from `@c15t/scripts` already set `vendor` to their
|
|
63
|
+
manifest slug, so `gtag()` and `metaPixel()` need no extra wiring.
|
|
64
|
+
|
|
65
|
+
A backend can also declare vendors. Add `vendors` and an optional
|
|
66
|
+
`vendorListVersion` to the manifest configuration; `/init` returns them and the
|
|
67
|
+
client merges them with the vendors declared in code. When both declare the
|
|
68
|
+
same id, the copy declared in code wins, and the backend copy comes back if the
|
|
69
|
+
code declaration is removed later. A slug used by a script, rule or iframe
|
|
70
|
+
but declared nowhere still gates loading. It is hidden from the preference surface, and the
|
|
71
|
+
runtime warns about it outside production.
|
|
72
|
+
|
|
73
|
+
## How a vendor is gated
|
|
74
|
+
|
|
75
|
+
A target loads when its category condition passes and the visitor has not
|
|
76
|
+
turned its vendor off:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
loads = category condition satisfied AND vendor not denied
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The category is evaluated first, so an unknown category still throws as a
|
|
83
|
+
configuration error. A vendor toggle never grants a category on its own: with
|
|
84
|
+
marketing denied, `meta-pixel` stays blocked whatever its own switch says.
|
|
85
|
+
A script with `alwaysLoad` still mounts, as it does for a denied category;
|
|
86
|
+
its callbacks receive the vendor result in `info.vendor.granted` so a
|
|
87
|
+
self-managing SDK can honor it.
|
|
88
|
+
|
|
89
|
+
Under an `iab` policy the `vendor` slug is inert. Vendor consent then comes from
|
|
90
|
+
the TC string through `vendorId`, and the vendor rows are not shown.
|
|
91
|
+
|
|
92
|
+
The same rule applies to the three gates:
|
|
93
|
+
|
|
94
|
+
| Surface | Field |
|
|
95
|
+
| --------------- | ------------------------------- |
|
|
96
|
+
| Script loader | `Script.vendor` |
|
|
97
|
+
| Network blocker | `NetworkBlockerRule.vendor` |
|
|
98
|
+
| Iframe blocker | `data-vendor` on the `<iframe>` |
|
|
99
|
+
|
|
100
|
+
An iframe with `data-vendor` and no `data-category` is gated on the vendor
|
|
101
|
+
alone. An unknown `data-vendor` value is granted rather than thrown: a vendor
|
|
102
|
+
the visitor never saw cannot have been turned off. Such a frame has no
|
|
103
|
+
category to follow, so a denial the visitor recorded earlier holds even while
|
|
104
|
+
nothing declares the slug, for example before the backend's vendor list has
|
|
105
|
+
arrived on a cold start.
|
|
106
|
+
|
|
107
|
+
A script, rule or frame keeps its slug declared for as long as it is
|
|
108
|
+
configured. If a backend list or a provider update drops the entry, the
|
|
109
|
+
loader or blocker puts it back, so a stored denial keeps gating it. A slug
|
|
110
|
+
several modules share stays under every category they name it with, whichever
|
|
111
|
+
module updates last, and drops a category only once no module names it there.
|
|
112
|
+
Disposing a loader or blocker, or removing a gated frame from the page, drops
|
|
113
|
+
what only it named, so a vendor no live module owns stops being toggleable.
|
|
114
|
+
|
|
115
|
+
## Record a vendor choice
|
|
116
|
+
|
|
117
|
+
Vendor grants travel with the save. Stage them and confirm with the next save,
|
|
118
|
+
or pass them next to the categories:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
// Stage from a toggle handler; nothing changes until save({}) runs. The
|
|
122
|
+
// empty patch confirms no category, so only the staged vendor is recorded;
|
|
123
|
+
// save() with no input would reconfirm every displayed category too.
|
|
124
|
+
runtime.stageVendorConsent('meta-pixel', false);
|
|
125
|
+
await runtime.kernel.commands.save({});
|
|
126
|
+
|
|
127
|
+
// Or confirm categories and vendors in one action.
|
|
128
|
+
await runtime.kernel.commands.save({
|
|
129
|
+
marketing: true,
|
|
130
|
+
measurement: true,
|
|
131
|
+
vendors: { 'meta-pixel': false },
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`stageVendorConsent` stages a vendor slug for the next save; it is not the
|
|
136
|
+
IAB handle's `setVendorConsent`, which sets a TCF vendor by numeric id and
|
|
137
|
+
takes effect at once. The grants can also travel in the save context as
|
|
138
|
+
`{ vendors }`, which wins when both are given.
|
|
139
|
+
|
|
140
|
+
Only the vendors the visitor turned off are stored. Accept all and reject all
|
|
141
|
+
both clear that list, so vendors follow their category on a bulk action. A bulk
|
|
142
|
+
action narrowed to the displayed categories only lifts the denials of vendors
|
|
143
|
+
those categories decide on their own; a vendor another granted category would
|
|
144
|
+
still load keeps its denial. A
|
|
145
|
+
vendor that is not declared, or is declared with `disabled: true`, is ignored.
|
|
146
|
+
Under an opt-out policy every vendor starts on and the stored list is the
|
|
147
|
+
do-not-sell list.
|
|
148
|
+
|
|
149
|
+
A vendor-only change records without touching category receipts. The kernel
|
|
150
|
+
emits `vendors:recorded` rather than `choice:recorded`, writes the
|
|
151
|
+
`<storageKey>-vendors` cookie and localStorage entry, and sends the complete
|
|
152
|
+
grant map to the backend as `vendorChoice`. Category confirmation times are not
|
|
153
|
+
renewed. The vendor entry also carries the subject id, so a visitor whose first
|
|
154
|
+
act only decided vendors keeps the same subject after a reload even though no
|
|
155
|
+
category record exists yet.
|
|
156
|
+
|
|
157
|
+
Scripts see the vendor result in their callbacks. `ScriptCallbackInfo.vendor`
|
|
158
|
+
carries `{ id, granted }` outside IAB mode. Integrations that send Google
|
|
159
|
+
Consent Mode or RudderStack signals send every category as denied while their
|
|
160
|
+
vendor is off, so the vendor's own consent API cannot re-enable tracking.
|
|
161
|
+
|
|
162
|
+
## Show vendors in the preference center
|
|
163
|
+
|
|
164
|
+
The `ConsentWidget` and `ConsentDialog` in React, Vue and Svelte list vendors
|
|
165
|
+
under their category when the provider declares them. Pass the same `vendors`
|
|
166
|
+
array to `ConsentProvider`, to the `vendors` prop of `ConsentRoot` in
|
|
167
|
+
[Next.js](https://c15t.com/docs/frameworks/next/script-loader#granular-consent) and
|
|
168
|
+
[TanStack Start](https://c15t.com/docs/frameworks/tanstack-start/quickstart#granular-consent),
|
|
169
|
+
to the Nuxt module or Vue plugin config next to `scripts`, or to
|
|
170
|
+
`ConsentManagerProvider` options in Svelte:
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { ConsentProvider, hosted } from 'c15t/react';
|
|
174
|
+
|
|
175
|
+
<ConsentProvider options={{ mode: hosted({ url: '/api/c15t' }), vendors }}>
|
|
176
|
+
{children}
|
|
177
|
+
</ConsentProvider>;
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Each category row expands to one card per vendor with its own switch. The
|
|
181
|
+
switches disable while the category is off in the draft, and Save records the
|
|
182
|
+
vendors the visitor moved. A custom control uses `useVendorDraft()` from
|
|
183
|
+
`c15t/react` to read and stage the same grants, with `isStale` and `reset` for
|
|
184
|
+
a draft the policy or vendor list changed under, and `useVendorAllowed(id)` to
|
|
185
|
+
read one vendor's effective result. Copy comes from
|
|
186
|
+
`consentManagerDialog.vendors.{title, privacyPolicy, disabledByCategory,
|
|
187
|
+
switchLabel}` in the translations. In Vue, `useConsentDraft()` returns the
|
|
188
|
+
same `vendors` map and `setVendor`; in Svelte, `getConsentManager()` exposes
|
|
189
|
+
`selectedVendors`, `setSelectedVendor` and `getDisplayedVendors(category)`.
|
|
190
|
+
The three frameworks render the same cards, and the parity suite compares
|
|
191
|
+
their markup, accessibility tree, computed styles and geometry.
|
|
192
|
+
|
|
193
|
+
## What a denial does not do
|
|
194
|
+
|
|
195
|
+
Turning a vendor off blocks future loads and requests. It does not delete the
|
|
196
|
+
cookies that vendor already set, and
|
|
197
|
+
[clear on revocation](./clear-on-revocation.md) does not help here:
|
|
198
|
+
it runs when a category is denied, and the category stays granted when only one
|
|
199
|
+
of its vendors is off. Remove that vendor's cookies yourself from an
|
|
200
|
+
`onConsentChange` callback that checks `info.vendor.granted`.
|
|
201
|
+
|
|
202
|
+
A vendor denial has no expiry and no policy basis. It stays until the visitor
|
|
203
|
+
changes it or a bulk action clears it, including across a policy change that
|
|
204
|
+
requires the category choice again.
|
|
205
|
+
|
|
206
|
+
Adding a vendor to the list does not reopen consent. New vendors default to on
|
|
207
|
+
inside a granted category. Use the policy rule's `copyRevision` when a new
|
|
208
|
+
vendor should prompt the visitor again.
|
|
@@ -34,15 +34,16 @@ behavior before choosing either approach.
|
|
|
34
34
|
| [Google Maps](./google-maps.md) | Framework-specific consent-gated map iframe | Iframe mounts only while the chosen permission is allowed |
|
|
35
35
|
| [YouTube](./youtube.md) | Framework-specific consent-gated video iframe | Iframe mounts only while the chosen permission is allowed |
|
|
36
36
|
|
|
37
|
-
Both guides include all nine framework examples. React and Svelte use `
|
|
37
|
+
Both guides include all nine framework examples. React and Svelte use `ConsentGate`;
|
|
38
38
|
Vue conditionally renders the iframe, and Astro and JavaScript use the existing
|
|
39
39
|
kernel to control its DOM lifecycle. Embeds do not require `@c15t/scripts`.
|
|
40
40
|
|
|
41
41
|
## Tag managers
|
|
42
42
|
|
|
43
|
-
| Integration | Helper | Category | Loading behavior
|
|
44
|
-
| --------------------------------------------- | ------------------ | ----------- |
|
|
45
|
-
| [
|
|
43
|
+
| Integration | Helper | Category | Loading behavior |
|
|
44
|
+
| --------------------------------------------- | ------------------ | ----------- | ------------------------------------------------ |
|
|
45
|
+
| [Cloudflare Zaraz](./cloudflare-zaraz.md) | `cloudflareZaraz` | `necessary` | Synchronizes purposes; Zaraz owns tool execution |
|
|
46
|
+
| [Google Tag Manager](./google-tag-manager.md) | `googleTagManager` | `necessary` | Always loads; signals Google consent |
|
|
46
47
|
|
|
47
48
|
## Analytics
|
|
48
49
|
|
|
@@ -33,12 +33,12 @@ Render this component inside your existing consent boundary or provider.
|
|
|
33
33
|
```tsx title="src/consent-embed.tsx"
|
|
34
34
|
'use client';
|
|
35
35
|
|
|
36
|
-
import {
|
|
36
|
+
import { ConsentGate } from 'c15t/next';
|
|
37
37
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
38
38
|
|
|
39
39
|
export function ConsentEmbed() {
|
|
40
40
|
return (
|
|
41
|
-
<
|
|
41
|
+
<ConsentGate category={embedCategory}>
|
|
42
42
|
<iframe
|
|
43
43
|
src={embedURL}
|
|
44
44
|
title={embedTitle}
|
|
@@ -46,12 +46,12 @@ export function ConsentEmbed() {
|
|
|
46
46
|
allowFullScreen
|
|
47
47
|
style={{ width: '100%', aspectRatio: embedAspectRatio, minHeight: 200, border: 0 }}
|
|
48
48
|
/>
|
|
49
|
-
</
|
|
49
|
+
</ConsentGate>
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
`
|
|
54
|
+
`ConsentGate` keeps the iframe absent while permission is denied and removes it
|
|
55
55
|
on revocation. Keep your existing consent styles and preferences dialog.
|
|
56
56
|
|
|
57
57
|
**TanStack Start**
|
|
@@ -59,12 +59,12 @@ on revocation. Keep your existing consent styles and preferences dialog.
|
|
|
59
59
|
Render this component inside your existing consent boundary or provider.
|
|
60
60
|
|
|
61
61
|
```tsx title="src/consent-embed.tsx"
|
|
62
|
-
import {
|
|
62
|
+
import { ConsentGate } from 'c15t/tanstack-start';
|
|
63
63
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
64
64
|
|
|
65
65
|
export function ConsentEmbed() {
|
|
66
66
|
return (
|
|
67
|
-
<
|
|
67
|
+
<ConsentGate category={embedCategory}>
|
|
68
68
|
<iframe
|
|
69
69
|
src={embedURL}
|
|
70
70
|
title={embedTitle}
|
|
@@ -72,12 +72,12 @@ export function ConsentEmbed() {
|
|
|
72
72
|
allowFullScreen
|
|
73
73
|
style={{ width: '100%', aspectRatio: embedAspectRatio, minHeight: 200, border: 0 }}
|
|
74
74
|
/>
|
|
75
|
-
</
|
|
75
|
+
</ConsentGate>
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
`
|
|
80
|
+
`ConsentGate` keeps the iframe absent while permission is denied and removes it
|
|
81
81
|
on revocation. Keep your existing consent styles and preferences dialog.
|
|
82
82
|
|
|
83
83
|
**React**
|
|
@@ -85,12 +85,12 @@ on revocation. Keep your existing consent styles and preferences dialog.
|
|
|
85
85
|
Render this component inside your existing consent boundary or provider.
|
|
86
86
|
|
|
87
87
|
```tsx title="src/consent-embed.tsx"
|
|
88
|
-
import {
|
|
88
|
+
import { ConsentGate } from 'c15t/react';
|
|
89
89
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
90
90
|
|
|
91
91
|
export function ConsentEmbed() {
|
|
92
92
|
return (
|
|
93
|
-
<
|
|
93
|
+
<ConsentGate category={embedCategory}>
|
|
94
94
|
<iframe
|
|
95
95
|
src={embedURL}
|
|
96
96
|
title={embedTitle}
|
|
@@ -98,12 +98,12 @@ export function ConsentEmbed() {
|
|
|
98
98
|
allowFullScreen
|
|
99
99
|
style={{ width: '100%', aspectRatio: embedAspectRatio, minHeight: 200, border: 0 }}
|
|
100
100
|
/>
|
|
101
|
-
</
|
|
101
|
+
</ConsentGate>
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
`
|
|
106
|
+
`ConsentGate` keeps the iframe absent while permission is denied and removes it
|
|
107
107
|
on revocation. Keep your existing consent styles and preferences dialog.
|
|
108
108
|
|
|
109
109
|
**Nuxt**
|
|
@@ -223,11 +223,11 @@ The provider from your quickstart supplies its consent state.
|
|
|
223
223
|
|
|
224
224
|
```svelte title="src/ConsentEmbed.svelte"
|
|
225
225
|
<script lang="ts">
|
|
226
|
-
import {
|
|
226
|
+
import { ConsentGate } from '@c15t/svelte';
|
|
227
227
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
228
228
|
</script>
|
|
229
229
|
|
|
230
|
-
<
|
|
230
|
+
<ConsentGate category={embedCategory}>
|
|
231
231
|
<iframe
|
|
232
232
|
src={embedURL}
|
|
233
233
|
title={embedTitle}
|
|
@@ -238,10 +238,10 @@ The provider from your quickstart supplies its consent state.
|
|
|
238
238
|
style:min-height="200px"
|
|
239
239
|
style:border="0"
|
|
240
240
|
></iframe>
|
|
241
|
-
</
|
|
241
|
+
</ConsentGate>
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
The Svelte `
|
|
244
|
+
The Svelte `ConsentGate` waits until the browser is mounted and the category is
|
|
245
245
|
allowed. Its default placeholder opens preferences. Revocation removes the
|
|
246
246
|
iframe.
|
|
247
247
|
|
|
@@ -252,11 +252,11 @@ Keep the SvelteKit root provider and its server prefetch unchanged.
|
|
|
252
252
|
|
|
253
253
|
```svelte title="src/lib/ConsentEmbed.svelte"
|
|
254
254
|
<script lang="ts">
|
|
255
|
-
import {
|
|
255
|
+
import { ConsentGate } from '@c15t/svelte';
|
|
256
256
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from '../embed-config';
|
|
257
257
|
</script>
|
|
258
258
|
|
|
259
|
-
<
|
|
259
|
+
<ConsentGate category={embedCategory}>
|
|
260
260
|
<iframe
|
|
261
261
|
src={embedURL}
|
|
262
262
|
title={embedTitle}
|
|
@@ -267,10 +267,10 @@ Keep the SvelteKit root provider and its server prefetch unchanged.
|
|
|
267
267
|
style:min-height="200px"
|
|
268
268
|
style:border="0"
|
|
269
269
|
></iframe>
|
|
270
|
-
</
|
|
270
|
+
</ConsentGate>
|
|
271
271
|
```
|
|
272
272
|
|
|
273
|
-
The Svelte `
|
|
273
|
+
The Svelte `ConsentGate` waits until the browser is mounted and the category is
|
|
274
274
|
allowed. Its default placeholder opens preferences. Revocation removes the
|
|
275
275
|
iframe.
|
|
276
276
|
|
|
@@ -380,7 +380,7 @@ Set playback options in the iframe URL. For example, append `start=36` to begin
|
|
|
380
380
|
[YouTube player parameters](https://developers.google.com/youtube/player_parameters)
|
|
381
381
|
and reserve at least a 200-by-200-pixel player area.
|
|
382
382
|
|
|
383
|
-
React and Svelte `
|
|
383
|
+
React and Svelte `ConsentGate` components provide a blocked-state placeholder and
|
|
384
384
|
consent action. Their `placeholder` APIs differ: React takes a node, Svelte
|
|
385
385
|
takes a snippet. Keep a clear way to reopen preferences when customizing them.
|
|
386
386
|
The Vue and browser examples show that action explicitly. `loading="lazy"` delays an
|
|
@@ -388,6 +388,11 @@ allowed iframe for performance; it does not implement consent gating.
|
|
|
388
388
|
|
|
389
389
|
## Consent behavior
|
|
390
390
|
|
|
391
|
+
Add `data-vendor="youtube"` next to `data-category` and declare a `youtube`
|
|
392
|
+
vendor in the runtime's `vendors` option or the backend manifest to let visitors
|
|
393
|
+
turn YouTube off while keeping the rest of the category on. See
|
|
394
|
+
[granular consent](./granular-consent.md).
|
|
395
|
+
|
|
391
396
|
Each example keeps the iframe absent until the category is allowed. After
|
|
392
397
|
permission, the iframe can load. Revoking permission removes the iframe and its
|
|
393
398
|
embedded document. Requests already sent cannot be recalled.
|
package/docs/upgrade-v3.md
CHANGED
|
@@ -5,6 +5,13 @@ description: Migrate policy configuration, consent records, callbacks, and
|
|
|
5
5
|
group: reference
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## React version requirement
|
|
9
|
+
|
|
10
|
+
The v3 React and Next.js adapters require React and React DOM 18 or newer.
|
|
11
|
+
Upgrade both packages together before installing v3. Earlier alpha peer ranges
|
|
12
|
+
incorrectly allowed React 16 and 17 even though v3 already uses `useId` and
|
|
13
|
+
`useSyncExternalStore`, which those versions do not provide.
|
|
14
|
+
|
|
8
15
|
## Start with a policy rule
|
|
9
16
|
|
|
10
17
|
```ts
|
|
@@ -252,6 +259,24 @@ TanStack Start (`c15t/tanstack-start`, `c15t/tanstack-start/server`):
|
|
|
252
259
|
`consentLoaderOptions`, `backendURL`, `initRoute` and `DEFAULT_INIT_ROUTE` are
|
|
253
260
|
unchanged.
|
|
254
261
|
|
|
262
|
+
## `Frame` is now `ConsentGate`
|
|
263
|
+
|
|
264
|
+
The component that mounts an embed only while its category is allowed is now
|
|
265
|
+
`ConsentGate` in React, Next.js, TanStack Start, Svelte and Vue. The old names
|
|
266
|
+
still work as deprecated aliases and will be removed in a later major release.
|
|
267
|
+
|
|
268
|
+
| v2 | v3 |
|
|
269
|
+
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
270
|
+
| `Frame`, `Frame.Root`, `Frame.Title`, `Frame.Button` | `ConsentGate`, `ConsentGate.Root`, `ConsentGate.Title`, `ConsentGate.Button` |
|
|
271
|
+
| `FrameProps`, `FrameCompoundComponent` | `ConsentGateProps`, `ConsentGateCompoundComponent` |
|
|
272
|
+
| `c15t/react/frame`, `c15t/react/components/frame` | `c15t/react/consent-gate`, `c15t/react/components/consent-gate` |
|
|
273
|
+
| Vue `ConsentFrame`, `@c15t/vue/runtime/components/consent-frame.vue` | `ConsentGate`, `@c15t/vue/runtime/components/consent-gate.vue` |
|
|
274
|
+
|
|
275
|
+
Props and behavior are unchanged. The placeholder keeps its `frame.*`
|
|
276
|
+
translation keys, `--frame-*` CSS custom properties and
|
|
277
|
+
`data-testid="frame-placeholder"`, so custom copy, styles and tests continue
|
|
278
|
+
to apply.
|
|
279
|
+
|
|
255
280
|
## Next.js RSC banner removal
|
|
256
281
|
|
|
257
282
|
The `@c15t/nextjs/rsc` entry (`c15t/next/rsc`) and its `RscConsentBanner`,
|
|
@@ -332,3 +357,25 @@ export function Banner() {
|
|
|
332
357
|
);
|
|
333
358
|
}
|
|
334
359
|
```
|
|
360
|
+
|
|
361
|
+
## Session reports in manifest mode
|
|
362
|
+
|
|
363
|
+
A host that resolves init from a cached manifest never calls `/init`, so a v3
|
|
364
|
+
backend could not count the visitors it served. From this release every
|
|
365
|
+
server-side resolution sends `POST /sessions` to the backend after the fact,
|
|
366
|
+
server-to-server and detached from the response: the Next.js, TanStack Start,
|
|
367
|
+
SvelteKit, Nuxt and Astro init routes, and the Next.js, TanStack Start and
|
|
368
|
+
Astro render-time prefetches. The browser makes no request.
|
|
369
|
+
|
|
370
|
+
This is a new outbound data flow from your server to the consent backend. The
|
|
371
|
+
report carries the manifest revision, the matched policy, the jurisdiction,
|
|
372
|
+
country, region, language and GPC signal, plus the visitor's user agent and
|
|
373
|
+
address as request headers. It carries no cookies and no identifier. Nothing is
|
|
374
|
+
stored on the backend; the report reaches a `sessions.onReport` sink and the
|
|
375
|
+
request log.
|
|
376
|
+
|
|
377
|
+
Reporting is on by default and needs an absolute backend URL. Set
|
|
378
|
+
`reportSessions: false` on the adapter to send none. Each report is one
|
|
379
|
+
resolution, not one visitor: a page view can produce a `render` report and a
|
|
380
|
+
`route` report, and nothing in them links the two. A consumer counting sessions
|
|
381
|
+
groups reports by the forwarded address and user agent within a window.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/react",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
4
4
|
"description": "React cookie banner, consent manager, preference center, and headless CMP components with IAB TCF and Consent Mode support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ccpa",
|
|
@@ -131,10 +131,15 @@
|
|
|
131
131
|
"import": "./dist/panel-trigger.js",
|
|
132
132
|
"default": "./dist/panel-trigger.js"
|
|
133
133
|
},
|
|
134
|
+
"./consent-gate": {
|
|
135
|
+
"types": "./dist-types/consent-gate.d.ts",
|
|
136
|
+
"import": "./dist/consent-gate.js",
|
|
137
|
+
"default": "./dist/consent-gate.js"
|
|
138
|
+
},
|
|
134
139
|
"./frame": {
|
|
135
|
-
"types": "./dist-types/
|
|
136
|
-
"import": "./dist/
|
|
137
|
-
"default": "./dist/
|
|
140
|
+
"types": "./dist-types/consent-gate.d.ts",
|
|
141
|
+
"import": "./dist/consent-gate.js",
|
|
142
|
+
"default": "./dist/consent-gate.js"
|
|
138
143
|
},
|
|
139
144
|
"./iab": {
|
|
140
145
|
"types": "./dist-types/iab.d.ts",
|
|
@@ -190,10 +195,15 @@
|
|
|
190
195
|
"import": "./dist/components/preferences/index.js",
|
|
191
196
|
"default": "./dist/components/preferences/index.js"
|
|
192
197
|
},
|
|
198
|
+
"./components/consent-gate": {
|
|
199
|
+
"types": "./dist-types/components/consent-gate/index.d.ts",
|
|
200
|
+
"import": "./dist/components/consent-gate/index.js",
|
|
201
|
+
"default": "./dist/components/consent-gate/index.js"
|
|
202
|
+
},
|
|
193
203
|
"./components/frame": {
|
|
194
|
-
"types": "./dist-types/components/
|
|
195
|
-
"import": "./dist/components/
|
|
196
|
-
"default": "./dist/components/
|
|
204
|
+
"types": "./dist-types/components/consent-gate/index.d.ts",
|
|
205
|
+
"import": "./dist/components/consent-gate/index.js",
|
|
206
|
+
"default": "./dist/components/consent-gate/index.js"
|
|
197
207
|
},
|
|
198
208
|
"./context": {
|
|
199
209
|
"types": "./dist-types/context/index.d.ts",
|
|
@@ -233,16 +243,16 @@
|
|
|
233
243
|
"test:watch": "bun prebuild && vitest"
|
|
234
244
|
},
|
|
235
245
|
"dependencies": {
|
|
236
|
-
"@c15t/core": "3.0.0-alpha.
|
|
237
|
-
"@c15t/dev-tools": "3.0.0-alpha.
|
|
238
|
-
"@c15t/iab": "3.0.0-alpha.
|
|
239
|
-
"@c15t/schema": "3.0.0-alpha.
|
|
240
|
-
"@c15t/translations": "3.0.0-alpha.
|
|
241
|
-
"@c15t/ui": "3.0.0-alpha.
|
|
246
|
+
"@c15t/core": "3.0.0-alpha.2",
|
|
247
|
+
"@c15t/dev-tools": "3.0.0-alpha.2",
|
|
248
|
+
"@c15t/iab": "3.0.0-alpha.2",
|
|
249
|
+
"@c15t/schema": "3.0.0-alpha.1",
|
|
250
|
+
"@c15t/translations": "3.0.0-alpha.2",
|
|
251
|
+
"@c15t/ui": "3.0.0-alpha.2",
|
|
242
252
|
"@types/google.maps": "3.65.3"
|
|
243
253
|
},
|
|
244
254
|
"devDependencies": {
|
|
245
|
-
"@c15t/backend": "3.0.0-alpha.
|
|
255
|
+
"@c15t/backend": "3.0.0-alpha.2",
|
|
246
256
|
"@c15t/conformance": "0.0.1",
|
|
247
257
|
"@c15t/typescript-config": "0.0.1",
|
|
248
258
|
"@c15t/vitest-config": "1.0.0",
|
|
@@ -252,8 +262,8 @@
|
|
|
252
262
|
"typescript": "7.0.2"
|
|
253
263
|
},
|
|
254
264
|
"peerDependencies": {
|
|
255
|
-
"react": "^
|
|
256
|
-
"react-dom": "^
|
|
265
|
+
"react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
266
|
+
"react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
257
267
|
},
|
|
258
268
|
"peerDependenciesMeta": {
|
|
259
269
|
"react": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import t from"@c15t/ui/styles/components/frame";import{forwardRef as r}from"react";import{useTranslations as a}from"../../component-hooks/use-translations.js";import{Box as o}from"../shared/primitives/box.js";import{ConsentButton as i}from"../shared/primitives/button.js";let m=r(({children:r,...a},i)=>e(o,{ref:i,baseClassName:t.placeholder,"data-testid":"frame-placeholder",...a,children:r})),l=r(({children:r,category:i,...m},l)=>{let{frame:s,consentTypes:n}=a(),p=i&&s?.title?s.title.replace("{category}",n?.[i]?.title??i):void 0;return e(o,{ref:l,baseClassName:t.title,...m,children:r??p})}),s=r(({children:t,category:r,...o},m)=>{let{frame:l,consentTypes:s}=a(),n=s?.[r]?.title??r,p=l?.actionButton?.replace("{category}",n);return e(i,{mode:"stroke",size:"small",variant:"primary",...o,ref:m,action:"open-consent-dialog",category:r,"data-testid":"frame-open-dialog",children:t??p})});m.displayName="FrameRoot",l.displayName="FrameTitle",s.displayName="FrameButton";export{s as FrameButton,m as FrameRoot,l as FrameTitle};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{forwardRef as r,useEffect as t}from"react";import{useConsentManager as i}from"../../component-hooks/use-manager.js";import{useTranslations as l}from"../../component-hooks/use-translations.js";import{FrameButton as n,FrameRoot as s,FrameTitle as c}from"./atoms.js";let a=({category:r,policyBlocked:t,policyBlockedMessage:i})=>o(s,{children:[e(c,{category:r,children:t?i??"This content is unavailable under your region's consent policy.":void 0}),t?null:e(n,{category:r})]}),m=r(({children:o,category:r,placeholder:n,noStyle:s,className:c,theme:m,...d},p)=>{let{has:y,updateConsentCategories:u,consentCategories:h,policyCategories:g,policyScopeMode:f}=i(),{frame:k}=l(),j=y(r),v=Array.isArray(g)&&g.length>0&&!g.includes("*")&&!g.includes(r);return t(()=>{h.includes(r)||u([...h,r])},[r,h,u]),e("div",{ref:p,className:c,...d,children:j?o:n||e(a,{category:r,policyBlocked:"strict"===f&&v,policyBlockedMessage:k?.policyBlocked})})});m.displayName="Frame";let d=m;export{d as Frame};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{Frame as t}from"./frame.js";import*as e from"./atoms.js";let r=Object.assign(t,{Button:e.FrameButton,Root:e.FrameRoot,Title:e.FrameTitle});var a=e.FrameButton,m=e.FrameRoot,o=e.FrameTitle;export{a as FrameButton,m as FrameRoot,o as FrameTitle,r as Frame};
|
package/dist/frame.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AllConsentNames } from '@c15t/core';
|
|
2
|
-
import type { BoxProps } from '../shared/primitives/box';
|
|
3
|
-
import type { ConsentButtonProps } from '../shared/primitives/button.types';
|
|
4
|
-
declare const FrameRoot: import("react").ForwardRefExoticComponent<Omit<BoxProps, "slotKey"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
|
-
declare const FrameTitle: import("react").ForwardRefExoticComponent<Omit<BoxProps, "slotKey"> & {
|
|
6
|
-
category?: AllConsentNames;
|
|
7
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
-
declare const FrameButton: import("react").ForwardRefExoticComponent<Omit<ConsentButtonProps, "slotKey"> & {
|
|
9
|
-
category: AllConsentNames;
|
|
10
|
-
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
11
|
-
export { FrameButton, FrameRoot, FrameTitle };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { FrameCompoundComponent } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* The Frame component that provides consent-gated content rendering
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* Acts as a consent boundary for embedded content (iframes, videos, third-party widgets).
|
|
7
|
-
* Conditionally renders children based on user consent, displaying a placeholder when
|
|
8
|
-
* permission is not granted.
|
|
9
|
-
* Supports custom styling via `theme` or complete style override with `noStyle` as well as a custom placeholder.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* <Frame category="marketing">
|
|
14
|
-
* <iframe src="https://www.youtube.com/embed/MtN1YnoL46Q?si=JYIFKdENwls43H-r" />
|
|
15
|
-
* </Frame>
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @see {@link FrameTheme} for theme options
|
|
19
|
-
* @see {@link AllConsentNames} for consent categories
|
|
20
|
-
*/
|
|
21
|
-
declare const Frame: FrameCompoundComponent;
|
|
22
|
-
export { FrameButton, FrameRoot, FrameTitle } from './atoms';
|
|
23
|
-
export type { FrameCompoundComponent, FrameProps } from './types';
|
|
24
|
-
export { Frame };
|
package/dist-types/frame.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/frame';
|
package/readme.json
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "@c15t/react: React Consent Components",
|
|
3
|
-
"description": "React cookie banner, consent manager, preference center, and headless CMP components for modern React apps.",
|
|
4
|
-
"features": [
|
|
5
|
-
"Works with React 19, 18, 17, and 16.8",
|
|
6
|
-
"Full 'use client' support for React Server Components",
|
|
7
|
-
"Prebuilt and fully customizable cookie banner, consent dialog, and preference center UI",
|
|
8
|
-
"Headless hooks for custom consent flows",
|
|
9
|
-
"Minimal configuration with TypeScript-first design",
|
|
10
|
-
"Comprehensive Consent Management Platform (CMP)",
|
|
11
|
-
"IAB TCF 2.3 UI and hooks through the @c15t/react/iab subpath",
|
|
12
|
-
"Google Tag Manager, Google Consent Mode v2, Meta Pixel, and analytics integrations through @c15t/scripts",
|
|
13
|
-
"Built-in internationalization support",
|
|
14
|
-
"Seamless consent storage and tracking"
|
|
15
|
-
],
|
|
16
|
-
"prerequisites": [
|
|
17
|
-
"React 16.8 or later",
|
|
18
|
-
"Node.js 20.19 or later",
|
|
19
|
-
"A hosted [c15t instance](https://inth.com) (free sign-up), [self-hosted deployment](https://c15t.com/docs/self-host/quickstart), or offline mode for local-only storage"
|
|
20
|
-
],
|
|
21
|
-
"manualInstallation": [
|
|
22
|
-
"",
|
|
23
|
-
"```bash\npnpm add @c15t/react\n```",
|
|
24
|
-
"",
|
|
25
|
-
"Then add the prebuilt stylesheet to your app-level CSS entrypoint:",
|
|
26
|
-
"",
|
|
27
|
-
"```css\n/* src/index.css */\n@import \"@c15t/react/styles.css\";\n```",
|
|
28
|
-
"",
|
|
29
|
-
"If you use the prebuilt IAB TCF UI, also import `@c15t/react/iab/styles.css`. It is published separately so non-IAB apps do not ship those component rules.",
|
|
30
|
-
"",
|
|
31
|
-
"To manually install, follow the guide in our [docs – manual setup](https://c15t.com/docs/frameworks/react/quickstart#manual-setup)."
|
|
32
|
-
],
|
|
33
|
-
"usage": [
|
|
34
|
-
"Import `ConsentManagerProvider` in your app's root component",
|
|
35
|
-
"Add `ConsentBanner` and `ConsentDialog` components",
|
|
36
|
-
"Customize styling and behavior to fit your app",
|
|
37
|
-
"For full implementation details, see the [React quickstart docs](https://c15t.com/docs/frameworks/react/quickstart)",
|
|
38
|
-
|
|
39
|
-
"```tsx\n// App.tsx\nimport {\n ConsentManagerProvider,\n ConsentBanner,\n ConsentDialog,\n} from '@c15t/react'\n\nfunction App() {\n return (\n <ConsentManagerProvider>\n <YourApp />\n <ConsentBanner />\n <ConsentDialog />\n </ConsentManagerProvider>\n )\n}\n```"
|
|
40
|
-
],
|
|
41
|
-
"docsLink": "https://c15t.com/docs/frameworks/react/quickstart",
|
|
42
|
-
"quickStartLink": "https://c15t.com/docs/frameworks/react/quickstart",
|
|
43
|
-
"showCLIGeneration": true,
|
|
44
|
-
"customSections": {
|
|
45
|
-
"Deployment Modes": "- **Hosted on inth.com**: Hosted c15t backend for policy storage, audit history, and hosted infrastructure\n- **Self-hosted backend**: Use @c15t/backend when you need full infrastructure control\n- **Offline mode**: Browser-only consent storage for local development, demos, previews, static sites, or fallback scenarios",
|
|
46
|
-
"Popular Integrations": "- Google Tag Manager with Google Consent Mode v2\n- Google Analytics 4 and Google Ads through gtag.js\n- Meta Pixel, TikTok Pixel, LinkedIn Insights, Microsoft UET, X Pixel, Reddit Pixel, and Snapchat Pixel\n- PostHog, Segment, Mixpanel, Microsoft Clarity, Hotjar, Plausible, Fathom, Matomo, Umami, and Vercel Analytics\n- Intercom and Crisp chat widgets"
|
|
47
|
-
}
|
|
48
|
-
}
|