Skip to content

Commit e24c1ec

Browse files
authored
Merge pull request #86 from digi-trust/master
v1.0.1 Bugfixes
2 parents 16c2480 + 05547d8 commit e24c1ec

File tree

10 files changed

+25
-19
lines changed

10 files changed

+25
-19
lines changed

metadata.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"cmpVersion": 1,
3-
"cmpId": 1,
3+
"cmpId": 15,
44
"maxCookieLifespanDays" : 390,
55
"cmpGlobalName": "__cmp",
6-
"portalUrl": "https://cdn.digitrust.mgr.consensu.org/1/portal.html",
6+
"globalConsentLocation": "https://cdn.digitrust.mgr.consensu.org/1/portal.html",
77
"globalVendorListLocation": "https://vendorlist.consensu.org/vendorlist.json",
88
"countryCodes": [
99
"GB",
@@ -21,6 +21,7 @@
2121
"NL",
2222
"HR",
2323
"IE",
24+
"CH",
2425
"CZ",
2526
"AT",
2627
"HU",

src/docs/assets/purposes.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
"purposes": [
44
{
55
"id": 1,
6-
"name": "Custom Purpose 1"
6+
"name": "Custom Purpose 1",
7+
"description": "Here's a description of the first purpose"
78
},
89
{
910
"id": 2,
10-
"name": "Custom Purpose 2"
11+
"name": "Custom Purpose 2",
12+
"description": "Here's a description of the second purpose"
1113
},
1214
{
1315
"id": 3,
14-
"name": "Custom Purpose 3"
16+
"name": "Custom Purpose 3",
17+
"description": "Here's a description of the third purpose"
1518
},
1619
{
1720
"id": 4,
18-
"name": "Custom Purpose 4"
21+
"name": "Custom Purpose 4",
22+
"description": "Here's a description of the fourth purpose"
1923
}
2024
]
2125
}

src/lib/cookie/cookie.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function decodePublisherConsentData(cookieValue) {
185185
cookieVersion,
186186
cmpId,
187187
vendorListVersion,
188-
publisherPurposeVersion,
188+
publisherPurposesVersion,
189189
created,
190190
lastUpdated,
191191
standardPurposeIdBitString,
@@ -196,7 +196,7 @@ function decodePublisherConsentData(cookieValue) {
196196
cookieVersion,
197197
cmpId,
198198
vendorListVersion,
199-
publisherPurposeVersion,
199+
publisherPurposesVersion,
200200
created,
201201
lastUpdated,
202202
selectedPurposeIds: decodeBitsToIds(standardPurposeIdBitString),

src/lib/cookie/cookie.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('cookie', () => {
122122
cookieVersion: 1,
123123
cmpId: 1,
124124
vendorListVersion: 1,
125-
publisherPurposeVersion: 1,
125+
publisherPurposesVersion: 1,
126126
created: aDate,
127127
lastUpdated: aDate,
128128
selectedCustomPurposeIds: new Set([2, 3])
@@ -206,7 +206,7 @@ describe('cookie', () => {
206206
cookieVersion: 1,
207207
cmpId: 1,
208208
vendorListVersion: 1,
209-
publisherPurposeVersion: 1,
209+
publisherPurposesVersion: 1,
210210
created: aDate,
211211
lastUpdated: aDate,
212212
};

src/lib/cookie/cookieutils.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe('cookieutils', () => {
251251
lastUpdated: aDate,
252252
cmpId: 1,
253253
vendorListVersion: 1,
254-
publisherPurposeVersion: 1,
254+
publisherPurposesVersion: 1,
255255
numCustomPurposes: 4,
256256
standardPurposeIdBitString: '000000001010101010001100',
257257
customPurposeIdBitString: '1011',

src/lib/cookie/definitions/publisher/version1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
{ name: 'lastUpdated', type: 'date', numBits: 36 },
77
{ name: 'cmpId', type: 'int', numBits: 12 },
88
{ name: 'vendorListVersion', type: 'int', numBits: 12 },
9-
{ name: 'publisherPurposeVersion', type: 'int', numBits: 12 },
9+
{ name: 'publisherPurposesVersion', type: 'int', numBits: 12 },
1010
{ name: 'standardPurposeIdBitString', type: 'bits', numBits: 24 },
1111
{ name: 'numCustomPurposes', type: 'int', numBits: 6 },
1212
{

src/lib/portal.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import config from "./config";
22
import Promise from "promise-polyfill";
3+
const metadata = require("../../metadata.json");
34

45
const PORTAL_LOAD_TIMEOUT_MILLISECONDS = 5000;
56
const PORTAL_COMMAND_TIMEOUT_MILLISECONDS = 2000;
@@ -23,7 +24,7 @@ function openGlobalVendorPortal() {
2324
// Only ever create a single iframe
2425
if (!globalVendorPortal) {
2526
globalVendorPortal = new Promise((resolve, reject) => {
26-
const url = config.globalConsentLocation;
27+
const url = (config.globalConsentLocation || metadata.globalConsentLocation);
2728
const iframe = document.createElement('iframe');
2829
iframe.setAttribute('style', 'width:1px;height:1px;position:absolute;left:-99px;top:-99px;');
2930
iframe.setAttribute('src', url);

src/lib/store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export default class Store {
185185
lastUpdated,
186186
cmpId,
187187
vendorListVersion,
188-
publisherPurposeVersion,
188+
publisherPurposesVersion,
189189
selectedCustomPurposeIds = new Set()
190190
} = persistedPublisherConsentData;
191191

@@ -220,7 +220,7 @@ export default class Store {
220220
lastUpdated,
221221
cmpId,
222222
vendorListVersion,
223-
publisherPurposeVersion,
223+
publisherPurposesVersion,
224224
standardPurposes: standardPurposeMap,
225225
customPurposes: customPurposeMap
226226
};
@@ -396,7 +396,7 @@ export default class Store {
396396
}
397397

398398
const {version = 1} = customPurposeList || {};
399-
this.publisherConsentData.publisherPurposeVersion = version;
399+
this.publisherConsentData.publisherPurposesVersion = version;
400400

401401
this.customPurposeList = customPurposeList;
402402
this.storeUpdate();

src/lib/store.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ describe('store', () => {
6565
expect(store.customPurposeList).to.be.undefined;
6666

6767
expect(store.vendorConsentData.cookieVersion).to.equal(1);
68-
expect(store.vendorConsentData.cmpId).to.equal(1);
68+
expect(store.vendorConsentData.cmpId).to.equal(15);
6969

7070
expect(store.publisherConsentData.cookieVersion).to.equal(1);
71-
expect(store.publisherConsentData.cmpId).to.equal(1);
71+
expect(store.publisherConsentData.cmpId).to.equal(15);
7272
});
7373

7474

webpack.config.babel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const commonConfig = {
133133
},
134134
{
135135
test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
136-
use: ENV === 'production' ? 'file-loader' : 'url-loader'
136+
use: 'url-loader'
137137
}
138138
]
139139
},

0 commit comments

Comments
 (0)