@cookieyes/nextjs 0.1.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/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/index.cjs +109 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CookieYes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @cookieyes/nextjs
|
|
2
|
+
|
|
3
|
+
Next.js adapter for the CookieYes consent SDK. It re-exports the entire
|
|
4
|
+
`@cookieyes/react` surface, pre-marked with `"use client"` so it composes
|
|
5
|
+
cleanly with the App Router and Server Components.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cookieyes/nextjs
|
|
11
|
+
pnpm add @cookieyes/nextjs
|
|
12
|
+
yarn add @cookieyes/nextjs
|
|
13
|
+
bun add @cookieyes/nextjs
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Peer dependencies:** Next.js ≥ 14, React ≥ 18, React DOM ≥ 18
|
|
17
|
+
|
|
18
|
+
## Setup (App Router)
|
|
19
|
+
|
|
20
|
+
Create a client component that configures the runtime and renders the consent
|
|
21
|
+
UI. Because `createCookieYes()` and the components are client-side, this file
|
|
22
|
+
**must** start with `"use client"`.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
// components/consent-manager.tsx
|
|
26
|
+
"use client";
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
CookieBanner,
|
|
30
|
+
CookiePreferences,
|
|
31
|
+
RecallButton,
|
|
32
|
+
createCookieYes,
|
|
33
|
+
} from "@cookieyes/nextjs";
|
|
34
|
+
|
|
35
|
+
createCookieYes()
|
|
36
|
+
.mode("offline") // "offline" (cookie-only) | "self-hosted"
|
|
37
|
+
.regulation("GDPR") // "GDPR" | "CCPA"
|
|
38
|
+
.colorScheme("system") // "light" | "dark" | "system"
|
|
39
|
+
.mount();
|
|
40
|
+
|
|
41
|
+
export function CookieYesRoot() {
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<CookieBanner />
|
|
45
|
+
<CookiePreferences />
|
|
46
|
+
<RecallButton />
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then mount it in your root layout — the layout itself stays a Server Component:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
// app/layout.tsx
|
|
56
|
+
import { CookieYesRoot } from "@/components/consent-manager";
|
|
57
|
+
|
|
58
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
59
|
+
return (
|
|
60
|
+
<html lang="en">
|
|
61
|
+
<body>
|
|
62
|
+
{children}
|
|
63
|
+
<CookieYesRoot />
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Pages Router
|
|
71
|
+
|
|
72
|
+
The same `CookieYesRoot` component works in the Pages Router — render it in
|
|
73
|
+
`pages/_app.tsx` alongside your app:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import type { AppProps } from "next/app";
|
|
77
|
+
import { CookieYesRoot } from "@/components/consent-manager";
|
|
78
|
+
|
|
79
|
+
export default function App({ Component, pageProps }: AppProps) {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Component {...pageProps} />
|
|
83
|
+
<CookieYesRoot />
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## CCPA
|
|
90
|
+
|
|
91
|
+
For `regulation("CCPA")`, also render the opt-out dialog:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { CookieBanner, CookiePreferences, CookieOptOut, RecallButton } from "@cookieyes/nextjs";
|
|
95
|
+
|
|
96
|
+
// inside CookieYesRoot:
|
|
97
|
+
<>
|
|
98
|
+
<CookieBanner />
|
|
99
|
+
<CookiePreferences />
|
|
100
|
+
<CookieOptOut />
|
|
101
|
+
<RecallButton />
|
|
102
|
+
</>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## API
|
|
106
|
+
|
|
107
|
+
This package re-exports everything from `@cookieyes/react` — the builder
|
|
108
|
+
(`createCookieYes`), components (`CookieBanner`, `CookiePreferences`,
|
|
109
|
+
`CookieOptOut`, `RecallButton`, `GatedScript`, `GatedFrame`), headless
|
|
110
|
+
primitives (`Banner`, `Preferences`, `OptOut`), and all hooks (`useConsent`,
|
|
111
|
+
`useConsentActions`, `useConsentCategory`, `useRegulation`, …). See the
|
|
112
|
+
[`@cookieyes/react` README](../react#readme) for the full reference.
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
MIT — see [LICENSE](./LICENSE). The "Powered by CookieYes" attribution may not be removed on the free tier.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('@cookieyes/react');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "Banner", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return react.Banner; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "CookieBanner", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return react.CookieBanner; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "CookieOptOut", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return react.CookieOptOut; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "CookiePreferences", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return react.CookiePreferences; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "GatedFrame", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return react.GatedFrame; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "GatedScript", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return react.GatedScript; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "OptOut", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return react.OptOut; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "Preferences", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return react.Preferences; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "RecallButton", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return react.RecallButton; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "createCookieYes", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return react.createCookieYes; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "defaultTranslations", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return react.defaultTranslations; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "getCookieYes", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return react.getCookieYes; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "getOrCreateConsentRuntime", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return react.getOrCreateConsentRuntime; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "resetConsentRuntime", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return react.resetConsentRuntime; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "resetCookieYes", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return react.resetCookieYes; }
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "resolveTranslations", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () { return react.resolveTranslations; }
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "useBannerVisibility", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () { return react.useBannerVisibility; }
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "useConsent", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () { return react.useConsent; }
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "useConsentActions", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () { return react.useConsentActions; }
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "useConsentCategory", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () { return react.useConsentCategory; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "useConsentRuntime", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return react.useConsentRuntime; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "useOptOutOpen", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return react.useOptOutOpen; }
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "usePreferencesOpen", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () { return react.usePreferencesOpen; }
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, "useRegulation", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () { return react.useRegulation; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "useTranslations", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return react.useTranslations; }
|
|
107
|
+
});
|
|
108
|
+
//# sourceMappingURL=index.cjs.map
|
|
109
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs","sourcesContent":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ActiveUI, Banner, Builder, ColorSchemePref, ConsentActions, ConsentBackend, ConsentCategory, ConsentChangePayload, ConsentConfig, ConsentManager, ConsentPayload, ConsentRuntime, ConsentRuntimeMode, ConsentRuntimeOptions, ConsentSnapshot, ConsentStore, ConsentStoreState, CookieBanner, CookieOptOut, CookiePreferences, CookieYesRuntime, CookieYesSnapshot, GatedFrame, GatedScript, I18nConfig, OptOut, Preferences, RecallButton, Regulation, RuntimeMode, ScriptEntry, ThemeConfig, TranslationMap, createCookieYes, defaultTranslations, getCookieYes, getOrCreateConsentRuntime, resetConsentRuntime, resetCookieYes, resolveTranslations, useBannerVisibility, useConsent, useConsentActions, useConsentCategory, useConsentRuntime, useOptOutOpen, usePreferencesOpen, useRegulation, useTranslations } from '@cookieyes/react';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ActiveUI, Banner, Builder, ColorSchemePref, ConsentActions, ConsentBackend, ConsentCategory, ConsentChangePayload, ConsentConfig, ConsentManager, ConsentPayload, ConsentRuntime, ConsentRuntimeMode, ConsentRuntimeOptions, ConsentSnapshot, ConsentStore, ConsentStoreState, CookieBanner, CookieOptOut, CookiePreferences, CookieYesRuntime, CookieYesSnapshot, GatedFrame, GatedScript, I18nConfig, OptOut, Preferences, RecallButton, Regulation, RuntimeMode, ScriptEntry, ThemeConfig, TranslationMap, createCookieYes, defaultTranslations, getCookieYes, getOrCreateConsentRuntime, resetConsentRuntime, resetCookieYes, resolveTranslations, useBannerVisibility, useConsent, useConsentActions, useConsentCategory, useConsentRuntime, useOptOutOpen, usePreferencesOpen, useRegulation, useTranslations } from '@cookieyes/react';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { Banner, CookieBanner, CookieOptOut, CookiePreferences, GatedFrame, GatedScript, OptOut, Preferences, RecallButton, createCookieYes, defaultTranslations, getCookieYes, getOrCreateConsentRuntime, resetConsentRuntime, resetCookieYes, resolveTranslations, useBannerVisibility, useConsent, useConsentActions, useConsentCategory, useConsentRuntime, useOptOutOpen, usePreferencesOpen, useRegulation, useTranslations } from '@cookieyes/react';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cookieyes/nextjs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Next.js App Router adapter for the CookieYes consent SDK",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cookie consent",
|
|
7
|
+
"GDPR",
|
|
8
|
+
"CCPA",
|
|
9
|
+
"cookie banner",
|
|
10
|
+
"consent management",
|
|
11
|
+
"privacy",
|
|
12
|
+
"compliance",
|
|
13
|
+
"React",
|
|
14
|
+
"Next.js",
|
|
15
|
+
"TypeScript",
|
|
16
|
+
"open source"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/cookieyes/cookieyes/tree/main/sdk/nextjs#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/cookieyes/cookieyes/issues"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/cookieyes/cookieyes.git",
|
|
25
|
+
"directory": "sdk/nextjs"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"author": "CookieYes (https://www.cookieyes.com)",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"type": "module",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js",
|
|
35
|
+
"require": "./dist/index.cjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.cjs",
|
|
39
|
+
"module": "./dist/index.js",
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"next": ">=14.0.0",
|
|
54
|
+
"react": ">=18.0.0",
|
|
55
|
+
"react-dom": ">=18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@cookieyes/react": "0.1.0",
|
|
59
|
+
"@cookieyes/core": "0.1.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^24.12.4",
|
|
63
|
+
"@types/react": "^19.2.15",
|
|
64
|
+
"@types/react-dom": "^19.2.3",
|
|
65
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
66
|
+
"next": "^16.2.6",
|
|
67
|
+
"react": "^19.2.6",
|
|
68
|
+
"react-dom": "^19.2.6",
|
|
69
|
+
"tsup": "^8.5.1",
|
|
70
|
+
"typescript": "^6.0.3",
|
|
71
|
+
"vitest": "^4.1.7"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsup",
|
|
75
|
+
"dev": "tsup --watch",
|
|
76
|
+
"typecheck": "tsc --noEmit",
|
|
77
|
+
"test": "vitest run --coverage",
|
|
78
|
+
"clean": "rm -rf dist"
|
|
79
|
+
}
|
|
80
|
+
}
|