Skip to content

Commit

Permalink
comments removing +new events
Browse files Browse the repository at this point in the history
- removed/commented some console log from code
- added UI events
    # isBannerShown
    # isBannerHidden
    # isModalShown
    # isModalHidden
  • Loading branch information
giegi committed Sep 21, 2019
1 parent ae7169a commit 62075fe
Show file tree
Hide file tree
Showing 8 changed files with 2,684 additions and 1,262 deletions.
3 changes: 1 addition & 2 deletions src/complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ function handleConsentResult(cmp, {vendorListVersion: listVersion} = {}, {create
//console.log("[CMP LOG] - config", config);
//console.log("[CMP LOG] - publisherConsents", publisherConsents);
} catch (e) {
console.log("[CMP LOG] - handleConsentResult ERROR");
console.log(e);
//console.log("[CMP LOG] - handleConsentResult ERROR", e);
}
if (!created) {
log.debug('No consent data found. Showing consent tool');
Expand Down
11 changes: 4 additions & 7 deletions src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class App extends Component {

};
onGeneralAcceptance = state => {
console.log("ENDED BY HERE", state);
//console.log("ENDED BY HERE", state);
};

onSelectPurpose = purposeItem => {
Expand Down Expand Up @@ -66,9 +66,9 @@ export default class App extends Component {
onSelectCustomPurpose = (customPurposeItem, _visitedCustomPurposes) => {

const { store } = this.props;
console.log("customPurposeItem", customPurposeItem);
console.log("_visitedCustomPurposes BEFORE", _visitedCustomPurposes);
console.log("Current State", _visitedCustomPurposes.hasOwnProperty(customPurposeItem.id));
//console.log("customPurposeItem", customPurposeItem);
//console.log("_visitedCustomPurposes BEFORE", _visitedCustomPurposes);
//console.log("Current State", _visitedCustomPurposes.hasOwnProperty(customPurposeItem.id));
let stateCustomPurpose = null;
if(_visitedCustomPurposes.hasOwnProperty(customPurposeItem.id) === true) {
if(_visitedCustomPurposes[customPurposeItem.id] === true) {
Expand All @@ -91,10 +91,7 @@ export default class App extends Component {
});
store.selectCustomPurpose(customPurposeItem.id, stateCustomPurpose);
const { visitedCustomPurposes } = this.state;
console.log("_visitedCustomPurposes AFTER", _visitedCustomPurposes);
console.log("visitedCustomPurposes AFTER", visitedCustomPurposes);
store.storeUpdate();
// store and persist data [....to do....]
};

updateState = (store) => {
Expand Down
18 changes: 9 additions & 9 deletions src/components/popup/details/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class Details extends Component {
onSelectPurpose(purposeItem);
};
handleGeneralPurposeClick = state => {
console.log("Clicked on general acceptance....", state, this.props);
//console.log("Clicked on general acceptance....", state, this.props);
this.props.store.selectAllPurposesAndVendors(state);
};
handleCustomPurposeClick = (customPurposeItem, visitedCustomPurposes) => {
Expand All @@ -57,7 +57,7 @@ export default class Details extends Component {
visitedCustomPurposes = {};

render(props, state) {
console.log("renderizzato");
//console.log("renderizzato");
const {
onSave,
onClose,
Expand Down Expand Up @@ -94,20 +94,20 @@ export default class Details extends Component {
const { purposes: customPurposes = [] } = customPurposeList;

for(var prop in this.visitedCustomPurposes) {
console.log("RESULT", prop);
//console.log("[CMP LOG] details.jsx...RESULT", prop);
}
console.log("VisitedCustomPurposes is empty?", JSON.stringify(this.visitedCustomPurposes) === JSON.stringify({}));
//console.log("[CMP LOG] details.jsx...VisitedCustomPurposes is empty?", JSON.stringify(this.visitedCustomPurposes) === JSON.stringify({}));

console.log("DETAILS.jsx visitedCustomPurposes (1)", this.visitedCustomPurposes, this.visitedCustomPurposes.length);
console.log("DETAILS.jsx customPurposeList", customPurposeList);
console.log("DETAILS.jsx publisherConsentData", publisherConsentData.selectedCustomPurposeIds);
//console.log("[CMP LOG] details.jsx...visitedCustomPurposes (1)", this.visitedCustomPurposes, this.visitedCustomPurposes.length);
//console.log("[CMP LOG] details.jsx...customPurposeList", customPurposeList);
//console.log("[CMP LOG] details.jsx...publisherConsentData", publisherConsentData.selectedCustomPurposeIds);
if(JSON.stringify(this.visitedCustomPurposes) === JSON.stringify({}) === true) {
publisherConsentData.selectedCustomPurposeIds.forEach( a => {
//console.log(a);
//console.log("[CMP LOG] details.jsx...", a);
this.visitedCustomPurposes[a] = true;
});
}
console.log("DETAILS.jsx visitedCustomPurposes (2)", this.visitedCustomPurposes, this.visitedCustomPurposes.length);
//console.log("[CMP LOG] details.jsx...visitedCustomPurposes (2)", this.visitedCustomPurposes, this.visitedCustomPurposes.length);

const formattedVendors = vendors
.map(vendor => ({
Expand Down
17 changes: 14 additions & 3 deletions src/lib/cmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default class Cmp {
store.subscribe(this.storeChange);
this.processCommand.receiveMessage = this.receiveMessage;
this.commandQueue = [];
this.showStatus = { isBannerShowing:false, isModalShowing:false };

}

commands = {
Expand Down Expand Up @@ -189,9 +191,18 @@ export default class Cmp {
storeChange = (_store) => {
//console.log("[CMP LOG] STORECHANGED - store passed object", _store)
//console.log("[CMP LOG] STORE VISIBILITY: " + _store.isModalShowing + " = " + _store.isBannerShowing);
if(_store.isModalShowing === true || _store.isBannerShowing === true) {
this.notify("isShown");
//console.log("[CMP LOG] this.showStatus VISIBILITY: " + this.showStatus.isModalShowing + " = " + this.showStatus.isBannerShowing);
if(_store.isBannerShowing === false && this.showStatus.isBannerShowing === true) {
this.notify("isBannerHidden");
} else if(_store.isBannerShowing === true && this.showStatus.isBannerShowing === false) {
this.notify("isBannerShown");
} else if(_store.isModalShowing === true && this.showStatus.isModalShowing === false) {
this.notify("isModalShown");
} else if(_store.isModalShowing === false && this.showStatus.isModalShowing === true) {
this.notify("isModalHidden");
}
this.showStatus.isModalShowing = _store.isModalShowing;
this.showStatus.isBannerShowing = _store.isBannerShowing;
};
generateConsentString = () => {
const {
Expand Down Expand Up @@ -261,7 +272,7 @@ export default class Cmp {
* @param {*} parameter Expected parameter for command
*/
processCommand = (command, parameter, callback) => {
console.log("[CMP LOG] COMMAND RECEIVED", "COMMAND", command, "persistedVendorConsentData", this.store.persistedVendorConsentData, "persistedPublisherConsentData", this.store.persistedPublisherConsentData);
//console.log("[CMP LOG] COMMAND RECEIVED", "COMMAND", command, "persistedVendorConsentData", this.store.persistedVendorConsentData, "persistedPublisherConsentData", this.store.persistedPublisherConsentData);
if (typeof this.commands[command] !== 'function') {
log.error(`Invalid CMP command "${command}"`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/cookie/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function writeGlobalVendorConsentCookie(vendorConsentData) {
* @returns Promise resolved with decoded cookie object
*/
function readLocalVendorConsentCookie() {
console.log("[CMP LOG] - readLocalVendorConsentCookie", this);
//console.log("[CMP LOG] - readLocalVendorConsentCookie", this);
const cookie = readCookie(VENDOR_CONSENT_COOKIE_NAME);
log.debug('Read consent data from local cookie', cookie);
return Promise.resolve(cookie && decodeVendorConsentData(cookie));
Expand All @@ -294,7 +294,7 @@ function writeLocalVendorConsentCookie(vendorConsentData) {
}

function readVendorConsentCookie() {
console.log("[CMP LOG - store consent globally", config.storeConsentGlobally);
//console.log("[CMP LOG - store consent globally", config.storeConsentGlobally);
return config.storeConsentGlobally ?
readGlobalVendorConsentCookie() : readLocalVendorConsentCookie();
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const CMP_VERSION = 1.1;

// CMP_ID is the ID of your consent management provider according to the IAB. Get an ID here: https://advertisingconsent.eu/cmps/
const CMP_ID = 223;
//const CMP_ID = 0;

// The cookie specification version, as determined by the IAB. Current is 1.
const COOKIE_VERSION = 1;
Expand Down Expand Up @@ -44,7 +45,7 @@ export function init(configUpdates) {
pubVendorsList,
allowedVendorIds
});
console.log("[CMP LOG] VENDOR CONSENT DATA", vendorConsentData);
//console.log("[CMP LOG] VENDOR CONSENT DATA", vendorConsentData);
// Pull queued command from __cmp stub
const {commandQueue = []} = window[CMP_GLOBAL_NAME] || {};

Expand Down
4 changes: 2 additions & 2 deletions src/lib/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export default class Store {
this.storeUpdate();
};
updateVendorList = vendorList => {
console.log("[CMP LOG] updateVendorList");
//console.log("[CMP LOG] updateVendorList");
const {
allowedVendorIds
} = this;
Expand Down Expand Up @@ -367,7 +367,7 @@ export default class Store {
};
updateCustomPurposeList = customPurposeList => {
const {created} = this.publisherConsentData;
console.log("[CMP LOG] updateCustomPurposesList");
//console.log("[CMP LOG] updateCustomPurposesList");
// If publisher consent has never been persisted set the default selected status
if (!created) {
const {purposes = [], } = customPurposeList || {};
Expand Down
Loading

0 comments on commit 62075fe

Please sign in to comment.