andreasonny83 / angular2-cookie-law Goto Github PK
View Code? Open in Web Editor NEWAngular2+ component that provides a banner to inform users about cookie law
Home Page: https://stackblitz.com/edit/angular2-cookie-law
License: MIT License
Angular2+ component that provides a banner to inform users about cookie law
Home Page: https://stackblitz.com/edit/angular2-cookie-law
License: MIT License
Would be nice to have a plain show/hide mode without angular/animations dependency.
When opening https://stackblitz.com/edit/angular2-cookie-law?file=src%2Fapp%2Fapp.component.html on Firefox or Chrome it tries to load the page forever and no content is presented.
With semantic-relase and commitizen
"@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.
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 !
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;
}
Please, comment to this issue if you're interested in becoming a maintainer for this project
Hi,
Can you push the last release "v6.1.0" on NPM ?
Thank you
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".
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 ?
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 ?
I saw some ssr fixes were merged. Though there is a 6.1.0 tag on github, it is not on npm.
Would be nice if we could apply custom styles. I can add a PR soon when i have some time
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/
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.
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 π¦π
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
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"
}
}
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.
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.
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+?
Decide where to display the cookie-law message on the page:
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 γ β
multiple components should refers to different cookie names
Generate a UMD library ready to use under a lib
folder
I think "tsickle" can be removed. I think it does not get used (anymore).
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'.
Using styleUrls and templateUrl to keep the source code cleaner
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
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
Using templateUrl
and styleUrls
breaks the module rendering while using the npm package inside an external project.
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
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
See:
https://www.npmjs.com/package/angular2-cookie-law#awsomecloseicon
It is currently called awsomeCloseIcon what i assume should be called awesomeCloseIcon.
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.
Is it possible to add your own svg icon for dismissing the banner?
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>
`
And in my component TS :
@ViewChild('cookieLaw') cookieLawEl: any; ... public dismiss(): void { this.cookieLawEl.dismiss(); }
Can you help me please ?
Thx
Dear All,
There is a way to disagree on accepting cookies?
Is it required by GDPR, is it?
Best Regards
Andrea
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)
....
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").
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.