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

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 (241) hide show
  1. package/AGENTS.md +9 -2
  2. package/dist/aggregate-components.js +1 -1
  3. package/dist/chunk-warming.js +1 -1
  4. package/dist/component-hooks/use-headless-iab-consent-ui.js +1 -1
  5. package/dist/component-hooks/use-panel-trigger.js +1 -1
  6. package/dist/components/consent-gate/atoms.js +1 -0
  7. package/dist/components/consent-gate/consent-gate.js +2 -0
  8. package/dist/components/consent-gate/index.js +2 -0
  9. package/dist/components/consent-preferences-link/consent-preferences-link.js +1 -1
  10. package/dist/components/iab-panel/atoms/purpose-item.js +1 -1
  11. package/dist/components/iab-panel/atoms/stack-item.js +1 -1
  12. package/dist/components/iab-panel/iab-panel.js +1 -1
  13. package/dist/components/iab-panel/index.js +1 -1
  14. package/dist/components/panel/atoms/overlay.js +1 -1
  15. package/dist/components/panel/atoms/root.js +1 -1
  16. package/dist/components/panel/index.js +1 -1
  17. package/dist/components/panel/panel.js +1 -1
  18. package/dist/components/panel-trigger/atoms/button.js +1 -1
  19. package/dist/components/panel-trigger/atoms/icon.js +1 -1
  20. package/dist/components/panel-trigger/atoms/root.js +1 -1
  21. package/dist/components/panel-trigger/atoms/trigger-icons.js +1 -0
  22. package/dist/components/panel-trigger/panel-trigger-toolbar.js +1 -1
  23. package/dist/components/preferences/atoms/accordion.js +1 -1
  24. package/dist/components/preferences/atoms/root.js +1 -1
  25. package/dist/components/preferences/atoms/vendor-list.js +1 -0
  26. package/dist/components/preferences/index.js +1 -1
  27. package/dist/components/prompt/policy-actions.js +1 -1
  28. package/dist/components/shared/primitives/button.js +1 -1
  29. package/dist/components/shared/ui/accordion/accordion.js +1 -1
  30. package/dist/components/shared/ui/collapsible/collapsible.js +1 -1
  31. package/dist/components/shared/ui/logo.js +1 -1
  32. package/dist/components/shared/ui/preference-item/preference-item.js +1 -1
  33. package/dist/components/shared/ui/switch/switch.js +1 -1
  34. package/dist/components/shared/ui/tabs/tabs.js +1 -1
  35. package/dist/consent-gate.js +2 -0
  36. package/dist/consent-theme.js +1 -0
  37. package/dist/draft.js +1 -1
  38. package/dist/external-iab-context.js +1 -1
  39. package/dist/headless.js +1 -1
  40. package/dist/hooks/use-committed-ref.js +2 -0
  41. package/dist/hooks.js +1 -1
  42. package/dist/iab/styles.tw3.css +1 -41
  43. package/dist/iab-context.js +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/kernel-selector.js +1 -0
  46. package/dist/module-hooks/iframe-blocker.js +1 -1
  47. package/dist/module-hooks/network-blocker.js +1 -1
  48. package/dist/module-hooks/network-hold.js +2 -0
  49. package/dist/module-hooks/persistence.js +1 -1
  50. package/dist/panel.js +1 -1
  51. package/dist/preferences.js +1 -2
  52. package/dist/provider.js +1 -1
  53. package/dist/styles.tw3.css +1 -43
  54. package/dist/ui-save.js +1 -1
  55. package/dist/utils/deferred-module.js +2 -0
  56. package/dist/version.js +1 -1
  57. package/dist-types/aggregate-components.d.ts +2 -2
  58. package/dist-types/chunk-warming.d.ts +41 -8
  59. package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +2 -2
  60. package/dist-types/components/consent-gate/atoms.d.ts +11 -0
  61. package/dist-types/components/consent-gate/consent-gate.d.ts +2 -0
  62. package/dist-types/components/consent-gate/index.d.ts +41 -0
  63. package/dist-types/components/{frame → consent-gate}/types.d.ts +7 -7
  64. package/dist-types/components/consent-preferences-link/consent-preferences-link.d.ts +1 -1
  65. package/dist-types/components/consent-preferences-link/index.d.ts +1 -1
  66. package/dist-types/components/iab-panel/atoms/purpose-item.d.ts +5 -2
  67. package/dist-types/components/iab-panel/atoms/stack-item.d.ts +7 -2
  68. package/dist-types/components/iab-panel/atoms/vendor-list.d.ts +1 -1
  69. package/dist-types/components/iab-panel/iab-panel.d.ts +1 -1
  70. package/dist-types/components/iab-panel/index.d.ts +25 -24
  71. package/dist-types/components/iab-prompt/index.d.ts +17 -17
  72. package/dist-types/components/panel/atoms/card.d.ts +4 -4
  73. package/dist-types/components/panel/atoms/overlay.d.ts +1 -1
  74. package/dist-types/components/panel/index.d.ts +8 -7
  75. package/dist-types/components/panel/panel.d.ts +3 -3
  76. package/dist-types/components/panel-link/index.d.ts +1 -1
  77. package/dist-types/components/panel-trigger/atoms/button.d.ts +1 -1
  78. package/dist-types/components/panel-trigger/atoms/icon.d.ts +1 -1
  79. package/dist-types/components/panel-trigger/atoms/root.d.ts +2 -2
  80. package/dist-types/components/panel-trigger/atoms/toolbar.d.ts +2 -2
  81. package/dist-types/components/panel-trigger/atoms/trigger-icons.d.ts +20 -0
  82. package/dist-types/components/panel-trigger/index.d.ts +4 -4
  83. package/dist-types/components/panel-trigger/panel-trigger-toolbar.d.ts +1 -1
  84. package/dist-types/components/panel-trigger/panel-trigger.d.ts +9 -9
  85. package/dist-types/components/panel-trigger/types.d.ts +1 -1
  86. package/dist-types/components/preferences/atoms/accordion.d.ts +6 -4
  87. package/dist-types/components/preferences/atoms/button.d.ts +1 -1
  88. package/dist-types/components/preferences/atoms/footer.d.ts +1 -1
  89. package/dist-types/components/preferences/atoms/root.d.ts +1 -1
  90. package/dist-types/components/preferences/atoms/vendor-list.d.ts +23 -0
  91. package/dist-types/components/preferences/index.d.ts +14 -11
  92. package/dist-types/components/preferences/policy-actions.d.ts +2 -2
  93. package/dist-types/components/preferences/preferences.d.ts +1 -1
  94. package/dist-types/components/preferences/types.d.ts +1 -1
  95. package/dist-types/components/prompt/components.d.ts +3 -3
  96. package/dist-types/components/prompt/index.d.ts +11 -11
  97. package/dist-types/components/prompt/policy-actions.d.ts +2 -2
  98. package/dist-types/components/prompt/prompt.d.ts +1 -1
  99. package/dist-types/components/shared/policy-actions.d.ts +2 -2
  100. package/dist-types/components/shared/primitives/box.d.ts +1 -1
  101. package/dist-types/components/shared/primitives/button.d.ts +2 -2
  102. package/dist-types/components/shared/primitives/button.types.d.ts +1 -1
  103. package/dist-types/components/shared/ui/accordion/accordion.d.ts +3 -2
  104. package/dist-types/components/shared/ui/accordion/index.d.ts +2 -2
  105. package/dist-types/components/shared/ui/animated-collapse/index.d.ts +2 -2
  106. package/dist-types/components/shared/ui/branding.d.ts +1 -1
  107. package/dist-types/components/shared/ui/button/button.d.ts +1 -1
  108. package/dist-types/components/shared/ui/button/index.d.ts +2 -2
  109. package/dist-types/components/shared/ui/collapsible/collapsible.d.ts +1 -0
  110. package/dist-types/components/shared/ui/collapsible/index.d.ts +1 -1
  111. package/dist-types/components/shared/ui/dialog/index.d.ts +1 -1
  112. package/dist-types/components/shared/ui/logo.d.ts +0 -10
  113. package/dist-types/components/shared/ui/preference-item/index.d.ts +1 -1
  114. package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +14 -0
  115. package/dist-types/components/shared/ui/switch/index.d.ts +2 -2
  116. package/dist-types/components/shared/ui/switch/switch.d.ts +2 -1
  117. package/dist-types/components/shared/ui/tabs/index.d.ts +1 -1
  118. package/dist-types/components/shared/ui/tabs/tabs.d.ts +1 -0
  119. package/dist-types/consent-gate.d.ts +1 -0
  120. package/dist-types/consent-theme.d.ts +38 -0
  121. package/dist-types/context/index.d.ts +3 -3
  122. package/dist-types/context/theme-context.d.ts +1 -1
  123. package/dist-types/draft.d.ts +96 -7
  124. package/dist-types/headless.d.ts +6 -7
  125. package/dist-types/hooks/use-committed-ref.d.ts +24 -0
  126. package/dist-types/hooks/use-headless-iab-consent-ui.d.ts +1 -1
  127. package/dist-types/hooks/use-iab-manager.d.ts +1 -1
  128. package/dist-types/hooks/use-theme.d.ts +1 -1
  129. package/dist-types/hooks.d.ts +30 -1
  130. package/dist-types/iab.d.ts +5 -5
  131. package/dist-types/index.d.ts +26 -25
  132. package/dist-types/kernel-selector.d.ts +66 -0
  133. package/dist-types/module-hooks/iframe-blocker.d.ts +27 -0
  134. package/dist-types/module-hooks/network-blocker.d.ts +23 -0
  135. package/dist-types/module-hooks/network-hold.d.ts +47 -0
  136. package/dist-types/module-hooks.d.ts +4 -4
  137. package/dist-types/panel-link.d.ts +1 -1
  138. package/dist-types/panel-trigger.d.ts +1 -1
  139. package/dist-types/panel.d.ts +13 -1
  140. package/dist-types/preferences.d.ts +12 -1
  141. package/dist-types/primitives/accordion.d.ts +1 -1
  142. package/dist-types/primitives/button.d.ts +1 -1
  143. package/dist-types/primitives/collapsible.d.ts +1 -1
  144. package/dist-types/primitives/dialog.d.ts +1 -1
  145. package/dist-types/primitives/preference-item.d.ts +1 -1
  146. package/dist-types/primitives/switch.d.ts +1 -1
  147. package/dist-types/primitives/tabs.d.ts +1 -1
  148. package/dist-types/primitives.d.ts +7 -7
  149. package/dist-types/prompt.d.ts +1 -1
  150. package/dist-types/provider.d.ts +62 -12
  151. package/dist-types/server/fetch-ssr-data.d.ts +1 -1
  152. package/dist-types/server/index.d.ts +5 -5
  153. package/dist-types/theme-provider.d.ts +2 -2
  154. package/dist-types/types/index.d.ts +3 -3
  155. package/dist-types/types/manager.d.ts +1 -1
  156. package/dist-types/types/theme/index.d.ts +1 -1
  157. package/dist-types/ui-config-context.d.ts +3 -1
  158. package/dist-types/ui-save.d.ts +21 -1
  159. package/dist-types/utils/deferred-module.d.ts +13 -0
  160. package/dist-types/utils/index.d.ts +4 -4
  161. package/dist-types/utils/merge-slot-props.d.ts +2 -2
  162. package/dist-types/utils/merge-styles.d.ts +1 -1
  163. package/dist-types/utils/theme-utils.d.ts +1 -1
  164. package/dist-types/version.d.ts +1 -1
  165. package/docs/README.md +9 -2
  166. package/docs/customization/overview.md +4 -3
  167. package/docs/customization/recipes.md +4 -2
  168. package/docs/customization/tokens.md +66 -3
  169. package/docs/frameworks/react/components/consent-dialog.md +46 -7
  170. package/docs/frameworks/react/components/{frame.md → consent-gate.md} +35 -31
  171. package/docs/frameworks/react/components/consent-manager-provider.md +35 -11
  172. package/docs/frameworks/react/components/consent-widget.md +48 -6
  173. package/docs/frameworks/react/concepts/consent-categories.md +38 -2
  174. package/docs/frameworks/react/hooks/{use-consent-manager/overview.md → overview.md} +7 -5
  175. package/docs/frameworks/react/iab/overview.md +121 -1
  176. package/docs/frameworks/react/network-blocker.md +146 -0
  177. package/docs/frameworks/react/script-loader.md +6 -0
  178. package/docs/frameworks/react/styling/overview.md +71 -22
  179. package/docs/guides/consent-state.md +327 -0
  180. package/docs/guides/deployment-modes.md +12 -0
  181. package/docs/guides/shared-consent-controls.md +158 -0
  182. package/docs/integrations/adobe-analytics.md +1 -1
  183. package/docs/integrations/ahrefs-analytics.md +1 -1
  184. package/docs/integrations/amplitude.md +1 -1
  185. package/docs/integrations/building-integrations.md +5 -0
  186. package/docs/integrations/clearbit.md +1 -1
  187. package/docs/integrations/cloudflare-web-analytics.md +1 -1
  188. package/docs/integrations/cloudflare-zaraz.md +399 -0
  189. package/docs/integrations/crisp.md +1 -1
  190. package/docs/integrations/databuddy.md +1 -1
  191. package/docs/integrations/fathom-analytics.md +1 -1
  192. package/docs/integrations/front-chat.md +322 -0
  193. package/docs/integrations/google-maps.md +21 -21
  194. package/docs/integrations/google-tag-manager.md +1 -1
  195. package/docs/integrations/google-tag.md +1 -1
  196. package/docs/integrations/granular-consent.md +210 -0
  197. package/docs/integrations/heap.md +1 -1
  198. package/docs/integrations/hightouch.md +1 -1
  199. package/docs/integrations/hotjar.md +1 -1
  200. package/docs/integrations/intercom.md +1 -1
  201. package/docs/integrations/linkedin-insights.md +1 -1
  202. package/docs/integrations/logrocket.md +1 -1
  203. package/docs/integrations/matomo-analytics.md +1 -1
  204. package/docs/integrations/meta-pixel.md +1 -1
  205. package/docs/integrations/microsoft-clarity.md +1 -1
  206. package/docs/integrations/microsoft-uet.md +1 -1
  207. package/docs/integrations/mixpanel-analytics.md +1 -1
  208. package/docs/integrations/one-dollar-stats.md +305 -0
  209. package/docs/integrations/openai-pixel.md +1 -1
  210. package/docs/integrations/overview.md +22 -18
  211. package/docs/integrations/pinterest-tag.md +321 -0
  212. package/docs/integrations/pirsch.md +1 -1
  213. package/docs/integrations/plausible-analytics.md +1 -1
  214. package/docs/integrations/posthog.md +1 -1
  215. package/docs/integrations/promptwatch.md +1 -1
  216. package/docs/integrations/reddit-pixel.md +1 -1
  217. package/docs/integrations/rudderstack.md +1 -1
  218. package/docs/integrations/rybbit-analytics.md +1 -1
  219. package/docs/integrations/segment.md +1 -1
  220. package/docs/integrations/snapchat-pixel.md +1 -1
  221. package/docs/integrations/tiktok-pixel.md +1 -1
  222. package/docs/integrations/umami-analytics.md +1 -1
  223. package/docs/integrations/vercel-analytics.md +1 -1
  224. package/docs/integrations/x-pixel.md +1 -1
  225. package/docs/integrations/youtube.md +27 -22
  226. package/docs/upgrade-v3.md +176 -1
  227. package/package.json +26 -16
  228. package/dist/component-hooks/use-manager.js +0 -2
  229. package/dist/components/frame/atoms.js +0 -1
  230. package/dist/components/frame/frame.js +0 -2
  231. package/dist/components/frame/index.js +0 -2
  232. package/dist/frame.js +0 -2
  233. package/dist-types/component-hooks/use-manager.d.ts +0 -40
  234. package/dist-types/components/frame/atoms.d.ts +0 -11
  235. package/dist-types/components/frame/frame.d.ts +0 -2
  236. package/dist-types/components/frame/index.d.ts +0 -24
  237. package/dist-types/frame.d.ts +0 -1
  238. package/readme.json +0 -48
  239. package/src/iab/styles.css +0 -11
  240. package/src/styles.css +0 -10
  241. /package/dist/components/{frame → consent-gate}/types.js +0 -0
@@ -1,2 +1,2 @@
1
- export * from './button';
2
- export * from './button.types';
1
+ export * from './button.js';
2
+ export * from './button.types.js';
@@ -1,3 +1,4 @@
1
+ import '@c15t/ui/styles/dialog';
1
2
  import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
2
3
  export declare const collapsibleVariants: () => {
3
4
  content: (options?: {
@@ -1 +1 @@
1
- export * from './collapsible';
1
+ export * from './collapsible.js';
@@ -1 +1 @@
1
- export * from './dialog';
1
+ export * from './dialog.js';
@@ -16,14 +16,4 @@ export declare const InthLogo: (props: SVGProps<SVGSVGElement> & IconProps) => i
16
16
  * INTH icon-only mark for compact placements like floating triggers.
17
17
  */
18
18
  export declare const InthIconOnly: (props: SVGProps<SVGSVGElement> & IconProps) => import("react").JSX.Element;
19
- /**
20
- * Fingerprint icon for privacy/consent contexts.
21
- * A generic icon representing user identity and privacy.
22
- */
23
- export declare const FingerprintIcon: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & IconProps) => import("react").JSX.Element;
24
- /**
25
- * Settings/gear icon for preference contexts.
26
- * A generic icon representing configuration and settings.
27
- */
28
- export declare const SettingsIcon: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & IconProps) => import("react").JSX.Element;
29
19
  export {};
@@ -1 +1 @@
1
- export * from './preference-item';
1
+ export * from './preference-item.js';
@@ -1,4 +1,5 @@
1
1
  import type { ConsentComponentSlotKey } from '@c15t/schema/config';
2
+ import '@c15t/ui/styles/dialog';
2
3
  import type { HTMLAttributes, ReactNode } from 'react';
3
4
  export type PreferenceItemVariantsProps = Record<never, never>;
4
5
  export declare const preferenceItemVariants: () => {
@@ -66,6 +67,19 @@ export interface PreferenceItemTitleProps extends HTMLAttributes<HTMLHeadingElem
66
67
  }
67
68
  declare const PreferenceItemTitle: import("react").ForwardRefExoticComponent<PreferenceItemTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
68
69
  export interface PreferenceItemContentProps extends HTMLAttributes<HTMLDivElement> {
70
+ /**
71
+ * Render the children while the item has never been opened.
72
+ *
73
+ * By default the content element is always rendered, so the trigger's
74
+ * `aria-controls` target exists, but its children mount the first time
75
+ * the item opens and then stay mounted, so the close transition and any
76
+ * state inside them survive. Collapsed content is `inert` and
77
+ * `aria-hidden` either way. Set this when collapsed children must be in
78
+ * the DOM, for example when custom CSS shows them.
79
+ *
80
+ * @defaultValue false
81
+ */
82
+ forceMount?: boolean;
69
83
  innerClassName?: string;
70
84
  innerSlotKey?: ConsentComponentSlotKey;
71
85
  noStyle?: boolean;
@@ -1,2 +1,2 @@
1
- export * from './switch';
2
- export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchThumbCSSVariables, SwitchTrackCSSVariables, } from './switch.types';
1
+ export * from './switch.js';
2
+ export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchThumbCSSVariables, SwitchTrackCSSVariables, } from './switch.types.js';
@@ -1,5 +1,6 @@
1
+ import '@c15t/ui/styles/dialog';
1
2
  import type { ButtonHTMLAttributes } from 'react';
2
- import type { ThemeValue } from '../../../../types/theme';
3
+ import type { ThemeValue } from '../../../../types/theme/index.js';
3
4
  export type SwitchSize = 'medium' | 'small';
4
5
  export interface SwitchVariantsProps {
5
6
  size?: SwitchSize;
@@ -1 +1 @@
1
- export * from './tabs';
1
+ export * from './tabs.js';
@@ -1,4 +1,5 @@
1
1
  import type { TabsOrientation } from '@c15t/ui/primitives/tabs';
2
+ import '@c15t/ui/styles/dialog';
2
3
  import type { HTMLAttributes, ReactNode } from 'react';
3
4
  export interface TabsVariantsProps {
4
5
  orientation?: TabsOrientation;
@@ -0,0 +1 @@
1
+ export * from './components/consent-gate/index.js';
@@ -0,0 +1,38 @@
1
+ import type { Theme } from './types/theme/index.js';
2
+ /** Props for {@link ConsentTheme}. */
3
+ export interface ConsentThemeProps {
4
+ /**
5
+ * Theme tokens: colors, dark colors, typography, spacing, radius,
6
+ * shadows and motion. Defaults to the built-in theme, which the package
7
+ * stylesheet already contains, so omit it only to pick a `colorScheme`
8
+ * before hydration.
9
+ */
10
+ theme?: Theme;
11
+ /**
12
+ * Color scheme to apply before hydration. `'dark'` makes the dark
13
+ * tokens the default, and `'system'` follows `prefers-color-scheme`.
14
+ * Omit it to follow the `dark` / `c15t-dark` class on `<html>`. Pass the
15
+ * same value as the provider's `colorScheme` option.
16
+ */
17
+ colorScheme?: 'light' | 'dark' | 'system' | null;
18
+ /** Content Security Policy nonce for the `<style>` element. */
19
+ nonce?: string;
20
+ }
21
+ /**
22
+ * Renders the `--c15t-*` CSS variables for a theme as a `<style>` element.
23
+ *
24
+ * Render it once, next to the consent provider, where your framework renders
25
+ * on the server. The provider does not generate theme CSS itself.
26
+ *
27
+ * @param props - The theme, color scheme and CSP nonce.
28
+ * @returns A `<style id="c15t-theme">` element.
29
+ * @example
30
+ * ```tsx
31
+ * // app/layout.tsx (Server Component)
32
+ * import { ConsentTheme } from '@c15t/nextjs';
33
+ * import { theme } from './consent-theme';
34
+ *
35
+ * <ConsentTheme theme={theme} colorScheme="system" />
36
+ * ```
37
+ */
38
+ export declare const ConsentTheme: ({ theme, colorScheme, nonce, }: ConsentThemeProps) => import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
- export * from '../context';
2
- export * from './consent-tracking-context';
3
- export * from './theme-context';
1
+ export * from '../context.js';
2
+ export * from './consent-tracking-context.js';
3
+ export * from './theme-context.js';
@@ -1,4 +1,4 @@
1
- import type { Theme } from '../types/theme';
1
+ import type { Theme } from '../types/theme/index.js';
2
2
  /**
3
3
  * Configuration value type for the ThemeContext.
4
4
  *
@@ -1,19 +1,54 @@
1
- import type { AllConsentNames, ConsentState, SaveResult, SaveInput } from '@c15t/core';
1
+ import type { AllConsentNames, ConsentKernel, ConsentState, SaveResult, SaveInput } from '@c15t/core';
2
2
  import type { ReactNode } from 'react';
3
3
  /** A local, unmasked selection, committed only by an explicit save. */
4
4
  export interface ConsentDraftHandle {
5
5
  values: Readonly<ConsentState>;
6
6
  displayedCategories: readonly AllConsentNames[];
7
+ /**
8
+ * Granted flag per declared vendor. Seeded from the denials the gate
9
+ * honors, so a vendor declared `disabled` reads `true` whatever an older
10
+ * record says; every vendor not denied is `true`. Empty under an `iab`
11
+ * policy.
12
+ */
13
+ vendors: Readonly<Record<string, boolean>>;
7
14
  isDirty: boolean;
8
- /** A material policy change requires reset and review before saving. */
15
+ /** A policy or displayed-category change requires reset and review before saving. */
9
16
  isStale: boolean;
10
17
  set: (category: AllConsentNames, value: boolean) => void;
11
18
  update: (patch: Partial<ConsentState>) => void;
19
+ /**
20
+ * Stage one vendor's grant. Recorded by the next save. Ignored for a
21
+ * vendor that is not declared or is declared `disabled`, since the kernel
22
+ * would drop the grant on save.
23
+ */
24
+ setVendor: (vendorId: string, granted: boolean) => void;
12
25
  acceptAll: () => void;
13
26
  rejectAll: () => void;
14
27
  save: () => Promise<SaveResult>;
15
28
  reset: () => void;
16
29
  }
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>;
17
52
  export interface ConsentDraftProviderProps {
18
53
  children: ReactNode;
19
54
  /** Defaults apply only to categories without an explicit receipt. */
@@ -22,10 +57,64 @@ export interface ConsentDraftProviderProps {
22
57
  export declare const ConsentDraftProvider: ({ children, initial, }: ConsentDraftProviderProps) => import("react").JSX.Element;
23
58
  /** Internal UI save path shared by stock controls and headless actions. */
24
59
  export declare const useConsentSaveAction: () => (input?: SaveInput) => Promise<SaveResult>;
25
- /** Keep the compatibility manager selection and its save on the same draft. */
26
- export declare const useConsentManagerDraft: () => {
27
- draft: ConsentDraftHandle;
28
- save: (input?: SaveInput) => Promise<SaveResult>;
29
- };
60
+ /**
61
+ * The nearest consent draft store, for the stock preference rows. Pair with
62
+ * {@link useConsentDraftSlice} so a row re-renders only when its own slice
63
+ * changes, not on every staged edit elsewhere in the draft.
64
+ *
65
+ * @returns The shared draft store, or a local one outside a provider.
66
+ * @internal
67
+ */
68
+ export declare const useConsentDraftStore: () => DraftStore;
69
+ /**
70
+ * Subscribes to one slice of a consent draft store.
71
+ *
72
+ * @param store - Store from {@link useConsentDraftStore}.
73
+ * @param selector - Picks the slice. Return a primitive or a reference the
74
+ * draft already holds.
75
+ * @returns The selected slice.
76
+ * @internal
77
+ */
78
+ export declare const useConsentDraftSlice: <SliceType>(store: DraftStore, selector: (draft: DraftSnapshot) => SliceType) => SliceType;
30
79
  /** Read and edit displayed choices without replacing masked effective permissions. */
31
80
  export declare const useConsentDraft: () => ConsentDraftHandle;
81
+ /** The vendor slice of the consent draft, for a custom vendor control. */
82
+ export interface VendorDraftHandle {
83
+ /** Granted flag per declared vendor. See {@link ConsentDraftHandle.vendors}. */
84
+ vendors: Readonly<Record<string, boolean>>;
85
+ /** Stage one vendor's grant for the next save. See {@link ConsentDraftHandle.setVendor}. */
86
+ setVendor: (vendorId: string, granted: boolean) => void;
87
+ /** Whether any draft value, category or vendor, differs from the record. */
88
+ isDirty: boolean;
89
+ /**
90
+ * Whether the policy or the vendor surface changed under an unsaved edit.
91
+ * `save` refuses a stale draft. See {@link ConsentDraftHandle.isStale}.
92
+ */
93
+ isStale: boolean;
94
+ /** Confirm the draft, categories and vendors together. */
95
+ save: () => Promise<SaveResult>;
96
+ /** Discard staged edits and reseed from the record. See {@link ConsentDraftHandle.reset}. */
97
+ reset: () => void;
98
+ }
99
+ /**
100
+ * Read and stage vendor grants on the same draft the category switches use.
101
+ * A custom vendor toggle needs only this; the categories stay where the
102
+ * stock widget or `useConsentDraft()` left them, and one save confirms both.
103
+ * When the policy or the vendor list changes under a staged edit the draft
104
+ * turns stale and `save` refuses it; `reset` reseeds it from the record.
105
+ *
106
+ * @returns The draft's vendor map, the setter, the dirty and stale flags,
107
+ * the save and the reset.
108
+ * @example
109
+ * ```tsx
110
+ * const { vendors, setVendor, isStale, reset, save } = useVendorDraft();
111
+ * <Switch
112
+ * checked={vendors['meta-pixel'] ?? true}
113
+ * onCheckedChange={(on) => setVendor('meta-pixel', on)}
114
+ * />;
115
+ * {isStale && <button onClick={reset}>Review again</button>}
116
+ * ```
117
+ * @public
118
+ */
119
+ export declare const useVendorDraft: () => VendorDraftHandle;
120
+ export {};
@@ -5,10 +5,9 @@
5
5
  * Pair with `ConsentProvider` from `@c15t/react` (or `@c15t/react/provider`).
6
6
  */
7
7
  export { defaultTranslationConfig, detectBrowserLanguage, mergeTranslationConfigs, prepareTranslationConfig, } from '@c15t/core';
8
- export { type ConsentDialogTriggerVisibility, type UseConsentDialogTriggerOptions, type UseConsentDialogTriggerResult, useConsentDialogTrigger, } from './component-hooks/use-panel-trigger';
9
- export { useConsentManager } from './component-hooks/use-manager';
10
- export { type HeadlessConsentBannerAction, type HeadlessConsentBannerState, type HeadlessConsentDialogAction, type HeadlessConsentDialogState, type HeadlessConsentSurface, type HeadlessConsentSurfaceAction, type HeadlessConsentSurfaceState, type HeadlessConsentWriteAction, useHeadlessConsentUI, } from './component-hooks/use-headless-consent-ui';
11
- export { useTranslations } from './component-hooks/use-translations';
12
- export { useColorScheme } from './hooks/use-color-scheme';
13
- export { useFocusTrap } from './hooks/use-focus-trap';
14
- export type { ReactUIOptions } from './types/manager';
8
+ export { type ConsentDialogTriggerVisibility, type UseConsentDialogTriggerOptions, type UseConsentDialogTriggerResult, useConsentDialogTrigger, } from './component-hooks/use-panel-trigger.js';
9
+ export { type HeadlessConsentBannerAction, type HeadlessConsentBannerState, type HeadlessConsentDialogAction, type HeadlessConsentDialogState, type HeadlessConsentSurface, type HeadlessConsentSurfaceAction, type HeadlessConsentSurfaceState, type HeadlessConsentWriteAction, useHeadlessConsentUI, } from './component-hooks/use-headless-consent-ui.js';
10
+ export { useTranslations } from './component-hooks/use-translations.js';
11
+ export { useColorScheme } from './hooks/use-color-scheme.js';
12
+ export { useFocusTrap } from './hooks/use-focus-trap.js';
13
+ export type { ReactUIOptions } from './types/manager.js';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A ref that holds `value` from the render React most recently committed.
3
+ *
4
+ * Consent guards use it to answer "is this still the kernel, draft or IAB
5
+ * selection this component renders?" when a kept callback runs, including
6
+ * from a descendant's layout effect in the very commit that switched
7
+ * runtimes.
8
+ *
9
+ * Why an insertion effect: React runs insertion effects while it applies a
10
+ * commit, before any layout effect of that commit, and never for a render it
11
+ * discards. Assigning the ref during render would publish values from
12
+ * renders React throws away (an interrupted concurrent render, StrictMode's
13
+ * second render). A layout effect is too late, because descendants' layout
14
+ * effects run before their ancestors'. A passive effect is later still.
15
+ * Assigning the committed value is idempotent, so StrictMode's replayed
16
+ * effects cannot leave a stale value behind.
17
+ *
18
+ * @param value - The value this render uses.
19
+ * @returns A ref whose `current` is the last committed `value`.
20
+ * @internal
21
+ */
22
+ export declare const useCommittedRef: <Value>(value: Value) => {
23
+ readonly current: Value;
24
+ };
@@ -1,5 +1,5 @@
1
1
  import type { HeadlessIABBannerAction, HeadlessIABDialogAction, HeadlessIABPreferenceTab } from '@c15t/iab/headless';
2
- import { useIABConsentManager } from './use-iab-manager';
2
+ import { useIABConsentManager } from './use-iab-manager.js';
3
3
  export type { HeadlessIABBannerAction, HeadlessIABDialogAction, HeadlessIABPreferenceTab, };
4
4
  export interface HeadlessIABBannerState {
5
5
  isVisible: boolean;
@@ -1,7 +1,7 @@
1
1
  import type { ActiveUI, ConsentPresentation, TranslationConfig } from '@c15t/core';
2
2
  export declare const useIABConsentManager: (overrides?: ConsentPresentation) => {
3
3
  activeUI: ActiveUI;
4
- iab: import("../iab-context").ReactIABState | null;
4
+ iab: import("../iab-context.js").ReactIABState | null;
5
5
  model: import("@c15t/core").KernelModel | null;
6
6
  policyBanner: {
7
7
  allowedActions: import("@c15t/core").PresentationAction[];
@@ -1,2 +1,2 @@
1
- import type { ThemeContextValue } from '../context/theme-context';
1
+ import type { ThemeContextValue } from '../context/theme-context.js';
2
2
  export declare const useTheme: () => ThemeContextValue;
@@ -17,7 +17,7 @@
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 } from '@c15t/core';
20
+ import type { AllConsentNames, ConsentKernel, PromptPresentation, PreferencesPresentation, ConsentSnapshot, ConsentState, KernelActiveUI, KernelBranding, KernelIABState, KernelModel, KernelOverrides, KernelTranslations, KernelUser, LocationResponse, PolicyScopeMode, ResolvedVendor, VendorChoice } from '@c15t/core';
21
21
  /**
22
22
  * Full snapshot accessor. Escape hatch for consumers that genuinely need
23
23
  * multiple slices. Prefer narrow hooks for re-render isolation.
@@ -65,6 +65,8 @@ export declare const useHasConsentPolicy: () => boolean;
65
65
  * {@link useHasConsentPolicy}.
66
66
  */
67
67
  export declare const useHasConsentUI: () => boolean;
68
+ /** Whether c15t or an external CMP offers a preferences control. */
69
+ export declare const useHasConsentPreferences: () => boolean;
68
70
  /**
69
71
  * Derived consent model (opt-in / opt-out / iab), or `null` while no policy
70
72
  * rule is resolved. The kernel keeps a safe fallback rule internally; this
@@ -91,6 +93,33 @@ export declare const usePurposeConsent: (purposeId: number) => boolean;
91
93
  export declare const useSpecialFeatureOptIn: (featureId: number) => boolean;
92
94
  /** Latest TCF string. `null` until the IAB module encodes one. */
93
95
  export declare const useTCString: () => string | null;
96
+ /**
97
+ * Vendors declared for vendor-level consent outside IAB, merged from the
98
+ * provider's `vendors` option, the backend and script slugs. Empty under an
99
+ * `iab` policy, where the TC string decides and vendor rows are not shown.
100
+ */
101
+ export declare const useDeclaredVendors: () => readonly ResolvedVendor[];
102
+ /**
103
+ * The visitor's recorded vendor decision.
104
+ *
105
+ * @returns The decision, whose `denied` list may be empty after a bulk
106
+ * action lifted every denial, or `null` when no vendor decision was ever
107
+ * recorded.
108
+ */
109
+ export declare const useVendorChoice: () => Readonly<VendorChoice> | null;
110
+ /**
111
+ * Whether one vendor is allowed: its category condition passes and the
112
+ * visitor has not turned it off.
113
+ *
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.
119
+ */
120
+ export declare const useVendorAllowed: (vendorId: string) => boolean;
121
+ /** Register categories used by scripts, frames, or other integrations. */
122
+ export declare const useRegisterConsentCategories: () => (categories: readonly AllConsentNames[]) => void;
94
123
  /**
95
124
  * Sync mutation: apply overrides (country, region, language, GPC).
96
125
  */
@@ -23,8 +23,8 @@
23
23
  *
24
24
  * @packageDocumentation
25
25
  */
26
- export { IABConsentBanner, type IABConsentBannerProps, } from './components/iab-prompt';
27
- export { IABConsentDialog, type IABConsentDialogProps, } from './components/iab-panel';
28
- export { type HeadlessIABBannerAction, type HeadlessIABBannerState, type HeadlessIABDialogAction, type HeadlessIABDialogState, type HeadlessIABPreferenceTab, type UseHeadlessIABConsentUIResult, useHeadlessIABConsentUI, } from './hooks/use-headless-iab-consent-ui';
29
- export { IABProvider } from './iab-context';
30
- export type { IABProviderProps } from './iab-context';
26
+ export { IABConsentBanner, type IABConsentBannerProps, } from './components/iab-prompt/index.js';
27
+ export { IABConsentDialog, type IABConsentDialogProps, } from './components/iab-panel/index.js';
28
+ export { type HeadlessIABBannerAction, type HeadlessIABBannerState, type HeadlessIABDialogAction, type HeadlessIABDialogState, type HeadlessIABPreferenceTab, type UseHeadlessIABConsentUIResult, useHeadlessIABConsentUI, } from './hooks/use-headless-iab-consent-ui.js';
29
+ export { IABProvider } from './iab-context.js';
30
+ export type { IABProviderProps } from './iab-context.js';
@@ -33,29 +33,30 @@
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
35
  export { createConsentKernel, custom, hosted } from '@c15t/core';
36
- export type { OfflineModeOptions } from './transports/offline';
37
- export { offline } from './transports/offline';
38
- export { ConsentDialog, ConsentWidget } from './aggregate-components';
39
- export type { ConsentBannerButton, ConsentBannerLayout, ConsentBannerProps, ConsentBannerRight, ConsentBannerRightLinkProps, ConsentBannerRightsProps, ConsentBannerSurface, } from './components/prompt';
40
- export { ConsentBanner, type ConsentBannerCompoundComponent, useConsentBannerSurface, } from './components/prompt';
41
- export type { ConsentDialogCompoundComponent, ConsentDialogProps, } from './components/panel';
42
- export type { ConsentDialogLinkProps } from './components/panel-link';
43
- export { ConsentDialogLink } from './components/panel-link';
44
- export type { ConsentDialogTriggerProps, ConsentDialogTriggerToolbarAction, ConsentDialogTriggerToolbarPreferences, ConsentDialogTriggerToolbarProps, TriggerOrientation, } from './components/panel-trigger';
45
- export { ConsentDialogTrigger, ConsentDialogTriggerToolbar, } from './components/panel-trigger';
46
- export type { ConsentWidgetCompoundComponent, ConsentWidgetProps, } from './components/preferences';
47
- export type { FrameProps } from './components/frame';
48
- export { Frame } from './components/frame';
49
- export type { ConsentDraftHandle, ConsentDraftProviderProps } from './draft';
50
- export { ConsentDraftProvider, useConsentDraft } from './draft';
51
- export { useConsentManager } from './component-hooks/use-manager';
52
- export { useTranslations } from './component-hooks/use-translations';
53
- export { useActiveUI, useBranding, useConsent, useConsents, useHasConsentPolicy, useHasConsentUI, useIABEnabled, useIABSnapshot, useIdentify, useInit, useLocation, useModel, useOverrides, usePromptPresentation, usePolicyCategories, usePreferencesPresentation, usePolicyScopeMode, usePurposeConsent, useSaveConsents, useSetActiveUI, useSetLanguage, useSetOverrides, useSnapshot, useSpecialFeatureOptIn, useTCString, useUser, useVendorConsent, } from './hooks';
54
- export type { UseIframeBlockerOptions, UseNetworkBlockerOptions, UsePersistenceOptions, UseScriptLoaderOptions, } from './module-hooks';
55
- export { useIframeBlocker, useNetworkBlocker, usePersistence, useScriptLoader, } from './module-hooks';
56
- export type { ConsentProviderOptions, ConsentProviderCallbacks, ConsentProviderPrefetch, ConsentProviderProps, ExternalRuntimeProviderOptions, ExternalRuntimeProviderProps, OwnedRuntimeProviderProps, } from './provider';
57
- export { ConsentProvider } from './provider';
58
- export type { ReactUIOptions } from './types/manager';
59
- export { defineTheme, type Theme } from './types/theme';
60
- export { useExplicitChoice, useEffectivePermissions, usePromptRequirement, useNoticeDismissal, usePrivacySignals, useOptOutDirectives, usePolicyResolution, usePolicyRule, useRestrictions, useDismissNotice, } from './hooks';
36
+ export type { OfflineModeOptions } from './transports/offline.js';
37
+ export { offline } from './transports/offline.js';
38
+ export { ConsentDialog, ConsentWidget } from './aggregate-components.js';
39
+ 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
+ export type { ConsentDialogCompoundComponent, ConsentDialogProps, } from './components/panel/index.js';
42
+ export type { ConsentDialogLinkProps } from './components/panel-link/index.js';
43
+ export { ConsentDialogLink } from './components/panel-link/index.js';
44
+ export type { ConsentDialogTriggerProps, ConsentDialogTriggerToolbarAction, ConsentDialogTriggerToolbarPreferences, ConsentDialogTriggerToolbarProps, TriggerOrientation, } from './components/panel-trigger/index.js';
45
+ export { ConsentDialogTrigger, ConsentDialogTriggerToolbar, } from './components/panel-trigger/index.js';
46
+ export type { ConsentWidgetCompoundComponent, ConsentWidgetProps, } from './components/preferences/index.js';
47
+ export type { ConsentGateProps, FrameProps } from './components/consent-gate/index.js';
48
+ export { ConsentGate, Frame } from './components/consent-gate/index.js';
49
+ 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
+ export type { UseIframeBlockerOptions, UseNetworkBlockerOptions, UsePersistenceOptions, UseScriptLoaderOptions, } from './module-hooks.js';
54
+ export { useIframeBlocker, useNetworkBlocker, usePersistence, useScriptLoader, } from './module-hooks.js';
55
+ 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
+ export type { ConsentThemeProps } from './consent-theme.js';
59
+ 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';
61
62
  export type { ConsentPresentation, PromptPresentation, PreferencesPresentation, PresentationAction, PromptPosition, PromptVariant, ResolvedConsentPresentation, } from '@c15t/core';
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Kernel access for the hooks and the stock components. The component
3
+ * selectors below each read a single derived value, so a component
4
+ * re-renders only when that value changes. Not exported from any package
5
+ * entry.
6
+ *
7
+ * @packageDocumentation
8
+ * @internal
9
+ */
10
+ import type { AllConsentNames, ConsentKernel, ConsentSnapshot } from '@c15t/core';
11
+ /**
12
+ * Reads the kernel from the nearest provider.
13
+ *
14
+ * @returns The provider's kernel.
15
+ * @throws {Error} When called outside a `ConsentProvider`.
16
+ * @internal
17
+ */
18
+ export declare const useKernel: () => ConsentKernel;
19
+ /**
20
+ * Subscribes to one slice of the kernel snapshot. React re-renders the
21
+ * caller only when the selected value `Object.is`-differs, so a selector
22
+ * must return a primitive or a reference the snapshot already holds.
23
+ *
24
+ * @param selector - Picks the slice from a snapshot.
25
+ * @returns The selected slice.
26
+ * @internal
27
+ */
28
+ export declare const useKernelSelector: <SliceType>(selector: (snap: ConsentSnapshot) => SliceType) => SliceType;
29
+ /**
30
+ * Like `useKernelSelector`, for selectors that evaluate a gate at a point in
31
+ * time. The server render and hydration evaluate at the snapshot's own
32
+ * `evaluatedAt`, so they never read the clock: a Next.js `cacheComponents`
33
+ * prerender rejects `Date.now()` in a Client Component. In the browser the
34
+ * gate is evaluated at `Date.now()`, so an expiry the kernel's deadline
35
+ * timer has not processed yet still denies.
36
+ *
37
+ * @param selector - Picks the slice from a snapshot at the given time.
38
+ * @returns The selected slice.
39
+ * @internal
40
+ */
41
+ export declare const useGateSelector: <SliceType>(selector: (snap: ConsentSnapshot, now: number) => SliceType) => SliceType;
42
+ /**
43
+ * Whether content gated on one category may render, with the kernel's gate
44
+ * semantics. Server rendering and hydration read no clock; see
45
+ * `useGateSelector`.
46
+ *
47
+ * @param category - Category the content needs.
48
+ * @returns `true` while the category is permitted.
49
+ * @internal
50
+ */
51
+ export declare const useCategoryAllowed: (category: AllConsentNames) => boolean;
52
+ /**
53
+ * Language of the active translation bundle.
54
+ *
55
+ * @returns The bundle's language, or the default language before one loads.
56
+ * @internal
57
+ */
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,6 +1,33 @@
1
+ import type { ConsentKernel } from '@c15t/core';
1
2
  import type { IframeBlockerHandle } from '@c15t/core/modules/iframe-blocker';
2
3
  export interface UseIframeBlockerOptions {
3
4
  disableAutomaticBlocking?: boolean;
4
5
  }
5
6
  export declare const useIframeBlocker: (options?: UseIframeBlockerOptions) => IframeBlockerHandle;
7
+ /**
8
+ * Call `onFound` when a gated iframe is on the page: at once when one is
9
+ * there already, and again for each batch of gated frames that arrives.
10
+ *
11
+ * Until the returned stop function runs, a gated frame that arrives with a
12
+ * `src` the snapshot does not clearly allow is paused (`src` moved to
13
+ * `data-src`), as the loaded blocker would pause it. Frames on the page at
14
+ * the first call are left to the blocker, which is what happens when it
15
+ * loads with the provider.
16
+ *
17
+ * @param kernel - The kernel whose snapshot decides what is clearly allowed.
18
+ * @param onFound - Called for every sighting; the caller dedupes.
19
+ * @returns Stops watching.
20
+ * @internal
21
+ */
22
+ export declare const watchGatedIframes: (kernel: ConsentKernel, onFound: () => void) => () => void;
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.
27
+ *
28
+ * @param options - Blocker options. With `disableAutomaticBlocking` the
29
+ * module loads at once, as it did before.
30
+ * @internal
31
+ */
32
+ export declare const useIframeBlockerOnDemand: (options?: UseIframeBlockerOptions) => void;
6
33
  export type { IframeBlockerHandle };
@@ -5,5 +5,28 @@ export interface UseNetworkBlockerOptions {
5
5
  logBlockedRequests?: boolean;
6
6
  onRequestBlocked?: (info: BlockedRequestInfo) => void;
7
7
  }
8
+ /**
9
+ * Block `fetch` and XHR requests that match `rules` until the visitor's
10
+ * consent allows them.
11
+ *
12
+ * Blocking starts during the first render in the browser: matching requests
13
+ * wait from then on, including ones sent from this component's children's
14
+ * mount effects and from effects that run before this component's. The
15
+ * blocker loads after mount and decides each waiting request. On the
16
+ * server the hook does nothing.
17
+ *
18
+ * Rendering has a side effect: the first render patches `fetch` and
19
+ * `XMLHttpRequest` to hold matching requests. If React discards that
20
+ * render and never commits it, the hold ends after 10 seconds. Nothing
21
+ * checked consent for the requests it held, so they fail as blocked: a 451
22
+ * response for `fetch`, a failed XHR.
23
+ *
24
+ * Prefer the provider's `networkBlocker` option. It starts blocking when
25
+ * the provider renders, so it also covers components rendered before this
26
+ * one.
27
+ *
28
+ * @param options - Rules and logging options.
29
+ * @returns A handle to update rules or toggle blocking.
30
+ */
8
31
  export declare const useNetworkBlocker: (options: UseNetworkBlockerOptions) => NetworkBlockerHandle;
9
32
  export type { BlockedRequestInfo, NetworkBlockerHandle, NetworkBlockerRule };