Skip to content

Commit

Permalink
Various Adapters: Delete s2s transform bid params for adapters with n…
Browse files Browse the repository at this point in the history
…o server equivalent (prebid#11402)

* Brightcom adapter: remove adapters (prebid#10925)

* Update adagioBidAdapter.js

* Update adrelevantisBidAdapter.js

* Update big-richmediaBidAdapter.js

* Update craftBidAdapter.js

* Update goldbachBidAdapter.js

* Update winrBidAdapter.js

* Update vibrantmediaBidAdapter.js

* Update winrBidAdapter.js

* Update goldbachBidAdapter.js

* Update craftBidAdapter.js

* Update adrelevantisBidAdapter.js

* Revert "Brightcom adapter: remove adapters (prebid#10925)" (prebid#11404)

This reverts commit 878f737.

* Update goldbachBidAdapter.js

* Update goldbachBidAdapter.js

* Update adagioBidAdapter_spec.js

* Update big-richmediaBidAdapter_spec.js

* Update vibrantmediaBidAdapter_spec.js

* Update vibrantmediaBidAdapter_spec.js

---------

Co-authored-by: Alexandru <prBigBrother@users.noreply.github.com>
  • Loading branch information
2 people authored and mefjush committed May 21, 2024
1 parent f876310 commit 51bc0d0
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 205 deletions.
14 changes: 0 additions & 14 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1275,20 +1275,6 @@ export const spec = {

return syncs;
},

/**
* Handle custom logic in s2s context
*
* @param {*} params
* @param {boolean} isOrtb Is an s2s context
* @param {*} adUnit
* @param {*} bidRequests
* @returns {object} updated params
*/
transformBidParams(params, isOrtb, adUnit, bidRequests) {
// We do not have a prebid server adapter. So let's return unchanged params.
return params;
}
};

initAdagio();
Expand Down
26 changes: 1 addition & 25 deletions modules/adrelevantisBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {find, includes} from '../src/polyfill.js';
import {INSTREAM, OUTSTREAM} from '../src/video.js';
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';
import {getANKeywordParam, transformBidderParamKeywords} from '../libraries/appnexusUtils/anKeywords.js';
import {convertCamelToUnderscore} from '../libraries/appnexusUtils/anUtils.js';
import {convertTypes} from '../libraries/transformParamsUtils/convertTypes.js';
import {getANKeywordParam} from '../libraries/appnexusUtils/anKeywords.js';
import {chunk} from '../libraries/chunk/chunk.js';

/**
Expand Down Expand Up @@ -187,28 +185,6 @@ export const spec = {
}

return bids;
},

transformBidParams: function(params, isOpenRtb) {
params = convertTypes({
'placementId': 'number',
'keywords': transformBidderParamKeywords
}, params);

if (isOpenRtb) {
params.use_pmt_rule = (typeof params.usePaymentRule === 'boolean') ? params.usePaymentRule : false;
if (params.usePaymentRule) { delete params.usePaymentRule; }

Object.keys(params).forEach(paramKey => {
let convertedKey = convertCamelToUnderscore(paramKey);
if (convertedKey !== paramKey) {
params[convertedKey] = params[paramKey];
delete params[paramKey];
}
});
}

return params;
}
};

Expand Down
5 changes: 0 additions & 5 deletions modules/big-richmediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ export const spec = {
return baseAdapter.getUserSyncs(syncOptions, responses, gdprConsent);
},

transformBidParams: function (params, isOpenRtb) {
if (!baseAdapter.transformBidParams) { return params; }
return baseAdapter.transformBidParams(params, isOpenRtb);
},

/**
* Add element selector to javascript tracker to improve native viewability
* @param {Bid} bid
Expand Down
22 changes: 1 addition & 21 deletions modules/craftBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import {getStorageManager} from '../src/storageManager.js';
import {ajax} from '../src/ajax.js';
import {hasPurpose1Consent} from '../src/utils/gpdr.js';
import {convertOrtbRequestToProprietaryNative} from '../src/native.js';
import {getANKeywordParam, transformBidderParamKeywords} from '../libraries/appnexusUtils/anKeywords.js';
import {convertCamelToUnderscore} from '../libraries/appnexusUtils/anUtils.js';
import {convertTypes} from '../libraries/transformParamsUtils/convertTypes.js';
import {getANKeywordParam} from '../libraries/appnexusUtils/anKeywords.js';

const BIDDER_CODE = 'craft';
const URL_BASE = 'https://gacraft.jp/prebid-v3';
Expand Down Expand Up @@ -101,24 +99,6 @@ export const spec = {
}
},

transformBidParams: function(params, isOpenRtb) {
params = convertTypes({
'sitekey': 'string',
'placementId': 'string',
'keywords': transformBidderParamKeywords,
}, params);
if (isOpenRtb) {
Object.keys(params).forEach(paramKey => {
let convertedKey = convertCamelToUnderscore(paramKey);
if (convertedKey !== paramKey) {
params[convertedKey] = params[paramKey];
delete params[paramKey];
}
});
}
return params;
},

onBidWon: function(bid) {
ajax(bid._prebidWon, null, null, {
method: 'POST',
Expand Down
28 changes: 1 addition & 27 deletions modules/goldbachBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ import {INSTREAM, OUTSTREAM} from '../src/video.js';
import {hasPurpose1Consent} from '../src/utils/gpdr.js';
import {convertOrtbRequestToProprietaryNative} from '../src/native.js';
import {APPNEXUS_CATEGORY_MAPPING} from '../libraries/categoryTranslationMapping/index.js';
import {getANKeywordParam, transformBidderParamKeywords} from '../libraries/appnexusUtils/anKeywords.js';
import {getANKeywordParam} from '../libraries/appnexusUtils/anKeywords.js';
import {convertCamelToUnderscore, fill} from '../libraries/appnexusUtils/anUtils.js';
import {convertTypes} from '../libraries/transformParamsUtils/convertTypes.js';
import {chunk} from '../libraries/chunk/chunk.js';

/**
Expand Down Expand Up @@ -386,31 +385,6 @@ export const spec = {
}
},

transformBidParams: function (params, isOpenRtb) {
params = convertTypes({
'member': 'string',
'invCode': 'string',
'placementId': 'number',
'keywords': transformBidderParamKeywords,
'publisherId': 'number'
}, params);

if (isOpenRtb) {
params.use_pmt_rule = (typeof params.usePaymentRule === 'boolean') ? params.usePaymentRule : false;
if (params.usePaymentRule) { delete params.usePaymentRule; }

Object.keys(params).forEach(paramKey => {
let convertedKey = convertCamelToUnderscore(paramKey);
if (convertedKey !== paramKey) {
params[convertedKey] = params[paramKey];
delete params[paramKey];
}
});
}

return params;
},

/**
* Add element selector to javascript tracker to improve native viewability
* @param {Bid} bid
Expand Down
11 changes: 0 additions & 11 deletions modules/vibrantmediaBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,6 @@ export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: SUPPORTED_MEDIA_TYPES,

/**
* Transforms the 'raw' bid params into ones that this adapter can use, prior to creating the bid request.
*
* @param {object} bidParams the params to transform.
*
* @returns {object} the bid params.
*/
transformBidParams: function(bidParams) {
return bidParams;
},

/**
* Determines whether or not the given bid request is valid. For all bid requests passed to the buildRequests
* function, each will have been passed to this function and this function will have returned true.
Expand Down
36 changes: 1 addition & 35 deletions modules/winrBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import {BANNER} from '../src/mediaTypes.js';
import {find, includes} from '../src/polyfill.js';
import {getStorageManager} from '../src/storageManager.js';
import {hasPurpose1Consent} from '../src/utils/gpdr.js';
import {getANKeywordParam, transformBidderParamKeywords} from '../libraries/appnexusUtils/anKeywords.js';
import {getANKeywordParam} from '../libraries/appnexusUtils/anKeywords.js';
import {convertCamelToUnderscore} from '../libraries/appnexusUtils/anUtils.js';
import {convertTypes} from '../libraries/transformParamsUtils/convertTypes.js';

/**
* @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
Expand Down Expand Up @@ -312,39 +311,6 @@ export const spec = {
];
}
},

transformBidParams: function (params, isOpenRtb) {
params = convertTypes(
{
member: 'string',
invCode: 'string',
placementId: 'number',
keywords: transformBidderParamKeywords,
publisherId: 'number',
},
params
);

if (isOpenRtb) {
params.use_pmt_rule =
typeof params.usePaymentRule === 'boolean'
? params.usePaymentRule
: false;
if (params.usePaymentRule) {
delete params.usePaymentRule;
}

Object.keys(params).forEach((paramKey) => {
let convertedKey = convertCamelToUnderscore(paramKey);
if (convertedKey !== paramKey) {
params[convertedKey] = params[paramKey];
delete params[paramKey];
}
});
}

return params;
},
};

function formatRequest(payload, bidderRequest) {
Expand Down
27 changes: 0 additions & 27 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1465,33 +1465,6 @@ describe('Adagio bid adapter', () => {
});
});

describe('transformBidParams', function() {
it('Compute additional params in s2s mode', function() {
const adUnit = {
code: 'adunit-code',
params: {
organizationId: '1000'
}
};
const bid01 = new BidRequestBuilder({
'mediaTypes': {
banner: { sizes: [[300, 250]] },
video: {
context: 'outstream',
playerSize: [300, 250],
renderer: {
url: 'https://url.tld',
render: () => true
}
}
}
}).withParams().build();

const params = spec.transformBidParams({ param01: 'test' }, true, adUnit, [{ bidderCode: 'adagio', auctionId: bid01.auctionId, bids: [bid01] }]);
expect(params.param01).eq('test');
});
});

describe('Adagio features when prebid in top.window', function() {
it('should return all expected features when all expected bidder params are available', function() {
sandbox.stub(window.top.document, 'getElementById').returns(
Expand Down
25 changes: 0 additions & 25 deletions test/spec/modules/big-richmediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,31 +271,6 @@ describe('bigRichMediaAdapterTests', function () {
});
});

describe('transformBidParams', function() {
it('cast placementId to number', function() {
const adUnit = {
code: 'adunit-code',
params: {
placementId: '456'
}
};
const bid = {
params: {
placementId: '456'
},
sizes: [[300, 250]],
mediaTypes: {
banner: { sizes: [[300, 250]] }
}
};

const params = spec.transformBidParams({ placementId: '456' }, true, adUnit, [{ bidderCode: 'bigRichmedia', auctionId: bid.auctionId, bids: [bid] }]);

expect(params.placement_id).to.exist;
expect(params.placement_id).to.be.a('number');
});
});

describe('onBidWon', function() {
it('Should not have any error', function() {
const result = spec.onBidWon({});
Expand Down
19 changes: 4 additions & 15 deletions test/spec/modules/vibrantmediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ describe('VibrantMediaBidAdapter', function () {
});
});

describe('transformBidParams', function () {
it('transforms bid params correctly', function () {
expect(spec.transformBidParams(VALID_VIDEO_BID_PARAMS)).to.deep.equal(VALID_VIDEO_BID_PARAMS);
});
})

let bidRequest;

beforeEach(function () {
Expand Down Expand Up @@ -1077,13 +1071,9 @@ describe('VibrantMediaBidAdapter', function () {
describe('Flow tests', function () {
describe('For successive API calls to the public functions', function () {
it('should succeed with one media type per bid', function () {
const transformedBannerBidParams = spec.transformBidParams(VALID_BANNER_BID_PARAMS);
const transformedVideoBidParams = spec.transformBidParams(VALID_VIDEO_BID_PARAMS);
const transformedNativeBidParams = spec.transformBidParams(VALID_NATIVE_BID_PARAMS);

const bannerBid = {
bidder: 'vibrantmedia',
params: transformedBannerBidParams,
params: VALID_BANNER_BID_PARAMS,
mediaTypes: {
banner: {
sizes: DEFAULT_BID_SIZES,
Expand All @@ -1097,7 +1087,7 @@ describe('VibrantMediaBidAdapter', function () {
};
const videoBid = {
bidder: 'vibrantmedia',
params: transformedVideoBidParams,
params: VALID_VIDEO_BID_PARAMS,
mediaTypes: {
video: {
context: OUTSTREAM,
Expand All @@ -1112,7 +1102,7 @@ describe('VibrantMediaBidAdapter', function () {
};
const nativeBid = {
bidder: 'vibrantmedia',
params: transformedNativeBidParams,
params: VALID_NATIVE_BID_PARAMS,
mediaTypes: {
native: {
image: {
Expand Down Expand Up @@ -1178,10 +1168,9 @@ describe('VibrantMediaBidAdapter', function () {
});

it('should succeed with multiple media types for a single bid', function () {
const bidParams = spec.transformBidParams(VALID_VIDEO_BID_PARAMS);
const bid = {
bidder: 'vibrantmedia',
params: bidParams,
params: VALID_VIDEO_BID_PARAMS,
mediaTypes: {
banner: {
sizes: DEFAULT_BID_SIZES
Expand Down

0 comments on commit 51bc0d0

Please sign in to comment.