prebid.js 7.32.0 → 7.34.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 (180) hide show
  1. package/.github/workflows/issue_tracker.yml +26 -15
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/admaticBidAdapter.js +1 -1
  8. package/dist/admixerBidAdapter.js +1 -1
  9. package/dist/adnuntiusBidAdapter.js +1 -1
  10. package/dist/adrelevantisBidAdapter.js +1 -1
  11. package/dist/adtrgtmeBidAdapter.js +1 -1
  12. package/dist/adxcgBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/arcspanRtdProvider.js +1 -0
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/bidglassBidAdapter.js +1 -1
  22. package/dist/big-richmediaBidAdapter.js +1 -1
  23. package/dist/bliinkBidAdapter.js +1 -1
  24. package/dist/bridgewellBidAdapter.js +1 -1
  25. package/dist/brightMountainMediaBidAdapter.js +1 -1
  26. package/dist/carodaBidAdapter.js +1 -1
  27. package/dist/chtnwBidAdapter.js +1 -1
  28. package/dist/concertBidAdapter.js +1 -1
  29. package/dist/connectadBidAdapter.js +1 -1
  30. package/dist/consentManagementUsp.js +1 -1
  31. package/dist/consumableBidAdapter.js +1 -1
  32. package/dist/conversantBidAdapter.js +1 -1
  33. package/dist/craftBidAdapter.js +1 -1
  34. package/dist/criteoBidAdapter.js +1 -1
  35. package/dist/dspxBidAdapter.js +1 -1
  36. package/dist/emx_digitalBidAdapter.js +1 -1
  37. package/dist/eplanningBidAdapter.js +1 -1
  38. package/dist/feedadBidAdapter.js +1 -1
  39. package/dist/finativeBidAdapter.js +1 -1
  40. package/dist/glimpseBidAdapter.js +1 -1
  41. package/dist/gmosspBidAdapter.js +1 -1
  42. package/dist/goldbachBidAdapter.js +1 -1
  43. package/dist/gridBidAdapter.js +1 -1
  44. package/dist/gridNMBidAdapter.js +1 -1
  45. package/dist/gumgumBidAdapter.js +1 -1
  46. package/dist/h12mediaBidAdapter.js +1 -1
  47. package/dist/holidBidAdapter.js +1 -1
  48. package/dist/id5IdSystem.js +1 -1
  49. package/dist/improvedigitalBidAdapter.js +1 -1
  50. package/dist/inmarBidAdapter.js +1 -1
  51. package/dist/insticatorBidAdapter.js +1 -1
  52. package/dist/ixBidAdapter.js +1 -1
  53. package/dist/justpremiumBidAdapter.js +1 -1
  54. package/dist/kargoBidAdapter.js +1 -1
  55. package/dist/konduitAnalyticsAdapter.js +1 -1
  56. package/dist/kueezBidAdapter.js +1 -1
  57. package/dist/kueezRtbBidAdapter.js +1 -1
  58. package/dist/lassoBidAdapter.js +1 -1
  59. package/dist/lifestreetBidAdapter.js +1 -1
  60. package/dist/liveIntentIdSystem.js +1 -1
  61. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  62. package/dist/logicadBidAdapter.js +1 -1
  63. package/dist/loglyliftBidAdapter.js +1 -1
  64. package/dist/lotamePanoramaIdSystem.js +1 -1
  65. package/dist/magniteAnalyticsAdapter.js +1 -1
  66. package/dist/malltvAnalyticsAdapter.js +1 -1
  67. package/dist/marsmediaBidAdapter.js +1 -1
  68. package/dist/mediafuseBidAdapter.js +1 -1
  69. package/dist/mediasquareBidAdapter.js +1 -1
  70. package/dist/mgidBidAdapter.js +1 -1
  71. package/dist/minutemediaBidAdapter.js +1 -1
  72. package/dist/nextMillenniumBidAdapter.js +1 -1
  73. package/dist/nexx360BidAdapter.js +1 -1
  74. package/dist/not-for-prod/prebid.js +129 -128
  75. package/dist/oguryBidAdapter.js +1 -1
  76. package/dist/onetagBidAdapter.js +1 -1
  77. package/dist/ooloAnalyticsAdapter.js +1 -1
  78. package/dist/openxBidAdapter.js +1 -1
  79. package/dist/ortbConverter.js +1 -1
  80. package/dist/outbrainBidAdapter.js +1 -1
  81. package/dist/parrableIdSystem.js +1 -1
  82. package/dist/pixfutureBidAdapter.js +1 -1
  83. package/dist/prebid-core.js +1 -1
  84. package/dist/prebidServerBidAdapter.js +1 -1
  85. package/dist/priceFloors.js +1 -1
  86. package/dist/publinkIdSystem.js +1 -1
  87. package/dist/pubmaticBidAdapter.js +1 -1
  88. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  89. package/dist/pxyzBidAdapter.js +1 -1
  90. package/dist/quantcastBidAdapter.js +1 -1
  91. package/dist/readpeakBidAdapter.js +1 -1
  92. package/dist/relaidoBidAdapter.js +1 -1
  93. package/dist/rhythmoneBidAdapter.js +1 -1
  94. package/dist/riseBidAdapter.js +1 -1
  95. package/dist/rubiconAnalyticsAdapter.js +1 -1
  96. package/dist/rubiconBidAdapter.js +1 -1
  97. package/dist/seedingAllianceBidAdapter.js +1 -1
  98. package/dist/seedtagBidAdapter.js +1 -1
  99. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  100. package/dist/sharethroughBidAdapter.js +1 -1
  101. package/dist/shinezBidAdapter.js +1 -1
  102. package/dist/smaatoBidAdapter.js +1 -1
  103. package/dist/smartadserverBidAdapter.js +1 -1
  104. package/dist/smartxBidAdapter.js +1 -1
  105. package/dist/smilewantedBidAdapter.js +1 -1
  106. package/dist/sonobiBidAdapter.js +1 -1
  107. package/dist/sovrnAnalyticsAdapter.js +1 -1
  108. package/dist/sovrnBidAdapter.js +1 -1
  109. package/dist/sspBCBidAdapter.js +1 -1
  110. package/dist/sublimeBidAdapter.js +1 -1
  111. package/dist/synacormediaBidAdapter.js +1 -1
  112. package/dist/targetVideoBidAdapter.js +1 -1
  113. package/dist/teadsBidAdapter.js +1 -1
  114. package/dist/trionBidAdapter.js +1 -1
  115. package/dist/tripleliftBidAdapter.js +1 -1
  116. package/dist/ttdBidAdapter.js +1 -1
  117. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  118. package/dist/uid2IdSystem.js +1 -1
  119. package/dist/underdogmediaBidAdapter.js +1 -1
  120. package/dist/undertoneBidAdapter.js +1 -1
  121. package/dist/vidazooBidAdapter.js +1 -1
  122. package/dist/videobyteBidAdapter.js +1 -1
  123. package/dist/visxBidAdapter.js +1 -1
  124. package/dist/vuukleBidAdapter.js +1 -1
  125. package/dist/widespaceBidAdapter.js +1 -1
  126. package/dist/winrBidAdapter.js +1 -1
  127. package/dist/yahoosspBidAdapter.js +1 -1
  128. package/dist/yieldmoBidAdapter.js +1 -1
  129. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  130. package/libraries/ortbConverter/processors/default.js +19 -1
  131. package/modules/.submodules.json +1 -0
  132. package/modules/admaticBidAdapter.js +2 -1
  133. package/modules/admixerBidAdapter.js +26 -4
  134. package/modules/adnuntiusBidAdapter.js +36 -38
  135. package/modules/arcspanRtdProvider.js +73 -0
  136. package/modules/arcspanRtdProvider.md +11 -0
  137. package/modules/bliinkBidAdapter.js +1 -1
  138. package/modules/consentManagementUsp.js +10 -10
  139. package/modules/consumableBidAdapter.js +20 -2
  140. package/modules/criteoBidAdapter.js +1 -1
  141. package/modules/emx_digitalBidAdapter.js +9 -2
  142. package/modules/holidBidAdapter.js +9 -4
  143. package/modules/id5IdSystem.js +3 -1
  144. package/modules/ixBidAdapter.js +25 -6
  145. package/modules/kargoBidAdapter.js +5 -1
  146. package/modules/lotamePanoramaIdSystem.js +9 -1
  147. package/modules/nextMillenniumBidAdapter.js +19 -9
  148. package/modules/nexx360BidAdapter.js +2 -1
  149. package/modules/openxBidAdapter.js +5 -0
  150. package/modules/prebidServerBidAdapter/index.js +14 -1
  151. package/modules/prebidServerBidAdapter/ortbConverter.js +1 -1
  152. package/modules/priceFloors.js +11 -5
  153. package/modules/seedingAllianceBidAdapter.js +129 -116
  154. package/modules/seedtagBidAdapter.js +20 -6
  155. package/modules/targetVideoBidAdapter.js +1 -1
  156. package/modules/tripleliftBidAdapter.js +4 -0
  157. package/package.json +2 -2
  158. package/src/adloader.js +2 -1
  159. package/src/utils/promise.js +8 -0
  160. package/test/spec/modules/admixerBidAdapter_spec.js +140 -60
  161. package/test/spec/modules/adnuntiusBidAdapter_spec.js +120 -120
  162. package/test/spec/modules/arcspanRtdProvider_spec.js +187 -0
  163. package/test/spec/modules/bliinkBidAdapter_spec.js +7 -7
  164. package/test/spec/modules/consentManagementUsp_spec.js +15 -2
  165. package/test/spec/modules/consumableBidAdapter_spec.js +46 -0
  166. package/test/spec/modules/emx_digitalBidAdapter_spec.js +30 -1
  167. package/test/spec/modules/holidBidAdapter_spec.js +29 -0
  168. package/test/spec/modules/ixBidAdapter_spec.js +117 -6
  169. package/test/spec/modules/kargoBidAdapter_spec.js +32 -0
  170. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +16 -10
  171. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +14 -2
  172. package/test/spec/modules/openxBidAdapter_spec.js +41 -0
  173. package/test/spec/modules/openxOrtbBidAdapter_spec.js +41 -0
  174. package/test/spec/modules/prebidServerBidAdapter_spec.js +138 -0
  175. package/test/spec/modules/priceFloors_spec.js +155 -0
  176. package/test/spec/modules/seedingAllianceAdapter_spec.js +66 -23
  177. package/test/spec/modules/seedtagBidAdapter_spec.js +58 -17
  178. package/test/spec/modules/targetVideoBidAdapter_spec.js +2 -2
  179. package/test/spec/modules/tripleliftBidAdapter_spec.js +13 -0
  180. package/test/spec/ortbConverter/default_processors_spec.js +23 -0
@@ -18,6 +18,7 @@ describe('LotameId', function() {
18
18
  let removeFromLocalStorageStub;
19
19
  let timeStampStub;
20
20
  let uspConsentDataStub;
21
+ let requestHost;
21
22
 
22
23
  const nowTimestamp = new Date().getTime();
23
24
 
@@ -33,6 +34,11 @@ describe('LotameId', function() {
33
34
  );
34
35
  timeStampStub = sinon.stub(utils, 'timestamp').returns(nowTimestamp);
35
36
  uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
37
+ if (navigator.userAgent && navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
38
+ requestHost = 'https://c.ltmsphrcl.net/id';
39
+ } else {
40
+ requestHost = 'https://id.crwdcntrl.net/id';
41
+ }
36
42
  });
37
43
 
38
44
  afterEach(function () {
@@ -69,7 +75,7 @@ describe('LotameId', function() {
69
75
  });
70
76
 
71
77
  it('should call the remote server when getId is called', function () {
72
- expect(request.url).to.be.eq('https://id.crwdcntrl.net/id');
78
+ expect(request.url).to.be.eq(`${requestHost}`);
73
79
  expect(callBackSpy.calledOnce).to.be.true;
74
80
  });
75
81
 
@@ -439,7 +445,7 @@ describe('LotameId', function() {
439
445
 
440
446
  it('should pass the gdpr consent string back', function() {
441
447
  expect(request.url).to.be.eq(
442
- 'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven'
448
+ `${requestHost}?gdpr_applies=true&gdpr_consent=consentGiven`
443
449
  );
444
450
  });
445
451
  });
@@ -471,7 +477,7 @@ describe('LotameId', function() {
471
477
 
472
478
  it('should pass the gdpr consent string back', function() {
473
479
  expect(request.url).to.be.eq(
474
- 'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven'
480
+ `${requestHost}?gdpr_applies=true&gdpr_consent=consentGiven`
475
481
  );
476
482
  });
477
483
  });
@@ -503,7 +509,7 @@ describe('LotameId', function() {
503
509
 
504
510
  it('should pass the gdpr consent string back', function() {
505
511
  expect(request.url).to.be.eq(
506
- 'https://id.crwdcntrl.net/id?gdpr_applies=true&gdpr_consent=consentGiven'
512
+ `${requestHost}?gdpr_applies=true&gdpr_consent=consentGiven`
507
513
  );
508
514
  });
509
515
  });
@@ -531,7 +537,7 @@ describe('LotameId', function() {
531
537
 
532
538
  it('should not include the gdpr consent string on the url', function() {
533
539
  expect(request.url).to.be.eq(
534
- 'https://id.crwdcntrl.net/id?gdpr_applies=true'
540
+ `${requestHost}?gdpr_applies=true`
535
541
  );
536
542
  });
537
543
  });
@@ -560,7 +566,7 @@ describe('LotameId', function() {
560
566
 
561
567
  it('should pass the gdpr consent string back', function() {
562
568
  expect(request.url).to.be.eq(
563
- 'https://id.crwdcntrl.net/id?gdpr_consent=consentGiven'
569
+ `${requestHost}?gdpr_consent=consentGiven`
564
570
  );
565
571
  });
566
572
  });
@@ -589,7 +595,7 @@ describe('LotameId', function() {
589
595
 
590
596
  it('should pass the gdpr consent string back', function() {
591
597
  expect(request.url).to.be.eq(
592
- 'https://id.crwdcntrl.net/id?gdpr_consent=consentGiven'
598
+ `${requestHost}?gdpr_consent=consentGiven`
593
599
  );
594
600
  });
595
601
  });
@@ -613,7 +619,7 @@ describe('LotameId', function() {
613
619
  });
614
620
 
615
621
  it('should pass the gdpr consent string back', function() {
616
- expect(request.url).to.be.eq('https://id.crwdcntrl.net/id');
622
+ expect(request.url).to.be.eq(`${requestHost}`);
617
623
  });
618
624
  });
619
625
 
@@ -835,7 +841,7 @@ describe('LotameId', function() {
835
841
 
836
842
  it('should pass the usp consent string and client id back', function () {
837
843
  expect(request.url).to.be.eq(
838
- 'https://id.crwdcntrl.net/id?gdpr_applies=false&us_privacy=1NNN&c=1234'
844
+ `${requestHost}?gdpr_applies=false&us_privacy=1NNN&c=1234`
839
845
  );
840
846
  });
841
847
 
@@ -923,7 +929,7 @@ describe('LotameId', function() {
923
929
 
924
930
  it('should pass client id back', function () {
925
931
  expect(request.url).to.be.eq(
926
- 'https://id.crwdcntrl.net/id?gdpr_applies=false&c=1234'
932
+ `${requestHost}?gdpr_applies=false&c=1234`
927
933
  );
928
934
  });
929
935
 
@@ -49,7 +49,7 @@ describe('nextMillenniumBidAdapterTests', function() {
49
49
  cur: 'USD',
50
50
  ext: {
51
51
  sync: {
52
- image: ['urlA'],
52
+ image: ['urlA?gdpr={{.GDPR}}'],
53
53
  iframe: ['urlB'],
54
54
  }
55
55
  }
@@ -132,7 +132,7 @@ describe('nextMillenniumBidAdapterTests', function() {
132
132
  let userSync = spec.getUserSyncs(syncOptions, [serverResponse], bidRequestData[0].gdprConsent, bidRequestData[0].uspConsent);
133
133
  expect(userSync).to.be.an('array').with.lengthOf(1);
134
134
  expect(userSync[0].type).to.equal('image');
135
- expect(userSync[0].url).to.equal('urlA');
135
+ expect(userSync[0].url).to.equal('urlA?gdpr=1');
136
136
 
137
137
  syncOptions.iframeEnabled = true;
138
138
  syncOptions.pixelEnabled = false;
@@ -142,6 +142,18 @@ describe('nextMillenniumBidAdapterTests', function() {
142
142
  expect(userSync[0].url).to.equal('urlB');
143
143
  });
144
144
 
145
+ it('Test getUserSyncs function if GDPR is undefined', function () {
146
+ const syncOptions = {
147
+ 'iframeEnabled': false,
148
+ 'pixelEnabled': true
149
+ }
150
+
151
+ let userSync = spec.getUserSyncs(syncOptions, [serverResponse], undefined, bidRequestData[0].uspConsent);
152
+ expect(userSync).to.be.an('array').with.lengthOf(1);
153
+ expect(userSync[0].type).to.equal('image');
154
+ expect(userSync[0].url).to.equal('urlA?gdpr=0');
155
+ });
156
+
145
157
  it('Request params check without GDPR Consent', function () {
146
158
  delete bidRequestData[0].gdprConsent
147
159
  const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
@@ -1729,6 +1729,47 @@ describe('OpenxAdapter', function () {
1729
1729
  });
1730
1730
  });
1731
1731
  });
1732
+ describe('with user agent client hints', function () {
1733
+ it('should add json query param sua with BidRequest.device.sua if available', function () {
1734
+ const bidderRequestWithUserAgentClientHints = { refererInfo: {},
1735
+ ortb2: {
1736
+ device: {
1737
+ sua: {
1738
+ source: 2,
1739
+ platform: {
1740
+ brand: 'macOS',
1741
+ version: [ '12', '4', '0' ]
1742
+ },
1743
+ browsers: [
1744
+ {
1745
+ brand: 'Chromium',
1746
+ version: [ '106', '0', '5249', '119' ]
1747
+ },
1748
+ {
1749
+ brand: 'Google Chrome',
1750
+ version: [ '106', '0', '5249', '119' ]
1751
+ },
1752
+ {
1753
+ brand: 'Not;A=Brand',
1754
+ version: [ '99', '0', '0', '0' ]
1755
+ }],
1756
+ mobile: 0,
1757
+ model: 'Pro',
1758
+ bitness: '64',
1759
+ architecture: 'x86'
1760
+ }
1761
+ }
1762
+ }};
1763
+
1764
+ let request = spec.buildRequests([bidRequest], bidderRequestWithUserAgentClientHints);
1765
+ expect(request[0].data.sua).to.exist;
1766
+ const payload = JSON.parse(request[0].data.sua);
1767
+ expect(payload).to.deep.equal(bidderRequestWithUserAgentClientHints.ortb2.device.sua);
1768
+ const bidderRequestWithoutUserAgentClientHints = {refererInfo: {}, ortb2: {}};
1769
+ request = spec.buildRequests([bidRequest], bidderRequestWithoutUserAgentClientHints);
1770
+ expect(request[0].data.sua).to.not.exist;
1771
+ });
1772
+ });
1732
1773
  });
1733
1774
  })
1734
1775
 
@@ -579,6 +579,47 @@ describe('OpenxRtbAdapter', function () {
579
579
  });
580
580
  });
581
581
  });
582
+
583
+ describe('with user agent client hints', function () {
584
+ it('should add device.sua if available', function () {
585
+ const bidderRequestWithUserAgentClientHints = { refererInfo: {},
586
+ ortb2: {
587
+ device: {
588
+ sua: {
589
+ source: 2,
590
+ platform: {
591
+ brand: 'macOS',
592
+ version: [ '12', '4', '0' ]
593
+ },
594
+ browsers: [
595
+ {
596
+ brand: 'Chromium',
597
+ version: [ '106', '0', '5249', '119' ]
598
+ },
599
+ {
600
+ brand: 'Google Chrome',
601
+ version: [ '106', '0', '5249', '119' ]
602
+ },
603
+ {
604
+ brand: 'Not;A=Brand',
605
+ version: [ '99', '0', '0', '0' ]
606
+ }],
607
+ mobile: 0,
608
+ model: 'Pro',
609
+ bitness: '64',
610
+ architecture: 'x86'
611
+ }
612
+ }
613
+ }};
614
+
615
+ let request = spec.buildRequests(bidRequests, bidderRequestWithUserAgentClientHints);
616
+ expect(request[0].data.device.sua).to.exist;
617
+ expect(request[0].data.device.sua).to.deep.equal(bidderRequestWithUserAgentClientHints.ortb2.device.sua);
618
+ const bidderRequestWithoutUserAgentClientHints = {refererInfo: {}, ortb2: {}};
619
+ request = spec.buildRequests(bidRequests, bidderRequestWithoutUserAgentClientHints);
620
+ expect(request[0].data.device?.sua).to.not.exist;
621
+ });
622
+ });
582
623
  });
583
624
 
584
625
  context('when there is a consent management framework', function () {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-trailing-spaces */
1
2
  import {expect} from 'chai';
2
3
  import {
3
4
  PrebidServer as Adapter,
@@ -1505,6 +1506,28 @@ describe('S2S Adapter', function () {
1505
1506
  });
1506
1507
  });
1507
1508
 
1509
+ it('site should not be present when app is present', function () {
1510
+ const _config = {
1511
+ s2sConfig: CONFIG,
1512
+ app: { bundle: 'com.test.app' },
1513
+ site: {
1514
+ publisher: {
1515
+ id: '1234',
1516
+ domain: 'test.com'
1517
+ },
1518
+ content: {
1519
+ language: 'en'
1520
+ }
1521
+ }
1522
+ };
1523
+
1524
+ config.setConfig(_config);
1525
+ adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
1526
+ const requestBid = JSON.parse(server.requests[0].requestBody);
1527
+ expect(requestBid.site).to.not.exist;
1528
+ expect(requestBid.app).to.exist.and.to.be.a('object');
1529
+ });
1530
+
1508
1531
  it('adds appnexus aliases to request', function () {
1509
1532
  config.setConfig({ s2sConfig: CONFIG });
1510
1533
 
@@ -1703,6 +1726,121 @@ describe('S2S Adapter', function () {
1703
1726
  }]);
1704
1727
  });
1705
1728
 
1729
+ describe('filterSettings', function () {
1730
+ const getRequestBid = userSync => {
1731
+ let cookieSyncConfig = utils.deepClone(CONFIG);
1732
+ const s2sBidRequest = utils.deepClone(REQUEST);
1733
+ cookieSyncConfig.syncEndpoint = { p1Consent: 'https://prebid.adnxs.com/pbs/v1/cookie_sync' };
1734
+ s2sBidRequest.s2sConfig = cookieSyncConfig;
1735
+
1736
+ config.setConfig({ userSync, s2sConfig: cookieSyncConfig });
1737
+
1738
+ let bidRequest = utils.deepClone(BID_REQUESTS);
1739
+ adapter.callBids(s2sBidRequest, bidRequest, addBidResponse, done, ajax);
1740
+ return JSON.parse(server.requests[0].requestBody);
1741
+ }
1742
+
1743
+ it('correctly adds filterSettings to the cookie_sync request if userSync.filterSettings is present in the config and only the all key is present in userSync.filterSettings', function () {
1744
+ const userSync = {
1745
+ filterSettings: {
1746
+ all: {
1747
+ bidders: ['appnexus', 'rubicon', 'pubmatic'],
1748
+ filter: 'exclude'
1749
+ }
1750
+ }
1751
+ };
1752
+ const requestBid = getRequestBid(userSync);
1753
+
1754
+ expect(requestBid.filterSettings).to.deep.equal({
1755
+ 'image': {
1756
+ 'bidders': ['appnexus', 'rubicon', 'pubmatic'],
1757
+ 'filter': 'exclude'
1758
+ },
1759
+ 'iframe': {
1760
+ 'bidders': ['appnexus', 'rubicon', 'pubmatic'],
1761
+ 'filter': 'exclude'
1762
+ }
1763
+ });
1764
+ });
1765
+
1766
+ it('correctly adds filterSettings to the cookie_sync request if userSync.filterSettings is present in the config and only the iframe key is present in userSync.filterSettings', function () {
1767
+ const userSync = {
1768
+ filterSettings: {
1769
+ iframe: {
1770
+ bidders: ['rubicon', 'pubmatic'],
1771
+ filter: 'include'
1772
+ }
1773
+ }
1774
+ };
1775
+ const requestBid = getRequestBid(userSync);
1776
+
1777
+ expect(requestBid.filterSettings).to.deep.equal({
1778
+ 'image': {
1779
+ 'bidders': '*',
1780
+ 'filter': 'include'
1781
+ },
1782
+ 'iframe': {
1783
+ 'bidders': ['rubicon', 'pubmatic'],
1784
+ 'filter': 'include'
1785
+ }
1786
+ });
1787
+ });
1788
+
1789
+ it('correctly adds filterSettings to the cookie_sync request if userSync.filterSettings is present in the config and the image and iframe keys are both present in userSync.filterSettings', function () {
1790
+ const userSync = {
1791
+ filterSettings: {
1792
+ image: {
1793
+ bidders: ['triplelift', 'appnexus'],
1794
+ filter: 'include'
1795
+ },
1796
+ iframe: {
1797
+ bidders: ['pulsepoint', 'triplelift', 'appnexus', 'rubicon'],
1798
+ filter: 'exclude'
1799
+ }
1800
+ }
1801
+ };
1802
+ const requestBid = getRequestBid(userSync);
1803
+
1804
+ expect(requestBid.filterSettings).to.deep.equal({
1805
+ 'image': {
1806
+ 'bidders': ['triplelift', 'appnexus'],
1807
+ 'filter': 'include'
1808
+ },
1809
+ 'iframe': {
1810
+ 'bidders': ['pulsepoint', 'triplelift', 'appnexus', 'rubicon'],
1811
+ 'filter': 'exclude'
1812
+ }
1813
+ });
1814
+ });
1815
+
1816
+ it('correctly adds filterSettings to the cookie_sync request if userSync.filterSettings is present in the config and the all and iframe keys are both present in userSync.filterSettings', function () {
1817
+ const userSync = {
1818
+ filterSettings: {
1819
+ all: {
1820
+ bidders: ['triplelift', 'appnexus'],
1821
+ filter: 'include'
1822
+ },
1823
+ iframe: {
1824
+ bidders: ['pulsepoint', 'triplelift', 'appnexus', 'rubicon'],
1825
+ filter: 'exclude'
1826
+ }
1827
+ }
1828
+ };
1829
+ const requestBid = getRequestBid(userSync);
1830
+
1831
+ expect(requestBid.filterSettings).to.deep.equal({
1832
+ 'image': {
1833
+ 'bidders': ['triplelift', 'appnexus'],
1834
+ 'filter': 'include'
1835
+ },
1836
+ 'iframe': {
1837
+ 'bidders': ['pulsepoint', 'triplelift', 'appnexus', 'rubicon'],
1838
+ 'filter': 'exclude'
1839
+ }
1840
+ });
1841
+ });
1842
+ });
1843
+
1706
1844
  it('adds limit to the cookie_sync request if userSyncLimit is greater than 0', function () {
1707
1845
  let cookieSyncConfig = utils.deepClone(CONFIG);
1708
1846
  cookieSyncConfig.syncEndpoint = { p1Consent: 'https://prebid.adnxs.com/pbs/v1/cookie_sync' };
@@ -1495,6 +1495,161 @@ describe('the price floors module', function () {
1495
1495
  });
1496
1496
  });
1497
1497
 
1498
+ it('should use inverseFloorAdjustment function before bidder cpm adjustment', function () {
1499
+ let functionUsed;
1500
+ getGlobal().bidderSettings = {
1501
+ rubicon: {
1502
+ bidCpmAdjustment: function (bidCpm, bidResponse) {
1503
+ functionUsed = 'Rubicon Adjustment';
1504
+ bidCpm *= 0.5;
1505
+ if (bidResponse.mediaType === 'video') bidCpm -= 0.18;
1506
+ return bidCpm;
1507
+ },
1508
+ inverseBidAdjustment: function (bidCpm, bidRequest) {
1509
+ functionUsed = 'Rubicon Inverse';
1510
+ // if video is the only mediaType on Bid Request => add 0.18
1511
+ if (bidRequest.mediaTypes.video && Object.keys(bidRequest.mediaTypes).length === 1) bidCpm += 0.18;
1512
+ return bidCpm / 0.5;
1513
+ },
1514
+ },
1515
+ appnexus: {
1516
+ bidCpmAdjustment: function (bidCpm, bidResponse) {
1517
+ functionUsed = 'Appnexus Adjustment';
1518
+ bidCpm *= 0.75;
1519
+ if (bidResponse.mediaType === 'video') bidCpm -= 0.18;
1520
+ return bidCpm;
1521
+ },
1522
+ inverseBidAdjustment: function (bidCpm, bidRequest) {
1523
+ functionUsed = 'Appnexus Inverse';
1524
+ // if video is the only mediaType on Bid Request => add 0.18
1525
+ if (bidRequest.mediaTypes.video && Object.keys(bidRequest.mediaTypes).length === 1) bidCpm += 0.18;
1526
+ return bidCpm / 0.75;
1527
+ },
1528
+ }
1529
+ };
1530
+
1531
+ _floorDataForAuction[bidRequest.auctionId] = utils.deepClone(basicFloorConfig);
1532
+
1533
+ _floorDataForAuction[bidRequest.auctionId].data.values = { '*': 1.0 };
1534
+
1535
+ // start with banner as only mediaType
1536
+ bidRequest.mediaTypes = { banner: { sizes: [[300, 250]] } };
1537
+ let appnexusBid = {
1538
+ ...bidRequest,
1539
+ bidder: 'appnexus',
1540
+ };
1541
+
1542
+ // should be same as the adjusted calculated inverses above test (banner)
1543
+ expect(bidRequest.getFloor()).to.deep.equal({
1544
+ currency: 'USD',
1545
+ floor: 2.0
1546
+ });
1547
+
1548
+ // should use rubicon inverse
1549
+ expect(functionUsed).to.equal('Rubicon Inverse');
1550
+
1551
+ // appnexus just using banner should be same
1552
+ expect(appnexusBid.getFloor()).to.deep.equal({
1553
+ currency: 'USD',
1554
+ floor: 1.3334
1555
+ });
1556
+
1557
+ expect(functionUsed).to.equal('Appnexus Inverse');
1558
+
1559
+ // now since asking for 'video' only mediaType inverse function should include the .18
1560
+ bidRequest.mediaTypes = { video: { context: 'instream' } };
1561
+ expect(bidRequest.getFloor({ mediaType: 'video' })).to.deep.equal({
1562
+ currency: 'USD',
1563
+ floor: 2.36
1564
+ });
1565
+
1566
+ expect(functionUsed).to.equal('Rubicon Inverse');
1567
+
1568
+ // now since asking for 'video' inverse function should include the .18
1569
+ appnexusBid.mediaTypes = { video: { context: 'instream' } };
1570
+ expect(appnexusBid.getFloor({ mediaType: 'video' })).to.deep.equal({
1571
+ currency: 'USD',
1572
+ floor: 1.5734
1573
+ });
1574
+
1575
+ expect(functionUsed).to.equal('Appnexus Inverse');
1576
+ });
1577
+
1578
+ it('should pass inverseFloorAdjustment the bidRequest object so it can be used', function () {
1579
+ // Adjustment factors based on Bid Media Type
1580
+ const mediaTypeFactors = {
1581
+ banner: 0.5,
1582
+ native: 0.7,
1583
+ video: 0.9
1584
+ }
1585
+ getGlobal().bidderSettings = {
1586
+ rubicon: {
1587
+ bidCpmAdjustment: function (bidCpm, bidResponse) {
1588
+ return bidCpm * mediaTypeFactors[bidResponse.mediaType];
1589
+ },
1590
+ inverseBidAdjustment: function (bidCpm, bidRequest) {
1591
+ // For the inverse we add up each mediaType in the request and divide by number of Mt's to get the inverse number
1592
+ let factor = Object.keys(bidRequest.mediaTypes).reduce((sum, mediaType) => sum += mediaTypeFactors[mediaType], 0);
1593
+ factor = factor / Object.keys(bidRequest.mediaTypes).length;
1594
+ return bidCpm / factor;
1595
+ },
1596
+ }
1597
+ };
1598
+
1599
+ _floorDataForAuction[bidRequest.auctionId] = utils.deepClone(basicFloorConfig);
1600
+
1601
+ _floorDataForAuction[bidRequest.auctionId].data.values = { '*': 1.0 };
1602
+
1603
+ // banner only should be 2
1604
+ bidRequest.mediaTypes = { banner: {} };
1605
+ expect(bidRequest.getFloor()).to.deep.equal({
1606
+ currency: 'USD',
1607
+ floor: 2.0
1608
+ });
1609
+
1610
+ // native only should be 1.4286
1611
+ bidRequest.mediaTypes = { native: {} };
1612
+ expect(bidRequest.getFloor()).to.deep.equal({
1613
+ currency: 'USD',
1614
+ floor: 1.4286
1615
+ });
1616
+
1617
+ // video only should be 1.1112
1618
+ bidRequest.mediaTypes = { video: {} };
1619
+ expect(bidRequest.getFloor()).to.deep.equal({
1620
+ currency: 'USD',
1621
+ floor: 1.1112
1622
+ });
1623
+
1624
+ // video and banner should even out to 0.7 factor so 1.4286
1625
+ bidRequest.mediaTypes = { video: {}, banner: {} };
1626
+ expect(bidRequest.getFloor()).to.deep.equal({
1627
+ currency: 'USD',
1628
+ floor: 1.4286
1629
+ });
1630
+
1631
+ // video and native should even out to 0.8 factor so -- 1.25
1632
+ bidRequest.mediaTypes = { video: {}, native: {} };
1633
+ expect(bidRequest.getFloor()).to.deep.equal({
1634
+ currency: 'USD',
1635
+ floor: 1.25
1636
+ });
1637
+
1638
+ // banner and native should even out to 0.6 factor so -- 1.6667
1639
+ bidRequest.mediaTypes = { banner: {}, native: {} };
1640
+ expect(bidRequest.getFloor()).to.deep.equal({
1641
+ currency: 'USD',
1642
+ floor: 1.6667
1643
+ });
1644
+
1645
+ // all 3 banner video and native should even out to 0.7 factor so -- 1.4286
1646
+ bidRequest.mediaTypes = { banner: {}, native: {}, video: {} };
1647
+ expect(bidRequest.getFloor()).to.deep.equal({
1648
+ currency: 'USD',
1649
+ floor: 1.4286
1650
+ });
1651
+ });
1652
+
1498
1653
  it('should use standard cpmAdjustment if no bidder cpmAdjustment', function () {
1499
1654
  getGlobal().bidderSettings = {
1500
1655
  rubicon: {