@c15t/react 3.0.0-alpha.3 → 3.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/AGENTS.md +92 -72
  2. package/README.md +21 -17
  3. package/SKILL.md +34 -0
  4. package/dist/component-hooks/use-headless-consent-ui.js +1 -1
  5. package/dist/component-hooks/use-headless-iab-consent-ui.js +1 -1
  6. package/dist/components/consent-gate/atoms.js +1 -1
  7. package/dist/components/consent-gate/consent-gate.js +1 -1
  8. package/dist/components/iab-panel/atoms/card.js +1 -1
  9. package/dist/components/iab-panel/atoms/feature-item.js +2 -0
  10. package/dist/components/iab-panel/atoms/header.js +1 -1
  11. package/dist/components/iab-panel/iab-panel.js +1 -1
  12. package/dist/components/iab-panel/index.js +1 -1
  13. package/dist/components/iab-prompt/atoms/overlay.js +1 -1
  14. package/dist/components/iab-prompt/atoms/root.js +1 -1
  15. package/dist/components/panel/atoms/card.js +1 -1
  16. package/dist/components/panel/atoms/root.js +1 -1
  17. package/dist/components/panel-trigger/atoms/button.js +1 -1
  18. package/dist/components/panel-trigger/atoms/toolbar.js +1 -1
  19. package/dist/components/preferences/atoms/accordion.js +1 -1
  20. package/dist/components/prompt/atoms/overlay.js +1 -1
  21. package/dist/components/prompt/atoms/root.js +1 -1
  22. package/dist/components/prompt/components.js +1 -1
  23. package/dist/components/shared/libs/compose-refs.js +1 -0
  24. package/dist/components/shared/libs/slot.js +1 -1
  25. package/dist/components/shared/primitives/button.js +1 -1
  26. package/dist/components/shared/ui/dialog/dialog.js +1 -1
  27. package/dist/components/shared/ui/icon.js +1 -1
  28. package/dist/context/consent-tracking-context.js +1 -1
  29. package/dist/devtools.js +1 -1
  30. package/dist/draft-context.js +2 -0
  31. package/dist/draft.js +1 -1
  32. package/dist/external-iab-context.js +1 -1
  33. package/dist/gpp.js +2 -0
  34. package/dist/hooks/use-color-scheme.js +1 -1
  35. package/dist/hooks/use-focus-trap.js +1 -1
  36. package/dist/hooks.js +1 -1
  37. package/dist/iab/styles.tw3.css +4 -4
  38. package/dist/index-parts/consent-banner.js +1 -0
  39. package/dist/index-parts/consent-dialog-link.js +1 -0
  40. package/dist/index-parts/consent-dialog-trigger.js +1 -0
  41. package/dist/index-parts/consent-dialog.js +1 -0
  42. package/dist/index-parts/consent-gate.js +1 -0
  43. package/dist/index-parts/core.js +1 -0
  44. package/dist/index-parts/draft.js +1 -0
  45. package/dist/index-parts/hooks.js +1 -0
  46. package/dist/index-parts/module-hooks.js +1 -0
  47. package/dist/index-parts/provider.js +1 -0
  48. package/dist/index-parts/theme.js +1 -0
  49. package/dist/index-parts/translations.js +1 -0
  50. package/dist/index.js +1 -1
  51. package/dist/kernel-selector.js +1 -1
  52. package/dist/module-hooks/iframe-blocker.js +1 -1
  53. package/dist/postcss-tailwind3.js +1 -0
  54. package/dist/provider.js +1 -1
  55. package/dist/server/fetch-ssr-data.js +1 -1
  56. package/dist/server/headers.js +1 -1
  57. package/dist/server/normalize-url.js +1 -1
  58. package/dist/styles.tw3.css +16 -16
  59. package/dist/transports/offline.js +1 -1
  60. package/dist/utils/merge-slot-props.js +1 -1
  61. package/dist/utils/theme-utils.js +1 -1
  62. package/dist/version.js +1 -1
  63. package/dist-types/component-hooks/use-headless-consent-ui.d.ts +1 -1
  64. package/dist-types/components/iab-panel/atoms/feature-item.d.ts +28 -0
  65. package/dist-types/components/iab-panel/iab-panel.d.ts +2 -2
  66. package/dist-types/components/iab-panel/index.d.ts +5 -2
  67. package/dist-types/components/iab-panel/use-iab-translations.d.ts +4 -0
  68. package/dist-types/components/iab-prompt/iab-prompt.d.ts +2 -2
  69. package/dist-types/components/iab-prompt/index.d.ts +2 -2
  70. package/dist-types/components/panel/atoms/card.d.ts +1 -0
  71. package/dist-types/components/prompt/components.d.ts +6 -0
  72. package/dist-types/components/shared/libs/compose-refs.d.ts +20 -0
  73. package/dist-types/components/shared/ui/icon.d.ts +2 -1
  74. package/dist-types/context/consent-tracking-context.d.ts +10 -0
  75. package/dist-types/context/theme-context.d.ts +2 -2
  76. package/dist-types/context.d.ts +6 -0
  77. package/dist-types/devtools.d.ts +13 -2
  78. package/dist-types/draft-context.d.ts +31 -0
  79. package/dist-types/draft.d.ts +13 -30
  80. package/dist-types/gpp.d.ts +27 -0
  81. package/dist-types/hooks/use-focus-trap.d.ts +3 -1
  82. package/dist-types/hooks.d.ts +57 -13
  83. package/dist-types/iab.d.ts +1 -1
  84. package/dist-types/index-parts/consent-banner.d.ts +7 -0
  85. package/dist-types/index-parts/consent-dialog-link.d.ts +7 -0
  86. package/dist-types/index-parts/consent-dialog-trigger.d.ts +7 -0
  87. package/dist-types/index-parts/consent-dialog.d.ts +7 -0
  88. package/dist-types/index-parts/consent-gate.d.ts +7 -0
  89. package/dist-types/index-parts/core.d.ts +8 -0
  90. package/dist-types/index-parts/draft.d.ts +7 -0
  91. package/dist-types/index-parts/hooks.d.ts +7 -0
  92. package/dist-types/index-parts/module-hooks.d.ts +7 -0
  93. package/dist-types/index-parts/provider.d.ts +7 -0
  94. package/dist-types/index-parts/theme.d.ts +8 -0
  95. package/dist-types/index-parts/translations.d.ts +7 -0
  96. package/dist-types/index.d.ts +14 -15
  97. package/dist-types/kernel-selector.d.ts +0 -8
  98. package/dist-types/module-hooks/iframe-blocker.d.ts +12 -7
  99. package/dist-types/postcss-tailwind3.d.ts +21 -0
  100. package/dist-types/provider.d.ts +57 -17
  101. package/dist-types/server/headers.d.ts +14 -4
  102. package/dist-types/server/normalize-url.d.ts +14 -7
  103. package/dist-types/server/types.d.ts +12 -1
  104. package/dist-types/transports/offline.d.ts +7 -16
  105. package/dist-types/ui-config-context.d.ts +7 -1
  106. package/dist-types/utils/merge-slot-props.d.ts +15 -1
  107. package/dist-types/utils/theme-utils.d.ts +17 -2
  108. package/dist-types/version.d.ts +1 -1
  109. package/docs/README.md +92 -72
  110. package/docs/assets/v3/bottom-bar.png +0 -0
  111. package/docs/assets/v3/brand-card.png +0 -0
  112. package/docs/assets/v3/brand-preferences.png +0 -0
  113. package/docs/assets/v3/choice-wall.png +0 -0
  114. package/docs/assets/v3/headless-bar-html.png +0 -0
  115. package/docs/assets/v3/headless-bar-mobile.png +0 -0
  116. package/docs/assets/v3/headless-bar.png +0 -0
  117. package/docs/assets/v3/slim-bar.png +0 -0
  118. package/docs/concepts/choose-your-setup.md +87 -0
  119. package/docs/{frameworks/react/concepts → concepts}/consent-categories.md +22 -7
  120. package/docs/{guides → concepts}/consent-state.md +89 -105
  121. package/docs/{guides → concepts}/data-fetching.md +31 -27
  122. package/docs/concepts/how-consent-works.md +123 -0
  123. package/docs/{frameworks/react/concepts/policy-presets.md → concepts/policies.md} +7 -59
  124. package/docs/customization/class-names.md +202 -0
  125. package/docs/customization/dark-mode.md +157 -0
  126. package/docs/customization/motion.md +119 -0
  127. package/docs/customization/overview.md +67 -34
  128. package/docs/customization/recipes.md +839 -49
  129. package/docs/customization/slots.md +216 -35
  130. package/docs/customization/stylesheets.md +147 -0
  131. package/docs/customization/tailwind.md +842 -0
  132. package/docs/customization/tokens.md +163 -96
  133. package/docs/customization/translations.md +60 -3
  134. package/docs/frameworks/react/callbacks.md +118 -0
  135. package/docs/frameworks/react/clear-on-revocation.md +106 -0
  136. package/docs/frameworks/react/components/consent-banner.md +42 -28
  137. package/docs/frameworks/react/components/consent-dialog-link.md +13 -11
  138. package/docs/frameworks/react/components/consent-dialog-trigger.md +81 -76
  139. package/docs/frameworks/react/components/consent-dialog.md +56 -50
  140. package/docs/frameworks/react/components/consent-gate.md +37 -20
  141. package/docs/frameworks/react/components/consent-provider.md +130 -0
  142. package/docs/frameworks/react/components/consent-widget.md +23 -20
  143. package/docs/frameworks/react/components/dev-tools.md +53 -85
  144. package/docs/frameworks/react/components.md +105 -0
  145. package/docs/frameworks/react/compose.md +354 -0
  146. package/docs/frameworks/react/content-security-policy.md +126 -0
  147. package/docs/frameworks/react/customize.md +250 -0
  148. package/docs/frameworks/react/embeds.md +89 -0
  149. package/docs/frameworks/react/gpp.md +163 -0
  150. package/docs/frameworks/react/{hooks/overview.md → hooks.md} +21 -16
  151. package/docs/frameworks/react/{iab/overview.md → iab.md} +80 -31
  152. package/docs/frameworks/react/network-blocker.md +35 -41
  153. package/docs/frameworks/react/quickstart.md +139 -101
  154. package/docs/frameworks/react/rendering.md +128 -0
  155. package/docs/frameworks/react/scripts.md +115 -0
  156. package/docs/frameworks/react/translations.md +155 -0
  157. package/docs/frameworks/react/troubleshooting.md +92 -47
  158. package/docs/frameworks/react/vendor-consent.md +170 -0
  159. package/docs/guides/banner-experiments.md +654 -0
  160. package/docs/guides/troubleshooting.md +120 -47
  161. package/docs/guides/verify-consent.md +81 -49
  162. package/docs/integrations/adobe-analytics.md +167 -159
  163. package/docs/integrations/ahrefs-analytics.md +152 -154
  164. package/docs/integrations/amplitude.md +162 -156
  165. package/docs/integrations/building-integrations.md +136 -37
  166. package/docs/integrations/clearbit.md +154 -154
  167. package/docs/integrations/cloudflare-web-analytics.md +156 -156
  168. package/docs/integrations/cloudflare-zaraz.md +209 -261
  169. package/docs/integrations/crisp.md +164 -158
  170. package/docs/integrations/databuddy.md +157 -173
  171. package/docs/integrations/fathom-analytics.md +158 -156
  172. package/docs/integrations/front-chat.md +167 -167
  173. package/docs/integrations/google-maps.md +118 -83
  174. package/docs/integrations/google-tag-manager.md +178 -163
  175. package/docs/integrations/google-tag.md +163 -160
  176. package/docs/integrations/heap.md +163 -155
  177. package/docs/integrations/hightouch.md +161 -157
  178. package/docs/integrations/hotjar.md +159 -155
  179. package/docs/integrations/intercom.md +183 -153
  180. package/docs/integrations/klaviyo.md +486 -0
  181. package/docs/integrations/linkedin-insights.md +174 -150
  182. package/docs/integrations/logrocket.md +160 -156
  183. package/docs/integrations/matomo-analytics.md +188 -178
  184. package/docs/integrations/meta-pixel.md +188 -150
  185. package/docs/integrations/microsoft-clarity.md +163 -155
  186. package/docs/integrations/microsoft-uet.md +148 -154
  187. package/docs/integrations/mixpanel-analytics.md +155 -160
  188. package/docs/integrations/one-dollar-stats.md +166 -165
  189. package/docs/integrations/openai-pixel.md +204 -301
  190. package/docs/integrations/overview.md +137 -80
  191. package/docs/integrations/pinterest-tag.md +191 -183
  192. package/docs/integrations/pirsch.md +169 -159
  193. package/docs/integrations/plausible-analytics.md +172 -158
  194. package/docs/integrations/posthog.md +313 -240
  195. package/docs/integrations/promptwatch.md +154 -154
  196. package/docs/integrations/reddit-pixel.md +185 -157
  197. package/docs/integrations/rudderstack.md +201 -186
  198. package/docs/integrations/rybbit-analytics.md +171 -160
  199. package/docs/integrations/segment.md +182 -154
  200. package/docs/integrations/snapchat-pixel.md +186 -156
  201. package/docs/integrations/tiktok-pixel.md +171 -150
  202. package/docs/integrations/umami-analytics.md +163 -158
  203. package/docs/integrations/vercel-analytics.md +166 -157
  204. package/docs/integrations/x-pixel.md +176 -150
  205. package/docs/integrations/youtube.md +121 -86
  206. package/docs/upgrade-v3.md +496 -467
  207. package/package.json +20 -9
  208. package/dist/ui-save.js +0 -1
  209. package/dist-types/ui-save.d.ts +0 -25
  210. package/docs/assets/v3/brand-bar.png +0 -0
  211. package/docs/assets/v3/mobile-card.png +0 -0
  212. package/docs/assets/v3/preferences.png +0 -0
  213. package/docs/frameworks/react/components/consent-manager-provider.md +0 -95
  214. package/docs/frameworks/react/script-loader.md +0 -69
  215. package/docs/frameworks/react/styling/overview.md +0 -266
  216. package/docs/guides/deployment-modes.md +0 -75
  217. package/docs/guides/shared-consent-controls.md +0 -158
  218. package/docs/integrations/clear-on-revocation.md +0 -167
  219. package/docs/integrations/granular-consent.md +0 -210
@@ -15,7 +15,7 @@ export type DevToolsProps = ConsentDevToolsProps;
15
15
  * @param props - Presentation options passed to the DevTools engine.
16
16
  * @returns `null`; the engine mounts its interface into `document.body`.
17
17
  */
18
- export declare const ConsentDevTools: ({ disabled, clearRecords, getPresentation, defaultOpen, defaultTab, getConsentCategories, maxEvents, position, }: ConsentDevToolsProps) => null;
18
+ export declare const ConsentDevTools: ({ disabled, clearRecords, getPresentation, defaultOpen, defaultTab, getConsentCategories, maxEvents, position, shadow, }: ConsentDevToolsProps) => null;
19
19
  /** Compatible short name for {@link ConsentDevTools}. */
20
20
  export declare const DevTools: typeof ConsentDevTools;
21
21
  /** Backward-compatible name for {@link ConsentDevTools}. */
@@ -24,13 +24,24 @@ export declare const C15TDevTools: typeof ConsentDevTools;
24
24
  export interface C15tTanStackDevtoolsPanelProps extends HTMLAttributes<HTMLDivElement>, Pick<DevToolsOptions, 'defaultTab' | 'maxEvents' | 'getConsentCategories' | 'getPresentation' | 'clearRecords'> {
25
25
  /** Prevents the embedded DevTools engine from mounting. @default false */
26
26
  disabled?: boolean;
27
+ /**
28
+ * Color scheme of the surrounding devtools shell. Omit to follow the
29
+ * operating system. {@link c15tDevtools} passes TanStack's theme.
30
+ */
31
+ theme?: TanStackDevtoolsTheme;
32
+ }
33
+ /** Color scheme TanStack Devtools passes to plugin panels. */
34
+ export type TanStackDevtoolsTheme = 'light' | 'dark';
35
+ /** Props React TanStack Devtools passes to a plugin's render function. */
36
+ export interface TanStackDevtoolsPluginProps {
37
+ theme?: TanStackDevtoolsTheme;
27
38
  }
28
39
  /** Plugin configuration accepted by React TanStack Devtools. */
29
40
  export interface TanStackDevtoolsPlugin {
30
41
  id?: string;
31
42
  name: string;
32
43
  defaultOpen?: boolean;
33
- render: ReactElement;
44
+ render: (element: HTMLElement, props?: TanStackDevtoolsPluginProps | TanStackDevtoolsTheme) => ReactElement;
34
45
  }
35
46
  /** Options for {@link c15tDevtools}. */
36
47
  export interface C15tDevtoolsPluginOptions extends C15tTanStackDevtoolsPanelProps {
@@ -0,0 +1,31 @@
1
+ import type { ConsentKernel, SaveInput, SaveResult, SaveUISource } from '@c15t/core';
2
+ import type { PreferenceDraft } from '@c15t/core/preference-draft';
3
+ /**
4
+ * The draft a `ConsentDraftProvider` shares. Here, apart from the draft
5
+ * module, so the banner's buttons can read it without loading the draft:
6
+ * the draft only runs once a preference surface renders.
7
+ */
8
+ export declare const DraftContext: import("react").Context<PreferenceDraft | null>;
9
+ export declare const REFUSED: SaveResult;
10
+ /** The kernel in context; throws outside a provider. */
11
+ export declare const useDraftKernel: () => ConsentKernel;
12
+ /**
13
+ * Whether `owner` is still the kernel this component last committed.
14
+ *
15
+ * A handle or save action kept across a runtime switch, by an async submit
16
+ * or a descendant's layout effect in the switch commit, calls through this,
17
+ * so it records nothing into the previous runtime. The committed kernel is
18
+ * read at call time (see `useCommittedRef`). A component that only unmounts
19
+ * keeps its last kernel, so a submit that outlives its dialog still saves.
20
+ */
21
+ export declare const useKernelGuard: (owner: ConsentKernel) => () => boolean;
22
+ /**
23
+ * Internal UI save path shared by stock controls and headless actions.
24
+ *
25
+ * Inside a `ConsentDraftProvider` an omitted input saves the shared draft.
26
+ * Bulk and explicit inputs go straight to the kernel; a bulk one also
27
+ * discards the draft's staged edits.
28
+ *
29
+ * @internal
30
+ */
31
+ export declare const useConsentSaveAction: () => (input?: SaveInput, uiSource?: SaveUISource) => Promise<SaveResult>;
@@ -1,4 +1,5 @@
1
- import type { AllConsentNames, ConsentKernel, ConsentState, SaveResult, SaveInput } from '@c15t/core';
1
+ import type { AllConsentNames, ConsentState, SaveResult } from '@c15t/core';
2
+ import type { PreferenceDraft, PreferenceDraftState } from '@c15t/core/preference-draft';
2
3
  import type { ReactNode } from 'react';
3
4
  /** A local, unmasked selection, committed only by an explicit save. */
4
5
  export interface ConsentDraftHandle {
@@ -27,55 +28,37 @@ export interface ConsentDraftHandle {
27
28
  save: () => Promise<SaveResult>;
28
29
  reset: () => void;
29
30
  }
30
- interface DraftSnapshot {
31
- values: ConsentState;
32
- displayedCategories: readonly AllConsentNames[];
33
- vendors: Record<string, boolean>;
34
- isDirty: boolean;
35
- isStale: boolean;
36
- }
37
- declare const createDraftStore: (kernel: ConsentKernel, defaults?: Partial<ConsentState>) => {
38
- acceptAll(): void;
39
- connect(): import("@c15t/core").Unsubscribe;
40
- getSnapshot: () => DraftSnapshot;
41
- /** The kernel this draft reads from and saves into. */
42
- kernel: ConsentKernel;
43
- rejectAll(): void;
44
- reset: () => void;
45
- save(input?: SaveInput, categories?: readonly AllConsentNames[], onSuccess?: () => void): Promise<SaveResult>;
46
- set(category: AllConsentNames, value: boolean): void;
47
- setVendor(vendorId: string, granted: boolean): void;
48
- subscribe(listener: () => void): () => void;
49
- update: (patch: Partial<ConsentState>) => void;
50
- };
51
- type DraftStore = ReturnType<typeof createDraftStore>;
31
+ type DraftStore = PreferenceDraft;
52
32
  export interface ConsentDraftProviderProps {
53
33
  children: ReactNode;
54
34
  /** Defaults apply only to categories without an explicit receipt. */
55
35
  initial?: Partial<ConsentState>;
56
36
  }
37
+ /**
38
+ * Share one draft with every draft hook and stock control below it. The
39
+ * preference dialog renders one, so its switches, vendor rows and save
40
+ * button stage into and confirm the same draft.
41
+ */
57
42
  export declare const ConsentDraftProvider: ({ children, initial, }: ConsentDraftProviderProps) => import("react").JSX.Element;
58
- /** Internal UI save path shared by stock controls and headless actions. */
59
- export declare const useConsentSaveAction: () => (input?: SaveInput) => Promise<SaveResult>;
60
43
  /**
61
- * The nearest consent draft store, for the stock preference rows. Pair with
44
+ * The nearest consent draft, for the stock preference rows. Pair with
62
45
  * {@link useConsentDraftSlice} so a row re-renders only when its own slice
63
46
  * changes, not on every staged edit elsewhere in the draft.
64
47
  *
65
- * @returns The shared draft store, or a local one outside a provider.
48
+ * @returns The shared draft, or a local one outside a provider.
66
49
  * @internal
67
50
  */
68
51
  export declare const useConsentDraftStore: () => DraftStore;
69
52
  /**
70
- * Subscribes to one slice of a consent draft store.
53
+ * Subscribes to one slice of a consent draft.
71
54
  *
72
- * @param store - Store from {@link useConsentDraftStore}.
55
+ * @param draft - Draft from {@link useConsentDraftStore}.
73
56
  * @param selector - Picks the slice. Return a primitive or a reference the
74
57
  * draft already holds.
75
58
  * @returns The selected slice.
76
59
  * @internal
77
60
  */
78
- export declare const useConsentDraftSlice: <SliceType>(store: DraftStore, selector: (draft: DraftSnapshot) => SliceType) => SliceType;
61
+ export declare const useConsentDraftSlice: <SliceType>(draft: DraftStore, selector: (state: PreferenceDraftState) => SliceType) => SliceType;
79
62
  /** Read and edit displayed choices without replacing masked effective permissions. */
80
63
  export declare const useConsentDraft: () => ConsentDraftHandle;
81
64
  /** The vendor slice of the consent draft, for a custom vendor control. */
@@ -0,0 +1,27 @@
1
+ import type { RuntimeGPPOptions } from '@c15t/core/runtime';
2
+ /** Props for {@link ConsentGPP}: the GPP options, all optional. */
3
+ export type ConsentGPPProps = RuntimeGPPOptions;
4
+ /**
5
+ * Installs `window.__gpp`, the IAB GPP CMP API, on the surrounding
6
+ * provider's kernel and keeps its GPP string in step with the visitor's
7
+ * choices. Renders nothing. Unmounting removes `__gpp`.
8
+ *
9
+ * Render it inside `ConsentProvider` (or `ConsentRoot` in Next.js and
10
+ * TanStack Start). Every prop is plain data, so a Server Component can
11
+ * render it.
12
+ *
13
+ * @param props - GPP options. See `RuntimeGPPOptions`.
14
+ * @returns `null`.
15
+ * @throws {Error} When rendered outside a consent provider.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { ConsentGPP } from '@c15t/react/gpp';
20
+ *
21
+ * <ConsentProvider options={{ mode: hosted({ url }) }}>
22
+ * <ConsentGPP usFallback="none" />
23
+ * <App />
24
+ * </ConsentProvider>
25
+ * ```
26
+ */
27
+ export declare const ConsentGPP: ({ cmpId, mspaMode, optOutCategories, tcf, usApproach, usFallback, }: ConsentGPPProps) => null;
@@ -1,3 +1,4 @@
1
+ import type { FocusTrapOptions } from '@c15t/ui/utils/dom';
1
2
  import type { RefObject } from 'react';
2
3
  /**
3
4
  * Hook that manages focus trapping within a container.
@@ -8,7 +9,8 @@ import type { RefObject } from 'react';
8
9
  *
9
10
  * @param shouldTrap - Boolean indicating whether focus should be trapped
10
11
  * @param containerRef - Reference to the container element
12
+ * @param options - Where the trap puts focus when it starts
11
13
  *
12
14
  * @public
13
15
  */
14
- export declare const useFocusTrap: (shouldTrap: boolean, containerRef: RefObject<HTMLElement | null> | null) => void;
16
+ export declare const useFocusTrap: (shouldTrap: boolean, containerRef: RefObject<HTMLElement | null> | null, options?: FocusTrapOptions) => void;
@@ -17,7 +17,8 @@
17
17
  * observed through the selector hooks, whose subscription model handles
18
18
  * invalidation correctly.
19
19
  */
20
- import type { AllConsentNames, ConsentKernel, PromptPresentation, PreferencesPresentation, ConsentSnapshot, ConsentState, KernelActiveUI, KernelBranding, KernelIABState, KernelModel, KernelOverrides, KernelTranslations, KernelUser, LocationResponse, PolicyScopeMode, ResolvedVendor, VendorChoice } from '@c15t/core';
20
+ import type { AllConsentNames, ConsentKernel, ConsentPresentation, ExperimentAssignment, PromptPresentation, PreferencesPresentation, ConsentSnapshot, ConsentState, KernelActiveUI, KernelBranding, KernelIABState, KernelModel, KernelOverrides, KernelTranslations, KernelUser, LocationResponse, PolicyScopeMode, ResolvedVendor, VendorChoice } from '@c15t/core';
21
+ import type { Theme } from './types/theme/index.js';
21
22
  /**
22
23
  * Full snapshot accessor. Escape hatch for consumers that genuinely need
23
24
  * multiple slices. Prefer narrow hooks for re-render isolation.
@@ -108,14 +109,13 @@ export declare const useDeclaredVendors: () => readonly ResolvedVendor[];
108
109
  */
109
110
  export declare const useVendorChoice: () => Readonly<VendorChoice> | null;
110
111
  /**
111
- * Whether one vendor is allowed: its category condition passes and the
112
- * visitor has not turned it off.
112
+ * Whether one vendor may load: it is declared, its category condition
113
+ * passes, and outside IAB the visitor has not turned it off.
113
114
  *
114
- * @param vendorId - Vendor slug as declared in `vendors` or on a script.
115
- * @returns `false` while the vendor is denied outside `iab`, otherwise the
116
- * result of its declared category condition. An undeclared id is `true`:
117
- * nothing is known about its category, and a denial only exists for a vendor
118
- * the visitor saw.
115
+ * @param vendorId - Vendor id as declared in `vendors`, on a script or by
116
+ * the backend.
117
+ * @returns `true` while the vendor may load. An id nothing declares, such
118
+ * as a typo, returns `false` and logs a development warning.
119
119
  */
120
120
  export declare const useVendorAllowed: (vendorId: string) => boolean;
121
121
  /** Register categories used by scripts, frames, or other integrations. */
@@ -125,11 +125,28 @@ export declare const useRegisterConsentCategories: () => (categories: readonly A
125
125
  */
126
126
  export declare const useSetOverrides: () => (input: KernelOverrides) => void;
127
127
  /**
128
- * Sync mutation: switch active language.
128
+ * Switch the consent language and load its copy.
129
+ *
130
+ * Stores the language override and runs init again, so the banner and
131
+ * dialog show copy in that language: a hosted backend returns it, and
132
+ * offline mode takes it from the bundled translations and `i18n.messages`.
133
+ * Setting the current language does nothing. A disabled provider stores
134
+ * the language without running init.
135
+ *
136
+ * @returns A setter that takes a language code such as `'de'`.
137
+ *
138
+ * @example
139
+ * ```tsx
140
+ * const setLanguage = useSetLanguage();
141
+ * <button onClick={() => setLanguage('de')}>Deutsch</button>
142
+ * ```
129
143
  */
130
144
  export declare const useSetLanguage: () => (code: string) => void;
131
145
  /**
132
146
  * Sync mutation: set the active UI surface (banner/dialog/none).
147
+ *
148
+ * Explicit navigation: a pending save on this kernel can no longer close or
149
+ * restore a surface once the visitor navigated.
133
150
  */
134
151
  export declare const useSetActiveUI: () => (ui: KernelActiveUI) => void;
135
152
  /**
@@ -161,8 +178,6 @@ export declare const usePromptRequirement: () => ConsentSnapshot['promptRequirem
161
178
  export declare const useNoticeDismissal: () => ConsentSnapshot['noticeDismissal'];
162
179
  /** Read privacySignals from the kernel without a competing projection. */
163
180
  export declare const usePrivacySignals: () => ConsentSnapshot['privacySignals'];
164
- /** Read optOutDirectives from the kernel without a competing projection. */
165
- export declare const useOptOutDirectives: () => ConsentSnapshot['optOutDirectives'];
166
181
  /** Read resolution from the kernel without a competing projection. */
167
182
  export declare const usePolicyResolution: () => ConsentSnapshot['resolution'];
168
183
  /** Read policyRule from the kernel without a competing projection. */
@@ -171,7 +186,36 @@ export declare const usePolicyRule: () => ConsentSnapshot['policyRule'];
171
186
  export declare const useRestrictions: () => ConsentSnapshot['restrictions'];
172
187
  /** Dismiss the current local notice without recording a category choice. */
173
188
  export declare const useDismissNotice: () => ConsentKernel['commands']['dismissNotice'];
174
- /** Host first-layer presentation. */
189
+ /**
190
+ * The presentation experiment arm this visitor runs. Built-in assignment
191
+ * lands after mount; a host-resolved `variant` is known at once.
192
+ *
193
+ * @returns The assignment, or `null` while no experiment is configured, the
194
+ * arm is not assigned yet, or the visitor's policy rejects it.
195
+ *
196
+ * @example
197
+ * ```tsx
198
+ * const arm = useExperiment();
199
+ * return arm ? <p>{arm.id}: {arm.variant}</p> : null;
200
+ * ```
201
+ */
202
+ export declare const useExperiment: () => Readonly<ExperimentAssignment> | null;
203
+ /**
204
+ * The host presentation with the assigned experiment arm merged over it.
205
+ *
206
+ * @returns The presentation to render: `options.presentation` itself while
207
+ * no arm is assigned.
208
+ */
209
+ export declare const useResolvedPresentation: () => ConsentPresentation | undefined;
210
+ /**
211
+ * The host theme with the assigned experiment arm's `theme` merged over it.
212
+ * Render its tokens with `<ConsentTheme theme={useResolvedTheme()} />`.
213
+ *
214
+ * @returns The theme to render: `options.theme` itself while no arm is
215
+ * assigned or the arm has no theme.
216
+ */
217
+ export declare const useResolvedTheme: () => Theme | undefined;
218
+ /** Host first-layer presentation, with the experiment arm applied. */
175
219
  export declare const usePromptPresentation: () => PromptPresentation;
176
- /** Host persistent preferences presentation. */
220
+ /** Host persistent preferences presentation, with the experiment arm applied. */
177
221
  export declare const usePreferencesPresentation: () => PreferencesPresentation;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * IAB TCF 2.3 React components and hooks.
2
+ * IAB TCF 2.4 React components and hooks.
3
3
  *
4
4
  * This subpath export contains all IAB-specific React UI. It is only
5
5
  * loaded when explicitly imported from '@c15t/react/iab'.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentBanner, useConsentBannerSurface } from '../components/prompt/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentDialogLink } from '../components/panel-link/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentDialogTrigger, ConsentDialogTriggerToolbar, } from '../components/panel-trigger/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentDialog, ConsentWidget } from '../aggregate-components.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentGate, Frame } from '../components/consent-gate/index.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { createConsentKernel, custom, hosted } from '@c15t/core';
8
+ export { offline } from '../transports/offline.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentDraftProvider, useConsentDraft, useVendorDraft, } from '../draft.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { useActiveUI, useBranding, useConsent, useConsents, useDeclaredVendors, useDismissNotice, useEffectivePermissions, useExperiment, useExplicitChoice, useHasConsentPolicy, useHasConsentPreferences, useHasConsentUI, useIABEnabled, useIABSnapshot, useIdentify, useInit, useLocation, useModel, useNoticeDismissal, useOverrides, usePolicyCategories, usePolicyResolution, usePolicyRule, usePolicyScopeMode, usePreferencesPresentation, usePrivacySignals, usePromptPresentation, usePromptRequirement, usePurposeConsent, useRegisterConsentCategories, useResolvedPresentation, useResolvedTheme, useRestrictions, useSaveConsents, useSetActiveUI, useSetLanguage, useSetOverrides, useSnapshot, useSpecialFeatureOptIn, useSubscribeToConsentChanges, useTCString, useUser, useVendorAllowed, useVendorChoice, useVendorConsent, } from '../hooks.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { useIframeBlocker, useNetworkBlocker, usePersistence, useScriptLoader, } from '../module-hooks.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentProvider } from '../provider.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { ConsentTheme } from '../consent-theme.js';
8
+ export { defineTheme } from '../types/theme/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * One group of `@c15t/react`'s public exports. The package index re-exports
3
+ * each group with `export *`, so a bundler that splits code by reachability
4
+ * (esbuild) does not treat every module the index names as part of an app
5
+ * that imports one hook: only the groups it uses are live.
6
+ */
7
+ export { useTranslations } from '../component-hooks/use-translations.js';
@@ -32,31 +32,30 @@
32
32
  * module wiring around a single per-mount kernel.
33
33
  */
34
34
  export type { ConsentKernel, ConsentSnapshot, ConsentState, HostedTransportOptions, InitContext, InitResponse, InitResult, KernelConfig, KernelEvent, KernelOverrides, KernelTransport, KernelUser, Listener, HostedModeOptions, ProviderTransportContext, ProviderTransportFactory, ProviderTransportKind, SavePayload, SaveResult, Unsubscribe, } from '@c15t/core';
35
- export { createConsentKernel, custom, hosted } from '@c15t/core';
36
35
  export type { OfflineModeOptions } from './transports/offline.js';
37
- export { offline } from './transports/offline.js';
38
- export { ConsentDialog, ConsentWidget } from './aggregate-components.js';
39
36
  export type { ConsentBannerButton, ConsentBannerLayout, ConsentBannerProps, ConsentBannerRight, ConsentBannerRightLinkProps, ConsentBannerRightsProps, ConsentBannerSurface, } from './components/prompt/index.js';
40
- export { ConsentBanner, type ConsentBannerCompoundComponent, useConsentBannerSurface, } from './components/prompt/index.js';
41
37
  export type { ConsentDialogCompoundComponent, ConsentDialogProps, } from './components/panel/index.js';
42
38
  export type { ConsentDialogLinkProps } from './components/panel-link/index.js';
43
- export { ConsentDialogLink } from './components/panel-link/index.js';
44
39
  export type { ConsentDialogTriggerProps, ConsentDialogTriggerToolbarAction, ConsentDialogTriggerToolbarPreferences, ConsentDialogTriggerToolbarProps, TriggerOrientation, } from './components/panel-trigger/index.js';
45
- export { ConsentDialogTrigger, ConsentDialogTriggerToolbar, } from './components/panel-trigger/index.js';
46
40
  export type { ConsentWidgetCompoundComponent, ConsentWidgetProps, } from './components/preferences/index.js';
47
41
  export type { ConsentGateProps, FrameProps } from './components/consent-gate/index.js';
48
- export { ConsentGate, Frame } from './components/consent-gate/index.js';
49
42
  export type { ConsentDraftHandle, ConsentDraftProviderProps, VendorDraftHandle, } from './draft.js';
50
- export { ConsentDraftProvider, useConsentDraft, useVendorDraft } from './draft.js';
51
- export { useTranslations } from './component-hooks/use-translations.js';
52
- export { useActiveUI, useBranding, useConsent, useConsents, useHasConsentPolicy, useHasConsentPreferences, useHasConsentUI, useIABEnabled, useIABSnapshot, useIdentify, useInit, useLocation, useModel, useOverrides, usePromptPresentation, usePolicyCategories, usePreferencesPresentation, usePolicyScopeMode, usePurposeConsent, useRegisterConsentCategories, useSaveConsents, useSetActiveUI, useSetLanguage, useSetOverrides, useSnapshot, useSpecialFeatureOptIn, useSubscribeToConsentChanges, useTCString, useUser, useDeclaredVendors, useVendorAllowed, useVendorChoice, useVendorConsent, } from './hooks.js';
53
43
  export type { UseIframeBlockerOptions, UseNetworkBlockerOptions, UsePersistenceOptions, UseScriptLoaderOptions, } from './module-hooks.js';
54
- export { useIframeBlocker, useNetworkBlocker, usePersistence, useScriptLoader, } from './module-hooks.js';
55
44
  export type { ConsentProviderOptions, ConsentProviderCallbacks, ConsentProviderPrefetch, ConsentProviderProps, ExternalRuntimeProviderOptions, ExternalRuntimeProviderProps, OwnedRuntimeProviderProps, } from './provider.js';
56
- export { ConsentProvider } from './provider.js';
57
- export { ConsentTheme } from './consent-theme.js';
58
45
  export type { ConsentThemeProps } from './consent-theme.js';
46
+ export type { Theme } from './types/theme/index.js';
47
+ export type { ConsentBannerCompoundComponent } from './components/prompt/index.js';
59
48
  export type { ReactUIOptions } from './types/manager.js';
60
- export { defineTheme, type Theme } from './types/theme/index.js';
61
- export { useExplicitChoice, useEffectivePermissions, usePromptRequirement, useNoticeDismissal, usePrivacySignals, useOptOutDirectives, usePolicyResolution, usePolicyRule, useRestrictions, useDismissNotice, } from './hooks.js';
62
49
  export type { ConsentPresentation, PromptPresentation, PreferencesPresentation, PresentationAction, PromptPosition, PromptVariant, ResolvedConsentPresentation, } from '@c15t/core';
50
+ export * from './index-parts/core.js';
51
+ export * from './index-parts/consent-dialog.js';
52
+ export * from './index-parts/consent-banner.js';
53
+ export * from './index-parts/consent-dialog-link.js';
54
+ export * from './index-parts/consent-dialog-trigger.js';
55
+ export * from './index-parts/consent-gate.js';
56
+ export * from './index-parts/draft.js';
57
+ export * from './index-parts/translations.js';
58
+ export * from './index-parts/module-hooks.js';
59
+ export * from './index-parts/provider.js';
60
+ export * from './index-parts/theme.js';
61
+ export * from './index-parts/hooks.js';
@@ -56,11 +56,3 @@ export declare const useCategoryAllowed: (category: AllConsentNames) => boolean;
56
56
  * @internal
57
57
  */
58
58
  export declare const useTranslationLanguage: () => string;
59
- /**
60
- * Categories the preference surface lists: `necessary` plus the recorded
61
- * choice scope, or the policy scope when no choice scope applies.
62
- *
63
- * @returns A list whose identity changes only when the scope does.
64
- * @internal
65
- */
66
- export declare const useDisplayedCategories: () => readonly AllConsentNames[];
@@ -1,5 +1,5 @@
1
1
  import type { ConsentKernel } from '@c15t/core';
2
- import type { IframeBlockerHandle } from '@c15t/core/modules/iframe-blocker';
2
+ import type { IframeBlockerHandle, IframeBlockerOptions } from '@c15t/core/modules/iframe-blocker';
3
3
  export interface UseIframeBlockerOptions {
4
4
  disableAutomaticBlocking?: boolean;
5
5
  }
@@ -21,13 +21,18 @@ export declare const useIframeBlocker: (options?: UseIframeBlockerOptions) => If
21
21
  */
22
22
  export declare const watchGatedIframes: (kernel: ConsentKernel, onFound: () => void) => () => void;
23
23
  /**
24
- * The provider's default iframe blocker. Loads the blocker module when the
25
- * first gated iframe (`data-category` or `data-vendor`) is on the page
26
- * instead of on every mount, so pages without one never download it.
24
+ * The provider's iframe blocker. Loads the blocker module when the first
25
+ * gated iframe (`data-category` or `data-vendor`) is on the page instead of
26
+ * on every mount, so pages without one never download it. Until then it
27
+ * pauses gated frames that arrive with a `src` consent does not allow.
27
28
  *
28
- * @param options - Blocker options. With `disableAutomaticBlocking` the
29
- * module loads at once, as it did before.
29
+ * Passed to the provider runtime as its `createIframeBlocker` module.
30
+ *
31
+ * @param options - The kernel and blocker options. With
32
+ * `disableAutomaticBlocking` the module loads at once.
33
+ * @returns A handle; `processAllIframes()` reaches the blocker once it has
34
+ * loaded.
30
35
  * @internal
31
36
  */
32
- export declare const useIframeBlockerOnDemand: (options?: UseIframeBlockerOptions) => void;
37
+ export declare const createIframeBlockerOnDemand: ({ disableAutomaticBlocking, kernel, }: IframeBlockerOptions) => IframeBlockerHandle;
33
38
  export type { IframeBlockerHandle };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Tailwind 3 PostCSS plugin for c15t stylesheets, re-exported from
3
+ * `@c15t/ui/postcss-tailwind3` so an app that installs `@c15t/react` can list
4
+ * `@c15t/react/postcss-tailwind3` without installing `@c15t/ui`.
5
+ * See `@c15t/ui/postcss-tailwind3` for what the plugin does. It must come
6
+ * before `tailwindcss`.
7
+ *
8
+ * @example
9
+ * ```js
10
+ * // postcss.config.mjs
11
+ * export default {
12
+ * plugins: {
13
+ * '@c15t/react/postcss-tailwind3': {},
14
+ * tailwindcss: {},
15
+ * autoprefixer: {},
16
+ * },
17
+ * };
18
+ * ```
19
+ */
20
+ export * from '@c15t/ui/postcss-tailwind3';
21
+ export { default } from '@c15t/ui/postcss-tailwind3';