prebid.js 5.19.0 → 5.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +4 -5
- package/modules/adxcgBidAdapter.js +311 -359
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/appnexusBidAdapter.js +9 -3
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/betweenBidAdapter.js +2 -1
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/gridBidAdapter.js +1 -0
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +7 -1
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/kinessoIdSystem.js +1 -1
- package/modules/livewrappedAnalyticsAdapter.js +5 -0
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +5 -1
- package/modules/openxBidAdapter.js +1 -1
- package/modules/operaadsBidAdapter.js +21 -1
- package/modules/otmBidAdapter.js +146 -0
- package/modules/otmBidAdapter.md +27 -26
- package/modules/outbrainBidAdapter.js +5 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/pubmaticBidAdapter.js +1 -1
- package/modules/rtdModule/index.js +2 -2
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/trustxBidAdapter.js +8 -6
- package/modules/ventesBidAdapter.js +370 -0
- package/modules/ventesBidAdapter.md +94 -0
- package/modules/yahoosspBidAdapter.js +6 -6
- package/package.json +1 -1
- package/src/auction.js +11 -11
- package/src/prebid.js +20 -4
- package/src/targeting.js +8 -0
- package/test/fixtures/fixtures.js +2 -1
- package/test/spec/modules/adxcgBidAdapter_spec.js +827 -571
- package/test/spec/modules/appnexusBidAdapter_spec.js +16 -1
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
- package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +3 -3
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +23 -4
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/openxBidAdapter_spec.js +0 -26
- package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
- package/test/spec/modules/otmBidAdapter_spec.js +67 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
- package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +3 -3
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/unit/core/adapterManager_spec.js +7 -3
- package/test/spec/unit/core/targeting_spec.js +93 -0
- package/test/spec/unit/pbjs_api_spec.js +3 -1
|
@@ -456,7 +456,8 @@ describe('adapterManager tests', function () {
|
|
|
456
456
|
});
|
|
457
457
|
|
|
458
458
|
it('should call spec\'s onBidderError callback when callBidderError is called', function () {
|
|
459
|
-
const
|
|
459
|
+
const bidRequests = getBidRequests();
|
|
460
|
+
const bidderRequest = find(bidRequests, bidRequest => bidRequest.bidderCode === bidder);
|
|
460
461
|
const xhrErrorMock = {
|
|
461
462
|
status: 500,
|
|
462
463
|
statusText: 'Internal Server Error'
|
|
@@ -1696,14 +1697,17 @@ describe('adapterManager tests', function () {
|
|
|
1696
1697
|
});
|
|
1697
1698
|
|
|
1698
1699
|
describe('sizeMapping', function () {
|
|
1700
|
+
let sandbox;
|
|
1699
1701
|
beforeEach(function () {
|
|
1702
|
+
sandbox = sinon.sandbox.create();
|
|
1700
1703
|
allS2SBidders.length = 0;
|
|
1701
1704
|
clientTestAdapters.length = 0;
|
|
1702
|
-
|
|
1705
|
+
// always have matchMedia return true for us
|
|
1706
|
+
sandbox.stub(utils.getWindowTop(), 'matchMedia').callsFake(() => ({matches: true}));
|
|
1703
1707
|
});
|
|
1704
1708
|
|
|
1705
1709
|
afterEach(function () {
|
|
1706
|
-
|
|
1710
|
+
sandbox.restore();
|
|
1707
1711
|
config.resetConfig();
|
|
1708
1712
|
setSizeConfig([]);
|
|
1709
1713
|
});
|
|
@@ -227,6 +227,8 @@ describe('targeting tests', function () {
|
|
|
227
227
|
let sandbox;
|
|
228
228
|
let enableSendAllBids = false;
|
|
229
229
|
let useBidCache;
|
|
230
|
+
let bidCacheFilterFunction;
|
|
231
|
+
let undef;
|
|
230
232
|
|
|
231
233
|
beforeEach(function() {
|
|
232
234
|
sandbox = sinon.sandbox.create();
|
|
@@ -241,12 +243,16 @@ describe('targeting tests', function () {
|
|
|
241
243
|
if (key === 'useBidCache') {
|
|
242
244
|
return useBidCache;
|
|
243
245
|
}
|
|
246
|
+
if (key === 'bidCacheFilterFunction') {
|
|
247
|
+
return bidCacheFilterFunction;
|
|
248
|
+
}
|
|
244
249
|
return origGetConfig.apply(config, arguments);
|
|
245
250
|
});
|
|
246
251
|
});
|
|
247
252
|
|
|
248
253
|
afterEach(function () {
|
|
249
254
|
sandbox.restore();
|
|
255
|
+
bidCacheFilterFunction = undef;
|
|
250
256
|
});
|
|
251
257
|
|
|
252
258
|
describe('getAllTargeting', function () {
|
|
@@ -785,6 +791,93 @@ describe('targeting tests', function () {
|
|
|
785
791
|
expect(bids[0].adId).to.equal('adid-2');
|
|
786
792
|
});
|
|
787
793
|
|
|
794
|
+
it('should use bidCacheFilterFunction', function() {
|
|
795
|
+
auctionManagerStub.returns([
|
|
796
|
+
createBidReceived({bidder: 'appnexus', cpm: 7, auctionId: 1, responseTimestamp: 100, adUnitCode: 'code-0', adId: 'adid-1', mediaType: 'banner'}),
|
|
797
|
+
createBidReceived({bidder: 'appnexus', cpm: 5, auctionId: 2, responseTimestamp: 102, adUnitCode: 'code-0', adId: 'adid-2', mediaType: 'banner'}),
|
|
798
|
+
createBidReceived({bidder: 'appnexus', cpm: 6, auctionId: 1, responseTimestamp: 101, adUnitCode: 'code-1', adId: 'adid-3', mediaType: 'banner'}),
|
|
799
|
+
createBidReceived({bidder: 'appnexus', cpm: 8, auctionId: 2, responseTimestamp: 103, adUnitCode: 'code-1', adId: 'adid-4', mediaType: 'banner'}),
|
|
800
|
+
createBidReceived({bidder: 'appnexus', cpm: 27, auctionId: 1, responseTimestamp: 100, adUnitCode: 'code-2', adId: 'adid-5', mediaType: 'video'}),
|
|
801
|
+
createBidReceived({bidder: 'appnexus', cpm: 25, auctionId: 2, responseTimestamp: 102, adUnitCode: 'code-2', adId: 'adid-6', mediaType: 'video'}),
|
|
802
|
+
createBidReceived({bidder: 'appnexus', cpm: 26, auctionId: 1, responseTimestamp: 101, adUnitCode: 'code-3', adId: 'adid-7', mediaType: 'video'}),
|
|
803
|
+
createBidReceived({bidder: 'appnexus', cpm: 28, auctionId: 2, responseTimestamp: 103, adUnitCode: 'code-3', adId: 'adid-8', mediaType: 'video'}),
|
|
804
|
+
]);
|
|
805
|
+
|
|
806
|
+
let adUnitCodes = ['code-0', 'code-1', 'code-2', 'code-3'];
|
|
807
|
+
targetingInstance.setLatestAuctionForAdUnit('code-0', 2);
|
|
808
|
+
targetingInstance.setLatestAuctionForAdUnit('code-1', 2);
|
|
809
|
+
targetingInstance.setLatestAuctionForAdUnit('code-2', 2);
|
|
810
|
+
targetingInstance.setLatestAuctionForAdUnit('code-3', 2);
|
|
811
|
+
|
|
812
|
+
// Bid Caching On, No Filter Function
|
|
813
|
+
useBidCache = true;
|
|
814
|
+
bidCacheFilterFunction = undef;
|
|
815
|
+
let bids = targetingInstance.getWinningBids(adUnitCodes);
|
|
816
|
+
|
|
817
|
+
expect(bids.length).to.equal(4);
|
|
818
|
+
expect(bids[0].adId).to.equal('adid-1');
|
|
819
|
+
expect(bids[1].adId).to.equal('adid-4');
|
|
820
|
+
expect(bids[2].adId).to.equal('adid-5');
|
|
821
|
+
expect(bids[3].adId).to.equal('adid-8');
|
|
822
|
+
|
|
823
|
+
// Bid Caching Off, No Filter Function
|
|
824
|
+
useBidCache = false;
|
|
825
|
+
bidCacheFilterFunction = undef;
|
|
826
|
+
bids = targetingInstance.getWinningBids(adUnitCodes);
|
|
827
|
+
|
|
828
|
+
expect(bids.length).to.equal(4);
|
|
829
|
+
expect(bids[0].adId).to.equal('adid-2');
|
|
830
|
+
expect(bids[1].adId).to.equal('adid-4');
|
|
831
|
+
expect(bids[2].adId).to.equal('adid-6');
|
|
832
|
+
expect(bids[3].adId).to.equal('adid-8');
|
|
833
|
+
|
|
834
|
+
// Bid Caching On AGAIN, No Filter Function (should be same as first time)
|
|
835
|
+
useBidCache = true;
|
|
836
|
+
bidCacheFilterFunction = undef;
|
|
837
|
+
bids = targetingInstance.getWinningBids(adUnitCodes);
|
|
838
|
+
|
|
839
|
+
expect(bids.length).to.equal(4);
|
|
840
|
+
expect(bids[0].adId).to.equal('adid-1');
|
|
841
|
+
expect(bids[1].adId).to.equal('adid-4');
|
|
842
|
+
expect(bids[2].adId).to.equal('adid-5');
|
|
843
|
+
expect(bids[3].adId).to.equal('adid-8');
|
|
844
|
+
|
|
845
|
+
// Bid Caching On, with Filter Function to Exclude video
|
|
846
|
+
useBidCache = true;
|
|
847
|
+
let bcffCalled = 0;
|
|
848
|
+
bidCacheFilterFunction = bid => {
|
|
849
|
+
bcffCalled++;
|
|
850
|
+
return bid.mediaType !== 'video';
|
|
851
|
+
}
|
|
852
|
+
bids = targetingInstance.getWinningBids(adUnitCodes);
|
|
853
|
+
|
|
854
|
+
expect(bids.length).to.equal(4);
|
|
855
|
+
expect(bids[0].adId).to.equal('adid-1');
|
|
856
|
+
expect(bids[1].adId).to.equal('adid-4');
|
|
857
|
+
expect(bids[2].adId).to.equal('adid-6');
|
|
858
|
+
expect(bids[3].adId).to.equal('adid-8');
|
|
859
|
+
// filter function should have been called for each cached bid (4 times)
|
|
860
|
+
expect(bcffCalled).to.equal(4);
|
|
861
|
+
|
|
862
|
+
// Bid Caching Off, with Filter Function to Exclude video
|
|
863
|
+
// - should not use cached bids or call the filter function
|
|
864
|
+
useBidCache = false;
|
|
865
|
+
bcffCalled = 0;
|
|
866
|
+
bidCacheFilterFunction = bid => {
|
|
867
|
+
bcffCalled++;
|
|
868
|
+
return bid.mediaType !== 'video';
|
|
869
|
+
}
|
|
870
|
+
bids = targetingInstance.getWinningBids(adUnitCodes);
|
|
871
|
+
|
|
872
|
+
expect(bids.length).to.equal(4);
|
|
873
|
+
expect(bids[0].adId).to.equal('adid-2');
|
|
874
|
+
expect(bids[1].adId).to.equal('adid-4');
|
|
875
|
+
expect(bids[2].adId).to.equal('adid-6');
|
|
876
|
+
expect(bids[3].adId).to.equal('adid-8');
|
|
877
|
+
// filter function should not have been called
|
|
878
|
+
expect(bcffCalled).to.equal(0);
|
|
879
|
+
});
|
|
880
|
+
|
|
788
881
|
it('should not use rendered bid to get winning bid', function () {
|
|
789
882
|
let bidsReceived = [
|
|
790
883
|
createBidReceived({bidder: 'appnexus', cpm: 8, auctionId: 1, responseTimestamp: 100, adUnitCode: 'code-0', adId: 'adid-1', status: 'rendered'}),
|
|
@@ -1135,13 +1135,15 @@ describe('Unit: Prebid Module', function () {
|
|
|
1135
1135
|
height: 0
|
|
1136
1136
|
}
|
|
1137
1137
|
},
|
|
1138
|
-
getElementsByTagName: sinon.stub()
|
|
1138
|
+
getElementsByTagName: sinon.stub(),
|
|
1139
|
+
querySelector: sinon.stub()
|
|
1139
1140
|
};
|
|
1140
1141
|
|
|
1141
1142
|
elStub = {
|
|
1142
1143
|
insertBefore: sinon.stub()
|
|
1143
1144
|
};
|
|
1144
1145
|
doc.getElementsByTagName.returns([elStub]);
|
|
1146
|
+
doc.querySelector.returns(elStub);
|
|
1145
1147
|
|
|
1146
1148
|
spyLogError = sinon.spy(utils, 'logError');
|
|
1147
1149
|
spyLogMessage = sinon.spy(utils, 'logMessage');
|