prebid.js 8.3.0 → 8.4.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 (203) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/admanBidAdapter.js +1 -1
  7. package/dist/adqueryBidAdapter.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/ajaBidAdapter.js +1 -1
  13. package/dist/amxBidAdapter.js +1 -1
  14. package/dist/amxIdSystem.js +1 -1
  15. package/dist/appierAnalyticsAdapter.js +1 -1
  16. package/dist/appnexusBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/bidglassBidAdapter.js +1 -1
  20. package/dist/big-richmediaBidAdapter.js +1 -1
  21. package/dist/brandmetricsRtdProvider.js +1 -1
  22. package/dist/bridBidAdapter.js +1 -1
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/carodaBidAdapter.js +1 -1
  26. package/dist/chtnwBidAdapter.js +1 -1
  27. package/dist/concertBidAdapter.js +1 -1
  28. package/dist/connectadBidAdapter.js +1 -1
  29. package/dist/consumableBidAdapter.js +1 -1
  30. package/dist/conversantAnalyticsAdapter.js +1 -1
  31. package/dist/conversantBidAdapter.js +1 -1
  32. package/dist/craftBidAdapter.js +1 -1
  33. package/dist/criteoBidAdapter.js +1 -1
  34. package/dist/cwireBidAdapter.js +1 -1
  35. package/dist/dependencies.json +3 -0
  36. package/dist/dspxBidAdapter.js +1 -1
  37. package/dist/eplanningBidAdapter.js +1 -1
  38. package/dist/euidIdSystem.js +1 -1
  39. package/dist/feedadBidAdapter.js +1 -1
  40. package/dist/finativeBidAdapter.js +1 -1
  41. package/dist/freewheel-sspBidAdapter.js +1 -1
  42. package/dist/gdprEnforcement.js +1 -1
  43. package/dist/gmosspBidAdapter.js +1 -1
  44. package/dist/goldbachBidAdapter.js +1 -1
  45. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  46. package/dist/greenbidsRtdProvider.js +1 -1
  47. package/dist/gridBidAdapter.js +1 -1
  48. package/dist/gumgumBidAdapter.js +1 -1
  49. package/dist/h12mediaBidAdapter.js +1 -1
  50. package/dist/hypelabBidAdapter.js +1 -1
  51. package/dist/id5IdSystem.js +1 -1
  52. package/dist/imdsBidAdapter.js +1 -1
  53. package/dist/improvedigitalBidAdapter.js +1 -1
  54. package/dist/insticatorBidAdapter.js +1 -1
  55. package/dist/ixBidAdapter.js +1 -1
  56. package/dist/justpremiumBidAdapter.js +1 -1
  57. package/dist/kargoBidAdapter.js +1 -1
  58. package/dist/konduitAnalyticsAdapter.js +1 -1
  59. package/dist/kueezBidAdapter.js +1 -1
  60. package/dist/kueezRtbBidAdapter.js +1 -1
  61. package/dist/kulturemediaBidAdapter.js +1 -1
  62. package/dist/lassoBidAdapter.js +1 -1
  63. package/dist/lifestreetBidAdapter.js +1 -1
  64. package/dist/logicadBidAdapter.js +1 -1
  65. package/dist/loglyliftBidAdapter.js +1 -1
  66. package/dist/magniteAnalyticsAdapter.js +1 -1
  67. package/dist/malltvAnalyticsAdapter.js +1 -1
  68. package/dist/marsmediaBidAdapter.js +1 -1
  69. package/dist/mediafuseBidAdapter.js +1 -1
  70. package/dist/mediasquareBidAdapter.js +1 -1
  71. package/dist/mgidBidAdapter.js +1 -1
  72. package/dist/minutemediaBidAdapter.js +1 -1
  73. package/dist/minutemediaplusBidAdapter.js +1 -1
  74. package/dist/nexx360BidAdapter.js +1 -1
  75. package/dist/not-for-prod/prebid.js +135 -135
  76. package/dist/oguryBidAdapter.js +1 -1
  77. package/dist/onetagBidAdapter.js +1 -1
  78. package/dist/ooloAnalyticsAdapter.js +1 -1
  79. package/dist/optidigitalBidAdapter.js +1 -1
  80. package/dist/outbrainBidAdapter.js +1 -1
  81. package/dist/parrableIdSystem.js +1 -1
  82. package/dist/pixfutureBidAdapter.js +1 -1
  83. package/dist/prebid-core.js +2 -2
  84. package/dist/publinkIdSystem.js +1 -1
  85. package/dist/pubmaticBidAdapter.js +1 -1
  86. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  87. package/dist/pulsepointBidAdapter.js +1 -1
  88. package/dist/pxyzBidAdapter.js +1 -1
  89. package/dist/quantcastBidAdapter.js +1 -1
  90. package/dist/readpeakBidAdapter.js +1 -1
  91. package/dist/relaidoBidAdapter.js +1 -1
  92. package/dist/retailspotBidAdapter.js +1 -1
  93. package/dist/rhythmoneBidAdapter.js +1 -1
  94. package/dist/riseBidAdapter.js +1 -1
  95. package/dist/rubiconBidAdapter.js +1 -1
  96. package/dist/seedingAllianceBidAdapter.js +1 -1
  97. package/dist/seedtagBidAdapter.js +1 -1
  98. package/dist/sharedIdSystem.js +1 -1
  99. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  100. package/dist/sharethroughBidAdapter.js +1 -1
  101. package/dist/shinezBidAdapter.js +1 -1
  102. package/dist/smaatoBidAdapter.js +1 -1
  103. package/dist/smartadserverBidAdapter.js +1 -1
  104. package/dist/smartxBidAdapter.js +1 -1
  105. package/dist/smilewantedBidAdapter.js +1 -1
  106. package/dist/sonobiBidAdapter.js +1 -1
  107. package/dist/sovrnAnalyticsAdapter.js +1 -1
  108. package/dist/sovrnBidAdapter.js +1 -1
  109. package/dist/sspBCBidAdapter.js +1 -1
  110. package/dist/stroeerCoreBidAdapter.js +1 -1
  111. package/dist/stvBidAdapter.js +1 -1
  112. package/dist/sublimeBidAdapter.js +1 -1
  113. package/dist/targetVideoBidAdapter.js +1 -1
  114. package/dist/teadsBidAdapter.js +1 -1
  115. package/dist/topicsFpdModule.js +1 -1
  116. package/dist/trionBidAdapter.js +1 -1
  117. package/dist/tripleliftBidAdapter.js +1 -1
  118. package/dist/ttdBidAdapter.js +1 -1
  119. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  120. package/dist/uid2IdSystem.js +1 -1
  121. package/dist/underdogmediaBidAdapter.js +1 -1
  122. package/dist/undertoneBidAdapter.js +1 -1
  123. package/dist/userId.js +1 -1
  124. package/dist/vidazooBidAdapter.js +1 -1
  125. package/dist/videobyteBidAdapter.js +1 -1
  126. package/dist/visxBidAdapter.js +1 -1
  127. package/dist/voxBidAdapter.js +1 -1
  128. package/dist/vuukleBidAdapter.js +1 -1
  129. package/dist/widespaceBidAdapter.js +1 -1
  130. package/dist/winrBidAdapter.js +1 -1
  131. package/dist/yahoosspBidAdapter.js +1 -1
  132. package/dist/yandexBidAdapter.js +1 -1
  133. package/dist/yieldmoBidAdapter.js +1 -1
  134. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  135. package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +1 -1
  136. package/integrationExamples/videoModule/jwplayer/eventListeners.html +2 -2
  137. package/integrationExamples/videoModule/jwplayer/eventsUI.html +1 -1
  138. package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +1 -1
  139. package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +1 -1
  140. package/integrationExamples/videoModule/jwplayer/playlist.html +1 -1
  141. package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +1 -1
  142. package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +1 -1
  143. package/integrationExamples/videoModule/videojs/eventListeners.html +1 -1
  144. package/integrationExamples/videoModule/videojs/eventsUI.html +1 -1
  145. package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +1 -1
  146. package/integrationExamples/videoModule/videojs/mediaMetadata.html +1 -1
  147. package/integrationExamples/videoModule/videojs/playlist.html +1 -1
  148. package/modules/33acrossBidAdapter.js +24 -14
  149. package/modules/33acrossIdSystem.js +15 -4
  150. package/modules/adagioBidAdapter.js +0 -1
  151. package/modules/admanBidAdapter.js +4 -0
  152. package/modules/brandmetricsRtdProvider.js +36 -2
  153. package/modules/brandmetricsRtdProvider.md +17 -2
  154. package/modules/gdprEnforcement.js +27 -22
  155. package/modules/gridBidAdapter.js +19 -0
  156. package/modules/ixBidAdapter.js +40 -2
  157. package/modules/kargoBidAdapter.js +4 -0
  158. package/modules/minutemediaBidAdapter.js +17 -2
  159. package/modules/oguryBidAdapter.js +29 -16
  160. package/modules/pubmaticBidAdapter.js +16 -1
  161. package/modules/pulsepointBidAdapter.js +63 -424
  162. package/modules/pulsepointBidAdapter.md +39 -45
  163. package/modules/sharedIdSystem.js +1 -1
  164. package/modules/sovrnBidAdapter.js +5 -1
  165. package/modules/stroeerCoreBidAdapter.js +2 -3
  166. package/modules/teadsBidAdapter.js +2 -0
  167. package/modules/topicsFpdModule.js +4 -1
  168. package/modules/topicsFpdModule.md +4 -0
  169. package/modules/userId/index.js +2 -2
  170. package/modules/vidazooBidAdapter.js +5 -7
  171. package/modules/voxBidAdapter.js +16 -5
  172. package/modules/yahoosspBidAdapter.js +38 -33
  173. package/modules/yahoosspBidAdapter.md +96 -95
  174. package/modules/yandexBidAdapter.js +12 -15
  175. package/package.json +1 -1
  176. package/src/activities/redactor.js +1 -1
  177. package/src/auction.js +24 -2
  178. package/src/constants.json +3 -1
  179. package/src/fpd/sua.js +8 -2
  180. package/test/spec/auctionmanager_spec.js +29 -1
  181. package/test/spec/fpd/enrichment_spec.js +7 -1
  182. package/test/spec/fpd/sua_spec.js +12 -0
  183. package/test/spec/modules/33acrossBidAdapter_spec.js +188 -35
  184. package/test/spec/modules/33acrossIdSystem_spec.js +122 -27
  185. package/test/spec/modules/adagioBidAdapter_spec.js +0 -1
  186. package/test/spec/modules/brandmetricsRtdProvider_spec.js +69 -7
  187. package/test/spec/modules/gdprEnforcement_spec.js +43 -2
  188. package/test/spec/modules/gridBidAdapter_spec.js +42 -0
  189. package/test/spec/modules/ixBidAdapter_spec.js +72 -0
  190. package/test/spec/modules/kargoBidAdapter_spec.js +121 -106
  191. package/test/spec/modules/minutemediaBidAdapter_spec.js +36 -5
  192. package/test/spec/modules/oguryBidAdapter_spec.js +208 -108
  193. package/test/spec/modules/pubmaticBidAdapter_spec.js +119 -0
  194. package/test/spec/modules/pulsepointBidAdapter_spec.js +225 -486
  195. package/test/spec/modules/sovrnBidAdapter_spec.js +24 -4
  196. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +8 -5
  197. package/test/spec/modules/teadsBidAdapter_spec.js +70 -21
  198. package/test/spec/modules/topicsFpdModule_spec.js +10 -4
  199. package/test/spec/modules/vidazooBidAdapter_spec.js +0 -5
  200. package/test/spec/modules/voxBidAdapter_spec.js +93 -0
  201. package/test/spec/modules/yahoosspBidAdapter_spec.js +402 -314
  202. package/test/spec/modules/yandexBidAdapter_spec.js +21 -3
  203. package/integrationExamples/gpt/inskin_example.html +0 -100
@@ -1,7 +1,8 @@
1
1
  /* eslint dot-notation:0, quote-props:0 */
2
2
  import {expect} from 'chai';
3
3
  import {spec} from 'modules/pulsepointBidAdapter.js';
4
- import {deepClone} from 'src/utils.js';
4
+ import {syncAddFPDToBidderRequest} from '../../helpers/fpd.js';
5
+ import {deepClone} from '../../../src/utils';
5
6
 
6
7
  describe('PulsePoint Adapter Tests', function () {
7
8
  const slotConfigs = [{
@@ -31,39 +32,52 @@ describe('PulsePoint Adapter Tests', function () {
31
32
  cf: '728x90'
32
33
  }
33
34
  }];
35
+ const nativeOrtbRequest = {
36
+ assets: [{
37
+ id: 1,
38
+ required: 1,
39
+ img: {
40
+ type: 3,
41
+ w: 150,
42
+ h: 50,
43
+ }
44
+ },
45
+ {
46
+ id: 2,
47
+ required: 1,
48
+ title: {
49
+ len: 80
50
+ }
51
+ },
52
+ {
53
+ id: 3,
54
+ required: 0,
55
+ data: {
56
+ type: 1
57
+ }
58
+ }]
59
+ };
34
60
  const nativeSlotConfig = [{
35
61
  placementCode: '/DfpAccount1/slot3',
36
62
  bidId: 'bid12345',
37
- nativeParams: {
38
- title: { required: true, len: 200 },
39
- image: { wmin: 100 },
40
- sponsoredBy: { }
63
+ mediaTypes: {
64
+ native: {
65
+ sendTargetingKeys: false,
66
+ ortb: nativeOrtbRequest
67
+ }
41
68
  },
69
+ nativeOrtbRequest,
42
70
  params: {
43
71
  cp: 'p10000',
44
72
  ct: 't10000'
45
73
  }
46
74
  }];
47
- const appSlotConfig = [{
48
- placementCode: '/DfpAccount1/slot3',
49
- bidId: 'bid12345',
50
- params: {
51
- cp: 'p10000',
52
- ct: 't10000',
53
- app: {
54
- bundle: 'com.pulsepoint.apps',
55
- storeUrl: 'https://pulsepoint.com/apps',
56
- domain: 'pulsepoint.com',
57
- }
58
- }
59
- }];
60
75
  const videoSlotConfig = [{
61
76
  placementCode: '/DfpAccount1/slotVideo',
62
77
  bidId: 'bid12345',
63
- params: {
64
- cp: 'p10000',
65
- ct: 't10000',
78
+ mediaTypes: {
66
79
  video: {
80
+ playerSize: [400, 300],
67
81
  w: 400,
68
82
  h: 300,
69
83
  minduration: 5,
@@ -73,6 +87,10 @@ describe('PulsePoint Adapter Tests', function () {
73
87
  minbitrate: 200,
74
88
  protocols: [1, 2, 4]
75
89
  }
90
+ },
91
+ params: {
92
+ cp: 'p10000',
93
+ ct: 't10000'
76
94
  }
77
95
  }];
78
96
  const additionalParamsConfig = [{
@@ -97,68 +115,6 @@ describe('PulsePoint Adapter Tests', function () {
97
115
  }
98
116
  }];
99
117
 
100
- const ortbParamsSlotConfig = [{
101
- placementCode: '/DfpAccount1/slot1',
102
- mediaTypes: {
103
- banner: {
104
- sizes: [[1, 1]]
105
- }
106
- },
107
- bidId: 'bid12345',
108
- params: {
109
- cp: 'p10000',
110
- ct: 't10000',
111
- cf: '1x1',
112
- bcat: ['IAB-1', 'IAB-20'],
113
- battr: [1, 2, 3],
114
- bidfloor: 1.5,
115
- badv: ['cocacola.com', 'lays.com']
116
- }
117
- }, {
118
- placementCode: '/DfpAccount1/slotVideo',
119
- bidId: 'bid12345',
120
- params: {
121
- cp: 'p10000',
122
- ct: 't10000',
123
- video: {
124
- w: 400,
125
- h: 300,
126
- minduration: 5,
127
- maxduration: 10,
128
- },
129
- battr: [2, 3, 4],
130
- bidfloor: 2.5,
131
- }
132
- }];
133
-
134
- const outstreamSlotConfig = [{
135
- placementCode: '/DfpAccount1/slot1',
136
- mediaTypes: {
137
- video: {
138
- playerSize: [640, 480],
139
- context: 'outstream'
140
- }
141
- },
142
- bidId: 'bid12345',
143
- params: {
144
- cp: 'p10000',
145
- ct: 't10000',
146
- cf: '1x1',
147
- video: {
148
- h: 300,
149
- w: 400,
150
- minduration: 1,
151
- maxduration: 210,
152
- linearity: 1,
153
- }
154
- },
155
- renderer: {
156
- options: {
157
- text: 'PulsePoint Outstream'
158
- }
159
- }
160
- }];
161
-
162
118
  const schainParamsSlotConfig = [{
163
119
  placementCode: '/DfpAccount1/slot1',
164
120
  mediaTypes: {
@@ -200,7 +156,7 @@ describe('PulsePoint Adapter Tests', function () {
200
156
  };
201
157
 
202
158
  it('Verify build request', function () {
203
- const request = spec.buildRequests(slotConfigs, bidderRequest);
159
+ const request = spec.buildRequests(slotConfigs, syncAddFPDToBidderRequest(bidderRequest));
204
160
  expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
205
161
  expect(request.method).to.equal('POST');
206
162
  const ortbRequest = request.data;
@@ -208,7 +164,6 @@ describe('PulsePoint Adapter Tests', function () {
208
164
  expect(ortbRequest.site).to.not.equal(null);
209
165
  expect(ortbRequest.site.publisher).to.not.equal(null);
210
166
  expect(ortbRequest.site.publisher.id).to.equal('p10000');
211
- expect(ortbRequest.site.ref).to.equal(bidderRequest.refererInfo.ref);
212
167
  expect(ortbRequest.site.page).to.equal('https://publisher.com/home');
213
168
  expect(ortbRequest.imp).to.have.lengthOf(2);
214
169
  // device object
@@ -217,19 +172,15 @@ describe('PulsePoint Adapter Tests', function () {
217
172
  // slot 1
218
173
  expect(ortbRequest.imp[0].tagid).to.equal('t10000');
219
174
  expect(ortbRequest.imp[0].banner).to.not.equal(null);
220
- expect(ortbRequest.imp[0].banner.w).to.equal(300);
221
- expect(ortbRequest.imp[0].banner.h).to.equal(250);
175
+ expect(ortbRequest.imp[0].banner.format).to.deep.eq([{'w': 728, 'h': 90}, {'w': 160, 'h': 600}]);
222
176
  // slot 2
223
177
  expect(ortbRequest.imp[1].tagid).to.equal('t20000');
224
178
  expect(ortbRequest.imp[1].banner).to.not.equal(null);
225
- expect(ortbRequest.imp[1].banner.w).to.equal(728);
226
- expect(ortbRequest.imp[1].banner.h).to.equal(90);
227
- // tmax
228
- expect(ortbRequest.tmax).to.equal(500);
179
+ expect(ortbRequest.imp[1].banner.format).to.deep.eq([{'w': 728, 'h': 90}]);
229
180
  });
230
181
 
231
182
  it('Verify parse response', function () {
232
- const request = spec.buildRequests(slotConfigs, bidderRequest);
183
+ const request = spec.buildRequests(slotConfigs, syncAddFPDToBidderRequest(bidderRequest));
233
184
  const ortbRequest = request.data;
234
185
  const ortbResponse = {
235
186
  seatbid: [{
@@ -237,11 +188,16 @@ describe('PulsePoint Adapter Tests', function () {
237
188
  impid: ortbRequest.imp[0].id,
238
189
  price: 1.25,
239
190
  adm: 'This is an Ad',
240
- crid: 'Creative#123'
191
+ crid: 'Creative#123',
192
+ mtype: 1,
193
+ w: 300,
194
+ h: 250,
195
+ exp: 20,
196
+ adomain: ['advertiser.com']
241
197
  }]
242
198
  }]
243
199
  };
244
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
200
+ const bids = spec.interpretResponse({body: ortbResponse}, request);
245
201
  expect(bids).to.have.lengthOf(1);
246
202
  // verify first bid
247
203
  const bid = bids[0];
@@ -249,140 +205,112 @@ describe('PulsePoint Adapter Tests', function () {
249
205
  expect(bid.ad).to.equal('This is an Ad');
250
206
  expect(bid.width).to.equal(300);
251
207
  expect(bid.height).to.equal(250);
252
- expect(bid.adId).to.equal('bid12345');
253
208
  expect(bid.creative_id).to.equal('Creative#123');
254
209
  expect(bid.creativeId).to.equal('Creative#123');
255
210
  expect(bid.netRevenue).to.equal(true);
256
211
  expect(bid.currency).to.equal('USD');
257
212
  expect(bid.ttl).to.equal(20);
258
- });
259
-
260
- it('Verify ttl/currency/adomain applied to bid', function () {
261
- const request = spec.buildRequests(slotConfigs, bidderRequest);
262
- const ortbRequest = request.data;
263
- const ortbResponse = {
264
- seatbid: [{
265
- bid: [{
266
- impid: ortbRequest.imp[0].id,
267
- price: 1.25,
268
- adm: 'This is an Ad#1',
269
- crid: 'Creative#123',
270
- exp: 50,
271
- adomain: ['advertiser.com']
272
- }, {
273
- impid: ortbRequest.imp[1].id,
274
- price: 1.25,
275
- adm: 'This is an Ad#2',
276
- crid: 'Creative#123'
277
- }]
278
- }],
279
- cur: 'GBP'
280
- };
281
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
282
- expect(bids).to.have.lengthOf(2);
283
- // verify first bid
284
- const bid = bids[0];
285
- expect(bid.cpm).to.equal(1.25);
286
- expect(bid.ad).to.equal('This is an Ad#1');
287
- expect(bid.ttl).to.equal(50);
288
- expect(bid.currency).to.equal('GBP');
289
213
  expect(bid.meta).to.not.be.null;
290
214
  expect(bid.meta.advertiserDomains).to.eql(['advertiser.com']);
291
- const secondBid = bids[1];
292
- expect(secondBid.cpm).to.equal(1.25);
293
- expect(secondBid.ad).to.equal('This is an Ad#2');
294
- expect(secondBid.ttl).to.equal(20);
295
- expect(secondBid.currency).to.equal('GBP');
296
- expect(secondBid.meta).to.not.be.null;
297
- expect(secondBid.meta.advertiserDomains).to.eql([]);
298
215
  });
299
216
 
300
217
  it('Verify full passback', function () {
301
218
  const request = spec.buildRequests(slotConfigs, bidderRequest);
302
- const bids = spec.interpretResponse({ body: null }, request)
219
+ const bids = spec.interpretResponse({body: null}, request)
303
220
  expect(bids).to.have.lengthOf(0);
304
221
  });
305
222
 
306
- it('Verify Native request', function () {
307
- const request = spec.buildRequests(nativeSlotConfig, bidderRequest);
308
- expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
309
- expect(request.method).to.equal('POST');
310
- const ortbRequest = request.data;
311
- // native impression
312
- expect(ortbRequest.imp[0].tagid).to.equal('t10000');
313
- expect(ortbRequest.imp[0].banner).to.equal(null);
314
- const nativePart = ortbRequest.imp[0]['native'];
315
- expect(nativePart).to.not.equal(null);
316
- expect(nativePart.ver).to.equal('1.1');
317
- expect(nativePart.request).to.not.equal(null);
318
- // native request assets
319
- const nativeRequest = JSON.parse(ortbRequest.imp[0]['native'].request);
320
- expect(nativeRequest).to.not.equal(null);
321
- expect(nativeRequest.assets).to.have.lengthOf(3);
322
- // title asset
323
- expect(nativeRequest.assets[0].id).to.equal(1);
324
- expect(nativeRequest.assets[0].required).to.equal(1);
325
- expect(nativeRequest.assets[0].title).to.not.equal(null);
326
- expect(nativeRequest.assets[0].title.len).to.equal(200);
327
- // data asset
328
- expect(nativeRequest.assets[1].id).to.equal(2);
329
- expect(nativeRequest.assets[1].required).to.equal(0);
330
- expect(nativeRequest.assets[1].title).to.be.undefined;
331
- expect(nativeRequest.assets[1].data).to.not.equal(null);
332
- expect(nativeRequest.assets[1].data.type).to.equal(1);
333
- expect(nativeRequest.assets[1].data.len).to.equal(50);
334
- // image asset
335
- expect(nativeRequest.assets[2].id).to.equal(3);
336
- expect(nativeRequest.assets[2].required).to.equal(0);
337
- expect(nativeRequest.assets[2].title).to.be.undefined;
338
- expect(nativeRequest.assets[2].img).to.not.equal(null);
339
- expect(nativeRequest.assets[2].img.wmin).to.equal(100);
340
- expect(nativeRequest.assets[2].img.hmin).to.equal(150);
341
- expect(nativeRequest.assets[2].img.type).to.equal(3);
342
- });
223
+ if (FEATURES.NATIVE) {
224
+ it('Verify Native request', function () {
225
+ const request = spec.buildRequests(nativeSlotConfig, syncAddFPDToBidderRequest(bidderRequest));
226
+ expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
227
+ expect(request.method).to.equal('POST');
228
+ const ortbRequest = request.data;
229
+ // native impression
230
+ expect(ortbRequest.imp[0].tagid).to.equal('t10000');
231
+ expect(ortbRequest.imp[0].banner).to.be.undefined;
232
+ const nativePart = ortbRequest.imp[0]['native'];
233
+ expect(nativePart).to.not.equal(null);
234
+ expect(nativePart.request).to.not.equal(null);
235
+ // native request assets
236
+ const nativeRequest = JSON.parse(ortbRequest.imp[0]['native'].request);
237
+ expect(nativeRequest).to.not.equal(null);
238
+ expect(nativeRequest.assets).to.have.lengthOf(3);
239
+ // image asset
240
+ expect(nativeRequest.assets[0].id).to.equal(1);
241
+ expect(nativeRequest.assets[0].required).to.equal(1);
242
+ expect(nativeRequest.assets[0].title).to.be.undefined;
243
+ expect(nativeRequest.assets[0].img).to.not.equal(null);
244
+ expect(nativeRequest.assets[0].img.w).to.equal(150);
245
+ expect(nativeRequest.assets[0].img.h).to.equal(50);
246
+ expect(nativeRequest.assets[0].img.type).to.equal(3);
247
+ // title asset
248
+ expect(nativeRequest.assets[1].id).to.equal(2);
249
+ expect(nativeRequest.assets[1].required).to.equal(1);
250
+ expect(nativeRequest.assets[1].title).to.not.equal(null);
251
+ expect(nativeRequest.assets[1].title.len).to.equal(80);
252
+ // data asset
253
+ expect(nativeRequest.assets[2].id).to.equal(3);
254
+ expect(nativeRequest.assets[2].required).to.equal(0);
255
+ expect(nativeRequest.assets[2].title).to.be.undefined;
256
+ expect(nativeRequest.assets[2].data).to.not.equal(null);
257
+ expect(nativeRequest.assets[2].data.type).to.equal(1);
258
+ });
343
259
 
344
- it('Verify Native response', function () {
345
- const request = spec.buildRequests(nativeSlotConfig, bidderRequest);
346
- expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
347
- expect(request.method).to.equal('POST');
348
- const ortbRequest = request.data;
349
- const nativeResponse = {
350
- 'native': {
260
+ it('Verify Native response', function () {
261
+ const request = spec.buildRequests(nativeSlotConfig, syncAddFPDToBidderRequest(bidderRequest));
262
+ expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
263
+ expect(request.method).to.equal('POST');
264
+ const ortbRequest = request.data;
265
+ const nativeResponse = {
351
266
  assets: [
352
- { title: { text: 'Ad Title' } },
353
- { data: { type: 1, value: 'Sponsored By: Brand' } },
354
- { img: { type: 3, url: 'https://images.cdn.brand.com/123' } }
267
+ {id: 1, img: {type: 3, url: 'https://images.cdn.brand.com/123'}},
268
+ {id: 2, title: {text: 'Ad Title'}},
269
+ {id: 3, data: {type: 1, value: 'Sponsored By: Brand'}}
355
270
  ],
356
- link: { url: 'https://brand.clickme.com/' },
271
+ link: {url: 'https://brand.clickme.com/'},
357
272
  imptrackers: ['https://imp1.trackme.com/', 'https://imp1.contextweb.com/']
358
- }
359
- };
360
- const ortbResponse = {
361
- seatbid: [{
362
- bid: [{
363
- impid: ortbRequest.imp[0].id,
364
- price: 1.25,
365
- adm: JSON.stringify(nativeResponse)
273
+
274
+ };
275
+ const ortbResponse = {
276
+ seatbid: [{
277
+ bid: [{
278
+ impid: ortbRequest.imp[0].id,
279
+ price: 1.25,
280
+ adm: JSON.stringify(nativeResponse),
281
+ mtype: 4
282
+ }]
366
283
  }]
367
- }]
368
- };
369
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
370
- // verify bid
371
- const bid = bids[0];
372
- expect(bid.cpm).to.equal(1.25);
373
- expect(bid.adId).to.equal('bid12345');
374
- expect(bid.ad).to.be.undefined;
375
- expect(bid.mediaType).to.equal('native');
376
- const nativeBid = bid['native'];
377
- expect(nativeBid).to.not.equal(null);
378
- expect(nativeBid.title).to.equal('Ad Title');
379
- expect(nativeBid.sponsoredBy).to.equal('Sponsored By: Brand');
380
- expect(nativeBid.image).to.equal('https://images.cdn.brand.com/123');
381
- expect(nativeBid.clickUrl).to.equal(encodeURIComponent('https://brand.clickme.com/'));
382
- expect(nativeBid.impressionTrackers).to.have.lengthOf(2);
383
- expect(nativeBid.impressionTrackers[0]).to.equal('https://imp1.trackme.com/');
384
- expect(nativeBid.impressionTrackers[1]).to.equal('https://imp1.contextweb.com/');
385
- });
284
+ };
285
+ const bids = spec.interpretResponse({body: ortbResponse}, request);
286
+ // verify bid
287
+ const bid = bids[0];
288
+ expect(bid.cpm).to.equal(1.25);
289
+ expect(bid.requestId).to.equal('bid12345');
290
+ expect(bid.ad).to.be.undefined;
291
+ expect(bid.mediaType).to.equal('native');
292
+ expect(bid['native']).to.not.be.null;
293
+ expect(bid['native'].ortb).to.not.be.null;
294
+ const nativeBid = bid['native'].ortb;
295
+ expect(nativeBid.assets).to.have.lengthOf(3);
296
+ expect(nativeBid.assets[0].id).to.equal(1);
297
+ expect(nativeBid.assets[0].img).to.not.be.null;
298
+ expect(nativeBid.assets[0].img.type).to.equal(3);
299
+ expect(nativeBid.assets[0].img.url).to.equal('https://images.cdn.brand.com/123');
300
+ expect(nativeBid.assets[1].id).to.equal(2);
301
+ expect(nativeBid.assets[1].title).to.not.be.null;
302
+ expect(nativeBid.assets[1].title.text).to.equal('Ad Title');
303
+ expect(nativeBid.assets[2].id).to.equal(3);
304
+ expect(nativeBid.assets[2].data).to.not.be.null;
305
+ expect(nativeBid.assets[2].data.type).to.equal(1);
306
+ expect(nativeBid.assets[2].data.value).to.equal('Sponsored By: Brand');
307
+ expect(nativeBid.link).to.not.be.null;
308
+ expect(nativeBid.link.url).to.equal('https://brand.clickme.com/');
309
+ expect(nativeBid.imptrackers).to.have.lengthOf(2);
310
+ expect(nativeBid.imptrackers[0]).to.equal('https://imp1.trackme.com/');
311
+ expect(nativeBid.imptrackers[1]).to.equal('https://imp1.contextweb.com/');
312
+ });
313
+ }
386
314
 
387
315
  it('Verifies bidder code', function () {
388
316
  expect(spec.code).to.equal('pulsepoint');
@@ -430,19 +358,6 @@ describe('PulsePoint Adapter Tests', function () {
430
358
  expect(options[0].url).to.equal('https://bh.contextweb.com/visitormatch/prebid');
431
359
  });
432
360
 
433
- it('Verify app requests', function () {
434
- const request = spec.buildRequests(appSlotConfig, bidderRequest);
435
- const ortbRequest = request.data;
436
- // site object
437
- expect(ortbRequest.site).to.equal(null);
438
- expect(ortbRequest.app).to.not.be.null;
439
- expect(ortbRequest.app.publisher).to.not.equal(null);
440
- expect(ortbRequest.app.publisher.id).to.equal('p10000');
441
- expect(ortbRequest.app.bundle).to.equal('com.pulsepoint.apps');
442
- expect(ortbRequest.app.storeurl).to.equal('https://pulsepoint.com/apps');
443
- expect(ortbRequest.app.domain).to.equal('pulsepoint.com');
444
- });
445
-
446
361
  it('Verify GDPR', function () {
447
362
  const bidderRequestGdpr = {
448
363
  gdprConsent: {
@@ -450,7 +365,7 @@ describe('PulsePoint Adapter Tests', function () {
450
365
  consentString: 'serialized_gpdr_data'
451
366
  }
452
367
  };
453
- const request = spec.buildRequests(slotConfigs, Object.assign({}, bidderRequest, bidderRequestGdpr));
368
+ const request = spec.buildRequests(slotConfigs, syncAddFPDToBidderRequest(Object.assign({}, bidderRequest, bidderRequestGdpr)));
454
369
  expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
455
370
  expect(request.method).to.equal('POST');
456
371
  const ortbRequest = request.data;
@@ -468,7 +383,8 @@ describe('PulsePoint Adapter Tests', function () {
468
383
  const bidderRequestUSPrivacy = {
469
384
  uspConsent: '1YYY'
470
385
  };
471
- const request = spec.buildRequests(slotConfigs, Object.assign({}, bidderRequest, bidderRequestUSPrivacy));
386
+ const request = spec.buildRequests(slotConfigs,
387
+ syncAddFPDToBidderRequest(Object.assign({}, bidderRequest, bidderRequestUSPrivacy)));
472
388
  expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
473
389
  expect(request.method).to.equal('POST');
474
390
  const ortbRequest = request.data;
@@ -478,52 +394,54 @@ describe('PulsePoint Adapter Tests', function () {
478
394
  expect(ortbRequest.regs.ext.us_privacy).to.equal('1YYY');
479
395
  });
480
396
 
481
- it('Verify Video request', function () {
482
- const request = spec.buildRequests(videoSlotConfig, bidderRequest);
483
- expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
484
- expect(request.method).to.equal('POST');
485
- const ortbRequest = request.data;
486
- expect(ortbRequest).to.not.equal(null);
487
- expect(ortbRequest.imp).to.have.lengthOf(1);
488
- expect(ortbRequest.imp[0].video).to.not.be.null;
489
- expect(ortbRequest.imp[0].native).to.be.null;
490
- expect(ortbRequest.imp[0].banner).to.be.null;
491
- expect(ortbRequest.imp[0].video.w).to.equal(400);
492
- expect(ortbRequest.imp[0].video.h).to.equal(300);
493
- expect(ortbRequest.imp[0].video.minduration).to.equal(5);
494
- expect(ortbRequest.imp[0].video.maxduration).to.equal(10);
495
- expect(ortbRequest.imp[0].video.startdelay).to.equal(0);
496
- expect(ortbRequest.imp[0].video.skip).to.equal(1);
497
- expect(ortbRequest.imp[0].video.minbitrate).to.equal(200);
498
- expect(ortbRequest.imp[0].video.protocols).to.eql([1, 2, 4]);
499
- });
397
+ if (FEATURES.VIDEO) {
398
+ it('Verify Video request', function () {
399
+ const request = spec.buildRequests(videoSlotConfig, syncAddFPDToBidderRequest(bidderRequest));
400
+ expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
401
+ expect(request.method).to.equal('POST');
402
+ const ortbRequest = request.data;
403
+ expect(ortbRequest).to.not.equal(null);
404
+ expect(ortbRequest.imp).to.have.lengthOf(1);
405
+ expect(ortbRequest.imp[0].video).to.not.be.null;
406
+ expect(ortbRequest.imp[0].native).to.be.undefined;
407
+ expect(ortbRequest.imp[0].banner).to.be.undefined;
408
+ expect(ortbRequest.imp[0].video.w).to.equal(400);
409
+ expect(ortbRequest.imp[0].video.h).to.equal(300);
410
+ expect(ortbRequest.imp[0].video.minduration).to.equal(5);
411
+ expect(ortbRequest.imp[0].video.maxduration).to.equal(10);
412
+ expect(ortbRequest.imp[0].video.startdelay).to.equal(0);
413
+ expect(ortbRequest.imp[0].video.skip).to.equal(1);
414
+ expect(ortbRequest.imp[0].video.minbitrate).to.equal(200);
415
+ expect(ortbRequest.imp[0].video.protocols).to.eql([1, 2, 4]);
416
+ });
500
417
 
501
- it('Verify Video response', function () {
502
- const request = spec.buildRequests(videoSlotConfig, bidderRequest);
503
- expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
504
- expect(request.method).to.equal('POST');
505
- const ortbRequest = request.data;
506
- const ortbResponse = {
507
- seatbid: [{
508
- bid: [{
509
- impid: ortbRequest.imp[0].id,
510
- price: 1.25,
511
- adm: '<VAST><Creative>https//pulsepoint.video.mp4</Creative></VAST>'
418
+ it('Verify Video response', function () {
419
+ const request = spec.buildRequests(videoSlotConfig, bidderRequest);
420
+ expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
421
+ expect(request.method).to.equal('POST');
422
+ const ortbRequest = request.data;
423
+ const ortbResponse = {
424
+ seatbid: [{
425
+ bid: [{
426
+ impid: ortbRequest.imp[0].id,
427
+ price: 1.25,
428
+ adm: '<VAST><Creative>https//pulsepoint.video.mp4</Creative></VAST>',
429
+ mtype: 2
430
+ }]
512
431
  }]
513
- }]
514
- };
515
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
516
- const bid = bids[0];
517
- expect(bid.cpm).to.equal(1.25);
518
- expect(bid.adId).to.equal('bid12345');
519
- expect(bid.ad).to.be.undefined;
520
- expect(bid['native']).to.be.undefined;
521
- expect(bid.mediaType).to.equal('video');
522
- expect(bid.vastXml).to.equal(ortbResponse.seatbid[0].bid[0].adm);
523
- });
432
+ };
433
+ const bids = spec.interpretResponse({ body: ortbResponse }, request);
434
+ const bid = bids[0];
435
+ expect(bid.cpm).to.equal(1.25);
436
+ expect(bid.ad).to.be.undefined;
437
+ expect(bid['native']).to.be.undefined;
438
+ expect(bid.mediaType).to.equal('video');
439
+ expect(bid.vastXml).to.equal(ortbResponse.seatbid[0].bid[0].adm);
440
+ });
441
+ }
524
442
 
525
443
  it('Verify extra parameters', function () {
526
- let request = spec.buildRequests(additionalParamsConfig, bidderRequest);
444
+ let request = spec.buildRequests(additionalParamsConfig, syncAddFPDToBidderRequest(bidderRequest));
527
445
  let ortbRequest = request.data;
528
446
  expect(ortbRequest).to.not.equal(null);
529
447
  expect(ortbRequest.imp).to.have.lengthOf(1);
@@ -538,31 +456,15 @@ describe('PulsePoint Adapter Tests', function () {
538
456
  expect(ortbRequest.imp[0].ext.prebid.extra_key4).to.eql([1, 2, 3]);
539
457
  expect(Object.keys(ortbRequest.imp[0].ext.prebid)).to.eql(['extra_key1', 'extra_key2', 'extra_key3', 'extra_key4']);
540
458
  // attempting with a configuration with no unknown params.
541
- request = spec.buildRequests(outstreamSlotConfig, bidderRequest);
459
+ request = spec.buildRequests(videoSlotConfig, bidderRequest);
542
460
  ortbRequest = request.data;
543
461
  expect(ortbRequest).to.not.equal(null);
544
462
  expect(ortbRequest.imp).to.have.lengthOf(1);
545
- expect(ortbRequest.imp[0].ext).to.equal(null);
546
- });
547
-
548
- it('Verify ortb parameters', function () {
549
- const request = spec.buildRequests(ortbParamsSlotConfig, bidderRequest);
550
- const ortbRequest = request.data;
551
- expect(ortbRequest).to.not.equal(null);
552
- expect(ortbRequest.bcat).to.eql(['IAB-1', 'IAB-20']);
553
- expect(ortbRequest.badv).to.eql(['cocacola.com', 'lays.com']);
554
- expect(ortbRequest.imp).to.have.lengthOf(2);
555
- expect(ortbRequest.imp[0].bidfloor).to.equal(1.5);
556
- expect(ortbRequest.imp[0].banner.battr).to.eql([1, 2, 3]);
557
- expect(ortbRequest.imp[0].ext).to.be.null;
558
- // slot 2
559
- expect(ortbRequest.imp[1].bidfloor).to.equal(2.5);
560
- expect(ortbRequest.imp[1].video.battr).to.eql([2, 3, 4]);
561
- expect(ortbRequest.imp[1].ext).to.be.null;
463
+ expect(ortbRequest.imp[0].ext).to.be.undefined;
562
464
  });
563
465
 
564
466
  it('Verify schain parameters', function () {
565
- const request = spec.buildRequests(schainParamsSlotConfig, bidderRequest);
467
+ const request = spec.buildRequests(schainParamsSlotConfig, syncAddFPDToBidderRequest(bidderRequest));
566
468
  const ortbRequest = request.data;
567
469
  expect(ortbRequest).to.not.equal(null);
568
470
  expect(ortbRequest.source).to.not.equal(null);
@@ -580,42 +482,6 @@ describe('PulsePoint Adapter Tests', function () {
580
482
  expect(ortbRequest.source.ext.schain.nodes[0].domain).to.equal('publisher.com');
581
483
  });
582
484
 
583
- it('Verify outstream renderer', function () {
584
- const bidderRequestOutstream = Object.assign({}, bidderRequest, {bids: [outstreamSlotConfig[0]]});
585
- const request = spec.buildRequests(outstreamSlotConfig, bidderRequestOutstream);
586
- const ortbRequest = request.data;
587
- expect(ortbRequest).to.not.be.null;
588
- expect(ortbRequest.imp[0]).to.not.be.null;
589
- expect(ortbRequest.imp[0].video).to.not.be.null;
590
- const ortbResponse = {
591
- seatbid: [{
592
- bid: [{
593
- impid: ortbRequest.imp[0].id,
594
- price: 1.25,
595
- adm: '<VAST><Creative>https//pulsepoint.video.mp4</Creative></VAST>',
596
- ext: {
597
- outstream: {
598
- type: 'Inline',
599
- config: {
600
- text: 'ADVERTISEMENT',
601
- skipaftersec: 5
602
- },
603
- rendererUrl: 'https://tag.contextweb.com/hb-outstr-renderer.js'
604
- }
605
- }
606
- }]
607
- }]
608
- };
609
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
610
- const bid = bids[0];
611
- expect(bid.cpm).to.equal(1.25);
612
- expect(bid.renderer).to.not.be.null;
613
- expect(bid.renderer.url).to.equal('https://tag.contextweb.com/hb-outstr-renderer.js');
614
- expect(bid.renderer.getConfig()).to.not.be.null;
615
- expect(bid.renderer.getConfig().defaultOptions).to.eql(ortbResponse.seatbid[0].bid[0].ext.outstream.config);
616
- expect(bid.renderer.getConfig().rendererOptions).to.eql(outstreamSlotConfig[0].renderer.options);
617
- expect(bid.renderer.getConfig().type).to.equal('Inline');
618
- });
619
485
  it('Verify common id parameters', function () {
620
486
  const bidRequests = deepClone(slotConfigs);
621
487
  bidRequests[0].userIdAsEids = [{
@@ -633,169 +499,17 @@ describe('PulsePoint Adapter Tests', function () {
633
499
  }]
634
500
  }
635
501
  ];
636
- const request = spec.buildRequests(bidRequests, bidderRequest);
502
+ const request = spec.buildRequests(bidRequests, syncAddFPDToBidderRequest(bidderRequest));
637
503
  expect(request).to.be.not.null;
638
- const ortbRequest = request.data;
639
504
  expect(request.data).to.be.not.null;
505
+ const ortbRequest = request.data;
640
506
  // user object
641
507
  expect(ortbRequest.user).to.not.be.undefined;
642
508
  expect(ortbRequest.user.ext).to.not.be.undefined;
643
509
  expect(ortbRequest.user.ext.eids).to.not.be.undefined;
644
510
  expect(ortbRequest.user.ext.eids).to.deep.equal(bidRequests[0].userIdAsEids);
645
511
  });
646
- it('Verify multiple adsizes', function () {
647
- const bidRequests = deepClone(slotConfigs);
648
- const request = spec.buildRequests(bidRequests, bidderRequest);
649
- expect(request).to.be.not.null;
650
- expect(request.data).to.be.not.null;
651
- const ortbRequest = request.data;
652
- expect(ortbRequest.imp).to.have.lengthOf(2);
653
- // first impression has multi sizes
654
- expect(ortbRequest.imp[0].banner).to.not.be.null;
655
- expect(ortbRequest.imp[0].banner.w).to.equal(300);
656
- expect(ortbRequest.imp[0].banner.h).to.equal(250);
657
- expect(ortbRequest.imp[0].banner.format).to.not.be.null;
658
- expect(ortbRequest.imp[0].banner.format).to.have.lengthOf(2);
659
- expect(ortbRequest.imp[0].banner.format[0].w).to.equal(728);
660
- expect(ortbRequest.imp[0].banner.format[0].h).to.equal(90);
661
- expect(ortbRequest.imp[0].banner.format[1].w).to.equal(160);
662
- expect(ortbRequest.imp[0].banner.format[1].h).to.equal(600);
663
- // slot 2
664
- expect(ortbRequest.imp[1].banner).to.not.be.null;
665
- expect(ortbRequest.imp[1].banner.w).to.equal(728);
666
- expect(ortbRequest.imp[1].banner.h).to.equal(90);
667
- expect(ortbRequest.imp[1].banner.format).to.not.be.null;
668
- expect(ortbRequest.imp[1].banner.format).to.have.lengthOf(1);
669
- expect(ortbRequest.imp[1].banner.format[0].w).to.equal(728);
670
- expect(ortbRequest.imp[1].banner.format[0].h).to.equal(90);
671
- // adsize on response
672
- const ortbResponse = {
673
- seatbid: [{
674
- bid: [{
675
- impid: ortbRequest.imp[0].id,
676
- price: 1.25,
677
- adm: 'This is an Ad',
678
- crid: 'Creative#123',
679
- w: 728,
680
- h: 90
681
- }]
682
- }]
683
- };
684
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
685
- expect(bids).to.have.lengthOf(1);
686
- const bid = bids[0];
687
- expect(bid.width).to.equal(728);
688
- expect(bid.height).to.equal(90);
689
- });
690
- it('Verify multi-format response', function () {
691
- const bidRequests = deepClone(slotConfigs);
692
- bidRequests[0].mediaTypes['native'] = {
693
- title: {
694
- required: true
695
- },
696
- image: {
697
- required: true
698
- },
699
- sponsoredBy: {
700
- required: true
701
- }
702
- };
703
- bidRequests[1].params.video = {
704
- w: 400,
705
- h: 300,
706
- minduration: 5,
707
- maxduration: 10,
708
- };
709
- const request = spec.buildRequests(bidRequests, bidderRequest);
710
- expect(request).to.be.not.null;
711
- expect(request.data).to.be.not.null;
712
- const ortbRequest = request.data;
713
- expect(ortbRequest.imp).to.have.lengthOf(2);
714
- // adsize on response
715
- const ortbResponse = {
716
- seatbid: [{
717
- bid: [{
718
- impid: ortbRequest.imp[0].id,
719
- price: 1.25,
720
- adm: 'This is an Ad',
721
- crid: 'Creative#123',
722
- w: 728,
723
- h: 90
724
- }, {
725
- impid: ortbRequest.imp[1].id,
726
- price: 2.5,
727
- adm: '<vast url="http://ad.com/video"></vast>',
728
- crid: 'Creative#234',
729
- w: 728,
730
- h: 90
731
- }]
732
- }]
733
- };
734
- // request has both types - banner and native, response is parsed as banner.
735
- // for impression#2, response is parsed as video
736
- const bids = spec.interpretResponse({ body: ortbResponse }, request);
737
- expect(bids).to.have.lengthOf(2);
738
- const bid = bids[0];
739
- expect(bid.width).to.equal(728);
740
- expect(bid.height).to.equal(90);
741
- const secondBid = bids[1];
742
- expect(secondBid.vastXml).to.equal('<vast url="http://ad.com/video"></vast>');
743
- });
744
- it('Verify bid floor', function () {
745
- const bidRequests = deepClone(slotConfigs);
746
- bidRequests[0].params.bidfloor = 1.05;
747
- let request = spec.buildRequests(bidRequests, bidderRequest);
748
- let ortbRequest = request.data;
749
- expect(ortbRequest).to.not.equal(null);
750
- expect(ortbRequest.imp[0].bidfloor).to.equal(1.05);
751
- expect(ortbRequest.imp[1].bidfloor).to.be.undefined;
752
- let floorArg = null;
753
- // publisher uses the floor module
754
- bidRequests[0].getFloor = (arg) => {
755
- floorArg = arg;
756
- return { floor: 1.25 };
757
- };
758
- bidRequests[1].getFloor = () => {
759
- return { floor: 2.05 };
760
- };
761
- request = spec.buildRequests(bidRequests, bidderRequest);
762
- ortbRequest = request.data;
763
- expect(ortbRequest).to.not.equal(null);
764
- expect(ortbRequest.imp[0].bidfloor).to.equal(1.25);
765
- expect(ortbRequest.imp[1].bidfloor).to.equal(2.05);
766
- expect(floorArg).to.not.be.null;
767
- expect(floorArg.mediaType).to.equal('banner');
768
- expect(floorArg.currency).to.equal('USD');
769
- expect(floorArg.size).to.equal('*');
770
- });
771
- it('Verify Video params on mediaTypes.video', function () {
772
- const bidRequests = deepClone(videoSlotConfig);
773
- bidRequests[0].mediaTypes = {
774
- video: {
775
- w: 600,
776
- h: 400,
777
- minduration: 15,
778
- maxduration: 20,
779
- startdelay: 10,
780
- skip: 0,
781
- }
782
- };
783
- const request = spec.buildRequests(bidRequests, bidderRequest);
784
- const ortbRequest = request.data;
785
- expect(ortbRequest).to.not.equal(null);
786
- expect(ortbRequest.imp).to.have.lengthOf(1);
787
- expect(ortbRequest.imp[0].video).to.not.be.null;
788
- expect(ortbRequest.imp[0].native).to.be.null;
789
- expect(ortbRequest.imp[0].banner).to.be.null;
790
- expect(ortbRequest.imp[0].video.w).to.equal(600);
791
- expect(ortbRequest.imp[0].video.h).to.equal(400);
792
- expect(ortbRequest.imp[0].video.minduration).to.equal(15);
793
- expect(ortbRequest.imp[0].video.maxduration).to.equal(20);
794
- expect(ortbRequest.imp[0].video.startdelay).to.equal(10);
795
- expect(ortbRequest.imp[0].video.skip).to.equal(0);
796
- expect(ortbRequest.imp[0].video.minbitrate).to.equal(200);
797
- expect(ortbRequest.imp[0].video.protocols).to.eql([1, 2, 4]);
798
- });
512
+
799
513
  it('Verify user level first party data', function () {
800
514
  const bidderRequest = {
801
515
  refererInfo: {
@@ -819,7 +533,7 @@ describe('PulsePoint Adapter Tests', function () {
819
533
  }
820
534
  }
821
535
  };
822
- let request = spec.buildRequests(slotConfigs, bidderRequest);
536
+ let request = spec.buildRequests(slotConfigs, syncAddFPDToBidderRequest(bidderRequest));
823
537
  let ortbRequest = request.data;
824
538
  expect(ortbRequest).to.not.equal(null);
825
539
  expect(ortbRequest.user).to.not.equal(null);
@@ -835,12 +549,9 @@ describe('PulsePoint Adapter Tests', function () {
835
549
  }
836
550
  });
837
551
  });
552
+
838
553
  it('Verify site level first party data', function () {
839
554
  const bidderRequest = {
840
- refererInfo: {
841
- page: 'https://publisher.com/home',
842
- ref: 'https://referrer'
843
- },
844
555
  ortb2: {
845
556
  site: {
846
557
  content: {
@@ -853,11 +564,14 @@ describe('PulsePoint Adapter Tests', function () {
853
564
  }]
854
565
  },
855
566
  page: 'http://pub.com/news',
856
- ref: 'http://google.com'
567
+ ref: 'http://google.com',
568
+ publisher: {
569
+ domain: 'pub.com'
570
+ }
857
571
  }
858
572
  }
859
573
  };
860
- let request = spec.buildRequests(slotConfigs, bidderRequest);
574
+ let request = spec.buildRequests(slotConfigs, syncAddFPDToBidderRequest(bidderRequest));
861
575
  let ortbRequest = request.data;
862
576
  expect(ortbRequest).to.not.equal(null);
863
577
  expect(ortbRequest.site).to.not.equal(null);
@@ -871,13 +585,15 @@ describe('PulsePoint Adapter Tests', function () {
871
585
  }
872
586
  }]
873
587
  },
874
- page: 'https://publisher.com/home',
875
- ref: 'https://referrer',
588
+ page: 'http://pub.com/news',
589
+ ref: 'http://google.com',
876
590
  publisher: {
877
- id: 'p10000'
591
+ id: 'p10000',
592
+ domain: 'pub.com'
878
593
  }
879
594
  });
880
595
  });
596
+
881
597
  it('Verify impression/slot level first party data', function () {
882
598
  const bidderRequests = [{
883
599
  placementCode: '/DfpAccount1/slot1',
@@ -928,4 +644,27 @@ describe('PulsePoint Adapter Tests', function () {
928
644
  // assert bidderRequest value is used when available
929
645
  expect(mkRequest(Object.assign({}, { timeout: 6000 }, bidderRequest)).tmax).to.equal(6000)
930
646
  });
647
+
648
+ it('Verify deals', function () {
649
+ const bidRequests = deepClone(slotConfigs);
650
+ const deals = [{
651
+ id: 'DEAL_ONE',
652
+ bidfloor: 1.1
653
+ }, {
654
+ id: 'DEAL_TWO',
655
+ bidfloor: 2.2
656
+ }];
657
+ bidRequests[0].params.deals = deals;
658
+ const request = spec.buildRequests(bidRequests, syncAddFPDToBidderRequest(bidderRequest));
659
+ expect(request.url).to.equal('https://bid.contextweb.com/header/ortb?src=prebid');
660
+ expect(request.method).to.equal('POST');
661
+ const ortbRequest = request.data;
662
+ // slot 1
663
+ expect(ortbRequest.imp[0].tagid).to.equal('t10000');
664
+ expect(ortbRequest.imp[0].pmp).to.not.be.undefined;
665
+ expect(ortbRequest.imp[0].pmp).to.deep.equal({
666
+ private_auction: 0,
667
+ deals
668
+ });
669
+ })
931
670
  });