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
@@ -0,0 +1,231 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/talkadsBidAdapter.js';
3
+ import {newBidder} from 'src/adapters/bidderFactory.js';
4
+ import {config} from '../../../src/config';
5
+ import {server} from '../../mocks/xhr';
6
+
7
+ describe('TalkAds adapter', function () {
8
+ const commonBidderRequest = {
9
+ refererInfo: {
10
+ referer: 'https://example.com/'
11
+ },
12
+ timeout: 3000,
13
+ }
14
+ const commonBidRequest = {
15
+ bidder: 'talkads',
16
+ params: {
17
+ tag_id: 999999,
18
+ bidder_url: 'https://test.natexo-programmatic.com/tad/tag/prebid',
19
+ },
20
+ bidId: '1a2b3c4d56e7f0',
21
+ auctionId: '12345678-1234-1a2b-3c4d-1a2b3c4d56e7',
22
+ transactionId: '4f68b713-04ba-4d7f-8df9-643bcdab5efb',
23
+ };
24
+ const nativeBidRequestParams = {
25
+ nativeParams: {},
26
+ };
27
+ const bannerBidRequestParams = {
28
+ sizes: [[300, 250], [300, 600]],
29
+ };
30
+
31
+ /**
32
+ * isBidRequestValid
33
+ */
34
+ describe('isBidRequestValid1', function() {
35
+ it('should fail when config is invalid', function () {
36
+ const bidRequest = {
37
+ ...commonBidRequest,
38
+ ...bannerBidRequestParams,
39
+ };
40
+ bidRequest.params = Object.assign({}, bidRequest.params);
41
+ delete bidRequest.params;
42
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
43
+ });
44
+ }); // isBidRequestValid1
45
+ describe('isBidRequestValid2', function() {
46
+ it('should fail when config is invalid', function () {
47
+ const bidRequest = {
48
+ ...commonBidRequest,
49
+ ...bannerBidRequestParams,
50
+ };
51
+ bidRequest.params = Object.assign({}, bidRequest.params);
52
+ delete bidRequest.params.bidder_url;
53
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
54
+ });
55
+ }); // isBidRequestValid2
56
+ describe('isBidRequestValid3', function() {
57
+ it('should fail when config is invalid', function () {
58
+ const bidRequest = {
59
+ ...commonBidRequest,
60
+ ...bannerBidRequestParams,
61
+ };
62
+ bidRequest.params = Object.assign({}, bidRequest.params);
63
+ delete bidRequest.params.tag_id;
64
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
65
+ });
66
+ }); // isBidRequestValid3
67
+ describe('isBidRequestValid4', function() {
68
+ let bidRequest = {
69
+ ...commonBidRequest,
70
+ ...bannerBidRequestParams,
71
+ };
72
+ it('should succeed when a banner bid is valid', function () {
73
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
74
+ });
75
+ bidRequest = {
76
+ ...commonBidRequest,
77
+ ...nativeBidRequestParams,
78
+ };
79
+ it('should succeed when a native bid is valid', function () {
80
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
81
+ });
82
+ }); // isBidRequestValid4
83
+
84
+ /**
85
+ * buildRequests
86
+ */
87
+ describe('buildRequests1', function() {
88
+ let bidRequest = {
89
+ ...commonBidRequest,
90
+ ...bannerBidRequestParams,
91
+ };
92
+ const loServerRequest = {
93
+ cur: 'EUR',
94
+ timeout: commonBidderRequest.timeout,
95
+ auction_id: commonBidRequest.auctionId,
96
+ transaction_id: commonBidRequest.transactionId,
97
+ bids: [{ id: 0, bid_id: commonBidRequest.bidId, type: 'banner', size: bannerBidRequestParams.sizes }],
98
+ gdpr: { applies: false, consent: false },
99
+ };
100
+ it('should generate a valid banner bid request', function () {
101
+ let laResponse = spec.buildRequests([bidRequest], commonBidderRequest);
102
+ expect(laResponse.method).to.equal('POST');
103
+ expect(laResponse.url).to.equal('https://test.natexo-programmatic.com/tad/tag/prebid/999999');
104
+ expect(laResponse.data).to.equal(JSON.stringify(loServerRequest));
105
+ });
106
+ }); // buildRequests1
107
+ describe('buildRequests2', function() {
108
+ let bidRequest = {
109
+ ...commonBidRequest,
110
+ ...nativeBidRequestParams,
111
+ };
112
+ const loServerRequest = {
113
+ cur: 'EUR',
114
+ timeout: commonBidderRequest.timeout,
115
+ auction_id: commonBidRequest.auctionId,
116
+ transaction_id: commonBidRequest.transactionId,
117
+ bids: [{ id: 0, bid_id: commonBidRequest.bidId, type: 'native', size: [] }],
118
+ gdpr: { applies: false, consent: false },
119
+ };
120
+ it('should generate a valid native bid request', function () {
121
+ let laResponse = spec.buildRequests([bidRequest], commonBidderRequest);
122
+ expect(laResponse.method).to.equal('POST');
123
+ expect(laResponse.url).to.equal('https://test.natexo-programmatic.com/tad/tag/prebid/999999');
124
+ expect(laResponse.data).to.equal(JSON.stringify(loServerRequest));
125
+ });
126
+ const bidderRequest = {
127
+ ...commonBidderRequest,
128
+ gdprConsent: { gdprApplies: true, consentString: 'yes' }
129
+ };
130
+ const loServerRequest2 = {
131
+ ...loServerRequest,
132
+ gdpr: { applies: true, consent: 'yes' },
133
+ };
134
+ it('should generate a valid native bid request', function () {
135
+ let laResponse = spec.buildRequests([bidRequest], bidderRequest);
136
+ expect(laResponse.method).to.equal('POST');
137
+ expect(laResponse.url).to.equal('https://test.natexo-programmatic.com/tad/tag/prebid/999999');
138
+ expect(laResponse.data).to.equal(JSON.stringify(loServerRequest2));
139
+ });
140
+ }); // buildRequests2
141
+
142
+ /**
143
+ * interpretResponse
144
+ */
145
+ describe('interpretResponse1', function() {
146
+ it('should return empty array if no valid bids', function () {
147
+ const laResult = spec.interpretResponse({}, [])
148
+ expect(laResult).to.be.an('array').that.is.empty;
149
+ });
150
+ const loServerResult = {
151
+ body: { status: 'error', error: 'aie' }
152
+ };
153
+ it('should return empty array if there is an error', function () {
154
+ const laResult = spec.interpretResponse(loServerResult, [])
155
+ expect(laResult).to.be.an('array').that.is.empty;
156
+ });
157
+ }); // interpretResponse1
158
+ describe('interpretResponse2', function() {
159
+ const loServerResult = {
160
+ body: {
161
+ status: 'ok',
162
+ error: '',
163
+ pbid: '6147833a65749742875ace47',
164
+ bids: [{
165
+ requestId: commonBidRequest.bidId,
166
+ cpm: 0.10,
167
+ currency: 'EUR',
168
+ width: 300,
169
+ height: 250,
170
+ ad: 'test ad',
171
+ ttl: 60,
172
+ creativeId: 'c123a456',
173
+ netRevenue: false,
174
+ }]
175
+ }
176
+ };
177
+ const loExpected = [{
178
+ requestId: '1a2b3c4d56e7f0',
179
+ cpm: 0.1,
180
+ currency: 'EUR',
181
+ width: 300,
182
+ height: 250,
183
+ ad: 'test ad',
184
+ ttl: 60,
185
+ creativeId: 'c123a456',
186
+ netRevenue: false,
187
+ pbid: '6147833a65749742875ace47'
188
+ }];
189
+ it('should return a correct bid response', function () {
190
+ const laResult = spec.interpretResponse(loServerResult, [])
191
+ expect(JSON.stringify(laResult)).to.equal(JSON.stringify(loExpected));
192
+ });
193
+ }); // interpretResponse2
194
+
195
+ /**
196
+ * onBidWon
197
+ */
198
+ describe('onBidWon', function() {
199
+ it('should not make an ajax call if pbid is null', function () {
200
+ const loBid = {
201
+ requestId: '1a2b3c4d56e7f0',
202
+ cpm: 0.1,
203
+ currency: 'EUR',
204
+ width: 300,
205
+ height: 250,
206
+ ad: 'test ad',
207
+ ttl: 60,
208
+ creativeId: 'c123a456',
209
+ netRevenue: false,
210
+ }
211
+ spec.onBidWon(loBid)
212
+ expect(server.requests.length).to.equals(0);
213
+ });
214
+ it('should make an ajax call', function () {
215
+ const loBid = {
216
+ requestId: '1a2b3c4d56e7f0',
217
+ cpm: 0.1,
218
+ currency: 'EUR',
219
+ width: 300,
220
+ height: 250,
221
+ ad: 'test ad',
222
+ ttl: 60,
223
+ creativeId: 'c123a456',
224
+ netRevenue: false,
225
+ pbid: '6147833a65749742875ace47'
226
+ }
227
+ spec.onBidWon(loBid)
228
+ expect(server.requests[0].url).to.equals('https://test.natexo-programmatic.com/tad/tag/prebidwon/6147833a65749742875ace47');
229
+ });
230
+ }); // onBidWon
231
+ });
@@ -582,6 +582,138 @@ describe('teadsBidAdapter', () => {
582
582
  });
583
583
  });
584
584
 
585
+ describe('Global Placement Id', function () {
586
+ let bidRequests = [
587
+ {
588
+ 'bidder': 'teads',
589
+ 'params': {
590
+ 'placementId': 10433394,
591
+ 'pageId': 1234
592
+ },
593
+ 'adUnitCode': 'adunit-code-1',
594
+ 'sizes': [[300, 250], [300, 600]],
595
+ 'bidId': '30b31c1838de1e',
596
+ 'bidderRequestId': '22edbae2733bf6',
597
+ 'auctionId': '1d1a030790a475',
598
+ 'creativeId': 'er2ee',
599
+ 'deviceWidth': 1680
600
+ },
601
+ {
602
+ 'bidder': 'teads',
603
+ 'params': {
604
+ 'placementId': 10433395,
605
+ 'pageId': 1234
606
+ },
607
+ 'adUnitCode': 'adunit-code-2',
608
+ 'sizes': [[300, 250], [300, 600]],
609
+ 'bidId': '30b31c1838de1f',
610
+ 'bidderRequestId': '22edbae2733bf6',
611
+ 'auctionId': '1d1a030790a475',
612
+ 'creativeId': 'er2ef',
613
+ 'deviceWidth': 1680
614
+ }
615
+ ];
616
+
617
+ it('should add gpid if ortb2Imp.ext.data.pbadslot is present and is non empty (and ortb2Imp.ext.data.adserver.adslot is not present)', function () {
618
+ const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
619
+ return {
620
+ ...bidRequest,
621
+ ortb2Imp: {
622
+ ext: {
623
+ data: {
624
+ pbadslot: '1111/home-left-' + index
625
+ }
626
+ }
627
+ }
628
+ };
629
+ }
630
+ );
631
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
632
+ const payload = JSON.parse(request.data);
633
+
634
+ expect(payload.data[0].gpid).to.equal('1111/home-left-0');
635
+ expect(payload.data[1].gpid).to.equal('1111/home-left-1');
636
+ });
637
+
638
+ it('should add gpid if ortb2Imp.ext.data.pbadslot is present and is non empty (even if ortb2Imp.ext.data.adserver.adslot is present and is non empty too)', function () {
639
+ const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
640
+ return {
641
+ ...bidRequest,
642
+ ortb2Imp: {
643
+ ext: {
644
+ data: {
645
+ pbadslot: '1111/home-left-' + index,
646
+ adserver: {
647
+ adslot: '1111/home-left/div-' + index
648
+ }
649
+ }
650
+ }
651
+ }
652
+ };
653
+ }
654
+ );
655
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
656
+ const payload = JSON.parse(request.data);
657
+
658
+ expect(payload.data[0].gpid).to.equal('1111/home-left-0');
659
+ expect(payload.data[1].gpid).to.equal('1111/home-left-1');
660
+ });
661
+
662
+ it('should not add gpid if both ortb2Imp.ext.data.pbadslot and ortb2Imp.ext.data.adserver.adslot are present but empty', function () {
663
+ const updatedBidRequests = bidRequests.map(bidRequest => ({
664
+ ...bidRequest,
665
+ ortb2Imp: {
666
+ ext: {
667
+ data: {
668
+ pbadslot: '',
669
+ adserver: {
670
+ adslot: ''
671
+ }
672
+ }
673
+ }
674
+ }
675
+ }));
676
+
677
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
678
+ const payload = JSON.parse(request.data);
679
+
680
+ return payload.data.forEach(bid => {
681
+ expect(bid).not.to.have.property('gpid');
682
+ });
683
+ });
684
+
685
+ it('should not add gpid if both ortb2Imp.ext.data.pbadslot and ortb2Imp.ext.data.adserver.adslot are not present', function () {
686
+ const request = spec.buildRequests(bidRequests, bidderResquestDefault);
687
+ const payload = JSON.parse(request.data);
688
+
689
+ return payload.data.forEach(bid => {
690
+ expect(bid).not.to.have.property('gpid');
691
+ });
692
+ });
693
+
694
+ it('should add gpid if ortb2Imp.ext.data.pbadslot is not present but ortb2Imp.ext.data.adserver.adslot is present and is non empty', function () {
695
+ const updatedBidRequests = bidRequests.map(function(bidRequest, index) {
696
+ return {
697
+ ...bidRequest,
698
+ ortb2Imp: {
699
+ ext: {
700
+ data: {
701
+ adserver: {
702
+ adslot: '1111/home-left-' + index
703
+ }
704
+ }
705
+ }
706
+ }
707
+ };
708
+ });
709
+ const request = spec.buildRequests(updatedBidRequests, bidderResquestDefault);
710
+ const payload = JSON.parse(request.data);
711
+
712
+ expect(payload.data[0].gpid).to.equal('1111/home-left-0');
713
+ expect(payload.data[1].gpid).to.equal('1111/home-left-1');
714
+ });
715
+ });
716
+
585
717
  function checkMediaTypesSizes(mediaTypes, expectedSizes) {
586
718
  const bidRequestWithBannerSizes = Object.assign(bidRequests[0], mediaTypes);
587
719
  const requestWithBannerSizes = spec.buildRequests([bidRequestWithBannerSizes], bidderResquestDefault);
@@ -568,6 +568,134 @@ describe('triplelift adapter', function () {
568
568
  expect(payload.user.ext.eids).to.have.lengthOf(4);
569
569
  });
570
570
 
571
+ it('should remove malformed ids that would otherwise break call', function () {
572
+ let tdidId = '6bca7f6b-a98a-46c0-be05-6020f7604598';
573
+ let idlEnvId = null; // fail; can't be null
574
+ let criteoId = '53e30ea700424f7bbdd793b02abc5d7';
575
+ let pubcid = ''; // fail; can't be empty string
576
+
577
+ let bidRequestsMultiple = [
578
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } },
579
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } },
580
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } }
581
+ ];
582
+
583
+ let request = tripleliftAdapterSpec.buildRequests(bidRequestsMultiple, bidderRequest);
584
+ let payload = request.data;
585
+
586
+ expect(payload.user).to.deep.equal({
587
+ ext: {
588
+ eids: [
589
+ {
590
+ source: 'adserver.org',
591
+ uids: [
592
+ {
593
+ id: tdidId,
594
+ ext: { rtiPartner: 'TDID' }
595
+ }
596
+ ],
597
+ },
598
+ {
599
+ source: 'criteo.com',
600
+ uids: [
601
+ {
602
+ id: criteoId,
603
+ ext: { rtiPartner: 'criteoId' }
604
+ }
605
+ ]
606
+ }
607
+ ]
608
+ }
609
+ });
610
+
611
+ expect(payload.user.ext.eids).to.be.an('array');
612
+ expect(payload.user.ext.eids).to.have.lengthOf(2);
613
+
614
+ tdidId = {}; // fail; can't be empty object
615
+ idlEnvId = { id: '987654' }; // pass
616
+ criteoId = [{ id: '123456' }]; // fail; can't be an array
617
+ pubcid = '3261d8ad-435d-481d-abd1-9f1a9ec99f0e'; // pass
618
+
619
+ bidRequestsMultiple = [
620
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } },
621
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } },
622
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } }
623
+ ];
624
+
625
+ request = tripleliftAdapterSpec.buildRequests(bidRequestsMultiple, bidderRequest);
626
+ payload = request.data;
627
+
628
+ expect(payload.user).to.deep.equal({
629
+ ext: {
630
+ eids: [
631
+ {
632
+ source: 'liveramp.com',
633
+ uids: [
634
+ {
635
+ id: '987654',
636
+ ext: { rtiPartner: 'idl' }
637
+ }
638
+ ]
639
+ },
640
+ {
641
+ source: 'pubcid.org',
642
+ uids: [
643
+ {
644
+ id: pubcid,
645
+ ext: { rtiPartner: 'pubcid' }
646
+ }
647
+ ]
648
+ }
649
+ ]
650
+ }
651
+ });
652
+
653
+ expect(payload.user.ext.eids).to.be.an('array');
654
+ expect(payload.user.ext.eids).to.have.lengthOf(2);
655
+
656
+ tdidId = { id: '987654' }; // pass
657
+ idlEnvId = { id: 987654 }; // fail; can't be an int
658
+ criteoId = '53e30ea700424f7bbdd793b02abc5d7'; // pass
659
+ pubcid = { id: '' }; // fail; can't be an empty string
660
+
661
+ bidRequestsMultiple = [
662
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } },
663
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } },
664
+ { ...bidRequests[0], userId: { tdid: tdidId, idl_env: idlEnvId, criteoId, pubcid } }
665
+ ];
666
+
667
+ request = tripleliftAdapterSpec.buildRequests(bidRequestsMultiple, bidderRequest);
668
+ payload = request.data;
669
+
670
+ expect(payload.user).to.deep.equal({
671
+ ext: {
672
+ eids: [
673
+ {
674
+ source: 'adserver.org',
675
+ uids: [
676
+ {
677
+ id: '987654',
678
+ ext: { rtiPartner: 'TDID' }
679
+ }
680
+ ],
681
+ },
682
+ {
683
+ source: 'criteo.com',
684
+ uids: [
685
+ {
686
+ id: criteoId,
687
+ ext: { rtiPartner: 'criteoId' }
688
+ }
689
+ ]
690
+ }
691
+ ]
692
+ }
693
+ });
694
+
695
+ expect(payload.user.ext.eids).to.be.an('array');
696
+ expect(payload.user.ext.eids).to.have.lengthOf(2);
697
+ });
698
+
571
699
  it('should return a query string for TL call', function () {
572
700
  const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
573
701
  const url = request.url;
@@ -402,7 +402,7 @@ describe('TrustXAdapter', function () {
402
402
  });
403
403
 
404
404
  it('if segment is present in permutive targeting, payload must have right params', function () {
405
- const permSegments = ['test_perm_1', 'test_perm_2'];
405
+ const permSegments = [{id: 'test_perm_1'}, {id: 'test_perm_2'}];
406
406
  const bidRequestsWithPermutiveTargeting = bidRequests.map((bid) => {
407
407
  return Object.assign({
408
408
  rtd: {
@@ -421,8 +421,8 @@ describe('TrustXAdapter', function () {
421
421
  expect(payload.user.data).to.deep.equal([{
422
422
  name: 'permutive',
423
423
  segment: [
424
- {name: 'p_standard', value: permSegments[0]},
425
- {name: 'p_standard', value: permSegments[1]}
424
+ {name: 'p_standard', value: permSegments[0].id},
425
+ {name: 'p_standard', value: permSegments[1].id}
426
426
  ]
427
427
  }]);
428
428
  });
@@ -60,6 +60,23 @@ const videoBidReq = [{
60
60
  bidId: '263be71e91dd9d',
61
61
  auctionId: '9ad1fa8d-2297-4660-a018-b39945054746'
62
62
  }];
63
+ const schainObj = {
64
+ 'ver': '1.0',
65
+ 'complete': 1,
66
+ 'nodes': [
67
+ {
68
+ 'asi': 'indirectseller.com',
69
+ 'sid': '00001',
70
+ 'hp': 1
71
+ },
72
+
73
+ {
74
+ 'asi': 'indirectseller-2.com',
75
+ 'sid': '00002',
76
+ 'hp': 2
77
+ }
78
+ ]
79
+ };
63
80
  const bidReq = [{
64
81
  adUnitCode: 'div-gpt-ad-1460505748561-0',
65
82
  bidder: BIDDER_CODE,
@@ -72,6 +89,29 @@ const bidReq = [{
72
89
  auctionId: '9ad1fa8d-2297-4660-a018-b39945054746'
73
90
  },
74
91
  {
92
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
93
+ bidder: BIDDER_CODE,
94
+ params: {
95
+ publisherId: 12345
96
+ },
97
+ sizes: [[1, 1]],
98
+ bidId: '453cf42d72bb3c',
99
+ auctionId: '6c22f5a5-59df-4dc6-b92c-f433bcf0a874',
100
+ schain: schainObj
101
+ }];
102
+
103
+ const supplyChainedBidReqs = [{
104
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
105
+ bidder: BIDDER_CODE,
106
+ params: {
107
+ placementId: '10433394',
108
+ publisherId: 12345,
109
+ },
110
+ sizes: [[300, 250], [300, 600]],
111
+ bidId: '263be71e91dd9d',
112
+ auctionId: '9ad1fa8d-2297-4660-a018-b39945054746',
113
+ schain: schainObj
114
+ }, {
75
115
  adUnitCode: 'div-gpt-ad-1460505748561-0',
76
116
  bidder: BIDDER_CODE,
77
117
  params: {
@@ -236,6 +276,18 @@ describe('Undertone Adapter', () => {
236
276
  sandbox.restore();
237
277
  });
238
278
 
279
+ describe('supply chain', function () {
280
+ it('should send supply chain if found on first bid', function () {
281
+ const request = spec.buildRequests(supplyChainedBidReqs, bidderReq);
282
+ const commons = JSON.parse(request.data)['commons'];
283
+ expect(commons.schain).to.deep.equal(schainObj);
284
+ });
285
+ it('should not send supply chain if not found on first bid', function () {
286
+ const request = spec.buildRequests(bidReq, bidderReq);
287
+ const commons = JSON.parse(request.data)['commons'];
288
+ expect(commons.schain).to.not.exist;
289
+ });
290
+ });
239
291
  it('should send request to correct url via POST not in GDPR or CCPA', function () {
240
292
  const request = spec.buildRequests(bidReq, bidderReq);
241
293
  const domainStart = bidderReq.refererInfo.referer.indexOf('//');
@@ -332,14 +332,14 @@ const openRTBRequest = {
332
332
  tagid: 'rectangle-ad-2'
333
333
  }
334
334
  ],
335
- cur: 'JPY',
335
+ cur: ['JPY'],
336
336
  ext: {
337
337
  accountId: 12345
338
338
  },
339
339
  site: {
340
340
  id: 'example',
341
341
  publisher: {
342
- id: 99999
342
+ id: '99999'
343
343
  },
344
344
  domain: 'uni-corn.net',
345
345
  page: 'https://uni-corn.net/',
@@ -357,7 +357,7 @@ const openRTBRequest = {
357
357
  ext: {
358
358
  stype: 'prebid_uncn',
359
359
  bidder: 'unicorn',
360
- prebid_version: '1.0'
360
+ prebid_version: '1.1'
361
361
  }
362
362
  }
363
363
  };
@@ -444,7 +444,7 @@ const serverResponse = {
444
444
  const request = {
445
445
  method: 'POST',
446
446
  url: 'https://ds.uncn.jp/pb/0/bid.json',
447
- data: '{"id":"5ebea288-f13a-4754-be6d-4ade66c68877","at":1,"imp":[{"id":"216255f234b602","banner":{"w":300,"h":250},"format":[{"w":300,"h":250},{"w":336,"h":280}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-0"},{"id":"31e2b28ced2475","banner":{"w":"300","h":"250"},"format":[{"w":"300","h":"250"}],"secure":1,"bidfloor":0"tagid":"/19968336/header-bid-tag-1"},{"id":"40a333e047a9bd","banner":{"w":300,"h":250},"format":[{"w":300,"h":250}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-2"}],"cur":"JPY","site":{"id":"uni-corn.net","publisher":{"id":12345},"domain":"uni-corn.net","page":"https://uni-corn.net/","ref":"https://uni-corn.net/"},"device":{"language":"ja","ua":"Mozilla/5.0 (Linux; Android 8.0.0; ONEPLUS A5000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36"},"user":{"id":"69d9e1c2-801e-4901-a665-fad467550fec"},"bcat":[],"source":{"ext":{"stype":"prebid_uncn","bidder":"unicorn","prebid_version":"1.0"}}}'
447
+ data: '{"id":"5ebea288-f13a-4754-be6d-4ade66c68877","at":1,"imp":[{"id":"216255f234b602","banner":{"w":300,"h":250},"format":[{"w":300,"h":250},{"w":336,"h":280}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-0"},{"id":"31e2b28ced2475","banner":{"w":"300","h":"250"},"format":[{"w":"300","h":"250"}],"secure":1,"bidfloor":0"tagid":"/19968336/header-bid-tag-1"},{"id":"40a333e047a9bd","banner":{"w":300,"h":250},"format":[{"w":300,"h":250}],"secure":1,"bidfloor":0,"tagid":"/19968336/header-bid-tag-2"}],"cur":"JPY","site":{"id":"uni-corn.net","publisher":{"id":12345},"domain":"uni-corn.net","page":"https://uni-corn.net/","ref":"https://uni-corn.net/"},"device":{"language":"ja","ua":"Mozilla/5.0 (Linux; Android 8.0.0; ONEPLUS A5000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36"},"user":{"id":"69d9e1c2-801e-4901-a665-fad467550fec"},"bcat":[],"source":{"ext":{"stype":"prebid_uncn","bidder":"unicorn","prebid_version":"1.1"}}}'
448
448
  };
449
449
 
450
450
  const interpretedBids = [