prebid.js 7.6.0 → 7.7.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 (159) hide show
  1. package/dist/1plusXRtdProvider.js +1 -0
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adoceanBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.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/bidglassBidAdapter.js +1 -1
  17. package/dist/big-richmediaBidAdapter.js +1 -1
  18. package/dist/bliinkBidAdapter.js +1 -1
  19. package/dist/bridgewellBidAdapter.js +1 -1
  20. package/dist/brightMountainMediaBidAdapter.js +1 -1
  21. package/dist/concertBidAdapter.js +1 -1
  22. package/dist/connectadBidAdapter.js +1 -1
  23. package/dist/consumableBidAdapter.js +1 -1
  24. package/dist/conversantBidAdapter.js +1 -1
  25. package/dist/craftBidAdapter.js +1 -1
  26. package/dist/criteoBidAdapter.js +1 -1
  27. package/dist/currency.js +1 -1
  28. package/dist/dspxBidAdapter.js +1 -1
  29. package/dist/eplanningBidAdapter.js +1 -1
  30. package/dist/finativeBidAdapter.js +1 -1
  31. package/dist/glimpseBidAdapter.js +1 -1
  32. package/dist/gmosspBidAdapter.js +1 -1
  33. package/dist/goldbachBidAdapter.js +1 -1
  34. package/dist/gridBidAdapter.js +1 -1
  35. package/dist/gridNMBidAdapter.js +1 -1
  36. package/dist/gumgumBidAdapter.js +1 -1
  37. package/dist/h12mediaBidAdapter.js +1 -1
  38. package/dist/id5IdSystem.js +1 -1
  39. package/dist/impactifyBidAdapter.js +1 -1
  40. package/dist/improvedigitalBidAdapter.js +1 -1
  41. package/dist/inmarBidAdapter.js +1 -1
  42. package/dist/insticatorBidAdapter.js +1 -1
  43. package/dist/ixBidAdapter.js +1 -1
  44. package/dist/jixieBidAdapter.js +1 -1
  45. package/dist/justpremiumBidAdapter.js +1 -1
  46. package/dist/konduitAnalyticsAdapter.js +1 -1
  47. package/dist/kueezBidAdapter.js +1 -1
  48. package/dist/lassoBidAdapter.js +1 -1
  49. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  50. package/dist/logicadBidAdapter.js +1 -1
  51. package/dist/loglyliftBidAdapter.js +1 -1
  52. package/dist/malltvAnalyticsAdapter.js +1 -1
  53. package/dist/marsmediaBidAdapter.js +1 -1
  54. package/dist/mediafuseBidAdapter.js +1 -1
  55. package/dist/mediasquareBidAdapter.js +1 -1
  56. package/dist/mgidBidAdapter.js +1 -1
  57. package/dist/minutemediaBidAdapter.js +1 -1
  58. package/dist/naveggIdSystem.js +1 -1
  59. package/dist/not-for-prod/prebid.js +112 -111
  60. package/dist/oguryBidAdapter.js +1 -1
  61. package/dist/onetagBidAdapter.js +1 -1
  62. package/dist/ooloAnalyticsAdapter.js +1 -1
  63. package/dist/outbrainBidAdapter.js +1 -1
  64. package/dist/parrableIdSystem.js +1 -1
  65. package/dist/pixfutureBidAdapter.js +1 -1
  66. package/dist/prebid-core.js +1 -1
  67. package/dist/prebidServerBidAdapter.js +1 -1
  68. package/dist/publinkIdSystem.js +1 -1
  69. package/dist/pubmaticBidAdapter.js +1 -1
  70. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  71. package/dist/pxyzBidAdapter.js +1 -1
  72. package/dist/quantcastBidAdapter.js +1 -1
  73. package/dist/readpeakBidAdapter.js +1 -1
  74. package/dist/relaidoBidAdapter.js +1 -1
  75. package/dist/rhythmoneBidAdapter.js +1 -1
  76. package/dist/riseBidAdapter.js +1 -1
  77. package/dist/rubiconAnalyticsAdapter.js +1 -1
  78. package/dist/rubiconBidAdapter.js +1 -1
  79. package/dist/seedingAllianceBidAdapter.js +1 -1
  80. package/dist/seedtagBidAdapter.js +1 -1
  81. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  82. package/dist/sharethroughBidAdapter.js +1 -1
  83. package/dist/shinezBidAdapter.js +1 -1
  84. package/dist/smaatoBidAdapter.js +1 -1
  85. package/dist/smartadserverBidAdapter.js +1 -1
  86. package/dist/smartxBidAdapter.js +1 -1
  87. package/dist/smilewantedBidAdapter.js +1 -1
  88. package/dist/sonobiBidAdapter.js +1 -1
  89. package/dist/sovrnAnalyticsAdapter.js +1 -1
  90. package/dist/sovrnBidAdapter.js +1 -1
  91. package/dist/sspBCBidAdapter.js +1 -1
  92. package/dist/sublimeBidAdapter.js +1 -1
  93. package/dist/synacormediaBidAdapter.js +1 -1
  94. package/dist/targetVideoBidAdapter.js +1 -1
  95. package/dist/teadsBidAdapter.js +1 -1
  96. package/dist/trionBidAdapter.js +1 -1
  97. package/dist/tripleliftBidAdapter.js +1 -1
  98. package/dist/ttdBidAdapter.js +1 -1
  99. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  100. package/dist/underdogmediaBidAdapter.js +1 -1
  101. package/dist/undertoneBidAdapter.js +1 -1
  102. package/dist/userId.js +1 -1
  103. package/dist/vidazooBidAdapter.js +1 -1
  104. package/dist/videobyteBidAdapter.js +1 -1
  105. package/dist/visxBidAdapter.js +1 -1
  106. package/dist/vuukleBidAdapter.js +1 -1
  107. package/dist/widespaceBidAdapter.js +1 -1
  108. package/dist/winrBidAdapter.js +1 -1
  109. package/dist/yahoosspBidAdapter.js +1 -1
  110. package/dist/yieldmoBidAdapter.js +1 -1
  111. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  112. package/integrationExamples/gpt/1plusXRtdProviderExample.html +112 -0
  113. package/modules/.submodules.json +2 -1
  114. package/modules/1plusXRtdProvider.js +251 -0
  115. package/modules/1plusXRtdProvider.md +65 -0
  116. package/modules/adoceanBidAdapter.js +10 -3
  117. package/modules/big-richmediaBidAdapter.js +3 -3
  118. package/modules/bliinkBidAdapter.js +120 -193
  119. package/modules/bliinkBidAdapter.md +2 -5
  120. package/modules/consumableBidAdapter.js +9 -0
  121. package/modules/currency.js +2 -2
  122. package/modules/impactifyBidAdapter.js +6 -2
  123. package/modules/ixBidAdapter.js +61 -14
  124. package/modules/ixBidAdapter.md +2 -5
  125. package/modules/jixieBidAdapter.js +10 -10
  126. package/modules/naveggIdSystem.js +1 -12
  127. package/modules/nextMillenniumBidAdapter.md +1 -1
  128. package/modules/onetagBidAdapter.js +44 -7
  129. package/modules/prebidServerBidAdapter/index.js +7 -0
  130. package/modules/rubiconBidAdapter.js +5 -0
  131. package/modules/seedingAllianceBidAdapter.js +3 -0
  132. package/modules/targetVideoBidAdapter.js +18 -0
  133. package/modules/userId/index.js +39 -21
  134. package/package.json +1 -1
  135. package/src/auction.js +6 -5
  136. package/src/consentHandler.js +11 -11
  137. package/src/debugging.js +5 -3
  138. package/src/hook.js +2 -2
  139. package/src/utils/promise.js +96 -21
  140. package/src/utils.js +3 -2
  141. package/test/helpers/consentData.js +2 -1
  142. package/test/spec/auctionmanager_spec.js +1 -6
  143. package/test/spec/debugging_spec.js +2 -2
  144. package/test/spec/modules/1plusXRtdProvider_spec.js +430 -0
  145. package/test/spec/modules/adoceanBidAdapter_spec.js +4 -1
  146. package/test/spec/modules/bliinkBidAdapter_spec.js +323 -136
  147. package/test/spec/modules/consumableBidAdapter_spec.js +47 -1
  148. package/test/spec/modules/idxIdSystem_spec.js +1 -1
  149. package/test/spec/modules/ixBidAdapter_spec.js +77 -2
  150. package/test/spec/modules/jixieBidAdapter_spec.js +8 -8
  151. package/test/spec/modules/onetagBidAdapter_spec.js +53 -4
  152. package/test/spec/modules/parrableIdSystem_spec.js +2 -1
  153. package/test/spec/modules/prebidServerBidAdapter_spec.js +20 -0
  154. package/test/spec/modules/rubiconBidAdapter_spec.js +27 -0
  155. package/test/spec/modules/targetVideoBidAdapter_spec.js +43 -0
  156. package/test/spec/modules/userId_spec.js +15 -2
  157. package/test/spec/unit/pbjs_api_spec.js +1 -5
  158. package/test/spec/unit/utils/promise_spec.js +283 -38
  159. package/test/helpers/syncPromise.js +0 -71
@@ -33,6 +33,22 @@ const BIDDER_REQUEST_1 = {
33
33
  transactionId: '92489f71-1bf2-49a0-adf9-000cea934729'
34
34
  }
35
35
  ],
36
+ schain: {
37
+ 'ver': '1.0',
38
+ 'complete': 1,
39
+ 'nodes': [
40
+ {
41
+ 'asi': 'indirectseller.com',
42
+ 'sid': '00001',
43
+ 'hp': 1
44
+ },
45
+ {
46
+ 'asi': 'indirectseller-2.com',
47
+ 'sid': '00002',
48
+ 'hp': 2
49
+ },
50
+ ]
51
+ },
36
52
  gdprConsent: {
37
53
  consentString: 'consent-test',
38
54
  gdprApplies: false
@@ -335,7 +351,37 @@ describe('Consumable BidAdapter', function () {
335
351
  let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1);
336
352
 
337
353
  expect(request.bidderRequest).to.equal(BIDDER_REQUEST_1);
338
- })
354
+ });
355
+
356
+ it('should contain schain if it exists in the bidRequest', function () {
357
+ let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1);
358
+ let data = JSON.parse(request.data);
359
+
360
+ expect(data.schain).to.deep.equal(BIDDER_REQUEST_1.schain)
361
+ });
362
+
363
+ it('should not contain schain if it does not exist in the bidRequest', function () {
364
+ let request = spec.buildRequests(BIDDER_REQUEST_2.bidRequest, BIDDER_REQUEST_2);
365
+ let data = JSON.parse(request.data);
366
+
367
+ expect(data.schain).to.be.undefined;
368
+ });
369
+
370
+ it('should contain coppa if configured', function () {
371
+ config.setConfig({ coppa: true });
372
+ let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1);
373
+ let data = JSON.parse(request.data);
374
+
375
+ expect(data.coppa).to.be.true;
376
+ });
377
+
378
+ it('should not contain coppa if not configured', function () {
379
+ config.setConfig({ coppa: false });
380
+ let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1);
381
+ let data = JSON.parse(request.data);
382
+
383
+ expect(data.coppa).to.be.undefined;
384
+ });
339
385
  });
340
386
  describe('interpretResponse validation', function () {
341
387
  it('response should have valid bidderCode', function () {
@@ -94,8 +94,8 @@ describe('IDx ID System', () => {
94
94
  adUnits = [getAdUnitMock()];
95
95
  init(config);
96
96
  setSubmoduleRegistry([idxIdSubmodule]);
97
- config.setConfig(getConfigMock());
98
97
  getCookieStub.withArgs(IDX_COOKIE_NAME).returns(IDX_COOKIE_STORED);
98
+ config.setConfig(getConfigMock());
99
99
  });
100
100
 
101
101
  afterEach(() => {
@@ -290,6 +290,7 @@ describe('IndexexchangeAdapter', function () {
290
290
  {
291
291
  bidder: 'ix',
292
292
  params: {
293
+ tagId: '123',
293
294
  siteId: '123',
294
295
  size: [300, 250],
295
296
  },
@@ -304,7 +305,10 @@ describe('IndexexchangeAdapter', function () {
304
305
  },
305
306
  ortb2Imp: {
306
307
  ext: {
307
- tid: '173f49a8-7549-4218-a23c-e7ba59b47230'
308
+ tid: '173f49a8-7549-4218-a23c-e7ba59b47230',
309
+ data: {
310
+ pbadslot: 'div-gpt-ad-1460505748562-0'
311
+ }
308
312
  }
309
313
  },
310
314
  adUnitCode: 'div-gpt-ad-1460505748562-0',
@@ -320,6 +324,7 @@ describe('IndexexchangeAdapter', function () {
320
324
  {
321
325
  bidder: 'ix',
322
326
  params: {
327
+ tagId: '123',
323
328
  siteId: '456',
324
329
  video: {
325
330
  skippable: false,
@@ -344,7 +349,10 @@ describe('IndexexchangeAdapter', function () {
344
349
  },
345
350
  ortb2Imp: {
346
351
  ext: {
347
- tid: '173f49a8-7549-4218-a23c-e7ba59b47230'
352
+ tid: '173f49a8-7549-4218-a23c-e7ba59b47230',
353
+ data: {
354
+ pbadslot: 'div-gpt-ad-1460505748562-0'
355
+ }
348
356
  }
349
357
  },
350
358
  adUnitCode: 'div-gpt-ad-1460505748562-0',
@@ -1649,6 +1657,70 @@ describe('IndexexchangeAdapter', function () {
1649
1657
  expect(gpid).to.equal(GPID);
1650
1658
  });
1651
1659
 
1660
+ it('should still build gpid in request if ortb2Imp.ext.gpid does not exist', function () {
1661
+ const AD_UNIT_CODE = '/1111/home';
1662
+ const validBids = utils.deepClone(DEFAULT_BANNER_VALID_BID);
1663
+ sinon.stub(utils, 'getGptSlotInfoForAdUnitCode')
1664
+ .returns({ gptSlot: AD_UNIT_CODE, divId: 'adunit-code-3-div-id' });
1665
+ validBids[0].ortb2Imp = {
1666
+ ext: {
1667
+ data: {
1668
+ adserver: {
1669
+ name: 'gam',
1670
+ adslot: AD_UNIT_CODE
1671
+ }
1672
+ }
1673
+ }
1674
+ }
1675
+ const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
1676
+ const { ext: { gpid } } = JSON.parse(requests[0].data.r).imp[0];
1677
+ utils.getGptSlotInfoForAdUnitCode.restore();
1678
+ expect(gpid).to.equal(`${AD_UNIT_CODE}#adunit-code-3-div-id`);
1679
+ });
1680
+
1681
+ it('should not build gpid if divid doesnt exist when ortb2Imp.ext.gpid does not exist', function () {
1682
+ const AD_UNIT_CODE = '/1111/home';
1683
+ const validBids = utils.deepClone(DEFAULT_BANNER_VALID_BID);
1684
+ sinon.stub(utils, 'getGptSlotInfoForAdUnitCode')
1685
+ .returns({ gptSlot: AD_UNIT_CODE });
1686
+ validBids[0].ortb2Imp = {
1687
+ ext: {
1688
+ data: {
1689
+ adserver: {
1690
+ name: 'gam',
1691
+ adslot: AD_UNIT_CODE
1692
+ }
1693
+ }
1694
+ }
1695
+ }
1696
+ const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
1697
+ const imp = JSON.parse(requests[0].data.r).imp[0];
1698
+ utils.getGptSlotInfoForAdUnitCode.restore();
1699
+ expect(imp.ext.gpid).to.be.undefined;
1700
+ expect(imp.ext.dfp_ad_unit_code).to.equal(AD_UNIT_CODE)
1701
+ });
1702
+
1703
+ it('should not build gpid if dfp ad unit code / divid doesnt exist when ortb2Imp.ext.gpid does not exist', function () {
1704
+ const AD_UNIT_CODE = '/1111/home';
1705
+ const validBids = utils.deepClone(DEFAULT_BANNER_VALID_BID);
1706
+ sinon.stub(utils, 'getGptSlotInfoForAdUnitCode')
1707
+ .returns({});
1708
+ validBids[0].ortb2Imp = {
1709
+ ext: {
1710
+ data: {
1711
+ adserver: {
1712
+ name: 'gam',
1713
+ }
1714
+ }
1715
+ }
1716
+ }
1717
+ const requests = spec.buildRequests(validBids, DEFAULT_OPTION);
1718
+
1719
+ const imp = JSON.parse(requests[0].data.r).imp[0];
1720
+ utils.getGptSlotInfoForAdUnitCode.restore();
1721
+ expect(imp.ext).to.be.undefined;
1722
+ });
1723
+
1652
1724
  it('should send gpid in request if ortb2Imp.ext.gpid exists when no size present', function () {
1653
1725
  const validBids = utils.deepClone(DEFAULT_BANNER_VALID_BID_PARAM_NO_SIZE);
1654
1726
  validBids[0].ortb2Imp = {
@@ -2614,6 +2686,9 @@ describe('IndexexchangeAdapter', function () {
2614
2686
  expect(diagObj.allu).to.equal(2);
2615
2687
  expect(diagObj.version).to.equal('$prebid.version$');
2616
2688
  expect(diagObj.url).to.equal('http://localhost:9876/context.html')
2689
+ expect(diagObj.pbadslot).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].ortb2Imp.ext.data.pbadslot)
2690
+ expect(diagObj.tagid).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].params.tagId)
2691
+ expect(diagObj.adunitcode).to.equal(DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0].adUnitCode)
2617
2692
  });
2618
2693
  });
2619
2694
  });
@@ -199,16 +199,16 @@ describe('jixie Adapter', function () {
199
199
  let getCookieStub = sinon.stub(storage, 'getCookie');
200
200
  let getLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
201
201
  getCookieStub
202
- .withArgs('_jx')
202
+ .withArgs('_jxx')
203
203
  .returns(clientIdTest1_);
204
204
  getCookieStub
205
- .withArgs('_jxs')
205
+ .withArgs('_jxxs')
206
206
  .returns(sessionIdTest1_);
207
207
  getLocalStorageStub
208
- .withArgs('_jx')
208
+ .withArgs('_jxx')
209
209
  .returns(clientIdTest1_);
210
210
  getLocalStorageStub
211
- .withArgs('_jxs')
211
+ .withArgs('_jxxs')
212
212
  .returns(sessionIdTest1_
213
213
  );
214
214
  let miscDimsStub = sinon.stub(jixieaux, 'getMiscDims');
@@ -528,10 +528,10 @@ describe('jixie Adapter', function () {
528
528
  let setCookieSpy = sinon.spy(storage, 'setCookie');
529
529
  let setLocalStorageSpy = sinon.spy(storage, 'setDataInLocalStorage');
530
530
  const result = spec.interpretResponse({body: responseBody_}, requestObj_)
531
- expect(setLocalStorageSpy.calledWith('_jx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
532
- expect(setLocalStorageSpy.calledWith('_jxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
533
- expect(setCookieSpy.calledWith('_jxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
534
- expect(setCookieSpy.calledWith('_jx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
531
+ expect(setLocalStorageSpy.calledWith('_jxx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
532
+ expect(setLocalStorageSpy.calledWith('_jxxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
533
+ expect(setCookieSpy.calledWith('_jxxs', '1600057934-43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
534
+ expect(setCookieSpy.calledWith('_jxx', '43aacc10-f643-11ea-8a10-c5fe2d394e7e')).to.equal(true);
535
535
 
536
536
  // video ad with vastUrl returned by adserver
537
537
  expect(result[0].requestId).to.equal('62847e4c696edcb')
@@ -1,4 +1,4 @@
1
- import { spec, isValid, hasTypeVideo } from 'modules/onetagBidAdapter.js';
1
+ import { spec, isValid, hasTypeVideo, isSchainValid } from 'modules/onetagBidAdapter.js';
2
2
  import { expect } from 'chai';
3
3
  import {find} from 'src/polyfill.js';
4
4
  import { BANNER, VIDEO } from 'src/mediaTypes.js';
@@ -15,7 +15,21 @@ describe('onetag', function () {
15
15
  'bidId': '30b31c1838de1e',
16
16
  'bidderRequestId': '22edbae2733bf6',
17
17
  'auctionId': '1d1a030790a475',
18
- 'transactionId': 'qwerty123'
18
+ 'transactionId': 'qwerty123',
19
+ 'schain': {
20
+ 'validation': 'off',
21
+ 'config': {
22
+ 'ver': '1.0',
23
+ 'complete': 1,
24
+ 'nodes': [
25
+ {
26
+ 'asi': 'indirectseller.com',
27
+ 'sid': '00001',
28
+ 'hp': 1
29
+ }
30
+ ]
31
+ }
32
+ },
19
33
  };
20
34
  }
21
35
 
@@ -193,7 +207,8 @@ describe('onetag', function () {
193
207
  'context',
194
208
  'playerSize',
195
209
  'mediaTypeInfo',
196
- 'type'
210
+ 'type',
211
+ 'priceFloors'
197
212
  );
198
213
  } else if (isValid(BANNER, bid)) {
199
214
  expect(bid).to.have.all.keys(
@@ -205,9 +220,13 @@ describe('onetag', function () {
205
220
  'transactionId',
206
221
  'mediaTypeInfo',
207
222
  'sizes',
208
- 'type'
223
+ 'type',
224
+ 'priceFloors'
209
225
  );
210
226
  }
227
+ if (bid.schain && isSchainValid(bid.schain)) {
228
+ expect(data).to.have.all.keys('schain');
229
+ }
211
230
  expect(bid.bidId).to.be.a('string');
212
231
  expect(bid.pubId).to.be.a('string');
213
232
  }
@@ -358,6 +377,36 @@ describe('onetag', function () {
358
377
  expect(syncs[0].url).to.match(/(?:[?&](?:us_privacy=us_foo(?:[&][^&]*)*))+$/);
359
378
  });
360
379
  });
380
+ describe('isSchainValid', function () {
381
+ it('Should return false when schain is null or undefined', function () {
382
+ expect(isSchainValid(null)).to.be.false;
383
+ expect(isSchainValid(undefined)).to.be.false;
384
+ });
385
+ it('Should return false when schain is missing nodes key', function () {
386
+ const schain = {'otherKey': 'otherValue'};
387
+ expect(isSchainValid(schain)).to.be.false;
388
+ });
389
+ it('Should return false when schain is missing one of the required SupplyChainNode attribute', function () {
390
+ const missingAsiNode = {'sid': '00001', 'hp': 1};
391
+ const missingSidNode = {'asi': 'indirectseller.com', 'hp': 1};
392
+ const missingHpNode = {'asi': 'indirectseller.com', 'sid': '00001'};
393
+ expect(isSchainValid({'config': {'nodes': [missingAsiNode]}})).to.be.false;
394
+ expect(isSchainValid({'config': {'nodes': [missingSidNode]}})).to.be.false;
395
+ expect(isSchainValid({'config': {'nodes': [missingHpNode]}})).to.be.false;
396
+ });
397
+ it('Should return true when schain contains all required attributes', function () {
398
+ const validSchain = {
399
+ 'nodes': [
400
+ {
401
+ 'asi': 'indirectseller.com',
402
+ 'sid': '00001',
403
+ 'hp': 1
404
+ }
405
+ ]
406
+ };
407
+ expect(isSchainValid(validSchain)).to.be.true;
408
+ })
409
+ });
361
410
  });
362
411
 
363
412
  function getBannerVideoResponse() {
@@ -655,7 +655,6 @@ describe('Parrable ID System', function() {
655
655
  writeParrableCookie({ eid: P_COOKIE_EID, ibaOptout: true });
656
656
  init(config);
657
657
  setSubmoduleRegistry([parrableIdSubmodule]);
658
- config.setConfig(getConfigMock());
659
658
  });
660
659
 
661
660
  afterEach(function() {
@@ -665,6 +664,7 @@ describe('Parrable ID System', function() {
665
664
  });
666
665
 
667
666
  it('when a stored Parrable ID exists it is added to bids', function(done) {
667
+ config.setConfig(getConfigMock());
668
668
  requestBidsHook(function() {
669
669
  adUnits.forEach(unit => {
670
670
  unit.bids.forEach(bid => {
@@ -691,6 +691,7 @@ describe('Parrable ID System', function() {
691
691
  it('supplies an optout reason when the EID is missing due to CCPA non-consent', function(done) {
692
692
  // the ID system itself will not write a cookie with an EID when CCPA=true
693
693
  writeParrableCookie({ ccpaOptout: true });
694
+ config.setConfig(getConfigMock());
694
695
 
695
696
  requestBidsHook(function() {
696
697
  adUnits.forEach(unit => {
@@ -2692,6 +2692,26 @@ describe('S2S Adapter', function () {
2692
2692
  sinon.assert.match(actual.imp[0], sinon.match(ortb2Imp));
2693
2693
  });
2694
2694
 
2695
+ it('setting adapterCode for default bidder', function () {
2696
+ config.setConfig({ CONFIG });
2697
+ adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
2698
+ server.requests[0].respond(200, {}, JSON.stringify(RESPONSE_OPENRTB));
2699
+
2700
+ const response = addBidResponse.firstCall.args[1];
2701
+ expect(response).to.have.property('adapterCode', 'appnexus');
2702
+ });
2703
+
2704
+ it('setting adapterCode for alternate bidder', function () {
2705
+ config.setConfig({ CONFIG });
2706
+ let RESPONSE_OPENRTB2 = deepClone(RESPONSE_OPENRTB);
2707
+ RESPONSE_OPENRTB2.seatbid[0].bid[0].ext.prebid.meta.adaptercode = 'appnexus2'
2708
+ adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
2709
+ server.requests[0].respond(200, {}, JSON.stringify(RESPONSE_OPENRTB2));
2710
+
2711
+ const response = addBidResponse.firstCall.args[1];
2712
+ expect(response).to.have.property('adapterCode', 'appnexus2');
2713
+ });
2714
+
2695
2715
  describe('on sync requested with no cookie', () => {
2696
2716
  let cfg, req, csRes;
2697
2717
 
@@ -2139,6 +2139,33 @@ describe('the rubicon adapter', function () {
2139
2139
  expect(request.data.imp[0].ext.data.pbadslot).to.equal('1234567890');
2140
2140
  });
2141
2141
 
2142
+ it('should NOT include storedrequests in pbs payload', function () {
2143
+ createVideoBidderRequest();
2144
+ bidderRequest.bids[0].ortb2 = {
2145
+ ext: {
2146
+ prebid: {
2147
+ storedrequest: 'no-send-top-level-sr'
2148
+ }
2149
+ }
2150
+ }
2151
+
2152
+ bidderRequest.bids[0].ortb2Imp = {
2153
+ ext: {
2154
+ prebid: {
2155
+ storedrequest: 'no-send-imp-sr'
2156
+ }
2157
+ }
2158
+ }
2159
+
2160
+ sandbox.stub(Date, 'now').callsFake(() =>
2161
+ bidderRequest.auctionStart + 100
2162
+ );
2163
+
2164
+ const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
2165
+ expect(request.data.ext.prebid.storedrequest).to.be.undefined;
2166
+ expect(request.data.imp[0].ext.prebid.storedrequest).to.be.undefined;
2167
+ });
2168
+
2142
2169
  it('should include GAM ad unit in bid request', function () {
2143
2170
  createVideoBidderRequest();
2144
2171
  bidderRequest.bids[0].ortb2Imp = {
@@ -93,4 +93,47 @@ describe('TargetVideo Bid Adapter', function() {
93
93
  expect(bid.ad).to.include('<script src="https://player.target-video.com/custom/targetvideo-banner.js"></script>')
94
94
  expect(bid.ad).to.include('initPlayer')
95
95
  });
96
+
97
+ it('Test GDPR consent information is present in the request', function () {
98
+ let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
99
+ let bidderRequest = {
100
+ 'bidderCode': 'targetVideo',
101
+ 'auctionId': '1d1a030790a475',
102
+ 'bidderRequestId': '22edbae2733bf6',
103
+ 'timeout': 3000,
104
+ 'gdprConsent': {
105
+ consentString: consentString,
106
+ gdprApplies: true,
107
+ addtlConsent: '1~7.12.35.62.66.70.89.93.108'
108
+ }
109
+ };
110
+ bidderRequest.bids = bannerRequest;
111
+
112
+ const request = spec.buildRequests(bannerRequest, bidderRequest);
113
+ expect(request.options).to.deep.equal({withCredentials: true});
114
+ const payload = JSON.parse(request.data);
115
+
116
+ expect(payload.gdpr_consent).to.exist;
117
+ expect(payload.gdpr_consent.consent_string).to.exist.and.to.equal(consentString);
118
+ expect(payload.gdpr_consent.consent_required).to.exist.and.to.be.true;
119
+ expect(payload.gdpr_consent.addtl_consent).to.exist.and.to.deep.equal([7, 12, 35, 62, 66, 70, 89, 93, 108]);
120
+ });
121
+
122
+ it('Test US Privacy string is present in the request', function() {
123
+ let consentString = '1YA-';
124
+ let bidderRequest = {
125
+ 'bidderCode': 'targetVideo',
126
+ 'auctionId': '1d1a030790a475',
127
+ 'bidderRequestId': '22edbae2733bf6',
128
+ 'timeout': 3000,
129
+ 'uspConsent': consentString
130
+ };
131
+ bidderRequest.bids = bannerRequest;
132
+
133
+ const request = spec.buildRequests(bannerRequest, bidderRequest);
134
+ const payload = JSON.parse(request.data);
135
+
136
+ expect(payload.us_privacy).to.exist;
137
+ expect(payload.us_privacy).to.exist.and.to.equal(consentString);
138
+ });
96
139
  });
@@ -466,6 +466,7 @@ describe('User ID', function () {
466
466
  describe('refreshing before init is complete', () => {
467
467
  const MOCK_ID = {'MOCKID': '1111'};
468
468
  let mockIdCallback;
469
+ let startInit;
469
470
 
470
471
  beforeEach(() => {
471
472
  mockIdCallback = sinon.stub();
@@ -480,7 +481,7 @@ describe('User ID', function () {
480
481
  };
481
482
  init(config);
482
483
  setSubmoduleRegistry([mockIdSystem]);
483
- config.setConfig({
484
+ startInit = () => config.setConfig({
484
485
  userSync: {
485
486
  auctionDelay: 10,
486
487
  userIds: [{
@@ -492,6 +493,7 @@ describe('User ID', function () {
492
493
  });
493
494
 
494
495
  it('should still resolve promises returned by getUserIdsAsync', () => {
496
+ startInit();
495
497
  let result = null;
496
498
  getGlobal().getUserIdsAsync().then((val) => { result = val; });
497
499
  return clearStack().then(() => {
@@ -506,6 +508,7 @@ describe('User ID', function () {
506
508
  it('should not stop auctions', (done) => {
507
509
  // simulate an infinite `auctionDelay`; refreshing should still allow the auction to continue
508
510
  // as soon as ID submodules have completed init
511
+ startInit();
509
512
  requestBidsHook(() => {
510
513
  done();
511
514
  }, {adUnits: [getAdUnitMock()]}, {delay: delay()});
@@ -519,6 +522,7 @@ describe('User ID', function () {
519
522
  it('should not get stuck when init fails', () => {
520
523
  const err = new Error();
521
524
  mockIdCallback.callsFake(() => { throw err; });
525
+ startInit();
522
526
  return getGlobal().getUserIdsAsync().catch((e) =>
523
527
  expect(e).to.equal(err)
524
528
  );
@@ -2531,7 +2535,6 @@ describe('User ID', function () {
2531
2535
 
2532
2536
  // init id system
2533
2537
  attachIdSystem(mockIdSystem);
2534
- config.setConfig(userIdConfig);
2535
2538
  });
2536
2539
 
2537
2540
  afterEach(function () {
@@ -2542,6 +2545,8 @@ describe('User ID', function () {
2542
2545
  coreStorage.setCookie(mockIdCookieName, JSON.stringify({id: '1234'}), expStr);
2543
2546
  coreStorage.setCookie(`${mockIdCookieName}_last`, (new Date(Date.now() - 1 * 1000).toUTCString()), expStr);
2544
2547
 
2548
+ config.setConfig(userIdConfig);
2549
+
2545
2550
  let innerAdUnits;
2546
2551
  return runBidsHook((config) => {
2547
2552
  innerAdUnits = config.adUnits
@@ -2556,6 +2561,8 @@ describe('User ID', function () {
2556
2561
  coreStorage.setCookie(mockIdCookieName, JSON.stringify({id: '1234'}), expStr);
2557
2562
  coreStorage.setCookie(`${mockIdCookieName}_last`, (new Date(Date.now() - 60 * 1000).toUTCString()), expStr);
2558
2563
 
2564
+ config.setConfig(userIdConfig);
2565
+
2559
2566
  let innerAdUnits;
2560
2567
  return runBidsHook((config) => {
2561
2568
  innerAdUnits = config.adUnits
@@ -2572,6 +2579,8 @@ describe('User ID', function () {
2572
2579
 
2573
2580
  setStoredConsentData();
2574
2581
 
2582
+ config.setConfig(userIdConfig);
2583
+
2575
2584
  let innerAdUnits;
2576
2585
  return runBidsHook((config) => {
2577
2586
  innerAdUnits = config.adUnits
@@ -2588,6 +2597,8 @@ describe('User ID', function () {
2588
2597
 
2589
2598
  setStoredConsentData({...consentData, consentString: 'different'});
2590
2599
 
2600
+ config.setConfig(userIdConfig);
2601
+
2591
2602
  let innerAdUnits;
2592
2603
  return runBidsHook((config) => {
2593
2604
  innerAdUnits = config.adUnits
@@ -2604,6 +2615,8 @@ describe('User ID', function () {
2604
2615
 
2605
2616
  setStoredConsentData({...consentData});
2606
2617
 
2618
+ config.setConfig(userIdConfig);
2619
+
2607
2620
  let innerAdUnits;
2608
2621
  return runBidsHook((config) => {
2609
2622
  innerAdUnits = config.adUnits
@@ -16,7 +16,6 @@ import * as auctionModule from 'src/auction.js';
16
16
  import { registerBidder } from 'src/adapters/bidderFactory.js';
17
17
  import { _sendAdToCreative } from 'src/secureCreatives.js';
18
18
  import {find} from 'src/polyfill.js';
19
- import {synchronizePromise} from '../../helpers/syncPromise.js';
20
19
  import * as pbjsModule from 'src/prebid.js';
21
20
  import {hook} from '../../../src/hook.js';
22
21
  import {reset as resetDebugging} from '../../../src/debugging.js';
@@ -195,7 +194,7 @@ window.apntag = {
195
194
  }
196
195
 
197
196
  describe('Unit: Prebid Module', function () {
198
- let bidExpiryStub, promiseSandbox;
197
+ let bidExpiryStub
199
198
 
200
199
  before(() => {
201
200
  hook.ready();
@@ -204,15 +203,12 @@ describe('Unit: Prebid Module', function () {
204
203
  });
205
204
 
206
205
  beforeEach(function () {
207
- promiseSandbox = sinon.createSandbox();
208
- synchronizePromise(promiseSandbox);
209
206
  bidExpiryStub = sinon.stub(filters, 'isBidNotExpired').callsFake(() => true);
210
207
  configObj.setConfig({ useBidCache: true });
211
208
  resetAuctionState();
212
209
  });
213
210
 
214
211
  afterEach(function() {
215
- promiseSandbox.restore();
216
212
  $$PREBID_GLOBAL$$.adUnits = [];
217
213
  bidExpiryStub.restore();
218
214
  configObj.setConfig({ useBidCache: false });