prebid.js 6.2.0 → 6.6.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 (169) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/gulpfile.js +87 -82
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  4. package/karma.conf.maker.js +1 -1
  5. package/modules/.submodules.json +2 -1
  6. package/modules/33acrossBidAdapter.js +189 -102
  7. package/modules/adagioBidAdapter.js +1 -1
  8. package/modules/addefendBidAdapter.js +1 -0
  9. package/modules/adkernelBidAdapter.js +148 -62
  10. package/modules/adlooxAdServerVideo.js +2 -2
  11. package/modules/adlooxAnalyticsAdapter.js +4 -4
  12. package/modules/admanBidAdapter.js +11 -4
  13. package/modules/admixerBidAdapter.js +1 -1
  14. package/modules/adnuntiusBidAdapter.js +3 -1
  15. package/modules/adomikAnalyticsAdapter.js +27 -9
  16. package/modules/adqueryIdSystem.js +103 -0
  17. package/modules/adqueryIdSystem.md +35 -0
  18. package/modules/adxcgBidAdapter.js +311 -359
  19. package/modules/adxcgBidAdapter.md +22 -21
  20. package/modules/adyoulikeBidAdapter.js +13 -9
  21. package/modules/aniviewBidAdapter.js +1 -1
  22. package/modules/appnexusBidAdapter.js +0 -1
  23. package/modules/beopBidAdapter.js +6 -4
  24. package/modules/bidViewability.js +3 -3
  25. package/modules/bidViewabilityIO.js +3 -3
  26. package/modules/bliinkBidAdapter.js +3 -2
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/compassBidAdapter.js +208 -0
  29. package/modules/compassBidAdapter.md +79 -0
  30. package/modules/consentManagement.js +7 -1
  31. package/modules/criteoBidAdapter.js +1 -1
  32. package/modules/criteoIdSystem.js +29 -7
  33. package/modules/currency.js +2 -2
  34. package/modules/cwireBidAdapter.js +3 -0
  35. package/modules/dailyhuntBidAdapter.js +435 -0
  36. package/modules/dailyhuntBidAdapter.md +4 -0
  37. package/modules/docereeBidAdapter.js +10 -1
  38. package/modules/docereeBidAdapter.md +2 -0
  39. package/modules/dspxBidAdapter.js +1 -1
  40. package/modules/engageyaBidAdapter.js +1 -1
  41. package/modules/feedadBidAdapter.js +2 -2
  42. package/modules/feedadBidAdapter.md +4 -2
  43. package/modules/futureads.md +48 -0
  44. package/modules/glimpseBidAdapter.js +82 -47
  45. package/modules/gptPreAuction.js +55 -7
  46. package/modules/gridBidAdapter.js +4 -3
  47. package/modules/gumgumBidAdapter.js +2 -2
  48. package/modules/idImportLibrary.js +45 -8
  49. package/modules/idImportLibrary.md +4 -0
  50. package/modules/improvedigitalBidAdapter.js +42 -4
  51. package/modules/instreamTracking.js +4 -4
  52. package/modules/invibesBidAdapter.js +49 -5
  53. package/modules/invibesBidAdapter.md +2 -1
  54. package/modules/ixBidAdapter.js +53 -18
  55. package/modules/kinessoIdSystem.js +1 -1
  56. package/modules/limelightDigitalBidAdapter.js +2 -1
  57. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  58. package/modules/livewrappedBidAdapter.js +8 -2
  59. package/modules/loglyliftBidAdapter.js +79 -0
  60. package/modules/loglyliftBidAdapter.md +55 -0
  61. package/modules/lotamePanoramaIdSystem.js +80 -8
  62. package/modules/mediasquareBidAdapter.js +1 -9
  63. package/modules/nextMillenniumBidAdapter.js +39 -7
  64. package/modules/oguryBidAdapter.js +9 -2
  65. package/modules/onetagBidAdapter.js +4 -2
  66. package/modules/optimeraRtdProvider.js +8 -1
  67. package/modules/ozoneBidAdapter.js +21 -64
  68. package/modules/prebidServerBidAdapter/index.js +16 -12
  69. package/modules/proxistoreBidAdapter.js +0 -2
  70. package/modules/pubgeniusBidAdapter.js +1 -1
  71. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  72. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  73. package/modules/richaudienceBidAdapter.js +4 -4
  74. package/modules/riseBidAdapter.js +1 -1
  75. package/modules/rtbhouseBidAdapter.js +14 -4
  76. package/modules/rtdModule/index.js +49 -18
  77. package/modules/rubiconBidAdapter.js +31 -19
  78. package/modules/sharedIdSystem.js +27 -1
  79. package/modules/showheroes-bsBidAdapter.js +13 -2
  80. package/modules/tappxBidAdapter.js +8 -5
  81. package/modules/targetVideoBidAdapter.js +187 -0
  82. package/modules/targetVideoBidAdapter.md +34 -0
  83. package/modules/teadsBidAdapter.js +1 -2
  84. package/modules/telariaBidAdapter.js +2 -2
  85. package/modules/trustxBidAdapter.js +8 -16
  86. package/modules/userId/eids.js +7 -1
  87. package/modules/userId/userId.md +8 -0
  88. package/modules/vidoomyBidAdapter.js +16 -10
  89. package/modules/weboramaRtdProvider.js +288 -73
  90. package/modules/weboramaRtdProvider.md +27 -10
  91. package/modules/welectBidAdapter.js +106 -0
  92. package/modules/yahoosspBidAdapter.js +5 -1
  93. package/modules/yieldmoBidAdapter.js +23 -5
  94. package/modules/zetaSspBidAdapter.md +33 -1
  95. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  96. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  97. package/modules/zeta_global_sspBidAdapter.js +22 -1
  98. package/package.json +1 -1
  99. package/plugins/pbjsGlobals.js +28 -1
  100. package/src/auction.js +2 -2
  101. package/src/config.js +27 -3
  102. package/src/hook.js +5 -1
  103. package/src/prebid.js +21 -6
  104. package/src/targeting.js +22 -1
  105. package/src/utils.js +46 -8
  106. package/test/helpers/prebidGlobal.js +1 -0
  107. package/test/spec/config_spec.js +279 -0
  108. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  109. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  110. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  111. package/test/spec/modules/adnuntiusBidAdapter_spec.js +17 -0
  112. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  113. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  114. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  115. package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
  116. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  117. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  118. package/test/spec/modules/bidViewability_spec.js +4 -4
  119. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  120. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  121. package/test/spec/modules/compassBidAdapter_spec.js +398 -0
  122. package/test/spec/modules/consentManagement_spec.js +20 -0
  123. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  124. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  125. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  126. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  127. package/test/spec/modules/eids_spec.js +15 -0
  128. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  129. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  130. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  131. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  132. package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
  133. package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
  134. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  135. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
  136. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  137. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  138. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  139. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  140. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  141. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  142. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  143. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  144. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  145. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  146. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  147. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  148. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  149. package/test/spec/modules/realTimeDataModule_spec.js +147 -48
  150. package/test/spec/modules/richaudienceBidAdapter_spec.js +42 -2
  151. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  152. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  153. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  154. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  155. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  156. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  157. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  158. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  159. package/test/spec/modules/userId_spec.js +68 -19
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  162. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  163. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/targeting_spec.js +72 -0
  166. package/test/spec/unit/pbjs_api_spec.js +3 -1
  167. package/test/spec/utils_spec.js +38 -0
  168. package/test/test_deps.js +3 -0
  169. package/test/test_index.js +1 -3
@@ -0,0 +1,404 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/dailyhuntBidAdapter.js';
3
+
4
+ const PROD_PREBID_ENDPOINT_URL = 'https://pbs.dailyhunt.in/openrtb2/auction?partner=dailyhunt';
5
+ const PROD_PREBID_TEST_ENDPOINT_URL = 'https://qa-pbs-van.dailyhunt.in/openrtb2/auction?partner=dailyhunt';
6
+
7
+ const _encodeURIComponent = function (a) {
8
+ if (!a) { return }
9
+ let b = window.encodeURIComponent(a);
10
+ b = b.replace(/'/g, '%27');
11
+ return b;
12
+ }
13
+
14
+ describe('DailyhuntAdapter', function () {
15
+ describe('isBidRequestValid', function () {
16
+ let bid = {
17
+ 'bidder': 'dailyhunt',
18
+ 'params': {
19
+ placement_id: 1,
20
+ publisher_id: 1,
21
+ partner_name: 'dailyhunt'
22
+ }
23
+ };
24
+
25
+ it('should return true when required params found', function () {
26
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
27
+ });
28
+
29
+ it('should return false when required params are not passed', function () {
30
+ let bid = Object.assign({}, bid);
31
+ delete bid.params;
32
+ bid.params = {};
33
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
34
+ });
35
+ });
36
+ describe('buildRequests', function() {
37
+ let bidRequests = [
38
+ {
39
+ bidder: 'dailyhunt',
40
+ params: {
41
+ placement_id: 1,
42
+ publisher_id: 1,
43
+ partner_name: 'dailyhunt',
44
+ bidfloor: 0.1,
45
+ device: {
46
+ ip: '47.9.247.217'
47
+ },
48
+ site: {
49
+ cat: ['1', '2', '3']
50
+ }
51
+ },
52
+ mediaTypes: {
53
+ banner: {
54
+ sizes: [[300, 250]]
55
+ }
56
+ },
57
+ adUnitCode: 'adunit-code',
58
+ sizes: [[300, 50]],
59
+ bidId: '30b31c1838de1e',
60
+ bidderRequestId: '22edbae2733bf6',
61
+ auctionId: '1d1a030790a475',
62
+ transactionId: '04f2659e-c005-4eb1-a57c-fa93145e3843'
63
+ }
64
+ ];
65
+ let nativeBidRequests = [
66
+ {
67
+ bidder: 'dailyhunt',
68
+ params: {
69
+ placement_id: 1,
70
+ publisher_id: 1,
71
+ partner_name: 'dailyhunt',
72
+ },
73
+ nativeParams: {
74
+ title: {
75
+ required: true,
76
+ len: 80
77
+ },
78
+ image: {
79
+ required: true,
80
+ sizes: [150, 50]
81
+ },
82
+ },
83
+ mediaTypes: {
84
+ native: {
85
+ title: {
86
+ required: true
87
+ },
88
+ }
89
+ },
90
+ adUnitCode: 'adunit-code',
91
+ sizes: [[300, 250], [300, 50]],
92
+ bidId: '30b31c1838de1e',
93
+ bidderRequestId: '22edbae2733bf6',
94
+ auctionId: '1d1a030790a475',
95
+ transactionId: '04f2659e-c005-4eb1-a57c-fa93145e3843'
96
+ }
97
+ ];
98
+ let videoBidRequests = [
99
+ {
100
+ bidder: 'dailyhunt',
101
+ params: {
102
+ placement_id: 1,
103
+ publisher_id: 1,
104
+ partner_name: 'dailyhunt'
105
+ },
106
+ nativeParams: {
107
+ video: {
108
+ context: 'instream'
109
+ }
110
+ },
111
+ mediaTypes: {
112
+ video: {
113
+ context: 'instream'
114
+ }
115
+ },
116
+ adUnitCode: 'adunit-code',
117
+ sizes: [[300, 250], [300, 50]],
118
+ bidId: '30b31c1838de1e',
119
+ bidderRequestId: '22edbae2733bf6',
120
+ auctionId: '1d1a030790a475',
121
+ transactionId: '04f2659e-c005-4eb1-a57c-fa93145e3843'
122
+ }
123
+ ];
124
+ let bidderRequest = {
125
+ 'bidderRequestId': '22edbae2733bf6',
126
+ 'auctionId': '1d1a030790a475',
127
+ 'bidderCode': 'dailyhunt',
128
+ 'bids': [
129
+ {
130
+ ...bidRequests[0]
131
+ }
132
+ ],
133
+ 'refererInfo': {
134
+ 'referer': 'http://m.dailyhunt.in/'
135
+ }
136
+ };
137
+ let nativeBidderRequest = {
138
+ 'bidderRequestId': '22edbae2733bf6',
139
+ 'auctionId': '1d1a030790a475',
140
+ 'bidderCode': 'dailyhunt',
141
+ 'bids': [
142
+ {
143
+ ...nativeBidRequests[0]
144
+ }
145
+ ],
146
+ 'refererInfo': {
147
+ 'referer': 'http://m.dailyhunt.in/'
148
+ }
149
+ };
150
+ let videoBidderRequest = {
151
+ 'bidderRequestId': '22edbae2733bf6',
152
+ 'auctionId': '1d1a030790a475',
153
+ 'bidderCode': 'dailyhunt',
154
+ 'bids': [
155
+ {
156
+ ...videoBidRequests[0]
157
+ }
158
+ ],
159
+ 'refererInfo': {
160
+ 'referer': 'http://m.dailyhunt.in/'
161
+ }
162
+ };
163
+
164
+ it('sends display bid request to ENDPOINT via POST', function () {
165
+ const request = spec.buildRequests(bidRequests, bidderRequest)[0];
166
+ expect(request.url).to.equal(PROD_PREBID_ENDPOINT_URL);
167
+ expect(request.method).to.equal('POST');
168
+ });
169
+
170
+ it('sends native bid request to ENDPOINT via POST', function () {
171
+ const request = spec.buildRequests(nativeBidRequests, nativeBidderRequest)[0];
172
+ expect(request.url).to.equal(PROD_PREBID_ENDPOINT_URL);
173
+ expect(request.method).to.equal('POST');
174
+ });
175
+
176
+ it('sends video bid request to ENDPOINT via POST', function () {
177
+ const request = spec.buildRequests(videoBidRequests, videoBidderRequest)[0];
178
+ expect(request.url).to.equal(PROD_PREBID_ENDPOINT_URL);
179
+ expect(request.method).to.equal('POST');
180
+ });
181
+ });
182
+ describe('interpretResponse', function () {
183
+ let bidResponses = {
184
+ id: 'da32def7-6779-403c-ada7-0b201dbc9744',
185
+ seatbid: [
186
+ {
187
+ bid: [
188
+ {
189
+ id: 'id1',
190
+ impid: 'banner-impid',
191
+ price: 1.4,
192
+ adm: 'adm',
193
+ adid: '66658',
194
+ crid: 'asd5ddbf014cac993.66466212',
195
+ dealid: 'asd5ddbf014cac993.66466212',
196
+ w: 300,
197
+ h: 250,
198
+ nurl: 'winUrl',
199
+ ext: {
200
+ prebid: {
201
+ type: 'banner'
202
+ }
203
+ }
204
+ },
205
+ {
206
+ id: '5caccc1f-94a6-4230-a1f9-6186ee65da99',
207
+ impid: 'video-impid',
208
+ price: 1.4,
209
+ nurl: 'winUrl',
210
+ adm: 'adm',
211
+ adid: '980',
212
+ crid: '2394',
213
+ w: 300,
214
+ h: 250,
215
+ ext: {
216
+ prebid: {
217
+ 'type': 'video'
218
+ },
219
+ bidder: {
220
+ cacheKey: 'cache_key',
221
+ vastUrl: 'vastUrl'
222
+ }
223
+ }
224
+ },
225
+ {
226
+ id: '74973faf-cce7-4eff-abd0-b59b8e91ca87',
227
+ impid: 'native-impid',
228
+ price: 50,
229
+ nurl: 'winUrl',
230
+ adm: '{"native":{"link":{"url":"url","clicktrackers":[]},"assets":[{"id":1,"required":1,"img":{},"video":{},"data":{},"title":{"text":"TITLE"},"link":{}},{"id":1,"required":1,"img":{},"video":{},"data":{"type":2,"value":"Lorem Ipsum Lorem Ipsum Lorem Ipsum."},"title":{},"link":{}},{"id":1,"required":1,"img":{},"video":{},"data":{"type":12,"value":"Install Here"},"title":{},"link":{}},{"id":1,"required":1,"img":{"type":3,"url":"urk","w":990,"h":505},"video":{},"data":{},"title":{},"link":{}}],"imptrackers":[]}}',
231
+ adid: '968',
232
+ crid: '2370',
233
+ w: 300,
234
+ h: 250,
235
+ ext: {
236
+ prebid: {
237
+ type: 'native'
238
+ },
239
+ bidder: null
240
+ }
241
+ },
242
+ {
243
+ id: '5caccc1f-94a6-4230-a1f9-6186ee65da99',
244
+ impid: 'video-outstream-impid',
245
+ price: 1.4,
246
+ nurl: 'winUrl',
247
+ adm: 'adm',
248
+ adid: '980',
249
+ crid: '2394',
250
+ w: 300,
251
+ h: 250,
252
+ ext: {
253
+ prebid: {
254
+ 'type': 'video'
255
+ },
256
+ bidder: {
257
+ cacheKey: 'cache_key',
258
+ vastUrl: 'vastUrl'
259
+ }
260
+ }
261
+ },
262
+ ],
263
+ seat: 'dailyhunt'
264
+ }
265
+ ],
266
+ ext: {
267
+ responsetimemillis: {
268
+ dailyhunt: 119
269
+ }
270
+ }
271
+ };
272
+
273
+ it('should get correct bid response', function () {
274
+ let expectedResponse = [
275
+ {
276
+ requestId: '1',
277
+ cpm: 1.4,
278
+ creativeId: 'asd5ddbf014cac993.66466212',
279
+ width: 300,
280
+ height: 250,
281
+ ttl: 360,
282
+ netRevenue: true,
283
+ currency: 'USD',
284
+ ad: 'adm',
285
+ mediaType: 'banner',
286
+ winUrl: 'winUrl',
287
+ adomain: 'dailyhunt'
288
+ },
289
+ {
290
+ requestId: '2',
291
+ cpm: 1.4,
292
+ creativeId: '2394',
293
+ width: 300,
294
+ height: 250,
295
+ ttl: 360,
296
+ netRevenue: true,
297
+ currency: 'USD',
298
+ mediaType: 'video',
299
+ winUrl: 'winUrl',
300
+ adomain: 'dailyhunt',
301
+ videoCacheKey: 'cache_key',
302
+ vastUrl: 'vastUrl',
303
+ },
304
+ {
305
+ requestId: '3',
306
+ cpm: 1.4,
307
+ creativeId: '2370',
308
+ width: 300,
309
+ height: 250,
310
+ ttl: 360,
311
+ netRevenue: true,
312
+ currency: 'USD',
313
+ mediaType: 'native',
314
+ winUrl: 'winUrl',
315
+ adomain: 'dailyhunt',
316
+ native: {
317
+ clickUrl: 'https%3A%2F%2Fmontu1996.github.io%2F',
318
+ clickTrackers: [],
319
+ impressionTrackers: [],
320
+ javascriptTrackers: [],
321
+ title: 'TITLE',
322
+ body: 'Lorem Ipsum Lorem Ipsum Lorem Ipsum.',
323
+ cta: 'Install Here',
324
+ image: {
325
+ url: 'url',
326
+ height: 505,
327
+ width: 990
328
+ }
329
+ }
330
+ },
331
+ {
332
+ requestId: '4',
333
+ cpm: 1.4,
334
+ creativeId: '2394',
335
+ width: 300,
336
+ height: 250,
337
+ ttl: 360,
338
+ netRevenue: true,
339
+ currency: 'USD',
340
+ mediaType: 'video',
341
+ winUrl: 'winUrl',
342
+ adomain: 'dailyhunt',
343
+ vastXml: 'adm',
344
+ },
345
+ ];
346
+ let bidderRequest = {
347
+ bids: [
348
+ {
349
+ bidId: 'banner-impid',
350
+ adUnitCode: 'code1',
351
+ requestId: '1'
352
+ },
353
+ {
354
+ bidId: 'video-impid',
355
+ adUnitCode: 'code2',
356
+ requestId: '2',
357
+ mediaTypes: {
358
+ video: {
359
+ context: 'instream'
360
+ }
361
+ }
362
+ },
363
+ {
364
+ bidId: 'native-impid',
365
+ adUnitCode: 'code3',
366
+ requestId: '3'
367
+ },
368
+ {
369
+ bidId: 'video-outstream-impid',
370
+ adUnitCode: 'code4',
371
+ requestId: '4',
372
+ mediaTypes: {
373
+ video: {
374
+ context: 'outstream'
375
+ }
376
+ }
377
+ },
378
+ ]
379
+ }
380
+ let result = spec.interpretResponse({ body: bidResponses }, bidderRequest);
381
+ result.forEach((r, i) => {
382
+ expect(Object.keys(r)).to.have.members(Object.keys(expectedResponse[i]));
383
+ });
384
+ });
385
+ })
386
+ describe('onBidWon', function () {
387
+ it('should hit win url when bid won', function () {
388
+ let bid = {
389
+ requestId: '1',
390
+ cpm: 1.4,
391
+ creativeId: 'asd5ddbf014cac993.66466212',
392
+ width: 300,
393
+ height: 250,
394
+ ttl: 360,
395
+ netRevenue: true,
396
+ currency: 'USD',
397
+ ad: 'adm',
398
+ mediaType: 'banner',
399
+ winUrl: 'winUrl'
400
+ };
401
+ expect(spec.onBidWon(bid)).to.equal(undefined);
402
+ });
403
+ })
404
+ })
@@ -31,6 +31,8 @@ describe('BidlabBidAdapter', function () {
31
31
  bidder: 'doceree',
32
32
  params: {
33
33
  placementId: 'DOC_7jm9j5eqkl0xvc5w',
34
+ gdpr: '1',
35
+ gdprConsent: 'CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g'
34
36
  }
35
37
  };
36
38
 
@@ -44,6 +46,12 @@ describe('BidlabBidAdapter', function () {
44
46
  });
45
47
  });
46
48
 
49
+ describe('isGdprConsentPresent', function () {
50
+ it('Should return true if gdpr consent is present', function () {
51
+ expect(spec.isGdprConsentPresent(bid)).to.be.true;
52
+ });
53
+ });
54
+
47
55
  describe('buildRequests', function () {
48
56
  let serverRequest = spec.buildRequests([bid]);
49
57
  serverRequest = serverRequest[0]
@@ -56,7 +64,7 @@ describe('BidlabBidAdapter', function () {
56
64
  expect(serverRequest.method).to.equal('GET');
57
65
  });
58
66
  it('Returns valid URL', function () {
59
- expect(serverRequest.url).to.equal('https://bidder.doceree.com/v1/adrequest?id=DOC_7jm9j5eqkl0xvc5w&pubRequestedURL=undefined&loggedInUser=JTdCJTIyZ2VuZGVyJTIyJTNBJTIyJTIyJTJDJTIyZW1haWwlMjIlM0ElMjIlMjIlMkMlMjJoYXNoZWRFbWFpbCUyMiUzQSUyMiUyMiUyQyUyMmZpcnN0TmFtZSUyMiUzQSUyMiUyMiUyQyUyMmxhc3ROYW1lJTIyJTNBJTIyJTIyJTJDJTIybnBpJTIyJTNBJTIyJTIyJTJDJTIyaGFzaGVkTlBJJTIyJTNBJTIyJTIyJTJDJTIyY2l0eSUyMiUzQSUyMiUyMiUyQyUyMnppcENvZGUlMjIlM0ElMjIlMjIlMkMlMjJzcGVjaWFsaXphdGlvbiUyMiUzQSUyMiUyMiU3RA%3D%3D&prebidjs=true&requestId=testing&');
67
+ expect(serverRequest.url).to.equal('https://bidder.doceree.com/v1/adrequest?id=DOC_7jm9j5eqkl0xvc5w&pubRequestedURL=undefined&loggedInUser=JTdCJTIyZ2VuZGVyJTIyJTNBJTIyJTIyJTJDJTIyZW1haWwlMjIlM0ElMjIlMjIlMkMlMjJoYXNoZWRFbWFpbCUyMiUzQSUyMiUyMiUyQyUyMmZpcnN0TmFtZSUyMiUzQSUyMiUyMiUyQyUyMmxhc3ROYW1lJTIyJTNBJTIyJTIyJTJDJTIybnBpJTIyJTNBJTIyJTIyJTJDJTIyaGFzaGVkTlBJJTIyJTNBJTIyJTIyJTJDJTIyY2l0eSUyMiUzQSUyMiUyMiUyQyUyMnppcENvZGUlMjIlM0ElMjIlMjIlMkMlMjJzcGVjaWFsaXphdGlvbiUyMiUzQSUyMiUyMiU3RA%3D%3D&prebidjs=true&requestId=testing&gdpr=1&gdpr_consent=CPQfU1jPQfU1jG0AAAENAwCAAAAAAAAAAAAAAAAAAAAA.IGLtV_T9fb2vj-_Z99_tkeYwf95y3p-wzhheMs-8NyZeH_B4Wv2MyvBX4JiQKGRgksjLBAQdtHGlcTQgBwIlViTLMYk2MjzNKJrJEilsbO2dYGD9Pn8HT3ZCY70-vv__7v3ff_3g&');
60
68
  });
61
69
  });
62
70
  describe('interpretResponse', function () {
@@ -348,6 +348,21 @@ describe('eids array generation for known sub-modules', function() {
348
348
  }]
349
349
  });
350
350
  });
351
+
352
+ it('qid', function() {
353
+ const userId = {
354
+ qid: 'some-random-id-value'
355
+ };
356
+ const newEids = createEidsArray(userId);
357
+ expect(newEids.length).to.equal(1);
358
+ expect(newEids[0]).to.deep.equal({
359
+ source: 'adquery.io',
360
+ uids: [{
361
+ id: 'some-random-id-value',
362
+ atype: 1
363
+ }]
364
+ });
365
+ });
351
366
  });
352
367
  describe('Negative case', function() {
353
368
  it('eids array generation for UN-known sub-module', function() {
@@ -171,6 +171,21 @@ describe('FeedAdAdapter', function () {
171
171
  expect(result.data.bids).to.be.lengthOf(1);
172
172
  expect(result.data.bids[0]).to.deep.equal(bid);
173
173
  });
174
+ it('should pass through additional bid parameters', function () {
175
+ let bid = {
176
+ code: 'feedad',
177
+ mediaTypes: {
178
+ banner: {
179
+ sizes: [[320, 250]]
180
+ }
181
+ },
182
+ params: {clientToken: 'clientToken', placementId: 'placement-id', another: 'parameter', more: 'parameters'}
183
+ };
184
+ let result = spec.buildRequests([bid], bidderRequest);
185
+ expect(result.data.bids).to.be.lengthOf(1);
186
+ expect(result.data.bids[0].params.another).to.equal('parameter');
187
+ expect(result.data.bids[0].params.more).to.equal('parameters');
188
+ });
174
189
  it('should detect empty media types', function () {
175
190
  let bid = {
176
191
  code: 'feedad',
@@ -178,24 +178,6 @@ describe('GlimpseProtocolAdapter', () => {
178
178
  const bidRequests = [getBidRequest()]
179
179
  const bidderRequest = getBidderRequest()
180
180
 
181
- it('Adds a demo flag', () => {
182
- const request = spec.buildRequests(bidRequests, bidderRequest)
183
- const payload = JSON.parse(request.data)
184
- expect(payload.data.demo).to.be.false
185
- })
186
-
187
- it('Adds an account id', () => {
188
- const request = spec.buildRequests(bidRequests, bidderRequest)
189
- const payload = JSON.parse(request.data)
190
- expect(payload.data.account).to.equal(-1)
191
- })
192
-
193
- it('Adds a demand provider', () => {
194
- const request = spec.buildRequests(bidRequests, bidderRequest)
195
- const payload = JSON.parse(request.data)
196
- expect(payload.data.demand).to.equal('glimpse')
197
- })
198
-
199
181
  it('Adds GDPR consent', () => {
200
182
  const request = spec.buildRequests(bidRequests, bidderRequest)
201
183
  const payload = JSON.parse(request.data)
@@ -20,7 +20,9 @@ describe('GPT pre-auction module', () => {
20
20
  const testSlots = [
21
21
  makeSlot({ code: 'slotCode1', divId: 'div1' }),
22
22
  makeSlot({ code: 'slotCode2', divId: 'div2' }),
23
- makeSlot({ code: 'slotCode3', divId: 'div3' })
23
+ makeSlot({ code: 'slotCode3', divId: 'div3' }),
24
+ makeSlot({ code: 'slotCode4', divId: 'div4' }),
25
+ makeSlot({ code: 'slotCode4', divId: 'div5' })
24
26
  ];
25
27
 
26
28
  describe('appendPbAdSlot', () => {
@@ -172,7 +174,9 @@ describe('GPT pre-auction module', () => {
172
174
  expect(_currentConfig).to.deep.equal({
173
175
  enabled: true,
174
176
  customGptSlotMatching: false,
175
- customPbAdSlot: false
177
+ customPbAdSlot: false,
178
+ customPreAuction: false,
179
+ useDefaultPreAuction: false
176
180
  });
177
181
  });
178
182
  });
@@ -266,5 +270,176 @@ describe('GPT pre-auction module', () => {
266
270
  runMakeBidRequests(testAdUnits);
267
271
  expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
268
272
  });
273
+
274
+ it('should use the passed customPreAuction logic', () => {
275
+ let counter = 0;
276
+ config.setConfig({
277
+ gptPreAuction: {
278
+ enabled: true,
279
+ customPreAuction: (adUnit, slotName) => {
280
+ counter += 1;
281
+ return `${adUnit.code}-${slotName || counter}`;
282
+ }
283
+ }
284
+ });
285
+ const testAdUnits = [
286
+ {
287
+ code: 'adUnit1',
288
+ ortb2Imp: { ext: { data: { pbadslot: '12345' } } }
289
+ },
290
+ {
291
+ code: 'adUnit2',
292
+ },
293
+ {
294
+ code: 'slotCode3',
295
+ },
296
+ {
297
+ code: 'div4',
298
+ }
299
+ ];
300
+
301
+ // all slots should be passed in same time and have slot-${index}
302
+ const expectedAdUnits = [{
303
+ code: 'adUnit1',
304
+ ortb2Imp: {
305
+ ext: {
306
+ // no slotname match so uses adUnit.code-counter
307
+ data: {
308
+ pbadslot: 'adUnit1-1'
309
+ },
310
+ gpid: 'adUnit1-1'
311
+ }
312
+ }
313
+ },
314
+ // second adunit
315
+ {
316
+ code: 'adUnit2',
317
+ ortb2Imp: {
318
+ ext: {
319
+ // no slotname match so uses adUnit.code-counter
320
+ data: {
321
+ pbadslot: 'adUnit2-2'
322
+ },
323
+ gpid: 'adUnit2-2'
324
+ }
325
+ }
326
+ }, {
327
+ code: 'slotCode3',
328
+ ortb2Imp: {
329
+ ext: {
330
+ // slotname found, so uses code + slotname (which is same)
331
+ data: {
332
+ pbadslot: 'slotCode3-slotCode3',
333
+ adserver: {
334
+ name: 'gam',
335
+ adslot: 'slotCode3'
336
+ }
337
+ },
338
+ gpid: 'slotCode3-slotCode3'
339
+ }
340
+ }
341
+ }, {
342
+ code: 'div4',
343
+ ortb2Imp: {
344
+ ext: {
345
+ // slotname found, so uses code + slotname
346
+ data: {
347
+ pbadslot: 'div4-slotCode4',
348
+ adserver: {
349
+ name: 'gam',
350
+ adslot: 'slotCode4'
351
+ }
352
+ },
353
+ gpid: 'div4-slotCode4'
354
+ }
355
+ }
356
+ }];
357
+
358
+ window.googletag.pubads().setSlots(testSlots);
359
+ runMakeBidRequests(testAdUnits);
360
+ expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
361
+ });
362
+
363
+ it('should use useDefaultPreAuction logic', () => {
364
+ config.setConfig({
365
+ gptPreAuction: {
366
+ enabled: true,
367
+ useDefaultPreAuction: true
368
+ }
369
+ });
370
+ const testAdUnits = [
371
+ // First adUnit should use the preset pbadslot
372
+ {
373
+ code: 'adUnit1',
374
+ ortb2Imp: { ext: { data: { pbadslot: '12345' } } }
375
+ },
376
+ // Second adUnit should not match a gam slot, so no slot set
377
+ {
378
+ code: 'adUnit2',
379
+ },
380
+ // third adunit matches a single slot so uses it
381
+ {
382
+ code: 'slotCode3',
383
+ },
384
+ // fourth adunit matches multiple slots so combination
385
+ {
386
+ code: 'div4',
387
+ }
388
+ ];
389
+
390
+ const expectedAdUnits = [{
391
+ code: 'adUnit1',
392
+ ortb2Imp: {
393
+ ext: {
394
+ data: {
395
+ pbadslot: '12345'
396
+ },
397
+ gpid: '12345'
398
+ }
399
+ }
400
+ },
401
+ // second adunit
402
+ {
403
+ code: 'adUnit2',
404
+ ortb2Imp: {
405
+ ext: {
406
+ data: {
407
+ },
408
+ }
409
+ }
410
+ }, {
411
+ code: 'slotCode3',
412
+ ortb2Imp: {
413
+ ext: {
414
+ data: {
415
+ pbadslot: 'slotCode3',
416
+ adserver: {
417
+ name: 'gam',
418
+ adslot: 'slotCode3'
419
+ }
420
+ },
421
+ gpid: 'slotCode3'
422
+ }
423
+ }
424
+ }, {
425
+ code: 'div4',
426
+ ortb2Imp: {
427
+ ext: {
428
+ data: {
429
+ pbadslot: 'slotCode4#div4',
430
+ adserver: {
431
+ name: 'gam',
432
+ adslot: 'slotCode4'
433
+ }
434
+ },
435
+ gpid: 'slotCode4#div4'
436
+ }
437
+ }
438
+ }];
439
+
440
+ window.googletag.pubads().setSlots(testSlots);
441
+ runMakeBidRequests(testAdUnits);
442
+ expect(returnedAdUnits).to.deep.equal(expectedAdUnits);
443
+ });
269
444
  });
270
445
  });