-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
consentManagement - add support for safeframe workflow #2523
Changes from all commits
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 |
---|---|---|
|
@@ -107,6 +107,35 @@ exports.transformAdServerTargetingObj = function (targeting) { | |
} | ||
}; | ||
|
||
/** | ||
* Read an adUnit object and return the sizes used in an [[728, 90]] format (even if they had [728, 90] defined) | ||
* Preference is given to the `adUnit.mediaTypes.banner.sizes` object over the `adUnit.sizes` | ||
* @param {object} adUnit one adUnit object from the normal list of adUnits | ||
* @returns {array[array[number]]} array of arrays containing numeric sizes | ||
*/ | ||
export function getAdUnitSizes(adUnit) { | ||
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. any reason this is a new function vs reusing 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. that function converts the sizes into an array of strings like |
||
if (!adUnit) { | ||
return; | ||
} | ||
|
||
let sizes = []; | ||
if (adUnit.mediaTypes && adUnit.mediaTypes.banner && Array.isArray(adUnit.mediaTypes.banner.sizes)) { | ||
let bannerSizes = adUnit.mediaTypes.banner.sizes; | ||
if (Array.isArray(bannerSizes[0])) { | ||
sizes = bannerSizes; | ||
} else { | ||
sizes.push(bannerSizes); | ||
} | ||
} else if (Array.isArray(adUnit.sizes)) { | ||
if (Array.isArray(adUnit.sizes[0])) { | ||
sizes = adUnit.sizes; | ||
} else { | ||
sizes.push(adUnit.sizes); | ||
} | ||
} | ||
return sizes; | ||
} | ||
|
||
/** | ||
* Parse a GPT-Style general size Array like `[[300, 250]]` or `"300x250,970x90"` into an array of sizes `["300x250"]` or '['300x250', '970x90']' | ||
* @param {array[array|number]} sizeObj Input array or double array [300,250] or [[300,250], [728,90]] | ||
|
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.
The spec uses
data.VendorConsents
(with a capital V). Not sure if it's a typo, or may be referring to the full VendorConsents object. should confirm this.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.
I checked internally with our resident CMP developer and he indicated it should be lower-case (ie normal syntax).
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.
cool. Looks good then.