prebid.js 8.0.0 → 8.2.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 (232) hide show
  1. package/.devcontainer/devcontainer.json +3 -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/admanBidAdapter.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/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/bedigitechBidAdapter.js +1 -1
  21. package/dist/beopBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/bridBidAdapter.js +1 -0
  26. package/dist/bridgewellBidAdapter.js +1 -1
  27. package/dist/brightMountainMediaBidAdapter.js +1 -1
  28. package/dist/carodaBidAdapter.js +1 -1
  29. package/dist/categoryTranslation.js +1 -1
  30. package/dist/chtnwBidAdapter.js +1 -1
  31. package/dist/cmp.js +1 -0
  32. package/dist/colossussspBidAdapter.js +1 -1
  33. package/dist/conceptxBidAdapter.js +1 -1
  34. package/dist/concertBidAdapter.js +1 -1
  35. package/dist/connectadBidAdapter.js +1 -1
  36. package/dist/consentManagement.js +1 -1
  37. package/dist/consentManagementGpp.js +1 -1
  38. package/dist/consentManagementUsp.js +1 -1
  39. package/dist/consumableBidAdapter.js +1 -1
  40. package/dist/conversantAnalyticsAdapter.js +1 -1
  41. package/dist/conversantBidAdapter.js +1 -1
  42. package/dist/craftBidAdapter.js +1 -1
  43. package/dist/criteoBidAdapter.js +1 -1
  44. package/dist/cwireBidAdapter.js +1 -1
  45. package/dist/dependencies.json +15 -0
  46. package/dist/dspxBidAdapter.js +1 -1
  47. package/dist/eplanningBidAdapter.js +1 -1
  48. package/dist/euidIdSystem.js +1 -1
  49. package/dist/feedadBidAdapter.js +1 -1
  50. package/dist/finativeBidAdapter.js +1 -1
  51. package/dist/freepassBidAdapter.js +1 -0
  52. package/dist/freewheel-sspBidAdapter.js +1 -1
  53. package/dist/gmosspBidAdapter.js +1 -1
  54. package/dist/goldbachBidAdapter.js +1 -1
  55. package/dist/gppControl_usnat.js +1 -0
  56. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  57. package/dist/greenbidsRtdProvider.js +1 -1
  58. package/dist/gridBidAdapter.js +1 -1
  59. package/dist/gumgumBidAdapter.js +1 -1
  60. package/dist/h12mediaBidAdapter.js +1 -1
  61. package/dist/hypelabBidAdapter.js +1 -1
  62. package/dist/id5IdSystem.js +1 -1
  63. package/dist/imdsBidAdapter.js +1 -1
  64. package/dist/improvedigitalBidAdapter.js +1 -1
  65. package/dist/insticatorBidAdapter.js +1 -1
  66. package/dist/intentIqIdSystem.js +1 -1
  67. package/dist/ixBidAdapter.js +1 -1
  68. package/dist/justpremiumBidAdapter.js +1 -1
  69. package/dist/kargoBidAdapter.js +1 -1
  70. package/dist/kiviadsBidAdapter.js +1 -0
  71. package/dist/konduitAnalyticsAdapter.js +1 -1
  72. package/dist/kueezBidAdapter.js +1 -1
  73. package/dist/kueezRtbBidAdapter.js +1 -1
  74. package/dist/kulturemediaBidAdapter.js +1 -1
  75. package/dist/lassoBidAdapter.js +1 -1
  76. package/dist/lifestreetBidAdapter.js +1 -1
  77. package/dist/liveIntentIdSystem.js +1 -1
  78. package/dist/logicadBidAdapter.js +1 -1
  79. package/dist/loglyliftBidAdapter.js +1 -1
  80. package/dist/magniteAnalyticsAdapter.js +1 -1
  81. package/dist/malltvAnalyticsAdapter.js +1 -1
  82. package/dist/marsmediaBidAdapter.js +1 -1
  83. package/dist/mediafuseBidAdapter.js +1 -1
  84. package/dist/mediasquareBidAdapter.js +1 -1
  85. package/dist/mgidBidAdapter.js +1 -1
  86. package/dist/mgidXBidAdapter.js +1 -0
  87. package/dist/minutemediaBidAdapter.js +1 -1
  88. package/dist/minutemediaplusBidAdapter.js +1 -1
  89. package/dist/mspa.js +1 -0
  90. package/dist/nexx360BidAdapter.js +1 -1
  91. package/dist/not-for-prod/prebid.js +146 -139
  92. package/dist/oguryBidAdapter.js +1 -1
  93. package/dist/onetagBidAdapter.js +1 -1
  94. package/dist/ooloAnalyticsAdapter.js +1 -1
  95. package/dist/optidigitalBidAdapter.js +1 -1
  96. package/dist/outbrainBidAdapter.js +1 -1
  97. package/dist/oxxionAnalyticsAdapter.js +1 -1
  98. package/dist/oxxionRtdProvider.js +1 -1
  99. package/dist/parrableIdSystem.js +1 -1
  100. package/dist/pixfutureBidAdapter.js +1 -1
  101. package/dist/prebid-core.js +1 -1
  102. package/dist/publinkIdSystem.js +1 -1
  103. package/dist/pubmaticBidAdapter.js +1 -1
  104. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  105. package/dist/pxyzBidAdapter.js +1 -1
  106. package/dist/quantcastBidAdapter.js +1 -1
  107. package/dist/readpeakBidAdapter.js +1 -1
  108. package/dist/relaidoBidAdapter.js +1 -1
  109. package/dist/retailspotBidAdapter.js +1 -1
  110. package/dist/rhythmoneBidAdapter.js +1 -1
  111. package/dist/riseBidAdapter.js +1 -1
  112. package/dist/rtbhouseBidAdapter.js +1 -1
  113. package/dist/rubiconBidAdapter.js +1 -1
  114. package/dist/seedingAllianceBidAdapter.js +1 -1
  115. package/dist/seedtagBidAdapter.js +1 -1
  116. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  117. package/dist/sharethroughBidAdapter.js +1 -1
  118. package/dist/shinezBidAdapter.js +1 -1
  119. package/dist/smaatoBidAdapter.js +1 -1
  120. package/dist/smartadserverBidAdapter.js +1 -1
  121. package/dist/smartxBidAdapter.js +1 -1
  122. package/dist/smilewantedBidAdapter.js +1 -1
  123. package/dist/sonobiBidAdapter.js +1 -1
  124. package/dist/sovrnAnalyticsAdapter.js +1 -1
  125. package/dist/sovrnBidAdapter.js +1 -1
  126. package/dist/sspBCBidAdapter.js +1 -1
  127. package/dist/stvBidAdapter.js +1 -1
  128. package/dist/sublimeBidAdapter.js +1 -1
  129. package/dist/targetVideoBidAdapter.js +1 -1
  130. package/dist/teadsBidAdapter.js +1 -1
  131. package/dist/trionBidAdapter.js +1 -1
  132. package/dist/tripleliftBidAdapter.js +1 -1
  133. package/dist/ttdBidAdapter.js +1 -1
  134. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  135. package/dist/uid2IdSystem.js +1 -1
  136. package/dist/underdogmediaBidAdapter.js +1 -1
  137. package/dist/undertoneBidAdapter.js +1 -1
  138. package/dist/userId.js +1 -1
  139. package/dist/vidazooBidAdapter.js +1 -1
  140. package/dist/videobyteBidAdapter.js +1 -1
  141. package/dist/visxBidAdapter.js +1 -1
  142. package/dist/vuukleBidAdapter.js +1 -1
  143. package/dist/widespaceBidAdapter.js +1 -1
  144. package/dist/winrBidAdapter.js +1 -1
  145. package/dist/yahoosspBidAdapter.js +1 -1
  146. package/dist/yieldmoBidAdapter.js +1 -1
  147. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  148. package/libraries/cmp/cmpClient.js +139 -0
  149. package/libraries/mspa/activityControls.js +91 -0
  150. package/modules/admanBidAdapter.js +5 -0
  151. package/modules/amxBidAdapter.js +11 -12
  152. package/modules/bedigitechBidAdapter.js +15 -12
  153. package/modules/bedigitechBidAdapter.md +2 -2
  154. package/modules/beopBidAdapter.js +0 -4
  155. package/modules/bidwatchAnalyticsAdapter.js +33 -5
  156. package/modules/bridBidAdapter.js +223 -0
  157. package/modules/categoryTranslation.js +3 -2
  158. package/modules/colossussspBidAdapter.js +9 -0
  159. package/modules/conceptxBidAdapter.js +6 -3
  160. package/modules/consentManagement.js +12 -86
  161. package/modules/consentManagementGpp.js +47 -126
  162. package/modules/consentManagementUsp.js +19 -97
  163. package/modules/freepassBidAdapter.js +98 -0
  164. package/modules/freepassBidAdapter.md +31 -0
  165. package/modules/freepassIdSystem.md +1 -1
  166. package/modules/gppControl_usnat.js +11 -0
  167. package/modules/greenbidsAnalyticsAdapter.js +7 -13
  168. package/modules/gridBidAdapter.js +3 -4
  169. package/modules/intentIqIdSystem.js +11 -9
  170. package/modules/ixBidAdapter.js +284 -55
  171. package/modules/kiviadsBidAdapter.js +212 -0
  172. package/modules/kiviadsBidAdapter.md +79 -0
  173. package/modules/liveIntentIdSystem.js +8 -3
  174. package/modules/mediasquareBidAdapter.js +19 -23
  175. package/modules/mgidXBidAdapter.js +263 -0
  176. package/modules/mgidXBidAdapter.md +79 -0
  177. package/modules/oxxionAnalyticsAdapter.js +33 -5
  178. package/modules/oxxionRtdProvider.js +124 -11
  179. package/modules/oxxionRtdProvider.md +19 -4
  180. package/modules/pubmaticBidAdapter.js +18 -2
  181. package/modules/rtbhouseBidAdapter.js +9 -2
  182. package/modules/rtbhouseBidAdapter.md +27 -8
  183. package/modules/rubiconBidAdapter.js +13 -1
  184. package/modules/sharethroughBidAdapter.js +14 -0
  185. package/modules/sonobiBidAdapter.js +4 -7
  186. package/modules/tripleliftBidAdapter.js +21 -1
  187. package/modules/userId/eids.js +29 -0
  188. package/modules/userId/eids.md +19 -2
  189. package/modules/userId/index.js +78 -29
  190. package/modules/userId/userId.md +3 -0
  191. package/package.json +1 -1
  192. package/src/activities/params.js +4 -1
  193. package/test/spec/libraries/cmp/cmpClient_spec.js +233 -0
  194. package/test/spec/libraries/mspa/activityControls_spec.js +315 -0
  195. package/test/spec/modules/admanBidAdapter_spec.js +8 -2
  196. package/test/spec/modules/adqueryBidAdapter_spec.js +5 -1
  197. package/test/spec/modules/amxBidAdapter_spec.js +6 -3
  198. package/test/spec/modules/bedigitechBidAdapter_spec.js +25 -36
  199. package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +21 -1
  200. package/test/spec/modules/bridBidAdapter_spec.js +129 -0
  201. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +9 -7
  202. package/test/spec/modules/chtnwBidAdapter_spec.js +4 -1
  203. package/test/spec/modules/colossussspBidAdapter_spec.js +29 -0
  204. package/test/spec/modules/consentManagementGpp_spec.js +84 -7
  205. package/test/spec/modules/consentManagement_spec.js +8 -18
  206. package/test/spec/modules/datablocksBidAdapter_spec.js +7 -3
  207. package/test/spec/modules/eids_spec.js +87 -0
  208. package/test/spec/modules/freepassBidAdapter_spec.js +161 -0
  209. package/test/spec/modules/greenbidsAnalyticsAdapter_spec.js +0 -15
  210. package/test/spec/modules/gridBidAdapter_spec.js +29 -28
  211. package/test/spec/modules/insticatorBidAdapter_spec.js +6 -2
  212. package/test/spec/modules/intentIqIdSystem_spec.js +36 -2
  213. package/test/spec/modules/ixBidAdapter_spec.js +785 -15
  214. package/test/spec/modules/kiviadsBidAdapter_spec.js +404 -0
  215. package/test/spec/modules/lassoBidAdapter_spec.js +6 -4
  216. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +17 -2
  217. package/test/spec/modules/liveIntentIdSystem_spec.js +11 -6
  218. package/test/spec/modules/mediasquareBidAdapter_spec.js +3 -0
  219. package/test/spec/modules/mgidXBidAdapter_spec.js +426 -0
  220. package/test/spec/modules/onetagBidAdapter_spec.js +81 -75
  221. package/test/spec/modules/orbidderBidAdapter_spec.js +6 -3
  222. package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +21 -2
  223. package/test/spec/modules/oxxionRtdProvider_spec.js +113 -1
  224. package/test/spec/modules/pubmaticBidAdapter_spec.js +25 -0
  225. package/test/spec/modules/relaidoBidAdapter_spec.js +4 -3
  226. package/test/spec/modules/rtbhouseBidAdapter_spec.js +35 -0
  227. package/test/spec/modules/rubiconBidAdapter_spec.js +41 -0
  228. package/test/spec/modules/sharethroughBidAdapter_spec.js +75 -0
  229. package/test/spec/modules/sonobiBidAdapter_spec.js +15 -15
  230. package/test/spec/modules/tripleliftBidAdapter_spec.js +20 -1
  231. package/test/spec/modules/ucfunnelBidAdapter_spec.js +37 -16
  232. package/test/spec/modules/userId_spec.js +393 -6
@@ -96,7 +96,7 @@ let expectedDataArgs = {
96
96
  aus: '300x250',
97
97
  bidadv: 'appnexus',
98
98
  bid: '14480e9832f2d2b',
99
- inb: 0,
99
+ inb: 1,
100
100
  ito: 0,
101
101
  ipwb: 0,
102
102
  iwb: 0,
@@ -107,7 +107,7 @@ let expectedDataArgs = {
107
107
  aus: '250x250',
108
108
  bidadv: 'appnexus',
109
109
  bid: '14480e9832f2d2b',
110
- inb: 0,
110
+ inb: 1,
111
111
  ito: 0,
112
112
  ipwb: 0,
113
113
  iwb: 0,
@@ -167,11 +167,13 @@ describe('byData Analytics Adapter ', () => {
167
167
  });
168
168
 
169
169
  describe('track-events', function () {
170
- ascAdapter.enableAnalytics(initOptions)
171
- // Step 1: Initialize adapter
172
- adapterManager.enableAnalytics({
173
- provider: 'bydata',
174
- options: initOptions
170
+ before(() => {
171
+ ascAdapter.enableAnalytics(initOptions)
172
+ // Step 1: Initialize adapter
173
+ adapterManager.enableAnalytics({
174
+ provider: 'bydata',
175
+ options: initOptions
176
+ });
175
177
  });
176
178
  it('sends and formatted auction data ', function () {
177
179
  events.emit(constants.EVENTS.BID_TIMEOUT, bidTimeoutArgs);
@@ -39,7 +39,10 @@ describe('ChtnwAdapter', function () {
39
39
  ],
40
40
  }];
41
41
 
42
- const request = spec.buildRequests(bidRequests);
42
+ let request;
43
+ before(() => {
44
+ request = spec.buildRequests(bidRequests);
45
+ })
43
46
 
44
47
  it('Returns POST method', function () {
45
48
  expect(request.method).to.equal('POST');
@@ -283,6 +283,35 @@ describe('ColossussspAdapter', function () {
283
283
  });
284
284
  });
285
285
 
286
+ describe('gpp consent', function () {
287
+ it('bidderRequest.gppConsent', () => {
288
+ bidderRequest.gppConsent = {
289
+ gppString: 'abc123',
290
+ applicableSections: [8]
291
+ };
292
+
293
+ let serverRequest = spec.buildRequests([bid], bidderRequest);
294
+ let data = serverRequest.data;
295
+ expect(data).to.be.an('object');
296
+ expect(data).to.have.property('gpp');
297
+ expect(data).to.have.property('gpp_sid');
298
+
299
+ delete bidderRequest.gppConsent;
300
+ })
301
+
302
+ it('bidderRequest.ortb2.regs.gpp', () => {
303
+ bidderRequest.ortb2.regs = bidderRequest.ortb2.regs || {};
304
+ bidderRequest.ortb2.regs.gpp = 'abc123';
305
+ bidderRequest.ortb2.regs.gpp_sid = [8];
306
+
307
+ let serverRequest = spec.buildRequests([bid], bidderRequest);
308
+ let data = serverRequest.data;
309
+ expect(data).to.be.an('object');
310
+ expect(data).to.have.property('gpp');
311
+ expect(data).to.have.property('gpp_sid');
312
+ })
313
+ });
314
+
286
315
  describe('interpretResponse', function () {
287
316
  let resObject = {
288
317
  body: [{
@@ -1,4 +1,11 @@
1
- import { setConsentConfig, requestBidsHook, resetConsentData, userCMP, consentTimeout, staticConsentData } from 'modules/consentManagementGpp.js';
1
+ import {
2
+ setConsentConfig,
3
+ requestBidsHook,
4
+ resetConsentData,
5
+ userCMP,
6
+ consentTimeout,
7
+ storeConsentData, lookupIabConsent
8
+ } from 'modules/consentManagementGpp.js';
2
9
  import { gppDataHandler } from 'src/adapterManager.js';
3
10
  import * as utils from 'src/utils.js';
4
11
  import { config } from 'src/config.js';
@@ -94,16 +101,79 @@ describe('consentManagementGpp', function () {
94
101
  });
95
102
  });
96
103
 
104
+ describe('lookupIABConsent', () => {
105
+ let mockCmp, mockCmpEvent, gppData, sectionData
106
+ beforeEach(() => {
107
+ gppData = {
108
+ gppString: 'mockString',
109
+ applicableSections: [],
110
+ pingData: {}
111
+ };
112
+ sectionData = {};
113
+ mockCmp = sinon.stub().callsFake(({command, callback, parameter}) => {
114
+ let res;
115
+ switch (command) {
116
+ case 'addEventListener':
117
+ mockCmpEvent = callback;
118
+ break;
119
+ case 'getGPPData':
120
+ res = gppData;
121
+ break;
122
+ case 'getSection':
123
+ res = sectionData[parameter];
124
+ break;
125
+ }
126
+ return Promise.resolve(res);
127
+ });
128
+ })
129
+
130
+ function runLookup() {
131
+ return new Promise((resolve, reject) => lookupIabConsent({onSuccess: resolve, onError: reject}, () => mockCmp));
132
+ }
133
+
134
+ function oneShotLookup() {
135
+ const pm = runLookup();
136
+ mockCmpEvent({eventName: 'sectionChange'});
137
+ return pm;
138
+ }
139
+
140
+ it('fetches all sections', () => {
141
+ gppData.pingData.supportedAPIs = ['usnat', 'usca']
142
+ sectionData = {
143
+ usnat: {mock: 'usnat'},
144
+ usca: {mock: 'usca'}
145
+ };
146
+ return oneShotLookup().then((res) => {
147
+ expect(res.sectionData).to.eql(sectionData);
148
+ });
149
+ });
150
+
151
+ it('does not choke if some section data is not available', () => {
152
+ gppData.pingData.supportedAPIs = ['usnat', 'usca']
153
+ sectionData = {
154
+ usca: {mock: 'data'}
155
+ };
156
+ return oneShotLookup().then((res) => {
157
+ expect(res.sectionData).to.eql(sectionData);
158
+ })
159
+ });
160
+ })
161
+
97
162
  describe('static consent string setConsentConfig value', () => {
98
163
  afterEach(() => {
99
164
  config.resetConfig();
100
165
  });
101
166
 
102
- it('results in user settings overriding system defaults for v2 spec', () => {
167
+ it('results in user settings overriding system defaults', () => {
103
168
  let staticConfig = {
104
169
  gpp: {
105
170
  cmpApi: 'static',
106
171
  timeout: 7500,
172
+ sectionData: {
173
+ usnat: {
174
+ MockUsnatParsedFlag: true
175
+ }
176
+ },
107
177
  consentData: {
108
178
  applicableSections: [7],
109
179
  gppString: 'ABCDEFG1234',
@@ -116,11 +186,10 @@ describe('consentManagementGpp', function () {
116
186
 
117
187
  setConsentConfig(staticConfig);
118
188
  expect(userCMP).to.be.equal('static');
119
- expect(consentTimeout).to.be.equal(0); // should always return without a timeout when config is used
120
189
  const consent = gppDataHandler.getConsentData();
121
190
  expect(consent.gppString).to.eql(staticConfig.gpp.consentData.gppString);
122
- expect(consent.fullGppData).to.eql(staticConfig.gpp.consentData);
123
- expect(staticConsentData).to.be.equal(staticConfig.gpp.consentData);
191
+ expect(consent.gppData).to.eql(staticConfig.gpp.consentData);
192
+ expect(consent.sectionData).to.eql(staticConfig.gpp.sectionData);
124
193
  });
125
194
  });
126
195
  });
@@ -334,6 +403,14 @@ describe('consentManagementGpp', function () {
334
403
  success: true
335
404
  }
336
405
  }
406
+ } else if (data[`${prefix}Call`].command === 'getSection') {
407
+ response = {
408
+ [`${prefix}Return`]: {
409
+ callId,
410
+ returnValue: {},
411
+ success: true
412
+ }
413
+ }
337
414
  }
338
415
  event.source.postMessage(stringifyResponse ? JSON.stringify(response) : response, '*');
339
416
  }
@@ -367,7 +444,7 @@ describe('consentManagementGpp', function () {
367
444
  resetConsentData();
368
445
  });
369
446
 
370
- describe('v2 CMP workflow for iframe pages:', function () {
447
+ describe('workflow for iframe pages:', function () {
371
448
  stringifyResponse = false;
372
449
  let ifr2 = null;
373
450
 
@@ -410,7 +487,7 @@ describe('consentManagementGpp', function () {
410
487
  resetConsentData();
411
488
  });
412
489
 
413
- describe('v2 CMP workflow for normal pages:', function () {
490
+ describe('CMP workflow for normal pages:', function () {
414
491
  beforeEach(function () {
415
492
  window.__gpp = function () {};
416
493
  });
@@ -1,18 +1,17 @@
1
1
  import {
2
- setConsentConfig,
3
- requestBidsHook,
4
- resetConsentData,
5
- userCMP,
6
- consentTimeout,
7
2
  actionTimeout,
8
- staticConsentData,
3
+ consentTimeout,
9
4
  gdprScope,
10
5
  loadConsentData,
11
- setActionTimeout
6
+ requestBidsHook,
7
+ resetConsentData,
8
+ setConsentConfig,
9
+ staticConsentData,
10
+ userCMP
12
11
  } from 'modules/consentManagement.js';
13
- import { gdprDataHandler } from 'src/adapterManager.js';
12
+ import {gdprDataHandler} from 'src/adapterManager.js';
14
13
  import * as utils from 'src/utils.js';
15
- import { config } from 'src/config.js';
14
+ import {config} from 'src/config.js';
16
15
  import 'src/prebid.js';
17
16
 
18
17
  let expect = require('chai').expect;
@@ -487,15 +486,6 @@ describe('consentManagement', function () {
487
486
 
488
487
  testIFramedPage('with/JSON response', false, 'abc12345234', 2);
489
488
  testIFramedPage('with/String response', true, 'abc12345234', 2);
490
-
491
- it('should contain correct v2 CMP definition', (done) => {
492
- setConsentConfig(goodConfig);
493
- requestBidsHook(() => {
494
- const nbArguments = window.__tcfapi.toString().split('\n')[0].split(', ').length;
495
- expect(nbArguments).to.equal(4);
496
- done();
497
- }, {});
498
- });
499
489
  });
500
490
  });
501
491
 
@@ -2,6 +2,7 @@ import { expect } from 'chai';
2
2
  import { spec } from '../../../modules/datablocksBidAdapter.js';
3
3
  import { BotClientTests } from '../../../modules/datablocksBidAdapter.js';
4
4
  import { getStorageManager } from '../../../src/storageManager.js';
5
+ import {deepClone} from '../../../src/utils.js';
5
6
 
6
7
  const bid = {
7
8
  bidId: '2dd581a2b6281d',
@@ -409,7 +410,7 @@ describe('DatablocksAdapter', function() {
409
410
  expect(spec.isBidRequestValid(bid)).to.be.true;
410
411
  });
411
412
  it('Should return false when host/source_id is not set', function() {
412
- let moddedBid = Object.assign({}, bid);
413
+ let moddedBid = deepClone(bid);
413
414
  delete moddedBid.params.source_id;
414
415
  expect(spec.isBidRequestValid(moddedBid)).to.be.false;
415
416
  });
@@ -442,9 +443,12 @@ describe('DatablocksAdapter', function() {
442
443
  });
443
444
 
444
445
  describe('buildRequests', function() {
445
- let request = spec.buildRequests([bid, bid2, nativeBid], bidderRequest);
446
+ let request;
447
+ before(() => {
448
+ request = spec.buildRequests([bid, bid2, nativeBid], bidderRequest);
449
+ expect(request).to.exist;
450
+ })
446
451
 
447
- expect(request).to.exist;
448
452
  it('Returns POST method', function() {
449
453
  expect(request.method).to.exist;
450
454
  expect(request.method).to.equal('POST');
@@ -187,6 +187,24 @@ describe('eids array generation for known sub-modules', function() {
187
187
  });
188
188
  });
189
189
 
190
+ it('bidswitch with ext', function() {
191
+ const userId = {
192
+ bidswitch: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
193
+ };
194
+ const newEids = createEidsArray(userId);
195
+ expect(newEids.length).to.equal(1);
196
+ expect(newEids[0]).to.deep.equal({
197
+ source: 'bidswitch.net',
198
+ uids: [{
199
+ id: 'sample_id',
200
+ atype: 3,
201
+ ext: {
202
+ provider: 'some.provider.com'
203
+ }
204
+ }]
205
+ });
206
+ });
207
+
190
208
  it('medianet', function() {
191
209
  const userId = {
192
210
  medianet: {'id': 'sample_id'}
@@ -202,6 +220,57 @@ describe('eids array generation for known sub-modules', function() {
202
220
  });
203
221
  });
204
222
 
223
+ it('medianet with ext', function() {
224
+ const userId = {
225
+ medianet: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
226
+ };
227
+ const newEids = createEidsArray(userId);
228
+ expect(newEids.length).to.equal(1);
229
+ expect(newEids[0]).to.deep.equal({
230
+ source: 'media.net',
231
+ uids: [{
232
+ id: 'sample_id',
233
+ atype: 3,
234
+ ext: {
235
+ provider: 'some.provider.com'
236
+ }
237
+ }]
238
+ });
239
+ });
240
+
241
+ it('magnite', function() {
242
+ const userId = {
243
+ magnite: {'id': 'sample_id'}
244
+ };
245
+ const newEids = createEidsArray(userId);
246
+ expect(newEids.length).to.equal(1);
247
+ expect(newEids[0]).to.deep.equal({
248
+ source: 'rubiconproject.com',
249
+ uids: [{
250
+ id: 'sample_id',
251
+ atype: 3
252
+ }]
253
+ });
254
+ });
255
+
256
+ it('magnite with ext', function() {
257
+ const userId = {
258
+ magnite: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
259
+ };
260
+ const newEids = createEidsArray(userId);
261
+ expect(newEids.length).to.equal(1);
262
+ expect(newEids[0]).to.deep.equal({
263
+ source: 'rubiconproject.com',
264
+ uids: [{
265
+ id: 'sample_id',
266
+ atype: 3,
267
+ ext: {
268
+ provider: 'some.provider.com'
269
+ }
270
+ }]
271
+ });
272
+ });
273
+
205
274
  it('liveIntentId; getValue call and NO ext', function() {
206
275
  const userId = {
207
276
  lipb: {
@@ -348,6 +417,24 @@ describe('eids array generation for known sub-modules', function() {
348
417
  });
349
418
  });
350
419
 
420
+ it('uid2 with ext', function() {
421
+ const userId = {
422
+ uid2: {'id': 'Sample_AD_Token', 'ext': {'provider': 'some.provider.com'}}
423
+ };
424
+ const newEids = createEidsArray(userId);
425
+ expect(newEids.length).to.equal(1);
426
+ expect(newEids[0]).to.deep.equal({
427
+ source: 'uidapi.com',
428
+ uids: [{
429
+ id: 'Sample_AD_Token',
430
+ atype: 3,
431
+ ext: {
432
+ provider: 'some.provider.com'
433
+ }
434
+ }]
435
+ });
436
+ });
437
+
351
438
  it('euid', function() {
352
439
  const userId = {
353
440
  euid: {'id': 'Sample_AD_Token'}
@@ -0,0 +1,161 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/freepassBidAdapter.js';
3
+ import {newBidder} from 'src/adapters/bidderFactory.js';
4
+
5
+ describe('FreePass adapter', function () {
6
+ const adapter = newBidder(spec);
7
+ describe('inherited functions', function () {
8
+ it('exists and is a function', function () {
9
+ expect(adapter.callBids).to.exist.and.to.be.a('function');
10
+ });
11
+ });
12
+
13
+ describe('isBidRequestValid', function () {
14
+ const bid = {
15
+ bidder: 'freepass',
16
+ userId: {
17
+ freepassId: {
18
+ userId: 'fpid'
19
+ }
20
+ },
21
+ adUnitCode: 'adunit-code',
22
+ };
23
+
24
+ it('should return true when required params found', function () {
25
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
26
+ });
27
+
28
+ it('should return false when adUnitCode is missing', function () {
29
+ let localBid = Object.assign({}, bid);
30
+ delete localBid.adUnitCode;
31
+ expect(spec.isBidRequestValid(localBid)).to.equal(false);
32
+ });
33
+ });
34
+
35
+ describe('buildRequests', function () {
36
+ let bidRequests, bidderRequest;
37
+ beforeEach(function () {
38
+ bidRequests = [{
39
+ 'bidder': 'freepass',
40
+ 'userId': {
41
+ 'freepassId': {
42
+ 'userIp': '172.21.0.1',
43
+ 'userId': '56c4c789-71ce-46f5-989e-9e543f3d5f96',
44
+ 'commonId': 'commonIdValue'
45
+ }
46
+ }
47
+ }];
48
+ bidderRequest = {};
49
+ });
50
+
51
+ it('should return an empty array when no bid requests', function () {
52
+ const bidRequest = spec.buildRequests([], bidderRequest);
53
+ expect(bidRequest).to.be.an('array');
54
+ expect(bidRequest.length).to.equal(0);
55
+ });
56
+
57
+ it('should return a valid bid request object', function () {
58
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
59
+ expect(bidRequest).to.be.an('object');
60
+ expect(bidRequest.data).to.be.an('object');
61
+ expect(bidRequest.method).to.equal('POST');
62
+ expect(bidRequest.url).to.not.equal('');
63
+ expect(bidRequest.url).to.not.equal(undefined);
64
+ expect(bidRequest.url).to.not.equal(null);
65
+ });
66
+
67
+ it('should add user id to user information', function () {
68
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
69
+ const ortbData = bidRequest.data;
70
+ expect(ortbData.user).to.be.an('object');
71
+ expect(ortbData.user.id).to.equal('56c4c789-71ce-46f5-989e-9e543f3d5f96');
72
+ });
73
+
74
+ it('should add freepass commonId to extended user information', function () {
75
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
76
+ const ortbData = bidRequest.data;
77
+ expect(ortbData.user).to.be.an('object');
78
+ expect(ortbData.user.ext).to.be.an('object');
79
+ expect(ortbData.user.ext.fuid).to.equal('commonIdValue');
80
+ });
81
+
82
+ it('should skip freepass commonId when not available', function () {
83
+ let localBidRequests = [Object.assign({}, bidRequests[0])];
84
+ delete localBidRequests[0].userId.freepassId.commonId;
85
+ const bidRequest = spec.buildRequests(localBidRequests, bidderRequest);
86
+ const ortbData = bidRequest.data;
87
+ expect(ortbData.user).to.be.an('object');
88
+ expect(ortbData.user.ext).to.be.an('object');
89
+ expect(ortbData.user.ext.fuid).to.be.undefined;
90
+ });
91
+
92
+ it('should add IP information to extended device information', function () {
93
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
94
+ const ortbData = bidRequest.data;
95
+ expect(ortbData.device).to.be.an('object');
96
+ expect(ortbData.device.ip).to.equal('172.21.0.1');
97
+ expect(ortbData.device.ext).to.be.an('object');
98
+ expect(ortbData.device.ext.is_accurate_ip).to.equal(1);
99
+ });
100
+
101
+ it('should skip IP information when not available', function () {
102
+ let localBidRequests = [Object.assign({}, bidRequests[0])];
103
+ delete localBidRequests[0].userId.freepassId.userIp;
104
+ const bidRequest = spec.buildRequests(localBidRequests, bidderRequest);
105
+ const ortbData = bidRequest.data;
106
+ expect(ortbData.device).to.be.an('object');
107
+ expect(ortbData.device.ip).to.be.undefined;
108
+ expect(ortbData.device.ext).to.be.an('object');
109
+ expect(ortbData.device.ext.is_accurate_ip).to.equal(0);
110
+ });
111
+ });
112
+
113
+ describe('interpretResponse', function () {
114
+ let bidRequests, bidderRequest;
115
+ beforeEach(function () {
116
+ bidRequests = [{
117
+ 'bidId': '28ffdf2a952532',
118
+ 'bidder': 'freepass',
119
+ 'userId': {
120
+ 'freepassId': {
121
+ 'userIp': '172.21.0.1',
122
+ 'userId': '56c4c789-71ce-46f5-989e-9e543f3d5f96',
123
+ 'commonId': 'commonIdValue'
124
+ }
125
+ }
126
+ }];
127
+ bidderRequest = {};
128
+ });
129
+
130
+ const ad = '<iframe src=\'http://127.0.0.1:8081/banner.html?w=300&h=250&cr=0\' width=\'300\' height=\'250\' style=\'border:none;\'></iframe>';
131
+ const serverResponse = {
132
+ body: {
133
+ 'cur': 'JPY',
134
+ 'seatbid': [{
135
+ 'bid': [{
136
+ 'impid': '28ffdf2a952532',
137
+ 'price': 97,
138
+ 'adm': ad,
139
+ 'w': 300,
140
+ 'h': 250,
141
+ 'crid': 'creative0'
142
+ }]
143
+ }]
144
+ }
145
+ };
146
+ it('should interpret server response', function () {
147
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
148
+ const bids = spec.interpretResponse(serverResponse, bidRequest);
149
+ expect(bids).to.be.an('array');
150
+
151
+ const bid = bids[0];
152
+ expect(bid).to.be.an('object');
153
+ expect(bid.currency).to.equal('JPY');
154
+ expect(bid.cpm).to.equal(97);
155
+ expect(bid.ad).to.equal(ad)
156
+ expect(bid.width).to.equal(300);
157
+ expect(bid.height).to.equal(250);
158
+ expect(bid.creativeId).to.equal('creative0');
159
+ });
160
+ });
161
+ });
@@ -389,7 +389,6 @@ describe('Greenbids Prebid AnalyticsAdapter Testing', function () {
389
389
  it('should parse config correctly with optional values', function () {
390
390
  expect(greenbidsAnalyticsAdapter.getAnalyticsOptions().options).to.deep.equal(configOptions);
391
391
  expect(greenbidsAnalyticsAdapter.getAnalyticsOptions().pbuid).to.equal(configOptions.pbuid);
392
- expect(greenbidsAnalyticsAdapter.getAnalyticsOptions().sampled).to.equal(false);
393
392
  });
394
393
 
395
394
  it('should not enable Analytics when pbuid is missing', function () {
@@ -400,19 +399,5 @@ describe('Greenbids Prebid AnalyticsAdapter Testing', function () {
400
399
  const validConfig = greenbidsAnalyticsAdapter.initConfig(configOptions);
401
400
  expect(validConfig).to.equal(false);
402
401
  });
403
- it('should fall back to default value when sampling factor is not number', function () {
404
- const configOptions = {
405
- options: {
406
- pbuid: pbuid,
407
- sampling: 'string',
408
- }
409
- };
410
- greenbidsAnalyticsAdapter.enableAnalytics({
411
- provider: 'greenbidsAnalytics',
412
- options: configOptions
413
- });
414
-
415
- expect(greenbidsAnalyticsAdapter.getAnalyticsOptions().sampled).to.equal(false);
416
- });
417
402
  });
418
403
  });