prebid.js 8.1.0 → 8.3.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/.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/adtelligentBidAdapter.js +1 -1
  11. package/dist/adtrgtmeBidAdapter.js +1 -1
  12. package/dist/adxcgBidAdapter.js +1 -1
  13. package/dist/adyoulikeBidAdapter.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/bridBidAdapter.js +1 -0
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/carodaBidAdapter.js +1 -1
  28. package/dist/categoryTranslation.js +1 -1
  29. package/dist/chtnwBidAdapter.js +1 -1
  30. package/dist/cmp.js +1 -0
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectadBidAdapter.js +1 -1
  33. package/dist/consentManagement.js +1 -1
  34. package/dist/consentManagementGpp.js +1 -1
  35. package/dist/consentManagementUsp.js +1 -1
  36. package/dist/consumableBidAdapter.js +1 -1
  37. package/dist/conversantAnalyticsAdapter.js +1 -1
  38. package/dist/conversantBidAdapter.js +1 -1
  39. package/dist/craftBidAdapter.js +1 -1
  40. package/dist/criteoBidAdapter.js +1 -1
  41. package/dist/cwireBidAdapter.js +1 -1
  42. package/dist/dependencies.json +15 -0
  43. package/dist/discoveryBidAdapter.js +1 -1
  44. package/dist/dspxBidAdapter.js +1 -1
  45. package/dist/eplanningBidAdapter.js +1 -1
  46. package/dist/euidIdSystem.js +1 -1
  47. package/dist/feedadBidAdapter.js +1 -1
  48. package/dist/finativeBidAdapter.js +1 -1
  49. package/dist/freewheel-sspBidAdapter.js +1 -1
  50. package/dist/gmosspBidAdapter.js +1 -1
  51. package/dist/goldbachBidAdapter.js +1 -1
  52. package/dist/gppControl_usnat.js +1 -0
  53. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  54. package/dist/greenbidsRtdProvider.js +1 -1
  55. package/dist/gridBidAdapter.js +1 -1
  56. package/dist/gumgumBidAdapter.js +1 -1
  57. package/dist/h12mediaBidAdapter.js +1 -1
  58. package/dist/holidBidAdapter.js +1 -1
  59. package/dist/hypelabBidAdapter.js +1 -1
  60. package/dist/id5IdSystem.js +1 -1
  61. package/dist/imdsBidAdapter.js +1 -1
  62. package/dist/improvedigitalBidAdapter.js +1 -1
  63. package/dist/insticatorBidAdapter.js +1 -1
  64. package/dist/intentIqIdSystem.js +1 -1
  65. package/dist/ixBidAdapter.js +1 -1
  66. package/dist/justpremiumBidAdapter.js +1 -1
  67. package/dist/kargoBidAdapter.js +1 -1
  68. package/dist/konduitAnalyticsAdapter.js +1 -1
  69. package/dist/kueezBidAdapter.js +1 -1
  70. package/dist/kueezRtbBidAdapter.js +1 -1
  71. package/dist/kulturemediaBidAdapter.js +1 -1
  72. package/dist/lassoBidAdapter.js +1 -1
  73. package/dist/lifestreetBidAdapter.js +1 -1
  74. package/dist/liveIntentIdSystem.js +1 -1
  75. package/dist/livewrappedAnalyticsAdapter.js +1 -1
  76. package/dist/logicadBidAdapter.js +1 -1
  77. package/dist/loglyliftBidAdapter.js +1 -1
  78. package/dist/magniteAnalyticsAdapter.js +1 -1
  79. package/dist/malltvAnalyticsAdapter.js +1 -1
  80. package/dist/marsmediaBidAdapter.js +1 -1
  81. package/dist/mediafuseBidAdapter.js +1 -1
  82. package/dist/mediagoBidAdapter.js +1 -1
  83. package/dist/mediasquareBidAdapter.js +1 -1
  84. package/dist/mgidBidAdapter.js +1 -1
  85. package/dist/minutemediaBidAdapter.js +1 -1
  86. package/dist/minutemediaplusBidAdapter.js +1 -1
  87. package/dist/mspa.js +1 -0
  88. package/dist/nexx360BidAdapter.js +1 -1
  89. package/dist/not-for-prod/prebid.js +144 -140
  90. package/dist/oguryBidAdapter.js +1 -1
  91. package/dist/onetagBidAdapter.js +1 -1
  92. package/dist/ooloAnalyticsAdapter.js +1 -1
  93. package/dist/optidigitalBidAdapter.js +1 -1
  94. package/dist/outbrainBidAdapter.js +1 -1
  95. package/dist/oxxionRtdProvider.js +1 -1
  96. package/dist/parrableIdSystem.js +1 -1
  97. package/dist/pixfutureBidAdapter.js +1 -1
  98. package/dist/prebid-core.js +1 -1
  99. package/dist/publinkIdSystem.js +1 -1
  100. package/dist/pubmaticBidAdapter.js +1 -1
  101. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  102. package/dist/pxyzBidAdapter.js +1 -1
  103. package/dist/quantcastBidAdapter.js +1 -1
  104. package/dist/readpeakBidAdapter.js +1 -1
  105. package/dist/relaidoBidAdapter.js +1 -1
  106. package/dist/retailspotBidAdapter.js +1 -1
  107. package/dist/rhythmoneBidAdapter.js +1 -1
  108. package/dist/riseBidAdapter.js +1 -1
  109. package/dist/rubiconBidAdapter.js +1 -1
  110. package/dist/seedingAllianceBidAdapter.js +1 -1
  111. package/dist/seedtagBidAdapter.js +1 -1
  112. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  113. package/dist/sharethroughBidAdapter.js +1 -1
  114. package/dist/shinezBidAdapter.js +1 -1
  115. package/dist/smaatoBidAdapter.js +1 -1
  116. package/dist/smartadserverBidAdapter.js +1 -1
  117. package/dist/smartxBidAdapter.js +1 -1
  118. package/dist/smartyadsBidAdapter.js +1 -1
  119. package/dist/smilewantedBidAdapter.js +1 -1
  120. package/dist/sonobiBidAdapter.js +1 -1
  121. package/dist/sovrnAnalyticsAdapter.js +1 -1
  122. package/dist/sovrnBidAdapter.js +1 -1
  123. package/dist/sspBCBidAdapter.js +1 -1
  124. package/dist/stvBidAdapter.js +1 -1
  125. package/dist/sublimeBidAdapter.js +1 -1
  126. package/dist/targetVideoBidAdapter.js +1 -1
  127. package/dist/teadsBidAdapter.js +1 -1
  128. package/dist/trafficgateBidAdapter.js +1 -1
  129. package/dist/trionBidAdapter.js +1 -1
  130. package/dist/tripleliftBidAdapter.js +1 -1
  131. package/dist/ttdBidAdapter.js +1 -1
  132. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  133. package/dist/uid2IdSystem.js +1 -1
  134. package/dist/underdogmediaBidAdapter.js +1 -1
  135. package/dist/undertoneBidAdapter.js +1 -1
  136. package/dist/userId.js +1 -1
  137. package/dist/vidazooBidAdapter.js +1 -1
  138. package/dist/videobyteBidAdapter.js +1 -1
  139. package/dist/visxBidAdapter.js +1 -1
  140. package/dist/vuukleBidAdapter.js +1 -1
  141. package/dist/widespaceBidAdapter.js +1 -1
  142. package/dist/winrBidAdapter.js +1 -1
  143. package/dist/yahoosspBidAdapter.js +1 -1
  144. package/dist/yieldmoBidAdapter.js +1 -1
  145. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  146. package/libraries/cmp/cmpClient.js +139 -0
  147. package/libraries/mspa/activityControls.js +91 -0
  148. package/modules/adagioBidAdapter.js +2 -1
  149. package/modules/admanBidAdapter.js +5 -0
  150. package/modules/adtelligentBidAdapter.js +8 -0
  151. package/modules/beopBidAdapter.js +6 -6
  152. package/modules/beopBidAdapter.md +35 -1
  153. package/modules/bridBidAdapter.js +223 -0
  154. package/modules/cadentApertureMXBidAdapter.md +2 -2
  155. package/modules/categoryTranslation.js +3 -2
  156. package/modules/consentManagement.js +12 -86
  157. package/modules/consentManagementGpp.js +47 -126
  158. package/modules/consentManagementUsp.js +19 -97
  159. package/modules/discoveryBidAdapter.js +1 -1
  160. package/modules/gppControl_usnat.js +11 -0
  161. package/modules/holidBidAdapter.js +49 -30
  162. package/modules/intentIqIdSystem.js +6 -5
  163. package/modules/ixBidAdapter.js +2 -1
  164. package/modules/liveIntentIdSystem.js +8 -3
  165. package/modules/livewrappedAnalyticsAdapter.js +33 -33
  166. package/modules/mediagoBidAdapter.js +1 -0
  167. package/modules/mediasquareBidAdapter.js +19 -23
  168. package/modules/oxxionRtdProvider.js +124 -11
  169. package/modules/oxxionRtdProvider.md +19 -4
  170. package/modules/smartyadsBidAdapter.js +6 -3
  171. package/modules/sovrnBidAdapter.js +5 -0
  172. package/modules/trafficgateBidAdapter.js +126 -72
  173. package/modules/tripleliftBidAdapter.js +21 -1
  174. package/modules/userId/eids.js +29 -0
  175. package/modules/userId/eids.md +19 -2
  176. package/modules/userId/index.js +78 -29
  177. package/modules/userId/userId.md +3 -0
  178. package/modules/vidazooBidAdapter.js +68 -16
  179. package/package.json +1 -1
  180. package/src/activities/params.js +4 -1
  181. package/test/spec/libraries/cmp/cmpClient_spec.js +233 -0
  182. package/test/spec/libraries/mspa/activityControls_spec.js +315 -0
  183. package/test/spec/modules/adagioBidAdapter_spec.js +2 -1
  184. package/test/spec/modules/admanBidAdapter_spec.js +8 -2
  185. package/test/spec/modules/adqueryBidAdapter_spec.js +5 -1
  186. package/test/spec/modules/adtelligentBidAdapter_spec.js +8 -0
  187. package/test/spec/modules/beopBidAdapter_spec.js +18 -2
  188. package/test/spec/modules/bridBidAdapter_spec.js +129 -0
  189. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +9 -7
  190. package/test/spec/modules/cadentApertureMXBidAdapter_spec.js +1 -1
  191. package/test/spec/modules/chtnwBidAdapter_spec.js +4 -1
  192. package/test/spec/modules/consentManagementGpp_spec.js +84 -7
  193. package/test/spec/modules/consentManagement_spec.js +8 -18
  194. package/test/spec/modules/datablocksBidAdapter_spec.js +7 -3
  195. package/test/spec/modules/eids_spec.js +87 -0
  196. package/test/spec/modules/holidBidAdapter_spec.js +26 -6
  197. package/test/spec/modules/insticatorBidAdapter_spec.js +6 -2
  198. package/test/spec/modules/intentIqIdSystem_spec.js +36 -2
  199. package/test/spec/modules/ixBidAdapter_spec.js +52 -18
  200. package/test/spec/modules/lassoBidAdapter_spec.js +6 -4
  201. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +17 -2
  202. package/test/spec/modules/liveIntentIdSystem_spec.js +11 -6
  203. package/test/spec/modules/mediasquareBidAdapter_spec.js +3 -0
  204. package/test/spec/modules/onetagBidAdapter_spec.js +81 -75
  205. package/test/spec/modules/orbidderBidAdapter_spec.js +6 -3
  206. package/test/spec/modules/oxxionRtdProvider_spec.js +113 -1
  207. package/test/spec/modules/relaidoBidAdapter_spec.js +4 -3
  208. package/test/spec/modules/smartyadsBidAdapter_spec.js +1 -1
  209. package/test/spec/modules/sovrnBidAdapter_spec.js +34 -0
  210. package/test/spec/modules/trafficgateBidAdapter_spec.js +1349 -199
  211. package/test/spec/modules/tripleliftBidAdapter_spec.js +20 -1
  212. package/test/spec/modules/ucfunnelBidAdapter_spec.js +37 -16
  213. package/test/spec/modules/userId_spec.js +393 -6
  214. package/test/spec/modules/vidazooBidAdapter_spec.js +131 -0
@@ -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'}
@@ -2,11 +2,14 @@ import { expect } from 'chai'
2
2
  import { spec } from 'modules/holidBidAdapter.js'
3
3
 
4
4
  describe('holidBidAdapterTests', () => {
5
+ const bidderRequest = {
6
+ bidderRequestId: 'test-id'
7
+ }
8
+
5
9
  const bidRequestData = {
6
10
  bidder: 'holid',
7
11
  adUnitCode: 'test-div',
8
12
  bidId: 'bid-id',
9
- auctionId: 'test-id',
10
13
  params: { adUnitID: '12345' },
11
14
  mediaTypes: { banner: {} },
12
15
  sizes: [[300, 250]],
@@ -48,18 +51,26 @@ describe('holidBidAdapterTests', () => {
48
51
 
49
52
  describe('buildRequests', () => {
50
53
  const bid = JSON.parse(JSON.stringify(bidRequestData))
51
- const request = spec.buildRequests([bid], bid)
54
+ const request = spec.buildRequests([bid], bidderRequest)
52
55
  const payload = JSON.parse(request[0].data)
53
56
 
57
+ it('should include id in request', () => {
58
+ expect(payload.id).to.equal('test-id')
59
+ })
60
+
54
61
  it('should include ext in imp', () => {
55
- expect(payload.imp[0].ext).to.exist
56
62
  expect(payload.imp[0].ext).to.deep.equal({
57
63
  prebid: { storedrequest: { id: '12345' } },
58
64
  })
59
65
  })
60
66
 
67
+ it('should include ext in request', () => {
68
+ expect(payload.ext).to.deep.equal({
69
+ prebid: { storedrequest: { id: '12345' } },
70
+ })
71
+ })
72
+
61
73
  it('should include banner format in imp', () => {
62
- expect(payload.imp[0].banner).to.exist
63
74
  expect(payload.imp[0].banner).to.deep.equal({
64
75
  format: [{ w: 300, h: 250 }],
65
76
  })
@@ -146,6 +157,10 @@ describe('holidBidAdapterTests', () => {
146
157
  }
147
158
  const uspConsent = 'mkjvbiniwot4827obfoy8sdg8203gb'
148
159
  const expectedUserSyncs = [
160
+ {
161
+ type: 'image',
162
+ url: 'https://track.adform.net/Serving/TrackPoint/?pm=2992097&lid=132720821',
163
+ },
149
164
  {
150
165
  type: 'iframe',
151
166
  url: 'https://null.holid.io/sync.html?bidders=%5B%22test%20seat%201%22%2C%22test%20seat%202%22%5D&gdpr=1&gdpr_consent=dkj49Sjmfjuj34as:12jaf90123hufabidfy9u23brfpoig&usp_consent=mkjvbiniwot4827obfoy8sdg8203gb&type=iframe',
@@ -162,7 +177,7 @@ describe('holidBidAdapterTests', () => {
162
177
  expect(userSyncs).to.deep.equal(expectedUserSyncs)
163
178
  })
164
179
 
165
- it('should return empty user syncs when responsetimemillis is not defined', () => {
180
+ it('should return base user syncs when responsetimemillis is not defined', () => {
166
181
  const optionsType = {
167
182
  iframeEnabled: true,
168
183
  pixelEnabled: true,
@@ -179,7 +194,12 @@ describe('holidBidAdapterTests', () => {
179
194
  consentString: 'dkj49Sjmfjuj34as:12jaf90123hufabidfy9u23brfpoig',
180
195
  }
181
196
  const uspConsent = 'mkjvbiniwot4827obfoy8sdg8203gb'
182
- const expectedUserSyncs = []
197
+ const expectedUserSyncs = [
198
+ {
199
+ type: 'image',
200
+ url: 'https://track.adform.net/Serving/TrackPoint/?pm=2992097&lid=132720821',
201
+ }
202
+ ]
183
203
 
184
204
  const userSyncs = spec.getUserSyncs(
185
205
  optionsType,
@@ -185,6 +185,7 @@ describe('InsticatorBidAdapter', function () {
185
185
  let getDataFromLocalStorageStub, localStorageIsEnabledStub;
186
186
  let getCookieStub, cookiesAreEnabledStub;
187
187
  let sandbox;
188
+ let serverRequests, serverRequest;
188
189
 
189
190
  beforeEach(() => {
190
191
  $$PREBID_GLOBAL$$.bidderSettings = {
@@ -210,12 +211,15 @@ describe('InsticatorBidAdapter', function () {
210
211
  $$PREBID_GLOBAL$$.bidderSettings = {};
211
212
  });
212
213
 
213
- const serverRequests = spec.buildRequests([bidRequest], bidderRequest);
214
+ before(() => {
215
+ serverRequests = spec.buildRequests([bidRequest], bidderRequest);
216
+ serverRequest = serverRequests[0];
217
+ })
218
+
214
219
  it('should create a request', function () {
215
220
  expect(serverRequests).to.have.length(1);
216
221
  });
217
222
 
218
- const serverRequest = serverRequests[0];
219
223
  it('should create a request object with method, URL, options and data', function () {
220
224
  expect(serverRequest).to.exist;
221
225
  expect(serverRequest.method).to.exist;
@@ -1,15 +1,17 @@
1
1
  import { expect } from 'chai';
2
- import { intentIqIdSubmodule, readData, FIRST_PARTY_KEY } from 'modules/intentIqIdSystem.js';
2
+ import { intentIqIdSubmodule, storage } from 'modules/intentIqIdSystem.js';
3
3
  import * as utils from 'src/utils.js';
4
4
  import { server } from 'test/mocks/xhr.js';
5
5
 
6
6
  const partner = 10;
7
7
  const pai = '11';
8
8
  const pcid = '12';
9
+ const enableCookieStorage = true;
9
10
  const defaultConfigParams = { params: { partner: partner } };
10
11
  const paiConfigParams = { params: { partner: partner, pai: pai } };
11
12
  const pcidConfigParams = { params: { partner: partner, pcid: pcid } };
12
- const allConfigParams = { params: { partner: partner, pai: pai, pcid: pcid } };
13
+ const enableCookieConfigParams = { params: { partner: partner, enableCookieStorage: enableCookieStorage } };
14
+ const allConfigParams = { params: { partner: partner, pai: pai, pcid: pcid, enableCookieStorage: enableCookieStorage } };
13
15
  const responseHeader = { 'Content-Type': 'application/json' }
14
16
 
15
17
  describe('IntentIQ tests', function () {
@@ -62,6 +64,38 @@ describe('IntentIQ tests', function () {
62
64
  expect(submodule).to.be.undefined;
63
65
  });
64
66
 
67
+ it('should not save data in cookie if enableCookieStorage configParam not set', function () {
68
+ let callBackSpy = sinon.spy();
69
+ let submoduleCallback = intentIqIdSubmodule.getId(defaultConfigParams).callback;
70
+ submoduleCallback(callBackSpy);
71
+ let request = server.requests[0];
72
+ expect(request.url).to.contain('https://api.intentiq.com/profiles_engine/ProfilesEngineServlet?at=39&mi=10&dpi=10&pt=17&dpn=1&iiqidtype=2&iiqpcid=');
73
+ request.respond(
74
+ 200,
75
+ responseHeader,
76
+ JSON.stringify({ pid: 'test_pid', data: 'test_personid', ls: true })
77
+ );
78
+ expect(callBackSpy.calledOnce).to.be.true;
79
+ expect(storage.getCookie('_iiq_fdata_' + partner)).to.equal(null);
80
+ });
81
+
82
+ it('should save data in cookie if enableCookieStorage configParam set to true', function () {
83
+ let callBackSpy = sinon.spy();
84
+ let submoduleCallback = intentIqIdSubmodule.getId(allConfigParams).callback;
85
+ submoduleCallback(callBackSpy);
86
+ let request = server.requests[0];
87
+ expect(request.url).to.contain('https://api.intentiq.com/profiles_engine/ProfilesEngineServlet?at=39&mi=10&dpi=10&pt=17&dpn=1&pcid=12&pai=11&iiqidtype=2&iiqpcid=');
88
+ request.respond(
89
+ 200,
90
+ responseHeader,
91
+ JSON.stringify({ pid: 'test_pid', data: 'test_personid', ls: true })
92
+ );
93
+ expect(callBackSpy.calledOnce).to.be.true;
94
+ const cookieValue = storage.getCookie('_iiq_fdata_' + partner)
95
+ expect(cookieValue).to.not.equal(null)
96
+ expect(JSON.parse(cookieValue).data).to.be.equal('test_personid');
97
+ });
98
+
65
99
  it('should call the IntentIQ endpoint with only partner', function () {
66
100
  let callBackSpy = sinon.spy();
67
101
  let submoduleCallback = intentIqIdSubmodule.getId(defaultConfigParams).callback;
@@ -759,7 +759,8 @@ describe('IndexexchangeAdapter', function () {
759
759
  uid2: { id: 'testuid2' }, // UID 2.0
760
760
  // similar to uid2, but id5's getValue takes .uid
761
761
  id5id: { uid: 'testid5id' }, // ID5
762
- imuid: 'testimuid'
762
+ imuid: 'testimuid',
763
+ '33acrossId': { envelope: 'v1.5fs.1000.fjdiosmclds' }
763
764
  };
764
765
 
765
766
  const DEFAULT_USERIDASEIDS_DATA = createEidsArray(DEFAULT_USERID_DATA);
@@ -813,7 +814,12 @@ describe('IndexexchangeAdapter', function () {
813
814
  }, {
814
815
  source: 'intimatemerger.com',
815
816
  uids: [{
816
- id: DEFAULT_USERID_DATA.imuid,
817
+ id: DEFAULT_USERID_DATA.imuid
818
+ }]
819
+ }, {
820
+ source: '33across.com',
821
+ uids: [{
822
+ id: DEFAULT_USERID_DATA['33acrossId'].envelope
817
823
  }]
818
824
  }
819
825
  ];
@@ -832,6 +838,18 @@ describe('IndexexchangeAdapter', function () {
832
838
  });
833
839
 
834
840
  describe('getUserSync tests', function () {
841
+ before(() => {
842
+ // TODO (dgirardi): the assertions in this block rely on
843
+ // global state (consent and siteId) set up in the SOT
844
+ // this is an outsider's attempt to recreate that state more explicitly after shuffling around setup code
845
+ // in this test suite
846
+
847
+ // please make your preconditions explicit;
848
+ // also, please, avoid global state if possible.
849
+
850
+ spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION);
851
+ })
852
+
835
853
  it('UserSync test : check type = iframe, check usermatch URL', function () {
836
854
  const syncOptions = {
837
855
  'iframeEnabled': true
@@ -1207,7 +1225,7 @@ describe('IndexexchangeAdapter', function () {
1207
1225
  const payload = extractPayload(request[0]);
1208
1226
  expect(request).to.be.an('array');
1209
1227
  expect(request).to.have.lengthOf.above(0); // should be 1 or more
1210
- expect(payload.user.eids).to.have.lengthOf(7);
1228
+ expect(payload.user.eids).to.have.lengthOf(8);
1211
1229
  expect(payload.user.eids).to.deep.include(DEFAULT_USERID_PAYLOAD[0]);
1212
1230
  });
1213
1231
  });
@@ -1395,7 +1413,7 @@ describe('IndexexchangeAdapter', function () {
1395
1413
  cloneValidBid[0].userIdAsEids = utils.deepClone(DEFAULT_USERIDASEIDS_DATA);
1396
1414
  const request = spec.buildRequests(cloneValidBid, DEFAULT_OPTION)[0];
1397
1415
  const payload = extractPayload(request);
1398
- expect(payload.user.eids).to.have.lengthOf(7);
1416
+ expect(payload.user.eids).to.have.lengthOf(8);
1399
1417
  expect(payload.user.eids).to.have.deep.members(DEFAULT_USERID_PAYLOAD);
1400
1418
  });
1401
1419
 
@@ -1528,7 +1546,7 @@ describe('IndexexchangeAdapter', function () {
1528
1546
  })
1529
1547
 
1530
1548
  expect(payload.user).to.exist;
1531
- expect(payload.user.eids).to.have.lengthOf(9);
1549
+ expect(payload.user.eids).to.have.lengthOf(10);
1532
1550
 
1533
1551
  expect(payload.user.eids).to.have.deep.members(validUserIdPayload);
1534
1552
  });
@@ -1570,7 +1588,7 @@ describe('IndexexchangeAdapter', function () {
1570
1588
  });
1571
1589
 
1572
1590
  const payload = extractPayload(request);
1573
- expect(payload.user.eids).to.have.lengthOf(8);
1591
+ expect(payload.user.eids).to.have.lengthOf(9);
1574
1592
  expect(payload.user.eids).to.have.deep.members(validUserIdPayload);
1575
1593
  });
1576
1594
  });
@@ -1771,16 +1789,19 @@ describe('IndexexchangeAdapter', function () {
1771
1789
  });
1772
1790
 
1773
1791
  describe('buildRequests', function () {
1774
- let request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
1775
- const requestUrl = request.url;
1776
- const requestMethod = request.method;
1777
- const payloadData = request.data;
1778
-
1779
1792
  const bidWithoutSchain = utils.deepClone(DEFAULT_BANNER_VALID_BID);
1780
1793
  delete bidWithoutSchain[0].schain;
1781
- const requestWithoutSchain = spec.buildRequests(bidWithoutSchain, DEFAULT_OPTION)[0];
1782
- const payloadWithoutSchain = extractPayload(requestWithoutSchain);
1783
1794
  const GPID = '/19968336/some-adunit-path';
1795
+ let request, requestUrl, requestMethod, payloadData, requestWithoutSchain, payloadWithoutSchain;
1796
+
1797
+ before(() => {
1798
+ request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
1799
+ requestUrl = request.url;
1800
+ requestMethod = request.method;
1801
+ payloadData = request.data;
1802
+ requestWithoutSchain = spec.buildRequests(bidWithoutSchain, DEFAULT_OPTION)[0];
1803
+ payloadWithoutSchain = extractPayload(requestWithoutSchain);
1804
+ });
1784
1805
 
1785
1806
  it('request should be made to IX endpoint with POST method and siteId in query param', function () {
1786
1807
  expect(requestMethod).to.equal('POST');
@@ -2302,7 +2323,11 @@ describe('IndexexchangeAdapter', function () {
2302
2323
  });
2303
2324
 
2304
2325
  describe('request should contain both banner and video requests', function () {
2305
- const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_VIDEO_VALID_BID[0]], {});
2326
+ let request;
2327
+ before(() => {
2328
+ request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_VIDEO_VALID_BID[0]], {});
2329
+ });
2330
+
2306
2331
  it('should have banner request', () => {
2307
2332
  const bannerImpression = extractPayload(request[0]).imp[0];
2308
2333
  const sidValue = DEFAULT_BANNER_VALID_BID[0].params.id;
@@ -2333,7 +2358,10 @@ describe('IndexexchangeAdapter', function () {
2333
2358
  });
2334
2359
 
2335
2360
  describe('request should contain both banner and native requests', function () {
2336
- const request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_NATIVE_VALID_BID[0]]);
2361
+ let request;
2362
+ before(() => {
2363
+ request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_NATIVE_VALID_BID[0]]);
2364
+ })
2337
2365
 
2338
2366
  it('should have banner request', () => {
2339
2367
  const bannerImpression = extractPayload(request[0]).imp[0];
@@ -2541,8 +2569,11 @@ describe('IndexexchangeAdapter', function () {
2541
2569
  });
2542
2570
 
2543
2571
  describe('buildRequestVideo', function () {
2544
- const request = spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION);
2545
- const payloadData = request[0].data;
2572
+ let request, payloadData;
2573
+ before(() => {
2574
+ request = spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION);
2575
+ payloadData = request[0].data;
2576
+ })
2546
2577
 
2547
2578
  it('auction type should be set correctly', function () {
2548
2579
  const at = payloadData.at;
@@ -2922,7 +2953,10 @@ describe('IndexexchangeAdapter', function () {
2922
2953
 
2923
2954
  describe('both banner and video bidder params set', function () {
2924
2955
  const bids = [DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0], DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]];
2925
- const request = spec.buildRequests(bids, {});
2956
+ let request;
2957
+ before(() => {
2958
+ request = spec.buildRequests(bids, {});
2959
+ })
2926
2960
 
2927
2961
  it('should return valid banner requests', function () {
2928
2962
  const impressions = extractPayload(request[0]).imp;
@@ -79,10 +79,12 @@ describe('lassoBidAdapter', function () {
79
79
  });
80
80
 
81
81
  describe('buildRequests', function () {
82
- const validBidRequests = spec.buildRequests([bid], bidderRequest);
83
- expect(validBidRequests).to.be.an('array').that.is.not.empty;
84
-
85
- const bidRequest = validBidRequests[0];
82
+ let validBidRequests, bidRequest;
83
+ before(() => {
84
+ validBidRequests = spec.buildRequests([bid], bidderRequest);
85
+ expect(validBidRequests).to.be.an('array').that.is.not.empty;
86
+ bidRequest = validBidRequests[0];
87
+ })
86
88
 
87
89
  it('Returns valid bidRequest', function () {
88
90
  expect(bidRequest).to.exist;