Coder Social home page Coder Social logo

chiiya / haven Goto Github PK

View Code? Open in Web Editor NEW
73.0 5.0 5.0 518 KB

๐Ÿ›ก๏ธ Fully-featured, GDPR-ready cookie consent manager

Home Page: https://chiiya.github.io/haven/

License: MIT License

JavaScript 2.08% TypeScript 97.39% Shell 0.53%
cookie-consent gdpr eprivacy cookies cookie-notification

haven's People

Contributors

chiiya avatar dependabot-preview[bot] avatar grsmto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

haven's Issues

How to fix `Replacing an existing Haven instance. Are you sure this behaviour is intended?`

Hi,

First of all, a big thank you for creating this package. It's really helpful.

I'd like to know if it would be possible for you to instead of console.warn("Replacing an existing Haven instance. Are you sure this behaviour is intended?");if you could simply return the existing instance.

create would be like this

  public static create(options: Partial<HavenOptions>): Haven {
    if (Haven.instance) {
      return Haven.instance
    } else {
      Haven.instance = new Haven(options);
      Haven.instance.init();
      return Haven.instance;
  }
}

If we have already an instance then there's no point in creating a new one right?

In my code I'm doing

const havenInstance = Haven.getInstance()
if (!havenInstance) {
    Haven.create(options)
}

But now I'm getting a console error because getInstance() has this console.error("No Haven instance found. Make sure to create a Haven instance before attempting to access it.")

Thank you

Enabling a cookie type from preferences should hide notification bar

Hi!

If a user enables a cookie type from the preferences panel (if user clicks directly on "settings" instead of accepting or declining all), the notification bar still shows up all the time. Even though the user explicitly chose his preferences.
I think the bar should hide since we can suppose the user has chosen at that point.
I had a look and I think whenever enableCookies is called, it should set every untouched cookies to their default value (false in that case).

What do you think?

Support for "anonymizeIp" option in Google Analytics?

I love your simple injection implementation. How can I set the anonymizeIp option, though? Normally I add this to my analytics call:

ga('send', 'pageview', {
  'anonymizeIp': true
});

Is it enough to add it to the options array? I tried this but I'm not sure if it's working:

<script>
    Haven.create({
        services: [
            {
                name: 'google-analytics',
                purposes: ['analytics'],
                type: 'google-analytics',
                inject: true,
                options: {
                    id: 'BLAH',
                    anonymizeIp: true,
                }
            }
        ]
    });
</script>

Cookie preferences instantiation only at page load

Hi,

The cookie preference is only instanciated at page load, meaning that if you use the plugin with client side routing (like with React or any other framework) it doesn't work.

The workaround I found is to do the following:

const haven = Haven.getInstance();

if (haven) {
  // @ts-ignore
  haven.cookiePreferences.init();
}

Of course that's an ugly hack and I think there could be an API for that!

Thanks!

SSR Compatibility (React/Gatsby)

Hi there

Firstly, thanks for creating ๐Ÿ‘

Not sure if its a typo but _import Haven from '@chiiya@haven'; didn't work for me, but import Haven from '@chiiya/haven'; did..

Resolved my reactjs issues, Monday mind block :)

How to configure notification style?

The docs mention configuring the notification style, but doesn't give an example. Neither of these seem to work:

<script>
Haven.create({
    notification: {
        policyUrl: "blah.com",
        background: '#428bca',
        textColor: '#ffffff',
        style: {
            background: '#428bca',
            textColor: '#ffffff',
        },
    },
...
});
</script>

Thanks!

Edit: I saw in the cookie preferences docs that we need to use styles (plural) instead of style. I tried this for the notification and it works. Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.