@springernature/global-javascript
Advanced tools
Comparing version 2.2.0 to 2.3.0
# 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 |
{ | ||
"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}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20251
18
430
179