Coder Social home page Coder Social logo

andreasonny83 / angular2-cookie-law Goto Github PK

View Code? Open in Web Editor NEW
37.0 5.0 24.0 1.23 MB

Angular2+ component that provides a banner to inform users about cookie law

Home Page: https://stackblitz.com/edit/angular2-cookie-law

License: MIT License

TypeScript 78.29% JavaScript 10.27% HTML 6.36% CSS 5.09%
angular2 angular4 angular2-cookie banner ng2 ng4 cookies angular-components angular2-components angularjs

angular2-cookie-law's Introduction

Hi there πŸ‘‹

@andreasonny83's Holopin board

πŸ“ˆ GitHub Stats

andreasonny83's GitHub Stats andreasonny83's GitHub Stats

πŸ† GitHub Trophies

trophy

angular2-cookie-law's People

Contributors

andreasonny83 avatar belobrad avatar dependabot[bot] avatar exequiel09 avatar neilime 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

Watchers

 avatar  avatar  avatar  avatar  avatar

angular2-cookie-law's Issues

Not able to use custom content after upgrade to ver 6

"@angular/core": "6.0.4",
"angular2-cookie-law": "^6.0.2",

When I use

<cookie-law position="bottom" expiration="30">
 Lalala
</cookie-law>

It still shows the default text: By continuing to browse the site ...

Expected behaviour:
Would like to see Lalala text instead of the default one.

changing text

Hey there,
Thanks a lot for your great work!
Do you think you could make the text configurable for the next release?
It will help a lot for multilingual sites.
If you don't have time right now I will make a pull request in few days.

Thanks !

cookieLawSeen attribute

When included in a page, I want to see a isSeen attribute to the HTML tag.
I want also to have an event triggered when the user dismiss the banner.

@Component({
  selector: 'app',
  template: `
  <div *ngIf="cookieLawSeen">
    This will be rendered only when the cookie banner is dismissed.
  </div>

  <cookie-law (isSeen)="cookieLawSeen"></cookie-law>
  `
})
export class AppComponent {
  private cookieLawSeen: boolean;
}

Looking For Maintainers

Please, comment to this issue if you're interested in becoming a maintainer for this project

Support for Angular 8

I've upgraded my application to Angular 8 and I'm getting some warnings on this package.
Could you update your package.json file to also allow angular 8, so I can get rid of these warnings.

warning " > [email protected]" has incorrect peer dependency "@angular/common@^6.0.0-rc.0 || ^6.0.0 || 7.0.0-rc.0 || ^7.0.0".
warning " > [email protected]" has incorrect peer dependency "@angular/core@^6.0.0-rc.0 || ^6.0.0 || 7.0.0-rc.0 || ^7.0.0".

Custom Template

It is possible to overwrite our default cookie policy law text with a custom template. Just put your favorite html content between the component like in the following example:

<cookie-law position="top"> This website contains cookie. <a href="#/cookie-policy">Read more</a> </cookie-law>

For me this one don't work!!!
I add to axactly the same code and when i change the text it return always "By continuing to browse the site, you're agreeing to our use of cookies.".
How can i resolve ?

Uncaught TypeError: Cannot read property 'core' of undefined

Hi,

I've been using your module for a weeks, it works very well but I have an error in my console.
I'm using angular cli : "../node_modules/ng2-page-scroll/bundles/ng2-page-scroll.umd.js"

And then the error :

VM61018:1 Uncaught TypeError: Cannot read property 'core' of undefined
    at eval (eval at module.exports (addScript.js:9), <anonymous>:1:464)
    at eval (eval at module.exports (addScript.js:9), <anonymous>:1:508)
    at eval (<anonymous>)
    at module.exports (addScript.js:9)
    at Object.512 (angular2-cookie-law.umd.js?d15c:1)
    at __webpack_require__ (bootstrap ed73b40…:52)
    at Object.1253 (scripts.bundle.js:16)
    at __webpack_require__ (bootstrap ed73b40…:52)
    at webpackJsonpCallback (bootstrap ed73b40…:23)
    at scripts.bundle.js:1

Any idea ?

custom styling

Would be nice if we could apply custom styles. I can add a PR soon when i have some time

Add rel="noopener" to target="_blank" to prevent window.opener vulnerability

Hi - thanks for making this module :)

There is a known vulnerability with the target="_blank" attribute on anchor links, and this is now being flagged by Google's Lighthouse, for example.

The solution would be to add an option to include the rel="noopener" & rel="noreferrer" (for Firefox) attributes to the 'read more' anchor link. You could also just add it by default.

More information about this vulnerability can be read here:
https://developers.google.com/web/tools/lighthouse/audits/noopener
https://jakearchibald.com/2016/performance-benefits-of-rel-noopener/
https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

expiration to 30 days but expired in less days

Hi, i set expiration to 30 days but seems like the cookie bars is shown before.
How can i set the expiration to until cookies are deleted?

<cookie-law *ngIf="GlobalFields.isBrowser" name="cookieLawSeenRoomless" expiration="30"> Questo sito utilizza cookies per migliorare la tua esperienza. Accetta se sei d'accordo con il loro utilizzo. <a [routerLink]="'/privacy-policy'" title="Privacy Policy">Privacy Policy</a> </cookie-law>

Thank you

Version 6.0.2 not customizable in Angular 6.0.x

Hi,

It is not possible to customize the directive, like this:

<cookie-law>Hallo Chris Cookie</cookie-law>

Effect you can see under your own demo page as well (using Chrome or Firefox)
https://stackblitz.com/edit/angular2-cookie-law

Can reproduce it with fresh Angular Cli 6.0.8 project:

brings the same result like demo Page.

package.json in my demo project:

{
"name": "testcookie",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.4",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/platform-browser": "^6.0.3",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/router": "^6.0.3",
"angular2-cookie-law": "^6.0.2",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "^6.0.3",
"@angular-devkit/build-angular": "~0.6.8",
"typescript": "~2.7.2",
"@angular/cli": "~6.0.8",
"@angular/language-service": "^6.0.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"
}
}

Support for Angular 7

I just upgraded my project from Angular 6 to 7 today, and it seems to work fine :-)
[email protected]
But I show some warnings:

npm WARN [email protected] requires a peer of @angular/common@^6.0.0-rc.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^6.0.0-rc.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.

Please update the package.json file to remove the dependency warnings.
Thanks.

popup appear for one sec after every reloading

Hello. I am facing a issue regarding cookie law. It is showing the pop-up for every page reload but just for one second. It should not do that. After showing the pop-up to a user who visit a site for the very first time, it should not show the pop-up. But, for me it is showing it for one second and then disappears.
What I am doing wrong? Any help will be appreciated.
Thanks.

Angular version: 6
I am using server side rendering.

bug?: regular expression

The line 35 in src/cookie-law.service.ts reads as
c = ca[i].replace(/^\s+/g, '');

Is it to remove the starting whitespace? If so, then the RE should be ^\s+?

Custom position

Decide where to display the cookie-law message on the page:

  • top
  • bottom

Add Support for Angular 16

I know. The creator of this Package is not maintaining this package anymore. He/She is happy to accept pull-requests. I just wanted to make sure the issue entry for missing Angular 16 support is not missing in the list ツ ✌

Angular v6.0.3 problem

ERROR in node_modules/angular2-cookie-law/lib/cookie-law-element.component.d.ts(1,32): error TS2305: Module '".../node_modules/@angular/core/core"' has no exported member 'AnimationTransitionEvent'.

link css has no class

Hello,

Just a minor issue to report, when cookie-law is inserted in the page, the css for 'a' tags overrides page css. It should had a class or an id.

Thanks

App compiles with errors

Following the documentation I get following errors:

ERROR in ../../../../node_modules/angular2-cookie-law/lib/angular2-cookie-law-container.component.d.ts(8,38): error TS2307: Cannot find module '@angular/core'.
../../../../node_modules/angular2-cookie-law/lib/angular2-cookie-law.component.d.ts(8,38): error TS2307: Cannot find module '@angular/core'.
../../../../node_modules/angular2-cookie-law/lib/angular2-cookie-law.component.d.ts(9,40): error TS2307: Cannot find module '@angular/platform-browser'.

The modules are all present and imported in 'app.module.ts'
Running Angular/cli 8.3.2

feature request: list of property-value pairs to be set in the cookie

Hi Andrea,

It is a great module which allows me to implement basic cookie law with only several lines of codes. If I understand correctly, this module store a cookie on the client computer with only one property: name. Does this mean that if two users use the the same computer and the first user accepts the cookie, the second user will not be prompted the banner?

What I am suggesting to allow taking in a data structure like

{ 
  user: john smith,
  name: cookie-law,
  date: 09/05/2018
}

which could make the module more flexible, e.g. if the terms and conditions changes, the cookie banner could be popped again.

Best regards,
Jun

Refused to to apply inline style

My server add a Content-Security-Policy and since then I have this alerts and problems with angular2-cookie-law component:

Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'".

Versions of Angular
Angular: 8

angular2-cookie-law: "7.0.1"

Bootstrap: 4

Uncaught TypeError: Object(...) is not a function

angular2-cookie-law.js:77 Uncaught TypeError: Object(...) is not a function
at angular2-cookie-law.js:77
at Object. (angular2-cookie-law.js:79)
at webpack_require (bootstrap a3035af3e3185551034c:54)
at Object.655 (main.ts:5)
at webpack_require (bootstrap a3035af3e3185551034c:54)
at Object.533 (Utility.ts:39)
at webpack_require (bootstrap a3035af3e3185551034c:54)
at webpackJsonpCallback (bootstrap a3035af3e3185551034c:25)

I am getting this error when i am trying to run my application. I am using ionic 3 and angular 5. I have installed rxjs-compat as well but this error still shows up.

Button dismiss

Hi,

I have a problem with the dismiss button :

ERROR TypeError: Cannot read property 'dismiss' of undefined

I have this code in my component HTML :
<cookie-law position="bottom">
<div class="container">
<div class="row">
<div class="col l10">
<div class="cookie-title">Nous utilisons des cookies</div>

En poursuivant la navigation, vous acceptez l'installation et l'utilisation des cookies sur votre ordinateur.
<button class="white-text amber darken-1 waves-effect waves-light btn depo cookie-btn" (click)="dismiss()">J'accepte
`

And in my component TS :
@ViewChild('cookieLaw') cookieLawEl: any; ... public dismiss(): void { this.cookieLawEl.dismiss(); }

Can you help me please ?

Thx

Opt-out option

Dear All,

There is a way to disagree on accepting cookies?
Is it required by GDPR, is it?

Best Regards
Andrea

throwing errors when using Server Side Rendering (angular 6 universal)

ERROR ReferenceError: document is not defined
at Angular2CookieLawService.seen (/Users/Desktop/stack-website/development/src/frontend/node_modules/angular2-cookie-law/bundles/angular2-cookie-law.umd.js:26:48)
at CookieLawContainerComponent.ngOnInit (/Users/Desktop/stack-website/development/src/frontend/node_modules/angular2-cookie-law/bundles/angular2-cookie-law.umd.js:284:51)
....

Issue when upgrading from Angular 9 to 10

Should I remove this dependency from my project ? When I am trying to upgrade from Angular 9 to 10, I have this message:

 Package "angular2-cookie-law" has an incompatible peer dependency to "@angular/common" (requires "^6.0.0-rc.0 || ^6.0.0 || 7.0.0-rc.0 || ^7.0.0" (extended), would install "10.2.5").
 Package "angular2-cookie-law" has an incompatible peer dependency to "@angular/core" (requires "^6.0.0-rc.0 || ^6.0.0 || 7.0.0-rc.0 || ^7.0.0" (extended), would install "10.2.5").

Cookie expiration

Hi @andreasonny83, I'm using your library in my personal project just HTML like that:

  <cookie-law name="cookieName" learnMore="/privacity">
    Some text inside the cookie banner.
    <a [routerLink]="['/privacity']">Learn more</a>
  </cookie-law>

So, the library is fantastic but I cannot set the expiration time of the cookie so when I close the browser, the cookie expires. Is there any posibility of setting cookie's duration for more than the session of the browser? Maybe setting it for a year or something.

I'm really thankful and waiting for your response!

Pablo

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.