prebid.js 7.48.0 → 7.50.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 (219) hide show
  1. package/README.md +3 -0
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/admixerBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/aidemBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/asoBidAdapter.js +1 -1
  19. package/dist/axonixBidAdapter.js +1 -1
  20. package/dist/beopBidAdapter.js +1 -1
  21. package/dist/bidglassBidAdapter.js +1 -1
  22. package/dist/big-richmediaBidAdapter.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/confiantRtdProvider.js +1 -1
  29. package/dist/connectadBidAdapter.js +1 -1
  30. package/dist/consumableBidAdapter.js +1 -1
  31. package/dist/conversantAnalyticsAdapter.js +1 -1
  32. package/dist/conversantBidAdapter.js +1 -1
  33. package/dist/craftBidAdapter.js +1 -1
  34. package/dist/criteoBidAdapter.js +1 -1
  35. package/dist/cwireBidAdapter.js +1 -1
  36. package/dist/dependencies.json +3 -0
  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/freewheel-sspBidAdapter.js +1 -1
  42. package/dist/glimpseBidAdapter.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/id5IdSystem.js +1 -1
  51. package/dist/improvedigitalBidAdapter.js +1 -1
  52. package/dist/inmarBidAdapter.js +1 -1
  53. package/dist/insticatorBidAdapter.js +1 -1
  54. package/dist/ixBidAdapter.js +1 -1
  55. package/dist/justpremiumBidAdapter.js +1 -1
  56. package/dist/kargoBidAdapter.js +1 -1
  57. package/dist/konduitAnalyticsAdapter.js +1 -1
  58. package/dist/kueezBidAdapter.js +1 -1
  59. package/dist/kueezRtbBidAdapter.js +1 -1
  60. package/dist/kulturemediaBidAdapter.js +1 -1
  61. package/dist/lassoBidAdapter.js +1 -1
  62. package/dist/lifestreetBidAdapter.js +1 -1
  63. package/dist/liveIntentIdSystem.js +1 -1
  64. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  65. package/dist/logicadBidAdapter.js +1 -1
  66. package/dist/loglyliftBidAdapter.js +1 -1
  67. package/dist/magniteAnalyticsAdapter.js +1 -1
  68. package/dist/malltvAnalyticsAdapter.js +1 -1
  69. package/dist/marsmediaBidAdapter.js +1 -1
  70. package/dist/mediafuseBidAdapter.js +1 -1
  71. package/dist/mediasquareBidAdapter.js +1 -1
  72. package/dist/mgidBidAdapter.js +1 -1
  73. package/dist/minutemediaBidAdapter.js +1 -1
  74. package/dist/minutemediaplusBidAdapter.js +1 -1
  75. package/dist/nexx360BidAdapter.js +1 -1
  76. package/dist/not-for-prod/prebid.js +136 -134
  77. package/dist/oguryBidAdapter.js +1 -1
  78. package/dist/onetagBidAdapter.js +1 -1
  79. package/dist/ooloAnalyticsAdapter.js +1 -1
  80. package/dist/optidigitalBidAdapter.js +1 -1
  81. package/dist/outbrainBidAdapter.js +1 -1
  82. package/dist/parrableIdSystem.js +1 -1
  83. package/dist/permutiveRtdProvider.js +1 -1
  84. package/dist/pixfutureBidAdapter.js +1 -1
  85. package/dist/prebid-core.js +1 -1
  86. package/dist/prebidServerBidAdapter.js +1 -1
  87. package/dist/publinkIdSystem.js +1 -1
  88. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  89. package/dist/pubmaticBidAdapter.js +1 -1
  90. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  91. package/dist/pxyzBidAdapter.js +1 -1
  92. package/dist/quantcastBidAdapter.js +1 -1
  93. package/dist/readpeakBidAdapter.js +1 -1
  94. package/dist/relaidoBidAdapter.js +1 -1
  95. package/dist/retailspotBidAdapter.js +1 -0
  96. package/dist/rhythmoneBidAdapter.js +1 -1
  97. package/dist/riseBidAdapter.js +1 -1
  98. package/dist/rubiconAnalyticsAdapter.js +1 -1
  99. package/dist/rubiconBidAdapter.js +1 -1
  100. package/dist/seedingAllianceBidAdapter.js +1 -1
  101. package/dist/seedtagBidAdapter.js +1 -1
  102. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  103. package/dist/sharethroughBidAdapter.js +1 -1
  104. package/dist/shinezBidAdapter.js +1 -1
  105. package/dist/silverpushBidAdapter.js +1 -0
  106. package/dist/smaatoBidAdapter.js +1 -1
  107. package/dist/smartadserverBidAdapter.js +1 -1
  108. package/dist/smartxBidAdapter.js +1 -1
  109. package/dist/smilewantedBidAdapter.js +1 -1
  110. package/dist/sonobiBidAdapter.js +1 -1
  111. package/dist/sovrnAnalyticsAdapter.js +1 -1
  112. package/dist/sovrnBidAdapter.js +1 -1
  113. package/dist/sspBCBidAdapter.js +1 -1
  114. package/dist/stvBidAdapter.js +1 -1
  115. package/dist/sublimeBidAdapter.js +1 -1
  116. package/dist/synacormediaBidAdapter.js +1 -1
  117. package/dist/targetVideoBidAdapter.js +1 -1
  118. package/dist/teadsBidAdapter.js +1 -1
  119. package/dist/trionBidAdapter.js +1 -1
  120. package/dist/tripleliftBidAdapter.js +1 -1
  121. package/dist/ttdBidAdapter.js +1 -1
  122. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  123. package/dist/uid2IdSystem.js +1 -1
  124. package/dist/underdogmediaBidAdapter.js +1 -1
  125. package/dist/undertoneBidAdapter.js +1 -1
  126. package/dist/vidazooBidAdapter.js +1 -1
  127. package/dist/video.js +1 -1
  128. package/dist/videoModule.js +1 -1
  129. package/dist/videobyteBidAdapter.js +1 -1
  130. package/dist/visxBidAdapter.js +1 -1
  131. package/dist/vuukleBidAdapter.js +1 -1
  132. package/dist/widespaceBidAdapter.js +1 -1
  133. package/dist/winrBidAdapter.js +1 -1
  134. package/dist/yahoosspBidAdapter.js +1 -1
  135. package/dist/yieldlabBidAdapter.js +1 -1
  136. package/dist/yieldmoBidAdapter.js +1 -1
  137. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  138. package/integrationExamples/videoModule/eventsUI/eventsUI.css +205 -0
  139. package/integrationExamples/videoModule/eventsUI/eventsUI.js +181 -0
  140. package/integrationExamples/videoModule/jwplayer/eventsUI.html +295 -0
  141. package/integrationExamples/videoModule/videojs/eventsUI.html +319 -0
  142. package/libraries/video/shared/helpers.js +14 -0
  143. package/modules/33acrossBidAdapter.js +1 -1
  144. package/modules/adgenerationBidAdapter.js +24 -15
  145. package/modules/admixerBidAdapter.js +15 -9
  146. package/modules/aidemBidAdapter.js +3 -1
  147. package/modules/appnexusBidAdapter.js +1 -0
  148. package/modules/beopBidAdapter.js +1 -0
  149. package/modules/confiantRtdProvider.js +15 -12
  150. package/modules/conversantAnalyticsAdapter.js +7 -5
  151. package/modules/conversantBidAdapter.js +1 -1
  152. package/modules/criteoBidAdapter.js +17 -1
  153. package/modules/gridBidAdapter.js +3 -0
  154. package/modules/ixBidAdapter.js +65 -47
  155. package/modules/kueezRtbBidAdapter.js +30 -33
  156. package/modules/liveIntentIdSystem.js +8 -4
  157. package/modules/magniteAnalyticsAdapter.js +26 -3
  158. package/modules/mgidBidAdapter.js +9 -8
  159. package/modules/minutemediaBidAdapter.js +6 -0
  160. package/modules/minutemediaplusBidAdapter.js +30 -32
  161. package/modules/nexx360BidAdapter.js +2 -1
  162. package/modules/permutiveRtdProvider.js +9 -38
  163. package/modules/prebidServerBidAdapter/index.js +1 -3
  164. package/modules/prebidServerBidAdapter/ortbConverter.js +5 -1
  165. package/modules/pubmaticAnalyticsAdapter.js +3 -2
  166. package/modules/retailspotBidAdapter .md +32 -0
  167. package/modules/retailspotBidAdapter.js +186 -0
  168. package/modules/riseBidAdapter.js +6 -0
  169. package/modules/rubiconBidAdapter.js +6 -2
  170. package/modules/silverpushBidAdapter.js +326 -0
  171. package/modules/silverpushBidAdapter.md +107 -0
  172. package/modules/ttdBidAdapter.js +23 -22
  173. package/modules/underdogmediaBidAdapter.js +2 -2
  174. package/modules/vidazooBidAdapter.js +28 -32
  175. package/modules/videoModule/adQueue.js +2 -2
  176. package/modules/videoModule/index.js +9 -5
  177. package/modules/yahoosspBidAdapter.js +6 -0
  178. package/modules/yahoosspBidAdapter.md +37 -0
  179. package/modules/yieldlabBidAdapter.js +27 -5
  180. package/package.json +1 -1
  181. package/src/adapterManager.js +4 -0
  182. package/src/adapters/bidderFactory.js +1 -0
  183. package/src/auction.js +2 -0
  184. package/src/prebid.js +36 -12
  185. package/src/utils/cpm.js +4 -1
  186. package/test/spec/modules/33acrossBidAdapter_spec.js +4 -3
  187. package/test/spec/modules/adgenerationBidAdapter_spec.js +6 -6
  188. package/test/spec/modules/admixerBidAdapter_spec.js +64 -25
  189. package/test/spec/modules/aidemBidAdapter_spec.js +3 -0
  190. package/test/spec/modules/beopBidAdapter_spec.js +4 -0
  191. package/test/spec/modules/confiantRtdProvider_spec.js +4 -1
  192. package/test/spec/modules/conversantBidAdapter_spec.js +2 -1
  193. package/test/spec/modules/criteoBidAdapter_spec.js +109 -0
  194. package/test/spec/modules/gridBidAdapter_spec.js +3 -0
  195. package/test/spec/modules/ixBidAdapter_spec.js +66 -1
  196. package/test/spec/modules/kueezRtbBidAdapter_spec.js +3 -2
  197. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +28 -0
  198. package/test/spec/modules/liveIntentIdSystem_spec.js +45 -0
  199. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +16 -36
  200. package/test/spec/modules/mass_spec.js +2 -0
  201. package/test/spec/modules/mgidBidAdapter_spec.js +9 -9
  202. package/test/spec/modules/minutemediaBidAdapter_spec.js +18 -0
  203. package/test/spec/modules/minutemediaplusBidAdapter_spec.js +3 -2
  204. package/test/spec/modules/permutiveRtdProvider_spec.js +0 -20
  205. package/test/spec/modules/prebidServerBidAdapter_spec.js +96 -1
  206. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +6 -1
  207. package/test/spec/modules/retailspotBidAdapter_spec.js +426 -0
  208. package/test/spec/modules/riseBidAdapter_spec.js +18 -0
  209. package/test/spec/modules/rubiconBidAdapter_spec.js +143 -67
  210. package/test/spec/modules/silverpushBidAdapter_spec.js +394 -0
  211. package/test/spec/modules/ttdBidAdapter_spec.js +129 -2
  212. package/test/spec/modules/underdogmediaBidAdapter_spec.js +1 -1
  213. package/test/spec/modules/vidazooBidAdapter_spec.js +3 -2
  214. package/test/spec/modules/videoModule/shared/helpers_spec.js +22 -0
  215. package/test/spec/modules/yahoosspBidAdapter_spec.js +60 -1
  216. package/test/spec/modules/yieldlabBidAdapter_spec.js +8 -1
  217. package/test/spec/unit/core/bidderFactory_spec.js +9 -9
  218. package/test/spec/unit/pbjs_api_spec.js +59 -1
  219. package/test/spec/unit/utils/cpm_spec.js +56 -1
@@ -0,0 +1,394 @@
1
+ import { expect } from 'chai';
2
+ import * as utils from 'src/utils';
3
+ import { newBidder } from 'src/adapters/bidderFactory.js';
4
+ import { REQUEST_URL, SP_OUTSTREAM_PLAYER_URL, CONVERTER, spec } from '../../../modules/silverpushBidAdapter.js';
5
+
6
+ const bannerBid = {
7
+ bidder: 'silverpush',
8
+ params: {
9
+ publisherId: '012345',
10
+ bidFloor: 1.5
11
+ },
12
+ mediaTypes: {
13
+ banner: {
14
+ sizes: [
15
+ [300, 250],
16
+ [300, 50],
17
+ ],
18
+ },
19
+ },
20
+ adUnitCode: 'div-gpt-ad-928572628472-0',
21
+ bidId: 'dl38fjf9d',
22
+ bidderRequestId: 'brid00000000',
23
+ auctionId: 'aucid0000000',
24
+ };
25
+
26
+ const videoBid = {
27
+ bidder: 'silverpush',
28
+ params: {
29
+ publisherId: '012345',
30
+ bidFloor: 0.1
31
+ },
32
+ mediaTypes: {
33
+ video: {
34
+ api: [1, 2, 4, 6],
35
+ mimes: ['video/mp4'],
36
+ playbackmethod: [2, 4, 6],
37
+ playerSize: [[1024, 768]],
38
+ protocols: [3, 4, 7, 8, 10],
39
+ placement: 1,
40
+ minduration: 0,
41
+ maxduration: 60,
42
+ startdelay: 0
43
+ },
44
+ },
45
+ adUnitCode: 'div-gpt-ad-928572628472-1',
46
+ bidId: '281141d3541362',
47
+ bidderRequestId: 'brid00000000',
48
+ auctionId: 'aucid0000000',
49
+ };
50
+
51
+ const bidderRequest = {
52
+ auctionId: 'aucid0000000',
53
+ bidderRequestId: 'brid00000000',
54
+ timeout: 200,
55
+ refererInfo: {
56
+ page: 'https://hello-world-page.com/',
57
+ domain: 'hello-world-page.com',
58
+ ref: 'http://example-domain.com/foo',
59
+ }
60
+ };
61
+
62
+ const bannerReponse = {
63
+ 'id': 'brid00000000',
64
+ 'seatbid': [
65
+ {
66
+ 'bid': [
67
+ {
68
+ 'id': 'ARUYoUZx',
69
+ 'impid': 'dl38fjf9d',
70
+ 'price': 1.64,
71
+ 'adid': 'aaaaadddddddd',
72
+ 'burl': 'http://0.0.0.0:8181/burl',
73
+ 'adm': '<div><img src="url_str"><div>',
74
+ 'adomain': [
75
+ 'https://www.exampleabc.com'
76
+ ],
77
+ 'iurl': 'https://example.example.com/2.png',
78
+ 'cid': 'aaaaadddddddd',
79
+ 'crid': 'aaaaadddddddd',
80
+ 'h': 250,
81
+ 'w': 300
82
+ }
83
+ ]
84
+ }
85
+ ],
86
+ 'bidid': 'ARUYoUZx',
87
+ 'cur': 'USD'
88
+ }
89
+
90
+ const videoResponse = {
91
+ 'id': 'brid00000000',
92
+ 'seatbid': [
93
+ {
94
+ 'bid': [
95
+ {
96
+ 'id': 'soCWeklh',
97
+ 'impid': '281141d3541362',
98
+ 'price': 1.09,
99
+ 'adid': 'outstream_video',
100
+ 'burl': 'http://0.0.0.0:8181/burl',
101
+ 'adm': '<VAST version="4.2"></VAST>\n',
102
+ 'adomain': [
103
+ 'https://www.exampleabc.com'
104
+ ],
105
+ 'cid': '229369649',
106
+ 'crid': 'aaaaadddddddd',
107
+ 'h': 768,
108
+ 'w': 1024
109
+ }
110
+ ]
111
+ }
112
+ ],
113
+ 'bidid': 'soCWeklh',
114
+ 'cur': 'USD'
115
+ }
116
+
117
+ describe('Silverpush Adapter', function () {
118
+ describe('isBidRequestValid()', () => {
119
+ it('should return false when publisherId is not defined', () => {
120
+ const bid = utils.deepClone(bannerBid);
121
+ delete bid.params.publisherId;
122
+
123
+ expect(spec.isBidRequestValid(bid)).to.be.false;
124
+ });
125
+
126
+ it('should return false when publisherId is empty string', () => {
127
+ const bid = utils.deepClone(bannerBid);
128
+ bid.params.publisherId = '';
129
+
130
+ expect(spec.isBidRequestValid(bid)).to.be.false;
131
+ });
132
+
133
+ it('should return false when publisherId is a number', () => {
134
+ const bid = utils.deepClone(bannerBid);
135
+ bid.params.publisherId = 12345;
136
+
137
+ expect(spec.isBidRequestValid(bid)).to.be.false;
138
+ });
139
+
140
+ it('should return false when there is no banner in mediaTypes', () => {
141
+ const bid = utils.deepClone(bannerBid);
142
+ delete bid.mediaTypes.banner;
143
+
144
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
145
+ });
146
+
147
+ it('should return false when sizes for banner are not specified', () => {
148
+ const bid = utils.deepClone(bannerBid);
149
+ delete bid.mediaTypes.banner.sizes;
150
+
151
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
152
+ });
153
+
154
+ it('should return false when there is no video in mediaTypes', () => {
155
+ const bid = utils.deepClone(videoBid);
156
+ delete bid.mediaTypes.video;
157
+
158
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
159
+ });
160
+
161
+ it('should reutrn false if player size is not set', () => {
162
+ const bid = utils.deepClone(videoBid);
163
+ delete bid.mediaTypes.video.playerSize;
164
+
165
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
166
+ });
167
+
168
+ it('should return true when required params found', () => {
169
+ expect(spec.isBidRequestValid(bannerBid)).to.equal(true);
170
+ expect(spec.isBidRequestValid(videoBid)).to.equal(true);
171
+ });
172
+ });
173
+
174
+ describe('buildRequests()', () => {
175
+ it('should build correct request for banner bid with both w, h', () => {
176
+ const bid = utils.deepClone(bannerBid);
177
+
178
+ const [request] = spec.buildRequests([bid], bidderRequest);
179
+ const requestData = request.data;
180
+
181
+ expect(requestData.imp[0].banner.w).to.equal(300);
182
+ expect(requestData.imp[0].banner.h).to.equal(250);
183
+ });
184
+
185
+ it('should return default bidfloor when bidFloor is not defined', () => {
186
+ const bid = utils.deepClone(bannerBid);
187
+ delete bid.params.bidFloor;
188
+
189
+ const [request] = spec.buildRequests([bid], bidderRequest);
190
+ const requestData = request.data;
191
+
192
+ expect(requestData.imp[0].bidfloor).to.equal(0.05);
193
+ });
194
+
195
+ it('should contain deals in request if deal is specified in params', () => {
196
+ const bid = utils.deepClone(bannerBid);
197
+ bid.params.deals = [{ id: 'test' }];
198
+
199
+ const [request] = spec.buildRequests([bid], bidderRequest);
200
+ const requestData = request.data;
201
+
202
+ expect(requestData.imp[0].pmp.deals).to.equal(bid.params.deals);
203
+ });
204
+
205
+ it('should return bidfloor when bidFloor is defined', () => {
206
+ const bid = utils.deepClone(bannerBid);
207
+
208
+ const [request] = spec.buildRequests([bid], bidderRequest);
209
+ const requestData = request.data;
210
+
211
+ expect(requestData.imp[0].bidfloor).to.equal(bannerBid.params.bidFloor);
212
+ });
213
+
214
+ it('should build correct request for video bid with playerSize', () => {
215
+ const bid = utils.deepClone(videoBid);
216
+
217
+ const [request] = spec.buildRequests([bid], bidderRequest);
218
+ const requestData = request.data;
219
+
220
+ expect(requestData.imp[0].video.w).to.equal(1024);
221
+ expect(requestData.imp[0].video.h).to.equal(768);
222
+ });
223
+
224
+ it('should use bidder video params if they are set', () => {
225
+ const videoBidWithParams = utils.deepClone(videoBid);
226
+ const bidderVideoParams = {
227
+ api: [1, 2],
228
+ mimes: ['video/mp4', 'video/x-flv'],
229
+ playbackmethod: [3, 4],
230
+ protocols: [5, 6],
231
+ placement: 1,
232
+ minduration: 0,
233
+ maxduration: 60,
234
+ w: 1024,
235
+ h: 768,
236
+ startdelay: 0
237
+ };
238
+
239
+ videoBidWithParams.params.video = bidderVideoParams;
240
+
241
+ const requests = spec.buildRequests([videoBidWithParams], bidderRequest);
242
+ const request = requests[0].data;
243
+
244
+ expect(request.imp[0]).to.deep.include({
245
+ video: {
246
+ ...bidderVideoParams,
247
+ w: videoBidWithParams.mediaTypes.video.playerSize[0][0],
248
+ h: videoBidWithParams.mediaTypes.video.playerSize[0][1],
249
+ },
250
+ });
251
+ });
252
+ });
253
+
254
+ describe('getOS()', () => {
255
+ it('shold return correct os name for Windows', () => {
256
+ let userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246';
257
+ let osName = spec.getOS(userAgent);
258
+
259
+ expect(osName).to.equal('Windows');
260
+ });
261
+
262
+ it('shold return correct os name for Mac OS', () => {
263
+ let userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9';
264
+ let osName = spec.getOS(userAgent);
265
+
266
+ expect(osName).to.equal('macOS');
267
+ });
268
+
269
+ it('shold return correct os name for Android', () => {
270
+ let userAgent = 'Mozilla/5.0 (Linux; Android 10; SM-G996U Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36';
271
+ let osName = spec.getOS(userAgent);
272
+
273
+ expect(osName).to.equal('Android');
274
+ });
275
+
276
+ it('shold return correct os name for ios', () => {
277
+ let userAgent = 'Mozilla/5.0 (iPhone14,3; U; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19A346 Safari/602.1';
278
+ let osName = spec.getOS(userAgent);
279
+
280
+ expect(osName).to.equal('iOS');
281
+ });
282
+
283
+ it('shold return correct os name for Linux', () => {
284
+ let userAgent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1';
285
+ let osName = spec.getOS(userAgent);
286
+
287
+ expect(osName).to.equal('Linux');
288
+ });
289
+ });
290
+
291
+ describe('interpretResponse()', () => {
292
+ it('should return nbr to 0 when response not received', () => {
293
+ const requests = spec.buildRequests([bannerBid], bidderRequest);
294
+ const bids = spec.interpretResponse({ body: null }, requests[0]);
295
+
296
+ expect(bids[0]).to.equal(undefined);
297
+ });
298
+
299
+ it('should correctly interpret valid banner response', () => {
300
+ const response = utils.deepClone(bannerReponse);
301
+ const requests = spec.buildRequests([bannerBid], bidderRequest);
302
+ const bids = spec.interpretResponse({ body: response }, requests[0]);
303
+
304
+ expect(bids[0].ad).to.equal('<div><img src="url_str"><div>');
305
+ expect(bids[0].burl).to.equal('http://0.0.0.0:8181/burl');
306
+ expect(bids[0].cpm).to.equal(1.64);
307
+ expect(bids[0].creativeId).to.equal('aaaaadddddddd');
308
+ expect(bids[0].creative_id).to.equal('aaaaadddddddd');
309
+ expect(bids[0].currency).to.equal('USD');
310
+ expect(bids[0].height).to.equal(250);
311
+ expect(bids[0].mediaType).to.equal('banner');
312
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://www.exampleabc.com');
313
+ expect(bids[0].netRevenue).to.equal(true);
314
+ expect(bids[0].requestId).to.equal('dl38fjf9d');
315
+ expect(bids[0].seatBidId).to.equal('ARUYoUZx');
316
+ expect(bids[0].ttl).to.equal(300);
317
+ expect(bids[0].width).to.equal(300);
318
+ });
319
+
320
+ if (FEATURES.VIDEO) {
321
+ it('should correctly interpret valid instream video response', () => {
322
+ const response = utils.deepClone(videoResponse);
323
+ videoBid.mediaTypes.video.context = 'outstream';
324
+ const requests = spec.buildRequests([videoBid], bidderRequest);
325
+ const bids = spec.interpretResponse({ body: response }, requests[0]);
326
+
327
+ expect(bids[0].vastXml).to.equal('<VAST version="4.2"></VAST>\n');
328
+ expect(bids[0].burl).to.equal('http://0.0.0.0:8181/burl');
329
+ expect(bids[0].cpm).to.equal(1.09);
330
+ expect(bids[0].creativeId).to.equal('aaaaadddddddd');
331
+ expect(bids[0].currency).to.equal('USD');
332
+ expect(bids[0].mediaType).to.equal('video');
333
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://www.exampleabc.com');
334
+ expect(bids[0].requestId).to.equal('281141d3541362');
335
+ expect(bids[0].seatBidId).to.equal('soCWeklh');
336
+ expect(bids[0].width).to.equal(1024);
337
+ expect(bids[0].height).to.equal(768);
338
+ });
339
+
340
+ it('should correctly interpret valid outstream video response', () => {
341
+ const response = utils.deepClone(videoResponse);
342
+ videoBid.mediaTypes.video.context = 'outstream';
343
+
344
+ const requests = spec.buildRequests([videoBid], bidderRequest);
345
+ const bids = spec.interpretResponse({ body: response }, requests[0]);
346
+
347
+ expect(bids[0].vastXml).to.equal('<VAST version="4.2"></VAST>\n');
348
+ expect(bids[0].rendererUrl).to.equal(SP_OUTSTREAM_PLAYER_URL);
349
+ expect(bids[0].renderer.url).to.equal(SP_OUTSTREAM_PLAYER_URL);
350
+ expect(bids[0].burl).to.equal('http://0.0.0.0:8181/burl');
351
+ expect(bids[0].cpm).to.equal(1.09);
352
+ expect(bids[0].creativeId).to.equal('aaaaadddddddd');
353
+ expect(bids[0].currency).to.equal('USD');
354
+ expect(bids[0].mediaType).to.equal('video');
355
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://www.exampleabc.com');
356
+ expect(bids[0].requestId).to.equal('281141d3541362');
357
+ expect(bids[0].seatBidId).to.equal('soCWeklh');
358
+ expect(bids[0].width).to.equal(1024);
359
+ expect(bids[0].height).to.equal(768);
360
+ });
361
+ }
362
+ });
363
+
364
+ describe('onBidWon', function() {
365
+ let ajaxStub;
366
+
367
+ beforeEach(() => {
368
+ ajaxStub = sinon.stub(spec, 'getRequest')
369
+ })
370
+
371
+ afterEach(() => {
372
+ ajaxStub.restore()
373
+ })
374
+
375
+ it('Should not trigger pixel if bid does not contain burl', function() {
376
+ const result = spec.onBidWon({});
377
+
378
+ expect(ajaxStub.calledOnce).to.equal(false);
379
+ })
380
+
381
+ it('Should trigger pixel with correct macros if bid burl is present', function() {
382
+ const result = spec.onBidWon({
383
+ cpm: 1.5,
384
+ auctionId: 'auc123',
385
+ requestId: 'req123',
386
+ adId: 'ad1234',
387
+ seatBidId: 'sea123',
388
+ burl: 'http://won.foo.bar/trk?ap=${AUCTION_PRICE}&aid=${AUCTION_ID}&imp=${AUCTION_IMP_ID}&adid=${AUCTION_AD_ID}&sid=${AUCTION_SEAT_ID}'
389
+ });
390
+
391
+ expect(ajaxStub.calledOnceWith('http://won.foo.bar/trk?ap=1.5&aid=auc123&imp=req123&adid=ad1234&sid=sea123')).to.equal(true);
392
+ })
393
+ })
394
+ });
@@ -232,6 +232,25 @@ describe('ttdBidAdapter', function () {
232
232
  'doneCbCallCount': 0
233
233
  };
234
234
 
235
+ const extFirstPartyDataValues = ['value', 'value2'];
236
+ const extFirstPartyData = {
237
+ data: {
238
+ firstPartyKey: 'firstPartyValue',
239
+ firstPartyKey2: extFirstPartyDataValues
240
+ },
241
+ custom: 'custom_data',
242
+ custom_kvp: {
243
+ customKey: 'customValue'
244
+ }
245
+ }
246
+
247
+ function validateExtFirstPartyData(ext) {
248
+ expect(ext.data.firstPartyKey).to.equal('firstPartyValue');
249
+ expect(ext.data.firstPartyKey2).to.eql(extFirstPartyDataValues);
250
+ expect(ext.custom).to.equal('custom_data');
251
+ expect(ext.custom_kvp.customKey).to.equal('customValue');
252
+ }
253
+
235
254
  it('sends bid request to our endpoint that makes sense', function () {
236
255
  const request = testBuildRequests(baseBannerBidRequests, baseBidderRequest);
237
256
  expect(request.method).to.equal('POST');
@@ -572,6 +591,115 @@ describe('ttdBidAdapter', function () {
572
591
  config.resetConfig();
573
592
  expect(requestBody.imp[0].bidfloor).to.equal(bidfloor);
574
593
  });
594
+
595
+ it('adds default value for secure if not set to request', function () {
596
+ const requestBody = testBuildRequests(baseBannerBidRequests, baseBidderRequest).data;
597
+ expect(requestBody.imp[0].secure).to.equal(1);
598
+ });
599
+
600
+ it('adds secure to request', function () {
601
+ let clonedBannerRequests = deepClone(baseBannerBidRequests);
602
+ clonedBannerRequests[0].ortb2Imp.secure = 0;
603
+
604
+ let requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
605
+ expect(0).to.equal(requestBody.imp[0].secure);
606
+
607
+ clonedBannerRequests[0].ortb2Imp.secure = 1;
608
+ requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
609
+ expect(1).to.equal(requestBody.imp[0].secure);
610
+ });
611
+
612
+ it('adds all of site first party data to request', function() {
613
+ const ortb2 = {
614
+ site: {
615
+ ext: extFirstPartyData,
616
+ search: 'test search'
617
+ }
618
+ };
619
+
620
+ let clonedBidderRequest = {...deepClone(baseBidderRequest), ortb2};
621
+ const requestBody = testBuildRequests(baseBannerBidRequests, clonedBidderRequest).data;
622
+
623
+ validateExtFirstPartyData(requestBody.site.ext)
624
+ expect(requestBody.site.search).to.equal('test search')
625
+ });
626
+
627
+ it('adds all of user first party data to request', function() {
628
+ const ortb2 = {
629
+ user: {
630
+ ext: extFirstPartyData,
631
+ yob: 1998
632
+ }
633
+ };
634
+
635
+ let clonedBidderRequest = {...deepClone(baseBidderRequest), ortb2};
636
+ const requestBody = testBuildRequests(baseBannerBidRequests, clonedBidderRequest).data;
637
+
638
+ validateExtFirstPartyData(requestBody.user.ext)
639
+ expect(requestBody.user.yob).to.equal(1998)
640
+ });
641
+
642
+ it('adds all of imp first party data to request', function() {
643
+ const metric = { type: 'viewability', value: 0.8 };
644
+ let clonedBannerRequests = deepClone(baseBannerBidRequests);
645
+ clonedBannerRequests[0].ortb2Imp = {
646
+ ext: extFirstPartyData,
647
+ metric: [metric],
648
+ clickbrowser: 1
649
+ };
650
+
651
+ const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
652
+
653
+ validateExtFirstPartyData(requestBody.imp[0].ext)
654
+ expect(requestBody.imp[0].tagid).to.equal('1gaa015');
655
+ expect(requestBody.imp[0].metric[0]).to.deep.equal(metric);
656
+ expect(requestBody.imp[0].clickbrowser).to.equal(1)
657
+ });
658
+
659
+ it('adds all of app first party data to request', function() {
660
+ const ortb2 = {
661
+ app: {
662
+ ext: extFirstPartyData,
663
+ ver: 'v1.0'
664
+ }
665
+ };
666
+
667
+ let clonedBidderRequest = {...deepClone(baseBidderRequest), ortb2};
668
+ const requestBody = testBuildRequests(baseBannerBidRequests, clonedBidderRequest).data;
669
+
670
+ validateExtFirstPartyData(requestBody.app.ext)
671
+ expect(requestBody.app.ver).to.equal('v1.0')
672
+ });
673
+
674
+ it('adds all of device first party data to request', function() {
675
+ const ortb2 = {
676
+ device: {
677
+ ext: extFirstPartyData,
678
+ os: 'iPhone'
679
+ }
680
+ };
681
+
682
+ let clonedBidderRequest = {...deepClone(baseBidderRequest), ortb2};
683
+ const requestBody = testBuildRequests(baseBannerBidRequests, clonedBidderRequest).data;
684
+
685
+ validateExtFirstPartyData(requestBody.device.ext)
686
+ expect(requestBody.device.os).to.equal('iPhone')
687
+ });
688
+
689
+ it('adds all of pmp first party data to request', function() {
690
+ const ortb2 = {
691
+ pmp: {
692
+ ext: extFirstPartyData,
693
+ private_auction: 1
694
+ }
695
+ };
696
+
697
+ let clonedBidderRequest = {...deepClone(baseBidderRequest), ortb2};
698
+ const requestBody = testBuildRequests(baseBannerBidRequests, clonedBidderRequest).data;
699
+
700
+ validateExtFirstPartyData(requestBody.pmp.ext)
701
+ expect(requestBody.pmp.private_auction).to.equal(1)
702
+ });
575
703
  });
576
704
 
577
705
  describe('buildRequests-banner-multiple', function () {
@@ -1295,8 +1423,7 @@ describe('ttdBidAdapter', function () {
1295
1423
  }
1296
1424
  };
1297
1425
 
1298
- const expectedBid =
1299
- {
1426
+ const expectedBid = {
1300
1427
  'requestId': '2eabb87dfbcae4',
1301
1428
  'cpm': 13.6,
1302
1429
  'creativeId': 'mokivv6m',
@@ -735,7 +735,7 @@ describe('UnderdogMedia adapter', function () {
735
735
  },
736
736
  },
737
737
  refererInfo: {
738
- ref: 'www.example.com'
738
+ page: 'www.example.com'
739
739
  }
740
740
  }
741
741
 
@@ -1,7 +1,6 @@
1
1
  import {expect} from 'chai';
2
2
  import {
3
3
  spec as adapter,
4
- SUPPORTED_ID_SYSTEMS,
5
4
  createDomain,
6
5
  hashCode,
7
6
  extractPID,
@@ -21,6 +20,8 @@ import {useFakeTimers} from 'sinon';
21
20
  import {BANNER, VIDEO} from '../../../src/mediaTypes';
22
21
  import {config} from '../../../src/config';
23
22
 
23
+ export const TEST_ID_SYSTEMS = ['britepoolid', 'criteoId', 'id5id', 'idl_env', 'lipb', 'netId', 'parrableId', 'pubcid', 'tdid', 'pubProvidedId'];
24
+
24
25
  const SUB_DOMAIN = 'openrtb';
25
26
 
26
27
  const BID = {
@@ -520,7 +521,7 @@ describe('VidazooBidAdapter', function () {
520
521
  });
521
522
 
522
523
  describe('user id system', function () {
523
- Object.keys(SUPPORTED_ID_SYSTEMS).forEach((idSystemProvider) => {
524
+ TEST_ID_SYSTEMS.forEach((idSystemProvider) => {
524
525
  const id = Date.now().toString();
525
526
  const bid = utils.deepClone(BID);
526
527
 
@@ -0,0 +1,22 @@
1
+ import { getExternalVideoEventName, getExternalVideoEventPayload } from 'libraries/video/shared/helpers.js';
2
+ import { expect } from 'chai';
3
+
4
+ describe('Helpers', function () {
5
+ describe('getExternalVideoEventName', function () {
6
+ it('should append video prefix and stay camelcase', function () {
7
+ expect(getExternalVideoEventName('eventName')).to.equal('videoEventName');
8
+ expect(getExternalVideoEventName(null)).to.equal('');
9
+ });
10
+ });
11
+
12
+ describe('getExternalVideoEventPayload', function () {
13
+ it('should include type in payload when absent', function () {
14
+ const testType = 'testType';
15
+ const payloadWithType = { datum: 'datum', type: 'existingType' };
16
+ expect(getExternalVideoEventPayload(testType, payloadWithType).type).to.equal('existingType');
17
+
18
+ const payloadWithoutType = { datum: 'datum' };
19
+ expect(getExternalVideoEventPayload(testType, payloadWithoutType).type).to.equal(testType);
20
+ });
21
+ });
22
+ });
@@ -481,6 +481,23 @@ describe('YahooSSP Bid Adapter:', () => {
481
481
  });
482
482
  });
483
483
 
484
+ const VALID_PUBLISHER_OBJECTS = ['ext'];
485
+ VALID_PUBLISHER_OBJECTS.forEach(param => {
486
+ it(`should determine that the ortb2.site.publisher Object key is valid and append to the bid-request: ${JSON.stringify(param)}`, () => {
487
+ const ortb2 = {
488
+ site: {
489
+ publisher: {
490
+ [param]: {a: '123', b: '456'}
491
+ }
492
+ }
493
+ };
494
+ const { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
495
+ const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
496
+ expect(data.site.publisher[param]).to.be.a('object');
497
+ expect(data.site.publisher[param]).to.be.equal(ortb2.site.publisher[param]);
498
+ });
499
+ });
500
+
484
501
  const VALID_CONTENT_ARRAYS = ['cat'];
485
502
  VALID_CONTENT_ARRAYS.forEach(param => {
486
503
  it(`should determine that the ortb2.site Array key is valid and append to the bid-request: ${JSON.stringify(param)}`, () => {
@@ -512,7 +529,6 @@ describe('YahooSSP Bid Adapter:', () => {
512
529
  const data = spec.buildRequests(validBidRequests, bidderRequest)[0].data;
513
530
  expect(data.site.content[param]).to.be.a('object');
514
531
  expect(data.site.content[param]).to.be.equal(ortb2.site.content[param]);
515
- config.setConfig({ortb2: {}});
516
532
  });
517
533
  });
518
534
  });
@@ -959,6 +975,49 @@ describe('YahooSSP Bid Adapter:', () => {
959
975
  expect(data.site.id).to.equal('1234567');
960
976
  });
961
977
 
978
+ it('should use site publisher ortb2 config in default integration mode', () => {
979
+ const ortb2 = {
980
+ site: {
981
+ publisher: {
982
+ ext: {
983
+ publisherblob: 'pblob',
984
+ bucket: 'bucket'
985
+ }
986
+ }
987
+ }
988
+ }
989
+ let { validBidRequests, bidderRequest } = generateBuildRequestMock({ortb2});
990
+ const data = spec.buildRequests(validBidRequests, bidderRequest).data;
991
+ expect(data.site.publisher).to.deep.equal({
992
+ ext: {
993
+ publisherblob: 'pblob',
994
+ bucket: 'bucket'
995
+ }
996
+ });
997
+ });
998
+
999
+ it('should use site publisher ortb2 config when using "pubId" integration mode', () => {
1000
+ const ortb2 = {
1001
+ site: {
1002
+ publisher: {
1003
+ ext: {
1004
+ publisherblob: 'pblob',
1005
+ bucket: 'bucket'
1006
+ }
1007
+ }
1008
+ }
1009
+ }
1010
+ let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true, ortb2});
1011
+ const data = spec.buildRequests(validBidRequests, bidderRequest).data;
1012
+ expect(data.site.publisher).to.deep.equal({
1013
+ id: DEFAULT_PUBID,
1014
+ ext: {
1015
+ publisherblob: 'pblob',
1016
+ bucket: 'bucket'
1017
+ }
1018
+ });
1019
+ });
1020
+
962
1021
  it('should use placementId value as imp.tagid in the outbound bid-request when using "pubId" integration mode', () => {
963
1022
  let { validBidRequests, bidderRequest } = generateBuildRequestMock({pubIdMode: true});
964
1023
  validBidRequests[0].params.placementId = 'header-300x250';