npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

strapi-plugin-cookie-manager

v1.2.3

Published

Strapi - Cookie Manager

Downloads

1,319

Readme

Strapi v4 - Cookie Manager

Manage categorized cookies directly within the Strapi CMS admin panel at one place and use the predefined plugin API to provide GDPR consent cookies.

🎉 Features

  • 🥞 Predefined API: Simple and ready for use API endpoint
  • 📦 Cookie Categories: Easly create categories and manage your cookies within
  • 💬 Internationalization: Possibility to localize your cookies supporting Strapi's I18n plugin
  • 👥 Duplicate: Maximize cookie creation efficiency by duplicating
  • 🌓 Light & Dark: Complete reuse of Strapi's design system components
  • 📢 GDPR Consent: Communicate transparently in the name of data privacy
  • 📍 One place: Manage everything related to cookies in one place

⚙️ Versions

  • Strapi v4 - (current) - v1.x

⏳ Installation

Make sure that the i18n plugin is installed within your strapi admin settings.

Then install the plugin with your desired package manager.

(It's recommended to use yarn to install this plugin within your Strapi project. Install yarn with these docs)

yarn add strapi-plugin-cookie-manager

# or

npm install strapi-plugin-cookie-manager

After successful installation you need to re-build your Strapi:

yarn build && yarn develop

# or

npm run build && npm run develop

or just run Strapis development mode with --watch-admin option

yarn develop --watch-admin

#or

npm run develop --watch-admin

Now the Cookie Manager should appear inside the Plugins section on the left hand sidebar like so:

You will notice that the plugin generated new content types named cookie, cookie-category and cookie-popup. Initially the relation fields are not populated for cookie and cookie-category! That means they won't show in your API.

In order to get them populated, just edit the following files like below:

./src/api/cookie/services/cookie.js

module.exports = createCoreService('api::cookie.cookie', ({ strapi }) => ({
  async find(params) {
    const { pagination } = await super.find(params);
    const results = await strapi.entityService.findMany("api::cookie.cookie", Object.assign(params, {
      populate: { category: true }
    }))

    return { results, pagination };
  },
}));

./src/api/cookie-category/services/cookie-category.js

module.exports = createCoreService('api::cookie-category.cookie-category', ({ strapi }) => ({
  async find(params) {
    const { pagination } = await super.find(params);
    const results = await strapi.entityService.findMany("api::cookie-category.cookie-category", Object.assign(params, {
      populate: { cookies: true }
    }))

    return { results, pagination }
  },
}));

This step is not required for the content type cookie-popup.

You might wanna check out API Fields to see the JSON response.

🔧 Configuration

Currently there is only one option for the plugin settings. You can change the plugin settings inside the Strapi admin panel under:

Strapi Settings -> Cookie Manager -> Configuration

Or you change it manually in your ./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  'cookie-manager': {
    enabled: true,
    config: {
      localization: true
    }
  },
  // ...
});

Options

| Option | Type | Default | | ---------------- | ---------------- | ------- | | localization | Boolean | true |

🔌 API Fields

Category

{
  "name": "Necessary Cookies",
  "description": "These cookies are required to enable the basic features of this site, such as adjusting your consent preferences. These cookies do not share any personally identifiable data.",
  "isNecessary": true,
  "key": "necessary-cookies",
  "cookies": {
    "data": [
      {
        "attributes": {
          "name": "Cookies Necessary",
          "description": "We set this cookie to remember the consent of users for the use of cookies in the \"Necessary\" category.",
          "host": "mydomain.com",
          "party": "First-party",
          "isVisible": true,
          "duration": {
            "days": 365,
            "hours": 0,
            "minutes": 0
          },
          "locale": "en"
        }
      }
    ]
  },
  "locale": "en"
}

Cookie

{
  "name": "Cookies Necessary",
  "description": "We set this cookie to remember the consent of users for the use of cookies in the \"Necessary\" category.",
  "host": "mydomain.com",
  "party": "First-party",
  "isVisible": true,
  "duration": {
    "days": 365,
    "hours": 0,
    "minutes": 0
  },
  "category": {
    "data": {
      "attributes": {
        "name": "Necessary Cookies",
        "description": "These cookies are required to enable the basic features of this site, such as adjusting your consent preferences. These cookies do not share any personally identifiable data.",
        "locale": "en"
      }
    }
  },
  "key": "necessary-cookies",
  "locale": "en"
}

Popup

{
  "title": "We value your privacy",
  "description": "We use cookies to help you navigate efficiently. You will find detailed information about all cookies under each category below. The cookies that are categorized as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. We also use third-party cookies that help analyze how you use our website in order to provide the content and advertisements that are relevant to you. These cookies will only be stored in your browser with your prior consent. You can choose to enable or disable some or all of these cookies but disabling some of them may affect your browsing experience.",
  "buttons": [
    {
      "buttonTyp": "Primary",
      "label": "Button"
    }
  ],
  "locale": "en"
}

👉 Good to know

The i18n plugin must be installed by default, even if you change the config to disabled! Disabling just hides the possibility to edit on multiple locales.

This plugin generates content types cookies and cookie-categories in your content manager (not plugin content type). Those will be hidden inside the content manager per default.

🤝 Contributing

If you like to enhance, fix or just helping improving the quality or security of the code. Feel free to fork and make a pull request to bring this plugin further ahead. All inputs are welcome!

❤️ Support the plugin

If this plugin was helpful, dont hesitate giving a ⭐️.

✨ Special Thanks for contributing

@Daedalus, @Eventyret, @derrickmehaffy, @kirdk, @dimitribarbot

🔗 Links

📝 Licence

MIT Licence copyright (c) 2022 eigengrau GmbH & Strapi Solutions