prebid.js 7.34.0 → 7.35.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 (169) hide show
  1. package/.devcontainer/devcontainer.json +2 -1
  2. package/.github/workflows/issue_tracker.yml +1 -1
  3. package/dist/33acrossBidAdapter.js +1 -1
  4. package/dist/33acrossIdSystem.js +1 -1
  5. package/dist/adagioBidAdapter.js +1 -1
  6. package/dist/adbookpspBidAdapter.js +1 -1
  7. package/dist/adgenerationBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/ajaBidAdapter.js +1 -1
  13. package/dist/amxBidAdapter.js +1 -1
  14. package/dist/amxIdSystem.js +1 -1
  15. package/dist/appierAnalyticsAdapter.js +1 -1
  16. package/dist/appnexusBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/bidglassBidAdapter.js +1 -1
  20. package/dist/big-richmediaBidAdapter.js +1 -1
  21. package/dist/bridgewellBidAdapter.js +1 -1
  22. package/dist/brightMountainMediaBidAdapter.js +1 -1
  23. package/dist/carodaBidAdapter.js +1 -1
  24. package/dist/chtnwBidAdapter.js +1 -1
  25. package/dist/concertBidAdapter.js +1 -1
  26. package/dist/connectadBidAdapter.js +1 -1
  27. package/dist/consentManagement.js +1 -1
  28. package/dist/consumableBidAdapter.js +1 -1
  29. package/dist/conversantBidAdapter.js +1 -1
  30. package/dist/craftBidAdapter.js +1 -1
  31. package/dist/criteoBidAdapter.js +1 -1
  32. package/dist/cwireBidAdapter.js +1 -1
  33. package/dist/dspxBidAdapter.js +1 -1
  34. package/dist/eplanningBidAdapter.js +1 -1
  35. package/dist/feedadBidAdapter.js +1 -1
  36. package/dist/finativeBidAdapter.js +1 -1
  37. package/dist/glimpseBidAdapter.js +1 -1
  38. package/dist/gmosspBidAdapter.js +1 -1
  39. package/dist/goldbachBidAdapter.js +1 -1
  40. package/dist/gridBidAdapter.js +1 -1
  41. package/dist/gridNMBidAdapter.js +1 -1
  42. package/dist/gumgumBidAdapter.js +1 -1
  43. package/dist/h12mediaBidAdapter.js +1 -1
  44. package/dist/hadronIdSystem.js +1 -1
  45. package/dist/id5IdSystem.js +1 -1
  46. package/dist/improvedigitalBidAdapter.js +1 -1
  47. package/dist/inmarBidAdapter.js +1 -1
  48. package/dist/insticatorBidAdapter.js +1 -1
  49. package/dist/ixBidAdapter.js +1 -1
  50. package/dist/justpremiumBidAdapter.js +1 -1
  51. package/dist/konduitAnalyticsAdapter.js +1 -1
  52. package/dist/kueezBidAdapter.js +1 -1
  53. package/dist/kueezRtbBidAdapter.js +1 -1
  54. package/dist/lassoBidAdapter.js +1 -1
  55. package/dist/lifestreetBidAdapter.js +1 -1
  56. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  57. package/dist/logicadBidAdapter.js +1 -1
  58. package/dist/loglyliftBidAdapter.js +1 -1
  59. package/dist/magniteAnalyticsAdapter.js +1 -1
  60. package/dist/malltvAnalyticsAdapter.js +1 -1
  61. package/dist/marsmediaBidAdapter.js +1 -1
  62. package/dist/mediafuseBidAdapter.js +1 -1
  63. package/dist/mediasquareBidAdapter.js +1 -1
  64. package/dist/mgidBidAdapter.js +1 -1
  65. package/dist/minutemediaBidAdapter.js +1 -1
  66. package/dist/nexx360BidAdapter.js +1 -1
  67. package/dist/not-for-prod/prebid.js +127 -137
  68. package/dist/oguryBidAdapter.js +1 -1
  69. package/dist/onetagBidAdapter.js +1 -1
  70. package/dist/ooloAnalyticsAdapter.js +1 -1
  71. package/dist/outbrainBidAdapter.js +1 -1
  72. package/dist/parrableIdSystem.js +1 -1
  73. package/dist/permutiveRtdProvider.js +1 -1
  74. package/dist/pixfutureBidAdapter.js +1 -1
  75. package/dist/prebid-core.js +1 -1
  76. package/dist/priceFloors.js +1 -1
  77. package/dist/publinkIdSystem.js +1 -1
  78. package/dist/pubmaticBidAdapter.js +1 -1
  79. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  80. package/dist/pulsepointBidAdapter.js +1 -1
  81. package/dist/pxyzBidAdapter.js +1 -1
  82. package/dist/quantcastBidAdapter.js +1 -1
  83. package/dist/readpeakBidAdapter.js +1 -1
  84. package/dist/relaidoBidAdapter.js +1 -1
  85. package/dist/rhythmoneBidAdapter.js +1 -1
  86. package/dist/riseBidAdapter.js +1 -1
  87. package/dist/rubiconAnalyticsAdapter.js +1 -1
  88. package/dist/rubiconBidAdapter.js +1 -1
  89. package/dist/seedingAllianceBidAdapter.js +1 -1
  90. package/dist/seedtagBidAdapter.js +1 -1
  91. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  92. package/dist/sharethroughBidAdapter.js +1 -1
  93. package/dist/shinezBidAdapter.js +1 -1
  94. package/dist/smaatoBidAdapter.js +1 -1
  95. package/dist/smartadserverBidAdapter.js +1 -1
  96. package/dist/smartxBidAdapter.js +1 -1
  97. package/dist/smartytechBidAdapter.js +1 -1
  98. package/dist/smilewantedBidAdapter.js +1 -1
  99. package/dist/sonobiBidAdapter.js +1 -1
  100. package/dist/sovrnAnalyticsAdapter.js +1 -1
  101. package/dist/sovrnBidAdapter.js +1 -1
  102. package/dist/sspBCBidAdapter.js +1 -1
  103. package/dist/sublimeBidAdapter.js +1 -1
  104. package/dist/synacormediaBidAdapter.js +1 -1
  105. package/dist/taboolaBidAdapter.js +1 -1
  106. package/dist/targetVideoBidAdapter.js +1 -1
  107. package/dist/teadsBidAdapter.js +1 -1
  108. package/dist/trionBidAdapter.js +1 -1
  109. package/dist/tripleliftBidAdapter.js +1 -1
  110. package/dist/ttdBidAdapter.js +1 -1
  111. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  112. package/dist/uid2IdSystem.js +1 -1
  113. package/dist/underdogmediaBidAdapter.js +1 -1
  114. package/dist/undertoneBidAdapter.js +1 -1
  115. package/dist/vidazooBidAdapter.js +1 -1
  116. package/dist/videobyteBidAdapter.js +1 -1
  117. package/dist/visxBidAdapter.js +1 -1
  118. package/dist/vuukleBidAdapter.js +1 -1
  119. package/dist/widespaceBidAdapter.js +1 -1
  120. package/dist/winrBidAdapter.js +1 -1
  121. package/dist/yahoosspBidAdapter.js +1 -1
  122. package/dist/yieldmoBidAdapter.js +1 -1
  123. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  124. package/dist/zeta_global_sspBidAdapter.js +1 -1
  125. package/dist/zeusPrimeRtdProvider.js +4 -14
  126. package/integrationExamples/gpt/hello_world.html +0 -0
  127. package/modules/adyoulikeBidAdapter.js +2 -0
  128. package/modules/consentManagement.js +33 -5
  129. package/modules/cwireBidAdapter.js +169 -242
  130. package/modules/cwireBidAdapter.md +15 -14
  131. package/modules/hadronIdSystem.js +37 -32
  132. package/modules/nexx360BidAdapter.js +1 -2
  133. package/modules/onetagBidAdapter.js +12 -1
  134. package/modules/outbrainBidAdapter.js +103 -6
  135. package/modules/permutiveRtdProvider.js +17 -12
  136. package/modules/priceFloors.js +7 -8
  137. package/modules/pulsepointBidAdapter.js +2 -0
  138. package/modules/smartadserverBidAdapter.js +39 -28
  139. package/modules/smartyadsBidAdapter.md +9 -0
  140. package/modules/smartytechBidAdapter.js +67 -10
  141. package/modules/smartytechBidAdapter.md +44 -33
  142. package/modules/sonobiBidAdapter.js +17 -10
  143. package/modules/taboolaBidAdapter.js +2 -1
  144. package/modules/vidazooBidAdapter.js +56 -22
  145. package/modules/zeta_global_sspBidAdapter.js +15 -0
  146. package/modules/zeusPrimeRtdProvider.js +3 -323
  147. package/modules/zeusPrimeRtdProvider.md +3 -0
  148. package/package.json +1 -1
  149. package/src/auction.js +2 -11
  150. package/src/prebid.js +8 -0
  151. package/src/utils/cpm.js +17 -0
  152. package/test/spec/modules/adyoulikeBidAdapter_spec.js +3 -0
  153. package/test/spec/modules/consentManagement_spec.js +49 -1
  154. package/test/spec/modules/cwireBidAdapter_spec.js +249 -335
  155. package/test/spec/modules/hadronIdSystem_spec.js +4 -6
  156. package/test/spec/modules/nexx360BidAdapter_spec.js +0 -4
  157. package/test/spec/modules/onetagBidAdapter_spec.js +43 -0
  158. package/test/spec/modules/outbrainBidAdapter_spec.js +182 -18
  159. package/test/spec/modules/pulsepointBidAdapter_spec.js +11 -1
  160. package/test/spec/modules/smartadserverBidAdapter_spec.js +116 -5
  161. package/test/spec/modules/smartytechBidAdapter_spec.js +172 -14
  162. package/test/spec/modules/sonobiBidAdapter_spec.js +2 -1
  163. package/test/spec/modules/taboolaBidAdapter_spec.js +12 -3
  164. package/test/spec/modules/userId_spec.js +19 -14
  165. package/test/spec/modules/vidazooBidAdapter_spec.js +61 -22
  166. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +8 -0
  167. package/test/spec/unit/pbjs_api_spec.js +14 -0
  168. package/test/spec/unit/utils/cpm_spec.js +64 -0
  169. package/test/spec/modules/zeusPrimeRtdProvider_spec.js +0 -410
@@ -372,7 +372,6 @@ describe('Nexx360 bid adapter tests', function () {
372
372
  }
373
373
  };
374
374
  const output = spec.interpretResponse(response);
375
- expect(output[0].bidderCode).to.be.eql('nexx360');
376
375
  expect(output[0].adUrl).to.be.eql(response.body.seatbid[0].bid[0].adUrl);
377
376
  expect(output[0].mediaType).to.be.eql(response.body.seatbid[0].bid[0].type);
378
377
  expect(output[0].currency).to.be.eql(response.body.cur);
@@ -411,7 +410,6 @@ describe('Nexx360 bid adapter tests', function () {
411
410
  }
412
411
  };
413
412
  const output = spec.interpretResponse(response);
414
- expect(output[0].bidderCode).to.be.eql('nexx360');
415
413
  expect(output[0].vastXml).to.be.eql(response.body.seatbid[0].bid[0].vastXml);
416
414
  expect(output[0].mediaType).to.be.eql('video');
417
415
  expect(output[0].currency).to.be.eql(response.body.cur);
@@ -454,7 +452,6 @@ describe('Nexx360 bid adapter tests', function () {
454
452
  }
455
453
  };
456
454
  const output = spec.interpretResponse(response);
457
- expect(output[0].bidderCode).to.be.eql('nexx360');
458
455
  expect(output[0].adUrl).to.be.eql(response.body.seatbid[0].bid[0].adUrl);
459
456
  expect(output[0].mediaType).to.be.eql(response.body.seatbid[0].bid[0].type);
460
457
  expect(output[0].currency).to.be.eql(response.body.cur);
@@ -490,7 +487,6 @@ describe('Nexx360 bid adapter tests', function () {
490
487
  }
491
488
  };
492
489
  const output = spec.interpretResponse(response);
493
- expect(output[0].bidderCode).to.be.eql('nexx360');
494
490
  expect(output[0].vastXml).to.be.eql(response.body.seatbid[0].bid[0].vastXml);
495
491
  expect(output[0].mediaType).to.be.eql('video');
496
492
  expect(output[0].currency).to.be.eql(response.body.cur);
@@ -266,6 +266,27 @@ describe('onetag', function () {
266
266
  expect(payload.gdprConsent.consentString).to.exist.and.to.equal(consentString);
267
267
  expect(payload.gdprConsent.consentRequired).to.exist.and.to.be.true;
268
268
  });
269
+ it('Should send GPP consent data', function () {
270
+ let consentString = 'consentString';
271
+ let applicableSections = [1, 2, 3];
272
+ let bidderRequest = {
273
+ 'bidderCode': 'onetag',
274
+ 'auctionId': '1d1a030790a475',
275
+ 'bidderRequestId': '22edbae2733bf6',
276
+ 'timeout': 3000,
277
+ 'gppConsent': {
278
+ gppString: consentString,
279
+ applicableSections: applicableSections
280
+ }
281
+ };
282
+ let serverRequest = spec.buildRequests([bannerBid], bidderRequest);
283
+ const payload = JSON.parse(serverRequest.data);
284
+
285
+ expect(payload).to.exist;
286
+ expect(payload.gppConsent).to.exist;
287
+ expect(payload.gppConsent.consentString).to.exist.and.to.equal(consentString);
288
+ expect(payload.gppConsent.applicableSections).to.have.same.members(applicableSections);
289
+ });
269
290
  it('Should send us privacy string', function () {
270
291
  let consentString = 'us_foo';
271
292
  let bidderRequest = {
@@ -375,6 +396,28 @@ describe('onetag', function () {
375
396
  expect(syncs[0].url).to.include(sync_endpoint);
376
397
  expect(syncs[0].url).to.not.match(/(?:[?&](?:gdpr_consent=([^&]*)|gdpr=([^&]*)))+$/);
377
398
  });
399
+ it('Must pass gpp consent string when gppConsent object is available', function () {
400
+ const syncs = spec.getUserSyncs({ iframeEnabled: true }, {}, {}, {}, {
401
+ gppString: 'foo'
402
+ });
403
+ expect(syncs[0].type).to.equal('iframe');
404
+ expect(syncs[0].url).to.include(sync_endpoint);
405
+ expect(syncs[0].url).to.match(/(?:[?&](?:gpp_consent=foo([^&]*)))+$/);
406
+ });
407
+ it('Must pass no gpp params when consentString is null', function () {
408
+ const syncs = spec.getUserSyncs({ iframeEnabled: true }, {}, {}, {}, {
409
+ gppString: null
410
+ });
411
+ expect(syncs[0].type).to.equal('iframe');
412
+ expect(syncs[0].url).to.include(sync_endpoint);
413
+ expect(syncs[0].url).to.not.match(/(?:[?&](?:gpp_consent=([^&]*)))+$/);
414
+ });
415
+ it('Must pass no gpp params when consentString is empty', function () {
416
+ const syncs = spec.getUserSyncs({ iframeEnabled: true }, {}, {}, {}, {});
417
+ expect(syncs[0].type).to.equal('iframe');
418
+ expect(syncs[0].url).to.include(sync_endpoint);
419
+ expect(syncs[0].url).to.not.match(/(?:[?&](?:gpp_consent=([^&]*)))+$/);
420
+ });
378
421
  it('Should send us privacy string', function () {
379
422
  let usConsentString = 'us_foo';
380
423
  const syncs = spec.getUserSyncs({ iframeEnabled: true }, {}, {}, usConsentString);
@@ -1,7 +1,7 @@
1
- import {expect} from 'chai';
2
- import {spec} from 'modules/outbrainBidAdapter.js';
3
- import {config} from 'src/config.js';
4
- import {server} from 'test/mocks/xhr';
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/outbrainBidAdapter.js';
3
+ import { config } from 'src/config.js';
4
+ import { server } from 'test/mocks/xhr';
5
5
  import { createEidsArray } from 'modules/userId/eids.js';
6
6
 
7
7
  describe('Outbrain Adapter', function () {
@@ -45,6 +45,26 @@ describe('Outbrain Adapter', function () {
45
45
  ]
46
46
  }
47
47
 
48
+ const videoBidRequestParams = {
49
+ mediaTypes: {
50
+ video: {
51
+ playerSize: [[640, 480]],
52
+ mimes: ['video/mp4'],
53
+ protocols: [1, 2, 3, 4, 5, 6, 7, 8],
54
+ playbackmethod: [1],
55
+ skip: 1,
56
+ api: [2],
57
+ minbitrate: 1000,
58
+ maxbitrate: 3000,
59
+ minduration: 3,
60
+ maxduration: 10,
61
+ startdelay: 2,
62
+ placement: 4,
63
+ linearity: 1
64
+ }
65
+ }
66
+ }
67
+
48
68
  describe('isBidRequestValid', function () {
49
69
  before(() => {
50
70
  config.setConfig({
@@ -93,6 +113,34 @@ describe('Outbrain Adapter', function () {
93
113
  }
94
114
  expect(spec.isBidRequestValid(bid)).to.equal(true)
95
115
  })
116
+ it('should succeed when bid contains video', function () {
117
+ const bid = {
118
+ bidder: 'outbrain',
119
+ params: {
120
+ publisher: {
121
+ id: 'publisher-id',
122
+ }
123
+ },
124
+ ...videoBidRequestParams,
125
+ }
126
+ expect(spec.isBidRequestValid(bid)).to.equal(true)
127
+ })
128
+ it('should fail when bid contains insufficient video information', function () {
129
+ const bid = {
130
+ bidder: 'outbrain',
131
+ params: {
132
+ publisher: {
133
+ id: 'publisher-id',
134
+ }
135
+ },
136
+ mediaTypes: {
137
+ video: {
138
+ context: 'outstream'
139
+ }
140
+ },
141
+ }
142
+ expect(spec.isBidRequestValid(bid)).to.equal(false)
143
+ })
96
144
  it('should fail if publisher id is not set', function () {
97
145
  const bid = {
98
146
  bidder: 'outbrain',
@@ -298,6 +346,61 @@ describe('Outbrain Adapter', function () {
298
346
  expect(res.data).to.deep.equal(JSON.stringify(expectedData))
299
347
  })
300
348
 
349
+ it('should build video request', function () {
350
+ const bidRequest = {
351
+ ...commonBidRequest,
352
+ ...videoBidRequestParams,
353
+ }
354
+ const expectedData = {
355
+ site: {
356
+ page: 'https://example.com/',
357
+ publisher: {
358
+ id: 'publisher-id'
359
+ }
360
+ },
361
+ device: {
362
+ ua: navigator.userAgent
363
+ },
364
+ source: {
365
+ fd: 1
366
+ },
367
+ cur: [
368
+ 'USD'
369
+ ],
370
+ imp: [
371
+ {
372
+ id: '1',
373
+ video: {
374
+ w: 640,
375
+ h: 480,
376
+ protocols: [1, 2, 3, 4, 5, 6, 7, 8],
377
+ playbackmethod: [1],
378
+ mimes: ['video/mp4'],
379
+ skip: 1,
380
+ api: [2],
381
+ minbitrate: 1000,
382
+ maxbitrate: 3000,
383
+ minduration: 3,
384
+ maxduration: 10,
385
+ startdelay: 2,
386
+ placement: 4,
387
+ linearity: 1
388
+ }
389
+ }
390
+ ],
391
+ ext: {
392
+ prebid: {
393
+ channel: {
394
+ name: 'pbjs', version: '$prebid.version$'
395
+ }
396
+ }
397
+ }
398
+ }
399
+ const res = spec.buildRequests([bidRequest], commonBidderRequest)
400
+ expect(res.url).to.equal('https://bidder-url.com')
401
+ expect(res.data).to.deep.equal(JSON.stringify(expectedData))
402
+ })
403
+
301
404
  it('should pass optional parameters in request', function () {
302
405
  const bidRequest = {
303
406
  ...commonBidRequest,
@@ -390,7 +493,7 @@ describe('Outbrain Adapter', function () {
390
493
  ...commonBidRequest,
391
494
  ...nativeBidRequestParams,
392
495
  }
393
- config.setConfig({coppa: true})
496
+ config.setConfig({ coppa: true })
394
497
 
395
498
  const res = spec.buildRequests([bidRequest], commonBidderRequest)
396
499
  const resData = JSON.parse(res.data)
@@ -412,7 +515,7 @@ describe('Outbrain Adapter', function () {
412
515
  let res = spec.buildRequests([bidRequest], commonBidderRequest);
413
516
  const resData = JSON.parse(res.data)
414
517
  expect(resData.user.ext.eids).to.deep.equal([
415
- {source: 'liveramp.com', uids: [{id: 'id-value', atype: 3}]}
518
+ { source: 'liveramp.com', uids: [{ id: 'id-value', atype: 3 }] }
416
519
  ]);
417
520
  });
418
521
 
@@ -421,7 +524,7 @@ describe('Outbrain Adapter', function () {
421
524
  ...commonBidRequest,
422
525
  ...nativeBidRequestParams,
423
526
  }
424
- bidRequest.getFloor = function() {
527
+ bidRequest.getFloor = function () {
425
528
  return {
426
529
  currency: 'USD',
427
530
  floor: 1.23,
@@ -619,6 +722,67 @@ describe('Outbrain Adapter', function () {
619
722
  const res = spec.interpretResponse(serverResponse, request)
620
723
  expect(res).to.deep.equal(expectedRes)
621
724
  });
725
+
726
+ it('should interpret video response', function () {
727
+ const serverResponse = {
728
+ body: {
729
+ id: '123',
730
+ seatbid: [
731
+ {
732
+ bid: [
733
+ {
734
+ id: '111',
735
+ impid: '1',
736
+ price: 1.1,
737
+ adm: '\u003cVAST version="3.0"\u003e\u003cAd\u003e\u003cInLine\u003e\u003cAdSystem\u003ezemanta\u003c/AdSystem\u003e\u003cAdTitle\u003e1\u003c/AdTitle\u003e\u003cImpression\u003ehttp://win.com\u003c/Impression\u003e\u003cImpression\u003ehttp://example.com/imptracker\u003c/Impression\u003e\u003cCreatives\u003e\u003cCreative\u003e\u003cLinear\u003e\u003cDuration\u003e00:00:25\u003c/Duration\u003e\u003cTrackingEvents\u003e\u003cTracking event="start"\u003ehttp://example.com/start\u003c/Tracking\u003e\u003cTracking event="progress" offset="00:00:03"\u003ehttp://example.com/p3s\u003c/Tracking\u003e\u003c/TrackingEvents\u003e\u003cVideoClicks\u003e\u003cClickThrough\u003ehttp://link.com\u003c/ClickThrough\u003e\u003c/VideoClicks\u003e\u003cMediaFiles\u003e\u003cMediaFile delivery="progressive" type="video/mp4" bitrate="700" width="640" height="360"\u003ehttps://example.com/123_360p.mp4\u003c/MediaFile\u003e\u003c/MediaFiles\u003e\u003c/Linear\u003e\u003c/Creative\u003e\u003c/Creatives\u003e\u003c/InLine\u003e\u003c/Ad\u003e\u003c/VAST\u003e',
738
+ adid: '100',
739
+ cid: '5',
740
+ crid: '29998660',
741
+ cat: ['cat-1'],
742
+ adomain: [
743
+ 'example.com'
744
+ ],
745
+ nurl: 'http://example.com/win/${AUCTION_PRICE}'
746
+ }
747
+ ],
748
+ seat: '100',
749
+ group: 1
750
+ }
751
+ ],
752
+ bidid: '456',
753
+ cur: 'USD'
754
+ }
755
+ }
756
+ const request = {
757
+ bids: [
758
+ {
759
+ ...commonBidRequest,
760
+ ...videoBidRequestParams
761
+ }
762
+ ]
763
+ }
764
+ const expectedRes = [
765
+ {
766
+ requestId: request.bids[0].bidId,
767
+ cpm: 1.1,
768
+ creativeId: '29998660',
769
+ ttl: 360,
770
+ netRevenue: false,
771
+ currency: 'USD',
772
+ mediaType: 'video',
773
+ nurl: 'http://example.com/win/${AUCTION_PRICE}',
774
+ vastXml: '<VAST version=\"3.0\"><Ad><InLine><AdSystem>zemanta</AdSystem><AdTitle>1</AdTitle><Impression>http://win.com</Impression><Impression>http://example.com/imptracker</Impression><Creatives><Creative><Linear><Duration>00:00:25</Duration><TrackingEvents><Tracking event=\"start\">http://example.com/start</Tracking><Tracking event=\"progress\" offset=\"00:00:03\">http://example.com/p3s</Tracking></TrackingEvents><VideoClicks><ClickThrough>http://link.com</ClickThrough></VideoClicks><MediaFiles><MediaFile delivery=\"progressive\" type=\"video/mp4\" bitrate=\"700\" width=\"640\" height=\"360\">https://example.com/123_360p.mp4</MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>',
775
+ meta: {
776
+ 'advertiserDomains': [
777
+ 'example.com'
778
+ ]
779
+ },
780
+ }
781
+ ]
782
+
783
+ const res = spec.interpretResponse(serverResponse, request)
784
+ expect(res).to.deep.equal(expectedRes)
785
+ });
622
786
  })
623
787
  })
624
788
 
@@ -637,41 +801,41 @@ describe('Outbrain Adapter', function () {
637
801
  })
638
802
 
639
803
  it('should return user sync if pixel enabled with outbrain config', function () {
640
- const ret = spec.getUserSyncs({pixelEnabled: true})
641
- expect(ret).to.deep.equal([{type: 'image', url: usersyncUrl}])
804
+ const ret = spec.getUserSyncs({ pixelEnabled: true })
805
+ expect(ret).to.deep.equal([{ type: 'image', url: usersyncUrl }])
642
806
  })
643
807
 
644
808
  it('should not return user sync if pixel disabled', function () {
645
- const ret = spec.getUserSyncs({pixelEnabled: false})
809
+ const ret = spec.getUserSyncs({ pixelEnabled: false })
646
810
  expect(ret).to.be.an('array').that.is.empty
647
811
  })
648
812
 
649
813
  it('should not return user sync if url is not set', function () {
650
814
  config.resetConfig()
651
- const ret = spec.getUserSyncs({pixelEnabled: true})
815
+ const ret = spec.getUserSyncs({ pixelEnabled: true })
652
816
  expect(ret).to.be.an('array').that.is.empty
653
817
  })
654
818
 
655
- it('should pass GDPR consent', function() {
656
- expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, undefined)).to.deep.equal([{
819
+ it('should pass GDPR consent', function () {
820
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, { gdprApplies: true, consentString: 'foo' }, undefined)).to.deep.equal([{
657
821
  type: 'image', url: `${usersyncUrl}?gdpr=1&gdpr_consent=foo`
658
822
  }]);
659
- expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: false, consentString: 'foo'}, undefined)).to.deep.equal([{
823
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, { gdprApplies: false, consentString: 'foo' }, undefined)).to.deep.equal([{
660
824
  type: 'image', url: `${usersyncUrl}?gdpr=0&gdpr_consent=foo`
661
825
  }]);
662
- expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: undefined}, undefined)).to.deep.equal([{
826
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, { gdprApplies: true, consentString: undefined }, undefined)).to.deep.equal([{
663
827
  type: 'image', url: `${usersyncUrl}?gdpr=1&gdpr_consent=`
664
828
  }]);
665
829
  });
666
830
 
667
- it('should pass US consent', function() {
831
+ it('should pass US consent', function () {
668
832
  expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined, '1NYN')).to.deep.equal([{
669
833
  type: 'image', url: `${usersyncUrl}?us_privacy=1NYN`
670
834
  }]);
671
835
  });
672
836
 
673
- it('should pass GDPR and US consent', function() {
674
- expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: 'foo'}, '1NYN')).to.deep.equal([{
837
+ it('should pass GDPR and US consent', function () {
838
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, { gdprApplies: true, consentString: 'foo' }, '1NYN')).to.deep.equal([{
675
839
  type: 'image', url: `${usersyncUrl}?gdpr=1&gdpr_consent=foo&us_privacy=1NYN`
676
840
  }]);
677
841
  });
@@ -2,7 +2,6 @@
2
2
  import {expect} from 'chai';
3
3
  import {spec} from 'modules/pulsepointBidAdapter.js';
4
4
  import {deepClone} from 'src/utils.js';
5
- import { config } from 'src/config.js';
6
5
 
7
6
  describe('PulsePoint Adapter Tests', function () {
8
7
  const slotConfigs = [{
@@ -225,6 +224,8 @@ describe('PulsePoint Adapter Tests', function () {
225
224
  expect(ortbRequest.imp[1].banner).to.not.equal(null);
226
225
  expect(ortbRequest.imp[1].banner.w).to.equal(728);
227
226
  expect(ortbRequest.imp[1].banner.h).to.equal(90);
227
+ // tmax
228
+ expect(ortbRequest.tmax).to.equal(500);
228
229
  });
229
230
 
230
231
  it('Verify parse response', function () {
@@ -918,4 +919,13 @@ describe('PulsePoint Adapter Tests', function () {
918
919
  }
919
920
  });
920
921
  });
922
+
923
+ it('Verify bid request timeouts', function () {
924
+ const mkRequest = (bidderRequest) => spec.buildRequests(slotConfigs, bidderRequest).data;
925
+ // assert default is used when no bidderRequest.timeout value is available
926
+ expect(mkRequest(bidderRequest).tmax).to.equal(500)
927
+
928
+ // assert bidderRequest value is used when available
929
+ expect(mkRequest(Object.assign({}, { timeout: 6000 }, bidderRequest)).tmax).to.equal(6000)
930
+ });
921
931
  });
@@ -1,4 +1,5 @@
1
1
  import { expect } from 'chai';
2
+ import { BANNER, VIDEO } from 'src/mediaTypes.js';
2
3
  import { config } from 'src/config.js';
3
4
  import { spec } from 'modules/smartadserverBidAdapter.js';
4
5
 
@@ -394,7 +395,6 @@ describe('Smart bid adapter tests', function () {
394
395
  afterEach(function () {
395
396
  config.setConfig({ ortb2: undefined });
396
397
  config.resetConfig();
397
- $$PREBID_GLOBAL$$.requestBids.removeAll();
398
398
  });
399
399
 
400
400
  it('Verify build request with GDPR', function () {
@@ -443,10 +443,33 @@ describe('Smart bid adapter tests', function () {
443
443
  });
444
444
  });
445
445
 
446
+ describe('GPP', function () {
447
+ it('should be added to payload when gppConsent available in bidder request', function () {
448
+ const options = {
449
+ gppConsent: {
450
+ gppString: 'some-gpp-string',
451
+ applicableSections: [3, 5]
452
+ }
453
+ };
454
+ const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, options);
455
+ const payload = JSON.parse(request[0].data);
456
+
457
+ expect(payload).to.have.property('gpp').and.to.equal(options.gppConsent.gppString);
458
+ expect(payload).to.have.property('gpp_sid').and.to.be.an('array');
459
+ expect(payload.gpp_sid).to.have.lengthOf(2).and.to.deep.equal(options.gppConsent.applicableSections);
460
+ });
461
+
462
+ it('should be undefined on payload when gppConsent unavailable in bidder request', function () {
463
+ const request = spec.buildRequests(DEFAULT_PARAMS_WO_OPTIONAL, {});
464
+ const payload = JSON.parse(request[0].data);
465
+
466
+ expect(payload.gpp).to.be.undefined;
467
+ });
468
+ });
469
+
446
470
  describe('ccpa/us privacy tests', function () {
447
471
  afterEach(function () {
448
472
  config.resetConfig();
449
- $$PREBID_GLOBAL$$.requestBids.removeAll();
450
473
  });
451
474
 
452
475
  it('Verify build request with us privacy', function () {
@@ -475,7 +498,6 @@ describe('Smart bid adapter tests', function () {
475
498
  describe('Instream video tests', function () {
476
499
  afterEach(function () {
477
500
  config.resetConfig();
478
- $$PREBID_GLOBAL$$.requestBids.removeAll();
479
501
  });
480
502
 
481
503
  const INSTREAM_DEFAULT_PARAMS = [{
@@ -746,7 +768,6 @@ describe('Smart bid adapter tests', function () {
746
768
  describe('Outstream video tests', function () {
747
769
  afterEach(function () {
748
770
  config.resetConfig();
749
- $$PREBID_GLOBAL$$.requestBids.removeAll();
750
771
  });
751
772
 
752
773
  const OUTSTREAM_DEFAULT_PARAMS = [{
@@ -1055,6 +1076,17 @@ describe('Smart bid adapter tests', function () {
1055
1076
  });
1056
1077
 
1057
1078
  describe('Floors module', function () {
1079
+ const getFloor = (bid) => {
1080
+ switch (bid.mediaType) {
1081
+ case BANNER:
1082
+ return { currency: 'USD', floor: 1.93 };
1083
+ case VIDEO:
1084
+ return { currency: 'USD', floor: 2.72 };
1085
+ default:
1086
+ return {};
1087
+ }
1088
+ };
1089
+
1058
1090
  it('should include floor from bid params', function() {
1059
1091
  const bidRequest = JSON.parse((spec.buildRequests(DEFAULT_PARAMS))[0].data);
1060
1092
  expect(bidRequest.bidfloor).to.deep.equal(DEFAULT_PARAMS[0].params.bidfloor);
@@ -1094,12 +1126,91 @@ describe('Smart bid adapter tests', function () {
1094
1126
  const floor = spec.getBidFloor(bidRequest, null);
1095
1127
  expect(floor).to.deep.equal(0);
1096
1128
  });
1129
+
1130
+ it('should take floor from bidder params over ad unit', function() {
1131
+ const bidRequest = [{
1132
+ mediaTypes: {
1133
+ banner: {
1134
+ sizes: [[300, 250]]
1135
+ }
1136
+ },
1137
+ getFloor,
1138
+ params: { siteId: 1234, pageId: 678, formatId: 73, bidfloor: 1.25 }
1139
+ }];
1140
+
1141
+ const request = spec.buildRequests(bidRequest);
1142
+ const requestContent = JSON.parse(request[0].data);
1143
+
1144
+ expect(requestContent).to.have.property('bidfloor').and.to.equal(1.25);
1145
+ });
1146
+
1147
+ it('should take floor from banner ad unit', function() {
1148
+ const bidRequest = [{
1149
+ mediaTypes: {
1150
+ banner: {
1151
+ sizes: [[300, 250], [300, 600]]
1152
+ }
1153
+ },
1154
+ getFloor,
1155
+ params: { siteId: 1234, pageId: 678, formatId: 73 }
1156
+ }];
1157
+
1158
+ const request = spec.buildRequests(bidRequest);
1159
+ const requestContent = JSON.parse(request[0].data);
1160
+
1161
+ expect(requestContent).to.have.property('bidfloor').and.to.equal(1.93);
1162
+ });
1163
+
1164
+ it('should take floor from video ad unit', function() {
1165
+ const bidRequest = [{
1166
+ mediaTypes: {
1167
+ video: {
1168
+ context: 'outstream',
1169
+ playerSize: [[640, 480]]
1170
+ }
1171
+ },
1172
+ getFloor,
1173
+ params: { siteId: 1234, pageId: 678, formatId: 73 }
1174
+ }];
1175
+
1176
+ const request = spec.buildRequests(bidRequest);
1177
+ const requestContent = JSON.parse(request[0].data);
1178
+
1179
+ expect(requestContent).to.have.property('bidfloor').and.to.equal(2.72);
1180
+ });
1181
+
1182
+ it('should take floor from multiple media type ad unit', function() {
1183
+ const bidRequest = [{
1184
+ mediaTypes: {
1185
+ banner: {
1186
+ sizes: [[300, 600]]
1187
+ },
1188
+ video: {
1189
+ context: 'outstream',
1190
+ playerSize: [[640, 480]]
1191
+ }
1192
+ },
1193
+ getFloor,
1194
+ params: { siteId: 1234, pageId: 678, formatId: 73 }
1195
+ }];
1196
+
1197
+ const requests = spec.buildRequests(bidRequest);
1198
+ expect(requests).to.have.lengthOf(2);
1199
+
1200
+ const requestContents = requests.map(r => JSON.parse(r.data));
1201
+ const videoRequest = requestContents.filter(r => r.videoData)[0];
1202
+ expect(videoRequest).to.not.equal(null).and.to.not.be.undefined;
1203
+ expect(videoRequest).to.have.property('bidfloor').and.to.equal(2.72);
1204
+
1205
+ const bannerRequest = requestContents.filter(r => !r.videoData)[0];
1206
+ expect(bannerRequest).to.not.equal(null).and.to.not.be.undefined;
1207
+ expect(bannerRequest).to.have.property('bidfloor').and.to.equal(1.93);
1208
+ });
1097
1209
  });
1098
1210
 
1099
1211
  describe('Verify bid requests with multiple mediaTypes', function () {
1100
1212
  afterEach(function () {
1101
1213
  config.resetConfig();
1102
- $$PREBID_GLOBAL$$.requestBids.removeAll();
1103
1214
  });
1104
1215
 
1105
1216
  var DEFAULT_PARAMS_MULTIPLE_MEDIA_TYPES = [{