prebid.js 7.24.0 → 7.26.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 (191) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/adagioBidAdapter.js +1 -1
  3. package/dist/adbookpspBidAdapter.js +1 -1
  4. package/dist/adgenerationBidAdapter.js +1 -1
  5. package/dist/admaticBidAdapter.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adtrgtmeBidAdapter.js +1 -1
  8. package/dist/adxcgBidAdapter.js +1 -1
  9. package/dist/ajaBidAdapter.js +1 -1
  10. package/dist/amxBidAdapter.js +1 -1
  11. package/dist/amxIdSystem.js +1 -1
  12. package/dist/appierAnalyticsAdapter.js +1 -1
  13. package/dist/appnexusBidAdapter.js +1 -1
  14. package/dist/asoBidAdapter.js +1 -1
  15. package/dist/axonixBidAdapter.js +1 -1
  16. package/dist/beopBidAdapter.js +1 -1
  17. package/dist/bidglassBidAdapter.js +1 -1
  18. package/dist/big-richmediaBidAdapter.js +1 -1
  19. package/dist/bridgewellBidAdapter.js +1 -1
  20. package/dist/brightMountainMediaBidAdapter.js +1 -1
  21. package/dist/captifyRtdProvider.js +1 -0
  22. package/dist/carodaBidAdapter.js +1 -1
  23. package/dist/chtnwBidAdapter.js +1 -1
  24. package/dist/concertBidAdapter.js +1 -1
  25. package/dist/connectadBidAdapter.js +1 -1
  26. package/dist/consumableBidAdapter.js +1 -1
  27. package/dist/conversantBidAdapter.js +1 -1
  28. package/dist/craftBidAdapter.js +1 -1
  29. package/dist/criteoBidAdapter.js +1 -1
  30. package/dist/discoveryBidAdapter.js +1 -1
  31. package/dist/dspxBidAdapter.js +1 -1
  32. package/dist/eplanningBidAdapter.js +1 -1
  33. package/dist/finativeBidAdapter.js +1 -1
  34. package/dist/glimpseBidAdapter.js +1 -1
  35. package/dist/gmosspBidAdapter.js +1 -1
  36. package/dist/goldbachBidAdapter.js +1 -1
  37. package/dist/gridBidAdapter.js +1 -1
  38. package/dist/gridNMBidAdapter.js +1 -1
  39. package/dist/gumgumBidAdapter.js +1 -1
  40. package/dist/h12mediaBidAdapter.js +1 -1
  41. package/dist/id5IdSystem.js +1 -1
  42. package/dist/improvedigitalBidAdapter.js +1 -1
  43. package/dist/inmarBidAdapter.js +1 -1
  44. package/dist/insticatorBidAdapter.js +1 -1
  45. package/dist/ixBidAdapter.js +1 -1
  46. package/dist/justpremiumBidAdapter.js +1 -1
  47. package/dist/kargoBidAdapter.js +1 -1
  48. package/dist/konduitAnalyticsAdapter.js +1 -1
  49. package/dist/kueezBidAdapter.js +1 -1
  50. package/dist/kueezRtbBidAdapter.js +1 -1
  51. package/dist/lassoBidAdapter.js +1 -1
  52. package/dist/lifestreetBidAdapter.js +1 -1
  53. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  54. package/dist/logicadBidAdapter.js +1 -1
  55. package/dist/loglyliftBidAdapter.js +1 -1
  56. package/dist/magniteAnalyticsAdapter.js +1 -1
  57. package/dist/malltvAnalyticsAdapter.js +1 -1
  58. package/dist/marsmediaBidAdapter.js +1 -1
  59. package/dist/mediafuseBidAdapter.js +1 -1
  60. package/dist/mediasquareBidAdapter.js +1 -1
  61. package/dist/mgidBidAdapter.js +1 -1
  62. package/dist/microadBidAdapter.js +1 -1
  63. package/dist/minutemediaBidAdapter.js +1 -1
  64. package/dist/nextMillenniumBidAdapter.js +1 -1
  65. package/dist/not-for-prod/prebid.js +154 -120
  66. package/dist/oguryBidAdapter.js +1 -1
  67. package/dist/onetagBidAdapter.js +1 -1
  68. package/dist/ooloAnalyticsAdapter.js +1 -1
  69. package/dist/outbrainBidAdapter.js +1 -1
  70. package/dist/parrableIdSystem.js +1 -1
  71. package/dist/pixfutureBidAdapter.js +1 -1
  72. package/dist/prebid-core.js +1 -1
  73. package/dist/publinkIdSystem.js +1 -1
  74. package/dist/pubmaticBidAdapter.js +1 -1
  75. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  76. package/dist/pxyzBidAdapter.js +1 -1
  77. package/dist/quantcastBidAdapter.js +1 -1
  78. package/dist/readpeakBidAdapter.js +1 -1
  79. package/dist/relaidoBidAdapter.js +1 -1
  80. package/dist/rhythmoneBidAdapter.js +1 -1
  81. package/dist/riseBidAdapter.js +1 -1
  82. package/dist/rubiconAnalyticsAdapter.js +1 -1
  83. package/dist/rubiconBidAdapter.js +1 -1
  84. package/dist/seedingAllianceBidAdapter.js +1 -1
  85. package/dist/seedtagBidAdapter.js +1 -1
  86. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  87. package/dist/sharethroughBidAdapter.js +1 -1
  88. package/dist/shinezBidAdapter.js +1 -1
  89. package/dist/smaatoBidAdapter.js +1 -1
  90. package/dist/smartadserverBidAdapter.js +1 -1
  91. package/dist/smartxBidAdapter.js +1 -1
  92. package/dist/smartytechBidAdapter.js +1 -0
  93. package/dist/smilewantedBidAdapter.js +1 -1
  94. package/dist/sonobiBidAdapter.js +1 -1
  95. package/dist/sovrnAnalyticsAdapter.js +1 -1
  96. package/dist/sovrnBidAdapter.js +1 -1
  97. package/dist/sspBCBidAdapter.js +1 -1
  98. package/dist/sublimeBidAdapter.js +1 -1
  99. package/dist/synacormediaBidAdapter.js +1 -1
  100. package/dist/taboolaBidAdapter.js +1 -1
  101. package/dist/tappxBidAdapter.js +1 -1
  102. package/dist/targetVideoBidAdapter.js +1 -1
  103. package/dist/teadsBidAdapter.js +1 -1
  104. package/dist/trionBidAdapter.js +1 -1
  105. package/dist/tripleliftBidAdapter.js +1 -1
  106. package/dist/ttdBidAdapter.js +1 -1
  107. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  108. package/dist/underdogmediaBidAdapter.js +1 -1
  109. package/dist/undertoneBidAdapter.js +1 -1
  110. package/dist/userId.js +1 -1
  111. package/dist/vidazooBidAdapter.js +1 -1
  112. package/dist/videobyteBidAdapter.js +1 -1
  113. package/dist/viqeoBidAdapter.js +1 -0
  114. package/dist/visxBidAdapter.js +1 -1
  115. package/dist/vuukleBidAdapter.js +1 -1
  116. package/dist/widespaceBidAdapter.js +1 -1
  117. package/dist/winrBidAdapter.js +1 -1
  118. package/dist/yahoosspBidAdapter.js +1 -1
  119. package/dist/yieldlabBidAdapter.js +1 -1
  120. package/dist/yieldmoBidAdapter.js +1 -1
  121. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  122. package/dist/zeta_global_sspBidAdapter.js +1 -1
  123. package/dist/zeusPrimeRtdProvider.js +31 -0
  124. package/integrationExamples/gpt/captifyRtdProvider_example.html +167 -0
  125. package/modules/.submodules.json +3 -1
  126. package/modules/adagioBidAdapter.js +1 -1
  127. package/modules/admaticBidAdapter.js +108 -59
  128. package/modules/admaticBidAdapter.md +2 -2
  129. package/modules/beopBidAdapter.js +17 -2
  130. package/modules/captifyRtdProvider.js +146 -0
  131. package/modules/captifyRtdProvider.md +68 -0
  132. package/modules/concertBidAdapter.js +17 -3
  133. package/modules/conversantAnalyticsAdapter.md +12 -13
  134. package/modules/conversantBidAdapter.md +3 -3
  135. package/modules/discoveryBidAdapter.js +38 -17
  136. package/modules/discoveryBidAdapter.md +7 -6
  137. package/modules/gridBidAdapter.js +440 -22
  138. package/modules/kargoBidAdapter.js +14 -8
  139. package/modules/magniteAnalyticsAdapter.js +1 -1
  140. package/modules/microadBidAdapter.js +22 -11
  141. package/modules/nextMillenniumBidAdapter.js +20 -24
  142. package/modules/oguryBidAdapter.js +5 -2
  143. package/modules/pubmaticBidAdapter.js +1 -1
  144. package/modules/seedtagBidAdapter.js +9 -4
  145. package/modules/smartadserverBidAdapter.js +6 -2
  146. package/modules/smartxBidAdapter.js +10 -7
  147. package/modules/smartytechBidAdapter.js +78 -0
  148. package/modules/smartytechBidAdapter.md +44 -0
  149. package/modules/taboolaBidAdapter.js +3 -3
  150. package/modules/taboolaBidAdapter.md +0 -2
  151. package/modules/tappxBidAdapter.js +21 -6
  152. package/modules/ttdBidAdapter.js +4 -3
  153. package/modules/userId/index.js +1 -1
  154. package/modules/vidazooBidAdapter.js +29 -3
  155. package/modules/viqeoBidAdapter.js +180 -0
  156. package/modules/viqeoBidAdapter.md +56 -0
  157. package/modules/yieldlabBidAdapter.js +19 -8
  158. package/modules/yieldmoBidAdapter.js +22 -8
  159. package/modules/yieldoneBidAdapter.js +60 -8
  160. package/modules/yieldoneBidAdapter.md +109 -9
  161. package/modules/zeta_global_sspBidAdapter.js +4 -0
  162. package/modules/zeusPrimeRtdProvider.js +357 -0
  163. package/modules/zeusPrimeRtdProvider.md +60 -0
  164. package/package.json +1 -1
  165. package/src/adloader.js +0 -1
  166. package/test/spec/modules/adagioBidAdapter_spec.js +2 -2
  167. package/test/spec/modules/admaticBidAdapter_spec.js +262 -3
  168. package/test/spec/modules/beopBidAdapter_spec.js +52 -0
  169. package/test/spec/modules/captifyRtdProvider_spec.js +253 -0
  170. package/test/spec/modules/concertBidAdapter_spec.js +26 -15
  171. package/test/spec/modules/discoveryBidAdapter_spec.js +9 -8
  172. package/test/spec/modules/gridBidAdapter_spec.js +289 -1
  173. package/test/spec/modules/kargoBidAdapter_spec.js +76 -4
  174. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +20 -0
  175. package/test/spec/modules/microadBidAdapter_spec.js +48 -0
  176. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +4 -3
  177. package/test/spec/modules/oguryBidAdapter_spec.js +27 -5
  178. package/test/spec/modules/pubmaticBidAdapter_spec.js +2 -2
  179. package/test/spec/modules/seedtagBidAdapter_spec.js +34 -10
  180. package/test/spec/modules/smartadserverBidAdapter_spec.js +80 -0
  181. package/test/spec/modules/smartxBidAdapter_spec.js +32 -0
  182. package/test/spec/modules/smartytechBidAdapter_spec.js +162 -0
  183. package/test/spec/modules/taboolaBidAdapter_spec.js +0 -77
  184. package/test/spec/modules/ttdBidAdapter_spec.js +13 -0
  185. package/test/spec/modules/vidazooBidAdapter_spec.js +1 -0
  186. package/test/spec/modules/viqeoBidAdapter_spec.js +124 -0
  187. package/test/spec/modules/yieldlabBidAdapter_spec.js +125 -0
  188. package/test/spec/modules/yieldmoBidAdapter_spec.js +3 -4
  189. package/test/spec/modules/yieldoneBidAdapter_spec.js +30 -6
  190. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +16 -1
  191. package/test/spec/modules/zeusPrimeRtdProvider_spec.js +410 -0
@@ -330,6 +330,54 @@ describe('microadBidAdapter', () => {
330
330
  })
331
331
  })
332
332
  })
333
+
334
+ Object.entries({
335
+ 'ID5 ID': {
336
+ userId: {id5id: {uid: 'id5id-sample'}},
337
+ userIdAsEids: [
338
+ {
339
+ source: 'id5-sync.com',
340
+ uids: [{id: 'id5id-sample', aType: 1, ext: {linkType: 2, abTestingControlGroup: false}}]
341
+ }
342
+ ],
343
+ expected: {
344
+ aids: JSON.stringify([{type: 8, id: 'id5id-sample', ext: {linkType: 2, abTestingControlGroup: false}}])
345
+ }
346
+ },
347
+ 'Unified ID': {
348
+ userId: {tdid: 'unified-sample'},
349
+ userIdAsEids: [
350
+ {
351
+ source: 'adserver.org',
352
+ uids: [{id: 'unified-sample', aType: 1, ext: {rtiPartner: 'TDID'}}]
353
+ }
354
+ ],
355
+ expected: {aids: JSON.stringify([{type: 9, id: 'unified-sample', ext: {rtiPartner: 'TDID'}}])}
356
+ },
357
+ 'not add': {
358
+ userId: {id5id: {uid: 'id5id-sample'}},
359
+ userIdAsEids: [],
360
+ expected: {
361
+ aids: JSON.stringify([{type: 8, id: 'id5id-sample'}])
362
+ }
363
+ }
364
+ }).forEach(([test, arg]) => {
365
+ it(`should ${test} ext if it is available in request parameters`, () => {
366
+ const bidRequestWithUserId = {
367
+ ...bidRequestTemplate,
368
+ userId: arg.userId,
369
+ userIdAsEids: arg.userIdAsEids
370
+ }
371
+ const requests = spec.buildRequests([bidRequestWithUserId], bidderRequest)
372
+ requests.forEach((request) => {
373
+ expect(request.data).to.deep.equal({
374
+ ...expectedResultTemplate,
375
+ cbt: request.data.cbt,
376
+ ...arg.expected
377
+ })
378
+ })
379
+ });
380
+ })
333
381
  });
334
382
 
335
383
  describe('interpretResponse', () => {
@@ -148,14 +148,15 @@ describe('nextMillenniumBidAdapterTests', function() {
148
148
 
149
149
  it('Test getUserSyncs function', function () {
150
150
  const syncOptions = {
151
- 'iframeEnabled': true
151
+ 'iframeEnabled': false,
152
+ 'pixelEnabled': true
152
153
  }
153
154
  const userSync = spec.getUserSyncs(syncOptions);
154
155
  expect(userSync).to.be.an('array').with.lengthOf(1);
155
156
  expect(userSync[0].type).to.exist;
156
157
  expect(userSync[0].url).to.exist;
157
- expect(userSync[0].type).to.be.equal('iframe');
158
- expect(userSync[0].url).to.be.equal('https://statics.nextmillmedia.com/load-cookie.html?v=4');
158
+ expect(userSync[0].type).to.be.equal('image');
159
+ expect(userSync[0].url).to.be.equal('https://cookies.nextmillmedia.com/sync?type=image');
159
160
  });
160
161
 
161
162
  it('validate_response_params', function() {
@@ -244,12 +244,16 @@ describe('OguryBidAdapter', function () {
244
244
  describe('buildRequests', function () {
245
245
  const stubbedWidth = 200
246
246
  const stubbedHeight = 600
247
+ const stubbedCurrentTime = 1234567890
247
248
  const stubbedWidthMethod = sinon.stub(window.top.document.documentElement, 'clientWidth').get(function() {
248
249
  return stubbedWidth;
249
250
  });
250
251
  const stubbedHeightMethod = sinon.stub(window.top.document.documentElement, 'clientHeight').get(function() {
251
252
  return stubbedHeight;
252
253
  });
254
+ const stubbedCurrentTimeMethod = sinon.stub(document.timeline, 'currentTime').get(function() {
255
+ return stubbedCurrentTime;
256
+ });
253
257
 
254
258
  const defaultTimeout = 1000;
255
259
  const expectedRequestObject = {
@@ -266,7 +270,10 @@ describe('OguryBidAdapter', function () {
266
270
  h: 250
267
271
  }]
268
272
  },
269
- ext: bidRequests[0].params
273
+ ext: {
274
+ ...bidRequests[0].params,
275
+ timeSpentOnPage: stubbedCurrentTime
276
+ }
270
277
  }, {
271
278
  id: bidRequests[1].bidId,
272
279
  tagid: bidRequests[1].params.adUnitId,
@@ -276,7 +283,10 @@ describe('OguryBidAdapter', function () {
276
283
  h: 500
277
284
  }]
278
285
  },
279
- ext: bidRequests[1].params
286
+ ext: {
287
+ ...bidRequests[1].params,
288
+ timeSpentOnPage: stubbedCurrentTime
289
+ }
280
290
  }],
281
291
  regs: {
282
292
  ext: {
@@ -295,7 +305,7 @@ describe('OguryBidAdapter', function () {
295
305
  },
296
306
  ext: {
297
307
  prebidversion: '$prebid.version$',
298
- adapterversion: '1.3.0'
308
+ adapterversion: '1.4.0'
299
309
  },
300
310
  device: {
301
311
  w: stubbedWidth,
@@ -306,6 +316,7 @@ describe('OguryBidAdapter', function () {
306
316
  after(function() {
307
317
  stubbedWidthMethod.restore();
308
318
  stubbedHeightMethod.restore();
319
+ stubbedCurrentTimeMethod.restore();
309
320
  });
310
321
 
311
322
  it('sends bid request to ENDPOINT via POST', function () {
@@ -316,6 +327,17 @@ describe('OguryBidAdapter', function () {
316
327
  expect(request.method).to.equal('POST');
317
328
  });
318
329
 
330
+ it('timeSpentOnpage should be 0 if timeline is undefined', function () {
331
+ const stubbedTimelineMethod = sinon.stub(document, 'timeline').get(function() {
332
+ return undefined;
333
+ });
334
+ const validBidRequests = utils.deepClone(bidRequests)
335
+
336
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
337
+ expect(request.data.imp[0].ext.timeSpentOnPage).to.equal(0);
338
+ stubbedTimelineMethod.restore();
339
+ });
340
+
319
341
  it('bid request object should be conform', function () {
320
342
  const validBidRequests = utils.deepClone(bidRequests)
321
343
 
@@ -675,7 +697,7 @@ describe('OguryBidAdapter', function () {
675
697
  advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[0].adomain
676
698
  },
677
699
  nurl: openRtbBidResponse.body.seatbid[0].bid[0].nurl,
678
- adapterVersion: '1.3.0',
700
+ adapterVersion: '1.4.0',
679
701
  prebidVersion: '$prebid.version$'
680
702
  }, {
681
703
  requestId: openRtbBidResponse.body.seatbid[0].bid[1].impid,
@@ -692,7 +714,7 @@ describe('OguryBidAdapter', function () {
692
714
  advertiserDomains: openRtbBidResponse.body.seatbid[0].bid[1].adomain
693
715
  },
694
716
  nurl: openRtbBidResponse.body.seatbid[0].bid[1].nurl,
695
- adapterVersion: '1.3.0',
717
+ adapterVersion: '1.4.0',
696
718
  prebidVersion: '$prebid.version$'
697
719
  }]
698
720
 
@@ -3406,7 +3406,7 @@ describe('PubMatic adapter', function () {
3406
3406
  let response = spec.interpretResponse(bidResponses, request);
3407
3407
  expect(response).to.be.an('array').with.length.above(0);
3408
3408
  expect(response[0].requestId).to.equal(bidResponses.body.seatbid[0].bid[0].impid);
3409
- expect(response[0].cpm).to.equal((bidResponses.body.seatbid[0].bid[0].price).toFixed(2));
3409
+ expect(response[0].cpm).to.equal(parseFloat((bidResponses.body.seatbid[0].bid[0].price).toFixed(2)));
3410
3410
  expect(response[0].width).to.equal(bidResponses.body.seatbid[0].bid[0].w);
3411
3411
  expect(response[0].height).to.equal(bidResponses.body.seatbid[0].bid[0].h);
3412
3412
  if (bidResponses.body.seatbid[0].bid[0].crid) {
@@ -3430,7 +3430,7 @@ describe('PubMatic adapter', function () {
3430
3430
  expect(response[0].partnerImpId).to.equal(bidResponses.body.seatbid[0].bid[0].id);
3431
3431
 
3432
3432
  expect(response[1].requestId).to.equal(bidResponses.body.seatbid[1].bid[0].impid);
3433
- expect(response[1].cpm).to.equal((bidResponses.body.seatbid[1].bid[0].price).toFixed(2));
3433
+ expect(response[1].cpm).to.equal(parseFloat((bidResponses.body.seatbid[1].bid[0].price).toFixed(2)));
3434
3434
  expect(response[1].width).to.equal(bidResponses.body.seatbid[1].bid[0].w);
3435
3435
  expect(response[1].height).to.equal(bidResponses.body.seatbid[1].bid[0].h);
3436
3436
  if (bidResponses.body.seatbid[1].bid[0].crid) {
@@ -1,6 +1,7 @@
1
1
  import { expect } from 'chai';
2
2
  import { spec, getTimeoutUrl } from 'modules/seedtagBidAdapter.js';
3
3
  import * as utils from 'src/utils.js';
4
+ import { config } from '../../../src/config.js';
4
5
 
5
6
  const PUBLISHER_ID = '0000-0000-01';
6
7
  const ADUNIT_ID = '000000';
@@ -357,6 +358,29 @@ describe('Seedtag Adapter', function () {
357
358
  });
358
359
  });
359
360
 
361
+ describe('COPPA param', function () {
362
+ it('should add COPPA param to payload when prebid config has parameter COPPA equal to true', function () {
363
+ config.setConfig({ coppa: true })
364
+
365
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
366
+ const data = JSON.parse(request.data);
367
+ expect(data.coppa).to.equal(true);
368
+ })
369
+
370
+ it('should not add COPPA param to payload when prebid config has parameter COPPA equal to false', function () {
371
+ config.setConfig({ coppa: false })
372
+
373
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
374
+ const data = JSON.parse(request.data);
375
+ expect(data.coppa).to.be.undefined;
376
+ })
377
+
378
+ it('should not add COPPA param to payload when prebid config has not parameter COPPA', function () {
379
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
380
+ const data = JSON.parse(request.data);
381
+ expect(data.coppa).to.be.undefined;
382
+ })
383
+ })
360
384
  describe('schain param', function () {
361
385
  it('should add schain to payload when exposed on validBidRequest', function () {
362
386
  // https://github.com/prebid/Prebid.js/blob/master/modules/schain.md#sample-code-for-passing-the-schain-object
@@ -536,11 +560,11 @@ describe('Seedtag Adapter', function () {
536
560
  const timeoutUrl = getTimeoutUrl(timeoutData);
537
561
  expect(timeoutUrl).to.equal(
538
562
  'https://s.seedtag.com/se/hb/timeout?publisherToken=' +
539
- params.publisherId +
540
- '&adUnitId=' +
541
- params.adUnitId +
542
- '&timeout=' +
543
- timeout
563
+ params.publisherId +
564
+ '&adUnitId=' +
565
+ params.adUnitId +
566
+ '&timeout=' +
567
+ timeout
544
568
  );
545
569
  });
546
570
 
@@ -552,11 +576,11 @@ describe('Seedtag Adapter', function () {
552
576
  expect(
553
577
  utils.triggerPixel.calledWith(
554
578
  'https://s.seedtag.com/se/hb/timeout?publisherToken=' +
555
- params.publisherId +
556
- '&adUnitId=' +
557
- params.adUnitId +
558
- '&timeout=' +
559
- timeout
579
+ params.publisherId +
580
+ '&adUnitId=' +
581
+ params.adUnitId +
582
+ '&timeout=' +
583
+ timeout
560
584
  )
561
585
  ).to.equal(true);
562
586
  });
@@ -158,12 +158,44 @@ describe('Smart bid adapter tests', function () {
158
158
  }
159
159
  };
160
160
 
161
+ var sellerDefinedAudience = [
162
+ {
163
+ 'name': 'hearst.com',
164
+ 'ext': { 'segtax': 1 },
165
+ 'segment': [
166
+ { 'id': '1001' },
167
+ { 'id': '1002' }
168
+ ]
169
+ }
170
+ ];
171
+
172
+ var sellerDefinedContext = [
173
+ {
174
+ 'name': 'cnn.com',
175
+ 'ext': { 'segtax': 2 },
176
+ 'segment': [
177
+ { 'id': '2002' }
178
+ ]
179
+ }
180
+ ];
181
+
161
182
  it('Verify build request', function () {
162
183
  config.setConfig({
163
184
  'currency': {
164
185
  'adServerCurrency': 'EUR'
186
+ },
187
+ ortb2: {
188
+ 'user': {
189
+ 'data': sellerDefinedAudience
190
+ },
191
+ 'site': {
192
+ 'content': {
193
+ 'data': sellerDefinedContext
194
+ }
195
+ }
165
196
  }
166
197
  });
198
+
167
199
  const request = spec.buildRequests(DEFAULT_PARAMS);
168
200
  expect(request[0]).to.have.property('url').and.to.equal('https://prg.smartadserver.com/prebid/v1');
169
201
  expect(request[0]).to.have.property('method').and.to.equal('POST');
@@ -186,6 +218,8 @@ describe('Smart bid adapter tests', function () {
186
218
  expect(requestContent).to.have.property('buid').and.to.equal('7569');
187
219
  expect(requestContent).to.have.property('appname').and.to.equal('Mozilla');
188
220
  expect(requestContent).to.have.property('ckid').and.to.equal(42);
221
+ expect(requestContent).to.have.property('sda').and.to.deep.equal(sellerDefinedAudience);
222
+ expect(requestContent).to.have.property('sdc').and.to.deep.equal(sellerDefinedContext);
189
223
  });
190
224
 
191
225
  it('Verify parse response with no ad', function () {
@@ -200,6 +234,27 @@ describe('Smart bid adapter tests', function () {
200
234
  }).to.not.throw();
201
235
  });
202
236
 
237
+ it('Should not nest response if ad and adUrl empty', () => {
238
+ const BID_RESPONSE_EMPTY = {
239
+ body: {
240
+ ad: null,
241
+ adUrl: null,
242
+ cpm: 0.92,
243
+ isNoAd: false
244
+ }
245
+ };
246
+
247
+ const request = spec.buildRequests(DEFAULT_PARAMS);
248
+ const bids = spec.interpretResponse(BID_RESPONSE_EMPTY, request[0]);
249
+
250
+ expect(bids).to.have.lengthOf(0);
251
+ expect(() => {
252
+ spec.interpretResponse(BID_RESPONSE_EMPTY, {
253
+ data: 'invalid Json'
254
+ });
255
+ }).to.not.throw();
256
+ });
257
+
203
258
  it('Verify parse response', function () {
204
259
  const request = spec.buildRequests(DEFAULT_PARAMS);
205
260
  const bids = spec.interpretResponse(BID_RESPONSE, request[0]);
@@ -337,6 +392,7 @@ describe('Smart bid adapter tests', function () {
337
392
 
338
393
  describe('gdpr tests', function () {
339
394
  afterEach(function () {
395
+ config.setConfig({ ortb2: undefined });
340
396
  config.resetConfig();
341
397
  $$PREBID_GLOBAL$$.requestBids.removeAll();
342
398
  });
@@ -468,6 +524,16 @@ describe('Smart bid adapter tests', function () {
468
524
  config.setConfig({
469
525
  'currency': {
470
526
  'adServerCurrency': 'EUR'
527
+ },
528
+ ortb2: {
529
+ 'user': {
530
+ 'data': sellerDefinedAudience
531
+ },
532
+ 'site': {
533
+ 'content': {
534
+ 'data': sellerDefinedContext
535
+ }
536
+ }
471
537
  }
472
538
  });
473
539
  const request = spec.buildRequests(INSTREAM_DEFAULT_PARAMS);
@@ -486,6 +552,8 @@ describe('Smart bid adapter tests', function () {
486
552
  expect(requestContent).to.have.property('buid').and.to.equal('7569');
487
553
  expect(requestContent).to.have.property('appname').and.to.equal('Mozilla');
488
554
  expect(requestContent).to.have.property('ckid').and.to.equal(42);
555
+ expect(requestContent).to.have.property('sda').and.to.deep.equal(sellerDefinedAudience);
556
+ expect(requestContent).to.have.property('sdc').and.to.deep.equal(sellerDefinedContext);
489
557
  expect(requestContent).to.have.property('isVideo').and.to.equal(true);
490
558
  expect(requestContent).to.have.property('videoData');
491
559
  expect(requestContent.videoData).to.have.property('videoProtocol').and.to.equal(6);
@@ -727,6 +795,16 @@ describe('Smart bid adapter tests', function () {
727
795
  config.setConfig({
728
796
  'currency': {
729
797
  'adServerCurrency': 'EUR'
798
+ },
799
+ ortb2: {
800
+ 'user': {
801
+ 'data': sellerDefinedAudience
802
+ },
803
+ 'site': {
804
+ 'content': {
805
+ 'data': sellerDefinedContext
806
+ }
807
+ }
730
808
  }
731
809
  });
732
810
  const request = spec.buildRequests(OUTSTREAM_DEFAULT_PARAMS);
@@ -745,6 +823,8 @@ describe('Smart bid adapter tests', function () {
745
823
  expect(requestContent).to.have.property('buid').and.to.equal('7579');
746
824
  expect(requestContent).to.have.property('appname').and.to.equal('Mozilla');
747
825
  expect(requestContent).to.have.property('ckid').and.to.equal(43);
826
+ expect(requestContent).to.have.property('sda').and.to.deep.equal(sellerDefinedAudience);
827
+ expect(requestContent).to.have.property('sdc').and.to.deep.equal(sellerDefinedContext);
748
828
  expect(requestContent).to.have.property('isVideo').and.to.equal(false);
749
829
  expect(requestContent).to.have.property('videoData');
750
830
  expect(requestContent.videoData).to.have.property('videoProtocol').and.to.equal(7);
@@ -342,6 +342,38 @@ describe('The smartx adapter', function () {
342
342
  expect(request.data.imp[0].video.minduration).to.equal(3);
343
343
  expect(request.data.imp[0].video.maxduration).to.equal(15);
344
344
  });
345
+
346
+ it('should pass schain param', function () {
347
+ var request;
348
+
349
+ bid.schain = {
350
+ complete: 1,
351
+ nodes: [
352
+ {
353
+ asi: 'indirectseller.com',
354
+ sid: '00001',
355
+ hp: 1
356
+ }
357
+ ]
358
+ }
359
+
360
+ request = spec.buildRequests([bid], bidRequestObj)[0];
361
+
362
+ expect(request.data.source).to.deep.equal({
363
+ ext: {
364
+ schain: {
365
+ complete: 1,
366
+ nodes: [
367
+ {
368
+ asi: 'indirectseller.com',
369
+ sid: '00001',
370
+ hp: 1
371
+ }
372
+ ]
373
+ }
374
+ }
375
+ })
376
+ });
345
377
  });
346
378
 
347
379
  describe('interpretResponse', function () {
@@ -0,0 +1,162 @@
1
+ import {expect} from 'chai';
2
+ import {spec, ENDPOINT_PROTOCOL, ENDPOINT_DOMAIN, ENDPOINT_PATH} from 'modules/smartytechBidAdapter';
3
+ import {newBidder} from 'src/adapters/bidderFactory.js';
4
+
5
+ const BIDDER_CODE = 'smartytech';
6
+
7
+ describe('SmartyTechDSPAdapter: inherited functions', function () {
8
+ let adapter;
9
+ beforeEach(() => {
10
+ adapter = newBidder(spec);
11
+ });
12
+ it('exists and is a function', function () {
13
+ expect(adapter.callBids).to.be.exist.and.to.be.a('function');
14
+ });
15
+ it(`bidder code is ${BIDDER_CODE}`, function () {
16
+ expect(spec.code).to.be.equal(BIDDER_CODE);
17
+ })
18
+ });
19
+
20
+ describe('SmartyTechDSPAdapter: isBidRequestValid', function () {
21
+ it('Invalid bid request. Should return false', function () {
22
+ const invalidBidFixture = {
23
+ params: {
24
+ use_id: 13144375
25
+ }
26
+ }
27
+ expect(spec.isBidRequestValid(invalidBidFixture)).to.be.false
28
+ });
29
+ it('Valid bid request. Should return true', function () {
30
+ const validBidFixture = {
31
+ params: {
32
+ endpointId: 13144375
33
+ }
34
+ }
35
+ expect(spec.isBidRequestValid(validBidFixture)).to.be.true
36
+ });
37
+ });
38
+
39
+ function mockRandomSizeArray(len) {
40
+ return Array.apply(null, {length: len}).map(i => {
41
+ return [Math.floor(Math.random() * 800), Math.floor(Math.random() * 800)]
42
+ });
43
+ }
44
+
45
+ function mockBidRequestListData(size) {
46
+ return Array.apply(null, {length: size}).map((i, index) => {
47
+ const id = Math.floor(Math.random() * 800) * (index + 1);
48
+ return {
49
+ adUnitCode: `adUnitCode-${id}`,
50
+ sizes: mockRandomSizeArray(index + 1),
51
+ bidId: `bidId-${id}`,
52
+ params: {
53
+ endpointId: id
54
+ }
55
+ }
56
+ });
57
+ }
58
+
59
+ function mockRefererData() {
60
+ return {
61
+ refererInfo: {
62
+ page: 'https://some-test.page'
63
+ }
64
+ }
65
+ }
66
+
67
+ function mockResponseData(requestData) {
68
+ let data = {}
69
+
70
+ requestData.data.forEach((request, index) => {
71
+ const sizeArrayIndex = Math.floor(Math.random() * (request.sizes.length - 1));
72
+ const rndIndex = Math.floor(Math.random() * 800);
73
+
74
+ data[request.adUnitCode] = {
75
+ ad: `ad-${rndIndex}`,
76
+ width: request.sizes[sizeArrayIndex][0],
77
+ height: request.sizes[sizeArrayIndex][1],
78
+ creativeId: `creative-id-${index}`,
79
+ cpm: Math.floor(Math.random() * 100),
80
+ currency: `UAH-${rndIndex}`
81
+ };
82
+ });
83
+ return {
84
+ body: data
85
+ }
86
+ };
87
+
88
+ describe('SmartyTechDSPAdapter: buildRequests', () => {
89
+ let mockBidRequest;
90
+ let mockReferer;
91
+ beforeEach(() => {
92
+ mockBidRequest = mockBidRequestListData(8);
93
+ mockReferer = mockRefererData();
94
+ });
95
+ it('has return data', () => {
96
+ const request = spec.buildRequests(mockBidRequest, mockReferer);
97
+ expect(request).not.null;
98
+ });
99
+ it('correct request URL', () => {
100
+ const request = spec.buildRequests(mockBidRequest, mockReferer);
101
+ expect(request.url).to.be.equal(`${ENDPOINT_PROTOCOL}://${ENDPOINT_DOMAIN}${ENDPOINT_PATH}`)
102
+ });
103
+ it('correct request method', () => {
104
+ const request = spec.buildRequests(mockBidRequest, mockReferer);
105
+ expect(request.method).to.be.equal(`POST`)
106
+ });
107
+ it('correct request data', () => {
108
+ const data = spec.buildRequests(mockBidRequest, mockReferer).data;
109
+ data.forEach((request, index) => {
110
+ expect(request.adUnitCode).to.be.equal(mockBidRequest[index].adUnitCode);
111
+ expect(request.sizes).to.be.equal(mockBidRequest[index].sizes);
112
+ expect(request.bidId).to.be.equal(mockBidRequest[index].bidId);
113
+ expect(request.endpointId).to.be.equal(mockBidRequest[index].params.endpointId);
114
+ expect(request.referer).to.be.equal(mockReferer.refererInfo.page);
115
+ })
116
+ });
117
+ });
118
+
119
+ describe('SmartyTechDSPAdapter: interpretResponse', () => {
120
+ let mockBidRequest;
121
+ let mockReferer;
122
+ let request;
123
+ let mockResponse;
124
+ beforeEach(() => {
125
+ const brData = mockBidRequestListData(2);
126
+ mockReferer = mockRefererData();
127
+ request = spec.buildRequests(brData, mockReferer);
128
+ mockBidRequest = {
129
+ data: brData
130
+ }
131
+ mockResponse = mockResponseData(request);
132
+ });
133
+
134
+ it('interpretResponse: empty data request', () => {
135
+ delete mockResponse['body']
136
+ const data = spec.interpretResponse(mockResponse, mockBidRequest);
137
+ expect(data.length).to.be.equal(0);
138
+ });
139
+
140
+ it('interpretResponse: response data and convert data arrays has same length', () => {
141
+ const keys = Object.keys(mockResponse.body);
142
+ const data = spec.interpretResponse(mockResponse, mockBidRequest);
143
+ expect(data.length).to.be.equal(keys.length);
144
+ });
145
+
146
+ it('interpretResponse: convert to correct data', () => {
147
+ const keys = Object.keys(mockResponse.body);
148
+ const data = spec.interpretResponse(mockResponse, mockBidRequest);
149
+
150
+ data.forEach((responseItem, index) => {
151
+ expect(responseItem.ad).to.be.equal(mockResponse.body[keys[index]].ad);
152
+ expect(responseItem.cpm).to.be.equal(mockResponse.body[keys[index]].cpm);
153
+ expect(responseItem.creativeId).to.be.equal(mockResponse.body[keys[index]].creativeId);
154
+ expect(responseItem.currency).to.be.equal(mockResponse.body[keys[index]].currency);
155
+ expect(responseItem.netRevenue).to.be.true;
156
+ expect(responseItem.ttl).to.be.equal(60);
157
+ expect(responseItem.requestId).to.be.equal(mockBidRequest.data[index].bidId);
158
+ expect(responseItem.width).to.be.equal(mockResponse.body[keys[index]].width);
159
+ expect(responseItem.height).to.be.equal(mockResponse.body[keys[index]].height);
160
+ });
161
+ });
162
+ });
@@ -89,45 +89,6 @@ describe('Taboola Adapter', function () {
89
89
  }
90
90
  expect(spec.isBidRequestValid(bid)).to.equal(true)
91
91
  })
92
-
93
- it('should succeed when url is null', function () {
94
- const bid = {
95
- bidder: 'taboola',
96
- params: {
97
- publisherId: 'publisherId',
98
- tagId: 'below the article',
99
- endpointUrl: null
100
- },
101
- ...displayBidRequestParams
102
- }
103
- expect(spec.isBidRequestValid(bid)).to.equal(true)
104
- })
105
-
106
- it('should succeed when url is empty string', function () {
107
- const bid = {
108
- bidder: 'taboola',
109
- params: {
110
- publisherId: 'publisherId',
111
- tagId: 'below the article',
112
- endpointUrl: ''
113
- },
114
- ...displayBidRequestParams
115
- }
116
- expect(spec.isBidRequestValid(bid)).to.equal(true)
117
- })
118
-
119
- it('should succeed when url is filled', function () {
120
- const bid = {
121
- bidder: 'taboola',
122
- params: {
123
- publisherId: 'publisherId',
124
- tagId: 'below the article',
125
- endpointUrl: 'https://example.com'
126
- },
127
- ...displayBidRequestParams
128
- }
129
- expect(spec.isBidRequestValid(bid)).to.equal(true)
130
- })
131
92
  })
132
93
 
133
94
  describe('buildRequests', function () {
@@ -189,44 +150,6 @@ describe('Taboola Adapter', function () {
189
150
  expect(res.data).to.deep.equal(JSON.stringify(expectedData));
190
151
  });
191
152
 
192
- it('should fill the url when it is passed', function () {
193
- const commonBidRequestWithUrl = {
194
- bidder: 'taboola',
195
- params: {
196
- publisherId: 'publisherId',
197
- tagId: 'placement name',
198
- endpointUrl: 'https://example.com'
199
- },
200
- bidId: 'aa43860a-4644-442a-b5e0-93f268cs4d19',
201
- auctionId: '65746dca-26f3-4186-be13-dfa63469b1b7',
202
- }
203
- let defaultBidRequestWithUrl = {
204
- ...commonBidRequestWithUrl,
205
- ...displayBidRequestParams,
206
- }
207
- const res = spec.buildRequests([defaultBidRequestWithUrl], commonBidderRequest);
208
- expect(res.url).to.equal(`${commonBidRequestWithUrl.params.endpointUrl}/${commonBidRequest.params.publisherId}`);
209
- })
210
-
211
- it('should fill default url when url param is empty string', function () {
212
- const commonBidRequestWithUrl = {
213
- bidder: 'taboola',
214
- params: {
215
- publisherId: 'publisherId',
216
- tagId: 'placement name',
217
- endpointUrl: ''
218
- },
219
- bidId: 'aa43860a-4644-442a-b5e0-93f268cs4d19',
220
- auctionId: '65746dca-26f3-4186-be13-dfa63469b1b7',
221
- }
222
- let defaultBidRequestWithUrl = {
223
- ...commonBidRequestWithUrl,
224
- ...displayBidRequestParams,
225
- }
226
- const res = spec.buildRequests([defaultBidRequestWithUrl], commonBidderRequest);
227
- expect(res.url).to.equal(`${END_POINT_URL}/${commonBidRequestWithUrl.params.publisherId}`);
228
- })
229
-
230
153
  it('should pass optional parameters in request', function () {
231
154
  const optionalParams = {
232
155
  bidfloor: 0.25,