Socket
Book a DemoInstallSign in
Socket

@uncinc/react-cookie-compliance

Package Overview
Dependencies
Maintainers
10
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uncinc/react-cookie-compliance

GDPR friendly cookie compliance popup to prompt the user for consent.

latest
Source
npmnpm
Version
1.7.0
Version published
Weekly downloads
4
Maintainers
10
Weekly downloads
 
Created
Source

GDPR friendly cookie compliance popup to prompt the user for consent, built with ImmutableJS.

NPM JavaScript Style Guide

Install

  • Yarn: yarn add @uncinc/react-cookie-compliance
  • NPM: npm install --save @uncinc/react-cookie-compliance

Usage

The cookie name being stored is named cookie-compliance-consent.

import React, { Component } from 'react';
import { combineReducers } from 'redux-immutable';

import CookieCompliancePopup, { cookieComplianceReducer } from '@uncinc/react-cookie-compliance';

// Add the reducer.
const rootReducer = combineReducers({
  cookieCompliance: cookieComplianceReducer,
  ...
});

...

class Example extends Component {
  render () {
    return (
      <CookieCompliancePopup agreeText="Yes" disagreeText="No">
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at
          pulvinar quam. Suspendisse pellentesque feugiat sagittis. Donec
          dapibus enim nec consectetur venenatis. Curabitur quis vehicula mi.
          &nbsp;
          <a href="https://example.com" target="_blank" rel="noopener noreferrer">
            I want to read more!
          </a>
        </p>
      </CookieCompliancePopup>
    );
  }
}

Development

  • Go to the ./example directory

  • Run yarn install

  • Run yarn start

Publishing (testing)

If you want to test locally before publishing you have to use npm pack. Normally you can use yarn link or npm link but since we have a connected component, this does not work because it will use react-redux from dev-dependencies instead of the react-redux from the main app. Besides, using npm pack emulates a package at its best.

  • In the root run npm pack, this will generate <package-name>-<package-version>.tgz

  • Go to your main app (where you use this package) and run:

# Absolute path
yarn add file:///path/to/my-lib/my-lib-1.0.0.tgz

# OR

# Relative path
yarn add ../../path/to/my-lib/my-lib-1.0.0.tgz

Publishing to NPM

Run npm publish.

Make sure that any npm modules you want as peer dependencies are properly marked as peerDependencies in package.json. The rollup config will automatically recognize them as peers and not try to bundle them in your module.

License

Apache License 2.0 © Unc Inc

Keywords

GDPR

FAQs

Package last updated on 21 May 2021

Did you know?

Socket

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.

Install

Related posts