prebid.js 7.22.0 → 7.23.1

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 (273) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/aaxBlockmeterRtdProvider.js +1 -0
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adtrgtmeBidAdapter.js +1 -1
  8. package/dist/adxcgBidAdapter.js +1 -1
  9. package/dist/ajaBidAdapter.js +1 -1
  10. package/dist/amxBidAdapter.js +1 -1
  11. package/dist/amxIdSystem.js +1 -1
  12. package/dist/analyticsAdapter.js +1 -1
  13. package/dist/appierAnalyticsAdapter.js +1 -1
  14. package/dist/appnexusBidAdapter.js +1 -1
  15. package/dist/asoBidAdapter.js +1 -1
  16. package/dist/axonixBidAdapter.js +1 -1
  17. package/dist/bidViewability.js +1 -1
  18. package/dist/bidViewabilityIO.js +1 -1
  19. package/dist/bidglassBidAdapter.js +1 -1
  20. package/dist/big-richmediaBidAdapter.js +1 -1
  21. package/dist/bridgewellBidAdapter.js +1 -1
  22. package/dist/brightMountainMediaBidAdapter.js +1 -1
  23. package/dist/browsiRtdProvider.js +1 -1
  24. package/dist/carodaBidAdapter.js +1 -1
  25. package/dist/chtnwBidAdapter.js +1 -0
  26. package/dist/cleanioRtdProvider.js +1 -1
  27. package/dist/concertBidAdapter.js +1 -1
  28. package/dist/connectadBidAdapter.js +1 -1
  29. package/dist/consentManagement.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/currency.js +1 -1
  36. package/dist/dependencies.json +19 -0
  37. package/dist/dfpAdServerVideo.js +1 -1
  38. package/dist/dgkeywordRtdProvider.js +1 -1
  39. package/dist/dspxBidAdapter.js +1 -1
  40. package/dist/eplanningBidAdapter.js +1 -1
  41. package/dist/finativeBidAdapter.js +1 -1
  42. package/dist/gdprEnforcement.js +1 -1
  43. package/dist/glimpseBidAdapter.js +1 -1
  44. package/dist/gmosspBidAdapter.js +1 -1
  45. package/dist/goldbachBidAdapter.js +1 -1
  46. package/dist/googleAnalyticsAdapter.js +1 -1
  47. package/dist/gridBidAdapter.js +1 -1
  48. package/dist/gridNMBidAdapter.js +1 -1
  49. package/dist/gumgumBidAdapter.js +1 -1
  50. package/dist/h12mediaBidAdapter.js +1 -1
  51. package/dist/id5AnalyticsAdapter.js +1 -1
  52. package/dist/id5IdSystem.js +1 -1
  53. package/dist/improvedigitalBidAdapter.js +1 -1
  54. package/dist/inmarBidAdapter.js +1 -1
  55. package/dist/insticatorBidAdapter.js +1 -1
  56. package/dist/instreamTracking.js +1 -1
  57. package/dist/ixBidAdapter.js +1 -1
  58. package/dist/justpremiumBidAdapter.js +1 -1
  59. package/dist/jwplayerVideoProvider.js +1 -0
  60. package/dist/kargoBidAdapter.js +1 -1
  61. package/dist/konduitAnalyticsAdapter.js +1 -1
  62. package/dist/kueezBidAdapter.js +1 -1
  63. package/dist/lassoBidAdapter.js +1 -1
  64. package/dist/lifestreetBidAdapter.js +1 -1
  65. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  66. package/dist/logicadBidAdapter.js +1 -1
  67. package/dist/loglyliftBidAdapter.js +1 -1
  68. package/dist/magniteAnalyticsAdapter.js +1 -1
  69. package/dist/malltvAnalyticsAdapter.js +1 -1
  70. package/dist/marsmediaBidAdapter.js +1 -1
  71. package/dist/mediafuseBidAdapter.js +1 -1
  72. package/dist/mediasquareBidAdapter.js +1 -1
  73. package/dist/mgidBidAdapter.js +1 -1
  74. package/dist/minutemediaBidAdapter.js +1 -1
  75. package/dist/multibid.js +1 -1
  76. package/dist/not-for-prod/prebid.js +141 -132
  77. package/dist/oguryBidAdapter.js +1 -1
  78. package/dist/onetagBidAdapter.js +1 -1
  79. package/dist/ooloAnalyticsAdapter.js +1 -1
  80. package/dist/openxOrtbBidAdapter.js +1 -1
  81. package/dist/ortbConverter.js +1 -0
  82. package/dist/outbrainBidAdapter.js +1 -1
  83. package/dist/oxxionRtdProvider.js +1 -0
  84. package/dist/parrableIdSystem.js +1 -1
  85. package/dist/pbsExtensions.js +1 -0
  86. package/dist/pixfutureBidAdapter.js +1 -1
  87. package/dist/prebid-core.js +1 -1
  88. package/dist/prebidServerBidAdapter.js +1 -1
  89. package/dist/priceFloors.js +1 -1
  90. package/dist/pubCommonId.js +1 -1
  91. package/dist/publinkIdSystem.js +1 -1
  92. package/dist/pubmaticBidAdapter.js +1 -1
  93. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  94. package/dist/pxyzBidAdapter.js +1 -1
  95. package/dist/quantcastBidAdapter.js +1 -1
  96. package/dist/readpeakBidAdapter.js +1 -1
  97. package/dist/relaidoBidAdapter.js +1 -1
  98. package/dist/rhythmoneBidAdapter.js +1 -1
  99. package/dist/riseBidAdapter.js +1 -1
  100. package/dist/rtdModule.js +1 -1
  101. package/dist/rubiconAnalyticsAdapter.js +1 -1
  102. package/dist/rubiconBidAdapter.js +1 -1
  103. package/dist/schain.js +1 -1
  104. package/dist/seedingAllianceBidAdapter.js +1 -1
  105. package/dist/seedtagBidAdapter.js +1 -1
  106. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  107. package/dist/sharethroughBidAdapter.js +1 -1
  108. package/dist/shinezBidAdapter.js +1 -1
  109. package/dist/smaatoBidAdapter.js +1 -1
  110. package/dist/smartadserverBidAdapter.js +1 -1
  111. package/dist/smartxBidAdapter.js +1 -1
  112. package/dist/smilewantedBidAdapter.js +1 -1
  113. package/dist/sonobiBidAdapter.js +1 -1
  114. package/dist/sovrnAnalyticsAdapter.js +1 -1
  115. package/dist/sovrnBidAdapter.js +1 -1
  116. package/dist/spotxBidAdapter.js +1 -1
  117. package/dist/sspBCBidAdapter.js +1 -1
  118. package/dist/sublimeBidAdapter.js +1 -1
  119. package/dist/synacormediaBidAdapter.js +1 -1
  120. package/dist/targetVideoBidAdapter.js +1 -1
  121. package/dist/teadsBidAdapter.js +1 -1
  122. package/dist/teadsIdSystem.js +1 -1
  123. package/dist/trionBidAdapter.js +1 -1
  124. package/dist/tripleliftBidAdapter.js +1 -1
  125. package/dist/ttdBidAdapter.js +1 -1
  126. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  127. package/dist/underdogmediaBidAdapter.js +1 -1
  128. package/dist/undertoneBidAdapter.js +1 -1
  129. package/dist/userId.js +1 -1
  130. package/dist/vidazooBidAdapter.js +1 -1
  131. package/dist/video.js +1 -0
  132. package/dist/videoModule.js +1 -0
  133. package/dist/videobyteBidAdapter.js +1 -1
  134. package/dist/videojsVideoProvider.js +1 -0
  135. package/dist/visxBidAdapter.js +1 -1
  136. package/dist/vuukleBidAdapter.js +1 -1
  137. package/dist/widespaceBidAdapter.js +1 -1
  138. package/dist/winrBidAdapter.js +1 -1
  139. package/dist/yahoosspBidAdapter.js +1 -1
  140. package/dist/yieldmoBidAdapter.js +1 -1
  141. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  142. package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +98 -0
  143. package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +89 -0
  144. package/integrationExamples/videoModule/jwplayer/eventListeners.html +244 -0
  145. package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +122 -0
  146. package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +80 -0
  147. package/integrationExamples/videoModule/jwplayer/playlist.html +122 -0
  148. package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +126 -0
  149. package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +132 -0
  150. package/integrationExamples/videoModule/videojs/eventListeners.html +238 -0
  151. package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +138 -0
  152. package/integrationExamples/videoModule/videojs/mediaMetadata.html +103 -0
  153. package/integrationExamples/videoModule/videojs/playlist.html +151 -0
  154. package/libraries/ortbConverter/README.md +378 -0
  155. package/libraries/ortbConverter/converter.js +135 -0
  156. package/libraries/ortbConverter/lib/composer.js +43 -0
  157. package/libraries/ortbConverter/lib/mergeProcessors.js +9 -0
  158. package/libraries/ortbConverter/lib/sizes.js +14 -0
  159. package/libraries/ortbConverter/processors/banner.js +40 -0
  160. package/libraries/ortbConverter/processors/default.js +167 -0
  161. package/libraries/ortbConverter/processors/mediaType.js +21 -0
  162. package/libraries/ortbConverter/processors/native.js +37 -0
  163. package/libraries/ortbConverter/processors/video.js +66 -0
  164. package/libraries/pbsExtensions/pbsExtensions.js +12 -0
  165. package/libraries/pbsExtensions/processors/aliases.js +17 -0
  166. package/libraries/pbsExtensions/processors/mediaType.js +23 -0
  167. package/libraries/pbsExtensions/processors/params.js +22 -0
  168. package/libraries/pbsExtensions/processors/pbs.js +99 -0
  169. package/libraries/pbsExtensions/processors/requestExtPrebid.js +30 -0
  170. package/libraries/pbsExtensions/processors/video.js +23 -0
  171. package/libraries/video/constants/enums.js +5 -0
  172. package/libraries/video/constants/events.js +97 -0
  173. package/libraries/video/constants/ortb.js +169 -0
  174. package/libraries/video/constants/vendorCodes.js +6 -0
  175. package/libraries/video/shared/eventHandler.js +18 -0
  176. package/libraries/video/shared/parentModule.js +82 -0
  177. package/libraries/video/shared/state.js +47 -0
  178. package/libraries/video/shared/vastXmlBuilder.js +77 -0
  179. package/libraries/video/shared/vastXmlEditor.js +115 -0
  180. package/modules/.submodules.json +6 -1
  181. package/modules/aaxBlockmeterRtdProvider.js +59 -0
  182. package/modules/aaxBlockmeterRtdProvider.md +48 -0
  183. package/modules/appnexusBidAdapter.js +38 -1
  184. package/modules/chtnwBidAdapter.js +110 -0
  185. package/modules/chtnwBidAdapter.md +31 -0
  186. package/modules/concertBidAdapter.js +44 -2
  187. package/modules/consentManagement.js +22 -1
  188. package/modules/consentManagementUsp.js +29 -7
  189. package/modules/criteoBidAdapter.js +25 -5
  190. package/modules/currency.js +9 -0
  191. package/modules/dgkeywordRtdProvider.js +3 -3
  192. package/modules/gridNMBidAdapter.js +10 -14
  193. package/modules/improvedigitalBidAdapter.js +191 -470
  194. package/modules/ixBidAdapter.js +24 -64
  195. package/modules/jwplayerVideoProvider.js +929 -0
  196. package/modules/jwplayerVideoProvider.md +25 -0
  197. package/modules/kargoBidAdapter.js +1 -1
  198. package/modules/multibid/index.js +12 -0
  199. package/modules/openxOrtbBidAdapter.js +120 -275
  200. package/modules/oxxionRtdProvider.js +119 -0
  201. package/modules/oxxionRtdProvider.md +48 -0
  202. package/modules/prebidServerBidAdapter/index.js +19 -716
  203. package/modules/prebidServerBidAdapter/ortbConverter.js +274 -0
  204. package/modules/priceFloors.js +73 -1
  205. package/modules/rtdModule/index.js +22 -1
  206. package/modules/schain.js +24 -1
  207. package/modules/spotxBidAdapter.js +16 -15
  208. package/modules/synacormediaBidAdapter.js +1 -1
  209. package/modules/teadsIdSystem.js +5 -0
  210. package/modules/userId/index.js +64 -6
  211. package/modules/videoModule/addingSubmodule.md +521 -0
  212. package/modules/videoModule/coreVideo.js +234 -0
  213. package/modules/videoModule/gamAdServerSubmodule.js +27 -0
  214. package/modules/videoModule/index.js +244 -0
  215. package/modules/videoModule/videoImpressionVerifier.js +206 -0
  216. package/modules/videojsVideoProvider.js +854 -0
  217. package/modules/videojsVideoProvider.md +17 -0
  218. package/package.json +5 -1
  219. package/src/adapterManager.js +56 -7
  220. package/src/adloader.js +2 -1
  221. package/src/auction.js +5 -0
  222. package/src/events.js +5 -1
  223. package/src/pbjsORTB.js +35 -0
  224. package/src/prebid.js +137 -112
  225. package/src/targeting.js +10 -2
  226. package/src/utils/currency.js +16 -0
  227. package/src/utils.js +21 -0
  228. package/test/spec/auctionmanager_spec.js +6 -0
  229. package/test/spec/modules/aaxBlockmeter_spec.js +58 -0
  230. package/test/spec/modules/chtnwBidAdapter_spec.js +105 -0
  231. package/test/spec/modules/concertBidAdapter_spec.js +56 -0
  232. package/test/spec/modules/consentManagementUsp_spec.js +64 -18
  233. package/test/spec/modules/criteoBidAdapter_spec.js +28 -0
  234. package/test/spec/modules/dgkeywordRtdProvider_spec.js +3 -3
  235. package/test/spec/modules/improvedigitalBidAdapter_spec.js +231 -211
  236. package/test/spec/modules/ixBidAdapter_spec.js +230 -371
  237. package/test/spec/modules/openxOrtbBidAdapter_spec.js +77 -49
  238. package/test/spec/modules/oxxionRtdProvider_spec.js +142 -0
  239. package/test/spec/modules/prebidServerBidAdapter_spec.js +139 -137
  240. package/test/spec/modules/realTimeDataModule_spec.js +65 -0
  241. package/test/spec/modules/userId_spec.js +67 -1
  242. package/test/spec/modules/videoModule/coreVideo_spec.js +98 -0
  243. package/test/spec/modules/videoModule/pbVideo_spec.js +362 -0
  244. package/test/spec/modules/videoModule/shared/parentModule_spec.js +73 -0
  245. package/test/spec/modules/videoModule/shared/state_spec.js +26 -0
  246. package/test/spec/modules/videoModule/shared/vastXmlBuilder_spec.js +103 -0
  247. package/test/spec/modules/videoModule/shared/vastXmlEditor_spec.js +209 -0
  248. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +846 -0
  249. package/test/spec/modules/videoModule/submodules/videojsVideoProvider_spec.js +391 -0
  250. package/test/spec/modules/videoModule/videoImpressionVerifier_spec.js +112 -0
  251. package/test/spec/ortbConverter/banner_spec.js +203 -0
  252. package/test/spec/ortbConverter/composer_spec.js +69 -0
  253. package/test/spec/ortbConverter/converter_spec.js +283 -0
  254. package/test/spec/ortbConverter/currency_spec.js +40 -0
  255. package/test/spec/ortbConverter/default_processors_spec.js +61 -0
  256. package/test/spec/ortbConverter/gdpr_spec.js +38 -0
  257. package/test/spec/ortbConverter/mediaTypes_spec.js +67 -0
  258. package/test/spec/ortbConverter/mergeProcessors_spec.js +59 -0
  259. package/test/spec/ortbConverter/multibid_spec.js +35 -0
  260. package/test/spec/ortbConverter/native_spec.js +95 -0
  261. package/test/spec/ortbConverter/pbjsORTB_spec.js +67 -0
  262. package/test/spec/ortbConverter/pbsExtensions/aliases_spec.js +57 -0
  263. package/test/spec/ortbConverter/pbsExtensions/params_spec.js +96 -0
  264. package/test/spec/ortbConverter/pbsExtensions/video_spec.js +52 -0
  265. package/test/spec/ortbConverter/priceFloors_spec.js +143 -0
  266. package/test/spec/ortbConverter/schain_spec.js +33 -0
  267. package/test/spec/ortbConverter/userId_spec.js +21 -0
  268. package/test/spec/ortbConverter/usp_spec.js +15 -0
  269. package/test/spec/ortbConverter/video_spec.js +189 -0
  270. package/test/spec/unit/core/adapterManager_spec.js +102 -0
  271. package/test/spec/unit/core/targeting_spec.js +34 -0
  272. package/test/spec/unit/pbjs_api_spec.js +124 -45
  273. package/test/spec/utils_spec.js +45 -1
@@ -1,5 +1,10 @@
1
1
  import { expect } from 'chai';
2
- import { PrebidServer as Adapter, resetSyncedStatus, resetWurlMap } from 'modules/prebidServerBidAdapter/index.js';
2
+ import {
3
+ PrebidServer as Adapter,
4
+ resetSyncedStatus,
5
+ resetWurlMap,
6
+ s2sDefaultConfig
7
+ } from 'modules/prebidServerBidAdapter/index.js';
3
8
  import adapterManager from 'src/adapterManager.js';
4
9
  import * as utils from 'src/utils.js';
5
10
  import { ajax } from 'src/ajax.js';
@@ -13,6 +18,14 @@ import 'modules/appnexusBidAdapter.js' // appnexus alias test
13
18
  import 'modules/rubiconBidAdapter.js' // rubicon alias test
14
19
  import 'src/prebid.js' // $$PREBID_GLOBAL$$.aliasBidder test
15
20
  import 'modules/currency.js' // adServerCurrency test
21
+ // also load modules that register ORTB processors
22
+ import 'modules/currency.js';
23
+ import 'modules/userId/index.js';
24
+ import 'modules/multibid/index.js';
25
+ import 'modules/priceFloors.js';
26
+ import 'modules/consentManagement.js';
27
+ import 'modules/consentManagementUsp.js';
28
+ import 'modules/schain.js';
16
29
  import { hook } from '../../../src/hook.js';
17
30
  import { decorateAdUnitsWithNativeParams } from '../../../src/native.js';
18
31
  import { auctionManager } from '../../../src/auctionManager.js';
@@ -552,6 +565,7 @@ describe('S2S Adapter', function () {
552
565
 
553
566
  beforeEach(function () {
554
567
  config.resetConfig();
568
+ config.setConfig({floors: {enabled: false}});
555
569
  adapter = new Adapter();
556
570
  BID_REQUESTS = [
557
571
  {
@@ -620,6 +634,14 @@ describe('S2S Adapter', function () {
620
634
  expect(requestBid.source.tid).to.equal(BID_REQUESTS[0].auctionId);
621
635
  });
622
636
 
637
+ it('should set tmax to s2sConfig.timeout', () => {
638
+ const cfg = {...CONFIG, timeout: 123};
639
+ config.setConfig({s2sConfig: cfg});
640
+ adapter.callBids({...REQUEST, s2sConfig: cfg}, BID_REQUESTS, addBidResponse, done, ajax);
641
+ const req = JSON.parse(server.requests[0].requestBody);
642
+ expect(req.tmax).to.eql(123);
643
+ })
644
+
623
645
  it('should block request if config did not define p1Consent URL in endpoint object config', function () {
624
646
  let badConfig = utils.deepClone(CONFIG);
625
647
  badConfig.endpoint = { noP1Consent: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' };
@@ -957,11 +979,11 @@ describe('S2S Adapter', function () {
957
979
  config.setConfig(_config);
958
980
  adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
959
981
  const requestBid = JSON.parse(server.requests[0].requestBody);
960
- expect(requestBid.device).to.deep.equal({
982
+ sinon.assert.match(requestBid.device, {
961
983
  ifa: '6D92078A-8246-4BA4-AE5B-76104861E7DC',
962
984
  w: window.innerWidth,
963
985
  h: window.innerHeight
964
- });
986
+ })
965
987
  expect(requestBid.app).to.deep.equal({
966
988
  bundle: 'com.test.app',
967
989
  publisher: { 'id': '1' }
@@ -984,11 +1006,11 @@ describe('S2S Adapter', function () {
984
1006
  config.setConfig(_config);
985
1007
  adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
986
1008
  const requestBid = JSON.parse(server.requests[0].requestBody);
987
- expect(requestBid.device).to.deep.equal({
1009
+ sinon.assert.match(requestBid.device, {
988
1010
  ifa: '6D92078A-8246-4BA4-AE5B-76104861E7DC',
989
1011
  w: window.innerWidth,
990
1012
  h: window.innerHeight
991
- });
1013
+ })
992
1014
  expect(requestBid.app).to.deep.equal({
993
1015
  bundle: 'com.test.app',
994
1016
  publisher: { 'id': '1' }
@@ -1029,6 +1051,8 @@ describe('S2S Adapter', function () {
1029
1051
  expect(
1030
1052
  BID_REQUESTS[0].bids[0].getFloor.calledWith({
1031
1053
  currency: 'USD',
1054
+ mediaType: '*',
1055
+ size: '*'
1032
1056
  })
1033
1057
  ).to.be.true;
1034
1058
 
@@ -1058,6 +1082,8 @@ describe('S2S Adapter', function () {
1058
1082
  expect(
1059
1083
  BID_REQUESTS[0].bids[0].getFloor.calledWith({
1060
1084
  currency: 'USD',
1085
+ mediaType: '*',
1086
+ size: '*'
1061
1087
  })
1062
1088
  ).to.be.true;
1063
1089
 
@@ -1085,6 +1111,8 @@ describe('S2S Adapter', function () {
1085
1111
  expect(
1086
1112
  BID_REQUESTS[0].bids[0].getFloor.calledWith({
1087
1113
  currency: 'JPY',
1114
+ mediaType: '*',
1115
+ size: '*'
1088
1116
  })
1089
1117
  ).to.be.true;
1090
1118
  });
@@ -1250,9 +1278,9 @@ describe('S2S Adapter', function () {
1250
1278
  conversionFn: null
1251
1279
  },
1252
1280
  'is not working': {
1253
- expectDesc: 'first',
1254
- expectedFloor: 2,
1255
- expectedCur: '1',
1281
+ expectDesc: 'absolute minimum',
1282
+ expectedFloor: 1,
1283
+ expectedCur: '10',
1256
1284
  conversionFn: () => {
1257
1285
  throw new Error();
1258
1286
  }
@@ -1291,6 +1319,47 @@ describe('S2S Adapter', function () {
1291
1319
 
1292
1320
  if (FEATURES.NATIVE) {
1293
1321
  describe('native requests', function () {
1322
+ const ORTB_NATIVE_REQ = {
1323
+ 'ver': '1.2',
1324
+ 'assets': [
1325
+ {
1326
+ 'required': 1,
1327
+ 'id': 0,
1328
+ 'title': {
1329
+ 'len': 800
1330
+ }
1331
+ },
1332
+ {
1333
+ 'required': 1,
1334
+ 'id': 1,
1335
+ 'img': {
1336
+ 'type': 3,
1337
+ 'w': 989,
1338
+ 'h': 742
1339
+ }
1340
+ },
1341
+ {
1342
+ 'required': 1,
1343
+ 'id': 2,
1344
+ 'img': {
1345
+ 'type': 1,
1346
+ 'wmin': 10,
1347
+ 'hmin': 10,
1348
+ 'ext': {
1349
+ 'aspectratios': ['1:1']
1350
+ }
1351
+ }
1352
+ },
1353
+ {
1354
+ 'required': 1,
1355
+ 'id': 3,
1356
+ 'data': {
1357
+ 'type': 1
1358
+ }
1359
+ }
1360
+ ]
1361
+ };
1362
+
1294
1363
  it('adds device.w and device.h even if the config lacks a device object', function () {
1295
1364
  const _config = {
1296
1365
  s2sConfig: CONFIG,
@@ -1300,14 +1369,15 @@ describe('S2S Adapter', function () {
1300
1369
  config.setConfig(_config);
1301
1370
  adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
1302
1371
  const requestBid = JSON.parse(server.requests[0].requestBody);
1303
- expect(requestBid.device).to.deep.equal({
1372
+ sinon.assert.match(requestBid.device, {
1304
1373
  w: window.innerWidth,
1305
1374
  h: window.innerHeight
1306
- });
1375
+ })
1307
1376
  expect(requestBid.app).to.deep.equal({
1308
1377
  bundle: 'com.test.app',
1309
1378
  publisher: { 'id': '1' }
1310
1379
  });
1380
+ expect(requestBid.imp[0].native.ver).to.equal('1.2');
1311
1381
  });
1312
1382
 
1313
1383
  it('adds native request for OpenRTB', function () {
@@ -1316,54 +1386,17 @@ describe('S2S Adapter', function () {
1316
1386
  };
1317
1387
 
1318
1388
  config.setConfig(_config);
1319
- adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
1389
+ adapter.callBids({...REQUEST, s2sConfig: Object.assign({}, CONFIG, s2sDefaultConfig)}, BID_REQUESTS, addBidResponse, done, ajax);
1320
1390
  const requestBid = JSON.parse(server.requests[0].requestBody);
1321
1391
  const ortbReq = JSON.parse(requestBid.imp[0].native.request);
1322
1392
  expect(ortbReq).to.deep.equal({
1323
- 'ver': '1.2',
1393
+ ...ORTB_NATIVE_REQ,
1324
1394
  'context': 1,
1325
1395
  'plcmttype': 1,
1326
1396
  'eventtrackers': [{
1327
1397
  event: 1,
1328
1398
  methods: [1]
1329
1399
  }],
1330
- 'assets': [
1331
- {
1332
- 'required': 1,
1333
- 'id': 0,
1334
- 'title': {
1335
- 'len': 800
1336
- }
1337
- },
1338
- {
1339
- 'required': 1,
1340
- 'id': 1,
1341
- 'img': {
1342
- 'type': 3,
1343
- 'w': 989,
1344
- 'h': 742
1345
- }
1346
- },
1347
- {
1348
- 'required': 1,
1349
- 'id': 2,
1350
- 'img': {
1351
- 'type': 1,
1352
- 'wmin': 10,
1353
- 'hmin': 10,
1354
- 'ext': {
1355
- 'aspectratios': ['1:1']
1356
- }
1357
- }
1358
- },
1359
- {
1360
- 'required': 1,
1361
- 'id': 3,
1362
- 'data': {
1363
- 'type': 1
1364
- }
1365
- }
1366
- ]
1367
1400
  });
1368
1401
  expect(requestBid.imp[0].native.ver).to.equal('1.2');
1369
1402
  });
@@ -1388,6 +1421,29 @@ describe('S2S Adapter', function () {
1388
1421
  expect(requestBid.imp[0].native.ver).to.equal('1.2');
1389
1422
  });
1390
1423
 
1424
+ it('can override default values for imp.native.request with s2sConfig.ortbNative', () => {
1425
+ const cfg = {
1426
+ ...CONFIG,
1427
+ ortbNative: {
1428
+ eventtrackers: [
1429
+ {event: 1, methods: [1, 2]}
1430
+ ]
1431
+ }
1432
+ }
1433
+ config.setConfig({
1434
+ s2sConfig: cfg
1435
+ });
1436
+ adapter.callBids({...REQUEST, s2sConfig: cfg}, BID_REQUESTS, addBidResponse, done, ajax);
1437
+ const requestBid = JSON.parse(server.requests[0].requestBody);
1438
+ const ortbReq = JSON.parse(requestBid.imp[0].native.request);
1439
+ expect(ortbReq).to.eql({
1440
+ ...ORTB_NATIVE_REQ,
1441
+ eventtrackers: [
1442
+ {event: 1, methods: [1, 2]}
1443
+ ]
1444
+ })
1445
+ })
1446
+
1391
1447
  it('should not include ext.aspectratios if adunit\'s aspect_ratios do not define radio_width and ratio_height', () => {
1392
1448
  const req = deepClone(REQUEST);
1393
1449
  req.ad_units[0].mediaTypes.native.icon.aspect_ratios[0] = {'min_width': 1, 'min_height': 2};
@@ -1444,13 +1500,14 @@ describe('S2S Adapter', function () {
1444
1500
 
1445
1501
  const aliasBidder = {
1446
1502
  bidder: 'beintoo',
1503
+ bid_id: REQUEST.ad_units[0].bids[0].bid_id,
1447
1504
  params: { placementId: '123456' }
1448
1505
  };
1449
1506
 
1450
1507
  const request = utils.deepClone(REQUEST);
1451
1508
  request.ad_units[0].bids = [aliasBidder];
1452
1509
 
1453
- adapter.callBids(request, BID_REQUESTS, addBidResponse, done, ajax);
1510
+ adapter.callBids(request, [{...BID_REQUESTS[0], bidderCode: 'beintoo'}], addBidResponse, done, ajax);
1454
1511
 
1455
1512
  const requestBid = JSON.parse(server.requests[0].requestBody);
1456
1513
  expect(requestBid.ext).to.haveOwnProperty('prebid');
@@ -1472,6 +1529,7 @@ describe('S2S Adapter', function () {
1472
1529
  config.setConfig({ s2sConfig: adjustedConfig });
1473
1530
 
1474
1531
  const aliasBidder = {
1532
+ ...REQUEST.ad_units[0].bids[0],
1475
1533
  bidder: 'bidderD',
1476
1534
  params: {
1477
1535
  unit: '10433394',
@@ -1484,7 +1542,7 @@ describe('S2S Adapter', function () {
1484
1542
  request.ad_units[0].bids = [aliasBidder];
1485
1543
  request.s2sConfig = adjustedConfig;
1486
1544
 
1487
- adapter.callBids(request, BID_REQUESTS, addBidResponse, done, ajax);
1545
+ adapter.callBids(request, [{...BID_REQUESTS[0], bidderCode: aliasBidder.bidder}], addBidResponse, done, ajax);
1488
1546
 
1489
1547
  const requestBid = JSON.parse(server.requests[0].requestBody);
1490
1548
  expect(requestBid.ext.prebid.aliases).to.deep.equal({ bidderD: 'mockBidder' });
@@ -1496,6 +1554,7 @@ describe('S2S Adapter', function () {
1496
1554
  const alias = 'foobar';
1497
1555
  const aliasBidder = {
1498
1556
  bidder: alias,
1557
+ bid_id: REQUEST.ad_units[0].bids[0].bid_id,
1499
1558
  params: { placementId: '123456' }
1500
1559
  };
1501
1560
 
@@ -1504,7 +1563,7 @@ describe('S2S Adapter', function () {
1504
1563
 
1505
1564
  // TODO: stub this
1506
1565
  $$PREBID_GLOBAL$$.aliasBidder('appnexus', alias);
1507
- adapter.callBids(request, BID_REQUESTS, addBidResponse, done, ajax);
1566
+ adapter.callBids(request, [{...BID_REQUESTS[0], bidderCode: 'foobar'}], addBidResponse, done, ajax);
1508
1567
 
1509
1568
  const requestBid = JSON.parse(server.requests[0].requestBody);
1510
1569
  expect(requestBid.ext).to.haveOwnProperty('prebid');
@@ -1536,13 +1595,14 @@ describe('S2S Adapter', function () {
1536
1595
  })
1537
1596
  const aliasBidder = {
1538
1597
  bidder: 'bidderCodeForTestSkipBPSAlias_Alias',
1598
+ bid_id: REQUEST.ad_units[0].bids[0].bid_id,
1539
1599
  params: { aid: 123 }
1540
1600
  };
1541
1601
 
1542
1602
  const request = utils.deepClone(REQUEST);
1543
1603
  request.ad_units[0].bids = [aliasBidder];
1544
1604
 
1545
- adapter.callBids(request, BID_REQUESTS, addBidResponse, done, ajax);
1605
+ adapter.callBids(request, [{...BID_REQUESTS[0], bidderCode: aliasBidder.bidder}], addBidResponse, done, ajax);
1546
1606
 
1547
1607
  const requestBid = JSON.parse(server.requests[0].requestBody);
1548
1608
 
@@ -1572,6 +1632,7 @@ describe('S2S Adapter', function () {
1572
1632
  const alias = 'foobar_1';
1573
1633
  const aliasBidder = {
1574
1634
  bidder: alias,
1635
+ bid_id: REQUEST.ad_units[0].bids[0].bid_id,
1575
1636
  params: { aid: 1234567 }
1576
1637
  };
1577
1638
 
@@ -1580,7 +1641,7 @@ describe('S2S Adapter', function () {
1580
1641
 
1581
1642
  // TODO: stub this
1582
1643
  $$PREBID_GLOBAL$$.aliasBidder('appnexus', alias, { skipPbsAliasing: true });
1583
- adapter.callBids(request, BID_REQUESTS, addBidResponse, done, ajax);
1644
+ adapter.callBids(request, [{...BID_REQUESTS[0], bidderCode: aliasBidder.bidder}], addBidResponse, done, ajax);
1584
1645
 
1585
1646
  const requestBid = JSON.parse(server.requests[0].requestBody);
1586
1647
 
@@ -1607,14 +1668,15 @@ describe('S2S Adapter', function () {
1607
1668
  });
1608
1669
  config.setConfig({ s2sConfig: s2sConfig });
1609
1670
 
1610
- const myRequest = utils.deepClone(REQUEST);
1611
- myRequest.ad_units[0].bids[0].params.usePaymentRule = true;
1612
- myRequest.ad_units[0].bids[0].params.keywords = {
1613
- foo: ['bar', 'baz'],
1614
- fizz: ['buzz']
1615
- };
1671
+ Object.assign(BID_REQUESTS[0].bids[0].params, {
1672
+ usePaymentRule: true,
1673
+ keywords: {
1674
+ foo: ['bar', 'baz'],
1675
+ fizz: ['buzz']
1676
+ }
1677
+ })
1616
1678
 
1617
- adapter.callBids(myRequest, BID_REQUESTS, addBidResponse, done, ajax);
1679
+ adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
1618
1680
  const requestBid = JSON.parse(server.requests[0].requestBody);
1619
1681
 
1620
1682
  const requestParams = requestBid.imp[0].ext.prebid.bidder;
@@ -1812,18 +1874,6 @@ describe('S2S Adapter', function () {
1812
1874
  expect(requestBid.user.ext.eids.filter(eid => eid.source === 'liveramp.com')[0].uids[0].id).is.equal('0000-1111-2222-3333');
1813
1875
  });
1814
1876
 
1815
- it('when config \'currency.adServerCurrency\' value is an array: ORTB has property \'cur\' value set to a single item array', function () {
1816
- config.setConfig({
1817
- currency: { adServerCurrency: ['USD', 'GB', 'UK', 'AU'] },
1818
- });
1819
-
1820
- const bidRequests = utils.deepClone(BID_REQUESTS);
1821
- adapter.callBids(REQUEST, bidRequests, addBidResponse, done, ajax);
1822
-
1823
- const parsedRequestBody = JSON.parse(server.requests[0].requestBody);
1824
- expect(parsedRequestBody.cur).to.deep.equal(['USD']);
1825
- });
1826
-
1827
1877
  it('when config \'currency.adServerCurrency\' value is a string: ORTB has property \'cur\' value set to a single item array', function () {
1828
1878
  config.setConfig({
1829
1879
  currency: { adServerCurrency: 'NZ' },
@@ -2157,29 +2207,22 @@ describe('S2S Adapter', function () {
2157
2207
  ]);
2158
2208
  });
2159
2209
 
2160
- it('passes schain object in request', function () {
2161
- const bidRequests = utils.deepClone(BID_REQUESTS);
2162
- const schainObject = {
2163
- 'ver': '1.0',
2164
- 'complete': 1,
2165
- 'nodes': [
2166
- {
2167
- 'asi': 'indirectseller.com',
2168
- 'sid': '00001',
2169
- 'hp': 1
2170
- },
2210
+ it('should "promote" the most reused bidder schain to source.ext.schain', () => {
2211
+ const bidderReqs = [
2212
+ {...deepClone(BID_REQUESTS[0]), bidderCode: 'A'},
2213
+ {...deepClone(BID_REQUESTS[0]), bidderCode: 'B'},
2214
+ {...deepClone(BID_REQUESTS[0]), bidderCode: 'C'}
2215
+ ];
2216
+ const chain1 = {chain: 1};
2217
+ const chain2 = {chain: 2};
2171
2218
 
2172
- {
2173
- 'asi': 'indirectseller-2.com',
2174
- 'sid': '00002',
2175
- 'hp': 2
2176
- }
2177
- ]
2178
- };
2179
- bidRequests[0].bids[0].schain = schainObject;
2180
- adapter.callBids(REQUEST, bidRequests, addBidResponse, done, ajax);
2181
- const parsedRequestBody = JSON.parse(server.requests[0].requestBody);
2182
- expect(parsedRequestBody.source.ext.schain).to.deep.equal(schainObject);
2219
+ bidderReqs[0].bids[0].schain = chain1;
2220
+ bidderReqs[1].bids[0].schain = chain2;
2221
+ bidderReqs[2].bids[0].schain = chain2;
2222
+
2223
+ adapter.callBids(REQUEST, bidderReqs, addBidResponse, done, ajax);
2224
+ const req = JSON.parse(server.requests[0].requestBody);
2225
+ expect(req.source.ext.schain).to.eql(chain2);
2183
2226
  });
2184
2227
 
2185
2228
  it('passes multibid array in request', function () {
@@ -2842,43 +2885,6 @@ describe('S2S Adapter', function () {
2842
2885
  expect(response).to.have.property('pbsBidId', '654321');
2843
2886
  });
2844
2887
 
2845
- it('handles response cache from ext.prebid.targeting with wurl and removes invalid targeting', function () {
2846
- const s2sConfig = Object.assign({}, CONFIG, {
2847
- endpoint: {
2848
- p1Consent: 'https://prebidserverurl/openrtb2/auction?querystring=param'
2849
- }
2850
- });
2851
- config.setConfig({ s2sConfig });
2852
- const cacheResponse = utils.deepClone(RESPONSE_OPENRTB_VIDEO);
2853
- cacheResponse.seatbid.forEach(item => {
2854
- item.bid[0].ext.prebid.events = {
2855
- win: 'https://wurl.com?a=1&b=2'
2856
- };
2857
- item.bid[0].ext.prebid.targeting = {
2858
- hb_uuid: 'a5ad3993',
2859
- hb_cache_host: 'prebid-cache.net',
2860
- hb_cache_path: '/cache',
2861
- hb_winurl: 'https://hbwinurl.com?a=1&b=2',
2862
- hb_bidid: '1234567890',
2863
- }
2864
- });
2865
-
2866
- const s2sVidRequest = utils.deepClone(VIDEO_REQUEST);
2867
- s2sVidRequest.s2sConfig = s2sConfig;
2868
-
2869
- adapter.callBids(s2sVidRequest, BID_REQUESTS, addBidResponse, done, ajax);
2870
- server.requests[0].respond(200, {}, JSON.stringify(cacheResponse));
2871
-
2872
- sinon.assert.calledOnce(addBidResponse);
2873
- const response = addBidResponse.firstCall.args[1];
2874
-
2875
- expect(response.adserverTargeting).to.deep.equal({
2876
- hb_uuid: 'a5ad3993',
2877
- hb_cache_host: 'prebid-cache.net',
2878
- hb_cache_path: '/cache'
2879
- });
2880
- });
2881
-
2882
2888
  it('add request property pbsBidId with ext.prebid.bidid value', function () {
2883
2889
  const s2sConfig = Object.assign({}, CONFIG, {
2884
2890
  endpoint: {
@@ -3513,11 +3519,7 @@ describe('S2S Adapter', function () {
3513
3519
 
3514
3520
  expect(requestBid.ext.prebid.floors).to.be.undefined;
3515
3521
 
3516
- // should pass of floorData is object
3517
- bidRequest[0].bids[0].floorData = {
3518
- skipped: false,
3519
- location: 'fetch',
3520
- }
3522
+ config.setConfig({floors: {}});
3521
3523
 
3522
3524
  adapter.callBids(REQUEST, bidRequest, addBidResponse, done, ajax);
3523
3525
  requestBid = JSON.parse(server.requests[1].requestBody);
@@ -4,6 +4,7 @@ import * as sinon from 'sinon';
4
4
  import {default as CONSTANTS} from '../../../src/constants.json';
5
5
  import * as events from '../../../src/events.js';
6
6
  import 'src/prebid.js';
7
+ import {attachRealTimeDataProvider, onDataDeletionRequest} from 'modules/rtdModule/index.js';
7
8
 
8
9
  const getBidRequestDataSpy = sinon.spy();
9
10
 
@@ -305,4 +306,68 @@ describe('Real time module', function () {
305
306
  });
306
307
  });
307
308
  });
309
+
310
+ describe('data deletion requests', () => {
311
+ let detach = () => null;
312
+
313
+ function mkRtdModule(name) {
314
+ const mod = {
315
+ name,
316
+ init: () => true,
317
+ onDataDeletionRequest: sinon.stub()
318
+ };
319
+ detach = ((orig) => {
320
+ const smDetach = attachRealTimeDataProvider(mod);
321
+ return function () {
322
+ orig();
323
+ smDetach();
324
+ }
325
+ })(detach);
326
+ return mod;
327
+ }
328
+ let sm1, sm2, cfg1, cfg2;
329
+ beforeEach(() => {
330
+ sm1 = mkRtdModule('mockMod1');
331
+ sm2 = mkRtdModule('mockMod2');
332
+ cfg1 = {
333
+ name: 'mockMod1',
334
+ i: 0
335
+ };
336
+ cfg2 = {
337
+ name: 'mockMod2',
338
+ i: 1
339
+ };
340
+ rtdModule.init(config);
341
+ config.setConfig({
342
+ realTimeData: {
343
+ dataProviders: [cfg1, cfg2],
344
+ }
345
+ });
346
+ });
347
+ afterEach(() => {
348
+ detach();
349
+ config.resetConfig();
350
+ });
351
+
352
+ it('calls onDataDeletionRequest on submodules', () => {
353
+ const next = sinon.stub();
354
+ onDataDeletionRequest(next, {a: 0});
355
+ sinon.assert.calledWith(next, {a: 0});
356
+ sinon.assert.calledWith(sm1.onDataDeletionRequest, cfg1);
357
+ sinon.assert.calledWith(sm2.onDataDeletionRequest, cfg2);
358
+ });
359
+
360
+ describe('does not choke if onDataDeletionRequest', () => {
361
+ Object.entries({
362
+ 'is missing': () => { delete sm1.onDataDeletionRequest },
363
+ 'throws': () => { sm1.onDataDeletionRequest.throws(new Error()) }
364
+ }).forEach(([t, setup]) => {
365
+ it(t, () => {
366
+ setup();
367
+ onDataDeletionRequest(sinon.stub());
368
+ sinon.assert.calledWith(sm2.onDataDeletionRequest, cfg2);
369
+ })
370
+ })
371
+ })
372
+ });
308
373
  });
@@ -9,7 +9,7 @@ import {
9
9
  setSubmoduleRegistry,
10
10
  syncDelay,
11
11
  PBJS_USER_ID_OPTOUT_NAME,
12
- findRootDomain,
12
+ findRootDomain, requestDataDeletion,
13
13
  } from 'modules/userId/index.js';
14
14
  import {createEidsArray} from 'modules/userId/eids.js';
15
15
  import {config} from 'src/config.js';
@@ -2703,6 +2703,72 @@ describe('User ID', function () {
2703
2703
  });
2704
2704
  });
2705
2705
 
2706
+ describe('requestDataDeletion', () => {
2707
+ function idMod(name, value) {
2708
+ return {
2709
+ name,
2710
+ getId() {
2711
+ return {id: value}
2712
+ },
2713
+ decode(d) {
2714
+ return {[name]: d}
2715
+ },
2716
+ onDataDeletionRequest: sinon.stub()
2717
+ }
2718
+ }
2719
+ let mod1, mod2, mod3, cfg1, cfg2, cfg3;
2720
+
2721
+ beforeEach(() => {
2722
+ init(config);
2723
+ mod1 = idMod('id1', 'val1');
2724
+ mod2 = idMod('id2', 'val2');
2725
+ mod3 = idMod('id3', 'val3');
2726
+ cfg1 = getStorageMock('id1', 'id1', 'cookie');
2727
+ cfg2 = getStorageMock('id2', 'id2', 'html5');
2728
+ cfg3 = {name: 'id3', value: {id3: 'val3'}};
2729
+ setSubmoduleRegistry([mod1, mod2, mod3]);
2730
+ config.setConfig({
2731
+ auctionDelay: 1,
2732
+ userSync: {
2733
+ userIds: [cfg1, cfg2, cfg3]
2734
+ }
2735
+ });
2736
+ return getGlobal().refreshUserIds();
2737
+ });
2738
+
2739
+ it('deletes stored IDs', () => {
2740
+ expect(coreStorage.getCookie('id1')).to.exist;
2741
+ expect(coreStorage.getDataFromLocalStorage('id2')).to.exist;
2742
+ requestDataDeletion(sinon.stub());
2743
+ expect(coreStorage.getCookie('id1')).to.not.exist;
2744
+ expect(coreStorage.getDataFromLocalStorage('id2')).to.not.exist;
2745
+ });
2746
+
2747
+ it('invokes onDataDeletionRequest', () => {
2748
+ requestDataDeletion(sinon.stub());
2749
+ sinon.assert.calledWith(mod1.onDataDeletionRequest, cfg1, {id1: 'val1'});
2750
+ sinon.assert.calledWith(mod2.onDataDeletionRequest, cfg2, {id2: 'val2'})
2751
+ sinon.assert.calledWith(mod3.onDataDeletionRequest, cfg3, {id3: 'val3'})
2752
+ });
2753
+
2754
+ describe('does not choke when onDataDeletionRequest', () => {
2755
+ Object.entries({
2756
+ 'is missing': () => { delete mod1.onDataDeletionRequest },
2757
+ 'throws': () => { mod1.onDataDeletionRequest.throws(new Error()) }
2758
+ }).forEach(([t, setup]) => {
2759
+ it(t, () => {
2760
+ setup();
2761
+ const next = sinon.stub();
2762
+ const arg = {random: 'value'};
2763
+ requestDataDeletion(next, arg);
2764
+ sinon.assert.calledOnce(mod2.onDataDeletionRequest);
2765
+ sinon.assert.calledOnce(mod3.onDataDeletionRequest);
2766
+ sinon.assert.calledWith(next, arg);
2767
+ })
2768
+ })
2769
+ })
2770
+ });
2771
+
2706
2772
  describe('findRootDomain', function () {
2707
2773
  let sandbox;
2708
2774