@c15t/react 2.0.0-rc.4 → 2.0.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/dist/components/consent-banner/atoms/root.cjs +1 -1
  2. package/dist/components/consent-banner/atoms/root.js +1 -1
  3. package/dist/components/consent-banner/consent-banner.cjs +1 -1
  4. package/dist/components/consent-banner/consent-banner.js +1 -1
  5. package/dist/components/consent-dialog/atoms/root.cjs +1 -1
  6. package/dist/components/consent-dialog/atoms/root.js +1 -1
  7. package/dist/components/consent-dialog/consent-dialog.cjs +1 -1
  8. package/dist/components/consent-dialog/consent-dialog.js +1 -1
  9. package/dist/components/consent-dialog-trigger/atoms/root.cjs +1 -1
  10. package/dist/components/consent-dialog-trigger/atoms/root.js +1 -1
  11. package/dist/components/consent-widget/atoms/button.cjs +1 -1
  12. package/dist/components/consent-widget/atoms/button.js +1 -1
  13. package/dist/components/consent-widget/consent-widget.cjs +1 -1
  14. package/dist/components/consent-widget/consent-widget.js +1 -1
  15. package/dist/components/frame/frame.cjs +1 -1
  16. package/dist/components/frame/frame.js +1 -1
  17. package/dist/components/iab-consent-banner/atoms/root.cjs +1 -1
  18. package/dist/components/iab-consent-banner/atoms/root.js +1 -1
  19. package/dist/components/iab-consent-banner/iab-consent-banner.cjs +1 -1
  20. package/dist/components/iab-consent-banner/iab-consent-banner.js +1 -1
  21. package/dist/components/iab-consent-dialog/atoms/footer.cjs +1 -1
  22. package/dist/components/iab-consent-dialog/atoms/footer.js +1 -1
  23. package/dist/components/iab-consent-dialog/atoms/root.cjs +1 -1
  24. package/dist/components/iab-consent-dialog/atoms/root.js +1 -1
  25. package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +1 -1
  26. package/dist/components/iab-consent-dialog/iab-consent-dialog.js +1 -1
  27. package/dist/components/shared/libs/policy-actions.cjs +1 -0
  28. package/dist/components/shared/libs/policy-actions.js +1 -0
  29. package/dist/components/shared/primitives/button.cjs +1 -1
  30. package/dist/components/shared/primitives/button.js +1 -1
  31. package/dist/headless.cjs +1 -1
  32. package/dist/headless.js +1 -1
  33. package/dist/hooks/index.cjs +1 -1
  34. package/dist/hooks/index.js +1 -1
  35. package/dist/hooks/use-consent-dialog-trigger.cjs +1 -0
  36. package/dist/hooks/use-consent-dialog-trigger.js +1 -0
  37. package/dist/hooks/use-consent-manager.cjs +1 -1
  38. package/dist/hooks/use-consent-manager.js +1 -1
  39. package/dist/hooks/use-headless-consent-ui.cjs +1 -0
  40. package/dist/hooks/use-headless-consent-ui.js +1 -0
  41. package/dist/hooks/use-headless-iab-consent-ui.cjs +1 -0
  42. package/dist/hooks/use-headless-iab-consent-ui.js +1 -0
  43. package/dist/index.cjs +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/providers/consent-manager-provider.cjs +1 -1
  46. package/dist/providers/consent-manager-provider.js +1 -1
  47. package/dist/server/fetch-ssr-data.cjs +1 -1
  48. package/dist/server/fetch-ssr-data.js +1 -1
  49. package/dist/server/headers.cjs +1 -1
  50. package/dist/server/headers.js +1 -1
  51. package/dist/server/index.cjs +1 -1
  52. package/dist/server/index.js +1 -1
  53. package/dist/server/init-cache-key.cjs +1 -0
  54. package/dist/server/init-cache-key.js +1 -0
  55. package/dist/version.cjs +1 -1
  56. package/dist/version.js +1 -1
  57. package/{dist → dist-types}/components/consent-banner/atoms/overlay.d.ts +0 -1
  58. package/{dist → dist-types}/components/consent-banner/atoms/root.d.ts +1 -2
  59. package/{dist → dist-types}/components/consent-banner/components.d.ts +0 -1
  60. package/{dist → dist-types}/components/consent-banner/consent-banner.d.ts +8 -7
  61. package/{dist → dist-types}/components/consent-banner/error-boundary.d.ts +0 -1
  62. package/{dist → dist-types}/components/consent-banner/index.d.ts +0 -1
  63. package/{dist → dist-types}/components/consent-dialog/atoms/card.d.ts +0 -1
  64. package/{dist → dist-types}/components/consent-dialog/atoms/overlay.d.ts +0 -1
  65. package/{dist → dist-types}/components/consent-dialog/atoms/root.d.ts +1 -2
  66. package/{dist → dist-types}/components/consent-dialog/consent-dialog.d.ts +1 -2
  67. package/{dist → dist-types}/components/consent-dialog/index.d.ts +0 -1
  68. package/{dist → dist-types}/components/consent-dialog-link/index.d.ts +0 -1
  69. package/{dist → dist-types}/components/consent-dialog-trigger/atoms/button.d.ts +0 -1
  70. package/{dist → dist-types}/components/consent-dialog-trigger/atoms/icon.d.ts +0 -1
  71. package/{dist → dist-types}/components/consent-dialog-trigger/atoms/root.d.ts +0 -1
  72. package/{dist → dist-types}/components/consent-dialog-trigger/atoms/text.d.ts +0 -1
  73. package/{dist → dist-types}/components/consent-dialog-trigger/consent-dialog-trigger.d.ts +0 -1
  74. package/{dist → dist-types}/components/consent-dialog-trigger/index.d.ts +0 -1
  75. package/{dist → dist-types}/components/consent-dialog-trigger/types.d.ts +1 -2
  76. package/{dist → dist-types}/components/consent-dialog-trigger/use-draggable.d.ts +1 -2
  77. package/{dist → dist-types}/components/consent-preferences-link/consent-preferences-link.d.ts +0 -1
  78. package/{dist → dist-types}/components/consent-preferences-link/index.d.ts +0 -1
  79. package/{dist → dist-types}/components/consent-widget/atoms/accordion.d.ts +0 -1
  80. package/{dist → dist-types}/components/consent-widget/atoms/button.d.ts +0 -1
  81. package/{dist → dist-types}/components/consent-widget/atoms/footer.d.ts +0 -1
  82. package/{dist → dist-types}/components/consent-widget/atoms/root.d.ts +0 -1
  83. package/{dist → dist-types}/components/consent-widget/consent-widget.d.ts +0 -1
  84. package/{dist → dist-types}/components/consent-widget/index.d.ts +0 -1
  85. package/{dist → dist-types}/components/consent-widget/types.d.ts +0 -1
  86. package/{dist → dist-types}/components/frame/atoms.d.ts +1 -2
  87. package/{dist → dist-types}/components/frame/frame.d.ts +0 -1
  88. package/{dist → dist-types}/components/frame/index.d.ts +0 -1
  89. package/{dist → dist-types}/components/frame/types.d.ts +1 -2
  90. package/{dist → dist-types}/components/iab-consent-banner/atoms/button-group.d.ts +0 -1
  91. package/{dist → dist-types}/components/iab-consent-banner/atoms/card.d.ts +0 -1
  92. package/{dist → dist-types}/components/iab-consent-banner/atoms/description.d.ts +0 -1
  93. package/{dist → dist-types}/components/iab-consent-banner/atoms/footer.d.ts +0 -1
  94. package/{dist → dist-types}/components/iab-consent-banner/atoms/header.d.ts +0 -1
  95. package/{dist → dist-types}/components/iab-consent-banner/atoms/overlay.d.ts +0 -1
  96. package/{dist → dist-types}/components/iab-consent-banner/atoms/root.d.ts +1 -2
  97. package/{dist → dist-types}/components/iab-consent-banner/atoms/title.d.ts +0 -1
  98. package/{dist → dist-types}/components/iab-consent-banner/iab-consent-banner.d.ts +1 -2
  99. package/{dist → dist-types}/components/iab-consent-banner/index.d.ts +0 -1
  100. package/{dist → dist-types}/components/iab-consent-dialog/atoms/card.d.ts +0 -1
  101. package/{dist → dist-types}/components/iab-consent-dialog/atoms/content.d.ts +0 -1
  102. package/{dist → dist-types}/components/iab-consent-dialog/atoms/footer.d.ts +0 -1
  103. package/{dist → dist-types}/components/iab-consent-dialog/atoms/header.d.ts +0 -1
  104. package/{dist → dist-types}/components/iab-consent-dialog/atoms/overlay.d.ts +0 -1
  105. package/{dist → dist-types}/components/iab-consent-dialog/atoms/purpose-item.d.ts +0 -1
  106. package/{dist → dist-types}/components/iab-consent-dialog/atoms/root.d.ts +1 -2
  107. package/{dist → dist-types}/components/iab-consent-dialog/atoms/stack-item.d.ts +0 -1
  108. package/{dist → dist-types}/components/iab-consent-dialog/atoms/tabs.d.ts +0 -1
  109. package/{dist → dist-types}/components/iab-consent-dialog/atoms/vendor-list.d.ts +1 -2
  110. package/{dist → dist-types}/components/iab-consent-dialog/hooks/use-gvl-data.d.ts +0 -1
  111. package/{dist → dist-types}/components/iab-consent-dialog/iab-consent-dialog.d.ts +1 -2
  112. package/{dist → dist-types}/components/iab-consent-dialog/index.d.ts +0 -1
  113. package/{dist → dist-types}/components/iab-consent-dialog/types.d.ts +0 -1
  114. package/{dist → dist-types}/components/iab-consent-dialog/use-iab-translations.d.ts +0 -1
  115. package/dist-types/components/shared/libs/policy-actions.d.ts +26 -0
  116. package/{dist → dist-types}/components/shared/libs/polymorphic.d.ts +0 -1
  117. package/{dist → dist-types}/components/shared/libs/recursive-clone-children.d.ts +0 -1
  118. package/{dist → dist-types}/components/shared/primitives/box.d.ts +0 -1
  119. package/{dist → dist-types}/components/shared/primitives/button.d.ts +5 -2
  120. package/{dist → dist-types}/components/shared/primitives/button.types.d.ts +17 -1
  121. package/{dist → dist-types}/components/shared/primitives/legal-links/index.d.ts +1 -2
  122. package/{dist → dist-types}/components/shared/ui/accordion/accordion.d.ts +1 -2
  123. package/{dist → dist-types}/components/shared/ui/accordion/accordion.types.d.ts +1 -2
  124. package/{dist → dist-types}/components/shared/ui/accordion/index.d.ts +0 -1
  125. package/{dist → dist-types}/components/shared/ui/animated-collapse/animated-collapse.d.ts +0 -1
  126. package/{dist → dist-types}/components/shared/ui/animated-collapse/index.d.ts +0 -1
  127. package/{dist → dist-types}/components/shared/ui/button/button.d.ts +1 -2
  128. package/{dist → dist-types}/components/shared/ui/button/button.types.d.ts +0 -1
  129. package/{dist → dist-types}/components/shared/ui/button/index.d.ts +0 -1
  130. package/{dist → dist-types}/components/shared/ui/icon.d.ts +0 -1
  131. package/{dist → dist-types}/components/shared/ui/logo.d.ts +0 -1
  132. package/{dist → dist-types}/components/shared/ui/switch/index.d.ts +0 -1
  133. package/{dist → dist-types}/components/shared/ui/switch/switch.d.ts +1 -2
  134. package/{dist → dist-types}/components/shared/ui/switch/switch.types.d.ts +1 -2
  135. package/{dist → dist-types}/context/consent-manager-context.d.ts +1 -2
  136. package/{dist → dist-types}/context/consent-tracking-context.d.ts +0 -1
  137. package/{dist → dist-types}/context/theme-context.d.ts +0 -1
  138. package/dist-types/headless.d.ts +10 -0
  139. package/{dist → dist-types}/hooks/index.d.ts +3 -1
  140. package/{dist → dist-types}/hooks/use-color-scheme.d.ts +0 -1
  141. package/{dist → dist-types}/hooks/use-component-config.d.ts +1 -2
  142. package/dist-types/hooks/use-consent-dialog-trigger.d.ts +10 -0
  143. package/{dist → dist-types}/hooks/use-consent-manager.d.ts +1 -2
  144. package/{dist → dist-types}/hooks/use-focus-trap.d.ts +0 -1
  145. package/dist-types/hooks/use-headless-consent-ui.d.ts +46 -0
  146. package/dist-types/hooks/use-headless-iab-consent-ui.d.ts +41 -0
  147. package/{dist → dist-types}/hooks/use-reduced-motion.d.ts +0 -1
  148. package/{dist → dist-types}/hooks/use-scroll-lock.d.ts +0 -1
  149. package/{dist → dist-types}/hooks/use-ssr-status.d.ts +0 -1
  150. package/{dist → dist-types}/hooks/use-styles.d.ts +0 -1
  151. package/{dist → dist-types}/hooks/use-text-direction.d.ts +0 -1
  152. package/{dist → dist-types}/hooks/use-theme.d.ts +0 -1
  153. package/{dist → dist-types}/hooks/use-translations.d.ts +1 -2
  154. package/{dist → dist-types}/index.d.ts +5 -3
  155. package/{dist → dist-types}/providers/consent-manager-provider.d.ts +0 -1
  156. package/{dist → dist-types}/server/fetch-ssr-data.d.ts +1 -2
  157. package/{dist → dist-types}/server/headers.d.ts +2 -2
  158. package/{dist → dist-types}/server/index.d.ts +1 -1
  159. package/dist-types/server/init-cache-key.d.ts +21 -0
  160. package/{dist → dist-types}/server/normalize-url.d.ts +0 -1
  161. package/{dist → dist-types}/server/types.d.ts +1 -2
  162. package/{dist → dist-types}/types/consent-manager.d.ts +8 -2
  163. package/{dist → dist-types}/types/theme/index.d.ts +0 -1
  164. package/dist-types/types/theme/style-keys.d.ts +1 -0
  165. package/{dist → dist-types}/types/theme/style-types.d.ts +4 -3
  166. package/{dist → dist-types}/utils/cn.d.ts +1 -2
  167. package/{dist → dist-types}/utils/merge-styles.d.ts +0 -1
  168. package/{dist → dist-types}/utils/test-helpers.d.ts +0 -1
  169. package/{dist → dist-types}/utils/theme-utils.d.ts +1 -2
  170. package/dist-types/version.d.ts +1 -0
  171. package/docs/README.md +76 -0
  172. package/docs/building-headless-components.md +245 -0
  173. package/docs/callbacks.md +117 -0
  174. package/docs/components/consent-banner.md +174 -0
  175. package/docs/components/consent-dialog-link.md +59 -0
  176. package/docs/components/consent-dialog-trigger.md +103 -0
  177. package/docs/components/consent-dialog.md +137 -0
  178. package/docs/components/consent-manager-provider.md +422 -0
  179. package/docs/components/consent-widget.md +78 -0
  180. package/docs/components/dev-tools.md +63 -0
  181. package/docs/components/frame.md +73 -0
  182. package/docs/concepts/client-modes.md +163 -0
  183. package/docs/concepts/consent-categories.md +97 -0
  184. package/docs/concepts/consent-models.md +112 -0
  185. package/docs/concepts/cookie-management.md +122 -0
  186. package/docs/concepts/glossary.md +23 -0
  187. package/docs/concepts/initialization-flow.md +141 -0
  188. package/docs/concepts/policy-packs.md +227 -0
  189. package/docs/headless.md +184 -0
  190. package/docs/hooks/use-color-scheme.md +40 -0
  191. package/docs/hooks/use-consent-manager/checking-consent.md +94 -0
  192. package/docs/hooks/use-consent-manager/location-info.md +95 -0
  193. package/docs/hooks/use-consent-manager/overview.md +390 -0
  194. package/docs/hooks/use-consent-manager/setting-consent.md +92 -0
  195. package/docs/hooks/use-draggable.md +57 -0
  196. package/docs/hooks/use-focus-trap.md +41 -0
  197. package/docs/hooks/use-reduced-motion.md +35 -0
  198. package/docs/hooks/use-ssr-status.md +31 -0
  199. package/docs/hooks/use-text-direction.md +49 -0
  200. package/docs/hooks/use-translations.md +116 -0
  201. package/docs/iab/consent-banner.md +95 -0
  202. package/docs/iab/consent-dialog.md +135 -0
  203. package/docs/iab/overview.md +119 -0
  204. package/docs/iab/use-gvl-data.md +208 -0
  205. package/docs/iframe-blocking.md +107 -0
  206. package/docs/integrations/databuddy.md +186 -0
  207. package/docs/integrations/google-tag-manager.md +153 -0
  208. package/docs/integrations/google-tag.md +149 -0
  209. package/docs/integrations/linkedin-insights.md +109 -0
  210. package/docs/integrations/meta-pixel.md +342 -0
  211. package/docs/integrations/microsoft-uet.md +112 -0
  212. package/docs/integrations/overview.md +89 -0
  213. package/docs/integrations/posthog.md +177 -0
  214. package/docs/integrations/tiktok-pixel.md +113 -0
  215. package/docs/integrations/x-pixel.md +143 -0
  216. package/docs/internationalization.md +197 -0
  217. package/docs/network-blocker.md +178 -0
  218. package/docs/optimization.md +117 -0
  219. package/docs/policy-packs.md +240 -0
  220. package/docs/quickstart.md +136 -0
  221. package/docs/script-loader.md +300 -0
  222. package/docs/server-side.md +153 -0
  223. package/docs/styling/classnames.md +84 -0
  224. package/docs/styling/color-scheme.md +82 -0
  225. package/docs/styling/css-variables.md +92 -0
  226. package/docs/styling/overview.md +315 -0
  227. package/docs/styling/slots.md +93 -0
  228. package/docs/styling/tailwind.md +86 -0
  229. package/docs/styling/tokens.md +214 -0
  230. package/docs/troubleshooting.md +137 -0
  231. package/package.json +28 -24
  232. package/dist/components/consent-banner/atoms/overlay.d.ts.map +0 -1
  233. package/dist/components/consent-banner/atoms/root.d.ts.map +0 -1
  234. package/dist/components/consent-banner/components.d.ts.map +0 -1
  235. package/dist/components/consent-banner/consent-banner.d.ts.map +0 -1
  236. package/dist/components/consent-banner/error-boundary.d.ts.map +0 -1
  237. package/dist/components/consent-banner/index.d.ts.map +0 -1
  238. package/dist/components/consent-dialog/atoms/card.d.ts.map +0 -1
  239. package/dist/components/consent-dialog/atoms/overlay.d.ts.map +0 -1
  240. package/dist/components/consent-dialog/atoms/root.d.ts.map +0 -1
  241. package/dist/components/consent-dialog/consent-dialog.d.ts.map +0 -1
  242. package/dist/components/consent-dialog/index.d.ts.map +0 -1
  243. package/dist/components/consent-dialog-link/index.d.ts.map +0 -1
  244. package/dist/components/consent-dialog-trigger/atoms/button.d.ts.map +0 -1
  245. package/dist/components/consent-dialog-trigger/atoms/icon.d.ts.map +0 -1
  246. package/dist/components/consent-dialog-trigger/atoms/root.d.ts.map +0 -1
  247. package/dist/components/consent-dialog-trigger/atoms/text.d.ts.map +0 -1
  248. package/dist/components/consent-dialog-trigger/consent-dialog-trigger.d.ts.map +0 -1
  249. package/dist/components/consent-dialog-trigger/index.d.ts.map +0 -1
  250. package/dist/components/consent-dialog-trigger/types.d.ts.map +0 -1
  251. package/dist/components/consent-dialog-trigger/use-draggable.d.ts.map +0 -1
  252. package/dist/components/consent-preferences-link/consent-preferences-link.d.ts.map +0 -1
  253. package/dist/components/consent-preferences-link/index.d.ts.map +0 -1
  254. package/dist/components/consent-widget/atoms/accordion.d.ts.map +0 -1
  255. package/dist/components/consent-widget/atoms/button.d.ts.map +0 -1
  256. package/dist/components/consent-widget/atoms/footer.d.ts.map +0 -1
  257. package/dist/components/consent-widget/atoms/root.d.ts.map +0 -1
  258. package/dist/components/consent-widget/consent-widget.d.ts.map +0 -1
  259. package/dist/components/consent-widget/index.d.ts.map +0 -1
  260. package/dist/components/consent-widget/types.d.ts.map +0 -1
  261. package/dist/components/frame/atoms.d.ts.map +0 -1
  262. package/dist/components/frame/frame.d.ts.map +0 -1
  263. package/dist/components/frame/index.d.ts.map +0 -1
  264. package/dist/components/frame/types.d.ts.map +0 -1
  265. package/dist/components/iab-consent-banner/atoms/button-group.d.ts.map +0 -1
  266. package/dist/components/iab-consent-banner/atoms/card.d.ts.map +0 -1
  267. package/dist/components/iab-consent-banner/atoms/description.d.ts.map +0 -1
  268. package/dist/components/iab-consent-banner/atoms/footer.d.ts.map +0 -1
  269. package/dist/components/iab-consent-banner/atoms/header.d.ts.map +0 -1
  270. package/dist/components/iab-consent-banner/atoms/overlay.d.ts.map +0 -1
  271. package/dist/components/iab-consent-banner/atoms/root.d.ts.map +0 -1
  272. package/dist/components/iab-consent-banner/atoms/title.d.ts.map +0 -1
  273. package/dist/components/iab-consent-banner/iab-consent-banner.d.ts.map +0 -1
  274. package/dist/components/iab-consent-banner/index.d.ts.map +0 -1
  275. package/dist/components/iab-consent-dialog/atoms/card.d.ts.map +0 -1
  276. package/dist/components/iab-consent-dialog/atoms/content.d.ts.map +0 -1
  277. package/dist/components/iab-consent-dialog/atoms/footer.d.ts.map +0 -1
  278. package/dist/components/iab-consent-dialog/atoms/header.d.ts.map +0 -1
  279. package/dist/components/iab-consent-dialog/atoms/overlay.d.ts.map +0 -1
  280. package/dist/components/iab-consent-dialog/atoms/purpose-item.d.ts.map +0 -1
  281. package/dist/components/iab-consent-dialog/atoms/root.d.ts.map +0 -1
  282. package/dist/components/iab-consent-dialog/atoms/stack-item.d.ts.map +0 -1
  283. package/dist/components/iab-consent-dialog/atoms/tabs.d.ts.map +0 -1
  284. package/dist/components/iab-consent-dialog/atoms/vendor-list.d.ts.map +0 -1
  285. package/dist/components/iab-consent-dialog/hooks/use-gvl-data.d.ts.map +0 -1
  286. package/dist/components/iab-consent-dialog/iab-consent-dialog.d.ts.map +0 -1
  287. package/dist/components/iab-consent-dialog/index.d.ts.map +0 -1
  288. package/dist/components/iab-consent-dialog/types.d.ts.map +0 -1
  289. package/dist/components/iab-consent-dialog/use-iab-translations.d.ts.map +0 -1
  290. package/dist/components/shared/libs/polymorphic.d.ts.map +0 -1
  291. package/dist/components/shared/libs/recursive-clone-children.d.ts.map +0 -1
  292. package/dist/components/shared/primitives/box.d.ts.map +0 -1
  293. package/dist/components/shared/primitives/button.d.ts.map +0 -1
  294. package/dist/components/shared/primitives/button.types.d.ts.map +0 -1
  295. package/dist/components/shared/primitives/legal-links/index.d.ts.map +0 -1
  296. package/dist/components/shared/ui/accordion/accordion.d.ts.map +0 -1
  297. package/dist/components/shared/ui/accordion/accordion.types.d.ts.map +0 -1
  298. package/dist/components/shared/ui/accordion/index.d.ts.map +0 -1
  299. package/dist/components/shared/ui/animated-collapse/animated-collapse.d.ts.map +0 -1
  300. package/dist/components/shared/ui/animated-collapse/index.d.ts.map +0 -1
  301. package/dist/components/shared/ui/button/button.d.ts.map +0 -1
  302. package/dist/components/shared/ui/button/button.types.d.ts.map +0 -1
  303. package/dist/components/shared/ui/button/index.d.ts.map +0 -1
  304. package/dist/components/shared/ui/icon.d.ts.map +0 -1
  305. package/dist/components/shared/ui/logo.d.ts.map +0 -1
  306. package/dist/components/shared/ui/switch/index.d.ts.map +0 -1
  307. package/dist/components/shared/ui/switch/switch.d.ts.map +0 -1
  308. package/dist/components/shared/ui/switch/switch.types.d.ts.map +0 -1
  309. package/dist/context/consent-manager-context.d.ts.map +0 -1
  310. package/dist/context/consent-tracking-context.d.ts.map +0 -1
  311. package/dist/context/theme-context.d.ts.map +0 -1
  312. package/dist/headless.d.ts +0 -8
  313. package/dist/headless.d.ts.map +0 -1
  314. package/dist/hooks/index.d.ts.map +0 -1
  315. package/dist/hooks/use-color-scheme.d.ts.map +0 -1
  316. package/dist/hooks/use-component-config.d.ts.map +0 -1
  317. package/dist/hooks/use-consent-manager.d.ts.map +0 -1
  318. package/dist/hooks/use-focus-trap.d.ts.map +0 -1
  319. package/dist/hooks/use-reduced-motion.d.ts.map +0 -1
  320. package/dist/hooks/use-scroll-lock.d.ts.map +0 -1
  321. package/dist/hooks/use-ssr-status.d.ts.map +0 -1
  322. package/dist/hooks/use-styles.d.ts.map +0 -1
  323. package/dist/hooks/use-text-direction.d.ts.map +0 -1
  324. package/dist/hooks/use-theme.d.ts.map +0 -1
  325. package/dist/hooks/use-translations.d.ts.map +0 -1
  326. package/dist/index.d.ts.map +0 -1
  327. package/dist/providers/consent-manager-provider.d.ts.map +0 -1
  328. package/dist/server/fetch-ssr-data.d.ts.map +0 -1
  329. package/dist/server/headers.d.ts.map +0 -1
  330. package/dist/server/index.d.ts.map +0 -1
  331. package/dist/server/normalize-url.d.ts.map +0 -1
  332. package/dist/server/types.d.ts.map +0 -1
  333. package/dist/types/consent-manager.d.ts.map +0 -1
  334. package/dist/types/theme/index.d.ts.map +0 -1
  335. package/dist/types/theme/style-keys.d.ts +0 -2
  336. package/dist/types/theme/style-keys.d.ts.map +0 -1
  337. package/dist/types/theme/style-types.d.ts.map +0 -1
  338. package/dist/utils/cn.d.ts.map +0 -1
  339. package/dist/utils/merge-styles.d.ts.map +0 -1
  340. package/dist/utils/test-helpers.d.ts.map +0 -1
  341. package/dist/utils/theme-utils.d.ts.map +0 -1
  342. package/dist/version.d.ts +0 -2
  343. package/dist/version.d.ts.map +0 -1
@@ -0,0 +1,122 @@
1
+ ---
2
+ title: Cookie Management
3
+ description: How c15t manages cookies through script, iframe, and network gating
4
+ lastModified: 2026-02-10
5
+ ---
6
+ Cookie management is the most commonly misunderstood part of consent. A critical distinction: **c15t does not manage all cookies on your site.** It controls what scripts, iframes, and network requests are allowed to load - and those third-party resources are what set most cookies.
7
+
8
+ Understanding this distinction is key to building a compliant consent flow: c15t gates the sources of cookies, not the cookies themselves.
9
+
10
+ ## What Actually Sets Cookies
11
+
12
+ There are four sources of cookies on a typical website:
13
+
14
+ **1. c15t itself**
15
+ c15t stores the user's consent state in a `c15t` cookie (and mirrors it to localStorage). This cookie records which categories the user consented to, when they consented, and their subject ID. This is a strictly necessary cookie - it exists so the site remembers the user's consent choice.
16
+
17
+ **2. Third-party scripts**
18
+ When you load a tracking script (Google Analytics, Meta Pixel, etc.), that script sets its own cookies. Google Analytics creates `_ga` and `_gid` cookies. Meta creates `_fbp` and `_fbc`. These cookies are set by the script's code running in the browser - c15t prevents them by not loading the script until the user consents.
19
+
20
+ **3. Embedded iframes**
21
+ YouTube embeds, social media widgets, and other iframes can set cookies via their embedded content. c15t's iframe blocker replaces iframes with placeholders until consent is granted, preventing these cookies from being set.
22
+
23
+ **4. Network requests**
24
+ Server responses can include `Set-Cookie` headers. If your page makes requests to third-party APIs or CDNs, those responses may set cookies. c15t's network blocker can intercept `fetch` and `XMLHttpRequest` calls to prevent these requests from happening without consent.
25
+
26
+ > ℹ️ **Info:**
27
+ > Don't list these cookies in your banner. The cookie names above (\_ga, \_gid, \_fbp, \_fbc) are implementation details — they matter for developers understanding how tracking works, but they should not be exposed to end users in your consent UI. Users don't know what \_ga means, and listing it doesn't help them make an informed choice. Instead, use purpose-based consent categories like "measurement" or "marketing" that communicate why data is collected, not how it is stored.
28
+
29
+ ## Why Revoking Consent Requires a Page Reload
30
+
31
+ When a user revokes consent for a category (e.g., turns off "measurement" after previously granting it), c15t reloads the page by default. This is not a limitation - it's the only reliable approach.
32
+
33
+ **Why you can't just delete third-party cookies from JavaScript:**
34
+
35
+ * **`httpOnly` cookies** - Many tracking cookies are set with the `httpOnly` flag, which prevents JavaScript from reading or deleting them. Only the server that set them can remove them.
36
+ * **Domain restrictions** - Cookies set on `.google.com` or `.facebook.com` can only be deleted by those domains. Your JavaScript running on `yourdomain.com` has no access.
37
+ * **Alternative storage** - Some scripts also write to `localStorage`, `sessionStorage`, `IndexedDB`, or even Web Workers. Cleaning up all possible storage locations is impractical.
38
+ * **In-memory state** - A loaded script has already executed. Its event listeners, timers, and in-memory data persist until the page unloads. You can't "unrun" JavaScript.
39
+
40
+ **The reliable solution: don't load the scripts in the first place.** A page reload creates a fresh execution context. On the fresh page, c15t reads the updated consent state and simply never loads the scripts that lost consent. No script means no cookies, no tracking, no in-memory state.
41
+
42
+ **When reload does NOT happen:**
43
+
44
+ * When a user is declining consent for the **first time** (no prior consent existed, so no scripts were loaded to clean up)
45
+ * When `reloadOnConsentRevoked` is set to `false`
46
+ * When the user is only **adding** consent (no revocations)
47
+
48
+ Configure reload behavior in the provider:
49
+
50
+ ```tsx
51
+ import { type ReactNode } from 'react';
52
+ import { ConsentManagerProvider } from '@c15t/react';
53
+
54
+ function ConsentManager({ children }: { children: ReactNode }) {
55
+ return (
56
+ <ConsentManagerProvider
57
+ options={{
58
+ mode: 'hosted',
59
+ backendURL: 'https://your-instance.c15t.dev',
60
+ reloadOnConsentRevoked: true, // default: true
61
+ callbacks: {
62
+ onBeforeConsentRevocationReload: ({ preferences }) => {
63
+ // Run cleanup before the page reloads
64
+ // e.g., flush pending analytics events
65
+ console.log('Reloading due to consent revocation:', preferences);
66
+ },
67
+ },
68
+ }}
69
+ >
70
+ {children}
71
+ </ConsentManagerProvider>
72
+ );
73
+ }
74
+ ```
75
+
76
+ > ℹ️ **Info:**
77
+ > The reload and deferred sync are part of the broader initialization flow. See Initialization Flow for the full sequence.
78
+ >
79
+ > ℹ️ **Info:**
80
+ > Setting reloadOnConsentRevoked: false means previously-loaded scripts will continue running after consent is revoked. Only disable this if you have a specific strategy for handling script cleanup.
81
+
82
+ ## The Revocation Flow
83
+
84
+ When a user revokes consent, the following sequence occurs:
85
+
86
+ **Simplified**
87
+
88
+ 1. **User revokes consent** — e.g. turns off "measurement" in the consent dialog
89
+ 2. **New consent saved** — updated preferences are written to cookies and localStorage
90
+ 3. **Pending sync stored** — the API update is deferred to localStorage (`c15t:pending-consent-sync`)
91
+ 4. **Page reloads** — a fresh execution context ensures revoked scripts never load
92
+ 5. **Fresh init** — c15t reads updated consent; scripts without consent are never loaded
93
+ 6. **Deferred API sync** — the pending consent change is sent to the backend and cleared from localStorage
94
+
95
+ **Sequence Diagram**
96
+
97
+ ```mermaid
98
+ sequenceDiagram
99
+ participant User
100
+ participant UI as Consent UI
101
+ participant Store as Consent Store
102
+ participant Storage as Cookie + localStorage
103
+ participant API as c15t Backend
104
+ participant Browser
105
+
106
+ User->>UI: Revokes "measurement" consent
107
+ UI->>Store: saveConsents({ type: 'custom' })
108
+ Store->>Store: shouldReloadOnConsentChange() → true
109
+ Store->>Storage: Save new consent state
110
+ Store->>Storage: Store PendingConsentSync in localStorage
111
+ Store->>Browser: onBeforeConsentRevocationReload callback
112
+ Store->>Browser: window.location.reload()
113
+ Browser->>Browser: Fresh page load
114
+ Browser->>Storage: Read consent state
115
+ Browser->>Store: Initialize with updated consents
116
+ Note over Store: Scripts without consent are never loaded
117
+ Store->>Storage: Read PendingConsentSync
118
+ Store->>API: Sync consent to backend
119
+ Store->>Storage: Clear PendingConsentSync
120
+ ```
121
+
122
+ **Key detail:** The API sync happens *after* the reload, not before. This ensures the page reloads as fast as possible. The pending sync data is stored in localStorage under the key `c15t:pending-consent-sync` and is picked up by the fresh page's initialization.
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: Glossary
3
+ description: Key terms used throughout the c15t documentation.
4
+ ---
5
+ ### Core Terms
6
+
7
+ |Term|Definition|
8
+ |--|--|
9
+ |`subjectId`|Client-generated device/browser identifier (`sub_xxx`). Stored in the `c15t` cookie. Created on first consent save.|
10
+ |`externalId`|Your authenticated user's ID (from Clerk, Auth0, etc.), linked via `identifyUser()`. Connects a device to a user account.|
11
+ |`consents`|The **saved** consent state — `Record<string, boolean>` mapping categories to granted/denied. Used for gating scripts, iframes, and network requests.|
12
+ |`selectedConsents`|**Unsaved** toggle state — what the user has toggled in the dialog but hasn't submitted yet. Becomes `consents` after save.|
13
+ |`mode`|Client operating mode: `'hosted'` (full backend), `'offline'` (local only), or `'custom'` (bring your own handlers). Legacy alias: `'c15t'`. Set once in provider config. See [Client Modes](/docs/frameworks/react/concepts/client-modes).|
14
+ |`model`|Consent regulatory model derived from jurisdiction: `'opt-in'`, `'opt-out'`, `'iab'`, or `null`. See [Consent Models](/docs/frameworks/react/concepts/consent-models).|
15
+
16
+ ### Regulatory Terms
17
+
18
+ |Term|Definition|
19
+ |--|--|
20
+ |`jurisdiction`|A privacy regulation code (e.g., `GDPR`, `CCPA`, `PIPEDA`, `QC_LAW25`) detected from the user's geolocation. Maps to a consent model. See [Consent Models](/docs/frameworks/react/concepts/consent-models) for the full mapping table.|
21
+ |GPC|Global Privacy Control — a browser signal (`Sec-GPC: 1`) indicating the user opts out of data sale/sharing. Honored when a policy sets `consent.gpc: true` (enabled by default in California presets).|
22
+ |TCF|IAB Transparency and Consent Framework (v2.3) — a standard for programmatic advertising consent in GDPR jurisdictions. See [IAB TCF](/docs/frameworks/react/iab/overview).|
23
+ |GVL|Global Vendor List — an IAB-maintained registry of ad-tech vendors and their declared purposes, used by the TCF consent flow.|
@@ -0,0 +1,141 @@
1
+ ---
2
+ title: Initialization Flow
3
+ description: What happens from provider mount to first render — the full consent lifecycle.
4
+ ---
5
+ When the consent provider mounts, it creates a cached consent runtime, reads any stored consent from the browser, fetches the resolved policy from the backend (or uses SSR/offline data), and decides whether to show the banner. This entire sequence completes before the first meaningful consent-aware render.
6
+
7
+ ## Lifecycle Sequence
8
+
9
+ **Simplified**
10
+
11
+ 1. **Provider mounts** — creates (or retrieves from cache) a consent runtime and store
12
+ 2. **Check stored consent** — reads existing consent from cookies / localStorage; if found and the policy fingerprint hasn't changed, the banner stays hidden
13
+ 3. **Fetch init data** — calls the backend `GET /init` (or uses SSR/offline data) for the resolved policy, location, and translations
14
+ 4. **Apply resolved policy** — the backend resolves the policy from your [policy pack](/docs/frameworks/react/concepts/policy-packs) based on visitor geo (region → country → fallback → default). The response includes the consent model, categories, UI mode, and a material fingerprint. If no policy pack is configured, the legacy jurisdiction-to-model mapping is used instead.
15
+ 5. **Decide banner visibility** — shows the banner only if no prior consent exists, the resolved policy requires it (`ui.mode` is `banner` or `dialog`), or the policy fingerprint changed since last consent
16
+ 6. **Gating enforced** — scripts, iframes, and network requests tagged with a consent category are blocked until that category is granted
17
+ 7. **User interacts** — choices are persisted to storage, synced to the backend (with `policySnapshotToken` if configured), and blocked scripts/iframes load immediately after consent is granted
18
+
19
+ **Sequence Diagram**
20
+
21
+ ```mermaid
22
+ sequenceDiagram
23
+ participant Provider as ConsentManagerProvider
24
+ participant Store as Consent Store
25
+ participant Storage as localStorage / Cookie
26
+ participant API as c15t Backend
27
+ participant UI as Banner / Dialog
28
+ participant Scripts as Script Loader
29
+
30
+ Provider->>Store: getOrCreateConsentRuntime()
31
+ Store->>Storage: getStoredConsent()
32
+ alt Stored consent exists
33
+ Storage-->>Store: consentInfo + consents
34
+ Store->>Store: activeUI = 'none'
35
+ else No stored consent
36
+ Store->>Store: isLoadingConsentInfo = true
37
+ end
38
+
39
+ Store->>Store: initConsentManager()
40
+ Store->>Storage: Check pending consent sync
41
+ opt Pending sync from revocation reload
42
+ Store->>API: Deferred setConsent() (non-blocking)
43
+ end
44
+
45
+ alt SSR data provided
46
+ Store->>Store: tryUseSSRData()
47
+ else No SSR data
48
+ Store->>API: GET /init
49
+ API-->>Store: policy, policyDecision, location, translations
50
+ end
51
+
52
+ Store->>Store: Apply resolved policy (model, categories, ui.mode)
53
+ Store->>Store: Check fingerprint change → re-prompt if needed
54
+ Store->>Store: Set activeUI, auto-grant if opt-out/none
55
+
56
+ alt User has no prior consent or policy changed
57
+ UI->>UI: Banner / Dialog appears (per policy ui.mode)
58
+ UI->>Store: saveConsents({ type })
59
+ Store->>Storage: Persist consent + subjectId + fingerprint
60
+ Store->>Scripts: updateScripts(), updateIframes(), updateNetwork()
61
+ Store->>API: POST /subjects + policySnapshotToken (non-blocking)
62
+ end
63
+ ```
64
+
65
+ ## How It Works
66
+
67
+ **Mount** — When the provider renders, it creates (or retrieves from cache) a consent runtime and store. Any existing consent is read from localStorage/cookies immediately. If consent already exists and the policy fingerprint matches, the banner stays hidden and gating rules apply right away. See [Client Modes](/docs/frameworks/react/concepts/client-modes) for how the mode affects runtime creation.
68
+
69
+ **Init** — The store fetches the resolved policy, location, and translation data. In hosted mode this calls `GET /init` on your backend; in offline mode it resolves from `offlinePolicy.policyPacks` locally. If SSR data was passed to the provider, the network fetch is skipped entirely. See [Server-Side Utilities](/docs/frameworks/react/server-side) for SSR setup.
70
+
71
+ **Policy resolution** — When [policy packs](/docs/frameworks/react/concepts/policy-packs) are configured, the backend resolves the right policy for the visitor based on their geo-location (region → country → fallback → default). The resolved policy determines the consent model (`opt-in`, `opt-out`, `iab`, or `none`), which categories are in scope, and what UI to show. For `opt-out` and `none` models, all categories are auto-granted — unless the resolved policy has `consent.gpc: true` and the browser sends a Global Privacy Control signal, in which case `marketing` and `measurement` are denied. If no policy pack is configured, the legacy jurisdiction-to-model mapping is used instead. See [Consent Models](/docs/frameworks/react/concepts/consent-models) for details.
72
+
73
+ **Re-prompting** — If the resolved policy's material fingerprint differs from the fingerprint stored with the user's last consent, the banner is shown again. This happens automatically when you change consent-affecting fields (model, categories, scope mode, allowed actions). Presentation-only changes do not trigger re-prompts. See [Policy Packs — Re-Prompting](/docs/frameworks/react/concepts/policy-packs#re-prompting) for details.
74
+
75
+ **Save** — When the user interacts with the banner or dialog, their choices are persisted to localStorage/cookies and synced to the backend (along with the `policySnapshotToken` if snapshot signing is configured). Script, iframe, and network gating rules update immediately based on the new consent state. See the [Script Loader](/docs/frameworks/react/script-loader), [Iframe Blocking](/docs/frameworks/react/iframe-blocking), and [Network Blocker](/docs/frameworks/react/network-blocker) guides for gating details.
76
+
77
+ **Revocation** — If a user revokes a previously granted category, the page reloads by default to ensure a clean execution environment. The API sync is deferred to the fresh page load. See [Cookie Management](/docs/frameworks/react/concepts/cookie-management) for revocation and persistence details.
78
+
79
+ ## When Does the Banner Show?
80
+
81
+ The banner appears when any of these conditions are true:
82
+
83
+ 1. **No existing consent** — the user has never consented (or their consent was cleared), **and** the resolved policy requires a UI (`ui.mode` is `banner` or `dialog`, or the model is `opt-in` or `iab`)
84
+ 2. **Policy changed** — the material policy fingerprint differs from the fingerprint stored with the user's last consent (re-prompting)
85
+ 3. **Storage is accessible** — the browser allows localStorage (not blocked in private mode)
86
+
87
+ If the resolved model is `none` or `opt-out` (and `ui.mode` is `none`), consents are auto-granted and the banner never appears. See [Consent Models](/docs/frameworks/react/concepts/consent-models) and [Policy Packs](/docs/frameworks/react/concepts/policy-packs) for details.
88
+
89
+ ## Debugging the Lifecycle
90
+
91
+ Use the DevTools panel and callbacks to inspect each step of the initialization flow:
92
+
93
+ |Step|DevTools Panel|Callback|What to check|
94
+ |--|--|--|--|
95
+ |Init / SSR hydration|Location|`onBannerFetched`|jurisdiction, countryCode, regionCode populated?|
96
+ |Policy resolution|Policy|`onBannerFetched`|`policyId`, `matchedBy`, `fingerprint` in policyDecision|
97
+ |Model resolution|Location|`onBannerFetched`|`model` value matches the resolved policy|
98
+ |Banner visibility|Consents|—|`activeUI` in store state; does policy `ui.mode` require it?|
99
+ |Re-prompting|Policy|—|Fingerprint mismatch between stored and resolved policy?|
100
+ |Consent save|Consents + Events|`onConsentSet`|`preferences` object in callback payload|
101
+ |Script loading|Scripts|`onConsentSet`|Script IDs and their load/blocked status|
102
+ |Reload on revocation|Events|`onBeforeConsentRevocationReload`|Fires before reload; check localStorage for `c15t:pending-consent-sync`|
103
+ |Deferred sync|Events|`onError` (if sync fails)|After reload, check Events panel for successful API call|
104
+
105
+ Configure callbacks in the provider to log lifecycle events, and add DevTools for a visual inspector:
106
+
107
+ ```tsx
108
+ import { type ReactNode } from 'react';
109
+ import { ConsentManagerProvider, ConsentBanner, ConsentDialog } from '@c15t/react';
110
+ import { DevTools } from '@c15t/dev-tools/react';
111
+
112
+ export default function ConsentManager({ children }: { children: ReactNode }) {
113
+ return (
114
+ <ConsentManagerProvider
115
+ options={{
116
+ mode: 'hosted',
117
+ backendURL: 'https://your-instance.c15t.dev',
118
+ callbacks: {
119
+ onBannerFetched: ({ jurisdiction, location }) => {
120
+ console.log('Init complete:', { jurisdiction, location });
121
+ },
122
+ onConsentSet: ({ preferences }) => {
123
+ console.log('Consent saved:', preferences);
124
+ },
125
+ onBeforeConsentRevocationReload: ({ preferences }) => {
126
+ console.log('Reloading due to revocation:', preferences);
127
+ },
128
+ onError: ({ error }) => {
129
+ console.error('Consent error:', error);
130
+ },
131
+ },
132
+ }}
133
+ >
134
+ <ConsentBanner />
135
+ <ConsentDialog />
136
+ {process.env.NODE_ENV !== 'production' && <DevTools />}
137
+ {children}
138
+ </ConsentManagerProvider>
139
+ );
140
+ }
141
+ ```
@@ -0,0 +1,227 @@
1
+ ---
2
+ title: Policy Packs
3
+ description: How c15t resolves regional consent policies and what a policy pack controls.
4
+ ---
5
+ Different countries need different consent experiences. Policy packs let you define those rules once — c15t picks the right one automatically based on where the visitor is.
6
+
7
+ A policy pack is an ordered array of policies. Each policy targets a region or country and controls the consent model, which categories are in scope, what UI is shown, and how consent is recorded.
8
+
9
+ There are three ways to configure policy packs:
10
+
11
+ 1. **consent.io (recommended)** — use [consent.io](https://consent.io) as your hosted backend. Configure packs visually in the dashboard or via API — no code changes required. Works with any frontend, including static sites.
12
+ 2. **Self-hosted backend** — define packs in code via `policyPacks` and resolve them from real request geo data. Full control over policy logic and storage.
13
+ 3. **Offline fallback** — pass the same policy shapes to the frontend via `offlinePolicy.policyPacks`. Used as a resilience fallback when the backend is unreachable, or for quick local experimentation and demos. If you omit `offlinePolicy.policyPacks`, c15t falls back to a synthetic worldwide opt-in banner instead of no-banner mode.
14
+
15
+ In both hosted and self-hosted modes, the **backend is always the source of truth**. Offline packs never override a live backend decision.
16
+
17
+ ## Quickstart
18
+
19
+ The fastest way to get started is with the built-in presets:
20
+
21
+ ```ts
22
+ import { policyPackPresets } from 'c15t';
23
+
24
+ const policies = [
25
+ policyPackPresets.europeOptIn(), // GDPR opt-in banner
26
+ policyPackPresets.californiaOptOut(), // CCPA opt-out banner
27
+ policyPackPresets.worldNoBanner(), // No banner elsewhere
28
+ ];
29
+ ```
30
+
31
+ |Preset|Model|UI|Matches|
32
+ |--|--|--|--|
33
+ |`europeOptIn()`|`opt-in`|banner|EEA + UK countries + geo fallback|
34
+ |`europeIab()`|`iab`|banner|EEA + UK countries + geo fallback (TCF 2.3)|
35
+ |`californiaOptOut()`|`opt-out`|none|US-CA region|
36
+ |`quebecOptIn()`|`opt-in`|banner|CA-QC region|
37
+ |`worldNoBanner()`|`none`|none|default fallback|
38
+
39
+ Most apps only need these presets — pick the ones that match your regions, pass them to your backend config or provider, and you're done. Customize individual fields or write fully custom policies when you need more control.
40
+
41
+ For banner/dialog actions, policy packs can also control grouped button arrangement:
42
+
43
+ ```ts
44
+ ui: {
45
+ mode: 'banner',
46
+ banner: {
47
+ allowedActions: ['reject', 'accept', 'customize'],
48
+ layout: [['reject', 'accept'], 'customize'],
49
+ direction: 'row',
50
+ primaryAction: 'customize',
51
+ },
52
+ }
53
+ ```
54
+
55
+ That expresses arrangement only. Button appearance like `stroke`, `filled`, or `ghost` lives in the UI theme.
56
+
57
+ ## What Users See
58
+
59
+ Each policy combination produces a different consent experience:
60
+
61
+ |Policy Config|User Experience|
62
+ |--|--|
63
+ |`model: 'opt-in'`, `ui.mode: 'banner'`|Banner appears, nothing loads until the user consents|
64
+ |`model: 'opt-out'`, `ui.mode: 'none'`|No banner, everything loads immediately — user opts out via a "Do Not Sell" link|
65
+ |`model: 'none'`, `ui.mode: 'none'`|No banner, all categories auto-granted silently|
66
+ |`model: 'opt-in'`, `ui.mode: 'dialog'`|Full-screen dialog, nothing loads until the user consents|
67
+ |`model: 'iab'`, `ui.mode: 'banner'`|IAB TCF 2.3 banner with vendor-level controls|
68
+
69
+ ## How Policy Resolution Works
70
+
71
+ When a visitor arrives, c15t walks the policy pack in priority order:
72
+
73
+ 1. **Match by region** — checks for a policy targeting the specific region (e.g., US-CA, CA-QC)
74
+ 2. **Match by country** — if no region match, checks for a country-level policy (e.g., US, DE)
75
+ 3. **Fallback (geo failure)** — if geo-location failed (no country detected), uses the policy marked with `match.fallback`
76
+ 4. **Fall back to default** — if nothing matches, uses the policy marked as the default
77
+ 5. **No match, no default** — resolves to no-banner mode (silent, no consent UI)
78
+
79
+ Within the same matcher type, the first policy in the array wins. Pack order matters when two policies target the same country or region.
80
+
81
+ The **fallback** step is distinct from **default**: `isDefault` is a catch-all for known locations that don't match any specific policy ("rest of world"), while `fallback` is a safety net for unknown locations when geo-headers are missing ("assume strictest"). The `europeOptIn()` and `europeIab()` presets include `fallback: true` by default so EU-level consent applies when geo fails.
82
+
83
+ > ⚠️ **Warning:**
84
+ > Only one default and one fallback policy are allowed. Use inspectPolicies() to surface overlapping matchers and other warnings before deployment.
85
+
86
+ Inspect the resolved policy at runtime with `useConsentManager()`:
87
+
88
+ ```tsx
89
+ import { useConsentManager } from '@c15t/react';
90
+
91
+ function PolicyDebug() {
92
+ const { locationInfo, model, policy, policyDecision } = useConsentManager();
93
+
94
+ return (
95
+ <pre>
96
+ {JSON.stringify(
97
+ {
98
+ country: locationInfo?.countryCode,
99
+ region: locationInfo?.regionCode,
100
+ model,
101
+ policyId: policy?.id,
102
+ matchedBy: policyDecision?.matchedBy,
103
+ fingerprint: policyDecision?.fingerprint,
104
+ },
105
+ null,
106
+ 2
107
+ )}
108
+ </pre>
109
+ );
110
+ }
111
+ ```
112
+
113
+ ## Common Patterns
114
+
115
+ **The 80% case** — strict in Europe, light in California, silent everywhere else:
116
+
117
+ ```ts
118
+ const policies = [
119
+ {
120
+ id: 'eu',
121
+ match: { countries: ['DE', 'FR', 'IT'] },
122
+ consent: { model: 'opt-in', categories: ['necessary', 'measurement', 'marketing'] },
123
+ ui: { mode: 'banner' },
124
+ },
125
+ {
126
+ id: 'ca',
127
+ match: { regions: [{ country: 'US', region: 'CA' }] },
128
+ consent: { model: 'opt-out', gpc: true },
129
+ ui: { mode: 'none' },
130
+ },
131
+ {
132
+ id: 'default',
133
+ match: { isDefault: true },
134
+ consent: { model: 'none' },
135
+ ui: { mode: 'none' },
136
+ },
137
+ ];
138
+ ```
139
+
140
+ **Region overrides country** — stricter rules for California than the rest of the US:
141
+
142
+ ```ts
143
+ const policies = [
144
+ {
145
+ id: 'us_ca',
146
+ match: { regions: [{ country: 'US', region: 'CA' }] },
147
+ consent: { model: 'opt-in', scopeMode: 'strict' },
148
+ ui: { mode: 'banner' },
149
+ },
150
+ {
151
+ id: 'us',
152
+ match: { countries: ['US'] },
153
+ consent: { model: 'opt-out' },
154
+ ui: { mode: 'banner' },
155
+ },
156
+ ];
157
+ // US-CA → us_ca (region match wins)
158
+ // US-NY → us (country match)
159
+ ```
160
+
161
+ **Different wording per region** — use `i18n.messageProfile` to vary copy without changing the consent model:
162
+
163
+ ```ts
164
+ const c15t = c15tInstance({
165
+ i18n: {
166
+ defaultProfile: 'default',
167
+ messages: {
168
+ default: {
169
+ translations: {
170
+ en: { cookieBanner: { title: 'Privacy choices' } },
171
+ es: { cookieBanner: { title: 'Tus opciones de privacidad' } },
172
+ },
173
+ },
174
+ eu: {
175
+ fallbackLanguage: 'en',
176
+ translations: {
177
+ en: { cookieBanner: { title: 'EU GDPR Consent' } },
178
+ fr: { cookieBanner: { title: 'Consentement RGPD' } },
179
+ de: { cookieBanner: { title: 'GDPR-Einwilligung' } },
180
+ },
181
+ },
182
+ },
183
+ },
184
+ policyPacks: [
185
+ {
186
+ id: 'eu',
187
+ match: { countries: ['DE', 'FR', 'IT'] },
188
+ i18n: { messageProfile: 'eu' },
189
+ consent: { model: 'opt-in' },
190
+ ui: { mode: 'banner' },
191
+ },
192
+ ],
193
+ });
194
+ ```
195
+
196
+ In that setup, the `eu` policy uses only the `eu` language set. So Europe can
197
+ resolve to `en`, `fr`, or `de`, but not to `es` or any other locale defined
198
+ only in `default`. If the browser asks for an unsupported locale, c15t falls
199
+ back to the `eu` profile's `fallbackLanguage`.
200
+
201
+ ## Re-Prompting on Policy Change
202
+
203
+ When you change a policy in a way that affects consent semantics — like adding a category, changing the consent model, or modifying allowed actions — c15t automatically re-prompts returning users.
204
+
205
+ This works through the **material policy fingerprint**: a hash of only the consent-affecting fields (model, categories, scope, allowed actions, grouped action layout, direction, proof settings). Presentation-only changes like copy, button styling, or scroll lock do not trigger re-prompts.
206
+
207
+ |Change|Re-prompts?|
208
+ |--|--|
209
+ |Add a consent category|Yes|
210
+ |Change `model` from `opt-out` to `opt-in`|Yes|
211
+ |Remove an `allowedAction`|Yes|
212
+ |Change `uiProfile` or button styling|No|
213
+ |Update translation copy|No|
214
+ |Change `scrollLock`|No|
215
+
216
+ ## Design Guidelines
217
+
218
+ * **Start from presets.** Use `policyPackPresets` to get running, then customize for your needs.
219
+ * **Keep packs small.** A handful of regional policies is better than dozens of tiny fragments.
220
+ * **Think risk, not geography.** Geography is just a matcher — the real question is what consent behavior each region needs.
221
+ * **Always include a default.** Unless "no banner for unmatched traffic" is intentional.
222
+ * **Set a fallback for geo failures.** Mark your strictest policy with `match.fallback=true` so users in unknown locations still see a consent banner. The `europeOptIn()` and `europeIab()` presets do this automatically.
223
+ * **Keep policy IDs stable.** They appear in debugging output, snapshots, and audit records.
224
+ * **Use `inspectPolicies()` before deploying.** It catches overlapping matchers, missing defaults, and IAB misconfigurations.
225
+
226
+ > ℹ️ **Info:**
227
+ > For provider setup, see the React policy pack guide. For backend configuration, see the self-host guide.