prebid.js 5.16.0 → 5.20.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 (182) hide show
  1. package/.devcontainer/Dockerfile +11 -0
  2. package/.devcontainer/devcontainer.json +27 -0
  3. package/.devcontainer/postCreate.sh +6 -0
  4. package/browsers.json +1 -0
  5. package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
  6. package/modules/.submodules.json +1 -0
  7. package/modules/adfBidAdapter.js +21 -16
  8. package/modules/adgenerationBidAdapter.js +28 -4
  9. package/modules/adkernelBidAdapter.js +3 -1
  10. package/modules/admixerBidAdapter.js +11 -0
  11. package/modules/adnuntiusBidAdapter.js +1 -0
  12. package/modules/adtelligentBidAdapter.js +2 -1
  13. package/modules/airgridRtdProvider.js +1 -1
  14. package/modules/akamaiDapRtdProvider.js +474 -0
  15. package/modules/akamaiDapRtdProvider.md +47 -0
  16. package/modules/aolBidAdapter.js +2 -1
  17. package/modules/appnexusBidAdapter.js +5 -3
  18. package/modules/atsAnalyticsAdapter.js +89 -63
  19. package/modules/atsAnalyticsAdapter.md +1 -0
  20. package/modules/betweenBidAdapter.js +20 -3
  21. package/modules/bliinkBidAdapter.js +58 -32
  22. package/modules/bliinkBidAdapter.md +29 -6
  23. package/modules/browsiRtdProvider.js +106 -18
  24. package/modules/cleanioRtdProvider.js +192 -0
  25. package/modules/cleanioRtdProvider.md +59 -0
  26. package/modules/codefuelBidAdapter.js +183 -0
  27. package/modules/codefuelBidAdapter.md +111 -0
  28. package/modules/connectIdSystem.js +104 -0
  29. package/modules/connectIdSystem.md +33 -0
  30. package/modules/cwireBidAdapter.js +272 -0
  31. package/modules/cwireBidAdapter.md +43 -0
  32. package/modules/deepintentBidAdapter.js +106 -9
  33. package/modules/deepintentBidAdapter.md +36 -1
  34. package/modules/deltaprojectsBidAdapter.js +252 -0
  35. package/modules/deltaprojectsBidAdapter.md +32 -0
  36. package/modules/dgkeywordRtdProvider.js +0 -1
  37. package/modules/engageyaBidAdapter.js +157 -0
  38. package/modules/glimpseBidAdapter.js +160 -48
  39. package/modules/glimpseBidAdapter.md +11 -74
  40. package/modules/gridBidAdapter.js +1 -0
  41. package/modules/gridNMBidAdapter.js +7 -6
  42. package/modules/gumgumBidAdapter.js +16 -2
  43. package/modules/iasRtdProvider.js +83 -67
  44. package/modules/inskinBidAdapter.js +7 -3
  45. package/modules/ixBidAdapter.js +8 -1
  46. package/modules/jixieBidAdapter.js +8 -2
  47. package/modules/justpremiumBidAdapter.js +6 -1
  48. package/modules/kargoBidAdapter.js +14 -7
  49. package/modules/kargoBidAdapter.md +20 -0
  50. package/modules/limelightDigitalBidAdapter.js +22 -2
  51. package/modules/livewrappedAnalyticsAdapter.js +53 -3
  52. package/modules/mediakeysBidAdapter.js +405 -14
  53. package/modules/mediakeysBidAdapter.md +108 -0
  54. package/modules/multibid/index.js +3 -3
  55. package/modules/mytargetBidAdapter.js +112 -0
  56. package/modules/nativoBidAdapter.js +48 -29
  57. package/modules/nativoBidAdapter.md +0 -1
  58. package/modules/nextMillenniumBidAdapter.js +12 -3
  59. package/modules/nextrollBidAdapter.js +375 -0
  60. package/modules/nobidBidAdapter.js +2 -1
  61. package/modules/oguryBidAdapter.js +36 -7
  62. package/modules/openxBidAdapter.js +34 -22
  63. package/modules/operaadsBidAdapter.js +21 -1
  64. package/modules/otmBidAdapter.js +146 -0
  65. package/modules/otmBidAdapter.md +27 -26
  66. package/modules/outbrainBidAdapter.js +5 -0
  67. package/modules/pixfutureBidAdapter.js +24 -4
  68. package/modules/pixfutureBidAdapter.md +127 -0
  69. package/modules/playwireBidAdapter.md +61 -0
  70. package/modules/prebidServerBidAdapter/index.js +1 -1
  71. package/modules/proxistoreBidAdapter.js +4 -6
  72. package/modules/publinkIdSystem.js +17 -7
  73. package/modules/publinkIdSystem.md +7 -2
  74. package/modules/pubmaticBidAdapter.js +22 -6
  75. package/modules/pubmaticBidAdapter.md +1 -1
  76. package/modules/relaidoBidAdapter.js +8 -2
  77. package/modules/rtdModule/index.js +2 -2
  78. package/modules/sharethroughBidAdapter.js +12 -19
  79. package/modules/slimcutBidAdapter.js +121 -0
  80. package/modules/sonobiBidAdapter.js +7 -0
  81. package/modules/sortableBidAdapter.js +1 -0
  82. package/modules/spotxBidAdapter.js +15 -1
  83. package/modules/sspBCBidAdapter.js +207 -12
  84. package/modules/sspBCBidAdapter.md +1 -1
  85. package/modules/talkadsBidAdapter.js +129 -0
  86. package/modules/talkadsBidAdapter.md +60 -0
  87. package/modules/tappxBidAdapter.js +6 -5
  88. package/modules/teadsBidAdapter.js +3 -0
  89. package/modules/tripleliftBidAdapter.js +22 -5
  90. package/modules/trustxBidAdapter.js +17 -11
  91. package/modules/undertoneBidAdapter.js +9 -5
  92. package/modules/undertoneBidAdapter.md +5 -1
  93. package/modules/unicornBidAdapter.js +3 -3
  94. package/modules/userId/eids.js +18 -0
  95. package/modules/userId/eids.md +7 -0
  96. package/modules/userId/userId.md +12 -0
  97. package/modules/ventesBidAdapter.js +370 -0
  98. package/modules/ventesBidAdapter.md +94 -0
  99. package/modules/videobyteBidAdapter.js +13 -6
  100. package/modules/videobyteBidAdapter.md +49 -0
  101. package/modules/vidoomyBidAdapter.js +20 -12
  102. package/modules/visxBidAdapter.js +15 -22
  103. package/modules/yahoosspBidAdapter.js +637 -0
  104. package/modules/yahoosspBidAdapter.md +795 -0
  105. package/modules/yieldlabBidAdapter.js +48 -3
  106. package/modules/yieldlabBidAdapter.md +16 -1
  107. package/modules/yieldmoBidAdapter.js +20 -6
  108. package/modules/yieldmoSyntheticInventoryModule.js +46 -0
  109. package/modules/yieldmoSyntheticInventoryModule.md +68 -0
  110. package/package.json +1 -1
  111. package/src/adapterManager.js +5 -0
  112. package/src/adapters/bidderFactory.js +4 -3
  113. package/src/auction.js +11 -11
  114. package/src/constants.json +1 -0
  115. package/src/secureCreatives.js +6 -7
  116. package/src/targeting.js +11 -9
  117. package/test/.eslintrc.js +2 -1
  118. package/test/spec/modules/adfBidAdapter_spec.js +83 -29
  119. package/test/spec/modules/adgenerationBidAdapter_spec.js +121 -50
  120. package/test/spec/modules/adnuntiusBidAdapter_spec.js +68 -0
  121. package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
  122. package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
  123. package/test/spec/modules/appnexusBidAdapter_spec.js +2 -1
  124. package/test/spec/modules/atsAnalyticsAdapter_spec.js +77 -9
  125. package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
  126. package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
  127. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  128. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  129. package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
  130. package/test/spec/modules/connectIdSystem_spec.js +189 -0
  131. package/test/spec/modules/cwireBidAdapter_spec.js +246 -0
  132. package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
  133. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  134. package/test/spec/modules/engageyaBidAdapter_spec.js +286 -0
  135. package/test/spec/modules/glimpseBidAdapter_spec.js +302 -204
  136. package/test/spec/modules/gridNMBidAdapter_spec.js +40 -1
  137. package/test/spec/modules/gumgumBidAdapter_spec.js +23 -6
  138. package/test/spec/modules/iasRtdProvider_spec.js +71 -6
  139. package/test/spec/modules/ixBidAdapter_spec.js +13 -3
  140. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  141. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  142. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
  143. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +67 -12
  144. package/test/spec/modules/mediakeysBidAdapter_spec.js +406 -51
  145. package/test/spec/modules/multibid_spec.js +31 -31
  146. package/test/spec/modules/mytargetBidAdapter_spec.js +199 -0
  147. package/test/spec/modules/nativoBidAdapter_spec.js +50 -3
  148. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
  149. package/test/spec/modules/nextrollBidAdapter_spec.js +290 -0
  150. package/test/spec/modules/nobidBidAdapter_spec.js +65 -1
  151. package/test/spec/modules/oguryBidAdapter_spec.js +125 -37
  152. package/test/spec/modules/openxBidAdapter_spec.js +85 -13
  153. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  154. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  155. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  156. package/test/spec/modules/publinkIdSystem_spec.js +34 -15
  157. package/test/spec/modules/pubmaticBidAdapter_spec.js +217 -1
  158. package/test/spec/modules/relaidoBidAdapter_spec.js +21 -20
  159. package/test/spec/modules/sharethroughBidAdapter_spec.js +156 -136
  160. package/test/spec/modules/slimcutBidAdapter_spec.js +200 -0
  161. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  162. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  163. package/test/spec/modules/spotxBidAdapter_spec.js +36 -0
  164. package/test/spec/modules/sspBCBidAdapter_spec.js +210 -62
  165. package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
  166. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  167. package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
  168. package/test/spec/modules/trustxBidAdapter_spec.js +38 -5
  169. package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
  170. package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
  171. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  172. package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
  173. package/test/spec/modules/visxBidAdapter_spec.js +48 -4
  174. package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
  175. package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
  176. package/test/spec/modules/yieldmoBidAdapter_spec.js +30 -9
  177. package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
  178. package/test/spec/unit/core/adapterManager_spec.js +32 -0
  179. package/test/spec/unit/core/bidderFactory_spec.js +61 -1
  180. package/test/spec/unit/pbjs_api_spec.js +37 -2
  181. package/test/spec/unit/secureCreatives_spec.js +54 -25
  182. package/modules/turktelekomBidAdapter.md +0 -49
@@ -6,7 +6,7 @@ import * as utils from 'src/utils';
6
6
 
7
7
  const spec = newBidder(sharethroughAdapterSpec).getSpec();
8
8
 
9
- describe('sharethrough adapter spec', function() {
9
+ describe('sharethrough adapter spec', function () {
10
10
  let protocolStub;
11
11
  let inIframeStub;
12
12
 
@@ -20,14 +20,14 @@ describe('sharethrough adapter spec', function() {
20
20
  inIframeStub.restore();
21
21
  });
22
22
 
23
- describe('code', function() {
24
- it('should return a bidder code of sharethrough', function() {
23
+ describe('code', function () {
24
+ it('should return a bidder code of sharethrough', function () {
25
25
  expect(spec.code).to.eql('sharethrough');
26
26
  });
27
27
  });
28
28
 
29
- describe('isBidRequestValid', function() {
30
- it('should return false if req has no pkey', function() {
29
+ describe('isBidRequestValid', function () {
30
+ it('should return false if req has no pkey', function () {
31
31
  const invalidBidRequest = {
32
32
  bidder: 'sharethrough',
33
33
  params: {
@@ -37,17 +37,17 @@ describe('sharethrough adapter spec', function() {
37
37
  expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false);
38
38
  });
39
39
 
40
- it('should return false if req has wrong bidder code', function() {
40
+ it('should return false if req has wrong bidder code', function () {
41
41
  const invalidBidRequest = {
42
42
  bidder: 'notSharethrough',
43
43
  params: {
44
44
  pkey: 'abc123',
45
- }
45
+ },
46
46
  };
47
47
  expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false);
48
48
  });
49
49
 
50
- it('should return true if req is correct', function() {
50
+ it('should return true if req is correct', function () {
51
51
  const validBidRequest = {
52
52
  bidder: 'sharethrough',
53
53
  params: {
@@ -175,71 +175,82 @@ describe('sharethrough adapter spec', function() {
175
175
  };
176
176
  });
177
177
 
178
- describe('buildRequests', function() {
178
+ describe('buildRequests', function () {
179
179
  describe('top level object', () => {
180
180
  it('should build openRTB request', () => {
181
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
182
-
183
- expect(builtRequest.method).to.equal('POST');
184
- expect(builtRequest.url).not.to.be.undefined;
185
- expect(builtRequest.options).to.be.undefined;
186
- expect(builtRequest.bidderRequest).to.deep.equal(bidderRequest);
187
-
188
- const openRtbReq = builtRequest.data;
189
- expect(openRtbReq.id).not.to.be.undefined;
190
- expect(openRtbReq.cur).to.deep.equal(['USD']);
191
- expect(openRtbReq.tmax).to.equal(242);
192
-
193
- expect(openRtbReq.site.domain).not.to.be.undefined;
194
- expect(openRtbReq.site.page).not.to.be.undefined;
195
- expect(openRtbReq.site.ref).to.equal('https://referer.com');
196
-
197
- const expectedEids = {
198
- 'liveramp.com': { id: 'fake-identity-link' },
199
- 'id5-sync.com': { id: 'fake-id5id' },
200
- 'pubcid.org': { id: 'fake-pubcid' },
201
- 'adserver.org': { id: 'fake-tdid' },
202
- 'criteo.com': { id: 'fake-criteo' },
203
- 'britepool.com': { id: 'fake-britepool' },
204
- 'liveintent.com': { id: 'fake-lipbid' },
205
- 'intentiq.com': { id: 'fake-intentiq' },
206
- 'crwdcntrl.net': { id: 'fake-lotame' },
207
- 'parrable.com': { id: 'fake-parrable' },
208
- 'netid.de': { id: 'fake-netid' },
209
- 'chrome.com': { id: 'fake-flocid' },
210
- };
211
- expect(openRtbReq.user.ext.eids).to.be.an('array').that.have.length(Object.keys(expectedEids).length);
212
- for (const eid of openRtbReq.user.ext.eids) {
213
- expect(Object.keys(expectedEids)).to.include(eid.source);
214
- expect(eid.uids[0].id).to.equal(expectedEids[eid.source].id);
215
- expect(eid.uids[0].atype).to.be.ok;
216
- }
217
-
218
- expect(openRtbReq.device.ua).to.equal(navigator.userAgent);
219
- expect(openRtbReq.regs.coppa).to.equal(1);
220
-
221
- expect(openRtbReq.source.ext.version).not.to.be.undefined;
222
- expect(openRtbReq.source.ext.str).not.to.be.undefined;
223
- expect(openRtbReq.source.ext.schain).to.deep.equal(bidRequests[0].schain);
224
-
225
- expect(openRtbReq.bcat).to.deep.equal(bidRequests[0].params.bcat);
226
- expect(openRtbReq.badv).to.deep.equal(bidRequests[0].params.badv);
227
-
228
- expect(openRtbReq.imp).to.have.length(2);
229
-
230
- expect(openRtbReq.imp[0].id).to.equal('bidId1');
231
- expect(openRtbReq.imp[0].tagid).to.equal('aaaa1111');
232
- expect(openRtbReq.imp[0].secure).to.equal(1);
233
- expect(openRtbReq.imp[0].bidfloor).to.equal(42);
234
-
235
- expect(openRtbReq.imp[1].id).to.equal('bidId2');
236
- expect(openRtbReq.imp[1].tagid).to.equal('bbbb2222');
237
- expect(openRtbReq.imp[1].secure).to.equal(1);
238
- expect(openRtbReq.imp[1].bidfloor).to.equal(42);
181
+ const builtRequests = spec.buildRequests(bidRequests, bidderRequest);
182
+
183
+ const expectedImpValues = [
184
+ {
185
+ id: 'bidId1',
186
+ tagid: 'aaaa1111',
187
+ secure: 1,
188
+ bidfloor: 42,
189
+ },
190
+ {
191
+ id: 'bidId2',
192
+ tagid: 'bbbb2222',
193
+ secure: 1,
194
+ bidfloor: 42,
195
+ },
196
+ ];
197
+
198
+ builtRequests.map((builtRequest, rIndex) => {
199
+ expect(builtRequest.method).to.equal('POST');
200
+ expect(builtRequest.url).not.to.be.undefined;
201
+ expect(builtRequest.options).to.be.undefined;
202
+
203
+ const openRtbReq = builtRequest.data;
204
+ expect(openRtbReq.id).not.to.be.undefined;
205
+ expect(openRtbReq.cur).to.deep.equal(['USD']);
206
+ expect(openRtbReq.tmax).to.equal(242);
207
+
208
+ expect(openRtbReq.site.domain).not.to.be.undefined;
209
+ expect(openRtbReq.site.page).not.to.be.undefined;
210
+ expect(openRtbReq.site.ref).to.equal('https://referer.com');
211
+
212
+ const expectedEids = {
213
+ 'liveramp.com': { id: 'fake-identity-link' },
214
+ 'id5-sync.com': { id: 'fake-id5id' },
215
+ 'pubcid.org': { id: 'fake-pubcid' },
216
+ 'adserver.org': { id: 'fake-tdid' },
217
+ 'criteo.com': { id: 'fake-criteo' },
218
+ 'britepool.com': { id: 'fake-britepool' },
219
+ 'liveintent.com': { id: 'fake-lipbid' },
220
+ 'intentiq.com': { id: 'fake-intentiq' },
221
+ 'crwdcntrl.net': { id: 'fake-lotame' },
222
+ 'parrable.com': { id: 'fake-parrable' },
223
+ 'netid.de': { id: 'fake-netid' },
224
+ 'chrome.com': { id: 'fake-flocid' },
225
+ };
226
+ expect(openRtbReq.user.ext.eids).to.be.an('array').that.have.length(Object.keys(expectedEids).length);
227
+ for (const eid of openRtbReq.user.ext.eids) {
228
+ expect(Object.keys(expectedEids)).to.include(eid.source);
229
+ expect(eid.uids[0].id).to.equal(expectedEids[eid.source].id);
230
+ expect(eid.uids[0].atype).to.be.ok;
231
+ }
232
+
233
+ expect(openRtbReq.device.ua).to.equal(navigator.userAgent);
234
+ expect(openRtbReq.regs.coppa).to.equal(1);
235
+
236
+ expect(openRtbReq.source.ext.version).not.to.be.undefined;
237
+ expect(openRtbReq.source.ext.str).not.to.be.undefined;
238
+ expect(openRtbReq.source.ext.schain).to.deep.equal(bidRequests[0].schain);
239
+
240
+ expect(openRtbReq.bcat).to.deep.equal(bidRequests[0].params.bcat);
241
+ expect(openRtbReq.badv).to.deep.equal(bidRequests[0].params.badv);
242
+
243
+ expect(openRtbReq.imp).to.have.length(1);
244
+
245
+ expect(openRtbReq.imp[0].id).to.equal(expectedImpValues[rIndex].id);
246
+ expect(openRtbReq.imp[0].tagid).to.equal(expectedImpValues[rIndex].tagid);
247
+ expect(openRtbReq.imp[0].secure).to.equal(expectedImpValues[rIndex].secure);
248
+ expect(openRtbReq.imp[0].bidfloor).to.equal(expectedImpValues[rIndex].bidfloor);
249
+ });
239
250
  });
240
251
 
241
252
  it('should have empty eid array if no id is provided', () => {
242
- const openRtbReq = spec.buildRequests([bidRequests[1]], bidderRequest).data;
253
+ const openRtbReq = spec.buildRequests([bidRequests[1]], bidderRequest)[0].data;
243
254
 
244
255
  expect(openRtbReq.user.ext.eids).to.deep.equal([]);
245
256
  });
@@ -253,8 +264,7 @@ describe('sharethrough adapter spec', function() {
253
264
  consentString: 'consent',
254
265
  };
255
266
 
256
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
257
- const openRtbReq = builtRequest.data;
267
+ const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
258
268
 
259
269
  expect(openRtbReq.regs.ext.gdpr).to.equal(1);
260
270
  expect(openRtbReq.user.ext.consent).to.equal('consent');
@@ -265,8 +275,7 @@ describe('sharethrough adapter spec', function() {
265
275
  gdprApplies: false,
266
276
  };
267
277
 
268
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
269
- const openRtbReq = builtRequest.data;
278
+ const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
270
279
 
271
280
  expect(openRtbReq.regs.ext.gdpr).to.equal(0);
272
281
  expect(openRtbReq.user.ext.consent).to.be.undefined;
@@ -277,8 +286,7 @@ describe('sharethrough adapter spec', function() {
277
286
  it('should populate request accordingly when us privacy applies', () => {
278
287
  bidderRequest.uspConsent = 'consent';
279
288
 
280
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
281
- const openRtbReq = builtRequest.data;
289
+ const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
282
290
 
283
291
  expect(openRtbReq.regs.ext.us_privacy).to.equal('consent');
284
292
  });
@@ -288,8 +296,7 @@ describe('sharethrough adapter spec', function() {
288
296
  it('should populate request accordingly when coppa does not apply', () => {
289
297
  config.setConfig({ coppa: false });
290
298
 
291
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
292
- const openRtbReq = builtRequest.data;
299
+ const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
293
300
 
294
301
  expect(openRtbReq.regs.coppa).to.equal(0);
295
302
  });
@@ -298,46 +305,42 @@ describe('sharethrough adapter spec', function() {
298
305
 
299
306
  describe('universal id', () => {
300
307
  it('should include gpid when universal id is provided', () => {
301
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
302
- const openRtbReq = builtRequest.data;
308
+ const requests = spec.buildRequests(bidRequests, bidderRequest);
303
309
 
304
- expect(openRtbReq.imp[0].ext.gpid).to.equal('universal-id');
305
- expect(openRtbReq.imp[1].ext).to.be.undefined;
310
+ expect(requests[0].data.imp[0].ext.gpid).to.equal('universal-id');
311
+ expect(requests[1].data.imp[0].ext).to.be.undefined;
306
312
  });
307
313
  });
308
314
 
309
315
  describe('secure flag', () => {
310
316
  it('should be positive when protocol is https', () => {
311
317
  protocolStub.returns('https');
312
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
313
- const openRtbReq = builtRequest.data;
318
+ const requests = spec.buildRequests(bidRequests, bidderRequest);
314
319
 
315
- expect(openRtbReq.imp[0].secure).to.equal(1);
316
- expect(openRtbReq.imp[1].secure).to.equal(1);
320
+ expect(requests[0].data.imp[0].secure).to.equal(1);
321
+ expect(requests[1].data.imp[0].secure).to.equal(1);
317
322
  });
318
323
 
319
324
  it('should be negative when protocol is http', () => {
320
325
  protocolStub.returns('http');
321
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
322
- const openRtbReq = builtRequest.data;
326
+ const requests = spec.buildRequests(bidRequests, bidderRequest);
323
327
 
324
- expect(openRtbReq.imp[0].secure).to.equal(0);
325
- expect(openRtbReq.imp[1].secure).to.equal(0);
328
+ expect(requests[0].data.imp[0].secure).to.equal(0);
329
+ expect(requests[1].data.imp[0].secure).to.equal(0);
326
330
  });
327
331
 
328
332
  it('should be positive when protocol is neither http nor https', () => {
329
333
  protocolStub.returns('about');
330
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
331
- const openRtbReq = builtRequest.data;
334
+ const requests = spec.buildRequests(bidRequests, bidderRequest);
332
335
 
333
- expect(openRtbReq.imp[0].secure).to.equal(1);
334
- expect(openRtbReq.imp[1].secure).to.equal(1);
336
+ expect(requests[0].data.imp[0].secure).to.equal(1);
337
+ expect(requests[1].data.imp[0].secure).to.equal(1);
335
338
  });
336
339
  });
337
340
 
338
341
  describe('banner imp', () => {
339
342
  it('should generate open rtb banner imp', () => {
340
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
343
+ const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[0];
341
344
 
342
345
  const bannerImp = builtRequest.data.imp[0].banner;
343
346
  expect(bannerImp.pos).to.equal(1);
@@ -347,7 +350,7 @@ describe('sharethrough adapter spec', function() {
347
350
 
348
351
  it('should default to pos 0 if not provided', () => {
349
352
  delete bidRequests[0].mediaTypes;
350
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
353
+ const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[0];
351
354
 
352
355
  const bannerImp = builtRequest.data.imp[0].banner;
353
356
  expect(bannerImp.pos).to.equal(0);
@@ -356,9 +359,9 @@ describe('sharethrough adapter spec', function() {
356
359
 
357
360
  describe('video imp', () => {
358
361
  it('should generate open rtb video imp', () => {
359
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
362
+ const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[1];
360
363
 
361
- const videoImp = builtRequest.data.imp[1].video;
364
+ const videoImp = builtRequest.data.imp[0].video;
362
365
  expect(videoImp.pos).to.equal(3);
363
366
  expect(videoImp.topframe).to.equal(1);
364
367
  expect(videoImp.skip).to.equal(1);
@@ -399,9 +402,9 @@ describe('sharethrough adapter spec', function() {
399
402
  delete bidRequests[1].mediaTypes.video.companiontype;
400
403
  delete bidRequests[1].mediaTypes.video.companionad;
401
404
 
402
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
405
+ const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[1];
403
406
 
404
- const videoImp = builtRequest.data.imp[1].video;
407
+ const videoImp = builtRequest.data.imp[0].video;
405
408
  expect(videoImp.pos).to.equal(0);
406
409
  expect(videoImp.skip).to.equal(0);
407
410
  expect(videoImp.linearity).to.equal(1);
@@ -424,47 +427,46 @@ describe('sharethrough adapter spec', function() {
424
427
 
425
428
  it('should not return a video impression if context is outstream', () => {
426
429
  bidRequests[1].mediaTypes.video.context = 'outstream';
427
- const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
430
+ const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[1];
428
431
 
429
- const videoImp = builtRequest.data.imp[1];
430
- expect(videoImp).to.be.undefined;
432
+ expect(builtRequest).to.be.undefined;
431
433
  });
432
434
  });
433
435
  });
434
436
 
435
- describe('interpretResponse', function() {
437
+ describe('interpretResponse', function () {
436
438
  let request;
437
439
  let response;
438
440
 
439
- beforeEach(() => {
440
- request = spec.buildRequests(bidRequests, bidderRequest);
441
- response = {
442
- body: {
443
- seatbid: [{
444
- bid: [{
445
- id: '123',
446
- impid: 'bidId1',
447
- w: 300,
448
- h: 250,
449
- price: 42,
450
- crid: 'creative',
451
- dealid: 'deal',
452
- adomain: ['domain.com'],
453
- adm: 'markup',
454
- }, {
455
- id: '456',
456
- impid: 'bidId2',
457
- w: 640,
458
- h: 480,
459
- price: 42,
460
- adm: 'vastTag',
441
+ describe('banner', () => {
442
+ beforeEach(() => {
443
+ request = spec.buildRequests(bidRequests, bidderRequest)[0];
444
+ response = {
445
+ body: {
446
+ seatbid: [{
447
+ bid: [{
448
+ id: '123',
449
+ impid: 'bidId1',
450
+ w: 300,
451
+ h: 250,
452
+ price: 42,
453
+ crid: 'creative',
454
+ dealid: 'deal',
455
+ adomain: ['domain.com'],
456
+ adm: 'markup',
457
+ }, {
458
+ id: '456',
459
+ impid: 'bidId2',
460
+ w: 640,
461
+ h: 480,
462
+ price: 42,
463
+ adm: 'vastTag',
464
+ }],
461
465
  }],
462
- }],
463
- },
464
- };
465
- });
466
+ },
467
+ };
468
+ });
466
469
 
467
- describe('banner', () => {
468
470
  it('should return a banner bid', () => {
469
471
  const resp = spec.interpretResponse(response, request);
470
472
 
@@ -486,10 +488,28 @@ describe('sharethrough adapter spec', function() {
486
488
  });
487
489
 
488
490
  describe('video', () => {
491
+ beforeEach(() => {
492
+ request = spec.buildRequests(bidRequests, bidderRequest)[1];
493
+ response = {
494
+ body: {
495
+ seatbid: [{
496
+ bid: [{
497
+ id: '456',
498
+ impid: 'bidId2',
499
+ w: 640,
500
+ h: 480,
501
+ price: 42,
502
+ adm: 'vastTag',
503
+ }],
504
+ }],
505
+ },
506
+ };
507
+ });
508
+
489
509
  it('should return a video bid', () => {
490
510
  const resp = spec.interpretResponse(response, request);
491
511
 
492
- const bannerBid = resp[1];
512
+ const bannerBid = resp[0];
493
513
  expect(bannerBid.requestId).to.equal('bidId2');
494
514
  expect(bannerBid.width).to.equal(640);
495
515
  expect(bannerBid.height).to.equal(480);
@@ -507,11 +527,11 @@ describe('sharethrough adapter spec', function() {
507
527
  });
508
528
  });
509
529
 
510
- describe('getUserSyncs', function() {
530
+ describe('getUserSyncs', function () {
511
531
  const cookieSyncs = ['cookieUrl1', 'cookieUrl2', 'cookieUrl3'];
512
532
  const serverResponses = [{ body: { cookieSyncUrls: cookieSyncs } }];
513
533
 
514
- it('returns an array of correctly formatted user syncs', function() {
534
+ it('returns an array of correctly formatted user syncs', function () {
515
535
  const syncArray = spec.getUserSyncs({ pixelEnabled: true }, serverResponses, null, 'fake-privacy-signal');
516
536
  expect(syncArray).to.deep.equal([
517
537
  { type: 'image', url: 'cookieUrl1&us_privacy=fake-privacy-signal' },
@@ -520,22 +540,22 @@ describe('sharethrough adapter spec', function() {
520
540
  );
521
541
  });
522
542
 
523
- it('returns an empty array if serverResponses is empty', function() {
543
+ it('returns an empty array if serverResponses is empty', function () {
524
544
  const syncArray = spec.getUserSyncs({ pixelEnabled: true }, []);
525
545
  expect(syncArray).to.be.an('array').that.is.empty;
526
546
  });
527
547
 
528
- it('returns an empty array if the body is null', function() {
548
+ it('returns an empty array if the body is null', function () {
529
549
  const syncArray = spec.getUserSyncs({ pixelEnabled: true }, [{ body: null }]);
530
550
  expect(syncArray).to.be.an('array').that.is.empty;
531
551
  });
532
552
 
533
- it('returns an empty array if the body.cookieSyncUrls is missing', function() {
553
+ it('returns an empty array if the body.cookieSyncUrls is missing', function () {
534
554
  const syncArray = spec.getUserSyncs({ pixelEnabled: true }, [{ body: { creatives: ['creative'] } }]);
535
555
  expect(syncArray).to.be.an('array').that.is.empty;
536
556
  });
537
557
 
538
- it('returns an empty array if pixels are not enabled', function() {
558
+ it('returns an empty array if pixels are not enabled', function () {
539
559
  const syncArray = spec.getUserSyncs({ pixelEnabled: false }, serverResponses);
540
560
  expect(syncArray).to.be.an('array').that.is.empty;
541
561
  });
@@ -0,0 +1,200 @@
1
+ import {
2
+ expect
3
+ } from 'chai';
4
+ import {
5
+ spec
6
+ } from 'modules/slimcutBidAdapter.js';
7
+ import {
8
+ newBidder
9
+ } from 'src/adapters/bidderFactory.js';
10
+ const ENDPOINT = 'https://sb.freeskreen.com/pbr';
11
+ const AD_SCRIPT = '<script type="text/javascript" class="slimcut" async="true" src="https://static.freeskreen.com/publisher/83/freeskreen.min.js"></script>"';
12
+ describe('slimcutBidAdapter', function() {
13
+ const adapter = newBidder(spec);
14
+ describe('inherited functions', function() {
15
+ it('exists and is a function', function() {
16
+ expect(adapter.callBids).to.exist.and.to.be.a('function');
17
+ });
18
+ });
19
+ describe('isBidRequestValid', function() {
20
+ let bid = {
21
+ 'bidder': 'slimcut',
22
+ 'params': {
23
+ 'placementId': 83
24
+ },
25
+ 'adUnitCode': 'adunit-code',
26
+ 'sizes': [
27
+ [300, 250],
28
+ [300, 600]
29
+ ],
30
+ 'bidId': '3c871ffa8ef14c',
31
+ 'bidderRequestId': 'b41642f1aee381',
32
+ 'auctionId': '4e156668c977d7'
33
+ };
34
+ it('should return true when required params found', function() {
35
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
36
+ });
37
+ it('should return false when placementId is not valid (letters)', function() {
38
+ let bid = Object.assign({}, bid);
39
+ delete bid.params;
40
+ bid.params = {
41
+ 'placementId': 'ABCD'
42
+ };
43
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
44
+ });
45
+ it('should return false when placementId < 0', function() {
46
+ let bid = Object.assign({}, bid);
47
+ delete bid.params;
48
+ bid.params = {
49
+ 'placementId': -1
50
+ };
51
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
52
+ });
53
+ it('should return false when required params are not passed', function() {
54
+ let bid = Object.assign({}, bid);
55
+ delete bid.params;
56
+ bid.params = {};
57
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
58
+ });
59
+ });
60
+ describe('buildRequests', function() {
61
+ let bidRequests = [{
62
+ 'bidder': 'teads',
63
+ 'params': {
64
+ 'placementId': 10433394
65
+ },
66
+ 'adUnitCode': 'adunit-code',
67
+ 'sizes': [
68
+ [300, 250],
69
+ [300, 600]
70
+ ],
71
+ 'bidId': '3c871ffa8ef14c',
72
+ 'bidderRequestId': 'b41642f1aee381',
73
+ 'auctionId': '4e156668c977d7',
74
+ 'deviceWidth': 1680
75
+ }];
76
+ let bidderResquestDefault = {
77
+ 'auctionId': '4e156668c977d7',
78
+ 'bidderRequestId': 'b41642f1aee381',
79
+ 'timeout': 3000
80
+ };
81
+ it('sends bid request to ENDPOINT via POST', function() {
82
+ const request = spec.buildRequests(bidRequests, bidderResquestDefault);
83
+ expect(request.url).to.equal(ENDPOINT);
84
+ expect(request.method).to.equal('POST');
85
+ });
86
+ it('should send GDPR to endpoint', function() {
87
+ let consentString = 'JRJ8RKfDeBNsERRDCSAAZ+A==';
88
+ let bidderRequest = {
89
+ 'auctionId': '4e156668c977d7',
90
+ 'bidderRequestId': 'b41642f1aee381',
91
+ 'timeout': 3000,
92
+ 'gdprConsent': {
93
+ 'consentString': consentString,
94
+ 'gdprApplies': true,
95
+ 'vendorData': {
96
+ 'hasGlobalConsent': false
97
+ }
98
+ }
99
+ };
100
+ const request = spec.buildRequests(bidRequests, bidderRequest);
101
+ const payload = JSON.parse(request.data);
102
+ expect(payload.gdpr_iab).to.exist;
103
+ expect(payload.gdpr_iab.consent).to.equal(consentString);
104
+ });
105
+ it('should add referer info to payload', function() {
106
+ const bidRequest = Object.assign({}, bidRequests[0])
107
+ const bidderRequest = {
108
+ refererInfo: {
109
+ referer: 'https://example.com/page.html',
110
+ reachedTop: true,
111
+ numIframes: 2
112
+ }
113
+ }
114
+ const request = spec.buildRequests([bidRequest], bidderRequest);
115
+ const payload = JSON.parse(request.data);
116
+ expect(payload.referrer).to.exist;
117
+ expect(payload.referrer).to.deep.equal('https://example.com/page.html')
118
+ });
119
+ });
120
+ describe('getUserSyncs', () => {
121
+ let bids = {
122
+ 'body': {
123
+ 'responses': [{
124
+ 'ad': AD_SCRIPT,
125
+ 'cpm': 0.5,
126
+ 'currency': 'USD',
127
+ 'height': 250,
128
+ 'netRevenue': true,
129
+ 'requestId': '3ede2a3fa0db94',
130
+ 'ttl': 360,
131
+ 'width': 300,
132
+ 'creativeId': 'er2ee',
133
+ 'transactionId': 'deadb33f',
134
+ 'winUrl': 'https://sb.freeskreen.com/win'
135
+ }]
136
+ }
137
+ };
138
+ it('should get the correct number of sync urls', () => {
139
+ let urls = spec.getUserSyncs({
140
+ iframeEnabled: true
141
+ }, bids);
142
+ expect(urls.length).to.equal(1);
143
+ expect(urls[0].url).to.equal('https://sb.freeskreen.com/async_usersync.html');
144
+ });
145
+ it('should return no url if not iframe enabled', () => {
146
+ let urls = spec.getUserSyncs({
147
+ iframeEnabled: false
148
+ }, bids);
149
+ expect(urls.length).to.equal(0);
150
+ });
151
+ });
152
+ describe('interpretResponse', function() {
153
+ let bids = {
154
+ 'body': {
155
+ 'responses': [{
156
+ 'ad': AD_SCRIPT,
157
+ 'cpm': 0.5,
158
+ 'currency': 'USD',
159
+ 'height': 250,
160
+ 'netRevenue': true,
161
+ 'requestId': '3ede2a3fa0db94',
162
+ 'ttl': 360,
163
+ 'width': 300,
164
+ 'creativeId': 'er2ee',
165
+ 'transactionId': 'deadb33f',
166
+ 'winUrl': 'https://sb.freeskreen.com/win'
167
+ }]
168
+ }
169
+ };
170
+ it('should get correct bid response', function() {
171
+ let expectedResponse = [{
172
+ 'cpm': 0.5,
173
+ 'width': 300,
174
+ 'height': 250,
175
+ 'currency': 'USD',
176
+ 'netRevenue': true,
177
+ 'ttl': 360,
178
+ 'ad': AD_SCRIPT,
179
+ 'requestId': '3ede2a3fa0db94',
180
+ 'creativeId': 'er2ee',
181
+ 'transactionId': 'deadb33f',
182
+ 'winUrl': 'https://sb.freeskreen.com/win',
183
+ 'meta': {
184
+ 'advertiserDomains': []
185
+ }
186
+ }];
187
+ let result = spec.interpretResponse(bids);
188
+ expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
189
+ });
190
+ it('handles nobid responses', function() {
191
+ let bids = {
192
+ 'body': {
193
+ 'responses': []
194
+ }
195
+ };
196
+ let result = spec.interpretResponse(bids);
197
+ expect(result.length).to.equal(0);
198
+ });
199
+ });
200
+ });