@c15t/react 2.1.0 → 2.2.0-canary-20260727202135
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 +155 -0
- package/README.md +29 -14
- package/client/components/integrations.js +3 -0
- package/dist/components/consent-banner/atoms/overlay.cjs +1 -1
- package/dist/components/consent-banner/atoms/root.cjs +1 -1
- package/dist/components/consent-banner/components.cjs +1 -1
- package/dist/components/consent-banner/consent-banner.cjs +1 -1
- package/dist/components/consent-banner/error-boundary.cjs +1 -1
- package/dist/components/consent-banner/index.cjs +1 -1
- package/dist/components/consent-banner/policy-actions.cjs +1 -1
- package/dist/components/consent-dialog/atoms/card.cjs +1 -1
- package/dist/components/consent-dialog/atoms/overlay.cjs +1 -1
- package/dist/components/consent-dialog/atoms/root.cjs +1 -1
- package/dist/components/consent-dialog/consent-dialog.cjs +1 -1
- package/dist/components/consent-dialog/index.cjs +1 -1
- package/dist/components/consent-dialog-link/index.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/button.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/button.js +1 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/root.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/text.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/toolbar.cjs +1 -0
- package/dist/components/consent-dialog-trigger/atoms/toolbar.js +1 -0
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.cjs +1 -0
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.js +1 -0
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger.cjs +1 -1
- package/dist/components/consent-dialog-trigger/index.cjs +1 -1
- package/dist/components/consent-dialog-trigger/index.js +1 -1
- package/dist/components/consent-dialog-trigger/use-draggable.cjs +1 -1
- package/dist/components/consent-preferences-link/consent-preferences-link.cjs +1 -1
- package/dist/components/consent-preferences-link/index.cjs +1 -1
- package/dist/components/consent-widget/atoms/accordion.cjs +1 -1
- package/dist/components/consent-widget/atoms/button.cjs +1 -1
- package/dist/components/consent-widget/atoms/footer.cjs +1 -1
- package/dist/components/consent-widget/atoms/root.cjs +1 -1
- package/dist/components/consent-widget/consent-widget.cjs +1 -1
- package/dist/components/consent-widget/index.cjs +1 -1
- package/dist/components/consent-widget/policy-actions.cjs +1 -1
- package/dist/components/frame/atoms.cjs +1 -1
- package/dist/components/frame/atoms.js +1 -1
- package/dist/components/frame/frame.cjs +1 -1
- package/dist/components/frame/index.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/button-group.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/card.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/description.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/footer.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/header.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/overlay.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/root.cjs +1 -1
- package/dist/components/iab-consent-banner/atoms/title.cjs +1 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.cjs +1 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.js +1 -1
- package/dist/components/iab-consent-banner/index.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/card.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/content.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/footer.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/header.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/overlay.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/purpose-item.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/root.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/stack-item.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/tabs.cjs +1 -1
- package/dist/components/iab-consent-dialog/atoms/vendor-list.cjs +1 -1
- package/dist/components/iab-consent-dialog/hooks/use-gvl-data.cjs +1 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +1 -1
- package/dist/components/iab-consent-dialog/index.cjs +1 -1
- package/dist/components/iab-consent-dialog/use-iab-translations.cjs +1 -1
- package/dist/components/integrations/google-map.cjs +1 -0
- package/dist/components/integrations/google-map.js +1 -0
- package/dist/components/integrations/index.cjs +1 -0
- package/dist/components/integrations/index.js +1 -0
- package/dist/components/integrations/shared.cjs +1 -0
- package/dist/components/integrations/shared.js +1 -0
- package/dist/components/integrations/youtube-embed.cjs +1 -0
- package/dist/components/integrations/youtube-embed.js +1 -0
- package/dist/components/shared/libs/recursive-clone-children.cjs +1 -1
- package/dist/components/shared/libs/slot.cjs +1 -1
- package/dist/components/shared/libs/use-controllable-state.cjs +1 -1
- package/dist/components/shared/policy-actions.cjs +1 -1
- package/dist/components/shared/primitives/box.cjs +1 -1
- package/dist/components/shared/primitives/button.cjs +1 -1
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/primitives/legal-links/index.cjs +1 -1
- package/dist/components/shared/primitives/legal-links/index.js +1 -1
- package/dist/components/shared/ui/accordion/accordion.cjs +1 -1
- package/dist/components/shared/ui/accordion/index.cjs +1 -1
- package/dist/components/shared/ui/animated-collapse/animated-collapse.cjs +1 -1
- package/dist/components/shared/ui/animated-collapse/index.cjs +1 -1
- package/dist/components/shared/ui/branding.cjs +1 -1
- package/dist/components/shared/ui/button/button.cjs +1 -1
- package/dist/components/shared/ui/button/index.cjs +1 -1
- package/dist/components/shared/ui/collapsible/collapsible.cjs +1 -1
- package/dist/components/shared/ui/collapsible/index.cjs +1 -1
- package/dist/components/shared/ui/dialog/dialog.cjs +1 -1
- package/dist/components/shared/ui/dialog/index.cjs +1 -1
- package/dist/components/shared/ui/icon.cjs +1 -1
- package/dist/components/shared/ui/logo.cjs +1 -1
- package/dist/components/shared/ui/preference-item/index.cjs +1 -1
- package/dist/components/shared/ui/preference-item/preference-item.cjs +1 -1
- package/dist/components/shared/ui/switch/index.cjs +1 -1
- package/dist/components/shared/ui/switch/switch.cjs +1 -1
- package/dist/components/shared/ui/tabs/index.cjs +1 -1
- package/dist/components/shared/ui/tabs/tabs.cjs +1 -1
- package/dist/context/consent-manager-context.cjs +1 -1
- package/dist/context/consent-tracking-context.cjs +1 -1
- package/dist/context/theme-context.cjs +1 -1
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-color-scheme.cjs +1 -1
- package/dist/hooks/use-component-config.cjs +1 -1
- package/dist/hooks/use-consent-dialog-trigger.cjs +1 -1
- package/dist/hooks/use-consent-manager.cjs +1 -1
- package/dist/hooks/use-consent-script.cjs +1 -0
- package/dist/hooks/use-consent-script.js +1 -0
- package/dist/hooks/use-focus-trap.cjs +1 -1
- package/dist/hooks/use-headless-consent-ui.cjs +1 -1
- package/dist/hooks/use-headless-iab-consent-ui.cjs +1 -1
- package/dist/hooks/use-reduced-motion.cjs +1 -1
- package/dist/hooks/use-scroll-lock.cjs +1 -1
- package/dist/hooks/use-ssr-status.cjs +1 -1
- package/dist/hooks/use-styles.cjs +1 -1
- package/dist/hooks/use-text-direction.cjs +1 -1
- package/dist/hooks/use-theme.cjs +1 -1
- package/dist/hooks/use-translations.cjs +1 -1
- package/dist/iab.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/primitives/accordion.cjs +1 -1
- package/dist/primitives/button.cjs +1 -1
- package/dist/primitives/collapsible.cjs +1 -1
- package/dist/primitives/dialog.cjs +1 -1
- package/dist/primitives/preference-item.cjs +1 -1
- package/dist/primitives/switch.cjs +1 -1
- package/dist/primitives/tabs.cjs +1 -1
- package/dist/primitives.cjs +1 -1
- package/dist/providers/consent-manager-provider.cjs +1 -1
- package/dist/server/fetch-ssr-data.cjs +1 -1
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/server/headers.cjs +1 -1
- package/dist/server/headers.js +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/init-cache-key.cjs +1 -1
- package/dist/server/normalize-url.cjs +1 -1
- package/dist/styles.tw3.css +1 -1
- package/dist/types/theme/index.cjs +1 -1
- package/dist/types/theme/style-types.cjs +1 -1
- package/dist/utils/cn.cjs +1 -1
- package/dist/utils/merge-styles.cjs +1 -1
- package/dist/utils/test-helpers.cjs +1 -1
- package/dist/utils/theme-utils.cjs +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist-types/components/consent-banner/components.d.ts +2 -2
- package/dist-types/components/consent-banner/policy-actions.d.ts +1 -1
- package/dist-types/components/consent-dialog/atoms/card.d.ts +5 -5
- package/dist-types/components/consent-dialog-trigger/atoms/toolbar.d.ts +22 -0
- package/dist-types/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.d.ts +35 -0
- package/dist-types/components/consent-dialog-trigger/index.d.ts +2 -1
- package/dist-types/components/consent-dialog-trigger/types.d.ts +111 -6
- package/dist-types/components/consent-widget/atoms/accordion.d.ts +4 -4
- package/dist-types/components/consent-widget/consent-widget.d.ts +1 -1
- package/dist-types/components/consent-widget/policy-actions.d.ts +1 -1
- package/dist-types/components/integrations/google-map.d.ts +82 -0
- package/dist-types/components/integrations/index.d.ts +2 -0
- package/dist-types/components/integrations/shared.d.ts +12 -0
- package/dist-types/components/integrations/youtube-embed.d.ts +95 -0
- package/dist-types/components/shared/policy-actions.d.ts +1 -1
- package/dist-types/components/shared/primitives/button.d.ts +36 -2
- package/dist-types/components/shared/primitives/legal-links/index.d.ts +1 -1
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +2 -2
- package/dist-types/components/shared/ui/branding.d.ts +3 -3
- package/dist-types/components/shared/ui/button/button.d.ts +1 -1
- package/dist-types/components/shared/ui/dialog/dialog.d.ts +1 -1
- package/dist-types/components/shared/ui/logo.d.ts +8 -8
- package/dist-types/headless.d.ts +1 -0
- package/dist-types/hooks/index.d.ts +1 -0
- package/dist-types/hooks/use-consent-script.d.ts +80 -0
- package/dist-types/index.d.ts +3 -1
- package/dist-types/providers/consent-manager-provider.d.ts +1 -1
- package/dist-types/server/headers.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +1 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +155 -76
- package/docs/{building-headless-components.md → frameworks/react/building-headless-components.md} +3 -1
- package/docs/{callbacks.md → frameworks/react/callbacks.md} +3 -1
- package/docs/{components → frameworks/react/components}/consent-banner.md +10 -21
- package/docs/{components → frameworks/react/components}/consent-dialog-link.md +8 -5
- package/docs/frameworks/react/components/consent-dialog-trigger.md +202 -0
- package/docs/{components → frameworks/react/components}/consent-dialog.md +7 -15
- package/docs/frameworks/react/components/consent-manager-provider.md +228 -0
- package/docs/{components → frameworks/react/components}/consent-widget.md +8 -6
- package/docs/{components → frameworks/react/components}/dev-tools.md +9 -6
- package/docs/{components → frameworks/react/components}/frame.md +8 -9
- package/docs/{concepts → frameworks/react/concepts}/client-modes.md +4 -2
- package/docs/{concepts → frameworks/react/concepts}/consent-categories.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/consent-models.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/cookie-management.md +3 -3
- package/docs/{concepts → frameworks/react/concepts}/glossary.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/initialization-flow.md +1 -0
- package/docs/{concepts → frameworks/react/concepts}/policy-packs.md +1 -0
- package/docs/{headless.md → frameworks/react/headless.md} +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-color-scheme.md +1 -0
- package/docs/{hooks → frameworks/react/hooks}/use-consent-manager/checking-consent.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-consent-manager/location-info.md +3 -1
- package/docs/frameworks/react/hooks/use-consent-manager/overview.md +172 -0
- package/docs/{hooks → frameworks/react/hooks}/use-consent-manager/setting-consent.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-draggable.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-focus-trap.md +1 -0
- package/docs/{hooks → frameworks/react/hooks}/use-reduced-motion.md +3 -1
- package/docs/{hooks → frameworks/react/hooks}/use-ssr-status.md +6 -5
- package/docs/{hooks → frameworks/react/hooks}/use-text-direction.md +1 -0
- package/docs/frameworks/react/hooks/use-translations.md +55 -0
- package/docs/{iab → frameworks/react/iab}/consent-banner.md +9 -12
- package/docs/{iab → frameworks/react/iab}/consent-dialog.md +9 -14
- package/docs/{iab → frameworks/react/iab}/overview.md +4 -2
- package/docs/{iab → frameworks/react/iab}/use-gvl-data.md +3 -2
- package/docs/{iframe-blocking.md → frameworks/react/iframe-blocking.md} +8 -9
- package/docs/{internationalization.md → frameworks/react/internationalization.md} +13 -3
- package/docs/{network-blocker.md → frameworks/react/network-blocker.md} +13 -51
- package/docs/{optimization.md → frameworks/react/optimization.md} +3 -2
- package/docs/{policy-packs.md → frameworks/react/policy-packs.md} +3 -1
- package/docs/{quickstart.md → frameworks/react/quickstart.md} +26 -42
- package/docs/{script-loader.md → frameworks/react/script-loader.md} +134 -89
- package/docs/{server-side.md → frameworks/react/server-side.md} +9 -4
- package/docs/{styling → frameworks/react/styling}/classnames.md +3 -1
- package/docs/{styling → frameworks/react/styling}/color-scheme.md +3 -1
- package/docs/frameworks/react/styling/css-variables.md +53 -0
- package/docs/frameworks/react/styling/overview.md +302 -0
- package/docs/frameworks/react/styling/slots.md +94 -0
- package/docs/{styling → frameworks/react/styling}/tailwind.md +3 -1
- package/docs/frameworks/react/styling/tokens.md +156 -0
- package/docs/{troubleshooting.md → frameworks/react/troubleshooting.md} +3 -1
- package/docs/integrations/adobe-analytics.md +160 -0
- package/docs/integrations/ahrefs-analytics.md +15 -82
- package/docs/integrations/amplitude.md +230 -0
- package/docs/integrations/building-integrations.md +15 -181
- package/docs/integrations/clearbit.md +130 -0
- package/docs/integrations/cloudflare-web-analytics.md +15 -83
- package/docs/integrations/crisp.md +13 -87
- package/docs/integrations/databuddy.md +16 -85
- package/docs/integrations/fathom-analytics.md +15 -86
- package/docs/integrations/google-maps.md +263 -0
- package/docs/integrations/google-tag-manager.md +18 -86
- package/docs/integrations/google-tag.md +15 -84
- package/docs/integrations/heap.md +219 -0
- package/docs/integrations/hightouch.md +199 -0
- package/docs/integrations/hotjar.md +15 -83
- package/docs/integrations/intercom.md +13 -83
- package/docs/integrations/linkedin-insights.md +15 -82
- package/docs/integrations/logrocket.md +175 -0
- package/docs/integrations/matomo-analytics.md +13 -88
- package/docs/integrations/meta-pixel.md +33 -316
- package/docs/integrations/microsoft-clarity.md +15 -83
- package/docs/integrations/microsoft-uet.md +16 -83
- package/docs/integrations/mixpanel-analytics.md +15 -83
- package/docs/integrations/overview.md +55 -6
- package/docs/integrations/pirsch.md +142 -0
- package/docs/integrations/plausible-analytics.md +14 -97
- package/docs/integrations/posthog.md +25 -97
- package/docs/integrations/promptwatch.md +16 -82
- package/docs/integrations/reddit-pixel.md +27 -122
- package/docs/integrations/rudderstack.md +271 -0
- package/docs/integrations/rybbit-analytics.md +15 -94
- package/docs/integrations/segment.md +15 -82
- package/docs/integrations/snapchat-pixel.md +21 -102
- package/docs/integrations/tiktok-pixel.md +13 -81
- package/docs/integrations/umami-analytics.md +16 -88
- package/docs/integrations/vercel-analytics.md +13 -85
- package/docs/integrations/x-pixel.md +27 -102
- package/docs/integrations/youtube.md +193 -0
- package/docs/shared/concepts/client-modes.md +103 -0
- package/docs/shared/concepts/consent-categories.md +41 -0
- package/docs/shared/concepts/consent-models.md +72 -0
- package/docs/shared/concepts/cookie-management.md +88 -0
- package/docs/shared/concepts/glossary.md +24 -0
- package/docs/shared/concepts/initialization-flow.md +105 -0
- package/docs/shared/concepts/policy-packs.md +225 -0
- package/docs/shared/react/components/consent-banner.md +242 -0
- package/docs/shared/react/components/consent-dialog-link.md +45 -0
- package/docs/shared/react/components/consent-dialog-trigger.md +185 -0
- package/docs/shared/react/components/consent-dialog.md +119 -0
- package/docs/shared/react/components/consent-manager-provider.md +183 -0
- package/docs/shared/react/components/consent-widget.md +121 -0
- package/docs/shared/react/components/dev-tools.md +81 -0
- package/docs/shared/react/components/frame.md +52 -0
- package/docs/shared/react/guides/building-headless-components.md +110 -0
- package/docs/shared/react/guides/callbacks.md +89 -0
- package/docs/shared/react/guides/headless.md +31 -0
- package/docs/shared/react/guides/iframe-blocking.md +65 -0
- package/docs/shared/react/guides/internationalization.md +123 -0
- package/docs/shared/react/guides/network-blocker.md +72 -0
- package/docs/shared/react/guides/optimization.md +44 -0
- package/docs/shared/react/guides/policy-packs.md +173 -0
- package/docs/shared/react/guides/script-loader.md +309 -0
- package/docs/shared/react/hooks/use-color-scheme.md +31 -0
- package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +95 -0
- package/docs/shared/react/hooks/use-consent-manager/location-info.md +96 -0
- package/docs/shared/react/hooks/use-consent-manager/overview.md +74 -0
- package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +93 -0
- package/docs/shared/react/hooks/use-draggable.md +30 -0
- package/docs/shared/react/hooks/use-focus-trap.md +20 -0
- package/docs/shared/react/hooks/use-reduced-motion.md +33 -0
- package/docs/shared/react/hooks/use-ssr-status.md +16 -0
- package/docs/shared/react/hooks/use-text-direction.md +38 -0
- package/docs/shared/react/hooks/use-translations.md +15 -0
- package/docs/shared/react/iab/consent-banner.md +60 -0
- package/docs/shared/react/iab/consent-dialog.md +76 -0
- package/docs/shared/react/iab/overview.md +80 -0
- package/docs/shared/react/iab/use-gvl-data.md +21 -0
- package/docs/shared/react/styling/classnames.md +93 -0
- package/docs/shared/react/styling/color-scheme.md +35 -0
- package/docs/shared/react/styling/css-variables.md +53 -0
- package/docs/shared/react/styling/overview.md +261 -0
- package/docs/shared/react/styling/slots.md +93 -0
- package/docs/shared/react/styling/stylesheet-entrypoint.md +8 -0
- package/docs/shared/react/styling/tailwind.md +88 -0
- package/docs/shared/react/styling/tokens.md +155 -0
- package/docs/shared/troubleshooting.md +82 -0
- package/package.json +23 -12
- package/readme.json +12 -7
- package/docs/ai-agents.md +0 -111
- package/docs/components/consent-dialog-trigger.md +0 -103
- package/docs/components/consent-manager-provider.md +0 -425
- package/docs/hooks/use-consent-manager/overview.md +0 -420
- package/docs/hooks/use-translations.md +0 -118
- package/docs/styling/css-variables.md +0 -92
- package/docs/styling/overview.md +0 -460
- package/docs/styling/slots.md +0 -128
- package/docs/styling/tokens.md +0 -216
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Quickstart
|
|
3
3
|
description: Add consent management to your React app in under 5 minutes.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
variants:
|
|
5
|
+
- value: javascript
|
|
6
|
+
href: /docs/frameworks/javascript/quickstart
|
|
7
|
+
label: JavaScript
|
|
8
|
+
- value: react
|
|
9
|
+
href: /docs/frameworks/react/quickstart
|
|
10
|
+
label: React
|
|
11
|
+
- value: next
|
|
12
|
+
href: /docs/frameworks/next/quickstart
|
|
13
|
+
label: Next.js
|
|
14
|
+
group: frameworks
|
|
15
15
|
---
|
|
16
16
|
## Via CLI
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|:--|:--|
|
|
20
|
-
|npm|`npx @c15t/cli`|
|
|
21
|
-
|pnpm|`pnpm dlx @c15t/cli`|
|
|
22
|
-
|yarn|`yarn dlx @c15t/cli`|
|
|
23
|
-
|bun|`bunx @c15t/cli`|
|
|
18
|
+
<PackageCommandTabs command="@c15t/cli" />
|
|
24
19
|
|
|
25
20
|
## Manual Installation
|
|
26
21
|
|
|
27
22
|
1. **Install package**
|
|
28
23
|
|
|
29
|
-
|Package manager|Command|
|
|
30
|
-
|:--|:--|
|
|
31
|
-
|npm|`npm install @c15t/react`|
|
|
32
|
-
|pnpm|`pnpm add @c15t/react`|
|
|
33
|
-
|yarn|`yarn add @c15t/react`|
|
|
34
|
-
|bun|`bun add @c15t/react`|
|
|
35
|
-
|
|
36
24
|
2. **Import styles** Import the prebuilt component stylesheet in your app-level CSS entrypoint. This is required for styled components to render correctly.
|
|
37
25
|
|
|
38
26
|
```css
|
|
@@ -42,7 +30,6 @@ availableIn:
|
|
|
42
30
|
Keeping the c15t stylesheet in your global CSS entrypoint makes layer and cascade order explicit. JS/TSX side-effect imports can load in a different order across framework and Tailwind tooling, which makes style regressions harder to debug.With Tailwind v4, keep c15t at the end of the top-level @import block so Fumadocs, tw-animate-css, and other preset imports do not override c15t theme tokens.
|
|
43
31
|
|
|
44
32
|
> ℹ️ Info:
|
|
45
|
-
>
|
|
46
33
|
> If you are using the headless API or fully custom styling, you can skip this import. src/main.tsx should keep importing ./index.css as usual.
|
|
47
34
|
|
|
48
35
|
3. **Create ConsentManager components** Create a provider component with the consent UI and a wrapper that re-exports it. This initializes the consent store and makes consent state available to all child components.
|
|
@@ -82,14 +69,12 @@ availableIn:
|
|
|
82
69
|
```
|
|
83
70
|
|
|
84
71
|
> ℹ️ Info:
|
|
85
|
-
>
|
|
86
72
|
> Hosted mode is the recommended production setup because the backend resolves jurisdiction and policy, keeps durable consent records, and lets c15t recover from temporary network failures by re-syncing later.
|
|
87
73
|
>
|
|
88
|
-
>
|
|
89
|
-
>
|
|
74
|
+
> ⚠️ Warning:
|
|
90
75
|
> Don't have a backend yet? You can use mode: 'offline' for local-only consent storage, but it gives up backend audit history, server-side consent awareness, and automatic jurisdiction detection. Review the browser-only storage consequences before choosing it for production.
|
|
91
76
|
|
|
92
|
-
4. **Mount ConsentManager at the app root** Wrap your existing app tree with ConsentManager so all routes/components can access consent state.
|
|
77
|
+
4. **Mount ConsentManager at the app root** Wrap your existing app tree with `ConsentManager` so all routes/components can access consent state.
|
|
93
78
|
|
|
94
79
|
```tsx
|
|
95
80
|
import { ConsentManager } from './components/consent-manager';
|
|
@@ -105,7 +90,9 @@ availableIn:
|
|
|
105
90
|
|
|
106
91
|
5. **Verify it works** Start your development server and confirm:
|
|
107
92
|
|
|
108
|
-
A consent banner appears at the bottom of the
|
|
93
|
+
1. A **consent banner** appears at the bottom of the page
|
|
94
|
+
2. Clicking **"Customize"** opens a dialog with toggles for each consent category
|
|
95
|
+
3. After accepting or rejecting, the banner dismisses and your choice persists across page reloads
|
|
109
96
|
|
|
110
97
|
> ℹ️ **Info:**
|
|
111
98
|
> Want to improve startup performance? See Optimization for the decision guide, prefetch setup, and network tuning.
|
|
@@ -114,12 +101,7 @@ availableIn:
|
|
|
114
101
|
|
|
115
102
|
Install DevTools only if you want a runtime inspector while building and debugging:
|
|
116
103
|
|
|
117
|
-
|
|
118
|
-
|:--|:--|
|
|
119
|
-
|npm|`npm install @c15t/dev-tools`|
|
|
120
|
-
|pnpm|`pnpm add @c15t/dev-tools`|
|
|
121
|
-
|yarn|`yarn add @c15t/dev-tools`|
|
|
122
|
-
|bun|`bun add @c15t/dev-tools`|
|
|
104
|
+
<PackageCommandTabs mode="install" command="@c15t/dev-tools" />
|
|
123
105
|
|
|
124
106
|
Then add it inside your existing provider:
|
|
125
107
|
|
|
@@ -143,13 +125,15 @@ import { DevTools } from '@c15t/dev-tools/react';
|
|
|
143
125
|
|
|
144
126
|
Install c15t agent skills to let AI agents help with styling, i18n, scripts & other configuration.
|
|
145
127
|
|
|
146
|
-
|
|
147
|
-
|:--|:--|
|
|
148
|
-
|npm|`npx @c15t/cli skills`|
|
|
149
|
-
|pnpm|`pnpm dlx @c15t/cli skills`|
|
|
150
|
-
|yarn|`yarn dlx @c15t/cli skills`|
|
|
151
|
-
|bun|`bunx @c15t/cli skills`|
|
|
128
|
+
<PackageCommandTabs command="@c15t/cli skills" />
|
|
152
129
|
|
|
153
130
|
See [AI Agents](/docs/ai-agents) for bundled package docs and agent skills.
|
|
154
131
|
|
|
155
132
|
## Next steps
|
|
133
|
+
|
|
134
|
+
* [Optimization](/docs/frameworks/react/optimization)
|
|
135
|
+
* [Script Loader](/docs/frameworks/react/script-loader)
|
|
136
|
+
* [Styling](/docs/frameworks/react/styling/overview)
|
|
137
|
+
* [Consent Categories](/docs/frameworks/react/concepts/consent-categories)
|
|
138
|
+
* [Components](/docs/frameworks/react/components/consent-banner)
|
|
139
|
+
* [AI Agents](/docs/ai-agents)
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Script Loader
|
|
3
|
-
description: Gate third-party scripts behind consent in React — load Google
|
|
3
|
+
description: Gate third-party scripts behind consent in React — load Google
|
|
4
|
+
Analytics, Meta Pixel, and other tracking scripts only when users grant
|
|
5
|
+
permission.
|
|
6
|
+
group: frameworks
|
|
4
7
|
---
|
|
5
8
|
The script loader manages third-party JavaScript based on consent state. You declare scripts in your provider's `scripts` option, and c15t decides when each script should load, stay loaded, unload, or receive a consent update.
|
|
6
9
|
|
|
7
10
|
Use it for analytics, pixels, tag managers, product analytics, and other vendor snippets that should not run until the right consent condition is satisfied. Prebuilt helpers live in [`@c15t/scripts`](/docs/integrations/overview); custom scripts can be declared directly when the vendor is specific to your app.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|:--|:--|
|
|
11
|
-
|npm|`npm install @c15t/scripts`|
|
|
12
|
-
|pnpm|`pnpm add @c15t/scripts`|
|
|
13
|
-
|yarn|`yarn add @c15t/scripts`|
|
|
14
|
-
|bun|`bun add @c15t/scripts`|
|
|
12
|
+
<PackageCommandTabs mode="install" command="@c15t/scripts" />
|
|
15
13
|
|
|
16
14
|
> ℹ️ **Info:**
|
|
17
15
|
> Start with the integrations overview before writing your own script. Built-in helpers encode vendor boot order, consent updates, and common defaults so you do not have to.
|
|
18
16
|
>
|
|
19
|
-
>
|
|
17
|
+
> 📝 **Note:**
|
|
20
18
|
> If you need a vendor c15t does not ship yet, see the custom integration guide. It explains when a one-off Script is enough and when to build a reusable manifest-backed helper.
|
|
21
19
|
>
|
|
22
20
|
> ℹ️ **Info:**
|
|
@@ -184,6 +182,8 @@ Some vendors are not just script tags. YouTube embeds, maps, calendars, and chec
|
|
|
184
182
|
|
|
185
183
|
* For iframe-only embeds, gate the iframe `src` with the [iframe blocking](/docs/frameworks/react/iframe-blocking) pattern instead of loading a script just to hide an iframe.
|
|
186
184
|
* For SDK-backed UI, use the script loader for the shared SDK and render the component only when consent and SDK readiness agree.
|
|
185
|
+
* Use `YouTubeEmbed` for the iframe-only YouTube candidate and `GoogleMap` for the callback-based SDK candidate.
|
|
186
|
+
* Use `useConsentScript()` when building custom wrappers. It registers scripts through the consent store, follows `loadedScripts`, and returns a promise-shaped readiness contract for callback-based SDKs.
|
|
187
187
|
|
|
188
188
|
## Lifecycle Callbacks
|
|
189
189
|
|
|
@@ -418,91 +418,136 @@ export function TenantAnalytics({ siteId }: { siteId: string }) {
|
|
|
418
418
|
|
|
419
419
|
Some vendors need a render surface as well as a script — maps, video players, calendars, and checkout widgets all fall in this bucket.
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
Use the built-in [Google Maps](/docs/integrations/google-maps) and
|
|
422
|
+
[YouTube](/docs/integrations/youtube) renderable helpers when they fit:
|
|
423
|
+
|
|
424
|
+
```tsx
|
|
425
|
+
import { GoogleMap, YouTubeEmbed } from '@c15t/react';
|
|
426
|
+
|
|
427
|
+
function Page() {
|
|
428
|
+
const googleMapsApiKey = import.meta.env.VITE_GOOGLE_MAPS_API_KEY;
|
|
429
|
+
|
|
430
|
+
return (
|
|
431
|
+
<>
|
|
432
|
+
{googleMapsApiKey && (
|
|
433
|
+
<GoogleMap
|
|
434
|
+
apiKey={googleMapsApiKey}
|
|
435
|
+
authReferrerPolicy="origin"
|
|
436
|
+
center={{ lat: 40.7128, lng: -74.006 }}
|
|
437
|
+
className="overflow-hidden rounded-xl"
|
|
438
|
+
consentCategory="measurement"
|
|
439
|
+
mapId="YOUR_MAP_ID"
|
|
440
|
+
zoom={12}
|
|
441
|
+
/>
|
|
442
|
+
)}
|
|
443
|
+
|
|
444
|
+
<YouTubeEmbed
|
|
445
|
+
consentCategory="marketing"
|
|
446
|
+
params={{ controls: true, playsinline: true }}
|
|
447
|
+
title="Product demo"
|
|
448
|
+
videoId="dQw4w9WgXcQ"
|
|
449
|
+
/>
|
|
450
|
+
</>
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
The design splits the problem into three layers:
|
|
422
456
|
|
|
423
457
|
1. Use the script loader to gate and load the shared SDK once.
|
|
424
|
-
2. Use
|
|
458
|
+
2. Use `useConsentScript()` for SDK readiness when a vendor uses a callback-style loader.
|
|
425
459
|
3. Create the widget instance only after the SDK is ready and clean it up on unmount.
|
|
426
460
|
|
|
427
|
-
|
|
461
|
+
Google Maps is SDK-backed, so `GoogleMap` registers one shared Google Maps script through the c15t script manager and waits for the callback-shaped SDK readiness signal before creating each map instance. It uses the official Google Maps types and accepts the direct-loader options `libraries`, `language`, `region`, `version`, `authReferrerPolicy`, `mapIds`, `channel`, and `solutionChannel`.
|
|
462
|
+
|
|
463
|
+
YouTube is iframe-only, so `YouTubeEmbed` builds on the existing `Frame` consent boundary instead of loading the YouTube iframe API. That keeps iframe media separate from SDK widgets and avoids a second source of truth for script readiness.
|
|
464
|
+
|
|
465
|
+
`GoogleMap` has a default height of `320px`; override `style.height` or supply a class that sets an inline-compatible height when your layout needs another size. `mapId` is construction-time configuration in the Google Maps API, so changing it recreates the map. Other controlled values such as `center`, `zoom`, and updateable `options` are applied to the existing instance.
|
|
466
|
+
|
|
467
|
+
The Maps JavaScript API is a page singleton. Before consent, c15t makes no Maps script request. After the first approved load, the SDK registration is retained for the consent-manager lifetime to avoid Google's duplicate-loader warning; map instances are still destroyed as soon as the component unmounts or consent becomes unavailable. All `GoogleMap` instances that share a `scriptId` must therefore use the same loader options. If another part of the application already loaded Maps, the component adopts that global API without injecting a second script.
|
|
468
|
+
|
|
469
|
+
`GoogleMap` reports network, timeout, constructor, and Google's global authentication failures through `onError` and `errorFallback`. Authentication errors commonly mean the browser key, billing, or allowed referrers need attention.
|
|
470
|
+
|
|
471
|
+
`YouTubeEmbed` defaults to a responsive, borderless 16:9 frame with stable
|
|
472
|
+
placeholder dimensions, a localized loading state, native lazy loading, and
|
|
473
|
+
the privacy-enhanced `youtube-nocookie.com` host. For overrides, `className` and
|
|
474
|
+
the forwarded ref target the iframe while `wrapperClassName` and `frameProps`
|
|
475
|
+
target the consent-gated `Frame`. Boolean values in `params` are serialized as
|
|
476
|
+
YouTube's documented `1` and `0` values.
|
|
477
|
+
|
|
478
|
+
For custom SDK-backed widgets, call `useConsentScript()` with a c15t `Script`
|
|
479
|
+
object. The hook uses the consent manager as the source of truth, shares
|
|
480
|
+
compatible registrations inside that provider, and exposes status, consent,
|
|
481
|
+
the ready SDK value, errors, and a promise:
|
|
482
|
+
|
|
483
|
+
```tsx
|
|
484
|
+
import { useState } from 'react';
|
|
485
|
+
import { useConsentScript } from '@c15t/react';
|
|
486
|
+
|
|
487
|
+
export function VendorWidget() {
|
|
488
|
+
const [retryKey, setRetryKey] = useState(0);
|
|
489
|
+
const vendor = useConsentScript({
|
|
490
|
+
script: {
|
|
491
|
+
id: 'vendor-sdk',
|
|
492
|
+
src: 'https://cdn.example.com/sdk.js',
|
|
493
|
+
category: 'measurement',
|
|
494
|
+
},
|
|
495
|
+
resolveReady: () => window.vendorSdk ?? false,
|
|
496
|
+
registerReadyCallback: ({ resolve }) => {
|
|
497
|
+
window.onVendorReady = () => resolve(window.vendorSdk);
|
|
498
|
+
|
|
499
|
+
return () => {
|
|
500
|
+
delete window.onVendorReady;
|
|
501
|
+
};
|
|
502
|
+
},
|
|
503
|
+
readinessKey: 'vendor-sdk-v1',
|
|
504
|
+
retryKey,
|
|
505
|
+
timeoutMs: 10_000,
|
|
506
|
+
unmountBehavior: 'keep',
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
if (vendor.status === 'blocked') {
|
|
510
|
+
return <p>Enable Analytics consent to use this widget.</p>;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (vendor.status === 'loading') {
|
|
514
|
+
return <p role="status">Loading widget…</p>;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if (vendor.status === 'error') {
|
|
518
|
+
return (
|
|
519
|
+
<div role="alert">
|
|
520
|
+
<p>The widget could not be loaded.</p>
|
|
521
|
+
<button type="button" onClick={() => setRetryKey((key) => key + 1)}>
|
|
522
|
+
Retry
|
|
523
|
+
</button>
|
|
524
|
+
</div>
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
if (vendor.status !== 'ready' || !vendor.readyValue) {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
return <div ref={(node) => node && vendor.readyValue.mount(node)} />;
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
Inline script objects and lifecycle callbacks are safe. The hook compares the complete non-function script configuration, reads callbacks from the latest render, adopts a compatible script already owned by the provider, and never removes a registration it did not create. Use `unmountBehavior: 'remove'` (the default) for route-local scripts, or `'keep'` for a genuine page-level singleton.
|
|
537
|
+
|
|
538
|
+
Change `retryKey` after a failed attempt to retry the same registration.
|
|
539
|
+
Consumers sharing a script id must use identical script options,
|
|
540
|
+
`readinessKey`, timeout, and unmount behavior. Conflicts throw
|
|
541
|
+
`ConsentScriptConflictError`; choose another id only when the vendor genuinely
|
|
542
|
+
supports multiple page-level loaders.
|
|
543
|
+
|
|
544
|
+
For iframe-only embeds, use the [iframe blocking](/docs/frameworks/react/iframe-blocking) pattern or `YouTubeEmbed` instead of loading a JavaScript SDK to hide an iframe. For SDK-backed widgets, treat the SDK as a singleton and each rendered component as its own instance.
|
|
428
545
|
|
|
429
546
|
## API Reference
|
|
430
547
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
|
|
438
|
-
|category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
|
|
439
|
-
|callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
|
|
440
|
-
|persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
|
|
441
|
-
|alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
|
|
442
|
-
|fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
|
|
443
|
-
|attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
|
|
444
|
-
|async|boolean \|undefined|Whether to use async loading|-|Optional|
|
|
445
|
-
|defer|boolean \|undefined|Whether to defer script loading|-|Optional|
|
|
446
|
-
|nonce|string \|undefined|Content Security Policy nonce|-|Optional|
|
|
447
|
-
|anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
|
|
448
|
-
|target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
|
|
449
|
-
|onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
|
|
450
|
-
|onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
|
|
451
|
-
|onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
|
|
452
|
-
|onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
|
|
453
|
-
|vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
|
|
454
|
-
|iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
|
|
455
|
-
|iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
|
|
456
|
-
|iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
|
|
457
|
-
|
|
458
|
-
#### `onBeforeLoad`
|
|
459
|
-
|
|
460
|
-
Callback executed before the script is loaded
|
|
461
|
-
|
|
462
|
-
|Property|Type|Description|Default|Required|
|
|
463
|
-
|:--|:--|:--|:--|:--:|
|
|
464
|
-
|id|string|The original script ID|-|✅ Required|
|
|
465
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
466
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
467
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
468
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
469
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
470
|
-
|
|
471
|
-
#### `onLoad`
|
|
472
|
-
|
|
473
|
-
Callback executed when the script loads successfully
|
|
474
|
-
|
|
475
|
-
|Property|Type|Description|Default|Required|
|
|
476
|
-
|:--|:--|:--|:--|:--:|
|
|
477
|
-
|id|string|The original script ID|-|✅ Required|
|
|
478
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
479
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
480
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
481
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
482
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
483
|
-
|
|
484
|
-
#### `onError`
|
|
485
|
-
|
|
486
|
-
Callback executed if the script fails to load
|
|
487
|
-
|
|
488
|
-
|Property|Type|Description|Default|Required|
|
|
489
|
-
|:--|:--|:--|:--|:--:|
|
|
490
|
-
|id|string|The original script ID|-|✅ Required|
|
|
491
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
492
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
493
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
494
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
495
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
496
|
-
|
|
497
|
-
#### `onConsentChange`
|
|
498
|
-
|
|
499
|
-
Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
|
|
500
|
-
|
|
501
|
-
|Property|Type|Description|Default|Required|
|
|
502
|
-
|:--|:--|:--|:--|:--:|
|
|
503
|
-
|id|string|The original script ID|-|✅ Required|
|
|
504
|
-
|elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
|
|
505
|
-
|hasConsent|boolean|Has consent|-|✅ Required|
|
|
506
|
-
|consents|ConsentState|The current consent state|-|✅ Required|
|
|
507
|
-
|element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
|
|
508
|
-
|error|Error \|undefined|Error information (for error callbacks)|-|Optional|
|
|
548
|
+
|Property|Value|
|
|
549
|
+
|:--|:--|
|
|
550
|
+
|Type Name|\`Script\`|
|
|
551
|
+
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
|
|
552
|
+
|
|
553
|
+
\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Server-Side Utilities
|
|
3
|
-
description: Fetch consent data on the server for SSR hydration — eliminate the
|
|
3
|
+
description: Fetch consent data on the server for SSR hydration — eliminate the
|
|
4
|
+
loading flash and improve performance.
|
|
5
|
+
group: frameworks
|
|
4
6
|
---
|
|
5
7
|
The `@c15t/react/server` module provides utilities for fetching consent data on the server before rendering. This enables SSR hydration — consent state is available immediately on page load without a client-side fetch, eliminating the consent banner flash.
|
|
6
8
|
|
|
@@ -36,9 +38,12 @@ const ssrData = await fetchSSRData({
|
|
|
36
38
|
|
|
37
39
|
### Options
|
|
38
40
|
|
|
39
|
-
|Property|
|
|
40
|
-
|
|
41
|
-
|
|
|
41
|
+
|Property|Value|
|
|
42
|
+
|:--|:--|
|
|
43
|
+
|Type Name|\`FetchSSRDataOptions\`|
|
|
44
|
+
|Source Path|\`./packages/react/src/server/types.ts\`|
|
|
45
|
+
|
|
46
|
+
\*ExtractedTypeTable: Could not extract "FetchSSRDataOptions" from "./packages/react/src/server/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
42
47
|
|
|
43
48
|
### Return Value
|
|
44
49
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Class Names
|
|
3
|
-
description: Style consent components using className props and per-slot
|
|
3
|
+
description: Style consent components using className props and per-slot
|
|
4
|
+
className targeting via the theme.
|
|
5
|
+
group: frameworks
|
|
4
6
|
---
|
|
5
7
|
## Prefer Slots for Stock Components
|
|
6
8
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Color Scheme
|
|
3
|
-
description: Support light mode, dark mode, and system preference detection in
|
|
3
|
+
description: Support light mode, dark mode, and system preference detection in
|
|
4
|
+
consent components.
|
|
5
|
+
group: frameworks
|
|
4
6
|
---
|
|
5
7
|
c15t supports light and dark mode through the theme's `colors` and `dark` token groups. The active color scheme is determined by one of three methods:
|
|
6
8
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CSS Variables
|
|
3
|
+
description: Reference for all --c15t-* CSS custom properties generated by the theme system.
|
|
4
|
+
group: frameworks
|
|
5
|
+
---
|
|
6
|
+
Every theme token is converted to a `--c15t-*` CSS custom property at runtime. You can override these variables in your stylesheet without using the JavaScript theme API.
|
|
7
|
+
|
|
8
|
+
## Variable Reference
|
|
9
|
+
|
|
10
|
+
|Property|Value|
|
|
11
|
+
|:--|:--|
|
|
12
|
+
|Type Name|\`ThemeCSSVariables\`|
|
|
13
|
+
|Source Path|\`./packages/ui/src/theme/types.ts\`|
|
|
14
|
+
|
|
15
|
+
\*ExtractedTypeTable: Could not extract "ThemeCSSVariables" from "./packages/ui/src/theme/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
16
|
+
|
|
17
|
+
## Overriding Variables
|
|
18
|
+
|
|
19
|
+
Override in your stylesheet:
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
:root {
|
|
23
|
+
--c15t-primary: #8b5cf6;
|
|
24
|
+
--c15t-surface: #fafafa;
|
|
25
|
+
--c15t-radius-md: 1rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Dark mode overrides */
|
|
29
|
+
.dark,
|
|
30
|
+
.c15t-dark {
|
|
31
|
+
--c15t-primary: #a78bfa;
|
|
32
|
+
--c15t-surface: #18181b;
|
|
33
|
+
--c15t-text: #fafafa;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Scoped Overrides
|
|
38
|
+
|
|
39
|
+
Target specific components by scoping variables:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<div className="checkout-consent">
|
|
43
|
+
<ConsentBanner />
|
|
44
|
+
</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```css
|
|
48
|
+
/* Only affect c15t components inside .checkout-consent */
|
|
49
|
+
.checkout-consent {
|
|
50
|
+
--c15t-surface: #f0f9ff;
|
|
51
|
+
--c15t-radius-lg: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
```
|