-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Narrow vendors disclosed to only the vendors we show in the UI #4250
Changes from 2 commits
46ceadd
bde1fee
c97138b
84fa8a7
133f213
ba7f2b6
65713f2
e84dfa6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,17 +39,22 @@ export const generateTcString = async ({ | |
tcModel.cmpVersion = CMP_VERSION; | ||
tcModel.consentScreen = 1; // todo- On which 'screen' consent was captured; this is a CMP proprietary number encoded into the TC string | ||
|
||
// Narrow the GVL to say we've only showed these vendors provided by our experience | ||
const vendorIds = [ | ||
...(experience.tcf_vendor_consents?.map((v) => +v.id) || []), | ||
...(experience.tcf_vendor_legitimate_interests?.map((v) => +v.id) || []), | ||
]; | ||
tcModel.gvl.narrowVendorsTo(vendorIds); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah! narrowVendorsTo, good find
|
||
|
||
if (tcStringPreferences) { | ||
if ( | ||
tcStringPreferences.vendorsConsent && | ||
tcStringPreferences.vendorsConsent.length > 0 | ||
) { | ||
Comment on lines
-73
to
-76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need these |
||
tcStringPreferences.vendorsConsent.forEach((vendorId) => { | ||
if (vendorIsGvl({ id: vendorId }, experience.gvl)) { | ||
tcModel.vendorConsents.set(+vendorId); | ||
} | ||
}); | ||
tcStringPreferences.vendorsLegint.forEach((vendorId) => { | ||
// Set vendors on tcModel | ||
tcStringPreferences.vendorsConsent.forEach((vendorId) => { | ||
if (vendorIsGvl({ id: vendorId }, experience.gvl)) { | ||
tcModel.vendorConsents.set(+vendorId); | ||
} | ||
}); | ||
tcStringPreferences.vendorsLegint.forEach((vendorId) => { | ||
if (vendorIsGvl({ id: vendorId }, experience.gvl)) { | ||
const thisVendor = experience.tcf_vendor_legitimate_interests?.filter( | ||
(v) => v.id === vendorId | ||
)[0]; | ||
|
@@ -70,39 +75,24 @@ export const generateTcString = async ({ | |
tcModel.vendorLegitimateInterests.set(+vendorId); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
// Set purpose consent on tcModel | ||
if ( | ||
tcStringPreferences.purposesConsent && | ||
tcStringPreferences.purposesConsent.length > 0 | ||
) { | ||
tcStringPreferences.purposesConsent.forEach((purposeId) => { | ||
tcModel.purposeConsents.set(+purposeId); | ||
}); | ||
} | ||
if ( | ||
tcStringPreferences.purposesLegint && | ||
tcStringPreferences.purposesLegint.length > 0 | ||
) { | ||
tcStringPreferences.purposesLegint.forEach((purposeId) => { | ||
const id = +purposeId; | ||
if (!FORBIDDEN_LEGITIMATE_INTEREST_PURPOSE_IDS.includes(id)) { | ||
tcModel.purposeLegitimateInterests.set(id); | ||
} | ||
}); | ||
} | ||
// Set purposes on tcModel | ||
tcStringPreferences.purposesConsent.forEach((purposeId) => { | ||
tcModel.purposeConsents.set(+purposeId); | ||
}); | ||
tcStringPreferences.purposesLegint.forEach((purposeId) => { | ||
const id = +purposeId; | ||
if (!FORBIDDEN_LEGITIMATE_INTEREST_PURPOSE_IDS.includes(id)) { | ||
tcModel.purposeLegitimateInterests.set(id); | ||
} | ||
}); | ||
|
||
// Set special feature opt-ins on tcModel | ||
if ( | ||
tcStringPreferences.specialFeatures && | ||
tcStringPreferences.specialFeatures.length > 0 | ||
) { | ||
tcStringPreferences.specialFeatures.forEach((id) => { | ||
tcModel.specialFeatureOptins.set(+id); | ||
}); | ||
} | ||
tcStringPreferences.specialFeatures.forEach((id) => { | ||
tcModel.specialFeatureOptins.set(+id); | ||
}); | ||
|
||
// note that we cannot set consent for special purposes nor features because the IAB policy states | ||
// the user is not given choice by a CMP. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, Dawn's commit here 7b86c15 reminded me that in addition we should filter to just the IDs that are GVL, now that we are supporting AC. I will do that shortly