5.0.1 • Published 6 days ago

@financial-times/privacy-legislation-client v5.0.1

Weekly downloads
727
License
-
Repository
-
Last release
6 days ago

Privacy Legislation Client

What it is

A module that reports which privacy-related legislation applies in the user's current location.

Available for both server and client: see example

Usage

Typical usage would be to add the module to your app, call the imported method and then update the UI in line with any applicable legal requirements:

import { fetchLegislation, buildConsentPageUrl } from "@financial-times/privacy-legislation-client";

function onPageLoad() {
  /**
   * `legislation`: a Set of applicable laws: "ccpa", "gdpr", etc
   * `region`: Identifies countries or subdivisions - "GB", "US-CA"
   */ 
  const { legislation, region } = await fetchLegislation();

  // Contruct a standardised URL for the Consent Page, embedding legislation  & referrer
  const url = buildConsentPageUrl({ url: "...", legislation })

  if(legislation.has("ccpa")) {
    insertCCPALink(url)
  }

  if(legislation.has("gdpr")) {
    ...
  }
}

How it works

This module is a lightweight wrapper over the Fetch API that hits https://privacy.ft.com/api/v1/compliance-region.json, and exposes the comma-delimted response as a property called legislation in the form of a Set.

The abstraction allows us to change implementation details like the API's URL, version, etc. without impacting consumers

See the legislation-api for more details

5.0.1

6 days ago

5.0.0

9 days ago

4.2.0-beta.1

23 days ago

4.1.0

1 month ago

4.0.0

3 months ago

3.5.0-beta.1

3 months ago

3.5.0-beta.2

3 months ago

3.4.0-beta.2

3 months ago

3.4.0-beta.1

3 months ago

3.3.0

3 months ago

3.3.0-beta.5

3 months ago

3.3.0-beta.4

3 months ago

3.1.4

5 months ago

3.2.0

5 months ago

3.1.3

5 months ago

3.1.2

6 months ago

0.0.0-beta.2

6 months ago

3.1.1

6 months ago

1.2.0

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

3.0.1-alpha

6 months ago

2.0.5-beta.3

7 months ago

2.0.5-beta.2

7 months ago

2.0.4-alpha

7 months ago

1.3.0

7 months ago

3.0.1-beta

6 months ago

2.2.1

7 months ago

2.0.3

7 months ago

2.2.3-alpha

6 months ago

2.2.0

7 months ago

2.0.2

7 months ago

2.2.2

6 months ago

2.0.4

7 months ago

2.1.0

7 months ago

2.0.0

7 months ago

3.0.1

6 months ago

3.0.0

6 months ago

0.0.0-beta.1

6 months ago

1.0.0

4 years ago

0.3.9

4 years ago

0.3.10

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago