Skip to content

Commit

Permalink
Criteo Bid Adapter : fix getFloor usage issue (prebid#9243)
Browse files Browse the repository at this point in the history
getFloor call context is loss when we reference it as a callback ; we need to make sure that it is properly mapped as getFloor function assumes that "this" is the actual bid request object
  • Loading branch information
leonardlabat authored and jorgeluisrocha committed May 18, 2023
1 parent 5513760 commit 74bbdb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,18 +672,18 @@ function enrichSlotWithFloors(slot, bidRequest) {
if (bidRequest.mediaTypes?.banner) {
slotFloors.banner = {};
const bannerSizes = parseSizes(deepAccess(bidRequest, 'mediaTypes.banner.sizes'))
bannerSizes.forEach(bannerSize => slotFloors.banner[parseSize(bannerSize).toString()] = getFloor({ size: bannerSize, mediaType: BANNER }));
bannerSizes.forEach(bannerSize => slotFloors.banner[parseSize(bannerSize).toString()] = getFloor.call(bidRequest, { size: bannerSize, mediaType: BANNER }));
}

if (bidRequest.mediaTypes?.video) {
slotFloors.video = {};
const videoSizes = parseSizes(deepAccess(bidRequest, 'mediaTypes.video.playerSize'))
videoSizes.forEach(videoSize => slotFloors.video[parseSize(videoSize).toString()] = getFloor({ size: videoSize, mediaType: VIDEO }));
videoSizes.forEach(videoSize => slotFloors.video[parseSize(videoSize).toString()] = getFloor.call(bidRequest, { size: videoSize, mediaType: VIDEO }));
}

if (bidRequest.mediaTypes?.native) {
slotFloors.native = {};
slotFloors.native['*'] = getFloor({ size: '*', mediaType: NATIVE });
slotFloors.native['*'] = getFloor.call(bidRequest, { size: '*', mediaType: NATIVE });
}

if (Object.keys(slotFloors).length > 0) {
Expand Down

0 comments on commit 74bbdb0

Please sign in to comment.