ngx-cookie-service
Advanced tools
Comparing version 10.0.1 to 10.1.1
@@ -367,41 +367,46 @@ (function (global, factory) { | ||
}; | ||
/** | ||
* @param name Cookie name | ||
* @param value Cookie value | ||
* @param expires Number of days until the cookies expires or an actual `Date` | ||
* @param path Cookie path | ||
* @param domain Cookie domain | ||
* @param secure Secure flag | ||
* @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax` | ||
*/ | ||
CookieService.prototype.set = function (name, value, expires, path, domain, secure, sameSite) { | ||
if (sameSite === void 0) { sameSite = 'Lax'; } | ||
CookieService.prototype.set = function (name, value, expiresOrOptions, path, domain, secure, sameSite) { | ||
if (!this.documentIsAccessible) { | ||
return; | ||
} | ||
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) { | ||
var optionsBody = { | ||
expires: expiresOrOptions, | ||
path: path, | ||
domain: domain, | ||
secure: secure, | ||
sameSite: sameSite ? sameSite : 'Lax', | ||
}; | ||
this.set(name, value, optionsBody); | ||
return; | ||
} | ||
var cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';'; | ||
if (expires) { | ||
if (typeof expires === 'number') { | ||
var dateExpires = new Date(new Date().getTime() + expires * 1000 * 60 * 60 * 24); | ||
var options = expiresOrOptions ? expiresOrOptions : {}; | ||
if (options.expires) { | ||
if (typeof options.expires === 'number') { | ||
var dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24); | ||
cookieString += 'expires=' + dateExpires.toUTCString() + ';'; | ||
} | ||
else { | ||
cookieString += 'expires=' + expires.toUTCString() + ';'; | ||
cookieString += 'expires=' + options.expires.toUTCString() + ';'; | ||
} | ||
} | ||
if (path) { | ||
cookieString += 'path=' + path + ';'; | ||
if (options.path) { | ||
cookieString += 'path=' + options.path + ';'; | ||
} | ||
if (domain) { | ||
cookieString += 'domain=' + domain + ';'; | ||
if (options.domain) { | ||
cookieString += 'domain=' + options.domain + ';'; | ||
} | ||
if (secure === false && sameSite === 'None') { | ||
secure = true; | ||
if (options.secure === false && options.sameSite === 'None') { | ||
options.secure = true; | ||
console.warn("[ngx-cookie-service] Cookie " + name + " was forced with secure flag because sameSite=None." + | ||
"More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130"); | ||
} | ||
if (secure) { | ||
if (options.secure) { | ||
cookieString += 'secure;'; | ||
} | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
if (!options.sameSite) { | ||
options.sameSite = 'Lax'; | ||
} | ||
cookieString += 'sameSite=' + options.sameSite + ';'; | ||
this.document.cookie = cookieString; | ||
@@ -419,3 +424,4 @@ }; | ||
} | ||
this.set(name, '', new Date('Thu, 01 Jan 1970 00:00:01 GMT'), path, domain, secure, sameSite); | ||
var expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT'); | ||
this.set(name, '', { expires: expiresDate, path: path, domain: domain, secure: secure, sameSite: sameSite }); | ||
}; | ||
@@ -422,0 +428,0 @@ /** |
@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-cookie-service",["exports","@angular/core","@angular/common"],t):t((e=e||self)["ngx-cookie-service"]={},e.ng.core,e.ng.common)}(this,(function(e,t,o){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */Object.create;function n(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var n,r,i=o.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}return c}Object.create;var r=function(){function e(e,t){this.document=e,this.platformId=t,this.documentIsAccessible=o.isPlatformBrowser(this.platformId)}return e.prototype.check=function(e){return!!this.documentIsAccessible&&(e=encodeURIComponent(e),this.getCookieRegExp(e).test(this.document.cookie))},e.prototype.get=function(e){if(this.documentIsAccessible&&this.check(e)){e=encodeURIComponent(e);var t=this.getCookieRegExp(e).exec(this.document.cookie);return this.safeDecodeURIComponent(t[1])}return""},e.prototype.getAll=function(){var e=this;if(!this.documentIsAccessible)return{};var t={},o=this.document;return o.cookie&&""!==o.cookie&&o.cookie.split(";").forEach((function(o){var r=n(o.split("="),2),i=r[0],c=r[1];t[e.safeDecodeURIComponent(i.replace(/^ /,""))]=e.safeDecodeURIComponent(c)})),t},e.prototype.set=function(e,t,o,n,r,i,c){if(void 0===c&&(c="Lax"),this.documentIsAccessible){var s=encodeURIComponent(e)+"="+encodeURIComponent(t)+";";if(o)if("number"==typeof o)s+="expires="+new Date((new Date).getTime()+1e3*o*60*60*24).toUTCString()+";";else s+="expires="+o.toUTCString()+";";n&&(s+="path="+n+";"),r&&(s+="domain="+r+";"),!1===i&&"None"===c&&(i=!0,console.warn("[ngx-cookie-service] Cookie "+e+" was forced with secure flag because sameSite=None.More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130")),i&&(s+="secure;"),s+="sameSite="+c+";",this.document.cookie=s}},e.prototype.delete=function(e,t,o,n,r){void 0===r&&(r="Lax"),this.documentIsAccessible&&this.set(e,"",new Date("Thu, 01 Jan 1970 00:00:01 GMT"),t,o,n,r)},e.prototype.deleteAll=function(e,t,o,n){if(void 0===n&&(n="Lax"),this.documentIsAccessible){var r=this.getAll();for(var i in r)r.hasOwnProperty(i)&&this.delete(i,e,t,o,n)}},e.prototype.getCookieRegExp=function(e){var t=e.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi,"\\$1");return new RegExp("(?:^"+t+"|;\\s*"+t+")=(.*?)(?:;|$)","g")},e.prototype.safeDecodeURIComponent=function(e){try{return decodeURIComponent(e)}catch(t){return e}},e}();r.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new r(t.ɵɵinject(o.DOCUMENT),t.ɵɵinject(t.PLATFORM_ID))},token:r,providedIn:"root"}),r.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],r.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[o.DOCUMENT]}]},{type:t.InjectionToken,decorators:[{type:t.Inject,args:[t.PLATFORM_ID]}]}]},e.CookieService=r,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
***************************************************************************** */Object.create;function n(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var n,r,i=o.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}return c}Object.create;var r=function(){function e(e,t){this.document=e,this.platformId=t,this.documentIsAccessible=o.isPlatformBrowser(this.platformId)}return e.prototype.check=function(e){return!!this.documentIsAccessible&&(e=encodeURIComponent(e),this.getCookieRegExp(e).test(this.document.cookie))},e.prototype.get=function(e){if(this.documentIsAccessible&&this.check(e)){e=encodeURIComponent(e);var t=this.getCookieRegExp(e).exec(this.document.cookie);return this.safeDecodeURIComponent(t[1])}return""},e.prototype.getAll=function(){var e=this;if(!this.documentIsAccessible)return{};var t={},o=this.document;return o.cookie&&""!==o.cookie&&o.cookie.split(";").forEach((function(o){var r=n(o.split("="),2),i=r[0],c=r[1];t[e.safeDecodeURIComponent(i.replace(/^ /,""))]=e.safeDecodeURIComponent(c)})),t},e.prototype.set=function(e,t,o,n,r,i,c){if(this.documentIsAccessible)if("number"==typeof o||o instanceof Date||n||r||i||c){var s={expires:o,path:n,domain:r,secure:i,sameSite:c||"Lax"};this.set(e,t,s)}else{var a=encodeURIComponent(e)+"="+encodeURIComponent(t)+";",u=o||{};if(u.expires)if("number"==typeof u.expires)a+="expires="+new Date((new Date).getTime()+1e3*u.expires*60*60*24).toUTCString()+";";else a+="expires="+u.expires.toUTCString()+";";u.path&&(a+="path="+u.path+";"),u.domain&&(a+="domain="+u.domain+";"),!1===u.secure&&"None"===u.sameSite&&(u.secure=!0,console.warn("[ngx-cookie-service] Cookie "+e+" was forced with secure flag because sameSite=None.More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130")),u.secure&&(a+="secure;"),u.sameSite||(u.sameSite="Lax"),a+="sameSite="+u.sameSite+";",this.document.cookie=a}},e.prototype.delete=function(e,t,o,n,r){if(void 0===r&&(r="Lax"),this.documentIsAccessible){var i=new Date("Thu, 01 Jan 1970 00:00:01 GMT");this.set(e,"",{expires:i,path:t,domain:o,secure:n,sameSite:r})}},e.prototype.deleteAll=function(e,t,o,n){if(void 0===n&&(n="Lax"),this.documentIsAccessible){var r=this.getAll();for(var i in r)r.hasOwnProperty(i)&&this.delete(i,e,t,o,n)}},e.prototype.getCookieRegExp=function(e){var t=e.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi,"\\$1");return new RegExp("(?:^"+t+"|;\\s*"+t+")=(.*?)(?:;|$)","g")},e.prototype.safeDecodeURIComponent=function(e){try{return decodeURIComponent(e)}catch(t){return e}},e}();r.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new r(t.ɵɵinject(o.DOCUMENT),t.ɵɵinject(t.PLATFORM_ID))},token:r,providedIn:"root"}),r.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],r.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[o.DOCUMENT]}]},{type:t.InjectionToken,decorators:[{type:t.Inject,args:[t.PLATFORM_ID]}]}]},e.CookieService=r,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngx-cookie-service.umd.min.js.map |
@@ -66,40 +66,46 @@ // This service is based on the `ng2-cookies` package which sadly is not a service and does | ||
} | ||
/** | ||
* @param name Cookie name | ||
* @param value Cookie value | ||
* @param expires Number of days until the cookies expires or an actual `Date` | ||
* @param path Cookie path | ||
* @param domain Cookie domain | ||
* @param secure Secure flag | ||
* @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax` | ||
*/ | ||
set(name, value, expires, path, domain, secure, sameSite = 'Lax') { | ||
set(name, value, expiresOrOptions, path, domain, secure, sameSite) { | ||
if (!this.documentIsAccessible) { | ||
return; | ||
} | ||
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) { | ||
const optionsBody = { | ||
expires: expiresOrOptions, | ||
path, | ||
domain, | ||
secure, | ||
sameSite: sameSite ? sameSite : 'Lax', | ||
}; | ||
this.set(name, value, optionsBody); | ||
return; | ||
} | ||
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';'; | ||
if (expires) { | ||
if (typeof expires === 'number') { | ||
const dateExpires = new Date(new Date().getTime() + expires * 1000 * 60 * 60 * 24); | ||
const options = expiresOrOptions ? expiresOrOptions : {}; | ||
if (options.expires) { | ||
if (typeof options.expires === 'number') { | ||
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24); | ||
cookieString += 'expires=' + dateExpires.toUTCString() + ';'; | ||
} | ||
else { | ||
cookieString += 'expires=' + expires.toUTCString() + ';'; | ||
cookieString += 'expires=' + options.expires.toUTCString() + ';'; | ||
} | ||
} | ||
if (path) { | ||
cookieString += 'path=' + path + ';'; | ||
if (options.path) { | ||
cookieString += 'path=' + options.path + ';'; | ||
} | ||
if (domain) { | ||
cookieString += 'domain=' + domain + ';'; | ||
if (options.domain) { | ||
cookieString += 'domain=' + options.domain + ';'; | ||
} | ||
if (secure === false && sameSite === 'None') { | ||
secure = true; | ||
if (options.secure === false && options.sameSite === 'None') { | ||
options.secure = true; | ||
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` + | ||
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`); | ||
} | ||
if (secure) { | ||
if (options.secure) { | ||
cookieString += 'secure;'; | ||
} | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
if (!options.sameSite) { | ||
options.sameSite = 'Lax'; | ||
} | ||
cookieString += 'sameSite=' + options.sameSite + ';'; | ||
this.document.cookie = cookieString; | ||
@@ -116,3 +122,4 @@ } | ||
} | ||
this.set(name, '', new Date('Thu, 01 Jan 1970 00:00:01 GMT'), path, domain, secure, sameSite); | ||
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT'); | ||
this.set(name, '', { expires: expiresDate, path, domain, secure, sameSite }); | ||
} | ||
@@ -162,2 +169,2 @@ /** | ||
]; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29va2llLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtY29va2llLXNlcnZpY2Uvc3JjL2xpYi9jb29raWUuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyRkFBMkY7QUFDM0YsMkZBQTJGO0FBQzNGLGdEQUFnRDtBQUVoRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxXQUFXLEVBQUUsY0FBYyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ2hGLE9BQU8sRUFBRSxRQUFRLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQzs7O0FBSzlELE1BQU0sT0FBTyxhQUFhO0lBR3hCO0lBQ0UsMEVBQTBFO0lBQzFFLG1FQUFtRTtJQUNuRSx5REFBeUQ7SUFDekQscURBQXFEO0lBQzNCLFFBQWE7SUFDdkMsK0RBQStEO0lBQ2xDLFVBQWtDO1FBRnJDLGFBQVEsR0FBUixRQUFRLENBQUs7UUFFVixlQUFVLEdBQVYsVUFBVSxDQUF3QjtRQUUvRCxJQUFJLENBQUMsb0JBQW9CLEdBQUcsaUJBQWlCLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ2pFLENBQUM7SUFFRDs7O09BR0c7SUFDSCxLQUFLLENBQUMsSUFBWTtRQUNoQixJQUFJLENBQUMsSUFBSSxDQUFD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1bWVudElzQWNjZXNzaWJsZSkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIGxldCBjb29raWVTdHJpbmc6IHN0cmluZyA9IGVuY29kZVVSSUNvbXBvbmVudChuYW1lKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkgKyAnOyc7XG5cbiAgICBpZiAoZXhwaXJlcykge1xuICAgICAgaWYgKHR5cGVvZiBleHBpcmVzID09PSAnbnVtYmVyJykge1xuICAgICAgICBjb25zdCBkYXRlRXhwaXJlczogRGF0ZSA9IG5ldyBEYXRlKG5ldyBEYXRlKCkuZ2V0VGltZSgpICsgZXhwaXJlcyAqIDEwMDAgKiA2MCAqIDYwICogMjQpO1xuXG4gICAgICAgIGNvb2tpZVN0cmluZyArPSAnZXhwaXJlcz0nICsgZGF0ZUV4cGlyZXMudG9VVENTdHJpbmcoKSArICc7JztcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGNvb2tpZVN0cmluZyArPSAnZXhwaXJlcz0nICsgZXhwaXJlcy50b1VUQ1N0cmluZygpICsgJzsnO1xuICAgICAgfVxuICAgIH1cblxuICAgIGlmIChwYXRoKSB7XG4gICAgICBjb29raWVTdHJpbmcgKz0gJ3BhdGg9JyArIHBhdGggKyAnOyc7XG4gICAgfVxuXG4gICAgaWYgKGRvbWFpbikge1xuICAgICAgY29va2llU3RyaW5nICs9ICdkb21haW49JyArIGRvbWFpbiArICc7JztcbiAgICB9XG5cbiAgICBpZiAoc2VjdXJlID09PSBmYWxzZSAmJiBzYW1lU2l0ZSA9PT0gJ05vbmUnKSB7XG4gICAgICBzZWN1cmUgPSB0cnVlO1xuICAgICAgY29uc29sZS53YXJuKFxuICAgICAgICBgW25neC1jb29raWUtc2VydmljZV0gQ29va2llICR7bmFtZX0gd2FzIGZvcmNlZCB3aXRoIHNlY3VyZSBmbGFnIGJlY2F1c2Ugc2FtZVNpdGU9Tm9uZS5gICtcbiAgICAgICAgICBgTW9yZSBkZXRhaWxzID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mJiB0aGlzLmNoZWNrKG5hbWUpKSB7XG4gICAgICBuYW1lID0gZW5jb2RlVVJJQ29tcG9uZW50KG5hbWUpO1xuXG4gICAgICBjb25zdCByZWdFeHA6IFJlZ0V4cCA9IHRoaXMuZ2V0Q29va2llUmVnRXhwKG5hbWUpO1xuICAgICAgY29uc3QgcmVzdWx0OiBSZWdFeHBFeGVjQXJyYXkgPSByZWdFeHAuZXhlYyh0aGlzLmRvY3VtZW50LmNvb2tpZSk7XG5cbiAgICAgIHJldHVybiB0aGlzLnNhZmVEZWNvZGVVUklDb21wb25lbnQocmVzdWx0WzFdKTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuICcnO1xuICAgIH1cbiAgfVxuXG4gIC8qKlxuICAgKiBAcmV0dXJucyBhbGwgdGhlIGNvb2tpZXMgaW4ganNvblxuICAgKi9cbiAgZ2V0QWxsKCk6IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH0ge1xuICAgIGlmICghdGhpcy5kb2N1bWVudElzQWNjZXNzaWJsZSkge1xuICAgICAgcmV0dXJuIHt9O1xuICAgIH1cblxuICAgIGNvbnN0IGNvb2tpZXM6IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH0gPSB7fTtcbiAgICBjb25zdCBkb2N1bWVudDogYW55ID0gdGhpcy5kb2N1bWVudDtcblxuICAgIGlmIChkb2N1bWVudC5jb29raWUgJiYgZG9jdW1lbnQuY29va2llICE9PSAnJykge1xuICAgICAgZG9jdW1lbnQuY29va2llLnNwbGl0KCc7JykuZm9yRWFjaCgoY3VycmVudENvb2tpZSkgPT4ge1xuICAgICAgICBjb25zdCBbY29va2llTmFtZSwgY29va2llVmFsdWVdID0gY3VycmVudENvb2tpZS5zcGxpdCgnPScpO1xuICAgICAgICBjb29raWVzW3RoaXMuc2FmZURlY29kZVVSSUNvbXBvbmVudChjb29raWVOYW1lLnJlcGxhY2UoL14gLywgJycpKV0gPSB0aGlzLnNhZmVEZWNvZGVVUklDb21wb25lbnQo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Rpb25zQm9keSA9IHtcbiAgICAgICAgZXhwaXJlczogZXhwaXJlc09yT3B0aW9ucyxcbiAgICAgICAgcGF0aCxcbiAgICAgICAgZG9tYWluLFxuICAgICAgICBzZWN1cmUsXG4gICAgICAgIHNhbWVTaXRlOiBzYW1lU2l0ZSA/IHNhbWVTaXRlIDogJ0xheCcsXG4gICAgICB9O1xuXG4gICAgICB0aGlzLnNldChuYW1lLCB2YWx1ZSwgb3B0aW9uc0JvZHkpO1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIGxldCBjb29raWVTdHJpbmc6IHN0cmluZyA9IGVuY29kZVVSSUNvbXBvbmVudChuYW1lKSArICc9JyArIGVuY29kZVVSSUNvbXBvbmVudCh2YWx1ZSkgKyAnOyc7XG5cbiAgICBjb25zdCBvcHRpb25zID0gZXhwaXJlc09yT3B0aW9ucyA/IGV4cGlyZXNPck9wdGlvbnMgOiB7fTtcblxuICAgIGlmIChvcHRpb25zLmV4cGlyZXMpIHtcbiAgICAgIGlmICh0eXBlb2Ygb3B0aW9ucy5leHBpcmVzID09PSAnbnVtYmVyJykge1xuICAgICAgICBjb25zdCBkYXRlRXhwaXJlczogRGF0ZSA9IG5ldyBEYXRlKG5ldyBEYXRlKCkuZ2V0VGltZSgpICsgb3B0aW9ucy5leHBpcmVzICogMTAwMCAqIDYwICogNjAgKiAyNCk7XG5cbiAgICAgICAgY29va2llU3RyaW5nICs9ICdleHBpcmVzPScgKyBkYXRlRXhwaXJlcy50b1VUQ1N0cmluZygpICsgJzsnO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgY29va2llU3RyaW5nICs9ICdleHBpcmVzPScgKyBvcHRpb25zLmV4cGlyZXMudG9VVENTdHJpbmcoKSArICc7JztcbiAgICAgIH1cbiAgICB9XG5cbiAgICBpZiAob3B0aW9ucy5wYXRoKSB7XG4gICAgICBjb29raWVTdHJpbmcgKz0gJ3BhdGg9JyArIG9wdGlvbnMucGF0aCArICc7JztcbiAgICB9XG5cbiA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mFtZVxuICAgKiBAcmV0dXJucyBwcm9wZXJ0eSBSZWdFeHBcbiAgICovXG4gIHByaXZhdGUgZ2V0Q29va2llUmVnRXhwKG5hbWU6IHN0cmluZyk6IFJlZ0V4cCB7XG4gICAgY29uc3QgZXNjYXBlZE5hbWU6IHN0cmluZyA9IG5hbWUucmVwbGFjZSgvKFtcXFtcXF1cXHtcXH1cXChcXClcXHxcXD1cXDtcXCtcXD9cXCxcXC5cXCpcXF5cXCRdKS9naSwgJ1xcXFwkMScpO1xuXG4gICAgcmV0dXJuIG5ldyBSZWdFeHAoJyg/Ol4nICsgZXNjYXBlZE5hbWUgKyAnfDtcXFxccyonICsgZXNjYXBlZE5hbWUgKyAnKT0oLio/KSg/Ojt8JCknLCAnZycpO1xuICB9XG5cbiAgcHJpdmF0ZSBzYWZlRGVjb2RlVVJJQ29tcG9uZW50KGVuY29kZWRVUklDb21wb25lbnQ6IHN0cmluZyk6IHN0cmluZyB7XG4gICAgdHJ5IHtcbiAgICAgIHJldHVybiBkZWNvZGVVUklDb21wb25lbnQoZW5jb2RlZFVSSUNvbXBvbmVudCk7XG4gICAgfSBjYXRjaCB7XG4gICAgICAvLyBwcm9iYWJseSBpdCBpcyBub3QgdXJpIGVuY29kZWQuIHJldHVybiBhcyBpc1xuICAgICAgcmV0dXJuIGVuY29kZWRVUklDb21wb25lbnQ7XG4gICAgfVxuICB9XG59XG4iXX0= |
@@ -63,40 +63,46 @@ import { ɵɵdefineInjectable, ɵɵinject, PLATFORM_ID, Injectable, Inject, InjectionToken } from '@angular/core'; | ||
} | ||
/** | ||
* @param name Cookie name | ||
* @param value Cookie value | ||
* @param expires Number of days until the cookies expires or an actual `Date` | ||
* @param path Cookie path | ||
* @param domain Cookie domain | ||
* @param secure Secure flag | ||
* @param sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax` | ||
*/ | ||
set(name, value, expires, path, domain, secure, sameSite = 'Lax') { | ||
set(name, value, expiresOrOptions, path, domain, secure, sameSite) { | ||
if (!this.documentIsAccessible) { | ||
return; | ||
} | ||
if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) { | ||
const optionsBody = { | ||
expires: expiresOrOptions, | ||
path, | ||
domain, | ||
secure, | ||
sameSite: sameSite ? sameSite : 'Lax', | ||
}; | ||
this.set(name, value, optionsBody); | ||
return; | ||
} | ||
let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';'; | ||
if (expires) { | ||
if (typeof expires === 'number') { | ||
const dateExpires = new Date(new Date().getTime() + expires * 1000 * 60 * 60 * 24); | ||
const options = expiresOrOptions ? expiresOrOptions : {}; | ||
if (options.expires) { | ||
if (typeof options.expires === 'number') { | ||
const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24); | ||
cookieString += 'expires=' + dateExpires.toUTCString() + ';'; | ||
} | ||
else { | ||
cookieString += 'expires=' + expires.toUTCString() + ';'; | ||
cookieString += 'expires=' + options.expires.toUTCString() + ';'; | ||
} | ||
} | ||
if (path) { | ||
cookieString += 'path=' + path + ';'; | ||
if (options.path) { | ||
cookieString += 'path=' + options.path + ';'; | ||
} | ||
if (domain) { | ||
cookieString += 'domain=' + domain + ';'; | ||
if (options.domain) { | ||
cookieString += 'domain=' + options.domain + ';'; | ||
} | ||
if (secure === false && sameSite === 'None') { | ||
secure = true; | ||
if (options.secure === false && options.sameSite === 'None') { | ||
options.secure = true; | ||
console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` + | ||
`More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`); | ||
} | ||
if (secure) { | ||
if (options.secure) { | ||
cookieString += 'secure;'; | ||
} | ||
cookieString += 'sameSite=' + sameSite + ';'; | ||
if (!options.sameSite) { | ||
options.sameSite = 'Lax'; | ||
} | ||
cookieString += 'sameSite=' + options.sameSite + ';'; | ||
this.document.cookie = cookieString; | ||
@@ -113,3 +119,4 @@ } | ||
} | ||
this.set(name, '', new Date('Thu, 01 Jan 1970 00:00:01 GMT'), path, domain, secure, sameSite); | ||
const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT'); | ||
this.set(name, '', { expires: expiresDate, path, domain, secure, sameSite }); | ||
} | ||
@@ -116,0 +123,0 @@ /** |
@@ -34,2 +34,22 @@ import { InjectionToken } from '@angular/core'; | ||
/** | ||
* Cookie's parameters: | ||
* <pre> | ||
* expires Number of days until the cookies expires or an actual `Date` | ||
* path Cookie path | ||
* domain Cookie domain | ||
* secure Secure flag | ||
* sameSite OWASP samesite token `Lax`, `None`, or `Strict`. Defaults to `Lax` | ||
* </pre> | ||
* @param name Cookie name | ||
* @param value Cookie value | ||
* @param options Body with cookie's params | ||
*/ | ||
set(name: string, value: string, options?: { | ||
expires?: number | Date; | ||
path?: string; | ||
domain?: string; | ||
secure?: boolean; | ||
sameSite?: 'Lax' | 'None' | 'Strict'; | ||
}): void; | ||
/** | ||
* @param name Cookie name | ||
@@ -36,0 +56,0 @@ * @param path Cookie path |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"CookieService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":7,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":18,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":18,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":20,"character":12}]}]],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"InjectionToken","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":20,"character":60,"module":"./lib/cookie.service"}]}]}],"check":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"set":[{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}],"deleteAll":[{"__symbolic":"method"}],"getCookieRegExp":[{"__symbolic":"method"}],"safeDecodeURIComponent":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"CookieService":"./lib/cookie.service"},"importAs":"ngx-cookie-service"} | ||
{"__symbolic":"module","version":4,"metadata":{"CookieService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":7,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":18,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":18,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":20,"character":12}]}]],"parameters":[{"__symbolic":"reference","name":"any"},{"__symbolic":"reference","name":"InjectionToken","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":20,"character":60,"module":"./lib/cookie.service"}]}]}],"check":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"set":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}],"deleteAll":[{"__symbolic":"method"}],"getCookieRegExp":[{"__symbolic":"method"}],"safeDecodeURIComponent":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"CookieService":"./lib/cookie.service"},"importAs":"ngx-cookie-service"} |
{ | ||
"name": "ngx-cookie-service", | ||
"description": "an (aot ready) angular (4.2+) cookie service", | ||
"version": "10.0.1", | ||
"version": "10.1.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Stepan Suvorov <stevermeister@gmail.com>", |
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
133277
921