@adv-ui/universal-consents-cookies-widget
Advanced tools
Comparing version 1.3.3 to 1.4.0
{ | ||
"name": "@adv-ui/universal-consents-cookies-widget", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "", | ||
@@ -20,3 +20,3 @@ "main": "lib/app.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"umd": "sui-bundler lib src-umd/index.js -o umd/ -p --root" | ||
"umd": "NODE_ENV=production sui-bundler lib src-umd/index.js -o umd/ -p --root" | ||
}, | ||
@@ -39,2 +39,3 @@ "repository": { | ||
"@adv-ui/boros-reporter": "1", | ||
"@adv-ui/vendor-by-consents-loader": "1.2.0", | ||
"@s-ui/react-tcf-ui": "2", | ||
@@ -41,0 +42,0 @@ "react": "17.0.1", |
# @adv-ui/universal-consents-cookies-widget [![Build Status](https://travis.mpi-internal.com/scmspain/frontend-all--consents-cookies-widget-pack.svg?token=rg6VMzkvzMeJr1v4tr6s&branch=master)](https://travis.mpi-internal.com/scmspain/frontend-all--consents-cookies-widget-pack) | ||
## How to use? | ||
Add the next code on the `<head>` of your website in order to show the Consent Cookies Widget in case it's needed for the user. | ||
```html | ||
<script defer src='https://unpkg.com/@adv-ui/universal-consents-cookies-widget/umd/index.js'></script> | ||
<link rel='stylesheet' href='https://unpkg.com/@adv-ui/universal-consents-cookies-widget/umd/styles.css'> | ||
``` | ||
When the user accepts or rejects it, the modal will disappear. | ||
### Adding a link to open manually Consents Cookies Widget | ||
You must offer to the user the possibility to open the widget to change the consents anytime. For that, you could add this HTML in order to give this feature to the user. | ||
```html | ||
<a href='#' onclick="window.__callUniversalConsentsCookiesWidget()">Gestionar consentimientos de cookies</a> | ||
``` | ||
## Configuration | ||
You could config some aspects of the widget by using a window object called `universalConsentsCookiesWidget`. | ||
**Important:** Config should be placed BEFORE loading the widget. | ||
```html | ||
<script> | ||
window.__mpi.universalConsentsCookiesWidget = { | ||
logo: 'https://your-domain.com/your-awesome-logo.png' | ||
} | ||
</script> | ||
<script defer src='https://unpkg.com/@adv-ui/universal-consents-cookies-widget/umd/index.js'></script> | ||
``` | ||
## Load scripts for some consents | ||
Once you have the consents widget implemented in your site, you'll be able to listen when the user has consented some purposes in order to load some specific tags. | ||
For example, for adding loading tealium after user is giving consents you should do: | ||
```html | ||
<script> | ||
// init vendors loader by consents | ||
window.sui.vendors.initVendorConsentsLoader({ | ||
vendors: { | ||
tealium: { | ||
// script to load | ||
script: 'https://frtassets.fotocasa.es/external-scripts/utag-pro.js', | ||
// consents needed for this script | ||
consents: { | ||
purposes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
specialFeatureOptins: [1] | ||
} | ||
}, | ||
} | ||
}) | ||
</script> | ||
``` | ||
Please, **keep in mind that if the user doesn't provide needed consents the script won't be loaded.** | ||
[Check list of purposes by ID.](https://github.mpi-internal.com/scmspain/frontend-all--vendor-by-consents-loader#list-of-purposes). |
65
332171
5
9
+ Added@adv-ui/vendor-by-consents-loader@1.2.0(transitive)
+ Added@s-ui/js@2.31.0(transitive)
+ Addedbowser@2.11.0(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcookie@0.3.1(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddom-serializer@1.4.1(transitive)
+ Addeddomelementtype@2.3.0(transitive)
+ Addeddomhandler@4.3.1(transitive)
+ Addeddomutils@2.8.0(transitive)
+ Addedentities@2.2.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhtml-entities@2.5.2(transitive)
+ Addedhtmlparser2@6.1.0(transitive)
+ Addedhtmr@1.0.0(transitive)
+ Addedjs-cookie@2.1.4(transitive)
+ Addedjust-camel-case@4.0.2(transitive)
+ Addedjust-capitalize@1.0.1(transitive)
+ Addedjust-kebab-case@1.1.0(transitive)
+ Addedlodash.debounce@4.0.8(transitive)
+ Addedlodash.throttle@4.1.1(transitive)
+ Addednanoid@3.3.1(transitive)
+ Addedobject-inspect@1.13.1(transitive)
+ Addedqs@6.11.2(transitive)
+ Addedremove-accents@0.4.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedside-channel@1.0.6(transitive)