@financial-times/privacy-us-privacy
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -67,5 +67,8 @@ "use strict"; | ||
function setUSPrivacyCookie(consent) { | ||
// The problem of removing any subdomain from a hostname is relatively involved, | ||
// and we are not trying to make it this work for every possible subdomain yet | ||
const domain = (document.location.hostname || "").replace("www.", ""); | ||
const uspString = `1Y${consent ? "N" : "Y"}N`; | ||
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/`; | ||
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/;domain=${domain}`; | ||
} | ||
exports.setUSPrivacyCookie = setUSPrivacyCookie; |
@@ -63,4 +63,7 @@ import { fetchLegislation } from "@financial-times/privacy-legislation-client"; | ||
export function setUSPrivacyCookie(consent) { | ||
// The problem of removing any subdomain from a hostname is relatively involved, | ||
// and we are not trying to make it this work for every possible subdomain yet | ||
const domain = (document.location.hostname || "").replace("www.", ""); | ||
const uspString = `1Y${consent ? "N" : "Y"}N`; | ||
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/`; | ||
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/;domain=${domain}`; | ||
} |
{ | ||
"name": "@financial-times/privacy-us-privacy", | ||
"description": "", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"main": "dist/cjs/main.js", | ||
@@ -15,3 +15,3 @@ "module": "dist/esm/main.js", | ||
"dependencies": { | ||
"@financial-times/privacy-legislation-client": "^0.3.4" | ||
"@financial-times/privacy-legislation-client": "^0.3.5" | ||
}, | ||
@@ -18,0 +18,0 @@ "scripts": { |
@@ -88,4 +88,7 @@ import { fetchLegislation } from "@financial-times/privacy-legislation-client"; | ||
export function setUSPrivacyCookie(consent: boolean): void { | ||
// The problem of removing any subdomain from a hostname is relatively involved, | ||
// and we are not trying to make it this work for every possible subdomain yet | ||
const domain = (document.location.hostname || "").replace("www.", ""); | ||
const uspString = `1Y${consent ? "N" : "Y"}N`; | ||
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/`; | ||
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/;domain=${domain}`; | ||
} |
15683
402