Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@use-cookie-consent/core
Advanced tools
:warning: This repository was transferred: As part of the roadmap for a major release, the repository was transferred to an organisation for easier scoping or library specific packages.
Although code in this repository is oriented to satisfy GDPR cookie rules, neither author nor contributors to this repository will be responsible for any non-compliance with the law. Please make sure that this repository provides all the functionality to satisfy requirements for your project. If you find something that can be improved please create an issue or send a PR with your fixes!
This hook is made to make managing cookie consent state easier. Although it might seem like a React thing, it's framework agnostic, and if you want to have best experience with React.js you should use this (not yet done) package. It is following this GDPR cookie guide which describes what you need for GDPR compliance. This hook mainly focuses handling the consent state of the different types of cookies as described in "Types of Cookies" in this page. Summarizing the mentioned document, there are three different ways to classify cookies:
The hook in this repository will provide a way to manage these types of cookies.
This package can be easily installed using npm
:
npm i @use-cookie-consent/core
Or yarn
:
yarn add @use-cookie-consent/core
import {useCookieConsent} from '@use-cookie-consent/core';
export const YourComponent = () => {
const {consent, acceptAllCookies, declineAllCookies, acceptCookies} =
useCookieConsent();
return (
<div>
<h3>
{`Third-party cookies ${consent.thirdParty ? 'approved' : 'rejected'}`}
</h3>
<h3>
{`First-party cookies ${consent.firstParty ? 'approved' : 'rejected'}`}
</h3>
<button onClick={acceptAllCookies}>Accept all</button>
<button onClick={() => acceptCookies({thirdParty: true})}>
Accept third-party
</button>
<button onClick={() => acceptCookies({firstParty: true})}>
Accept first-party
</button>
<button onClick={declineAllCookies}>Reject all</button>
</div>
);
};
useCookieConsent(options)
useCookieConsent
is the main hook in this library. You call it whenever you need to accept, decline, set or get cookies - so anything to do with cookies.
useCookieConsent({
defaultConsent?: CookieConsent,
consentCookieAttributes?: CookieAttributes;
})
This hook function returns following object:
{
consent: {
session?: boolean;
persistent?: boolean;
necessary?: boolean;
preferences?: boolean;
statistics?: boolean;
marketing?: boolean;
firstParty?: boolean;
thirdParty?: boolean;
};
acceptCookies: (cookies: CookieTypes) => void;
declineAllCookies: () => void;
acceptAllCookies: () => void;
didAcceptAll: () => boolean;
didDeclineAll: (opts?: CookieDeclineOptions) => boolean;
cookies: CookieWrapper;
}
CookiesWrapper
API to something that doesn't require a specific dependency (maybe just Storage API step?).Following package was used as a starter for this project:
FAQs
React hook for managing GDPR cookie consent state.
The npm package @use-cookie-consent/core receives a total of 359 weekly downloads. As such, @use-cookie-consent/core popularity was classified as not popular.
We found that @use-cookie-consent/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.