1.1.0 • Published 1 year ago

@tizy/hagreed_react v1.1.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Hagreed

Hagreed is a GDPR (General Data Protection Regulation) compliance support tool

Installation

This package is an offical extension of the default package to @tizy/hagreed to facilitate integration with React It works with a simple configuration and React.Context

First, go to hagreed.com and subscribe to a free or premium plan to obtain a token and register your website.

Using npm:

npm install @tizy/hagreed @tizy/hagreed_react

Usage

These examples are defined with the Next.js framework, but they can be adapted to all React applications.

import {HagreedProvider} from '@tizy/hagreed_react';

const hagreedConfig = {
    consentsFormList: []
    cookiesList: [],
    token: 'your token here'
}

return (
    <HagreedProvider hagreedConfig={hagreedConfig}>
        <Component {...pageProps}/>
        <div id="hagreed" className="hagreed" />
    </HagreedProvider>
)
import {HagreedContext} from '@tizy/hagreed_react';

export const FormComponent = () => {
    const hagreed = useContext(HagreedContext);
    useEffect(() => {
        if (!!hagreed) {
            hagreed.initForm();
        }
    }, [hagreed])
    
    return (
        ...
        <div className="hagreedForm" data-hagreed-id="contact" />
        ...
    )
};

Next.js

This package uses React.Context and by definition runs client side. \ For Next.js applications, you may need to add use-client to the top of the component or page that includes <HagreedProvider> or your context HagreedContext

Documentation

After subscribing to a plan and registering your website on hagreed.com, you will be able to download the complete documentation in the final step.

1.1.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.1

2 years ago

1.0.0-beta.0

2 years ago