From 35556d5e46d07be14d680099ec313b3ea594acff Mon Sep 17 00:00:00 2001 From: Dmytro Shyrokov Date: Thu, 20 Feb 2025 15:43:11 +0200 Subject: [PATCH 1/4] Update xeUtils/bidderUtils.js: pass full gdprConsent object to the bidder --- libraries/xeUtils/bidderUtils.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libraries/xeUtils/bidderUtils.js b/libraries/xeUtils/bidderUtils.js index f03c6323d76..93b70a68d5c 100644 --- a/libraries/xeUtils/bidderUtils.js +++ b/libraries/xeUtils/bidderUtils.js @@ -77,13 +77,9 @@ export function buildRequests(validBidRequests, bidderRequest, endpoint) { } else { request.userEids = []; } - if (gdprConsent.gdprApplies) { - request.gdprApplies = Number(gdprConsent.gdprApplies); - request.consentString = gdprConsent.consentString; - } else { - request.gdprApplies = 0; - request.consentString = ''; - } + + request.gdprConsent = gdprConsent; + if (uspConsent) { request.usPrivacy = uspConsent; } else { From e296be3567d58ae526cd80418ddbf34f1ce60895 Mon Sep 17 00:00:00 2001 From: Dmytro Shyrokov Date: Thu, 20 Feb 2025 15:52:27 +0200 Subject: [PATCH 2/4] linter fix --- libraries/xeUtils/bidderUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/xeUtils/bidderUtils.js b/libraries/xeUtils/bidderUtils.js index 93b70a68d5c..498f428bc20 100644 --- a/libraries/xeUtils/bidderUtils.js +++ b/libraries/xeUtils/bidderUtils.js @@ -79,7 +79,7 @@ export function buildRequests(validBidRequests, bidderRequest, endpoint) { } request.gdprConsent = gdprConsent; - + if (uspConsent) { request.usPrivacy = uspConsent; } else { From 9bab42a554a530016d58a16143a00361ed5a6158 Mon Sep 17 00:00:00 2001 From: Dmytro Shyrokov Date: Thu, 20 Feb 2025 16:12:41 +0200 Subject: [PATCH 3/4] timeout filed passed --- libraries/xeUtils/bidderUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/xeUtils/bidderUtils.js b/libraries/xeUtils/bidderUtils.js index 498f428bc20..7e742a66c5d 100644 --- a/libraries/xeUtils/bidderUtils.js +++ b/libraries/xeUtils/bidderUtils.js @@ -43,6 +43,7 @@ export function buildRequests(validBidRequests, bidderRequest, endpoint) { const {refererInfo = {}, gdprConsent = {}, uspConsent} = bidderRequest; const requests = validBidRequests.map(req => { const request = {}; + request.tmax = bidderRequest.timeout || 0; request.bidId = req.bidId; request.banner = deepAccess(req, 'mediaTypes.banner'); request.auctionId = req.ortb2?.source?.tid; From 350ae129fa60133d6f9c8bc821e2af81082b2cb0 Mon Sep 17 00:00:00 2001 From: Dmytro Shyrokov Date: Thu, 20 Feb 2025 15:24:53 +0000 Subject: [PATCH 4/4] update related tests --- test/spec/modules/anyclipBidAdapter_spec.js | 19 ++++--------------- .../spec/modules/driftpixelBidAdapter_spec.js | 19 ++++--------------- test/spec/modules/iqxBidAdapter_spec.js | 19 ++++--------------- .../spec/modules/lm_kiviadsBidAdapter_spec.js | 19 ++++--------------- test/spec/modules/xeBidAdapter_spec.js | 19 ++++--------------- 5 files changed, 20 insertions(+), 75 deletions(-) diff --git a/test/spec/modules/anyclipBidAdapter_spec.js b/test/spec/modules/anyclipBidAdapter_spec.js index 9f34184d378..3ec81d60546 100644 --- a/test/spec/modules/anyclipBidAdapter_spec.js +++ b/test/spec/modules/anyclipBidAdapter_spec.js @@ -7,6 +7,7 @@ import {getBidFloor} from '../../../libraries/xeUtils/bidderUtils.js'; const ENDPOINT = 'https://prebid.anyclip.com'; const defaultRequest = { + tmax: 0, adUnitCode: 'test', bidId: '1', requestId: 'qwerty', @@ -102,14 +103,14 @@ describe('anyclipBidAdapter', () => { it('should build basic request structure', function () { const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0]; + expect(request).to.have.property('tmax').and.to.equal(defaultRequest.tmax); expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId); expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.ortb2.source.tid); expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.ortb2Imp.ext.tid); expect(request).to.have.property('tz').and.to.equal(new Date().getTimezoneOffset()); expect(request).to.have.property('bc').and.to.equal(1); expect(request).to.have.property('banner').and.to.deep.equal({sizes: [[300, 250], [300, 200]]}); - expect(request).to.have.property('gdprApplies').and.to.equal(0); - expect(request).to.have.property('consentString').and.to.equal(''); + expect(request).to.have.property('gdprConsent').and.to.deep.equal({}); expect(request).to.have.property('userEids').and.to.deep.equal([]); expect(request).to.have.property('usPrivacy').and.to.equal(''); expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']); @@ -205,18 +206,6 @@ describe('anyclipBidAdapter', () => { expect(request).to.have.property('floor').and.to.equal(5); }); - it('should build request with gdpr consent data if applies', function () { - const bidderRequest = { - gdprConsent: { - gdprApplies: true, - consentString: 'qwerty' - } - }; - const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0]; - expect(request).to.have.property('gdprApplies').and.equals(1); - expect(request).to.have.property('consentString').and.equals('qwerty'); - }); - it('should build request with usp consent data if applies', function () { const bidderRequest = { uspConsent: '1YA-' @@ -455,4 +444,4 @@ describe('anyclipBidAdapter', () => { expect(result).to.equal(5); }); }); -}) +}); diff --git a/test/spec/modules/driftpixelBidAdapter_spec.js b/test/spec/modules/driftpixelBidAdapter_spec.js index da84235b404..057ca1c7e9f 100644 --- a/test/spec/modules/driftpixelBidAdapter_spec.js +++ b/test/spec/modules/driftpixelBidAdapter_spec.js @@ -7,6 +7,7 @@ import {getBidFloor} from '../../../libraries/xeUtils/bidderUtils.js'; const ENDPOINT = 'https://pbjs.driftpixel.live'; const defaultRequest = { + tmax: 0, adUnitCode: 'test', bidId: '1', requestId: 'qwerty', @@ -102,6 +103,7 @@ describe('driftpixelBidAdapter', () => { it('should build basic request structure', function () { const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0]; + expect(request).to.have.property('tmax').and.to.equal(defaultRequest.tmax); expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId); expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.ortb2.source.tid); expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.ortb2Imp.ext.tid); @@ -109,8 +111,7 @@ describe('driftpixelBidAdapter', () => { expect(request).to.have.property('bc').and.to.equal(1); expect(request).to.have.property('floor').and.to.equal(null); expect(request).to.have.property('banner').and.to.deep.equal({sizes: [[300, 250], [300, 200]]}); - expect(request).to.have.property('gdprApplies').and.to.equal(0); - expect(request).to.have.property('consentString').and.to.equal(''); + expect(request).to.have.property('gdprConsent').and.to.deep.equal({}); expect(request).to.have.property('userEids').and.to.deep.equal([]); expect(request).to.have.property('usPrivacy').and.to.equal(''); expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']); @@ -205,18 +206,6 @@ describe('driftpixelBidAdapter', () => { expect(request).to.have.property('floor').and.to.equal(5); }); - it('should build request with gdpr consent data if applies', function () { - const bidderRequest = { - gdprConsent: { - gdprApplies: true, - consentString: 'qwerty' - } - }; - const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0]; - expect(request).to.have.property('gdprApplies').and.equals(1); - expect(request).to.have.property('consentString').and.equals('qwerty'); - }); - it('should build request with usp consent data if applies', function () { const bidderRequest = { uspConsent: '1YA-' @@ -455,4 +444,4 @@ describe('driftpixelBidAdapter', () => { expect(result).to.equal(5); }); }); -}) +}); diff --git a/test/spec/modules/iqxBidAdapter_spec.js b/test/spec/modules/iqxBidAdapter_spec.js index 29b03a4ed3a..553bfa4a87d 100644 --- a/test/spec/modules/iqxBidAdapter_spec.js +++ b/test/spec/modules/iqxBidAdapter_spec.js @@ -7,6 +7,7 @@ import {getBidFloor} from '../../../libraries/xeUtils/bidderUtils.js'; const ENDPOINT = 'https://pbjs.iqzonertb.live'; const defaultRequest = { + tmax: 0, adUnitCode: 'test', bidId: '1', requestId: 'qwerty', @@ -91,6 +92,7 @@ describe('iqxBidAdapter', () => { it('should build basic request structure', function () { const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0]; + expect(request).to.have.property('tmax').and.to.equal(defaultRequest.tmax); expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId); expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.ortb2.source.tid); expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.ortb2Imp.ext.tid); @@ -98,8 +100,7 @@ describe('iqxBidAdapter', () => { expect(request).to.have.property('bc').and.to.equal(1); expect(request).to.have.property('floor').and.to.equal(null); expect(request).to.have.property('banner').and.to.deep.equal({sizes: [[300, 250], [300, 200]]}); - expect(request).to.have.property('gdprApplies').and.to.equal(0); - expect(request).to.have.property('consentString').and.to.equal(''); + expect(request).to.have.property('gdprConsent').and.to.deep.equal({}); expect(request).to.have.property('userEids').and.to.deep.equal([]); expect(request).to.have.property('usPrivacy').and.to.equal(''); expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']); @@ -194,18 +195,6 @@ describe('iqxBidAdapter', () => { expect(request).to.have.property('floor').and.to.equal(5); }); - it('should build request with gdpr consent data if applies', function () { - const bidderRequest = { - gdprConsent: { - gdprApplies: true, - consentString: 'qwerty' - } - }; - const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0]; - expect(request).to.have.property('gdprApplies').and.equals(1); - expect(request).to.have.property('consentString').and.equals('qwerty'); - }); - it('should build request with usp consent data if applies', function () { const bidderRequest = { uspConsent: '1YA-' @@ -444,4 +433,4 @@ describe('iqxBidAdapter', () => { expect(result).to.equal(5); }); }); -}) +}); diff --git a/test/spec/modules/lm_kiviadsBidAdapter_spec.js b/test/spec/modules/lm_kiviadsBidAdapter_spec.js index 645dd756c19..b6c4ae9bc4b 100644 --- a/test/spec/modules/lm_kiviadsBidAdapter_spec.js +++ b/test/spec/modules/lm_kiviadsBidAdapter_spec.js @@ -7,6 +7,7 @@ import {getBidFloor} from '../../../libraries/xeUtils/bidderUtils.js'; const ENDPOINT = 'https://pbjs.kiviads.live'; const defaultRequest = { + tmax: 0, adUnitCode: 'test', bidId: '1', requestId: 'qwerty', @@ -91,6 +92,7 @@ describe('lm_kiviadsBidAdapter', () => { it('should build basic request structure', function () { const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0]; + expect(request).to.have.property('tmax').and.to.equal(defaultRequest.tmax); expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId); expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.ortb2.source.tid); expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.ortb2Imp.ext.tid); @@ -98,8 +100,7 @@ describe('lm_kiviadsBidAdapter', () => { expect(request).to.have.property('bc').and.to.equal(1); expect(request).to.have.property('floor').and.to.equal(null); expect(request).to.have.property('banner').and.to.deep.equal({sizes: [[300, 250], [300, 200]]}); - expect(request).to.have.property('gdprApplies').and.to.equal(0); - expect(request).to.have.property('consentString').and.to.equal(''); + expect(request).to.have.property('gdprConsent').and.to.deep.equal({}); expect(request).to.have.property('userEids').and.to.deep.equal([]); expect(request).to.have.property('usPrivacy').and.to.equal(''); expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']); @@ -194,18 +195,6 @@ describe('lm_kiviadsBidAdapter', () => { expect(request).to.have.property('floor').and.to.equal(5); }); - it('should build request with gdpr consent data if applies', function () { - const bidderRequest = { - gdprConsent: { - gdprApplies: true, - consentString: 'qwerty' - } - }; - const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0]; - expect(request).to.have.property('gdprApplies').and.equals(1); - expect(request).to.have.property('consentString').and.equals('qwerty'); - }); - it('should build request with usp consent data if applies', function () { const bidderRequest = { uspConsent: '1YA-' @@ -444,4 +433,4 @@ describe('lm_kiviadsBidAdapter', () => { expect(result).to.equal(5); }); }); -}) +}); diff --git a/test/spec/modules/xeBidAdapter_spec.js b/test/spec/modules/xeBidAdapter_spec.js index e15ab6251ea..c4e91d9943c 100644 --- a/test/spec/modules/xeBidAdapter_spec.js +++ b/test/spec/modules/xeBidAdapter_spec.js @@ -7,6 +7,7 @@ import {getBidFloor} from '../../../libraries/xeUtils/bidderUtils.js'; const ENDPOINT = 'https://pbjs.xe.works/bid'; const defaultRequest = { + tmax: 0, adUnitCode: 'test', bidId: '1', requestId: 'qwerty', @@ -102,6 +103,7 @@ describe('xeBidAdapter', () => { it('should build basic request structure', function () { const request = JSON.parse(spec.buildRequests([defaultRequest], {}).data)[0]; + expect(request).to.have.property('tmax').and.to.equal(defaultRequest.tmax); expect(request).to.have.property('bidId').and.to.equal(defaultRequest.bidId); expect(request).to.have.property('auctionId').and.to.equal(defaultRequest.ortb2.source.tid); expect(request).to.have.property('transactionId').and.to.equal(defaultRequest.ortb2Imp.ext.tid); @@ -109,8 +111,7 @@ describe('xeBidAdapter', () => { expect(request).to.have.property('bc').and.to.equal(1); expect(request).to.have.property('floor').and.to.equal(null); expect(request).to.have.property('banner').and.to.deep.equal({sizes: [[300, 250], [300, 200]]}); - expect(request).to.have.property('gdprApplies').and.to.equal(0); - expect(request).to.have.property('consentString').and.to.equal(''); + expect(request).to.have.property('gdprConsent').and.to.deep.equal({}); expect(request).to.have.property('userEids').and.to.deep.equal([]); expect(request).to.have.property('usPrivacy').and.to.equal(''); expect(request).to.have.property('sizes').and.to.deep.equal(['300x250', '300x200']); @@ -205,18 +206,6 @@ describe('xeBidAdapter', () => { expect(request).to.have.property('floor').and.to.equal(5); }); - it('should build request with gdpr consent data if applies', function () { - const bidderRequest = { - gdprConsent: { - gdprApplies: true, - consentString: 'qwerty' - } - }; - const request = JSON.parse(spec.buildRequests([defaultRequest], bidderRequest).data)[0]; - expect(request).to.have.property('gdprApplies').and.equals(1); - expect(request).to.have.property('consentString').and.equals('qwerty'); - }); - it('should build request with usp consent data if applies', function () { const bidderRequest = { uspConsent: '1YA-' @@ -455,4 +444,4 @@ describe('xeBidAdapter', () => { expect(result).to.equal(5); }); }); -}) +});