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.
Files changed (67) hide show
  1. package/.circleci/config.yml +4 -5
  2. package/modules/adxcgBidAdapter.js +311 -359
  3. package/modules/airgridRtdProvider.js +1 -1
  4. package/modules/appnexusBidAdapter.js +9 -3
  5. package/modules/atsAnalyticsAdapter.js +67 -46
  6. package/modules/atsAnalyticsAdapter.md +1 -0
  7. package/modules/betweenBidAdapter.js +2 -1
  8. package/modules/browsiRtdProvider.js +106 -18
  9. package/modules/cleanioRtdProvider.js +192 -0
  10. package/modules/cleanioRtdProvider.md +59 -0
  11. package/modules/deltaprojectsBidAdapter.js +252 -0
  12. package/modules/deltaprojectsBidAdapter.md +32 -0
  13. package/modules/gridBidAdapter.js +1 -0
  14. package/modules/ipromBidAdapter.js +79 -0
  15. package/modules/ixBidAdapter.js +7 -1
  16. package/modules/jixieBidAdapter.js +8 -2
  17. package/modules/justpremiumBidAdapter.js +6 -1
  18. package/modules/kinessoIdSystem.js +1 -1
  19. package/modules/livewrappedAnalyticsAdapter.js +5 -0
  20. package/modules/multibid/index.js +3 -3
  21. package/modules/nativoBidAdapter.js +5 -1
  22. package/modules/openxBidAdapter.js +1 -1
  23. package/modules/operaadsBidAdapter.js +21 -1
  24. package/modules/otmBidAdapter.js +146 -0
  25. package/modules/otmBidAdapter.md +27 -26
  26. package/modules/outbrainBidAdapter.js +5 -0
  27. package/modules/playwireBidAdapter.md +61 -0
  28. package/modules/pubmaticBidAdapter.js +1 -1
  29. package/modules/rtdModule/index.js +2 -2
  30. package/modules/sonobiBidAdapter.js +7 -0
  31. package/modules/sortableBidAdapter.js +1 -0
  32. package/modules/teadsBidAdapter.js +3 -0
  33. package/modules/trustxBidAdapter.js +8 -6
  34. package/modules/ventesBidAdapter.js +370 -0
  35. package/modules/ventesBidAdapter.md +94 -0
  36. package/modules/yahoosspBidAdapter.js +6 -6
  37. package/package.json +1 -1
  38. package/src/auction.js +11 -11
  39. package/src/prebid.js +20 -4
  40. package/src/targeting.js +8 -0
  41. package/test/fixtures/fixtures.js +2 -1
  42. package/test/spec/modules/adxcgBidAdapter_spec.js +827 -571
  43. package/test/spec/modules/appnexusBidAdapter_spec.js +16 -1
  44. package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
  45. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  46. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  47. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  48. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  49. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  50. package/test/spec/modules/ixBidAdapter_spec.js +3 -3
  51. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  52. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  53. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +23 -4
  54. package/test/spec/modules/multibid_spec.js +31 -31
  55. package/test/spec/modules/openxBidAdapter_spec.js +0 -26
  56. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  57. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  58. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  59. package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
  60. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  61. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  62. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  63. package/test/spec/modules/trustxBidAdapter_spec.js +3 -3
  64. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  65. package/test/spec/unit/core/adapterManager_spec.js +7 -3
  66. package/test/spec/unit/core/targeting_spec.js +93 -0
  67. package/test/spec/unit/pbjs_api_spec.js +3 -1
@@ -0,0 +1,67 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/otmBidAdapter';
3
+
4
+ describe('otmBidAdapter', function () {
5
+ it('validate_pub_params', function () {
6
+ expect(spec.isBidRequestValid({
7
+ bidder: 'otm',
8
+ params: {
9
+ tid: '123',
10
+ bidfloor: 20
11
+ }
12
+ })).to.equal(true);
13
+ });
14
+
15
+ it('validate_generated_params', function () {
16
+ let bidRequestData = [{
17
+ bidId: 'bid1234',
18
+ bidder: 'otm',
19
+ params: {
20
+ tid: '123',
21
+ bidfloor: 20
22
+ },
23
+ sizes: [[240, 400]]
24
+ }];
25
+
26
+ let request = spec.buildRequests(bidRequestData);
27
+ let req_data = request[0].data;
28
+
29
+ expect(req_data.bidid).to.equal('bid1234');
30
+ });
31
+
32
+ it('validate_response_params', function () {
33
+ let bidRequestData = {
34
+ data: {
35
+ bidId: 'bid1234'
36
+ }
37
+ };
38
+
39
+ let serverResponse = {
40
+ body: [
41
+ {
42
+ 'auctionid': '3c6f8e22-541b-485c-9214-e974d9fb1b6f',
43
+ 'cpm': 847.097,
44
+ 'ad': '<html><body>test html</body></html>',
45
+ 'w': 240,
46
+ 'h': 400,
47
+ 'currency': 'RUB',
48
+ 'ttl': 300,
49
+ 'creativeid': '1_7869053',
50
+ 'bidid': '101f211def7c99',
51
+ 'transactionid': 'transaction_id_1'
52
+ }
53
+ ]
54
+ };
55
+
56
+ let bids = spec.interpretResponse(serverResponse, bidRequestData);
57
+ expect(bids).to.have.lengthOf(1);
58
+ let bid = bids[0];
59
+ expect(bid.cpm).to.equal(847.097);
60
+ expect(bid.currency).to.equal('RUB');
61
+ expect(bid.width).to.equal(240);
62
+ expect(bid.height).to.equal(400);
63
+ expect(bid.netRevenue).to.equal(true);
64
+ expect(bid.requestId).to.equal('101f211def7c99');
65
+ expect(bid.ad).to.equal('<html><body>test html</body></html>');
66
+ });
67
+ });
@@ -2,6 +2,7 @@ import {expect} from 'chai';
2
2
  import {spec} from 'modules/outbrainBidAdapter.js';
3
3
  import {config} from 'src/config.js';
4
4
  import {server} from 'test/mocks/xhr';
5
+ import { createEidsArray } from 'modules/userId/eids.js';
5
6
 
6
7
  describe('Outbrain Adapter', function () {
7
8
  describe('Bid request and response', function () {
@@ -344,6 +345,23 @@ describe('Outbrain Adapter', function () {
344
345
 
345
346
  config.resetConfig()
346
347
  });
348
+
349
+ it('should pass extended ids', function () {
350
+ let bidRequest = {
351
+ bidId: 'bidId',
352
+ params: {},
353
+ userIdAsEids: createEidsArray({
354
+ idl_env: 'id-value',
355
+ }),
356
+ ...commonBidRequest,
357
+ };
358
+
359
+ let res = spec.buildRequests([bidRequest], commonBidderRequest);
360
+ const resData = JSON.parse(res.data)
361
+ expect(resData.user.ext.eids).to.deep.equal([
362
+ {source: 'liveramp.com', uids: [{id: 'id-value', atype: 3}]}
363
+ ]);
364
+ });
347
365
  })
348
366
 
349
367
  describe('interpretResponse', function () {
@@ -3861,4 +3861,44 @@ describe('PubMatic adapter', function () {
3861
3861
  })
3862
3862
  });
3863
3863
  });
3864
+
3865
+ describe('Video request params', function() {
3866
+ let sandbox, utilsMock, newVideoRequest;
3867
+ beforeEach(() => {
3868
+ utilsMock = sinon.mock(utils);
3869
+ sandbox = sinon.sandbox.create();
3870
+ sandbox.spy(utils, 'logWarn');
3871
+ newVideoRequest = utils.deepClone(videoBidRequests)
3872
+ });
3873
+
3874
+ afterEach(() => {
3875
+ utilsMock.restore();
3876
+ sandbox.restore();
3877
+ })
3878
+
3879
+ it('Should log warning if video params from mediaTypes and params obj of bid are not present', function () {
3880
+ delete newVideoRequest[0].mediaTypes.video;
3881
+ delete newVideoRequest[0].params.video;
3882
+
3883
+ let request = spec.buildRequests(newVideoRequest, {
3884
+ auctionId: 'new-auction-id'
3885
+ });
3886
+
3887
+ sinon.assert.calledOnce(utils.logWarn);
3888
+ expect(request).to.equal(undefined);
3889
+ });
3890
+
3891
+ it('Should consider video params from mediaType object of bid', function () {
3892
+ delete newVideoRequest[0].params.video;
3893
+
3894
+ let request = spec.buildRequests(newVideoRequest, {
3895
+ auctionId: 'new-auction-id'
3896
+ });
3897
+ let data = JSON.parse(request.data);
3898
+ expect(data.imp[0].video).to.exist;
3899
+ expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]);
3900
+ expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]);
3901
+ expect(data.imp[0]['video']['battr']).to.equal(undefined);
3902
+ });
3903
+ });
3864
3904
  });
@@ -238,14 +238,17 @@ describe('SonobiBidAdapter', function () {
238
238
  });
239
239
 
240
240
  describe('.buildRequests', function () {
241
+ let sandbox;
241
242
  beforeEach(function() {
242
243
  sinon.stub(userSync, 'canBidderRegisterSync');
243
244
  sinon.stub(utils, 'getGptSlotInfoForAdUnitCode')
244
- .onFirstCall().returns({gptSlot: '/123123/gpt_publisher/adunit-code-3', divId: 'adunit-code-3-div-id'})
245
+ .onFirstCall().returns({gptSlot: '/123123/gpt_publisher/adunit-code-3', divId: 'adunit-code-3-div-id'});
246
+ sandbox = sinon.createSandbox();
245
247
  });
246
248
  afterEach(function() {
247
249
  userSync.canBidderRegisterSync.restore();
248
250
  utils.getGptSlotInfoForAdUnitCode.restore();
251
+ sandbox.restore();
249
252
  });
250
253
  let bidRequest = [{
251
254
  'schain': {
@@ -333,6 +336,36 @@ describe('SonobiBidAdapter', function () {
333
336
  uspConsent: 'someCCPAString'
334
337
  };
335
338
 
339
+ it('should set fpd if there is any data in ortb2', function() {
340
+ const ortb2 = {
341
+ site: {
342
+ ext: {
343
+ data: {
344
+ pageType: 'article',
345
+ category: 'tools'
346
+ }
347
+ }
348
+ },
349
+ user: {
350
+ ext: {
351
+ data: {
352
+ registered: true,
353
+ interests: ['cars']
354
+ }
355
+ }
356
+ }
357
+ };
358
+
359
+ sandbox.stub(config, 'getConfig').callsFake(key => {
360
+ const config = {
361
+ ortb2: ortb2
362
+ };
363
+ return utils.deepAccess(config, key);
364
+ });
365
+ const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
366
+ expect(bidRequests.data.fpd).to.equal(JSON.stringify(ortb2));
367
+ });
368
+
336
369
  it('should populate coppa as 1 if set in config', function () {
337
370
  config.setConfig({coppa: true});
338
371
  const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
@@ -112,6 +112,13 @@ describe('sortableBidAdapter', function() {
112
112
  'key2': 'val2'
113
113
  }
114
114
  },
115
+ 'ortb2Imp': {
116
+ 'ext': {
117
+ 'data': {
118
+ 'pbadslot': 'abc/123'
119
+ }
120
+ }
121
+ },
115
122
  'sizes': [
116
123
  [300, 250]
117
124
  ],
@@ -176,6 +183,10 @@ describe('sortableBidAdapter', function() {
176
183
  expect(requestBody.imp[0].floor).to.equal(0.21);
177
184
  });
178
185
 
186
+ it('includes pbadslot in the bid request', function () {
187
+ expect(requestBody.imp[0].ext.gpid).to.equal('abc/123');
188
+ });
189
+
179
190
  it('sets domain and href correctly', function () {
180
191
  expect(requestBody.site.domain).to.equal('example.com');
181
192
  expect(requestBody.site.page).to.equal('http://example.com/page?param=val');
@@ -582,6 +582,138 @@ describe('teadsBidAdapter', () => {
582
582
  });
583
583
  });
584
584
 
585
+ describe('Global Placement Id', function () {
586
+ let bidRequests = [
587
+ {
588
+ 'bidder': 'teads',
589
+ 'params': {
590
+ 'placementId': 10433394,
591
+ 'pageId': 1234
592
+ },
593
+ 'adUnitCode': 'adunit-code-1',
594
+ 'sizes': [[300, 250], [300, 600]],
595
+ 'bidId': '30b31c1838de1e',
596
+ 'bidderRequestId': '22edbae2733bf6',
597
+ 'auctionId': '1d1a030790a475',
598
+ 'creativeId': 'er2ee',
599
+ 'deviceWidth': 1680
600
+ },
601
+ {
602
+ 'bidder': 'teads',
603
+ 'params': {
604
+ 'placementId': 10433395,
605
+ 'pageId': 1234
606
+ },
607
+ 'adUnitCode': 'adunit-code-2',
608
+ 'sizes': [[300, 250], [300, 600]],
609
+ 'bidId': '30b31c1838de1f',
610
+ 'bidderRequestId': '22edbae2733bf6',
611
+ 'auctionId': '1d1a030790a475',
612
+ 'creativeId': 'er2ef',
613
+ 'deviceWidth': 1680
614
+ }
615
+ ];
616
+
617
+ it('should add gpid if ortb2Imp.ext.data.pbadslot is present and is non empty (and ortb2Imp.ext.data.adserver.adslot is not present)', function () {
618
+ const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
619
+ return {
620
+ ...bidRequest,
621
+ ortb2Imp: {
622
+ ext: {
623
+ data: {
624
+ pbadslot: '1111/home-left-' + index
625
+ }
626
+ }
627
+ }
628
+ };
629
+ }
630
+ );
631
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
632
+ const payload = JSON.parse(request.data);
633
+
634
+ expect(payload.data[0].gpid).to.equal('1111/home-left-0');
635
+ expect(payload.data[1].gpid).to.equal('1111/home-left-1');
636
+ });
637
+
638
+ it('should add gpid if ortb2Imp.ext.data.pbadslot is present and is non empty (even if ortb2Imp.ext.data.adserver.adslot is present and is non empty too)', function () {
639
+ const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
640
+ return {
641
+ ...bidRequest,
642
+ ortb2Imp: {
643
+ ext: {
644
+ data: {
645
+ pbadslot: '1111/home-left-' + index,
646
+ adserver: {
647
+ adslot: '1111/home-left/div-' + index
648
+ }
649
+ }
650
+ }
651
+ }
652
+ };
653
+ }
654
+ );
655
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
656
+ const payload = JSON.parse(request.data);
657
+
658
+ expect(payload.data[0].gpid).to.equal('1111/home-left-0');
659
+ expect(payload.data[1].gpid).to.equal('1111/home-left-1');
660
+ });
661
+
662
+ it('should not add gpid if both ortb2Imp.ext.data.pbadslot and ortb2Imp.ext.data.adserver.adslot are present but empty', function () {
663
+ const updatedBidRequests = bidRequests.map(bidRequest => ({
664
+ ...bidRequest,
665
+ ortb2Imp: {
666
+ ext: {
667
+ data: {
668
+ pbadslot: '',
669
+ adserver: {
670
+ adslot: ''
671
+ }
672
+ }
673
+ }
674
+ }
675
+ }));
676
+
677
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
678
+ const payload = JSON.parse(request.data);
679
+
680
+ return payload.data.forEach(bid => {
681
+ expect(bid).not.to.have.property('gpid');
682
+ });
683
+ });
684
+
685
+ it('should not add gpid if both ortb2Imp.ext.data.pbadslot and ortb2Imp.ext.data.adserver.adslot are not present', function () {
686
+ const request = spec.buildRequests(bidRequests, bidderResquestDefault);
687
+ const payload = JSON.parse(request.data);
688
+
689
+ return payload.data.forEach(bid => {
690
+ expect(bid).not.to.have.property('gpid');
691
+ });
692
+ });
693
+
694
+ it('should add gpid if ortb2Imp.ext.data.pbadslot is not present but ortb2Imp.ext.data.adserver.adslot is present and is non empty', function () {
695
+ const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
696
+ return {
697
+ ...bidRequest,
698
+ ortb2Imp: {
699
+ ext: {
700
+ data: {
701
+ adserver: {
702
+ adslot: '1111/home-left-' + index
703
+ }
704
+ }
705
+ }
706
+ }
707
+ };
708
+ });
709
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
710
+ const payload = JSON.parse(request.data);
711
+
712
+ expect(payload.data[0].gpid).to.equal('1111/home-left-0');
713
+ expect(payload.data[1].gpid).to.equal('1111/home-left-1');
714
+ });
715
+ });
716
+
585
717
  function checkMediaTypesSizes(mediaTypes, expectedSizes) {
586
718
  const bidRequestWithBannerSizes = Object.assign(bidRequests[0], mediaTypes);
587
719
  const requestWithBannerSizes = spec.buildRequests([bidRequestWithBannerSizes], bidderResquestDefault);
@@ -402,7 +402,7 @@ describe('TrustXAdapter', function () {
402
402
  });
403
403
 
404
404
  it('if segment is present in permutive targeting, payload must have right params', function () {
405
- const permSegments = ['test_perm_1', 'test_perm_2'];
405
+ const permSegments = [{id: 'test_perm_1'}, {id: 'test_perm_2'}];
406
406
  const bidRequestsWithPermutiveTargeting = bidRequests.map((bid) => {
407
407
  return Object.assign({
408
408
  rtd: {
@@ -421,8 +421,8 @@ describe('TrustXAdapter', function () {
421
421
  expect(payload.user.data).to.deep.equal([{
422
422
  name: 'permutive',
423
423
  segment: [
424
- {name: 'p_standard', value: permSegments[0]},
425
- {name: 'p_standard', value: permSegments[1]}
424
+ {name: 'p_standard', value: permSegments[0].id},
425
+ {name: 'p_standard', value: permSegments[1].id}
426
426
  ]
427
427
  }]);
428
428
  });