Skip to content

Commit

Permalink
BlueBillyWig Bid Adapter: add renderer customization options (#6540)
Browse files Browse the repository at this point in the history
* add Blue Billywig adapter

* Blue Billywig Adapter - update according to review feedback

* Blue Billywig Adapter - update to try and pass CircleCI

* Remove the last for .. of in bluebillywigBidAdapter.js, hopefully...

* Update bluebillywigBidAdapter test parameters to match renderer to rendererCode rename

* Blue Billywig - Also pass through site config with OpenRTB request

* add Blue Billywig adapter

* Blue Billywig Adapter - update according to review feedback

* Blue Billywig Adapter - update to try and pass CircleCI

* Remove the last for .. of in bluebillywigBidAdapter.js, hopefully...

* Code quality update, always hit user syncs, improved video params

* Remove unnecessary export

* Add rendererSettings param to bluebillywig adapter

* Kick off CircleCi tests manually

Co-authored-by: Klaas-Jan Boon <klaas-janboon@ip-172-16-224-85.eu-west-1.compute.internal>
Co-authored-by: Chris Huie <phoenixtechnerd@gmail.com>
  • Loading branch information
3 people authored and idettman committed May 21, 2021
1 parent 866af99 commit feba9c5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/bluebillywigBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const BB_CONSTANTS = {
const getConfig = config.getConfig;

// Helper Functions
export const BB_HELPERS = {
const BB_HELPERS = {
addSiteAppDevice: function(request, pageUrl) {
if (typeof getConfig('app') === 'object') request.app = getConfig('app');
else {
Expand Down Expand Up @@ -151,7 +151,7 @@ const BB_RENDERER = {
const ele = document.getElementById(bid.adUnitCode); // NB convention
const renderer = find(window.bluebillywig.renderers, r => r._id === rendererId);

if (renderer) renderer.bootstrap(config, ele);
if (renderer) renderer.bootstrap(config, ele, bid.rendererSettings || {});
else utils.logWarn(`${BB_CONSTANTS.BIDDER_CODE}: Couldn't find a renderer with ${rendererId}`);
},
newRenderer: function(rendererUrl, adUnitCode) {
Expand Down Expand Up @@ -235,6 +235,11 @@ export const spec = {
return false;
}

if (bid.params.hasOwnProperty('rendererSettings') && (bid.params.rendererSettings === null || typeof bid.params.rendererSettings !== 'object')) {
utils.logError(`${BB_CONSTANTS.BIDDER_CODE}: params.rendererSettings must be of type object. Rejecting bid: `, bid);
return false;
}

if (bid.hasOwnProperty('mediaTypes') && bid.mediaTypes.hasOwnProperty(VIDEO)) {
if (!bid.mediaTypes[VIDEO].hasOwnProperty('context')) {
utils.logError(`${BB_CONSTANTS.BIDDER_CODE}: no context specified in bid. Rejecting bid: `, bid);
Expand Down Expand Up @@ -330,6 +335,7 @@ export const spec = {
bid.publicationName = bidParams.publicationName;
bid.rendererCode = bidParams.rendererCode;
bid.accountId = bidParams.accountId;
bid.rendererSettings = bidParams.rendererSettings;

const rendererUrl = BB_HELPERS.getRendererUrl(bid.publicationName, bid.rendererCode);
bid.renderer = BB_RENDERER.newRenderer(rendererUrl, bid.adUnitCode);
Expand Down
19 changes: 19 additions & 0 deletions test/spec/modules/bluebillywigBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,25 @@ describe('BlueBillywigAdapter', () => {
bid.params.video = void (0);
expect(spec.isBidRequestValid(bid)).to.equal(false);
});

it('should fail if rendererSettings is specified but is not an object', () => {
const bid = deepClone(baseValidBid);

bid.params.rendererSettings = null;
expect(spec.isBidRequestValid(bid)).to.equal(false);

bid.params.rendererSettings = 'string';
expect(spec.isBidRequestValid(bid)).to.equal(false);

bid.params.rendererSettings = 123;
expect(spec.isBidRequestValid(bid)).to.equal(false);

bid.params.rendererSettings = false;
expect(spec.isBidRequestValid(bid)).to.equal(false);

bid.params.rendererSettings = void (0);
expect(spec.isBidRequestValid(bid)).to.equal(false);
});
});

describe('buildRequests', () => {
Expand Down

0 comments on commit feba9c5

Please sign in to comment.