prebid.js 5.17.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/.babelrc.js +3 -6
  2. package/README.md +3 -1
  3. package/browsers.json +1 -8
  4. package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
  5. package/modules/.submodules.json +1 -0
  6. package/modules/adfBidAdapter.js +21 -16
  7. package/modules/adgenerationBidAdapter.js +28 -4
  8. package/modules/adkernelBidAdapter.js +2 -1
  9. package/modules/admixerBidAdapter.js +11 -0
  10. package/modules/adtelligentBidAdapter.js +2 -1
  11. package/modules/airgridRtdProvider.js +1 -1
  12. package/modules/akamaiDapRtdProvider.js +474 -0
  13. package/modules/akamaiDapRtdProvider.md +47 -0
  14. package/modules/aolBidAdapter.js +2 -1
  15. package/modules/appnexusBidAdapter.js +5 -3
  16. package/modules/atsAnalyticsAdapter.js +67 -46
  17. package/modules/atsAnalyticsAdapter.md +1 -0
  18. package/modules/betweenBidAdapter.js +20 -3
  19. package/modules/bliinkBidAdapter.js +58 -32
  20. package/modules/bliinkBidAdapter.md +29 -6
  21. package/modules/browsiRtdProvider.js +106 -18
  22. package/modules/cleanioRtdProvider.js +192 -0
  23. package/modules/cleanioRtdProvider.md +59 -0
  24. package/modules/codefuelBidAdapter.js +183 -0
  25. package/modules/codefuelBidAdapter.md +111 -0
  26. package/modules/connectIdSystem.js +104 -0
  27. package/modules/connectIdSystem.md +33 -0
  28. package/modules/cwireBidAdapter.js +272 -0
  29. package/modules/cwireBidAdapter.md +43 -0
  30. package/modules/deepintentBidAdapter.js +106 -9
  31. package/modules/deepintentBidAdapter.md +36 -1
  32. package/modules/deltaprojectsBidAdapter.js +252 -0
  33. package/modules/deltaprojectsBidAdapter.md +32 -0
  34. package/modules/dgkeywordRtdProvider.js +0 -1
  35. package/modules/engageyaBidAdapter.js +157 -0
  36. package/modules/gridBidAdapter.js +1 -0
  37. package/modules/gumgumBidAdapter.js +8 -0
  38. package/modules/inskinBidAdapter.js +7 -3
  39. package/modules/ixBidAdapter.js +8 -1
  40. package/modules/jixieBidAdapter.js +8 -2
  41. package/modules/justpremiumBidAdapter.js +6 -1
  42. package/modules/limelightDigitalBidAdapter.js +22 -2
  43. package/modules/livewrappedAnalyticsAdapter.js +53 -3
  44. package/modules/mediakeysBidAdapter.js +2 -1
  45. package/modules/multibid/index.js +3 -3
  46. package/modules/nativoBidAdapter.js +6 -2
  47. package/modules/nextMillenniumBidAdapter.js +12 -3
  48. package/modules/oguryBidAdapter.js +36 -7
  49. package/modules/openxBidAdapter.js +34 -22
  50. package/modules/operaadsBidAdapter.js +21 -1
  51. package/modules/otmBidAdapter.js +146 -0
  52. package/modules/otmBidAdapter.md +27 -26
  53. package/modules/outbrainBidAdapter.js +5 -0
  54. package/modules/pixfutureBidAdapter.js +24 -4
  55. package/modules/pixfutureBidAdapter.md +127 -0
  56. package/modules/playwireBidAdapter.md +61 -0
  57. package/modules/prebidServerBidAdapter/index.js +1 -1
  58. package/modules/proxistoreBidAdapter.js +4 -6
  59. package/modules/publinkIdSystem.js +11 -6
  60. package/modules/pubmaticBidAdapter.js +9 -0
  61. package/modules/pubmaticBidAdapter.md +1 -1
  62. package/modules/rtdModule/index.js +2 -2
  63. package/modules/sonobiBidAdapter.js +7 -0
  64. package/modules/sortableBidAdapter.js +1 -0
  65. package/modules/talkadsBidAdapter.js +129 -0
  66. package/modules/talkadsBidAdapter.md +60 -0
  67. package/modules/teadsBidAdapter.js +3 -0
  68. package/modules/tripleliftBidAdapter.js +22 -5
  69. package/modules/trustxBidAdapter.js +8 -6
  70. package/modules/undertoneBidAdapter.js +9 -5
  71. package/modules/undertoneBidAdapter.md +5 -1
  72. package/modules/unicornBidAdapter.js +3 -3
  73. package/modules/userId/eids.js +18 -0
  74. package/modules/userId/eids.md +7 -0
  75. package/modules/userId/userId.md +12 -0
  76. package/modules/ventesBidAdapter.js +370 -0
  77. package/modules/ventesBidAdapter.md +94 -0
  78. package/modules/videobyteBidAdapter.js +13 -6
  79. package/modules/videobyteBidAdapter.md +49 -0
  80. package/modules/visxBidAdapter.js +15 -22
  81. package/modules/yahoosspBidAdapter.js +637 -0
  82. package/modules/yahoosspBidAdapter.md +795 -0
  83. package/modules/yieldlabBidAdapter.js +48 -3
  84. package/modules/yieldlabBidAdapter.md +16 -1
  85. package/modules/yieldmoSyntheticInventoryModule.js +46 -0
  86. package/modules/yieldmoSyntheticInventoryModule.md +68 -0
  87. package/package.json +1 -1
  88. package/src/adapterManager.js +5 -0
  89. package/src/adapters/bidderFactory.js +4 -3
  90. package/src/auction.js +11 -11
  91. package/src/constants.json +1 -0
  92. package/src/secureCreatives.js +6 -7
  93. package/src/targeting.js +11 -9
  94. package/test/spec/modules/adfBidAdapter_spec.js +83 -29
  95. package/test/spec/modules/adgenerationBidAdapter_spec.js +121 -50
  96. package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
  97. package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
  98. package/test/spec/modules/appnexusBidAdapter_spec.js +2 -1
  99. package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
  100. package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
  101. package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
  102. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  103. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  104. package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
  105. package/test/spec/modules/connectIdSystem_spec.js +189 -0
  106. package/test/spec/modules/cwireBidAdapter_spec.js +246 -0
  107. package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
  108. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  109. package/test/spec/modules/engageyaBidAdapter_spec.js +286 -0
  110. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
  111. package/test/spec/modules/ixBidAdapter_spec.js +13 -3
  112. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  113. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  114. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
  115. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +67 -12
  116. package/test/spec/modules/multibid_spec.js +31 -31
  117. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
  118. package/test/spec/modules/oguryBidAdapter_spec.js +125 -37
  119. package/test/spec/modules/openxBidAdapter_spec.js +85 -13
  120. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  121. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  122. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  123. package/test/spec/modules/publinkIdSystem_spec.js +6 -6
  124. package/test/spec/modules/pubmaticBidAdapter_spec.js +39 -1
  125. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  126. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  127. package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
  128. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  129. package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
  130. package/test/spec/modules/trustxBidAdapter_spec.js +3 -3
  131. package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
  132. package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
  133. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  134. package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
  135. package/test/spec/modules/visxBidAdapter_spec.js +48 -4
  136. package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
  137. package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
  138. package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
  139. package/test/spec/unit/core/adapterManager_spec.js +32 -0
  140. package/test/spec/unit/core/bidderFactory_spec.js +61 -1
  141. package/test/spec/unit/pbjs_api_spec.js +37 -2
  142. package/test/spec/unit/secureCreatives_spec.js +54 -25
  143. package/wdio.conf.js +1 -1
  144. package/modules/turktelekomBidAdapter.md +0 -49
  145. package/yarn.lock +0 -13122
@@ -1085,7 +1085,7 @@ describe('OpenxAdapter', function () {
1085
1085
  intentIqId: '1111-intentiqid',
1086
1086
  lipb: {lipbid: '1111-lipb'},
1087
1087
  lotamePanoramaId: '1111-lotameid',
1088
- merkleId: '1111-merkleid',
1088
+ merkleId: {id: '1111-merkleid'},
1089
1089
  netId: 'fH5A3n2O8_CZZyPoJVD-eabc6ECb7jhxCicsds7qSg',
1090
1090
  parrableId: { eid: 'eidVersion.encryptionKeyReference.encryptedValue' },
1091
1091
  pubcid: '1111-pubcid',
@@ -1139,6 +1139,9 @@ describe('OpenxAdapter', function () {
1139
1139
  let userIdValue;
1140
1140
  // handle cases where userId key refers to an object
1141
1141
  switch (userIdProviderKey) {
1142
+ case 'merkleId':
1143
+ userIdValue = EXAMPLE_DATA_BY_ATTR.merkleId.id;
1144
+ break;
1142
1145
  case 'flocId':
1143
1146
  userIdValue = EXAMPLE_DATA_BY_ATTR.flocId.id;
1144
1147
  break;
@@ -1545,7 +1548,7 @@ describe('OpenxAdapter', function () {
1545
1548
  describe('with segments', function () {
1546
1549
  const TESTS = [
1547
1550
  {
1548
- name: 'should send proprietary segment data from first party config',
1551
+ name: 'should send proprietary segment data from ortb2.user.data',
1549
1552
  config: {
1550
1553
  ortb2: {
1551
1554
  user: {
@@ -1556,10 +1559,51 @@ describe('OpenxAdapter', function () {
1556
1559
  }
1557
1560
  }
1558
1561
  },
1559
- expect: 'dmp1/4:foo|bar,dmp2:baz',
1562
+ expect: {sm: 'dmp1/4:foo|bar,dmp2:baz'},
1560
1563
  },
1561
1564
  {
1562
- name: 'should combine same provider segment data from first party config',
1565
+ name: 'should send proprietary segment data from ortb2.site.content.data',
1566
+ config: {
1567
+ ortb2: {
1568
+ site: {
1569
+ content: {
1570
+ data: [
1571
+ {name: 'dmp1', ext: {segtax: 4}, segment: [{id: 'foo'}, {id: 'bar'}]},
1572
+ {name: 'dmp2', segment: [{id: 'baz'}]},
1573
+ ]
1574
+ }
1575
+ }
1576
+ }
1577
+ },
1578
+ expect: {scsm: 'dmp1/4:foo|bar,dmp2:baz'},
1579
+ },
1580
+ {
1581
+ name: 'should send proprietary segment data from both ortb2.site.content.data and ortb2.user.data',
1582
+ config: {
1583
+ ortb2: {
1584
+ user: {
1585
+ data: [
1586
+ {name: 'dmp1', ext: {segtax: 4}, segment: [{id: 'foo'}, {id: 'bar'}]},
1587
+ {name: 'dmp2', segment: [{id: 'baz'}]},
1588
+ ]
1589
+ },
1590
+ site: {
1591
+ content: {
1592
+ data: [
1593
+ {name: 'dmp3', ext: {segtax: 5}, segment: [{id: 'foo2'}, {id: 'bar2'}]},
1594
+ {name: 'dmp4', segment: [{id: 'baz2'}]},
1595
+ ]
1596
+ }
1597
+ }
1598
+ }
1599
+ },
1600
+ expect: {
1601
+ sm: 'dmp1/4:foo|bar,dmp2:baz',
1602
+ scsm: 'dmp3/5:foo2|bar2,dmp4:baz2'
1603
+ },
1604
+ },
1605
+ {
1606
+ name: 'should combine same provider segment data from ortb2.user.data',
1563
1607
  config: {
1564
1608
  ortb2: {
1565
1609
  user: {
@@ -1570,7 +1614,23 @@ describe('OpenxAdapter', function () {
1570
1614
  }
1571
1615
  }
1572
1616
  },
1573
- expect: 'dmp1/4:foo|bar,dmp1:baz',
1617
+ expect: {sm: 'dmp1/4:foo|bar,dmp1:baz'},
1618
+ },
1619
+ {
1620
+ name: 'should combine same provider segment data from ortb2.site.content.data',
1621
+ config: {
1622
+ ortb2: {
1623
+ site: {
1624
+ content: {
1625
+ data: [
1626
+ {name: 'dmp1', ext: {segtax: 4}, segment: [{id: 'foo'}, {id: 'bar'}]},
1627
+ {name: 'dmp1', ext: {}, segment: [{id: 'baz'}]},
1628
+ ]
1629
+ }
1630
+ }
1631
+ }
1632
+ },
1633
+ expect: {scsm: 'dmp1/4:foo|bar,dmp1:baz'},
1574
1634
  },
1575
1635
  {
1576
1636
  name: 'should not send any segment data if first party config is incomplete',
@@ -1595,6 +1655,14 @@ describe('OpenxAdapter', function () {
1595
1655
  {name: 'dmp1', segment: [{id: 'foo'}, {id: 'bar'}]},
1596
1656
  {name: 'dmp2', segment: [{id: 'baz'}]},
1597
1657
  ]
1658
+ },
1659
+ site: {
1660
+ content: {
1661
+ data: [
1662
+ {name: 'dmp3', ext: {segtax: 5}, segment: [{id: 'foo2'}, {id: 'bar2'}]},
1663
+ {name: 'dmp4', segment: [{id: 'baz2'}]},
1664
+ ]
1665
+ }
1598
1666
  }
1599
1667
  }
1600
1668
  },
@@ -1606,7 +1674,10 @@ describe('OpenxAdapter', function () {
1606
1674
  },
1607
1675
  },
1608
1676
  },
1609
- expect: 'dmp1:foo|bar,dmp2:baz,liveintent:l1|l2',
1677
+ expect: {
1678
+ sm: 'dmp1:foo|bar,dmp2:baz,liveintent:l1|l2',
1679
+ scsm: 'dmp3/5:foo2|bar2,dmp4:baz2'
1680
+ },
1610
1681
  },
1611
1682
  {
1612
1683
  name: 'should send just liveintent segment from request if no first party config',
@@ -1619,7 +1690,7 @@ describe('OpenxAdapter', function () {
1619
1690
  },
1620
1691
  },
1621
1692
  },
1622
- expect: 'liveintent:l1|l2',
1693
+ expect: {sm: 'liveintent:l1|l2'},
1623
1694
  },
1624
1695
  {
1625
1696
  name: 'should send nothing if lipb section does not contain segments',
@@ -1636,13 +1707,11 @@ describe('OpenxAdapter', function () {
1636
1707
  utils._each(TESTS, (t) => {
1637
1708
  context('in ortb2.user.data', function () {
1638
1709
  let bidRequests;
1639
- let configStub;
1640
-
1641
1710
  beforeEach(function () {
1642
1711
  let fpdConfig = t.config
1643
- configStub = sinon
1712
+ sinon
1644
1713
  .stub(config, 'getConfig')
1645
- .withArgs('ortb2.user.data')
1714
+ .withArgs(sinon.match(/^ortb2\.user\.data$|^ortb2\.site\.content\.data$/))
1646
1715
  .callsFake((key) => {
1647
1716
  return utils.deepAccess(fpdConfig, key);
1648
1717
  });
@@ -1658,10 +1727,13 @@ describe('OpenxAdapter', function () {
1658
1727
  const request = spec.buildRequests(bidRequests, mockBidderRequest)
1659
1728
  expect(request.length).to.equal(1);
1660
1729
  if (t.expect) {
1661
- expect(request[0].data.sm).to.exist;
1662
- expect(request[0].data.sm).to.equal(encodeURIComponent(t.expect));
1730
+ for (const key in t.expect) {
1731
+ expect(request[0].data[key]).to.exist;
1732
+ expect(request[0].data[key]).to.equal(t.expect[key]);
1733
+ }
1663
1734
  } else {
1664
1735
  expect(request[0].data.sm).to.not.exist;
1736
+ expect(request[0].data.scsm).to.not.exist;
1665
1737
  }
1666
1738
  });
1667
1739
  });
@@ -369,7 +369,7 @@ describe('Opera Ads Bid Adapter', function () {
369
369
  requestData = JSON.parse(reqs[0].data);
370
370
  }).to.not.throw();
371
371
 
372
- expect(requestData.user.id).to.equal(bidRequests[0].userId.sharedid.id);
372
+ expect(requestData.user.buyeruid).to.equal(bidRequests[0].userId.sharedid.id);
373
373
  });
374
374
 
375
375
  it('pubcid should be used when sharedid is empty', function () {
@@ -406,7 +406,7 @@ describe('Opera Ads Bid Adapter', function () {
406
406
  requestData = JSON.parse(reqs[0].data);
407
407
  }).to.not.throw();
408
408
 
409
- expect(requestData.user.id).to.equal(bidRequests[0].userId.pubcid);
409
+ expect(requestData.user.buyeruid).to.equal(bidRequests[0].userId.pubcid);
410
410
  });
411
411
 
412
412
  it('random uid will be generate when userId is empty', function () {
@@ -433,7 +433,7 @@ describe('Opera Ads Bid Adapter', function () {
433
433
  requestData = JSON.parse(reqs[0].data);
434
434
  }).to.not.throw();
435
435
 
436
- expect(requestData.user.id).to.not.be.empty;
436
+ expect(requestData.user.buyeruid).to.not.be.empty;
437
437
  })
438
438
  });
439
439
 
@@ -679,9 +679,41 @@ describe('Opera Ads Bid Adapter', function () {
679
679
  });
680
680
  });
681
681
 
682
- describe('Test getUserSyncs', function () {
683
- it('getUserSyncs should return empty array', function () {
684
- expect(spec.getUserSyncs()).to.be.an('array').that.is.empty;
682
+ describe('Test getUserSyncs with both iframe and pixel disabled', function () {
683
+ it('getUserSyncs should return an empty array', function () {
684
+ const syncOptions = {};
685
+ expect(spec.getUserSyncs(syncOptions)).to.be.an('array').that.is.empty;
686
+ });
687
+ });
688
+
689
+ describe('Test getUserSyncs with iframe enabled', function () {
690
+ it('getUserSyncs should return array', function () {
691
+ const syncOptions = {
692
+ iframeEnabled: true
693
+ }
694
+ const userSyncPixels = spec.getUserSyncs(syncOptions)
695
+ expect(userSyncPixels).to.have.lengthOf(1);
696
+ expect(userSyncPixels[0].url).to.equal('https://s.adx.opera.com/usersync/page')
697
+ });
698
+ });
699
+
700
+ describe('Test getUserSyncs with pixel enabled', function () {
701
+ it('getUserSyncs should return array', function () {
702
+ const serverResponse = {
703
+ body: {
704
+ 'pixels': [
705
+ 'https://b1.com/usersync',
706
+ 'https://b2.com/usersync'
707
+ ]
708
+ }
709
+ };
710
+ const syncOptions = {
711
+ pixelEnabled: true
712
+ }
713
+ const userSyncPixels = spec.getUserSyncs(syncOptions, [serverResponse])
714
+ expect(userSyncPixels).to.have.lengthOf(2);
715
+ expect(userSyncPixels[0].url).to.equal('https://b1.com/usersync')
716
+ expect(userSyncPixels[1].url).to.equal('https://b2.com/usersync')
685
717
  });
686
718
  });
687
719
 
@@ -0,0 +1,67 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/otmBidAdapter';
3
+
4
+ describe('otmBidAdapter', function () {
5
+ it('validate_pub_params', function () {
6
+ expect(spec.isBidRequestValid({
7
+ bidder: 'otm',
8
+ params: {
9
+ tid: '123',
10
+ bidfloor: 20
11
+ }
12
+ })).to.equal(true);
13
+ });
14
+
15
+ it('validate_generated_params', function () {
16
+ let bidRequestData = [{
17
+ bidId: 'bid1234',
18
+ bidder: 'otm',
19
+ params: {
20
+ tid: '123',
21
+ bidfloor: 20
22
+ },
23
+ sizes: [[240, 400]]
24
+ }];
25
+
26
+ let request = spec.buildRequests(bidRequestData);
27
+ let req_data = request[0].data;
28
+
29
+ expect(req_data.bidid).to.equal('bid1234');
30
+ });
31
+
32
+ it('validate_response_params', function () {
33
+ let bidRequestData = {
34
+ data: {
35
+ bidId: 'bid1234'
36
+ }
37
+ };
38
+
39
+ let serverResponse = {
40
+ body: [
41
+ {
42
+ 'auctionid': '3c6f8e22-541b-485c-9214-e974d9fb1b6f',
43
+ 'cpm': 847.097,
44
+ 'ad': '<html><body>test html</body></html>',
45
+ 'w': 240,
46
+ 'h': 400,
47
+ 'currency': 'RUB',
48
+ 'ttl': 300,
49
+ 'creativeid': '1_7869053',
50
+ 'bidid': '101f211def7c99',
51
+ 'transactionid': 'transaction_id_1'
52
+ }
53
+ ]
54
+ };
55
+
56
+ let bids = spec.interpretResponse(serverResponse, bidRequestData);
57
+ expect(bids).to.have.lengthOf(1);
58
+ let bid = bids[0];
59
+ expect(bid.cpm).to.equal(847.097);
60
+ expect(bid.currency).to.equal('RUB');
61
+ expect(bid.width).to.equal(240);
62
+ expect(bid.height).to.equal(400);
63
+ expect(bid.netRevenue).to.equal(true);
64
+ expect(bid.requestId).to.equal('101f211def7c99');
65
+ expect(bid.ad).to.equal('<html><body>test html</body></html>');
66
+ });
67
+ });
@@ -2,6 +2,7 @@ import {expect} from 'chai';
2
2
  import {spec} from 'modules/outbrainBidAdapter.js';
3
3
  import {config} from 'src/config.js';
4
4
  import {server} from 'test/mocks/xhr';
5
+ import { createEidsArray } from 'modules/userId/eids.js';
5
6
 
6
7
  describe('Outbrain Adapter', function () {
7
8
  describe('Bid request and response', function () {
@@ -344,6 +345,23 @@ describe('Outbrain Adapter', function () {
344
345
 
345
346
  config.resetConfig()
346
347
  });
348
+
349
+ it('should pass extended ids', function () {
350
+ let bidRequest = {
351
+ bidId: 'bidId',
352
+ params: {},
353
+ userIdAsEids: createEidsArray({
354
+ idl_env: 'id-value',
355
+ }),
356
+ ...commonBidRequest,
357
+ };
358
+
359
+ let res = spec.buildRequests([bidRequest], commonBidderRequest);
360
+ const resData = JSON.parse(res.data)
361
+ expect(resData.user.ext.eids).to.deep.equal([
362
+ {source: 'liveramp.com', uids: [{id: 'id-value', atype: 3}]}
363
+ ]);
364
+ });
347
365
  })
348
366
 
349
367
  describe('interpretResponse', function () {
@@ -47,12 +47,6 @@ describe('PublinkIdSystem', () => {
47
47
  expect(result.id).to.equal(LOCAL_VALUE.publink);
48
48
  storage.removeDataFromLocalStorage(PUBLINK_COOKIE);
49
49
  });
50
- it('ignore expired cookie', () => {
51
- storage.setDataInLocalStorage(PUBLINK_COOKIE, JSON.stringify({publink: 'value', exp: Date.now() - 60 * 60 * 24 * 1000}));
52
- const result = publinkIdSubmodule.getId();
53
- expect(result.id).to.be.undefined;
54
- storage.removeDataFromLocalStorage(PUBLINK_COOKIE);
55
- });
56
50
  it('priority goes to publink_srv cookie', () => {
57
51
  storage.setCookie(PUBLINK_SRV_COOKIE, JSON.stringify(COOKIE_VALUE), COOKIE_EXPIRATION);
58
52
  storage.setDataInLocalStorage(PUBLINK_COOKIE, JSON.stringify(LOCAL_VALUE));
@@ -61,6 +55,12 @@ describe('PublinkIdSystem', () => {
61
55
  storage.setCookie(PUBLINK_SRV_COOKIE, '', DELETE_COOKIE);
62
56
  storage.removeDataFromLocalStorage(PUBLINK_COOKIE);
63
57
  });
58
+ it('publink non-json cookie', () => {
59
+ storage.setCookie(PUBLINK_COOKIE, COOKIE_VALUE.publink, COOKIE_EXPIRATION);
60
+ const result = publinkIdSubmodule.getId();
61
+ expect(result.id).to.equal(COOKIE_VALUE.publink);
62
+ storage.setCookie(PUBLINK_COOKIE, '', DELETE_COOKIE);
63
+ });
64
64
  });
65
65
 
66
66
  describe('getId', () => {
@@ -1,5 +1,5 @@
1
1
  import {expect} from 'chai';
2
- import {spec} from 'modules/pubmaticBidAdapter.js';
2
+ import {spec, checkVideoPlacement} from 'modules/pubmaticBidAdapter.js';
3
3
  import * as utils from 'src/utils.js';
4
4
  import {config} from 'src/config.js';
5
5
  import { createEidsArray } from 'modules/userId/eids.js';
@@ -3822,5 +3822,43 @@ describe('PubMatic adapter', function () {
3822
3822
  expect(bidRequests[0].params.dctr).to.equal('key1:val1,val2|key2:val1');
3823
3823
  });
3824
3824
  })
3825
+
3826
+ describe('Checking for Video.Placement property', function() {
3827
+ let sandbox, utilsMock;
3828
+ const adUnit = 'Div1';
3829
+ const msg_placement_missing = 'Video.Placement param missing for Div1';
3830
+ let videoData = {
3831
+ battr: [6, 7],
3832
+ skipafter: 15,
3833
+ maxduration: 50,
3834
+ context: 'instream',
3835
+ playerSize: [640, 480],
3836
+ skip: 0,
3837
+ connectiontype: [1, 2, 6],
3838
+ skipmin: 10,
3839
+ minduration: 10,
3840
+ mimes: ['video/mp4', 'video/x-flv'],
3841
+ }
3842
+ beforeEach(() => {
3843
+ utilsMock = sinon.mock(utils);
3844
+ sandbox = sinon.sandbox.create();
3845
+ sandbox.spy(utils, 'logWarn');
3846
+ });
3847
+
3848
+ afterEach(() => {
3849
+ utilsMock.restore();
3850
+ sandbox.restore();
3851
+ })
3852
+
3853
+ it('should log Video.Placement param missing', function() {
3854
+ checkVideoPlacement(videoData, adUnit);
3855
+ sinon.assert.calledWith(utils.logWarn, msg_placement_missing);
3856
+ })
3857
+ it('shoud not log Video.Placement param missing', function() {
3858
+ videoData['placement'] = 1;
3859
+ checkVideoPlacement(videoData, adUnit);
3860
+ sinon.assert.neverCalledWith(utils.logWarn, msg_placement_missing);
3861
+ })
3862
+ });
3825
3863
  });
3826
3864
  });
@@ -238,14 +238,17 @@ describe('SonobiBidAdapter', function () {
238
238
  });
239
239
 
240
240
  describe('.buildRequests', function () {
241
+ let sandbox;
241
242
  beforeEach(function() {
242
243
  sinon.stub(userSync, 'canBidderRegisterSync');
243
244
  sinon.stub(utils, 'getGptSlotInfoForAdUnitCode')
244
- .onFirstCall().returns({gptSlot: '/123123/gpt_publisher/adunit-code-3', divId: 'adunit-code-3-div-id'})
245
+ .onFirstCall().returns({gptSlot: '/123123/gpt_publisher/adunit-code-3', divId: 'adunit-code-3-div-id'});
246
+ sandbox = sinon.createSandbox();
245
247
  });
246
248
  afterEach(function() {
247
249
  userSync.canBidderRegisterSync.restore();
248
250
  utils.getGptSlotInfoForAdUnitCode.restore();
251
+ sandbox.restore();
249
252
  });
250
253
  let bidRequest = [{
251
254
  'schain': {
@@ -333,6 +336,36 @@ describe('SonobiBidAdapter', function () {
333
336
  uspConsent: 'someCCPAString'
334
337
  };
335
338
 
339
+ it('should set fpd if there is any data in ortb2', function() {
340
+ const ortb2 = {
341
+ site: {
342
+ ext: {
343
+ data: {
344
+ pageType: 'article',
345
+ category: 'tools'
346
+ }
347
+ }
348
+ },
349
+ user: {
350
+ ext: {
351
+ data: {
352
+ registered: true,
353
+ interests: ['cars']
354
+ }
355
+ }
356
+ }
357
+ };
358
+
359
+ sandbox.stub(config, 'getConfig').callsFake(key => {
360
+ const config = {
361
+ ortb2: ortb2
362
+ };
363
+ return utils.deepAccess(config, key);
364
+ });
365
+ const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
366
+ expect(bidRequests.data.fpd).to.equal(JSON.stringify(ortb2));
367
+ });
368
+
336
369
  it('should populate coppa as 1 if set in config', function () {
337
370
  config.setConfig({coppa: true});
338
371
  const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
@@ -112,6 +112,13 @@ describe('sortableBidAdapter', function() {
112
112
  'key2': 'val2'
113
113
  }
114
114
  },
115
+ 'ortb2Imp': {
116
+ 'ext': {
117
+ 'data': {
118
+ 'pbadslot': 'abc/123'
119
+ }
120
+ }
121
+ },
115
122
  'sizes': [
116
123
  [300, 250]
117
124
  ],
@@ -176,6 +183,10 @@ describe('sortableBidAdapter', function() {
176
183
  expect(requestBody.imp[0].floor).to.equal(0.21);
177
184
  });
178
185
 
186
+ it('includes pbadslot in the bid request', function () {
187
+ expect(requestBody.imp[0].ext.gpid).to.equal('abc/123');
188
+ });
189
+
179
190
  it('sets domain and href correctly', function () {
180
191
  expect(requestBody.site.domain).to.equal('example.com');
181
192
  expect(requestBody.site.page).to.equal('http://example.com/page?param=val');