Socket
Socket
Sign inDemoInstall

@financial-times/privacy-us-privacy

Package Overview
Dependencies
Maintainers
18
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@financial-times/privacy-us-privacy - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

3

dist/cjs/main.d.ts

@@ -18,3 +18,4 @@ declare global {

* @param consent - Does the user have consent for CCPA
* @param domain - An optional explicit domain for the cookie
*/
export declare function setUSPrivacyCookie(consent: boolean): void;
export declare function setUSPrivacyCookie(consent: boolean, domain?: string): void;

@@ -74,7 +74,8 @@ "use strict";

* @param consent - Does the user have consent for CCPA
* @param domain - An optional explicit domain for the cookie
*/
function setUSPrivacyCookie(consent) {
function setUSPrivacyCookie(consent, domain) {
// 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.", "");
domain = domain || (document.location.hostname || "").replace("www.", "");
const uspString = `1Y${consent ? "N" : "Y"}N`;

@@ -81,0 +82,0 @@ document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/;domain=${domain}`;

@@ -18,3 +18,4 @@ declare global {

* @param consent - Does the user have consent for CCPA
* @param domain - An optional explicit domain for the cookie
*/
export declare function setUSPrivacyCookie(consent: boolean): void;
export declare function setUSPrivacyCookie(consent: boolean, domain?: string): void;

@@ -69,9 +69,10 @@ import { fetchLegislation } from "@financial-times/privacy-legislation-client";

* @param consent - Does the user have consent for CCPA
* @param domain - An optional explicit domain for the cookie
*/
export function setUSPrivacyCookie(consent) {
export function setUSPrivacyCookie(consent, domain) {
// 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.", "");
domain = domain || (document.location.hostname || "").replace("www.", "");
const uspString = `1Y${consent ? "N" : "Y"}N`;
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/;domain=${domain}`;
}
{
"name": "@financial-times/privacy-us-privacy",
"description": "",
"version": "0.3.7",
"version": "0.3.8",
"main": "dist/cjs/main.js",

@@ -15,3 +15,3 @@ "module": "dist/esm/main.js",

"dependencies": {
"@financial-times/privacy-legislation-client": "^0.3.7"
"@financial-times/privacy-legislation-client": "^0.3.8"
},

@@ -18,0 +18,0 @@ "scripts": {

@@ -94,9 +94,10 @@ import { fetchLegislation } from "@financial-times/privacy-legislation-client";

* @param consent - Does the user have consent for CCPA
* @param domain - An optional explicit domain for the cookie
*/
export function setUSPrivacyCookie(consent: boolean): void {
export function setUSPrivacyCookie(consent: boolean, domain?: string): 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.", "");
domain = domain || (document.location.hostname || "").replace("www.", "");
const uspString = `1Y${consent ? "N" : "Y"}N`;
document.cookie = `usprivacy=${uspString}; max-age=${60 * 60 * 24 * 365};path=/;domain=${domain}`;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc