prebid.js 8.1.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 (183) 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/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/bridBidAdapter.js +1 -0
  23. package/dist/bridgewellBidAdapter.js +1 -1
  24. package/dist/brightMountainMediaBidAdapter.js +1 -1
  25. package/dist/carodaBidAdapter.js +1 -1
  26. package/dist/categoryTranslation.js +1 -1
  27. package/dist/chtnwBidAdapter.js +1 -1
  28. package/dist/cmp.js +1 -0
  29. package/dist/concertBidAdapter.js +1 -1
  30. package/dist/connectadBidAdapter.js +1 -1
  31. package/dist/consentManagement.js +1 -1
  32. package/dist/consentManagementGpp.js +1 -1
  33. package/dist/consentManagementUsp.js +1 -1
  34. package/dist/consumableBidAdapter.js +1 -1
  35. package/dist/conversantAnalyticsAdapter.js +1 -1
  36. package/dist/conversantBidAdapter.js +1 -1
  37. package/dist/craftBidAdapter.js +1 -1
  38. package/dist/criteoBidAdapter.js +1 -1
  39. package/dist/cwireBidAdapter.js +1 -1
  40. package/dist/dependencies.json +12 -0
  41. package/dist/dspxBidAdapter.js +1 -1
  42. package/dist/eplanningBidAdapter.js +1 -1
  43. package/dist/euidIdSystem.js +1 -1
  44. package/dist/feedadBidAdapter.js +1 -1
  45. package/dist/finativeBidAdapter.js +1 -1
  46. package/dist/freewheel-sspBidAdapter.js +1 -1
  47. package/dist/gmosspBidAdapter.js +1 -1
  48. package/dist/goldbachBidAdapter.js +1 -1
  49. package/dist/gppControl_usnat.js +1 -0
  50. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  51. package/dist/greenbidsRtdProvider.js +1 -1
  52. package/dist/gridBidAdapter.js +1 -1
  53. package/dist/gumgumBidAdapter.js +1 -1
  54. package/dist/h12mediaBidAdapter.js +1 -1
  55. package/dist/hypelabBidAdapter.js +1 -1
  56. package/dist/id5IdSystem.js +1 -1
  57. package/dist/imdsBidAdapter.js +1 -1
  58. package/dist/improvedigitalBidAdapter.js +1 -1
  59. package/dist/insticatorBidAdapter.js +1 -1
  60. package/dist/intentIqIdSystem.js +1 -1
  61. package/dist/ixBidAdapter.js +1 -1
  62. package/dist/justpremiumBidAdapter.js +1 -1
  63. package/dist/kargoBidAdapter.js +1 -1
  64. package/dist/konduitAnalyticsAdapter.js +1 -1
  65. package/dist/kueezBidAdapter.js +1 -1
  66. package/dist/kueezRtbBidAdapter.js +1 -1
  67. package/dist/kulturemediaBidAdapter.js +1 -1
  68. package/dist/lassoBidAdapter.js +1 -1
  69. package/dist/lifestreetBidAdapter.js +1 -1
  70. package/dist/liveIntentIdSystem.js +1 -1
  71. package/dist/logicadBidAdapter.js +1 -1
  72. package/dist/loglyliftBidAdapter.js +1 -1
  73. package/dist/magniteAnalyticsAdapter.js +1 -1
  74. package/dist/malltvAnalyticsAdapter.js +1 -1
  75. package/dist/marsmediaBidAdapter.js +1 -1
  76. package/dist/mediafuseBidAdapter.js +1 -1
  77. package/dist/mediasquareBidAdapter.js +1 -1
  78. package/dist/mgidBidAdapter.js +1 -1
  79. package/dist/minutemediaBidAdapter.js +1 -1
  80. package/dist/minutemediaplusBidAdapter.js +1 -1
  81. package/dist/mspa.js +1 -0
  82. package/dist/nexx360BidAdapter.js +1 -1
  83. package/dist/not-for-prod/prebid.js +136 -132
  84. package/dist/oguryBidAdapter.js +1 -1
  85. package/dist/onetagBidAdapter.js +1 -1
  86. package/dist/ooloAnalyticsAdapter.js +1 -1
  87. package/dist/optidigitalBidAdapter.js +1 -1
  88. package/dist/outbrainBidAdapter.js +1 -1
  89. package/dist/oxxionRtdProvider.js +1 -1
  90. package/dist/parrableIdSystem.js +1 -1
  91. package/dist/pixfutureBidAdapter.js +1 -1
  92. package/dist/prebid-core.js +1 -1
  93. package/dist/publinkIdSystem.js +1 -1
  94. package/dist/pubmaticBidAdapter.js +1 -1
  95. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  96. package/dist/pxyzBidAdapter.js +1 -1
  97. package/dist/quantcastBidAdapter.js +1 -1
  98. package/dist/readpeakBidAdapter.js +1 -1
  99. package/dist/relaidoBidAdapter.js +1 -1
  100. package/dist/retailspotBidAdapter.js +1 -1
  101. package/dist/rhythmoneBidAdapter.js +1 -1
  102. package/dist/riseBidAdapter.js +1 -1
  103. package/dist/rubiconBidAdapter.js +1 -1
  104. package/dist/seedingAllianceBidAdapter.js +1 -1
  105. package/dist/seedtagBidAdapter.js +1 -1
  106. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  107. package/dist/sharethroughBidAdapter.js +1 -1
  108. package/dist/shinezBidAdapter.js +1 -1
  109. package/dist/smaatoBidAdapter.js +1 -1
  110. package/dist/smartadserverBidAdapter.js +1 -1
  111. package/dist/smartxBidAdapter.js +1 -1
  112. package/dist/smilewantedBidAdapter.js +1 -1
  113. package/dist/sonobiBidAdapter.js +1 -1
  114. package/dist/sovrnAnalyticsAdapter.js +1 -1
  115. package/dist/sovrnBidAdapter.js +1 -1
  116. package/dist/sspBCBidAdapter.js +1 -1
  117. package/dist/stvBidAdapter.js +1 -1
  118. package/dist/sublimeBidAdapter.js +1 -1
  119. package/dist/targetVideoBidAdapter.js +1 -1
  120. package/dist/teadsBidAdapter.js +1 -1
  121. package/dist/trionBidAdapter.js +1 -1
  122. package/dist/tripleliftBidAdapter.js +1 -1
  123. package/dist/ttdBidAdapter.js +1 -1
  124. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  125. package/dist/uid2IdSystem.js +1 -1
  126. package/dist/underdogmediaBidAdapter.js +1 -1
  127. package/dist/undertoneBidAdapter.js +1 -1
  128. package/dist/userId.js +1 -1
  129. package/dist/vidazooBidAdapter.js +1 -1
  130. package/dist/videobyteBidAdapter.js +1 -1
  131. package/dist/visxBidAdapter.js +1 -1
  132. package/dist/vuukleBidAdapter.js +1 -1
  133. package/dist/widespaceBidAdapter.js +1 -1
  134. package/dist/winrBidAdapter.js +1 -1
  135. package/dist/yahoosspBidAdapter.js +1 -1
  136. package/dist/yieldmoBidAdapter.js +1 -1
  137. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  138. package/libraries/cmp/cmpClient.js +139 -0
  139. package/libraries/mspa/activityControls.js +91 -0
  140. package/modules/admanBidAdapter.js +5 -0
  141. package/modules/bridBidAdapter.js +223 -0
  142. package/modules/categoryTranslation.js +3 -2
  143. package/modules/consentManagement.js +12 -86
  144. package/modules/consentManagementGpp.js +47 -126
  145. package/modules/consentManagementUsp.js +19 -97
  146. package/modules/gppControl_usnat.js +11 -0
  147. package/modules/intentIqIdSystem.js +6 -5
  148. package/modules/liveIntentIdSystem.js +8 -3
  149. package/modules/mediasquareBidAdapter.js +19 -23
  150. package/modules/oxxionRtdProvider.js +124 -11
  151. package/modules/oxxionRtdProvider.md +19 -4
  152. package/modules/tripleliftBidAdapter.js +21 -1
  153. package/modules/userId/eids.js +29 -0
  154. package/modules/userId/eids.md +19 -2
  155. package/modules/userId/index.js +78 -29
  156. package/modules/userId/userId.md +3 -0
  157. package/package.json +1 -1
  158. package/src/activities/params.js +4 -1
  159. package/test/spec/libraries/cmp/cmpClient_spec.js +233 -0
  160. package/test/spec/libraries/mspa/activityControls_spec.js +315 -0
  161. package/test/spec/modules/admanBidAdapter_spec.js +8 -2
  162. package/test/spec/modules/adqueryBidAdapter_spec.js +5 -1
  163. package/test/spec/modules/bridBidAdapter_spec.js +129 -0
  164. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +9 -7
  165. package/test/spec/modules/chtnwBidAdapter_spec.js +4 -1
  166. package/test/spec/modules/consentManagementGpp_spec.js +84 -7
  167. package/test/spec/modules/consentManagement_spec.js +8 -18
  168. package/test/spec/modules/datablocksBidAdapter_spec.js +7 -3
  169. package/test/spec/modules/eids_spec.js +87 -0
  170. package/test/spec/modules/insticatorBidAdapter_spec.js +6 -2
  171. package/test/spec/modules/intentIqIdSystem_spec.js +36 -2
  172. package/test/spec/modules/ixBidAdapter_spec.js +40 -12
  173. package/test/spec/modules/lassoBidAdapter_spec.js +6 -4
  174. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +17 -2
  175. package/test/spec/modules/liveIntentIdSystem_spec.js +11 -6
  176. package/test/spec/modules/mediasquareBidAdapter_spec.js +3 -0
  177. package/test/spec/modules/onetagBidAdapter_spec.js +81 -75
  178. package/test/spec/modules/orbidderBidAdapter_spec.js +6 -3
  179. package/test/spec/modules/oxxionRtdProvider_spec.js +113 -1
  180. package/test/spec/modules/relaidoBidAdapter_spec.js +4 -3
  181. package/test/spec/modules/tripleliftBidAdapter_spec.js +20 -1
  182. package/test/spec/modules/ucfunnelBidAdapter_spec.js +37 -16
  183. package/test/spec/modules/userId_spec.js +393 -6
@@ -0,0 +1,129 @@
1
+ import { spec } from '../../../modules/bridBidAdapter.js'
2
+
3
+ describe('Brid Bid Adapter', function() {
4
+ const videoRequest = [{
5
+ bidder: 'brid',
6
+ params: {
7
+ placementId: 12345,
8
+ },
9
+ mediaTypes: {
10
+ video: {
11
+ playerSize: [[640, 360]],
12
+ context: 'instream',
13
+ playbackmethod: [1, 2, 3, 4]
14
+ }
15
+ }
16
+ }];
17
+
18
+ it('Test the bid validation function', function() {
19
+ const validBid = spec.isBidRequestValid(videoRequest[0]);
20
+ const invalidBid = spec.isBidRequestValid(null);
21
+
22
+ expect(validBid).to.be.true;
23
+ expect(invalidBid).to.be.false;
24
+ });
25
+
26
+ it('Test the request processing function', function () {
27
+ const request = spec.buildRequests(videoRequest, videoRequest[0]);
28
+ expect(request).to.not.be.empty;
29
+
30
+ const payload = JSON.parse(request[0].data);
31
+ expect(payload).to.not.be.empty;
32
+ expect(payload.sdk).to.deep.equal({
33
+ source: 'pbjs',
34
+ version: '$prebid.version$'
35
+ });
36
+ expect(payload.imp[0].ext.prebid.storedrequest.id).to.equal(12345);
37
+ });
38
+
39
+ it('Test nobid responses', function () {
40
+ const responseBody = {
41
+ 'id': 'test-id',
42
+ 'cur': 'USD',
43
+ 'seatbid': [],
44
+ 'nbr': 0
45
+ };
46
+ const bidderRequest = null;
47
+
48
+ const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
49
+
50
+ expect(bidResponse.length).to.equal(0);
51
+ });
52
+
53
+ it('Test the response parsing function', function () {
54
+ const responseBody = {
55
+ 'id': 'test-id',
56
+ 'cur': 'USD',
57
+ 'seatbid': [{
58
+ 'bid': [{
59
+ 'id': '5044997188309660254',
60
+ 'price': 5,
61
+ 'adm': 'test ad',
62
+ 'adid': '97517771',
63
+ 'crid': '97517771',
64
+ 'adomain': ['domain.com'],
65
+ 'w': 640,
66
+ 'h': 480
67
+ }],
68
+ 'seat': 'bidder'
69
+ }]
70
+ };
71
+ const bidderRequest = {
72
+ bidderCode: 'brid',
73
+ bidderRequestId: '22edbae2733bf6',
74
+ bids: videoRequest
75
+ };
76
+
77
+ const bidResponse = spec.interpretResponse({ body: responseBody }, {bidderRequest});
78
+ expect(bidResponse).to.not.be.empty;
79
+
80
+ const bid = bidResponse[0];
81
+ expect(bid).to.not.be.empty;
82
+ expect(bid.ad).to.equal('test ad');
83
+ expect(bid.cpm).to.equal(5);
84
+ expect(bid.width).to.equal(640);
85
+ expect(bid.height).to.equal(480);
86
+ expect(bid.currency).to.equal('USD');
87
+ });
88
+
89
+ it('Test GDPR and USP consents are present in the request', function () {
90
+ let gdprConsentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
91
+ let uspConsentString = '1YA-';
92
+ let bidderRequest = {
93
+ 'bidderCode': 'brid',
94
+ 'bidderRequestId': '22edbae2733bf6',
95
+ 'timeout': 3000,
96
+ 'uspConsent': uspConsentString,
97
+ 'gdprConsent': {
98
+ consentString: gdprConsentString,
99
+ gdprApplies: true,
100
+ addtlConsent: '1~7.12.35.62.66.70.89.93.108'
101
+ }
102
+ };
103
+ bidderRequest.bids = videoRequest;
104
+
105
+ const request = spec.buildRequests(videoRequest, bidderRequest);
106
+ const payload = JSON.parse(request[0].data);
107
+
108
+ expect(payload.user.ext.consent).to.equal(gdprConsentString);
109
+ expect(payload.regs.ext.us_privacy).to.equal(uspConsentString);
110
+ expect(payload.regs.ext.gdpr).to.equal(1);
111
+ });
112
+
113
+ it('Test GDPR is not present', function () {
114
+ let uspConsentString = '1YA-';
115
+ let bidderRequest = {
116
+ 'bidderCode': 'brid',
117
+ 'bidderRequestId': '22edbae2733bf6',
118
+ 'timeout': 3000,
119
+ 'uspConsent': uspConsentString
120
+ };
121
+ bidderRequest.bids = videoRequest;
122
+
123
+ const request = spec.buildRequests(videoRequest, bidderRequest);
124
+ const payload = JSON.parse(request[0].data);
125
+
126
+ expect(payload.regs.ext.gdpr).to.be.undefined;
127
+ expect(payload.regs.ext.us_privacy).to.equal(uspConsentString);
128
+ });
129
+ });
@@ -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');
@@ -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'}
@@ -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;
@@ -832,6 +832,18 @@ describe('IndexexchangeAdapter', function () {
832
832
  });
833
833
 
834
834
  describe('getUserSync tests', function () {
835
+ before(() => {
836
+ // TODO (dgirardi): the assertions in this block rely on
837
+ // global state (consent and siteId) set up in the SOT
838
+ // this is an outsider's attempt to recreate that state more explicitly after shuffling around setup code
839
+ // in this test suite
840
+
841
+ // please make your preconditions explicit;
842
+ // also, please, avoid global state if possible.
843
+
844
+ spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION);
845
+ })
846
+
835
847
  it('UserSync test : check type = iframe, check usermatch URL', function () {
836
848
  const syncOptions = {
837
849
  'iframeEnabled': true
@@ -1771,16 +1783,19 @@ describe('IndexexchangeAdapter', function () {
1771
1783
  });
1772
1784
 
1773
1785
  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
1786
  const bidWithoutSchain = utils.deepClone(DEFAULT_BANNER_VALID_BID);
1780
1787
  delete bidWithoutSchain[0].schain;
1781
- const requestWithoutSchain = spec.buildRequests(bidWithoutSchain, DEFAULT_OPTION)[0];
1782
- const payloadWithoutSchain = extractPayload(requestWithoutSchain);
1783
1788
  const GPID = '/19968336/some-adunit-path';
1789
+ let request, requestUrl, requestMethod, payloadData, requestWithoutSchain, payloadWithoutSchain;
1790
+
1791
+ before(() => {
1792
+ request = spec.buildRequests(DEFAULT_BANNER_VALID_BID, DEFAULT_OPTION)[0];
1793
+ requestUrl = request.url;
1794
+ requestMethod = request.method;
1795
+ payloadData = request.data;
1796
+ requestWithoutSchain = spec.buildRequests(bidWithoutSchain, DEFAULT_OPTION)[0];
1797
+ payloadWithoutSchain = extractPayload(requestWithoutSchain);
1798
+ });
1784
1799
 
1785
1800
  it('request should be made to IX endpoint with POST method and siteId in query param', function () {
1786
1801
  expect(requestMethod).to.equal('POST');
@@ -2302,7 +2317,11 @@ describe('IndexexchangeAdapter', function () {
2302
2317
  });
2303
2318
 
2304
2319
  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]], {});
2320
+ let request;
2321
+ before(() => {
2322
+ request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_VIDEO_VALID_BID[0]], {});
2323
+ });
2324
+
2306
2325
  it('should have banner request', () => {
2307
2326
  const bannerImpression = extractPayload(request[0]).imp[0];
2308
2327
  const sidValue = DEFAULT_BANNER_VALID_BID[0].params.id;
@@ -2333,7 +2352,10 @@ describe('IndexexchangeAdapter', function () {
2333
2352
  });
2334
2353
 
2335
2354
  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]]);
2355
+ let request;
2356
+ before(() => {
2357
+ request = spec.buildRequests([DEFAULT_BANNER_VALID_BID[0], DEFAULT_NATIVE_VALID_BID[0]]);
2358
+ })
2337
2359
 
2338
2360
  it('should have banner request', () => {
2339
2361
  const bannerImpression = extractPayload(request[0]).imp[0];
@@ -2541,8 +2563,11 @@ describe('IndexexchangeAdapter', function () {
2541
2563
  });
2542
2564
 
2543
2565
  describe('buildRequestVideo', function () {
2544
- const request = spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION);
2545
- const payloadData = request[0].data;
2566
+ let request, payloadData;
2567
+ before(() => {
2568
+ request = spec.buildRequests(DEFAULT_VIDEO_VALID_BID, DEFAULT_OPTION);
2569
+ payloadData = request[0].data;
2570
+ })
2546
2571
 
2547
2572
  it('auction type should be set correctly', function () {
2548
2573
  const at = payloadData.at;
@@ -2922,7 +2947,10 @@ describe('IndexexchangeAdapter', function () {
2922
2947
 
2923
2948
  describe('both banner and video bidder params set', function () {
2924
2949
  const bids = [DEFAULT_MULTIFORMAT_BANNER_VALID_BID[0], DEFAULT_MULTIFORMAT_VIDEO_VALID_BID[0]];
2925
- const request = spec.buildRequests(bids, {});
2950
+ let request;
2951
+ before(() => {
2952
+ request = spec.buildRequests(bids, {});
2953
+ })
2926
2954
 
2927
2955
  it('should return valid banner requests', function () {
2928
2956
  const impressions = extractPayload(request[0]).imp;