@use-cookie-consent/core
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "@use-cookie-consent/core", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "React hook for managing GDPR cookie consent state.", | ||
@@ -12,5 +12,3 @@ "main": "./build/cjs/index.js", | ||
"engines": { | ||
"node": ">=12", | ||
"npm": "<0", | ||
"yarn": "^1" | ||
"node": ">=12" | ||
}, | ||
@@ -17,0 +15,0 @@ "scripts": { |
@@ -10,2 +10,4 @@ # useCookieConsent hook for pure JavaScript projects | ||
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/bring.shrubbery) | ||
> Headless state management for GDPR cookie consent | ||
@@ -78,6 +80,6 @@ | ||
<button onClick={acceptAllCookies}>Accept all</button> | ||
<button onClick={() => acceptCookies({ thirdParty: true })}> | ||
<button onClick={() => acceptCookies({ necessary: true, thirdParty: true })}> | ||
Accept third-party | ||
</button> | ||
<button onClick={() => acceptCookies({ firstParty: true })}> | ||
<button onClick={() => acceptCookies({ necessary: true, firstParty: true })}> | ||
Accept first-party | ||
@@ -91,2 +93,19 @@ </button> | ||
### With custom cookie attributes | ||
```tsx | ||
import { useCookieConsent } from '@use-cookie-consent/core'; | ||
export const YourComponent = () => { | ||
const { consent, acceptAllCookies, declineAllCookies, acceptCookies } = useCookieConsent({ | ||
consentCookieAttributes: { expires: 180 } // 180 days | ||
}); | ||
return ( | ||
// ... | ||
); | ||
}; | ||
``` | ||
Cookie attributes for the underlying js-cookie package, more info [here](https://github.com/js-cookie/js-cookie). | ||
## API | ||
@@ -130,2 +149,3 @@ | ||
- [ ] Monorepo | ||
- [x] Add package bundler ([rollup](https://rollupjs.org/) was added) | ||
@@ -132,0 +152,0 @@ - [ ] Add support for Storage API |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43473
174