prebid.js 6.0.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/.babelrc.js +1 -7
  2. package/.circleci/config.yml +1 -1
  3. package/README.md +1 -1
  4. package/browsers.json +13 -29
  5. package/gulpfile.js +88 -82
  6. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  7. package/karma.conf.maker.js +2 -2
  8. package/modules/33acrossBidAdapter.js +189 -102
  9. package/modules/adagioBidAdapter.js +1 -1
  10. package/modules/addefendBidAdapter.js +1 -0
  11. package/modules/adheseBidAdapter.js +7 -2
  12. package/modules/adkernelBidAdapter.js +147 -61
  13. package/modules/adlivetechBidAdapter.md +61 -0
  14. package/modules/adlooxAdServerVideo.js +2 -2
  15. package/modules/adlooxAnalyticsAdapter.js +4 -4
  16. package/modules/admanBidAdapter.js +1 -0
  17. package/modules/admixerBidAdapter.js +3 -2
  18. package/modules/adnuntiusBidAdapter.js +5 -2
  19. package/modules/adomikAnalyticsAdapter.js +16 -4
  20. package/modules/adplusBidAdapter.js +203 -0
  21. package/modules/adplusBidAdapter.md +39 -0
  22. package/modules/adxcgBidAdapter.js +311 -359
  23. package/modules/adxcgBidAdapter.md +22 -21
  24. package/modules/adyoulikeBidAdapter.js +7 -2
  25. package/modules/aniviewBidAdapter.js +1 -1
  26. package/modules/appnexusBidAdapter.js +23 -3
  27. package/modules/beachfrontBidAdapter.js +14 -17
  28. package/modules/beopBidAdapter.js +6 -4
  29. package/modules/bidViewability.js +3 -3
  30. package/modules/bidViewabilityIO.js +3 -3
  31. package/modules/codefuelBidAdapter.js +1 -3
  32. package/modules/codefuelBidAdapter.md +3 -3
  33. package/modules/colossussspBidAdapter.js +7 -0
  34. package/modules/compassBidAdapter.js +201 -0
  35. package/modules/compassBidAdapter.md +79 -0
  36. package/modules/craftBidAdapter.js +5 -3
  37. package/modules/criteoBidAdapter.js +1 -1
  38. package/modules/currency.js +2 -2
  39. package/modules/cwireBidAdapter.js +3 -0
  40. package/modules/dailyhuntBidAdapter.js +435 -0
  41. package/modules/dailyhuntBidAdapter.md +4 -0
  42. package/modules/datablocksBidAdapter.js +3 -3
  43. package/modules/dchain.js +149 -0
  44. package/modules/dchain.md +45 -0
  45. package/modules/deepintentBidAdapter.js +1 -1
  46. package/modules/dspxBidAdapter.js +1 -1
  47. package/modules/emx_digitalBidAdapter.js +9 -1
  48. package/modules/engageyaBidAdapter.js +68 -54
  49. package/modules/feedadBidAdapter.js +2 -2
  50. package/modules/feedadBidAdapter.md +4 -2
  51. package/modules/freewheel-sspBidAdapter.js +6 -0
  52. package/modules/futureads.md +48 -0
  53. package/modules/glimpseBidAdapter.js +44 -16
  54. package/modules/goldbachBidAdapter.js +1176 -0
  55. package/modules/goldbachBidAdapter.md +151 -0
  56. package/modules/gptPreAuction.js +11 -5
  57. package/modules/gridBidAdapter.js +5 -4
  58. package/modules/gumgumBidAdapter.js +7 -3
  59. package/modules/id5IdSystem.md +6 -6
  60. package/modules/imRtdProvider.js +31 -0
  61. package/modules/improvedigitalBidAdapter.js +19 -3
  62. package/modules/instreamTracking.js +4 -4
  63. package/modules/intersectionRtdProvider.js +114 -0
  64. package/modules/invibesBidAdapter.js +64 -14
  65. package/modules/invibesBidAdapter.md +2 -1
  66. package/modules/ipromBidAdapter.js +79 -0
  67. package/modules/ixBidAdapter.js +185 -22
  68. package/modules/kinessoIdSystem.js +1 -1
  69. package/modules/limelightDigitalBidAdapter.js +2 -1
  70. package/modules/livewrappedBidAdapter.js +8 -2
  71. package/modules/lotamePanoramaIdSystem.js +80 -8
  72. package/modules/luponmediaBidAdapter.js +570 -0
  73. package/modules/mediasquareBidAdapter.js +1 -9
  74. package/modules/merkleIdSystem.js +5 -0
  75. package/modules/missenaBidAdapter.js +89 -0
  76. package/modules/nativoBidAdapter.js +27 -1
  77. package/modules/nextMillenniumBidAdapter.js +37 -7
  78. package/modules/oguryBidAdapter.js +2 -1
  79. package/modules/openxBidAdapter.js +6 -1
  80. package/modules/prebidServerBidAdapter/index.js +19 -15
  81. package/modules/pubgeniusBidAdapter.js +1 -1
  82. package/modules/pubmaticBidAdapter.js +5 -3
  83. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  84. package/modules/relaidoBidAdapter.js +86 -65
  85. package/modules/richaudienceBidAdapter.js +2 -3
  86. package/modules/rtdModule/index.js +48 -18
  87. package/modules/rubiconBidAdapter.js +31 -19
  88. package/modules/saambaaBidAdapter.js +420 -0
  89. package/modules/saambaaBidAdapter.md +65 -68
  90. package/modules/seedtagBidAdapter.js +6 -0
  91. package/modules/sharedIdSystem.js +27 -1
  92. package/modules/smaatoBidAdapter.js +9 -1
  93. package/modules/smartxBidAdapter.js +17 -1
  94. package/modules/sspBCBidAdapter.js +34 -3
  95. package/modules/tappxBidAdapter.js +3 -1
  96. package/modules/targetVideoBidAdapter.js +187 -0
  97. package/modules/targetVideoBidAdapter.md +34 -0
  98. package/modules/telariaBidAdapter.js +2 -2
  99. package/modules/trustxBidAdapter.js +18 -17
  100. package/modules/undertoneBidAdapter.js +8 -1
  101. package/modules/userId/index.js +27 -2
  102. package/modules/ventes.md +71 -0
  103. package/modules/ventesBidAdapter.js +104 -64
  104. package/modules/ventesBidAdapter.md +0 -1
  105. package/modules/vidoomyBidAdapter.js +65 -108
  106. package/modules/visxBidAdapter.js +20 -3
  107. package/modules/visxBidAdapter.md +4 -6
  108. package/modules/weboramaRtdProvider.js +288 -73
  109. package/modules/weboramaRtdProvider.md +27 -10
  110. package/modules/yahoosspBidAdapter.js +5 -1
  111. package/modules/yahoosspBidAdapter.md +1 -1
  112. package/modules/yieldlabBidAdapter.js +41 -10
  113. package/modules/yieldlabBidAdapter.md +91 -48
  114. package/modules/yieldoneBidAdapter.js +115 -11
  115. package/modules/zetaSspBidAdapter.md +33 -1
  116. package/modules/zeta_global_sspBidAdapter.js +22 -1
  117. package/package.json +6 -1
  118. package/plugins/pbjsGlobals.js +28 -1
  119. package/src/adapterManager.js +14 -8
  120. package/src/auction.js +5 -4
  121. package/src/prebid.js +1 -2
  122. package/src/targeting.js +24 -3
  123. package/src/utils.js +41 -7
  124. package/test/helpers/prebidGlobal.js +1 -0
  125. package/test/spec/integration/faker/googletag.js +6 -0
  126. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  127. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  128. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  129. package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
  130. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  131. package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
  132. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  133. package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
  134. package/test/spec/modules/appnexusBidAdapter_spec.js +63 -1
  135. package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
  136. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  137. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  138. package/test/spec/modules/bidViewability_spec.js +4 -4
  139. package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
  140. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  141. package/test/spec/modules/compassBidAdapter_spec.js +397 -0
  142. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  143. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  144. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  145. package/test/spec/modules/dchain_spec.js +329 -0
  146. package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
  147. package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
  148. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  149. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  150. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
  151. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  152. package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
  153. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  154. package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
  155. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  156. package/test/spec/modules/improvedigitalBidAdapter_spec.js +3 -1
  157. package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
  158. package/test/spec/modules/invibesBidAdapter_spec.js +148 -4
  159. package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
  160. package/test/spec/modules/ixBidAdapter_spec.js +293 -2
  161. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  162. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
  163. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  164. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  165. package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
  166. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  167. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  168. package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
  169. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  170. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  171. package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
  172. package/test/spec/modules/openxBidAdapter_spec.js +5 -0
  173. package/test/spec/modules/prebidServerBidAdapter_spec.js +62 -2
  174. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  175. package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
  176. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  177. package/test/spec/modules/realTimeDataModule_spec.js +135 -49
  178. package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
  179. package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
  180. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  181. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  182. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  183. package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
  184. package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
  185. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  186. package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
  187. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  188. package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
  189. package/test/spec/modules/userId_spec.js +51 -0
  190. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  191. package/test/spec/modules/visxBidAdapter_spec.js +121 -5
  192. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  193. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  194. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  195. package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
  196. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  197. package/test/spec/unit/core/adapterManager_spec.js +24 -6
  198. package/test/spec/unit/core/targeting_spec.js +116 -0
  199. package/test/spec/utils_spec.js +38 -0
  200. package/test/test_deps.js +3 -0
  201. package/test/test_index.js +1 -3
@@ -4,6 +4,7 @@ import { spec } from 'modules/nextMillenniumBidAdapter.js';
4
4
  describe('nextMillenniumBidAdapterTests', function() {
5
5
  const bidRequestData = [
6
6
  {
7
+ adUnitCode: 'test-div',
7
8
  bidId: 'bid1234',
8
9
  auctionId: 'b06c5141-fe8f-4cdf-9d7d-54415490a917',
9
10
  bidder: 'nextMillennium',
@@ -17,19 +18,43 @@ describe('nextMillenniumBidAdapterTests', function() {
17
18
  }
18
19
  ];
19
20
 
20
- it('Request params check with GDPR Consent', function () {
21
+ it('Request params check with GDPR and USP Consent', function () {
21
22
  const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
22
23
  expect(JSON.parse(request[0].data).user.ext.consent).to.equal('kjfdniwjnifwenrif3');
23
24
  expect(JSON.parse(request[0].data).regs.ext.us_privacy).to.equal('1---');
24
25
  expect(JSON.parse(request[0].data).regs.ext.gdpr).to.equal(1);
25
26
  });
26
27
 
28
+ it('Request params check without GDPR Consent', function () {
29
+ delete bidRequestData[0].gdprConsent
30
+ const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
31
+ expect(JSON.parse(request[0].data).regs.ext.gdpr).to.be.undefined;
32
+ expect(JSON.parse(request[0].data).regs.ext.us_privacy).to.equal('1---');
33
+ });
34
+
27
35
  it('validate_generated_params', function() {
28
36
  const request = spec.buildRequests(bidRequestData);
29
37
  expect(request[0].bidId).to.equal('bid1234');
30
38
  expect(JSON.parse(request[0].data).id).to.equal('b06c5141-fe8f-4cdf-9d7d-54415490a917');
31
39
  });
32
40
 
41
+ it('Check if refresh_count param is incremented', function() {
42
+ const request = spec.buildRequests(bidRequestData);
43
+ expect(JSON.parse(request[0].data).refresh_count).to.equal(3);
44
+ });
45
+
46
+ it('Test getUserSyncs function', function () {
47
+ const syncOptions = {
48
+ 'iframeEnabled': true
49
+ }
50
+ const userSync = spec.getUserSyncs(syncOptions);
51
+ expect(userSync).to.be.an('array').with.lengthOf(1);
52
+ expect(userSync[0].type).to.exist;
53
+ expect(userSync[0].url).to.exist;
54
+ expect(userSync[0].type).to.be.equal('iframe');
55
+ expect(userSync[0].url).to.be.equal('https://statics.nextmillmedia.com/load-cookie.html?v=4');
56
+ });
57
+
33
58
  it('validate_response_params', function() {
34
59
  const serverResponse = {
35
60
  body: {
@@ -119,7 +119,7 @@ describe('OguryBidAdapter', function () {
119
119
  };
120
120
  });
121
121
 
122
- it('should return sync array with two elements of type image', () => {
122
+ it('should return syncs array with two elements of type image', () => {
123
123
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
124
124
 
125
125
  expect(userSyncs).to.have.lengthOf(2);
@@ -129,7 +129,7 @@ describe('OguryBidAdapter', function () {
129
129
  expect(userSyncs[1].url).to.contain('https://ms-cookie-sync.presage.io/ttd/init-sync');
130
130
  });
131
131
 
132
- it('should set the same source as query param', () => {
132
+ it('should set the source as query param', () => {
133
133
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
134
134
  expect(userSyncs[0].url).to.contain('source=prebid');
135
135
  expect(userSyncs[1].url).to.contain('source=prebid');
@@ -146,7 +146,7 @@ describe('OguryBidAdapter', function () {
146
146
  expect(spec.getUserSyncs(syncOptions, [], gdprConsent)).to.have.lengthOf(0);
147
147
  });
148
148
 
149
- it('should return sync array with two elements of type image when consentString is undefined', () => {
149
+ it('should return syncs array with two elements of type image when consentString is undefined', () => {
150
150
  gdprConsent = {
151
151
  gdprApplies: true,
152
152
  consentString: undefined
@@ -160,7 +160,7 @@ describe('OguryBidAdapter', function () {
160
160
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
161
161
  });
162
162
 
163
- it('should return sync array with two elements of type image when consentString is null', () => {
163
+ it('should return syncs array with two elements of type image when consentString is null', () => {
164
164
  gdprConsent = {
165
165
  gdprApplies: true,
166
166
  consentString: null
@@ -174,7 +174,7 @@ describe('OguryBidAdapter', function () {
174
174
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
175
175
  });
176
176
 
177
- it('should return sync array with two elements of type image when gdprConsent is undefined', () => {
177
+ it('should return syncs array with two elements of type image when gdprConsent is undefined', () => {
178
178
  gdprConsent = undefined;
179
179
 
180
180
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
@@ -185,7 +185,7 @@ describe('OguryBidAdapter', function () {
185
185
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
186
186
  });
187
187
 
188
- it('should return sync array with two elements of type image when gdprConsent is null', () => {
188
+ it('should return syncs array with two elements of type image when gdprConsent is null', () => {
189
189
  gdprConsent = null;
190
190
 
191
191
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
@@ -196,7 +196,7 @@ describe('OguryBidAdapter', function () {
196
196
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
197
197
  });
198
198
 
199
- it('should return sync array with two elements of type image when gdprConsent is null and gdprApplies is false', () => {
199
+ it('should return syncs array with two elements of type image when gdprConsent is null and gdprApplies is false', () => {
200
200
  gdprConsent = {
201
201
  gdprApplies: false,
202
202
  consentString: null
@@ -210,7 +210,7 @@ describe('OguryBidAdapter', function () {
210
210
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
211
211
  });
212
212
 
213
- it('should return sync array with two elements of type image when gdprConsent is empty string and gdprApplies is false', () => {
213
+ it('should return syncs array with two elements of type image when gdprConsent is empty string and gdprApplies is false', () => {
214
214
  gdprConsent = {
215
215
  gdprApplies: false,
216
216
  consentString: ''
@@ -240,7 +240,8 @@ describe('OguryBidAdapter', function () {
240
240
  w: 300,
241
241
  h: 250
242
242
  }]
243
- }
243
+ },
244
+ ext: bidRequests[0].params
244
245
  }, {
245
246
  id: bidRequests[1].bidId,
246
247
  tagid: bidRequests[1].params.adUnitId,
@@ -250,7 +251,8 @@ describe('OguryBidAdapter', function () {
250
251
  w: 600,
251
252
  h: 500
252
253
  }]
253
- }
254
+ },
255
+ ext: bidRequests[1].params
254
256
  }],
255
257
  regs: {
256
258
  ext: {
@@ -549,7 +551,7 @@ describe('OguryBidAdapter', function () {
549
551
  xhr.restore()
550
552
  })
551
553
 
552
- it('should send notification on bid timeout', function() {
554
+ it('should send on bid timeout notification', function() {
553
555
  const bid = {
554
556
  ad: '<img style="width: 300px; height: 250px;" src="https://assets.afcdn.com/recipe/20190529/93153_w1024h768c1cx2220cy1728cxt0cyt0cxb4441cyb3456.jpg" alt="cookies" />',
555
557
  cpm: 3
@@ -1102,6 +1102,11 @@ describe('OpenxAdapter', function () {
1102
1102
  mwOpenLinkId: '1111-mwopenlinkid',
1103
1103
  dapId: '1111-dapId',
1104
1104
  amxId: '1111-amxid',
1105
+ kpuid: '1111-kpuid',
1106
+ publinkId: '1111-publinkid',
1107
+ naveggId: '1111-naveggid',
1108
+ imuid: '1111-imuid',
1109
+ adtelligentId: '1111-adtelligentid'
1105
1110
  };
1106
1111
 
1107
1112
  // generates the same set of tests for each id provider
@@ -8,6 +8,7 @@ import events from 'src/events.js';
8
8
  import CONSTANTS from 'src/constants.json';
9
9
  import { server } from 'test/mocks/xhr.js';
10
10
  import { createEidsArray } from 'modules/userId/eids.js';
11
+ import {deepAccess, deepClone} from 'src/utils.js';
11
12
 
12
13
  let CONFIG = {
13
14
  accountId: '1',
@@ -507,6 +508,17 @@ describe('S2S Adapter', function () {
507
508
  resetSyncedStatus();
508
509
  });
509
510
 
511
+ it('should set id to auction ID and source.tid to tid', function () {
512
+ config.setConfig({ s2sConfig: CONFIG });
513
+
514
+ adapter.callBids(OUTSTREAM_VIDEO_REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
515
+
516
+ const requestBid = JSON.parse(server.requests[0].requestBody);
517
+ expect(requestBid.id).to.equal('173afb6d132ba3');
518
+ expect(requestBid.source).to.be.an('object');
519
+ expect(requestBid.source.tid).to.equal('437fbbf5-33f5-487a-8e16-a7112903cfe5');
520
+ });
521
+
510
522
  it('should block request if config did not define p1Consent URL in endpoint object config', function() {
511
523
  let badConfig = utils.deepClone(CONFIG);
512
524
  badConfig.endpoint = { noP1Consent: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction' };
@@ -1081,6 +1093,18 @@ describe('S2S Adapter', function () {
1081
1093
  });
1082
1094
  });
1083
1095
 
1096
+ it('should not include ext.aspectratios if adunit\'s aspect_ratios do not define radio_width and ratio_height', () => {
1097
+ const req = deepClone(REQUEST);
1098
+ req.ad_units[0].mediaTypes.native.icon.aspect_ratios[0] = {'min_width': 1, 'min_height': 2};
1099
+ adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
1100
+ const nativeReq = JSON.parse(JSON.parse(server.requests[0].requestBody).imp[0].native.request);
1101
+ const icons = nativeReq.assets.map((a) => a.img).filter((img) => img && img.type === 1);
1102
+ expect(icons).to.have.length(1);
1103
+ expect(icons[0].hmin).to.equal(2);
1104
+ expect(icons[0].wmin).to.equal(1);
1105
+ expect(deepAccess(icons[0], 'ext.aspectratios')).to.be.undefined;
1106
+ })
1107
+
1084
1108
  it('adds site if app is not present', function () {
1085
1109
  const _config = {
1086
1110
  s2sConfig: CONFIG,
@@ -1705,7 +1729,7 @@ describe('S2S Adapter', function () {
1705
1729
  expect(parsedRequestBody.ext.prebid.channel).to.deep.equal({name: 'pbjs', version: 'v$prebid.version$'});
1706
1730
  });
1707
1731
 
1708
- it('does not set pbjs version in request if channel does exist in s2sConfig', () => {
1732
+ it('extPrebid is now mergedDeep -> should include default channel as well', () => {
1709
1733
  const s2sBidRequest = utils.deepClone(REQUEST);
1710
1734
  const bidRequests = utils.deepClone(BID_REQUESTS);
1711
1735
 
@@ -1714,7 +1738,13 @@ describe('S2S Adapter', function () {
1714
1738
  adapter.callBids(s2sBidRequest, bidRequests, addBidResponse, done, ajax);
1715
1739
 
1716
1740
  const parsedRequestBody = JSON.parse(server.requests[0].requestBody);
1717
- expect(parsedRequestBody.ext.prebid.channel).to.deep.equal({test: 1});
1741
+
1742
+ // extPrebid is now deep merged with
1743
+ expect(parsedRequestBody.ext.prebid.channel).to.deep.equal({
1744
+ name: 'pbjs',
1745
+ test: 1,
1746
+ version: 'v$prebid.version$'
1747
+ });
1718
1748
  });
1719
1749
 
1720
1750
  it('passes first party data in request', () => {
@@ -2403,6 +2433,36 @@ describe('S2S Adapter', function () {
2403
2433
 
2404
2434
  utils.getBidRequest.restore();
2405
2435
  });
2436
+
2437
+ describe('on sync requested with no cookie', () => {
2438
+ let cfg, req, csRes;
2439
+
2440
+ beforeEach(() => {
2441
+ cfg = utils.deepClone(CONFIG);
2442
+ req = utils.deepClone(REQUEST);
2443
+ cfg.syncEndpoint = { p1Consent: 'https://prebid.adnxs.com/pbs/v1/cookie_sync' };
2444
+ req.s2sConfig = cfg;
2445
+ config.setConfig({ s2sConfig: cfg });
2446
+ csRes = utils.deepClone(RESPONSE_NO_COOKIE);
2447
+ });
2448
+
2449
+ afterEach(() => {
2450
+ resetSyncedStatus();
2451
+ })
2452
+
2453
+ Object.entries({
2454
+ iframe: () => utils.insertUserSyncIframe,
2455
+ image: () => utils.triggerPixel,
2456
+ }).forEach(([type, syncer]) => {
2457
+ it(`passes timeout to ${type} syncs`, () => {
2458
+ cfg.syncTimeout = 123;
2459
+ csRes.bidder_status[0].usersync.type = type;
2460
+ adapter.callBids(req, BID_REQUESTS, addBidResponse, done, ajax);
2461
+ server.requests[0].respond(200, {}, JSON.stringify(csRes));
2462
+ expect(syncer().args[0]).to.include.members([123]);
2463
+ });
2464
+ });
2465
+ });
2406
2466
  });
2407
2467
 
2408
2468
  describe('bid won events', function () {
@@ -173,7 +173,7 @@ describe('pubGENIUS adapter', () => {
173
173
 
174
174
  expectedRequest = {
175
175
  method: 'POST',
176
- url: 'https://ortb.adpearl.io/prebid/auction',
176
+ url: 'https://auction.adpearl.io/prebid/auction',
177
177
  data: {
178
178
  id: 'fake-auction-id',
179
179
  imp: [
@@ -493,7 +493,7 @@ describe('pubGENIUS adapter', () => {
493
493
  };
494
494
  expectedSync = {
495
495
  type: 'iframe',
496
- url: 'https://ortb.adpearl.io/usersync/pixels.html?',
496
+ url: 'https://auction.adpearl.io/usersync/pixels.html?',
497
497
  };
498
498
  });
499
499
 
@@ -551,7 +551,7 @@ describe('pubGENIUS adapter', () => {
551
551
  onTimeout(timeoutData);
552
552
 
553
553
  expect(server.requests[0].method).to.equal('POST');
554
- expect(server.requests[0].url).to.equal('https://ortb.adpearl.io/prebid/events?type=timeout');
554
+ expect(server.requests[0].url).to.equal('https://auction.adpearl.io/prebid/events?type=timeout');
555
555
  expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(timeoutData);
556
556
  });
557
557
  });
@@ -3457,7 +3457,7 @@ describe('PubMatic adapter', function () {
3457
3457
  'h': 0,
3458
3458
  'dealId': 'ASEA-MS-KLY-TTD-DESKTOP-ID-VID-6S-030420',
3459
3459
  'ext': {
3460
- 'BidType': 1
3460
+ 'bidtype': 1
3461
3461
  }
3462
3462
  }],
3463
3463
  'ext': {
@@ -28,6 +28,7 @@ describe('pubxai analytics adapter', function() {
28
28
  };
29
29
 
30
30
  let location = utils.getWindowLocation();
31
+ let storage = window.top['sessionStorage'];
31
32
 
32
33
  let prebidEvent = {
33
34
  'auctionInit': {
@@ -514,6 +515,11 @@ describe('pubxai analytics adapter', function() {
514
515
  'path': location.pathname,
515
516
  'search': location.search
516
517
  },
518
+ 'pmcDetail': {
519
+ 'bidDensity': storage.getItem('pbx:dpbid'),
520
+ 'maxBid': storage.getItem('pbx:mxbid'),
521
+ 'auctionId': storage.getItem('pbx:aucid')
522
+ }
517
523
  };
518
524
 
519
525
  let expectedAfterBid = {
@@ -577,6 +583,11 @@ describe('pubxai analytics adapter', function() {
577
583
  'deviceOS': getOS(),
578
584
  'browser': getBrowser()
579
585
  },
586
+ 'pmcDetail': {
587
+ 'bidDensity': storage.getItem('pbx:dpbid'),
588
+ 'maxBid': storage.getItem('pbx:mxbid'),
589
+ 'auctionId': storage.getItem('pbx:aucid')
590
+ },
580
591
  'initOptions': initOptions
581
592
  };
582
593
 
@@ -1,6 +1,8 @@
1
1
  import * as rtdModule from 'modules/rtdModule/index.js';
2
- import { config } from 'src/config.js';
2
+ import {config} from 'src/config.js';
3
3
  import * as sinon from 'sinon';
4
+ import {default as CONSTANTS} from '../../../src/constants.json';
5
+ import {default as events} from '../../../src/events.js';
4
6
 
5
7
  const getBidRequestDataSpy = sinon.spy();
6
8
 
@@ -58,33 +60,87 @@ const conf = {
58
60
  };
59
61
 
60
62
  describe('Real time module', function () {
61
- before(function () {
62
- rtdModule.attachRealTimeDataProvider(validSM);
63
- rtdModule.attachRealTimeDataProvider(invalidSM);
64
- rtdModule.attachRealTimeDataProvider(failureSM);
65
- rtdModule.attachRealTimeDataProvider(nonConfSM);
66
- rtdModule.attachRealTimeDataProvider(validSMWait);
67
- });
63
+ let eventHandlers;
64
+ let sandbox;
68
65
 
69
- after(function () {
70
- config.resetConfig();
71
- });
66
+ function mockEmitEvent(event, ...args) {
67
+ (eventHandlers[event] || []).forEach((h) => h(...args));
68
+ }
72
69
 
73
- beforeEach(function () {
74
- config.setConfig(conf);
70
+ before(() => {
71
+ eventHandlers = {};
72
+ sandbox = sinon.sandbox.create();
73
+ sandbox.stub(events, 'on').callsFake((event, handler) => {
74
+ if (!eventHandlers.hasOwnProperty(event)) {
75
+ eventHandlers[event] = [];
76
+ }
77
+ eventHandlers[event].push(handler);
78
+ });
75
79
  });
76
80
 
77
- it('should use only valid modules', function () {
78
- rtdModule.init(config);
79
- expect(rtdModule.subModules).to.eql([validSMWait, validSM]);
81
+ after(() => {
82
+ sandbox.restore();
80
83
  });
81
84
 
82
- it('should be able to modify bid request', function (done) {
83
- rtdModule.setBidRequestsData(() => {
84
- assert(getBidRequestDataSpy.calledTwice);
85
- assert(getBidRequestDataSpy.calledWith({bidRequest: {}}));
85
+ describe('', () => {
86
+ const PROVIDERS = [validSM, invalidSM, failureSM, nonConfSM, validSMWait];
87
+ let _detachers;
88
+
89
+ beforeEach(function () {
90
+ _detachers = PROVIDERS.map(rtdModule.attachRealTimeDataProvider);
91
+ rtdModule.init(config);
92
+ config.setConfig(conf);
93
+ });
94
+
95
+ afterEach(function () {
96
+ _detachers.forEach((f) => f());
97
+ config.resetConfig();
98
+ });
99
+
100
+ it('should use only valid modules', function () {
101
+ expect(rtdModule.subModules).to.eql([validSMWait, validSM]);
102
+ });
103
+
104
+ it('should be able to modify bid request', function (done) {
105
+ rtdModule.setBidRequestsData(() => {
106
+ assert(getBidRequestDataSpy.calledTwice);
107
+ assert(getBidRequestDataSpy.calledWith({bidRequest: {}}));
108
+ done();
109
+ }, {bidRequest: {}})
110
+ });
111
+
112
+ it('sould place targeting on adUnits', function (done) {
113
+ const auction = {
114
+ adUnitCodes: ['ad1', 'ad2'],
115
+ adUnits: [
116
+ {
117
+ code: 'ad1'
118
+ },
119
+ {
120
+ code: 'ad2',
121
+ adserverTargeting: {preKey: 'preValue'}
122
+ }
123
+ ]
124
+ };
125
+
126
+ const expectedAdUnits = [
127
+ {
128
+ code: 'ad1',
129
+ adserverTargeting: {key: 'validSMWait'}
130
+ },
131
+ {
132
+ code: 'ad2',
133
+ adserverTargeting: {
134
+ preKey: 'preValue',
135
+ key: 'validSM'
136
+ }
137
+ }
138
+ ];
139
+
140
+ const adUnits = rtdModule.getAdUnitTargeting(auction);
141
+ assert.deepEqual(expectedAdUnits, adUnits)
86
142
  done();
87
- }, {bidRequest: {}})
143
+ })
88
144
  });
89
145
 
90
146
  it('deep merge object', function () {
@@ -125,36 +181,66 @@ describe('Real time module', function () {
125
181
  assert.deepEqual(expected, merged);
126
182
  });
127
183
 
128
- it('sould place targeting on adUnits', function (done) {
129
- const auction = {
130
- adUnitCodes: ['ad1', 'ad2'],
131
- adUnits: [
132
- {
133
- code: 'ad1'
134
- },
135
- {
136
- code: 'ad2',
137
- adserverTargeting: {preKey: 'preValue'}
138
- }
139
- ]
184
+ describe('event', () => {
185
+ const EVENTS = {
186
+ [CONSTANTS.EVENTS.AUCTION_INIT]: 'onAuctionInitEvent',
187
+ [CONSTANTS.EVENTS.AUCTION_END]: 'onAuctionEndEvent',
188
+ [CONSTANTS.EVENTS.BID_RESPONSE]: 'onBidResponseEvent',
189
+ [CONSTANTS.EVENTS.BID_REQUESTED]: 'onBidRequestEvent'
190
+ }
191
+ const conf = {
192
+ 'realTimeData': {
193
+ dataProviders: [
194
+ {
195
+ 'name': 'tp1',
196
+ },
197
+ {
198
+ 'name': 'tp2'
199
+ }
200
+ ]
201
+ }
140
202
  };
203
+ let providers;
204
+ let _detachers;
141
205
 
142
- const expectedAdUnits = [
143
- {
144
- code: 'ad1',
145
- adserverTargeting: {key: 'validSMWait'}
146
- },
147
- {
148
- code: 'ad2',
149
- adserverTargeting: {
150
- preKey: 'preValue',
151
- key: 'validSM'
152
- }
206
+ function eventHandlingProvider(name) {
207
+ const provider = {
208
+ name: name,
209
+ init: () => true
153
210
  }
154
- ];
155
-
156
- const adUnits = rtdModule.getAdUnitTargeting(auction);
157
- assert.deepEqual(expectedAdUnits, adUnits)
158
- done();
211
+ Object.values(EVENTS).forEach((ev) => provider[ev] = sinon.spy());
212
+ return provider;
213
+ }
214
+
215
+ beforeEach(() => {
216
+ providers = [eventHandlingProvider('tp1'), eventHandlingProvider('tp2')];
217
+ _detachers = providers.map(rtdModule.attachRealTimeDataProvider);
218
+ rtdModule.init(config);
219
+ config.setConfig(conf);
220
+ });
221
+
222
+ afterEach(() => {
223
+ _detachers.forEach((d) => d())
224
+ config.resetConfig();
225
+ })
226
+
227
+ Object.entries(EVENTS).forEach(([event, hook]) => {
228
+ it(`'${event}' should be propagated to providers through '${hook}'`, () => {
229
+ const eventArg = {};
230
+ mockEmitEvent(event, eventArg);
231
+ providers.forEach((provider) => {
232
+ const providerConf = conf.realTimeData.dataProviders.find((cfg) => cfg.name === provider.name);
233
+ expect(provider[hook].called).to.be.true;
234
+ expect(provider[hook].args).to.have.length(1);
235
+ expect(provider[hook].args[0]).to.include.members([eventArg, providerConf])
236
+ })
237
+ });
238
+
239
+ it(`${event} should not fail to propagate elsewhere if a provider throws in its event handler`, () => {
240
+ providers[0][hook] = function () { throw new Error() };
241
+ mockEmitEvent(event);
242
+ expect(providers[1][hook].called).to.be.true;
243
+ });
244
+ });
159
245
  })
160
246
  });