Skip to content

Commit

Permalink
Smarthub replace placement (#11629)
Browse files Browse the repository at this point in the history
* update adapter SmartHub: add aliases

* SmartHub adapter: replace placement

* add getter video.plcmt and update test

* revert placement to plcmt

---------

Co-authored-by: Victor <[email protected]>
  • Loading branch information
SmartHubSolutions and Victor authored Jun 4, 2024
1 parent 5653058 commit 1258c53
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
45 changes: 23 additions & 22 deletions modules/smarthubBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getPlacementReqData(bid) {
const { partnerName, seat, token, iabCat, minBidfloor, pos } = params;
const bidfloor = getBidFloor(bid);

const placement = {
const plcmt = {
partnerName: String(partnerName || bidder).toLowerCase(),
seat,
token,
Expand All @@ -61,31 +61,32 @@ function getPlacementReqData(bid) {
};

if (mediaTypes && mediaTypes[BANNER]) {
placement.adFormat = BANNER;
placement.sizes = mediaTypes[BANNER].sizes;
plcmt.adFormat = BANNER;
plcmt.sizes = mediaTypes[BANNER].sizes;
} else if (mediaTypes && mediaTypes[VIDEO]) {
placement.adFormat = VIDEO;
placement.playerSize = mediaTypes[VIDEO].playerSize;
placement.minduration = mediaTypes[VIDEO].minduration;
placement.maxduration = mediaTypes[VIDEO].maxduration;
placement.mimes = mediaTypes[VIDEO].mimes;
placement.protocols = mediaTypes[VIDEO].protocols;
placement.startdelay = mediaTypes[VIDEO].startdelay;
placement.placement = mediaTypes[VIDEO].placement;
placement.skip = mediaTypes[VIDEO].skip;
placement.skipafter = mediaTypes[VIDEO].skipafter;
placement.minbitrate = mediaTypes[VIDEO].minbitrate;
placement.maxbitrate = mediaTypes[VIDEO].maxbitrate;
placement.delivery = mediaTypes[VIDEO].delivery;
placement.playbackmethod = mediaTypes[VIDEO].playbackmethod;
placement.api = mediaTypes[VIDEO].api;
placement.linearity = mediaTypes[VIDEO].linearity;
plcmt.adFormat = VIDEO;
plcmt.playerSize = mediaTypes[VIDEO].playerSize;
plcmt.minduration = mediaTypes[VIDEO].minduration;
plcmt.maxduration = mediaTypes[VIDEO].maxduration;
plcmt.mimes = mediaTypes[VIDEO].mimes;
plcmt.protocols = mediaTypes[VIDEO].protocols;
plcmt.startdelay = mediaTypes[VIDEO].startdelay;
plcmt.placement = mediaTypes[VIDEO].plcmt;
plcmt.plcmt = mediaTypes[VIDEO].plcmt; // https://github.com/prebid/Prebid.js/issues/10452
plcmt.skip = mediaTypes[VIDEO].skip;
plcmt.skipafter = mediaTypes[VIDEO].skipafter;
plcmt.minbitrate = mediaTypes[VIDEO].minbitrate;
plcmt.maxbitrate = mediaTypes[VIDEO].maxbitrate;
plcmt.delivery = mediaTypes[VIDEO].delivery;
plcmt.playbackmethod = mediaTypes[VIDEO].playbackmethod;
plcmt.api = mediaTypes[VIDEO].api;
plcmt.linearity = mediaTypes[VIDEO].linearity;
} else if (mediaTypes && mediaTypes[NATIVE]) {
placement.native = mediaTypes[NATIVE];
placement.adFormat = NATIVE;
plcmt.native = mediaTypes[NATIVE];
plcmt.adFormat = NATIVE;
}

return placement;
return plcmt;
}

function getBidFloor(bid) {
Expand Down
2 changes: 2 additions & 0 deletions test/spec/modules/smarthubBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('SmartHubBidAdapter', function () {
playerSize: [[300, 300]],
minduration: 5,
maxduration: 60,
plcmt: 1,
}
},
params: {
Expand Down Expand Up @@ -197,6 +198,7 @@ describe('SmartHubBidAdapter', function () {
expect(placement.playerSize).to.be.an('array');
expect(placement.minduration).to.be.an('number');
expect(placement.maxduration).to.be.an('number');
expect(placement.plcmt).to.be.an('number');
break;
case NATIVE:
expect(placement.native).to.be.an('object');
Expand Down

0 comments on commit 1258c53

Please sign in to comment.