prebid.js 6.2.0 → 6.6.0

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 (169) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/gulpfile.js +87 -82
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  4. package/karma.conf.maker.js +1 -1
  5. package/modules/.submodules.json +2 -1
  6. package/modules/33acrossBidAdapter.js +189 -102
  7. package/modules/adagioBidAdapter.js +1 -1
  8. package/modules/addefendBidAdapter.js +1 -0
  9. package/modules/adkernelBidAdapter.js +148 -62
  10. package/modules/adlooxAdServerVideo.js +2 -2
  11. package/modules/adlooxAnalyticsAdapter.js +4 -4
  12. package/modules/admanBidAdapter.js +11 -4
  13. package/modules/admixerBidAdapter.js +1 -1
  14. package/modules/adnuntiusBidAdapter.js +3 -1
  15. package/modules/adomikAnalyticsAdapter.js +27 -9
  16. package/modules/adqueryIdSystem.js +103 -0
  17. package/modules/adqueryIdSystem.md +35 -0
  18. package/modules/adxcgBidAdapter.js +311 -359
  19. package/modules/adxcgBidAdapter.md +22 -21
  20. package/modules/adyoulikeBidAdapter.js +13 -9
  21. package/modules/aniviewBidAdapter.js +1 -1
  22. package/modules/appnexusBidAdapter.js +0 -1
  23. package/modules/beopBidAdapter.js +6 -4
  24. package/modules/bidViewability.js +3 -3
  25. package/modules/bidViewabilityIO.js +3 -3
  26. package/modules/bliinkBidAdapter.js +3 -2
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/compassBidAdapter.js +208 -0
  29. package/modules/compassBidAdapter.md +79 -0
  30. package/modules/consentManagement.js +7 -1
  31. package/modules/criteoBidAdapter.js +1 -1
  32. package/modules/criteoIdSystem.js +29 -7
  33. package/modules/currency.js +2 -2
  34. package/modules/cwireBidAdapter.js +3 -0
  35. package/modules/dailyhuntBidAdapter.js +435 -0
  36. package/modules/dailyhuntBidAdapter.md +4 -0
  37. package/modules/docereeBidAdapter.js +10 -1
  38. package/modules/docereeBidAdapter.md +2 -0
  39. package/modules/dspxBidAdapter.js +1 -1
  40. package/modules/engageyaBidAdapter.js +1 -1
  41. package/modules/feedadBidAdapter.js +2 -2
  42. package/modules/feedadBidAdapter.md +4 -2
  43. package/modules/futureads.md +48 -0
  44. package/modules/glimpseBidAdapter.js +82 -47
  45. package/modules/gptPreAuction.js +55 -7
  46. package/modules/gridBidAdapter.js +4 -3
  47. package/modules/gumgumBidAdapter.js +2 -2
  48. package/modules/idImportLibrary.js +45 -8
  49. package/modules/idImportLibrary.md +4 -0
  50. package/modules/improvedigitalBidAdapter.js +42 -4
  51. package/modules/instreamTracking.js +4 -4
  52. package/modules/invibesBidAdapter.js +49 -5
  53. package/modules/invibesBidAdapter.md +2 -1
  54. package/modules/ixBidAdapter.js +53 -18
  55. package/modules/kinessoIdSystem.js +1 -1
  56. package/modules/limelightDigitalBidAdapter.js +2 -1
  57. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  58. package/modules/livewrappedBidAdapter.js +8 -2
  59. package/modules/loglyliftBidAdapter.js +79 -0
  60. package/modules/loglyliftBidAdapter.md +55 -0
  61. package/modules/lotamePanoramaIdSystem.js +80 -8
  62. package/modules/mediasquareBidAdapter.js +1 -9
  63. package/modules/nextMillenniumBidAdapter.js +39 -7
  64. package/modules/oguryBidAdapter.js +9 -2
  65. package/modules/onetagBidAdapter.js +4 -2
  66. package/modules/optimeraRtdProvider.js +8 -1
  67. package/modules/ozoneBidAdapter.js +21 -64
  68. package/modules/prebidServerBidAdapter/index.js +16 -12
  69. package/modules/proxistoreBidAdapter.js +0 -2
  70. package/modules/pubgeniusBidAdapter.js +1 -1
  71. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  72. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  73. package/modules/richaudienceBidAdapter.js +4 -4
  74. package/modules/riseBidAdapter.js +1 -1
  75. package/modules/rtbhouseBidAdapter.js +14 -4
  76. package/modules/rtdModule/index.js +49 -18
  77. package/modules/rubiconBidAdapter.js +31 -19
  78. package/modules/sharedIdSystem.js +27 -1
  79. package/modules/showheroes-bsBidAdapter.js +13 -2
  80. package/modules/tappxBidAdapter.js +8 -5
  81. package/modules/targetVideoBidAdapter.js +187 -0
  82. package/modules/targetVideoBidAdapter.md +34 -0
  83. package/modules/teadsBidAdapter.js +1 -2
  84. package/modules/telariaBidAdapter.js +2 -2
  85. package/modules/trustxBidAdapter.js +8 -16
  86. package/modules/userId/eids.js +7 -1
  87. package/modules/userId/userId.md +8 -0
  88. package/modules/vidoomyBidAdapter.js +16 -10
  89. package/modules/weboramaRtdProvider.js +288 -73
  90. package/modules/weboramaRtdProvider.md +27 -10
  91. package/modules/welectBidAdapter.js +106 -0
  92. package/modules/yahoosspBidAdapter.js +5 -1
  93. package/modules/yieldmoBidAdapter.js +23 -5
  94. package/modules/zetaSspBidAdapter.md +33 -1
  95. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  96. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  97. package/modules/zeta_global_sspBidAdapter.js +22 -1
  98. package/package.json +1 -1
  99. package/plugins/pbjsGlobals.js +28 -1
  100. package/src/auction.js +2 -2
  101. package/src/config.js +27 -3
  102. package/src/hook.js +5 -1
  103. package/src/prebid.js +21 -6
  104. package/src/targeting.js +22 -1
  105. package/src/utils.js +46 -8
  106. package/test/helpers/prebidGlobal.js +1 -0
  107. package/test/spec/config_spec.js +279 -0
  108. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  109. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  110. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  111. package/test/spec/modules/adnuntiusBidAdapter_spec.js +17 -0
  112. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  113. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  114. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  115. package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
  116. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  117. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  118. package/test/spec/modules/bidViewability_spec.js +4 -4
  119. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  120. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  121. package/test/spec/modules/compassBidAdapter_spec.js +398 -0
  122. package/test/spec/modules/consentManagement_spec.js +20 -0
  123. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  124. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  125. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  126. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  127. package/test/spec/modules/eids_spec.js +15 -0
  128. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  129. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  130. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  131. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  132. package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
  133. package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
  134. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  135. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
  136. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  137. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  138. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  139. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  140. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  141. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  142. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  143. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  144. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  145. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  146. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  147. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  148. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  149. package/test/spec/modules/realTimeDataModule_spec.js +147 -48
  150. package/test/spec/modules/richaudienceBidAdapter_spec.js +42 -2
  151. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  152. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  153. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  154. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  155. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  156. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  157. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  158. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  159. package/test/spec/modules/userId_spec.js +68 -19
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  162. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  163. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/targeting_spec.js +72 -0
  166. package/test/spec/unit/pbjs_api_spec.js +3 -1
  167. package/test/spec/utils_spec.js +38 -0
  168. package/test/test_deps.js +3 -0
  169. package/test/test_index.js +1 -3
@@ -791,6 +791,46 @@ describe('Richaudience adapter tests', function () {
791
791
  })).to.equal(true);
792
792
  });
793
793
 
794
+ it('should pass schain', function() {
795
+ let schain = {
796
+ 'ver': '1.0',
797
+ 'complete': 1,
798
+ 'nodes': [{
799
+ 'asi': 'richaudience.com',
800
+ 'sid': '00001',
801
+ 'hp': 1
802
+ }, {
803
+ 'asi': 'richaudience-2.com',
804
+ 'sid': '00002',
805
+ 'hp': 1
806
+ }]
807
+ }
808
+
809
+ DEFAULT_PARAMS_NEW_SIZES[0].schain = {
810
+ 'ver': '1.0',
811
+ 'complete': 1,
812
+ 'nodes': [{
813
+ 'asi': 'richaudience.com',
814
+ 'sid': '00001',
815
+ 'hp': 1
816
+ }, {
817
+ 'asi': 'richaudience-2.com',
818
+ 'sid': '00002',
819
+ 'hp': 1
820
+ }]
821
+ }
822
+
823
+ const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
824
+ gdprConsent: {
825
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
826
+ gdprApplies: true
827
+ },
828
+ refererInfo: {}
829
+ })
830
+ const requestContent = JSON.parse(request[0].data);
831
+ expect(requestContent).to.have.property('schain').to.deep.equal(schain);
832
+ })
833
+
794
834
  describe('userSync', function () {
795
835
  it('Verifies user syncs iframe include', function () {
796
836
  config.setConfig({
@@ -905,7 +945,7 @@ describe('Richaudience adapter tests', function () {
905
945
  }, [], {
906
946
  consentString: null,
907
947
  referer: 'http://domain.com',
908
- gdprApplies: true
948
+ gdprApplies: false
909
949
  })
910
950
  expect(syncs).to.have.lengthOf(1);
911
951
  expect(syncs[0].type).to.equal('image');
@@ -942,7 +982,7 @@ describe('Richaudience adapter tests', function () {
942
982
  }, [], {
943
983
  consentString: null,
944
984
  referer: 'http://domain.com',
945
- gdprApplies: true
985
+ gdprApplies: false
946
986
  })
947
987
  expect(syncs).to.have.lengthOf(0);
948
988
  });
@@ -257,7 +257,7 @@ describe('riseAdapter', function () {
257
257
  const requests = spec.buildRequests(bidRequests, bidderRequest);
258
258
  for (const request of requests) {
259
259
  expect(request.data).to.be.an('object');
260
- expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001,,,,');
260
+ expect(request.data).to.have.property('schain', '1.0,1!indirectseller.com,00001,1,,,');
261
261
  }
262
262
  });
263
263
 
@@ -68,6 +68,7 @@ describe('RTBHouseAdapter', () => {
68
68
  'params': {
69
69
  'publisherId': 'PREBID_TEST',
70
70
  'region': 'prebid-eu',
71
+ 'channel': 'Partner_Site - news',
71
72
  'test': 1
72
73
  },
73
74
  'adUnitCode': 'adunit-code',
@@ -101,6 +102,25 @@ describe('RTBHouseAdapter', () => {
101
102
  expect(JSON.parse(builtTestRequest).test).to.equal(1);
102
103
  });
103
104
 
105
+ it('should build channel param into request.site', () => {
106
+ let builtTestRequest = spec.buildRequests(bidRequests, bidderRequest).data;
107
+ expect(JSON.parse(builtTestRequest).site.channel).to.equal('Partner_Site - news');
108
+ })
109
+
110
+ it('should not build channel param into request.site if no value is passed', () => {
111
+ let bidRequest = Object.assign([], bidRequests);
112
+ bidRequest[0].params.channel = undefined;
113
+ let builtTestRequest = spec.buildRequests(bidRequest, bidderRequest).data;
114
+ expect(JSON.parse(builtTestRequest).site.channel).to.be.undefined
115
+ })
116
+
117
+ it('should cap the request.site.channel length to 50', () => {
118
+ let bidRequest = Object.assign([], bidRequests);
119
+ bidRequest[0].params.channel = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent scelerisque ipsum eu purus lobortis iaculis.';
120
+ let builtTestRequest = spec.buildRequests(bidRequest, bidderRequest).data;
121
+ expect(JSON.parse(builtTestRequest).site.channel.length).to.equal(50)
122
+ })
123
+
104
124
  it('should build valid OpenRTB banner object', () => {
105
125
  const request = JSON.parse(spec.buildRequests(bidRequests, bidderRequest).data);
106
126
  const imp = request.imp[0];
@@ -1408,7 +1408,7 @@ describe('the rubicon adapter', function () {
1408
1408
  expect(data['tg_i.pbadslot']).to.equal('abc');
1409
1409
  });
1410
1410
 
1411
- it('should send \"tg_i.pbadslot\" if \"ortb2Imp.ext.data.pbadslot\" value is a valid string, but all leading slash characters should be removed', function () {
1411
+ it('should send \"tg_i.pbadslot\" if \"ortb2Imp.ext.data.pbadslot\" value is a valid string', function () {
1412
1412
  bidderRequest.bids[0].ortb2Imp = {
1413
1413
  ext: {
1414
1414
  data: {
@@ -1422,7 +1422,45 @@ describe('the rubicon adapter', function () {
1422
1422
 
1423
1423
  expect(data).to.be.an('Object');
1424
1424
  expect(data).to.have.property('tg_i.pbadslot');
1425
- expect(data['tg_i.pbadslot']).to.equal('a/b/c');
1425
+ expect(data['tg_i.pbadslot']).to.equal('/a/b/c');
1426
+ });
1427
+
1428
+ it('should send gpid as p_gpid if valid', function () {
1429
+ bidderRequest.bids[0].ortb2Imp = {
1430
+ ext: {
1431
+ gpid: '/1233/sports&div1'
1432
+ }
1433
+ }
1434
+
1435
+ const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
1436
+ const data = parseQuery(request.data);
1437
+
1438
+ expect(data).to.be.an('Object');
1439
+ expect(data).to.have.property('p_gpid');
1440
+ expect(data['p_gpid']).to.equal('/1233/sports&div1');
1441
+ });
1442
+
1443
+ it('should send gpid and pbadslot since it is prefered over dfp code', function () {
1444
+ bidderRequest.bids[0].ortb2Imp = {
1445
+ ext: {
1446
+ gpid: '/1233/sports&div1',
1447
+ data: {
1448
+ pbadslot: 'pb_slot',
1449
+ adserver: {
1450
+ adslot: '/1234/sports',
1451
+ name: 'gam'
1452
+ }
1453
+ }
1454
+ }
1455
+ }
1456
+
1457
+ const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
1458
+ const data = parseQuery(request.data);
1459
+
1460
+ expect(data).to.be.an('Object');
1461
+ expect(data['p_gpid']).to.equal('/1233/sports&div1');
1462
+ expect(data).to.not.have.property('tg_i.dfp_ad_unit_code');
1463
+ expect(data['tg_i.pbadslot']).to.equal('pb_slot');
1426
1464
  });
1427
1465
  });
1428
1466
 
@@ -1470,12 +1508,13 @@ describe('the rubicon adapter', function () {
1470
1508
  expect(data).to.not.have.property('tg_i.dfp_ad_unit_code');
1471
1509
  });
1472
1510
 
1473
- it('should send \"tg_i.dfp_ad_unit_code\" if \"ortb2Imp.ext.data.adServer.adslot\" value is a valid string', function () {
1511
+ it('should send NOT \"tg_i.dfp_ad_unit_code\" if \"ortb2Imp.ext.data.adServer.adslot\" value is a valid string but not gam', function () {
1474
1512
  bidderRequest.bids[0].ortb2Imp = {
1475
1513
  ext: {
1476
1514
  data: {
1477
1515
  adserver: {
1478
- adslot: 'abc'
1516
+ adslot: '/a/b/c',
1517
+ name: 'not gam'
1479
1518
  }
1480
1519
  }
1481
1520
  }
@@ -1485,16 +1524,16 @@ describe('the rubicon adapter', function () {
1485
1524
  const data = parseQuery(request.data);
1486
1525
 
1487
1526
  expect(data).to.be.an('Object');
1488
- expect(data).to.have.property('tg_i.dfp_ad_unit_code');
1489
- expect(data['tg_i.dfp_ad_unit_code']).to.equal('abc');
1527
+ expect(data).to.not.have.property('tg_i.dfp_ad_unit_code');
1490
1528
  });
1491
1529
 
1492
- it('should send \"tg_i.dfp_ad_unit_code\" if \"ortb2Imp.ext.data.adServer.adslot\" value is a valid string, but all leading slash characters should be removed', function () {
1530
+ it('should send \"tg_i.dfp_ad_unit_code\" if \"ortb2Imp.ext.data.adServer.adslot\" value is a valid string and name is gam', function () {
1493
1531
  bidderRequest.bids[0].ortb2Imp = {
1494
1532
  ext: {
1495
1533
  data: {
1496
1534
  adserver: {
1497
- adslot: 'a/b/c'
1535
+ name: 'gam',
1536
+ adslot: '/a/b/c'
1498
1537
  }
1499
1538
  }
1500
1539
  }
@@ -1505,7 +1544,7 @@ describe('the rubicon adapter', function () {
1505
1544
 
1506
1545
  expect(data).to.be.an('Object');
1507
1546
  expect(data).to.have.property('tg_i.dfp_ad_unit_code');
1508
- expect(data['tg_i.dfp_ad_unit_code']).to.equal('a/b/c');
1547
+ expect(data['tg_i.dfp_ad_unit_code']).to.equal('/a/b/c');
1509
1548
  });
1510
1549
  });
1511
1550
  });
@@ -3343,6 +3382,23 @@ describe('the rubicon adapter', function () {
3343
3382
  type: 'iframe', url: `${emilyUrl}?gdpr_consent=foo&us_privacy=1NYN`
3344
3383
  });
3345
3384
  });
3385
+
3386
+ it('should pass gdprApplies', function () {
3387
+ expect(spec.getUserSyncs({iframeEnabled: true}, {}, {
3388
+ gdprApplies: true
3389
+ }, '1NYN')).to.deep.equal({
3390
+ type: 'iframe', url: `${emilyUrl}?gdpr=1&us_privacy=1NYN`
3391
+ });
3392
+ });
3393
+
3394
+ it('should pass all correctly', function () {
3395
+ expect(spec.getUserSyncs({iframeEnabled: true}, {}, {
3396
+ gdprApplies: true,
3397
+ consentString: 'foo'
3398
+ }, '1NYN')).to.deep.equal({
3399
+ type: 'iframe', url: `${emilyUrl}?gdpr=1&gdpr_consent=foo&us_privacy=1NYN`
3400
+ });
3401
+ });
3346
3402
  });
3347
3403
 
3348
3404
  describe('get price granularity', function () {
@@ -50,10 +50,10 @@ describe('SharedId System', function () {
50
50
  expect(callbackSpy.calledOnce).to.be.true;
51
51
  expect(callbackSpy.lastCall.lastArg).to.equal(UUID);
52
52
  });
53
- it('should log message if coppa is set', function () {
53
+ it('should abort if coppa is set', function () {
54
54
  coppaDataHandlerDataStub.returns('true');
55
- sharedIdSystemSubmodule.getId({});
56
- expect(utils.logInfo.args[0][0]).to.exist.and.to.equal('PubCommonId: IDs not provided for coppa requests, exiting PubCommonId');
55
+ const result = sharedIdSystemSubmodule.getId({});
56
+ expect(result).to.be.undefined;
57
57
  });
58
58
  });
59
59
  describe('SharedId System extendId()', function () {
@@ -85,10 +85,56 @@ describe('SharedId System', function () {
85
85
  let pubcommId = sharedIdSystemSubmodule.extendId(config, undefined, 'TestId').id;
86
86
  expect(pubcommId).to.equal('TestId');
87
87
  });
88
- it('should log message if coppa is set', function () {
88
+ it('should abort if coppa is set', function () {
89
89
  coppaDataHandlerDataStub.returns('true');
90
- sharedIdSystemSubmodule.extendId({}, undefined, 'TestId');
91
- expect(utils.logInfo.args[0][0]).to.exist.and.to.equal('PubCommonId: IDs not provided for coppa requests, exiting PubCommonId');
90
+ const result = sharedIdSystemSubmodule.extendId({params: {extend: true}}, undefined, 'TestId');
91
+ expect(result).to.be.undefined;
92
+ });
93
+ });
94
+
95
+ describe('SharedID System domainOverride', () => {
96
+ let sandbox, domain, cookies, rejectCookiesFor;
97
+
98
+ beforeEach(() => {
99
+ sandbox = sinon.createSandbox();
100
+ sandbox.stub(document, 'domain').get(() => domain);
101
+ cookies = {};
102
+ sandbox.stub(storage, 'getCookie').callsFake((key) => cookies[key]);
103
+ rejectCookiesFor = null;
104
+ sandbox.stub(storage, 'setCookie').callsFake((key, value, expires, sameSite, domain) => {
105
+ if (domain !== rejectCookiesFor) {
106
+ if (expires != null) {
107
+ expires = new Date(expires);
108
+ }
109
+ if (expires == null || expires > Date.now()) {
110
+ cookies[key] = value;
111
+ } else {
112
+ delete cookies[key];
113
+ }
114
+ }
115
+ });
116
+ });
117
+
118
+ afterEach(() => {
119
+ sandbox.restore();
120
+ });
121
+
122
+ it('should return TLD if cookies can be set there', () => {
123
+ domain = 'sub.domain.com';
124
+ rejectCookiesFor = 'com';
125
+ expect(sharedIdSystemSubmodule.domainOverride()).to.equal('domain.com');
126
+ });
127
+
128
+ it('should return undefined when cookies cannot be set', () => {
129
+ domain = 'sub.domain.com';
130
+ rejectCookiesFor = 'sub.domain.com';
131
+ expect(sharedIdSystemSubmodule.domainOverride()).to.be.undefined;
132
+ });
133
+
134
+ it('should return half-way domain if parent domain rejects cookies', () => {
135
+ domain = 'inner.outer.domain.com';
136
+ rejectCookiesFor = 'domain.com';
137
+ expect(sharedIdSystemSubmodule.domainOverride()).to.equal('outer.domain.com');
92
138
  });
93
139
  });
94
140
  });
@@ -13,6 +13,7 @@ const adomain = ['showheroes.com'];
13
13
 
14
14
  const gdpr = {
15
15
  'gdprConsent': {
16
+ 'apiVersion': 2,
16
17
  'consentString': 'BOEFEAyOEFEAyAHABDENAI4AAAB9vABAASA',
17
18
  'gdprApplies': true
18
19
  }
@@ -332,6 +333,7 @@ describe('shBidAdapter', function () {
332
333
  {
333
334
  'cpm': 5,
334
335
  'creativeId': 'c_38b373e1e31c18',
336
+ 'adUnitCode': 'adunit-code-1',
335
337
  'currency': 'EUR',
336
338
  'width': 640,
337
339
  'height': 480,
@@ -134,12 +134,6 @@ describe('Tappx bid adapter', function () {
134
134
  assert.isTrue(spec.isBidRequestValid(c_BIDREQUEST.bids[0]), JSON.stringify(c_BIDREQUEST));
135
135
  });
136
136
 
137
- it('should return false when params are missing', function () {
138
- let badBidRequestParam = JSON.parse(JSON.stringify(c_BIDREQUEST));
139
- delete badBidRequestParam.bids[0].params;
140
- assert.isFalse(spec.isBidRequestValid(badBidRequestParam.bids[0]));
141
- });
142
-
143
137
  it('should return false when tappxkey is missing', function () {
144
138
  let badBidRequestTpxkey = JSON.parse(JSON.stringify(c_BIDREQUEST)); ;
145
139
  delete badBidRequestTpxkey.bids[0].params.tappxkey;
@@ -165,21 +159,11 @@ describe('Tappx bid adapter', function () {
165
159
  assert.isTrue(spec.isBidRequestValid(badBidRequestNwEp.bids[0]));
166
160
  });
167
161
 
168
- it('should return false mimes param is missing', function () {
169
- let badBidRequest_mimes = c_BIDDERREQUEST_V;
170
- delete badBidRequest_mimes.bids.mediaTypes.video;
171
- badBidRequest_mimes.bids.mediaTypes.video = {};
172
- badBidRequest_mimes.bids.mediaTypes.video.context = 'instream';
173
- badBidRequest_mimes.bids.mediaTypes.video.playerSize = [320, 250];
174
- assert.isFalse(spec.isBidRequestValid(badBidRequest_mimes.bids), badBidRequest_mimes);
175
- });
176
-
177
162
  it('should return false for not instream/outstream requests', function () {
178
163
  let badBidRequest_v = c_BIDDERREQUEST_V;
179
164
  delete badBidRequest_v.bids.mediaTypes.banner;
180
165
  badBidRequest_v.bids.mediaTypes.video = {};
181
166
  badBidRequest_v.bids.mediaTypes.video.context = '';
182
- badBidRequest_v.bids.mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
183
167
  badBidRequest_v.bids.mediaTypes.video.playerSize = [320, 250];
184
168
  assert.isFalse(spec.isBidRequestValid(badBidRequest_v.bids));
185
169
  });
@@ -232,7 +216,6 @@ describe('Tappx bid adapter', function () {
232
216
  validBidRequests_V[0].mediaTypes.video = {};
233
217
  validBidRequests_V[0].mediaTypes.video.playerSize = [640, 480];
234
218
  validBidRequests_V[0].mediaTypes.video.context = 'instream';
235
- validBidRequests_V[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
236
219
 
237
220
  bidderRequest_V.bids.mediaTypes.context = 'instream';
238
221
 
@@ -252,7 +235,6 @@ describe('Tappx bid adapter', function () {
252
235
  validBidRequests_Voutstream[0].mediaTypes.video = {};
253
236
  validBidRequests_Voutstream[0].mediaTypes.video.playerSize = [640, 480];
254
237
  validBidRequests_Voutstream[0].mediaTypes.video.context = 'outstream';
255
- validBidRequests_Voutstream[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
256
238
 
257
239
  bidderRequest_VOutstream.bids.mediaTypes.context = 'outstream';
258
240
 
@@ -273,7 +255,6 @@ describe('Tappx bid adapter', function () {
273
255
  validBidRequests_Voutstream[0].mediaTypes.video.rewarded = 1;
274
256
  validBidRequests_Voutstream[0].mediaTypes.video.playerSize = [640, 480];
275
257
  validBidRequests_Voutstream[0].mediaTypes.video.context = 'outstream';
276
- validBidRequests_Voutstream[0].mediaTypes.video.mimes = [ 'video/mp4', 'application/javascript' ];
277
258
 
278
259
  bidderRequest_VOutstream.bids.mediaTypes.context = 'outstream';
279
260
 
@@ -0,0 +1,96 @@
1
+ import { spec } from '../../../modules/targetVideoBidAdapter.js'
2
+
3
+ describe('TargetVideo Bid Adapter', function() {
4
+ const bannerRequest = [{
5
+ bidder: 'targetVideo',
6
+ mediaTypes: {
7
+ banner: {
8
+ sizes: [[300, 250]],
9
+ }
10
+ },
11
+ params: {
12
+ placementId: 12345,
13
+ }
14
+ }];
15
+
16
+ it('Test the bid validation function', function() {
17
+ const validBid = spec.isBidRequestValid(bannerRequest[0]);
18
+ const invalidBid = spec.isBidRequestValid(null);
19
+
20
+ expect(validBid).to.be.true;
21
+ expect(invalidBid).to.be.false;
22
+ });
23
+
24
+ it('Test the request processing function', function () {
25
+ const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
26
+ expect(request).to.not.be.empty;
27
+
28
+ const payload = JSON.parse(request.data);
29
+ expect(payload).to.not.be.empty;
30
+ expect(payload.sdk).to.deep.equal({
31
+ source: 'pbjs',
32
+ version: '$prebid.version$'
33
+ });
34
+ expect(payload.tags[0].id).to.equal(12345);
35
+ expect(payload.tags[0].gpid).to.equal('targetVideo');
36
+ expect(payload.tags[0].ad_types[0]).to.equal('video');
37
+ });
38
+
39
+ it('Handle nobid responses', function () {
40
+ const responseBody = {
41
+ 'version': '0.0.1',
42
+ 'tags': [{
43
+ 'uuid': '84ab500420319d',
44
+ 'tag_id': 5976557,
45
+ 'auction_id': '297492697822162468',
46
+ 'nobid': true
47
+ }]
48
+ };
49
+ const bidderRequest = null;
50
+
51
+ const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
52
+ expect(bidResponse.length).to.equal(0);
53
+ });
54
+
55
+ it('Test the response parsing function', function () {
56
+ const responseBody = {
57
+ 'tags': [{
58
+ 'uuid': '84ab500420319d',
59
+ 'ads': [{
60
+ 'ad_type': 'video',
61
+ 'cpm': 0.500000,
62
+ 'notify_url': 'https://www.target-video.com/',
63
+ 'rtb': {
64
+ 'video': {
65
+ 'player_width': 640,
66
+ 'player_height': 360,
67
+ 'asset_url': 'https://www.target-video.com/'
68
+ }
69
+ }
70
+ }]
71
+ }]
72
+ };
73
+ const bidderRequest = {
74
+ bids: [{
75
+ bidId: '84ab500420319d',
76
+ adUnitCode: 'code',
77
+ mediaTypes: {
78
+ banner: {
79
+ sizes: [[300, 250]]
80
+ }
81
+ }
82
+ }]
83
+ };
84
+
85
+ const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
86
+ expect(bidResponse).to.not.be.empty;
87
+
88
+ const bid = bidResponse[0];
89
+ expect(bid).to.not.be.empty;
90
+ expect(bid.cpm).to.equal(0.675);
91
+ expect(bid.width).to.equal(300);
92
+ expect(bid.height).to.equal(250);
93
+ expect(bid.ad).to.include('<script src="https://player.target-video.com/custom/targetvideo-banner.js"></script>')
94
+ expect(bid.ad).to.include('initPlayer')
95
+ });
96
+ });
@@ -614,15 +614,13 @@ describe('teadsBidAdapter', () => {
614
614
  }
615
615
  ];
616
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 () {
617
+ it('should add gpid if ortb2Imp.ext.gpid is present and is non empty', function () {
618
618
  const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
619
619
  return {
620
620
  ...bidRequest,
621
621
  ortb2Imp: {
622
622
  ext: {
623
- data: {
624
- pbadslot: '1111/home-left-' + index
625
- }
623
+ gpid: '1111/home-left-' + index
626
624
  }
627
625
  }
628
626
  };
@@ -635,41 +633,12 @@ describe('teadsBidAdapter', () => {
635
633
  expect(payload.data[1].gpid).to.equal('1111/home-left-1');
636
634
  });
637
635
 
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 () {
636
+ it('should not add gpid if ortb2Imp.ext.gpid is present but empty', function () {
663
637
  const updatedBidRequests = bidRequests.map(bidRequest => ({
664
638
  ...bidRequest,
665
639
  ortb2Imp: {
666
640
  ext: {
667
- data: {
668
- pbadslot: '',
669
- adserver: {
670
- adslot: ''
671
- }
672
- }
641
+ gpid: ''
673
642
  }
674
643
  }
675
644
  }));
@@ -682,36 +651,22 @@ describe('teadsBidAdapter', () => {
682
651
  });
683
652
  });
684
653
 
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);
654
+ it('should not add gpid if ortb2Imp.ext.gpid is not present', function () {
655
+ const updatedBidRequests = bidRequests.map(bidRequest => ({
656
+ ...bidRequest,
657
+ ortb2Imp: {
658
+ ext: {
659
+ }
660
+ }
661
+ }));
662
+
663
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
687
664
  const payload = JSON.parse(request.data);
688
665
 
689
666
  return payload.data.forEach(bid => {
690
667
  expect(bid).not.to.have.property('gpid');
691
668
  });
692
669
  });
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
670
  });
716
671
 
717
672
  function checkMediaTypesSizes(mediaTypes, expectedSizes) {