prebid.js 7.2.0 → 7.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 (251) hide show
  1. package/.circleci/config.yml +11 -6
  2. package/.github/dependabot.yml +6 -0
  3. package/.github/workflows/issue_tracker.yml +5 -0
  4. package/.github/workflows/release-drafter.yml +6 -0
  5. package/README.md +35 -0
  6. package/dist/33acrossBidAdapter.js +1 -1
  7. package/dist/adagioBidAdapter.js +1 -1
  8. package/dist/adbookpspBidAdapter.js +1 -1
  9. package/dist/adgenerationBidAdapter.js +1 -1
  10. package/dist/adkernelBidAdapter.js +1 -1
  11. package/dist/adotBidAdapter.js +1 -1
  12. package/dist/adpod.js +1 -1
  13. package/dist/adqueryBidAdapter.js +1 -1
  14. package/dist/adrelevantisBidAdapter.js +1 -1
  15. package/dist/adxcgBidAdapter.js +1 -1
  16. package/dist/adyoulikeBidAdapter.js +1 -1
  17. package/dist/ajaBidAdapter.js +1 -1
  18. package/dist/amxBidAdapter.js +1 -1
  19. package/dist/amxIdSystem.js +1 -1
  20. package/dist/appierAnalyticsAdapter.js +1 -1
  21. package/dist/appnexusBidAdapter.js +1 -1
  22. package/dist/asoBidAdapter.js +1 -1
  23. package/dist/audiencerunBidAdapter.js +1 -1
  24. package/dist/axonixBidAdapter.js +1 -1
  25. package/dist/bidglassBidAdapter.js +1 -1
  26. package/dist/big-richmediaBidAdapter.js +1 -1
  27. package/dist/bluebillywigBidAdapter.js +1 -1
  28. package/dist/bridgewellBidAdapter.js +1 -1
  29. package/dist/brightMountainMediaBidAdapter.js +1 -1
  30. package/dist/concertBidAdapter.js +1 -1
  31. package/dist/connectadBidAdapter.js +1 -1
  32. package/dist/consumableBidAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/cpexIdSystem.js +1 -1
  35. package/dist/craftBidAdapter.js +1 -1
  36. package/dist/criteoBidAdapter.js +1 -1
  37. package/dist/debugging-standalone.js +1 -1
  38. package/dist/debugging.js +1 -1
  39. package/dist/dianomiBidAdapter.js +1 -0
  40. package/dist/dspxBidAdapter.js +1 -1
  41. package/dist/eplanningBidAdapter.js +1 -1
  42. package/dist/finativeBidAdapter.js +1 -0
  43. package/dist/fpdModule.js +1 -1
  44. package/dist/gdprEnforcement.js +1 -1
  45. package/dist/glimpseBidAdapter.js +1 -1
  46. package/dist/gmosspBidAdapter.js +1 -1
  47. package/dist/goldbachBidAdapter.js +1 -1
  48. package/dist/gridBidAdapter.js +1 -1
  49. package/dist/gridNMBidAdapter.js +1 -1
  50. package/dist/gumgumBidAdapter.js +1 -1
  51. package/dist/h12mediaBidAdapter.js +1 -1
  52. package/dist/hadronIdSystem.js +1 -1
  53. package/dist/hadronRtdProvider.js +1 -1
  54. package/dist/id5IdSystem.js +1 -1
  55. package/dist/impactifyBidAdapter.js +1 -1
  56. package/dist/improvedigitalBidAdapter.js +1 -1
  57. package/dist/inmarBidAdapter.js +1 -1
  58. package/dist/insticatorBidAdapter.js +1 -1
  59. package/dist/ixBidAdapter.js +1 -1
  60. package/dist/jixieBidAdapter.js +1 -1
  61. package/dist/justpremiumBidAdapter.js +1 -1
  62. package/dist/kargoAnalyticsAdapter.js +1 -1
  63. package/dist/kargoBidAdapter.js +1 -1
  64. package/dist/konduitAnalyticsAdapter.js +1 -1
  65. package/dist/kueezBidAdapter.js +1 -1
  66. package/dist/lassoBidAdapter.js +1 -0
  67. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  68. package/dist/logicadBidAdapter.js +1 -1
  69. package/dist/loglyliftBidAdapter.js +1 -1
  70. package/dist/malltvAnalyticsAdapter.js +1 -1
  71. package/dist/marsmediaBidAdapter.js +1 -1
  72. package/dist/mediafuseBidAdapter.js +1 -1
  73. package/dist/mediakeysBidAdapter.js +1 -1
  74. package/dist/medianetBidAdapter.js +1 -1
  75. package/dist/mediasquareBidAdapter.js +1 -1
  76. package/dist/mgidBidAdapter.js +1 -1
  77. package/dist/minutemediaBidAdapter.js +1 -1
  78. package/dist/missenaBidAdapter.js +1 -1
  79. package/dist/nativoBidAdapter.js +1 -1
  80. package/dist/not-for-prod/prebid.js +137 -131
  81. package/dist/oguryBidAdapter.js +1 -1
  82. package/dist/onetagBidAdapter.js +1 -1
  83. package/dist/ooloAnalyticsAdapter.js +1 -1
  84. package/dist/openxOrtbBidAdapter.js +1 -0
  85. package/dist/outbrainBidAdapter.js +1 -1
  86. package/dist/parrableIdSystem.js +1 -1
  87. package/dist/pixfutureBidAdapter.js +1 -1
  88. package/dist/prebid-core.js +2 -2
  89. package/dist/pubCommonId.js +1 -1
  90. package/dist/publinkIdSystem.js +1 -1
  91. package/dist/pubmaticBidAdapter.js +1 -1
  92. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  93. package/dist/pxyzBidAdapter.js +1 -1
  94. package/dist/quantcastBidAdapter.js +1 -1
  95. package/dist/readpeakBidAdapter.js +1 -1
  96. package/dist/relaidoBidAdapter.js +1 -1
  97. package/dist/rhythmoneBidAdapter.js +1 -1
  98. package/dist/riseBidAdapter.js +1 -1
  99. package/dist/rubiconAnalyticsAdapter.js +1 -1
  100. package/dist/rubiconBidAdapter.js +1 -1
  101. package/dist/seedingAllianceBidAdapter.js +1 -1
  102. package/dist/seedtagBidAdapter.js +1 -1
  103. package/dist/sharedIdSystem.js +1 -1
  104. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  105. package/dist/sharethroughBidAdapter.js +1 -1
  106. package/dist/shinezBidAdapter.js +1 -0
  107. package/dist/sizeMappingV2.js +1 -1
  108. package/dist/smaatoBidAdapter.js +1 -1
  109. package/dist/smartadserverBidAdapter.js +1 -1
  110. package/dist/smartxBidAdapter.js +1 -1
  111. package/dist/smilewantedBidAdapter.js +1 -1
  112. package/dist/sonobiBidAdapter.js +1 -1
  113. package/dist/sovrnAnalyticsAdapter.js +1 -1
  114. package/dist/sovrnBidAdapter.js +1 -1
  115. package/dist/sspBCBidAdapter.js +1 -1
  116. package/dist/sublimeBidAdapter.js +1 -1
  117. package/dist/synacormediaBidAdapter.js +1 -1
  118. package/dist/taboolaBidAdapter.js +1 -1
  119. package/dist/targetVideoBidAdapter.js +1 -1
  120. package/dist/teadsBidAdapter.js +1 -1
  121. package/dist/tncIdSystem.js +1 -0
  122. package/dist/trionBidAdapter.js +1 -1
  123. package/dist/tripleliftBidAdapter.js +1 -1
  124. package/dist/ttdBidAdapter.js +1 -1
  125. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  126. package/dist/underdogmediaBidAdapter.js +1 -1
  127. package/dist/undertoneBidAdapter.js +1 -1
  128. package/dist/userId.js +1 -1
  129. package/dist/ventesBidAdapter.js +1 -1
  130. package/dist/vidazooBidAdapter.js +1 -1
  131. package/dist/videobyteBidAdapter.js +1 -1
  132. package/dist/visxBidAdapter.js +1 -1
  133. package/dist/vrtcalBidAdapter.js +1 -1
  134. package/dist/vuukleBidAdapter.js +1 -1
  135. package/dist/widespaceBidAdapter.js +1 -1
  136. package/dist/winrBidAdapter.js +1 -1
  137. package/dist/yahoosspBidAdapter.js +1 -1
  138. package/dist/yieldlabBidAdapter.js +1 -1
  139. package/dist/yieldmoBidAdapter.js +1 -1
  140. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  141. package/dist/yieldoneBidAdapter.js +1 -1
  142. package/governance.md +5 -11
  143. package/gulpHelpers.js +1 -1
  144. package/gulpfile.js +1 -1
  145. package/karma.conf.maker.js +3 -1
  146. package/modules/.submodules.json +1 -0
  147. package/modules/33acrossBidAdapter.js +5 -1
  148. package/modules/adkernelBidAdapter.js +2 -1
  149. package/modules/adotBidAdapter.js +3 -3
  150. package/modules/adqueryBidAdapter.js +5 -1
  151. package/modules/appnexusBidAdapter.js +3 -3
  152. package/modules/cpexIdSystem.js +7 -8
  153. package/modules/criteoBidAdapter.js +7 -1
  154. package/modules/cwireBidAdapter.md +1 -1
  155. package/modules/debugging/bidInterceptor.js +1 -1
  156. package/modules/debugging/index.js +2 -1
  157. package/modules/dianomiBidAdapter.js +369 -0
  158. package/modules/dianomiBidAdapter.md +73 -0
  159. package/modules/finativeBidAdapter.js +235 -0
  160. package/modules/finativeBidAdapter.md +45 -0
  161. package/modules/fpdModule/index.js +6 -5
  162. package/modules/gdprEnforcement.js +8 -14
  163. package/modules/gumgumBidAdapter.js +2 -0
  164. package/modules/gumgumBidAdapter.md +19 -1
  165. package/modules/hadronAnalyticsAdapter.md +5 -5
  166. package/modules/hadronIdSystem.js +18 -5
  167. package/modules/hadronIdSystem.md +15 -11
  168. package/modules/hadronRtdProvider.js +14 -1
  169. package/modules/hadronRtdProvider.md +17 -13
  170. package/modules/insticatorBidAdapter.js +9 -0
  171. package/modules/ixBidAdapter.js +457 -57
  172. package/modules/ixBidAdapter.md +95 -5
  173. package/modules/kargoAnalyticsAdapter.js +88 -6
  174. package/modules/kargoAnalyticsAdapter.md +33 -0
  175. package/modules/kargoBidAdapter.js +1 -2
  176. package/modules/lassoBidAdapter.js +133 -0
  177. package/modules/lassoBidAdapter.md +29 -0
  178. package/modules/medianetBidAdapter.js +9 -5
  179. package/modules/missenaBidAdapter.js +20 -2
  180. package/modules/nativoBidAdapter.js +19 -7
  181. package/modules/openxBidAdapter.md +3 -1
  182. package/modules/openxOrtbBidAdapter.js +349 -0
  183. package/modules/openxOrtbBidAdapter.md +105 -0
  184. package/modules/pubCommonId.js +1 -2
  185. package/modules/readpeakBidAdapter.js +15 -6
  186. package/modules/relaidoBidAdapter.js +19 -4
  187. package/modules/riseBidAdapter.js +1 -0
  188. package/modules/seedtagBidAdapter.js +33 -1
  189. package/modules/sharedIdSystem.js +11 -5
  190. package/modules/sharethroughBidAdapter.js +9 -24
  191. package/modules/shinezBidAdapter.js +435 -0
  192. package/modules/shinezBidAdapter.md +76 -0
  193. package/modules/sonobiBidAdapter.js +28 -9
  194. package/modules/sovrnBidAdapter.js +16 -10
  195. package/modules/taboolaBidAdapter.js +1 -1
  196. package/modules/taboolaBidAdapter.md +3 -3
  197. package/modules/tncIdSystem.js +63 -0
  198. package/modules/tncIdSystem.md +33 -0
  199. package/modules/userId/eids.js +12 -0
  200. package/modules/userId/eids.md +7 -0
  201. package/modules/userId/userId.md +17 -0
  202. package/modules/ventesBidAdapter.js +1 -1
  203. package/modules/ventesBidAdapter.md +1 -1
  204. package/modules/vrtcalBidAdapter.js +35 -0
  205. package/modules/yieldlabBidAdapter.js +4 -0
  206. package/modules/yieldmoBidAdapter.js +20 -2
  207. package/modules/yieldoneBidAdapter.js +12 -1
  208. package/package.json +1 -1
  209. package/plugins/pbjsGlobals.js +2 -1
  210. package/src/adloader.js +1 -0
  211. package/src/prebid.js +4 -1
  212. package/src/storageManager.js +4 -5
  213. package/test/spec/modules/33acrossBidAdapter_spec.js +39 -0
  214. package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
  215. package/test/spec/modules/cpexIdSystem_spec.js +5 -5
  216. package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
  217. package/test/spec/modules/debugging_mod_spec.js +7 -0
  218. package/test/spec/modules/dianomiBidAdapter_spec.js +1223 -0
  219. package/test/spec/modules/eids_spec.js +26 -1
  220. package/test/spec/modules/finativeBidAdapter_spec.js +186 -0
  221. package/test/spec/modules/fpdModule_spec.js +28 -1
  222. package/test/spec/modules/gdprEnforcement_spec.js +53 -100
  223. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -0
  224. package/test/spec/modules/hadronIdSystem_spec.js +2 -2
  225. package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
  226. package/test/spec/modules/ixBidAdapter_spec.js +429 -10
  227. package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
  228. package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
  229. package/test/spec/modules/lassoBidAdapter_spec.js +177 -0
  230. package/test/spec/modules/medianetBidAdapter_spec.js +24 -1
  231. package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
  232. package/test/spec/modules/nativoBidAdapter_spec.js +67 -17
  233. package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
  234. package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
  235. package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
  236. package/test/spec/modules/riseBidAdapter_spec.js +3 -0
  237. package/test/spec/modules/seedtagBidAdapter_spec.js +4 -0
  238. package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
  239. package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
  240. package/test/spec/modules/sonobiBidAdapter_spec.js +38 -23
  241. package/test/spec/modules/sovrnBidAdapter_spec.js +39 -5
  242. package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
  243. package/test/spec/modules/tncIdSystem_spec.js +109 -0
  244. package/test/spec/modules/userId_spec.js +6 -3
  245. package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
  246. package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
  247. package/test/spec/modules/yieldlabBidAdapter_spec.js +4 -0
  248. package/test/spec/modules/yieldmoBidAdapter_spec.js +15 -2
  249. package/test/spec/modules/yieldoneBidAdapter_spec.js +43 -2
  250. package/test/spec/unit/pbjs_api_spec.js +23 -0
  251. package/webpack.conf.js +1 -1
@@ -35,6 +35,7 @@ describe('InsticatorBidAdapter', function () {
35
35
  ],
36
36
  w: 250,
37
37
  h: 300,
38
+ placement: 2,
38
39
  },
39
40
  },
40
41
  bidId: '30b31c1838de1e',
@@ -155,6 +156,25 @@ describe('InsticatorBidAdapter', function () {
155
156
  }
156
157
  })).to.be.false;
157
158
  });
159
+
160
+ it('should return false if video placement is not a number', () => {
161
+ expect(spec.isBidRequestValid({
162
+ ...bidRequest,
163
+ ...{
164
+ mediaTypes: {
165
+ video: {
166
+ mimes: [
167
+ 'video/mp4',
168
+ 'video/mpeg',
169
+ ],
170
+ w: 250,
171
+ h: 300,
172
+ placement: 'NaN',
173
+ },
174
+ }
175
+ }
176
+ })).to.be.false;
177
+ });
158
178
  });
159
179
 
160
180
  describe('buildRequests', function () {
@@ -276,7 +296,7 @@ describe('InsticatorBidAdapter', function () {
276
296
  banner: {
277
297
  format: [
278
298
  { w: 300, h: 250 },
279
- { w: 300, h: 600 },
299
+ { w: 300, h: 600 }
280
300
  ]
281
301
  },
282
302
  video: {
@@ -286,6 +306,7 @@ describe('InsticatorBidAdapter', function () {
286
306
  ],
287
307
  h: 300,
288
308
  w: 250,
309
+ placement: 2,
289
310
  },
290
311
  ext: {
291
312
  gpid: bidRequest.ortb2Imp.ext.gpid,
@@ -4,12 +4,13 @@ import { expect } from 'chai';
4
4
  import { newBidder } from 'src/adapters/bidderFactory.js';
5
5
  import { spec, storage, ERROR_CODES } from '../../../modules/ixBidAdapter.js';
6
6
  import { createEidsArray } from 'modules/userId/eids.js';
7
- import { deepAccess } from '../../../src/utils.js';
7
+ import { deepAccess, deepClone } from '../../../src/utils.js';
8
8
 
9
9
  describe('IndexexchangeAdapter', function () {
10
10
  const IX_SECURE_ENDPOINT = 'https://htlb.casalemedia.com/openrtb/pbjs';
11
11
  const VIDEO_ENDPOINT_VERSION = 8.1;
12
12
  const BANNER_ENDPOINT_VERSION = 7.2;
13
+ const NATIVE_ENDPOINT_VERSION = undefined;
13
14
 
14
15
  const SAMPLE_SCHAIN = {
15
16
  'ver': '1.0',
@@ -315,6 +316,88 @@ describe('IndexexchangeAdapter', function () {
315
316
  }
316
317
  ];
317
318
 
319
+ const DEFAULT_NATIVE_VALID_BID = [
320
+ {
321
+ bidder: 'ix',
322
+ params: {
323
+ siteId: '123',
324
+ size: [300, 250]
325
+ },
326
+ sizes: [[300, 250], [300, 600]],
327
+ mediaTypes: {
328
+ native: {
329
+ icon: {
330
+ required: false
331
+ },
332
+ title: {
333
+ required: true
334
+ },
335
+ body: {
336
+ required: true
337
+ },
338
+ image: {
339
+ required: true
340
+ },
341
+ video: {
342
+ required: false
343
+ },
344
+ sponsoredBy: {
345
+ required: true
346
+ }
347
+ }
348
+ },
349
+ adUnitCode: 'div-gpt-ad-1460505748563-0',
350
+ transactionId: '173f49a8-7549-4218-a23c-e7ba59b47231',
351
+ bidId: '1a2b3c4f',
352
+ bidderRequestId: '11a22b33c44f',
353
+ auctionId: '1aa2bb3cc4df',
354
+ schain: SAMPLE_SCHAIN
355
+ }
356
+ ];
357
+
358
+ const DEFAULT_MULTIFORMAT_NATIVE_VALID_BID = [
359
+ {
360
+ bidder: 'ix',
361
+ params: {
362
+ siteId: '123',
363
+ size: [300, 250],
364
+ },
365
+ mediaTypes: {
366
+ banner: {
367
+ sizes: [[300, 250], [300, 600], [400, 500]]
368
+ },
369
+ native: {
370
+ title: {
371
+ required: true
372
+ },
373
+ body: {
374
+ required: true
375
+ },
376
+ image: {
377
+ required: true
378
+ },
379
+ sponsoredBy: {
380
+ required: true
381
+ },
382
+ icon: {
383
+ required: false
384
+ }
385
+ }
386
+ },
387
+ adUnitCode: 'div-gpt-ad-1460505748562-0',
388
+ transactionId: '173f49a8-7549-4218-a23c-e7ba59b47230',
389
+ bidId: '1a2b3c4e',
390
+ bidderRequestId: '11a22b33c44e',
391
+ auctionId: '1aa2bb3cc4de',
392
+ schain: SAMPLE_SCHAIN
393
+ }
394
+ ];
395
+
396
+ const DEFAULT_NATIVE_IMP = {
397
+ request: '{"assets":[{"required":0,"img":{"type":1},"id":201},{"required":1,"title":{"len":25},"id":100},{"required":1,"data":{"type":2},"id":402},{"required":1,"img":{"type":3},"id":203},{"required":0,"video":{"mimes":["video/mp4","video/webm"],"minduration":0,"maxduration":120,"protocols":[2,3,5,6]},"id":300},{"required":1,"data":{"type":1},"id":401}],"ver":"1.2","eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}',
398
+ ver: '1.2'
399
+ }
400
+
318
401
  const DEFAULT_BANNER_BID_RESPONSE = {
319
402
  cur: 'USD',
320
403
  id: '11a22b33c44d',
@@ -437,6 +520,34 @@ describe('IndexexchangeAdapter', function () {
437
520
  ]
438
521
  };
439
522
 
523
+ const DEFAULT_NATIVE_BID_RESPONSE = {
524
+ cur: 'USD',
525
+ id: '11a22b33c44d',
526
+ seatbid: [
527
+ {
528
+ bid: [
529
+ {
530
+ crid: '12345',
531
+ adomain: ['www.abc.com'],
532
+ adid: '14851455',
533
+ impid: '1a2b3c4d',
534
+ cid: '3051266',
535
+ price: 100,
536
+ id: '1',
537
+ ext: {
538
+ dspid: 50,
539
+ pricelevel: '_100',
540
+ advbrandid: 303325,
541
+ advbrand: 'OECTA'
542
+ },
543
+ adm: '{"native":{"ver":"1.2","assets":[{"id":201,"img":{"url":"https://cdn.liftoff.io/customers/1209/creatives/2501-icon-250x250.png","w":250,"h":250}},{"id":203,"img":{"url":"https://cdn.liftoff.io/customers/5a9cab9cc6/image/lambda_png/a0355879b06c09b09232.png","w":1200,"h":627}},{"id":401,"data":{"value":"autodoc.co.uk"}},{"id":402,"data":{"value":"Les pièces automobiles dont vous avez besoin, toujours sous la main."}},{"id":100,"title":{"text":"Autodoc"}},{"id":300,"video":{"vasttag":"<VAST>blah</VAST>"}}],"link":{"url":"https://play.google.com/store/apps/details?id=de.autodoc.gmbh","clicktrackers":["https://click.liftoff.io/v1/campaign_click/blah"]},"eventtrackers":[{"event":1,"method":1,"url":"https://impression-europe.liftoff.io/index/impression"},{"event":1,"method":1,"url":"https://a701.casalemedia.com/impression/v1"}],"privacy":"https://privacy.link.com"}}'
544
+ }
545
+ ],
546
+ seat: '3970'
547
+ }
548
+ ]
549
+ };
550
+
440
551
  const DEFAULT_OPTION = {
441
552
  gdprConsent: {
442
553
  gdprApplies: true,
@@ -566,18 +677,109 @@ describe('IndexexchangeAdapter', function () {
566
677
  const syncOptions = {
567
678
  'iframeEnabled': true
568
679
  }
569
- let userSync = spec.getUserSyncs(syncOptions);
680
+ let userSync = spec.getUserSyncs(syncOptions, []);
570
681
  expect(userSync[0].type).to.equal('iframe');
571
682
  const USER_SYNC_URL = 'https://js-sec.indexww.com/um/ixmatch.html';
572
683
  expect(userSync[0].url).to.equal(USER_SYNC_URL);
573
684
  });
574
685
 
575
- it('When iframeEnabled is false, no userSync should be returned', function () {
686
+ it('When iframeEnabled = false, default to img', function () {
687
+ const syncOptions = {
688
+ 'iframeEnabled': false,
689
+ }
690
+ let userSync = spec.getUserSyncs(syncOptions, []);
691
+ expect(userSync[0].type).to.equal('image');
692
+ const USER_SYNC_URL = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=1&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
693
+ expect(userSync[0].url).to.equal(USER_SYNC_URL);
694
+ });
695
+
696
+ it('UserSync test : check type = pixel, check usermatch URL, no exchange data, only drop 1', function () {
697
+ const syncOptions = {
698
+ 'pixelEnabled': true
699
+ }
700
+ config.setConfig({
701
+ userSync: {
702
+ pixelEnabled: true,
703
+ syncsPerBidder: 3
704
+ }
705
+ })
706
+ let userSync = spec.getUserSyncs(syncOptions, []);
707
+ expect(userSync[0].type).to.equal('image');
708
+ const USER_SYNC_URL = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=1&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
709
+ expect(userSync[0].url).to.equal(USER_SYNC_URL);
710
+ });
711
+
712
+ it('UserSync test : check type = pixel, check usermatch URL with override set to 0', function () {
713
+ const syncOptions = {
714
+ 'pixelEnabled': true
715
+ }
716
+ config.setConfig({
717
+ userSync: {
718
+ pixelEnabled: true,
719
+ syncsPerBidder: 3
720
+ }
721
+ });
722
+ let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 0}}}]);
723
+ expect(userSync.length).to.equal(0);
724
+ });
725
+
726
+ it('UserSync test : check type = pixel, check usermatch URL with override set', function () {
576
727
  const syncOptions = {
577
- 'iframeEnabled': false
728
+ 'pixelEnabled': true
578
729
  }
579
- let userSync = spec.getUserSyncs(syncOptions);
580
- expect(userSync).to.be.an('array').that.is.empty;
730
+ config.setConfig({
731
+ userSync: {
732
+ pixelEnabled: true,
733
+ syncsPerBidder: 3
734
+ }
735
+ });
736
+ let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 2}}}]);
737
+ expect(userSync[0].type).to.equal('image');
738
+ const USER_SYNC_URL_0 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
739
+ const USER_SYNC_URL_1 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=1&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
740
+ expect(userSync[0].url).to.equal(USER_SYNC_URL_0);
741
+ expect(userSync[1].url).to.equal(USER_SYNC_URL_1);
742
+ expect(userSync.length).to.equal(2);
743
+ });
744
+
745
+ it('UserSync test : check type = pixel, check usermatch URL with override greater than publisher syncs per bidder , use syncsperbidder', function () {
746
+ const syncOptions = {
747
+ 'pixelEnabled': true
748
+ }
749
+ config.setConfig({
750
+ userSync: {
751
+ pixelEnabled: true,
752
+ syncsPerBidder: 3
753
+ }
754
+ });
755
+ let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 4}}}]);
756
+ expect(userSync[0].type).to.equal('image');
757
+ const USER_SYNC_URL_0 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=3&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
758
+ const USER_SYNC_URL_1 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=3&i=1&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
759
+ const USER_SYNC_URL_2 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=3&i=2&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
760
+ expect(userSync[0].url).to.equal(USER_SYNC_URL_0);
761
+ expect(userSync[1].url).to.equal(USER_SYNC_URL_1);
762
+ expect(userSync[2].url).to.equal(USER_SYNC_URL_2);
763
+ expect(userSync.length).to.equal(3);
764
+ });
765
+
766
+ it('UserSync test : check type = pixel, syncsPerBidder = 0, still use override', function () {
767
+ const syncOptions = {
768
+ 'pixelEnabled': true
769
+ }
770
+ config.setConfig({
771
+ userSync: {
772
+ pixelEnabled: true,
773
+ syncsPerBidder: 0
774
+ }
775
+ });
776
+ let userSync = spec.getUserSyncs(syncOptions, [{'body': {'ext': {'publishersyncsperbidderoverride': 2}}}]);
777
+ expect(userSync[0].type).to.equal('image');
778
+ const USER_SYNC_URL_0 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=0&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
779
+ const USER_SYNC_URL_1 = 'https://dsum.casalemedia.com/pbusermatch?origin=prebid&site_id=123&p=2&i=1&gdpr=1&gdpr_consent=3huaa11=qu3198ae&us_privacy=';
780
+ expect(userSync[0].url).to.equal(USER_SYNC_URL_0);
781
+ expect(userSync[1].url).to.equal(USER_SYNC_URL_1);
782
+ expect(userSync.length).to.equal(2);
581
783
  });
582
784
  });
583
785
 
@@ -617,6 +819,7 @@ describe('IndexexchangeAdapter', function () {
617
819
  it('should return true when required params found for a banner or video ad', function () {
618
820
  expect(spec.isBidRequestValid(DEFAULT_BANNER_VALID_BID[0])).to.equal(true);
619
821
  expect(spec.isBidRequestValid(DEFAULT_VIDEO_VALID_BID[0])).to.equal(true);
822
+ expect(spec.isBidRequestValid(DEFAULT_NATIVE_VALID_BID[0])).to.equal(true);
620
823
  });
621
824
 
622
825
  it('should return true when optional bidFloor params found for an ad', function () {
@@ -705,11 +908,11 @@ describe('IndexexchangeAdapter', function () {
705
908
  });
706
909
 
707
910
  it('should return false when mediaType is native', function () {
708
- const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
911
+ const bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID[0]);
709
912
  delete bid.params.mediaTypes;
710
913
  bid.mediaType = 'native';
711
914
  bid.sizes = [[300, 250]];
712
- expect(spec.isBidRequestValid(bid)).to.equal(false);
915
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
713
916
  });
714
917
 
715
918
  it('should return true when mediaType is missing and has sizes', function () {
@@ -745,6 +948,11 @@ describe('IndexexchangeAdapter', function () {
745
948
  expect(spec.isBidRequestValid(bid)).to.equal(true);
746
949
  });
747
950
 
951
+ it('shoult return true for native bid when there are multiple mediaTypes (banner, native)', function () {
952
+ const bid = utils.deepClone(DEFAULT_MULTIFORMAT_NATIVE_VALID_BID[0]);
953
+ expect(spec.isBidRequestValid(bid)).to.be.true;
954
+ });
955
+
748
956
  it('should return false when there is only bidFloor', function () {
749
957
  const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
750
958
  bid.params.bidFloor = 50;
@@ -807,6 +1015,18 @@ describe('IndexexchangeAdapter', function () {
807
1015
  delete bid.params.video.protocols;
808
1016
  expect(spec.isBidRequestValid(bid)).to.equal(false);
809
1017
  });
1018
+
1019
+ it('should fail when native contains unrecongized properties', function () {
1020
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID[0]);
1021
+ bid.mediaTypes.native.test = {}
1022
+ expect(spec.isBidRequestValid(bid)).to.be.false;
1023
+ });
1024
+
1025
+ it('should fail if native mediaTypes should contains no valid assets', function () {
1026
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID[0]);
1027
+ bid.mediaTypes.native = {}
1028
+ expect(spec.isBidRequestValid(bid)).to.be.false;
1029
+ });
810
1030
  });
811
1031
 
812
1032
  describe('Roundel alias adapter', function () {
@@ -1785,6 +2005,39 @@ describe('IndexexchangeAdapter', function () {
1785
2005
  });
1786
2006
  });
1787
2007
 
2008
+ describe('request should contain both banner and native requests', function () {
2009
+ const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_NATIVE_VALID_BID[0]]);
2010
+
2011
+ it('should have banner request', () => {
2012
+ const bannerImpression = JSON.parse(request[0].data.r).imp[0];
2013
+
2014
+ expect(JSON.parse(request[0].data.r).imp).to.have.lengthOf(1);
2015
+ expect(JSON.parse(request[0].data.v)).to.equal(BANNER_ENDPOINT_VERSION);
2016
+ expect(bannerImpression.id).to.equal(DEFAULT_BANNER_VALID_BID[0].bidId);
2017
+
2018
+ expect(bannerImpression.banner.format).to.be.length(2);
2019
+ expect(bannerImpression.banner.topframe).to.be.oneOf([0, 1]);
2020
+
2021
+ bannerImpression.banner.format.map(({ w, h, ext }, index) => {
2022
+ const size = DEFAULT_BANNER_VALID_BID[0].mediaTypes.banner.sizes[index];
2023
+ const sidValue = utils.parseGPTSingleSizeArray(size);
2024
+
2025
+ expect(w).to.equal(size[0]);
2026
+ expect(h).to.equal(size[1]);
2027
+ expect(ext.siteID).to.equal(DEFAULT_BANNER_VALID_BID[0].params.siteId);
2028
+ expect(ext.sid).to.equal(sidValue);
2029
+ });
2030
+ });
2031
+
2032
+ it('should have native request', () => {
2033
+ const nativeImpression = JSON.parse(request[1].data.r).imp[0];
2034
+
2035
+ expect(request[1].data.v).to.equal(NATIVE_ENDPOINT_VERSION);
2036
+ expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
2037
+ expect(nativeImpression.native).to.deep.equal(DEFAULT_NATIVE_IMP);
2038
+ });
2039
+ });
2040
+
1788
2041
  it('single request under 8k size limit for large ad unit', function () {
1789
2042
  const options = {};
1790
2043
  const bid = utils.deepClone(DEFAULT_BANNER_VALID_BID[0]);
@@ -2120,6 +2373,125 @@ describe('IndexexchangeAdapter', function () {
2120
2373
  })
2121
2374
  });
2122
2375
 
2376
+ describe('buildRequestNative', function () {
2377
+ it('should build request with expected params', function() {
2378
+ const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION);
2379
+ const query = request[0].data;
2380
+
2381
+ expect(query.v).to.equal(NATIVE_ENDPOINT_VERSION);
2382
+ expect(query.s).to.equal(DEFAULT_NATIVE_VALID_BID[0].params.siteId);
2383
+ expect(query.r).to.exist;
2384
+ expect(query.ac).to.equal('j');
2385
+ expect(query.sd).to.equal(1);
2386
+ expect(JSON.parse(query.r).at).to.equal(1);
2387
+ });
2388
+
2389
+ it('should send gpid in request if ortb2Imp.ext.gpid exists', function () {
2390
+ const GPID = '/19968336/some-adunit-path';
2391
+ const bids = utils.deepClone(DEFAULT_NATIVE_VALID_BID);
2392
+ bids[0].ortb2Imp = {
2393
+ ext: {
2394
+ gpid: GPID
2395
+ }
2396
+ };
2397
+ const requests = spec.buildRequests(bids, DEFAULT_OPTION);
2398
+ const { ext: { gpid } } = JSON.parse(requests[0].data.r).imp[0];
2399
+ expect(gpid).to.equal(GPID);
2400
+ });
2401
+
2402
+ it('should build request with required asset properties with default values', function() {
2403
+ const request = spec.buildRequests(DEFAULT_NATIVE_VALID_BID, DEFAULT_OPTION);
2404
+ const nativeImpression = JSON.parse(request[0].data.r).imp[0];
2405
+
2406
+ expect(request[0].data.v).to.equal(NATIVE_ENDPOINT_VERSION);
2407
+ expect(nativeImpression.id).to.equal(DEFAULT_NATIVE_VALID_BID[0].bidId);
2408
+ expect(nativeImpression.native).to.deep.equal(DEFAULT_NATIVE_IMP);
2409
+ });
2410
+
2411
+ it('should build request with given asset properties', function() {
2412
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID)
2413
+ bid[0].mediaTypes.native = {
2414
+ title: {
2415
+ len: 200
2416
+ },
2417
+ video: {
2418
+ mimes: [
2419
+ 'javascript'
2420
+ ],
2421
+ minduration: 10,
2422
+ maxduration: 60,
2423
+ protocols: [1]
2424
+ }
2425
+ }
2426
+ const request = spec.buildRequests(bid, DEFAULT_OPTION);
2427
+ const nativeImpression = JSON.parse(request[0].data.r).imp[0];
2428
+ expect(nativeImpression.native).to.deep.equal({request: '{"assets":[{"required":0,"title":{"len":200},"id":100},{"required":0,"video":{"mimes":["javascript"],"minduration":10,"maxduration":60,"protocols":[1]},"id":300}],"ver":"1.2","eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2'});
2429
+ });
2430
+
2431
+ it('should build request with all possible Prebid asset properties', function() {
2432
+ let bid = utils.deepClone(DEFAULT_NATIVE_VALID_BID)
2433
+ bid[0].mediaTypes.native = {
2434
+ title: {
2435
+ required: false
2436
+ },
2437
+ body: {
2438
+ required: false
2439
+ },
2440
+ body2: {
2441
+ required: false
2442
+ },
2443
+ sponsoredBy: {
2444
+ required: false
2445
+ },
2446
+ icon: {
2447
+ required: false
2448
+ },
2449
+ image: {
2450
+ required: false
2451
+ },
2452
+ clickUrl: {
2453
+ required: false
2454
+ },
2455
+ displayUrl: {
2456
+ required: false
2457
+ },
2458
+ privacyLink: {
2459
+ required: false
2460
+ },
2461
+ privacyIcon: {
2462
+ required: false
2463
+ },
2464
+ cta: {
2465
+ required: false
2466
+ },
2467
+ rating: {
2468
+ required: false
2469
+ },
2470
+ downloads: {
2471
+ required: false
2472
+ },
2473
+ likes: {
2474
+ required: false
2475
+ },
2476
+ price: {
2477
+ required: false
2478
+ },
2479
+ salePrice: {
2480
+ required: false
2481
+ },
2482
+ address: {
2483
+ required: false
2484
+ },
2485
+ phone: {
2486
+ required: false
2487
+ },
2488
+ }
2489
+ const request = spec.buildRequests(bid, DEFAULT_OPTION);
2490
+ const nativeImpression = JSON.parse(request[0].data.r).imp[0];
2491
+ expect(nativeImpression.native).to.deep.equal({request: '{"assets":[{"required":0,"title":{"len":25},"id":100},{"required":0,"data":{"type":2},"id":402},{"required":0,"data":{"type":10},"id":410},{"required":0,"data":{"type":1},"id":401},{"required":0,"img":{"type":1},"id":201},{"required":0,"img":{"type":3},"id":203},{"required":0,"data":{"type":11},"id":411},{"required":0,"data":{"type":12},"id":412},{"required":0,"data":{"type":3},"id":403},{"required":0,"data":{"type":5},"id":405},{"required":0,"data":{"type":4},"id":404},{"required":0,"data":{"type":6},"id":406},{"required":0,"data":{"type":7},"id":407},{"required":0,"data":{"type":9},"id":409},{"required":0,"data":{"type":8},"id":408}],"ver":"1.2","eventtrackers":[{"event":1,"methods":[1,2]}],"privacy":1}', ver: '1.2'});
2492
+ })
2493
+ });
2494
+
2123
2495
  describe('buildRequestMultiFormat', function () {
2124
2496
  it('only banner bidder params set', function () {
2125
2497
  const request = spec.buildRequests(DEFAULT_MULTIFORMAT_BANNER_VALID_BID, {})
@@ -2584,6 +2956,53 @@ describe('IndexexchangeAdapter', function () {
2584
2956
  expect(bannerResult[0].ttl).to.equal(300);
2585
2957
  expect(videoResult[0].ttl).to.equal(3600);
2586
2958
  });
2959
+
2960
+ it('should get correct bid response for native ad', function () {
2961
+ const expectedParse = [
2962
+ {
2963
+ requestId: '1a2b3c4d',
2964
+ cpm: 1,
2965
+ creativeId: '12345',
2966
+ mediaType: 'native',
2967
+ width: 1,
2968
+ height: 1,
2969
+ currency: 'USD',
2970
+ netRevenue: true,
2971
+ meta: {
2972
+ networkId: 50,
2973
+ brandId: 303325,
2974
+ brandName: 'OECTA',
2975
+ advertiserDomains: ['www.abc.com']
2976
+ },
2977
+ native: {
2978
+ body: 'Les pièces automobiles dont vous avez besoin, toujours sous la main.',
2979
+ clickUrl: 'https://play.google.com/store/apps/details?id=de.autodoc.gmbh',
2980
+ icon: {
2981
+ height: 250,
2982
+ width: 250,
2983
+ url: 'https://cdn.liftoff.io/customers/1209/creatives/2501-icon-250x250.png'
2984
+ },
2985
+ image: {
2986
+ height: 627,
2987
+ width: 1200,
2988
+ url: 'https://cdn.liftoff.io/customers/5a9cab9cc6/image/lambda_png/a0355879b06c09b09232.png'
2989
+ },
2990
+ impressionTrackers: [
2991
+ 'https://click.liftoff.io/v1/campaign_click/blah',
2992
+ 'https://impression-europe.liftoff.io/index/impression',
2993
+ 'https://a701.casalemedia.com/impression/v1'
2994
+ ],
2995
+ privacyLink: 'https://privacy.link.com',
2996
+ sponsoredBy: 'autodoc.co.uk',
2997
+ title: 'Autodoc',
2998
+ video: '<VAST>blah</VAST>'
2999
+ },
3000
+ ttl: 3600
3001
+ }
3002
+ ];
3003
+ const result = spec.interpretResponse({ body: DEFAULT_NATIVE_BID_RESPONSE }, { data: DEFAULT_BIDDER_REQUEST_DATA, validBidRequests: [] });
3004
+ expect(result[0]).to.deep.equal(expectedParse[0]);
3005
+ });
2587
3006
  });
2588
3007
 
2589
3008
  describe('bidrequest consent', function () {
@@ -2839,8 +3258,8 @@ describe('IndexexchangeAdapter', function () {
2839
3258
  bid.params.video.maxduration = 0;
2840
3259
 
2841
3260
  expect(spec.isBidRequestValid(bid)).to.be.true;
2842
- spec.buildRequests([bid], {});
2843
- expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.VIDEO_DURATION_INVALID]: 3 } });
3261
+ spec.buildRequests([bid]);
3262
+ expect(JSON.parse(localStorageValues[key])).to.deep.equal({ [TODAY]: { [ERROR_CODES.VIDEO_DURATION_INVALID]: 2 } });
2844
3263
  });
2845
3264
 
2846
3265
  it('should increment errors for errorCode', () => {
@@ -0,0 +1,42 @@
1
+ import kargoAnalyticsAdapter from 'modules/kargoAnalyticsAdapter.js';
2
+ import { expect } from 'chai';
3
+ import { server } from 'test/mocks/xhr.js';
4
+ let events = require('src/events');
5
+ let constants = require('src/constants.json');
6
+
7
+ describe('Kargo Analytics Adapter', function () {
8
+ const adapterConfig = {
9
+ provider: 'kargoAnalytics',
10
+ };
11
+
12
+ after(function () {
13
+ kargoAnalyticsAdapter.disableAnalytics();
14
+ });
15
+
16
+ describe('main test flow', function () {
17
+ beforeEach(function () {
18
+ kargoAnalyticsAdapter.enableAnalytics(adapterConfig);
19
+ sinon.stub(events, 'getEvents').returns([]);
20
+ });
21
+
22
+ afterEach(function () {
23
+ events.getEvents.restore();
24
+ });
25
+
26
+ it('bid response data should send one request with auction ID, auction timeout, and response time', function() {
27
+ const bidResponse = {
28
+ bidder: 'kargo',
29
+ auctionId: '66529d4c-8998-47c2-ab3e-5b953490b98f',
30
+ timeToRespond: 192,
31
+ };
32
+
33
+ events.emit(constants.EVENTS.AUCTION_INIT, {
34
+ timeout: 1000
35
+ });
36
+ events.emit(constants.EVENTS.BID_RESPONSE, bidResponse);
37
+
38
+ expect(server.requests.length).to.equal(1);
39
+ expect(server.requests[0].url).to.equal('https://krk.kargo.com/api/v1/event/auction-data?aid=66529d4c-8998-47c2-ab3e-5b953490b98f&ato=1000&rt=192&it=0');
40
+ });
41
+ });
42
+ });
@@ -572,6 +572,7 @@ describe('kargo adapter tests', function () {
572
572
  cpm: 2.5,
573
573
  width: 300,
574
574
  height: 250,
575
+ ad: '<VAST></VAST>',
575
576
  vastXml: '<VAST></VAST>',
576
577
  ttl: 300,
577
578
  creativeId: 'bar',