prebid.js 7.30.0 → 7.32.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 (197) 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/adkernelBidAdapter.js +1 -1
  7. package/dist/adlooxRtdProvider.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/aidemBidAdapter.js +1 -1
  12. package/dist/ajaBidAdapter.js +1 -1
  13. package/dist/alkimiBidAdapter.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/appushBidAdapter.js +1 -0
  20. package/dist/asoBidAdapter.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/bridgewellBidAdapter.js +1 -1
  25. package/dist/brightMountainMediaBidAdapter.js +1 -1
  26. package/dist/carodaBidAdapter.js +1 -1
  27. package/dist/chtnwBidAdapter.js +1 -1
  28. package/dist/concertBidAdapter.js +1 -1
  29. package/dist/confiantRtdProvider.js +1 -0
  30. package/dist/connectIdSystem.js +1 -1
  31. package/dist/connectadBidAdapter.js +1 -1
  32. package/dist/consumableBidAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/craftBidAdapter.js +1 -1
  35. package/dist/criteoBidAdapter.js +1 -1
  36. package/dist/datawrkzBidAdapter.js +1 -1
  37. package/dist/dspxBidAdapter.js +1 -1
  38. package/dist/eplanningBidAdapter.js +1 -1
  39. package/dist/feedadBidAdapter.js +1 -1
  40. package/dist/finativeBidAdapter.js +1 -1
  41. package/dist/glimpseBidAdapter.js +1 -1
  42. package/dist/gmosspBidAdapter.js +1 -1
  43. package/dist/goldbachBidAdapter.js +1 -1
  44. package/dist/gridBidAdapter.js +1 -1
  45. package/dist/gridNMBidAdapter.js +1 -1
  46. package/dist/gumgumBidAdapter.js +1 -1
  47. package/dist/h12mediaBidAdapter.js +1 -1
  48. package/dist/holidBidAdapter.js +1 -0
  49. package/dist/id5IdSystem.js +1 -1
  50. package/dist/improvedigitalBidAdapter.js +1 -1
  51. package/dist/inmarBidAdapter.js +1 -1
  52. package/dist/insticatorBidAdapter.js +1 -1
  53. package/dist/ixBidAdapter.js +1 -1
  54. package/dist/justpremiumBidAdapter.js +1 -1
  55. package/dist/jwplayerVideoProvider.js +1 -1
  56. package/dist/konduitAnalyticsAdapter.js +1 -1
  57. package/dist/kueezBidAdapter.js +1 -1
  58. package/dist/kueezRtbBidAdapter.js +1 -1
  59. package/dist/lassoBidAdapter.js +1 -1
  60. package/dist/lifestreetBidAdapter.js +1 -1
  61. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  62. package/dist/logicadBidAdapter.js +1 -1
  63. package/dist/loglyliftBidAdapter.js +1 -1
  64. package/dist/magniteAnalyticsAdapter.js +1 -1
  65. package/dist/malltvAnalyticsAdapter.js +1 -1
  66. package/dist/marsmediaBidAdapter.js +1 -1
  67. package/dist/mediafuseBidAdapter.js +1 -1
  68. package/dist/medianetRtdProvider.js +1 -1
  69. package/dist/mediasquareBidAdapter.js +1 -1
  70. package/dist/mgidBidAdapter.js +1 -1
  71. package/dist/minutemediaBidAdapter.js +1 -1
  72. package/dist/nexx360BidAdapter.js +1 -1
  73. package/dist/not-for-prod/prebid.js +131 -127
  74. package/dist/oguryBidAdapter.js +1 -1
  75. package/dist/onetagBidAdapter.js +1 -1
  76. package/dist/ooloAnalyticsAdapter.js +1 -1
  77. package/dist/orbitsoftBidAdapter.js +1 -0
  78. package/dist/outbrainBidAdapter.js +1 -1
  79. package/dist/parrableIdSystem.js +1 -1
  80. package/dist/pbsExtensions.js +1 -1
  81. package/dist/permutiveRtdProvider.js +1 -1
  82. package/dist/pixfutureBidAdapter.js +1 -1
  83. package/dist/prebid-core.js +1 -1
  84. package/dist/prebidServerBidAdapter.js +1 -1
  85. package/dist/publinkIdSystem.js +1 -1
  86. package/dist/pubmaticBidAdapter.js +1 -1
  87. package/dist/pubwiseAnalyticsAdapter.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/rhythmoneBidAdapter.js +1 -1
  93. package/dist/riseBidAdapter.js +1 -1
  94. package/dist/rubiconAnalyticsAdapter.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/sharethroughAnalyticsAdapter.js +1 -1
  99. package/dist/sharethroughBidAdapter.js +1 -1
  100. package/dist/shinezBidAdapter.js +1 -1
  101. package/dist/smaatoBidAdapter.js +1 -1
  102. package/dist/smartadserverBidAdapter.js +1 -1
  103. package/dist/smartxBidAdapter.js +1 -1
  104. package/dist/smilewantedBidAdapter.js +1 -1
  105. package/dist/sonobiBidAdapter.js +1 -1
  106. package/dist/sovrnAnalyticsAdapter.js +1 -1
  107. package/dist/sovrnBidAdapter.js +1 -1
  108. package/dist/sspBCBidAdapter.js +1 -1
  109. package/dist/sublimeBidAdapter.js +1 -1
  110. package/dist/synacormediaBidAdapter.js +1 -1
  111. package/dist/taboolaBidAdapter.js +1 -1
  112. package/dist/targetVideoBidAdapter.js +1 -1
  113. package/dist/teadsBidAdapter.js +1 -1
  114. package/dist/trionBidAdapter.js +1 -1
  115. package/dist/tripleliftBidAdapter.js +1 -1
  116. package/dist/ttdBidAdapter.js +1 -1
  117. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  118. package/dist/uid2IdSystem.js +1 -1
  119. package/dist/underdogmediaBidAdapter.js +1 -1
  120. package/dist/undertoneBidAdapter.js +1 -1
  121. package/dist/vidazooBidAdapter.js +1 -1
  122. package/dist/videobyteBidAdapter.js +1 -1
  123. package/dist/visxBidAdapter.js +1 -1
  124. package/dist/vuukleBidAdapter.js +1 -1
  125. package/dist/widespaceBidAdapter.js +1 -1
  126. package/dist/winrBidAdapter.js +1 -1
  127. package/dist/yahoosspBidAdapter.js +1 -1
  128. package/dist/yieldlabBidAdapter.js +1 -1
  129. package/dist/yieldmoBidAdapter.js +1 -1
  130. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  131. package/integrationExamples/gpt/adloox.html +5 -0
  132. package/libraries/pbsExtensions/processors/adUnitCode.js +13 -0
  133. package/libraries/pbsExtensions/processors/pbs.js +5 -0
  134. package/modules/.submodules.json +1 -0
  135. package/modules/adagioBidAdapter.js +0 -4
  136. package/modules/adagioBidAdapter.md +4 -22
  137. package/modules/adkernelBidAdapter.js +2 -1
  138. package/modules/adlooxAnalyticsAdapter.md +5 -3
  139. package/modules/adlooxRtdProvider.js +82 -278
  140. package/modules/adlooxRtdProvider.md +6 -6
  141. package/modules/aidemBidAdapter.js +4 -0
  142. package/modules/aidemBidAdapter.md +1 -0
  143. package/modules/alkimiBidAdapter.js +23 -6
  144. package/modules/aolBidAdapter.js +12 -0
  145. package/modules/appnexusBidAdapter.js +2 -2
  146. package/modules/appushBidAdapter.js +188 -0
  147. package/modules/appushBidAdapter.md +79 -0
  148. package/modules/asoBidAdapter.js +8 -5
  149. package/modules/confiantRtdProvider.js +128 -0
  150. package/modules/confiantRtdProvider.md +45 -0
  151. package/modules/connectIdSystem.js +15 -1
  152. package/modules/datawrkzBidAdapter.js +24 -4
  153. package/modules/feedadBidAdapter.js +17 -7
  154. package/modules/holidBidAdapter.js +170 -0
  155. package/modules/holidBidAdapter.md +36 -0
  156. package/modules/jwplayerVideoProvider.js +10 -3
  157. package/modules/kueezRtbBidAdapter.js +21 -8
  158. package/modules/medianetRtdProvider.js +4 -4
  159. package/modules/nexx360BidAdapter.js +5 -7
  160. package/modules/orbitsoftBidAdapter.js +150 -0
  161. package/modules/permutiveRtdProvider.js +1 -1
  162. package/modules/prebidServerBidAdapter/ortbConverter.js +1 -0
  163. package/modules/riseBidAdapter.js +2 -1
  164. package/modules/riseBidAdapter.md +2 -0
  165. package/modules/seedtagBidAdapter.js +12 -0
  166. package/modules/smartxBidAdapter.js +6 -0
  167. package/modules/taboolaBidAdapter.js +61 -14
  168. package/modules/yahoosspBidAdapter.js +5 -0
  169. package/modules/yieldlabBidAdapter.js +150 -134
  170. package/modules/yieldmoBidAdapter.js +1 -12
  171. package/package.json +1 -1
  172. package/src/adloader.js +2 -1
  173. package/src/prebid.js +7 -8
  174. package/test/spec/modules/adagioBidAdapter_spec.js +1 -28
  175. package/test/spec/modules/adlooxRtdProvider_spec.js +28 -120
  176. package/test/spec/modules/aidemBidAdapter_spec.js +10 -2
  177. package/test/spec/modules/alkimiBidAdapter_spec.js +15 -3
  178. package/test/spec/modules/aolBidAdapter_spec.js +22 -0
  179. package/test/spec/modules/appnexusBidAdapter_spec.js +7 -3
  180. package/test/spec/modules/appushBidAdapter_spec.js +372 -0
  181. package/test/spec/modules/confiantRtdProvider_spec.js +107 -0
  182. package/test/spec/modules/connectIdSystem_spec.js +17 -5
  183. package/test/spec/modules/feedadBidAdapter_spec.js +60 -13
  184. package/test/spec/modules/holidBidAdapter_spec.js +165 -0
  185. package/test/spec/modules/kueezRtbBidAdapter_spec.js +147 -24
  186. package/test/spec/modules/medianetRtdProvider_spec.js +3 -3
  187. package/test/spec/modules/orbitsoftBidAdapter_spec.js +255 -0
  188. package/test/spec/modules/riseBidAdapter_spec.js +7 -0
  189. package/test/spec/modules/seedtagBidAdapter_spec.js +56 -10
  190. package/test/spec/modules/smartxBidAdapter_spec.js +10 -0
  191. package/test/spec/modules/taboolaBidAdapter_spec.js +142 -5
  192. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +45 -10
  193. package/test/spec/modules/yahoosspBidAdapter_spec.js +16 -1
  194. package/test/spec/modules/yieldlabBidAdapter_spec.js +311 -301
  195. package/test/spec/modules/yieldmoBidAdapter_spec.js +70 -0
  196. package/test/spec/ortbConverter/pbsExtensions/adUnitCode_spec.js +23 -0
  197. package/test/spec/unit/pbjs_api_spec.js +11 -0
@@ -0,0 +1,255 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/orbitsoftBidAdapter.js';
3
+
4
+ const ENDPOINT_URL = 'https://orbitsoft.com/php/ads/hb.phps';
5
+ const REFERRER_URL = 'http://referrer.url/?_=';
6
+
7
+ describe('Orbitsoft adapter', function () {
8
+ describe('implementation', function () {
9
+ describe('for requests', function () {
10
+ it('should accept valid bid', function () {
11
+ let validBid = {
12
+ bidder: 'orbitsoft',
13
+ params: {
14
+ placementId: '123',
15
+ requestUrl: ENDPOINT_URL
16
+ }
17
+ },
18
+ isValid = spec.isBidRequestValid(validBid);
19
+
20
+ expect(isValid).to.equal(true);
21
+ });
22
+
23
+ it('should reject invalid bid', function () {
24
+ let invalidBid = {
25
+ bidder: 'orbitsoft'
26
+ },
27
+ isValid = spec.isBidRequestValid(invalidBid);
28
+
29
+ expect(isValid).to.equal(false);
30
+ });
31
+ });
32
+ describe('for requests', function () {
33
+ it('should accept valid bid with styles', function () {
34
+ let validBid = {
35
+ bidder: 'orbitsoft',
36
+ params: {
37
+ placementId: '123',
38
+ requestUrl: ENDPOINT_URL,
39
+ style: {
40
+ title: {
41
+ family: 'Tahoma',
42
+ size: 'medium',
43
+ weight: 'normal',
44
+ style: 'normal',
45
+ color: '0053F9'
46
+ },
47
+ description: {
48
+ family: 'Tahoma',
49
+ size: 'medium',
50
+ weight: 'normal',
51
+ style: 'normal',
52
+ color: '0053F9'
53
+ },
54
+ url: {
55
+ family: 'Tahoma',
56
+ size: 'medium',
57
+ weight: 'normal',
58
+ style: 'normal',
59
+ color: '0053F9'
60
+ },
61
+ colors: {
62
+ background: 'ffffff',
63
+ border: 'E0E0E0',
64
+ link: '5B99FE'
65
+ }
66
+ }
67
+ },
68
+ refererInfo: {referer: REFERRER_URL},
69
+ },
70
+ isValid = spec.isBidRequestValid(validBid);
71
+ expect(isValid).to.equal(true);
72
+
73
+ let buildRequest = spec.buildRequests([validBid])[0];
74
+ let requestUrl = buildRequest.url;
75
+ let requestUrlParams = buildRequest.data;
76
+ expect(requestUrl).to.equal(ENDPOINT_URL);
77
+ expect(requestUrlParams).have.property('f1', 'Tahoma');
78
+ expect(requestUrlParams).have.property('fs1', 'medium');
79
+ expect(requestUrlParams).have.property('w1', 'normal');
80
+ expect(requestUrlParams).have.property('s1', 'normal');
81
+ expect(requestUrlParams).have.property('c3', '0053F9');
82
+ expect(requestUrlParams).have.property('f2', 'Tahoma');
83
+ expect(requestUrlParams).have.property('fs2', 'medium');
84
+ expect(requestUrlParams).have.property('w2', 'normal');
85
+ expect(requestUrlParams).have.property('s2', 'normal');
86
+ expect(requestUrlParams).have.property('c4', '0053F9');
87
+ expect(requestUrlParams).have.property('f3', 'Tahoma');
88
+ expect(requestUrlParams).have.property('fs3', 'medium');
89
+ expect(requestUrlParams).have.property('w3', 'normal');
90
+ expect(requestUrlParams).have.property('s3', 'normal');
91
+ expect(requestUrlParams).have.property('c5', '0053F9');
92
+ expect(requestUrlParams).have.property('c2', 'ffffff');
93
+ expect(requestUrlParams).have.property('c1', 'E0E0E0');
94
+ expect(requestUrlParams).have.property('c6', '5B99FE');
95
+ });
96
+
97
+ it('should accept valid bid with custom params', function () {
98
+ let validBid = {
99
+ bidder: 'orbitsoft',
100
+ params: {
101
+ placementId: '123',
102
+ requestUrl: ENDPOINT_URL,
103
+ customParams: {
104
+ cacheBuster: 'bf4d7c1',
105
+ clickUrl: 'http://testclickurl.com'
106
+ }
107
+ },
108
+ refererInfo: {referer: REFERRER_URL},
109
+ },
110
+ isValid = spec.isBidRequestValid(validBid);
111
+ expect(isValid).to.equal(true);
112
+
113
+ let buildRequest = spec.buildRequests([validBid])[0];
114
+ let requestUrlCustomParams = buildRequest.data;
115
+ expect(requestUrlCustomParams).have.property('c.cacheBuster', 'bf4d7c1');
116
+ expect(requestUrlCustomParams).have.property('c.clickUrl', 'http://testclickurl.com');
117
+ });
118
+
119
+ it('should reject invalid bid without requestUrl', function () {
120
+ let invalidBid = {
121
+ bidder: 'orbitsoft',
122
+ params: {
123
+ placementId: '123'
124
+ }
125
+ },
126
+ isValid = spec.isBidRequestValid(invalidBid);
127
+
128
+ expect(isValid).to.equal(false);
129
+ });
130
+
131
+ it('should reject invalid bid without placementId', function () {
132
+ let invalidBid = {
133
+ bidder: 'orbitsoft',
134
+ params: {
135
+ requestUrl: ENDPOINT_URL
136
+ }
137
+ },
138
+ isValid = spec.isBidRequestValid(invalidBid);
139
+
140
+ expect(isValid).to.equal(false);
141
+ });
142
+ });
143
+ describe('bid responses', function () {
144
+ it('should return complete bid response', function () {
145
+ let serverResponse = {
146
+ body: {
147
+ callback_uid: '265b29b70cc106',
148
+ cpm: 0.5,
149
+ width: 240,
150
+ height: 240,
151
+ content_url: 'https://orbitsoft.com/php/ads/hb.html',
152
+ adomain: ['test.adomain.tld']
153
+ }
154
+ };
155
+
156
+ let bidRequests = [
157
+ {
158
+ bidder: 'orbitsoft',
159
+ params: {
160
+ placementId: '123',
161
+ requestUrl: ENDPOINT_URL
162
+ }
163
+ }
164
+ ];
165
+ let bids = spec.interpretResponse(serverResponse, {'bidRequest': bidRequests[0]});
166
+ expect(bids).to.be.lengthOf(1);
167
+ expect(bids[0].cpm).to.equal(serverResponse.body.cpm);
168
+ expect(bids[0].width).to.equal(serverResponse.body.width);
169
+ expect(bids[0].height).to.equal(serverResponse.body.height);
170
+ expect(bids[0].currency).to.equal('USD');
171
+ expect(bids[0].netRevenue).to.equal(true);
172
+ expect(bids[0].adUrl).to.have.length.above(1);
173
+ expect(bids[0].adUrl).to.have.string('https://orbitsoft.com/php/ads/hb.html');
174
+ expect(Object.keys(bids[0].meta)).to.include.members(['advertiserDomains']);
175
+ expect(bids[0].meta.advertiserDomains).to.deep.equal(serverResponse.body.adomain);
176
+ });
177
+
178
+ it('should return empty bid response', function () {
179
+ let bidRequests = [
180
+ {
181
+ bidder: 'orbitsoft',
182
+ params: {
183
+ placementId: '123',
184
+ requestUrl: ENDPOINT_URL
185
+ }
186
+ }
187
+ ];
188
+ let serverResponse = {
189
+ body: {
190
+ callback_uid: '265b29b70cc106',
191
+ cpm: 0
192
+ }
193
+ },
194
+ bids = spec.interpretResponse(serverResponse, {'bidRequest': bidRequests[0]});
195
+
196
+ expect(bids).to.be.lengthOf(0);
197
+ });
198
+
199
+ it('should return empty bid response on incorrect size', function () {
200
+ let bidRequests = [
201
+ {
202
+ bidder: 'orbitsoft',
203
+ params: {
204
+ placementId: '123',
205
+ requestUrl: ENDPOINT_URL
206
+ }
207
+ }
208
+ ];
209
+ let serverResponse = {
210
+ body: {
211
+ callback_uid: '265b29b70cc106',
212
+ cpm: 1.5,
213
+ width: 0,
214
+ height: 0
215
+ }
216
+ },
217
+ bids = spec.interpretResponse(serverResponse, {'bidRequest': bidRequests[0]});
218
+
219
+ expect(bids).to.be.lengthOf(0);
220
+ });
221
+
222
+ it('should return empty bid response with error', function () {
223
+ let bidRequests = [
224
+ {
225
+ bidder: 'orbitsoft',
226
+ params: {
227
+ placementId: '123',
228
+ requestUrl: ENDPOINT_URL
229
+ }
230
+ }
231
+ ];
232
+ let serverResponse = {error: 'error'},
233
+ bids = spec.interpretResponse(serverResponse, {'bidRequest': bidRequests[0]});
234
+
235
+ expect(bids).to.be.lengthOf(0);
236
+ });
237
+
238
+ it('should return empty bid response on empty body', function () {
239
+ let bidRequests = [
240
+ {
241
+ bidder: 'orbitsoft',
242
+ params: {
243
+ placementId: '123',
244
+ requestUrl: ENDPOINT_URL
245
+ }
246
+ }
247
+ ];
248
+ let serverResponse = {},
249
+ bids = spec.interpretResponse(serverResponse, {'bidRequest': bidRequests[0]});
250
+
251
+ expect(bids).to.be.lengthOf(0);
252
+ });
253
+ });
254
+ });
255
+ });
@@ -116,6 +116,13 @@ describe('riseAdapter', function () {
116
116
  expect(request.data.bids[0].placementId).to.equal(placementId);
117
117
  });
118
118
 
119
+ it('sends the is_wrapper parameter to ENDPOINT via POST', function() {
120
+ const request = spec.buildRequests(bidRequests, bidderRequest);
121
+ expect(request.data.params).to.be.an('object');
122
+ expect(request.data.params).to.have.property('is_wrapper');
123
+ expect(request.data.params.is_wrapper).to.equal(false);
124
+ });
125
+
119
126
  it('sends bid request to ENDPOINT via POST', function () {
120
127
  const request = spec.buildRequests(bidRequests, bidderRequest);
121
128
  expect(request.url).to.equal(ENDPOINT);
@@ -395,6 +395,52 @@ describe('Seedtag Adapter', function () {
395
395
  expect(payload.schain).to.not.exist;
396
396
  });
397
397
  });
398
+
399
+ describe('GPP param', function () {
400
+ it('should be added to payload when bidderRequest has gppConsent param', function () {
401
+ const gppConsent = {
402
+ gppString: 'someGppString',
403
+ applicableSections: [7]
404
+ }
405
+ bidderRequest['gppConsent'] = gppConsent
406
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
407
+ const data = JSON.parse(request.data);
408
+ expect(data.gppConsent).to.exist;
409
+ expect(data.gppConsent.gppString).to.equal(gppConsent.gppString);
410
+ expect(data.gppConsent.applicableSections[0]).to.equal(gppConsent.applicableSections[0]);
411
+ });
412
+
413
+ it('should be undefined on payload when bidderRequest has not gppConsent param', function () {
414
+ bidderRequest.gppConsent = undefined
415
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
416
+ const data = JSON.parse(request.data);
417
+ expect(data.gppConsent).to.be.undefined;
418
+ });
419
+
420
+ it('should be added to payload when bidderRequest has ortb2 param', function () {
421
+ const ortb2 = {
422
+ regs: {
423
+ gpp: 'someGppString',
424
+ gpp_sid: [7]
425
+ }
426
+ }
427
+ bidderRequest['gppConsent'] = undefined
428
+ bidderRequest['ortb2'] = ortb2;
429
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
430
+ const data = JSON.parse(request.data);
431
+ expect(data.gppConsent).to.exist;
432
+ expect(data.gppConsent.gppString).to.equal(ortb2.regs.gpp);
433
+ expect(data.gppConsent.applicableSections[0]).to.equal(ortb2.regs.gpp_sid[0]);
434
+ });
435
+
436
+ it('should be added to payload when bidderRequest has neither gppConsent nor ortb2', function () {
437
+ bidderRequest['ortb2'] = undefined;
438
+ bidderRequest['gppConsent'] = undefined;
439
+ const request = spec.buildRequests(validBidRequests, bidderRequest);
440
+ const data = JSON.parse(request.data);
441
+ expect(data.gppConsent).to.be.undefined;
442
+ });
443
+ });
398
444
  });
399
445
 
400
446
  describe('interpret response method', function () {
@@ -533,11 +579,11 @@ describe('Seedtag Adapter', function () {
533
579
  const timeoutUrl = getTimeoutUrl(timeoutData);
534
580
  expect(timeoutUrl).to.equal(
535
581
  'https://s.seedtag.com/se/hb/timeout?publisherToken=' +
536
- params.publisherId +
537
- '&adUnitId=' +
538
- params.adUnitId +
539
- '&timeout=' +
540
- timeout
582
+ params.publisherId +
583
+ '&adUnitId=' +
584
+ params.adUnitId +
585
+ '&timeout=' +
586
+ timeout
541
587
  );
542
588
  });
543
589
 
@@ -549,11 +595,11 @@ describe('Seedtag Adapter', function () {
549
595
  expect(
550
596
  utils.triggerPixel.calledWith(
551
597
  'https://s.seedtag.com/se/hb/timeout?publisherToken=' +
552
- params.publisherId +
553
- '&adUnitId=' +
554
- params.adUnitId +
555
- '&timeout=' +
556
- timeout
598
+ params.publisherId +
599
+ '&adUnitId=' +
600
+ params.adUnitId +
601
+ '&timeout=' +
602
+ timeout
557
603
  )
558
604
  ).to.equal(true);
559
605
  });
@@ -374,6 +374,16 @@ describe('The smartx adapter', function () {
374
374
  }
375
375
  })
376
376
  });
377
+
378
+ it('should pass sitekey param', function () {
379
+ var request;
380
+
381
+ bid.params.sitekey = 'foo'
382
+
383
+ request = spec.buildRequests([bid], bidRequestObj)[0];
384
+
385
+ expect(request.data.site.content.ext.sitekey).to.equal('foo');
386
+ });
377
387
  });
378
388
 
379
389
  describe('interpretResponse', function () {
@@ -2,6 +2,7 @@ import {expect} from 'chai';
2
2
  import {spec, internal, END_POINT_URL, userData} from 'modules/taboolaBidAdapter.js';
3
3
  import {config} from '../../../src/config'
4
4
  import * as utils from '../../../src/utils'
5
+ import {server} from '../../mocks/xhr'
5
6
 
6
7
  describe('Taboola Adapter', function () {
7
8
  let hasLocalStorage, cookiesAreEnabled, getDataFromLocalStorage, localStorageIsEnabled, getCookie, commonBidRequest;
@@ -91,6 +92,31 @@ describe('Taboola Adapter', function () {
91
92
  })
92
93
  })
93
94
 
95
+ describe('onBidWon', function () {
96
+ it('onBidWon exist as a function', () => {
97
+ expect(spec.onBidWon).to.exist.and.to.be.a('function');
98
+ });
99
+
100
+ it('should resolve price macro in nurl', function () {
101
+ const nurl = 'http://win.example.com/${AUCTION_PRICE}';
102
+ const bid = {
103
+ requestId: 1,
104
+ cpm: 2,
105
+ originalCpm: 3.4,
106
+ creativeId: 1,
107
+ ttl: 60,
108
+ netRevenue: true,
109
+ mediaType: 'banner',
110
+ ad: '...',
111
+ width: 300,
112
+ height: 250,
113
+ nurl: nurl
114
+ }
115
+ spec.onBidWon(bid);
116
+ expect(server.requests[0].url).to.equals('http://win.example.com/3.4')
117
+ });
118
+ });
119
+
94
120
  describe('buildRequests', function () {
95
121
  const defaultBidRequest = {
96
122
  ...createBidRequest(),
@@ -122,7 +148,8 @@ describe('Taboola Adapter', function () {
122
148
  },
123
149
  'tagid': commonBidRequest.params.tagId,
124
150
  'bidfloor': null,
125
- 'bidfloorcur': 'USD'
151
+ 'bidfloorcur': 'USD',
152
+ 'ext': {}
126
153
  }],
127
154
  'site': {
128
155
  'id': commonBidRequest.params.publisherId,
@@ -137,11 +164,13 @@ describe('Taboola Adapter', function () {
137
164
  'source': {'fd': 1},
138
165
  'bcat': [],
139
166
  'badv': [],
167
+ 'wlang': [],
140
168
  'user': {
141
169
  'buyeruid': 0,
142
170
  'ext': {},
143
171
  },
144
- 'regs': {'coppa': 0, 'ext': {}}
172
+ 'regs': {'coppa': 0, 'ext': {}},
173
+ 'ext': {}
145
174
  };
146
175
 
147
176
  const res = spec.buildRequests([defaultBidRequest], commonBidderRequest);
@@ -184,7 +213,7 @@ describe('Taboola Adapter', function () {
184
213
  expect(resData.imp[0].bidfloorcur).to.deep.equal('USD');
185
214
  });
186
215
 
187
- it('should pass bid floor even if they is a bid floor param', function () {
216
+ it('should pass bid floor even if it is a bid floor param', function () {
188
217
  const optionalParams = {
189
218
  bidfloor: 0.25,
190
219
  bidfloorcur: 'EUR'
@@ -206,6 +235,38 @@ describe('Taboola Adapter', function () {
206
235
  expect(resData.imp[0].bidfloorcur).to.deep.equal('USD');
207
236
  });
208
237
 
238
+ it('should pass impression position', function () {
239
+ const optionalParams = {
240
+ position: 2
241
+ };
242
+
243
+ const bidRequest = {
244
+ ...defaultBidRequest,
245
+ params: {...commonBidRequest.params, ...optionalParams}
246
+ };
247
+
248
+ const res = spec.buildRequests([bidRequest], commonBidderRequest);
249
+ const resData = JSON.parse(res.data);
250
+ expect(resData.imp[0].banner.pos).to.deep.equal(2);
251
+ });
252
+
253
+ it('should pass gpid if configured', function () {
254
+ const ortb2Imp = {
255
+ ext: {
256
+ gpid: '/homepage/#1'
257
+ }
258
+ }
259
+ const bidRequest = {
260
+ ...defaultBidRequest,
261
+ ortb2Imp: ortb2Imp,
262
+ params: {...commonBidRequest.params}
263
+ };
264
+
265
+ const res = spec.buildRequests([bidRequest], commonBidderRequest);
266
+ const resData = JSON.parse(res.data);
267
+ expect(resData.imp[0].ext.gpid).to.deep.equal('/homepage/#1');
268
+ });
269
+
209
270
  it('should pass bidder timeout', function () {
210
271
  const bidderRequest = {
211
272
  ...commonBidderRequest,
@@ -216,6 +277,40 @@ describe('Taboola Adapter', function () {
216
277
  expect(resData.tmax).to.equal(500);
217
278
  });
218
279
 
280
+ describe('first party data', function () {
281
+ it('should parse first party data', function () {
282
+ const bidderRequest = {
283
+ ...commonBidderRequest,
284
+ ortb2: {
285
+ bcat: ['EX1', 'EX2', 'EX3'],
286
+ badv: ['site.com'],
287
+ wlang: ['de'],
288
+ }
289
+ }
290
+ const res = spec.buildRequests([defaultBidRequest], bidderRequest);
291
+ const resData = JSON.parse(res.data);
292
+ expect(resData.bcat).to.deep.equal(bidderRequest.ortb2.bcat)
293
+ expect(resData.badv).to.deep.equal(bidderRequest.ortb2.badv)
294
+ expect(resData.wlang).to.deep.equal(bidderRequest.ortb2.wlang)
295
+ });
296
+
297
+ it('should pass pageType if exists in ortb2', function () {
298
+ const bidderRequest = {
299
+ ...commonBidderRequest,
300
+ ortb2: {
301
+ ext: {
302
+ data: {
303
+ pageType: 'news'
304
+ }
305
+ }
306
+ }
307
+ }
308
+ const res = spec.buildRequests([defaultBidRequest], bidderRequest);
309
+ const resData = JSON.parse(res.data);
310
+ expect(resData.ext.pageType).to.deep.equal(bidderRequest.ortb2.ext.data.pageType);
311
+ });
312
+ });
313
+
219
314
  describe('handle privacy segments when building request', function () {
220
315
  it('should pass GDPR consent', function () {
221
316
  const bidderRequest = {
@@ -234,6 +329,20 @@ describe('Taboola Adapter', function () {
234
329
  expect(resData.regs.ext.gdpr).to.equal(1)
235
330
  });
236
331
 
332
+ it('should pass GPP consent if exist in ortb2', function () {
333
+ const ortb2 = {
334
+ regs: {
335
+ gpp: 'testGpp',
336
+ gpp_sid: [1, 2, 3]
337
+ }
338
+ }
339
+
340
+ const res = spec.buildRequests([defaultBidRequest], {...commonBidderRequest, ortb2})
341
+ const resData = JSON.parse(res.data)
342
+ expect(resData.regs.ext.gpp).to.equal('testGpp')
343
+ expect(resData.regs.ext.gpp_sid).to.deep.equal([1, 2, 3])
344
+ });
345
+
237
346
  it('should pass us privacy consent', function () {
238
347
  const bidderRequest = {
239
348
  refererInfo: {
@@ -552,8 +661,36 @@ describe('Taboola Adapter', function () {
552
661
  });
553
662
  })
554
663
 
555
- describe('userData', function () {
556
- // todo: add UT for getUserSyncs
664
+ describe('getUserSyncs', function () {
665
+ const usersyncUrl = 'https://trc.taboola.com/sg/prebidJS/1/cm';
666
+
667
+ it('should not return user sync if pixelEnabled is false', function () {
668
+ const res = spec.getUserSyncs({pixelEnabled: false});
669
+ expect(res).to.be.an('array').that.is.empty;
670
+ });
671
+
672
+ it('should return user sync if pixelEnabled is true', function () {
673
+ const res = spec.getUserSyncs({pixelEnabled: true});
674
+ expect(res).to.deep.equal([{type: 'image', url: usersyncUrl}]);
675
+ });
676
+
677
+ it('should pass consent tokens values', function() {
678
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: true, consentString: 'GDPR_CONSENT'}, 'USP_CONSENT')).to.deep.equal([{
679
+ type: 'image', url: `${usersyncUrl}?gdpr=1&gdpr_consent=GDPR_CONSENT&us_privacy=USP_CONSENT`
680
+ }]);
681
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: false, consentString: undefined}, undefined)).to.deep.equal([{
682
+ type: 'image', url: `${usersyncUrl}?gdpr=0&gdpr_consent=`
683
+ }]);
684
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {gdprApplies: false, consentString: undefined}, undefined)).to.deep.equal([{
685
+ type: 'image', url: `${usersyncUrl}?gdpr=0&gdpr_consent=`
686
+ }]);
687
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined, 'USP_CONSENT')).to.deep.equal([{
688
+ type: 'image', url: `${usersyncUrl}?us_privacy=USP_CONSENT`
689
+ }]);
690
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined, 'USP_CONSENT', 'GPP_STRING')).to.deep.equal([{
691
+ type: 'image', url: `${usersyncUrl}?us_privacy=USP_CONSENT&gpp=GPP_STRING`
692
+ }]);
693
+ });
557
694
  })
558
695
 
559
696
  describe('internal functions', function () {