@c15t/react 3.0.0-alpha.3 → 3.0.0-alpha.5
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 +92 -72
- package/README.md +21 -17
- package/SKILL.md +34 -0
- 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/components/consent-gate/atoms.js +1 -1
- package/dist/components/consent-gate/consent-gate.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/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/root.js +1 -1
- package/dist/components/panel-trigger/atoms/button.js +1 -1
- package/dist/components/panel-trigger/atoms/toolbar.js +1 -1
- package/dist/components/preferences/atoms/accordion.js +1 -1
- 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/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/ui/dialog/dialog.js +1 -1
- package/dist/components/shared/ui/icon.js +1 -1
- package/dist/context/consent-tracking-context.js +1 -1
- 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/hooks/use-color-scheme.js +1 -1
- package/dist/hooks/use-focus-trap.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/iab/styles.tw3.css +4 -4
- 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/hooks.js +1 -0
- package/dist/index-parts/module-hooks.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 -1
- package/dist/module-hooks/iframe-blocker.js +1 -1
- package/dist/postcss-tailwind3.js +1 -0
- 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 +16 -16
- package/dist/transports/offline.js +1 -1
- 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/component-hooks/use-headless-consent-ui.d.ts +1 -1
- package/dist-types/components/iab-panel/atoms/feature-item.d.ts +28 -0
- package/dist-types/components/iab-panel/iab-panel.d.ts +2 -2
- package/dist-types/components/iab-panel/index.d.ts +5 -2
- package/dist-types/components/iab-panel/use-iab-translations.d.ts +4 -0
- package/dist-types/components/iab-prompt/iab-prompt.d.ts +2 -2
- package/dist-types/components/iab-prompt/index.d.ts +2 -2
- package/dist-types/components/panel/atoms/card.d.ts +1 -0
- package/dist-types/components/prompt/components.d.ts +6 -0
- package/dist-types/components/shared/libs/compose-refs.d.ts +20 -0
- package/dist-types/components/shared/ui/icon.d.ts +2 -1
- package/dist-types/context/consent-tracking-context.d.ts +10 -0
- package/dist-types/context/theme-context.d.ts +2 -2
- package/dist-types/context.d.ts +6 -0
- package/dist-types/devtools.d.ts +13 -2
- package/dist-types/draft-context.d.ts +31 -0
- package/dist-types/draft.d.ts +13 -30
- package/dist-types/gpp.d.ts +27 -0
- package/dist-types/hooks/use-focus-trap.d.ts +3 -1
- package/dist-types/hooks.d.ts +57 -13
- package/dist-types/iab.d.ts +1 -1
- 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 +8 -0
- package/dist-types/index-parts/draft.d.ts +7 -0
- package/dist-types/index-parts/hooks.d.ts +7 -0
- package/dist-types/index-parts/module-hooks.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 +14 -15
- package/dist-types/kernel-selector.d.ts +0 -8
- package/dist-types/module-hooks/iframe-blocker.d.ts +12 -7
- package/dist-types/postcss-tailwind3.d.ts +21 -0
- package/dist-types/provider.d.ts +57 -17
- package/dist-types/server/headers.d.ts +14 -4
- package/dist-types/server/normalize-url.d.ts +14 -7
- package/dist-types/server/types.d.ts +12 -1
- package/dist-types/transports/offline.d.ts +7 -16
- package/dist-types/ui-config-context.d.ts +7 -1
- package/dist-types/utils/merge-slot-props.d.ts +15 -1
- package/dist-types/utils/theme-utils.d.ts +17 -2
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +92 -72
- 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 +87 -0
- package/docs/{frameworks/react/concepts → concepts}/consent-categories.md +22 -7
- package/docs/{guides → concepts}/consent-state.md +89 -105
- package/docs/{guides → concepts}/data-fetching.md +31 -27
- package/docs/concepts/how-consent-works.md +123 -0
- package/docs/{frameworks/react/concepts/policy-presets.md → concepts/policies.md} +7 -59
- package/docs/customization/class-names.md +202 -0
- package/docs/customization/dark-mode.md +157 -0
- package/docs/customization/motion.md +119 -0
- package/docs/customization/overview.md +67 -34
- package/docs/customization/recipes.md +839 -49
- package/docs/customization/slots.md +216 -35
- package/docs/customization/stylesheets.md +147 -0
- package/docs/customization/tailwind.md +842 -0
- package/docs/customization/tokens.md +163 -96
- package/docs/customization/translations.md +60 -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 +42 -28
- package/docs/frameworks/react/components/consent-dialog-link.md +13 -11
- package/docs/frameworks/react/components/consent-dialog-trigger.md +81 -76
- package/docs/frameworks/react/components/consent-dialog.md +56 -50
- package/docs/frameworks/react/components/consent-gate.md +37 -20
- package/docs/frameworks/react/components/consent-provider.md +130 -0
- package/docs/frameworks/react/components/consent-widget.md +23 -20
- package/docs/frameworks/react/components/dev-tools.md +53 -85
- package/docs/frameworks/react/components.md +105 -0
- package/docs/frameworks/react/compose.md +354 -0
- package/docs/frameworks/react/content-security-policy.md +126 -0
- package/docs/frameworks/react/customize.md +250 -0
- package/docs/frameworks/react/embeds.md +89 -0
- package/docs/frameworks/react/gpp.md +163 -0
- package/docs/frameworks/react/{hooks/overview.md → hooks.md} +21 -16
- package/docs/frameworks/react/{iab/overview.md → iab.md} +80 -31
- package/docs/frameworks/react/network-blocker.md +35 -41
- package/docs/frameworks/react/quickstart.md +139 -101
- package/docs/frameworks/react/rendering.md +128 -0
- package/docs/frameworks/react/scripts.md +115 -0
- package/docs/frameworks/react/translations.md +155 -0
- package/docs/frameworks/react/troubleshooting.md +92 -47
- package/docs/frameworks/react/vendor-consent.md +170 -0
- package/docs/guides/banner-experiments.md +654 -0
- package/docs/guides/troubleshooting.md +120 -47
- package/docs/guides/verify-consent.md +81 -49
- package/docs/integrations/adobe-analytics.md +167 -159
- package/docs/integrations/ahrefs-analytics.md +152 -154
- package/docs/integrations/amplitude.md +162 -156
- package/docs/integrations/building-integrations.md +136 -37
- package/docs/integrations/clearbit.md +154 -154
- package/docs/integrations/cloudflare-web-analytics.md +156 -156
- package/docs/integrations/cloudflare-zaraz.md +209 -261
- package/docs/integrations/crisp.md +164 -158
- package/docs/integrations/databuddy.md +157 -173
- package/docs/integrations/fathom-analytics.md +158 -156
- package/docs/integrations/front-chat.md +167 -167
- package/docs/integrations/google-maps.md +118 -83
- package/docs/integrations/google-tag-manager.md +178 -163
- package/docs/integrations/google-tag.md +163 -160
- package/docs/integrations/heap.md +163 -155
- package/docs/integrations/hightouch.md +161 -157
- package/docs/integrations/hotjar.md +159 -155
- package/docs/integrations/intercom.md +183 -153
- package/docs/integrations/klaviyo.md +486 -0
- package/docs/integrations/linkedin-insights.md +174 -150
- package/docs/integrations/logrocket.md +160 -156
- package/docs/integrations/matomo-analytics.md +188 -178
- package/docs/integrations/meta-pixel.md +188 -150
- package/docs/integrations/microsoft-clarity.md +163 -155
- package/docs/integrations/microsoft-uet.md +148 -154
- package/docs/integrations/mixpanel-analytics.md +155 -160
- package/docs/integrations/one-dollar-stats.md +166 -165
- package/docs/integrations/openai-pixel.md +204 -301
- package/docs/integrations/overview.md +137 -80
- package/docs/integrations/pinterest-tag.md +191 -183
- package/docs/integrations/pirsch.md +169 -159
- package/docs/integrations/plausible-analytics.md +172 -158
- package/docs/integrations/posthog.md +313 -240
- package/docs/integrations/promptwatch.md +154 -154
- package/docs/integrations/reddit-pixel.md +185 -157
- package/docs/integrations/rudderstack.md +201 -186
- package/docs/integrations/rybbit-analytics.md +171 -160
- package/docs/integrations/segment.md +182 -154
- package/docs/integrations/snapchat-pixel.md +186 -156
- package/docs/integrations/tiktok-pixel.md +171 -150
- package/docs/integrations/umami-analytics.md +163 -158
- package/docs/integrations/vercel-analytics.md +166 -157
- package/docs/integrations/x-pixel.md +176 -150
- package/docs/integrations/youtube.md +121 -86
- package/docs/upgrade-v3.md +496 -467
- package/package.json +20 -9
- package/dist/ui-save.js +0 -1
- package/dist-types/ui-save.d.ts +0 -25
- 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 -95
- package/docs/frameworks/react/script-loader.md +0 -69
- package/docs/frameworks/react/styling/overview.md +0 -266
- package/docs/guides/deployment-modes.md +0 -75
- package/docs/guides/shared-consent-controls.md +0 -158
- package/docs/integrations/clear-on-revocation.md +0 -167
- package/docs/integrations/granular-consent.md +0 -210
package/AGENTS.md
CHANGED
|
@@ -6,14 +6,16 @@ These docs ship inside the package so coding agents can read them offline. Open
|
|
|
6
6
|
|
|
7
7
|
## Using these docs
|
|
8
8
|
|
|
9
|
-
These docs describe v3.
|
|
9
|
+
These docs describe c15t v3. Find your app's row in Choose your setup, then follow that framework guide from start to finish; it names the files to create and the backend URL to use. Install c15t packages with the @alpha dist-tag, because npm latest is still v2. A visible banner does not prove anything: check that vendor requests wait for consent, that rejection survives a reload, and that preferences can be reopened.
|
|
10
10
|
|
|
11
11
|
## Start here
|
|
12
12
|
|
|
13
13
|
- [React quickstart](./docs/frameworks/react/quickstart.md)
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
14
|
+
- [Choose your setup](./docs/concepts/choose-your-setup.md): Pick the c15t setup for your framework, rendering mode and hosting, and decide who runs the consent backend.
|
|
15
|
+
- [How consent works](./docs/concepts/how-consent-works.md): What c15t decides on each page load, the difference between a permission and a recorded choice, and what happens when a visitor saves.
|
|
16
|
+
- [Customize the interface](./docs/customization/overview.md): Change c15t's consent banner and dialog one step at a time, from a prop to your own markup, and find where each step lives in your framework.
|
|
17
|
+
- [Verify consent](./docs/guides/verify-consent.md): Check in a production build that vendor requests wait for consent, rejection survives a reload, preferences reopen and privacy signals apply.
|
|
18
|
+
- [Migrate to v3](./docs/upgrade-v3.md): Upgrade a c15t v2 app to v3. Covers packages, the Next.js and React providers, the JavaScript runtime, custom UI built on useConsentManager, callbacks, policies, stored consent and a self-hosted backend.
|
|
17
19
|
|
|
18
20
|
## More documentation
|
|
19
21
|
|
|
@@ -21,90 +23,108 @@ These docs describe v3. Start with Inth hosted setup, identify the framework, ro
|
|
|
21
23
|
|
|
22
24
|
## Frameworks
|
|
23
25
|
|
|
24
|
-
- [
|
|
26
|
+
- [Callbacks](./docs/frameworks/react/callbacks.md): Run code in a React app when a visitor records a consent choice, when permissions change, when a request fails and before the revocation reload, with the ConsentProvider callbacks option.
|
|
27
|
+
- [Clear on revocation](./docs/frameworks/react/clear-on-revocation.md): Delete the first-party cookies and Web Storage keys a consent category owns in a React app when that category is denied, with the clearOnRevocation option on ConsentProvider.
|
|
28
|
+
- [Components](./docs/frameworks/react/components.md): Every c15t component a React app imports from c15t/react, what each renders, where each one mounts, and which to start with.
|
|
29
|
+
- [ConsentBanner](./docs/frameworks/react/components/consent-banner.md): Render the c15t consent banner in a React app, choose its variant and position, and compose its parts.
|
|
25
30
|
- [ConsentDialog](./docs/frameworks/react/components/consent-dialog.md): Open the c15t preference center as a modal ConsentDialog in a React app, wire its triggers and control blocking, focus and policy gating.
|
|
26
31
|
- [ConsentDialogLink](./docs/frameworks/react/components/consent-dialog-link.md): Add a ConsentDialogLink to a React footer so visitors reopen the c15t preference center from your own text link, with asChild and rights data.
|
|
27
|
-
- [ConsentDialogTrigger](./docs/frameworks/react/components/consent-dialog-trigger.md):
|
|
32
|
+
- [ConsentDialogTrigger](./docs/frameworks/react/components/consent-dialog-trigger.md): Add the c15t ConsentDialogTrigger floating button or toolbar inside a React ConsentProvider so visitors can reopen the preference center after the first prompt.
|
|
28
33
|
- [ConsentGate](./docs/frameworks/react/components/consent-gate.md): Gate a YouTube or map iframe behind consent with ConsentGate in React, showing a placeholder that opens the preference center until the category is allowed.
|
|
29
|
-
- [ConsentProvider](./docs/frameworks/react/components/consent-
|
|
34
|
+
- [ConsentProvider](./docs/frameworks/react/components/consent-provider.md): Mount ConsentProvider in a React app and configure its backend, scripts, storage, blocking and presentation options.
|
|
30
35
|
- [ConsentWidget](./docs/frameworks/react/components/consent-widget.md): Embed the c15t preference center inline with ConsentWidget on a React privacy page, with draft toggles that record a choice only on Save.
|
|
31
|
-
- [DevTools](./docs/frameworks/react/components/dev-tools.md):
|
|
32
|
-
- [
|
|
33
|
-
- [Policy
|
|
36
|
+
- [DevTools](./docs/frameworks/react/components/dev-tools.md): Inspect consent state, location, loaded scripts and consent events in a React app during development with the c15t DevTools panel.
|
|
37
|
+
- [Compose your own banner](./docs/frameworks/react/compose.md): Build a React consent banner from the ConsentBanner parts in c15t/react, with your own markup and buttons, while the policy still decides which actions appear.
|
|
38
|
+
- [Content Security Policy](./docs/frameworks/react/content-security-policy.md): Run c15t in a React app under a Content Security Policy, allow the consent backend and vendor hosts, and pass a nonce to ConsentProvider and ConsentTheme.
|
|
39
|
+
- [Customize](./docs/frameworks/react/customize.md): Change the colors, fonts, layout, button styles and copy of the c15t banner and dialog in a React app with the stylesheet, theme tokens, provider options and slots.
|
|
40
|
+
- [Embeds](./docs/frameworks/react/embeds.md): Keep YouTube videos, maps and other iframes out of a React page until their consent category is allowed, with ConsentGate or the iframe blocker in ConsentProvider.
|
|
41
|
+
- [IAB GPP](./docs/frameworks/react/gpp.md): Add the IAB Global Privacy Platform API (__gpp) to a React app with ConsentGPP from @c15t/react/gpp, so ad tech can read US state opt-outs and the TCF EU consent string.
|
|
34
42
|
- [Headless](./docs/frameworks/react/headless.md): Build a custom consent banner in React with the c15t/react/headless hooks inside your ConsentProvider.
|
|
35
|
-
- [Hooks](./docs/frameworks/react/hooks
|
|
36
|
-
- [IAB TCF](./docs/frameworks/react/iab
|
|
37
|
-
- [
|
|
38
|
-
- [Quickstart](./docs/frameworks/react/quickstart.md):
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
43
|
+
- [Hooks](./docs/frameworks/react/hooks.md): Gate features and save consent choices in React components with the focused hooks exported from c15t/react.
|
|
44
|
+
- [IAB TCF](./docs/frameworks/react/iab.md): Mount the IAB TCF banner and dialog inside a React ConsentProvider and configure the CMP ID, policy and vendor data.
|
|
45
|
+
- [Network blocker](./docs/frameworks/react/network-blocker.md): Hold fetch and XMLHttpRequest calls in a React app until their consent category is allowed, with networkBlocker rules in the ConsentProvider options.
|
|
46
|
+
- [Quickstart](./docs/frameworks/react/quickstart.md): Add a consent banner, preferences dialog and consent-gated scripts to a React single-page app built with Vite, using Inth as the consent backend.
|
|
47
|
+
- [Rendering and deployment](./docs/frameworks/react/rendering.md): How c15t resolves consent in client-rendered React apps, React Router framework mode, Remix and other server-rendered React apps without a c15t adapter.
|
|
48
|
+
- [Scripts](./docs/frameworks/react/scripts.md): Load vendor scripts by consent category in a React app with ConsentProvider, and clear stored data or reload the page when a visitor withdraws consent.
|
|
49
|
+
- [Translations](./docs/frameworks/react/translations.md): Where c15t banner and dialog copy comes from in a React app, how the browser picks the visitor's language, and how to override copy and switch languages with the provider's i18n option and hooks.
|
|
50
|
+
- [Troubleshooting](./docs/frameworks/react/troubleshooting.md): Fix a missing banner, early vendor requests, unstyled components and theme warnings in a React app that uses c15t/react.
|
|
51
|
+
- [Vendor consent](./docs/frameworks/react/vendor-consent.md): Let visitors allow a category such as marketing in a React app and still turn off one vendor in it, with the vendors option on ConsentProvider and useVendorAllowed.
|
|
52
|
+
|
|
53
|
+
## Concepts
|
|
54
|
+
|
|
55
|
+
- [Choose your setup](./docs/concepts/choose-your-setup.md): Pick the c15t setup for your framework, rendering mode and hosting, and decide who runs the consent backend.
|
|
56
|
+
- [Consent categories](./docs/concepts/consent-categories.md): Assign scripts, embeds and features to c15t consent categories, and understand which categories the preference dialog shows.
|
|
57
|
+
- [Consent state reference](./docs/concepts/consent-state.md): How c15t saves choices, gates IAB vendors, hydrates server records and keeps browser tabs and storage in step.
|
|
58
|
+
- [Data fetching](./docs/concepts/data-fetching.md): How c15t gets policy data through a cached manifest, backend /init, the browser or offline rules, and where consent choices are saved.
|
|
59
|
+
- [How consent works](./docs/concepts/how-consent-works.md): What c15t decides on each page load, the difference between a permission and a recorded choice, and what happens when a visitor saves.
|
|
60
|
+
- [Policies](./docs/concepts/policies.md): How policy models, prompts and scope decide what c15t asks visitors, where to change the rules, and why a banner may not appear.
|
|
42
61
|
|
|
43
62
|
## Guides
|
|
44
63
|
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
- [Share consent controls across frameworks](./docs/guides/shared-consent-controls.md): Use the same c15t script lifecycle, external consent source, and event controls in every framework.
|
|
49
|
-
- [Troubleshoot consent](./docs/guides/troubleshooting.md): Diagnose missing banners, early vendor requests, lost choices and hydration differences.
|
|
50
|
-
- [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
|
|
64
|
+
- [Banner experiments](./docs/guides/banner-experiments.md): Run A/B tests on consent banner presentation with any feature-flag provider or built-in weighted assignment, and attribute every impression and choice to its arm.
|
|
65
|
+
- [Troubleshooting](./docs/guides/troubleshooting.md): Fix a missing banner, analytics that load before consent, choices lost on reload, CORS errors, hydration differences and failed static builds in c15t v3.
|
|
66
|
+
- [Verify consent](./docs/guides/verify-consent.md): Check in a production build that vendor requests wait for consent, rejection survives a reload, preferences reopen and privacy signals apply.
|
|
51
67
|
|
|
52
68
|
## Customization
|
|
53
69
|
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
70
|
+
- [Class names and CSS-in-JS](./docs/customization/class-names.md): Style c15t's component parts with CSS Modules, vanilla-extract, StyleX, Emotion or plain class names, and see which approach works in each framework.
|
|
71
|
+
- [Dark mode](./docs/customization/dark-mode.md): Switch c15t's banner and dialog to dark colors with colorScheme, set your own dark tokens, follow your site's theme switch, and paint dark on the first frame in every framework.
|
|
72
|
+
- [Motion and animation](./docs/customization/motion.md): Change how fast c15t's banner and dialog animate with duration and easing tokens, turn animations off per surface with disableAnimation, and check reduced-motion behavior in each framework.
|
|
73
|
+
- [Customize the interface](./docs/customization/overview.md): Change c15t's consent banner and dialog one step at a time, from a prop to your own markup, and find where each step lives in your framework.
|
|
74
|
+
- [Banner designs](./docs/customization/recipes.md): Five consent banner designs built with c15t, from one prop to your own markup, with tested code for React, Vue, Svelte, Astro and plain HTML.
|
|
75
|
+
- [Component parts](./docs/customization/slots.md): Find every part of c15t's banner, dialog, widget, trigger and ConsentGate placeholder, its key in your framework's part API, and the data attributes to select on.
|
|
76
|
+
- [Stylesheets and CSS layers](./docs/customization/stylesheets.md): Load the right c15t stylesheet for your framework, see when the dialog's CSS loads, order c15t's cascade layer against your own, and run c15t without its styles.
|
|
77
|
+
- [Tailwind CSS](./docs/customization/tailwind.md): Load c15t's styles next to Tailwind CSS 4 or 3 in every framework, put utilities on c15t component parts, and use Tailwind's dark variant with c15t.
|
|
78
|
+
- [Theme tokens](./docs/customization/tokens.md): Change c15t's colors, type, radius, spacing, shadows and motion with theme tokens, and see every --c15t-* variable with its default.
|
|
58
79
|
- [Copy and translations](./docs/customization/translations.md): Change consent wording through i18n and test the complete prompt and preferences flow.
|
|
59
80
|
|
|
60
81
|
## Integrations
|
|
61
82
|
|
|
62
|
-
- [Adobe Analytics](./docs/integrations/adobe-analytics.md):
|
|
63
|
-
- [Ahrefs Analytics](./docs/integrations/ahrefs-analytics.md):
|
|
64
|
-
- [Amplitude](./docs/integrations/amplitude.md):
|
|
65
|
-
- [Custom integrations](./docs/integrations/building-integrations.md):
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [Cloudflare
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [Google
|
|
75
|
-
- [Google Tag](./docs/integrations/google-tag.md):
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
79
|
-
- [
|
|
80
|
-
- [
|
|
81
|
-
- [
|
|
82
|
-
- [
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [
|
|
86
|
-
- [Microsoft
|
|
87
|
-
- [
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [
|
|
92
|
-
- [
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
95
|
-
- [
|
|
96
|
-
- [
|
|
97
|
-
- [
|
|
98
|
-
- [
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
101
|
-
- [
|
|
102
|
-
- [
|
|
103
|
-
- [
|
|
104
|
-
- [
|
|
105
|
-
- [X Pixel](./docs/integrations/x-pixel.md): Configure X Pixel with c15t v3, understand marketing permission and verify loading and revocation.
|
|
83
|
+
- [Adobe Analytics](./docs/integrations/adobe-analytics.md): Load an Adobe Data Collection Tags property only after measurement consent with the c15t adobeAnalytics helper, and check its extensions in DevTools.
|
|
84
|
+
- [Ahrefs Analytics](./docs/integrations/ahrefs-analytics.md): Load Ahrefs Web Analytics only after measurement consent with the c15t ahrefsAnalytics helper, and check it in DevTools.
|
|
85
|
+
- [Amplitude](./docs/integrations/amplitude.md): Load the Amplitude Browser SDK 2 only after measurement consent with the c15t amplitude helper, which opts the SDK out on revocation and back in on a new grant.
|
|
86
|
+
- [Custom integrations](./docs/integrations/building-integrations.md): Gate a vendor that has no @c15t/integrations helper, or sync consent with an SDK your app already loads, using a c15t script configuration.
|
|
87
|
+
- [Clearbit](./docs/integrations/clearbit.md): Load the Clearbit enrichment tag only after marketing consent with the c15t clearbit helper, and check it in DevTools.
|
|
88
|
+
- [Cloudflare Web Analytics](./docs/integrations/cloudflare-web-analytics.md): Load the Cloudflare Web Analytics beacon only after measurement consent with the c15t cloudflareWebAnalytics helper, and check it in DevTools.
|
|
89
|
+
- [Cloudflare Zaraz](./docs/integrations/cloudflare-zaraz.md): Sync c15t permissions to Cloudflare Zaraz purposes with the c15t cloudflareZaraz bridge, which runs on every page without loading a script, and check the tools it controls.
|
|
90
|
+
- [Crisp](./docs/integrations/crisp.md): Load the Crisp chat widget only after functionality consent with the c15t crisp helper, pass its runtime settings and check it in DevTools.
|
|
91
|
+
- [Databuddy](./docs/integrations/databuddy.md): Load the Databuddy SDK on every page with the c15t databuddy helper, switch its disabled flag and config from measurement consent, and check both in DevTools.
|
|
92
|
+
- [Fathom Analytics](./docs/integrations/fathom-analytics.md): Load Fathom Analytics only after measurement consent with the c15t fathomAnalytics helper, set its SPA mode, and check it in DevTools.
|
|
93
|
+
- [Front Chat](./docs/integrations/front-chat.md): Load the Front Chat widget only after functionality consent with the c15t frontChat helper, forward CSP nonces, clear the session on revocation and check it in DevTools.
|
|
94
|
+
- [Google Maps](./docs/integrations/google-maps.md): Gate a Google Maps iframe embed with c15t v3 so the map loads only after the visitor allows its consent category, in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit, HTML or JavaScript.
|
|
95
|
+
- [Google Tag](./docs/integrations/google-tag.md): Load gtag.js for Google Analytics or Google Ads with c15t Consent Mode v2 signals, and verify the consent commands in DevTools.
|
|
96
|
+
- [Google Tag Manager](./docs/integrations/google-tag-manager.md): Load a Google Tag Manager container with c15t Consent Mode v2 signals, configure consent checks inside the container, and verify both in DevTools.
|
|
97
|
+
- [Heap](./docs/integrations/heap.md): Load the Heap config script and heap.js only after measurement consent with the c15t heap helper, and check it in DevTools.
|
|
98
|
+
- [Hightouch](./docs/integrations/hightouch.md): Load the Hightouch Events browser SDK only after measurement consent with the c15t hightouch helper, and check page events in DevTools.
|
|
99
|
+
- [Hotjar](./docs/integrations/hotjar.md): Load Hotjar only after measurement consent with the c15t hotjar helper, and check its loader and recordings in DevTools.
|
|
100
|
+
- [Intercom](./docs/integrations/intercom.md): Load the Intercom messenger only after functionality consent with the c15t intercom helper, set its region and check it in DevTools.
|
|
101
|
+
- [Klaviyo](./docs/integrations/klaviyo.md): Load Klaviyo signup forms and onsite tracking only after marketing and measurement consent with the c15t klaviyo helper, gate your own events, and check it in DevTools.
|
|
102
|
+
- [LinkedIn Insight Tag](./docs/integrations/linkedin-insights.md): Load the LinkedIn Insight Tag only after marketing consent with the c15t linkedinInsights helper, guard lintrk conversion calls, and check it in DevTools.
|
|
103
|
+
- [LogRocket](./docs/integrations/logrocket.md): Load LogRocket session replay only after measurement consent with the c15t logRocket helper, including proxied setups, and check it in DevTools.
|
|
104
|
+
- [Matomo Analytics](./docs/integrations/matomo-analytics.md): Load Matomo after measurement consent with the c15t matomoAnalytics helper, or use Matomo's own consent mode, and check each mode in DevTools.
|
|
105
|
+
- [Meta Pixel](./docs/integrations/meta-pixel.md): Load the Meta Pixel only after marketing consent with the c15t metaPixel helper, guard fbq event calls, and check it in DevTools.
|
|
106
|
+
- [Microsoft Clarity](./docs/integrations/microsoft-clarity.md): Load Microsoft Clarity only after measurement consent with the c15t clarity helper, send Consent V2 storage signals and check them in DevTools.
|
|
107
|
+
- [Microsoft UET](./docs/integrations/microsoft-uet.md): Load Microsoft Advertising UET on every page with the c15t microsoftUet helper, send ad_storage consent defaults and updates, and verify both in DevTools.
|
|
108
|
+
- [Mixpanel](./docs/integrations/mixpanel-analytics.md): Load the Mixpanel SDK on every page with the c15t mixpanelAnalytics helper, which switches Mixpanel tracking on and off with measurement consent, and check it in DevTools.
|
|
109
|
+
- [OneDollarStats](./docs/integrations/one-dollar-stats.md): Load the OneDollarStats tracker only after measurement consent with the c15t oneDollarStats helper, forward its data-attribute settings, and check it in DevTools.
|
|
110
|
+
- [OpenAI Pixel](./docs/integrations/openai-pixel.md): Load the ChatGPT Ads Measurement Pixel only after marketing consent with the c15t openaiPixel helper, guard oaiq conversion calls, and check it in DevTools.
|
|
111
|
+
- [Integrations](./docs/integrations/overview.md): Find all c15t integrations for analytics, tag managers, advertising, email and SMS, chat and embedded content.
|
|
112
|
+
- [Pinterest Tag](./docs/integrations/pinterest-tag.md): Load the Pinterest Tag only after marketing consent with the c15t pinterestTag helper, guard pintrk event calls, and check it in DevTools.
|
|
113
|
+
- [Pirsch](./docs/integrations/pirsch.md): Load Pirsch Analytics only after measurement consent with the c15t pirsch helper, keep custom event bindings working, and check it in DevTools.
|
|
114
|
+
- [Plausible Analytics](./docs/integrations/plausible-analytics.md): Load the Plausible Analytics tracker only after measurement consent with the c15t plausibleAnalytics helper, and check it in DevTools.
|
|
115
|
+
- [PostHog](./docs/integrations/posthog.md): Load PostHog before or after measurement consent with the c15t posthog helper, choose its cookieless behavior, turn off PostHog modules you do not use, and sync consent with an SDK you already initialize.
|
|
116
|
+
- [Promptwatch](./docs/integrations/promptwatch.md): Load the Promptwatch attribution client only after measurement consent with the c15t promptwatch helper, and check it in DevTools.
|
|
117
|
+
- [Reddit Pixel](./docs/integrations/reddit-pixel.md): Load the Reddit Pixel only after marketing consent with the c15t redditPixel helper, guard rdt conversion calls, and check it in DevTools.
|
|
118
|
+
- [RudderStack](./docs/integrations/rudderstack.md): Load the RudderStack JavaScript SDK after measurement consent with the c15t rudderstack helper, or map c15t categories to destination consent IDs, and check each mode.
|
|
119
|
+
- [Rybbit Analytics](./docs/integrations/rybbit-analytics.md): Load Rybbit Analytics only after measurement consent with the c15t rybbitAnalytics helper, map its tracking options to data attributes, and check it in DevTools.
|
|
120
|
+
- [Segment](./docs/integrations/segment.md): Load Segment Analytics.js only after measurement consent with the c15t segment helper, guard your own track and identify calls, and check it in DevTools.
|
|
121
|
+
- [Snapchat Pixel](./docs/integrations/snapchat-pixel.md): Load the Snapchat Pixel only after marketing consent with the c15t snapchatPixel helper, guard snaptr event calls, and check it in DevTools.
|
|
122
|
+
- [TikTok Pixel](./docs/integrations/tiktok-pixel.md): Load the TikTok Pixel only after marketing consent with the c15t tiktokPixel helper, guard ttq event calls, and check it in DevTools.
|
|
123
|
+
- [Umami Analytics](./docs/integrations/umami-analytics.md): Load the Umami Analytics tracker only after measurement consent with the c15t umamiAnalytics helper, point it at a self-hosted instance, and check it in DevTools.
|
|
124
|
+
- [Vercel Analytics](./docs/integrations/vercel-analytics.md): Load the Vercel Web Analytics script only after measurement consent with the c15t vercelAnalytics helper, choose the debug script, and check it in DevTools.
|
|
125
|
+
- [X Pixel](./docs/integrations/x-pixel.md): Load the X Pixel only after marketing consent with the c15t xPixel helper, guard twq conversion events, and check it in DevTools.
|
|
106
126
|
- [YouTube](./docs/integrations/youtube.md): Gate YouTube embeds with c15t v3 in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit or JavaScript.
|
|
107
127
|
|
|
108
128
|
## Reference
|
|
109
129
|
|
|
110
|
-
- [
|
|
130
|
+
- [Migrate to v3](./docs/upgrade-v3.md): Upgrade a c15t v2 app to v3. Covers packages, the Next.js and React providers, the JavaScript runtime, custom UI built on useConsentManager, callbacks, policies, stored consent and a self-hosted backend.
|
package/README.md
CHANGED
|
@@ -28,8 +28,8 @@ React cookie banner, consent manager, preference center, and headless CMP compon
|
|
|
28
28
|
- Headless hooks for custom consent flows
|
|
29
29
|
- Minimal configuration with TypeScript-first design
|
|
30
30
|
- Comprehensive Consent Management Platform (CMP)
|
|
31
|
-
- IAB TCF 2.
|
|
32
|
-
- Google Tag Manager, Google Consent Mode v2, Meta Pixel, and analytics integrations through @c15t/
|
|
31
|
+
- IAB TCF 2.4 UI and hooks through the @c15t/react/iab subpath
|
|
32
|
+
- Google Tag Manager, Google Consent Mode v2, Meta Pixel, and analytics integrations through @c15t/integrations
|
|
33
33
|
- Built-in internationalization support
|
|
34
34
|
- Seamless consent storage and tracking
|
|
35
35
|
|
|
@@ -73,32 +73,36 @@ Then add the prebuilt stylesheet to your app-level CSS entrypoint:
|
|
|
73
73
|
|
|
74
74
|
If you use the prebuilt IAB TCF UI, also import `@c15t/react/iab/styles.css`. It is published separately so non-IAB apps do not ship those component rules.
|
|
75
75
|
|
|
76
|
-
To manually install, follow the
|
|
76
|
+
To manually install, follow the [quickstart](https://c15t.com/docs/frameworks/react/quickstart).
|
|
77
77
|
|
|
78
78
|
## Usage
|
|
79
79
|
|
|
80
|
-
1.
|
|
81
|
-
2.
|
|
80
|
+
1. Wrap your app in `ConsentProvider` with the backend URL from your Inth project
|
|
81
|
+
2. Render `ConsentBanner`, `ConsentDialog` and `ConsentDialogLink` inside the provider, and mount it once for the life of the app
|
|
82
82
|
3. Customize styling and behavior to fit your app
|
|
83
83
|
4. For full implementation details, see the [React quickstart docs](https://c15t.com/docs/frameworks/react/quickstart)
|
|
84
84
|
|
|
85
85
|
```tsx
|
|
86
|
-
//
|
|
86
|
+
// src/consent.tsx
|
|
87
87
|
import {
|
|
88
|
-
ConsentManagerProvider,
|
|
89
88
|
ConsentBanner,
|
|
90
89
|
ConsentDialog,
|
|
90
|
+
ConsentDialogLink,
|
|
91
|
+
ConsentProvider,
|
|
92
|
+
hosted,
|
|
91
93
|
} from '@c15t/react'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
import type { ReactNode } from 'react'
|
|
95
|
+
|
|
96
|
+
const mode = hosted({ url: 'https://your-project.inth.app' })
|
|
97
|
+
|
|
98
|
+
export const Consent = ({ children }: { children: ReactNode }) => (
|
|
99
|
+
<ConsentProvider options={{ mode }}>
|
|
100
|
+
{children}
|
|
101
|
+
<ConsentBanner />
|
|
102
|
+
<ConsentDialog />
|
|
103
|
+
<ConsentDialogLink>Privacy settings</ConsentDialogLink>
|
|
104
|
+
</ConsentProvider>
|
|
105
|
+
)
|
|
102
106
|
```
|
|
103
107
|
|
|
104
108
|
## Documentation
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: c15t-react
|
|
3
|
+
description: Set up, customize or debug c15t consent management with @c15t/react. Use when the project is a React app, such as Vite or React Router, or when a task mentions a cookie banner, consent dialog, GDPR or CCPA prompts, blocking analytics until consent, Google Consent Mode or IAB TCF.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# c15t with @c15t/react
|
|
7
|
+
|
|
8
|
+
The Markdown under `./docs` matches the installed version. Read it before writing code: v3 renamed most v2 APIs, so remembered examples are usually wrong.
|
|
9
|
+
|
|
10
|
+
## Before writing code
|
|
11
|
+
|
|
12
|
+
1. Find the framework, router, rendering mode (server, static or single-page) and host in the project.
|
|
13
|
+
2. Pick the matching row in [Choose your setup](./docs/concepts/choose-your-setup.md).
|
|
14
|
+
3. Follow that guide from start to finish: [React](./docs/frameworks/react/quickstart.md).
|
|
15
|
+
|
|
16
|
+
## Rules
|
|
17
|
+
|
|
18
|
+
- Install with the `alpha` tag: `npm install c15t@alpha` and import `c15t/react`. npm `latest` is still v2. Keep every c15t package on the same release. New apps install `c15t` and import its framework subpath. An app that already depends on this scoped package can keep importing from it, but should not install both.
|
|
19
|
+
- The backend URL comes from the user's Inth project or self-hosted backend. It is public configuration. Never invent one; ask for it or read it from the environment.
|
|
20
|
+
- Register analytics, pixels and embeds through c15t and remove the vendor's own loader or plugin. With a bundler, use `@c15t/integrations` helpers and `ConsentGate`. On a plain HTML page, change the vendor's `<script>` to `type="text/plain"` with `data-c15t-category`. A banner does not block code loaded elsewhere.
|
|
21
|
+
- Gate features on the current permission. Never save a consent choice on page load or from code; only a visitor action records one.
|
|
22
|
+
- Offline mode keeps policies in code and choices in the browser, with no consent records. Not recommended for production environments.
|
|
23
|
+
- Keep one consent provider or root for the whole app, mounted outside route-level components.
|
|
24
|
+
|
|
25
|
+
## Customize with the smallest change
|
|
26
|
+
|
|
27
|
+
Copy and languages use i18n configuration. Position and layout use component props. Colors, type, radius and spacing use theme tokens. One part of a component uses slots. Different markup uses compound or headless components.
|
|
28
|
+
Start at [Customization overview](./docs/customization/overview.md).
|
|
29
|
+
|
|
30
|
+
## Finish with a check
|
|
31
|
+
|
|
32
|
+
A visible banner proves nothing. In a production build, confirm vendor requests are absent before consent, a rejection survives a reload, and preferences reopen. Follow [Verify consent before shipping](./docs/guides/verify-consent.md). If something fails, start with [Troubleshooting](./docs/guides/troubleshooting.md).
|
|
33
|
+
|
|
34
|
+
`./AGENTS.md` lists every bundled page.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{resolveConsentPresentation as
|
|
2
|
+
import{actionAppearanceFromTheme as e,resolveConsentPresentation as r}from"@c15t/core";import{useCallback as o,useContext as s,useEffect as t,useMemo as c}from"react";import{GlobalThemeContext as n}from"../context/theme-context.js";import{useConsentSaveAction as a}from"../draft-context.js";import{useActiveUI as i,useDismissNotice as p,usePolicyRule as l,useResolvedPresentation as m,useSetActiveUI as u}from"../hooks.js";import{useTheme as f}from"../hooks/use-theme.js";let d=function(d){let g=i(),h=l(),k=m(),b=s(n),j=c(()=>({preferences:{scrollLock:b.scrollLock,trapFocus:b.trapFocus,...k?.preferences},prompt:{scrollLock:b.scrollLock,trapFocus:b.trapFocus,...k?.prompt}}),[k,b.scrollLock,b.trapFocus]),{theme:v}=f(),F=c(()=>e(v),[v]),L=a(),_=p(),x=u(),A=c(()=>({...r({actionAppearance:F,override:d?.prompt,policy:h,presentation:j,surface:"prompt"}),isVisible:"banner"===g}),[h,j,d?.prompt,g,F]),C=c(()=>({...r({actionAppearance:F,override:d?.preferences,policy:h,presentation:j,surface:"preferences"}),isVisible:"dialog"===g}),[h,j,d?.preferences,g,F]);t(()=>{if(globalThis.process?.env?.NODE_ENV!=="production")for(let e of[...A.diagnostics,...C.diagnostics])console.warn(`c15t presentation: ${e.message}`,e.actions)},[A.diagnostics,C.diagnostics]);let V=o(()=>x("banner"),[x]),w=o(()=>x("dialog"),[x]),D=o(()=>x("none"),[x]),E=o(e=>{switch(e){case"accept":return L("all");case"reject":return L("none");case"save":return L();case"dismiss":return _();case"customize":return x("dialog");default:return}},[L,_,x]);return{activeUI:g,banner:A,closeUI:D,dialog:C,openBanner:V,openDialog:w,performAction:E,performBannerAction:E,performDialogAction:E,saveCustomPreferences:L}};export{d as useHeadlessConsentUI};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
2
|
+
import{saveIABConsentSurface as e}from"@c15t/core/surface-actions";import{resolveIABBannerSummary as o}from"@c15t/iab/headless";import{useCallback as t,useContext as s,useMemo as r}from"react";import{KernelContext as c}from"../context.js";import{useActiveUI as a,usePreferencesPresentation as n,usePromptPresentation as l,useSetActiveUI as i}from"../hooks.js";import{useIAB as m}from"../iab-context.js";let f=function(){let f=m(),d=s(c),p=a()??"none",u=l(),b=n(),v=i(),g=r(()=>o(f),[f]),j=t(()=>{f?.setPreferenceCenterTab("vendors"),v("dialog")},[f,v]),k=t(()=>v("none"),[v]),_=t(e=>{e?.tab&&f?.setPreferenceCenterTab(e.tab),v("dialog")},[f,v]),A=t(async o=>{f&&("accept"===o?f.acceptAll():"reject"===o&&f.rejectAll(),await (d?e(d,f.save):f.save()))},[f,d]),C=t(async e=>{"customize"===e?_():await A(e)},[_,A]),I=t(e=>A("customize"===e?void 0:e),[A]);return{activeUI:p,banner:{...g,scrollLock:u.scrollLock},closeUI:k,dialog:{isReady:!!(f?.gvl||f?.gvlReference),scrollLock:b.scrollLock},iab:f,openDialog:_,openVendorsDialog:j,performBannerAction:C,performDialogAction:I}};export{f as useHeadlessIABConsentUI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/consent-gate";import{forwardRef as o}from"react";import{useTranslations as n}from"../../component-hooks/use-translations.js";import{useUIConfig as a}from"../../ui-config-context.js";import{getSlotProps as s,mergeSlotProps as r}from"../../utils/merge-slot-props.js";import{Box as i}from"../shared/primitives/box.js";import{ConsentButton as l}from"../shared/primitives/button.js";let m=o(({children:o,...n},a)=>t(i,{ref:a,baseClassName:e.placeholder,"data-testid":"consent-gate-placeholder",slotKey:"consent-gate.root",...n,children:o})),c=o(({children:o,category:a,...s},r)=>{let{consentGate:l,consentTypes:m}=n(),c=a&&l?.title?l.title.replace("{category}",m?.[a]?.title??a):void 0;return t(i,{ref:r,baseClassName:e.title,"data-testid":"consent-gate-title",slotKey:"consent-gate.title",...s,children:o??c})}),p=o(({children:e,category:o,className:i,style:m,...c},p)=>{let{consentGate:d,consentTypes:g}=n(),{components:u}=a(),f=r(s(u,"consent-gate.button"),{className:i,style:m}),y=g?.[o]?.title??o,h=d?.actionButton?.replace("{category}",y);return t(l,{mode:"stroke",size:"small",variant:"primary",...f,...c,ref:p,action:"open-consent-dialog",category:o,"data-testid":"consent-gate-button",children:e??h})});m.displayName="ConsentGateRoot",c.displayName="ConsentGateTitle",p.displayName="ConsentGateButton";export{p as ConsentGateButton,m as ConsentGateRoot,c as ConsentGateTitle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{forwardRef as r,useEffect as t}from"react";import{useTranslations as s}from"../../component-hooks/use-translations.js";import{usePolicyCategories as i,usePolicyScopeMode as l,useRegisterConsentCategories as n}from"../../hooks.js";import{useIsHydrated as c}from"../../hooks/use-is-hydrated.js";import{useCategoryAllowed as a}from"../../kernel-selector.js";import{ConsentGateButton as m,ConsentGateRoot as d,ConsentGateTitle as p}from"./atoms.js";let y=({category:r,policyBlocked:t,policyBlockedMessage:s})=>o(d,{children:[e(p,{category:r,children:t?s??"This content is unavailable under your region's consent policy.":void 0}),t?null:e(m,{category:r})]}),u=r(({children:o,category:r,placeholder:m,noStyle:d,className:p,theme:u,...h},f)=>{let k=a(r),j=c(),g=i(),v=l(),B=n(),{
|
|
2
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{forwardRef as r,useEffect as t}from"react";import{useTranslations as s}from"../../component-hooks/use-translations.js";import{usePolicyCategories as i,usePolicyScopeMode as l,useRegisterConsentCategories as n}from"../../hooks.js";import{useIsHydrated as c}from"../../hooks/use-is-hydrated.js";import{useCategoryAllowed as a}from"../../kernel-selector.js";import{ConsentGateButton as m,ConsentGateRoot as d,ConsentGateTitle as p}from"./atoms.js";let y=({category:r,policyBlocked:t,policyBlockedMessage:s})=>o(d,{children:[e(p,{category:r,children:t?s??"This content is unavailable under your region's consent policy.":void 0}),t?null:e(m,{category:r})]}),u=r(({children:o,category:r,placeholder:m,noStyle:d,className:p,theme:u,...h},f)=>{let k=a(r),j=c(),g=i(),v=l(),B=n(),{consentGate:x}=s(),C="necessary"!==r&&!g.includes("*")&&!g.includes(r);return t(()=>{B([r])},[r,B]),e("div",{ref:f,className:p,...h,children:k?j?o:null:m||e(y,{category:r,policyBlocked:"strict"===v&&C,policyBlockedMessage:x?.policyBlocked})})});u.displayName="ConsentGate";let h=u;export{h as ConsentGate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/iab-consent-dialog";import{forwardRef as r,useCallback as
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/iab-consent-dialog";import{forwardRef as r,useCallback as i,useEffect as o,useRef as a,useState as n}from"react";import{useFocusTrap as s}from"../../../hooks/use-focus-trap.js";import{useTheme as l}from"../../../hooks/use-theme.js";import{useUIConfig as m}from"../../../ui-config-context.js";import{cnExt as c}from"../../../utils/cn.js";import{mergeSlotProps as d}from"../../../utils/merge-slot-props.js";import{useIABTranslations as u}from"../use-iab-translations.js";let p=r(({children:r,className:p,"data-testid":f,...b},g)=>{let{trapFocus:j}=l(),{components:C}=m(),h=a(null),x=i(t=>{if(h.current=t,"function"==typeof g)return g(t);g&&(g.current=t)},[g]),y=u(),[A,F]=n(!1);return s(!!j,h,{initialFocus:"first-tabbable"}),o(()=>{let t=requestAnimationFrame(()=>F(!0));return()=>cancelAnimationFrame(t)},[]),t("div",{ref:x,"aria-describedby":"iab-consent-dialog-description",...d(C?.["iab-dialog"]?.card,{baseClassName:c(e.card,A?e.contentVisible:e.contentHidden),className:p,"data-testid":f??"iab-consent-dialog-card",...b}),"aria-label":y.preferenceCenter.title,"aria-modal":j?"true":void 0,role:"dialog",tabIndex:-1,children:r})});p.displayName="IABConsentDialogCard";export{p as IABConsentDialogCard};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{iabDisplayTestId as t}from"@c15t/iab/headless";import o from"@c15t/ui/styles/components/iab-consent-dialog";import{useState as n}from"react";import{useTheme as i}from"../../../hooks/use-theme.js";import{useUIConfig as s}from"../../../ui-config-context.js";import{mergeSlotProps as l}from"../../../utils/merge-slot-props.js";import{useIABTranslations as a}from"../use-iab-translations.js";import*as p from"../../shared/ui/preference-item/index.js";let d=({feature:d,testId:m})=>{let{components:c}=s(),{noStyle:h}=i(),[u,g]=n(!1),[f,v]=n(!1),[y,C]=n(!1),S=a(),N=l(c?.["iab-purpose-item"]?.header,{baseClassName:o.purposeHeader,noStyle:h}),x=l(c?.["iab-purpose-item"]?.examples,{noStyle:h}),b=l(c?.["iab-purpose-item"]?.vendors,{noStyle:h});return r(p.Root,{className:h?void 0:o.purposeItem,"data-testid":m??t("feature",d.id),noStyle:!0,onOpenChange:g,open:u,slotKey:"iab-purpose-item.root",children:[e("div",{...N,children:r(p.Trigger,{className:h?void 0:o.purposeTrigger,noStyle:!0,slotKey:"iab-purpose-item.trigger",children:[e(p.Leading,{noStyle:!0,children:e("svg",{"aria-hidden":"true",className:o.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u?e("path",{d:"M19 9l-7 7-7-7"}):e("path",{d:"M9 5l7 7-7 7"})})}),r(p.Header,{className:o.purposeInfo,noStyle:!0,children:[e(p.Title,{className:o.purposeName,noStyle:!0,children:d.name}),e(p.Meta,{className:o.purposeMeta,noStyle:!0,children:S.preferenceCenter.purposeItem.partners.replace("{count}",String(d.vendors.length))})]})]})}),r(p.Content,{innerClassName:h?void 0:o.purposeContent,innerSlotKey:"iab-purpose-item.content",noStyle:h,children:[e("p",{className:o.purposeDescription,children:d.description}),d.illustrations.length>0&&e("div",{...x,children:r(p.Root,{noStyle:!0,onOpenChange:v,open:f,children:[r(p.Trigger,{className:o.examplesToggle,noStyle:!0,children:[e("svg",{"aria-hidden":"true",style:{height:"0.75rem",width:"0.75rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:f?e("path",{d:"M19 9l-7 7-7-7"}):e("path",{d:"M9 5l7 7-7 7"})}),S.preferenceCenter.purposeItem.examples," (",d.illustrations.length,")"]}),e(p.Content,{noStyle:h,children:e("ul",{className:o.examplesList,children:d.illustrations.map((r,t)=>e("li",{children:r},t))})})]})}),d.vendors.length>0&&e("div",{...b,children:r(p.Root,{noStyle:!0,onOpenChange:C,open:y,children:[r(p.Trigger,{className:o.vendorsToggle,noStyle:!0,children:[e("svg",{"aria-hidden":"true",style:{height:"0.75rem",width:"0.75rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:y?e("path",{d:"M19 9l-7 7-7-7"}):e("path",{d:"M9 5l7 7-7 7"})}),S.preferenceCenter.vendorList.iabVendorsHeading," (",d.vendors.length,")"]}),e(p.Content,{noStyle:h,children:e("ul",{className:o.examplesList,children:d.vendors.map(r=>e("li",{children:r.name},r.id))})})]})})]})]})};export{d as FeatureItem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as e,jsx as
|
|
2
|
+
import{Fragment as e,jsx as o,jsxs as t}from"react/jsx-runtime";import r from"@c15t/ui/styles/components/iab-consent-dialog";import{forwardRef as i}from"react";import{useTranslations as n}from"../../../component-hooks/use-translations.js";import{useSetActiveUI as s}from"../../../hooks.js";import{useUIConfig as a}from"../../../ui-config-context.js";import{mergeSlotProps as l}from"../../../utils/merge-slot-props.js";import{useIABTranslations as c}from"../use-iab-translations.js";let m=i(({children:i,headerTitle:m,description:d,showCloseButton:p=!0,className:h},f)=>{let u=s(),{components:g}=a(),b=c(),{common:x}=n();return o("div",{ref:f,...l(g?.["iab-dialog"]?.header,{baseClassName:r.header,className:h}),children:i||t(e,{children:[t("div",{className:r.headerContent,children:[o("h2",{className:r.title,children:m??b.preferenceCenter.title}),o("p",{className:r.description,id:"iab-consent-dialog-description",children:d??b.preferenceCenter.description})]}),p&&o("button",{type:"button",onClick:()=>{u("none")},className:r.closeButton,"aria-label":x.close,"data-testid":"iab-consent-dialog-close",children:t("svg",{style:{height:"1rem",width:"1rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})});m.displayName="IABConsentDialogHeader";export{m as IABConsentDialogHeader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as e,jsx as t,jsxs as o}from"react/jsx-runtime";import{applyPublisherRestrictionsToGVL as n}from"@c15t/iab/headless";import{isDialogDismissKey as r}from"@c15t/ui/primitives/dialog";import i from"@c15t/ui/styles/components/consent-actions";import a from"@c15t/ui/styles/components/iab-consent-dialog";import{useCallback as s,useEffect as l,useLayoutEffect as d,useMemo as c,useRef as m,useState as p}from"react";import{createPortal as u}from"react-dom";import{useHeadlessIABConsentUI as g}from"../../component-hooks/use-headless-iab-consent-ui.js";import{useTranslations as h}from"../../component-hooks/use-translations.js";import{ConsentDialogTrigger as b}from"../panel-trigger/index.js";import{Branding as y}from"../panel/atoms/card.js";import{ConsentTrackingContext as v}from"../../context/consent-tracking-context.js";import{LocalThemeContext as f}from"../../context/theme-context.js";import{useComponentConfig as C}from"../../hooks/use-component-config.js";import{useFocusTrap as S}from"../../hooks/use-focus-trap.js";import{useIABConsentManager as k}from"../../hooks/use-iab-manager.js";import{useScrollLock as I}from"../../hooks/use-scroll-lock.js";import{useTextDirection as N}from"../../hooks/use-text-direction.js";import{useUIConfig as x}from"../../ui-config-context.js";import{mergeSlotProps as L}from"../../utils/merge-slot-props.js";import{IABConsentDialogOverlay as j}from"./atoms/overlay.js";import{PurposeItem as T}from"./atoms/purpose-item.js";import{StackItem as A}from"./atoms/stack-item.js";import{VendorList as V}from"./atoms/vendor-list.js";import{useIABDisplayModel as F}from"./hooks/use-display-model.js";import{useIABTranslations as w}from"./use-iab-translations.js";import*as P from"../shared/ui/button/index.js";import*as B from"../shared/ui/tabs/index.js";let R=["iab"],$={tabIndex:-1},M=({open:M,noStyle:q,disableAnimation:z,scrollLock:E,trapFocus:H,hideBranding:W,initialTab:D,showTrigger:G=!1,models:O=R,uiSource:_})=>{let J=w(),{common:K}=h(),{components:Q}=x(),{iab:U,activeUI:X,policyDialog:Y,translationConfig:Z,model:ee}=k({preferences:{scrollLock:E,trapFocus:H}}),{banner:et,closeUI:eo,openDialog:en,performDialogAction:er}=g(),ei=Y.blocking,ea=N(Z.defaultLanguage),es=m(null),el=m(null),ed=m(null),[ec,em]=p(D??U?.preferenceCenterTab??"purposes"),[ep,eu]=p(null),[eg,eh]=p(!1),[eb,ey]=p(!1),[ev,ef]=p(!1),eC=null!==ee&&O.includes(ee)&&(M??"dialog"===X),eS=C({disableAnimation:z,noStyle:q,scrollLock:ei,trapFocus:Y.blocking}),{consentRows:ek,essentialRows:eI,essentialPartnerCount:eN,purposeTabCount:ex,vendorTabCount:eL,data:{purposes:ej}}=F(),eT=U?.gvl??null,eA=U?.publisherRestrictions,eV=c(()=>eT?n(eT,eA):null,[eT,eA]),eF=s((e,t)=>{U?.setPurposeConsent(e,t)},[U]),ew=s((e,t)=>{U?.setSpecialFeatureOptIn(e,t)},[U]),eP=s((e,t)=>{U?.setVendorConsent(e,t)},[U]),eB=s((e,t)=>{U?.setVendorLegitimateInterest(e,t)},[U]),eR=s((e,t)=>{U?.setPurposeLegitimateInterest(e,t)},[U]),e$=async()=>{try{await er("accept")}catch{}},eM=async()=>{try{await er("reject")}catch{}},eq=async()=>{try{await er("customize")}catch{}},ez=s(()=>{eo()},[eo]),eE=e=>{eu(e),em("vendors"),en({tab:"vendors"})};S(!!(eb&&eC&&eS.trapFocus),es),I(!!(eC&&eS.scrollLock)),l(()=>{if(!eC)return;let e=e=>{r(e.key)&&(e.preventDefault(),ez())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ez,eC]),l(()=>{let e=requestAnimationFrame(()=>ey(!0));return()=>cancelAnimationFrame(e)},[]),l(()=>{if(eC){let e=requestAnimationFrame(()=>ef(!0));return()=>cancelAnimationFrame(e)}if(eS.disableAnimation){let e=requestAnimationFrame(()=>ef(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{ef(!1)},150);return()=>clearTimeout(e)},[eC,eS.disableAnimation]);let eH=m(!!D);l(()=>{let e=U?.preferenceCenterTab;if(!(eC&&e))return;if(eH.current){eH.current=!1;return}let t=requestAnimationFrame(()=>{em(e)});return()=>cancelAnimationFrame(t)},[eC,U?.preferenceCenterTab]),d(()=>{let e,t;if("purposes"!==ec&&"vendors"!==ec)return;let o=el.current;if(!o||null===ed.current)return;let n=ed.current;if(ed.current=null,!window.matchMedia("(prefers-reduced-motion: reduce)").matches)return o.style.height=`${n}px`,o.style.overflow="hidden",o.style.transition="none",e=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{if(!o)return;o.style.height="auto";let e=o.getBoundingClientRect().height;if(o.style.height=`${n}px`,1>Math.abs(n-e)){o.style.height="",o.style.overflow="",o.style.transition="";return}o.getBoundingClientRect(),o.style.transition="height 180ms cubic-bezier(0.33, 1, 0.68, 1)",o.style.height=`${e}px`,o.addEventListener("transitionend",e=>{"height"===e.propertyName&&(o.style.height="",o.style.overflow="",o.style.transition="")},{once:!0})})}),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t)}},[ec]);let eW=s(e=>{el.current&&(ed.current=el.current.offsetHeight),em(e),en({tab:e})},[en]),eD=c(()=>({uiSource:_??"iab_dialog"}),[_]);if(!eb||!U?.config.enabled)return null;let eG=U.isLoadingGVL||!U.gvl,eO=L(Q?.["iab-dialog"]?.root,{baseClassName:`${a.root} ${ev?a.dialogVisible:a.dialogHidden}`,noStyle:eS.noStyle}),e_=L(Q?.["iab-dialog"]?.card,{baseClassName:`${a.card} ${ev?a.contentVisible:a.contentHidden}`,noStyle:eS.noStyle}),eJ=L(Q?.["iab-dialog"]?.header,{baseClassName:a.header,noStyle:eS.noStyle}),eK=L(Q?.["iab-dialog"]?.headerContent,{baseClassName:a.headerContent,noStyle:eS.noStyle}),eQ=L(Q?.["iab-dialog"]?.title,{baseClassName:a.title,noStyle:eS.noStyle}),eU=L(Q?.["iab-dialog"]?.description,{baseClassName:a.description,noStyle:eS.noStyle}),eX=L(Q?.["iab-dialog"]?.closeButton,{baseClassName:a.closeButton,noStyle:eS.noStyle}),eY=L(Q?.["iab-dialog"]?.body,{baseClassName:a.body,noStyle:eS.noStyle}),eZ=L(Q?.["iab-dialog"]?.tabs,{baseClassName:a.tabsContainer,noStyle:eS.noStyle}),e1=L(Q?.["iab-dialog"]?.tabsList,{baseClassName:a.tabsList,noStyle:eS.noStyle}),e0=L(Q?.["iab-dialog"]?.tabTrigger,{baseClassName:a.tabButton,noStyle:eS.noStyle}),e2=L(Q?.["iab-dialog"]?.tabIndicator,{baseClassName:a.tabIndicator,noStyle:eS.noStyle}),e7=L(Q?.["iab-dialog"]?.content,{baseClassName:a.content,noStyle:eS.noStyle}),e4=L(Q?.["iab-dialog"]?.loading,{baseClassName:a.loadingContainer,noStyle:eS.noStyle}),e5=L(Q?.["iab-dialog"]?.tabPanel,{baseClassName:a.tabPanel,noStyle:eS.noStyle}),e8=L(Q?.["iab-dialog"]?.specialPurposes,{baseClassName:a.specialPurposesSection,noStyle:eS.noStyle}),e6=L(Q?.["iab-dialog"]?.consentNotice,{baseClassName:a.consentNotice,noStyle:eS.noStyle}),e3=L(Q?.["iab-dialog"]?.actions,{baseClassName:i.actionRoot,noStyle:eS.noStyle}),e9=L(Q?.["iab-dialog"]?.footer,{baseClassName:a.footer,noStyle:eS.noStyle,...e3}),te=L(Q?.["iab-dialog"]?.actionGroup,{baseClassName:i.actionGroup,"data-direction":"row",noStyle:eS.noStyle}),tt=t(v.Provider,{value:eD,children:o(f.Provider,{value:eS,children:[t(j,{isOpen:eC}),t("div",{...eO,"data-testid":"iab-consent-dialog-root",dir:ea,children:o("div",{...e_,ref:es,"aria-label":J.preferenceCenter.title,"aria-modal":eS.trapFocus?"true":void 0,role:"dialog",...$,"data-testid":"iab-consent-dialog-card",children:[o("div",{...eJ,children:[o("div",{...eK,children:[t("h2",{...eQ,children:J.preferenceCenter.title}),t("p",{...eU,children:J.preferenceCenter.description})]}),t("button",{...eX,type:"button","data-testid":"iab-consent-dialog-close",onClick:ez,"aria-label":K.close,children:o("svg",{"aria-hidden":"true",style:{height:"1rem",width:"1rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o(B.Root,{...eY,noStyle:!0,onValueChange:e=>eW(e),value:ec,children:[t("div",{...eZ,children:o(B.List,{...e1,noStyle:!0,children:[o(B.Trigger,{...e0,noStyle:!0,value:"purposes",children:[J.preferenceCenter.tabs.purposes,!eG&&` (${ex})`]}),o(B.Trigger,{...e0,noStyle:!0,value:"vendors",children:[J.preferenceCenter.tabs.vendors,!eG&&` (${eL})`]}),t("div",{...e2,"aria-hidden":"true","data-active-tab":ec})]})}),t("div",{...e7,ref:el,children:eG?o("div",{...e4,children:[t("div",{className:a.loadingSpinner}),t("p",{className:a.loadingText,children:J.common.loading})]}):o(e,{children:[o(B.Content,{...e5,forceMount:!0,noStyle:!0,value:"purposes",children:[ek.map(e=>"stack"===e.kind?t(A,{stack:e,consents:U.purposeConsents,onToggle:eF,vendorConsents:U.vendorConsents,onVendorToggle:eP,onVendorClick:eE,vendorLegitimateInterests:U.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eB,purposeLegitimateInterests:U.purposeLegitimateInterests,onPurposeLegitimateInterestToggle:eR},e.testId):t(T,{purpose:e,testId:e.testId,isEnabled:"special-feature"===e.toggle?U.specialFeatureOptIns[e.id]??!1:U.purposeConsents[e.id]??!1,onToggle:t=>{"special-feature"===e.toggle?ew(e.id,t):eF(e.id,t)},vendorConsents:U.vendorConsents,onVendorToggle:eP,onVendorClick:eE,vendorLegitimateInterests:U.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eB,purposeLegitimateInterests:"purpose"===e.kind?U.purposeLegitimateInterests:void 0,onPurposeLegitimateInterestToggle:"purpose"===e.kind?eR:void 0},e.testId)),eI.length>0&&o("div",{...e8,children:[o("div",{className:a.specialPurposesHeader,children:[o("button",{type:"button","aria-expanded":eg,onClick:()=>eh(!eg),className:a.purposeTrigger,children:[t("svg",{"aria-hidden":"true",className:a.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:eg?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})}),o("div",{className:a.purposeInfo,children:[o("h3",{className:a.specialPurposesTitle,children:[J.preferenceCenter.specialPurposes.title,o("svg",{"aria-hidden":"true",className:a.lockIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),o("p",{className:a.purposeMeta,children:[eN," ",1===eN?J.preferenceCenter.vendorList.partnerSingular:J.preferenceCenter.vendorList.partnerPlural]})]})]}),t("div",{style:{position:"relative"},children:o("svg",{className:a.infoIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":J.preferenceCenter.specialPurposes.tooltip,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),t("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})})]}),eg&&t("div",{style:{padding:"0.75rem"},children:eI.map(e=>t(T,{purpose:e,testId:e.testId,isEnabled:!0,onToggle:()=>{},vendorConsents:U.vendorConsents,onVendorToggle:eP,onVendorClick:eE,isLocked:!0},e.testId))})]}),t("div",{...e6,children:t("p",{className:a.consentNoticeText,children:J.preferenceCenter.footer.consentStorage})})]}),t(B.Content,{...e5,forceMount:!0,noStyle:!0,value:"vendors",children:t(V,{vendorData:eV,purposes:ej,vendorConsents:U.vendorConsents,onVendorToggle:eP,selectedVendorId:ep,onClearSelection:()=>eu(null),customVendors:U.nonIABVendors,vendorLegitimateInterests:U.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eB})})]})})]}),o("div",{...e9,children:[o("div",{...te,children:[t(P.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eM,disabled:!et.isReady,"data-action":"reject",children:J.common.rejectAll}),t(P.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:e$,disabled:!et.isReady,"data-action":"accept",children:J.common.acceptAll})]}),t("div",{...te,children:t(P.Root,{variant:"primary",mode:"filled",size:"small",onClick:eq,disabled:eG,"data-action":"customize",children:J.common.saveSettings})})]}),t(y,{hideBranding:W??!1,variant:"dialog-tag",slotContext:"iab-dialog","data-testid":"iab-consent-dialog-branding"})]})})]})}),to=!0===G?{}:!1===G?null:G,tn=to?t(b,{...to}):null;return eC||ev?o(e,{children:[tn,u(tt,document.body)]}):tn};export{M as IABConsentDialog};
|
|
2
|
+
import{Fragment as e,jsx as t,jsxs as o}from"react/jsx-runtime";import{applyPublisherRestrictionsToGVL as n}from"@c15t/iab/headless";import{isDialogDismissKey as i}from"@c15t/ui/primitives/dialog";import r from"@c15t/ui/styles/components/consent-actions";import a from"@c15t/ui/styles/components/iab-consent-dialog";import{useCallback as s,useEffect as l,useLayoutEffect as d,useMemo as c,useRef as m,useState as u}from"react";import{createPortal as p}from"react-dom";import{useHeadlessIABConsentUI as g}from"../../component-hooks/use-headless-iab-consent-ui.js";import{useTranslations as h}from"../../component-hooks/use-translations.js";import{ConsentDialogTrigger as b}from"../panel-trigger/index.js";import{Branding as y}from"../panel/atoms/card.js";import{ConsentTrackingContext as f}from"../../context/consent-tracking-context.js";import{LocalThemeContext as v}from"../../context/theme-context.js";import{useComponentConfig as C}from"../../hooks/use-component-config.js";import{useFocusTrap as S}from"../../hooks/use-focus-trap.js";import{useIABConsentManager as k}from"../../hooks/use-iab-manager.js";import{useScrollLock as N}from"../../hooks/use-scroll-lock.js";import{useTextDirection as I}from"../../hooks/use-text-direction.js";import{useUIConfig as x}from"../../ui-config-context.js";import{mergeSlotProps as L}from"../../utils/merge-slot-props.js";import{FeatureItem as j}from"./atoms/feature-item.js";import{IABConsentDialogOverlay as T}from"./atoms/overlay.js";import{PurposeItem as A}from"./atoms/purpose-item.js";import{StackItem as F}from"./atoms/stack-item.js";import{VendorList as V}from"./atoms/vendor-list.js";import{useIABDisplayModel as w}from"./hooks/use-display-model.js";import{useIABTranslations as P}from"./use-iab-translations.js";import*as B from"../shared/ui/button/index.js";import*as R from"../shared/ui/tabs/index.js";let $=["iab"],M={tabIndex:-1},q=({open:q,noStyle:z,disableAnimation:E,scrollLock:H,trapFocus:D,hideBranding:W,initialTab:G,showTrigger:O=!1,models:_=$,uiSource:J})=>{let K=P(),{common:Q}=h(),{components:U}=x(),{iab:X,activeUI:Y,policyDialog:Z,translationConfig:ee,model:et}=k({preferences:{scrollLock:H,trapFocus:D}}),{banner:eo,closeUI:en,openDialog:ei,performDialogAction:er}=g(),ea=Z.blocking,es=I(ee.defaultLanguage),el=m(null),ed=m(null),ec=m(null),[em,eu]=u(G??X?.preferenceCenterTab??"purposes"),[ep,eg]=u(null),[eh,eb]=u(!1),[ey,ef]=u(!1),[ev,eC]=u(!1),eS=null!==et&&_.includes(et)&&(q??"dialog"===Y),ek=C({disableAnimation:E,noStyle:z,scrollLock:ea,trapFocus:Z.blocking}),{consentRows:eN,essentialRows:eI,essentialPartnerCount:ex,featureRows:eL,featuresStandardText:ej,purposeTabCount:eT,vendorTabCount:eA,data:{purposes:eF}}=w(),eV=X?.gvl??null,ew=X?.publisherRestrictions,eP=c(()=>eV?n(eV,ew):null,[eV,ew]),eB=s((e,t)=>{X?.setPurposeConsent(e,t)},[X]),eR=s((e,t)=>{X?.setSpecialFeatureOptIn(e,t)},[X]),e$=s((e,t)=>{X?.setVendorConsent(e,t)},[X]),eM=s((e,t)=>{X?.setVendorLegitimateInterest(e,t)},[X]),eq=s((e,t)=>{X?.setPurposeLegitimateInterest(e,t)},[X]),ez=async()=>{try{await er("accept")}catch{}},eE=async()=>{try{await er("reject")}catch{}},eH=async()=>{try{await er("customize")}catch{}},eD=s(()=>{en()},[en]),eW=e=>{eg(e),eu("vendors"),ei({tab:"vendors"})};S(!!(ey&&eS&&ek.trapFocus),el,{initialFocus:"first-tabbable"}),N(!!(eS&&ek.scrollLock)),l(()=>{if(!eS)return;let e=e=>{i(e.key)&&(e.preventDefault(),eD())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[eD,eS]),l(()=>{let e=requestAnimationFrame(()=>ef(!0));return()=>cancelAnimationFrame(e)},[]),l(()=>{if(eS){let e=requestAnimationFrame(()=>eC(!0));return()=>cancelAnimationFrame(e)}if(ek.disableAnimation){let e=requestAnimationFrame(()=>eC(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{eC(!1)},150);return()=>clearTimeout(e)},[eS,ek.disableAnimation]);let eG=m(!!G);l(()=>{let e=X?.preferenceCenterTab;if(!(eS&&e))return;if(eG.current){eG.current=!1;return}let t=requestAnimationFrame(()=>{eu(e)});return()=>cancelAnimationFrame(t)},[eS,X?.preferenceCenterTab]),d(()=>{let e,t;if("purposes"!==em&&"vendors"!==em)return;let o=ed.current;if(!o||null===ec.current)return;let n=ec.current;if(ec.current=null,!window.matchMedia("(prefers-reduced-motion: reduce)").matches)return o.style.height=`${n}px`,o.style.overflow="hidden",o.style.transition="none",e=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{if(!o)return;o.style.height="auto";let e=o.getBoundingClientRect().height;if(o.style.height=`${n}px`,1>Math.abs(n-e)){o.style.height="",o.style.overflow="",o.style.transition="";return}o.getBoundingClientRect(),o.style.transition="height 180ms cubic-bezier(0.33, 1, 0.68, 1)",o.style.height=`${e}px`,o.addEventListener("transitionend",e=>{"height"===e.propertyName&&(o.style.height="",o.style.overflow="",o.style.transition="")},{once:!0})})}),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t)}},[em]);let eO=s(e=>{ed.current&&(ec.current=ed.current.offsetHeight),eu(e),ei({tab:e})},[ei]),e_=c(()=>({uiSource:J??"iab_dialog"}),[J]);if(!ey||!X?.config.enabled)return null;let eJ=X.isLoadingGVL||!X.gvl,eK=L(U?.["iab-dialog"]?.root,{baseClassName:`${a.root} ${ev?a.dialogVisible:a.dialogHidden}`,noStyle:ek.noStyle}),eQ=L(U?.["iab-dialog"]?.card,{baseClassName:`${a.card} ${ev?a.contentVisible:a.contentHidden}`,noStyle:ek.noStyle}),eU=L(U?.["iab-dialog"]?.header,{baseClassName:a.header,noStyle:ek.noStyle}),eX=L(U?.["iab-dialog"]?.headerContent,{baseClassName:a.headerContent,noStyle:ek.noStyle}),eY=L(U?.["iab-dialog"]?.title,{baseClassName:a.title,noStyle:ek.noStyle}),eZ=L(U?.["iab-dialog"]?.description,{baseClassName:a.description,noStyle:ek.noStyle}),e1=L(U?.["iab-dialog"]?.closeButton,{baseClassName:a.closeButton,noStyle:ek.noStyle}),e0=L(U?.["iab-dialog"]?.body,{baseClassName:a.body,noStyle:ek.noStyle}),e2=L(U?.["iab-dialog"]?.tabs,{baseClassName:a.tabsContainer,noStyle:ek.noStyle}),e7=L(U?.["iab-dialog"]?.tabsList,{baseClassName:a.tabsList,noStyle:ek.noStyle}),e4=L(U?.["iab-dialog"]?.tabTrigger,{baseClassName:a.tabButton,noStyle:ek.noStyle}),e5=L(U?.["iab-dialog"]?.tabIndicator,{baseClassName:a.tabIndicator,noStyle:ek.noStyle}),e8=L(U?.["iab-dialog"]?.content,{baseClassName:a.content,noStyle:ek.noStyle}),e6=L(U?.["iab-dialog"]?.loading,{baseClassName:a.loadingContainer,noStyle:ek.noStyle}),e3=L(U?.["iab-dialog"]?.tabPanel,{baseClassName:a.tabPanel,noStyle:ek.noStyle}),e9=L(U?.["iab-dialog"]?.specialPurposes,{baseClassName:a.specialPurposesSection,noStyle:ek.noStyle}),te=L(U?.["iab-dialog"]?.consentNotice,{baseClassName:a.consentNotice,noStyle:ek.noStyle}),tt=L(U?.["iab-dialog"]?.actions,{baseClassName:r.actionRoot,noStyle:ek.noStyle}),to=L(U?.["iab-dialog"]?.footer,{baseClassName:a.footer,noStyle:ek.noStyle,...tt}),tn=L(U?.["iab-dialog"]?.actionGroup,{baseClassName:r.actionGroup,"data-direction":"row",noStyle:ek.noStyle}),ti=t(f.Provider,{value:e_,children:o(v.Provider,{value:ek,children:[t(T,{isOpen:eS}),t("div",{...eK,"data-testid":"iab-consent-dialog-root",dir:es,children:o("div",{"aria-describedby":"iab-consent-dialog-description",...eQ,ref:el,"aria-label":K.preferenceCenter.title,"aria-modal":ek.trapFocus?"true":void 0,role:"dialog",...M,"data-testid":"iab-consent-dialog-card",children:[o("div",{...eU,children:[o("div",{...eX,children:[t("h2",{...eY,children:K.preferenceCenter.title}),t("p",{...eZ,id:"iab-consent-dialog-description",children:K.preferenceCenter.description})]}),t("button",{...e1,type:"button","data-testid":"iab-consent-dialog-close",onClick:eD,"aria-label":Q.close,children:o("svg",{"aria-hidden":"true",style:{height:"1rem",width:"1rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o(R.Root,{...e0,noStyle:!0,onValueChange:e=>eO(e),value:em,children:[t("div",{...e2,children:o(R.List,{...e7,noStyle:!0,children:[o(R.Trigger,{...e4,noStyle:!0,value:"purposes",children:[K.preferenceCenter.tabs.purposes,!eJ&&` (${eT})`]}),o(R.Trigger,{...e4,noStyle:!0,value:"vendors",children:[K.preferenceCenter.tabs.vendors,!eJ&&` (${eA})`]}),t("div",{...e5,"aria-hidden":"true","data-active-tab":em})]})}),t("div",{...e8,ref:ed,children:eJ?o("div",{...e6,children:[t("div",{className:a.loadingSpinner}),t("p",{className:a.loadingText,children:K.common.loading})]}):o(e,{children:[o(R.Content,{...e3,forceMount:!0,noStyle:!0,value:"purposes",children:[eN.map(e=>"stack"===e.kind?t(F,{stack:e,consents:X.purposeConsents,onToggle:eB,vendorConsents:X.vendorConsents,onVendorToggle:e$,onVendorClick:eW,vendorLegitimateInterests:X.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eM,purposeLegitimateInterests:X.purposeLegitimateInterests,onPurposeLegitimateInterestToggle:eq},e.testId):t(A,{purpose:e,testId:e.testId,isEnabled:"special-feature"===e.toggle?X.specialFeatureOptIns[e.id]??!1:X.purposeConsents[e.id]??!1,onToggle:t=>{"special-feature"===e.toggle?eR(e.id,t):eB(e.id,t)},vendorConsents:X.vendorConsents,onVendorToggle:e$,onVendorClick:eW,vendorLegitimateInterests:X.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eM,purposeLegitimateInterests:"purpose"===e.kind?X.purposeLegitimateInterests:void 0,onPurposeLegitimateInterestToggle:"purpose"===e.kind?eq:void 0},e.testId)),eI.length>0&&o("div",{...e9,children:[o("div",{className:a.specialPurposesHeader,children:[o("button",{type:"button","aria-expanded":eh,onClick:()=>eb(!eh),className:a.purposeTrigger,children:[t("svg",{"aria-hidden":"true",className:a.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:eh?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})}),o("div",{className:a.purposeInfo,children:[o("h3",{className:a.specialPurposesTitle,children:[K.preferenceCenter.specialPurposes.title,o("svg",{"aria-hidden":"true",className:a.lockIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),o("p",{className:a.purposeMeta,children:[ex," ",1===ex?K.preferenceCenter.vendorList.partnerSingular:K.preferenceCenter.vendorList.partnerPlural]})]})]}),t("div",{style:{position:"relative"},children:o("svg",{className:a.infoIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":K.preferenceCenter.specialPurposes.tooltip,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),t("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})})]}),eh&&t("div",{style:{padding:"0.75rem"},children:eI.map(e=>t(A,{purpose:e,testId:e.testId,isEnabled:!0,onToggle:()=>{},vendorConsents:X.vendorConsents,onVendorToggle:e$,onVendorClick:eW,isLocked:!0},e.testId))})]}),eL.length>0&&o("section",{"aria-label":K.preferenceCenter.features.title,className:ek.noStyle?void 0:a.featuresSection,"data-testid":"iab-consent-dialog-features",children:[o("div",{className:ek.noStyle?void 0:a.featuresHeader,children:[t("h3",{className:ek.noStyle?void 0:a.featuresTitle,children:K.preferenceCenter.features.title}),t("p",{className:ek.noStyle?void 0:a.featuresDescription,children:ej??K.preferenceCenter.features.description})]}),t("div",{className:ek.noStyle?void 0:a.featuresList,children:eL.map(e=>t(j,{feature:e,testId:e.testId},e.testId))})]}),t("div",{...te,children:t("p",{className:a.consentNoticeText,children:K.preferenceCenter.footer.consentStorage})})]}),t(R.Content,{...e3,forceMount:!0,noStyle:!0,value:"vendors",children:t(V,{vendorData:eP,purposes:eF,vendorConsents:X.vendorConsents,onVendorToggle:e$,selectedVendorId:ep,onClearSelection:()=>eg(null),customVendors:X.nonIABVendors,vendorLegitimateInterests:X.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eM})})]})})]}),o("div",{...to,children:[o("div",{...tn,children:[t(B.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eE,disabled:!eo.isReady,"data-action":"reject",children:K.common.rejectAll}),t(B.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:ez,disabled:!eo.isReady,"data-action":"accept",children:K.common.acceptAll})]}),t("div",{...tn,children:t(B.Root,{variant:"primary",mode:"filled",size:"small",onClick:eH,disabled:eJ,"data-action":"customize",children:K.common.saveSettings})})]}),t(y,{hideBranding:W??!1,variant:"dialog-tag",slotContext:"iab-dialog","data-testid":"iab-consent-dialog-branding"})]})})]})}),tr=!0===O?{}:!1===O?null:O,ta=tr?t(b,{...tr}):null;return eS||ev?o(e,{children:[ta,p(ti,document.body)]}):ta};export{q as IABConsentDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import"@c15t/ui/styles/dialog";import{IABConsentDialogCard as o}from"./atoms/card.js";import{IABConsentDialogContent as t}from"./atoms/content.js";import{IABConsentDialogFooter as s}from"./atoms/footer.js";import{IABConsentDialogHeader as
|
|
2
|
+
import"@c15t/ui/styles/dialog";import{IABConsentDialogCard as o}from"./atoms/card.js";import{IABConsentDialogContent as t}from"./atoms/content.js";import{FeatureItem as e}from"./atoms/feature-item.js";import{IABConsentDialogFooter as s}from"./atoms/footer.js";import{IABConsentDialogHeader as a}from"./atoms/header.js";import{IABConsentDialogOverlay as r}from"./atoms/overlay.js";import{PurposeItem as m}from"./atoms/purpose-item.js";import{IABConsentDialogRoot as i}from"./atoms/root.js";import{StackItem as n}from"./atoms/stack-item.js";import{IABConsentDialogTabButton as l,IABConsentDialogTabs as p}from"./atoms/tabs.js";import{VendorList as f}from"./atoms/vendor-list.js";import{IABConsentDialog as I}from"./iab-panel.js";let d=Object.assign(I,{Card:o,Content:t,FeatureItem:e,Footer:s,Header:a,Overlay:r,PurposeItem:m,Root:i,StackItem:n,TabButton:l,Tabs:p,VendorList:f});export{useIABDisplayModel}from"./hooks/use-display-model.js";export{useGVLData}from"./hooks/use-gvl-data.js";export default d;export{e as FeatureItem,o as IABConsentDialogCard,t as IABConsentDialogContent,s as IABConsentDialogFooter,a as IABConsentDialogHeader,r as IABConsentDialogOverlay,i as IABConsentDialogRoot,l as IABConsentDialogTabButton,p as IABConsentDialogTabs,m as PurposeItem,n as StackItem,f as VendorList,d as IABConsentDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/iab-consent-banner";import{forwardRef as r}from"react";import{useActiveUI as t}from"../../../hooks.js";import{useScrollLock as s}from"../../../hooks/use-scroll-lock.js";import{useTheme as n}from"../../../hooks/use-theme.js";import{useUIConfig as a}from"../../../ui-config-context.js";import{cnExt as i}from"../../../utils/cn.js";import{mergeSlotProps as m}from"../../../utils/merge-slot-props.js";let l=r(({className:r,style:l,noStyle:p,...c},f)=>{let y=t(),{disableAnimation:u,noStyle:b,scrollLock:v}=n(),{components:d}=a(),j="banner"===y,h=m(d?.["iab-banner"]?.overlay,{baseClassName:o.overlay,className:r,noStyle:b||p,style:l,...c}),k=b||p||u?void 0:`${o.overlayVisible} ${o.overlayEntering}`,B=i(h.className,k);return(s(!!(j&&v)),j&&v)?e("div",{ref:f,...h,"aria-hidden":"true",className:B,"data-testid":"iab-consent-banner-overlay"}):null});l.displayName="IABConsentBannerOverlay";export{l as IABConsentBannerOverlay};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as e,jsx as
|
|
2
|
+
import{Fragment as e,jsx as o,jsxs as t}from"react/jsx-runtime";import r from"@c15t/ui/styles/components/iab-consent-banner";import{forwardRef as n,useMemo as a}from"react";import{ConsentTrackingContext as s}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as i}from"../../../context/theme-context.js";import{useActiveUI as m,useModel as l,useTranslations as c}from"../../../hooks.js";import{useIABConsentManager as b}from"../../../hooks/use-iab-manager.js";import{useTextDirection as p}from"../../../hooks/use-text-direction.js";import{useUIConfig as d}from"../../../ui-config-context.js";import{mergeSlotProps as u}from"../../../utils/merge-slot-props.js";import{IABConsentBannerOverlay as f}from"./overlay.js";let h=["iab"],g=n(({children:n,className:a,style:s,className:i,disableAnimation:b,noStyle:g,models:j=h,...x},N)=>{let k=m(),{components:v}=d(),y=l(),B=c(),C=p(B?.language??"en"),$=null!==y&&"banner"===k&&j.includes(y),A=u(v?.["iab-banner"]?.root,{baseClassName:[r.root],className:a||i,noStyle:g,style:s,...x}),I=g?A.className||"":`${A.className||""} ${r.bannerVisible}${b?"":` ${r.bannerEntering}`}`;return $?t(e,{children:[o(f,{}),o("div",{ref:N,...A,className:I,"data-position":"ltr"===C?"bottom-left":"bottom-right","data-testid":"iab-consent-banner-root",dir:C,tabIndex:-1,children:n})]}):null}),j=({children:e,className:t,noStyle:r,disableAnimation:n,scrollLock:m,trapFocus:l,models:c,uiSource:p,...d})=>{let{policyBanner:u}=b({prompt:{scrollLock:m,trapFocus:l}}),f=u.blocking,h=a(()=>({disableAnimation:n,noStyle:r,scrollLock:f,trapFocus:f}),[n,r,f]),j=a(()=>({uiSource:p??"iab_banner"}),[p]);return o(s.Provider,{value:j,children:o(i.Provider,{value:h,children:o(g,{disableAnimation:n,className:t,noStyle:r,models:c,...d,children:e})})})};g.displayName="IABConsentBannerRootChildren";export{j as IABConsentBannerRoot};
|