prebid.js 5.17.0 → 6.0.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 (145) hide show
  1. package/.babelrc.js +3 -6
  2. package/README.md +3 -1
  3. package/browsers.json +1 -8
  4. package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
  5. package/modules/.submodules.json +1 -0
  6. package/modules/adfBidAdapter.js +21 -16
  7. package/modules/adgenerationBidAdapter.js +28 -4
  8. package/modules/adkernelBidAdapter.js +2 -1
  9. package/modules/admixerBidAdapter.js +11 -0
  10. package/modules/adtelligentBidAdapter.js +2 -1
  11. package/modules/airgridRtdProvider.js +1 -1
  12. package/modules/akamaiDapRtdProvider.js +474 -0
  13. package/modules/akamaiDapRtdProvider.md +47 -0
  14. package/modules/aolBidAdapter.js +2 -1
  15. package/modules/appnexusBidAdapter.js +5 -3
  16. package/modules/atsAnalyticsAdapter.js +67 -46
  17. package/modules/atsAnalyticsAdapter.md +1 -0
  18. package/modules/betweenBidAdapter.js +20 -3
  19. package/modules/bliinkBidAdapter.js +58 -32
  20. package/modules/bliinkBidAdapter.md +29 -6
  21. package/modules/browsiRtdProvider.js +106 -18
  22. package/modules/cleanioRtdProvider.js +192 -0
  23. package/modules/cleanioRtdProvider.md +59 -0
  24. package/modules/codefuelBidAdapter.js +183 -0
  25. package/modules/codefuelBidAdapter.md +111 -0
  26. package/modules/connectIdSystem.js +104 -0
  27. package/modules/connectIdSystem.md +33 -0
  28. package/modules/cwireBidAdapter.js +272 -0
  29. package/modules/cwireBidAdapter.md +43 -0
  30. package/modules/deepintentBidAdapter.js +106 -9
  31. package/modules/deepintentBidAdapter.md +36 -1
  32. package/modules/deltaprojectsBidAdapter.js +252 -0
  33. package/modules/deltaprojectsBidAdapter.md +32 -0
  34. package/modules/dgkeywordRtdProvider.js +0 -1
  35. package/modules/engageyaBidAdapter.js +157 -0
  36. package/modules/gridBidAdapter.js +1 -0
  37. package/modules/gumgumBidAdapter.js +8 -0
  38. package/modules/inskinBidAdapter.js +7 -3
  39. package/modules/ixBidAdapter.js +8 -1
  40. package/modules/jixieBidAdapter.js +8 -2
  41. package/modules/justpremiumBidAdapter.js +6 -1
  42. package/modules/limelightDigitalBidAdapter.js +22 -2
  43. package/modules/livewrappedAnalyticsAdapter.js +53 -3
  44. package/modules/mediakeysBidAdapter.js +2 -1
  45. package/modules/multibid/index.js +3 -3
  46. package/modules/nativoBidAdapter.js +6 -2
  47. package/modules/nextMillenniumBidAdapter.js +12 -3
  48. package/modules/oguryBidAdapter.js +36 -7
  49. package/modules/openxBidAdapter.js +34 -22
  50. package/modules/operaadsBidAdapter.js +21 -1
  51. package/modules/otmBidAdapter.js +146 -0
  52. package/modules/otmBidAdapter.md +27 -26
  53. package/modules/outbrainBidAdapter.js +5 -0
  54. package/modules/pixfutureBidAdapter.js +24 -4
  55. package/modules/pixfutureBidAdapter.md +127 -0
  56. package/modules/playwireBidAdapter.md +61 -0
  57. package/modules/prebidServerBidAdapter/index.js +1 -1
  58. package/modules/proxistoreBidAdapter.js +4 -6
  59. package/modules/publinkIdSystem.js +11 -6
  60. package/modules/pubmaticBidAdapter.js +9 -0
  61. package/modules/pubmaticBidAdapter.md +1 -1
  62. package/modules/rtdModule/index.js +2 -2
  63. package/modules/sonobiBidAdapter.js +7 -0
  64. package/modules/sortableBidAdapter.js +1 -0
  65. package/modules/talkadsBidAdapter.js +129 -0
  66. package/modules/talkadsBidAdapter.md +60 -0
  67. package/modules/teadsBidAdapter.js +3 -0
  68. package/modules/tripleliftBidAdapter.js +22 -5
  69. package/modules/trustxBidAdapter.js +8 -6
  70. package/modules/undertoneBidAdapter.js +9 -5
  71. package/modules/undertoneBidAdapter.md +5 -1
  72. package/modules/unicornBidAdapter.js +3 -3
  73. package/modules/userId/eids.js +18 -0
  74. package/modules/userId/eids.md +7 -0
  75. package/modules/userId/userId.md +12 -0
  76. package/modules/ventesBidAdapter.js +370 -0
  77. package/modules/ventesBidAdapter.md +94 -0
  78. package/modules/videobyteBidAdapter.js +13 -6
  79. package/modules/videobyteBidAdapter.md +49 -0
  80. package/modules/visxBidAdapter.js +15 -22
  81. package/modules/yahoosspBidAdapter.js +637 -0
  82. package/modules/yahoosspBidAdapter.md +795 -0
  83. package/modules/yieldlabBidAdapter.js +48 -3
  84. package/modules/yieldlabBidAdapter.md +16 -1
  85. package/modules/yieldmoSyntheticInventoryModule.js +46 -0
  86. package/modules/yieldmoSyntheticInventoryModule.md +68 -0
  87. package/package.json +1 -1
  88. package/src/adapterManager.js +5 -0
  89. package/src/adapters/bidderFactory.js +4 -3
  90. package/src/auction.js +11 -11
  91. package/src/constants.json +1 -0
  92. package/src/secureCreatives.js +6 -7
  93. package/src/targeting.js +11 -9
  94. package/test/spec/modules/adfBidAdapter_spec.js +83 -29
  95. package/test/spec/modules/adgenerationBidAdapter_spec.js +121 -50
  96. package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
  97. package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
  98. package/test/spec/modules/appnexusBidAdapter_spec.js +2 -1
  99. package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
  100. package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
  101. package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
  102. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  103. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  104. package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
  105. package/test/spec/modules/connectIdSystem_spec.js +189 -0
  106. package/test/spec/modules/cwireBidAdapter_spec.js +246 -0
  107. package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
  108. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  109. package/test/spec/modules/engageyaBidAdapter_spec.js +286 -0
  110. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
  111. package/test/spec/modules/ixBidAdapter_spec.js +13 -3
  112. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  113. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  114. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
  115. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +67 -12
  116. package/test/spec/modules/multibid_spec.js +31 -31
  117. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
  118. package/test/spec/modules/oguryBidAdapter_spec.js +125 -37
  119. package/test/spec/modules/openxBidAdapter_spec.js +85 -13
  120. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  121. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  122. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  123. package/test/spec/modules/publinkIdSystem_spec.js +6 -6
  124. package/test/spec/modules/pubmaticBidAdapter_spec.js +39 -1
  125. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  126. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  127. package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
  128. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  129. package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
  130. package/test/spec/modules/trustxBidAdapter_spec.js +3 -3
  131. package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
  132. package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
  133. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  134. package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
  135. package/test/spec/modules/visxBidAdapter_spec.js +48 -4
  136. package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
  137. package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
  138. package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
  139. package/test/spec/unit/core/adapterManager_spec.js +32 -0
  140. package/test/spec/unit/core/bidderFactory_spec.js +61 -1
  141. package/test/spec/unit/pbjs_api_spec.js +37 -2
  142. package/test/spec/unit/secureCreatives_spec.js +54 -25
  143. package/wdio.conf.js +1 -1
  144. package/modules/turktelekomBidAdapter.md +0 -49
  145. package/yarn.lock +0 -13122
@@ -82,7 +82,7 @@ describe('multibid adapter', function () {
82
82
  'sizes': [[300, 250]]
83
83
  }
84
84
  },
85
- 'adUnitCode': 'test-div',
85
+ 'adUnitCode': 'test.div',
86
86
  'transactionId': 'c153f3da-84f0-4be8-95cb-0647c458bc60',
87
87
  'sizes': [[300, 250]],
88
88
  'bidId': '2408ef83b84c9d',
@@ -106,7 +106,7 @@ describe('multibid adapter', function () {
106
106
  'sizes': [[300, 250]]
107
107
  }
108
108
  },
109
- 'adUnitCode': 'test-div',
109
+ 'adUnitCode': 'test.div',
110
110
  'transactionId': 'c153f3da-84f0-4be8-95cb-0647c458bc60',
111
111
  'sizes': [[300, 250]],
112
112
  'bidId': '2408ef83b84c9d',
@@ -197,14 +197,14 @@ describe('multibid adapter', function () {
197
197
  });
198
198
 
199
199
  it('adds original bids and does not modify', function () {
200
- let adUnitCode = 'test-div';
200
+ let adUnitCode = 'test.div';
201
201
  let bids = [{...bidArray[0]}, {...bidArray[1]}];
202
202
 
203
203
  addBidResponseHook(callbackFn, adUnitCode, {...bids[0]});
204
204
 
205
205
  expect(result).to.not.equal(null);
206
206
  expect(result.adUnitCode).to.not.equal(null);
207
- expect(result.adUnitCode).to.equal('test-div');
207
+ expect(result.adUnitCode).to.equal('test.div');
208
208
  expect(result.bid).to.not.equal(null);
209
209
  expect(result.bid).to.deep.equal(bids[0]);
210
210
 
@@ -214,13 +214,13 @@ describe('multibid adapter', function () {
214
214
 
215
215
  expect(result).to.not.equal(null);
216
216
  expect(result.adUnitCode).to.not.equal(null);
217
- expect(result.adUnitCode).to.equal('test-div');
217
+ expect(result.adUnitCode).to.equal('test.div');
218
218
  expect(result.bid).to.not.equal(null);
219
219
  expect(result.bid).to.deep.equal(bids[1]);
220
220
  });
221
221
 
222
222
  it('modifies and adds both bids based on multibid configuration', function () {
223
- let adUnitCode = 'test-div';
223
+ let adUnitCode = 'test.div';
224
224
  let bids = [{...bidArray[0]}, {...bidArray[1]}];
225
225
 
226
226
  config.setConfig({multibid: [{bidder: 'bidderA', maxBids: 2, targetBiddercodePrefix: 'bidA'}]});
@@ -232,7 +232,7 @@ describe('multibid adapter', function () {
232
232
 
233
233
  expect(result).to.not.equal(null);
234
234
  expect(result.adUnitCode).to.not.equal(null);
235
- expect(result.adUnitCode).to.equal('test-div');
235
+ expect(result.adUnitCode).to.equal('test.div');
236
236
  expect(result.bid).to.not.equal(null);
237
237
  expect(result.bid).to.deep.equal(bids[0]);
238
238
 
@@ -250,13 +250,13 @@ describe('multibid adapter', function () {
250
250
 
251
251
  expect(result).to.not.equal(null);
252
252
  expect(result.adUnitCode).to.not.equal(null);
253
- expect(result.adUnitCode).to.equal('test-div');
253
+ expect(result.adUnitCode).to.equal('test.div');
254
254
  expect(result.bid).to.not.equal(null);
255
255
  expect(result.bid).to.deep.equal(bids[1]);
256
256
  });
257
257
 
258
258
  it('only modifies bids defined in the multibid configuration', function () {
259
- let adUnitCode = 'test-div';
259
+ let adUnitCode = 'test.div';
260
260
  let bids = [{...bidArray[0]}, {...bidArray[1]}];
261
261
 
262
262
  bids.push({
@@ -276,7 +276,7 @@ describe('multibid adapter', function () {
276
276
 
277
277
  expect(result).to.not.equal(null);
278
278
  expect(result.adUnitCode).to.not.equal(null);
279
- expect(result.adUnitCode).to.equal('test-div');
279
+ expect(result.adUnitCode).to.equal('test.div');
280
280
  expect(result.bid).to.not.equal(null);
281
281
  expect(result.bid).to.deep.equal(bids[0]);
282
282
 
@@ -292,7 +292,7 @@ describe('multibid adapter', function () {
292
292
 
293
293
  expect(result).to.not.equal(null);
294
294
  expect(result.adUnitCode).to.not.equal(null);
295
- expect(result.adUnitCode).to.equal('test-div');
295
+ expect(result.adUnitCode).to.equal('test.div');
296
296
  expect(result.bid).to.not.equal(null);
297
297
  expect(result.bid).to.deep.equal(bids[1]);
298
298
 
@@ -302,13 +302,13 @@ describe('multibid adapter', function () {
302
302
 
303
303
  expect(result).to.not.equal(null);
304
304
  expect(result.adUnitCode).to.not.equal(null);
305
- expect(result.adUnitCode).to.equal('test-div');
305
+ expect(result.adUnitCode).to.equal('test.div');
306
306
  expect(result.bid).to.not.equal(null);
307
307
  expect(result.bid).to.deep.equal(bids[2]);
308
308
  });
309
309
 
310
310
  it('only modifies and returns bids under limit for a specifc bidder in the multibid configuration', function () {
311
- let adUnitCode = 'test-div';
311
+ let adUnitCode = 'test.div';
312
312
  let bids = [{...bidArray[0]}, {...bidArray[1]}];
313
313
 
314
314
  bids.push({
@@ -328,7 +328,7 @@ describe('multibid adapter', function () {
328
328
 
329
329
  expect(result).to.not.equal(null);
330
330
  expect(result.adUnitCode).to.not.equal(null);
331
- expect(result.adUnitCode).to.equal('test-div');
331
+ expect(result.adUnitCode).to.equal('test.div');
332
332
  expect(result.bid).to.not.equal(null);
333
333
  expect(result.bid).to.deep.equal(bids[0]);
334
334
 
@@ -344,7 +344,7 @@ describe('multibid adapter', function () {
344
344
 
345
345
  expect(result).to.not.equal(null);
346
346
  expect(result.adUnitCode).to.not.equal(null);
347
- expect(result.adUnitCode).to.equal('test-div');
347
+ expect(result.adUnitCode).to.equal('test.div');
348
348
  expect(result.bid).to.not.equal(null);
349
349
  expect(result.bid).to.deep.equal(bids[1]);
350
350
 
@@ -356,7 +356,7 @@ describe('multibid adapter', function () {
356
356
  });
357
357
 
358
358
  it('if no prefix in multibid configuration, modifies and returns bids under limit without preifx property', function () {
359
- let adUnitCode = 'test-div';
359
+ let adUnitCode = 'test.div';
360
360
  let bids = [{...bidArray[0]}, {...bidArray[1]}];
361
361
 
362
362
  bids.push({
@@ -375,7 +375,7 @@ describe('multibid adapter', function () {
375
375
 
376
376
  expect(result).to.not.equal(null);
377
377
  expect(result.adUnitCode).to.not.equal(null);
378
- expect(result.adUnitCode).to.equal('test-div');
378
+ expect(result.adUnitCode).to.equal('test.div');
379
379
  expect(result.bid).to.not.equal(null);
380
380
  expect(result.bid).to.deep.equal(bids[0]);
381
381
 
@@ -389,7 +389,7 @@ describe('multibid adapter', function () {
389
389
 
390
390
  expect(result).to.not.equal(null);
391
391
  expect(result.adUnitCode).to.not.equal(null);
392
- expect(result.adUnitCode).to.equal('test-div');
392
+ expect(result.adUnitCode).to.equal('test.div');
393
393
  expect(result.bid).to.not.equal(null);
394
394
  expect(result.bid).to.deep.equal(bids[1]);
395
395
 
@@ -401,7 +401,7 @@ describe('multibid adapter', function () {
401
401
  });
402
402
 
403
403
  it('does not include extra bids if cpm is less than floor value', function () {
404
- let adUnitCode = 'test-div';
404
+ let adUnitCode = 'test.div';
405
405
  let bids = [{...bidArrayAlt[1]}, {...bidArrayAlt[0]}, {...bidArrayAlt[2]}, {...bidArrayAlt[3]}];
406
406
 
407
407
  bids.map(bid => {
@@ -418,7 +418,7 @@ describe('multibid adapter', function () {
418
418
  floorRuleValue: 65,
419
419
  floorValue: 65,
420
420
  matchedFields: {
421
- gptSlot: 'test-div',
421
+ gptSlot: 'test.div',
422
422
  mediaType: 'banner'
423
423
  }
424
424
  }
@@ -435,7 +435,7 @@ describe('multibid adapter', function () {
435
435
 
436
436
  expect(result).to.not.equal(null);
437
437
  expect(result.adUnitCode).to.not.equal(null);
438
- expect(result.adUnitCode).to.equal('test-div');
438
+ expect(result.adUnitCode).to.equal('test.div');
439
439
  expect(result.bid).to.not.equal(null);
440
440
  expect(result.bid.bidder).to.equal('bidderA');
441
441
  expect(result.bid.targetingBidder).to.equal(undefined);
@@ -452,7 +452,7 @@ describe('multibid adapter', function () {
452
452
 
453
453
  expect(result).to.not.equal(null);
454
454
  expect(result.adUnitCode).to.not.equal(null);
455
- expect(result.adUnitCode).to.equal('test-div');
455
+ expect(result.adUnitCode).to.equal('test.div');
456
456
  expect(result.bid).to.not.equal(null);
457
457
  expect(result.bid.bidder).to.equal('bidderB');
458
458
  expect(result.bid.targetingBidder).to.equal(undefined);
@@ -463,14 +463,14 @@ describe('multibid adapter', function () {
463
463
 
464
464
  expect(result).to.not.equal(null);
465
465
  expect(result.adUnitCode).to.not.equal(null);
466
- expect(result.adUnitCode).to.equal('test-div');
466
+ expect(result.adUnitCode).to.equal('test.div');
467
467
  expect(result.bid).to.not.equal(null);
468
468
  expect(result.bid.bidder).to.equal('bidderC');
469
469
  expect(result.bid.targetingBidder).to.equal(undefined);
470
470
  });
471
471
 
472
472
  it('does include extra bids if cpm is not less than floor value', function () {
473
- let adUnitCode = 'test-div';
473
+ let adUnitCode = 'test.div';
474
474
  let bids = [{...bidArrayAlt[1]}, {...bidArrayAlt[0]}];
475
475
 
476
476
  bids.map(bid => {
@@ -487,7 +487,7 @@ describe('multibid adapter', function () {
487
487
  floorRuleValue: 25,
488
488
  floorValue: 25,
489
489
  matchedFields: {
490
- gptSlot: 'test-div',
490
+ gptSlot: 'test.div',
491
491
  mediaType: 'banner'
492
492
  }
493
493
  }
@@ -504,7 +504,7 @@ describe('multibid adapter', function () {
504
504
 
505
505
  expect(result).to.not.equal(null);
506
506
  expect(result.adUnitCode).to.not.equal(null);
507
- expect(result.adUnitCode).to.equal('test-div');
507
+ expect(result.adUnitCode).to.equal('test.div');
508
508
  expect(result.bid).to.not.equal(null);
509
509
  expect(result.bid.bidder).to.equal('bidderA');
510
510
  expect(result.bid.targetingBidder).to.equal(undefined);
@@ -518,7 +518,7 @@ describe('multibid adapter', function () {
518
518
 
519
519
  expect(result).to.not.equal(null);
520
520
  expect(result.adUnitCode).to.not.equal(null);
521
- expect(result.adUnitCode).to.equal('test-div');
521
+ expect(result.adUnitCode).to.equal('test.div');
522
522
  expect(result.bid).to.not.equal(null);
523
523
  expect(result.bid.bidder).to.equal('bidderA');
524
524
  expect(result.bid.targetingBidder).to.equal('bidA2');
@@ -578,7 +578,7 @@ describe('multibid adapter', function () {
578
578
 
579
579
  it('it sorts and creates dynamic alias on bidsReceived if multibid configuration found with prefix', function () {
580
580
  let modifiedBids = [{...bidArray[1]}, {...bidArray[0]}].map(bid => {
581
- addBidResponseHook(bidResponseCallback, 'test-div', {...bid});
581
+ addBidResponseHook(bidResponseCallback, 'test.div', {...bid});
582
582
 
583
583
  return bidResult;
584
584
  });
@@ -603,7 +603,7 @@ describe('multibid adapter', function () {
603
603
 
604
604
  it('it sorts by cpm treating dynamic alias as unique bid when no bid limit defined', function () {
605
605
  let modifiedBids = [{...bidArrayAlt[0]}, {...bidArrayAlt[2]}, {...bidArrayAlt[3]}, {...bidArrayAlt[1]}].map(bid => {
606
- addBidResponseHook(bidResponseCallback, 'test-div', {...bid});
606
+ addBidResponseHook(bidResponseCallback, 'test.div', {...bid});
607
607
 
608
608
  return bidResult;
609
609
  });
@@ -636,7 +636,7 @@ describe('multibid adapter', function () {
636
636
 
637
637
  it('it should filter out dynamic bid when bid limit is less than unique bid pool', function () {
638
638
  let modifiedBids = [{...bidArrayAlt[0]}, {...bidArrayAlt[2]}, {...bidArrayAlt[3]}, {...bidArrayAlt[1]}].map(bid => {
639
- addBidResponseHook(bidResponseCallback, 'test-div', {...bid});
639
+ addBidResponseHook(bidResponseCallback, 'test.div', {...bid});
640
640
 
641
641
  return bidResult;
642
642
  });
@@ -662,7 +662,7 @@ describe('multibid adapter', function () {
662
662
  config.setConfig({ multibid: [{bidder: 'bidderA', maxBids: 2, targetBiddercodePrefix: 'bidA'}] });
663
663
 
664
664
  let modifiedBids = [{...bidArrayAlt[0]}, {...bidArrayAlt[2]}, {...bidArrayAlt[3]}, {...bidArrayAlt[1]}].map(bid => {
665
- addBidResponseHook(bidResponseCallback, 'test-div', {...bid});
665
+ addBidResponseHook(bidResponseCallback, 'test.div', {...bid});
666
666
 
667
667
  return bidResult;
668
668
  });
@@ -8,10 +8,22 @@ describe('nextMillenniumBidAdapterTests', function() {
8
8
  auctionId: 'b06c5141-fe8f-4cdf-9d7d-54415490a917',
9
9
  bidder: 'nextMillennium',
10
10
  params: { placement_id: '-1' },
11
- sizes: [[300, 250]]
11
+ sizes: [[300, 250]],
12
+ uspConsent: '1---',
13
+ gdprConsent: {
14
+ consentString: 'kjfdniwjnifwenrif3',
15
+ gdprApplies: true
16
+ }
12
17
  }
13
18
  ];
14
19
 
20
+ it('Request params check with GDPR Consent', function () {
21
+ const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
22
+ expect(JSON.parse(request[0].data).user.ext.consent).to.equal('kjfdniwjnifwenrif3');
23
+ expect(JSON.parse(request[0].data).regs.ext.us_privacy).to.equal('1---');
24
+ expect(JSON.parse(request[0].data).regs.ext.gdpr).to.equal(1);
25
+ });
26
+
15
27
  it('validate_generated_params', function() {
16
28
  const request = spec.buildRequests(bidRequestData);
17
29
  expect(request[0].bidId).to.equal('bid1234');
@@ -1,8 +1,9 @@
1
1
  import { expect } from 'chai';
2
2
  import { spec } from 'modules/oguryBidAdapter';
3
- import { deepClone } from 'src/utils.js';
3
+ import * as utils from 'src/utils.js';
4
4
 
5
- const BID_HOST = 'https://mweb-hb.presage.io/api/header-bidding-request';
5
+ const BID_URL = 'https://mweb-hb.presage.io/api/header-bidding-request';
6
+ const TIMEOUT_URL = 'https://ms-ads-monitoring-events.presage.io/bid_timeout'
6
7
 
7
8
  describe('OguryBidAdapter', function () {
8
9
  let bidRequests;
@@ -67,14 +68,14 @@ describe('OguryBidAdapter', function () {
67
68
 
68
69
  describe('isBidRequestValid', function () {
69
70
  it('should validate correct bid', () => {
70
- let validBid = deepClone(bidRequests[0]);
71
+ let validBid = utils.deepClone(bidRequests[0]);
71
72
 
72
73
  let isValid = spec.isBidRequestValid(validBid);
73
74
  expect(isValid).to.equal(true);
74
75
  });
75
76
 
76
77
  it('should not validate incorrect bid', () => {
77
- let invalidBid = deepClone(bidRequests[0]);
78
+ let invalidBid = utils.deepClone(bidRequests[0]);
78
79
  delete invalidBid.sizes;
79
80
  delete invalidBid.mediaTypes;
80
81
 
@@ -83,7 +84,7 @@ describe('OguryBidAdapter', function () {
83
84
  });
84
85
 
85
86
  it('should not validate bid if adunit is not present', () => {
86
- let invalidBid = deepClone(bidRequests[0]);
87
+ let invalidBid = utils.deepClone(bidRequests[0]);
87
88
  delete invalidBid.params.adUnitId;
88
89
 
89
90
  let isValid = spec.isBidRequestValid(invalidBid);
@@ -91,7 +92,7 @@ describe('OguryBidAdapter', function () {
91
92
  });
92
93
 
93
94
  it('should not validate bid if assetKet is not present', () => {
94
- let invalidBid = deepClone(bidRequests[0]);
95
+ let invalidBid = utils.deepClone(bidRequests[0]);
95
96
  delete invalidBid.params.assetKey;
96
97
 
97
98
  let isValid = spec.isBidRequestValid(invalidBid);
@@ -99,7 +100,7 @@ describe('OguryBidAdapter', function () {
99
100
  });
100
101
 
101
102
  it('should validate bid if getFloor is not present', () => {
102
- let invalidBid = deepClone(bidRequests[1]);
103
+ let invalidBid = utils.deepClone(bidRequests[1]);
103
104
  delete invalidBid.getFloor;
104
105
 
105
106
  let isValid = spec.isBidRequestValid(invalidBid);
@@ -118,22 +119,26 @@ describe('OguryBidAdapter', function () {
118
119
  };
119
120
  });
120
121
 
121
- it('should return syncs array with an element of type image', () => {
122
+ it('should return sync array with two elements of type image', () => {
122
123
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
123
124
 
124
- expect(userSyncs).to.have.lengthOf(1);
125
+ expect(userSyncs).to.have.lengthOf(2);
125
126
  expect(userSyncs[0].type).to.equal('image');
126
127
  expect(userSyncs[0].url).to.contain('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch');
128
+ expect(userSyncs[1].type).to.equal('image');
129
+ expect(userSyncs[1].url).to.contain('https://ms-cookie-sync.presage.io/ttd/init-sync');
127
130
  });
128
131
 
129
- it('should set the source as query param', () => {
132
+ it('should set the same source as query param', () => {
130
133
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
131
134
  expect(userSyncs[0].url).to.contain('source=prebid');
135
+ expect(userSyncs[1].url).to.contain('source=prebid');
132
136
  });
133
137
 
134
138
  it('should set the tcString as query param', () => {
135
139
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
136
140
  expect(userSyncs[0].url).to.contain(`iab_string=${gdprConsent.consentString}`);
141
+ expect(userSyncs[1].url).to.contain(`iab_string=${gdprConsent.consentString}`);
137
142
  });
138
143
 
139
144
  it('should return an empty array when pixel is disable', () => {
@@ -141,70 +146,82 @@ describe('OguryBidAdapter', function () {
141
146
  expect(spec.getUserSyncs(syncOptions, [], gdprConsent)).to.have.lengthOf(0);
142
147
  });
143
148
 
144
- it('should return syncs array with an element of type image when consentString is undefined', () => {
149
+ it('should return sync array with two elements of type image when consentString is undefined', () => {
145
150
  gdprConsent = {
146
151
  gdprApplies: true,
147
152
  consentString: undefined
148
153
  };
149
154
 
150
155
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
151
- expect(userSyncs).to.have.lengthOf(1);
156
+ expect(userSyncs).to.have.lengthOf(2);
152
157
  expect(userSyncs[0].type).to.equal('image');
153
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
158
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
159
+ expect(userSyncs[1].type).to.equal('image');
160
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
154
161
  });
155
162
 
156
- it('should return syncs array with an element of type image when consentString is null', () => {
163
+ it('should return sync array with two elements of type image when consentString is null', () => {
157
164
  gdprConsent = {
158
165
  gdprApplies: true,
159
166
  consentString: null
160
167
  };
161
168
 
162
169
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
163
- expect(userSyncs).to.have.lengthOf(1);
170
+ expect(userSyncs).to.have.lengthOf(2);
164
171
  expect(userSyncs[0].type).to.equal('image');
165
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
172
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
173
+ expect(userSyncs[1].type).to.equal('image');
174
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
166
175
  });
167
176
 
168
- it('should return syncs array with an element of type image when gdprConsent is undefined', () => {
177
+ it('should return sync array with two elements of type image when gdprConsent is undefined', () => {
169
178
  gdprConsent = undefined;
170
179
 
171
180
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
172
- expect(userSyncs).to.have.lengthOf(1);
181
+ expect(userSyncs).to.have.lengthOf(2);
173
182
  expect(userSyncs[0].type).to.equal('image');
174
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
183
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
184
+ expect(userSyncs[1].type).to.equal('image');
185
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
175
186
  });
176
187
 
177
- it('should return syncs array with an element of type image when gdprConsent is null', () => {
188
+ it('should return sync array with two elements of type image when gdprConsent is null', () => {
178
189
  gdprConsent = null;
179
190
 
180
191
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
181
- expect(userSyncs).to.have.lengthOf(1);
192
+ expect(userSyncs).to.have.lengthOf(2);
182
193
  expect(userSyncs[0].type).to.equal('image');
183
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
194
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
195
+ expect(userSyncs[1].type).to.equal('image');
196
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
184
197
  });
185
198
 
186
- it('should return syncs array with an element of type image when gdprConsent is null and gdprApplies is false', () => {
199
+ it('should return sync array with two elements of type image when gdprConsent is null and gdprApplies is false', () => {
187
200
  gdprConsent = {
188
201
  gdprApplies: false,
189
202
  consentString: null
190
203
  };
191
204
 
192
205
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
193
- expect(userSyncs).to.have.lengthOf(1);
206
+ expect(userSyncs).to.have.lengthOf(2);
194
207
  expect(userSyncs[0].type).to.equal('image');
195
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
208
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
209
+ expect(userSyncs[1].type).to.equal('image');
210
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
196
211
  });
197
212
 
198
- it('should return syncs array with an element of type image when gdprConsent is empty string and gdprApplies is false', () => {
213
+ it('should return sync array with two elements of type image when gdprConsent is empty string and gdprApplies is false', () => {
199
214
  gdprConsent = {
200
215
  gdprApplies: false,
201
216
  consentString: ''
202
217
  };
203
218
 
204
219
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
205
- expect(userSyncs).to.have.lengthOf(1);
220
+ expect(userSyncs).to.have.lengthOf(2);
206
221
  expect(userSyncs[0].type).to.equal('image');
207
- expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid');
222
+ expect(userSyncs[0].url).to.equal('https://ms-cookie-sync.presage.io/v1/init-sync/bid-switch?iab_string=&source=prebid')
223
+ expect(userSyncs[1].type).to.equal('image');
224
+ expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
208
225
  });
209
226
  });
210
227
 
@@ -243,6 +260,7 @@ describe('OguryBidAdapter', function () {
243
260
  site: {
244
261
  id: bidRequests[0].params.assetKey,
245
262
  domain: window.location.hostname,
263
+ page: window.location.href
246
264
  },
247
265
  user: {
248
266
  ext: {
@@ -252,15 +270,15 @@ describe('OguryBidAdapter', function () {
252
270
  };
253
271
 
254
272
  it('sends bid request to ENDPOINT via POST', function () {
255
- const validBidRequests = deepClone(bidRequests)
273
+ const validBidRequests = utils.deepClone(bidRequests)
256
274
 
257
275
  const request = spec.buildRequests(validBidRequests, bidderRequest);
258
- expect(request.url).to.equal(BID_HOST);
276
+ expect(request.url).to.equal(BID_URL);
259
277
  expect(request.method).to.equal('POST');
260
278
  });
261
279
 
262
280
  it('bid request object should be conform', function () {
263
- const validBidRequests = deepClone(bidRequests)
281
+ const validBidRequests = utils.deepClone(bidRequests)
264
282
 
265
283
  const request = spec.buildRequests(validBidRequests, bidderRequest);
266
284
  expect(request.data).to.deep.equal(expectedRequestObject);
@@ -298,7 +316,7 @@ describe('OguryBidAdapter', function () {
298
316
  ...expectedRequestObject
299
317
  };
300
318
 
301
- const validBidRequests = deepClone(bidRequests);
319
+ const validBidRequests = utils.deepClone(bidRequests);
302
320
  validBidRequests[1] = {
303
321
  ...validBidRequests[1],
304
322
  getFloor: undefined
@@ -313,7 +331,7 @@ describe('OguryBidAdapter', function () {
313
331
  ...expectedRequestObject
314
332
  };
315
333
 
316
- let validBidRequests = deepClone(bidRequests);
334
+ let validBidRequests = utils.deepClone(bidRequests);
317
335
  validBidRequests[1] = {
318
336
  ...validBidRequests[1],
319
337
  getFloor: 'getFloor'
@@ -324,9 +342,9 @@ describe('OguryBidAdapter', function () {
324
342
  });
325
343
 
326
344
  it('should handle bidFloor when currency is not USD', () => {
327
- const expectedRequestWithUnsupportedFloorCurrency = deepClone(expectedRequestObject)
345
+ const expectedRequestWithUnsupportedFloorCurrency = utils.deepClone(expectedRequestObject)
328
346
  expectedRequestWithUnsupportedFloorCurrency.imp[0].bidfloor = 0;
329
- let validBidRequests = deepClone(bidRequests);
347
+ let validBidRequests = utils.deepClone(bidRequests);
330
348
  validBidRequests[0] = {
331
349
  ...validBidRequests[0],
332
350
  getFloor: ({ size, currency, mediaType }) => {
@@ -453,11 +471,11 @@ describe('OguryBidAdapter', function () {
453
471
  })
454
472
 
455
473
  afterEach(function() {
456
- xhr.restore();
474
+ xhr.restore()
457
475
  })
458
476
 
459
477
  it('Should not create nurl request if bid is undefined', function() {
460
- spec.onBidWon();
478
+ spec.onBidWon()
461
479
  expect(requests.length).to.equal(0);
462
480
  })
463
481
 
@@ -472,5 +490,75 @@ describe('OguryBidAdapter', function () {
472
490
  expect(requests[0].url).to.equal(nurl);
473
491
  expect(requests[0].method).to.equal('GET')
474
492
  })
493
+
494
+ it('Should trigger getWindowContext method', function() {
495
+ const bidSample = {
496
+ id: 'advertId',
497
+ impid: 'bidId',
498
+ price: 100,
499
+ nurl: 'url',
500
+ adm: `<html><head><title>test creative</title></head><body style="margin: 0;"><div><img style="width: 300px; height: 250px;" src="https://assets.afcdn.com/recipe/20190529/93153_w1024h768c1cx2220cy1728cxt0cyt0cxb4441cyb3456.jpg" alt="cookies" /></div></body></html>`,
501
+ adomain: ['renault.fr'],
502
+ ext: {
503
+ adcontent: 'sample_creative',
504
+ advertid: '1a278c48-b79a-4bbf-b69f-3824803e7d87',
505
+ campaignid: '31724',
506
+ mediatype: 'image',
507
+ userid: 'ab4aabed-5230-49d9-9f1a-f06280d28366',
508
+ usersync: true,
509
+ advertiserid: '1',
510
+ isomidcompliant: false
511
+ },
512
+ w: 180,
513
+ h: 101
514
+ }
515
+ spec.onBidWon(bidSample)
516
+ expect(window.top.OG_PREBID_BID_OBJECT).to.deep.equal(bidSample)
517
+ })
475
518
  })
519
+
520
+ describe('getWindowContext', function() {
521
+ it('Should return top window if exist', function() {
522
+ const res = spec.getWindowContext()
523
+ expect(res).to.equal(window.top)
524
+ expect(res).to.not.be.undefined;
525
+ })
526
+
527
+ it('Should return self window if getting top window throw an error', function() {
528
+ const stub = sinon.stub(utils, 'getWindowTop')
529
+ stub.throws()
530
+ const res = spec.getWindowContext()
531
+ expect(res).to.equal(window.self)
532
+ utils.getWindowTop.restore()
533
+ })
534
+ })
535
+
536
+ describe('onTimeout', function () {
537
+ let xhr;
538
+ let requests;
539
+
540
+ beforeEach(function() {
541
+ xhr = sinon.useFakeXMLHttpRequest();
542
+ requests = [];
543
+ xhr.onCreate = (xhr) => {
544
+ requests.push(xhr);
545
+ };
546
+ })
547
+
548
+ afterEach(function() {
549
+ xhr.restore()
550
+ })
551
+
552
+ it('should send notification on bid timeout', function() {
553
+ const bid = {
554
+ ad: '<img style="width: 300px; height: 250px;" src="https://assets.afcdn.com/recipe/20190529/93153_w1024h768c1cx2220cy1728cxt0cyt0cxb4441cyb3456.jpg" alt="cookies" />',
555
+ cpm: 3
556
+ }
557
+ spec.onTimeout(bid);
558
+ expect(requests).to.not.be.undefined;
559
+ expect(requests.length).to.equal(1);
560
+ expect(requests[0].url).to.equal(TIMEOUT_URL);
561
+ expect(requests[0].method).to.equal('POST');
562
+ })
563
+ });
476
564
  });