Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from tv2/feature/TV2DK-2490
Browse files Browse the repository at this point in the history
TV2DK-2490: custom purposes use default
  • Loading branch information
Jeppe Sigaard authored Jul 8, 2019
2 parents c58005b + d4f3efa commit 9b594fe
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 9 deletions.
87 changes: 87 additions & 0 deletions src/demos/cpc-custom-purposes-default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Test Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- tag::oil-config[] -->
<script id="oil-configuration" type="application/configuration">
{
"config_version": 1,
"advanced_settings": true,
"poi_group_name": "testGroup",
"timeout": -1,
"publicPath": "/",
"locale": {
"version": 1,
"localeId": "de",
"texts": {
"label_intro_heading": "We use cookies and other technologies",
"label_intro": "The website uses cookies, web beacons, JavaScript and similar technologies.",
"label_button_yes": "OK",
"label_button_back": "Back",
"label_button_advanced_settings": "More information",
"label_cpc_heading": "Please select a privacy setting:",
"label_cpc_text": "cpc_text",
"label_cpc_activate_all": "Activate all",
"label_cpc_deactivate_all": "Deactivate all",
"label_cpc_purpose_desc": "Purposes",
"label_cpc_purpose_01_text": "Accessing a Device",
"label_cpc_purpose_01_desc": "Allow storing or accessing information on a user’s device.",
"label_cpc_purpose_02_text": "Advertising Personalisation",
"label_cpc_purpose_02_desc": "Allow processing of a user’s data to provide and inform personalised advertising (including delivery, measurement, and reporting) based on a user’s preferences or interests known or inferred from data collected across multiple sites, apps, or devices; and/or accessing or storing information on devices for that purpose.",
"label_cpc_purpose_03_text": "Analytics",
"label_cpc_purpose_03_desc": "Allow processing of a user’s data to deliver content or advertisements and measure the delivery of such content or advertisements, extract insights and generate reports to understand service usage; and/or accessing or storing information on devices for that purpose.",
"label_cpc_purpose_04_text": "Content Personalisation",
"label_cpc_purpose_04_desc": "Allow processing of a user’s data to provide and inform personalised content (including delivery, measurement, and reporting) based on a user’s preferences or interests known or inferred from data collected across multiple sites, apps, or devices; and/or accessing or storing information on devices for that purpose.",
"label_cpc_purpose_05_text": "Matching Data to Offline Sources",
"label_cpc_purpose_05_desc": "Combining data from offline sources that were initially collected in other contexts",
"label_cpc_purpose_06_text": "Linking Devices",
"label_cpc_purpose_06_desc": "Allow processing of a user’s data to connect such user across multiple devices.",
"label_cpc_purpose_07_text": "Precise Geographic Location data",
"label_cpc_purpose_07_desc": "Allow processing of a user’s precise geographic location data in support of a purpose for which that certain third party has consent",
"label_poi_group_list_heading": "Your consent for companies of the group",
"label_poi_group_list_text": "Here is a list of companies of the group:",
"label_third_party": "Third Parties",
"label_thirdparty_list_heading": "Your consent for third party software",
"label_thirdparty_list_text": "Your consent",
"label_nocookie_head": "In order to be able to provide our services in the best possible way, cookies must be activated in your browser.",
"label_nocookie_text": "Please activate Cookies in the properties of your Browsers."
}
},
"customPurposes": [{
"id": 25,
"name": "Custom Purpose 1",
"description": "Lorem!"
},
{
"id": 26,
"name": "Custom Purpose 2",
"description": "Lorem2!"
}],
"advanced_settings_purposes_default": true
}
</script>
<!-- end::oil-config[] -->
<style>
body {
font-family: 'Nunito', sans-serif;
font-size: 60px;
color: #f7f7f7;
height: 100%;
background: linear-gradient(20deg, #3a871a 0%, #a5ba10 50%, #cfcd26 100%);
padding: 0;
margin: 0;
}

.demoname {
padding: 24px;
}
</style>
</head>

<body>
<div class="demoname">Group A Site A</div>
</body>
</html>
4 changes: 2 additions & 2 deletions src/scripts/userview/userview_modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import * as AdvancedSettingsStandard from './view/oil.advanced.settings.standard
import * as AdvancedSettingsTabs from './view/oil.advanced.settings.tabs';
import { logError, logInfo } from '../core/core_log';
import { getCpcType, getTheme, getTimeOutValue, isOptoutConfirmRequired, isPersistMinimumTracking } from './userview_config';
import { gdprApplies, getAdvancedSettingsPurposesDefault, isPoiActive } from '../core/core_config';
import { gdprApplies, getAdvancedSettingsPurposesDefault, isPoiActive, getCustomPurposeIds } from '../core/core_config';
import { applyPrivacySettings, getPrivacySettings, getSoiConsentData } from './userview_privacy';
import { activateOptoutConfirm } from './userview_optout_confirm';
import { getPurposeIds, loadVendorListAndCustomVendorList } from '../core/core_vendor_lists';
Expand Down Expand Up @@ -96,7 +96,7 @@ export function oilShowPreferenceCenter() {
if (consentData) {
currentPrivacySettings = consentData.getPurposesAllowed();
} else {
currentPrivacySettings = getAdvancedSettingsPurposesDefault() ? getPurposeIds() : [];
currentPrivacySettings = getAdvancedSettingsPurposesDefault() ? [...getPurposeIds(), ...getCustomPurposeIds()] : [];
}
applyPrivacySettings(currentPrivacySettings);
});
Expand Down
12 changes: 5 additions & 7 deletions src/scripts/userview/userview_privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,17 @@ export function getPrivacySettings() {
export function applyPrivacySettings(allowedPurposes) {
logInfo('Apply privacy settings from cookie', allowedPurposes);

for (let i = 1; i <= getPurposes().length; i++) {
document.querySelector(`#as-js-purpose-slider-${i}`).checked = (allowedPurposes.indexOf(i) !== -1);
}

if (allowedPurposes === 1) {
forEach(document.querySelectorAll('.as-js-purpose-slider'), (domNode) => {
domNode && (domNode.checked = true);
});
}

if (allowedPurposes === 0) {
} else if (allowedPurposes === 0) {
forEach(document.querySelectorAll('.as-js-purpose-slider'), (domNode) => {
domNode && (domNode.checked = false);
});
} else if (allowedPurposes) {
for (let i = 1; i <= getPurposes().length; i++) {
document.querySelector(`#as-js-purpose-slider-${i}`).checked = (allowedPurposes.indexOf(i) !== -1);
}
}
}

0 comments on commit 9b594fe

Please sign in to comment.