Skip to content

Commit

Permalink
update placement logic, deprecated in 9.0 prebid version (#11600)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamc-ins committed May 29, 2024
1 parent e1b028f commit deeeb9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
14 changes: 5 additions & 9 deletions modules/insticatorBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function buildVideo(bidRequest) {
let w = deepAccess(bidRequest, 'mediaTypes.video.w');
let h = deepAccess(bidRequest, 'mediaTypes.video.h');
const mimes = deepAccess(bidRequest, 'mediaTypes.video.mimes');
const placement = deepAccess(bidRequest, 'mediaTypes.video.placement') || 3;
const placement = deepAccess(bidRequest, 'mediaTypes.video.placement');
const plcmt = deepAccess(bidRequest, 'mediaTypes.video.plcmt') || undefined;
const playerSize = deepAccess(bidRequest, 'mediaTypes.video.playerSize');
const context = deepAccess(bidRequest, 'mediaTypes.video.context');
Expand Down Expand Up @@ -136,6 +136,10 @@ function buildVideo(bidRequest) {
}
}

if (placement && typeof placement !== 'undefined' && typeof placement === 'number') {
optionalParams['placement'] = placement;
}

if (plcmt) {
optionalParams['plcmt'] = plcmt;
}
Expand All @@ -145,7 +149,6 @@ function buildVideo(bidRequest) {
}

let videoObj = {
placement,
mimes,
w,
h,
Expand Down Expand Up @@ -595,13 +598,6 @@ function validateVideo(bid) {
return false;
}

const placement = deepAccess(bid, 'mediaTypes.video.placement');

if (typeof placement !== 'undefined' && typeof placement !== 'number') {
logError('insticator: video placement is not a number');
return false;
}

const plcmt = deepAccess(bid, 'mediaTypes.video.plcmt');

if (typeof plcmt !== 'undefined' && typeof plcmt !== 'number') {
Expand Down
25 changes: 3 additions & 22 deletions test/spec/modules/insticatorBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,6 @@ describe('InsticatorBidAdapter', function () {
})).to.be.true;
})

it('should return false if video placement is not a number', () => {
expect(spec.isBidRequestValid({
...bidRequest,
...{
mediaTypes: {
video: {
mimes: [
'video/mp4',
'video/mpeg',
],
w: 250,
h: 300,
placement: 'NaN',
},
}
}
})).to.be.false;
});

it('should return false if video plcmt is not a number', () => {
expect(spec.isBidRequestValid({
...bidRequest,
Expand Down Expand Up @@ -224,7 +205,7 @@ describe('InsticatorBidAdapter', function () {
'video/mpeg',
],
playerSize: [250, 300],
placement: 1,
plcmt: 1,
},
}
}
Expand Down Expand Up @@ -293,7 +274,7 @@ describe('InsticatorBidAdapter', function () {
'video/mpeg',
],
playerSize: [250, 300],
placement: 1,
plcmt: 1,
},
}
},
Expand All @@ -306,7 +287,7 @@ describe('InsticatorBidAdapter', function () {
'video/x-flv',
'video/webm',
],
placement: 2,
plcmt: 2,
},
}
})).to.be.true;
Expand Down

0 comments on commit deeeb9e

Please sign in to comment.