prebid.js 7.52.0 → 7.53.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 (214) hide show
  1. package/dist/1plusXRtdProvider.js +1 -1
  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/adkernelBidAdapter.js +1 -1
  8. package/dist/adqueryBidAdapter.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adtrgtmeBidAdapter.js +1 -1
  11. package/dist/adxcgBidAdapter.js +1 -1
  12. package/dist/adyoulikeBidAdapter.js +1 -1
  13. package/dist/airgridRtdProvider.js +1 -1
  14. package/dist/ajaBidAdapter.js +1 -1
  15. package/dist/amxBidAdapter.js +1 -1
  16. package/dist/amxIdSystem.js +1 -1
  17. package/dist/appierAnalyticsAdapter.js +1 -1
  18. package/dist/appnexusBidAdapter.js +1 -1
  19. package/dist/asoBidAdapter.js +1 -1
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/beopBidAdapter.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/conceptxBidAdapter.js +1 -0
  29. package/dist/concertBidAdapter.js +1 -1
  30. package/dist/connectadBidAdapter.js +1 -1
  31. package/dist/consumableBidAdapter.js +1 -1
  32. package/dist/conversantAnalyticsAdapter.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/cwireBidAdapter.js +1 -1
  37. package/dist/dspxBidAdapter.js +1 -1
  38. package/dist/eplanningBidAdapter.js +1 -1
  39. package/dist/eskimiBidAdapter.js +1 -1
  40. package/dist/euidIdSystem.js +1 -0
  41. package/dist/feedadBidAdapter.js +1 -1
  42. package/dist/finativeBidAdapter.js +1 -1
  43. package/dist/freepassIdSystem.js +1 -0
  44. package/dist/freewheel-sspBidAdapter.js +1 -1
  45. package/dist/glimpseBidAdapter.js +1 -1
  46. package/dist/gmosspBidAdapter.js +1 -1
  47. package/dist/goldbachBidAdapter.js +1 -1
  48. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  49. package/dist/greenbidsRtdProvider.js +1 -1
  50. package/dist/gridBidAdapter.js +1 -1
  51. package/dist/gumgumBidAdapter.js +1 -1
  52. package/dist/h12mediaBidAdapter.js +1 -1
  53. package/dist/id5IdSystem.js +1 -1
  54. package/dist/improvedigitalBidAdapter.js +1 -1
  55. package/dist/inmarBidAdapter.js +1 -1
  56. package/dist/insticatorBidAdapter.js +1 -1
  57. package/dist/ixBidAdapter.js +1 -1
  58. package/dist/justpremiumBidAdapter.js +1 -1
  59. package/dist/kargoBidAdapter.js +1 -1
  60. package/dist/konduitAnalyticsAdapter.js +1 -1
  61. package/dist/kueezBidAdapter.js +1 -1
  62. package/dist/kueezRtbBidAdapter.js +1 -1
  63. package/dist/kulturemediaBidAdapter.js +1 -1
  64. package/dist/lassoBidAdapter.js +1 -1
  65. package/dist/lifestreetBidAdapter.js +1 -1
  66. package/dist/limelightDigitalBidAdapter.js +1 -1
  67. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  68. package/dist/logicadBidAdapter.js +1 -1
  69. package/dist/loglyliftBidAdapter.js +1 -1
  70. package/dist/magniteAnalyticsAdapter.js +1 -1
  71. package/dist/malltvAnalyticsAdapter.js +1 -1
  72. package/dist/marsmediaBidAdapter.js +1 -1
  73. package/dist/mediafuseBidAdapter.js +1 -1
  74. package/dist/mediasquareBidAdapter.js +1 -1
  75. package/dist/mgidBidAdapter.js +1 -1
  76. package/dist/minutemediaBidAdapter.js +1 -1
  77. package/dist/minutemediaplusBidAdapter.js +1 -1
  78. package/dist/nexx360BidAdapter.js +1 -1
  79. package/dist/not-for-prod/prebid.js +146 -142
  80. package/dist/oguryBidAdapter.js +1 -1
  81. package/dist/onetagBidAdapter.js +1 -1
  82. package/dist/ooloAnalyticsAdapter.js +1 -1
  83. package/dist/optidigitalBidAdapter.js +1 -1
  84. package/dist/outbrainBidAdapter.js +1 -1
  85. package/dist/pairIdSystem.js +1 -1
  86. package/dist/parrableIdSystem.js +1 -1
  87. package/dist/pixfutureBidAdapter.js +1 -1
  88. package/dist/prebid-core.js +1 -1
  89. package/dist/proxistoreBidAdapter.js +1 -1
  90. package/dist/publinkIdSystem.js +1 -1
  91. package/dist/pubmaticBidAdapter.js +1 -1
  92. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  93. package/dist/pxyzBidAdapter.js +1 -1
  94. package/dist/quantcastBidAdapter.js +1 -1
  95. package/dist/readpeakBidAdapter.js +1 -1
  96. package/dist/relaidoBidAdapter.js +1 -1
  97. package/dist/retailspotBidAdapter.js +1 -1
  98. package/dist/rhythmoneBidAdapter.js +1 -1
  99. package/dist/richaudienceBidAdapter.js +1 -1
  100. package/dist/riseBidAdapter.js +1 -1
  101. package/dist/rubiconAnalyticsAdapter.js +1 -1
  102. package/dist/rubiconBidAdapter.js +1 -1
  103. package/dist/schain.js +1 -1
  104. package/dist/seedingAllianceBidAdapter.js +1 -1
  105. package/dist/seedtagBidAdapter.js +1 -1
  106. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  107. package/dist/sharethroughBidAdapter.js +1 -1
  108. package/dist/shinezBidAdapter.js +1 -1
  109. package/dist/sirdataRtdProvider.js +1 -1
  110. package/dist/smaatoBidAdapter.js +1 -1
  111. package/dist/smartadserverBidAdapter.js +1 -1
  112. package/dist/smartxBidAdapter.js +1 -1
  113. package/dist/smilewantedBidAdapter.js +1 -1
  114. package/dist/sonobiBidAdapter.js +1 -1
  115. package/dist/sovrnAnalyticsAdapter.js +1 -1
  116. package/dist/sovrnBidAdapter.js +1 -1
  117. package/dist/sspBCBidAdapter.js +1 -1
  118. package/dist/stroeerCoreBidAdapter.js +1 -1
  119. package/dist/stvBidAdapter.js +1 -1
  120. package/dist/sublimeBidAdapter.js +1 -1
  121. package/dist/synacormediaBidAdapter.js +1 -1
  122. package/dist/targetVideoBidAdapter.js +1 -1
  123. package/dist/teadsBidAdapter.js +1 -1
  124. package/dist/trionBidAdapter.js +1 -1
  125. package/dist/tripleliftBidAdapter.js +1 -1
  126. package/dist/ttdBidAdapter.js +1 -1
  127. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  128. package/dist/uid2IdSystem.js +1 -1
  129. package/dist/uid2IdSystem_shared.js +1 -0
  130. package/dist/underdogmediaBidAdapter.js +1 -1
  131. package/dist/undertoneBidAdapter.js +1 -1
  132. package/dist/userId.js +1 -1
  133. package/dist/vidazooBidAdapter.js +1 -1
  134. package/dist/videobyteBidAdapter.js +1 -1
  135. package/dist/viouslyBidAdapter.js +1 -1
  136. package/dist/visxBidAdapter.js +1 -1
  137. package/dist/vuukleBidAdapter.js +1 -1
  138. package/dist/weboramaRtdProvider.js +1 -1
  139. package/dist/widespaceBidAdapter.js +1 -1
  140. package/dist/winrBidAdapter.js +1 -1
  141. package/dist/yahoosspBidAdapter.js +1 -1
  142. package/dist/yieldlabBidAdapter.js +1 -1
  143. package/dist/yieldmoBidAdapter.js +1 -1
  144. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  145. package/dist/zeta_global_sspBidAdapter.js +1 -1
  146. package/integrationExamples/gpt/userId_example.html +20 -6
  147. package/modules/.submodules.json +3 -1
  148. package/modules/1plusXRtdProvider.js +31 -60
  149. package/modules/adagioBidAdapter.js +86 -24
  150. package/modules/adkernelBidAdapter.js +2 -2
  151. package/modules/airgridRtdProvider.js +11 -12
  152. package/modules/asoBidAdapter.js +2 -1
  153. package/modules/beopBidAdapter.js +6 -0
  154. package/modules/conceptxBidAdapter.js +70 -0
  155. package/modules/conceptxBidAdapter.md +36 -0
  156. package/modules/criteoBidAdapter.js +9 -2
  157. package/modules/eskimiBidAdapter.js +171 -41
  158. package/modules/eskimiBidAdapter.md +35 -16
  159. package/modules/euidIdSystem.js +121 -0
  160. package/modules/euidIdSystem.md +131 -0
  161. package/modules/freepassIdSystem.js +61 -0
  162. package/modules/freepassIdSystem.md +47 -0
  163. package/modules/greenbidsAnalyticsAdapter.js +1 -1
  164. package/modules/id5IdSystem.js +3 -5
  165. package/modules/ixBidAdapter.js +12 -1
  166. package/modules/limelightDigitalBidAdapter.js +1 -1
  167. package/modules/logicadBidAdapter.js +14 -1
  168. package/modules/mediasquareBidAdapter.js +13 -5
  169. package/modules/nexx360BidAdapter.js +1 -0
  170. package/modules/pairIdSystem.js +10 -5
  171. package/modules/proxistoreBidAdapter.js +11 -14
  172. package/modules/richaudienceBidAdapter.js +10 -1
  173. package/modules/riseBidAdapter.js +1 -1
  174. package/modules/schain.js +2 -2
  175. package/modules/sirdataRtdProvider.js +73 -146
  176. package/modules/sovrnBidAdapter.js +4 -1
  177. package/modules/stroeerCoreBidAdapter.js +55 -6
  178. package/modules/uid2IdSystem.js +27 -210
  179. package/modules/uid2IdSystem.md +104 -23
  180. package/modules/uid2IdSystem_shared.js +232 -0
  181. package/modules/userId/eids.js +8 -0
  182. package/modules/userId/userId.md +2 -1
  183. package/modules/viouslyBidAdapter.js +2 -2
  184. package/modules/weboramaRtdProvider.js +25 -95
  185. package/modules/weboramaRtdProvider.md +4 -4
  186. package/modules/yieldlabBidAdapter.js +23 -14
  187. package/modules/zeta_global_sspBidAdapter.js +27 -22
  188. package/package.json +1 -1
  189. package/src/adloader.js +1 -0
  190. package/test/spec/modules/1plusXRtdProvider_spec.js +98 -149
  191. package/test/spec/modules/adagioBidAdapter_spec.js +46 -17
  192. package/test/spec/modules/airgridRtdProvider_spec.js +2 -0
  193. package/test/spec/modules/beopBidAdapter_spec.js +24 -0
  194. package/test/spec/modules/conceptxBidAdapter_spec.js +136 -0
  195. package/test/spec/modules/criteoBidAdapter_spec.js +1 -1
  196. package/test/spec/modules/eids_spec.js +15 -0
  197. package/test/spec/modules/eskimiBidAdapter_spec.js +264 -112
  198. package/test/spec/modules/euidIdSystem_spec.js +130 -0
  199. package/test/spec/modules/freepassIdSystem_spec.js +186 -0
  200. package/test/spec/modules/id5IdSystem_spec.js +10 -3
  201. package/test/spec/modules/ixBidAdapter_spec.js +30 -0
  202. package/test/spec/modules/logicadBidAdapter_spec.js +122 -2
  203. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -0
  204. package/test/spec/modules/richaudienceBidAdapter_spec.js +44 -0
  205. package/test/spec/modules/schain_spec.js +9 -0
  206. package/test/spec/modules/sirdataRtdProvider_spec.js +110 -17
  207. package/test/spec/modules/sovrnBidAdapter_spec.js +13 -0
  208. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +151 -6
  209. package/test/spec/modules/uid2IdSystem_helpers.js +70 -0
  210. package/test/spec/modules/uid2IdSystem_spec.js +131 -86
  211. package/test/spec/modules/userId_spec.js +16 -12
  212. package/test/spec/modules/weboramaRtdProvider_spec.js +331 -205
  213. package/test/spec/modules/yieldlabBidAdapter_spec.js +42 -2
  214. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +200 -4
@@ -1,26 +1,31 @@
1
- import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule} from 'modules/sirdataRtdProvider.js';
1
+ import {addSegmentData, getSegmentsAndCategories, sirdataSubmodule, setOrtb2} from 'modules/sirdataRtdProvider.js';
2
2
  import {server} from 'test/mocks/xhr.js';
3
3
 
4
4
  const responseHeader = {'Content-Type': 'application/json'};
5
5
 
6
6
  describe('sirdataRtdProvider', function () {
7
7
  describe('sirdataSubmodule', function () {
8
+ it('exists', function () {
9
+ expect(sirdataSubmodule.init).to.be.a('function');
10
+ });
8
11
  it('successfully instantiates', function () {
9
12
  expect(sirdataSubmodule.init()).to.equal(true);
10
13
  });
14
+ it('has the correct module name', function () {
15
+ expect(sirdataSubmodule.name).to.equal('SirdataRTDModule');
16
+ });
11
17
  });
12
18
 
13
19
  describe('Add Segment Data', function () {
14
20
  it('adds segment data', function () {
15
- const config = {
21
+ const firstConfig = {
16
22
  params: {
17
- setGptKeyValues: false,
23
+ partnerId: 1,
24
+ key: 1,
25
+ setGptKeyValues: true,
26
+ gptCurationId: 27449,
18
27
  contextualMinRelevancyScore: 50,
19
- bidders: [{
20
- bidder: 'appnexus'
21
- }, {
22
- bidder: 'other'
23
- }]
28
+ bidders: []
24
29
  }
25
30
  };
26
31
 
@@ -37,21 +42,47 @@ describe('sirdataRtdProvider', function () {
37
42
  }
38
43
  ];
39
44
 
40
- let data = {
45
+ let firstReqBidsConfigObj = {
46
+ adUnits: adUnits,
47
+ ortb2Fragments: {
48
+ global: {}
49
+ }
50
+ };
51
+
52
+ let firstData = {
41
53
  segments: [111111, 222222],
42
- contextual_categories: {'333333': 100}
54
+ contextual_categories: {'333333': 100},
55
+ 'segtaxid': null,
56
+ 'cattaxid': null,
57
+ 'shared_taxonomy': {
58
+ '27449': {
59
+ 'segments': [444444, 555555],
60
+ 'segtaxid': null,
61
+ 'cattaxid': null,
62
+ 'contextual_categories': {'666666': 100}
63
+ }
64
+ },
65
+ 'global_taxonomy': {
66
+ '9998': {
67
+ 'segments': [123, 234],
68
+ 'segtaxid': 4,
69
+ 'cattaxid': 7,
70
+ 'contextual_categories': {'345': 100, '456': 100}
71
+ }
72
+ }
43
73
  };
44
74
 
45
- addSegmentData({adUnits}, data, config, () => {
75
+ addSegmentData(firstReqBidsConfigObj, firstData, firstConfig, () => {
46
76
  });
47
- expect(adUnits[0].bids[0].params.keywords).to.have.deep.property('sd_rtd', ['111111', '222222', '333333']);
77
+
78
+ expect(firstReqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4);
48
79
  });
49
80
  });
50
81
 
51
82
  describe('Get Segments And Categories', function () {
52
83
  it('gets data from async request and adds segment data', function () {
53
84
  const overrideAppnexus = function (adUnit, list, data, bid) {
54
- deepSetValue(bid, 'params.keywords.custom', list);
85
+ deepSetValue(bid, 'params.keywords.custom', list.segments.concat(list.categories));
55
86
  }
56
87
 
57
88
  const config = {
@@ -60,16 +91,21 @@ describe('sirdataRtdProvider', function () {
60
91
  contextualMinRelevancyScore: 50,
61
92
  bidders: [{
62
93
  bidder: 'appnexus',
63
- customFunction: overrideAppnexus
94
+ customFunction: overrideAppnexus,
95
+ curationId: 27446
64
96
  }, {
65
- bidder: 'smartadserver'
97
+ bidder: 'smartadserver',
98
+ curationId: 27440
66
99
  }, {
67
100
  bidder: 'ix',
68
101
  sizeLimit: 1200,
102
+ curationId: 27248
69
103
  }, {
70
104
  bidder: 'rubicon',
105
+ curationId: 27452
71
106
  }, {
72
107
  bidder: 'proxistore',
108
+ curationId: 27484
73
109
  }]
74
110
  }
75
111
  };
@@ -146,6 +182,12 @@ describe('sirdataRtdProvider', function () {
146
182
  'segtaxid': 552,
147
183
  'cattaxid': 553,
148
184
  'contextual_categories': {'666666': 100}
185
+ },
186
+ '27446': {
187
+ 'segments': [777777, 888888],
188
+ 'segtaxid': 552,
189
+ 'cattaxid': 553,
190
+ 'contextual_categories': {'999999': 100}
149
191
  }
150
192
  },
151
193
  'global_taxonomy': {
@@ -164,8 +206,6 @@ describe('sirdataRtdProvider', function () {
164
206
  let request = server.requests[0];
165
207
  request.respond(200, responseHeader, JSON.stringify(data));
166
208
 
167
- expect(reqBidsConfigObj.adUnits[0].bids[1].params).to.have.deep.property('target', 'sd_rtd=111111;sd_rtd=222222;sd_rtd=333333;sd_rtd=444444;sd_rtd=555555;sd_rtd=666666');
168
-
169
209
  expect(reqBidsConfigObj.ortb2Fragments.global.site.content.data[0].name).to.equal(
170
210
  'sirdata.com'
171
211
  );
@@ -185,4 +225,57 @@ describe('sirdataRtdProvider', function () {
185
225
  expect(reqBidsConfigObj.ortb2Fragments.global.user.data[0].ext.segtax).to.equal(4);
186
226
  });
187
227
  });
228
+
229
+ describe('Set ortb2 for bidder', function () {
230
+ it('set ortb2 for a givent bidder', function () {
231
+ const config = {
232
+ params: {
233
+ setGptKeyValues: false,
234
+ contextualMinRelevancyScore: 50,
235
+ bidders: [{
236
+ bidder: 'appnexus',
237
+ }]
238
+ }
239
+ };
240
+
241
+ let reqBidsConfigObj = {
242
+ adUnits: [{
243
+ bids: [{
244
+ bidder: 'appnexus',
245
+ params: {
246
+ placementId: 13144370
247
+ }
248
+ }]
249
+ }],
250
+ ortb2Fragments: {
251
+ global: {}
252
+ }
253
+ };
254
+
255
+ let data = {
256
+ 'segments': [111111, 222222],
257
+ 'segtaxid': null,
258
+ 'cattaxid': null,
259
+ 'contextual_categories': {'333333': 100},
260
+ 'shared_taxonomy': {
261
+ '27440': {
262
+ 'segments': [444444, 555555],
263
+ 'segtaxid': null,
264
+ 'cattaxid': null,
265
+ 'contextual_categories': {'666666': 100}
266
+ }
267
+ },
268
+ 'global_taxonomy': {}
269
+ };
270
+
271
+ window.googletag = window.googletag || {};
272
+ window.googletag.cmd = window.googletag.cmd || [];
273
+
274
+ let test = setOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', []);
275
+ expect(test).to.be.false;
276
+
277
+ test = setOrtb2(reqBidsConfigObj.ortb2Fragments, 'appnexus', 'user', ['1']);
278
+ expect(test).to.be.true;
279
+ });
280
+ });
188
281
  });
@@ -170,6 +170,19 @@ describe('sovrnBidAdapter', function() {
170
170
  expect(payload.site.domain).to.equal('example.com')
171
171
  })
172
172
 
173
+ it('sets correct timeout', function() {
174
+ const bidderRequest = {
175
+ ...baseBidderRequest,
176
+ bidderCode: 'sovrn',
177
+ auctionId: '1d1a030790a475',
178
+ bidderRequestId: '22edbae2733bf6',
179
+ timeout: 3000,
180
+ bids: [baseBidRequest]
181
+ }
182
+ const payload = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
183
+ expect(payload.tmax).to.equal(3000)
184
+ })
185
+
173
186
  it('includes the ad unit code in the request', function() {
174
187
  const impression = payload.imp[0]
175
188
  expect(impression.adunitcode).to.equal('adunit-code')
@@ -527,14 +527,16 @@ describe('stroeerCore bid adapter', function () {
527
527
  'bid': 'bid8',
528
528
  'viz': true,
529
529
  'ban': {
530
- 'siz': [[300, 600], [160, 60]]
531
- }
530
+ 'siz': [[300, 600], [160, 60]],
531
+ 'fp': undefined
532
+ },
532
533
  },
533
534
  {
534
535
  'sid': 'ABC=',
535
536
  'bid': 'bid12',
536
537
  'ban': {
537
- 'siz': [[100, 200], [300, 500]]
538
+ 'siz': [[100, 200], [300, 500]],
539
+ 'fp': undefined
538
540
  },
539
541
  'viz': undefined
540
542
  }
@@ -548,7 +550,8 @@ describe('stroeerCore bid adapter', function () {
548
550
  'vid': {
549
551
  'ctx': 'instream',
550
552
  'siz': [640, 480],
551
- 'mim': ['video/mp4', 'video/quicktime']
553
+ 'mim': ['video/mp4', 'video/quicktime'],
554
+ 'fp': undefined
552
555
  }
553
556
  }
554
557
  ];
@@ -589,7 +592,8 @@ describe('stroeerCore bid adapter', function () {
589
592
  'bid': 'bid3',
590
593
  'viz': true,
591
594
  'ban': {
592
- 'siz': [[100, 200], [300, 500]]
595
+ 'siz': [[100, 200], [300, 500]],
596
+ 'fp': undefined
593
597
  }
594
598
  }
595
599
  ];
@@ -602,7 +606,8 @@ describe('stroeerCore bid adapter', function () {
602
606
  'vid': {
603
607
  'ctx': 'instream',
604
608
  'siz': [640, 480],
605
- 'mim': ['video/mp4', 'video/quicktime']
609
+ 'mim': ['video/mp4', 'video/quicktime'],
610
+ 'fp': undefined
606
611
  }
607
612
  }
608
613
  ];
@@ -696,6 +701,146 @@ describe('stroeerCore bid adapter', function () {
696
701
  const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);
697
702
  assert.deepEqual(serverRequestInfo.data.schain, schain);
698
703
  });
704
+
705
+ it('should add floor info to banner bid request if floor is available', () => {
706
+ const bidReq = buildBidderRequest();
707
+
708
+ const getFloorStub1 = sinon.stub();
709
+ const getFloorStub2 = sinon.stub();
710
+
711
+ getFloorStub1
712
+ .returns({})
713
+ .withArgs({currency: 'EUR', mediaType: BANNER, size: '*'})
714
+ .returns({currency: 'TRY', floor: 0.7})
715
+ .withArgs({currency: 'EUR', mediaType: 'banner', size: [300, 600]})
716
+ .returns({currency: 'TRY', floor: 1.3})
717
+ .withArgs({currency: 'EUR', mediaType: 'banner', size: [160, 60]})
718
+ .returns({currency: 'TRY', floor: 2.5})
719
+
720
+ getFloorStub2
721
+ .returns({})
722
+ .withArgs({currency: 'EUR', mediaType: 'banner', size: '*'})
723
+ .returns({currency: 'USD', floor: 1.2})
724
+ .withArgs({currency: 'EUR', mediaType: 'banner', size: [728, 90]})
725
+ .returns({currency: 'USD', floor: 1.85})
726
+
727
+ bidReq.bids[0].getFloor = getFloorStub1;
728
+ bidReq.bids[1].getFloor = getFloorStub2;
729
+
730
+ const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);
731
+
732
+ const serverRequestBids = serverRequestInfo.data.bids;
733
+ const firstBid = serverRequestBids[0];
734
+ const secondBid = serverRequestBids[1];
735
+
736
+ assert.nestedPropertyVal(firstBid, 'ban.fp.def', 0.7);
737
+ assert.nestedPropertyVal(firstBid, 'ban.fp.cur', 'TRY');
738
+ assert.deepNestedPropertyVal(firstBid, 'ban.fp.siz', [{w: 300, h: 600, p: 1.3}, {w: 160, h: 60, p: 2.5}]);
739
+
740
+ assert.isTrue(getFloorStub1.calledThrice);
741
+
742
+ assert.nestedPropertyVal(secondBid, 'ban.fp.def', 1.2);
743
+ assert.nestedPropertyVal(secondBid, 'ban.fp.cur', 'USD');
744
+ assert.deepNestedPropertyVal(secondBid, 'ban.fp.siz', [{w: 728, h: 90, p: 1.85}]);
745
+
746
+ assert.isTrue(getFloorStub2.calledTwice);
747
+ });
748
+
749
+ it('should add floor info to video bid request if floor is available', () => {
750
+ const bidReq = buildBidderRequest();
751
+
752
+ const getFloorStub1 = sinon.stub();
753
+ const getFloorStub2 = sinon.stub();
754
+
755
+ getFloorStub1
756
+ .returns({})
757
+ .withArgs({currency: 'EUR', mediaType: 'video', size: '*'})
758
+ .returns({currency: 'NZD', floor: 3.25})
759
+ .withArgs({currency: 'EUR', mediaType: 'video', size: [640, 480]})
760
+ .returns({currency: 'NZD', floor: 4.10});
761
+
762
+ getFloorStub2
763
+ .returns({})
764
+ .withArgs({currency: 'EUR', mediaType: 'video', size: '*'})
765
+ .returns({currency: 'GBP', floor: 4.75})
766
+ .withArgs({currency: 'EUR', mediaType: 'video', size: [1280, 720]})
767
+ .returns({currency: 'GBP', floor: 6.50})
768
+
769
+ delete bidReq.bids[0].mediaTypes.banner;
770
+ bidReq.bids[0].mediaTypes.video = {
771
+ playerSize: [640, 480],
772
+ context: 'instream'
773
+ };
774
+
775
+ delete bidReq.bids[1].mediaTypes.banner;
776
+ bidReq.bids[1].mediaTypes.video = {
777
+ playerSize: [1280, 720],
778
+ context: 'outstream'
779
+ };
780
+
781
+ bidReq.bids[0].getFloor = getFloorStub1;
782
+ bidReq.bids[1].getFloor = getFloorStub2;
783
+
784
+ const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);
785
+
786
+ const serverRequestBids = serverRequestInfo.data.bids;
787
+ const firstBid = serverRequestBids[0];
788
+ const secondBid = serverRequestBids[1];
789
+
790
+ assert.nestedPropertyVal(firstBid, 'vid.fp.def', 3.25);
791
+ assert.nestedPropertyVal(firstBid, 'vid.fp.cur', 'NZD');
792
+ assert.deepNestedPropertyVal(firstBid, 'vid.fp.siz', [{w: 640, h: 480, p: 4.10}]);
793
+
794
+ assert.isTrue(getFloorStub1.calledTwice);
795
+
796
+ assert.nestedPropertyVal(secondBid, 'vid.fp.def', 4.75);
797
+ assert.nestedPropertyVal(secondBid, 'vid.fp.cur', 'GBP');
798
+ assert.deepNestedPropertyVal(secondBid, 'vid.fp.siz', [{w: 1280, h: 720, p: 6.50}]);
799
+
800
+ assert.isTrue(getFloorStub2.calledTwice);
801
+ });
802
+
803
+ it('should not add floor info to bid request if floor is unavailable', () => {
804
+ const bidReq = buildBidderRequest();
805
+ const getFloorSpy = sinon.spy(() => ({}));
806
+
807
+ delete bidReq.bids[0].getFloor;
808
+ bidReq.bids[1].getFloor = getFloorSpy;
809
+
810
+ const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);
811
+
812
+ const serverRequestBids = serverRequestInfo.data.bids;
813
+ const firstBid = serverRequestBids[0];
814
+ const secondBid = serverRequestBids[1];
815
+
816
+ assert.nestedPropertyVal(firstBid, 'ban.fp', undefined);
817
+ assert.nestedPropertyVal(secondBid, 'ban.fp', undefined);
818
+
819
+ assert.isTrue(getFloorSpy.calledWith({currency: 'EUR', mediaType: 'banner', size: '*'}));
820
+ assert.isTrue(getFloorSpy.calledWith({currency: 'EUR', mediaType: 'banner', size: [728, 90]}));
821
+ assert.isTrue(getFloorSpy.calledTwice);
822
+ });
823
+
824
+ it('should not add floor info for a size when it is the same as the default', () => {
825
+ const bidReq = buildBidderRequest();
826
+ const getFloorStub = sinon.stub();
827
+
828
+ getFloorStub
829
+ .returns({currency: 'EUR', floor: 1.9})
830
+ .withArgs({currency: 'EUR', mediaType: BANNER, size: [160, 60]})
831
+ .returns({currency: 'EUR', floor: 2.7});
832
+
833
+ bidReq.bids[0].getFloor = getFloorStub;
834
+
835
+ const serverRequestInfo = spec.buildRequests(bidReq.bids, bidReq);
836
+
837
+ const serverRequestBids = serverRequestInfo.data.bids;
838
+ const bid = serverRequestBids[0];
839
+
840
+ assert.nestedPropertyVal(bid, 'ban.fp.def', 1.9);
841
+ assert.nestedPropertyVal(bid, 'ban.fp.cur', 'EUR');
842
+ assert.deepNestedPropertyVal(bid, 'ban.fp.siz', [{w: 160, h: 60, p: 2.7}]);
843
+ });
699
844
  });
700
845
  });
701
846
  });
@@ -0,0 +1,70 @@
1
+ import { setConsentConfig } from 'modules/consentManagement.js';
2
+ import { server } from 'test/mocks/xhr.js';
3
+ import {coreStorage, init, setSubmoduleRegistry, requestBidsHook} from 'modules/userId/index.js';
4
+
5
+ const msIn12Hours = 60 * 60 * 12 * 1000;
6
+ const expireCookieDate = 'Thu, 01 Jan 1970 00:00:01 GMT';
7
+
8
+ export const cookieHelpers = {
9
+ getFutureCookieExpiry: () => new Date(Date.now() + msIn12Hours).toUTCString(),
10
+ setPublisherCookie: (cookieName, token) => coreStorage.setCookie(cookieName, JSON.stringify(token), cookieHelpers.getFutureCookieExpiry()),
11
+ clearCookies: (...cookieNames) => cookieNames.forEach(cookieName => coreStorage.setCookie(cookieName, '', expireCookieDate)),
12
+ }
13
+
14
+ export const runAuction = async () => {
15
+ const adUnits = [{
16
+ code: 'adUnit-code',
17
+ mediaTypes: {banner: {}, native: {}},
18
+ sizes: [[300, 200], [300, 600]],
19
+ bids: [{bidder: 'sampleBidder', params: {placementId: 'banner-only-bidder'}}]
20
+ }];
21
+ return new Promise(function(resolve) {
22
+ requestBidsHook(function() {
23
+ resolve(adUnits[0].bids[0]);
24
+ }, {adUnits});
25
+ });
26
+ }
27
+
28
+ export const apiHelpers = {
29
+ makeTokenResponse: (token, shouldRefresh = false, expired = false) => ({
30
+ advertising_token: token,
31
+ refresh_token: 'fake-refresh-token',
32
+ identity_expires: expired ? Date.now() - 1000 : Date.now() + 60 * 60 * 1000,
33
+ refresh_from: shouldRefresh ? Date.now() - 1000 : Date.now() + 60 * 1000,
34
+ refresh_expires: Date.now() + 24 * 60 * 60 * 1000, // 24 hours
35
+ refresh_response_key: 'wR5t6HKMfJ2r4J7fEGX9Gw==', // Fake data
36
+ }),
37
+ respondAfterDelay: (delay) => new Promise((resolve) => setTimeout(() => {
38
+ server.respond();
39
+ setTimeout(() => resolve());
40
+ }, delay)),
41
+ }
42
+
43
+ export const setGdprApplies = (consent = false) => {
44
+ const consentDetails = consent ? {
45
+ tcString: 'CPhJRpMPhJRpMABAMBFRACBoALAAAEJAAIYgAKwAQAKgArABAAqAAA',
46
+ purpose: {
47
+ consents: {
48
+ '1': true,
49
+ },
50
+ },
51
+ vendor: {
52
+ consents: {
53
+ '21': true,
54
+ },
55
+ }
56
+
57
+ } : {
58
+ tcString: 'CPhJRpMPhJRpMABAMBFRACBoALAAAEJAAIYgAKwAQAKgArABAAqAAA'
59
+ };
60
+ const staticConfig = {
61
+ cmpApi: 'static',
62
+ timeout: 7500,
63
+ consentData: {
64
+ gdprApplies: true,
65
+ ...consentDetails
66
+ }
67
+ }
68
+ setConsentConfig(staticConfig);
69
+ return staticConfig;
70
+ }