Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@financial-times/privacy-utils

Package Overview
Dependencies
Maintainers
10
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@financial-times/privacy-utils

A set of utilities to help with managing a user's privacy preferences

  • 2.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
402
increased by13.88%
Maintainers
10
Weekly downloads
 
Created
Source

Privacy Utils

What it is

A module that exports a set of useful helper functions and types for working with privacy legislations and framework

Functions will generally be available for both server-side and client-side code

Usage

Example usage to check consent for a particular custom purpose:

  1. Make sure you have created/updated the custom purpose in src/packages/privacy-utils/src/custom-purposes.ts
  2. Install, import and use helper function
import { checkConsentFor } from "@financial-times/privacy-utils";

const cookieConsent = getCookieValue("FTConsentV2");

const { gdpr, ccpa, leg: activeLegislation } = cookieConsent;

const consentState = {
  gdpr,
  ccpa,
  activeLegislation,
};

const canRunPermutive = checkConsentFor("permutive", consentState); // boolean

This package exposes a simple util function that is designed to work the FT.com footer. This function will use a querySelector to find and update the legacy 'Manage Cookie' link so that it works with the new CMP behavior. The new behavior will open the CMP Modal; whereas the legacy behavior is to take the user to the Manage Cookies Page.

Example usage
import { updateFooterLinkCMP } from "@financial-times/privacy-utils";
...
 if (flagsClient.get('adsDisableInternalCMP')) {
  updateFooterLinkCMP();
 }

FAQs

Package last updated on 27 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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