@c15t/react 3.0.0-alpha.1 → 3.0.0-alpha.10
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 +96 -70
- package/README.md +21 -17
- package/SKILL.md +34 -0
- package/dist/aggregate-components.js +1 -1
- package/dist/chunk-warming.js +1 -1
- package/dist/component-hooks/use-headless-consent-ui.js +1 -1
- package/dist/component-hooks/use-headless-iab-consent-ui.js +1 -1
- package/dist/component-hooks/use-panel-trigger.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/frame.js +2 -0
- package/dist/components/consent-gate/index.js +2 -0
- package/dist/components/consent-preferences-link/consent-preferences-link.js +1 -1
- package/dist/components/iab-panel/atoms/card.js +1 -1
- package/dist/components/iab-panel/atoms/feature-item.js +2 -0
- package/dist/components/iab-panel/atoms/header.js +1 -1
- package/dist/components/iab-panel/atoms/purpose-item.js +1 -1
- package/dist/components/iab-panel/atoms/root.js +1 -1
- package/dist/components/iab-panel/atoms/stack-item.js +1 -1
- package/dist/components/iab-panel/atoms/vendor-list.js +1 -1
- package/dist/components/iab-panel/hooks/use-gvl-data.js +1 -1
- package/dist/components/iab-panel/iab-panel.js +1 -1
- package/dist/components/iab-panel/index.js +1 -1
- package/dist/components/iab-prompt/atoms/overlay.js +1 -1
- package/dist/components/iab-prompt/atoms/root.js +1 -1
- package/dist/components/panel/atoms/card.js +1 -1
- package/dist/components/panel/atoms/overlay.js +1 -1
- package/dist/components/panel/atoms/root.js +1 -1
- package/dist/components/panel/panel.js +1 -1
- package/dist/components/panel-trigger/atoms/button.js +1 -1
- package/dist/components/panel-trigger/atoms/icon.js +1 -1
- package/dist/components/panel-trigger/atoms/root.js +1 -1
- package/dist/components/panel-trigger/atoms/toolbar.js +1 -1
- package/dist/components/panel-trigger/atoms/trigger-icons.js +1 -0
- package/dist/components/panel-trigger/panel-trigger-toolbar.js +1 -1
- package/dist/components/panel-trigger/panel-trigger.js +1 -1
- package/dist/components/preferences/atoms/accordion.js +1 -1
- package/dist/components/preferences/atoms/root.js +1 -1
- package/dist/components/preferences/atoms/vendor-list.js +1 -0
- package/dist/components/preferences/index.js +1 -1
- package/dist/components/prompt/atoms/early-tap-script.js +2 -0
- package/dist/components/prompt/atoms/overlay.js +1 -1
- package/dist/components/prompt/atoms/root.js +1 -1
- package/dist/components/prompt/components.js +1 -1
- package/dist/components/prompt/policy-actions.js +1 -1
- package/dist/components/prompt/prompt.js +1 -1
- package/dist/components/shared/dialog-sheets.js +1 -0
- package/dist/components/shared/first-paint-sheets.js +1 -0
- package/dist/components/shared/iab-dialog-sheets.js +1 -0
- package/dist/components/shared/iab-first-paint-sheets.js +1 -0
- package/dist/components/shared/libs/compose-refs.js +1 -0
- package/dist/components/shared/libs/slot.js +1 -1
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/primitives/legal-links/index.js +1 -1
- package/dist/components/shared/streamed-surface.js +2 -0
- package/dist/components/shared/surface-styles.js +2 -0
- package/dist/components/shared/ui/dialog/dialog.js +1 -1
- package/dist/components/shared/ui/icon.js +1 -1
- package/dist/components/shared/ui/logo.js +1 -1
- package/dist/components/shared/ui/preference-item/preference-item.js +1 -1
- package/dist/consent-gate.js +2 -0
- package/dist/consent-theme.js +1 -0
- package/dist/context/consent-tracking-context.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context.js +1 -1
- package/dist/devtools-launcher.js +2 -0
- package/dist/devtools.js +1 -1
- package/dist/draft-context.js +2 -0
- package/dist/draft.js +1 -1
- package/dist/external-iab-context.js +1 -1
- package/dist/gpp.js +2 -0
- package/dist/headless.js +1 -1
- package/dist/hooks/use-color-scheme.js +1 -1
- package/dist/hooks/use-committed-ref.js +2 -0
- package/dist/hooks/use-focus-trap.js +1 -1
- package/dist/hooks/use-headless-iab-consent-ui.js +1 -1
- package/dist/hooks/use-iab-policy-guard.js +1 -0
- package/dist/hooks/use-late-entry.js +2 -0
- package/dist/hooks.js +1 -1
- package/dist/iab/styles.tw3.css +5 -45
- package/dist/iab-context.js +1 -1
- package/dist/index-parts/consent-banner.js +1 -0
- package/dist/index-parts/consent-dialog-link.js +1 -0
- package/dist/index-parts/consent-dialog-trigger.js +1 -0
- package/dist/index-parts/consent-dialog.js +1 -0
- package/dist/index-parts/consent-gate.js +1 -0
- package/dist/index-parts/core.js +1 -0
- package/dist/index-parts/draft.js +1 -0
- package/dist/index-parts/frame.js +1 -0
- package/dist/index-parts/hooks.js +1 -0
- package/dist/index-parts/hosted.js +1 -0
- package/dist/index-parts/module-hooks.js +1 -0
- package/dist/index-parts/offline.js +1 -0
- package/dist/index-parts/presets.js +1 -0
- package/dist/index-parts/provider.js +1 -0
- package/dist/index-parts/theme.js +1 -0
- package/dist/index-parts/translations.js +1 -0
- package/dist/index.js +1 -1
- package/dist/kernel-selector.js +1 -0
- package/dist/modes.js +1 -0
- package/dist/module-hooks/iframe-blocker.js +1 -1
- package/dist/module-hooks/network-blocker.js +1 -1
- package/dist/module-hooks/network-hold.js +2 -0
- package/dist/module-hooks/persistence.js +1 -1
- package/dist/panel-link.js +1 -1
- package/dist/panel-trigger.js +1 -1
- package/dist/panel.js +1 -1
- package/dist/postcss-tailwind3.js +1 -0
- package/dist/preferences.js +1 -2
- package/dist/provider.js +1 -1
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/server/headers.js +1 -1
- package/dist/server/normalize-url.js +1 -1
- package/dist/styles.tw3.css +33 -51
- package/dist/transports/hosted.js +1 -0
- package/dist/transports/manifest.js +1 -0
- package/dist/transports/offline.js +1 -1
- package/dist/utils/deferred-module.js +2 -0
- package/dist/utils/merge-slot-props.js +1 -1
- package/dist/utils/theme-utils.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/aggregate-components.d.ts +2 -2
- package/dist-types/chunk-warming.d.ts +45 -8
- package/dist-types/component-hooks/use-headless-consent-ui.d.ts +5 -5
- package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +2 -2
- 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/frame.d.ts +19 -0
- package/dist-types/components/consent-gate/index.d.ts +25 -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/feature-item.d.ts +28 -0
- package/dist-types/components/iab-panel/atoms/purpose-item.d.ts +5 -2
- package/dist-types/components/iab-panel/atoms/stack-item.d.ts +7 -2
- package/dist-types/components/iab-panel/atoms/vendor-list.d.ts +1 -1
- package/dist-types/components/iab-panel/iab-panel.d.ts +3 -3
- package/dist-types/components/iab-panel/index.d.ts +29 -26
- package/dist-types/components/iab-panel/use-iab-translations.d.ts +4 -0
- package/dist-types/components/iab-prompt/iab-prompt.d.ts +3 -3
- package/dist-types/components/iab-prompt/index.d.ts +19 -19
- package/dist-types/components/panel/atoms/card.d.ts +5 -4
- package/dist-types/components/panel/atoms/overlay.d.ts +1 -1
- package/dist-types/components/panel/index.d.ts +8 -8
- package/dist-types/components/panel/panel.d.ts +3 -3
- 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/atoms/trigger-icons.d.ts +25 -0
- 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 -17
- 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 +14 -12
- 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/atoms/early-tap-script.d.ts +17 -0
- package/dist-types/components/prompt/atoms/root.d.ts +4 -0
- package/dist-types/components/prompt/components.d.ts +9 -3
- package/dist-types/components/prompt/index.d.ts +12 -12
- package/dist-types/components/prompt/policy-actions.d.ts +2 -2
- package/dist-types/components/prompt/prompt.d.ts +5 -1
- package/dist-types/components/shared/dialog-sheets.d.ts +9 -0
- package/dist-types/components/shared/first-paint-sheets.d.ts +8 -0
- package/dist-types/components/shared/iab-dialog-sheets.d.ts +3 -0
- package/dist-types/components/shared/iab-first-paint-sheets.d.ts +3 -0
- package/dist-types/components/shared/libs/compose-refs.d.ts +20 -0
- 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/streamed-surface.d.ts +23 -0
- package/dist-types/components/shared/surface-styles.d.ts +36 -0
- 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/icon.d.ts +2 -1
- package/dist-types/components/shared/ui/logo.d.ts +0 -10
- package/dist-types/components/shared/ui/preference-item/index.d.ts +1 -1
- package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +13 -0
- 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/consent-theme.d.ts +38 -0
- package/dist-types/context/consent-tracking-context.d.ts +10 -0
- package/dist-types/context/index.d.ts +3 -3
- package/dist-types/context/theme-context.d.ts +3 -3
- package/dist-types/context.d.ts +25 -1
- package/dist-types/devtools-launcher.d.ts +29 -0
- package/dist-types/devtools.d.ts +13 -2
- package/dist-types/draft-context.d.ts +31 -0
- package/dist-types/draft.d.ts +81 -9
- package/dist-types/gpp.d.ts +27 -0
- package/dist-types/headless.d.ts +6 -7
- package/dist-types/hooks/use-committed-ref.d.ts +24 -0
- package/dist-types/hooks/use-focus-trap.d.ts +3 -1
- package/dist-types/hooks/use-headless-iab-consent-ui.d.ts +1 -1
- package/dist-types/hooks/use-iab-manager.d.ts +5 -5
- package/dist-types/hooks/use-iab-policy-guard.d.ts +35 -0
- package/dist-types/hooks/use-late-entry.d.ts +14 -0
- package/dist-types/hooks/use-theme.d.ts +1 -1
- package/dist-types/hooks.d.ts +106 -11
- package/dist-types/iab.d.ts +7 -7
- package/dist-types/index-parts/consent-banner.d.ts +7 -0
- package/dist-types/index-parts/consent-dialog-link.d.ts +7 -0
- package/dist-types/index-parts/consent-dialog-trigger.d.ts +7 -0
- package/dist-types/index-parts/consent-dialog.d.ts +7 -0
- package/dist-types/index-parts/consent-gate.d.ts +7 -0
- package/dist-types/index-parts/core.d.ts +7 -0
- package/dist-types/index-parts/draft.d.ts +7 -0
- package/dist-types/index-parts/frame.d.ts +7 -0
- package/dist-types/index-parts/hooks.d.ts +7 -0
- package/dist-types/index-parts/hosted.d.ts +7 -0
- package/dist-types/index-parts/module-hooks.d.ts +7 -0
- package/dist-types/index-parts/offline.d.ts +7 -0
- package/dist-types/index-parts/presets.d.ts +7 -0
- package/dist-types/index-parts/provider.d.ts +7 -0
- package/dist-types/index-parts/theme.d.ts +8 -0
- package/dist-types/index-parts/translations.d.ts +7 -0
- package/dist-types/index.d.ts +32 -28
- package/dist-types/kernel-selector.d.ts +68 -0
- package/dist-types/modes.d.ts +26 -0
- package/dist-types/module-hooks/iframe-blocker.d.ts +33 -1
- package/dist-types/module-hooks/network-blocker.d.ts +23 -0
- package/dist-types/module-hooks/network-hold.d.ts +47 -0
- 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 +13 -1
- package/dist-types/postcss-tailwind3.d.ts +21 -0
- package/dist-types/preferences.d.ts +12 -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 +169 -28
- package/dist-types/server/fetch-ssr-data.d.ts +1 -1
- package/dist-types/server/headers.d.ts +14 -4
- package/dist-types/server/index.d.ts +5 -5
- package/dist-types/server/normalize-url.d.ts +14 -7
- package/dist-types/server/types.d.ts +12 -1
- package/dist-types/theme-provider.d.ts +2 -2
- package/dist-types/transports/hosted.d.ts +36 -0
- package/dist-types/transports/manifest.d.ts +48 -0
- package/dist-types/transports/offline.d.ts +7 -16
- 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 +14 -2
- package/dist-types/utils/deferred-module.d.ts +13 -0
- package/dist-types/utils/index.d.ts +4 -4
- package/dist-types/utils/merge-slot-props.d.ts +17 -3
- package/dist-types/utils/merge-styles.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +18 -3
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +96 -70
- package/docs/assets/v3/bottom-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/brand-preferences.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/headless-bar-html.png +0 -0
- package/docs/assets/v3/headless-bar-mobile.png +0 -0
- package/docs/assets/v3/headless-bar.png +0 -0
- package/docs/assets/v3/slim-bar.png +0 -0
- package/docs/concepts/choose-your-setup.md +138 -0
- package/docs/concepts/consent-categories.md +84 -0
- package/docs/concepts/consent-state.md +421 -0
- package/docs/concepts/data-fetching.md +270 -0
- package/docs/concepts/how-consent-works.md +123 -0
- package/docs/concepts/modes.md +278 -0
- package/docs/{frameworks/react/concepts/policy-presets.md → concepts/policies.md} +8 -60
- package/docs/customization/class-names.md +202 -0
- package/docs/customization/dark-mode.md +157 -0
- package/docs/customization/motion.md +128 -0
- package/docs/customization/overview.md +68 -33
- package/docs/customization/recipes.md +838 -47
- package/docs/customization/slots.md +217 -35
- package/docs/customization/stylesheets.md +248 -0
- package/docs/customization/tailwind.md +863 -0
- package/docs/customization/tokens.md +167 -36
- package/docs/customization/translations.md +87 -3
- package/docs/frameworks/react/callbacks.md +118 -0
- package/docs/frameworks/react/clear-on-revocation.md +106 -0
- package/docs/frameworks/react/components/consent-banner.md +48 -27
- package/docs/frameworks/react/components/consent-dialog-link.md +13 -11
- package/docs/frameworks/react/components/consent-dialog-trigger.md +86 -76
- package/docs/frameworks/react/components/consent-dialog.md +111 -58
- package/docs/frameworks/react/components/{frame.md → consent-gate.md} +70 -49
- package/docs/frameworks/react/components/consent-provider.md +140 -0
- package/docs/frameworks/react/components/consent-widget.md +69 -24
- package/docs/frameworks/react/components/dev-tools.md +76 -85
- package/docs/frameworks/react/components.md +113 -0
- package/docs/frameworks/react/compose.md +354 -0
- package/docs/frameworks/react/content-security-policy.md +143 -0
- package/docs/frameworks/react/customize.md +258 -0
- package/docs/frameworks/react/embeds.md +89 -0
- package/docs/frameworks/react/gpp.md +163 -0
- package/docs/frameworks/react/headless.md +4 -4
- package/docs/frameworks/react/hooks.md +70 -0
- package/docs/frameworks/react/iab.md +259 -0
- package/docs/frameworks/react/network-blocker.md +140 -0
- package/docs/frameworks/react/quickstart.md +220 -102
- package/docs/frameworks/react/rendering.md +263 -0
- package/docs/frameworks/react/scripts.md +114 -0
- package/docs/frameworks/react/translations.md +155 -0
- package/docs/frameworks/react/troubleshooting.md +188 -61
- package/docs/frameworks/react/upgrade-v3.md +651 -0
- package/docs/frameworks/react/vendor-consent.md +188 -0
- package/docs/guides/banner-experiments.md +672 -0
- package/docs/guides/troubleshooting.md +192 -54
- package/docs/guides/verify-consent.md +96 -49
- package/docs/integrations/adobe-analytics.md +177 -183
- package/docs/integrations/ahrefs-analytics.md +162 -178
- package/docs/integrations/amplitude.md +172 -180
- package/docs/integrations/building-integrations.md +137 -33
- package/docs/integrations/clearbit.md +164 -178
- package/docs/integrations/cloudflare-web-analytics.md +166 -180
- package/docs/integrations/cloudflare-zaraz.md +333 -0
- package/docs/integrations/crisp.md +174 -182
- package/docs/integrations/databuddy.md +167 -197
- package/docs/integrations/fathom-analytics.md +168 -180
- package/docs/integrations/front-chat.md +308 -0
- package/docs/integrations/google-maps.md +142 -108
- package/docs/integrations/google-tag-manager.md +258 -185
- package/docs/integrations/google-tag.md +226 -182
- package/docs/integrations/heap.md +173 -179
- package/docs/integrations/hightouch.md +171 -181
- package/docs/integrations/hotjar.md +169 -179
- package/docs/integrations/intercom.md +193 -177
- package/docs/integrations/klaviyo.md +473 -0
- package/docs/integrations/linkedin-insights.md +184 -174
- package/docs/integrations/logrocket.md +170 -180
- package/docs/integrations/matomo-analytics.md +198 -202
- package/docs/integrations/meta-pixel.md +198 -174
- package/docs/integrations/microsoft-clarity.md +173 -179
- package/docs/integrations/microsoft-uet.md +158 -178
- package/docs/integrations/mixpanel-analytics.md +165 -184
- package/docs/integrations/one-dollar-stats.md +292 -0
- package/docs/integrations/openai-pixel.md +214 -325
- package/docs/integrations/overview.md +152 -83
- package/docs/integrations/pinterest-tag.md +315 -0
- package/docs/integrations/pirsch.md +179 -183
- package/docs/integrations/plausible-analytics.md +182 -182
- package/docs/integrations/posthog.md +323 -264
- package/docs/integrations/promptwatch.md +164 -178
- package/docs/integrations/reddit-pixel.md +195 -181
- package/docs/integrations/rudderstack.md +211 -210
- package/docs/integrations/rybbit-analytics.md +181 -184
- package/docs/integrations/segment.md +192 -178
- package/docs/integrations/sentry.md +402 -0
- package/docs/integrations/snapchat-pixel.md +196 -180
- package/docs/integrations/tiktok-pixel.md +181 -174
- package/docs/integrations/umami-analytics.md +173 -182
- package/docs/integrations/vercel-analytics.md +176 -181
- package/docs/integrations/x-pixel.md +186 -174
- package/docs/integrations/youtube.md +150 -111
- package/package.json +48 -17
- package/dist/component-hooks/use-manager.js +0 -2
- 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/ui-save.js +0 -1
- package/dist-types/component-hooks/use-manager.d.ts +0 -40
- 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/dist-types/ui-save.d.ts +0 -5
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/frameworks/react/components/consent-manager-provider.md +0 -71
- package/docs/frameworks/react/concepts/consent-categories.md +0 -33
- package/docs/frameworks/react/hooks/use-consent-manager/overview.md +0 -58
- package/docs/frameworks/react/iab/overview.md +0 -53
- package/docs/frameworks/react/script-loader.md +0 -63
- package/docs/frameworks/react/styling/overview.md +0 -217
- package/docs/guides/consent-state.md +0 -60
- package/docs/guides/data-fetching.md +0 -163
- package/docs/guides/deployment-modes.md +0 -63
- package/docs/integrations/clear-on-revocation.md +0 -167
- package/docs/upgrade-v3.md +0 -334
- 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
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { ActiveUI, AllConsentNames, ConsentState, ConsentType, HasCondition, Model, PromptPresentation, TranslationConfig } from '@c15t/core';
|
|
2
|
-
type SaveType = 'all' | 'custom' | 'necessary';
|
|
3
|
-
export declare const useConsentManager: () => {
|
|
4
|
-
activeUI: ActiveUI;
|
|
5
|
-
branding: import("@c15t/core").KernelBranding;
|
|
6
|
-
consentCategories: AllConsentNames[];
|
|
7
|
-
consentTypes: ConsentType[];
|
|
8
|
-
consents: ConsentState;
|
|
9
|
-
draftIsStale: boolean;
|
|
10
|
-
effectivePermissions: Readonly<ConsentState>;
|
|
11
|
-
explicitChoice: Readonly<import("@c15t/core").ExplicitChoice> | null;
|
|
12
|
-
getDisplayedConsents: () => ConsentType[];
|
|
13
|
-
has: (condition: HasCondition<AllConsentNames>) => boolean;
|
|
14
|
-
iab: Readonly<import("@c15t/core").KernelIABState> | null;
|
|
15
|
-
manager: null;
|
|
16
|
-
model: Model;
|
|
17
|
-
noticeDismissal: Readonly<import("@c15t/core").NoticeDismissal> | null;
|
|
18
|
-
optOutDirectives: readonly import("@c15t/core").PrivacyOptOut[];
|
|
19
|
-
policyBanner: PromptPresentation;
|
|
20
|
-
policyCategories: AllConsentNames[];
|
|
21
|
-
policyDialog: import("@c15t/core").PreferencesPresentation;
|
|
22
|
-
policyRule: Readonly<import("@c15t/core").ResolvedPolicyRule>;
|
|
23
|
-
policyScopeMode: import("@c15t/core").PolicyScopeMode;
|
|
24
|
-
privacySignals: import("@c15t/core").KernelPrivacySignals;
|
|
25
|
-
promptRequirement: Readonly<import("@c15t/core").PromptRequirement>;
|
|
26
|
-
resetDraft: () => void;
|
|
27
|
-
resolution: Readonly<import("@c15t/core").PolicyResolution>;
|
|
28
|
-
restrictions: Readonly<Partial<Record<import("@c15t/core").OptionalConsentCategory, readonly import("@c15t/core").RestrictionReason[]>>>;
|
|
29
|
-
saveConsents: (type: SaveType, _options?: {
|
|
30
|
-
uiSource?: string;
|
|
31
|
-
}) => Promise<void>;
|
|
32
|
-
selectedConsentTypes: Readonly<ConsentState>;
|
|
33
|
-
selectedConsents: Readonly<ConsentState>;
|
|
34
|
-
setActiveUI: (ui: ActiveUI) => void;
|
|
35
|
-
setSelectedConsent: (name: AllConsentNames, value: boolean) => void;
|
|
36
|
-
subscribeToConsentChanges: (listener: (state: ConsentState) => void) => () => void;
|
|
37
|
-
translationConfig: TranslationConfig;
|
|
38
|
-
updateConsentCategories: (_names: AllConsentNames[]) => void;
|
|
39
|
-
};
|
|
40
|
-
export {};
|
|
@@ -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/dist-types/ui-save.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ConsentKernel, SaveResult } from '@c15t/core';
|
|
2
|
-
/** Explicit navigation supersedes a pending UI action, even to the same dialog. */
|
|
3
|
-
export declare const invalidateConsentUIAction: (kernel: ConsentKernel) => void;
|
|
4
|
-
/** Keep an open preferences dialog available until its own save succeeds. */
|
|
5
|
-
export declare const saveConsentUI: (kernel: ConsentKernel, save: () => Promise<SaveResult>, canClose: () => boolean) => Promise<SaveResult>;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: ConsentProvider
|
|
3
|
-
description: Configure the v3 consent runtime and share its state with child components.
|
|
4
|
-
group: frameworks
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Mount one provider
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
import type { ReactNode } from 'react';
|
|
11
|
-
import { ConsentProvider, ConsentBanner, ConsentDialog, ConsentDialogLink, hosted } from 'c15t/react';
|
|
12
|
-
|
|
13
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
14
|
-
|
|
15
|
-
export function Consent({ children }: { children: ReactNode }) {
|
|
16
|
-
return (
|
|
17
|
-
<ConsentProvider options={{ mode }}>
|
|
18
|
-
{children}
|
|
19
|
-
<ConsentBanner />
|
|
20
|
-
<ConsentDialog />
|
|
21
|
-
<ConsentDialogLink>Privacy settings</ConsentDialogLink>
|
|
22
|
-
</ConsentProvider>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Replace the URL with your Inth project endpoint. Import the adapter stylesheet
|
|
28
|
-
once at the app root. In Next.js this component needs a client boundary; prefer
|
|
29
|
-
the framework's `ConsentRoot` when passing server-resolved state.
|
|
30
|
-
|
|
31
|
-
## Provider responsibilities
|
|
32
|
-
|
|
33
|
-
The provider owns initialization, persistence, configured script loading and
|
|
34
|
-
subscriptions. Keep it mounted across client navigation. Its initial mode and
|
|
35
|
-
prefetch configuration belong to the runtime's creation, not a per-render
|
|
36
|
-
mechanism for switching visitors or backends.
|
|
37
|
-
|
|
38
|
-
| Option | Purpose |
|
|
39
|
-
| --------------------- | --------------------------------------------------------------- |
|
|
40
|
-
| `mode` | Hosted, offline or custom transport factory |
|
|
41
|
-
| `scripts` | Consent-managed script configurations |
|
|
42
|
-
| `callbacks` | Choice, permission and error events |
|
|
43
|
-
| `theme`, `components` | Theme tokens and component slot attributes |
|
|
44
|
-
| `presentation` | Prompt and preferences layout behavior |
|
|
45
|
-
| `i18n` | Languages and message overrides |
|
|
46
|
-
| `storageConfig` | Browser record storage configuration |
|
|
47
|
-
| `enabled` | Set false only when intentionally bypassing consent enforcement |
|
|
48
|
-
|
|
49
|
-
`enabled: false` grants categories and allows gated loading while suppressing
|
|
50
|
-
consent UI. It is not a way to fix failed initialization or hide a banner in
|
|
51
|
-
production.
|
|
52
|
-
|
|
53
|
-
## Observe changes without inventing choices
|
|
54
|
-
|
|
55
|
-
`onChoiceRecorded` reports explicit accept, reject and save actions.
|
|
56
|
-
`onPermissionsChanged` also covers changes caused by policy, expiry or privacy
|
|
57
|
-
signals. Hydration and notice dismissal do not become explicit choices.
|
|
58
|
-
|
|
59
|
-
An externally owned runtime can be passed through `runtime`. Its owner must
|
|
60
|
-
start and dispose it. A provider borrowing that runtime must not initialize or
|
|
61
|
-
dispose a second copy. See [consent state](../../../guides/consent-state.md) and
|
|
62
|
-
[deployment modes](../../../guides/deployment-modes.md).
|
|
63
|
-
|
|
64
|
-
## Clear data when consent is denied
|
|
65
|
-
|
|
66
|
-
Set `options.clearOnRevocation` to declare cookies, localStorage keys, and
|
|
67
|
-
sessionStorage keys by optional consent category. Cleanup waits for policy
|
|
68
|
-
resolution, then clears denied categories and later allowed-to-denied
|
|
69
|
-
transitions. This option is initial-only. See
|
|
70
|
-
[clear on revocation](../../../integrations/clear-on-revocation.md) for examples,
|
|
71
|
-
cookie scopes, and browser limits.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Consent categories
|
|
3
|
-
description: Assign optional features to categories and understand how policy
|
|
4
|
-
scope affects permission.
|
|
5
|
-
group: frameworks
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Choose categories by purpose
|
|
9
|
-
|
|
10
|
-
| Category | Purpose |
|
|
11
|
-
| --------------- | ---------------------------------------------- |
|
|
12
|
-
| `necessary` | Functionality required for the site to operate |
|
|
13
|
-
| `functionality` | Optional features such as support widgets |
|
|
14
|
-
| `measurement` | Analytics and usage measurement |
|
|
15
|
-
| `experience` | Optional personalization |
|
|
16
|
-
| `marketing` | Advertising and marketing |
|
|
17
|
-
|
|
18
|
-
`necessary` is always permitted. Assign categories based on what an integration
|
|
19
|
-
does in your application; renaming analytics to necessary does not change its
|
|
20
|
-
purpose. The provider's displayed categories and the resolved policy scope must
|
|
21
|
-
agree.
|
|
22
|
-
|
|
23
|
-
## Respect policy scope
|
|
24
|
-
|
|
25
|
-
A strict scope denies categories outside the rule. A permissive scope can allow
|
|
26
|
-
out-of-scope categories unless another restriction applies. When a rule selects
|
|
27
|
-
only some optional categories, set `scopeMode` explicitly. An omitted scope,
|
|
28
|
-
`['*']`, or a list containing only `necessary` expands to the default optional
|
|
29
|
-
categories; a necessary-only list is not a shortcut for disabling all tracking.
|
|
30
|
-
|
|
31
|
-
Use effective permissions to gate work and explicit choices to inspect what the
|
|
32
|
-
visitor confirmed. Read [consent state](../../../guides/consent-state.md) for that
|
|
33
|
-
distinction and [migration](../../../upgrade-v3.md) for v3 policy configuration.
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Hooks
|
|
3
|
-
description: Gate features and save consent choices in React components with the
|
|
4
|
-
focused hooks exported from c15t/react.
|
|
5
|
-
group: frameworks
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Read only the state you need
|
|
9
|
-
|
|
10
|
-
Every hook reads the runtime from the nearest `ConsentProvider`, so call them
|
|
11
|
-
from components rendered inside that provider and import them from
|
|
12
|
-
`c15t/react`.
|
|
13
|
-
|
|
14
|
-
```tsx title="src/optional-feature.tsx"
|
|
15
|
-
import { useConsent } from 'c15t/react';
|
|
16
|
-
|
|
17
|
-
export function OptionalFeature() {
|
|
18
|
-
const allowed = useConsent('marketing');
|
|
19
|
-
return allowed ? <div>Optional marketing content</div> : null;
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Call hooks inside the consent provider. `useConsent` reads effective permission,
|
|
24
|
-
which can be true under an opt-out policy without a recorded grant.
|
|
25
|
-
|
|
26
|
-
| Need | Hook |
|
|
27
|
-
| --------------------------------- | ------------------------------------------ |
|
|
28
|
-
| One category's current permission | `useConsent(category)` |
|
|
29
|
-
| All current permissions | `useConsents()` |
|
|
30
|
-
| Recorded per-category choices | `useExplicitChoice()` |
|
|
31
|
-
| Whether a prompt is required | `usePromptRequirement()` |
|
|
32
|
-
| Active policy and resolution | `usePolicyRule()`, `usePolicyResolution()` |
|
|
33
|
-
| Save an explicit choice | `useSaveConsents()` |
|
|
34
|
-
| Open or close a consent surface | `useSetActiveUI()` |
|
|
35
|
-
| Acknowledge a notice | `useDismissNotice()` |
|
|
36
|
-
|
|
37
|
-
## Save from a visitor action
|
|
38
|
-
|
|
39
|
-
Render this component inside your existing `ConsentProvider`.
|
|
40
|
-
|
|
41
|
-
```tsx title="src/reject-button.tsx"
|
|
42
|
-
import { useSaveConsents } from 'c15t/react';
|
|
43
|
-
|
|
44
|
-
export function RejectButton() {
|
|
45
|
-
const save = useSaveConsents();
|
|
46
|
-
return <button type="button" onClick={() => void save('none')}>Reject optional</button>;
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
This is an isolated action example, not a complete policy-aware banner. Use the
|
|
51
|
-
stock UI or headless surface actions for a complete prompt. Do not call save on
|
|
52
|
-
mount to persist a state derived from permissions.
|
|
53
|
-
|
|
54
|
-
`useConsentManager` remains available for the combined UI API, including draft
|
|
55
|
-
management. Prefer focused hooks for simple feature gates and use the headless
|
|
56
|
-
UI hook when implementing a complete custom prompt. Read
|
|
57
|
-
[consent state](../../../../guides/consent-state.md) before treating a callback as evidence
|
|
58
|
-
of a choice.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: IAB TCF
|
|
3
|
-
description: Mount the IAB TCF banner and dialog inside a React ConsentProvider
|
|
4
|
-
and configure the CMP ID, policy and vendor data.
|
|
5
|
-
group: frameworks
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Prepare the IAB configuration
|
|
9
|
-
|
|
10
|
-
Use the IAB integration when your application needs the Transparency and Consent
|
|
11
|
-
Framework. Configure an IAB policy, the correct CMP identity and vendor data for
|
|
12
|
-
your deployment. A demo CMP ID is not a production configuration.
|
|
13
|
-
|
|
14
|
-
Install `@c15t/iab` alongside your framework adapter, then mount the IAB
|
|
15
|
-
components inside an existing consent provider connected to Inth.
|
|
16
|
-
|
|
17
|
-
Import the components from `c15t/react/iab` and render them inside your
|
|
18
|
-
existing `ConsentProvider` from `c15t/react`. Import `c15t/react/iab/styles.css`
|
|
19
|
-
at your global stylesheet entry.
|
|
20
|
-
|
|
21
|
-
```tsx title="src/iab-consent.tsx"
|
|
22
|
-
import { IABProvider, IABConsentBanner, IABConsentDialog } from 'c15t/react/iab';
|
|
23
|
-
|
|
24
|
-
export function IABConsent({ cmpId }: { cmpId: number }) {
|
|
25
|
-
return (
|
|
26
|
-
<IABProvider cmpId={cmpId}>
|
|
27
|
-
<IABConsentBanner />
|
|
28
|
-
<IABConsentDialog />
|
|
29
|
-
</IABProvider>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Supply the CMP ID from your deployment's IAB configuration. Keep a persistent
|
|
35
|
-
preferences entry point through the surrounding consent provider.
|
|
36
|
-
|
|
37
|
-
## Resolve the policy before rendering
|
|
38
|
-
|
|
39
|
-
IAB components remain hidden until an applicable policy resolves. Forcing a
|
|
40
|
-
dialog open does not create a policy or vendor list. Inspect resolution and the
|
|
41
|
-
Global Vendor List response before changing rendering conditions.
|
|
42
|
-
|
|
43
|
-
IAB presentation follows `presentation.prompt.blocking` and
|
|
44
|
-
`presentation.preferences.blocking`. A blocking dialog needs focus management,
|
|
45
|
-
scroll locking and a backdrop together. See [migration](../../../upgrade-v3.md) for
|
|
46
|
-
legacy option behavior.
|
|
47
|
-
|
|
48
|
-
## Verify vendor and purpose choices
|
|
49
|
-
|
|
50
|
-
Test category choices alongside vendor, purpose, legitimate-interest and special
|
|
51
|
-
feature controls used by your integration. Confirm the TC String and `__tcfapi`
|
|
52
|
-
reflect the saved state, and verify the vendor's actual requests. A category-only
|
|
53
|
-
banner test does not establish that the IAB flow works.
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Load scripts with consent
|
|
3
|
-
description: Register vendor scripts once and let effective permissions control loading.
|
|
4
|
-
group: frameworks
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Register scripts on the provider
|
|
8
|
-
|
|
9
|
-
Install `@c15t/scripts` for vendor helpers. This React-compatible client component
|
|
10
|
-
uses Inth as the backend. Set the URL to the endpoint supplied by your Inth
|
|
11
|
-
project and keep the component mounted around your application.
|
|
12
|
-
|
|
13
|
-
```tsx title="components/consent.tsx"
|
|
14
|
-
'use client';
|
|
15
|
-
|
|
16
|
-
import type { ReactNode } from 'react';
|
|
17
|
-
import { ConsentProvider, ConsentBanner, ConsentDialog, ConsentDialogLink, hosted } from 'c15t/react';
|
|
18
|
-
import { metaPixel } from '@c15t/scripts/meta-pixel';
|
|
19
|
-
|
|
20
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
21
|
-
const scripts = [metaPixel({ pixelId: '123456789012345' })];
|
|
22
|
-
|
|
23
|
-
export function Consent({ children }: { children: ReactNode }) {
|
|
24
|
-
return (
|
|
25
|
-
<ConsentProvider options={{ mode, scripts }}>
|
|
26
|
-
{children}
|
|
27
|
-
<ConsentBanner />
|
|
28
|
-
<ConsentDialog />
|
|
29
|
-
<ConsentDialogLink>Privacy settings</ConsentDialogLink>
|
|
30
|
-
</ConsentProvider>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Import your adapter's stylesheet globally, as in the framework quickstart. For
|
|
36
|
-
an existing server-resolved `ConsentRoot`, keep that root and pass
|
|
37
|
-
`scripts` as a top-level prop instead of mounting a second provider.
|
|
38
|
-
|
|
39
|
-
## Understand loading and revocation
|
|
40
|
-
|
|
41
|
-
Ordinary scripts wait for their category's effective permission. Give each
|
|
42
|
-
script a stable unique `id` and remove any other loader for the same vendor.
|
|
43
|
-
Some helpers use `alwaysLoad` to load the SDK and signal consent through its own
|
|
44
|
-
API. Read the vendor guide; a category field alone does not guarantee no
|
|
45
|
-
requests.
|
|
46
|
-
|
|
47
|
-
Removing a script element cannot undo JavaScript that already executed or
|
|
48
|
-
requests already sent. Use the vendor's supported consent and cleanup behavior,
|
|
49
|
-
and stop future event calls after revocation. Test both initial denial and a
|
|
50
|
-
change from allowed to denied.
|
|
51
|
-
|
|
52
|
-
Use [custom integrations](../../integrations/building-integrations.md) for an
|
|
53
|
-
unlisted vendor and [verification](../../guides/verify-consent.md) for the network
|
|
54
|
-
checks. Google helpers have a separate
|
|
55
|
-
[Consent Mode contract](../../integrations/google-tag-manager.md).
|
|
56
|
-
|
|
57
|
-
## Clear stored tracking data
|
|
58
|
-
|
|
59
|
-
Script gating does not remove cookies or Web Storage entries that a script
|
|
60
|
-
already wrote. Add `clearOnRevocation` to `ConsentProvider.options` to remove
|
|
61
|
-
declared data when its category is denied. See
|
|
62
|
-
[clear on revocation](../../integrations/clear-on-revocation.md) for configuration
|
|
63
|
-
and browser limits.
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Styling
|
|
3
|
-
description: Import the React stylesheet and theme c15t components with tokens,
|
|
4
|
-
slots, and class names on ConsentProvider.
|
|
5
|
-
group: frameworks
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Stylesheet
|
|
9
|
-
|
|
10
|
-
Import the stylesheet once, next to your global CSS, in the entry module that
|
|
11
|
-
renders `ConsentProvider`:
|
|
12
|
-
|
|
13
|
-
```tsx
|
|
14
|
-
import 'c15t/react/styles.css';
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Every rule lives in `@layer components`, so unlayered utilities from Tailwind
|
|
18
|
-
v4 and atomic classes from StyleX override it without specificity tricks.
|
|
19
|
-
Tailwind v3 treats `@layer components` as its own directive, so import the
|
|
20
|
-
Tailwind 3 build from your Tailwind entry instead, between the `components`
|
|
21
|
-
and `utilities` directives:
|
|
22
|
-
|
|
23
|
-
```css
|
|
24
|
-
@tailwind base;
|
|
25
|
-
@tailwind components;
|
|
26
|
-
@import 'c15t/react/styles.tw3.css';
|
|
27
|
-
@tailwind utilities;
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Tokens
|
|
31
|
-
|
|
32
|
-
The provider snippets below are partial configuration examples. Apply them to
|
|
33
|
-
your existing `ConsentProvider` from `c15t/react`, keeping its `mode`, children
|
|
34
|
-
and other options.
|
|
35
|
-
|
|
36
|
-
Colors, radii, shadows, typography, and motion come from `--c15t-*` custom
|
|
37
|
-
properties. Set them on the provider through `theme`, or override the
|
|
38
|
-
variables directly in your CSS.
|
|
39
|
-
|
|
40
|
-
React and Next.js render the theme stylesheet in the server HTML before
|
|
41
|
-
the banner. Pass the same theme on the server and the first client render
|
|
42
|
-
so your custom tokens apply before hydration. The provider's `nonce`
|
|
43
|
-
option also applies to this stylesheet for Content Security Policy.
|
|
44
|
-
|
|
45
|
-
`colorScheme: 'dark'` applies dark tokens in the server HTML.
|
|
46
|
-
`colorScheme: 'system'` uses a CSS media query to follow the visitor's
|
|
47
|
-
preference before hydration. If your app manages dark mode through a
|
|
48
|
-
root class instead, include that class in the server HTML too.
|
|
49
|
-
|
|
50
|
-
```tsx
|
|
51
|
-
import { ConsentProvider, defineTheme } from 'c15t/react';
|
|
52
|
-
|
|
53
|
-
const theme = defineTheme({
|
|
54
|
-
colors: { primary: '#2f6f4e' },
|
|
55
|
-
radius: { lg: '4px' },
|
|
56
|
-
consentActions: {
|
|
57
|
-
primary: { variant: 'primary', mode: 'filled' },
|
|
58
|
-
dismiss: { variant: 'neutral', mode: 'stroke' },
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
<ConsentProvider options={{ mode, theme }} />;
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
`consentActions` decides how each action role looks: `default` applies to
|
|
66
|
-
every button, `primary` to whichever actions the policy or your props mark
|
|
67
|
-
primary, and `accept`, `reject`, `customize`, and `dismiss` to one role each.
|
|
68
|
-
Per-action keys win over `primary`, which wins over `default`.
|
|
69
|
-
|
|
70
|
-
Banner sizing has its own variables. Override them in CSS when a variant
|
|
71
|
-
needs a different footprint:
|
|
72
|
-
|
|
73
|
-
| Variable | Default | Applies to |
|
|
74
|
-
| ----------------------------------- | ------- | ---------------- |
|
|
75
|
-
| `--consent-banner-max-width` | `440px` | `floating` cards |
|
|
76
|
-
| `--consent-banner-widget-max-width` | `20rem` | `widget` chips |
|
|
77
|
-
| `--consent-banner-wall-max-width` | `30rem` | `wall` cards |
|
|
78
|
-
|
|
79
|
-
## Colors by consent model
|
|
80
|
-
|
|
81
|
-
The primary action can change while the brand color stays the same. Set
|
|
82
|
-
`consentActions.primary` once, then select `primaryButton` per policy as
|
|
83
|
-
shown in [ConsentBanner](../components/consent-banner.md#per-policy-buttons).
|
|
84
|
-
|
|
85
|
-
To give opt-in and opt-out banners different colors, scope the tokens to
|
|
86
|
-
the root's attributes. Include hover and foreground colors when overriding
|
|
87
|
-
CSS tokens directly:
|
|
88
|
-
|
|
89
|
-
```css
|
|
90
|
-
[data-prompt][data-model='opt-in'] {
|
|
91
|
-
--c15t-primary: #2f6f4e;
|
|
92
|
-
--c15t-primary-hover: #24563c;
|
|
93
|
-
--c15t-text-on-primary: #fff;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
[data-prompt][data-model='opt-out'] {
|
|
97
|
-
--c15t-primary: #6b3fa0;
|
|
98
|
-
--c15t-primary-hover: #55327f;
|
|
99
|
-
--c15t-text-on-primary: #fff;
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
These colors apply to the action marked primary. Button layout and color
|
|
104
|
-
changes do not change the policy or expire a saved choice.
|
|
105
|
-
|
|
106
|
-
## Slots
|
|
107
|
-
|
|
108
|
-
Each component part is a slot. A slot accepts any attributes the element
|
|
109
|
-
takes, so the contract is the same whether you write class strings or pass an
|
|
110
|
-
object with `className` and `style`. Set slots on the provider under
|
|
111
|
-
`components`, keyed by component and part.
|
|
112
|
-
|
|
113
|
-
For a full-width notice, use the supported `bar` variant. Inside your existing
|
|
114
|
-
provider, replace the stock banner with:
|
|
115
|
-
|
|
116
|
-
```tsx title="src/regional-banner.tsx"
|
|
117
|
-
import { ConsentBanner, usePolicyRule } from 'c15t/react';
|
|
118
|
-
|
|
119
|
-
export function RegionalBanner() {
|
|
120
|
-
const policy = usePolicyRule();
|
|
121
|
-
return <ConsentBanner variant={policy?.prompt === 'notice' ? 'bar' : 'floating'} />;
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
To remove the notice card's radius, add these values to the existing
|
|
126
|
-
`options.components.banner` slots. The root owns `data-prompt`, so the card
|
|
127
|
-
uses Tailwind's `group` selector to read it:
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
const bannerSlots = {
|
|
131
|
-
root: { className: 'group' },
|
|
132
|
-
card: { className: 'group-data-[prompt=notice]:rounded-none' },
|
|
133
|
-
rightLink: {
|
|
134
|
-
className: 'underline-offset-4 data-[right=opt-out]:text-red-700',
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// In the existing options.components object:
|
|
139
|
-
// banner: bannerSlots
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
The root also carries `data-variant`, so you can restyle one shape without
|
|
143
|
-
touching the others. Tailwind, giving a `bar` a brand-colored top edge and
|
|
144
|
-
tighter text:
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
<ConsentProvider
|
|
148
|
-
options={{
|
|
149
|
-
mode,
|
|
150
|
-
presentation: { prompt: { variant: 'bar' } },
|
|
151
|
-
components: {
|
|
152
|
-
banner: {
|
|
153
|
-
root: { className: 'group' },
|
|
154
|
-
card: {
|
|
155
|
-
className:
|
|
156
|
-
'group-data-[variant=bar]:border-t-4 group-data-[variant=bar]:border-t-emerald-600',
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
description: {
|
|
160
|
-
banner: { className: 'group-data-[variant=bar]:text-xs' },
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
}}
|
|
164
|
-
/>
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
`data-variant` sits on the root, so child slots use Tailwind's `group`
|
|
168
|
-
prefix to read it.
|
|
169
|
-
|
|
170
|
-
StyleX, spreading the result of `stylex.props()` into a slot:
|
|
171
|
-
|
|
172
|
-
```tsx
|
|
173
|
-
import * as stylex from '@stylexjs/stylex';
|
|
174
|
-
|
|
175
|
-
const styles = stylex.create({
|
|
176
|
-
card: { borderRadius: 0, boxShadow: 'none' },
|
|
177
|
-
rightLink: { textUnderlineOffset: 4, color: 'rgb(185 28 28)' },
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
<ConsentProvider
|
|
181
|
-
options={{
|
|
182
|
-
mode,
|
|
183
|
-
components: {
|
|
184
|
-
banner: {
|
|
185
|
-
card: stylex.props(styles.card),
|
|
186
|
-
rightLink: stylex.props(styles.rightLink),
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
}}
|
|
190
|
-
/>;
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Set `noStyle` on a component to drop the built-in classes from every part and
|
|
194
|
-
keep only what your slots pass. Set `noStyle` in the provider options to do it
|
|
195
|
-
for every component.
|
|
196
|
-
|
|
197
|
-
Banner slot keys under `components.banner`:
|
|
198
|
-
|
|
199
|
-
| Key | Element |
|
|
200
|
-
| ------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
201
|
-
| `root` | Fixed-position wrapper carrying `data-prompt`, `data-model`, `data-variant`, `data-position`, and `data-blocking` |
|
|
202
|
-
| `cardShell` | Sizes the card and holds the branding tag |
|
|
203
|
-
| `card` | The visible card, carrying `data-state` |
|
|
204
|
-
| `header` | Title and description container |
|
|
205
|
-
| `title` | Heading |
|
|
206
|
-
| `footer` | Action area |
|
|
207
|
-
| `actions` | Group of action groups |
|
|
208
|
-
| `actionGroup` | One group of equally prominent actions |
|
|
209
|
-
| `rights` | Group of right links, rendered before the actions |
|
|
210
|
-
| `rightLink` | One right link, carrying `data-action="right"` and `data-right` |
|
|
211
|
-
| `overlay` | Backdrop shown when the banner blocks the page |
|
|
212
|
-
|
|
213
|
-
Action buttons carry `data-action` and `data-variant`, and right links carry
|
|
214
|
-
`data-action="right"`, so a single rule such as `[data-action='dismiss']` or
|
|
215
|
-
`[data-action='right']` styles one role across every surface. Right links are
|
|
216
|
-
underlined text by default, so the only button on a notice is the primary
|
|
217
|
-
action.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Understand consent state
|
|
3
|
-
description: Distinguish policy resolution, effective permissions, explicit
|
|
4
|
-
choices, notices and privacy signals.
|
|
5
|
-
group: guides
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Use effective permissions to gate features
|
|
9
|
-
|
|
10
|
-
`effectivePermissions` answers whether a category is allowed now. It combines
|
|
11
|
-
the resolved policy, stored choices and privacy signals. Under an opt-out rule,
|
|
12
|
-
permission can be true before the visitor acts. It is not evidence of a recorded
|
|
13
|
-
grant.
|
|
14
|
-
|
|
15
|
-
| Task | State or API |
|
|
16
|
-
| ------------------------------------------- | ---------------------------------------------------- |
|
|
17
|
-
| Load a script or render an optional feature | `effectivePermissions`, React `useConsent(category)` |
|
|
18
|
-
| Inspect what the visitor confirmed | `explicitChoice` |
|
|
19
|
-
| Decide whether to show a prompt | `promptRequirement` |
|
|
20
|
-
| Explain regional behavior | `policyRule` |
|
|
21
|
-
| Diagnose initialization | `resolution` |
|
|
22
|
-
|
|
23
|
-
## Record only explicit visitor actions
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
// Run in the corresponding click or form-submit handler.
|
|
27
|
-
await kernel.commands.save('all');
|
|
28
|
-
await kernel.commands.save('none');
|
|
29
|
-
await kernel.commands.save({ marketing: false });
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
These are three separate examples: accept, reject and a partial save. A partial
|
|
33
|
-
save confirms only the supplied categories and keeps the other categories'
|
|
34
|
-
confirmation times. Do not call all three in one handler.
|
|
35
|
-
|
|
36
|
-
`onChoiceRecorded` reports an explicit choice. `onPermissionsChanged` reports
|
|
37
|
-
changes in effective permissions, including changes caused by expiry or privacy
|
|
38
|
-
signals. Hydration must not be counted as another visitor choice.
|
|
39
|
-
|
|
40
|
-
## Treat notices and privacy signals separately
|
|
41
|
-
|
|
42
|
-
`commands.dismissNotice()` acknowledges the current notice. It does not grant
|
|
43
|
-
categories or overwrite existing denials. Global Privacy Control, or GPC, is a
|
|
44
|
-
browser privacy signal. Its configured restrictions can change permissions
|
|
45
|
-
without creating an explicit choice.
|
|
46
|
-
|
|
47
|
-
A rule with `prompt: 'none'` can still require a persistent preferences entry
|
|
48
|
-
point. Check the policy's rights instead of hiding preferences merely because
|
|
49
|
-
the banner is absent. An unresolved rule is another distinct state; optional
|
|
50
|
-
permissions stay denied until resolution succeeds.
|
|
51
|
-
|
|
52
|
-
## Preserve records during hydration
|
|
53
|
-
|
|
54
|
-
Server helpers return records with policy information and evaluation time.
|
|
55
|
-
Forward that configuration intact. Copying an allowed category into a receipt
|
|
56
|
-
would invent a grant and lose its original confirmation time.
|
|
57
|
-
|
|
58
|
-
Valid v2 records can be read without a startup rewrite. The next explicit action
|
|
59
|
-
writes the v3 format. See [migration](../upgrade-v3.md) for expiry, partial saves,
|
|
60
|
-
custom transports and backend contract changes.
|