prebid.js 7.35.0 → 7.37.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 (229) hide show
  1. package/.devcontainer/Dockerfile +2 -0
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/admaruBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/aidemBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/aolBidAdapter.js +1 -1
  17. package/dist/appierAnalyticsAdapter.js +1 -1
  18. package/dist/appnexusBidAdapter.js +1 -1
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/audiencerunBidAdapter.js +1 -1
  21. package/dist/axonixBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/big-richmediaBidAdapter.js +1 -1
  24. package/dist/bluebillywigBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/brightcomBidAdapter.js +1 -1
  28. package/dist/brightcomSSPBidAdapter.js +1 -0
  29. package/dist/carodaBidAdapter.js +1 -1
  30. package/dist/chtnwBidAdapter.js +1 -1
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectadBidAdapter.js +1 -1
  33. package/dist/consumableBidAdapter.js +1 -1
  34. package/dist/conversantBidAdapter.js +1 -1
  35. package/dist/craftBidAdapter.js +1 -1
  36. package/dist/criteoBidAdapter.js +1 -1
  37. package/dist/cwireBidAdapter.js +1 -1
  38. package/dist/dependencies.json +3 -0
  39. package/dist/discoveryBidAdapter.js +1 -1
  40. package/dist/dspxBidAdapter.js +1 -1
  41. package/dist/eplanningBidAdapter.js +1 -1
  42. package/dist/feedadBidAdapter.js +1 -1
  43. package/dist/finativeBidAdapter.js +1 -1
  44. package/dist/freewheel-sspBidAdapter.js +1 -1
  45. package/dist/glimpseBidAdapter.js +1 -1
  46. package/dist/gmosspBidAdapter.js +1 -1
  47. package/dist/goldbachBidAdapter.js +1 -1
  48. package/dist/gridBidAdapter.js +1 -1
  49. package/dist/gridNMBidAdapter.js +1 -1
  50. package/dist/gumgumBidAdapter.js +1 -1
  51. package/dist/h12mediaBidAdapter.js +1 -1
  52. package/dist/id5IdSystem.js +1 -1
  53. package/dist/impactifyBidAdapter.js +1 -1
  54. package/dist/improvedigitalBidAdapter.js +1 -1
  55. package/dist/incrxBidAdapter.js +1 -1
  56. package/dist/inmarBidAdapter.js +1 -1
  57. package/dist/insticatorBidAdapter.js +1 -1
  58. package/dist/ixBidAdapter.js +1 -1
  59. package/dist/jixieBidAdapter.js +1 -1
  60. package/dist/justpremiumBidAdapter.js +1 -1
  61. package/dist/konduitAnalyticsAdapter.js +1 -1
  62. package/dist/kueezBidAdapter.js +1 -1
  63. package/dist/kueezRtbBidAdapter.js +1 -1
  64. package/dist/lassoBidAdapter.js +1 -1
  65. package/dist/lifestreetBidAdapter.js +1 -1
  66. package/dist/limelightDigitalBidAdapter.js +1 -1
  67. package/dist/liveIntentIdSystem.js +1 -1
  68. package/dist/livewrappedBidAdapter.js +1 -1
  69. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  70. package/dist/logicadBidAdapter.js +1 -1
  71. package/dist/loglyliftBidAdapter.js +1 -1
  72. package/dist/magniteAnalyticsAdapter.js +1 -1
  73. package/dist/malltvAnalyticsAdapter.js +1 -1
  74. package/dist/marsmediaBidAdapter.js +1 -1
  75. package/dist/mediafuseBidAdapter.js +1 -1
  76. package/dist/mediagoBidAdapter.js +1 -1
  77. package/dist/mediakeysBidAdapter.js +1 -1
  78. package/dist/mediasquareBidAdapter.js +1 -1
  79. package/dist/mgidBidAdapter.js +1 -1
  80. package/dist/minutemediaBidAdapter.js +1 -1
  81. package/dist/minutemediaplusBidAdapter.js +1 -0
  82. package/dist/neuwoRtdProvider.js +1 -0
  83. package/dist/nextMillenniumBidAdapter.js +1 -1
  84. package/dist/nexx360BidAdapter.js +1 -1
  85. package/dist/not-for-prod/prebid.js +141 -137
  86. package/dist/oguryBidAdapter.js +1 -1
  87. package/dist/onetagBidAdapter.js +1 -1
  88. package/dist/ooloAnalyticsAdapter.js +1 -1
  89. package/dist/outbrainBidAdapter.js +1 -1
  90. package/dist/parrableIdSystem.js +1 -1
  91. package/dist/pixfutureBidAdapter.js +1 -1
  92. package/dist/prebid-core.js +1 -1
  93. package/dist/prebidServerBidAdapter.js +1 -1
  94. package/dist/proxistoreBidAdapter.js +1 -1
  95. package/dist/publinkIdSystem.js +1 -1
  96. package/dist/pubmaticBidAdapter.js +1 -1
  97. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  98. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  99. package/dist/pxyzBidAdapter.js +1 -1
  100. package/dist/quantcastBidAdapter.js +1 -1
  101. package/dist/readpeakBidAdapter.js +1 -1
  102. package/dist/relaidoBidAdapter.js +1 -1
  103. package/dist/rhythmoneBidAdapter.js +1 -1
  104. package/dist/riseBidAdapter.js +1 -1
  105. package/dist/rubiconAnalyticsAdapter.js +1 -1
  106. package/dist/rubiconBidAdapter.js +1 -1
  107. package/dist/scatteredBidAdapter.js +1 -0
  108. package/dist/seedingAllianceBidAdapter.js +1 -1
  109. package/dist/seedtagBidAdapter.js +1 -1
  110. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  111. package/dist/sharethroughBidAdapter.js +1 -1
  112. package/dist/shinezBidAdapter.js +1 -1
  113. package/dist/sirdataRtdProvider.js +1 -1
  114. package/dist/smaatoBidAdapter.js +1 -1
  115. package/dist/smartadserverBidAdapter.js +1 -1
  116. package/dist/smartxBidAdapter.js +1 -1
  117. package/dist/smilewantedBidAdapter.js +1 -1
  118. package/dist/sonobiBidAdapter.js +1 -1
  119. package/dist/sovrnAnalyticsAdapter.js +1 -1
  120. package/dist/sovrnBidAdapter.js +1 -1
  121. package/dist/sspBCBidAdapter.js +1 -1
  122. package/dist/sublimeBidAdapter.js +1 -1
  123. package/dist/synacormediaBidAdapter.js +1 -1
  124. package/dist/targetVideoBidAdapter.js +1 -1
  125. package/dist/teadsBidAdapter.js +1 -1
  126. package/dist/trionBidAdapter.js +1 -1
  127. package/dist/tripleliftBidAdapter.js +1 -1
  128. package/dist/ttdBidAdapter.js +1 -1
  129. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  130. package/dist/uid2IdSystem.js +1 -1
  131. package/dist/underdogmediaBidAdapter.js +1 -1
  132. package/dist/undertoneBidAdapter.js +1 -1
  133. package/dist/userId.js +1 -1
  134. package/dist/vidazooBidAdapter.js +1 -1
  135. package/dist/videobyteBidAdapter.js +1 -1
  136. package/dist/visxBidAdapter.js +1 -1
  137. package/dist/vuukleBidAdapter.js +1 -1
  138. package/dist/widespaceBidAdapter.js +1 -1
  139. package/dist/winrBidAdapter.js +1 -1
  140. package/dist/yahoosspBidAdapter.js +1 -1
  141. package/dist/yieldmoBidAdapter.js +1 -1
  142. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  143. package/integrationExamples/gpt/neuwoRtdProvider_example.html +190 -0
  144. package/modules/33acrossBidAdapter.js +13 -4
  145. package/modules/adagioBidAdapter.js +14 -14
  146. package/modules/adagioBidAdapter.md +3 -1
  147. package/modules/admaruBidAdapter.js +19 -1
  148. package/modules/aidemBidAdapter.js +90 -65
  149. package/modules/aidemBidAdapter.md +10 -7
  150. package/modules/ajaBidAdapter.js +6 -1
  151. package/modules/amxIdSystem.md +2 -10
  152. package/modules/aolBidAdapter.js +1 -1
  153. package/modules/appnexusBidAdapter.js +45 -48
  154. package/modules/brightcomBidAdapter.js +1 -0
  155. package/modules/brightcomSSPBidAdapter.js +323 -0
  156. package/modules/brightcomSSPBidAdapter.md +46 -0
  157. package/modules/criteoBidAdapter.js +4 -5
  158. package/modules/cwireBidAdapter.md +9 -3
  159. package/modules/discoveryBidAdapter.js +22 -12
  160. package/modules/feedadBidAdapter.js +35 -15
  161. package/modules/fpdModule/index.md +5 -2
  162. package/modules/freewheel-sspBidAdapter.js +5 -1
  163. package/modules/gridBidAdapter.js +3 -1
  164. package/modules/incrxBidAdapter.js +2 -0
  165. package/modules/ixBidAdapter.js +318 -175
  166. package/modules/kueezRtbBidAdapter.js +54 -20
  167. package/modules/limelightDigitalBidAdapter.js +6 -1
  168. package/modules/limelightDigitalBidAdapter.md +12 -2
  169. package/modules/liveIntentIdSystem.js +1 -1
  170. package/modules/livewrappedBidAdapter.js +28 -16
  171. package/modules/mediagoBidAdapter.js +22 -17
  172. package/modules/minutemediaplusBidAdapter.js +291 -0
  173. package/modules/minutemediaplusBidAdapter.md +35 -0
  174. package/modules/neuwoRtdProvider.js +171 -0
  175. package/modules/neuwoRtdProvider.md +40 -0
  176. package/modules/nextMillenniumBidAdapter.js +9 -1
  177. package/modules/nexx360BidAdapter.js +1 -1
  178. package/modules/prebidServerBidAdapter/ortbConverter.js +6 -0
  179. package/modules/proxistoreBidAdapter.js +2 -2
  180. package/modules/pubmaticBidAdapter.js +4 -0
  181. package/modules/pubxaiAnalyticsAdapter.js +2 -2
  182. package/modules/scatteredBidAdapter.js +72 -0
  183. package/modules/scatteredBidAdapter.md +36 -0
  184. package/modules/sirdataRtdProvider.js +262 -284
  185. package/modules/smartxBidAdapter.js +2 -0
  186. package/modules/smilewantedBidAdapter.js +5 -0
  187. package/modules/sonobiBidAdapter.js +1 -10
  188. package/modules/topicsFpdModule.md +62 -0
  189. package/modules/tripleliftBidAdapter.js +4 -0
  190. package/modules/userId/eids.js +1 -1
  191. package/modules/vidazooBidAdapter.js +3 -1
  192. package/modules/yahoosspBidAdapter.js +1 -1
  193. package/modules/yieldmoBidAdapter.js +1 -0
  194. package/package.json +2 -2
  195. package/src/adapterManager.js +30 -14
  196. package/src/utils.js +1 -1
  197. package/test/spec/modules/33acrossBidAdapter_spec.js +51 -18
  198. package/test/spec/modules/adagioBidAdapter_spec.js +2 -2
  199. package/test/spec/modules/admaruBidAdapter_spec.js +48 -0
  200. package/test/spec/modules/aidemBidAdapter_spec.js +77 -10
  201. package/test/spec/modules/ajaBidAdapter_spec.js +21 -1
  202. package/test/spec/modules/aolBidAdapter_spec.js +2 -2
  203. package/test/spec/modules/appnexusBidAdapter_spec.js +123 -16
  204. package/test/spec/modules/brightcomSSPBidAdapter_spec.js +411 -0
  205. package/test/spec/modules/criteoBidAdapter_spec.js +24 -1
  206. package/test/spec/modules/eids_spec.js +1 -1
  207. package/test/spec/modules/feedadBidAdapter_spec.js +47 -77
  208. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +1 -1
  209. package/test/spec/modules/incrxBidAdapter_spec.js +4 -0
  210. package/test/spec/modules/ixBidAdapter_spec.js +24 -54
  211. package/test/spec/modules/kueezRtbBidAdapter_spec.js +63 -22
  212. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +35 -5
  213. package/test/spec/modules/livewrappedBidAdapter_spec.js +267 -2
  214. package/test/spec/modules/minutemediaplusBidAdapter_spec.js +519 -0
  215. package/test/spec/modules/neuwoRtdProvider_spec.js +123 -0
  216. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +11 -0
  217. package/test/spec/modules/prebidServerBidAdapter_spec.js +56 -0
  218. package/test/spec/modules/proxistoreBidAdapter_spec.js +2 -2
  219. package/test/spec/modules/pubmaticBidAdapter_spec.js +15 -0
  220. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +3 -1
  221. package/test/spec/modules/scatteredBidAdapter_spec.js +210 -0
  222. package/test/spec/modules/sirdataRtdProvider_spec.js +116 -22
  223. package/test/spec/modules/smilewantedBidAdapter_spec.js +54 -3
  224. package/test/spec/modules/sonobiBidAdapter_spec.js +3 -25
  225. package/test/spec/modules/tripleliftBidAdapter_spec.js +9 -2
  226. package/test/spec/modules/userId_spec.js +1 -1
  227. package/test/spec/modules/vidazooBidAdapter_spec.js +4 -1
  228. package/test/spec/modules/yahoosspBidAdapter_spec.js +1 -1
  229. package/test/spec/unit/core/adapterManager_spec.js +147 -0
@@ -36,14 +36,31 @@ describe('AppNexusAdapter', function () {
36
36
  });
37
37
 
38
38
  it('should return true when required params found', function () {
39
- let bid = Object.assign({}, bid);
40
- delete bid.params;
41
- bid.params = {
39
+ let bid1 = deepClone(bid);
40
+ bid1.params = {
41
+ 'placement_id': 123423
42
+ }
43
+ expect(spec.isBidRequestValid(bid1)).to.equal(true);
44
+ });
45
+
46
+ it('should return true when required params found', function () {
47
+ let bid1 = deepClone(bid);
48
+ bid1.params = {
42
49
  'member': '1234',
43
50
  'invCode': 'ABCD'
44
51
  };
45
52
 
46
- expect(spec.isBidRequestValid(bid)).to.equal(true);
53
+ expect(spec.isBidRequestValid(bid1)).to.equal(true);
54
+ });
55
+
56
+ it('should return true when required params found', function () {
57
+ let bid1 = deepClone(bid);
58
+ bid1.params = {
59
+ 'member': '1234',
60
+ 'inv_code': 'ABCD'
61
+ };
62
+
63
+ expect(spec.isBidRequestValid(bid1)).to.equal(true);
47
64
  });
48
65
 
49
66
  it('should return false when required params are not passed', function () {
@@ -54,6 +71,15 @@ describe('AppNexusAdapter', function () {
54
71
  };
55
72
  expect(spec.isBidRequestValid(bid)).to.equal(false);
56
73
  });
74
+
75
+ it('should return false when required params are not passed', function () {
76
+ let bid = Object.assign({}, bid);
77
+ delete bid.params;
78
+ bid.params = {
79
+ 'placement_id': 0
80
+ };
81
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
82
+ });
57
83
  });
58
84
 
59
85
  describe('buildRequests', function () {
@@ -101,6 +127,24 @@ describe('AppNexusAdapter', function () {
101
127
  expect(payload.tags[0].private_sizes).to.deep.equal([{ width: 300, height: 250 }]);
102
128
  });
103
129
 
130
+ it('should parse out private sizes', function () {
131
+ let bidRequest = Object.assign({},
132
+ bidRequests[0],
133
+ {
134
+ params: {
135
+ placementId: '10433394',
136
+ private_sizes: [300, 250]
137
+ }
138
+ }
139
+ );
140
+
141
+ const request = spec.buildRequests([bidRequest]);
142
+ const payload = JSON.parse(request.data);
143
+
144
+ expect(payload.tags[0].private_sizes).to.exist;
145
+ expect(payload.tags[0].private_sizes).to.deep.equal([{ width: 300, height: 250 }]);
146
+ });
147
+
104
148
  it('should add position in request', function () {
105
149
  // set from bid.params
106
150
  let bidRequest = deepClone(bidRequests[0]);
@@ -168,6 +212,24 @@ describe('AppNexusAdapter', function () {
168
212
  expect(payload.publisher_id).to.deep.equal(1231234);
169
213
  });
170
214
 
215
+ it('should add publisher_id in request', function () {
216
+ let bidRequest = Object.assign({},
217
+ bidRequests[0],
218
+ {
219
+ params: {
220
+ placement_id: '10433394',
221
+ publisher_id: '1231234'
222
+ }
223
+ });
224
+ const request = spec.buildRequests([bidRequest]);
225
+ const payload = JSON.parse(request.data);
226
+
227
+ expect(payload.tags[0].publisher_id).to.exist;
228
+ expect(payload.tags[0].publisher_id).to.deep.equal(1231234);
229
+ expect(payload.publisher_id).to.exist;
230
+ expect(payload.publisher_id).to.deep.equal(1231234);
231
+ });
232
+
171
233
  it('should add source and verison to the tag', function () {
172
234
  const request = spec.buildRequests(bidRequests);
173
235
  const payload = JSON.parse(request.data);
@@ -189,7 +251,7 @@ describe('AppNexusAdapter', function () {
189
251
  bids: [{
190
252
  bidder: 'appnexus',
191
253
  params: {
192
- placementId: '10433394'
254
+ placement_id: '10433394'
193
255
  }
194
256
  }],
195
257
  transactionId: '04f2659e-c005-4eb1-a57c-fa93145e3843'
@@ -351,7 +413,7 @@ describe('AppNexusAdapter', function () {
351
413
  bidRequests[0],
352
414
  {
353
415
  params: {
354
- placementId: '10433394',
416
+ placement_id: '10433394',
355
417
  user: {
356
418
  externalUid: '123',
357
419
  segments: [123, { id: 987, value: 876 }],
@@ -407,7 +469,7 @@ describe('AppNexusAdapter', function () {
407
469
 
408
470
  // 2 -> reserve is defined, getFloor not defined > reserve is used
409
471
  bidRequest.params = {
410
- 'placementId': '10433394',
472
+ 'placement_id': '10433394',
411
473
  'reserve': 0.5
412
474
  };
413
475
  request = spec.buildRequests([bidRequest]);
@@ -428,7 +490,7 @@ describe('AppNexusAdapter', function () {
428
490
  let bidRequest = Object.assign({},
429
491
  bidRequests[0],
430
492
  {
431
- params: { placementId: '14542875' }
493
+ params: { placement_id: '14542875' }
432
494
  },
433
495
  {
434
496
  mediaTypes: {
@@ -461,7 +523,7 @@ describe('AppNexusAdapter', function () {
461
523
  let bidRequest = Object.assign({},
462
524
  bidRequests[0],
463
525
  {
464
- params: { placementId: '14542875' }
526
+ params: { placement_id: '14542875' }
465
527
  },
466
528
  {
467
529
  mediaTypes: {
@@ -484,7 +546,7 @@ describe('AppNexusAdapter', function () {
484
546
  let bidRequest = Object.assign({},
485
547
  bidRequests[0],
486
548
  {
487
- params: { placementId: '14542875' }
549
+ params: { placement_id: '14542875' }
488
550
  },
489
551
  {
490
552
  mediaTypes: {
@@ -526,7 +588,7 @@ describe('AppNexusAdapter', function () {
526
588
  let bidRequest = Object.assign({},
527
589
  bidRequests[0],
528
590
  {
529
- params: { placementId: '14542875' }
591
+ params: { placement_id: '14542875' }
530
592
  },
531
593
  {
532
594
  mediaTypes: {
@@ -557,7 +619,7 @@ describe('AppNexusAdapter', function () {
557
619
  let bidRequest = Object.assign({},
558
620
  bidRequests[0],
559
621
  {
560
- params: { placementId: '14542875' }
622
+ params: { placement_id: '14542875' }
561
623
  },
562
624
  {
563
625
  mediaTypes: {
@@ -585,7 +647,7 @@ describe('AppNexusAdapter', function () {
585
647
  let bidRequest = Object.assign({},
586
648
  bidRequests[0],
587
649
  {
588
- params: { placementId: '14542875' }
650
+ params: { placement_id: '14542875' }
589
651
  },
590
652
  {
591
653
  mediaTypes: {
@@ -610,7 +672,7 @@ describe('AppNexusAdapter', function () {
610
672
  mediaType: 'banner',
611
673
  params: {
612
674
  sizes: [[300, 250], [300, 600]],
613
- placementId: 13144370
675
+ placement_id: 13144370
614
676
  }
615
677
  }
616
678
  );
@@ -786,7 +848,7 @@ describe('AppNexusAdapter', function () {
786
848
  bidRequests[0],
787
849
  {
788
850
  params: {
789
- placementId: '10433394',
851
+ placement_id: '10433394',
790
852
  keywords: {
791
853
  single: 'val',
792
854
  singleArr: ['val'],
@@ -931,6 +993,23 @@ describe('AppNexusAdapter', function () {
931
993
  expect(payload.tags[0].use_pmt_rule).to.equal(true);
932
994
  });
933
995
 
996
+ it('should add payment rules to the request', function () {
997
+ let bidRequest = Object.assign({},
998
+ bidRequests[0],
999
+ {
1000
+ params: {
1001
+ placement_id: '10433394',
1002
+ use_payment_rule: true
1003
+ }
1004
+ }
1005
+ );
1006
+
1007
+ const request = spec.buildRequests([bidRequest]);
1008
+ const payload = JSON.parse(request.data);
1009
+
1010
+ expect(payload.tags[0].use_pmt_rule).to.equal(true);
1011
+ });
1012
+
934
1013
  it('should add gpid to the request', function () {
935
1014
  let testGpid = '/12345/my-gpt-tag-0';
936
1015
  let bidRequest = deepClone(bidRequests[0]);
@@ -1239,9 +1318,33 @@ describe('AppNexusAdapter', function () {
1239
1318
  source: 'puburl2.com',
1240
1319
  uids: [{
1241
1320
  id: 'pubid2'
1321
+ }, {
1322
+ id: 'pubid2-123'
1242
1323
  }]
1243
1324
  }]
1244
- }
1325
+ },
1326
+ userIdAsEids: [{
1327
+ source: 'adserver.org',
1328
+ uids: [{ id: 'sample-userid' }]
1329
+ }, {
1330
+ source: 'criteo.com',
1331
+ uids: [{ id: 'sample-criteo-userid' }]
1332
+ }, {
1333
+ source: 'netid.de',
1334
+ uids: [{ id: 'sample-netId-userid' }]
1335
+ }, {
1336
+ source: 'liveramp.com',
1337
+ uids: [{ id: 'sample-idl-userid' }]
1338
+ }, {
1339
+ source: 'uidapi.com',
1340
+ uids: [{ id: 'sample-uid2-value' }]
1341
+ }, {
1342
+ source: 'puburl.com',
1343
+ uids: [{ id: 'pubid1' }]
1344
+ }, {
1345
+ source: 'puburl2.com',
1346
+ uids: [{ id: 'pubid2' }, { id: 'pubid2-123' }]
1347
+ }]
1245
1348
  });
1246
1349
 
1247
1350
  const request = spec.buildRequests([bidRequest]);
@@ -1282,6 +1385,10 @@ describe('AppNexusAdapter', function () {
1282
1385
  source: 'puburl2.com',
1283
1386
  id: 'pubid2'
1284
1387
  });
1388
+ expect(payload.eids).to.deep.include({
1389
+ source: 'puburl2.com',
1390
+ id: 'pubid2-123'
1391
+ });
1285
1392
  });
1286
1393
 
1287
1394
  it('should populate iab_support object at the root level if omid support is detected', function () {
@@ -0,0 +1,411 @@
1
+ import { expect } from 'chai';
2
+ import * as utils from 'src/utils.js';
3
+ import { spec } from 'modules/brightcomSSPBidAdapter';
4
+ import { newBidder } from 'src/adapters/bidderFactory.js';
5
+ import {config} from '../../../src/config';
6
+
7
+ const URL = 'https://rt.marphezis.com/hb';
8
+
9
+ describe('brightcomSSPBidAdapter', function() {
10
+ const adapter = newBidder(spec);
11
+ let element, win;
12
+ let bidRequests;
13
+ let sandbox;
14
+
15
+ beforeEach(function() {
16
+ element = {
17
+ x: 0,
18
+ y: 0,
19
+
20
+ width: 0,
21
+ height: 0,
22
+
23
+ getBoundingClientRect: () => {
24
+ return {
25
+ width: element.width,
26
+ height: element.height,
27
+
28
+ left: element.x,
29
+ top: element.y,
30
+ right: element.x + element.width,
31
+ bottom: element.y + element.height
32
+ };
33
+ }
34
+ };
35
+ win = {
36
+ document: {
37
+ visibilityState: 'visible'
38
+ },
39
+
40
+ innerWidth: 800,
41
+ innerHeight: 600
42
+ };
43
+ bidRequests = [{
44
+ 'bidder': 'bcmssp',
45
+ 'params': {
46
+ 'publisherId': 1234567
47
+ },
48
+ 'adUnitCode': 'adunit-code',
49
+ 'mediaTypes': {
50
+ 'banner': {
51
+ 'sizes': [[300, 250], [300, 600]]
52
+ }
53
+ },
54
+ 'bidId': '5fb26ac22bde4',
55
+ 'bidderRequestId': '4bf93aeb730cb9',
56
+ 'auctionId': 'ffe9a1f7-7b67-4bda-a8e0-9ee5dc9f442e',
57
+ 'schain': {
58
+ 'ver': '1.0',
59
+ 'complete': 1,
60
+ 'nodes': [
61
+ {
62
+ 'asi': 'exchange1.com',
63
+ 'sid': '1234',
64
+ 'hp': 1,
65
+ 'rid': 'bid-request-1',
66
+ 'name': 'publisher',
67
+ 'domain': 'publisher.com'
68
+ }
69
+ ]
70
+ },
71
+ }];
72
+
73
+ sandbox = sinon.sandbox.create();
74
+ sandbox.stub(document, 'getElementById').withArgs('adunit-code').returns(element);
75
+ sandbox.stub(utils, 'getWindowTop').returns(win);
76
+ sandbox.stub(utils, 'getWindowSelf').returns(win);
77
+ });
78
+
79
+ afterEach(function() {
80
+ sandbox.restore();
81
+ });
82
+
83
+ describe('isBidRequestValid', function () {
84
+ let bid = {
85
+ 'bidder': 'bcmssp',
86
+ 'params': {
87
+ 'publisherId': 1234567
88
+ },
89
+ 'adUnitCode': 'adunit-code',
90
+ 'mediaTypes': {
91
+ 'banner': {
92
+ 'sizes': [[300, 250], [300, 600]]
93
+ }
94
+ },
95
+ 'bidId': '5fb26ac22bde4',
96
+ 'bidderRequestId': '4bf93aeb730cb9',
97
+ 'auctionId': 'ffe9a1f7-7b67-4bda-a8e0-9ee5dc9f442e',
98
+ };
99
+
100
+ it('should return true when required params found', function () {
101
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
102
+ });
103
+
104
+ it('should return false when publisherId not passed correctly', function () {
105
+ bid.params.publisherId = undefined;
106
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
107
+ });
108
+
109
+ it('should return false when require params are not passed', function () {
110
+ let bid = Object.assign({}, bid);
111
+ bid.params = {};
112
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
113
+ });
114
+ });
115
+
116
+ describe('buildRequests', function () {
117
+ it('sends bid request to our endpoint via POST', function () {
118
+ const request = spec.buildRequests(bidRequests);
119
+ expect(request.method).to.equal('POST');
120
+ });
121
+
122
+ it('request url should match our endpoint url', function () {
123
+ const request = spec.buildRequests(bidRequests);
124
+ expect(request.url).to.equal(URL);
125
+ });
126
+
127
+ it('sets the proper banner object', function() {
128
+ const request = spec.buildRequests(bidRequests);
129
+ const payload = JSON.parse(request.data);
130
+ expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}]);
131
+ });
132
+
133
+ it('accepts a single array as a size', function() {
134
+ bidRequests[0].mediaTypes.banner.sizes = [300, 250];
135
+ const request = spec.buildRequests(bidRequests);
136
+ const payload = JSON.parse(request.data);
137
+ expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}]);
138
+ });
139
+
140
+ it('sends bidfloor param if present', function () {
141
+ bidRequests[0].params.bidFloor = 0.05;
142
+ const request = spec.buildRequests(bidRequests);
143
+ const payload = JSON.parse(request.data);
144
+ expect(payload.imp[0].bidfloor).to.equal(0.05);
145
+ });
146
+
147
+ it('sends tagid', function () {
148
+ const request = spec.buildRequests(bidRequests);
149
+ const payload = JSON.parse(request.data);
150
+ expect(payload.imp[0].tagid).to.equal('adunit-code');
151
+ });
152
+
153
+ it('sends publisher id', function () {
154
+ const request = spec.buildRequests(bidRequests);
155
+ const payload = JSON.parse(request.data);
156
+ expect(payload.site.publisher.id).to.equal(1234567);
157
+ });
158
+
159
+ it('sends gdpr info if exists', function () {
160
+ const consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
161
+ const bidderRequest = {
162
+ 'bidderCode': 'bcmssp',
163
+ 'auctionId': '1d1a030790a437',
164
+ 'bidderRequestId': '22edbae2744bf5',
165
+ 'timeout': 3000,
166
+ gdprConsent: {
167
+ consentString: consentString,
168
+ gdprApplies: true
169
+ },
170
+ refererInfo: {
171
+ page: 'http://example.com/page.html',
172
+ domain: 'example.com',
173
+ }
174
+ };
175
+ bidderRequest.bids = bidRequests;
176
+
177
+ const data = JSON.parse(spec.buildRequests(bidRequests, bidderRequest).data);
178
+
179
+ expect(data.regs.ext.gdpr).to.exist.and.to.be.a('number');
180
+ expect(data.regs.ext.gdpr).to.equal(1);
181
+ expect(data.user.ext.consent).to.exist.and.to.be.a('string');
182
+ expect(data.user.ext.consent).to.equal(consentString);
183
+ });
184
+
185
+ it('sends us_privacy', function () {
186
+ const bidderRequest = {
187
+ uspConsent: '1YYY'
188
+ };
189
+ const data = JSON.parse(spec.buildRequests(bidRequests, bidderRequest).data)
190
+
191
+ expect(data.regs).to.not.equal(null);
192
+ expect(data.regs.ext).to.not.equal(null);
193
+ expect(data.regs.ext.us_privacy).to.equal('1YYY');
194
+ });
195
+
196
+ it('sends coppa', function () {
197
+ sandbox.stub(config, 'getConfig').withArgs('coppa').returns(true);
198
+
199
+ const data = JSON.parse(spec.buildRequests(bidRequests).data)
200
+ expect(data.regs).to.not.be.undefined;
201
+ expect(data.regs.coppa).to.equal(1);
202
+ });
203
+
204
+ it('sends schain', function () {
205
+ const data = JSON.parse(spec.buildRequests(bidRequests).data);
206
+ expect(data).to.not.be.undefined;
207
+ expect(data.source).to.not.be.undefined;
208
+ expect(data.source.ext).to.not.be.undefined;
209
+ expect(data.source.ext.schain).to.not.be.undefined;
210
+ expect(data.source.ext.schain.complete).to.equal(1);
211
+ expect(data.source.ext.schain.ver).to.equal('1.0');
212
+ expect(data.source.ext.schain.nodes).to.not.be.undefined;
213
+ expect(data.source.ext.schain.nodes).to.lengthOf(1);
214
+ expect(data.source.ext.schain.nodes[0].asi).to.equal('exchange1.com');
215
+ expect(data.source.ext.schain.nodes[0].sid).to.equal('1234');
216
+ expect(data.source.ext.schain.nodes[0].hp).to.equal(1);
217
+ expect(data.source.ext.schain.nodes[0].rid).to.equal('bid-request-1');
218
+ expect(data.source.ext.schain.nodes[0].name).to.equal('publisher');
219
+ expect(data.source.ext.schain.nodes[0].domain).to.equal('publisher.com');
220
+ });
221
+
222
+ it('sends user eid parameters', function () {
223
+ bidRequests[0].userIdAsEids = [{
224
+ source: 'pubcid.org',
225
+ uids: [{
226
+ id: 'userid_pubcid'
227
+ }]
228
+ }, {
229
+ source: 'adserver.org',
230
+ uids: [{
231
+ id: 'userid_ttd',
232
+ ext: {
233
+ rtiPartner: 'TDID'
234
+ }
235
+ }]
236
+ }
237
+ ];
238
+
239
+ const data = JSON.parse(spec.buildRequests(bidRequests).data);
240
+
241
+ expect(data.user).to.not.be.undefined;
242
+ expect(data.user.ext).to.not.be.undefined;
243
+ expect(data.user.ext.eids).to.not.be.undefined;
244
+ expect(data.user.ext.eids).to.deep.equal(bidRequests[0].userIdAsEids);
245
+ });
246
+
247
+ it('sends user id parameters', function () {
248
+ const userId = {
249
+ sharedid: {
250
+ id: '01*******',
251
+ third: '01E*******'
252
+ }
253
+ };
254
+
255
+ bidRequests[0].userId = userId;
256
+
257
+ const data = JSON.parse(spec.buildRequests(bidRequests).data);
258
+ expect(data.user).to.not.be.undefined;
259
+ expect(data.user.ext).to.not.be.undefined;
260
+ expect(data.user.ext.ids).is.deep.equal(userId);
261
+ });
262
+
263
+ context('when element is fully in view', function() {
264
+ it('returns 100', function() {
265
+ Object.assign(element, { width: 600, height: 400 });
266
+ const request = spec.buildRequests(bidRequests);
267
+ const payload = JSON.parse(request.data);
268
+ expect(payload.imp[0].banner.ext.viewability).to.equal(100);
269
+ });
270
+ });
271
+
272
+ context('when element is out of view', function() {
273
+ it('returns 0', function() {
274
+ Object.assign(element, { x: -300, y: 0, width: 207, height: 320 });
275
+ const request = spec.buildRequests(bidRequests);
276
+ const payload = JSON.parse(request.data);
277
+ expect(payload.imp[0].banner.ext.viewability).to.equal(0);
278
+ });
279
+ });
280
+
281
+ context('when element is partially in view', function() {
282
+ it('returns percentage', function() {
283
+ Object.assign(element, { width: 800, height: 800 });
284
+ const request = spec.buildRequests(bidRequests);
285
+ const payload = JSON.parse(request.data);
286
+ expect(payload.imp[0].banner.ext.viewability).to.equal(75);
287
+ });
288
+ });
289
+
290
+ context('when width or height of the element is zero', function() {
291
+ it('try to use alternative values', function() {
292
+ Object.assign(element, { width: 0, height: 0 });
293
+ bidRequests[0].mediaTypes.banner.sizes = [[800, 2400]];
294
+ const request = spec.buildRequests(bidRequests);
295
+ const payload = JSON.parse(request.data);
296
+ expect(payload.imp[0].banner.ext.viewability).to.equal(25);
297
+ });
298
+ });
299
+
300
+ context('when nested iframes', function() {
301
+ it('returns \'na\'', function() {
302
+ Object.assign(element, { width: 600, height: 400 });
303
+
304
+ utils.getWindowTop.restore();
305
+ utils.getWindowSelf.restore();
306
+ sandbox.stub(utils, 'getWindowTop').returns(win);
307
+ sandbox.stub(utils, 'getWindowSelf').returns({});
308
+
309
+ const request = spec.buildRequests(bidRequests);
310
+ const payload = JSON.parse(request.data);
311
+ expect(payload.imp[0].banner.ext.viewability).to.equal('na');
312
+ });
313
+ });
314
+
315
+ context('when tab is inactive', function() {
316
+ it('returns 0', function() {
317
+ Object.assign(element, { width: 600, height: 400 });
318
+
319
+ utils.getWindowTop.restore();
320
+ win.document.visibilityState = 'hidden';
321
+ sandbox.stub(utils, 'getWindowTop').returns(win);
322
+
323
+ const request = spec.buildRequests(bidRequests);
324
+ const payload = JSON.parse(request.data);
325
+ expect(payload.imp[0].banner.ext.viewability).to.equal(0);
326
+ });
327
+ });
328
+ });
329
+
330
+ describe('interpretResponse', function () {
331
+ let response;
332
+ beforeEach(function () {
333
+ response = {
334
+ body: {
335
+ 'id': '37386aade21a71',
336
+ 'seatbid': [{
337
+ 'bid': [{
338
+ 'id': '376874781',
339
+ 'impid': '283a9f4cd2415d',
340
+ 'price': 0.35743275,
341
+ 'nurl': '<!-- NURL -->',
342
+ 'adm': '<!-- Creative -->',
343
+ 'w': 300,
344
+ 'h': 250,
345
+ 'adomain': ['example.com']
346
+ }]
347
+ }]
348
+ }
349
+ };
350
+ });
351
+
352
+ it('should get the correct bid response', function () {
353
+ let expectedResponse = [{
354
+ 'requestId': '283a9f4cd2415d',
355
+ 'cpm': 0.35743275,
356
+ 'width': 300,
357
+ 'height': 250,
358
+ 'creativeId': '376874781',
359
+ 'currency': 'USD',
360
+ 'netRevenue': true,
361
+ 'mediaType': 'banner',
362
+ 'ad': `<!-- Creative --><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="${encodeURI('<!-- NURL -->')}"></div>`,
363
+ 'ttl': 60,
364
+ 'meta': {
365
+ 'advertiserDomains': ['example.com']
366
+ }
367
+ }];
368
+
369
+ let result = spec.interpretResponse(response);
370
+ expect(result[0]).to.deep.equal(expectedResponse[0]);
371
+ });
372
+
373
+ it('crid should default to the bid id if not on the response', function () {
374
+ let expectedResponse = [{
375
+ 'requestId': '283a9f4cd2415d',
376
+ 'cpm': 0.35743275,
377
+ 'width': 300,
378
+ 'height': 250,
379
+ 'creativeId': response.body.seatbid[0].bid[0].id,
380
+ 'currency': 'USD',
381
+ 'netRevenue': true,
382
+ 'mediaType': 'banner',
383
+ 'ad': `<!-- Creative --><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="${encodeURI('<!-- NURL -->')}"></div>`,
384
+ 'ttl': 60,
385
+ 'meta': {
386
+ 'advertiserDomains': ['example.com']
387
+ }
388
+ }];
389
+
390
+ let result = spec.interpretResponse(response);
391
+ expect(result[0]).to.deep.equal(expectedResponse[0]);
392
+ });
393
+
394
+ it('handles empty bid response', function () {
395
+ let response = {
396
+ body: ''
397
+ };
398
+ let result = spec.interpretResponse(response);
399
+ expect(result.length).to.equal(0);
400
+ });
401
+ });
402
+
403
+ describe('getUserSyncs ', () => {
404
+ let syncOptions = {iframeEnabled: true, pixelEnabled: true};
405
+
406
+ it('should not return', () => {
407
+ let returnStatement = spec.getUserSyncs(syncOptions, []);
408
+ expect(returnStatement).to.be.empty;
409
+ });
410
+ });
411
+ });