@c15t/nextjs 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/AGENTS.md +155 -0
  2. package/README.md +31 -15
  3. package/client/components/integrations.js +3 -0
  4. package/dist/components/integrations/index.cjs +1 -0
  5. package/dist/components/integrations/index.js +1 -0
  6. package/dist/headless.cjs +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/libs/browser-initial-data.cjs +1 -1
  9. package/dist/libs/initial-data.cjs +1 -1
  10. package/dist/styles.tw3.css +1 -1
  11. package/dist/version.cjs +1 -1
  12. package/dist/version.js +1 -1
  13. package/dist-types/components/integrations/index.d.ts +1 -0
  14. package/dist-types/libs/browser-initial-data.d.ts +1 -1
  15. package/dist-types/version.d.ts +1 -1
  16. package/docs/README.md +155 -73
  17. package/docs/{building-headless-components.md → frameworks/next/building-headless-components.md} +3 -1
  18. package/docs/{callbacks.md → frameworks/next/callbacks.md} +3 -1
  19. package/docs/{components → frameworks/next/components}/consent-banner.md +10 -21
  20. package/docs/{components → frameworks/next/components}/consent-dialog-link.md +8 -5
  21. package/docs/frameworks/next/components/consent-dialog-trigger.md +202 -0
  22. package/docs/{components → frameworks/next/components}/consent-dialog.md +7 -15
  23. package/docs/frameworks/next/components/consent-manager-provider.md +327 -0
  24. package/docs/{components → frameworks/next/components}/consent-widget.md +8 -6
  25. package/docs/{components → frameworks/next/components}/dev-tools.md +9 -6
  26. package/docs/{components → frameworks/next/components}/frame.md +8 -9
  27. package/docs/{concepts → frameworks/next/concepts}/client-modes.md +4 -2
  28. package/docs/{concepts → frameworks/next/concepts}/consent-categories.md +1 -0
  29. package/docs/{concepts → frameworks/next/concepts}/consent-models.md +1 -0
  30. package/docs/{concepts → frameworks/next/concepts}/cookie-management.md +3 -3
  31. package/docs/{concepts → frameworks/next/concepts}/glossary.md +1 -0
  32. package/docs/{concepts → frameworks/next/concepts}/initialization-flow.md +1 -0
  33. package/docs/{concepts → frameworks/next/concepts}/policy-packs.md +1 -0
  34. package/docs/{headless.md → frameworks/next/headless.md} +3 -1
  35. package/docs/{hooks → frameworks/next/hooks}/use-color-scheme.md +1 -0
  36. package/docs/{hooks → frameworks/next/hooks}/use-consent-manager/checking-consent.md +3 -1
  37. package/docs/{hooks → frameworks/next/hooks}/use-consent-manager/location-info.md +3 -1
  38. package/docs/frameworks/next/hooks/use-consent-manager/overview.md +185 -0
  39. package/docs/{hooks → frameworks/next/hooks}/use-consent-manager/setting-consent.md +3 -1
  40. package/docs/{hooks → frameworks/next/hooks}/use-draggable.md +3 -1
  41. package/docs/{hooks → frameworks/next/hooks}/use-focus-trap.md +1 -0
  42. package/docs/{hooks → frameworks/next/hooks}/use-reduced-motion.md +3 -1
  43. package/docs/{hooks → frameworks/next/hooks}/use-ssr-status.md +6 -5
  44. package/docs/{hooks → frameworks/next/hooks}/use-text-direction.md +1 -0
  45. package/docs/frameworks/next/hooks/use-translations.md +55 -0
  46. package/docs/{iab → frameworks/next/iab}/consent-banner.md +9 -12
  47. package/docs/{iab → frameworks/next/iab}/consent-dialog.md +9 -14
  48. package/docs/{iab → frameworks/next/iab}/overview.md +4 -2
  49. package/docs/{iab → frameworks/next/iab}/use-gvl-data.md +3 -2
  50. package/docs/{iframe-blocking.md → frameworks/next/iframe-blocking.md} +8 -9
  51. package/docs/{internationalization.md → frameworks/next/internationalization.md} +13 -3
  52. package/docs/{network-blocker.md → frameworks/next/network-blocker.md} +13 -51
  53. package/docs/{optimization.md → frameworks/next/optimization.md} +5 -4
  54. package/docs/{policy-packs.md → frameworks/next/policy-packs.md} +3 -1
  55. package/docs/{quickstart.md → frameworks/next/quickstart.md} +26 -42
  56. package/docs/{script-loader.md → frameworks/next/script-loader.md} +72 -90
  57. package/docs/{server-side.md → frameworks/next/server-side.md} +12 -15
  58. package/docs/{styling → frameworks/next/styling}/classnames.md +3 -1
  59. package/docs/{styling → frameworks/next/styling}/color-scheme.md +3 -1
  60. package/docs/frameworks/next/styling/css-variables.md +53 -0
  61. package/docs/frameworks/next/styling/overview.md +299 -0
  62. package/docs/frameworks/next/styling/slots.md +94 -0
  63. package/docs/{styling → frameworks/next/styling}/tailwind.md +3 -1
  64. package/docs/frameworks/next/styling/tokens.md +156 -0
  65. package/docs/{troubleshooting.md → frameworks/next/troubleshooting.md} +3 -1
  66. package/docs/integrations/adobe-analytics.md +160 -0
  67. package/docs/integrations/ahrefs-analytics.md +15 -82
  68. package/docs/integrations/amplitude.md +230 -0
  69. package/docs/integrations/building-integrations.md +15 -181
  70. package/docs/integrations/clearbit.md +130 -0
  71. package/docs/integrations/cloudflare-web-analytics.md +15 -83
  72. package/docs/integrations/crisp.md +13 -87
  73. package/docs/integrations/databuddy.md +16 -85
  74. package/docs/integrations/fathom-analytics.md +15 -86
  75. package/docs/integrations/google-maps.md +263 -0
  76. package/docs/integrations/google-tag-manager.md +18 -86
  77. package/docs/integrations/google-tag.md +15 -84
  78. package/docs/integrations/heap.md +219 -0
  79. package/docs/integrations/hightouch.md +199 -0
  80. package/docs/integrations/hotjar.md +15 -83
  81. package/docs/integrations/intercom.md +13 -83
  82. package/docs/integrations/linkedin-insights.md +15 -82
  83. package/docs/integrations/logrocket.md +175 -0
  84. package/docs/integrations/matomo-analytics.md +13 -88
  85. package/docs/integrations/meta-pixel.md +33 -316
  86. package/docs/integrations/microsoft-clarity.md +15 -83
  87. package/docs/integrations/microsoft-uet.md +16 -83
  88. package/docs/integrations/mixpanel-analytics.md +15 -83
  89. package/docs/integrations/overview.md +55 -6
  90. package/docs/integrations/pirsch.md +142 -0
  91. package/docs/integrations/plausible-analytics.md +14 -97
  92. package/docs/integrations/posthog.md +26 -98
  93. package/docs/integrations/promptwatch.md +16 -82
  94. package/docs/integrations/reddit-pixel.md +27 -122
  95. package/docs/integrations/rudderstack.md +271 -0
  96. package/docs/integrations/rybbit-analytics.md +15 -94
  97. package/docs/integrations/segment.md +15 -82
  98. package/docs/integrations/snapchat-pixel.md +21 -102
  99. package/docs/integrations/tiktok-pixel.md +13 -81
  100. package/docs/integrations/umami-analytics.md +16 -88
  101. package/docs/integrations/vercel-analytics.md +13 -85
  102. package/docs/integrations/x-pixel.md +27 -102
  103. package/docs/integrations/youtube.md +193 -0
  104. package/docs/shared/concepts/client-modes.md +103 -0
  105. package/docs/shared/concepts/consent-categories.md +41 -0
  106. package/docs/shared/concepts/consent-models.md +72 -0
  107. package/docs/shared/concepts/cookie-management.md +88 -0
  108. package/docs/shared/concepts/glossary.md +24 -0
  109. package/docs/shared/concepts/initialization-flow.md +105 -0
  110. package/docs/shared/concepts/policy-packs.md +225 -0
  111. package/docs/shared/react/components/consent-banner.md +242 -0
  112. package/docs/shared/react/components/consent-dialog-link.md +45 -0
  113. package/docs/shared/react/components/consent-dialog-trigger.md +185 -0
  114. package/docs/shared/react/components/consent-dialog.md +119 -0
  115. package/docs/shared/react/components/consent-manager-provider.md +225 -0
  116. package/docs/shared/react/components/consent-widget.md +121 -0
  117. package/docs/shared/react/components/dev-tools.md +81 -0
  118. package/docs/shared/react/components/frame.md +52 -0
  119. package/docs/shared/react/guides/building-headless-components.md +110 -0
  120. package/docs/shared/react/guides/callbacks.md +89 -0
  121. package/docs/shared/react/guides/headless.md +31 -0
  122. package/docs/shared/react/guides/iframe-blocking.md +65 -0
  123. package/docs/shared/react/guides/internationalization.md +123 -0
  124. package/docs/shared/react/guides/network-blocker.md +72 -0
  125. package/docs/shared/react/guides/optimization.md +44 -0
  126. package/docs/shared/react/guides/policy-packs.md +173 -0
  127. package/docs/shared/react/guides/script-loader.md +311 -0
  128. package/docs/shared/react/hooks/use-color-scheme.md +31 -0
  129. package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +95 -0
  130. package/docs/shared/react/hooks/use-consent-manager/location-info.md +96 -0
  131. package/docs/shared/react/hooks/use-consent-manager/overview.md +74 -0
  132. package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +93 -0
  133. package/docs/shared/react/hooks/use-draggable.md +30 -0
  134. package/docs/shared/react/hooks/use-focus-trap.md +20 -0
  135. package/docs/shared/react/hooks/use-reduced-motion.md +33 -0
  136. package/docs/shared/react/hooks/use-ssr-status.md +16 -0
  137. package/docs/shared/react/hooks/use-text-direction.md +38 -0
  138. package/docs/shared/react/hooks/use-translations.md +15 -0
  139. package/docs/shared/react/iab/consent-banner.md +60 -0
  140. package/docs/shared/react/iab/consent-dialog.md +76 -0
  141. package/docs/shared/react/iab/overview.md +80 -0
  142. package/docs/shared/react/iab/use-gvl-data.md +21 -0
  143. package/docs/shared/react/styling/classnames.md +93 -0
  144. package/docs/shared/react/styling/color-scheme.md +35 -0
  145. package/docs/shared/react/styling/css-variables.md +53 -0
  146. package/docs/shared/react/styling/overview.md +261 -0
  147. package/docs/shared/react/styling/slots.md +93 -0
  148. package/docs/shared/react/styling/stylesheet-entrypoint.md +8 -0
  149. package/docs/shared/react/styling/tailwind.md +88 -0
  150. package/docs/shared/react/styling/tokens.md +155 -0
  151. package/docs/shared/troubleshooting.md +82 -0
  152. package/package.json +19 -10
  153. package/readme.json +14 -8
  154. package/docs/ai-agents.md +0 -111
  155. package/docs/components/consent-dialog-trigger.md +0 -103
  156. package/docs/components/consent-manager-provider.md +0 -425
  157. package/docs/hooks/use-consent-manager/overview.md +0 -420
  158. package/docs/hooks/use-translations.md +0 -118
  159. package/docs/styling/css-variables.md +0 -92
  160. package/docs/styling/overview.md +0 -457
  161. package/docs/styling/slots.md +0 -128
  162. package/docs/styling/tokens.md +0 -216
@@ -0,0 +1,155 @@
1
+ ---
2
+ title: Tokens
3
+ description: Reference page for tokens.
4
+ group: reference
5
+ ---
6
+ ## Color Tokens
7
+
8
+ Color tokens define the palette for all consent components. Set `colors` for light mode and `dark` for dark mode overrides.
9
+
10
+ When `textOnPrimary` is omitted, c15t derives it automatically from `primary` to keep text readable on primary-filled surfaces such as stock branding tags and buttons. Set `textOnPrimary` explicitly when you need a specific foreground color.
11
+
12
+ ```tsx
13
+ const theme = {
14
+ colors: {
15
+ primary: '#6366f1',
16
+ primaryHover: '#4f46e5',
17
+ surface: '#ffffff',
18
+ surfaceHover: '#f9fafb',
19
+ border: '#e5e7eb',
20
+ borderHover: '#d1d5db',
21
+ text: '#1f2937',
22
+ textMuted: '#6b7280',
23
+ textOnPrimary: '#ffffff',
24
+ overlay: 'rgba(0, 0, 0, 0.5)',
25
+ switchTrack: '#d1d5db',
26
+ switchTrackActive: '#6366f1',
27
+ switchThumb: '#ffffff',
28
+ },
29
+ dark: {
30
+ primary: '#818cf8',
31
+ surface: '#1f2937',
32
+ text: '#f9fafb',
33
+ textMuted: '#9ca3af',
34
+ border: '#374151',
35
+ },
36
+ } satisfies Theme;
37
+ ```
38
+
39
+ |Property|Value|
40
+ |:--|:--|
41
+ |Type Name|\`ColorTokens\`|
42
+ |Source Path|\`./packages/ui/src/theme/types.ts\`|
43
+
44
+ \*ExtractedTypeTable: Could not extract "ColorTokens" 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.\*
45
+
46
+ ## Typography Tokens
47
+
48
+ Control font family, sizes, weights, and line heights.
49
+
50
+ ```tsx
51
+ const theme = {
52
+ typography: {
53
+ fontFamily: 'Inter, system-ui, sans-serif',
54
+ fontSize: { sm: '0.875rem', base: '1rem', lg: '1.125rem' },
55
+ fontWeight: { normal: 400, medium: 500, semibold: 600 },
56
+ lineHeight: { tight: '1.25', normal: '1.5', relaxed: '1.75' },
57
+ },
58
+ } satisfies Theme;
59
+ ```
60
+
61
+ |Property|Value|
62
+ |:--|:--|
63
+ |Type Name|\`TypographyTokens\`|
64
+ |Source Path|\`./packages/ui/src/theme/types.ts\`|
65
+
66
+ \*ExtractedTypeTable: Could not extract "TypographyTokens" 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.\*
67
+
68
+ ## Spacing Tokens
69
+
70
+ Five-step scale for internal padding, margins, and gaps.
71
+
72
+ ```tsx
73
+ const theme = {
74
+ spacing: {
75
+ xs: '0.25rem', // 4px
76
+ sm: '0.5rem', // 8px
77
+ md: '1rem', // 16px
78
+ lg: '1.5rem', // 24px
79
+ xl: '2rem', // 32px
80
+ },
81
+ } satisfies Theme;
82
+ ```
83
+
84
+ |Property|Value|
85
+ |:--|:--|
86
+ |Type Name|\`SpacingTokens\`|
87
+ |Source Path|\`./packages/ui/src/theme/types.ts\`|
88
+
89
+ \*ExtractedTypeTable: Could not extract "SpacingTokens" 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.\*
90
+
91
+ ## Radius Tokens
92
+
93
+ Border radius scale for rounded corners.
94
+
95
+ ```tsx
96
+ const theme = {
97
+ radius: {
98
+ sm: '0.25rem', // 4px
99
+ md: '0.5rem', // 8px
100
+ lg: '0.75rem', // 12px
101
+ full: '9999px', // Pill shape
102
+ },
103
+ } satisfies Theme;
104
+ ```
105
+
106
+ |Property|Value|
107
+ |:--|:--|
108
+ |Type Name|\`RadiusTokens\`|
109
+ |Source Path|\`./packages/ui/src/theme/types.ts\`|
110
+
111
+ \*ExtractedTypeTable: Could not extract "RadiusTokens" 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.\*
112
+
113
+ ## Shadow Tokens
114
+
115
+ Box shadow scale for depth and elevation.
116
+
117
+ ```tsx
118
+ const theme = {
119
+ shadows: {
120
+ sm: '0 1px 2px hsla(0, 0%, 0%, 0.05)',
121
+ md: '0 4px 12px hsla(0, 0%, 0%, 0.08)',
122
+ lg: '0 8px 24px hsla(0, 0%, 0%, 0.12)',
123
+ },
124
+ } satisfies Theme;
125
+ ```
126
+
127
+ |Property|Value|
128
+ |:--|:--|
129
+ |Type Name|\`ShadowTokens\`|
130
+ |Source Path|\`./packages/ui/src/theme/types.ts\`|
131
+
132
+ \*ExtractedTypeTable: Could not extract "ShadowTokens" 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.\*
133
+
134
+ ## Motion Tokens
135
+
136
+ Animation duration and easing presets.
137
+
138
+ ```tsx
139
+ const theme = {
140
+ motion: {
141
+ duration: { fast: '100ms', normal: '200ms', slow: '300ms' },
142
+ easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
143
+ easingOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',
144
+ easingInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',
145
+ easingSpring: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
146
+ },
147
+ } satisfies Theme;
148
+ ```
149
+
150
+ |Property|Value|
151
+ |:--|:--|
152
+ |Type Name|\`MotionTokens\`|
153
+ |Source Path|\`./packages/ui/src/theme/types.ts\`|
154
+
155
+ \*ExtractedTypeTable: Could not extract "MotionTokens" 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.\*
@@ -0,0 +1,82 @@
1
+ ---
2
+ title: Troubleshooting
3
+ description: Reference page for troubleshooting.
4
+ group: reference
5
+ ---
6
+ ## "Provider not found" Error
7
+
8
+ **Symptom:** `useConsentManager must be used within a ConsentManagerProvider` error.
9
+
10
+ **Fix:** Ensure the component calling `useConsentManager()` (or any c15t hook) is rendered inside a `ConsentManagerProvider`:
11
+
12
+ ```tsx
13
+ // Wrong — hook is outside the provider
14
+ function App() {
15
+ const { consents } = useConsentManager(); // throws
16
+ return <ConsentManagerProvider options={...}>...</ConsentManagerProvider>;
17
+ }
18
+
19
+ // Correct — hook is inside the provider
20
+ function App() {
21
+ return (
22
+ <ConsentManagerProvider options={...}>
23
+ <MyComponent /> {/* useConsentManager works here */}
24
+ </ConsentManagerProvider>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Banner Doesn't Show
30
+
31
+ **Possible causes:**
32
+
33
+ 1. **Opt-out jurisdiction** — In CCPA/opt-out regions, the banner is not shown because tracking is allowed by default. Check `model` from `useConsentManager()` — if it's `'opt-out'`, the banner is intentionally hidden.
34
+
35
+ 2. **Consent already given** — If the user has already made a consent choice, the banner won't reappear. Clear cookies or use `resetConsents()` to test again.
36
+
37
+ 3. **`activeUI` is `'none'`** — Something is explicitly setting `activeUI` to `'none'`. Check the DevTools panel for the current consent state.
38
+
39
+ 4. **Backend not responding** — In `'c15t'` mode, the banner waits for the backend `/init` response. Check the Network tab for failed requests to your `backendURL`.
40
+
41
+ ```tsx
42
+ // Debug: check what the consent manager sees
43
+ const { activeUI, model, isLoadingConsentInfo } = useConsentManager();
44
+ console.log({ activeUI, model, isLoadingConsentInfo });
45
+ ```
46
+
47
+ ## Consent Not Persisting
48
+
49
+ **Symptom:** Consent is lost after page reload.
50
+
51
+ **Possible causes:**
52
+
53
+ 1. **Incognito/private mode** — Some browsers restrict cookie storage in private browsing.
54
+
55
+ 2. **Cookie settings** — In `'offline'` mode, consent is stored in cookies. Ensure cookies are not being blocked by browser settings or extensions.
56
+
57
+ 3. **Different domains** — Cookies are domain-scoped. If your dev server uses a different domain than production, consent won't carry over.
58
+
59
+ 4. **Backend errors** — In `'c15t'` mode, check that the backend is saving consent successfully. Enable `debug: true` in provider options to see detailed logs.
60
+
61
+ ## Scripts Not Loading
62
+
63
+ **Symptom:** Third-party scripts configured in the `scripts` option don't load after consent is granted.
64
+
65
+ **Checklist:**
66
+
67
+ 1. **Wrong category name** — The `category` on the script must match one of the `consentCategories` names. For example, `'measurement'` not `'analytics'`.
68
+
69
+ 2. **Consent condition not met** — Use `has('measurement')` to verify the category is actually consented.
70
+
71
+ 3. **Script error** — Check the browser DevTools Console for script loading errors. The `onError` callback can help debug:
72
+
73
+ ```tsx
74
+ {
75
+ id: 'analytics',
76
+ src: 'https://...',
77
+ category: 'measurement',
78
+ onError: ({ error }) => console.error('Script failed:', error),
79
+ }
80
+ ```
81
+
82
+ 4. **Ad blocker** — Browser extensions may block the script regardless of consent. The `anonymizeId` option (default: `true`) helps avoid pattern-based blocking.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@c15t/nextjs",
3
- "version": "2.1.0",
4
- "description": "Headless cookie banner, consent manager & preference center for Next.js. App Router & Pages Router, RSC, GDPR/CCPA/LGPD/TCF compliant.",
3
+ "version": "2.2.1",
4
+ "description": "Next.js cookie banner and consent management platform for App Router, Pages Router, SSR, IAB TCF, and Consent Mode.",
5
5
  "keywords": [
6
6
  "nextjs",
7
7
  "next",
@@ -31,7 +31,10 @@
31
31
  "rsc",
32
32
  "ssr",
33
33
  "server-side-rendering",
34
- "tracking-consent"
34
+ "tracking-consent",
35
+ "google-consent-mode",
36
+ "consent-mode-v2",
37
+ "nextjs-cmp"
35
38
  ],
36
39
  "homepage": "https://c15t.com/docs/frameworks/next/quickstart",
37
40
  "bugs": {
@@ -62,6 +65,11 @@
62
65
  "import": "./client/components/consent-dialog-link.js",
63
66
  "require": "./dist/index.cjs"
64
67
  },
68
+ "./components/integrations": {
69
+ "types": "./dist-types/components/integrations/index.d.ts",
70
+ "import": "./client/components/integrations.js",
71
+ "require": "./dist/components/integrations/index.cjs"
72
+ },
65
73
  ".": {
66
74
  "types": "./dist-types/index.d.ts",
67
75
  "import": "./dist/index.js",
@@ -73,8 +81,9 @@
73
81
  "types": "./dist-types/index.d.ts",
74
82
  "files": [
75
83
  "dist",
76
- "docs",
77
84
  "dist-types",
85
+ "AGENTS.md",
86
+ "docs",
78
87
  "client",
79
88
  "styles.css",
80
89
  "styles.tw3.css",
@@ -86,8 +95,8 @@
86
95
  ],
87
96
  "scripts": {
88
97
  "prebuild": "genversion --esm --semi src/version.ts",
89
- "build": "bun prebuild && rslib build && bun ../../scripts/normalize-dist-types.mjs && bun scripts/generate-distribution-css.ts && bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/nextjs",
90
- "build:agent-docs": "bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/nextjs",
98
+ "build": "bun prebuild && rslib build && bun ../../scripts/normalize-dist-types.mjs && bun scripts/generate-distribution-css.ts && bun ../../scripts/generate-package-docs.ts @c15t/nextjs",
99
+ "build:docs": "bun ../../scripts/generate-package-docs.ts @c15t/nextjs",
91
100
  "check-types": "bun prebuild && tsc --noEmit",
92
101
  "dev": "sh -c 'bun prebuild && rslib build --no-dts --no-clean && bun scripts/generate-distribution-css.ts && rslib build --watch --no-dts --no-clean'",
93
102
  "fmt": "bun biome format --write . && bun biome check --formatter-enabled=false --linter-enabled=false --write",
@@ -97,15 +106,15 @@
97
106
  "test:watch": "bun prebuild && vitest --passWithNoTests"
98
107
  },
99
108
  "dependencies": {
100
- "@c15t/react": "2.1.0",
101
- "@c15t/translations": "2.1.0",
102
- "c15t": "2.1.0"
109
+ "@c15t/react": "2.2.1",
110
+ "@c15t/translations": "2.2.1",
111
+ "c15t": "2.2.1"
103
112
  },
104
113
  "devDependencies": {
105
114
  "@c15t/typescript-config": "0.0.1",
106
115
  "@c15t/vitest-config": "1.0.0",
107
116
  "genversion": "3.2.0",
108
- "typescript": "6.0.2"
117
+ "typescript": "7.0.1-rc"
109
118
  },
110
119
  "peerDependencies": {
111
120
  "next": "^16.0.0 || ^15.0.0 || ^14.0.0 || ^13.0.0",
package/readme.json CHANGED
@@ -1,21 +1,23 @@
1
1
  {
2
2
  "title": "@c15t/nextjs: Next.js Integration",
3
- "description": "Headless cookie banner, consent manager & preference center for Next.js. App Router & Pages Router, RSC, GDPR/CCPA/LGPD/TCF compliant.",
3
+ "description": "Next.js cookie banner and consent management platform for App Router, Pages Router, SSR, and headless consent flows.",
4
4
  "features": [
5
- "Works with Next.js 15, 14, and 13",
5
+ "Works with Next.js 16, 15, 14, and 13",
6
6
  "Full 'use client' support for React Server Components",
7
7
  "Server-side rendering support for both app and pages routers",
8
- "Automatic GDPR compliance",
8
+ "Prebuilt and customizable cookie banner, consent dialog, and preference center UI",
9
+ "Headless hooks for custom consent flows",
9
10
  "Minimal configuration with TypeScript-first design",
10
- "Headless, customisable UI components (Cookie Banner, Consent Dialog, etc.)",
11
- "Built-in internationalisation support",
11
+ "IAB TCF 2.3 UI and hooks through the @c15t/react/iab subpath",
12
+ "Google Tag Manager, Google Consent Mode v2, Meta Pixel, and analytics integrations through @c15t/scripts",
13
+ "Built-in internationalization support",
12
14
  "Seamless consent storage and tracking"
13
15
  ],
14
16
  "prerequisites": [
15
17
  "Next.js 13.5.4 or later",
16
18
  "React 18 or later",
17
19
  "Node.js 18.17.0 or later",
18
- "A hosted [c15t instance](https://inth.com) (free sign-up) or [self-hosted deployment](https://c15t.com/docs/self-host/v2)"
20
+ "A hosted [c15t instance](https://inth.com) (free sign-up), [self-hosted deployment](https://c15t.com/docs/self-host/quickstart), or offline mode for local-only storage"
19
21
  ],
20
22
  "manualInstallation": [
21
23
  "",
@@ -30,11 +32,15 @@
30
32
  "usage": [
31
33
  "Import `ConsentManagerProvider` in your app's root layout",
32
34
  "Add `ConsentBanner` and `ConsentDialog` components",
33
- "Customise styling and behaviour to fit your app",
35
+ "Customize styling and behavior to fit your app",
34
36
  "For full implementation details, see the [Next.js quickstart docs](https://c15t.com/docs/frameworks/next/quickstart)",
35
37
  "```tsx\n// app/layout.tsx\nimport {\n ConsentManagerProvider,\n ConsentBanner,\n ConsentDialog,\n} from '@c15t/nextjs'\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>\n <ConsentManagerProvider>\n {children}\n <ConsentBanner />\n <ConsentDialog />\n </ConsentManagerProvider>\n </body>\n </html>\n )\n}\n```"
36
38
  ],
37
39
  "docsLink": "https://c15t.com/docs/frameworks/next/quickstart",
38
40
  "quickStartLink": "https://c15t.com/docs/frameworks/next/quickstart",
39
- "showCLIGeneration": true
41
+ "showCLIGeneration": true,
42
+ "customSections": {
43
+ "Deployment Modes": "- **Hosted on inth.com**: Hosted c15t backend for policy storage, audit history, and hosted infrastructure\n- **Self-hosted backend**: Use @c15t/backend with your own database and infrastructure\n- **Offline mode**: Browser-only consent storage for local development, demos, previews, static sites, or fallback scenarios",
44
+ "Popular Integrations": "- Google Tag Manager with Google Consent Mode v2\n- Google Analytics 4 and Google Ads through gtag.js\n- Meta Pixel, TikTok Pixel, LinkedIn Insights, Microsoft UET, X Pixel, Reddit Pixel, and Snapchat Pixel\n- PostHog, Segment, Mixpanel, Microsoft Clarity, Hotjar, Plausible, Fathom, Matomo, Umami, and Vercel Analytics\n- Intercom and Crisp chat widgets"
45
+ }
40
46
  }
package/docs/ai-agents.md DELETED
@@ -1,111 +0,0 @@
1
- ---
2
- title: AI Agents
3
- description: Integrate c15t with AI coding assistants using the docs bundled in each package and c15t agent skills. Give agents version-matched local docs for consent management, banners, script loading, callbacks, and integrations.
4
- lastModified: 2026-03-24
5
- ---
6
- ## Bundled Docs
7
-
8
- Every supported c15t package now ships docs inside the installed package itself.
9
-
10
- ### Where to find them
11
-
12
- * `node_modules/c15t/docs/README.md`
13
- * `node_modules/@c15t/react/docs/README.md`
14
- * `node_modules/@c15t/nextjs/docs/README.md`
15
- * `node_modules/@c15t/backend/docs/README.md`
16
-
17
- Start with the package `README.md`, then follow its linked pages for the relevant workflow.
18
-
19
- These docs are version-matched to the exact c15t package version in your project, including generated reference content like prop and type tables.
20
-
21
- ### Why use them
22
-
23
- If your app uses multiple c15t packages, use the docs from each relevant installed package instead of relying on stale model knowledge.
24
-
25
- ### Agent philosophy
26
-
27
- When an AI tool is helping with c15t behavior, it should read the installed c15t docs first and use model knowledge second. That keeps consent flows, script gating, banner behavior, and integrations aligned with the exact version you have installed.
28
-
29
- ### Customization ladder for agents
30
-
31
- When an agent is working on consent UI, it should choose the lowest-power tool that solves the task:
32
-
33
- 1. Start with the pre-built component and its existing props or provider options
34
- 2. Use `theme` tokens for semantic visual changes
35
- 3. Use `theme.slots` for targeted styling of specific parts
36
- 4. Use CSS variables or className-level overrides only when integrating with external styles
37
- 5. Use compound components only when the markup order must change
38
- 6. Use `noStyle` only when c15t structure is still correct but all styling must be replaced
39
- 7. Use headless hooks only when markup and behavior both need to be rebuilt
40
-
41
- For common tasks:
42
-
43
- * Banner footer background -> `theme.colors.surfaceHover`
44
- * Banner card background -> `theme.colors.surface`
45
- * Banner card/footer/title tweaks -> banner slots
46
- * Stock action styling -> `theme.consentActions`
47
- * Copy changes -> `ConsentManagerProvider.options.i18n`
48
-
49
- If a token appears not to work, the agent should verify the token-to-component mapping before suggesting CSS overrides, `!important`, `noStyle`, or headless mode.
50
-
51
- ***
52
-
53
- ## Agent Skills
54
-
55
- c15t publishes agent skills that give AI coding assistants deep knowledge of c15t's APIs, components, and configuration. Skills are reusable workflows and tool-specific guidance, not version-matched local docs.
56
-
57
- ### Installation
58
-
59
- Via the c15t CLI:
60
-
61
- |Package manager|Command|
62
- |:--|:--|
63
- |npm|`npx @c15t/cli install-skills`|
64
- |pnpm|`pnpm dlx @c15t/cli install-skills`|
65
- |yarn|`yarn dlx @c15t/cli install-skills`|
66
- |bun|`bunx @c15t/cli install-skills`|
67
-
68
- Or directly:
69
-
70
- |Package manager|Command|
71
- |:--|:--|
72
- |npm|`npx skills add c15t/skills`|
73
- |pnpm|`pnpm dlx skills add c15t/skills`|
74
- |yarn|`yarn dlx skills add c15t/skills`|
75
- |bun|`bunx skills add c15t/skills`|
76
-
77
- ### What skills provide
78
-
79
- * **Styling customization** — strict escalation guidance across props, tokens, slots, CSS variables, compound components, `noStyle`, and headless
80
- * **Internationalization** — translation setup, locale routing integration
81
- * **Script management** — configuring third-party scripts with consent categories
82
- * **Component setup** — ConsentBanner, ConsentDialog, provider configuration
83
-
84
- ### Supported tools
85
-
86
- * Claude Code
87
- * Cursor
88
- * GitHub Copilot (via `.github/skills`)
89
- * Any agent that supports the skills format
90
-
91
- ***
92
-
93
- ## When to use which
94
-
95
- Use bundled docs when:
96
-
97
- * Your agent can read files in the local project
98
- * You want version-matched docs from the installed c15t packages
99
- * You want a package-local README that tells the agent which detailed docs to read first
100
- * You want concrete guidance for consent management, cookie banners, consent dialogs, preference centers, script loading, callbacks, and integrations
101
-
102
- Use agent skills when:
103
-
104
- * Your tool supports the skills ecosystem
105
- * You want reusable workflows and tool-specific guidance that can point back to the installed package README files
106
-
107
- Use both when:
108
-
109
- * Your tool supports both local file context and skills
110
- * You want local package docs plus reusable setup and configuration help
111
- * You want the bundled package docs as the source of truth plus a reusable decision tree for customization
@@ -1,103 +0,0 @@
1
- ---
2
- title: ConsentDialogTrigger
3
- description: A floating, draggable button that lets users re-open the consent dialog at any time.
4
- ---
5
- `ConsentDialogTrigger` is a floating button that opens the consent dialog when clicked. Users can drag it to any corner of the screen, and the position persists across sessions. Use it to give users a persistent way to manage their privacy settings.
6
-
7
- ## Basic Usage
8
-
9
- Use standalone or via the `showTrigger` prop on `ConsentDialog`:
10
-
11
- ```tsx
12
- import { ConsentDialogTrigger } from '@c15t/nextjs';
13
-
14
- // Standalone
15
- <ConsentDialogTrigger />
16
-
17
- // Via ConsentDialog
18
- <ConsentDialog showTrigger />
19
- ```
20
-
21
- For inline footer links (instead of a floating button), use [`ConsentDialogLink`](/docs/frameworks/next/components/consent-dialog-link).
22
-
23
- ## Icon Options
24
-
25
- ```tsx
26
- {/* Built-in icons */}
27
- <ConsentDialogTrigger icon="branding" /> {/* c15t logo (default) */}
28
- <ConsentDialogTrigger icon="fingerprint" /> {/* Privacy icon */}
29
- <ConsentDialogTrigger icon="settings" /> {/* Gear icon */}
30
-
31
- {/* Custom icon */}
32
- <ConsentDialogTrigger icon={<MyCustomIcon />} />
33
- ```
34
-
35
- ## Visibility
36
-
37
- Control when the trigger is visible:
38
-
39
- ```tsx
40
- {/* Always visible (default) */}
41
- <ConsentDialogTrigger showWhen="always" />
42
-
43
- {/* Only after user has made a consent choice */}
44
- <ConsentDialogTrigger showWhen="after-consent" />
45
-
46
- {/* Hidden (control visibility programmatically) */}
47
- <ConsentDialogTrigger showWhen="never" />
48
- ```
49
-
50
- ## Position
51
-
52
- Set the default corner and control persistence:
53
-
54
- ```tsx
55
- <ConsentDialogTrigger
56
- defaultPosition="bottom-left"
57
- persistPosition={true} // Remembers user's drag position
58
- onPositionChange={(position) => console.log('Moved to:', position)}
59
- />
60
- ```
61
-
62
- ## Size
63
-
64
- ```tsx
65
- <ConsentDialogTrigger size="sm" /> {/* Small */}
66
- <ConsentDialogTrigger size="md" /> {/* Medium (default) */}
67
- <ConsentDialogTrigger size="lg" /> {/* Large */}
68
- ```
69
-
70
- ## Compound Components
71
-
72
- Build fully custom trigger layouts using sub-components:
73
-
74
- ```tsx
75
- <ConsentDialogTrigger.Root defaultPosition="bottom-right">
76
- <ConsentDialogTrigger.Button size="md">
77
- <ConsentDialogTrigger.Icon icon="settings" />
78
- <ConsentDialogTrigger.Text>Privacy</ConsentDialogTrigger.Text>
79
- </ConsentDialogTrigger.Button>
80
- </ConsentDialogTrigger.Root>
81
- ```
82
-
83
- * `ConsentDialogTrigger.Root` — Portal wrapper with drag handling and position persistence
84
- * `ConsentDialogTrigger.Button` — Draggable button element with size variants
85
- * `ConsentDialogTrigger.Icon` — Icon display (branding, fingerprint, settings, or custom)
86
- * `ConsentDialogTrigger.Text` — Optional text label
87
-
88
- ## Props
89
-
90
- ### ConsentDialogTriggerProps
91
-
92
- |Property|Type|Description|Default|Required|
93
- |:--|:--|:--|:--|:--:|
94
- |icon|TriggerIcon|Icon to display in the trigger button.|'branding'|Optional|
95
- |defaultPosition|CornerPosition \|undefined|Default corner position for the trigger. User can drag to any corner and the position will be remembered.|'bottom-right'|Optional|
96
- |persistPosition|boolean \|undefined|Whether to persist the user's position preference in localStorage.|true|Optional|
97
- |ariaLabel|string \|undefined|Accessible label for the trigger button.|'Open privacy settings'|Optional|
98
- |className|string \|undefined|Additional CSS class names.|-|Optional|
99
- |noStyle|boolean \|undefined|When true, removes default styling.|false|Optional|
100
- |showWhen|TriggerVisibility \|undefined|Controls when the trigger is visible.|'always'|Optional|
101
- |size|TriggerSize \|undefined|Size of the trigger button.|'md'|Optional|
102
- |onClick|(() => void) \|undefined|Callback fired when the trigger is clicked (before opening dialog).|-|Optional|
103
- |onPositionChange|((position: CornerPosition) => void) \|undefined|Callback fired when the corner position changes.|-|Optional|