1.7.0 • Published 4 years ago

@uncinc/react-cookie-compliance v1.7.0

Weekly downloads
178
License
Apache-2.0
Repository
github
Last release
4 years ago

@uncinc/react-cookie-compliance

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

1) Go to the ./example directory

2) Run yarn install

3) 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.

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

2) 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

1.7.0

4 years ago

1.6.0

4 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.5

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.8

6 years ago

1.3.7

6 years ago

1.3.6

6 years ago

1.3.5

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago