2.0.4 • Published 7 months ago

@financial-times/privacy-utils v2.0.4

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

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

CMP footer link util function

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();
 }
2.0.4

7 months ago

2.0.4-alpha

7 months ago

2.0.3

7 months ago

2.0.2

7 months ago

2.0.0

7 months ago

1.3.0

7 months ago

1.2.0

8 months ago

1.1.1

8 months ago