ngx-cookie-service
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -74,6 +74,7 @@ (function (global, factory) { | ||
* @param {?=} secure Secure flag | ||
* @param {?=} sameSite OWASP samesite token `Lax` or `Strict` | ||
* @param {?=} sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `None` | ||
* @return {?} | ||
*/ | ||
CookieService.prototype.set = function (name, value, expires, path, domain, secure, sameSite) { | ||
if (sameSite === void 0) { sameSite = 'None'; } | ||
if (!this.documentIsAccessible) { | ||
@@ -101,5 +102,3 @@ return; | ||
} | ||
if (sameSite) { | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
} | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
this.document.cookie = cookieString; | ||
@@ -106,0 +105,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common"],t):t(e["ngx-cookie-service"]={},e.ng.core,e.ng.common)}(this,function(e,t,o){"use strict";var n=(i.prototype.check=function(e){return!!this.documentIsAccessible&&(e=encodeURIComponent(e),this.getCookieRegExp(e).test(this.document.cookie))},i.prototype.get=function(e){if(this.documentIsAccessible&&this.check(e)){e=encodeURIComponent(e);var t=this.getCookieRegExp(e).exec(this.document.cookie);return decodeURIComponent(t[1])}return""},i.prototype.getAll=function(){if(!this.documentIsAccessible)return{};var e={},t=this.document;if(t.cookie&&""!==t.cookie)for(var o=t.cookie.split(";"),n=0;n<o.length;n+=1){var i=o[n].split("=");i[0]=i[0].replace(/^ /,""),e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e},i.prototype.set=function(e,t,o,n,i,c,r){if(this.documentIsAccessible){var s=encodeURIComponent(e)+"="+encodeURIComponent(t)+";";o&&(s+="number"==typeof o?"expires="+new Date((new Date).getTime()+1e3*o*60*60*24).toUTCString()+";":"expires="+o.toUTCString()+";"),n&&(s+="path="+n+";"),i&&(s+="domain="+i+";"),c&&(s+="secure;"),r&&(s+="sameSite="+r+";"),this.document.cookie=s}},i.prototype["delete"]=function(e,t,o){this.documentIsAccessible&&this.set(e,"",new Date("Thu, 01 Jan 1970 00:00:01 GMT"),t,o)},i.prototype.deleteAll=function(e,t){if(this.documentIsAccessible){var o=this.getAll();for(var n in o)o.hasOwnProperty(n)&&this["delete"](n,e,t)}},i.prototype.getCookieRegExp=function(e){var t=e.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi,"\\$1");return new RegExp("(?:^"+t+"|;\\s*"+t+")=(.*?)(?:;|$)","g")},i);function i(e,t){this.document=e,this.platformId=t,this.documentIsAccessible=o.isPlatformBrowser(this.platformId)}n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Inject,args:[o.DOCUMENT]}]},{type:t.InjectionToken,decorators:[{type:t.Inject,args:[t.PLATFORM_ID]}]}]},e.CookieService=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common"],t):t(e["ngx-cookie-service"]={},e.ng.core,e.ng.common)}(this,function(e,t,o){"use strict";var n=(i.prototype.check=function(e){return!!this.documentIsAccessible&&(e=encodeURIComponent(e),this.getCookieRegExp(e).test(this.document.cookie))},i.prototype.get=function(e){if(this.documentIsAccessible&&this.check(e)){e=encodeURIComponent(e);var t=this.getCookieRegExp(e).exec(this.document.cookie);return decodeURIComponent(t[1])}return""},i.prototype.getAll=function(){if(!this.documentIsAccessible)return{};var e={},t=this.document;if(t.cookie&&""!==t.cookie)for(var o=t.cookie.split(";"),n=0;n<o.length;n+=1){var i=o[n].split("=");i[0]=i[0].replace(/^ /,""),e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e},i.prototype.set=function(e,t,o,n,i,c,r){if(void 0===r&&(r="None"),this.documentIsAccessible){var s=encodeURIComponent(e)+"="+encodeURIComponent(t)+";";o&&(s+="number"==typeof o?"expires="+new Date((new Date).getTime()+1e3*o*60*60*24).toUTCString()+";":"expires="+o.toUTCString()+";"),n&&(s+="path="+n+";"),i&&(s+="domain="+i+";"),c&&(s+="secure;"),s+="sameSite="+r+";",this.document.cookie=s}},i.prototype["delete"]=function(e,t,o){this.documentIsAccessible&&this.set(e,"",new Date("Thu, 01 Jan 1970 00:00:01 GMT"),t,o)},i.prototype.deleteAll=function(e,t){if(this.documentIsAccessible){var o=this.getAll();for(var n in o)o.hasOwnProperty(n)&&this["delete"](n,e,t)}},i.prototype.getCookieRegExp=function(e){var t=e.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi,"\\$1");return new RegExp("(?:^"+t+"|;\\s*"+t+")=(.*?)(?:;|$)","g")},i);function i(e,t){this.document=e,this.platformId=t,this.documentIsAccessible=o.isPlatformBrowser(this.platformId)}n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Inject,args:[o.DOCUMENT]}]},{type:t.InjectionToken,decorators:[{type:t.Inject,args:[t.PLATFORM_ID]}]}]},e.CookieService=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-cookie-service.umd.min.js.map |
@@ -28,5 +28,5 @@ import { InjectionToken } from '@angular/core'; | ||
* @param secure Secure flag | ||
* @param sameSite OWASP samesite token `Lax` or `Strict` | ||
* @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `None` | ||
*/ | ||
set(name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'Strict'): void; | ||
set(name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'None' | 'Strict'): void; | ||
/** | ||
@@ -33,0 +33,0 @@ * @param name Cookie name |
@@ -70,6 +70,7 @@ import { Inject, Injectable, InjectionToken, PLATFORM_ID } from '@angular/core'; | ||
* @param {?=} secure Secure flag | ||
* @param {?=} sameSite OWASP samesite token `Lax` or `Strict` | ||
* @param {?=} sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `None` | ||
* @return {?} | ||
*/ | ||
CookieService.prototype.set = function (name, value, expires, path, domain, secure, sameSite) { | ||
if (sameSite === void 0) { sameSite = 'None'; } | ||
if (!this.documentIsAccessible) { | ||
@@ -97,5 +98,3 @@ return; | ||
} | ||
if (sameSite) { | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
} | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
this.document.cookie = cookieString; | ||
@@ -102,0 +101,0 @@ }; |
@@ -71,6 +71,6 @@ import { Inject, Injectable, InjectionToken, PLATFORM_ID } from '@angular/core'; | ||
* @param {?=} secure Secure flag | ||
* @param {?=} sameSite OWASP samesite token `Lax` or `Strict` | ||
* @param {?=} sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `None` | ||
* @return {?} | ||
*/ | ||
set(name, value, expires, path, domain, secure, sameSite) { | ||
set(name, value, expires, path, domain, secure, sameSite = 'None') { | ||
if (!this.documentIsAccessible) { | ||
@@ -98,5 +98,3 @@ return; | ||
} | ||
if (sameSite) { | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
} | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
this.document.cookie = cookieString; | ||
@@ -103,0 +101,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"name":"ngx-cookie-service","description":"an (aot ready) angular (4.2+) cookie service","version":"2.2.0","license":"MIT","author":"7leads GmbH <info@7leads.org>","keywords":["angular","angular2","angular4","angular5","angular-2","angular-4","angular-5","angular-6","angular-7","aot","aot-compatible","aot-compilation","ngx","ng2","ng","service","angular-service","cookie-service","cookie","cookies"],"contributors":[{"name":"Christopher Parotat","email":"c.parotat@7leads.org"},{"name":"Stefan Bauer","email":"bauer.stefan@live.de"},{"name":"Kristian Thy","email":"thy@42.dk"},{"name":"Jared Clemence"},{"name":"flakolefluk"},{"name":"mattbanks"},{"name":"DBaker85"},{"name":"Matt Lewis","email":"npm@mattlewis.me"}],"scripts":{"ng":"ng","start":"npm run compile && ng serve","build":"npm run compile && ng build","test":"npm run compile && ng test","lint":"npm run compile && ng lint","e2e":"npm run compile && ng e2e","compile":"ng-packagr -p ng-package.json","publish:dist":"npm run compile && npm publish dist-lib"},"repository":{"type":"git","url":"https://github.com/7leads/ngx-cookie-service.git"},"bugs":{"url":"https://github.com/7leads/ngx-cookie-service/issues","email":"info@7leads.org"},"peerDependencies":{"@angular/core":">=4.2.0","@angular/platform-browser":">=4.2.0","@angular/platform-browser-dynamic":">=4.2.0"},"devDependencies":{"@angular/cli":"1.0.0","@angular/common":"^4.0.0","@angular/compiler":"^4.0.0","@angular/compiler-cli":"^4.0.0","@angular/core":"^4.0.0","@angular/forms":"^4.0.0","@angular/http":"^4.0.0","@angular/platform-browser":"^4.0.0","@angular/platform-browser-dynamic":"^4.0.0","@angular/platform-server":"^4.0.0","@angular/router":"^4.0.0","@types/jasmine":"2.5.38","@types/node":"~6.0.60","async":"^2.3.0","codelyzer":"~2.0.0","core-js":"^2.4.1","jasmine-core":"~2.5.2","jasmine-spec-reporter":"~3.2.0","karma":"~1.4.1","karma-chrome-launcher":"~2.0.0","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^0.2.0","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","ng-packagr":"^1.7.0","protractor":"~5.1.0","rimraf":"^2.6.1","rxjs":"^5.1.0","ts-node":"~2.0.0","tslint":"~4.5.0","typescript":"~2.2.0","zone.js":"^0.8.4"},"main":"bundles/ngx-cookie-service.umd.js","module":"ngx-cookie-service.es5.js","es2015":"ngx-cookie-service.js","typings":"ngx-cookie-service.d.ts","metadata":"ngx-cookie-service.metadata.json"} | ||
{"name":"ngx-cookie-service","description":"an (aot ready) angular (4.2+) cookie service","version":"2.3.0","license":"MIT","author":"7leads GmbH <info@7leads.org>","keywords":["angular","angular2","angular4","angular5","angular-2","angular-4","angular-5","angular-6","angular-7","aot","aot-compatible","aot-compilation","ngx","ng2","ng","service","angular-service","cookie-service","cookie","cookies"],"contributors":[{"name":"Christopher Parotat","email":"c.parotat@7leads.org"},{"name":"Stefan Bauer","email":"bauer.stefan@live.de"},{"name":"Kristian Thy","email":"thy@42.dk"},{"name":"Jared Clemence"},{"name":"flakolefluk"},{"name":"mattbanks"},{"name":"DBaker85"},{"name":"Matt Lewis","email":"npm@mattlewis.me"},{"name":"IceBreakerG"}],"scripts":{"ng":"ng","start":"npm run compile && ng serve","build":"npm run compile && ng build","test":"npm run compile && ng test","lint":"npm run compile && ng lint","e2e":"npm run compile && ng e2e","compile":"ng-packagr -p ng-package.json","publish:dist":"npm run compile && npm publish dist-lib"},"repository":{"type":"git","url":"https://github.com/7leads/ngx-cookie-service.git"},"bugs":{"url":"https://github.com/7leads/ngx-cookie-service/issues","email":"info@7leads.org"},"peerDependencies":{"@angular/core":">=4.2.0","@angular/platform-browser":">=4.2.0","@angular/platform-browser-dynamic":">=4.2.0"},"devDependencies":{"@angular/cli":"1.0.0","@angular/common":"^4.0.0","@angular/compiler":"^4.0.0","@angular/compiler-cli":"^4.0.0","@angular/core":"^4.0.0","@angular/forms":"^4.0.0","@angular/http":"^4.0.0","@angular/platform-browser":"^4.0.0","@angular/platform-browser-dynamic":"^4.0.0","@angular/platform-server":"^4.0.0","@angular/router":"^4.0.0","@types/jasmine":"2.5.38","@types/node":"~6.0.60","async":"^2.3.0","codelyzer":"~2.0.0","core-js":"^2.4.1","jasmine-core":"~2.5.2","jasmine-spec-reporter":"~3.2.0","karma":"~1.4.1","karma-chrome-launcher":"~2.0.0","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^0.2.0","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","ng-packagr":"^1.7.0","protractor":"~5.1.0","rimraf":"^2.6.1","rxjs":"^5.1.0","ts-node":"~2.0.0","tslint":"~4.5.0","typescript":"~2.2.0","zone.js":"^0.8.4"},"main":"bundles/ngx-cookie-service.umd.js","module":"ngx-cookie-service.es5.js","es2015":"ngx-cookie-service.js","typings":"ngx-cookie-service.d.ts","metadata":"ngx-cookie-service.metadata.json"} |
@@ -5,2 +5,8 @@ # NGX Cookie Service | ||
# :warning: Announcement: New maintainer needed. | ||
We stopped working with Angular some time ago. At first we did not mind maintaining this package as a small side project, but we would finally like to move on to other projects. | ||
However, we feel that this package is still useful. Therefore, we would really like to hand it over to a new maintainer instead of just deprecating it. If you would like to take care of `ngx-cookie-service` in the future, feel free to shoot us an email: technik@7leads.org | ||
# Installation | ||
@@ -93,3 +99,3 @@ | ||
## set( name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'Strict' ): void; | ||
## set( name: string, value: string, expires?: number | Date, path?: string, domain?: string, secure?: boolean, sameSite?: 'Lax' | 'Strict' | 'None' ): void; | ||
@@ -100,3 +106,3 @@ ```typescript | ||
Sets a cookie with the specified `name` and `value`. It is good practice to specify a path. If you are unsure about the path value, use `'/'`. If no path or domain is explicitly defined, the current location is assumed. | ||
Sets a cookie with the specified `name` and `value`. It is good practice to specify a path. If you are unsure about the path value, use `'/'`. If no path or domain is explicitly defined, the current location is assumed. `sameSite` defaults to `None`. | ||
@@ -188,2 +194,3 @@ **Important:** For security reasons, it is not possible to define cookies for other domains. Browsers do not allow this. Read [this](https://stackoverflow.com/a/1063760) and [this](https://stackoverflow.com/a/17777005/1007003) StackOverflow answer for a more in-depth explanation. | ||
* [mattlewis92](https://github.com/mattlewis92) | ||
* [IceBreakerG](https://github.com/IceBreakerG) | ||
@@ -190,0 +197,0 @@ # License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
70194
196
0
522