prebid.js 7.22.0 → 7.24.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 (314) 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/admaticBidAdapter.js +1 -0
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtrgtmeBidAdapter.js +1 -1
  9. package/dist/adxcgBidAdapter.js +1 -1
  10. package/dist/adyoulikeBidAdapter.js +1 -1
  11. package/dist/ajaBidAdapter.js +1 -1
  12. package/dist/amxBidAdapter.js +1 -1
  13. package/dist/amxIdSystem.js +1 -1
  14. package/dist/analyticsAdapter.js +1 -1
  15. package/dist/appierAnalyticsAdapter.js +1 -1
  16. package/dist/appnexusBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/audiencerunBidAdapter.js +1 -1
  19. package/dist/axonixBidAdapter.js +1 -1
  20. package/dist/bidViewability.js +1 -1
  21. package/dist/bidViewabilityIO.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/big-richmediaBidAdapter.js +1 -1
  24. package/dist/bluebillywigBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/browsiRtdProvider.js +1 -1
  28. package/dist/carodaBidAdapter.js +1 -1
  29. package/dist/chtnwBidAdapter.js +1 -0
  30. package/dist/cleanioRtdProvider.js +1 -1
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectIdSystem.js +1 -1
  33. package/dist/connectadBidAdapter.js +1 -1
  34. package/dist/consentManagement.js +1 -1
  35. package/dist/consentManagementUsp.js +1 -1
  36. package/dist/consumableBidAdapter.js +1 -1
  37. package/dist/conversantBidAdapter.js +1 -1
  38. package/dist/craftBidAdapter.js +1 -1
  39. package/dist/criteoBidAdapter.js +1 -1
  40. package/dist/currency.js +1 -1
  41. package/dist/dependencies.json +19 -0
  42. package/dist/dfpAdServerVideo.js +1 -1
  43. package/dist/dgkeywordRtdProvider.js +1 -1
  44. package/dist/dspxBidAdapter.js +1 -1
  45. package/dist/eplanningBidAdapter.js +1 -1
  46. package/dist/finativeBidAdapter.js +1 -1
  47. package/dist/gdprEnforcement.js +1 -1
  48. package/dist/glimpseBidAdapter.js +1 -1
  49. package/dist/gmosspBidAdapter.js +1 -1
  50. package/dist/goldbachBidAdapter.js +1 -1
  51. package/dist/googleAnalyticsAdapter.js +1 -1
  52. package/dist/gridBidAdapter.js +1 -1
  53. package/dist/gridNMBidAdapter.js +1 -1
  54. package/dist/growthCodeIdSystem.js +1 -1
  55. package/dist/gumgumBidAdapter.js +1 -1
  56. package/dist/h12mediaBidAdapter.js +1 -1
  57. package/dist/id5AnalyticsAdapter.js +1 -1
  58. package/dist/id5IdSystem.js +1 -1
  59. package/dist/impactifyBidAdapter.js +1 -1
  60. package/dist/improvedigitalBidAdapter.js +1 -1
  61. package/dist/inmarBidAdapter.js +1 -1
  62. package/dist/insticatorBidAdapter.js +1 -1
  63. package/dist/instreamTracking.js +1 -1
  64. package/dist/ixBidAdapter.js +1 -1
  65. package/dist/jixieBidAdapter.js +1 -1
  66. package/dist/justpremiumBidAdapter.js +1 -1
  67. package/dist/jwplayerVideoProvider.js +1 -0
  68. package/dist/kargoBidAdapter.js +1 -1
  69. package/dist/konduitAnalyticsAdapter.js +1 -1
  70. package/dist/kueezBidAdapter.js +1 -1
  71. package/dist/kueezRtbBidAdapter.js +1 -0
  72. package/dist/lassoBidAdapter.js +1 -1
  73. package/dist/lifestreetBidAdapter.js +1 -1
  74. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  75. package/dist/logicadBidAdapter.js +1 -1
  76. package/dist/loglyliftBidAdapter.js +1 -1
  77. package/dist/magniteAnalyticsAdapter.js +1 -1
  78. package/dist/malltvAnalyticsAdapter.js +1 -1
  79. package/dist/marsmediaBidAdapter.js +1 -1
  80. package/dist/mediafuseBidAdapter.js +1 -1
  81. package/dist/mediakeysBidAdapter.js +1 -1
  82. package/dist/mediasquareBidAdapter.js +1 -1
  83. package/dist/mgidBidAdapter.js +1 -1
  84. package/dist/mgidRtdProvider.js +1 -0
  85. package/dist/minutemediaBidAdapter.js +1 -1
  86. package/dist/multibid.js +1 -1
  87. package/dist/not-for-prod/prebid.js +153 -141
  88. package/dist/oguryBidAdapter.js +1 -1
  89. package/dist/onetagBidAdapter.js +1 -1
  90. package/dist/ooloAnalyticsAdapter.js +1 -1
  91. package/dist/openxOrtbBidAdapter.js +1 -1
  92. package/dist/ortbConverter.js +1 -0
  93. package/dist/outbrainBidAdapter.js +1 -1
  94. package/dist/oxxionRtdProvider.js +1 -0
  95. package/dist/parrableIdSystem.js +1 -1
  96. package/dist/pbsExtensions.js +1 -0
  97. package/dist/permutiveRtdProvider.js +1 -1
  98. package/dist/pixfutureBidAdapter.js +1 -1
  99. package/dist/prebid-core.js +1 -1
  100. package/dist/prebidServerBidAdapter.js +1 -1
  101. package/dist/priceFloors.js +1 -1
  102. package/dist/pubCommonId.js +1 -1
  103. package/dist/publinkIdSystem.js +1 -1
  104. package/dist/pubmaticBidAdapter.js +1 -1
  105. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  106. package/dist/pxyzBidAdapter.js +1 -1
  107. package/dist/quantcastBidAdapter.js +1 -1
  108. package/dist/readpeakBidAdapter.js +1 -1
  109. package/dist/relaidoBidAdapter.js +1 -1
  110. package/dist/rhythmoneBidAdapter.js +1 -1
  111. package/dist/riseBidAdapter.js +1 -1
  112. package/dist/rtdModule.js +1 -1
  113. package/dist/rubiconAnalyticsAdapter.js +1 -1
  114. package/dist/rubiconBidAdapter.js +1 -1
  115. package/dist/schain.js +1 -1
  116. package/dist/seedingAllianceBidAdapter.js +1 -1
  117. package/dist/seedtagBidAdapter.js +1 -1
  118. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  119. package/dist/sharethroughBidAdapter.js +1 -1
  120. package/dist/shinezBidAdapter.js +1 -1
  121. package/dist/smaatoBidAdapter.js +1 -1
  122. package/dist/smartadserverBidAdapter.js +1 -1
  123. package/dist/smartxBidAdapter.js +1 -1
  124. package/dist/smilewantedBidAdapter.js +1 -1
  125. package/dist/sonobiBidAdapter.js +1 -1
  126. package/dist/sovrnAnalyticsAdapter.js +1 -1
  127. package/dist/sovrnBidAdapter.js +1 -1
  128. package/dist/spotxBidAdapter.js +1 -1
  129. package/dist/sspBCBidAdapter.js +1 -1
  130. package/dist/sublimeBidAdapter.js +1 -1
  131. package/dist/synacormediaBidAdapter.js +1 -1
  132. package/dist/targetVideoBidAdapter.js +1 -1
  133. package/dist/teadsBidAdapter.js +1 -1
  134. package/dist/teadsIdSystem.js +1 -1
  135. package/dist/trionBidAdapter.js +1 -1
  136. package/dist/tripleliftBidAdapter.js +1 -1
  137. package/dist/ttdBidAdapter.js +1 -1
  138. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  139. package/dist/underdogmediaBidAdapter.js +1 -1
  140. package/dist/undertoneBidAdapter.js +1 -1
  141. package/dist/userId.js +1 -1
  142. package/dist/vidazooBidAdapter.js +1 -1
  143. package/dist/video.js +1 -0
  144. package/dist/videoModule.js +1 -0
  145. package/dist/videobyteBidAdapter.js +1 -1
  146. package/dist/videojsVideoProvider.js +1 -0
  147. package/dist/visxBidAdapter.js +1 -1
  148. package/dist/vuukleBidAdapter.js +1 -1
  149. package/dist/widespaceBidAdapter.js +1 -1
  150. package/dist/winrBidAdapter.js +1 -1
  151. package/dist/yahoosspBidAdapter.js +1 -1
  152. package/dist/yieldmoBidAdapter.js +1 -1
  153. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  154. package/integrationExamples/gpt/mgidRtdProvider_example.html +143 -0
  155. package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +98 -0
  156. package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +89 -0
  157. package/integrationExamples/videoModule/jwplayer/eventListeners.html +244 -0
  158. package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +122 -0
  159. package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +80 -0
  160. package/integrationExamples/videoModule/jwplayer/playlist.html +122 -0
  161. package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +126 -0
  162. package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +132 -0
  163. package/integrationExamples/videoModule/videojs/eventListeners.html +238 -0
  164. package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +138 -0
  165. package/integrationExamples/videoModule/videojs/mediaMetadata.html +103 -0
  166. package/integrationExamples/videoModule/videojs/playlist.html +151 -0
  167. package/libraries/ortbConverter/README.md +378 -0
  168. package/libraries/ortbConverter/converter.js +135 -0
  169. package/libraries/ortbConverter/lib/composer.js +43 -0
  170. package/libraries/ortbConverter/lib/mergeProcessors.js +9 -0
  171. package/libraries/ortbConverter/lib/sizes.js +14 -0
  172. package/libraries/ortbConverter/processors/banner.js +40 -0
  173. package/libraries/ortbConverter/processors/default.js +167 -0
  174. package/libraries/ortbConverter/processors/mediaType.js +21 -0
  175. package/libraries/ortbConverter/processors/native.js +37 -0
  176. package/libraries/ortbConverter/processors/video.js +66 -0
  177. package/libraries/pbsExtensions/pbsExtensions.js +12 -0
  178. package/libraries/pbsExtensions/processors/aliases.js +17 -0
  179. package/libraries/pbsExtensions/processors/mediaType.js +23 -0
  180. package/libraries/pbsExtensions/processors/params.js +22 -0
  181. package/libraries/pbsExtensions/processors/pbs.js +99 -0
  182. package/libraries/pbsExtensions/processors/requestExtPrebid.js +30 -0
  183. package/libraries/pbsExtensions/processors/video.js +23 -0
  184. package/libraries/video/constants/enums.js +5 -0
  185. package/libraries/video/constants/events.js +97 -0
  186. package/libraries/video/constants/ortb.js +169 -0
  187. package/libraries/video/constants/vendorCodes.js +6 -0
  188. package/libraries/video/shared/eventHandler.js +18 -0
  189. package/libraries/video/shared/parentModule.js +82 -0
  190. package/libraries/video/shared/state.js +47 -0
  191. package/libraries/video/shared/vastXmlBuilder.js +77 -0
  192. package/libraries/video/shared/vastXmlEditor.js +115 -0
  193. package/modules/.submodules.json +7 -1
  194. package/modules/aaxBlockmeterRtdProvider.js +59 -0
  195. package/modules/aaxBlockmeterRtdProvider.md +48 -0
  196. package/modules/admaticBidAdapter.js +147 -0
  197. package/modules/admaticBidAdapter.md +48 -0
  198. package/modules/amxBidAdapter.js +1 -0
  199. package/modules/appnexusBidAdapter.js +38 -1
  200. package/modules/chtnwBidAdapter.js +110 -0
  201. package/modules/chtnwBidAdapter.md +31 -0
  202. package/modules/concertBidAdapter.js +44 -2
  203. package/modules/connectIdSystem.js +36 -23
  204. package/modules/connectIdSystem.md +3 -2
  205. package/modules/consentManagement.js +22 -1
  206. package/modules/consentManagementUsp.js +29 -7
  207. package/modules/criteoBidAdapter.js +25 -5
  208. package/modules/currency.js +9 -0
  209. package/modules/dgkeywordRtdProvider.js +3 -3
  210. package/modules/gridNMBidAdapter.js +10 -14
  211. package/modules/growthCodeIdSystem.js +9 -5
  212. package/modules/gumgumBidAdapter.js +4 -0
  213. package/modules/improvedigitalBidAdapter.js +191 -470
  214. package/modules/ixBidAdapter.js +54 -71
  215. package/modules/jwplayerVideoProvider.js +929 -0
  216. package/modules/jwplayerVideoProvider.md +25 -0
  217. package/modules/kargoBidAdapter.js +1 -1
  218. package/modules/kueezRtbBidAdapter.js +278 -0
  219. package/modules/kueezRtbBidAdapter.md +35 -0
  220. package/modules/magniteAnalyticsAdapter.js +6 -1
  221. package/modules/mgidRtdProvider.js +190 -0
  222. package/modules/mgidRtdProvider.md +51 -0
  223. package/modules/multibid/index.js +12 -0
  224. package/modules/openxOrtbBidAdapter.js +120 -275
  225. package/modules/oxxionRtdProvider.js +119 -0
  226. package/modules/oxxionRtdProvider.md +48 -0
  227. package/modules/permutiveRtdProvider.js +2 -1
  228. package/modules/permutiveRtdProvider.md +36 -1
  229. package/modules/prebidServerBidAdapter/index.js +19 -716
  230. package/modules/prebidServerBidAdapter/ortbConverter.js +274 -0
  231. package/modules/priceFloors.js +73 -1
  232. package/modules/pubmaticBidAdapter.js +21 -29
  233. package/modules/rtdModule/index.js +22 -1
  234. package/modules/schain.js +24 -1
  235. package/modules/spotxBidAdapter.js +16 -15
  236. package/modules/synacormediaBidAdapter.js +1 -1
  237. package/modules/teadsIdSystem.js +5 -0
  238. package/modules/tripleliftBidAdapter.js +1 -1
  239. package/modules/userId/eids.js +3 -10
  240. package/modules/userId/index.js +64 -6
  241. package/modules/videoModule/addingSubmodule.md +521 -0
  242. package/modules/videoModule/coreVideo.js +234 -0
  243. package/modules/videoModule/gamAdServerSubmodule.js +27 -0
  244. package/modules/videoModule/index.js +244 -0
  245. package/modules/videoModule/videoImpressionVerifier.js +206 -0
  246. package/modules/videojsVideoProvider.js +854 -0
  247. package/modules/videojsVideoProvider.md +17 -0
  248. package/package.json +12 -8
  249. package/src/adRendering.js +1 -1
  250. package/src/adapterManager.js +56 -7
  251. package/src/adloader.js +3 -1
  252. package/src/auction.js +6 -1
  253. package/src/events.js +5 -1
  254. package/src/pbjsORTB.js +35 -0
  255. package/src/prebid.js +137 -112
  256. package/src/targeting.js +10 -2
  257. package/src/utils/currency.js +16 -0
  258. package/src/utils.js +21 -0
  259. package/test/spec/auctionmanager_spec.js +15 -0
  260. package/test/spec/modules/aaxBlockmeter_spec.js +58 -0
  261. package/test/spec/modules/admaticBidAdapter_spec.js +46 -0
  262. package/test/spec/modules/chtnwBidAdapter_spec.js +105 -0
  263. package/test/spec/modules/concertBidAdapter_spec.js +56 -0
  264. package/test/spec/modules/connectIdSystem_spec.js +175 -5
  265. package/test/spec/modules/consentManagementUsp_spec.js +64 -18
  266. package/test/spec/modules/criteoBidAdapter_spec.js +28 -0
  267. package/test/spec/modules/dgkeywordRtdProvider_spec.js +3 -3
  268. package/test/spec/modules/eids_spec.js +10 -7
  269. package/test/spec/modules/ftrackIdSystem_spec.js +34 -22
  270. package/test/spec/modules/gumgumBidAdapter_spec.js +15 -0
  271. package/test/spec/modules/improvedigitalBidAdapter_spec.js +231 -211
  272. package/test/spec/modules/ixBidAdapter_spec.js +412 -350
  273. package/test/spec/modules/kueezRtbBidAdapter_spec.js +396 -0
  274. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +26 -0
  275. package/test/spec/modules/mgidRtdProvider_spec.js +366 -0
  276. package/test/spec/modules/openxOrtbBidAdapter_spec.js +77 -49
  277. package/test/spec/modules/oxxionRtdProvider_spec.js +142 -0
  278. package/test/spec/modules/permutiveRtdProvider_spec.js +64 -5
  279. package/test/spec/modules/prebidServerBidAdapter_spec.js +139 -137
  280. package/test/spec/modules/realTimeDataModule_spec.js +65 -0
  281. package/test/spec/modules/tripleliftBidAdapter_spec.js +14 -0
  282. package/test/spec/modules/userId_spec.js +67 -1
  283. package/test/spec/modules/videoModule/coreVideo_spec.js +98 -0
  284. package/test/spec/modules/videoModule/pbVideo_spec.js +362 -0
  285. package/test/spec/modules/videoModule/shared/parentModule_spec.js +73 -0
  286. package/test/spec/modules/videoModule/shared/state_spec.js +26 -0
  287. package/test/spec/modules/videoModule/shared/vastXmlBuilder_spec.js +103 -0
  288. package/test/spec/modules/videoModule/shared/vastXmlEditor_spec.js +209 -0
  289. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +846 -0
  290. package/test/spec/modules/videoModule/submodules/videojsVideoProvider_spec.js +391 -0
  291. package/test/spec/modules/videoModule/videoImpressionVerifier_spec.js +112 -0
  292. package/test/spec/ortbConverter/banner_spec.js +203 -0
  293. package/test/spec/ortbConverter/composer_spec.js +69 -0
  294. package/test/spec/ortbConverter/converter_spec.js +283 -0
  295. package/test/spec/ortbConverter/currency_spec.js +40 -0
  296. package/test/spec/ortbConverter/default_processors_spec.js +61 -0
  297. package/test/spec/ortbConverter/gdpr_spec.js +38 -0
  298. package/test/spec/ortbConverter/mediaTypes_spec.js +67 -0
  299. package/test/spec/ortbConverter/mergeProcessors_spec.js +59 -0
  300. package/test/spec/ortbConverter/multibid_spec.js +35 -0
  301. package/test/spec/ortbConverter/native_spec.js +95 -0
  302. package/test/spec/ortbConverter/pbjsORTB_spec.js +67 -0
  303. package/test/spec/ortbConverter/pbsExtensions/aliases_spec.js +57 -0
  304. package/test/spec/ortbConverter/pbsExtensions/params_spec.js +96 -0
  305. package/test/spec/ortbConverter/pbsExtensions/video_spec.js +52 -0
  306. package/test/spec/ortbConverter/priceFloors_spec.js +143 -0
  307. package/test/spec/ortbConverter/schain_spec.js +33 -0
  308. package/test/spec/ortbConverter/userId_spec.js +21 -0
  309. package/test/spec/ortbConverter/usp_spec.js +15 -0
  310. package/test/spec/ortbConverter/video_spec.js +189 -0
  311. package/test/spec/unit/core/adapterManager_spec.js +102 -0
  312. package/test/spec/unit/core/targeting_spec.js +34 -0
  313. package/test/spec/unit/pbjs_api_spec.js +124 -45
  314. package/test/spec/utils_spec.js +45 -1
@@ -13,13 +13,13 @@ import { deepAccess, deepSetValue, mergeDeep } from '../../../src/utils.js'
13
13
  import { config } from 'src/config.js'
14
14
 
15
15
  describe('permutiveRtdProvider', function () {
16
- before(function () {
16
+ beforeEach(function () {
17
17
  const data = getTargetingData()
18
18
  setLocalStorage(data)
19
19
  config.resetConfig()
20
20
  })
21
21
 
22
- after(function () {
22
+ afterEach(function () {
23
23
  const data = getTargetingData()
24
24
  removeLocalStorage(data)
25
25
  config.resetConfig()
@@ -317,6 +317,7 @@ describe('permutiveRtdProvider', function () {
317
317
  })
318
318
  }
319
319
  })
320
+
320
321
  it('sets segment targeting for Magnite', function () {
321
322
  const data = transformedTargeting()
322
323
  const adUnits = getAdUnits()
@@ -337,6 +338,38 @@ describe('permutiveRtdProvider', function () {
337
338
  })
338
339
  }
339
340
  })
341
+
342
+ it('sets segment targeting for Magnite video', function () {
343
+ const targetingData = getTargetingData()
344
+ targetingData._prubicons.push(321)
345
+
346
+ setLocalStorage(targetingData)
347
+
348
+ const data = transformedTargeting(targetingData)
349
+ const config = getConfig()
350
+
351
+ const adUnits = getAdUnits().filter(adUnit => adUnit.mediaTypes.video)
352
+ expect(adUnits).to.have.lengthOf(1)
353
+
354
+ initSegments({ adUnits }, callback, config)
355
+
356
+ function callback() {
357
+ adUnits.forEach(adUnit => {
358
+ adUnit.bids.forEach(bid => {
359
+ const { bidder, params } = bid
360
+
361
+ if (bidder === 'rubicon') {
362
+ expect(
363
+ deepAccess(params, 'visitor.permutive'),
364
+ 'Should map all targeting values to a string',
365
+ ).to.eql(data.rubicon.map(String))
366
+ expect(deepAccess(params, 'visitor.p_standard')).to.eql(data.ac)
367
+ }
368
+ })
369
+ })
370
+ }
371
+ })
372
+
340
373
  it('sets segment targeting for Ozone', function () {
341
374
  const data = transformedTargeting()
342
375
  const adUnits = getAdUnits()
@@ -516,9 +549,7 @@ function getConfig () {
516
549
  }
517
550
  }
518
551
 
519
- function transformedTargeting () {
520
- const data = getTargetingData()
521
-
552
+ function transformedTargeting (data = getTargetingData()) {
522
553
  return {
523
554
  ac: [...data._pcrprs, ...data._ppam, ...data._psegs.filter(seg => seg >= 1000000)],
524
555
  appnexus: data._papns,
@@ -640,6 +671,34 @@ function getAdUnits () {
640
671
  }
641
672
  }
642
673
  ]
674
+ },
675
+ {
676
+ code: 'myVideoAdUnit',
677
+ mediaTypes: {
678
+ video: {
679
+ context: 'instream',
680
+ playerSize: [640, 480],
681
+ mimes: ['video/mp4', 'video/x-ms-wmv'],
682
+ protocols: [2, 3, 5, 6],
683
+ api: [2],
684
+ maxduration: 30,
685
+ linearity: 1
686
+ }
687
+ },
688
+ bids: [{
689
+ bidder: 'rubicon',
690
+ params: {
691
+ accountId: '9840',
692
+ siteId: '123564',
693
+ zoneId: '583584',
694
+ video: {
695
+ language: 'en'
696
+ },
697
+ visitor: {
698
+ test_kv: ['true']
699
+ }
700
+ }
701
+ }]
643
702
  }
644
703
  ]
645
704
  }
@@ -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
  });
@@ -979,6 +979,20 @@ describe('triplelift adapter', function () {
979
979
  expect(url).to.match(new RegExp('(?:' + prebid.version + ')'))
980
980
  expect(url).to.match(/(?:referrer)/);
981
981
  });
982
+ it('should prioritize topmostLocation for referrer', function () {
983
+ bidderRequest.refererInfo.topmostLocation = 'https://topmostlocation.com?foo=bar'
984
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
985
+ const url = request.url;
986
+ expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Ftopmostlocation.com%3Ffoo%3Dbar/);
987
+ delete bidderRequest.refererInfo.topmostLocation
988
+ });
989
+ it('should fall back to page for referrer if topmostLocation is unavailable', function () {
990
+ bidderRequest.refererInfo.topmostLocation = null
991
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
992
+ const url = request.url;
993
+ expect(url).to.match(/(\?|&)referrer=https%3A%2F%2Fexamplereferer.com/);
994
+ delete bidderRequest.refererInfo.topmostLocation
995
+ });
982
996
  it('should return us_privacy param when CCPA info is available', function() {
983
997
  bidderRequest.uspConsent = '1YYY';
984
998
  const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);