prebid.js 9.4.0 → 9.5.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 (363) hide show
  1. package/.eslintrc.js +31 -5
  2. package/.github/workflows/jscpd.yml +2 -2
  3. package/.github/workflows/linter.yml +107 -0
  4. package/creative/crossDomain.js +6 -3
  5. package/dist/33acrossAnalyticsAdapter.js +1 -1
  6. package/dist/33acrossBidAdapter.js +1 -1
  7. package/dist/33acrossIdSystem.js +1 -1
  8. package/dist/BTBidAdapter.js +1 -1
  9. package/dist/adagioAnalyticsAdapter.js +1 -1
  10. package/dist/adagioBidAdapter.js +1 -1
  11. package/dist/adagioRtdProvider.js +1 -1
  12. package/dist/adagioUtils.js +1 -1
  13. package/dist/addefendBidAdapter.js +1 -1
  14. package/dist/adgenerationBidAdapter.js +1 -1
  15. package/dist/adkernelAdnBidAdapter.js +1 -1
  16. package/dist/adkernelBidAdapter.js +1 -1
  17. package/dist/adkernelUtils.js +1 -0
  18. package/dist/adlooxRtdProvider.js +1 -1
  19. package/dist/admixerBidAdapter.js +1 -1
  20. package/dist/adqueryBidAdapter.js +1 -1
  21. package/dist/adrelevantisBidAdapter.js +1 -1
  22. package/dist/adstirBidAdapter.js +1 -1
  23. package/dist/adtrgtmeBidAdapter.js +1 -1
  24. package/dist/advRedAnalyticsAdapter.js +1 -0
  25. package/dist/adxcgAnalyticsAdapter.js +1 -1
  26. package/dist/adxcgBidAdapter.js +1 -1
  27. package/dist/adyoulikeBidAdapter.js +1 -1
  28. package/dist/agmaAnalyticsAdapter.js +1 -1
  29. package/dist/ajaBidAdapter.js +1 -1
  30. package/dist/akamaiDapRtdProvider.js +1 -1
  31. package/dist/amxBidAdapter.js +1 -1
  32. package/dist/amxIdSystem.js +1 -1
  33. package/dist/anonymisedRtdProvider.js +1 -1
  34. package/dist/apacdexBidAdapter.js +1 -1
  35. package/dist/appierAnalyticsAdapter.js +1 -1
  36. package/dist/appnexusBidAdapter.js +1 -1
  37. package/dist/asoBidAdapter.js +1 -1
  38. package/dist/axonixBidAdapter.js +1 -1
  39. package/dist/azerionedgeRtdProvider.js +1 -1
  40. package/dist/bidglassBidAdapter.js +1 -1
  41. package/dist/big-richmediaBidAdapter.js +1 -1
  42. package/dist/bridBidAdapter.js +1 -1
  43. package/dist/bridgewellBidAdapter.js +1 -1
  44. package/dist/brightMountainMediaBidAdapter.js +1 -1
  45. package/dist/carodaBidAdapter.js +1 -1
  46. package/dist/chtnwBidAdapter.js +1 -1
  47. package/dist/chunk-core.js +1 -1
  48. package/dist/concertBidAdapter.js +1 -1
  49. package/dist/connatixBidAdapter.js +1 -1
  50. package/dist/connectadBidAdapter.js +1 -1
  51. package/dist/consumableBidAdapter.js +1 -1
  52. package/dist/contxtfulRtdProvider.js +1 -1
  53. package/dist/conversantAnalyticsAdapter.js +1 -1
  54. package/dist/conversantBidAdapter.js +1 -1
  55. package/dist/craftBidAdapter.js +1 -1
  56. package/dist/criteoBidAdapter.js +1 -1
  57. package/dist/currencyUtils.js +1 -1
  58. package/dist/cwireBidAdapter.js +1 -1
  59. package/dist/dailymotionBidAdapter.js +1 -1
  60. package/dist/debugging-standalone.js +1 -1
  61. package/dist/dependencies.json +43 -7
  62. package/dist/dfpAdServerVideo.js +1 -1
  63. package/dist/dfpAdpod.js +1 -1
  64. package/dist/dfpUtils.js +1 -1
  65. package/dist/discoveryBidAdapter.js +1 -1
  66. package/dist/dspxBidAdapter.js +1 -1
  67. package/dist/dxkultureBidAdapter.js +1 -1
  68. package/dist/eightPodAnalyticsAdapter.js +1 -1
  69. package/dist/eightPodBidAdapter.js +1 -1
  70. package/dist/eplanningBidAdapter.js +1 -1
  71. package/dist/euidIdSystem.js +1 -1
  72. package/dist/exadsBidAdapter.js +1 -1
  73. package/dist/feedadBidAdapter.js +1 -1
  74. package/dist/finativeBidAdapter.js +1 -1
  75. package/dist/fintezaAnalyticsAdapter.js +1 -1
  76. package/dist/fpdUtils.js +1 -0
  77. package/dist/freewheel-sspBidAdapter.js +1 -1
  78. package/dist/gmosspBidAdapter.js +1 -1
  79. package/dist/goldbachBidAdapter.js +1 -1
  80. package/dist/gptPreAuction.js +1 -1
  81. package/dist/gptUtils.js +1 -1
  82. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  83. package/dist/greenbidsRtdProvider.js +1 -1
  84. package/dist/gridBidAdapter.js +1 -1
  85. package/dist/growthCodeAnalyticsAdapter.js +1 -1
  86. package/dist/growthCodeRtdProvider.js +1 -1
  87. package/dist/gumgumBidAdapter.js +1 -1
  88. package/dist/h12mediaBidAdapter.js +1 -1
  89. package/dist/hypelabBidAdapter.js +1 -1
  90. package/dist/id5AnalyticsAdapter.js +1 -1
  91. package/dist/id5IdSystem.js +1 -1
  92. package/dist/imdsBidAdapter.js +1 -1
  93. package/dist/improvedigitalBidAdapter.js +1 -1
  94. package/dist/insticatorBidAdapter.js +1 -1
  95. package/dist/intentIqAnalyticsAdapter.js +1 -0
  96. package/dist/ixBidAdapter.js +1 -1
  97. package/dist/jixieBidAdapter.js +1 -1
  98. package/dist/justpremiumBidAdapter.js +1 -1
  99. package/dist/jwplayerBidAdapter.js +1 -1
  100. package/dist/jwplayerRtdProvider.js +1 -1
  101. package/dist/kargoBidAdapter.js +1 -1
  102. package/dist/kimberliteBidAdapter.js +1 -1
  103. package/dist/konduitAnalyticsAdapter.js +1 -1
  104. package/dist/kueezBidAdapter.js +1 -1
  105. package/dist/lassoBidAdapter.js +1 -1
  106. package/dist/lifestreetBidAdapter.js +1 -1
  107. package/dist/liveIntentIdSystem.js +1 -1
  108. package/dist/logicadBidAdapter.js +1 -1
  109. package/dist/loglyliftBidAdapter.js +1 -1
  110. package/dist/luceadBidAdapter.js +1 -1
  111. package/dist/mabidderBidAdapter.js +1 -1
  112. package/dist/magniteAnalyticsAdapter.js +1 -1
  113. package/dist/malltvAnalyticsAdapter.js +1 -1
  114. package/dist/marsmediaBidAdapter.js +1 -1
  115. package/dist/mediafuseBidAdapter.js +1 -1
  116. package/dist/mediagoBidAdapter.js +1 -1
  117. package/dist/medianetAnalyticsAdapter.js +1 -1
  118. package/dist/medianetBidAdapter.js +1 -1
  119. package/dist/mediasquareBidAdapter.js +1 -1
  120. package/dist/mgidBidAdapter.js +1 -1
  121. package/dist/minutemediaBidAdapter.js +1 -1
  122. package/dist/missenaBidAdapter.js +1 -1
  123. package/dist/mobianRtdProvider.js +1 -1
  124. package/dist/nextMillenniumBidAdapter.js +1 -1
  125. package/dist/nexx360BidAdapter.js +1 -1
  126. package/dist/nobidAnalyticsAdapter.js +1 -1
  127. package/dist/nobidBidAdapter.js +1 -1
  128. package/dist/not-for-prod/prebid.js +201 -193
  129. package/dist/oguryBidAdapter.js +1 -1
  130. package/dist/onetagBidAdapter.js +1 -1
  131. package/dist/ooloAnalyticsAdapter.js +1 -1
  132. package/dist/openwebBidAdapter.js +1 -1
  133. package/dist/openxBidAdapter.js +1 -1
  134. package/dist/optidigitalBidAdapter.js +1 -1
  135. package/dist/optoutBidAdapter.js +1 -1
  136. package/dist/orbidderBidAdapter.js +1 -1
  137. package/dist/outbrainBidAdapter.js +1 -1
  138. package/dist/paapi.js +1 -1
  139. package/dist/permutiveRtdProvider.js +1 -1
  140. package/dist/pixfutureBidAdapter.js +1 -1
  141. package/dist/playdigoBidAdapter.js +1 -1
  142. package/dist/prebidServerBidAdapter.js +1 -1
  143. package/dist/programmaticaBidAdapter.js +1 -1
  144. package/dist/publinkIdSystem.js +1 -1
  145. package/dist/publirBidAdapter.js +1 -1
  146. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  147. package/dist/pubmaticBidAdapter.js +1 -1
  148. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  149. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  150. package/dist/pxyzBidAdapter.js +1 -1
  151. package/dist/quantcastBidAdapter.js +1 -1
  152. package/dist/readpeakBidAdapter.js +1 -1
  153. package/dist/relaidoBidAdapter.js +1 -1
  154. package/dist/relevatehealthBidAdapter.js +1 -1
  155. package/dist/retailspotBidAdapter.js +1 -1
  156. package/dist/rhythmoneBidAdapter.js +1 -1
  157. package/dist/ringieraxelspringerBidAdapter.js +1 -1
  158. package/dist/riseBidAdapter.js +1 -1
  159. package/dist/rubiconBidAdapter.js +1 -1
  160. package/dist/schainSerializer.js +1 -0
  161. package/dist/seedingAllianceBidAdapter.js +1 -1
  162. package/dist/seedtagBidAdapter.js +1 -1
  163. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  164. package/dist/sharethroughBidAdapter.js +1 -1
  165. package/dist/shinezBidAdapter.js +1 -1
  166. package/dist/sizeMapping.js +1 -1
  167. package/dist/sizeUtils.js +1 -1
  168. package/dist/smaatoBidAdapter.js +1 -1
  169. package/dist/smartadserverBidAdapter.js +1 -1
  170. package/dist/smartxBidAdapter.js +1 -1
  171. package/dist/smilewantedBidAdapter.js +1 -1
  172. package/dist/snigelBidAdapter.js +1 -1
  173. package/dist/sonobiBidAdapter.js +1 -1
  174. package/dist/sovrnBidAdapter.js +1 -1
  175. package/dist/sspBCBidAdapter.js +1 -1
  176. package/dist/stnBidAdapter.js +1 -1
  177. package/dist/stvBidAdapter.js +1 -1
  178. package/dist/sublimeBidAdapter.js +1 -1
  179. package/dist/symitriDapRtdProvider.js +1 -0
  180. package/dist/taboolaBidAdapter.js +1 -1
  181. package/dist/tappxBidAdapter.js +1 -1
  182. package/dist/targetVideoBidAdapter.js +1 -1
  183. package/dist/targetVideoUtils.js +1 -0
  184. package/dist/teadsBidAdapter.js +1 -1
  185. package/dist/terceptAnalyticsAdapter.js +1 -1
  186. package/dist/themoneytizerBidAdapter.js +1 -1
  187. package/dist/trionBidAdapter.js +1 -1
  188. package/dist/tripleliftBidAdapter.js +1 -1
  189. package/dist/ttdBidAdapter.js +1 -1
  190. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  191. package/dist/uid2IdSystem.js +1 -1
  192. package/dist/underdogmediaBidAdapter.js +1 -1
  193. package/dist/undertoneBidAdapter.js +1 -1
  194. package/dist/unrulyBidAdapter.js +1 -1
  195. package/dist/userAgentUtils.js +1 -0
  196. package/dist/utiqIdSystem.js +1 -1
  197. package/dist/vidazooUtils.js +1 -1
  198. package/dist/videobyteBidAdapter.js +1 -1
  199. package/dist/visxBidAdapter.js +1 -1
  200. package/dist/vuukleBidAdapter.js +1 -1
  201. package/dist/widespaceBidAdapter.js +1 -1
  202. package/dist/winrBidAdapter.js +1 -1
  203. package/dist/yahooAdsBidAdapter.js +1 -1
  204. package/dist/yandexIdSystem.js +1 -1
  205. package/dist/yieldmoBidAdapter.js +1 -1
  206. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  207. package/integrationExamples/gpt/x-domain/creative.html +1 -1
  208. package/libraries/adkernelUtils/adkernelUtils.js +11 -0
  209. package/libraries/currencyUtils/floor.js +23 -0
  210. package/libraries/dfpUtils/dfpUtils.js +7 -0
  211. package/libraries/fpdUtils/deviceInfo.js +58 -0
  212. package/libraries/fpdUtils/pageInfo.js +73 -0
  213. package/libraries/gptUtils/gptUtils.js +23 -1
  214. package/libraries/schainSerializer/schainSerializer.js +24 -0
  215. package/libraries/sizeUtils/tranformSize.js +43 -0
  216. package/libraries/targetVideoUtils/bidderUtils.js +178 -0
  217. package/libraries/targetVideoUtils/constants.js +23 -0
  218. package/libraries/userAgentUtils/index.js +58 -0
  219. package/libraries/userAgentUtils/userAgentTypes.enums.js +22 -0
  220. package/modules/.submodules.json +1 -0
  221. package/modules/33acrossAnalyticsAdapter.js +2 -0
  222. package/modules/adagioBidAdapter.js +1 -1
  223. package/modules/adagioRtdProvider.js +18 -4
  224. package/modules/adkernelAdnBidAdapter.js +1 -12
  225. package/modules/adkernelBidAdapter.js +4 -13
  226. package/modules/adlooxAnalyticsAdapter.js +1 -0
  227. package/modules/admixerBidAdapter.js +10 -6
  228. package/modules/admixerBidAdapter.md +7 -10
  229. package/modules/adtrgtmeBidAdapter.js +1 -1
  230. package/modules/advRedAnalyticsAdapter.js +198 -0
  231. package/modules/advRedAnalyticsAdapter.md +30 -0
  232. package/modules/akamaiDapRtdProvider.js +19 -798
  233. package/modules/anonymisedRtdProvider.js +5 -1
  234. package/modules/anonymisedRtdProvider.md +1 -1
  235. package/modules/apacdexBidAdapter.js +1 -1
  236. package/modules/appnexusBidAdapter.js +56 -2
  237. package/modules/automatadAnalyticsAdapter.js +2 -0
  238. package/modules/azerionedgeRtdProvider.js +13 -3
  239. package/modules/azerionedgeRtdProvider.md +0 -17
  240. package/modules/bridBidAdapter.js +47 -47
  241. package/modules/cleanioRtdProvider.js +1 -0
  242. package/modules/concertBidAdapter.js +1 -1
  243. package/modules/connatixBidAdapter.js +36 -8
  244. package/modules/connectIdSystem.js +3 -1
  245. package/modules/contxtfulRtdProvider.js +20 -2
  246. package/modules/contxtfulRtdProvider.md +1 -0
  247. package/modules/craftBidAdapter.js +1 -1
  248. package/modules/criteoBidAdapter.js +1 -1
  249. package/modules/cwireBidAdapter.js +5 -1
  250. package/modules/dailymotionBidAdapter.js +85 -65
  251. package/modules/debugging/debugging.js +3 -0
  252. package/modules/dfpAdServerVideo.js +15 -33
  253. package/modules/dfpAdpod.js +2 -6
  254. package/modules/dgkeywordRtdProvider.js +2 -0
  255. package/modules/discoveryBidAdapter.js +26 -210
  256. package/modules/dspxBidAdapter.js +176 -54
  257. package/modules/eightPodAnalyticsAdapter.js +28 -34
  258. package/modules/eightPodBidAdapter.js +113 -57
  259. package/modules/fintezaAnalyticsAdapter.js +9 -4
  260. package/modules/goldbachBidAdapter.js +1 -1
  261. package/modules/gptPreAuction.js +63 -4
  262. package/modules/growthCodeAnalyticsAdapter.js +1 -1
  263. package/modules/growthCodeRtdProvider.js +1 -1
  264. package/modules/gumgumBidAdapter.js +14 -10
  265. package/modules/improvedigitalBidAdapter.js +1 -1
  266. package/modules/intentIqAnalyticsAdapter.js +234 -0
  267. package/modules/intentIqAnalyticsAdapter.md +27 -0
  268. package/modules/intentIqIdSystem.md +0 -0
  269. package/modules/jwplayerBidAdapter.js +1 -1
  270. package/modules/jwplayerRtdProvider.js +26 -6
  271. package/modules/jwplayerVideoProvider.js +6 -0
  272. package/modules/mediafuseBidAdapter.js +1 -1
  273. package/modules/mediagoBidAdapter.js +7 -176
  274. package/modules/medianetBidAdapter.js +101 -40
  275. package/modules/mgidBidAdapter.js +3 -1
  276. package/modules/mobianRtdProvider.js +16 -2
  277. package/modules/nextMillenniumBidAdapter.js +1 -27
  278. package/modules/nobidBidAdapter.js +1 -1
  279. package/modules/optoutBidAdapter.js +1 -1
  280. package/modules/paapi.js +48 -35
  281. package/modules/permutiveRtdProvider.js +72 -22
  282. package/modules/playdigoBidAdapter.js +4 -2
  283. package/modules/prebidServerBidAdapter/index.js +4 -2
  284. package/modules/prebidServerBidAdapter/ortbConverter.js +1 -0
  285. package/modules/programmaticaBidAdapter.js +1 -1
  286. package/modules/pubmaticBidAdapter.js +12 -0
  287. package/modules/pubxaiAnalyticsAdapter.js +306 -164
  288. package/modules/relevatehealthBidAdapter.js +2 -1
  289. package/modules/richaudienceBidAdapter.js +1 -1
  290. package/modules/rtdModule/index.js +5 -3
  291. package/modules/sirdataRtdProvider.js +2 -0
  292. package/modules/sizeMapping.js +2 -5
  293. package/modules/smaatoBidAdapter.js +18 -1
  294. package/modules/smilewantedBidAdapter.js +26 -22
  295. package/modules/snigelBidAdapter.js +1 -1
  296. package/modules/sonobiBidAdapter.js +5 -10
  297. package/modules/symitriDapRtdProvider.js +812 -0
  298. package/modules/symitriDapRtdProvider.md +49 -0
  299. package/modules/targetVideoBidAdapter.js +120 -152
  300. package/modules/targetVideoBidAdapter.md +20 -3
  301. package/modules/userId/eids.js +3 -0
  302. package/modules/utiqIdSystem.js +12 -10
  303. package/modules/validationFpdModule/index.js +22 -17
  304. package/modules/videojsVideoProvider.js +3 -0
  305. package/modules/visxBidAdapter.js +1 -1
  306. package/modules/winrBidAdapter.js +2 -27
  307. package/modules/yahooAdsBidAdapter.js +1 -1
  308. package/modules/yandexIdSystem.js +1 -1
  309. package/package.json +4 -4
  310. package/plugins/eslint/index.js +73 -45
  311. package/src/adRendering.js +7 -3
  312. package/src/adloader.js +1 -0
  313. package/src/ajax.js +15 -0
  314. package/src/config.js +0 -4
  315. package/src/debugging.js +1 -0
  316. package/src/secureCreatives.js +1 -1
  317. package/src/storageManager.js +62 -73
  318. package/src/targeting.js +26 -20
  319. package/src/utils.js +9 -0
  320. package/test/pages/banner_sync.html +97 -0
  321. package/test/pages/consent_mgt_gdpr.html +1 -1
  322. package/test/spec/ajax_spec.js +11 -0
  323. package/test/spec/creative/crossDomainCreative_spec.js +26 -9
  324. package/test/spec/e2e/banner/basic_banner_ad.spec.js +20 -14
  325. package/test/spec/fpd/gdpr_spec.js +1 -1
  326. package/test/spec/libraries/userAgentUtils_spec.js +109 -0
  327. package/test/spec/modules/adagioRtdProvider_spec.js +72 -0
  328. package/test/spec/modules/admixerBidAdapter_spec.js +21 -17
  329. package/test/spec/modules/advRedAnalyticsAdapter_spec.js +114 -0
  330. package/test/spec/modules/adxcgBidAdapter_spec.js +1 -1
  331. package/test/spec/modules/appnexusBidAdapter_spec.js +36 -0
  332. package/test/spec/modules/azerionedgeRtdProvider_spec.js +36 -21
  333. package/test/spec/modules/connatixBidAdapter_spec.js +55 -2
  334. package/test/spec/modules/consentManagement_spec.js +1 -1
  335. package/test/spec/modules/contxtfulRtdProvider_spec.js +6 -0
  336. package/test/spec/modules/dailymotionBidAdapter_spec.js +497 -4
  337. package/test/spec/modules/discoveryBidAdapter_spec.js +9 -6
  338. package/test/spec/modules/dspxBidAdapter_spec.js +188 -7
  339. package/test/spec/modules/eightPodAnalyticsAdapter_spec.js +22 -13
  340. package/test/spec/modules/gptPreAuction_spec.js +143 -1
  341. package/test/spec/modules/gumgumBidAdapter_spec.js +17 -0
  342. package/test/spec/modules/intentIqAnalyticsAdapter_spec.js +172 -0
  343. package/test/spec/modules/jwplayerRtdProvider_spec.js +61 -0
  344. package/test/spec/modules/mediagoBidAdapter_spec.js +34 -37
  345. package/test/spec/modules/medianetBidAdapter_spec.js +297 -16
  346. package/test/spec/modules/mgidBidAdapter_spec.js +15 -5
  347. package/test/spec/modules/mobianRtdProvider_spec.js +1 -3
  348. package/test/spec/modules/paapi_spec.js +177 -111
  349. package/test/spec/modules/permutiveRtdProvider_spec.js +42 -8
  350. package/test/spec/modules/prebidServerBidAdapter_spec.js +17 -3
  351. package/test/spec/modules/proxistoreBidAdapter_spec.js +1 -1
  352. package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
  353. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +970 -603
  354. package/test/spec/modules/pulsepointBidAdapter_spec.js +4 -4
  355. package/test/spec/modules/smaatoBidAdapter_spec.js +36 -1
  356. package/test/spec/modules/smilewantedBidAdapter_spec.js +57 -1
  357. package/test/spec/modules/symitriDapRtdProvider_spec.js +600 -0
  358. package/test/spec/modules/targetVideoBidAdapter_spec.js +112 -11
  359. package/test/spec/modules/yandexIdSystem_spec.js +6 -1
  360. package/test/spec/schainSerializer/schainSerializer_spec.js +138 -0
  361. package/test/spec/unit/core/storageManager_spec.js +68 -51
  362. package/test/spec/utils_spec.js +19 -0
  363. /package/src/utils/{gpdr.js → gdpr.js} +0 -0
@@ -1,27 +1,42 @@
1
1
  import { spec } from '../../../modules/targetVideoBidAdapter.js'
2
2
 
3
3
  describe('TargetVideo Bid Adapter', function() {
4
+ const bidder = 'targetVideo';
5
+ const params = {
6
+ placementId: 12345,
7
+ };
8
+
4
9
  const bannerRequest = [{
5
- bidder: 'targetVideo',
10
+ bidder,
11
+ params,
6
12
  mediaTypes: {
7
13
  banner: {
8
14
  sizes: [[300, 250]],
9
15
  }
10
16
  },
11
- params: {
12
- placementId: 12345,
17
+ }];
18
+
19
+ const videoRequest = [{
20
+ bidder,
21
+ params,
22
+ mediaTypes: {
23
+ video: {
24
+ playerSize: [[640, 360]],
25
+ context: 'instream',
26
+ playbackmethod: [1, 2, 3, 4]
27
+ }
13
28
  }
14
29
  }];
15
30
 
16
31
  it('Test the bid validation function', function() {
17
- const validBid = spec.isBidRequestValid(bannerRequest[0]);
32
+ const validBid = spec.isBidRequestValid(bannerRequest[0]) && spec.isBidRequestValid(videoRequest[0]);
18
33
  const invalidBid = spec.isBidRequestValid(null);
19
34
 
20
35
  expect(validBid).to.be.true;
21
36
  expect(invalidBid).to.be.false;
22
37
  });
23
38
 
24
- it('Test the request processing function', function () {
39
+ it('Test the BANNER request processing function', function() {
25
40
  const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
26
41
  expect(request).to.not.be.empty;
27
42
 
@@ -36,7 +51,20 @@ describe('TargetVideo Bid Adapter', function() {
36
51
  expect(payload.tags[0].ad_types[0]).to.equal('video');
37
52
  });
38
53
 
39
- it('Handle nobid responses', function () {
54
+ it('Test the VIDEO request processing function', function() {
55
+ const request = spec.buildRequests(videoRequest, videoRequest[0]);
56
+ expect(request).to.not.be.empty;
57
+
58
+ const payload = JSON.parse(request[0].data);
59
+ expect(payload).to.not.be.empty;
60
+ expect(payload.sdk).to.deep.equal({
61
+ source: 'pbjs',
62
+ version: '$prebid.version$'
63
+ });
64
+ expect(payload.imp[0].ext.prebid.storedrequest.id).to.equal(12345);
65
+ })
66
+
67
+ it('Handle BANNER nobid responses', function() {
40
68
  const responseBody = {
41
69
  'version': '0.0.1',
42
70
  'tags': [{
@@ -48,11 +76,24 @@ describe('TargetVideo Bid Adapter', function() {
48
76
  };
49
77
  const bidderRequest = null;
50
78
 
51
- const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
79
+ const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
52
80
  expect(bidResponse.length).to.equal(0);
53
81
  });
54
82
 
55
- it('Test the response parsing function', function () {
83
+ it('Handle VIDEO nobid responses', function() {
84
+ const responseBody = {
85
+ 'id': 'test-id',
86
+ 'cur': 'USD',
87
+ 'seatbid': [],
88
+ 'nbr': 0
89
+ };
90
+ const bidderRequest = null;
91
+
92
+ const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
93
+ expect(bidResponse.length).to.equal(0);
94
+ })
95
+
96
+ it('Test the BANNER response parsing function', function() {
56
97
  const responseBody = {
57
98
  'tags': [{
58
99
  'uuid': '84ab500420319d',
@@ -82,7 +123,7 @@ describe('TargetVideo Bid Adapter', function() {
82
123
  }]
83
124
  };
84
125
 
85
- const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
126
+ const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
86
127
  expect(bidResponse).to.not.be.empty;
87
128
 
88
129
  const bid = bidResponse[0];
@@ -94,7 +135,43 @@ describe('TargetVideo Bid Adapter', function() {
94
135
  expect(bid.ad).to.include('initPlayer')
95
136
  });
96
137
 
97
- it('Test GDPR consent information is present in the request', function () {
138
+ it('Test the VIDEO response parsing function', function() {
139
+ const responseBody = {
140
+ 'id': 'test-id',
141
+ 'cur': 'USD',
142
+ 'seatbid': [{
143
+ 'bid': [{
144
+ 'id': '5044997188309660254',
145
+ 'price': 10,
146
+ 'adm': 'test ad',
147
+ 'adid': '97517771',
148
+ 'crid': '97517771',
149
+ 'adomain': ['domain.com'],
150
+ 'w': 640,
151
+ 'h': 480
152
+ }],
153
+ 'seat': 'bidder'
154
+ }]
155
+ };
156
+ const bidderRequest = {
157
+ bidderCode: 'brid',
158
+ bidderRequestId: '22edbae2733bf6',
159
+ bids: videoRequest
160
+ };
161
+
162
+ const bidResponse = spec.interpretResponse({ body: responseBody }, { bidderRequest });
163
+ expect(bidResponse).to.not.be.empty;
164
+
165
+ const bid = bidResponse[0];
166
+ expect(bid).to.not.be.empty;
167
+ expect(bid.ad).to.equal('test ad');
168
+ expect(bid.cpm).to.equal(10);
169
+ expect(bid.width).to.equal(640);
170
+ expect(bid.height).to.equal(480);
171
+ expect(bid.currency).to.equal('USD');
172
+ })
173
+
174
+ it('Test BANNER GDPR consent information is present in the request', function() {
98
175
  let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
99
176
  let bidderRequest = {
100
177
  'bidderCode': 'targetVideo',
@@ -119,7 +196,7 @@ describe('TargetVideo Bid Adapter', function() {
119
196
  expect(payload.gdpr_consent.addtl_consent).to.exist.and.to.deep.equal([7, 12, 35, 62, 66, 70, 89, 93, 108]);
120
197
  });
121
198
 
122
- it('Test US Privacy string is present in the request', function() {
199
+ it('Test BANNER US Privacy string is present in the request', function() {
123
200
  let consentString = '1YA-';
124
201
  let bidderRequest = {
125
202
  'bidderCode': 'targetVideo',
@@ -136,4 +213,28 @@ describe('TargetVideo Bid Adapter', function() {
136
213
  expect(payload.us_privacy).to.exist;
137
214
  expect(payload.us_privacy).to.exist.and.to.equal(consentString);
138
215
  });
216
+
217
+ it('Test VIDEO GDPR and USP consents are present in the request', function() {
218
+ let gdprConsentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
219
+ let uspConsentString = '1YA-';
220
+ let bidderRequest = {
221
+ 'bidderCode': 'targetVideo',
222
+ 'bidderRequestId': '22edbae2733bf6',
223
+ 'timeout': 3000,
224
+ 'uspConsent': uspConsentString,
225
+ 'gdprConsent': {
226
+ consentString: gdprConsentString,
227
+ gdprApplies: true,
228
+ addtlConsent: '1~7.12.35.62.66.70.89.93.108'
229
+ }
230
+ };
231
+ bidderRequest.bids = videoRequest;
232
+
233
+ const request = spec.buildRequests(videoRequest, bidderRequest);
234
+ const payload = JSON.parse(request[0].data);
235
+
236
+ expect(payload.user.ext.consent).to.equal(gdprConsentString);
237
+ expect(payload.regs.ext.us_privacy).to.equal(uspConsentString);
238
+ expect(payload.regs.ext.gdpr).to.equal(1);
239
+ });
139
240
  });
@@ -110,12 +110,17 @@ describe('YandexId module', () => {
110
110
 
111
111
  describe('crypto', () => {
112
112
  it('uses Math.random when crypto is not available', () => {
113
- sandbox.stub(window, 'crypto').value(undefined);
113
+ const cryptoTmp = window.crypto;
114
+
115
+ // @ts-expect-error -- Crypto is always defined in modern JS. TS yells when trying to delete non-nullable property.
116
+ delete window.crypto;
114
117
 
115
118
  yandexIdSubmodule.getId(CORRECT_SUBMODULE_CONFIG);
116
119
 
117
120
  expect(randomStub.calledOnce).to.be.true;
118
121
  expect(getCryptoRandomValuesStub.called).to.be.false;
122
+
123
+ window.crypto = cryptoTmp;
119
124
  });
120
125
 
121
126
  it('uses crypto when it is available', () => {
@@ -0,0 +1,138 @@
1
+ import {serializeSupplyChain} from '../../../libraries/schainSerializer/schainSerializer.js'
2
+ describe('serializeSupplyChain', () => {
3
+ describe('Single Hop - Chain Complete', () => {
4
+ it('should serialize a single hop chain with complete information', () => {
5
+ const schain = {
6
+ ver: '1.0',
7
+ complete: 1,
8
+ nodes: [
9
+ {
10
+ asi: 'exchange1.com',
11
+ sid: '1234',
12
+ hp: 1,
13
+ rid: 'bid-request-1',
14
+ name: 'publisher',
15
+ domain: 'publisher.com'
16
+ }
17
+ ]
18
+ };
19
+ const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
20
+ const expectedResult = '1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com';
21
+ expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
22
+ });
23
+ });
24
+
25
+ describe('Single Hop - Chain Complete, optional fields missing', () => {
26
+ it('should serialize a single hop chain with missing optional fields', () => {
27
+ const schain = {
28
+ ver: '1.0',
29
+ complete: 1,
30
+ nodes: [
31
+ {
32
+ asi: 'exchange1.com',
33
+ sid: '1234',
34
+ hp: 1
35
+ }
36
+ ]
37
+ };
38
+ const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
39
+ const expectedResult = '1.0,1!exchange1.com,1234,1,,,';
40
+ expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
41
+ });
42
+ });
43
+
44
+ describe('Multiple Hops - With all properties supplied', () => {
45
+ it('should serialize multiple hops with all properties supplied', () => {
46
+ const schain = {
47
+ ver: '1.0',
48
+ complete: 1,
49
+ nodes: [
50
+ {
51
+ asi: 'exchange1.com',
52
+ sid: '1234',
53
+ hp: 1,
54
+ rid: 'bid-request-1',
55
+ name: 'publisher',
56
+ domain: 'publisher.com'
57
+ },
58
+ {
59
+ asi: 'exchange2.com',
60
+ sid: 'abcd',
61
+ hp: 1,
62
+ rid: 'bid-request-2',
63
+ name: 'intermediary',
64
+ domain: 'intermediary.com'
65
+ }
66
+ ]
67
+ };
68
+ const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
69
+ const expectedResult = '1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com!exchange2.com,abcd,1,bid-request-2,intermediary,intermediary.com';
70
+ expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
71
+ });
72
+ });
73
+
74
+ describe('Multiple Hops - Chain Complete, optional fields missing', () => {
75
+ it('should serialize multiple hops with missing optional fields', () => {
76
+ const schain = {
77
+ ver: '1.0',
78
+ complete: 1,
79
+ nodes: [
80
+ {
81
+ asi: 'exchange1.com',
82
+ sid: '1234',
83
+ hp: 1
84
+ },
85
+ {
86
+ asi: 'exchange2.com',
87
+ sid: 'abcd',
88
+ hp: 1
89
+ }
90
+ ]
91
+ };
92
+ const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
93
+ const expectedResult = '1.0,1!exchange1.com,1234,1,,,!exchange2.com,abcd,1,,,';
94
+ expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
95
+ });
96
+ });
97
+
98
+ describe('Multiple Hops Expected - Chain Incomplete', () => {
99
+ it('should serialize multiple hops with chain incomplete', () => {
100
+ const schain = {
101
+ ver: '1.0',
102
+ complete: 0,
103
+ nodes: [
104
+ {
105
+ asi: 'exchange2.com',
106
+ sid: 'abcd',
107
+ hp: 1
108
+ }
109
+ ]
110
+ };
111
+ const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
112
+ const expectedResult = '1.0,0!exchange2.com,abcd,1,,,';
113
+ expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
114
+ });
115
+ });
116
+
117
+ describe('Single Hop - Chain Complete, encoded values', () => {
118
+ it('should serialize a single hop chain with encoded values', () => {
119
+ const schain = {
120
+ ver: '1.0',
121
+ complete: 1,
122
+ nodes: [
123
+ {
124
+ asi: 'exchange1.com',
125
+ sid: '1234!abcd',
126
+ hp: 1,
127
+ rid: 'bid-request-1',
128
+ name: 'publisher, Inc.',
129
+ domain: 'publisher.com'
130
+ }
131
+ ]
132
+ };
133
+ const nodesProperties = ['asi', 'sid', 'hp', 'rid', 'name', 'domain'];
134
+ const expectedResult = '1.0,1!exchange1.com,1234%21abcd,1,bid-request-1,publisher%2C%20Inc.,publisher.com';
135
+ expect(serializeSupplyChain(schain, nodesProperties)).to.equal(expectedResult);
136
+ });
137
+ });
138
+ });
@@ -26,15 +26,15 @@ describe('storage manager', function() {
26
26
  hook.ready();
27
27
  });
28
28
 
29
- beforeEach(function() {
29
+ beforeEach(function () {
30
30
  resetData();
31
31
  });
32
32
 
33
- afterEach(function() {
33
+ afterEach(function () {
34
34
  config.resetConfig();
35
35
  })
36
36
 
37
- it('should allow to set cookie for core modules without checking gdpr enforcements', function() {
37
+ it('should allow to set cookie for core modules without checking gdpr enforcements', function () {
38
38
  const coreStorage = getCoreStorageManager();
39
39
  let date = new Date();
40
40
  date.setTime(date.getTime() + (24 * 60 * 60 * 1000));
@@ -43,7 +43,7 @@ describe('storage manager', function() {
43
43
  expect(coreStorage.getCookie('hello')).to.equal('world');
44
44
  });
45
45
 
46
- it('should add done callbacks to storageCallbacks array', function() {
46
+ it('should add done callbacks to storageCallbacks array', function () {
47
47
  let noop = sinon.spy();
48
48
  const coreStorage = newStorageManager();
49
49
 
@@ -55,11 +55,15 @@ describe('storage manager', function() {
55
55
  coreStorage.getDataFromLocalStorage('foo', noop);
56
56
  coreStorage.removeDataFromLocalStorage('foo', noop);
57
57
  coreStorage.hasLocalStorage(noop);
58
+ coreStorage.setDataInSessionStorage('foo', 'bar', noop);
59
+ coreStorage.getDataFromSessionStorage('foo', noop);
60
+ coreStorage.removeDataFromSessionStorage('foo', noop);
61
+ coreStorage.hasSessionStorage(noop);
58
62
 
59
- expect(storageCallbacks.length).to.equal(8);
63
+ expect(storageCallbacks.length).to.equal(12);
60
64
  });
61
65
 
62
- it('should allow bidder to access device if gdpr enforcement module is not included', function() {
66
+ it('should allow bidder to access device if gdpr enforcement module is not included', function () {
63
67
  let deviceAccessSpy = sinon.spy(utils, 'hasDeviceAccess');
64
68
  const storage = newStorageManager();
65
69
  storage.setCookie('foo1', 'baz1');
@@ -87,12 +91,16 @@ describe('storage manager', function() {
87
91
  }));
88
92
  });
89
93
 
90
- it('should deny access if activity is denied', () => {
91
- isAllowed.returns(false);
92
- const mgr = mkManager(MODULE_TYPE_PREBID, 'mockMod');
93
- mgr.setDataInLocalStorage('testKey', 'val');
94
- expect(mgr.getDataFromLocalStorage('testKey')).to.not.exist;
95
- });
94
+ ['Local', 'Session'].forEach(type => {
95
+ describe(`${type} storage`, () => {
96
+ it('should deny access if activity is denied', () => {
97
+ isAllowed.returns(false);
98
+ const mgr = mkManager(MODULE_TYPE_PREBID, 'mockMod');
99
+ mgr[`setDataIn${type}Storage`]('testKey', 'val');
100
+ expect(mgr[`getDataFrom${type}Storage`]('testKey')).to.not.exist;
101
+ });
102
+ })
103
+ })
96
104
 
97
105
  it('should use bidder aliases when possible', () => {
98
106
  adapterManager.registerBidAdapter({callBids: sinon.stub(), getSpec: () => ({})}, 'mockBidder');
@@ -103,57 +111,66 @@ describe('storage manager', function() {
103
111
  [ACTIVITY_PARAM_COMPONENT_NAME]: 'mockAlias'
104
112
  }))
105
113
  })
106
- })
107
-
108
- describe('localstorage forbidden access in 3rd-party context', function() {
109
- let errorLogSpy;
110
- let originalLocalStorage;
111
- const localStorageMock = { get: () => { throw Error } };
114
+ });
112
115
 
113
- beforeEach(function() {
114
- originalLocalStorage = window.localStorage;
115
- Object.defineProperty(window, 'localStorage', localStorageMock);
116
- errorLogSpy = sinon.spy(utils, 'logError');
117
- });
116
+ ['localStorage', 'sessionStorage'].forEach(storage => {
117
+ const Storage = storage.charAt(0).toUpperCase() + storage.substring(1);
118
118
 
119
- afterEach(function() {
120
- Object.defineProperty(window, 'localStorage', { get: () => originalLocalStorage });
121
- errorLogSpy.restore();
122
- })
119
+ describe(`${storage} forbidden access in 3rd-party context`, function () {
120
+ let errorLogSpy;
121
+ let originalStorage;
122
+ const storageMock = {
123
+ get: () => {
124
+ throw Error
125
+ }
126
+ };
123
127
 
124
- it('should not throw if the localstorage is not accessible when setting/getting/removing from localstorage', function() {
125
- const coreStorage = newStorageManager();
128
+ beforeEach(function () {
129
+ originalStorage = window[storage];
130
+ Object.defineProperty(window, storage, storageMock);
131
+ errorLogSpy = sinon.spy(utils, 'logError');
132
+ });
126
133
 
127
- coreStorage.setDataInLocalStorage('key', 'value');
128
- const val = coreStorage.getDataFromLocalStorage('key');
129
- coreStorage.removeDataFromLocalStorage('key');
134
+ afterEach(function () {
135
+ Object.defineProperty(window, storage, {get: () => originalStorage});
136
+ errorLogSpy.restore();
137
+ })
130
138
 
131
- expect(val).to.be.null;
132
- sinon.assert.calledThrice(errorLogSpy);
133
- })
134
- })
139
+ it('should not throw if storage is not accessible when setting/getting/removing', function () {
140
+ const coreStorage = newStorageManager();
135
141
 
136
- describe('localstorage is enabled', function() {
137
- let localStorage;
142
+ coreStorage[`setDataIn${Storage}`]('key', 'value');
143
+ const val = coreStorage[`getDataFrom${Storage}`]('key');
144
+ coreStorage[`removeDataFrom${Storage}`]('key');
138
145
 
139
- beforeEach(function() {
140
- localStorage = window.localStorage;
141
- localStorage.clear();
146
+ expect(val).to.be.null;
147
+ sinon.assert.calledThrice(errorLogSpy);
148
+ });
142
149
  });
150
+ });
143
151
 
144
- afterEach(function() {
145
- localStorage.clear();
146
- })
152
+ ['localStorage', 'sessionStorage'].forEach(storage => {
153
+ describe(`${storage} is enabled`, function () {
154
+ let store;
155
+ beforeEach(function () {
156
+ store = window[storage];
157
+ store.clear();
158
+ });
147
159
 
148
- it('should remove side-effect after checking', function () {
149
- const storage = newStorageManager();
160
+ afterEach(function () {
161
+ store.clear();
162
+ })
150
163
 
151
- localStorage.setItem('unrelated', 'dummy');
152
- const val = storage.localStorageIsEnabled();
164
+ it('should remove side-effect after checking', function () {
165
+ const storageMgr = newStorageManager();
153
166
 
154
- expect(val).to.be.true;
155
- expect(localStorage.length).to.be.eq(1);
156
- expect(localStorage.getItem('unrelated')).to.be.eq('dummy');
167
+ store.setItem('unrelated', 'dummy');
168
+ const val = storageMgr[`${storage}IsEnabled`]();
169
+
170
+ expect(val).to.be.true;
171
+ expect(store.length).to.be.eq(1);
172
+ expect(store.getItem('unrelated')).to.be.eq('dummy');
173
+ });
157
174
  });
158
175
  });
159
176
 
@@ -1223,6 +1223,25 @@ describe('Utils', function () {
1223
1223
  expect(script.id).to.equal('newId');
1224
1224
  });
1225
1225
  });
1226
+
1227
+ describe('safeJSONParse', () => {
1228
+ it('correctly encodes valid input', () => {
1229
+ const jsonObj = {
1230
+ key1: 'val1',
1231
+ key2: {
1232
+ key3: 100,
1233
+ key4: true
1234
+ }
1235
+ };
1236
+ const result = utils.safeJSONEncode(jsonObj);
1237
+ expect(result).to.equal(`{"key1":"val1","key2":{"key3":100,"key4":true}}`);
1238
+ });
1239
+ it('return empty string for stringify errors', () => {
1240
+ const jsonObj = {k: 2n};
1241
+ const result = utils.safeJSONEncode(jsonObj);
1242
+ expect(result).to.equal('');
1243
+ });
1244
+ });
1226
1245
  });
1227
1246
 
1228
1247
  describe('memoize', () => {
File without changes