prebid.js 6.2.0 → 6.6.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 (169) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/gulpfile.js +87 -82
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  4. package/karma.conf.maker.js +1 -1
  5. package/modules/.submodules.json +2 -1
  6. package/modules/33acrossBidAdapter.js +189 -102
  7. package/modules/adagioBidAdapter.js +1 -1
  8. package/modules/addefendBidAdapter.js +1 -0
  9. package/modules/adkernelBidAdapter.js +148 -62
  10. package/modules/adlooxAdServerVideo.js +2 -2
  11. package/modules/adlooxAnalyticsAdapter.js +4 -4
  12. package/modules/admanBidAdapter.js +11 -4
  13. package/modules/admixerBidAdapter.js +1 -1
  14. package/modules/adnuntiusBidAdapter.js +3 -1
  15. package/modules/adomikAnalyticsAdapter.js +27 -9
  16. package/modules/adqueryIdSystem.js +103 -0
  17. package/modules/adqueryIdSystem.md +35 -0
  18. package/modules/adxcgBidAdapter.js +311 -359
  19. package/modules/adxcgBidAdapter.md +22 -21
  20. package/modules/adyoulikeBidAdapter.js +13 -9
  21. package/modules/aniviewBidAdapter.js +1 -1
  22. package/modules/appnexusBidAdapter.js +0 -1
  23. package/modules/beopBidAdapter.js +6 -4
  24. package/modules/bidViewability.js +3 -3
  25. package/modules/bidViewabilityIO.js +3 -3
  26. package/modules/bliinkBidAdapter.js +3 -2
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/compassBidAdapter.js +208 -0
  29. package/modules/compassBidAdapter.md +79 -0
  30. package/modules/consentManagement.js +7 -1
  31. package/modules/criteoBidAdapter.js +1 -1
  32. package/modules/criteoIdSystem.js +29 -7
  33. package/modules/currency.js +2 -2
  34. package/modules/cwireBidAdapter.js +3 -0
  35. package/modules/dailyhuntBidAdapter.js +435 -0
  36. package/modules/dailyhuntBidAdapter.md +4 -0
  37. package/modules/docereeBidAdapter.js +10 -1
  38. package/modules/docereeBidAdapter.md +2 -0
  39. package/modules/dspxBidAdapter.js +1 -1
  40. package/modules/engageyaBidAdapter.js +1 -1
  41. package/modules/feedadBidAdapter.js +2 -2
  42. package/modules/feedadBidAdapter.md +4 -2
  43. package/modules/futureads.md +48 -0
  44. package/modules/glimpseBidAdapter.js +82 -47
  45. package/modules/gptPreAuction.js +55 -7
  46. package/modules/gridBidAdapter.js +4 -3
  47. package/modules/gumgumBidAdapter.js +2 -2
  48. package/modules/idImportLibrary.js +45 -8
  49. package/modules/idImportLibrary.md +4 -0
  50. package/modules/improvedigitalBidAdapter.js +42 -4
  51. package/modules/instreamTracking.js +4 -4
  52. package/modules/invibesBidAdapter.js +49 -5
  53. package/modules/invibesBidAdapter.md +2 -1
  54. package/modules/ixBidAdapter.js +53 -18
  55. package/modules/kinessoIdSystem.js +1 -1
  56. package/modules/limelightDigitalBidAdapter.js +2 -1
  57. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  58. package/modules/livewrappedBidAdapter.js +8 -2
  59. package/modules/loglyliftBidAdapter.js +79 -0
  60. package/modules/loglyliftBidAdapter.md +55 -0
  61. package/modules/lotamePanoramaIdSystem.js +80 -8
  62. package/modules/mediasquareBidAdapter.js +1 -9
  63. package/modules/nextMillenniumBidAdapter.js +39 -7
  64. package/modules/oguryBidAdapter.js +9 -2
  65. package/modules/onetagBidAdapter.js +4 -2
  66. package/modules/optimeraRtdProvider.js +8 -1
  67. package/modules/ozoneBidAdapter.js +21 -64
  68. package/modules/prebidServerBidAdapter/index.js +16 -12
  69. package/modules/proxistoreBidAdapter.js +0 -2
  70. package/modules/pubgeniusBidAdapter.js +1 -1
  71. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  72. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  73. package/modules/richaudienceBidAdapter.js +4 -4
  74. package/modules/riseBidAdapter.js +1 -1
  75. package/modules/rtbhouseBidAdapter.js +14 -4
  76. package/modules/rtdModule/index.js +49 -18
  77. package/modules/rubiconBidAdapter.js +31 -19
  78. package/modules/sharedIdSystem.js +27 -1
  79. package/modules/showheroes-bsBidAdapter.js +13 -2
  80. package/modules/tappxBidAdapter.js +8 -5
  81. package/modules/targetVideoBidAdapter.js +187 -0
  82. package/modules/targetVideoBidAdapter.md +34 -0
  83. package/modules/teadsBidAdapter.js +1 -2
  84. package/modules/telariaBidAdapter.js +2 -2
  85. package/modules/trustxBidAdapter.js +8 -16
  86. package/modules/userId/eids.js +7 -1
  87. package/modules/userId/userId.md +8 -0
  88. package/modules/vidoomyBidAdapter.js +16 -10
  89. package/modules/weboramaRtdProvider.js +288 -73
  90. package/modules/weboramaRtdProvider.md +27 -10
  91. package/modules/welectBidAdapter.js +106 -0
  92. package/modules/yahoosspBidAdapter.js +5 -1
  93. package/modules/yieldmoBidAdapter.js +23 -5
  94. package/modules/zetaSspBidAdapter.md +33 -1
  95. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  96. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  97. package/modules/zeta_global_sspBidAdapter.js +22 -1
  98. package/package.json +1 -1
  99. package/plugins/pbjsGlobals.js +28 -1
  100. package/src/auction.js +2 -2
  101. package/src/config.js +27 -3
  102. package/src/hook.js +5 -1
  103. package/src/prebid.js +21 -6
  104. package/src/targeting.js +22 -1
  105. package/src/utils.js +46 -8
  106. package/test/helpers/prebidGlobal.js +1 -0
  107. package/test/spec/config_spec.js +279 -0
  108. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  109. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  110. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  111. package/test/spec/modules/adnuntiusBidAdapter_spec.js +17 -0
  112. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  113. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  114. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  115. package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
  116. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  117. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  118. package/test/spec/modules/bidViewability_spec.js +4 -4
  119. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  120. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  121. package/test/spec/modules/compassBidAdapter_spec.js +398 -0
  122. package/test/spec/modules/consentManagement_spec.js +20 -0
  123. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  124. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  125. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  126. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  127. package/test/spec/modules/eids_spec.js +15 -0
  128. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  129. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  130. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  131. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  132. package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
  133. package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
  134. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  135. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
  136. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  137. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  138. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  139. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  140. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  141. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  142. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  143. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  144. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  145. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  146. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  147. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  148. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  149. package/test/spec/modules/realTimeDataModule_spec.js +147 -48
  150. package/test/spec/modules/richaudienceBidAdapter_spec.js +42 -2
  151. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  152. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  153. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  154. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  155. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  156. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  157. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  158. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  159. package/test/spec/modules/userId_spec.js +68 -19
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  162. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  163. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/targeting_spec.js +72 -0
  166. package/test/spec/unit/pbjs_api_spec.js +3 -1
  167. package/test/spec/utils_spec.js +38 -0
  168. package/test/test_deps.js +3 -0
  169. package/test/test_index.js +1 -3
@@ -95,6 +95,40 @@ describe('Adyoulike Adapter', function () {
95
95
  }
96
96
  ];
97
97
 
98
+ const bidRequestWithMultipleMediatype = [
99
+ {
100
+ 'bidId': 'bid_id_0',
101
+ 'bidder': 'adyoulike',
102
+ 'placementCode': 'adunit/hb-0',
103
+ 'params': {
104
+ 'placement': 'placement_0'
105
+ },
106
+ 'sizes': '300x250',
107
+ 'mediaTypes': {
108
+ 'banner': {
109
+ 'sizes': ['640x480']
110
+ },
111
+ 'video': {
112
+ 'playerSize': [640, 480],
113
+ 'context': 'outstream'
114
+ },
115
+ 'native': {
116
+ 'image': {
117
+ 'required': true,
118
+ },
119
+ 'title': {
120
+ 'required': true,
121
+ 'len': 80
122
+ },
123
+ 'cta': {
124
+ 'required': false
125
+ },
126
+ }
127
+ },
128
+ 'transactionId': 'bid_id_0_transaction_id'
129
+ }
130
+ ];
131
+
98
132
  const bidRequestWithNativeImageType = [
99
133
  {
100
134
  'bidId': 'bid_id_0',
@@ -647,6 +681,21 @@ describe('Adyoulike Adapter', function () {
647
681
  expect(payload.Bids['bid_id_0'].TransactionID).to.be.equal('bid_id_0_transaction_id');
648
682
  });
649
683
 
684
+ it('sends bid request to endpoint with single placement multiple mediatype', function () {
685
+ canonicalQuery.restore();
686
+ const request = spec.buildRequests(bidRequestWithMultipleMediatype, bidderRequest);
687
+ const payload = JSON.parse(request.data);
688
+
689
+ expect(request.url).to.contain(getEndpoint());
690
+ expect(request.method).to.equal('POST');
691
+
692
+ expect(request.url).to.not.contains('CanonicalUrl=' + encodeURIComponent(canonicalUrl));
693
+ expect(payload.Version).to.equal('1.0');
694
+ expect(payload.Bids['bid_id_0'].PlacementID).to.be.equal('placement_0');
695
+ expect(payload.PageRefreshed).to.equal(false);
696
+ expect(payload.Bids['bid_id_0'].TransactionID).to.be.equal('bid_id_0_transaction_id');
697
+ });
698
+
650
699
  it('sends bid request to endpoint with multiple placements', function () {
651
700
  const request = spec.buildRequests(bidRequestMultiPlacements, bidderRequest);
652
701
  const payload = JSON.parse(request.data);
@@ -124,7 +124,7 @@ describe('BeOp Bid Adapter tests', () => {
124
124
  expect(payload.tc_string).to.exist;
125
125
  expect(payload.tc_string).to.equal('BOJ8RZsOJ8RZsABAB8AAAAAZ+A==');
126
126
  expect(payload.url).to.exist;
127
- expect(payload.url).to.equal('http://test.te');
127
+ expect(payload.url).to.equal('http://localhost:9876/context.html');
128
128
  });
129
129
  });
130
130
 
@@ -3,7 +3,7 @@ import * as events from 'src/events.js';
3
3
  import * as utils from 'src/utils.js';
4
4
  import * as sinon from 'sinon';
5
5
  import { expect } from 'chai';
6
- import { EVENTS } from 'src/constants.json';
6
+ import CONSTANTS from 'src/constants.json';
7
7
 
8
8
  describe('#bidViewabilityIO', function() {
9
9
  const makeElement = (id) => {
@@ -97,7 +97,7 @@ describe('#bidViewabilityIO', function() {
97
97
  expect(mockObserver.unobserve.calledOnce).to.be.true;
98
98
  expect(emitSpy.calledOnce).to.be.true;
99
99
  // expect(emitSpy.firstCall.args).to.be.false;
100
- expect(emitSpy.firstCall.args[0]).to.eq(EVENTS.BID_VIEWABLE);
100
+ expect(emitSpy.firstCall.args[0]).to.eq(CONSTANTS.EVENTS.BID_VIEWABLE);
101
101
  });
102
102
  })
103
103
 
@@ -5,7 +5,7 @@ import * as utils from 'src/utils.js';
5
5
  import * as sinon from 'sinon';
6
6
  import {expect, spy} from 'chai';
7
7
  import * as prebidGlobal from 'src/prebidGlobal.js';
8
- import { EVENTS } from 'src/constants.json';
8
+ import CONSTANTS from 'src/constants.json';
9
9
  import adapterManager, { gdprDataHandler, uspDataHandler } from 'src/adapterManager.js';
10
10
  import parse from 'url-parse';
11
11
 
@@ -279,9 +279,9 @@ describe('#bidViewability', function() {
279
279
  let call = callBidViewableBidderSpy.getCall(0);
280
280
  expect(call.args[0]).to.equal(PBJS_WINNING_BID.bidder);
281
281
  expect(call.args[1]).to.deep.equal(PBJS_WINNING_BID);
282
- // EVENTS.BID_VIEWABLE is triggered
282
+ // CONSTANTS.EVENTS.BID_VIEWABLE is triggered
283
283
  call = eventsEmitSpy.getCall(0);
284
- expect(call.args[0]).to.equal(EVENTS.BID_VIEWABLE);
284
+ expect(call.args[0]).to.equal(CONSTANTS.EVENTS.BID_VIEWABLE);
285
285
  expect(call.args[1]).to.deep.equal(PBJS_WINNING_BID);
286
286
  });
287
287
 
@@ -290,7 +290,7 @@ describe('#bidViewability', function() {
290
290
  expect(triggerPixelSpy.callCount).to.equal(0);
291
291
  // adapterManager.callBidViewableBidder is NOT called
292
292
  expect(callBidViewableBidderSpy.callCount).to.equal(0);
293
- // EVENTS.BID_VIEWABLE is NOT triggered
293
+ // CONSTANTS.EVENTS.BID_VIEWABLE is NOT triggered
294
294
  expect(eventsEmitSpy.callCount).to.equal(0);
295
295
  });
296
296
  });
@@ -477,6 +477,8 @@ const testsBuildRequests = [
477
477
  refererInfo: getConfigBuildRequest('banner').refererInfo
478
478
  },
479
479
  data: {
480
+ gdpr: false,
481
+ gdpr_consent: '',
480
482
  height: 250,
481
483
  width: 300,
482
484
  keywords: '',
@@ -186,6 +186,15 @@ describe('ColossussspAdapter', function () {
186
186
  });
187
187
  });
188
188
 
189
+ describe('onBidWon', function () {
190
+ it('should make an ajax call', function () {
191
+ const bid = {
192
+ nurl: 'http://example.com/win',
193
+ };
194
+ expect(spec.onBidWon(bid)).to.equals(undefined);
195
+ });
196
+ })
197
+
189
198
  describe('getUserSyncs', function () {
190
199
  let userSync = spec.getUserSyncs();
191
200
  it('Returns valid URL and type', function () {
@@ -0,0 +1,398 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from '../../../modules/compassBidAdapter.js';
3
+ import { BANNER, VIDEO, NATIVE } from '../../../src/mediaTypes.js';
4
+ import { getUniqueIdentifierStr } from '../../../src/utils.js';
5
+
6
+ const bidder = 'compass'
7
+
8
+ describe('CompassBidAdapter', function () {
9
+ const bids = [
10
+ {
11
+ bidId: getUniqueIdentifierStr(),
12
+ bidder: bidder,
13
+ mediaTypes: {
14
+ [BANNER]: {
15
+ sizes: [[300, 250]]
16
+ }
17
+ },
18
+ params: {
19
+ placementId: 'testBanner',
20
+ }
21
+ },
22
+ {
23
+ bidId: getUniqueIdentifierStr(),
24
+ bidder: bidder,
25
+ mediaTypes: {
26
+ [VIDEO]: {
27
+ playerSize: [[300, 300]],
28
+ minduration: 5,
29
+ maxduration: 60
30
+ }
31
+ },
32
+ params: {
33
+ placementId: 'testVideo',
34
+ }
35
+ },
36
+ {
37
+ bidId: getUniqueIdentifierStr(),
38
+ bidder: bidder,
39
+ mediaTypes: {
40
+ [NATIVE]: {
41
+ native: {
42
+ title: {
43
+ required: true
44
+ },
45
+ body: {
46
+ required: true
47
+ },
48
+ icon: {
49
+ required: true,
50
+ size: [64, 64]
51
+ }
52
+ }
53
+ }
54
+ },
55
+ params: {
56
+ placementId: 'testNative',
57
+ }
58
+ }
59
+ ];
60
+
61
+ const invalidBid = {
62
+ bidId: getUniqueIdentifierStr(),
63
+ bidder: bidder,
64
+ mediaTypes: {
65
+ [BANNER]: {
66
+ sizes: [[300, 250]]
67
+ }
68
+ },
69
+ params: {
70
+
71
+ }
72
+ }
73
+
74
+ const bidderRequest = {
75
+ uspConsent: '1---',
76
+ gdprConsent: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
77
+ refererInfo: {
78
+ referer: 'https://test.com'
79
+ }
80
+ };
81
+
82
+ describe('isBidRequestValid', function () {
83
+ it('Should return true if there are bidId, params and key parameters present', function () {
84
+ expect(spec.isBidRequestValid(bids[0])).to.be.true;
85
+ });
86
+ it('Should return false if at least one of parameters is not present', function () {
87
+ expect(spec.isBidRequestValid(invalidBid)).to.be.false;
88
+ });
89
+ });
90
+
91
+ describe('buildRequests', function () {
92
+ let serverRequest = spec.buildRequests(bids, bidderRequest);
93
+
94
+ it('Creates a ServerRequest object with method, URL and data', function () {
95
+ expect(serverRequest).to.exist;
96
+ expect(serverRequest.method).to.exist;
97
+ expect(serverRequest.url).to.exist;
98
+ expect(serverRequest.data).to.exist;
99
+ });
100
+
101
+ it('Returns POST method', function () {
102
+ expect(serverRequest.method).to.equal('POST');
103
+ });
104
+
105
+ it('Returns valid URL', function () {
106
+ expect(serverRequest.url).to.equal('https://sa-lb.deliverimp.com/pbjs');
107
+ });
108
+
109
+ it('Returns general data valid', function () {
110
+ let data = serverRequest.data;
111
+ expect(data).to.be.an('object');
112
+ expect(data).to.have.all.keys('deviceWidth',
113
+ 'deviceHeight',
114
+ 'language',
115
+ 'secure',
116
+ 'host',
117
+ 'page',
118
+ 'placements',
119
+ 'coppa',
120
+ 'ccpa',
121
+ 'gdpr',
122
+ 'tmax'
123
+ );
124
+ expect(data.deviceWidth).to.be.a('number');
125
+ expect(data.deviceHeight).to.be.a('number');
126
+ expect(data.language).to.be.a('string');
127
+ expect(data.secure).to.be.within(0, 1);
128
+ expect(data.host).to.be.a('string');
129
+ expect(data.page).to.be.a('string');
130
+ expect(data.coppa).to.be.a('number');
131
+ expect(data.gdpr).to.be.a('string');
132
+ expect(data.ccpa).to.be.a('string');
133
+ expect(data.tmax).to.be.a('number');
134
+ expect(data.placements).to.have.lengthOf(3);
135
+ });
136
+
137
+ it('Returns valid placements', function () {
138
+ const { placements } = serverRequest.data;
139
+ for (let i = 0, len = placements.length; i < len; i++) {
140
+ const placement = placements[i];
141
+ expect(placement.placementId).to.be.oneOf(['testBanner', 'testVideo', 'testNative']);
142
+ expect(placement.adFormat).to.be.oneOf([BANNER, VIDEO, NATIVE]);
143
+ expect(placement.bidId).to.be.a('string');
144
+ expect(placement.schain).to.be.an('object');
145
+ expect(placement.bidfloor).to.exist.and.to.equal(0);
146
+ expect(placement.type).to.exist.and.to.equal('publisher');
147
+
148
+ if (placement.adFormat === BANNER) {
149
+ expect(placement.sizes).to.be.an('array');
150
+ }
151
+ switch (placement.adFormat) {
152
+ case BANNER:
153
+ expect(placement.sizes).to.be.an('array');
154
+ break;
155
+ case VIDEO:
156
+ expect(placement.playerSize).to.be.an('array');
157
+ expect(placement.minduration).to.be.an('number');
158
+ expect(placement.maxduration).to.be.an('number');
159
+ break;
160
+ case NATIVE:
161
+ expect(placement.native).to.be.an('object');
162
+ break;
163
+ }
164
+ }
165
+ });
166
+
167
+ it('Returns data with gdprConsent and without uspConsent', function () {
168
+ delete bidderRequest.uspConsent;
169
+ serverRequest = spec.buildRequests(bids, bidderRequest);
170
+ let data = serverRequest.data;
171
+ expect(data.gdpr).to.exist;
172
+ expect(data.gdpr).to.be.a('string');
173
+ expect(data.gdpr).to.equal(bidderRequest.gdprConsent);
174
+ expect(data.ccpa).to.not.exist;
175
+ delete bidderRequest.gdprConsent;
176
+ });
177
+
178
+ it('Returns data with uspConsent and without gdprConsent', function () {
179
+ bidderRequest.uspConsent = '1---';
180
+ delete bidderRequest.gdprConsent;
181
+ serverRequest = spec.buildRequests(bids, bidderRequest);
182
+ let data = serverRequest.data;
183
+ expect(data.ccpa).to.exist;
184
+ expect(data.ccpa).to.be.a('string');
185
+ expect(data.ccpa).to.equal(bidderRequest.uspConsent);
186
+ expect(data.gdpr).to.not.exist;
187
+ });
188
+
189
+ it('Returns empty data if no valid requests are passed', function () {
190
+ serverRequest = spec.buildRequests([], bidderRequest);
191
+ let data = serverRequest.data;
192
+ expect(data.placements).to.be.an('array').that.is.empty;
193
+ });
194
+ });
195
+
196
+ describe('interpretResponse', function () {
197
+ it('Should interpret banner response', function () {
198
+ const banner = {
199
+ body: [{
200
+ mediaType: 'banner',
201
+ width: 300,
202
+ height: 250,
203
+ cpm: 0.4,
204
+ ad: 'Test',
205
+ requestId: '23fhj33i987f',
206
+ ttl: 120,
207
+ creativeId: '2',
208
+ netRevenue: true,
209
+ currency: 'USD',
210
+ dealId: '1',
211
+ meta: {
212
+ advertiserDomains: ['google.com'],
213
+ advertiserId: 1234
214
+ }
215
+ }]
216
+ };
217
+ let bannerResponses = spec.interpretResponse(banner);
218
+ expect(bannerResponses).to.be.an('array').that.is.not.empty;
219
+ let dataItem = bannerResponses[0];
220
+ expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
221
+ 'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
222
+ expect(dataItem.requestId).to.equal(banner.body[0].requestId);
223
+ expect(dataItem.cpm).to.equal(banner.body[0].cpm);
224
+ expect(dataItem.width).to.equal(banner.body[0].width);
225
+ expect(dataItem.height).to.equal(banner.body[0].height);
226
+ expect(dataItem.ad).to.equal(banner.body[0].ad);
227
+ expect(dataItem.ttl).to.equal(banner.body[0].ttl);
228
+ expect(dataItem.creativeId).to.equal(banner.body[0].creativeId);
229
+ expect(dataItem.netRevenue).to.be.true;
230
+ expect(dataItem.currency).to.equal(banner.body[0].currency);
231
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
232
+ });
233
+ it('Should interpret video response', function () {
234
+ const video = {
235
+ body: [{
236
+ vastUrl: 'test.com',
237
+ mediaType: 'video',
238
+ cpm: 0.5,
239
+ requestId: '23fhj33i987f',
240
+ ttl: 120,
241
+ creativeId: '2',
242
+ netRevenue: true,
243
+ currency: 'USD',
244
+ dealId: '1',
245
+ meta: {
246
+ advertiserDomains: ['google.com'],
247
+ advertiserId: 1234
248
+ }
249
+ }]
250
+ };
251
+ let videoResponses = spec.interpretResponse(video);
252
+ expect(videoResponses).to.be.an('array').that.is.not.empty;
253
+
254
+ let dataItem = videoResponses[0];
255
+ expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
256
+ 'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
257
+ expect(dataItem.requestId).to.equal('23fhj33i987f');
258
+ expect(dataItem.cpm).to.equal(0.5);
259
+ expect(dataItem.vastUrl).to.equal('test.com');
260
+ expect(dataItem.ttl).to.equal(120);
261
+ expect(dataItem.creativeId).to.equal('2');
262
+ expect(dataItem.netRevenue).to.be.true;
263
+ expect(dataItem.currency).to.equal('USD');
264
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
265
+ });
266
+ it('Should interpret native response', function () {
267
+ const native = {
268
+ body: [{
269
+ mediaType: 'native',
270
+ native: {
271
+ clickUrl: 'test.com',
272
+ title: 'Test',
273
+ image: 'test.com',
274
+ impressionTrackers: ['test.com'],
275
+ },
276
+ ttl: 120,
277
+ cpm: 0.4,
278
+ requestId: '23fhj33i987f',
279
+ creativeId: '2',
280
+ netRevenue: true,
281
+ currency: 'USD',
282
+ meta: {
283
+ advertiserDomains: ['google.com'],
284
+ advertiserId: 1234
285
+ }
286
+ }]
287
+ };
288
+ let nativeResponses = spec.interpretResponse(native);
289
+ expect(nativeResponses).to.be.an('array').that.is.not.empty;
290
+
291
+ let dataItem = nativeResponses[0];
292
+ expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
293
+ expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
294
+ expect(dataItem.requestId).to.equal('23fhj33i987f');
295
+ expect(dataItem.cpm).to.equal(0.4);
296
+ expect(dataItem.native.clickUrl).to.equal('test.com');
297
+ expect(dataItem.native.title).to.equal('Test');
298
+ expect(dataItem.native.image).to.equal('test.com');
299
+ expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
300
+ expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
301
+ expect(dataItem.ttl).to.equal(120);
302
+ expect(dataItem.creativeId).to.equal('2');
303
+ expect(dataItem.netRevenue).to.be.true;
304
+ expect(dataItem.currency).to.equal('USD');
305
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
306
+ });
307
+ it('Should return an empty array if invalid banner response is passed', function () {
308
+ const invBanner = {
309
+ body: [{
310
+ width: 300,
311
+ cpm: 0.4,
312
+ ad: 'Test',
313
+ requestId: '23fhj33i987f',
314
+ ttl: 120,
315
+ creativeId: '2',
316
+ netRevenue: true,
317
+ currency: 'USD',
318
+ dealId: '1'
319
+ }]
320
+ };
321
+
322
+ let serverResponses = spec.interpretResponse(invBanner);
323
+ expect(serverResponses).to.be.an('array').that.is.empty;
324
+ });
325
+ it('Should return an empty array if invalid video response is passed', function () {
326
+ const invVideo = {
327
+ body: [{
328
+ mediaType: 'video',
329
+ cpm: 0.5,
330
+ requestId: '23fhj33i987f',
331
+ ttl: 120,
332
+ creativeId: '2',
333
+ netRevenue: true,
334
+ currency: 'USD',
335
+ dealId: '1'
336
+ }]
337
+ };
338
+ let serverResponses = spec.interpretResponse(invVideo);
339
+ expect(serverResponses).to.be.an('array').that.is.empty;
340
+ });
341
+ it('Should return an empty array if invalid native response is passed', function () {
342
+ const invNative = {
343
+ body: [{
344
+ mediaType: 'native',
345
+ clickUrl: 'test.com',
346
+ title: 'Test',
347
+ impressionTrackers: ['test.com'],
348
+ ttl: 120,
349
+ requestId: '23fhj33i987f',
350
+ creativeId: '2',
351
+ netRevenue: true,
352
+ currency: 'USD',
353
+ }]
354
+ };
355
+ let serverResponses = spec.interpretResponse(invNative);
356
+ expect(serverResponses).to.be.an('array').that.is.empty;
357
+ });
358
+ it('Should return an empty array if invalid response is passed', function () {
359
+ const invalid = {
360
+ body: [{
361
+ ttl: 120,
362
+ creativeId: '2',
363
+ netRevenue: true,
364
+ currency: 'USD',
365
+ dealId: '1'
366
+ }]
367
+ };
368
+ let serverResponses = spec.interpretResponse(invalid);
369
+ expect(serverResponses).to.be.an('array').that.is.empty;
370
+ });
371
+ });
372
+
373
+ describe('getUserSyncs', function() {
374
+ it('Should return array of objects with proper sync config , include GDPR', function() {
375
+ const syncData = spec.getUserSyncs({}, {}, {
376
+ consentString: 'ALL',
377
+ gdprApplies: true,
378
+ }, {});
379
+ expect(syncData).to.be.an('array').which.is.not.empty;
380
+ expect(syncData[0]).to.be.an('object')
381
+ expect(syncData[0].type).to.be.a('string')
382
+ expect(syncData[0].type).to.equal('image')
383
+ expect(syncData[0].url).to.be.a('string')
384
+ expect(syncData[0].url).to.equal('https://sa-cs.deliverimp.com/image?pbjs=1&gdpr=1&gdpr_consent=ALL&coppa=0')
385
+ });
386
+ it('Should return array of objects with proper sync config , include CCPA', function() {
387
+ const syncData = spec.getUserSyncs({}, {}, {}, {
388
+ consentString: '1---'
389
+ });
390
+ expect(syncData).to.be.an('array').which.is.not.empty;
391
+ expect(syncData[0]).to.be.an('object')
392
+ expect(syncData[0].type).to.be.a('string')
393
+ expect(syncData[0].type).to.equal('image')
394
+ expect(syncData[0].url).to.be.a('string')
395
+ expect(syncData[0].url).to.equal('https://sa-cs.deliverimp.com/image?pbjs=1&ccpa_consent=1---&coppa=0')
396
+ });
397
+ });
398
+ });
@@ -715,6 +715,26 @@ describe('consentManagement', function () {
715
715
  expect(consent).to.be.null;
716
716
  });
717
717
 
718
+ it('allows the auction when CMP is unresponsive', (done) => {
719
+ setConsentConfig({
720
+ cmpApi: 'iab',
721
+ timeout: 10,
722
+ defaultGdprScope: true
723
+ });
724
+
725
+ requestBidsHook(() => {
726
+ didHookReturn = true;
727
+ }, {});
728
+
729
+ setTimeout(() => {
730
+ expect(didHookReturn).to.be.true;
731
+ const consent = gdprDataHandler.getConsentData();
732
+ expect(consent.gdprApplies).to.be.true;
733
+ expect(consent.consentString).to.be.undefined;
734
+ done();
735
+ }, 20);
736
+ });
737
+
718
738
  it('It still considers it a valid cmp response if gdprApplies is not a boolean', function () {
719
739
  // gdprApplies is undefined, should just still store consent response but use whatever defaultGdprScope was
720
740
  let testConsentData = {
@@ -116,16 +116,19 @@ describe('CriteoId module', function () {
116
116
  expect(setCookieStub.calledWith('cto_bundle')).to.be.false;
117
117
  expect(setLocalStorageStub.calledWith('cto_bundle')).to.be.false;
118
118
  } else if (response.bundle) {
119
- expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs)).to.be.true;
119
+ expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs, null, '.com')).to.be.true;
120
+ expect(setCookieStub.calledWith('cto_bundle', response.bundle, expirationTs, null, '.testdev.com')).to.be.true;
120
121
  expect(setLocalStorageStub.calledWith('cto_bundle', response.bundle)).to.be.true;
121
122
  expect(triggerPixelStub.called).to.be.false;
122
123
  }
123
124
 
124
125
  if (response.bidId) {
125
- expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs)).to.be.true;
126
+ expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs, null, '.com')).to.be.true;
127
+ expect(setCookieStub.calledWith('cto_bidid', response.bidId, expirationTs, null, '.testdev.com')).to.be.true;
126
128
  expect(setLocalStorageStub.calledWith('cto_bidid', response.bidId)).to.be.true;
127
129
  } else {
128
- expect(setCookieStub.calledWith('cto_bidid', '', pastDateString)).to.be.true;
130
+ expect(setCookieStub.calledWith('cto_bidid', '', pastDateString, null, '.com')).to.be.true;
131
+ expect(setCookieStub.calledWith('cto_bidid', '', pastDateString, null, '.testdev.com')).to.be.true;
129
132
  expect(removeFromLocalStorageStub.calledWith('cto_bidid')).to.be.true;
130
133
  }
131
134
  });
@@ -36,11 +36,6 @@ const BidderRequestBuilder = function BidderRequestBuilder(options) {
36
36
  bidderRequestId: BID_DEFAULTS.request.bidderRequestId,
37
37
  transactionId: BID_DEFAULTS.request.transactionId,
38
38
  timeout: 3000,
39
- refererInfo: {
40
- numIframes: 0,
41
- reachedTop: true,
42
- referer: 'http://test.io/index.html?pbjs_debug=true'
43
- }
44
39
  };
45
40
 
46
41
  const request = {
@@ -82,16 +77,13 @@ const BidRequestBuilder = function BidRequestBuilder(options, deleteKeys) {
82
77
  };
83
78
 
84
79
  describe('C-WIRE bid adapter', () => {
85
- let utilsMock;
86
80
  let sandbox;
87
81
 
88
82
  beforeEach(() => {
89
- utilsMock = sinon.mock(utils);
90
83
  sandbox = sinon.createSandbox();
91
84
  });
92
85
 
93
86
  afterEach(() => {
94
- utilsMock.restore();
95
87
  sandbox.restore();
96
88
  });
97
89
 
@@ -146,6 +138,12 @@ describe('C-WIRE bid adapter', () => {
146
138
 
147
139
  describe('C-WIRE - buildRequests()', function () {
148
140
  it('creates a valid request', function () {
141
+ // for whatever reason stub for getWindowLocation does not work
142
+ // so this was the closest way to test for get params
143
+ const params = sandbox.stub(utils, 'getParameterByName');
144
+ params.withArgs('cwgroups').returns('group_1');
145
+ params.withArgs('cwcreative').returns('54321');
146
+
149
147
  const bid01 = new BidRequestBuilder({
150
148
  mediaTypes: {
151
149
  banner: {
@@ -153,12 +151,16 @@ describe('C-WIRE bid adapter', () => {
153
151
  }
154
152
  }
155
153
  }).withParams().build();
154
+
156
155
  const bidderRequest01 = new BidderRequestBuilder().build();
157
156
 
158
157
  const requests = spec.buildRequests([bid01], bidderRequest01);
158
+
159
159
  expect(requests.data.slots.length).to.equal(1);
160
160
  expect(requests.data.cwid).to.be.null;
161
161
  expect(requests.data.slots[0].sizes[0]).to.equal('1x1');
162
+ expect(requests.data.cwcreative).to.equal('54321');
163
+ expect(requests.data.refgroups[0]).to.equal('group_1');
162
164
  });
163
165
  });
164
166