@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,2 +1,2 @@
|
|
|
1
|
-
export * from './button';
|
|
2
|
-
export * from './button.types';
|
|
1
|
+
export * from './button.js';
|
|
2
|
+
export * from './button.types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './collapsible';
|
|
1
|
+
export * from './collapsible.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dialog';
|
|
1
|
+
export * from './dialog.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ElementType, JSX, SVGProps } from 'react';
|
|
2
2
|
type LucideIconProps = SVGProps<SVGSVGElement> & {
|
|
3
|
-
|
|
3
|
+
/** Omit for a decorative icon that must add nothing to an accessible name. */
|
|
4
|
+
title?: string;
|
|
4
5
|
iconPath: JSX.Element;
|
|
5
6
|
};
|
|
6
7
|
export declare const LucideIcon: ({ title, iconPath }: LucideIconProps) => ElementType;
|
|
@@ -16,14 +16,4 @@ export declare const InthLogo: (props: SVGProps<SVGSVGElement> & IconProps) => i
|
|
|
16
16
|
* INTH icon-only mark for compact placements like floating triggers.
|
|
17
17
|
*/
|
|
18
18
|
export declare const InthIconOnly: (props: SVGProps<SVGSVGElement> & IconProps) => import("react").JSX.Element;
|
|
19
|
-
/**
|
|
20
|
-
* Fingerprint icon for privacy/consent contexts.
|
|
21
|
-
* A generic icon representing user identity and privacy.
|
|
22
|
-
*/
|
|
23
|
-
export declare const FingerprintIcon: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & IconProps) => import("react").JSX.Element;
|
|
24
|
-
/**
|
|
25
|
-
* Settings/gear icon for preference contexts.
|
|
26
|
-
* A generic icon representing configuration and settings.
|
|
27
|
-
*/
|
|
28
|
-
export declare const SettingsIcon: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & IconProps) => import("react").JSX.Element;
|
|
29
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './preference-item';
|
|
1
|
+
export * from './preference-item.js';
|
|
@@ -66,6 +66,19 @@ export interface PreferenceItemTitleProps extends HTMLAttributes<HTMLHeadingElem
|
|
|
66
66
|
}
|
|
67
67
|
declare const PreferenceItemTitle: import("react").ForwardRefExoticComponent<PreferenceItemTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
68
68
|
export interface PreferenceItemContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
69
|
+
/**
|
|
70
|
+
* Render the children while the item has never been opened.
|
|
71
|
+
*
|
|
72
|
+
* By default the content element is always rendered, so the trigger's
|
|
73
|
+
* `aria-controls` target exists, but its children mount the first time
|
|
74
|
+
* the item opens and then stay mounted, so the close transition and any
|
|
75
|
+
* state inside them survive. Collapsed content is `inert` and
|
|
76
|
+
* `aria-hidden` either way. Set this when collapsed children must be in
|
|
77
|
+
* the DOM, for example when custom CSS shows them.
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue false
|
|
80
|
+
*/
|
|
81
|
+
forceMount?: boolean;
|
|
69
82
|
innerClassName?: string;
|
|
70
83
|
innerSlotKey?: ConsentComponentSlotKey;
|
|
71
84
|
noStyle?: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './switch';
|
|
2
|
-
export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchThumbCSSVariables, SwitchTrackCSSVariables, } from './switch.types';
|
|
1
|
+
export * from './switch.js';
|
|
2
|
+
export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchThumbCSSVariables, SwitchTrackCSSVariables, } from './switch.types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
-
import type { ThemeValue } from '../../../../types/theme';
|
|
2
|
+
import type { ThemeValue } from '../../../../types/theme/index.js';
|
|
3
3
|
export type SwitchSize = 'medium' | 'small';
|
|
4
4
|
export interface SwitchVariantsProps {
|
|
5
5
|
size?: SwitchSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './tabs';
|
|
1
|
+
export * from './tabs.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConsentGate, ConsentGateButton, type ConsentGateCompoundComponent, type ConsentGateProps, ConsentGateRoot, ConsentGateTitle, Frame, FrameButton, type FrameCompoundComponent, type FrameProps, FrameRoot, FrameTitle, } from './components/consent-gate/index.js';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Theme } from './types/theme/index.js';
|
|
2
|
+
/** Props for {@link ConsentTheme}. */
|
|
3
|
+
export interface ConsentThemeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Theme tokens: colors, dark colors, typography, spacing, radius,
|
|
6
|
+
* shadows and motion. Defaults to the built-in theme, which the package
|
|
7
|
+
* stylesheet already contains, so omit it only to pick a `colorScheme`
|
|
8
|
+
* before hydration.
|
|
9
|
+
*/
|
|
10
|
+
theme?: Theme;
|
|
11
|
+
/**
|
|
12
|
+
* Color scheme to apply before hydration. `'dark'` makes the dark
|
|
13
|
+
* tokens the default, and `'system'` follows `prefers-color-scheme`.
|
|
14
|
+
* Omit it to follow the `dark` / `c15t-dark` class on `<html>`. Pass the
|
|
15
|
+
* same value as the provider's `colorScheme` option.
|
|
16
|
+
*/
|
|
17
|
+
colorScheme?: 'light' | 'dark' | 'system' | null;
|
|
18
|
+
/** Content Security Policy nonce for the `<style>` element. */
|
|
19
|
+
nonce?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders the `--c15t-*` CSS variables for a theme as a `<style>` element.
|
|
23
|
+
*
|
|
24
|
+
* Render it once, next to the consent provider, where your framework renders
|
|
25
|
+
* on the server. The provider does not generate theme CSS itself.
|
|
26
|
+
*
|
|
27
|
+
* @param props - The theme, color scheme and CSP nonce.
|
|
28
|
+
* @returns A `<style id="c15t-theme">` element.
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* // app/layout.tsx (Server Component)
|
|
32
|
+
* import { ConsentTheme } from '@c15t/nextjs';
|
|
33
|
+
* import { theme } from './consent-theme';
|
|
34
|
+
*
|
|
35
|
+
* <ConsentTheme theme={theme} colorScheme="system" />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const ConsentTheme: ({ theme, colorScheme, nonce, }: ConsentThemeProps) => import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SaveUISource } from '@c15t/core';
|
|
1
2
|
/**
|
|
2
3
|
* Value provided by the ConsentTrackingContext.
|
|
3
4
|
*
|
|
@@ -30,3 +31,12 @@ export declare const ConsentTrackingContext: import("react").Context<ConsentTrac
|
|
|
30
31
|
* @public
|
|
31
32
|
*/
|
|
32
33
|
export declare const useConsentTracking: () => ConsentTrackingValue;
|
|
34
|
+
/**
|
|
35
|
+
* Narrow a tracking `uiSource` to a value the kernel records. Custom labels
|
|
36
|
+
* fall back to the kernel's `activeUI` attribution.
|
|
37
|
+
*
|
|
38
|
+
* @param value - The `uiSource` from props or context.
|
|
39
|
+
* @returns A kernel save source, or `undefined` to keep the default.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare const toSaveUISource: (value: string | undefined) => SaveUISource | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export { HydrationSnapshotContext, KernelContext, type ProviderServices, ProviderServicesContext, StreamedPrefetchContext, } from '../context.js';
|
|
2
|
+
export { ConsentTrackingContext, type ConsentTrackingValue, toSaveUISource, useConsentTracking, } from './consent-tracking-context.js';
|
|
3
|
+
export { GlobalThemeContext, LocalThemeContext, type ThemeContextValue, } from './theme-context.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Theme } from '../types/theme';
|
|
1
|
+
import type { Theme } from '../types/theme/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Configuration value type for the ThemeContext.
|
|
4
4
|
*
|
|
@@ -41,10 +41,10 @@ export interface ThemeContextValue {
|
|
|
41
41
|
*/
|
|
42
42
|
trapFocus?: boolean;
|
|
43
43
|
/**
|
|
44
|
-
* Color scheme preference.
|
|
44
|
+
* Color scheme preference. `null` when the provider leaves the class alone.
|
|
45
45
|
* @default 'system'
|
|
46
46
|
*/
|
|
47
|
-
colorScheme?: 'light' | 'dark' | 'system';
|
|
47
|
+
colorScheme?: 'light' | 'dark' | 'system' | null;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Context for providing theme values to components.
|
package/dist-types/context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AllConsentNames, ConsentKernel, ConsentPresentation } from '@c15t/core';
|
|
1
|
+
import type { AllConsentNames, ConsentKernel, ConsentPresentation, ConsentSnapshot } from '@c15t/core';
|
|
2
|
+
import type { StreamedPrefetch } from '@c15t/core/runtime';
|
|
2
3
|
/**
|
|
3
4
|
* React context carrying the kernel instance.
|
|
4
5
|
*
|
|
@@ -13,5 +14,28 @@ export interface ProviderServices {
|
|
|
13
14
|
clearRecords: () => void;
|
|
14
15
|
getPresentation: () => ConsentPresentation | undefined;
|
|
15
16
|
getConsentCategories: () => readonly AllConsentNames[];
|
|
17
|
+
/** Whether the runtime has started: records hydrated, prefetch adopted. */
|
|
18
|
+
isStarted: () => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Store a language override and load its copy: init runs again on the
|
|
21
|
+
* provider's own kernel while it is enabled, and a borrowed runtime
|
|
22
|
+
* reinitializes itself.
|
|
23
|
+
*/
|
|
24
|
+
setLanguage: (code: string) => void;
|
|
16
25
|
}
|
|
17
26
|
export declare const ProviderServicesContext: import("react").Context<ProviderServices | null>;
|
|
27
|
+
/**
|
|
28
|
+
* The provider runtime's streamed `prefetch`, while `prefetch` is a promise.
|
|
29
|
+
* Consent surfaces render inside a boundary that waits for it.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const StreamedPrefetchContext: import("react").Context<StreamedPrefetch | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* The snapshot a streamed consent surface was server-rendered from, which
|
|
36
|
+
* its hydration must read in place of the kernel's own server snapshot.
|
|
37
|
+
* `null` everywhere else.
|
|
38
|
+
*
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare const HydrationSnapshotContext: import("react").Context<ConsentSnapshot | null>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DevToolsDock } from '@c15t/ui/utils/devtools-launcher';
|
|
2
|
+
export { publishDevToolsLauncher } from '@c15t/ui/utils/devtools-launcher';
|
|
3
|
+
export type { DevToolsDock } from '@c15t/ui/utils/devtools-launcher';
|
|
4
|
+
/** Controls for the DevTools button a consent trigger renders. */
|
|
5
|
+
export interface DevToolsLauncherControls {
|
|
6
|
+
/** Whether the DevTools panel is open. */
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
/** Open or close the panel. */
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
/** Anchor the panel to the trigger, or release it with `null`. */
|
|
11
|
+
dock: (dock: DevToolsDock | null) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether a `<ConsentDevTools>` is mounted for the nearest provider.
|
|
15
|
+
* @returns `true` while DevTools can hand its launcher to a trigger.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const useDevToolsLauncherAvailable: () => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Claim the DevTools launcher for this trigger.
|
|
21
|
+
*
|
|
22
|
+
* Only one trigger renders the launcher at a time; others get `null` until
|
|
23
|
+
* the owner unmounts. Releasing the claim, or DevTools unmounting, brings
|
|
24
|
+
* the floating launcher back.
|
|
25
|
+
*
|
|
26
|
+
* @returns Launcher controls while this trigger owns the launcher.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare const useDevToolsLauncher: () => DevToolsLauncherControls | null;
|
package/dist-types/devtools.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type DevToolsProps = ConsentDevToolsProps;
|
|
|
15
15
|
* @param props - Presentation options passed to the DevTools engine.
|
|
16
16
|
* @returns `null`; the engine mounts its interface into `document.body`.
|
|
17
17
|
*/
|
|
18
|
-
export declare const ConsentDevTools: ({ disabled, clearRecords, getPresentation, defaultOpen, defaultTab, getConsentCategories, maxEvents, position, }: ConsentDevToolsProps) => null;
|
|
18
|
+
export declare const ConsentDevTools: ({ disabled, clearRecords, getPresentation, defaultOpen, defaultTab, getConsentCategories, maxEvents, position, shadow, }: ConsentDevToolsProps) => null;
|
|
19
19
|
/** Compatible short name for {@link ConsentDevTools}. */
|
|
20
20
|
export declare const DevTools: typeof ConsentDevTools;
|
|
21
21
|
/** Backward-compatible name for {@link ConsentDevTools}. */
|
|
@@ -24,13 +24,24 @@ export declare const C15TDevTools: typeof ConsentDevTools;
|
|
|
24
24
|
export interface C15tTanStackDevtoolsPanelProps extends HTMLAttributes<HTMLDivElement>, Pick<DevToolsOptions, 'defaultTab' | 'maxEvents' | 'getConsentCategories' | 'getPresentation' | 'clearRecords'> {
|
|
25
25
|
/** Prevents the embedded DevTools engine from mounting. @default false */
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Color scheme of the surrounding devtools shell. Omit to follow the
|
|
29
|
+
* operating system. {@link c15tDevtools} passes TanStack's theme.
|
|
30
|
+
*/
|
|
31
|
+
theme?: TanStackDevtoolsTheme;
|
|
32
|
+
}
|
|
33
|
+
/** Color scheme TanStack Devtools passes to plugin panels. */
|
|
34
|
+
export type TanStackDevtoolsTheme = 'light' | 'dark';
|
|
35
|
+
/** Props React TanStack Devtools passes to a plugin's render function. */
|
|
36
|
+
export interface TanStackDevtoolsPluginProps {
|
|
37
|
+
theme?: TanStackDevtoolsTheme;
|
|
27
38
|
}
|
|
28
39
|
/** Plugin configuration accepted by React TanStack Devtools. */
|
|
29
40
|
export interface TanStackDevtoolsPlugin {
|
|
30
41
|
id?: string;
|
|
31
42
|
name: string;
|
|
32
43
|
defaultOpen?: boolean;
|
|
33
|
-
render: ReactElement;
|
|
44
|
+
render: (element: HTMLElement, props?: TanStackDevtoolsPluginProps | TanStackDevtoolsTheme) => ReactElement;
|
|
34
45
|
}
|
|
35
46
|
/** Options for {@link c15tDevtools}. */
|
|
36
47
|
export interface C15tDevtoolsPluginOptions extends C15tTanStackDevtoolsPanelProps {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ConsentKernel, SaveInput, SaveResult, SaveUISource } from '@c15t/core';
|
|
2
|
+
import type { PreferenceDraft } from '@c15t/core/preference-draft';
|
|
3
|
+
/**
|
|
4
|
+
* The draft a `ConsentDraftProvider` shares. Here, apart from the draft
|
|
5
|
+
* module, so the banner's buttons can read it without loading the draft:
|
|
6
|
+
* the draft only runs once a preference surface renders.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DraftContext: import("react").Context<PreferenceDraft | null>;
|
|
9
|
+
export declare const REFUSED: SaveResult;
|
|
10
|
+
/** The kernel in context; throws outside a provider. */
|
|
11
|
+
export declare const useDraftKernel: () => ConsentKernel;
|
|
12
|
+
/**
|
|
13
|
+
* Whether `owner` is still the kernel this component last committed.
|
|
14
|
+
*
|
|
15
|
+
* A handle or save action kept across a runtime switch, by an async submit
|
|
16
|
+
* or a descendant's layout effect in the switch commit, calls through this,
|
|
17
|
+
* so it records nothing into the previous runtime. The committed kernel is
|
|
18
|
+
* read at call time (see `useCommittedRef`). A component that only unmounts
|
|
19
|
+
* keeps its last kernel, so a submit that outlives its dialog still saves.
|
|
20
|
+
*/
|
|
21
|
+
export declare const useKernelGuard: (owner: ConsentKernel) => () => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Internal UI save path shared by stock controls and headless actions.
|
|
24
|
+
*
|
|
25
|
+
* Inside a `ConsentDraftProvider` an omitted input saves the shared draft.
|
|
26
|
+
* Bulk and explicit inputs go straight to the kernel; a bulk one also
|
|
27
|
+
* discards the draft's staged edits.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare const useConsentSaveAction: () => (input?: SaveInput, uiSource?: SaveUISource) => Promise<SaveResult>;
|
package/dist-types/draft.d.ts
CHANGED
|
@@ -1,31 +1,103 @@
|
|
|
1
|
-
import type { AllConsentNames, ConsentState, SaveResult
|
|
1
|
+
import type { AllConsentNames, ConsentState, SaveResult } from '@c15t/core';
|
|
2
|
+
import type { PreferenceDraft, PreferenceDraftState } from '@c15t/core/preference-draft';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
4
|
/** A local, unmasked selection, committed only by an explicit save. */
|
|
4
5
|
export interface ConsentDraftHandle {
|
|
5
6
|
values: Readonly<ConsentState>;
|
|
6
7
|
displayedCategories: readonly AllConsentNames[];
|
|
8
|
+
/**
|
|
9
|
+
* Granted flag per declared vendor. Seeded from the denials the gate
|
|
10
|
+
* honors, so a vendor declared `disabled` reads `true` whatever an older
|
|
11
|
+
* record says; every vendor not denied is `true`. Empty under an `iab`
|
|
12
|
+
* policy.
|
|
13
|
+
*/
|
|
14
|
+
vendors: Readonly<Record<string, boolean>>;
|
|
7
15
|
isDirty: boolean;
|
|
8
|
-
/** A
|
|
16
|
+
/** A policy or displayed-category change requires reset and review before saving. */
|
|
9
17
|
isStale: boolean;
|
|
10
18
|
set: (category: AllConsentNames, value: boolean) => void;
|
|
11
19
|
update: (patch: Partial<ConsentState>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Stage one vendor's grant. Recorded by the next save. Ignored for a
|
|
22
|
+
* vendor that is not declared or is declared `disabled`, since the kernel
|
|
23
|
+
* would drop the grant on save.
|
|
24
|
+
*/
|
|
25
|
+
setVendor: (vendorId: string, granted: boolean) => void;
|
|
12
26
|
acceptAll: () => void;
|
|
13
27
|
rejectAll: () => void;
|
|
14
28
|
save: () => Promise<SaveResult>;
|
|
15
29
|
reset: () => void;
|
|
16
30
|
}
|
|
31
|
+
type DraftStore = PreferenceDraft;
|
|
17
32
|
export interface ConsentDraftProviderProps {
|
|
18
33
|
children: ReactNode;
|
|
19
34
|
/** Defaults apply only to categories without an explicit receipt. */
|
|
20
35
|
initial?: Partial<ConsentState>;
|
|
21
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Share one draft with every draft hook and stock control below it. The
|
|
39
|
+
* preference dialog renders one, so its switches, vendor rows and save
|
|
40
|
+
* button stage into and confirm the same draft.
|
|
41
|
+
*/
|
|
22
42
|
export declare const ConsentDraftProvider: ({ children, initial, }: ConsentDraftProviderProps) => import("react").JSX.Element;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The nearest consent draft, for the stock preference rows. Pair with
|
|
45
|
+
* {@link useConsentDraftSlice} so a row re-renders only when its own slice
|
|
46
|
+
* changes, not on every staged edit elsewhere in the draft.
|
|
47
|
+
*
|
|
48
|
+
* @returns The shared draft, or a local one outside a provider.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare const useConsentDraftStore: () => DraftStore;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribes to one slice of a consent draft.
|
|
54
|
+
*
|
|
55
|
+
* @param draft - Draft from {@link useConsentDraftStore}.
|
|
56
|
+
* @param selector - Picks the slice. Return a primitive or a reference the
|
|
57
|
+
* draft already holds.
|
|
58
|
+
* @returns The selected slice.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare const useConsentDraftSlice: <SliceType>(draft: DraftStore, selector: (state: PreferenceDraftState) => SliceType) => SliceType;
|
|
30
62
|
/** Read and edit displayed choices without replacing masked effective permissions. */
|
|
31
63
|
export declare const useConsentDraft: () => ConsentDraftHandle;
|
|
64
|
+
/** The vendor slice of the consent draft, for a custom vendor control. */
|
|
65
|
+
export interface VendorDraftHandle {
|
|
66
|
+
/** Granted flag per declared vendor. See {@link ConsentDraftHandle.vendors}. */
|
|
67
|
+
vendors: Readonly<Record<string, boolean>>;
|
|
68
|
+
/** Stage one vendor's grant for the next save. See {@link ConsentDraftHandle.setVendor}. */
|
|
69
|
+
setVendor: (vendorId: string, granted: boolean) => void;
|
|
70
|
+
/** Whether any draft value, category or vendor, differs from the record. */
|
|
71
|
+
isDirty: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the policy or the vendor surface changed under an unsaved edit.
|
|
74
|
+
* `save` refuses a stale draft. See {@link ConsentDraftHandle.isStale}.
|
|
75
|
+
*/
|
|
76
|
+
isStale: boolean;
|
|
77
|
+
/** Confirm the draft, categories and vendors together. */
|
|
78
|
+
save: () => Promise<SaveResult>;
|
|
79
|
+
/** Discard staged edits and reseed from the record. See {@link ConsentDraftHandle.reset}. */
|
|
80
|
+
reset: () => void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Read and stage vendor grants on the same draft the category switches use.
|
|
84
|
+
* A custom vendor toggle needs only this; the categories stay where the
|
|
85
|
+
* stock widget or `useConsentDraft()` left them, and one save confirms both.
|
|
86
|
+
* When the policy or the vendor list changes under a staged edit the draft
|
|
87
|
+
* turns stale and `save` refuses it; `reset` reseeds it from the record.
|
|
88
|
+
*
|
|
89
|
+
* @returns The draft's vendor map, the setter, the dirty and stale flags,
|
|
90
|
+
* the save and the reset.
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* const { vendors, setVendor, isStale, reset, save } = useVendorDraft();
|
|
94
|
+
* <Switch
|
|
95
|
+
* checked={vendors['meta-pixel'] ?? true}
|
|
96
|
+
* onCheckedChange={(on) => setVendor('meta-pixel', on)}
|
|
97
|
+
* />;
|
|
98
|
+
* {isStale && <button onClick={reset}>Review again</button>}
|
|
99
|
+
* ```
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export declare const useVendorDraft: () => VendorDraftHandle;
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RuntimeGPPOptions } from '@c15t/core/runtime';
|
|
2
|
+
/** Props for {@link ConsentGPP}: the GPP options, all optional. */
|
|
3
|
+
export type ConsentGPPProps = RuntimeGPPOptions;
|
|
4
|
+
/**
|
|
5
|
+
* Installs `window.__gpp`, the IAB GPP CMP API, on the surrounding
|
|
6
|
+
* provider's kernel and keeps its GPP string in step with the visitor's
|
|
7
|
+
* choices. Renders nothing. Unmounting removes `__gpp`.
|
|
8
|
+
*
|
|
9
|
+
* Render it inside `ConsentProvider` (or `ConsentRoot` in Next.js and
|
|
10
|
+
* TanStack Start). Every prop is plain data, so a Server Component can
|
|
11
|
+
* render it.
|
|
12
|
+
*
|
|
13
|
+
* @param props - GPP options. See `RuntimeGPPOptions`.
|
|
14
|
+
* @returns `null`.
|
|
15
|
+
* @throws {Error} When rendered outside a consent provider.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { ConsentGPP } from '@c15t/react/gpp';
|
|
20
|
+
*
|
|
21
|
+
* <ConsentProvider options={{ mode: hosted({ backendURL }) }}>
|
|
22
|
+
* <ConsentGPP usFallback="none" />
|
|
23
|
+
* <App />
|
|
24
|
+
* </ConsentProvider>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const ConsentGPP: ({ cmpId, mspaMode, optOutCategories, tcf, usApproach, usFallback, }: ConsentGPPProps) => null;
|
package/dist-types/headless.d.ts
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* Pair with `ConsentProvider` from `@c15t/react` (or `@c15t/react/provider`).
|
|
6
6
|
*/
|
|
7
7
|
export { defaultTranslationConfig, detectBrowserLanguage, mergeTranslationConfigs, prepareTranslationConfig, } from '@c15t/core';
|
|
8
|
-
export { type ConsentDialogTriggerVisibility, type UseConsentDialogTriggerOptions, type UseConsentDialogTriggerResult, useConsentDialogTrigger, } from './component-hooks/use-panel-trigger';
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export type { ReactUIOptions } from './types/manager';
|
|
8
|
+
export { type ConsentDialogTriggerVisibility, type UseConsentDialogTriggerOptions, type UseConsentDialogTriggerResult, useConsentDialogTrigger, } from './component-hooks/use-panel-trigger.js';
|
|
9
|
+
export { type HeadlessConsentBannerAction, type HeadlessConsentBannerState, type HeadlessConsentDialogAction, type HeadlessConsentDialogState, type HeadlessConsentSurface, type HeadlessConsentSurfaceAction, type HeadlessConsentSurfaceState, type HeadlessConsentWriteAction, useHeadlessConsentUI, } from './component-hooks/use-headless-consent-ui.js';
|
|
10
|
+
export { useTranslations } from './component-hooks/use-translations.js';
|
|
11
|
+
export { useColorScheme } from './hooks/use-color-scheme.js';
|
|
12
|
+
export { useFocusTrap } from './hooks/use-focus-trap.js';
|
|
13
|
+
export type { ReactUIOptions } from './types/manager.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A ref that holds `value` from the render React most recently committed.
|
|
3
|
+
*
|
|
4
|
+
* Consent guards use it to answer "is this still the kernel, draft or IAB
|
|
5
|
+
* selection this component renders?" when a kept callback runs, including
|
|
6
|
+
* from a descendant's layout effect in the very commit that switched
|
|
7
|
+
* runtimes.
|
|
8
|
+
*
|
|
9
|
+
* Why an insertion effect: React runs insertion effects while it applies a
|
|
10
|
+
* commit, before any layout effect of that commit, and never for a render it
|
|
11
|
+
* discards. Assigning the ref during render would publish values from
|
|
12
|
+
* renders React throws away (an interrupted concurrent render, StrictMode's
|
|
13
|
+
* second render). A layout effect is too late, because descendants' layout
|
|
14
|
+
* effects run before their ancestors'. A passive effect is later still.
|
|
15
|
+
* Assigning the committed value is idempotent, so StrictMode's replayed
|
|
16
|
+
* effects cannot leave a stale value behind.
|
|
17
|
+
*
|
|
18
|
+
* @param value - The value this render uses.
|
|
19
|
+
* @returns A ref whose `current` is the last committed `value`.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare const useCommittedRef: <Value>(value: Value) => {
|
|
23
|
+
readonly current: Value;
|
|
24
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FocusTrapOptions } from '@c15t/ui/utils/dom';
|
|
1
2
|
import type { RefObject } from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* Hook that manages focus trapping within a container.
|
|
@@ -8,7 +9,8 @@ import type { RefObject } from 'react';
|
|
|
8
9
|
*
|
|
9
10
|
* @param shouldTrap - Boolean indicating whether focus should be trapped
|
|
10
11
|
* @param containerRef - Reference to the container element
|
|
12
|
+
* @param options - Where the trap puts focus when it starts
|
|
11
13
|
*
|
|
12
14
|
* @public
|
|
13
15
|
*/
|
|
14
|
-
export declare const useFocusTrap: (shouldTrap: boolean, containerRef: RefObject<HTMLElement | null> | null) => void;
|
|
16
|
+
export declare const useFocusTrap: (shouldTrap: boolean, containerRef: RefObject<HTMLElement | null> | null, options?: FocusTrapOptions) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HeadlessIABBannerAction, HeadlessIABDialogAction, HeadlessIABPreferenceTab } from '@c15t/iab/headless';
|
|
2
|
-
import { useIABConsentManager } from './use-iab-manager';
|
|
2
|
+
import { useIABConsentManager } from './use-iab-manager.js';
|
|
3
3
|
export type { HeadlessIABBannerAction, HeadlessIABDialogAction, HeadlessIABPreferenceTab, };
|
|
4
4
|
export interface HeadlessIABBannerState {
|
|
5
5
|
isVisible: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ActiveUI, ConsentPresentation, TranslationConfig } from '@c15t/core';
|
|
2
2
|
export declare const useIABConsentManager: (overrides?: ConsentPresentation) => {
|
|
3
3
|
activeUI: ActiveUI;
|
|
4
|
-
iab: import("../iab-context").ReactIABState | null;
|
|
4
|
+
iab: import("../iab-context.js").ReactIABState | null;
|
|
5
5
|
model: import("@c15t/core").KernelModel | null;
|
|
6
6
|
policyBanner: {
|
|
7
7
|
allowedActions: import("@c15t/core").PresentationAction[];
|
|
@@ -11,8 +11,8 @@ export declare const useIABConsentManager: (overrides?: ConsentPresentation) =>
|
|
|
11
11
|
actionGroups: import("@c15t/core").PresentationAction[][];
|
|
12
12
|
primaryActions: import("@c15t/core").PresentationAction[];
|
|
13
13
|
diagnostics: import("@c15t/core").PresentationDiagnostic[];
|
|
14
|
-
rights: readonly import("@c15t/schema
|
|
15
|
-
preferenceControls: Exclude<import("@c15t/schema
|
|
14
|
+
rights: readonly import("@c15t/schema").PolicyRight[];
|
|
15
|
+
preferenceControls: Exclude<import("@c15t/schema").PolicyRight, 'disclosure'>[];
|
|
16
16
|
direction: 'row' | 'column';
|
|
17
17
|
uiProfile: 'balanced' | 'compact' | 'strict';
|
|
18
18
|
scrollLock: boolean;
|
|
@@ -32,8 +32,8 @@ export declare const useIABConsentManager: (overrides?: ConsentPresentation) =>
|
|
|
32
32
|
actionGroups: import("@c15t/core").PresentationAction[][];
|
|
33
33
|
primaryActions: import("@c15t/core").PresentationAction[];
|
|
34
34
|
diagnostics: import("@c15t/core").PresentationDiagnostic[];
|
|
35
|
-
rights: readonly import("@c15t/schema
|
|
36
|
-
preferenceControls: Exclude<import("@c15t/schema
|
|
35
|
+
rights: readonly import("@c15t/schema").PolicyRight[];
|
|
36
|
+
preferenceControls: Exclude<import("@c15t/schema").PolicyRight, 'disclosure'>[];
|
|
37
37
|
direction: 'row' | 'column';
|
|
38
38
|
uiProfile: 'balanced' | 'compact' | 'strict';
|
|
39
39
|
scrollLock: boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IABUnavailableError } from '@c15t/core';
|
|
2
|
+
/**
|
|
3
|
+
* Record that `IABProvider` is part of the app. `@c15t/react/iab` calls
|
|
4
|
+
* this when it loads.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const markIABProviderLoaded: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* The error the standard surfaces throw for an `iab` policy without
|
|
11
|
+
* `<IABProvider>`.
|
|
12
|
+
*
|
|
13
|
+
* @returns A fresh {@link IABUnavailableError}.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const missingIABProviderError: () => IABUnavailableError;
|
|
17
|
+
/**
|
|
18
|
+
* Throw while rendering when the visitor's policy needs a CMP and the app
|
|
19
|
+
* has none.
|
|
20
|
+
*
|
|
21
|
+
* The standard banner and dialog do not answer for the IAB model, so
|
|
22
|
+
* without `<IABProvider>` a visitor under an `iab` policy would see no
|
|
23
|
+
* consent UI at all. Throwing during render reaches error boundaries and
|
|
24
|
+
* framework error overlays, on the server render and in the browser alike,
|
|
25
|
+
* since both read the same snapshot.
|
|
26
|
+
*
|
|
27
|
+
* `<IABProvider>` usually sits beside the standard surfaces rather than
|
|
28
|
+
* around them, so a missing IAB context alone does not prove the app has
|
|
29
|
+
* none. The check also passes once `@c15t/react/iab` has loaded.
|
|
30
|
+
*
|
|
31
|
+
* @throws {IABUnavailableError} When the policy needs IAB and neither an
|
|
32
|
+
* IAB context nor `@c15t/react/iab` is present.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare const useIABPolicyGuard: () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a banner that shows now arrives after the page has painted.
|
|
3
|
+
*
|
|
4
|
+
* Decided once each time `shown` turns on, and held while it stays on, so a
|
|
5
|
+
* re-render never restarts the entry. A banner hydrated from server HTML is
|
|
6
|
+
* part of the first paint: the hook answers `false` while hydrating, which
|
|
7
|
+
* also keeps the markup matching the server's.
|
|
8
|
+
*
|
|
9
|
+
* @param shown - Whether the banner is rendered.
|
|
10
|
+
* @returns Whether to mark the mount `data-entry="late"`.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const useLateEntry: (shown: boolean) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ThemeContextValue } from '../context/theme-context';
|
|
1
|
+
import type { ThemeContextValue } from '../context/theme-context.js';
|
|
2
2
|
export declare const useTheme: () => ThemeContextValue;
|