@c15t/react 3.0.0-alpha.2 → 3.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +91 -67
- package/README.md +21 -17
- package/SKILL.md +34 -0
- package/dist/aggregate-components.js +1 -1
- package/dist/chunk-warming.js +1 -1
- package/dist/component-hooks/use-headless-consent-ui.js +1 -1
- package/dist/component-hooks/use-headless-iab-consent-ui.js +1 -1
- package/dist/component-hooks/use-panel-trigger.js +1 -1
- package/dist/components/consent-gate/atoms.js +1 -1
- package/dist/components/consent-gate/consent-gate.js +1 -1
- package/dist/components/consent-preferences-link/consent-preferences-link.js +1 -1
- package/dist/components/iab-panel/atoms/card.js +1 -1
- package/dist/components/iab-panel/atoms/feature-item.js +2 -0
- package/dist/components/iab-panel/atoms/header.js +1 -1
- package/dist/components/iab-panel/atoms/purpose-item.js +1 -1
- package/dist/components/iab-panel/atoms/stack-item.js +1 -1
- package/dist/components/iab-panel/iab-panel.js +1 -1
- package/dist/components/iab-panel/index.js +1 -1
- package/dist/components/iab-prompt/atoms/overlay.js +1 -1
- package/dist/components/iab-prompt/atoms/root.js +1 -1
- package/dist/components/panel/atoms/card.js +1 -1
- package/dist/components/panel/atoms/overlay.js +1 -1
- package/dist/components/panel/atoms/root.js +1 -1
- package/dist/components/panel/index.js +1 -1
- package/dist/components/panel/panel.js +1 -1
- package/dist/components/panel-trigger/atoms/button.js +1 -1
- package/dist/components/panel-trigger/atoms/icon.js +1 -1
- package/dist/components/panel-trigger/atoms/root.js +1 -1
- package/dist/components/panel-trigger/atoms/toolbar.js +1 -1
- package/dist/components/panel-trigger/atoms/trigger-icons.js +1 -0
- package/dist/components/panel-trigger/panel-trigger-toolbar.js +1 -1
- package/dist/components/preferences/atoms/accordion.js +1 -1
- package/dist/components/preferences/atoms/root.js +1 -1
- package/dist/components/preferences/atoms/vendor-list.js +1 -1
- package/dist/components/preferences/index.js +1 -1
- package/dist/components/prompt/atoms/overlay.js +1 -1
- package/dist/components/prompt/atoms/root.js +1 -1
- package/dist/components/prompt/components.js +1 -1
- package/dist/components/prompt/policy-actions.js +1 -1
- package/dist/components/shared/libs/compose-refs.js +1 -0
- package/dist/components/shared/libs/slot.js +1 -1
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/ui/accordion/accordion.js +1 -1
- package/dist/components/shared/ui/collapsible/collapsible.js +1 -1
- package/dist/components/shared/ui/dialog/dialog.js +1 -1
- package/dist/components/shared/ui/icon.js +1 -1
- package/dist/components/shared/ui/logo.js +1 -1
- package/dist/components/shared/ui/preference-item/preference-item.js +1 -1
- package/dist/components/shared/ui/switch/switch.js +1 -1
- package/dist/components/shared/ui/tabs/tabs.js +1 -1
- package/dist/consent-theme.js +1 -0
- package/dist/context/consent-tracking-context.js +1 -1
- package/dist/devtools.js +1 -1
- package/dist/draft.js +1 -1
- package/dist/external-iab-context.js +1 -1
- package/dist/headless.js +1 -1
- package/dist/hooks/use-committed-ref.js +2 -0
- package/dist/hooks/use-focus-trap.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/iab/styles.tw3.css +5 -45
- package/dist/iab-context.js +1 -1
- package/dist/index.js +1 -1
- package/dist/kernel-selector.js +1 -0
- package/dist/module-hooks/iframe-blocker.js +1 -1
- package/dist/module-hooks/network-blocker.js +1 -1
- package/dist/module-hooks/network-hold.js +2 -0
- package/dist/module-hooks/persistence.js +1 -1
- package/dist/panel.js +1 -1
- package/dist/postcss-tailwind3.js +1 -0
- package/dist/preferences.js +1 -2
- package/dist/provider.js +1 -1
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/server/headers.js +1 -1
- package/dist/server/normalize-url.js +1 -1
- package/dist/styles.tw3.css +16 -61
- package/dist/transports/offline.js +1 -1
- package/dist/ui-save.js +1 -1
- package/dist/utils/deferred-module.js +1 -1
- package/dist/utils/merge-slot-props.js +1 -1
- package/dist/utils/theme-utils.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/chunk-warming.d.ts +41 -8
- package/dist-types/component-hooks/use-headless-consent-ui.d.ts +1 -1
- package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +1 -1
- package/dist-types/components/iab-panel/atoms/feature-item.d.ts +28 -0
- package/dist-types/components/iab-panel/atoms/purpose-item.d.ts +4 -1
- package/dist-types/components/iab-panel/atoms/stack-item.d.ts +6 -1
- package/dist-types/components/iab-panel/iab-panel.d.ts +2 -2
- package/dist-types/components/iab-panel/index.d.ts +6 -2
- package/dist-types/components/iab-panel/use-iab-translations.d.ts +4 -0
- package/dist-types/components/iab-prompt/iab-prompt.d.ts +2 -2
- package/dist-types/components/iab-prompt/index.d.ts +2 -2
- package/dist-types/components/panel/atoms/card.d.ts +1 -0
- package/dist-types/components/panel/index.d.ts +1 -0
- package/dist-types/components/panel/panel.d.ts +1 -1
- package/dist-types/components/panel-trigger/atoms/trigger-icons.d.ts +20 -0
- package/dist-types/components/preferences/index.d.ts +1 -0
- package/dist-types/components/prompt/components.d.ts +6 -0
- package/dist-types/components/shared/libs/compose-refs.d.ts +20 -0
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +1 -0
- package/dist-types/components/shared/ui/collapsible/collapsible.d.ts +1 -0
- package/dist-types/components/shared/ui/icon.d.ts +2 -1
- package/dist-types/components/shared/ui/logo.d.ts +0 -10
- package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +14 -0
- package/dist-types/components/shared/ui/switch/switch.d.ts +1 -0
- package/dist-types/components/shared/ui/tabs/tabs.d.ts +1 -0
- package/dist-types/consent-theme.d.ts +38 -0
- package/dist-types/context/consent-tracking-context.d.ts +10 -0
- package/dist-types/context/theme-context.d.ts +2 -2
- package/dist-types/context.d.ts +6 -0
- package/dist-types/devtools.d.ts +13 -2
- package/dist-types/draft.d.ts +50 -7
- package/dist-types/headless.d.ts +0 -1
- package/dist-types/hooks/use-committed-ref.d.ts +24 -0
- package/dist-types/hooks/use-focus-trap.d.ts +3 -1
- package/dist-types/hooks.d.ts +56 -13
- package/dist-types/iab.d.ts +1 -1
- package/dist-types/index.d.ts +4 -3
- package/dist-types/kernel-selector.d.ts +66 -0
- package/dist-types/module-hooks/iframe-blocker.d.ts +27 -0
- package/dist-types/module-hooks/network-blocker.d.ts +23 -0
- package/dist-types/module-hooks/network-hold.d.ts +47 -0
- package/dist-types/panel.d.ts +13 -1
- package/dist-types/postcss-tailwind3.d.ts +21 -0
- package/dist-types/preferences.d.ts +12 -1
- package/dist-types/provider.d.ts +62 -12
- package/dist-types/server/headers.d.ts +14 -4
- package/dist-types/server/normalize-url.d.ts +14 -7
- package/dist-types/server/types.d.ts +12 -1
- package/dist-types/transports/offline.d.ts +7 -16
- package/dist-types/ui-config-context.d.ts +9 -1
- package/dist-types/ui-save.d.ts +21 -1
- package/dist-types/utils/deferred-module.d.ts +3 -1
- package/dist-types/utils/merge-slot-props.d.ts +15 -1
- package/dist-types/utils/theme-utils.d.ts +17 -2
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +91 -67
- package/docs/assets/v3/bottom-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/brand-preferences.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/headless-bar-html.png +0 -0
- package/docs/assets/v3/headless-bar-mobile.png +0 -0
- package/docs/assets/v3/headless-bar.png +0 -0
- package/docs/assets/v3/slim-bar.png +0 -0
- package/docs/concepts/choose-your-setup.md +87 -0
- package/docs/{frameworks/react/concepts → concepts}/consent-categories.md +30 -8
- package/docs/concepts/consent-state.md +357 -0
- package/docs/{guides → concepts}/data-fetching.md +31 -27
- package/docs/concepts/how-consent-works.md +123 -0
- package/docs/{frameworks/react/concepts/policy-presets.md → concepts/policies.md} +7 -59
- package/docs/customization/class-names.md +202 -0
- package/docs/customization/dark-mode.md +157 -0
- package/docs/customization/motion.md +119 -0
- package/docs/customization/overview.md +67 -33
- package/docs/customization/recipes.md +839 -47
- package/docs/customization/slots.md +216 -35
- package/docs/customization/stylesheets.md +147 -0
- package/docs/customization/tailwind.md +842 -0
- package/docs/customization/tokens.md +166 -36
- package/docs/customization/translations.md +61 -3
- package/docs/frameworks/react/callbacks.md +118 -0
- package/docs/frameworks/react/clear-on-revocation.md +106 -0
- package/docs/frameworks/react/components/consent-banner.md +42 -28
- package/docs/frameworks/react/components/consent-dialog-link.md +13 -11
- package/docs/frameworks/react/components/consent-dialog-trigger.md +81 -76
- package/docs/frameworks/react/components/consent-dialog.md +100 -55
- package/docs/frameworks/react/components/consent-gate.md +45 -24
- package/docs/frameworks/react/components/consent-provider.md +126 -0
- package/docs/frameworks/react/components/consent-widget.md +32 -20
- package/docs/frameworks/react/components/dev-tools.md +52 -84
- package/docs/frameworks/react/components.md +105 -0
- package/docs/frameworks/react/compose.md +354 -0
- package/docs/frameworks/react/content-security-policy.md +126 -0
- package/docs/frameworks/react/customize.md +250 -0
- package/docs/frameworks/react/embeds.md +89 -0
- package/docs/frameworks/react/hooks.md +65 -0
- package/docs/frameworks/react/iab.md +222 -0
- package/docs/frameworks/react/network-blocker.md +140 -0
- package/docs/frameworks/react/quickstart.md +139 -101
- package/docs/frameworks/react/rendering.md +128 -0
- package/docs/frameworks/react/scripts.md +115 -0
- package/docs/frameworks/react/translations.md +155 -0
- package/docs/frameworks/react/troubleshooting.md +92 -47
- package/docs/frameworks/react/vendor-consent.md +170 -0
- package/docs/guides/banner-experiments.md +654 -0
- package/docs/guides/troubleshooting.md +120 -47
- package/docs/guides/verify-consent.md +81 -49
- package/docs/integrations/adobe-analytics.md +168 -160
- package/docs/integrations/ahrefs-analytics.md +153 -155
- package/docs/integrations/amplitude.md +163 -157
- package/docs/integrations/building-integrations.md +136 -37
- package/docs/integrations/clearbit.md +155 -155
- package/docs/integrations/cloudflare-web-analytics.md +157 -157
- package/docs/integrations/cloudflare-zaraz.md +210 -262
- package/docs/integrations/crisp.md +165 -159
- package/docs/integrations/databuddy.md +158 -174
- package/docs/integrations/fathom-analytics.md +159 -157
- package/docs/integrations/front-chat.md +322 -0
- package/docs/integrations/google-maps.md +119 -84
- package/docs/integrations/google-tag-manager.md +179 -164
- package/docs/integrations/google-tag.md +164 -161
- package/docs/integrations/heap.md +164 -156
- package/docs/integrations/hightouch.md +162 -158
- package/docs/integrations/hotjar.md +160 -156
- package/docs/integrations/intercom.md +184 -154
- package/docs/integrations/klaviyo.md +486 -0
- package/docs/integrations/linkedin-insights.md +175 -151
- package/docs/integrations/logrocket.md +161 -157
- package/docs/integrations/matomo-analytics.md +189 -179
- package/docs/integrations/meta-pixel.md +189 -151
- package/docs/integrations/microsoft-clarity.md +164 -156
- package/docs/integrations/microsoft-uet.md +149 -155
- package/docs/integrations/mixpanel-analytics.md +156 -161
- package/docs/integrations/one-dollar-stats.md +306 -0
- package/docs/integrations/openai-pixel.md +205 -302
- package/docs/integrations/overview.md +143 -83
- package/docs/integrations/pinterest-tag.md +329 -0
- package/docs/integrations/pirsch.md +170 -160
- package/docs/integrations/plausible-analytics.md +173 -159
- package/docs/integrations/posthog.md +227 -242
- package/docs/integrations/promptwatch.md +155 -155
- package/docs/integrations/reddit-pixel.md +186 -158
- package/docs/integrations/rudderstack.md +202 -187
- package/docs/integrations/rybbit-analytics.md +172 -161
- package/docs/integrations/segment.md +183 -155
- package/docs/integrations/snapchat-pixel.md +187 -157
- package/docs/integrations/tiktok-pixel.md +172 -151
- package/docs/integrations/umami-analytics.md +164 -159
- package/docs/integrations/vercel-analytics.md +167 -158
- package/docs/integrations/x-pixel.md +177 -151
- package/docs/integrations/youtube.md +122 -87
- package/docs/upgrade-v3.md +490 -354
- package/package.json +15 -9
- package/dist/component-hooks/use-manager.js +0 -2
- package/dist-types/component-hooks/use-manager.d.ts +0 -45
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/frameworks/react/components/consent-manager-provider.md +0 -75
- package/docs/frameworks/react/hooks/use-consent-manager/overview.md +0 -58
- package/docs/frameworks/react/iab/overview.md +0 -53
- package/docs/frameworks/react/script-loader.md +0 -63
- package/docs/frameworks/react/styling/overview.md +0 -217
- package/docs/guides/consent-state.md +0 -60
- package/docs/guides/deployment-modes.md +0 -75
- package/docs/integrations/clear-on-revocation.md +0 -167
- package/docs/integrations/granular-consent.md +0 -208
|
@@ -12,9 +12,20 @@ import type { Overrides, SSRInitialData } from '@c15t/core';
|
|
|
12
12
|
export interface FetchSSRDataOptionsBase {
|
|
13
13
|
/**
|
|
14
14
|
* The backend URL to fetch consent data from.
|
|
15
|
-
* Can be absolute (https://...) or relative (/api/consent).
|
|
15
|
+
* Can be absolute (https://...) or relative (/api/consent). A relative
|
|
16
|
+
* URL resolves against the request's `host` header.
|
|
16
17
|
*/
|
|
17
18
|
backendURL: string;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a relative `backendURL` against the request's `forwarded`,
|
|
21
|
+
* `x-forwarded-host` and `x-forwarded-proto` headers instead of `host`.
|
|
22
|
+
* Any client can send those headers, so set this only behind a proxy
|
|
23
|
+
* that sets them and drops incoming ones. Also forwards those three
|
|
24
|
+
* headers to the backend, which is skipped otherwise.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
trustForwardedHeaders?: boolean;
|
|
18
29
|
/**
|
|
19
30
|
* Optional overrides for geo-location.
|
|
20
31
|
*/
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import type { ProviderTransportFactory } from '@c15t/core';
|
|
2
|
-
import type { PolicyRule } from '@c15t/schema/types';
|
|
3
|
-
/** Policy rules evaluated locally when initialization runs. */
|
|
4
|
-
export interface OfflineModeOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Rules to resolve locally. Omit them to use `recommendedPolicyRules()`:
|
|
7
|
-
* strict opt-in for Europe, the UK, Quebec and unknown locations, opt-out
|
|
8
|
-
* for the US states with a privacy law, and `none` everywhere else.
|
|
9
|
-
* Passing rules replaces that pack entirely.
|
|
10
|
-
*/
|
|
11
|
-
policyRules?: PolicyRule[];
|
|
12
|
-
}
|
|
13
1
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
2
|
+
* Offline mode for the React provider: core's `offline()`, which resolves
|
|
3
|
+
* policy rules locally and switches copy when `overrides.language` or
|
|
4
|
+
* `useSetLanguage()` names a language the bundle or `i18n.messages` has.
|
|
5
|
+
* The language a server prefetch detected from `Accept-Language` keeps the
|
|
6
|
+
* startup copy.
|
|
17
7
|
*/
|
|
18
|
-
export
|
|
8
|
+
export { offline } from '@c15t/core';
|
|
9
|
+
export type { OfflineModeOptions } from '@c15t/core';
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConsentExperiment, ConsentPresentation, LegalLinks } from '@c15t/core';
|
|
2
|
+
import type { DialogPreload } from './chunk-warming.js';
|
|
2
3
|
import type { ReactComponentSlots } from './types/slots.js';
|
|
4
|
+
import type { Theme } from './types/theme/index.js';
|
|
3
5
|
export interface V3UIConfigValue {
|
|
4
6
|
components?: ReactComponentSlots;
|
|
7
|
+
/** The host's base presentation, before any experiment arm is applied. */
|
|
5
8
|
presentation?: ConsentPresentation;
|
|
9
|
+
/** The configured experiment; the assigned arm lives on the snapshot. */
|
|
10
|
+
experiment?: ConsentExperiment;
|
|
11
|
+
/** The host's base theme, before any experiment arm is applied. */
|
|
12
|
+
theme?: Theme;
|
|
6
13
|
legalLinks?: LegalLinks;
|
|
14
|
+
preloadDialog?: DialogPreload;
|
|
7
15
|
}
|
|
8
16
|
export declare const V3UIConfigContext: import("react").Context<V3UIConfigValue>;
|
|
9
17
|
export declare const useUIConfig: () => V3UIConfigValue;
|
package/dist-types/ui-save.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
import type { ConsentKernel, SaveResult } from '@c15t/core';
|
|
2
2
|
/** Explicit navigation supersedes a pending UI action, even to the same dialog. */
|
|
3
3
|
export declare const invalidateConsentUIAction: (kernel: ConsentKernel) => void;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Close the preferences dialog as soon as its choice is recorded locally.
|
|
6
|
+
*
|
|
7
|
+
* The kernel commits the receipt and updates permissions synchronously, so
|
|
8
|
+
* the dialog closes in the task that handled the click. Storage is written
|
|
9
|
+
* one task later, still ahead of the request, and the request runs after:
|
|
10
|
+
* its outcome never reopens the dialog, and a failed request stays queued
|
|
11
|
+
* for replay by the kernel. A save that recorded nothing (an unchanged
|
|
12
|
+
* selection) closes when it resolves successfully, unless explicit
|
|
13
|
+
* navigation or a newer action came first.
|
|
14
|
+
*/
|
|
5
15
|
export declare const saveConsentUI: (kernel: ConsentKernel, save: () => Promise<SaveResult>, canClose: () => boolean) => Promise<SaveResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Close an IAB surface in the task that handled the click.
|
|
18
|
+
*
|
|
19
|
+
* An IAB choice commits once its TC string is encoded, which can wait on the
|
|
20
|
+
* TCF library chunk but never on the backend. The surface closes first and
|
|
21
|
+
* comes back only when that local step recorded nothing (the vendor list
|
|
22
|
+
* failed to load, or the policy changed underneath), so the visitor can try
|
|
23
|
+
* again. A failed backend request never reopens it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const saveIABConsentUI: (kernel: ConsentKernel, save: () => Promise<void> | void) => Promise<void>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Share an on-demand module across exports and
|
|
3
|
+
* Share an on-demand module across exports and preloading. Ready client
|
|
4
4
|
* retries run synchronously; Suspense retains server rendering and hydration.
|
|
5
|
+
* A failed import is cached for rendered exports only, so a failed preload
|
|
6
|
+
* does not stop a later open from retrying.
|
|
5
7
|
*
|
|
6
8
|
* @internal
|
|
7
9
|
*/
|
|
@@ -10,5 +10,19 @@ export declare const getSlotProps: (components: ReactComponentSlots | undefined,
|
|
|
10
10
|
export type MergedSlotProps = Omit<ReactSlotProps, 'style'> & {
|
|
11
11
|
style?: CSSPropertiesWithVars;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A `components` part, plus the `noStyle` flag a `theme.slots` entry puts
|
|
15
|
+
* on it through `applyThemeSlots`.
|
|
16
|
+
*/
|
|
17
|
+
type SlotPropsInput = ReactSlotProps & {
|
|
18
|
+
noStyle?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Merge a `components` part with a component's own props.
|
|
22
|
+
*
|
|
23
|
+
* The stock `baseClassName` is dropped when the component's `noStyle` or
|
|
24
|
+
* the part's `noStyle` is set; the part's and the component's classes
|
|
25
|
+
* stay, as `resolveStyles` keeps theme slot classes under `noStyle`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const mergeSlotProps: (slotProps: SlotPropsInput | undefined, { baseClassName, className, noStyle, style, ...ownProps }: MergeSlotPropsInput) => MergedSlotProps;
|
|
14
28
|
export {};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Handles token-to-CSS variable conversion and dark mode overrides.
|
|
4
4
|
*/
|
|
5
5
|
import type { ThemeCSSVariables } from '@c15t/ui/theme';
|
|
6
|
+
import { generateThemeCSS as baseGenerateThemeCSS } from '@c15t/ui/theme';
|
|
6
7
|
import type { Theme } from '../types/theme/style-types.js';
|
|
7
8
|
/**
|
|
8
9
|
* Default design tokens for the v2 theme system.
|
|
@@ -13,6 +14,20 @@ export declare const defaultTheme: Required<Omit<Theme, 'slots'>>;
|
|
|
13
14
|
*/
|
|
14
15
|
export declare const themeToVars: (theme: Theme, isDark?: boolean) => ThemeCSSVariables;
|
|
15
16
|
/**
|
|
16
|
-
* Generates a CSS string for the theme variables
|
|
17
|
+
* Generates a CSS string for the theme variables, the same CSS as
|
|
18
|
+
* `generateThemeCSS` from `@c15t/ui/theme`.
|
|
19
|
+
*
|
|
20
|
+
* @param theme - Theme tokens to serialize.
|
|
21
|
+
* @param colorScheme - `'dark'` makes the dark tokens the default,
|
|
22
|
+
* `'system'` follows `prefers-color-scheme`, and `'light'` adds the stock
|
|
23
|
+
* dark palette under the dark classes. Omit it, or pass `null`, to write
|
|
24
|
+
* only the theme's own tokens.
|
|
25
|
+
* @returns Theme CSS for a `<style>` element or a stylesheet.
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { generateThemeCSS } from '@c15t/react/utils';
|
|
29
|
+
*
|
|
30
|
+
* const css = generateThemeCSS({ dark: { primary: '#7fd1a8' } }, 'system');
|
|
31
|
+
* ```
|
|
17
32
|
*/
|
|
18
|
-
export declare const generateThemeCSS: (theme: Theme) => string;
|
|
33
|
+
export declare const generateThemeCSS: (theme: Theme, colorScheme?: Parameters<typeof baseGenerateThemeCSS>[1]) => string;
|
package/dist-types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.0.0-alpha.
|
|
1
|
+
export declare const version = "3.0.0-alpha.4";
|
package/docs/README.md
CHANGED
|
@@ -6,14 +6,16 @@ These docs ship inside the package so coding agents can read them offline. Open
|
|
|
6
6
|
|
|
7
7
|
## Using these docs
|
|
8
8
|
|
|
9
|
-
These docs describe v3.
|
|
9
|
+
These docs describe c15t v3. Find your app's row in Choose your setup, then follow that framework guide from start to finish; it names the files to create and the backend URL to use. Install c15t packages with the @alpha dist-tag, because npm latest is still v2. A visible banner does not prove anything: check that vendor requests wait for consent, that rejection survives a reload, and that preferences can be reopened.
|
|
10
10
|
|
|
11
11
|
## Start here
|
|
12
12
|
|
|
13
13
|
- [React quickstart](./frameworks/react/quickstart.md)
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
14
|
+
- [Choose your setup](./concepts/choose-your-setup.md): Pick the c15t setup for your framework, rendering mode and hosting, and decide who runs the consent backend.
|
|
15
|
+
- [How consent works](./concepts/how-consent-works.md): What c15t decides on each page load, the difference between a permission and a recorded choice, and what happens when a visitor saves.
|
|
16
|
+
- [Customize the interface](./customization/overview.md): Change c15t's consent banner and dialog one step at a time, from a prop to your own markup, and find where each step lives in your framework.
|
|
17
|
+
- [Verify consent](./guides/verify-consent.md): Check in a production build that vendor requests wait for consent, rejection survives a reload, preferences reopen and privacy signals apply.
|
|
18
|
+
- [Migrate to v3](./upgrade-v3.md): Upgrade a c15t v2 app to v3. Covers packages, the Next.js and React providers, the JavaScript runtime, custom UI built on useConsentManager, callbacks, policies, stored consent and a self-hosted backend.
|
|
17
19
|
|
|
18
20
|
## More documentation
|
|
19
21
|
|
|
@@ -21,85 +23,107 @@ These docs describe v3. Start with Inth hosted setup, identify the framework, ro
|
|
|
21
23
|
|
|
22
24
|
## Frameworks
|
|
23
25
|
|
|
24
|
-
- [
|
|
26
|
+
- [Callbacks](./frameworks/react/callbacks.md): Run code in a React app when a visitor records a consent choice, when permissions change, when a request fails and before the revocation reload, with the ConsentProvider callbacks option.
|
|
27
|
+
- [Clear on revocation](./frameworks/react/clear-on-revocation.md): Delete the first-party cookies and Web Storage keys a consent category owns in a React app when that category is denied, with the clearOnRevocation option on ConsentProvider.
|
|
28
|
+
- [Components](./frameworks/react/components.md): Every c15t component a React app imports from c15t/react, what each renders, where each one mounts, and which to start with.
|
|
29
|
+
- [ConsentBanner](./frameworks/react/components/consent-banner.md): Render the c15t consent banner in a React app, choose its variant and position, and compose its parts.
|
|
25
30
|
- [ConsentDialog](./frameworks/react/components/consent-dialog.md): Open the c15t preference center as a modal ConsentDialog in a React app, wire its triggers and control blocking, focus and policy gating.
|
|
26
31
|
- [ConsentDialogLink](./frameworks/react/components/consent-dialog-link.md): Add a ConsentDialogLink to a React footer so visitors reopen the c15t preference center from your own text link, with asChild and rights data.
|
|
27
|
-
- [ConsentDialogTrigger](./frameworks/react/components/consent-dialog-trigger.md):
|
|
32
|
+
- [ConsentDialogTrigger](./frameworks/react/components/consent-dialog-trigger.md): Add the c15t ConsentDialogTrigger floating button or toolbar inside a React ConsentProvider so visitors can reopen the preference center after the first prompt.
|
|
28
33
|
- [ConsentGate](./frameworks/react/components/consent-gate.md): Gate a YouTube or map iframe behind consent with ConsentGate in React, showing a placeholder that opens the preference center until the category is allowed.
|
|
29
|
-
- [ConsentProvider](./frameworks/react/components/consent-
|
|
34
|
+
- [ConsentProvider](./frameworks/react/components/consent-provider.md): Mount ConsentProvider in a React app and configure its backend, scripts, storage, blocking and presentation options.
|
|
30
35
|
- [ConsentWidget](./frameworks/react/components/consent-widget.md): Embed the c15t preference center inline with ConsentWidget on a React privacy page, with draft toggles that record a choice only on Save.
|
|
31
|
-
- [DevTools](./frameworks/react/components/dev-tools.md):
|
|
32
|
-
- [
|
|
33
|
-
- [Policy
|
|
36
|
+
- [DevTools](./frameworks/react/components/dev-tools.md): Inspect consent state, location, loaded scripts and consent events in a React app during development with the c15t DevTools panel.
|
|
37
|
+
- [Compose your own banner](./frameworks/react/compose.md): Build a React consent banner from the ConsentBanner parts in c15t/react, with your own markup and buttons, while the policy still decides which actions appear.
|
|
38
|
+
- [Content Security Policy](./frameworks/react/content-security-policy.md): Run c15t in a React app under a Content Security Policy, allow the consent backend and vendor hosts, and pass a nonce to ConsentProvider and ConsentTheme.
|
|
39
|
+
- [Customize](./frameworks/react/customize.md): Change the colors, fonts, layout, button styles and copy of the c15t banner and dialog in a React app with the stylesheet, theme tokens, provider options and slots.
|
|
40
|
+
- [Embeds](./frameworks/react/embeds.md): Keep YouTube videos, maps and other iframes out of a React page until their consent category is allowed, with ConsentGate or the iframe blocker in ConsentProvider.
|
|
34
41
|
- [Headless](./frameworks/react/headless.md): Build a custom consent banner in React with the c15t/react/headless hooks inside your ConsentProvider.
|
|
35
|
-
- [Hooks](./frameworks/react/hooks
|
|
36
|
-
- [IAB TCF](./frameworks/react/iab
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
42
|
+
- [Hooks](./frameworks/react/hooks.md): Gate features and save consent choices in React components with the focused hooks exported from c15t/react.
|
|
43
|
+
- [IAB TCF](./frameworks/react/iab.md): Mount the IAB TCF banner and dialog inside a React ConsentProvider and configure the CMP ID, policy and vendor data.
|
|
44
|
+
- [Network blocker](./frameworks/react/network-blocker.md): Hold fetch and XMLHttpRequest calls in a React app until their consent category is allowed, with networkBlocker rules in the ConsentProvider options.
|
|
45
|
+
- [Quickstart](./frameworks/react/quickstart.md): Add a consent banner, preferences dialog and consent-gated scripts to a React single-page app built with Vite, using Inth as the consent backend.
|
|
46
|
+
- [Rendering and deployment](./frameworks/react/rendering.md): How c15t resolves consent in client-rendered React apps, React Router framework mode, Remix and other server-rendered React apps without a c15t adapter.
|
|
47
|
+
- [Scripts](./frameworks/react/scripts.md): Load vendor scripts by consent category in a React app with ConsentProvider, and clear stored data or reload the page when a visitor withdraws consent.
|
|
48
|
+
- [Translations](./frameworks/react/translations.md): Where c15t banner and dialog copy comes from in a React app, how the browser picks the visitor's language, and how to override copy and switch languages with the provider's i18n option and hooks.
|
|
49
|
+
- [Troubleshooting](./frameworks/react/troubleshooting.md): Fix a missing banner, early vendor requests, unstyled components and theme warnings in a React app that uses c15t/react.
|
|
50
|
+
- [Vendor consent](./frameworks/react/vendor-consent.md): Let visitors allow a category such as marketing in a React app and still turn off one vendor in it, with the vendors option on ConsentProvider and useVendorAllowed.
|
|
51
|
+
|
|
52
|
+
## Concepts
|
|
53
|
+
|
|
54
|
+
- [Choose your setup](./concepts/choose-your-setup.md): Pick the c15t setup for your framework, rendering mode and hosting, and decide who runs the consent backend.
|
|
55
|
+
- [Consent categories](./concepts/consent-categories.md): Assign scripts, embeds and features to c15t consent categories, and understand which categories the preference dialog shows.
|
|
56
|
+
- [Consent state reference](./concepts/consent-state.md): How c15t saves choices, gates IAB vendors, hydrates server records and keeps browser tabs and storage in step.
|
|
57
|
+
- [Data fetching](./concepts/data-fetching.md): How c15t gets policy data through a cached manifest, backend /init, the browser or offline rules, and where consent choices are saved.
|
|
58
|
+
- [How consent works](./concepts/how-consent-works.md): What c15t decides on each page load, the difference between a permission and a recorded choice, and what happens when a visitor saves.
|
|
59
|
+
- [Policies](./concepts/policies.md): How policy models, prompts and scope decide what c15t asks visitors, where to change the rules, and why a banner may not appear.
|
|
41
60
|
|
|
42
61
|
## Guides
|
|
43
62
|
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [Troubleshoot consent](./guides/troubleshooting.md): Diagnose missing banners, early vendor requests, lost choices and hydration differences.
|
|
48
|
-
- [Verify consent before shipping](./guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
|
|
63
|
+
- [Banner experiments](./guides/banner-experiments.md): Run A/B tests on consent banner presentation with any feature-flag provider or built-in weighted assignment, and attribute every impression and choice to its arm.
|
|
64
|
+
- [Troubleshooting](./guides/troubleshooting.md): Fix a missing banner, analytics that load before consent, choices lost on reload, CORS errors, hydration differences and failed static builds in c15t v3.
|
|
65
|
+
- [Verify consent](./guides/verify-consent.md): Check in a production build that vendor requests wait for consent, rejection survives a reload, preferences reopen and privacy signals apply.
|
|
49
66
|
|
|
50
67
|
## Customization
|
|
51
68
|
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
69
|
+
- [Class names and CSS-in-JS](./customization/class-names.md): Style c15t's component parts with CSS Modules, vanilla-extract, StyleX, Emotion or plain class names, and see which approach works in each framework.
|
|
70
|
+
- [Dark mode](./customization/dark-mode.md): Switch c15t's banner and dialog to dark colors with colorScheme, set your own dark tokens, follow your site's theme switch, and paint dark on the first frame in every framework.
|
|
71
|
+
- [Motion and animation](./customization/motion.md): Change how fast c15t's banner and dialog animate with duration and easing tokens, turn animations off per surface with disableAnimation, and check reduced-motion behavior in each framework.
|
|
72
|
+
- [Customize the interface](./customization/overview.md): Change c15t's consent banner and dialog one step at a time, from a prop to your own markup, and find where each step lives in your framework.
|
|
73
|
+
- [Banner designs](./customization/recipes.md): Five consent banner designs built with c15t, from one prop to your own markup, with tested code for React, Vue, Svelte, Astro and plain HTML.
|
|
74
|
+
- [Component parts](./customization/slots.md): Find every part of c15t's banner, dialog, widget, trigger and ConsentGate placeholder, its key in your framework's part API, and the data attributes to select on.
|
|
75
|
+
- [Stylesheets and CSS layers](./customization/stylesheets.md): Load the right c15t stylesheet for your framework, see when the dialog's CSS loads, order c15t's cascade layer against your own, and run c15t without its styles.
|
|
76
|
+
- [Tailwind CSS](./customization/tailwind.md): Load c15t's styles next to Tailwind CSS 4 or 3 in every framework, put utilities on c15t component parts, and use Tailwind's dark variant with c15t.
|
|
77
|
+
- [Theme tokens](./customization/tokens.md): Change c15t's colors, type, radius, spacing, shadows and motion with theme tokens, and see every --c15t-* variable with its default.
|
|
56
78
|
- [Copy and translations](./customization/translations.md): Change consent wording through i18n and test the complete prompt and preferences flow.
|
|
57
79
|
|
|
58
80
|
## Integrations
|
|
59
81
|
|
|
60
|
-
- [Adobe Analytics](./integrations/adobe-analytics.md):
|
|
61
|
-
- [Ahrefs Analytics](./integrations/ahrefs-analytics.md):
|
|
62
|
-
- [Amplitude](./integrations/amplitude.md):
|
|
63
|
-
- [Custom integrations](./integrations/building-integrations.md):
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
- [Cloudflare
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [Google Maps](./integrations/google-maps.md):
|
|
72
|
-
- [Google Tag](./integrations/google-tag.md):
|
|
73
|
-
- [Google Tag Manager](./integrations/google-tag-manager.md): Load
|
|
74
|
-
- [
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
79
|
-
- [LinkedIn Insight Tag](./integrations/linkedin-insights.md):
|
|
80
|
-
- [LogRocket](./integrations/logrocket.md):
|
|
81
|
-
- [Matomo Analytics](./integrations/matomo-analytics.md):
|
|
82
|
-
- [Meta Pixel](./integrations/meta-pixel.md):
|
|
83
|
-
- [Microsoft Clarity](./integrations/microsoft-clarity.md):
|
|
84
|
-
- [Microsoft UET](./integrations/microsoft-uet.md):
|
|
85
|
-
- [Mixpanel](./integrations/mixpanel-analytics.md):
|
|
86
|
-
- [
|
|
87
|
-
- [
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [
|
|
92
|
-
- [
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
95
|
-
- [
|
|
96
|
-
- [
|
|
97
|
-
- [
|
|
98
|
-
- [
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
82
|
+
- [Adobe Analytics](./integrations/adobe-analytics.md): Load an Adobe Data Collection Tags property only after measurement consent with the c15t adobeAnalytics helper, and check its extensions in DevTools.
|
|
83
|
+
- [Ahrefs Analytics](./integrations/ahrefs-analytics.md): Load Ahrefs Web Analytics only after measurement consent with the c15t ahrefsAnalytics helper, and check it in DevTools.
|
|
84
|
+
- [Amplitude](./integrations/amplitude.md): Load the Amplitude Browser SDK 2 only after measurement consent with the c15t amplitude helper, which opts the SDK out on revocation and back in on a new grant.
|
|
85
|
+
- [Custom integrations](./integrations/building-integrations.md): Gate a vendor that has no @c15t/integrations helper, or sync consent with an SDK your app already loads, using a c15t script configuration.
|
|
86
|
+
- [Clearbit](./integrations/clearbit.md): Load the Clearbit enrichment tag only after marketing consent with the c15t clearbit helper, and check it in DevTools.
|
|
87
|
+
- [Cloudflare Web Analytics](./integrations/cloudflare-web-analytics.md): Load the Cloudflare Web Analytics beacon only after measurement consent with the c15t cloudflareWebAnalytics helper, and check it in DevTools.
|
|
88
|
+
- [Cloudflare Zaraz](./integrations/cloudflare-zaraz.md): Sync c15t permissions to Cloudflare Zaraz purposes with the c15t cloudflareZaraz bridge, which runs on every page without loading a script, and check the tools it controls.
|
|
89
|
+
- [Crisp](./integrations/crisp.md): Load the Crisp chat widget only after functionality consent with the c15t crisp helper, pass its runtime settings and check it in DevTools.
|
|
90
|
+
- [Databuddy](./integrations/databuddy.md): Load the Databuddy SDK on every page with the c15t databuddy helper, switch its disabled flag and config from measurement consent, and check both in DevTools.
|
|
91
|
+
- [Fathom Analytics](./integrations/fathom-analytics.md): Load Fathom Analytics only after measurement consent with the c15t fathomAnalytics helper, set its SPA mode, and check it in DevTools.
|
|
92
|
+
- [Front Chat](./integrations/front-chat.md): Load the Front Chat widget only after functionality consent with the c15t frontChat helper, forward CSP nonces, clear the session on revocation and check it in DevTools.
|
|
93
|
+
- [Google Maps](./integrations/google-maps.md): Gate a Google Maps iframe embed with c15t v3 so the map loads only after the visitor allows its consent category, in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit, HTML or JavaScript.
|
|
94
|
+
- [Google Tag](./integrations/google-tag.md): Load gtag.js for Google Analytics or Google Ads with c15t Consent Mode v2 signals, and verify the consent commands in DevTools.
|
|
95
|
+
- [Google Tag Manager](./integrations/google-tag-manager.md): Load a Google Tag Manager container with c15t Consent Mode v2 signals, configure consent checks inside the container, and verify both in DevTools.
|
|
96
|
+
- [Heap](./integrations/heap.md): Load the Heap config script and heap.js only after measurement consent with the c15t heap helper, and check it in DevTools.
|
|
97
|
+
- [Hightouch](./integrations/hightouch.md): Load the Hightouch Events browser SDK only after measurement consent with the c15t hightouch helper, and check page events in DevTools.
|
|
98
|
+
- [Hotjar](./integrations/hotjar.md): Load Hotjar only after measurement consent with the c15t hotjar helper, and check its loader and recordings in DevTools.
|
|
99
|
+
- [Intercom](./integrations/intercom.md): Load the Intercom messenger only after functionality consent with the c15t intercom helper, set its region and check it in DevTools.
|
|
100
|
+
- [Klaviyo](./integrations/klaviyo.md): Load Klaviyo signup forms and onsite tracking only after marketing and measurement consent with the c15t klaviyo helper, gate your own events, and check it in DevTools.
|
|
101
|
+
- [LinkedIn Insight Tag](./integrations/linkedin-insights.md): Load the LinkedIn Insight Tag only after marketing consent with the c15t linkedinInsights helper, guard lintrk conversion calls, and check it in DevTools.
|
|
102
|
+
- [LogRocket](./integrations/logrocket.md): Load LogRocket session replay only after measurement consent with the c15t logRocket helper, including proxied setups, and check it in DevTools.
|
|
103
|
+
- [Matomo Analytics](./integrations/matomo-analytics.md): Load Matomo after measurement consent with the c15t matomoAnalytics helper, or use Matomo's own consent mode, and check each mode in DevTools.
|
|
104
|
+
- [Meta Pixel](./integrations/meta-pixel.md): Load the Meta Pixel only after marketing consent with the c15t metaPixel helper, guard fbq event calls, and check it in DevTools.
|
|
105
|
+
- [Microsoft Clarity](./integrations/microsoft-clarity.md): Load Microsoft Clarity only after measurement consent with the c15t clarity helper, send Consent V2 storage signals and check them in DevTools.
|
|
106
|
+
- [Microsoft UET](./integrations/microsoft-uet.md): Load Microsoft Advertising UET on every page with the c15t microsoftUet helper, send ad_storage consent defaults and updates, and verify both in DevTools.
|
|
107
|
+
- [Mixpanel](./integrations/mixpanel-analytics.md): Load the Mixpanel SDK on every page with the c15t mixpanelAnalytics helper, which switches Mixpanel tracking on and off with measurement consent, and check it in DevTools.
|
|
108
|
+
- [OneDollarStats](./integrations/one-dollar-stats.md): Load the OneDollarStats tracker only after measurement consent with the c15t oneDollarStats helper, forward its data-attribute settings, and check it in DevTools.
|
|
109
|
+
- [OpenAI Pixel](./integrations/openai-pixel.md): Load the ChatGPT Ads Measurement Pixel only after marketing consent with the c15t openaiPixel helper, guard oaiq conversion calls, and check it in DevTools.
|
|
110
|
+
- [Integrations](./integrations/overview.md): Find all c15t integrations for analytics, tag managers, advertising, email and SMS, chat and embedded content.
|
|
111
|
+
- [Pinterest Tag](./integrations/pinterest-tag.md): Load the Pinterest Tag only after marketing consent with the c15t pinterestTag helper, guard pintrk event calls, and check it in DevTools.
|
|
112
|
+
- [Pirsch](./integrations/pirsch.md): Load Pirsch Analytics only after measurement consent with the c15t pirsch helper, keep custom event bindings working, and check it in DevTools.
|
|
113
|
+
- [Plausible Analytics](./integrations/plausible-analytics.md): Load the Plausible Analytics tracker only after measurement consent with the c15t plausibleAnalytics helper, and check it in DevTools.
|
|
114
|
+
- [PostHog](./integrations/posthog.md): Load PostHog before or after measurement consent with the c15t posthog helper, choose its cookieless behavior, and sync consent with an SDK you already initialize.
|
|
115
|
+
- [Promptwatch](./integrations/promptwatch.md): Load the Promptwatch attribution client only after measurement consent with the c15t promptwatch helper, and check it in DevTools.
|
|
116
|
+
- [Reddit Pixel](./integrations/reddit-pixel.md): Load the Reddit Pixel only after marketing consent with the c15t redditPixel helper, guard rdt conversion calls, and check it in DevTools.
|
|
117
|
+
- [RudderStack](./integrations/rudderstack.md): Load the RudderStack JavaScript SDK after measurement consent with the c15t rudderstack helper, or map c15t categories to destination consent IDs, and check each mode.
|
|
118
|
+
- [Rybbit Analytics](./integrations/rybbit-analytics.md): Load Rybbit Analytics only after measurement consent with the c15t rybbitAnalytics helper, map its tracking options to data attributes, and check it in DevTools.
|
|
119
|
+
- [Segment](./integrations/segment.md): Load Segment Analytics.js only after measurement consent with the c15t segment helper, guard your own track and identify calls, and check it in DevTools.
|
|
120
|
+
- [Snapchat Pixel](./integrations/snapchat-pixel.md): Load the Snapchat Pixel only after marketing consent with the c15t snapchatPixel helper, guard snaptr event calls, and check it in DevTools.
|
|
121
|
+
- [TikTok Pixel](./integrations/tiktok-pixel.md): Load the TikTok Pixel only after marketing consent with the c15t tiktokPixel helper, guard ttq event calls, and check it in DevTools.
|
|
122
|
+
- [Umami Analytics](./integrations/umami-analytics.md): Load the Umami Analytics tracker only after measurement consent with the c15t umamiAnalytics helper, point it at a self-hosted instance, and check it in DevTools.
|
|
123
|
+
- [Vercel Analytics](./integrations/vercel-analytics.md): Load the Vercel Web Analytics script only after measurement consent with the c15t vercelAnalytics helper, choose the debug script, and check it in DevTools.
|
|
124
|
+
- [X Pixel](./integrations/x-pixel.md): Load the X Pixel only after marketing consent with the c15t xPixel helper, guard twq conversion events, and check it in DevTools.
|
|
101
125
|
- [YouTube](./integrations/youtube.md): Gate YouTube embeds with c15t v3 in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit or JavaScript.
|
|
102
126
|
|
|
103
127
|
## Reference
|
|
104
128
|
|
|
105
|
-
- [
|
|
129
|
+
- [Migrate to v3](./upgrade-v3.md): Upgrade a c15t v2 app to v3. Covers packages, the Next.js and React providers, the JavaScript runtime, custom UI built on useConsentManager, callbacks, policies, stored consent and a self-hosted backend.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Choose your setup
|
|
3
|
+
description: Pick the c15t setup for your framework, rendering mode and hosting,
|
|
4
|
+
and decide who runs the consent backend.
|
|
5
|
+
group: concepts
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Find your app in this table
|
|
9
|
+
|
|
10
|
+
Most apps need one row. Follow its guide from start to finish; each guide links
|
|
11
|
+
to the alternatives it rules out.
|
|
12
|
+
|
|
13
|
+
| Your app | Setup | Guide |
|
|
14
|
+
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| Next.js App Router with a Next.js server | Server resolves consent from a cached manifest and streams it to the page | [App Router](https://c15t.com/docs/frameworks/next/rendering#pick-your-rendering-path) |
|
|
16
|
+
| Next.js App Router, banner must be in the first HTML | Await consent inside `Suspense` | [Stream or await](https://c15t.com/docs/frameworks/next/rendering#stream-or-await-consent-in-the-app-router) |
|
|
17
|
+
| Next.js with static, ISR or `'use cache'` pages | Browser resolves consent on those pages | [Static, ISR and cached pages](https://c15t.com/docs/frameworks/next/rendering#render-static-isr-and-cached-pages) |
|
|
18
|
+
| Next.js Pages Router | Resolve consent in `getServerSideProps` | [Pages Router](https://c15t.com/docs/frameworks/next/rendering#pick-your-rendering-path) |
|
|
19
|
+
| Next.js with `output: 'export'` | Browser resolves consent | [Static export](https://c15t.com/docs/frameworks/next/static-export) |
|
|
20
|
+
| TanStack Start with a server | Root loader resolves consent on the server | [TanStack Start](https://c15t.com/docs/frameworks/tanstack-start/quickstart) |
|
|
21
|
+
| TanStack Start on a serverless host, banner may follow the page | Root loader streams consent | [TanStack Start rendering](https://c15t.com/docs/frameworks/tanstack-start/rendering#stream-the-page-while-consent-resolves) |
|
|
22
|
+
| TanStack Start in SPA mode or prerendered | Browser resolves consent | [TanStack Start rendering](https://c15t.com/docs/frameworks/tanstack-start/rendering#spa-mode-prerendered-pages-and-static-hosts) |
|
|
23
|
+
| React with Vite, or another single-page app | Browser resolves consent | [React](../frameworks/react/quickstart.md) |
|
|
24
|
+
| React Router framework mode, Remix, or another server-rendered React app | Browser resolves consent after hydration | [React rendering](../frameworks/react/rendering.md#react-router-remix-and-other-server-rendered-apps) |
|
|
25
|
+
| Nuxt with a Nuxt server | Nuxt module resolves consent on the server from a cached manifest | [Nuxt](https://c15t.com/docs/frameworks/nuxt/quickstart) |
|
|
26
|
+
| Nuxt with prerendered or cached routes | Nuxt server for most pages, the browser on prerendered and cached routes | [Nuxt prerendered and cached routes](https://c15t.com/docs/frameworks/nuxt/rendering#prerendered-and-cached-routes) |
|
|
27
|
+
| Nuxt with `nuxt generate` on static hosting | Nuxt module, browser resolves consent from the manifest or `/init` | [Nuxt static hosting](https://c15t.com/docs/frameworks/nuxt/rendering#deploy-to-static-hosting) |
|
|
28
|
+
| Nuxt with `ssr: false` | Nuxt module, browser resolves consent from the manifest | [Nuxt single-page app](https://c15t.com/docs/frameworks/nuxt/rendering#build-a-single-page-app-with-ssr-false) |
|
|
29
|
+
| Vue with Vite | Vue plugin, browser resolves consent | [Vue](https://c15t.com/docs/frameworks/vue/quickstart) |
|
|
30
|
+
| Vue rendered on the server without Nuxt | Vue plugin; the banner mounts after hydration. Use Nuxt for the banner in server HTML. | [Vue rendering](https://c15t.com/docs/frameworks/vue/rendering#server-rendering-without-nuxt) |
|
|
31
|
+
| Astro with static output | Browser resolves consent through the hosted backend | [Astro static output](https://c15t.com/docs/frameworks/astro/rendering#static-output-with-hosted) |
|
|
32
|
+
| Astro with server output and an adapter | Middleware resolves consent from a cached manifest | [Astro server output](https://c15t.com/docs/frameworks/astro/rendering#server-output-with-manifest) |
|
|
33
|
+
| Svelte with Vite | Svelte provider, browser resolves consent | [Svelte](https://c15t.com/docs/frameworks/svelte/quickstart) |
|
|
34
|
+
| SvelteKit with a server | Root layout load resolves consent on the server | [SvelteKit](https://c15t.com/docs/frameworks/sveltekit/quickstart) |
|
|
35
|
+
| SvelteKit with `adapter-static`, prerendered pages or SPA mode | Browser resolves consent | [SvelteKit rendering](https://c15t.com/docs/frameworks/sveltekit/rendering#build-a-static-site) |
|
|
36
|
+
| Plain HTML, a CMS, a page builder, or a static site generator such as Hugo or Eleventy | One script tag, stock banner included | [HTML](https://c15t.com/docs/frameworks/html/quickstart) |
|
|
37
|
+
| JavaScript with a bundler and no UI framework | `@c15t/browser` module, stock banner included | [JavaScript](https://c15t.com/docs/frameworks/javascript/quickstart) |
|
|
38
|
+
| Your own UI, or a framework without an adapter such as Solid | Headless runtime | [JavaScript headless](https://c15t.com/docs/frameworks/javascript/headless) |
|
|
39
|
+
|
|
40
|
+
Solid has no c15t adapter. Use the [headless runtime](https://c15t.com/docs/frameworks/javascript/headless#use-c15t-with-solid)
|
|
41
|
+
and subscribe to it from your components.
|
|
42
|
+
|
|
43
|
+
## Decide who runs the consent backend
|
|
44
|
+
|
|
45
|
+
The backend supplies policies and stores consent records. Every setup above
|
|
46
|
+
works with each option; only the URL changes.
|
|
47
|
+
|
|
48
|
+
| Option | Use it when |
|
|
49
|
+
| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| [Inth](https://inth.com) | You want hosted policies and consent records. The guides use this. |
|
|
51
|
+
| [Self-hosted c15t backend](https://c15t.com/docs/self-host/overview) | You need to run the service and its database yourself. |
|
|
52
|
+
| Offline mode | Local development and tests. Policies live in your code and choices stay in the browser, with no consent records. Not recommended for production environments. |
|
|
53
|
+
|
|
54
|
+
To use Inth, create a project, set its policy rules, add your site's origin to
|
|
55
|
+
its trusted origins, and copy the backend URL. The guides use the placeholder
|
|
56
|
+
`https://your-project.inth.app`; replace it with your project's backend URL,
|
|
57
|
+
including any path prefix.
|
|
58
|
+
|
|
59
|
+
## Server rendering or browser rendering
|
|
60
|
+
|
|
61
|
+
Where consent resolves decides what the visitor's first HTML contains.
|
|
62
|
+
|
|
63
|
+
| Rendering | What the visitor gets |
|
|
64
|
+
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
65
|
+
| The server resolves consent for each request | The server reads the visitor's cookie and location headers, so the browser starts with the answer. Gated scripts can run right after hydration, and the banner can be part of the HTML. |
|
|
66
|
+
| The browser resolves consent | The HTML is the same for everyone. After the page loads, the browser requests the policy, then shows the banner or runs gated scripts. |
|
|
67
|
+
|
|
68
|
+
A static or prerendered page cannot contain one visitor's consent, because the
|
|
69
|
+
same HTML goes to everyone. Static sites still use Inth; the browser talks to it
|
|
70
|
+
directly. A same-origin `/api/c15t` route only works where a server runs it.
|
|
71
|
+
|
|
72
|
+
Pages that are cached and shared between visitors, such as Next.js ISR or
|
|
73
|
+
`'use cache'` routes, need browser resolution for the same reason. Cache the
|
|
74
|
+
public policy manifest, never a response that contains a visitor's consent.
|
|
75
|
+
|
|
76
|
+
## How the server gets the policy
|
|
77
|
+
|
|
78
|
+
Server setups fetch policy one of two ways:
|
|
79
|
+
|
|
80
|
+
* **Manifest**, used by the Next.js, Nuxt and Astro server guides.
|
|
81
|
+
Your server downloads the project's public policy file, caches it, and
|
|
82
|
+
resolves each visitor locally. Consent saves still go to the backend.
|
|
83
|
+
* **`/init`**. Each visit asks the backend to resolve the visitor. Simpler, but
|
|
84
|
+
every page load makes a request to the backend.
|
|
85
|
+
|
|
86
|
+
[Data fetching](./data-fetching.md) compares them in detail,
|
|
87
|
+
including proxies and custom transports.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Consent categories
|
|
3
|
-
description: Assign
|
|
4
|
-
|
|
5
|
-
group:
|
|
3
|
+
description: Assign scripts, embeds and features to c15t consent categories, and
|
|
4
|
+
understand which categories the preference dialog shows.
|
|
5
|
+
group: concepts
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Choose categories by purpose
|
|
@@ -27,8 +27,23 @@ Compound script and network conditions contribute every category they reference.
|
|
|
27
27
|
Discovered categories are added to `consentCategories`, when supplied. The dialog
|
|
28
28
|
always includes Necessary and offers the optional categories in that combined
|
|
29
29
|
set that are also in the resolved policy scope. Choice completion uses the same
|
|
30
|
-
set.
|
|
31
|
-
|
|
30
|
+
set.
|
|
31
|
+
|
|
32
|
+
If neither configuration nor integrations supply categories, the result depends
|
|
33
|
+
on the policy's `scopeMode`:
|
|
34
|
+
|
|
35
|
+
* Under a permissive policy, the dialog lists only Necessary. The banner still
|
|
36
|
+
appears when the policy prompts for a choice. Accept All, Reject All and Save
|
|
37
|
+
each record that the visitor saw it, send a consent receipt for Necessary
|
|
38
|
+
alone in hosted and manifest modes, and keep the banner dismissed after
|
|
39
|
+
reload. The acknowledgement expires with the policy's choice validity and
|
|
40
|
+
after a policy change, like a choice would. A stored choice that is still
|
|
41
|
+
valid under the current policy also counts as an acknowledgement.
|
|
42
|
+
* Under a strict policy, or an IAB TCF policy, the dialog uses the full policy
|
|
43
|
+
scope. TCF consent is given per purpose and recorded in the TC string.
|
|
44
|
+
|
|
45
|
+
A category declared after that acknowledgement, such as a newly registered
|
|
46
|
+
script or a discovered iframe, needs a choice, so the banner asks again.
|
|
32
47
|
|
|
33
48
|
Categories discovered later are added immediately and retained until the provider
|
|
34
49
|
or runtime is recreated. Adding a category can require a new choice; removing a
|
|
@@ -53,10 +68,17 @@ Analytics.
|
|
|
53
68
|
Hidden optional categories do not need a choice to dismiss the banner. Their
|
|
54
69
|
permissions still follow the backend policy, so hidden opt-in categories remain
|
|
55
70
|
denied without a valid grant. React providers enable DOM iframe blocking and
|
|
56
|
-
discovery by default
|
|
71
|
+
discovery by default. The blocker loads when the first iframe with
|
|
72
|
+
`data-category` or `data-vendor` is on the page, so pages without one never
|
|
73
|
+
download it; until it runs, such an iframe that arrives with a `src` consent
|
|
74
|
+
does not allow is paused. Write gated iframes with `data-src`, not `src`. The
|
|
75
|
+
browser requests a `src` as soon as the iframe is in the document, before the
|
|
76
|
+
blocker can pause it, whether the iframe comes from the server HTML or a
|
|
77
|
+
client render. Set
|
|
78
|
+
`iframeBlocker: false` to disable it, or
|
|
57
79
|
`iframeBlocker: { disableAutomaticBlocking: true }` to scan manually with
|
|
58
80
|
`useIframeBlocker({ disableAutomaticBlocking: true }).processAllIframes()`.
|
|
59
81
|
|
|
60
82
|
Use effective permissions to gate work and explicit choices to inspect what the
|
|
61
|
-
visitor confirmed. Read [consent
|
|
62
|
-
distinction and [migration](
|
|
83
|
+
visitor confirmed. Read [how consent works](./how-consent-works.md#a-permission-is-not-a-recorded-choice) for that
|
|
84
|
+
distinction and [migration](../upgrade-v3.md) for v3 policy configuration.
|