Skip to content

Commit

Permalink
Merge pull request #86 from digi-trust/master
Browse files Browse the repository at this point in the history
v1.0.1 Bugfixes
  • Loading branch information
SupahNickie authored May 22, 2018
2 parents 16c2480 + 05547d8 commit e24c1ec
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 19 deletions.
5 changes: 3 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"cmpVersion": 1,
"cmpId": 1,
"cmpId": 15,
"maxCookieLifespanDays" : 390,
"cmpGlobalName": "__cmp",
"portalUrl": "https://cdn.digitrust.mgr.consensu.org/1/portal.html",
"globalConsentLocation": "https://cdn.digitrust.mgr.consensu.org/1/portal.html",
"globalVendorListLocation": "https://vendorlist.consensu.org/vendorlist.json",
"countryCodes": [
"GB",
Expand All @@ -21,6 +21,7 @@
"NL",
"HR",
"IE",
"CH",
"CZ",
"AT",
"HU",
Expand Down
12 changes: 8 additions & 4 deletions src/docs/assets/purposes.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
"purposes": [
{
"id": 1,
"name": "Custom Purpose 1"
"name": "Custom Purpose 1",
"description": "Here's a description of the first purpose"
},
{
"id": 2,
"name": "Custom Purpose 2"
"name": "Custom Purpose 2",
"description": "Here's a description of the second purpose"
},
{
"id": 3,
"name": "Custom Purpose 3"
"name": "Custom Purpose 3",
"description": "Here's a description of the third purpose"
},
{
"id": 4,
"name": "Custom Purpose 4"
"name": "Custom Purpose 4",
"description": "Here's a description of the fourth purpose"
}
]
}
4 changes: 2 additions & 2 deletions src/lib/cookie/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function decodePublisherConsentData(cookieValue) {
cookieVersion,
cmpId,
vendorListVersion,
publisherPurposeVersion,
publisherPurposesVersion,
created,
lastUpdated,
standardPurposeIdBitString,
Expand All @@ -196,7 +196,7 @@ function decodePublisherConsentData(cookieValue) {
cookieVersion,
cmpId,
vendorListVersion,
publisherPurposeVersion,
publisherPurposesVersion,
created,
lastUpdated,
selectedPurposeIds: decodeBitsToIds(standardPurposeIdBitString),
Expand Down
4 changes: 2 additions & 2 deletions src/lib/cookie/cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('cookie', () => {
cookieVersion: 1,
cmpId: 1,
vendorListVersion: 1,
publisherPurposeVersion: 1,
publisherPurposesVersion: 1,
created: aDate,
lastUpdated: aDate,
selectedCustomPurposeIds: new Set([2, 3])
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('cookie', () => {
cookieVersion: 1,
cmpId: 1,
vendorListVersion: 1,
publisherPurposeVersion: 1,
publisherPurposesVersion: 1,
created: aDate,
lastUpdated: aDate,
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/cookie/cookieutils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('cookieutils', () => {
lastUpdated: aDate,
cmpId: 1,
vendorListVersion: 1,
publisherPurposeVersion: 1,
publisherPurposesVersion: 1,
numCustomPurposes: 4,
standardPurposeIdBitString: '000000001010101010001100',
customPurposeIdBitString: '1011',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/cookie/definitions/publisher/version1.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
{ name: 'lastUpdated', type: 'date', numBits: 36 },
{ name: 'cmpId', type: 'int', numBits: 12 },
{ name: 'vendorListVersion', type: 'int', numBits: 12 },
{ name: 'publisherPurposeVersion', type: 'int', numBits: 12 },
{ name: 'publisherPurposesVersion', type: 'int', numBits: 12 },
{ name: 'standardPurposeIdBitString', type: 'bits', numBits: 24 },
{ name: 'numCustomPurposes', type: 'int', numBits: 6 },
{
Expand Down
3 changes: 2 additions & 1 deletion src/lib/portal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import config from "./config";
import Promise from "promise-polyfill";
const metadata = require("../../metadata.json");

const PORTAL_LOAD_TIMEOUT_MILLISECONDS = 5000;
const PORTAL_COMMAND_TIMEOUT_MILLISECONDS = 2000;
Expand All @@ -23,7 +24,7 @@ function openGlobalVendorPortal() {
// Only ever create a single iframe
if (!globalVendorPortal) {
globalVendorPortal = new Promise((resolve, reject) => {
const url = config.globalConsentLocation;
const url = (config.globalConsentLocation || metadata.globalConsentLocation);
const iframe = document.createElement('iframe');
iframe.setAttribute('style', 'width:1px;height:1px;position:absolute;left:-99px;top:-99px;');
iframe.setAttribute('src', url);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default class Store {
lastUpdated,
cmpId,
vendorListVersion,
publisherPurposeVersion,
publisherPurposesVersion,
selectedCustomPurposeIds = new Set()
} = persistedPublisherConsentData;

Expand Down Expand Up @@ -220,7 +220,7 @@ export default class Store {
lastUpdated,
cmpId,
vendorListVersion,
publisherPurposeVersion,
publisherPurposesVersion,
standardPurposes: standardPurposeMap,
customPurposes: customPurposeMap
};
Expand Down Expand Up @@ -396,7 +396,7 @@ export default class Store {
}

const {version = 1} = customPurposeList || {};
this.publisherConsentData.publisherPurposeVersion = version;
this.publisherConsentData.publisherPurposesVersion = version;

this.customPurposeList = customPurposeList;
this.storeUpdate();
Expand Down
4 changes: 2 additions & 2 deletions src/lib/store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ describe('store', () => {
expect(store.customPurposeList).to.be.undefined;

expect(store.vendorConsentData.cookieVersion).to.equal(1);
expect(store.vendorConsentData.cmpId).to.equal(1);
expect(store.vendorConsentData.cmpId).to.equal(15);

expect(store.publisherConsentData.cookieVersion).to.equal(1);
expect(store.publisherConsentData.cmpId).to.equal(1);
expect(store.publisherConsentData.cmpId).to.equal(15);
});


Expand Down
2 changes: 1 addition & 1 deletion webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const commonConfig = {
},
{
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
use: ENV === 'production' ? 'file-loader' : 'url-loader'
use: 'url-loader'
}
]
},
Expand Down

0 comments on commit e24c1ec

Please sign in to comment.