@c15t/nextjs 2.0.0-rc.0 → 2.0.0-rc.10
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/README.md +10 -3
- package/client/components/consent-dialog-link.js +3 -0
- package/dist/headless.cjs +1 -1
- package/dist/iab/styles.css +12 -0
- package/dist/iab/styles.tw3.css +14 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/libs/browser-initial-data.cjs +1 -0
- package/dist/libs/browser-initial-data.js +1 -0
- package/dist/libs/initial-data.cjs +1 -1
- package/dist/libs/initial-data.js +1 -1
- package/dist/styles.css +10 -0
- package/dist/styles.tw3.css +13 -0
- package/dist/types.cjs +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/{dist → dist-types}/headless.d.ts +0 -1
- package/{dist → dist-types}/index.d.ts +3 -2
- package/dist-types/libs/browser-initial-data.d.ts +9 -0
- package/{dist → dist-types}/libs/initial-data.d.ts +7 -2
- package/dist-types/types.d.ts +38 -0
- package/dist-types/version.d.ts +1 -0
- package/docs/README.md +73 -0
- package/docs/building-headless-components.md +377 -0
- package/docs/callbacks.md +184 -0
- package/docs/components/consent-banner.md +269 -0
- package/docs/components/consent-dialog-link.md +59 -0
- package/docs/components/consent-dialog-trigger.md +103 -0
- package/docs/components/consent-dialog.md +177 -0
- package/docs/components/consent-manager-provider.md +425 -0
- package/docs/components/consent-widget.md +133 -0
- package/docs/components/dev-tools.md +63 -0
- package/docs/components/frame.md +73 -0
- package/docs/concepts/client-modes.md +175 -0
- package/docs/concepts/consent-categories.md +97 -0
- package/docs/concepts/consent-models.md +116 -0
- package/docs/concepts/cookie-management.md +122 -0
- package/docs/concepts/glossary.md +23 -0
- package/docs/concepts/initialization-flow.md +148 -0
- package/docs/concepts/policy-packs.md +229 -0
- package/docs/headless.md +190 -0
- package/docs/hooks/use-color-scheme.md +40 -0
- package/docs/hooks/use-consent-manager/checking-consent.md +94 -0
- package/docs/hooks/use-consent-manager/location-info.md +95 -0
- package/docs/hooks/use-consent-manager/overview.md +420 -0
- package/docs/hooks/use-consent-manager/setting-consent.md +92 -0
- package/docs/hooks/use-draggable.md +57 -0
- package/docs/hooks/use-focus-trap.md +41 -0
- package/docs/hooks/use-reduced-motion.md +35 -0
- package/docs/hooks/use-ssr-status.md +31 -0
- package/docs/hooks/use-text-direction.md +49 -0
- package/docs/hooks/use-translations.md +118 -0
- package/docs/iab/consent-banner.md +94 -0
- package/docs/iab/consent-dialog.md +134 -0
- package/docs/iab/overview.md +126 -0
- package/docs/iab/use-gvl-data.md +20 -0
- package/docs/iframe-blocking.md +107 -0
- package/docs/integrations/building-integrations.md +405 -0
- package/docs/integrations/databuddy.md +203 -0
- package/docs/integrations/google-tag-manager.md +153 -0
- package/docs/integrations/google-tag.md +122 -0
- package/docs/integrations/linkedin-insights.md +109 -0
- package/docs/integrations/meta-pixel.md +342 -0
- package/docs/integrations/microsoft-uet.md +112 -0
- package/docs/integrations/overview.md +105 -0
- package/docs/integrations/posthog.md +199 -0
- package/docs/integrations/tiktok-pixel.md +113 -0
- package/docs/integrations/x-pixel.md +143 -0
- package/docs/internationalization.md +197 -0
- package/docs/network-blocker.md +178 -0
- package/docs/optimization.md +234 -0
- package/docs/policy-packs.md +246 -0
- package/docs/quickstart.md +161 -0
- package/docs/script-loader.md +321 -0
- package/docs/server-side.md +176 -0
- package/docs/styling/classnames.md +92 -0
- package/docs/styling/color-scheme.md +82 -0
- package/docs/styling/css-variables.md +92 -0
- package/docs/styling/overview.md +456 -0
- package/docs/styling/slots.md +127 -0
- package/docs/styling/tailwind.md +113 -0
- package/docs/styling/tokens.md +216 -0
- package/docs/troubleshooting.md +146 -0
- package/iab/styles.css +1 -0
- package/package.json +38 -17
- package/readme.json +4 -0
- package/src/iab/styles.css +12 -0
- package/src/iab/styles.tw3.css +14 -0
- package/src/styles.css +10 -0
- package/src/styles.tw3.css +13 -0
- package/styles.css +1 -0
- package/dist/headless.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/libs/initial-data.d.ts.map +0 -1
- package/dist/types.d.ts +0 -16
- package/dist/types.d.ts.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
[](https://github.com/c15t/c15t)
|
|
13
13
|
[](https://github.com/c15t/c15t/actions/workflows/ci.yml)
|
|
14
|
-
[](https://github.com/c15t/c15t/blob/main/LICENSE.md)
|
|
15
15
|
[](https://c15t.link/discord)
|
|
16
16
|
[](https://www.npmjs.com/package/@c15t/nextjs)
|
|
17
17
|
[](https://github.com/c15t/c15t)
|
|
@@ -63,6 +63,13 @@ The CLI will:
|
|
|
63
63
|
pnpm add @c15t/nextjs
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
Then add the prebuilt stylesheet to your app-level CSS entrypoint:
|
|
67
|
+
|
|
68
|
+
```css
|
|
69
|
+
/* app/globals.css */
|
|
70
|
+
@import "@c15t/nextjs/styles.css";
|
|
71
|
+
```
|
|
72
|
+
|
|
66
73
|
To manually install, follow the guide in our [docs – manual setup](https://c15t.com/docs/frameworks/nextjs/quickstart#manual-setup).
|
|
67
74
|
|
|
68
75
|
## Usage
|
|
@@ -126,8 +133,8 @@ Our preference is that you make use of GitHub's private vulnerability reporting
|
|
|
126
133
|
|
|
127
134
|
## License
|
|
128
135
|
|
|
129
|
-
[
|
|
136
|
+
[Apache License 2.0](https://github.com/c15t/c15t/blob/main/LICENSE.md)
|
|
130
137
|
|
|
131
138
|
---
|
|
132
139
|
|
|
133
|
-
**Built
|
|
140
|
+
**Built by [Inth](https://inth.com?utm_source=github&utm_medium=repopage_%40c15t%2Fnextjs)**
|
package/dist/headless.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"@c15t/react/headless"(e){e.exports=require("@c15t/react/headless")}},__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};for(var __rspack_i in(()=>{__webpack_require__.r(__webpack_exports__);var e=__webpack_require__("@c15t/react/headless"),_={};for(let r in e)"default"!==r&&(_[r]=()=>e[r]);__webpack_require__.d(__webpack_exports__,_)})(),__webpack_exports__)exports[__rspack_i]=__webpack_exports__[__rspack_i];Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @c15t/nextjs — IAB TCF component styles.
|
|
3
|
+
*
|
|
4
|
+
* Add this stylesheet to the same global CSS entrypoint as your base c15t styles
|
|
5
|
+
* when using IAB consent components in Next.js. Do not import either stylesheet
|
|
6
|
+
* from JS/TSX.
|
|
7
|
+
*
|
|
8
|
+
* Usage (app/globals.css):
|
|
9
|
+
* @import "@c15t/nextjs/styles.css";
|
|
10
|
+
* @import "@c15t/nextjs/iab/styles.css";
|
|
11
|
+
*/
|
|
12
|
+
@import "@c15t/react/iab/styles.css";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @c15t/nextjs/iab — Tailwind 3-compatible IAB component styles.
|
|
3
|
+
*
|
|
4
|
+
* Add this stylesheet to the same global CSS entrypoint as your base c15t styles.
|
|
5
|
+
* Do not import either stylesheet from JS/TSX files.
|
|
6
|
+
*
|
|
7
|
+
* Usage (app/globals.css):
|
|
8
|
+
* @tailwind base;
|
|
9
|
+
* @tailwind components;
|
|
10
|
+
* @import "@c15t/nextjs/styles.tw3.css";
|
|
11
|
+
* @import "@c15t/nextjs/iab/styles.tw3.css";
|
|
12
|
+
* @tailwind utilities;
|
|
13
|
+
*/
|
|
14
|
+
@import "@c15t/react/iab/styles.tw3.css";
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"./libs/browser-initial-data"(e){e.exports=require("./libs/browser-initial-data.cjs")},"./libs/initial-data"(e){e.exports=require("./libs/initial-data.cjs")},"@c15t/react"(e){e.exports=require("@c15t/react")},c15t(e){e.exports=require("c15t")}},__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};for(var __rspack_i in(()=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{C15tPrefetch:()=>t.C15tPrefetch,buildPrefetchScript:()=>r.buildPrefetchScript,fetchInitialData:()=>a.fetchInitialData});var e=__webpack_require__("@c15t/react"),_={};for(let r in e)0>["fetchInitialData","default","buildPrefetchScript","C15tPrefetch"].indexOf(r)&&(_[r]=()=>e[r]);__webpack_require__.d(__webpack_exports__,_);var r=__webpack_require__("c15t"),t=__webpack_require__("./libs/browser-initial-data"),a=__webpack_require__("./libs/initial-data")})(),exports.C15tPrefetch=__webpack_exports__.C15tPrefetch,exports.buildPrefetchScript=__webpack_exports__.buildPrefetchScript,exports.fetchInitialData=__webpack_exports__.fetchInitialData,__webpack_exports__)-1===["C15tPrefetch","buildPrefetchScript","fetchInitialData"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export*from"@c15t/react";export{buildPrefetchScript}from"c15t";export{C15tPrefetch}from"./libs/browser-initial-data.js";export{fetchInitialData}from"./libs/initial-data.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{C15tPrefetch:()=>C15tPrefetch});const jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_c15t_namespaceObject=require("c15t"),script_namespaceObject=require("next/script");var script_default=__webpack_require__.n(script_namespaceObject);const DEFAULT_SCRIPT_ID="c15t-initial-data-prefetch";function C15tPrefetch({id:e="c15t-initial-data-prefetch",..._}){return(0,jsx_runtime_namespaceObject.jsx)(script_default(),{id:e,strategy:"beforeInteractive",children:(0,external_c15t_namespaceObject.buildPrefetchScript)(_)})}for(var __rspack_i in exports.C15tPrefetch=__webpack_exports__.C15tPrefetch,__webpack_exports__)-1===["C15tPrefetch"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{buildPrefetchScript as r}from"c15t";import e from"next/script";function i({id:c="c15t-initial-data-prefetch",...o}){return t(e,{id:c,strategy:"beforeInteractive",children:r(o)})}export{i as C15tPrefetch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{fetchInitialData:()=>fetchInitialData});const server_namespaceObject=require("@c15t/react/server"),cache_namespaceObject=require("next/cache"),headers_namespaceObject=require("next/headers"),DEFAULT_REVALIDATE_SECONDS=1;async function fetchInitialData(e){let _=await (0,headers_namespaceObject.headers)(),r=(0,server_namespaceObject.normalizeBackendURL)(e.backendURL,_);if(!r)return;let a=e.nextCache?.revalidateSeconds;if(!1===a)return(0,server_namespaceObject.fetchSSRData)({...e,backendURL:r,headers:_});let t=(0,server_namespaceObject.createSSRInitCacheKey)({normalizedURL:r,headers:_,overrides:e.overrides});return(0,cache_namespaceObject.unstable_cache)(()=>(0,server_namespaceObject.fetchSSRData)({...e,backendURL:r,headers:_}),["c15t:nextjs:fetchInitialData",t],{revalidate:a??1})()}for(var __rspack_i in exports.fetchInitialData=__webpack_exports__.fetchInitialData,__webpack_exports__)-1===["fetchInitialData"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fetchSSRData as t}from"@c15t/react/server";import{headers as
|
|
1
|
+
import{createSSRInitCacheKey as e,fetchSSRData as t,normalizeBackendURL as a}from"@c15t/react/server";import{unstable_cache as r}from"next/cache";import{headers as n}from"next/headers";async function c(c){let i=await n(),o=a(c.backendURL,i);if(!o)return;let d=c.nextCache?.revalidateSeconds;return!1===d?t({...c,backendURL:o,headers:i}):r(()=>t({...c,backendURL:o,headers:i}),["c15t:nextjs:fetchInitialData",e({normalizedURL:o,headers:i,overrides:c.overrides})],{revalidate:d??1})()}export{c as fetchInitialData};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @c15t/nextjs — Non-IAB prebuilt component styles.
|
|
3
|
+
*
|
|
4
|
+
* Import this stylesheet once from your app-level CSS entrypoint when using
|
|
5
|
+
* prebuilt (styled) consent components.
|
|
6
|
+
*
|
|
7
|
+
* Usage (app/globals.css):
|
|
8
|
+
* @import "@c15t/nextjs/styles.css";
|
|
9
|
+
*/
|
|
10
|
+
@import "@c15t/react/styles.css";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @c15t/nextjs — Tailwind 3-compatible prebuilt component styles.
|
|
3
|
+
*
|
|
4
|
+
* Import this stylesheet in the same global CSS entrypoint as Tailwind 3,
|
|
5
|
+
* after `@tailwind components;` and before `@tailwind utilities;`.
|
|
6
|
+
*
|
|
7
|
+
* Usage (app/globals.css):
|
|
8
|
+
* @tailwind base;
|
|
9
|
+
* @tailwind components;
|
|
10
|
+
* @import "@c15t/nextjs/styles.tw3.css";
|
|
11
|
+
* @tailwind utilities;
|
|
12
|
+
*/
|
|
13
|
+
@import "@c15t/react/styles.tw3.css";
|
package/dist/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};for(var __rspack_i in __webpack_require__.r(__webpack_exports__),__webpack_exports__)exports[__rspack_i]=__webpack_exports__[__rspack_i];Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/version.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{version:()=>version});const version="2.0.0-rc.10";for(var __rspack_i in exports.version=__webpack_exports__.version,__webpack_exports__)-1===["version"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e="2.0.0-rc.
|
|
1
|
+
let e="2.0.0-rc.10";export{e as version};
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @see {@link ./middleware} for Next.js middleware integration
|
|
9
9
|
*/
|
|
10
10
|
export * from '@c15t/react';
|
|
11
|
+
export { buildPrefetchScript, type PrefetchOptions } from 'c15t';
|
|
12
|
+
export { C15tPrefetch } from './libs/browser-initial-data';
|
|
11
13
|
export { fetchInitialData } from './libs/initial-data';
|
|
12
|
-
export type { FetchInitialDataOptions, InitialDataPromise,
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
14
|
+
export type { C15tPrefetchProps, ConsentManagerProps, FetchInitialDataOptions, InitialDataPromise, } from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { C15tPrefetchProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Next.js script component that starts `/init` prefetching before hydration.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Use in `app/layout.tsx` for static routes. Matching prefetched data is
|
|
7
|
+
* consumed automatically by the runtime during first store initialization.
|
|
8
|
+
*/
|
|
9
|
+
export declare function C15tPrefetch({ id, ...options }: C15tPrefetchProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,8 +21,13 @@ import type { FetchInitialDataOptions } from '../types';
|
|
|
21
21
|
* backendURL: '/api/consent',
|
|
22
22
|
* debug: process.env.NODE_ENV === 'development'
|
|
23
23
|
* });
|
|
24
|
-
* return
|
|
24
|
+
* return (
|
|
25
|
+
* <ConsentManagerProvider
|
|
26
|
+
* options={{ mode: 'hosted', backendURL: '/api/consent', ssrData: initialData }}
|
|
27
|
+
* >
|
|
28
|
+
* {children}
|
|
29
|
+
* </ConsentManagerProvider>
|
|
30
|
+
* )
|
|
25
31
|
* ```
|
|
26
32
|
*/
|
|
27
33
|
export declare function fetchInitialData(options: FetchInitialDataOptions): Promise<SSRInitialData | undefined>;
|
|
28
|
-
//# sourceMappingURL=initial-data.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ConsentManagerProviderProps } from '@c15t/react';
|
|
2
|
+
import type { FetchSSRDataOptionsBase } from '@c15t/react/server';
|
|
3
|
+
import type { PrefetchOptions } from 'c15t';
|
|
4
|
+
export type InitialDataPromise = NonNullable<ConsentManagerProviderProps['options']['store']>['ssrData'];
|
|
5
|
+
export interface NextCacheOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Cache lifetime in seconds for the Next.js data cache.
|
|
8
|
+
* Set to false to disable Next.js caching for this call.
|
|
9
|
+
*
|
|
10
|
+
* @default 1
|
|
11
|
+
*/
|
|
12
|
+
revalidateSeconds?: number | false;
|
|
13
|
+
}
|
|
14
|
+
export interface C15tPrefetchProps extends PrefetchOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Optional script element ID.
|
|
17
|
+
*
|
|
18
|
+
* @default 'c15t-initial-data-prefetch'
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for the fetchInitialData function.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Uses the base options from @c15t/react/server - headers are
|
|
27
|
+
* resolved automatically from Next.js.
|
|
28
|
+
*/
|
|
29
|
+
export interface FetchInitialDataOptions extends FetchSSRDataOptionsBase {
|
|
30
|
+
/**
|
|
31
|
+
* Optional Next.js cache controls for SSR init requests.
|
|
32
|
+
*/
|
|
33
|
+
nextCache?: NextCacheOptions;
|
|
34
|
+
}
|
|
35
|
+
export interface ConsentManagerProps {
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
ssrData?: InitialDataPromise;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version = "2.0.0-rc.10";
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# c15t Next.js Docs
|
|
2
|
+
|
|
3
|
+
Next.js-focused c15t docs for consent UI, server-side behavior, callbacks, and integrations.
|
|
4
|
+
|
|
5
|
+
If you are changing consent flows, consent UI, script loading, server-side setup, or backend configuration in an app that uses this package, start here before editing code.
|
|
6
|
+
|
|
7
|
+
## Start Here
|
|
8
|
+
|
|
9
|
+
- [Quickstart](./quickstart.md)
|
|
10
|
+
- [Server Side](./server-side.md)
|
|
11
|
+
- [Callbacks](./callbacks.md)
|
|
12
|
+
- [Script Loader](./script-loader.md)
|
|
13
|
+
- [Google Tag Manager](./integrations/google-tag-manager.md)
|
|
14
|
+
|
|
15
|
+
## Workflow Rules
|
|
16
|
+
|
|
17
|
+
### Server-Side Setup
|
|
18
|
+
|
|
19
|
+
Use this when:
|
|
20
|
+
- working on App Router or SSR consent initialization
|
|
21
|
+
- connecting the provider to server-fetched consent data
|
|
22
|
+
- deciding whether client-only setup is sufficient
|
|
23
|
+
|
|
24
|
+
Prefer:
|
|
25
|
+
- Prefer the documented server helpers and provider setup.
|
|
26
|
+
- Use the server-side integration path before inventing custom cookie or init plumbing.
|
|
27
|
+
|
|
28
|
+
Avoid:
|
|
29
|
+
- Do not default to client-only initialization when the documented SSR flow already covers the use case.
|
|
30
|
+
|
|
31
|
+
Read next:
|
|
32
|
+
- [Quickstart](./quickstart.md)
|
|
33
|
+
- [Server Side](./server-side.md)
|
|
34
|
+
|
|
35
|
+
### Styling
|
|
36
|
+
|
|
37
|
+
Use this when:
|
|
38
|
+
- customizing component appearance in a Next.js app
|
|
39
|
+
- deciding how to override the default consent UI
|
|
40
|
+
|
|
41
|
+
Prefer:
|
|
42
|
+
- Prefer design tokens first.
|
|
43
|
+
- If tokens are not enough, use component slots.
|
|
44
|
+
- Then use CSS variables or `className` for targeted overrides.
|
|
45
|
+
|
|
46
|
+
If that is not enough:
|
|
47
|
+
- Use `noStyle` or headless only as a last resort.
|
|
48
|
+
|
|
49
|
+
Avoid:
|
|
50
|
+
- Do not rebuild the consent UI if the documented styling layers can express the design.
|
|
51
|
+
|
|
52
|
+
Read next:
|
|
53
|
+
- [Overview](./styling/overview.md)
|
|
54
|
+
- [Tokens](./styling/tokens.md)
|
|
55
|
+
- [Slots](./styling/slots.md)
|
|
56
|
+
|
|
57
|
+
### Scripts & Integrations
|
|
58
|
+
|
|
59
|
+
Use this when:
|
|
60
|
+
- wiring scripts through Next.js routes, layouts, or providers
|
|
61
|
+
- adding analytics or advertising behind consent
|
|
62
|
+
|
|
63
|
+
Prefer:
|
|
64
|
+
- Prefer premade scripts from `@c15t/scripts/*`.
|
|
65
|
+
- Start from the integration docs before wiring scripts through Next-specific code paths.
|
|
66
|
+
|
|
67
|
+
Avoid:
|
|
68
|
+
- Do not use custom script injection when a documented integration already exists.
|
|
69
|
+
|
|
70
|
+
Read next:
|
|
71
|
+
- [Script Loader](./script-loader.md)
|
|
72
|
+
- [Google Tag Manager](./integrations/google-tag-manager.md)
|
|
73
|
+
- [Meta Pixel](./integrations/meta-pixel.md)
|