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

@somosus/ngx-cookie-consent

v1.1.3

Published

Angular module to display a cookie consent banner without other dependencies.

Downloads

1

Readme

@somosus/ngx-cookie-consent

IMPORTANT: This is a package updated by me and done by @giacomo, I've just publish it here to use the Portuguese version while it's not accepted to the final version of the original package

Angular multi-language module to display a cookie consent banner without other dependencies.

Works with Angular v14+
Available languages: English, German, Italian, Portuguese (Brazil)

Installation

Install the package via npm:

npm install @somosus/ngx-cookie-consent --save

Usage

Import the module

import { NgxCookieConsentModule } from '@somosus/ngx-cookie-consent';

// use your configuration or leave it empty
// const cookieConfig = {};

@NgModule({
    imports: [
        // using own configuration pass the config object
        NgxCookieConsentModule.forRoot(),
    ],
})

Add the cookie consent component to your template at the top for all pages eg. app.component.html

<ngx-cookie-consent></ngx-cookie-consent> <router-outlet></router-outlet>

Usage in templates to check if the user has accepted the cookie consent

<div *ngxIfConsent="'functional_google_maps'">
  This content is only visible if functional_google_maps consent is given. (In
  this example functional_google_maps is the name of the cookie configured in
  the config object)
</div>

Configuration

| Name | Type | Default | Description | | --------------------- | ------------ | ------------------ | ---------------------------------------------------------------------------------- | | privacyPolicyUrl | string | '#' | URL to your privacy policy ⚠ required ⚠ | | imprintUrl | string | '#' | URL to your imprint ⚠ required ⚠ | | defaultLanguage | string | 'en' | Default language for the cookie consent banner | | availableLanguages | string[] | ['en', 'de', 'it'] | Available languages for the cookie consent banner | | showLanguageSwitcher | boolean | true | Show language switcher | | showBadgeOpener | boolean | true | Show badge opener | | openerPosition | enum | 'left-bottom' | Position of the badge eg. 'left-top', 'right-top' , 'left-bottom' , 'right-bottom' | | customClass | string | '' | Custom class for the cookie consent banner | | cookiePrefix | string | 'cookieconsent_' | Prefix for the cookie consent banner | | cookieExpiryDays | number | 365 | Expiry days for the cookie consent banner | | showCookieDetails | boolean | false | Show cookie details | | showFunctionalCookies | boolean | true | Show functional cookies | | functionalCookies | CookieItem[] | [] | Functional cookies | | showMarketingCookies | boolean | true | Show marketing cookies | | marketingCookies | CookieItem[] | [] | Marketing cookies | | showEssentialCookies | boolean | true | Show essential cookies | | essentialCookies | CookieItem[] | [] | Essential cookies | | showOtherTools | boolean | true | Show other tools | | otherTools | CookieItem[] | [] | Other tools | | excludeRoutes | string[] | [] | Exclude routes eg. ['/privacy-policy'] |

CookieItem interface

| Name | Type | Description | | ---------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | key | string | Key for the cookie eg. 'functional_google_analytics' | | name | string | Name for the cookie eg. 'Google Analytics' | | description | string | Description for the cookie eg. 'Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.' | | privacyPolicyUrl | string | URL to the privacy policy for the cookie eg. 'https://policies.google.com/privacy' | | cookies | CookieDetail[] | Cookie details for the cookie |

CookieDetail interface

| Name | Type | Description | | ----------- | ------ | -------------------------------------------------------------------------------- | | name | string | Name for the saved cookie eg. '_ga' | | description | string | Description for the saved cookie eg. 'This cookie is used to distinguish users.' | | duration | string | Duration for the saved cookie eg. '2 years' |

Contributing

This project has a maintainer that actively monitors its issue queue and responds in a timely manner. This means that bug reports, tasks, feature requests and support request posted in the project's issue should receive timely attention from project's maintainers. Other community members are also welcome to resolve issues posted to the issue queue.

License

ngx-cookie-consent is licensed under the MIT license.