@reactizer/cookies
Reactizer's cookies.
Last updated 2 months ago by oreqizer .
MIT · Original npm · Tarball · package.json
$ cnpm install @reactizer/cookies 
SYNC missed versions from official npm registry.

@reactizer/cookies

An utility for handling GDPR cookie compliance.

API

Exports an useCookies hook, a CookiesProvider and a CookiesConsumer.

Just hook the CookiesProvider up on the client:

import { CookiesProvider } from "@reactizer/cookies";

<CookiesProvider>
  <Root />
</CookiesProvider>

Then use the useCookies hook:

import { useCookies } from "@reactizer/cookies";

const Component = () => {
  const cookies = useCookies();
}

Types:

export enum Level {
  NECESSARY = "necessary",
  PREFERENCES = "preferences",
  ANALYTICS = "analytics",
  MARKETING = "marketing",
}

export type Settings = {
  preferences: boolean;
  analytics: boolean;
  marketing: boolean;
};

// The context type
export type Cookies = {
  agreed: boolean;
  settings: Settings;
  onAgree: () => void; // marks cookies as agreed
  onChange: (settings: Settings) => void; // changes cookie settings
};

License

MIT

Current Tags

  • 0.32.0                                ...           latest (2 months ago)

8 Versions

  • 0.32.0                                ...           2 months ago
  • 0.31.2                                ...           2 months ago
  • 0.31.1                                ...           3 months ago
  • 0.31.0                                ...           3 months ago
  • 0.30.0                                ...           5 months ago
  • 0.29.0                                ...           a year ago
  • 0.28.1                                ...           a year ago
  • 0.28.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 7
Dependencies (1)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |