@c15t/react 2.2.1 → 3.0.0-alpha.0
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 +88 -141
- package/README.md +2 -2
- package/dist/aggregate-components.js +2 -0
- package/dist/chunk-warming.js +1 -0
- package/dist/component-hooks/use-headless-consent-ui.js +2 -0
- package/dist/component-hooks/use-headless-iab-consent-ui.js +2 -0
- package/dist/component-hooks/use-manager.js +2 -0
- package/dist/component-hooks/use-panel-trigger.js +2 -0
- package/dist/component-hooks/use-translations.js +2 -0
- package/dist/components/consent-preferences-link/consent-preferences-link.js +2 -1
- package/dist/components/consent-preferences-link/index.js +1 -0
- package/dist/components/frame/atoms.js +1 -1
- package/dist/components/frame/frame.js +2 -1
- package/dist/components/frame/index.js +2 -1
- package/dist/components/iab-panel/atoms/card.js +2 -0
- package/dist/components/iab-panel/atoms/content.js +2 -0
- package/dist/components/iab-panel/atoms/footer.js +2 -0
- package/dist/components/iab-panel/atoms/header.js +2 -0
- package/dist/components/iab-panel/atoms/overlay.js +2 -0
- package/dist/components/iab-panel/atoms/purpose-item.js +2 -0
- package/dist/components/iab-panel/atoms/root.js +2 -0
- package/dist/components/iab-panel/atoms/stack-item.js +2 -0
- package/dist/components/iab-panel/atoms/tabs.js +2 -0
- package/dist/components/iab-panel/atoms/vendor-list.js +2 -0
- package/dist/components/iab-panel/hooks/use-display-model.js +2 -0
- package/dist/components/iab-panel/hooks/use-gvl-data.js +2 -0
- package/dist/components/iab-panel/iab-panel.js +2 -0
- package/dist/components/iab-panel/index.js +2 -0
- package/dist/components/iab-panel/use-iab-translations.js +1 -0
- package/dist/components/iab-prompt/atoms/button-group.js +2 -0
- package/dist/components/iab-prompt/atoms/card.js +2 -0
- package/dist/components/iab-prompt/atoms/description.js +2 -0
- package/dist/components/iab-prompt/atoms/footer.js +2 -0
- package/dist/components/iab-prompt/atoms/header.js +2 -0
- package/dist/components/iab-prompt/atoms/overlay.js +2 -0
- package/dist/components/iab-prompt/atoms/root.js +2 -0
- package/dist/components/iab-prompt/atoms/title.js +2 -0
- package/dist/components/iab-prompt/iab-prompt.js +2 -0
- package/dist/components/iab-prompt/index.js +2 -0
- package/dist/components/panel/atoms/card.js +2 -0
- package/dist/components/panel/atoms/overlay.js +1 -0
- package/dist/components/panel/atoms/root.js +2 -0
- package/dist/components/panel/index.js +2 -0
- package/dist/components/panel/panel.js +2 -0
- package/dist/components/{consent-dialog-link → panel-link}/index.js +1 -0
- package/dist/components/panel-trigger/atoms/button.js +2 -0
- package/dist/components/panel-trigger/atoms/icon.js +2 -0
- package/dist/components/panel-trigger/atoms/root.js +2 -0
- package/dist/components/panel-trigger/atoms/text.js +2 -0
- package/dist/components/panel-trigger/atoms/toolbar.js +2 -0
- package/dist/components/panel-trigger/index.js +2 -0
- package/dist/components/panel-trigger/panel-trigger-toolbar.js +2 -0
- package/dist/components/panel-trigger/panel-trigger.js +2 -0
- package/dist/components/panel-trigger/use-draggable.js +2 -0
- package/dist/components/preferences/atoms/accordion.js +1 -0
- package/dist/components/preferences/atoms/button.js +1 -0
- package/dist/components/preferences/atoms/footer.js +1 -0
- package/dist/components/preferences/atoms/root.js +2 -0
- package/dist/components/preferences/index.js +2 -0
- package/dist/components/preferences/policy-actions.js +2 -0
- package/dist/components/preferences/preferences.js +2 -0
- package/dist/components/prompt/atoms/overlay.js +1 -0
- package/dist/components/prompt/atoms/root.js +2 -0
- package/dist/components/prompt/components.js +1 -0
- package/dist/components/prompt/error-boundary.js +2 -0
- package/dist/components/prompt/index.js +2 -0
- package/dist/components/prompt/policy-actions.js +2 -0
- package/dist/components/prompt/prompt.js +2 -0
- package/dist/components/prompt/resolve-banner-primary-actions.js +1 -0
- package/dist/components/prompt/surface-context.js +2 -0
- package/dist/components/prompt/use-banner-copy.js +2 -0
- package/dist/components/shared/libs/recursive-clone-children.js +1 -1
- package/dist/components/shared/libs/slot.js +1 -1
- package/dist/components/shared/libs/use-controllable-state.js +1 -1
- package/dist/components/shared/policy-actions.js +2 -1
- package/dist/components/shared/primitives/box.js +2 -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/ui/accordion/accordion.js +2 -1
- package/dist/components/shared/ui/animated-collapse/animated-collapse.js +2 -1
- package/dist/components/shared/ui/branding.js +1 -1
- package/dist/components/shared/ui/button/button.js +1 -1
- package/dist/components/shared/ui/collapsible/collapsible.js +2 -1
- package/dist/components/shared/ui/dialog/dialog.js +2 -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 +2 -1
- package/dist/components/shared/ui/switch/switch.js +1 -1
- package/dist/components/shared/ui/tabs/tabs.js +2 -1
- package/dist/context/consent-tracking-context.js +1 -0
- package/dist/context/iab-context-value.js +1 -0
- package/dist/context/index.js +1 -0
- package/dist/context/theme-context.js +2 -1
- package/dist/context.js +1 -0
- package/dist/devtools.js +2 -0
- package/dist/draft.js +2 -0
- package/dist/external-iab-context.js +2 -0
- package/dist/frame.js +2 -0
- package/dist/headless.js +1 -1
- package/dist/hooks/use-color-scheme.js +2 -1
- package/dist/hooks/use-component-config.js +2 -1
- package/dist/hooks/use-focus-trap.js +2 -1
- package/dist/hooks/use-headless-iab-consent-ui.js +2 -1
- package/dist/hooks/use-iab-manager.js +2 -0
- package/dist/hooks/use-is-hydrated.js +2 -0
- package/dist/hooks/use-reduced-motion.js +2 -1
- package/dist/hooks/use-scroll-lock.js +2 -1
- package/dist/hooks/use-text-direction.js +2 -1
- package/dist/hooks/use-theme.js +2 -1
- package/dist/hooks.js +1 -0
- package/dist/iab/styles.css +1 -1
- package/dist/iab/styles.tw3.css +133 -19
- package/dist/iab-context.js +2 -0
- package/dist/iab.js +1 -1
- package/dist/index.js +1 -1
- package/dist/module-hooks/iframe-blocker.js +2 -0
- package/dist/module-hooks/network-blocker.js +2 -0
- package/dist/module-hooks/persistence.js +2 -0
- package/dist/module-hooks/script-loader.js +2 -0
- package/dist/module-hooks/shared.js +2 -0
- package/dist/module-hooks.js +2 -0
- package/dist/panel-link.js +2 -0
- package/dist/panel-trigger.js +2 -0
- package/dist/panel.js +2 -0
- package/dist/preferences.js +2 -0
- package/dist/primitives.js +1 -1
- package/dist/prompt.js +2 -0
- package/dist/provider.js +2 -0
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/server/headers.js +1 -1
- package/dist/server/init-cache-key.js +1 -1
- package/dist/server/normalize-url.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.tw3.css +173 -29
- package/dist/theme-provider.js +2 -0
- package/dist/transports/offline.js +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/theme/index.js +1 -1
- package/dist/types/theme/style-types.js +1 -1
- package/dist/ui-config-context.js +2 -0
- package/dist/ui-save.js +1 -0
- package/dist/utils/cn.js +1 -1
- package/dist/utils/default-translation-config.js +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-slot-props.js +1 -0
- package/dist/utils/merge-styles.js +1 -1
- package/dist/utils/theme-utils.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/aggregate-components.d.ts +4 -0
- package/dist-types/chunk-warming.d.ts +19 -0
- package/dist-types/component-hooks/use-headless-consent-ui.d.ts +68 -0
- package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +22 -0
- package/dist-types/component-hooks/use-manager.d.ts +40 -0
- package/dist-types/component-hooks/use-panel-trigger.d.ts +20 -0
- package/dist-types/component-hooks/use-translations.d.ts +2 -0
- package/dist-types/components/consent-preferences-link/consent-preferences-link.d.ts +1 -1
- package/dist-types/components/frame/atoms.d.ts +5 -5
- package/dist-types/components/frame/types.d.ts +3 -2
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/card.d.ts +2 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/content.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/footer.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/header.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/overlay.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/purpose-item.d.ts +7 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/root.d.ts +3 -2
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/stack-item.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/tabs.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/vendor-list.d.ts +2 -3
- package/dist-types/components/iab-panel/hooks/use-display-model.d.ts +18 -0
- package/dist-types/components/iab-panel/hooks/use-gvl-data.d.ts +17 -0
- package/dist-types/components/{iab-consent-dialog/iab-consent-dialog.d.ts → iab-panel/iab-panel.d.ts} +10 -3
- package/dist-types/components/{iab-consent-dialog → iab-panel}/index.d.ts +3 -2
- package/dist-types/components/iab-panel/types.d.ts +1 -0
- package/dist-types/components/{iab-consent-dialog → iab-panel}/use-iab-translations.d.ts +3 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/button-group.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/card.d.ts +2 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/description.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/footer.d.ts +2 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/header.d.ts +2 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/overlay.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/root.d.ts +3 -2
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/title.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner/iab-consent-banner.d.ts → iab-prompt/iab-prompt.d.ts} +10 -4
- package/dist-types/components/{iab-consent-banner → iab-prompt}/index.d.ts +1 -1
- package/dist-types/components/{consent-dialog → panel}/atoms/card.d.ts +15 -15
- package/dist-types/components/{consent-dialog → panel}/atoms/overlay.d.ts +24 -8
- package/dist-types/components/{consent-dialog → panel}/atoms/root.d.ts +4 -3
- package/dist-types/components/{consent-dialog → panel}/index.d.ts +13 -8
- package/dist-types/components/{consent-dialog/consent-dialog.d.ts → panel/panel.d.ts} +6 -5
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/button.d.ts +2 -1
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/icon.d.ts +1 -16
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/root.d.ts +11 -23
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/text.d.ts +0 -11
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/toolbar.d.ts +15 -4
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/index.d.ts +2 -2
- package/dist-types/components/{consent-dialog-trigger/consent-dialog-trigger-toolbar.d.ts → panel-trigger/panel-trigger-toolbar.d.ts} +0 -23
- package/dist-types/components/{consent-dialog-trigger/consent-dialog-trigger.d.ts → panel-trigger/panel-trigger.d.ts} +8 -4
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/types.d.ts +16 -7
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/use-draggable.d.ts +2 -9
- package/dist-types/components/{consent-widget → preferences}/atoms/accordion.d.ts +5 -5
- package/dist-types/components/{consent-widget → preferences}/atoms/footer.d.ts +3 -3
- package/dist-types/components/{consent-widget → preferences}/atoms/root.d.ts +1 -1
- package/dist-types/components/{consent-widget → preferences}/index.d.ts +11 -9
- package/dist-types/components/preferences/policy-actions.d.ts +10 -0
- package/dist-types/components/{consent-banner → prompt}/atoms/overlay.d.ts +1 -1
- package/dist-types/components/prompt/atoms/root.d.ts +78 -0
- package/dist-types/components/{consent-banner → prompt}/components.d.ts +99 -14
- package/dist-types/components/{consent-banner → prompt}/error-boundary.d.ts +3 -1
- package/dist-types/components/{consent-banner → prompt}/index.d.ts +18 -10
- package/dist-types/components/prompt/policy-actions.d.ts +12 -0
- package/dist-types/components/{consent-banner/consent-banner.d.ts → prompt/prompt.d.ts} +36 -10
- package/dist-types/components/prompt/resolve-banner-primary-actions.d.ts +14 -0
- package/dist-types/components/prompt/surface-context.d.ts +45 -0
- package/dist-types/components/prompt/use-banner-copy.d.ts +16 -0
- package/dist-types/components/shared/libs/polymorphic.d.ts +2 -2
- package/dist-types/components/shared/libs/recursive-clone-children.d.ts +2 -2
- package/dist-types/components/shared/libs/slot.d.ts +1 -1
- package/dist-types/components/shared/libs/use-controllable-state.d.ts +1 -1
- package/dist-types/components/shared/policy-actions.d.ts +8 -3
- package/dist-types/components/shared/primitives/box.d.ts +3 -1
- package/dist-types/components/shared/primitives/button.d.ts +4 -37
- package/dist-types/components/shared/primitives/button.types.d.ts +3 -1
- package/dist-types/components/shared/primitives/legal-links/index.d.ts +7 -11
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +45 -12
- package/dist-types/components/shared/ui/accordion/accordion.types.d.ts +1 -1
- package/dist-types/components/shared/ui/animated-collapse/animated-collapse.d.ts +1 -1
- package/dist-types/components/shared/ui/branding.d.ts +12 -12
- package/dist-types/components/shared/ui/button/button.d.ts +19 -25
- package/dist-types/components/shared/ui/button/button.types.d.ts +2 -2
- package/dist-types/components/shared/ui/collapsible/collapsible.d.ts +18 -1
- package/dist-types/components/shared/ui/dialog/dialog.d.ts +6 -6
- package/dist-types/components/shared/ui/icon.d.ts +1 -1
- package/dist-types/components/shared/ui/logo.d.ts +0 -21
- package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +46 -2
- package/dist-types/components/shared/ui/switch/switch.d.ts +19 -8
- package/dist-types/components/shared/ui/tabs/tabs.d.ts +19 -2
- package/dist-types/context/iab-context-value.d.ts +37 -0
- package/dist-types/context/index.d.ts +3 -0
- package/dist-types/context/theme-context.d.ts +2 -2
- package/dist-types/context.d.ts +17 -0
- package/dist-types/devtools.d.ts +54 -0
- package/dist-types/draft.d.ts +31 -0
- package/dist-types/external-iab-context.d.ts +29 -0
- package/dist-types/frame.d.ts +1 -0
- package/dist-types/headless.d.ts +12 -8
- package/dist-types/hooks/use-color-scheme.d.ts +1 -1
- package/dist-types/hooks/use-component-config.d.ts +2 -2
- package/dist-types/hooks/use-focus-trap.d.ts +2 -2
- package/dist-types/hooks/use-headless-iab-consent-ui.d.ts +7 -8
- package/dist-types/hooks/use-iab-manager.d.ts +52 -0
- package/dist-types/hooks/use-is-hydrated.d.ts +8 -0
- package/dist-types/hooks/use-reduced-motion.d.ts +1 -1
- package/dist-types/hooks/use-scroll-lock.d.ts +1 -1
- package/dist-types/hooks/use-text-direction.d.ts +1 -1
- package/dist-types/hooks/use-theme.d.ts +2 -1
- package/dist-types/hooks.d.ts +148 -0
- package/dist-types/iab-context.d.ts +28 -0
- package/dist-types/iab.d.ts +14 -8
- package/dist-types/index.d.ts +61 -22
- package/dist-types/module-hooks/iframe-blocker.d.ts +6 -0
- package/dist-types/module-hooks/network-blocker.d.ts +9 -0
- package/dist-types/module-hooks/persistence.d.ts +4 -0
- package/dist-types/module-hooks/script-loader.d.ts +6 -0
- package/dist-types/module-hooks/shared.d.ts +2 -0
- package/dist-types/module-hooks.d.ts +4 -0
- package/dist-types/panel-link.d.ts +1 -0
- package/dist-types/panel-trigger.d.ts +1 -0
- package/dist-types/panel.d.ts +1 -0
- package/dist-types/preferences.d.ts +1 -0
- package/dist-types/prompt.d.ts +1 -0
- package/dist-types/provider.d.ts +144 -0
- package/dist-types/server/fetch-ssr-data.d.ts +2 -2
- package/dist-types/server/headers.d.ts +3 -3
- package/dist-types/server/init-cache-key.d.ts +3 -3
- package/dist-types/server/normalize-url.d.ts +2 -2
- package/dist-types/server/types.d.ts +1 -1
- package/dist-types/theme-provider.d.ts +10 -0
- package/dist-types/transports/offline.d.ts +18 -0
- package/dist-types/types/index.d.ts +3 -0
- package/dist-types/types/manager.d.ts +15 -0
- package/dist-types/types/slots.d.ts +5 -0
- package/dist-types/types/theme/index.d.ts +0 -1
- package/dist-types/types/theme/style-types.d.ts +3 -9
- package/dist-types/ui-config-context.d.ts +9 -0
- package/dist-types/ui-save.d.ts +5 -0
- package/dist-types/utils/cn.d.ts +1 -1
- package/dist-types/utils/default-translation-config.d.ts +6 -0
- package/dist-types/utils/index.d.ts +4 -0
- package/dist-types/utils/merge-slot-props.d.ts +14 -0
- package/dist-types/utils/merge-styles.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +2 -2
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +88 -141
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/customization/overview.md +45 -0
- package/docs/customization/recipes.md +79 -0
- package/docs/customization/slots.md +55 -0
- package/docs/customization/tokens.md +76 -0
- package/docs/customization/translations.md +49 -0
- package/docs/frameworks/react/components/consent-banner.md +219 -202
- package/docs/frameworks/react/components/consent-dialog-link.md +88 -35
- package/docs/frameworks/react/components/consent-dialog-trigger.md +74 -134
- package/docs/frameworks/react/components/consent-dialog.md +170 -135
- package/docs/frameworks/react/components/consent-manager-provider.md +41 -249
- package/docs/frameworks/react/components/consent-widget.md +154 -118
- package/docs/frameworks/react/components/dev-tools.md +198 -33
- package/docs/frameworks/react/components/frame.md +120 -42
- package/docs/frameworks/react/concepts/consent-categories.md +24 -89
- package/docs/frameworks/react/concepts/policy-presets.md +123 -0
- package/docs/frameworks/react/headless.md +91 -185
- package/docs/frameworks/react/hooks/use-consent-manager/overview.md +39 -153
- package/docs/frameworks/react/iab/overview.md +33 -108
- package/docs/frameworks/react/quickstart.md +116 -112
- package/docs/frameworks/react/script-loader.md +35 -535
- package/docs/frameworks/react/styling/overview.md +160 -255
- package/docs/frameworks/react/troubleshooting.md +47 -119
- package/docs/guides/consent-state.md +60 -0
- package/docs/guides/data-fetching.md +163 -0
- package/docs/guides/deployment-modes.md +63 -0
- package/docs/guides/troubleshooting.md +68 -0
- package/docs/guides/verify-consent.md +62 -0
- package/docs/integrations/adobe-analytics.md +239 -105
- package/docs/integrations/ahrefs-analytics.md +238 -104
- package/docs/integrations/amplitude.md +219 -157
- package/docs/integrations/building-integrations.md +32 -224
- package/docs/integrations/clearbit.md +247 -86
- package/docs/integrations/cloudflare-web-analytics.md +250 -84
- package/docs/integrations/crisp.md +251 -97
- package/docs/integrations/databuddy.md +259 -153
- package/docs/integrations/fathom-analytics.md +239 -96
- package/docs/integrations/google-maps.md +328 -207
- package/docs/integrations/google-tag-manager.md +248 -96
- package/docs/integrations/google-tag.md +261 -90
- package/docs/integrations/heap.md +222 -149
- package/docs/integrations/hightouch.md +225 -131
- package/docs/integrations/hotjar.md +239 -90
- package/docs/integrations/intercom.md +239 -98
- package/docs/integrations/linkedin-insights.md +243 -113
- package/docs/integrations/logrocket.md +241 -123
- package/docs/integrations/matomo-analytics.md +256 -111
- package/docs/integrations/meta-pixel.md +197 -324
- package/docs/integrations/microsoft-clarity.md +233 -114
- package/docs/integrations/microsoft-uet.md +245 -110
- package/docs/integrations/mixpanel-analytics.md +252 -87
- package/docs/integrations/openai-pixel.md +441 -0
- package/docs/integrations/overview.md +95 -133
- package/docs/integrations/pirsch.md +249 -96
- package/docs/integrations/plausible-analytics.md +241 -100
- package/docs/integrations/posthog.md +353 -214
- package/docs/integrations/promptwatch.md +251 -81
- package/docs/integrations/reddit-pixel.md +226 -173
- package/docs/integrations/rudderstack.md +244 -187
- package/docs/integrations/rybbit-analytics.md +244 -91
- package/docs/integrations/segment.md +238 -92
- package/docs/integrations/snapchat-pixel.md +240 -110
- package/docs/integrations/tiktok-pixel.md +249 -81
- package/docs/integrations/umami-analytics.md +242 -95
- package/docs/integrations/vercel-analytics.md +242 -90
- package/docs/integrations/x-pixel.md +238 -104
- package/docs/integrations/youtube.md +354 -142
- package/docs/upgrade-v3.md +334 -0
- package/iab/styles.css +1 -1
- package/iab/styles.tw3.css +1 -1
- package/package.json +187 -102
- package/readme.json +1 -1
- package/src/iab/styles.css +1 -1
- package/src/iab/styles.tw3.css +1 -1
- package/src/styles.css +1 -1
- package/src/styles.tw3.css +1 -1
- package/styles.css +1 -1
- package/styles.tw3.css +1 -1
- package/client/components/consent-banner.js +0 -4
- package/client/components/consent-dialog-link.js +0 -3
- package/client/components/consent-dialog-trigger.js +0 -3
- package/client/components/consent-dialog.js +0 -4
- package/client/components/consent-widget.js +0 -4
- package/client/components/frame.js +0 -3
- package/client/components/integrations.js +0 -3
- package/dist/components/consent-banner/atoms/overlay.cjs +0 -1
- package/dist/components/consent-banner/atoms/overlay.js +0 -1
- package/dist/components/consent-banner/atoms/root.cjs +0 -1
- package/dist/components/consent-banner/atoms/root.js +0 -1
- package/dist/components/consent-banner/components.cjs +0 -1
- package/dist/components/consent-banner/components.js +0 -1
- package/dist/components/consent-banner/consent-banner.cjs +0 -1
- package/dist/components/consent-banner/consent-banner.js +0 -1
- package/dist/components/consent-banner/error-boundary.cjs +0 -1
- package/dist/components/consent-banner/error-boundary.js +0 -1
- package/dist/components/consent-banner/index.cjs +0 -1
- package/dist/components/consent-banner/index.js +0 -1
- package/dist/components/consent-banner/policy-actions.cjs +0 -1
- package/dist/components/consent-banner/policy-actions.js +0 -1
- package/dist/components/consent-dialog/atoms/card.cjs +0 -1
- package/dist/components/consent-dialog/atoms/card.js +0 -1
- package/dist/components/consent-dialog/atoms/overlay.cjs +0 -1
- package/dist/components/consent-dialog/atoms/overlay.js +0 -1
- package/dist/components/consent-dialog/atoms/root.cjs +0 -1
- package/dist/components/consent-dialog/atoms/root.js +0 -1
- package/dist/components/consent-dialog/consent-dialog.cjs +0 -1
- package/dist/components/consent-dialog/consent-dialog.js +0 -1
- package/dist/components/consent-dialog/index.cjs +0 -1
- package/dist/components/consent-dialog/index.js +0 -1
- package/dist/components/consent-dialog-link/index.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/button.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/button.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/root.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/root.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/text.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/text.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/toolbar.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/toolbar.js +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.cjs +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.js +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger.cjs +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger.js +0 -1
- package/dist/components/consent-dialog-trigger/index.cjs +0 -1
- package/dist/components/consent-dialog-trigger/index.js +0 -1
- package/dist/components/consent-dialog-trigger/types.cjs +0 -1
- package/dist/components/consent-dialog-trigger/use-draggable.cjs +0 -1
- package/dist/components/consent-dialog-trigger/use-draggable.js +0 -1
- package/dist/components/consent-preferences-link/consent-preferences-link.cjs +0 -1
- package/dist/components/consent-preferences-link/index.cjs +0 -1
- package/dist/components/consent-widget/atoms/accordion.cjs +0 -1
- package/dist/components/consent-widget/atoms/accordion.js +0 -1
- package/dist/components/consent-widget/atoms/button.cjs +0 -1
- package/dist/components/consent-widget/atoms/button.js +0 -1
- package/dist/components/consent-widget/atoms/footer.cjs +0 -1
- package/dist/components/consent-widget/atoms/footer.js +0 -1
- package/dist/components/consent-widget/atoms/root.cjs +0 -1
- package/dist/components/consent-widget/atoms/root.js +0 -1
- package/dist/components/consent-widget/consent-widget.cjs +0 -1
- package/dist/components/consent-widget/consent-widget.js +0 -1
- package/dist/components/consent-widget/index.cjs +0 -1
- package/dist/components/consent-widget/index.js +0 -1
- package/dist/components/consent-widget/policy-actions.cjs +0 -1
- package/dist/components/consent-widget/policy-actions.js +0 -1
- package/dist/components/consent-widget/types.cjs +0 -1
- package/dist/components/frame/atoms.cjs +0 -1
- package/dist/components/frame/frame.cjs +0 -1
- package/dist/components/frame/index.cjs +0 -1
- package/dist/components/frame/types.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/button-group.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/button-group.js +0 -1
- package/dist/components/iab-consent-banner/atoms/card.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/card.js +0 -1
- package/dist/components/iab-consent-banner/atoms/description.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/description.js +0 -1
- package/dist/components/iab-consent-banner/atoms/footer.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/footer.js +0 -1
- package/dist/components/iab-consent-banner/atoms/header.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/header.js +0 -1
- package/dist/components/iab-consent-banner/atoms/overlay.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/overlay.js +0 -1
- package/dist/components/iab-consent-banner/atoms/root.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/root.js +0 -1
- package/dist/components/iab-consent-banner/atoms/title.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/title.js +0 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.cjs +0 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.js +0 -1
- package/dist/components/iab-consent-banner/index.cjs +0 -1
- package/dist/components/iab-consent-banner/index.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/card.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/card.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/content.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/content.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/footer.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/footer.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/header.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/header.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/overlay.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/overlay.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/purpose-item.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/purpose-item.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/root.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/root.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/stack-item.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/stack-item.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/tabs.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/tabs.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/vendor-list.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/vendor-list.js +0 -1
- package/dist/components/iab-consent-dialog/hooks/use-gvl-data.cjs +0 -1
- package/dist/components/iab-consent-dialog/hooks/use-gvl-data.js +0 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +0 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.js +0 -1
- package/dist/components/iab-consent-dialog/index.cjs +0 -1
- package/dist/components/iab-consent-dialog/index.js +0 -1
- package/dist/components/iab-consent-dialog/types.cjs +0 -1
- package/dist/components/iab-consent-dialog/use-iab-translations.cjs +0 -1
- package/dist/components/iab-consent-dialog/use-iab-translations.js +0 -1
- package/dist/components/integrations/google-map.cjs +0 -1
- package/dist/components/integrations/google-map.js +0 -1
- package/dist/components/integrations/index.cjs +0 -1
- package/dist/components/integrations/index.js +0 -1
- package/dist/components/integrations/shared.cjs +0 -1
- package/dist/components/integrations/shared.js +0 -1
- package/dist/components/integrations/youtube-embed.cjs +0 -1
- package/dist/components/integrations/youtube-embed.js +0 -1
- package/dist/components/shared/libs/polymorphic.cjs +0 -1
- package/dist/components/shared/libs/recursive-clone-children.cjs +0 -1
- package/dist/components/shared/libs/slot.cjs +0 -1
- package/dist/components/shared/libs/use-controllable-state.cjs +0 -1
- package/dist/components/shared/policy-actions.cjs +0 -1
- package/dist/components/shared/primitives/box.cjs +0 -1
- package/dist/components/shared/primitives/button.cjs +0 -1
- package/dist/components/shared/primitives/button.types.cjs +0 -1
- package/dist/components/shared/primitives/legal-links/index.cjs +0 -1
- package/dist/components/shared/ui/accordion/accordion.cjs +0 -1
- package/dist/components/shared/ui/accordion/accordion.types.cjs +0 -1
- package/dist/components/shared/ui/accordion/index.cjs +0 -1
- package/dist/components/shared/ui/animated-collapse/animated-collapse.cjs +0 -1
- package/dist/components/shared/ui/animated-collapse/index.cjs +0 -1
- package/dist/components/shared/ui/branding.cjs +0 -1
- package/dist/components/shared/ui/button/button.cjs +0 -1
- package/dist/components/shared/ui/button/button.types.cjs +0 -1
- package/dist/components/shared/ui/button/index.cjs +0 -1
- package/dist/components/shared/ui/collapsible/collapsible.cjs +0 -1
- package/dist/components/shared/ui/collapsible/index.cjs +0 -1
- package/dist/components/shared/ui/dialog/dialog.cjs +0 -1
- package/dist/components/shared/ui/dialog/index.cjs +0 -1
- package/dist/components/shared/ui/icon.cjs +0 -1
- package/dist/components/shared/ui/logo.cjs +0 -1
- package/dist/components/shared/ui/preference-item/index.cjs +0 -1
- package/dist/components/shared/ui/preference-item/preference-item.cjs +0 -1
- package/dist/components/shared/ui/switch/index.cjs +0 -1
- package/dist/components/shared/ui/switch/switch.cjs +0 -1
- package/dist/components/shared/ui/switch/switch.types.cjs +0 -1
- package/dist/components/shared/ui/tabs/index.cjs +0 -1
- package/dist/components/shared/ui/tabs/tabs.cjs +0 -1
- package/dist/context/consent-manager-context.cjs +0 -1
- package/dist/context/consent-manager-context.js +0 -1
- package/dist/context/consent-tracking-context.cjs +0 -1
- package/dist/context/theme-context.cjs +0 -1
- package/dist/headless.cjs +0 -1
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/use-color-scheme.cjs +0 -1
- package/dist/hooks/use-component-config.cjs +0 -1
- package/dist/hooks/use-consent-dialog-trigger.cjs +0 -1
- package/dist/hooks/use-consent-dialog-trigger.js +0 -1
- package/dist/hooks/use-consent-manager.cjs +0 -1
- package/dist/hooks/use-consent-manager.js +0 -1
- package/dist/hooks/use-consent-script.cjs +0 -1
- package/dist/hooks/use-consent-script.js +0 -1
- package/dist/hooks/use-focus-trap.cjs +0 -1
- package/dist/hooks/use-headless-consent-ui.cjs +0 -1
- package/dist/hooks/use-headless-consent-ui.js +0 -1
- package/dist/hooks/use-headless-iab-consent-ui.cjs +0 -1
- package/dist/hooks/use-reduced-motion.cjs +0 -1
- package/dist/hooks/use-scroll-lock.cjs +0 -1
- package/dist/hooks/use-ssr-status.cjs +0 -1
- package/dist/hooks/use-ssr-status.js +0 -1
- package/dist/hooks/use-styles.cjs +0 -1
- package/dist/hooks/use-styles.js +0 -1
- package/dist/hooks/use-text-direction.cjs +0 -1
- package/dist/hooks/use-theme.cjs +0 -1
- package/dist/hooks/use-translations.cjs +0 -1
- package/dist/hooks/use-translations.js +0 -1
- package/dist/iab.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/primitives/accordion.cjs +0 -1
- package/dist/primitives/button.cjs +0 -1
- package/dist/primitives/collapsible.cjs +0 -1
- package/dist/primitives/dialog.cjs +0 -1
- package/dist/primitives/preference-item.cjs +0 -1
- package/dist/primitives/switch.cjs +0 -1
- package/dist/primitives/tabs.cjs +0 -1
- package/dist/primitives.cjs +0 -1
- package/dist/providers/consent-manager-provider.cjs +0 -1
- package/dist/providers/consent-manager-provider.js +0 -1
- package/dist/server/fetch-ssr-data.cjs +0 -1
- package/dist/server/headers.cjs +0 -1
- package/dist/server/index.cjs +0 -1
- package/dist/server/init-cache-key.cjs +0 -1
- package/dist/server/normalize-url.cjs +0 -1
- package/dist/server/types.cjs +0 -1
- package/dist/types/consent-manager.cjs +0 -1
- package/dist/types/theme/index.cjs +0 -1
- package/dist/types/theme/style-keys.cjs +0 -1
- package/dist/types/theme/style-types.cjs +0 -1
- package/dist/utils/cn.cjs +0 -1
- package/dist/utils/merge-styles.cjs +0 -1
- package/dist/utils/test-helpers.cjs +0 -1
- package/dist/utils/test-helpers.js +0 -1
- package/dist/utils/theme-utils.cjs +0 -1
- package/dist/version.cjs +0 -1
- package/dist-types/components/consent-banner/atoms/root.d.ts +0 -126
- package/dist-types/components/consent-banner/policy-actions.d.ts +0 -11
- package/dist-types/components/consent-widget/policy-actions.d.ts +0 -11
- package/dist-types/components/iab-consent-dialog/hooks/use-gvl-data.d.ts +0 -27
- package/dist-types/components/iab-consent-dialog/types.d.ts +0 -72
- package/dist-types/components/integrations/google-map.d.ts +0 -82
- package/dist-types/components/integrations/index.d.ts +0 -2
- package/dist-types/components/integrations/shared.d.ts +0 -12
- package/dist-types/components/integrations/youtube-embed.d.ts +0 -95
- package/dist-types/context/consent-manager-context.d.ts +0 -31
- package/dist-types/hooks/index.d.ts +0 -12
- package/dist-types/hooks/use-consent-dialog-trigger.d.ts +0 -10
- package/dist-types/hooks/use-consent-manager.d.ts +0 -27
- package/dist-types/hooks/use-consent-script.d.ts +0 -80
- package/dist-types/hooks/use-headless-consent-ui.d.ts +0 -46
- package/dist-types/hooks/use-ssr-status.d.ts +0 -57
- package/dist-types/hooks/use-styles.d.ts +0 -21
- package/dist-types/hooks/use-translations.d.ts +0 -28
- package/dist-types/providers/consent-manager-provider.d.ts +0 -40
- package/dist-types/types/consent-manager.d.ts +0 -39
- package/dist-types/types/theme/style-keys.d.ts +0 -1
- package/dist-types/utils/test-helpers.d.ts +0 -31
- package/docs/frameworks/react/building-headless-components.md +0 -370
- package/docs/frameworks/react/callbacks.md +0 -186
- package/docs/frameworks/react/concepts/client-modes.md +0 -177
- package/docs/frameworks/react/concepts/consent-models.md +0 -113
- package/docs/frameworks/react/concepts/cookie-management.md +0 -122
- package/docs/frameworks/react/concepts/glossary.md +0 -24
- package/docs/frameworks/react/concepts/initialization-flow.md +0 -149
- package/docs/frameworks/react/concepts/policy-packs.md +0 -228
- package/docs/frameworks/react/hooks/use-color-scheme.md +0 -41
- package/docs/frameworks/react/hooks/use-consent-manager/checking-consent.md +0 -96
- package/docs/frameworks/react/hooks/use-consent-manager/location-info.md +0 -97
- package/docs/frameworks/react/hooks/use-consent-manager/setting-consent.md +0 -94
- package/docs/frameworks/react/hooks/use-draggable.md +0 -59
- package/docs/frameworks/react/hooks/use-focus-trap.md +0 -42
- package/docs/frameworks/react/hooks/use-reduced-motion.md +0 -37
- package/docs/frameworks/react/hooks/use-ssr-status.md +0 -32
- package/docs/frameworks/react/hooks/use-text-direction.md +0 -50
- package/docs/frameworks/react/hooks/use-translations.md +0 -55
- package/docs/frameworks/react/iab/consent-banner.md +0 -91
- package/docs/frameworks/react/iab/consent-dialog.md +0 -129
- package/docs/frameworks/react/iab/use-gvl-data.md +0 -21
- package/docs/frameworks/react/iframe-blocking.md +0 -106
- package/docs/frameworks/react/internationalization.md +0 -207
- package/docs/frameworks/react/network-blocker.md +0 -140
- package/docs/frameworks/react/optimization.md +0 -148
- package/docs/frameworks/react/policy-packs.md +0 -242
- package/docs/frameworks/react/server-side.md +0 -158
- package/docs/frameworks/react/styling/classnames.md +0 -94
- package/docs/frameworks/react/styling/color-scheme.md +0 -84
- package/docs/frameworks/react/styling/css-variables.md +0 -53
- package/docs/frameworks/react/styling/slots.md +0 -94
- package/docs/frameworks/react/styling/tailwind.md +0 -119
- package/docs/frameworks/react/styling/tokens.md +0 -156
- package/docs/shared/concepts/client-modes.md +0 -103
- package/docs/shared/concepts/consent-categories.md +0 -41
- package/docs/shared/concepts/consent-models.md +0 -72
- package/docs/shared/concepts/cookie-management.md +0 -88
- package/docs/shared/concepts/glossary.md +0 -24
- package/docs/shared/concepts/initialization-flow.md +0 -105
- package/docs/shared/concepts/policy-packs.md +0 -225
- package/docs/shared/react/components/consent-banner.md +0 -242
- package/docs/shared/react/components/consent-dialog-link.md +0 -45
- package/docs/shared/react/components/consent-dialog-trigger.md +0 -185
- package/docs/shared/react/components/consent-dialog.md +0 -119
- package/docs/shared/react/components/consent-manager-provider.md +0 -225
- package/docs/shared/react/components/consent-widget.md +0 -121
- package/docs/shared/react/components/dev-tools.md +0 -81
- package/docs/shared/react/components/frame.md +0 -52
- package/docs/shared/react/guides/building-headless-components.md +0 -110
- package/docs/shared/react/guides/callbacks.md +0 -89
- package/docs/shared/react/guides/headless.md +0 -31
- package/docs/shared/react/guides/iframe-blocking.md +0 -65
- package/docs/shared/react/guides/internationalization.md +0 -123
- package/docs/shared/react/guides/network-blocker.md +0 -72
- package/docs/shared/react/guides/optimization.md +0 -44
- package/docs/shared/react/guides/policy-packs.md +0 -173
- package/docs/shared/react/guides/script-loader.md +0 -311
- package/docs/shared/react/hooks/use-color-scheme.md +0 -31
- package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +0 -95
- package/docs/shared/react/hooks/use-consent-manager/location-info.md +0 -96
- package/docs/shared/react/hooks/use-consent-manager/overview.md +0 -74
- package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +0 -93
- package/docs/shared/react/hooks/use-draggable.md +0 -30
- package/docs/shared/react/hooks/use-focus-trap.md +0 -20
- package/docs/shared/react/hooks/use-reduced-motion.md +0 -33
- package/docs/shared/react/hooks/use-ssr-status.md +0 -16
- package/docs/shared/react/hooks/use-text-direction.md +0 -38
- package/docs/shared/react/hooks/use-translations.md +0 -15
- package/docs/shared/react/iab/consent-banner.md +0 -60
- package/docs/shared/react/iab/consent-dialog.md +0 -76
- package/docs/shared/react/iab/overview.md +0 -80
- package/docs/shared/react/iab/use-gvl-data.md +0 -21
- package/docs/shared/react/styling/classnames.md +0 -93
- package/docs/shared/react/styling/color-scheme.md +0 -35
- package/docs/shared/react/styling/css-variables.md +0 -53
- package/docs/shared/react/styling/overview.md +0 -261
- package/docs/shared/react/styling/slots.md +0 -93
- package/docs/shared/react/styling/stylesheet-entrypoint.md +0 -8
- package/docs/shared/react/styling/tailwind.md +0 -88
- package/docs/shared/react/styling/tokens.md +0 -155
- package/docs/shared/troubleshooting.md +0 -82
- /package/dist/components/{consent-dialog-trigger → iab-panel}/types.js +0 -0
- /package/dist/components/{consent-widget → panel-trigger}/types.js +0 -0
- /package/dist/components/{iab-consent-dialog → preferences}/types.js +0 -0
- /package/dist/types/{consent-manager.js → manager.js} +0 -0
- /package/dist/types/{theme/style-keys.js → slots.js} +0 -0
- /package/dist-types/components/{consent-dialog-link → panel-link}/index.d.ts +0 -0
- /package/dist-types/components/{consent-widget → preferences}/atoms/button.d.ts +0 -0
- /package/dist-types/components/{consent-widget/consent-widget.d.ts → preferences/preferences.d.ts} +0 -0
- /package/dist-types/components/{consent-widget → preferences}/types.d.ts +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Policy presets
|
|
3
|
+
description: Understand how policy rules affect React prompts, permissions and
|
|
4
|
+
persistent privacy controls.
|
|
5
|
+
group: frameworks
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What the policy controls
|
|
9
|
+
|
|
10
|
+
A policy rule selects the permission model, categories, prompt and persistent
|
|
11
|
+
privacy controls for a visitor. Your app reads the resolved rule and effective
|
|
12
|
+
permissions. It should not choose a different rule just to hide a banner.
|
|
13
|
+
|
|
14
|
+
| Policy setting | What your app should expect |
|
|
15
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
16
|
+
| `model: 'opt-in'` | Optional categories in scope wait for consent. |
|
|
17
|
+
| `model: 'opt-out'` | Categories in scope can be allowed before a choice. Saved refusals and privacy signals can restrict them. |
|
|
18
|
+
| `model: 'none'` | Categories in scope are allowed without an initial prompt. Stock consent controls stay hidden unless the rule grants privacy rights. |
|
|
19
|
+
| `prompt: 'choice'` | The banner asks for a choice when the current state requires one. |
|
|
20
|
+
| `prompt: 'notice'` | Dismissing the notice records an acknowledgement, not a consent grant. |
|
|
21
|
+
| `prompt: 'none'` | No automatic prompt. The rule can still require a way to open preferences. |
|
|
22
|
+
| `scopeMode: 'strict'` | Optional categories outside the rule's scope stay denied. |
|
|
23
|
+
|
|
24
|
+
Keep a persistent preferences entry point wherever the policy provides that
|
|
25
|
+
right. A visitor who dismissed a notice or rejected tracking still needs a way
|
|
26
|
+
to revisit their choice. Stock components read the rule's rights; custom UI
|
|
27
|
+
must do the same.
|
|
28
|
+
|
|
29
|
+
Use `effectivePermissions` to gate a script or embed. A `true` value under an
|
|
30
|
+
opt-out rule does not mean the visitor clicked Accept. Read `explicitChoice`
|
|
31
|
+
when you need the visitor's recorded decision. See
|
|
32
|
+
[consent state](../../../guides/consent-state.md) for these distinctions.
|
|
33
|
+
|
|
34
|
+
## Where to change the rules
|
|
35
|
+
|
|
36
|
+
For Inth, configure policy rules on your hosted project. The app receives those
|
|
37
|
+
rules through the configured [data-fetching path](../../../guides/data-fetching.md). Importing
|
|
38
|
+
`recommendedPolicyRules()` or changing browser styling does not override the
|
|
39
|
+
hosted policy.
|
|
40
|
+
|
|
41
|
+
For a backend you operate, use the
|
|
42
|
+
[policy packs guide](https://c15t.com/docs/self-host/guides/policy-packs). It covers
|
|
43
|
+
`manifest.policyRules`, preset selection and custom matchers. Browser-only
|
|
44
|
+
setups own their rules locally; see
|
|
45
|
+
[deployment modes](../../../guides/deployment-modes.md).
|
|
46
|
+
|
|
47
|
+
Presets are starting configurations. Select them for your actual processing,
|
|
48
|
+
and review their assumptions before allowing optional categories by default.
|
|
49
|
+
A country match does not establish a legal basis for a vendor's data use.
|
|
50
|
+
|
|
51
|
+
## Why the banner may be absent
|
|
52
|
+
|
|
53
|
+
A missing banner can be an expected policy outcome or an initialization problem.
|
|
54
|
+
Check `resolution.status` before interpreting the active model.
|
|
55
|
+
|
|
56
|
+
| State | What to check |
|
|
57
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| A policy matched and `promptRequirement.kind` is `none` | The rule does not ask for an initial prompt, or the stored records already satisfy it. Check persistent preferences separately. |
|
|
59
|
+
| A policy matched but a category is denied | Inspect `effectivePermissions`, `explicitChoice`, `privacySignals` and `restrictions`. A saved refusal or GPC can keep it denied. |
|
|
60
|
+
| No policy has matched | Check backend connectivity, location inputs and policy configuration. Optional categories stay denied while resolution is unresolved. |
|
|
61
|
+
|
|
62
|
+
Do not treat `policyRule` alone as proof that a policy resolved. The snapshot
|
|
63
|
+
also carries a safe rule for evaluation while resolution is pending or failed.
|
|
64
|
+
Use `resolution.policy` only after checking for `status: 'matched'`.
|
|
65
|
+
|
|
66
|
+
The local `recommendedPolicyRules()` pack uses opt-in rules for Europe and
|
|
67
|
+
Québec, opt-out for its supported US privacy states, and a no-prompt `none`
|
|
68
|
+
default for other known locations. An unknown country uses its strict opt-in
|
|
69
|
+
fallback. A US country with a missing state gets the US opt-out fallback.
|
|
70
|
+
These are the local pack's defaults, not a promise about your Inth project.
|
|
71
|
+
Browser-only mode does not discover a visitor's country from their IP address.
|
|
72
|
+
|
|
73
|
+
## Inspect the active policy
|
|
74
|
+
|
|
75
|
+
Place this diagnostic component inside your existing consent
|
|
76
|
+
provider. It reads state without recording a choice.
|
|
77
|
+
|
|
78
|
+
```tsx title="src/consent-policy-debug.tsx"
|
|
79
|
+
import { useSnapshot } from 'c15t/react';
|
|
80
|
+
|
|
81
|
+
export function ConsentPolicyDebug() {
|
|
82
|
+
const snapshot = useSnapshot();
|
|
83
|
+
const resolution = snapshot.resolution;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<pre>
|
|
87
|
+
{JSON.stringify(
|
|
88
|
+
{
|
|
89
|
+
status: resolution.status,
|
|
90
|
+
policy: resolution.status === 'matched' ? resolution.policy.id : null,
|
|
91
|
+
prompt: snapshot.promptRequirement,
|
|
92
|
+
permissions: snapshot.effectivePermissions,
|
|
93
|
+
location: snapshot.location,
|
|
94
|
+
privacySignals: snapshot.privacySignals,
|
|
95
|
+
},
|
|
96
|
+
null,
|
|
97
|
+
2,
|
|
98
|
+
)}
|
|
99
|
+
</pre>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The diagnostic subscribes to consent changes. Remove it after verification.
|
|
105
|
+
For a production feature gate, use `useConsent('marketing')` or the category
|
|
106
|
+
your feature needs instead of subscribing to the whole snapshot.
|
|
107
|
+
|
|
108
|
+
## Change appearance without changing policy
|
|
109
|
+
|
|
110
|
+
Keep one banner and one dialog in your existing
|
|
111
|
+
provider. Use
|
|
112
|
+
[styling](../styling/overview.md) to change their appearance,
|
|
113
|
+
or [headless UI](../headless.md) for custom markup.
|
|
114
|
+
Presentation settings change layout and emphasis; policy rules decide which
|
|
115
|
+
actions and privacy rights the app must expose.
|
|
116
|
+
|
|
117
|
+
## Verify policy behavior
|
|
118
|
+
|
|
119
|
+
Use a fresh browser profile to check the intended location, then repeat with a
|
|
120
|
+
saved rejection and GPC enabled. Confirm that the expected prompt and
|
|
121
|
+
preferences controls appear, and that denied scripts and embeds make no
|
|
122
|
+
requests. Test missing location inputs too. Follow
|
|
123
|
+
[verify consent](../../../guides/verify-consent.md) for the full flow.
|
|
@@ -1,192 +1,98 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Headless
|
|
3
|
-
description: Build
|
|
4
|
-
|
|
2
|
+
title: Headless
|
|
3
|
+
description: Build a custom consent banner in React with the c15t/react/headless
|
|
4
|
+
hooks inside your ConsentProvider.
|
|
5
5
|
group: frameworks
|
|
6
6
|
---
|
|
7
|
-
c15t's headless mode means using the hooks (`useConsentManager`, `useTranslations`, etc.) without any pre-built UI components. This gives you complete control over the consent experience.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
disabled={type.disabled}
|
|
76
|
-
onChange={(e) => setSelectedConsent(type.name, e.target.checked)}
|
|
77
|
-
/>
|
|
78
|
-
<div>
|
|
79
|
-
<span className="font-medium">
|
|
80
|
-
{translations.consentTypes[type.name]?.title ?? type.name}
|
|
81
|
-
</span>
|
|
82
|
-
<p className="text-xs text-gray-500">{type.description}</p>
|
|
83
|
-
</div>
|
|
84
|
-
</label>
|
|
85
|
-
))}
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<div className="mt-4 flex gap-3">
|
|
89
|
-
<button
|
|
90
|
-
onClick={() => saveConsents('necessary')}
|
|
91
|
-
className="px-4 py-2 border rounded"
|
|
92
|
-
>
|
|
93
|
-
{translations.common.rejectAll}
|
|
94
|
-
</button>
|
|
95
|
-
<button
|
|
96
|
-
onClick={() => saveConsents('custom')}
|
|
97
|
-
className="px-4 py-2 border rounded"
|
|
98
|
-
>
|
|
99
|
-
{translations.common.save}
|
|
100
|
-
</button>
|
|
101
|
-
<button
|
|
102
|
-
onClick={() => saveConsents('all')}
|
|
103
|
-
className="px-4 py-2 bg-blue-600 text-white rounded"
|
|
104
|
-
>
|
|
105
|
-
{translations.common.acceptAll}
|
|
106
|
-
</button>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
8
|
+
## When to go headless
|
|
9
|
+
|
|
10
|
+
The pre-built banner and dialog cover most designs through props, slots, and
|
|
11
|
+
the stylesheet. Go headless when your markup has to be something else
|
|
12
|
+
entirely: a design system component, a native sheet, or a layout the compound
|
|
13
|
+
parts cannot express.
|
|
14
|
+
|
|
15
|
+
Headless code owns the rendered controls, so it also owns the compliance
|
|
16
|
+
outcome. The hooks hand you the actions a policy requires, the rights it must
|
|
17
|
+
keep reachable, and diagnostics when your presentation drops one. Render from
|
|
18
|
+
those lists rather than from a fixed set of buttons, and a site that later adds
|
|
19
|
+
a notice region keeps working without a code change.
|
|
20
|
+
|
|
21
|
+
Check for a policy before rendering your own surfaces. `useModel()` from
|
|
22
|
+
`c15t/react` returns `null` while no rule has resolved and `'none'` under a
|
|
23
|
+
rule that owes no consent UI, and the pre-built surfaces render nothing in that
|
|
24
|
+
state.
|
|
25
|
+
|
|
26
|
+
## Minimal example
|
|
27
|
+
|
|
28
|
+
The headless hooks read the runtime from the nearest `ConsentProvider` from
|
|
29
|
+
`c15t/react`. Render this component inside that provider in place of the stock
|
|
30
|
+
banner, and keep the dialog and persistent preferences control.
|
|
31
|
+
|
|
32
|
+
```tsx title="src/consent-banner.tsx"
|
|
33
|
+
import { useHeadlessConsentUI, useTranslations } from 'c15t/react/headless';
|
|
34
|
+
|
|
35
|
+
const ACTION_LABELS = {
|
|
36
|
+
accept: 'acceptAll',
|
|
37
|
+
reject: 'rejectAll',
|
|
38
|
+
customize: 'customize',
|
|
39
|
+
dismiss: 'acknowledge',
|
|
40
|
+
save: 'save',
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
export function Banner() {
|
|
44
|
+
const { banner, performAction, openDialog } = useHeadlessConsentUI();
|
|
45
|
+
const { common, rights } = useTranslations();
|
|
46
|
+
|
|
47
|
+
if (!banner.isVisible) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<section role="region" aria-label="Privacy">
|
|
53
|
+
{banner.preferenceControls.map((right) => (
|
|
54
|
+
<button key={right} type="button" onClick={openDialog}>
|
|
55
|
+
{right === 'opt-out' ? rights?.optOut : rights?.preferences}
|
|
56
|
+
</button>
|
|
57
|
+
))}
|
|
58
|
+
{banner.actionGroups.map((group) => (
|
|
59
|
+
<div key={group.join('-')}>
|
|
60
|
+
{group.map((action) => (
|
|
61
|
+
<button
|
|
62
|
+
key={action}
|
|
63
|
+
type="button"
|
|
64
|
+
data-primary={banner.primaryActions.includes(action) || undefined}
|
|
65
|
+
onClick={() => performAction(action)}
|
|
66
|
+
>
|
|
67
|
+
{common[ACTION_LABELS[action]]}
|
|
68
|
+
</button>
|
|
69
|
+
))}
|
|
70
|
+
</div>
|
|
71
|
+
))}
|
|
72
|
+
</section>
|
|
73
|
+
);
|
|
110
74
|
}
|
|
111
75
|
```
|
|
112
76
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Custom Dialog
|
|
138
|
-
|
|
139
|
-
Build a custom consent dialog for detailed category management:
|
|
140
|
-
|
|
141
|
-
```tsx
|
|
142
|
-
import { useConsentManager, useTranslations } from '@c15t/react';
|
|
143
|
-
|
|
144
|
-
function CustomConsentDialog() {
|
|
145
|
-
const {
|
|
146
|
-
activeUI,
|
|
147
|
-
setActiveUI,
|
|
148
|
-
consentTypes,
|
|
149
|
-
consentCategories,
|
|
150
|
-
selectedConsents,
|
|
151
|
-
consents,
|
|
152
|
-
setSelectedConsent,
|
|
153
|
-
saveConsents,
|
|
154
|
-
has,
|
|
155
|
-
} = useConsentManager();
|
|
156
|
-
const translations = useTranslations();
|
|
157
|
-
|
|
158
|
-
if (activeUI !== 'dialog') return null;
|
|
159
|
-
|
|
160
|
-
return (
|
|
161
|
-
<div className="fixed inset-0 z-50 flex items-center justify-center">
|
|
162
|
-
<div className="absolute inset-0 bg-black/50" onClick={() => setActiveUI('none')} />
|
|
163
|
-
<div className="relative bg-white rounded-xl p-6 max-w-md w-full">
|
|
164
|
-
<h2 className="text-lg font-semibold">{translations.consentManagerDialog.title}</h2>
|
|
165
|
-
|
|
166
|
-
{consentTypes
|
|
167
|
-
.filter((t) => consentCategories.includes(t.name))
|
|
168
|
-
.map((type) => (
|
|
169
|
-
<div key={type.name} className="flex items-center justify-between py-3 border-b">
|
|
170
|
-
<div>
|
|
171
|
-
<p className="font-medium">{translations.consentTypes[type.name]?.title}</p>
|
|
172
|
-
<p className="text-sm text-gray-500">{type.description}</p>
|
|
173
|
-
</div>
|
|
174
|
-
<input
|
|
175
|
-
type="checkbox"
|
|
176
|
-
checked={selectedConsents[type.name] ?? consents[type.name] ?? false}
|
|
177
|
-
disabled={type.disabled}
|
|
178
|
-
onChange={(e) => setSelectedConsent(type.name, e.target.checked)}
|
|
179
|
-
/>
|
|
180
|
-
</div>
|
|
181
|
-
))}
|
|
182
|
-
|
|
183
|
-
<div className="mt-4 flex justify-end gap-2">
|
|
184
|
-
<button onClick={() => saveConsents('necessary')}>Reject</button>
|
|
185
|
-
<button onClick={() => saveConsents('custom')}>Save</button>
|
|
186
|
-
<button onClick={() => saveConsents('all')}>Accept All</button>
|
|
187
|
-
</div>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
77
|
+
`banner.actionGroups` is the resolved layout: reject and accept share a group
|
|
78
|
+
at equal prominence, and the rest follow. `banner.orderedActions` is the same
|
|
79
|
+
list flattened. Under a notice the only action is `dismiss`, and
|
|
80
|
+
`banner.preferenceControls` recommends additional buttons for opening
|
|
81
|
+
preferences. Under a notice it contains `opt-out`, which selects the
|
|
82
|
+
"Do not sell or share my data" label. The example renders that button and
|
|
83
|
+
an "OK" button. Both controls keep their own command: opening
|
|
84
|
+
preferences and dismissing the notice.
|
|
85
|
+
|
|
86
|
+
The list is a rendering helper. It does not establish that your UI implements
|
|
87
|
+
all policy rights. Provide disclosure and persistent preferences access.
|
|
88
|
+
|
|
89
|
+
`performAction` saves all categories for `accept`, none for `reject`, the
|
|
90
|
+
current draft for `save`, records a dismissal for `dismiss`, and opens the
|
|
91
|
+
preference center for `customize`. `banner.diagnostics` reports when a host
|
|
92
|
+
layout drops a required action or gives equivalent actions different
|
|
93
|
+
prominence. Review each diagnostic when configuring custom presentation.
|
|
94
|
+
|
|
95
|
+
`banner.variant`, `banner.position`, and `banner.blocking` carry the resolved
|
|
96
|
+
shape from `presentation.prompt`, so a headless surface can follow the same
|
|
97
|
+
bar, widget, or wall choice the pre-built banner would make, and can trap
|
|
98
|
+
focus and lock scroll exactly when `blocking` is true.
|
|
@@ -1,172 +1,58 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description:
|
|
4
|
-
|
|
2
|
+
title: Hooks
|
|
3
|
+
description: Gate features and save consent choices in React components with the
|
|
4
|
+
focused hooks exported from c15t/react.
|
|
5
5
|
group: frameworks
|
|
6
6
|
---
|
|
7
|
-
`useConsentManager()` is the primary hook for interacting with the consent system. It returns the complete consent store state and all action methods.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
import { useConsentManager } from '@c15t/react';
|
|
8
|
+
## Read only the state you need
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
model,
|
|
16
|
-
has,
|
|
17
|
-
saveConsents,
|
|
18
|
-
// ... all state and actions
|
|
19
|
-
} = useConsentManager();
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
> ⚠️ **Warning:**
|
|
24
|
-
> Must be used within a ConsentManagerProvider. Throws an error if used outside the provider.
|
|
25
|
-
|
|
26
|
-
## State Properties
|
|
27
|
-
|
|
28
|
-
|Property|Value|
|
|
29
|
-
|:--|:--|
|
|
30
|
-
|Type Name|\`StoreRuntimeState\`|
|
|
31
|
-
|Source Path|\`./packages/core/src/store/type.ts\`|
|
|
32
|
-
|
|
33
|
-
\*ExtractedTypeTable: Could not extract "StoreRuntimeState" from "./packages/core/src/store/type.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
34
|
-
|
|
35
|
-
## Action Methods
|
|
36
|
-
|
|
37
|
-
|Property|Value|
|
|
38
|
-
|:--|:--|
|
|
39
|
-
|Type Name|\`StoreActions\`|
|
|
40
|
-
|Source Path|\`./packages/core/src/store/type.ts\`|
|
|
41
|
-
|
|
42
|
-
\*ExtractedTypeTable: Could not extract "StoreActions" from "./packages/core/src/store/type.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
43
|
-
|
|
44
|
-
## User Identification
|
|
45
|
-
|
|
46
|
-
You can link a consent subject to your own internal user ID or a non-secret anonymous visitor ID. c15t stores the identifier in the subject row's `externalId` field. Consent records remain associated with that subject through `subjectId`, so your backend can find the subject and its related consent records by external ID for GDPR Article 15 exports.
|
|
47
|
-
|
|
48
|
-
### 1. Providing the Current User ID
|
|
49
|
-
|
|
50
|
-
When using Clerk, wait for Clerk to load and prefer its authenticated `userId`. Before sign-in, you can fall back to a non-secret visitor ID from your application:
|
|
51
|
-
|
|
52
|
-
> ⚠️ **Warning:**
|
|
53
|
-
> Values passed through options.user are available to client-side JavaScript. Pass only a non-secret identifier, such as a Clerk userId or an opaque visitor ID. Never pass a Clerk session token or a value returned by getToken().
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
import { useAuth } from '@clerk/react';
|
|
57
|
-
import { ConsentManagerProvider } from '@c15t/react';
|
|
58
|
-
|
|
59
|
-
function ConsentApp() {
|
|
60
|
-
// Render this component beneath your existing ClerkProvider.
|
|
61
|
-
const { isLoaded, isSignedIn, userId } = useAuth();
|
|
62
|
-
|
|
63
|
-
if (!isLoaded) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const visitorId = getVisitorId();
|
|
68
|
-
const consentUser = isSignedIn && userId
|
|
69
|
-
? { id: userId, identityProvider: 'clerk' }
|
|
70
|
-
: visitorId
|
|
71
|
-
? { id: visitorId, identityProvider: 'anonymous-visitor' }
|
|
72
|
-
: undefined;
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<ConsentManagerProvider
|
|
76
|
-
options={{
|
|
77
|
-
mode: 'hosted',
|
|
78
|
-
backendURL: 'https://your-instance.c15t.dev',
|
|
79
|
-
consentCategories: ['necessary', 'measurement', 'marketing'],
|
|
80
|
-
user: consentUser,
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
<ClerkConsentSync />
|
|
84
|
-
<MyComponents />
|
|
85
|
-
</ConsentManagerProvider>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### 2. Synchronizing Clerk Sign-ins
|
|
91
|
-
|
|
92
|
-
Use a component inside `ConsentManagerProvider` to update the current consent subject when Clerk's authentication state changes:
|
|
93
|
-
|
|
94
|
-
```tsx
|
|
95
|
-
import { useAuth } from '@clerk/react';
|
|
96
|
-
import { useConsentManager } from '@c15t/react';
|
|
97
|
-
import { useEffect } from 'react';
|
|
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`.
|
|
98
13
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const { identifyUser } = useConsentManager();
|
|
14
|
+
```tsx title="src/optional-feature.tsx"
|
|
15
|
+
import { useConsent } from 'c15t/react';
|
|
102
16
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
void identifyUser({
|
|
109
|
-
id: userId,
|
|
110
|
-
identityProvider: 'clerk',
|
|
111
|
-
}).then(() => {
|
|
112
|
-
clearVisitorId();
|
|
113
|
-
});
|
|
114
|
-
}, [identifyUser, isLoaded, isSignedIn, userId]);
|
|
115
|
-
|
|
116
|
-
return null;
|
|
17
|
+
export function OptionalFeature() {
|
|
18
|
+
const allowed = useConsent('marketing');
|
|
19
|
+
return allowed ? <div>Optional marketing content</div> : null;
|
|
117
20
|
}
|
|
118
21
|
```
|
|
119
22
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
> ℹ️ **Info:**
|
|
123
|
-
> Backend subject identification requires hosted mode (mode: 'hosted'). In offline mode, identifyUser() cannot update a backend subject. Identifiers supplied through options.user can still be held in client state and persisted with locally stored consent, so do not place sensitive values there.
|
|
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.
|
|
124
25
|
|
|
125
|
-
|
|
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()` |
|
|
126
36
|
|
|
127
|
-
|
|
37
|
+
## Save from a visitor action
|
|
128
38
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
type ConsentState = Record<AllConsentNames, boolean>;
|
|
133
|
-
// Example: { necessary: true, measurement: true, marketing: false }
|
|
134
|
-
```
|
|
39
|
+
Render this component inside your existing `ConsentProvider`.
|
|
135
40
|
|
|
136
|
-
|
|
41
|
+
```tsx title="src/reject-button.tsx"
|
|
42
|
+
import { useSaveConsents } from 'c15t/react';
|
|
137
43
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
interface ConsentInfo {
|
|
142
|
-
time: number; // Epoch timestamp when consent was recorded
|
|
143
|
-
subjectId?: string; // Client-generated subject ID (sub_xxx format)
|
|
144
|
-
externalId?: string; // External user ID linked via identifyUser()
|
|
145
|
-
identityProvider?: string; // Identity provider (e.g. 'clerk', 'auth0')
|
|
44
|
+
export function RejectButton() {
|
|
45
|
+
const save = useSaveConsents();
|
|
46
|
+
return <button type="button" onClick={() => void save('none')}>Reject optional</button>;
|
|
146
47
|
}
|
|
147
48
|
```
|
|
148
49
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
```ts
|
|
154
|
-
interface LocationInfo {
|
|
155
|
-
countryCode: string; // ISO 3166-1 alpha-2 (e.g. 'DE')
|
|
156
|
-
regionCode: string; // Region/state code (e.g. 'BY')
|
|
157
|
-
jurisdiction: string; // Applicable jurisdiction (e.g. 'GDPR', 'CCPA')
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Model
|
|
162
|
-
|
|
163
|
-
The active consent model:
|
|
164
|
-
|
|
165
|
-
```ts
|
|
166
|
-
type Model = 'opt-in' | 'opt-out' | 'iab' | null;
|
|
167
|
-
```
|
|
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.
|
|
168
53
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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.
|