@c15t/react 3.0.0-alpha.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/AGENTS.md +7 -9
  2. package/README.md +41 -70
  3. package/SKILL.md +1 -1
  4. package/dist/aggregate-components.js +1 -1
  5. package/dist/components/consent-gate/atoms.js +1 -1
  6. package/dist/components/consent-gate/frame.js +2 -0
  7. package/dist/components/consent-gate/index.js +1 -1
  8. package/dist/components/iab-panel/atoms/root.js +1 -1
  9. package/dist/components/iab-panel/iab-panel.js +1 -1
  10. package/dist/components/iab-prompt/atoms/root.js +1 -1
  11. package/dist/components/iab-prompt/iab-prompt.js +1 -1
  12. package/dist/components/panel/atoms/root.js +1 -1
  13. package/dist/components/panel-trigger/atoms/root.js +1 -1
  14. package/dist/components/panel-trigger/panel-trigger.js +1 -1
  15. package/dist/components/panel-trigger/toolbar-loader.js +2 -0
  16. package/dist/components/preferences/atoms/root.js +1 -1
  17. package/dist/components/prompt/atoms/early-tap-script.js +2 -0
  18. package/dist/components/prompt/atoms/root.js +1 -1
  19. package/dist/components/shared/primitives/button.js +1 -1
  20. package/dist/components/shared/surface-styles.js +1 -1
  21. package/dist/consent-gate.js +1 -1
  22. package/dist/context/index.js +1 -1
  23. package/dist/devtools.js +1 -1
  24. package/dist/iab/styles.tw3.css +2 -2
  25. package/dist/iab-dialog-deferred.js +2 -0
  26. package/dist/iab.js +1 -1
  27. package/dist/index-parts/consent-gate.js +1 -1
  28. package/dist/index-parts/core.js +1 -1
  29. package/dist/index-parts/frame.js +1 -0
  30. package/dist/index-parts/hosted.js +1 -0
  31. package/dist/index-parts/offline.js +1 -0
  32. package/dist/index-parts/presets.js +1 -0
  33. package/dist/index.js +1 -1
  34. package/dist/modes.js +1 -0
  35. package/dist/panel-link.js +1 -1
  36. package/dist/panel-trigger.js +1 -1
  37. package/dist/provider.js +1 -1
  38. package/dist/styles.tw3.css +2 -2
  39. package/dist/transports/hosted.js +1 -0
  40. package/dist/transports/manifest.js +1 -0
  41. package/dist/utils/deferred-module.js +1 -1
  42. package/dist/version.js +1 -1
  43. package/dist-types/chunk-warming.d.ts +7 -6
  44. package/dist-types/components/consent-gate/frame.d.ts +19 -0
  45. package/dist-types/components/consent-gate/index.d.ts +3 -19
  46. package/dist-types/components/iab-prompt/iab-prompt.d.ts +1 -1
  47. package/dist-types/components/panel/index.d.ts +1 -1
  48. package/dist-types/components/panel-trigger/toolbar-loader.d.ts +34 -0
  49. package/dist-types/components/preferences/index.d.ts +1 -1
  50. package/dist-types/components/prompt/atoms/early-tap-script.d.ts +17 -0
  51. package/dist-types/components/prompt/index.d.ts +1 -1
  52. package/dist-types/components/shared/surface-styles.d.ts +26 -2
  53. package/dist-types/consent-gate.d.ts +1 -1
  54. package/dist-types/context/index.d.ts +3 -3
  55. package/dist-types/context.d.ts +2 -0
  56. package/dist-types/gpp.d.ts +1 -1
  57. package/dist-types/iab-dialog-deferred.d.ts +36 -0
  58. package/dist-types/iab.d.ts +3 -2
  59. package/dist-types/index-parts/consent-gate.d.ts +1 -1
  60. package/dist-types/index-parts/core.d.ts +1 -2
  61. package/dist-types/index-parts/frame.d.ts +7 -0
  62. package/dist-types/index-parts/hosted.d.ts +7 -0
  63. package/dist-types/index-parts/offline.d.ts +7 -0
  64. package/dist-types/index-parts/presets.d.ts +7 -0
  65. package/dist-types/index.d.ts +5 -1
  66. package/dist-types/modes.d.ts +26 -0
  67. package/dist-types/panel-link.d.ts +1 -1
  68. package/dist-types/panel-trigger.d.ts +1 -1
  69. package/dist-types/provider.d.ts +3 -3
  70. package/dist-types/transports/hosted.d.ts +36 -0
  71. package/dist-types/transports/manifest.d.ts +48 -0
  72. package/dist-types/version.d.ts +1 -1
  73. package/docs/README.md +7 -9
  74. package/docs/concepts/choose-your-setup.md +45 -10
  75. package/docs/concepts/consent-categories.md +1 -1
  76. package/docs/concepts/consent-state.md +5 -2
  77. package/docs/concepts/data-fetching.md +100 -42
  78. package/docs/concepts/modes.md +281 -0
  79. package/docs/customization/dark-mode.md +1 -1
  80. package/docs/customization/motion.md +2 -2
  81. package/docs/customization/recipes.md +4 -4
  82. package/docs/customization/slots.md +25 -25
  83. package/docs/customization/stylesheets.md +12 -14
  84. package/docs/customization/tailwind.md +17 -11
  85. package/docs/customization/tokens.md +36 -7
  86. package/docs/frameworks/react/components/consent-banner.md +14 -10
  87. package/docs/frameworks/react/components/consent-dialog.md +14 -10
  88. package/docs/frameworks/react/components/consent-provider.md +51 -44
  89. package/docs/frameworks/react/components.md +14 -10
  90. package/docs/frameworks/react/content-security-policy.md +21 -12
  91. package/docs/frameworks/react/hooks.md +2 -2
  92. package/docs/frameworks/react/iab.md +20 -2
  93. package/docs/frameworks/react/quickstart.md +63 -97
  94. package/docs/frameworks/react/rendering.md +168 -94
  95. package/docs/frameworks/react/scripts.md +19 -28
  96. package/docs/frameworks/react/troubleshooting.md +57 -25
  97. package/docs/frameworks/react/upgrade-v3.md +110 -62
  98. package/docs/guides/banner-experiments.md +21 -6
  99. package/docs/guides/troubleshooting.md +89 -25
  100. package/docs/guides/verify-consent.md +23 -8
  101. package/docs/integrations/adobe-analytics.md +60 -64
  102. package/docs/integrations/ahrefs-analytics.md +58 -63
  103. package/docs/integrations/amplitude.md +60 -64
  104. package/docs/integrations/clearbit.md +59 -63
  105. package/docs/integrations/cloudflare-web-analytics.md +56 -60
  106. package/docs/integrations/cloudflare-zaraz.md +55 -57
  107. package/docs/integrations/crisp.md +64 -69
  108. package/docs/integrations/databuddy.md +62 -64
  109. package/docs/integrations/fathom-analytics.md +56 -60
  110. package/docs/integrations/front-chat.md +56 -60
  111. package/docs/integrations/google-maps.md +25 -13
  112. package/docs/integrations/google-tag-manager.md +153 -77
  113. package/docs/integrations/google-tag.md +134 -78
  114. package/docs/integrations/heap.md +56 -60
  115. package/docs/integrations/hightouch.md +55 -60
  116. package/docs/integrations/hotjar.md +60 -64
  117. package/docs/integrations/intercom.md +55 -60
  118. package/docs/integrations/klaviyo.md +65 -66
  119. package/docs/integrations/linkedin-insights.md +58 -63
  120. package/docs/integrations/logrocket.md +55 -60
  121. package/docs/integrations/matomo-analytics.md +58 -60
  122. package/docs/integrations/meta-pixel.md +56 -60
  123. package/docs/integrations/microsoft-clarity.md +57 -60
  124. package/docs/integrations/microsoft-uet.md +58 -61
  125. package/docs/integrations/mixpanel-analytics.md +73 -75
  126. package/docs/integrations/one-dollar-stats.md +53 -59
  127. package/docs/integrations/openai-pixel.md +58 -60
  128. package/docs/integrations/overview.md +59 -42
  129. package/docs/integrations/pinterest-tag.md +56 -60
  130. package/docs/integrations/pirsch.md +54 -60
  131. package/docs/integrations/plausible-analytics.md +55 -60
  132. package/docs/integrations/posthog.md +56 -60
  133. package/docs/integrations/promptwatch.md +57 -63
  134. package/docs/integrations/reddit-pixel.md +57 -60
  135. package/docs/integrations/rudderstack.md +65 -67
  136. package/docs/integrations/rybbit-analytics.md +70 -75
  137. package/docs/integrations/segment.md +56 -60
  138. package/docs/integrations/sentry.md +65 -60
  139. package/docs/integrations/snapchat-pixel.md +54 -60
  140. package/docs/integrations/tiktok-pixel.md +59 -63
  141. package/docs/integrations/umami-analytics.md +54 -60
  142. package/docs/integrations/vercel-analytics.md +53 -59
  143. package/docs/integrations/vercel-speed-insights.md +317 -0
  144. package/docs/integrations/x-pixel.md +57 -63
  145. package/docs/integrations/youtube.md +25 -13
  146. package/package.json +18 -8
  147. package/docs/upgrade-v3.md +0 -429
package/AGENTS.md CHANGED
@@ -6,7 +6,7 @@ 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 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.
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. 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
 
@@ -15,7 +15,7 @@ These docs describe c15t v3. Find your app's row in Choose your setup, then foll
15
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
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
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 from c15t v2 to v3. Pick the guide for the v2 package you use (@c15t/nextjs, @c15t/react or the c15t store), rename @c15t/scripts, keep visitors' choices, and upgrade a self-hosted backend and the Node.js SDK.
18
+ - [Upgrade a React app from v2](./docs/frameworks/react/upgrade-v3.md): Upgrade a React app from c15t v2 (@c15t/react) to v3. Covers packages, ConsentProvider and transports, the useConsentManager codemod, callbacks, policies, styles, IAB and stored consent.
19
19
 
20
20
  ## More documentation
21
21
 
@@ -58,12 +58,13 @@ These docs describe c15t v3. Find your app's row in Choose your setup, then foll
58
58
  - [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.
59
59
  - [Data fetching](./docs/concepts/data-fetching.md): Choose the recommended build-time policy snapshot or runtime manifest fetching, backend /init, browser resolution or offline rules, and understand where consent choices are saved.
60
60
  - [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.
61
+ - [Consent modes](./docs/concepts/modes.md): Reference for manifest(), hosted() and offline() in every c15t framework package, where each one resolves the visitor's policy, what it adds to first-load JavaScript, the build-time manifest fetch and its failure policy, and the backend URL variable each framework reads.
61
62
  - [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.
62
63
 
63
64
  ## Guides
64
65
 
65
66
  - [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.
66
- - [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.
67
+ - [Troubleshooting](./docs/guides/troubleshooting.md): Fix a missing banner, analytics that load before consent, choices lost on reload, CORS errors, hydration differences, failed manifest downloads, mode errors and failed static builds in c15t v3.
67
68
  - [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.
68
69
 
69
70
  ## Customization
@@ -93,8 +94,8 @@ These docs describe c15t v3. Find your app's row in Choose your setup, then foll
93
94
  - [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.
94
95
  - [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.
95
96
  - [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.
96
- - [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.
97
- - [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
+ - [Google Tag](./docs/integrations/google-tag.md): Load gtag.js for Google Analytics or Google Ads before or after consent with c15t Consent Mode v2 signals, and verify the consent commands in DevTools.
98
+ - [Google Tag Manager](./docs/integrations/google-tag-manager.md): Load a Google Tag Manager container before or after consent with c15t Consent Mode v2 signals, configure consent checks inside the container, and verify both in DevTools.
98
99
  - [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.
99
100
  - [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.
100
101
  - [Hotjar](./docs/integrations/hotjar.md): Load Hotjar only after measurement consent with the c15t hotjar helper, and check its loader and recordings in DevTools.
@@ -124,9 +125,6 @@ These docs describe c15t v3. Find your app's row in Choose your setup, then foll
124
125
  - [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.
125
126
  - [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.
126
127
  - [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.
128
+ - [Vercel Speed Insights](./docs/integrations/vercel-speed-insights.md): Load the Vercel Speed Insights collector only after measurement consent with the c15t vercelSpeedInsights helper, drop Web Vitals reports on revocation, and check it in DevTools.
127
129
  - [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.
128
130
  - [YouTube](./docs/integrations/youtube.md): Gate YouTube embeds with c15t v3 in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit or JavaScript.
129
-
130
- ## Reference
131
-
132
- - [Migrate to v3](./docs/upgrade-v3.md): Upgrade from c15t v2 to v3. Pick the guide for the v2 package you use (@c15t/nextjs, @c15t/react or the c15t store), rename @c15t/scripts, keep visitors' choices, and upgrade a self-hosted backend and the Node.js SDK.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  <p align="center">
2
2
  <a href="https://c15t.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Freact" target="_blank" rel="noopener noreferrer">
3
3
  <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="../../docs/assets/c15t-banner-readme-dark.svg" type="image/svg+xml">
5
- <img src="../../docs/assets/c15t-banner-readme-light.svg" alt="c15t Banner" type="image/svg+xml">
4
+ <source media="(prefers-color-scheme: dark)" srcset="../../docs/assets/c15t-banner-readme-dark.png">
5
+ <img src="../../docs/assets/c15t-banner-readme-light.png" alt="c15t: the open standard for cookie banners">
6
6
  </picture>
7
7
  </a>
8
8
  </p>
9
9
 
10
- # @c15t/react: React Consent Components
10
+ # @c15t/react: React Cookie Banner and Consent Components
11
11
 
12
12
  <p>
13
13
  <a href="https://www.npmjs.com/package/@c15t/react"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/npm/%40c15t%2Freact.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/npm/%40c15t%2Freact.svg?variant=outline&mode=light" alt="Latest NPM Version"></picture></a>
@@ -18,69 +18,46 @@
18
18
  <a href="https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Freact"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?color=ffc803&labelTextColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&valueColor=000000&mode=dark"><img src="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?color=ffc803&labelTextColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&valueColor=000000&mode=light" alt="Made by Inth"></picture></a>
19
19
  </p>
20
20
 
21
- React cookie banner, consent manager, preference center, and headless CMP components for modern React apps.
21
+ React cookie banner, consent dialog, and preference center for React 18 and 19, with headless hooks when you want your own design.
22
+
23
+ c15t is used by [2,100+ sites](https://www.wappalyzer.com/technologies/cookie-compliance/c15t/), including expo.dev, zed.dev, unkey.dev, mintlify.com, and sazabi.com.
22
24
 
23
25
  ## Key Features
24
26
 
25
- - Works with React 19, 18, 17, and 16.8
26
- - Full 'use client' support for React Server Components
27
- - Prebuilt and fully customizable cookie banner, consent dialog, and preference center UI
28
- - Headless hooks for custom consent flows
29
- - Minimal configuration with TypeScript-first design
30
- - Comprehensive Consent Management Platform (CMP)
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
- - Built-in internationalization support
34
- - Seamless consent storage and tracking
27
+ - Works with React 18 and 19, including React Server Components through 'use client' entry points
28
+ - Prebuilt cookie banner, consent dialog, and preference center with a theme system
29
+ - Headless hooks and compound components for a fully custom design
30
+ - Analytics, ads, and pixels follow each visitor's choice through @c15t/integrations: Google Tag Manager, Google Consent Mode v2, GA4, Meta Pixel, PostHog, and more
31
+ - IAB TCF 2.4 banner, dialog, and hooks through the @c15t/react/iab subpath
32
+ - Translations for 35 languages through @c15t/translations
35
33
 
36
34
  ## Prerequisites
37
35
 
38
- - React 16.8 or later
36
+ - React 18 or 19
39
37
  - Node.js 20.19 or later
40
- - A hosted [c15t instance](https://inth.com) (free sign-up), [self-hosted deployment](https://c15t.com/docs/self-host/quickstart), or offline mode for local-only storage
41
-
42
- ## Quick Start
43
-
44
- Easiest setup with @c15t/cli:
45
-
46
- ```bash
47
- # Set up c15t in your project
48
- pnpm dlx @c15t/cli setup
49
- # Alternatives:
50
- # npx @c15t/cli setup
51
- # bunx --bun @c15t/cli setup
52
- ```
53
-
54
- The CLI will:
55
-
56
- - Install necessary packages
57
- - Configure your c15t instance
58
- - Set up environment variables
59
- - Add consent management components to your app
38
+ - An [Inth project](https://inth.com) (free sign-up), a [self-hosted backend](https://c15t.com/docs/self-host/quickstart), or offline mode for local development
60
39
 
61
- ## Manual Installation
40
+ ## Installation
62
41
 
63
42
  ```bash
64
43
  pnpm add @c15t/react
65
44
  ```
66
45
 
67
- Then add the prebuilt stylesheet to your app-level CSS entrypoint:
46
+ Then add the prebuilt stylesheet to your app-level CSS entry point:
68
47
 
69
48
  ```css
70
49
  /* src/index.css */
71
50
  @import "@c15t/react/styles.css";
72
51
  ```
73
52
 
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.
53
+ If you use the prebuilt IAB TCF UI, also import `@c15t/react/iab/styles.css`. It is published separately so apps without IAB do not ship those styles.
75
54
 
76
- To manually install, follow the [quickstart](https://c15t.com/docs/frameworks/react/quickstart).
55
+ Using several c15t packages? Install [`c15t`](https://www.npmjs.com/package/c15t) and import `c15t/react` instead. It is the same code.
77
56
 
78
57
  ## Usage
79
58
 
80
59
  1. Wrap your app in `ConsentProvider` with the backend URL from your Inth project
81
60
  2. Render `ConsentBanner`, `ConsentDialog` and `ConsentDialogLink` inside the provider, and mount it once for the life of the app
82
- 3. Customize styling and behavior to fit your app
83
- 4. For full implementation details, see the [React quickstart docs](https://c15t.com/docs/frameworks/react/quickstart)
84
61
 
85
62
  ```tsx
86
63
  // src/consent.tsx
@@ -93,7 +70,7 @@ import {
93
70
  } from '@c15t/react'
94
71
  import type { ReactNode } from 'react'
95
72
 
96
- const mode = hosted({ url: 'https://your-project.inth.app' })
73
+ const mode = hosted({ backendURL: 'https://your-project.inth.app' })
97
74
 
98
75
  export const Consent = ({ children }: { children: ReactNode }) => (
99
76
  <ConsentProvider options={{ mode }}>
@@ -105,23 +82,27 @@ export const Consent = ({ children }: { children: ReactNode }) => (
105
82
  )
106
83
  ```
107
84
 
108
- ## Documentation
85
+ 3. For the full setup, see the [React quickstart](https://c15t.com/docs/frameworks/react/quickstart)
86
+
87
+ ## Hosting
88
+
89
+ c15t needs somewhere to keep policies and consent records. Pick one:
90
+
91
+ - **Hosted on [Inth](https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Freact)**: Inth runs the backend for you. You get policy storage, consent records, audit history, and a dashboard, with no database or server to run. Sign-up is free.
92
+ - **Self-hosted**: Run [`@c15t/backend`](https://www.npmjs.com/package/@c15t/backend) on your own server with PostgreSQL, MySQL, or SQLite. You own migrations, backups, and uptime. See the [self-hosting guide](https://c15t.com/docs/self-host/quickstart).
93
+ - **Offline**: Choices stay in the browser, with no consent records. Use it for local development, previews, and demos, not production.
109
94
 
110
- For further information, guides, and examples visit the [reference documentation](https://c15t.com/docs/frameworks/react/quickstart).
95
+ The frontend code is the same for Inth and a self-hosted backend. Only the backend URL changes.
111
96
 
112
- ## Deployment Modes
97
+ ## Documentation
98
+
99
+ See the [documentation](https://c15t.com/docs/frameworks/react/quickstart) for guides, API reference, and examples.
113
100
 
114
- - **Hosted on inth.com**: Hosted c15t backend for policy storage, audit history, and hosted infrastructure
115
- - **Self-hosted backend**: Use @c15t/backend when you need full infrastructure control
116
- - **Offline mode**: Browser-only consent storage for local development, demos, previews, static sites, or fallback scenarios
101
+ ## Docs for AI Agents
117
102
 
118
- ## Popular Integrations
103
+ This package ships its documentation as Markdown, matched to the installed version. After you install it, point your coding agent at `node_modules/@c15t/react/AGENTS.md`. It indexes every guide in `node_modules/@c15t/react/docs/`.
119
104
 
120
- - Google Tag Manager with Google Consent Mode v2
121
- - Google Analytics 4 and Google Ads through gtag.js
122
- - Meta Pixel, TikTok Pixel, LinkedIn Insights, Microsoft UET, X Pixel, Reddit Pixel, and Snapchat Pixel
123
- - PostHog, Segment, Mixpanel, Microsoft Clarity, Hotjar, Plausible, Fathom, Matomo, Umami, and Vercel Analytics
124
- - Intercom and Crisp chat widgets
105
+ On the web, every page of the [c15t docs](https://c15t.com/docs) has a Markdown version, and [llms.txt](https://c15t.com/docs/llms.txt) lists them all. Install the c15t agent skills with `npx skills add c15t/skills`.
125
106
 
126
107
  ## Support
127
108
 
@@ -132,26 +113,16 @@ For further information, guides, and examples visit the [reference documentation
132
113
 
133
114
  ## Contributing
134
115
 
135
- - We're open to all community contributions.
136
- - Read our [Contribution Guidelines](https://c15t.com/docs/oss/contributing)
137
- - Review our [Code of Conduct](https://c15t.com/docs/oss/code-of-conduct)
138
- - Fork the repository
139
- - Create a new branch for your feature
140
- - Submit a pull request
141
- - **All contributions, big or small, are welcome and appreciated.**
116
+ - Read the [contribution guidelines](https://c15t.com/docs/oss/contributing) before you open a pull request
117
+ - Follow the [code of conduct](https://c15t.com/docs/oss/code-of-conduct)
142
118
 
143
119
  ## Security
144
120
 
145
- If you believe you have found a security vulnerability in c15t, we encourage you to **_responsibly disclose this and NOT open a public issue_**. We will investigate all legitimate reports.
146
-
147
- Our preference is that you make use of GitHub's private vulnerability reporting feature to disclose potential security vulnerabilities in our open-source software. To do this, please visit [https://github.com/c15t/c15t/security](https://github.com/c15t/c15t/security) and click the "Report a vulnerability" button.
148
-
149
- ### Security Policy
121
+ Do not open a public issue for a security vulnerability. Report it privately through [GitHub's vulnerability reporting](https://github.com/c15t/c15t/security/advisories/new). We examine every valid report.
150
122
 
151
- - Please do not share security vulnerabilities in public forums, issues, or pull requests
152
- - Provide detailed information about the potential vulnerability
153
- - Allow reasonable time for us to address the issue before any public disclosure
154
- - We are committed to addressing security concerns promptly and transparently
123
+ - Do not share the vulnerability in public forums, issues, or pull requests
124
+ - Give the steps to reproduce it and the versions it affects
125
+ - Give us time to release a fix before you disclose it
155
126
 
156
127
  ## License
157
128
 
package/SKILL.md CHANGED
@@ -15,7 +15,7 @@ The Markdown under `./docs` matches the installed version. Read it before writin
15
15
 
16
16
  ## Rules
17
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.
18
+ - Install with `npm install c15t` and import `c15t/react`. 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
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
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
21
  - Gate features on the current permission. Never save a consent choice on page load or from code; only a visitor action records one.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as o}from"react/jsx-runtime";import{registerDialogChunkWarmer as e,useIdleDialogWarming as n}from"./chunk-warming.js";import{useActiveUI as t}from"./hooks.js";import{createDeferredModule as r}from"./utils/deferred-module.js";let i=r(()=>import("./components/panel/index.js")),c=r(()=>import("./components/preferences/index.js"));e(()=>{i.preload()});let s=i.component(o=>o.ConsentDialog),l=c.component(o=>o.ConsentWidget),a=function(o,e,n){let t={};for(let r of e)Object.defineProperty(o,r,{configurable:!0,enumerable:!0,get:()=>(t[r]??=n(r),t[r])});return o},d=a(e=>{let r=t();return(n("banner"===r),!0===e.open||"dialog"===r||e.showTrigger)?o(s,{...e}):null},["Card","Header","HeaderTitle","HeaderDescription","Content","Footer","ConsentCustomizationCard","ConsentDialogFooter","ConsentDialogHeader","ConsentDialogHeaderTitle","ConsentDialogHeaderDescription","ConsentDialogContent","Overlay","Root"],o=>i.component(e=>e[o])),m=a(e=>o(l,{...e}),["AccordionTrigger","AccordionTriggerInner","AccordionContent","AccordionArrow","Accordion","Switch","AccordionItems","AccordionItem","VendorList","Root","AcceptAllButton","CustomizeButton","SaveButton","RejectButton","PolicyActions","Footer","FooterSubGroup"],o=>c.component(e=>e[o]));export{d as ConsentDialog,m as ConsentWidget};
2
+ import{jsx as o}from"react/jsx-runtime";import{registerDialogChunkWarmer as e,useIdleDialogWarming as t}from"./chunk-warming.js";import{FIRST_PAINT_SHEETS as n}from"./components/shared/first-paint-sheets.js";import{preloadSurfaceSheets as r}from"./components/shared/surface-styles.js";import{useActiveUI as i}from"./hooks.js";import{createDeferredModule as s}from"./utils/deferred-module.js";let c=s(()=>(r(n),import("./components/panel/index.js"))),a=s(()=>import("./components/preferences/index.js"));e(()=>{c.preload()});let m=c.component(o=>o.ConsentDialog),d=a.component(o=>o.ConsentWidget),l=function(o,e,t){let n={};for(let r of e)Object.defineProperty(o,r,{configurable:!0,enumerable:!0,get:()=>(n[r]??=t(r),n[r])});return o},p=l(e=>{let n=i();return(t("banner"===n),!0===e.open||"dialog"===n||e.showTrigger)?o(m,{...e}):null},["Card","Header","HeaderTitle","HeaderDescription","Content","Footer","ConsentCustomizationCard","ConsentDialogFooter","ConsentDialogHeader","ConsentDialogHeaderTitle","ConsentDialogHeaderDescription","ConsentDialogContent","Overlay","Root"],o=>c.component(e=>e[o])),g=l(e=>o(d,{...e}),["AccordionTrigger","AccordionTriggerInner","AccordionContent","AccordionArrow","Accordion","Switch","AccordionItems","AccordionItem","VendorList","Root","AcceptAllButton","CustomizeButton","SaveButton","RejectButton","PolicyActions","Footer","FooterSubGroup"],o=>a.component(e=>e[o]));export{p as ConsentDialog,g as ConsentWidget};
@@ -1 +1 @@
1
- import{Fragment as t,jsx as e,jsxs as o}from"react/jsx-runtime";import s from"@c15t/ui/styles/components/consent-gate";import{forwardRef as r}from"react";import{useTranslations as n}from"../../component-hooks/use-translations.js";import{useUIConfig as a}from"../../ui-config-context.js";import{getSlotProps as i,mergeSlotProps as l}from"../../utils/merge-slot-props.js";import{FIRST_PAINT_SHEETS as m}from"../shared/first-paint-sheets.js";import{Box as c}from"../shared/primitives/box.js";import{ConsentButton as p}from"../shared/primitives/button.js";import{SurfaceStyles as d}from"../shared/surface-styles.js";let f=r(({children:r,...n},a)=>o(t,{children:[e(d,{sheets:m,noStyle:n.noStyle}),e(c,{ref:a,baseClassName:s.placeholder,"data-testid":"consent-gate-placeholder",slotKey:"consent-gate.root",...n,children:r})]})),u=r(({children:t,category:o,...r},a)=>{let{consentGate:i,consentTypes:l}=n(),m=o&&i?.title?i.title.replace("{category}",l?.[o]?.title??o):void 0;return e(c,{ref:a,baseClassName:s.title,"data-testid":"consent-gate-title",slotKey:"consent-gate.title",...r,children:t??m})}),g=r(({children:t,category:o,className:s,style:r,...m},c)=>{let{consentGate:d,consentTypes:f}=n(),{components:u}=a(),g=l(i(u,"consent-gate.button"),{className:s,style:r}),h=f?.[o]?.title??o,y=d?.actionButton?.replace("{category}",h);return e(p,{mode:"stroke",size:"small",variant:"primary",...g,...m,ref:c,action:"open-consent-dialog",category:o,"data-testid":"consent-gate-button",children:t??y})});f.displayName="ConsentGateRoot",u.displayName="ConsentGateTitle",g.displayName="ConsentGateButton";export{g as ConsentGateButton,f as ConsentGateRoot,u as ConsentGateTitle};
1
+ import{Fragment as t,jsx as e,jsxs as o}from"react/jsx-runtime";import s from"@c15t/ui/styles/components/consent-gate";import{forwardRef as n}from"react";import{useTranslations as r}from"../../component-hooks/use-translations.js";import{useUIConfig as a}from"../../ui-config-context.js";import{getSlotProps as i,mergeSlotProps as l}from"../../utils/merge-slot-props.js";import{FIRST_PAINT_SHEETS as m}from"../shared/first-paint-sheets.js";import{Box as c}from"../shared/primitives/box.js";import{ConsentButton as p}from"../shared/primitives/button.js";import{SurfaceStyles as d,useSurfaceSheetsReady as f}from"../shared/surface-styles.js";let u=n(({children:n,...r},a)=>f(m,r.noStyle)?o(t,{children:[e(d,{sheets:m,noStyle:r.noStyle}),e(c,{ref:a,baseClassName:s.placeholder,"data-testid":"consent-gate-placeholder",slotKey:"consent-gate.root",...r,children:n})]}):null),y=n(({children:t,category:o,...n},a)=>{let{consentGate:i,consentTypes:l}=r(),m=o&&i?.title?i.title.replace("{category}",l?.[o]?.title??o):void 0;return e(c,{ref:a,baseClassName:s.title,"data-testid":"consent-gate-title",slotKey:"consent-gate.title",...n,children:t??m})}),g=n(({children:t,category:o,className:s,style:n,...m},c)=>{let{consentGate:d,consentTypes:f}=r(),{components:u}=a(),y=l(i(u,"consent-gate.button"),{className:s,style:n}),g=f?.[o]?.title??o,h=d?.actionButton?.replace("{category}",g);return e(p,{mode:"stroke",size:"small",variant:"primary",...y,...m,ref:c,action:"open-consent-dialog",category:o,"data-testid":"consent-gate-button",children:t??h})});u.displayName="ConsentGateRoot",y.displayName="ConsentGateTitle",g.displayName="ConsentGateButton";export{g as ConsentGateButton,u as ConsentGateRoot,y as ConsentGateTitle};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as t}from"react/jsx-runtime";import{forwardRef as e}from"react";import{ConsentGate as o}from"./consent-gate.js";import*as n from"./atoms.js";let a=new Set,r=function(t,e){"production"===process.env.NODE_ENV||a.has(t)||(a.add(t),console.warn(`c15t: \`${t}\` is deprecated and will be removed in a future major release. Use \`${e}\` instead.`))},s=function(o,n,a){let s=e((e,s)=>(r(n,a),t(o,{...e,ref:s})));return s.displayName=n,s},m=s(n.ConsentGateRoot,"FrameRoot","ConsentGate.Root"),i=s(n.ConsentGateTitle,"FrameTitle","ConsentGate.Title"),l=s(n.ConsentGateButton,"FrameButton","ConsentGate.Button"),u=Object.assign(s(o,"Frame","ConsentGate"),{Button:l,Root:m,Title:i});export{u as Frame,l as FrameButton,m as FrameRoot,i as FrameTitle};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{ConsentGate as t}from"./consent-gate.js";import*as e from"./atoms.js";let o=Object.assign(t,{Button:e.ConsentGateButton,Root:e.ConsentGateRoot,Title:e.ConsentGateTitle}),n=o,a=e.ConsentGateRoot,s=e.ConsentGateTitle,C=e.ConsentGateButton;var G=e.ConsentGateButton,r=e.ConsentGateRoot,i=e.ConsentGateTitle;export{G as ConsentGateButton,r as ConsentGateRoot,i as ConsentGateTitle,n as Frame,C as FrameButton,a as FrameRoot,s as FrameTitle,o as ConsentGate};
2
+ import{ConsentGate as t}from"./consent-gate.js";import*as e from"./atoms.js";let o=Object.assign(t,{Button:e.ConsentGateButton,Root:e.ConsentGateRoot,Title:e.ConsentGateTitle});var n=e.ConsentGateButton,a=e.ConsentGateRoot,s=e.ConsentGateTitle;export{Frame,FrameButton,FrameRoot,FrameTitle}from"./frame.js";export{n as ConsentGateButton,a as ConsentGateRoot,s as ConsentGateTitle,o as ConsentGate};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as o,jsxs as e}from"react/jsx-runtime";import{isDialogDismissKey as t}from"@c15t/ui/primitives/dialog";import r from"@c15t/ui/styles/components/iab-consent-dialog";import{useEffect as i,useMemo as n,useState as s}from"react";import{createPortal as m}from"react-dom";import{ConsentTrackingContext as a}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as l}from"../../../context/theme-context.js";import{useSetActiveUI as c}from"../../../hooks.js";import{useIABConsentManager as d}from"../../../hooks/use-iab-manager.js";import{useIsHydrated as u}from"../../../hooks/use-is-hydrated.js";import{useScrollLock as p}from"../../../hooks/use-scroll-lock.js";import{useTextDirection as f}from"../../../hooks/use-text-direction.js";import{useUIConfig as g}from"../../../ui-config-context.js";import{cnExt as h}from"../../../utils/cn.js";import{mergeSlotProps as j}from"../../../utils/merge-slot-props.js";import{IAB_DIALOG_SHEETS as b}from"../../shared/iab-dialog-sheets.js";import{SurfaceStyles as k}from"../../shared/surface-styles.js";import{IABConsentDialogOverlay as v}from"./overlay.js";let y=["iab"],x=({children:x,open:A,models:F=y,noStyle:L,disableAnimation:C,scrollLock:D,trapFocus:q,uiSource:w})=>{let{activeUI:B,translationConfig:E,iab:I,policyDialog:N,model:P}=d({preferences:{scrollLock:D,trapFocus:q}}),R=c(),{components:S}=g(),T=f(E.defaultLanguage),H=u(),[O,V]=s(!1),_=null!==P&&F.includes(P)&&(A??"dialog"===B),z=N.blocking,G=n(()=>({disableAnimation:C,noStyle:L,scrollLock:z,trapFocus:z}),[C,L,z]);p(!!(_&&z)),i(()=>{if(!_)return;let o=o=>{t(o.key)&&(o.preventDefault(),R("none"))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[_,R]),i(()=>{if(_){let o=requestAnimationFrame(()=>V(!0));return()=>cancelAnimationFrame(o)}if(C){let o=requestAnimationFrame(()=>V(!1));return()=>cancelAnimationFrame(o)}let o=setTimeout(()=>{V(!1)},150);return()=>clearTimeout(o)},[_,C]);let J=j(S?.["iab-dialog"]?.root,{baseClassName:h(r.root,C?void 0:O?r.dialogVisible:r.dialogHidden)}),K=n(()=>({uiSource:w??"iab_dialog"}),[w]);return H&&I?.config.enabled&&(_||O)?m(o(a.Provider,{value:K,children:e(l.Provider,{value:G,children:[o(k,{sheets:b,noStyle:L}),o(v,{isOpen:_}),o("div",{...J,"data-testid":"iab-consent-dialog-root",dir:T,children:x})]})}),document.body):null};x.displayName="IABConsentDialogRoot";export{x as IABConsentDialogRoot};
2
+ import{jsx as o,jsxs as e}from"react/jsx-runtime";import{isDialogDismissKey as t}from"@c15t/ui/primitives/dialog";import r from"@c15t/ui/styles/components/iab-consent-dialog";import{useEffect as i,useMemo as n,useState as s}from"react";import{createPortal as m}from"react-dom";import{ConsentTrackingContext as a}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as l}from"../../../context/theme-context.js";import{useSetActiveUI as c}from"../../../hooks.js";import{useIABConsentManager as d}from"../../../hooks/use-iab-manager.js";import{useIsHydrated as u}from"../../../hooks/use-is-hydrated.js";import{useScrollLock as p}from"../../../hooks/use-scroll-lock.js";import{useTextDirection as f}from"../../../hooks/use-text-direction.js";import{useUIConfig as g}from"../../../ui-config-context.js";import{cnExt as h}from"../../../utils/cn.js";import{mergeSlotProps as j}from"../../../utils/merge-slot-props.js";import{IAB_DIALOG_SHEETS as b}from"../../shared/iab-dialog-sheets.js";import{SurfaceStyles as k,useSurfaceSheetsReady as v}from"../../shared/surface-styles.js";import{IABConsentDialogOverlay as y}from"./overlay.js";let x=["iab"],A=({children:A,open:F,models:L=x,noStyle:C,disableAnimation:D,scrollLock:q,trapFocus:w,uiSource:B})=>{let{activeUI:E,translationConfig:I,iab:N,policyDialog:P,model:R}=d({preferences:{scrollLock:q,trapFocus:w}}),S=c(),{components:T}=g(),H=f(I.defaultLanguage),O=u(),[V,_]=s(!1),z=v(b,C)&&null!==R&&L.includes(R)&&(F??"dialog"===E),G=P.blocking,J=n(()=>({disableAnimation:D,noStyle:C,scrollLock:G,trapFocus:G}),[D,C,G]);p(!!(z&&G)),i(()=>{if(!z)return;let o=o=>{t(o.key)&&(o.preventDefault(),S("none"))};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[z,S]),i(()=>{if(z){let o=requestAnimationFrame(()=>_(!0));return()=>cancelAnimationFrame(o)}if(D){let o=requestAnimationFrame(()=>_(!1));return()=>cancelAnimationFrame(o)}let o=setTimeout(()=>{_(!1)},150);return()=>clearTimeout(o)},[z,D]);let K=j(T?.["iab-dialog"]?.root,{baseClassName:h(r.root,D?void 0:V?r.dialogVisible:r.dialogHidden)}),M=n(()=>({uiSource:B??"iab_dialog"}),[B]);return O&&N?.config.enabled&&(z||V)?m(o(a.Provider,{value:M,children:e(l.Provider,{value:J,children:[o(k,{sheets:b,noStyle:C}),o(y,{isOpen:z}),o("div",{...K,"data-testid":"iab-consent-dialog-root",dir:H,children:A})]})}),document.body):null};A.displayName="IABConsentDialogRoot";export{A as IABConsentDialogRoot};
@@ -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 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 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 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{IAB_DIALOG_SHEETS as j}from"../shared/iab-dialog-sheets.js";import{SurfaceStyles as T}from"../shared/surface-styles.js";import{FeatureItem as A}from"./atoms/feature-item.js";import{IABConsentDialogOverlay as F}from"./atoms/overlay.js";import{PurposeItem as V}from"./atoms/purpose-item.js";import{StackItem as w}from"./atoms/stack-item.js";import{VendorList as P}from"./atoms/vendor-list.js";import{useIABDisplayModel as B}from"./hooks/use-display-model.js";import{useIABTranslations as R}from"./use-iab-translations.js";import*as $ from"../shared/ui/button/index.js";import*as M from"../shared/ui/tabs/index.js";let q=["iab"],z={tabIndex:-1},E=({open:E,noStyle:H,disableAnimation:D,scrollLock:W,trapFocus:G,hideBranding:O,initialTab:_,showTrigger:J=!1,models:K=q,uiSource:Q})=>{let U=R(),{common:X}=h(),{components:Y}=x(),{iab:Z,activeUI:ee,policyDialog:et,translationConfig:eo,model:en}=k({preferences:{scrollLock:W,trapFocus:G}}),{banner:ei,closeUI:er,openDialog:ea,performDialogAction:es}=g(),el=et.blocking,ed=I(eo.defaultLanguage),ec=m(null),em=m(null),ep=m(null),[eu,eg]=p(_??Z?.preferenceCenterTab??"purposes"),[eh,eb]=p(null),[ey,ef]=p(!1),[ev,eC]=p(!1),[eS,ek]=p(!1),eN=null!==en&&K.includes(en)&&(E??"dialog"===ee),eI=C({disableAnimation:D,noStyle:H,scrollLock:el,trapFocus:et.blocking}),{consentRows:ex,essentialRows:eL,essentialPartnerCount:ej,featureRows:eT,featuresStandardText:eA,purposeTabCount:eF,vendorTabCount:eV,data:{purposes:ew}}=B(),eP=Z?.gvl??null,eB=Z?.publisherRestrictions,eR=c(()=>eP?n(eP,eB):null,[eP,eB]),e$=s((e,t)=>{Z?.setPurposeConsent(e,t)},[Z]),eM=s((e,t)=>{Z?.setSpecialFeatureOptIn(e,t)},[Z]),eq=s((e,t)=>{Z?.setVendorConsent(e,t)},[Z]),ez=s((e,t)=>{Z?.setVendorLegitimateInterest(e,t)},[Z]),eE=s((e,t)=>{Z?.setPurposeLegitimateInterest(e,t)},[Z]),eH=async()=>{try{await es("accept")}catch{}},eD=async()=>{try{await es("reject")}catch{}},eW=async()=>{try{await es("customize")}catch{}},eG=s(()=>{er()},[er]),eO=e=>{eb(e),eg("vendors"),ea({tab:"vendors"})};S(!!(ev&&eN&&eI.trapFocus),ec,{initialFocus:"first-tabbable"}),N(!!(eN&&eI.scrollLock)),l(()=>{if(!eN)return;let e=e=>{i(e.key)&&(e.preventDefault(),eG())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[eG,eN]),l(()=>{let e=requestAnimationFrame(()=>eC(!0));return()=>cancelAnimationFrame(e)},[]),l(()=>{if(eN){let e=requestAnimationFrame(()=>ek(!0));return()=>cancelAnimationFrame(e)}if(eI.disableAnimation){let e=requestAnimationFrame(()=>ek(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{ek(!1)},150);return()=>clearTimeout(e)},[eN,eI.disableAnimation]);let e_=m(!!_);l(()=>{let e=Z?.preferenceCenterTab;if(!(eN&&e))return;if(e_.current){e_.current=!1;return}let t=requestAnimationFrame(()=>{eg(e)});return()=>cancelAnimationFrame(t)},[eN,Z?.preferenceCenterTab]),d(()=>{let e,t;if("purposes"!==eu&&"vendors"!==eu)return;let o=em.current;if(!o||null===ep.current)return;let n=ep.current;if(ep.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)}},[eu]);let eJ=s(e=>{em.current&&(ep.current=em.current.offsetHeight),eg(e),ea({tab:e})},[ea]),eK=c(()=>({uiSource:Q??"iab_dialog"}),[Q]);if(!ev||!Z?.config.enabled)return null;let eQ=Z.isLoadingGVL||!Z.gvl,eU=L(Y?.["iab-dialog"]?.root,{baseClassName:`${a.root} ${eS?a.dialogVisible:a.dialogHidden}`,noStyle:eI.noStyle}),eX=L(Y?.["iab-dialog"]?.card,{baseClassName:`${a.card} ${eS?a.contentVisible:a.contentHidden}`,noStyle:eI.noStyle}),eY=L(Y?.["iab-dialog"]?.header,{baseClassName:a.header,noStyle:eI.noStyle}),eZ=L(Y?.["iab-dialog"]?.headerContent,{baseClassName:a.headerContent,noStyle:eI.noStyle}),e1=L(Y?.["iab-dialog"]?.title,{baseClassName:a.title,noStyle:eI.noStyle}),e0=L(Y?.["iab-dialog"]?.description,{baseClassName:a.description,noStyle:eI.noStyle}),e2=L(Y?.["iab-dialog"]?.closeButton,{baseClassName:a.closeButton,noStyle:eI.noStyle}),e7=L(Y?.["iab-dialog"]?.body,{baseClassName:a.body,noStyle:eI.noStyle}),e4=L(Y?.["iab-dialog"]?.tabs,{baseClassName:a.tabsContainer,noStyle:eI.noStyle}),e5=L(Y?.["iab-dialog"]?.tabsList,{baseClassName:a.tabsList,noStyle:eI.noStyle}),e8=L(Y?.["iab-dialog"]?.tabTrigger,{baseClassName:a.tabButton,noStyle:eI.noStyle}),e6=L(Y?.["iab-dialog"]?.tabIndicator,{baseClassName:a.tabIndicator,noStyle:eI.noStyle}),e3=L(Y?.["iab-dialog"]?.content,{baseClassName:a.content,noStyle:eI.noStyle}),e9=L(Y?.["iab-dialog"]?.loading,{baseClassName:a.loadingContainer,noStyle:eI.noStyle}),te=L(Y?.["iab-dialog"]?.tabPanel,{baseClassName:a.tabPanel,noStyle:eI.noStyle}),tt=L(Y?.["iab-dialog"]?.specialPurposes,{baseClassName:a.specialPurposesSection,noStyle:eI.noStyle}),to=L(Y?.["iab-dialog"]?.consentNotice,{baseClassName:a.consentNotice,noStyle:eI.noStyle}),tn=L(Y?.["iab-dialog"]?.actions,{baseClassName:r.actionRoot,noStyle:eI.noStyle}),ti=L(Y?.["iab-dialog"]?.footer,{baseClassName:a.footer,noStyle:eI.noStyle,...tn}),tr=L(Y?.["iab-dialog"]?.actionGroup,{baseClassName:r.actionGroup,"data-direction":"row",noStyle:eI.noStyle}),ta=t(f.Provider,{value:eK,children:o(v.Provider,{value:eI,children:[t(T,{sheets:j,noStyle:eI.noStyle}),t(F,{isOpen:eN}),t("div",{...eU,"data-testid":"iab-consent-dialog-root",dir:ed,children:o("div",{"aria-describedby":"iab-consent-dialog-description",...eX,ref:ec,"aria-label":U.preferenceCenter.title,"aria-modal":eI.trapFocus?"true":void 0,role:"dialog",...z,"data-testid":"iab-consent-dialog-card",children:[o("div",{...eY,children:[o("div",{...eZ,children:[t("h2",{...e1,children:U.preferenceCenter.title}),t("p",{...e0,id:"iab-consent-dialog-description",children:U.preferenceCenter.description})]}),t("button",{...e2,type:"button","data-testid":"iab-consent-dialog-close",onClick:eG,"aria-label":X.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(M.Root,{...e7,noStyle:!0,onValueChange:e=>eJ(e),value:eu,children:[t("div",{...e4,children:o(M.List,{...e5,noStyle:!0,children:[o(M.Trigger,{...e8,noStyle:!0,value:"purposes",children:[U.preferenceCenter.tabs.purposes,!eQ&&` (${eF})`]}),o(M.Trigger,{...e8,noStyle:!0,value:"vendors",children:[U.preferenceCenter.tabs.vendors,!eQ&&` (${eV})`]}),t("div",{...e6,"aria-hidden":"true","data-active-tab":eu})]})}),t("div",{...e3,ref:em,children:eQ?o("div",{...e9,children:[t("div",{className:a.loadingSpinner}),t("p",{className:a.loadingText,children:U.common.loading})]}):o(e,{children:[o(M.Content,{...te,forceMount:!0,noStyle:!0,value:"purposes",children:[ex.map(e=>"stack"===e.kind?t(w,{stack:e,consents:Z.purposeConsents,onToggle:e$,vendorConsents:Z.vendorConsents,onVendorToggle:eq,onVendorClick:eO,vendorLegitimateInterests:Z.vendorLegitimateInterests,onVendorLegitimateInterestToggle:ez,purposeLegitimateInterests:Z.purposeLegitimateInterests,onPurposeLegitimateInterestToggle:eE},e.testId):t(V,{purpose:e,testId:e.testId,isEnabled:"special-feature"===e.toggle?Z.specialFeatureOptIns[e.id]??!1:Z.purposeConsents[e.id]??!1,onToggle:t=>{"special-feature"===e.toggle?eM(e.id,t):e$(e.id,t)},vendorConsents:Z.vendorConsents,onVendorToggle:eq,onVendorClick:eO,vendorLegitimateInterests:Z.vendorLegitimateInterests,onVendorLegitimateInterestToggle:ez,purposeLegitimateInterests:"purpose"===e.kind?Z.purposeLegitimateInterests:void 0,onPurposeLegitimateInterestToggle:"purpose"===e.kind?eE:void 0},e.testId)),eL.length>0&&o("div",{...tt,children:[o("div",{className:a.specialPurposesHeader,children:[o("button",{type:"button","aria-expanded":ey,onClick:()=>ef(!ey),className:a.purposeTrigger,children:[t("svg",{"aria-hidden":"true",className:a.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ey?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:[U.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:[ej," ",1===ej?U.preferenceCenter.vendorList.partnerSingular:U.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":U.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"})]})})]}),ey&&t("div",{style:{padding:"0.75rem"},children:eL.map(e=>t(V,{purpose:e,testId:e.testId,isEnabled:!0,onToggle:()=>{},vendorConsents:Z.vendorConsents,onVendorToggle:eq,onVendorClick:eO,isLocked:!0},e.testId))})]}),eT.length>0&&o("section",{"aria-label":U.preferenceCenter.features.title,className:eI.noStyle?void 0:a.featuresSection,"data-testid":"iab-consent-dialog-features",children:[o("div",{className:eI.noStyle?void 0:a.featuresHeader,children:[t("h3",{className:eI.noStyle?void 0:a.featuresTitle,children:U.preferenceCenter.features.title}),t("p",{className:eI.noStyle?void 0:a.featuresDescription,children:eA??U.preferenceCenter.features.description})]}),t("div",{className:eI.noStyle?void 0:a.featuresList,children:eT.map(e=>t(A,{feature:e,testId:e.testId},e.testId))})]}),t("div",{...to,children:t("p",{className:a.consentNoticeText,children:U.preferenceCenter.footer.consentStorage})})]}),t(M.Content,{...te,forceMount:!0,noStyle:!0,value:"vendors",children:t(P,{vendorData:eR,purposes:ew,vendorConsents:Z.vendorConsents,onVendorToggle:eq,selectedVendorId:eh,onClearSelection:()=>eb(null),customVendors:Z.nonIABVendors,vendorLegitimateInterests:Z.vendorLegitimateInterests,onVendorLegitimateInterestToggle:ez})})]})})]}),o("div",{...ti,children:[o("div",{...tr,children:[t($.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eD,disabled:!ei.isReady,"data-action":"reject",children:U.common.rejectAll}),t($.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eH,disabled:!ei.isReady,"data-action":"accept",children:U.common.acceptAll})]}),t("div",{...tr,children:t($.Root,{variant:"primary",mode:"filled",size:"small",onClick:eW,disabled:eQ,"data-action":"customize",children:U.common.saveSettings})})]}),t(y,{hideBranding:O??!1,variant:"dialog-tag",slotContext:"iab-dialog","data-testid":"iab-consent-dialog-branding"})]})})]})}),ts=!0===J?{}:!1===J?null:J,tl=ts?t(b,{...ts}):null;return eN||eS?o(e,{children:[tl,u(ta,document.body)]}):tl};export{E 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 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 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{IAB_DIALOG_SHEETS as j}from"../shared/iab-dialog-sheets.js";import{SurfaceStyles as T,useSurfaceSheetsReady as A}from"../shared/surface-styles.js";import{FeatureItem as F}from"./atoms/feature-item.js";import{IABConsentDialogOverlay as V}from"./atoms/overlay.js";import{PurposeItem as w}from"./atoms/purpose-item.js";import{StackItem as P}from"./atoms/stack-item.js";import{VendorList as B}from"./atoms/vendor-list.js";import{useIABDisplayModel as R}from"./hooks/use-display-model.js";import{useIABTranslations as $}from"./use-iab-translations.js";import*as M from"../shared/ui/button/index.js";import*as q from"../shared/ui/tabs/index.js";let z=["iab"],E={tabIndex:-1},H=({open:H,noStyle:D,disableAnimation:W,scrollLock:G,trapFocus:O,hideBranding:_,initialTab:J,showTrigger:K=!1,models:Q=z,uiSource:U})=>{let X=$(),{common:Y}=h(),{components:Z}=x(),{iab:ee,activeUI:et,policyDialog:eo,translationConfig:en,model:ei}=k({preferences:{scrollLock:G,trapFocus:O}}),{banner:er,closeUI:ea,openDialog:es,performDialogAction:el}=g(),ed=eo.blocking,ec=I(en.defaultLanguage),em=m(null),ep=m(null),eu=m(null),[eg,eh]=p(J??ee?.preferenceCenterTab??"purposes"),[eb,ey]=p(null),[ef,ev]=p(!1),[eC,eS]=p(!1),[ek,eN]=p(!1),eI=A(j,D)&&null!==ei&&Q.includes(ei)&&(H??"dialog"===et),ex=C({disableAnimation:W,noStyle:D,scrollLock:ed,trapFocus:eo.blocking}),{consentRows:eL,essentialRows:ej,essentialPartnerCount:eT,featureRows:eA,featuresStandardText:eF,purposeTabCount:eV,vendorTabCount:ew,data:{purposes:eP}}=R(),eB=ee?.gvl??null,eR=ee?.publisherRestrictions,e$=c(()=>eB?n(eB,eR):null,[eB,eR]),eM=s((e,t)=>{ee?.setPurposeConsent(e,t)},[ee]),eq=s((e,t)=>{ee?.setSpecialFeatureOptIn(e,t)},[ee]),ez=s((e,t)=>{ee?.setVendorConsent(e,t)},[ee]),eE=s((e,t)=>{ee?.setVendorLegitimateInterest(e,t)},[ee]),eH=s((e,t)=>{ee?.setPurposeLegitimateInterest(e,t)},[ee]),eD=async()=>{try{await el("accept")}catch{}},eW=async()=>{try{await el("reject")}catch{}},eG=async()=>{try{await el("customize")}catch{}},eO=s(()=>{ea()},[ea]),e_=e=>{ey(e),eh("vendors"),es({tab:"vendors"})};S(!!(eC&&eI&&ex.trapFocus),em,{initialFocus:"first-tabbable"}),N(!!(eI&&ex.scrollLock)),l(()=>{if(!eI)return;let e=e=>{i(e.key)&&(e.preventDefault(),eO())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[eO,eI]),l(()=>{let e=requestAnimationFrame(()=>eS(!0));return()=>cancelAnimationFrame(e)},[]),l(()=>{if(eI){let e=requestAnimationFrame(()=>eN(!0));return()=>cancelAnimationFrame(e)}if(ex.disableAnimation){let e=requestAnimationFrame(()=>eN(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{eN(!1)},150);return()=>clearTimeout(e)},[eI,ex.disableAnimation]);let eJ=m(!!J);l(()=>{let e=ee?.preferenceCenterTab;if(!(eI&&e))return;if(eJ.current){eJ.current=!1;return}let t=requestAnimationFrame(()=>{eh(e)});return()=>cancelAnimationFrame(t)},[eI,ee?.preferenceCenterTab]),d(()=>{let e,t;if("purposes"!==eg&&"vendors"!==eg)return;let o=ep.current;if(!o||null===eu.current)return;let n=eu.current;if(eu.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)}},[eg]);let eK=s(e=>{ep.current&&(eu.current=ep.current.offsetHeight),eh(e),es({tab:e})},[es]),eQ=c(()=>({uiSource:U??"iab_dialog"}),[U]);if(!eC||!ee?.config.enabled)return null;let eU=ee.isLoadingGVL||!ee.gvl,eX=L(Z?.["iab-dialog"]?.root,{baseClassName:`${a.root} ${ek?a.dialogVisible:a.dialogHidden}`,noStyle:ex.noStyle}),eY=L(Z?.["iab-dialog"]?.card,{baseClassName:`${a.card} ${ek?a.contentVisible:a.contentHidden}`,noStyle:ex.noStyle}),eZ=L(Z?.["iab-dialog"]?.header,{baseClassName:a.header,noStyle:ex.noStyle}),e1=L(Z?.["iab-dialog"]?.headerContent,{baseClassName:a.headerContent,noStyle:ex.noStyle}),e0=L(Z?.["iab-dialog"]?.title,{baseClassName:a.title,noStyle:ex.noStyle}),e2=L(Z?.["iab-dialog"]?.description,{baseClassName:a.description,noStyle:ex.noStyle}),e7=L(Z?.["iab-dialog"]?.closeButton,{baseClassName:a.closeButton,noStyle:ex.noStyle}),e4=L(Z?.["iab-dialog"]?.body,{baseClassName:a.body,noStyle:ex.noStyle}),e5=L(Z?.["iab-dialog"]?.tabs,{baseClassName:a.tabsContainer,noStyle:ex.noStyle}),e8=L(Z?.["iab-dialog"]?.tabsList,{baseClassName:a.tabsList,noStyle:ex.noStyle}),e6=L(Z?.["iab-dialog"]?.tabTrigger,{baseClassName:a.tabButton,noStyle:ex.noStyle}),e3=L(Z?.["iab-dialog"]?.tabIndicator,{baseClassName:a.tabIndicator,noStyle:ex.noStyle}),e9=L(Z?.["iab-dialog"]?.content,{baseClassName:a.content,noStyle:ex.noStyle}),te=L(Z?.["iab-dialog"]?.loading,{baseClassName:a.loadingContainer,noStyle:ex.noStyle}),tt=L(Z?.["iab-dialog"]?.tabPanel,{baseClassName:a.tabPanel,noStyle:ex.noStyle}),to=L(Z?.["iab-dialog"]?.specialPurposes,{baseClassName:a.specialPurposesSection,noStyle:ex.noStyle}),tn=L(Z?.["iab-dialog"]?.consentNotice,{baseClassName:a.consentNotice,noStyle:ex.noStyle}),ti=L(Z?.["iab-dialog"]?.actions,{baseClassName:r.actionRoot,noStyle:ex.noStyle}),tr=L(Z?.["iab-dialog"]?.footer,{baseClassName:a.footer,noStyle:ex.noStyle,...ti}),ta=L(Z?.["iab-dialog"]?.actionGroup,{baseClassName:r.actionGroup,"data-direction":"row",noStyle:ex.noStyle}),ts=t(f.Provider,{value:eQ,children:o(v.Provider,{value:ex,children:[t(T,{sheets:j,noStyle:ex.noStyle}),t(V,{isOpen:eI}),t("div",{...eX,"data-testid":"iab-consent-dialog-root",dir:ec,children:o("div",{"aria-describedby":"iab-consent-dialog-description",...eY,ref:em,"aria-label":X.preferenceCenter.title,"aria-modal":ex.trapFocus?"true":void 0,role:"dialog",...E,"data-testid":"iab-consent-dialog-card",children:[o("div",{...eZ,children:[o("div",{...e1,children:[t("h2",{...e0,children:X.preferenceCenter.title}),t("p",{...e2,id:"iab-consent-dialog-description",children:X.preferenceCenter.description})]}),t("button",{...e7,type:"button","data-testid":"iab-consent-dialog-close",onClick:eO,"aria-label":Y.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(q.Root,{...e4,noStyle:!0,onValueChange:e=>eK(e),value:eg,children:[t("div",{...e5,children:o(q.List,{...e8,noStyle:!0,children:[o(q.Trigger,{...e6,noStyle:!0,value:"purposes",children:[X.preferenceCenter.tabs.purposes,!eU&&` (${eV})`]}),o(q.Trigger,{...e6,noStyle:!0,value:"vendors",children:[X.preferenceCenter.tabs.vendors,!eU&&` (${ew})`]}),t("div",{...e3,"aria-hidden":"true","data-active-tab":eg})]})}),t("div",{...e9,ref:ep,children:eU?o("div",{...te,children:[t("div",{className:a.loadingSpinner}),t("p",{className:a.loadingText,children:X.common.loading})]}):o(e,{children:[o(q.Content,{...tt,forceMount:!0,noStyle:!0,value:"purposes",children:[eL.map(e=>"stack"===e.kind?t(P,{stack:e,consents:ee.purposeConsents,onToggle:eM,vendorConsents:ee.vendorConsents,onVendorToggle:ez,onVendorClick:e_,vendorLegitimateInterests:ee.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eE,purposeLegitimateInterests:ee.purposeLegitimateInterests,onPurposeLegitimateInterestToggle:eH},e.testId):t(w,{purpose:e,testId:e.testId,isEnabled:"special-feature"===e.toggle?ee.specialFeatureOptIns[e.id]??!1:ee.purposeConsents[e.id]??!1,onToggle:t=>{"special-feature"===e.toggle?eq(e.id,t):eM(e.id,t)},vendorConsents:ee.vendorConsents,onVendorToggle:ez,onVendorClick:e_,vendorLegitimateInterests:ee.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eE,purposeLegitimateInterests:"purpose"===e.kind?ee.purposeLegitimateInterests:void 0,onPurposeLegitimateInterestToggle:"purpose"===e.kind?eH:void 0},e.testId)),ej.length>0&&o("div",{...to,children:[o("div",{className:a.specialPurposesHeader,children:[o("button",{type:"button","aria-expanded":ef,onClick:()=>ev(!ef),className:a.purposeTrigger,children:[t("svg",{"aria-hidden":"true",className:a.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ef?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:[X.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:[eT," ",1===eT?X.preferenceCenter.vendorList.partnerSingular:X.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":X.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"})]})})]}),ef&&t("div",{style:{padding:"0.75rem"},children:ej.map(e=>t(w,{purpose:e,testId:e.testId,isEnabled:!0,onToggle:()=>{},vendorConsents:ee.vendorConsents,onVendorToggle:ez,onVendorClick:e_,isLocked:!0},e.testId))})]}),eA.length>0&&o("section",{"aria-label":X.preferenceCenter.features.title,className:ex.noStyle?void 0:a.featuresSection,"data-testid":"iab-consent-dialog-features",children:[o("div",{className:ex.noStyle?void 0:a.featuresHeader,children:[t("h3",{className:ex.noStyle?void 0:a.featuresTitle,children:X.preferenceCenter.features.title}),t("p",{className:ex.noStyle?void 0:a.featuresDescription,children:eF??X.preferenceCenter.features.description})]}),t("div",{className:ex.noStyle?void 0:a.featuresList,children:eA.map(e=>t(F,{feature:e,testId:e.testId},e.testId))})]}),t("div",{...tn,children:t("p",{className:a.consentNoticeText,children:X.preferenceCenter.footer.consentStorage})})]}),t(q.Content,{...tt,forceMount:!0,noStyle:!0,value:"vendors",children:t(B,{vendorData:e$,purposes:eP,vendorConsents:ee.vendorConsents,onVendorToggle:ez,selectedVendorId:eb,onClearSelection:()=>ey(null),customVendors:ee.nonIABVendors,vendorLegitimateInterests:ee.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eE})})]})})]}),o("div",{...tr,children:[o("div",{...ta,children:[t(M.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eW,disabled:!er.isReady,"data-action":"reject",children:X.common.rejectAll}),t(M.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eD,disabled:!er.isReady,"data-action":"accept",children:X.common.acceptAll})]}),t("div",{...ta,children:t(M.Root,{variant:"primary",mode:"filled",size:"small",onClick:eG,disabled:eU,"data-action":"customize",children:X.common.saveSettings})})]}),t(y,{hideBranding:_??!1,variant:"dialog-tag",slotContext:"iab-dialog","data-testid":"iab-consent-dialog-branding"})]})})]})}),tl=!0===K?{}:!1===K?null:K,td=tl?t(b,{...tl}):null;return eI||ek?o(e,{children:[td,u(ts,document.body)]}):td};export{H as IABConsentDialog};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{Fragment as e,jsx as t,jsxs as o}from"react/jsx-runtime";import r from"@c15t/ui/styles/components/iab-consent-banner";import{forwardRef as n,useMemo as s}from"react";import{ConsentTrackingContext as a}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 d}from"../../../hooks/use-iab-manager.js";import{useLateEntry as p}from"../../../hooks/use-late-entry.js";import{useTextDirection as b}from"../../../hooks/use-text-direction.js";import{useUIConfig as f}from"../../../ui-config-context.js";import{mergeSlotProps as u}from"../../../utils/merge-slot-props.js";import{IAB_FIRST_PAINT_SHEETS as h}from"../../shared/iab-first-paint-sheets.js";import{SurfaceStyles as j}from"../../shared/surface-styles.js";import{IABConsentBannerOverlay as g}from"./overlay.js";let x=["iab"],y=n(({children:n,className:s,style:a,className:i,disableAnimation:d,noStyle:y,models:N=x,...k},v)=>{let B=m(),{components:C}=f(),$=l(),A=c(),I=b(A?.language??"en"),S=null!==$&&"banner"===B&&N.includes($),P=p(S)&&!d,R=u(C?.["iab-banner"]?.root,{baseClassName:[r.root],className:s||i,noStyle:y,style:a,...k}),E=y?R.className||"":`${R.className||""} ${r.bannerVisible}${d?"":` ${r.bannerEntering}`}`;return S?o(e,{children:[t(j,{sheets:h,noStyle:y}),t(g,{}),o("div",{ref:v,...R,className:E,"data-position":"ltr"===I?"bottom-left":"bottom-right","data-entry":P?"late":void 0,"data-testid":"iab-consent-banner-root","data-c15t-streamed":"",dir:I,tabIndex:-1,children:[n,t("span",{"data-c15t-stream-end":"",hidden:!0})]})]}):null}),N=({children:e,className:o,noStyle:r,disableAnimation:n,scrollLock:m,trapFocus:l,models:c,uiSource:p,...b})=>{let{policyBanner:f}=d({prompt:{scrollLock:m,trapFocus:l}}),u=f.blocking,h=s(()=>({disableAnimation:n,noStyle:r,scrollLock:u,trapFocus:u}),[n,r,u]),j=s(()=>({uiSource:p??"iab_banner"}),[p]);return t(a.Provider,{value:j,children:t(i.Provider,{value:h,children:t(y,{disableAnimation:n,className:o,noStyle:r,models:c,...b,children:e})})})};y.displayName="IABConsentBannerRootChildren";export{N as IABConsentBannerRoot};
2
+ import{Fragment as e,jsx as t,jsxs as o}from"react/jsx-runtime";import r from"@c15t/ui/styles/components/iab-consent-banner";import{forwardRef as n,useMemo as s}from"react";import{ConsentTrackingContext as a}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 d}from"../../../hooks/use-iab-manager.js";import{useLateEntry as p}from"../../../hooks/use-late-entry.js";import{useTextDirection as b}from"../../../hooks/use-text-direction.js";import{useUIConfig as f}from"../../../ui-config-context.js";import{mergeSlotProps as u}from"../../../utils/merge-slot-props.js";import{IAB_FIRST_PAINT_SHEETS as h}from"../../shared/iab-first-paint-sheets.js";import{SurfaceStyles as j,useSurfaceSheetsReady as g}from"../../shared/surface-styles.js";import{IABConsentBannerOverlay as x}from"./overlay.js";let y=["iab"],N=n(({children:n,className:s,style:a,className:i,disableAnimation:d,noStyle:N,models:k=y,...v},B)=>{let C=m(),{components:$}=f(),A=l(),I=c(),S=b(I?.language??"en"),P=g(h,N)&&null!==A&&"banner"===C&&k.includes(A),R=p(P)&&!d,E=u($?.["iab-banner"]?.root,{baseClassName:[r.root],className:s||i,noStyle:N,style:a,...v}),F=N?E.className||"":`${E.className||""} ${r.bannerVisible}${d?"":` ${r.bannerEntering}`}`;return P?o(e,{children:[t(j,{sheets:h,noStyle:N}),t(x,{}),o("div",{ref:B,...E,className:F,"data-position":"ltr"===S?"bottom-left":"bottom-right","data-entry":R?"late":void 0,"data-testid":"iab-consent-banner-root","data-c15t-streamed":"",dir:S,tabIndex:-1,children:[n,t("span",{"data-c15t-stream-end":"",hidden:!0})]})]}):null}),k=({children:e,className:o,noStyle:r,disableAnimation:n,scrollLock:m,trapFocus:l,models:c,uiSource:p,...b})=>{let{policyBanner:f}=d({prompt:{scrollLock:m,trapFocus:l}}),u=f.blocking,h=s(()=>({disableAnimation:n,noStyle:r,scrollLock:u,trapFocus:u}),[n,r,u]),j=s(()=>({uiSource:p??"iab_banner"}),[p]);return t(a.Provider,{value:j,children:t(i.Provider,{value:h,children:t(N,{disableAnimation:n,className:o,noStyle:r,models:c,...b,children:e})})})};N.displayName="IABConsentBannerRootChildren";export{k as IABConsentBannerRoot};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"@c15t/ui/styles/components/consent-actions";import a from"@c15t/ui/styles/components/iab-consent-banner";import{useHeadlessIABConsentUI as o}from"../../component-hooks/use-headless-iab-consent-ui.js";import{Box as i}from"../shared/primitives/box.js";import{BrandingLink as r}from"../shared/ui/branding.js";import{useComponentConfig as s}from"../../hooks/use-component-config.js";import{useIABConsentManager as l}from"../../hooks/use-iab-manager.js";import{useUIConfig as c}from"../../ui-config-context.js";import{mergeSlotProps as m}from"../../utils/merge-slot-props.js";import{useIABTranslations as b}from"../iab-panel/use-iab-translations.js";import{IABConsentBannerCard as d}from"./atoms/card.js";import{IABConsentBannerRoot as p}from"./atoms/root.js";import*as u from"../shared/ui/button/index.js";let h=({noStyle:h,disableAnimation:y,scrollLock:S,trapFocus:f,primaryButton:C="customize",models:g,uiSource:k})=>{let j=b(),{iab:N,banner:v,openVendorsDialog:z,performBannerAction:L}=o(),{policyBanner:x}=l({prompt:{scrollLock:S,trapFocus:f}}),{components:A}=c(),I=s({disableAnimation:y,noStyle:h,scrollLock:x.blocking,trapFocus:x.blocking}),R=async()=>{try{await L("accept")}catch{}},w=async()=>{try{await L("reject")}catch{}};if(!N?.config.enabled||!v.isReady)return null;let M=j.banner.description.replace("{partnerCount}",String(v.vendorCount)),B=j.banner.partnersLink.replace("{count}",String(v.vendorCount)),F=j.banner.scopeServiceSpecific,K=m(A?.["iab-banner"]?.title,{baseClassName:a.title,noStyle:I.noStyle}),G=m(A?.["iab-banner"]?.description,{baseClassName:a.description,noStyle:I.noStyle}),$=m(A?.["iab-banner"]?.partnersLink,{baseClassName:a.partnersLink,noStyle:I.noStyle}),E=m(A?.["iab-banner"]?.purposeList,{baseClassName:a.purposeList,noStyle:I.noStyle}),q=m(A?.["iab-banner"]?.purposeMore,{baseClassName:a.purposeMore,noStyle:I.noStyle}),D=m(A?.["iab-banner"]?.legitimateInterestNotice,{baseClassName:a.legitimateInterestNotice,noStyle:I.noStyle}),H=m(A?.["iab-banner"]?.actions,{baseClassName:n.actionRoot,"data-direction":"row","data-split":!0,noStyle:I.noStyle}),J=m(A?.["iab-banner"]?.actionGroup,{baseClassName:n.actionGroup,"data-direction":"row",noStyle:I.noStyle});return e(p,{...I,models:g,uiSource:k,children:t(i,{baseClassName:a.cardShell,slotKey:"iab-banner.cardShell",children:[e(r,{hideBranding:!1,variant:"banner-tag",slotContext:"iab-banner","data-testid":"iab-consent-banner-branding"}),t(d,{"aria-label":j.banner.title,children:[t(i,{baseClassName:a.header,slotKey:"iab-banner.header","data-testid":"iab-consent-banner-header",children:[e("h2",{...K,children:j.banner.title}),t("p",{...G,children:[M.split(B)[0],e("button",{...$,type:"button","data-testid":"iab-consent-banner-partners-link",onClick:()=>{z()},onMouseEnter:()=>{},children:B}),M.split(B)[1]]}),t("ul",{...E,children:[v.displayItems.map((t,n)=>e("li",{children:t},n)),v.remainingCount>0&&e("li",{...q,children:j.banner.andMore.replace("{count}",String(v.remainingCount))})]}),e("p",{...D,children:`${j.banner.legitimateInterestNotice} ${F}`})]}),t(i,{baseClassName:a.footer,slotKey:"iab-banner.footer","data-testid":"iab-consent-banner-footer",...H,children:[t("div",{...J,children:[e(u.Root,{variant:"reject"===C?"primary":"neutral",mode:"stroke",size:"small",onClick:w,"data-action":"reject","data-testid":"iab-consent-banner-reject-button",children:j.common.rejectAll}),e(u.Root,{variant:"accept"===C?"primary":"neutral",mode:"accept"===C?"filled":"stroke",size:"small",onClick:R,"data-action":"accept","data-testid":"iab-consent-banner-accept-button",children:j.common.acceptAll})]}),e("div",{...J,children:e(u.Root,{variant:"customize"===C?"primary":"neutral",mode:"customize"===C?"filled":"stroke",size:"small",onClick:()=>{L("customize")},"data-action":"customize","data-testid":"iab-consent-banner-customize-button",children:j.common.customize})})]})]})]})})};export{h as IABConsentBanner};
2
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import t from"@c15t/ui/styles/components/consent-actions";import a from"@c15t/ui/styles/components/iab-consent-banner";import{warmDialogChunk as o}from"../../chunk-warming.js";import{useHeadlessIABConsentUI as r}from"../../component-hooks/use-headless-iab-consent-ui.js";import{Box as i}from"../shared/primitives/box.js";import{BrandingLink as s}from"../shared/ui/branding.js";import{useComponentConfig as c}from"../../hooks/use-component-config.js";import{useIABConsentManager as l}from"../../hooks/use-iab-manager.js";import{useUIConfig as m}from"../../ui-config-context.js";import{mergeSlotProps as b}from"../../utils/merge-slot-props.js";import{useIABTranslations as d}from"../iab-panel/use-iab-translations.js";import{IABConsentBannerCard as p}from"./atoms/card.js";import{IABConsentBannerRoot as u}from"./atoms/root.js";import*as h from"../shared/ui/button/index.js";let y=({noStyle:y,disableAnimation:S,scrollLock:f,trapFocus:C,primaryButton:g="customize",models:k,uiSource:j})=>{let N=d(),{iab:v,banner:z,openVendorsDialog:L,performBannerAction:x}=r(),{policyBanner:F}=l({prompt:{scrollLock:f,trapFocus:C}}),{components:w}=m(),A=c({disableAnimation:S,noStyle:y,scrollLock:F.blocking,trapFocus:F.blocking}),I=async()=>{try{await x("accept")}catch{}},R=async()=>{try{await x("reject")}catch{}};if(!v?.config.enabled||!z.isReady)return null;let B=N.banner.description.replace("{partnerCount}",String(z.vendorCount)),E=N.banner.partnersLink.replace("{count}",String(z.vendorCount)),K=N.banner.scopeServiceSpecific,M=b(w?.["iab-banner"]?.title,{baseClassName:a.title,noStyle:A.noStyle}),P=b(w?.["iab-banner"]?.description,{baseClassName:a.description,noStyle:A.noStyle}),G=b(w?.["iab-banner"]?.partnersLink,{baseClassName:a.partnersLink,noStyle:A.noStyle}),$=b(w?.["iab-banner"]?.purposeList,{baseClassName:a.purposeList,noStyle:A.noStyle}),q=b(w?.["iab-banner"]?.purposeMore,{baseClassName:a.purposeMore,noStyle:A.noStyle}),D=b(w?.["iab-banner"]?.legitimateInterestNotice,{baseClassName:a.legitimateInterestNotice,noStyle:A.noStyle}),H=b(w?.["iab-banner"]?.actions,{baseClassName:t.actionRoot,"data-direction":"row","data-split":!0,noStyle:A.noStyle}),J=b(w?.["iab-banner"]?.actionGroup,{baseClassName:t.actionGroup,"data-direction":"row",noStyle:A.noStyle});return e(u,{...A,models:k,uiSource:j,children:n(i,{baseClassName:a.cardShell,slotKey:"iab-banner.cardShell",children:[e(s,{hideBranding:!1,variant:"banner-tag",slotContext:"iab-banner","data-testid":"iab-consent-banner-branding"}),n(p,{"aria-label":N.banner.title,children:[n(i,{baseClassName:a.header,slotKey:"iab-banner.header","data-testid":"iab-consent-banner-header",children:[e("h2",{...M,children:N.banner.title}),n("p",{...P,children:[B.split(E)[0],e("button",{...G,type:"button","data-testid":"iab-consent-banner-partners-link",onClick:()=>{L()},onFocus:e=>{G.onFocus?.(e),o()},onPointerEnter:e=>{G.onPointerEnter?.(e),o()},children:E}),B.split(E)[1]]}),n("ul",{...$,children:[z.displayItems.map((n,t)=>e("li",{children:n},t)),z.remainingCount>0&&e("li",{...q,children:N.banner.andMore.replace("{count}",String(z.remainingCount))})]}),e("p",{...D,children:`${N.banner.legitimateInterestNotice} ${K}`})]}),n(i,{baseClassName:a.footer,slotKey:"iab-banner.footer","data-testid":"iab-consent-banner-footer",...H,children:[n("div",{...J,children:[e(h.Root,{variant:"reject"===g?"primary":"neutral",mode:"stroke",size:"small",onClick:R,"data-action":"reject","data-testid":"iab-consent-banner-reject-button",children:N.common.rejectAll}),e(h.Root,{variant:"accept"===g?"primary":"neutral",mode:"accept"===g?"filled":"stroke",size:"small",onClick:I,"data-action":"accept","data-testid":"iab-consent-banner-accept-button",children:N.common.acceptAll})]}),e("div",{...J,children:e(h.Root,{variant:"customize"===g?"primary":"neutral",mode:"customize"===g?"filled":"stroke",size:"small",onClick:()=>{x("customize")},onFocus:o,onPointerEnter:o,"data-action":"customize","data-testid":"iab-consent-banner-customize-button",children:N.common.customize})})]})]})]})})};export{y as IABConsentBanner};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{Fragment as o,jsx as e,jsxs as t}from"react/jsx-runtime";import{isDialogDismissKey as r}from"@c15t/ui/primitives/dialog";import i from"@c15t/ui/styles/components/consent-dialog";import{useEffect as n,useMemo as s,useRef as l,useState as a}from"react";import{createPortal as m}from"react-dom";import{useHeadlessConsentUI as c}from"../../../component-hooks/use-headless-consent-ui.js";import{ConsentTrackingContext as d}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as u}from"../../../context/theme-context.js";import{useActiveUI as p,useHasConsentUI as f,useModel as h}from"../../../hooks.js";import{useFocusTrap as g}from"../../../hooks/use-focus-trap.js";import{useIABPolicyGuard as b}from"../../../hooks/use-iab-policy-guard.js";import{useIsHydrated as k}from"../../../hooks/use-is-hydrated.js";import{useScrollLock as j}from"../../../hooks/use-scroll-lock.js";import{useTextDirection as y}from"../../../hooks/use-text-direction.js";import{useTheme as v}from"../../../hooks/use-theme.js";import{useTranslationLanguage as x}from"../../../kernel-selector.js";import{useUIConfig as F}from"../../../ui-config-context.js";import{cnExt as A}from"../../../utils/cn.js";import{mergeSlotProps as L}from"../../../utils/merge-slot-props.js";import{DIALOG_SHEETS as N}from"../../shared/dialog-sheets.js";import{SurfaceStyles as S}from"../../shared/surface-styles.js";import{Overlay as C}from"./overlay.js";let q=["opt-in","opt-out","none"],w=({children:w,open:D,models:E=q,noStyle:H,disableAnimation:I,scrollLock:P,trapFocus:R,overlay:T,uiSource:V,className:z,style:B,...G})=>{var J;let K,M,O;b();let Q=v(),{components:U}=F(),W=p(),X=h(),Y=x(),{closeUI:Z,dialog:$}=c({preferences:{scrollLock:P,trapFocus:R}}),{disableAnimation:_,noStyle:oo,scrollLock:oe,trapFocus:ot}=(K=Q.disableAnimation,M=Q.noStyle,{disableAnimation:I??K??!1,noStyle:H??M??!1,scrollLock:O=$.blocking,trapFocus:O}),or=y(Y),oi=(J=f(),!!J&&!!E.includes(X??"opt-in")&&(D??"dialog"===W)),[on,os]=a(!1),ol=l(null),oa=l(null),om=k(),oc=Q.theme?.motion?.duration?.normal;n(()=>{if(oi){let o=requestAnimationFrame(()=>os(!0));return()=>cancelAnimationFrame(o)}if(_){let o=requestAnimationFrame(()=>os(!1));return()=>cancelAnimationFrame(o)}let o=setTimeout(()=>os(!1),Number.parseInt((oc||"200ms").replace("ms",""),10));return()=>clearTimeout(o)},[oi,_,oc]),g(oi&&ot,oa,{initialFocus:"first-tabbable"}),n(()=>{if(!oi)return;let o=o=>{r(o.key)&&(o.preventDefault(),Z())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[Z,oi]),j(oi&&oe);let od=_?i.root:A(i.root,on?i.dialogVisible:i.dialogHidden),ou=L(U?.dialog?.root,{baseClassName:od,className:z,noStyle:oo,style:B,...G}),op=L(U?.dialog?.container,{baseClassName:A(i.container,!_&&(on?i.contentVisible:i.contentHidden)),noStyle:oo}),of=s(()=>({disableAnimation:_,noStyle:oo,scrollLock:oe,theme:Q.theme,trapFocus:ot}),[_,Q.theme,oo,oe,ot]),oh=s(()=>({uiSource:V??"dialog"}),[V]),og=$.blocking?"true":void 0,ob=e(d.Provider,{value:oh,children:e(u.Provider,{value:of,children:oi&&t(o,{children:[e(S,{sheets:N,noStyle:oo}),$.blocking&&!1!==T?T??e(C,{open:oi}):null,e("div",{ref:ol,"data-slot":"dialog-positioner","data-blocking":og,...ou,className:ou.className,children:e("div",{ref:oa,...op,"aria-describedby":"consent-dialog-description","aria-labelledby":"consent-dialog-title","aria-modal":ot?"true":void 0,"data-blocking":og,"data-testid":"consent-dialog-root",dir:or,role:"dialog",tabIndex:-1,children:w})})]})})});return om?m(ob,document.body):null},D=w;export{w as ConsentDialogRoot,D as Root};
2
+ import{Fragment as o,jsx as e,jsxs as t}from"react/jsx-runtime";import{isDialogDismissKey as r}from"@c15t/ui/primitives/dialog";import i from"@c15t/ui/styles/components/consent-dialog";import{useEffect as n,useMemo as s,useRef as l,useState as a}from"react";import{createPortal as m}from"react-dom";import{useHeadlessConsentUI as c}from"../../../component-hooks/use-headless-consent-ui.js";import{ConsentTrackingContext as d}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as u}from"../../../context/theme-context.js";import{useActiveUI as p,useHasConsentUI as f,useModel as h}from"../../../hooks.js";import{useFocusTrap as g}from"../../../hooks/use-focus-trap.js";import{useIABPolicyGuard as b}from"../../../hooks/use-iab-policy-guard.js";import{useIsHydrated as k}from"../../../hooks/use-is-hydrated.js";import{useScrollLock as j}from"../../../hooks/use-scroll-lock.js";import{useTextDirection as y}from"../../../hooks/use-text-direction.js";import{useTheme as v}from"../../../hooks/use-theme.js";import{useTranslationLanguage as x}from"../../../kernel-selector.js";import{useUIConfig as F}from"../../../ui-config-context.js";import{cnExt as A}from"../../../utils/cn.js";import{mergeSlotProps as L}from"../../../utils/merge-slot-props.js";import{DIALOG_SHEETS as N}from"../../shared/dialog-sheets.js";import{SurfaceStyles as S,useSurfaceSheetsReady as C}from"../../shared/surface-styles.js";import{Overlay as q}from"./overlay.js";let w=["opt-in","opt-out","none"],D=({children:D,open:E,models:H=w,noStyle:I,disableAnimation:P,scrollLock:R,trapFocus:T,overlay:V,uiSource:z,className:B,style:G,...J})=>{var K;let M,O,Q;b();let U=v(),{components:W}=F(),X=p(),Y=h(),Z=x(),{closeUI:$,dialog:_}=c({preferences:{scrollLock:R,trapFocus:T}}),{disableAnimation:oo,noStyle:oe,scrollLock:ot,trapFocus:or}=(M=U.disableAnimation,O=U.noStyle,{disableAnimation:P??M??!1,noStyle:I??O??!1,scrollLock:Q=_.blocking,trapFocus:Q}),oi=y(Z),on=f(),os=(K=C(N,oe),!!on&&!!H.includes(Y??"opt-in")&&K&&(E??"dialog"===X)),[ol,oa]=a(!1),om=l(null),oc=l(null),od=k(),ou=U.theme?.motion?.duration?.normal;n(()=>{if(os){let o=requestAnimationFrame(()=>oa(!0));return()=>cancelAnimationFrame(o)}if(oo){let o=requestAnimationFrame(()=>oa(!1));return()=>cancelAnimationFrame(o)}let o=setTimeout(()=>oa(!1),Number.parseInt((ou||"200ms").replace("ms",""),10));return()=>clearTimeout(o)},[os,oo,ou]),g(os&&or,oc,{initialFocus:"first-tabbable"}),n(()=>{if(!os)return;let o=o=>{r(o.key)&&(o.preventDefault(),$())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[$,os]),j(os&&ot);let op=oo?i.root:A(i.root,ol?i.dialogVisible:i.dialogHidden),of=L(W?.dialog?.root,{baseClassName:op,className:B,noStyle:oe,style:G,...J}),oh=L(W?.dialog?.container,{baseClassName:A(i.container,!oo&&(ol?i.contentVisible:i.contentHidden)),noStyle:oe}),og=s(()=>({disableAnimation:oo,noStyle:oe,scrollLock:ot,theme:U.theme,trapFocus:or}),[oo,U.theme,oe,ot,or]),ob=s(()=>({uiSource:z??"dialog"}),[z]),ok=_.blocking?"true":void 0,oj=e(d.Provider,{value:ob,children:e(u.Provider,{value:og,children:os&&t(o,{children:[e(S,{sheets:N,noStyle:oe}),_.blocking&&!1!==V?V??e(q,{open:os}):null,e("div",{ref:om,"data-slot":"dialog-positioner","data-blocking":ok,...of,className:of.className,children:e("div",{ref:oc,...oh,"aria-describedby":"consent-dialog-description","aria-labelledby":"consent-dialog-title","aria-modal":or?"true":void 0,"data-blocking":ok,"data-testid":"consent-dialog-root",dir:oi,role:"dialog",tabIndex:-1,children:D})})]})})});return od?m(oj,document.body):null},E=D;export{D as ConsentDialogRoot,E as Root};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as r,jsxs as o}from"react/jsx-runtime";import{createContext as t,useContext as e,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{useConsentDialogTrigger as n}from"../../../component-hooks/use-panel-trigger.js";import{useBranding as m}from"../../../hooks.js";import{useIsHydrated as g}from"../../../hooks/use-is-hydrated.js";import{FIRST_PAINT_SHEETS as a}from"../../shared/first-paint-sheets.js";import{SurfaceStyles as l}from"../../shared/surface-styles.js";import{useDraggable as p}from"../use-draggable.js";let u=t(null),f=function(){let r=e(u);if(!r)throw Error("ConsentDialogTrigger components must be used within a ConsentDialogTrigger.Root");return r},d=({children:t,defaultPosition:e="bottom-right",persistPosition:f=!0,showWhen:d="always",visible:h,onPositionChange:c,onClick:j})=>{let T=m()??"c15t",{isVisible:C,openDialog:b}=n({onClick:j,showWhen:d}),x=h??C,{corner:y,isDragging:k,isSnapping:w,wasDragged:D,handlers:P,dragStyle:R}=p({defaultPosition:e,onPositionChange:c,persistPosition:f}),v=g(),E=s(()=>({branding:T,corner:y,dragStyle:R,handlers:P,isDragging:k,isSnapping:w,isVisible:x,openDialog:b,wasDragged:D}),[T,y,R,P,k,w,x,b,D]);return v&&x?i(o(u.Provider,{value:E,children:[r(l,{sheets:a}),t]}),document.body):null};d.displayName="ConsentDialogTrigger.Root";export{u as TriggerContext,d as TriggerRoot,f as useTriggerContext};
2
+ import{jsx as r,jsxs as o}from"react/jsx-runtime";import{createContext as t,useContext as e,useMemo as s}from"react";import{createPortal as i}from"react-dom";import{useConsentDialogTrigger as n}from"../../../component-hooks/use-panel-trigger.js";import{useBranding as m}from"../../../hooks.js";import{useIsHydrated as g}from"../../../hooks/use-is-hydrated.js";import{FIRST_PAINT_SHEETS as a}from"../../shared/first-paint-sheets.js";import{SurfaceStyles as l,useSurfaceSheetsReady as p}from"../../shared/surface-styles.js";import{useDraggable as u}from"../use-draggable.js";let f=t(null),d=function(){let r=e(f);if(!r)throw Error("ConsentDialogTrigger components must be used within a ConsentDialogTrigger.Root");return r},h=({children:t,defaultPosition:e="bottom-right",persistPosition:d=!0,showWhen:h="always",visible:c,onPositionChange:j,onClick:T})=>{let C=m()??"c15t",{isVisible:b,openDialog:x}=n({onClick:T,showWhen:h}),y=c??b,{corner:k,isDragging:w,isSnapping:D,wasDragged:P,handlers:R,dragStyle:v}=u({defaultPosition:e,onPositionChange:j,persistPosition:d}),E=g(),N=p(a),V=s(()=>({branding:C,corner:k,dragStyle:v,handlers:R,isDragging:w,isSnapping:D,isVisible:y,openDialog:x,wasDragged:P}),[C,k,v,R,w,D,y,x,P]);return E&&y&&N?i(o(f.Provider,{value:V,children:[r(l,{sheets:a}),t]}),document.body):null};h.displayName="ConsentDialogTrigger.Root";export{f as TriggerContext,h as TriggerRoot,d as useTriggerContext};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as o}from"react/jsx-runtime";import{useMemo as t}from"react";import{useDevToolsLauncherAvailable as r}from"../../devtools-launcher.js";import{TriggerButton as e}from"./atoms/button.js";import{TriggerIcon as i}from"./atoms/icon.js";import{TriggerRoot as n,useTriggerContext as s}from"./atoms/root.js";import{TriggerText as a}from"./atoms/text.js";import{TriggerToolbar as m}from"./atoms/toolbar.js";let g=[],l=({icon:s="branding",defaultPosition:a="bottom-right",persistPosition:l=!0,ariaLabel:c="Open privacy settings",showWhen:p="always",size:f="md",className:T,noStyle:j,onClick:u,onPositionChange:b})=>{let d=r(),h=t(()=>({className:T,icon:s,label:c}),[c,T,s]);return o(n,{defaultPosition:a,persistPosition:l,showWhen:p,onClick:u,onPositionChange:b,children:d?o(m,{actions:g,noStyle:j,preferences:h,size:f}):o(e,{size:f,ariaLabel:c,className:T,noStyle:j,children:o(i,{icon:s,noStyle:j})})})};l.displayName="ConsentDialogTrigger";let c=Object.assign(l,{Button:e,Icon:i,Root:n,Text:a});export{c as ConsentDialogTrigger,e as TriggerButton,i as TriggerIcon,n as TriggerRoot,a as TriggerText,s as useTriggerContext};
2
+ import{jsx as t}from"react/jsx-runtime";import{createElement as o,useEffect as r,useMemo as e,useState as i}from"react";import{useDevToolsLauncherAvailable as n}from"../../devtools-launcher.js";import{TriggerButton as s}from"./atoms/button.js";import{TriggerIcon as a}from"./atoms/icon.js";import{TriggerRoot as l,useTriggerContext as m}from"./atoms/root.js";import{TriggerText as g}from"./atoms/text.js";import{getTriggerToolbar as c,loadTriggerToolbar as p}from"./toolbar-loader.js";let f=[],u=({fallback:t,...e})=>{let[n,s]=i(void 0),a=n??c();return r(()=>{if(a)return;let t=!0;return(async()=>{try{let o=await p();t&&s(()=>o)}catch{}})(),()=>{t=!1}},[a]),a?o(a,e):t},d=({icon:o="branding",defaultPosition:r="bottom-right",persistPosition:i=!0,ariaLabel:m="Open privacy settings",showWhen:g="always",size:c="md",className:p,noStyle:d,onClick:T,onPositionChange:b})=>{let h=n(),j=e(()=>({className:p,icon:o,label:m}),[m,p,o]),y=t(s,{size:c,ariaLabel:m,className:p,noStyle:d,children:t(a,{icon:o,noStyle:d})});return t(l,{defaultPosition:r,persistPosition:i,showWhen:g,onClick:T,onPositionChange:b,children:h?t(u,{actions:f,fallback:y,noStyle:d,preferences:j,size:c}):y})};d.displayName="ConsentDialogTrigger";let T=Object.assign(d,{Button:s,Icon:a,Root:l,Text:g});export{T as ConsentDialogTrigger,s as TriggerButton,a as TriggerIcon,l as TriggerRoot,g as TriggerText,m as useTriggerContext};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ let r,o;let e=function(o){r=o},a=function(){return r},t=function(){return r?Promise.resolve(r):o??=(async()=>{try{let o=await import("./atoms/toolbar.js");return r??=o.TriggerToolbar}catch(r){throw o=void 0,r}})()};export{a as getTriggerToolbar,t as loadTriggerToolbar,e as registerTriggerToolbar};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{Fragment as e,jsx as r,jsxs as t}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/consent-manager";import{useMemo as i}from"react";import{DIALOG_SHEETS as s}from"../../shared/dialog-sheets.js";import{Box as m}from"../../shared/primitives/box.js";import{SurfaceStyles as n}from"../../shared/surface-styles.js";import{ConsentTrackingContext as c,useConsentTracking as a}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as l}from"../../../context/theme-context.js";import{ConsentDraftProvider as d}from"../../../draft.js";import{useHasConsentUI as f}from"../../../hooks.js";import{useTextDirection as h}from"../../../hooks/use-text-direction.js";import{useTranslationLanguage as p}from"../../../kernel-selector.js";let u=({children:u,noStyle:j=!1,disableAnimation:g=!1,useProvider:x=!0,uiSource:v})=>{let k=h(p()),y=a(),P=i(()=>({disableAnimation:g,noStyle:j}),[g,j]),S=v??y.uiSource??"widget",b=i(()=>({uiSource:S}),[S]);if(!f())return null;let w=t(e,{children:[r(n,{sheets:s,noStyle:j}),r(m,{baseClassName:o.manager,"data-testid":"consent-widget-root",slotKey:"manager.root",dir:k,children:u})]});return x?r(c.Provider,{value:b,children:r(l.Provider,{value:P,children:r(d,{children:w})})}):r(c.Provider,{value:b,children:r(d,{children:w})})},j=u;export{u as ConsentWidgetRoot,j as Root};
2
+ import{Fragment as e,jsx as r,jsxs as t}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/consent-manager";import{useMemo as i}from"react";import{DIALOG_SHEETS as s}from"../../shared/dialog-sheets.js";import{Box as m}from"../../shared/primitives/box.js";import{SurfaceStyles as n,useSurfaceSheetsReady as c}from"../../shared/surface-styles.js";import{ConsentTrackingContext as a,useConsentTracking as l}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as d}from"../../../context/theme-context.js";import{ConsentDraftProvider as f}from"../../../draft.js";import{useHasConsentUI as h}from"../../../hooks.js";import{useTextDirection as p}from"../../../hooks/use-text-direction.js";import{useTranslationLanguage as u}from"../../../kernel-selector.js";let j=({children:j,noStyle:g=!1,disableAnimation:x=!1,useProvider:v=!0,uiSource:k})=>{let y=p(u()),P=l(),S=i(()=>({disableAnimation:x,noStyle:g}),[x,g]),b=k??P.uiSource??"widget",w=i(()=>({uiSource:b}),[b]),C=h(),R=c(s,g);if(!(C&&R))return null;let K=t(e,{children:[r(n,{sheets:s,noStyle:g}),r(m,{baseClassName:o.manager,"data-testid":"consent-widget-root",slotKey:"manager.root",dir:y,children:j})]});return v?r(a.Provider,{value:w,children:r(d.Provider,{value:S,children:r(f,{children:K})})}):r(a.Provider,{value:w,children:r(f,{children:K})})},g=j;export{j as ConsentWidgetRoot,g as Root};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as r}from"react/jsx-runtime";import{EARLY_CONSENT_TAP_SCRIPT as t,replayEarlyConsentTaps as e}from"@c15t/core/surface-actions";import{useContext as o,useEffect as n,useLayoutEffect as c,useRef as i,useState as m}from"react";import{ProviderServicesContext as s}from"../../../context.js";import{toSaveUISource as u,useConsentTracking as l}from"../../../context/consent-tracking-context.js";import{useCommittedRef as f}from"../../../hooks/use-committed-ref.js";import{useIsHydrated as a}from"../../../hooks/use-is-hydrated.js";import{useKernel as p}from"../../../kernel-selector.js";import{useUIConfig as d}from"../../../ui-config-context.js";let j="u"<typeof document?n:c,g=()=>{let{nonce:c}=d(),[g]=m(!a()),x=p(),h=u(l().uiSource),k=f(o(s)),y=i(null),S=i(null);return(j(()=>{S.current=y.current?.ownerDocument.defaultView??null},[]),n(()=>e(x,{categories:()=>k.current?.getConsentCategories(),started:()=>k.current?.isStarted()??!0,uiSource:h,view:S.current}),[x,k,h]),g)?r("script",{ref:y,nonce:c,dangerouslySetInnerHTML:{__html:t}}):null};export{g as EarlyTapScript};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{Fragment as o,jsx as t,jsxs as e}from"react/jsx-runtime";import r from"@c15t/ui/styles/components/consent-banner";import{forwardRef as n,useMemo as i}from"react";import{useHeadlessConsentUI as s}from"../../../component-hooks/use-headless-consent-ui.js";import{ConsentTrackingContext as a}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as l}from"../../../context/theme-context.js";import{useActiveUI as m,useHasConsentUI as c,useModel as p,usePolicyRule as d,useTranslations as u}from"../../../hooks.js";import{useIABPolicyGuard as f}from"../../../hooks/use-iab-policy-guard.js";import{useLateEntry as h}from"../../../hooks/use-late-entry.js";import{useTextDirection as b}from"../../../hooks/use-text-direction.js";import{useUIConfig as j}from"../../../ui-config-context.js";import{defaultTranslationConfig as v}from"../../../utils/default-translation-config.js";import{mergeSlotProps as g}from"../../../utils/merge-slot-props.js";import{FIRST_PAINT_SHEETS as k}from"../../shared/first-paint-sheets.js";import{StreamedSurface as y}from"../../shared/streamed-surface.js";import{SurfaceStyles as x}from"../../shared/surface-styles.js";import{ConsentBannerSurfaceContext as N,mirrorDefaultPosition as S,useConsentBannerSurface as C}from"../surface-context.js";import{Overlay as $}from"./overlay.js";let L=["opt-in","opt-out"],P=n(({asChild:n,children:i,className:s,style:a,className:l,disableAnimation:y,noStyle:N,models:P=L,...R},B)=>{f();let F=m(),{components:A}=j(),E=c(),V=p()??"opt-in",q=d(),w=C(),z=u(),D=b(z?.language??v.defaultLanguage),G=S(w.position,w.positionSource,w.variant,D),H=E&&"banner"===F&&P.includes(V),I=h(H)&&!y,J=g(A?.banner?.root,{baseClassName:r.root,className:s||l,noStyle:N,style:a,...R}),K=N?J.className||"":`${J.className||""} ${y?"":`${r.bannerVisible} ${r.bannerEntering}`}`;return H?e(o,{children:[t(x,{sheets:k,noStyle:N}),t($,{}),t("div",{ref:B,...J,className:K,"data-variant":w.variant,"data-position":G,"data-blocking":w.blocking?"true":void 0,"data-prompt":q.prompt,"data-model":q.model,"data-entry":I?"late":void 0,"data-testid":"consent-banner-root",dir:D,children:i})]}):null}),R=({children:o,className:e,noStyle:r,disableAnimation:n,scrollLock:m,trapFocus:c,models:p,uiSource:d,variant:u,position:f,blocking:h,...b})=>{let{banner:j}=s({prompt:{blocking:h,position:f,scrollLock:m,trapFocus:c,variant:u}}),v=j.scrollLock,g=j.trapFocus,k=i(()=>({disableAnimation:n,noStyle:r,scrollLock:v,trapFocus:g}),[n,r,v,g]),y=i(()=>({blocking:j.blocking,position:j.position,positionSource:j.positionSource,variant:j.variant}),[j.blocking,j.position,j.positionSource,j.variant]),x=i(()=>({uiSource:d??"banner"}),[d]);return t(a.Provider,{value:x,children:t(l.Provider,{value:k,children:t(N.Provider,{value:y,children:t(P,{disableAnimation:n,className:e,noStyle:r,models:p,...b,children:o})})})})};P.displayName="ConsentBannerRootChildren";let B=o=>t(y,{children:t(R,{...o})}),F=B;export{B as ConsentBannerRoot,F as Root};
2
+ import{Fragment as o,jsx as t,jsxs as r}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/consent-banner";import{forwardRef as i,useMemo as s}from"react";import{useHeadlessConsentUI as n}from"../../../component-hooks/use-headless-consent-ui.js";import{ConsentTrackingContext as a}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as l}from"../../../context/theme-context.js";import{useActiveUI as m,useHasConsentUI as c,useModel as p,usePolicyRule as d,useTranslations as u}from"../../../hooks.js";import{useIABPolicyGuard as f}from"../../../hooks/use-iab-policy-guard.js";import{useLateEntry as h}from"../../../hooks/use-late-entry.js";import{useTextDirection as j}from"../../../hooks/use-text-direction.js";import{useUIConfig as b}from"../../../ui-config-context.js";import{defaultTranslationConfig as v}from"../../../utils/default-translation-config.js";import{mergeSlotProps as g}from"../../../utils/merge-slot-props.js";import{FIRST_PAINT_SHEETS as k}from"../../shared/first-paint-sheets.js";import{StreamedSurface as y}from"../../shared/streamed-surface.js";import{SurfaceStyles as x,useSurfaceSheetsReady as N}from"../../shared/surface-styles.js";import{ConsentBannerSurfaceContext as S,mirrorDefaultPosition as C,useConsentBannerSurface as $}from"../surface-context.js";import{EarlyTapScript as L}from"./early-tap-script.js";import{Overlay as P}from"./overlay.js";let R=["opt-in","opt-out"],B=i(({asChild:i,children:s,className:n,style:a,className:l,disableAnimation:y,noStyle:S,models:B=R,...F},A)=>{f();let E=m(),{components:V}=b(),q=c(),w=p()??"opt-in",z=d(),D=$(),G=u(),H=j(G?.language??v.defaultLanguage),I=C(D.position,D.positionSource,D.variant,H),J=N(k,S)&&q&&"banner"===E&&B.includes(w),K=h(J)&&!y,M=g(V?.banner?.root,{baseClassName:e.root,className:n||l,noStyle:S,style:a,...F}),O=S?M.className||"":`${M.className||""} ${y?"":`${e.bannerVisible} ${e.bannerEntering}`}`;return J?r(o,{children:[t(L,{}),t(x,{sheets:k,noStyle:S}),t(P,{}),t("div",{ref:A,...M,className:O,"data-variant":D.variant,"data-position":I,"data-blocking":D.blocking?"true":void 0,"data-prompt":z.prompt,"data-model":z.model,"data-entry":K?"late":void 0,"data-testid":"consent-banner-root",dir:H,children:s})]}):null}),F=({children:o,className:r,noStyle:e,disableAnimation:i,scrollLock:m,trapFocus:c,models:p,uiSource:d,variant:u,position:f,blocking:h,...j})=>{let{banner:b}=n({prompt:{blocking:h,position:f,scrollLock:m,trapFocus:c,variant:u}}),v=b.scrollLock,g=b.trapFocus,k=s(()=>({disableAnimation:i,noStyle:e,scrollLock:v,trapFocus:g}),[i,e,v,g]),y=s(()=>({blocking:b.blocking,position:b.position,positionSource:b.positionSource,variant:b.variant}),[b.blocking,b.position,b.positionSource,b.variant]),x=s(()=>({uiSource:d??"banner"}),[d]);return t(a.Provider,{value:x,children:t(l.Provider,{value:k,children:t(S.Provider,{value:y,children:t(B,{disableAnimation:i,className:r,noStyle:e,models:p,...j,children:o})})})})};B.displayName="ConsentBannerRootChildren";let A=o=>t(y,{children:t(F,{...o})}),E=A;export{A as ConsentBannerRoot,E as Root};