prebid.js 6.1.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/README.md +1 -1
  3. package/browsers.json +13 -29
  4. package/gulpfile.js +87 -82
  5. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  6. package/karma.conf.maker.js +2 -2
  7. package/modules/33acrossBidAdapter.js +189 -102
  8. package/modules/adagioBidAdapter.js +1 -1
  9. package/modules/addefendBidAdapter.js +1 -0
  10. package/modules/adkernelBidAdapter.js +146 -61
  11. package/modules/adlooxAdServerVideo.js +2 -2
  12. package/modules/adlooxAnalyticsAdapter.js +4 -4
  13. package/modules/admanBidAdapter.js +1 -0
  14. package/modules/admixerBidAdapter.js +3 -2
  15. package/modules/adnuntiusBidAdapter.js +5 -2
  16. package/modules/adomikAnalyticsAdapter.js +6 -0
  17. package/modules/adplusBidAdapter.js +203 -0
  18. package/modules/adplusBidAdapter.md +39 -0
  19. package/modules/adxcgBidAdapter.js +311 -359
  20. package/modules/adxcgBidAdapter.md +22 -21
  21. package/modules/adyoulikeBidAdapter.js +20 -11
  22. package/modules/aniviewBidAdapter.js +1 -1
  23. package/modules/appnexusBidAdapter.js +19 -3
  24. package/modules/beachfrontBidAdapter.js +14 -17
  25. package/modules/beopBidAdapter.js +6 -4
  26. package/modules/bidViewability.js +3 -3
  27. package/modules/bidViewabilityIO.js +3 -3
  28. package/modules/bliinkBidAdapter.js +1 -1
  29. package/modules/colossussspBidAdapter.js +7 -0
  30. package/modules/compassBidAdapter.js +201 -0
  31. package/modules/compassBidAdapter.md +79 -0
  32. package/modules/consentManagement.js +7 -1
  33. package/modules/craftBidAdapter.js +5 -3
  34. package/modules/criteoBidAdapter.js +1 -1
  35. package/modules/currency.js +2 -2
  36. package/modules/cwireBidAdapter.js +3 -0
  37. package/modules/dailyhuntBidAdapter.js +435 -0
  38. package/modules/dailyhuntBidAdapter.md +4 -0
  39. package/modules/dchain.js +149 -0
  40. package/modules/dchain.md +45 -0
  41. package/modules/docereeBidAdapter.js +10 -1
  42. package/modules/docereeBidAdapter.md +2 -0
  43. package/modules/dspxBidAdapter.js +1 -1
  44. package/modules/emx_digitalBidAdapter.js +9 -1
  45. package/modules/engageyaBidAdapter.js +1 -1
  46. package/modules/feedadBidAdapter.js +2 -2
  47. package/modules/feedadBidAdapter.md +4 -2
  48. package/modules/freewheel-sspBidAdapter.js +6 -0
  49. package/modules/futureads.md +48 -0
  50. package/modules/glimpseBidAdapter.js +16 -3
  51. package/modules/goldbachBidAdapter.js +1176 -0
  52. package/modules/goldbachBidAdapter.md +151 -0
  53. package/modules/gptPreAuction.js +55 -7
  54. package/modules/gridBidAdapter.js +4 -3
  55. package/modules/gumgumBidAdapter.js +7 -3
  56. package/modules/improvedigitalBidAdapter.js +19 -3
  57. package/modules/instreamTracking.js +4 -4
  58. package/modules/intersectionRtdProvider.js +114 -0
  59. package/modules/invibesBidAdapter.js +64 -14
  60. package/modules/invibesBidAdapter.md +2 -1
  61. package/modules/ipromBidAdapter.js +79 -0
  62. package/modules/ixBidAdapter.js +53 -18
  63. package/modules/kinessoIdSystem.js +1 -1
  64. package/modules/limelightDigitalBidAdapter.js +3 -1
  65. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  66. package/modules/livewrappedBidAdapter.js +8 -2
  67. package/modules/loglyliftBidAdapter.js +79 -0
  68. package/modules/loglyliftBidAdapter.md +55 -0
  69. package/modules/lotamePanoramaIdSystem.js +80 -8
  70. package/modules/luponmediaBidAdapter.js +570 -0
  71. package/modules/mediasquareBidAdapter.js +1 -9
  72. package/modules/missenaBidAdapter.js +89 -0
  73. package/modules/nextMillenniumBidAdapter.js +37 -7
  74. package/modules/optimeraRtdProvider.js +8 -1
  75. package/modules/ozoneBidAdapter.js +21 -64
  76. package/modules/prebidServerBidAdapter/index.js +16 -12
  77. package/modules/pubgeniusBidAdapter.js +1 -1
  78. package/modules/pubmaticBidAdapter.js +3 -3
  79. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  80. package/modules/relaidoBidAdapter.js +86 -65
  81. package/modules/richaudienceBidAdapter.js +2 -3
  82. package/modules/rtdModule/index.js +48 -18
  83. package/modules/rubiconBidAdapter.js +31 -19
  84. package/modules/sharedIdSystem.js +27 -1
  85. package/modules/smaatoBidAdapter.js +4 -1
  86. package/modules/smartxBidAdapter.js +17 -1
  87. package/modules/tappxBidAdapter.js +3 -1
  88. package/modules/targetVideoBidAdapter.js +187 -0
  89. package/modules/targetVideoBidAdapter.md +34 -0
  90. package/modules/telariaBidAdapter.js +2 -2
  91. package/modules/trustxBidAdapter.js +8 -16
  92. package/modules/undertoneBidAdapter.js +8 -1
  93. package/modules/userId/index.js +27 -2
  94. package/modules/ventes.md +71 -0
  95. package/modules/ventesBidAdapter.js +104 -64
  96. package/modules/ventesBidAdapter.md +0 -1
  97. package/modules/vidoomyBidAdapter.js +16 -10
  98. package/modules/visxBidAdapter.js +19 -2
  99. package/modules/visxBidAdapter.md +4 -6
  100. package/modules/weboramaRtdProvider.js +288 -73
  101. package/modules/weboramaRtdProvider.md +27 -10
  102. package/modules/yahoosspBidAdapter.js +5 -1
  103. package/modules/yahoosspBidAdapter.md +1 -1
  104. package/modules/yieldmoBidAdapter.js +23 -5
  105. package/modules/yieldoneBidAdapter.js +115 -11
  106. package/modules/zetaSspBidAdapter.md +33 -1
  107. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  108. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  109. package/modules/zeta_global_sspBidAdapter.js +22 -1
  110. package/package.json +1 -1
  111. package/plugins/pbjsGlobals.js +28 -1
  112. package/src/auction.js +5 -4
  113. package/src/config.js +27 -3
  114. package/src/prebid.js +3 -2
  115. package/src/targeting.js +24 -3
  116. package/src/utils.js +53 -8
  117. package/test/helpers/prebidGlobal.js +1 -0
  118. package/test/spec/config_spec.js +279 -0
  119. package/test/spec/integration/faker/googletag.js +6 -0
  120. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  121. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  122. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  123. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +6 -0
  124. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  125. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  126. package/test/spec/modules/adyoulikeBidAdapter_spec.js +75 -0
  127. package/test/spec/modules/appnexusBidAdapter_spec.js +49 -1
  128. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  129. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  130. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  131. package/test/spec/modules/bidViewability_spec.js +4 -4
  132. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  133. package/test/spec/modules/compassBidAdapter_spec.js +397 -0
  134. package/test/spec/modules/consentManagement_spec.js +20 -0
  135. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  136. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  137. package/test/spec/modules/dchain_spec.js +329 -0
  138. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  139. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  140. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  141. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  142. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  143. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  144. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  145. package/test/spec/modules/improvedigitalBidAdapter_spec.js +3 -1
  146. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  147. package/test/spec/modules/invibesBidAdapter_spec.js +148 -4
  148. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  149. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  150. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +84 -23
  151. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  152. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  153. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  154. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  155. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  156. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  157. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  158. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  159. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  160. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  161. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  162. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  163. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  164. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  165. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  166. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  167. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  168. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  169. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  170. package/test/spec/modules/smaatoBidAdapter_spec.js +31 -0
  171. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  172. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  173. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  174. package/test/spec/modules/userId_spec.js +51 -0
  175. package/test/spec/modules/visxBidAdapter_spec.js +120 -4
  176. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  177. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  178. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  179. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  180. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  181. package/test/spec/unit/core/targeting_spec.js +116 -0
  182. package/test/spec/utils_spec.js +38 -0
  183. package/test/test_deps.js +3 -0
  184. package/test/test_index.js +1 -3
@@ -20,7 +20,9 @@ describe('GPT pre-auction module', () => {
20
20
  const testSlots = [
21
21
  makeSlot({ code: 'slotCode1', divId: 'div1' }),
22
22
  makeSlot({ code: 'slotCode2', divId: 'div2' }),
23
- makeSlot({ code: 'slotCode3', divId: 'div3' })
23
+ makeSlot({ code: 'slotCode3', divId: 'div3' }),
24
+ makeSlot({ code: 'slotCode4', divId: 'div4' }),
25
+ makeSlot({ code: 'slotCode4', divId: 'div5' })
24
26
  ];
25
27
 
26
28
  describe('appendPbAdSlot', () => {
@@ -172,7 +174,9 @@ describe('GPT pre-auction module', () => {
172
174
  expect(_currentConfig).to.deep.equal({
173
175
  enabled: true,
174
176
  customGptSlotMatching: false,
175
- customPbAdSlot: false
177
+ customPbAdSlot: false,
178
+ customPreAuction: false,
179
+ useDefaultPreAuction: false
176
180
  });
177
181
  });
178
182
  });
@@ -266,5 +270,176 @@ describe('GPT pre-auction module', () => {
266
270
  runMakeBidRequests(testAdUnits);
267
271
  expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
268
272
  });
273
+
274
+ it('should use the passed customPreAuction logic', () => {
275
+ let counter = 0;
276
+ config.setConfig({
277
+ gptPreAuction: {
278
+ enabled: true,
279
+ customPreAuction: (adUnit, slotName) => {
280
+ counter += 1;
281
+ return `${adUnit.code}-${slotName || counter}`;
282
+ }
283
+ }
284
+ });
285
+ const testAdUnits = [
286
+ {
287
+ code: 'adUnit1',
288
+ ortb2Imp: { ext: { data: { pbadslot: '12345' } } }
289
+ },
290
+ {
291
+ code: 'adUnit2',
292
+ },
293
+ {
294
+ code: 'slotCode3',
295
+ },
296
+ {
297
+ code: 'div4',
298
+ }
299
+ ];
300
+
301
+ // all slots should be passed in same time and have slot-${index}
302
+ const expectedAdUnits = [{
303
+ code: 'adUnit1',
304
+ ortb2Imp: {
305
+ ext: {
306
+ // no slotname match so uses adUnit.code-counter
307
+ data: {
308
+ pbadslot: 'adUnit1-1'
309
+ },
310
+ gpid: 'adUnit1-1'
311
+ }
312
+ }
313
+ },
314
+ // second adunit
315
+ {
316
+ code: 'adUnit2',
317
+ ortb2Imp: {
318
+ ext: {
319
+ // no slotname match so uses adUnit.code-counter
320
+ data: {
321
+ pbadslot: 'adUnit2-2'
322
+ },
323
+ gpid: 'adUnit2-2'
324
+ }
325
+ }
326
+ }, {
327
+ code: 'slotCode3',
328
+ ortb2Imp: {
329
+ ext: {
330
+ // slotname found, so uses code + slotname (which is same)
331
+ data: {
332
+ pbadslot: 'slotCode3-slotCode3',
333
+ adserver: {
334
+ name: 'gam',
335
+ adslot: 'slotCode3'
336
+ }
337
+ },
338
+ gpid: 'slotCode3-slotCode3'
339
+ }
340
+ }
341
+ }, {
342
+ code: 'div4',
343
+ ortb2Imp: {
344
+ ext: {
345
+ // slotname found, so uses code + slotname
346
+ data: {
347
+ pbadslot: 'div4-slotCode4',
348
+ adserver: {
349
+ name: 'gam',
350
+ adslot: 'slotCode4'
351
+ }
352
+ },
353
+ gpid: 'div4-slotCode4'
354
+ }
355
+ }
356
+ }];
357
+
358
+ window.googletag.pubads().setSlots(testSlots);
359
+ runMakeBidRequests(testAdUnits);
360
+ expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
361
+ });
362
+
363
+ it('should use useDefaultPreAuction logic', () => {
364
+ config.setConfig({
365
+ gptPreAuction: {
366
+ enabled: true,
367
+ useDefaultPreAuction: true
368
+ }
369
+ });
370
+ const testAdUnits = [
371
+ // First adUnit should use the preset pbadslot
372
+ {
373
+ code: 'adUnit1',
374
+ ortb2Imp: { ext: { data: { pbadslot: '12345' } } }
375
+ },
376
+ // Second adUnit should not match a gam slot, so no slot set
377
+ {
378
+ code: 'adUnit2',
379
+ },
380
+ // third adunit matches a single slot so uses it
381
+ {
382
+ code: 'slotCode3',
383
+ },
384
+ // fourth adunit matches multiple slots so combination
385
+ {
386
+ code: 'div4',
387
+ }
388
+ ];
389
+
390
+ const expectedAdUnits = [{
391
+ code: 'adUnit1',
392
+ ortb2Imp: {
393
+ ext: {
394
+ data: {
395
+ pbadslot: '12345'
396
+ },
397
+ gpid: '12345'
398
+ }
399
+ }
400
+ },
401
+ // second adunit
402
+ {
403
+ code: 'adUnit2',
404
+ ortb2Imp: {
405
+ ext: {
406
+ data: {
407
+ },
408
+ }
409
+ }
410
+ }, {
411
+ code: 'slotCode3',
412
+ ortb2Imp: {
413
+ ext: {
414
+ data: {
415
+ pbadslot: 'slotCode3',
416
+ adserver: {
417
+ name: 'gam',
418
+ adslot: 'slotCode3'
419
+ }
420
+ },
421
+ gpid: 'slotCode3'
422
+ }
423
+ }
424
+ }, {
425
+ code: 'div4',
426
+ ortb2Imp: {
427
+ ext: {
428
+ data: {
429
+ pbadslot: 'slotCode4#div4',
430
+ adserver: {
431
+ name: 'gam',
432
+ adslot: 'slotCode4'
433
+ }
434
+ },
435
+ gpid: 'slotCode4#div4'
436
+ }
437
+ }
438
+ }];
439
+
440
+ window.googletag.pubads().setSlots(testSlots);
441
+ runMakeBidRequests(testAdUnits);
442
+ expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
443
+ });
269
444
  });
270
445
  });
@@ -152,6 +152,12 @@ describe('gumgumAdapter', function () {
152
152
  const zoneParam = { 'zone': '123a' };
153
153
  const pubIdParam = { 'pubId': 123 };
154
154
 
155
+ it('should set aun if the adUnitCode is available', function () {
156
+ const request = { ...bidRequests[0] };
157
+ const bidRequest = spec.buildRequests([request])[0];
158
+ expect(bidRequest.data.aun).to.equal(bidRequests[0].adUnitCode);
159
+ });
160
+
155
161
  it('should set pubId param if found', function () {
156
162
  const request = { ...bidRequests[0], params: pubIdParam };
157
163
  const bidRequest = spec.buildRequests([request])[0];
@@ -92,7 +92,8 @@ describe('Improve Digital Adapter Tests', function () {
92
92
  gdprConsent: {
93
93
  consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
94
94
  vendorData: {},
95
- gdprApplies: true
95
+ gdprApplies: true,
96
+ addtlConsent: '1~1.35.41.101',
96
97
  },
97
98
  };
98
99
 
@@ -278,6 +279,7 @@ describe('Improve Digital Adapter Tests', function () {
278
279
  const request = spec.buildRequests([bidRequest], bidderRequestGdpr)[0];
279
280
  const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
280
281
  expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==');
282
+ expect(params.bid_request.user.ext.consented_providers_settings.consented_providers).to.exist.and.to.deep.equal([1, 35, 41, 101]);
281
283
  });
282
284
 
283
285
  it('should add CCPA consent string', function () {
@@ -0,0 +1,141 @@
1
+ import {config as _config, config} from 'src/config.js';
2
+ import { expect } from 'chai';
3
+ import events from 'src/events.js';
4
+ import * as prebidGlobal from 'src/prebidGlobal.js';
5
+ import { intersectionSubmodule } from 'modules/intersectionRtdProvider.js';
6
+ import * as utils from 'src/utils.js';
7
+ import {getGlobal} from 'src/prebidGlobal.js';
8
+ import 'src/prebid.js';
9
+
10
+ describe('Intersection RTD Provider', function () {
11
+ let sandbox;
12
+ let placeholder;
13
+ const pbjs = getGlobal();
14
+ const adUnit = {
15
+ code: 'ad-slot-1',
16
+ mediaTypes: {
17
+ banner: {
18
+ sizes: [ [300, 250] ]
19
+ }
20
+ },
21
+ bids: [
22
+ {
23
+ bidder: 'fake'
24
+ }
25
+ ]
26
+ };
27
+ const providerConfig = {name: 'intersection', waitForIt: true};
28
+ const rtdConfig = {realTimeData: {auctionDelay: 200, dataProviders: [providerConfig]}}
29
+ describe('IntersectionObserver not supported', function() {
30
+ beforeEach(function() {
31
+ sandbox = sinon.sandbox.create();
32
+ });
33
+ afterEach(function() {
34
+ sandbox.restore();
35
+ sandbox = undefined;
36
+ });
37
+ it('init should return false', function () {
38
+ sandbox.stub(window, 'IntersectionObserver').value(undefined);
39
+ expect(intersectionSubmodule.init({})).is.false;
40
+ });
41
+ });
42
+ describe('IntersectionObserver supported', function() {
43
+ beforeEach(function() {
44
+ sandbox = sinon.sandbox.create();
45
+ placeholder = createDiv();
46
+ append();
47
+ const __config = {};
48
+ sandbox.stub(_config, 'getConfig').callsFake(function (path) {
49
+ return utils.deepAccess(__config, path);
50
+ });
51
+ sandbox.stub(_config, 'setConfig').callsFake(function (obj) {
52
+ utils.mergeDeep(__config, obj);
53
+ });
54
+ });
55
+ afterEach(function() {
56
+ sandbox.restore();
57
+ remove();
58
+ sandbox = undefined;
59
+ placeholder = undefined;
60
+ pbjs.removeAdUnit();
61
+ });
62
+ it('init should return true', function () {
63
+ expect(intersectionSubmodule.init({})).is.true;
64
+ });
65
+ it('should set intersection. (request with "adUnitCodes")', function(done) {
66
+ pbjs.addAdUnits([utils.deepClone(adUnit)]);
67
+ config.setConfig(rtdConfig);
68
+ const onDone = sandbox.stub();
69
+ const requestBidObject = {adUnitCodes: [adUnit.code]};
70
+ intersectionSubmodule.init({});
71
+ intersectionSubmodule.getBidRequestData(
72
+ requestBidObject,
73
+ onDone,
74
+ providerConfig
75
+ );
76
+ setTimeout(function() {
77
+ expect(pbjs.adUnits[0].bids[0]).to.have.property('intersection');
78
+ done();
79
+ }, 200);
80
+ });
81
+ it('should set intersection. (request with "adUnits")', function(done) {
82
+ config.setConfig(rtdConfig);
83
+ const onDone = sandbox.stub();
84
+ const requestBidObject = {adUnits: [utils.deepClone(adUnit)]};
85
+ intersectionSubmodule.init();
86
+ intersectionSubmodule.getBidRequestData(
87
+ requestBidObject,
88
+ onDone,
89
+ providerConfig
90
+ );
91
+ setTimeout(function() {
92
+ expect(requestBidObject.adUnits[0].bids[0]).to.have.property('intersection');
93
+ done();
94
+ }, 200);
95
+ });
96
+ it('should set intersection. (request all)', function(done) {
97
+ pbjs.addAdUnits([utils.deepClone(adUnit)]);
98
+ config.setConfig(rtdConfig);
99
+ const onDone = sandbox.stub();
100
+ const requestBidObject = {};
101
+ intersectionSubmodule.init({});
102
+ intersectionSubmodule.getBidRequestData(
103
+ requestBidObject,
104
+ onDone,
105
+ providerConfig
106
+ );
107
+ setTimeout(function() {
108
+ expect(pbjs.adUnits[0].bids[0]).to.have.property('intersection');
109
+ done();
110
+ }, 200);
111
+ });
112
+ it('should call done due timeout', function(done) {
113
+ config.setConfig(rtdConfig);
114
+ remove();
115
+ const onDone = sandbox.stub();
116
+ const requestBidObject = {adUnits: [utils.deepClone(adUnit)]};
117
+ intersectionSubmodule.init({});
118
+ intersectionSubmodule.getBidRequestData(
119
+ requestBidObject,
120
+ onDone,
121
+ {...providerConfig, test: 1}
122
+ );
123
+ setTimeout(function() {
124
+ sinon.assert.calledOnce(onDone);
125
+ expect(requestBidObject.adUnits[0].bids[0]).to.not.have.property('intersection');
126
+ done();
127
+ }, 300);
128
+ });
129
+ });
130
+ function createDiv() {
131
+ const div = document.createElement('div');
132
+ div.id = adUnit.code;
133
+ return div;
134
+ }
135
+ function append() {
136
+ placeholder && document.body.appendChild(placeholder);
137
+ }
138
+ function remove() {
139
+ placeholder && placeholder.parentElement && placeholder.parentElement.removeChild(placeholder);
140
+ }
141
+ });
@@ -15,7 +15,7 @@ describe('invibesBidAdapter:', function () {
15
15
  params: {
16
16
  placementId: PLACEMENT_ID
17
17
  },
18
- adUnitCode: 'test-div',
18
+ adUnitCode: 'test-div1',
19
19
  auctionId: 'a1',
20
20
  sizes: [
21
21
  [300, 250],
@@ -30,7 +30,7 @@ describe('invibesBidAdapter:', function () {
30
30
  params: {
31
31
  placementId: 'abcde'
32
32
  },
33
- adUnitCode: 'test-div',
33
+ adUnitCode: 'test-div2',
34
34
  auctionId: 'a2',
35
35
  sizes: [
36
36
  [300, 250],
@@ -48,7 +48,7 @@ describe('invibesBidAdapter:', function () {
48
48
  params: {
49
49
  placementId: PLACEMENT_ID
50
50
  },
51
- adUnitCode: 'test-div',
51
+ adUnitCode: 'test-div1',
52
52
  auctionId: 'a1',
53
53
  sizes: [
54
54
  [300, 250],
@@ -67,7 +67,7 @@ describe('invibesBidAdapter:', function () {
67
67
  params: {
68
68
  placementId: 'abcde'
69
69
  },
70
- adUnitCode: 'test-div',
70
+ adUnitCode: 'test-div2',
71
71
  auctionId: 'a2',
72
72
  sizes: [
73
73
  [300, 250],
@@ -158,6 +158,125 @@ describe('invibesBidAdapter:', function () {
158
158
  expect(request.method).to.equal('GET');
159
159
  });
160
160
 
161
+ it('sends bid request to custom endpoint via GET', function () {
162
+ const request = spec.buildRequests([{
163
+ bidId: 'b1',
164
+ bidder: BIDDER_CODE,
165
+ params: {
166
+ placementId: 'placement',
167
+ customEndpoint: 'sub.domain.com/Bid/VideoAdContent'
168
+ },
169
+ adUnitCode: 'test-div1'
170
+ }]);
171
+ expect(request.url).to.equal('sub.domain.com/Bid/VideoAdContent');
172
+ expect(request.method).to.equal('GET');
173
+ });
174
+
175
+ it('sends bid request to default endpoint when no placement', function () {
176
+ const request = spec.buildRequests([{
177
+ bidId: 'b1',
178
+ bidder: BIDDER_CODE,
179
+ params: {
180
+ },
181
+ adUnitCode: 'test-div1'
182
+ }]);
183
+ expect(request.url).to.equal(ENDPOINT);
184
+ expect(request.method).to.equal('GET');
185
+ });
186
+
187
+ it('sends bid request to default endpoint when null placement', function () {
188
+ const request = spec.buildRequests([{
189
+ bidId: 'b1',
190
+ bidder: BIDDER_CODE,
191
+ params: {
192
+ placementId: null
193
+ },
194
+ adUnitCode: 'test-div1'
195
+ }]);
196
+ expect(request.url).to.equal(ENDPOINT);
197
+ expect(request.method).to.equal('GET');
198
+ });
199
+
200
+ it('sends bid request to default endpoint 1 via GET', function () {
201
+ const request = spec.buildRequests([{
202
+ bidId: 'b1',
203
+ bidder: BIDDER_CODE,
204
+ params: {
205
+ placementId: 'placement'
206
+ },
207
+ adUnitCode: 'test-div1'
208
+ }]);
209
+ expect(request.url).to.equal('https://bid.videostep.com/Bid/VideoAdContent');
210
+ expect(request.method).to.equal('GET');
211
+ });
212
+
213
+ it('sends bid request to network id endpoint 1 via GET', function () {
214
+ const request = spec.buildRequests([{
215
+ bidId: 'b1',
216
+ bidder: BIDDER_CODE,
217
+ params: {
218
+ placementId: 'placement',
219
+ domainId: 1001
220
+ },
221
+ adUnitCode: 'test-div1'
222
+ }]);
223
+ expect(request.url).to.equal('https://bid.videostep.com/Bid/VideoAdContent');
224
+ expect(request.method).to.equal('GET');
225
+ });
226
+
227
+ it('sends bid request to network id endpoint 2 via GET', function () {
228
+ const request = spec.buildRequests([{
229
+ bidId: 'b1',
230
+ bidder: BIDDER_CODE,
231
+ params: {
232
+ placementId: 'placement',
233
+ domainId: 1002
234
+ },
235
+ adUnitCode: 'test-div1'
236
+ }]);
237
+ expect(request.url).to.equal('https://bid2.videostep.com/Bid/VideoAdContent');
238
+ expect(request.method).to.equal('GET');
239
+ });
240
+
241
+ it('sends bid request to network id by placement 1 via GET', function () {
242
+ const request = spec.buildRequests([{
243
+ bidId: 'b1',
244
+ bidder: BIDDER_CODE,
245
+ params: {
246
+ placementId: 'infeed_ivbs1'
247
+ },
248
+ adUnitCode: 'test-div1'
249
+ }]);
250
+ expect(request.url).to.equal('https://bid.videostep.com/Bid/VideoAdContent');
251
+ expect(request.method).to.equal('GET');
252
+ });
253
+
254
+ it('sends bid request to network id by placement 2 via GET', function () {
255
+ const request = spec.buildRequests([{
256
+ bidId: 'b1',
257
+ bidder: BIDDER_CODE,
258
+ params: {
259
+ placementId: 'infeed_ivbs2'
260
+ },
261
+ adUnitCode: 'test-div1'
262
+ }]);
263
+ expect(request.url).to.equal('https://bid2.videostep.com/Bid/VideoAdContent');
264
+ expect(request.method).to.equal('GET');
265
+ });
266
+
267
+ it('sends bid request to network id by placement 10 via GET', function () {
268
+ const request = spec.buildRequests([{
269
+ bidId: 'b1',
270
+ bidder: BIDDER_CODE,
271
+ params: {
272
+ placementId: 'infeed_ivbs10'
273
+ },
274
+ adUnitCode: 'test-div1'
275
+ }]);
276
+ expect(request.url).to.equal('https://bid10.videostep.com/Bid/VideoAdContent');
277
+ expect(request.method).to.equal('GET');
278
+ });
279
+
161
280
  it('sends cookies with the bid request', function () {
162
281
  const request = spec.buildRequests(bidRequests);
163
282
  expect(request.options.withCredentials).to.equal(true);
@@ -223,6 +342,12 @@ describe('invibesBidAdapter:', function () {
223
342
  expect(JSON.parse(request.data.bidParamsJson).placementIds).to.contain(bidRequests[1].params.placementId);
224
343
  });
225
344
 
345
+ it('sends all adUnitCodes', function () {
346
+ const request = spec.buildRequests(bidRequests);
347
+ expect(JSON.parse(request.data.bidParamsJson).adUnitCodes).to.contain(bidRequests[0].adUnitCode);
348
+ expect(JSON.parse(request.data.bidParamsJson).adUnitCodes).to.contain(bidRequests[1].adUnitCode);
349
+ });
350
+
226
351
  it('sends all Placement Ids and userId', function () {
227
352
  const request = spec.buildRequests(bidRequestsWithUserId);
228
353
  expect(JSON.parse(request.data.bidParamsJson).userId).to.exist;
@@ -823,6 +948,20 @@ describe('invibesBidAdapter:', function () {
823
948
  }
824
949
  };
825
950
 
951
+ let responseWithAdUnit = {
952
+ Ads: [{
953
+ BidPrice: 0.5,
954
+ VideoExposedId: 123
955
+ }],
956
+ BidModel: {
957
+ BidVersion: 1,
958
+ PlacementId: '12345_test-div1',
959
+ AuctionStartTime: Date.now(),
960
+ CreativeHtml: '<!-- Creative -->'
961
+ },
962
+ UseAdUnitCode: true
963
+ };
964
+
826
965
  var buildResponse = function(placementId, cid, blcids, creativeId) {
827
966
  return {
828
967
  MultipositionEnabled: true,
@@ -911,6 +1050,11 @@ describe('invibesBidAdapter:', function () {
911
1050
  let secondResult = spec.interpretResponse({body: response}, {bidRequests});
912
1051
  expect(secondResult).to.be.empty;
913
1052
  });
1053
+
1054
+ it('bids using the adUnitCode', function () {
1055
+ let result = spec.interpretResponse({body: responseWithAdUnit}, {bidRequests});
1056
+ expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0]));
1057
+ });
914
1058
  });
915
1059
 
916
1060
  context('when the response has meta', function () {