@c15t/nextjs 2.2.1 → 3.0.0-alpha.0
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 +102 -142
- package/README.md +4 -4
- package/dist/api.js +1 -0
- package/dist/config.js +1 -0
- package/dist/devtools.js +2 -0
- package/dist/headers.js +1 -0
- package/dist/iab/styles.css +1 -1
- package/dist/iab/styles.tw3.css +133 -19
- package/dist/index.js +1 -1
- package/dist/middleware.js +1 -0
- package/dist/node-bridge.js +1 -0
- package/dist/pages.js +1 -0
- package/dist/proxy.js +1 -0
- package/dist/root.js +2 -0
- package/dist/server.js +1 -0
- package/dist/static.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/styles.tw3.css +173 -29
- package/dist/version.js +1 -1
- package/dist-types/api.d.ts +88 -0
- package/dist-types/config.d.ts +110 -0
- package/dist-types/devtools.d.ts +1 -0
- package/dist-types/headers.d.ts +4 -0
- package/dist-types/index.d.ts +28 -10
- package/dist-types/middleware.d.ts +15 -0
- package/dist-types/node-bridge.d.ts +57 -0
- package/dist-types/pages.d.ts +88 -0
- package/dist-types/proxy.d.ts +34 -0
- package/dist-types/root.d.ts +86 -0
- package/dist-types/server.d.ts +164 -0
- package/dist-types/static.d.ts +42 -0
- package/dist-types/types.d.ts +5 -36
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +102 -142
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/customization/overview.md +45 -0
- package/docs/customization/recipes.md +79 -0
- package/docs/customization/slots.md +55 -0
- package/docs/customization/tokens.md +76 -0
- package/docs/customization/translations.md +49 -0
- package/docs/frameworks/next/api-reference/data-fetching.md +416 -0
- package/docs/frameworks/next/app-router.md +403 -0
- package/docs/frameworks/next/client-side.md +118 -0
- package/docs/frameworks/next/components/consent-banner.md +251 -211
- package/docs/frameworks/next/components/consent-dialog-link.md +96 -35
- package/docs/frameworks/next/components/consent-dialog-trigger.md +74 -149
- package/docs/frameworks/next/components/consent-dialog.md +189 -134
- package/docs/frameworks/next/components/consent-manager-provider.md +60 -318
- package/docs/frameworks/next/components/consent-widget.md +172 -114
- package/docs/frameworks/next/components/dev-tools.md +199 -40
- package/docs/frameworks/next/components/frame.md +137 -42
- package/docs/frameworks/next/concepts/consent-categories.md +24 -89
- package/docs/frameworks/next/concepts/policy-presets.md +142 -0
- package/docs/frameworks/next/content-security-policy.md +189 -0
- package/docs/frameworks/next/data-fetching.md +74 -0
- package/docs/frameworks/next/geography-headers.md +251 -0
- package/docs/frameworks/next/headless.md +95 -185
- package/docs/frameworks/next/hooks/use-consent-manager/overview.md +42 -163
- package/docs/frameworks/next/iab/overview.md +37 -107
- package/docs/frameworks/next/optimization.md +158 -194
- package/docs/frameworks/next/pages-router.md +296 -0
- package/docs/frameworks/next/quickstart.md +31 -132
- package/docs/frameworks/next/script-loader.md +134 -467
- package/docs/frameworks/next/server-side.md +97 -130
- package/docs/frameworks/next/static-export.md +164 -0
- package/docs/frameworks/next/styling/overview.md +166 -250
- package/docs/frameworks/next/troubleshooting.md +134 -144
- package/docs/guides/consent-state.md +60 -0
- package/docs/guides/data-fetching.md +163 -0
- package/docs/guides/deployment-modes.md +63 -0
- package/docs/guides/troubleshooting.md +68 -0
- package/docs/guides/verify-consent.md +62 -0
- package/docs/integrations/adobe-analytics.md +239 -105
- package/docs/integrations/ahrefs-analytics.md +238 -104
- package/docs/integrations/amplitude.md +219 -157
- package/docs/integrations/building-integrations.md +32 -224
- package/docs/integrations/clearbit.md +247 -86
- package/docs/integrations/cloudflare-web-analytics.md +250 -84
- package/docs/integrations/crisp.md +251 -97
- package/docs/integrations/databuddy.md +259 -153
- package/docs/integrations/fathom-analytics.md +239 -96
- package/docs/integrations/google-maps.md +328 -207
- package/docs/integrations/google-tag-manager.md +248 -96
- package/docs/integrations/google-tag.md +261 -90
- package/docs/integrations/heap.md +222 -149
- package/docs/integrations/hightouch.md +225 -131
- package/docs/integrations/hotjar.md +239 -90
- package/docs/integrations/intercom.md +239 -98
- package/docs/integrations/linkedin-insights.md +243 -113
- package/docs/integrations/logrocket.md +241 -123
- package/docs/integrations/matomo-analytics.md +256 -111
- package/docs/integrations/meta-pixel.md +197 -324
- package/docs/integrations/microsoft-clarity.md +233 -114
- package/docs/integrations/microsoft-uet.md +245 -110
- package/docs/integrations/mixpanel-analytics.md +252 -87
- package/docs/integrations/openai-pixel.md +441 -0
- package/docs/integrations/overview.md +95 -133
- package/docs/integrations/pirsch.md +249 -96
- package/docs/integrations/plausible-analytics.md +241 -100
- package/docs/integrations/posthog.md +353 -214
- package/docs/integrations/promptwatch.md +251 -81
- package/docs/integrations/reddit-pixel.md +226 -173
- package/docs/integrations/rudderstack.md +244 -187
- package/docs/integrations/rybbit-analytics.md +244 -91
- package/docs/integrations/segment.md +238 -92
- package/docs/integrations/snapchat-pixel.md +240 -110
- package/docs/integrations/tiktok-pixel.md +249 -81
- package/docs/integrations/umami-analytics.md +242 -95
- package/docs/integrations/vercel-analytics.md +242 -90
- package/docs/integrations/x-pixel.md +238 -104
- package/docs/integrations/youtube.md +354 -142
- package/docs/upgrade-v3.md +334 -0
- package/iab/styles.css +1 -1
- package/iab/styles.tw3.css +1 -1
- package/package.json +106 -65
- package/readme.json +3 -3
- package/src/iab/styles.css +1 -1
- package/src/iab/styles.tw3.css +1 -1
- package/src/styles.css +1 -1
- package/src/styles.tw3.css +1 -1
- package/styles.css +1 -1
- package/styles.tw3.css +1 -1
- package/client/components/consent-dialog-link.js +0 -3
- package/client/components/integrations.js +0 -3
- package/dist/components/integrations/index.cjs +0 -1
- package/dist/components/integrations/index.js +0 -1
- package/dist/headless.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/libs/browser-initial-data.cjs +0 -1
- package/dist/libs/browser-initial-data.js +0 -1
- package/dist/libs/initial-data.cjs +0 -1
- package/dist/libs/initial-data.js +0 -1
- package/dist/types.cjs +0 -1
- package/dist/version.cjs +0 -1
- package/dist-types/components/integrations/index.d.ts +0 -1
- package/dist-types/libs/browser-initial-data.d.ts +0 -9
- package/dist-types/libs/initial-data.d.ts +0 -33
- package/docs/frameworks/next/building-headless-components.md +0 -379
- package/docs/frameworks/next/callbacks.md +0 -186
- package/docs/frameworks/next/concepts/client-modes.md +0 -177
- package/docs/frameworks/next/concepts/consent-models.md +0 -117
- package/docs/frameworks/next/concepts/cookie-management.md +0 -122
- package/docs/frameworks/next/concepts/glossary.md +0 -24
- package/docs/frameworks/next/concepts/initialization-flow.md +0 -149
- package/docs/frameworks/next/concepts/policy-packs.md +0 -230
- package/docs/frameworks/next/hooks/use-color-scheme.md +0 -41
- package/docs/frameworks/next/hooks/use-consent-manager/checking-consent.md +0 -96
- package/docs/frameworks/next/hooks/use-consent-manager/location-info.md +0 -97
- package/docs/frameworks/next/hooks/use-consent-manager/setting-consent.md +0 -94
- package/docs/frameworks/next/hooks/use-draggable.md +0 -59
- package/docs/frameworks/next/hooks/use-focus-trap.md +0 -42
- package/docs/frameworks/next/hooks/use-reduced-motion.md +0 -37
- package/docs/frameworks/next/hooks/use-ssr-status.md +0 -32
- package/docs/frameworks/next/hooks/use-text-direction.md +0 -50
- package/docs/frameworks/next/hooks/use-translations.md +0 -55
- package/docs/frameworks/next/iab/consent-banner.md +0 -91
- package/docs/frameworks/next/iab/consent-dialog.md +0 -129
- package/docs/frameworks/next/iab/use-gvl-data.md +0 -21
- package/docs/frameworks/next/iframe-blocking.md +0 -106
- package/docs/frameworks/next/internationalization.md +0 -207
- package/docs/frameworks/next/network-blocker.md +0 -140
- package/docs/frameworks/next/policy-packs.md +0 -248
- package/docs/frameworks/next/styling/classnames.md +0 -94
- package/docs/frameworks/next/styling/color-scheme.md +0 -84
- package/docs/frameworks/next/styling/css-variables.md +0 -53
- package/docs/frameworks/next/styling/slots.md +0 -94
- package/docs/frameworks/next/styling/tailwind.md +0 -137
- package/docs/frameworks/next/styling/tokens.md +0 -156
- package/docs/shared/concepts/client-modes.md +0 -103
- package/docs/shared/concepts/consent-categories.md +0 -41
- package/docs/shared/concepts/consent-models.md +0 -72
- package/docs/shared/concepts/cookie-management.md +0 -88
- package/docs/shared/concepts/glossary.md +0 -24
- package/docs/shared/concepts/initialization-flow.md +0 -105
- package/docs/shared/concepts/policy-packs.md +0 -225
- package/docs/shared/react/components/consent-banner.md +0 -242
- package/docs/shared/react/components/consent-dialog-link.md +0 -45
- package/docs/shared/react/components/consent-dialog-trigger.md +0 -185
- package/docs/shared/react/components/consent-dialog.md +0 -119
- package/docs/shared/react/components/consent-manager-provider.md +0 -225
- package/docs/shared/react/components/consent-widget.md +0 -121
- package/docs/shared/react/components/dev-tools.md +0 -81
- package/docs/shared/react/components/frame.md +0 -52
- package/docs/shared/react/guides/building-headless-components.md +0 -110
- package/docs/shared/react/guides/callbacks.md +0 -89
- package/docs/shared/react/guides/headless.md +0 -31
- package/docs/shared/react/guides/iframe-blocking.md +0 -65
- package/docs/shared/react/guides/internationalization.md +0 -123
- package/docs/shared/react/guides/network-blocker.md +0 -72
- package/docs/shared/react/guides/optimization.md +0 -44
- package/docs/shared/react/guides/policy-packs.md +0 -173
- package/docs/shared/react/guides/script-loader.md +0 -311
- package/docs/shared/react/hooks/use-color-scheme.md +0 -31
- package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +0 -95
- package/docs/shared/react/hooks/use-consent-manager/location-info.md +0 -96
- package/docs/shared/react/hooks/use-consent-manager/overview.md +0 -74
- package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +0 -93
- package/docs/shared/react/hooks/use-draggable.md +0 -30
- package/docs/shared/react/hooks/use-focus-trap.md +0 -20
- package/docs/shared/react/hooks/use-reduced-motion.md +0 -33
- package/docs/shared/react/hooks/use-ssr-status.md +0 -16
- package/docs/shared/react/hooks/use-text-direction.md +0 -38
- package/docs/shared/react/hooks/use-translations.md +0 -15
- package/docs/shared/react/iab/consent-banner.md +0 -60
- package/docs/shared/react/iab/consent-dialog.md +0 -76
- package/docs/shared/react/iab/overview.md +0 -80
- package/docs/shared/react/iab/use-gvl-data.md +0 -21
- package/docs/shared/react/styling/classnames.md +0 -93
- package/docs/shared/react/styling/color-scheme.md +0 -35
- package/docs/shared/react/styling/css-variables.md +0 -53
- package/docs/shared/react/styling/overview.md +0 -261
- package/docs/shared/react/styling/slots.md +0 -93
- package/docs/shared/react/styling/stylesheet-entrypoint.md +0 -8
- package/docs/shared/react/styling/tailwind.md +0 -88
- package/docs/shared/react/styling/tokens.md +0 -155
- package/docs/shared/troubleshooting.md +0 -82
package/AGENTS.md
CHANGED
|
@@ -1,155 +1,115 @@
|
|
|
1
1
|
# @c15t/nextjs
|
|
2
2
|
|
|
3
|
-
> Next.js
|
|
3
|
+
> Next.js v3 App Router, Pages Router, static export and hydration with Inth.
|
|
4
4
|
|
|
5
5
|
These docs ship inside the package so coding agents can read them offline. Open the topic file you need from the list below — paths are relative to this file.
|
|
6
6
|
|
|
7
|
+
## Using these docs
|
|
8
|
+
|
|
9
|
+
These docs describe v3. Start with Inth hosted setup, identify the framework, router and deployment, then read its quickstart. Static sites can use Inth directly. Use page Markdown and package-bundled docs for targeted context. Verify scripts, rejection, reload and preferences; banner visibility alone is insufficient.
|
|
10
|
+
|
|
11
|
+
## Start here
|
|
12
|
+
|
|
13
|
+
- [Next.js quickstart](./docs/frameworks/next/quickstart.md)
|
|
14
|
+
- [App Router setup](./docs/frameworks/next/app-router.md)
|
|
15
|
+
- [Pages Router setup](./docs/frameworks/next/pages-router.md)
|
|
16
|
+
- [Static export setup](./docs/frameworks/next/static-export.md)
|
|
17
|
+
- [Customize your consent interface](./docs/customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
|
|
18
|
+
- [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
|
|
19
|
+
- [Upgrade to v3 policies](./docs/upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
|
|
20
|
+
|
|
21
|
+
## More documentation
|
|
22
|
+
|
|
23
|
+
[Documentation index](https://c15t.com/docs/llms.txt) · [Full Markdown context](https://c15t.com/llms-full.txt). Prefer the index and individual pages for focused tasks.
|
|
24
|
+
|
|
7
25
|
## Frameworks
|
|
8
26
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
-
- [
|
|
30
|
-
- [
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- [
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [Class Names](./docs/frameworks/next/styling/classnames.md): Style consent components using className props and per-slot className targeting via the theme.
|
|
53
|
-
- [Color Scheme](./docs/frameworks/next/styling/color-scheme.md): Support light mode, dark mode, and system preference detection in consent components.
|
|
54
|
-
- [CSS Variables](./docs/frameworks/next/styling/css-variables.md): Reference for all --c15t-* CSS custom properties generated by the theme system.
|
|
55
|
-
- [Styling Overview](./docs/frameworks/next/styling/overview.md): Five approaches for theming consent components — design tokens, component slots, CSS variables, className, and noStyle mode.
|
|
56
|
-
- [Component Slots](./docs/frameworks/next/styling/slots.md): Target individual component parts with styles using the slot system - className strings or inline style objects.
|
|
57
|
-
- [Tailwind CSS](./docs/frameworks/next/styling/tailwind.md): Use Tailwind CSS utility classes to style consent components via the slot system.
|
|
58
|
-
- [Design Tokens](./docs/frameworks/next/styling/tokens.md): The six base token categories that control colors, typography, spacing, radius, shadows, and motion, plus optional dark-mode overrides.
|
|
59
|
-
- [Troubleshooting](./docs/frameworks/next/troubleshooting.md): Solutions for common issues with @c15t/nextjs — provider errors, missing banners, consent persistence, and more.
|
|
27
|
+
- [Fetching reference](./docs/frameworks/next/api-reference/data-fetching.md): Reference for Next.js consent URLs, manifest resolution, request geography and offline configuration.
|
|
28
|
+
- [App Router](./docs/frameworks/next/app-router.md): Set up App Router with Inth, cached manifests and consent-gated scripts.
|
|
29
|
+
- [Client-side initialization](./docs/frameworks/next/client-side.md): Initialize Next.js consent in the browser with one backend URL, without server prefetch or local API handlers.
|
|
30
|
+
- [ConsentBanner](./docs/frameworks/next/components/consent-banner.md): Render the pre-built ConsentBanner inside a Next.js ConsentRoot and configure its variants, per-policy buttons and compound parts.
|
|
31
|
+
- [ConsentDialog](./docs/frameworks/next/components/consent-dialog.md): Mount ConsentDialog as a Client Component inside a Next.js ConsentRoot to open the preference center from the banner, links and triggers.
|
|
32
|
+
- [ConsentDialogLink](./docs/frameworks/next/components/consent-dialog-link.md): Open the preference center from a Next.js footer with ConsentDialogLink, a Client Component that renders an unstyled button inside ConsentRoot.
|
|
33
|
+
- [ConsentDialogTrigger](./docs/frameworks/next/components/consent-dialog-trigger.md): Add the floating ConsentDialogTrigger button or toolbar to a Next.js ConsentRoot so visitors can reopen the preference center.
|
|
34
|
+
- [ConsentRoot](./docs/frameworks/next/components/consent-manager-provider.md): Pass server-resolved consent state and shared configuration to the Next.js ConsentRoot.
|
|
35
|
+
- [ConsentWidget](./docs/frameworks/next/components/consent-widget.md): Render ConsentWidget on a Next.js privacy page inside ConsentRoot as an inline preference center, server-rendered when the route resolves consent.
|
|
36
|
+
- [DevTools](./docs/frameworks/next/components/dev-tools.md): Load the c15t DevTools panel only in Next.js development builds to inspect consent state, scripts, policy and events inside ConsentRoot.
|
|
37
|
+
- [Frame](./docs/frameworks/next/components/frame.md): Consent-gate an iframe in Next.js with Frame inside ConsentRoot; with server prefetch the placeholder or embed is decided in the server HTML.
|
|
38
|
+
- [Consent categories](./docs/frameworks/next/concepts/consent-categories.md): Assign optional features to categories and understand how policy scope affects permission.
|
|
39
|
+
- [Policy presets](./docs/frameworks/next/concepts/policy-presets.md): Understand how policy rules affect Next.js prompts, permissions and persistent privacy controls.
|
|
40
|
+
- [Content Security Policy](./docs/frameworks/next/content-security-policy.md): Pass a per-request CSP nonce to ConsentRoot in Next.js and allow the consent backend in connect-src.
|
|
41
|
+
- [Data fetching](./docs/frameworks/next/data-fetching.md): Choose cached manifests for a Next.js server, backend initialization for a simpler setup, or offline mode for local development.
|
|
42
|
+
- [Forward geography headers](./docs/frameworks/next/geography-headers.md): Use c15tProxy in Next.js proxy.ts or middleware.ts so Server Components and Route Handlers receive the visitor's country and region.
|
|
43
|
+
- [Headless](./docs/frameworks/next/headless.md): Build a custom consent banner in Next.js with the c15t/next/headless hooks inside your existing ConsentRoot.
|
|
44
|
+
- [Hooks](./docs/frameworks/next/hooks/use-consent-manager/overview.md): Gate features and save consent choices in Next.js Client Components with the focused hooks exported from c15t/next.
|
|
45
|
+
- [IAB TCF](./docs/frameworks/next/iab/overview.md): Mount the IAB TCF banner and dialog inside a Next.js ConsentRoot and configure the CMP ID, policy and vendor data.
|
|
46
|
+
- [Optimization](./docs/frameworks/next/optimization.md): Reuse cached policy data and optionally reduce browser connection overhead without changing consent behavior.
|
|
47
|
+
- [Pages Router](./docs/frameworks/next/pages-router.md): Set up Pages Router with Inth, cached manifests and consent-gated scripts.
|
|
48
|
+
- [Quickstart](./docs/frameworks/next/quickstart.md): Add c15t consent management to Next.js with Inth, with setup guides for the App Router, the Pages Router and static export.
|
|
49
|
+
- [Load scripts with consent](./docs/frameworks/next/script-loader.md): Register vendor scripts in your existing Next.js ConsentRoot and handle loading and revocation.
|
|
50
|
+
- [Server rendering and hydration](./docs/frameworks/next/server-side.md): Resolve consent on the server, choose what waits for the result, and preserve the same state through hydration.
|
|
51
|
+
- [Static export](./docs/frameworks/next/static-export.md): Add c15t to output export without request helpers or a local API server.
|
|
52
|
+
- [Styling](./docs/frameworks/next/styling/overview.md): Import the Next.js stylesheet and theme c15t components with tokens, slots, and class names through ConsentRoot options.
|
|
53
|
+
- [Troubleshoot Next.js consent](./docs/frameworks/next/troubleshooting.md): Diagnose failed Next.js prefetch, verify manifest requests, and fix consent rendering or persistence problems.
|
|
54
|
+
|
|
55
|
+
## Guides
|
|
56
|
+
|
|
57
|
+
- [Understand consent state](./docs/guides/consent-state.md): Distinguish policy resolution, effective permissions, explicit choices, notices and privacy signals.
|
|
58
|
+
- [Data fetching and transports](./docs/guides/data-fetching.md): Choose cached manifests, backend init or offline policy resolution, and understand where consent records are saved.
|
|
59
|
+
- [Choose a deployment mode](./docs/guides/deployment-modes.md): Choose who runs your consent backend, then select manifest, init or offline resolution for your deployment.
|
|
60
|
+
- [Troubleshoot consent](./docs/guides/troubleshooting.md): Diagnose missing banners, early vendor requests, lost choices and hydration differences.
|
|
61
|
+
- [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
|
|
62
|
+
|
|
63
|
+
## Customization
|
|
64
|
+
|
|
65
|
+
- [Customize your consent interface](./docs/customization/overview.md): Choose presentation, theme tokens, slots or custom markup for the change you need.
|
|
66
|
+
- [Banner styling recipes](./docs/customization/recipes.md): See real v3 components and reuse the exact theme configuration behind the examples.
|
|
67
|
+
- [Style component slots](./docs/customization/slots.md): Target a specific c15t component part without replacing its markup or behavior.
|
|
68
|
+
- [Theme tokens and CSS](./docs/customization/tokens.md): Style c15t with semantic tokens and use the stylesheet that matches your CSS tooling.
|
|
69
|
+
- [Copy and translations](./docs/customization/translations.md): Change consent wording through i18n and test the complete prompt and preferences flow.
|
|
60
70
|
|
|
61
71
|
## Integrations
|
|
62
72
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [Google
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
79
|
-
- [
|
|
80
|
-
- [
|
|
81
|
-
- [
|
|
82
|
-
- [
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [
|
|
86
|
-
- [
|
|
87
|
-
- [
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [
|
|
92
|
-
- [
|
|
93
|
-
- [
|
|
94
|
-
- [
|
|
95
|
-
- [
|
|
96
|
-
- [
|
|
97
|
-
- [
|
|
98
|
-
- [
|
|
99
|
-
- [
|
|
100
|
-
- [
|
|
101
|
-
- [
|
|
102
|
-
- [YouTube](./docs/integrations/youtube.md): Keep YouTube iframes unmounted until consent with a privacy-enhanced, lazy-loaded React or Next.js embed.
|
|
73
|
+
- [Adobe Analytics](./docs/integrations/adobe-analytics.md): Configure Adobe Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
74
|
+
- [Ahrefs Analytics](./docs/integrations/ahrefs-analytics.md): Configure Ahrefs Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
75
|
+
- [Amplitude](./docs/integrations/amplitude.md): Configure Amplitude with c15t v3, understand measurement permission and verify loading and revocation.
|
|
76
|
+
- [Custom integrations](./docs/integrations/building-integrations.md): Define loading, initialization and consent-change behavior for a vendor without a helper.
|
|
77
|
+
- [Clearbit](./docs/integrations/clearbit.md): Configure Clearbit with c15t v3, understand marketing permission and verify loading and revocation.
|
|
78
|
+
- [Cloudflare Web Analytics](./docs/integrations/cloudflare-web-analytics.md): Configure Cloudflare Web Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
79
|
+
- [Crisp](./docs/integrations/crisp.md): Configure Crisp with c15t v3, understand functionality permission and verify loading and revocation.
|
|
80
|
+
- [Databuddy](./docs/integrations/databuddy.md): Configure Databuddy's initial and updated consent state with c15t v3.
|
|
81
|
+
- [Fathom Analytics](./docs/integrations/fathom-analytics.md): Configure Fathom Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
82
|
+
- [Google Maps](./docs/integrations/google-maps.md): Prevent a map iframe from mounting before the required permission.
|
|
83
|
+
- [Google Tag](./docs/integrations/google-tag.md): Configure gtag with c15t Consent Mode signals and understand its loading behavior.
|
|
84
|
+
- [Google Tag Manager](./docs/integrations/google-tag-manager.md): Load GTM with c15t consent signals and verify the tags inside your container.
|
|
85
|
+
- [Heap](./docs/integrations/heap.md): Configure Heap with c15t v3, understand measurement permission and verify loading and revocation.
|
|
86
|
+
- [Hightouch](./docs/integrations/hightouch.md): Configure Hightouch with c15t v3, understand measurement permission and verify loading and revocation.
|
|
87
|
+
- [Hotjar](./docs/integrations/hotjar.md): Configure Hotjar with c15t v3, understand measurement permission and verify loading and revocation.
|
|
88
|
+
- [Intercom](./docs/integrations/intercom.md): Load the Intercom messenger with functionality permission and configure its region.
|
|
89
|
+
- [LinkedIn Insight Tag](./docs/integrations/linkedin-insights.md): Configure LinkedIn Insight Tag with c15t v3, understand marketing permission and verify loading and revocation.
|
|
90
|
+
- [LogRocket](./docs/integrations/logrocket.md): Configure LogRocket with c15t v3, understand measurement permission and verify loading and revocation.
|
|
91
|
+
- [Matomo Analytics](./docs/integrations/matomo-analytics.md): Choose gated loading or Matomo consent signaling and configure the correct tracker endpoints.
|
|
92
|
+
- [Meta Pixel](./docs/integrations/meta-pixel.md): Register the Meta Pixel under marketing permission and verify event calls after revocation.
|
|
93
|
+
- [Microsoft Clarity](./docs/integrations/microsoft-clarity.md): Configure Microsoft Clarity with c15t v3, understand measurement permission and verify loading and revocation.
|
|
94
|
+
- [Microsoft UET](./docs/integrations/microsoft-uet.md): Configure Microsoft UET with c15t v3, understand marketing permission and verify loading and revocation.
|
|
95
|
+
- [Mixpanel](./docs/integrations/mixpanel-analytics.md): Configure Mixpanel with c15t v3, understand measurement permission and verify loading and revocation.
|
|
96
|
+
- [OpenAI Pixel](./docs/integrations/openai-pixel.md): Configure the OpenAI Measurement Pixel for ChatGPT Ads with c15t v3, manage marketing permission and verify conversion delivery.
|
|
97
|
+
- [Overview](./docs/integrations/overview.md): Find all c15t integrations for analytics, tag managers, advertising, chat and embedded content.
|
|
98
|
+
- [Pirsch](./docs/integrations/pirsch.md): Configure Pirsch with c15t v3, understand measurement permission and verify loading and revocation.
|
|
99
|
+
- [Plausible Analytics](./docs/integrations/plausible-analytics.md): Configure Plausible Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
100
|
+
- [PostHog](./docs/integrations/posthog.md): Choose PostHog loading and cookieless behavior, configure the region, and synchronize v3 permissions.
|
|
101
|
+
- [Promptwatch](./docs/integrations/promptwatch.md): Configure Promptwatch with c15t v3, understand measurement permission and verify loading and revocation.
|
|
102
|
+
- [Reddit Pixel](./docs/integrations/reddit-pixel.md): Configure Reddit Pixel with c15t v3, understand marketing permission and verify loading and revocation.
|
|
103
|
+
- [RudderStack](./docs/integrations/rudderstack.md): Gate the RudderStack browser SDK or map c15t categories to destination consent IDs.
|
|
104
|
+
- [Rybbit Analytics](./docs/integrations/rybbit-analytics.md): Configure Rybbit Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
105
|
+
- [Segment](./docs/integrations/segment.md): Configure Segment with c15t v3, understand measurement permission and verify loading and revocation.
|
|
106
|
+
- [Snapchat Pixel](./docs/integrations/snapchat-pixel.md): Configure Snapchat Pixel with c15t v3, understand marketing permission and verify loading and revocation.
|
|
107
|
+
- [TikTok Pixel](./docs/integrations/tiktok-pixel.md): Configure TikTok Pixel with c15t v3, understand marketing permission and verify loading and revocation.
|
|
108
|
+
- [Umami Analytics](./docs/integrations/umami-analytics.md): Configure Umami Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
109
|
+
- [Vercel Analytics](./docs/integrations/vercel-analytics.md): Configure Vercel Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
110
|
+
- [X Pixel](./docs/integrations/x-pixel.md): Configure X Pixel with c15t v3, understand marketing permission and verify loading and revocation.
|
|
111
|
+
- [YouTube](./docs/integrations/youtube.md): Gate YouTube embeds with c15t v3 in Next.js, TanStack Start, React, Nuxt, Vue, Astro, Svelte, SvelteKit or JavaScript.
|
|
103
112
|
|
|
104
113
|
## Reference
|
|
105
114
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- [Client Modes](./docs/shared/concepts/client-modes.md): Reference page for client modes.
|
|
109
|
-
- [Consent Categories](./docs/shared/concepts/consent-categories.md): Reference page for consent categories.
|
|
110
|
-
- [Consent Models](./docs/shared/concepts/consent-models.md): Reference page for consent models.
|
|
111
|
-
- [Cookie Management](./docs/shared/concepts/cookie-management.md): Reference page for cookie management.
|
|
112
|
-
- [Glossary](./docs/shared/concepts/glossary.md): Reference page for glossary.
|
|
113
|
-
- [Initialization Flow](./docs/shared/concepts/initialization-flow.md): Reference page for initialization flow.
|
|
114
|
-
- [Policy Packs](./docs/shared/concepts/policy-packs.md): Reference page for policy packs.
|
|
115
|
-
- [Consent Banner](./docs/shared/react/components/consent-banner.md): Reference page for consent banner.
|
|
116
|
-
- [Consent Dialog](./docs/shared/react/components/consent-dialog.md): Reference page for consent dialog.
|
|
117
|
-
- [Consent Dialog Link](./docs/shared/react/components/consent-dialog-link.md): Reference page for consent dialog link.
|
|
118
|
-
- [Consent Dialog Trigger](./docs/shared/react/components/consent-dialog-trigger.md): Reference page for consent dialog trigger.
|
|
119
|
-
- [Consent Manager Provider](./docs/shared/react/components/consent-manager-provider.md): Reference page for consent manager provider.
|
|
120
|
-
- [Consent Widget](./docs/shared/react/components/consent-widget.md): Reference page for consent widget.
|
|
121
|
-
- [Dev Tools](./docs/shared/react/components/dev-tools.md): Reference page for dev tools.
|
|
122
|
-
- [Frame](./docs/shared/react/components/frame.md): Reference page for frame.
|
|
123
|
-
- [Building Headless Components](./docs/shared/react/guides/building-headless-components.md): Reference page for building headless components.
|
|
124
|
-
- [Callbacks](./docs/shared/react/guides/callbacks.md): Reference page for callbacks.
|
|
125
|
-
- [Headless](./docs/shared/react/guides/headless.md): Reference page for headless.
|
|
126
|
-
- [Iframe Blocking](./docs/shared/react/guides/iframe-blocking.md): Reference page for iframe blocking.
|
|
127
|
-
- [Internationalization](./docs/shared/react/guides/internationalization.md): Reference page for internationalization.
|
|
128
|
-
- [Network Blocker](./docs/shared/react/guides/network-blocker.md): Reference page for network blocker.
|
|
129
|
-
- [Optimization](./docs/shared/react/guides/optimization.md): Reference page for optimization.
|
|
130
|
-
- [Policy Packs](./docs/shared/react/guides/policy-packs.md): Reference page for policy packs.
|
|
131
|
-
- [Script Loader](./docs/shared/react/guides/script-loader.md): Reference page for script loader.
|
|
132
|
-
- [Use Color Scheme](./docs/shared/react/hooks/use-color-scheme.md): Reference page for use color scheme.
|
|
133
|
-
- [Checking Consent](./docs/shared/react/hooks/use-consent-manager/checking-consent.md): Reference page for checking consent.
|
|
134
|
-
- [Location Info](./docs/shared/react/hooks/use-consent-manager/location-info.md): Reference page for location info.
|
|
135
|
-
- [Overview](./docs/shared/react/hooks/use-consent-manager/overview.md): Reference page for overview.
|
|
136
|
-
- [Setting Consent](./docs/shared/react/hooks/use-consent-manager/setting-consent.md): Reference page for setting consent.
|
|
137
|
-
- [Use Draggable](./docs/shared/react/hooks/use-draggable.md): Reference page for use draggable.
|
|
138
|
-
- [Use Focus Trap](./docs/shared/react/hooks/use-focus-trap.md): Reference page for use focus trap.
|
|
139
|
-
- [Use Reduced Motion](./docs/shared/react/hooks/use-reduced-motion.md): Reference page for use reduced motion.
|
|
140
|
-
- [Use SSR Status](./docs/shared/react/hooks/use-ssr-status.md): Reference page for use ssr status.
|
|
141
|
-
- [Use Text Direction](./docs/shared/react/hooks/use-text-direction.md): Reference page for use text direction.
|
|
142
|
-
- [Use Translations](./docs/shared/react/hooks/use-translations.md): Reference page for use translations.
|
|
143
|
-
- [Consent Banner](./docs/shared/react/iab/consent-banner.md): Reference page for consent banner.
|
|
144
|
-
- [Consent Dialog](./docs/shared/react/iab/consent-dialog.md): Reference page for consent dialog.
|
|
145
|
-
- [Overview](./docs/shared/react/iab/overview.md): Reference page for overview.
|
|
146
|
-
- [Use GVL Data](./docs/shared/react/iab/use-gvl-data.md): Reference page for use gvl data.
|
|
147
|
-
- [Classnames](./docs/shared/react/styling/classnames.md): Reference page for classnames.
|
|
148
|
-
- [Color Scheme](./docs/shared/react/styling/color-scheme.md): Reference page for color scheme.
|
|
149
|
-
- [CSS Variables](./docs/shared/react/styling/css-variables.md): Reference page for css variables.
|
|
150
|
-
- [Overview](./docs/shared/react/styling/overview.md): Reference page for overview.
|
|
151
|
-
- [Slots](./docs/shared/react/styling/slots.md): Reference page for slots.
|
|
152
|
-
- [Stylesheet Entrypoint](./docs/shared/react/styling/stylesheet-entrypoint.md): Reference page for stylesheet entrypoint.
|
|
153
|
-
- [Tailwind](./docs/shared/react/styling/tailwind.md): Reference page for tailwind.
|
|
154
|
-
- [Tokens](./docs/shared/react/styling/tokens.md): Reference page for tokens.
|
|
155
|
-
- [Troubleshooting](./docs/shared/troubleshooting.md): Reference page for troubleshooting.
|
|
115
|
+
- [Upgrade to v3 policies](./docs/upgrade-v3.md): Migrate policy configuration, consent records, callbacks, and custom transports to the v3 policy system.
|
package/README.md
CHANGED
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
<a href="https://github.com/c15t/c15t/blob/main/LICENSE.md"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/c15t/c15t/license.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/github/c15t/c15t/license.svg?variant=outline&mode=light" alt="License"></picture></a>
|
|
16
16
|
<a href="https://c15t.link/discord"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/discord/1312171102268690493.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/discord/1312171102268690493.svg?variant=outline&mode=light" alt="Discord"></picture></a>
|
|
17
17
|
<a href="https://skills.sh/c15t/skills/c15t"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/skills/c15t/skills/c15t.svg?variant=outline&mode=dark"><img src="https://shieldcn.dev/skills/c15t/skills/c15t.svg?variant=outline&mode=light" alt="Skills"></picture></a>
|
|
18
|
-
<a href="https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Fnextjs"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&
|
|
18
|
+
<a href="https://inth.com?utm_source=npm&utm_medium=readme&utm_campaign=oss_readme&utm_content=%40c15t%2Fnextjs"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?color=ffc803&labelTextColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&valueColor=000000&mode=dark"><img src="https://shieldcn.dev/badge/Made%20By-Inth-ffc803.svg?color=ffc803&labelTextColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAzOTMgNDAwIj48cGF0aCBmaWxsPSIjMDAwIiBkPSJNMTgyLjY2MiAwdjM2Ljg5NWgtNTkuMDMxdjgyLjczM2g1OS4wMzF2MzYuODkzSDI3LjQ4MnYtMzYuODkzaDU5LjAzVjM2Ljg5NWgtNTkuMDNWMHpNMzIxLjk0MSA4OS44NVYwaDM1LjM1NXYxNTYuNTIxaC0yNS43MTNsLTg2LjEzNy05MC4zNjR2OTAuMzY0aC0zNS4zNTVWMGgyNi4zNTV6Ii8%2BPHBhdGggZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzE4LjU3MSAxODUuNzE0aDc0LjI4NlY0MDBIMFYxODUuNzE0aDI3Mi44NTd2LTQ3LjE0M3ptLTI5MS4wOSAyOC45Njl2MzcuMTE4aDU4LjEzN3YxMTkuNjI4aDM2Ljg5NVYyNTEuODAxaDU4LjU4NHYtMzcuMTE4em0xODIuNjEuMjI0djE1Ni41MjJoMzYuODk0VjMxMy41OWg3My4zNDF2NTcuODM5aDM3LjExOFYyMTQuOTA3aC0zNy4xMTh2NjEuNzg4aC03My4zNDF2LTYxLjc4OHoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg%3D%3D&valueColor=000000&mode=light" alt="Made by Inth"></picture></a>
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
Next.js cookie banner and consent management platform for App Router, Pages Router, SSR, and headless consent flows.
|
|
22
22
|
|
|
23
23
|
## Key Features
|
|
24
24
|
|
|
25
|
-
- Works with Next.js 16
|
|
25
|
+
- Works with Next.js 16 and 15
|
|
26
26
|
- Full 'use client' support for React Server Components
|
|
27
27
|
- Server-side rendering support for both app and pages routers
|
|
28
28
|
- Prebuilt and customizable cookie banner, consent dialog, and preference center UI
|
|
@@ -35,9 +35,9 @@ Next.js cookie banner and consent management platform for App Router, Pages Rout
|
|
|
35
35
|
|
|
36
36
|
## Prerequisites
|
|
37
37
|
|
|
38
|
-
- Next.js
|
|
38
|
+
- Next.js 15.0.0 or later
|
|
39
39
|
- React 18 or later
|
|
40
|
-
- Node.js
|
|
40
|
+
- Node.js 20.19 or later
|
|
41
41
|
- 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
|
|
42
42
|
|
|
43
43
|
## Quick Start
|
package/dist/api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c15tProtocolHeaders as e,deferInitGvlToRoute as t,fetchCachedGvl as a,serveGvlReference as n}from"@c15t/core";import{fetchCachedManifest as r,getManifestAge as i,parseCacheDirectiveSeconds as o}from"@c15t/core/libs/manifest-cache";import{POLICY_CONTRACT_HEADER as s,POLICY_CONTRACT_VERSION as l,resolveBackendURL as c,resolveInitFromManifest as f}from"@c15t/schema/types";import{baseTranslations as u}from"@c15t/translations/all";import{defineConsentConfig as h,isConsentConfig as g}from"./config.js";import{extractConsentRequestInputs as d}from"./headers.js";let p=function(e){if("u">typeof process)return process.env?.[e]},m=function(){let e=p("C15T_MANIFEST_REVALIDATE_SECONDS");if(void 0===e)return;if("false"===e)return!1;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=0?t:void 0},T=function(e){let t={host:new URL(e.url).host};for(let a of["x-forwarded-proto","x-forwarded-ssl","x-forwarded-host","host","referer"]){let n=e.headers.get(a);n&&(t[a]=n)}return t},v=function(e,t){return c(e,T(t))},R=function(e,t){let a=t.manifestURL??p("C15T_MANIFEST_URL");if(a){let t=v(a,e);if(!t)throw Error("@c15t/nextjs/api: invalid C15T_MANIFEST_URL.");return t}let n=t.backendURL??p("C15T_BACKEND_URL")??p("NEXT_PUBLIC_C15T_BACKEND_URL");if(!n)throw Error("@c15t/nextjs/api: configure C15T_BACKEND_URL or C15T_MANIFEST_URL.");let r=v(n,e);if(!r)throw Error("@c15t/nextjs/api: invalid C15T_BACKEND_URL.");return`${r}/manifest`},_=function(e,t){if(!t)return e;let a=new URL(e);return a.searchParams.set("language",t),a.toString()},C=function(e){return o(e,"s-maxage")},E=function(e){return e.manifestRevalidateSeconds??m()??300},b=function(t={}){let a=E(t);return{headers:{accept:"application/json",...e},method:"GET",next:{revalidate:a}}},w=async function(e,t={},a){let n=_(R(e,t),a??null),{headers:o,method:s,...l}=b(t),c=await r({fetch:t.fetch,headers:o,init:l,onBackgroundRevalidate:t.onBackgroundRevalidate,url:n}),f=c.headers["cache-control"]??"public, s-maxage=300, stale-while-revalidate=86400",u=C(f)??E(t);return{age:i(c),cacheControl:f,etag:c.headers.etag,manifest:c.manifest,revalidate:u,status:200}},x=function(t){return a({fetch:t.fetch,headers:e,label:"@c15t/nextjs/api",language:t.language,url:t.reference.url})},S=function(e){if(!g(e))return e;let{initURL:t,manifestURL:a,...n}=e;return n},L=function(e={}){let a=S(e);return{async GET(e){let{manifest:r}=await w(e,a),i=await n(e,e=>r.iab?.gvl?(a.fetchGvl??x)({fetch:a.fetch??globalThis.fetch.bind(globalThis),language:e,reference:r.iab.gvl}):Promise.resolve(null));if(i)return i;let o=f(r,d(e.headers),{baseTranslations:u}),c=e.headers.get(s);if(null!==c&&c.trim()!==String(l)&&(o.policyResolution={policy:null,reason:"unsupported-contract",status:"failed",version:l},delete o.policySnapshotToken,delete o.gvl),r.iab?.enabled===!0&&void 0!==r.iab.gvl&&o.policyResolution?.status==="matched"&&"iab"===o.policyResolution.policy.model&&r.iab?.gvl){let e=o.translations.language.split("-")[0]||"en";o.gvl=await (a.fetchGvl??x)({fetch:a.fetch??globalThis.fetch.bind(globalThis),language:e,reference:r.iab.gvl})}return Response.json(t(o,new URL(e.url).pathname),{headers:{"cache-control":"private, no-store",[s]:String(l)}})},async manifestGET(e){let t=new URL(e.url),n=await w(e,a,t.searchParams.get("language")),r=new Headers({age:String(n.age),"cache-control":n.cacheControl,"content-type":"application/json",[s]:String(l)});return n.etag&&r.set("etag",n.etag),r.set("x-c15t-next-revalidate",String(n.revalidate)),new Response(JSON.stringify(n.manifest),{headers:r,status:200})}}},N=L(),{GET:U}=N,{manifestGET:y}=N;export{U as GET,b as createManifestFetchInit,L as createNextConsentRouteHandlers,w as fetchCachedManifest,C as getSMaxAge,h as defineConsentConfig,y as manifestGET};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t=Symbol.for("@c15t/nextjs/consent-config"),e=function(t){if(t.startsWith("/"))return!t.startsWith("//");try{let e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}},n=function(t,n,i){if(void 0===n){if(i)throw TypeError(`@c15t/nextjs: defineConsentConfig needs \`${t}\`.`);return}if("string"!=typeof n||!e(n))throw TypeError(`@c15t/nextjs: defineConsentConfig \`${t}\` must be an absolute http(s) URL or a \`/\`-relative path, received ${JSON.stringify(n)}.`)},i=function(e){if("object"!=typeof e||null===e)throw TypeError("@c15t/nextjs: defineConsentConfig expects an object with `backendURL`.");return n("backendURL",e.backendURL,!0),n("manifestURL",e.manifestURL,!1),n("initURL",e.initURL,!1),e.initURL&&!e.manifestURL&&"production"!==globalThis.process?.env?.NODE_ENV&&console.warn("[c15t] defineConsentConfig: `initURL` without `manifestURL` sends browser init through `initURL`, but `resolveConsent` still calls the backend `/init` on every request. Set `manifestURL` to the same-origin manifest route so the server resolves init from the cached manifest too."),Object.freeze({[t]:!0,backendURL:e.backendURL,initURL:e.initURL,manifestURL:e.manifestURL})},o=function(e){return"object"==typeof e&&null!==e&&!0===e[t]};export{i as defineConsentConfig,o as isConsentConfig};
|
package/dist/devtools.js
ADDED
package/dist/headers.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{CONSENT_REQUEST_HEADER_NAMES,COUNTRY_HEADERS,REGION_HEADERS,consentInputsToOverrides,extractConsentRequestInputs,parseGlobalPrivacyControl}from"@c15t/schema/types";
|
package/dist/iab/styles.css
CHANGED