Socket
Socket
Sign inDemoInstall

@springernature/global-javascript

Package Overview
Dependencies
Maintainers
12
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springernature/global-javascript - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

__tests__/unit/util/onetrust.spec.js

4

HISTORY.md
# History
## 2.3.0 (2020-07-14)
* FEATURE: checkConsent util
* FEATURE: isConsentBannerClosed util
## 2.2.0 (2020-07-10)

@@ -4,0 +8,0 @@ * FEATURE: getCookie util

2

package.json
{
"name": "@springernature/global-javascript",
"version": "2.2.0",
"version": "2.3.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Globally shared Javascript helpers",

@@ -21,8 +21,9 @@ # Global Javascript

- [getCookie](#getcookie)
- [getCookie](#debounce)
- [getCookie](#throttle)
- [debounce](#debounce)
- [throttle](#throttle)
- [onetrust](#onetrust)
**Dom**
- [getDataOptions](#getDataOptions)
- [getDataOptions](#getdataoptions)

@@ -107,2 +108,34 @@ ### Util

#### onetrust
OneTrust is the cookie management tool we use in order to aid GDPR compliance.
This helper exports two named functions, `checkConsent` and `isConsentBannerClosed`.
##### checkConsent
Takes a OneTrust category string and returns a boolean representing whether the category has been consent to (retrieved from the `OptanonConsent` cookie).
Valid categories are:
- "strictlyNecessary"
- "performance"
- "functional"
- "targetingFirstParty"
- "targetingThirdParty"
```javascript
checkConsent('targetingThirdParty');
```
An error will be thrown if an invalid category is passed in.
##### isConsentBannerClosed
Returns a boolean representing whether the cookie consent banner has been closed (retrieved from the `OptanonAlertBoxClosed` cookie).
```javascript
isConsentBannerClosed();
```
### Dom

@@ -109,0 +142,0 @@ Dom helpers are used to help achieve JavaScript tasks that involve getting information from, or manipulating the DOM.

@@ -7,2 +7,3 @@ // Util

import {getCookie} from './util/get-cookie';
import {checkConsent, isConsentBannerClosed} from './util/onetrust';

@@ -12,2 +13,2 @@ // Dom

export {makeArray, createEvent, debounce, throttle, getCookie, getDataOptions};
export {makeArray, createEvent, debounce, throttle, getCookie, getDataOptions, checkConsent, isConsentBannerClosed};
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